From de6f745cdefd87ef157fd4e58d7a413a735ec905 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 17 Jul 2011 15:26:56 +0000 Subject: [PATCH 001/702] Add support for conditionally compiling the debug_server to hand off crashed teams to the native debugger instead. This assumes the latter is installed in /boot/system/apps. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42445 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/debug/DebugServer.cpp | 36 +++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/servers/debug/DebugServer.cpp b/src/servers/debug/DebugServer.cpp index ffdb480491..1de703726b 100644 --- a/src/servers/debug/DebugServer.cpp +++ b/src/servers/debug/DebugServer.cpp @@ -27,6 +27,9 @@ #include +#define HANDOVER_USE_GDB 1 +//#define HANDOVER_USE_DEBUGGER 1 + #define USE_GUI true // define to false if the debug server shouldn't use GUI (i.e. an alert) @@ -45,9 +48,13 @@ using std::nothrow; static const char *kSignature = "application/x-vnd.Haiku-debug_server"; // paths to the apps used for debugging +#ifdef HANDOVER_USE_GDB static const char *kConsoledPath = "/bin/consoled"; static const char *kTerminalPath = "/boot/system/apps/Terminal"; static const char *kGDBPath = "/bin/gdb"; +#elif defined(HANDOVER_USE_DEBUGGER) +static const char *kDebuggerPath = "/boot/system/apps/Debugger"; +#endif static void @@ -434,8 +441,6 @@ TeamDebugHandler::_EnterDebugger() TRACE(("debug_server: TeamDebugHandler::_EnterDebugger(): team %ld\n", fTeam)); - bool debugInConsoled = _IsGUIServer() || !_AreGUIServersAlive(); - // prepare a debugger handover TRACE(("debug_server: TeamDebugHandler::_EnterDebugger(): preparing " "debugger handover for team %ld...\n", fTeam)); @@ -448,15 +453,17 @@ TeamDebugHandler::_EnterDebugger() return error; } - // prepare the argument vector + const char *argv[16]; + int argc = 0; char teamString[32]; +#ifdef HANDOVER_USE_GDB + bool debugInConsoled = _IsGUIServer() || !_AreGUIServersAlive(); + + // prepare the argument vector snprintf(teamString, sizeof(teamString), "--pid=%ld", fTeam); const char *terminal = (debugInConsoled ? kConsoledPath : kTerminalPath); - const char *argv[16]; - int argc = 0; - argv[argc++] = terminal; if (!debugInConsoled) { @@ -477,9 +484,24 @@ TeamDebugHandler::_EnterDebugger() TRACE(("debug_server: TeamDebugHandler::_EnterDebugger(): starting " "terminal (debugger) for team %ld...\n", fTeam)); +#elif defined(HANDOVER_USE_DEBUGGER) + // prepare the argument vector + snprintf(teamString, sizeof(teamString), "%ld", fTeam); + + argv[argc++] = kDebuggerPath; + argv[argc++] = "--team"; + argv[argc++] = teamString; + argv[argc] = NULL; + + // start the debugger + TRACE(("debug_server: TeamDebugHandler::_EnterDebugger(): starting " + "graphical debugger for team %ld...\n", fTeam)); + +#endif + thread_id thread = load_image(argc, argv, (const char**)environ); if (thread < 0) { - debug_printf("debug_server: Failed to start consoled + gdb: %s\n", + debug_printf("debug_server: Failed to start debugger: %s\n", strerror(thread)); return thread; } From 9918b71672f5f48606b74f6cf76190a83778a80e Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 17 Jul 2011 16:55:28 +0000 Subject: [PATCH 002/702] - Factor out setting up the arguments for gdb handover. - When using the graphical debugger by default, fall back to setting up gdb handover if the GUI is unavailable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42446 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/debug/DebugServer.cpp | 80 ++++++++++++++++++------------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/src/servers/debug/DebugServer.cpp b/src/servers/debug/DebugServer.cpp index 1de703726b..b01da568bc 100644 --- a/src/servers/debug/DebugServer.cpp +++ b/src/servers/debug/DebugServer.cpp @@ -48,11 +48,10 @@ using std::nothrow; static const char *kSignature = "application/x-vnd.Haiku-debug_server"; // paths to the apps used for debugging -#ifdef HANDOVER_USE_GDB static const char *kConsoledPath = "/bin/consoled"; static const char *kTerminalPath = "/boot/system/apps/Terminal"; static const char *kGDBPath = "/bin/gdb"; -#elif defined(HANDOVER_USE_DEBUGGER) +#ifdef HANDOVER_USE_DEBUGGER static const char *kDebuggerPath = "/boot/system/apps/Debugger"; #endif @@ -117,6 +116,8 @@ private: status_t _PopMessage(DebugMessage *&message); thread_id _EnterDebugger(); + void _SetupGDBArguments(const char **argv, int &argc, char *teamString, + size_t teamStringSize, bool usingConsoled); void _KillTeam(); bool _HandleMessage(DebugMessage *message); @@ -435,6 +436,33 @@ TeamDebugHandler::_PopMessage(DebugMessage *&message) } +void +TeamDebugHandler::_SetupGDBArguments(const char **argv, int &argc, + char *teamString, size_t teamStringSize, bool usingConsoled) +{ + // prepare the argument vector + snprintf(teamString, teamStringSize, "--pid=%ld", fTeam); + + const char *terminal = (usingConsoled ? kConsoledPath : kTerminalPath); + + argv[argc++] = terminal; + + if (!usingConsoled) { + char windowTitle[64]; + snprintf(windowTitle, sizeof(windowTitle), "Debug of Team %ld: %s", + fTeam, _LastPathComponent(fExecutablePath)); + argv[argc++] = "-t"; + argv[argc++] = windowTitle; + } + + argv[argc++] = kGDBPath; + argv[argc++] = teamString; + if (strlen(fExecutablePath) > 0) + argv[argc++] = fExecutablePath; + argv[argc] = NULL; +} + + thread_id TeamDebugHandler::_EnterDebugger() { @@ -456,47 +484,33 @@ TeamDebugHandler::_EnterDebugger() const char *argv[16]; int argc = 0; char teamString[32]; -#ifdef HANDOVER_USE_GDB bool debugInConsoled = _IsGUIServer() || !_AreGUIServersAlive(); +#ifdef HANDOVER_USE_GDB - // prepare the argument vector - snprintf(teamString, sizeof(teamString), "--pid=%ld", fTeam); - - const char *terminal = (debugInConsoled ? kConsoledPath : kTerminalPath); - - argv[argc++] = terminal; - - if (!debugInConsoled) { - char windowTitle[64]; - snprintf(windowTitle, sizeof(windowTitle), "Debug of Team %ld: %s", - fTeam, _LastPathComponent(fExecutablePath)); - argv[argc++] = "-t"; - argv[argc++] = windowTitle; - } - - argv[argc++] = kGDBPath; - argv[argc++] = teamString; - if (strlen(fExecutablePath) > 0) - argv[argc++] = fExecutablePath; - argv[argc] = NULL; + _SetupGDBArguments(argv, argc, teamString, sizeof(teamString), + debugInConsoled); // start the terminal TRACE(("debug_server: TeamDebugHandler::_EnterDebugger(): starting " "terminal (debugger) for team %ld...\n", fTeam)); #elif defined(HANDOVER_USE_DEBUGGER) - // prepare the argument vector - snprintf(teamString, sizeof(teamString), "%ld", fTeam); + if (debugInConsoled) { + _SetupGDBArguments(argv, argc, teamString, sizeof(teamString), + debugInConsoled); + } else { + // prepare the argument vector + snprintf(teamString, sizeof(teamString), "%ld", fTeam); - argv[argc++] = kDebuggerPath; - argv[argc++] = "--team"; - argv[argc++] = teamString; - argv[argc] = NULL; - - // start the debugger - TRACE(("debug_server: TeamDebugHandler::_EnterDebugger(): starting " - "graphical debugger for team %ld...\n", fTeam)); + argv[argc++] = kDebuggerPath; + argv[argc++] = "--team"; + argv[argc++] = teamString; + argv[argc] = NULL; + // start the debugger + TRACE(("debug_server: TeamDebugHandler::_EnterDebugger(): starting " + "graphical debugger for team %ld...\n", fTeam)); + } #endif thread_id thread = load_image(argc, argv, (const char**)environ); From def39abd747d7e9f5e3866fc47d4c211cc21db83 Mon Sep 17 00:00:00 2001 From: Alexandre Deckner Date: Sun, 17 Jul 2011 17:28:29 +0000 Subject: [PATCH 003/702] * Finally finish implementing proper selection rect autoscroll to work with the new asynchronous mouse tracking. Sorry for the delay. Up to now it was needing mouse moves to autoscroll, it now behaves as before. * Removed check that was disabling regular drag'n'drop auto-scrolling when inactive. I don't see an obvious reason why that was done, as it's just handy and is consistent with the other behaviors when inactive. Note, i gotta love those comments that do anything but help, good example of how not to comment :) i.e don't comment about what will happen when the adjacent code won't be executed (especially in a case that can't happen). My brain almost exploded a second time trying to explain that! // selection scrolling will also work if the window is inactive Should read: // disable drag'n'drop auto scrolling when window is inactive git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42447 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/PoseView.cpp | 21 +++++++++++++-------- src/kits/tracker/PoseView.h | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index b407c9544b..d4dda49043 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -6579,6 +6579,11 @@ BPoseView::_BeginSelectionRect(const BPoint& point, bool shouldExtend) fSelectionRectInfo.startPoint = point; fSelectionRectInfo.lastPoint = point; fSelectionRectInfo.isDragging = true; + + if (fAutoScrollState == kAutoScrollOff) { + fAutoScrollState = kAutoScrollOn; + Window()->SetPulseRate(20000); + } } @@ -6615,8 +6620,6 @@ BPoseView::_UpdateSelectionRect(const BPoint& point) fIsDrawingSelectionRect = true; - CheckAutoScroll(point, true, true); - // use current selection rectangle to scan poses if (ViewMode() == kListMode) { SelectPosesListMode(fSelectionRectInfo.rect, @@ -9286,8 +9289,7 @@ BPoseView::HiliteDropTarget(bool hiliteState) bool -BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll, - bool selectionScrolling) +BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll) { if (!fShouldAutoScroll) return false; @@ -9297,10 +9299,6 @@ BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll, if (window == NULL) return false; - // selection scrolling will also work if the window is inactive - if (!selectionScrolling && !window->IsActive()) - return false; - BRect bounds(Bounds()); BRect extent(Extent()); @@ -9314,6 +9312,8 @@ BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll, if (ViewMode() == kListMode) border.top -= kTitleViewHeight; + bool selectionScrolling = fSelectionRectInfo.isDragging; + if (bounds.top > extent.top) { if (selectionScrolling) { keepGoing = mouseLoc.y < bounds.top; @@ -9419,6 +9419,11 @@ BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll, } } + // Force selection rect update to account for the new scrolled coords + // without a mouse move + if (selectionScrolling) + _UpdateSelectionRect(mouseLoc); + return wouldScroll; } diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index e41454a659..cfe4b5da73 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -592,7 +592,7 @@ class BPoseView : public BView { // scrolling void HandleAutoScroll(); - bool CheckAutoScroll(BPoint mouseLoc, bool shouldScroll, bool selectionScrolling = false); + bool CheckAutoScroll(BPoint mouseLoc, bool shouldScroll); // view extent handling void RecalcExtent(); From 9cf506a2bfc6c4f1364d4c6028d4a6e09af043aa Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Tue, 19 Jul 2011 03:52:42 +0000 Subject: [PATCH 004/702] Tracker: * Add "Arrange By" submenu in Window menu. * You can arrange by the same fields you can sort by in list view. Changing your sorting order in list view will change the Arrange By choice when you enter icon view and vice-versa. * Support ReverseSort order. * Keep the clean-up feature, but it's now under the Arrange By menu. Fixing ticket #1349. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42448 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/Commands.h | 4 ++ src/kits/tracker/ContainerWindow.cpp | 85 +++++++++++++++++++++++++--- src/kits/tracker/ContainerWindow.h | 5 +- src/kits/tracker/PoseView.cpp | 28 +++++++-- 4 files changed, 109 insertions(+), 13 deletions(-) diff --git a/src/kits/tracker/Commands.h b/src/kits/tracker/Commands.h index d40e69c65f..c2e19d3646 100644 --- a/src/kits/tracker/Commands.h +++ b/src/kits/tracker/Commands.h @@ -85,6 +85,10 @@ const uint32 kOpenParentDir = 'Topt'; const uint32 kOpenDir = 'Topd'; const uint32 kCleanup = 'Tcln'; const uint32 kCleanupAll = 'Tcla'; + +const uint32 kArrangeBy = 'ARBY'; +const uint32 kArrangeReverseOrder = 'ARRO'; + const uint32 kResizeToFit = 'Trtf'; const uint32 kSelectMatchingEntries = 'Tsme'; const uint32 kShowSelectionWindow = 'Tssw'; diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index f6a5d289ea..fb065e8b48 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -567,6 +567,7 @@ BContainerWindow::BContainerWindow(LockingList *list, fAttrMenu(NULL), fWindowMenu(NULL), fFileMenu(NULL), + fArrangeByMenu(NULL), fSelectionWindow(NULL), fTaskLoop(NULL), fIsTrash(false), @@ -886,6 +887,8 @@ BContainerWindow::RepopulateMenus() if (PoseView()->ViewMode() == kListMode) ShowAttributeMenu(); + PopulateArrangeByMenu(fArrangeByMenu); + int32 selectCount = PoseView()->SelectionList()->CountItems(); SetupOpenWithMenu(fFileMenu); @@ -1748,25 +1751,30 @@ BContainerWindow::SetPasteItem(BMenu *menu) void -BContainerWindow::SetCleanUpItem(BMenu *menu) +BContainerWindow::SetArrangeMenu(BMenu *menu) { BMenuItem *item; if ((item = menu->FindItem(kCleanup)) == NULL && (item = menu->FindItem(kCleanupAll)) == NULL) return; - item->SetEnabled(PoseView()->CountItems() > 0 + item->Menu()->SetEnabled(PoseView()->CountItems() > 0 && (PoseView()->ViewMode() != kListMode)); + BMenu* arrangeMenu; + if (modifiers() & B_SHIFT_KEY) { item->SetLabel(B_TRANSLATE("Clean up all")); item->SetShortcut('K', B_COMMAND_KEY | B_SHIFT_KEY); item->SetMessage(new BMessage(kCleanupAll)); + arrangeMenu = item->Menu(); } else { item->SetLabel(B_TRANSLATE("Clean up")); item->SetShortcut('K', B_COMMAND_KEY); item->SetMessage(new BMessage(kCleanup)); + arrangeMenu = item->Menu(); } + MarkArrangeByMenu(arrangeMenu); } @@ -1818,6 +1826,7 @@ BContainerWindow::AddMenus() // just create the attribute, decide to add it later fAttrMenu = new BMenu(B_TRANSLATE("Attributes")); NewAttributeMenu(fAttrMenu); + PopulateArrangeByMenu(fArrangeByMenu); } @@ -1977,9 +1986,8 @@ BContainerWindow::AddWindowMenu(BMenu *menu) item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem(B_TRANSLATE("Clean up"), new BMessage(kCleanup), 'K'); - item->SetTarget(PoseView()); - menu->AddItem(item); + fArrangeByMenu = new BMenu(B_TRANSLATE("Arrange by")); + menu->AddItem(fArrangeByMenu); item = new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS), new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY); @@ -2744,8 +2752,11 @@ BContainerWindow::AddWindowContextMenus(BMenu *menu) menu->AddItem(pasteItem); menu->AddSeparatorItem(); #endif - menu->AddItem(new BMenuItem(B_TRANSLATE("Clean up"), - new BMessage(kCleanup), 'K')); + BMenu* arrangeBy = new BMenu(B_TRANSLATE("Arrange by")); + PopulateArrangeByMenu(arrangeBy); + + menu->AddItem(arrangeBy); + menu->AddItem(new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS), new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY)); menu->AddItem(new BMenuItem(B_TRANSLATE("Select all"), @@ -3055,7 +3066,7 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context) MarkNamedMenuItem(menu, kMiniIconMode, viewMode == kMiniIconMode); SetCloseItem(menu); - SetCleanUpItem(menu); + SetArrangeMenu(menu); SetPasteItem(menu); EnableNamedMenuItem(menu, kOpenParentDir, !TargetModel()->IsRoot()); @@ -3257,6 +3268,26 @@ BContainerWindow::MarkAttributeMenu(BMenu *menu) } +void +BContainerWindow::MarkArrangeByMenu(BMenu* menu) +{ + if (!menu) + return; + + int32 count = menu->CountItems(); + for (int32 index = 0; index < count; index++) { + BMenuItem* item = menu->ItemAt(index); + if (item->Message()) { + uint32 attrHash; + if (item->Message()->FindInt32("attr_hash", (int32*)&attrHash) == B_OK) + item->SetMarked(PoseView()->PrimarySort() == attrHash); + else if (item->Command() == kArrangeReverseOrder) + item->SetMarked(PoseView()->ReverseSort()); + } + } +} + + void BContainerWindow::AddMimeTypesToMenu() { @@ -3991,6 +4022,44 @@ BContainerWindow::PulseTaskLoop() } +void +BContainerWindow::PopulateArrangeByMenu(BMenu* menu) +{ + if (!fAttrMenu || !menu) + return; + // empty fArrangeByMenu... + BMenuItem* item; + while ((item = menu->RemoveItem((int32)0)) != NULL) + delete item; + + int32 itemCount = fAttrMenu->CountItems(); + for (int32 i = 0; i < itemCount; i++) { + item = fAttrMenu->ItemAt(i); + if (item->Command() == kAttributeItem) { + BMessage* message = new BMessage(*(item->Message())); + message->what = kArrangeBy; + BMenuItem* newItem = new BMenuItem(item->Label(), message); + newItem->SetTarget(PoseView()); + menu->AddItem(newItem); + } + } + + menu->AddSeparatorItem(); + + item = new BMenuItem(B_TRANSLATE("Reverse order"), + new BMessage(kArrangeReverseOrder)); + + item->SetTarget(PoseView()); + menu->AddItem(item); + menu->AddSeparatorItem(); + + + item = new BMenuItem(B_TRANSLATE("Clean up"), new BMessage(kCleanup), 'K'); + item->SetTarget(PoseView()); + menu->AddItem(item); +} + + // #pragma mark - diff --git a/src/kits/tracker/ContainerWindow.h b/src/kits/tracker/ContainerWindow.h index dec7bc2b26..2d05ba1d7c 100644 --- a/src/kits/tracker/ContainerWindow.h +++ b/src/kits/tracker/ContainerWindow.h @@ -150,6 +150,7 @@ class BContainerWindow : public BWindow { void AddMimeTypesToMenu(); virtual void MarkAttributeMenu(BMenu *); void MarkAttributeMenu(); + void MarkArrangeByMenu(BMenu *); BMenuItem *NewAttributeMenuItem(const char *label, const char *name, int32 type, float width, int32 align, bool editable, bool statField); BMenuItem *NewAttributeMenuItem(const char *label, const char *name, @@ -216,11 +217,12 @@ class BContainerWindow : public BWindow { virtual void AddTrashContextMenus(BMenu *); virtual void RepopulateMenus(); + void PopulateArrangeByMenu(BMenu* ); virtual void SetCutItem(BMenu *); virtual void SetCopyItem(BMenu *); virtual void SetPasteItem(BMenu *); - virtual void SetCleanUpItem(BMenu *); + virtual void SetArrangeMenu(BMenu *); virtual void SetCloseItem(BMenu *); virtual void SetupNavigationMenu(const entry_ref *, BMenu *); virtual void SetupMoveCopyMenus(const entry_ref *, BMenu *); @@ -268,6 +270,7 @@ class BContainerWindow : public BWindow { BMenu *fAttrMenu; BMenu *fWindowMenu; BMenu *fFileMenu; + BMenu *fArrangeByMenu; SelectionWindow *fSelectionWindow; diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index d4dda49043..d5f6543567 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -2402,6 +2402,28 @@ BPoseView::MessageReceived(BMessage *message) be_clipboard->Unlock(); } break; + + case kArrangeBy: + { + uint32 attrHash; + if (message->FindInt32("attr_hash", (int32*)&attrHash) == B_OK) { + if (ColumnFor(attrHash) == NULL) + HandleAttrMenuItemSelected(message); + + if (PrimarySort() == attrHash) + attrHash = 0; + + SetPrimarySort(attrHash); + SetSecondarySort(0); + Cleanup(true); + } + break; + } + case kArrangeReverseOrder: + SetReverseSort(!fViewState->ReverseSort()); + Cleanup(true); + break; + case kAttributeItem: HandleAttrMenuItemSelected(message); break; @@ -2981,10 +3003,8 @@ BPoseView::SetViewMode(uint32 newMode) AddToVSList(pose); } - // sort poselist if we are switching to list mode - if (newMode == kListMode) - SortPoses(); - else + SortPoses(); + if (newMode != kListMode) RecalcExtent(); UpdateScrollRange(); From 2e3b6c53ad321a1d7dc38baab7d6a1b45c63cff9 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 19 Jul 2011 04:20:38 +0000 Subject: [PATCH 005/702] * Clean up debugging of PowerPC mmu code to be consistent * Clean up messge and error text * Begin use B_PRI* macros git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42449 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../platform/openfirmware/arch/ppc/mmu.cpp | 120 +++++++++++------- 1 file changed, 72 insertions(+), 48 deletions(-) diff --git a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp index 26a95e38e0..ccd39d4faf 100644 --- a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp +++ b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp @@ -30,6 +30,14 @@ //#define PHYSINVAL ((void *)-1) #define PHYSINVAL NULL +//#define TRACE_MMU +#ifdef TRACE_MMU +# define TRACE(x...) dprintf(x) +#else +# define TRACE(x...) ; +#endif + + segment_descriptor sSegments[16]; page_table_entry_group *sPageTable; uint32 sPageTableHashMask; @@ -62,7 +70,7 @@ static status_t find_physical_memory_ranges(size_t &total) { int memory, package; - printf("checking for memory...\n"); + dprintf("checking for memory...\n"); if (of_getprop(gChosen, "memory", &memory, sizeof(int)) == OF_FAILED) return B_ERROR; package = of_instance_to_package(memory); @@ -80,17 +88,18 @@ find_physical_memory_ranges(size_t &total) for (int32 i = 0; i < count; i++) { if (regions[i].size <= 0) { - printf("%ld: empty region\n", i); + dprintf("%ld: empty region\n", i); continue; } - printf("%ld: base = %p, size = %lu\n", i, regions[i].base, - regions[i].size); + dprintf("%" B_PRIu32 ": base = %p, size = %" B_PRIu32 "\n", i, + regions[i].base, regions[i].size); total += regions[i].size; if (insert_physical_memory_range((addr_t)regions[i].base, regions[i].size) != B_OK) { - printf("cannot map physical memory range (num ranges = %lu)!\n", + dprintf("cannot map physical memory range " + "(num ranges = %" B_PRIu32 ")!\n", gKernelArgs.num_physical_memory_ranges); return B_ERROR; } @@ -184,7 +193,8 @@ map_page(void *virtualAddress, void *physicalAddress, uint8 mode) fill_page_table_entry(&group->entry[i], virtualSegmentID, virtualAddress, physicalAddress, mode, false); - //printf("map: va = %p -> %p, mode = %d, hash = %lu\n", virtualAddress, physicalAddress, mode, hash); + //TRACE("map: va = %p -> %p, mode = %d, hash = %lu\n", + // virtualAddress, physicalAddress, mode, hash); return; } @@ -197,12 +207,12 @@ map_page(void *virtualAddress, void *physicalAddress, uint8 mode) fill_page_table_entry(&group->entry[i], virtualSegmentID, virtualAddress, physicalAddress, mode, true); - //printf("map: va = %p -> %p, mode = %d, second hash = %lu\n", virtualAddress, physicalAddress, mode, hash); + //TRACE("map: va = %p -> %p, mode = %d, second hash = %lu\n", + // virtualAddress, physicalAddress, mode, hash); return; } - panic("out of page table entries! (you would think this could not happen " - "in a boot loader...)\n"); + panic("%s: out of page table entries!\n", __func__); } @@ -226,7 +236,7 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, // we have proper driver support for the target hardware). int mmu; if (of_getprop(gChosen, "mmu", &mmu, sizeof(int)) == OF_FAILED) { - puts("no OF mmu"); + dprintf("%s: Error: no OpenFirmware mmu\n", __func__); return B_ERROR; } mmu = of_instance_to_package(mmu); @@ -241,30 +251,33 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, int length = of_getprop(mmu, "translations", &translations, sizeof(translations)); if (length == OF_FAILED) { - puts("no OF translations"); + dprintf("Error: no OF translations.\n"); return B_ERROR; } length = length / sizeof(struct translation_map); uint32 total = 0; - printf("found %d translations\n", length); + dprintf("found %d translations\n", length); for (int i = 0; i < length; i++) { struct translation_map *map = &translations[i]; bool keepRange = true; - //printf("%i: map: %p, length %d -> physical: %p, mode %d\n", i, map->virtual_address, map->length, map->physical_address, map->mode); + TRACE("%i: map: %p, length %d -> physical: %p, mode %d\n", i, + map->virtual_address, map->length, + map->physical_address, map->mode); // insert range in physical allocated, if it points to physical memory if (is_physical_memory(map->physical_address) && insert_physical_allocated_range((addr_t)map->physical_address, map->length) != B_OK) { - printf("cannot map physical allocated range (num ranges = %lu)!\n", + dprintf("cannot map physical allocated range " + "(num ranges = %" B_PRIu32 ")!\n", gKernelArgs.num_physical_allocated_ranges); return B_ERROR; } if (map->virtual_address == pageTable) { - puts("found page table!"); + dprintf("found page table\n"); *_physicalPageTable = (page_table_entry_group *)map->physical_address; keepRange = false; @@ -272,7 +285,7 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, } if ((addr_t)map->physical_address <= 0x100 && (addr_t)map->physical_address + map->length >= 0x1000) { - puts("found exception handlers!"); + dprintf("found exception handlers\n"); *_exceptionHandlers = map->virtual_address; keepRange = false; // we keep it explicitely anyway @@ -284,7 +297,8 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, if (insert_virtual_allocated_range((addr_t)map->virtual_address, map->length) != B_OK) { - printf("cannot map virtual allocated range (num ranges = %lu)!\n", + dprintf("cannot map virtual allocated range " + "(num ranges = %" B_PRIu32 ")!\n", gKernelArgs.num_virtual_allocated_ranges); } @@ -298,20 +312,21 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, if (keepRange) { if (insert_virtual_range_to_keep(map->virtual_address, map->length) != B_OK) { - printf("cannot map virtual range to keep (num ranges = %lu)!\n", + dprintf("cannot map virtual range to keep " + "(num ranges = %" B_PRIu32 ")\n", gKernelArgs.num_virtual_allocated_ranges); } } total += map->length; } - //printf("total mapped: %lu\n", total); + dprintf("total mapped: %" B_PRIu32 "\n", total); // remove the boot loader code from the virtual ranges to keep in the // kernel if (remove_virtual_range_to_keep(&__text_begin, &_end - &__text_begin) != B_OK) { - printf("find_allocated_ranges(): Failed to remove boot loader range " + dprintf("find_allocated_ranges(): Failed to remove boot loader range " "from virtual ranges to keep.\n"); } @@ -431,7 +446,7 @@ arch_mmu_allocate(void *_virtualAddress, size_t size, uint8 _protection, // fail if the exact address was requested, but is not free if (exactAddress && _virtualAddress && virtualAddress != _virtualAddress) { dprintf("arch_mmu_allocate(): exact address requested, but virtual " - "range (base: %p, size: %lu) is not free.\n", + "range (base: %p, size: %" B_PRIuSIZE ") is not free.\n", _virtualAddress, size); return NULL; } @@ -443,14 +458,14 @@ arch_mmu_allocate(void *_virtualAddress, size_t size, uint8 _protection, void *physicalAddress = find_free_physical_range(size); if (physicalAddress == PHYSINVAL) { - dprintf("arch_mmu_allocate(base: %p, size: %lu) no free physical " - "address\n", virtualAddress, size); + dprintf("arch_mmu_allocate(base: %p, size: %" B_PRIuSIZE ") " + "no free physical address\n", virtualAddress, size); return NULL; } // everything went fine, so lets mark the space as used. - printf("mmu_alloc: va %p, pa %p, size %u\n", virtualAddress, + dprintf("mmu_alloc: va %p, pa %p, size %" B_PRIuSIZE "\n", virtualAddress, physicalAddress, size); insert_virtual_allocated_range((addr_t)virtualAddress, size); insert_physical_allocated_range((addr_t)physicalAddress, size); @@ -618,7 +633,7 @@ static int callback(struct of_arguments *args) { const char *name = args->name; -printf("CALLBACK: %s\n", name); + TRACE("OF CALLBACK: %s\n", name); if (!strcmp(name, "map")) return map_callback(args); @@ -642,10 +657,10 @@ arch_set_callback(void) void *oldCallback = NULL; if (of_call_client_function("set-callback", 1, 1, &callback, &oldCallback) == OF_FAILED) { - puts("set-callback failed!"); + dprintf("Error: OpenFirmware set-callback failed\n"); return B_ERROR; } - //printf("old callback = %p\n", oldCallback); + TRACE("old callback = %p; new callback = %p\n", oldCallback, callback); return B_OK; } @@ -658,10 +673,10 @@ arch_mmu_init(void) size_t total; if (find_physical_memory_ranges(total) != B_OK) { - puts("could not find physical memory ranges!"); + dprintf("Error: could not find physical memory ranges!\n"); return B_ERROR; } - printf("total physical memory = %u MB\n", total / (1024*1024)); + dprintf("total physical memory = %" B_PRId32 "MB\n", total / (1024 * 1024)); // get OpenFirmware's current page table @@ -679,23 +694,25 @@ arch_mmu_init(void) // can we just keep the page table? size_t suggestedTableSize = suggested_page_table_size(total); - printf("suggested page table size = %u\n", suggestedTableSize); + dprintf("suggested page table size = %" B_PRIuSIZE "\n", + suggestedTableSize); if (tableSize < suggestedTableSize) { // nah, we need a new one! - printf("need new page table, size = %u!\n", suggestedTableSize); + dprintf("need new page table, size = %" B_PRIuSIZE "!\n", + suggestedTableSize); table = (page_table_entry_group *)of_claim(NULL, suggestedTableSize, suggestedTableSize); // KERNEL_BASE would be better as virtual address, but // at least with Apple's OpenFirmware, it makes no // difference - we will have to remap it later if (table == (void *)OF_FAILED) { - panic("Could not allocate new page table (size = %ld)!!\n", - suggestedTableSize); + panic("Could not allocate new page table " + "(size = %" B_PRIuSIZE ")!!\n", suggestedTableSize); return B_NO_MEMORY; } if (table == NULL) { // work-around for the broken Pegasos OpenFirmware - puts("broken OpenFirmware detected (claim doesn't work)."); + dprintf("broken OpenFirmware detected (claim doesn't work)\n"); realMode = true; addr_t tableBase = 0; @@ -706,7 +723,7 @@ arch_mmu_init(void) table = (page_table_entry_group *)tableBase; } - printf("new table at: %p\n", table); + dprintf("new table at: %p\n", table); sPageTable = table; tableSize = suggestedTableSize; } else { @@ -723,9 +740,9 @@ arch_mmu_init(void) // turn off address translation via the page table/segment mechanism, // identity map the first 256 MB (where our code/data reside) - printf("MSR: %p\n", (void *)get_msr()); + dprintf("MSR: %p\n", (void *)get_msr()); -#if 0 + #if 0 block_address_translation bat; bat.length = BAT_LENGTH_256MB; @@ -736,7 +753,7 @@ arch_mmu_init(void) set_ibat0(&bat); set_dbat0(&bat); isync(); -#endif + #endif // initialize segment descriptors, but don't set the registers // until we're about to take over the page table - we're mapping @@ -752,8 +769,8 @@ arch_mmu_init(void) void *exceptionHandlers = (void *)-1; if (find_allocated_ranges(oldTable, table, &physicalTable, &exceptionHandlers) != B_OK) { - puts("find_allocated_ranges() failed!"); - //return B_ERROR; + dprintf("Error: find_allocated_ranges() failed\n"); + return B_ERROR; } #if 0 @@ -766,14 +783,18 @@ arch_mmu_init(void) #endif if (physicalTable == NULL) { - puts("arch_mmu_init(): Didn't find physical address of page table!"); + dprintf("%s: Didn't find physical address of page table\n", __func__); if (!realMode) return B_ERROR; // Pegasos work-around - //map_range((void *)realBase, (void *)realBase, realSize * 2, PAGE_READ_WRITE); - //map_range((void *)(total - realSize), (void *)(total - realSize), realSize, PAGE_READ_WRITE); - //map_range((void *)table, (void *)table, tableSize, PAGE_READ_WRITE); + #if 0 + map_range((void *)realBase, (void *)realBase, + realSize * 2, PAGE_READ_WRITE); + map_range((void *)(total - realSize), (void *)(total - realSize), + realSize, PAGE_READ_WRITE); + map_range((void *)table, (void *)table, tableSize, PAGE_READ_WRITE); + #endif insert_physical_allocated_range(realBase, realSize * 2); insert_virtual_allocated_range(realBase, realSize * 2); insert_physical_allocated_range(total - realSize, realSize); @@ -790,7 +811,7 @@ arch_mmu_init(void) if (exceptionHandlers == (void *)-1) { // TODO: create mapping for the exception handlers - puts("no mapping for the exception handlers!"); + dprintf("Error: no mapping for the exception handlers!\n"); } // Set the Open Firmware memory callback. From now on the Open Firmware @@ -820,9 +841,12 @@ arch_mmu_init(void) // set kernel args - printf("virt_allocated: %lu\n", gKernelArgs.num_virtual_allocated_ranges); - printf("phys_allocated: %lu\n", gKernelArgs.num_physical_allocated_ranges); - printf("phys_memory: %lu\n", gKernelArgs.num_physical_memory_ranges); + dprintf("virt_allocated: %" B_PRIu32 "\n", + gKernelArgs.num_virtual_allocated_ranges); + dprintf("phys_allocated: %" B_PRIu32 "\n", + gKernelArgs.num_physical_allocated_ranges); + dprintf("phys_memory: %" B_PRIu32 "\n", + gKernelArgs.num_physical_memory_ranges); gKernelArgs.arch_args.page_table.start = (addr_t)sPageTable; gKernelArgs.arch_args.page_table.size = tableSize; From c97f0d47c1ed3ee98c8f800dc81392a1b8132591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 19 Jul 2011 16:59:50 +0000 Subject: [PATCH 006/702] * Coding style cleanup. * Removed excessive debug output, and values that aren't needed for the timing computation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42450 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../common/compute_display_timing.cpp | 182 ++++++------------ 1 file changed, 58 insertions(+), 124 deletions(-) diff --git a/src/add-ons/accelerants/common/compute_display_timing.cpp b/src/add-ons/accelerants/common/compute_display_timing.cpp index 23e69fcb1c..60f42ad7d8 100644 --- a/src/add-ons/accelerants/common/compute_display_timing.cpp +++ b/src/add-ons/accelerants/common/compute_display_timing.cpp @@ -69,8 +69,6 @@ * These mode timings can then be formatted as an XFree86 modeline * or a mode description for use by fbset(8). * - * - * * NOTES: * * The GTF allows for computation of "margins" (the visible border @@ -85,8 +83,6 @@ * I've implemented the computations but not enabled them, yet. * I should probably enable and test this at some point. * - * - * * TODO: * * o Add support for interlaced modes. @@ -118,21 +114,22 @@ #endif -#define MARGIN_PERCENT 1.8 // % of active vertical image -#define CELL_GRAN 8.0 // assumed character cell granularity -#define MIN_PORCH 1 // minimum front porch -#define V_SYNC_RQD 3 // width of vsync in lines -#define H_SYNC_PERCENT 8.0 // width of hsync as % of total line -#define MIN_VSYNC_PLUS_BP 550.0 // min time of vsync + back porch (microsec) +#define MARGIN_PERCENT 1.8 // % of active vertical image +#define CELL_GRANULARITY 8.0 + // assumed character cell granularity +#define MIN_PORCH 1 // minimum front porch +#define V_SYNC_WIDTH 3 // width of vsync in lines +#define H_SYNC_PERCENT 8.0 // width of hsync as % of total line +#define MIN_VSYNC_PLUS_BACK_PORCH 550.0 // time in microsec + +// C' and M' are part of the Blanking Duty Cycle computation + #define M 600.0 // blanking formula gradient #define C 40.0 // blanking formula offset #define K 128.0 // blanking formula scaling factor #define J 20.0 // blanking formula scaling factor - -// C' and M' are part of the Blanking Duty Cycle computation - -#define C_PRIME (((C - J) * K/256.0) + J) -#define M_PRIME (K/256.0 * M) +#define C_PRIME (((C - J) * K / 256.0) + J) +#define M_PRIME (K / 256.0 * M) /*! As defined by the GTF Timing Standard, compute the Stage 1 Parameters @@ -147,42 +144,14 @@ compute_display_timing(uint32 width, uint32 height, float refresh, || refresh < 25 || refresh > 1000) return B_BAD_VALUE; - int margins = 0; - - float h_pixels_rnd; - float v_lines_rnd; - float v_field_rate_rqd; - float top_margin; - float bottom_margin; - float interlace; - float h_period_est; - float vsync_plus_bp; - float v_back_porch; - float total_v_lines; - float v_field_rate_est; - float h_period; - float v_field_rate; - float v_frame_rate; - float left_margin; - float right_margin; - float total_active_pixels; - float ideal_duty_cycle; - float h_blank; - float total_pixels; - float pixel_freq; - float h_freq; - - float h_sync; - float h_front_porch; - float v_odd_front_porch_lines; + bool margins = false; // 1. In order to give correct results, the number of horizontal // pixels requested is first processed to ensure that it is divisible // by the character size, by rounding it to the nearest character // cell boundary: // [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND]) - h_pixels_rnd = rint((float)width / CELL_GRAN) * CELL_GRAN; - TRACE("[H PIXELS RND] %g\n", h_pixels_rnd); + width = (uint32)(rint(width / CELL_GRANULARITY) * CELL_GRANULARITY); // 2. If interlace is requested, the number of vertical lines assumed // by the calculation must be halved, as the computation calculates @@ -190,133 +159,99 @@ compute_display_timing(uint32 width, uint32 height, float refresh, // number of lines is rounded to the nearest integer. // [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0), // ROUND([V LINES],0)) - v_lines_rnd = interlaced - ? (double)height / 2.0 : (double)height; - TRACE("[V LINES RND] %g\n", v_lines_rnd); + float verticalLines = interlaced ? (double)height / 2.0 : (double)height; // 3. Find the frame rate required: // [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2, // [I/P FREQ RQD]) - v_field_rate_rqd = interlaced ? refresh * 2.0 : refresh; - TRACE("[V FIELD RATE RQD] %g\n", v_field_rate_rqd); + float verticalFieldRate = interlaced ? refresh * 2.0 : refresh; // 4. Find number of lines in Top margin: // [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y", // ROUND(([MARGIN%]/100*[V LINES RND]),0), 0) - top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : 0.0; - TRACE("[TOP MARGIN (LINES)] %g\n", top_margin); + float topMargin = margins ? rint(MARGIN_PERCENT / 100.0 * verticalLines) + : 0.0; // 5. Find number of lines in Bottom margin: // [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y", // ROUND(([MARGIN%]/100*[V LINES RND]),0), 0) - bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : 0.0; - TRACE("[BOT MARGIN (LINES)] %g\n", bottom_margin); + float bottomMargin = margins ? rint(MARGIN_PERCENT / 100.0 * verticalLines) + : 0.0; // 6. If interlace is required, then set variable [INTERLACE]=0.5: // [INTERLACE]=(IF([INT RQD?]="y",0.5,0)) - interlace = interlaced ? 0.5 : 0.0; - TRACE("[INTERLACE] %g\n", interlace); + float interlace = interlaced ? 0.5 : 0.0; // 7. Estimate the Horizontal period // [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) // / ([V LINES RND] + (2*[TOP MARGIN (LINES)]) // + [MIN PORCH RND]+[INTERLACE]) * 1000000 - h_period_est = (((1.0 / v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP / 1000000.0)) - / (v_lines_rnd + (2 * top_margin) + MIN_PORCH + interlace) * 1000000.0); - TRACE("[H PERIOD EST] %g\n", h_period_est); + float horizontalPeriodEstimate = (1.0 / verticalFieldRate + - MIN_VSYNC_PLUS_BACK_PORCH / 1000000.0) + / (verticalLines + (2 * topMargin) + MIN_PORCH + interlace) * 1000000.0; // 8. Find the number of lines in V sync + back porch: // [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0) - vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est); - TRACE("[V SYNC+BP] %g\n", vsync_plus_bp); - - // 9. Find the number of lines in V back porch alone: - // [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND] - // XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]? - v_back_porch = vsync_plus_bp - V_SYNC_RQD; - TRACE("[V BACK PORCH] %g\n", v_back_porch); + float verticalSyncPlusBackPorch = rint(MIN_VSYNC_PLUS_BACK_PORCH + / horizontalPeriodEstimate); // 10. Find the total number of lines in Vertical field period: // [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] // + [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] + [MIN PORCH RND] - total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp + - interlace + MIN_PORCH; - TRACE("[TOTAL V LINES] %g\n", total_v_lines); + float totalVerticalLines = verticalLines + topMargin + bottomMargin + + verticalSyncPlusBackPorch + interlace + MIN_PORCH; // 11. Estimate the Vertical field frequency: // [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000 - v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0; - TRACE("[V FIELD RATE EST] %g\n", v_field_rate_est); + float verticalFieldRateEstimate = 1.0 / horizontalPeriodEstimate + / totalVerticalLines * 1000000.0; // 12. Find the actual horizontal period: // [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST]) - h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est); - TRACE("[H PERIOD] %g\n", h_period); - - // 13. Find the actual Vertical field frequency: - // [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000 - v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0; - TRACE("[V FIELD RATE] %g\n", v_field_rate); - - // 14. Find the Vertical frame frequency: - // [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE])) - v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate; - TRACE("[V FRAME RATE] %g\n", v_frame_rate); + float horizontalPeriod = horizontalPeriodEstimate + / (verticalFieldRate / verticalFieldRateEstimate); // 15. Find number of pixels in left margin: // [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", // (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / // [CELL GRAN RND]),0)) * [CELL GRAN RND], 0)) - left_margin = margins - ? rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN - : 0.0; - TRACE("[LEFT MARGIN (PIXELS)] %g\n", left_margin); + float leftMargin = margins ? rint(width * MARGIN_PERCENT / 100.0 + / CELL_GRANULARITY) * CELL_GRANULARITY : 0.0; // 16. Find number of pixels in right margin: // [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", // (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / // [CELL GRAN RND]),0)) * [CELL GRAN RND], 0)) - right_margin = margins - ? rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN - : 0.0; - TRACE("[RIGHT MARGIN (PIXELS)] %g\n", right_margin); + float rightMargin = margins ? rint(width * MARGIN_PERCENT / 100.0 + / CELL_GRANULARITY) * CELL_GRANULARITY : 0.0; // 17. Find total number of active pixels in image and left and right // margins: // [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] // + [RIGHT MARGIN (PIXELS)] - total_active_pixels = h_pixels_rnd + left_margin + right_margin; - TRACE("[TOTAL ACTIVE PIXELS] %g\n", total_active_pixels); + float totalActivePixels = width + leftMargin + rightMargin; // 18. Find the ideal blanking duty cycle from the blanking duty cycle // equation: // [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000) - ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0); - TRACE("[IDEAL DUTY CYCLE] %g\n", ideal_duty_cycle); + float idealDutyCycle = C_PRIME - (M_PRIME * horizontalPeriod / 1000.0); // 19. Find the number of pixels in the blanking time to the nearest // double character cell: // [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] // * [IDEAL DUTY CYCLE] / (100-[IDEAL DUTY CYCLE]) // / (2*[CELL GRAN RND])), 0)) * (2*[CELL GRAN RND]) - h_blank = rint(total_active_pixels * ideal_duty_cycle - / (100.0 - ideal_duty_cycle) / (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN); - TRACE("[H BLANK (PIXELS)] %g\n", h_blank); + float horizontalBlank = rint(totalActivePixels * idealDutyCycle + / (100.0 - idealDutyCycle) / (2.0 * CELL_GRANULARITY)) + * (2.0 * CELL_GRANULARITY); // 20. Find total number of pixels: // [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)] - total_pixels = total_active_pixels + h_blank; - TRACE("[TOTAL PIXELS] %g\n", total_pixels); + float totalPixels = totalActivePixels + horizontalBlank; // 21. Find pixel clock frequency: // [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD] - pixel_freq = total_pixels / h_period; - TRACE("[PIXEL FREQ] %g\n", pixel_freq); - - // 22. Find horizontal frequency: - // [H FREQ] = 1000 / [H PERIOD] - h_freq = 1000.0 / h_period; - TRACE("[H FREQ] %g\n", h_freq); + float pixelFrequency = totalPixels / horizontalPeriod; // Stage 1 computations are now complete; I should really pass // the results to another function and do the Stage 2 @@ -326,31 +261,30 @@ compute_display_timing(uint32 width, uint32 height, float refresh, // 17. Find the number of pixels in the horizontal sync period: // [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] // / [CELL GRAN RND]),0))*[CELL GRAN RND] - h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN; - TRACE("[H SYNC (PIXELS)] %g\n", h_sync); + float horizontalSync = rint(H_SYNC_PERCENT / 100.0 * totalPixels + / CELL_GRANULARITY) * CELL_GRANULARITY; // 18. Find the number of pixels in the horizontal front porch period: // [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)] - h_front_porch = (h_blank / 2.0) - h_sync; - TRACE("[H FRONT PORCH (PIXELS)] %g\n", h_front_porch); + float horizontalFrontPorch = (horizontalBlank / 2.0) - horizontalSync; // 36. Find the number of lines in the odd front porch period: // [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE]) - v_odd_front_porch_lines = MIN_PORCH + interlace; - TRACE("[V ODD FRONT PORCH(LINES)] %g\n", v_odd_front_porch_lines); + float verticalOddFrontPorchLines = MIN_PORCH + interlace; // finally, pack the results in the mode struct - timing->pixel_clock = uint32(pixel_freq * 1000); - timing->h_display = (uint16)h_pixels_rnd; - timing->h_sync_start = (uint16)(h_pixels_rnd + h_front_porch); - timing->h_sync_end = (uint16)(h_pixels_rnd + h_front_porch + h_sync); - timing->h_total = (uint16)total_pixels; - timing->v_display = (uint16)v_lines_rnd; - timing->v_sync_start = (uint16)(v_lines_rnd + v_odd_front_porch_lines); - timing->v_sync_end = (uint16)(v_lines_rnd + v_odd_front_porch_lines - + V_SYNC_RQD); - timing->v_total = (uint16)total_v_lines; + timing->pixel_clock = uint32(pixelFrequency * 1000); + timing->h_display = (uint16)width; + timing->h_sync_start = (uint16)(width + horizontalFrontPorch); + timing->h_sync_end + = (uint16)(width + horizontalFrontPorch + horizontalSync); + timing->h_total = (uint16)totalPixels; + timing->v_display = (uint16)verticalLines; + timing->v_sync_start = (uint16)(verticalLines + verticalOddFrontPorchLines); + timing->v_sync_end + = (uint16)(verticalLines + verticalOddFrontPorchLines + V_SYNC_WIDTH); + timing->v_total = (uint16)totalVerticalLines; timing->flags = B_POSITIVE_HSYNC | B_POSITIVE_VSYNC | (interlace ? B_TIMING_INTERLACED : 0); From 0c4f821caac245dd1aff2688be85eab8c9cdecb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 19 Jul 2011 17:08:45 +0000 Subject: [PATCH 007/702] * Removed the previous version of the GTF function, since a few rounding errors have been introduced, and also support for interlace mode had been removed. * Instead, the Screen preferences are now using the common accelerant code for this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42451 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/screen/Jamfile | 4 +- src/preferences/screen/ScreenMode.cpp | 16 +-- src/preferences/screen/gtf.cpp | 146 -------------------------- src/preferences/screen/gtf.h | 18 ---- 4 files changed, 10 insertions(+), 174 deletions(-) delete mode 100644 src/preferences/screen/gtf.cpp delete mode 100644 src/preferences/screen/gtf.h diff --git a/src/preferences/screen/Jamfile b/src/preferences/screen/Jamfile index f0999b5003..d89e504f6f 100644 --- a/src/preferences/screen/Jamfile +++ b/src/preferences/screen/Jamfile @@ -3,13 +3,13 @@ SubDir HAIKU_TOP src preferences screen ; SetSubDirSupportedPlatformsBeOSCompatible ; AddSubDirSupportedPlatforms libbe_test ; +UsePrivateHeaders [ FDirName graphics common ] ; UsePrivateHeaders [ FDirName graphics radeon ] ; UsePrivateHeaders interface ; Preference Screen : AlertView.cpp AlertWindow.cpp - gtf.cpp MonitorView.cpp multimon.cpp RefreshSlider.cpp @@ -19,7 +19,7 @@ Preference Screen : ScreenSettings.cpp ScreenWindow.cpp Utility.cpp - : be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) + : be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) libaccelerantscommon.a : Screen.rdef ; diff --git a/src/preferences/screen/ScreenMode.cpp b/src/preferences/screen/ScreenMode.cpp index ee1d3b117a..748632e269 100644 --- a/src/preferences/screen/ScreenMode.cpp +++ b/src/preferences/screen/ScreenMode.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2009, Haiku. + * Copyright 2005-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -8,15 +8,16 @@ #include "ScreenMode.h" -#include "gtf.h" - -#include -#include #include #include #include +#include +#include + +#include + /* Note, this headers defines a *private* interface to the Radeon accelerant. * It's a solution that works with the current BeOS interface that Haiku @@ -626,9 +627,8 @@ ScreenMode::_GetDisplayMode(const screen_mode& mode, display_mode& displayMode) // For the mode selected by the width, height, and refresh rate, compute // the video timing parameters for the mode by using the VESA Generalized // Timing Formula (GTF). - - ComputeGTFVideoTiming(displayMode.timing.h_display, - displayMode.timing.v_display, mode.refresh, displayMode.timing); + compute_display_timing(mode.width, mode.height, mode.refresh, false, + &displayMode.timing); return true; } diff --git a/src/preferences/screen/gtf.cpp b/src/preferences/screen/gtf.cpp deleted file mode 100644 index c5ca1b72e8..0000000000 --- a/src/preferences/screen/gtf.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2009 Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. - * - * Authors: - * Gerald Zajac - */ - -/* Copyright (c) 2001, Andy Ritger aritger@nvidia.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * o Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * o Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * o Neither the name of NVIDIA nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - - -/*! This file contains function(s) to generate video mode timings using the - GTF Timing Standard, based on VESA.org's GTF_V1R1.xls. -*/ - - -#include "gtf.h" - -#include - - -#define CELL_GRAN 8.0 // assumed character cell granularity -#define MIN_PORCH 1 // minimum front porch -#define V_SYNC_RQD 3 // width of vsync in lines -#define H_SYNC_PERCENT 8.0 // width of hsync as % of total line -#define MIN_VSYNC_PLUS_BP 550.0 // min time of vsync + back porch (microsec) - -// C' and M' are part of the Blanking Duty Cycle computation. - -#define C_PRIME 30.0 -#define M_PRIME 300.0 - - -/*! Computes the timing values for the specified video mode using the - VESA Generalized Timing Formula (GTF). - \a width is the display width in pixels, \a lines is the display height - in lines, and \a refreshRate is the refresh rate in Hz. The computed - timing values are returned in \a modeTiming. -*/ -void -ComputeGTFVideoTiming(int width, int lines, double refreshRate, - display_timing& modeTiming) -{ - // In order to give correct results, the number of horizontal pixels - // requested is first processed to ensure that it is divisible by the - // character size, by rounding it to the nearest character cell boundary. - - width = int((width / CELL_GRAN) * CELL_GRAN); - - // Estimate the Horizontal period. - - double horizontalPeriodEstimate = (((1.0 / refreshRate) - - (MIN_VSYNC_PLUS_BP / 1000000.0)) / (lines + MIN_PORCH) * 1000000.0); - - // Compute the number of lines in V sync + back porch. - - double verticalSyncAndBackPorch - = rint(MIN_VSYNC_PLUS_BP / horizontalPeriodEstimate); - - // Compute the total number of lines in Vertical field period. - - double totalLines = lines + verticalSyncAndBackPorch + MIN_PORCH; - - // Estimate the Vertical field frequency. - - double verticalFieldRateEstimate = 1.0 / horizontalPeriodEstimate - / totalLines * 1000000.0; - - // Compute the actual horizontal period. - - double horizontalPeriod = horizontalPeriodEstimate - / (refreshRate / verticalFieldRateEstimate); - - // Compute the ideal blanking duty cycle from the blanking duty cycle - // equation. - - double idealDutyCycle = C_PRIME - (M_PRIME * horizontalPeriod / 1000.0); - - // Compute the number of pixels in the horizontal blanking time to the - // nearest double character cell. - - double horizontalBlank = rint(width * idealDutyCycle - / (100.0 - idealDutyCycle) - / (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN); - - // Compute the total number of pixels in a horizontal line. - - double totalWidth = width + horizontalBlank; - - // Compute the number of pixels in the horizontal sync period. - - double horizontalSync - = rint(H_SYNC_PERCENT / 100.0 * totalWidth / CELL_GRAN) * CELL_GRAN; - - // Compute the number of pixels in the horizontal front porch period. - - double horizontalFrontPorch = (horizontalBlank / 2.0) - horizontalSync; - - // Finally, return the results in a display_timing struct. - - modeTiming.pixel_clock = uint32(totalWidth * 1000.0 / horizontalPeriod); - - modeTiming.h_display = uint16(width); - modeTiming.h_sync_start = uint16(width + horizontalFrontPorch); - modeTiming.h_sync_end - = uint16(width + horizontalFrontPorch + horizontalSync); - modeTiming.h_total = uint16(totalWidth); - - modeTiming.v_display = uint16(lines); - modeTiming.v_sync_start = uint16(lines + MIN_PORCH); - modeTiming.v_sync_end = uint16(lines + MIN_PORCH + V_SYNC_RQD); - modeTiming.v_total = uint16(totalLines); - - modeTiming.flags = B_POSITIVE_VSYNC; - // GTF timings use -hSync and +vSync -} diff --git a/src/preferences/screen/gtf.h b/src/preferences/screen/gtf.h deleted file mode 100644 index 73a8d17ec1..0000000000 --- a/src/preferences/screen/gtf.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2009 Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. - * - * Authors: - * Gerald Zajac - */ -#ifndef GTF_H -#define GTF_H - - -#include - - -void ComputeGTFVideoTiming(int width, int lines, double refreshRate, - display_timing& modeTiming); - -#endif // GTF_H From 78c704eee7fad2644a8efc9cd838aa32920fd62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 19 Jul 2011 17:42:36 +0000 Subject: [PATCH 008/702] * Build fix due to the changes in Screen. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42452 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/screenmode/Jamfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/bin/screenmode/Jamfile b/src/bin/screenmode/Jamfile index b39ab54cda..3cec7da3b5 100644 --- a/src/bin/screenmode/Jamfile +++ b/src/bin/screenmode/Jamfile @@ -2,6 +2,7 @@ SubDir HAIKU_TOP src bin screenmode ; SetSubDirSupportedPlatformsBeOSCompatible ; +UsePrivateHeaders [ FDirName graphics common ] ; UsePrivateHeaders [ FDirName graphics radeon ] ; # for multimon.h @@ -11,13 +12,8 @@ BinCommand screenmode : screenmode.cpp # from Screen preferences - gtf.cpp multimon.cpp ScreenMode.cpp - : be $(TARGET_LIBSUPC++) + : be $(TARGET_LIBSUPC++) libaccelerantscommon.a ; - -#SEARCH on [ FGristFiles -# ScreenMode.cpp -# ] = [ FDirName $(HAIKU_TOP) src preferences screen ] ; From c80809a3ab0b0a2ce53ea861a2b00ace24ff452d Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Tue, 19 Jul 2011 18:14:29 +0000 Subject: [PATCH 009/702] This should fix crashes due to bad initialization. Completely untested. Might help with ticket #3241 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42453 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/game/FileGameSound.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/kits/game/FileGameSound.cpp b/src/kits/game/FileGameSound.cpp index 1c0ba42c49..50b16c7a65 100644 --- a/src/kits/game/FileGameSound.cpp +++ b/src/kits/game/FileGameSound.cpp @@ -353,10 +353,18 @@ BFileGameSound::IsPaused() status_t BFileGameSound::Init(const entry_ref* file) { - fAudioStream = new _gs_media_tracker; - memset(fAudioStream, 0, sizeof(_gs_media_tracker)); + fAudioStream = new(std::nothrow) _gs_media_tracker; + if (!fAudioStream) + return B_NO_MEMORY; - fAudioStream->file = new BMediaFile(file); + memset(fAudioStream, 0, sizeof(_gs_media_tracker)); + fAudioStream->file = new(std::nothrow) BMediaFile(file); + if (!fAudioStream->file) { + delete fAudioStream; + fAudioStream = NULL; + return B_NO_MEMORY; + } + status_t error = fAudioStream->file->InitCheck(); if (error != B_OK) return error; @@ -365,19 +373,28 @@ BFileGameSound::Init(const entry_ref* file) // is this is an audio file? media_format playFormat; - if ((error = fAudioStream->stream->EncodedFormat(&playFormat)) != B_OK) + if ((error = fAudioStream->stream->EncodedFormat(&playFormat)) != B_OK) { + fAudioStream->file->ReleaseTrack(fAudioStream->stream); + fAudioStream->stream = NULL; return error; + } - if (!playFormat.IsAudio()) + if (!playFormat.IsAudio()) { + fAudioStream->file->ReleaseTrack(fAudioStream->stream); + fAudioStream->stream = NULL; return B_MEDIA_BAD_FORMAT; + } gs_audio_format dformat = Device()->Format(); // request the format we want the sound memset(&playFormat, 0, sizeof(media_format)); playFormat.type = B_MEDIA_RAW_AUDIO; - if (fAudioStream->stream->DecodedFormat(&playFormat) != B_OK) + if (fAudioStream->stream->DecodedFormat(&playFormat) != B_OK) { + fAudioStream->file->ReleaseTrack(fAudioStream->stream); + fAudioStream->stream = NULL; return B_MEDIA_BAD_FORMAT; + } // translate the format into a "GameKit" friendly one gs_audio_format gsformat; @@ -410,6 +427,9 @@ BFileGameSound::Init(const entry_ref* file) bool BFileGameSound::Load() { + if (!fAudioStream || !fAudioStream->stream) + return false; + // read a new buffer int64 frames = 0; fAudioStream->stream->ReadFrames(fBuffer, &frames); From d3d53515a9e81be00e5c1d6eefa819de0098b2dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 19 Jul 2011 18:16:58 +0000 Subject: [PATCH 010/702] * Add the width, and height to fill_display_mode(). This should help with #7751 this time. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42454 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/common/create_display_modes.h | 4 ++-- src/add-ons/accelerants/common/create_display_modes.cpp | 8 ++++---- src/add-ons/accelerants/vesa/mode.cpp | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/headers/private/graphics/common/create_display_modes.h b/headers/private/graphics/common/create_display_modes.h index f7c79a7fcd..8e3180080b 100644 --- a/headers/private/graphics/common/create_display_modes.h +++ b/headers/private/graphics/common/create_display_modes.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2007-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ #ifndef _CREATE_DISPLAY_MODES_H @@ -23,7 +23,7 @@ area_id create_display_modes(const char* name, edid1_info* edid, const color_space* spaces, uint32 spacesCount, check_display_mode_hook hook, display_mode** _modes, uint32* _count); -void fill_display_mode(display_mode* mode); +void fill_display_mode(uint32 width, uint32 height, display_mode* mode); #ifdef __cplusplus } diff --git a/src/add-ons/accelerants/common/create_display_modes.cpp b/src/add-ons/accelerants/common/create_display_modes.cpp index 7e53f48a1c..778de4e4dd 100644 --- a/src/add-ons/accelerants/common/create_display_modes.cpp +++ b/src/add-ons/accelerants/common/create_display_modes.cpp @@ -399,7 +399,7 @@ ModeList::_AddBaseMode(uint16 width, uint16 height, uint32 refresh) != B_OK) return; - fill_display_mode(&mode); + fill_display_mode(width, height, &mode); _AddMode(mode); } @@ -518,11 +518,11 @@ create_display_modes(const char* name, edid1_info* edid, void -fill_display_mode(display_mode* mode) +fill_display_mode(uint32 width, uint32 height, display_mode* mode) { mode->space = B_CMAP8; - mode->virtual_width = mode->timing.h_display; - mode->virtual_height = mode->timing.v_display; + mode->virtual_width = width; + mode->virtual_height = height; mode->h_display_start = 0; mode->v_display_start = 0; mode->flags = MODE_FLAGS; diff --git a/src/add-ons/accelerants/vesa/mode.cpp b/src/add-ons/accelerants/vesa/mode.cpp index d010b99ec5..5780015e10 100644 --- a/src/add-ons/accelerants/vesa/mode.cpp +++ b/src/add-ons/accelerants/vesa/mode.cpp @@ -90,7 +90,8 @@ create_mode_list(void) for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) { compute_display_timing(vesaModes[i].width, vesaModes[i].height, 60, false, &initialModes[i].timing); - fill_display_mode(&initialModes[i]); + fill_display_mode(vesaModes[i].width, vesaModes[i].height, + &initialModes[i]); } } } From 6cb28af8fdade41425f3c9c21dcb9d3a23bc8775 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Tue, 19 Jul 2011 20:54:21 +0000 Subject: [PATCH 011/702] Remove unsave usage of strncpy. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42455 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/game/GameProducer.cpp | 8 ++++---- src/kits/game/WindowScreen.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/kits/game/GameProducer.cpp b/src/kits/game/GameProducer.cpp index 993eb9ea12..f65fabcca5 100644 --- a/src/kits/game/GameProducer.cpp +++ b/src/kits/game/GameProducer.cpp @@ -55,7 +55,7 @@ GameProducer::GameProducer(GameSoundBuffer* object, fPreferredFormat.u.raw_audio.channel_count = format->channel_count; fPreferredFormat.u.raw_audio.frame_rate = format->frame_rate; // measured in Hertz fPreferredFormat.u.raw_audio.byte_order = format->byte_order; -// fPreferredFormat.u.raw_audio.channel_mask = B_CHANNEL_LEFT & B_CHANNEL_RIGHT; +// fPreferredFormat.u.raw_audio.channel_mask = B_CHANNEL_LEFT | B_CHANNEL_RIGHT; // fPreferredFormat.u.raw_audio.valid_bits = 32; // fPreferredFormat.u.raw_audio.matrix_mask = B_MATRIX_AMBISONIC_WXYZ; @@ -186,7 +186,7 @@ GameProducer::PrepareToConnect(const media_source& what, const media_destination fOutput.destination = where; fOutput.format = *format; *out_source = fOutput.source; - strncpy(out_name, fOutput.name, B_MEDIA_NAME_LENGTH); + strlcpy(out_name, fOutput.name, B_MEDIA_NAME_LENGTH); return B_OK; } @@ -207,7 +207,7 @@ GameProducer::Connect(status_t error, const media_source& source, const media_de // that we agreed on, and report our connection name again. fOutput.destination = destination; fOutput.format = format; - strncpy(io_name, fOutput.name, B_MEDIA_NAME_LENGTH); + strlcpy(io_name, fOutput.name, B_MEDIA_NAME_LENGTH); // Now that we're connected, we can determine our downstream latency. // Do so, then make sure we get our events early enough. @@ -393,7 +393,7 @@ GameProducer::NodeRegistered() fOutput.source.port = ControlPort(); fOutput.source.id = 0; fOutput.node = Node(); - ::strcpy(fOutput.name, "GameProducer Output"); + strlcpy(fOutput.name, "GameProducer Output", B_MEDIA_NAME_LENGTH); } diff --git a/src/kits/game/WindowScreen.cpp b/src/kits/game/WindowScreen.cpp index b6ebed418a..38d482b2f4 100644 --- a/src/kits/game/WindowScreen.cpp +++ b/src/kits/game/WindowScreen.cpp @@ -844,9 +844,9 @@ BWindowScreen::_GetCardInfo() fCardInfo.height = mode.virtual_height; if (mode.space & 0x10) - strncpy(fCardInfo.rgba_order, "rgba", 4); + memcpy(fCardInfo.rgba_order, "rgba", 4); else - strncpy(fCardInfo.rgba_order, "bgra", 4); + memcpy(fCardInfo.rgba_order, "bgra", 4); fCardInfo.flags = 0; if (mode.flags & B_SCROLL) From 69b1511d01b442f0eba706e3384310b822990839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 19 Jul 2011 21:54:27 +0000 Subject: [PATCH 012/702] * Don't crash on invalid EDID modes. * This might fix #7847, as well as #7510. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42456 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/dump_edid.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/add-ons/accelerants/common/dump_edid.c b/src/add-ons/accelerants/common/dump_edid.c index 5001c9225b..f1a3f1ed5d 100644 --- a/src/add-ons/accelerants/common/dump_edid.c +++ b/src/add-ons/accelerants/common/dump_edid.c @@ -35,7 +35,8 @@ edid_dump(edid1_info *edid) edid->version.revision); dprintf("Type: %s\n", edid->display.input_type ? "Digital" : "Analog"); - dprintf("Size: %d cm x %d cm\n", edid->display.h_size, edid->display.v_size); + dprintf("Size: %d cm x %d cm\n", edid->display.h_size, + edid->display.v_size); dprintf("Gamma=%.3f\n", (edid->display.gamma + 100) / 100.0); dprintf("White (X,Y)=(%.3f,%.3f)\n", edid->display.white_x / 1024.0, edid->display.white_y / 1024.0); @@ -151,21 +152,29 @@ edid_dump(edid1_info *edid) case EDID1_IS_DETAILED_TIMING: { edid1_detailed_timing *timing = &monitor->data.detailed_timing; + if (timing->h_active + timing->h_blank == 0 + || timing->v_active + timing->v_blank == 0) { + dprintf("Invalid video mode (%dx%d)\n", timing->h_active, + timing->v_active); + continue; + } dprintf("Additional Video Mode (%dx%d@%dHz):\n", timing->h_active, timing->v_active, (timing->pixel_clock * 10000 - / (timing->h_active + timing->h_blank) - / (timing->v_active + timing->v_blank))); + / (timing->h_active + timing->h_blank) + / (timing->v_active + timing->v_blank))); // Refresh rate = pixel clock in MHz / Htotal / Vtotal dprintf("clock=%f MHz\n", timing->pixel_clock / 100.0); dprintf("h: (%d, %d, %d, %d)\n", timing->h_active, timing->h_active + timing->h_sync_off, - timing->h_active + timing->h_sync_off + timing->h_sync_width, + timing->h_active + timing->h_sync_off + + timing->h_sync_width, timing->h_active + timing->h_blank); dprintf("v: (%d, %d, %d, %d)\n", timing->v_active, timing->v_active + timing->v_sync_off, - timing->v_active + timing->v_sync_off + timing->v_sync_width, + timing->v_active + timing->v_sync_off + + timing->v_sync_width, timing->v_active + timing->v_blank); dprintf("size: %.1f cm x %.1f cm\n", timing->h_size / 10.0, timing->v_size / 10.0); From 55715512617f711f9bbdf68fd1440f84545e4efc Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 19 Jul 2011 22:39:05 +0000 Subject: [PATCH 013/702] For value nodes with deferred child creation, value loading needs to be requested once the deferred load has been complete, otherwise their values would never be loaded if their parent node was already expanded while stepping through the debugger. There still remains an issue with saving/restoring view state for such nodes though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42457 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../gui/team_window/VariablesView.cpp | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index 265f3b2368..d293e9059a 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -48,7 +48,8 @@ enum { enum { - MSG_MODEL_NODE_HIDDEN = 'monh' + MSG_MODEL_NODE_HIDDEN = 'monh', + MSG_VALUE_NODE_NEEDS_VALUE = 'mvnv' }; @@ -70,6 +71,8 @@ public: virtual void ModelNodeHidden(ModelNode* node); + virtual void ModelNodeValueRequested(ModelNode* node); + private: BHandler* fIndirectTarget; VariableTableModel* fModel; @@ -689,6 +692,20 @@ VariablesView::ContainerListener::ModelNodeHidden(ModelNode* node) } +void +VariablesView::ContainerListener::ModelNodeValueRequested(ModelNode* node) +{ + BReference nodeReference(node); + + BMessage message(MSG_VALUE_NODE_NEEDS_VALUE); + if (message.AddPointer("node", node) == B_OK + && fIndirectTarget->Looper()->PostMessage(&message, fIndirectTarget) + == B_OK) { + nodeReference.Detach(); + } +} + + // #pragma mark - VariableTableModel @@ -845,6 +862,13 @@ VariablesView::VariableTableModel::ValueNodeChildrenCreated( _AddNode(modelNode->GetVariable(), modelNode, child, child->IsInternal(), childCount == 1); } + + if (valueNode->ChildCreationNeedsValue()) { + ModelNode* childNode = fNodeTable.Lookup(child); + if (childNode != NULL) + fContainerListener->ModelNodeValueRequested(childNode); + } + } } @@ -882,6 +906,12 @@ VariablesView::VariableTableModel::ValueNodeValueChanged(ValueNode* valueNode) status_t error = valueNode->CreateChildren(); if (error != B_OK) return; + + for (int32 i = 0; i < valueNode->CountChildren(); i++) { + ValueNodeChild* child = valueNode->ChildAt(i); + _CreateValueNode(child); + _AddChildNodes(child); + } } // check whether the value actually changed @@ -1407,6 +1437,7 @@ VariablesView::MessageReceived(BMessage* message) break; } + case MSG_VALUE_NODE_NEEDS_VALUE: case MSG_MODEL_NODE_HIDDEN: { ModelNode* node; From a1a978ff21c8d02ed202833e0fabd33b2f2d3254 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 20 Jul 2011 17:06:13 +0000 Subject: [PATCH 014/702] * Clean up translation debug output * Few small style cleanups * No functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42458 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../platform/openfirmware/arch/ppc/mmu.cpp | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp index ccd39d4faf..7bd8e0b32b 100644 --- a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp +++ b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp @@ -114,9 +114,8 @@ is_virtual_allocated(void *address, size_t size) { addr_t foundBase; return !get_free_address_range(gKernelArgs.virtual_allocated_range, - gKernelArgs.num_virtual_allocated_ranges, (addr_t)address, size, - &foundBase) - || foundBase != (addr_t)address; + gKernelArgs.num_virtual_allocated_ranges, (addr_t)address, size, + &foundBase) || foundBase != (addr_t)address; } @@ -125,10 +124,9 @@ is_physical_allocated(void *address, size_t size) { phys_addr_t foundBase; return !get_free_physical_address_range( - gKernelArgs.physical_allocated_range, - gKernelArgs.num_physical_allocated_ranges, (addr_t)address, size, - &foundBase) - || foundBase != (addr_t)address; + gKernelArgs.physical_allocated_range, + gKernelArgs.num_physical_allocated_ranges, (addr_t)address, size, + &foundBase) || foundBase != (addr_t)address; } @@ -269,7 +267,7 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, if (is_physical_memory(map->physical_address) && insert_physical_allocated_range((addr_t)map->physical_address, - map->length) != B_OK) { + map->length) != B_OK) { dprintf("cannot map physical allocated range " "(num ranges = %" B_PRIu32 ")!\n", gKernelArgs.num_physical_allocated_ranges); @@ -277,7 +275,8 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, } if (map->virtual_address == pageTable) { - dprintf("found page table\n"); + dprintf("%i: found page table at va %p\n", i, + map->virtual_address); *_physicalPageTable = (page_table_entry_group *)map->physical_address; keepRange = false; @@ -285,7 +284,8 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, } if ((addr_t)map->physical_address <= 0x100 && (addr_t)map->physical_address + map->length >= 0x1000) { - dprintf("found exception handlers\n"); + dprintf("%i: found exception handlers at va %p\n", i, + map->virtual_address); *_exceptionHandlers = map->virtual_address; keepRange = false; // we keep it explicitely anyway @@ -310,6 +310,9 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, // insert range in virtual ranges to keep if (keepRange) { + TRACE("%i: keeping free range starting at va %p\n", i, + map->virtual_address); + if (insert_virtual_range_to_keep(map->virtual_address, map->length) != B_OK) { dprintf("cannot map virtual range to keep " @@ -320,14 +323,14 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, total += map->length; } - dprintf("total mapped: %" B_PRIu32 "\n", total); + dprintf("total size kept: %" B_PRIu32 "\n", total); // remove the boot loader code from the virtual ranges to keep in the // kernel if (remove_virtual_range_to_keep(&__text_begin, &_end - &__text_begin) != B_OK) { - dprintf("find_allocated_ranges(): Failed to remove boot loader range " - "from virtual ranges to keep.\n"); + dprintf("%s: Failed to remove boot loader range " + "from virtual ranges to keep.\n", __func__); } return B_OK; @@ -688,7 +691,10 @@ arch_mmu_init(void) oldTable = table; bool realMode = false; + // TODO: read these values out of the OF settings + // NOTE: I've only ever seen -1 (0xffffffff) for these values in + // OpenFirmware.. even after loading the bootloader -- Alex addr_t realBase = 0; addr_t realSize = 0x400000; From 372fe617b28c085efad6964dcb144f2f97ef840e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 20 Jul 2011 20:31:32 +0000 Subject: [PATCH 015/702] * Clean up OpenFirmware machine detections * Detect OpenBIOS used in QEMU and set machine flag (OpenBIOS isn't 1:1 Apple OpenFirmware) * Show at boot which machine type is detected git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42459 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../boot/platform/openfirmware/machine.h | 3 ++ .../boot/platform/openfirmware/start.cpp | 32 ++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/system/boot/platform/openfirmware/machine.h b/src/system/boot/platform/openfirmware/machine.h index 3aca3fad6c..662f52d89d 100644 --- a/src/system/boot/platform/openfirmware/machine.h +++ b/src/system/boot/platform/openfirmware/machine.h @@ -9,12 +9,15 @@ #include +// Possible gMachine OpenFirmware platforms #define MACHINE_UNKNOWN 0x0000 #define MACHINE_CHRP 0x0001 #define MACHINE_MAC 0x0002 #define MACHINE_PEGASOS 0x0100 +#define MACHINE_QEMU 0x0200 +#define MACHINE_SPARC 0x0300 extern uint32 gMachine; diff --git a/src/system/boot/platform/openfirmware/start.cpp b/src/system/boot/platform/openfirmware/start.cpp index b159023b87..1a4a14f4d8 100644 --- a/src/system/boot/platform/openfirmware/start.cpp +++ b/src/system/boot/platform/openfirmware/start.cpp @@ -1,5 +1,6 @@ /* * Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2011, Alexander von Gluck, kallisti5@unixzen.com * Distributed under the terms of the MIT License. */ @@ -61,26 +62,28 @@ determine_machine(void) int root = of_finddevice("/"); char buffer[64]; - int length; - if ((length = of_getprop(root, "device_type", buffer, sizeof(buffer) - 1)) - == OF_FAILED) - return; - buffer[length] = '\0'; - // ToDo: add more, and be as generic as possible + // TODO : Probe other OpenFirmware platforms and set gMachine as needed + + int length = of_getprop(root, "device_type", buffer, sizeof(buffer) - 1); + buffer[length] = '\0'; if (!strcasecmp("chrp", buffer)) gMachine = MACHINE_CHRP; - else if (!strcasecmp("bootrom", buffer)) + else //(bootrom) + QEMU gMachine = MACHINE_MAC; - - if ((length = of_getprop(root, "model", buffer, sizeof(buffer) - 1)) - == OF_FAILED) - return; + + length = of_getprop(root, "model", buffer, sizeof(buffer) - 1); buffer[length] = '\0'; if (!strcasecmp("pegasos", buffer)) gMachine |= MACHINE_PEGASOS; + + length = of_getprop(root, "name", buffer, sizeof(buffer) - 1); + buffer[length] = '\0'; + + if (!strcasecmp("openbiosteam,openbios", buffer)) + gMachine |= MACHINE_QEMU; } @@ -156,6 +159,13 @@ start(void *openFirmwareEntry) determine_machine(); console_init(); + if (gMachine & MACHINE_QEMU) + dprintf("OpenBIOS (QEMU?) OpenFirmware machine detected\n"); + else if (gMachine & MACHINE_PEGASOS) + dprintf("Pegasos PowerPC machine detected\n"); + else + dprintf("Apple PowerPC machine assumed\n"); + // Initialize and take over MMU and set the OpenFirmware callbacks - it // will ask us for memory after that instead of maintaining it itself // (the kernel will need to adjust the callback later on as well) From 75f0db355c16d349f9e7278fe354dc1cc5e0ee43 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 21 Jul 2011 01:44:45 +0000 Subject: [PATCH 016/702] * Remove a few superfluous spaces * Style fixes as per Axel * Reintroduce removed OF_FAIL checks git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42460 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../boot/platform/openfirmware/start.cpp | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/system/boot/platform/openfirmware/start.cpp b/src/system/boot/platform/openfirmware/start.cpp index 1a4a14f4d8..e297900d5f 100644 --- a/src/system/boot/platform/openfirmware/start.cpp +++ b/src/system/boot/platform/openfirmware/start.cpp @@ -39,10 +39,10 @@ static uint32 sBootOptions; static void call_ctors(void) -{ +{ void (**f)(void); - for (f = &__ctor_list; f < &__ctor_end; f++) { + for (f = &__ctor_list; f < &__ctor_end; f++) { (**f)(); } } @@ -55,35 +55,40 @@ clear_bss(void) } -static void +static void determine_machine(void) { gMachine = MACHINE_UNKNOWN; int root = of_finddevice("/"); char buffer[64]; + int length; // TODO : Probe other OpenFirmware platforms and set gMachine as needed - int length = of_getprop(root, "device_type", buffer, sizeof(buffer) - 1); - buffer[length] = '\0'; - - if (!strcasecmp("chrp", buffer)) - gMachine = MACHINE_CHRP; - else //(bootrom) + QEMU + if ((length = of_getprop(root, "device_type", buffer, sizeof(buffer) - 1)) + != OF_FAILED) { + buffer[length] = '\0'; + if (!strcasecmp("chrp", buffer)) + gMachine = MACHINE_CHRP; + else if (!strcasecmp("bootrom", buffer)) + gMachine = MACHINE_MAC; + } else gMachine = MACHINE_MAC; - - length = of_getprop(root, "model", buffer, sizeof(buffer) - 1); - buffer[length] = '\0'; - if (!strcasecmp("pegasos", buffer)) - gMachine |= MACHINE_PEGASOS; + if ((length = of_getprop(root, "model", buffer, sizeof(buffer) - 1)) + != OF_FAILED) { + buffer[length] = '\0'; + if (!strcasecmp("pegasos", buffer)) + gMachine |= MACHINE_PEGASOS; + } - length = of_getprop(root, "name", buffer, sizeof(buffer) - 1); - buffer[length] = '\0'; - - if (!strcasecmp("openbiosteam,openbios", buffer)) - gMachine |= MACHINE_QEMU; + if ((length = of_getprop(root, "name", buffer, sizeof(buffer) - 1)) + != OF_FAILED) { + buffer[length] = '\0'; + if (!strcasecmp("openbiosteam,openbios", buffer)) + gMachine |= MACHINE_QEMU; + } } @@ -97,7 +102,7 @@ platform_start_kernel(void) printf("kernel entry at %p\n", (void*)kernelEntry); printf("kernel stack top: %p\n", (void*)stackTop); - /* TODO: ? + /* TODO: ? mmu_init_for_kernel(); smp_boot_other_cpus(); */ @@ -159,9 +164,9 @@ start(void *openFirmwareEntry) determine_machine(); console_init(); - if (gMachine & MACHINE_QEMU) + if ((gMachine & MACHINE_QEMU) != 0) dprintf("OpenBIOS (QEMU?) OpenFirmware machine detected\n"); - else if (gMachine & MACHINE_PEGASOS) + else if ((gMachine & MACHINE_PEGASOS) != 0) dprintf("Pegasos PowerPC machine detected\n"); else dprintf("Apple PowerPC machine assumed\n"); From 787929837b0c57d288a6b29fc31b2b0b2a95a3ef Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 22 Jul 2011 01:24:26 +0000 Subject: [PATCH 017/702] * Add AtomBIOS memory controller callbacks git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42461 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/bios.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 86c4cea82c..3df71ef50d 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -151,12 +151,8 @@ ULONG CailReadMC(VOID *CAIL, ULONG address) { TRACE("AtomBios callback %s, addr (0x%X)\n", __func__, address); - // TODO : CailReadMC - ULONG ret = 0; - - // ret = RHDReadMC(((atomBiosHandlePtr)CAIL), address | MC_IND_ALL); - return ret; + return Read32(MC, address | MC_IND_ALL); } @@ -164,11 +160,9 @@ VOID CailWriteMC(VOID *CAIL, ULONG address, ULONG data) { TRACE("AtomBios callback %s, addr (0x%X)\n", __func__, address); - // TODO : CailWriteMC // atomSaveRegisters((atomBiosHandlePtr)CAIL, atomRegisterMC, address); - // RHDWriteMC(((atomBiosHandlePtr)CAIL), - // address | MC_IND_ALL | MC_IND_WR_EN, data); + Write32(MC, address | MC_IND_ALL | MC_IND_WR_EN, data); } From 95e1d7e8288c9eb390705b0fa6e735ff091a0e65 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 22 Jul 2011 04:59:07 +0000 Subject: [PATCH 018/702] * Large refactoring of display detection and storage * Create new display.c/h for display management * Rename global gCRT to gDisplay * Add CRT connection type into gDisplay * Add CRT connection index into gDisplay * Refactor registers for each display into gDisplay via regs * We now shouldn't freak out too badly on multi-monitors git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42462 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/Jamfile | 1 + .../accelerants/radeon_hd/accelerant.cpp | 197 ++----------- .../accelerants/radeon_hd/accelerant.h | 33 +-- src/add-ons/accelerants/radeon_hd/display.cpp | 261 ++++++++++++++++++ src/add-ons/accelerants/radeon_hd/display.h | 17 ++ src/add-ons/accelerants/radeon_hd/mode.cpp | 181 +++++------- src/add-ons/accelerants/radeon_hd/mode.h | 2 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 8 +- 8 files changed, 391 insertions(+), 309 deletions(-) create mode 100644 src/add-ons/accelerants/radeon_hd/display.cpp create mode 100644 src/add-ons/accelerants/radeon_hd/display.h diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile b/src/add-ons/accelerants/radeon_hd/Jamfile index 55d9702f7e..8a23985d26 100644 --- a/src/add-ons/accelerants/radeon_hd/Jamfile +++ b/src/add-ons/accelerants/radeon_hd/Jamfile @@ -15,6 +15,7 @@ Addon radeon_hd.accelerant : pll.cpp mc.cpp dac.cpp + display.cpp tmds.cpp mode.cpp bios.cpp diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 2b8cea78eb..9f8319f728 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -11,6 +11,7 @@ #include "accelerant_protos.h" #include "accelerant.h" +#include "display.h" #include "utility.h" #include "pll.h" #include "mc.h" @@ -34,8 +35,7 @@ extern "C" void _sPrintf(const char *format, ...); struct accelerant_info *gInfo; -struct register_info *gRegister; -crt_info *gCRT[MAX_CRT]; +crt_info *gDisplay[MAX_DISPLAY]; class AreaCloner { @@ -97,22 +97,23 @@ init_common(int device, bool isClone) // initialize global accelerant info structure gInfo = (accelerant_info *)malloc(sizeof(accelerant_info)); - gRegister = (register_info *)malloc(sizeof(register_info)); - if (gInfo == NULL || gRegister == NULL) + if (gInfo == NULL) return B_NO_MEMORY; - for (uint32 id = 0; id < MAX_CRT; id++) { - gCRT[id] = (crt_info *)malloc(sizeof(crt_info)); - if (gCRT[id] == NULL) - return B_NO_MEMORY; - } - memset(gInfo, 0, sizeof(accelerant_info)); - memset(gRegister, 0, sizeof(register_info)); - for (uint32 id = 0; id < MAX_CRT; id++) - memset(gCRT[id], 0, sizeof(crt_info)); + for (uint32 id = 0; id < MAX_DISPLAY; id++) { + gDisplay[id] = (crt_info *)malloc(sizeof(crt_info)); + if (gDisplay[id] == NULL) + return B_NO_MEMORY; + memset(gDisplay[id], 0, sizeof(crt_info)); + + gDisplay[id]->regs = (register_info *)malloc(sizeof(register_info)); + if (gDisplay[id]->regs == NULL) + return B_NO_MEMORY; + memset(gDisplay[id]->regs, 0, sizeof(register_info)); + } gInfo->is_clone = isClone; gInfo->device = device; @@ -177,169 +178,13 @@ uninit_common(void) close(gInfo->device); free(gInfo); - free(gRegister); - for (uint32 id = 0; id < MAX_CRT; id++) - free(gCRT[id]); -} - - -/*! Populate gRegister with device dependant register locations */ -status_t -init_registers(uint8 crtid) -{ - radeon_shared_info &info = *gInfo->shared_info; - - if (info.device_chipset >= RADEON_R800) { - uint32 offset = 0; - - // AMD Eyefinity on Evergreen GPUs - if (crtid == 1) { - offset = EVERGREEN_CRTC1_REGISTER_OFFSET; - gRegister->vgaControl = D2VGA_CONTROL; - } else if (crtid == 2) { - offset = EVERGREEN_CRTC2_REGISTER_OFFSET; - gRegister->vgaControl = EVERGREEN_D3VGA_CONTROL; - } else if (crtid == 3) { - offset = EVERGREEN_CRTC3_REGISTER_OFFSET; - gRegister->vgaControl = EVERGREEN_D4VGA_CONTROL; - } else if (crtid == 4) { - offset = EVERGREEN_CRTC4_REGISTER_OFFSET; - gRegister->vgaControl = EVERGREEN_D5VGA_CONTROL; - } else if (crtid == 5) { - offset = EVERGREEN_CRTC5_REGISTER_OFFSET; - gRegister->vgaControl = EVERGREEN_D6VGA_CONTROL; - } else { - offset = EVERGREEN_CRTC0_REGISTER_OFFSET; - gRegister->vgaControl = D1VGA_CONTROL; - } - - // Evergreen+ is crtoffset + register - gRegister->grphEnable = offset + EVERGREEN_GRPH_ENABLE; - gRegister->grphControl = offset + EVERGREEN_GRPH_CONTROL; - gRegister->grphSwapControl = offset + EVERGREEN_GRPH_SWAP_CONTROL; - gRegister->grphPrimarySurfaceAddr - = offset + EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS; - gRegister->grphSecondarySurfaceAddr - = offset + EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS; - - gRegister->grphPrimarySurfaceAddrHigh - = offset + EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; - gRegister->grphSecondarySurfaceAddrHigh - = offset + EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH; - - gRegister->grphPitch = offset + EVERGREEN_GRPH_PITCH; - gRegister->grphSurfaceOffsetX - = offset + EVERGREEN_GRPH_SURFACE_OFFSET_X; - gRegister->grphSurfaceOffsetY - = offset + EVERGREEN_GRPH_SURFACE_OFFSET_Y; - gRegister->grphXStart = offset + EVERGREEN_GRPH_X_START; - gRegister->grphYStart = offset + EVERGREEN_GRPH_Y_START; - gRegister->grphXEnd = offset + EVERGREEN_GRPH_X_END; - gRegister->grphYEnd = offset + EVERGREEN_GRPH_Y_END; - gRegister->crtControl = offset + EVERGREEN_CRTC_CONTROL; - gRegister->modeDesktopHeight = offset + EVERGREEN_DESKTOP_HEIGHT; - gRegister->modeDataFormat = offset + EVERGREEN_DATA_FORMAT; - gRegister->viewportStart = offset + EVERGREEN_VIEWPORT_START; - gRegister->viewportSize = offset + EVERGREEN_VIEWPORT_SIZE; - - } else if (info.device_chipset >= RADEON_R600 - && info.device_chipset < RADEON_R800) { - - // r600 - r700 are D1 or D2 based on primary / secondary crt - gRegister->vgaControl - = crtid == 1 ? D2VGA_CONTROL : D1VGA_CONTROL; - gRegister->grphEnable - = crtid == 1 ? D2GRPH_ENABLE : D1GRPH_ENABLE; - gRegister->grphControl - = crtid == 1 ? D2GRPH_CONTROL : D1GRPH_CONTROL; - gRegister->grphSwapControl - = crtid == 1 ? D2GRPH_SWAP_CNTL : D1GRPH_SWAP_CNTL; - gRegister->grphPrimarySurfaceAddr - = crtid == 1 ? D2GRPH_PRIMARY_SURFACE_ADDRESS - : D1GRPH_PRIMARY_SURFACE_ADDRESS; - gRegister->grphSecondarySurfaceAddr - = crtid == 1 ? D2GRPH_SECONDARY_SURFACE_ADDRESS - : D1GRPH_SECONDARY_SURFACE_ADDRESS; - - // Surface Address high only used on r770+ - gRegister->grphPrimarySurfaceAddrHigh - = crtid == 1 ? R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH - : R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; - gRegister->grphSecondarySurfaceAddrHigh - = crtid == 1 ? R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH - : R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH; - - gRegister->grphPitch - = crtid == 1 ? D2GRPH_PITCH : D1GRPH_PITCH; - gRegister->grphSurfaceOffsetX - = crtid == 1 ? D2GRPH_SURFACE_OFFSET_X : D1GRPH_SURFACE_OFFSET_X; - gRegister->grphSurfaceOffsetY - = crtid == 1 ? D2GRPH_SURFACE_OFFSET_Y : D1GRPH_SURFACE_OFFSET_Y; - gRegister->grphXStart - = crtid == 1 ? D2GRPH_X_START : D1GRPH_X_START; - gRegister->grphYStart - = crtid == 1 ? D2GRPH_Y_START : D1GRPH_Y_START; - gRegister->grphXEnd - = crtid == 1 ? D2GRPH_X_END : D1GRPH_X_END; - gRegister->grphYEnd - = crtid == 1 ? D2GRPH_Y_END : D1GRPH_Y_END; - gRegister->crtControl - = crtid == 1 ? D2CRTC_CONTROL : D1CRTC_CONTROL; - gRegister->modeDesktopHeight - = crtid == 1 ? D2MODE_DESKTOP_HEIGHT : D1MODE_DESKTOP_HEIGHT; - gRegister->modeDataFormat - = crtid == 1 ? D2MODE_DATA_FORMAT : D1MODE_DATA_FORMAT; - gRegister->viewportStart - = crtid == 1 ? D2MODE_VIEWPORT_START : D1MODE_VIEWPORT_START; - gRegister->viewportSize - = crtid == 1 ? D2MODE_VIEWPORT_SIZE : D1MODE_VIEWPORT_SIZE; - } else { - // this really shouldn't happen unless a driver PCIID chipset is wrong - TRACE("%s, unknown Radeon chipset: r%X\n", __func__, - info.device_chipset); - return B_ERROR; + for (uint32 id = 0; id < MAX_DISPLAY; id++) { + if (gDisplay[id]->regs != NULL) + free(gDisplay[id]->regs); + if (gDisplay[id] != NULL) + free(gDisplay[id]); } - - // Populate common registers - // TODO : Wait.. this doesn't work with Eyefinity > crt 1. - gRegister->crtid = crtid; - - gRegister->modeCenter - = crtid == 1 ? D2MODE_CENTER : D1MODE_CENTER; - gRegister->grphUpdate - = crtid == 1 ? D2GRPH_UPDATE : D1GRPH_UPDATE; - gRegister->crtHPolarity - = crtid == 1 ? D2CRTC_H_SYNC_A_CNTL : D1CRTC_H_SYNC_A_CNTL; - gRegister->crtVPolarity - = crtid == 1 ? D2CRTC_V_SYNC_A_CNTL : D1CRTC_V_SYNC_A_CNTL; - gRegister->crtHTotal - = crtid == 1 ? D2CRTC_H_TOTAL : D1CRTC_H_TOTAL; - gRegister->crtVTotal - = crtid == 1 ? D2CRTC_V_TOTAL : D1CRTC_V_TOTAL; - gRegister->crtHSync - = crtid == 1 ? D2CRTC_H_SYNC_A : D1CRTC_H_SYNC_A; - gRegister->crtVSync - = crtid == 1 ? D2CRTC_V_SYNC_A : D1CRTC_V_SYNC_A; - gRegister->crtHBlank - = crtid == 1 ? D2CRTC_H_BLANK_START_END : D1CRTC_H_BLANK_START_END; - gRegister->crtVBlank - = crtid == 1 ? D2CRTC_V_BLANK_START_END : D1CRTC_V_BLANK_START_END; - gRegister->crtInterlace - = crtid == 1 ? D2CRTC_INTERLACE_CONTROL : D1CRTC_INTERLACE_CONTROL; - gRegister->crtCountControl - = crtid == 1 ? D2CRTC_COUNT_CONTROL : D1CRTC_COUNT_CONTROL; - gRegister->sclUpdate - = crtid == 1 ? D2SCL_UPDATE : D1SCL_UPDATE; - gRegister->sclEnable - = crtid == 1 ? D2SCL_ENABLE : D1SCL_ENABLE; - gRegister->sclTapControl - = crtid == 1 ? D2SCL_TAP_CONTROL : D1SCL_TAP_CONTROL; - - TRACE("%s, registers for ATI chipset r%X crt #%d loaded\n", __func__, - info.device_chipset, crtid); - - return B_OK; } @@ -361,9 +206,7 @@ radeon_init_accelerant(int device) init_lock(&info.accelerant_lock, "radeon hd accelerant"); init_lock(&info.engine_lock, "radeon hd engine"); - status = init_registers(0); - // Initilize registers for crt0 to begin - + status = detect_displays(); if (status != B_OK) return status; diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index be03fd1f1b..c45dd2089d 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -20,8 +20,8 @@ #include -#define MAX_CRT 6 - // eyefinity limit +#define MAX_DISPLAY 2 + // Maximum displays (more then two requires AtomBIOS) struct accelerant_info { @@ -46,7 +46,6 @@ struct accelerant_info { struct register_info { - uint16 crtid; uint16 vgaControl; uint16 grphEnable; uint16 grphUpdate; @@ -86,19 +85,21 @@ struct register_info { typedef struct { - uint16 location; - uint16 locationIndex; - uint32 vfreq_max; - uint32 vfreq_min; - uint32 hfreq_max; - uint32 hfreq_min; + bool active; + uint32 connection_type; + uint8 connection_id; + register_info *regs; + uint32 vfreq_max; + uint32 vfreq_min; + uint32 hfreq_max; + uint32 hfreq_min; } crt_info; -#define HEAD_MODE_A_ANALOG 0x01 -#define HEAD_MODE_B_DIGITAL 0x02 -#define HEAD_MODE_CLONE 0x03 -#define HEAD_MODE_LVDS_PANEL 0x08 +// crt_info connection_type +#define CONNECTION_DAC 0x0001 +#define CONNECTION_TMDS 0x0002 +#define CONNECTION_LVDS 0x0003 // register MMIO modes #define OUT 0x1 // direct MMIO calls @@ -109,11 +110,7 @@ typedef struct { extern accelerant_info *gInfo; -extern register_info *gRegister; -extern crt_info *gCRT[MAX_CRT]; - - -status_t init_registers(uint8 crtid); +extern crt_info *gDisplay[MAX_DISPLAY]; // register access diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp new file mode 100644 index 0000000000..3060b99754 --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -0,0 +1,261 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include "accelerant_protos.h" +#include "accelerant.h" +#include "display.h" + +#include +#include + + +#define TRACE_DISPLAY +#ifdef TRACE_DISPLAY +extern "C" void _sPrintf(const char *format, ...); +# define TRACE(x...) _sPrintf("radeon_hd: " x) +#else +# define TRACE(x...) ; +#endif + + +/*! Populate regs with device dependant register locations */ +status_t +init_registers(register_info* regs, uint8 crtid) +{ + memset(regs, 0, sizeof(register_info)); + + radeon_shared_info &info = *gInfo->shared_info; + + if (info.device_chipset >= RADEON_R800) { + uint32 offset = 0; + + // AMD Eyefinity on Evergreen GPUs + if (crtid == 1) { + offset = EVERGREEN_CRTC1_REGISTER_OFFSET; + regs->vgaControl = D2VGA_CONTROL; + } else if (crtid == 2) { + offset = EVERGREEN_CRTC2_REGISTER_OFFSET; + regs->vgaControl = EVERGREEN_D3VGA_CONTROL; + } else if (crtid == 3) { + offset = EVERGREEN_CRTC3_REGISTER_OFFSET; + regs->vgaControl = EVERGREEN_D4VGA_CONTROL; + } else if (crtid == 4) { + offset = EVERGREEN_CRTC4_REGISTER_OFFSET; + regs->vgaControl = EVERGREEN_D5VGA_CONTROL; + } else if (crtid == 5) { + offset = EVERGREEN_CRTC5_REGISTER_OFFSET; + regs->vgaControl = EVERGREEN_D6VGA_CONTROL; + } else { + offset = EVERGREEN_CRTC0_REGISTER_OFFSET; + regs->vgaControl = D1VGA_CONTROL; + } + + // Evergreen+ is crtoffset + register + regs->grphEnable = offset + EVERGREEN_GRPH_ENABLE; + regs->grphControl = offset + EVERGREEN_GRPH_CONTROL; + regs->grphSwapControl = offset + EVERGREEN_GRPH_SWAP_CONTROL; + regs->grphPrimarySurfaceAddr + = offset + EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS; + regs->grphSecondarySurfaceAddr + = offset + EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS; + + regs->grphPrimarySurfaceAddrHigh + = offset + EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; + regs->grphSecondarySurfaceAddrHigh + = offset + EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH; + + regs->grphPitch = offset + EVERGREEN_GRPH_PITCH; + regs->grphSurfaceOffsetX + = offset + EVERGREEN_GRPH_SURFACE_OFFSET_X; + regs->grphSurfaceOffsetY + = offset + EVERGREEN_GRPH_SURFACE_OFFSET_Y; + regs->grphXStart = offset + EVERGREEN_GRPH_X_START; + regs->grphYStart = offset + EVERGREEN_GRPH_Y_START; + regs->grphXEnd = offset + EVERGREEN_GRPH_X_END; + regs->grphYEnd = offset + EVERGREEN_GRPH_Y_END; + regs->crtControl = offset + EVERGREEN_CRTC_CONTROL; + regs->modeDesktopHeight = offset + EVERGREEN_DESKTOP_HEIGHT; + regs->modeDataFormat = offset + EVERGREEN_DATA_FORMAT; + regs->viewportStart = offset + EVERGREEN_VIEWPORT_START; + regs->viewportSize = offset + EVERGREEN_VIEWPORT_SIZE; + + } else if (info.device_chipset >= RADEON_R600 + && info.device_chipset < RADEON_R800) { + + // r600 - r700 are D1 or D2 based on primary / secondary crt + regs->vgaControl + = crtid == 1 ? D2VGA_CONTROL : D1VGA_CONTROL; + regs->grphEnable + = crtid == 1 ? D2GRPH_ENABLE : D1GRPH_ENABLE; + regs->grphControl + = crtid == 1 ? D2GRPH_CONTROL : D1GRPH_CONTROL; + regs->grphSwapControl + = crtid == 1 ? D2GRPH_SWAP_CNTL : D1GRPH_SWAP_CNTL; + regs->grphPrimarySurfaceAddr + = crtid == 1 ? D2GRPH_PRIMARY_SURFACE_ADDRESS + : D1GRPH_PRIMARY_SURFACE_ADDRESS; + regs->grphSecondarySurfaceAddr + = crtid == 1 ? D2GRPH_SECONDARY_SURFACE_ADDRESS + : D1GRPH_SECONDARY_SURFACE_ADDRESS; + + // Surface Address high only used on r770+ + regs->grphPrimarySurfaceAddrHigh + = crtid == 1 ? R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + : R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; + regs->grphSecondarySurfaceAddrHigh + = crtid == 1 ? R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + : R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH; + + regs->grphPitch + = crtid == 1 ? D2GRPH_PITCH : D1GRPH_PITCH; + regs->grphSurfaceOffsetX + = crtid == 1 ? D2GRPH_SURFACE_OFFSET_X : D1GRPH_SURFACE_OFFSET_X; + regs->grphSurfaceOffsetY + = crtid == 1 ? D2GRPH_SURFACE_OFFSET_Y : D1GRPH_SURFACE_OFFSET_Y; + regs->grphXStart + = crtid == 1 ? D2GRPH_X_START : D1GRPH_X_START; + regs->grphYStart + = crtid == 1 ? D2GRPH_Y_START : D1GRPH_Y_START; + regs->grphXEnd + = crtid == 1 ? D2GRPH_X_END : D1GRPH_X_END; + regs->grphYEnd + = crtid == 1 ? D2GRPH_Y_END : D1GRPH_Y_END; + regs->crtControl + = crtid == 1 ? D2CRTC_CONTROL : D1CRTC_CONTROL; + regs->modeDesktopHeight + = crtid == 1 ? D2MODE_DESKTOP_HEIGHT : D1MODE_DESKTOP_HEIGHT; + regs->modeDataFormat + = crtid == 1 ? D2MODE_DATA_FORMAT : D1MODE_DATA_FORMAT; + regs->viewportStart + = crtid == 1 ? D2MODE_VIEWPORT_START : D1MODE_VIEWPORT_START; + regs->viewportSize + = crtid == 1 ? D2MODE_VIEWPORT_SIZE : D1MODE_VIEWPORT_SIZE; + } else { + // this really shouldn't happen unless a driver PCIID chipset is wrong + TRACE("%s, unknown Radeon chipset: r%X\n", __func__, + info.device_chipset); + return B_ERROR; + } + + // Populate common registers + // TODO : Wait.. this doesn't work with Eyefinity > crt 1. + + regs->modeCenter + = crtid == 1 ? D2MODE_CENTER : D1MODE_CENTER; + regs->grphUpdate + = crtid == 1 ? D2GRPH_UPDATE : D1GRPH_UPDATE; + regs->crtHPolarity + = crtid == 1 ? D2CRTC_H_SYNC_A_CNTL : D1CRTC_H_SYNC_A_CNTL; + regs->crtVPolarity + = crtid == 1 ? D2CRTC_V_SYNC_A_CNTL : D1CRTC_V_SYNC_A_CNTL; + regs->crtHTotal + = crtid == 1 ? D2CRTC_H_TOTAL : D1CRTC_H_TOTAL; + regs->crtVTotal + = crtid == 1 ? D2CRTC_V_TOTAL : D1CRTC_V_TOTAL; + regs->crtHSync + = crtid == 1 ? D2CRTC_H_SYNC_A : D1CRTC_H_SYNC_A; + regs->crtVSync + = crtid == 1 ? D2CRTC_V_SYNC_A : D1CRTC_V_SYNC_A; + regs->crtHBlank + = crtid == 1 ? D2CRTC_H_BLANK_START_END : D1CRTC_H_BLANK_START_END; + regs->crtVBlank + = crtid == 1 ? D2CRTC_V_BLANK_START_END : D1CRTC_V_BLANK_START_END; + regs->crtInterlace + = crtid == 1 ? D2CRTC_INTERLACE_CONTROL : D1CRTC_INTERLACE_CONTROL; + regs->crtCountControl + = crtid == 1 ? D2CRTC_COUNT_CONTROL : D1CRTC_COUNT_CONTROL; + regs->sclUpdate + = crtid == 1 ? D2SCL_UPDATE : D1SCL_UPDATE; + regs->sclEnable + = crtid == 1 ? D2SCL_ENABLE : D1SCL_ENABLE; + regs->sclTapControl + = crtid == 1 ? D2SCL_TAP_CONTROL : D1SCL_TAP_CONTROL; + + TRACE("%s, registers for ATI chipset r%X crt #%d loaded\n", __func__, + info.device_chipset, crtid); + + return B_OK; +} + + +status_t +detect_crt_ranges(uint32 crtid) +{ + edid1_info *edid = &gInfo->shared_info->edid_info; + + // TODO : VESA edid is just for primary monitor + + // EDID spec states 4 descriptor blocks + for (uint32 index = 0; index < EDID1_NUM_DETAILED_MONITOR_DESC; index++) { + + edid1_detailed_monitor *monitor + = &edid->detailed_monitor[index]; + + if (monitor->monitor_desc_type + == EDID1_MONITOR_RANGES) { + edid1_monitor_range range = monitor->data.monitor_range; + gDisplay[crtid]->vfreq_min = range.min_v; /* in Hz */ + gDisplay[crtid]->vfreq_max = range.max_v; + gDisplay[crtid]->hfreq_min = range.min_h; /* in kHz */ + gDisplay[crtid]->hfreq_max = range.max_h; + TRACE("CRT %d : v_min %d : v_max %d : h_min %d : h_max %d\n", + crtid, gDisplay[crtid]->vfreq_min, gDisplay[crtid]->vfreq_max, + gDisplay[crtid]->hfreq_min, gDisplay[crtid]->hfreq_max); + return B_OK; + } + + } + + return B_ERROR; +} + + +status_t +detect_displays() +{ + // reset known displays + for (uint32 id = 0; id < MAX_DISPLAY; id++) + gDisplay[id]->active = false; + + uint32 index = 0; + + // Probe for DAC monitors connected + for (uint32 id = 0; id < 2; id++) { + if (DACSense(id)) { + gDisplay[index]->active = true; + gDisplay[index]->connection_type = CONNECTION_DAC; + gDisplay[index]->connection_id = id; + init_registers(gDisplay[index]->regs, index); + detect_crt_ranges(index); + if (index < MAX_DISPLAY) + index++; + else + return B_OK; + } + } + + // Probe for TMDS monitors connected + for (uint32 id = 0; id < 1; id++) { + if (TMDSSense(id)) { + gDisplay[index]->active = true; + gDisplay[index]->connection_type = CONNECTION_TMDS; + gDisplay[index]->connection_id = id; + init_registers(gDisplay[index]->regs, index); + detect_crt_ranges(index); + if (index < MAX_DISPLAY) + index++; + else + return B_OK; + } + } + + return B_OK; +} + + diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h new file mode 100644 index 0000000000..7a916732dd --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -0,0 +1,17 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ +#ifndef RADEON_HD_DISPLAY_H +#define RADEON_HD_DISPLAY_H + + +status_t init_registers(register_info* reg, uint8 crtid); +status_t detect_crt_ranges(uint32 crtid); +status_t detect_displays(); + + +#endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 0adfdd9934..da6ad0d6a8 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -38,8 +38,6 @@ create_mode_list(void) const color_space kRadeonHDSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE, B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8}; - detect_crt_ranges(); - gInfo->mode_list_area = create_display_modes("radeon HD modes", gInfo->shared_info->has_edid ? &gInfo->shared_info->edid_info : NULL, NULL, 0, kRadeonHDSpaces, @@ -141,14 +139,17 @@ CardBlankSet(uint8 crtid, bool blank) static void -CardFBSet(display_mode *mode) +CardFBSet(uint8 crtid, display_mode *mode) { + register_info* regs = gDisplay[crtid]->regs; + uint32 colorMode; uint32 bytesPerRow; uint32 bitsPerPixel; get_color_space_format(*mode, colorMode, bytesPerRow, bitsPerPixel); + #if 0 // TMDSAllIdle // DVI / HDMI // LVTMAAllIdle // DVI @@ -160,68 +161,68 @@ CardFBSet(display_mode *mode) MCFBSetup(Read32(OUT, R6XX_CONFIG_FB_BASE), mcFbSize); #endif - Write32(CRT, gRegister->grphUpdate, (1<<16)); + Write32(CRT, regs->grphUpdate, (1<<16)); // Lock for update (isn't this normally the other way around on VGA? // framebuffersize = w * h * bpp = fb bits / 8 = bytes needed uint64_t fbAddress = gInfo->shared_info->frame_buffer_phys; // Tell GPU which frame buffer address to draw from - Write32(CRT, gRegister->grphPrimarySurfaceAddr, + Write32(CRT, regs->grphPrimarySurfaceAddr, fbAddress & 0xffffffff); - Write32(CRT, gRegister->grphSecondarySurfaceAddr, + Write32(CRT, regs->grphSecondarySurfaceAddr, fbAddress & 0xffffffff); if (gInfo->shared_info->device_chipset >= (RADEON_R700 | 0x70)) { - Write32(CRT, gRegister->grphPrimarySurfaceAddrHigh, + Write32(CRT, regs->grphPrimarySurfaceAddrHigh, (fbAddress >> 32) & 0xf); - Write32(CRT, gRegister->grphSecondarySurfaceAddrHigh, + Write32(CRT, regs->grphSecondarySurfaceAddrHigh, (fbAddress >> 32) & 0xf); } - Write32(CRT, gRegister->grphControl, 0); + Write32(CRT, regs->grphControl, 0); // Reset stored depth, format, etc // set color mode on video card switch (mode->space) { case B_CMAP8: - Write32Mask(CRT, gRegister->grphControl, + Write32Mask(CRT, regs->grphControl, 0, 0x00000703); break; case B_RGB15_LITTLE: - Write32Mask(CRT, gRegister->grphControl, + Write32Mask(CRT, regs->grphControl, 0x000001, 0x00000703); break; case B_RGB16_LITTLE: - Write32Mask(CRT, gRegister->grphControl, + Write32Mask(CRT, regs->grphControl, 0x000101, 0x00000703); break; case B_RGB24_LITTLE: case B_RGB32_LITTLE: default: - Write32Mask(CRT, gRegister->grphControl, + Write32Mask(CRT, regs->grphControl, 0x000002, 0x00000703); break; } - Write32(CRT, gRegister->grphSwapControl, 0); + Write32(CRT, regs->grphSwapControl, 0); // only for chipsets > r600 // R5xx - RS690 case is GRPH_CONTROL bit 16 - Write32Mask(CRT, gRegister->grphEnable, 1, 0x00000001); + Write32Mask(CRT, regs->grphEnable, 1, 0x00000001); // Enable graphics - Write32(CRT, gRegister->grphSurfaceOffsetX, 0); - Write32(CRT, gRegister->grphSurfaceOffsetY, 0); - Write32(CRT, gRegister->grphXStart, 0); - Write32(CRT, gRegister->grphYStart, 0); - Write32(CRT, gRegister->grphXEnd, mode->virtual_width); - Write32(CRT, gRegister->grphYEnd, mode->virtual_height); - Write32(CRT, gRegister->grphPitch, bytesPerRow / 4); + Write32(CRT, regs->grphSurfaceOffsetX, 0); + Write32(CRT, regs->grphSurfaceOffsetY, 0); + Write32(CRT, regs->grphXStart, 0); + Write32(CRT, regs->grphYStart, 0); + Write32(CRT, regs->grphXEnd, mode->virtual_width); + Write32(CRT, regs->grphYEnd, mode->virtual_height); + Write32(CRT, regs->grphPitch, bytesPerRow / 4); - Write32(CRT, gRegister->modeDesktopHeight, mode->virtual_height); + Write32(CRT, regs->modeDesktopHeight, mode->virtual_height); - Write32(CRT, gRegister->grphUpdate, 0); + Write32(CRT, regs->grphUpdate, 0); // Unlock changed registers // update shared info @@ -232,18 +233,19 @@ CardFBSet(display_mode *mode) static void -CardModeSet(display_mode *mode) +CardModeSet(uint8 crtid, display_mode *mode) { display_timing& displayTiming = mode->timing; + register_info* regs = gDisplay[crtid]->regs; TRACE("%s called to do %dx%d\n", __func__, displayTiming.h_display, displayTiming.v_display); // enable read requests - Write32Mask(CRT, gRegister->grphControl, 0, 0x01000000); + Write32Mask(CRT, regs->grphControl, 0, 0x01000000); // *** Horizontal - Write32(CRT, gRegister->crtHTotal, + Write32(CRT, regs->crtHTotal, displayTiming.h_total - 1); // Blanking @@ -251,55 +253,57 @@ CardModeSet(display_mode *mode) + displayTiming.h_display - displayTiming.h_sync_start; uint16 blankEnd = displayTiming.h_total - displayTiming.h_sync_start; - Write32(CRT, gRegister->crtHBlank, + Write32(CRT, regs->crtHBlank, blankStart | (blankEnd << 16)); - Write32(CRT, gRegister->crtHSync, + Write32(CRT, regs->crtHSync, (displayTiming.h_sync_end - displayTiming.h_sync_start) << 16); // set flag for neg. H sync. M76 Register Reference Guide 2-256 - Write32Mask(CRT, gRegister->crtHPolarity, + Write32Mask(CRT, regs->crtHPolarity, displayTiming.flags & B_POSITIVE_HSYNC ? 0 : 1, 0x1); // *** Vertical - Write32(CRT, gRegister->crtVTotal, + Write32(CRT, regs->crtVTotal, displayTiming.v_total - 1); blankStart = displayTiming.v_total + displayTiming.v_display - displayTiming.v_sync_start; blankEnd = displayTiming.v_total - displayTiming.v_sync_start; - Write32(CRT, gRegister->crtVBlank, + Write32(CRT, regs->crtVBlank, blankStart | (blankEnd << 16)); // Set Interlace if specified within mode line if (displayTiming.flags & B_TIMING_INTERLACED) { - Write32(CRT, gRegister->crtInterlace, 0x1); - Write32(CRT, gRegister->modeDataFormat, 0x1); + Write32(CRT, regs->crtInterlace, 0x1); + Write32(CRT, regs->modeDataFormat, 0x1); } else { - Write32(CRT, gRegister->crtInterlace, 0x0); - Write32(CRT, gRegister->modeDataFormat, 0x0); + Write32(CRT, regs->crtInterlace, 0x0); + Write32(CRT, regs->modeDataFormat, 0x0); } - Write32(CRT, gRegister->crtVSync, + Write32(CRT, regs->crtVSync, (displayTiming.v_sync_end - displayTiming.v_sync_start) << 16); // set flag for neg. V sync. M76 Register Reference Guide 2-258 - Write32Mask(CRT, gRegister->crtVPolarity, + Write32Mask(CRT, regs->crtVPolarity, displayTiming.flags & B_POSITIVE_VSYNC ? 0 : 1, 0x1); /* set D1CRTC_HORZ_COUNT_BY2_EN to 0; should only be set to 1 on 30bpp DVI modes */ - Write32Mask(CRT, gRegister->crtCountControl, 0x0, 0x1); + Write32Mask(CRT, regs->crtCountControl, 0x0, 0x1); } static void -CardModeScale(display_mode *mode) +CardModeScale(uint8 crtid, display_mode *mode) { + register_info* regs = gDisplay[crtid]->regs; + // No scaling - Write32(CRT, gRegister->sclUpdate, (1<<16));// Lock + Write32(CRT, regs->sclUpdate, (1<<16));// Lock #if 0 Write32(CRT, D1MODE_EXT_OVERSCAN_LEFT_RIGHT, @@ -308,52 +312,40 @@ CardModeScale(display_mode *mode) (OVERSCAN << 16) | OVERSCAN); // TOP | BOTTOM #endif - Write32(CRT, gRegister->viewportStart, 0); - Write32(CRT, gRegister->viewportSize, + Write32(CRT, regs->viewportStart, 0); + Write32(CRT, regs->viewportSize, mode->timing.v_display | (mode->timing.h_display << 16)); - Write32(CRT, gRegister->sclEnable, 0); - Write32(CRT, gRegister->sclTapControl, 0); - Write32(CRT, gRegister->modeCenter, 2); + Write32(CRT, regs->sclEnable, 0); + Write32(CRT, regs->sclTapControl, 0); + Write32(CRT, regs->modeCenter, 2); // D1MODE_DATA_FORMAT? - Write32(CRT, gRegister->sclUpdate, 0); // Unlock + Write32(CRT, regs->sclUpdate, 0); // Unlock } status_t radeon_set_display_mode(display_mode *mode) { - uint8 crtNumber = 0; - uint8 dacNumber = 0; + uint8 display_id = 0; - init_registers(crtNumber); + CardFBSet(display_id, mode); + CardModeSet(display_id, mode); + CardModeScale(display_id, mode); - // TODO Populate gCRT with interface connection - if (DACSense(0)) - dacNumber = 0; - else if (DACSense(1)) - dacNumber = 1; + // If this is DAC, set our PLL + if ((gDisplay[display_id]->connection_type & CONNECTION_DAC) != 0) { + PLLSet(gDisplay[display_id]->connection_id, mode->timing.pixel_clock); + DACSet(gDisplay[display_id]->connection_id, display_id); - TMDSSense(0); // DVI / HDMI + // TODO : Shutdown unused PLL/DAC - CardFBSet(mode); - CardModeSet(mode); - CardModeScale(mode); - - PLLSet(dacNumber, mode->timing.pixel_clock); - // Set pixel clock - - Write32(CRT, D1GRPH_LUT_SEL, 0); - - DACSet(dacNumber, crtNumber); - - // TODO : Shutdown unused PLL/DAC - - // Power up the output - PLLPower(dacNumber, RHD_POWER_ON); - DACPower(dacNumber, RHD_POWER_ON); + // Power up the output + PLLPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); + DACPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); + } // Ensure screen isn't blanked - CardBlankSet(crtNumber, false); + CardBlankSet(display_id, false); int32 crtstatus = Read32(CRT, D1CRTC_STATUS); TRACE("CRT0 Status: 0x%X\n", crtstatus); @@ -430,16 +422,17 @@ is_mode_supported(display_mode *mode) if (is_mode_sane(mode) != B_OK) return false; + // TODO : is_mode_supported on *which* display? uint32 crtid = 0; // if we have edid info, check frequency adginst crt reported valid ranges if (gInfo->shared_info->has_edid) { uint32 hfreq = mode->timing.pixel_clock / mode->timing.h_total; - if (hfreq > gCRT[crtid]->hfreq_max + 1 - || hfreq < gCRT[crtid]->hfreq_min - 1) { + if (hfreq > gDisplay[crtid]->hfreq_max + 1 + || hfreq < gDisplay[crtid]->hfreq_min - 1) { TRACE("!!! hfreq : %d , hfreq_min : %d, hfreq_max : %d\n", - hfreq, gCRT[crtid]->hfreq_min, gCRT[crtid]->hfreq_max); + hfreq, gDisplay[crtid]->hfreq_min, gDisplay[crtid]->hfreq_max); TRACE("!!! %dx%d falls outside of CRT %d's valid " "horizontal range.\n", mode->timing.h_display, mode->timing.v_display, crtid); @@ -449,10 +442,10 @@ is_mode_supported(display_mode *mode) uint32 vfreq = mode->timing.pixel_clock / ((mode->timing.v_total * mode->timing.h_total) / 1000); - if (vfreq > gCRT[crtid]->vfreq_max + 1 - || vfreq < gCRT[crtid]->vfreq_min - 1) { + if (vfreq > gDisplay[crtid]->vfreq_max + 1 + || vfreq < gDisplay[crtid]->vfreq_min - 1) { TRACE("!!! vfreq : %d , vfreq_min : %d, vfreq_max : %d\n", - vfreq, gCRT[crtid]->vfreq_min, gCRT[crtid]->vfreq_max); + vfreq, gDisplay[crtid]->vfreq_min, gDisplay[crtid]->vfreq_max); TRACE("!!! %dx%d falls outside of CRT %d's valid vertical range\n", mode->timing.h_display, mode->timing.v_display, crtid); return false; @@ -518,33 +511,3 @@ is_mode_sane(display_mode *mode) } -// TODO : Move to a new "monitors.c" file -status_t -detect_crt_ranges() -{ - edid1_info *edid = &gInfo->shared_info->edid_info; - - int crtid = 0; - // edid indexes are not in order - - for (uint32 index = 0; index < MAX_CRT; index++) { - - edid1_detailed_monitor *monitor - = &edid->detailed_monitor[index]; - - if (monitor->monitor_desc_type - == EDID1_MONITOR_RANGES) { - edid1_monitor_range range = monitor->data.monitor_range; - gCRT[crtid]->vfreq_min = range.min_v; /* in Hz */ - gCRT[crtid]->vfreq_max = range.max_v; - gCRT[crtid]->hfreq_min = range.min_h; /* in kHz */ - gCRT[crtid]->hfreq_max = range.max_h; - TRACE("CRT %d : v_min %d : v_max %d : h_min %d : h_max %d\n", - crtid, gCRT[crtid]->vfreq_min, gCRT[crtid]->vfreq_max, - gCRT[crtid]->hfreq_min, gCRT[crtid]->hfreq_max); - crtid++; - } - - } - return B_OK; -} diff --git a/src/add-ons/accelerants/radeon_hd/mode.h b/src/add-ons/accelerants/radeon_hd/mode.h index 1ab7165cc4..0b51cd93e2 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.h +++ b/src/add-ons/accelerants/radeon_hd/mode.h @@ -25,7 +25,7 @@ #define OVERSCAN 0 // TODO : Overscan and scaling support -status_t detect_crt_ranges(); + status_t create_mode_list(void); bool is_mode_supported(display_mode* mode); status_t is_mode_sane(display_mode *mode); diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index df55939d47..9e08b40e47 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -345,8 +345,8 @@ PLLSetLowLegacy(uint8 pllIndex, uint32 pixelClock, uint16 reference, Write32(PLL, pllExtPostDivSrc, 0x01); // Set source as PLL - // TODO : better way to grab crt to work on? - PLLCRTCGrab(pllIndex, gRegister->crtid); + // TODO : for now we assume crt 0, needs refactoring + PLLCRTCGrab(pllIndex, 0); } @@ -461,8 +461,8 @@ PLLSetLowR620(uint8 pllIndex, uint32 pixelClock, uint16 reference, Write32Mask(PLL, pllCntl, 0, 0x80000000); // needed and undocumented - // TODO : better way to grab crt to work on? - PLLCRTCGrab(pllIndex, gRegister->crtid); + // TODO : for now we assume crt 0, needs refactoring + PLLCRTCGrab(pllIndex, 0); if (hasDccg) DCCGCLKSet(pllIndex, RV620_DCCGCLK_GRAB); From f09dc6d9754acb87367a324f36acd634d58f999a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 22 Jul 2011 05:14:39 +0000 Subject: [PATCH 019/702] * Small bit of comment cleanup * Rename crt_info display_info git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42463 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.cpp | 6 +++--- src/add-ons/accelerants/radeon_hd/accelerant.h | 6 +++--- src/add-ons/accelerants/radeon_hd/display.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 9f8319f728..8a26075ec4 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -35,7 +35,7 @@ extern "C" void _sPrintf(const char *format, ...); struct accelerant_info *gInfo; -crt_info *gDisplay[MAX_DISPLAY]; +display_info *gDisplay[MAX_DISPLAY]; class AreaCloner { @@ -104,10 +104,10 @@ init_common(int device, bool isClone) memset(gInfo, 0, sizeof(accelerant_info)); for (uint32 id = 0; id < MAX_DISPLAY; id++) { - gDisplay[id] = (crt_info *)malloc(sizeof(crt_info)); + gDisplay[id] = (display_info *)malloc(sizeof(display_info)); if (gDisplay[id] == NULL) return B_NO_MEMORY; - memset(gDisplay[id], 0, sizeof(crt_info)); + memset(gDisplay[id], 0, sizeof(display_info)); gDisplay[id]->regs = (register_info *)malloc(sizeof(register_info)); if (gDisplay[id]->regs == NULL) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index c45dd2089d..4f5890c6e7 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -93,10 +93,10 @@ typedef struct { uint32 vfreq_min; uint32 hfreq_max; uint32 hfreq_min; -} crt_info; +} display_info; -// crt_info connection_type +// display_info connection_type #define CONNECTION_DAC 0x0001 #define CONNECTION_TMDS 0x0002 #define CONNECTION_LVDS 0x0003 @@ -110,7 +110,7 @@ typedef struct { extern accelerant_info *gInfo; -extern crt_info *gDisplay[MAX_DISPLAY]; +extern display_info *gDisplay[MAX_DISPLAY]; // register access diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 3060b99754..5b758542d5 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -189,9 +189,9 @@ detect_crt_ranges(uint32 crtid) { edid1_info *edid = &gInfo->shared_info->edid_info; - // TODO : VESA edid is just for primary monitor + // TODO : VESA edid is just for primary monitor? - // EDID spec states 4 descriptor blocks + // Scan each VESA EDID description for monitor ranges for (uint32 index = 0; index < EDID1_NUM_DETAILED_MONITOR_DESC; index++) { edid1_detailed_monitor *monitor From 8bcc8b379f4bbfa8b65f36acab2b4c712b59466c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 22 Jul 2011 19:40:14 +0000 Subject: [PATCH 020/702] Remove OSX crap that slipped in the bash 4.0 official sources to avoid svn complaining after removing all the ._* files around. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42464 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/bash/po/._lt.po | Bin 4096 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/bin/bash/po/._lt.po diff --git a/src/bin/bash/po/._lt.po b/src/bin/bash/po/._lt.po deleted file mode 100644 index 09ec0ede78a8649d1a8f76df60b3c29938b7899c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeH~u?oU45QeXUh)Xw}q-1s|qAsPAi<=1A!A)XGG#C?&6;yl>AH!$zMf9pg(8XE2 zACAi%`48^f4$AcklmG@iWy3L>utIqcsu*nm|AHB7{|ev*`2M0^l8n68)PFkQjNh9d z77y#9UrX&Oa5TBx`iMcsBJJ8@q*A?-dsSvL Date: Sat, 23 Jul 2011 01:27:59 +0000 Subject: [PATCH 021/702] * Add fancy detected monitors debug function git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42465 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 2 ++ src/add-ons/accelerants/radeon_hd/dac.cpp | 8 +---- src/add-ons/accelerants/radeon_hd/display.cpp | 35 ++++++++++++++++--- src/add-ons/accelerants/radeon_hd/display.h | 1 + src/add-ons/accelerants/radeon_hd/tmds.cpp | 6 ---- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 8a26075ec4..bc47945f13 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -210,6 +210,8 @@ radeon_init_accelerant(int device) if (status != B_OK) return status; + debug_displays(); + status = create_mode_list(); if (status != B_OK) { uninit_common(); diff --git a/src/add-ons/accelerants/radeon_hd/dac.cpp b/src/add-ons/accelerants/radeon_hd/dac.cpp index 72067d28f8..d45306b4c8 100644 --- a/src/add-ons/accelerants/radeon_hd/dac.cpp +++ b/src/add-ons/accelerants/radeon_hd/dac.cpp @@ -85,13 +85,7 @@ DACSense(uint8 dacIndex) detectControl, 0x000000FF); Write32Mask(OUT, dacOffset + DACA_ENABLE, enable, 0x000000FF); - if (out == 0x7) { - TRACE("%s: DAC%d : Display device attached\n", __func__, dacIndex); - return true; - } else { - TRACE("%s: DAC%d : No display device attached\n", __func__, dacIndex); - return false; - } + return (out == 0x7); } diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 5b758542d5..fbe3296f7c 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -204,12 +204,8 @@ detect_crt_ranges(uint32 crtid) gDisplay[crtid]->vfreq_max = range.max_v; gDisplay[crtid]->hfreq_min = range.min_h; /* in kHz */ gDisplay[crtid]->hfreq_max = range.max_h; - TRACE("CRT %d : v_min %d : v_max %d : h_min %d : h_max %d\n", - crtid, gDisplay[crtid]->vfreq_min, gDisplay[crtid]->vfreq_max, - gDisplay[crtid]->hfreq_min, gDisplay[crtid]->hfreq_max); return B_OK; } - } return B_ERROR; @@ -259,3 +255,34 @@ detect_displays() } +void +debug_displays() +{ + TRACE("Currently detected monitors===============\n"); + for (uint32 id = 0; id < MAX_DISPLAY; id++) { + TRACE("Display #%" B_PRIu32 " active = %s\n", + id, gDisplay[id]->active ? "true" : "false"); + + if (gDisplay[id]->active) { + if (gDisplay[id]->connection_type == CONNECTION_DAC) + TRACE(" + connection: DAC\n"); + else if (gDisplay[id]->connection_type == CONNECTION_TMDS) + TRACE(" + connection: TMDS\n"); + else if (gDisplay[id]->connection_type == CONNECTION_LVDS) + TRACE(" + connection: LVDS\n"); + else + TRACE(" + connection: UNKNOWN\n"); + + TRACE(" + connection index: % " B_PRIu8 "\n", + gDisplay[id]->connection_id); + + TRACE(" + limits: Vert Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", + gDisplay[id]->vfreq_min, gDisplay[id]->vfreq_max); + TRACE(" + limits: Horz Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", + gDisplay[id]->hfreq_min, gDisplay[id]->hfreq_max); + } + } + TRACE("==========================================\n"); + +} + diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 7a916732dd..14d6247ca8 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -12,6 +12,7 @@ status_t init_registers(register_info* reg, uint8 crtid); status_t detect_crt_ranges(uint32 crtid); status_t detect_displays(); +void debug_displays(); #endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/tmds.cpp b/src/add-ons/accelerants/radeon_hd/tmds.cpp index 2d7f46b446..09717a8485 100644 --- a/src/add-ons/accelerants/radeon_hd/tmds.cpp +++ b/src/add-ons/accelerants/radeon_hd/tmds.cpp @@ -40,12 +40,6 @@ TMDSSense(uint8 tmdsIndex) // Restore saved value Write32Mask(OUT, TMDSA_LOAD_DETECT, loadDetect, 0x00000001); - if (result) { - TRACE("%s: TMDS%d: Display device attached\n", __func__, tmdsIndex); - } else { - TRACE("%s: TMDS%d: No display device attached\n", __func__, tmdsIndex); - } - return result; } From 9e26987aff50b46ca9ed2881e1604df3fc914439 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 23 Jul 2011 01:32:25 +0000 Subject: [PATCH 022/702] * Tab fix * No functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42466 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index fbe3296f7c..bb9c8d2f58 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -273,13 +273,13 @@ debug_displays() else TRACE(" + connection: UNKNOWN\n"); - TRACE(" + connection index: % " B_PRIu8 "\n", - gDisplay[id]->connection_id); + TRACE(" + connection index: % " B_PRIu8 "\n", + gDisplay[id]->connection_id); - TRACE(" + limits: Vert Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", - gDisplay[id]->vfreq_min, gDisplay[id]->vfreq_max); - TRACE(" + limits: Horz Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", - gDisplay[id]->hfreq_min, gDisplay[id]->hfreq_max); + TRACE(" + limits: Vert Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", + gDisplay[id]->vfreq_min, gDisplay[id]->vfreq_max); + TRACE(" + limits: Horz Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", + gDisplay[id]->hfreq_min, gDisplay[id]->hfreq_max); } } TRACE("==========================================\n"); From 422a49d2f8a388b57dd6b372e9f6b94ee2fced8b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 23 Jul 2011 14:38:48 +0000 Subject: [PATCH 023/702] * Add TMDS Set and Power controls * Call TMDS controls if the monitor is TMDS connected git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42467 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/mode.cpp | 3 + src/add-ons/accelerants/radeon_hd/tmds.cpp | 180 +++++++++++++++++++++ src/add-ons/accelerants/radeon_hd/tmds.h | 3 + 3 files changed, 186 insertions(+) diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index da6ad0d6a8..7d8934d93b 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -342,6 +342,9 @@ radeon_set_display_mode(display_mode *mode) // Power up the output PLLPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); DACPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); + } else if ((gDisplay[display_id]->connection_type & CONNECTION_TMDS) != 0) { + TMDSSet(gDisplay[display_id]->connection_id, mode); + TMDSPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); } // Ensure screen isn't blanked diff --git a/src/add-ons/accelerants/radeon_hd/tmds.cpp b/src/add-ons/accelerants/radeon_hd/tmds.cpp index 09717a8485..2ecda5077f 100644 --- a/src/add-ons/accelerants/radeon_hd/tmds.cpp +++ b/src/add-ons/accelerants/radeon_hd/tmds.cpp @@ -22,6 +22,83 @@ extern "C" void _sPrintf(const char *format, ...); #endif +/* + * From Xorg Driver + * This information is not provided in an atombios data table. + */ +static struct R5xxTMDSAMacro { + uint16 device; + uint32 macro; +} R5xxTMDSAMacro[] = { + { 0x7104, 0x00C00414 }, /* R520 */ + { 0x7142, 0x00A00415 }, /* RV515 */ + { 0x7145, 0x00A00416 }, /* M54 */ + { 0x7146, 0x00C0041F }, /* RV515 */ + { 0x7147, 0x00C00418 }, /* RV505 */ + { 0x7149, 0x00800416 }, /* M56 */ + { 0x7152, 0x00A00415 }, /* RV515 */ + { 0x7183, 0x00600412 }, /* RV530 */ + { 0x71C1, 0x00C0041F }, /* RV535 */ + { 0x71C2, 0x00A00416 }, /* RV530 */ + { 0x71C4, 0x00A00416 }, /* M56 */ + { 0x71C5, 0x00A00416 }, /* M56 */ + { 0x71C6, 0x00A00513 }, /* RV530 */ + { 0x71D2, 0x00A00513 }, /* RV530 */ + { 0x71D5, 0x00A00513 }, /* M66 */ + { 0x7249, 0x00A00513 }, /* R580 */ + { 0x724B, 0x00A00513 }, /* R580 */ + { 0x7280, 0x00C0041F }, /* RV570 */ + { 0x7288, 0x00C0041F }, /* RV570 */ + { 0x9400, 0x00910419 }, /* R600: */ + { 0, 0} /* End marker */ +}; + +static struct Rv6xxTMDSAMacro { + uint16 device; + uint32 pll; + uint32 tx; +} Rv6xxTMDSAMacro[] = { + { 0x94C1, 0x00010416, 0x00010308 }, /* RV610 */ + { 0x94C3, 0x00010416, 0x00010308 }, /* RV610 */ + { 0x9501, 0x00010416, 0x00010308 }, /* RV670: != atombios */ + { 0x9505, 0x00010416, 0x00010308 }, /* RV670: != atombios */ + { 0x950F, 0x00010416, 0x00010308 }, /* R680 : != atombios */ + { 0x9581, 0x00030410, 0x00301044 }, /* M76 */ + { 0x9587, 0x00010416, 0x00010308 }, /* RV630 */ + { 0x9588, 0x00010416, 0x00010388 }, /* RV630 */ + { 0x9589, 0x00010416, 0x00010388 }, /* RV630 */ + { 0, 0, 0} /* End marker */ +}; + + +void +TMDSVoltageControl(uint8 tmdsIndex) +{ + int i; + + radeon_shared_info &info = *gInfo->shared_info; + + if (info.device_chipset < (RADEON_R600 | 0x10)) { + for (i = 0; R5xxTMDSAMacro[i].device; i++) { + if (R5xxTMDSAMacro[i].device == info.device_id) { + Write32(OUT, TMDSA_MACRO_CONTROL, R5xxTMDSAMacro[i].macro); + return; + } + } + TRACE("%s : unhandled chipset 0x%X\n", __func__, info.device_id); + } else { + for (i = 0; Rv6xxTMDSAMacro[i].device; i++) { + if (Rv6xxTMDSAMacro[i].device == info.device_id) { + Write32(OUT, TMDSA_PLL_ADJUST, Rv6xxTMDSAMacro[i].pll); + Write32(OUT, TMDSA_TRANSMITTER_ADJUST, Rv6xxTMDSAMacro[i].tx); + return; + } + } + TRACE("%s : unhandled chipset 0x%X\n", __func__, info.device_id); + } +} + + bool TMDSSense(uint8 tmdsIndex) { @@ -44,3 +121,106 @@ TMDSSense(uint8 tmdsIndex) } +status_t +TMDSPower(uint8 tmdsIndex, int command) +{ + // For now radeon cards only have TMDSA and no TMDSB + switch (command) { + case RHD_POWER_ON: + { + TRACE("%s: TMDS %d Power On\n", __func__, tmdsIndex); + Write32Mask(OUT, TMDSA_CNTL, 0x1, 0x00000001); + Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0x00000001, 0x00000001); + snooze(20); + + // Reset transmitter + Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0x00000002, 0x00000002); + snooze(2); + Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0, 0x00000002); + + snooze(30); + + // Restart data sync + // TODO : 165000 this is DualLink + Write32Mask(OUT, TMDSA_CNTL, 0, 0x01000000); + + // Disable force data + Write32Mask(OUT, TMDSA_FORCE_OUTPUT_CNTL, 0, 0x00000001); + + // Enable DC balancer + Write32Mask(OUT, TMDSA_DCBALANCER_CONTROL, 0x00000001, 0x00000001); + + TMDSVoltageControl(tmdsIndex); + + // USE IDCLK + Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0x00000010, 0x00000010); + + // TODO : if coherent? For now lets asume false + Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0x10000000, 0x10000000); + + // TODO : HdmiSetMode(mode) + return B_OK; +} diff --git a/src/add-ons/accelerants/radeon_hd/tmds.h b/src/add-ons/accelerants/radeon_hd/tmds.h index 37a9b21408..3d1f750227 100644 --- a/src/add-ons/accelerants/radeon_hd/tmds.h +++ b/src/add-ons/accelerants/radeon_hd/tmds.h @@ -9,7 +9,10 @@ #define RADEON_HD_TMDS_H +void TMDSVoltageControl(uint8 tmdsIndex); bool TMDSSense(uint8 tmdsIndex); +status_t TMDSPower(uint8 tmdsIndex, int command); +status_t TMDSSet(uint8 tmdsIndex, display_mode *mode); #endif From 5fb1d0a640942f41be672ea7a0a420af0a61010f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 23 Jul 2011 15:41:47 +0000 Subject: [PATCH 024/702] * Added definitions for n_short, n_long, and n_time as expected on FreeBSD when including in_systm.h git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42468 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/compatibility/bsd/netinet/in_systm.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/headers/compatibility/bsd/netinet/in_systm.h b/headers/compatibility/bsd/netinet/in_systm.h index e69de29bb2..068f6808a9 100644 --- a/headers/compatibility/bsd/netinet/in_systm.h +++ b/headers/compatibility/bsd/netinet/in_systm.h @@ -0,0 +1,17 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _NETINET_IN_SYSTM_H_ +#define _NETINET_IN_SYSTM_H_ + + +#include + + +typedef uint16_t n_short; +typedef uint32_t n_long; +typedef uint32_t n_time; + + +#endif /* _NETINET_IN_SYSTM_H_ */ From efc5edfaa28d0e693a6e3e6fac72a17cf163a419 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 24 Jul 2011 01:31:35 +0000 Subject: [PATCH 025/702] * Rename and make VariableTableModel::_GetTreePath() public so VariablesView can make use of it, and adjust existing callers. * For nodes that need child creation to be deferred until after value resolution succeeds, send a request to the view to restore their view state once child creation is complete. This gets the view state working again for things like BPoints and other complex structures embedded in a BMessage. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42469 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../gui/team_window/VariablesView.cpp | 59 ++++++++++++++++--- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index d293e9059a..0ba972dafb 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -48,8 +49,9 @@ enum { enum { - MSG_MODEL_NODE_HIDDEN = 'monh', - MSG_VALUE_NODE_NEEDS_VALUE = 'mvnv' + MSG_MODEL_NODE_HIDDEN = 'monh', + MSG_VALUE_NODE_NEEDS_VALUE = 'mvnv', + MSG_RESTORE_PARTIAL_VIEW_STATE = 'mpvs' }; @@ -73,6 +75,8 @@ public: virtual void ModelNodeValueRequested(ModelNode* node); + virtual void ModelNodeRestoreViewStateRequested(ModelNode* node); + private: BHandler* fIndirectTarget; VariableTableModel* fModel; @@ -364,6 +368,9 @@ public: virtual bool GetValueAt(void* object, int32 columnIndex, BVariant& _value); + bool GetTreePath(ModelNode* node, + TreeTablePath& _path) const; + void NodeExpanded(ModelNode* node); void NotifyNodeChanged(ModelNode* node); @@ -412,8 +419,6 @@ private: // ModelNode* _GetNode(Variable* variable, // TypeComponentPath* path) const; - bool _GetTreePath(ModelNode* node, - TreeTablePath& _path) const; private: Thread* fThread; @@ -706,6 +711,21 @@ VariablesView::ContainerListener::ModelNodeValueRequested(ModelNode* node) } +void +VariablesView::ContainerListener::ModelNodeRestoreViewStateRequested( + ModelNode* node) +{ + BReference nodeReference(node); + + BMessage message(MSG_RESTORE_PARTIAL_VIEW_STATE); + if (message.AddPointer("node", node) == B_OK + && fIndirectTarget->Looper()->PostMessage(&message, fIndirectTarget) + == B_OK) { + nodeReference.Detach(); + } +} + + // #pragma mark - VariableTableModel @@ -869,6 +889,7 @@ VariablesView::VariableTableModel::ValueNodeChildrenCreated( fContainerListener->ModelNodeValueRequested(childNode); } + fContainerListener->ModelNodeRestoreViewStateRequested(modelNode); } } @@ -1047,7 +1068,7 @@ VariablesView::VariableTableModel::NotifyNodeChanged(ModelNode* node) { if (!node->IsHidden()) { TreeTablePath treePath; - if (_GetTreePath(node, treePath)) { + if (GetTreePath(node, treePath)) { int32 index = treePath.RemoveLastComponent(); NotifyNodesChanged(treePath, index, 1); } @@ -1118,7 +1139,7 @@ VariablesView::VariableTableModel::_AddNode(Variable* variable, // notify table model listeners if (!node->IsHidden()) { TreeTablePath path; - if (parent == NULL || _GetTreePath(parent, path)) + if (parent == NULL || GetTreePath(parent, path)) NotifyNodesAdded(path, childIndex, 1); } @@ -1269,12 +1290,12 @@ VariablesView::VariableTableModel::_AddChildNodes(ValueNodeChild* nodeChild) bool -VariablesView::VariableTableModel::_GetTreePath(ModelNode* node, +VariablesView::VariableTableModel::GetTreePath(ModelNode* node, TreeTablePath& _path) const { // recurse, if the node has a parent if (ModelNode* parent = node->Parent()) { - if (!_GetTreePath(parent, _path)) + if (!GetTreePath(parent, _path)) return false; if (node->IsHidden()) @@ -1437,6 +1458,28 @@ VariablesView::MessageReceived(BMessage* message) break; } + case MSG_RESTORE_PARTIAL_VIEW_STATE: + { + ModelNode* node; + if (message->FindPointer("node", (void**)&node) == B_OK) { + TreeTablePath path; + if (fVariableTableModel->GetTreePath(node, path)) { + FunctionID* functionID = fStackFrame->Function() + ->GetFunctionID(); + if (functionID == NULL) + return; + BReference functionIDReference(functionID, + true); + VariablesViewState* viewState = fViewStateHistory + ->GetState(fThread->ID(), functionID); + if (viewState != NULL) { + _ApplyViewStateDescendentNodeInfos(viewState, node, + path); + } + } + } + break; + } case MSG_VALUE_NODE_NEEDS_VALUE: case MSG_MODEL_NODE_HIDDEN: { From 657d27403c39666074357f6b1fa0ab993758fbec Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 24 Jul 2011 01:35:31 +0000 Subject: [PATCH 026/702] Fix indentation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42470 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../debugger/user_interface/gui/team_window/VariablesView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index 0ba972dafb..571399967b 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -49,8 +49,8 @@ enum { enum { - MSG_MODEL_NODE_HIDDEN = 'monh', - MSG_VALUE_NODE_NEEDS_VALUE = 'mvnv', + MSG_MODEL_NODE_HIDDEN = 'monh', + MSG_VALUE_NODE_NEEDS_VALUE = 'mvnv', MSG_RESTORE_PARTIAL_VIEW_STATE = 'mpvs' }; From 781a7c361d819f5f18b39dd6f8775370d81e8415 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 24 Jul 2011 02:54:59 +0000 Subject: [PATCH 027/702] Relocate incorrectly placed call, and guard it as needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42471 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../user_interface/gui/team_window/VariablesView.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index 571399967b..15206ae8c8 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -888,9 +888,10 @@ VariablesView::VariableTableModel::ValueNodeChildrenCreated( if (childNode != NULL) fContainerListener->ModelNodeValueRequested(childNode); } - - fContainerListener->ModelNodeRestoreViewStateRequested(modelNode); } + + if (valueNode->ChildCreationNeedsValue()) + fContainerListener->ModelNodeRestoreViewStateRequested(modelNode); } From d5314ec095b26892b07dc9aa51a3d8db9eee6213 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 24 Jul 2011 10:50:33 +0000 Subject: [PATCH 028/702] * It helps a lot to find thread problems when the multi locker assert macros actually doing something useful. Took me forever to finally realise that and to find a threading bug. * Remove a superfluously assert which sends the app server into the debugger. More fixes following. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42472 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/MultiLocker.h | 7 ++++--- src/servers/app/Workspace.cpp | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/servers/app/MultiLocker.h b/src/servers/app/MultiLocker.h index 30446e57a2..318aea9012 100644 --- a/src/servers/app/MultiLocker.h +++ b/src/servers/app/MultiLocker.h @@ -25,13 +25,14 @@ #define MULTI_LOCKER_TIMING 0 #if DEBUG +# include # define MULTI_LOCKER_DEBUG DEBUG #endif #if MULTI_LOCKER_DEBUG -# define ASSERT_MULTI_LOCKED(x) ((x).IsWriteLocked() || (x).IsReadLocked()) -# define ASSERT_MULTI_READ_LOCKED(x) ((x).IsReadLocked()) -# define ASSERT_MULTI_WRITE_LOCKED(x) ((x).IsWriteLocked()) +# define ASSERT_MULTI_LOCKED(x) assert((x).IsWriteLocked() || (x).IsReadLocked()) +# define ASSERT_MULTI_READ_LOCKED(x) assert((x).IsReadLocked()) +# define ASSERT_MULTI_WRITE_LOCKED(x) assert((x).IsWriteLocked()) #else # define MULTI_LOCKER_DEBUG 0 # define ASSERT_MULTI_LOCKED(x) ; diff --git a/src/servers/app/Workspace.cpp b/src/servers/app/Workspace.cpp index 617ecba1e1..887ee6cfb4 100644 --- a/src/servers/app/Workspace.cpp +++ b/src/servers/app/Workspace.cpp @@ -82,7 +82,6 @@ Workspace::Workspace(Desktop& desktop, int32 index) fDesktop(desktop), fCurrentWorkspace(index == desktop.CurrentWorkspace()) { - ASSERT_MULTI_LOCKED(desktop.WindowLocker()); RewindWindows(); } From 0990a31aa234d66e618d72821d2d8d32af9a78a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 24 Jul 2011 16:34:41 +0000 Subject: [PATCH 029/702] fix comments git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42473 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp b/src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp index 43754e6a7a..c16d4631d1 100644 --- a/src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp +++ b/src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp @@ -528,8 +528,8 @@ init_driver() PRINTER_INTERFACE_CLASS, PRINTER_INTERFACE_SUBCLASS, 0, // any protocol - 0, // any product - 0 // any vendor + 0, // any vendor + 0 // any product }; gDeviceList = NULL; From 811ac4d5022918b2125b82408a4c807def82d5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 24 Jul 2011 18:27:05 +0000 Subject: [PATCH 030/702] No point in checking the new device for NULL if it's not nothrow. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42474 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../media/media-add-ons/multi_audio/MultiAudioAddOn.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/add-ons/media/media-add-ons/multi_audio/MultiAudioAddOn.cpp b/src/add-ons/media/media-add-ons/multi_audio/MultiAudioAddOn.cpp index 1758d0a073..00b8437730 100644 --- a/src/add-ons/media/media-add-ons/multi_audio/MultiAudioAddOn.cpp +++ b/src/add-ons/media/media-add-ons/multi_audio/MultiAudioAddOn.cpp @@ -197,8 +197,9 @@ MultiAudioAddOn::_RecursiveScan(const char* rootPath, BEntry* rootEntry, uint32 } else { BPath path; entry.GetPath(&path); - MultiAudioDevice *device = new MultiAudioDevice(path.Path() - + strlen(rootPath), path.Path()); + MultiAudioDevice *device = + new(std::nothrow) MultiAudioDevice(path.Path() + + strlen(rootPath), path.Path()); if (device) { if (device->InitCheck() == B_OK) fDevices.AddItem(device); From f7953fa76911c2c0a300ea606921edaa172190a4 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 24 Jul 2011 23:49:30 +0000 Subject: [PATCH 031/702] Add MoveItem method to easily move a item within a list. Fix line limit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42475 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/support/ObjectList.h | 10 +++++++ src/kits/support/PointerList.cpp | 48 ++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/headers/os/support/ObjectList.h b/headers/os/support/ObjectList.h index 40792297d0..f0e1927efa 100644 --- a/headers/os/support/ObjectList.h +++ b/headers/os/support/ObjectList.h @@ -101,6 +101,7 @@ public: bool Owning() const; bool ReplaceItem(int32, void *); + bool MoveItem(int32 from, int32 to); protected: bool owning; @@ -154,6 +155,7 @@ public: // same as ReplaceItem, except does not // delete old item at , returns it // instead + bool MoveItem(int32 from, int32 to); T* FirstItem() const; T* LastItem() const; @@ -552,6 +554,14 @@ BObjectList::SwapWithItem(int32 index, T* newItem) } +template +bool +BObjectList::MoveItem(int32 from, int32 to) +{ + return _PointerList_::MoveItem(from, to); +} + + template void BObjectList::_SetItem(int32 index, T* newItem) diff --git a/src/kits/support/PointerList.cpp b/src/kits/support/PointerList.cpp index 177eb266b8..ff8207b32d 100644 --- a/src/kits/support/PointerList.cpp +++ b/src/kits/support/PointerList.cpp @@ -18,10 +18,10 @@ #include -#include - #include +#include #include +#include #include @@ -76,7 +76,8 @@ private: // Methods that do the actual work: inline void Swap(void **items, int32 i, int32 j); - void* BinarySearch(const void *key, const void **items, int32 numItems, int32 &index); + void* BinarySearch(const void *key, const void **items, int32 numItems, + int32 &index); void QuickSort(void **items, int32 low, int32 high); // Method to be implemented by sub classes @@ -151,7 +152,8 @@ AbstractPointerListHelper::HSortItems(BList *list) void * -AbstractPointerListHelper::BinarySearch(const void *key, const void **items, int32 numItems, int32 &index) +AbstractPointerListHelper::BinarySearch(const void *key, const void **items, + int32 numItems, int32 &index) { const void** end = &items[numItems]; const void** found = lower_bound(items, end, key, comparator(this)); @@ -289,7 +291,8 @@ _PointerList_::SortItems(GenericCompareFunction compareFunc) void -_PointerList_::SortItems(GenericCompareFunctionWithState compareFunc, void *state) +_PointerList_::SortItems(GenericCompareFunctionWithState compareFunc, + void *state) { PointerListHelperWithState helper(compareFunc, state); helper.SortItems(this); @@ -305,7 +308,8 @@ _PointerList_::HSortItems(GenericCompareFunction compareFunc) void -_PointerList_::HSortItems(GenericCompareFunctionWithState compareFunc, void *state) +_PointerList_::HSortItems(GenericCompareFunctionWithState compareFunc, + void *state) { PointerListHelperWithState helper(compareFunc, state); helper.HSortItems(this); @@ -313,7 +317,8 @@ _PointerList_::HSortItems(GenericCompareFunctionWithState compareFunc, void *sta void * -_PointerList_::BinarySearch(const void *key, GenericCompareFunction compareFunc) const +_PointerList_::BinarySearch(const void *key, + GenericCompareFunction compareFunc) const { PointerListHelper helper(compareFunc); return helper.BinarySearch(key, this); @@ -330,7 +335,8 @@ _PointerList_::BinarySearch(const void *key, int32 -_PointerList_::BinarySearchIndex(const void *key, GenericCompareFunction compareFunc) const +_PointerList_::BinarySearchIndex(const void *key, + GenericCompareFunction compareFunc) const { PointerListHelper helper(compareFunc); return helper.BinarySearchIndex(key, this); @@ -347,7 +353,8 @@ _PointerList_::BinarySearchIndex(const void *key, int32 -_PointerList_::BinarySearchIndexByPredicate(const void *key, UnaryPredicateGlue predicate) const +_PointerList_::BinarySearchIndexByPredicate(const void *key, + UnaryPredicateGlue predicate) const { PointerListHelperUsePredicate helper(predicate); return helper.BinarySearchIndex(key, this); @@ -365,3 +372,26 @@ _PointerList_::ReplaceItem(int32 index, void *newItem) return true; } + +bool +_PointerList_::MoveItem(int32 from, int32 to) +{ + if (from == to) + return true; + + void* fromItem = ItemAt(from); + void* toItem = ItemAt(to); + if (fromItem == NULL || toItem == NULL) + return false; + + void** items = static_cast(Items()); + if (from < to) + memmove(items + from, items + from + 1, (to - from) * sizeof(void*)); + else + memmove(items + to + 1, items + to, (from - to) * sizeof(void*)); + + items[to] = fromItem; + return true; +} + + From c0dad949eef84a7f64a1d8f8b404c8c81b7e4dce Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 24 Jul 2011 23:53:12 +0000 Subject: [PATCH 032/702] BRect's OffsetBy takes a BPoint. Add a similar BRegion method to be more consistent. This one takes a const reference instead a complete BPoint object. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42476 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/Region.h | 1 + src/kits/interface/Region.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/headers/os/interface/Region.h b/headers/os/interface/Region.h index 3a32dcfb66..55d8252efd 100644 --- a/headers/os/interface/Region.h +++ b/headers/os/interface/Region.h @@ -56,6 +56,7 @@ public: void PrintToStream() const; + void OffsetBy(const BPoint& point); void OffsetBy(int32 x, int32 y); void MakeEmpty(); diff --git a/src/kits/interface/Region.cpp b/src/kits/interface/Region.cpp index e9adcd78b8..9d63e41683 100644 --- a/src/kits/interface/Region.cpp +++ b/src/kits/interface/Region.cpp @@ -342,6 +342,14 @@ BRegion::PrintToStream() const // #pragma mark - + +void +BRegion::OffsetBy(const BPoint& point) +{ + OffsetBy(point.x, point.y); +} + + /*! \brief Offsets all region's rects, and bounds by the given values. \param dh The horizontal offset. \param dv The vertical offset. From 5b1742af2703dd0484641997f829476d7ef1bb9c Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 00:11:33 +0000 Subject: [PATCH 033/702] Remove another assert that fails. In this case the access from ServerApp is fine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42477 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerWindow.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 18fadbdfb5..8ffea2423f 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -299,8 +299,6 @@ ServerWindow::Init(BRect frame, window_look look, window_feel feel, Window* ServerWindow::Window() const { - ASSERT_MULTI_LOCKED(fDesktop->WindowLocker()); - if (!fWindowAddedToDesktop) return NULL; From bb2e9b06acb1783543442464561b7811892ee7e2 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 01:09:26 +0000 Subject: [PATCH 034/702] Add multi tab support to the default decorator as discussed on the mailing list. Windows can be stacked on top of one another. All windows using the same decorator instance. This makes it easier to draw the stacked tabs and makes it possible to design more fancy looks for stacked windows. This also helps to fix some issues in S&T, e.g. when activating one window in a stacked group all windows have to be activated to ensure that all tabs are on top. This causes some flickering in tracker. * Each Window has a reference counted WindowStack class which can be shared between stacked Windows. To keep the Decorator separated from Window there is another tab list in the Decorator now. The index of the stacked Window in the window stack is the same as the index of the tab in the Decorator. Properties like title or window focus are managed on a per tab basis now. This mean when you set the title in the Decorator you also have to specify the tab id which is equal to the window position in the stack. * When drawing the decorator its important that only the top window is doing the drawing. Also the top window drawing engine should be used. Actually that is only a problem directly after a window is stacked and the other window has still a none empty dirty region. In this case we clear the dirty region of this window and stop the drawing (the top window will draw everything). * Track if shifting of a tab is still ongoing, i.e. mouse still down. * The key event filter called the DesktopListener without holding the window write lock. This probably caused #7801 and #7796. * Commented out assert's in Window::SetScreen and Window::Screen. Add TODO because I'm not sure about the screen access. This breaks all existing decorators again, sorry guys! Haven't looked into any other then the default decorator (and the SAT decorator). Will not fix the others in the near future so go for it! Since applications should be able to rely on S&T features the other decorator must be able to handle multiple tabs as well. A simple solution would be to draw all title bars in multiple rows. That probably looks quit poorly. Think the better solution would be to draw a tab interface in the title bar, e.g. like in KDE. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42478 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/DecorManager.cpp | 9 +- src/servers/app/Decorator.cpp | 538 ++++++++----- src/servers/app/Decorator.h | 157 ++-- src/servers/app/DefaultDecorator.cpp | 835 ++++++++++++++------- src/servers/app/DefaultDecorator.h | 93 ++- src/servers/app/DefaultWindowBehaviour.cpp | 87 ++- src/servers/app/DefaultWindowBehaviour.h | 3 +- src/servers/app/Desktop.cpp | 29 +- src/servers/app/Desktop.h | 2 +- src/servers/app/DesktopListener.cpp | 4 +- src/servers/app/DesktopListener.h | 4 +- src/servers/app/Window.cpp | 494 ++++++++++-- src/servers/app/Window.h | 69 +- src/servers/app/WorkspacesView.cpp | 2 +- 14 files changed, 1666 insertions(+), 660 deletions(-) diff --git a/src/servers/app/DecorManager.cpp b/src/servers/app/DecorManager.cpp index 9b53e060e0..c06ef07dc7 100644 --- a/src/servers/app/DecorManager.cpp +++ b/src/servers/app/DecorManager.cpp @@ -65,15 +65,16 @@ DecorAddOn::AllocateDecorator(Desktop* desktop, DrawingEngine* engine, DesktopSettings settings(desktop); Decorator* decorator; decorator = _AllocateDecorator(settings, rect, look, flags); - desktop->UnlockSingleWindow(); - if (!decorator) return NULL; - decorator->SetDrawingEngine(engine); - decorator->SetTitle(title); + if (decorator->AddTab(title) == false) { + delete decorator; + return NULL; + } + decorator->SetDrawingEngine(engine); return decorator; } diff --git a/src/servers/app/Decorator.cpp b/src/servers/app/Decorator.cpp index 92dbd6045f..837a2f9e93 100644 --- a/src/servers/app/Decorator.cpp +++ b/src/servers/app/Decorator.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -22,6 +22,22 @@ #include "DrawingEngine.h" +Decorator::Tab::Tab() + : + zoomRect(), + closeRect(), + minimizeRect(), + + closePressed(false), + zoomPressed(false), + minimizePressed(false), + isFocused(false), + title("") +{ + +} + + /*! \brief Constructor Does general initialization of internal data members and creates a colorset @@ -41,19 +57,12 @@ Decorator::Decorator(DesktopSettings& settings, BRect rect, window_look look, fLook(look), fFlags(flags), - fZoomRect(), - fCloseRect(), - fMinimizeRect(), - fTabRect(), + fTitleBarRect(), fFrame(rect), fResizeRect(), fBorderRect(), - fClosePressed(false), - fZoomPressed(false), - fMinimizePressed(false), - fIsFocused(false), - fTitle(""), + fTopTab(NULL), fFootprintValid(false) { @@ -71,6 +80,89 @@ Decorator::~Decorator() } +Decorator::Tab* +Decorator::AddTab(const char* title, int32 index, BRegion* updateRegion) +{ + Decorator::Tab* tab = _AllocateNewTab(); + if (tab == NULL) + return NULL; + tab->title = title; + + bool ok = false; + if (index >= 0) { + if (fTabList.AddItem(tab, index) == true) + ok = true; + } else if (fTabList.AddItem(tab) == true) + ok = true; + + if (ok == false) { + delete tab; + return NULL; + } + + if (_AddTab(index, updateRegion) == false) { + fTabList.RemoveItem(tab); + delete tab; + return NULL; + } + + if (fTopTab == NULL) + fTopTab = tab; + + _InvalidateFootprint(); + return tab; +} + + +bool +Decorator::RemoveTab(int32 index, BRegion* updateRegion) +{ + Decorator::Tab* tab = fTabList.RemoveItemAt(index); + if (tab == NULL) + return false; + + _RemoveTab(index, updateRegion); + + delete tab; + _InvalidateFootprint(); + return true; +} + + +bool +Decorator::MoveTab(int32 from, int32 to, bool isMoving, BRegion* updateRegion) +{ + if (_MoveTab(from, to, isMoving, updateRegion) == false) + return false; + if (fTabList.MoveItem(from, to) == false) { + // move the tab back + _MoveTab(from, to, isMoving, updateRegion); + return false; + } + return true; +} + + +int32 +Decorator::TabAt(const BPoint& where) const +{ + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + if (tab->tabRect.Contains(where)) + return i; + } + + return -1; +} + + +void +Decorator::SetTopTap(int32 tab) +{ + fTopTab = fTabList.ItemAt(tab); +} + + /*! \brief Assigns a display driver to the decorator \param driver A valid DrawingEngine object */ @@ -132,71 +224,6 @@ Decorator::SetLook(DesktopSettings& settings, window_look look, } -/*! \brief Sets the close button's value. - - Note that this does not update the button's look - it just updates the - internal button value - - \param is_down Whether the button is down or not -*/ -void -Decorator::SetClose(bool pressed) -{ - if (pressed != fClosePressed) { - fClosePressed = pressed; - DrawClose(); - } -} - -/*! \brief Sets the minimize button's value. - - Note that this does not update the button's look - it just updates the - internal button value - - \param is_down Whether the button is down or not -*/ -void -Decorator::SetMinimize(bool pressed) -{ - if (pressed != fMinimizePressed) { - fMinimizePressed = pressed; - DrawMinimize(); - } -} - -/*! \brief Sets the zoom button's value. - - Note that this does not update the button's look - it just updates the - internal button value - - \param is_down Whether the button is down or not -*/ -void -Decorator::SetZoom(bool pressed) -{ - if (pressed != fZoomPressed) { - fZoomPressed = pressed; - DrawZoom(); - } -} - - -/*! \brief Updates the value of the decorator title - \param string New title value -*/ -void -Decorator::SetTitle(const char* string, BRegion* updateRegion) -{ - fTitle.SetTo(string); - _SetTitle(string, updateRegion); - - _InvalidateFootprint(); - // the border very likely changed - - // TODO: redraw? -} - - /*! \brief Returns the decorator's window look \return the decorator's window look */ @@ -217,16 +244,6 @@ Decorator::Flags() const } -/*! \brief Returns the decorator's title - \return the decorator's title -*/ -const char* -Decorator::Title() const -{ - return fTitle.String(); -} - - /*! \brief Returns the decorator's border rectangle \return the decorator's border rectangle */ @@ -237,52 +254,149 @@ Decorator::BorderRect() const } +BRect +Decorator::TitleBarRect() const +{ + return fTitleBarRect; +} + + /*! \brief Returns the decorator's tab rectangle \return the decorator's tab rectangle */ BRect -Decorator::TabRect() const +Decorator::TabRect(int32 tab) const { - return fTabRect; + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return BRect(); + return decoratorTab->tabRect; } -/*! \brief Returns the value of the close button - \return true if down, false if up +BRect +Decorator::TabRect(Decorator::Tab* tab) const +{ + return tab->tabRect; +} + + +/*! \brief Sets the close button's value. + + Note that this does not update the button's look - it just updates the + internal button value + + \param is_down Whether the button is down or not */ -bool -Decorator::GetClose() -{ - return fClosePressed; -} - - -/*! \brief Returns the value of the minimize button - \return true if down, false if up -*/ -bool -Decorator::GetMinimize() -{ - return fMinimizePressed; -} - - -/*! \brief Returns the value of the zoom button - \return true if down, false if up -*/ -bool -Decorator::GetZoom() -{ - return fZoomPressed; -} - - void -Decorator::GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth, - int32* maxHeight) const +Decorator::SetClose(int32 tab, bool pressed) { + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + + if (pressed != decoratorTab->closePressed) { + decoratorTab->closePressed = pressed; + DrawClose(tab); + } } +/*! \brief Sets the minimize button's value. + + Note that this does not update the button's look - it just updates the + internal button value + + \param is_down Whether the button is down or not +*/ +void +Decorator::SetMinimize(int32 tab, bool pressed) +{ + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + + if (pressed != decoratorTab->minimizePressed) { + decoratorTab->minimizePressed = pressed; + DrawMinimize(tab); + } +} + +/*! \brief Sets the zoom button's value. + + Note that this does not update the button's look - it just updates the + internal button value + + \param is_down Whether the button is down or not +*/ +void +Decorator::SetZoom(int32 tab, bool pressed) +{ + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + + if (pressed != decoratorTab->zoomPressed) { + decoratorTab->zoomPressed = pressed; + DrawZoom(tab); + } +} + + +/*! \brief Updates the value of the decorator title + \param string New title value +*/ +void +Decorator::SetTitle(int32 tab, const char* string, BRegion* updateRegion) +{ + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + + decoratorTab->title.SetTo(string); + _SetTitle(decoratorTab, string, updateRegion); + + _InvalidateFootprint(); + // the border very likely changed + + // TODO: redraw? +} + + +/*! \brief Returns the decorator's title + \return the decorator's title +*/ +const char* +Decorator::Title(int32 tab) const +{ + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return ""; + return decoratorTab->title; +} + + +const char* +Decorator::Title(Decorator::Tab* tab) const +{ + return tab->title; +} + + +bool +Decorator::SetTabLocation(int32 tab, float location, bool isShifting, + BRegion* updateRegion) +{ + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return false; + if (_SetTabLocation(decoratorTab, location, isShifting, updateRegion)) { + _InvalidateFootprint(); + return true; + } + return false; +} + + /*! \brief Changes the focus value of the decorator @@ -292,14 +406,41 @@ Decorator::GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth, \param active True if active, false if not */ void -Decorator::SetFocus(bool active) +Decorator::SetFocus(int32 tab, bool active) { - fIsFocused = active; - _SetFocus(); + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + decoratorTab->isFocused = active; + _SetFocus(decoratorTab); // TODO: maybe it would be cleaner to handle the redraw here. } +bool +Decorator::IsFocus(int32 tab) const +{ + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return false; + return decoratorTab->isFocused; +}; + + +bool +Decorator::IsFocus(Decorator::Tab* tab) const +{ + return tab->isFocused; +} + + +void +Decorator::GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth, + int32* maxHeight) const +{ +} + + // #pragma mark - virtual methods @@ -339,14 +480,25 @@ Decorator::GetFootprint() - \c REGION_RIGHT_BOTTOM_CORNER The right-bottom corner. */ Decorator::Region -Decorator::RegionAt(BPoint where) const +Decorator::RegionAt(BPoint where, int32& tabIndex) const { - if (fCloseRect.Contains(where)) - return REGION_CLOSE_BUTTON; - if (fZoomRect.Contains(where)) - return REGION_ZOOM_BUTTON; - if (fTabRect.Contains(where)) - return REGION_TAB; + tabIndex = -1; + + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + if (tab->closeRect.Contains(where)) { + tabIndex = i; + return REGION_CLOSE_BUTTON; + } + if (tab->zoomRect.Contains(where)) { + tabIndex = i; + return REGION_ZOOM_BUTTON; + } + if (tab->tabRect.Contains(where)) { + tabIndex = i; + return REGION_TAB; + } + } return REGION_NONE; } @@ -411,17 +563,6 @@ Decorator::ResizeBy(BPoint offset, BRegion* dirty) } -bool -Decorator::SetTabLocation(float location, BRegion* updateRegion) -{ - if (_SetTabLocation(location, updateRegion)) { - _InvalidateFootprint(); - return true; - } - return false; -} - - /*! \brief Sets a specific highlight for a decorator region. Can be overridden by derived classes, but the base class version must be @@ -434,7 +575,8 @@ Decorator::SetTabLocation(float location, BRegion* updateRegion) \return \c true, if the highlight could be applied. */ bool -Decorator::SetRegionHighlight(Region region, uint8 highlight, BRegion* dirty) +Decorator::SetRegionHighlight(Region region, uint8 highlight, BRegion* dirty, + int32 tab) { int32 index = (int32)region - 1; if (index < 0 || index >= REGION_COUNT - 1) @@ -479,7 +621,7 @@ void Decorator::Draw(BRect rect) { _DrawFrame(rect & fFrame); - _DrawTab(rect & fTabRect); + _DrawTabs(rect & fTitleBarRect); } @@ -488,15 +630,7 @@ void Decorator::Draw() { _DrawFrame(fFrame); - _DrawTab(fTabRect); -} - - -//! Draws the close button -void -Decorator::DrawClose() -{ - _DrawClose(fCloseRect); + _DrawTabs(fTitleBarRect); } @@ -508,39 +642,63 @@ Decorator::DrawFrame() } -//! draws the minimize button +//! draws the tab, title, and buttons void -Decorator::DrawMinimize() +Decorator::DrawTab(int32 tabIndex) { - _DrawTab(fMinimizeRect); + Decorator::Tab* tab = fTabList.ItemAt(tabIndex); + if (tab == NULL) + return; + + _DrawTab(tab, tab->tabRect); + _DrawZoom(tab, tab->zoomRect); + _DrawMinimize(tab, tab->minimizeRect); + _DrawTitle(tab, tab->tabRect); + _DrawClose(tab, tab->closeRect); } -//! draws the tab, title, and buttons +//! Draws the close button void -Decorator::DrawTab() +Decorator::DrawClose(int32 tab) { - _DrawTab(fTabRect); - _DrawZoom(fZoomRect); - _DrawMinimize(fMinimizeRect); - _DrawTitle(fTabRect); - _DrawClose(fCloseRect); + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + _DrawClose(decoratorTab, decoratorTab->closeRect); +} + + +//! draws the minimize button +void +Decorator::DrawMinimize(int32 tab) +{ + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + _DrawTab(decoratorTab, decoratorTab->minimizeRect); } //! draws the title void -Decorator::DrawTitle() +Decorator::DrawTitle(int32 tab) { - _DrawTitle(fTabRect); + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + _DrawTitle(decoratorTab, decoratorTab->tabRect); } //! draws the zoom button void -Decorator::DrawZoom() +Decorator::DrawZoom(int32 tab) { - _DrawZoom(fZoomRect); + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + _DrawZoom(decoratorTab, decoratorTab->zoomRect); } @@ -582,6 +740,24 @@ Decorator::_DrawFrame(BRect rect) } + +void +Decorator::_DrawTabs(BRect rect) +{ + Decorator::Tab* focusTab = NULL; + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + if (tab->isFocused) { + focusTab = tab; + continue; + } + _DrawTab(tab, rect); + } + if (focusTab != NULL) + _DrawTab(focusTab, rect); +} + + /*! \brief Actually draws the tab This function is called when the tab itself needs drawn. Other items, @@ -590,7 +766,7 @@ Decorator::_DrawFrame(BRect rect) \param rect Area of the tab to update */ void -Decorator::_DrawTab(BRect rect) +Decorator::_DrawTab(Decorator::Tab* tab, BRect rect) { } @@ -603,7 +779,7 @@ Decorator::_DrawTab(BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawClose(BRect rect) +Decorator::_DrawClose(Decorator::Tab* tab, BRect rect) { } @@ -618,7 +794,7 @@ Decorator::_DrawClose(BRect rect) \param rect area of the title to update */ void -Decorator::_DrawTitle(BRect rect) +Decorator::_DrawTitle(Decorator::Tab* tab, BRect rect) { } @@ -631,7 +807,7 @@ Decorator::_DrawTitle(BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawZoom(BRect rect) +Decorator::_DrawZoom(Decorator::Tab* tab, BRect rect) { } @@ -644,14 +820,22 @@ Decorator::_DrawZoom(BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawMinimize(BRect rect) +Decorator::_DrawMinimize(Decorator::Tab* tab, BRect rect) { } +bool +Decorator::_SetTabLocation(Decorator::Tab* tab, float location, bool isShifting, + BRegion* /*updateRegion*/) +{ + return false; +} + + //! Hook function called when the decorator changes focus void -Decorator::_SetFocus() +Decorator::_SetFocus(Decorator::Tab* tab) { } @@ -680,11 +864,15 @@ Decorator::_SetFlags(uint32 flags, BRegion* updateRegion) void Decorator::_MoveBy(BPoint offset) { - fZoomRect.OffsetBy(offset); - fCloseRect.OffsetBy(offset); - fMinimizeRect.OffsetBy(offset); - fMinimizeRect.OffsetBy(offset); - fTabRect.OffsetBy(offset); + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + + tab->zoomRect.OffsetBy(offset); + tab->closeRect.OffsetBy(offset); + tab->minimizeRect.OffsetBy(offset); + tab->tabRect.OffsetBy(offset); + } + fTitleBarRect.OffsetBy(offset); fFrame.OffsetBy(offset); fResizeRect.OffsetBy(offset); fBorderRect.OffsetBy(offset); diff --git a/src/servers/app/Decorator.h b/src/servers/app/Decorator.h index d02f2f360d..66451ec334 100644 --- a/src/servers/app/Decorator.h +++ b/src/servers/app/Decorator.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -27,6 +27,25 @@ class BRegion; class Decorator { public: + class Tab { + public: + Tab(); + virtual ~Tab() {} + + BRect zoomRect; + BRect closeRect; + BRect minimizeRect; + BRect tabRect; + + bool closePressed : 1; + bool zoomPressed : 1; + bool minimizePressed : 1; + + bool isFocused : 1; + + BString title; + }; + enum Region { REGION_NONE, @@ -61,6 +80,19 @@ public: window_look look, uint32 flags); virtual ~Decorator(); + virtual Decorator::Tab* AddTab(const char* title, int32 index = -1, + BRegion* updateRegion = NULL); + virtual bool RemoveTab(int32 index, + BRegion* updateRegion = NULL); + virtual bool MoveTab(int32 from, int32 to, bool isMoving, + BRegion* updateRegion = NULL); + virtual int32 TabAt(const BPoint& where) const; + Decorator::Tab* TabAt(int32 index) + { return fTabList.ItemAt(index); } + int32 CountTabs() const + { return fTabList.CountItems(); } + void SetTopTap(int32 tab); + void SetDrawingEngine(DrawingEngine *driver); inline DrawingEngine* GetDrawingEngine() const { return fDrawingEngine; } @@ -72,52 +104,50 @@ public: void SetFlags(uint32 flags, BRegion* updateRegion = NULL); - void SetClose(bool pressed); - void SetMinimize(bool pressed); - void SetZoom(bool pressed); - - void SetTitle(const char* string, - BRegion* updateRegion = NULL); - window_look Look() const; uint32 Flags() const; - const char* Title() const; - BRect BorderRect() const; - BRect TabRect() const; + BRect TitleBarRect() const; + BRect TabRect(int32 tab) const; + BRect TabRect(Decorator::Tab* tab) const; - bool GetClose(); - bool GetMinimize(); - bool GetZoom(); + void SetClose(int32 tab, bool pressed); + void SetMinimize(int32 tab, bool pressed); + void SetZoom(int32 tab, bool pressed); + + const char* Title(int32 tab) const; + const char* Title(Decorator::Tab* tab) const; + void SetTitle(int32 tab, const char* string, + BRegion* updateRegion = NULL); + + void SetFocus(int32 tab, bool focussed); + bool IsFocus(int32 tab) const; + bool IsFocus(Decorator::Tab* tab) const; + + /*! \return true if tab location updated, false if out of bounds + or unsupported */ + bool SetTabLocation(int32 tab, float location, + bool isShifting, BRegion* updateRegion = NULL); + virtual float TabLocation(int32 tab) const + { return 0.0; } + + virtual Region RegionAt(BPoint where, int32& tab) const; virtual void GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth, int32* maxHeight) const; - void SetFocus(bool focussed); - bool IsFocus() - { return fIsFocused; }; - const BRegion& GetFootprint(); - virtual Region RegionAt(BPoint where) const; - void MoveBy(float x, float y); void MoveBy(BPoint offset); void ResizeBy(float x, float y, BRegion* dirty); void ResizeBy(BPoint offset, BRegion* dirty); - /*! \return true if tab location updated, false if out of bounds - or unsupported - */ - bool SetTabLocation(float location, - BRegion* /*updateRegion*/ = NULL); - virtual float TabLocation() const - { return 0.0; } - virtual bool SetRegionHighlight(Region region, uint8 highlight, - BRegion* dirty); - inline uint8 RegionHighlight(Region region) const; + BRegion* dirty, int32 tab = -1); + inline uint8 RegionHighlight(Region region, + int32 tab = -1) const; bool SetSettings(const BMessage& settings, BRegion* updateRegion = NULL); @@ -125,30 +155,39 @@ public: virtual void Draw(BRect rect); virtual void Draw(); - virtual void DrawClose(); + virtual void DrawClose(int32 tab); + virtual void DrawMinimize(int32 tab); + virtual void DrawTab(int32 tab); + virtual void DrawTitle(int32 tab); + virtual void DrawZoom(int32 tab); virtual void DrawFrame(); - virtual void DrawMinimize(); - virtual void DrawTab(); - virtual void DrawTitle(); - virtual void DrawZoom(); rgb_color UIColor(color_which which); virtual void ExtendDirtyRegion(Region region, BRegion& dirty); protected: - int32 _TitleWidth() const - { return fTitle.CountChars(); } - virtual void _DoLayout(); virtual void _DrawFrame(BRect rect); - virtual void _DrawTab(BRect rect); - virtual void _DrawClose(BRect rect); - virtual void _DrawTitle(BRect rect); - virtual void _DrawZoom(BRect rect); - virtual void _DrawMinimize(BRect rect); + virtual void _DrawTabs(BRect rect); + virtual void _DrawTab(Decorator::Tab* tab, BRect rect); + virtual void _DrawClose(Decorator::Tab* tab, BRect rect); + virtual void _DrawTitle(Decorator::Tab* tab, BRect rect); + virtual void _DrawZoom(Decorator::Tab* tab, BRect rect); + virtual void _DrawMinimize(Decorator::Tab* tab, BRect rect); + + virtual Decorator::Tab* _AllocateNewTab() = 0; + + virtual void _SetTitle(Decorator::Tab* tab, const char* string, + BRegion* updateRegion = NULL) = 0; + int32 _TitleWidth(Decorator::Tab* tab) const + { return tab->title.CountChars(); } + + virtual bool _SetTabLocation(Decorator::Tab* tab, float location, + bool isShifting, BRegion* updateRegion = NULL); + virtual void _SetFocus(Decorator::Tab* tab); virtual void _FontsChanged(DesktopSettings& settings, BRegion* updateRegion = NULL); @@ -157,20 +196,19 @@ protected: virtual void _SetFlags(uint32 flags, BRegion* updateRegion = NULL); - virtual void _SetTitle(const char* string, - BRegion* updateRegion = NULL) = 0; - - virtual void _SetFocus(); virtual void _MoveBy(BPoint offset); virtual void _ResizeBy(BPoint offset, BRegion* dirty) = 0; - virtual bool _SetTabLocation(float location, - BRegion* /*updateRegion*/ = NULL) - { return false; } - virtual bool _SetSettings(const BMessage& settings, BRegion* updateRegion = NULL); + virtual bool _AddTab(int32 index = -1, + BRegion* updateRegion = NULL) = 0; + virtual bool _RemoveTab(int32 index, + BRegion* updateRegion = NULL) = 0; + virtual bool _MoveTab(int32 from, int32 to, bool isMoving, + BRegion* updateRegion = NULL) = 0; + virtual void _GetFootprint(BRegion *region); void _InvalidateFootprint(); @@ -180,23 +218,14 @@ protected: window_look fLook; uint32 fFlags; - BRect fZoomRect; - BRect fCloseRect; - BRect fMinimizeRect; - BRect fTabRect; + BRect fTitleBarRect; BRect fFrame; BRect fResizeRect; BRect fBorderRect; + Decorator::Tab* fTopTab; + BObjectList fTabList; private: - bool fClosePressed : 1; - bool fZoomPressed : 1; - bool fMinimizePressed : 1; - - bool fIsFocused : 1; - - BString fTitle; - BRegion fFootprint; bool fFootprintValid : 1; @@ -205,7 +234,7 @@ private: uint8 -Decorator::RegionHighlight(Region region) const +Decorator::RegionHighlight(Region region, int32 tab) const { int32 index = (int32)region - 1; return index >= 0 && index < REGION_COUNT - 1 diff --git a/src/servers/app/DefaultDecorator.cpp b/src/servers/app/DefaultDecorator.cpp index ea6840e85a..fe0fb01dad 100644 --- a/src/servers/app/DefaultDecorator.cpp +++ b/src/servers/app/DefaultDecorator.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku, Inc. + * Copyright 2001-2011, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -18,10 +18,12 @@ #include "DefaultDecorator.h" #include +#include #include #include #include +#include #include #include #include @@ -45,6 +47,18 @@ #endif +DefaultDecorator::Tab::Tab() + : + tabOffset(0), + tabLocation(0.0), + isHighlighted(false) +{ + closeBitmaps[0] = closeBitmaps[1] = closeBitmaps[2] = closeBitmaps[3] + = zoomBitmaps[0] = zoomBitmaps[1] = zoomBitmaps[2] = zoomBitmaps[3] + = NULL; +} + + static const float kBorderResizeLength = 22.0; static const float kResizeKnobSize = 18.0; @@ -107,19 +121,11 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect, kNonFocusTabColorShadow(tint_color(kNonFocusTabColor, (B_DARKEN_1_TINT + B_NO_TINT) / 2)), kNonFocusTextColor(settings.UIColor(B_WINDOW_INACTIVE_TEXT_COLOR)), - fTabOffset(0), - fTabLocation(0.0) + + fOldMovingTab(0, 0, -1, -1) { _UpdateFont(settings); - fCloseBitmaps[0] = fCloseBitmaps[1] = fCloseBitmaps[2] = fCloseBitmaps[3] - = fZoomBitmaps[0] = fZoomBitmaps[1] = fZoomBitmaps[2] = fZoomBitmaps[3] - = NULL; - - // Set appropriate colors based on the current focus value. In this case, - // each decorator defaults to not having the focus. - _SetFocus(); - // Do initial decorator setup _DoLayout(); @@ -138,19 +144,36 @@ DefaultDecorator::~DefaultDecorator() } +float +DefaultDecorator::TabLocation(int32 tab) const +{ + DefaultDecorator::Tab* decoratorTab = _TabAt(tab); + if (decoratorTab == NULL) + return 0.; + return (float)decoratorTab->tabOffset; +} + + bool DefaultDecorator::GetSettings(BMessage* settings) const { - if (!fTabRect.IsValid()) + if (!fTitleBarRect.IsValid()) return false; - if (settings->AddRect("tab frame", fTabRect) != B_OK) + if (settings->AddRect("tab frame", fTitleBarRect) != B_OK) return false; if (settings->AddFloat("border width", fBorderWidth) != B_OK) return false; - return settings->AddFloat("tab location", (float)fTabOffset) == B_OK; + // TODO only add the location of the tab of the window who requested the + // settings + for (int32 i = 0; i < fTabList.CountItems(); i++) { + DefaultDecorator::Tab* tab = _TabAt(i); + if (settings->AddFloat("tab location", (float)tab->tabOffset) != B_OK) + return false; + } + return true; } @@ -168,7 +191,7 @@ DefaultDecorator::Draw(BRect update) fDrawingEngine->SetDrawState(&fDrawState); _DrawFrame(update); - _DrawTab(update); + _DrawTabs(update); } @@ -180,7 +203,7 @@ DefaultDecorator::Draw() fDrawingEngine->SetDrawState(&fDrawState); _DrawFrame(BRect(fTopBorder.LeftTop(), fBottomBorder.RightBottom())); - _DrawTab(fTabRect); + _DrawTabs(fTitleBarRect); } @@ -188,9 +211,12 @@ void DefaultDecorator::GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth, int32* maxHeight) const { - if (fTabRect.IsValid()) { + float minTabSize = 0; + if (CountTabs() > 0) + minTabSize = _TabAt(0)->minTabSize; + if (fTitleBarRect.IsValid()) { *minWidth = (int32)roundf(max_c(*minWidth, - fMinTabSize - 2 * fBorderWidth)); + minTabSize - 2 * fBorderWidth)); } if (fResizeRect.IsValid()) { *minHeight = (int32)roundf(max_c(*minHeight, @@ -200,10 +226,10 @@ DefaultDecorator::GetSizeLimits(int32* minWidth, int32* minHeight, Decorator::Region -DefaultDecorator::RegionAt(BPoint where) const +DefaultDecorator::RegionAt(BPoint where, int32& tab) const { // Let the base class version identify hits of the buttons and the tab. - Region region = Decorator::RegionAt(where); + Region region = Decorator::RegionAt(where, tab); if (region != REGION_NONE) return region; @@ -245,24 +271,28 @@ DefaultDecorator::RegionAt(BPoint where) const bool DefaultDecorator::SetRegionHighlight(Region region, uint8 highlight, - BRegion* dirty) + BRegion* dirty, int32 tabIndex) { - // Invalidate the bitmap caches for the close/zoom button, when the - // highlight changes. - switch (region) { - case REGION_CLOSE_BUTTON: - if (highlight != RegionHighlight(region)) - memset(&fCloseBitmaps, 0, sizeof(fCloseBitmaps)); - break; - case REGION_ZOOM_BUTTON: - if (highlight != RegionHighlight(region)) - memset(&fZoomBitmaps, 0, sizeof(fZoomBitmaps)); - break; - default: - break; + DefaultDecorator::Tab* tab = _TabAt(tabIndex); + if (tab != NULL) { + tab->isHighlighted = highlight != 0; + // Invalidate the bitmap caches for the close/zoom button, when the + // highlight changes. + switch (region) { + case REGION_CLOSE_BUTTON: + if (highlight != RegionHighlight(region)) + memset(&tab->closeBitmaps, 0, sizeof(tab->closeBitmaps)); + break; + case REGION_ZOOM_BUTTON: + if (highlight != RegionHighlight(region)) + memset(&tab->zoomBitmaps, 0, sizeof(tab->zoomBitmaps)); + break; + default: + break; + } } - return Decorator::SetRegionHighlight(region, highlight, dirty); + return Decorator::SetRegionHighlight(region, highlight, dirty, tabIndex); } @@ -271,17 +301,19 @@ DefaultDecorator::ExtendDirtyRegion(Region region, BRegion& dirty) { switch (region) { case REGION_TAB: - dirty.Include(fTabRect); + dirty.Include(fTitleBarRect); break; case REGION_CLOSE_BUTTON: if ((fFlags & B_NOT_CLOSABLE) == 0) - dirty.Include(fCloseRect); + for (int32 i = 0; i < fTabList.CountItems(); i++) + dirty.Include(fTabList.ItemAt(i)->closeRect); break; case REGION_ZOOM_BUTTON: if ((fFlags & B_NOT_ZOOMABLE) == 0) - dirty.Include(fZoomRect); + for (int32 i = 0; i < fTabList.CountItems(); i++) + dirty.Include(fTabList.ItemAt(i)->zoomRect); break; case REGION_LEFT_BORDER: @@ -335,8 +367,8 @@ DefaultDecorator::BorderWidth() float DefaultDecorator::TabHeight() { - if (fTabRect.IsValid()) - return fTabRect.Height(); + if (fTitleBarRect.IsValid()) + return fTitleBarRect.Height(); return BorderWidth(); } @@ -374,77 +406,6 @@ DefaultDecorator::_DoLayout() fBorderWidth = 0; } - // calculate our tab rect - if (hasTab) { - // distance from one item of the tab bar to another. - // In this case the text and close/zoom rects - fTextOffset = (fLook == B_FLOATING_WINDOW_LOOK - || fLook == kLeftTitledWindowLook) ? 10 : 18; - - font_height fontHeight; - fDrawState.Font().GetHeight(fontHeight); - - if (fLook != kLeftTitledWindowLook) { - fTabRect.Set(fFrame.left - fBorderWidth, - fFrame.top - fBorderWidth - - ceilf(fontHeight.ascent + fontHeight.descent + 7.0), - ((fFrame.right - fFrame.left) < 35.0 ? - fFrame.left + 35.0 : fFrame.right) + fBorderWidth, - fFrame.top - fBorderWidth); - } else { - fTabRect.Set(fFrame.left - fBorderWidth - - ceilf(fontHeight.ascent + fontHeight.descent + 5.0), - fFrame.top - fBorderWidth, fFrame.left - fBorderWidth, - fFrame.bottom + fBorderWidth); - } - - // format tab rect for a floating window - make the rect smaller - if (fLook == B_FLOATING_WINDOW_LOOK) { - fTabRect.InsetBy(0, 2); - fTabRect.OffsetBy(0, 2); - } - - float offset; - float size; - float inset; - _GetButtonSizeAndOffset(fTabRect, &offset, &size, &inset); - - // fMinTabSize contains just the room for the buttons - fMinTabSize = inset * 2 + fTextOffset; - if ((fFlags & B_NOT_CLOSABLE) == 0) - fMinTabSize += offset + size; - if ((fFlags & B_NOT_ZOOMABLE) == 0) - fMinTabSize += offset + size; - - // fMaxTabSize contains fMinWidth + the width required for the title - fMaxTabSize = fDrawingEngine - ? ceilf(fDrawingEngine->StringWidth(Title(), strlen(Title()), - fDrawState.Font())) : 0.0; - if (fMaxTabSize > 0.0) - fMaxTabSize += fTextOffset; - fMaxTabSize += fMinTabSize; - - float tabSize = (fLook != kLeftTitledWindowLook - ? fFrame.Width() : fFrame.Height()) + fBorderWidth * 2; - if (tabSize < fMinTabSize) - tabSize = fMinTabSize; - if (tabSize > fMaxTabSize) - tabSize = fMaxTabSize; - - // layout buttons and truncate text - if (fLook != kLeftTitledWindowLook) - fTabRect.right = fTabRect.left + tabSize; - else - fTabRect.bottom = fTabRect.top + tabSize; - } else { - // no tab - fMinTabSize = 0.0; - fMaxTabSize = 0.0; - fTabRect.Set(0.0, 0.0, -1.0, -1.0); - fCloseRect.Set(0.0, 0.0, -1.0, -1.0); - fZoomRect.Set(0.0, 0.0, -1.0, -1.0); - } - // calculate left/top/right/bottom borders if (fBorderWidth > 0) { // NOTE: no overlapping, the left and right border rects @@ -479,21 +440,205 @@ DefaultDecorator::_DoLayout() } if (hasTab) { - // make sure fTabOffset is within limits and apply it to - // the fTabRect - if (fTabLocation != 0.0 - && fTabOffset > (fRightBorder.right - fLeftBorder.left - - fTabRect.Width())) - fTabOffset = uint32(fRightBorder.right - fLeftBorder.left - - fTabRect.Width()); - fTabRect.OffsetBy(fTabOffset, 0); - - // finally, layout the buttons and text within the tab rect - _LayoutTabItems(fTabRect); + _DoTabLayout(); + return; + } else { + // no tab + fTitleBarRect.Set(0.0, 0.0, -1.0, -1.0); } } +void +DefaultDecorator::_DoTabLayout() +{ + float tabPosition = 0; + if (fTabList.CountItems() == 1) + tabPosition = _TabAt(0)->tabOffset; + float sumTabWidth = 0; + // calculate our tab rect + for (int32 i = 0; i < fTabList.CountItems(); i++) { + DefaultDecorator::Tab* tab = _TabAt(i); + + BRect& tabRect = tab->tabRect; + // distance from one item of the tab bar to another. + // In this case the text and close/zoom rects + tab->textOffset = _DefaultTextOffset(); + + font_height fontHeight; + fDrawState.Font().GetHeight(fontHeight); + + if (fLook != kLeftTitledWindowLook) { + tabRect.Set(fFrame.left - fBorderWidth, + fFrame.top - fBorderWidth + - ceilf(fontHeight.ascent + fontHeight.descent + 7.0), + ((fFrame.right - fFrame.left) < 35.0 ? + fFrame.left + 35.0 : fFrame.right) + fBorderWidth, + fFrame.top - fBorderWidth); + } else { + tabRect.Set(fFrame.left - fBorderWidth + - ceilf(fontHeight.ascent + fontHeight.descent + 5.0), + fFrame.top - fBorderWidth, fFrame.left - fBorderWidth, + fFrame.bottom + fBorderWidth); + } + + // format tab rect for a floating window - make the rect smaller + if (fLook == B_FLOATING_WINDOW_LOOK) { + tabRect.InsetBy(0, 2); + tabRect.OffsetBy(0, 2); + } + + float offset; + float size; + float inset; + _GetButtonSizeAndOffset(tabRect, &offset, &size, &inset); + + // tab->minTabSize contains just the room for the buttons + tab->minTabSize = inset * 2 + tab->textOffset; + if ((fFlags & B_NOT_CLOSABLE) == 0) + tab->minTabSize += offset + size; + if ((fFlags & B_NOT_ZOOMABLE) == 0) + tab->minTabSize += offset + size; + + // tab->maxTabSize contains tab->minTabSize + the width required for the + // title + tab->maxTabSize = fDrawingEngine + ? ceilf(fDrawingEngine->StringWidth(Title(tab), strlen(Title(tab)), + fDrawState.Font())) : 0.0; + if (tab->maxTabSize > 0.0) + tab->maxTabSize += tab->textOffset; + tab->maxTabSize += tab->minTabSize; + + float tabSize = (fLook != kLeftTitledWindowLook + ? fFrame.Width() : fFrame.Height()) + fBorderWidth * 2; + if (tabSize < tab->minTabSize) + tabSize = tab->minTabSize; + if (tabSize > tab->maxTabSize) + tabSize = tab->maxTabSize; + + // layout buttons and truncate text + if (fLook != kLeftTitledWindowLook) + tabRect.right = tabRect.left + tabSize; + else + tabRect.bottom = tabRect.top + tabSize; + + // make sure fTabOffset is within limits and apply it to + // the tabRect + if (tab->tabLocation != 0.0 + && tab->tabOffset > (fRightBorder.right - fLeftBorder.left + - tabRect.Width())) { + tab->tabOffset = uint32(fRightBorder.right - fLeftBorder.left + - tabRect.Width()); + } + tab->tabOffset = (uint32)tabPosition; + tabRect.OffsetBy(tab->tabOffset, 0); + tabPosition += tabRect.Width(); + + sumTabWidth += tabRect.Width(); + } + + float windowWidth = fFrame.Width() + 2 * fBorderWidth; + if (CountTabs() > 1 && sumTabWidth > windowWidth) + _DistributeTabSize(sumTabWidth - windowWidth); + + // finally, layout the buttons and text within the tab rect + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + + if (i == 0) + fTitleBarRect = tab->tabRect; + else + fTitleBarRect = fTitleBarRect | tab->tabRect; + + _LayoutTabItems(tab, tab->tabRect); + } + fTabsRegion = fTitleBarRect; +} + + +static bool +int_equal(float x, float y) +{ + return abs(x - y) <= 1; +} + + +void +DefaultDecorator::_DistributeTabSize(float delta) +{ + ASSERT(CountTabs() > 1); + + float maxTabSize = 0; + float secMaxTabSize = 0; + int32 nTabsWithMaxSize = 0; + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + float tabWidth = tab->tabRect.Width(); + if (int_equal(maxTabSize, tabWidth)) { + nTabsWithMaxSize++; + continue; + } + if (maxTabSize < tabWidth) { + secMaxTabSize = maxTabSize; + maxTabSize = tabWidth; + nTabsWithMaxSize = 1; + } else if (secMaxTabSize <= tabWidth) + secMaxTabSize = tabWidth; + } + + float minus = ceil(std::min(maxTabSize - secMaxTabSize, delta)); + delta -= minus; + minus /= nTabsWithMaxSize; + + Decorator::Tab* prevTab = NULL; + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + if (int_equal(maxTabSize, tab->tabRect.Width())) + tab->tabRect.right -= minus; + + if (prevTab) { + tab->tabRect.OffsetBy(prevTab->tabRect.right - tab->tabRect.left, + 0); + } + + prevTab = tab; + } + + if (delta > 0) { + _DistributeTabSize(delta); + return; + } + + // done + prevTab->tabRect.right = floor(fFrame.right + fBorderWidth); + + for (int32 i = 0; i < fTabList.CountItems(); i++) { + DefaultDecorator::Tab* tab = _TabAt(i); + tab->tabOffset = uint32(tab->tabRect.left - fLeftBorder.left); + } +} + + +Decorator::Tab* +DefaultDecorator::_AllocateNewTab() +{ + Decorator::Tab* tab = new(std::nothrow) DefaultDecorator::Tab; + if (tab == NULL) + return NULL; + // Set appropriate colors based on the current focus value. In this case, + // each decorator defaults to not having the focus. + _SetFocus(tab); + return tab; +} + + +DefaultDecorator::Tab* +DefaultDecorator::_TabAt(int32 index) const +{ + return static_cast(fTabList.ItemAt(index)); +} + + void DefaultDecorator::_DrawFrame(BRect invalid) { @@ -525,12 +670,14 @@ DefaultDecorator::_DrawFrame(BRect invalid) fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i), BPoint(r.right - i, r.top + i), colors[i]); } - if (fTabRect.IsValid()) { + if (fTitleBarRect.IsValid()) { // grey along the bottom of the tab // (overwrites "white" from frame) fDrawingEngine->StrokeLine( - BPoint(fTabRect.left + 2, fTabRect.bottom + 1), - BPoint(fTabRect.right - 2, fTabRect.bottom + 1), + BPoint(fTitleBarRect.left + 2, + fTitleBarRect.bottom + 1), + BPoint(fTitleBarRect.right - 2, + fTitleBarRect.bottom + 1), colors[2]); } } @@ -581,13 +728,14 @@ DefaultDecorator::_DrawFrame(BRect invalid) fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i), BPoint(r.right - i, r.top + i), colors[i * 2]); } - if (fTabRect.IsValid() && fLook != kLeftTitledWindowLook) { + if (fTitleBarRect.IsValid() && fLook != kLeftTitledWindowLook) { // grey along the bottom of the tab // (overwrites "white" from frame) fDrawingEngine->StrokeLine( - BPoint(fTabRect.left + 2, fTabRect.bottom + 1), - BPoint(fTabRect.right - 2, fTabRect.bottom + 1), - colors[2]); + BPoint(fTitleBarRect.left + 2, + fTitleBarRect.bottom + 1), + BPoint(fTitleBarRect.right - 2, + fTitleBarRect.bottom + 1), colors[2]); } } // left @@ -599,13 +747,14 @@ DefaultDecorator::_DrawFrame(BRect invalid) fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i), BPoint(r.left + i, r.bottom - i), colors[i * 2]); } - if (fLook == kLeftTitledWindowLook && fTabRect.IsValid()) { + if (fLook == kLeftTitledWindowLook && fTitleBarRect.IsValid()) { // grey along the right side of the tab // (overwrites "white" from frame) fDrawingEngine->StrokeLine( - BPoint(fTabRect.right + 1, fTabRect.top + 2), - BPoint(fTabRect.right + 1, fTabRect.bottom - 2), - colors[2]); + BPoint(fTitleBarRect.right + 1, + fTitleBarRect.top + 2), + BPoint(fTitleBarRect.right + 1, + fTitleBarRect.bottom - 2), colors[2]); } } // bottom @@ -683,7 +832,7 @@ DefaultDecorator::_DrawFrame(BRect invalid) fDrawingEngine->StrokeLine(BPoint(x - 14, y - 14), BPoint(x - 1, y - 14), colors[1]); - if (!IsFocus()) + if (fTopTab && !IsFocus(fTopTab)) break; static const rgb_color kWhite @@ -729,86 +878,93 @@ DefaultDecorator::_DrawFrame(BRect invalid) void -DefaultDecorator::_DrawTab(BRect invalid) +DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid) { STRACE(("_DrawTab(%.1f,%.1f,%.1f,%.1f)\n", - invalid.left, invalid.top, invalid.right, invalid.bottom)); + invalid.left, invalid.top, invalid.right, invalid.bottom)); + const BRect& tabRect = tab->tabRect; // If a window has a tab, this will draw it and any buttons which are // in it. - if (!fTabRect.IsValid() || !invalid.Intersects(fTabRect)) + if (!tabRect.IsValid() || !invalid.Intersects(tabRect)) return; ComponentColors colors; - _GetComponentColors(COMPONENT_TAB, colors); + _GetComponentColors(COMPONENT_TAB, colors, tab); // outer frame - fDrawingEngine->StrokeLine(fTabRect.LeftTop(), fTabRect.LeftBottom(), + fDrawingEngine->StrokeLine(tabRect.LeftTop(), tabRect.LeftBottom(), colors[COLOR_TAB_FRAME_LIGHT]); - fDrawingEngine->StrokeLine(fTabRect.LeftTop(), fTabRect.RightTop(), + fDrawingEngine->StrokeLine(tabRect.LeftTop(), tabRect.RightTop(), colors[COLOR_TAB_FRAME_LIGHT]); if (fLook != kLeftTitledWindowLook) { - fDrawingEngine->StrokeLine(fTabRect.RightTop(), fTabRect.RightBottom(), + fDrawingEngine->StrokeLine(tabRect.RightTop(), tabRect.RightBottom(), colors[COLOR_TAB_FRAME_DARK]); } else { - fDrawingEngine->StrokeLine(fTabRect.LeftBottom(), - fTabRect.RightBottom(), colors[COLOR_TAB_FRAME_DARK]); + fDrawingEngine->StrokeLine(tabRect.LeftBottom(), + tabRect.RightBottom(), colors[COLOR_TAB_FRAME_DARK]); } + float tabBotton = tabRect.bottom; + if (fTopTab != tab) + tabBotton -= 1; + // bevel - fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 1, fTabRect.top + 1), - BPoint(fTabRect.left + 1, - fTabRect.bottom - (fLook == kLeftTitledWindowLook ? 1 : 0)), + fDrawingEngine->StrokeLine(BPoint(tabRect.left + 1, tabRect.top + 1), + BPoint(tabRect.left + 1, + tabBotton - (fLook == kLeftTitledWindowLook ? 1 : 0)), colors[COLOR_TAB_BEVEL]); - fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 1, fTabRect.top + 1), - BPoint(fTabRect.right - (fLook == kLeftTitledWindowLook ? 0 : 1), - fTabRect.top + 1), + fDrawingEngine->StrokeLine(BPoint(tabRect.left + 1, tabRect.top + 1), + BPoint(tabRect.right - (fLook == kLeftTitledWindowLook ? 0 : 1), + tabRect.top + 1), colors[COLOR_TAB_BEVEL]); if (fLook != kLeftTitledWindowLook) { - fDrawingEngine->StrokeLine(BPoint(fTabRect.right - 1, fTabRect.top + 2), - BPoint(fTabRect.right - 1, fTabRect.bottom), + fDrawingEngine->StrokeLine(BPoint(tabRect.right - 1, tabRect.top + 2), + BPoint(tabRect.right - 1, tabBotton), colors[COLOR_TAB_SHADOW]); } else { fDrawingEngine->StrokeLine( - BPoint(fTabRect.left + 2, fTabRect.bottom - 1), - BPoint(fTabRect.right, fTabRect.bottom - 1), + BPoint(tabRect.left + 2, tabRect.bottom - 1), + BPoint(tabRect.right, tabRect.bottom - 1), colors[COLOR_TAB_SHADOW]); } // fill BGradientLinear gradient; - gradient.SetStart(fTabRect.LeftTop()); + gradient.SetStart(tabRect.LeftTop()); gradient.AddColor(colors[COLOR_TAB_LIGHT], 0); gradient.AddColor(colors[COLOR_TAB], 255); if (fLook != kLeftTitledWindowLook) { - gradient.SetEnd(fTabRect.LeftBottom()); - fDrawingEngine->FillRect(BRect(fTabRect.left + 2, fTabRect.top + 2, - fTabRect.right - 2, fTabRect.bottom), gradient); + gradient.SetEnd(tabRect.LeftBottom()); + fDrawingEngine->FillRect(BRect(tabRect.left + 2, tabRect.top + 2, + tabRect.right - 2, tabBotton), gradient); } else { - gradient.SetEnd(fTabRect.RightTop()); - fDrawingEngine->FillRect(BRect(fTabRect.left + 2, fTabRect.top + 2, - fTabRect.right, fTabRect.bottom - 2), gradient); + gradient.SetEnd(tabRect.RightTop()); + fDrawingEngine->FillRect(BRect(tabRect.left + 2, tabRect.top + 2, + tabRect.right, tabRect.bottom - 2), gradient); } - _DrawTitle(fTabRect); + _DrawTitle(tab, tabRect); - DrawButtons(invalid); + DrawButtons(tab, invalid); } void -DefaultDecorator::_DrawClose(BRect rect) +DefaultDecorator::_DrawClose(Decorator::Tab* _tab, BRect rect) { STRACE(("_DrawClose(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right, rect.bottom)); - int32 index = (fButtonFocus ? 0 : 1) + (GetClose() ? 0 : 2); - ServerBitmap* bitmap = fCloseBitmaps[index]; + DefaultDecorator::Tab* tab = static_cast(_tab); + + int32 index = (tab->buttonFocus ? 0 : 1) + (tab->closePressed ? 0 : 2); + ServerBitmap* bitmap = tab->closeBitmaps[index]; if (bitmap == NULL) { - bitmap = _GetBitmapForButton(COMPONENT_CLOSE_BUTTON, GetClose(), - rect.IntegerWidth(), rect.IntegerHeight()); - fCloseBitmaps[index] = bitmap; + bitmap = _GetBitmapForButton(tab, COMPONENT_CLOSE_BUTTON, + tab->closePressed, rect.IntegerWidth(), rect.IntegerHeight()); + tab->closeBitmaps[index] = bitmap; } _DrawButtonBitmap(bitmap, rect); @@ -816,12 +972,18 @@ DefaultDecorator::_DrawClose(BRect rect) void -DefaultDecorator::_DrawTitle(BRect r) +DefaultDecorator::_DrawTitle(Decorator::Tab* _tab, BRect r) { + DefaultDecorator::Tab* tab = static_cast(_tab); + + const BRect& tabRect = tab->tabRect; + const BRect& closeRect = tab->closeRect; + const BRect& zoomRect = tab->zoomRect; + STRACE(("_DrawTitle(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom)); ComponentColors colors; - _GetComponentColors(COMPONENT_TAB, colors); + _GetComponentColors(COMPONENT_TAB, colors, tab); fDrawingEngine->SetDrawingMode(B_OP_OVER); fDrawingEngine->SetHighColor(colors[COLOR_TAB_TEXT]); @@ -833,20 +995,20 @@ DefaultDecorator::_DrawTitle(BRect r) BPoint titlePos; if (fLook != kLeftTitledWindowLook) { - titlePos.x = fCloseRect.IsValid() ? fCloseRect.right + fTextOffset - : fTabRect.left + fTextOffset; - titlePos.y = floorf(((fTabRect.top + 2.0) + fTabRect.bottom + titlePos.x = closeRect.IsValid() ? closeRect.right + tab->textOffset + : tabRect.left + tab->textOffset; + titlePos.y = floorf(((tabRect.top + 2.0) + tabRect.bottom + fontHeight.ascent + fontHeight.descent) / 2.0 - fontHeight.descent + 0.5); } else { - titlePos.x = floorf(((fTabRect.left + 2.0) + fTabRect.right + titlePos.x = floorf(((tabRect.left + 2.0) + tabRect.right + fontHeight.ascent + fontHeight.descent) / 2.0 - fontHeight.descent + 0.5); - titlePos.y = fZoomRect.IsValid() ? fZoomRect.top - fTextOffset - : fTabRect.bottom - fTextOffset; + titlePos.y = zoomRect.IsValid() ? zoomRect.top - tab->textOffset + : tabRect.bottom - tab->textOffset; } - fDrawingEngine->DrawString(fTruncatedTitle.String(), fTruncatedTitleLength, + fDrawingEngine->DrawString(tab->truncatedTitle, tab->truncatedTitleLength, titlePos); fDrawingEngine->SetDrawingMode(B_OP_COPY); @@ -854,17 +1016,20 @@ DefaultDecorator::_DrawTitle(BRect r) void -DefaultDecorator::_DrawZoom(BRect rect) +DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, BRect rect) { STRACE(("_DrawZoom(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right, rect.bottom)); + if (rect.IntegerWidth() < 1) + return; + DefaultDecorator::Tab* tab = static_cast(_tab); - int32 index = (fButtonFocus ? 0 : 1) + (GetZoom() ? 0 : 2); - ServerBitmap* bitmap = fZoomBitmaps[index]; + int32 index = (tab->buttonFocus ? 0 : 1) + (tab->zoomPressed ? 0 : 2); + ServerBitmap* bitmap = tab->zoomBitmaps[index]; if (bitmap == NULL) { - bitmap = _GetBitmapForButton(COMPONENT_ZOOM_BUTTON, GetZoom(), - rect.IntegerWidth(), rect.IntegerHeight()); - fZoomBitmaps[index] = bitmap; + bitmap = _GetBitmapForButton(tab, COMPONENT_ZOOM_BUTTON, + tab->zoomPressed, rect.IntegerWidth(), rect.IntegerHeight()); + tab->zoomBitmaps[index] = bitmap; } _DrawButtonBitmap(bitmap, rect); @@ -872,18 +1037,19 @@ DefaultDecorator::_DrawZoom(BRect rect) void -DefaultDecorator::_SetTitle(const char* string, BRegion* updateRegion) +DefaultDecorator::_SetTitle(Decorator::Tab* tab, const char* string, + BRegion* updateRegion) { // TODO: we could be much smarter about the update region - BRect rect = TabRect(); + BRect rect = TabRect(tab); _DoLayout(); if (updateRegion == NULL) return; - rect = rect | TabRect(); + rect = rect | TabRect(tab); rect.bottom++; // the border will look differently when the title is adjacent @@ -951,11 +1117,14 @@ DefaultDecorator::_SetFlags(uint32 flags, BRegion* updateRegion) void -DefaultDecorator::_SetFocus() +DefaultDecorator::_SetFocus(Decorator::Tab* _tab) { - fButtonFocus = IsFocus() + DefaultDecorator::Tab* tab = static_cast(_tab); + tab->buttonFocus = IsFocus(tab) || ((fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook) && (fFlags & B_AVOID_FOCUS) != 0); + if (CountTabs() > 1) + _LayoutTabItems(tab, tab->tabRect); } @@ -964,11 +1133,17 @@ DefaultDecorator::_MoveBy(BPoint offset) { STRACE(("DefaultDecorator: Move By (%.1f, %.1f)\n", offset.x, offset.y)); // Move all internal rectangles the appropriate amount + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + + tab->zoomRect.OffsetBy(offset); + tab->closeRect.OffsetBy(offset); + tab->tabRect.OffsetBy(offset); + } fFrame.OffsetBy(offset); - fCloseRect.OffsetBy(offset); - fTabRect.OffsetBy(offset); + fTitleBarRect.OffsetBy(offset); + fTabsRegion.OffsetBy(offset); fResizeRect.OffsetBy(offset); - fZoomRect.OffsetBy(offset); fBorderRect.OffsetBy(offset); fLeftBorder.OffsetBy(offset); @@ -1066,8 +1241,16 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) } // resize tab and layout tab items - if (fTabRect.IsValid()) { - BRect oldTabRect(fTabRect); + if (fTitleBarRect.IsValid()) { + if (fTabList.CountItems() > 1) { + _DoTabLayout(); + dirty->Include(fTitleBarRect); + return; + } + + DefaultDecorator::Tab* tab = _TabAt(0); + BRect& tabRect = tab->tabRect; + BRect oldTabRect(tabRect); float tabSize; float maxLocation; @@ -1076,39 +1259,39 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) } else { tabSize = fBottomBorder.bottom - fTopBorder.top; } - maxLocation = tabSize - fMaxTabSize; + maxLocation = tabSize - tab->maxTabSize; if (maxLocation < 0) maxLocation = 0; - float tabOffset = floorf(fTabLocation * maxLocation); - float delta = tabOffset - fTabOffset; - fTabOffset = (uint32)tabOffset; + float tabOffset = floorf(tab->tabLocation * maxLocation); + float delta = tabOffset - tab->tabOffset; + tab->tabOffset = (uint32)tabOffset; if (fLook != kLeftTitledWindowLook) - fTabRect.OffsetBy(delta, 0.0); + tabRect.OffsetBy(delta, 0.0); else - fTabRect.OffsetBy(0.0, delta); + tabRect.OffsetBy(0.0, delta); - if (tabSize < fMinTabSize) - tabSize = fMinTabSize; - if (tabSize > fMaxTabSize) - tabSize = fMaxTabSize; + if (tabSize < tab->minTabSize) + tabSize = tab->minTabSize; + if (tabSize > tab->maxTabSize) + tabSize = tab->maxTabSize; - if (fLook != kLeftTitledWindowLook && tabSize != fTabRect.Width()) { - fTabRect.right = fTabRect.left + tabSize; + if (fLook != kLeftTitledWindowLook && tabSize != tabRect.Width()) { + tabRect.right = tabRect.left + tabSize; } else if (fLook == kLeftTitledWindowLook - && tabSize != fTabRect.Height()) { - fTabRect.bottom = fTabRect.top + tabSize; + && tabSize != tabRect.Height()) { + tabRect.bottom = tabRect.top + tabSize; } - if (oldTabRect != fTabRect) { - _LayoutTabItems(fTabRect); + if (oldTabRect != tabRect) { + _LayoutTabItems(tab, tabRect); if (dirty) { // NOTE: the tab rect becoming smaller only would // handled be the Desktop anyways, so it is sufficient // to include it into the dirty region in it's // final state - BRect redraw(fTabRect); + BRect redraw(tabRect); if (delta != 0.0) { redraw = redraw | oldTabRect; if (fLook != kLeftTitledWindowLook) @@ -1119,44 +1302,72 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) dirty->Include(redraw); } } + fTitleBarRect = tabRect; + fTabsRegion = fTitleBarRect; } } bool -DefaultDecorator::_SetTabLocation(float location, BRegion* updateRegion) +DefaultDecorator::_SetTabLocation(Decorator::Tab* _tab, float location, + bool isShifting, BRegion* updateRegion) { STRACE(("DefaultDecorator: Set Tab Location(%.1f)\n", location)); - if (!fTabRect.IsValid()) + if (CountTabs() > 1) { + if (isShifting == false) { + _DoTabLayout(); + if (updateRegion != NULL) + updateRegion->Include(fTitleBarRect); + fOldMovingTab = BRect(0, 0, -1, -1); + return true; + } else { + if (fOldMovingTab.IsValid() == false) + fOldMovingTab = _tab->tabRect; + } + } + + DefaultDecorator::Tab* tab = static_cast(_tab); + BRect& tabRect = tab->tabRect; + if (tabRect.IsValid() == false) return false; if (location < 0) location = 0; float maxLocation - = fRightBorder.right - fLeftBorder.left - fTabRect.Width(); + = fRightBorder.right - fLeftBorder.left - tabRect.Width(); + if (CountTabs() > 1) + maxLocation = fTitleBarRect.right - fLeftBorder.left - tabRect.Width(); + if (location > maxLocation) location = maxLocation; - float delta = location - fTabOffset; + float delta = floor(location - tab->tabOffset); if (delta == 0.0) return false; - // redraw old rect (1 pix on the border also must be updated) - BRect trect(fTabRect); - trect.bottom++; - updateRegion->Include(trect); + // redraw old rect (1 pixel on the border must also be updated) + BRect rect(tabRect); + rect.bottom++; + if (updateRegion != NULL) + updateRegion->Include(rect); - fTabRect.OffsetBy(delta, 0); - fTabOffset = (int32)location; - _LayoutTabItems(fTabRect); + tabRect.OffsetBy(delta, 0); + tab->tabOffset = (int32)location; + _LayoutTabItems(_tab, tabRect); + tab->tabLocation = maxLocation > 0.0 ? tab->tabOffset / maxLocation : 0.0; - fTabLocation = maxLocation > 0.0 ? fTabOffset / maxLocation : 0.0; + if (fTabList.CountItems() == 1) + fTitleBarRect = tabRect; + + _CalculateTabsRegion(); // redraw new rect as well - trect = fTabRect; - trect.bottom++; - updateRegion->Include(trect); + rect = tabRect; + rect.bottom++; + if (updateRegion != NULL) + updateRegion->Include(rect); + return true; } @@ -1165,10 +1376,63 @@ bool DefaultDecorator::_SetSettings(const BMessage& settings, BRegion* updateRegion) { float tabLocation; - if (settings.FindFloat("tab location", &tabLocation) == B_OK) - return SetTabLocation(tabLocation, updateRegion); + bool modified = false; + for (int32 i = 0; i < fTabList.CountItems(); i++) { + if (settings.FindFloat("tab location", i, &tabLocation) != B_OK) + return false; + modified |= SetTabLocation(i, tabLocation, updateRegion); + } + return modified; +} - return false; + +bool +DefaultDecorator::_AddTab(int32 index, BRegion* updateRegion) +{ + _DoLayout(); + if (updateRegion != NULL) + updateRegion->Include(fTitleBarRect); + return true; +} + + +bool +DefaultDecorator::_RemoveTab(int32 index, BRegion* updateRegion ) +{ + BRect oldTitle = fTitleBarRect; + _DoLayout(); + if (updateRegion != NULL) { + updateRegion->Include(oldTitle); + updateRegion->Include(fTitleBarRect); + } + return true; +} + + +bool +DefaultDecorator::_MoveTab(int32 from, int32 to, bool isMoving, + BRegion* updateRegion) +{ + DefaultDecorator::Tab* toTab = _TabAt(to); + if (toTab == NULL) + return false; + + if (from < to) { + fOldMovingTab.OffsetBy(toTab->tabRect.Width(), 0); + toTab->tabRect.OffsetBy(-fOldMovingTab.Width(), 0); + } else { + fOldMovingTab.OffsetBy(-toTab->tabRect.Width(), 0); + toTab->tabRect.OffsetBy(fOldMovingTab.Width(), 0); + } + + toTab->tabOffset = uint32(toTab->tabRect.left - fLeftBorder.left); + _LayoutTabItems(toTab, toTab->tabRect); + + _CalculateTabsRegion(); + + if (updateRegion != NULL) + updateRegion->Include(fTitleBarRect); + return true; } @@ -1195,7 +1459,7 @@ DefaultDecorator::_GetFootprint(BRegion *region) if (fLook == B_BORDERED_WINDOW_LOOK) return; - region->Include(fTabRect); + region->Include(&fTabsRegion); if (fLook == B_DOCUMENT_WINDOW_LOOK) { // include the rectangular resize knob on the bottom right @@ -1207,13 +1471,13 @@ DefaultDecorator::_GetFootprint(BRegion *region) void -DefaultDecorator::DrawButtons(const BRect& invalid) +DefaultDecorator::DrawButtons(Decorator::Tab* tab, const BRect& invalid) { // Draw the buttons if we're supposed to - if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(fCloseRect)) - _DrawClose(fCloseRect); - if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(fZoomRect)) - _DrawZoom(fZoomRect); + if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect)) + _DrawClose(tab, tab->closeRect); + if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect)) + _DrawZoom(tab, tab->zoomRect); } @@ -1228,13 +1492,14 @@ DefaultDecorator::DrawButtons(const BRect& invalid) */ void DefaultDecorator::GetComponentColors(Component component, uint8 highlight, - ComponentColors _colors) + ComponentColors _colors, Decorator::Tab* _tab) { + DefaultDecorator::Tab* tab = static_cast(_tab); switch (component) { case COMPONENT_TAB: _colors[COLOR_TAB_FRAME_LIGHT] = kFrameColors[0]; _colors[COLOR_TAB_FRAME_DARK] = kFrameColors[3]; - if (fButtonFocus) { + if (tab && tab->buttonFocus) { _colors[COLOR_TAB] = kFocusTabColor; _colors[COLOR_TAB_LIGHT] = kFocusTabColorLight; _colors[COLOR_TAB_BEVEL] = kFocusTabColorBevel; @@ -1251,7 +1516,7 @@ DefaultDecorator::GetComponentColors(Component component, uint8 highlight, case COMPONENT_CLOSE_BUTTON: case COMPONENT_ZOOM_BUTTON: - if (fButtonFocus) { + if (tab && tab->buttonFocus) { _colors[COLOR_BUTTON] = kFocusTabColor; _colors[COLOR_BUTTON_LIGHT] = kFocusTabColorLight; } else { @@ -1268,7 +1533,7 @@ DefaultDecorator::GetComponentColors(Component component, uint8 highlight, default: _colors[0] = kFrameColors[0]; _colors[1] = kFrameColors[1]; - if (fButtonFocus) { + if (tab && tab->buttonFocus) { _colors[2] = kFocusFrameColors[0]; _colors[3] = kFocusFrameColors[1]; } else { @@ -1380,38 +1645,46 @@ DefaultDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset, void -DefaultDecorator::_LayoutTabItems(const BRect& tabRect) +DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect) { + DefaultDecorator::Tab* tab = static_cast(_tab); + float offset; float size; float inset; _GetButtonSizeAndOffset(tabRect, &offset, &size, &inset); + // default textOffset + tab->textOffset = _DefaultTextOffset(); + + BRect& closeRect = tab->closeRect; + BRect& zoomRect = tab->zoomRect; + // calulate close rect based on the tab rectangle if (fLook != kLeftTitledWindowLook) { - fCloseRect.Set(tabRect.left + offset, tabRect.top + offset, + closeRect.Set(tabRect.left + offset, tabRect.top + offset, tabRect.left + offset + size, tabRect.top + offset + size); - fZoomRect.Set(tabRect.right - offset - size, tabRect.top + offset, + zoomRect.Set(tabRect.right - offset - size, tabRect.top + offset, tabRect.right - offset, tabRect.top + offset + size); // hidden buttons have no width if ((Flags() & B_NOT_CLOSABLE) != 0) - fCloseRect.right = fCloseRect.left - offset; + closeRect.right = closeRect.left - offset; if ((Flags() & B_NOT_ZOOMABLE) != 0) - fZoomRect.left = fZoomRect.right + offset; + zoomRect.left = zoomRect.right + offset; } else { - fCloseRect.Set(tabRect.left + offset, tabRect.top + offset, + closeRect.Set(tabRect.left + offset, tabRect.top + offset, tabRect.left + offset + size, tabRect.top + offset + size); - fZoomRect.Set(tabRect.left + offset, tabRect.bottom - offset - size, + zoomRect.Set(tabRect.left + offset, tabRect.bottom - offset - size, tabRect.left + size + offset, tabRect.bottom - offset); // hidden buttons have no height if ((Flags() & B_NOT_CLOSABLE) != 0) - fCloseRect.bottom = fCloseRect.top - offset; + closeRect.bottom = closeRect.top - offset; if ((Flags() & B_NOT_ZOOMABLE) != 0) - fZoomRect.top = fZoomRect.bottom + offset; + zoomRect.top = zoomRect.bottom + offset; } // calculate room for title @@ -1419,29 +1692,54 @@ DefaultDecorator::_LayoutTabItems(const BRect& tabRect) // truncated for no apparent reason - OTOH the title does // also not appear perfectly in the middle if (fLook != kLeftTitledWindowLook) - size = (fZoomRect.left - fCloseRect.right) - fTextOffset * 2 + inset; + size = (zoomRect.left - closeRect.right) - tab->textOffset * 2 + inset; else - size = (fZoomRect.top - fCloseRect.bottom) - fTextOffset * 2 + inset; + size = (zoomRect.top - closeRect.bottom) - tab->textOffset * 2 + inset; - fTruncatedTitle = Title(); - fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_MIDDLE, size); - fTruncatedTitleLength = fTruncatedTitle.Length(); + bool stackMode = fTabList.CountItems() > 1; + if (stackMode && IsFocus(tab) == false) { + zoomRect.Set(0, 0, 0, 0); + size = (tab->tabRect.right - closeRect.right) - tab->textOffset * 2 + + inset; + } + uint8 truncateMode = B_TRUNCATE_MIDDLE; + if (stackMode) { + if (tab->tabRect.Width() < 100) + truncateMode = B_TRUNCATE_END; + float titleWidth = fDrawState.Font().StringWidth(Title(tab), + BString(Title(tab)).Length()); + if (size < titleWidth) { + float oldTextOffset = tab->textOffset; + tab->textOffset -= (titleWidth - size) / 2; + const float kMinTextOffset = 5.; + if (tab->textOffset < kMinTextOffset) + tab->textOffset = kMinTextOffset; + size += oldTextOffset * 2; + size -= tab->textOffset * 2; + } + } + tab->truncatedTitle = Title(tab); + fDrawState.Font().TruncateString(&tab->truncatedTitle, truncateMode, size); + tab->truncatedTitleLength = tab->truncatedTitle.Length(); } void DefaultDecorator::_InvalidateBitmaps() { - for (int32 index = 0; index < 4; index++) { - fCloseBitmaps[index] = NULL; - fZoomBitmaps[index] = NULL; + for (int32 i = 0; i < fTabList.CountItems(); i++) { + DefaultDecorator::Tab* tab = _TabAt(i); + for (int32 index = 0; index < 4; index++) { + tab->closeBitmaps[index] = NULL; + tab->zoomBitmaps[index] = NULL; + } } } ServerBitmap* -DefaultDecorator::_GetBitmapForButton(Component item, bool down, int32 width, - int32 height) +DefaultDecorator::_GetBitmapForButton(Decorator::Tab* tab, Component item, + bool down, int32 width, int32 height) { // TODO: the list of shared bitmaps is never freed struct decorator_bitmap { @@ -1459,7 +1757,7 @@ DefaultDecorator::_GetBitmapForButton(Component item, bool down, int32 width, static decorator_bitmap* sBitmapList = NULL; ComponentColors colors; - _GetComponentColors(item, colors); + _GetComponentColors(item, colors, tab); BAutolock locker(sBitmapListLock); @@ -1546,7 +1844,7 @@ DefaultDecorator::_GetBitmapForButton(Component item, bool down, int32 width, void DefaultDecorator::_GetComponentColors(Component component, - ComponentColors _colors) + ComponentColors _colors, Decorator::Tab* tab) { // get the highlight for our component Region region = REGION_NONE; @@ -1577,5 +1875,22 @@ DefaultDecorator::_GetComponentColors(Component component, break; } - return GetComponentColors(component, RegionHighlight(region), _colors); + return GetComponentColors(component, RegionHighlight(region), _colors, tab); +} + + +float +DefaultDecorator::_DefaultTextOffset() const +{ + return (fLook == B_FLOATING_WINDOW_LOOK + || fLook == kLeftTitledWindowLook) ? 10 : 18; +} + + +void +DefaultDecorator::_CalculateTabsRegion() +{ + fTabsRegion.MakeEmpty(); + for (int32 i = 0; i < fTabList.CountItems(); i++) + fTabsRegion.Include(fTabList.ItemAt(i)->tabRect); } diff --git a/src/servers/app/DefaultDecorator.h b/src/servers/app/DefaultDecorator.h index 329297cafd..8bf3b07007 100644 --- a/src/servers/app/DefaultDecorator.h +++ b/src/servers/app/DefaultDecorator.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku, Inc. + * Copyright 2001-2011, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -22,13 +22,33 @@ class ServerBitmap; class DefaultDecorator: public Decorator { public: + class Tab : public Decorator::Tab { + public: + Tab(); + + uint32 tabOffset; + float tabLocation; + float textOffset; + + BString truncatedTitle; + int32 truncatedTitleLength; + + bool buttonFocus : 1; + + bool isHighlighted : 1; + ServerBitmap* closeBitmaps[4]; + ServerBitmap* zoomBitmaps[4]; + + float minTabSize; + float maxTabSize; + }; + DefaultDecorator(DesktopSettings& settings, BRect frame, window_look look, uint32 flags); virtual ~DefaultDecorator(); - virtual float TabLocation() const - { return (float)fTabOffset; } + virtual float TabLocation(int32 tab) const; virtual bool GetSettings(BMessage* settings) const; @@ -38,10 +58,11 @@ public: virtual void GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth, int32* maxHeight) const; - virtual Region RegionAt(BPoint where) const; + virtual Region RegionAt(BPoint where, int32& tab) const; virtual bool SetRegionHighlight(Region region, - uint8 highlight, BRegion* dirty); + uint8 highlight, BRegion* dirty, + int32 tab = -1); virtual void ExtendDirtyRegion(Region region, BRegion& dirty); @@ -83,16 +104,22 @@ protected: protected: virtual void _DoLayout(); + virtual void _DoTabLayout(); + void _DistributeTabSize(float delta); + + virtual Decorator::Tab* _AllocateNewTab(); + DefaultDecorator::Tab* _TabAt(int32 index) const; virtual void _DrawFrame(BRect r); - virtual void _DrawTab(BRect r); + virtual void _DrawTab(Decorator::Tab* tab, BRect r); - virtual void _DrawClose(BRect r); - virtual void _DrawTitle(BRect r); - virtual void _DrawZoom(BRect r); + virtual void _DrawClose(Decorator::Tab* tab, BRect r); + virtual void _DrawTitle(Decorator::Tab* tab, BRect r); + virtual void _DrawZoom(Decorator::Tab* tab, BRect r); - virtual void _SetTitle(const char* string, + virtual void _SetTitle(Decorator::Tab* tab, const char* string, BRegion* updateRegion = NULL); + virtual void _SetFocus(Decorator::Tab* tab); virtual void _FontsChanged(DesktopSettings& settings, BRegion* updateRegion); @@ -102,17 +129,23 @@ protected: virtual void _SetFlags(uint32 flags, BRegion* updateRegion = NULL); - virtual void _SetFocus(); - virtual void _MoveBy(BPoint offset); virtual void _ResizeBy(BPoint offset, BRegion* dirty); - virtual bool _SetTabLocation(float location, + virtual bool _SetTabLocation(Decorator::Tab* tab, + float location, bool isShifting, BRegion* updateRegion = NULL); virtual bool _SetSettings(const BMessage& settings, BRegion* updateRegion = NULL); + virtual bool _AddTab(int32 index = -1, + BRegion* updateRegion = NULL); + virtual bool _RemoveTab(int32 index, + BRegion* updateRegion = NULL); + virtual bool _MoveTab(int32 from, int32 to, bool isMoving, + BRegion* updateRegion = NULL); + virtual void _GetFootprint(BRegion *region); void _GetButtonSizeAndOffset(const BRect& tabRect, @@ -120,9 +153,11 @@ protected: float* inset) const; // DefaultDecorator customization points - virtual void DrawButtons(const BRect& invalid); + virtual void DrawButtons(Decorator::Tab* tab, + const BRect& invalid); virtual void GetComponentColors(Component component, - uint8 highlight, ComponentColors _colors); + uint8 highlight, ComponentColors _colors, + Decorator::Tab* tab = NULL); private: void _UpdateFont(DesktopSettings& settings); @@ -131,14 +166,20 @@ private: void _DrawBlendedRect(DrawingEngine *engine, BRect rect, bool down, const ComponentColors& colors); - void _LayoutTabItems(const BRect& tabRect); + void _LayoutTabItems(Decorator::Tab* tab, + const BRect& tabRect); void _InvalidateBitmaps(); - ServerBitmap* _GetBitmapForButton(Component item, bool down, - int32 width, int32 height); + ServerBitmap* _GetBitmapForButton(Decorator::Tab* tab, + Component item, bool down, int32 width, + int32 height); void _GetComponentColors(Component component, - ComponentColors _colors); + ComponentColors _colors, + Decorator::Tab* tab = NULL); + inline float _DefaultTextOffset() const; + + void _CalculateTabsRegion(); protected: static const rgb_color kFrameColors[4]; static const rgb_color kFocusFrameColors[2]; @@ -156,10 +197,6 @@ protected: const rgb_color kNonFocusTabColorShadow; const rgb_color kNonFocusTextColor; - bool fButtonFocus; - ServerBitmap* fCloseBitmaps[4]; - ServerBitmap* fZoomBitmaps[4]; - // Individual rects for handling window frame // rendering the proper way BRect fRightBorder; @@ -169,14 +206,8 @@ protected: int32 fBorderWidth; - uint32 fTabOffset; - float fTabLocation; - float fTextOffset; - - float fMinTabSize; - float fMaxTabSize; - BString fTruncatedTitle; - int32 fTruncatedTitleLength; + BRegion fTabsRegion; + BRect fOldMovingTab; }; diff --git a/src/servers/app/DefaultWindowBehaviour.cpp b/src/servers/app/DefaultWindowBehaviour.cpp index c49a6df485..d6650d033d 100644 --- a/src/servers/app/DefaultWindowBehaviour.cpp +++ b/src/servers/app/DefaultWindowBehaviour.cpp @@ -21,6 +21,7 @@ #include "ClickTarget.h" #include "Desktop.h" +#include "DefaultDecorator.h" #include "DrawingEngine.h" #include "Window.h" @@ -286,16 +287,58 @@ struct DefaultWindowBehaviour::SlideTabState : MouseTrackingState { { } + virtual + ~SlideTabState() + { + fDesktop->SetWindowTabLocation(fWindow, fWindow->TabLocation(), false); + } + virtual void MouseMovedAction(BPoint& delta, bigtime_t now) { - float loc = fWindow->TabLocation(); + float location = fWindow->TabLocation(); // TODO: change to [0:1] - loc += delta.x; - if (fDesktop->SetWindowTabLocation(fWindow, loc)) + location += delta.x; + AdjustMultiTabLocation(location, true); + if (fDesktop->SetWindowTabLocation(fWindow, location, true)) delta.y = 0; else delta = BPoint(0, 0); } + + void AdjustMultiTabLocation(float location, bool isShifting) + { + ::Decorator* decorator = fWindow->Decorator(); + if (decorator == NULL || decorator->CountTabs() <= 1) + return; + + // TODO does not work for none continuous shifts + int32 windowIndex = fWindow->PositionInStack(); + DefaultDecorator::Tab* movingTab = static_cast( + decorator->TabAt(windowIndex)); + int32 neighbourIndex = windowIndex; + if (movingTab->tabOffset > location) + neighbourIndex--; + else + neighbourIndex++; + + DefaultDecorator::Tab* neighbourTab + = static_cast(decorator->TabAt( + neighbourIndex)); + if (neighbourTab == NULL) + return; + + if (movingTab->tabOffset > location) { + if (location > + neighbourTab->tabOffset + neighbourTab->tabRect.Width() / 2) + return; + } else { + if (location + movingTab->tabRect.Width() < + neighbourTab->tabOffset + neighbourTab->tabRect.Width() / 2) + return; + } + + fWindow->MoveToStackPosition(neighbourIndex, isShifting); + } }; @@ -423,9 +466,10 @@ private: struct DefaultWindowBehaviour::DecoratorButtonState : State { DecoratorButtonState(DefaultWindowBehaviour& behavior, - Decorator::Region button) + int32 tab, Decorator::Region button) : State(behavior), + fTab(tab), fButton(button) { } @@ -452,22 +496,23 @@ struct DefaultWindowBehaviour::DecoratorButtonState : State { engine->LockParallelAccess(); engine->ConstrainClippingRegion(visibleBorder); + int32 tab; switch (fButton) { case Decorator::REGION_CLOSE_BUTTON: - decorator->SetClose(false); - if (fBehavior._RegionFor(message) == fButton) + decorator->SetClose(fTab, false); + if (fBehavior._RegionFor(message, tab) == fButton) fWindow->ServerWindow()->NotifyQuitRequested(); break; case Decorator::REGION_ZOOM_BUTTON: - decorator->SetZoom(false); - if (fBehavior._RegionFor(message) == fButton) + decorator->SetZoom(fTab, false); + if (fBehavior._RegionFor(message, tab) == fButton) fWindow->ServerWindow()->NotifyZoom(); break; case Decorator::REGION_MINIMIZE_BUTTON: - decorator->SetMinimize(false); - if (fBehavior._RegionFor(message) == fButton) + decorator->SetMinimize(fTab, false); + if (fBehavior._RegionFor(message, tab) == fButton) fWindow->ServerWindow()->NotifyMinimize(true); break; @@ -500,20 +545,21 @@ private: engine->LockParallelAccess(); engine->ConstrainClippingRegion(visibleBorder); + int32 tab; Decorator::Region hitRegion = message != NULL - ? fBehavior._RegionFor(message) : fButton; + ? fBehavior._RegionFor(message, tab) : fButton; switch (fButton) { case Decorator::REGION_CLOSE_BUTTON: - decorator->SetClose(hitRegion == fButton); + decorator->SetClose(fTab, hitRegion == fButton); break; case Decorator::REGION_ZOOM_BUTTON: - decorator->SetZoom(hitRegion == fButton); + decorator->SetZoom(fTab, hitRegion == fButton); break; case Decorator::REGION_MINIMIZE_BUTTON: - decorator->SetMinimize(hitRegion == fButton); + decorator->SetMinimize(fTab, hitRegion == fButton); break; default: @@ -526,6 +572,7 @@ private: } protected: + int32 fTab; Decorator::Region fButton; }; @@ -669,6 +716,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where, Decorator* decorator = fWindow->Decorator(); Decorator::Region hitRegion = Decorator::REGION_NONE; + int32 tab = -1; Action action = ACTION_NONE; bool inBorderRegion = false; @@ -688,7 +736,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where, hitRegion = Decorator::REGION_LEFT_BORDER; } else { // click on the decorator -- get the exact region - hitRegion = _RegionFor(message); + hitRegion = _RegionFor(message, tab); } // translate the region into an action @@ -697,7 +745,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where, if ((buttons & B_PRIMARY_MOUSE_BUTTON) != 0) { // left mouse button switch (hitRegion) { - case Decorator::REGION_TAB: + case Decorator::REGION_TAB: { // tab sliding in any case if either shift key is held down // except sliding up-down by moving mouse left-right would // look strange @@ -708,6 +756,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where, } action = ACTION_DRAG; break; + } case Decorator::REGION_LEFT_BORDER: case Decorator::REGION_RIGHT_BORDER: @@ -809,7 +858,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where, case ACTION_ZOOM: case ACTION_MINIMIZE: _NextState( - new (std::nothrow) DecoratorButtonState(*this, hitRegion)); + new (std::nothrow) DecoratorButtonState(*this, tab, hitRegion)); STRACE_CLICK(("===> ACTION_CLOSE/ZOOM/MINIMIZE\n")); break; @@ -910,7 +959,7 @@ DefaultWindowBehaviour::_IsWindowModifier(int32 modifiers) const Decorator::Region -DefaultWindowBehaviour::_RegionFor(const BMessage* message) const +DefaultWindowBehaviour::_RegionFor(const BMessage* message, int32& tab) const { Decorator* decorator = fWindow->Decorator(); if (decorator == NULL) @@ -920,7 +969,7 @@ DefaultWindowBehaviour::_RegionFor(const BMessage* message) const if (message->FindPoint("where", &where) != B_OK) return Decorator::REGION_NONE; - return decorator->RegionAt(where); + return decorator->RegionAt(where, tab); } diff --git a/src/servers/app/DefaultWindowBehaviour.h b/src/servers/app/DefaultWindowBehaviour.h index 6452eb43bc..3ad3f9f4f7 100644 --- a/src/servers/app/DefaultWindowBehaviour.h +++ b/src/servers/app/DefaultWindowBehaviour.h @@ -88,7 +88,8 @@ private: private: bool _IsWindowModifier(int32 modifiers) const; - Decorator::Region _RegionFor(const BMessage* message) const; + Decorator::Region _RegionFor(const BMessage* message, + int32& tab) const; void _SetBorderHighlights(int8 horizontal, int8 vertical, bool active); diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 6845e1d327..5abe4c85ec 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -581,6 +581,7 @@ Desktop::BroadcastToAllWindows(int32 code) filter_result Desktop::KeyEvent(uint32 what, int32 key, int32 modifiers) { + filter_result result = B_DISPATCH_MESSAGE; if (LockAllWindows()) { Window* window = MouseEventWindow(); if (window == NULL) @@ -591,13 +592,13 @@ Desktop::KeyEvent(uint32 what, int32 key, int32 modifiers) window->ModifiersChanged(modifiers); } + if (NotifyKeyPressed(what, key, modifiers)) + result = B_SKIP_MESSAGE; + UnlockAllWindows(); } - if (NotifyKeyPressed(what, key, modifiers)) - return B_SKIP_MESSAGE; - - return B_DISPATCH_MESSAGE; + return result; } @@ -1115,15 +1116,12 @@ Desktop::ActivateWindow(Window* window) } } - // we don't need to redraw what is currently - // visible of the window - BRegion clean(window->VisibleRegion()); WindowList windows(kWorkingList); - Window* frontmost = window->Frontmost(); CurrentWindows().RemoveWindow(window); windows.AddWindow(window); + window->MoveToTopStackLayer(); if (frontmost != NULL && frontmost->IsModal()) { // all modal windows follow their subsets to the front @@ -1335,6 +1333,10 @@ Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace) if (!LockAllWindows()) return; + Window* topWindow = window->TopLayerStackWindow(); + if (topWindow) + window = topWindow; + if (workspace == -1) workspace = fCurrentWorkspace; if (!window->IsVisible() || workspace != fCurrentWorkspace) { @@ -1472,16 +1474,16 @@ Desktop::ResizeWindowBy(Window* window, float x, float y) bool -Desktop::SetWindowTabLocation(Window* window, float location) +Desktop::SetWindowTabLocation(Window* window, float location, bool isShifting) { AutoWriteLocker _(fWindowLock); BRegion dirty; - bool changed = window->SetTabLocation(location, dirty); + bool changed = window->SetTabLocation(location, isShifting, dirty); if (changed) RebuildAndRedrawAfterWindowChange(window, dirty); - NotifyWindowTabLocationChanged(window, location); + NotifyWindowTabLocationChanged(window, location, isShifting); return changed; } @@ -1763,7 +1765,7 @@ Desktop::WindowAt(BPoint where) for (Window* window = CurrentWindows().LastWindow(); window; window = window->PreviousWindow(fCurrentWorkspace)) { if (window->IsVisible() && window->VisibleRegion().Contains(where)) - return window; + return window->StackedWindowAt(where); } return NULL; @@ -3177,6 +3179,7 @@ void Desktop::RebuildAndRedrawAfterWindowChange(Window* changedWindow, BRegion& dirty) { + ASSERT_MULTI_WRITE_LOCKED(fWindowLock); if (!changedWindow->IsVisible() || dirty.CountRects() == 0) return; diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index 388c3f4b1f..ae663ac690 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -171,7 +171,7 @@ public: void ResizeWindowBy(Window* window, float x, float y); bool SetWindowTabLocation(Window* window, - float location); + float location, bool isShifting); bool SetWindowDecoratorSettings(Window* window, const BMessage& settings); diff --git a/src/servers/app/DesktopListener.cpp b/src/servers/app/DesktopListener.cpp index 84599c5ab1..37cc38b8ee 100644 --- a/src/servers/app/DesktopListener.cpp +++ b/src/servers/app/DesktopListener.cpp @@ -244,7 +244,7 @@ DesktopObservable::NotifyWindowMinimized(Window* window, bool minimize) void DesktopObservable::NotifyWindowTabLocationChanged(Window* window, - float location) + float location, bool isShifting) { if (fWeAreInvoking) return; @@ -252,7 +252,7 @@ DesktopObservable::NotifyWindowTabLocationChanged(Window* window, for (DesktopListener* listener = fDesktopListenerList.First(); listener != NULL; listener = fDesktopListenerList.GetNext(listener)) - listener->WindowTabLocationChanged(window, location); + listener->WindowTabLocationChanged(window, location, isShifting); } diff --git a/src/servers/app/DesktopListener.h b/src/servers/app/DesktopListener.h index df102a5399..1b89b9da08 100644 --- a/src/servers/app/DesktopListener.h +++ b/src/servers/app/DesktopListener.h @@ -59,7 +59,7 @@ public: bool minimize) = 0; virtual void WindowTabLocationChanged(Window* window, - float location) = 0; + float location, bool isShifting) = 0; virtual void SizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, int32 minHeight, int32 maxHeight) = 0; @@ -113,7 +113,7 @@ public: bool minimize); void NotifyWindowTabLocationChanged(Window* window, - float location); + float location, bool isShifting); void NotifySizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, int32 minHeight, int32 maxHeight); diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index dd57406573..975dcc3df6 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku, Inc. + * Copyright 2001-2011, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -14,6 +14,17 @@ #include "Window.h" +#include +#include + +#include + +#include +#include +#include +#include +#include + #include "ClickTarget.h" #include "Decorator.h" #include "DecorManager.h" @@ -28,17 +39,6 @@ #include "Workspace.h" #include "WorkspacesView.h" -#include -#include - -#include -#include -#include -#include - -#include -#include - // Toggle debug output //#define DEBUG_WINDOW @@ -91,7 +91,6 @@ Window::Window(const BRect& frame, const char *name, fRegionPool(), fWindowBehaviour(NULL), - fDecorator(NULL), fTopView(NULL), fWindow(window), fDrawingEngine(drawingEngine), @@ -120,6 +119,8 @@ Window::Window(const BRect& frame, const char *name, fWorkspacesViewCount(0) { + _InitWindowStack(); + // make sure our arguments are valid if (!IsValidLook(fLook)) fLook = B_TITLED_WINDOW_LOOK; @@ -128,11 +129,12 @@ Window::Window(const BRect& frame, const char *name, SetFlags(flags, NULL); - if (fLook != B_NO_BORDER_WINDOW_LOOK) { - fDecorator = gDecorManager.AllocateDecorator(this); - if (fDecorator) { - fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, - &fMaxWidth, &fMaxHeight); + if (fLook != B_NO_BORDER_WINDOW_LOOK && fCurrentStack.Get() != NULL) { + // allocates a decorator + ::Decorator* decorator = Decorator(); + if (decorator != NULL) { + decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, + &fMaxHeight); } } fWindowBehaviour = gDecorManager.AllocateWindowBehaviour(this); @@ -169,8 +171,9 @@ Window::~Window() delete fTopView; } + DetachFromWindowStack(false); + delete fWindowBehaviour; - delete fDecorator; delete fDrawingEngine; gDecorManager.CleanupForWindow(this); @@ -220,8 +223,9 @@ Window::GetBorderRegion(BRegion* region) // TODO: if someone needs to call this from // the outside, the clipping needs to be readlocked! - if (fDecorator) - *region = fDecorator->GetFootprint(); + ::Decorator* decorator = Decorator(); + if (decorator) + *region = decorator->GetFootprint(); else region->MakeEmpty(); } @@ -272,7 +276,7 @@ Window::_PropagatePosition() void -Window::MoveBy(int32 x, int32 y) +Window::MoveBy(int32 x, int32 y, bool moveStack) { // this function is only called from the desktop thread @@ -296,14 +300,27 @@ Window::MoveBy(int32 x, int32 y) fEffectiveDrawingRegionValid = false; - if (fDecorator) - fDecorator->MoveBy(x, y); - if (fTopView != NULL) { fTopView->MoveBy(x, y, NULL); fTopView->UpdateOverlay(); } + ::Decorator* decorator = Decorator(); + if (moveStack && decorator) + decorator->MoveBy(x, y); + + WindowStack* stack = GetWindowStack(); + if (moveStack && stack) { + for (int32 i = 0; i < stack->CountWindows(); i++) { + Window* window = stack->WindowList().ItemAt(i); + if (window == this) + continue; + window->MoveBy(x, y, false); + + //fDesktop->RebuildAndRedrawAfterWindowChange(window, dirty); + } + } + // the desktop will take care of dirty regions // dispatch a message to the client informing about the changed size @@ -315,7 +332,7 @@ Window::MoveBy(int32 x, int32 y) void -Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) +Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion, bool resizeStack) { // this function is only called from the desktop thread @@ -345,19 +362,29 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) fContentRegionValid = false; fEffectiveDrawingRegionValid = false; - if (fDecorator) { - fDecorator->ResizeBy(x, y, dirtyRegion); + if (fTopView != NULL) { + fTopView->ResizeBy(x, y, dirtyRegion); + fTopView->UpdateOverlay(); + } + + ::Decorator* decorator = Decorator(); + if (decorator && resizeStack) { + decorator->ResizeBy(x, y, dirtyRegion); //if (dirtyRegion) { //fDrawingEngine->FillRegion(*dirtyRegion, (rgb_color){ 255, 255, 0, 255 }); //snooze(40000); //} } - if (fTopView != NULL) { - fTopView->ResizeBy(x, y, dirtyRegion); - fTopView->UpdateOverlay(); + WindowStack* stack = GetWindowStack(); + if (resizeStack && stack) { + for (int32 i = 0; i < stack->CountWindows(); i++) { + Window* window = stack->WindowList().ItemAt(i); + if (window == this) + continue; + window->ResizeBy(x, y, dirtyRegion, false); + } } - //if (dirtyRegion) //fDrawingEngine->FillRegion(*dirtyRegion, (rgb_color){ 0, 255, 255, 255 }); @@ -543,20 +570,32 @@ Window::PreviousWindow(int32 index) const } +::Decorator* +Window::Decorator() const +{ + if (fCurrentStack.Get() == NULL) + return NULL; + return fCurrentStack->Decorator(); +} + + bool Window::ReloadDecor() { ::Decorator* decorator = NULL; WindowBehaviour* windowBehaviour = NULL; - + WindowStack* stack = GetWindowStack(); + if (stack == NULL) + return false; if (fLook != B_NO_BORDER_WINDOW_LOOK) { // we need a new decorator decorator = gDecorManager.AllocateDecorator(this); if (decorator == NULL) return false; + int32 index = PositionInStack(); if (IsFocus()) - decorator->SetFocus(true); + decorator->SetFocus(index, true); } windowBehaviour = gDecorManager.AllocateWindowBehaviour(this); @@ -565,8 +604,7 @@ Window::ReloadDecor() return false; } - delete fDecorator; - fDecorator = decorator; + stack->SetDecorator(decorator); delete fWindowBehaviour; fWindowBehaviour = windowBehaviour; @@ -578,7 +616,8 @@ Window::ReloadDecor() void Window::SetScreen(const ::Screen* screen) { - ASSERT_MULTI_WRITE_LOCKED(fDesktop->ScreenLocker()); + // TODO this assert fails in Desktop::ShowWindow + //ASSERT_MULTI_WRITE_LOCKED(fDesktop->ScreenLocker()); fScreen = screen; } @@ -586,7 +625,8 @@ Window::SetScreen(const ::Screen* screen) const ::Screen* Window::Screen() const { - ASSERT_MULTI_READ_LOCKED(fDesktop->ScreenLocker()); + // TODO this assert also fails + //ASSERT_MULTI_READ_LOCKED(fDesktop->ScreenLocker()); return fScreen; } @@ -640,7 +680,7 @@ Window::DrawingRegionChanged(View* view) const void Window::ProcessDirtyRegion(BRegion& region) { - // if this is exectuted in the desktop thread, + // if this is executed in the desktop thread, // it means that the window thread currently // blocks to get the read lock, if it is // executed from the window thread, it should @@ -669,8 +709,13 @@ Window::ProcessDirtyRegion(BRegion& region) void Window::RedrawDirtyRegion() { - // executed from ServerWindow with the read lock held + if (TopLayerStackWindow() != this) { + fDirtyRegion.MakeEmpty(); + fDirtyCause = 0; + return; + } + // executed from ServerWindow with the read lock held if (IsVisible()) { _DrawBorder(); @@ -961,22 +1006,27 @@ Window::SetTitle(const char* name, BRegion& dirty) fTitle = name; - if (fDecorator) - fDecorator->SetTitle(name, &dirty); + ::Decorator* decorator = Decorator(); + if (decorator) { + int32 index = PositionInStack(); + decorator->SetTitle(index, name, &dirty); + } } void Window::SetFocus(bool focus) { + ::Decorator* decorator = Decorator(); + // executed from Desktop thread // it holds the clipping write lock, // so the window thread cannot be // accessing fIsFocus BRegion* dirty = NULL; - if (fDecorator) - dirty = fRegionPool.GetRegion(fDecorator->GetFootprint()); + if (decorator) + dirty = fRegionPool.GetRegion(decorator->GetFootprint()); if (dirty) { dirty->IntersectWith(&fVisibleRegion); fDesktop->MarkDirty(*dirty); @@ -984,8 +1034,10 @@ Window::SetFocus(bool focus) } fIsFocus = focus; - if (fDecorator) - fDecorator->SetFocus(focus); + if (decorator) { + int32 index = PositionInStack(); + decorator->SetFocus(index, focus); + } Activated(focus); } @@ -1066,8 +1118,9 @@ Window::SetSizeLimits(int32 minWidth, int32 maxWidth, int32 minHeight, fMaxHeight = maxHeight; // give the Decorator a say in this too - if (fDecorator) { - fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, + ::Decorator* decorator = Decorator(); + if (decorator) { + decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight); } @@ -1087,10 +1140,13 @@ Window::GetSizeLimits(int32* minWidth, int32* maxWidth, bool -Window::SetTabLocation(float location, BRegion& dirty) +Window::SetTabLocation(float location, bool isShifting, BRegion& dirty) { - if (fDecorator) - return fDecorator->SetTabLocation(location, &dirty); + ::Decorator* decorator = Decorator(); + if (decorator) { + int32 index = PositionInStack(); + return decorator->SetTabLocation(index, location, isShifting, &dirty); + } return false; } @@ -1099,8 +1155,11 @@ Window::SetTabLocation(float location, BRegion& dirty) float Window::TabLocation() const { - if (fDecorator) - return fDecorator->TabLocation(); + ::Decorator* decorator = Decorator(); + if (decorator) { + int32 index = PositionInStack(); + return decorator->TabLocation(index); + } return 0.0; } @@ -1116,8 +1175,10 @@ Window::SetDecoratorSettings(const BMessage& settings, BRegion& dirty) return false; } - if (fDecorator) - return fDecorator->SetSettings(settings, &dirty); + ::Decorator* decorator = Decorator(); + if (decorator) + return decorator->SetSettings(settings, &dirty); + return false; } @@ -1128,8 +1189,9 @@ Window::GetDecoratorSettings(BMessage* settings) if (fDesktop) fDesktop->GetDecoratorSettings(this, *settings); - if (fDecorator) - return fDecorator->GetSettings(settings); + ::Decorator* decorator = Decorator(); + if (decorator) + return decorator->GetSettings(settings); return false; } @@ -1138,9 +1200,10 @@ Window::GetDecoratorSettings(BMessage* settings) void Window::FontsChanged(BRegion* updateRegion) { - if (fDecorator != NULL) { + ::Decorator* decorator = Decorator(); + if (decorator != NULL) { DesktopSettings settings(fDesktop); - fDecorator->FontsChanged(settings, updateRegion); + decorator->FontsChanged(settings, updateRegion); } } @@ -1148,11 +1211,14 @@ Window::FontsChanged(BRegion* updateRegion) void Window::SetLook(window_look look, BRegion* updateRegion) { - if (fDecorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) { + ::Decorator* decorator = Decorator(); + if (decorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) { // we need a new decorator - fDecorator = gDecorManager.AllocateDecorator(this); - if (IsFocus()) - fDecorator->SetFocus(true); + decorator = gDecorManager.AllocateDecorator(this); + if (IsFocus()) { + int32 index = PositionInStack(); + decorator->SetFocus(index, true); + } } fLook = look; @@ -1163,20 +1229,19 @@ Window::SetLook(window_look look, BRegion* updateRegion) // ...and therefor the drawing region is // likely not valid anymore either - if (fDecorator != NULL) { + if (decorator != NULL) { DesktopSettings settings(fDesktop); - fDecorator->SetLook(settings, look, updateRegion); + decorator->SetLook(settings, look, updateRegion); // we might need to resize the window! - fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, + decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight); _ObeySizeLimits(); } - if (look == B_NO_BORDER_WINDOW_LOOK) { + if (look == B_NO_BORDER_WINDOW_LOOK && fCurrentStack.Get() != NULL) { // we don't need a decorator for this window - delete fDecorator; - fDecorator = NULL; + fCurrentStack->SetDecorator(NULL); } } @@ -1216,16 +1281,15 @@ Window::SetFlags(uint32 flags, BRegion* updateRegion) if ((fFlags & B_SAME_POSITION_IN_ALL_WORKSPACES) != 0) _PropagatePosition(); - if (fDecorator == NULL) + ::Decorator* decorator = Decorator(); + if (decorator == NULL) return; - fDecorator->SetFlags(flags, updateRegion); + decorator->SetFlags(flags, updateRegion); // we might need to resize the window! - if (fDecorator) { - fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight); - _ObeySizeLimits(); - } + decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight); + _ObeySizeLimits(); // TODO: not sure if we want to do this #if 0 @@ -1672,8 +1736,8 @@ Window::_DrawBorder() // this is executed in the window thread, but only // in respond to a REDRAW message having been received, the // clipping lock is held for reading - - if (!fDecorator) + ::Decorator* decorator = Decorator(); + if (!decorator) return; // construct the region of the border that needs redrawing @@ -1686,13 +1750,13 @@ Window::_DrawBorder() // intersect with the dirty region dirtyBorderRegion->IntersectWith(&fDirtyRegion); - DrawingEngine* engine = fDecorator->GetDrawingEngine(); + DrawingEngine* engine = decorator->GetDrawingEngine(); if (dirtyBorderRegion->CountRects() > 0 && engine->LockParallelAccess()) { engine->ConstrainClippingRegion(dirtyBorderRegion); bool copyToFrontEnabled = engine->CopyToFrontEnabled(); engine->SetCopyToFrontEnabled(true); - fDecorator->Draw(dirtyBorderRegion->Frame()); + decorator->Draw(dirtyBorderRegion->Frame()); engine->SetCopyToFrontEnabled(copyToFrontEnabled); @@ -1887,8 +1951,9 @@ Window::_UpdateContentRegion() fContentRegion.Set(fFrame); // resize handle - if (fDecorator) - fContentRegion.Exclude(&fDecorator->GetFootprint()); + ::Decorator* decorator = Decorator(); + if (decorator) + fContentRegion.Exclude(&decorator->GetFootprint()); fContentRegionValid = true; } @@ -1991,3 +2056,270 @@ Window::UpdateSession::AddCause(uint8 cause) { fCause |= cause; } + + +int32 +Window::PositionInStack() const +{ + if (fCurrentStack.Get() == NULL) + return -1; + return fCurrentStack->WindowList().IndexOf(this); +} + + +bool +Window::DetachFromWindowStack(bool ownStackNeeded) +{ + // The lock must normally be held but is not held when closing the window. + //ASSERT_MULTI_WRITE_LOCKED(fDesktop->WindowLocker()); + + if (fCurrentStack.Get() == NULL) + return false; + if (fCurrentStack->CountWindows() == 1) + return true; + + int32 index = PositionInStack(); + + if (fCurrentStack->RemoveWindow(this) == false) + return false; + + BRegion dirty; + ::Decorator* decorator = fCurrentStack->Decorator(); + if (decorator != NULL) + decorator->RemoveTab(index, &dirty); + + Window* remainingTop = fCurrentStack->TopLayerWindow(); + if (remainingTop != NULL) { + decorator->SetDrawingEngine(remainingTop->fDrawingEngine); + // propagate focus to the decorator + remainingTop->SetFocus(remainingTop->IsFocus()); + } + + fCurrentStack = NULL; + if (ownStackNeeded == true) + _InitWindowStack(); + // propagate focus to the new decorator + SetFocus(IsFocus()); + + fDesktop->RebuildAndRedrawAfterWindowChange(this, dirty); + if (remainingTop != NULL) + fDesktop->MarkDirty(remainingTop->VisibleRegion()); + + return true; +} + + +bool +Window::AddWindowToStack(Window* window) +{ + ASSERT_MULTI_WRITE_LOCKED(fDesktop->WindowLocker()); + + WindowStack* stack = GetWindowStack(); + if (stack == NULL) + return false; + + // first collect dirt from the window to add + BRegion dirty; + ::Decorator* otherDecorator = window->Decorator(); + if (otherDecorator != NULL) + dirty.Include(otherDecorator->TitleBarRect()); + ::Decorator* decorator = stack->Decorator(); + if (decorator != NULL) + dirty.Include(decorator->TitleBarRect()); + + int32 position = PositionInStack() + 1; + if (position >= stack->CountWindows()) + position = -1; + if (stack->AddWindow(window, position) == false) + return false; + window->DetachFromWindowStack(false); + window->fCurrentStack.SetTo(stack); + + if (decorator != NULL) + decorator->AddTab(window->Title(), position, &dirty); + + fDesktop->RebuildAndRedrawAfterWindowChange(TopLayerStackWindow(), dirty); + window->SetFocus(window->IsFocus()); + return true; +} + + +Window* +Window::StackedWindowAt(const BPoint& where) +{ + ::Decorator* decorator = Decorator(); + if (decorator == NULL) + return NULL; + + int tab = decorator->TabAt(where); + // if we have a decorator we also have a stack + Window* window = fCurrentStack->WindowAt(tab); + if (window != NULL) + return window; + return this; +} + + +Window* +Window::TopLayerStackWindow() +{ + if (fCurrentStack.Get() == NULL) + return this; + return fCurrentStack->TopLayerWindow(); +} + + +WindowStack* +Window::GetWindowStack() +{ + if (fCurrentStack.Get() == NULL) + return _InitWindowStack(); + return fCurrentStack; +} + + + +bool +Window::MoveToTopStackLayer() +{ + ::Decorator* decorator = Decorator(); + if (decorator == NULL) + return false; + decorator->SetDrawingEngine(fDrawingEngine); + decorator->SetTopTap(PositionInStack()); + return fCurrentStack->MoveToTopLayer(this); +} + + +bool +Window::MoveToStackPosition(int32 to, bool isMoving) +{ + if (fCurrentStack.Get() == NULL) + return false; + int32 index = PositionInStack(); + if (fCurrentStack->Move(index, to) == false) + return false; + + BRegion dirty; + ::Decorator* decorator = Decorator(); + if (decorator && decorator->MoveTab(index, to, isMoving, &dirty) == false) + return false; + + fDesktop->RebuildAndRedrawAfterWindowChange(this, dirty); + return true; +} + + +WindowStack* +Window::_InitWindowStack() +{ + fCurrentStack = NULL; + ::Decorator* decorator = NULL; + if (fLook != B_NO_BORDER_WINDOW_LOOK) + decorator = gDecorManager.AllocateDecorator(this); + + WindowStack* stack = new(std::nothrow) WindowStack(decorator); + if (stack == NULL) + return NULL; + + if (stack->AddWindow(this) != true) { + delete stack; + return NULL; + } + fCurrentStack.SetTo(stack, true); + return stack; +} + + +WindowStack::WindowStack(::Decorator* decorator) + : + fDecorator(decorator) +{ + +} + + +WindowStack::~WindowStack() +{ + delete fDecorator; +} + + +void +WindowStack::SetDecorator(::Decorator* decorator) +{ + delete fDecorator; + fDecorator = decorator; +} + + +::Decorator* +WindowStack::Decorator() +{ + return fDecorator; +} + + +Window* +WindowStack::TopLayerWindow() const +{ + return fWindowLayerOrder.ItemAt(fWindowLayerOrder.CountItems() - 1); +} + + +int32 +WindowStack::CountWindows() +{ + return fWindowList.CountItems(); +} + + +Window* +WindowStack::WindowAt(int32 index) +{ + return fWindowList.ItemAt(index); +} + + +bool +WindowStack::AddWindow(Window* window, int32 position) +{ + if (position >= 0) { + if (fWindowList.AddItem(window, position) == false) + return false; + } else if (fWindowList.AddItem(window) == false) + return false; + + if (fWindowLayerOrder.AddItem(window) == false) { + fWindowList.RemoveItem(window); + return false; + } + return true; +} + + +bool +WindowStack::RemoveWindow(Window* window) +{ + if (fWindowList.RemoveItem(window) == false) + return false; + + fWindowLayerOrder.RemoveItem(window); + return true; +} + + +bool +WindowStack::MoveToTopLayer(Window* window) +{ + int32 index = fWindowLayerOrder.IndexOf(window); + return fWindowLayerOrder.MoveItem(index, + fWindowLayerOrder.CountItems() - 1); +} + + +bool +WindowStack::Move(int32 from, int32 to) +{ + return fWindowList.MoveItem(from, to); +} diff --git a/src/servers/app/Window.h b/src/servers/app/Window.h index 749ba086a4..887f2d8d20 100644 --- a/src/servers/app/Window.h +++ b/src/servers/app/Window.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku, Inc. + * Copyright 2001-2011, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -20,9 +20,46 @@ #include "WindowList.h" #include +#include #include #include + +class Window; + + +typedef BObjectList StackWindows; + + +class WindowStack : public BReferenceable { +public: + WindowStack(::Decorator* decorator); + ~WindowStack(); + + void SetDecorator(::Decorator* decorator); + ::Decorator* Decorator(); + + const StackWindows& WindowList() const { return fWindowList; } + const StackWindows& LayerOrder() const { return fWindowLayerOrder; } + + Window* TopLayerWindow() const; + + int32 CountWindows(); + Window* WindowAt(int32 index); + bool AddWindow(Window* window, + int32 position = -1); + bool RemoveWindow(Window* window); + + bool MoveToTopLayer(Window* window); + bool Move(int32 from, int32 to); +private: + ::Decorator* fDecorator; + + StackWindows fWindowList; + StackWindows fWindowLayerOrder; +}; + + namespace BPrivate { class PortLink; }; @@ -65,7 +102,7 @@ public: Window* PreviousWindow(int32 index) const; ::Desktop* Desktop() const { return fDesktop; } - ::Decorator* Decorator() const { return fDecorator; } + ::Decorator* Decorator() const; ::ServerWindow* ServerWindow() const { return fWindow; } ::EventTarget& EventTarget() const { return fWindow->EventTarget(); } @@ -88,9 +125,10 @@ public: void GetBorderRegion(BRegion* region); void GetContentRegion(BRegion* region); - void MoveBy(int32 x, int32 y); + void MoveBy(int32 x, int32 y, bool moveStack = true); void ResizeBy(int32 x, int32 y, - BRegion* dirtyRegion); + BRegion* dirtyRegion, + bool resizeStack = true); void ScrollViewBy(View* view, int32 dx, int32 dy); @@ -191,7 +229,8 @@ public: int32* minHeight, int32* maxHeight) const; // 0.0 -> left .... 1.0 -> right - bool SetTabLocation(float location, BRegion& dirty); + bool SetTabLocation(float location, bool isShifting, + BRegion& dirty); float TabLocation() const; bool SetDecoratorSettings(const BMessage& settings, @@ -254,6 +293,19 @@ public: static uint32 ValidWindowFlags(); static uint32 ValidWindowFlags(window_feel feel); + // Window stack methods. + WindowStack* GetWindowStack(); + + bool DetachFromWindowStack( + bool ownStackNeeded = true); + bool AddWindowToStack(Window* window); + Window* StackedWindowAt(const BPoint& where); + Window* TopLayerStackWindow(); + + int32 PositionInStack() const; + bool MoveToTopStackLayer(); + bool MoveToStackPosition(int32 index, + bool isMoving); protected: void _ShiftPartOfRegion(BRegion* region, BRegion* regionToShift, int32 xOffset, @@ -307,7 +359,6 @@ protected: BObjectList fSubsets; WindowBehaviour* fWindowBehaviour; - ::Decorator* fDecorator; View* fTopView; ::ServerWindow* fWindow; DrawingEngine* fDrawingEngine; @@ -377,6 +428,12 @@ protected: int32 fWorkspacesViewCount; friend class DecorManager; + +private: + WindowStack* _InitWindowStack(); + + BReference fCurrentStack; }; + #endif // WINDOW_H diff --git a/src/servers/app/WorkspacesView.cpp b/src/servers/app/WorkspacesView.cpp index efcf439ef2..76045b8dca 100644 --- a/src/servers/app/WorkspacesView.cpp +++ b/src/servers/app/WorkspacesView.cpp @@ -177,7 +177,7 @@ WorkspacesView::_DrawWindow(DrawingEngine* drawingEngine, Decorator *decorator = window->Decorator(); BRect tabFrame(0, 0, 0, 0); if (decorator != NULL) - tabFrame = decorator->TabRect(); + tabFrame = decorator->TitleBarRect(); tabFrame = _WindowFrame(workspaceFrame, screenFrame, tabFrame, tabFrame.LeftTop() - offset); From bdfe478e9d57b86b3d3ef75ddccca58c60642d28 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 01:10:02 +0000 Subject: [PATCH 035/702] Fix the SATDecorator. Much of the stacking part is handled by the DefaultDecorator now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42479 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../decorators/SATDecorator/SATDecorator.cpp | 356 +----------------- .../decorators/SATDecorator/SATDecorator.h | 29 +- .../decorators/SATDecorator/SATWindow.cpp | 92 +---- .../decorators/SATDecorator/SATWindow.h | 6 - .../decorators/SATDecorator/StackAndTile.cpp | 37 +- .../decorators/SATDecorator/StackAndTile.h | 5 +- .../decorators/SATDecorator/Stacking.cpp | 106 +----- .../decorators/SATDecorator/Stacking.h | 2 - .../decorators/SATDecorator/Tiling.cpp | 7 - src/add-ons/decorators/SATDecorator/Tiling.h | 1 - 10 files changed, 48 insertions(+), 593 deletions(-) diff --git a/src/add-ons/decorators/SATDecorator/SATDecorator.cpp b/src/add-ons/decorators/SATDecorator/SATDecorator.cpp index 99ed1a02e3..a5649a20a6 100644 --- a/src/add-ons/decorators/SATDecorator/SATDecorator.cpp +++ b/src/add-ons/decorators/SATDecorator/SATDecorator.cpp @@ -85,359 +85,29 @@ SATDecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect, SATDecorator::SATDecorator(DesktopSettings& settings, BRect frame, window_look look, uint32 flags) : - DefaultDecorator(settings, frame, look, flags), - - fStackedMode(false), - fStackedTabLength(0) + DefaultDecorator(settings, frame, look, flags) { - fStackedDrawZoom = IsFocus(); -} - -void -SATDecorator::SetStackedMode(bool stacked, BRegion* dirty) -{ - fStackedMode = stacked; - - dirty->Include(fTabRect); - _DoLayout(); - _InvalidateFootprint(); - dirty->Include(fTabRect); -} - - -void -SATDecorator::SetStackedTabLength(float length, BRegion* dirty) -{ - fStackedTabLength = length; - - dirty->Include(fTabRect); - _DoLayout(); - _InvalidateFootprint(); - dirty->Include(fTabRect); -} - - -void -SATDecorator::_DoLayout() -{ - STRACE(("DefaultDecorator: Do Layout\n")); - // Here we determine the size of every rectangle that we use - // internally when we are given the size of the client rectangle. - - bool hasTab = false; - - switch ((int)Look()) { - case B_MODAL_WINDOW_LOOK: - fBorderWidth = 5; - break; - - case B_TITLED_WINDOW_LOOK: - case B_DOCUMENT_WINDOW_LOOK: - hasTab = true; - fBorderWidth = 5; - break; - case B_FLOATING_WINDOW_LOOK: - case kLeftTitledWindowLook: - hasTab = true; - fBorderWidth = 3; - break; - - case B_BORDERED_WINDOW_LOOK: - fBorderWidth = 1; - break; - - default: - fBorderWidth = 0; - } - - // calculate our tab rect - if (hasTab) { - // distance from one item of the tab bar to another. - // In this case the text and close/zoom rects - fTextOffset = (fLook == B_FLOATING_WINDOW_LOOK - || fLook == kLeftTitledWindowLook) ? 10 : 18; - - font_height fontHeight; - fDrawState.Font().GetHeight(fontHeight); - - if (fLook != kLeftTitledWindowLook) { - fTabRect.Set(fFrame.left - fBorderWidth, - fFrame.top - fBorderWidth - - ceilf(fontHeight.ascent + fontHeight.descent + 7.0), - ((fFrame.right - fFrame.left) < 35.0 ? - fFrame.left + 35.0 : fFrame.right) + fBorderWidth, - fFrame.top - fBorderWidth); - } else { - fTabRect.Set(fFrame.left - fBorderWidth - - ceilf(fontHeight.ascent + fontHeight.descent + 5.0), - fFrame.top - fBorderWidth, fFrame.left - fBorderWidth, - fFrame.bottom + fBorderWidth); - } - - // format tab rect for a floating window - make the rect smaller - if (fLook == B_FLOATING_WINDOW_LOOK) { - fTabRect.InsetBy(0, 2); - fTabRect.OffsetBy(0, 2); - } - - if (fStackedMode) - fTabRect.right = fTabRect.left + fStackedTabLength; - - float offset; - float size; - float inset; - _GetButtonSizeAndOffset(fTabRect, &offset, &size, &inset); - - // fMinTabSize contains just the room for the buttons - fMinTabSize = inset * 2 + fTextOffset; - if ((fFlags & B_NOT_CLOSABLE) == 0) - fMinTabSize += offset + size; - if ((fFlags & B_NOT_ZOOMABLE) == 0) - fMinTabSize += offset + size; - - // fMaxTabSize contains fMinWidth + the width required for the title - fMaxTabSize = fDrawingEngine - ? ceilf(fDrawingEngine->StringWidth(Title(), strlen(Title()), - fDrawState.Font())) : 0.0; - if (fMaxTabSize > 0.0) - fMaxTabSize += fTextOffset; - fMaxTabSize += fMinTabSize; - - float tabSize = (fLook != kLeftTitledWindowLook - ? fFrame.Width() : fFrame.Height()) + fBorderWidth * 2; - - if (fStackedMode) { - tabSize = fStackedTabLength; - fMaxTabSize = tabSize; - } - else { - if (tabSize < fMinTabSize) - tabSize = fMinTabSize; - if (tabSize > fMaxTabSize) - tabSize = fMaxTabSize; - } - // layout buttons and truncate text - if (fLook != kLeftTitledWindowLook) - fTabRect.right = fTabRect.left + tabSize; - else - fTabRect.bottom = fTabRect.top + tabSize; - } else { - // no tab - fMinTabSize = 0.0; - fMaxTabSize = 0.0; - fTabRect.Set(0.0, 0.0, -1.0, -1.0); - fCloseRect.Set(0.0, 0.0, -1.0, -1.0); - fZoomRect.Set(0.0, 0.0, -1.0, -1.0); - } - - // calculate left/top/right/bottom borders - if (fBorderWidth > 0) { - // NOTE: no overlapping, the left and right border rects - // don't include the corners! - fLeftBorder.Set(fFrame.left - fBorderWidth, fFrame.top, - fFrame.left - 1, fFrame.bottom); - - fRightBorder.Set(fFrame.right + 1, fFrame.top , - fFrame.right + fBorderWidth, fFrame.bottom); - - fTopBorder.Set(fFrame.left - fBorderWidth, fFrame.top - fBorderWidth, - fFrame.right + fBorderWidth, fFrame.top - 1); - - fBottomBorder.Set(fFrame.left - fBorderWidth, fFrame.bottom + 1, - fFrame.right + fBorderWidth, fFrame.bottom + fBorderWidth); - } else { - // no border - fLeftBorder.Set(0.0, 0.0, -1.0, -1.0); - fRightBorder.Set(0.0, 0.0, -1.0, -1.0); - fTopBorder.Set(0.0, 0.0, -1.0, -1.0); - fBottomBorder.Set(0.0, 0.0, -1.0, -1.0); - } - - // calculate resize rect - if (fBorderWidth > 1) { - fResizeRect.Set(fBottomBorder.right - kResizeKnobSize, - fBottomBorder.bottom - kResizeKnobSize, fBottomBorder.right, - fBottomBorder.bottom); - } else { - // no border or one pixel border (menus and such) - fResizeRect.Set(0, 0, -1, -1); - } - - if (hasTab) { - // make sure fTabOffset is within limits and apply it to - // the fTabRect - if (fTabOffset < 0) - fTabOffset = 0; - if (fTabLocation != 0.0 - && fTabOffset > (fRightBorder.right - fLeftBorder.left - - fTabRect.Width())) - fTabOffset = uint32(fRightBorder.right - fLeftBorder.left - - fTabRect.Width()); - fTabRect.OffsetBy(fTabOffset, 0); - - // finally, layout the buttons and text within the tab rect - _LayoutTabItems(fTabRect); - } -} - - -void -SATDecorator::_LayoutTabItems(const BRect& tabRect) -{ - float offset; - float size; - float inset; - _GetButtonSizeAndOffset(tabRect, &offset, &size, &inset); - - // calulate close rect based on the tab rectangle - if (fLook != kLeftTitledWindowLook) { - fCloseRect.Set(tabRect.left + offset, tabRect.top + offset, - tabRect.left + offset + size, tabRect.top + offset + size); - - fZoomRect.Set(tabRect.right - offset - size, tabRect.top + offset, - tabRect.right - offset, tabRect.top + offset + size); - - // hidden buttons have no width - if ((Flags() & B_NOT_CLOSABLE) != 0) - fCloseRect.right = fCloseRect.left - offset; - if ((Flags() & B_NOT_ZOOMABLE) != 0) - fZoomRect.left = fZoomRect.right + offset; - } else { - fCloseRect.Set(tabRect.left + offset, tabRect.top + offset, - tabRect.left + offset + size, tabRect.top + offset + size); - - fZoomRect.Set(tabRect.left + offset, tabRect.bottom - offset - size, - tabRect.left + size + offset, tabRect.bottom - offset); - - // hidden buttons have no height - if ((Flags() & B_NOT_CLOSABLE) != 0) - fCloseRect.bottom = fCloseRect.top - offset; - if ((Flags() & B_NOT_ZOOMABLE) != 0) - fZoomRect.top = fZoomRect.bottom + offset; - } - - // calculate room for title - // TODO: the +2 is there because the title often appeared - // truncated for no apparent reason - OTOH the title does - // also not appear perfectly in the middle - if (fLook != kLeftTitledWindowLook) - size = (fZoomRect.left - fCloseRect.right) - fTextOffset * 2 + inset; - else - size = (fZoomRect.top - fCloseRect.bottom) - fTextOffset * 2 + inset; - - if (fStackedMode && !fStackedDrawZoom) { - fZoomRect.Set(0, 0, 0, 0); - size = (fTabRect.right - fCloseRect.right) - fTextOffset * 2 + inset; - } - uint8 truncateMode = B_TRUNCATE_MIDDLE; - - if (fStackedMode) { - if (fStackedTabLength < 100) - truncateMode = B_TRUNCATE_END; - float titleWidth = fDrawState.Font().StringWidth(Title(), - BString(Title()).Length()); - if (size < titleWidth) { - float oldTextOffset = fTextOffset; - fTextOffset -= (titleWidth - size) / 2; - const float kMinTextOffset = 5.; - if (fTextOffset < kMinTextOffset) - fTextOffset = kMinTextOffset; - size += oldTextOffset * 2; - size -= fTextOffset * 2; - } - } - - fTruncatedTitle = Title(); - fDrawState.Font().TruncateString(&fTruncatedTitle, truncateMode, size); - fTruncatedTitleLength = fTruncatedTitle.Length(); -} - - -bool -SATDecorator::_SetTabLocation(float location, BRegion* updateRegion) -{ - STRACE(("DefaultDecorator: Set Tab Location(%.1f)\n", location)); - if (!fTabRect.IsValid()) - return false; - - if (location < 0) - location = 0; - - float maxLocation = 0.; - if (fStackedMode) - maxLocation = fRightBorder.right - fLeftBorder.left - fStackedTabLength; - else - maxLocation = fRightBorder.right - fLeftBorder.left - fTabRect.Width(); - if (location > maxLocation) - location = maxLocation; - - float delta = location - fTabOffset; - if (delta == 0.0) - return false; - - // redraw old rect (1 pix on the border also must be updated) - BRect trect(fTabRect); - trect.bottom++; - updateRegion->Include(trect); - - fTabRect.OffsetBy(delta, 0); - fTabOffset = (int32)location; - _LayoutTabItems(fTabRect); - - fTabLocation = maxLocation > 0.0 ? fTabOffset / maxLocation : 0.0; - - // redraw new rect as well - trect = fTabRect; - trect.bottom++; - updateRegion->Include(trect); - return true; -} - - -void -SATDecorator::_SetFocus() -{ - DefaultDecorator::_SetFocus(); - - if (!fStackedMode) - return; - - if (IsFocus()) - fStackedDrawZoom = true; - else - fStackedDrawZoom = false; - - _DoLayout(); - -} - - -void -SATDecorator::DrawButtons(const BRect& invalid) -{ - // Draw the buttons if we're supposed to - if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(fCloseRect)) - _DrawClose(fCloseRect); - - if (fStackedMode) { - // TODO: This should be solved differently. We don't just want to not - // draw the button, we actually want it removed. So rather add extra - // flags to remove the individual buttons to DefaultDecorator. - if (fStackedDrawZoom && invalid.Intersects(fZoomRect)) - _DrawZoom(fZoomRect); - } else if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(fZoomRect)) - _DrawZoom(fZoomRect); } void SATDecorator::GetComponentColors(Component component, uint8 highlight, - ComponentColors _colors) + ComponentColors _colors, Decorator::Tab* _tab) { + DefaultDecorator::Tab* tab = static_cast(_tab); // we handle only our own highlights if (highlight != HIGHLIGHT_STACK_AND_TILE) { - DefaultDecorator::GetComponentColors(component, highlight, _colors); + DefaultDecorator::GetComponentColors(component, highlight, + _colors, tab); + return; + } + + if (tab && tab->isHighlighted == false + && (component == COMPONENT_TAB || component == COMPONENT_CLOSE_BUTTON + || component == COMPONENT_ZOOM_BUTTON)) { + DefaultDecorator::GetComponentColors(component, highlight, + _colors, tab); return; } diff --git a/src/add-ons/decorators/SATDecorator/SATDecorator.h b/src/add-ons/decorators/SATDecorator/SATDecorator.h index 514f6dfa6c..7e5a4c4d0b 100644 --- a/src/add-ons/decorators/SATDecorator/SATDecorator.h +++ b/src/add-ons/decorators/SATDecorator/SATDecorator.h @@ -42,35 +42,10 @@ public: BRect frame, window_look look, uint32 flags); - /*! Indicates that window is stacked */ - void SetStackedMode(bool stacked, BRegion* dirty); - bool StackedMode() const - { return fStackedMode; } - - /*! Set the tab length if the decorator is in stacked mode and if - the tab is the last one in the tab bar. */ - void SetStackedTabLength(float length, - BRegion* dirty); - float StackedTabLength() const - { return fStackedTabLength; } - protected: - void _DoLayout(); - void _LayoutTabItems(const BRect& tabRect); - - bool _SetTabLocation(float location, - BRegion* updateRegion = NULL); - void _SetFocus(); - - virtual void DrawButtons(const BRect& invalid); virtual void GetComponentColors(Component component, - uint8 highlight, ComponentColors _colors); - -private: - bool fStackedMode; - bool fStackedDrawZoom; - float fStackedTabLength; - bool fStackedTabShifting; + uint8 highlight, ComponentColors _colors, + Decorator::Tab* tab = NULL); }; diff --git a/src/add-ons/decorators/SATDecorator/SATWindow.cpp b/src/add-ons/decorators/SATDecorator/SATWindow.cpp index 357a1e7e88..5c6b43c719 100644 --- a/src/add-ons/decorators/SATDecorator/SATWindow.cpp +++ b/src/add-ons/decorators/SATDecorator/SATWindow.cpp @@ -403,15 +403,17 @@ SATWindow::StackWindow(SATWindow* child) if (!group || !area) return false; - bool status = group->AddWindow(child, area, this); - - if (status) { - area->WindowList().ItemAt(0)->SetStackedMode(true); - // for the case we are the first added window - child->SetStackedMode(true); - } + if (group->AddWindow(child, area, this) == false) + return false; DoGroupLayout(); + + if (fWindow->AddWindowToStack(child->GetWindow()) == false) { + group->RemoveWindow(child); + DoGroupLayout(); + return false; + } + return true; } @@ -419,6 +421,7 @@ SATWindow::StackWindow(SATWindow* child) void SATWindow::RemovedFromArea(WindowArea* area) { + fWindow->DetachFromWindowStack(true); for (int i = 0; i < fSATSnappingBehaviourList.CountItems(); i++) fSATSnappingBehaviourList.ItemAt(i)->RemovedFromArea(area); } @@ -461,14 +464,6 @@ SATWindow::JoinCandidates() } -void -SATWindow::DoWindowLayout() -{ - for (int i = 0; i < fSATSnappingBehaviourList.CountItems(); i++) - fSATSnappingBehaviourList.ItemAt(i)->DoWindowLayout(); -} - - void SATWindow::DoGroupLayout() { @@ -476,8 +471,6 @@ SATWindow::DoGroupLayout() return; fGroupCookie->DoGroupLayout(); - - DoWindowLayout(); } @@ -659,15 +652,17 @@ SATWindow::HighlightTab(bool active) if (!decorator) return false; + int32 tabIndex = fWindow->PositionInStack(); BRegion dirty; uint8 highlight = active ? SATDecorator::HIGHLIGHT_STACK_AND_TILE : 0; - decorator->SetRegionHighlight(SATDecorator::REGION_TAB, highlight, &dirty); - decorator->SetRegionHighlight(SATDecorator::REGION_CLOSE_BUTTON, highlight, - &dirty); - decorator->SetRegionHighlight(SATDecorator::REGION_ZOOM_BUTTON, highlight, - &dirty); + decorator->SetRegionHighlight(Decorator::REGION_TAB, highlight, &dirty, + tabIndex); + decorator->SetRegionHighlight(Decorator::REGION_CLOSE_BUTTON, highlight, + &dirty, tabIndex); + decorator->SetRegionHighlight(Decorator::REGION_ZOOM_BUTTON, highlight, + &dirty, tabIndex); - fWindow->ProcessDirtyRegion(dirty); + fWindow->TopLayerStackWindow()->ProcessDirtyRegion(dirty); return true; } @@ -688,55 +683,6 @@ SATWindow::HighlightBorders(Decorator::Region region, bool active) } -bool -SATWindow::SetStackedMode(bool stacked) -{ - SATDecorator* decorator = GetDecorator(); - if (!decorator) - return false; - BRegion dirty; - decorator->SetStackedMode(stacked, &dirty); - fDesktop->RebuildAndRedrawAfterWindowChange(fWindow, dirty); - return true; -} - - -bool -SATWindow::SetStackedTabLength(float length) -{ - SATDecorator* decorator = GetDecorator(); - if (!decorator) - return false; - BRegion dirty; - decorator->SetStackedTabLength(length, &dirty); - fDesktop->RebuildAndRedrawAfterWindowChange(fWindow, dirty); - return true; -} - - -bool -SATWindow::SetStackedTabMoving(bool moving) -{ - SATDecorator* decorator = GetDecorator(); - if (!decorator) - return false; - - if (!moving) - DoGroupLayout(); - - return true; -} - - -void -SATWindow::TabLocationMoved(float location, bool shifting) -{ - for (int i = 0; i < fSATSnappingBehaviourList.CountItems(); i++) - fSATSnappingBehaviourList.ItemAt(i)->TabLocationMoved(location, - shifting); -} - - uint64 SATWindow::Id() { @@ -814,7 +760,7 @@ SATWindow::_RestoreOriginalSize(bool stayBelowMouse) SATDecorator* decorator = GetDecorator(); if (decorator == NULL) return; - BRect tabRect = decorator->TabRect(); + BRect tabRect = decorator->TitleBarRect(); if (mousePosition.y < tabRect.bottom && mousePosition.y > tabRect.top && mousePosition.x <= frame.right + decorator->BorderWidth() +1 && mousePosition.x >= frame.left + decorator->BorderWidth()) { diff --git a/src/add-ons/decorators/SATDecorator/SATWindow.h b/src/add-ons/decorators/SATDecorator/SATWindow.h index 07815b1aa8..e322b0d459 100644 --- a/src/add-ons/decorators/SATDecorator/SATWindow.h +++ b/src/add-ons/decorators/SATDecorator/SATWindow.h @@ -104,7 +104,6 @@ public: void FindSnappingCandidates(); bool JoinCandidates(); - void DoWindowLayout(); void DoGroupLayout(); void AdjustSizeLimits(BRect targetFrame); @@ -134,11 +133,6 @@ public: bool IsTabHighlighted(); bool IsBordersHighlighted(); - bool SetStackedMode(bool stacked = true); - bool SetStackedTabLength(float length); - bool SetStackedTabMoving(bool moving = true); - void TabLocationMoved(float location, bool shifting); - uint64 Id(); bool SetSettings(const BMessage& message); diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp index 0774697ac3..07d902d152 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp @@ -26,8 +26,7 @@ StackAndTile::StackAndTile() : fDesktop(NULL), fSATKeyPressed(false), - fCurrentSATWindow(NULL), - fTabIsShifting(false) + fCurrentSATWindow(NULL) { } @@ -218,7 +217,8 @@ StackAndTile::MouseDown(Window* window, BMessage* message, const BPoint& where) if (message->FindInt32("clicks") == 2) return; - switch (satWindow->GetDecorator()->RegionAt(where)) { + int32 tab; + switch (satWindow->GetDecorator()->RegionAt(where, tab)) { case Decorator::REGION_TAB: case Decorator::REGION_LEFT_BORDER: case Decorator::REGION_RIGHT_BORDER: @@ -247,15 +247,6 @@ StackAndTile::MouseDown(Window* window, BMessage* message, const BPoint& where) void StackAndTile::MouseUp(Window* window, BMessage* message, const BPoint& where) { - if (fTabIsShifting) { - SATWindow* satWindow = GetSATWindow(window); - if (satWindow) { - fTabIsShifting = false; - satWindow->TabLocationMoved(satWindow->GetWindow()->TabLocation(), - fTabIsShifting); - } - } - if (fSATKeyPressed) _StopSAT(); @@ -287,20 +278,8 @@ StackAndTile::WindowResized(Window* window) if (SATKeyPressed() && fCurrentSATWindow) satWindow->FindSnappingCandidates(); - else { + else satWindow->DoGroupLayout(); - - // Do a window layout for all windows. TODO: maybe do it a bit more - // efficient - SATGroup* group = satWindow->GetGroup(); - if (!group) - return; - for (int i = 0; i < group->CountItems(); i++) { - SATWindow* listWindow = group->WindowAt(i); - if (listWindow != satWindow) - listWindow->DoWindowLayout(); - } - } } @@ -379,14 +358,10 @@ StackAndTile::WindowMinimized(Window* window, bool minimize) void -StackAndTile::WindowTabLocationChanged(Window* window, float location) +StackAndTile::WindowTabLocationChanged(Window* window, float location, + bool isShifting) { - SATWindow* satWindow = GetSATWindow(window); - if (!satWindow) - return; - fTabIsShifting = true; - satWindow->TabLocationMoved(location, fTabIsShifting); } diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.h b/src/add-ons/decorators/SATDecorator/StackAndTile.h index 9d5abbcf53..ee701c66c3 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.h +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.h @@ -74,7 +74,7 @@ public: virtual void WindowMinimized(Window* window, bool minimize); virtual void WindowTabLocationChanged(Window* window, - float location); + float location, bool isShifting); virtual void SizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, int32 minHeight, int32 maxHeight); @@ -107,8 +107,6 @@ private: SATWindowList fGrouplessWindows; SATWindow* fCurrentSATWindow; - - bool fTabIsShifting; }; @@ -167,7 +165,6 @@ public: virtual bool JoinCandidates() = 0; /*! Update the window tab values, solve the layout and move all windows in the group accordantly. */ - virtual void DoWindowLayout() = 0; virtual void RemovedFromArea(WindowArea* area) {} virtual void TabLocationMoved(float location, bool shifting) {} diff --git a/src/add-ons/decorators/SATDecorator/Stacking.cpp b/src/add-ons/decorators/SATDecorator/Stacking.cpp index 47196768ad..bad0324c5c 100644 --- a/src/add-ons/decorators/SATDecorator/Stacking.cpp +++ b/src/add-ons/decorators/SATDecorator/Stacking.cpp @@ -227,11 +227,11 @@ SATStacking::FindSnappingCandidates(SATGroup* group) BPoint mousePosition; int32 buttons; fSATWindow->GetDesktop()->GetLastMouseState(&mousePosition, &buttons); - if (!window->Decorator()->TabRect().Contains(mousePosition)) + if (!window->Decorator()->TitleBarRect().Contains(mousePosition)) return false; // use the upper edge of the candidate window to find the parent window - mousePosition.y = window->Decorator()->TabRect().top; + mousePosition.y = window->Decorator()->TitleBarRect().top; for (int i = 0; i < group->CountItems(); i++) { SATWindow* satWindow = group->WindowAt(i); @@ -239,7 +239,10 @@ SATStacking::FindSnappingCandidates(SATGroup* group) Window* win = satWindow->GetWindow(); if (win == window || !win->Decorator()) continue; - if (win->Decorator()->TabRect().Contains(mousePosition)) { + Decorator::Tab* tab = win->Decorator()->TabAt(win->PositionInStack()); + if (tab == NULL) + continue; + if (tab->tabRect.Contains(mousePosition)) { // remember window as the parent for stacking fStackingParent = satWindow; _HighlightWindows(true); @@ -264,64 +267,12 @@ SATStacking::JoinCandidates() } -void -SATStacking::DoWindowLayout() -{ - _AdjustWindowTabs(); -} - - void SATStacking::RemovedFromArea(WindowArea* area) { const SATWindowList& list = area->WindowList(); - if (list.CountItems() == 1) - list.ItemAt(0)->SetStackedMode(false); - else if (list.CountItems() > 0) + if (list.CountItems() > 0) list.ItemAt(0)->DoGroupLayout(); - - fSATWindow->SetStackedMode(false); -} - - -void -SATStacking::TabLocationMoved(float location, bool shifting) -{ - if (!shifting) { - _AdjustWindowTabs(); - return; - } - - SATDecorator* decorator = fSATWindow->GetDecorator(); - Desktop* desktop = fSATWindow->GetWindow()->Desktop(); - WindowArea* area = fSATWindow->GetWindowArea(); - if (!desktop || !area || ! decorator) - return; - - const SATWindowList& stackedWindows = area->WindowList(); - ASSERT(stackedWindows.CountItems() > 0); - int32 windowIndex = stackedWindows.IndexOf(fSATWindow); - ASSERT(windowIndex >= 0); - float tabLength = stackedWindows.ItemAt(0)->GetDecorator() - ->StackedTabLength(); - - float oldTabPosition = windowIndex * (tabLength + 1); - if (fabs(oldTabPosition - location) < tabLength / 2) - return; - - int32 neighbourIndex = windowIndex; - if (oldTabPosition > location) - neighbourIndex--; - else - neighbourIndex++; - - SATWindow* neighbour = stackedWindows.ItemAt(neighbourIndex); - if (!neighbour) - return; - - float newNeighbourPosition = windowIndex * (tabLength + 1); - area->MoveWindowToPosition(fSATWindow, neighbourIndex); - desktop->SetWindowTabLocation(neighbour->GetWindow(), newNeighbourPosition); } @@ -345,46 +296,3 @@ SATStacking::_HighlightWindows(bool highlight) fStackingParent->HighlightTab(highlight); fSATWindow->HighlightTab(highlight); } - - -bool -SATStacking::_AdjustWindowTabs() -{ - SATDecorator* decorator = fSATWindow->GetDecorator(); - Desktop* desktop = fSATWindow->GetWindow()->Desktop(); - WindowArea* area = fSATWindow->GetWindowArea(); - if (!desktop || !area || ! decorator) - return false; - - if (!decorator->StackedMode()) - return false; - - BRect frame = fSATWindow->CompleteWindowFrame(); - - const SATWindowList& stackedWindows = area->WindowList(); - - int stackCount = stackedWindows.CountItems(); - float titleBarLength = frame.Width(); - ASSERT(titleBarLength > 0); - // floor to avoid drawing issues - float tabLength = floorf(titleBarLength / stackCount); - // the part that we lost due to the floor - float roundingError = 0; - if (tabLength > kMaxTabWidth) - tabLength = kMaxTabWidth; - else - roundingError = titleBarLength - stackCount * tabLength; - - float location = 0; - for (int i = 0; i < stackCount; i++) { - SATWindow* window = stackedWindows.ItemAt(i); - if (i == stackCount - 1) - window->SetStackedTabLength(tabLength - 1 + roundingError); - else - window->SetStackedTabLength(tabLength - 1); - - desktop->SetWindowTabLocation(window->GetWindow(), location); - location += tabLength; - } - return true; -} diff --git a/src/add-ons/decorators/SATDecorator/Stacking.h b/src/add-ons/decorators/SATDecorator/Stacking.h index 7d822ea547..6934ba36ae 100644 --- a/src/add-ons/decorators/SATDecorator/Stacking.h +++ b/src/add-ons/decorators/SATDecorator/Stacking.h @@ -34,12 +34,10 @@ public: void DoWindowLayout(); void RemovedFromArea(WindowArea* area); - void TabLocationMoved(float location, bool shifting); private: void _ClearSearchResult(); void _HighlightWindows(bool highlight = true); - bool _AdjustWindowTabs(); SATWindow* fSATWindow; diff --git a/src/add-ons/decorators/SATDecorator/Tiling.cpp b/src/add-ons/decorators/SATDecorator/Tiling.cpp index eadbb45b64..4e63655656 100644 --- a/src/add-ons/decorators/SATDecorator/Tiling.cpp +++ b/src/add-ons/decorators/SATDecorator/Tiling.cpp @@ -78,13 +78,6 @@ SATTiling::JoinCandidates() } -void -SATTiling::DoWindowLayout() -{ - -} - - bool SATTiling::_FindFreeAreaInGroup(SATGroup* group) { diff --git a/src/add-ons/decorators/SATDecorator/Tiling.h b/src/add-ons/decorators/SATDecorator/Tiling.h index 13c8a92741..08c555c539 100644 --- a/src/add-ons/decorators/SATDecorator/Tiling.h +++ b/src/add-ons/decorators/SATDecorator/Tiling.h @@ -24,7 +24,6 @@ public: bool FindSnappingCandidates(SATGroup* group); bool JoinCandidates(); - void DoWindowLayout(); private: bool _FindFreeAreaInGroup(SATGroup* group); From 93a0b8fa8b09e014dca78b90e1292e76ef5dd660 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 01:10:51 +0000 Subject: [PATCH 036/702] Remove not working decorators. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42480 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index c5a8b0366b..b030c41b73 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -589,7 +589,7 @@ AddFilesToHaikuImage system add-ons disk_systems # decorators AddDirectoryToHaikuImage home config add-ons decorators ; AddFilesToHaikuImage home config add-ons decorators : - MacDecorator WinDecorator ClassicBe SATDecorator ; + SATDecorator ; # create directories that will remain empty AddDirectoryToHaikuImage common bin ; From ac9cbf290642879fff0c2722bbee8c8aa2ae6636 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Mon, 25 Jul 2011 02:13:18 +0000 Subject: [PATCH 037/702] Fixed a minor typo in the help text. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42481 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mail/MailApp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/mail/MailApp.cpp b/src/apps/mail/MailApp.cpp index 8aab75c5b6..5a1c12235d 100644 --- a/src/apps/mail/MailApp.cpp +++ b/src/apps/mail/MailApp.cpp @@ -165,7 +165,7 @@ TMailApp::ArgvReceived(int32 argc, char **argv) || strcmp(argv[loop], "--help") == 0) { printf(" usage: %s [ mailto:
] [ -subject \"\" ] [ ccto:
] [ bccto:
] " - "[ -body \" ] [ ...] \n", + "[ -body \"\" ] [ enclosure: ] [ ...] \n", argv[0]); fPrintHelpAndExit = true; be_app->PostMessage(B_QUIT_REQUESTED); From 418f391fb12d0485e22b522b6c5c62ed4a8034c2 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 03:32:14 +0000 Subject: [PATCH 038/702] Fixes #7796. The decorator add-on is unloaded when not needed anymore. Avoid assigning offscreen windows a window behaviour (which lives in an add-on). When loading another add-on the offscreen window was still pointing to an invalid window behaviour. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42482 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/interface/WindowPrivate.h | 1 + src/servers/app/OffscreenWindow.cpp | 4 +++- src/servers/app/Window.cpp | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/headers/private/interface/WindowPrivate.h b/headers/private/interface/WindowPrivate.h index 858bd9f7c6..749902bc97 100644 --- a/headers/private/interface/WindowPrivate.h +++ b/headers/private/interface/WindowPrivate.h @@ -20,6 +20,7 @@ const window_feel kDesktopWindowFeel = window_feel(1024); const window_feel kMenuWindowFeel = window_feel(1025); const window_feel kWindowScreenFeel = window_feel(1026); const window_feel kPasswordWindowFeel = window_feel(1027); +const window_feel kOffscreenWindowFeel = window_feel(1028); /* Private window types */ diff --git a/src/servers/app/OffscreenWindow.cpp b/src/servers/app/OffscreenWindow.cpp index 291b80ea67..1e8eaffc3f 100644 --- a/src/servers/app/OffscreenWindow.cpp +++ b/src/servers/app/OffscreenWindow.cpp @@ -14,6 +14,8 @@ #include +#include + #include "BitmapHWInterface.h" #include "DrawingEngine.h" #include "ServerBitmap.h" @@ -24,7 +26,7 @@ using std::nothrow; OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap, const char* name, ::ServerWindow* window) : Window(bitmap->Bounds(), name, - B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, + B_NO_BORDER_WINDOW_LOOK, kOffscreenWindowFeel, 0, 0, window, new (nothrow) DrawingEngine()), fBitmap(bitmap), fHWInterface(new (nothrow) BitmapHWInterface(fBitmap)) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 975dcc3df6..bb57933a81 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -137,7 +137,8 @@ Window::Window(const BRect& frame, const char *name, &fMaxHeight); } } - fWindowBehaviour = gDecorManager.AllocateWindowBehaviour(this); + if (fFeel != kOffscreenWindowFeel) + fWindowBehaviour = gDecorManager.AllocateWindowBehaviour(this); // do we need to change our size to let the decorator fit? // _ResizeBy() will adapt the frame for validity before resizing @@ -183,7 +184,8 @@ Window::~Window() status_t Window::InitCheck() const { - if (!fDrawingEngine || !fWindowBehaviour) + if (fDrawingEngine == NULL + || (fFeel != kOffscreenWindowFeel && fWindowBehaviour == NULL)) return B_NO_MEMORY; // TODO: anything else? return B_OK; @@ -1597,7 +1599,8 @@ Window::IsValidFeel(window_feel feel) || feel == kDesktopWindowFeel || feel == kMenuWindowFeel || feel == kWindowScreenFeel - || feel == kPasswordWindowFeel; + || feel == kPasswordWindowFeel + || feel == kOffscreenWindowFeel; } From f4f30311aab9b2768d3ef7e590f85598298edfe0 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 04:31:54 +0000 Subject: [PATCH 039/702] Cleanup app server directory a bit by creating a font and a decorator sub folder. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42483 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/decorators/SATDecorator/Jamfile | 2 + src/servers/app/Desktop.cpp | 1 + src/servers/app/DrawState.h | 1 - src/servers/app/Jamfile | 39 +++++++++++++------ src/servers/app/ServerPicture.cpp | 1 + .../app/{ => decorator}/DecorManager.cpp | 0 .../app/{ => decorator}/DecorManager.h | 0 src/servers/app/{ => decorator}/Decorator.cpp | 0 src/servers/app/{ => decorator}/Decorator.h | 0 .../app/{ => decorator}/DefaultDecorator.cpp | 0 .../app/{ => decorator}/DefaultDecorator.h | 0 .../DefaultWindowBehaviour.cpp | 0 .../{ => decorator}/DefaultWindowBehaviour.h | 0 .../app/{ => decorator}/MagneticBorder.cpp | 0 .../app/{ => decorator}/MagneticBorder.h | 0 .../app/{ => decorator}/WindowBehaviour.cpp | 0 .../app/{ => decorator}/WindowBehaviour.h | 0 src/servers/app/drawing/Jamfile | 1 + src/servers/app/drawing/Painter/Jamfile | 1 + src/servers/app/drawing/remote/Jamfile | 1 + src/servers/app/{ => font}/FontCache.cpp | 0 src/servers/app/{ => font}/FontCache.h | 0 src/servers/app/{ => font}/FontCacheEntry.cpp | 0 src/servers/app/{ => font}/FontCacheEntry.h | 0 src/servers/app/{ => font}/FontEngine.cpp | 0 src/servers/app/{ => font}/FontEngine.h | 0 src/servers/app/{ => font}/FontFamily.cpp | 0 src/servers/app/{ => font}/FontFamily.h | 0 src/servers/app/{ => font}/FontManager.cpp | 0 src/servers/app/{ => font}/FontManager.h | 0 src/servers/app/{ => font}/FontStyle.cpp | 0 src/servers/app/{ => font}/FontStyle.h | 0 .../app/{ => font}/GlyphLayoutEngine.h | 0 33 files changed, 34 insertions(+), 13 deletions(-) rename src/servers/app/{ => decorator}/DecorManager.cpp (100%) rename src/servers/app/{ => decorator}/DecorManager.h (100%) rename src/servers/app/{ => decorator}/Decorator.cpp (100%) rename src/servers/app/{ => decorator}/Decorator.h (100%) rename src/servers/app/{ => decorator}/DefaultDecorator.cpp (100%) rename src/servers/app/{ => decorator}/DefaultDecorator.h (100%) rename src/servers/app/{ => decorator}/DefaultWindowBehaviour.cpp (100%) rename src/servers/app/{ => decorator}/DefaultWindowBehaviour.h (100%) rename src/servers/app/{ => decorator}/MagneticBorder.cpp (100%) rename src/servers/app/{ => decorator}/MagneticBorder.h (100%) rename src/servers/app/{ => decorator}/WindowBehaviour.cpp (100%) rename src/servers/app/{ => decorator}/WindowBehaviour.h (100%) rename src/servers/app/{ => font}/FontCache.cpp (100%) rename src/servers/app/{ => font}/FontCache.h (100%) rename src/servers/app/{ => font}/FontCacheEntry.cpp (100%) rename src/servers/app/{ => font}/FontCacheEntry.h (100%) rename src/servers/app/{ => font}/FontEngine.cpp (100%) rename src/servers/app/{ => font}/FontEngine.h (100%) rename src/servers/app/{ => font}/FontFamily.cpp (100%) rename src/servers/app/{ => font}/FontFamily.h (100%) rename src/servers/app/{ => font}/FontManager.cpp (100%) rename src/servers/app/{ => font}/FontManager.h (100%) rename src/servers/app/{ => font}/FontStyle.cpp (100%) rename src/servers/app/{ => font}/FontStyle.h (100%) rename src/servers/app/{ => font}/GlyphLayoutEngine.h (100%) diff --git a/src/add-ons/decorators/SATDecorator/Jamfile b/src/add-ons/decorators/SATDecorator/Jamfile index 1f07f3ecc4..e83ebf7ef9 100644 --- a/src/add-ons/decorators/SATDecorator/Jamfile +++ b/src/add-ons/decorators/SATDecorator/Jamfile @@ -4,6 +4,8 @@ UseLibraryHeaders agg lp_solve linprog ; UsePrivateHeaders app graphics interface shared kernel ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app decorator ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app font ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; UseFreeTypeHeaders ; diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 5abe4c85ec..d6dc179c5f 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -40,6 +40,7 @@ #include "DecorManager.h" #include "DesktopSettingsPrivate.h" #include "DrawingEngine.h" +#include "FontManager.h" #include "HWInterface.h" #include "InputManager.h" #include "Screen.h" diff --git a/src/servers/app/DrawState.h b/src/servers/app/DrawState.h index a050f53644..c64ebd192a 100644 --- a/src/servers/app/DrawState.h +++ b/src/servers/app/DrawState.h @@ -17,7 +17,6 @@ #include #include // for B_FONT_ALL -#include "FontManager.h" #include "ServerFont.h" #include "PatternHandler.h" diff --git a/src/servers/app/Jamfile b/src/servers/app/Jamfile index 6fb19d7b7f..9514028257 100644 --- a/src/servers/app/Jamfile +++ b/src/servers/app/Jamfile @@ -8,6 +8,26 @@ UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; UseFreeTypeHeaders ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app decorator ] ; +local decorator_src = + DecorManager.cpp + Decorator.cpp + DefaultDecorator.cpp + DefaultWindowBehaviour.cpp + MagneticBorder.cpp + WindowBehaviour.cpp + ; + +UseHeaders [ FDirName $(HAIKU_TOP) src servers app font ] ; +local font_src = + FontCache.cpp + FontCacheEntry.cpp + FontEngine.cpp + FontFamily.cpp + FontManager.cpp + FontStyle.cpp + ; + Server app_server : Angle.cpp AppServer.cpp @@ -18,10 +38,6 @@ Server app_server : CursorData.cpp CursorManager.cpp CursorSet.cpp - DecorManager.cpp - Decorator.cpp - DefaultDecorator.cpp - DefaultWindowBehaviour.cpp Desktop.cpp DesktopListener.cpp DesktopSettings.cpp @@ -29,17 +45,10 @@ Server app_server : DrawState.cpp EventDispatcher.cpp EventStream.cpp - FontCache.cpp - FontCacheEntry.cpp - FontEngine.cpp - FontFamily.cpp - FontManager.cpp - FontStyle.cpp HashTable.cpp InputManager.cpp IntPoint.cpp IntRect.cpp - MagneticBorder.cpp MessageLooper.cpp MultiLocker.cpp OffscreenServerWindow.cpp @@ -60,11 +69,13 @@ Server app_server : View.cpp VirtualScreen.cpp Window.cpp - WindowBehaviour.cpp WindowList.cpp Workspace.cpp WorkspacesView.cpp + $(decorator_src) + $(font_src) + # libraries : libtranslation.so libbe.so libbnetapi.so @@ -74,4 +85,8 @@ Server app_server : : app_server.rdef ; +SEARCH on [ FGristFiles $(decorator_src) ] = [ FDirName $(HAIKU_TOP) src servers app decorator ] ; +SEARCH on [ FGristFiles $(font_src) ] = [ FDirName $(HAIKU_TOP) src servers app font ] ; + + SubInclude HAIKU_TOP src servers app drawing ; diff --git a/src/servers/app/ServerPicture.cpp b/src/servers/app/ServerPicture.cpp index 72d81f27c9..3e094cd899 100644 --- a/src/servers/app/ServerPicture.cpp +++ b/src/servers/app/ServerPicture.cpp @@ -16,6 +16,7 @@ #include "DrawingEngine.h" #include "DrawState.h" +#include "FontManager.h" #include "ServerApp.h" #include "ServerBitmap.h" #include "ServerFont.h" diff --git a/src/servers/app/DecorManager.cpp b/src/servers/app/decorator/DecorManager.cpp similarity index 100% rename from src/servers/app/DecorManager.cpp rename to src/servers/app/decorator/DecorManager.cpp diff --git a/src/servers/app/DecorManager.h b/src/servers/app/decorator/DecorManager.h similarity index 100% rename from src/servers/app/DecorManager.h rename to src/servers/app/decorator/DecorManager.h diff --git a/src/servers/app/Decorator.cpp b/src/servers/app/decorator/Decorator.cpp similarity index 100% rename from src/servers/app/Decorator.cpp rename to src/servers/app/decorator/Decorator.cpp diff --git a/src/servers/app/Decorator.h b/src/servers/app/decorator/Decorator.h similarity index 100% rename from src/servers/app/Decorator.h rename to src/servers/app/decorator/Decorator.h diff --git a/src/servers/app/DefaultDecorator.cpp b/src/servers/app/decorator/DefaultDecorator.cpp similarity index 100% rename from src/servers/app/DefaultDecorator.cpp rename to src/servers/app/decorator/DefaultDecorator.cpp diff --git a/src/servers/app/DefaultDecorator.h b/src/servers/app/decorator/DefaultDecorator.h similarity index 100% rename from src/servers/app/DefaultDecorator.h rename to src/servers/app/decorator/DefaultDecorator.h diff --git a/src/servers/app/DefaultWindowBehaviour.cpp b/src/servers/app/decorator/DefaultWindowBehaviour.cpp similarity index 100% rename from src/servers/app/DefaultWindowBehaviour.cpp rename to src/servers/app/decorator/DefaultWindowBehaviour.cpp diff --git a/src/servers/app/DefaultWindowBehaviour.h b/src/servers/app/decorator/DefaultWindowBehaviour.h similarity index 100% rename from src/servers/app/DefaultWindowBehaviour.h rename to src/servers/app/decorator/DefaultWindowBehaviour.h diff --git a/src/servers/app/MagneticBorder.cpp b/src/servers/app/decorator/MagneticBorder.cpp similarity index 100% rename from src/servers/app/MagneticBorder.cpp rename to src/servers/app/decorator/MagneticBorder.cpp diff --git a/src/servers/app/MagneticBorder.h b/src/servers/app/decorator/MagneticBorder.h similarity index 100% rename from src/servers/app/MagneticBorder.h rename to src/servers/app/decorator/MagneticBorder.h diff --git a/src/servers/app/WindowBehaviour.cpp b/src/servers/app/decorator/WindowBehaviour.cpp similarity index 100% rename from src/servers/app/WindowBehaviour.cpp rename to src/servers/app/decorator/WindowBehaviour.cpp diff --git a/src/servers/app/WindowBehaviour.h b/src/servers/app/decorator/WindowBehaviour.h similarity index 100% rename from src/servers/app/WindowBehaviour.h rename to src/servers/app/decorator/WindowBehaviour.h diff --git a/src/servers/app/drawing/Jamfile b/src/servers/app/drawing/Jamfile index 52fe15dc34..5c2a0bf964 100644 --- a/src/servers/app/drawing/Jamfile +++ b/src/servers/app/drawing/Jamfile @@ -6,6 +6,7 @@ UsePrivateHeaders [ FDirName graphics common ] ; UsePrivateSystemHeaders ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app font ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter drawing_modes ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter font_support ] ; diff --git a/src/servers/app/drawing/Painter/Jamfile b/src/servers/app/drawing/Painter/Jamfile index 18146324d8..10c9a25136 100644 --- a/src/servers/app/drawing/Painter/Jamfile +++ b/src/servers/app/drawing/Painter/Jamfile @@ -6,6 +6,7 @@ AddSubDirSupportedPlatforms libbe_test ; UseLibraryHeaders agg ; UsePrivateHeaders app graphics interface kernel shared ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app font ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter drawing_modes ] ; UseFreeTypeHeaders ; diff --git a/src/servers/app/drawing/remote/Jamfile b/src/servers/app/drawing/remote/Jamfile index d55a61f523..e354b860eb 100644 --- a/src/servers/app/drawing/remote/Jamfile +++ b/src/servers/app/drawing/remote/Jamfile @@ -6,6 +6,7 @@ UsePrivateHeaders [ FDirName graphics common ] ; UsePrivateSystemHeaders ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app font ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter drawing_modes ] ; diff --git a/src/servers/app/FontCache.cpp b/src/servers/app/font/FontCache.cpp similarity index 100% rename from src/servers/app/FontCache.cpp rename to src/servers/app/font/FontCache.cpp diff --git a/src/servers/app/FontCache.h b/src/servers/app/font/FontCache.h similarity index 100% rename from src/servers/app/FontCache.h rename to src/servers/app/font/FontCache.h diff --git a/src/servers/app/FontCacheEntry.cpp b/src/servers/app/font/FontCacheEntry.cpp similarity index 100% rename from src/servers/app/FontCacheEntry.cpp rename to src/servers/app/font/FontCacheEntry.cpp diff --git a/src/servers/app/FontCacheEntry.h b/src/servers/app/font/FontCacheEntry.h similarity index 100% rename from src/servers/app/FontCacheEntry.h rename to src/servers/app/font/FontCacheEntry.h diff --git a/src/servers/app/FontEngine.cpp b/src/servers/app/font/FontEngine.cpp similarity index 100% rename from src/servers/app/FontEngine.cpp rename to src/servers/app/font/FontEngine.cpp diff --git a/src/servers/app/FontEngine.h b/src/servers/app/font/FontEngine.h similarity index 100% rename from src/servers/app/FontEngine.h rename to src/servers/app/font/FontEngine.h diff --git a/src/servers/app/FontFamily.cpp b/src/servers/app/font/FontFamily.cpp similarity index 100% rename from src/servers/app/FontFamily.cpp rename to src/servers/app/font/FontFamily.cpp diff --git a/src/servers/app/FontFamily.h b/src/servers/app/font/FontFamily.h similarity index 100% rename from src/servers/app/FontFamily.h rename to src/servers/app/font/FontFamily.h diff --git a/src/servers/app/FontManager.cpp b/src/servers/app/font/FontManager.cpp similarity index 100% rename from src/servers/app/FontManager.cpp rename to src/servers/app/font/FontManager.cpp diff --git a/src/servers/app/FontManager.h b/src/servers/app/font/FontManager.h similarity index 100% rename from src/servers/app/FontManager.h rename to src/servers/app/font/FontManager.h diff --git a/src/servers/app/FontStyle.cpp b/src/servers/app/font/FontStyle.cpp similarity index 100% rename from src/servers/app/FontStyle.cpp rename to src/servers/app/font/FontStyle.cpp diff --git a/src/servers/app/FontStyle.h b/src/servers/app/font/FontStyle.h similarity index 100% rename from src/servers/app/FontStyle.h rename to src/servers/app/font/FontStyle.h diff --git a/src/servers/app/GlyphLayoutEngine.h b/src/servers/app/font/GlyphLayoutEngine.h similarity index 100% rename from src/servers/app/GlyphLayoutEngine.h rename to src/servers/app/font/GlyphLayoutEngine.h From 898878314d25b67a9be06dd6c5a92ae77481af74 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 05:07:26 +0000 Subject: [PATCH 040/702] Fix todo and only unload listener from the last add-on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42484 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 14 +++++++------- src/servers/app/Desktop.h | 3 ++- src/servers/app/decorator/DecorManager.cpp | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index d6dc179c5f..a0abb3a4c2 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -2047,18 +2047,18 @@ Desktop::RedrawBackground() bool -Desktop::ReloadDecor() +Desktop::ReloadDecor(DecorAddOn* oldDecor) { AutoWriteLocker _(fWindowLock); bool returnValue = true; - // TODO it is assumed all listeners are registered by one decor - // unregister old listeners - const DesktopListenerDLList& currentListeners = GetDesktopListenerList(); - for (DesktopListener* listener = currentListeners.First(); - listener != NULL; listener = currentListeners.GetNext(listener)) - UnregisterListener(listener); + if (oldDecor != NULL) { + const DesktopListenerList* oldListeners + = &oldDecor->GetDesktopListeners(); + for (int i = 0; i < oldListeners->CountItems(); i++) + UnregisterListener(oldListeners->ItemAt(i)); + } for (Window* window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index ae663ac690..39cb7a5a01 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -39,6 +39,7 @@ class BMessage; +class DecorAddOn; class DrawingEngine; class HWInterface; class ServerApp; @@ -221,7 +222,7 @@ public: void Redraw(); void RedrawBackground(); - bool ReloadDecor(); + bool ReloadDecor(DecorAddOn* oldDecor); BRegion& BackgroundRegion() { return fBackgroundRegion; } diff --git a/src/servers/app/decorator/DecorManager.cpp b/src/servers/app/decorator/DecorManager.cpp index c06ef07dc7..a020e20909 100644 --- a/src/servers/app/decorator/DecorManager.cpp +++ b/src/servers/app/decorator/DecorManager.cpp @@ -243,13 +243,14 @@ DecorManager::SetDecorator(BString path, Desktop* desktop) return error == B_OK ? B_ERROR : error; DecorAddOn* oldDecor = fCurrentDecor; + BString oldPath = fCurrentDecorPath; image_id oldImage = fCurrentDecor->ImageID(); fCurrentDecor = newDecor; fCurrentDecorPath = path.String(); - if (desktop->ReloadDecor()) { + if (desktop->ReloadDecor(oldDecor)) { // now safe to unload all old decorator data // saves us from deleting oldDecor... unload_add_on(oldImage); From 0bb924af97f9d7389a3d991f9f28c5337ed5ad32 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 25 Jul 2011 17:39:20 +0000 Subject: [PATCH 041/702] * Add 4250, 4290 PCIIDs as per #7871 * Fix a few tabs to make things consistent git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42485 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/driver.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 5a6152868d..4dc181ba56 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -49,7 +49,7 @@ const struct supported_device { {0x94cc, RADEON_R600 | 0x10, "Radeon HD 2400"}, /*RV610*/ {0x9586, RADEON_R600 | 0x30, "Radeon HD 2600"}, /*RV630*/ {0x9588, RADEON_R600 | 0x30, "Radeon HD 2600"}, /*RV630*/ - {0x958a, RADEON_R600 | 0x30, "Radeon HD 2600 X2"}, /*RV630*/ + {0x958a, RADEON_R600 | 0x30, "Radeon HD 2600 X2"},/*RV630*/ // Radeon 2700 - RV630 {0x9400, RADEON_R600 | 0x0, "Radeon HD 2900"}, /*RV600*/ {0x9405, RADEON_R600 | 0x0, "Radeon HD 2900"}, /*RV600*/ @@ -66,21 +66,22 @@ const struct supported_device { {0x95c9, RADEON_R600 | 0x20, "Radeon HD 3450"}, /*RV620*/ {0x95c4, RADEON_R600 | 0x20, "Radeon HD 3470"}, /*RV620*/ {0x95c0, RADEON_R600 | 0x20, "Radeon HD 3550"}, /*RV620*/ - {0x9581, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ - {0x9583, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ - {0x9598, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ - {0x9591, RADEON_R600 | 0x35, "Radeon HD 3600"}, /*RV635*/ + {0x9581, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ + {0x9583, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ + {0x9598, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ + {0x9591, RADEON_R600 | 0x35, "Radeon HD 3600"}, /*RV635*/ {0x9589, RADEON_R600 | 0x30, "Radeon HD 3610"}, /*RV630*/ // Radeon 3650 - RV635 // Radeon 3670 - RV635 {0x9507, RADEON_R600 | 0x70, "Radeon HD 3830"}, /*RV670*/ {0x9505, RADEON_R600 | 0x70, "Radeon HD 3850"}, /*RV670, IGP*/ - {0x9513, RADEON_R600 | 0x80, "Radeon HD 3850 X2"}, /*RV670*/ + {0x9513, RADEON_R600 | 0x80, "Radeon HD 3850 X2"},/*RV670*/ {0x9501, RADEON_R600 | 0x70, "Radeon HD 3870"}, /*RV670*/ - {0x950F, RADEON_R600 | 0x80, "Radeon HD 3870 X2"}, /*R680*/ + {0x950F, RADEON_R600 | 0x80, "Radeon HD 3870 X2"},/*R680*/ {0x9710, RADEON_R600 | 0x20, "Radeon HD 4200"}, /*RV620, IGP*/ - // Radeon 4225 - RV620 + {0x9715, RADEON_R600 | 0x20, "Radeon HD 4250"}, /*RV620, IGP*/ {0x9712, RADEON_R600 | 0x20, "Radeon HD 4270"}, /*RV620, IGP*/ + {0x9714, RADEON_R600 | 0x20, "Radeon HD 4290"}, /*RV620, IGP*/ // R700 series (HD4330 - HD4890, HD51xx, HD5xxV) // Codename: Wekiva @@ -91,17 +92,17 @@ const struct supported_device { {0x9540, RADEON_R700 | 0x10, "Radeon HD 4550"}, /*RV710*/ {0x9498, RADEON_R700 | 0x30, "Radeon HD 4650"}, /*RV740*/ {0x94b4, RADEON_R700 | 0x40, "Radeon HD 4700"}, /*RV740*/ - {0x9490, RADEON_R700 | 0x30, "Radeon HD 4710"}, /*RV740*/ + {0x9490, RADEON_R700 | 0x30, "Radeon HD 4710"}, /*RV740*/ {0x94b3, RADEON_R700 | 0x40, "Radeon HD 4770"}, /*RV740*/ {0x94b5, RADEON_R700 | 0x40, "Radeon HD 4770"}, /*RV740*/ - {0x944a, RADEON_R700 | 0x70, "Radeon HD 4800"}, /*RV740*/ + {0x944a, RADEON_R700 | 0x70, "Radeon HD 4800"}, /*RV740*/ {0x944e, RADEON_R700 | 0x70, "Radeon HD 4810"}, /*RV740*/ {0x944c, RADEON_R700 | 0x70, "Radeon HD 4830"}, /*RV740*/ {0x9442, RADEON_R700 | 0x70, "Radeon HD 4850"}, /*RV770*/ - {0x9443, RADEON_R700 | 0x70, "Radeon HD 4850 X2"}, /*RV770*/ + {0x9443, RADEON_R700 | 0x70, "Radeon HD 4850 X2"},/*RV770*/ {0x94a1, RADEON_R700 | 0x90, "Radeon HD 4860"}, /*RV780, IGP*/ {0x9440, RADEON_R700 | 0x70, "Radeon HD 4870"}, /*RV770*/ - {0x9441, RADEON_R700 | 0x70, "Radeon HD 4870 X2"}, /*RV770*/ + {0x9441, RADEON_R700 | 0x70, "Radeon HD 4870 X2"},/*RV770*/ // R800 series (HD54xx - HD59xx) // Codename: Evergreen From d24ddec4e4e5bb2fd466c1b3db7a4fa836fbd4ff Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 25 Jul 2011 22:26:35 +0000 Subject: [PATCH 042/702] * Move platform support.cpp into less generic of_support.cpp * Add header file to support of_support.cpp * Add support functions to obtain address and size cell lengths * Small style cleanups * Add support for G5 PowerPC cpus... * Refactor memory region code to be aware of 64-bit OF addresses. As-is the boot loader wouldn't start on G5 systems because OpenFirmware memory base addresses are stored as two 32-bit unsigned int 'cells' vs one 32-bit unsigned int 'cell' on G3/G4. I removed the static struct and replaced it with a template and pass uint32 or uint64 depending on the address cell size. Thanks for the idea DeadYak! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42486 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../platform/openfirmware/openfirmware.h | 12 ++-- src/system/boot/platform/openfirmware/Jamfile | 2 +- .../platform/openfirmware/arch/ppc/mmu.cpp | 68 ++++++++++++++++--- .../boot/platform/openfirmware/of_support.cpp | 48 +++++++++++++ .../boot/platform/openfirmware/of_support.h | 19 ++++++ .../boot/platform/openfirmware/support.cpp | 17 ----- 6 files changed, 135 insertions(+), 31 deletions(-) create mode 100644 src/system/boot/platform/openfirmware/of_support.cpp create mode 100644 src/system/boot/platform/openfirmware/of_support.h delete mode 100644 src/system/boot/platform/openfirmware/support.cpp diff --git a/headers/private/kernel/platform/openfirmware/openfirmware.h b/headers/private/kernel/platform/openfirmware/openfirmware.h index 9e75fc10e6..065f73f49a 100644 --- a/headers/private/kernel/platform/openfirmware/openfirmware.h +++ b/headers/private/kernel/platform/openfirmware/openfirmware.h @@ -15,6 +15,13 @@ extern int gChosen; +template +struct of_region +{ + addressSize base; + uint32 size; +}; + struct of_arguments { const char *name; int num_args; @@ -27,11 +34,6 @@ struct of_arguments { #endif }; -struct of_region { - void *base; - uint32 size; -}; - #ifdef __cplusplus extern "C" { diff --git a/src/system/boot/platform/openfirmware/Jamfile b/src/system/boot/platform/openfirmware/Jamfile index 227df039bf..322ab3bea5 100644 --- a/src/system/boot/platform/openfirmware/Jamfile +++ b/src/system/boot/platform/openfirmware/Jamfile @@ -17,7 +17,7 @@ KernelMergeObject boot_platform_openfirmware.o : network.cpp real_time_clock.cpp start.cpp - support.cpp + of_support.cpp video.cpp openfirmware.cpp diff --git a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp index 7bd8e0b32b..b3111e8176 100644 --- a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp +++ b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp @@ -17,6 +17,7 @@ #include #include +#include "of_support.h" // set protection to WIMGNPP: -----PP // PP: 00 - no access @@ -69,30 +70,81 @@ remove_virtual_range_to_keep(void *start, uint32 size) static status_t find_physical_memory_ranges(size_t &total) { - int memory, package; + int memory; dprintf("checking for memory...\n"); if (of_getprop(gChosen, "memory", &memory, sizeof(int)) == OF_FAILED) return B_ERROR; - package = of_instance_to_package(memory); + int package = of_instance_to_package(memory); total = 0; - struct of_region regions[64]; - int count; - count = of_getprop(package, "reg", regions, sizeof(regions)); + /* Memory base addresses are provided in 32 or 64 bit flavors + #address-cells and #size-cells matches the number of 32-bit 'cells' + representing the length of the base address and size fields + */ + int root = of_finddevice("/"); + int regAddressCount = of_address_cells(root); + int regSizeCount = of_size_cells(root); + if (regAddressCount == OF_FAILED || regSizeCount == OF_FAILED) { + dprintf("finding base/size length counts failed, assume 32-bit.\n"); + regAddressCount = 1; + regSizeCount = 1; + } + dprintf("memory range address cells: %d; size cells: %d;\n", + regAddressCount, regSizeCount); + + if (regAddressCount > 2 || regSizeCount > 1) { + dprintf("Unsupported cell size detected. (machine is > 64bit?).\n"); + return B_ERROR; + } + + // On 64-bit PowerPC systems (G5), our mem base range address is larger + if (regAddressCount == 2) { + struct of_region regions[64]; + int count = of_getprop(package, "reg", regions, sizeof(regions)); + if (count == OF_FAILED) + count = of_getprop(memory, "reg", regions, sizeof(regions)); + if (count == OF_FAILED) + return B_ERROR; + count /= sizeof(regions[0]); + + for (int32 i = 0; i < count; i++) { + if (regions[i].size <= 0) { + dprintf("%ld: empty region\n", i); + continue; + } + dprintf("%" B_PRIu32 ": base = %" B_PRIu64 "," + "size = %" B_PRIu32 "\n", i, regions[i].base, regions[i].size); + + total += regions[i].size; + + if (insert_physical_memory_range((addr_t)regions[i].base, + regions[i].size) != B_OK) { + dprintf("cannot map physical memory range " + "(num ranges = %" B_PRIu32 ")!\n", + gKernelArgs.num_physical_memory_ranges); + return B_ERROR; + } + } + return B_OK; + } + + // Otherwise, normal 32-bit PowerPC G3 or G4 have a smaller 32-bit one + struct of_region regions[64]; + int count = of_getprop(package, "reg", regions, sizeof(regions)); if (count == OF_FAILED) count = of_getprop(memory, "reg", regions, sizeof(regions)); if (count == OF_FAILED) return B_ERROR; - count /= sizeof(of_region); + count /= sizeof(regions[0]); for (int32 i = 0; i < count; i++) { if (regions[i].size <= 0) { dprintf("%ld: empty region\n", i); continue; } - dprintf("%" B_PRIu32 ": base = %p, size = %" B_PRIu32 "\n", i, - regions[i].base, regions[i].size); + dprintf("%" B_PRIu32 ": base = %" B_PRIu32 "," + "size = %" B_PRIu32 "\n", i, regions[i].base, regions[i].size); total += regions[i].size; diff --git a/src/system/boot/platform/openfirmware/of_support.cpp b/src/system/boot/platform/openfirmware/of_support.cpp new file mode 100644 index 0000000000..f1e86ef809 --- /dev/null +++ b/src/system/boot/platform/openfirmware/of_support.cpp @@ -0,0 +1,48 @@ +/* + * Copyright 2005, Ingo Weinhold . + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * All rights reserved. Distributed under the terms of the MIT License. + * + * Authors: + * Ingo Weinhold, bonefish@cs.tu-berlin.de + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include "of_support.h" +#include + + +bigtime_t +system_time(void) +{ + int result = of_milliseconds(); + return (result == OF_FAILED ? 0 : bigtime_t(result) * 1000); +} + + +/** given the package provided, get the number of cells ++ in the reg property ++ */ + +uint32 +of_address_cells(int package) { + uint32 address_cells; + if (of_getprop(package, "#address-cells", + &address_cells, sizeof(address_cells)) == OF_FAILED) + return OF_FAILED; + + return address_cells; +} + + +uint32 +of_size_cells(int package) { + uint32 size_cells; + if (of_getprop(package, "#size-cells", + &size_cells, sizeof(size_cells)) == OF_FAILED) + return OF_FAILED; + return size_cells; +} + + diff --git a/src/system/boot/platform/openfirmware/of_support.h b/src/system/boot/platform/openfirmware/of_support.h new file mode 100644 index 0000000000..a7667ec396 --- /dev/null +++ b/src/system/boot/platform/openfirmware/of_support.h @@ -0,0 +1,19 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ +#ifndef OF_SUPPORT_H +#define OF_SUPPORT_H + + +#include + + +bigtime_t system_time(void); +uint32 of_address_cells(int package); +uint32 of_size_cells(int package); + +#endif diff --git a/src/system/boot/platform/openfirmware/support.cpp b/src/system/boot/platform/openfirmware/support.cpp deleted file mode 100644 index 2333b8eb24..0000000000 --- a/src/system/boot/platform/openfirmware/support.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2005, Ingo Weinhold . - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include - -#include - - -bigtime_t -system_time(void) -{ - int result = of_milliseconds(); - return (result == OF_FAILED ? 0 : bigtime_t(result) * 1000); -} From 837ad4a36f7e824909b2d5d4cd0787c2ecbbf987 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 22:26:44 +0000 Subject: [PATCH 043/702] Activate only the top window in a group and not all windows. Fixes #6652 and #6616. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42487 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/decorators/SATDecorator/SATGroup.cpp | 7 +++++++ src/add-ons/decorators/SATDecorator/SATGroup.h | 1 + .../decorators/SATDecorator/StackAndTile.cpp | 15 ++++++--------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/add-ons/decorators/SATDecorator/SATGroup.cpp b/src/add-ons/decorators/SATDecorator/SATGroup.cpp index ab98faae02..209afea68c 100644 --- a/src/add-ons/decorators/SATDecorator/SATGroup.cpp +++ b/src/add-ons/decorators/SATDecorator/SATGroup.cpp @@ -78,6 +78,13 @@ WindowArea::MoveWindowToPosition(SATWindow* window, int32 index) } +SATWindow* +WindowArea::TopWindow() +{ + return fWindowLayerOrder.ItemAt(fWindowLayerOrder.CountItems() - 1); +} + + bool WindowArea::_AddWindow(SATWindow* window, SATWindow* after) { diff --git a/src/add-ons/decorators/SATDecorator/SATGroup.h b/src/add-ons/decorators/SATDecorator/SATGroup.h index 6324b3fe08..3f26050c6c 100644 --- a/src/add-ons/decorators/SATDecorator/SATGroup.h +++ b/src/add-ons/decorators/SATDecorator/SATGroup.h @@ -144,6 +144,7 @@ public: const SATWindowList& LayerOrder() { return fWindowLayerOrder; } bool MoveWindowToPosition(SATWindow* window, int32 index); + SATWindow* TopWindow(); Crossing* LeftTopCrossing() { return fLeftTopCrossing.Get(); } diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp index 07d902d152..32a6f5be73 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp @@ -502,15 +502,12 @@ StackAndTile::_ActivateWindow(SATWindow* satWindow) return; area->MoveToTopLayer(satWindow); - //desktop->ActivateWindow(satWindow->GetWindow()); - - WindowIterator iter(group); - for (SATWindow* listWindow = iter.NextWindow(); listWindow != NULL; - listWindow = iter.NextWindow()) { - if (listWindow != satWindow) - //desktop->SendWindowBehind(listWindow->GetWindow(), - // satWindow->GetWindow()); - desktop->ActivateWindow(listWindow->GetWindow()); + const WindowAreaList& areas = group->GetAreaList() ; + for (int32 i = 0; i < areas.CountItems(); i++) { + WindowArea* currentArea = areas.ItemAt(i); + if (currentArea == area) + continue; + desktop->ActivateWindow(currentArea->TopWindow()->GetWindow()); } desktop->ActivateWindow(satWindow->GetWindow()); From 3a850e1a1ad7b6a19365368c9600f0946f03d8b9 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 25 Jul 2011 22:40:59 +0000 Subject: [PATCH 044/702] Remove empty line, thanks Axel! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42488 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Region.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/kits/interface/Region.cpp b/src/kits/interface/Region.cpp index 9d63e41683..d44529ec86 100644 --- a/src/kits/interface/Region.cpp +++ b/src/kits/interface/Region.cpp @@ -342,7 +342,6 @@ BRegion::PrintToStream() const // #pragma mark - - void BRegion::OffsetBy(const BPoint& point) { From 8320d948d5a5d60d6fc6039a653f04f031a01480 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 25 Jul 2011 22:46:24 +0000 Subject: [PATCH 045/702] small style fix git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42489 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/platform/openfirmware/openfirmware.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/headers/private/kernel/platform/openfirmware/openfirmware.h b/headers/private/kernel/platform/openfirmware/openfirmware.h index 065f73f49a..7510425db8 100644 --- a/headers/private/kernel/platform/openfirmware/openfirmware.h +++ b/headers/private/kernel/platform/openfirmware/openfirmware.h @@ -16,8 +16,7 @@ extern int gChosen; template -struct of_region -{ +struct of_region { addressSize base; uint32 size; }; From ed8b50f79ab6ab6d046998bf0d585b9fa55dcaf9 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 25 Jul 2011 22:52:00 +0000 Subject: [PATCH 046/702] small tab fix; no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42490 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/openfirmware/of_support.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/system/boot/platform/openfirmware/of_support.cpp b/src/system/boot/platform/openfirmware/of_support.cpp index f1e86ef809..545e952f3f 100644 --- a/src/system/boot/platform/openfirmware/of_support.cpp +++ b/src/system/boot/platform/openfirmware/of_support.cpp @@ -40,8 +40,9 @@ uint32 of_size_cells(int package) { uint32 size_cells; if (of_getprop(package, "#size-cells", - &size_cells, sizeof(size_cells)) == OF_FAILED) - return OF_FAILED; + &size_cells, sizeof(size_cells)) == OF_FAILED) + return OF_FAILED; + return size_cells; } From 16aa61c46a18969d8fa9b13d04cf1f9cab03b80d Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 02:41:56 +0000 Subject: [PATCH 047/702] Fix changing of the window feel and borderless windows. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42491 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index bb57933a81..d8b9bdd552 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -1213,16 +1213,6 @@ Window::FontsChanged(BRegion* updateRegion) void Window::SetLook(window_look look, BRegion* updateRegion) { - ::Decorator* decorator = Decorator(); - if (decorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) { - // we need a new decorator - decorator = gDecorManager.AllocateDecorator(this); - if (IsFocus()) { - int32 index = PositionInStack(); - decorator->SetFocus(index, true); - } - } - fLook = look; fContentRegionValid = false; @@ -1231,6 +1221,20 @@ Window::SetLook(window_look look, BRegion* updateRegion) // ...and therefor the drawing region is // likely not valid anymore either + if (fCurrentStack.Get() == NULL) + return; + + ::Decorator* decorator = Decorator(); + if (decorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) { + // we need a new decorator + decorator = gDecorManager.AllocateDecorator(this); + fCurrentStack->SetDecorator(decorator); + if (IsFocus()) { + int32 index = PositionInStack(); + decorator->SetFocus(index, true); + } + } + if (decorator != NULL) { DesktopSettings settings(fDesktop); decorator->SetLook(settings, look, updateRegion); @@ -1241,7 +1245,7 @@ Window::SetLook(window_look look, BRegion* updateRegion) _ObeySizeLimits(); } - if (look == B_NO_BORDER_WINDOW_LOOK && fCurrentStack.Get() != NULL) { + if (look == B_NO_BORDER_WINDOW_LOOK) { // we don't need a decorator for this window fCurrentStack->SetDecorator(NULL); } @@ -2152,7 +2156,7 @@ Window::StackedWindowAt(const BPoint& where) { ::Decorator* decorator = Decorator(); if (decorator == NULL) - return NULL; + return this; int tab = decorator->TabAt(where); // if we have a decorator we also have a stack From 7c5525e83489cc80600bc31d1a8be774bccd34c0 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 04:37:27 +0000 Subject: [PATCH 048/702] Only allow windows with a normal thick border to S&T. Fixes #6647. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42492 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../decorators/SATDecorator/SATWindow.cpp | 8 +++++ .../decorators/SATDecorator/SATWindow.h | 1 + .../decorators/SATDecorator/StackAndTile.cpp | 13 ++++++-- .../decorators/SATDecorator/StackAndTile.h | 5 +-- .../decorators/SATDecorator/Stacking.cpp | 29 +++++++++++++++++ .../decorators/SATDecorator/Stacking.h | 3 +- .../decorators/SATDecorator/Tiling.cpp | 32 +++++++++++++++++++ src/add-ons/decorators/SATDecorator/Tiling.h | 3 ++ src/servers/app/Desktop.cpp | 2 ++ src/servers/app/DesktopListener.cpp | 13 ++++++++ src/servers/app/DesktopListener.h | 4 +++ src/servers/app/Window.cpp | 3 +- 12 files changed, 110 insertions(+), 6 deletions(-) diff --git a/src/add-ons/decorators/SATDecorator/SATWindow.cpp b/src/add-ons/decorators/SATDecorator/SATWindow.cpp index 5c6b43c719..a1846d0810 100644 --- a/src/add-ons/decorators/SATDecorator/SATWindow.cpp +++ b/src/add-ons/decorators/SATDecorator/SATWindow.cpp @@ -427,6 +427,14 @@ SATWindow::RemovedFromArea(WindowArea* area) } +void +SATWindow::WindowLookChanged(window_look look) +{ + for (int i = 0; i < fSATSnappingBehaviourList.CountItems(); i++) + fSATSnappingBehaviourList.ItemAt(i)->WindowLookChanged(look); +} + + void SATWindow::FindSnappingCandidates() { diff --git a/src/add-ons/decorators/SATDecorator/SATWindow.h b/src/add-ons/decorators/SATDecorator/SATWindow.h index e322b0d459..5de5990fc8 100644 --- a/src/add-ons/decorators/SATDecorator/SATWindow.h +++ b/src/add-ons/decorators/SATDecorator/SATWindow.h @@ -99,6 +99,7 @@ public: bool RemovedFromGroup(SATGroup* group, bool stayBelowMouse); void RemovedFromArea(WindowArea* area); + void WindowLookChanged(window_look look); bool StackWindow(SATWindow* child); diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp index 32a6f5be73..b2a4ef1625 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp @@ -382,10 +382,19 @@ StackAndTile::SizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, void StackAndTile::WindowLookChanged(Window* window, window_look look) { - // if the decorator has been removed remove it from the stacking group - if (look != B_NO_BORDER_WINDOW_LOOK) + SATWindow* satWindow = GetSATWindow(window); + if (!satWindow) return; + satWindow->WindowLookChanged(look); +} + +void +StackAndTile::WindowFeelChanged(Window* window, window_feel feel) +{ + // check if it is still a compatible feel + if (feel != B_NORMAL_WINDOW_FEEL) + return; SATWindow* satWindow = GetSATWindow(window); if (!satWindow) return; diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.h b/src/add-ons/decorators/SATDecorator/StackAndTile.h index ee701c66c3..198fe655cf 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.h +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.h @@ -80,6 +80,8 @@ public: int32 minHeight, int32 maxHeight); virtual void WindowLookChanged(Window* window, window_look look); + virtual void WindowFeelChanged(Window* window, + window_feel feel); virtual bool SetDecoratorSettings(Window* window, const BMessage& settings); @@ -166,8 +168,7 @@ public: /*! Update the window tab values, solve the layout and move all windows in the group accordantly. */ virtual void RemovedFromArea(WindowArea* area) {} - virtual void TabLocationMoved(float location, bool shifting) - {} + virtual void WindowLookChanged(window_look look) {} }; diff --git a/src/add-ons/decorators/SATDecorator/Stacking.cpp b/src/add-ons/decorators/SATDecorator/Stacking.cpp index bad0324c5c..15392c2ce8 100644 --- a/src/add-ons/decorators/SATDecorator/Stacking.cpp +++ b/src/add-ons/decorators/SATDecorator/Stacking.cpp @@ -239,6 +239,9 @@ SATStacking::FindSnappingCandidates(SATGroup* group) Window* win = satWindow->GetWindow(); if (win == window || !win->Decorator()) continue; + if (_IsStackableWindow(win) == false + || _IsStackableWindow(window) == false) + continue; Decorator::Tab* tab = win->Decorator()->TabAt(win->PositionInStack()); if (tab == NULL) continue; @@ -276,6 +279,32 @@ SATStacking::RemovedFromArea(WindowArea* area) } +void +SATStacking::WindowLookChanged(window_look look) +{ + Window* window = fSATWindow->GetWindow(); + WindowStack* stack = window->GetWindowStack(); + if (stack == NULL) + return; + SATGroup* group = fSATWindow->GetGroup(); + if (group == NULL) + return; + if (stack->CountWindows() > 1 && _IsStackableWindow(window) == false) + group->RemoveWindow(fSATWindow); +} + + +bool +SATStacking::_IsStackableWindow(Window* window) +{ + if (window->Look() == B_DOCUMENT_WINDOW_LOOK) + return true; + if (window->Look() == B_TITLED_WINDOW_LOOK) + return true; + return false; +} + + void SATStacking::_ClearSearchResult() { diff --git a/src/add-ons/decorators/SATDecorator/Stacking.h b/src/add-ons/decorators/SATDecorator/Stacking.h index 6934ba36ae..c5b7ad3c87 100644 --- a/src/add-ons/decorators/SATDecorator/Stacking.h +++ b/src/add-ons/decorators/SATDecorator/Stacking.h @@ -34,8 +34,9 @@ public: void DoWindowLayout(); void RemovedFromArea(WindowArea* area); - + void WindowLookChanged(window_look look); private: + bool _IsStackableWindow(Window* window); void _ClearSearchResult(); void _HighlightWindows(bool highlight = true); diff --git a/src/add-ons/decorators/SATDecorator/Tiling.cpp b/src/add-ons/decorators/SATDecorator/Tiling.cpp index 4e63655656..57b1c2d703 100644 --- a/src/add-ons/decorators/SATDecorator/Tiling.cpp +++ b/src/add-ons/decorators/SATDecorator/Tiling.cpp @@ -46,6 +46,10 @@ SATTiling::FindSnappingCandidates(SATGroup* group) { _ResetSearchResults(); + if (_IsTileableWindow(fSATWindow->GetWindow()) == false + || (group->CountItems() == 1 + && _IsTileableWindow(group->WindowAt(0)->GetWindow()) == false)) + return false; if (fSATWindow->GetGroup() == group) return false; @@ -78,6 +82,34 @@ SATTiling::JoinCandidates() } +void +SATTiling::WindowLookChanged(window_look look) +{ + SATGroup* group = fSATWindow->GetGroup(); + if (group == NULL) + return; + if (_IsTileableWindow(fSATWindow->GetWindow()) == false) + group->RemoveWindow(fSATWindow); +} + + +bool +SATTiling::_IsTileableWindow(Window* window) +{ + if (window->Look() == B_DOCUMENT_WINDOW_LOOK) + return true; + if (window->Look() == B_TITLED_WINDOW_LOOK) + return true; + if (window->Look() == B_FLOATING_WINDOW_LOOK) + return true; + if (window->Look() == B_MODAL_WINDOW_LOOK) + return true; + if (window->Look() == B_BORDERED_WINDOW_LOOK) + return true; + return false; +} + + bool SATTiling::_FindFreeAreaInGroup(SATGroup* group) { diff --git a/src/add-ons/decorators/SATDecorator/Tiling.h b/src/add-ons/decorators/SATDecorator/Tiling.h index 08c555c539..1eeeb47f3d 100644 --- a/src/add-ons/decorators/SATDecorator/Tiling.h +++ b/src/add-ons/decorators/SATDecorator/Tiling.h @@ -25,7 +25,10 @@ public: bool FindSnappingCandidates(SATGroup* group); bool JoinCandidates(); + void WindowLookChanged(window_look look); private: + bool _IsTileableWindow(Window* window); + bool _FindFreeAreaInGroup(SATGroup* group); bool _FindFreeAreaInGroup(SATGroup* group, Corner::position_t corner); diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index a0abb3a4c2..b99e446d42 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1724,6 +1724,8 @@ Desktop::SetWindowFeel(Window* window, window_feel newFeel) if (window == FocusWindow() && !window->IsVisible()) SetFocusWindow(); + NotifyWindowFeelChanged(window, newFeel); + UnlockAllWindows(); } diff --git a/src/servers/app/DesktopListener.cpp b/src/servers/app/DesktopListener.cpp index 37cc38b8ee..b87e975dda 100644 --- a/src/servers/app/DesktopListener.cpp +++ b/src/servers/app/DesktopListener.cpp @@ -284,6 +284,19 @@ DesktopObservable::NotifyWindowLookChanged(Window* window, window_look look) } +void +DesktopObservable::NotifyWindowFeelChanged(Window* window, window_feel feel) +{ + if (fWeAreInvoking) + return; + InvokeGuard invokeGuard(fWeAreInvoking); + + for (DesktopListener* listener = fDesktopListenerList.First(); + listener != NULL; listener = fDesktopListenerList.GetNext(listener)) + listener->WindowFeelChanged(window, feel); +} + + bool DesktopObservable::SetDecoratorSettings(Window* window, const BMessage& settings) diff --git a/src/servers/app/DesktopListener.h b/src/servers/app/DesktopListener.h index 1b89b9da08..0a257dce31 100644 --- a/src/servers/app/DesktopListener.h +++ b/src/servers/app/DesktopListener.h @@ -65,6 +65,8 @@ public: int32 minHeight, int32 maxHeight) = 0; virtual void WindowLookChanged(Window* window, window_look look) = 0; + virtual void WindowFeelChanged(Window* window, + window_feel feel) = 0; virtual bool SetDecoratorSettings(Window* window, const BMessage& settings) = 0; @@ -119,6 +121,8 @@ public: int32 minHeight, int32 maxHeight); void NotifyWindowLookChanged(Window* window, window_look look); + void NotifyWindowFeelChanged(Window* window, + window_feel feel); bool SetDecoratorSettings(Window* window, const BMessage& settings); diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index d8b9bdd552..b4a5c62ab6 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -2100,6 +2100,8 @@ Window::DetachFromWindowStack(bool ownStackNeeded) decorator->SetDrawingEngine(remainingTop->fDrawingEngine); // propagate focus to the decorator remainingTop->SetFocus(remainingTop->IsFocus()); + remainingTop->SetFeel(remainingTop->Feel()); + remainingTop->SetLook(remainingTop->Look(), &dirty); } fCurrentStack = NULL; @@ -2185,7 +2187,6 @@ Window::GetWindowStack() } - bool Window::MoveToTopStackLayer() { From 86b010824cfcf9923573ca68850fd26a71eeb0bc Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 05:53:35 +0000 Subject: [PATCH 049/702] * Draw the complete decorator off screen and copy it to the front when finished. Stippi please take a look. This fixes some flickering when drawing shifted tabs in stack mode. In stack mode the different tabs sometime repaint each other, thus the decorator has to been drawn double buffered to avoid artefacts. * Add an option to draw the button directly, i.e. when they are clicked. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42493 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 3 ++- src/servers/app/decorator/Decorator.cpp | 16 ++++++++-------- src/servers/app/decorator/Decorator.h | 10 +++++++--- .../app/decorator/DefaultDecorator.cpp | 19 ++++++++++--------- src/servers/app/decorator/DefaultDecorator.h | 11 +++++++---- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index b4a5c62ab6..d1fb9c9746 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -1761,11 +1761,12 @@ Window::_DrawBorder() if (dirtyBorderRegion->CountRects() > 0 && engine->LockParallelAccess()) { engine->ConstrainClippingRegion(dirtyBorderRegion); bool copyToFrontEnabled = engine->CopyToFrontEnabled(); - engine->SetCopyToFrontEnabled(true); + engine->SetCopyToFrontEnabled(false); decorator->Draw(dirtyBorderRegion->Frame()); engine->SetCopyToFrontEnabled(copyToFrontEnabled); + engine->CopyToFront(*dirtyBorderRegion); // TODO: remove this once the DrawState stuff is handled // more cleanly. The reason why this is needed is that diff --git a/src/servers/app/decorator/Decorator.cpp b/src/servers/app/decorator/Decorator.cpp index 837a2f9e93..765b672a90 100644 --- a/src/servers/app/decorator/Decorator.cpp +++ b/src/servers/app/decorator/Decorator.cpp @@ -651,10 +651,10 @@ Decorator::DrawTab(int32 tabIndex) return; _DrawTab(tab, tab->tabRect); - _DrawZoom(tab, tab->zoomRect); - _DrawMinimize(tab, tab->minimizeRect); + _DrawZoom(tab, false, tab->zoomRect); + _DrawMinimize(tab, false, tab->minimizeRect); _DrawTitle(tab, tab->tabRect); - _DrawClose(tab, tab->closeRect); + _DrawClose(tab, false, tab->closeRect); } @@ -665,7 +665,7 @@ Decorator::DrawClose(int32 tab) Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); if (decoratorTab == NULL) return; - _DrawClose(decoratorTab, decoratorTab->closeRect); + _DrawClose(decoratorTab, true, decoratorTab->closeRect); } @@ -698,7 +698,7 @@ Decorator::DrawZoom(int32 tab) Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); if (decoratorTab == NULL) return; - _DrawZoom(decoratorTab, decoratorTab->zoomRect); + _DrawZoom(decoratorTab, true, decoratorTab->zoomRect); } @@ -779,7 +779,7 @@ Decorator::_DrawTab(Decorator::Tab* tab, BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawClose(Decorator::Tab* tab, BRect rect) +Decorator::_DrawClose(Decorator::Tab* tab, bool direct, BRect rect) { } @@ -807,7 +807,7 @@ Decorator::_DrawTitle(Decorator::Tab* tab, BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawZoom(Decorator::Tab* tab, BRect rect) +Decorator::_DrawZoom(Decorator::Tab* tab, bool direct, BRect rect) { } @@ -820,7 +820,7 @@ Decorator::_DrawZoom(Decorator::Tab* tab, BRect rect) \param rect Area of the button to update */ void -Decorator::_DrawMinimize(Decorator::Tab* tab, BRect rect) +Decorator::_DrawMinimize(Decorator::Tab* tab, bool direct, BRect rect) { } diff --git a/src/servers/app/decorator/Decorator.h b/src/servers/app/decorator/Decorator.h index 66451ec334..4df65ada0d 100644 --- a/src/servers/app/decorator/Decorator.h +++ b/src/servers/app/decorator/Decorator.h @@ -173,10 +173,14 @@ protected: virtual void _DrawTabs(BRect rect); virtual void _DrawTab(Decorator::Tab* tab, BRect rect); - virtual void _DrawClose(Decorator::Tab* tab, BRect rect); virtual void _DrawTitle(Decorator::Tab* tab, BRect rect); - virtual void _DrawZoom(Decorator::Tab* tab, BRect rect); - virtual void _DrawMinimize(Decorator::Tab* tab, BRect rect); + //! direct means drawing without double buffering + virtual void _DrawClose(Decorator::Tab* tab, bool direct, + BRect rect); + virtual void _DrawZoom(Decorator::Tab* tab, bool direct, + BRect rect); + virtual void _DrawMinimize(Decorator::Tab* tab, bool direct, + BRect rect); virtual Decorator::Tab* _AllocateNewTab() = 0; diff --git a/src/servers/app/decorator/DefaultDecorator.cpp b/src/servers/app/decorator/DefaultDecorator.cpp index fe0fb01dad..41d49c36f5 100644 --- a/src/servers/app/decorator/DefaultDecorator.cpp +++ b/src/servers/app/decorator/DefaultDecorator.cpp @@ -952,7 +952,7 @@ DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid) void -DefaultDecorator::_DrawClose(Decorator::Tab* _tab, BRect rect) +DefaultDecorator::_DrawClose(Decorator::Tab* _tab, bool direct, BRect rect) { STRACE(("_DrawClose(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right, rect.bottom)); @@ -967,7 +967,7 @@ DefaultDecorator::_DrawClose(Decorator::Tab* _tab, BRect rect) tab->closeBitmaps[index] = bitmap; } - _DrawButtonBitmap(bitmap, rect); + _DrawButtonBitmap(bitmap, direct, rect); } @@ -1016,7 +1016,7 @@ DefaultDecorator::_DrawTitle(Decorator::Tab* _tab, BRect r) void -DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, BRect rect) +DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, bool direct, BRect rect) { STRACE(("_DrawZoom(%f,%f,%f,%f)\n", rect.left, rect.top, rect.right, rect.bottom)); @@ -1032,7 +1032,7 @@ DefaultDecorator::_DrawZoom(Decorator::Tab* _tab, BRect rect) tab->zoomBitmaps[index] = bitmap; } - _DrawButtonBitmap(bitmap, rect); + _DrawButtonBitmap(bitmap, direct, rect); } @@ -1397,7 +1397,7 @@ DefaultDecorator::_AddTab(int32 index, BRegion* updateRegion) bool -DefaultDecorator::_RemoveTab(int32 index, BRegion* updateRegion ) +DefaultDecorator::_RemoveTab(int32 index, BRegion* updateRegion) { BRect oldTitle = fTitleBarRect; _DoLayout(); @@ -1475,9 +1475,9 @@ DefaultDecorator::DrawButtons(Decorator::Tab* tab, const BRect& invalid) { // Draw the buttons if we're supposed to if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect)) - _DrawClose(tab, tab->closeRect); + _DrawClose(tab, false, tab->closeRect); if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect)) - _DrawZoom(tab, tab->zoomRect); + _DrawZoom(tab, false, tab->zoomRect); } @@ -1574,13 +1574,14 @@ DefaultDecorator::_UpdateFont(DesktopSettings& settings) void -DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect) +DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, bool direct, + BRect rect) { if (bitmap == NULL) return; bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled(); - fDrawingEngine->SetCopyToFrontEnabled(true); + fDrawingEngine->SetCopyToFrontEnabled(direct); drawing_mode oldMode; fDrawingEngine->SetDrawingMode(B_OP_OVER, oldMode); fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); diff --git a/src/servers/app/decorator/DefaultDecorator.h b/src/servers/app/decorator/DefaultDecorator.h index 8bf3b07007..2297374494 100644 --- a/src/servers/app/decorator/DefaultDecorator.h +++ b/src/servers/app/decorator/DefaultDecorator.h @@ -113,11 +113,14 @@ protected: virtual void _DrawFrame(BRect r); virtual void _DrawTab(Decorator::Tab* tab, BRect r); - virtual void _DrawClose(Decorator::Tab* tab, BRect r); + virtual void _DrawClose(Decorator::Tab* tab, bool direct, + BRect r); virtual void _DrawTitle(Decorator::Tab* tab, BRect r); - virtual void _DrawZoom(Decorator::Tab* tab, BRect r); + virtual void _DrawZoom(Decorator::Tab* tab, bool direct, + BRect r); - virtual void _SetTitle(Decorator::Tab* tab, const char* string, + virtual void _SetTitle(Decorator::Tab* tab, + const char* string, BRegion* updateRegion = NULL); virtual void _SetFocus(Decorator::Tab* tab); @@ -162,7 +165,7 @@ protected: private: void _UpdateFont(DesktopSettings& settings); void _DrawButtonBitmap(ServerBitmap* bitmap, - BRect rect); + bool direct, BRect rect); void _DrawBlendedRect(DrawingEngine *engine, BRect rect, bool down, const ComponentColors& colors); From b7b6df07b845c49a49c4c157dcf306771e066f54 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 06:15:41 +0000 Subject: [PATCH 050/702] When closing a window the window can't redraw the dirty region anymore. Mark the region of the remaining window dirty. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42494 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index d1fb9c9746..ac4010afe6 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -2111,10 +2111,10 @@ Window::DetachFromWindowStack(bool ownStackNeeded) // propagate focus to the new decorator SetFocus(IsFocus()); - fDesktop->RebuildAndRedrawAfterWindowChange(this, dirty); - if (remainingTop != NULL) - fDesktop->MarkDirty(remainingTop->VisibleRegion()); - + if (remainingTop != NULL) { + dirty.Include(&remainingTop->VisibleRegion()); + fDesktop->RebuildAndRedrawAfterWindowChange(remainingTop, dirty); + } return true; } From 4154a161ede188216241ef4c8970ae27bdcc083b Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 06:34:34 +0000 Subject: [PATCH 051/702] Set the top tab every time when adding a new tab. This draws newly stacked tabs correctly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42495 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/decorator/Decorator.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/servers/app/decorator/Decorator.cpp b/src/servers/app/decorator/Decorator.cpp index 765b672a90..cd33cd6d37 100644 --- a/src/servers/app/decorator/Decorator.cpp +++ b/src/servers/app/decorator/Decorator.cpp @@ -106,8 +106,7 @@ Decorator::AddTab(const char* title, int32 index, BRegion* updateRegion) return NULL; } - if (fTopTab == NULL) - fTopTab = tab; + fTopTab = tab; _InvalidateFootprint(); return tab; From b9bedde479b543dc53b5c4de100af2d4722419fd Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 06:49:16 +0000 Subject: [PATCH 052/702] Assert the right lock, thanks Axel. Some clean up. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42496 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/MessageLooper.cpp | 6 ++++-- src/servers/app/Workspace.cpp | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/servers/app/MessageLooper.cpp b/src/servers/app/MessageLooper.cpp index 6bcc540756..507092da50 100644 --- a/src/servers/app/MessageLooper.cpp +++ b/src/servers/app/MessageLooper.cpp @@ -9,13 +9,15 @@ #include "MessageLooper.h" -#include #include #include +#include + MessageLooper::MessageLooper(const char* name) - : BLocker(name), + : + BLocker(name), fThread(-1), fQuitting(false), fDeathSemaphore(-1) diff --git a/src/servers/app/Workspace.cpp b/src/servers/app/Workspace.cpp index 887ee6cfb4..b2aa0ff25b 100644 --- a/src/servers/app/Workspace.cpp +++ b/src/servers/app/Workspace.cpp @@ -7,15 +7,18 @@ */ -#include "Desktop.h" #include "Workspace.h" -#include "WorkspacePrivate.h" -#include "Window.h" #include #include #include +#include + +#include "Desktop.h" +#include "WorkspacePrivate.h" +#include "Window.h" + static rgb_color kDefaultColor = (rgb_color){ 51, 102, 152, 255 }; @@ -82,6 +85,7 @@ Workspace::Workspace(Desktop& desktop, int32 index) fDesktop(desktop), fCurrentWorkspace(index == desktop.CurrentWorkspace()) { + ASSERT(desktop.IsLocked()); RewindWindows(); } From bf0e980dc49bf12b69fcb31f7183c45f81134bcd Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 26 Jul 2011 15:09:18 +0000 Subject: [PATCH 053/702] * Fix a few style issues as per Axel * Rename a few variables to make more sense * OF_FAILED is a signed int.. fix return of of_address_cells * OF_FAILED is a signed int.. fix return of of_size_cells git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42497 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../platform/openfirmware/openfirmware.h | 5 +-- .../platform/openfirmware/arch/ppc/mmu.cpp | 36 +++++++++++-------- .../boot/platform/openfirmware/of_support.cpp | 4 +-- .../boot/platform/openfirmware/of_support.h | 4 +-- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/headers/private/kernel/platform/openfirmware/openfirmware.h b/headers/private/kernel/platform/openfirmware/openfirmware.h index 7510425db8..3fe2c30d84 100644 --- a/headers/private/kernel/platform/openfirmware/openfirmware.h +++ b/headers/private/kernel/platform/openfirmware/openfirmware.h @@ -11,13 +11,14 @@ #define OF_FAILED (-1) + /* global device tree/properties access */ extern int gChosen; -template +template struct of_region { - addressSize base; + AddressSize base; uint32 size; }; diff --git a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp index b3111e8176..345a45e0cf 100644 --- a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp +++ b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp @@ -1,6 +1,11 @@ /* * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de. - * Distributed under the terms of the MIT License. + * Copyright 2010-2011, Haiku, Inc. All Rights Reserved. + * All rights reserved. Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de. + * Alexander von Gluck, kallisti5@unixzen.com */ @@ -19,6 +24,7 @@ #include "of_support.h" + // set protection to WIMGNPP: -----PP // PP: 00 - no access // 01 - read only @@ -78,28 +84,28 @@ find_physical_memory_ranges(size_t &total) total = 0; - /* Memory base addresses are provided in 32 or 64 bit flavors - #address-cells and #size-cells matches the number of 32-bit 'cells' - representing the length of the base address and size fields - */ + // Memory base addresses are provided in 32 or 64 bit flavors + // #address-cells and #size-cells matches the number of 32-bit 'cells' + // representing the length of the base address and size fields int root = of_finddevice("/"); - int regAddressCount = of_address_cells(root); - int regSizeCount = of_size_cells(root); - if (regAddressCount == OF_FAILED || regSizeCount == OF_FAILED) { + int32 regAddressCells = of_address_cells(root); + int32 regSizeCells = of_size_cells(root); + if (regAddressCells == OF_FAILED || regSizeCells == OF_FAILED) { dprintf("finding base/size length counts failed, assume 32-bit.\n"); - regAddressCount = 1; - regSizeCount = 1; + regAddressCells = 1; + regSizeCells = 1; } - dprintf("memory range address cells: %d; size cells: %d;\n", - regAddressCount, regSizeCount); - if (regAddressCount > 2 || regSizeCount > 1) { - dprintf("Unsupported cell size detected. (machine is > 64bit?).\n"); + // NOTE : Size Cells of 2 is possible in theory... but I haven't seen it yet. + if (regAddressCells > 2 || regSizeCells > 1) { + panic("%s: Unsupported OpenFirmware cell count detected.\n" + "Address Cells: %" B_PRId32 "; Size Cells: %" B_PRId32 + " (CPU > 64bit?).\n", __func__, regAddressCells, regSizeCells); return B_ERROR; } // On 64-bit PowerPC systems (G5), our mem base range address is larger - if (regAddressCount == 2) { + if (regAddressCells == 2) { struct of_region regions[64]; int count = of_getprop(package, "reg", regions, sizeof(regions)); if (count == OF_FAILED) diff --git a/src/system/boot/platform/openfirmware/of_support.cpp b/src/system/boot/platform/openfirmware/of_support.cpp index 545e952f3f..6c6d033b88 100644 --- a/src/system/boot/platform/openfirmware/of_support.cpp +++ b/src/system/boot/platform/openfirmware/of_support.cpp @@ -25,7 +25,7 @@ system_time(void) + in the reg property + */ -uint32 +int32 of_address_cells(int package) { uint32 address_cells; if (of_getprop(package, "#address-cells", @@ -36,7 +36,7 @@ of_address_cells(int package) { } -uint32 +int32 of_size_cells(int package) { uint32 size_cells; if (of_getprop(package, "#size-cells", diff --git a/src/system/boot/platform/openfirmware/of_support.h b/src/system/boot/platform/openfirmware/of_support.h index a7667ec396..d7e0c66d27 100644 --- a/src/system/boot/platform/openfirmware/of_support.h +++ b/src/system/boot/platform/openfirmware/of_support.h @@ -13,7 +13,7 @@ bigtime_t system_time(void); -uint32 of_address_cells(int package); -uint32 of_size_cells(int package); +int32 of_address_cells(int package); +int32 of_size_cells(int package); #endif From 40a5a5a0ac071efdbd7cab48c642fc805fc420f4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 26 Jul 2011 16:42:14 +0000 Subject: [PATCH 054/702] * Rename of_region type template as per Axel * Rename of_support.h/cpp back to support.cpp as per Axel git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42498 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/platform/openfirmware/openfirmware.h | 4 ++-- src/system/boot/platform/openfirmware/Jamfile | 2 +- src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp | 2 +- .../platform/openfirmware/{of_support.cpp => support.cpp} | 2 +- .../boot/platform/openfirmware/{of_support.h => support.h} | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) rename src/system/boot/platform/openfirmware/{of_support.cpp => support.cpp} (97%) rename src/system/boot/platform/openfirmware/{of_support.h => support.h} (88%) diff --git a/headers/private/kernel/platform/openfirmware/openfirmware.h b/headers/private/kernel/platform/openfirmware/openfirmware.h index 3fe2c30d84..e5ebf77ddd 100644 --- a/headers/private/kernel/platform/openfirmware/openfirmware.h +++ b/headers/private/kernel/platform/openfirmware/openfirmware.h @@ -16,9 +16,9 @@ extern int gChosen; -template +template struct of_region { - AddressSize base; + AddressType base; uint32 size; }; diff --git a/src/system/boot/platform/openfirmware/Jamfile b/src/system/boot/platform/openfirmware/Jamfile index 322ab3bea5..227df039bf 100644 --- a/src/system/boot/platform/openfirmware/Jamfile +++ b/src/system/boot/platform/openfirmware/Jamfile @@ -17,7 +17,7 @@ KernelMergeObject boot_platform_openfirmware.o : network.cpp real_time_clock.cpp start.cpp - of_support.cpp + support.cpp video.cpp openfirmware.cpp diff --git a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp index 345a45e0cf..0d3e0d2810 100644 --- a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp +++ b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp @@ -22,7 +22,7 @@ #include #include -#include "of_support.h" +#include "support.h" // set protection to WIMGNPP: -----PP diff --git a/src/system/boot/platform/openfirmware/of_support.cpp b/src/system/boot/platform/openfirmware/support.cpp similarity index 97% rename from src/system/boot/platform/openfirmware/of_support.cpp rename to src/system/boot/platform/openfirmware/support.cpp index 6c6d033b88..9c9a101f1f 100644 --- a/src/system/boot/platform/openfirmware/of_support.cpp +++ b/src/system/boot/platform/openfirmware/support.cpp @@ -9,7 +9,7 @@ */ -#include "of_support.h" +#include "support.h" #include diff --git a/src/system/boot/platform/openfirmware/of_support.h b/src/system/boot/platform/openfirmware/support.h similarity index 88% rename from src/system/boot/platform/openfirmware/of_support.h rename to src/system/boot/platform/openfirmware/support.h index d7e0c66d27..afdae7c48b 100644 --- a/src/system/boot/platform/openfirmware/of_support.h +++ b/src/system/boot/platform/openfirmware/support.h @@ -5,8 +5,8 @@ * Authors: * Alexander von Gluck, kallisti5@unixzen.com */ -#ifndef OF_SUPPORT_H -#define OF_SUPPORT_H +#ifndef SUPPORT_H +#define SUPPORT_H #include From 271ed0f390856a6aecf3fcc82b22fde20373105e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 26 Jul 2011 18:27:39 +0000 Subject: [PATCH 055/702] * Fix improper sizeof, CID 10628 * Improve malloc check to look for NULL, CID 10698 * Remove unused size_t git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42499 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/wimax/usb_beceemwmx/BeceemDevice.cpp | 10 ++++------ .../drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp index a73c192661..ac1f0ac681 100644 --- a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp +++ b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp @@ -270,15 +270,15 @@ BeceemDevice::~BeceemDevice() if (fNotifyWriteSem >= B_OK) delete_sem(fNotifyWriteSem); - if (fNotifyBuffer) + if (fNotifyBuffer != NULL) free(fNotifyBuffer); // Free notification buffer - if (pwmxdevice->nvmFlashCSInfo) + if (pwmxdevice->nvmFlashCSInfo != NULL) free(pwmxdevice->nvmFlashCSInfo); // Free flash configuration structure - if (pwmxdevice) + if (pwmxdevice != NULL) free(pwmxdevice); // Free malloc of wimax device struct @@ -1017,7 +1017,7 @@ BeceemDevice::LoadConfig() unsigned int* buffer = (unsigned int*)malloc(MAX_USB_TRANSFER); - if (!buffer) { + if (buffer == NULL) { TRACE_ALWAYS("Error: Memory allocation error.\n"); return B_ERROR; } @@ -1119,8 +1119,6 @@ BeceemDevice::PushConfig(unsigned int loc) return fh; } - size_t file_size = cfgStat.st_size; - TRACE_ALWAYS("Info: Vendor configuration to be pushed to 0x%x on device.\n", loc); diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp index 987e83cca4..8e98119775 100644 --- a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp +++ b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp @@ -501,7 +501,7 @@ BeceemNVM::FlashBulkRead(unsigned int offset, unsigned int size, if (pwmxdevice->driverHalt == true) return -ENODEV; - if (size > sizeof(&buffer)) + if (size > sizeof(buffer)) TRACE("Warning: Reading more then the buffer can handle\n"); bSelectedChip = RESET_CHIP_SELECT; From 659fefbd43508e69d233ae845a5f9b0e3088f150 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 26 Jul 2011 18:36:49 +0000 Subject: [PATCH 056/702] * Insert missing case break, CID 10659 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42500 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp index 187f41c94f..85307b3d04 100644 --- a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp +++ b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp @@ -171,6 +171,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) default: return -EINVAL; } + break; case 0xbece0310: { switch (vendorDDRSetting) { From 6a0ed7da5303f3389cf954b24eda4c179f6a0a72 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 22:18:55 +0000 Subject: [PATCH 057/702] Move S&T back into the app server. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42501 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 3 +- src/add-ons/decorators/Jamfile | 1 - .../decorators/SATDecorator/resources.rdef | 11 ------ src/servers/app/Desktop.cpp | 2 + src/servers/app/Desktop.h | 4 ++ src/servers/app/Jamfile | 5 ++- .../app/StackAndTile}/Jamfile | 13 +------ .../app/StackAndTile}/SATDecorator.cpp | 39 ------------------- .../app/StackAndTile}/SATDecorator.h | 16 -------- .../app/StackAndTile}/SATGroup.cpp | 2 + .../app/StackAndTile}/SATGroup.h | 0 .../app/StackAndTile}/SATWindow.cpp | 1 + .../app/StackAndTile}/SATWindow.h | 0 .../app/StackAndTile}/StackAndTile.cpp | 0 .../app/StackAndTile}/StackAndTile.h | 7 ++-- .../app/StackAndTile}/Stacking.cpp | 1 + .../app/StackAndTile}/Stacking.h | 0 .../app/StackAndTile}/Tiling.cpp | 0 .../app/StackAndTile}/Tiling.h | 1 + src/servers/app/decorator/DecorManager.cpp | 8 ++-- 20 files changed, 26 insertions(+), 88 deletions(-) delete mode 100644 src/add-ons/decorators/SATDecorator/resources.rdef rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/Jamfile (70%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/SATDecorator.cpp (83%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/SATDecorator.h (72%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/SATGroup.cpp (99%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/SATGroup.h (100%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/SATWindow.cpp (99%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/SATWindow.h (100%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/StackAndTile.cpp (100%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/StackAndTile.h (97%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/Stacking.cpp (99%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/Stacking.h (100%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/Tiling.cpp (100%) rename src/{add-ons/decorators/SATDecorator => servers/app/StackAndTile}/Tiling.h (98%) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index b030c41b73..081ce99546 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -588,8 +588,7 @@ AddFilesToHaikuImage system add-ons disk_systems # decorators AddDirectoryToHaikuImage home config add-ons decorators ; -AddFilesToHaikuImage home config add-ons decorators : - SATDecorator ; +#AddFilesToHaikuImage home config add-ons decorators : ; # create directories that will remain empty AddDirectoryToHaikuImage common bin ; diff --git a/src/add-ons/decorators/Jamfile b/src/add-ons/decorators/Jamfile index 44a74fc734..c6e86651da 100644 --- a/src/add-ons/decorators/Jamfile +++ b/src/add-ons/decorators/Jamfile @@ -3,4 +3,3 @@ SubDir HAIKU_TOP src add-ons decorators ; SubInclude HAIKU_TOP src add-ons decorators BeDecorator ; SubInclude HAIKU_TOP src add-ons decorators MacDecorator ; SubInclude HAIKU_TOP src add-ons decorators WinDecorator ; -SubInclude HAIKU_TOP src add-ons decorators SATDecorator ; \ No newline at end of file diff --git a/src/add-ons/decorators/SATDecorator/resources.rdef b/src/add-ons/decorators/SATDecorator/resources.rdef deleted file mode 100644 index 3ceacd091c..0000000000 --- a/src/add-ons/decorators/SATDecorator/resources.rdef +++ /dev/null @@ -1,11 +0,0 @@ -resource("be:decor:info") message('deco') { - "name" = "Stack and Tile", - "authors" = "Clemens Zeidler, Ingo Weinhold", - "short_descr" = "Default look with ability to stack & tile windows.", - "long_descr" = "Group windows together and take advantage of those" - " tabs!\n\nTODO: instructions", - "lic_url" = "", - "lic_name" = "MIT", - "support_url" = "http://www.haiku-os.org/", - float "version" = 1.0 -}; diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index b99e446d42..d7c3e46690 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -449,6 +449,8 @@ Desktop::Desktop(uid_t userID, const char* targetScreen) fLink.SetReceiverPort(fMessagePort); // register listeners + RegisterListener(&fStackAndTile); + const DesktopListenerList& newListeners = gDecorManager.GetDesktopListeners(); for (int i = 0; i < newListeners.CountItems(); i++) diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index 39cb7a5a01..c3682e9a45 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -31,6 +31,7 @@ #include "Screen.h" #include "ScreenManager.h" #include "ServerCursor.h" +#include "StackAndTile.h" #include "VirtualScreen.h" #include "WindowList.h" #include "Workspace.h" @@ -246,6 +247,7 @@ public: Window* WindowForClientLooperPort(port_id port); + StackAndTile* GetStackAndTile() { return &fStackAndTile; } private: WindowList& _Windows(int32 index); @@ -350,6 +352,8 @@ private: Window* fFocus; Window* fFront; Window* fBack; + + StackAndTile fStackAndTile; }; #endif // DESKTOP_H diff --git a/src/servers/app/Jamfile b/src/servers/app/Jamfile index 9514028257..09d5feff2b 100644 --- a/src/servers/app/Jamfile +++ b/src/servers/app/Jamfile @@ -5,6 +5,7 @@ UsePrivateHeaders app graphics input interface kernel shared storage support ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app StackAndTile ] ; UseFreeTypeHeaders ; @@ -80,7 +81,8 @@ Server app_server : : libtranslation.so libbe.so libbnetapi.so libasdrawing.a libasremote.a libpainter.a libagg.a libfreetype.so - libtextencoding.so libshared.a $(TARGET_LIBSTDC++) + StackAndTile.a liblinprog.a libtextencoding.so libshared.a + $(TARGET_LIBSTDC++) : app_server.rdef ; @@ -90,3 +92,4 @@ SEARCH on [ FGristFiles $(font_src) ] = [ FDirName $(HAIKU_TOP) src servers app SubInclude HAIKU_TOP src servers app drawing ; +SubInclude HAIKU_TOP src servers app StackAndTile ; diff --git a/src/add-ons/decorators/SATDecorator/Jamfile b/src/servers/app/StackAndTile/Jamfile similarity index 70% rename from src/add-ons/decorators/SATDecorator/Jamfile rename to src/servers/app/StackAndTile/Jamfile index e83ebf7ef9..b781b141d8 100644 --- a/src/add-ons/decorators/SATDecorator/Jamfile +++ b/src/servers/app/StackAndTile/Jamfile @@ -1,4 +1,4 @@ -SubDir HAIKU_TOP src add-ons decorators SATDecorator ; +SubDir HAIKU_TOP src servers app StackAndTile ; UseLibraryHeaders agg lp_solve linprog ; UsePrivateHeaders app graphics interface shared kernel ; @@ -10,20 +10,11 @@ UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; UseFreeTypeHeaders ; -AddResources SATDecorator : resources.rdef ; - -Addon SATDecorator : +StaticLibrary StackAndTile.a : SATDecorator.cpp SATGroup.cpp SATWindow.cpp StackAndTile.cpp Stacking.cpp Tiling.cpp - - # libraries - : - libbe.so - app_server - $(TARGET_LIBSTDC++) - liblpsolve55.so liblinprog.a ; diff --git a/src/add-ons/decorators/SATDecorator/SATDecorator.cpp b/src/servers/app/StackAndTile/SATDecorator.cpp similarity index 83% rename from src/add-ons/decorators/SATDecorator/SATDecorator.cpp rename to src/servers/app/StackAndTile/SATDecorator.cpp index a5649a20a6..639d452216 100644 --- a/src/add-ons/decorators/SATDecorator/SATDecorator.cpp +++ b/src/servers/app/StackAndTile/SATDecorator.cpp @@ -49,39 +49,6 @@ static const rgb_color kHighlightTabColorShadow = tint_color(kHighlightTabColor, (B_DARKEN_1_TINT + B_NO_TINT) / 2); -SATDecorAddOn::SATDecorAddOn(image_id id, const char* name) - : - DecorAddOn(id, name) -{ - fDesktopListeners.AddItem(&fStackAndTile); -} - - -status_t -SATDecorAddOn::InitCheck() const -{ - if (fDesktopListeners.CountItems() != 1) - return B_ERROR; - - return B_OK; -} - - -WindowBehaviour* -SATDecorAddOn::AllocateWindowBehaviour(Window* window) -{ - return new (std::nothrow)SATWindowBehaviour(window, &fStackAndTile); -} - - -Decorator* -SATDecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect, - window_look look, uint32 flags) -{ - return new (std::nothrow)SATDecorator(settings, rect, look, flags); -} - - SATDecorator::SATDecorator(DesktopSettings& settings, BRect frame, window_look look, uint32 flags) : @@ -175,9 +142,3 @@ SATWindowBehaviour::AlterDeltaForSnap(Window* window, BPoint& delta, return fMagneticBorder.AlterDeltaForSnap(window->Screen(), groupFrame, delta, now); } - - -extern "C" DecorAddOn* (instantiate_decor_addon)(image_id id, const char* name) -{ - return new (std::nothrow)SATDecorAddOn(id, name); -} diff --git a/src/add-ons/decorators/SATDecorator/SATDecorator.h b/src/servers/app/StackAndTile/SATDecorator.h similarity index 72% rename from src/add-ons/decorators/SATDecorator/SATDecorator.h rename to src/servers/app/StackAndTile/SATDecorator.h index 7e5a4c4d0b..6ca099f96d 100644 --- a/src/add-ons/decorators/SATDecorator/SATDecorator.h +++ b/src/servers/app/StackAndTile/SATDecorator.h @@ -15,22 +15,6 @@ #include "StackAndTile.h" -class SATDecorAddOn : public DecorAddOn { -public: - SATDecorAddOn(image_id id, const char* name); - - virtual status_t InitCheck() const; - - virtual WindowBehaviour* AllocateWindowBehaviour(Window* window); - -protected: - virtual Decorator* _AllocateDecorator(DesktopSettings& settings, - BRect rect, window_look look, uint32 flags); - - StackAndTile fStackAndTile; -}; - - class SATDecorator : public DefaultDecorator { public: enum { diff --git a/src/add-ons/decorators/SATDecorator/SATGroup.cpp b/src/servers/app/StackAndTile/SATGroup.cpp similarity index 99% rename from src/add-ons/decorators/SATDecorator/SATGroup.cpp rename to src/servers/app/StackAndTile/SATGroup.cpp index 209afea68c..d434a2ce70 100644 --- a/src/add-ons/decorators/SATDecorator/SATGroup.cpp +++ b/src/servers/app/StackAndTile/SATGroup.cpp @@ -14,6 +14,8 @@ #include #include +#include "Desktop.h" + #include "SATWindow.h" #include "StackAndTile.h" #include "Window.h" diff --git a/src/add-ons/decorators/SATDecorator/SATGroup.h b/src/servers/app/StackAndTile/SATGroup.h similarity index 100% rename from src/add-ons/decorators/SATDecorator/SATGroup.h rename to src/servers/app/StackAndTile/SATGroup.h diff --git a/src/add-ons/decorators/SATDecorator/SATWindow.cpp b/src/servers/app/StackAndTile/SATWindow.cpp similarity index 99% rename from src/add-ons/decorators/SATDecorator/SATWindow.cpp rename to src/servers/app/StackAndTile/SATWindow.cpp index a1846d0810..bf505b0b23 100644 --- a/src/add-ons/decorators/SATDecorator/SATWindow.cpp +++ b/src/servers/app/StackAndTile/SATWindow.cpp @@ -13,6 +13,7 @@ #include "StackAndTilePrivate.h" +#include "Desktop.h" #include "SATGroup.h" #include "ServerApp.h" #include "Window.h" diff --git a/src/add-ons/decorators/SATDecorator/SATWindow.h b/src/servers/app/StackAndTile/SATWindow.h similarity index 100% rename from src/add-ons/decorators/SATDecorator/SATWindow.h rename to src/servers/app/StackAndTile/SATWindow.h diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp b/src/servers/app/StackAndTile/StackAndTile.cpp similarity index 100% rename from src/add-ons/decorators/SATDecorator/StackAndTile.cpp rename to src/servers/app/StackAndTile/StackAndTile.cpp diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.h b/src/servers/app/StackAndTile/StackAndTile.h similarity index 97% rename from src/add-ons/decorators/SATDecorator/StackAndTile.h rename to src/servers/app/StackAndTile/StackAndTile.h index 198fe655cf..2aae3e9d04 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.h +++ b/src/servers/app/StackAndTile/StackAndTile.h @@ -14,9 +14,8 @@ #include #include -#include "Desktop.h" +#include "DesktopListener.h" #include "ObjectList.h" -#include "SATGroup.h" #include "WindowList.h" @@ -29,8 +28,10 @@ #endif +class SATGroup; class SATWindow; class Window; +class WindowArea; typedef std::map SATWindowMap; @@ -106,7 +107,7 @@ private: bool fSATKeyPressed; SATWindowMap fSATWindowMap; - SATWindowList fGrouplessWindows; + BObjectList fGrouplessWindows; SATWindow* fCurrentSATWindow; }; diff --git a/src/add-ons/decorators/SATDecorator/Stacking.cpp b/src/servers/app/StackAndTile/Stacking.cpp similarity index 99% rename from src/add-ons/decorators/SATDecorator/Stacking.cpp rename to src/servers/app/StackAndTile/Stacking.cpp index 15392c2ce8..dc9ebe13a8 100644 --- a/src/add-ons/decorators/SATDecorator/Stacking.cpp +++ b/src/servers/app/StackAndTile/Stacking.cpp @@ -12,6 +12,7 @@ #include "StackAndTilePrivate.h" +#include "Desktop.h" #include "SATWindow.h" #include "Window.h" diff --git a/src/add-ons/decorators/SATDecorator/Stacking.h b/src/servers/app/StackAndTile/Stacking.h similarity index 100% rename from src/add-ons/decorators/SATDecorator/Stacking.h rename to src/servers/app/StackAndTile/Stacking.h diff --git a/src/add-ons/decorators/SATDecorator/Tiling.cpp b/src/servers/app/StackAndTile/Tiling.cpp similarity index 100% rename from src/add-ons/decorators/SATDecorator/Tiling.cpp rename to src/servers/app/StackAndTile/Tiling.cpp diff --git a/src/add-ons/decorators/SATDecorator/Tiling.h b/src/servers/app/StackAndTile/Tiling.h similarity index 98% rename from src/add-ons/decorators/SATDecorator/Tiling.h rename to src/servers/app/StackAndTile/Tiling.h index 1eeeb47f3d..c442458f1b 100644 --- a/src/add-ons/decorators/SATDecorator/Tiling.h +++ b/src/servers/app/StackAndTile/Tiling.h @@ -12,6 +12,7 @@ #include "Decorator.h" #include "StackAndTile.h" +#include "SATGroup.h" class SATWindow; diff --git a/src/servers/app/decorator/DecorManager.cpp b/src/servers/app/decorator/DecorManager.cpp index a020e20909..ad07f1dfb7 100644 --- a/src/servers/app/decorator/DecorManager.cpp +++ b/src/servers/app/decorator/DecorManager.cpp @@ -21,11 +21,10 @@ #include #include "AppServer.h" -#include "DefaultDecorator.h" -#include "DefaultWindowBehaviour.h" #include "Desktop.h" #include "DesktopSettings.h" #include "ServerConfig.h" +#include "SATDecorator.h" #include "Window.h" typedef float get_version(void); @@ -82,7 +81,8 @@ DecorAddOn::AllocateDecorator(Desktop* desktop, DrawingEngine* engine, WindowBehaviour* DecorAddOn::AllocateWindowBehaviour(Window* window) { - return new (std::nothrow)DefaultWindowBehaviour(window); + return new (std::nothrow)SATWindowBehaviour(window, + window->Desktop()->GetStackAndTile()); } @@ -97,7 +97,7 @@ Decorator* DecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect, window_look look, uint32 flags) { - return new (std::nothrow)DefaultDecorator(settings, rect, look, flags); + return new (std::nothrow)SATDecorator(settings, rect, look, flags); } From 8313747b531d9f5e80cb79966056782504fd1542 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 23:18:28 +0000 Subject: [PATCH 058/702] As done in move, resize only the top layer window. The top layer window resizes the lower windows separately. Use auto locker. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42502 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index d7c3e46690..2fc0a6349a 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1333,8 +1333,7 @@ Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace) if (x == 0 && y == 0) return; - if (!LockAllWindows()) - return; + AutoWriteLocker _(fWindowLock); Window* topWindow = window->TopLayerStackWindow(); if (topWindow) @@ -1356,7 +1355,6 @@ Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace) window->MoveBy((int32)x, (int32)y); NotifyWindowMoved(window); - UnlockAllWindows(); return; } @@ -1411,8 +1409,6 @@ Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace) } NotifyWindowMoved(window); - - UnlockAllWindows(); } @@ -1422,13 +1418,15 @@ Desktop::ResizeWindowBy(Window* window, float x, float y) if (x == 0 && y == 0) return; - if (!LockAllWindows()) - return; + AutoWriteLocker _(fWindowLock); + + Window* topWindow = window->TopLayerStackWindow(); + if (topWindow) + window = topWindow; if (!window->IsVisible()) { window->ResizeBy((int32)x, (int32)y, NULL); NotifyWindowResized(window); - UnlockAllWindows(); return; } @@ -1471,8 +1469,6 @@ Desktop::ResizeWindowBy(Window* window, float x, float y) } NotifyWindowResized(window); - - UnlockAllWindows(); } From 6ce29ffc9711306bfb44c099fcb1d81ff5d0eae6 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 26 Jul 2011 23:38:42 +0000 Subject: [PATCH 059/702] Remove some debug left over. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42503 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index ac4010afe6..508c95c64a 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -318,8 +318,6 @@ Window::MoveBy(int32 x, int32 y, bool moveStack) if (window == this) continue; window->MoveBy(x, y, false); - - //fDesktop->RebuildAndRedrawAfterWindowChange(window, dirty); } } @@ -370,13 +368,8 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion, bool resizeStack) } ::Decorator* decorator = Decorator(); - if (decorator && resizeStack) { + if (decorator && resizeStack) decorator->ResizeBy(x, y, dirtyRegion); -//if (dirtyRegion) { -//fDrawingEngine->FillRegion(*dirtyRegion, (rgb_color){ 255, 255, 0, 255 }); -//snooze(40000); -//} - } WindowStack* stack = GetWindowStack(); if (resizeStack && stack) { @@ -387,8 +380,6 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion, bool resizeStack) window->ResizeBy(x, y, dirtyRegion, false); } } -//if (dirtyRegion) -//fDrawingEngine->FillRegion(*dirtyRegion, (rgb_color){ 0, 255, 255, 255 }); // send a message to the client informing about the changed size BRect frame(Frame()); From 13e25213561d2e087501366a9671857d484cce4e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 27 Jul 2011 01:42:43 +0000 Subject: [PATCH 060/702] * Fix free NULL check style violations * Remove linux style EINVAL git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42504 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/wimax/usb_beceemwmx/BeceemDDR.cpp | 8 ++++---- .../wimax/usb_beceemwmx/BeceemDevice.cpp | 17 ++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp index 85307b3d04..87dba3b6ff 100644 --- a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp +++ b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp @@ -70,7 +70,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) break; default: - return -EINVAL; + return B_BAD_VALUE; } break; @@ -169,7 +169,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) break; default: - return -EINVAL; + return B_BAD_VALUE; } break; case 0xbece0310: @@ -209,13 +209,13 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) break; default: - return -EINVAL; + return B_BAD_VALUE; } break; } default: - return -EINVAL; + return B_BAD_VALUE; } value = 0; diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp index ac1f0ac681..00d6b3dd89 100644 --- a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp +++ b/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp @@ -270,17 +270,12 @@ BeceemDevice::~BeceemDevice() if (fNotifyWriteSem >= B_OK) delete_sem(fNotifyWriteSem); - if (fNotifyBuffer != NULL) - free(fNotifyBuffer); - // Free notification buffer - - if (pwmxdevice->nvmFlashCSInfo != NULL) - free(pwmxdevice->nvmFlashCSInfo); - // Free flash configuration structure - - if (pwmxdevice != NULL) - free(pwmxdevice); - // Free malloc of wimax device struct + free(fNotifyBuffer); + // Free notification buffer + free(pwmxdevice->nvmFlashCSInfo); + // Free flash configuration structure + free(pwmxdevice); + // Free malloc of wimax device struct mutex_destroy(&gUSBLock); From a956672a338292e4e7d9b4f910c82cf9e64466f8 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 27 Jul 2011 02:26:49 +0000 Subject: [PATCH 061/702] * Fix a few spots where we were checking for NULL unneededly * Fix a few spots where we *should* of been checking for NULL to prevent referencing a null pointer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42505 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index bc47945f13..b4a8aa7f51 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -168,22 +168,24 @@ init_common(int device, bool isClone) static void uninit_common(void) { - delete_area(gInfo->regs_area); - delete_area(gInfo->shared_info_area); + if (gInfo != NULL) { + delete_area(gInfo->regs_area); + delete_area(gInfo->shared_info_area); - gInfo->regs_area = gInfo->shared_info_area = -1; + gInfo->regs_area = gInfo->shared_info_area = -1; - // close the file handle ONLY if we're the clone - if (gInfo->is_clone) - close(gInfo->device); + // close the file handle ONLY if we're the clone + if (gInfo->is_clone) + close(gInfo->device); - free(gInfo); + free(gInfo); + } for (uint32 id = 0; id < MAX_DISPLAY; id++) { - if (gDisplay[id]->regs != NULL) + if (gDisplay[id] != NULL) { free(gDisplay[id]->regs); - if (gDisplay[id] != NULL) free(gDisplay[id]); + } } } From e4228c37603d96c787cacce88c55edd019f00478 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Wed, 27 Jul 2011 03:24:53 +0000 Subject: [PATCH 062/702] Also make the right option key working as a S&T key. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42506 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/StackAndTile/StackAndTile.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/servers/app/StackAndTile/StackAndTile.cpp b/src/servers/app/StackAndTile/StackAndTile.cpp index b2a4ef1625..00a4fcba02 100644 --- a/src/servers/app/StackAndTile/StackAndTile.cpp +++ b/src/servers/app/StackAndTile/StackAndTile.cpp @@ -115,10 +115,15 @@ StackAndTile::WindowRemoved(Window* window) bool StackAndTile::KeyPressed(uint32 what, int32 key, int32 modifiers) { - // switch to and from stacking and snapping mode - if (what == B_MODIFIERS_CHANGED) { + const int32 kRightOptionKey = 103; + if (what == B_MODIFIERS_CHANGED + || (what == B_UNMAPPED_KEY_DOWN && key == kRightOptionKey) + || (what == B_UNMAPPED_KEY_UP && key == kRightOptionKey)) { + // switch to and from stacking and snapping mode bool wasPressed = fSATKeyPressed; - fSATKeyPressed = modifiers & B_OPTION_KEY; + fSATKeyPressed = (what == B_MODIFIERS_CHANGED + && modifiers & B_OPTION_KEY) + || (what == B_UNMAPPED_KEY_DOWN && key == kRightOptionKey); if (wasPressed && !fSATKeyPressed) _StopSAT(); if (!wasPressed && fSATKeyPressed) From 87cec635c0bcc33de4193223215716bf675cacb4 Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Wed, 27 Jul 2011 06:53:04 +0000 Subject: [PATCH 063/702] Updated Finnish catkeys. Thanks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42507 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/apps/aboutsystem/fi.catkeys | 3 ++- data/catalogs/apps/charactermap/fi.catkeys | 4 +++- data/catalogs/apps/deskbar/fi.catkeys | 4 ++-- data/catalogs/kits/tracker/fi.catkeys | 4 +++- data/catalogs/preferences/mail/fi.catkeys | 11 ++++++----- data/catalogs/servers/mail/fi.catkeys | 6 +++++- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/data/catalogs/apps/aboutsystem/fi.catkeys b/data/catalogs/apps/aboutsystem/fi.catkeys index acfe2a318f..83ae94d8ae 100644 --- a/data/catalogs/apps/aboutsystem/fi.catkeys +++ b/data/catalogs/apps/aboutsystem/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-About 128117018 +1 finnish x-vnd.Haiku-About 1190044815 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d mebitavua yhteensä %d MiB used (%d%%) AboutView %d mebitavua käytetty (%d%%) @@ -6,6 +6,7 @@ %ld Processors: AboutView %ld Suoritinta: %total MiB total, %inaccessible MiB inaccessible AboutView %total mebitavua yhteensä, %inaccessible mebitavua luoksepääsemätön ... and the many people making donations!\n\n AboutView ... ja monet lahjoituksia tehneet ihmiset!\n\n +2001 by Andy Ritger based on the Generalized Timing Formula AboutView 2001, Andy Ritger perustuen Generalized Timing Formula -standardiin About this system AboutWindow Tietoa tästä järjestelmästä AboutSystem System name Järjestelmästä BSD (2-clause) AboutView BSD (2-ehto) diff --git a/data/catalogs/apps/charactermap/fi.catkeys b/data/catalogs/apps/charactermap/fi.catkeys index 9bb0af944a..3af4dcba36 100644 --- a/data/catalogs/apps/charactermap/fi.catkeys +++ b/data/catalogs/apps/charactermap/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-CharacterMap 2137207616 +1 finnish x-vnd.Haiku-CharacterMap 4082916013 Aegean numbers UnicodeBlocks Aegean-numerot Alphabetic presentation forms UnicodeBlocks Aakkosellinen esitysmuoto Ancient Greek musical notation UnicodeBlocks Antiikin kreikan nuottikirjoitus @@ -43,6 +43,8 @@ Combining diacritical marks supplement UnicodeBlocks Yhdistettyjen diakriittist Combining half marks UnicodeBlocks Yhdistetyt puolimerkit Control pictures UnicodeBlocks Ohjainkuvat Coptic UnicodeBlocks Kopti +Copy as escaped byte string CharacterView Kopioi koodinvaihtotavumerkkijonona +Copy character CharacterView Kopioi merkki Counting rod numerals UnicodeBlocks Laskentatankonumerraalit Cuneiform UnicodeBlocks Nuolenpääkirjoitus Cuneiform numbers and punctuation UnicodeBlocks Nuolenpääkirjoituksen numerot ja välimerkit diff --git a/data/catalogs/apps/deskbar/fi.catkeys b/data/catalogs/apps/deskbar/fi.catkeys index 562b31810d..cb5ed134c1 100644 --- a/data/catalogs/apps/deskbar/fi.catkeys +++ b/data/catalogs/apps/deskbar/fi.catkeys @@ -1,6 +1,6 @@ -1 finnish x-vnd.Be-TSKB 1465644101 +1 finnish x-vnd.Be-TSKB 4265681964 BeMenu -About Haiku BeMenu Haikusta +About this system BeMenu Tästä järjestelmästä Always on top PreferencesWindow Aina päällimmäisenä Applications B_USER_DESKBAR_DIRECTORY/Applications Sovellukset Applications PreferencesWindow Sovellukset diff --git a/data/catalogs/kits/tracker/fi.catkeys b/data/catalogs/kits/tracker/fi.catkeys index cd7ea4c865..6450873cb2 100644 --- a/data/catalogs/kits/tracker/fi.catkeys +++ b/data/catalogs/kits/tracker/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-libtracker 2699246155 +1 finnish x-vnd.Haiku-libtracker 3486294898 %BytesPerSecond/s StatusWindow %BytesPerSecond/s %Ld B WidgetAttributeText %Ld tavua %Ld bytes WidgetAttributeText %Ld tavua @@ -38,6 +38,7 @@ An item named \"%name\" already exists in this folder. Would you like to replace And FindPanel Ja Are you sure you want to delete the selected item(s)? This operation cannot be reverted. FSUtils Oletko varma, että haluat poistaa valitut kohteet? Tätä toimintoa ei voi palauttaa. Are you sure you want to move or copy the selected item(s) to this folder? PoseView Oletko varma, että haluat kopioida tai siirtää valitut kohteet tähän kansioon? +Arrange by ContainerWindow Järjestä: Ask before delete SettingsView Kysy ennen poistoa At %func \nfind_directory() failed. \nReason: %error TrackerInitialState Funktio %func kohteessa\nfind_directory() epäonnistui. \nSyy: %error Attributes ContainerWindow Attribuutit @@ -301,6 +302,7 @@ Resize to fit QueryContainerWindow Muuta koko sopimaan Resize to fit VolumeWindow Muunna koko sopimaan Restore ContainerWindow Palauta Restoring: StatusWindow Palautetaan: +Reverse order ContainerWindow Käännä järjestys Revert TrackerSettingsWindow Palauta Save FilePanelPriv Tallenna Save FindPanel Tallenna diff --git a/data/catalogs/preferences/mail/fi.catkeys b/data/catalogs/preferences/mail/fi.catkeys index c00eb175a5..a5473a7a1b 100644 --- a/data/catalogs/preferences/mail/fi.catkeys +++ b/data/catalogs/preferences/mail/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-Mail 1746145370 +1 finnish x-vnd.Haiku-Mail 3957822883 Account name: Config Views Tilin nimi: Account name: E-Mail Tilinimi: Account settings AutoConfigWindow Tiliasetukset @@ -25,6 +25,7 @@ Incoming mail filters Config Views Tulevan postin suodattimet Login name: E-Mail Kirjautumisnimi: Mail checking Config Window Sähköpostin tarkistus Miscellaneous Config Window Sekalaiset +Never Config Window show status window Ei koskaan Next AutoConfigWindow Seuraava OK AutoConfigWindow Valmis OK Config Views Valmis @@ -50,10 +51,10 @@ While sending Config Window Lähetettäessä While sending and receiving Config Window Lähetettäessä ja vastaanotettaessa \nThe general settings couldn't be reverted.\n\nError retrieving general settings:\n%s\n Config Window \nYleisasetuksia ei voitu palauttaa.\n\nVirhe noudettaessa yleisasetuksia:\n%s\n \n\nCreate a new account with the Add button.\n\nRemove an account with the Remove button on the selected item.\n\nSelect an item in the list to change its settings. Config Window \n\nLuo uusi tili ”Lisää”-painikkeella.\n\nPoista tili ”Poista”-painikkella valitusta kohdasta.\n\nValitse kohde luettelosta sen asetusten muuttamiseksi. +\t\t· E-mail filters Config Window \t\t· Sähköpostisuodattimet +\t\t· Incoming Config Window \t\t· Tuleva +\t\t· Outgoing Config Window \t\t· Lähtevä days Config Window päivä hours Config Window tunti minutes Config Window minuutti -never Config Window älä tarkista -· E-mail filters Config Window · Sähköpostisuodattimet -· Incoming Config Window · Tuleva -· Outgoing Config Window · Lähtevä +never Config Window mail checking frequency ei koskaan diff --git a/data/catalogs/servers/mail/fi.catkeys b/data/catalogs/servers/mail/fi.catkeys index 7bf1b6b699..abf13db36e 100644 --- a/data/catalogs/servers/mail/fi.catkeys +++ b/data/catalogs/servers/mail/fi.catkeys @@ -1,4 +1,6 @@ -1 finnish x-vnd.Be-POST 2900218551 +1 finnish x-vnd.Be-POST 1358359182 +%.1f / %.1f kb (%d / %d messages) StatusWindow %.1f / %.1f kilotavua (%d / %d viestiä) +%d / %d messages StatusWindow %d / %d viestiä %num new message DeskbarView %num uusi viesti %num new message for %name\n MailDaemon %num uusi viesti käyttäjälle %name\n %num new message. MailDaemon %num uusi viesti. @@ -10,6 +12,7 @@ Check for mail now DeskbarView Tarkista sähköposti nyt Check for mails only DeskbarView Tarkista vain sähköpostit Check mail now StatusWindow Tarkista sähköposti nyt Create new message… DeskbarView Luo uusi viesti... +Fetching mail for %name Notifier Noudetaan sähköpostia vastaanottajalle %name Mail Status MailDaemon Sähköpostitila Mail daemon status log MailDaemon Sähköpostitaustaohjelman tilaloki New Messages MailDaemon Uudet viestit @@ -19,4 +22,5 @@ No new messages. MailDaemon Ei uusia viestejä. No new messages. StatusWindow Ei uusia viestejä. Preferences… DeskbarView Asetukset... Send pending mails DeskbarView Lähetä odottamassa olevat sähköpostit +Sending mail for %name Notifier Lähetetään sähköpostia vastaanottajalle %name Shutdown mail services DeskbarView Sulje sähköpostipalvelut From e1b9d6e6743b027ba89a78d381ea398d79ec7822 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 29 Jul 2011 03:32:01 +0000 Subject: [PATCH 064/702] * Add LVDS handling for TMDSB * Fix crash situation if no monitors detected * Assume TMDSB if no monitors sensed (temporary) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42508 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/Jamfile | 1 + .../accelerants/radeon_hd/accelerant.cpp | 12 +- .../accelerants/radeon_hd/accelerant.h | 4 +- src/add-ons/accelerants/radeon_hd/display.cpp | 21 +- src/add-ons/accelerants/radeon_hd/lvds.cpp | 260 ++++++++++++++++++ src/add-ons/accelerants/radeon_hd/lvds.h | 33 +++ src/add-ons/accelerants/radeon_hd/mode.cpp | 26 +- 7 files changed, 337 insertions(+), 20 deletions(-) create mode 100644 src/add-ons/accelerants/radeon_hd/lvds.cpp create mode 100644 src/add-ons/accelerants/radeon_hd/lvds.h diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile b/src/add-ons/accelerants/radeon_hd/Jamfile index 8a23985d26..9aab5ee2d1 100644 --- a/src/add-ons/accelerants/radeon_hd/Jamfile +++ b/src/add-ons/accelerants/radeon_hd/Jamfile @@ -17,6 +17,7 @@ Addon radeon_hd.accelerant : dac.cpp display.cpp tmds.cpp + lvds.cpp mode.cpp bios.cpp create_display_modes.cpp diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index b4a8aa7f51..144503263d 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -209,16 +209,16 @@ radeon_init_accelerant(int device) init_lock(&info.engine_lock, "radeon hd engine"); status = detect_displays(); - if (status != B_OK) - return status; + //if (status != B_OK) + // return status; debug_displays(); status = create_mode_list(); - if (status != B_OK) { - uninit_common(); - return status; - } + //if (status != B_OK) { + // radeon_uninit_accelerant(); + // return status; + //} TRACE("%s done\n", __func__); return B_OK; diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 4f5890c6e7..8ce02b5f6d 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -15,6 +15,7 @@ #include "pll.h" #include "dac.h" #include "tmds.h" +#include "lvds.h" #include @@ -89,6 +90,7 @@ typedef struct { uint32 connection_type; uint8 connection_id; register_info *regs; + bool found_ranges; uint32 vfreq_max; uint32 vfreq_min; uint32 hfreq_max; @@ -99,7 +101,7 @@ typedef struct { // display_info connection_type #define CONNECTION_DAC 0x0001 #define CONNECTION_TMDS 0x0002 -#define CONNECTION_LVDS 0x0003 +#define CONNECTION_LVDS 0x0004 // register MMIO modes #define OUT 0x1 // direct MMIO calls diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index bb9c8d2f58..8cc1e197a7 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -216,8 +216,10 @@ status_t detect_displays() { // reset known displays - for (uint32 id = 0; id < MAX_DISPLAY; id++) + for (uint32 id = 0; id < MAX_DISPLAY; id++) { gDisplay[id]->active = false; + gDisplay[id]->found_ranges = false; + } uint32 index = 0; @@ -228,7 +230,9 @@ detect_displays() gDisplay[index]->connection_type = CONNECTION_DAC; gDisplay[index]->connection_id = id; init_registers(gDisplay[index]->regs, index); - detect_crt_ranges(index); + if (detect_crt_ranges(index) == B_OK) + gDisplay[index]->found_ranges = true; + if (index < MAX_DISPLAY) index++; else @@ -243,7 +247,9 @@ detect_displays() gDisplay[index]->connection_type = CONNECTION_TMDS; gDisplay[index]->connection_id = id; init_registers(gDisplay[index]->regs, index); - detect_crt_ranges(index); + if (detect_crt_ranges(index) == B_OK) + gDisplay[index]->found_ranges = true; + if (index < MAX_DISPLAY) index++; else @@ -251,6 +257,15 @@ detect_displays() } } + // No monitors? Lets assume LVDS for now + if (index == 0) { + gDisplay[index]->active = true; + gDisplay[index]->connection_type = CONNECTION_LVDS; + gDisplay[index]->connection_id = 1; + // 0 : LVDSA ; 1 : LVDSB / TDMSB + init_registers(gDisplay[index]->regs, index); + } + return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/lvds.cpp b/src/add-ons/accelerants/radeon_hd/lvds.cpp new file mode 100644 index 0000000000..7a7c449a9b --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/lvds.cpp @@ -0,0 +1,260 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include "accelerant_protos.h" +#include "accelerant.h" +#include "utility.h" +#include "lvds.h" + + +#define TRACE_LVDS +#ifdef TRACE_LVDS +extern "C" void _sPrintf(const char *format, ...); +# define TRACE(x...) _sPrintf("radeon_hd: " x) +#else +# define TRACE(x...) ; +#endif + + +// Static microvoltage values taken from Xorg driver +static struct R5xxTMDSBMacro { + uint16 device; + uint32 macroSingle; + uint32 macroDual; +} R5xxTMDSBMacro[] = { + /* + * this list isn't complete yet. + * Some more values for dual need to be dug up + */ + { 0x7104, 0x00F20616, 0x00F20616 }, // R520 + { 0x7142, 0x00F2061C, 0x00F2061C }, // RV515 + { 0x7145, 0x00F1061D, 0x00F2061D }, + { 0x7146, 0x00F1061D, 0x00F1061D }, // RV515 + { 0x7147, 0x0082041D, 0x0082041D }, // RV505 + { 0x7149, 0x00F1061D, 0x00D2061D }, + { 0x7152, 0x00F2061C, 0x00F2061C }, // RV515 + { 0x7183, 0x00B2050C, 0x00B2050C }, // RV530 + { 0x71C0, 0x00F1061F, 0x00f2061D }, + { 0x71C1, 0x0062041D, 0x0062041D }, // RV535 + { 0x71C2, 0x00F1061D, 0x00F2061D }, // RV530 + { 0x71C5, 0x00D1061D, 0x00D2061D }, + { 0x71C6, 0x00F2061D, 0x00F2061D }, // RV530 + { 0x71D2, 0x00F10610, 0x00F20610 }, // RV530: atombios uses 0x00F1061D + { 0x7249, 0x00F1061D, 0x00F1061D }, // R580 + { 0x724B, 0x00F10610, 0x00F10610 }, // R580: atombios uses 0x00F1061D + { 0x7280, 0x0042041F, 0x0042041F }, // RV570 + { 0x7288, 0x0042041F, 0x0042041F }, // RV570 + { 0x791E, 0x0001642F, 0x0001642F }, // RS690 + { 0x791F, 0x0001642F, 0x0001642F }, // RS690 + { 0x9400, 0x00020213, 0x00020213 }, // R600 + { 0x9401, 0x00020213, 0x00020213 }, // R600 + { 0x9402, 0x00020213, 0x00020213 }, // R600 + { 0x9403, 0x00020213, 0x00020213 }, // R600 + { 0x9405, 0x00020213, 0x00020213 }, // R600 + { 0x940A, 0x00020213, 0x00020213 }, // R600 + { 0x940B, 0x00020213, 0x00020213 }, // R600 + { 0x940F, 0x00020213, 0x00020213 }, // R600 + { 0, 0, 0 } /* End marker */ +}; + +static struct RV6xxTMDSBMacro { + uint16 device; + uint32 macro; + uint32 tx; + uint32 preEmphasis; +} RV6xxTMDSBMacro[] = { + { 0x94C1, 0x01030311, 0x10001A00, 0x01801015}, /* RV610 */ + { 0x94C3, 0x01030311, 0x10001A00, 0x01801015}, /* RV610 */ + { 0x9501, 0x0533041A, 0x020010A0, 0x41002045}, /* RV670 */ + { 0x9505, 0x0533041A, 0x020010A0, 0x41002045}, /* RV670 */ + { 0x950F, 0x0533041A, 0x020010A0, 0x41002045}, /* R680 */ + { 0x9587, 0x01030311, 0x10001C00, 0x01C01011}, /* RV630 */ + { 0x9588, 0x01030311, 0x10001C00, 0x01C01011}, /* RV630 */ + { 0x9589, 0x01030311, 0x10001C00, 0x01C01011}, /* RV630 */ + { 0, 0, 0, 0} /* End marker */ +}; + + +void +LVDSVoltageControl(uint8 lvdsIndex) +{ + bool dualLink = false; // TODO : DualLink + radeon_shared_info &info = *gInfo->shared_info; + + // TODO : Special RS690 RS600 IGP oneoffs + + if (info.device_chipset < (RADEON_R600 | 0x70)) + Write32Mask(OUT, LVTMA_REG_TEST_OUTPUT, 0x00100000, 0x00100000); + + // Micromanage voltages + if (info.device_chipset < (RADEON_R600 | 0x10)) { + for (uint32 i = 0; R5xxTMDSBMacro[i].device; i++) { + if (R5xxTMDSBMacro[i].device == info.device_id) { + if (dualLink) { + Write32(OUT, LVTMA_MACRO_CONTROL, + R5xxTMDSBMacro[i].macroDual); + } else { + Write32(OUT, LVTMA_MACRO_CONTROL, + R5xxTMDSBMacro[i].macroSingle); + } + return; + } + } + TRACE("%s : unhandled chipset 0x%X\n", __func__, info.device_id); + } else { + for (uint32 i = 0; RV6xxTMDSBMacro[i].device; i++) { + if (RV6xxTMDSBMacro[i].device == info.device_id) { + Write32(OUT, LVTMA_MACRO_CONTROL, RV6xxTMDSBMacro[i].macro); + Write32(OUT, LVTMA_TRANSMITTER_ADJUST, + RV6xxTMDSBMacro[i].tx); + Write32(OUT, LVTMA_PREEMPHASIS_CONTROL, + RV6xxTMDSBMacro[i].preEmphasis); + return; + } + } + TRACE("%s : unhandled chipset 0x%X\n", __func__, info.device_id); + } +} + + +void +LVDSPower(uint8 lvdsIndex, int command) +{ + bool dualLink = false; // TODO : dualLink + + if (lvdsIndex == 0) { + TRACE("LVTMA not yet supported :(\n"); + return; + } else { + // Select TMDSB (which is on LVDS) + Write32Mask(OUT, LVTMA_MODE, 0x00000001, 0x00000001); + } + + switch (command) { + case RHD_POWER_ON: + TRACE("%s: LVDS %d Power On\n", __func__, lvdsIndex); + Write32Mask(OUT, LVTMA_CNTL, 0x1, 0x00000001); + + if (dualLink) { + Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, + 0x00003E3E, 0x00003E3E); + } else { + Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, + 0x0000003E, 0x00003E3E); + } + + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x00000001, 0x00000001); + snooze(2); + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x00000002); + // TODO : Enable HDMI + return; + + case RHD_POWER_RESET: + TRACE("%s: LVDS %d Power Reset\n", __func__, lvdsIndex); + Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, 0, 0x00003E3E); + return; + + case RHD_POWER_SHUTDOWN: + default: + TRACE("%s: LVDS %d Power Shutdown\n", __func__, lvdsIndex); + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x00000002, 0x00000002); + snooze(2); + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x00000001); + + Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, 0, 0x00003E3E); + Write32Mask(OUT, LVTMA_CNTL, 0, 0x00000001); + // TODO : Disable HDMI + return; + } +} + + +status_t +LVDSSet(uint8 lvdsIndex, display_mode *mode) +{ + TRACE("%s: LVDS %d Set\n", __func__, lvdsIndex); + + uint16 crtid = 0; // TODO : assume CRT0 + + if (lvdsIndex == 0) { + TRACE("LVTMA not yet supported :(\n"); + return B_ERROR; + } else { + // Select TMDSB (which is on LVDS) + Write32Mask(OUT, LVTMA_MODE, 0x00000001, 0x00000001); + } + + // Clear HPD events + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x0000000C); + Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, 0, 0x00070000); + + Write32Mask(OUT, LVTMA_CNTL, 0, 0x00000010); + + // Disable LVDS (TMDSB) transmitter + Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, 0, 0x00003E3E); + + // Reset dither bits + Write32Mask(OUT, LVTMA_BIT_DEPTH_CONTROL, 0, 0x00010101); + Write32Mask(OUT, LVTMA_BIT_DEPTH_CONTROL, LVTMA_DITHER_RESET_BIT, + LVTMA_DITHER_RESET_BIT); + snooze(2); + Write32Mask(OUT, LVTMA_BIT_DEPTH_CONTROL, 0, LVTMA_DITHER_RESET_BIT); + Write32Mask(OUT, LVTMA_BIT_DEPTH_CONTROL, 0, 0xF0000000); + // Undocumented depth control bit from Xorg + + Write32Mask(OUT, LVTMA_CNTL, 0x00001000, 0x00011000); + // Reset phase for vsync and use RGB color + + Write32Mask(OUT, LVTMA_SOURCE_SELECT, crtid, 0x00010101); + // Assign to CRTC + + Write32(OUT, LVTMA_COLOR_FORMAT, 0); + + // TODO : Detect DualLink via SynthClock? + Write32Mask(OUT, LVTMA_CNTL, 0, 0x01000000); + + // TODO : only > R600 - disable split mode + Write32Mask(OUT, LVTMA_CNTL, 0, 0x20000000); + + Write32Mask(OUT, LVTMA_FORCE_OUTPUT_CNTL, 0, 0x00000001); + // Disable force data + + Write32Mask(OUT, LVTMA_DCBALANCER_CONTROL, 0x00000001, 0x00000001); + // Enable DC balancer + + LVDSVoltageControl(lvdsIndex); + + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x00000010, 0x00000010); + // use IDCLK + + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x20000000, 0x20000000); + // use clock selected by next write + + // TODO : coherent mode? + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x10000000); + + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x03FF0000); + // Clear current LVDS clock + + // Reset PLL's + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x00000002, 0x00000002); + snooze(2); + Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x00000002); + snooze(20); + + // Restart LVDS data sync + Write32Mask(OUT, LVTMA_DATA_SYNCHRONIZATION, 0x00000001, 0x00000001); + Write32Mask(OUT, LVTMA_DATA_SYNCHRONIZATION, 0x00000100, 0x00000100); + snooze(20); + Write32Mask(OUT, LVTMA_DATA_SYNCHRONIZATION, 0, 0x00000001); + + // TODO : Set HDMI mode + + return B_OK; +} diff --git a/src/add-ons/accelerants/radeon_hd/lvds.h b/src/add-ons/accelerants/radeon_hd/lvds.h new file mode 100644 index 0000000000..503942d00e --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/lvds.h @@ -0,0 +1,33 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ +#ifndef RADEON_HD_LVDS_H +#define RADEON_HD_LVDS_H + + +#define LVTMA_DATA_SYNCHRONIZATION LVTMA_R600_DATA_SYNCHRONIZATION +#define LVTMA_PWRSEQ_REF_DIV LVTMA_R600_PWRSEQ_REF_DIV +#define LVTMA_PWRSEQ_DELAY1 LVTMA_R600_PWRSEQ_DELAY1 +#define LVTMA_PWRSEQ_DELAY2 LVTMA_R600_PWRSEQ_DELAY2 +#define LVTMA_PWRSEQ_CNTL LVTMA_R600_PWRSEQ_CNTL +#define LVTMA_PWRSEQ_STATE LVTMA_R600_PWRSEQ_STATE +#define LVTMA_LVDS_DATA_CNTL LVTMA_R600_LVDS_DATA_CNTL +#define LVTMA_MODE LVTMA_R600_MODE +#define LVTMA_TRANSMITTER_ENABLE LVTMA_R600_TRANSMITTER_ENABLE +#define LVTMA_MACRO_CONTROL LVTMA_R600_MACRO_CONTROL +#define LVTMA_TRANSMITTER_CONTROL LVTMA_R600_TRANSMITTER_CONTROL +#define LVTMA_REG_TEST_OUTPUT LVTMA_R600_REG_TEST_OUTPUT +#define LVTMA_BL_MOD_CNTL LVTMA_R600_BL_MOD_CNTL +#define LVTMA_DITHER_RESET_BIT 0x02000000 + + +void LVDSVoltageControl(uint8 lvdsIndex); +void LVDSPower(uint8 lvdsIndex, int command); +status_t LVDSSet(uint8 lvdsIndex, display_mode *mode); + + +#endif /* RADEON_HD_LVDS_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 7d8934d93b..eaec697ed0 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -149,7 +149,6 @@ CardFBSet(uint8 crtid, display_mode *mode) get_color_space_format(*mode, colorMode, bytesPerRow, bitsPerPixel); - #if 0 // TMDSAllIdle // DVI / HDMI // LVTMAAllIdle // DVI @@ -249,9 +248,10 @@ CardModeSet(uint8 crtid, display_mode *mode) displayTiming.h_total - 1); // Blanking - uint16 blankStart = displayTiming.h_total - + displayTiming.h_display - displayTiming.h_sync_start; - uint16 blankEnd = displayTiming.h_total - displayTiming.h_sync_start; + uint16 blankStart = MIN(displayTiming.h_sync_start, + displayTiming.h_display); + uint16 blankEnd = MAX(displayTiming.h_sync_end, + displayTiming.h_total); Write32(CRT, regs->crtHBlank, blankStart | (blankEnd << 16)); @@ -267,9 +267,10 @@ CardModeSet(uint8 crtid, display_mode *mode) Write32(CRT, regs->crtVTotal, displayTiming.v_total - 1); - blankStart = displayTiming.v_total - + displayTiming.v_display - displayTiming.v_sync_start; - blankEnd = displayTiming.v_total - displayTiming.v_sync_start; + blankStart = MIN(displayTiming.v_sync_start, + displayTiming.v_display); + blankEnd = MAX(displayTiming.v_sync_end, + displayTiming.v_total); Write32(CRT, regs->crtVBlank, blankStart | (blankEnd << 16)); @@ -345,6 +346,9 @@ radeon_set_display_mode(display_mode *mode) } else if ((gDisplay[display_id]->connection_type & CONNECTION_TMDS) != 0) { TMDSSet(gDisplay[display_id]->connection_id, mode); TMDSPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); + } else if ((gDisplay[display_id]->connection_type & CONNECTION_LVDS) != 0) { + LVDSSet(gDisplay[display_id]->connection_id, mode); + LVDSPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); } // Ensure screen isn't blanked @@ -429,7 +433,8 @@ is_mode_supported(display_mode *mode) uint32 crtid = 0; // if we have edid info, check frequency adginst crt reported valid ranges - if (gInfo->shared_info->has_edid) { + if (gInfo->shared_info->has_edid + && gDisplay[crtid]->found_ranges) { uint32 hfreq = mode->timing.pixel_clock / mode->timing.h_total; if (hfreq > gDisplay[crtid]->hfreq_max + 1 @@ -453,10 +458,11 @@ is_mode_supported(display_mode *mode) mode->timing.h_display, mode->timing.v_display, crtid); return false; } - TRACE("%dx%d is within CRT %d's valid frequency range\n", - mode->timing.h_display, mode->timing.v_display, crtid); } + TRACE("%dx%d is within CRT %d's valid frequency range\n", + mode->timing.h_display, mode->timing.v_display, crtid); + return true; } From eb027537793a9f57d07dc87d86e482e51c8d4b2b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 29 Jul 2011 06:10:52 +0000 Subject: [PATCH 065/702] * Little cleanup * Add missing Idle call for connectors * Reformulate blanking.. this should match what the register is after the GTF vesa call * Set FrameBuffer to card internal address git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42509 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 1 + src/add-ons/accelerants/radeon_hd/lvds.cpp | 7 +++ src/add-ons/accelerants/radeon_hd/lvds.h | 1 + src/add-ons/accelerants/radeon_hd/mc.cpp | 3 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 46 +++++++++---------- src/add-ons/accelerants/radeon_hd/tmds.cpp | 7 +++ src/add-ons/accelerants/radeon_hd/tmds.h | 1 + .../drivers/graphics/radeon_hd/radeon_hd.cpp | 2 + 8 files changed, 44 insertions(+), 24 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index f6973db6e2..f867546e1d 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -83,6 +83,7 @@ struct radeon_shared_info { addr_t frame_buffer_phys; // card PCI BAR address of FB area_id frame_buffer_area; // area of memory mapped FB + uint32 frame_buffer_int; // card internal FB location uint32 frame_buffer_size; // card internal FB aperture size uint8* frame_buffer; // virtual memory mapped FB diff --git a/src/add-ons/accelerants/radeon_hd/lvds.cpp b/src/add-ons/accelerants/radeon_hd/lvds.cpp index 7a7c449a9b..6c7e52793a 100644 --- a/src/add-ons/accelerants/radeon_hd/lvds.cpp +++ b/src/add-ons/accelerants/radeon_hd/lvds.cpp @@ -258,3 +258,10 @@ LVDSSet(uint8 lvdsIndex, display_mode *mode) return B_OK; } + + +void +LVDSAllIdle() +{ + LVDSPower(1, RHD_POWER_RESET); +} diff --git a/src/add-ons/accelerants/radeon_hd/lvds.h b/src/add-ons/accelerants/radeon_hd/lvds.h index 503942d00e..ce32696fd1 100644 --- a/src/add-ons/accelerants/radeon_hd/lvds.h +++ b/src/add-ons/accelerants/radeon_hd/lvds.h @@ -28,6 +28,7 @@ void LVDSVoltageControl(uint8 lvdsIndex); void LVDSPower(uint8 lvdsIndex, int command); status_t LVDSSet(uint8 lvdsIndex, display_mode *mode); +void LVDSAllIdle(); #endif /* RADEON_HD_LVDS_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mc.cpp b/src/add-ons/accelerants/radeon_hd/mc.cpp index e25869c4c1..8c6244b0f7 100644 --- a/src/add-ons/accelerants/radeon_hd/mc.cpp +++ b/src/add-ons/accelerants/radeon_hd/mc.cpp @@ -65,9 +65,10 @@ MCFBSetup(uint32 newFbLocation, uint32 newFbSize) return B_OK; } - if (oldFbLocation >> 32) + if (oldFbLocation >> 32) { TRACE("%s: board claims to use a frame buffer address > 32-bits\n", __func__); + } uint32 idleState = MCIdle(); if (idleState > 0) { diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index eaec697ed0..970ea97d28 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -128,6 +128,7 @@ get_color_space_format(const display_mode &mode, uint32 &colorMode, static void CardBlankSet(uint8 crtid, bool blank) { + return; int blackColorReg = crtid == 1 ? D2CRTC_BLACK_COLOR : D1CRTC_BLACK_COLOR; int blankControlReg @@ -149,34 +150,34 @@ CardFBSet(uint8 crtid, display_mode *mode) get_color_space_format(*mode, colorMode, bytesPerRow, bitsPerPixel); - #if 0 - // TMDSAllIdle // DVI / HDMI - // LVTMAAllIdle // DVI + LVDSAllIdle(); + // DVI / HDMI / LCD + TMDSAllIdle(); + // DVI / HDMI DACAllIdle(); + // VGA + + // framebuffersize = w * h * bpp = fb bits / 8 = bytes needed + //uint64 fbAddress = gInfo->shared_info->frame_buffer_phys; + uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; // Set the inital frame buffer location in the memory controler uint32 mcFbSize; - MCFBLocation(0, &mcFbSize); - MCFBSetup(Read32(OUT, R6XX_CONFIG_FB_BASE), mcFbSize); - #endif + MCFBLocation(fbAddressInt, &mcFbSize); + //MCFBSetup(gInfo->shared_info->frame_buffer_int, mcFbSize); Write32(CRT, regs->grphUpdate, (1<<16)); // Lock for update (isn't this normally the other way around on VGA? - // framebuffersize = w * h * bpp = fb bits / 8 = bytes needed - uint64_t fbAddress = gInfo->shared_info->frame_buffer_phys; - // Tell GPU which frame buffer address to draw from - Write32(CRT, regs->grphPrimarySurfaceAddr, - fbAddress & 0xffffffff); - Write32(CRT, regs->grphSecondarySurfaceAddr, - fbAddress & 0xffffffff); + Write32(CRT, regs->grphPrimarySurfaceAddr, fbAddressInt & 0xffffffff); + Write32(CRT, regs->grphSecondarySurfaceAddr, fbAddressInt & 0xffffffff); if (gInfo->shared_info->device_chipset >= (RADEON_R700 | 0x70)) { Write32(CRT, regs->grphPrimarySurfaceAddrHigh, - (fbAddress >> 32) & 0xf); + (fbAddressInt >> 32) & 0xf); Write32(CRT, regs->grphSecondarySurfaceAddrHigh, - (fbAddress >> 32) & 0xf); + (fbAddressInt >> 32) & 0xf); } Write32(CRT, regs->grphControl, 0); @@ -248,10 +249,9 @@ CardModeSet(uint8 crtid, display_mode *mode) displayTiming.h_total - 1); // Blanking - uint16 blankStart = MIN(displayTiming.h_sync_start, - displayTiming.h_display); - uint16 blankEnd = MAX(displayTiming.h_sync_end, - displayTiming.h_total); + uint16 blankStart = displayTiming.h_total - displayTiming.h_sync_start; + uint16 blankEnd = displayTiming.h_total + + displayTiming.h_display - displayTiming.h_sync_start; Write32(CRT, regs->crtHBlank, blankStart | (blankEnd << 16)); @@ -267,10 +267,10 @@ CardModeSet(uint8 crtid, display_mode *mode) Write32(CRT, regs->crtVTotal, displayTiming.v_total - 1); - blankStart = MIN(displayTiming.v_sync_start, - displayTiming.v_display); - blankEnd = MAX(displayTiming.v_sync_end, - displayTiming.v_total); + // Blanking + blankStart = displayTiming.v_total - displayTiming.v_sync_start; + blankEnd = displayTiming.v_total + + displayTiming.v_display - displayTiming.v_sync_start; Write32(CRT, regs->crtVBlank, blankStart | (blankEnd << 16)); diff --git a/src/add-ons/accelerants/radeon_hd/tmds.cpp b/src/add-ons/accelerants/radeon_hd/tmds.cpp index 2ecda5077f..1c84e3ce6f 100644 --- a/src/add-ons/accelerants/radeon_hd/tmds.cpp +++ b/src/add-ons/accelerants/radeon_hd/tmds.cpp @@ -224,3 +224,10 @@ TMDSSet(uint8 tmdsIndex, display_mode *mode) // TODO : HdmiSetMode(mode) return B_OK; } + + +void +TMDSAllIdle() +{ + TMDSPower(0, RHD_POWER_RESET); +} diff --git a/src/add-ons/accelerants/radeon_hd/tmds.h b/src/add-ons/accelerants/radeon_hd/tmds.h index 3d1f750227..f2b7eca59f 100644 --- a/src/add-ons/accelerants/radeon_hd/tmds.h +++ b/src/add-ons/accelerants/radeon_hd/tmds.h @@ -13,6 +13,7 @@ void TMDSVoltageControl(uint8 tmdsIndex); bool TMDSSense(uint8 tmdsIndex); status_t TMDSPower(uint8 tmdsIndex, int command); status_t TMDSSet(uint8 tmdsIndex, display_mode *mode); +void TMDSAllIdle(); #endif diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index b8a37c36d2..17a5e41d30 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -99,6 +99,8 @@ radeon_hd_init(radeon_info &info) info.shared_info->frame_buffer_area = info.framebuffer_area; info.shared_info->frame_buffer_phys = info.pci->u.h0.base_registers[RHD_FB_BAR]; + info.shared_info->frame_buffer_int + = read32(info.registers + R6XX_CONFIG_FB_BASE); // Pull active monitor VESA EDID from boot loader edid1_info* edidInfo = (edid1_info*)get_boot_item(EDID_BOOT_INFO, From 3b1fd3270ebb68188835929d3c5d15a3916d9ffe Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 29 Jul 2011 06:12:01 +0000 Subject: [PATCH 066/702] * Remove return from testing git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42510 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/mode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 970ea97d28..b8301dfa24 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -128,7 +128,6 @@ get_color_space_format(const display_mode &mode, uint32 &colorMode, static void CardBlankSet(uint8 crtid, bool blank) { - return; int blackColorReg = crtid == 1 ? D2CRTC_BLACK_COLOR : D1CRTC_BLACK_COLOR; int blankControlReg From d6e4f54f2de4c76fbfbe85fc348a8fde8c296dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 29 Jul 2011 10:06:34 +0000 Subject: [PATCH 067/702] Patch by Jian Chiang as part of his GSoc Project (coding style fixes by myself): * xhci controller start operation * command ring and event ring initialization * No-Op Command test and real xhci irq handle * xhci root hub support * add Super Speed enumeration and xhci_rh.cpp into jamfile git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42511 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/usb/usb_private.h | 3 +- src/add-ons/kernel/busses/usb/Jamfile | 1 + src/add-ons/kernel/busses/usb/xhci.cpp | 598 +++++++++++++++--- src/add-ons/kernel/busses/usb/xhci.h | 113 +++- src/add-ons/kernel/busses/usb/xhci_hardware.h | 97 ++- src/add-ons/kernel/busses/usb/xhci_rh.cpp | 281 ++++++++ 6 files changed, 1002 insertions(+), 91 deletions(-) create mode 100644 src/add-ons/kernel/busses/usb/xhci_rh.cpp diff --git a/src/add-ons/kernel/bus_managers/usb/usb_private.h b/src/add-ons/kernel/bus_managers/usb/usb_private.h index 5b745d1f86..191d1602f1 100644 --- a/src/add-ons/kernel/bus_managers/usb/usb_private.h +++ b/src/add-ons/kernel/bus_managers/usb/usb_private.h @@ -90,7 +90,8 @@ typedef enum { USB_SPEED_LOWSPEED = 0, USB_SPEED_FULLSPEED, USB_SPEED_HIGHSPEED, - USB_SPEED_MAX = USB_SPEED_HIGHSPEED + USB_SPEED_SUPER, + USB_SPEED_MAX = USB_SPEED_SUPER } usb_speed; diff --git a/src/add-ons/kernel/busses/usb/Jamfile b/src/add-ons/kernel/busses/usb/Jamfile index 0afb4610f9..f1a2252030 100644 --- a/src/add-ons/kernel/busses/usb/Jamfile +++ b/src/add-ons/kernel/busses/usb/Jamfile @@ -28,6 +28,7 @@ KernelAddon ehci : KernelAddon xhci : xhci.cpp + xhci_rh.cpp : libusb.a : xhci.rdef ; diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp index fe1069c406..0d5fb986e1 100644 --- a/src/add-ons/kernel/busses/usb/xhci.cpp +++ b/src/add-ons/kernel/busses/usb/xhci.cpp @@ -63,7 +63,22 @@ XHCI::XHCI(pci_info *info, Stack *stack) fRegisterArea(-1), fPCIInfo(info), fStack(stack), - fPortCount(0) + fErstArea(-1), + fDcbaArea(-1), + fSpinlock(B_SPINLOCK_INITIALIZER), + fCmdCompSem(-1), + fCmdCompThread(-1), + fFinishTransfersSem(-1), + fFinishThread(-1), + fStopThreads(false), + fRootHub(NULL), + fRootHubAddress(0), + fPortCount(0), + fSlotCount(0), + fEventIdx(0), + fCmdIdx(0), + fEventCcs(1), + fCmdCcs(1) { if (BusManager::InitCheck() < B_OK) { TRACE_ERROR("bus manager failed to init\n"); @@ -76,7 +91,7 @@ XHCI::XHCI(pci_info *info, Stack *stack) // enable busmaster and memory mapped access uint16 command = sPCIModule->read_pci_config(fPCIInfo->bus, fPCIInfo->device, fPCIInfo->function, PCI_command, 2); - command &= ~PCI_command_io; + command &= ~(PCI_command_io | PCI_command_int_disable); command |= PCI_command_master | PCI_command_memory; sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device, @@ -92,7 +107,7 @@ XHCI::XHCI(pci_info *info, Stack *stack) fPCIInfo->u.h0.base_registers[0], physicalAddress, offset, fPCIInfo->u.h0.base_register_sizes[0]); - fRegisterArea = map_physical_memory("EHCI memory mapped registers", + fRegisterArea = map_physical_memory("XHCI memory mapped registers", physicalAddress, mapSize, B_ANY_KERNEL_BLOCK_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_READ_AREA | B_WRITE_AREA, (void **)&fCapabilityRegisters); @@ -103,62 +118,55 @@ XHCI::XHCI(pci_info *info, Stack *stack) fCapabilityRegisters += offset; fOperationalRegisters = fCapabilityRegisters + ReadCapReg8(XHCI_CAPLENGTH); - fRuntimeRegisters = fCapabilityRegisters + ReadCapReg8(XHCI_RTSOFF); + fRuntimeRegisters = fCapabilityRegisters + ReadCapReg32(XHCI_RTSOFF); + fDoorbellRegisters = fCapabilityRegisters + ReadCapReg32(XHCI_DBOFF); TRACE("mapped capability registers: 0x%08lx\n", (uint32)fCapabilityRegisters); TRACE("mapped operational registers: 0x%08lx\n", (uint32)fOperationalRegisters); TRACE("mapped rumtime registers: 0x%08lx\n", (uint32)fRuntimeRegisters); + TRACE("mapped doorbell registers: 0x%08lx\n", (uint32)fDoorbellRegisters); TRACE("structural parameters1: 0x%08lx\n", ReadCapReg32(XHCI_HCSPARAMS1)); TRACE("structural parameters2: 0x%08lx\n", ReadCapReg32(XHCI_HCSPARAMS2)); TRACE("structural parameters3: 0x%08lx\n", ReadCapReg32(XHCI_HCSPARAMS3)); TRACE("capability parameters: 0x%08lx\n", ReadCapReg32(XHCI_HCCPARAMS)); - // read port count from capability register - fPortCount = (ReadCapReg32(XHCI_HCSPARAMS1) >> 24) & 0x7f; - - uint32 extendedCapPointer = ((ReadCapReg32(XHCI_HCCPARAMS) >> 16) & 0xffff) - << 2; - if (extendedCapPointer > 0) { - TRACE("extended capabilities register at %ld\n", extendedCapPointer); - - uint32 legacySupport = ReadCapReg32(extendedCapPointer); - if ((legacySupport & XHCI_LEGSUP_CAPID_MASK) == XHCI_LEGSUP_CAPID) { - if ((legacySupport & XHCI_LEGSUP_BIOSOWNED) != 0) { - TRACE_ALWAYS("the host controller is bios owned, claiming" - " ownership\n"); - WriteCapReg32(extendedCapPointer, legacySupport - | XHCI_LEGSUP_OSOWNED); - for (int32 i = 0; i < 20; i++) { - legacySupport = ReadCapReg32(extendedCapPointer); - - if ((legacySupport & XHCI_LEGSUP_BIOSOWNED) == 0) - break; - - TRACE_ALWAYS("controller is still bios owned, waiting\n"); - snooze(50000); - } - } - - if (legacySupport & XHCI_LEGSUP_BIOSOWNED) { - TRACE_ERROR("bios won't give up control over the host " - "controller (ignoring)\n"); - } else if (legacySupport & XHCI_LEGSUP_OSOWNED) { - TRACE_ALWAYS("successfully took ownership of the host " - "controller\n"); - } - - // Force off the BIOS owned flag, and clear all SMIs. Some BIOSes - // do indicate a successful handover but do not remove their SMIs - // and then freeze the system when interrupts are generated. - WriteCapReg32(extendedCapPointer, legacySupport & ~XHCI_LEGSUP_BIOSOWNED); - WriteCapReg32(extendedCapPointer + XHCI_LEGCTLSTS, - XHCI_LEGCTLSTS_DISABLE_SMI); - } else { - TRACE("extended capability is not a legacy support register\n"); - } - } else { - TRACE("no extended capabilities register\n"); + uint32 cparams = ReadCapReg32(XHCI_HCCPARAMS); + uint32 eec = 0xffffffff; + uint32 eecp = HCS0_XECP(cparams) << 2; + for (; eecp != 0 && XECP_NEXT(eec); eecp += XECP_NEXT(eec) << 2) { + eec = ReadCapReg32(eecp); + if (XECP_ID(eec) != XHCI_LEGSUP_CAPID) + continue; } + if (eec & XHCI_LEGSUP_BIOSOWNED) { + TRACE_ALWAYS("the host controller is bios owned, claiming" + " ownership\n"); + WriteCapReg32(eecp, eec | XHCI_LEGSUP_OSOWNED); + + for (int32 i = 0; i < 20; i++) { + eec = ReadCapReg32(eecp); + + if ((eec & XHCI_LEGSUP_BIOSOWNED) == 0) + break; + + TRACE_ALWAYS("controller is still bios owned, waiting\n"); + snooze(50000); + } + + if (eec & XHCI_LEGSUP_BIOSOWNED) { + TRACE_ERROR("bios won't give up control over the host " + "controller (ignoring)\n"); + } else if (eec & XHCI_LEGSUP_OSOWNED) { + TRACE_ALWAYS("successfully took ownership of the host " + "controller\n"); + } + + // Force off the BIOS owned flag, and clear all SMIs. Some BIOSes + // do indicate a successful handover but do not remove their SMIs + // and then freeze the system when interrupts are generated. + WriteCapReg32(eecp, eec & ~XHCI_LEGSUP_BIOSOWNED); + } + WriteCapReg32(eecp + XHCI_LEGCTLSTS, XHCI_LEGCTLSTS_DISABLE_SMI); // halt the host controller if (ControllerHalt() < B_OK) { @@ -171,6 +179,28 @@ XHCI::XHCI(pci_info *info, Stack *stack) return; } + fCmdCompSem = create_sem(0, "XHCI Command Complete"); + fFinishTransfersSem = create_sem(0, "XHCI Finish Transfers"); + if (fFinishTransfersSem < B_OK || fCmdCompSem < B_OK) { + TRACE_ERROR("failed to create semaphores\n"); + return; + } + + // create finisher service thread + fFinishThread = spawn_kernel_thread(FinishThread, "xhci finish thread", + B_NORMAL_PRIORITY, (void *)this); + resume_thread(fFinishThread); + + // create command complete service thread + fCmdCompThread = spawn_kernel_thread(CmdCompThread, "xhci cmd complete thread", + B_NORMAL_PRIORITY, (void *)this); + resume_thread(fCmdCompThread); + + // Install the interrupt handler + TRACE("installing interrupt handler\n"); + install_io_interrupt_handler(fPCIInfo->u.h0.interrupt_line, + InterruptHandler, (void *)this, 0); + fInitOK = true; TRACE("XHCI host controller driver constructed\n"); } @@ -182,7 +212,15 @@ XHCI::~XHCI() WriteOpReg(XHCI_CMD, 0); + int32 result = 0; + fStopThreads = true; + delete_sem(fCmdCompSem); + delete_sem(fFinishTransfersSem); delete_area(fRegisterArea); + delete_area(fErstArea); + delete_area(fDcbaArea); + wait_for_thread(fCmdCompThread, &result); + wait_for_thread(fFinishThread, &result); put_module(B_PCI_MODULE_NAME); } @@ -194,7 +232,100 @@ XHCI::Start() TRACE("usbcmd: 0x%08lx; usbsts: 0x%08lx\n", ReadOpReg(XHCI_CMD), ReadOpReg(XHCI_STS)); + if ((ReadOpReg(XHCI_PAGESIZE) & (1 << 0)) == 0) { + TRACE_ERROR("Controller does not support 4K page size.\n"); + return B_ERROR; + } + + // read port count from capability register + uint32 capabilities = ReadCapReg32(XHCI_HCSPARAMS1); + + uint8 portsCount = HCS_MAX_PORTS(capabilities); + if (portsCount == 0) { + TRACE_ERROR("Invalid number of ports: %u\n", portsCount); + return B_ERROR; + } + fPortCount = portsCount; + fSlotCount = HCS_MAX_SLOTS(capabilities); + WriteOpReg(XHCI_CONFIG, fSlotCount); + + void *dmaAddress; + fDcbaArea = fStack->AllocateArea((void **)&fDcba, &dmaAddress, + sizeof(uint64) * XHCI_MAX_SLOTS, "DCBA Area"); + if (fDcbaArea < B_OK) { + TRACE_ERROR("unable to create the DCBA area\n"); + return B_ERROR; + } + memset(fDcba, 0, sizeof(uint64) * XHCI_MAX_SLOTS); + TRACE("setting DCBAAP\n"); + WriteOpReg(XHCI_DCBAAP_LO, (uint32)dmaAddress); + WriteOpReg(XHCI_DCBAAP_HI, 0); + + fErstArea = fStack->AllocateArea((void **)&fErst, &dmaAddress, + (MAX_COMMANDS + MAX_EVENTS) * sizeof(xhci_trb) + + sizeof(xhci_erst_element), + "USB XHCI ERST CMD_RING and EVENT_RING Area"); + + if (fErstArea < B_OK) { + TRACE_ERROR("unable to create the ERST AND RING area\n"); + delete_area(fDcbaArea); + return B_ERROR; + } + memset(fErst, 0, (MAX_COMMANDS + MAX_EVENTS) * sizeof(xhci_trb) + + sizeof(xhci_erst_element)); + + fErst->rs_addr = (uint32)dmaAddress + sizeof(xhci_erst_element); + fErst->rs_size = MAX_EVENTS; + fErst->rsvdz = 0; + + uint32 addr = (uint32)fErst + sizeof(xhci_erst_element); + fEventRing = (xhci_trb *)addr; + addr += MAX_EVENTS * sizeof(xhci_trb); + fCmdRing = (xhci_trb *)addr; + + TRACE("setting ERST size\n"); + WriteRunReg32(XHCI_ERSTSZ(0), XHCI_ERSTS_SET(1)); + + TRACE("setting ERDP addr = 0x%llx\n", fErst->rs_addr); + WriteRunReg32(XHCI_ERDP_LO(0), (uint32)fErst->rs_addr); + WriteRunReg32(XHCI_ERDP_HI(0), (uint32)(fErst->rs_addr >> 32)); + + TRACE("setting ERST base addr = 0x%llx\n", (uint64)dmaAddress); + WriteRunReg32(XHCI_ERSTBA_LO(0), (uint32)dmaAddress); + WriteRunReg32(XHCI_ERSTBA_HI(0), 0); + + addr = fErst->rs_addr + MAX_EVENTS * sizeof(xhci_trb); + TRACE("setting CRCR addr = 0x%llx\n", (uint64)addr); + WriteOpReg(XHCI_CRCR_LO, addr | CRCR_RCS); + WriteOpReg(XHCI_CRCR_HI, 0); + //link trb + fCmdRing[MAX_COMMANDS - 1].qwtrb0 = addr; + + TRACE("setting interrupt rate\n"); + WriteRunReg32(XHCI_IMOD(0), 160);//4000 irq/s + + TRACE("enabling interrupt\n"); + WriteRunReg32(XHCI_IMAN(0), ReadRunReg32(XHCI_IMAN(0)) | IMAN_INTR_ENA); + + WriteOpReg(XHCI_CMD, CMD_RUN | CMD_EIE | CMD_HSEIE); + + fRootHubAddress = AllocateAddress(); + fRootHub = new(std::nothrow) XHCIRootHub(RootObject(), fRootHubAddress); + if (!fRootHub) { + TRACE_ERROR("no memory to allocate root hub\n"); + return B_NO_MEMORY; + } + + if (fRootHub->InitCheck() < B_OK) { + TRACE_ERROR("root hub failed init check\n"); + return fRootHub->InitCheck(); + } + + SetRootHub(fRootHub); + TRACE_ALWAYS("successfully started the controller\n"); + TRACE("No-Op test\n"); + QueueNoop(); return BusManager::Start(); } @@ -202,6 +333,10 @@ XHCI::Start() status_t XHCI::SubmitTransfer(Transfer *transfer) { + // short circuit the root hub + if (transfer->TransferPipe()->DeviceAddress() == fRootHubAddress) + return fRootHub->ProcessTransfer(this, transfer); + return B_OK; } @@ -315,6 +450,46 @@ XHCI::AddTo(Stack *stack) status_t XHCI::GetPortStatus(uint8 index, usb_port_status *status) { + if (index >= fPortCount) + return B_BAD_INDEX; + + status->status = status->change = 0; + uint32 portStatus = ReadOpReg(XHCI_PORTSC(index)); + TRACE("port status=0x%08lx\n", portStatus); + + // build the status + switch(PS_SPEED_GET(portStatus)) { + case 3: + status->status |= PORT_STATUS_HIGH_SPEED; + break; + case 2: + status->status |= PORT_STATUS_LOW_SPEED; + break; + default: + break; + } + + if (portStatus & PS_CCS) + status->status |= PORT_STATUS_CONNECTION; + if (portStatus & PS_PED) + status->status |= PORT_STATUS_ENABLE; + if (portStatus & PS_OCA) + status->status |= PORT_STATUS_OVER_CURRENT; + if (portStatus & PS_PR) + status->status |= PORT_STATUS_RESET; + if (portStatus & PS_PP) + status->status |= PORT_STATUS_POWER; + + // build the change + if (portStatus & PS_CSC) + status->change |= PORT_STATUS_CONNECTION; + if (portStatus & PS_PEC) + status->change |= PORT_STATUS_ENABLE; + if (portStatus & PS_OCC) + status->change |= PORT_STATUS_OVER_CURRENT; + if (portStatus & PS_PRC) + status->change |= PORT_STATUS_RESET; + return B_OK; } @@ -322,6 +497,36 @@ XHCI::GetPortStatus(uint8 index, usb_port_status *status) status_t XHCI::SetPortFeature(uint8 index, uint16 feature) { + TRACE("set port feature index %u feature %u\n", index, feature); + if (index >= fPortCount) + return B_BAD_INDEX; + + uint32 portRegister = XHCI_PORTSC(index); + uint32 portStatus = ReadOpReg(portRegister); + + switch (feature) { + case PORT_SUSPEND: + if ((portStatus & PS_PED ) == 0 || (portStatus & PS_PR) + || (portStatus & PS_PLS_MASK) >= PS_XDEV_U3) { + TRACE_ERROR("USB core suspending device not in U0/U1/U2.\n"); + return B_BAD_VALUE; + } + portStatus &= ~PS_CLEAR; + portStatus &= ~PS_PLS_MASK; + portStatus |= PS_LWS | PS_XDEV_U3; + WriteOpReg(portRegister, portStatus); + return B_OK; + + case PORT_RESET: + portStatus &= ~PS_CLEAR; + WriteOpReg(portRegister, portStatus | PS_PR); + return B_OK; + + case PORT_POWER: + portStatus &= ~PS_CLEAR; + WriteOpReg(portRegister, portStatus | PS_PP); + return B_OK; + } return B_BAD_VALUE; } @@ -329,26 +534,51 @@ XHCI::SetPortFeature(uint8 index, uint16 feature) status_t XHCI::ClearPortFeature(uint8 index, uint16 feature) { + TRACE("clear port feature index %u feature %u\n", index, feature); + if (index >= fPortCount) + return B_BAD_INDEX; + + uint32 portRegister = XHCI_PORTSC(index); + uint32 portStatus = ReadOpReg(portRegister); + portStatus &= ~PS_CLEAR; + + switch (feature) { + case PORT_SUSPEND: + portStatus = ReadOpReg(portRegister); + if (portStatus & PS_PR) + return B_BAD_VALUE; + if (portStatus & PS_XDEV_U3) { + if ((portStatus & PS_PED) == 0) + return B_BAD_VALUE; + portStatus &= ~PS_CLEAR; + portStatus &= ~PS_PLS_MASK; + WriteOpReg(portRegister, portStatus | PS_XDEV_U0 | PS_LWS); + } + return B_OK; + case PORT_ENABLE: + WriteOpReg(portRegister, portStatus | PS_PED); + return B_OK; + case PORT_POWER: + WriteOpReg(portRegister, portStatus & ~PS_PP); + return B_OK; + case C_PORT_CONNECTION: + WriteOpReg(portRegister, portStatus | PS_CSC); + return B_OK; + case C_PORT_ENABLE: + WriteOpReg(portRegister, portStatus | PS_PEC); + return B_OK; + case C_PORT_OVER_CURRENT: + WriteOpReg(portRegister, portStatus | PS_OCC); + return B_OK; + case C_PORT_RESET: + WriteOpReg(portRegister, portStatus | PS_PRC); + return B_OK; + } + return B_BAD_VALUE; } -status_t -XHCI::ResetPort(uint8 index) -{ - TRACE("reset port %d\n", index); - - return B_OK; -} - - -status_t -XHCI::SuspendPort(uint8 index) -{ - return B_OK; -} - - status_t XHCI::ControllerHalt() { @@ -388,13 +618,6 @@ XHCI::ControllerReset() } -status_t -XHCI::LightReset() -{ - return B_ERROR; -} - - int32 XHCI::InterruptHandler(void *data) { @@ -405,11 +628,215 @@ XHCI::InterruptHandler(void *data) int32 XHCI::Interrupt() { + acquire_spinlock(&fSpinlock); + + uint32 status = ReadOpReg(XHCI_STS); + uint32 temp = ReadRunReg32(XHCI_IMAN(0)); + WriteOpReg(XHCI_STS, status); + WriteRunReg32(XHCI_IMAN(0), temp); + TRACE("STS: %lx IRQ_PENDING: %lx\n", status, temp); + int32 result = B_HANDLED_INTERRUPT; + + if (status & STS_HSE) { + TRACE_ERROR("Host System Error\n"); + return result; + } + if (status & STS_HCE) { + TRACE_ERROR("Host Controller Error\n"); + return result; + } + uint16 i = fEventIdx; + uint8 j = fEventCcs; + uint8 t = 2; + + while (1) { + temp = fEventRing[i].dwtrb3; + uint8 k = (temp & TRB_3_CYCLE_BIT) ? 1 : 0; + if (j != k) + break; + + uint8 event = TRB_TYPE_GET(temp); + + TRACE("event[%u] = %u (0x%016llx 0x%08lx 0x%08lx)\n", i, event, + fEventRing[i].qwtrb0, fEventRing[i].dwtrb2, fEventRing[i].dwtrb3); + switch (event) { + case TRB_COMPLETION: + HandleCmdComplete(&fEventRing[i]); + result = B_INVOKE_SCHEDULER; + break; + default: + TRACE_ERROR("Unhandled event = %u\n", event); + break; + } + + i++; + if (i == MAX_EVENTS) { + i = 0; + j ^= 1; + if (!--t) + break; + } + } + + fEventIdx = i; + fEventCcs = j; + + uint64 addr = fErst->rs_addr + i * sizeof(xhci_trb); + addr |= ERST_EHB; + WriteRunReg32(XHCI_ERDP_LO(0), (uint32)addr); + WriteRunReg32(XHCI_ERDP_HI(0), (uint32)(addr >> 32)); + + + release_spinlock(&fSpinlock); return result; } + +void +XHCI::Ring() +{ + TRACE("Ding Dong!\n") + WriteDoorReg32(XHCI_DOORBELL(0), 0); + /* Flush PCI posted writes */ + ReadDoorReg32(XHCI_DOORBELL(0)); +} + + +void +XHCI::QueueCommand(xhci_trb *trb) +{ + uint8 i, j; + uint32 temp; + + i = fCmdIdx; + j = fCmdCcs; + + TRACE("command[%u] = %lx (0x%016llx, 0x%08lx, 0x%08lx)\n", + i, TRB_TYPE_GET(trb->dwtrb3), + trb->qwtrb0, trb->dwtrb2, trb->dwtrb3); + + fCmdRing[i].qwtrb0 = trb->qwtrb0; + fCmdRing[i].dwtrb2 = trb->dwtrb2; + temp = trb->dwtrb3; + + if (j) + temp |= TRB_3_CYCLE_BIT; + else + temp &= ~TRB_3_CYCLE_BIT; + temp &= ~TRB_3_TC_BIT; + fCmdRing[i].dwtrb3 = temp; + + fCmdAddr = fErst->rs_addr + (MAX_EVENTS + i) * sizeof(xhci_trb); + + i++; + + if (i == (MAX_COMMANDS - 1)) { + if (j) + temp = TRB_3_CYCLE_BIT | TRB_TYPE(TRB_LINK); + else + temp = TRB_TYPE(TRB_LINK); + fCmdRing[i].dwtrb3 = temp; + + i = 0; + j ^= 1; + } + + fCmdIdx = i; + fCmdCcs = j; +} + + +void +XHCI::HandleCmdComplete(xhci_trb *trb) +{ + if (fCmdAddr == trb->qwtrb0) { + TRACE("Received command event\n"); + fCmdResult[0] = trb->dwtrb2; + fCmdResult[1] = trb->dwtrb3; + release_sem_etc(fCmdCompSem, 1, B_DO_NOT_RESCHEDULE); + } + +} + + +void +XHCI::QueueNoop() +{ + xhci_trb trb; + uint32 temp; + + trb.qwtrb0 = 0; + trb.dwtrb2 = 0; + temp = TRB_TYPE(TRB_TR_NOOP); + trb.dwtrb3 = temp; + cpu_status state = disable_interrupts(); + acquire_spinlock(&fSpinlock); + QueueCommand(&trb); + Ring(); + release_spinlock(&fSpinlock); + restore_interrupts(state); +} + + +int32 +XHCI::CmdCompThread(void *data) +{ + ((XHCI *)data)->CmdComplete(); + return B_OK; +} + + +void +XHCI::CmdComplete() +{ + while (!fStopThreads) { + if (acquire_sem(fCmdCompSem) < B_OK) + continue; + + // eat up sems that have been released by multiple interrupts + int32 semCount = 0; + get_sem_count(fCmdCompSem, &semCount); + if (semCount > 0) + acquire_sem_etc(fCmdCompSem, semCount, B_RELATIVE_TIMEOUT, 0); + + TRACE("Command Complete\n"); + if (COMP_CODE_GET(fCmdResult[0]) != COMP_SUCCESS) { + TRACE_ERROR("unsuccessful no-op command\n"); + //continue; + } + snooze(1000000 * 5); + QueueNoop(); + } +} + + +int32 +XHCI::FinishThread(void *data) +{ + ((XHCI *)data)->FinishTransfers(); + return B_OK; +} + + +void +XHCI::FinishTransfers() +{ + while (!fStopThreads) { + if (acquire_sem(fFinishTransfersSem) < B_OK) + continue; + + // eat up sems that have been released by multiple interrupts + int32 semCount = 0; + get_sem_count(fFinishTransfersSem, &semCount); + if (semCount > 0) + acquire_sem_etc(fFinishTransfersSem, semCount, B_RELATIVE_TIMEOUT, 0); + + TRACE("finishing transfers\n"); + } +} + inline void XHCI::WriteOpReg(uint32 reg, uint32 value) { @@ -451,3 +878,30 @@ XHCI::WriteCapReg32(uint32 reg, uint32 value) *(volatile uint32 *)(fCapabilityRegisters + reg) = value; } + +inline uint32 +XHCI::ReadRunReg32(uint32 reg) +{ + return *(volatile uint32 *)(fRuntimeRegisters + reg); +} + + +inline void +XHCI::WriteRunReg32(uint32 reg, uint32 value) +{ + *(volatile uint32 *)(fRuntimeRegisters + reg) = value; +} + + +inline uint32 +XHCI::ReadDoorReg32(uint32 reg) +{ + return *(volatile uint32 *)(fDoorbellRegisters + reg); +} + + +inline void +XHCI::WriteDoorReg32(uint32 reg, uint32 value) +{ + *(volatile uint32 *)(fDoorbellRegisters + reg) = value; +} diff --git a/src/add-ons/kernel/busses/usb/xhci.h b/src/add-ons/kernel/busses/usb/xhci.h index 6a8867ae88..1bc99ab79e 100644 --- a/src/add-ons/kernel/busses/usb/xhci.h +++ b/src/add-ons/kernel/busses/usb/xhci.h @@ -14,8 +14,43 @@ #include "xhci_hardware.h" +#define MAX_EVENTS (16 * 13) +#define MAX_COMMANDS (16 * 1) +#define XHCI_MAX_SLOTS 256 +#define XHCI_MAX_PORTS 127 + + struct pci_info; struct pci_module_info; +class XHCIRootHub; + + +struct xhci_trb { + uint64 qwtrb0; + uint32 dwtrb2; + uint32 dwtrb3; +}; + + +struct xhci_segment { + xhci_trb * trbs; + xhci_segment * next; +}; + + +struct xhci_ring { + xhci_segment * first_seg; + xhci_trb * enqueue; + xhci_trb * dequeue; +}; + + +// Section 6.5 +struct xhci_erst_element { + uint64 rs_addr; + uint32 rs_size; + uint32 rsvdz; +} __attribute__((__aligned__(64))); class XHCI : public BusManager { @@ -32,51 +67,107 @@ public: static status_t AddTo(Stack *stack); - // Port operations for root hub + // Port operations for root hub uint8 PortCount() { return fPortCount; }; status_t GetPortStatus(uint8 index, usb_port_status *status); status_t SetPortFeature(uint8 index, uint16 feature); status_t ClearPortFeature(uint8 index, uint16 feature); - status_t ResetPort(uint8 index); - status_t SuspendPort(uint8 index); - virtual const char * TypeName() const { return "xhci"; }; private: - // Controller resets + // Controller resets status_t ControllerReset(); status_t ControllerHalt(); - status_t LightReset(); - // Interrupt functions + // Interrupt functions static int32 InterruptHandler(void *data); int32 Interrupt(); + // Transfer management + static int32 FinishThread(void *data); + void FinishTransfers(); - // Operational register functions + // Command + void QueueCommand(xhci_trb *trb); + void HandleCmdComplete(xhci_trb *trb); + + //Doorbell + void Ring(); + + //no-op + void QueueNoop(); + static int32 CmdCompThread(void *data); + void CmdComplete(); + + // Operational register functions inline void WriteOpReg(uint32 reg, uint32 value); inline uint32 ReadOpReg(uint32 reg); - // Capability register functions + // Capability register functions inline uint8 ReadCapReg8(uint32 reg); inline uint16 ReadCapReg16(uint32 reg); inline uint32 ReadCapReg32(uint32 reg); inline void WriteCapReg32(uint32 reg, uint32 value); + // Runtime register functions + inline uint32 ReadRunReg32(uint32 reg); + inline void WriteRunReg32(uint32 reg, uint32 value); + + // Doorbell register functions + inline uint32 ReadDoorReg32(uint32 reg); + inline void WriteDoorReg32(uint32 reg, uint32 value); + static pci_module_info * sPCIModule; uint8 * fCapabilityRegisters; uint8 * fOperationalRegisters; uint8 * fRuntimeRegisters; + uint8 * fDoorbellRegisters; area_id fRegisterArea; pci_info * fPCIInfo; Stack * fStack; - // Root Hub + area_id fErstArea; + xhci_erst_element * fErst; + xhci_trb * fEventRing; + xhci_trb * fCmdRing; + uint64 fCmdAddr; + uint32 fCmdResult[2]; - // Port management + area_id fDcbaArea; + uint8 * fDcba; + + spinlock fSpinlock; + + sem_id fCmdCompSem; + thread_id fCmdCompThread; + sem_id fFinishTransfersSem; + thread_id fFinishThread; + bool fStopThreads; + + // Root Hub + XHCIRootHub * fRootHub; + uint8 fRootHubAddress; + + // Port management uint8 fPortCount; + uint8 fSlotCount; + + uint16 fEventIdx; + uint16 fCmdIdx; + uint8 fEventCcs; + uint8 fCmdCcs; +}; + + +class XHCIRootHub : public Hub { +public: + XHCIRootHub(Object *rootObject, + int8 deviceAddress); + +static status_t ProcessTransfer(XHCI *ehci, + Transfer *transfer); }; diff --git a/src/add-ons/kernel/busses/usb/xhci_hardware.h b/src/add-ons/kernel/busses/usb/xhci_hardware.h index 7d832362b0..ea4238c54d 100644 --- a/src/add-ons/kernel/busses/usb/xhci_hardware.h +++ b/src/add-ons/kernel/busses/usb/xhci_hardware.h @@ -13,31 +13,71 @@ #define XHCI_CAPLENGTH 0x00 // Capability Register Length #define XHCI_HCIVERSION 0x02 // Interface Version Number #define XHCI_HCSPARAMS1 0x04 // Structural Parameters 1 +// HCSPARAMS1 +#define HCS_MAX_SLOTS(p) (((p) >> 0) & 0xff) +#define HCS_MAX_PORTS(p) (((p) >> 24) & 0x7f) #define XHCI_HCSPARAMS2 0x08 // Structural Parameters 2 #define XHCI_HCSPARAMS3 0x0C // Structural Parameters 3 #define XHCI_HCCPARAMS 0x10 // Capability Parameters +#define XHCI_DBOFF 0x14 // Doorbell Register offset #define XHCI_RTSOFF 0x18 // Runtime Register Space offset // Host Controller Operational Registers #define XHCI_CMD 0x00 // USB Command -#define XHCI_STS 0x04 // USB Status - - // USB Command Register +#define CMD_RUN (1 << 0) #define CMD_HCRST (1 << 1) // Host Controller Reset +#define CMD_EIE (1 << 2) +#define CMD_HSEIE (1 << 3) - +#define XHCI_STS 0x04 // USB Status // USB Status Register -#define STS_HCH (1<<0) +#define STS_HCH (1 << 0) +#define STS_HSE (1 << 2) +#define STS_PCD (1 << 4) #define STS_CNR (1<<11) +#define STS_HCE (1 << 12) +#define XHCI_PAGESIZE 0x08 // PAGE SIZE +// Section 5.4.5 +#define XHCI_CRCR_LO 0x18 +#define XHCI_CRCR_HI 0x1C +#define CRCR_RCS (1<<0) +// Section 5.4.6 +#define XHCI_DCBAAP_LO 0x30 +#define XHCI_DCBAAP_HI 0x34 +// Section 5.4.7 +#define XHCI_CONFIG 0x38 +// Host Controller Runtime Registers +// Section 5.5.2.1 +#define XHCI_IMAN(n) (0x0020 + (0x20 * (n))) +// IMAN +#define IMAN_INTR_ENA 0x00000002 +// Section 5.5.2.2 +#define XHCI_IMOD(n) (0x0024 + (0x20 * (n))) +// Section 5.5.2.3.1 +#define XHCI_ERSTSZ(n) (0x0028 + (0x20 * (n))) +// ERSTSZ +#define XHCI_ERSTS_SET(x) ((x) & 0xFFFF) +// Section 5.5.2.3.2 +#define XHCI_ERSTBA_LO(n) (0x0030 + (0x20 * (n))) +#define XHCI_ERSTBA_HI(n) (0x0034 + (0x20 * (n))) +// Section 5.5.2.3.3 +#define XHCI_ERDP_LO(n) (0x0038 + (0x20 * (n))) +#define XHCI_ERDP_HI(n) (0x003C + (0x20 * (n))) +// Event Handler Busy (EHB) +#define ERST_EHB (1 << 3) +// Host Controller Doorbell Registers +#define XHCI_DOORBELL(n) (0x0000 + (4 * (n))) // Extended Capabilities -#define XHCI_LEGSUP_CAPID_MASK 0xff +#define XECP_ID(x) ((x) & 0xff) +#define HCS0_XECP(x) (((x) >> 16) & 0xffff) +#define XECP_NEXT(x) (((x) >> 8) & 0xff) #define XHCI_LEGSUP_CAPID 0x01 #define XHCI_LEGSUP_OSOWNED (1 << 24) // OS Owned Semaphore #define XHCI_LEGSUP_BIOSOWNED (1 << 16) // BIOS Owned Semaphore @@ -46,5 +86,48 @@ #define XHCI_LEGCTLSTS_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) -#endif // !XHCI_HARDWARE_H +// Port status Registers +// Section 5.4.8 +#define XHCI_PORTSC(n) (0x3F0 + (0x10 * (n))) +#define PS_CCS (1 << 0) +#define PS_PED (1 << 1) +#define PS_OCA (1 << 3) +#define PS_PR (1 << 4) +#define PS_PP (1 << 9) +#define PS_SPEED_GET(x) (((x) >> 10) & 0xF) +#define PS_LWS (1 << 16) +#define PS_CSC (1 << 17) +#define PS_PEC (1 << 18) +#define PS_WRC (1 << 19) +#define PS_OCC (1 << 20) +#define PS_PRC (1 << 21) +#define PS_PLC (1 << 22) +#define PS_CEC (1 << 23) +#define PS_CAS (1 << 24) +#define PS_WCE (1 << 25) +#define PS_WDE (1 << 26) +#define PS_WPR (1 << 30) +#define PS_CLEAR 0x80FF00F7U + +#define PS_PLS_MASK (0xf << 5) +#define PS_XDEV_U0 (0x0 << 5) +#define PS_XDEV_U3 (0x3 << 5) + + +// Completion Code +#define COMP_CODE_GET(x) (((x) >> 24) & 0xff) +#define COMP_SUCCESS 0x01 + + +// TRB Type +#define TRB_TYPE(x) ((x) << 10) +#define TRB_TYPE_GET(x) (((x) >> 10) & 0x3F) +#define TRB_LINK 6 +#define TRB_TR_NOOP 8 +#define TRB_TRANSFER 32 +#define TRB_COMPLETION 33 +#define TRB_3_CYCLE_BIT (1U << 0) +#define TRB_3_TC_BIT (1U << 1) + +#endif // !XHCI_HARDWARE_H diff --git a/src/add-ons/kernel/busses/usb/xhci_rh.cpp b/src/add-ons/kernel/busses/usb/xhci_rh.cpp new file mode 100644 index 0000000000..7b7cbd3894 --- /dev/null +++ b/src/add-ons/kernel/busses/usb/xhci_rh.cpp @@ -0,0 +1,281 @@ +/* + * Copyright 2011, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Lotz + * Jian Chiang + */ + + +#define TRACE_USB +#include "xhci.h" + +#define USB_MODULE_NAME "xhci roothub" + +static usb_device_descriptor sXHCIRootHubDevice = +{ + 18, // Descriptor length + USB_DESCRIPTOR_DEVICE, // Descriptor type + 0x300, // USB 3.0 + 0x09, // Class (9 = Hub) + 0, // Subclass + 3, // Protocol + 9, // Max packet size on endpoint 0 + 0, // Vendor ID + 0, // Product ID + 0x003, // Version + 1, // Index of manufacturer string + 2, // Index of product string + 0, // Index of serial number string + 1 // Number of configurations +}; + + +struct usb_endpoint_ss_comp_descriptor { + uint8 length; + uint8 descriptor_type; + uint16 burst; + uint8 attributes; + uint16 internal; +} _PACKED; + + +struct xhci_root_hub_configuration_s { + usb_configuration_descriptor configuration; + usb_interface_descriptor interface; + usb_endpoint_descriptor endpoint; + usb_endpoint_ss_comp_descriptor endpc; + usb_hub_descriptor hub; +} _PACKED; + + +static xhci_root_hub_configuration_s sXHCIRootHubConfig = +{ + { // configuration descriptor + 9, // Descriptor length + USB_DESCRIPTOR_CONFIGURATION, // Descriptor type + sizeof(sXHCIRootHubConfig), // Total length of configuration (including + // interface, endpoint and hub descriptors) + 1, // Number of interfaces + 1, // Value of this configuration + 0, // Index of configuration string + 0x40, // Attributes (0x40 = self powered) + 0 // Max power (0, since self powered) + }, + + { // interface descriptor + 9, // Descriptor length + USB_DESCRIPTOR_INTERFACE, // Descriptor type + 0, // Interface number + 0, // Alternate setting + 1, // Number of endpoints + 0x09, // Interface class (9 = Hub) + 0, // Interface subclass + 0, // Interface protocol + 0 // Index of interface string + }, + + { // endpoint descriptor + 7, // Descriptor length + USB_DESCRIPTOR_ENDPOINT, // Descriptor type + USB_REQTYPE_DEVICE_IN | 1, // Endpoint address (first in IN endpoint) + 0x03, // Attributes (0x03 = interrupt endpoint) + 2, // Max packet size + 0xff // Interval + }, + + { // endpoint companion descriptor + 7, + 0x30, + 0, + 0, + 0 + }, + + { // hub descriptor + 9, // Descriptor length (including + // deprecated power control mask) + USB_DESCRIPTOR_HUB, // Descriptor type + 0x0f, // Number of ports + 0x0000, // Hub characteristics + 10, // Power on to power good (in 2ms units) + 0, // Maximum current (in mA) + 0x00, // All ports are removable + 0xff // Deprecated power control mask + } +}; + + +struct xhci_root_hub_string_s { + uint8 length; + uint8 descriptor_type; + uint16 unicode_string[12]; +} _PACKED; + + +static xhci_root_hub_string_s sXHCIRootHubStrings[3] = { + { + 4, // Descriptor length + USB_DESCRIPTOR_STRING, // Descriptor type + { + 0x0409 // Supported language IDs (English US) + } + }, + + { + 22, // Descriptor length + USB_DESCRIPTOR_STRING, // Descriptor type + { + 'H', 'A', 'I', 'K', 'U', // Characters + ' ', 'I', 'n', 'c', '.' + } + }, + + { + 26, // Descriptor length + USB_DESCRIPTOR_STRING, // Descriptor type + { + 'X', 'H', 'C', 'I', ' ', // Characters + 'R', 'o', 'o', 't', 'H', + 'u', 'b' + } + } +}; + + +XHCIRootHub::XHCIRootHub(Object *rootObject, int8 deviceAddress) + : Hub(rootObject, 0, rootObject->GetStack()->IndexOfBusManager(rootObject->GetBusManager()), + sXHCIRootHubDevice, deviceAddress, USB_SPEED_SUPER, true) +{ +} + + +status_t +XHCIRootHub::ProcessTransfer(XHCI *xhci, Transfer *transfer) +{ + if ((transfer->TransferPipe()->Type() & USB_OBJECT_CONTROL_PIPE) == 0) + return B_ERROR; + + usb_request_data *request = transfer->RequestData(); + TRACE_MODULE("request: %d\n", request->Request); + + status_t status = B_TIMED_OUT; + size_t actualLength = 0; + switch (request->Request) { + case USB_REQUEST_GET_STATUS: { + if (request->Index == 0) { + // get hub status + actualLength = MIN(sizeof(usb_port_status), + transfer->DataLength()); + // the hub reports whether the local power failed (bit 0) + // and if there is a over-current condition (bit 1). + // everything as 0 means all is ok. + memset(transfer->Data(), 0, actualLength); + status = B_OK; + break; + } + + usb_port_status portStatus; + if (xhci->GetPortStatus(request->Index - 1, &portStatus) >= B_OK) { + actualLength = MIN(sizeof(usb_port_status), transfer->DataLength()); + memcpy(transfer->Data(), (void *)&portStatus, actualLength); + status = B_OK; + } + + break; + } + + case USB_REQUEST_SET_ADDRESS: + if (request->Value >= 128) { + status = B_TIMED_OUT; + break; + } + + TRACE_MODULE("set address: %d\n", request->Value); + status = B_OK; + break; + + case USB_REQUEST_GET_DESCRIPTOR: + TRACE_MODULE("get descriptor: %d\n", request->Value >> 8); + + switch (request->Value >> 8) { + case USB_DESCRIPTOR_DEVICE: { + actualLength = MIN(sizeof(usb_device_descriptor), + transfer->DataLength()); + memcpy(transfer->Data(), (void *)&sXHCIRootHubDevice, + actualLength); + status = B_OK; + break; + } + + case USB_DESCRIPTOR_CONFIGURATION: { + actualLength = MIN(sizeof(xhci_root_hub_configuration_s), + transfer->DataLength()); + sXHCIRootHubConfig.hub.num_ports = xhci->PortCount(); + memcpy(transfer->Data(), (void *)&sXHCIRootHubConfig, + actualLength); + status = B_OK; + break; + } + + case USB_DESCRIPTOR_STRING: { + uint8 index = request->Value & 0x00ff; + if (index > 2) + break; + + actualLength = MIN(sXHCIRootHubStrings[index].length, + transfer->DataLength()); + memcpy(transfer->Data(), (void *)&sXHCIRootHubStrings[index], + actualLength); + status = B_OK; + break; + } + + case USB_DESCRIPTOR_HUB: { + actualLength = MIN(sizeof(usb_hub_descriptor), + transfer->DataLength()); + sXHCIRootHubConfig.hub.num_ports = xhci->PortCount(); + memcpy(transfer->Data(), (void *)&sXHCIRootHubConfig.hub, + actualLength); + status = B_OK; + break; + } + } + break; + + case USB_REQUEST_SET_CONFIGURATION: + status = B_OK; + break; + + case USB_REQUEST_CLEAR_FEATURE: { + if (request->Index == 0) { + // we don't support any hub changes + TRACE_MODULE_ERROR("clear feature: no hub changes\n"); + break; + } + + TRACE_MODULE("clear feature: %d\n", request->Value); + if (xhci->ClearPortFeature(request->Index - 1, request->Value) >= B_OK) + status = B_OK; + break; + } + + case USB_REQUEST_SET_FEATURE: { + if (request->Index == 0) { + // we don't support any hub changes + TRACE_MODULE_ERROR("set feature: no hub changes\n"); + break; + } + + TRACE_MODULE("set feature: %d\n", request->Value); + if (xhci->SetPortFeature(request->Index - 1, request->Value) >= B_OK) + status = B_OK; + break; + } + } + + transfer->Finished(status, actualLength); + delete transfer; + return B_OK; +} From 42a6ef881dce6c1713878d8b5f25f552bdb1a63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 29 Jul 2011 10:15:49 +0000 Subject: [PATCH 068/702] Add Jian Jiang to the contributors list. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42512 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/aboutsystem/AboutSystem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 6ccfb49c57..6404c94ad6 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -1077,6 +1077,7 @@ AboutView::_CreateCreditsView() "Mathew Hounsell\n" "Morgan Howe\n" "Christophe Huriaux\n" + "Jian Jiang\n" "Ma Jie\n" "Carwyn Jones\n" "Vasilis Kaoutsis\n" From f148b5ee0415b48a855f64c2a24cd4741c4358f2 Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Sat, 30 Jul 2011 16:05:28 +0000 Subject: [PATCH 069/702] Applied taos patch to fix the MIT license link. We'll see if it finally nailed the bugger when the translated catkeys arrive. Preliminarily fixes #7697. Thanks a lot. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42514 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/aboutsystem/AboutSystem.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 6404c94ad6..0e85b30c3a 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -1236,26 +1236,26 @@ AboutView::_CreateCreditsView() "respective license.]\n\n")); // Haiku license - BString haikuLicence = B_TRANSLATE("The code that is unique to Haiku, " + BString haikuLicense = B_TRANSLATE("The code that is unique to Haiku, " "especially the kernel and all code that applications may link " - "against, is distributed under the terms of the %MIT licence%. " + "against, is distributed under the terms of the %MIT license%. " "Some system libraries contain third party code distributed under the " "LGPL license. You can find the copyrights to third party code below.\n" "\n"); - int32 licencePart1 = haikuLicence.FindFirst("%"); - int32 licencePart2 = haikuLicence.FindLast("%"); + int32 licensePart1 = haikuLicense.FindFirst("%"); + int32 licensePart2 = haikuLicense.FindLast("%"); BString part; - haikuLicence.CopyCharsInto(part, 0, licencePart1 ); + haikuLicense.CopyInto(part, 0, licensePart1); fCreditsView->Insert(part); part.Truncate(0); - haikuLicence.CopyCharsInto(part, licencePart1 + 1, licencePart2 - 1 - - licencePart1); + haikuLicense.CopyInto(part, licensePart1 + 1, licensePart2 - 1 + - licensePart1); fCreditsView->InsertHyperText(part, new OpenFileAction(mitPath.Path())); part.Truncate(0); - haikuLicence.CopyCharsInto(part, licencePart2 + 1, haikuLicence.CountChars() - - licencePart2); + haikuLicense.CopyInto(part, licensePart2 + 1, haikuLicense.Length() - 1 + - licensePart2); fCreditsView->Insert(part); // GNU copyrights From 6ab8261b98f59b9751c7178a4df66bf1ae0fa66e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 30 Jul 2011 17:45:14 +0000 Subject: [PATCH 070/702] * Pass device name into shared info * Refactor MCFBsetup to be a little simpler for now * Implement radeon accelerant_device_info for screen preflet * Re-add CRT Power calls to display code. * Disable blanking setting for now... just can't figure out what AMD wants for this. * Remove some un-needed locking in the scaling code * Be sure to disable VGA when set_display_mode is called * Refactor mode setting code to loop over all possible displays and set the provided mode on the attached ones. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42515 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 13 +++ .../accelerants/radeon_hd/accelerant_protos.h | 2 + src/add-ons/accelerants/radeon_hd/display.cpp | 27 +++++ src/add-ons/accelerants/radeon_hd/display.h | 1 + src/add-ons/accelerants/radeon_hd/hooks.cpp | 5 +- src/add-ons/accelerants/radeon_hd/mc.cpp | 41 ++----- src/add-ons/accelerants/radeon_hd/mc.h | 10 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 100 ++++++++++++------ .../drivers/graphics/radeon_hd/radeon_hd.cpp | 2 + 9 files changed, 128 insertions(+), 73 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 144503263d..5ff839cf3f 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -244,3 +244,16 @@ radeon_uninit_accelerant(void) TRACE("%s done\n", __func__); } + +status_t +radeon_get_accelerant_device_info(accelerant_device_info *di) +{ + di->version = B_ACCELERANT_VERSION; + strcpy(di->name, gInfo->shared_info->device_identifier); + strcpy(di->chipset, "radeon_hd"); + // TODO : Give chipset, ex: r600 + strcpy(di->serial_no, "None" ); + + di->memory = gInfo->shared_info->graphics_memory_size; + return B_OK; +} diff --git a/src/add-ons/accelerants/radeon_hd/accelerant_protos.h b/src/add-ons/accelerants/radeon_hd/accelerant_protos.h index 7bd8b63e4c..5febcc59c6 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant_protos.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant_protos.h @@ -18,11 +18,13 @@ extern "C" { #endif + void spin(bigtime_t delay); // general status_t radeon_init_accelerant(int fd); void radeon_uninit_accelerant(void); +status_t radeon_get_accelerant_device_info(accelerant_device_info *di); // modes & constraints uint32 radeon_accelerant_mode_count(void); diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 8cc1e197a7..47393bbd0e 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -301,3 +301,30 @@ debug_displays() } + +void +display_power(uint8 crtid, int command) +{ + register_info* regs = gDisplay[crtid]->regs; + + switch (command) { + case RHD_POWER_ON: + Write32Mask(OUT, regs->grphEnable, 0x00000001, 0x00000001); + snooze(2); + Write32Mask(OUT, regs->crtControl, 0, 0x01000000); + // Enable read requests + Write32Mask(OUT, regs->crtControl, 1, 1); + return; + case RHD_POWER_RESET: + Write32Mask(OUT, regs->crtControl, 0x01000000, 0x01000000); + // Disable read requestes + //D1CRTCDisable? + return; + case RHD_POWER_SHUTDOWN: + Write32Mask(OUT, regs->crtControl, 0x01000000, 0x01000000); + // Disable read requests + //D1CRTCDisable? + Write32Mask(OUT, regs->grphEnable, 0x00000001, 0x00000001); + return; + } +} diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 14d6247ca8..20286bfc82 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -13,6 +13,7 @@ status_t init_registers(register_info* reg, uint8 crtid); status_t detect_crt_ranges(uint32 crtid); status_t detect_displays(); void debug_displays(); +void display_power(uint8 crtid, int command); #endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/hooks.cpp b/src/add-ons/accelerants/radeon_hd/hooks.cpp index 0f687a43c7..68c4ea737d 100644 --- a/src/add-ons/accelerants/radeon_hd/hooks.cpp +++ b/src/add-ons/accelerants/radeon_hd/hooks.cpp @@ -26,11 +26,14 @@ get_accelerant_hook(uint32 feature, void *data) return (void*)radeon_accelerant_clone_info_size; case B_GET_ACCELERANT_CLONE_INFO: return (void*)radeon_get_accelerant_clone_info; + */ case B_GET_ACCELERANT_DEVICE_INFO: return (void*)radeon_get_accelerant_device_info; + /* case B_ACCELERANT_RETRACE_SEMAPHORE: return (void*)radeon_accelerant_retrace_semaphore; -*/ + */ + /* mode configuration */ case B_ACCELERANT_MODE_COUNT: return (void*)radeon_accelerant_mode_count; diff --git a/src/add-ons/accelerants/radeon_hd/mc.cpp b/src/add-ons/accelerants/radeon_hd/mc.cpp index 8c6244b0f7..da514ecfdf 100644 --- a/src/add-ons/accelerants/radeon_hd/mc.cpp +++ b/src/add-ons/accelerants/radeon_hd/mc.cpp @@ -28,17 +28,6 @@ extern "C" void _sPrintf(const char *format, ...); #endif -uint64 -MCFBLocation(uint16 chipset, uint32* size) -{ - // TODO : R800 : This is only valid for all R6xx and R7xx? - uint32 fbLocationReg = Read32(MC, R7XX_MC_VM_FB_LOCATION); - *size = (((fbLocationReg & 0xFFFF0000) - - ((fbLocationReg & 0xFFFF) << 16))) << 8; - return (fbLocationReg & 0xFFFF) << 24; -} - - uint32 MCIdle() { @@ -53,22 +42,15 @@ MCIdle() status_t -MCFBSetup(uint32 newFbLocation, uint32 newFbSize) +MCFBSetup() { - uint32 oldFbSize; - uint64 oldFbLocation = MCFBLocation(0, &oldFbSize); + uint32 fb_location_int = gInfo->shared_info->frame_buffer_int; - if (oldFbLocation == newFbLocation - && oldFbSize == newFbSize) { - TRACE("%s: not adjusting frame buffer as it is already correct\n", - __func__); - return B_OK; - } - - if (oldFbLocation >> 32) { - TRACE("%s: board claims to use a frame buffer address > 32-bits\n", - __func__); - } + uint32 fb_location = Read32(OUT, R6XX_MC_VM_FB_LOCATION); + uint16 fb_size = (fb_location >> 16) - (fb_location & 0xFFFF); + uint32 fb_location_tmp = fb_location_int >> 24; + fb_location_tmp |= (fb_location_tmp + fb_size) << 16; + uint32 fb_offset_tmp = (fb_location_int >> 8) & 0xff0000; uint32 idleState = MCIdle(); if (idleState > 0) { @@ -77,13 +59,12 @@ MCFBSetup(uint32 newFbLocation, uint32 newFbSize) return B_ERROR; } - TRACE("%s: Setting MC/FB from 0x%08X to 0x%08X [size 0x%08X]\n", - __func__, oldFbLocation, newFbLocation, newFbSize); + TRACE("%s: Setting frame buffer from 0x%08X to 0x%08X [size 0x%08X]\n", + __func__, fb_location, fb_location_tmp, fb_size); // The MC Write32 will handle cards needing a special MC read/write register - Write32(MC, R6XX_MC_VM_FB_LOCATION, - R6XX_FB_LOCATION(newFbLocation, newFbSize)); - Write32(MC, R6XX_HDP_NONSURFACE_BASE, R6XX_HDP_LOCATION(newFbLocation)); + Write32(MC, R6XX_MC_VM_FB_LOCATION, fb_location_tmp); + Write32(MC, R6XX_HDP_NONSURFACE_BASE, fb_offset_tmp); return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/mc.h b/src/add-ons/accelerants/radeon_hd/mc.h index 2ef458bfa1..d1858b86a0 100644 --- a/src/add-ons/accelerants/radeon_hd/mc.h +++ b/src/add-ons/accelerants/radeon_hd/mc.h @@ -9,14 +9,8 @@ #define RADEON_HD_MC_H -#define R6XX_FB_LOCATION(address, size) \ - (((((address) + (size)) >> 8) & 0xFFFF0000) | (((address) >> 24) & 0xFFFF)) -#define R6XX_HDP_LOCATION(address) \ - ((((address) >> 8) & 0x00FF0000)) - - -uint64 MCFBLocation(uint16 chipset, uint32* size); -status_t MCFBSetup(uint32 newFbLocation, uint32 newFbSize); +uint32 MCIdle(); +status_t MCFBSetup(); #endif diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index b8301dfa24..13cb8d3daa 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -15,6 +15,7 @@ #include "accelerant.h" #include "utility.h" #include "mode.h" +#include "display.h" #include #include @@ -157,20 +158,16 @@ CardFBSet(uint8 crtid, display_mode *mode) // VGA // framebuffersize = w * h * bpp = fb bits / 8 = bytes needed - //uint64 fbAddress = gInfo->shared_info->frame_buffer_phys; uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; - // Set the inital frame buffer location in the memory controler - uint32 mcFbSize; - MCFBLocation(fbAddressInt, &mcFbSize); - //MCFBSetup(gInfo->shared_info->frame_buffer_int, mcFbSize); + MCFBSetup(); Write32(CRT, regs->grphUpdate, (1<<16)); // Lock for update (isn't this normally the other way around on VGA? // Tell GPU which frame buffer address to draw from - Write32(CRT, regs->grphPrimarySurfaceAddr, fbAddressInt & 0xffffffff); - Write32(CRT, regs->grphSecondarySurfaceAddr, fbAddressInt & 0xffffffff); + Write32(CRT, regs->grphPrimarySurfaceAddr, fbAddressInt & 0xFFFFFFFF); + //Write32(CRT, regs->grphSecondarySurfaceAddr, fbAddressInt); if (gInfo->shared_info->device_chipset >= (RADEON_R700 | 0x70)) { Write32(CRT, regs->grphPrimarySurfaceAddrHigh, @@ -247,13 +244,15 @@ CardModeSet(uint8 crtid, display_mode *mode) Write32(CRT, regs->crtHTotal, displayTiming.h_total - 1); + /* // Blanking - uint16 blankStart = displayTiming.h_total - displayTiming.h_sync_start; - uint16 blankEnd = displayTiming.h_total + uint16 blankStart = displayTiming.h_total + displayTiming.h_display - displayTiming.h_sync_start; + uint16 blankEnd = displayTiming.h_total - displayTiming.h_sync_start; Write32(CRT, regs->crtHBlank, blankStart | (blankEnd << 16)); + */ Write32(CRT, regs->crtHSync, (displayTiming.h_sync_end - displayTiming.h_sync_start) << 16); @@ -266,13 +265,15 @@ CardModeSet(uint8 crtid, display_mode *mode) Write32(CRT, regs->crtVTotal, displayTiming.v_total - 1); + /* // Blanking - blankStart = displayTiming.v_total - displayTiming.v_sync_start; - blankEnd = displayTiming.v_total + blankStart = displayTiming.v_total + displayTiming.v_display - displayTiming.v_sync_start; + blankEnd = displayTiming.v_total - displayTiming.v_sync_start; Write32(CRT, regs->crtVBlank, blankStart | (blankEnd << 16)); + */ // Set Interlace if specified within mode line if (displayTiming.flags & B_TIMING_INTERLACED) { @@ -303,7 +304,6 @@ CardModeScale(uint8 crtid, display_mode *mode) register_info* regs = gDisplay[crtid]->regs; // No scaling - Write32(CRT, regs->sclUpdate, (1<<16));// Lock #if 0 Write32(CRT, D1MODE_EXT_OVERSCAN_LEFT_RIGHT, @@ -315,44 +315,76 @@ CardModeScale(uint8 crtid, display_mode *mode) Write32(CRT, regs->viewportStart, 0); Write32(CRT, regs->viewportSize, mode->timing.v_display | (mode->timing.h_display << 16)); + Write32(CRT, regs->sclEnable, 0); Write32(CRT, regs->sclTapControl, 0); Write32(CRT, regs->modeCenter, 2); // D1MODE_DATA_FORMAT? - Write32(CRT, regs->sclUpdate, 0); // Unlock } status_t radeon_set_display_mode(display_mode *mode) { - uint8 display_id = 0; + // Disable VGA (boo, hiss) + Write32Mask(OUT, VGA_RENDER_CONTROL, 0, 0x00030000); + Write32Mask(OUT, VGA_MODE_CONTROL, 0, 0x00000030); + Write32Mask(OUT, VGA_HDP_CONTROL, 0x00010010, 0x00010010); + Write32(OUT, D1VGA_CONTROL, 0); + Write32(OUT, D2VGA_CONTROL, 0); - CardFBSet(display_id, mode); - CardModeSet(display_id, mode); - CardModeScale(display_id, mode); + // TODO : We set the same VESA EDID mode on each display - // If this is DAC, set our PLL - if ((gDisplay[display_id]->connection_type & CONNECTION_DAC) != 0) { - PLLSet(gDisplay[display_id]->connection_id, mode->timing.pixel_clock); - DACSet(gDisplay[display_id]->connection_id, display_id); + // Set mode on each display + for (uint8 id = 0; id < MAX_DISPLAY; id++) { + // Skip if display is inactive + if (gDisplay[id]->active == false) { + CardBlankSet(id, true); + display_power(id, RHD_POWER_ON); + continue; + } - // TODO : Shutdown unused PLL/DAC + // Program CRT Controller + CardFBSet(id, mode); + CardModeSet(id, mode); + CardModeScale(id, mode); - // Power up the output - PLLPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); - DACPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); - } else if ((gDisplay[display_id]->connection_type & CONNECTION_TMDS) != 0) { - TMDSSet(gDisplay[display_id]->connection_id, mode); - TMDSPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); - } else if ((gDisplay[display_id]->connection_type & CONNECTION_LVDS) != 0) { - LVDSSet(gDisplay[display_id]->connection_id, mode); - LVDSPower(gDisplay[display_id]->connection_id, RHD_POWER_ON); + display_power(id, RHD_POWER_RESET); + + // Program connector controllers + switch (gDisplay[id]->connection_type) { + case CONNECTION_DAC: + PLLSet(gDisplay[id]->connection_id, + mode->timing.pixel_clock); + DACSet(gDisplay[id]->connection_id, id); + break; + case CONNECTION_TMDS: + TMDSSet(gDisplay[id]->connection_id, mode); + break; + case CONNECTION_LVDS: + LVDSSet(gDisplay[id]->connection_id, mode); + break; + } + + // Power CRT Controller + display_power(id, RHD_POWER_ON); + CardBlankSet(id, false); + + // Power connector controllers + switch (gDisplay[id]->connection_type) { + case CONNECTION_DAC: + PLLPower(gDisplay[id]->connection_id, RHD_POWER_ON); + DACPower(gDisplay[id]->connection_id, RHD_POWER_ON); + break; + case CONNECTION_TMDS: + TMDSPower(gDisplay[id]->connection_id, RHD_POWER_ON); + break; + case CONNECTION_LVDS: + LVDSPower(gDisplay[id]->connection_id, RHD_POWER_ON); + break; + } } - // Ensure screen isn't blanked - CardBlankSet(display_id, false); - int32 crtstatus = Read32(CRT, D1CRTC_STATUS); TRACE("CRT0 Status: 0x%X\n", crtstatus); crtstatus = Read32(CRT, D2CRTC_STATUS); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 17a5e41d30..816adada5b 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -102,6 +102,8 @@ radeon_hd_init(radeon_info &info) info.shared_info->frame_buffer_int = read32(info.registers + R6XX_CONFIG_FB_BASE); + strcpy(info.shared_info->device_identifier, info.device_identifier); + // Pull active monitor VESA EDID from boot loader edid1_info* edidInfo = (edid1_info*)get_boot_item(EDID_BOOT_INFO, NULL); From 0e3075fb4d4a9f769cec675242280be1193ef464 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 30 Jul 2011 18:25:08 +0000 Subject: [PATCH 071/702] * Provide device chipset in accelerant_device_info git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42516 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 5ff839cf3f..9e7639de15 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -250,8 +251,11 @@ radeon_get_accelerant_device_info(accelerant_device_info *di) { di->version = B_ACCELERANT_VERSION; strcpy(di->name, gInfo->shared_info->device_identifier); - strcpy(di->chipset, "radeon_hd"); - // TODO : Give chipset, ex: r600 + + char chipset[32]; + sprintf(chipset, "r%X", gInfo->shared_info->device_chipset); + strcpy(di->chipset, chipset); + strcpy(di->serial_no, "None" ); di->memory = gInfo->shared_info->graphics_memory_size; From a4506dd3e779029125c8ceb00642f7e8a2fcb4c3 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 30 Jul 2011 19:51:28 +0000 Subject: [PATCH 072/702] Fix reverse condition. This would lead to the view getting Pulse messages both from it's own MessageRunner and from BWindow. No functional change intended :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42517 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/interface/PeakView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/mediaplayer/interface/PeakView.cpp b/src/apps/mediaplayer/interface/PeakView.cpp index 31b4e94cde..6bb6bb96b9 100644 --- a/src/apps/mediaplayer/interface/PeakView.cpp +++ b/src/apps/mediaplayer/interface/PeakView.cpp @@ -40,7 +40,7 @@ enum { PeakView::PeakView(const char* name, bool useGlobalPulse, bool displayLabels) : - BView(name, (useGlobalPulse ? 0 : B_PULSE_NEEDED) + BView(name, (useGlobalPulse ? B_PULSE_NEEDED : 0) | B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE), fUseGlobalPulse(useGlobalPulse), fDisplayLabels(displayLabels), From e1ac525ddff37e7aedf656334d97f1708bbad926 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 31 Jul 2011 14:45:55 +0000 Subject: [PATCH 073/702] * Don't eat alt+space if there is only one input method available (the shortcut is meant to switch input methods) Makes it useable in applications and less confusing. Fixes #6468. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42521 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/input/InputServer.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index f6a837c204..c2140e10de 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -1016,12 +1016,17 @@ InputServer::SetNextMethod(bool direction) gInputMethodListLocker.Lock(); int32 index = gInputMethodList.IndexOf(fActiveMethod); + int32 oldIndex = index; + index += (direction ? 1 : -1); if (index < -1) index = gInputMethodList.CountItems() - 1; if (index >= gInputMethodList.CountItems()) index = -1; + + if (index == oldIndex) + return B_BAD_INDEX; BInputServerMethod *method = &gKeymapMethod; @@ -1460,6 +1465,9 @@ InputServer::_UpdateMouseAndKeys(EventList& events) // we scan for Alt+Space key down events which means we change // to next input method // (pressing "shift" will let us switch to the previous method) + + // If there is only one input method, SetNextMethod will return + // B_BAD_INDEX and the event will be forwarded to the user. PRINT(("SanitizeEvents: %lx, %x\n", fKeyInfo.modifiers, fKeyInfo.key_states[KEY_Spacebar >> 3])); @@ -1470,12 +1478,13 @@ InputServer::_UpdateMouseAndKeys(EventList& events) if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') || byte == B_HANKAKU_ZENKAKU) { - SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)); - - // this event isn't sent to the user - events.RemoveItemAt(index); - delete event; - continue; + if (SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)) == B_OK) + { + // this event isn't sent to the user + events.RemoveItemAt(index); + delete event; + continue; + } } break; } From ef3a7658fa1ad818737228b88a780deb2dcc6dec Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 31 Jul 2011 16:48:59 +0000 Subject: [PATCH 074/702] bug fix, POWER_SHUTDOWN vs POWER_ON git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42522 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/mode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 13cb8d3daa..d26354bb9b 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -340,7 +340,7 @@ radeon_set_display_mode(display_mode *mode) // Skip if display is inactive if (gDisplay[id]->active == false) { CardBlankSet(id, true); - display_power(id, RHD_POWER_ON); + display_power(id, RHD_POWER_SHUTDOWN); continue; } From ab7cbe31c2cae99a5a693de6405d5b27f626fce8 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 31 Jul 2011 18:11:26 +0000 Subject: [PATCH 075/702] Always set the palette registers even if the head is not connected. This will not do anything bad (if the display is disabled, it has no effect), and since the test was a bit too constraining (I have an LVDS panel on head A), it would prevent setting colors for the CMAP modes. This finally gets the \n demo working from the original binary from BeOS, without any change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42523 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/intel_extreme/mode.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 3facba7e94..e12ee0ff56 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -1191,10 +1191,8 @@ intel_set_indexed_colors(uint count, uint8 first, uint8 *colors, uint32 flags) uint32 color = colors[0] << 16 | colors[1] << 8 | colors[2]; colors += 3; - if (gInfo->head_mode & HEAD_MODE_A_ANALOG) - write32(INTEL_DISPLAY_A_PALETTE + first * sizeof(uint32), color); - if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) - write32(INTEL_DISPLAY_B_PALETTE + first * sizeof(uint32), color); + write32(INTEL_DISPLAY_A_PALETTE + first * sizeof(uint32), color); + write32(INTEL_DISPLAY_B_PALETTE + first * sizeof(uint32), color); } } From b0af58132b493e47e59d16679b8d679f63f1d6de Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Mon, 1 Aug 2011 00:34:22 +0000 Subject: [PATCH 076/702] Fixed url for sdl-gfx. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42525 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalLibPackages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/jam/OptionalLibPackages b/build/jam/OptionalLibPackages index ecaf22544d..4acc6c387e 100644 --- a/build/jam/OptionalLibPackages +++ b/build/jam/OptionalLibPackages @@ -233,8 +233,8 @@ if [ IsOptionalHaikuImagePackageAdded SDLLibs ] { guilib-1.2.1-r1a3-x86-gcc4-2011-05-26.zip : $(baseURL)/lib/guilib-1.2.1-r1a3-x86-gcc4-2011-05-26.zip ; InstallOptionalHaikuImagePackage - sdl-gfx-2.0.20-r1a3-x86-gcc4-2011-05-26.zip - : $(baseURL)/lib/sdl-gfx-r1a3-x86-gcc4-2011-05-26.zip ; + sdl-gfx-2.0.22-r1a3-x86-gcc4-2011-05-26.zip + : $(baseURL)/lib/sdl-gfx-2.0.22-r1a3-x86-gcc4-2011-05-26.zip ; InstallOptionalHaikuImagePackage sdl-image-1.2.10-r1a3-x86-gcc4-2011-05-26.zip : $(baseURL)/lib/sdl-image-1.2.10-r1a3-x86-gcc4-2011-05-26.zip ; From 2dae355ecb8879c494b3ba19f506a581ced13b28 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 1 Aug 2011 00:56:23 +0000 Subject: [PATCH 077/702] Fix window stack api and Desktop::WindowForClientLooperPort lock assert. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42526 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/WindowStack.cpp | 3 ++- src/servers/app/Desktop.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/WindowStack.cpp b/src/kits/interface/WindowStack.cpp index 688a97f291..34db295976 100644 --- a/src/kits/interface/WindowStack.cpp +++ b/src/kits/interface/WindowStack.cpp @@ -163,7 +163,7 @@ BWindowStack::HasWindow(const BMessenger& window) int32 code = B_ERROR; fLink->FlushWithReply(code); if (code != B_OK) - return code; + return false; bool hasWindow; if (fLink->Read(&hasWindow) != B_OK) @@ -205,5 +205,6 @@ BWindowStack::_StartMessage(int32 what) { fLink->StartMessage(AS_TALK_TO_DESKTOP_LISTENER); fLink->Attach(kMagicSATIdentifier); + fLink->Attach(kStacking); return fLink->Attach(what); } diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 2fc0a6349a..7baf5bc41d 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -2643,7 +2643,7 @@ Desktop::AllWindows() Window* Desktop::WindowForClientLooperPort(port_id port) { - ASSERT(fWindowLock.IsReadLocked()); + ASSERT_MULTI_LOCKED(fWindowLock); for (Window* window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { From bd545a2af25e43ea46dfd34a2101f6279ae4a2ac Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 1 Aug 2011 01:03:06 +0000 Subject: [PATCH 078/702] Set the top layer tab when detaching a window from the stack. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42527 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 508c95c64a..46c86d0084 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -2084,8 +2084,10 @@ Window::DetachFromWindowStack(bool ownStackNeeded) BRegion dirty; ::Decorator* decorator = fCurrentStack->Decorator(); - if (decorator != NULL) + if (decorator != NULL) { decorator->RemoveTab(index, &dirty); + decorator->SetTopTap(fCurrentStack->LayerOrder().CountItems() - 1); + } Window* remainingTop = fCurrentStack->TopLayerWindow(); if (remainingTop != NULL) { From e089170a153f92a46538cf1a01278b651c3259ec Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 1 Aug 2011 01:30:47 +0000 Subject: [PATCH 079/702] Fix the check for the max tab offset when there is only one tab. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42528 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../app/decorator/DefaultDecorator.cpp | 44 ++++++++++++------- src/servers/app/decorator/DefaultDecorator.h | 1 + 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/servers/app/decorator/DefaultDecorator.cpp b/src/servers/app/decorator/DefaultDecorator.cpp index 41d49c36f5..0dc34cdd5d 100644 --- a/src/servers/app/decorator/DefaultDecorator.cpp +++ b/src/servers/app/decorator/DefaultDecorator.cpp @@ -452,9 +452,12 @@ DefaultDecorator::_DoLayout() void DefaultDecorator::_DoTabLayout() { - float tabPosition = 0; - if (fTabList.CountItems() == 1) - tabPosition = _TabAt(0)->tabOffset; + float tabOffset = 0; + if (fTabList.CountItems() == 1) { + float tabSize; + tabOffset = _SingleTabOffsetAndSize(tabSize); + } + float sumTabWidth = 0; // calculate our tab rect for (int32 i = 0; i < fTabList.CountItems(); i++) { @@ -524,15 +527,15 @@ DefaultDecorator::_DoTabLayout() // make sure fTabOffset is within limits and apply it to // the tabRect - if (tab->tabLocation != 0.0 + tab->tabOffset = (uint32)tabOffset; + if (tab->tabLocation != 0.0 && fTabList.CountItems() == 1 && tab->tabOffset > (fRightBorder.right - fLeftBorder.left - tabRect.Width())) { tab->tabOffset = uint32(fRightBorder.right - fLeftBorder.left - tabRect.Width()); } - tab->tabOffset = (uint32)tabPosition; tabRect.OffsetBy(tab->tabOffset, 0); - tabPosition += tabRect.Width(); + tabOffset += tabRect.Width(); sumTabWidth += tabRect.Width(); } @@ -1253,17 +1256,8 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) BRect oldTabRect(tabRect); float tabSize; - float maxLocation; - if (fLook != kLeftTitledWindowLook) { - tabSize = fRightBorder.right - fLeftBorder.left; - } else { - tabSize = fBottomBorder.bottom - fTopBorder.top; - } - maxLocation = tabSize - tab->maxTabSize; - if (maxLocation < 0) - maxLocation = 0; + float tabOffset = _SingleTabOffsetAndSize(tabSize); - float tabOffset = floorf(tab->tabLocation * maxLocation); float delta = tabOffset - tab->tabOffset; tab->tabOffset = (uint32)tabOffset; if (fLook != kLeftTitledWindowLook) @@ -1888,6 +1882,24 @@ DefaultDecorator::_DefaultTextOffset() const } +float +DefaultDecorator::_SingleTabOffsetAndSize(float& tabSize) +{ + float maxLocation; + if (fLook != kLeftTitledWindowLook) { + tabSize = fRightBorder.right - fLeftBorder.left; + } else { + tabSize = fBottomBorder.bottom - fTopBorder.top; + } + DefaultDecorator::Tab* tab = _TabAt(0); + maxLocation = tabSize - tab->maxTabSize; + if (maxLocation < 0) + maxLocation = 0; + + return floorf(tab->tabLocation * maxLocation); +} + + void DefaultDecorator::_CalculateTabsRegion() { diff --git a/src/servers/app/decorator/DefaultDecorator.h b/src/servers/app/decorator/DefaultDecorator.h index 2297374494..ce6dd3429a 100644 --- a/src/servers/app/decorator/DefaultDecorator.h +++ b/src/servers/app/decorator/DefaultDecorator.h @@ -181,6 +181,7 @@ private: Decorator::Tab* tab = NULL); inline float _DefaultTextOffset() const; + inline float _SingleTabOffsetAndSize(float& tabSize); void _CalculateTabsRegion(); protected: From 3b01da1b46340fd91d2dc86501570e7ec1e94772 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 1 Aug 2011 02:44:22 +0000 Subject: [PATCH 080/702] Add compatibility file again. Should fix #7858. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42530 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/mail/Jamfile | 1 + src/kits/mail/b_mail_message.cpp | 138 +++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 src/kits/mail/b_mail_message.cpp diff --git a/src/kits/mail/Jamfile b/src/kits/mail/Jamfile index 7415cad7f0..bda4a2655a 100644 --- a/src/kits/mail/Jamfile +++ b/src/kits/mail/Jamfile @@ -13,6 +13,7 @@ UsePrivateHeaders textencoding ; local sources = + b_mail_message.cpp c_mail_api.cpp crypt.cpp des.c diff --git a/src/kits/mail/b_mail_message.cpp b/src/kits/mail/b_mail_message.cpp new file mode 100644 index 0000000000..89a579330e --- /dev/null +++ b/src/kits/mail/b_mail_message.cpp @@ -0,0 +1,138 @@ +/* BMailMessage - compatibility wrapper to our mail message class +** +** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. +*/ + + +//------This entire document is a horrible, horrible hack. I apologize. +#include + +class _EXPORT BMailMessage; + +#include + +#include +#include + +#include + +struct CharsetConversionEntry +{ + const char *charset; + uint32 flavor; +}; + +extern const CharsetConversionEntry mail_charsets[]; + + +BMailMessage::BMailMessage(void) + : fFields((BList *)(new BEmailMessage())) +{ +} + +BMailMessage::~BMailMessage(void) +{ + delete ((BEmailMessage *)(fFields)); +} + +status_t BMailMessage::AddContent(const char *text, int32 length, + uint32 encoding, bool /*clobber*/) +{ + BTextMailComponent *comp = new BTextMailComponent; + BMemoryIO io(text,length); + comp->SetDecodedData(&io); + + comp->SetEncoding(quoted_printable,encoding); + + //if (clobber) + ((BEmailMessage *)(fFields))->AddComponent(comp); + + return B_OK; +} + +status_t BMailMessage::AddContent(const char *text, int32 length, + const char *encoding, bool /*clobber*/) +{ + BTextMailComponent *comp = new BTextMailComponent(); + BMemoryIO io(text,length); + comp->SetDecodedData(&io); + + uint32 encode = B_ISO1_CONVERSION; + //-----I'm assuming that encoding is one of the RFC charsets + //-----there are no docs. Am I right? + if (encoding != NULL) { + for (int32 i = 0; mail_charsets[i].charset != NULL; i++) { + if (strcasecmp(encoding,mail_charsets[i].charset) == 0) { + encode = mail_charsets[i].flavor; + break; + } + } + } + + comp->SetEncoding(quoted_printable,encode); + + //if (clobber) + ((BEmailMessage *)(fFields))->AddComponent(comp); + + return B_OK; +} + +status_t BMailMessage::AddEnclosure(entry_ref *ref, bool /*clobber*/) +{ + ((BEmailMessage *)(fFields))->Attach(ref); + return B_OK; +} + +status_t BMailMessage::AddEnclosure(const char *path, bool /*clobber*/) +{ + BEntry entry(path); + status_t status; + if ((status = entry.InitCheck()) < B_OK) + return status; + + entry_ref ref; + if ((status = entry.GetRef(&ref)) < B_OK) + return status; + + ((BEmailMessage *)(fFields))->Attach(&ref); + return B_OK; +} + +status_t BMailMessage::AddEnclosure(const char *MIME_type, void *data, int32 len, + bool /*clobber*/) +{ + BSimpleMailAttachment *attach = new BSimpleMailAttachment; + attach->SetDecodedData(data,len); + attach->SetHeaderField("Content-Type",MIME_type); + + ((BEmailMessage *)(fFields))->AddComponent(attach); + return B_OK; +} + +status_t BMailMessage::AddHeaderField(uint32 /*encoding*/, const char *field_name, const char *str, + bool /*clobber*/) +{ + //printf("First AddHeaderField. Args are %s%s\n",field_name,str); + + BString string = field_name; + string.Truncate(string.Length() - 2); //----BMailMessage includes the ": " + ((BEmailMessage *)(fFields))->SetHeaderField(string.String(),str); + return B_OK; +} + +status_t BMailMessage::AddHeaderField(const char *field_name, const char *str, + bool /*clobber*/) +{ + //printf("Second AddHeaderField. Args are %s%s\n",field_name,str); + BString string = field_name; + string.Truncate(string.Length() - 2); //----BMailMessage includes the ": " + ((BEmailMessage *)(fFields))->SetHeaderField(string.String(),str); + return B_OK; +} + +status_t BMailMessage::Send(bool send_now, + bool /*remove_when_I_have_completed_sending_this_message_to_your_preferred_SMTP_server*/) +{ + return ((BEmailMessage *)(fFields))->Send(send_now); +} + From 01123cf9ed2cdd931e7d5210cbe58692874acfd8 Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Mon, 1 Aug 2011 07:03:00 +0000 Subject: [PATCH 081/702] Switched to a B_TRANSLATE_COMMENT because it's nt obvious that %MIT license% isn't a variable and has to be translated. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42531 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/aboutsystem/AboutSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 0e85b30c3a..c48e55d40b 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -1236,12 +1236,12 @@ AboutView::_CreateCreditsView() "respective license.]\n\n")); // Haiku license - BString haikuLicense = B_TRANSLATE("The code that is unique to Haiku, " + BString haikuLicense = B_TRANSLATE_COMMENT("The code that is unique to Haiku, " "especially the kernel and all code that applications may link " "against, is distributed under the terms of the %MIT license%. " "Some system libraries contain third party code distributed under the " "LGPL license. You can find the copyrights to third party code below.\n" - "\n"); + "\n", "%MIT license% isn't a variable and has to be translated."); int32 licensePart1 = haikuLicense.FindFirst("%"); int32 licensePart2 = haikuLicense.FindLast("%"); BString part; From 7286c86c3901db167e044ec0d0d21414742d2cb4 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Mon, 1 Aug 2011 10:50:37 +0000 Subject: [PATCH 082/702] Disable group keyboard navigation for now. Don't start a S&T operation if the right button is down. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42532 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/StackAndTile/StackAndTile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/servers/app/StackAndTile/StackAndTile.cpp b/src/servers/app/StackAndTile/StackAndTile.cpp index 00a4fcba02..2f26ab75e6 100644 --- a/src/servers/app/StackAndTile/StackAndTile.cpp +++ b/src/servers/app/StackAndTile/StackAndTile.cpp @@ -129,7 +129,8 @@ StackAndTile::KeyPressed(uint32 what, int32 key, int32 modifiers) if (!wasPressed && fSATKeyPressed) _StartSAT(); } - +// switch off group navigation because it clashes with tracker... +return false; if (!SATKeyPressed() || (modifiers & B_COMMAND_KEY) == 0 || what != B_KEY_DOWN) return false; @@ -218,6 +219,12 @@ StackAndTile::MouseDown(Window* window, BMessage* message, const BPoint& where) if (!satWindow || !satWindow->GetDecorator()) return; + // fCurrentSATWindow is not zero if e.g. the secondary and the primary + // mouse button are pressed at the same time + if ((message->FindInt32("buttons") & B_PRIMARY_MOUSE_BUTTON) == 0 || + fCurrentSATWindow != NULL) + return; + // we are only interested in single clicks if (message->FindInt32("clicks") == 2) return; From 3eb02f08d9cec7c674f931ab56c40e2b3deae78d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 1 Aug 2011 17:19:54 +0000 Subject: [PATCH 083/702] Style fix. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42533 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/input/InputServer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index c2140e10de..767994112d 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -1477,9 +1477,9 @@ InputServer::_UpdateMouseAndKeys(EventList& events) byte = 0; if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') - || byte == B_HANKAKU_ZENKAKU) { - if (SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)) == B_OK) - { + || byte == B_HANKAKU_ZENKAKU) { + if (SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)) + == B_OK) { // this event isn't sent to the user events.RemoveItemAt(index); delete event; From 2df3def596241bbf68767401c5ae11b11290536b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 1 Aug 2011 22:41:04 +0000 Subject: [PATCH 084/702] * Remove old legacy internal AtomBIOS parser * Import "new" AMD AtomBios Parser (aka AMD KGrids) * Add a new global storage struct for BIOS info (ex. location, size, etc) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42534 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/Jamfile | 7 +- .../accelerants/radeon_hd/accelerant.cpp | 15 +- .../radeon_hd/atombios/CD_Operations.c | 959 --- .../accelerants/radeon_hd/atombios/Decoder.c | 235 - .../accelerants/radeon_hd/atombios/Jamfile | 24 - .../CD_Definitions.h => atom-bits.h} | 49 +- .../radeon_hd/atombios/atom-names.h | 100 + .../accelerants/radeon_hd/atombios/atom.c | 1114 ++++ .../accelerants/radeon_hd/atombios/atom.h | 136 + .../radeon_hd/atombios/hwserv_drv.c | 348 -- .../atombios/includes/CD_Common_Types.h | 169 - .../radeon_hd/atombios/includes/CD_Opcodes.h | 181 - .../radeon_hd/atombios/includes/CD_Structs.h | 464 -- .../radeon_hd/atombios/includes/CD_binding.h | 46 - .../atombios/includes/CD_hw_services.h | 318 - .../radeon_hd/atombios/includes/Decoder.h | 87 - .../radeon_hd/atombios/includes/ObjectID.h | 643 --- .../radeon_hd/atombios/includes/atombios.h | 5141 ----------------- .../radeon_hd/atombios/includes/regsdef.h | 25 - src/add-ons/accelerants/radeon_hd/bios.cpp | 187 - src/add-ons/accelerants/radeon_hd/bios.h | 10 +- 21 files changed, 1396 insertions(+), 8862 deletions(-) delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/CD_Operations.c delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/Decoder.c delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/Jamfile rename src/add-ons/accelerants/radeon_hd/atombios/{includes/CD_Definitions.h => atom-bits.h} (58%) create mode 100644 src/add-ons/accelerants/radeon_hd/atombios/atom-names.h create mode 100644 src/add-ons/accelerants/radeon_hd/atombios/atom.c create mode 100644 src/add-ons/accelerants/radeon_hd/atombios/atom.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/hwserv_drv.c delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Common_Types.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Opcodes.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Structs.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/CD_binding.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/CD_hw_services.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/Decoder.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/ObjectID.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/atombios.h delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/includes/regsdef.h diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile b/src/add-ons/accelerants/radeon_hd/Jamfile index 9aab5ee2d1..dbb86e5983 100644 --- a/src/add-ons/accelerants/radeon_hd/Jamfile +++ b/src/add-ons/accelerants/radeon_hd/Jamfile @@ -3,12 +3,13 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; SetSubDirSupportedPlatformsBeOSCompatible ; -UseHeaders [ FDirName $(SUBDIR) atombios includes ] ; +UseHeaders [ FDirName $(SUBDIR) atombios ] ; UsePrivateHeaders graphics ; UsePrivateHeaders [ FDirName graphics radeon_hd ] ; UsePrivateHeaders [ FDirName graphics common ] ; Addon radeon_hd.accelerant : + #atombios/atom.c accelerant.cpp engine.cpp hooks.cpp @@ -21,7 +22,5 @@ Addon radeon_hd.accelerant : mode.cpp bios.cpp create_display_modes.cpp - : be libaccelerantscommon.a atombios.a + : be libaccelerantscommon.a ; - -SubInclude HAIKU_TOP src add-ons accelerants radeon_hd atombios ; diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 9e7639de15..55d44c10f4 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -11,10 +11,11 @@ #include "accelerant_protos.h" #include "accelerant.h" +#include "bios.h" #include "display.h" -#include "utility.h" -#include "pll.h" #include "mc.h" +#include "pll.h" +#include "utility.h" #include #include @@ -36,6 +37,7 @@ extern "C" void _sPrintf(const char *format, ...); struct accelerant_info *gInfo; +struct bios_info *gBIOS; display_info *gDisplay[MAX_DISPLAY]; @@ -98,11 +100,13 @@ init_common(int device, bool isClone) // initialize global accelerant info structure gInfo = (accelerant_info *)malloc(sizeof(accelerant_info)); + gBIOS = (bios_info *)malloc(sizeof(bios_info)); - if (gInfo == NULL) + if (gInfo == NULL || gBIOS == NULL) return B_NO_MEMORY; memset(gInfo, 0, sizeof(accelerant_info)); + memset(gBIOS, 0, sizeof(bios_info)); for (uint32 id = 0; id < MAX_DISPLAY; id++) { gDisplay[id] = (display_info *)malloc(sizeof(display_info)); @@ -127,6 +131,7 @@ init_common(int device, bool isClone) if (ioctl(device, RADEON_GET_PRIVATE_DATA, &data, sizeof(radeon_get_private_data)) != 0) { free(gInfo); + free(gBIOS); return B_ERROR; } @@ -137,6 +142,7 @@ init_common(int device, bool isClone) status_t status = sharedCloner.InitCheck(); if (status < B_OK) { free(gInfo); + free(gBIOS); TRACE("%s, failed shared area%i, %i\n", __func__, data.shared_info_area, gInfo->shared_info_area); return status; @@ -149,6 +155,7 @@ init_common(int device, bool isClone) status = regsCloner.InitCheck(); if (status < B_OK) { free(gInfo); + free(gBIOS); return status; } @@ -182,6 +189,8 @@ uninit_common(void) free(gInfo); } + free(gBIOS); + for (uint32 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id] != NULL) { free(gDisplay[id]->regs); diff --git a/src/add-ons/accelerants/radeon_hd/atombios/CD_Operations.c b/src/add-ons/accelerants/radeon_hd/atombios/CD_Operations.c deleted file mode 100644 index 9212ba26bb..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/CD_Operations.c +++ /dev/null @@ -1,959 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - -Module Name: - - CD_Operations.c - -Abstract: - - Functions Implementing Command Operations and other common functions - -Revision History: - - NEG:27.09.2002 Initiated. ---*/ -#define __SW_4 - -#include "Decoder.h" -#include "atombios.h" - - - -VOID PutDataRegister(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID PutDataPS(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID PutDataWS(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID PutDataFB(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID PutDataPLL(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID PutDataMC(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -UINT32 GetParametersDirect32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -UINT32 GetParametersDirect16(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -UINT32 GetParametersDirect8(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -UINT32 GetParametersRegister(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -UINT32 GetParametersPS(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -UINT32 GetParametersWS(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -UINT32 GetParametersFB(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -UINT32 GetParametersPLL(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -UINT32 GetParametersMC(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -VOID SkipParameters16(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID SkipParameters8(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -UINT32 GetParametersIndirect(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -UINT32 GetParametersDirect(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -UINT16* GetDataMasterTablePointer(DEVICE_DATA STACK_BASED* pDeviceData); -UINT8 GetTrueIndexInMasterTable(PARSER_TEMP_DATA STACK_BASED * pParserTempData, UINT8 IndexInMasterTable); - - -WRITE_IO_FUNCTION WritePCIFunctions[8] = { - WritePCIReg32, - WritePCIReg16, WritePCIReg16, WritePCIReg16, - WritePCIReg8,WritePCIReg8,WritePCIReg8,WritePCIReg8 -}; -WRITE_IO_FUNCTION WriteIOFunctions[8] = { - WriteSysIOReg32, - WriteSysIOReg16,WriteSysIOReg16,WriteSysIOReg16, - WriteSysIOReg8,WriteSysIOReg8,WriteSysIOReg8,WriteSysIOReg8 -}; -READ_IO_FUNCTION ReadPCIFunctions[8] = { - (READ_IO_FUNCTION)ReadPCIReg32, - (READ_IO_FUNCTION)ReadPCIReg16, - (READ_IO_FUNCTION)ReadPCIReg16, - (READ_IO_FUNCTION)ReadPCIReg16, - (READ_IO_FUNCTION)ReadPCIReg8, - (READ_IO_FUNCTION)ReadPCIReg8, - (READ_IO_FUNCTION)ReadPCIReg8, - (READ_IO_FUNCTION)ReadPCIReg8 -}; -READ_IO_FUNCTION ReadIOFunctions[8] = { - (READ_IO_FUNCTION)ReadSysIOReg32, - (READ_IO_FUNCTION)ReadSysIOReg16, - (READ_IO_FUNCTION)ReadSysIOReg16, - (READ_IO_FUNCTION)ReadSysIOReg16, - (READ_IO_FUNCTION)ReadSysIOReg8, - (READ_IO_FUNCTION)ReadSysIOReg8, - (READ_IO_FUNCTION)ReadSysIOReg8, - (READ_IO_FUNCTION)ReadSysIOReg8 -}; -READ_IO_FUNCTION GetParametersDirectArray[8]={ - GetParametersDirect32, - GetParametersDirect16,GetParametersDirect16,GetParametersDirect16, - GetParametersDirect8,GetParametersDirect8,GetParametersDirect8, - GetParametersDirect8 -}; - -COMMANDS_DECODER PutDataFunctions[6] = { - PutDataRegister, - PutDataPS, - PutDataWS, - PutDataFB, - PutDataPLL, - PutDataMC -}; -CD_GET_PARAMETERS GetDestination[6] = { - GetParametersRegister, - GetParametersPS, - GetParametersWS, - GetParametersFB, - GetParametersPLL, - GetParametersMC -}; - -COMMANDS_DECODER SkipDestination[6] = { - SkipParameters16, - SkipParameters8, - SkipParameters8, - SkipParameters8, - SkipParameters8, - SkipParameters8 -}; - -CD_GET_PARAMETERS GetSource[8] = { - GetParametersRegister, - GetParametersPS, - GetParametersWS, - GetParametersFB, - GetParametersIndirect, - GetParametersDirect, - GetParametersPLL, - GetParametersMC -}; - -UINT32 AlignmentMask[8] = {0xFFFFFFFF,0xFFFF,0xFFFF,0xFFFF,0xFF,0xFF,0xFF,0xFF}; -UINT8 SourceAlignmentShift[8] = {0,0,8,16,0,8,16,24}; -UINT8 DestinationAlignmentShift[4] = {0,8,16,24}; - -#define INDIRECTIO_ID 1 -#define INDIRECTIO_END_OF_ID 9 - -VOID IndirectIOCommand(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID IndirectIOCommand_MOVE(PARSER_TEMP_DATA STACK_BASED * pParserTempData, UINT32 temp); -VOID IndirectIOCommand_MOVE_INDEX(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID IndirectIOCommand_MOVE_ATTR(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID IndirectIOCommand_MOVE_DATA(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID IndirectIOCommand_SET(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -VOID IndirectIOCommand_CLEAR(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - -INDIRECT_IO_PARSER_COMMANDS IndirectIOParserCommands[10]={ - {IndirectIOCommand,1}, - {IndirectIOCommand,2}, - {ReadIndReg32,3}, - {WriteIndReg32,3}, - {IndirectIOCommand_CLEAR,3}, - {IndirectIOCommand_SET,3}, - {IndirectIOCommand_MOVE_INDEX,4}, - {IndirectIOCommand_MOVE_ATTR,4}, - {IndirectIOCommand_MOVE_DATA,4}, - {IndirectIOCommand,3} -}; - - -VOID IndirectIOCommand(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ -} - - -VOID IndirectIOCommand_MOVE_INDEX(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->IndirectData &= ~((0xFFFFFFFF >> (32-pParserTempData->IndirectIOTablePointer[1])) << pParserTempData->IndirectIOTablePointer[3]); - pParserTempData->IndirectData |=(((pParserTempData->Index >> pParserTempData->IndirectIOTablePointer[2]) & - (0xFFFFFFFF >> (32-pParserTempData->IndirectIOTablePointer[1]))) << pParserTempData->IndirectIOTablePointer[3]); -} - -VOID IndirectIOCommand_MOVE_ATTR(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->IndirectData &= ~((0xFFFFFFFF >> (32-pParserTempData->IndirectIOTablePointer[1])) << pParserTempData->IndirectIOTablePointer[3]); - pParserTempData->IndirectData |=(((pParserTempData->AttributesData >> pParserTempData->IndirectIOTablePointer[2]) - & (0xFFFFFFFF >> (32-pParserTempData->IndirectIOTablePointer[1]))) << pParserTempData->IndirectIOTablePointer[3]); -} - -VOID IndirectIOCommand_MOVE_DATA(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->IndirectData &= ~((0xFFFFFFFF >> (32-pParserTempData->IndirectIOTablePointer[1])) << pParserTempData->IndirectIOTablePointer[3]); - pParserTempData->IndirectData |=(((pParserTempData->DestData32 >> pParserTempData->IndirectIOTablePointer[2]) - & (0xFFFFFFFF >> (32-pParserTempData->IndirectIOTablePointer[1]))) << pParserTempData->IndirectIOTablePointer[3]); -} - - -VOID IndirectIOCommand_SET(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->IndirectData |= ((0xFFFFFFFF >> (32-pParserTempData->IndirectIOTablePointer[1])) << pParserTempData->IndirectIOTablePointer[2]); -} - -VOID IndirectIOCommand_CLEAR(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->IndirectData &= ~((0xFFFFFFFF >> (32-pParserTempData->IndirectIOTablePointer[1])) << pParserTempData->IndirectIOTablePointer[2]); -} - - -UINT32 IndirectInputOutput(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - // if ((pParserTempData->IndirectData & 0x7f)==INDIRECT_IO_MM) pParserTempData->IndirectData|=pParserTempData->CurrentPortID; -// pParserTempData->IndirectIOTablePointer=pParserTempData->IndirectIOTable; - while (*pParserTempData->IndirectIOTablePointer) - { - if ((pParserTempData->IndirectIOTablePointer[0] == INDIRECTIO_ID) && - (pParserTempData->IndirectIOTablePointer[1] == pParserTempData->IndirectData)) - { - pParserTempData->IndirectIOTablePointer+=IndirectIOParserCommands[*pParserTempData->IndirectIOTablePointer].csize; - while (*pParserTempData->IndirectIOTablePointer != INDIRECTIO_END_OF_ID) - { - IndirectIOParserCommands[*pParserTempData->IndirectIOTablePointer].func(pParserTempData); - pParserTempData->IndirectIOTablePointer+=IndirectIOParserCommands[*pParserTempData->IndirectIOTablePointer].csize; - } - pParserTempData->IndirectIOTablePointer-=*(UINT16*)(pParserTempData->IndirectIOTablePointer+1); - pParserTempData->IndirectIOTablePointer++; - return pParserTempData->IndirectData; - } else pParserTempData->IndirectIOTablePointer+=IndirectIOParserCommands[*pParserTempData->IndirectIOTablePointer].csize; - } - return 0; -} - - - -VOID PutDataRegister(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=(UINT32)pParserTempData->pCmd->Parameters.WordXX.PA_Destination; - pParserTempData->Index+=pParserTempData->CurrentRegBlock; - switch(pParserTempData->Multipurpose.CurrentPort){ - case ATI_RegsPort: - if (pParserTempData->CurrentPortID == INDIRECT_IO_MM) - { - if (pParserTempData->Index==0) pParserTempData->DestData32 <<= 2; - WriteReg32( pParserTempData); - } else - { - pParserTempData->IndirectData=pParserTempData->CurrentPortID+INDIRECT_IO_WRITE; - IndirectInputOutput(pParserTempData); - } - break; - case PCI_Port: - WritePCIFunctions[pParserTempData->pCmd->Header.Attribute.SourceAlignment](pParserTempData); - break; - case SystemIO_Port: - WriteIOFunctions[pParserTempData->pCmd->Header.Attribute.SourceAlignment](pParserTempData); - break; - } -} - -VOID PutDataPS(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - *(pParserTempData->pDeviceData->pParameterSpace+pParserTempData->pCmd->Parameters.ByteXX.PA_Destination)= - pParserTempData->DestData32; -} - -VOID PutDataWS(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - if (pParserTempData->pCmd->Parameters.ByteXX.PA_Destination < WS_QUOTIENT_C) - *(pParserTempData->pWorkingTableData->pWorkSpace+pParserTempData->pCmd->Parameters.ByteXX.PA_Destination) = pParserTempData->DestData32; - else - switch (pParserTempData->pCmd->Parameters.ByteXX.PA_Destination) - { - case WS_REMINDER_C: - pParserTempData->MultiplicationOrDivision.Division.Reminder32=pParserTempData->DestData32; - break; - case WS_QUOTIENT_C: - pParserTempData->MultiplicationOrDivision.Division.Quotient32=pParserTempData->DestData32; - break; - case WS_DATAPTR_C: -#ifndef UEFI_BUILD - pParserTempData->CurrentDataBlock=(UINT16)pParserTempData->DestData32; -#else - pParserTempData->CurrentDataBlock=(UINTN)pParserTempData->DestData32; -#endif - break; - case WS_SHIFT_C: - pParserTempData->Shift2MaskConverter=(UINT8)pParserTempData->DestData32; - break; - case WS_FB_WINDOW_C: - pParserTempData->CurrentFB_Window=pParserTempData->DestData32; - break; - case WS_ATTRIBUTES_C: - pParserTempData->AttributesData=(UINT16)pParserTempData->DestData32; - break; - case WS_REGPTR_C: - pParserTempData->CurrentRegBlock=(UINT16)pParserTempData->DestData32; - break; - } - -} - -VOID PutDataFB(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=(UINT32)pParserTempData->pCmd->Parameters.ByteXX.PA_Destination; - //Make an Index from address first, then add to the Index - pParserTempData->Index+=(pParserTempData->CurrentFB_Window>>2); - WriteFrameBuffer32(pParserTempData); -} - -VOID PutDataPLL(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=(UINT32)pParserTempData->pCmd->Parameters.ByteXX.PA_Destination; - WritePLL32( pParserTempData ); -} - -VOID PutDataMC(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=(UINT32)pParserTempData->pCmd->Parameters.ByteXX.PA_Destination; - WriteMC32( pParserTempData ); -} - - -VOID SkipParameters8(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->pWorkingTableData->IP+=sizeof(UINT8); -} - -VOID SkipParameters16(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->pWorkingTableData->IP+=sizeof(UINT16); -} - - -UINT32 GetParametersRegister(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=*(UINT16*)pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT16); - pParserTempData->Index+=pParserTempData->CurrentRegBlock; - switch(pParserTempData->Multipurpose.CurrentPort) - { - case PCI_Port: - return ReadPCIFunctions[pParserTempData->pCmd->Header.Attribute.SourceAlignment](pParserTempData); - case SystemIO_Port: - return ReadIOFunctions[pParserTempData->pCmd->Header.Attribute.SourceAlignment](pParserTempData); - case ATI_RegsPort: - default: - if (pParserTempData->CurrentPortID == INDIRECT_IO_MM) return ReadReg32( pParserTempData ); - else - { - pParserTempData->IndirectData=pParserTempData->CurrentPortID+INDIRECT_IO_READ; - return IndirectInputOutput(pParserTempData); - } - } -} - -UINT32 GetParametersPS(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=*pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT8); - return *(pParserTempData->pDeviceData->pParameterSpace+pParserTempData->Index); -} - -UINT32 GetParametersWS(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=*pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT8); - if (pParserTempData->Index < WS_QUOTIENT_C) - return *(pParserTempData->pWorkingTableData->pWorkSpace+pParserTempData->Index); - else - switch (pParserTempData->Index) - { - case WS_REMINDER_C: - return pParserTempData->MultiplicationOrDivision.Division.Reminder32; - case WS_QUOTIENT_C: - return pParserTempData->MultiplicationOrDivision.Division.Quotient32; - case WS_DATAPTR_C: - return (UINT32)pParserTempData->CurrentDataBlock; - case WS_OR_MASK_C: - return ((UINT32)1) << pParserTempData->Shift2MaskConverter; - case WS_AND_MASK_C: - return ~(((UINT32)1) << pParserTempData->Shift2MaskConverter); - case WS_FB_WINDOW_C: - return pParserTempData->CurrentFB_Window; - case WS_ATTRIBUTES_C: - return pParserTempData->AttributesData; - case WS_REGPTR_C: - return (UINT32)pParserTempData->CurrentRegBlock; - } - return 0; - -} - -UINT32 GetParametersFB(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=*pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT8); - pParserTempData->Index+=(pParserTempData->CurrentFB_Window>>2); - return ReadFrameBuffer32(pParserTempData); -} - -UINT32 GetParametersPLL(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=*pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT8); - return ReadPLL32( pParserTempData ); -} - -UINT32 GetParametersMC(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=*pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT8); - return ReadMC32( pParserTempData ); -} - - -UINT32 GetParametersIndirect(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Index=*(UINT16*)pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT16); - return *(UINT32*)(RELATIVE_TO_BIOS_IMAGE(pParserTempData->Index)+pParserTempData->CurrentDataBlock); -} - -UINT32 GetParametersDirect8(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->CD_Mask.SrcAlignment=alignmentByte0; - pParserTempData->Index=*(UINT8*)pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT8); - return pParserTempData->Index; -} - -UINT32 GetParametersDirect16(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->CD_Mask.SrcAlignment=alignmentLowerWord; - pParserTempData->Index=*(UINT16*)pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT16); - return pParserTempData->Index; -} - -UINT32 GetParametersDirect32(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->CD_Mask.SrcAlignment=alignmentDword; - pParserTempData->Index=*(UINT32*)pParserTempData->pWorkingTableData->IP; - pParserTempData->pWorkingTableData->IP+=sizeof(UINT32); - return pParserTempData->Index; -} - - -UINT32 GetParametersDirect(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - return GetParametersDirectArray[pParserTempData->pCmd->Header.Attribute.SourceAlignment](pParserTempData); -} - - -VOID CommonSourceDataTransformation(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->SourceData32 >>= SourceAlignmentShift[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->SourceData32 &= AlignmentMask[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->SourceData32 <<= DestinationAlignmentShift[pParserTempData->CD_Mask.DestAlignment]; -} - -VOID CommonOperationDataTransformation(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->SourceData32 >>= SourceAlignmentShift[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->SourceData32 &= AlignmentMask[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->DestData32 >>= DestinationAlignmentShift[pParserTempData->CD_Mask.DestAlignment]; - pParserTempData->DestData32 &= AlignmentMask[pParserTempData->CD_Mask.SrcAlignment]; -} - -VOID ProcessMove(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - if (pParserTempData->CD_Mask.SrcAlignment!=alignmentDword) - { - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - } else - { - SkipDestination[pParserTempData->ParametersType.Destination](pParserTempData); - } - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - - if (pParserTempData->CD_Mask.SrcAlignment!=alignmentDword) - { - pParserTempData->DestData32 &= ~(AlignmentMask[pParserTempData->CD_Mask.SrcAlignment] << DestinationAlignmentShift[pParserTempData->CD_Mask.DestAlignment]); - CommonSourceDataTransformation(pParserTempData); - pParserTempData->DestData32 |= pParserTempData->SourceData32; - } else - { - pParserTempData->DestData32=pParserTempData->SourceData32; - } - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessMask(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetParametersDirect(pParserTempData); - pParserTempData->Index=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - pParserTempData->SourceData32 <<= DestinationAlignmentShift[pParserTempData->CD_Mask.DestAlignment]; - pParserTempData->SourceData32 |= ~(AlignmentMask[pParserTempData->CD_Mask.SrcAlignment] << DestinationAlignmentShift[pParserTempData->CD_Mask.DestAlignment]); - pParserTempData->DestData32 &= pParserTempData->SourceData32; - pParserTempData->Index &= AlignmentMask[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->Index <<= DestinationAlignmentShift[pParserTempData->CD_Mask.DestAlignment]; - pParserTempData->DestData32 |= pParserTempData->Index; - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessAnd(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - pParserTempData->SourceData32 >>= SourceAlignmentShift[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->SourceData32 <<= DestinationAlignmentShift[pParserTempData->CD_Mask.DestAlignment]; - pParserTempData->SourceData32 |= ~(AlignmentMask[pParserTempData->CD_Mask.SrcAlignment] << DestinationAlignmentShift[pParserTempData->CD_Mask.DestAlignment]); - pParserTempData->DestData32 &= pParserTempData->SourceData32; - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessOr(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - CommonSourceDataTransformation(pParserTempData); - pParserTempData->DestData32 |= pParserTempData->SourceData32; - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessXor(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - CommonSourceDataTransformation(pParserTempData); - pParserTempData->DestData32 ^= pParserTempData->SourceData32; - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessShl(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - CommonSourceDataTransformation(pParserTempData); - pParserTempData->DestData32 <<= pParserTempData->SourceData32; - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessShr(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - CommonSourceDataTransformation(pParserTempData); - pParserTempData->DestData32 >>= pParserTempData->SourceData32; - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - - -VOID ProcessADD(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - CommonSourceDataTransformation(pParserTempData); - pParserTempData->DestData32 += pParserTempData->SourceData32; - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessSUB(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - CommonSourceDataTransformation(pParserTempData); - pParserTempData->DestData32 -= pParserTempData->SourceData32; - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessMUL(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - CommonOperationDataTransformation(pParserTempData); - pParserTempData->MultiplicationOrDivision.Multiplication.Low32Bit=pParserTempData->DestData32 * pParserTempData->SourceData32; -} - -VOID ProcessDIV(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - - CommonOperationDataTransformation(pParserTempData); - pParserTempData->MultiplicationOrDivision.Division.Quotient32= - pParserTempData->DestData32 / pParserTempData->SourceData32; - pParserTempData->MultiplicationOrDivision.Division.Reminder32= - pParserTempData->DestData32 % pParserTempData->SourceData32; -} - - -VOID ProcessCompare(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - - CommonOperationDataTransformation(pParserTempData); - - // Here we just set flags based on evaluation - if (pParserTempData->DestData32==pParserTempData->SourceData32) - pParserTempData->CompareFlags = Equal; - else - pParserTempData->CompareFlags = - (UINT8)((pParserTempData->DestData32SourceData32) ? Below : Above); - -} - -VOID ProcessClear(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->DestData32 &= ~(AlignmentMask[pParserTempData->CD_Mask.SrcAlignment] << SourceAlignmentShift[pParserTempData->CD_Mask.SrcAlignment]); - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); - -} - -VOID ProcessShift(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - UINT32 mask = AlignmentMask[pParserTempData->CD_Mask.SrcAlignment] << SourceAlignmentShift[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetParametersDirect8(pParserTempData); - - // save original value of the destination - pParserTempData->Index = pParserTempData->DestData32 & ~mask; - pParserTempData->DestData32 &= mask; - - if (pParserTempData->pCmd->Header.Opcode < SHIFT_RIGHT_REG_OPCODE) - pParserTempData->DestData32 <<= pParserTempData->SourceData32; else - pParserTempData->DestData32 >>= pParserTempData->SourceData32; - - // Clear any bits shifted out of masked area... - pParserTempData->DestData32 &= mask; - // ... and restore the area outside of masked with original values - pParserTempData->DestData32 |= pParserTempData->Index; - - // write data back - PutDataFunctions[pParserTempData->ParametersType.Destination](pParserTempData); -} - -VOID ProcessTest(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->DestData32=GetDestination[pParserTempData->ParametersType.Destination](pParserTempData); - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - CommonOperationDataTransformation(pParserTempData); - pParserTempData->CompareFlags = - (UINT8)((pParserTempData->DestData32 & pParserTempData->SourceData32) ? NotEqual : Equal); - -} - -VOID ProcessSetFB_Base(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - pParserTempData->SourceData32 >>= SourceAlignmentShift[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->SourceData32 &= AlignmentMask[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->CurrentFB_Window=pParserTempData->SourceData32; -} - -VOID ProcessSwitch(PARSER_TEMP_DATA STACK_BASED * pParserTempData){ - pParserTempData->SourceData32=GetSource[pParserTempData->ParametersType.Source](pParserTempData); - pParserTempData->SourceData32 >>= SourceAlignmentShift[pParserTempData->CD_Mask.SrcAlignment]; - pParserTempData->SourceData32 &= AlignmentMask[pParserTempData->CD_Mask.SrcAlignment]; - while ( *(UINT16*)pParserTempData->pWorkingTableData->IP != (((UINT16)NOP_OPCODE << 8)+NOP_OPCODE)) - { - if (*pParserTempData->pWorkingTableData->IP == 'c') - { - pParserTempData->pWorkingTableData->IP++; - pParserTempData->DestData32=GetParametersDirect(pParserTempData); - pParserTempData->Index=GetParametersDirect16(pParserTempData); - if (pParserTempData->SourceData32 == pParserTempData->DestData32) - { - pParserTempData->pWorkingTableData->IP= RELATIVE_TO_TABLE(pParserTempData->Index); - return; - } - } - } - pParserTempData->pWorkingTableData->IP+=sizeof(UINT16); -} - - -VOID cmdSetDataBlock(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - UINT8 value; - UINT16* pMasterDataTable; - value=((COMMAND_TYPE_1*)pParserTempData->pWorkingTableData->IP)->Parameters.ByteXX.PA_Destination; - if (value == 0) pParserTempData->CurrentDataBlock=0; else - { - if (value == DB_CURRENT_COMMAND_TABLE) - { - pParserTempData->CurrentDataBlock= (UINT16)(pParserTempData->pWorkingTableData->pTableHead-pParserTempData->pDeviceData->pBIOS_Image); - } else - { - pMasterDataTable = GetDataMasterTablePointer(pParserTempData->pDeviceData); - pParserTempData->CurrentDataBlock= (TABLE_UNIT_TYPE)((PTABLE_UNIT_TYPE)pMasterDataTable)[value]; - } - } - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_VALUE_BYTE); -} - -VOID cmdSet_ATI_Port(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Multipurpose.CurrentPort=ATI_RegsPort; - pParserTempData->CurrentPortID = (UINT8)((COMMAND_TYPE_1*)pParserTempData->pWorkingTableData->IP)->Parameters.WordXX.PA_Destination; - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_OFFSET16); -} - -VOID cmdSet_Reg_Block(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->CurrentRegBlock = ((COMMAND_TYPE_1*)pParserTempData->pWorkingTableData->IP)->Parameters.WordXX.PA_Destination; - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_OFFSET16); -} - - -//Atavism!!! Review!!! -VOID cmdSet_X_Port(PARSER_TEMP_DATA STACK_BASED * pParserTempData){ - pParserTempData->Multipurpose.CurrentPort=pParserTempData->ParametersType.Destination; - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_ONLY); - -} - -VOID cmdDelay_Millisec(PARSER_TEMP_DATA STACK_BASED * pParserTempData){ - pParserTempData->SourceData32 = - ((COMMAND_TYPE_1*)pParserTempData->pWorkingTableData->IP)->Parameters.ByteXX.PA_Destination; - DelayMilliseconds(pParserTempData); - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_VALUE_BYTE); -} -VOID cmdDelay_Microsec(PARSER_TEMP_DATA STACK_BASED * pParserTempData){ - pParserTempData->SourceData32 = - ((COMMAND_TYPE_1*)pParserTempData->pWorkingTableData->IP)->Parameters.ByteXX.PA_Destination; - DelayMicroseconds(pParserTempData); - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_VALUE_BYTE); -} - -VOID ProcessPostChar(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->SourceData32 = - ((COMMAND_TYPE_1*)pParserTempData->pWorkingTableData->IP)->Parameters.ByteXX.PA_Destination; - PostCharOutput(pParserTempData); - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_VALUE_BYTE); -} - -VOID ProcessDebug(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->SourceData32 = - ((COMMAND_TYPE_1*)pParserTempData->pWorkingTableData->IP)->Parameters.ByteXX.PA_Destination; - CallerDebugFunc(pParserTempData); - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_VALUE_BYTE); -} - - -VOID ProcessDS(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->pWorkingTableData->IP+=((COMMAND_TYPE_1*)pParserTempData->pWorkingTableData->IP)->Parameters.WordXX.PA_Destination+sizeof(COMMAND_TYPE_OPCODE_OFFSET16); -} - - -VOID cmdCall_Table(PARSER_TEMP_DATA STACK_BASED * pParserTempData){ - UINT16* MasterTableOffset; - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_VALUE_BYTE); - MasterTableOffset = GetCommandMasterTablePointer(pParserTempData->pDeviceData); - if(((PTABLE_UNIT_TYPE)MasterTableOffset)[((COMMAND_TYPE_OPCODE_VALUE_BYTE*)pParserTempData->pCmd)->Value]!=0 ) // if the offset is not ZERO - { - pParserTempData->CommandSpecific.IndexInMasterTable=GetTrueIndexInMasterTable(pParserTempData,((COMMAND_TYPE_OPCODE_VALUE_BYTE*)pParserTempData->pCmd)->Value); - pParserTempData->Multipurpose.PS_SizeInDwordsUsedByCallingTable = - (((ATOM_COMMON_ROM_COMMAND_TABLE_HEADER *)pParserTempData->pWorkingTableData->pTableHead)->TableAttribute.PS_SizeInBytes>>2); - pParserTempData->pDeviceData->pParameterSpace+= - pParserTempData->Multipurpose.PS_SizeInDwordsUsedByCallingTable; - pParserTempData->Status=CD_CALL_TABLE; - pParserTempData->pCmd=(GENERIC_ATTRIBUTE_COMMAND*)MasterTableOffset; - } -} - - -VOID cmdNOP_(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ -} - - -static VOID NotImplemented(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - pParserTempData->Status = CD_NOT_IMPLEMENTED; -} - - -VOID ProcessJump(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - if ((pParserTempData->ParametersType.Destination == NoCondition) || - (pParserTempData->ParametersType.Destination == pParserTempData->CompareFlags )) - { - - pParserTempData->pWorkingTableData->IP= RELATIVE_TO_TABLE(((COMMAND_TYPE_OPCODE_OFFSET16*)pParserTempData->pWorkingTableData->IP)->CD_Offset16); - } else - { - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_OFFSET16); - } -} - -VOID ProcessJumpE(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - if ((pParserTempData->CompareFlags == Equal) || - (pParserTempData->CompareFlags == pParserTempData->ParametersType.Destination)) - { - - pParserTempData->pWorkingTableData->IP= RELATIVE_TO_TABLE(((COMMAND_TYPE_OPCODE_OFFSET16*)pParserTempData->pWorkingTableData->IP)->CD_Offset16); - } else - { - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_OFFSET16); - } -} - -VOID ProcessJumpNE(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - if (pParserTempData->CompareFlags != Equal) - { - - pParserTempData->pWorkingTableData->IP= RELATIVE_TO_TABLE(((COMMAND_TYPE_OPCODE_OFFSET16*)pParserTempData->pWorkingTableData->IP)->CD_Offset16); - } else - { - pParserTempData->pWorkingTableData->IP+=sizeof(COMMAND_TYPE_OPCODE_OFFSET16); - } -} - - - -COMMANDS_PROPERTIES CallTable[] = -{ - { NULL, 0,0}, - { ProcessMove, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessMove, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessMove, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessMove, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessMove, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessMove, destMC, sizeof(COMMAND_HEADER)}, - { ProcessAnd, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessAnd, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessAnd, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessAnd, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessAnd, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessAnd, destMC, sizeof(COMMAND_HEADER)}, - { ProcessOr, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessOr, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessOr, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessOr, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessOr, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessOr, destMC, sizeof(COMMAND_HEADER)}, - { ProcessShift, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessShift, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessShift, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessShift, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessShift, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessShift, destMC, sizeof(COMMAND_HEADER)}, - { ProcessShift, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessShift, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessShift, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessShift, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessShift, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessShift, destMC, sizeof(COMMAND_HEADER)}, - { ProcessMUL, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessMUL, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessMUL, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessMUL, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessMUL, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessMUL, destMC, sizeof(COMMAND_HEADER)}, - { ProcessDIV, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessDIV, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessDIV, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessDIV, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessDIV, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessDIV, destMC, sizeof(COMMAND_HEADER)}, - { ProcessADD, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessADD, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessADD, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessADD, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessADD, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessADD, destMC, sizeof(COMMAND_HEADER)}, - { ProcessSUB, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessSUB, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessSUB, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessSUB, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessSUB, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessSUB, destMC, sizeof(COMMAND_HEADER)}, - { cmdSet_ATI_Port, ATI_RegsPort, 0}, - { cmdSet_X_Port, PCI_Port, 0}, - { cmdSet_X_Port, SystemIO_Port, 0}, - { cmdSet_Reg_Block, 0, 0}, - { ProcessSetFB_Base,0, sizeof(COMMAND_HEADER)}, - { ProcessCompare, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessCompare, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessCompare, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessCompare, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessCompare, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessCompare, destMC, sizeof(COMMAND_HEADER)}, - { ProcessSwitch, 0, sizeof(COMMAND_HEADER)}, - { ProcessJump, NoCondition, 0}, - { ProcessJump, Equal, 0}, - { ProcessJump, Below, 0}, - { ProcessJump, Above, 0}, - { ProcessJumpE, Below, 0}, - { ProcessJumpE, Above, 0}, - { ProcessJumpNE, 0, 0}, - { ProcessTest, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessTest, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessTest, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessTest, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessTest, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessTest, destMC, sizeof(COMMAND_HEADER)}, - { cmdDelay_Millisec,0, 0}, - { cmdDelay_Microsec,0, 0}, - { cmdCall_Table, 0, 0}, - /*cmdRepeat*/ { NotImplemented, 0, 0}, - { ProcessClear, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessClear, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessClear, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessClear, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessClear, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessClear, destMC, sizeof(COMMAND_HEADER)}, - { cmdNOP_, 0, sizeof(COMMAND_TYPE_OPCODE_ONLY)}, - /*cmdEOT*/ { cmdNOP_, 0, sizeof(COMMAND_TYPE_OPCODE_ONLY)}, - { ProcessMask, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessMask, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessMask, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessMask, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessMask, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessMask, destMC, sizeof(COMMAND_HEADER)}, - /*cmdPost_Card*/ { ProcessPostChar, 0, 0}, - /*cmdBeep*/ { NotImplemented, 0, 0}, - /*cmdSave_Reg*/ { NotImplemented, 0, 0}, - /*cmdRestore_Reg*/{ NotImplemented, 0, 0}, - { cmdSetDataBlock, 0, 0}, - { ProcessXor, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessXor, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessXor, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessXor, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessXor, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessXor, destMC, sizeof(COMMAND_HEADER)}, - - { ProcessShl, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessShl, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessShl, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessShl, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessShl, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessShl, destMC, sizeof(COMMAND_HEADER)}, - - { ProcessShr, destRegister, sizeof(COMMAND_HEADER)}, - { ProcessShr, destParamSpace, sizeof(COMMAND_HEADER)}, - { ProcessShr, destWorkSpace, sizeof(COMMAND_HEADER)}, - { ProcessShr, destFrameBuffer, sizeof(COMMAND_HEADER)}, - { ProcessShr, destPLL, sizeof(COMMAND_HEADER)}, - { ProcessShr, destMC, sizeof(COMMAND_HEADER)}, - /*cmdDebug*/ { ProcessDebug, 0, 0}, - { ProcessDS, 0, 0}, - -}; - -// EOF diff --git a/src/add-ons/accelerants/radeon_hd/atombios/Decoder.c b/src/add-ons/accelerants/radeon_hd/atombios/Decoder.c deleted file mode 100644 index 95908d5fe6..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/Decoder.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - -Module Name: - - Decoder.c - -Abstract: - - Commands Decoder - -Revision History: - - NEG:24.09.2002 Initiated. ---*/ -//#include "AtomBios.h" -#include "Decoder.h" -#include "atombios.h" -#include "CD_binding.h" -#include "CD_Common_Types.h" - -#ifndef DISABLE_EASF - #include "easf.h" -#endif - - - -#define INDIRECT_IO_TABLE (((UINT16)&((ATOM_MASTER_LIST_OF_DATA_TABLES*)0)->IndirectIOAccess)/sizeof(TABLE_UNIT_TYPE) ) -extern COMMANDS_PROPERTIES CallTable[]; - - -UINT8 ProcessCommandProperties(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ - UINT8 opcode=((COMMAND_HEADER*)pParserTempData->pWorkingTableData->IP)->Opcode; - pParserTempData->pWorkingTableData->IP+=CallTable[opcode].headersize; - pParserTempData->ParametersType.Destination=CallTable[opcode].destination; - pParserTempData->ParametersType.Source = pParserTempData->pCmd->Header.Attribute.Source; - pParserTempData->CD_Mask.SrcAlignment=pParserTempData->pCmd->Header.Attribute.SourceAlignment; - pParserTempData->CD_Mask.DestAlignment=pParserTempData->pCmd->Header.Attribute.DestinationAlignment; - return opcode; -} - -UINT16* GetCommandMasterTablePointer(DEVICE_DATA STACK_BASED* pDeviceData) -{ - UINT16 *MasterTableOffset; -#ifndef DISABLE_EASF - if (pDeviceData->format == TABLE_FORMAT_EASF) - { - /* - make MasterTableOffset point to EASF_ASIC_SETUP_TABLE structure, including usSize. - */ - MasterTableOffset = (UINT16 *) (pDeviceData->pBIOS_Image+((EASF_ASIC_DESCRIPTOR*)pDeviceData->pBIOS_Image)->usAsicSetupTable_Offset); - } else -#endif - { -#ifndef UEFI_BUILD - MasterTableOffset = (UINT16 *)(*(UINT16 *)(pDeviceData->pBIOS_Image+OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER) + pDeviceData->pBIOS_Image); - MasterTableOffset = (UINT16 *)((ULONG)((ATOM_ROM_HEADER *)MasterTableOffset)->usMasterCommandTableOffset + pDeviceData->pBIOS_Image ); - MasterTableOffset =(UINT16 *) &(((ATOM_MASTER_COMMAND_TABLE *)MasterTableOffset)->ListOfCommandTables); -#else - MasterTableOffset = (UINT16 *)(&(GetCommandMasterTable( )->ListOfCommandTables)); -#endif - } - return MasterTableOffset; -} - -UINT16* GetDataMasterTablePointer(DEVICE_DATA STACK_BASED* pDeviceData) -{ - UINT16 *MasterTableOffset; - -#ifndef UEFI_BUILD - MasterTableOffset = (UINT16 *)(*(UINT16 *)(pDeviceData->pBIOS_Image+OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER) + pDeviceData->pBIOS_Image); - MasterTableOffset = (UINT16 *)((ULONG)((ATOM_ROM_HEADER *)MasterTableOffset)->usMasterDataTableOffset + pDeviceData->pBIOS_Image ); - MasterTableOffset =(UINT16 *) &(((ATOM_MASTER_DATA_TABLE *)MasterTableOffset)->ListOfDataTables); -#else - MasterTableOffset = (UINT16 *)(&(GetDataMasterTable( )->ListOfDataTables)); -#endif - return MasterTableOffset; -} - - -UINT8 GetTrueIndexInMasterTable(PARSER_TEMP_DATA STACK_BASED * pParserTempData, UINT8 IndexInMasterTable) -{ -#ifndef DISABLE_EASF - UINT16 i; - if ( pParserTempData->pDeviceData->format == TABLE_FORMAT_EASF) - { -/* - Consider EASF_ASIC_SETUP_TABLE structure pointed by pParserTempData->pCmd as UINT16[] - ((UINT16*)pParserTempData->pCmd)[0] = EASF_ASIC_SETUP_TABLE.usSize; - ((UINT16*)pParserTempData->pCmd)[1+n*4] = usFunctionID; - usFunctionID has to be shifted left by 2 before compare it to the value provided by caller. -*/ - for (i=1; (i < ((UINT16*)pParserTempData->pCmd)[0] >> 1);i+=4) - if ((UINT8)(((UINT16*)pParserTempData->pCmd)[i] << 2)==(IndexInMasterTable & EASF_TABLE_INDEX_MASK)) return (i+1+(IndexInMasterTable & EASF_TABLE_ATTR_MASK)); - return 1; - } else -#endif - { - return IndexInMasterTable; - } -} - -CD_STATUS ParseTable(DEVICE_DATA STACK_BASED* pDeviceData, UINT8 IndexInMasterTable) -{ - PARSER_TEMP_DATA ParserTempData; - WORKING_TABLE_DATA STACK_BASED* prevWorkingTableData; - - ParserTempData.pDeviceData=(DEVICE_DATA*)pDeviceData; -#ifndef DISABLE_EASF - if (pDeviceData->format == TABLE_FORMAT_EASF) - { - ParserTempData.IndirectIOTablePointer = 0; - } else -#endif - { - ParserTempData.pCmd=(GENERIC_ATTRIBUTE_COMMAND*)GetDataMasterTablePointer(pDeviceData); - ParserTempData.IndirectIOTablePointer=(UINT8*)((ULONG)(((PTABLE_UNIT_TYPE)ParserTempData.pCmd)[INDIRECT_IO_TABLE]) + pDeviceData->pBIOS_Image); - ParserTempData.IndirectIOTablePointer+=sizeof(ATOM_COMMON_TABLE_HEADER); - } - - ParserTempData.pCmd=(GENERIC_ATTRIBUTE_COMMAND*)GetCommandMasterTablePointer(pDeviceData); - IndexInMasterTable=GetTrueIndexInMasterTable((PARSER_TEMP_DATA STACK_BASED *)&ParserTempData,IndexInMasterTable); - if(((PTABLE_UNIT_TYPE)ParserTempData.pCmd)[IndexInMasterTable]!=0 ) // if the offset is not ZERO - { - ParserTempData.CommandSpecific.IndexInMasterTable=IndexInMasterTable; - ParserTempData.Multipurpose.CurrentPort=ATI_RegsPort; - ParserTempData.CurrentPortID=INDIRECT_IO_MM; - ParserTempData.CurrentRegBlock=0; - ParserTempData.CurrentFB_Window=0; - prevWorkingTableData=NULL; - ParserTempData.Status=CD_CALL_TABLE; - - do{ - - if (ParserTempData.Status==CD_CALL_TABLE) - { - IndexInMasterTable=ParserTempData.CommandSpecific.IndexInMasterTable; - if(((PTABLE_UNIT_TYPE)ParserTempData.pCmd)[IndexInMasterTable]!=0) // if the offset is not ZERO - { -#ifndef UEFI_BUILD - ParserTempData.pWorkingTableData =(WORKING_TABLE_DATA STACK_BASED*) AllocateWorkSpace(pDeviceData, - ((ATOM_COMMON_ROM_COMMAND_TABLE_HEADER*)(((PTABLE_UNIT_TYPE)ParserTempData.pCmd)[IndexInMasterTable]+pDeviceData->pBIOS_Image))->TableAttribute.WS_SizeInBytes+sizeof(WORKING_TABLE_DATA)); -#else - ParserTempData.pWorkingTableData =(WORKING_TABLE_DATA STACK_BASED*) AllocateWorkSpace(pDeviceData, - ((ATOM_COMMON_ROM_COMMAND_TABLE_HEADER*)(((PTABLE_UNIT_TYPE)ParserTempData.pCmd)[IndexInMasterTable]))->TableAttribute.WS_SizeInBytes+sizeof(WORKING_TABLE_DATA)); -#endif - if (ParserTempData.pWorkingTableData!=NULL) - { - ParserTempData.pWorkingTableData->pWorkSpace=(WORKSPACE_POINTER STACK_BASED*)((UINT8*)ParserTempData.pWorkingTableData+sizeof(WORKING_TABLE_DATA)); -#ifndef UEFI_BUILD - ParserTempData.pWorkingTableData->pTableHead = (UINT8 *)(((PTABLE_UNIT_TYPE)ParserTempData.pCmd)[IndexInMasterTable]+pDeviceData->pBIOS_Image); -#else - ParserTempData.pWorkingTableData->pTableHead = (UINT8 *)(((PTABLE_UNIT_TYPE)ParserTempData.pCmd)[IndexInMasterTable]); -#endif - ParserTempData.pWorkingTableData->IP=((UINT8*)ParserTempData.pWorkingTableData->pTableHead)+sizeof(ATOM_COMMON_ROM_COMMAND_TABLE_HEADER); - ParserTempData.pWorkingTableData->prevWorkingTableData=prevWorkingTableData; - prevWorkingTableData=ParserTempData.pWorkingTableData; - ParserTempData.Status = CD_SUCCESS; - } else ParserTempData.Status = CD_UNEXPECTED_BEHAVIOR; - } else ParserTempData.Status = CD_EXEC_TABLE_NOT_FOUND; - } - if (!CD_ERROR(ParserTempData.Status)) - { - ParserTempData.Status = CD_SUCCESS; - while (!CD_ERROR_OR_COMPLETED(ParserTempData.Status)) - { - - if (IS_COMMAND_VALID(((COMMAND_HEADER*)ParserTempData.pWorkingTableData->IP)->Opcode)) - { - ParserTempData.pCmd = (GENERIC_ATTRIBUTE_COMMAND*)ParserTempData.pWorkingTableData->IP; - - if (IS_END_OF_TABLE(((COMMAND_HEADER*)ParserTempData.pWorkingTableData->IP)->Opcode)) - { - ParserTempData.Status=CD_COMPLETED; - prevWorkingTableData=ParserTempData.pWorkingTableData->prevWorkingTableData; - - FreeWorkSpace(pDeviceData, ParserTempData.pWorkingTableData); - ParserTempData.pWorkingTableData=prevWorkingTableData; - if (prevWorkingTableData!=NULL) - { - ParserTempData.pDeviceData->pParameterSpace-= - (((ATOM_COMMON_ROM_COMMAND_TABLE_HEADER*)ParserTempData.pWorkingTableData-> - pTableHead)->TableAttribute.PS_SizeInBytes>>2); - } - // if there is a parent table where to return, then restore PS_pointer to the original state - } - else - { - IndexInMasterTable=ProcessCommandProperties((PARSER_TEMP_DATA STACK_BASED *)&ParserTempData); - (*CallTable[IndexInMasterTable].function)((PARSER_TEMP_DATA STACK_BASED *)&ParserTempData); -#if (PARSER_TYPE!=DRIVER_TYPE_PARSER) - BIOS_STACK_MODIFIER(); -#endif - } - } - else - { - ParserTempData.Status=CD_INVALID_OPCODE; - break; - } - - } // while - } // if - else - break; - } while (prevWorkingTableData!=NULL); - if (ParserTempData.Status == CD_COMPLETED) return CD_SUCCESS; - return ParserTempData.Status; - } else return CD_SUCCESS; -} - -// EOF - diff --git a/src/add-ons/accelerants/radeon_hd/atombios/Jamfile b/src/add-ons/accelerants/radeon_hd/atombios/Jamfile deleted file mode 100644 index f00f602980..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/Jamfile +++ /dev/null @@ -1,24 +0,0 @@ -SubDir HAIKU_TOP src add-ons accelerants radeon_hd atombios ; - -UseHeaders [ FDirName $(SUBDIR) includes ] ; -UsePrivateHeaders graphics ; -UsePrivateHeaders [ FDirName graphics radeon_hd ] ; -UsePrivateHeaders [ FDirName graphics common ] ; - -DEFINES += DISABLE_EASF ; -DEFINES += DRIVER_PARSER ; -DEFINES += ENABLE_ALL_SERVICE_FUNCTIONS ; - -# To avoid changing AMD vendor sources -TARGET_WARNING_CCFLAGS = [ FFilter $(TARGET_WARNING_CCFLAGS) - : -Wall -Wmissing-prototypes -Wcast-align ] ; - -if $(HAIKU_GCC_VERSION[1]) = 4 { - TARGET_WARNING_CCFLAGS += -Wno-pointer-to-int-cast ; -} - -StaticLibrary atombios.a : - Decoder.c - CD_Operations.c - hwserv_drv.c -; diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Definitions.h b/src/add-ons/accelerants/radeon_hd/atombios/atom-bits.h similarity index 58% rename from src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Definitions.h rename to src/add-ons/accelerants/radeon_hd/atombios/atom-bits.h index 98fd49546d..f94d2e2721 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Definitions.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom-bits.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 Advanced Micro Devices, Inc. + * Copyright 2008 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -18,32 +18,31 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. + * + * Author: Stanislaw Skowronek */ -/*++ +#ifndef ATOM_BITS_H +#define ATOM_BITS_H -Module Name: +static inline uint8_t get_u8(void *bios, int ptr) +{ + return ((unsigned char *)bios)[ptr]; +} +#define U8(ptr) get_u8(ctx->ctx->bios,(ptr)) +#define CU8(ptr) get_u8(ctx->bios,(ptr)) +static inline uint16_t get_u16(void *bios, int ptr) +{ + return get_u8(bios,ptr)|(((uint16_t)get_u8(bios,ptr+1))<<8); +} +#define U16(ptr) get_u16(ctx->ctx->bios,(ptr)) +#define CU16(ptr) get_u16(ctx->bios,(ptr)) +static inline uint32_t get_u32(void *bios, int ptr) +{ + return get_u16(bios,ptr)|(((uint32_t)get_u16(bios,ptr+2))<<16); +} +#define U32(ptr) get_u32(ctx->ctx->bios,(ptr)) +#define CU32(ptr) get_u32(ctx->bios,(ptr)) +#define CSTR(ptr) (((char *)(ctx->bios))+(ptr)) -CD_Definitions.h - -Abstract: - -Defines Script Language commands - -Revision History: - -NEG:27.08.2002 Initiated. ---*/ - -#include "CD_Structs.h" -#ifndef _CD_DEFINITIONS_H -#define _CD_DEFINITIONS_H_ -#ifdef DRIVER_PARSER -VOID *AllocateMemory(VOID *, UINT16); -VOID ReleaseMemory(DEVICE_DATA * , WORKING_TABLE_DATA* ); #endif -CD_STATUS ParseTable(DEVICE_DATA* pDeviceData, UINT8 IndexInMasterTable); -//CD_STATUS CD_MainLoop(PARSER_TEMP_DATA_POINTER pParserTempData); -CD_STATUS Main_Loop(DEVICE_DATA* pDeviceData,UINT16 *MasterTableOffset,UINT8 IndexInMasterTable); -UINT16* GetCommandMasterTablePointer(DEVICE_DATA* pDeviceData); -#endif //CD_DEFINITIONS diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom-names.h b/src/add-ons/accelerants/radeon_hd/atombios/atom-names.h new file mode 100644 index 0000000000..2cdc170b32 --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom-names.h @@ -0,0 +1,100 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Author: Stanislaw Skowronek + */ + +#ifndef ATOM_NAMES_H +#define ATOM_NAMES_H + +#include "atom.h" + +#ifdef ATOM_DEBUG + +#define ATOM_OP_NAMES_CNT 123 +static char *atom_op_names[ATOM_OP_NAMES_CNT]={ +"RESERVED", "MOVE_REG", "MOVE_PS", "MOVE_WS", "MOVE_FB", "MOVE_PLL", +"MOVE_MC", "AND_REG", "AND_PS", "AND_WS", "AND_FB", "AND_PLL", "AND_MC", +"OR_REG", "OR_PS", "OR_WS", "OR_FB", "OR_PLL", "OR_MC", "SHIFT_LEFT_REG", +"SHIFT_LEFT_PS", "SHIFT_LEFT_WS", "SHIFT_LEFT_FB", "SHIFT_LEFT_PLL", +"SHIFT_LEFT_MC", "SHIFT_RIGHT_REG", "SHIFT_RIGHT_PS", "SHIFT_RIGHT_WS", +"SHIFT_RIGHT_FB", "SHIFT_RIGHT_PLL", "SHIFT_RIGHT_MC", "MUL_REG", +"MUL_PS", "MUL_WS", "MUL_FB", "MUL_PLL", "MUL_MC", "DIV_REG", "DIV_PS", +"DIV_WS", "DIV_FB", "DIV_PLL", "DIV_MC", "ADD_REG", "ADD_PS", "ADD_WS", +"ADD_FB", "ADD_PLL", "ADD_MC", "SUB_REG", "SUB_PS", "SUB_WS", "SUB_FB", +"SUB_PLL", "SUB_MC", "SET_ATI_PORT", "SET_PCI_PORT", "SET_SYS_IO_PORT", +"SET_REG_BLOCK", "SET_FB_BASE", "COMPARE_REG", "COMPARE_PS", +"COMPARE_WS", "COMPARE_FB", "COMPARE_PLL", "COMPARE_MC", "SWITCH", +"JUMP", "JUMP_EQUAL", "JUMP_BELOW", "JUMP_ABOVE", "JUMP_BELOW_OR_EQUAL", +"JUMP_ABOVE_OR_EQUAL", "JUMP_NOT_EQUAL", "TEST_REG", "TEST_PS", "TEST_WS", +"TEST_FB", "TEST_PLL", "TEST_MC", "DELAY_MILLISEC", "DELAY_MICROSEC", +"CALL_TABLE", "REPEAT", "CLEAR_REG", "CLEAR_PS", "CLEAR_WS", "CLEAR_FB", +"CLEAR_PLL", "CLEAR_MC", "NOP", "EOT", "MASK_REG", "MASK_PS", "MASK_WS", +"MASK_FB", "MASK_PLL", "MASK_MC", "POST_CARD", "BEEP", "SAVE_REG", +"RESTORE_REG", "SET_DATA_BLOCK", "XOR_REG", "XOR_PS", "XOR_WS", "XOR_FB", +"XOR_PLL", "XOR_MC", "SHL_REG", "SHL_PS", "SHL_WS", "SHL_FB", "SHL_PLL", +"SHL_MC", "SHR_REG", "SHR_PS", "SHR_WS", "SHR_FB", "SHR_PLL", "SHR_MC", +"DEBUG", "CTB_DS", +}; + +#define ATOM_TABLE_NAMES_CNT 74 +static char *atom_table_names[ATOM_TABLE_NAMES_CNT]={ +"ASIC_Init", "GetDisplaySurfaceSize", "ASIC_RegistersInit", +"VRAM_BlockVenderDetection", "SetClocksRatio", "MemoryControllerInit", +"GPIO_PinInit", "MemoryParamAdjust", "DVOEncoderControl", +"GPIOPinControl", "SetEngineClock", "SetMemoryClock", "SetPixelClock", +"DynamicClockGating", "ResetMemoryDLL", "ResetMemoryDevice", +"MemoryPLLInit", "EnableMemorySelfRefresh", "AdjustMemoryController", +"EnableASIC_StaticPwrMgt", "ASIC_StaticPwrMgtStatusChange", +"DAC_LoadDetection", "TMDS2EncoderControl", "LCD1OutputControl", +"DAC1EncoderControl", "DAC2EncoderControl", "DVOOutputControl", +"CV1OutputControl", "SetCRTC_DPM_State", "TVEncoderControl", +"TMDS1EncoderControl", "LVDSEncoderControl", "TV1OutputControl", +"EnableScaler", "BlankCRTC", "EnableCRTC", "GetPixelClock", +"EnableVGA_Render", "EnableVGA_Access", "SetCRTC_Timing", +"SetCRTC_OverScan", "SetCRTC_Replication", "SelectCRTC_Source", +"EnableGraphSurfaces", "UpdateCRTC_DoubleBufferRegisters", +"LUT_AutoFill", "EnableHW_IconCursor", "GetMemoryClock", +"GetEngineClock", "SetCRTC_UsingDTDTiming", "TVBootUpStdPinDetection", +"DFP2OutputControl", "VRAM_BlockDetectionByStrap", "MemoryCleanUp", +"ReadEDIDFromHWAssistedI2C", "WriteOneByteToHWAssistedI2C", +"ReadHWAssistedI2CStatus", "SpeedFanControl", "PowerConnectorDetection", +"MC_Synchronization", "ComputeMemoryEnginePLL", "MemoryRefreshConversion", +"VRAM_GetCurrentInfoBlock", "DynamicMemorySettings", "MemoryTraining", +"EnableLVDS_SS", "DFP1OutputControl", "SetVoltage", "CRT1OutputControl", +"CRT2OutputControl", "SetupHWAssistedI2CStatus", "ClockSource", +"MemoryDeviceInit", "EnableYUV", +}; + +#define ATOM_IO_NAMES_CNT 5 +static char *atom_io_names[ATOM_IO_NAMES_CNT]={ +"MM", "PLL", "MC", "PCIE", "PCIE PORT", +}; + +#else + +#define ATOM_OP_NAMES_CNT 0 +#define ATOM_TABLE_NAMES_CNT 0 +#define ATOM_IO_NAMES_CNT 0 + +#endif + +#endif diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.c b/src/add-ons/accelerants/radeon_hd/atombios/atom.c new file mode 100644 index 0000000000..d3952e3041 --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.c @@ -0,0 +1,1114 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Author: Stanislaw Skowronek + */ + +#ifndef __HAIKU__ +#include +#include +#endif + +#include "atom.h" +#include "atom-names.h" +#include "atom-bits.h" + +#define ATOM_COND_ABOVE 0 +#define ATOM_COND_ABOVEOREQUAL 1 +#define ATOM_COND_ALWAYS 2 +#define ATOM_COND_BELOW 3 +#define ATOM_COND_BELOWOREQUAL 4 +#define ATOM_COND_EQUAL 5 +#define ATOM_COND_NOTEQUAL 6 + +#define ATOM_PORT_ATI 0 +#define ATOM_PORT_PCI 1 +#define ATOM_PORT_SYSIO 2 + +#define ATOM_UNIT_MICROSEC 0 +#define ATOM_UNIT_MILLISEC 1 + +#define PLL_INDEX 2 +#define PLL_DATA 3 + +typedef struct { + atom_context *ctx; + + uint32_t *ps, *ws; + int ps_shift; + uint16_t start; +} atom_exec_context; + +int atom_debug = 0; +void atom_execute_table(atom_context *ctx, int index, uint32_t *params); + +static uint32_t atom_arg_mask[8] = {0xFFFFFFFF, 0xFFFF, 0xFFFF00, 0xFFFF0000, 0xFF, 0xFF00, 0xFF0000, 0xFF000000}; +static int atom_arg_shift[8] = {0, 0, 8, 16, 0, 8, 16, 24}; +static int atom_dst_to_src[8][4] = { // translate destination alignment field to the source alignment encoding + { 0, 0, 0, 0 }, + { 1, 2, 3, 0 }, + { 1, 2, 3, 0 }, + { 1, 2, 3, 0 }, + { 4, 5, 6, 7 }, + { 4, 5, 6, 7 }, + { 4, 5, 6, 7 }, + { 4, 5, 6, 7 }, +}; +static int atom_def_dst[8] = { 0, 0, 1, 2, 0, 1, 2, 3 }; + +static int debug_depth = 0; +#ifdef ATOM_DEBUG +static void debug_print_spaces(int n) +{ + while(n--) + printk(" "); +} +#define DEBUG(...) do if(atom_debug) { printk(KERN_DEBUG __VA_ARGS__); } while(0) +#define SDEBUG(...) do if(atom_debug) { printk(KERN_DEBUG); debug_print_spaces(debug_depth); printk(__VA_ARGS__); } while(0) +#else +#define DEBUG(...) do { } while(0) +#define SDEBUG(...) do { } while(0) +#endif + +static uint32_t atom_iio_execute(atom_context *ctx, int base, uint32_t index, uint32_t data) +{ + uint32_t temp = 0xCDCDCDCD; + while(1) + switch(CU8(base)) { + case ATOM_IIO_NOP: + base++; + break; + case ATOM_IIO_READ: + temp = ctx->card->reg_read(ctx->card, CU16(base+1)); + base+=3; + break; + case ATOM_IIO_WRITE: + ctx->card->reg_write(ctx->card, CU16(base+1), temp); + base+=3; + break; + case ATOM_IIO_CLEAR: + temp &= ~((0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2)); + base+=3; + break; + case ATOM_IIO_SET: + temp |= (0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2); + base+=3; + break; + case ATOM_IIO_MOVE_INDEX: + temp &= ~((0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2)); + temp |= ((index >> CU8(base+2)) & (0xFFFFFFFF >> (32-CU8(base+1)))) << CU8(base+3); + base+=4; + break; + case ATOM_IIO_MOVE_DATA: + temp &= ~((0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2)); + temp |= ((data >> CU8(base+2)) & (0xFFFFFFFF >> (32-CU8(base+1)))) << CU8(base+3); + base+=4; + break; + case ATOM_IIO_MOVE_ATTR: + temp &= ~((0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2)); + temp |= ((ctx->io_attr >> CU8(base+2)) & (0xFFFFFFFF >> (32-CU8(base+1)))) << CU8(base+3); + base+=4; + break; + case ATOM_IIO_END: + return temp; + default: + printk(KERN_INFO "Unknown IIO opcode.\n"); + return 0; + } +} + +static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr, int *ptr, uint32_t *saved, int print) +{ + uint32_t idx, val = 0xCDCDCDCD, align, arg; + atom_context *gctx = ctx->ctx; + arg = attr & 7; + align = (attr >> 3) & 7; + switch(arg) { + case ATOM_ARG_REG: + idx = U16(*ptr); + (*ptr)+=2; + if(print) + DEBUG("REG[0x%04X]", idx); + idx += gctx->reg_block; + switch(gctx->io_mode) { + case ATOM_IO_MM: + val = gctx->card->reg_read(gctx->card, idx); + break; + case ATOM_IO_PCI: + printk(KERN_INFO "PCI registers are not implemented.\n"); + return 0; + case ATOM_IO_SYSIO: + printk(KERN_INFO "SYSIO registers are not implemented.\n"); + return 0; + default: + if(!(gctx->io_mode&0x80)) { + printk(KERN_INFO "Bad IO mode.\n"); + return 0; + } + if(!gctx->iio[gctx->io_mode&0x7F]) { + printk(KERN_INFO "Undefined indirect IO read method %d.\n", gctx->io_mode&0x7F); + return 0; + } + val = atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0x7F], idx, 0); + } + break; + case ATOM_ARG_PS: + idx = U8(*ptr); + (*ptr)++; + if(print) + DEBUG("PS[0x%02X]", idx); + val = ctx->ps[idx]; + break; + case ATOM_ARG_WS: + idx = U8(*ptr); + (*ptr)++; + if(print) + DEBUG("WS[0x%02X]", idx); + switch(idx) { + case ATOM_WS_QUOTIENT: + val = gctx->divmul[0]; + break; + case ATOM_WS_REMAINDER: + val = gctx->divmul[1]; + break; + case ATOM_WS_DATAPTR: + val = gctx->data_block; + break; + case ATOM_WS_SHIFT: + val = gctx->shift; + break; + case ATOM_WS_OR_MASK: + val = 1<shift; + break; + case ATOM_WS_AND_MASK: + val = ~(1<shift); + break; + case ATOM_WS_FB_WINDOW: + val = gctx->fb_base; + break; + case ATOM_WS_ATTRIBUTES: + val = gctx->io_attr; + break; + default: + val = ctx->ws[idx]; + } + break; + case ATOM_ARG_ID: + idx = U16(*ptr); + (*ptr)+=2; + if(print) { + if(gctx->data_block) + DEBUG("ID[0x%04X+%04X]", idx, gctx->data_block); + else + DEBUG("ID[0x%04X]", idx); + } + val = U32(idx + gctx->data_block); + break; + case ATOM_ARG_FB: + idx = U8(*ptr); + (*ptr)++; + if(print) + DEBUG("FB[0x%02X]", idx); + printk(KERN_INFO "FB access is not implemented.\n"); + return 0; + case ATOM_ARG_IMM: + switch(align) { + case ATOM_SRC_DWORD: + val = U32(*ptr); + (*ptr)+=4; + if(print) + DEBUG("IMM 0x%08X\n", val); + return val; + case ATOM_SRC_WORD0: + case ATOM_SRC_WORD8: + case ATOM_SRC_WORD16: + val = U16(*ptr); + (*ptr)+=2; + if(print) + DEBUG("IMM 0x%04X\n", val); + return val; + case ATOM_SRC_BYTE0: + case ATOM_SRC_BYTE8: + case ATOM_SRC_BYTE16: + case ATOM_SRC_BYTE24: + val = U8(*ptr); + (*ptr)++; + if(print) + DEBUG("IMM 0x%02X\n", val); + return val; + } + return 0; + case ATOM_ARG_PLL: + idx = U8(*ptr); + (*ptr)++; + if(print) + DEBUG("PLL[0x%02X]", idx); + gctx->card->reg_write(gctx->card, PLL_INDEX, idx); + val = gctx->card->reg_read(gctx->card, PLL_DATA); + break; + case ATOM_ARG_MC: + idx = U8(*ptr); + (*ptr)++; + if(print) + DEBUG("MC[0x%02X]", idx); + printk(KERN_INFO "MC registers are not implemented.\n"); + return 0; + } + if(saved) + *saved = val; + val &= atom_arg_mask[align]; + val >>= atom_arg_shift[align]; + if(print) + switch(align) { + case ATOM_SRC_DWORD: + DEBUG(".[31:0] -> 0x%08X\n", val); + break; + case ATOM_SRC_WORD0: + DEBUG(".[15:0] -> 0x%04X\n", val); + break; + case ATOM_SRC_WORD8: + DEBUG(".[23:8] -> 0x%04X\n", val); + break; + case ATOM_SRC_WORD16: + DEBUG(".[31:16] -> 0x%04X\n", val); + break; + case ATOM_SRC_BYTE0: + DEBUG(".[7:0] -> 0x%02X\n", val); + break; + case ATOM_SRC_BYTE8: + DEBUG(".[15:8] -> 0x%02X\n", val); + break; + case ATOM_SRC_BYTE16: + DEBUG(".[23:16] -> 0x%02X\n", val); + break; + case ATOM_SRC_BYTE24: + DEBUG(".[31:24] -> 0x%02X\n", val); + break; + } + return val; +} + +static void atom_skip_src_int(atom_exec_context *ctx, uint8_t attr, int *ptr) +{ + uint32_t align = (attr >> 3) & 7, arg = attr & 7; + switch(arg) { + case ATOM_ARG_REG: + case ATOM_ARG_ID: + (*ptr)+=2; + break; + case ATOM_ARG_PLL: + case ATOM_ARG_MC: + case ATOM_ARG_PS: + case ATOM_ARG_WS: + case ATOM_ARG_FB: + (*ptr)++; + break; + case ATOM_ARG_IMM: + switch(align) { + case ATOM_SRC_DWORD: + (*ptr)+=4; + return; + case ATOM_SRC_WORD0: + case ATOM_SRC_WORD8: + case ATOM_SRC_WORD16: + (*ptr)+=2; + return; + case ATOM_SRC_BYTE0: + case ATOM_SRC_BYTE8: + case ATOM_SRC_BYTE16: + case ATOM_SRC_BYTE24: + (*ptr)++; + return; + } + return; + } +} + +static uint32_t atom_get_src(atom_exec_context *ctx, uint8_t attr, int *ptr) +{ + return atom_get_src_int(ctx, attr, ptr, NULL, 1); +} + +static uint32_t atom_get_dst(atom_exec_context *ctx, int arg, uint8_t attr, int *ptr, uint32_t *saved, int print) +{ + return atom_get_src_int(ctx, arg|atom_dst_to_src[(attr>>3)&7][(attr>>6)&3]<<3, ptr, saved, print); +} + +static void atom_skip_dst(atom_exec_context *ctx, int arg, uint8_t attr, int *ptr) +{ + atom_skip_src_int(ctx, arg|atom_dst_to_src[(attr>>3)&7][(attr>>6)&3]<<3, ptr); +} + +static void atom_put_dst(atom_exec_context *ctx, int arg, uint8_t attr, int *ptr, uint32_t val, uint32_t saved) +{ + uint32_t align = atom_dst_to_src[(attr>>3)&7][(attr>>6)&3], old_val = val, idx; + atom_context *gctx = ctx->ctx; + old_val &= atom_arg_mask[align] >> atom_arg_shift[align]; + val <<= atom_arg_shift[align]; + val &= atom_arg_mask[align]; + saved &= ~atom_arg_mask[align]; + val |= saved; + switch(arg) { + case ATOM_ARG_REG: + idx = U16(*ptr); + (*ptr)+=2; + DEBUG("REG[0x%04X]", idx); + idx += gctx->reg_block; + switch(gctx->io_mode) { + case ATOM_IO_MM: + if(idx == 0) + gctx->card->reg_write(gctx->card, idx, val<<2); + else + gctx->card->reg_write(gctx->card, idx, val); + break; + case ATOM_IO_PCI: + printk(KERN_INFO "PCI registers are not implemented.\n"); + return; + case ATOM_IO_SYSIO: + printk(KERN_INFO "SYSIO registers are not implemented.\n"); + return; + default: + if(!(gctx->io_mode&0x80)) { + printk(KERN_INFO "Bad IO mode.\n"); + return; + } + if(!gctx->iio[gctx->io_mode&0xFF]) { + printk(KERN_INFO "Undefined indirect IO write method %d.\n", gctx->io_mode&0x7F); + return; + } + atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0xFF], idx, val); + } + break; + case ATOM_ARG_PS: + idx = U8(*ptr); + (*ptr)++; + DEBUG("PS[0x%02X]", idx); + ctx->ps[idx] = val; + break; + case ATOM_ARG_WS: + idx = U8(*ptr); + (*ptr)++; + DEBUG("WS[0x%02X]", idx); + switch(idx) { + case ATOM_WS_QUOTIENT: + gctx->divmul[0] = val; + break; + case ATOM_WS_REMAINDER: + gctx->divmul[1] = val; + break; + case ATOM_WS_DATAPTR: + gctx->data_block = val; + break; + case ATOM_WS_SHIFT: + gctx->shift = val; + break; + case ATOM_WS_OR_MASK: + case ATOM_WS_AND_MASK: + break; + case ATOM_WS_FB_WINDOW: + gctx->fb_base = val; + break; + case ATOM_WS_ATTRIBUTES: + gctx->io_attr = val; + break; + default: + ctx->ws[idx] = val; + } + break; + case ATOM_ARG_FB: + idx = U8(*ptr); + (*ptr)++; + DEBUG("FB[0x%02X]", idx); + printk(KERN_INFO "FB access is not implemented.\n"); + return; + case ATOM_ARG_PLL: + idx = U8(*ptr); + (*ptr)++; + DEBUG("PLL[0x%02X]", idx); + gctx->card->reg_write(gctx->card, PLL_INDEX, idx); + gctx->card->reg_write(gctx->card, PLL_DATA, val); + break; + case ATOM_ARG_MC: + idx = U8(*ptr); + (*ptr)++; + printk(KERN_INFO "MC registers are not implemented.\n"); + return; + } + switch(align) { + case ATOM_SRC_DWORD: + DEBUG(".[31:0] <- 0x%08X\n", old_val); + break; + case ATOM_SRC_WORD0: + DEBUG(".[15:0] <- 0x%04X\n", old_val); + break; + case ATOM_SRC_WORD8: + DEBUG(".[23:8] <- 0x%04X\n", old_val); + break; + case ATOM_SRC_WORD16: + DEBUG(".[31:16] <- 0x%04X\n", old_val); + break; + case ATOM_SRC_BYTE0: + DEBUG(".[7:0] <- 0x%02X\n", old_val); + break; + case ATOM_SRC_BYTE8: + DEBUG(".[15:8] <- 0x%02X\n", old_val); + break; + case ATOM_SRC_BYTE16: + DEBUG(".[23:16] <- 0x%02X\n", old_val); + break; + case ATOM_SRC_BYTE24: + DEBUG(".[31:24] <- 0x%02X\n", old_val); + break; + } +} + +static void atom_op_add(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src, saved; + int dptr = *ptr; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + SDEBUG(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst += src; + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + +static void atom_op_and(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src, saved; + int dptr = *ptr; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + SDEBUG(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst &= src; + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + +static void atom_op_beep(atom_exec_context *ctx, int *ptr, int arg) +{ + printk("ATOM BIOS beeped!\n"); +} + +static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) +{ + int idx = U8((*ptr)++); + if(idx < ATOM_TABLE_NAMES_CNT) + SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]); + else + SDEBUG(" table: %d\n", idx); + if(U16(ctx->ctx->cmd_table + 4 + 2*idx)) + atom_execute_table(ctx->ctx, idx, ctx->ps+ctx->ps_shift); +} + +static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t saved; + int dptr = *ptr; + attr &= 0x38; + attr |= atom_def_dst[attr>>3]<<6; + atom_get_dst(ctx, arg, attr, ptr, &saved, 0); + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, 0, saved); +} + +static void atom_op_compare(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src; + SDEBUG(" src1: "); + dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); + SDEBUG(" src2: "); + src = atom_get_src(ctx, attr, ptr); + ctx->ctx->cs_equal = (dst == src); + ctx->ctx->cs_above = (dst > src); + SDEBUG(" result: %s %s\n", ctx->ctx->cs_equal?"EQ":"NE", ctx->ctx->cs_above?"GT":"LE"); +} + +static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t count = U8((*ptr)++); + SDEBUG(" count: %d\n", count); + if(arg == ATOM_UNIT_MICROSEC) + schedule_timeout_uninterruptible(usecs_to_jiffies(count)); + else + schedule_timeout_uninterruptible(msecs_to_jiffies(count)); +} + +static void atom_op_div(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src; + SDEBUG(" src1: "); + dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); + SDEBUG(" src2: "); + src = atom_get_src(ctx, attr, ptr); + if(src != 0) { + ctx->ctx->divmul[0] = dst/src; + ctx->ctx->divmul[1] = dst%src; + } else { + ctx->ctx->divmul[0] = 0; + ctx->ctx->divmul[1] = 0; + } +} + +static void atom_op_eot(atom_exec_context *ctx, int *ptr, int arg) +{ + /* functionally, a nop */ +} + +static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) +{ + int execute = 0, target = U16(*ptr); + (*ptr)+=2; + switch(arg) { + case ATOM_COND_ABOVE: + execute = ctx->ctx->cs_above; + break; + case ATOM_COND_ABOVEOREQUAL: + execute = ctx->ctx->cs_above || ctx->ctx->cs_equal; + break; + case ATOM_COND_ALWAYS: + execute = 1; + break; + case ATOM_COND_BELOW: + execute = !(ctx->ctx->cs_above || ctx->ctx->cs_equal); + break; + case ATOM_COND_BELOWOREQUAL: + execute = !ctx->ctx->cs_above; + break; + case ATOM_COND_EQUAL: + execute = ctx->ctx->cs_equal; + break; + case ATOM_COND_NOTEQUAL: + execute = !ctx->ctx->cs_equal; + break; + } + if(arg != ATOM_COND_ALWAYS) + SDEBUG(" taken: %s\n", execute?"yes":"no"); + SDEBUG(" target: 0x%04X\n", target); + if(execute) + *ptr = ctx->start+target; +} + +static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src1, src2, saved; + int dptr = *ptr; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + SDEBUG(" src1: "); + src1 = atom_get_src(ctx, attr, ptr); + SDEBUG(" src2: "); + src2 = atom_get_src(ctx, attr, ptr); + dst &= src1; + dst |= src2; + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + +static void atom_op_move(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t src, saved; + int dptr = *ptr; + if(((attr>>3)&7) != ATOM_SRC_DWORD) + atom_get_dst(ctx, arg, attr, ptr, &saved, 0); + else { + atom_skip_dst(ctx, arg, attr, ptr); + saved = 0xCDCDCDCD; + } + SDEBUG(" src: "); + src = atom_get_src(ctx, attr, ptr); + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, src, saved); +} + +static void atom_op_mul(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src; + SDEBUG(" src1: "); + dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); + SDEBUG(" src2: "); + src = atom_get_src(ctx, attr, ptr); + ctx->ctx->divmul[0] = dst*src; +} + +static void atom_op_nop(atom_exec_context *ctx, int *ptr, int arg) +{ + /* nothing */ +} + +static void atom_op_or(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src, saved; + int dptr = *ptr; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + SDEBUG(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst |= src; + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + +static void atom_op_postcard(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t val = U8((*ptr)++); + SDEBUG("POST card output: 0x%02X\n", val); +} + +static void atom_op_repeat(atom_exec_context *ctx, int *ptr, int arg) +{ + printk(KERN_INFO "unimplemented!\n"); +} + +static void atom_op_restorereg(atom_exec_context *ctx, int *ptr, int arg) +{ + printk(KERN_INFO "unimplemented!\n"); +} + +static void atom_op_savereg(atom_exec_context *ctx, int *ptr, int arg) +{ + printk(KERN_INFO "unimplemented!\n"); +} + +static void atom_op_setdatablock(atom_exec_context *ctx, int *ptr, int arg) +{ + int idx = U8(*ptr); + (*ptr)++; + SDEBUG(" block: %d\n", idx); + if(!idx) + ctx->ctx->data_block = 0; + else if(idx==255) + ctx->ctx->data_block = ctx->start; + else + ctx->ctx->data_block = U16(ctx->ctx->data_table + 4 + 2*idx); + SDEBUG(" base: 0x%04X\n", ctx->ctx->data_block); +} + +static void atom_op_setfbbase(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + SDEBUG(" fb_base: "); + ctx->ctx->fb_base = atom_get_src(ctx, attr, ptr); +} + +static void atom_op_setport(atom_exec_context *ctx, int *ptr, int arg) +{ + int port; + switch(arg) { + case ATOM_PORT_ATI: + port = U16(*ptr); + if(port < ATOM_IO_NAMES_CNT) + SDEBUG(" port: %d (%s)\n", port, atom_io_names[port]); + else + SDEBUG(" port: %d\n", port); + if(!port) + ctx->ctx->io_mode = ATOM_IO_MM; + else + ctx->ctx->io_mode = ATOM_IO_IIO|port; + (*ptr)+=2; + break; + case ATOM_PORT_PCI: + ctx->ctx->io_mode = ATOM_IO_PCI; + (*ptr)++; + break; + case ATOM_PORT_SYSIO: + ctx->ctx->io_mode = ATOM_IO_SYSIO; + (*ptr)++; + break; + } +} + +static void atom_op_setregblock(atom_exec_context *ctx, int *ptr, int arg) +{ + ctx->ctx->reg_block = U16(*ptr); + (*ptr)+=2; + SDEBUG(" base: 0x%04X\n", ctx->ctx->reg_block); +} + +static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++), shift; + uint32_t saved, dst; + int dptr = *ptr; + attr &= 0x38; + attr |= atom_def_dst[attr>>3]<<6; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + shift = U8((*ptr)++); + SDEBUG(" shift: %d\n", shift); + dst <<= shift; + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + +static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++), shift; + uint32_t saved, dst; + int dptr = *ptr; + attr &= 0x38; + attr |= atom_def_dst[attr>>3]<<6; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + shift = U8((*ptr)++); + SDEBUG(" shift: %d\n", shift); + dst >>= shift; + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + +static void atom_op_sub(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src, saved; + int dptr = *ptr; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + SDEBUG(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst -= src; + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + +static void atom_op_switch(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t src, val, target; + SDEBUG(" switch: "); + src = atom_get_src(ctx, attr, ptr); + while(U16(*ptr) != ATOM_CASE_END) + if(U8(*ptr) == ATOM_CASE_MAGIC) { + (*ptr)++; + SDEBUG(" case: "); + val = atom_get_src(ctx, (attr&0x38)|ATOM_ARG_IMM, ptr); + target = U16(*ptr); + if(val == src) { + SDEBUG(" target: %04X\n", target); + *ptr = ctx->start+target; + return; + } + (*ptr) += 2; + } else { + printk(KERN_INFO "Bad case.\n"); + return; + } + (*ptr) += 2; +} + +static void atom_op_test(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src; + SDEBUG(" src1: "); + dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); + SDEBUG(" src2: "); + src = atom_get_src(ctx, attr, ptr); + ctx->ctx->cs_equal = ((dst & src) == 0); + SDEBUG(" result: %s\n", ctx->ctx->cs_equal?"EQ":"NE"); +} + +static void atom_op_xor(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8_t attr = U8((*ptr)++); + uint32_t dst, src, saved; + int dptr = *ptr; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + SDEBUG(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst ^= src; + SDEBUG(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + +static void atom_op_debug(atom_exec_context *ctx, int *ptr, int arg) +{ + printk(KERN_INFO "unimplemented!\n"); +} + +static struct { + void (*func)(atom_exec_context *, int *, int); + int arg; +} opcode_table[ATOM_OP_CNT] = { + { NULL, 0 }, + { atom_op_move, ATOM_ARG_REG }, + { atom_op_move, ATOM_ARG_PS }, + { atom_op_move, ATOM_ARG_WS }, + { atom_op_move, ATOM_ARG_FB }, + { atom_op_move, ATOM_ARG_PLL }, + { atom_op_move, ATOM_ARG_MC }, + { atom_op_and, ATOM_ARG_REG }, + { atom_op_and, ATOM_ARG_PS }, + { atom_op_and, ATOM_ARG_WS }, + { atom_op_and, ATOM_ARG_FB }, + { atom_op_and, ATOM_ARG_PLL }, + { atom_op_and, ATOM_ARG_MC }, + { atom_op_or, ATOM_ARG_REG }, + { atom_op_or, ATOM_ARG_PS }, + { atom_op_or, ATOM_ARG_WS }, + { atom_op_or, ATOM_ARG_FB }, + { atom_op_or, ATOM_ARG_PLL }, + { atom_op_or, ATOM_ARG_MC }, + { atom_op_shl, ATOM_ARG_REG }, + { atom_op_shl, ATOM_ARG_PS }, + { atom_op_shl, ATOM_ARG_WS }, + { atom_op_shl, ATOM_ARG_FB }, + { atom_op_shl, ATOM_ARG_PLL }, + { atom_op_shl, ATOM_ARG_MC }, + { atom_op_shr, ATOM_ARG_REG }, + { atom_op_shr, ATOM_ARG_PS }, + { atom_op_shr, ATOM_ARG_WS }, + { atom_op_shr, ATOM_ARG_FB }, + { atom_op_shr, ATOM_ARG_PLL }, + { atom_op_shr, ATOM_ARG_MC }, + { atom_op_mul, ATOM_ARG_REG }, + { atom_op_mul, ATOM_ARG_PS }, + { atom_op_mul, ATOM_ARG_WS }, + { atom_op_mul, ATOM_ARG_FB }, + { atom_op_mul, ATOM_ARG_PLL }, + { atom_op_mul, ATOM_ARG_MC }, + { atom_op_div, ATOM_ARG_REG }, + { atom_op_div, ATOM_ARG_PS }, + { atom_op_div, ATOM_ARG_WS }, + { atom_op_div, ATOM_ARG_FB }, + { atom_op_div, ATOM_ARG_PLL }, + { atom_op_div, ATOM_ARG_MC }, + { atom_op_add, ATOM_ARG_REG }, + { atom_op_add, ATOM_ARG_PS }, + { atom_op_add, ATOM_ARG_WS }, + { atom_op_add, ATOM_ARG_FB }, + { atom_op_add, ATOM_ARG_PLL }, + { atom_op_add, ATOM_ARG_MC }, + { atom_op_sub, ATOM_ARG_REG }, + { atom_op_sub, ATOM_ARG_PS }, + { atom_op_sub, ATOM_ARG_WS }, + { atom_op_sub, ATOM_ARG_FB }, + { atom_op_sub, ATOM_ARG_PLL }, + { atom_op_sub, ATOM_ARG_MC }, + { atom_op_setport, ATOM_PORT_ATI }, + { atom_op_setport, ATOM_PORT_PCI }, + { atom_op_setport, ATOM_PORT_SYSIO }, + { atom_op_setregblock, 0 }, + { atom_op_setfbbase, 0 }, + { atom_op_compare, ATOM_ARG_REG }, + { atom_op_compare, ATOM_ARG_PS }, + { atom_op_compare, ATOM_ARG_WS }, + { atom_op_compare, ATOM_ARG_FB }, + { atom_op_compare, ATOM_ARG_PLL }, + { atom_op_compare, ATOM_ARG_MC }, + { atom_op_switch, 0 }, + { atom_op_jump, ATOM_COND_ALWAYS }, + { atom_op_jump, ATOM_COND_EQUAL }, + { atom_op_jump, ATOM_COND_BELOW }, + { atom_op_jump, ATOM_COND_ABOVE }, + { atom_op_jump, ATOM_COND_BELOWOREQUAL }, + { atom_op_jump, ATOM_COND_ABOVEOREQUAL }, + { atom_op_jump, ATOM_COND_NOTEQUAL }, + { atom_op_test, ATOM_ARG_REG }, + { atom_op_test, ATOM_ARG_PS }, + { atom_op_test, ATOM_ARG_WS }, + { atom_op_test, ATOM_ARG_FB }, + { atom_op_test, ATOM_ARG_PLL }, + { atom_op_test, ATOM_ARG_MC }, + { atom_op_delay, ATOM_UNIT_MILLISEC }, + { atom_op_delay, ATOM_UNIT_MICROSEC }, + { atom_op_calltable, 0 }, + { atom_op_repeat, 0 }, + { atom_op_clear, ATOM_ARG_REG }, + { atom_op_clear, ATOM_ARG_PS }, + { atom_op_clear, ATOM_ARG_WS }, + { atom_op_clear, ATOM_ARG_FB }, + { atom_op_clear, ATOM_ARG_PLL }, + { atom_op_clear, ATOM_ARG_MC }, + { atom_op_nop, 0 }, + { atom_op_eot, 0 }, + { atom_op_mask, ATOM_ARG_REG }, + { atom_op_mask, ATOM_ARG_PS }, + { atom_op_mask, ATOM_ARG_WS }, + { atom_op_mask, ATOM_ARG_FB }, + { atom_op_mask, ATOM_ARG_PLL }, + { atom_op_mask, ATOM_ARG_MC }, + { atom_op_postcard, 0 }, + { atom_op_beep, 0 }, + { atom_op_savereg, 0 }, + { atom_op_restorereg, 0 }, + { atom_op_setdatablock, 0 }, + { atom_op_xor, ATOM_ARG_REG }, + { atom_op_xor, ATOM_ARG_PS }, + { atom_op_xor, ATOM_ARG_WS }, + { atom_op_xor, ATOM_ARG_FB }, + { atom_op_xor, ATOM_ARG_PLL }, + { atom_op_xor, ATOM_ARG_MC }, + { atom_op_shl, ATOM_ARG_REG }, + { atom_op_shl, ATOM_ARG_PS }, + { atom_op_shl, ATOM_ARG_WS }, + { atom_op_shl, ATOM_ARG_FB }, + { atom_op_shl, ATOM_ARG_PLL }, + { atom_op_shl, ATOM_ARG_MC }, + { atom_op_shr, ATOM_ARG_REG }, + { atom_op_shr, ATOM_ARG_PS }, + { atom_op_shr, ATOM_ARG_WS }, + { atom_op_shr, ATOM_ARG_FB }, + { atom_op_shr, ATOM_ARG_PLL }, + { atom_op_shr, ATOM_ARG_MC }, + { atom_op_debug, 0 }, +}; + +void atom_execute_table(atom_context *ctx, int index, uint32_t *params) +{ + int base = CU16(ctx->cmd_table+4+2*index); + int len, ws, ps, ptr; + unsigned char op; + atom_exec_context ectx; + + if(!base) + return; + + len = CU16(base+ATOM_CT_SIZE_PTR); + ws = CU8(base+ATOM_CT_WS_PTR); + ps = CU8(base+ATOM_CT_PS_PTR) & ATOM_CT_PS_MASK; + ptr = base+ATOM_CT_CODE_PTR; + + SDEBUG(">> execute %04X (len %d, WS %d, PS %d)\n", base, len, ws, ps); + + /* reset reg block */ + ctx->reg_block = 0; + ectx.ctx = ctx; + ectx.ps_shift = ps/4; + ectx.start = base; + ectx.ps = params; + if(ws) + ectx.ws = kzalloc(4*ws, GFP_KERNEL); + else + ectx.ws = NULL; + + debug_depth++; + while(1) { + op = CU8(ptr++); + if(op0) + opcode_table[op].func(&ectx, &ptr, opcode_table[op].arg); + else + break; + + if(op == ATOM_OP_EOT) + break; + } + debug_depth--; + SDEBUG("<<\n"); + + if(ws) + kfree(ectx.ws); +} + +static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; +static void atom_index_iio(atom_context *ctx, int base) +{ + ctx->iio = kzalloc(2*256, GFP_KERNEL); + while(CU8(base) == ATOM_IIO_START) { + ctx->iio[CU8(base+1)] = base+2; + base += 2; + while(CU8(base) != ATOM_IIO_END) + base += atom_iio_len[CU8(base)]; + base += 3; + } +} + +atom_context *atom_parse(card_info *card, void *bios) +{ + int base; + atom_context *ctx = kzalloc(sizeof(atom_context), GFP_KERNEL); + char *str; + + ctx->card = card; + ctx->bios = bios; + + if(CU16(0) != ATOM_BIOS_MAGIC) { + printk(KERN_INFO "Invalid BIOS magic.\n"); + kfree(ctx); + return NULL; + } + if(strncmp(CSTR(ATOM_ATI_MAGIC_PTR), ATOM_ATI_MAGIC, strlen(ATOM_ATI_MAGIC))) { + printk(KERN_INFO "Invalid ATI magic.\n"); + kfree(ctx); + return NULL; + } + + base = CU16(ATOM_ROM_TABLE_PTR); + if(strncmp(CSTR(base+ATOM_ROM_MAGIC_PTR), ATOM_ROM_MAGIC, strlen(ATOM_ROM_MAGIC))) { + printk(KERN_INFO "Invalid ATOM magic.\n"); + kfree(ctx); + return NULL; + } + + ctx->cmd_table = CU16(base+ATOM_ROM_CMD_PTR); + ctx->data_table = CU16(base+ATOM_ROM_DATA_PTR); + atom_index_iio(ctx, CU16(ctx->data_table+ATOM_DATA_IIO_PTR)+4); + + str = CSTR(CU16(base+ATOM_ROM_MSG_PTR)); + while(*str && ((*str == '\n') || (*str == '\r'))) + str++; + printk(KERN_INFO "ATOM BIOS: %s", str); + + return ctx; +} + +int atom_asic_init(atom_context *ctx) +{ + int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); + uint32_t ps[16]; + memset(ps, 0, 64); + + ps[0] = CU32(hwi + ATOM_FWI_DEFSCLK_PTR); + ps[1] = CU32(hwi + ATOM_FWI_DEFMCLK_PTR); + if(!ps[0] || !ps[1]) + return 1; + + if(!CU16(ctx->cmd_table+4+2*ATOM_CMD_INIT)) + return 1; + atom_execute_table(ctx, ATOM_CMD_INIT, ps); + + return 0; +} + +void atom_destroy(atom_context *ctx) +{ + if(ctx->iio) + kfree(ctx->iio); + kfree(ctx); +} diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h new file mode 100644 index 0000000000..324cb1f4c6 --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -0,0 +1,136 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Author: Stanislaw Skowronek + */ + +#ifndef ATOM_H +#define ATOM_H + +#ifndef __HAIKU__ +#include +#endif +#include "card.h" + +#define ATOM_BIOS_MAGIC 0xAA55 +#define ATOM_ATI_MAGIC_PTR 0x30 +#define ATOM_ATI_MAGIC " 761295520" +#define ATOM_ROM_TABLE_PTR 0x48 + +#define ATOM_ROM_MAGIC "ATOM" +#define ATOM_ROM_MAGIC_PTR 4 + +#define ATOM_ROM_MSG_PTR 0x10 +#define ATOM_ROM_CMD_PTR 0x1E +#define ATOM_ROM_DATA_PTR 0x20 + +#define ATOM_CMD_INIT 0 +#define ATOM_CMD_SETSCLK 0x0A +#define ATOM_CMD_SETMCLK 0x0B +#define ATOM_CMD_SETPCLK 0x0C + +#define ATOM_DATA_FWI_PTR 0xC +#define ATOM_DATA_IIO_PTR 0x32 + +#define ATOM_FWI_DEFSCLK_PTR 8 +#define ATOM_FWI_DEFMCLK_PTR 0xC +#define ATOM_FWI_MAXSCLK_PTR 0x24 +#define ATOM_FWI_MAXMCLK_PTR 0x28 + +#define ATOM_CT_SIZE_PTR 0 +#define ATOM_CT_WS_PTR 4 +#define ATOM_CT_PS_PTR 5 +#define ATOM_CT_PS_MASK 0x7F +#define ATOM_CT_CODE_PTR 6 + +#define ATOM_OP_CNT 123 +#define ATOM_OP_EOT 91 + +#define ATOM_CASE_MAGIC 0x63 +#define ATOM_CASE_END 0x5A5A + +#define ATOM_ARG_REG 0 +#define ATOM_ARG_PS 1 +#define ATOM_ARG_WS 2 +#define ATOM_ARG_ID 4 +#define ATOM_ARG_FB 3 +#define ATOM_ARG_IMM 5 +#define ATOM_ARG_PLL 6 +#define ATOM_ARG_MC 7 + +#define ATOM_SRC_DWORD 0 +#define ATOM_SRC_WORD0 1 +#define ATOM_SRC_WORD8 2 +#define ATOM_SRC_WORD16 3 +#define ATOM_SRC_BYTE0 4 +#define ATOM_SRC_BYTE8 5 +#define ATOM_SRC_BYTE16 6 +#define ATOM_SRC_BYTE24 7 + +#define ATOM_WS_QUOTIENT 0x40 +#define ATOM_WS_REMAINDER 0x41 +#define ATOM_WS_DATAPTR 0x42 +#define ATOM_WS_SHIFT 0x43 +#define ATOM_WS_OR_MASK 0x44 +#define ATOM_WS_AND_MASK 0x45 +#define ATOM_WS_FB_WINDOW 0x46 +#define ATOM_WS_ATTRIBUTES 0x47 + +#define ATOM_IIO_NOP 0 +#define ATOM_IIO_START 1 +#define ATOM_IIO_READ 2 +#define ATOM_IIO_WRITE 3 +#define ATOM_IIO_CLEAR 4 +#define ATOM_IIO_SET 5 +#define ATOM_IIO_MOVE_INDEX 6 +#define ATOM_IIO_MOVE_ATTR 7 +#define ATOM_IIO_MOVE_DATA 8 +#define ATOM_IIO_END 9 + +#define ATOM_IO_MM 0 +#define ATOM_IO_PCI 1 +#define ATOM_IO_SYSIO 2 +#define ATOM_IO_IIO 0x80 + +typedef struct atom_context_s { + card_info *card; + void *bios; + uint32_t cmd_table, data_table; + uint16_t *iio; + + uint16_t data_block; + uint32_t fb_base; + uint32_t divmul[2]; + uint16_t io_attr; + uint16_t reg_block; + uint8_t shift; + int cs_equal, cs_above; + int io_mode; +} atom_context; + +extern int atom_debug; + +atom_context *atom_parse(card_info *, void *); +void atom_execute_table(atom_context *, int, uint32_t *); +int atom_asic_init(atom_context *); +void atom_destroy(atom_context *); + +#endif diff --git a/src/add-ons/accelerants/radeon_hd/atombios/hwserv_drv.c b/src/add-ons/accelerants/radeon_hd/atombios/hwserv_drv.c deleted file mode 100644 index a5f5a5b80a..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/hwserv_drv.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - -Module Name: - - hwserv_drv.c - -Abstract: - - Functions defined in the Command Decoder Specification document - -Revision History: - - NEG:27.09.2002 Initiated. ---*/ -#include "CD_binding.h" -#include "CD_hw_services.h" - -//trace settings -#if DEBUG_OUTPUT_DEVICE & 1 - #define TRACE_USING_STDERR //define it to use stderr as trace output, -#endif -#if DEBUG_OUTPUT_DEVICE & 2 - #define TRACE_USING_RS232 -#endif -#if DEBUG_OUTPUT_DEVICE & 4 - #define TRACE_USING_LPT -#endif - - -#if DEBUG_PARSER == 4 - #define IO_TRACE //IO access trace switch, undefine it to turn off - #define PCI_TRACE //PCI access trace switch, undefine it to turn off - #define MEM_TRACE //MEM access trace switch, undefine it to turn off -#endif - -UINT32 CailReadATIRegister(VOID*,UINT32); -VOID CailWriteATIRegister(VOID*,UINT32,UINT32); -VOID* CailAllocateMemory(VOID*,UINT16); -VOID CailReleaseMemory(VOID *,VOID *); -VOID CailDelayMicroSeconds(VOID *,UINT32 ); -VOID CailReadPCIConfigData(VOID*,VOID*,UINT32,UINT16); -VOID CailWritePCIConfigData(VOID*,VOID*,UINT32,UINT16); -UINT32 CailReadFBData(VOID*,UINT32); -VOID CailWriteFBData(VOID*,UINT32,UINT32); -ULONG CailReadPLL(VOID *Context ,ULONG Address); -VOID CailWritePLL(VOID *Context,ULONG Address,ULONG Data); -ULONG CailReadMC(VOID *Context ,ULONG Address); -VOID CailWriteMC(VOID *Context ,ULONG Address,ULONG Data); - - -#if DEBUG_PARSER>0 -VOID CailVideoDebugPrint(VOID*,ULONG_PTR, UINT16); -#endif -// Delay function -#if ( defined ENABLE_PARSER_DELAY || defined ENABLE_ALL_SERVICE_FUNCTIONS ) - -VOID DelayMilliseconds(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - CailDelayMicroSeconds(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->SourceData32*1000); -} - -VOID DelayMicroseconds(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - CailDelayMicroSeconds(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->SourceData32); -} -#endif - -VOID PostCharOutput(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ -} - -VOID CallerDebugFunc(PARSER_TEMP_DATA STACK_BASED * pParserTempData) -{ -} - - -// PCI READ Access - -#if ( defined ENABLE_PARSER_PCIREAD8 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -UINT8 ReadPCIReg8(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - UINT8 rvl; - CailReadPCIConfigData(pWorkingTableData->pDeviceData->CAIL,&rvl,pWorkingTableData->Index,sizeof(UINT8)); - return rvl; -} -#endif - - -#if ( defined ENABLE_PARSER_PCIREAD16 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -UINT16 ReadPCIReg16(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - UINT16 rvl; - CailReadPCIConfigData(pWorkingTableData->pDeviceData->CAIL,&rvl,pWorkingTableData->Index,sizeof(UINT16)); - return rvl; - -} -#endif - - - -#if ( defined ENABLE_PARSER_PCIREAD32 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -UINT32 ReadPCIReg32 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - UINT32 rvl; - CailReadPCIConfigData(pWorkingTableData->pDeviceData->CAIL,&rvl,pWorkingTableData->Index,sizeof(UINT32)); - return rvl; -} -#endif - - -// PCI WRITE Access - -#if ( defined ENABLE_PARSER_PCIWRITE8 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -VOID WritePCIReg8 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - CailWritePCIConfigData(pWorkingTableData->pDeviceData->CAIL,&(pWorkingTableData->DestData32),pWorkingTableData->Index,sizeof(UINT8)); - -} - -#endif - - -#if ( defined ENABLE_PARSER_PCIWRITE16 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -VOID WritePCIReg16 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - CailWritePCIConfigData(pWorkingTableData->pDeviceData->CAIL,&(pWorkingTableData->DestData32),pWorkingTableData->Index,sizeof(UINT16)); -} - -#endif - - -#if ( defined ENABLE_PARSER_PCIWRITE32 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -VOID WritePCIReg32 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - CailWritePCIConfigData(pWorkingTableData->pDeviceData->CAIL,&(pWorkingTableData->DestData32),pWorkingTableData->Index,sizeof(UINT32)); -} -#endif - - - - -// System IO Access -#if ( defined ENABLE_PARSER_SYS_IOREAD8 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -UINT8 ReadSysIOReg8 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - UINT8 rvl; - rvl=0; - //rvl= (UINT8) ReadGenericPciCfg(dev,reg,sizeof(UINT8)); - return rvl; -} -#endif - - -#if ( defined ENABLE_PARSER_SYS_IOREAD16 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -UINT16 ReadSysIOReg16(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - UINT16 rvl; - rvl=0; - //rvl= (UINT16) ReadGenericPciCfg(dev,reg,sizeof(UINT16)); - return rvl; - -} -#endif - - - -#if ( defined ENABLE_PARSER_SYS_IOREAD32 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -UINT32 ReadSysIOReg32 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - UINT32 rvl; - rvl=0; - //rvl= (UINT32) ReadGenericPciCfg(dev,reg,sizeof(UINT32)); - return rvl; -} -#endif - - -// PCI WRITE Access - -#if ( defined ENABLE_PARSER_SYS_IOWRITE8 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -VOID WriteSysIOReg8 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - //WriteGenericPciCfg(dev,reg,sizeof(UINT8),(UINT32)value); -} - -#endif - - -#if ( defined ENABLE_PARSER_SYS_IOWRITE16 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -VOID WriteSysIOReg16 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - //WriteGenericPciCfg(dev,reg,sizeof(UINT16),(UINT32)value); -} - -#endif - - -#if ( defined ENABLE_PARSER_SYS_IOWRITE32 || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -VOID WriteSysIOReg32 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - //WriteGenericPciCfg(dev,reg,sizeof(UINT32),(UINT32)value); -} -#endif - -// ATI Registers Memory Mapped Access - -#if ( defined ENABLE_PARSER_REGISTERS_MEMORY_ACCESS || defined ENABLE_ALL_SERVICE_FUNCTIONS) - -UINT32 ReadReg32 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - return CailReadATIRegister(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->Index); -} - -VOID WriteReg32(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - CailWriteATIRegister(pWorkingTableData->pDeviceData->CAIL,(UINT16)pWorkingTableData->Index,pWorkingTableData->DestData32 ); -} - - -VOID ReadIndReg32 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - pWorkingTableData->IndirectData = CailReadATIRegister(pWorkingTableData->pDeviceData->CAIL,*(UINT16*)(pWorkingTableData->IndirectIOTablePointer+1)); -} - -VOID WriteIndReg32(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - CailWriteATIRegister(pWorkingTableData->pDeviceData->CAIL,*(UINT16*)(pWorkingTableData->IndirectIOTablePointer+1),pWorkingTableData->IndirectData ); -} - -#endif - -// ATI Registers IO Mapped Access - -#if ( defined ENABLE_PARSER_REGISTERS_IO_ACCESS || defined ENABLE_ALL_SERVICE_FUNCTIONS ) -UINT32 ReadRegIO (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - //return CailReadATIRegister(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->Index); - return 0; -} -VOID WriteRegIO(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - // return CailWriteATIRegister(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->Index,pWorkingTableData->DestData32 ); -} -#endif - -// access to Frame buffer, dummy function, need more information to implement it -UINT32 ReadFrameBuffer32 (PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - - return CailReadFBData(pWorkingTableData->pDeviceData->CAIL, (pWorkingTableData->Index <<2 )); - -} - -VOID WriteFrameBuffer32(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - CailWriteFBData(pWorkingTableData->pDeviceData->CAIL,(pWorkingTableData->Index <<2), pWorkingTableData->DestData32); - -} - - -VOID *AllocateMemory(DEVICE_DATA *pDeviceData , UINT16 MemSize) -{ - if(MemSize) - return(CailAllocateMemory(pDeviceData->CAIL,MemSize)); - else - return NULL; -} - - -VOID ReleaseMemory(DEVICE_DATA *pDeviceData , WORKING_TABLE_DATA* pWorkingTableData) -{ - if( pWorkingTableData) - CailReleaseMemory(pDeviceData->CAIL, pWorkingTableData); -} - - -UINT32 ReadMC32(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - UINT32 ReadData; - ReadData=(UINT32)CailReadMC(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->Index); - return ReadData; -} - -VOID WriteMC32(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - CailWriteMC(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->Index,pWorkingTableData->DestData32); -} - -UINT32 ReadPLL32(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - UINT32 ReadData; - ReadData=(UINT32)CailReadPLL(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->Index); - return ReadData; - -} - -VOID WritePLL32(PARSER_TEMP_DATA STACK_BASED * pWorkingTableData) -{ - CailWritePLL(pWorkingTableData->pDeviceData->CAIL,pWorkingTableData->Index,pWorkingTableData->DestData32); - -} - - - -#if DEBUG_PARSER>0 -VOID CD_print_string (DEVICE_DATA *pDeviceData, UINT8 *str) -{ - CailVideoDebugPrint( pDeviceData->CAIL, (ULONG_PTR) str, PARSER_STRINGS); -} - -VOID CD_print_value (DEVICE_DATA *pDeviceData, ULONG_PTR value, UINT16 value_type ) -{ - CailVideoDebugPrint( pDeviceData->CAIL, (ULONG_PTR)value, value_type); -} - -#endif - -// EOF diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Common_Types.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Common_Types.h deleted file mode 100644 index d998820c09..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Common_Types.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/*++ - -Module Name: - - CD_Common_Types.h - -Abstract: - - Defines common data types to use across platforms/SW components - -Revision History: - - NEG:17.09.2002 Initiated. ---*/ -#ifndef _COMMON_TYPES_H_ - #define _COMMON_TYPES_H_ - -// HAIKU_ADDITION START IF -#if defined(__HAIKU__) - #include -#else - #ifndef LINUX - #if _MSC_EXTENSIONS - - // - // use Microsoft* C complier dependent interger width types - // - // typedef unsigned __int64 uint64_t; - // typedef __int64 int64_t; - typedef unsigned __int32 uint32_t; - typedef __int32 int32_t; -#elif defined (__linux__) || defined (__NetBSD__) \ - || defined(__sun) || defined(__OpenBSD__) \ - || defined (__FreeBSD__) || defined(__DragonFly__) || defined(__GLIBC__) - typedef unsigned int uint32_t; - typedef int int32_t; - #else - typedef unsigned long uint32_t; - typedef signed long int32_t; - #endif - typedef unsigned char uint8_t; -#if (defined(__sun) && defined(_CHAR_IS_SIGNED)) - typedef char int8_t; -#else - typedef signed char int8_t; -#endif - typedef unsigned short uint16_t; - typedef signed short int16_t; - #endif - -#endif -// HAIKU_ADDITION ENDIF - -#ifndef UEFI_BUILD - typedef signed int intn_t; - typedef unsigned int uintn_t; -#else -#ifndef EFIX64 - typedef signed int intn_t; - typedef unsigned int uintn_t; -#endif -#endif -// HAIKU_ADDITION prevent silly Werror -#if 0 -#ifndef FGL_LINUX -#pragma warning ( disable : 4142 ) -#endif -#endif - - -#ifndef VOID -typedef void VOID; -#endif -#ifndef UEFI_BUILD - typedef intn_t INTN; - typedef uintn_t UINTN; -#else -#ifndef EFIX64 - typedef intn_t INTN; - typedef uintn_t UINTN; -#endif -#endif -#ifndef BOOLEAN -typedef uint8_t BOOLEAN; -#endif -#ifndef INT8 -typedef int8_t INT8; -#endif -#ifndef UINT8 -typedef uint8_t UINT8; -#endif -#ifndef INT16 -typedef int16_t INT16; -#endif -#ifndef UINT16 -typedef uint16_t UINT16; -#endif -#ifndef INT32 -typedef int32_t INT32; -#endif -#ifndef UINT32 -typedef uint32_t UINT32; -#endif -//typedef int64_t INT64; -//typedef uint64_t UINT64; -typedef uint8_t CHAR8; -typedef uint16_t CHAR16; -#ifndef USHORT -typedef UINT16 USHORT; -#endif -#ifndef UCHAR -typedef UINT8 UCHAR; -#endif -#ifndef ULONG -typedef UINT32 ULONG; -#endif - -#ifndef _WIN64 -#ifndef ULONG_PTR -typedef unsigned long ULONG_PTR; -#endif // ULONG_PTR -#endif // _WIN64 - -//#define FAR __far -#ifndef TRUE - #define TRUE ((BOOLEAN) 1 == 1) -#endif - -#ifndef FALSE - #define FALSE ((BOOLEAN) 0 == 1) -#endif - -#ifndef NULL - #define NULL ((VOID *) 0) -#endif - -//typedef UINTN CD_STATUS; - -// HAIKU_ADDITION prevent silly Werror -#if 0 -#ifndef FGL_LINUX -#pragma warning ( default : 4142 ) -#endif -#endif -#endif // _COMMON_TYPES_H_ - -// EOF diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Opcodes.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Opcodes.h deleted file mode 100644 index 2f3bec5fa3..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Opcodes.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/*++ - -Module Name: - -CD_OPCODEs.h - -Abstract: - -Defines Command Decoder OPCODEs - -Revision History: - -NEG:24.09.2002 Initiated. ---*/ -#ifndef _CD_OPCODES_H_ -#define _CD_OPCODES_H_ - -typedef enum _OPCODE { - Reserved_00= 0, // 0 = 0x00 - // MOVE_ group - MOVE_REG_OPCODE, // 1 = 0x01 - FirstValidCommand=MOVE_REG_OPCODE, - MOVE_PS_OPCODE, // 2 = 0x02 - MOVE_WS_OPCODE, // 3 = 0x03 - MOVE_FB_OPCODE, // 4 = 0x04 - MOVE_PLL_OPCODE, // 5 = 0x05 - MOVE_MC_OPCODE, // 6 = 0x06 - // Logic group - AND_REG_OPCODE, // 7 = 0x07 - AND_PS_OPCODE, // 8 = 0x08 - AND_WS_OPCODE, // 9 = 0x09 - AND_FB_OPCODE, // 10 = 0x0A - AND_PLL_OPCODE, // 11 = 0x0B - AND_MC_OPCODE, // 12 = 0x0C - OR_REG_OPCODE, // 13 = 0x0D - OR_PS_OPCODE, // 14 = 0x0E - OR_WS_OPCODE, // 15 = 0x0F - OR_FB_OPCODE, // 16 = 0x10 - OR_PLL_OPCODE, // 17 = 0x11 - OR_MC_OPCODE, // 18 = 0x12 - SHIFT_LEFT_REG_OPCODE, // 19 = 0x13 - SHIFT_LEFT_PS_OPCODE, // 20 = 0x14 - SHIFT_LEFT_WS_OPCODE, // 21 = 0x15 - SHIFT_LEFT_FB_OPCODE, // 22 = 0x16 - SHIFT_LEFT_PLL_OPCODE, // 23 = 0x17 - SHIFT_LEFT_MC_OPCODE, // 24 = 0x18 - SHIFT_RIGHT_REG_OPCODE, // 25 = 0x19 - SHIFT_RIGHT_PS_OPCODE, // 26 = 0x1A - SHIFT_RIGHT_WS_OPCODE, // 27 = 0x1B - SHIFT_RIGHT_FB_OPCODE, // 28 = 0x1C - SHIFT_RIGHT_PLL_OPCODE, // 29 = 0x1D - SHIFT_RIGHT_MC_OPCODE, // 30 = 0x1E - // Arithmetic group - MUL_REG_OPCODE, // 31 = 0x1F - MUL_PS_OPCODE, // 32 = 0x20 - MUL_WS_OPCODE, // 33 = 0x21 - MUL_FB_OPCODE, // 34 = 0x22 - MUL_PLL_OPCODE, // 35 = 0x23 - MUL_MC_OPCODE, // 36 = 0x24 - DIV_REG_OPCODE, // 37 = 0x25 - DIV_PS_OPCODE, // 38 = 0x26 - DIV_WS_OPCODE, // 39 = 0x27 - DIV_FB_OPCODE, // 40 = 0x28 - DIV_PLL_OPCODE, // 41 = 0x29 - DIV_MC_OPCODE, // 42 = 0x2A - ADD_REG_OPCODE, // 43 = 0x2B - ADD_PS_OPCODE, // 44 = 0x2C - ADD_WS_OPCODE, // 45 = 0x2D - ADD_FB_OPCODE, // 46 = 0x2E - ADD_PLL_OPCODE, // 47 = 0x2F - ADD_MC_OPCODE, // 48 = 0x30 - SUB_REG_OPCODE, // 49 = 0x31 - SUB_PS_OPCODE, // 50 = 0x32 - SUB_WS_OPCODE, // 51 = 0x33 - SUB_FB_OPCODE, // 52 = 0x34 - SUB_PLL_OPCODE, // 53 = 0x35 - SUB_MC_OPCODE, // 54 = 0x36 - // Control grouop - SET_ATI_PORT_OPCODE, // 55 = 0x37 - SET_PCI_PORT_OPCODE, // 56 = 0x38 - SET_SYS_IO_PORT_OPCODE, // 57 = 0x39 - SET_REG_BLOCK_OPCODE, // 58 = 0x3A - SET_FB_BASE_OPCODE, // 59 = 0x3B - COMPARE_REG_OPCODE, // 60 = 0x3C - COMPARE_PS_OPCODE, // 61 = 0x3D - COMPARE_WS_OPCODE, // 62 = 0x3E - COMPARE_FB_OPCODE, // 63 = 0x3F - COMPARE_PLL_OPCODE, // 64 = 0x40 - COMPARE_MC_OPCODE, // 65 = 0x41 - SWITCH_OPCODE, // 66 = 0x42 - JUMP__OPCODE, // 67 = 0x43 - JUMP_EQUAL_OPCODE, // 68 = 0x44 - JUMP_BELOW_OPCODE, // 69 = 0x45 - JUMP_ABOVE_OPCODE, // 70 = 0x46 - JUMP_BELOW_OR_EQUAL_OPCODE, // 71 = 0x47 - JUMP_ABOVE_OR_EQUAL_OPCODE, // 72 = 0x48 - JUMP_NOT_EQUAL_OPCODE, // 73 = 0x49 - TEST_REG_OPCODE, // 74 = 0x4A - TEST_PS_OPCODE, // 75 = 0x4B - TEST_WS_OPCODE, // 76 = 0x4C - TEST_FB_OPCODE, // 77 = 0x4D - TEST_PLL_OPCODE, // 78 = 0x4E - TEST_MC_OPCODE, // 79 = 0x4F - DELAY_MILLISEC_OPCODE, // 80 = 0x50 - DELAY_MICROSEC_OPCODE, // 81 = 0x51 - CALL_TABLE_OPCODE, // 82 = 0x52 - REPEAT_OPCODE, // 83 = 0x53 - // Miscellaneous group - CLEAR_REG_OPCODE, // 84 = 0x54 - CLEAR_PS_OPCODE, // 85 = 0x55 - CLEAR_WS_OPCODE, // 86 = 0x56 - CLEAR_FB_OPCODE, // 87 = 0x57 - CLEAR_PLL_OPCODE, // 88 = 0x58 - CLEAR_MC_OPCODE, // 89 = 0x59 - NOP_OPCODE, // 90 = 0x5A - EOT_OPCODE, // 91 = 0x5B - MASK_REG_OPCODE, // 92 = 0x5C - MASK_PS_OPCODE, // 93 = 0x5D - MASK_WS_OPCODE, // 94 = 0x5E - MASK_FB_OPCODE, // 95 = 0x5F - MASK_PLL_OPCODE, // 96 = 0x60 - MASK_MC_OPCODE, // 97 = 0x61 - // BIOS dedicated group - POST_CARD_OPCODE, // 98 = 0x62 - BEEP_OPCODE, // 99 = 0x63 - SAVE_REG_OPCODE, // 100 = 0x64 - RESTORE_REG_OPCODE, // 101 = 0x65 - SET_DATA_BLOCK_OPCODE, // 102 = 0x66 - - XOR_REG_OPCODE, // 103 = 0x67 - XOR_PS_OPCODE, // 104 = 0x68 - XOR_WS_OPCODE, // 105 = 0x69 - XOR_FB_OPCODE, // 106 = 0x6a - XOR_PLL_OPCODE, // 107 = 0x6b - XOR_MC_OPCODE, // 108 = 0x6c - - SHL_REG_OPCODE, // 109 = 0x6d - SHL_PS_OPCODE, // 110 = 0x6e - SHL_WS_OPCODE, // 111 = 0x6f - SHL_FB_OPCODE, // 112 = 0x70 - SHL_PLL_OPCODE, // 113 = 0x71 - SHL_MC_OPCODE, // 114 = 0x72 - - SHR_REG_OPCODE, // 115 = 0x73 - SHR_PS_OPCODE, // 116 = 0x74 - SHR_WS_OPCODE, // 117 = 0x75 - SHR_FB_OPCODE, // 118 = 0x76 - SHR_PLL_OPCODE, // 119 = 0x77 - SHR_MC_OPCODE, // 120 = 0x78 - - DEBUG_OPCODE, // 121 = 0x79 - CTB_DS_OPCODE, // 122 = 0x7A - - LastValidCommand = CTB_DS_OPCODE, - // Extension specificaTOR - Extension = 0x80, // 128 = 0x80 // Next byte is an OPCODE as well - Reserved_FF = 255 // 255 = 0xFF -}OPCODE; -#endif // _CD_OPCODES_H_ diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Structs.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Structs.h deleted file mode 100644 index 2d2f7a23be..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_Structs.h +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/*++ - -Module Name: - -CD_Struct.h - -Abstract: - -Defines Script Language commands - -Revision History: - -NEG:26.08.2002 Initiated. ---*/ - -#include "CD_binding.h" -#ifndef _CD_STRUCTS_H_ -#define _CD_STRUCTS_H_ - -#ifdef UEFI_BUILD -typedef UINT16** PTABLE_UNIT_TYPE; -typedef UINTN TABLE_UNIT_TYPE; -#else -typedef UINT16* PTABLE_UNIT_TYPE; -typedef UINT16 TABLE_UNIT_TYPE; -#endif - -#include "regsdef.h" //This important file is dynamically generated based on the ASIC!!!! - -#define PARSER_MAJOR_REVISION 5 -#define PARSER_MINOR_REVISION 0 - -//#include "atombios.h" -#if (PARSER_TYPE==DRIVER_TYPE_PARSER) && !defined(__HAIKU__) -#ifdef FGL_LINUX -#pragma pack(push,1) -#else -#pragma pack(push) -#pragma pack(1) -#endif -#endif - -#include "CD_Common_Types.h" -#include "CD_Opcodes.h" -typedef UINT16 WORK_SPACE_SIZE; -typedef enum _CD_STATUS{ - CD_SUCCESS, - CD_CALL_TABLE, - CD_COMPLETED=0x10, - CD_GENERAL_ERROR=0x80, - CD_INVALID_OPCODE, - CD_NOT_IMPLEMENTED, - CD_EXEC_TABLE_NOT_FOUND, - CD_EXEC_PARAMETER_ERROR, - CD_EXEC_PARSER_ERROR, - CD_INVALID_DESTINATION_TYPE, - CD_UNEXPECTED_BEHAVIOR, - CD_INVALID_SWITCH_OPERAND_SIZE -}CD_STATUS; - -#define PARSER_STRINGS 0 -#define PARSER_DEC 1 -#define PARSER_HEX 2 - -#define DB_CURRENT_COMMAND_TABLE 0xFF - -#define TABLE_FORMAT_BIOS 0 -#define TABLE_FORMAT_EASF 1 - -#define EASF_TABLE_INDEX_MASK 0xfc -#define EASF_TABLE_ATTR_MASK 0x03 - -#define CD_ERROR(a) (((INTN) (a)) > CD_COMPLETED) -#define CD_ERROR_OR_COMPLETED(a) (((INTN) (a)) > CD_SUCCESS) - - -#if (BIOS_PARSER==1) -#ifdef _H2INC -#define STACK_BASED -#else -extern __segment farstack; -#define STACK_BASED __based(farstack) -#endif -#else -#define STACK_BASED -#endif - -typedef enum _COMPARE_FLAGS{ - Below, - Equal, - Above, - NotEqual, - Overflow, - NoCondition -}COMPARE_FLAGS; - -typedef UINT16 IO_BASE_ADDR; - -typedef struct _BUS_DEV_FUNC_PCI_ADDR{ - UINT8 Register; - UINT8 Function; - UINT8 Device; - UINT8 Bus; -} BUS_DEV_FUNC_PCI_ADDR; - -typedef struct _BUS_DEV_FUNC{ - UINT8 Function : 3; - UINT8 Device : 5; - UINT8 Bus; -} BUS_DEV_FUNC; - -#ifndef UEFI_BUILD -typedef struct _PCI_CONFIG_ACCESS_CF8{ - UINT32 Reg : 8; - UINT32 Func : 3; - UINT32 Dev : 5; - UINT32 Bus : 8; - UINT32 Reserved: 7; - UINT32 Enable : 1; -} PCI_CONFIG_ACCESS_CF8; -#endif - -typedef enum _MEM_RESOURCE { - Stack_Resource, - FrameBuffer_Resource, - BIOS_Image_Resource -}MEM_RESOURCE; - -typedef enum _PORTS{ - ATI_RegsPort, - PCI_Port, - SystemIO_Port -}PORTS; - -typedef enum _OPERAND_TYPE { - typeRegister, - typeParamSpace, - typeWorkSpace, - typeFrameBuffer, - typeIndirect, - typeDirect, - typePLL, - typeMC -}OPERAND_TYPE; - -typedef enum _DESTINATION_OPERAND_TYPE { - destRegister, - destParamSpace, - destWorkSpace, - destFrameBuffer, - destPLL, - destMC -}DESTINATION_OPERAND_TYPE; - -typedef enum _SOURCE_OPERAND_TYPE { - sourceRegister, - sourceParamSpace, - sourceWorkSpace, - sourceFrameBuffer, - sourceIndirect, - sourceDirect, - sourcePLL, - sourceMC -}SOURCE_OPERAND_TYPE; - -typedef enum _ALIGNMENT_TYPE { - alignmentDword, - alignmentLowerWord, - alignmentMiddleWord, - alignmentUpperWord, - alignmentByte0, - alignmentByte1, - alignmentByte2, - alignmentByte3 -}ALIGNMENT_TYPE; - - -#define INDIRECT_IO_READ 0 -#define INDIRECT_IO_WRITE 0x80 -#define INDIRECT_IO_MM 0 -#define INDIRECT_IO_PLL 1 -#define INDIRECT_IO_MC 2 - -typedef struct _PARAMETERS_TYPE{ - UINT8 Destination; - UINT8 Source; -}PARAMETERS_TYPE; -/* The following structures don't used to allocate any type of objects(variables). - they are serve the only purpose: Get proper access to data(commands), found in the tables*/ -typedef struct _PA_BYTE_BYTE{ - UINT8 PA_Destination; - UINT8 PA_Source; - UINT8 PA_Padding[8]; -}PA_BYTE_BYTE; -typedef struct _PA_BYTE_WORD{ - UINT8 PA_Destination; - UINT16 PA_Source; - UINT8 PA_Padding[7]; -}PA_BYTE_WORD; -typedef struct _PA_BYTE_DWORD{ - UINT8 PA_Destination; - UINT32 PA_Source; - UINT8 PA_Padding[5]; -}PA_BYTE_DWORD; -typedef struct _PA_WORD_BYTE{ - UINT16 PA_Destination; - UINT8 PA_Source; - UINT8 PA_Padding[7]; -}PA_WORD_BYTE; -typedef struct _PA_WORD_WORD{ - UINT16 PA_Destination; - UINT16 PA_Source; - UINT8 PA_Padding[6]; -}PA_WORD_WORD; -typedef struct _PA_WORD_DWORD{ - UINT16 PA_Destination; - UINT32 PA_Source; - UINT8 PA_Padding[4]; -}PA_WORD_DWORD; -typedef struct _PA_WORD_XX{ - UINT16 PA_Destination; - UINT8 PA_Padding[8]; -}PA_WORD_XX; -typedef struct _PA_BYTE_XX{ - UINT8 PA_Destination; - UINT8 PA_Padding[9]; -}PA_BYTE_XX; -/*The following 6 definitions used for Mask operation*/ -typedef struct _PA_BYTE_BYTE_BYTE{ - UINT8 PA_Destination; - UINT8 PA_AndMaskByte; - UINT8 PA_OrMaskByte; - UINT8 PA_Padding[7]; -}PA_BYTE_BYTE_BYTE; -typedef struct _PA_BYTE_WORD_WORD{ - UINT8 PA_Destination; - UINT16 PA_AndMaskWord; - UINT16 PA_OrMaskWord; - UINT8 PA_Padding[5]; -}PA_BYTE_WORD_WORD; -typedef struct _PA_BYTE_DWORD_DWORD{ - UINT8 PA_Destination; - UINT32 PA_AndMaskDword; - UINT32 PA_OrMaskDword; - UINT8 PA_Padding; -}PA_BYTE_DWORD_DWORD; -typedef struct _PA_WORD_BYTE_BYTE{ - UINT16 PA_Destination; - UINT8 PA_AndMaskByte; - UINT8 PA_OrMaskByte; - UINT8 PA_Padding[6]; -}PA_WORD_BYTE_BYTE; -typedef struct _PA_WORD_WORD_WORD{ - UINT16 PA_Destination; - UINT16 PA_AndMaskWord; - UINT16 PA_OrMaskWord; - UINT8 PA_Padding[4]; -}PA_WORD_WORD_WORD; -typedef struct _PA_WORD_DWORD_DWORD{ - UINT16 PA_Destination; - UINT32 PA_AndMaskDword; - UINT32 PA_OrMaskDword; -}PA_WORD_DWORD_DWORD; - - -typedef union _PARAMETER_ACCESS { - PA_BYTE_XX ByteXX; - PA_BYTE_BYTE ByteByte; - PA_BYTE_WORD ByteWord; - PA_BYTE_DWORD ByteDword; - PA_WORD_BYTE WordByte; - PA_WORD_WORD WordWord; - PA_WORD_DWORD WordDword; - PA_WORD_XX WordXX; -/*The following 6 definitions used for Mask operation*/ - PA_BYTE_BYTE_BYTE ByteByteAndByteOr; - PA_BYTE_WORD_WORD ByteWordAndWordOr; - PA_BYTE_DWORD_DWORD ByteDwordAndDwordOr; - PA_WORD_BYTE_BYTE WordByteAndByteOr; - PA_WORD_WORD_WORD WordWordAndWordOr; - PA_WORD_DWORD_DWORD WordDwordAndDwordOr; -}PARAMETER_ACCESS; - -typedef struct _COMMAND_ATTRIBUTE { - UINT8 Source:3; - UINT8 SourceAlignment:3; - UINT8 DestinationAlignment:2; -}COMMAND_ATTRIBUTE; - -typedef struct _SOURCE_DESTINATION_ALIGNMENT{ - UINT8 DestAlignment; - UINT8 SrcAlignment; -}SOURCE_DESTINATION_ALIGNMENT; -typedef struct _MULTIPLICATION_RESULT{ - UINT32 Low32Bit; - UINT32 High32Bit; -}MULTIPLICATION_RESULT; -typedef struct _DIVISION_RESULT{ - UINT32 Quotient32; - UINT32 Reminder32; -}DIVISION_RESULT; -typedef union _DIVISION_MULTIPLICATION_RESULT{ - MULTIPLICATION_RESULT Multiplication; - DIVISION_RESULT Division; -}DIVISION_MULTIPLICATION_RESULT; -typedef struct _COMMAND_HEADER { - UINT8 Opcode; - COMMAND_ATTRIBUTE Attribute; -}COMMAND_HEADER; - -typedef struct _GENERIC_ATTRIBUTE_COMMAND{ - COMMAND_HEADER Header; - PARAMETER_ACCESS Parameters; -} GENERIC_ATTRIBUTE_COMMAND; - -typedef struct _COMMAND_TYPE_1{ - UINT8 Opcode; - PARAMETER_ACCESS Parameters; -} COMMAND_TYPE_1; - -typedef struct _COMMAND_TYPE_OPCODE_OFFSET16{ - UINT8 Opcode; - UINT16 CD_Offset16; -} COMMAND_TYPE_OPCODE_OFFSET16; - -typedef struct _COMMAND_TYPE_OPCODE_OFFSET32{ - UINT8 Opcode; - UINT32 CD_Offset32; -} COMMAND_TYPE_OPCODE_OFFSET32; - -typedef struct _COMMAND_TYPE_OPCODE_VALUE_BYTE{ - UINT8 Opcode; - UINT8 Value; -} COMMAND_TYPE_OPCODE_VALUE_BYTE; - -typedef union _COMMAND_SPECIFIC_UNION{ - UINT8 ContinueSwitch; - UINT8 ControlOperandSourcePosition; - UINT8 IndexInMasterTable; -} COMMAND_SPECIFIC_UNION; - - -typedef struct _CD_GENERIC_BYTE{ - UINT16 CommandType:3; - UINT16 CurrentParameterSize:3; - UINT16 CommandAccessType:3; - UINT16 CurrentPort:2; - UINT16 PS_SizeInDwordsUsedByCallingTable:5; -}CD_GENERIC_BYTE; - -typedef UINT8 COMMAND_TYPE_OPCODE_ONLY; - -typedef UINT8 COMMAND_HEADER_POINTER; - - -#if (PARSER_TYPE==BIOS_TYPE_PARSER) - -typedef struct _DEVICE_DATA { - UINT32 STACK_BASED *pParameterSpace; - UINT8 *pBIOS_Image; - UINT8 format; -#if (IO_INTERFACE==PARSER_INTERFACE) - IO_BASE_ADDR IOBase; -#endif -} DEVICE_DATA; - -#else - -typedef struct _DEVICE_DATA { - UINT32 *pParameterSpace; - VOID *CAIL; - UINT8 *pBIOS_Image; - UINT32 format; -} DEVICE_DATA; - -#endif - -struct _PARSER_TEMP_DATA; -typedef UINT32 WORKSPACE_POINTER; - -struct _WORKING_TABLE_DATA{ - UINT8 * pTableHead; - COMMAND_HEADER_POINTER * IP; // Commands pointer - WORKSPACE_POINTER STACK_BASED * pWorkSpace; - struct _WORKING_TABLE_DATA STACK_BASED * prevWorkingTableData; -}; - - - -typedef struct _PARSER_TEMP_DATA{ - DEVICE_DATA STACK_BASED *pDeviceData; - struct _WORKING_TABLE_DATA STACK_BASED *pWorkingTableData; - UINT32 SourceData32; - UINT32 DestData32; - DIVISION_MULTIPLICATION_RESULT MultiplicationOrDivision; - UINT32 Index; - UINT32 CurrentFB_Window; - UINT32 IndirectData; - UINT16 CurrentRegBlock; - TABLE_UNIT_TYPE CurrentDataBlock; - UINT16 AttributesData; -// UINT8 *IndirectIOTable; - UINT8 *IndirectIOTablePointer; - GENERIC_ATTRIBUTE_COMMAND *pCmd; //CurrentCommand; - SOURCE_DESTINATION_ALIGNMENT CD_Mask; - PARAMETERS_TYPE ParametersType; - CD_GENERIC_BYTE Multipurpose; - UINT8 CompareFlags; - COMMAND_SPECIFIC_UNION CommandSpecific; - CD_STATUS Status; - UINT8 Shift2MaskConverter; - UINT8 CurrentPortID; -} PARSER_TEMP_DATA; - - -typedef struct _WORKING_TABLE_DATA WORKING_TABLE_DATA; - - - -typedef VOID (*COMMANDS_DECODER)(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -typedef VOID (*WRITE_IO_FUNCTION)(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -typedef UINT32 (*READ_IO_FUNCTION)(PARSER_TEMP_DATA STACK_BASED * pParserTempData); -typedef UINT32 (*CD_GET_PARAMETERS)(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -typedef struct _COMMANDS_PROPERTIES -{ - COMMANDS_DECODER function; - UINT8 destination; - UINT8 headersize; -} COMMANDS_PROPERTIES; - -typedef struct _INDIRECT_IO_PARSER_COMMANDS -{ - COMMANDS_DECODER func; - UINT8 csize; -} INDIRECT_IO_PARSER_COMMANDS; - -#if (PARSER_TYPE==DRIVER_TYPE_PARSER) && !defined(__HAIKU__) -#pragma pack(pop) -#endif - -#endif diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_binding.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_binding.h deleted file mode 100644 index 7b021d3ed9..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_binding.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifdef NT_BUILD -#ifdef LH_BUILD -#include -#else -#include -#endif // LH_BUILD -#endif // NT_BUILD - - -#if ((defined DBG) || (defined DEBUG)) -#define DEBUG_PARSER 1 // enable parser debug output -#endif - -#define USE_SWITCH_COMMAND 1 -#define DRIVER_TYPE_PARSER 0x48 - -#define PARSER_TYPE DRIVER_TYPE_PARSER - -#define AllocateWorkSpace(x,y) AllocateMemory(pDeviceData,y) -#define FreeWorkSpace(x,y) ReleaseMemory(x,y) - -#define RELATIVE_TO_BIOS_IMAGE( x ) ((ULONG_PTR)x + (ULONG_PTR)((DEVICE_DATA*)pParserTempData->pDeviceData->pBIOS_Image)) -#define RELATIVE_TO_TABLE( x ) (x + (UCHAR *)(pParserTempData->pWorkingTableData->pTableHead)) - diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_hw_services.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_hw_services.h deleted file mode 100644 index 529fde590e..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/CD_hw_services.h +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef _HW_SERVICES_INTERFACE_ -#define _HW_SERVICES_INTERFACE_ - -#include "CD_Common_Types.h" -#include "CD_Structs.h" - - -// CD - from Command Decoder -typedef UINT16 CD_REG_INDEX; -typedef UINT8 CD_PCI_OFFSET; -typedef UINT16 CD_FB_OFFSET; -typedef UINT16 CD_SYS_IO_PORT; -typedef UINT8 CD_MEM_TYPE; -typedef UINT8 CD_MEM_SIZE; - -typedef VOID * CD_VIRT_ADDR; -typedef UINT32 CD_PHYS_ADDR; -typedef UINT32 CD_IO_ADDR; - -/***********************ATI Registers access routines**************************/ - - VOID ReadIndReg32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WriteIndReg32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - UINT32 ReadReg32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WriteReg32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - UINT32 ReadPLL32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WritePLL32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - UINT32 ReadMC32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WriteMC32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -/************************PCI Registers access routines*************************/ - - UINT8 ReadPCIReg8(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - UINT16 ReadPCIReg16(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - UINT32 ReadPCIReg32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WritePCIReg8(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WritePCIReg16(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WritePCIReg32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -/***************************Frame buffer access routines************************/ - - UINT32 ReadFrameBuffer32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WriteFrameBuffer32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -/******************System IO Registers access routines********************/ - - UINT8 ReadSysIOReg8(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - UINT16 ReadSysIOReg16(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - UINT32 ReadSysIOReg32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WriteSysIOReg8(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WriteSysIOReg16(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID WriteSysIOReg32(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - -/****************************Delay routines****************************************/ - - VOID DelayMicroseconds(PARSER_TEMP_DATA STACK_BASED * pParserTempData); // take WORKING_TABLE_DATA->SourceData32 as a delay value - - VOID DelayMilliseconds(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID PostCharOutput(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - VOID CallerDebugFunc(PARSER_TEMP_DATA STACK_BASED * pParserTempData); - - -//************************Tracing/Debugging routines and macroses******************/ -#define KEYPRESSED -1 - -#if (DEBUG_PARSER != 0) - -#ifdef DRIVER_PARSER - -VOID CD_print_string (DEVICE_DATA STACK_BASED *pDeviceData, UINT8 *str); -VOID CD_print_value (DEVICE_DATA STACK_BASED *pDeviceData, ULONG_PTR value, UINT16 value_type ); - -// Level 1 : can use WorkingTableData or pDeviceData -#define CD_TRACE_DL1(string) CD_print_string(pDeviceData, string); -#define CD_TRACETAB_DL1(string) CD_TRACE_DL1("\n");CD_TRACE_DL1(string) -#define CD_TRACEDEC_DL1(value) CD_print_value( pDeviceData, (ULONG_PTR)value, PARSER_DEC); -#define CD_TRACEHEX_DL1(value) CD_print_value( pDeviceData, (ULONG_PTR)value, PARSER_HEX); - -// Level 2:can use pWorkingTableData -#define CD_TRACE_DL2(string) CD_print_string( pWorkingTableData->pParserTempData->pDeviceData, string); -#define CD_TRACETAB_DL2(string) CD_TRACE_DL2("\n");CD_TRACE_DL2(string) -#define CD_TRACEDEC_DL2(value) CD_print_value( pWorkingTableData->pParserTempData->pDeviceData, (ULONG_PTR)value, PARSER_DEC); -#define CD_TRACEHEX_DL2(value) CD_print_value( pWorkingTableData->pParserTempData->pDeviceData, (ULONG_PTR)value, PARSER_HEX); - -// Level 3:can use pWorkingTableData -#define CD_TRACE_DL3(string) CD_print_string( pWorkingTableData->pParserTempData->pDeviceData, string); -#define CD_TRACETAB_DL3(string) CD_TRACE_DL3("\n");CD_TRACE_DL3(string) -#define CD_TRACEDEC_DL3(value) CD_print_value( pWorkingTableData->pParserTempData->pDeviceData, value, PARSER_DEC); -#define CD_TRACEHEX_DL3(value) CD_print_value( pWorkingTableData->pParserTempData->pDeviceData, value, PARSER_HEX); - -#define CD_TRACE(string) -#define CD_WAIT(what) -#define CD_BREAKPOINT() - -#else - - -VOID CD_assert (UINT8 *file, INTN lineno); //output file/line to debug console -VOID CD_postcode(UINT8 value); //output post code to debug console -VOID CD_print (UINT8 *str); //output text to debug console -VOID CD_print_dec(UINTN value); //output value in decimal format to debug console -VOID CD_print_hex(UINT32 value, UINT8 len); //output value in hexadecimal format to debug console -VOID CD_print_buf(UINT8 *p, UINTN len); //output dump of memory to debug console -VOID CD_wait(INT32 what); //wait for KEYPRESSED=-1 or Delay value expires -VOID CD_breakpoint(); //insert int3 opcode or 0xF1 (for American Arium) - -#define CD_ASSERT(condition) if(!(condition)) CD_assert(__FILE__, __LINE__) -#define CD_POSTCODE(value) CD_postcode(value) -#define CD_TRACE(string) CD_print(string) -#define CD_TRACETAB(string) CD_print(string) -#define CD_TRACEDEC(value) CD_print_dec( (UINTN)(value)) -#define CD_TRACEHEX(value) CD_print_hex( (UINT32)(value), sizeof(value) ) -#define CD_TRACEBUF(pointer, len) CD_print_buf( (UINT8 *)(pointer), (UINTN) len) -#define CD_WAIT(what) CD_wait((INT32)what) -#define CD_BREAKPOINT() CD_breakpoint() - -#if (DEBUG_PARSER == 4) -#define CD_ASSERT_DL4(condition) if(!(condition)) CD_assert(__FILE__, __LINE__) -#define CD_POSTCODE_DL4(value) CD_postcode(value) -#define CD_TRACE_DL4(string) CD_print(string) -#define CD_TRACETAB_DL4(string) CD_print("\n\t\t");CD_print(string) -#define CD_TRACEDEC_DL4(value) CD_print_dec( (UINTN)(value)) -#define CD_TRACEHEX_DL4(value) CD_print_hex( (UINT32)(value), sizeof(value) ) -#define CD_TRACEBUF_DL4(pointer, len) CD_print_buf( (UINT8 *)(pointer), (UINTN) len) -#define CD_WAIT_DL4(what) CD_wait((INT32)what) -#define CD_BREAKPOINT_DL4() CD_breakpoint() -#else -#define CD_ASSERT_DL4(condition) -#define CD_POSTCODE_DL4(value) -#define CD_TRACE_DL4(string) -#define CD_TRACETAB_DL4(string) -#define CD_TRACEDEC_DL4(value) -#define CD_TRACEHEX_DL4(value) -#define CD_TRACEBUF_DL4(pointer, len) -#define CD_WAIT_DL4(what) -#define CD_BREAKPOINT_DL4() -#endif - -#if (DEBUG_PARSER >= 3) -#define CD_ASSERT_DL3(condition) if(!(condition)) CD_assert(__FILE__, __LINE__) -#define CD_POSTCODE_DL3(value) CD_postcode(value) -#define CD_TRACE_DL3(string) CD_print(string) -#define CD_TRACETAB_DL3(string) CD_print("\n\t\t");CD_print(string) -#define CD_TRACEDEC_DL3(value) CD_print_dec( (UINTN)(value)) -#define CD_TRACEHEX_DL3(value) CD_print_hex( (UINT32)(value), sizeof(value) ) -#define CD_TRACEBUF_DL3(pointer, len) CD_print_buf( (UINT8 *)(pointer), (UINTN) len) -#define CD_WAIT_DL3(what) CD_wait((INT32)what) -#define CD_BREAKPOINT_DL3() CD_breakpoint() -#else -#define CD_ASSERT_DL3(condition) -#define CD_POSTCODE_DL3(value) -#define CD_TRACE_DL3(string) -#define CD_TRACETAB_DL3(string) -#define CD_TRACEDEC_DL3(value) -#define CD_TRACEHEX_DL3(value) -#define CD_TRACEBUF_DL3(pointer, len) -#define CD_WAIT_DL3(what) -#define CD_BREAKPOINT_DL3() -#endif - - -#if (DEBUG_PARSER >= 2) -#define CD_ASSERT_DL2(condition) if(!(condition)) CD_assert(__FILE__, __LINE__) -#define CD_POSTCODE_DL2(value) CD_postcode(value) -#define CD_TRACE_DL2(string) CD_print(string) -#define CD_TRACETAB_DL2(string) CD_print("\n\t");CD_print(string) -#define CD_TRACEDEC_DL2(value) CD_print_dec( (UINTN)(value)) -#define CD_TRACEHEX_DL2(value) CD_print_hex( (UINT32)(value), sizeof(value) ) -#define CD_TRACEBUF_DL2(pointer, len) CD_print_buf( (UINT8 *)(pointer), (UINTN) len) -#define CD_WAIT_DL2(what) CD_wait((INT32)what) -#define CD_BREAKPOINT_DL2() CD_breakpoint() -#else -#define CD_ASSERT_DL2(condition) -#define CD_POSTCODE_DL2(value) -#define CD_TRACE_DL2(string) -#define CD_TRACETAB_DL2(string) -#define CD_TRACEDEC_DL2(value) -#define CD_TRACEHEX_DL2(value) -#define CD_TRACEBUF_DL2(pointer, len) -#define CD_WAIT_DL2(what) -#define CD_BREAKPOINT_DL2() -#endif - - -#if (DEBUG_PARSER >= 1) -#define CD_ASSERT_DL1(condition) if(!(condition)) CD_assert(__FILE__, __LINE__) -#define CD_POSTCODE_DL1(value) CD_postcode(value) -#define CD_TRACE_DL1(string) CD_print(string) -#define CD_TRACETAB_DL1(string) CD_print("\n");CD_print(string) -#define CD_TRACEDEC_DL1(value) CD_print_dec( (UINTN)(value)) -#define CD_TRACEHEX_DL1(value) CD_print_hex( (UINT32)(value), sizeof(value) ) -#define CD_TRACEBUF_DL1(pointer, len) CD_print_buf( (UINT8 *)(pointer), (UINTN) len) -#define CD_WAIT_DL1(what) CD_wait((INT32)what) -#define CD_BREAKPOINT_DL1() CD_breakpoint() -#else -#define CD_ASSERT_DL1(condition) -#define CD_POSTCODE_DL1(value) -#define CD_TRACE_DL1(string) -#define CD_TRACETAB_DL1(string) -#define CD_TRACEDEC_DL1(value) -#define CD_TRACEHEX_DL1(value) -#define CD_TRACEBUF_DL1(pointer, len) -#define CD_WAIT_DL1(what) -#define CD_BREAKPOINT_DL1() -#endif - -#endif //#ifdef DRIVER_PARSER - - -#else - -#define CD_ASSERT(condition) -#define CD_POSTCODE(value) -#define CD_TRACE(string) -#define CD_TRACEDEC(value) -#define CD_TRACEHEX(value) -#define CD_TRACEBUF(pointer, len) -#define CD_WAIT(what) -#define CD_BREAKPOINT() - -#define CD_ASSERT_DL4(condition) -#define CD_POSTCODE_DL4(value) -#define CD_TRACE_DL4(string) -#define CD_TRACETAB_DL4(string) -#define CD_TRACEDEC_DL4(value) -#define CD_TRACEHEX_DL4(value) -#define CD_TRACEBUF_DL4(pointer, len) -#define CD_WAIT_DL4(what) -#define CD_BREAKPOINT_DL4() - -#define CD_ASSERT_DL3(condition) -#define CD_POSTCODE_DL3(value) -#define CD_TRACE_DL3(string) -#define CD_TRACETAB_DL3(string) -#define CD_TRACEDEC_DL3(value) -#define CD_TRACEHEX_DL3(value) -#define CD_TRACEBUF_DL3(pointer, len) -#define CD_WAIT_DL3(what) -#define CD_BREAKPOINT_DL3() - -#define CD_ASSERT_DL2(condition) -#define CD_POSTCODE_DL2(value) -#define CD_TRACE_DL2(string) -#define CD_TRACETAB_DL2(string) -#define CD_TRACEDEC_DL2(value) -#define CD_TRACEHEX_DL2(value) -#define CD_TRACEBUF_DL2(pointer, len) -#define CD_WAIT_DL2(what) -#define CD_BREAKPOINT_DL2() - -#define CD_ASSERT_DL1(condition) -#define CD_POSTCODE_DL1(value) -#define CD_TRACE_DL1(string) -#define CD_TRACETAB_DL1(string) -#define CD_TRACEDEC_DL1(value) -#define CD_TRACEHEX_DL1(value) -#define CD_TRACEBUF_DL1(pointer, len) -#define CD_WAIT_DL1(what) -#define CD_BREAKPOINT_DL1() - - -#endif //#if (DEBUG_PARSER > 0) - - -#ifdef CHECKSTACK -VOID CD_fillstack(UINT16 size); -UINT16 CD_checkstack(UINT16 size); -#define CD_CHECKSTACK(stacksize) CD_checkstack(stacksize) -#define CD_FILLSTACK(stacksize) CD_fillstack(stacksize) -#else -#define CD_CHECKSTACK(stacksize) 0 -#define CD_FILLSTACK(stacksize) -#endif - - -#endif diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/Decoder.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/Decoder.h deleted file mode 100644 index 5ce2022c1d..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/Decoder.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/*++ - -Module Name: - -Decoder.h - -Abstract: - -Includes all helper headers - -Revision History: - -NEG:27.08.2002 Initiated. ---*/ -#ifndef _DECODER_H_ -#define _DECODER_H_ -#define WS_QUOTIENT_C 64 -#define WS_REMINDER_C (WS_QUOTIENT_C+1) -#define WS_DATAPTR_C (WS_REMINDER_C+1) -#define WS_SHIFT_C (WS_DATAPTR_C+1) -#define WS_OR_MASK_C (WS_SHIFT_C+1) -#define WS_AND_MASK_C (WS_OR_MASK_C+1) -#define WS_FB_WINDOW_C (WS_AND_MASK_C+1) -#define WS_ATTRIBUTES_C (WS_FB_WINDOW_C+1) -#define WS_REGPTR_C (WS_ATTRIBUTES_C+1) -#define PARSER_VERSION_MAJOR 0x00000000 -#define PARSER_VERSION_MINOR 0x0000000E -#define PARSER_VERSION (PARSER_VERSION_MAJOR | PARSER_VERSION_MINOR) -#include "CD_binding.h" -#include "CD_Common_Types.h" -#include "CD_hw_services.h" -#include "CD_Structs.h" -#include "CD_Definitions.h" -#include "CD_Opcodes.h" - -#define SOURCE_ONLY_CMD_TYPE 0//0xFE -#define SOURCE_DESTINATION_CMD_TYPE 1//0xFD -#define DESTINATION_ONLY_CMD_TYPE 2//0xFC - -#define ACCESS_TYPE_BYTE 0//0xF9 -#define ACCESS_TYPE_WORD 1//0xF8 -#define ACCESS_TYPE_DWORD 2//0xF7 -#define SWITCH_TYPE_ACCESS 3//0xF6 - -#define CD_CONTINUE 0//0xFB -#define CD_STOP 1//0xFA - - -#define IS_END_OF_TABLE(cmd) ((cmd) == EOT_OPCODE) -#define IS_COMMAND_VALID(cmd) (((cmd)<=LastValidCommand)&&((cmd)>=FirstValidCommand)) -#define IS_IT_SHIFT_COMMAND(Opcode) ((Opcode<=SHIFT_RIGHT_MC_OPCODE)&&(Opcode>=SHIFT_LEFT_REG_OPCODE)) -#define IS_IT_XXXX_COMMAND(Group, Opcode) ((Opcode<=Group##_MC_OPCODE)&&(Opcode>=Group##_REG_OPCODE)) -#define CheckCaseAndAdjustIP_Macro(size) \ - if (pParserTempData->SourceData32==(UINT32)((CASE_OFFSET*)pParserTempData->pWorkingTableData->IP)->XX_Access.size##.Access.Value){\ - pParserTempData->CommandSpecific.ContinueSwitch = CD_STOP;\ - pParserTempData->pWorkingTableData->IP =(COMMAND_HEADER_POINTER *) RELATIVE_TO_TABLE(((CASE_OFFSET*)pParserTempData->pWorkingTableData->IP)->XX_Access.size##.Access.JumpOffset);\ - }else{\ - pParserTempData->pWorkingTableData->IP+=(sizeof (CASE_##size##ACCESS)\ - +sizeof(((CASE_OFFSET*)pParserTempData->pWorkingTableData->IP)->CaseSignature));\ - } - -#endif -/* pWorkingTableData->pCmd->Header.Attribute.SourceAlignment=alignmentLowerWord;\*/ - -// EOF diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/ObjectID.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/ObjectID.h deleted file mode 100644 index b42843843c..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/ObjectID.h +++ /dev/null @@ -1,643 +0,0 @@ -/* -* Copyright 2006-2007 Advanced Micro Devices, Inc. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -*/ -/* based on stg/asic_reg/drivers/inc/asic_reg/ObjectID.h ver 23 */ - -#ifndef _OBJECTID_H -#define _OBJECTID_H - -#if defined(_X86_) -#pragma pack(1) -#endif - -/****************************************************/ -/* Graphics Object Type Definition */ -/****************************************************/ -#define GRAPH_OBJECT_TYPE_NONE 0x0 -#define GRAPH_OBJECT_TYPE_GPU 0x1 -#define GRAPH_OBJECT_TYPE_ENCODER 0x2 -#define GRAPH_OBJECT_TYPE_CONNECTOR 0x3 -#define GRAPH_OBJECT_TYPE_ROUTER 0x4 -/* deleted */ - -/****************************************************/ -/* Encoder Object ID Definition */ -/****************************************************/ -#define ENCODER_OBJECT_ID_NONE 0x00 - -/* Radeon Class Display Hardware */ -#define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01 -#define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02 -#define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03 -#define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04 -#define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */ -#define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06 -#define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07 - -/* External Third Party Encoders */ -#define ENCODER_OBJECT_ID_SI170B 0x08 -#define ENCODER_OBJECT_ID_CH7303 0x09 -#define ENCODER_OBJECT_ID_CH7301 0x0A -#define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */ -#define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C -#define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D -#define ENCODER_OBJECT_ID_TITFP513 0x0E -#define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */ -#define ENCODER_OBJECT_ID_VT1623 0x10 -#define ENCODER_OBJECT_ID_HDMI_SI1930 0x11 -#define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12 -/* Kaleidoscope (KLDSCP) Class Display Hardware (internal) */ -#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13 -#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14 -#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15 -#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */ -#define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */ -#define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */ -#define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19 -#define ENCODER_OBJECT_ID_VT1625 0x1A -#define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B -#define ENCODER_OBJECT_ID_DP_AN9801 0x1C -#define ENCODER_OBJECT_ID_DP_DP501 0x1D -#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY 0x1E -#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA 0x1F -#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 0x20 -#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 0x21 - -#define ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO 0xFF - -/****************************************************/ -/* Connector Object ID Definition */ -/****************************************************/ -#define CONNECTOR_OBJECT_ID_NONE 0x00 -#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01 -#define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02 -#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03 -#define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D 0x04 -#define CONNECTOR_OBJECT_ID_VGA 0x05 -#define CONNECTOR_OBJECT_ID_COMPOSITE 0x06 -#define CONNECTOR_OBJECT_ID_SVIDEO 0x07 -#define CONNECTOR_OBJECT_ID_YPbPr 0x08 -#define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09 -#define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */ -#define CONNECTOR_OBJECT_ID_SCART 0x0B -#define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C -#define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D -#define CONNECTOR_OBJECT_ID_LVDS 0x0E -#define CONNECTOR_OBJECT_ID_7PIN_DIN 0x0F -#define CONNECTOR_OBJECT_ID_PCIE_CONNECTOR 0x10 -#define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11 -#define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12 -#define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13 -#define CONNECTOR_OBJECT_ID_eDP 0x14 -#define CONNECTOR_OBJECT_ID_MXM 0x15 - -/* deleted */ - -/****************************************************/ -/* Router Object ID Definition */ -/****************************************************/ -#define ROUTER_OBJECT_ID_NONE 0x00 -#define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01 - -/****************************************************/ -/* Generic Object ID Definition */ -/****************************************************/ -#define GENERIC_OBJECT_ID_NONE 0x00 -#define GENERIC_OBJECT_ID_GLSYNC 0x01 -#define GENERIC_OBJECT_ID_PX2_NON_DRIVABLE 0x02 -#define GENERIC_OBJECT_ID_MXM_OPM 0x03 - -/****************************************************/ -/* Graphics Object ENUM ID Definition */ -/****************************************************/ -#define GRAPH_OBJECT_ENUM_ID1 0x01 -#define GRAPH_OBJECT_ENUM_ID2 0x02 -#define GRAPH_OBJECT_ENUM_ID3 0x03 -#define GRAPH_OBJECT_ENUM_ID4 0x04 -#define GRAPH_OBJECT_ENUM_ID5 0x05 -#define GRAPH_OBJECT_ENUM_ID6 0x06 -#define GRAPH_OBJECT_ENUM_ID7 0x07 - -/****************************************************/ -/* Graphics Object ID Bit definition */ -/****************************************************/ -#define OBJECT_ID_MASK 0x00FF -#define ENUM_ID_MASK 0x0700 -#define RESERVED1_ID_MASK 0x0800 -#define OBJECT_TYPE_MASK 0x7000 -#define RESERVED2_ID_MASK 0x8000 - -#define OBJECT_ID_SHIFT 0x00 -#define ENUM_ID_SHIFT 0x08 -#define OBJECT_TYPE_SHIFT 0x0C - - -/****************************************************/ -/* Graphics Object family definition */ -/****************************************************/ -#define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) (GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \ - GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT) -/****************************************************/ -/* GPU Object ID definition - Shared with BIOS */ -/****************************************************/ -#define GPU_ENUM_ID1 ( GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT) - -/****************************************************/ -/* Encoder Object ID definition - Shared with BIOS */ -/****************************************************/ -/* -#define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101 -#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102 -#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103 -#define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104 -#define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105 -#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106 -#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107 -#define ENCODER_SIL170B_ENUM_ID1 0x2108 -#define ENCODER_CH7303_ENUM_ID1 0x2109 -#define ENCODER_CH7301_ENUM_ID1 0x210A -#define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B -#define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 0x210C -#define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 0x210D -#define ENCODER_TITFP513_ENUM_ID1 0x210E -#define ENCODER_INTERNAL_LVTM1_ENUM_ID1 0x210F -#define ENCODER_VT1623_ENUM_ID1 0x2110 -#define ENCODER_HDMI_SI1930_ENUM_ID1 0x2111 -#define ENCODER_HDMI_INTERNAL_ENUM_ID1 0x2112 -#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113 -#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114 -#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115 -#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116 -#define ENCODER_SI178_ENUM_ID1 0x2117 -#define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118 -#define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119 -#define ENCODER_VT1625_ENUM_ID1 0x211A -#define ENCODER_HDMI_SI1932_ENUM_ID1 0x211B -#define ENCODER_ENCODER_DP_AN9801_ENUM_ID1 0x211C -#define ENCODER_DP_DP501_ENUM_ID1 0x211D -#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E -*/ -#define ENCODER_INTERNAL_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT) - -#define ENCODER_SIL170B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT) - -#define ENCODER_CH7303_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT) - -#define ENCODER_CH7301_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT) - -#define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) - -#define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) - - -#define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT) - - -#define ENCODER_TITFP513_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_LVTM1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT) - -#define ENCODER_VT1623_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT) - -#define ENCODER_HDMI_SI1930_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT) - -#define ENCODER_HDMI_INTERNAL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) - - -#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) - - -#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) // Shared with CV/TV and CRT - -#define ENCODER_SI178_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT) - -#define ENCODER_MVPU_FPGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_DDI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT) - -#define ENCODER_VT1625_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT) - -#define ENCODER_HDMI_SI1932_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT) - -#define ENCODER_DP_DP501_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT) - -#define ENCODER_DP_AN9801_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) - -#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) - -#define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT) - -/****************************************************/ -/* Connector Object ID definition - Shared with BIOS */ -/****************************************************/ -/* -#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 0x3101 -#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 0x3102 -#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 0x3103 -#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 0x3104 -#define CONNECTOR_VGA_ENUM_ID1 0x3105 -#define CONNECTOR_COMPOSITE_ENUM_ID1 0x3106 -#define CONNECTOR_SVIDEO_ENUM_ID1 0x3107 -#define CONNECTOR_YPbPr_ENUM_ID1 0x3108 -#define CONNECTOR_D_CONNECTORE_ENUM_ID1 0x3109 -#define CONNECTOR_9PIN_DIN_ENUM_ID1 0x310A -#define CONNECTOR_SCART_ENUM_ID1 0x310B -#define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 0x310C -#define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 0x310D -#define CONNECTOR_LVDS_ENUM_ID1 0x310E -#define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F -#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110 -*/ -#define CONNECTOR_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) - -#define CONNECTOR_LVDS_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) - -#define CONNECTOR_eDP_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT) - -#define CONNECTOR_eDP_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT) - -#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) - -#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) - -#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) - -#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) - -#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) - -#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) - -#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) - -#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) - -#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) - -#define CONNECTOR_VGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) - -#define CONNECTOR_VGA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) - -#define CONNECTOR_COMPOSITE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) - -#define CONNECTOR_COMPOSITE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) - -#define CONNECTOR_SVIDEO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) - -#define CONNECTOR_SVIDEO_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) - -#define CONNECTOR_YPbPr_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) - -#define CONNECTOR_YPbPr_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) - -#define CONNECTOR_D_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) - -#define CONNECTOR_D_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) - -#define CONNECTOR_9PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) - -#define CONNECTOR_9PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) - -#define CONNECTOR_SCART_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) - -#define CONNECTOR_SCART_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) - -#define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) - -#define CONNECTOR_HDMI_TYPE_A_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) - -#define CONNECTOR_HDMI_TYPE_A_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) - -#define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) - -#define CONNECTOR_HDMI_TYPE_B_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) - -#define CONNECTOR_7PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) -#define CONNECTOR_7PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) - -#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) - -#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) - -#define CONNECTOR_CROSSFIRE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) - -#define CONNECTOR_CROSSFIRE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) - - -#define CONNECTOR_HARDCODE_DVI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) - -#define CONNECTOR_HARDCODE_DVI_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) - -#define CONNECTOR_DISPLAYPORT_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) - -#define CONNECTOR_DISPLAYPORT_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) - -#define CONNECTOR_DISPLAYPORT_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) - -#define CONNECTOR_DISPLAYPORT_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) - -#define CONNECTOR_DISPLAYPORT_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) - -#define CONNECTOR_DISPLAYPORT_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) - -#define CONNECTOR_MXM_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_A - -#define CONNECTOR_MXM_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_B - -#define CONNECTOR_MXM_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_C - -#define CONNECTOR_MXM_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_D - -#define CONNECTOR_MXM_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_TXxx - -#define CONNECTOR_MXM_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_UXxx - -#define CONNECTOR_MXM_ENUM_ID7 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID7 << ENUM_ID_SHIFT |\ - CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DAC - -/****************************************************/ -/* Router Object ID definition - Shared with BIOS */ -/****************************************************/ -#define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT) - -/* deleted */ - -/****************************************************/ -/* Generic Object ID definition - Shared with BIOS */ -/****************************************************/ -#define GENERICOBJECT_GLSYNC_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - GENERIC_OBJECT_ID_GLSYNC << OBJECT_ID_SHIFT) - -#define GENERICOBJECT_PX2_NON_DRIVABLE_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT) - -#define GENERICOBJECT_PX2_NON_DRIVABLE_ID2 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ - GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT) - -#define GENERICOBJECT_MXM_OPM_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ - GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ - GENERIC_OBJECT_ID_MXM_OPM << OBJECT_ID_SHIFT) - -/****************************************************/ -/* Object Cap definition - Shared with BIOS */ -/****************************************************/ -#define GRAPHICS_OBJECT_CAP_I2C 0x00000001L -#define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L - - -#define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01 -#define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02 -#define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03 - -#if defined(_X86_) -#pragma pack() -#endif - -#endif /*GRAPHICTYPE */ - - - - diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/atombios.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/atombios.h deleted file mode 100644 index be5f73a05c..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/atombios.h +++ /dev/null @@ -1,5141 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - - -/****************************************************************************/ -/*Portion I: Definitions shared between VBIOS and Driver */ -/****************************************************************************/ - - -#ifndef _ATOMBIOS_H -#define _ATOMBIOS_H - -#define ATOM_VERSION_MAJOR 0x00020000 -#define ATOM_VERSION_MINOR 0x00000002 - -#define ATOM_HEADER_VERSION (ATOM_VERSION_MAJOR | ATOM_VERSION_MINOR) - - -#ifdef _H2INC - #ifndef ULONG - typedef unsigned long ULONG; - #endif - - #ifndef UCHAR - typedef unsigned char UCHAR; - #endif - - #ifndef USHORT - typedef unsigned short USHORT; - #endif -#endif - -#define ATOM_DAC_A 0 -#define ATOM_DAC_B 1 -#define ATOM_EXT_DAC 2 - -#define ATOM_CRTC1 0 -#define ATOM_CRTC2 1 - -#define ATOM_DIGA 0 -#define ATOM_DIGB 1 - -#define ATOM_PPLL1 0 -#define ATOM_PPLL2 1 - -#define ATOM_SCALER1 0 -#define ATOM_SCALER2 1 - -#define ATOM_SCALER_DISABLE 0 -#define ATOM_SCALER_CENTER 1 -#define ATOM_SCALER_EXPANSION 2 -#define ATOM_SCALER_MULTI_EX 3 - -#define ATOM_DISABLE 0 -#define ATOM_ENABLE 1 -#define ATOM_LCD_BLOFF (ATOM_DISABLE+2) -#define ATOM_LCD_BLON (ATOM_ENABLE+2) -#define ATOM_LCD_BL_BRIGHTNESS_CONTROL (ATOM_ENABLE+3) -#define ATOM_LCD_SELFTEST_START (ATOM_DISABLE+5) -#define ATOM_LCD_SELFTEST_STOP (ATOM_ENABLE+5) -#define ATOM_ENCODER_INIT (ATOM_DISABLE+7) - -#define ATOM_BLANKING 1 -#define ATOM_BLANKING_OFF 0 - -#define ATOM_CURSOR1 0 -#define ATOM_CURSOR2 1 - -#define ATOM_ICON1 0 -#define ATOM_ICON2 1 - -#define ATOM_CRT1 0 -#define ATOM_CRT2 1 - -#define ATOM_TV_NTSC 1 -#define ATOM_TV_NTSCJ 2 -#define ATOM_TV_PAL 3 -#define ATOM_TV_PALM 4 -#define ATOM_TV_PALCN 5 -#define ATOM_TV_PALN 6 -#define ATOM_TV_PAL60 7 -#define ATOM_TV_SECAM 8 -#define ATOM_TV_CV 16 - -#define ATOM_DAC1_PS2 1 -#define ATOM_DAC1_CV 2 -#define ATOM_DAC1_NTSC 3 -#define ATOM_DAC1_PAL 4 - -#define ATOM_DAC2_PS2 ATOM_DAC1_PS2 -#define ATOM_DAC2_CV ATOM_DAC1_CV -#define ATOM_DAC2_NTSC ATOM_DAC1_NTSC -#define ATOM_DAC2_PAL ATOM_DAC1_PAL - -#define ATOM_PM_ON 0 -#define ATOM_PM_STANDBY 1 -#define ATOM_PM_SUSPEND 2 -#define ATOM_PM_OFF 3 - -/* Bit0:{=0:single, =1:dual}, - Bit1 {=0:666RGB, =1:888RGB}, - Bit2:3:{Grey level} - Bit4:{=0:LDI format for RGB888, =1 FPDI format for RGB888}*/ - -#define ATOM_PANEL_MISC_DUAL 0x00000001 -#define ATOM_PANEL_MISC_888RGB 0x00000002 -#define ATOM_PANEL_MISC_GREY_LEVEL 0x0000000C -#define ATOM_PANEL_MISC_FPDI 0x00000010 -#define ATOM_PANEL_MISC_GREY_LEVEL_SHIFT 2 -#define ATOM_PANEL_MISC_SPATIAL 0x00000020 -#define ATOM_PANEL_MISC_TEMPORAL 0x00000040 -#define ATOM_PANEL_MISC_API_ENABLED 0x00000080 - - -#define MEMTYPE_DDR1 "DDR1" -#define MEMTYPE_DDR2 "DDR2" -#define MEMTYPE_DDR3 "DDR3" -#define MEMTYPE_DDR4 "DDR4" - -#define ASIC_BUS_TYPE_PCI "PCI" -#define ASIC_BUS_TYPE_AGP "AGP" -#define ASIC_BUS_TYPE_PCIE "PCI_EXPRESS" - -/* Maximum size of that FireGL flag string */ - -#define ATOM_FIREGL_FLAG_STRING "FGL" //Flag used to enable FireGL Support -#define ATOM_MAX_SIZE_OF_FIREGL_FLAG_STRING 3 //sizeof( ATOM_FIREGL_FLAG_STRING ) - -#define ATOM_FAKE_DESKTOP_STRING "DSK" //Flag used to enable mobile ASIC on Desktop -#define ATOM_MAX_SIZE_OF_FAKE_DESKTOP_STRING ATOM_MAX_SIZE_OF_FIREGL_FLAG_STRING - -#define ATOM_M54T_FLAG_STRING "M54T" //Flag used to enable M54T Support -#define ATOM_MAX_SIZE_OF_M54T_FLAG_STRING 4 //sizeof( ATOM_M54T_FLAG_STRING ) - -#define HW_ASSISTED_I2C_STATUS_FAILURE 2 -#define HW_ASSISTED_I2C_STATUS_SUCCESS 1 - -#pragma pack(1) /* BIOS data must use byte aligment */ - -/* Define offset to location of ROM header. */ - -#define OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER 0x00000048L -#define OFFSET_TO_ATOM_ROM_IMAGE_SIZE 0x00000002L - -#define OFFSET_TO_ATOMBIOS_ASIC_BUS_MEM_TYPE 0x94 -#define MAXSIZE_OF_ATOMBIOS_ASIC_BUS_MEM_TYPE 20 /* including the terminator 0x0! */ -#define OFFSET_TO_GET_ATOMBIOS_STRINGS_NUMBER 0x002f -#define OFFSET_TO_GET_ATOMBIOS_STRINGS_START 0x006e - -/* Common header for all ROM Data tables. - Every table pointed _ATOM_MASTER_DATA_TABLE has this common header. - And the pointer actually points to this header. */ - -typedef struct _ATOM_COMMON_TABLE_HEADER -{ - USHORT usStructureSize; - UCHAR ucTableFormatRevision; /*Change it when the Parser is not backward compatible */ - UCHAR ucTableContentRevision; /*Change it only when the table needs to change but the firmware */ - /*Image can't be updated, while Driver needs to carry the new table! */ -}ATOM_COMMON_TABLE_HEADER; - -typedef struct _ATOM_ROM_HEADER -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR uaFirmWareSignature[4]; /*Signature to distinguish between Atombios and non-atombios, - atombios should init it as "ATOM", don't change the position */ - USHORT usBiosRuntimeSegmentAddress; - USHORT usProtectedModeInfoOffset; - USHORT usConfigFilenameOffset; - USHORT usCRC_BlockOffset; - USHORT usBIOS_BootupMessageOffset; - USHORT usInt10Offset; - USHORT usPciBusDevInitCode; - USHORT usIoBaseAddress; - USHORT usSubsystemVendorID; - USHORT usSubsystemID; - USHORT usPCI_InfoOffset; - USHORT usMasterCommandTableOffset; /*Offset for SW to get all command table offsets, Don't change the position */ - USHORT usMasterDataTableOffset; /*Offset for SW to get all data table offsets, Don't change the position */ - UCHAR ucExtendedFunctionCode; - UCHAR ucReserved; -}ATOM_ROM_HEADER; - -/*==============================Command Table Portion==================================== */ - -#ifdef UEFI_BUILD - #define UTEMP USHORT - #define USHORT void* -#endif - -/****************************************************************************/ -// Structures used in Command.mtb -/****************************************************************************/ -typedef struct _ATOM_MASTER_LIST_OF_COMMAND_TABLES{ - USHORT ASIC_Init; //Function Table, used by various SW components,latest version 1.1 - USHORT GetDisplaySurfaceSize; //Atomic Table, Used by Bios when enabling HW ICON - USHORT ASIC_RegistersInit; //Atomic Table, indirectly used by various SW components,called from ASIC_Init - USHORT VRAM_BlockVenderDetection; //Atomic Table, used only by Bios - USHORT DIGxEncoderControl; //Only used by Bios - USHORT MemoryControllerInit; //Atomic Table, indirectly used by various SW components,called from ASIC_Init - USHORT EnableCRTCMemReq; //Function Table,directly used by various SW components,latest version 2.1 - USHORT MemoryParamAdjust; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock if needed - USHORT DVOEncoderControl; //Function Table,directly used by various SW components,latest version 1.2 - USHORT GPIOPinControl; //Atomic Table, only used by Bios - USHORT SetEngineClock; //Function Table,directly used by various SW components,latest version 1.1 - USHORT SetMemoryClock; //Function Table,directly used by various SW components,latest version 1.1 - USHORT SetPixelClock; //Function Table,directly used by various SW components,latest version 1.2 - USHORT DynamicClockGating; //Atomic Table, indirectly used by various SW components,called from ASIC_Init - USHORT ResetMemoryDLL; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock - USHORT ResetMemoryDevice; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock - USHORT MemoryPLLInit; - USHORT AdjustDisplayPll; //only used by Bios - USHORT AdjustMemoryController; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock - USHORT EnableASIC_StaticPwrMgt; //Atomic Table, only used by Bios - USHORT ASIC_StaticPwrMgtStatusChange; //Obsolete , only used by Bios - USHORT DAC_LoadDetection; //Atomic Table, directly used by various SW components,latest version 1.2 - USHORT LVTMAEncoderControl; //Atomic Table,directly used by various SW components,latest version 1.3 - USHORT LCD1OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT DAC1EncoderControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT DAC2EncoderControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT DVOOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT CV1OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT GetConditionalGoldenSetting; //only used by Bios - USHORT TVEncoderControl; //Function Table,directly used by various SW components,latest version 1.1 - USHORT TMDSAEncoderControl; //Atomic Table, directly used by various SW components,latest version 1.3 - USHORT LVDSEncoderControl; //Atomic Table, directly used by various SW components,latest version 1.3 - USHORT TV1OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT EnableScaler; //Atomic Table, used only by Bios - USHORT BlankCRTC; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT EnableCRTC; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT GetPixelClock; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT EnableVGA_Render; //Function Table,directly used by various SW components,latest version 1.1 - USHORT EnableVGA_Access; //Obsolete , only used by Bios - USHORT SetCRTC_Timing; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT SetCRTC_OverScan; //Atomic Table, used by various SW components,latest version 1.1 - USHORT SetCRTC_Replication; //Atomic Table, used only by Bios - USHORT SelectCRTC_Source; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT EnableGraphSurfaces; //Atomic Table, used only by Bios - USHORT UpdateCRTC_DoubleBufferRegisters; - USHORT LUT_AutoFill; //Atomic Table, only used by Bios - USHORT EnableHW_IconCursor; //Atomic Table, only used by Bios - USHORT GetMemoryClock; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT GetEngineClock; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT SetCRTC_UsingDTDTiming; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT ExternalEncoderControl; //Atomic Table, directly used by various SW components,latest version 2.1 - USHORT LVTMAOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT VRAM_BlockDetectionByStrap; //Atomic Table, used only by Bios - USHORT MemoryCleanUp; //Atomic Table, only used by Bios - USHORT ProcessI2cChannelTransaction; //Function Table,only used by Bios - USHORT WriteOneByteToHWAssistedI2C; //Function Table,indirectly used by various SW components - USHORT ReadHWAssistedI2CStatus; //Atomic Table, indirectly used by various SW components - USHORT SpeedFanControl; //Function Table,indirectly used by various SW components,called from ASIC_Init - USHORT PowerConnectorDetection; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT MC_Synchronization; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock - USHORT ComputeMemoryEnginePLL; //Atomic Table, indirectly used by various SW components,called from SetMemory/EngineClock - USHORT MemoryRefreshConversion; //Atomic Table, indirectly used by various SW components,called from SetMemory or SetEngineClock - USHORT VRAM_GetCurrentInfoBlock; //Atomic Table, used only by Bios - USHORT DynamicMemorySettings; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock - USHORT MemoryTraining; //Atomic Table, used only by Bios - USHORT EnableSpreadSpectrumOnPPLL; //Atomic Table, directly used by various SW components,latest version 1.2 - USHORT TMDSAOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT SetVoltage; //Function Table,directly and/or indirectly used by various SW components,latest version 1.1 - USHORT DAC1OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT DAC2OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 - USHORT SetupHWAssistedI2CStatus; //Function Table,only used by Bios, obsolete soon.Switch to use "ReadEDIDFromHWAssistedI2C" - USHORT ClockSource; //Atomic Table, indirectly used by various SW components,called from ASIC_Init - USHORT MemoryDeviceInit; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock - USHORT EnableYUV; //Atomic Table, indirectly used by various SW components,called from EnableVGARender - USHORT DIG1EncoderControl; //Atomic Table,directly used by various SW components,latest version 1.1 - USHORT DIG2EncoderControl; //Atomic Table,directly used by various SW components,latest version 1.1 - USHORT DIG1TransmitterControl; //Atomic Table,directly used by various SW components,latest version 1.1 - USHORT DIG2TransmitterControl; //Atomic Table,directly used by various SW components,latest version 1.1 - USHORT ProcessAuxChannelTransaction; //Function Table,only used by Bios - USHORT DPEncoderService; //Function Table,only used by Bios -}ATOM_MASTER_LIST_OF_COMMAND_TABLES; - -// For backward compatible -#define ReadEDIDFromHWAssistedI2C ProcessI2cChannelTransaction -#define UNIPHYTransmitterControl DIG1TransmitterControl -#define LVTMATransmitterControl DIG2TransmitterControl -#define SetCRTC_DPM_State GetConditionalGoldenSetting -#define SetUniphyInstance ASIC_StaticPwrMgtStatusChange - -typedef struct _ATOM_MASTER_COMMAND_TABLE -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_MASTER_LIST_OF_COMMAND_TABLES ListOfCommandTables; -}ATOM_MASTER_COMMAND_TABLE; - -/****************************************************************************/ -// Structures used in every command table -/****************************************************************************/ -typedef struct _ATOM_TABLE_ATTRIBUTE -{ - USHORT WS_SizeInBytes:8; //[7:0]=Size of workspace in Bytes (in multiple of a dword), - USHORT PS_SizeInBytes:7; //[14:8]=Size of parameter space in Bytes (multiple of a dword), - USHORT UpdatedByUtility:1; //[15]=Table updated by utility flag -}ATOM_TABLE_ATTRIBUTE; - -/****************************************************************************/ -// Common header for all command tables. -// Every table pointed by _ATOM_MASTER_COMMAND_TABLE has this common header. -// And the pointer actually points to this header. -/****************************************************************************/ -typedef struct _ATOM_COMMON_ROM_COMMAND_TABLE_HEADER -{ - ATOM_COMMON_TABLE_HEADER CommonHeader; - ATOM_TABLE_ATTRIBUTE TableAttribute; -}ATOM_COMMON_ROM_COMMAND_TABLE_HEADER; - - -/****************************************************************************/ -// Structures used by ComputeMemoryEnginePLLTable -/****************************************************************************/ - -#define COMPUTE_MEMORY_PLL_PARAM 1 -#define COMPUTE_ENGINE_PLL_PARAM 2 - -typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS -{ - ULONG ulClock; //When returen, it's the re-calculated clock based on given Fb_div Post_Div and ref_div - UCHAR ucAction; //0:reserved //1:Memory //2:Engine - UCHAR ucReserved; //may expand to return larger Fbdiv later - UCHAR ucFbDiv; //return value - UCHAR ucPostDiv; //return value -}COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS; - -typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V2 -{ - ULONG ulClock; //When return, [23:0] return real clock - UCHAR ucAction; //0:reserved;COMPUTE_MEMORY_PLL_PARAM:Memory;COMPUTE_ENGINE_PLL_PARAM:Engine. it return ref_div to be written to register - USHORT usFbDiv; //return Feedback value to be written to register - UCHAR ucPostDiv; //return post div to be written to register -}COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V2; -#define COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS - - -#define SET_CLOCK_FREQ_MASK 0x00FFFFFF //Clock change tables only take bit [23:0] as the requested clock value -#define USE_NON_BUS_CLOCK_MASK 0x01000000 //Applicable to both memory and engine clock change, when set, it uses another clock as the temporary clock (engine uses memory and vice versa) -#define USE_MEMORY_SELF_REFRESH_MASK 0x02000000 //Only applicable to memory clock change, when set, using memory self refresh during clock transition -#define SKIP_INTERNAL_MEMORY_PARAMETER_CHANGE 0x04000000 //Only applicable to memory clock change, when set, the table will skip predefined internal memory parameter change -#define FIRST_TIME_CHANGE_CLOCK 0x08000000 //Applicable to both memory and engine clock change,when set, it means this is 1st time to change clock after ASIC bootup -#define SKIP_SW_PROGRAM_PLL 0x10000000 //Applicable to both memory and engine clock change, when set, it means the table will not program SPLL/MPLL -#define USE_SS_ENABLED_PIXEL_CLOCK USE_NON_BUS_CLOCK_MASK - -#define b3USE_NON_BUS_CLOCK_MASK 0x01 //Applicable to both memory and engine clock change, when set, it uses another clock as the temporary clock (engine uses memory and vice versa) -#define b3USE_MEMORY_SELF_REFRESH 0x02 //Only applicable to memory clock change, when set, using memory self refresh during clock transition -#define b3SKIP_INTERNAL_MEMORY_PARAMETER_CHANGE 0x04 //Only applicable to memory clock change, when set, the table will skip predefined internal memory parameter change -#define b3FIRST_TIME_CHANGE_CLOCK 0x08 //Applicable to both memory and engine clock change,when set, it means this is 1st time to change clock after ASIC bootup -#define b3SKIP_SW_PROGRAM_PLL 0x10 //Applicable to both memory and engine clock change, when set, it means the table will not program SPLL/MPLL - -typedef struct _ATOM_COMPUTE_CLOCK_FREQ -{ - ULONG ulClockFreq:24; // in unit of 10kHz - ULONG ulComputeClockFlag:8; // =1: COMPUTE_MEMORY_PLL_PARAM, =2: COMPUTE_ENGINE_PLL_PARAM -}ATOM_COMPUTE_CLOCK_FREQ; - -typedef struct _ATOM_S_MPLL_FB_DIVIDER -{ - USHORT usFbDivFrac; - USHORT usFbDiv; -}ATOM_S_MPLL_FB_DIVIDER; - -typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V3 -{ - union - { - ATOM_COMPUTE_CLOCK_FREQ ulClock; //Input Parameter - ATOM_S_MPLL_FB_DIVIDER ulFbDiv; //Output Parameter - }; - UCHAR ucRefDiv; //Output Parameter - UCHAR ucPostDiv; //Output Parameter - UCHAR ucCntlFlag; //Output Parameter - UCHAR ucReserved; -}COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V3; - -// ucCntlFlag -#define ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN 1 -#define ATOM_PLL_CNTL_FLAG_MPLL_VCO_MODE 2 -#define ATOM_PLL_CNTL_FLAG_FRACTION_DISABLE 4 - -typedef struct _DYNAMICE_MEMORY_SETTINGS_PARAMETER -{ - ATOM_COMPUTE_CLOCK_FREQ ulClock; - ULONG ulReserved[2]; -}DYNAMICE_MEMORY_SETTINGS_PARAMETER; - -typedef struct _DYNAMICE_ENGINE_SETTINGS_PARAMETER -{ - ATOM_COMPUTE_CLOCK_FREQ ulClock; - ULONG ulMemoryClock; - ULONG ulReserved; -}DYNAMICE_ENGINE_SETTINGS_PARAMETER; - -/****************************************************************************/ -// Structures used by SetEngineClockTable -/****************************************************************************/ -typedef struct _SET_ENGINE_CLOCK_PARAMETERS -{ - ULONG ulTargetEngineClock; //In 10Khz unit -}SET_ENGINE_CLOCK_PARAMETERS; - -typedef struct _SET_ENGINE_CLOCK_PS_ALLOCATION -{ - ULONG ulTargetEngineClock; //In 10Khz unit - COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION sReserved; -}SET_ENGINE_CLOCK_PS_ALLOCATION; - -/****************************************************************************/ -// Structures used by SetMemoryClockTable -/****************************************************************************/ -typedef struct _SET_MEMORY_CLOCK_PARAMETERS -{ - ULONG ulTargetMemoryClock; //In 10Khz unit -}SET_MEMORY_CLOCK_PARAMETERS; - -typedef struct _SET_MEMORY_CLOCK_PS_ALLOCATION -{ - ULONG ulTargetMemoryClock; //In 10Khz unit - COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION sReserved; -}SET_MEMORY_CLOCK_PS_ALLOCATION; - -/****************************************************************************/ -// Structures used by ASIC_Init.ctb -/****************************************************************************/ -typedef struct _ASIC_INIT_PARAMETERS -{ - ULONG ulDefaultEngineClock; //In 10Khz unit - ULONG ulDefaultMemoryClock; //In 10Khz unit -}ASIC_INIT_PARAMETERS; - -typedef struct _ASIC_INIT_PS_ALLOCATION -{ - ASIC_INIT_PARAMETERS sASICInitClocks; - SET_ENGINE_CLOCK_PS_ALLOCATION sReserved; //Caller doesn't need to init this structure -}ASIC_INIT_PS_ALLOCATION; - -/****************************************************************************/ -// Structure used by DynamicClockGatingTable.ctb -/****************************************************************************/ -typedef struct _DYNAMIC_CLOCK_GATING_PARAMETERS -{ - UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE - UCHAR ucPadding[3]; -}DYNAMIC_CLOCK_GATING_PARAMETERS; -#define DYNAMIC_CLOCK_GATING_PS_ALLOCATION DYNAMIC_CLOCK_GATING_PARAMETERS - -/****************************************************************************/ -// Structure used by EnableASIC_StaticPwrMgtTable.ctb -/****************************************************************************/ -typedef struct _ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS -{ - UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE - UCHAR ucPadding[3]; -}ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS; -#define ENABLE_ASIC_STATIC_PWR_MGT_PS_ALLOCATION ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS - -/****************************************************************************/ -// Structures used by DAC_LoadDetectionTable.ctb -/****************************************************************************/ -typedef struct _DAC_LOAD_DETECTION_PARAMETERS -{ - USHORT usDeviceID; //{ATOM_DEVICE_CRTx_SUPPORT,ATOM_DEVICE_TVx_SUPPORT,ATOM_DEVICE_CVx_SUPPORT} - UCHAR ucDacType; //{ATOM_DAC_A,ATOM_DAC_B, ATOM_EXT_DAC} - UCHAR ucMisc; //Valid only when table revision =1.3 and above -}DAC_LOAD_DETECTION_PARAMETERS; - -// DAC_LOAD_DETECTION_PARAMETERS.ucMisc -#define DAC_LOAD_MISC_YPrPb 0x01 - -typedef struct _DAC_LOAD_DETECTION_PS_ALLOCATION -{ - DAC_LOAD_DETECTION_PARAMETERS sDacload; - ULONG Reserved[2];// Don't set this one, allocation for EXT DAC -}DAC_LOAD_DETECTION_PS_ALLOCATION; - -/****************************************************************************/ -// Structures used by DAC1EncoderControlTable.ctb and DAC2EncoderControlTable.ctb -/****************************************************************************/ -typedef struct _DAC_ENCODER_CONTROL_PARAMETERS -{ - USHORT usPixelClock; // in 10KHz; for bios convenient - UCHAR ucDacStandard; // See definition of ATOM_DACx_xxx, For DEC3.0, bit 7 used as internal flag to indicate DAC2 (==1) or DAC1 (==0) - UCHAR ucAction; // 0: turn off encoder - // 1: setup and turn on encoder - // 7: ATOM_ENCODER_INIT Initialize DAC -}DAC_ENCODER_CONTROL_PARAMETERS; - -#define DAC_ENCODER_CONTROL_PS_ALLOCATION DAC_ENCODER_CONTROL_PARAMETERS - -/****************************************************************************/ -// Structures used by DIG1EncoderControlTable -// DIG2EncoderControlTable -// ExternalEncoderControlTable -/****************************************************************************/ -typedef struct _DIG_ENCODER_CONTROL_PARAMETERS -{ - USHORT usPixelClock; // in 10KHz; for bios convenient - UCHAR ucConfig; - // [2] Link Select: - // =0: PHY linkA if bfLane<3 - // =1: PHY linkB if bfLanes<3 - // =0: PHY linkA+B if bfLanes=3 - // [3] Transmitter Sel - // =0: UNIPHY or PCIEPHY - // =1: LVTMA - UCHAR ucAction; // =0: turn off encoder - // =1: turn on encoder - UCHAR ucEncoderMode; - // =0: DP encoder - // =1: LVDS encoder - // =2: DVI encoder - // =3: HDMI encoder - // =4: SDVO encoder - UCHAR ucLaneNum; // how many lanes to enable - UCHAR ucReserved[2]; -}DIG_ENCODER_CONTROL_PARAMETERS; -#define DIG_ENCODER_CONTROL_PS_ALLOCATION DIG_ENCODER_CONTROL_PARAMETERS -#define EXTERNAL_ENCODER_CONTROL_PARAMETER DIG_ENCODER_CONTROL_PARAMETERS - -//ucConfig -#define ATOM_ENCODER_CONFIG_DPLINKRATE_MASK 0x01 -#define ATOM_ENCODER_CONFIG_DPLINKRATE_1_62GHZ 0x00 -#define ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ 0x01 -#define ATOM_ENCODER_CONFIG_LINK_SEL_MASK 0x04 -#define ATOM_ENCODER_CONFIG_LINKA 0x00 -#define ATOM_ENCODER_CONFIG_LINKB 0x04 -#define ATOM_ENCODER_CONFIG_LINKA_B ATOM_TRANSMITTER_CONFIG_LINKA -#define ATOM_ENCODER_CONFIG_LINKB_A ATOM_ENCODER_CONFIG_LINKB -#define ATOM_ENCODER_CONFIG_TRANSMITTER_SEL_MASK 0x08 -#define ATOM_ENCODER_CONFIG_UNIPHY 0x00 -#define ATOM_ENCODER_CONFIG_LVTMA 0x08 -#define ATOM_ENCODER_CONFIG_TRANSMITTER1 0x00 -#define ATOM_ENCODER_CONFIG_TRANSMITTER2 0x08 -#define ATOM_ENCODER_CONFIG_DIGB 0x80 // VBIOS Internal use, outside SW should set this bit=0 -// ucAction -// ATOM_ENABLE: Enable Encoder -// ATOM_DISABLE: Disable Encoder - -//ucEncoderMode -#define ATOM_ENCODER_MODE_DP 0 -#define ATOM_ENCODER_MODE_LVDS 1 -#define ATOM_ENCODER_MODE_DVI 2 -#define ATOM_ENCODER_MODE_HDMI 3 -#define ATOM_ENCODER_MODE_SDVO 4 -#define ATOM_ENCODER_MODE_TV 13 -#define ATOM_ENCODER_MODE_CV 14 -#define ATOM_ENCODER_MODE_CRT 15 - -typedef struct _ATOM_DIG_ENCODER_CONFIG_V2 -{ - UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz - UCHAR ucReserved:1; - UCHAR ucLinkSel:1; // =0: linkA/C/E =1: linkB/D/F - UCHAR ucTransmitterSel:2; // =0: UniphyAB, =1: UniphyCD =2: UniphyEF - UCHAR ucReserved1:2; -}ATOM_DIG_ENCODER_CONFIG_V2; - - -typedef struct _DIG_ENCODER_CONTROL_PARAMETERS_V2 -{ - USHORT usPixelClock; // in 10KHz; for bios convenient - ATOM_DIG_ENCODER_CONFIG_V2 acConfig; - UCHAR ucAction; - UCHAR ucEncoderMode; - // =0: DP encoder - // =1: LVDS encoder - // =2: DVI encoder - // =3: HDMI encoder - // =4: SDVO encoder - UCHAR ucLaneNum; // how many lanes to enable - UCHAR ucReserved[2]; -}DIG_ENCODER_CONTROL_PARAMETERS_V2; - -//ucConfig -#define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_MASK 0x01 -#define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_1_62GHZ 0x00 -#define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_2_70GHZ 0x01 -#define ATOM_ENCODER_CONFIG_V2_LINK_SEL_MASK 0x04 -#define ATOM_ENCODER_CONFIG_V2_LINKA 0x00 -#define ATOM_ENCODER_CONFIG_V2_LINKB 0x04 -#define ATOM_ENCODER_CONFIG_V2_TRANSMITTER_SEL_MASK 0x18 -#define ATOM_ENCODER_CONFIG_V2_TRANSMITTER1 0x00 -#define ATOM_ENCODER_CONFIG_V2_TRANSMITTER2 0x08 -#define ATOM_ENCODER_CONFIG_V2_TRANSMITTER3 0x10 - -/****************************************************************************/ -// Structures used by UNIPHYTransmitterControlTable -// LVTMATransmitterControlTable -// DVOOutputControlTable -/****************************************************************************/ -typedef struct _ATOM_DP_VS_MODE -{ - UCHAR ucLaneSel; - UCHAR ucLaneSet; -}ATOM_DP_VS_MODE; - -typedef struct _DIG_TRANSMITTER_CONTROL_PARAMETERS -{ - union - { - USHORT usPixelClock; // in 10KHz; for bios convenient - USHORT usInitInfo; // when init uniphy,lower 8bit is used for connector type defined in objectid.h - ATOM_DP_VS_MODE asMode; // DP Voltage swing mode - }; - UCHAR ucConfig; - // [0]=0: 4 lane Link, - // =1: 8 lane Link ( Dual Links TMDS ) - // [1]=0: InCoherent mode - // =1: Coherent Mode - // [2] Link Select: - // =0: PHY linkA if bfLane<3 - // =1: PHY linkB if bfLanes<3 - // =0: PHY linkA+B if bfLanes=3 - // [5:4]PCIE lane Sel - // =0: lane 0~3 or 0~7 - // =1: lane 4~7 - // =2: lane 8~11 or 8~15 - // =3: lane 12~15 - UCHAR ucAction; // =0: turn off encoder - // =1: turn on encoder - UCHAR ucReserved[4]; -}DIG_TRANSMITTER_CONTROL_PARAMETERS; - -#define DIG_TRANSMITTER_CONTROL_PS_ALLOCATION DIG_TRANSMITTER_CONTROL_PARAMETERS - -//ucInitInfo -#define ATOM_TRAMITTER_INITINFO_CONNECTOR_MASK 0x00ff - -//ucConfig -#define ATOM_TRANSMITTER_CONFIG_8LANE_LINK 0x01 -#define ATOM_TRANSMITTER_CONFIG_COHERENT 0x02 -#define ATOM_TRANSMITTER_CONFIG_LINK_SEL_MASK 0x04 -#define ATOM_TRANSMITTER_CONFIG_LINKA 0x00 -#define ATOM_TRANSMITTER_CONFIG_LINKB 0x04 -#define ATOM_TRANSMITTER_CONFIG_LINKA_B 0x00 -#define ATOM_TRANSMITTER_CONFIG_LINKB_A 0x04 - -#define ATOM_TRANSMITTER_CONFIG_ENCODER_SEL_MASK 0x08 // only used when ATOM_TRANSMITTER_ACTION_ENABLE -#define ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER 0x00 // only used when ATOM_TRANSMITTER_ACTION_ENABLE -#define ATOM_TRANSMITTER_CONFIG_DIG2_ENCODER 0x08 // only used when ATOM_TRANSMITTER_ACTION_ENABLE - -#define ATOM_TRANSMITTER_CONFIG_CLKSRC_MASK 0x30 -#define ATOM_TRANSMITTER_CONFIG_CLKSRC_PPLL 0x00 -#define ATOM_TRANSMITTER_CONFIG_CLKSRC_PCIE 0x20 -#define ATOM_TRANSMITTER_CONFIG_CLKSRC_XTALIN 0x30 -#define ATOM_TRANSMITTER_CONFIG_LANE_SEL_MASK 0xc0 -#define ATOM_TRANSMITTER_CONFIG_LANE_0_3 0x00 -#define ATOM_TRANSMITTER_CONFIG_LANE_0_7 0x00 -#define ATOM_TRANSMITTER_CONFIG_LANE_4_7 0x40 -#define ATOM_TRANSMITTER_CONFIG_LANE_8_11 0x80 -#define ATOM_TRANSMITTER_CONFIG_LANE_8_15 0x80 -#define ATOM_TRANSMITTER_CONFIG_LANE_12_15 0xc0 - -//ucAction -#define ATOM_TRANSMITTER_ACTION_DISABLE 0 -#define ATOM_TRANSMITTER_ACTION_ENABLE 1 -#define ATOM_TRANSMITTER_ACTION_LCD_BLOFF 2 -#define ATOM_TRANSMITTER_ACTION_LCD_BLON 3 -#define ATOM_TRANSMITTER_ACTION_BL_BRIGHTNESS_CONTROL 4 -#define ATOM_TRANSMITTER_ACTION_LCD_SELFTEST_START 5 -#define ATOM_TRANSMITTER_ACTION_LCD_SELFTEST_STOP 6 -#define ATOM_TRANSMITTER_ACTION_INIT 7 -#define ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT 8 -#define ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT 9 -#define ATOM_TRANSMITTER_ACTION_SETUP 10 -#define ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH 11 - - -// Following are used for DigTransmitterControlTable ver1.2 -typedef struct _ATOM_DIG_TRANSMITTER_CONFIG_V2 -{ - UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector - UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode ) - UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E - // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F - UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA( DIG inst0 ). =1: Data/clk path source from DIGB ( DIG inst1 ) - UCHAR fDPConnector:1; //bit4=0: DP connector =1: None DP connector - UCHAR ucReserved:1; - UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB ) - // =1 Dig Transmitter 2 ( Uniphy CD ) - // =2 Dig Transmitter 3 ( Uniphy EF ) -}ATOM_DIG_TRANSMITTER_CONFIG_V2; - -//ucConfig -//Bit0 -#define ATOM_TRANSMITTER_CONFIG_V2_DUAL_LINK_CONNECTOR 0x01 - -//Bit1 -#define ATOM_TRANSMITTER_CONFIG_V2_COHERENT 0x02 - -//Bit2 -#define ATOM_TRANSMITTER_CONFIG_V2_LINK_SEL_MASK 0x04 -#define ATOM_TRANSMITTER_CONFIG_V2_LINKA 0x00 -#define ATOM_TRANSMITTER_CONFIG_V2_LINKB 0x04 - -// Bit3 -#define ATOM_TRANSMITTER_CONFIG_V2_ENCODER_SEL_MASK 0x08 -#define ATOM_TRANSMITTER_CONFIG_V2_DIG1_ENCODER 0x00 // only used when ucAction == ATOM_TRANSMITTER_ACTION_ENABLE or ATOM_TRANSMITTER_ACTION_SETUP -#define ATOM_TRANSMITTER_CONFIG_V2_DIG2_ENCODER 0x08 // only used when ucAction == ATOM_TRANSMITTER_ACTION_ENABLE or ATOM_TRANSMITTER_ACTION_SETUP - -// Bit4 -#define ATOM_TRASMITTER_CONFIG_V2_DP_CONNECTOR 0x10 - -// Bit7:6 -#define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER_SEL_MASK 0xC0 -#define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER1 0x00 //AB -#define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER2 0x40 //CD -#define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER3 0x80 //EF - -typedef struct _DIG_TRANSMITTER_CONTROL_PARAMETERS_V2 -{ - union - { - USHORT usPixelClock; // in 10KHz; for bios convenient - USHORT usInitInfo; // when init uniphy,lower 8bit is used for connector type defined in objectid.h - ATOM_DP_VS_MODE asMode; // DP Voltage swing mode - }; - ATOM_DIG_TRANSMITTER_CONFIG_V2 acConfig; - UCHAR ucAction; // define as ATOM_TRANSMITER_ACTION_XXX - UCHAR ucReserved[4]; -}DIG_TRANSMITTER_CONTROL_PARAMETERS_V2; - - -/****************************************************************************/ -// Structures used by DAC1OuputControlTable -// DAC2OuputControlTable -// LVTMAOutputControlTable (Before DEC30) -// TMDSAOutputControlTable (Before DEC30) -/****************************************************************************/ -typedef struct _DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -{ - UCHAR ucAction; // Possible input:ATOM_ENABLE||ATOMDISABLE - // When the display is LCD, in addition to above: - // ATOM_LCD_BLOFF|| ATOM_LCD_BLON ||ATOM_LCD_BL_BRIGHTNESS_CONTROL||ATOM_LCD_SELFTEST_START|| - // ATOM_LCD_SELFTEST_STOP - - UCHAR aucPadding[3]; // padding to DWORD aligned -}DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS; - -#define DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS - - -#define CRT1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -#define CRT1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION - -#define CRT2_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -#define CRT2_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION - -#define CV1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -#define CV1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION - -#define TV1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -#define TV1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION - -#define DFP1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -#define DFP1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION - -#define DFP2_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -#define DFP2_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION - -#define LCD1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -#define LCD1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION - -#define DVO_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS -#define DVO_OUTPUT_CONTROL_PS_ALLOCATION DIG_TRANSMITTER_CONTROL_PS_ALLOCATION -#define DVO_OUTPUT_CONTROL_PARAMETERS_V3 DIG_TRANSMITTER_CONTROL_PARAMETERS - -/****************************************************************************/ -// Structures used by BlankCRTCTable -/****************************************************************************/ -typedef struct _BLANK_CRTC_PARAMETERS -{ - UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 - UCHAR ucBlanking; // ATOM_BLANKING or ATOM_BLANKINGOFF - USHORT usBlackColorRCr; - USHORT usBlackColorGY; - USHORT usBlackColorBCb; -}BLANK_CRTC_PARAMETERS; -#define BLANK_CRTC_PS_ALLOCATION BLANK_CRTC_PARAMETERS - -/****************************************************************************/ -// Structures used by EnableCRTCTable -// EnableCRTCMemReqTable -// UpdateCRTC_DoubleBufferRegistersTable -/****************************************************************************/ -typedef struct _ENABLE_CRTC_PARAMETERS -{ - UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 - UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE - UCHAR ucPadding[2]; -}ENABLE_CRTC_PARAMETERS; -#define ENABLE_CRTC_PS_ALLOCATION ENABLE_CRTC_PARAMETERS - -/****************************************************************************/ -// Structures used by SetCRTC_OverScanTable -/****************************************************************************/ -typedef struct _SET_CRTC_OVERSCAN_PARAMETERS -{ - USHORT usOverscanRight; // right - USHORT usOverscanLeft; // left - USHORT usOverscanBottom; // bottom - USHORT usOverscanTop; // top - UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 - UCHAR ucPadding[3]; -}SET_CRTC_OVERSCAN_PARAMETERS; -#define SET_CRTC_OVERSCAN_PS_ALLOCATION SET_CRTC_OVERSCAN_PARAMETERS - -/****************************************************************************/ -// Structures used by SetCRTC_ReplicationTable -/****************************************************************************/ -typedef struct _SET_CRTC_REPLICATION_PARAMETERS -{ - UCHAR ucH_Replication; // horizontal replication - UCHAR ucV_Replication; // vertical replication - UCHAR usCRTC; // ATOM_CRTC1 or ATOM_CRTC2 - UCHAR ucPadding; -}SET_CRTC_REPLICATION_PARAMETERS; -#define SET_CRTC_REPLICATION_PS_ALLOCATION SET_CRTC_REPLICATION_PARAMETERS - -/****************************************************************************/ -// Structures used by SelectCRTC_SourceTable -/****************************************************************************/ -typedef struct _SELECT_CRTC_SOURCE_PARAMETERS -{ - UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 - UCHAR ucDevice; // ATOM_DEVICE_CRT1|ATOM_DEVICE_CRT2|.... - UCHAR ucPadding[2]; -}SELECT_CRTC_SOURCE_PARAMETERS; -#define SELECT_CRTC_SOURCE_PS_ALLOCATION SELECT_CRTC_SOURCE_PARAMETERS - -typedef struct _SELECT_CRTC_SOURCE_PARAMETERS_V2 -{ - UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 - UCHAR ucEncoderID; // DAC1/DAC2/TVOUT/DIG1/DIG2/DVO - UCHAR ucEncodeMode; // Encoding mode, only valid when using DIG1/DIG2/DVO - UCHAR ucPadding; -}SELECT_CRTC_SOURCE_PARAMETERS_V2; - -//ucEncoderID -//#define ASIC_INT_DAC1_ENCODER_ID 0x00 -//#define ASIC_INT_TV_ENCODER_ID 0x02 -//#define ASIC_INT_DIG1_ENCODER_ID 0x03 -//#define ASIC_INT_DAC2_ENCODER_ID 0x04 -//#define ASIC_EXT_TV_ENCODER_ID 0x06 -//#define ASIC_INT_DVO_ENCODER_ID 0x07 -//#define ASIC_INT_DIG2_ENCODER_ID 0x09 -//#define ASIC_EXT_DIG_ENCODER_ID 0x05 - -//ucEncodeMode -//#define ATOM_ENCODER_MODE_DP 0 -//#define ATOM_ENCODER_MODE_LVDS 1 -//#define ATOM_ENCODER_MODE_DVI 2 -//#define ATOM_ENCODER_MODE_HDMI 3 -//#define ATOM_ENCODER_MODE_SDVO 4 -//#define ATOM_ENCODER_MODE_TV 13 -//#define ATOM_ENCODER_MODE_CV 14 -//#define ATOM_ENCODER_MODE_CRT 15 - -/****************************************************************************/ -// Structures used by SetPixelClockTable -// GetPixelClockTable -/****************************************************************************/ -//Major revision=1., Minor revision=1 -typedef struct _PIXEL_CLOCK_PARAMETERS -{ - USHORT usPixelClock; // in 10kHz unit; for bios convenient = (RefClk*FB_Div)/(Ref_Div*Post_Div) - // 0 means disable PPLL - USHORT usRefDiv; // Reference divider - USHORT usFbDiv; // feedback divider - UCHAR ucPostDiv; // post divider - UCHAR ucFracFbDiv; // fractional feedback divider - UCHAR ucPpll; // ATOM_PPLL1 or ATOM_PPL2 - UCHAR ucRefDivSrc; // ATOM_PJITTER or ATO_NONPJITTER - UCHAR ucCRTC; // Which CRTC uses this Ppll - UCHAR ucPadding; -}PIXEL_CLOCK_PARAMETERS; - -//Major revision=1., Minor revision=2, add ucMiscIfno -//ucMiscInfo: -#define MISC_FORCE_REPROG_PIXEL_CLOCK 0x1 -#define MISC_DEVICE_INDEX_MASK 0xF0 -#define MISC_DEVICE_INDEX_SHIFT 4 - -typedef struct _PIXEL_CLOCK_PARAMETERS_V2 -{ - USHORT usPixelClock; // in 10kHz unit; for bios convenient = (RefClk*FB_Div)/(Ref_Div*Post_Div) - // 0 means disable PPLL - USHORT usRefDiv; // Reference divider - USHORT usFbDiv; // feedback divider - UCHAR ucPostDiv; // post divider - UCHAR ucFracFbDiv; // fractional feedback divider - UCHAR ucPpll; // ATOM_PPLL1 or ATOM_PPL2 - UCHAR ucRefDivSrc; // ATOM_PJITTER or ATO_NONPJITTER - UCHAR ucCRTC; // Which CRTC uses this Ppll - UCHAR ucMiscInfo; // Different bits for different purpose, bit [7:4] as device index, bit[0]=Force prog -}PIXEL_CLOCK_PARAMETERS_V2; - -//Major revision=1., Minor revision=3, structure/definition change -//ucEncoderMode: -//ATOM_ENCODER_MODE_DP -//ATOM_ENOCDER_MODE_LVDS -//ATOM_ENOCDER_MODE_DVI -//ATOM_ENOCDER_MODE_HDMI -//ATOM_ENOCDER_MODE_SDVO -//ATOM_ENCODER_MODE_TV 13 -//ATOM_ENCODER_MODE_CV 14 -//ATOM_ENCODER_MODE_CRT 15 - -//ucDVOConfig -//#define DVO_ENCODER_CONFIG_RATE_SEL 0x01 -//#define DVO_ENCODER_CONFIG_DDR_SPEED 0x00 -//#define DVO_ENCODER_CONFIG_SDR_SPEED 0x01 -//#define DVO_ENCODER_CONFIG_OUTPUT_SEL 0x0c -//#define DVO_ENCODER_CONFIG_LOW12BIT 0x00 -//#define DVO_ENCODER_CONFIG_UPPER12BIT 0x04 -//#define DVO_ENCODER_CONFIG_24BIT 0x08 - -//ucMiscInfo: also changed, see below -#define PIXEL_CLOCK_MISC_FORCE_PROG_PPLL 0x01 -#define PIXEL_CLOCK_MISC_VGA_MODE 0x02 -#define PIXEL_CLOCK_MISC_CRTC_SEL_MASK 0x04 -#define PIXEL_CLOCK_MISC_CRTC_SEL_CRTC1 0x00 -#define PIXEL_CLOCK_MISC_CRTC_SEL_CRTC2 0x04 -#define PIXEL_CLOCK_MISC_USE_ENGINE_FOR_DISPCLK 0x08 - -typedef struct _PIXEL_CLOCK_PARAMETERS_V3 -{ - USHORT usPixelClock; // in 10kHz unit; for bios convenient = (RefClk*FB_Div)/(Ref_Div*Post_Div) - // 0 means disable PPLL. For VGA PPLL,make sure this value is not 0. - USHORT usRefDiv; // Reference divider - USHORT usFbDiv; // feedback divider - UCHAR ucPostDiv; // post divider - UCHAR ucFracFbDiv; // fractional feedback divider - UCHAR ucPpll; // ATOM_PPLL1 or ATOM_PPL2 - UCHAR ucTransmitterId; // graphic encoder id defined in objectId.h - union - { - UCHAR ucEncoderMode; // encoder type defined as ATOM_ENCODER_MODE_DP/DVI/HDMI/ - UCHAR ucDVOConfig; // when use DVO, need to know SDR/DDR, 12bit or 24bit - }; - UCHAR ucMiscInfo; // bit[0]=Force program, bit[1]= set pclk for VGA, b[2]= CRTC sel - // bit[3]=0:use PPLL for dispclk source, =1: use engine clock for dispclock source -}PIXEL_CLOCK_PARAMETERS_V3; - -#define PIXEL_CLOCK_PARAMETERS_LAST PIXEL_CLOCK_PARAMETERS_V2 -#define GET_PIXEL_CLOCK_PS_ALLOCATION PIXEL_CLOCK_PARAMETERS_LAST - -/****************************************************************************/ -// Structures used by AdjustDisplayPllTable -/****************************************************************************/ -typedef struct _ADJUST_DISPLAY_PLL_PARAMETERS -{ - USHORT usPixelClock; - UCHAR ucTransmitterID; - UCHAR ucEncodeMode; - union - { - UCHAR ucDVOConfig; //if DVO, need passing link rate and output 12bitlow or 24bit - UCHAR ucConfig; //if none DVO, not defined yet - }; - UCHAR ucReserved[3]; -}ADJUST_DISPLAY_PLL_PARAMETERS; - -#define ADJUST_DISPLAY_CONFIG_SS_ENABLE 0x10 - -#define ADJUST_DISPLAY_PLL_PS_ALLOCATION ADJUST_DISPLAY_PLL_PARAMETERS - -/****************************************************************************/ -// Structures used by EnableYUVTable -/****************************************************************************/ -typedef struct _ENABLE_YUV_PARAMETERS -{ - UCHAR ucEnable; // ATOM_ENABLE:Enable YUV or ATOM_DISABLE:Disable YUV (RGB) - UCHAR ucCRTC; // Which CRTC needs this YUV or RGB format - UCHAR ucPadding[2]; -}ENABLE_YUV_PARAMETERS; -#define ENABLE_YUV_PS_ALLOCATION ENABLE_YUV_PARAMETERS - -/****************************************************************************/ -// Structures used by GetMemoryClockTable -/****************************************************************************/ -typedef struct _GET_MEMORY_CLOCK_PARAMETERS -{ - ULONG ulReturnMemoryClock; // current memory speed in 10KHz unit -} GET_MEMORY_CLOCK_PARAMETERS; -#define GET_MEMORY_CLOCK_PS_ALLOCATION GET_MEMORY_CLOCK_PARAMETERS - -/****************************************************************************/ -// Structures used by GetEngineClockTable -/****************************************************************************/ -typedef struct _GET_ENGINE_CLOCK_PARAMETERS -{ - ULONG ulReturnEngineClock; // current engine speed in 10KHz unit -} GET_ENGINE_CLOCK_PARAMETERS; -#define GET_ENGINE_CLOCK_PS_ALLOCATION GET_ENGINE_CLOCK_PARAMETERS - -/****************************************************************************/ -// Following Structures and constant may be obsolete -/****************************************************************************/ -//Maxium 8 bytes,the data read in will be placed in the parameter space. -//Read operaion successeful when the paramter space is non-zero, otherwise read operation failed -typedef struct _READ_EDID_FROM_HW_I2C_DATA_PARAMETERS -{ - USHORT usPrescale; //Ratio between Engine clock and I2C clock - USHORT usVRAMAddress; //Adress in Frame Buffer where to pace raw EDID - USHORT usStatus; //When use output: lower byte EDID checksum, high byte hardware status - //WHen use input: lower byte as 'byte to read':currently limited to 128byte or 1byte - UCHAR ucSlaveAddr; //Read from which slave - UCHAR ucLineNumber; //Read from which HW assisted line -}READ_EDID_FROM_HW_I2C_DATA_PARAMETERS; -#define READ_EDID_FROM_HW_I2C_DATA_PS_ALLOCATION READ_EDID_FROM_HW_I2C_DATA_PARAMETERS - - -#define ATOM_WRITE_I2C_FORMAT_PSOFFSET_PSDATABYTE 0 -#define ATOM_WRITE_I2C_FORMAT_PSOFFSET_PSTWODATABYTES 1 -#define ATOM_WRITE_I2C_FORMAT_PSCOUNTER_PSOFFSET_IDDATABLOCK 2 -#define ATOM_WRITE_I2C_FORMAT_PSCOUNTER_IDOFFSET_PLUS_IDDATABLOCK 3 -#define ATOM_WRITE_I2C_FORMAT_IDCOUNTER_IDOFFSET_IDDATABLOCK 4 - -typedef struct _WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS -{ - USHORT usPrescale; //Ratio between Engine clock and I2C clock - USHORT usByteOffset; //Write to which byte - //Upper portion of usByteOffset is Format of data - //1bytePS+offsetPS - //2bytesPS+offsetPS - //blockID+offsetPS - //blockID+offsetID - //blockID+counterID+offsetID - UCHAR ucData; //PS data1 - UCHAR ucStatus; //Status byte 1=success, 2=failure, Also is used as PS data2 - UCHAR ucSlaveAddr; //Write to which slave - UCHAR ucLineNumber; //Write from which HW assisted line -}WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS; - -#define WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS - -typedef struct _SET_UP_HW_I2C_DATA_PARAMETERS -{ - USHORT usPrescale; //Ratio between Engine clock and I2C clock - UCHAR ucSlaveAddr; //Write to which slave - UCHAR ucLineNumber; //Write from which HW assisted line -}SET_UP_HW_I2C_DATA_PARAMETERS; - - -/**************************************************************************/ -#define SPEED_FAN_CONTROL_PS_ALLOCATION WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS - -/****************************************************************************/ -// Structures used by PowerConnectorDetectionTable -/****************************************************************************/ -typedef struct _POWER_CONNECTOR_DETECTION_PARAMETERS -{ - UCHAR ucPowerConnectorStatus; //Used for return value 0: detected, 1:not detected - UCHAR ucPwrBehaviorId; - USHORT usPwrBudget; //how much power currently boot to in unit of watt -}POWER_CONNECTOR_DETECTION_PARAMETERS; - -typedef struct POWER_CONNECTOR_DETECTION_PS_ALLOCATION -{ - UCHAR ucPowerConnectorStatus; //Used for return value 0: detected, 1:not detected - UCHAR ucReserved; - USHORT usPwrBudget; //how much power currently boot to in unit of watt - WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; -}POWER_CONNECTOR_DETECTION_PS_ALLOCATION; - -/****************************LVDS SS Command Table Definitions**********************/ - -/****************************************************************************/ -// Structures used by EnableSpreadSpectrumOnPPLLTable -/****************************************************************************/ -typedef struct _ENABLE_LVDS_SS_PARAMETERS -{ - USHORT usSpreadSpectrumPercentage; - UCHAR ucSpreadSpectrumType; //Bit1=0 Down Spread,=1 Center Spread. Bit1=1 Ext. =0 Int. Others:TBD - UCHAR ucSpreadSpectrumStepSize_Delay; //bits3:2 SS_STEP_SIZE; bit 6:4 SS_DELAY - UCHAR ucEnable; //ATOM_ENABLE or ATOM_DISABLE - UCHAR ucPadding[3]; -}ENABLE_LVDS_SS_PARAMETERS; - -//ucTableFormatRevision=1,ucTableContentRevision=2 -typedef struct _ENABLE_LVDS_SS_PARAMETERS_V2 -{ - USHORT usSpreadSpectrumPercentage; - UCHAR ucSpreadSpectrumType; //Bit1=0 Down Spread,=1 Center Spread. Bit1=1 Ext. =0 Int. Others:TBD - UCHAR ucSpreadSpectrumStep; // - UCHAR ucEnable; //ATOM_ENABLE or ATOM_DISABLE - UCHAR ucSpreadSpectrumDelay; - UCHAR ucSpreadSpectrumRange; - UCHAR ucPadding; -}ENABLE_LVDS_SS_PARAMETERS_V2; - -//This new structure is based on ENABLE_LVDS_SS_PARAMETERS but expands to SS on PPLL, so other devices can use SS. -typedef struct _ENABLE_SPREAD_SPECTRUM_ON_PPLL -{ - USHORT usSpreadSpectrumPercentage; - UCHAR ucSpreadSpectrumType; // Bit1=0 Down Spread,=1 Center Spread. Bit1=1 Ext. =0 Int. Others:TBD - UCHAR ucSpreadSpectrumStep; // - UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE - UCHAR ucSpreadSpectrumDelay; - UCHAR ucSpreadSpectrumRange; - UCHAR ucPpll; // ATOM_PPLL1/ATOM_PPLL2 -}ENABLE_SPREAD_SPECTRUM_ON_PPLL; - -#define ENABLE_SPREAD_SPECTRUM_ON_PPLL_PS_ALLOCATION ENABLE_SPREAD_SPECTRUM_ON_PPLL - -/**************************************************************************/ - -typedef struct _SET_PIXEL_CLOCK_PS_ALLOCATION -{ - PIXEL_CLOCK_PARAMETERS sPCLKInput; - ENABLE_SPREAD_SPECTRUM_ON_PPLL sReserved;//Caller doesn't need to init this portion -}SET_PIXEL_CLOCK_PS_ALLOCATION; - -#define ENABLE_VGA_RENDER_PS_ALLOCATION SET_PIXEL_CLOCK_PS_ALLOCATION - -/****************************************************************************/ -// Structures used by ### -/****************************************************************************/ -typedef struct _MEMORY_TRAINING_PARAMETERS -{ - ULONG ulTargetMemoryClock; //In 10Khz unit -}MEMORY_TRAINING_PARAMETERS; -#define MEMORY_TRAINING_PS_ALLOCATION MEMORY_TRAINING_PARAMETERS - - -/****************************LVDS and other encoder command table definitions **********************/ - - -/****************************************************************************/ -// Structures used by LVDSEncoderControlTable (Before DCE30) -// LVTMAEncoderControlTable (Before DCE30) -// TMDSAEncoderControlTable (Before DCE30) -/****************************************************************************/ -typedef struct _LVDS_ENCODER_CONTROL_PARAMETERS -{ - USHORT usPixelClock; // in 10KHz; for bios convenient - UCHAR ucMisc; // bit0=0: Enable single link - // =1: Enable dual link - // Bit1=0: 666RGB - // =1: 888RGB - UCHAR ucAction; // 0: turn off encoder - // 1: setup and turn on encoder -}LVDS_ENCODER_CONTROL_PARAMETERS; - -#define LVDS_ENCODER_CONTROL_PS_ALLOCATION LVDS_ENCODER_CONTROL_PARAMETERS - -#define TMDS1_ENCODER_CONTROL_PARAMETERS LVDS_ENCODER_CONTROL_PARAMETERS -#define TMDS1_ENCODER_CONTROL_PS_ALLOCATION TMDS1_ENCODER_CONTROL_PARAMETERS - -#define TMDS2_ENCODER_CONTROL_PARAMETERS TMDS1_ENCODER_CONTROL_PARAMETERS -#define TMDS2_ENCODER_CONTROL_PS_ALLOCATION TMDS2_ENCODER_CONTROL_PARAMETERS - - -//ucTableFormatRevision=1,ucTableContentRevision=2 -typedef struct _LVDS_ENCODER_CONTROL_PARAMETERS_V2 -{ - USHORT usPixelClock; // in 10KHz; for bios convenient - UCHAR ucMisc; // see PANEL_ENCODER_MISC_xx defintions below - UCHAR ucAction; // 0: turn off encoder - // 1: setup and turn on encoder - UCHAR ucTruncate; // bit0=0: Disable truncate - // =1: Enable truncate - // bit4=0: 666RGB - // =1: 888RGB - UCHAR ucSpatial; // bit0=0: Disable spatial dithering - // =1: Enable spatial dithering - // bit4=0: 666RGB - // =1: 888RGB - UCHAR ucTemporal; // bit0=0: Disable temporal dithering - // =1: Enable temporal dithering - // bit4=0: 666RGB - // =1: 888RGB - // bit5=0: Gray level 2 - // =1: Gray level 4 - UCHAR ucFRC; // bit4=0: 25FRC_SEL pattern E - // =1: 25FRC_SEL pattern F - // bit6:5=0: 50FRC_SEL pattern A - // =1: 50FRC_SEL pattern B - // =2: 50FRC_SEL pattern C - // =3: 50FRC_SEL pattern D - // bit7=0: 75FRC_SEL pattern E - // =1: 75FRC_SEL pattern F -}LVDS_ENCODER_CONTROL_PARAMETERS_V2; - -#define LVDS_ENCODER_CONTROL_PS_ALLOCATION_V2 LVDS_ENCODER_CONTROL_PARAMETERS_V2 - -#define TMDS1_ENCODER_CONTROL_PARAMETERS_V2 LVDS_ENCODER_CONTROL_PARAMETERS_V2 -#define TMDS1_ENCODER_CONTROL_PS_ALLOCATION_V2 TMDS1_ENCODER_CONTROL_PARAMETERS_V2 - -#define TMDS2_ENCODER_CONTROL_PARAMETERS_V2 TMDS1_ENCODER_CONTROL_PARAMETERS_V2 -#define TMDS2_ENCODER_CONTROL_PS_ALLOCATION_V2 TMDS2_ENCODER_CONTROL_PARAMETERS_V2 - -#define LVDS_ENCODER_CONTROL_PARAMETERS_V3 LVDS_ENCODER_CONTROL_PARAMETERS_V2 -#define LVDS_ENCODER_CONTROL_PS_ALLOCATION_V3 LVDS_ENCODER_CONTROL_PARAMETERS_V3 - -#define TMDS1_ENCODER_CONTROL_PARAMETERS_V3 LVDS_ENCODER_CONTROL_PARAMETERS_V3 -#define TMDS1_ENCODER_CONTROL_PS_ALLOCATION_V3 TMDS1_ENCODER_CONTROL_PARAMETERS_V3 - -#define TMDS2_ENCODER_CONTROL_PARAMETERS_V3 LVDS_ENCODER_CONTROL_PARAMETERS_V3 -#define TMDS2_ENCODER_CONTROL_PS_ALLOCATION_V3 TMDS2_ENCODER_CONTROL_PARAMETERS_V3 - -/****************************************************************************/ -// Structures used by ### -/****************************************************************************/ -typedef struct _ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS -{ - UCHAR ucEnable; // Enable or Disable External TMDS encoder - UCHAR ucMisc; // Bit0=0:Enable Single link;=1:Enable Dual link;Bit1 {=0:666RGB, =1:888RGB} - UCHAR ucPadding[2]; -}ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS; - -typedef struct _ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION -{ - ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS sXTmdsEncoder; - WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; //Caller doesn't need to init this portion -}ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION; - -#define ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS_V2 LVDS_ENCODER_CONTROL_PARAMETERS_V2 - -typedef struct _ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION_V2 -{ - ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS_V2 sXTmdsEncoder; - WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; //Caller doesn't need to init this portion -}ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION_V2; - -typedef struct _EXTERNAL_ENCODER_CONTROL_PS_ALLOCATION -{ - DIG_ENCODER_CONTROL_PARAMETERS sDigEncoder; - WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; -}EXTERNAL_ENCODER_CONTROL_PS_ALLOCATION; - -/****************************************************************************/ -// Structures used by DVOEncoderControlTable -/****************************************************************************/ -//ucTableFormatRevision=1,ucTableContentRevision=3 -//ucDVOConfig: -#define DVO_ENCODER_CONFIG_RATE_SEL 0x01 -#define DVO_ENCODER_CONFIG_DDR_SPEED 0x00 -#define DVO_ENCODER_CONFIG_SDR_SPEED 0x01 -#define DVO_ENCODER_CONFIG_OUTPUT_SEL 0x0c -#define DVO_ENCODER_CONFIG_LOW12BIT 0x00 -#define DVO_ENCODER_CONFIG_UPPER12BIT 0x04 -#define DVO_ENCODER_CONFIG_24BIT 0x08 - -typedef struct _DVO_ENCODER_CONTROL_PARAMETERS_V3 -{ - USHORT usPixelClock; - UCHAR ucDVOConfig; - UCHAR ucAction; //ATOM_ENABLE/ATOM_DISABLE/ATOM_HPD_INIT - UCHAR ucReseved[4]; -}DVO_ENCODER_CONTROL_PARAMETERS_V3; -#define DVO_ENCODER_CONTROL_PS_ALLOCATION_V3 DVO_ENCODER_CONTROL_PARAMETERS_V3 - -//ucTableFormatRevision=1 -//ucTableContentRevision=3 structure is not changed but usMisc add bit 1 as another input for -// bit1=0: non-coherent mode -// =1: coherent mode - -//========================================================================================== -//Only change is here next time when changing encoder parameter definitions again! -#define LVDS_ENCODER_CONTROL_PARAMETERS_LAST LVDS_ENCODER_CONTROL_PARAMETERS_V3 -#define LVDS_ENCODER_CONTROL_PS_ALLOCATION_LAST LVDS_ENCODER_CONTROL_PARAMETERS_LAST - -#define TMDS1_ENCODER_CONTROL_PARAMETERS_LAST LVDS_ENCODER_CONTROL_PARAMETERS_V3 -#define TMDS1_ENCODER_CONTROL_PS_ALLOCATION_LAST TMDS1_ENCODER_CONTROL_PARAMETERS_LAST - -#define TMDS2_ENCODER_CONTROL_PARAMETERS_LAST LVDS_ENCODER_CONTROL_PARAMETERS_V3 -#define TMDS2_ENCODER_CONTROL_PS_ALLOCATION_LAST TMDS2_ENCODER_CONTROL_PARAMETERS_LAST - -#define DVO_ENCODER_CONTROL_PARAMETERS_LAST DVO_ENCODER_CONTROL_PARAMETERS -#define DVO_ENCODER_CONTROL_PS_ALLOCATION_LAST DVO_ENCODER_CONTROL_PS_ALLOCATION - -//========================================================================================== -#define PANEL_ENCODER_MISC_DUAL 0x01 -#define PANEL_ENCODER_MISC_COHERENT 0x02 -#define PANEL_ENCODER_MISC_TMDS_LINKB 0x04 -#define PANEL_ENCODER_MISC_HDMI_TYPE 0x08 - -#define PANEL_ENCODER_ACTION_DISABLE ATOM_DISABLE -#define PANEL_ENCODER_ACTION_ENABLE ATOM_ENABLE -#define PANEL_ENCODER_ACTION_COHERENTSEQ (ATOM_ENABLE+1) - -#define PANEL_ENCODER_TRUNCATE_EN 0x01 -#define PANEL_ENCODER_TRUNCATE_DEPTH 0x10 -#define PANEL_ENCODER_SPATIAL_DITHER_EN 0x01 -#define PANEL_ENCODER_SPATIAL_DITHER_DEPTH 0x10 -#define PANEL_ENCODER_TEMPORAL_DITHER_EN 0x01 -#define PANEL_ENCODER_TEMPORAL_DITHER_DEPTH 0x10 -#define PANEL_ENCODER_TEMPORAL_LEVEL_4 0x20 -#define PANEL_ENCODER_25FRC_MASK 0x10 -#define PANEL_ENCODER_25FRC_E 0x00 -#define PANEL_ENCODER_25FRC_F 0x10 -#define PANEL_ENCODER_50FRC_MASK 0x60 -#define PANEL_ENCODER_50FRC_A 0x00 -#define PANEL_ENCODER_50FRC_B 0x20 -#define PANEL_ENCODER_50FRC_C 0x40 -#define PANEL_ENCODER_50FRC_D 0x60 -#define PANEL_ENCODER_75FRC_MASK 0x80 -#define PANEL_ENCODER_75FRC_E 0x00 -#define PANEL_ENCODER_75FRC_F 0x80 - -/****************************************************************************/ -// Structures used by SetVoltageTable -/****************************************************************************/ -#define SET_VOLTAGE_TYPE_ASIC_VDDC 1 -#define SET_VOLTAGE_TYPE_ASIC_MVDDC 2 -#define SET_VOLTAGE_TYPE_ASIC_MVDDQ 3 -#define SET_VOLTAGE_TYPE_ASIC_VDDCI 4 -#define SET_VOLTAGE_INIT_MODE 5 -#define SET_VOLTAGE_GET_MAX_VOLTAGE 6 //Gets the Max. voltage for the soldered Asic - -#define SET_ASIC_VOLTAGE_MODE_ALL_SOURCE 0x1 -#define SET_ASIC_VOLTAGE_MODE_SOURCE_A 0x2 -#define SET_ASIC_VOLTAGE_MODE_SOURCE_B 0x4 - -#define SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE 0x0 -#define SET_ASIC_VOLTAGE_MODE_GET_GPIOVAL 0x1 -#define SET_ASIC_VOLTAGE_MODE_GET_GPIOMASK 0x2 - -typedef struct _SET_VOLTAGE_PARAMETERS -{ - UCHAR ucVoltageType; // To tell which voltage to set up, VDDC/MVDDC/MVDDQ - UCHAR ucVoltageMode; // To set all, to set source A or source B or ... - UCHAR ucVoltageIndex; // An index to tell which voltage level - UCHAR ucReserved; -}SET_VOLTAGE_PARAMETERS; - -typedef struct _SET_VOLTAGE_PARAMETERS_V2 -{ - UCHAR ucVoltageType; // To tell which voltage to set up, VDDC/MVDDC/MVDDQ - UCHAR ucVoltageMode; // Not used, maybe use for state machine for differen power mode - USHORT usVoltageLevel; // real voltage level -}SET_VOLTAGE_PARAMETERS_V2; - -typedef struct _SET_VOLTAGE_PS_ALLOCATION -{ - SET_VOLTAGE_PARAMETERS sASICSetVoltage; - WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; -}SET_VOLTAGE_PS_ALLOCATION; - -/****************************************************************************/ -// Structures used by TVEncoderControlTable -/****************************************************************************/ -typedef struct _TV_ENCODER_CONTROL_PARAMETERS -{ - USHORT usPixelClock; // in 10KHz; for bios convenient - UCHAR ucTvStandard; // See definition "ATOM_TV_NTSC ..." - UCHAR ucAction; // 0: turn off encoder - // 1: setup and turn on encoder -}TV_ENCODER_CONTROL_PARAMETERS; - -typedef struct _TV_ENCODER_CONTROL_PS_ALLOCATION -{ - TV_ENCODER_CONTROL_PARAMETERS sTVEncoder; - WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; // Don't set this one -}TV_ENCODER_CONTROL_PS_ALLOCATION; - -//==============================Data Table Portion==================================== - -#ifdef UEFI_BUILD - #define UTEMP USHORT - #define USHORT void* -#endif - -/****************************************************************************/ -// Structure used in Data.mtb -/****************************************************************************/ -typedef struct _ATOM_MASTER_LIST_OF_DATA_TABLES -{ - USHORT UtilityPipeLine; // Offest for the utility to get parser info,Don't change this position! - USHORT MultimediaCapabilityInfo; // Only used by MM Lib,latest version 1.1, not configuable from Bios, need to include the table to build Bios - USHORT MultimediaConfigInfo; // Only used by MM Lib,latest version 2.1, not configuable from Bios, need to include the table to build Bios - USHORT StandardVESA_Timing; // Only used by Bios - USHORT FirmwareInfo; // Shared by various SW components,latest version 1.4 - USHORT DAC_Info; // Will be obsolete from R600 - USHORT LVDS_Info; // Shared by various SW components,latest version 1.1 - USHORT TMDS_Info; // Will be obsolete from R600 - USHORT AnalogTV_Info; // Shared by various SW components,latest version 1.1 - USHORT SupportedDevicesInfo; // Will be obsolete from R600 - USHORT GPIO_I2C_Info; // Shared by various SW components,latest version 1.2 will be used from R600 - USHORT VRAM_UsageByFirmware; // Shared by various SW components,latest version 1.3 will be used from R600 - USHORT GPIO_Pin_LUT; // Shared by various SW components,latest version 1.1 - USHORT VESA_ToInternalModeLUT; // Only used by Bios - USHORT ComponentVideoInfo; // Shared by various SW components,latest version 2.1 will be used from R600 - USHORT PowerPlayInfo; // Shared by various SW components,latest version 2.1,new design from R600 - USHORT CompassionateData; // Will be obsolete from R600 - USHORT SaveRestoreInfo; // Only used by Bios - USHORT PPLL_SS_Info; // Shared by various SW components,latest version 1.2, used to call SS_Info, change to new name because of int ASIC SS info - USHORT OemInfo; // Defined and used by external SW, should be obsolete soon - USHORT XTMDS_Info; // Will be obsolete from R600 - USHORT MclkSS_Info; // Shared by various SW components,latest version 1.1, only enabled when ext SS chip is used - USHORT Object_Header; // Shared by various SW components,latest version 1.1 - USHORT IndirectIOAccess; // Only used by Bios,this table position can't change at all!! - USHORT MC_InitParameter; // Only used by command table - USHORT ASIC_VDDC_Info; // Will be obsolete from R600 - USHORT ASIC_InternalSS_Info; // New tabel name from R600, used to be called "ASIC_MVDDC_Info" - USHORT TV_VideoMode; // Only used by command table - USHORT VRAM_Info; // Only used by command table, latest version 1.3 - USHORT MemoryTrainingInfo; // Used for VBIOS and Diag utility for memory training purpose since R600. the new table rev start from 2.1 - USHORT IntegratedSystemInfo; // Shared by various SW components - USHORT ASIC_ProfilingInfo; // New table name from R600, used to be called "ASIC_VDDCI_Info" for pre-R600 - USHORT VoltageObjectInfo; // Shared by various SW components, latest version 1.1 - USHORT PowerSourceInfo; // Shared by various SW components, latest versoin 1.1 -}ATOM_MASTER_LIST_OF_DATA_TABLES; - -#ifdef UEFI_BUILD - #define USHORT UTEMP -#endif - -typedef struct _ATOM_MASTER_DATA_TABLE -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_MASTER_LIST_OF_DATA_TABLES ListOfDataTables; -}ATOM_MASTER_DATA_TABLE; - -/****************************************************************************/ -// Structure used in MultimediaCapabilityInfoTable -/****************************************************************************/ -typedef struct _ATOM_MULTIMEDIA_CAPABILITY_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ULONG ulSignature; // HW info table signature string "$ATI" - UCHAR ucI2C_Type; // I2C type (normal GP_IO, ImpactTV GP_IO, Dedicated I2C pin, etc) - UCHAR ucTV_OutInfo; // Type of TV out supported (3:0) and video out crystal frequency (6:4) and TV data port (7) - UCHAR ucVideoPortInfo; // Provides the video port capabilities - UCHAR ucHostPortInfo; // Provides host port configuration information -}ATOM_MULTIMEDIA_CAPABILITY_INFO; - -/****************************************************************************/ -// Structure used in MultimediaConfigInfoTable -/****************************************************************************/ -typedef struct _ATOM_MULTIMEDIA_CONFIG_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ULONG ulSignature; // MM info table signature sting "$MMT" - UCHAR ucTunerInfo; // Type of tuner installed on the adapter (4:0) and video input for tuner (7:5) - UCHAR ucAudioChipInfo; // List the audio chip type (3:0) product type (4) and OEM revision (7:5) - UCHAR ucProductID; // Defines as OEM ID or ATI board ID dependent on product type setting - UCHAR ucMiscInfo1; // Tuner voltage (1:0) HW teletext support (3:2) FM audio decoder (5:4) reserved (6) audio scrambling (7) - UCHAR ucMiscInfo2; // I2S input config (0) I2S output config (1) I2S Audio Chip (4:2) SPDIF Output Config (5) reserved (7:6) - UCHAR ucMiscInfo3; // Video Decoder Type (3:0) Video In Standard/Crystal (7:4) - UCHAR ucMiscInfo4; // Video Decoder Host Config (2:0) reserved (7:3) - UCHAR ucVideoInput0Info;// Video Input 0 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) - UCHAR ucVideoInput1Info;// Video Input 1 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) - UCHAR ucVideoInput2Info;// Video Input 2 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) - UCHAR ucVideoInput3Info;// Video Input 3 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) - UCHAR ucVideoInput4Info;// Video Input 4 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) -}ATOM_MULTIMEDIA_CONFIG_INFO; - - -/****************************************************************************/ -// Structures used in FirmwareInfoTable -/****************************************************************************/ - -// usBIOSCapability Defintion: -// Bit 0 = 0: Bios image is not Posted, =1:Bios image is Posted; -// Bit 1 = 0: Dual CRTC is not supported, =1: Dual CRTC is supported; -// Bit 2 = 0: Extended Desktop is not supported, =1: Extended Desktop is supported; -// Others: Reserved -#define ATOM_BIOS_INFO_ATOM_FIRMWARE_POSTED 0x0001 -#define ATOM_BIOS_INFO_DUAL_CRTC_SUPPORT 0x0002 -#define ATOM_BIOS_INFO_EXTENDED_DESKTOP_SUPPORT 0x0004 -#define ATOM_BIOS_INFO_MEMORY_CLOCK_SS_SUPPORT 0x0008 -#define ATOM_BIOS_INFO_ENGINE_CLOCK_SS_SUPPORT 0x0010 -#define ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU 0x0020 -#define ATOM_BIOS_INFO_WMI_SUPPORT 0x0040 -#define ATOM_BIOS_INFO_PPMODE_ASSIGNGED_BY_SYSTEM 0x0080 -#define ATOM_BIOS_INFO_HYPERMEMORY_SUPPORT 0x0100 -#define ATOM_BIOS_INFO_HYPERMEMORY_SIZE_MASK 0x1E00 -#define ATOM_BIOS_INFO_VPOST_WITHOUT_FIRST_MODE_SET 0x2000 -#define ATOM_BIOS_INFO_BIOS_SCRATCH6_SCL2_REDEFINE 0x4000 - - -#ifndef _H2INC - -//Please don't add or expand this bitfield structure below, this one will retire soon.! -typedef struct _ATOM_FIRMWARE_CAPABILITY -{ - USHORT FirmwarePosted:1; - USHORT DualCRTC_Support:1; - USHORT ExtendedDesktopSupport:1; - USHORT MemoryClockSS_Support:1; - USHORT EngineClockSS_Support:1; - USHORT GPUControlsBL:1; - USHORT WMI_SUPPORT:1; - USHORT PPMode_Assigned:1; - USHORT HyperMemory_Support:1; - USHORT HyperMemory_Size:4; - USHORT Reserved:3; -}ATOM_FIRMWARE_CAPABILITY; - -typedef union _ATOM_FIRMWARE_CAPABILITY_ACCESS -{ - ATOM_FIRMWARE_CAPABILITY sbfAccess; - USHORT susAccess; -}ATOM_FIRMWARE_CAPABILITY_ACCESS; - -#else - -typedef union _ATOM_FIRMWARE_CAPABILITY_ACCESS -{ - USHORT susAccess; -}ATOM_FIRMWARE_CAPABILITY_ACCESS; - -#endif - -typedef struct _ATOM_FIRMWARE_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ULONG ulFirmwareRevision; - ULONG ulDefaultEngineClock; //In 10Khz unit - ULONG ulDefaultMemoryClock; //In 10Khz unit - ULONG ulDriverTargetEngineClock; //In 10Khz unit - ULONG ulDriverTargetMemoryClock; //In 10Khz unit - ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit - ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit - ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit - ULONG ulASICMaxEngineClock; //In 10Khz unit - ULONG ulASICMaxMemoryClock; //In 10Khz unit - UCHAR ucASICMaxTemperature; - UCHAR ucPadding[3]; //Don't use them - ULONG aulReservedForBIOS[3]; //Don't use them - USHORT usMinEngineClockPLL_Input; //In 10Khz unit - USHORT usMaxEngineClockPLL_Input; //In 10Khz unit - USHORT usMinEngineClockPLL_Output; //In 10Khz unit - USHORT usMinMemoryClockPLL_Input; //In 10Khz unit - USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit - USHORT usMinMemoryClockPLL_Output; //In 10Khz unit - USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk - USHORT usMinPixelClockPLL_Input; //In 10Khz unit - USHORT usMaxPixelClockPLL_Input; //In 10Khz unit - USHORT usMinPixelClockPLL_Output; //In 10Khz unit, the definitions above can't change!!! - ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; - USHORT usReferenceClock; //In 10Khz unit - USHORT usPM_RTS_Location; //RTS PM4 starting location in ROM in 1Kb unit - UCHAR ucPM_RTS_StreamSize; //RTS PM4 packets in Kb unit - UCHAR ucDesign_ID; //Indicate what is the board design - UCHAR ucMemoryModule_ID; //Indicate what is the board design -}ATOM_FIRMWARE_INFO; - -typedef struct _ATOM_FIRMWARE_INFO_V1_2 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ULONG ulFirmwareRevision; - ULONG ulDefaultEngineClock; //In 10Khz unit - ULONG ulDefaultMemoryClock; //In 10Khz unit - ULONG ulDriverTargetEngineClock; //In 10Khz unit - ULONG ulDriverTargetMemoryClock; //In 10Khz unit - ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit - ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit - ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit - ULONG ulASICMaxEngineClock; //In 10Khz unit - ULONG ulASICMaxMemoryClock; //In 10Khz unit - UCHAR ucASICMaxTemperature; - UCHAR ucMinAllowedBL_Level; - UCHAR ucPadding[2]; //Don't use them - ULONG aulReservedForBIOS[2]; //Don't use them - ULONG ulMinPixelClockPLL_Output; //In 10Khz unit - USHORT usMinEngineClockPLL_Input; //In 10Khz unit - USHORT usMaxEngineClockPLL_Input; //In 10Khz unit - USHORT usMinEngineClockPLL_Output; //In 10Khz unit - USHORT usMinMemoryClockPLL_Input; //In 10Khz unit - USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit - USHORT usMinMemoryClockPLL_Output; //In 10Khz unit - USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk - USHORT usMinPixelClockPLL_Input; //In 10Khz unit - USHORT usMaxPixelClockPLL_Input; //In 10Khz unit - USHORT usMinPixelClockPLL_Output; //In 10Khz unit - lower 16bit of ulMinPixelClockPLL_Output - ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; - USHORT usReferenceClock; //In 10Khz unit - USHORT usPM_RTS_Location; //RTS PM4 starting location in ROM in 1Kb unit - UCHAR ucPM_RTS_StreamSize; //RTS PM4 packets in Kb unit - UCHAR ucDesign_ID; //Indicate what is the board design - UCHAR ucMemoryModule_ID; //Indicate what is the board design -}ATOM_FIRMWARE_INFO_V1_2; - -typedef struct _ATOM_FIRMWARE_INFO_V1_3 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ULONG ulFirmwareRevision; - ULONG ulDefaultEngineClock; //In 10Khz unit - ULONG ulDefaultMemoryClock; //In 10Khz unit - ULONG ulDriverTargetEngineClock; //In 10Khz unit - ULONG ulDriverTargetMemoryClock; //In 10Khz unit - ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit - ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit - ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit - ULONG ulASICMaxEngineClock; //In 10Khz unit - ULONG ulASICMaxMemoryClock; //In 10Khz unit - UCHAR ucASICMaxTemperature; - UCHAR ucMinAllowedBL_Level; - UCHAR ucPadding[2]; //Don't use them - ULONG aulReservedForBIOS; //Don't use them - ULONG ul3DAccelerationEngineClock;//In 10Khz unit - ULONG ulMinPixelClockPLL_Output; //In 10Khz unit - USHORT usMinEngineClockPLL_Input; //In 10Khz unit - USHORT usMaxEngineClockPLL_Input; //In 10Khz unit - USHORT usMinEngineClockPLL_Output; //In 10Khz unit - USHORT usMinMemoryClockPLL_Input; //In 10Khz unit - USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit - USHORT usMinMemoryClockPLL_Output; //In 10Khz unit - USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk - USHORT usMinPixelClockPLL_Input; //In 10Khz unit - USHORT usMaxPixelClockPLL_Input; //In 10Khz unit - USHORT usMinPixelClockPLL_Output; //In 10Khz unit - lower 16bit of ulMinPixelClockPLL_Output - ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; - USHORT usReferenceClock; //In 10Khz unit - USHORT usPM_RTS_Location; //RTS PM4 starting location in ROM in 1Kb unit - UCHAR ucPM_RTS_StreamSize; //RTS PM4 packets in Kb unit - UCHAR ucDesign_ID; //Indicate what is the board design - UCHAR ucMemoryModule_ID; //Indicate what is the board design -}ATOM_FIRMWARE_INFO_V1_3; - -typedef struct _ATOM_FIRMWARE_INFO_V1_4 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ULONG ulFirmwareRevision; - ULONG ulDefaultEngineClock; //In 10Khz unit - ULONG ulDefaultMemoryClock; //In 10Khz unit - ULONG ulDriverTargetEngineClock; //In 10Khz unit - ULONG ulDriverTargetMemoryClock; //In 10Khz unit - ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit - ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit - ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit - ULONG ulASICMaxEngineClock; //In 10Khz unit - ULONG ulASICMaxMemoryClock; //In 10Khz unit - UCHAR ucASICMaxTemperature; - UCHAR ucMinAllowedBL_Level; - USHORT usBootUpVDDCVoltage; //In MV unit - USHORT usLcdMinPixelClockPLL_Output; // In MHz unit - USHORT usLcdMaxPixelClockPLL_Output; // In MHz unit - ULONG ul3DAccelerationEngineClock;//In 10Khz unit - ULONG ulMinPixelClockPLL_Output; //In 10Khz unit - USHORT usMinEngineClockPLL_Input; //In 10Khz unit - USHORT usMaxEngineClockPLL_Input; //In 10Khz unit - USHORT usMinEngineClockPLL_Output; //In 10Khz unit - USHORT usMinMemoryClockPLL_Input; //In 10Khz unit - USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit - USHORT usMinMemoryClockPLL_Output; //In 10Khz unit - USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk - USHORT usMinPixelClockPLL_Input; //In 10Khz unit - USHORT usMaxPixelClockPLL_Input; //In 10Khz unit - USHORT usMinPixelClockPLL_Output; //In 10Khz unit - lower 16bit of ulMinPixelClockPLL_Output - ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; - USHORT usReferenceClock; //In 10Khz unit - USHORT usPM_RTS_Location; //RTS PM4 starting location in ROM in 1Kb unit - UCHAR ucPM_RTS_StreamSize; //RTS PM4 packets in Kb unit - UCHAR ucDesign_ID; //Indicate what is the board design - UCHAR ucMemoryModule_ID; //Indicate what is the board design -}ATOM_FIRMWARE_INFO_V1_4; - -#define ATOM_FIRMWARE_INFO_LAST ATOM_FIRMWARE_INFO_V1_4 - -/****************************************************************************/ -// Structures used in IntegratedSystemInfoTable -/****************************************************************************/ -#define IGP_CAP_FLAG_DYNAMIC_CLOCK_EN 0x2 -#define IGP_CAP_FLAG_AC_CARD 0x4 -#define IGP_CAP_FLAG_SDVO_CARD 0x8 -#define IGP_CAP_FLAG_POSTDIV_BY_2_MODE 0x10 - -typedef struct _ATOM_INTEGRATED_SYSTEM_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ULONG ulBootUpEngineClock; //in 10kHz unit - ULONG ulBootUpMemoryClock; //in 10kHz unit - ULONG ulMaxSystemMemoryClock; //in 10kHz unit - ULONG ulMinSystemMemoryClock; //in 10kHz unit - UCHAR ucNumberOfCyclesInPeriodHi; - UCHAR ucLCDTimingSel; //=0:not valid.!=0 sel this timing descriptor from LCD EDID. - USHORT usReserved1; - USHORT usInterNBVoltageLow; //An intermidiate PMW value to set the voltage - USHORT usInterNBVoltageHigh; //Another intermidiate PMW value to set the voltage - ULONG ulReserved[2]; - - USHORT usFSBClock; //In MHz unit - USHORT usCapabilityFlag; //Bit0=1 indicates the fake HDMI support,Bit1=0/1 for Dynamic clocking dis/enable - //Bit[3:2]== 0:No PCIE card, 1:AC card, 2:SDVO card - //Bit[4]==1: P/2 mode, ==0: P/1 mode - USHORT usPCIENBCfgReg7; //bit[7:0]=MUX_Sel, bit[9:8]=MUX_SEL_LEVEL2, bit[10]=Lane_Reversal - USHORT usK8MemoryClock; //in MHz unit - USHORT usK8SyncStartDelay; //in 0.01 us unit - USHORT usK8DataReturnTime; //in 0.01 us unit - UCHAR ucMaxNBVoltage; - UCHAR ucMinNBVoltage; - UCHAR ucMemoryType; //[7:4]=1:DDR1;=2:DDR2;=3:DDR3.[3:0] is reserved - UCHAR ucNumberOfCyclesInPeriod; //CG.FVTHROT_PWM_CTRL_REG0.NumberOfCyclesInPeriod - UCHAR ucStartingPWM_HighTime; //CG.FVTHROT_PWM_CTRL_REG0.StartingPWM_HighTime - UCHAR ucHTLinkWidth; //16 bit vs. 8 bit - UCHAR ucMaxNBVoltageHigh; - UCHAR ucMinNBVoltageHigh; -}ATOM_INTEGRATED_SYSTEM_INFO; - -/* Explanation on entries in ATOM_INTEGRATED_SYSTEM_INFO -ulBootUpMemoryClock: For Intel IGP,it's the UMA system memory clock - For AMD IGP,it's 0 if no SidePort memory installed or it's the boot-up SidePort memory clock -ulMaxSystemMemoryClock: For Intel IGP,it's the Max freq from memory SPD if memory runs in ASYNC mode or otherwise (SYNC mode) it's 0 - For AMD IGP,for now this can be 0 -ulMinSystemMemoryClock: For Intel IGP,it's 133MHz if memory runs in ASYNC mode or otherwise (SYNC mode) it's 0 - For AMD IGP,for now this can be 0 - -usFSBClock: For Intel IGP,it's FSB Freq - For AMD IGP,it's HT Link Speed - -usK8MemoryClock: For AMD IGP only. For RevF CPU, set it to 200 -usK8SyncStartDelay: For AMD IGP only. Memory access latency in K8, required for watermark calculation -usK8DataReturnTime: For AMD IGP only. Memory access latency in K8, required for watermark calculation - -VC:Voltage Control -ucMaxNBVoltage: Voltage regulator dependent PWM value. Low 8 bits of the value for the max voltage.Set this one to 0xFF if VC without PWM. Set this to 0x0 if no VC at all. -ucMinNBVoltage: Voltage regulator dependent PWM value. Low 8 bits of the value for the min voltage.Set this one to 0x00 if VC without PWM or no VC at all. - -ucNumberOfCyclesInPeriod: Indicate how many cycles when PWM duty is 100%. low 8 bits of the value. -ucNumberOfCyclesInPeriodHi: Indicate how many cycles when PWM duty is 100%. high 8 bits of the value.If the PWM has an inverter,set bit [7]==1,otherwise set it 0 - -ucMaxNBVoltageHigh: Voltage regulator dependent PWM value. High 8 bits of the value for the max voltage.Set this one to 0xFF if VC without PWM. Set this to 0x0 if no VC at all. -ucMinNBVoltageHigh: Voltage regulator dependent PWM value. High 8 bits of the value for the min voltage.Set this one to 0x00 if VC without PWM or no VC at all. - - -usInterNBVoltageLow: Voltage regulator dependent PWM value. The value makes the the voltage >=Min NB voltage but <=InterNBVoltageHigh. Set this to 0x0000 if VC without PWM or no VC at all. -usInterNBVoltageHigh: Voltage regulator dependent PWM value. The value makes the the voltage >=InterNBVoltageLow but <=Max NB voltage.Set this to 0x0000 if VC without PWM or no VC at all. -*/ - - -/* -The following IGP table is introduced from RS780, which is supposed to be put by SBIOS in FB before IGP VBIOS starts VPOST; -Then VBIOS will copy the whole structure to its image so all GPU SW components can access this data structure to get whatever they need. -The enough reservation should allow us to never change table revisions. Whenever needed, a GPU SW component can use reserved portion for new data entries. - -SW components can access the IGP system infor structure in the same way as before -*/ - - -typedef struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ULONG ulBootUpEngineClock; //in 10kHz unit - ULONG ulReserved1[2]; //must be 0x0 for the reserved - ULONG ulBootUpUMAClock; //in 10kHz unit - ULONG ulBootUpSidePortClock; //in 10kHz unit - ULONG ulMinSidePortClock; //in 10kHz unit - ULONG ulReserved2[6]; //must be 0x0 for the reserved - ULONG ulSystemConfig; //see explanation below - ULONG ulBootUpReqDisplayVector; - ULONG ulOtherDisplayMisc; - ULONG ulDDISlot1Config; - ULONG ulDDISlot2Config; - UCHAR ucMemoryType; //[3:0]=1:DDR1;=2:DDR2;=3:DDR3.[7:4] is reserved - UCHAR ucUMAChannelNumber; - UCHAR ucDockingPinBit; - UCHAR ucDockingPinPolarity; - ULONG ulDockingPinCFGInfo; - ULONG ulCPUCapInfo; - USHORT usNumberOfCyclesInPeriod; - USHORT usMaxNBVoltage; - USHORT usMinNBVoltage; - USHORT usBootUpNBVoltage; - ULONG ulHTLinkFreq; //in 10Khz - USHORT usMinHTLinkWidth; - USHORT usMaxHTLinkWidth; - USHORT usUMASyncStartDelay; - USHORT usUMADataReturnTime; - USHORT usLinkStatusZeroTime; - USHORT usReserved; - ULONG ulHighVoltageHTLinkFreq; // in 10Khz - ULONG ulLowVoltageHTLinkFreq; // in 10Khz - USHORT usMaxUpStreamHTLinkWidth; - USHORT usMaxDownStreamHTLinkWidth; - USHORT usMinUpStreamHTLinkWidth; - USHORT usMinDownStreamHTLinkWidth; - ULONG ulReserved3[97]; //must be 0x0 -}ATOM_INTEGRATED_SYSTEM_INFO_V2; - -/* -ulBootUpEngineClock: Boot-up Engine Clock in 10Khz; -ulBootUpUMAClock: Boot-up UMA Clock in 10Khz; it must be 0x0 when UMA is not present -ulBootUpSidePortClock: Boot-up SidePort Clock in 10Khz; it must be 0x0 when SidePort Memory is not present,this could be equal to or less than maximum supported Sideport memory clock - -ulSystemConfig: -Bit[0]=1: PowerExpress mode =0 Non-PowerExpress mode; -Bit[1]=1: system boots up at AMD overdrived state or user customized mode. In this case, driver will just stick to this boot-up mode. No other PowerPlay state - =0: system boots up at driver control state. Power state depends on PowerPlay table. -Bit[2]=1: PWM method is used on NB voltage control. =0: GPIO method is used. -Bit[3]=1: Only one power state(Performance) will be supported. - =0: Multiple power states supported from PowerPlay table. -Bit[4]=1: CLMC is supported and enabled on current system. - =0: CLMC is not supported or enabled on current system. SBIOS need to support HT link/freq change through ATIF interface. -Bit[5]=1: Enable CDLW for all driver control power states. Max HT width is from SBIOS, while Min HT width is determined by display requirement. - =0: CDLW is disabled. If CLMC is enabled case, Min HT width will be set equal to Max HT width. If CLMC disabled case, Max HT width will be applied. -Bit[6]=1: High Voltage requested for all power states. In this case, voltage will be forced at 1.1v and powerplay table voltage drop/throttling request will be ignored. - =0: Voltage settings is determined by powerplay table. -Bit[7]=1: Enable CLMC as hybrid Mode. CDLD and CILR will be disabled in this case and we're using legacy C1E. This is workaround for CPU(Griffin) performance issue. - =0: Enable CLMC as regular mode, CDLD and CILR will be enabled. - -ulBootUpReqDisplayVector: This dword is a bit vector indicates what display devices are requested during boot-up. Refer to ATOM_DEVICE_xxx_SUPPORT for the bit vector definitions. - -ulOtherDisplayMisc: [15:8]- Bootup LCD Expansion selection; 0-center, 1-full panel size expansion; - [7:0] - BootupTV standard selection; This is a bit vector to indicate what TV standards are supported by the system. Refer to ucTVSuppportedStd definition; - -ulDDISlot1Config: Describes the PCIE lane configuration on this DDI PCIE slot (ADD2 card) or connector (Mobile design). - [3:0] - Bit vector to indicate PCIE lane config of the DDI slot/connector on chassis (bit 0=1 lane 3:0; bit 1=1 lane 7:4; bit 2=1 lane 11:8; bit 3=1 lane 15:12) - [7:4] - Bit vector to indicate PCIE lane config of the same DDI slot/connector on docking station (bit 0=1 lane 3:0; bit 1=1 lane 7:4; bit 2=1 lane 11:8; bit 3=1 lane 15:12) - [15:8] - Lane configuration attribute; - [23:16]- Connector type, possible value: - CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D - CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D - CONNECTOR_OBJECT_ID_HDMI_TYPE_A - CONNECTOR_OBJECT_ID_DISPLAYPORT - [31:24]- Reserved - -ulDDISlot2Config: Same as Slot1. -ucMemoryType: SidePort memory type, set it to 0x0 when Sideport memory is not installed. Driver needs this info to change sideport memory clock. Not for display in CCC. -For IGP, Hypermemory is the only memory type showed in CCC. - -ucUMAChannelNumber: how many channels for the UMA; - -ulDockingPinCFGInfo: [15:0]-Bus/Device/Function # to CFG to read this Docking Pin; [31:16]-reg offset in CFG to read this pin -ucDockingPinBit: which bit in this register to read the pin status; -ucDockingPinPolarity:Polarity of the pin when docked; - -ulCPUCapInfo: [7:0]=1:Griffin;[7:0]=2:Greyhound;[7:0]=3:K8, other bits reserved for now and must be 0x0 - -usNumberOfCyclesInPeriod:Indicate how many cycles when PWM duty is 100%. -usMaxNBVoltage:Voltage regulator dependent PWM value.Set this one to 0xFF if VC without PWM. Set this to 0x0 if no VC at all. - -usMaxNBVoltage:Max. voltage control value in either PWM or GPIO mode. -usMinNBVoltage:Min. voltage control value in either PWM or GPIO mode. - GPIO mode: both usMaxNBVoltage & usMinNBVoltage have a valid value ulSystemConfig.SYSTEM_CONFIG_USE_PWM_ON_VOLTAGE=0 - PWM mode: both usMaxNBVoltage & usMinNBVoltage have a valid value ulSystemConfig.SYSTEM_CONFIG_USE_PWM_ON_VOLTAGE=1 - GPU SW don't control mode: usMaxNBVoltage & usMinNBVoltage=0 and no care about ulSystemConfig.SYSTEM_CONFIG_USE_PWM_ON_VOLTAGE - - -ulHTLinkFreq: Bootup HT link Frequency in 10Khz. -usMinHTLinkWidth: Bootup minimum HT link width. If CDLW disabled, this is equal to usMaxHTLinkWidth. - If CDLW enabled, both upstream and downstream width should be the same during bootup. -usMaxHTLinkWidth: Bootup maximum HT link width. If CDLW disabled, this is equal to usMinHTLinkWidth. - If CDLW enabled, both upstream and downstream width should be the same during bootup. - -usUMASyncStartDelay: Memory access latency, required for watermark calculation -usUMADataReturnTime: Memory access latency, required for watermark calculation -usLinkStatusZeroTime:Memory access latency required for watermark calculation, set this to 0x0 for K8 CPU, set a proper value in 0.01 the unit of us -for Griffin or Greyhound. SBIOS needs to convert to actual time by: - if T0Ttime [5:4]=00b, then usLinkStatusZeroTime=T0Ttime [3:0]*0.1us (0.0 to 1.5us) - if T0Ttime [5:4]=01b, then usLinkStatusZeroTime=T0Ttime [3:0]*0.5us (0.0 to 7.5us) - if T0Ttime [5:4]=10b, then usLinkStatusZeroTime=T0Ttime [3:0]*2.0us (0.0 to 30us) - if T0Ttime [5:4]=11b, and T0Ttime [3:0]=0x0 to 0xa, then usLinkStatusZeroTime=T0Ttime [3:0]*20us (0.0 to 200us) - -ulHighVoltageHTLinkFreq: HT link frequency for power state with low voltage. If boot up runs in HT1, this must be 0. - This must be less than or equal to ulHTLinkFreq(bootup frequency). -ulLowVoltageHTLinkFreq: HT link frequency for power state with low voltage or voltage scaling 1.0v~1.1v. If boot up runs in HT1, this must be 0. - This must be less than or equal to ulHighVoltageHTLinkFreq. - -usMaxUpStreamHTLinkWidth: Asymmetric link width support in the future, to replace usMaxHTLinkWidth. Not used for now. -usMaxDownStreamHTLinkWidth: same as above. -usMinUpStreamHTLinkWidth: Asymmetric link width support in the future, to replace usMinHTLinkWidth. Not used for now. -usMinDownStreamHTLinkWidth: same as above. -*/ - - -#define SYSTEM_CONFIG_POWEREXPRESS_ENABLE 0x00000001 -#define SYSTEM_CONFIG_RUN_AT_OVERDRIVE_ENGINE 0x00000002 -#define SYSTEM_CONFIG_USE_PWM_ON_VOLTAGE 0x00000004 -#define SYSTEM_CONFIG_PERFORMANCE_POWERSTATE_ONLY 0x00000008 -#define SYSTEM_CONFIG_CLMC_ENABLED 0x00000010 -#define SYSTEM_CONFIG_CDLW_ENABLED 0x00000020 -#define SYSTEM_CONFIG_HIGH_VOLTAGE_REQUESTED 0x00000040 -#define SYSTEM_CONFIG_CLMC_HYBRID_MODE_ENABLED 0x00000080 - -#define IGP_DDI_SLOT_LANE_CONFIG_MASK 0x000000FF - -#define b0IGP_DDI_SLOT_LANE_MAP_MASK 0x0F -#define b0IGP_DDI_SLOT_DOCKING_LANE_MAP_MASK 0xF0 -#define b0IGP_DDI_SLOT_CONFIG_LANE_0_3 0x01 -#define b0IGP_DDI_SLOT_CONFIG_LANE_4_7 0x02 -#define b0IGP_DDI_SLOT_CONFIG_LANE_8_11 0x04 -#define b0IGP_DDI_SLOT_CONFIG_LANE_12_15 0x08 - -#define IGP_DDI_SLOT_ATTRIBUTE_MASK 0x0000FF00 -#define IGP_DDI_SLOT_CONFIG_REVERSED 0x00000100 -#define b1IGP_DDI_SLOT_CONFIG_REVERSED 0x01 - -#define IGP_DDI_SLOT_CONNECTOR_TYPE_MASK 0x00FF0000 - -#define ATOM_CRT_INT_ENCODER1_INDEX 0x00000000 -#define ATOM_LCD_INT_ENCODER1_INDEX 0x00000001 -#define ATOM_TV_INT_ENCODER1_INDEX 0x00000002 -#define ATOM_DFP_INT_ENCODER1_INDEX 0x00000003 -#define ATOM_CRT_INT_ENCODER2_INDEX 0x00000004 -#define ATOM_LCD_EXT_ENCODER1_INDEX 0x00000005 -#define ATOM_TV_EXT_ENCODER1_INDEX 0x00000006 -#define ATOM_DFP_EXT_ENCODER1_INDEX 0x00000007 -#define ATOM_CV_INT_ENCODER1_INDEX 0x00000008 -#define ATOM_DFP_INT_ENCODER2_INDEX 0x00000009 -#define ATOM_CRT_EXT_ENCODER1_INDEX 0x0000000A -#define ATOM_CV_EXT_ENCODER1_INDEX 0x0000000B -#define ATOM_DFP_INT_ENCODER3_INDEX 0x0000000C -#define ATOM_DFP_INT_ENCODER4_INDEX 0x0000000D - -// define ASIC internal encoder id ( bit vector ) -#define ASIC_INT_DAC1_ENCODER_ID 0x00 -#define ASIC_INT_TV_ENCODER_ID 0x02 -#define ASIC_INT_DIG1_ENCODER_ID 0x03 -#define ASIC_INT_DAC2_ENCODER_ID 0x04 -#define ASIC_EXT_TV_ENCODER_ID 0x06 -#define ASIC_INT_DVO_ENCODER_ID 0x07 -#define ASIC_INT_DIG2_ENCODER_ID 0x09 -#define ASIC_EXT_DIG_ENCODER_ID 0x05 - -//define Encoder attribute -#define ATOM_ANALOG_ENCODER 0 -#define ATOM_DIGITAL_ENCODER 1 - -#define ATOM_DEVICE_CRT1_INDEX 0x00000000 -#define ATOM_DEVICE_LCD1_INDEX 0x00000001 -#define ATOM_DEVICE_TV1_INDEX 0x00000002 -#define ATOM_DEVICE_DFP1_INDEX 0x00000003 -#define ATOM_DEVICE_CRT2_INDEX 0x00000004 -#define ATOM_DEVICE_LCD2_INDEX 0x00000005 -#define ATOM_DEVICE_TV2_INDEX 0x00000006 -#define ATOM_DEVICE_DFP2_INDEX 0x00000007 -#define ATOM_DEVICE_CV_INDEX 0x00000008 -#define ATOM_DEVICE_DFP3_INDEX 0x00000009 -#define ATOM_DEVICE_DFP4_INDEX 0x0000000A -#define ATOM_DEVICE_DFP5_INDEX 0x0000000B -#define ATOM_DEVICE_RESERVEDC_INDEX 0x0000000C -#define ATOM_DEVICE_RESERVEDD_INDEX 0x0000000D -#define ATOM_DEVICE_RESERVEDE_INDEX 0x0000000E -#define ATOM_DEVICE_RESERVEDF_INDEX 0x0000000F -#define ATOM_MAX_SUPPORTED_DEVICE_INFO (ATOM_DEVICE_DFP3_INDEX+1) -#define ATOM_MAX_SUPPORTED_DEVICE_INFO_2 ATOM_MAX_SUPPORTED_DEVICE_INFO -#define ATOM_MAX_SUPPORTED_DEVICE_INFO_3 (ATOM_DEVICE_DFP5_INDEX + 1 ) - -#define ATOM_MAX_SUPPORTED_DEVICE (ATOM_DEVICE_RESERVEDF_INDEX+1) - -#define ATOM_DEVICE_CRT1_SUPPORT (0x1L << ATOM_DEVICE_CRT1_INDEX ) -#define ATOM_DEVICE_LCD1_SUPPORT (0x1L << ATOM_DEVICE_LCD1_INDEX ) -#define ATOM_DEVICE_TV1_SUPPORT (0x1L << ATOM_DEVICE_TV1_INDEX ) -#define ATOM_DEVICE_DFP1_SUPPORT (0x1L << ATOM_DEVICE_DFP1_INDEX) -#define ATOM_DEVICE_CRT2_SUPPORT (0x1L << ATOM_DEVICE_CRT2_INDEX ) -#define ATOM_DEVICE_LCD2_SUPPORT (0x1L << ATOM_DEVICE_LCD2_INDEX ) -#define ATOM_DEVICE_TV2_SUPPORT (0x1L << ATOM_DEVICE_TV2_INDEX ) -#define ATOM_DEVICE_DFP2_SUPPORT (0x1L << ATOM_DEVICE_DFP2_INDEX) -#define ATOM_DEVICE_CV_SUPPORT (0x1L << ATOM_DEVICE_CV_INDEX ) -#define ATOM_DEVICE_DFP3_SUPPORT (0x1L << ATOM_DEVICE_DFP3_INDEX ) -#define ATOM_DEVICE_DFP4_SUPPORT (0x1L << ATOM_DEVICE_DFP4_INDEX ) -#define ATOM_DEVICE_DFP5_SUPPORT (0x1L << ATOM_DEVICE_DFP5_INDEX ) - -#define ATOM_DEVICE_CRT_SUPPORT ATOM_DEVICE_CRT1_SUPPORT | ATOM_DEVICE_CRT2_SUPPORT -#define ATOM_DEVICE_DFP_SUPPORT ATOM_DEVICE_DFP1_SUPPORT | ATOM_DEVICE_DFP2_SUPPORT | ATOM_DEVICE_DFP3_SUPPORT | ATOM_DEVICE_DFP4_SUPPORT | ATOM_DEVICE_DFP5_SUPPORT -#define ATOM_DEVICE_TV_SUPPORT ATOM_DEVICE_TV1_SUPPORT | ATOM_DEVICE_TV2_SUPPORT -#define ATOM_DEVICE_LCD_SUPPORT ATOM_DEVICE_LCD1_SUPPORT | ATOM_DEVICE_LCD2_SUPPORT - -#define ATOM_DEVICE_CONNECTOR_TYPE_MASK 0x000000F0 -#define ATOM_DEVICE_CONNECTOR_TYPE_SHIFT 0x00000004 -#define ATOM_DEVICE_CONNECTOR_VGA 0x00000001 -#define ATOM_DEVICE_CONNECTOR_DVI_I 0x00000002 -#define ATOM_DEVICE_CONNECTOR_DVI_D 0x00000003 -#define ATOM_DEVICE_CONNECTOR_DVI_A 0x00000004 -#define ATOM_DEVICE_CONNECTOR_SVIDEO 0x00000005 -#define ATOM_DEVICE_CONNECTOR_COMPOSITE 0x00000006 -#define ATOM_DEVICE_CONNECTOR_LVDS 0x00000007 -#define ATOM_DEVICE_CONNECTOR_DIGI_LINK 0x00000008 -#define ATOM_DEVICE_CONNECTOR_SCART 0x00000009 -#define ATOM_DEVICE_CONNECTOR_HDMI_TYPE_A 0x0000000A -#define ATOM_DEVICE_CONNECTOR_HDMI_TYPE_B 0x0000000B -#define ATOM_DEVICE_CONNECTOR_CASE_1 0x0000000E -#define ATOM_DEVICE_CONNECTOR_DISPLAYPORT 0x0000000F - - -#define ATOM_DEVICE_DAC_INFO_MASK 0x0000000F -#define ATOM_DEVICE_DAC_INFO_SHIFT 0x00000000 -#define ATOM_DEVICE_DAC_INFO_NODAC 0x00000000 -#define ATOM_DEVICE_DAC_INFO_DACA 0x00000001 -#define ATOM_DEVICE_DAC_INFO_DACB 0x00000002 -#define ATOM_DEVICE_DAC_INFO_EXDAC 0x00000003 - -#define ATOM_DEVICE_I2C_ID_NOI2C 0x00000000 - -#define ATOM_DEVICE_I2C_LINEMUX_MASK 0x0000000F -#define ATOM_DEVICE_I2C_LINEMUX_SHIFT 0x00000000 - -#define ATOM_DEVICE_I2C_ID_MASK 0x00000070 -#define ATOM_DEVICE_I2C_ID_SHIFT 0x00000004 -#define ATOM_DEVICE_I2C_ID_IS_FOR_NON_MM_USE 0x00000001 -#define ATOM_DEVICE_I2C_ID_IS_FOR_MM_USE 0x00000002 -#define ATOM_DEVICE_I2C_ID_IS_FOR_SDVO_USE 0x00000003 //For IGP RS600 -#define ATOM_DEVICE_I2C_ID_IS_FOR_DAC_SCL 0x00000004 //For IGP RS690 - -#define ATOM_DEVICE_I2C_HARDWARE_CAP_MASK 0x00000080 -#define ATOM_DEVICE_I2C_HARDWARE_CAP_SHIFT 0x00000007 -#define ATOM_DEVICE_USES_SOFTWARE_ASSISTED_I2C 0x00000000 -#define ATOM_DEVICE_USES_HARDWARE_ASSISTED_I2C 0x00000001 - -// usDeviceSupport: -// Bits0 = 0 - no CRT1 support= 1- CRT1 is supported -// Bit 1 = 0 - no LCD1 support= 1- LCD1 is supported -// Bit 2 = 0 - no TV1 support= 1- TV1 is supported -// Bit 3 = 0 - no DFP1 support= 1- DFP1 is supported -// Bit 4 = 0 - no CRT2 support= 1- CRT2 is supported -// Bit 5 = 0 - no LCD2 support= 1- LCD2 is supported -// Bit 6 = 0 - no TV2 support= 1- TV2 is supported -// Bit 7 = 0 - no DFP2 support= 1- DFP2 is supported -// Bit 8 = 0 - no CV support= 1- CV is supported -// Bit 9 = 0 - no DFP3 support= 1- DFP3 is supported -// Byte1 (Supported Device Info) -// Bit 0 = = 0 - no CV support= 1- CV is supported -// -// - -// ucI2C_ConfigID -// [7:0] - I2C LINE Associate ID -// = 0 - no I2C -// [7] - HW_Cap = 1, [6:0]=HW assisted I2C ID(HW line selection) -// = 0, [6:0]=SW assisted I2C ID -// [6-4] - HW_ENGINE_ID = 1, HW engine for NON multimedia use -// = 2, HW engine for Multimedia use -// = 3-7 Reserved for future I2C engines -// [3-0] - I2C_LINE_MUX = A Mux number when it's HW assisted I2C or GPIO ID when it's SW I2C - -typedef struct _ATOM_I2C_ID_CONFIG -{ - UCHAR bfI2C_LineMux:4; - UCHAR bfHW_EngineID:3; - UCHAR bfHW_Capable:1; -}ATOM_I2C_ID_CONFIG; - -typedef union _ATOM_I2C_ID_CONFIG_ACCESS -{ - ATOM_I2C_ID_CONFIG sbfAccess; - UCHAR ucAccess; -}ATOM_I2C_ID_CONFIG_ACCESS; - -/****************************************************************************/ -// Structure used in GPIO_I2C_InfoTable -/****************************************************************************/ -typedef struct _ATOM_GPIO_I2C_ASSIGMENT -{ - USHORT usClkMaskRegisterIndex; - USHORT usClkEnRegisterIndex; - USHORT usClkY_RegisterIndex; - USHORT usClkA_RegisterIndex; - USHORT usDataMaskRegisterIndex; - USHORT usDataEnRegisterIndex; - USHORT usDataY_RegisterIndex; - USHORT usDataA_RegisterIndex; - ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; - UCHAR ucClkMaskShift; - UCHAR ucClkEnShift; - UCHAR ucClkY_Shift; - UCHAR ucClkA_Shift; - UCHAR ucDataMaskShift; - UCHAR ucDataEnShift; - UCHAR ucDataY_Shift; - UCHAR ucDataA_Shift; - UCHAR ucReserved1; - UCHAR ucReserved2; -}ATOM_GPIO_I2C_ASSIGMENT; - -typedef struct _ATOM_GPIO_I2C_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_GPIO_I2C_ASSIGMENT asGPIO_Info[ATOM_MAX_SUPPORTED_DEVICE]; -}ATOM_GPIO_I2C_INFO; - -/****************************************************************************/ -// Common Structure used in other structures -/****************************************************************************/ - -#ifndef _H2INC - -//Please don't add or expand this bitfield structure below, this one will retire soon.! -typedef struct _ATOM_MODE_MISC_INFO -{ - USHORT HorizontalCutOff:1; - USHORT HSyncPolarity:1; //0=Active High, 1=Active Low - USHORT VSyncPolarity:1; //0=Active High, 1=Active Low - USHORT VerticalCutOff:1; - USHORT H_ReplicationBy2:1; - USHORT V_ReplicationBy2:1; - USHORT CompositeSync:1; - USHORT Interlace:1; - USHORT DoubleClock:1; - USHORT RGB888:1; - USHORT Reserved:6; -}ATOM_MODE_MISC_INFO; - -typedef union _ATOM_MODE_MISC_INFO_ACCESS -{ - ATOM_MODE_MISC_INFO sbfAccess; - USHORT usAccess; -}ATOM_MODE_MISC_INFO_ACCESS; - -#else - -typedef union _ATOM_MODE_MISC_INFO_ACCESS -{ - USHORT usAccess; -}ATOM_MODE_MISC_INFO_ACCESS; - -#endif - -// usModeMiscInfo- -#define ATOM_H_CUTOFF 0x01 -#define ATOM_HSYNC_POLARITY 0x02 //0=Active High, 1=Active Low -#define ATOM_VSYNC_POLARITY 0x04 //0=Active High, 1=Active Low -#define ATOM_V_CUTOFF 0x08 -#define ATOM_H_REPLICATIONBY2 0x10 -#define ATOM_V_REPLICATIONBY2 0x20 -#define ATOM_COMPOSITESYNC 0x40 -#define ATOM_INTERLACE 0x80 -#define ATOM_DOUBLE_CLOCK_MODE 0x100 -#define ATOM_RGB888_MODE 0x200 - -//usRefreshRate- -#define ATOM_REFRESH_43 43 -#define ATOM_REFRESH_47 47 -#define ATOM_REFRESH_56 56 -#define ATOM_REFRESH_60 60 -#define ATOM_REFRESH_65 65 -#define ATOM_REFRESH_70 70 -#define ATOM_REFRESH_72 72 -#define ATOM_REFRESH_75 75 -#define ATOM_REFRESH_85 85 - -// ATOM_MODE_TIMING data are exactly the same as VESA timing data. -// Translation from EDID to ATOM_MODE_TIMING, use the following formula. -// -// VESA_HTOTAL = VESA_ACTIVE + 2* VESA_BORDER + VESA_BLANK -// = EDID_HA + EDID_HBL -// VESA_HDISP = VESA_ACTIVE = EDID_HA -// VESA_HSYNC_START = VESA_ACTIVE + VESA_BORDER + VESA_FRONT_PORCH -// = EDID_HA + EDID_HSO -// VESA_HSYNC_WIDTH = VESA_HSYNC_TIME = EDID_HSPW -// VESA_BORDER = EDID_BORDER - -/****************************************************************************/ -// Structure used in SetCRTC_UsingDTDTimingTable -/****************************************************************************/ -typedef struct _SET_CRTC_USING_DTD_TIMING_PARAMETERS -{ - USHORT usH_Size; - USHORT usH_Blanking_Time; - USHORT usV_Size; - USHORT usV_Blanking_Time; - USHORT usH_SyncOffset; - USHORT usH_SyncWidth; - USHORT usV_SyncOffset; - USHORT usV_SyncWidth; - ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo; - UCHAR ucH_Border; // From DFP EDID - UCHAR ucV_Border; - UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 - UCHAR ucPadding[3]; -}SET_CRTC_USING_DTD_TIMING_PARAMETERS; - -/****************************************************************************/ -// Structure used in SetCRTC_TimingTable -/****************************************************************************/ -typedef struct _SET_CRTC_TIMING_PARAMETERS -{ - USHORT usH_Total; // horizontal total - USHORT usH_Disp; // horizontal display - USHORT usH_SyncStart; // horozontal Sync start - USHORT usH_SyncWidth; // horizontal Sync width - USHORT usV_Total; // vertical total - USHORT usV_Disp; // vertical display - USHORT usV_SyncStart; // vertical Sync start - USHORT usV_SyncWidth; // vertical Sync width - ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo; - UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 - UCHAR ucOverscanRight; // right - UCHAR ucOverscanLeft; // left - UCHAR ucOverscanBottom; // bottom - UCHAR ucOverscanTop; // top - UCHAR ucReserved; -}SET_CRTC_TIMING_PARAMETERS; -#define SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION SET_CRTC_TIMING_PARAMETERS - -/****************************************************************************/ -// Structure used in StandardVESA_TimingTable -// AnalogTV_InfoTable -// ComponentVideoInfoTable -/****************************************************************************/ -typedef struct _ATOM_MODE_TIMING -{ - USHORT usCRTC_H_Total; - USHORT usCRTC_H_Disp; - USHORT usCRTC_H_SyncStart; - USHORT usCRTC_H_SyncWidth; - USHORT usCRTC_V_Total; - USHORT usCRTC_V_Disp; - USHORT usCRTC_V_SyncStart; - USHORT usCRTC_V_SyncWidth; - USHORT usPixelClock; //in 10Khz unit - ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo; - USHORT usCRTC_OverscanRight; - USHORT usCRTC_OverscanLeft; - USHORT usCRTC_OverscanBottom; - USHORT usCRTC_OverscanTop; - USHORT usReserve; - UCHAR ucInternalModeNumber; - UCHAR ucRefreshRate; -}ATOM_MODE_TIMING; - -typedef struct _ATOM_DTD_FORMAT -{ - USHORT usPixClk; - USHORT usHActive; - USHORT usHBlanking_Time; - USHORT usVActive; - USHORT usVBlanking_Time; - USHORT usHSyncOffset; - USHORT usHSyncWidth; - USHORT usVSyncOffset; - USHORT usVSyncWidth; - USHORT usImageHSize; - USHORT usImageVSize; - UCHAR ucHBorder; - UCHAR ucVBorder; - ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo; - UCHAR ucInternalModeNumber; - UCHAR ucRefreshRate; -}ATOM_DTD_FORMAT; - -/****************************************************************************/ -// Structure used in LVDS_InfoTable -// * Need a document to describe this table -/****************************************************************************/ -#define SUPPORTED_LCD_REFRESHRATE_30Hz 0x0004 -#define SUPPORTED_LCD_REFRESHRATE_40Hz 0x0008 -#define SUPPORTED_LCD_REFRESHRATE_50Hz 0x0010 -#define SUPPORTED_LCD_REFRESHRATE_60Hz 0x0020 - -//Once DAL sees this CAP is set, it will read EDID from LCD on its own instead of using sLCDTiming in ATOM_LVDS_INFO_V12. -//Other entries in ATOM_LVDS_INFO_V12 are still valid/useful to DAL -#define LCDPANEL_CAP_READ_EDID 0x1 - -//ucTableFormatRevision=1 -//ucTableContentRevision=1 -typedef struct _ATOM_LVDS_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_DTD_FORMAT sLCDTiming; - USHORT usModePatchTableOffset; - USHORT usSupportedRefreshRate; //Refer to panel info table in ATOMBIOS extension Spec. - USHORT usOffDelayInMs; - UCHAR ucPowerSequenceDigOntoDEin10Ms; - UCHAR ucPowerSequenceDEtoBLOnin10Ms; - UCHAR ucLVDS_Misc; // Bit0:{=0:single, =1:dual},Bit1 {=0:666RGB, =1:888RGB},Bit2:3:{Grey level} - // Bit4:{=0:LDI format for RGB888, =1 FPDI format for RGB888} - // Bit5:{=0:Spatial Dithering disabled;1 Spatial Dithering enabled} - // Bit6:{=0:Temporal Dithering disabled;1 Temporal Dithering enabled} - UCHAR ucPanelDefaultRefreshRate; - UCHAR ucPanelIdentification; - UCHAR ucSS_Id; -}ATOM_LVDS_INFO; - -//ucTableFormatRevision=1 -//ucTableContentRevision=2 -typedef struct _ATOM_LVDS_INFO_V12 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_DTD_FORMAT sLCDTiming; - USHORT usExtInfoTableOffset; - USHORT usSupportedRefreshRate; //Refer to panel info table in ATOMBIOS extension Spec. - USHORT usOffDelayInMs; - UCHAR ucPowerSequenceDigOntoDEin10Ms; - UCHAR ucPowerSequenceDEtoBLOnin10Ms; - UCHAR ucLVDS_Misc; // Bit0:{=0:single, =1:dual},Bit1 {=0:666RGB, =1:888RGB},Bit2:3:{Grey level} - // Bit4:{=0:LDI format for RGB888, =1 FPDI format for RGB888} - // Bit5:{=0:Spatial Dithering disabled;1 Spatial Dithering enabled} - // Bit6:{=0:Temporal Dithering disabled;1 Temporal Dithering enabled} - UCHAR ucPanelDefaultRefreshRate; - UCHAR ucPanelIdentification; - UCHAR ucSS_Id; - USHORT usLCDVenderID; - USHORT usLCDProductID; - UCHAR ucLCDPanel_SpecialHandlingCap; - UCHAR ucPanelInfoSize; // start from ATOM_DTD_FORMAT to end of panel info, include ExtInfoTable - UCHAR ucReserved[2]; -}ATOM_LVDS_INFO_V12; - -#define ATOM_LVDS_INFO_LAST ATOM_LVDS_INFO_V12 - -typedef struct _ATOM_PATCH_RECORD_MODE -{ - UCHAR ucRecordType; - USHORT usHDisp; - USHORT usVDisp; -}ATOM_PATCH_RECORD_MODE; - -typedef struct _ATOM_LCD_RTS_RECORD -{ - UCHAR ucRecordType; - UCHAR ucRTSValue; -}ATOM_LCD_RTS_RECORD; - -//!! If the record below exits, it shoud always be the first record for easy use in command table!!! -typedef struct _ATOM_LCD_MODE_CONTROL_CAP -{ - UCHAR ucRecordType; - USHORT usLCDCap; -}ATOM_LCD_MODE_CONTROL_CAP; - -#define LCD_MODE_CAP_BL_OFF 1 -#define LCD_MODE_CAP_CRTC_OFF 2 -#define LCD_MODE_CAP_PANEL_OFF 4 - -typedef struct _ATOM_FAKE_EDID_PATCH_RECORD -{ - UCHAR ucRecordType; - UCHAR ucFakeEDIDLength; - UCHAR ucFakeEDIDString[1]; // This actually has ucFakeEdidLength elements. -} ATOM_FAKE_EDID_PATCH_RECORD; - -typedef struct _ATOM_PANEL_RESOLUTION_PATCH_RECORD -{ - UCHAR ucRecordType; - USHORT usHSize; - USHORT usVSize; -}ATOM_PANEL_RESOLUTION_PATCH_RECORD; - -#define LCD_MODE_PATCH_RECORD_MODE_TYPE 1 -#define LCD_RTS_RECORD_TYPE 2 -#define LCD_CAP_RECORD_TYPE 3 -#define LCD_FAKE_EDID_PATCH_RECORD_TYPE 4 -#define LCD_PANEL_RESOLUTION_RECORD_TYPE 5 -#define ATOM_RECORD_END_TYPE 0xFF - -/****************************Spread Spectrum Info Table Definitions **********************/ - -//ucTableFormatRevision=1 -//ucTableContentRevision=2 -typedef struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT -{ - USHORT usSpreadSpectrumPercentage; - UCHAR ucSpreadSpectrumType; //Bit1=0 Down Spread,=1 Center Spread. Bit1=1 Ext. =0 Int. Others:TBD - UCHAR ucSS_Step; - UCHAR ucSS_Delay; - UCHAR ucSS_Id; - UCHAR ucRecommandedRef_Div; - UCHAR ucSS_Range; //it was reserved for V11 -}ATOM_SPREAD_SPECTRUM_ASSIGNMENT; - -#define ATOM_MAX_SS_ENTRY 16 -#define ATOM_DP_SS_ID1 0x0f1 // SS modulation freq=30k -#define ATOM_DP_SS_ID2 0x0f2 // SS modulation freq=33k - - -#define ATOM_SS_DOWN_SPREAD_MODE_MASK 0x00000000 -#define ATOM_SS_DOWN_SPREAD_MODE 0x00000000 -#define ATOM_SS_CENTRE_SPREAD_MODE_MASK 0x00000001 -#define ATOM_SS_CENTRE_SPREAD_MODE 0x00000001 -#define ATOM_INTERNAL_SS_MASK 0x00000000 -#define ATOM_EXTERNAL_SS_MASK 0x00000002 -#define EXEC_SS_STEP_SIZE_SHIFT 2 -#define EXEC_SS_DELAY_SHIFT 4 -#define ACTIVEDATA_TO_BLON_DELAY_SHIFT 4 - -typedef struct _ATOM_SPREAD_SPECTRUM_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_SPREAD_SPECTRUM_ASSIGNMENT asSS_Info[ATOM_MAX_SS_ENTRY]; -}ATOM_SPREAD_SPECTRUM_INFO; - -/****************************************************************************/ -// Structure used in AnalogTV_InfoTable (Top level) -/****************************************************************************/ -//ucTVBootUpDefaultStd definiton: - -//ATOM_TV_NTSC 1 -//ATOM_TV_NTSCJ 2 -//ATOM_TV_PAL 3 -//ATOM_TV_PALM 4 -//ATOM_TV_PALCN 5 -//ATOM_TV_PALN 6 -//ATOM_TV_PAL60 7 -//ATOM_TV_SECAM 8 - -//ucTVSuppportedStd definition: -#define NTSC_SUPPORT 0x1 -#define NTSCJ_SUPPORT 0x2 - -#define PAL_SUPPORT 0x4 -#define PALM_SUPPORT 0x8 -#define PALCN_SUPPORT 0x10 -#define PALN_SUPPORT 0x20 -#define PAL60_SUPPORT 0x40 -#define SECAM_SUPPORT 0x80 - -#define MAX_SUPPORTED_TV_TIMING 2 - -typedef struct _ATOM_ANALOG_TV_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR ucTV_SupportedStandard; - UCHAR ucTV_BootUpDefaultStandard; - UCHAR ucExt_TV_ASIC_ID; - UCHAR ucExt_TV_ASIC_SlaveAddr; -/* ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING]; */ - ATOM_MODE_TIMING aModeTimings[MAX_SUPPORTED_TV_TIMING]; -}ATOM_ANALOG_TV_INFO; - - -/**************************************************************************/ -// VRAM usage and their defintions - -// One chunk of VRAM used by Bios are for HWICON surfaces,EDID data. -// Current Mode timing and Dail Timing and/or STD timing data EACH device. They can be broken down as below. -// All the addresses below are the offsets from the frame buffer start.They all MUST be Dword aligned! -// To driver: The physical address of this memory portion=mmFB_START(4K aligned)+ATOMBIOS_VRAM_USAGE_START_ADDR+ATOM_x_ADDR -// To Bios: ATOMBIOS_VRAM_USAGE_START_ADDR+ATOM_x_ADDR->MM_INDEX - -#ifndef VESA_MEMORY_IN_64K_BLOCK -#define VESA_MEMORY_IN_64K_BLOCK 0x100 //256*64K=16Mb (Max. VESA memory is 16Mb!) -#endif - -#define ATOM_EDID_RAW_DATASIZE 256 //In Bytes -#define ATOM_HWICON_SURFACE_SIZE 4096 //In Bytes -#define ATOM_HWICON_INFOTABLE_SIZE 32 -#define MAX_DTD_MODE_IN_VRAM 6 -#define ATOM_DTD_MODE_SUPPORT_TBL_SIZE (MAX_DTD_MODE_IN_VRAM*28) //28= (SIZEOF ATOM_DTD_FORMAT) -#define ATOM_STD_MODE_SUPPORT_TBL_SIZE 32*8 //32 is a predefined number,8= (SIZEOF ATOM_STD_FORMAT) -#define DFP_ENCODER_TYPE_OFFSET 0x80 -#define DP_ENCODER_LANE_NUM_OFFSET 0x84 -#define DP_ENCODER_LINK_RATE_OFFSET 0x88 - -#define ATOM_HWICON1_SURFACE_ADDR 0 -#define ATOM_HWICON2_SURFACE_ADDR (ATOM_HWICON1_SURFACE_ADDR + ATOM_HWICON_SURFACE_SIZE) -#define ATOM_HWICON_INFOTABLE_ADDR (ATOM_HWICON2_SURFACE_ADDR + ATOM_HWICON_SURFACE_SIZE) -#define ATOM_CRT1_EDID_ADDR (ATOM_HWICON_INFOTABLE_ADDR + ATOM_HWICON_INFOTABLE_SIZE) -#define ATOM_CRT1_DTD_MODE_TBL_ADDR (ATOM_CRT1_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_CRT1_STD_MODE_TBL_ADDR (ATOM_CRT1_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_LCD1_EDID_ADDR (ATOM_CRT1_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_LCD1_DTD_MODE_TBL_ADDR (ATOM_LCD1_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_LCD1_STD_MODE_TBL_ADDR (ATOM_LCD1_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_TV1_DTD_MODE_TBL_ADDR (ATOM_LCD1_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_DFP1_EDID_ADDR (ATOM_TV1_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_DFP1_DTD_MODE_TBL_ADDR (ATOM_DFP1_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_DFP1_STD_MODE_TBL_ADDR (ATOM_DFP1_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_CRT2_EDID_ADDR (ATOM_DFP1_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_CRT2_DTD_MODE_TBL_ADDR (ATOM_CRT2_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_CRT2_STD_MODE_TBL_ADDR (ATOM_CRT2_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_LCD2_EDID_ADDR (ATOM_CRT2_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_LCD2_DTD_MODE_TBL_ADDR (ATOM_LCD2_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_LCD2_STD_MODE_TBL_ADDR (ATOM_LCD2_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_TV2_EDID_ADDR (ATOM_LCD2_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_TV2_DTD_MODE_TBL_ADDR (ATOM_TV2_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_TV2_STD_MODE_TBL_ADDR (ATOM_TV2_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_DFP2_EDID_ADDR (ATOM_TV2_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_DFP2_DTD_MODE_TBL_ADDR (ATOM_DFP2_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_DFP2_STD_MODE_TBL_ADDR (ATOM_DFP2_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_CV_EDID_ADDR (ATOM_DFP2_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_CV_DTD_MODE_TBL_ADDR (ATOM_CV_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_CV_STD_MODE_TBL_ADDR (ATOM_CV_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_DFP3_EDID_ADDR (ATOM_CV_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_DFP3_DTD_MODE_TBL_ADDR (ATOM_DFP3_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_DFP3_STD_MODE_TBL_ADDR (ATOM_DFP3_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_DFP4_EDID_ADDR (ATOM_DFP3_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_DFP4_DTD_MODE_TBL_ADDR (ATOM_DFP4_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_DFP4_STD_MODE_TBL_ADDR (ATOM_DFP4_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_DFP5_EDID_ADDR (ATOM_DFP4_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) -#define ATOM_DFP5_DTD_MODE_TBL_ADDR (ATOM_DFP5_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) -#define ATOM_DFP5_STD_MODE_TBL_ADDR (ATOM_DFP5_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_DP_TRAINING_TBL_ADDR (ATOM_DFP5_STD_MODE_TBL_ADDR+ATOM_STD_MODE_SUPPORT_TBL_SIZE) - -#define ATOM_STACK_STORAGE_START (ATOM_DP_TRAINING_TBL_ADDR+256) -#define ATOM_STACK_STORAGE_END ATOM_STACK_STORAGE_START+512 - -//The size below is in Kb! -#define ATOM_VRAM_RESERVE_SIZE ((((ATOM_STACK_STORAGE_END - ATOM_HWICON1_SURFACE_ADDR)>>10)+4)&0xFFFC) - -#define ATOM_VRAM_OPERATION_FLAGS_MASK 0xC0000000L -#define ATOM_VRAM_OPERATION_FLAGS_SHIFT 30 -#define ATOM_VRAM_BLOCK_NEEDS_NO_RESERVATION 0x1 -#define ATOM_VRAM_BLOCK_NEEDS_RESERVATION 0x0 - -/***********************************************************************************/ -// Structure used in VRAM_UsageByFirmwareTable -// Note1: This table is filled by SetBiosReservationStartInFB in CoreCommSubs.asm -// at running time. -// note2: From RV770, the memory is more than 32bit addressable, so we will change -// ucTableFormatRevision=1,ucTableContentRevision=4, the strcuture remains -// exactly same as 1.1 and 1.2 (1.3 is never in use), but ulStartAddrUsedByFirmware -// (in offset to start of memory address) is KB aligned instead of byte aligend. -/***********************************************************************************/ -#define ATOM_MAX_FIRMWARE_VRAM_USAGE_INFO 1 - -typedef struct _ATOM_FIRMWARE_VRAM_RESERVE_INFO -{ - ULONG ulStartAddrUsedByFirmware; - USHORT usFirmwareUseInKb; - USHORT usReserved; -}ATOM_FIRMWARE_VRAM_RESERVE_INFO; - -typedef struct _ATOM_VRAM_USAGE_BY_FIRMWARE -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_FIRMWARE_VRAM_RESERVE_INFO asFirmwareVramReserveInfo[ATOM_MAX_FIRMWARE_VRAM_USAGE_INFO]; -}ATOM_VRAM_USAGE_BY_FIRMWARE; - -/****************************************************************************/ -// Structure used in GPIO_Pin_LUTTable -/****************************************************************************/ -typedef struct _ATOM_GPIO_PIN_ASSIGNMENT -{ - USHORT usGpioPin_AIndex; - UCHAR ucGpioPinBitShift; - UCHAR ucGPIO_ID; -}ATOM_GPIO_PIN_ASSIGNMENT; - -typedef struct _ATOM_GPIO_PIN_LUT -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_GPIO_PIN_ASSIGNMENT asGPIO_Pin[1]; -}ATOM_GPIO_PIN_LUT; - -/****************************************************************************/ -// Structure used in ComponentVideoInfoTable -/****************************************************************************/ -#define GPIO_PIN_ACTIVE_HIGH 0x1 - -#define MAX_SUPPORTED_CV_STANDARDS 5 - -// definitions for ATOM_D_INFO.ucSettings -#define ATOM_GPIO_SETTINGS_BITSHIFT_MASK 0x1F // [4:0] -#define ATOM_GPIO_SETTINGS_RESERVED_MASK 0x60 // [6:5] = must be zeroed out -#define ATOM_GPIO_SETTINGS_ACTIVE_MASK 0x80 // [7] - -typedef struct _ATOM_GPIO_INFO -{ - USHORT usAOffset; - UCHAR ucSettings; - UCHAR ucReserved; -}ATOM_GPIO_INFO; - -// definitions for ATOM_COMPONENT_VIDEO_INFO.ucMiscInfo (bit vector) -#define ATOM_CV_RESTRICT_FORMAT_SELECTION 0x2 - -// definitions for ATOM_COMPONENT_VIDEO_INFO.uc480i/uc480p/uc720p/uc1080i -#define ATOM_GPIO_DEFAULT_MODE_EN 0x80 //[7]; -#define ATOM_GPIO_SETTING_PERMODE_MASK 0x7F //[6:0] - -// definitions for ATOM_COMPONENT_VIDEO_INFO.ucLetterBoxMode -//Line 3 out put 5V. -#define ATOM_CV_LINE3_ASPECTRATIO_16_9_GPIO_A 0x01 //represent gpio 3 state for 16:9 -#define ATOM_CV_LINE3_ASPECTRATIO_16_9_GPIO_B 0x02 //represent gpio 4 state for 16:9 -#define ATOM_CV_LINE3_ASPECTRATIO_16_9_GPIO_SHIFT 0x0 - -//Line 3 out put 2.2V -#define ATOM_CV_LINE3_ASPECTRATIO_4_3_LETBOX_GPIO_A 0x04 //represent gpio 3 state for 4:3 Letter box -#define ATOM_CV_LINE3_ASPECTRATIO_4_3_LETBOX_GPIO_B 0x08 //represent gpio 4 state for 4:3 Letter box -#define ATOM_CV_LINE3_ASPECTRATIO_4_3_LETBOX_GPIO_SHIFT 0x2 - -//Line 3 out put 0V -#define ATOM_CV_LINE3_ASPECTRATIO_4_3_GPIO_A 0x10 //represent gpio 3 state for 4:3 -#define ATOM_CV_LINE3_ASPECTRATIO_4_3_GPIO_B 0x20 //represent gpio 4 state for 4:3 -#define ATOM_CV_LINE3_ASPECTRATIO_4_3_GPIO_SHIFT 0x4 - -#define ATOM_CV_LINE3_ASPECTRATIO_MASK 0x3F // bit [5:0] - -#define ATOM_CV_LINE3_ASPECTRATIO_EXIST 0x80 //bit 7 - -//GPIO bit index in gpio setting per mode value, also represend the block no. in gpio blocks. -#define ATOM_GPIO_INDEX_LINE3_ASPECRATIO_GPIO_A 3 //bit 3 in uc480i/uc480p/uc720p/uc1080i, which represend the default gpio bit setting for the mode. -#define ATOM_GPIO_INDEX_LINE3_ASPECRATIO_GPIO_B 4 //bit 4 in uc480i/uc480p/uc720p/uc1080i, which represend the default gpio bit setting for the mode. - - -typedef struct _ATOM_COMPONENT_VIDEO_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usMask_PinRegisterIndex; - USHORT usEN_PinRegisterIndex; - USHORT usY_PinRegisterIndex; - USHORT usA_PinRegisterIndex; - UCHAR ucBitShift; - UCHAR ucPinActiveState; //ucPinActiveState: Bit0=1 active high, =0 active low - ATOM_DTD_FORMAT sReserved; // must be zeroed out - UCHAR ucMiscInfo; - UCHAR uc480i; - UCHAR uc480p; - UCHAR uc720p; - UCHAR uc1080i; - UCHAR ucLetterBoxMode; - UCHAR ucReserved[3]; - UCHAR ucNumOfWbGpioBlocks; //For Component video D-Connector support. If zere, NTSC type connector - ATOM_GPIO_INFO aWbGpioStateBlock[MAX_SUPPORTED_CV_STANDARDS]; - ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_CV_STANDARDS]; -}ATOM_COMPONENT_VIDEO_INFO; - -//ucTableFormatRevision=2 -//ucTableContentRevision=1 -typedef struct _ATOM_COMPONENT_VIDEO_INFO_V21 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR ucMiscInfo; - UCHAR uc480i; - UCHAR uc480p; - UCHAR uc720p; - UCHAR uc1080i; - UCHAR ucReserved; - UCHAR ucLetterBoxMode; - UCHAR ucNumOfWbGpioBlocks; //For Component video D-Connector support. If zere, NTSC type connector - ATOM_GPIO_INFO aWbGpioStateBlock[MAX_SUPPORTED_CV_STANDARDS]; - ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_CV_STANDARDS]; -}ATOM_COMPONENT_VIDEO_INFO_V21; - -#define ATOM_COMPONENT_VIDEO_INFO_LAST ATOM_COMPONENT_VIDEO_INFO_V21 - -/****************************************************************************/ -// Structure used in object_InfoTable -/****************************************************************************/ -typedef struct _ATOM_OBJECT_HEADER -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usDeviceSupport; - USHORT usConnectorObjectTableOffset; - USHORT usRouterObjectTableOffset; - USHORT usEncoderObjectTableOffset; - USHORT usProtectionObjectTableOffset; //only available when Protection block is independent. - USHORT usDisplayPathTableOffset; -}ATOM_OBJECT_HEADER; - - -typedef struct _ATOM_DISPLAY_OBJECT_PATH -{ - USHORT usDeviceTag; //supported device - USHORT usSize; //the size of ATOM_DISPLAY_OBJECT_PATH - USHORT usConnObjectId; //Connector Object ID - USHORT usGPUObjectId; //GPU ID - USHORT usGraphicObjIds[1]; //1st Encoder Obj source from GPU to last Graphic Obj destinate to connector. -}ATOM_DISPLAY_OBJECT_PATH; - -typedef struct _ATOM_DISPLAY_OBJECT_PATH_TABLE -{ - UCHAR ucNumOfDispPath; - UCHAR ucVersion; - UCHAR ucPadding[2]; - ATOM_DISPLAY_OBJECT_PATH asDispPath[1]; -}ATOM_DISPLAY_OBJECT_PATH_TABLE; - - -typedef struct _ATOM_OBJECT //each object has this structure -{ - USHORT usObjectID; - USHORT usSrcDstTableOffset; - USHORT usRecordOffset; //this pointing to a bunch of records defined below - USHORT usReserved; -}ATOM_OBJECT; - -typedef struct _ATOM_OBJECT_TABLE //Above 4 object table offset pointing to a bunch of objects all have this structure -{ - UCHAR ucNumberOfObjects; - UCHAR ucPadding[3]; - ATOM_OBJECT asObjects[1]; -}ATOM_OBJECT_TABLE; - -typedef struct _ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT //usSrcDstTableOffset pointing to this structure -{ - UCHAR ucNumberOfSrc; - USHORT usSrcObjectID[1]; - UCHAR ucNumberOfDst; - USHORT usDstObjectID[1]; -}ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT; - - -//Related definitions, all records are differnt but they have a commond header -typedef struct _ATOM_COMMON_RECORD_HEADER -{ - UCHAR ucRecordType; //An emun to indicate the record type - UCHAR ucRecordSize; //The size of the whole record in byte -}ATOM_COMMON_RECORD_HEADER; - - -#define ATOM_I2C_RECORD_TYPE 1 -#define ATOM_HPD_INT_RECORD_TYPE 2 -#define ATOM_OUTPUT_PROTECTION_RECORD_TYPE 3 -#define ATOM_CONNECTOR_DEVICE_TAG_RECORD_TYPE 4 -#define ATOM_CONNECTOR_DVI_EXT_INPUT_RECORD_TYPE 5 //Obsolete, switch to use GPIO_CNTL_RECORD_TYPE -#define ATOM_ENCODER_FPGA_CONTROL_RECORD_TYPE 6 //Obsolete, switch to use GPIO_CNTL_RECORD_TYPE -#define ATOM_CONNECTOR_CVTV_SHARE_DIN_RECORD_TYPE 7 -#define ATOM_JTAG_RECORD_TYPE 8 //Obsolete, switch to use GPIO_CNTL_RECORD_TYPE -#define ATOM_OBJECT_GPIO_CNTL_RECORD_TYPE 9 -#define ATOM_ENCODER_DVO_CF_RECORD_TYPE 10 -#define ATOM_CONNECTOR_CF_RECORD_TYPE 11 -#define ATOM_CONNECTOR_HARDCODE_DTD_RECORD_TYPE 12 -#define ATOM_CONNECTOR_PCIE_SUBCONNECTOR_RECORD_TYPE 13 -#define ATOM_ROUTER_DDC_PATH_SELECT_RECORD_TYPE 14 -#define ATOM_ROUTER_DATA_CLOCK_PATH_SELECT_RECORD_TYPE 15 - -//Must be updated when new record type is added,equal to that record definition! -#define ATOM_MAX_OBJECT_RECORD_NUMBER ATOM_CONNECTOR_CF_RECORD_TYPE - -typedef struct _ATOM_I2C_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - ATOM_I2C_ID_CONFIG sucI2cId; - UCHAR ucI2CAddr; //The slave address, it's 0 when the record is attached to connector for DDC -}ATOM_I2C_RECORD; - -typedef struct _ATOM_HPD_INT_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucHPDIntGPIOID; //Corresponding block in GPIO_PIN_INFO table gives the pin info - UCHAR ucPluggged_PinState; -}ATOM_HPD_INT_RECORD; - - -typedef struct _ATOM_OUTPUT_PROTECTION_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucProtectionFlag; - UCHAR ucReserved; -}ATOM_OUTPUT_PROTECTION_RECORD; - -typedef struct _ATOM_CONNECTOR_DEVICE_TAG -{ - ULONG ulACPIDeviceEnum; //Reserved for now - USHORT usDeviceID; //This Id is same as "ATOM_DEVICE_XXX_SUPPORT" - USHORT usPadding; -}ATOM_CONNECTOR_DEVICE_TAG; - -typedef struct _ATOM_CONNECTOR_DEVICE_TAG_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucNumberOfDevice; - UCHAR ucReserved; - ATOM_CONNECTOR_DEVICE_TAG asDeviceTag[1]; //This Id is same as "ATOM_DEVICE_XXX_SUPPORT", 1 is only for allocation -}ATOM_CONNECTOR_DEVICE_TAG_RECORD; - - -typedef struct _ATOM_CONNECTOR_DVI_EXT_INPUT_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucConfigGPIOID; - UCHAR ucConfigGPIOState; //Set to 1 when it's active high to enable external flow in - UCHAR ucFlowinGPIPID; - UCHAR ucExtInGPIPID; -}ATOM_CONNECTOR_DVI_EXT_INPUT_RECORD; - -typedef struct _ATOM_ENCODER_FPGA_CONTROL_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucCTL1GPIO_ID; - UCHAR ucCTL1GPIOState; //Set to 1 when it's active high - UCHAR ucCTL2GPIO_ID; - UCHAR ucCTL2GPIOState; //Set to 1 when it's active high - UCHAR ucCTL3GPIO_ID; - UCHAR ucCTL3GPIOState; //Set to 1 when it's active high - UCHAR ucCTLFPGA_IN_ID; - UCHAR ucPadding[3]; -}ATOM_ENCODER_FPGA_CONTROL_RECORD; - -typedef struct _ATOM_CONNECTOR_CVTV_SHARE_DIN_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucGPIOID; //Corresponding block in GPIO_PIN_INFO table gives the pin info - UCHAR ucTVActiveState; //Indicating when the pin==0 or 1 when TV is connected -}ATOM_CONNECTOR_CVTV_SHARE_DIN_RECORD; - -typedef struct _ATOM_JTAG_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucTMSGPIO_ID; - UCHAR ucTMSGPIOState; //Set to 1 when it's active high - UCHAR ucTCKGPIO_ID; - UCHAR ucTCKGPIOState; //Set to 1 when it's active high - UCHAR ucTDOGPIO_ID; - UCHAR ucTDOGPIOState; //Set to 1 when it's active high - UCHAR ucTDIGPIO_ID; - UCHAR ucTDIGPIOState; //Set to 1 when it's active high - UCHAR ucPadding[2]; -}ATOM_JTAG_RECORD; - - -//The following generic object gpio pin control record type will replace JTAG_RECORD/FPGA_CONTROL_RECORD/DVI_EXT_INPUT_RECORD above gradually -typedef struct _ATOM_GPIO_PIN_CONTROL_PAIR -{ - UCHAR ucGPIOID; // GPIO_ID, find the corresponding ID in GPIO_LUT table - UCHAR ucGPIO_PinState; // Pin state showing how to set-up the pin -}ATOM_GPIO_PIN_CONTROL_PAIR; - -typedef struct _ATOM_OBJECT_GPIO_CNTL_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucFlags; // Future expnadibility - UCHAR ucNumberOfPins; // Number of GPIO pins used to control the object - ATOM_GPIO_PIN_CONTROL_PAIR asGpio[1]; // the real gpio pin pair determined by number of pins ucNumberOfPins -}ATOM_OBJECT_GPIO_CNTL_RECORD; - -//Definitions for GPIO pin state -#define GPIO_PIN_TYPE_INPUT 0x00 -#define GPIO_PIN_TYPE_OUTPUT 0x10 -#define GPIO_PIN_TYPE_HW_CONTROL 0x20 - -//For GPIO_PIN_TYPE_OUTPUT the following is defined -#define GPIO_PIN_OUTPUT_STATE_MASK 0x01 -#define GPIO_PIN_OUTPUT_STATE_SHIFT 0 -#define GPIO_PIN_STATE_ACTIVE_LOW 0x0 -#define GPIO_PIN_STATE_ACTIVE_HIGH 0x1 - -typedef struct _ATOM_ENCODER_DVO_CF_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - ULONG ulStrengthControl; // DVOA strength control for CF - UCHAR ucPadding[2]; -}ATOM_ENCODER_DVO_CF_RECORD; - -// value for ATOM_CONNECTOR_CF_RECORD.ucConnectedDvoBundle -#define ATOM_CONNECTOR_CF_RECORD_CONNECTED_UPPER12BITBUNDLEA 1 -#define ATOM_CONNECTOR_CF_RECORD_CONNECTED_LOWER12BITBUNDLEB 2 - -typedef struct _ATOM_CONNECTOR_CF_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - USHORT usMaxPixClk; - UCHAR ucFlowCntlGpioId; - UCHAR ucSwapCntlGpioId; - UCHAR ucConnectedDvoBundle; - UCHAR ucPadding; -}ATOM_CONNECTOR_CF_RECORD; - -typedef struct _ATOM_CONNECTOR_HARDCODE_DTD_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - ATOM_DTD_FORMAT asTiming; -}ATOM_CONNECTOR_HARDCODE_DTD_RECORD; - -typedef struct _ATOM_CONNECTOR_PCIE_SUBCONNECTOR_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; //ATOM_CONNECTOR_PCIE_SUBCONNECTOR_RECORD_TYPE - UCHAR ucSubConnectorType; //CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D|X_ID_DUAL_LINK_DVI_D|HDMI_TYPE_A - UCHAR ucReserved; -}ATOM_CONNECTOR_PCIE_SUBCONNECTOR_RECORD; - - -typedef struct _ATOM_ROUTER_DDC_PATH_SELECT_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucMuxType; //decide the number of ucMuxState, =0, no pin state, =1: single state with complement, >1: multiple state - UCHAR ucMuxControlPin; - UCHAR ucMuxState[2]; //for alligment purpose -}ATOM_ROUTER_DDC_PATH_SELECT_RECORD; - -typedef struct _ATOM_ROUTER_DATA_CLOCK_PATH_SELECT_RECORD -{ - ATOM_COMMON_RECORD_HEADER sheader; - UCHAR ucMuxType; - UCHAR ucMuxControlPin; - UCHAR ucMuxState[2]; //for alligment purpose -}ATOM_ROUTER_DATA_CLOCK_PATH_SELECT_RECORD; - -// define ucMuxType -#define ATOM_ROUTER_MUX_PIN_STATE_MASK 0x0f -#define ATOM_ROUTER_MUX_PIN_SINGLE_STATE_COMPLEMENT 0x01 - -/****************************************************************************/ -// ASIC voltage data table -/****************************************************************************/ -typedef struct _ATOM_VOLTAGE_INFO_HEADER -{ - USHORT usVDDCBaseLevel; //In number of 50mv unit - USHORT usReserved; //For possible extension table offset - UCHAR ucNumOfVoltageEntries; - UCHAR ucBytesPerVoltageEntry; - UCHAR ucVoltageStep; //Indicating in how many mv increament is one step, 0.5mv unit - UCHAR ucDefaultVoltageEntry; - UCHAR ucVoltageControlI2cLine; - UCHAR ucVoltageControlAddress; - UCHAR ucVoltageControlOffset; -}ATOM_VOLTAGE_INFO_HEADER; - -typedef struct _ATOM_VOLTAGE_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_VOLTAGE_INFO_HEADER viHeader; - UCHAR ucVoltageEntries[64]; //64 is for allocation, the actual number of entry is present at ucNumOfVoltageEntries*ucBytesPerVoltageEntry -}ATOM_VOLTAGE_INFO; - - -typedef struct _ATOM_VOLTAGE_FORMULA -{ - USHORT usVoltageBaseLevel; // In number of 1mv unit - USHORT usVoltageStep; // Indicating in how many mv increament is one step, 1mv unit - UCHAR ucNumOfVoltageEntries; // Number of Voltage Entry, which indicate max Voltage - UCHAR ucFlag; // bit0=0 :step is 1mv =1 0.5mv - UCHAR ucBaseVID; // if there is no lookup table, VID= BaseVID + ( Vol - BaseLevle ) /VoltageStep - UCHAR ucReserved; - UCHAR ucVIDAdjustEntries[32]; // 32 is for allocation, the actual number of entry is present at ucNumOfVoltageEntries -}ATOM_VOLTAGE_FORMULA; - -typedef struct _ATOM_VOLTAGE_CONTROL -{ - UCHAR ucVoltageControlId; //Indicate it is controlled by I2C or GPIO or HW state machine - UCHAR ucVoltageControlI2cLine; - UCHAR ucVoltageControlAddress; - UCHAR ucVoltageControlOffset; - USHORT usGpioPin_AIndex; //GPIO_PAD register index - UCHAR ucGpioPinBitShift[9]; //at most 8 pin support 255 VIDs, termintate with 0xff - UCHAR ucReserved; -}ATOM_VOLTAGE_CONTROL; - -// Define ucVoltageControlId -#define VOLTAGE_CONTROLLED_BY_HW 0x00 -#define VOLTAGE_CONTROLLED_BY_I2C_MASK 0x7F -#define VOLTAGE_CONTROLLED_BY_GPIO 0x80 -#define VOLTAGE_CONTROL_ID_LM64 0x01 //I2C control, used for R5xx Core Voltage -#define VOLTAGE_CONTROL_ID_DAC 0x02 //I2C control, used for R5xx/R6xx MVDDC,MVDDQ or VDDCI -#define VOLTAGE_CONTROL_ID_VT116xM 0x03 //I2C control, used for R6xx Core Voltage -#define VOLTAGE_CONTROL_ID_DS4402 0x04 - -typedef struct _ATOM_VOLTAGE_OBJECT -{ - UCHAR ucVoltageType; //Indicate Voltage Source: VDDC, MVDDC, MVDDQ or MVDDCI - UCHAR ucSize; //Size of Object - ATOM_VOLTAGE_CONTROL asControl; //describ how to control - ATOM_VOLTAGE_FORMULA asFormula; //Indicate How to convert real Voltage to VID -}ATOM_VOLTAGE_OBJECT; - -typedef struct _ATOM_VOLTAGE_OBJECT_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_VOLTAGE_OBJECT asVoltageObj[3]; //Info for Voltage control -}ATOM_VOLTAGE_OBJECT_INFO; - -typedef struct _ATOM_LEAKID_VOLTAGE -{ - UCHAR ucLeakageId; - UCHAR ucReserved; - USHORT usVoltage; -}ATOM_LEAKID_VOLTAGE; - -typedef struct _ATOM_ASIC_PROFILE_VOLTAGE -{ - UCHAR ucProfileId; - UCHAR ucReserved; - USHORT usSize; - USHORT usEfuseSpareStartAddr; - USHORT usFuseIndex[8]; //from LSB to MSB, Max 8bit,end of 0xffff if less than 8 efuse id, - ATOM_LEAKID_VOLTAGE asLeakVol[2]; //Leakid and relatd voltage -}ATOM_ASIC_PROFILE_VOLTAGE; - -//ucProfileId -#define ATOM_ASIC_PROFILE_ID_EFUSE_VOLTAGE 1 -#define ATOM_ASIC_PROFILE_ID_EFUSE_PERFORMANCE_VOLTAGE 1 -#define ATOM_ASIC_PROFILE_ID_EFUSE_THERMAL_VOLTAGE 2 - -typedef struct _ATOM_ASIC_PROFILING_INFO -{ - ATOM_COMMON_TABLE_HEADER asHeader; - ATOM_ASIC_PROFILE_VOLTAGE asVoltage; -}ATOM_ASIC_PROFILING_INFO; - -typedef struct _ATOM_POWER_SOURCE_OBJECT -{ - UCHAR ucPwrSrcId; // Power source - UCHAR ucPwrSensorType; // GPIO, I2C or none - UCHAR ucPwrSensId; // if GPIO detect, it is GPIO id, if I2C detect, it is I2C id - UCHAR ucPwrSensSlaveAddr; // Slave address if I2C detect - UCHAR ucPwrSensRegIndex; // I2C register Index if I2C detect - UCHAR ucPwrSensRegBitMask; // detect which bit is used if I2C detect - UCHAR ucPwrSensActiveState; // high active or low active - UCHAR ucReserve[3]; // reserve - USHORT usSensPwr; // in unit of watt -}ATOM_POWER_SOURCE_OBJECT; - -typedef struct _ATOM_POWER_SOURCE_INFO -{ - ATOM_COMMON_TABLE_HEADER asHeader; - UCHAR asPwrbehave[16]; - ATOM_POWER_SOURCE_OBJECT asPwrObj[1]; -}ATOM_POWER_SOURCE_INFO; - - -//Define ucPwrSrcId -#define POWERSOURCE_PCIE_ID1 0x00 -#define POWERSOURCE_6PIN_CONNECTOR_ID1 0x01 -#define POWERSOURCE_8PIN_CONNECTOR_ID1 0x02 -#define POWERSOURCE_6PIN_CONNECTOR_ID2 0x04 -#define POWERSOURCE_8PIN_CONNECTOR_ID2 0x08 - -//define ucPwrSensorId -#define POWER_SENSOR_ALWAYS 0x00 -#define POWER_SENSOR_GPIO 0x01 -#define POWER_SENSOR_I2C 0x02 - -/**************************************************************************/ -// This portion is only used when ext thermal chip or engine/memory clock SS chip is populated on a design -//Memory SS Info Table -//Define Memory Clock SS chip ID -#define ICS91719 1 -#define ICS91720 2 - -//Define one structure to inform SW a "block of data" writing to external SS chip via I2C protocol -typedef struct _ATOM_I2C_DATA_RECORD -{ - UCHAR ucNunberOfBytes; //Indicates how many bytes SW needs to write to the external ASIC for one block, besides to "Start" and "Stop" - UCHAR ucI2CData[1]; //I2C data in bytes, should be less than 16 bytes usually -}ATOM_I2C_DATA_RECORD; - - -//Define one structure to inform SW how many blocks of data writing to external SS chip via I2C protocol, in addition to other information -typedef struct _ATOM_I2C_DEVICE_SETUP_INFO -{ - ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; //I2C line and HW/SW assisted cap. - UCHAR ucSSChipID; //SS chip being used - UCHAR ucSSChipSlaveAddr; //Slave Address to set up this SS chip - UCHAR ucNumOfI2CDataRecords; //number of data block - ATOM_I2C_DATA_RECORD asI2CData[1]; -}ATOM_I2C_DEVICE_SETUP_INFO; - -//========================================================================================== -typedef struct _ATOM_ASIC_MVDD_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_I2C_DEVICE_SETUP_INFO asI2CSetup[1]; -}ATOM_ASIC_MVDD_INFO; - -//========================================================================================== -#define ATOM_MCLK_SS_INFO ATOM_ASIC_MVDD_INFO - -//========================================================================================== -/**************************************************************************/ - -typedef struct _ATOM_ASIC_SS_ASSIGNMENT -{ - ULONG ulTargetClockRange; //Clock Out frequence (VCO ), in unit of 10Khz - USHORT usSpreadSpectrumPercentage; //in unit of 0.01% - USHORT usSpreadRateInKhz; //in unit of kHz, modulation freq - UCHAR ucClockIndication; //Indicate which clock source needs SS - UCHAR ucSpreadSpectrumMode; //Bit1=0 Down Spread,=1 Center Spread. - UCHAR ucReserved[2]; -}ATOM_ASIC_SS_ASSIGNMENT; - -//Define ucSpreadSpectrumType -#define ASIC_INTERNAL_MEMORY_SS 1 -#define ASIC_INTERNAL_ENGINE_SS 2 -#define ASIC_INTERNAL_UVD_SS 3 - -typedef struct _ATOM_ASIC_INTERNAL_SS_INFO{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_ASIC_SS_ASSIGNMENT asSpreadSpectrum[4]; -}ATOM_ASIC_INTERNAL_SS_INFO; - -//==============================Scratch Pad Definition Portion=============================== -#define ATOM_DEVICE_CONNECT_INFO_DEF 0 -#define ATOM_ROM_LOCATION_DEF 1 -#define ATOM_TV_STANDARD_DEF 2 -#define ATOM_ACTIVE_INFO_DEF 3 -#define ATOM_LCD_INFO_DEF 4 -#define ATOM_DOS_REQ_INFO_DEF 5 -#define ATOM_ACC_CHANGE_INFO_DEF 6 -#define ATOM_DOS_MODE_INFO_DEF 7 -#define ATOM_I2C_CHANNEL_STATUS_DEF 8 -#define ATOM_I2C_CHANNEL_STATUS1_DEF 9 - - -// BIOS_0_SCRATCH Definition -#define ATOM_S0_CRT1_MONO 0x00000001L -#define ATOM_S0_CRT1_COLOR 0x00000002L -#define ATOM_S0_CRT1_MASK (ATOM_S0_CRT1_MONO+ATOM_S0_CRT1_COLOR) - -#define ATOM_S0_TV1_COMPOSITE_A 0x00000004L -#define ATOM_S0_TV1_SVIDEO_A 0x00000008L -#define ATOM_S0_TV1_MASK_A (ATOM_S0_TV1_COMPOSITE_A+ATOM_S0_TV1_SVIDEO_A) - -#define ATOM_S0_CV_A 0x00000010L -#define ATOM_S0_CV_DIN_A 0x00000020L -#define ATOM_S0_CV_MASK_A (ATOM_S0_CV_A+ATOM_S0_CV_DIN_A) - - -#define ATOM_S0_CRT2_MONO 0x00000100L -#define ATOM_S0_CRT2_COLOR 0x00000200L -#define ATOM_S0_CRT2_MASK (ATOM_S0_CRT2_MONO+ATOM_S0_CRT2_COLOR) - -#define ATOM_S0_TV1_COMPOSITE 0x00000400L -#define ATOM_S0_TV1_SVIDEO 0x00000800L -#define ATOM_S0_TV1_SCART 0x00004000L -#define ATOM_S0_TV1_MASK (ATOM_S0_TV1_COMPOSITE+ATOM_S0_TV1_SVIDEO+ATOM_S0_TV1_SCART) - -#define ATOM_S0_CV 0x00001000L -#define ATOM_S0_CV_DIN 0x00002000L -#define ATOM_S0_CV_MASK (ATOM_S0_CV+ATOM_S0_CV_DIN) - -#define ATOM_S0_DFP1 0x00010000L -#define ATOM_S0_DFP2 0x00020000L -#define ATOM_S0_LCD1 0x00040000L -#define ATOM_S0_LCD2 0x00080000L -#define ATOM_S0_TV2 0x00100000L -#define ATOM_S0_DFP3 0x00200000L -#define ATOM_S0_DFP4 0x00400000L -#define ATOM_S0_DFP5 0x00800000L - -#define ATOM_S0_DFP_MASK ATOM_S0_DFP1 | ATOM_S0_DFP2 | ATOM_S0_DFP3 | ATOM_S0_DFP4 | ATOM_S0_DFP5 - -#define ATOM_S0_FAD_REGISTER_BUG 0x02000000L // If set, indicates we are running a PCIE asic with - // the FAD/HDP reg access bug. Bit is read by DAL - -#define ATOM_S0_THERMAL_STATE_MASK 0x1C000000L -#define ATOM_S0_THERMAL_STATE_SHIFT 26 - -#define ATOM_S0_SYSTEM_POWER_STATE_MASK 0xE0000000L -#define ATOM_S0_SYSTEM_POWER_STATE_SHIFT 29 - -#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_AC 1 -#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_DC 2 -#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LITEAC 3 - -//Byte aligned defintion for BIOS usage -#define ATOM_S0_CRT1_MONOb0 0x01 -#define ATOM_S0_CRT1_COLORb0 0x02 -#define ATOM_S0_CRT1_MASKb0 (ATOM_S0_CRT1_MONOb0+ATOM_S0_CRT1_COLORb0) - -#define ATOM_S0_TV1_COMPOSITEb0 0x04 -#define ATOM_S0_TV1_SVIDEOb0 0x08 -#define ATOM_S0_TV1_MASKb0 (ATOM_S0_TV1_COMPOSITEb0+ATOM_S0_TV1_SVIDEOb0) - -#define ATOM_S0_CVb0 0x10 -#define ATOM_S0_CV_DINb0 0x20 -#define ATOM_S0_CV_MASKb0 (ATOM_S0_CVb0+ATOM_S0_CV_DINb0) - -#define ATOM_S0_CRT2_MONOb1 0x01 -#define ATOM_S0_CRT2_COLORb1 0x02 -#define ATOM_S0_CRT2_MASKb1 (ATOM_S0_CRT2_MONOb1+ATOM_S0_CRT2_COLORb1) - -#define ATOM_S0_TV1_COMPOSITEb1 0x04 -#define ATOM_S0_TV1_SVIDEOb1 0x08 -#define ATOM_S0_TV1_SCARTb1 0x40 -#define ATOM_S0_TV1_MASKb1 (ATOM_S0_TV1_COMPOSITEb1+ATOM_S0_TV1_SVIDEOb1+ATOM_S0_TV1_SCARTb1) - -#define ATOM_S0_CVb1 0x10 -#define ATOM_S0_CV_DINb1 0x20 -#define ATOM_S0_CV_MASKb1 (ATOM_S0_CVb1+ATOM_S0_CV_DINb1) - -#define ATOM_S0_DFP1b2 0x01 -#define ATOM_S0_DFP2b2 0x02 -#define ATOM_S0_LCD1b2 0x04 -#define ATOM_S0_LCD2b2 0x08 -#define ATOM_S0_TV2b2 0x10 -#define ATOM_S0_DFP3b2 0x20 -#define ATOM_S0_DFP4b2 0x40 -#define ATOM_S0_DFP5b2 0x80 - -#define ATOM_S0_THERMAL_STATE_MASKb3 0x1C -#define ATOM_S0_THERMAL_STATE_SHIFTb3 2 - -#define ATOM_S0_SYSTEM_POWER_STATE_MASKb3 0xE0 -#define ATOM_S0_LCD1_SHIFT 18 - -// BIOS_1_SCRATCH Definition -#define ATOM_S1_ROM_LOCATION_MASK 0x0000FFFFL -#define ATOM_S1_PCI_BUS_DEV_MASK 0xFFFF0000L - -// BIOS_2_SCRATCH Definition -#define ATOM_S2_TV1_STANDARD_MASK 0x0000000FL -#define ATOM_S2_CURRENT_BL_LEVEL_MASK 0x0000FF00L -#define ATOM_S2_CURRENT_BL_LEVEL_SHIFT 8 - -#define ATOM_S2_CRT1_DPMS_STATE 0x00010000L -#define ATOM_S2_LCD1_DPMS_STATE 0x00020000L -#define ATOM_S2_TV1_DPMS_STATE 0x00040000L -#define ATOM_S2_DFP1_DPMS_STATE 0x00080000L -#define ATOM_S2_CRT2_DPMS_STATE 0x00100000L -#define ATOM_S2_LCD2_DPMS_STATE 0x00200000L -#define ATOM_S2_TV2_DPMS_STATE 0x00400000L -#define ATOM_S2_DFP2_DPMS_STATE 0x00800000L -#define ATOM_S2_CV_DPMS_STATE 0x01000000L -#define ATOM_S2_DFP3_DPMS_STATE 0x02000000L -#define ATOM_S2_DFP4_DPMS_STATE 0x04000000L -#define ATOM_S2_DFP5_DPMS_STATE 0x08000000L - -#define ATOM_S2_DFP_DPM_STATE ATOM_S2_DFP1_DPMS_STATE | ATOM_S2_DFP2_DPMS_STATE | ATOM_S2_DFP3_DPMS_STATE | ATOM_S2_DFP4_DPMS_STATE | ATOM_S2_DFP5_DPMS_STATE - -#define ATOM_S2_DEVICE_DPMS_STATE (ATOM_S2_CRT1_DPMS_STATE+ATOM_S2_LCD1_DPMS_STATE+ATOM_S2_TV1_DPMS_STATE+\ - ATOM_S2_DFP_DPMS_STATE+ATOM_S2_CRT2_DPMS_STATE+ATOM_S2_LCD2_DPMS_STATE+\ - ATOM_S2_TV2_DPMS_STATE+ATOM_S2_CV_DPMS_STATE - -#define ATOM_S2_FORCEDLOWPWRMODE_STATE_MASK 0x0C000000L -#define ATOM_S2_FORCEDLOWPWRMODE_STATE_MASK_SHIFT 26 -#define ATOM_S2_FORCEDLOWPWRMODE_STATE_CHANGE 0x10000000L - -#define ATOM_S2_VRI_BRIGHT_ENABLE 0x20000000L - -#define ATOM_S2_DISPLAY_ROTATION_0_DEGREE 0x0 -#define ATOM_S2_DISPLAY_ROTATION_90_DEGREE 0x1 -#define ATOM_S2_DISPLAY_ROTATION_180_DEGREE 0x2 -#define ATOM_S2_DISPLAY_ROTATION_270_DEGREE 0x3 -#define ATOM_S2_DISPLAY_ROTATION_DEGREE_SHIFT 30 -#define ATOM_S2_DISPLAY_ROTATION_ANGLE_MASK 0xC0000000L - - -//Byte aligned defintion for BIOS usage -#define ATOM_S2_TV1_STANDARD_MASKb0 0x0F -#define ATOM_S2_CURRENT_BL_LEVEL_MASKb1 0xFF -#define ATOM_S2_CRT1_DPMS_STATEb2 0x01 -#define ATOM_S2_LCD1_DPMS_STATEb2 0x02 -#define ATOM_S2_TV1_DPMS_STATEb2 0x04 -#define ATOM_S2_DFP1_DPMS_STATEb2 0x08 -#define ATOM_S2_CRT2_DPMS_STATEb2 0x10 -#define ATOM_S2_LCD2_DPMS_STATEb2 0x20 -#define ATOM_S2_TV2_DPMS_STATEb2 0x40 -#define ATOM_S2_DFP2_DPMS_STATEb2 0x80 -#define ATOM_S2_CV_DPMS_STATEb3 0x01 -#define ATOM_S2_DFP3_DPMS_STATEb3 0x02 -#define ATOM_S2_DFP4_DPMS_STATEb3 0x04 -#define ATOM_S2_DFP5_DPMS_STATEb3 0x08 - -#define ATOM_S2_DEVICE_DPMS_MASKw1 0x3FF -#define ATOM_S2_FORCEDLOWPWRMODE_STATE_MASKb3 0x0C -#define ATOM_S2_FORCEDLOWPWRMODE_STATE_CHANGEb3 0x10 -#define ATOM_S2_VRI_BRIGHT_ENABLEb3 0x20 -#define ATOM_S2_ROTATION_STATE_MASKb3 0xC0 - - -// BIOS_3_SCRATCH Definition -#define ATOM_S3_CRT1_ACTIVE 0x00000001L -#define ATOM_S3_LCD1_ACTIVE 0x00000002L -#define ATOM_S3_TV1_ACTIVE 0x00000004L -#define ATOM_S3_DFP1_ACTIVE 0x00000008L -#define ATOM_S3_CRT2_ACTIVE 0x00000010L -#define ATOM_S3_LCD2_ACTIVE 0x00000020L -#define ATOM_S3_TV2_ACTIVE 0x00000040L -#define ATOM_S3_DFP2_ACTIVE 0x00000080L -#define ATOM_S3_CV_ACTIVE 0x00000100L -#define ATOM_S3_DFP3_ACTIVE 0x00000200L -#define ATOM_S3_DFP4_ACTIVE 0x00000400L -#define ATOM_S3_DFP5_ACTIVE 0x00000800L - -#define ATOM_S3_DEVICE_ACTIVE_MASK 0x00000FFFL - -#define ATOM_S3_LCD_FULLEXPANSION_ACTIVE 0x00001000L -#define ATOM_S3_LCD_EXPANSION_ASPEC_RATIO_ACTIVE 0x00002000L - -#define ATOM_S3_CRT1_CRTC_ACTIVE 0x00010000L -#define ATOM_S3_LCD1_CRTC_ACTIVE 0x00020000L -#define ATOM_S3_TV1_CRTC_ACTIVE 0x00040000L -#define ATOM_S3_DFP1_CRTC_ACTIVE 0x00080000L -#define ATOM_S3_CRT2_CRTC_ACTIVE 0x00100000L -#define ATOM_S3_LCD2_CRTC_ACTIVE 0x00200000L -#define ATOM_S3_TV2_CRTC_ACTIVE 0x00400000L -#define ATOM_S3_DFP2_CRTC_ACTIVE 0x00800000L -#define ATOM_S3_CV_CRTC_ACTIVE 0x01000000L -#define ATOM_S3_DFP3_CRTC_ACTIVE 0x02000000L -#define ATOM_S3_DFP4_CRTC_ACTIVE 0x04000000L -#define ATOM_S3_DFP5_CRTC_ACTIVE 0x08000000L - -#define ATOM_S3_DEVICE_CRTC_ACTIVE_MASK 0x0FFF0000L -#define ATOM_S3_ASIC_GUI_ENGINE_HUNG 0x20000000L -#define ATOM_S3_ALLOW_FAST_PWR_SWITCH 0x40000000L -#define ATOM_S3_RQST_GPU_USE_MIN_PWR 0x80000000L - -//Byte aligned defintion for BIOS usage -#define ATOM_S3_CRT1_ACTIVEb0 0x01 -#define ATOM_S3_LCD1_ACTIVEb0 0x02 -#define ATOM_S3_TV1_ACTIVEb0 0x04 -#define ATOM_S3_DFP1_ACTIVEb0 0x08 -#define ATOM_S3_CRT2_ACTIVEb0 0x10 -#define ATOM_S3_LCD2_ACTIVEb0 0x20 -#define ATOM_S3_TV2_ACTIVEb0 0x40 -#define ATOM_S3_DFP2_ACTIVEb0 0x80 -#define ATOM_S3_CV_ACTIVEb1 0x01 -#define ATOM_S3_DFP3_ACTIVEb1 0x02 -#define ATOM_S3_DFP4_ACTIVEb1 0x04 -#define ATOM_S3_DFP5_ACTIVEb1 0x08 - -#define ATOM_S3_ACTIVE_CRTC1w0 0xFFF - -#define ATOM_S3_CRT1_CRTC_ACTIVEb2 0x01 -#define ATOM_S3_LCD1_CRTC_ACTIVEb2 0x02 -#define ATOM_S3_TV1_CRTC_ACTIVEb2 0x04 -#define ATOM_S3_DFP1_CRTC_ACTIVEb2 0x08 -#define ATOM_S3_CRT2_CRTC_ACTIVEb2 0x10 -#define ATOM_S3_LCD2_CRTC_ACTIVEb2 0x20 -#define ATOM_S3_TV2_CRTC_ACTIVEb2 0x40 -#define ATOM_S3_DFP2_CRTC_ACTIVEb2 0x80 -#define ATOM_S3_CV_CRTC_ACTIVEb3 0x01 -#define ATOM_S3_DFP3_CRTC_ACTIVEb3 0x02 -#define ATOM_S3_DFP4_CRTC_ACTIVEb3 0x04 -#define ATOM_S3_DFP5_CRTC_ACTIVEb3 0x08 - -#define ATOM_S3_ACTIVE_CRTC2w1 0xFFF - -#define ATOM_S3_ASIC_GUI_ENGINE_HUNGb3 0x20 -#define ATOM_S3_ALLOW_FAST_PWR_SWITCHb3 0x40 -#define ATOM_S3_RQST_GPU_USE_MIN_PWRb3 0x80 - -// BIOS_4_SCRATCH Definition -#define ATOM_S4_LCD1_PANEL_ID_MASK 0x000000FFL -#define ATOM_S4_LCD1_REFRESH_MASK 0x0000FF00L -#define ATOM_S4_LCD1_REFRESH_SHIFT 8 - -//Byte aligned defintion for BIOS usage -#define ATOM_S4_LCD1_PANEL_ID_MASKb0 0x0FF -#define ATOM_S4_LCD1_REFRESH_MASKb1 ATOM_S4_LCD1_PANEL_ID_MASKb0 -#define ATOM_S4_VRAM_INFO_MASKb2 ATOM_S4_LCD1_PANEL_ID_MASKb0 - -// BIOS_5_SCRATCH Definition, BIOS_5_SCRATCH is used by Firmware only !!!! -#define ATOM_S5_DOS_REQ_CRT1b0 0x01 -#define ATOM_S5_DOS_REQ_LCD1b0 0x02 -#define ATOM_S5_DOS_REQ_TV1b0 0x04 -#define ATOM_S5_DOS_REQ_DFP1b0 0x08 -#define ATOM_S5_DOS_REQ_CRT2b0 0x10 -#define ATOM_S5_DOS_REQ_LCD2b0 0x20 -#define ATOM_S5_DOS_REQ_TV2b0 0x40 -#define ATOM_S5_DOS_REQ_DFP2b0 0x80 -#define ATOM_S5_DOS_REQ_CVb1 0x01 -#define ATOM_S5_DOS_REQ_DFP3b1 0x02 -#define ATOM_S5_DOS_REQ_DFP4b1 0x04 -#define ATOM_S5_DOS_REQ_DFP5b1 0x08 - -#define ATOM_S5_DOS_REQ_DEVICEw0 0x03FF - -#define ATOM_S5_DOS_REQ_CRT1 0x0001 -#define ATOM_S5_DOS_REQ_LCD1 0x0002 -#define ATOM_S5_DOS_REQ_TV1 0x0004 -#define ATOM_S5_DOS_REQ_DFP1 0x0008 -#define ATOM_S5_DOS_REQ_CRT2 0x0010 -#define ATOM_S5_DOS_REQ_LCD2 0x0020 -#define ATOM_S5_DOS_REQ_TV2 0x0040 -#define ATOM_S5_DOS_REQ_DFP2 0x0080 -#define ATOM_S5_DOS_REQ_CV 0x0100 -#define ATOM_S5_DOS_REQ_DFP3 0x0200 -#define ATOM_S5_DOS_REQ_DFP4 0x0400 -#define ATOM_S5_DOS_REQ_DFP5 0x0800 - -#define ATOM_S5_DOS_FORCE_CRT1b2 ATOM_S5_DOS_REQ_CRT1b0 -#define ATOM_S5_DOS_FORCE_TV1b2 ATOM_S5_DOS_REQ_TV1b0 -#define ATOM_S5_DOS_FORCE_CRT2b2 ATOM_S5_DOS_REQ_CRT2b0 -#define ATOM_S5_DOS_FORCE_CVb3 ATOM_S5_DOS_REQ_CVb1 -#define ATOM_S5_DOS_FORCE_DEVICEw1 (ATOM_S5_DOS_FORCE_CRT1b2+ATOM_S5_DOS_FORCE_TV1b2+ATOM_S5_DOS_FORCE_CRT2b2+\ - (ATOM_S5_DOS_FORCE_CVb3<<8)) - -// BIOS_6_SCRATCH Definition -#define ATOM_S6_DEVICE_CHANGE 0x00000001L -#define ATOM_S6_SCALER_CHANGE 0x00000002L -#define ATOM_S6_LID_CHANGE 0x00000004L -#define ATOM_S6_DOCKING_CHANGE 0x00000008L -#define ATOM_S6_ACC_MODE 0x00000010L -#define ATOM_S6_EXT_DESKTOP_MODE 0x00000020L -#define ATOM_S6_LID_STATE 0x00000040L -#define ATOM_S6_DOCK_STATE 0x00000080L -#define ATOM_S6_CRITICAL_STATE 0x00000100L -#define ATOM_S6_HW_I2C_BUSY_STATE 0x00000200L -#define ATOM_S6_THERMAL_STATE_CHANGE 0x00000400L -#define ATOM_S6_INTERRUPT_SET_BY_BIOS 0x00000800L -#define ATOM_S6_REQ_LCD_EXPANSION_FULL 0x00001000L //Normal expansion Request bit for LCD -#define ATOM_S6_REQ_LCD_EXPANSION_ASPEC_RATIO 0x00002000L //Aspect ratio expansion Request bit for LCD - -#define ATOM_S6_DISPLAY_STATE_CHANGE 0x00004000L //This bit is recycled when ATOM_BIOS_INFO_BIOS_SCRATCH6_SCL2_REDEFINE is set,previously it's SCL2_H_expansion -#define ATOM_S6_I2C_STATE_CHANGE 0x00008000L //This bit is recycled,when ATOM_BIOS_INFO_BIOS_SCRATCH6_SCL2_REDEFINE is set,previously it's SCL2_V_expansion - -#define ATOM_S6_ACC_REQ_CRT1 0x00010000L -#define ATOM_S6_ACC_REQ_LCD1 0x00020000L -#define ATOM_S6_ACC_REQ_TV1 0x00040000L -#define ATOM_S6_ACC_REQ_DFP1 0x00080000L -#define ATOM_S6_ACC_REQ_CRT2 0x00100000L -#define ATOM_S6_ACC_REQ_LCD2 0x00200000L -#define ATOM_S6_ACC_REQ_TV2 0x00400000L -#define ATOM_S6_ACC_REQ_DFP2 0x00800000L -#define ATOM_S6_ACC_REQ_CV 0x01000000L -#define ATOM_S6_ACC_REQ_DFP3 0x02000000L -#define ATOM_S6_ACC_REQ_DFP4 0x04000000L -#define ATOM_S6_ACC_REQ_DFP5 0x08000000L - -#define ATOM_S6_ACC_REQ_MASK 0x0FFF0000L -#define ATOM_S6_SYSTEM_POWER_MODE_CHANGE 0x10000000L -#define ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH 0x20000000L -#define ATOM_S6_VRI_BRIGHTNESS_CHANGE 0x40000000L -#define ATOM_S6_CONFIG_DISPLAY_CHANGE_MASK 0x80000000L - -//Byte aligned defintion for BIOS usage -#define ATOM_S6_DEVICE_CHANGEb0 0x01 -#define ATOM_S6_SCALER_CHANGEb0 0x02 -#define ATOM_S6_LID_CHANGEb0 0x04 -#define ATOM_S6_DOCKING_CHANGEb0 0x08 -#define ATOM_S6_ACC_MODEb0 0x10 -#define ATOM_S6_EXT_DESKTOP_MODEb0 0x20 -#define ATOM_S6_LID_STATEb0 0x40 -#define ATOM_S6_DOCK_STATEb0 0x80 -#define ATOM_S6_CRITICAL_STATEb1 0x01 -#define ATOM_S6_HW_I2C_BUSY_STATEb1 0x02 -#define ATOM_S6_THERMAL_STATE_CHANGEb1 0x04 -#define ATOM_S6_INTERRUPT_SET_BY_BIOSb1 0x08 -#define ATOM_S6_REQ_LCD_EXPANSION_FULLb1 0x10 -#define ATOM_S6_REQ_LCD_EXPANSION_ASPEC_RATIOb1 0x20 - -#define ATOM_S6_ACC_REQ_CRT1b2 0x01 -#define ATOM_S6_ACC_REQ_LCD1b2 0x02 -#define ATOM_S6_ACC_REQ_TV1b2 0x04 -#define ATOM_S6_ACC_REQ_DFP1b2 0x08 -#define ATOM_S6_ACC_REQ_CRT2b2 0x10 -#define ATOM_S6_ACC_REQ_LCD2b2 0x20 -#define ATOM_S6_ACC_REQ_TV2b2 0x40 -#define ATOM_S6_ACC_REQ_DFP2b2 0x80 -#define ATOM_S6_ACC_REQ_CVb3 0x01 -#define ATOM_S6_ACC_REQ_DFP3b3 0x02 -#define ATOM_S6_ACC_REQ_DFP4b3 0x04 -#define ATOM_S6_ACC_REQ_DFP5b3 0x08 - -#define ATOM_S6_ACC_REQ_DEVICEw1 ATOM_S5_DOS_REQ_DEVICEw0 -#define ATOM_S6_SYSTEM_POWER_MODE_CHANGEb3 0x10 -#define ATOM_S6_ACC_BLOCK_DISPLAY_SWITCHb3 0x20 -#define ATOM_S6_VRI_BRIGHTNESS_CHANGEb3 0x40 -#define ATOM_S6_CONFIG_DISPLAY_CHANGEb3 0x80 - -#define ATOM_S6_DEVICE_CHANGE_SHIFT 0 -#define ATOM_S6_SCALER_CHANGE_SHIFT 1 -#define ATOM_S6_LID_CHANGE_SHIFT 2 -#define ATOM_S6_DOCKING_CHANGE_SHIFT 3 -#define ATOM_S6_ACC_MODE_SHIFT 4 -#define ATOM_S6_EXT_DESKTOP_MODE_SHIFT 5 -#define ATOM_S6_LID_STATE_SHIFT 6 -#define ATOM_S6_DOCK_STATE_SHIFT 7 -#define ATOM_S6_CRITICAL_STATE_SHIFT 8 -#define ATOM_S6_HW_I2C_BUSY_STATE_SHIFT 9 -#define ATOM_S6_THERMAL_STATE_CHANGE_SHIFT 10 -#define ATOM_S6_INTERRUPT_SET_BY_BIOS_SHIFT 11 -#define ATOM_S6_REQ_SCALER_SHIFT 12 -#define ATOM_S6_REQ_SCALER_ARATIO_SHIFT 13 -#define ATOM_S6_DISPLAY_STATE_CHANGE_SHIFT 14 -#define ATOM_S6_I2C_STATE_CHANGE_SHIFT 15 -#define ATOM_S6_SYSTEM_POWER_MODE_CHANGE_SHIFT 28 -#define ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH_SHIFT 29 -#define ATOM_S6_VRI_BRIGHTNESS_CHANGE_SHIFT 30 -#define ATOM_S6_CONFIG_DISPLAY_CHANGE_SHIFT 31 - -// BIOS_7_SCRATCH Definition, BIOS_7_SCRATCH is used by Firmware only !!!! -#define ATOM_S7_DOS_MODE_TYPEb0 0x03 -#define ATOM_S7_DOS_MODE_VGAb0 0x00 -#define ATOM_S7_DOS_MODE_VESAb0 0x01 -#define ATOM_S7_DOS_MODE_EXTb0 0x02 -#define ATOM_S7_DOS_MODE_PIXEL_DEPTHb0 0x0C -#define ATOM_S7_DOS_MODE_PIXEL_FORMATb0 0xF0 -#define ATOM_S7_DOS_8BIT_DAC_ENb1 0x01 -#define ATOM_S7_DOS_MODE_NUMBERw1 0x0FFFF - -#define ATOM_S7_DOS_8BIT_DAC_EN_SHIFT 8 - -// BIOS_8_SCRATCH Definition -#define ATOM_S8_I2C_CHANNEL_BUSY_MASK 0x00000FFFF -#define ATOM_S8_I2C_HW_ENGINE_BUSY_MASK 0x0FFFF0000 - -#define ATOM_S8_I2C_CHANNEL_BUSY_SHIFT 0 -#define ATOM_S8_I2C_ENGINE_BUSY_SHIFT 16 - -// BIOS_9_SCRATCH Definition -#ifndef ATOM_S9_I2C_CHANNEL_COMPLETED_MASK -#define ATOM_S9_I2C_CHANNEL_COMPLETED_MASK 0x0000FFFF -#endif -#ifndef ATOM_S9_I2C_CHANNEL_ABORTED_MASK -#define ATOM_S9_I2C_CHANNEL_ABORTED_MASK 0xFFFF0000 -#endif -#ifndef ATOM_S9_I2C_CHANNEL_COMPLETED_SHIFT -#define ATOM_S9_I2C_CHANNEL_COMPLETED_SHIFT 0 -#endif -#ifndef ATOM_S9_I2C_CHANNEL_ABORTED_SHIFT -#define ATOM_S9_I2C_CHANNEL_ABORTED_SHIFT 16 -#endif - - -#define ATOM_FLAG_SET 0x20 -#define ATOM_FLAG_CLEAR 0 -#define CLEAR_ATOM_S6_ACC_MODE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_ACC_MODE_SHIFT | ATOM_FLAG_CLEAR) -#define SET_ATOM_S6_DEVICE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DEVICE_CHANGE_SHIFT | ATOM_FLAG_SET) -#define SET_ATOM_S6_VRI_BRIGHTNESS_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_VRI_BRIGHTNESS_CHANGE_SHIFT | ATOM_FLAG_SET) -#define SET_ATOM_S6_SCALER_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_SCALER_CHANGE_SHIFT | ATOM_FLAG_SET) -#define SET_ATOM_S6_LID_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_LID_CHANGE_SHIFT | ATOM_FLAG_SET) - -#define SET_ATOM_S6_LID_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_LID_STATE_SHIFT | ATOM_FLAG_SET) -#define CLEAR_ATOM_S6_LID_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_LID_STATE_SHIFT | ATOM_FLAG_CLEAR) - -#define SET_ATOM_S6_DOCK_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DOCKING_CHANGE_SHIFT | ATOM_FLAG_SET) -#define SET_ATOM_S6_DOCK_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DOCK_STATE_SHIFT | ATOM_FLAG_SET) -#define CLEAR_ATOM_S6_DOCK_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DOCK_STATE_SHIFT | ATOM_FLAG_CLEAR) - -#define SET_ATOM_S6_THERMAL_STATE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_THERMAL_STATE_CHANGE_SHIFT | ATOM_FLAG_SET) -#define SET_ATOM_S6_SYSTEM_POWER_MODE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_SYSTEM_POWER_MODE_CHANGE_SHIFT | ATOM_FLAG_SET) -#define SET_ATOM_S6_INTERRUPT_SET_BY_BIOS ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_INTERRUPT_SET_BY_BIOS_SHIFT | ATOM_FLAG_SET) - -#define SET_ATOM_S6_CRITICAL_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_CRITICAL_STATE_SHIFT | ATOM_FLAG_SET) -#define CLEAR_ATOM_S6_CRITICAL_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_CRITICAL_STATE_SHIFT | ATOM_FLAG_CLEAR) - -#define SET_ATOM_S6_REQ_SCALER ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_REQ_SCALER_SHIFT | ATOM_FLAG_SET) -#define CLEAR_ATOM_S6_REQ_SCALER ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_REQ_SCALER_SHIFT | ATOM_FLAG_CLEAR ) - -#define SET_ATOM_S6_REQ_SCALER_ARATIO ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_REQ_SCALER_ARATIO_SHIFT | ATOM_FLAG_SET ) -#define CLEAR_ATOM_S6_REQ_SCALER_ARATIO ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_REQ_SCALER_ARATIO_SHIFT | ATOM_FLAG_CLEAR ) - -#define SET_ATOM_S6_I2C_STATE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_I2C_STATE_CHANGE_SHIFT | ATOM_FLAG_SET ) - -#define SET_ATOM_S6_DISPLAY_STATE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DISPLAY_STATE_CHANGE_SHIFT | ATOM_FLAG_SET ) - -#define SET_ATOM_S6_DEVICE_RECONFIG ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_CONFIG_DISPLAY_CHANGE_SHIFT | ATOM_FLAG_SET) -#define CLEAR_ATOM_S0_LCD1 ((ATOM_DEVICE_CONNECT_INFO_DEF << 8 )| ATOM_S0_LCD1_SHIFT | ATOM_FLAG_CLEAR ) -#define SET_ATOM_S7_DOS_8BIT_DAC_EN ((ATOM_DOS_MODE_INFO_DEF << 8 )|ATOM_S7_DOS_8BIT_DAC_EN_SHIFT | ATOM_FLAG_SET ) -#define CLEAR_ATOM_S7_DOS_8BIT_DAC_EN ((ATOM_DOS_MODE_INFO_DEF << 8 )|ATOM_S7_DOS_8BIT_DAC_EN_SHIFT | ATOM_FLAG_CLEAR ) - -/****************************************************************************/ -//Portion II: Definitinos only used in Driver -/****************************************************************************/ - -// Macros used by driver - -#define GetIndexIntoMasterTable(MasterOrData, FieldName) (((char*)(&((ATOM_MASTER_LIST_OF_##MasterOrData##_TABLES*)0)->FieldName)-(char*)0)/sizeof(USHORT)) - -#define GET_COMMAND_TABLE_COMMANDSET_REVISION(TABLE_HEADER_OFFSET) ((((ATOM_COMMON_TABLE_HEADER*)TABLE_HEADER_OFFSET)->ucTableFormatRevision)&0x3F) -#define GET_COMMAND_TABLE_PARAMETER_REVISION(TABLE_HEADER_OFFSET) ((((ATOM_COMMON_TABLE_HEADER*)TABLE_HEADER_OFFSET)->ucTableContentRevision)&0x3F) - -#define GET_DATA_TABLE_MAJOR_REVISION GET_COMMAND_TABLE_COMMANDSET_REVISION -#define GET_DATA_TABLE_MINOR_REVISION GET_COMMAND_TABLE_PARAMETER_REVISION - -/****************************************************************************/ -//Portion III: Definitinos only used in VBIOS -/****************************************************************************/ -#define ATOM_DAC_SRC 0x80 -#define ATOM_SRC_DAC1 0 -#define ATOM_SRC_DAC2 0x80 - - -#ifdef UEFI_BUILD - #define USHORT UTEMP -#endif - -typedef struct _MEMORY_PLLINIT_PARAMETERS -{ - ULONG ulTargetMemoryClock; //In 10Khz unit - UCHAR ucAction; //not define yet - UCHAR ucFbDiv_Hi; //Fbdiv Hi byte - UCHAR ucFbDiv; //FB value - UCHAR ucPostDiv; //Post div -}MEMORY_PLLINIT_PARAMETERS; - -#define MEMORY_PLLINIT_PS_ALLOCATION MEMORY_PLLINIT_PARAMETERS - - -#define GPIO_PIN_WRITE 0x01 -#define GPIO_PIN_READ 0x00 - -typedef struct _GPIO_PIN_CONTROL_PARAMETERS -{ - UCHAR ucGPIO_ID; //return value, read from GPIO pins - UCHAR ucGPIOBitShift; //define which bit in uGPIOBitVal need to be update - UCHAR ucGPIOBitVal; //Set/Reset corresponding bit defined in ucGPIOBitMask - UCHAR ucAction; //=GPIO_PIN_WRITE: Read; =GPIO_PIN_READ: Write -}GPIO_PIN_CONTROL_PARAMETERS; - -typedef struct _ENABLE_SCALER_PARAMETERS -{ - UCHAR ucScaler; // ATOM_SCALER1, ATOM_SCALER2 - UCHAR ucEnable; // ATOM_SCALER_DISABLE or ATOM_SCALER_CENTER or ATOM_SCALER_EXPANSION - UCHAR ucTVStandard; // - UCHAR ucPadding[1]; -}ENABLE_SCALER_PARAMETERS; -#define ENABLE_SCALER_PS_ALLOCATION ENABLE_SCALER_PARAMETERS - -//ucEnable: -#define SCALER_BYPASS_AUTO_CENTER_NO_REPLICATION 0 -#define SCALER_BYPASS_AUTO_CENTER_AUTO_REPLICATION 1 -#define SCALER_ENABLE_2TAP_ALPHA_MODE 2 -#define SCALER_ENABLE_MULTITAP_MODE 3 - -typedef struct _ENABLE_HARDWARE_ICON_CURSOR_PARAMETERS -{ - ULONG usHWIconHorzVertPosn; // Hardware Icon Vertical position - UCHAR ucHWIconVertOffset; // Hardware Icon Vertical offset - UCHAR ucHWIconHorzOffset; // Hardware Icon Horizontal offset - UCHAR ucSelection; // ATOM_CURSOR1 or ATOM_ICON1 or ATOM_CURSOR2 or ATOM_ICON2 - UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE -}ENABLE_HARDWARE_ICON_CURSOR_PARAMETERS; - -typedef struct _ENABLE_HARDWARE_ICON_CURSOR_PS_ALLOCATION -{ - ENABLE_HARDWARE_ICON_CURSOR_PARAMETERS sEnableIcon; - ENABLE_CRTC_PARAMETERS sReserved; -}ENABLE_HARDWARE_ICON_CURSOR_PS_ALLOCATION; - -typedef struct _ENABLE_GRAPH_SURFACE_PARAMETERS -{ - USHORT usHight; // Image Hight - USHORT usWidth; // Image Width - UCHAR ucSurface; // Surface 1 or 2 - UCHAR ucPadding[3]; -}ENABLE_GRAPH_SURFACE_PARAMETERS; - -typedef struct _ENABLE_GRAPH_SURFACE_PARAMETERS_V1_2 -{ - USHORT usHight; // Image Hight - USHORT usWidth; // Image Width - UCHAR ucSurface; // Surface 1 or 2 - UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE - UCHAR ucPadding[2]; -}ENABLE_GRAPH_SURFACE_PARAMETERS_V1_2; - -typedef struct _ENABLE_GRAPH_SURFACE_PS_ALLOCATION -{ - ENABLE_GRAPH_SURFACE_PARAMETERS sSetSurface; - ENABLE_YUV_PS_ALLOCATION sReserved; // Don't set this one -}ENABLE_GRAPH_SURFACE_PS_ALLOCATION; - -typedef struct _MEMORY_CLEAN_UP_PARAMETERS -{ - USHORT usMemoryStart; //in 8Kb boundry, offset from memory base address - USHORT usMemorySize; //8Kb blocks aligned -}MEMORY_CLEAN_UP_PARAMETERS; -#define MEMORY_CLEAN_UP_PS_ALLOCATION MEMORY_CLEAN_UP_PARAMETERS - -typedef struct _GET_DISPLAY_SURFACE_SIZE_PARAMETERS -{ - USHORT usX_Size; //When use as input parameter, usX_Size indicates which CRTC - USHORT usY_Size; -}GET_DISPLAY_SURFACE_SIZE_PARAMETERS; - -typedef struct _INDIRECT_IO_ACCESS -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR IOAccessSequence[256]; -} INDIRECT_IO_ACCESS; - -#define INDIRECT_READ 0x00 -#define INDIRECT_WRITE 0x80 - -#define INDIRECT_IO_MM 0 -#define INDIRECT_IO_PLL 1 -#define INDIRECT_IO_MC 2 -#define INDIRECT_IO_PCIE 3 -#define INDIRECT_IO_PCIEP 4 -#define INDIRECT_IO_NBMISC 5 - -#define INDIRECT_IO_PLL_READ INDIRECT_IO_PLL | INDIRECT_READ -#define INDIRECT_IO_PLL_WRITE INDIRECT_IO_PLL | INDIRECT_WRITE -#define INDIRECT_IO_MC_READ INDIRECT_IO_MC | INDIRECT_READ -#define INDIRECT_IO_MC_WRITE INDIRECT_IO_MC | INDIRECT_WRITE -#define INDIRECT_IO_PCIE_READ INDIRECT_IO_PCIE | INDIRECT_READ -#define INDIRECT_IO_PCIE_WRITE INDIRECT_IO_PCIE | INDIRECT_WRITE -#define INDIRECT_IO_PCIEP_READ INDIRECT_IO_PCIEP | INDIRECT_READ -#define INDIRECT_IO_PCIEP_WRITE INDIRECT_IO_PCIEP | INDIRECT_WRITE -#define INDIRECT_IO_NBMISC_READ INDIRECT_IO_NBMISC | INDIRECT_READ -#define INDIRECT_IO_NBMISC_WRITE INDIRECT_IO_NBMISC | INDIRECT_WRITE - -typedef struct _ATOM_OEM_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; -}ATOM_OEM_INFO; - -typedef struct _ATOM_TV_MODE -{ - UCHAR ucVMode_Num; //Video mode number - UCHAR ucTV_Mode_Num; //Internal TV mode number -}ATOM_TV_MODE; - -typedef struct _ATOM_BIOS_INT_TVSTD_MODE -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usTV_Mode_LUT_Offset; // Pointer to standard to internal number conversion table - USHORT usTV_FIFO_Offset; // Pointer to FIFO entry table - USHORT usNTSC_Tbl_Offset; // Pointer to SDTV_Mode_NTSC table - USHORT usPAL_Tbl_Offset; // Pointer to SDTV_Mode_PAL table - USHORT usCV_Tbl_Offset; // Pointer to SDTV_Mode_PAL table -}ATOM_BIOS_INT_TVSTD_MODE; - - -typedef struct _ATOM_TV_MODE_SCALER_PTR -{ - USHORT ucFilter0_Offset; //Pointer to filter format 0 coefficients - USHORT usFilter1_Offset; //Pointer to filter format 0 coefficients - UCHAR ucTV_Mode_Num; -}ATOM_TV_MODE_SCALER_PTR; - -typedef struct _ATOM_STANDARD_VESA_TIMING -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_DTD_FORMAT aModeTimings[16]; // 16 is not the real array number, just for initial allocation -}ATOM_STANDARD_VESA_TIMING; - - -typedef struct _ATOM_STD_FORMAT -{ - USHORT usSTD_HDisp; - USHORT usSTD_VDisp; - USHORT usSTD_RefreshRate; - USHORT usReserved; -}ATOM_STD_FORMAT; - -typedef struct _ATOM_VESA_TO_EXTENDED_MODE -{ - USHORT usVESA_ModeNumber; - USHORT usExtendedModeNumber; -}ATOM_VESA_TO_EXTENDED_MODE; - -typedef struct _ATOM_VESA_TO_INTENAL_MODE_LUT -{ - ATOM_COMMON_TABLE_HEADER sHeader; - ATOM_VESA_TO_EXTENDED_MODE asVESA_ToExtendedModeInfo[76]; -}ATOM_VESA_TO_INTENAL_MODE_LUT; - -/*************** ATOM Memory Related Data Structure ***********************/ -typedef struct _ATOM_MEMORY_VENDOR_BLOCK{ - UCHAR ucMemoryType; - UCHAR ucMemoryVendor; - UCHAR ucAdjMCId; - UCHAR ucDynClkId; - ULONG ulDllResetClkRange; -}ATOM_MEMORY_VENDOR_BLOCK; - - -typedef struct _ATOM_MEMORY_SETTING_ID_CONFIG{ - ULONG ulMemClockRange:24; - ULONG ucMemBlkId:8; -}ATOM_MEMORY_SETTING_ID_CONFIG; - -typedef union _ATOM_MEMORY_SETTING_ID_CONFIG_ACCESS -{ - ATOM_MEMORY_SETTING_ID_CONFIG slAccess; - ULONG ulAccess; -}ATOM_MEMORY_SETTING_ID_CONFIG_ACCESS; - - -typedef struct _ATOM_MEMORY_SETTING_DATA_BLOCK{ - ATOM_MEMORY_SETTING_ID_CONFIG_ACCESS ulMemoryID; - ULONG aulMemData[1]; -}ATOM_MEMORY_SETTING_DATA_BLOCK; - - -typedef struct _ATOM_INIT_REG_INDEX_FORMAT{ - USHORT usRegIndex; // MC register index - UCHAR ucPreRegDataLength; // offset in ATOM_INIT_REG_DATA_BLOCK.saRegDataBuf -}ATOM_INIT_REG_INDEX_FORMAT; - - -typedef struct _ATOM_INIT_REG_BLOCK{ - USHORT usRegIndexTblSize; //size of asRegIndexBuf - USHORT usRegDataBlkSize; //size of ATOM_MEMORY_SETTING_DATA_BLOCK - ATOM_INIT_REG_INDEX_FORMAT asRegIndexBuf[1]; - ATOM_MEMORY_SETTING_DATA_BLOCK asRegDataBuf[1]; -}ATOM_INIT_REG_BLOCK; - -#define END_OF_REG_INDEX_BLOCK 0x0ffff -#define END_OF_REG_DATA_BLOCK 0x00000000 -#define ATOM_INIT_REG_MASK_FLAG 0x80 -#define CLOCK_RANGE_HIGHEST 0x00ffffff - -#define VALUE_DWORD SIZEOF ULONG -#define VALUE_SAME_AS_ABOVE 0 -#define VALUE_MASK_DWORD 0x84 - -#define INDEX_ACCESS_RANGE_BEGIN (VALUE_DWORD + 1) -#define INDEX_ACCESS_RANGE_END (INDEX_ACCESS_RANGE_BEGIN + 1) -#define VALUE_INDEX_ACCESS_SINGLE (INDEX_ACCESS_RANGE_END + 1) - - -typedef struct _ATOM_MC_INIT_PARAM_TABLE -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usAdjustARB_SEQDataOffset; - USHORT usMCInitMemTypeTblOffset; - USHORT usMCInitCommonTblOffset; - USHORT usMCInitPowerDownTblOffset; - ULONG ulARB_SEQDataBuf[32]; - ATOM_INIT_REG_BLOCK asMCInitMemType; - ATOM_INIT_REG_BLOCK asMCInitCommon; -}ATOM_MC_INIT_PARAM_TABLE; - - -#define _4Mx16 0x2 -#define _4Mx32 0x3 -#define _8Mx16 0x12 -#define _8Mx32 0x13 -#define _16Mx16 0x22 -#define _16Mx32 0x23 -#define _32Mx16 0x32 -#define _32Mx32 0x33 -#define _64Mx8 0x41 -#define _64Mx16 0x42 - -#define SAMSUNG 0x1 -#define INFINEON 0x2 -#define ELPIDA 0x3 -#define ETRON 0x4 -#define NANYA 0x5 -#define HYNIX 0x6 -#define MOSEL 0x7 -#define WINBOND 0x8 -#define ESMT 0x9 -#define MICRON 0xF - -#define QIMONDA INFINEON -#define PROMOS MOSEL - -/////////////Support for GDDR5 MC uCode to reside in upper 64K of ROM///////////// - -#define UCODE_ROM_START_ADDRESS 0x1c000 -#define UCODE_SIGNATURE 0x4375434d // 'MCuC' - MC uCode - -//uCode block header for reference - -typedef struct _MCuCodeHeader -{ - ULONG ulSignature; - UCHAR ucRevision; - UCHAR ucChecksum; - UCHAR ucReserved1; - UCHAR ucReserved2; - USHORT usParametersLength; - USHORT usUCodeLength; - USHORT usReserved1; - USHORT usReserved2; -} MCuCodeHeader; - -////////////////////////////////////////////////////////////////////////////////// - -#define ATOM_MAX_NUMBER_OF_VRAM_MODULE 16 - -#define ATOM_VRAM_MODULE_MEMORY_VENDOR_ID_MASK 0xF -typedef struct _ATOM_VRAM_MODULE_V1 -{ - ULONG ulReserved; - USHORT usEMRSValue; - USHORT usMRSValue; - USHORT usReserved; - UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module - UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4;[3:0] reserved; - UCHAR ucMemoryVenderID; // Predefined,never change across designs or memory type/vender - UCHAR ucMemoryDeviceCfg; // [7:4]=0x0:4M;=0x1:8M;=0x2:16M;0x3:32M....[3:0]=0x0:x4;=0x1:x8;=0x2:x16;=0x3:x32... - UCHAR ucRow; // Number of Row,in power of 2; - UCHAR ucColumn; // Number of Column,in power of 2; - UCHAR ucBank; // Nunber of Bank; - UCHAR ucRank; // Number of Rank, in power of 2 - UCHAR ucChannelNum; // Number of channel; - UCHAR ucChannelConfig; // [3:0]=Indication of what channel combination;[4:7]=Channel bit width, in number of 2 - UCHAR ucDefaultMVDDQ_ID; // Default MVDDQ setting for this memory block, ID linking to MVDDQ info table to find real set-up data; - UCHAR ucDefaultMVDDC_ID; // Default MVDDC setting for this memory block, ID linking to MVDDC info table to find real set-up data; - UCHAR ucReserved[2]; -}ATOM_VRAM_MODULE_V1; - - -typedef struct _ATOM_VRAM_MODULE_V2 -{ - ULONG ulReserved; - ULONG ulFlags; // To enable/disable functionalities based on memory type - ULONG ulEngineClock; // Override of default engine clock for particular memory type - ULONG ulMemoryClock; // Override of default memory clock for particular memory type - USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type - USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type - USHORT usEMRSValue; - USHORT usMRSValue; - USHORT usReserved; - UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module - UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4;[3:0] - must not be used for now; - UCHAR ucMemoryVenderID; // Predefined,never change across designs or memory type/vender. If not predefined, vendor detection table gets executed - UCHAR ucMemoryDeviceCfg; // [7:4]=0x0:4M;=0x1:8M;=0x2:16M;0x3:32M....[3:0]=0x0:x4;=0x1:x8;=0x2:x16;=0x3:x32... - UCHAR ucRow; // Number of Row,in power of 2; - UCHAR ucColumn; // Number of Column,in power of 2; - UCHAR ucBank; // Nunber of Bank; - UCHAR ucRank; // Number of Rank, in power of 2 - UCHAR ucChannelNum; // Number of channel; - UCHAR ucChannelConfig; // [3:0]=Indication of what channel combination;[4:7]=Channel bit width, in number of 2 - UCHAR ucDefaultMVDDQ_ID; // Default MVDDQ setting for this memory block, ID linking to MVDDQ info table to find real set-up data; - UCHAR ucDefaultMVDDC_ID; // Default MVDDC setting for this memory block, ID linking to MVDDC info table to find real set-up data; - UCHAR ucRefreshRateFactor; - UCHAR ucReserved[3]; -}ATOM_VRAM_MODULE_V2; - - -typedef struct _ATOM_MEMORY_TIMING_FORMAT -{ - ULONG ulClkRange; // memory clock in 10kHz unit, when target memory clock is below this clock, use this memory timing - union{ - USHORT usMRS; // mode register - USHORT usDDR3_MR0; - }; - union{ - USHORT usEMRS; // extended mode register - USHORT usDDR3_MR1; - }; - UCHAR ucCL; // CAS latency - UCHAR ucWL; // WRITE Latency - UCHAR uctRAS; // tRAS - UCHAR uctRC; // tRC - UCHAR uctRFC; // tRFC - UCHAR uctRCDR; // tRCDR - UCHAR uctRCDW; // tRCDW - UCHAR uctRP; // tRP - UCHAR uctRRD; // tRRD - UCHAR uctWR; // tWR - UCHAR uctWTR; // tWTR - UCHAR uctPDIX; // tPDIX - UCHAR uctFAW; // tFAW - UCHAR uctAOND; // tAOND - union - { - struct { - UCHAR ucflag; // flag to control memory timing calculation. bit0= control EMRS2 Infineon - UCHAR ucReserved; - }; - USHORT usDDR3_MR2; - }; -}ATOM_MEMORY_TIMING_FORMAT; - - -typedef struct _ATOM_MEMORY_TIMING_FORMAT_V1 -{ - ULONG ulClkRange; // memory clock in 10kHz unit, when target memory clock is below this clock, use this memory timing - USHORT usMRS; // mode register - USHORT usEMRS; // extended mode register - UCHAR ucCL; // CAS latency - UCHAR ucWL; // WRITE Latency - UCHAR uctRAS; // tRAS - UCHAR uctRC; // tRC - UCHAR uctRFC; // tRFC - UCHAR uctRCDR; // tRCDR - UCHAR uctRCDW; // tRCDW - UCHAR uctRP; // tRP - UCHAR uctRRD; // tRRD - UCHAR uctWR; // tWR - UCHAR uctWTR; // tWTR - UCHAR uctPDIX; // tPDIX - UCHAR uctFAW; // tFAW - UCHAR uctAOND; // tAOND - UCHAR ucflag; // flag to control memory timing calculation. bit0= control EMRS2 Infineon -////////////////////////////////////GDDR parameters/////////////////////////////////// - UCHAR uctCCDL; // - UCHAR uctCRCRL; // - UCHAR uctCRCWL; // - UCHAR uctCKE; // - UCHAR uctCKRSE; // - UCHAR uctCKRSX; // - UCHAR uctFAW32; // - UCHAR ucReserved1; // - UCHAR ucReserved2; // - UCHAR ucTerminator; -}ATOM_MEMORY_TIMING_FORMAT_V1; - - -typedef struct _ATOM_MEMORY_FORMAT -{ - ULONG ulDllDisClock; // memory DLL will be disable when target memory clock is below this clock - union{ - USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type - USHORT usDDR3_Reserved; // Not used for DDR3 memory - }; - union{ - USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type - USHORT usDDR3_MR3; // Used for DDR3 memory - }; - UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4;[3:0] - must not be used for now; - UCHAR ucMemoryVenderID; // Predefined,never change across designs or memory type/vender. If not predefined, vendor detection table gets executed - UCHAR ucRow; // Number of Row,in power of 2; - UCHAR ucColumn; // Number of Column,in power of 2; - UCHAR ucBank; // Nunber of Bank; - UCHAR ucRank; // Number of Rank, in power of 2 - UCHAR ucBurstSize; // burst size, 0= burst size=4 1= burst size=8 - UCHAR ucDllDisBit; // position of DLL Enable/Disable bit in EMRS ( Extended Mode Register ) - UCHAR ucRefreshRateFactor; // memory refresh rate in unit of ms - UCHAR ucDensity; // _8Mx32, _16Mx32, _16Mx16, _32Mx16 - UCHAR ucPreamble; //[7:4] Write Preamble, [3:0] Read Preamble - UCHAR ucMemAttrib; // Memory Device Addribute, like RDBI/WDBI etc - ATOM_MEMORY_TIMING_FORMAT asMemTiming[5]; //Memory Timing block sort from lower clock to higher clock -}ATOM_MEMORY_FORMAT; - - -typedef struct _ATOM_VRAM_MODULE_V3 -{ - ULONG ulChannelMapCfg; // board dependent paramenter:Channel combination - USHORT usSize; // size of ATOM_VRAM_MODULE_V3 - USHORT usDefaultMVDDQ; // board dependent parameter:Default Memory Core Voltage - USHORT usDefaultMVDDC; // board dependent parameter:Default Memory IO Voltage - UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module - UCHAR ucChannelNum; // board dependent parameter:Number of channel; - UCHAR ucChannelSize; // board dependent parameter:32bit or 64bit - UCHAR ucVREFI; // board dependnt parameter: EXT or INT +160mv to -140mv - UCHAR ucNPL_RT; // board dependent parameter:NPL round trip delay, used for calculate memory timing parameters - UCHAR ucFlag; // To enable/disable functionalities based on memory type - ATOM_MEMORY_FORMAT asMemory; // describ all of video memory parameters from memory spec -}ATOM_VRAM_MODULE_V3; - - -//ATOM_VRAM_MODULE_V3.ucNPL_RT -#define NPL_RT_MASK 0x0f -#define BATTERY_ODT_MASK 0xc0 - -#define ATOM_VRAM_MODULE ATOM_VRAM_MODULE_V3 - -typedef struct _ATOM_VRAM_MODULE_V4 -{ - ULONG ulChannelMapCfg; // board dependent parameter: Channel combination - USHORT usModuleSize; // size of ATOM_VRAM_MODULE_V4, make it easy for VBIOS to look for next entry of VRAM_MODULE - USHORT usPrivateReserved; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! - // MC_ARB_RAMCFG (includes NOOFBANK,NOOFRANKS,NOOFROWS,NOOFCOLS) - USHORT usReserved; - UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module - UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4; 0x5:DDR5 [3:0] - Must be 0x0 for now; - UCHAR ucChannelNum; // Number of channels present in this module config - UCHAR ucChannelWidth; // 0 - 32 bits; 1 - 64 bits - UCHAR ucDensity; // _8Mx32, _16Mx32, _16Mx16, _32Mx16 - UCHAR ucFlag; // To enable/disable functionalities based on memory type - UCHAR ucMisc; // bit0: 0 - single rank; 1 - dual rank; bit2: 0 - burstlength 4, 1 - burstlength 8 - UCHAR ucVREFI; // board dependent parameter - UCHAR ucNPL_RT; // board dependent parameter:NPL round trip delay, used for calculate memory timing parameters - UCHAR ucPreamble; // [7:4] Write Preamble, [3:0] Read Preamble - UCHAR ucMemorySize; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! - // Total memory size in unit of 16MB for CONFIG_MEMSIZE - bit[23:0] zeros - UCHAR ucReserved[3]; - -//compare with V3, we flat the struct by merging ATOM_MEMORY_FORMAT (as is) into V4 as the same level - union{ - USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type - USHORT usDDR3_Reserved; - }; - union{ - USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type - USHORT usDDR3_MR3; // Used for DDR3 memory - }; - UCHAR ucMemoryVenderID; // Predefined, If not predefined, vendor detection table gets executed - UCHAR ucRefreshRateFactor; // [1:0]=RefreshFactor (00=8ms, 01=16ms, 10=32ms,11=64ms) - UCHAR ucReserved2[2]; - ATOM_MEMORY_TIMING_FORMAT asMemTiming[5];//Memory Timing block sort from lower clock to higher clock -}ATOM_VRAM_MODULE_V4; - -#define VRAM_MODULE_V4_MISC_RANK_MASK 0x3 -#define VRAM_MODULE_V4_MISC_DUAL_RANK 0x1 -#define VRAM_MODULE_V4_MISC_BL_MASK 0x4 -#define VRAM_MODULE_V4_MISC_BL8 0x4 -#define VRAM_MODULE_V4_MISC_DUAL_CS 0x10 - -typedef struct _ATOM_VRAM_MODULE_V5 -{ - ULONG ulChannelMapCfg; // board dependent parameter: Channel combination - USHORT usModuleSize; // size of ATOM_VRAM_MODULE_V4, make it easy for VBIOS to look for next entry of VRAM_MODULE - USHORT usPrivateReserved; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! - // MC_ARB_RAMCFG (includes NOOFBANK,NOOFRANKS,NOOFROWS,NOOFCOLS) - USHORT usReserved; - UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module - UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4; 0x5:DDR5 [3:0] - Must be 0x0 for now; - UCHAR ucChannelNum; // Number of channels present in this module config - UCHAR ucChannelWidth; // 0 - 32 bits; 1 - 64 bits - UCHAR ucDensity; // _8Mx32, _16Mx32, _16Mx16, _32Mx16 - UCHAR ucFlag; // To enable/disable functionalities based on memory type - UCHAR ucMisc; // bit0: 0 - single rank; 1 - dual rank; bit2: 0 - burstlength 4, 1 - burstlength 8 - UCHAR ucVREFI; // board dependent parameter - UCHAR ucNPL_RT; // board dependent parameter:NPL round trip delay, used for calculate memory timing parameters - UCHAR ucPreamble; // [7:4] Write Preamble, [3:0] Read Preamble - UCHAR ucMemorySize; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! - // Total memory size in unit of 16MB for CONFIG_MEMSIZE - bit[23:0] zeros - UCHAR ucReserved[3]; - -//compare with V3, we flat the struct by merging ATOM_MEMORY_FORMAT (as is) into V4 as the same level - USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type - USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type - UCHAR ucMemoryVenderID; // Predefined, If not predefined, vendor detection table gets executed - UCHAR ucRefreshRateFactor; // [1:0]=RefreshFactor (00=8ms, 01=16ms, 10=32ms,11=64ms) - UCHAR ucFIFODepth; // FIFO depth supposes to be detected during vendor detection, but if we dont do vendor detection we have to hardcode FIFO Depth - UCHAR ucCDR_Bandwidth; // [0:3]=Read CDR bandwidth, [4:7] - Write CDR Bandwidth - ATOM_MEMORY_TIMING_FORMAT_V1 asMemTiming[5];//Memory Timing block sort from lower clock to higher clock -}ATOM_VRAM_MODULE_V5; - -typedef struct _ATOM_VRAM_INFO_V2 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR ucNumOfVRAMModule; - ATOM_VRAM_MODULE aVramInfo[ATOM_MAX_NUMBER_OF_VRAM_MODULE]; // just for allocation, real number of blocks is in ucNumOfVRAMModule; -}ATOM_VRAM_INFO_V2; - -typedef struct _ATOM_VRAM_INFO_V3 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usMemAdjustTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory vendor specific MC adjust setting - USHORT usMemClkPatchTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory clock specific MC setting - USHORT usRerseved; - UCHAR aVID_PinsShift[9]; // 8 bit strap maximum+terminator - UCHAR ucNumOfVRAMModule; - ATOM_VRAM_MODULE aVramInfo[ATOM_MAX_NUMBER_OF_VRAM_MODULE]; // just for allocation, real number of blocks is in ucNumOfVRAMModule; - ATOM_INIT_REG_BLOCK asMemPatch; // for allocation - // ATOM_INIT_REG_BLOCK aMemAdjust; -}ATOM_VRAM_INFO_V3; - -#define ATOM_VRAM_INFO_LAST ATOM_VRAM_INFO_V3 - -typedef struct _ATOM_VRAM_INFO_V4 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usMemAdjustTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory vendor specific MC adjust setting - USHORT usMemClkPatchTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory clock specific MC setting - USHORT usRerseved; - UCHAR ucMemDQ7_0ByteRemap; // DQ line byte remap, =0: Memory Data line BYTE0, =1: BYTE1, =2: BYTE2, =3: BYTE3 - ULONG ulMemDQ7_0BitRemap; // each DQ line ( 7~0) use 3bits, like: DQ0=Bit[2:0], DQ1:[5:3], ... DQ7:[23:21] - UCHAR ucReservde[4]; - UCHAR ucNumOfVRAMModule; - ATOM_VRAM_MODULE_V4 aVramInfo[ATOM_MAX_NUMBER_OF_VRAM_MODULE]; // just for allocation, real number of blocks is in ucNumOfVRAMModule; - ATOM_INIT_REG_BLOCK asMemPatch; // for allocation - // ATOM_INIT_REG_BLOCK aMemAdjust; -}ATOM_VRAM_INFO_V4; - -typedef struct _ATOM_VRAM_GPIO_DETECTION_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR aVID_PinsShift[9]; //8 bit strap maximum+terminator -}ATOM_VRAM_GPIO_DETECTION_INFO; - - -typedef struct _ATOM_MEMORY_TRAINING_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR ucTrainingLoop; - UCHAR ucReserved[3]; - ATOM_INIT_REG_BLOCK asMemTrainingSetting; -}ATOM_MEMORY_TRAINING_INFO; - - -typedef struct SW_I2C_CNTL_DATA_PARAMETERS -{ - UCHAR ucControl; - UCHAR ucData; - UCHAR ucSatus; - UCHAR ucTemp; -} SW_I2C_CNTL_DATA_PARAMETERS; - -#define SW_I2C_CNTL_DATA_PS_ALLOCATION SW_I2C_CNTL_DATA_PARAMETERS - -typedef struct _SW_I2C_IO_DATA_PARAMETERS -{ - USHORT GPIO_Info; - UCHAR ucAct; - UCHAR ucData; - } SW_I2C_IO_DATA_PARAMETERS; - -#define SW_I2C_IO_DATA_PS_ALLOCATION SW_I2C_IO_DATA_PARAMETERS - -/****************************SW I2C CNTL DEFINITIONS**********************/ -#define SW_I2C_IO_RESET 0 -#define SW_I2C_IO_GET 1 -#define SW_I2C_IO_DRIVE 2 -#define SW_I2C_IO_SET 3 -#define SW_I2C_IO_START 4 - -#define SW_I2C_IO_CLOCK 0 -#define SW_I2C_IO_DATA 0x80 - -#define SW_I2C_IO_ZERO 0 -#define SW_I2C_IO_ONE 0x100 - -#define SW_I2C_CNTL_READ 0 -#define SW_I2C_CNTL_WRITE 1 -#define SW_I2C_CNTL_START 2 -#define SW_I2C_CNTL_STOP 3 -#define SW_I2C_CNTL_OPEN 4 -#define SW_I2C_CNTL_CLOSE 5 -#define SW_I2C_CNTL_WRITE1BIT 6 - -//==============================VESA definition Portion=============================== -#define VESA_OEM_PRODUCT_REV '01.00' -#define VESA_MODE_ATTRIBUTE_MODE_SUPPORT 0xBB //refer to VBE spec p.32, no TTY support -#define VESA_MODE_WIN_ATTRIBUTE 7 -#define VESA_WIN_SIZE 64 - -typedef struct _PTR_32_BIT_STRUCTURE -{ - USHORT Offset16; - USHORT Segment16; -} PTR_32_BIT_STRUCTURE; - -typedef union _PTR_32_BIT_UNION -{ - PTR_32_BIT_STRUCTURE SegmentOffset; - ULONG Ptr32_Bit; -} PTR_32_BIT_UNION; - -typedef struct _VBE_1_2_INFO_BLOCK_UPDATABLE -{ - UCHAR VbeSignature[4]; - USHORT VbeVersion; - PTR_32_BIT_UNION OemStringPtr; - UCHAR Capabilities[4]; - PTR_32_BIT_UNION VideoModePtr; - USHORT TotalMemory; -} VBE_1_2_INFO_BLOCK_UPDATABLE; - - -typedef struct _VBE_2_0_INFO_BLOCK_UPDATABLE -{ - VBE_1_2_INFO_BLOCK_UPDATABLE CommonBlock; - USHORT OemSoftRev; - PTR_32_BIT_UNION OemVendorNamePtr; - PTR_32_BIT_UNION OemProductNamePtr; - PTR_32_BIT_UNION OemProductRevPtr; -} VBE_2_0_INFO_BLOCK_UPDATABLE; - -typedef union _VBE_VERSION_UNION -{ - VBE_2_0_INFO_BLOCK_UPDATABLE VBE_2_0_InfoBlock; - VBE_1_2_INFO_BLOCK_UPDATABLE VBE_1_2_InfoBlock; -} VBE_VERSION_UNION; - -typedef struct _VBE_INFO_BLOCK -{ - VBE_VERSION_UNION UpdatableVBE_Info; - UCHAR Reserved[222]; - UCHAR OemData[256]; -} VBE_INFO_BLOCK; - -typedef struct _VBE_FP_INFO -{ - USHORT HSize; - USHORT VSize; - USHORT FPType; - UCHAR RedBPP; - UCHAR GreenBPP; - UCHAR BlueBPP; - UCHAR ReservedBPP; - ULONG RsvdOffScrnMemSize; - ULONG RsvdOffScrnMEmPtr; - UCHAR Reserved[14]; -} VBE_FP_INFO; - -typedef struct _VESA_MODE_INFO_BLOCK -{ -// Mandatory information for all VBE revisions - USHORT ModeAttributes; // dw ? ; mode attributes - UCHAR WinAAttributes; // db ? ; window A attributes - UCHAR WinBAttributes; // db ? ; window B attributes - USHORT WinGranularity; // dw ? ; window granularity - USHORT WinSize; // dw ? ; window size - USHORT WinASegment; // dw ? ; window A start segment - USHORT WinBSegment; // dw ? ; window B start segment - ULONG WinFuncPtr; // dd ? ; real mode pointer to window function - USHORT BytesPerScanLine;// dw ? ; bytes per scan line - -//; Mandatory information for VBE 1.2 and above - USHORT XResolution; // dw ? ; horizontal resolution in pixels or characters - USHORT YResolution; // dw ? ; vertical resolution in pixels or characters - UCHAR XCharSize; // db ? ; character cell width in pixels - UCHAR YCharSize; // db ? ; character cell height in pixels - UCHAR NumberOfPlanes; // db ? ; number of memory planes - UCHAR BitsPerPixel; // db ? ; bits per pixel - UCHAR NumberOfBanks; // db ? ; number of banks - UCHAR MemoryModel; // db ? ; memory model type - UCHAR BankSize; // db ? ; bank size in KB - UCHAR NumberOfImagePages;// db ? ; number of images - UCHAR ReservedForPageFunction;//db 1 ; reserved for page function - -//; Direct Color fields(required for direct/6 and YUV/7 memory models) - UCHAR RedMaskSize; // db ? ; size of direct color red mask in bits - UCHAR RedFieldPosition; // db ? ; bit position of lsb of red mask - UCHAR GreenMaskSize; // db ? ; size of direct color green mask in bits - UCHAR GreenFieldPosition; // db ? ; bit position of lsb of green mask - UCHAR BlueMaskSize; // db ? ; size of direct color blue mask in bits - UCHAR BlueFieldPosition; // db ? ; bit position of lsb of blue mask - UCHAR RsvdMaskSize; // db ? ; size of direct color reserved mask in bits - UCHAR RsvdFieldPosition; // db ? ; bit position of lsb of reserved mask - UCHAR DirectColorModeInfo;// db ? ; direct color mode attributes - -//; Mandatory information for VBE 2.0 and above - ULONG PhysBasePtr; // dd ? ; physical address for flat memory frame buffer - ULONG Reserved_1; // dd 0 ; reserved - always set to 0 - USHORT Reserved_2; // dw 0 ; reserved - always set to 0 - -//; Mandatory information for VBE 3.0 and above - USHORT LinBytesPerScanLine; // dw ? ; bytes per scan line for linear modes - UCHAR BnkNumberOfImagePages;// db ? ; number of images for banked modes - UCHAR LinNumberOfImagPages; // db ? ; number of images for linear modes - UCHAR LinRedMaskSize; // db ? ; size of direct color red mask(linear modes) - UCHAR LinRedFieldPosition; // db ? ; bit position of lsb of red mask(linear modes) - UCHAR LinGreenMaskSize; // db ? ; size of direct color green mask(linear modes) - UCHAR LinGreenFieldPosition;// db ? ; bit position of lsb of green mask(linear modes) - UCHAR LinBlueMaskSize; // db ? ; size of direct color blue mask(linear modes) - UCHAR LinBlueFieldPosition; // db ? ; bit position of lsb of blue mask(linear modes) - UCHAR LinRsvdMaskSize; // db ? ; size of direct color reserved mask(linear modes) - UCHAR LinRsvdFieldPosition; // db ? ; bit position of lsb of reserved mask(linear modes) - ULONG MaxPixelClock; // dd ? ; maximum pixel clock(in Hz) for graphics mode - UCHAR Reserved; // db 190 dup (0) -} VESA_MODE_INFO_BLOCK; - -// BIOS function CALLS -#define ATOM_BIOS_EXTENDED_FUNCTION_CODE 0xA0 // ATI Extended Function code -#define ATOM_BIOS_FUNCTION_COP_MODE 0x00 -#define ATOM_BIOS_FUNCTION_SHORT_QUERY1 0x04 -#define ATOM_BIOS_FUNCTION_SHORT_QUERY2 0x05 -#define ATOM_BIOS_FUNCTION_SHORT_QUERY3 0x06 -#define ATOM_BIOS_FUNCTION_GET_DDC 0x0B -#define ATOM_BIOS_FUNCTION_ASIC_DSTATE 0x0E -#define ATOM_BIOS_FUNCTION_DEBUG_PLAY 0x0F -#define ATOM_BIOS_FUNCTION_STV_STD 0x16 -#define ATOM_BIOS_FUNCTION_DEVICE_DET 0x17 -#define ATOM_BIOS_FUNCTION_DEVICE_SWITCH 0x18 - -#define ATOM_BIOS_FUNCTION_PANEL_CONTROL 0x82 -#define ATOM_BIOS_FUNCTION_OLD_DEVICE_DET 0x83 -#define ATOM_BIOS_FUNCTION_OLD_DEVICE_SWITCH 0x84 -#define ATOM_BIOS_FUNCTION_HW_ICON 0x8A -#define ATOM_BIOS_FUNCTION_SET_CMOS 0x8B -#define SUB_FUNCTION_UPDATE_DISPLAY_INFO 0x8000 // Sub function 80 -#define SUB_FUNCTION_UPDATE_EXPANSION_INFO 0x8100 // Sub function 80 - -#define ATOM_BIOS_FUNCTION_DISPLAY_INFO 0x8D -#define ATOM_BIOS_FUNCTION_DEVICE_ON_OFF 0x8E -#define ATOM_BIOS_FUNCTION_VIDEO_STATE 0x8F -#define ATOM_SUB_FUNCTION_GET_CRITICAL_STATE 0x0300 // Sub function 03 -#define ATOM_SUB_FUNCTION_GET_LIDSTATE 0x0700 // Sub function 7 -#define ATOM_SUB_FUNCTION_THERMAL_STATE_NOTICE 0x1400 // Notify caller the current thermal state -#define ATOM_SUB_FUNCTION_CRITICAL_STATE_NOTICE 0x8300 // Notify caller the current critical state -#define ATOM_SUB_FUNCTION_SET_LIDSTATE 0x8500 // Sub function 85 -#define ATOM_SUB_FUNCTION_GET_REQ_DISPLAY_FROM_SBIOS_MODE 0x8900// Sub function 89 -#define ATOM_SUB_FUNCTION_INFORM_ADC_SUPPORT 0x9400 // Notify caller that ADC is supported - - -#define ATOM_BIOS_FUNCTION_VESA_DPMS 0x4F10 // Set DPMS -#define ATOM_SUB_FUNCTION_SET_DPMS 0x0001 // BL: Sub function 01 -#define ATOM_SUB_FUNCTION_GET_DPMS 0x0002 // BL: Sub function 02 -#define ATOM_PARAMETER_VESA_DPMS_ON 0x0000 // BH Parameter for DPMS ON. -#define ATOM_PARAMETER_VESA_DPMS_STANDBY 0x0100 // BH Parameter for DPMS STANDBY -#define ATOM_PARAMETER_VESA_DPMS_SUSPEND 0x0200 // BH Parameter for DPMS SUSPEND -#define ATOM_PARAMETER_VESA_DPMS_OFF 0x0400 // BH Parameter for DPMS OFF -#define ATOM_PARAMETER_VESA_DPMS_REDUCE_ON 0x0800 // BH Parameter for DPMS REDUCE ON (NOT SUPPORTED) - -#define ATOM_BIOS_RETURN_CODE_MASK 0x0000FF00L -#define ATOM_BIOS_REG_HIGH_MASK 0x0000FF00L -#define ATOM_BIOS_REG_LOW_MASK 0x000000FFL - -// structure used for VBIOS only - -//DispOutInfoTable -typedef struct _ASIC_TRANSMITTER_INFO -{ - USHORT usTransmitterObjId; - USHORT usSupportDevice; - UCHAR ucTransmitterCmdTblId; - UCHAR ucConfig; - UCHAR ucEncoderID; //available 1st encoder ( default ) - UCHAR ucOptionEncoderID; //available 2nd encoder ( optional ) - UCHAR uc2ndEncoderID; - UCHAR ucReserved; -}ASIC_TRANSMITTER_INFO; - -typedef struct _ASIC_ENCODER_INFO -{ - UCHAR ucEncoderID; - UCHAR ucEncoderConfig; - USHORT usEncoderCmdTblId; -}ASIC_ENCODER_INFO; - -typedef struct _ATOM_DISP_OUT_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT ptrTransmitterInfo; - USHORT ptrEncoderInfo; - ASIC_TRANSMITTER_INFO asTransmitterInfo[1]; - ASIC_ENCODER_INFO asEncoderInfo[1]; -}ATOM_DISP_OUT_INFO; - -// DispDevicePriorityInfo -typedef struct _ATOM_DISPLAY_DEVICE_PRIORITY_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT asDevicePriority[16]; -}ATOM_DISPLAY_DEVICE_PRIORITY_INFO; - -//ProcessAuxChannelTransactionTable -typedef struct _PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS -{ - USHORT lpAuxRequest; - USHORT lpDataOut; - UCHAR ucChannelID; - union - { - UCHAR ucReplyStatus; - UCHAR ucDelay; - }; - UCHAR ucDataOutLen; - UCHAR ucReserved; -}PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS; - -#define PROCESS_AUX_CHANNEL_TRANSACTION_PS_ALLOCATION PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS - -//GetSinkType - -typedef struct _DP_ENCODER_SERVICE_PARAMETERS -{ - USHORT ucLinkClock; - union - { - UCHAR ucConfig; // for DP training command - UCHAR ucI2cId; // use for GET_SINK_TYPE command - }; - UCHAR ucAction; - UCHAR ucStatus; - UCHAR ucLaneNum; - UCHAR ucReserved[2]; -}DP_ENCODER_SERVICE_PARAMETERS; - -// ucAction -#define ATOM_DP_ACTION_GET_SINK_TYPE 0x01 -#define ATOM_DP_ACTION_TRAINING_START 0x02 -#define ATOM_DP_ACTION_TRAINING_COMPLETE 0x03 -#define ATOM_DP_ACTION_TRAINING_PATTERN_SEL 0x04 -#define ATOM_DP_ACTION_SET_VSWING_PREEMP 0x05 -#define ATOM_DP_ACTION_GET_VSWING_PREEMP 0x06 -#define ATOM_DP_ACTION_BLANKING 0x07 - -// ucConfig -#define ATOM_DP_CONFIG_ENCODER_SEL_MASK 0x03 -#define ATOM_DP_CONFIG_DIG1_ENCODER 0x00 -#define ATOM_DP_CONFIG_DIG2_ENCODER 0x01 -#define ATOM_DP_CONFIG_EXTERNAL_ENCODER 0x02 -#define ATOM_DP_CONFIG_LINK_SEL_MASK 0x04 -#define ATOM_DP_CONFIG_LINK_A 0x00 -#define ATOM_DP_CONFIG_LINK_B 0x04 - -#define DP_ENCODER_SERVICE_PS_ALLOCATION WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS - -// DP_TRAINING_TABLE -#define DPCD_SET_LINKRATE_LANENUM_PATTERN1_TBL_ADDR ATOM_DP_TRAINING_TBL_ADDR -#define DPCD_SET_SS_CNTL_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 8 ) -#define DPCD_SET_LANE_VSWING_PREEMP_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 16 ) -#define DPCD_SET_TRAINING_PATTERN0_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 24 ) -#define DPCD_SET_TRAINING_PATTERN2_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 32) -#define DPCD_GET_LINKRATE_LANENUM_SS_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 40) -#define DPCD_GET_LANE_STATUS_ADJUST_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 48) -#define DP_I2C_AUX_DDC_WRITE_START_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 60) -#define DP_I2C_AUX_DDC_WRITE_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 64) -#define DP_I2C_AUX_DDC_READ_START_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 72) -#define DP_I2C_AUX_DDC_READ_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 76) -#define DP_I2C_AUX_DDC_READ_END_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 80) - - -typedef struct _PROCESS_I2C_CHANNEL_TRANSACTION_PARAMETERS -{ - UCHAR ucI2CSpeed; - union - { - UCHAR ucRegIndex; - UCHAR ucStatus; - }; - USHORT lpI2CDataOut; - UCHAR ucFlag; - UCHAR ucTransBytes; - UCHAR ucSlaveAddr; - UCHAR ucLineNumber; -}PROCESS_I2C_CHANNEL_TRANSACTION_PARAMETERS; - -#define PROCESS_I2C_CHANNEL_TRANSACTION_PS_ALLOCATION PROCESS_I2C_CHANNEL_TRANSACTION_PARAMETERS - -//ucFlag -#define HW_I2C_WRITE 1 -#define HW_I2C_READ 0 - - -/****************************************************************************/ -//Portion VI: Definitinos being oboselete -/****************************************************************************/ - -//========================================================================================== -//Remove the definitions below when driver is ready! -typedef struct _ATOM_DAC_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usMaxFrequency; // in 10kHz unit - USHORT usReserved; -}ATOM_DAC_INFO; - - -typedef struct _COMPASSIONATE_DATA -{ - ATOM_COMMON_TABLE_HEADER sHeader; - - //============================== DAC1 portion - UCHAR ucDAC1_BG_Adjustment; - UCHAR ucDAC1_DAC_Adjustment; - USHORT usDAC1_FORCE_Data; - //============================== DAC2 portion - UCHAR ucDAC2_CRT2_BG_Adjustment; - UCHAR ucDAC2_CRT2_DAC_Adjustment; - USHORT usDAC2_CRT2_FORCE_Data; - USHORT usDAC2_CRT2_MUX_RegisterIndex; - UCHAR ucDAC2_CRT2_MUX_RegisterInfo; //Bit[4:0]=Bit position,Bit[7]=1:Active High;=0 Active Low - UCHAR ucDAC2_NTSC_BG_Adjustment; - UCHAR ucDAC2_NTSC_DAC_Adjustment; - USHORT usDAC2_TV1_FORCE_Data; - USHORT usDAC2_TV1_MUX_RegisterIndex; - UCHAR ucDAC2_TV1_MUX_RegisterInfo; //Bit[4:0]=Bit position,Bit[7]=1:Active High;=0 Active Low - UCHAR ucDAC2_CV_BG_Adjustment; - UCHAR ucDAC2_CV_DAC_Adjustment; - USHORT usDAC2_CV_FORCE_Data; - USHORT usDAC2_CV_MUX_RegisterIndex; - UCHAR ucDAC2_CV_MUX_RegisterInfo; //Bit[4:0]=Bit position,Bit[7]=1:Active High;=0 Active Low - UCHAR ucDAC2_PAL_BG_Adjustment; - UCHAR ucDAC2_PAL_DAC_Adjustment; - USHORT usDAC2_TV2_FORCE_Data; -}COMPASSIONATE_DATA; - -/****************************Supported Device Info Table Definitions**********************/ -// ucConnectInfo: -// [7:4] - connector type -// = 1 - VGA connector -// = 2 - DVI-I -// = 3 - DVI-D -// = 4 - DVI-A -// = 5 - SVIDEO -// = 6 - COMPOSITE -// = 7 - LVDS -// = 8 - DIGITAL LINK -// = 9 - SCART -// = 0xA - HDMI_type A -// = 0xB - HDMI_type B -// = 0xE - Special case1 (DVI+DIN) -// Others=TBD -// [3:0] - DAC Associated -// = 0 - no DAC -// = 1 - DACA -// = 2 - DACB -// = 3 - External DAC -// Others=TBD -// - -typedef struct _ATOM_CONNECTOR_INFO -{ - UCHAR bfAssociatedDAC:4; - UCHAR bfConnectorType:4; -}ATOM_CONNECTOR_INFO; - -typedef union _ATOM_CONNECTOR_INFO_ACCESS -{ - ATOM_CONNECTOR_INFO sbfAccess; - UCHAR ucAccess; -}ATOM_CONNECTOR_INFO_ACCESS; - -typedef struct _ATOM_CONNECTOR_INFO_I2C -{ - ATOM_CONNECTOR_INFO_ACCESS sucConnectorInfo; - ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; -}ATOM_CONNECTOR_INFO_I2C; - - -typedef struct _ATOM_SUPPORTED_DEVICES_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usDeviceSupport; - ATOM_CONNECTOR_INFO_I2C asConnInfo[ATOM_MAX_SUPPORTED_DEVICE_INFO]; -}ATOM_SUPPORTED_DEVICES_INFO; - -#define NO_INT_SRC_MAPPED 0xFF - -typedef struct _ATOM_CONNECTOR_INC_SRC_BITMAP -{ - UCHAR ucIntSrcBitmap; -}ATOM_CONNECTOR_INC_SRC_BITMAP; - -typedef struct _ATOM_SUPPORTED_DEVICES_INFO_2 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usDeviceSupport; - ATOM_CONNECTOR_INFO_I2C asConnInfo[ATOM_MAX_SUPPORTED_DEVICE_INFO_2]; - ATOM_CONNECTOR_INC_SRC_BITMAP asIntSrcInfo[ATOM_MAX_SUPPORTED_DEVICE_INFO_2]; -}ATOM_SUPPORTED_DEVICES_INFO_2; - -typedef struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usDeviceSupport; - ATOM_CONNECTOR_INFO_I2C asConnInfo[ATOM_MAX_SUPPORTED_DEVICE]; - ATOM_CONNECTOR_INC_SRC_BITMAP asIntSrcInfo[ATOM_MAX_SUPPORTED_DEVICE]; -}ATOM_SUPPORTED_DEVICES_INFO_2d1; - -#define ATOM_SUPPORTED_DEVICES_INFO_LAST ATOM_SUPPORTED_DEVICES_INFO_2d1 - - - -typedef struct _ATOM_MISC_CONTROL_INFO -{ - USHORT usFrequency; - UCHAR ucPLL_ChargePump; // PLL charge-pump gain control - UCHAR ucPLL_DutyCycle; // PLL duty cycle control - UCHAR ucPLL_VCO_Gain; // PLL VCO gain control - UCHAR ucPLL_VoltageSwing; // PLL driver voltage swing control -}ATOM_MISC_CONTROL_INFO; - - -#define ATOM_MAX_MISC_INFO 4 - -typedef struct _ATOM_TMDS_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usMaxFrequency; // in 10Khz - ATOM_MISC_CONTROL_INFO asMiscInfo[ATOM_MAX_MISC_INFO]; -}ATOM_TMDS_INFO; - - -typedef struct _ATOM_ENCODER_ANALOG_ATTRIBUTE -{ - UCHAR ucTVStandard; //Same as TV standards defined above, - UCHAR ucPadding[1]; -}ATOM_ENCODER_ANALOG_ATTRIBUTE; - -typedef struct _ATOM_ENCODER_DIGITAL_ATTRIBUTE -{ - UCHAR ucAttribute; //Same as other digital encoder attributes defined above - UCHAR ucPadding[1]; -}ATOM_ENCODER_DIGITAL_ATTRIBUTE; - -typedef union _ATOM_ENCODER_ATTRIBUTE -{ - ATOM_ENCODER_ANALOG_ATTRIBUTE sAlgAttrib; - ATOM_ENCODER_DIGITAL_ATTRIBUTE sDigAttrib; -}ATOM_ENCODER_ATTRIBUTE; - - -typedef struct _DVO_ENCODER_CONTROL_PARAMETERS -{ - USHORT usPixelClock; - USHORT usEncoderID; - UCHAR ucDeviceType; //Use ATOM_DEVICE_xxx1_Index to indicate device type only. - UCHAR ucAction; //ATOM_ENABLE/ATOM_DISABLE/ATOM_HPD_INIT - ATOM_ENCODER_ATTRIBUTE usDevAttr; -}DVO_ENCODER_CONTROL_PARAMETERS; - -typedef struct _DVO_ENCODER_CONTROL_PS_ALLOCATION -{ - DVO_ENCODER_CONTROL_PARAMETERS sDVOEncoder; - WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; //Caller doesn't need to init this portion -}DVO_ENCODER_CONTROL_PS_ALLOCATION; - - -#define ATOM_XTMDS_ASIC_SI164_ID 1 -#define ATOM_XTMDS_ASIC_SI178_ID 2 -#define ATOM_XTMDS_ASIC_TFP513_ID 3 -#define ATOM_XTMDS_SUPPORTED_SINGLELINK 0x00000001 -#define ATOM_XTMDS_SUPPORTED_DUALLINK 0x00000002 -#define ATOM_XTMDS_MVPU_FPGA 0x00000004 - - -typedef struct _ATOM_XTMDS_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - USHORT usSingleLinkMaxFrequency; - ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; //Point the ID on which I2C is used to control external chip - UCHAR ucXtransimitterID; - UCHAR ucSupportedLink; // Bit field, bit0=1, single link supported;bit1=1,dual link supported - UCHAR ucSequnceAlterID; // Even with the same external TMDS asic, it's possible that the program seqence alters - // due to design. This ID is used to alert driver that the sequence is not "standard"! - UCHAR ucMasterAddress; // Address to control Master xTMDS Chip - UCHAR ucSlaveAddress; // Address to control Slave xTMDS Chip -}ATOM_XTMDS_INFO; - -typedef struct _DFP_DPMS_STATUS_CHANGE_PARAMETERS -{ - UCHAR ucEnable; // ATOM_ENABLE=On or ATOM_DISABLE=Off - UCHAR ucDevice; // ATOM_DEVICE_DFP1_INDEX.... - UCHAR ucPadding[2]; -}DFP_DPMS_STATUS_CHANGE_PARAMETERS; - -/****************************Legacy Power Play Table Definitions **********************/ - -//Definitions for ulPowerPlayMiscInfo -#define ATOM_PM_MISCINFO_SPLIT_CLOCK 0x00000000L -#define ATOM_PM_MISCINFO_USING_MCLK_SRC 0x00000001L -#define ATOM_PM_MISCINFO_USING_SCLK_SRC 0x00000002L - -#define ATOM_PM_MISCINFO_VOLTAGE_DROP_SUPPORT 0x00000004L -#define ATOM_PM_MISCINFO_VOLTAGE_DROP_ACTIVE_HIGH 0x00000008L - -#define ATOM_PM_MISCINFO_LOAD_PERFORMANCE_EN 0x00000010L - -#define ATOM_PM_MISCINFO_ENGINE_CLOCK_CONTRL_EN 0x00000020L -#define ATOM_PM_MISCINFO_MEMORY_CLOCK_CONTRL_EN 0x00000040L -#define ATOM_PM_MISCINFO_PROGRAM_VOLTAGE 0x00000080L //When this bit set, ucVoltageDropIndex is not an index for GPIO pin, but a voltage ID that SW needs program - -#define ATOM_PM_MISCINFO_ASIC_REDUCED_SPEED_SCLK_EN 0x00000100L -#define ATOM_PM_MISCINFO_ASIC_DYNAMIC_VOLTAGE_EN 0x00000200L -#define ATOM_PM_MISCINFO_ASIC_SLEEP_MODE_EN 0x00000400L -#define ATOM_PM_MISCINFO_LOAD_BALANCE_EN 0x00000800L -#define ATOM_PM_MISCINFO_DEFAULT_DC_STATE_ENTRY_TRUE 0x00001000L -#define ATOM_PM_MISCINFO_DEFAULT_LOW_DC_STATE_ENTRY_TRUE 0x00002000L -#define ATOM_PM_MISCINFO_LOW_LCD_REFRESH_RATE 0x00004000L - -#define ATOM_PM_MISCINFO_DRIVER_DEFAULT_MODE 0x00008000L -#define ATOM_PM_MISCINFO_OVER_CLOCK_MODE 0x00010000L -#define ATOM_PM_MISCINFO_OVER_DRIVE_MODE 0x00020000L -#define ATOM_PM_MISCINFO_POWER_SAVING_MODE 0x00040000L -#define ATOM_PM_MISCINFO_THERMAL_DIODE_MODE 0x00080000L - -#define ATOM_PM_MISCINFO_FRAME_MODULATION_MASK 0x00300000L //0-FM Disable, 1-2 level FM, 2-4 level FM, 3-Reserved -#define ATOM_PM_MISCINFO_FRAME_MODULATION_SHIFT 20 - -#define ATOM_PM_MISCINFO_DYN_CLK_3D_IDLE 0x00400000L -#define ATOM_PM_MISCINFO_DYNAMIC_CLOCK_DIVIDER_BY_2 0x00800000L -#define ATOM_PM_MISCINFO_DYNAMIC_CLOCK_DIVIDER_BY_4 0x01000000L -#define ATOM_PM_MISCINFO_DYNAMIC_HDP_BLOCK_EN 0x02000000L //When set, Dynamic -#define ATOM_PM_MISCINFO_DYNAMIC_MC_HOST_BLOCK_EN 0x04000000L //When set, Dynamic -#define ATOM_PM_MISCINFO_3D_ACCELERATION_EN 0x08000000L //When set, This mode is for acceleated 3D mode - -#define ATOM_PM_MISCINFO_POWERPLAY_SETTINGS_GROUP_MASK 0x70000000L //1-Optimal Battery Life Group, 2-High Battery, 3-Balanced, 4-High Performance, 5- Optimal Performance (Default state with Default clocks) -#define ATOM_PM_MISCINFO_POWERPLAY_SETTINGS_GROUP_SHIFT 28 -#define ATOM_PM_MISCINFO_ENABLE_BACK_BIAS 0x80000000L - -#define ATOM_PM_MISCINFO2_SYSTEM_AC_LITE_MODE 0x00000001L -#define ATOM_PM_MISCINFO2_MULTI_DISPLAY_SUPPORT 0x00000002L -#define ATOM_PM_MISCINFO2_DYNAMIC_BACK_BIAS_EN 0x00000004L -#define ATOM_PM_MISCINFO2_FS3D_OVERDRIVE_INFO 0x00000008L -#define ATOM_PM_MISCINFO2_FORCEDLOWPWR_MODE 0x00000010L -#define ATOM_PM_MISCINFO2_VDDCI_DYNAMIC_VOLTAGE_EN 0x00000020L -#define ATOM_PM_MISCINFO2_VIDEO_PLAYBACK_CAPABLE 0x00000040L //If this bit is set in multi-pp mode, then driver will pack up one with the minior power consumption. - //If it's not set in any pp mode, driver will use its default logic to pick a pp mode in video playback -#define ATOM_PM_MISCINFO2_NOT_VALID_ON_DC 0x00000080L -#define ATOM_PM_MISCINFO2_STUTTER_MODE_EN 0x00000100L -#define ATOM_PM_MISCINFO2_UVD_SUPPORT_MODE 0x00000200L - -//ucTableFormatRevision=1 -//ucTableContentRevision=1 -typedef struct _ATOM_POWERMODE_INFO -{ - ULONG ulMiscInfo; //The power level should be arranged in ascending order - ULONG ulReserved1; // must set to 0 - ULONG ulReserved2; // must set to 0 - USHORT usEngineClock; - USHORT usMemoryClock; - UCHAR ucVoltageDropIndex; // index to GPIO table - UCHAR ucSelectedPanel_RefreshRate;// panel refresh rate - UCHAR ucMinTemperature; - UCHAR ucMaxTemperature; - UCHAR ucNumPciELanes; // number of PCIE lanes -}ATOM_POWERMODE_INFO; - -//ucTableFormatRevision=2 -//ucTableContentRevision=1 -typedef struct _ATOM_POWERMODE_INFO_V2 -{ - ULONG ulMiscInfo; //The power level should be arranged in ascending order - ULONG ulMiscInfo2; - ULONG ulEngineClock; - ULONG ulMemoryClock; - UCHAR ucVoltageDropIndex; // index to GPIO table - UCHAR ucSelectedPanel_RefreshRate;// panel refresh rate - UCHAR ucMinTemperature; - UCHAR ucMaxTemperature; - UCHAR ucNumPciELanes; // number of PCIE lanes -}ATOM_POWERMODE_INFO_V2; - -//ucTableFormatRevision=2 -//ucTableContentRevision=2 -typedef struct _ATOM_POWERMODE_INFO_V3 -{ - ULONG ulMiscInfo; //The power level should be arranged in ascending order - ULONG ulMiscInfo2; - ULONG ulEngineClock; - ULONG ulMemoryClock; - UCHAR ucVoltageDropIndex; // index to Core (VDDC) votage table - UCHAR ucSelectedPanel_RefreshRate;// panel refresh rate - UCHAR ucMinTemperature; - UCHAR ucMaxTemperature; - UCHAR ucNumPciELanes; // number of PCIE lanes - UCHAR ucVDDCI_VoltageDropIndex; // index to VDDCI votage table -}ATOM_POWERMODE_INFO_V3; - - -#define ATOM_MAX_NUMBEROF_POWER_BLOCK 8 - -#define ATOM_PP_OVERDRIVE_INTBITMAP_AUXWIN 0x01 -#define ATOM_PP_OVERDRIVE_INTBITMAP_OVERDRIVE 0x02 - -#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_LM63 0x01 -#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_ADM1032 0x02 -#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_ADM1030 0x03 -#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_MUA6649 0x04 -#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_LM64 0x05 -#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_F75375 0x06 -#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_ASC7512 0x07 // Andigilog - - -typedef struct _ATOM_POWERPLAY_INFO -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR ucOverdriveThermalController; - UCHAR ucOverdriveI2cLine; - UCHAR ucOverdriveIntBitmap; - UCHAR ucOverdriveControllerAddress; - UCHAR ucSizeOfPowerModeEntry; - UCHAR ucNumOfPowerModeEntries; - ATOM_POWERMODE_INFO asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; -}ATOM_POWERPLAY_INFO; - -typedef struct _ATOM_POWERPLAY_INFO_V2 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR ucOverdriveThermalController; - UCHAR ucOverdriveI2cLine; - UCHAR ucOverdriveIntBitmap; - UCHAR ucOverdriveControllerAddress; - UCHAR ucSizeOfPowerModeEntry; - UCHAR ucNumOfPowerModeEntries; - ATOM_POWERMODE_INFO_V2 asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; -}ATOM_POWERPLAY_INFO_V2; - -typedef struct _ATOM_POWERPLAY_INFO_V3 -{ - ATOM_COMMON_TABLE_HEADER sHeader; - UCHAR ucOverdriveThermalController; - UCHAR ucOverdriveI2cLine; - UCHAR ucOverdriveIntBitmap; - UCHAR ucOverdriveControllerAddress; - UCHAR ucSizeOfPowerModeEntry; - UCHAR ucNumOfPowerModeEntries; - ATOM_POWERMODE_INFO_V3 asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; -}ATOM_POWERPLAY_INFO_V3; - -/* New PPlib */ -/**************************************************************************/ -typedef struct _ATOM_PPLIB_THERMALCONTROLLER - -{ - UCHAR ucType; // one of ATOM_PP_THERMALCONTROLLER_* - UCHAR ucI2cLine; // as interpreted by DAL I2C - UCHAR ucI2cAddress; - UCHAR ucFanParameters; // Fan Control Parameters. - UCHAR ucFanMinRPM; // Fan Minimum RPM (hundreds) -- for display purposes only. - UCHAR ucFanMaxRPM; // Fan Maximum RPM (hundreds) -- for display purposes only. - UCHAR ucReserved; // ---- - UCHAR ucFlags; // to be defined -} ATOM_PPLIB_THERMALCONTROLLER; - -#define ATOM_PP_FANPARAMETERS_TACHOMETER_PULSES_PER_REVOLUTION_MASK 0x0f -#define ATOM_PP_FANPARAMETERS_NOFAN 0x80 // No fan is connected to this controller. - -#define ATOM_PP_THERMALCONTROLLER_NONE 0 -#define ATOM_PP_THERMALCONTROLLER_LM63 1 // Not used by PPLib -#define ATOM_PP_THERMALCONTROLLER_ADM1032 2 // Not used by PPLib -#define ATOM_PP_THERMALCONTROLLER_ADM1030 3 // Not used by PPLib -#define ATOM_PP_THERMALCONTROLLER_MUA6649 4 // Not used by PPLib -#define ATOM_PP_THERMALCONTROLLER_LM64 5 -#define ATOM_PP_THERMALCONTROLLER_F75375 6 // Not used by PPLib -#define ATOM_PP_THERMALCONTROLLER_RV6xx 7 -#define ATOM_PP_THERMALCONTROLLER_RV770 8 -#define ATOM_PP_THERMALCONTROLLER_ADT7473 9 - -typedef struct _ATOM_PPLIB_STATE -{ - UCHAR ucNonClockStateIndex; - UCHAR ucClockStateIndices[1]; // variable-sized -} ATOM_PPLIB_STATE; - -//// ATOM_PPLIB_POWERPLAYTABLE::ulPlatformCaps -#define ATOM_PP_PLATFORM_CAP_BACKBIAS 1 -#define ATOM_PP_PLATFORM_CAP_POWERPLAY 2 -#define ATOM_PP_PLATFORM_CAP_SBIOSPOWERSOURCE 4 -#define ATOM_PP_PLATFORM_CAP_ASPM_L0s 8 -#define ATOM_PP_PLATFORM_CAP_ASPM_L1 16 -#define ATOM_PP_PLATFORM_CAP_HARDWAREDC 32 -#define ATOM_PP_PLATFORM_CAP_GEMINIPRIMARY 64 -#define ATOM_PP_PLATFORM_CAP_STEPVDDC 128 -#define ATOM_PP_PLATFORM_CAP_VOLTAGECONTROL 256 -#define ATOM_PP_PLATFORM_CAP_SIDEPORTCONTROL 512 -#define ATOM_PP_PLATFORM_CAP_TURNOFFPLL_ASPML1 1024 -#define ATOM_PP_PLATFORM_CAP_HTLINKCONTROL 2048 - -typedef struct _ATOM_PPLIB_POWERPLAYTABLE -{ - ATOM_COMMON_TABLE_HEADER sHeader; - - UCHAR ucDataRevision; - - UCHAR ucNumStates; - UCHAR ucStateEntrySize; - UCHAR ucClockInfoSize; - UCHAR ucNonClockSize; - - // offset from start of this table to array of ucNumStates ATOM_PPLIB_STATE structures - USHORT usStateArrayOffset; - - // offset from start of this table to array of ASIC-specific structures, - // currently ATOM_PPLIB_CLOCK_INFO. - USHORT usClockInfoArrayOffset; - - // offset from start of this table to array of ATOM_PPLIB_NONCLOCK_INFO - USHORT usNonClockInfoArrayOffset; - - USHORT usBackbiasTime; // in microseconds - USHORT usVoltageTime; // in microseconds - USHORT usTableSize; //the size of this structure, or the extended structure - - ULONG ulPlatformCaps; // See ATOM_PPLIB_CAPS_* - - ATOM_PPLIB_THERMALCONTROLLER sThermalController; - - USHORT usBootClockInfoOffset; - USHORT usBootNonClockInfoOffset; - -} ATOM_PPLIB_POWERPLAYTABLE; - -//// ATOM_PPLIB_NONCLOCK_INFO::usClassification -#define ATOM_PPLIB_CLASSIFICATION_UI_MASK 0x0007 -#define ATOM_PPLIB_CLASSIFICATION_UI_SHIFT 0 -#define ATOM_PPLIB_CLASSIFICATION_UI_NONE 0 -#define ATOM_PPLIB_CLASSIFICATION_UI_BATTERY 1 -#define ATOM_PPLIB_CLASSIFICATION_UI_BALANCED 3 -#define ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE 5 -// 2, 4, 6, 7 are reserved - -#define ATOM_PPLIB_CLASSIFICATION_BOOT 0x0008 -#define ATOM_PPLIB_CLASSIFICATION_THERMAL 0x0010 -#define ATOM_PPLIB_CLASSIFICATION_LIMITEDPOWERSOURCE 0x0020 -#define ATOM_PPLIB_CLASSIFICATION_REST 0x0040 -#define ATOM_PPLIB_CLASSIFICATION_FORCED 0x0080 -#define ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE 0x0100 -#define ATOM_PPLIB_CLASSIFICATION_OVERDRIVETEMPLATE 0x0200 -#define ATOM_PPLIB_CLASSIFICATION_UVDSTATE 0x0400 -#define ATOM_PPLIB_CLASSIFICATION_3DLOW 0x0800 -#define ATOM_PPLIB_CLASSIFICATION_ACPI 0x1000 -// remaining 3 bits are reserved - -//// ATOM_PPLIB_NONCLOCK_INFO::ulCapsAndSettings -#define ATOM_PPLIB_SINGLE_DISPLAY_ONLY 0x00000001 -#define ATOM_PPLIB_SUPPORTS_VIDEO_PLAYBACK 0x00000002 - -// 0 is 2.5Gb/s, 1 is 5Gb/s -#define ATOM_PPLIB_PCIE_LINK_SPEED_MASK 0x00000004 -#define ATOM_PPLIB_PCIE_LINK_SPEED_SHIFT 2 - -// lanes - 1: 1, 2, 4, 8, 12, 16 permitted by PCIE spec -#define ATOM_PPLIB_PCIE_LINK_WIDTH_MASK 0x000000F8 -#define ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT 3 - -// lookup into reduced refresh-rate table -#define ATOM_PPLIB_LIMITED_REFRESHRATE_VALUE_MASK 0x00000F00 -#define ATOM_PPLIB_LIMITED_REFRESHRATE_VALUE_SHIFT 8 - -#define ATOM_PPLIB_LIMITED_REFRESHRATE_UNLIMITED 0 -#define ATOM_PPLIB_LIMITED_REFRESHRATE_50HZ 1 -// 2-15 TBD as needed. - -#define ATOM_PPLIB_SOFTWARE_DISABLE_LOADBALANCING 0x00001000 -#define ATOM_PPLIB_SOFTWARE_ENABLE_SLEEP_FOR_TIMESTAMPS 0x00002000 -#define ATOM_PPLIB_ENABLE_VARIBRIGHT 0x00008000 - -#define ATOM_PPLIB_DISALLOW_ON_DC 0x00004000 - -// Contained in an array starting at the offset -// in ATOM_PPLIB_POWERPLAYTABLE::usNonClockInfoArrayOffset. -// referenced from ATOM_PPLIB_STATE_INFO::ucNonClockStateIndex -typedef struct _ATOM_PPLIB_NONCLOCK_INFO -{ - USHORT usClassification; - UCHAR ucMinTemperature; - UCHAR ucMaxTemperature; - ULONG ulCapsAndSettings; - UCHAR ucRequiredPower; - UCHAR ucUnused1[3]; -} ATOM_PPLIB_NONCLOCK_INFO; - -// Contained in an array starting at the offset -// in ATOM_PPLIB_POWERPLAYTABLE::usClockInfoArrayOffset. -// referenced from ATOM_PPLIB_STATE::ucClockStateIndices -typedef struct _ATOM_PPLIB_R600_CLOCK_INFO -{ - USHORT usEngineClockLow; - UCHAR ucEngineClockHigh; - - USHORT usMemoryClockLow; - UCHAR ucMemoryClockHigh; - - USHORT usVDDC; - USHORT usUnused1; - USHORT usUnused2; - - ULONG ulFlags; // ATOM_PPLIB_R600_FLAGS_* - -} ATOM_PPLIB_R600_CLOCK_INFO; - -// ulFlags in ATOM_PPLIB_R600_CLOCK_INFO -#define ATOM_PPLIB_R600_FLAGS_PCIEGEN2 1 -#define ATOM_PPLIB_R600_FLAGS_UVDSAFE 2 -#define ATOM_PPLIB_R600_FLAGS_BACKBIASENABLE 4 -#define ATOM_PPLIB_R600_FLAGS_MEMORY_ODT_OFF 8 -#define ATOM_PPLIB_R600_FLAGS_MEMORY_DLL_OFF 16 - -typedef struct _ATOM_PPLIB_RS780_CLOCK_INFO - -{ - USHORT usLowEngineClockLow; // Low Engine clock in MHz (the same way as on the R600). - UCHAR ucLowEngineClockHigh; - USHORT usHighEngineClockLow; // High Engine clock in MHz. - UCHAR ucHighEngineClockHigh; - USHORT usMemoryClockLow; // For now one of the ATOM_PPLIB_RS780_SPMCLK_XXXX constants. - UCHAR ucMemoryClockHigh; // Currentyl unused. - UCHAR ucPadding; // For proper alignment and size. - USHORT usVDDC; // For the 780, use: None, Low, High, Variable - UCHAR ucMaxHTLinkWidth; // From SBIOS - {2, 4, 8, 16} - UCHAR ucMinHTLinkWidth; // From SBIOS - {2, 4, 8, 16}. Effective only if CDLW enabled. Minimum down stream width could be bigger as display BW requriement. - USHORT usHTLinkFreq; // See definition ATOM_PPLIB_RS780_HTLINKFREQ_xxx or in MHz(>=200). - ULONG ulFlags; -} ATOM_PPLIB_RS780_CLOCK_INFO; - -#define ATOM_PPLIB_RS780_VOLTAGE_NONE 0 -#define ATOM_PPLIB_RS780_VOLTAGE_LOW 1 -#define ATOM_PPLIB_RS780_VOLTAGE_HIGH 2 -#define ATOM_PPLIB_RS780_VOLTAGE_VARIABLE 3 - -#define ATOM_PPLIB_RS780_SPMCLK_NONE 0 // We cannot change the side port memory clock, leave it as it is. -#define ATOM_PPLIB_RS780_SPMCLK_LOW 1 -#define ATOM_PPLIB_RS780_SPMCLK_HIGH 2 - -#define ATOM_PPLIB_RS780_HTLINKFREQ_NONE 0 -#define ATOM_PPLIB_RS780_HTLINKFREQ_LOW 1 -#define ATOM_PPLIB_RS780_HTLINKFREQ_HIGH 2 - -/**************************************************************************/ - - -// Following definitions are for compatiblity issue in different SW components. -#define ATOM_MASTER_DATA_TABLE_REVISION 0x01 -#define Object_Info Object_Header -#define AdjustARB_SEQ MC_InitParameter -#define VRAM_GPIO_DetectionInfo VoltageObjectInfo -#define ASIC_VDDCI_Info ASIC_ProfilingInfo -#define ASIC_MVDDQ_Info MemoryTrainingInfo -#define SS_Info PPLL_SS_Info -#define ASIC_MVDDC_Info ASIC_InternalSS_Info -#define DispDevicePriorityInfo SaveRestoreInfo -#define DispOutInfo TV_VideoMode - - -#define ATOM_ENCODER_OBJECT_TABLE ATOM_OBJECT_TABLE -#define ATOM_CONNECTOR_OBJECT_TABLE ATOM_OBJECT_TABLE - -//New device naming, remove them when both DAL/VBIOS is ready -#define DFP2I_OUTPUT_CONTROL_PARAMETERS CRT1_OUTPUT_CONTROL_PARAMETERS -#define DFP2I_OUTPUT_CONTROL_PS_ALLOCATION DFP2I_OUTPUT_CONTROL_PARAMETERS - -#define DFP1X_OUTPUT_CONTROL_PARAMETERS CRT1_OUTPUT_CONTROL_PARAMETERS -#define DFP1X_OUTPUT_CONTROL_PS_ALLOCATION DFP1X_OUTPUT_CONTROL_PARAMETERS - -#define DFP1I_OUTPUT_CONTROL_PARAMETERS DFP1_OUTPUT_CONTROL_PARAMETERS -#define DFP1I_OUTPUT_CONTROL_PS_ALLOCATION DFP1_OUTPUT_CONTROL_PS_ALLOCATION - -#define ATOM_DEVICE_DFP1I_SUPPORT ATOM_DEVICE_DFP1_SUPPORT -#define ATOM_DEVICE_DFP1X_SUPPORT ATOM_DEVICE_DFP2_SUPPORT - -#define ATOM_DEVICE_DFP1I_INDEX ATOM_DEVICE_DFP1_INDEX -#define ATOM_DEVICE_DFP1X_INDEX ATOM_DEVICE_DFP2_INDEX - -#define ATOM_DEVICE_DFP2I_INDEX 0x00000009 -#define ATOM_DEVICE_DFP2I_SUPPORT (0x1L << ATOM_DEVICE_DFP2I_INDEX) - -#define ATOM_S0_DFP1I ATOM_S0_DFP1 -#define ATOM_S0_DFP1X ATOM_S0_DFP2 - -#define ATOM_S0_DFP2I 0x00200000L -#define ATOM_S0_DFP2Ib2 0x20 - -#define ATOM_S2_DFP1I_DPMS_STATE ATOM_S2_DFP1_DPMS_STATE -#define ATOM_S2_DFP1X_DPMS_STATE ATOM_S2_DFP2_DPMS_STATE - -#define ATOM_S2_DFP2I_DPMS_STATE 0x02000000L -#define ATOM_S2_DFP2I_DPMS_STATEb3 0x02 - -#define ATOM_S3_DFP2I_ACTIVEb1 0x02 - -#define ATOM_S3_DFP1I_ACTIVE ATOM_S3_DFP1_ACTIVE -#define ATOM_S3_DFP1X_ACTIVE ATOM_S3_DFP2_ACTIVE - -#define ATOM_S3_DFP2I_ACTIVE 0x00000200L - -#define ATOM_S3_DFP1I_CRTC_ACTIVE ATOM_S3_DFP1_CRTC_ACTIVE -#define ATOM_S3_DFP1X_CRTC_ACTIVE ATOM_S3_DFP2_CRTC_ACTIVE -#define ATOM_S3_DFP2I_CRTC_ACTIVE 0x02000000L - -#define ATOM_S3_DFP2I_CRTC_ACTIVEb3 0x02 -#define ATOM_S5_DOS_REQ_DFP2Ib1 0x02 - -#define ATOM_S5_DOS_REQ_DFP2I 0x0200 -#define ATOM_S6_ACC_REQ_DFP1I ATOM_S6_ACC_REQ_DFP1 -#define ATOM_S6_ACC_REQ_DFP1X ATOM_S6_ACC_REQ_DFP2 - -#define ATOM_S6_ACC_REQ_DFP2Ib3 0x02 -#define ATOM_S6_ACC_REQ_DFP2I 0x02000000L - -#define TMDS1XEncoderControl DVOEncoderControl -#define DFP1XOutputControl DVOOutputControl - -#define ExternalDFPOutputControl DFP1XOutputControl -#define EnableExternalTMDS_Encoder TMDS1XEncoderControl - -#define DFP1IOutputControl TMDSAOutputControl -#define DFP2IOutputControl LVTMAOutputControl - -#define DAC1_ENCODER_CONTROL_PARAMETERS DAC_ENCODER_CONTROL_PARAMETERS -#define DAC1_ENCODER_CONTROL_PS_ALLOCATION DAC_ENCODER_CONTROL_PS_ALLOCATION - -#define DAC2_ENCODER_CONTROL_PARAMETERS DAC_ENCODER_CONTROL_PARAMETERS -#define DAC2_ENCODER_CONTROL_PS_ALLOCATION DAC_ENCODER_CONTROL_PS_ALLOCATION - -#define ucDac1Standard ucDacStandard -#define ucDac2Standard ucDacStandard - -#define TMDS1EncoderControl TMDSAEncoderControl -#define TMDS2EncoderControl LVTMAEncoderControl - -#define DFP1OutputControl TMDSAOutputControl -#define DFP2OutputControl LVTMAOutputControl -#define CRT1OutputControl DAC1OutputControl -#define CRT2OutputControl DAC2OutputControl - -//These two lines will be removed for sure in a few days, will follow up with Michael V. -#define EnableLVDS_SS EnableSpreadSpectrumOnPPLL -#define ENABLE_LVDS_SS_PARAMETERS_V3 ENABLE_SPREAD_SPECTRUM_ON_PPLL - -/*********************************************************************************/ - -#pragma pack() // BIOS data must use byte aligment - -#endif /* _ATOMBIOS_H */ diff --git a/src/add-ons/accelerants/radeon_hd/atombios/includes/regsdef.h b/src/add-ons/accelerants/radeon_hd/atombios/includes/regsdef.h deleted file mode 100644 index e557ac0486..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/includes/regsdef.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2006-2007 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -//This is a dummy file used by driver-parser during compilation. -//Without this file, compatibility will be broken among ASICs and BIOs vs. driver -//James H. Apr. 22/03 diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 3df71ef50d..a14ca7fff6 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -24,190 +24,3 @@ # define TRACE(x...) ; #endif - -status_t -AtomParser(void *parameterSpace, uint8_t index, void *handle, void *biosBase) -{ - DEVICE_DATA deviceData; - - deviceData.pParameterSpace = (UINT32*)parameterSpace; - deviceData.CAIL = handle; - deviceData.pBIOS_Image = (UINT8*)biosBase; - deviceData.format = TABLE_FORMAT_BIOS; - - switch (ParseTable(&deviceData, index)) { - case CD_SUCCESS: - TRACE("%s: CD_SUCCESS : success\n", __func__); - return B_OK; - break; - case CD_CALL_TABLE: - TRACE("%s: CD_CALL_TABLE : success\n", __func__); - return B_OK; - break; - case CD_COMPLETED: - TRACE("%s: CD_COMPLETED : success\n", __func__); - return B_OK; - break; - default: - TRACE("%s: UNKNOWN ERROR\n", __func__); - } - return B_ERROR; -} - - -/* Begin AtomBIOS OS callbacks - These functions are used by AtomBios to access - functions and data provided by the accelerant -*/ -extern "C" { - - -VOID* -CailAllocateMemory(VOID *CAIL, UINT16 size) -{ - TRACE("AtomBios callback %s, size = %d\n", __func__, size); - return malloc(size); -} - - -VOID -CailReleaseMemory(VOID *CAIL, VOID *addr) -{ - TRACE("AtomBios callback %s\n", __func__); - free(addr); -} - - -VOID -CailDelayMicroSeconds(VOID *CAIL, UINT32 delay) -{ - usleep(delay); -} - - -UINT32 -CailReadATIRegister(VOID* CAIL, UINT32 idx) -{ - TRACE("AtomBios callback %s, idx (0x%X)\n", __func__, idx << 2); - return Read32(OUT, idx << 2); -} - - -VOID -CailWriteATIRegister(VOID *CAIL, UINT32 idx, UINT32 data) -{ - TRACE("AtomBios callback %s, idx (0x%X)\n", __func__, idx << 2); - - // TODO : save MMIO via atomSaveRegisters in CailWriteATIRegister - // atomSaveRegisters((atomBiosHandlePtr)CAIL, atomRegisterMMIO, idx << 2); - Write32(OUT, idx << 2, data); -} - - -VOID -CailReadPCIConfigData(VOID *CAIL, VOID* ret, UINT32 idx, UINT16 size) -{ - TRACE("AtomBios callback %s, idx (0x%X)\n", __func__, idx); - // TODO : CailReadPCIConfigData - - // pci_device_cfg_read(RHDPTRI((atomBiosHandlePtr)CAIL)->PciInfo, - // ret, idx << 2 , size >> 3, NULL); -} - - -VOID -CailWritePCIConfigData(VOID *CAIL, VOID *src, UINT32 idx, UINT16 size) -{ - TRACE("AtomBios callback %s, idx (0x%X)\n", __func__, idx); - // TODO : CailWritePCIConfigData - - // atomSaveRegisters((atomBiosHandlePtr)CAIL, atomRegisterPCICFG, idx << 2); - // pci_device_cfg_write(RHDPTRI((atomBiosHandlePtr)CAIL)->PciInfo, - // src, idx << 2, size >> 3, NULL); -} - - -ULONG -CailReadPLL(VOID *CAIL, ULONG address) -{ - TRACE("AtomBios callback %s, addr (0x%X)\n", __func__, address); - return Read32(PLL, address); -} - - -VOID -CailWritePLL(VOID *CAIL, ULONG address, ULONG data) -{ - TRACE("AtomBios callback %s, addr (0x%X)\n", __func__, address); - - // TODO : save PLL registers - // atomSaveRegisters((atomBiosHandlePtr)CAIL, atomRegisterPLL, address); - // TODO : Assumed screen index 0 - Write32(PLL, address, data); -} - - -ULONG -CailReadMC(VOID *CAIL, ULONG address) -{ - TRACE("AtomBios callback %s, addr (0x%X)\n", __func__, address); - - return Read32(MC, address | MC_IND_ALL); -} - - -VOID -CailWriteMC(VOID *CAIL, ULONG address, ULONG data) -{ - TRACE("AtomBios callback %s, addr (0x%X)\n", __func__, address); - - // atomSaveRegisters((atomBiosHandlePtr)CAIL, atomRegisterMC, address); - Write32(MC, address | MC_IND_ALL | MC_IND_WR_EN, data); -} - - -UINT32 -CailReadFBData(VOID* CAIL, UINT32 idx) -{ - // TODO : This should work only in theory and needs tested - - TRACE("AtomBios callback %s, idx (0x%X)\n", __func__, idx); - - UINT32 ret = 0; - - uint32_t fbLocation - = gInfo->shared_info->frame_buffer_phys & 0xffffffff; - - // If we have a physical offset for our frame buffer, use it - if (fbLocation > 0) - ret = Read32(PLL, fbLocation + idx); - else { - TRACE("%s: ERROR: Frame Buffer offset not defined\n", - __func__); - return 0; - } - - return ret; -} - - -VOID -CailWriteFBData(VOID *CAIL, UINT32 idx, UINT32 data) -{ - // TODO : This should work only in theory and needs tested - - TRACE("AtomBios callback %s, idx (0x%X)\n", __func__, idx); - - uint32_t fbLocation - = gInfo->shared_info->frame_buffer_phys & 0xffffffff; - - // If we have a physical offset for our frame buffer, use it - if (fbLocation > 0) - Write32(OUT, fbLocation + idx, data); - else - TRACE("%s: ERROR: Frame Buffer offset not defined\n", - __func__); -} - - -} // end extern "C" diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index 4d26848730..0c98fbde39 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -13,12 +13,16 @@ // AtomBios includes extern "C" { -#include "CD_Common_Types.h" -#include "CD_Definitions.h" -#include "atombios.h" +//#include "atom.h" } +struct bios_info { + uint32 location; + uint32 size; +}; + + status_t AtomParser(void *parameterSpace, uint8_t index, void *handle, void *biosBase); From cc9e8e94d48193b0b59c0f9475e662d1330e0899 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 1 Aug 2011 22:56:18 +0000 Subject: [PATCH 085/702] * Add card_info struct used by AtomBIOS parser git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42535 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/atombios/atom.h | 15 ++++++++++++++- src/add-ons/accelerants/radeon_hd/bios.h | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 324cb1f4c6..79f6f1f2cb 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -25,10 +25,23 @@ #ifndef ATOM_H #define ATOM_H + #ifndef __HAIKU__ #include -#endif #include "card.h" +#else +struct card_info { + struct drm_device *dev; + void (* reg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ + uint32_t (* reg_read)(struct card_info *, uint32_t); /* filled by driver */ + void (* ioreg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ + uint32_t (* ioreg_read)(struct card_info *, uint32_t); /* filled by driver */ + void (* mc_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ + uint32_t (* mc_read)(struct card_info *, uint32_t); /* filled by driver */ + void (* pll_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ + uint32_t (* pll_read)(struct card_info *, uint32_t); /* filled by driver */ +}; +#endif #define ATOM_BIOS_MAGIC 0xAA55 #define ATOM_ATI_MAGIC_PTR 0x30 diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index 0c98fbde39..80f8ca57c6 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -13,7 +13,7 @@ // AtomBios includes extern "C" { -//#include "atom.h" + #include "atom.h" } From b375e9cd653bcc4a0bb382b38c2339a90fdc303a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 01:07:10 +0000 Subject: [PATCH 086/702] * Program DATA_FORMAT to non-interlaced git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42536 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/mode.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index d26354bb9b..5ded5f08c8 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -291,6 +291,10 @@ CardModeSet(uint8 crtid, display_mode *mode) Write32Mask(CRT, regs->crtVPolarity, displayTiming.flags & B_POSITIVE_VSYNC ? 0 : 1, 0x1); + // TODO : for now fixed non-interlace + Write32(OUT, D1CRTC_INTERLACE_CONTROL, 0x0); + Write32(OUT, D1MODE_DATA_FORMAT, 0x0); + /* set D1CRTC_HORZ_COUNT_BY2_EN to 0; should only be set to 1 on 30bpp DVI modes */ @@ -319,7 +323,6 @@ CardModeScale(uint8 crtid, display_mode *mode) Write32(CRT, regs->sclEnable, 0); Write32(CRT, regs->sclTapControl, 0); Write32(CRT, regs->modeCenter, 2); - // D1MODE_DATA_FORMAT? } From 555ff46538c86abb0ad150f3c9ef9fc26eae8c21 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 2 Aug 2011 05:00:22 +0000 Subject: [PATCH 087/702] Check size limit of all stacked windows when resizing. Fixes #7893 thanks to diver (again). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42537 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 46c86d0084..25d034f28b 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -340,15 +340,22 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion, bool resizeStack) int32 wantHeight = fFrame.IntegerHeight() + y; // enforce size limits - if (wantWidth < fMinWidth) - wantWidth = fMinWidth; - if (wantWidth > fMaxWidth) - wantWidth = fMaxWidth; + WindowStack* stack = GetWindowStack(); + if (resizeStack && stack) { + for (int32 i = 0; i < stack->CountWindows(); i++) { + Window* window = stack->WindowList().ItemAt(i); - if (wantHeight < fMinHeight) - wantHeight = fMinHeight; - if (wantHeight > fMaxHeight) - wantHeight = fMaxHeight; + if (wantWidth < window->fMinWidth) + wantWidth = window->fMinWidth; + if (wantWidth > window->fMaxWidth) + wantWidth = window->fMaxWidth; + + if (wantHeight < window->fMinHeight) + wantHeight = window->fMinHeight; + if (wantHeight > window->fMaxHeight) + wantHeight = window->fMaxHeight; + } + } x = wantWidth - fFrame.IntegerWidth(); y = wantHeight - fFrame.IntegerHeight(); @@ -371,7 +378,6 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion, bool resizeStack) if (decorator && resizeStack) decorator->ResizeBy(x, y, dirtyRegion); - WindowStack* stack = GetWindowStack(); if (resizeStack && stack) { for (int32 i = 0; i < stack->CountWindows(); i++) { Window* window = stack->WindowList().ItemAt(i); From 5136067474e5350ce28b33e809580dd8118166c1 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 06:07:49 +0000 Subject: [PATCH 088/702] * Initial work on bios_init for setting up AtomBIOS parser * Refactor AtomBIOS parser to use non-linux-kernel calls (normally I would keep it as-is and do wrappers, but the AtomBIOS parser has been rewritten from scratch twice by its creator in the last 5 years.. so eh. * Refactor AtomBIOS parser to be more haiku-like stylewise git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42538 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/Jamfile | 2 +- .../accelerants/radeon_hd/accelerant.cpp | 3 + .../radeon_hd/atombios/atom-bits.h | 10 +- .../accelerants/radeon_hd/atombios/atom.c | 1114 ---------------- .../accelerants/radeon_hd/atombios/atom.cpp | 1121 +++++++++++++++++ .../accelerants/radeon_hd/atombios/atom.h | 55 +- src/add-ons/accelerants/radeon_hd/bios.cpp | 43 + src/add-ons/accelerants/radeon_hd/bios.h | 8 +- 8 files changed, 1202 insertions(+), 1154 deletions(-) delete mode 100644 src/add-ons/accelerants/radeon_hd/atombios/atom.c create mode 100644 src/add-ons/accelerants/radeon_hd/atombios/atom.cpp diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile b/src/add-ons/accelerants/radeon_hd/Jamfile index dbb86e5983..c6ce582dda 100644 --- a/src/add-ons/accelerants/radeon_hd/Jamfile +++ b/src/add-ons/accelerants/radeon_hd/Jamfile @@ -9,7 +9,7 @@ UsePrivateHeaders [ FDirName graphics radeon_hd ] ; UsePrivateHeaders [ FDirName graphics common ] ; Addon radeon_hd.accelerant : - #atombios/atom.c + atombios/atom.cpp accelerant.cpp engine.cpp hooks.cpp diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 55d44c10f4..e721c5c646 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -218,6 +218,9 @@ radeon_init_accelerant(int device) init_lock(&info.accelerant_lock, "radeon hd accelerant"); init_lock(&info.engine_lock, "radeon hd engine"); + // Init AtomBIOS + bios_init(); + status = detect_displays(); //if (status != B_OK) // return status; diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom-bits.h b/src/add-ons/accelerants/radeon_hd/atombios/atom-bits.h index f94d2e2721..eba08ea9dd 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom-bits.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom-bits.h @@ -25,21 +25,21 @@ #ifndef ATOM_BITS_H #define ATOM_BITS_H -static inline uint8_t get_u8(void *bios, int ptr) +static inline uint8 get_u8(void *bios, int ptr) { return ((unsigned char *)bios)[ptr]; } #define U8(ptr) get_u8(ctx->ctx->bios,(ptr)) #define CU8(ptr) get_u8(ctx->bios,(ptr)) -static inline uint16_t get_u16(void *bios, int ptr) +static inline uint16 get_u16(void *bios, int ptr) { - return get_u8(bios,ptr)|(((uint16_t)get_u8(bios,ptr+1))<<8); + return get_u8(bios,ptr)|(((uint16)get_u8(bios,ptr+1))<<8); } #define U16(ptr) get_u16(ctx->ctx->bios,(ptr)) #define CU16(ptr) get_u16(ctx->bios,(ptr)) -static inline uint32_t get_u32(void *bios, int ptr) +static inline uint32 get_u32(void *bios, int ptr) { - return get_u16(bios,ptr)|(((uint32_t)get_u16(bios,ptr+2))<<16); + return get_u16(bios,ptr)|(((uint32)get_u16(bios,ptr+2))<<16); } #define U32(ptr) get_u32(ctx->ctx->bios,(ptr)) #define CU32(ptr) get_u32(ctx->bios,(ptr)) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.c b/src/add-ons/accelerants/radeon_hd/atombios/atom.c deleted file mode 100644 index d3952e3041..0000000000 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.c +++ /dev/null @@ -1,1114 +0,0 @@ -/* - * Copyright 2008 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Author: Stanislaw Skowronek - */ - -#ifndef __HAIKU__ -#include -#include -#endif - -#include "atom.h" -#include "atom-names.h" -#include "atom-bits.h" - -#define ATOM_COND_ABOVE 0 -#define ATOM_COND_ABOVEOREQUAL 1 -#define ATOM_COND_ALWAYS 2 -#define ATOM_COND_BELOW 3 -#define ATOM_COND_BELOWOREQUAL 4 -#define ATOM_COND_EQUAL 5 -#define ATOM_COND_NOTEQUAL 6 - -#define ATOM_PORT_ATI 0 -#define ATOM_PORT_PCI 1 -#define ATOM_PORT_SYSIO 2 - -#define ATOM_UNIT_MICROSEC 0 -#define ATOM_UNIT_MILLISEC 1 - -#define PLL_INDEX 2 -#define PLL_DATA 3 - -typedef struct { - atom_context *ctx; - - uint32_t *ps, *ws; - int ps_shift; - uint16_t start; -} atom_exec_context; - -int atom_debug = 0; -void atom_execute_table(atom_context *ctx, int index, uint32_t *params); - -static uint32_t atom_arg_mask[8] = {0xFFFFFFFF, 0xFFFF, 0xFFFF00, 0xFFFF0000, 0xFF, 0xFF00, 0xFF0000, 0xFF000000}; -static int atom_arg_shift[8] = {0, 0, 8, 16, 0, 8, 16, 24}; -static int atom_dst_to_src[8][4] = { // translate destination alignment field to the source alignment encoding - { 0, 0, 0, 0 }, - { 1, 2, 3, 0 }, - { 1, 2, 3, 0 }, - { 1, 2, 3, 0 }, - { 4, 5, 6, 7 }, - { 4, 5, 6, 7 }, - { 4, 5, 6, 7 }, - { 4, 5, 6, 7 }, -}; -static int atom_def_dst[8] = { 0, 0, 1, 2, 0, 1, 2, 3 }; - -static int debug_depth = 0; -#ifdef ATOM_DEBUG -static void debug_print_spaces(int n) -{ - while(n--) - printk(" "); -} -#define DEBUG(...) do if(atom_debug) { printk(KERN_DEBUG __VA_ARGS__); } while(0) -#define SDEBUG(...) do if(atom_debug) { printk(KERN_DEBUG); debug_print_spaces(debug_depth); printk(__VA_ARGS__); } while(0) -#else -#define DEBUG(...) do { } while(0) -#define SDEBUG(...) do { } while(0) -#endif - -static uint32_t atom_iio_execute(atom_context *ctx, int base, uint32_t index, uint32_t data) -{ - uint32_t temp = 0xCDCDCDCD; - while(1) - switch(CU8(base)) { - case ATOM_IIO_NOP: - base++; - break; - case ATOM_IIO_READ: - temp = ctx->card->reg_read(ctx->card, CU16(base+1)); - base+=3; - break; - case ATOM_IIO_WRITE: - ctx->card->reg_write(ctx->card, CU16(base+1), temp); - base+=3; - break; - case ATOM_IIO_CLEAR: - temp &= ~((0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2)); - base+=3; - break; - case ATOM_IIO_SET: - temp |= (0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2); - base+=3; - break; - case ATOM_IIO_MOVE_INDEX: - temp &= ~((0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2)); - temp |= ((index >> CU8(base+2)) & (0xFFFFFFFF >> (32-CU8(base+1)))) << CU8(base+3); - base+=4; - break; - case ATOM_IIO_MOVE_DATA: - temp &= ~((0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2)); - temp |= ((data >> CU8(base+2)) & (0xFFFFFFFF >> (32-CU8(base+1)))) << CU8(base+3); - base+=4; - break; - case ATOM_IIO_MOVE_ATTR: - temp &= ~((0xFFFFFFFF >> (32-CU8(base+1))) << CU8(base+2)); - temp |= ((ctx->io_attr >> CU8(base+2)) & (0xFFFFFFFF >> (32-CU8(base+1)))) << CU8(base+3); - base+=4; - break; - case ATOM_IIO_END: - return temp; - default: - printk(KERN_INFO "Unknown IIO opcode.\n"); - return 0; - } -} - -static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr, int *ptr, uint32_t *saved, int print) -{ - uint32_t idx, val = 0xCDCDCDCD, align, arg; - atom_context *gctx = ctx->ctx; - arg = attr & 7; - align = (attr >> 3) & 7; - switch(arg) { - case ATOM_ARG_REG: - idx = U16(*ptr); - (*ptr)+=2; - if(print) - DEBUG("REG[0x%04X]", idx); - idx += gctx->reg_block; - switch(gctx->io_mode) { - case ATOM_IO_MM: - val = gctx->card->reg_read(gctx->card, idx); - break; - case ATOM_IO_PCI: - printk(KERN_INFO "PCI registers are not implemented.\n"); - return 0; - case ATOM_IO_SYSIO: - printk(KERN_INFO "SYSIO registers are not implemented.\n"); - return 0; - default: - if(!(gctx->io_mode&0x80)) { - printk(KERN_INFO "Bad IO mode.\n"); - return 0; - } - if(!gctx->iio[gctx->io_mode&0x7F]) { - printk(KERN_INFO "Undefined indirect IO read method %d.\n", gctx->io_mode&0x7F); - return 0; - } - val = atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0x7F], idx, 0); - } - break; - case ATOM_ARG_PS: - idx = U8(*ptr); - (*ptr)++; - if(print) - DEBUG("PS[0x%02X]", idx); - val = ctx->ps[idx]; - break; - case ATOM_ARG_WS: - idx = U8(*ptr); - (*ptr)++; - if(print) - DEBUG("WS[0x%02X]", idx); - switch(idx) { - case ATOM_WS_QUOTIENT: - val = gctx->divmul[0]; - break; - case ATOM_WS_REMAINDER: - val = gctx->divmul[1]; - break; - case ATOM_WS_DATAPTR: - val = gctx->data_block; - break; - case ATOM_WS_SHIFT: - val = gctx->shift; - break; - case ATOM_WS_OR_MASK: - val = 1<shift; - break; - case ATOM_WS_AND_MASK: - val = ~(1<shift); - break; - case ATOM_WS_FB_WINDOW: - val = gctx->fb_base; - break; - case ATOM_WS_ATTRIBUTES: - val = gctx->io_attr; - break; - default: - val = ctx->ws[idx]; - } - break; - case ATOM_ARG_ID: - idx = U16(*ptr); - (*ptr)+=2; - if(print) { - if(gctx->data_block) - DEBUG("ID[0x%04X+%04X]", idx, gctx->data_block); - else - DEBUG("ID[0x%04X]", idx); - } - val = U32(idx + gctx->data_block); - break; - case ATOM_ARG_FB: - idx = U8(*ptr); - (*ptr)++; - if(print) - DEBUG("FB[0x%02X]", idx); - printk(KERN_INFO "FB access is not implemented.\n"); - return 0; - case ATOM_ARG_IMM: - switch(align) { - case ATOM_SRC_DWORD: - val = U32(*ptr); - (*ptr)+=4; - if(print) - DEBUG("IMM 0x%08X\n", val); - return val; - case ATOM_SRC_WORD0: - case ATOM_SRC_WORD8: - case ATOM_SRC_WORD16: - val = U16(*ptr); - (*ptr)+=2; - if(print) - DEBUG("IMM 0x%04X\n", val); - return val; - case ATOM_SRC_BYTE0: - case ATOM_SRC_BYTE8: - case ATOM_SRC_BYTE16: - case ATOM_SRC_BYTE24: - val = U8(*ptr); - (*ptr)++; - if(print) - DEBUG("IMM 0x%02X\n", val); - return val; - } - return 0; - case ATOM_ARG_PLL: - idx = U8(*ptr); - (*ptr)++; - if(print) - DEBUG("PLL[0x%02X]", idx); - gctx->card->reg_write(gctx->card, PLL_INDEX, idx); - val = gctx->card->reg_read(gctx->card, PLL_DATA); - break; - case ATOM_ARG_MC: - idx = U8(*ptr); - (*ptr)++; - if(print) - DEBUG("MC[0x%02X]", idx); - printk(KERN_INFO "MC registers are not implemented.\n"); - return 0; - } - if(saved) - *saved = val; - val &= atom_arg_mask[align]; - val >>= atom_arg_shift[align]; - if(print) - switch(align) { - case ATOM_SRC_DWORD: - DEBUG(".[31:0] -> 0x%08X\n", val); - break; - case ATOM_SRC_WORD0: - DEBUG(".[15:0] -> 0x%04X\n", val); - break; - case ATOM_SRC_WORD8: - DEBUG(".[23:8] -> 0x%04X\n", val); - break; - case ATOM_SRC_WORD16: - DEBUG(".[31:16] -> 0x%04X\n", val); - break; - case ATOM_SRC_BYTE0: - DEBUG(".[7:0] -> 0x%02X\n", val); - break; - case ATOM_SRC_BYTE8: - DEBUG(".[15:8] -> 0x%02X\n", val); - break; - case ATOM_SRC_BYTE16: - DEBUG(".[23:16] -> 0x%02X\n", val); - break; - case ATOM_SRC_BYTE24: - DEBUG(".[31:24] -> 0x%02X\n", val); - break; - } - return val; -} - -static void atom_skip_src_int(atom_exec_context *ctx, uint8_t attr, int *ptr) -{ - uint32_t align = (attr >> 3) & 7, arg = attr & 7; - switch(arg) { - case ATOM_ARG_REG: - case ATOM_ARG_ID: - (*ptr)+=2; - break; - case ATOM_ARG_PLL: - case ATOM_ARG_MC: - case ATOM_ARG_PS: - case ATOM_ARG_WS: - case ATOM_ARG_FB: - (*ptr)++; - break; - case ATOM_ARG_IMM: - switch(align) { - case ATOM_SRC_DWORD: - (*ptr)+=4; - return; - case ATOM_SRC_WORD0: - case ATOM_SRC_WORD8: - case ATOM_SRC_WORD16: - (*ptr)+=2; - return; - case ATOM_SRC_BYTE0: - case ATOM_SRC_BYTE8: - case ATOM_SRC_BYTE16: - case ATOM_SRC_BYTE24: - (*ptr)++; - return; - } - return; - } -} - -static uint32_t atom_get_src(atom_exec_context *ctx, uint8_t attr, int *ptr) -{ - return atom_get_src_int(ctx, attr, ptr, NULL, 1); -} - -static uint32_t atom_get_dst(atom_exec_context *ctx, int arg, uint8_t attr, int *ptr, uint32_t *saved, int print) -{ - return atom_get_src_int(ctx, arg|atom_dst_to_src[(attr>>3)&7][(attr>>6)&3]<<3, ptr, saved, print); -} - -static void atom_skip_dst(atom_exec_context *ctx, int arg, uint8_t attr, int *ptr) -{ - atom_skip_src_int(ctx, arg|atom_dst_to_src[(attr>>3)&7][(attr>>6)&3]<<3, ptr); -} - -static void atom_put_dst(atom_exec_context *ctx, int arg, uint8_t attr, int *ptr, uint32_t val, uint32_t saved) -{ - uint32_t align = atom_dst_to_src[(attr>>3)&7][(attr>>6)&3], old_val = val, idx; - atom_context *gctx = ctx->ctx; - old_val &= atom_arg_mask[align] >> atom_arg_shift[align]; - val <<= atom_arg_shift[align]; - val &= atom_arg_mask[align]; - saved &= ~atom_arg_mask[align]; - val |= saved; - switch(arg) { - case ATOM_ARG_REG: - idx = U16(*ptr); - (*ptr)+=2; - DEBUG("REG[0x%04X]", idx); - idx += gctx->reg_block; - switch(gctx->io_mode) { - case ATOM_IO_MM: - if(idx == 0) - gctx->card->reg_write(gctx->card, idx, val<<2); - else - gctx->card->reg_write(gctx->card, idx, val); - break; - case ATOM_IO_PCI: - printk(KERN_INFO "PCI registers are not implemented.\n"); - return; - case ATOM_IO_SYSIO: - printk(KERN_INFO "SYSIO registers are not implemented.\n"); - return; - default: - if(!(gctx->io_mode&0x80)) { - printk(KERN_INFO "Bad IO mode.\n"); - return; - } - if(!gctx->iio[gctx->io_mode&0xFF]) { - printk(KERN_INFO "Undefined indirect IO write method %d.\n", gctx->io_mode&0x7F); - return; - } - atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0xFF], idx, val); - } - break; - case ATOM_ARG_PS: - idx = U8(*ptr); - (*ptr)++; - DEBUG("PS[0x%02X]", idx); - ctx->ps[idx] = val; - break; - case ATOM_ARG_WS: - idx = U8(*ptr); - (*ptr)++; - DEBUG("WS[0x%02X]", idx); - switch(idx) { - case ATOM_WS_QUOTIENT: - gctx->divmul[0] = val; - break; - case ATOM_WS_REMAINDER: - gctx->divmul[1] = val; - break; - case ATOM_WS_DATAPTR: - gctx->data_block = val; - break; - case ATOM_WS_SHIFT: - gctx->shift = val; - break; - case ATOM_WS_OR_MASK: - case ATOM_WS_AND_MASK: - break; - case ATOM_WS_FB_WINDOW: - gctx->fb_base = val; - break; - case ATOM_WS_ATTRIBUTES: - gctx->io_attr = val; - break; - default: - ctx->ws[idx] = val; - } - break; - case ATOM_ARG_FB: - idx = U8(*ptr); - (*ptr)++; - DEBUG("FB[0x%02X]", idx); - printk(KERN_INFO "FB access is not implemented.\n"); - return; - case ATOM_ARG_PLL: - idx = U8(*ptr); - (*ptr)++; - DEBUG("PLL[0x%02X]", idx); - gctx->card->reg_write(gctx->card, PLL_INDEX, idx); - gctx->card->reg_write(gctx->card, PLL_DATA, val); - break; - case ATOM_ARG_MC: - idx = U8(*ptr); - (*ptr)++; - printk(KERN_INFO "MC registers are not implemented.\n"); - return; - } - switch(align) { - case ATOM_SRC_DWORD: - DEBUG(".[31:0] <- 0x%08X\n", old_val); - break; - case ATOM_SRC_WORD0: - DEBUG(".[15:0] <- 0x%04X\n", old_val); - break; - case ATOM_SRC_WORD8: - DEBUG(".[23:8] <- 0x%04X\n", old_val); - break; - case ATOM_SRC_WORD16: - DEBUG(".[31:16] <- 0x%04X\n", old_val); - break; - case ATOM_SRC_BYTE0: - DEBUG(".[7:0] <- 0x%02X\n", old_val); - break; - case ATOM_SRC_BYTE8: - DEBUG(".[15:8] <- 0x%02X\n", old_val); - break; - case ATOM_SRC_BYTE16: - DEBUG(".[23:16] <- 0x%02X\n", old_val); - break; - case ATOM_SRC_BYTE24: - DEBUG(".[31:24] <- 0x%02X\n", old_val); - break; - } -} - -static void atom_op_add(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src, saved; - int dptr = *ptr; - SDEBUG(" dst: "); - dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - SDEBUG(" src: "); - src = atom_get_src(ctx, attr, ptr); - dst += src; - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, dst, saved); -} - -static void atom_op_and(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src, saved; - int dptr = *ptr; - SDEBUG(" dst: "); - dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - SDEBUG(" src: "); - src = atom_get_src(ctx, attr, ptr); - dst &= src; - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, dst, saved); -} - -static void atom_op_beep(atom_exec_context *ctx, int *ptr, int arg) -{ - printk("ATOM BIOS beeped!\n"); -} - -static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) -{ - int idx = U8((*ptr)++); - if(idx < ATOM_TABLE_NAMES_CNT) - SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]); - else - SDEBUG(" table: %d\n", idx); - if(U16(ctx->ctx->cmd_table + 4 + 2*idx)) - atom_execute_table(ctx->ctx, idx, ctx->ps+ctx->ps_shift); -} - -static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t saved; - int dptr = *ptr; - attr &= 0x38; - attr |= atom_def_dst[attr>>3]<<6; - atom_get_dst(ctx, arg, attr, ptr, &saved, 0); - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, 0, saved); -} - -static void atom_op_compare(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src; - SDEBUG(" src1: "); - dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); - SDEBUG(" src2: "); - src = atom_get_src(ctx, attr, ptr); - ctx->ctx->cs_equal = (dst == src); - ctx->ctx->cs_above = (dst > src); - SDEBUG(" result: %s %s\n", ctx->ctx->cs_equal?"EQ":"NE", ctx->ctx->cs_above?"GT":"LE"); -} - -static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t count = U8((*ptr)++); - SDEBUG(" count: %d\n", count); - if(arg == ATOM_UNIT_MICROSEC) - schedule_timeout_uninterruptible(usecs_to_jiffies(count)); - else - schedule_timeout_uninterruptible(msecs_to_jiffies(count)); -} - -static void atom_op_div(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src; - SDEBUG(" src1: "); - dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); - SDEBUG(" src2: "); - src = atom_get_src(ctx, attr, ptr); - if(src != 0) { - ctx->ctx->divmul[0] = dst/src; - ctx->ctx->divmul[1] = dst%src; - } else { - ctx->ctx->divmul[0] = 0; - ctx->ctx->divmul[1] = 0; - } -} - -static void atom_op_eot(atom_exec_context *ctx, int *ptr, int arg) -{ - /* functionally, a nop */ -} - -static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) -{ - int execute = 0, target = U16(*ptr); - (*ptr)+=2; - switch(arg) { - case ATOM_COND_ABOVE: - execute = ctx->ctx->cs_above; - break; - case ATOM_COND_ABOVEOREQUAL: - execute = ctx->ctx->cs_above || ctx->ctx->cs_equal; - break; - case ATOM_COND_ALWAYS: - execute = 1; - break; - case ATOM_COND_BELOW: - execute = !(ctx->ctx->cs_above || ctx->ctx->cs_equal); - break; - case ATOM_COND_BELOWOREQUAL: - execute = !ctx->ctx->cs_above; - break; - case ATOM_COND_EQUAL: - execute = ctx->ctx->cs_equal; - break; - case ATOM_COND_NOTEQUAL: - execute = !ctx->ctx->cs_equal; - break; - } - if(arg != ATOM_COND_ALWAYS) - SDEBUG(" taken: %s\n", execute?"yes":"no"); - SDEBUG(" target: 0x%04X\n", target); - if(execute) - *ptr = ctx->start+target; -} - -static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src1, src2, saved; - int dptr = *ptr; - SDEBUG(" dst: "); - dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - SDEBUG(" src1: "); - src1 = atom_get_src(ctx, attr, ptr); - SDEBUG(" src2: "); - src2 = atom_get_src(ctx, attr, ptr); - dst &= src1; - dst |= src2; - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, dst, saved); -} - -static void atom_op_move(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t src, saved; - int dptr = *ptr; - if(((attr>>3)&7) != ATOM_SRC_DWORD) - atom_get_dst(ctx, arg, attr, ptr, &saved, 0); - else { - atom_skip_dst(ctx, arg, attr, ptr); - saved = 0xCDCDCDCD; - } - SDEBUG(" src: "); - src = atom_get_src(ctx, attr, ptr); - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, src, saved); -} - -static void atom_op_mul(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src; - SDEBUG(" src1: "); - dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); - SDEBUG(" src2: "); - src = atom_get_src(ctx, attr, ptr); - ctx->ctx->divmul[0] = dst*src; -} - -static void atom_op_nop(atom_exec_context *ctx, int *ptr, int arg) -{ - /* nothing */ -} - -static void atom_op_or(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src, saved; - int dptr = *ptr; - SDEBUG(" dst: "); - dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - SDEBUG(" src: "); - src = atom_get_src(ctx, attr, ptr); - dst |= src; - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, dst, saved); -} - -static void atom_op_postcard(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t val = U8((*ptr)++); - SDEBUG("POST card output: 0x%02X\n", val); -} - -static void atom_op_repeat(atom_exec_context *ctx, int *ptr, int arg) -{ - printk(KERN_INFO "unimplemented!\n"); -} - -static void atom_op_restorereg(atom_exec_context *ctx, int *ptr, int arg) -{ - printk(KERN_INFO "unimplemented!\n"); -} - -static void atom_op_savereg(atom_exec_context *ctx, int *ptr, int arg) -{ - printk(KERN_INFO "unimplemented!\n"); -} - -static void atom_op_setdatablock(atom_exec_context *ctx, int *ptr, int arg) -{ - int idx = U8(*ptr); - (*ptr)++; - SDEBUG(" block: %d\n", idx); - if(!idx) - ctx->ctx->data_block = 0; - else if(idx==255) - ctx->ctx->data_block = ctx->start; - else - ctx->ctx->data_block = U16(ctx->ctx->data_table + 4 + 2*idx); - SDEBUG(" base: 0x%04X\n", ctx->ctx->data_block); -} - -static void atom_op_setfbbase(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - SDEBUG(" fb_base: "); - ctx->ctx->fb_base = atom_get_src(ctx, attr, ptr); -} - -static void atom_op_setport(atom_exec_context *ctx, int *ptr, int arg) -{ - int port; - switch(arg) { - case ATOM_PORT_ATI: - port = U16(*ptr); - if(port < ATOM_IO_NAMES_CNT) - SDEBUG(" port: %d (%s)\n", port, atom_io_names[port]); - else - SDEBUG(" port: %d\n", port); - if(!port) - ctx->ctx->io_mode = ATOM_IO_MM; - else - ctx->ctx->io_mode = ATOM_IO_IIO|port; - (*ptr)+=2; - break; - case ATOM_PORT_PCI: - ctx->ctx->io_mode = ATOM_IO_PCI; - (*ptr)++; - break; - case ATOM_PORT_SYSIO: - ctx->ctx->io_mode = ATOM_IO_SYSIO; - (*ptr)++; - break; - } -} - -static void atom_op_setregblock(atom_exec_context *ctx, int *ptr, int arg) -{ - ctx->ctx->reg_block = U16(*ptr); - (*ptr)+=2; - SDEBUG(" base: 0x%04X\n", ctx->ctx->reg_block); -} - -static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++), shift; - uint32_t saved, dst; - int dptr = *ptr; - attr &= 0x38; - attr |= atom_def_dst[attr>>3]<<6; - SDEBUG(" dst: "); - dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - shift = U8((*ptr)++); - SDEBUG(" shift: %d\n", shift); - dst <<= shift; - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, dst, saved); -} - -static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++), shift; - uint32_t saved, dst; - int dptr = *ptr; - attr &= 0x38; - attr |= atom_def_dst[attr>>3]<<6; - SDEBUG(" dst: "); - dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - shift = U8((*ptr)++); - SDEBUG(" shift: %d\n", shift); - dst >>= shift; - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, dst, saved); -} - -static void atom_op_sub(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src, saved; - int dptr = *ptr; - SDEBUG(" dst: "); - dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - SDEBUG(" src: "); - src = atom_get_src(ctx, attr, ptr); - dst -= src; - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, dst, saved); -} - -static void atom_op_switch(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t src, val, target; - SDEBUG(" switch: "); - src = atom_get_src(ctx, attr, ptr); - while(U16(*ptr) != ATOM_CASE_END) - if(U8(*ptr) == ATOM_CASE_MAGIC) { - (*ptr)++; - SDEBUG(" case: "); - val = atom_get_src(ctx, (attr&0x38)|ATOM_ARG_IMM, ptr); - target = U16(*ptr); - if(val == src) { - SDEBUG(" target: %04X\n", target); - *ptr = ctx->start+target; - return; - } - (*ptr) += 2; - } else { - printk(KERN_INFO "Bad case.\n"); - return; - } - (*ptr) += 2; -} - -static void atom_op_test(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src; - SDEBUG(" src1: "); - dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); - SDEBUG(" src2: "); - src = atom_get_src(ctx, attr, ptr); - ctx->ctx->cs_equal = ((dst & src) == 0); - SDEBUG(" result: %s\n", ctx->ctx->cs_equal?"EQ":"NE"); -} - -static void atom_op_xor(atom_exec_context *ctx, int *ptr, int arg) -{ - uint8_t attr = U8((*ptr)++); - uint32_t dst, src, saved; - int dptr = *ptr; - SDEBUG(" dst: "); - dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - SDEBUG(" src: "); - src = atom_get_src(ctx, attr, ptr); - dst ^= src; - SDEBUG(" dst: "); - atom_put_dst(ctx, arg, attr, &dptr, dst, saved); -} - -static void atom_op_debug(atom_exec_context *ctx, int *ptr, int arg) -{ - printk(KERN_INFO "unimplemented!\n"); -} - -static struct { - void (*func)(atom_exec_context *, int *, int); - int arg; -} opcode_table[ATOM_OP_CNT] = { - { NULL, 0 }, - { atom_op_move, ATOM_ARG_REG }, - { atom_op_move, ATOM_ARG_PS }, - { atom_op_move, ATOM_ARG_WS }, - { atom_op_move, ATOM_ARG_FB }, - { atom_op_move, ATOM_ARG_PLL }, - { atom_op_move, ATOM_ARG_MC }, - { atom_op_and, ATOM_ARG_REG }, - { atom_op_and, ATOM_ARG_PS }, - { atom_op_and, ATOM_ARG_WS }, - { atom_op_and, ATOM_ARG_FB }, - { atom_op_and, ATOM_ARG_PLL }, - { atom_op_and, ATOM_ARG_MC }, - { atom_op_or, ATOM_ARG_REG }, - { atom_op_or, ATOM_ARG_PS }, - { atom_op_or, ATOM_ARG_WS }, - { atom_op_or, ATOM_ARG_FB }, - { atom_op_or, ATOM_ARG_PLL }, - { atom_op_or, ATOM_ARG_MC }, - { atom_op_shl, ATOM_ARG_REG }, - { atom_op_shl, ATOM_ARG_PS }, - { atom_op_shl, ATOM_ARG_WS }, - { atom_op_shl, ATOM_ARG_FB }, - { atom_op_shl, ATOM_ARG_PLL }, - { atom_op_shl, ATOM_ARG_MC }, - { atom_op_shr, ATOM_ARG_REG }, - { atom_op_shr, ATOM_ARG_PS }, - { atom_op_shr, ATOM_ARG_WS }, - { atom_op_shr, ATOM_ARG_FB }, - { atom_op_shr, ATOM_ARG_PLL }, - { atom_op_shr, ATOM_ARG_MC }, - { atom_op_mul, ATOM_ARG_REG }, - { atom_op_mul, ATOM_ARG_PS }, - { atom_op_mul, ATOM_ARG_WS }, - { atom_op_mul, ATOM_ARG_FB }, - { atom_op_mul, ATOM_ARG_PLL }, - { atom_op_mul, ATOM_ARG_MC }, - { atom_op_div, ATOM_ARG_REG }, - { atom_op_div, ATOM_ARG_PS }, - { atom_op_div, ATOM_ARG_WS }, - { atom_op_div, ATOM_ARG_FB }, - { atom_op_div, ATOM_ARG_PLL }, - { atom_op_div, ATOM_ARG_MC }, - { atom_op_add, ATOM_ARG_REG }, - { atom_op_add, ATOM_ARG_PS }, - { atom_op_add, ATOM_ARG_WS }, - { atom_op_add, ATOM_ARG_FB }, - { atom_op_add, ATOM_ARG_PLL }, - { atom_op_add, ATOM_ARG_MC }, - { atom_op_sub, ATOM_ARG_REG }, - { atom_op_sub, ATOM_ARG_PS }, - { atom_op_sub, ATOM_ARG_WS }, - { atom_op_sub, ATOM_ARG_FB }, - { atom_op_sub, ATOM_ARG_PLL }, - { atom_op_sub, ATOM_ARG_MC }, - { atom_op_setport, ATOM_PORT_ATI }, - { atom_op_setport, ATOM_PORT_PCI }, - { atom_op_setport, ATOM_PORT_SYSIO }, - { atom_op_setregblock, 0 }, - { atom_op_setfbbase, 0 }, - { atom_op_compare, ATOM_ARG_REG }, - { atom_op_compare, ATOM_ARG_PS }, - { atom_op_compare, ATOM_ARG_WS }, - { atom_op_compare, ATOM_ARG_FB }, - { atom_op_compare, ATOM_ARG_PLL }, - { atom_op_compare, ATOM_ARG_MC }, - { atom_op_switch, 0 }, - { atom_op_jump, ATOM_COND_ALWAYS }, - { atom_op_jump, ATOM_COND_EQUAL }, - { atom_op_jump, ATOM_COND_BELOW }, - { atom_op_jump, ATOM_COND_ABOVE }, - { atom_op_jump, ATOM_COND_BELOWOREQUAL }, - { atom_op_jump, ATOM_COND_ABOVEOREQUAL }, - { atom_op_jump, ATOM_COND_NOTEQUAL }, - { atom_op_test, ATOM_ARG_REG }, - { atom_op_test, ATOM_ARG_PS }, - { atom_op_test, ATOM_ARG_WS }, - { atom_op_test, ATOM_ARG_FB }, - { atom_op_test, ATOM_ARG_PLL }, - { atom_op_test, ATOM_ARG_MC }, - { atom_op_delay, ATOM_UNIT_MILLISEC }, - { atom_op_delay, ATOM_UNIT_MICROSEC }, - { atom_op_calltable, 0 }, - { atom_op_repeat, 0 }, - { atom_op_clear, ATOM_ARG_REG }, - { atom_op_clear, ATOM_ARG_PS }, - { atom_op_clear, ATOM_ARG_WS }, - { atom_op_clear, ATOM_ARG_FB }, - { atom_op_clear, ATOM_ARG_PLL }, - { atom_op_clear, ATOM_ARG_MC }, - { atom_op_nop, 0 }, - { atom_op_eot, 0 }, - { atom_op_mask, ATOM_ARG_REG }, - { atom_op_mask, ATOM_ARG_PS }, - { atom_op_mask, ATOM_ARG_WS }, - { atom_op_mask, ATOM_ARG_FB }, - { atom_op_mask, ATOM_ARG_PLL }, - { atom_op_mask, ATOM_ARG_MC }, - { atom_op_postcard, 0 }, - { atom_op_beep, 0 }, - { atom_op_savereg, 0 }, - { atom_op_restorereg, 0 }, - { atom_op_setdatablock, 0 }, - { atom_op_xor, ATOM_ARG_REG }, - { atom_op_xor, ATOM_ARG_PS }, - { atom_op_xor, ATOM_ARG_WS }, - { atom_op_xor, ATOM_ARG_FB }, - { atom_op_xor, ATOM_ARG_PLL }, - { atom_op_xor, ATOM_ARG_MC }, - { atom_op_shl, ATOM_ARG_REG }, - { atom_op_shl, ATOM_ARG_PS }, - { atom_op_shl, ATOM_ARG_WS }, - { atom_op_shl, ATOM_ARG_FB }, - { atom_op_shl, ATOM_ARG_PLL }, - { atom_op_shl, ATOM_ARG_MC }, - { atom_op_shr, ATOM_ARG_REG }, - { atom_op_shr, ATOM_ARG_PS }, - { atom_op_shr, ATOM_ARG_WS }, - { atom_op_shr, ATOM_ARG_FB }, - { atom_op_shr, ATOM_ARG_PLL }, - { atom_op_shr, ATOM_ARG_MC }, - { atom_op_debug, 0 }, -}; - -void atom_execute_table(atom_context *ctx, int index, uint32_t *params) -{ - int base = CU16(ctx->cmd_table+4+2*index); - int len, ws, ps, ptr; - unsigned char op; - atom_exec_context ectx; - - if(!base) - return; - - len = CU16(base+ATOM_CT_SIZE_PTR); - ws = CU8(base+ATOM_CT_WS_PTR); - ps = CU8(base+ATOM_CT_PS_PTR) & ATOM_CT_PS_MASK; - ptr = base+ATOM_CT_CODE_PTR; - - SDEBUG(">> execute %04X (len %d, WS %d, PS %d)\n", base, len, ws, ps); - - /* reset reg block */ - ctx->reg_block = 0; - ectx.ctx = ctx; - ectx.ps_shift = ps/4; - ectx.start = base; - ectx.ps = params; - if(ws) - ectx.ws = kzalloc(4*ws, GFP_KERNEL); - else - ectx.ws = NULL; - - debug_depth++; - while(1) { - op = CU8(ptr++); - if(op0) - opcode_table[op].func(&ectx, &ptr, opcode_table[op].arg); - else - break; - - if(op == ATOM_OP_EOT) - break; - } - debug_depth--; - SDEBUG("<<\n"); - - if(ws) - kfree(ectx.ws); -} - -static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; -static void atom_index_iio(atom_context *ctx, int base) -{ - ctx->iio = kzalloc(2*256, GFP_KERNEL); - while(CU8(base) == ATOM_IIO_START) { - ctx->iio[CU8(base+1)] = base+2; - base += 2; - while(CU8(base) != ATOM_IIO_END) - base += atom_iio_len[CU8(base)]; - base += 3; - } -} - -atom_context *atom_parse(card_info *card, void *bios) -{ - int base; - atom_context *ctx = kzalloc(sizeof(atom_context), GFP_KERNEL); - char *str; - - ctx->card = card; - ctx->bios = bios; - - if(CU16(0) != ATOM_BIOS_MAGIC) { - printk(KERN_INFO "Invalid BIOS magic.\n"); - kfree(ctx); - return NULL; - } - if(strncmp(CSTR(ATOM_ATI_MAGIC_PTR), ATOM_ATI_MAGIC, strlen(ATOM_ATI_MAGIC))) { - printk(KERN_INFO "Invalid ATI magic.\n"); - kfree(ctx); - return NULL; - } - - base = CU16(ATOM_ROM_TABLE_PTR); - if(strncmp(CSTR(base+ATOM_ROM_MAGIC_PTR), ATOM_ROM_MAGIC, strlen(ATOM_ROM_MAGIC))) { - printk(KERN_INFO "Invalid ATOM magic.\n"); - kfree(ctx); - return NULL; - } - - ctx->cmd_table = CU16(base+ATOM_ROM_CMD_PTR); - ctx->data_table = CU16(base+ATOM_ROM_DATA_PTR); - atom_index_iio(ctx, CU16(ctx->data_table+ATOM_DATA_IIO_PTR)+4); - - str = CSTR(CU16(base+ATOM_ROM_MSG_PTR)); - while(*str && ((*str == '\n') || (*str == '\r'))) - str++; - printk(KERN_INFO "ATOM BIOS: %s", str); - - return ctx; -} - -int atom_asic_init(atom_context *ctx) -{ - int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); - uint32_t ps[16]; - memset(ps, 0, 64); - - ps[0] = CU32(hwi + ATOM_FWI_DEFSCLK_PTR); - ps[1] = CU32(hwi + ATOM_FWI_DEFMCLK_PTR); - if(!ps[0] || !ps[1]) - return 1; - - if(!CU16(ctx->cmd_table+4+2*ATOM_CMD_INIT)) - return 1; - atom_execute_table(ctx, ATOM_CMD_INIT, ps); - - return 0; -} - -void atom_destroy(atom_context *ctx) -{ - if(ctx->iio) - kfree(ctx->iio); - kfree(ctx); -} diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp new file mode 100644 index 0000000000..66fffd66bd --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -0,0 +1,1121 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Author: Stanislaw Skowronek + */ + +/* Reworked for the Haiku Operating System Radeon HD driver + * Author: + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include + +#include "atom.h" +#include "atom-names.h" +#include "atom-bits.h" + + +#undef TRACE + +#define TRACE_ATOM +#ifdef TRACE_ATOM +# define TRACE(x...) _sPrintf("radeon_hd: " x) +#else +# define TRACE(x...) ; +#endif + + +#define ATOM_COND_ABOVE 0 +#define ATOM_COND_ABOVEOREQUAL 1 +#define ATOM_COND_ALWAYS 2 +#define ATOM_COND_BELOW 3 +#define ATOM_COND_BELOWOREQUAL 4 +#define ATOM_COND_EQUAL 5 +#define ATOM_COND_NOTEQUAL 6 + +#define ATOM_PORT_ATI 0 +#define ATOM_PORT_PCI 1 +#define ATOM_PORT_SYSIO 2 + +#define ATOM_UNIT_MICROSEC 0 +#define ATOM_UNIT_MILLISEC 1 + +#define PLL_INDEX 2 +#define PLL_DATA 3 + +typedef struct { + atom_context *ctx; + + uint32 *ps, *ws; + int ps_shift; + uint16 start; +} atom_exec_context; + +int atom_debug = 0; +void atom_execute_table(atom_context *ctx, int index, uint32 *params); + +static uint32 atom_arg_mask[8] = {0xFFFFFFFF, 0xFFFF, 0xFFFF00, 0xFFFF0000, + 0xFF, 0xFF00, 0xFF0000, 0xFF000000}; +static int atom_arg_shift[8] = {0, 0, 8, 16, 0, 8, 16, 24}; +static int atom_dst_to_src[8][4] = { + // translate destination alignment field to the source alignment encoding + { 0, 0, 0, 0 }, + { 1, 2, 3, 0 }, + { 1, 2, 3, 0 }, + { 1, 2, 3, 0 }, + { 4, 5, 6, 7 }, + { 4, 5, 6, 7 }, + { 4, 5, 6, 7 }, + { 4, 5, 6, 7 }, +}; +static int atom_def_dst[8] = { 0, 0, 1, 2, 0, 1, 2, 3 }; + +static int debug_depth = 0; + +static uint32 +atom_iio_execute(atom_context *ctx, int base, uint32 index, uint32 data) +{ + uint32 temp = 0xCDCDCDCD; + while (1) + switch(CU8(base)) { + case ATOM_IIO_NOP: + base++; + break; + case ATOM_IIO_READ: + temp = ctx->card->reg_read(CU16(base + 1)); + base+=3; + break; + case ATOM_IIO_WRITE: + ctx->card->reg_write(CU16(base + 1), temp); + base+=3; + break; + case ATOM_IIO_CLEAR: + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); + base+=3; + break; + case ATOM_IIO_SET: + temp |= (0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2); + base+=3; + break; + case ATOM_IIO_MOVE_INDEX: + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); + temp |= ((index >> CU8(base + 2)) + & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); + base+=4; + break; + case ATOM_IIO_MOVE_DATA: + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); + temp |= ((data >> CU8(base + 2)) + & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); + base+=4; + break; + case ATOM_IIO_MOVE_ATTR: + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); + temp |= ((ctx->io_attr >> CU8(base + 2)) + & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); + base+=4; + break; + case ATOM_IIO_END: + return temp; + default: + TRACE("Unknown IIO opcode.\n"); + return 0; + } +} + + +static uint32 +atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, + uint32 *saved, int print) +{ + uint32 idx, val = 0xCDCDCDCD, align, arg; + atom_context *gctx = ctx->ctx; + arg = attr & 7; + align = (attr >> 3) & 7; + switch(arg) { + case ATOM_ARG_REG: + idx = U16(*ptr); + (*ptr)+=2; + idx += gctx->reg_block; + switch(gctx->io_mode) { + case ATOM_IO_MM: + val = gctx->card->reg_read(idx); + break; + case ATOM_IO_PCI: + TRACE("PCI registers are not implemented.\n"); + return 0; + case ATOM_IO_SYSIO: + TRACE("SYSIO registers are not implemented.\n"); + return 0; + default: + if (!(gctx->io_mode&0x80)) { + TRACE("Bad IO mode.\n"); + return 0; + } + if (!gctx->iio[gctx->io_mode&0x7F]) { + TRACE("Undefined indirect IO read method %d.\n", gctx->io_mode&0x7F); + return 0; + } + val = atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0x7F], idx, 0); + } + break; + case ATOM_ARG_PS: + idx = U8(*ptr); + (*ptr)++; + val = ctx->ps[idx]; + break; + case ATOM_ARG_WS: + idx = U8(*ptr); + (*ptr)++; + switch(idx) { + case ATOM_WS_QUOTIENT: + val = gctx->divmul[0]; + break; + case ATOM_WS_REMAINDER: + val = gctx->divmul[1]; + break; + case ATOM_WS_DATAPTR: + val = gctx->data_block; + break; + case ATOM_WS_SHIFT: + val = gctx->shift; + break; + case ATOM_WS_OR_MASK: + val = 1<shift; + break; + case ATOM_WS_AND_MASK: + val = ~(1<shift); + break; + case ATOM_WS_FB_WINDOW: + val = gctx->fb_base; + break; + case ATOM_WS_ATTRIBUTES: + val = gctx->io_attr; + break; + default: + val = ctx->ws[idx]; + } + break; + case ATOM_ARG_ID: + idx = U16(*ptr); + (*ptr)+=2; + val = U32(idx + gctx->data_block); + break; + case ATOM_ARG_FB: + idx = U8(*ptr); + (*ptr)++; + TRACE("FB access is not implemented.\n"); + return 0; + case ATOM_ARG_IMM: + switch(align) { + case ATOM_SRC_DWORD: + val = U32(*ptr); + (*ptr)+=4; + return val; + case ATOM_SRC_WORD0: + case ATOM_SRC_WORD8: + case ATOM_SRC_WORD16: + val = U16(*ptr); + (*ptr)+=2; + return val; + case ATOM_SRC_BYTE0: + case ATOM_SRC_BYTE8: + case ATOM_SRC_BYTE16: + case ATOM_SRC_BYTE24: + val = U8(*ptr); + (*ptr)++; + return val; + } + return 0; + case ATOM_ARG_PLL: + idx = U8(*ptr); + (*ptr)++; + gctx->card->reg_write(PLL_INDEX, idx); + val = gctx->card->reg_read(PLL_DATA); + break; + case ATOM_ARG_MC: + idx = U8(*ptr); + (*ptr)++; + TRACE("MC registers are not implemented.\n"); + return 0; + } + if (saved) + *saved = val; + val &= atom_arg_mask[align]; + val >>= atom_arg_shift[align]; + return val; +} + + +static void +atom_skip_src_int(atom_exec_context *ctx, uint8 attr, int *ptr) +{ + uint32 align = (attr >> 3) & 7, arg = attr & 7; + switch(arg) { + case ATOM_ARG_REG: + case ATOM_ARG_ID: + (*ptr)+=2; + break; + case ATOM_ARG_PLL: + case ATOM_ARG_MC: + case ATOM_ARG_PS: + case ATOM_ARG_WS: + case ATOM_ARG_FB: + (*ptr)++; + break; + case ATOM_ARG_IMM: + switch(align) { + case ATOM_SRC_DWORD: + (*ptr)+=4; + return; + case ATOM_SRC_WORD0: + case ATOM_SRC_WORD8: + case ATOM_SRC_WORD16: + (*ptr)+=2; + return; + case ATOM_SRC_BYTE0: + case ATOM_SRC_BYTE8: + case ATOM_SRC_BYTE16: + case ATOM_SRC_BYTE24: + (*ptr)++; + return; + } + return; + } +} + + +static uint32 +atom_get_src(atom_exec_context *ctx, uint8 attr, int *ptr) +{ + return atom_get_src_int(ctx, attr, ptr, NULL, 1); +} + + +static uint32 +atom_get_dst(atom_exec_context *ctx, int arg, uint8 attr, + int *ptr, uint32 *saved, int print) +{ + return atom_get_src_int(ctx, + arg|atom_dst_to_src[(attr>>3)&7][(attr>>6)&3]<<3, ptr, saved, print); +} + + +static void +atom_skip_dst(atom_exec_context *ctx, int arg, uint8 attr, int *ptr) +{ + atom_skip_src_int(ctx, + arg|atom_dst_to_src[(attr>>3)&7][(attr>>6)&3]<<3, ptr); +} + + +static void +atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, + int *ptr, uint32 val, uint32 saved) +{ + uint32 align = atom_dst_to_src[(attr>>3)&7][(attr>>6)&3], + old_val = val, idx; + atom_context *gctx = ctx->ctx; + old_val &= atom_arg_mask[align] >> atom_arg_shift[align]; + val <<= atom_arg_shift[align]; + val &= atom_arg_mask[align]; + saved &= ~atom_arg_mask[align]; + val |= saved; + switch(arg) { + case ATOM_ARG_REG: + idx = U16(*ptr); + (*ptr)+=2; + idx += gctx->reg_block; + switch(gctx->io_mode) { + case ATOM_IO_MM: + if (idx == 0) + gctx->card->reg_write(idx, val<<2); + else + gctx->card->reg_write(idx, val); + break; + case ATOM_IO_PCI: + TRACE("PCI registers are not implemented.\n"); + return; + case ATOM_IO_SYSIO: + TRACE("SYSIO registers are not implemented.\n"); + return; + default: + if (!(gctx->io_mode&0x80)) { + TRACE("Bad IO mode.\n"); + return; + } + if (!gctx->iio[gctx->io_mode&0xFF]) { + return; + } + atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0xFF], idx, val); + } + break; + case ATOM_ARG_PS: + idx = U8(*ptr); + (*ptr)++; + ctx->ps[idx] = val; + break; + case ATOM_ARG_WS: + idx = U8(*ptr); + (*ptr)++; + switch(idx) { + case ATOM_WS_QUOTIENT: + gctx->divmul[0] = val; + break; + case ATOM_WS_REMAINDER: + gctx->divmul[1] = val; + break; + case ATOM_WS_DATAPTR: + gctx->data_block = val; + break; + case ATOM_WS_SHIFT: + gctx->shift = val; + break; + case ATOM_WS_OR_MASK: + case ATOM_WS_AND_MASK: + break; + case ATOM_WS_FB_WINDOW: + gctx->fb_base = val; + break; + case ATOM_WS_ATTRIBUTES: + gctx->io_attr = val; + break; + default: + ctx->ws[idx] = val; + } + break; + case ATOM_ARG_FB: + idx = U8(*ptr); + (*ptr)++; + TRACE("FB access is not implemented.\n"); + return; + case ATOM_ARG_PLL: + idx = U8(*ptr); + (*ptr)++; + gctx->card->reg_write(PLL_INDEX, idx); + gctx->card->reg_write(PLL_DATA, val); + break; + case ATOM_ARG_MC: + idx = U8(*ptr); + (*ptr)++; + TRACE("MC registers are not implemented.\n"); + return; + } +} + + +static void +atom_op_add(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src, saved; + int dptr = *ptr; + TRACE(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + TRACE(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst += src; + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void +atom_op_and(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src, saved; + int dptr = *ptr; + TRACE(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + TRACE(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst &= src; + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void +atom_op_beep(atom_exec_context *ctx, int *ptr, int arg) +{ + TRACE("ATOM BIOS beeped!\n"); +} + + +static void +atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) +{ + int idx = U8((*ptr)++); + TRACE(" table: %d\n", idx); + if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) + atom_execute_table(ctx->ctx, idx, ctx->ps + ctx->ps_shift); +} + + +static void +atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 saved; + int dptr = *ptr; + attr &= 0x38; + attr |= atom_def_dst[attr>>3]<<6; + atom_get_dst(ctx, arg, attr, ptr, &saved, 0); + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, 0, saved); +} + + +static void +atom_op_compare(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src; + TRACE(" src1: "); + dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); + TRACE(" src2: "); + src = atom_get_src(ctx, attr, ptr); + ctx->ctx->cs_equal = (dst == src); + ctx->ctx->cs_above = (dst > src); + TRACE(" result: %s %s\n", ctx->ctx->cs_equal ? "EQ" : "NE", + ctx->ctx->cs_above ? "GT" : "LE"); +} + + +static void +atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 count = U8((*ptr)++); + TRACE(" count: %d\n", count); + if (arg == ATOM_UNIT_MICROSEC) { + // Microseconds + usleep(count); + } else { + // TODO : check + // Milliseconds + usleep(count); + } +} + + +static void +atom_op_div(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src; + TRACE(" src1: "); + dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); + TRACE(" src2: "); + src = atom_get_src(ctx, attr, ptr); + if (src != 0) { + ctx->ctx->divmul[0] = dst / src; + ctx->ctx->divmul[1] = dst%src; + } else { + ctx->ctx->divmul[0] = 0; + ctx->ctx->divmul[1] = 0; + } +} + + +static void +atom_op_eot(atom_exec_context *ctx, int *ptr, int arg) +{ + /* functionally, a nop */ +} + + +static void +atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) +{ + int execute = 0, target = U16(*ptr); + (*ptr)+=2; + switch(arg) { + case ATOM_COND_ABOVE: + execute = ctx->ctx->cs_above; + break; + case ATOM_COND_ABOVEOREQUAL: + execute = ctx->ctx->cs_above || ctx->ctx->cs_equal; + break; + case ATOM_COND_ALWAYS: + execute = 1; + break; + case ATOM_COND_BELOW: + execute = !(ctx->ctx->cs_above || ctx->ctx->cs_equal); + break; + case ATOM_COND_BELOWOREQUAL: + execute = !ctx->ctx->cs_above; + break; + case ATOM_COND_EQUAL: + execute = ctx->ctx->cs_equal; + break; + case ATOM_COND_NOTEQUAL: + execute = !ctx->ctx->cs_equal; + break; + } + if (arg != ATOM_COND_ALWAYS) + TRACE(" taken: %s\n", execute?"yes":"no"); + TRACE(" target: 0x%04X\n", target); + if (execute) + *ptr = ctx->start + target; +} + + +static void +atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src1, src2, saved; + int dptr = *ptr; + TRACE(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + TRACE(" src1: "); + src1 = atom_get_src(ctx, attr, ptr); + TRACE(" src2: "); + src2 = atom_get_src(ctx, attr, ptr); + dst &= src1; + dst |= src2; + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void +atom_op_move(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 src, saved; + int dptr = *ptr; + if (((attr>>3)&7) != ATOM_SRC_DWORD) + atom_get_dst(ctx, arg, attr, ptr, &saved, 0); + else { + atom_skip_dst(ctx, arg, attr, ptr); + saved = 0xCDCDCDCD; + } + TRACE(" src: "); + src = atom_get_src(ctx, attr, ptr); + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, src, saved); +} + + +static void +atom_op_mul(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src; + TRACE(" src1: "); + dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); + TRACE(" src2: "); + src = atom_get_src(ctx, attr, ptr); + ctx->ctx->divmul[0] = dst * src; +} + + +static void +atom_op_nop(atom_exec_context *ctx, int *ptr, int arg) +{ + /* nothing */ +} + + +static void +atom_op_or(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src, saved; + int dptr = *ptr; + TRACE(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + TRACE(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst |= src; + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void +atom_op_postcard(atom_exec_context *ctx, int *ptr, int arg) +{ + TRACE("unimplemented!\n"); +} + + +static void atom_op_repeat(atom_exec_context *ctx, int *ptr, int arg) +{ + TRACE("unimplemented!\n"); +} + + +static void +atom_op_restorereg(atom_exec_context *ctx, int *ptr, int arg) +{ + TRACE("unimplemented!\n"); +} + + +static void +atom_op_savereg(atom_exec_context *ctx, int *ptr, int arg) +{ + TRACE("unimplemented!\n"); +} + + +static void +atom_op_setdatablock(atom_exec_context *ctx, int *ptr, int arg) +{ + int idx = U8(*ptr); + (*ptr)++; + TRACE(" block: %d\n", idx); + if (!idx) + ctx->ctx->data_block = 0; + else if (idx==255) + ctx->ctx->data_block = ctx->start; + else + ctx->ctx->data_block = U16(ctx->ctx->data_table + 4 + 2 * idx); +} + + +static void +atom_op_setfbbase(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + TRACE(" fb_base: "); + ctx->ctx->fb_base = atom_get_src(ctx, attr, ptr); +} + + +static void +atom_op_setport(atom_exec_context *ctx, int *ptr, int arg) +{ + int port; + switch(arg) { + case ATOM_PORT_ATI: + port = U16(*ptr); + TRACE(" port: %d\n", port); + if (!port) + ctx->ctx->io_mode = ATOM_IO_MM; + else + ctx->ctx->io_mode = ATOM_IO_IIO|port; + (*ptr)+=2; + break; + case ATOM_PORT_PCI: + ctx->ctx->io_mode = ATOM_IO_PCI; + (*ptr)++; + break; + case ATOM_PORT_SYSIO: + ctx->ctx->io_mode = ATOM_IO_SYSIO; + (*ptr)++; + break; + } +} + + +static void +atom_op_setregblock(atom_exec_context *ctx, int *ptr, int arg) +{ + ctx->ctx->reg_block = U16(*ptr); + (*ptr)+=2; +} + + +static void +atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++), shift; + uint32 saved, dst; + int dptr = *ptr; + attr &= 0x38; + attr |= atom_def_dst[attr>>3]<<6; + TRACE(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + shift = U8((*ptr)++); + TRACE(" shift: %d\n", shift); + dst <<= shift; + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void +atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++), shift; + uint32 saved, dst; + int dptr = *ptr; + attr &= 0x38; + attr |= atom_def_dst[attr>>3]<<6; + TRACE(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + shift = U8((*ptr)++); + TRACE(" shift: %d\n", shift); + dst >>= shift; + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void +atom_op_sub(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src, saved; + int dptr = *ptr; + TRACE(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + TRACE(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst -= src; + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void +atom_op_switch(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 src, val, target; + TRACE(" switch: "); + src = atom_get_src(ctx, attr, ptr); + while (U16(*ptr) != ATOM_CASE_END) + if (U8(*ptr) == ATOM_CASE_MAGIC) { + (*ptr)++; + TRACE(" case: "); + val = atom_get_src(ctx, (attr&0x38)|ATOM_ARG_IMM, ptr); + target = U16(*ptr); + if (val == src) { + *ptr = ctx->start + target; + return; + } + (*ptr) += 2; + } else { + TRACE("Bad case.\n"); + return; + } + (*ptr) += 2; +} + + +static void +atom_op_test(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src; + TRACE(" src1: "); + dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); + TRACE(" src2: "); + src = atom_get_src(ctx, attr, ptr); + ctx->ctx->cs_equal = ((dst & src) == 0); + TRACE(" result: %s\n", ctx->ctx->cs_equal?"EQ":"NE"); +} + + +static void +atom_op_xor(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++); + uint32 dst, src, saved; + int dptr = *ptr; + TRACE(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + TRACE(" src: "); + src = atom_get_src(ctx, attr, ptr); + dst ^= src; + TRACE(" dst: "); + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void +atom_op_debug(atom_exec_context *ctx, int *ptr, int arg) +{ + TRACE("unimplemented!\n"); +} + + +static struct { + void (*func)(atom_exec_context *, int *, int); + int arg; +} opcode_table[ATOM_OP_CNT] = { + { NULL, 0 }, + { atom_op_move, ATOM_ARG_REG }, + { atom_op_move, ATOM_ARG_PS }, + { atom_op_move, ATOM_ARG_WS }, + { atom_op_move, ATOM_ARG_FB }, + { atom_op_move, ATOM_ARG_PLL }, + { atom_op_move, ATOM_ARG_MC }, + { atom_op_and, ATOM_ARG_REG }, + { atom_op_and, ATOM_ARG_PS }, + { atom_op_and, ATOM_ARG_WS }, + { atom_op_and, ATOM_ARG_FB }, + { atom_op_and, ATOM_ARG_PLL }, + { atom_op_and, ATOM_ARG_MC }, + { atom_op_or, ATOM_ARG_REG }, + { atom_op_or, ATOM_ARG_PS }, + { atom_op_or, ATOM_ARG_WS }, + { atom_op_or, ATOM_ARG_FB }, + { atom_op_or, ATOM_ARG_PLL }, + { atom_op_or, ATOM_ARG_MC }, + { atom_op_shl, ATOM_ARG_REG }, + { atom_op_shl, ATOM_ARG_PS }, + { atom_op_shl, ATOM_ARG_WS }, + { atom_op_shl, ATOM_ARG_FB }, + { atom_op_shl, ATOM_ARG_PLL }, + { atom_op_shl, ATOM_ARG_MC }, + { atom_op_shr, ATOM_ARG_REG }, + { atom_op_shr, ATOM_ARG_PS }, + { atom_op_shr, ATOM_ARG_WS }, + { atom_op_shr, ATOM_ARG_FB }, + { atom_op_shr, ATOM_ARG_PLL }, + { atom_op_shr, ATOM_ARG_MC }, + { atom_op_mul, ATOM_ARG_REG }, + { atom_op_mul, ATOM_ARG_PS }, + { atom_op_mul, ATOM_ARG_WS }, + { atom_op_mul, ATOM_ARG_FB }, + { atom_op_mul, ATOM_ARG_PLL }, + { atom_op_mul, ATOM_ARG_MC }, + { atom_op_div, ATOM_ARG_REG }, + { atom_op_div, ATOM_ARG_PS }, + { atom_op_div, ATOM_ARG_WS }, + { atom_op_div, ATOM_ARG_FB }, + { atom_op_div, ATOM_ARG_PLL }, + { atom_op_div, ATOM_ARG_MC }, + { atom_op_add, ATOM_ARG_REG }, + { atom_op_add, ATOM_ARG_PS }, + { atom_op_add, ATOM_ARG_WS }, + { atom_op_add, ATOM_ARG_FB }, + { atom_op_add, ATOM_ARG_PLL }, + { atom_op_add, ATOM_ARG_MC }, + { atom_op_sub, ATOM_ARG_REG }, + { atom_op_sub, ATOM_ARG_PS }, + { atom_op_sub, ATOM_ARG_WS }, + { atom_op_sub, ATOM_ARG_FB }, + { atom_op_sub, ATOM_ARG_PLL }, + { atom_op_sub, ATOM_ARG_MC }, + { atom_op_setport, ATOM_PORT_ATI }, + { atom_op_setport, ATOM_PORT_PCI }, + { atom_op_setport, ATOM_PORT_SYSIO }, + { atom_op_setregblock, 0 }, + { atom_op_setfbbase, 0 }, + { atom_op_compare, ATOM_ARG_REG }, + { atom_op_compare, ATOM_ARG_PS }, + { atom_op_compare, ATOM_ARG_WS }, + { atom_op_compare, ATOM_ARG_FB }, + { atom_op_compare, ATOM_ARG_PLL }, + { atom_op_compare, ATOM_ARG_MC }, + { atom_op_switch, 0 }, + { atom_op_jump, ATOM_COND_ALWAYS }, + { atom_op_jump, ATOM_COND_EQUAL }, + { atom_op_jump, ATOM_COND_BELOW }, + { atom_op_jump, ATOM_COND_ABOVE }, + { atom_op_jump, ATOM_COND_BELOWOREQUAL }, + { atom_op_jump, ATOM_COND_ABOVEOREQUAL }, + { atom_op_jump, ATOM_COND_NOTEQUAL }, + { atom_op_test, ATOM_ARG_REG }, + { atom_op_test, ATOM_ARG_PS }, + { atom_op_test, ATOM_ARG_WS }, + { atom_op_test, ATOM_ARG_FB }, + { atom_op_test, ATOM_ARG_PLL }, + { atom_op_test, ATOM_ARG_MC }, + { atom_op_delay, ATOM_UNIT_MILLISEC }, + { atom_op_delay, ATOM_UNIT_MICROSEC }, + { atom_op_calltable, 0 }, + { atom_op_repeat, 0 }, + { atom_op_clear, ATOM_ARG_REG }, + { atom_op_clear, ATOM_ARG_PS }, + { atom_op_clear, ATOM_ARG_WS }, + { atom_op_clear, ATOM_ARG_FB }, + { atom_op_clear, ATOM_ARG_PLL }, + { atom_op_clear, ATOM_ARG_MC }, + { atom_op_nop, 0 }, + { atom_op_eot, 0 }, + { atom_op_mask, ATOM_ARG_REG }, + { atom_op_mask, ATOM_ARG_PS }, + { atom_op_mask, ATOM_ARG_WS }, + { atom_op_mask, ATOM_ARG_FB }, + { atom_op_mask, ATOM_ARG_PLL }, + { atom_op_mask, ATOM_ARG_MC }, + { atom_op_postcard, 0 }, + { atom_op_beep, 0 }, + { atom_op_savereg, 0 }, + { atom_op_restorereg, 0 }, + { atom_op_setdatablock, 0 }, + { atom_op_xor, ATOM_ARG_REG }, + { atom_op_xor, ATOM_ARG_PS }, + { atom_op_xor, ATOM_ARG_WS }, + { atom_op_xor, ATOM_ARG_FB }, + { atom_op_xor, ATOM_ARG_PLL }, + { atom_op_xor, ATOM_ARG_MC }, + { atom_op_shl, ATOM_ARG_REG }, + { atom_op_shl, ATOM_ARG_PS }, + { atom_op_shl, ATOM_ARG_WS }, + { atom_op_shl, ATOM_ARG_FB }, + { atom_op_shl, ATOM_ARG_PLL }, + { atom_op_shl, ATOM_ARG_MC }, + { atom_op_shr, ATOM_ARG_REG }, + { atom_op_shr, ATOM_ARG_PS }, + { atom_op_shr, ATOM_ARG_WS }, + { atom_op_shr, ATOM_ARG_FB }, + { atom_op_shr, ATOM_ARG_PLL }, + { atom_op_shr, ATOM_ARG_MC }, + { atom_op_debug, 0 }, +}; + + +void +atom_execute_table(atom_context *ctx, int index, uint32 *params) +{ + int base = CU16(ctx->cmd_table + 4 + 2 * index); + int len, ws, ps, ptr; + unsigned char op; + atom_exec_context ectx; + + if (!base) + return; + + len = CU16(base + ATOM_CT_SIZE_PTR); + ws = CU8(base + ATOM_CT_WS_PTR); + ps = CU8(base + ATOM_CT_PS_PTR) & ATOM_CT_PS_MASK; + ptr = base + ATOM_CT_CODE_PTR; + + /* reset reg block */ + ctx->reg_block = 0; + ectx.ctx = ctx; + ectx.ps_shift = ps / 4; + ectx.start = base; + ectx.ps = params; + if (ws) + ectx.ws = (uint32*)malloc(4 * ws); + else + ectx.ws = NULL; + + debug_depth++; + while (1) { + op = CU8(ptr++); + + if (op 0) + opcode_table[op].func(&ectx, &ptr, opcode_table[op].arg); + else + break; + + if (op == ATOM_OP_EOT) + break; + } + debug_depth--; + TRACE("<<\n"); + + if (ws) + free(ectx.ws); +} + + +static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; + + +static void +atom_index_iio(atom_context *ctx, int base) +{ + ctx->iio = (uint16*)malloc(2 * 256); + while (CU8(base) == ATOM_IIO_START) { + ctx->iio[CU8(base + 1)] = base + 2; + base += 2; + while (CU8(base) != ATOM_IIO_END) + base += atom_iio_len[CU8(base)]; + base += 3; + } +} + + +atom_context +*atom_parse(card_info *card, void *bios) +{ + int base; + atom_context *ctx = (atom_context*)malloc(sizeof(atom_context)); + char *str; + + ctx->card = card; + ctx->bios = bios; + + if (CU16(0) != ATOM_BIOS_MAGIC) { + TRACE("Invalid BIOS magic.\n"); + free(ctx); + return NULL; + } + if (strncmp(CSTR(ATOM_ATI_MAGIC_PTR), ATOM_ATI_MAGIC, + strlen(ATOM_ATI_MAGIC))) { + TRACE("Invalid ATI magic.\n"); + free(ctx); + return NULL; + } + + base = CU16(ATOM_ROM_TABLE_PTR); + if (strncmp(CSTR(base + ATOM_ROM_MAGIC_PTR), ATOM_ROM_MAGIC, + strlen(ATOM_ROM_MAGIC))) { + TRACE("Invalid ATOM magic.\n"); + free(ctx); + return NULL; + } + + ctx->cmd_table = CU16(base + ATOM_ROM_CMD_PTR); + ctx->data_table = CU16(base + ATOM_ROM_DATA_PTR); + atom_index_iio(ctx, CU16(ctx->data_table + ATOM_DATA_IIO_PTR) + 4); + + str = CSTR(CU16(base + ATOM_ROM_MSG_PTR)); + while (*str && ((*str == '\n') || (*str == '\r'))) + str++; + TRACE("ATOM BIOS: %s", str); + + return ctx; +} + + +int +atom_asic_init(atom_context *ctx) +{ + int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); + uint32 ps[16]; + memset(ps, 0, 64); + + ps[0] = CU32(hwi + ATOM_FWI_DEFSCLK_PTR); + ps[1] = CU32(hwi + ATOM_FWI_DEFMCLK_PTR); + if (!ps[0] || !ps[1]) + return 1; + + if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) + return 1; + + atom_execute_table(ctx, ATOM_CMD_INIT, ps); + + return 0; +} + + +void +atom_destroy(atom_context *ctx) +{ + if (ctx->iio) + free(ctx->iio); + free(ctx); +} diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 79f6f1f2cb..8a57c45859 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -21,27 +21,26 @@ * * Author: Stanislaw Skowronek */ - #ifndef ATOM_H #define ATOM_H -#ifndef __HAIKU__ -#include -#include "card.h" -#else +#include +#include + + struct card_info { - struct drm_device *dev; - void (* reg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ - uint32_t (* reg_read)(struct card_info *, uint32_t); /* filled by driver */ - void (* ioreg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ - uint32_t (* ioreg_read)(struct card_info *, uint32_t); /* filled by driver */ - void (* mc_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ - uint32_t (* mc_read)(struct card_info *, uint32_t); /* filled by driver */ - void (* pll_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ - uint32_t (* pll_read)(struct card_info *, uint32_t); /* filled by driver */ + // Filled by driver + void (*reg_write)(uint32 offset, uint32 data); + uint32 (*reg_read)(uint32 offset); + void (*ioreg_write)(uint32 offset, uint32 data); + uint32 (*ioreg_read)(uint32 offset); + void (*mc_write)(uint32 offset, uint32 data); + uint32 (*mc_read)(uint32 offset); + void (*pll_write)(uint32 offset, uint32 data); + uint32 (*pll_read)(uint32 offset); }; -#endif + #define ATOM_BIOS_MAGIC 0xAA55 #define ATOM_ATI_MAGIC_PTR 0x30 @@ -124,25 +123,25 @@ struct card_info { #define ATOM_IO_IIO 0x80 typedef struct atom_context_s { - card_info *card; - void *bios; - uint32_t cmd_table, data_table; - uint16_t *iio; + card_info *card; + void *bios; + uint32 cmd_table, data_table; + uint16 *iio; - uint16_t data_block; - uint32_t fb_base; - uint32_t divmul[2]; - uint16_t io_attr; - uint16_t reg_block; - uint8_t shift; - int cs_equal, cs_above; - int io_mode; + uint16 data_block; + uint32 fb_base; + uint32 divmul[2]; + uint16 io_attr; + uint16 reg_block; + uint8 shift; + int cs_equal, cs_above; + int io_mode; } atom_context; extern int atom_debug; atom_context *atom_parse(card_info *, void *); -void atom_execute_table(atom_context *, int, uint32_t *); +void atom_execute_table(atom_context *, int, uint32 *); int atom_asic_init(atom_context *); void atom_destroy(atom_context *); diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index a14ca7fff6..406d222de8 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -24,3 +24,46 @@ # define TRACE(x...) ; #endif + +// AtomBios related calls + + +status_t +bios_init() +{ + struct card_info *atom_card_info + = (card_info*)malloc(sizeof(card_info)); + + if (!atom_card_info) + return B_NO_MEMORY; + + atom_card_info->reg_read = _read32; + atom_card_info->reg_write = _write32; + + if (false) { + // TODO : if rio_mem, use ioreg + //atom_card_info->ioreg_read = cail_ioreg_read; + //atom_card_info->ioreg_write = cail_ioreg_write; + } else { + TRACE("%s: Cannot find PCI I/O BAR; using MMIO\n", __func__); + atom_card_info->ioreg_read = _read32; + atom_card_info->ioreg_write = _write32; + } + atom_card_info->mc_read = _read32; + atom_card_info->mc_write = _write32; + atom_card_info->pll_read = _read32; + atom_card_info->pll_write = _write32; + + // System VGA shadow bios? Why not (temporary) + atom_parse(atom_card_info, (void*)0xC0000); + + // TODO : we need to get a copy of the VGA bios :( + #if 0 + rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios); + mutex_init(&rdev->mode_info.atom_context->mutex); + radeon_atom_initialize_bios_scratch_regs(rdev->ddev); + atom_allocate_fb_scratch(rdev->mode_info.atom_context); + #endif + + return B_OK; +} diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index 80f8ca57c6..fd45b0546d 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -11,10 +11,7 @@ #include -// AtomBios includes -extern "C" { - #include "atom.h" -} +#include "atom.h" struct bios_info { @@ -23,8 +20,7 @@ struct bios_info { }; -status_t AtomParser(void *parameterSpace, uint8_t index, - void *handle, void *biosBase); +status_t bios_init(); #endif /* RADEON_HD_BIOS_H */ From 27f5d579244cd1e43a1469782e08642fdc14b7f2 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 2 Aug 2011 06:46:11 +0000 Subject: [PATCH 089/702] Fix coding style pointed out by Axel. Thanks for the array trick haven't known this one :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42539 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Jamfile | 6 +- .../{StackAndTile => stackandtile}/Jamfile | 4 +- .../SATDecorator.cpp | 0 .../SATDecorator.h | 0 .../SATGroup.cpp | 77 ++++++------------- .../{StackAndTile => stackandtile}/SATGroup.h | 27 ++++--- .../SATWindow.cpp | 0 .../SATWindow.h | 0 .../StackAndTile.cpp | 0 .../StackAndTile.h | 0 .../Stacking.cpp | 0 .../{StackAndTile => stackandtile}/Stacking.h | 0 .../{StackAndTile => stackandtile}/Tiling.cpp | 0 .../{StackAndTile => stackandtile}/Tiling.h | 0 14 files changed, 40 insertions(+), 74 deletions(-) rename src/servers/app/{StackAndTile => stackandtile}/Jamfile (86%) rename src/servers/app/{StackAndTile => stackandtile}/SATDecorator.cpp (100%) rename src/servers/app/{StackAndTile => stackandtile}/SATDecorator.h (100%) rename src/servers/app/{StackAndTile => stackandtile}/SATGroup.cpp (95%) rename src/servers/app/{StackAndTile => stackandtile}/SATGroup.h (94%) rename src/servers/app/{StackAndTile => stackandtile}/SATWindow.cpp (100%) rename src/servers/app/{StackAndTile => stackandtile}/SATWindow.h (100%) rename src/servers/app/{StackAndTile => stackandtile}/StackAndTile.cpp (100%) rename src/servers/app/{StackAndTile => stackandtile}/StackAndTile.h (100%) rename src/servers/app/{StackAndTile => stackandtile}/Stacking.cpp (100%) rename src/servers/app/{StackAndTile => stackandtile}/Stacking.h (100%) rename src/servers/app/{StackAndTile => stackandtile}/Tiling.cpp (100%) rename src/servers/app/{StackAndTile => stackandtile}/Tiling.h (100%) diff --git a/src/servers/app/Jamfile b/src/servers/app/Jamfile index 09d5feff2b..4027d3674f 100644 --- a/src/servers/app/Jamfile +++ b/src/servers/app/Jamfile @@ -5,7 +5,7 @@ UsePrivateHeaders app graphics input interface kernel shared storage support ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; -UseHeaders [ FDirName $(HAIKU_TOP) src servers app StackAndTile ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app stackandtile ] ; UseFreeTypeHeaders ; @@ -81,7 +81,7 @@ Server app_server : : libtranslation.so libbe.so libbnetapi.so libasdrawing.a libasremote.a libpainter.a libagg.a libfreetype.so - StackAndTile.a liblinprog.a libtextencoding.so libshared.a + libstackandtile.a liblinprog.a libtextencoding.so libshared.a $(TARGET_LIBSTDC++) : app_server.rdef @@ -92,4 +92,4 @@ SEARCH on [ FGristFiles $(font_src) ] = [ FDirName $(HAIKU_TOP) src servers app SubInclude HAIKU_TOP src servers app drawing ; -SubInclude HAIKU_TOP src servers app StackAndTile ; +SubInclude HAIKU_TOP src servers app stackandtile ; diff --git a/src/servers/app/StackAndTile/Jamfile b/src/servers/app/stackandtile/Jamfile similarity index 86% rename from src/servers/app/StackAndTile/Jamfile rename to src/servers/app/stackandtile/Jamfile index b781b141d8..56e4788c6e 100644 --- a/src/servers/app/StackAndTile/Jamfile +++ b/src/servers/app/stackandtile/Jamfile @@ -1,4 +1,4 @@ -SubDir HAIKU_TOP src servers app StackAndTile ; +SubDir HAIKU_TOP src servers app stackandtile ; UseLibraryHeaders agg lp_solve linprog ; UsePrivateHeaders app graphics interface shared kernel ; @@ -10,7 +10,7 @@ UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; UseFreeTypeHeaders ; -StaticLibrary StackAndTile.a : +StaticLibrary libstackandtile.a : SATDecorator.cpp SATGroup.cpp SATWindow.cpp diff --git a/src/servers/app/StackAndTile/SATDecorator.cpp b/src/servers/app/stackandtile/SATDecorator.cpp similarity index 100% rename from src/servers/app/StackAndTile/SATDecorator.cpp rename to src/servers/app/stackandtile/SATDecorator.cpp diff --git a/src/servers/app/StackAndTile/SATDecorator.h b/src/servers/app/stackandtile/SATDecorator.h similarity index 100% rename from src/servers/app/StackAndTile/SATDecorator.h rename to src/servers/app/stackandtile/SATDecorator.h diff --git a/src/servers/app/StackAndTile/SATGroup.cpp b/src/servers/app/stackandtile/SATGroup.cpp similarity index 95% rename from src/servers/app/StackAndTile/SATGroup.cpp rename to src/servers/app/stackandtile/SATGroup.cpp index d434a2ce70..0eb77038f3 100644 --- a/src/servers/app/StackAndTile/SATGroup.cpp +++ b/src/servers/app/stackandtile/SATGroup.cpp @@ -66,17 +66,8 @@ bool WindowArea::MoveWindowToPosition(SATWindow* window, int32 index) { int32 oldIndex = fWindowList.IndexOf(window); - if (oldIndex < 0) - return false; ASSERT(oldIndex != index); - if (oldIndex < index) - index++; - else - oldIndex++; - if (!fWindowList.AddItem(window, index)) - return false; - fWindowList.RemoveItemAt(oldIndex); - return true; + return fWindowList.MoveItem(oldIndex, index); } @@ -94,8 +85,7 @@ WindowArea::_AddWindow(SATWindow* window, SATWindow* after) int32 indexAfter = fWindowList.IndexOf(after); if (!fWindowList.AddItem(window, indexAfter + 1)) return false; - } - else if (!fWindowList.AddItem(window)) + } else if (fWindowList.AddItem(window) == false) return false; AcquireReference(); @@ -361,7 +351,14 @@ Crossing::~Crossing() Corner* Crossing::GetCorner(Corner::position_t corner) const { - return _GetCorner(corner); + return &const_cast(fCorners)[corner]; +} + + +Corner* +Crossing::GetOppositeCorner(Corner::position_t corner) const +{ + return &const_cast(fCorners)[3 - corner]; } @@ -383,47 +380,13 @@ void Crossing::Trace() const { STRACE_SAT("left-top corner: "); - fLeftTop.Trace(); + fCorners[Corner::kLeftTop].Trace(); STRACE_SAT("right-top corner: "); - fRightTop.Trace(); + fCorners[Corner::kRightTop].Trace(); STRACE_SAT("left-bottom corner: "); - fLeftBottom.Trace(); + fCorners[Corner::kLeftBottom].Trace(); STRACE_SAT("right-bottom corner: "); - fRightBottom.Trace(); -} - - -Corner* -Crossing::_GetCorner(Corner::position_t corner) const -{ - switch (corner) { - case Corner::kLeftTop: - return const_cast(&fLeftTop); - case Corner::kRightTop: - return const_cast(&fRightTop); - case Corner::kLeftBottom: - return const_cast(&fLeftBottom); - case Corner::kRightBottom: - return const_cast(&fRightBottom); - }; - return NULL; -} - - -Corner* -Crossing::GetOppositeCorner(Corner::position_t corner) const -{ - switch (corner) { - case Corner::kLeftTop: - return const_cast(&fRightBottom); - case Corner::kRightTop: - return const_cast(&fLeftBottom); - case Corner::kLeftBottom: - return const_cast(&fRightTop); - case Corner::kRightBottom: - return const_cast(&fLeftTop); - }; - return NULL; + fCorners[Corner::kRightBottom].Trace(); } @@ -520,13 +483,15 @@ int32 Tab::FindCrossingIndex(Tab* tab) { if (fOrientation == kVertical) { - for (int32 i = 0; i < fCrossingList.CountItems(); i++) + for (int32 i = 0; i < fCrossingList.CountItems(); i++) { if (fCrossingList.ItemAt(i)->HorizontalTab() == tab) return i; + } } else { - for (int32 i = 0; i < fCrossingList.CountItems(); i++) + for (int32 i = 0; i < fCrossingList.CountItems(); i++) { if (fCrossingList.ItemAt(i)->VerticalTab() == tab) return i; + } } return -1; } @@ -536,13 +501,15 @@ int32 Tab::FindCrossingIndex(float pos) { if (fOrientation == kVertical) { - for (int32 i = 0; i < fCrossingList.CountItems(); i++) + for (int32 i = 0; i < fCrossingList.CountItems(); i++) { if (fCrossingList.ItemAt(i)->HorizontalTab()->Position() == pos) return i; + } } else { - for (int32 i = 0; i < fCrossingList.CountItems(); i++) + for (int32 i = 0; i < fCrossingList.CountItems(); i++) { if (fCrossingList.ItemAt(i)->VerticalTab()->Position() == pos) return i; + } } return -1; } diff --git a/src/servers/app/StackAndTile/SATGroup.h b/src/servers/app/stackandtile/SATGroup.h similarity index 94% rename from src/servers/app/StackAndTile/SATGroup.h rename to src/servers/app/stackandtile/SATGroup.h index 3f26050c6c..df8feeaefb 100644 --- a/src/servers/app/StackAndTile/SATGroup.h +++ b/src/servers/app/stackandtile/SATGroup.h @@ -35,10 +35,10 @@ public: enum position_t { - kLeftTop, - kRightTop, - kLeftBottom, - kRightBottom + kLeftTop = 0, + kRightTop = 1, + kLeftBottom = 2, + kRightBottom = 3 }; Corner(); @@ -58,22 +58,21 @@ public: Corner* GetOppositeCorner( Corner::position_t corner) const; - Corner* LeftTopCorner() { return &fLeftTop; } - Corner* RightTopCorner() { return &fRightTop; } - Corner* LeftBottomCorner() { return &fLeftBottom; } - Corner* RightBottomCorner() { return &fRightBottom; } + Corner* LeftTopCorner() + { return &fCorners[Corner::kLeftTop]; } + Corner* RightTopCorner() + { return &fCorners[Corner::kRightTop]; } + Corner* LeftBottomCorner() + { return &fCorners[Corner::kLeftBottom]; } + Corner* RightBottomCorner() + { return &fCorners[Corner::kRightBottom]; } Tab* VerticalTab() const; Tab* HorizontalTab() const; void Trace() const; private: - Corner* _GetCorner(Corner::position_t corner) const; - - Corner fLeftTop; - Corner fRightTop; - Corner fLeftBottom; - Corner fRightBottom; + Corner fCorners[4]; Tab* fVerticalTab; Tab* fHorizontalTab; diff --git a/src/servers/app/StackAndTile/SATWindow.cpp b/src/servers/app/stackandtile/SATWindow.cpp similarity index 100% rename from src/servers/app/StackAndTile/SATWindow.cpp rename to src/servers/app/stackandtile/SATWindow.cpp diff --git a/src/servers/app/StackAndTile/SATWindow.h b/src/servers/app/stackandtile/SATWindow.h similarity index 100% rename from src/servers/app/StackAndTile/SATWindow.h rename to src/servers/app/stackandtile/SATWindow.h diff --git a/src/servers/app/StackAndTile/StackAndTile.cpp b/src/servers/app/stackandtile/StackAndTile.cpp similarity index 100% rename from src/servers/app/StackAndTile/StackAndTile.cpp rename to src/servers/app/stackandtile/StackAndTile.cpp diff --git a/src/servers/app/StackAndTile/StackAndTile.h b/src/servers/app/stackandtile/StackAndTile.h similarity index 100% rename from src/servers/app/StackAndTile/StackAndTile.h rename to src/servers/app/stackandtile/StackAndTile.h diff --git a/src/servers/app/StackAndTile/Stacking.cpp b/src/servers/app/stackandtile/Stacking.cpp similarity index 100% rename from src/servers/app/StackAndTile/Stacking.cpp rename to src/servers/app/stackandtile/Stacking.cpp diff --git a/src/servers/app/StackAndTile/Stacking.h b/src/servers/app/stackandtile/Stacking.h similarity index 100% rename from src/servers/app/StackAndTile/Stacking.h rename to src/servers/app/stackandtile/Stacking.h diff --git a/src/servers/app/StackAndTile/Tiling.cpp b/src/servers/app/stackandtile/Tiling.cpp similarity index 100% rename from src/servers/app/StackAndTile/Tiling.cpp rename to src/servers/app/stackandtile/Tiling.cpp diff --git a/src/servers/app/StackAndTile/Tiling.h b/src/servers/app/stackandtile/Tiling.h similarity index 100% rename from src/servers/app/StackAndTile/Tiling.h rename to src/servers/app/stackandtile/Tiling.h From 817f7d80039d667922f9ee05f3d6248932b1fba9 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 2 Aug 2011 10:56:39 +0000 Subject: [PATCH 090/702] Check if there is still a decorator. Fixes #7894. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42540 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 25d034f28b..32fbe90b1e 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -2097,7 +2097,8 @@ Window::DetachFromWindowStack(bool ownStackNeeded) Window* remainingTop = fCurrentStack->TopLayerWindow(); if (remainingTop != NULL) { - decorator->SetDrawingEngine(remainingTop->fDrawingEngine); + if (decorator != NULL) + decorator->SetDrawingEngine(remainingTop->fDrawingEngine); // propagate focus to the decorator remainingTop->SetFocus(remainingTop->IsFocus()); remainingTop->SetFeel(remainingTop->Feel()); From ef2909a10ff51b6d543e9208e84055ad1af1a8c5 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 14:58:56 +0000 Subject: [PATCH 091/702] * Move bios_info into shared info * Pull pci_rom base address from pci subsystem * Point AtomBIOS parser to pci rom address to set up and malloc atom_context * This is untested! Don't run on an expensive card until I test it on a cheaper one! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42541 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon_hd/radeon_hd.h | 3 +++ src/add-ons/accelerants/radeon_hd/accelerant.cpp | 10 +--------- src/add-ons/accelerants/radeon_hd/accelerant.h | 2 ++ src/add-ons/accelerants/radeon_hd/bios.cpp | 12 ++++++++---- src/add-ons/accelerants/radeon_hd/bios.h | 6 ------ .../kernel/drivers/graphics/radeon_hd/radeon_hd.cpp | 3 +++ 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index f867546e1d..089dada2cb 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -71,6 +71,9 @@ struct radeon_shared_info { area_id mode_list_area; // area containing display mode list uint32 mode_count; + uint32 rom_base; // AtomBIOS base location + uint32 rom_size; // AtomBIOS size + display_mode current_mode; uint32 bytes_per_row; uint32 bits_per_pixel; diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index e721c5c646..75b342d575 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -37,7 +37,6 @@ extern "C" void _sPrintf(const char *format, ...); struct accelerant_info *gInfo; -struct bios_info *gBIOS; display_info *gDisplay[MAX_DISPLAY]; @@ -100,13 +99,11 @@ init_common(int device, bool isClone) // initialize global accelerant info structure gInfo = (accelerant_info *)malloc(sizeof(accelerant_info)); - gBIOS = (bios_info *)malloc(sizeof(bios_info)); - if (gInfo == NULL || gBIOS == NULL) + if (gInfo == NULL) return B_NO_MEMORY; memset(gInfo, 0, sizeof(accelerant_info)); - memset(gBIOS, 0, sizeof(bios_info)); for (uint32 id = 0; id < MAX_DISPLAY; id++) { gDisplay[id] = (display_info *)malloc(sizeof(display_info)); @@ -131,7 +128,6 @@ init_common(int device, bool isClone) if (ioctl(device, RADEON_GET_PRIVATE_DATA, &data, sizeof(radeon_get_private_data)) != 0) { free(gInfo); - free(gBIOS); return B_ERROR; } @@ -142,7 +138,6 @@ init_common(int device, bool isClone) status_t status = sharedCloner.InitCheck(); if (status < B_OK) { free(gInfo); - free(gBIOS); TRACE("%s, failed shared area%i, %i\n", __func__, data.shared_info_area, gInfo->shared_info_area); return status; @@ -155,7 +150,6 @@ init_common(int device, bool isClone) status = regsCloner.InitCheck(); if (status < B_OK) { free(gInfo); - free(gBIOS); return status; } @@ -189,8 +183,6 @@ uninit_common(void) free(gInfo); } - free(gBIOS); - for (uint32 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id] != NULL) { free(gDisplay[id]->regs); diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 8ce02b5f6d..8c2502c4de 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -10,6 +10,7 @@ #define RADEON_HD_ACCELERANT_H +#include "atom.h" #include "mode.h" #include "radeon_hd.h" #include "pll.h" @@ -112,6 +113,7 @@ typedef struct { extern accelerant_info *gInfo; +extern atom_context *gAtomBIOS; extern display_info *gDisplay[MAX_DISPLAY]; diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 406d222de8..bd12685708 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -25,7 +25,7 @@ #endif -// AtomBios related calls +atom_context *gAtomBIOS; status_t @@ -54,10 +54,14 @@ bios_init() atom_card_info->pll_read = _read32; atom_card_info->pll_write = _write32; - // System VGA shadow bios? Why not (temporary) - atom_parse(atom_card_info, (void*)0xC0000); + // Point AtomBIOS parser to card bios and malloc gAtomBIOS + gAtomBIOS = atom_parse(atom_card_info, (void*)gInfo->shared_info->rom_base); + + if (gAtomBIOS == NULL) { + TRACE("%s: couldn't parse system AtomBIOS\n", __func__); + return B_ERROR; + } - // TODO : we need to get a copy of the VGA bios :( #if 0 rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios); mutex_init(&rdev->mode_info.atom_context->mutex); diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index fd45b0546d..6f731b5f86 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -14,12 +14,6 @@ #include "atom.h" -struct bios_info { - uint32 location; - uint32 size; -}; - - status_t bios_init(); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 816adada5b..d03db2fdeb 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -102,6 +102,9 @@ radeon_hd_init(radeon_info &info) info.shared_info->frame_buffer_int = read32(info.registers + R6XX_CONFIG_FB_BASE); + info.shared_info->rom_base = info.pci->u.h0.rom_base; + // Grab ROM base from PCI (AtomBIOS location for card) + strcpy(info.shared_info->device_identifier, info.device_identifier); // Pull active monitor VESA EDID from boot loader From 4034e8950e350e045167dd44441e882287988d90 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 16:15:32 +0000 Subject: [PATCH 092/702] * Fix Jamfile to properly reference external source file. (thanks DeadYak!) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42542 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/Jamfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile b/src/add-ons/accelerants/radeon_hd/Jamfile index c6ce582dda..e769ff1874 100644 --- a/src/add-ons/accelerants/radeon_hd/Jamfile +++ b/src/add-ons/accelerants/radeon_hd/Jamfile @@ -1,5 +1,6 @@ SubDir HAIKU_TOP src add-ons accelerants radeon_hd ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants radeon_hd atombios ] ; SetSubDirSupportedPlatformsBeOSCompatible ; @@ -9,7 +10,7 @@ UsePrivateHeaders [ FDirName graphics radeon_hd ] ; UsePrivateHeaders [ FDirName graphics common ] ; Addon radeon_hd.accelerant : - atombios/atom.cpp + atom.cpp accelerant.cpp engine.cpp hooks.cpp From 22582a297c7e74465243aad35a040ff3822cd9ce Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 18:05:52 +0000 Subject: [PATCH 093/702] * Map AtomBIOS specified by PCI rom into virtual memory * Point AtomBIOS to PCI rom mapped in memory * Things no longer crash, but we get an Invalid BIOS Magic error in the logs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42543 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 6 ++++-- .../accelerants/radeon_hd/atombios/atom.cpp | 4 ++-- src/add-ons/accelerants/radeon_hd/bios.cpp | 2 +- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 21 ++++++++++++++++--- .../graphics/radeon_hd/radeon_hd_private.h | 1 + 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 089dada2cb..856595e3a8 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -71,8 +71,10 @@ struct radeon_shared_info { area_id mode_list_area; // area containing display mode list uint32 mode_count; - uint32 rom_base; // AtomBIOS base location - uint32 rom_size; // AtomBIOS size + uint32 rom_phys; // rom base location + area_id rom_area; // area of mapped rom + uint32 rom_size; // rom size + uint8* rom; // virtual memory mapped PCI ROM display_mode current_mode; uint32 bytes_per_row; diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 66fffd66bd..4e3ed7872b 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -1048,8 +1048,8 @@ atom_index_iio(atom_context *ctx, int base) } -atom_context -*atom_parse(card_info *card, void *bios) +atom_context* +atom_parse(card_info *card, void *bios) { int base; atom_context *ctx = (atom_context*)malloc(sizeof(atom_context)); diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index bd12685708..ace7119982 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -55,7 +55,7 @@ bios_init() atom_card_info->pll_write = _write32; // Point AtomBIOS parser to card bios and malloc gAtomBIOS - gAtomBIOS = atom_parse(atom_card_info, (void*)gInfo->shared_info->rom_base); + gAtomBIOS = atom_parse(atom_card_info, gInfo->shared_info->rom); if (gAtomBIOS == NULL) { TRACE("%s: couldn't parse system AtomBIOS\n", __func__); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index d03db2fdeb..937ee742af 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -84,6 +84,19 @@ radeon_hd_init(radeon_info &info) return info.framebuffer_area; } + // *** AtomBIOS mapping + AreaKeeper romMapper; + info.rom_area = romMapper.Map("radeon hd AtomBIOS", + (void *)info.pci->u.h0.rom_base, + info.pci->u.h0.rom_size, + B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, + (void **)&info.shared_info->rom); + if (frambufferMapper.InitCheck() < B_OK) { + dprintf(DEVICE_NAME ": card(%ld): could not map AtomBIOS!\n", + info.id); + return info.rom_area; + } + // Turn on write combining for the area vm_set_area_memory_type(info.framebuffer_area, info.pci->u.h0.base_registers[RHD_FB_BAR], B_MTR_WC); @@ -91,6 +104,7 @@ radeon_hd_init(radeon_info &info) sharedCreator.Detach(); mmioMapper.Detach(); frambufferMapper.Detach(); + romMapper.Detach(); // Pass common information to accelerant info.shared_info->device_id = info.device_id; @@ -101,9 +115,9 @@ radeon_hd_init(radeon_info &info) = info.pci->u.h0.base_registers[RHD_FB_BAR]; info.shared_info->frame_buffer_int = read32(info.registers + R6XX_CONFIG_FB_BASE); - - info.shared_info->rom_base = info.pci->u.h0.rom_base; - // Grab ROM base from PCI (AtomBIOS location for card) + info.shared_info->rom_area = info.rom_area; + info.shared_info->rom_phys = info.pci->u.h0.rom_base; + info.shared_info->rom_size = info.pci->u.h0.rom_size; strcpy(info.shared_info->device_identifier, info.device_identifier); @@ -167,5 +181,6 @@ radeon_hd_uninit(radeon_info &info) delete_area(info.shared_area); delete_area(info.registers_area); delete_area(info.framebuffer_area); + delete_area(info.rom_area); } diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index aa3165f745..c7ab7316dd 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -27,6 +27,7 @@ struct radeon_info { uint8* registers; area_id registers_area; area_id framebuffer_area; + area_id rom_area; struct radeon_shared_info* shared_info; area_id shared_area; From 32e7d18a75c4cc95a78858bb3b82a199a8e494b7 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 18:14:54 +0000 Subject: [PATCH 094/702] * Quick style cleanup * Check for failed malloc in atom_parse git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42544 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 4e3ed7872b..5a96a8c562 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -1051,40 +1051,44 @@ atom_index_iio(atom_context *ctx, int base) atom_context* atom_parse(card_info *card, void *bios) { - int base; atom_context *ctx = (atom_context*)malloc(sizeof(atom_context)); - char *str; + + if (ctx == NULL) { + TRACE("%s: Error: No memory for atom_context mapping\n", __func__); + return NULL; + } ctx->card = card; ctx->bios = bios; if (CU16(0) != ATOM_BIOS_MAGIC) { - TRACE("Invalid BIOS magic.\n"); - free(ctx); - return NULL; + TRACE("Invalid BIOS magic.\n"); + free(ctx); + return NULL; } if (strncmp(CSTR(ATOM_ATI_MAGIC_PTR), ATOM_ATI_MAGIC, strlen(ATOM_ATI_MAGIC))) { - TRACE("Invalid ATI magic.\n"); - free(ctx); - return NULL; + TRACE("Invalid ATI magic.\n"); + free(ctx); + return NULL; } - base = CU16(ATOM_ROM_TABLE_PTR); + int base = CU16(ATOM_ROM_TABLE_PTR); if (strncmp(CSTR(base + ATOM_ROM_MAGIC_PTR), ATOM_ROM_MAGIC, strlen(ATOM_ROM_MAGIC))) { - TRACE("Invalid ATOM magic.\n"); - free(ctx); - return NULL; + TRACE("Invalid ATOM magic.\n"); + free(ctx); + return NULL; } ctx->cmd_table = CU16(base + ATOM_ROM_CMD_PTR); ctx->data_table = CU16(base + ATOM_ROM_DATA_PTR); atom_index_iio(ctx, CU16(ctx->data_table + ATOM_DATA_IIO_PTR) + 4); - str = CSTR(CU16(base + ATOM_ROM_MSG_PTR)); + char *str = CSTR(CU16(base + ATOM_ROM_MSG_PTR)); while (*str && ((*str == '\n') || (*str == '\r'))) str++; + TRACE("ATOM BIOS: %s", str); return ctx; From 52aeea2482063e86815af151d10643dd5c98e53f Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 22:14:13 +0000 Subject: [PATCH 095/702] * Register additions * No functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42545 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon_hd/r600_reg.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/headers/private/graphics/radeon_hd/r600_reg.h b/headers/private/graphics/radeon_hd/r600_reg.h index 3c27c7f720..51629338dc 100644 --- a/headers/private/graphics/radeon_hd/r600_reg.h +++ b/headers/private/graphics/radeon_hd/r600_reg.h @@ -34,6 +34,14 @@ #include "r600_reg_r7xx.h" +#define R600_ROM_CNTL 0x1600 +#define R600_BUS_CNTL 0x5420 +#define R600_BIOS_ROM_DIS (1 << 1) +#define R600_SCK_OVERWRITE (1 << 1) +#define DVGA_CONTROL_MODE_ENABLE (1 << 0) +#define DVGA_CONTROL_TIMING_SELECT (1 << 8) +#define VGA_VSTATUS_CNTL_MASK (3 << 16) + /* SET_*_REG offsets + ends */ enum { SET_CONFIG_REG_offset = 0x00008000, From 39b96f9e92af9cba27e7431e9482c68410cb7037 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 22:16:23 +0000 Subject: [PATCH 096/702] * Rename PCI rom shared area.. isn't AtomBios until we verify it is git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42546 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 937ee742af..901a7db0dc 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -86,7 +86,7 @@ radeon_hd_init(radeon_info &info) // *** AtomBIOS mapping AreaKeeper romMapper; - info.rom_area = romMapper.Map("radeon hd AtomBIOS", + info.rom_area = romMapper.Map("radeon hd rom", (void *)info.pci->u.h0.rom_base, info.pci->u.h0.rom_size, B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, From 1c44bb215761366278902e794ff1c9af64012ead Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 2 Aug 2011 22:20:12 +0000 Subject: [PATCH 097/702] Check if the dirty region is valid. Part of #7896. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42547 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/decorator/DefaultDecorator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/servers/app/decorator/DefaultDecorator.cpp b/src/servers/app/decorator/DefaultDecorator.cpp index 0dc34cdd5d..7b07782169 100644 --- a/src/servers/app/decorator/DefaultDecorator.cpp +++ b/src/servers/app/decorator/DefaultDecorator.cpp @@ -1247,7 +1247,8 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) if (fTitleBarRect.IsValid()) { if (fTabList.CountItems() > 1) { _DoTabLayout(); - dirty->Include(fTitleBarRect); + if (dirty != NULL) + dirty->Include(fTitleBarRect); return; } From 55fbf11fd7ac3b4c6002b4d8ff3ec2372fa5e8c4 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 2 Aug 2011 22:27:12 +0000 Subject: [PATCH 098/702] If a window is hidden remove it from the S&T group. This happens when MediaPlayer goes fullscreen. Maybe not optimal but at least consistent with terminal which also left the S&T group in fullscreen mode. This is because the terminal has no decorator in fullscreen mode and thus can't be stacked any more (maybe this should be solved in the future...). Fixes #7895, #7896. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42548 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 2 + src/servers/app/DesktopListener.cpp | 13 +++++ src/servers/app/DesktopListener.h | 2 + src/servers/app/stackandtile/StackAndTile.cpp | 47 ++++++++++++------- src/servers/app/stackandtile/StackAndTile.h | 1 + 5 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 7baf5bc41d..2cc554f0e0 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1300,6 +1300,8 @@ Desktop::HideWindow(Window* window) } } + NotifyWindowHidden(window); + UnlockAllWindows(); if (window == fWindowUnderMouse) diff --git a/src/servers/app/DesktopListener.cpp b/src/servers/app/DesktopListener.cpp index b87e975dda..cce860ddc5 100644 --- a/src/servers/app/DesktopListener.cpp +++ b/src/servers/app/DesktopListener.cpp @@ -229,6 +229,19 @@ DesktopObservable::NotifyWindowWorkspacesChanged(Window* window, } +void +DesktopObservable::NotifyWindowHidden(Window* window) +{ + if (fWeAreInvoking) + return; + InvokeGuard invokeGuard(fWeAreInvoking); + + for (DesktopListener* listener = fDesktopListenerList.First(); + listener != NULL; listener = fDesktopListenerList.GetNext(listener)) + listener->WindowHidden(window); +} + + void DesktopObservable::NotifyWindowMinimized(Window* window, bool minimize) { diff --git a/src/servers/app/DesktopListener.h b/src/servers/app/DesktopListener.h index 0a257dce31..d44d242798 100644 --- a/src/servers/app/DesktopListener.h +++ b/src/servers/app/DesktopListener.h @@ -55,6 +55,7 @@ public: Window* behindOf) = 0; virtual void WindowWorkspacesChanged(Window* window, uint32 workspaces) = 0; + virtual void WindowHidden(Window* window) = 0; virtual void WindowMinimized(Window* window, bool minimize) = 0; @@ -111,6 +112,7 @@ public: Window* behindOf); void NotifyWindowWorkspacesChanged(Window* window, uint32 workspaces); + void NotifyWindowHidden(Window* window); void NotifyWindowMinimized(Window* window, bool minimize); diff --git a/src/servers/app/stackandtile/StackAndTile.cpp b/src/servers/app/stackandtile/StackAndTile.cpp index 2f26ab75e6..b4f76d993a 100644 --- a/src/servers/app/stackandtile/StackAndTile.cpp +++ b/src/servers/app/stackandtile/StackAndTile.cpp @@ -270,7 +270,7 @@ void StackAndTile::WindowMoved(Window* window) { SATWindow* satWindow = GetSATWindow(window); - if (!satWindow) + if (satWindow == NULL) return; if (SATKeyPressed() && fCurrentSATWindow) @@ -284,7 +284,7 @@ void StackAndTile::WindowResized(Window* window) { SATWindow* satWindow = GetSATWindow(window); - if (!satWindow) + if (satWindow == NULL) return; satWindow->Resized(); @@ -298,8 +298,8 @@ StackAndTile::WindowResized(Window* window) void StackAndTile::WindowActitvated(Window* window) { - SATWindow* satWindow = GetSATWindow(window); - if (!satWindow) + SATWindow* satWindow = GetSATWindow(window); + if (satWindow == NULL) return; _ActivateWindow(satWindow); } @@ -308,14 +308,14 @@ StackAndTile::WindowActitvated(Window* window) void StackAndTile::WindowSentBehind(Window* window, Window* behindOf) { - SATWindow* satWindow = GetSATWindow(window); - if (!satWindow) + SATWindow* satWindow = GetSATWindow(window); + if (satWindow == NULL) return; SATGroup* group = satWindow->GetGroup(); - if (!group) + if (group == NULL) return; Desktop* desktop = satWindow->GetWindow()->Desktop(); - if (!desktop) + if (desktop == NULL) return; WindowIterator iter(group, true); @@ -330,14 +330,14 @@ StackAndTile::WindowSentBehind(Window* window, Window* behindOf) void StackAndTile::WindowWorkspacesChanged(Window* window, uint32 workspaces) { - SATWindow* satWindow = GetSATWindow(window); - if (!satWindow) + SATWindow* satWindow = GetSATWindow(window); + if (satWindow == NULL) return; SATGroup* group = satWindow->GetGroup(); - if (!group) + if (group == NULL) return; Desktop* desktop = satWindow->GetWindow()->Desktop(); - if (!desktop) + if (desktop == NULL) return; for (int i = 0; i < group->CountItems(); i++) { @@ -349,16 +349,29 @@ StackAndTile::WindowWorkspacesChanged(Window* window, uint32 workspaces) void -StackAndTile::WindowMinimized(Window* window, bool minimize) +StackAndTile::WindowHidden(Window* window) { - SATWindow* satWindow = GetSATWindow(window); - if (!satWindow) + SATWindow* satWindow = GetSATWindow(window); + if (satWindow == NULL) return; SATGroup* group = satWindow->GetGroup(); - if (!group) + if (group == NULL) + return; + group->RemoveWindow(satWindow); +} + + +void +StackAndTile::WindowMinimized(Window* window, bool minimize) +{ + SATWindow* satWindow = GetSATWindow(window); + if (satWindow == NULL) + return; + SATGroup* group = satWindow->GetGroup(); + if (group == NULL) return; Desktop* desktop = satWindow->GetWindow()->Desktop(); - if (!desktop) + if (desktop == NULL) return; for (int i = 0; i < group->CountItems(); i++) { diff --git a/src/servers/app/stackandtile/StackAndTile.h b/src/servers/app/stackandtile/StackAndTile.h index 2aae3e9d04..7fc77dd042 100644 --- a/src/servers/app/stackandtile/StackAndTile.h +++ b/src/servers/app/stackandtile/StackAndTile.h @@ -72,6 +72,7 @@ public: Window* behindOf); virtual void WindowWorkspacesChanged(Window* window, uint32 workspaces); + virtual void WindowHidden(Window* window); virtual void WindowMinimized(Window* window, bool minimize); virtual void WindowTabLocationChanged(Window* window, From c70bf97cfc99652317b0418f9a53c8791cf695e0 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 2 Aug 2011 22:42:57 +0000 Subject: [PATCH 099/702] Set the top most window look when switching between windows in a stack. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42549 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 32fbe90b1e..8a003b0be9 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -2148,6 +2148,7 @@ Window::AddWindowToStack(Window* window) if (decorator != NULL) decorator->AddTab(window->Title(), position, &dirty); + window->SetLook(window->Look(), &dirty); fDesktop->RebuildAndRedrawAfterWindowChange(TopLayerStackWindow(), dirty); window->SetFocus(window->IsFocus()); return true; @@ -2195,6 +2196,8 @@ Window::MoveToTopStackLayer() if (decorator == NULL) return false; decorator->SetDrawingEngine(fDrawingEngine); + DesktopSettings settings(fDesktop); + SetLook(Look(), NULL); decorator->SetTopTap(PositionInStack()); return fCurrentStack->MoveToTopLayer(this); } From 81cd6636667750c27d5bad289fa2625926d7c953 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 23:11:15 +0000 Subject: [PATCH 100/702] * refactor accelerant debugging * clone VGA rom shared area in accelerant * enable access, and make a copy of the VGA bios * give malloc'ed VGA bios pointer to AtomBIOS parser * Still invalid BIOS magic * TODO : Move atomBIOS pointer and reorganize some stuff git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42550 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 71 +++++++++++++++++-- .../accelerants/radeon_hd/accelerant.h | 3 + src/add-ons/accelerants/radeon_hd/bios.cpp | 11 ++- src/add-ons/accelerants/radeon_hd/bios.h | 2 +- 4 files changed, 79 insertions(+), 8 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 75b342d575..93e5cf1241 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -17,6 +17,8 @@ #include "pll.h" #include "utility.h" +#include + #include #include #include @@ -27,9 +29,10 @@ #include +#undef TRACE + #define TRACE_ACCELERANT #ifdef TRACE_ACCELERANT -extern "C" void _sPrintf(const char *format, ...); # define TRACE(x...) _sPrintf("radeon_hd: " x) #else # define TRACE(x...) ; @@ -138,8 +141,7 @@ init_common(int device, bool isClone) status_t status = sharedCloner.InitCheck(); if (status < B_OK) { free(gInfo); - TRACE("%s, failed shared area%i, %i\n", - __func__, data.shared_info_area, gInfo->shared_info_area); + TRACE("%s, failed to create shared area\n", __func__); return status; } @@ -150,11 +152,24 @@ init_common(int device, bool isClone) status = regsCloner.InitCheck(); if (status < B_OK) { free(gInfo); + TRACE("%s, failed to create mmio area\n", __func__); return status; } + AreaCloner romCloner; + gInfo->rom_area = romCloner.Clone("radeon hd rom", + (void **)&gInfo->rom, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, + gInfo->shared_info->rom_area); + status = romCloner.InitCheck(); + if (status < B_OK) { + //free(gInfo); + TRACE("%s, failed to create rom area\n", __func__); + //return status; + } + sharedCloner.Keep(); regsCloner.Keep(); + romCloner.Keep(); // Define Radeon PLL default ranges gInfo->shared_info->pll_info.reference_frequency @@ -173,6 +188,7 @@ uninit_common(void) if (gInfo != NULL) { delete_area(gInfo->regs_area); delete_area(gInfo->shared_info_area); + delete_area(gInfo->rom_area); gInfo->regs_area = gInfo->shared_info_area = -1; @@ -192,6 +208,52 @@ uninit_common(void) } +status_t +radeon_init_bios() +{ + radeon_shared_info &info = *gInfo->shared_info; + + uint32 bus_cntl = Read32(OUT, R600_BUS_CNTL); + uint32 d1vga_control = Read32(OUT, D1VGA_CONTROL); + uint32 d2vga_control = Read32(OUT, D2VGA_CONTROL); + uint32 vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); + uint32 rom_cntl = Read32(OUT, R600_ROM_CNTL); + + // Enable rom access + Write32(OUT, R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); + /* Disable VGA mode */ + Write32(OUT, D1VGA_CONTROL, (d1vga_control + & ~(DVGA_CONTROL_MODE_ENABLE + | DVGA_CONTROL_TIMING_SELECT))); + Write32(OUT, D2VGA_CONTROL, (d2vga_control + & ~(DVGA_CONTROL_MODE_ENABLE + | DVGA_CONTROL_TIMING_SELECT))); + Write32(OUT, VGA_RENDER_CONTROL, (vga_render_control + & ~VGA_VSTATUS_CNTL_MASK)); + Write32(OUT, R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); + + void* atomBIOS = (void*)malloc(info.rom_size); + if (atomBIOS == NULL) + return B_NO_MEMORY; + + snooze(2); + + memcpy(atomBIOS, gInfo->rom, info.rom_size); + + /* restore regs */ + Write32(OUT, R600_BUS_CNTL, bus_cntl); + Write32(OUT, D1VGA_CONTROL, d1vga_control); + Write32(OUT, D2VGA_CONTROL, d2vga_control); + Write32(OUT, VGA_RENDER_CONTROL, vga_render_control); + Write32(OUT, R600_ROM_CNTL, rom_cntl); + + // Init AtomBIOS + bios_init(atomBIOS); + + return B_OK; +} + + // #pragma mark - public accelerant functions @@ -210,8 +272,7 @@ radeon_init_accelerant(int device) init_lock(&info.accelerant_lock, "radeon hd accelerant"); init_lock(&info.engine_lock, "radeon hd engine"); - // Init AtomBIOS - bios_init(); + radeon_init_bios(); status = detect_displays(); //if (status != B_OK) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 8c2502c4de..282868b668 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -36,6 +36,9 @@ struct accelerant_info { display_mode *mode_list; // cloned list of standard display modes area_id mode_list_area; + uint8 *rom; + area_id rom_area; + edid1_info edid_info; bool has_edid; diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index ace7119982..6118792c5d 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -29,8 +29,15 @@ atom_context *gAtomBIOS; status_t -bios_init() +bios_init(void* bios) { + if (gInfo->rom == NULL) { + // just incase, this prevents a crash + TRACE("%s: called even though VGA rom hasn't been mapped!\n", + __func__); + return B_ERROR; + } + struct card_info *atom_card_info = (card_info*)malloc(sizeof(card_info)); @@ -55,7 +62,7 @@ bios_init() atom_card_info->pll_write = _write32; // Point AtomBIOS parser to card bios and malloc gAtomBIOS - gAtomBIOS = atom_parse(atom_card_info, gInfo->shared_info->rom); + gAtomBIOS = atom_parse(atom_card_info, bios); if (gAtomBIOS == NULL) { TRACE("%s: couldn't parse system AtomBIOS\n", __func__); diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index 6f731b5f86..97faed79cb 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -14,7 +14,7 @@ #include "atom.h" -status_t bios_init(); +status_t bios_init(void* bios); #endif /* RADEON_HD_BIOS_H */ From 8992f603edb092483e71bdfc74724d97d05b2d34 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 2 Aug 2011 23:13:45 +0000 Subject: [PATCH 101/702] * var typo fix in driver rom shared area creation git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42551 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 901a7db0dc..21471f9ae9 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -84,15 +84,15 @@ radeon_hd_init(radeon_info &info) return info.framebuffer_area; } - // *** AtomBIOS mapping + // *** VGA rom / AtomBIOS mapping AreaKeeper romMapper; info.rom_area = romMapper.Map("radeon hd rom", (void *)info.pci->u.h0.rom_base, info.pci->u.h0.rom_size, B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, (void **)&info.shared_info->rom); - if (frambufferMapper.InitCheck() < B_OK) { - dprintf(DEVICE_NAME ": card(%ld): could not map AtomBIOS!\n", + if (romMapper.InitCheck() < B_OK) { + dprintf(DEVICE_NAME ": card(%ld): could not map VGA rom!\n", info.id); return info.rom_area; } From 1c1415732dcf43dec54a93d20ad15c701dc6996e Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Wed, 3 Aug 2011 01:36:50 +0000 Subject: [PATCH 102/702] Move flags and look into the tab too. The flags are needed to determine e.g. whether or not the zoom button should be drawn. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42552 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 22 +-- src/servers/app/decorator/DecorManager.cpp | 9 +- src/servers/app/decorator/DecorManager.h | 2 +- src/servers/app/decorator/Decorator.cpp | 53 ++++--- src/servers/app/decorator/Decorator.h | 35 ++--- .../app/decorator/DefaultDecorator.cpp | 141 +++++++++--------- src/servers/app/decorator/DefaultDecorator.h | 12 +- src/servers/app/stackandtile/SATDecorator.cpp | 5 +- src/servers/app/stackandtile/SATDecorator.h | 3 +- src/servers/app/stackandtile/SATWindow.cpp | 2 + 10 files changed, 149 insertions(+), 135 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 8a003b0be9..def7a11792 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -1221,20 +1221,20 @@ Window::SetLook(window_look look, BRegion* updateRegion) if (fCurrentStack.Get() == NULL) return; + int32 stackPosition = PositionInStack(); + ::Decorator* decorator = Decorator(); if (decorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) { // we need a new decorator decorator = gDecorManager.AllocateDecorator(this); fCurrentStack->SetDecorator(decorator); - if (IsFocus()) { - int32 index = PositionInStack(); - decorator->SetFocus(index, true); - } + if (IsFocus()) + decorator->SetFocus(stackPosition, true); } if (decorator != NULL) { DesktopSettings settings(fDesktop); - decorator->SetLook(settings, look, updateRegion); + decorator->SetLook(stackPosition, settings, look, updateRegion); // we might need to resize the window! decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, @@ -1288,7 +1288,8 @@ Window::SetFlags(uint32 flags, BRegion* updateRegion) if (decorator == NULL) return; - decorator->SetFlags(flags, updateRegion); + int32 stackPosition = PositionInStack(); + decorator->SetFlags(stackPosition, flags, updateRegion); // we might need to resize the window! decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight); @@ -2101,7 +2102,6 @@ Window::DetachFromWindowStack(bool ownStackNeeded) decorator->SetDrawingEngine(remainingTop->fDrawingEngine); // propagate focus to the decorator remainingTop->SetFocus(remainingTop->IsFocus()); - remainingTop->SetFeel(remainingTop->Feel()); remainingTop->SetLook(remainingTop->Look(), &dirty); } @@ -2145,8 +2145,11 @@ Window::AddWindowToStack(Window* window) window->DetachFromWindowStack(false); window->fCurrentStack.SetTo(stack); - if (decorator != NULL) - decorator->AddTab(window->Title(), position, &dirty); + if (decorator != NULL) { + DesktopSettings settings(fDesktop); + decorator->AddTab(settings, window->Title(), window->Look(), + window->Flags(), position, &dirty); + } window->SetLook(window->Look(), &dirty); fDesktop->RebuildAndRedrawAfterWindowChange(TopLayerStackWindow(), dirty); @@ -2196,7 +2199,6 @@ Window::MoveToTopStackLayer() if (decorator == NULL) return false; decorator->SetDrawingEngine(fDrawingEngine); - DesktopSettings settings(fDesktop); SetLook(Look(), NULL); decorator->SetTopTap(PositionInStack()); return fCurrentStack->MoveToTopLayer(this); diff --git a/src/servers/app/decorator/DecorManager.cpp b/src/servers/app/decorator/DecorManager.cpp index ad07f1dfb7..59e6f539a8 100644 --- a/src/servers/app/decorator/DecorManager.cpp +++ b/src/servers/app/decorator/DecorManager.cpp @@ -63,12 +63,12 @@ DecorAddOn::AllocateDecorator(Desktop* desktop, DrawingEngine* engine, DesktopSettings settings(desktop); Decorator* decorator; - decorator = _AllocateDecorator(settings, rect, look, flags); + decorator = _AllocateDecorator(settings, rect); desktop->UnlockSingleWindow(); if (!decorator) return NULL; - if (decorator->AddTab(title) == false) { + if (decorator->AddTab(settings, title, look, flags) == false) { delete decorator; return NULL; } @@ -94,10 +94,9 @@ DecorAddOn::GetDesktopListeners() Decorator* -DecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect, - window_look look, uint32 flags) +DecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect) { - return new (std::nothrow)SATDecorator(settings, rect, look, flags); + return new (std::nothrow)SATDecorator(settings, rect); } diff --git a/src/servers/app/decorator/DecorManager.h b/src/servers/app/decorator/DecorManager.h index 92feeb084d..ab67a2e319 100644 --- a/src/servers/app/decorator/DecorManager.h +++ b/src/servers/app/decorator/DecorManager.h @@ -52,7 +52,7 @@ public: protected: virtual Decorator* _AllocateDecorator(DesktopSettings& settings, - BRect rect, window_look look, uint32 flags); + BRect rect); DesktopListenerList fDesktopListeners; diff --git a/src/servers/app/decorator/Decorator.cpp b/src/servers/app/decorator/Decorator.cpp index cd33cd6d37..263da1968c 100644 --- a/src/servers/app/decorator/Decorator.cpp +++ b/src/servers/app/decorator/Decorator.cpp @@ -31,6 +31,9 @@ Decorator::Tab::Tab() closePressed(false), zoomPressed(false), minimizePressed(false), + + look(B_TITLED_WINDOW_LOOK), + flags(0), isFocused(false), title("") { @@ -48,15 +51,11 @@ Decorator::Tab::Tab() \param wfeel style of window feel. See Window.h \param wflags various window flags. See Window.h */ -Decorator::Decorator(DesktopSettings& settings, BRect rect, window_look look, - uint32 flags) +Decorator::Decorator(DesktopSettings& settings, BRect rect) : fDrawingEngine(NULL), fDrawState(), - fLook(look), - fFlags(flags), - fTitleBarRect(), fFrame(rect), fResizeRect(), @@ -81,12 +80,15 @@ Decorator::~Decorator() Decorator::Tab* -Decorator::AddTab(const char* title, int32 index, BRegion* updateRegion) +Decorator::AddTab(DesktopSettings& settings, const char* title, + window_look look, uint32 flags, int32 index, BRegion* updateRegion) { Decorator::Tab* tab = _AllocateNewTab(); if (tab == NULL) return NULL; tab->title = title; + tab->look = look; + tab->flags = flags; bool ok = false; if (index >= 0) { @@ -100,14 +102,15 @@ Decorator::AddTab(const char* title, int32 index, BRegion* updateRegion) return NULL; } - if (_AddTab(index, updateRegion) == false) { + Decorator::Tab* oldTop = fTopTab; + fTopTab = tab; + if (_AddTab(settings, index, updateRegion) == false) { fTabList.RemoveItem(tab); delete tab; + fTopTab = oldTop; return NULL; } - fTopTab = tab; - _InvalidateFootprint(); return tab; } @@ -184,7 +187,7 @@ Decorator::SetDrawingEngine(DrawingEngine* engine) \param flags New value for the flags */ void -Decorator::SetFlags(uint32 flags, BRegion* updateRegion) +Decorator::SetFlags(int32 tab, uint32 flags, BRegion* updateRegion) { // we're nice to our subclasses - we make sure B_NOT_{H|V|}_RESIZABLE // are in sync (it's only a semantical simplification, not a necessity) @@ -194,7 +197,10 @@ Decorator::SetFlags(uint32 flags, BRegion* updateRegion) if (flags & B_NOT_RESIZABLE) flags |= B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE; - _SetFlags(flags, updateRegion); + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + _SetFlags(decoratorTab, flags, updateRegion); _InvalidateFootprint(); // the border might have changed (smaller/larger tab) } @@ -214,10 +220,13 @@ Decorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion) \param look New value for the look */ void -Decorator::SetLook(DesktopSettings& settings, window_look look, +Decorator::SetLook(int32 tab, DesktopSettings& settings, window_look look, BRegion* updateRect) { - _SetLook(settings, look, updateRect); + Decorator::Tab* decoratorTab = fTabList.ItemAt(tab); + if (decoratorTab == NULL) + return; + _SetLook(decoratorTab, settings, look, updateRect); _InvalidateFootprint(); // the border very likely changed } @@ -227,9 +236,9 @@ Decorator::SetLook(DesktopSettings& settings, window_look look, \return the decorator's window look */ window_look -Decorator::Look() const +Decorator::Look(int32 tab) const { - return fLook; + return TabAt(tab)->look; } @@ -237,9 +246,9 @@ Decorator::Look() const \return the decorator's window flags */ uint32 -Decorator::Flags() const +Decorator::Flags(int32 tab) const { - return fFlags; + return TabAt(tab)->flags; } @@ -846,17 +855,17 @@ Decorator::_FontsChanged(DesktopSettings& settings, BRegion* updateRegion) void -Decorator::_SetLook(DesktopSettings& settings, window_look look, - BRegion* updateRect) +Decorator::_SetLook(Decorator::Tab* tab, DesktopSettings& settings, + window_look look, BRegion* updateRect) { - fLook = look; + tab->look = look; } void -Decorator::_SetFlags(uint32 flags, BRegion* updateRegion) +Decorator::_SetFlags(Decorator::Tab* tab, uint32 flags, BRegion* updateRegion) { - fFlags = flags; + tab->flags = flags; } diff --git a/src/servers/app/decorator/Decorator.h b/src/servers/app/decorator/Decorator.h index 4df65ada0d..f444a0b9bd 100644 --- a/src/servers/app/decorator/Decorator.h +++ b/src/servers/app/decorator/Decorator.h @@ -41,6 +41,8 @@ public: bool zoomPressed : 1; bool minimizePressed : 1; + window_look look; + uint32 flags; bool isFocused : 1; BString title; @@ -76,18 +78,18 @@ public: }; public: - Decorator(DesktopSettings& settings, BRect rect, - window_look look, uint32 flags); + Decorator(DesktopSettings& settings, BRect rect); virtual ~Decorator(); - virtual Decorator::Tab* AddTab(const char* title, int32 index = -1, - BRegion* updateRegion = NULL); + virtual Decorator::Tab* AddTab(DesktopSettings& settings, const char* title, + window_look look, uint32 flags, + int32 index = -1, BRegion* updateRegion = NULL); virtual bool RemoveTab(int32 index, BRegion* updateRegion = NULL); virtual bool MoveTab(int32 from, int32 to, bool isMoving, BRegion* updateRegion = NULL); virtual int32 TabAt(const BPoint& where) const; - Decorator::Tab* TabAt(int32 index) + Decorator::Tab* TabAt(int32 index) const { return fTabList.ItemAt(index); } int32 CountTabs() const { return fTabList.CountItems(); } @@ -99,13 +101,13 @@ public: void FontsChanged(DesktopSettings& settings, BRegion* updateRegion = NULL); - void SetLook(DesktopSettings& settings, window_look look, - BRegion* updateRegion = NULL); - void SetFlags(uint32 flags, + void SetLook(int32 tab, DesktopSettings& settings, + window_look look, BRegion* updateRegion = NULL); + void SetFlags(int32 tab, uint32 flags, BRegion* updateRegion = NULL); - window_look Look() const; - uint32 Flags() const; + window_look Look(int32 tab) const; + uint32 Flags(int32 tab) const; BRect BorderRect() const; BRect TitleBarRect() const; @@ -195,9 +197,10 @@ protected: virtual void _FontsChanged(DesktopSettings& settings, BRegion* updateRegion = NULL); - virtual void _SetLook(DesktopSettings& settings, - window_look look, BRegion* updateRegion = NULL); - virtual void _SetFlags(uint32 flags, + virtual void _SetLook(Decorator::Tab* tab, + DesktopSettings& settings, window_look look, + BRegion* updateRegion = NULL); + virtual void _SetFlags(Decorator::Tab* tab, uint32 flags, BRegion* updateRegion = NULL); virtual void _MoveBy(BPoint offset); @@ -206,7 +209,8 @@ protected: virtual bool _SetSettings(const BMessage& settings, BRegion* updateRegion = NULL); - virtual bool _AddTab(int32 index = -1, + virtual bool _AddTab(DesktopSettings& settings, + int32 index = -1, BRegion* updateRegion = NULL) = 0; virtual bool _RemoveTab(int32 index, BRegion* updateRegion = NULL) = 0; @@ -219,9 +223,6 @@ protected: DrawingEngine* fDrawingEngine; DrawState fDrawState; - window_look fLook; - uint32 fFlags; - BRect fTitleBarRect; BRect fFrame; BRect fResizeRect; diff --git a/src/servers/app/decorator/DefaultDecorator.cpp b/src/servers/app/decorator/DefaultDecorator.cpp index 7b07782169..e6058a4cdf 100644 --- a/src/servers/app/decorator/DefaultDecorator.cpp +++ b/src/servers/app/decorator/DefaultDecorator.cpp @@ -101,10 +101,9 @@ const rgb_color DefaultDecorator::kNonFocusFrameColors[2] = { // TODO: get rid of DesktopSettings here, and introduce private accessor // methods to the Decorator base class -DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect, - window_look look, uint32 flags) +DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect) : - Decorator(settings, rect, look, flags), + Decorator(settings, rect), // focus color constants kFocusTabColor(settings.UIColor(B_WINDOW_TAB_COLOR)), kFocusTabColorLight(tint_color(kFocusTabColor, @@ -124,11 +123,6 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect, fOldMovingTab(0, 0, -1, -1) { - _UpdateFont(settings); - - // Do initial decorator setup - _DoLayout(); - // TODO: If the decorator was created with a frame too small, it should // resize itself! @@ -234,7 +228,7 @@ DefaultDecorator::RegionAt(BPoint where, int32& tab) const return region; // check the resize corner - if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(where)) + if (fTopTab->look == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(where)) return REGION_RIGHT_BOTTOM_CORNER; // hit-test the borders @@ -253,11 +247,11 @@ DefaultDecorator::RegionAt(BPoint where, int32& tab) const return REGION_NONE; // check resize area - if ((fFlags & B_NOT_RESIZABLE) == 0 - && (fLook == B_TITLED_WINDOW_LOOK - || fLook == B_FLOATING_WINDOW_LOOK - || fLook == B_MODAL_WINDOW_LOOK - || fLook == kLeftTitledWindowLook)) { + if ((fTopTab->flags & B_NOT_RESIZABLE) == 0 + && (fTopTab->look == B_TITLED_WINDOW_LOOK + || fTopTab->look == B_FLOATING_WINDOW_LOOK + || fTopTab->look == B_MODAL_WINDOW_LOOK + || fTopTab->look == kLeftTitledWindowLook)) { BRect resizeRect(BPoint(fBottomBorder.right - kBorderResizeLength, fBottomBorder.bottom - kBorderResizeLength), fBottomBorder.RightBottom()); @@ -305,13 +299,13 @@ DefaultDecorator::ExtendDirtyRegion(Region region, BRegion& dirty) break; case REGION_CLOSE_BUTTON: - if ((fFlags & B_NOT_CLOSABLE) == 0) + if ((fTopTab->flags & B_NOT_CLOSABLE) == 0) for (int32 i = 0; i < fTabList.CountItems(); i++) dirty.Include(fTabList.ItemAt(i)->closeRect); break; case REGION_ZOOM_BUTTON: - if ((fFlags & B_NOT_ZOOMABLE) == 0) + if ((fTopTab->flags & B_NOT_ZOOMABLE) == 0) for (int32 i = 0; i < fTabList.CountItems(); i++) dirty.Include(fTabList.ItemAt(i)->zoomRect); break; @@ -347,7 +341,7 @@ DefaultDecorator::ExtendDirtyRegion(Region region, BRegion& dirty) break; case REGION_RIGHT_BOTTOM_CORNER: - if ((fFlags & B_NOT_RESIZABLE) == 0) + if ((fTopTab->flags & B_NOT_RESIZABLE) == 0) dirty.Include(fResizeRect); break; @@ -382,7 +376,7 @@ DefaultDecorator::_DoLayout() bool hasTab = false; - switch ((int)Look()) { + switch ((int)fTopTab->look) { case B_MODAL_WINDOW_LOOK: fBorderWidth = 5; break; @@ -471,7 +465,7 @@ DefaultDecorator::_DoTabLayout() font_height fontHeight; fDrawState.Font().GetHeight(fontHeight); - if (fLook != kLeftTitledWindowLook) { + if (tab->look != kLeftTitledWindowLook) { tabRect.Set(fFrame.left - fBorderWidth, fFrame.top - fBorderWidth - ceilf(fontHeight.ascent + fontHeight.descent + 7.0), @@ -486,7 +480,7 @@ DefaultDecorator::_DoTabLayout() } // format tab rect for a floating window - make the rect smaller - if (fLook == B_FLOATING_WINDOW_LOOK) { + if (tab->look == B_FLOATING_WINDOW_LOOK) { tabRect.InsetBy(0, 2); tabRect.OffsetBy(0, 2); } @@ -498,9 +492,9 @@ DefaultDecorator::_DoTabLayout() // tab->minTabSize contains just the room for the buttons tab->minTabSize = inset * 2 + tab->textOffset; - if ((fFlags & B_NOT_CLOSABLE) == 0) + if ((tab->flags & B_NOT_CLOSABLE) == 0) tab->minTabSize += offset + size; - if ((fFlags & B_NOT_ZOOMABLE) == 0) + if ((tab->flags & B_NOT_ZOOMABLE) == 0) tab->minTabSize += offset + size; // tab->maxTabSize contains tab->minTabSize + the width required for the @@ -512,7 +506,7 @@ DefaultDecorator::_DoTabLayout() tab->maxTabSize += tab->textOffset; tab->maxTabSize += tab->minTabSize; - float tabSize = (fLook != kLeftTitledWindowLook + float tabSize = (tab->look != kLeftTitledWindowLook ? fFrame.Width() : fFrame.Height()) + fBorderWidth * 2; if (tabSize < tab->minTabSize) tabSize = tab->minTabSize; @@ -520,7 +514,7 @@ DefaultDecorator::_DoTabLayout() tabSize = tab->maxTabSize; // layout buttons and truncate text - if (fLook != kLeftTitledWindowLook) + if (tab->look != kLeftTitledWindowLook) tabRect.right = tabRect.left + tabSize; else tabRect.bottom = tabRect.top + tabSize; @@ -651,7 +645,7 @@ DefaultDecorator::_DrawFrame(BRect invalid) // NOTE: the DrawingEngine needs to be locked for the entire // time for the clipping to stay valid for this decorator - if (fLook == B_NO_BORDER_WINDOW_LOOK) + if (fTopTab->look == B_NO_BORDER_WINDOW_LOOK) return; if (fBorderWidth <= 0) @@ -659,7 +653,7 @@ DefaultDecorator::_DrawFrame(BRect invalid) // Draw the border frame BRect r = BRect(fTopBorder.LeftTop(), fBottomBorder.RightBottom()); - switch ((int)fLook) { + switch ((int)fTopTab->look) { case B_TITLED_WINDOW_LOOK: case B_DOCUMENT_WINDOW_LOOK: case B_MODAL_WINDOW_LOOK: @@ -731,7 +725,8 @@ DefaultDecorator::_DrawFrame(BRect invalid) fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i), BPoint(r.right - i, r.top + i), colors[i * 2]); } - if (fTitleBarRect.IsValid() && fLook != kLeftTitledWindowLook) { + if (fTitleBarRect.IsValid() + && fTopTab->look != kLeftTitledWindowLook) { // grey along the bottom of the tab // (overwrites "white" from frame) fDrawingEngine->StrokeLine( @@ -750,7 +745,8 @@ DefaultDecorator::_DrawFrame(BRect invalid) fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i), BPoint(r.left + i, r.bottom - i), colors[i * 2]); } - if (fLook == kLeftTitledWindowLook && fTitleBarRect.IsValid()) { + if (fTopTab->look == kLeftTitledWindowLook + && fTitleBarRect.IsValid()) { // grey along the right side of the tab // (overwrites "white" from frame) fDrawingEngine->StrokeLine( @@ -801,13 +797,13 @@ DefaultDecorator::_DrawFrame(BRect invalid) } // Draw the resize knob if we're supposed to - if (!(fFlags & B_NOT_RESIZABLE)) { + if (!(fTopTab->flags & B_NOT_RESIZABLE)) { r = fResizeRect; ComponentColors colors; _GetComponentColors(COMPONENT_RESIZE_CORNER, colors); - switch ((int)fLook) { + switch ((int)fTopTab->look) { case B_DOCUMENT_WINDOW_LOOK: { if (!invalid.Intersects(r)) @@ -899,7 +895,7 @@ DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid) colors[COLOR_TAB_FRAME_LIGHT]); fDrawingEngine->StrokeLine(tabRect.LeftTop(), tabRect.RightTop(), colors[COLOR_TAB_FRAME_LIGHT]); - if (fLook != kLeftTitledWindowLook) { + if (tab->look != kLeftTitledWindowLook) { fDrawingEngine->StrokeLine(tabRect.RightTop(), tabRect.RightBottom(), colors[COLOR_TAB_FRAME_DARK]); } else { @@ -914,14 +910,14 @@ DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid) // bevel fDrawingEngine->StrokeLine(BPoint(tabRect.left + 1, tabRect.top + 1), BPoint(tabRect.left + 1, - tabBotton - (fLook == kLeftTitledWindowLook ? 1 : 0)), + tabBotton - (tab->look == kLeftTitledWindowLook ? 1 : 0)), colors[COLOR_TAB_BEVEL]); fDrawingEngine->StrokeLine(BPoint(tabRect.left + 1, tabRect.top + 1), - BPoint(tabRect.right - (fLook == kLeftTitledWindowLook ? 0 : 1), + BPoint(tabRect.right - (tab->look == kLeftTitledWindowLook ? 0 : 1), tabRect.top + 1), colors[COLOR_TAB_BEVEL]); - if (fLook != kLeftTitledWindowLook) { + if (tab->look != kLeftTitledWindowLook) { fDrawingEngine->StrokeLine(BPoint(tabRect.right - 1, tabRect.top + 2), BPoint(tabRect.right - 1, tabBotton), colors[COLOR_TAB_SHADOW]); @@ -938,7 +934,7 @@ DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid) gradient.AddColor(colors[COLOR_TAB_LIGHT], 0); gradient.AddColor(colors[COLOR_TAB], 255); - if (fLook != kLeftTitledWindowLook) { + if (tab->look != kLeftTitledWindowLook) { gradient.SetEnd(tabRect.LeftBottom()); fDrawingEngine->FillRect(BRect(tabRect.left + 2, tabRect.top + 2, tabRect.right - 2, tabBotton), gradient); @@ -997,7 +993,7 @@ DefaultDecorator::_DrawTitle(Decorator::Tab* _tab, BRect r) fDrawState.Font().GetHeight(fontHeight); BPoint titlePos; - if (fLook != kLeftTitledWindowLook) { + if (tab->look != kLeftTitledWindowLook) { titlePos.x = closeRect.IsValid() ? closeRect.right + tab->textOffset : tabRect.left + tab->textOffset; titlePos.y = floorf(((tabRect.top + 2.0) + tabRect.bottom @@ -1080,8 +1076,8 @@ DefaultDecorator::_FontsChanged(DesktopSettings& settings, void -DefaultDecorator::_SetLook(DesktopSettings& settings, window_look look, - BRegion* updateRegion) +DefaultDecorator::_SetLook(Decorator::Tab* tab, DesktopSettings& settings, + window_look look, BRegion* updateRegion) { // TODO: we could be much smarter about the update region @@ -1089,7 +1085,7 @@ DefaultDecorator::_SetLook(DesktopSettings& settings, window_look look, if (updateRegion != NULL) updateRegion->Include(&GetFootprint()); - fLook = look; + tab->look = look; _UpdateFont(settings); _InvalidateBitmaps(); @@ -1102,7 +1098,8 @@ DefaultDecorator::_SetLook(DesktopSettings& settings, window_look look, void -DefaultDecorator::_SetFlags(uint32 flags, BRegion* updateRegion) +DefaultDecorator::_SetFlags(Decorator::Tab* tab, uint32 flags, + BRegion* updateRegion) { // TODO: we could be much smarter about the update region @@ -1110,7 +1107,7 @@ DefaultDecorator::_SetFlags(uint32 flags, BRegion* updateRegion) if (updateRegion != NULL) updateRegion->Include(&GetFootprint()); - fFlags = flags; + tab->flags = flags; _DoLayout(); _InvalidateFootprint(); @@ -1124,8 +1121,9 @@ DefaultDecorator::_SetFocus(Decorator::Tab* _tab) { DefaultDecorator::Tab* tab = static_cast(_tab); tab->buttonFocus = IsFocus(tab) - || ((fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook) - && (fFlags & B_AVOID_FOCUS) != 0); + || ((tab->look == B_FLOATING_WINDOW_LOOK + || tab->look == kLeftTitledWindowLook) + && (tab->flags & B_AVOID_FOCUS) != 0); if (CountTabs() > 1) _LayoutTabItems(tab, tab->tabRect); } @@ -1165,9 +1163,9 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) fFrame.bottom += offset.y; // Handle invalidation of resize rect - if (dirty && !(fFlags & B_NOT_RESIZABLE)) { + if (dirty && !(fTopTab->flags & B_NOT_RESIZABLE)) { BRect realResizeRect; - switch ((int)fLook) { + switch ((int)fTopTab->look) { case B_DOCUMENT_WINDOW_LOOK: realResizeRect = fResizeRect; // Resize rect at old location @@ -1261,7 +1259,7 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) float delta = tabOffset - tab->tabOffset; tab->tabOffset = (uint32)tabOffset; - if (fLook != kLeftTitledWindowLook) + if (fTopTab->look != kLeftTitledWindowLook) tabRect.OffsetBy(delta, 0.0); else tabRect.OffsetBy(0.0, delta); @@ -1271,9 +1269,10 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) if (tabSize > tab->maxTabSize) tabSize = tab->maxTabSize; - if (fLook != kLeftTitledWindowLook && tabSize != tabRect.Width()) { + if (fTopTab->look != kLeftTitledWindowLook + && tabSize != tabRect.Width()) { tabRect.right = tabRect.left + tabSize; - } else if (fLook == kLeftTitledWindowLook + } else if (fTopTab->look == kLeftTitledWindowLook && tabSize != tabRect.Height()) { tabRect.bottom = tabRect.top + tabSize; } @@ -1289,7 +1288,7 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty) BRect redraw(tabRect); if (delta != 0.0) { redraw = redraw | oldTabRect; - if (fLook != kLeftTitledWindowLook) + if (fTopTab->look != kLeftTitledWindowLook) redraw.bottom++; else redraw.right++; @@ -1382,8 +1381,11 @@ DefaultDecorator::_SetSettings(const BMessage& settings, BRegion* updateRegion) bool -DefaultDecorator::_AddTab(int32 index, BRegion* updateRegion) +DefaultDecorator::_AddTab(DesktopSettings& settings, int32 index, + BRegion* updateRegion) { + _UpdateFont(settings); + _DoLayout(); if (updateRegion != NULL) updateRegion->Include(fTitleBarRect); @@ -1443,7 +1445,7 @@ DefaultDecorator::_GetFootprint(BRegion *region) region->MakeEmpty(); - if (fLook == B_NO_BORDER_WINDOW_LOOK) + if (fTopTab->look == B_NO_BORDER_WINDOW_LOOK) return; region->Include(fTopBorder); @@ -1451,12 +1453,12 @@ DefaultDecorator::_GetFootprint(BRegion *region) region->Include(fRightBorder); region->Include(fBottomBorder); - if (fLook == B_BORDERED_WINDOW_LOOK) + if (fTopTab->look == B_BORDERED_WINDOW_LOOK) return; region->Include(&fTabsRegion); - if (fLook == B_DOCUMENT_WINDOW_LOOK) { + if (fTopTab->look == B_DOCUMENT_WINDOW_LOOK) { // include the rectangular resize knob on the bottom right float knobSize = kResizeKnobSize - fBorderWidth; region->Include(BRect(fFrame.right - knobSize, fFrame.bottom - knobSize, @@ -1469,9 +1471,9 @@ void DefaultDecorator::DrawButtons(Decorator::Tab* tab, const BRect& invalid) { // Draw the buttons if we're supposed to - if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect)) + if (!(tab->flags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect)) _DrawClose(tab, false, tab->closeRect); - if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect)) + if (!(tab->flags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect)) _DrawZoom(tab, false, tab->zoomRect); } @@ -1555,9 +1557,10 @@ void DefaultDecorator::_UpdateFont(DesktopSettings& settings) { ServerFont font; - if (fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook) { + if (fTopTab->look == B_FLOATING_WINDOW_LOOK + || fTopTab->look == kLeftTitledWindowLook) { settings.GetDefaultPlainFont(font); - if (fLook == kLeftTitledWindowLook) + if (fTopTab->look == kLeftTitledWindowLook) font.SetRotation(90.0f); } else settings.GetDefaultBoldFont(font); @@ -1623,11 +1626,11 @@ void DefaultDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset, float* _size, float* _inset) const { - float tabSize = fLook == kLeftTitledWindowLook ? + float tabSize = fTopTab->look == kLeftTitledWindowLook ? tabRect.Width() : tabRect.Height(); - bool smallTab = fLook == B_FLOATING_WINDOW_LOOK - || fLook == kLeftTitledWindowLook; + bool smallTab = fTopTab->look == B_FLOATING_WINDOW_LOOK + || fTopTab->look == kLeftTitledWindowLook; *_offset = smallTab ? floorf(fDrawState.Font().Size() / 2.6) : floorf(fDrawState.Font().Size() / 2.3); @@ -1657,7 +1660,7 @@ DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect) BRect& zoomRect = tab->zoomRect; // calulate close rect based on the tab rectangle - if (fLook != kLeftTitledWindowLook) { + if (tab->look != kLeftTitledWindowLook) { closeRect.Set(tabRect.left + offset, tabRect.top + offset, tabRect.left + offset + size, tabRect.top + offset + size); @@ -1665,9 +1668,9 @@ DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect) tabRect.right - offset, tabRect.top + offset + size); // hidden buttons have no width - if ((Flags() & B_NOT_CLOSABLE) != 0) + if ((tab->flags & B_NOT_CLOSABLE) != 0) closeRect.right = closeRect.left - offset; - if ((Flags() & B_NOT_ZOOMABLE) != 0) + if ((tab->flags & B_NOT_ZOOMABLE) != 0) zoomRect.left = zoomRect.right + offset; } else { closeRect.Set(tabRect.left + offset, tabRect.top + offset, @@ -1677,9 +1680,9 @@ DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect) tabRect.left + size + offset, tabRect.bottom - offset); // hidden buttons have no height - if ((Flags() & B_NOT_CLOSABLE) != 0) + if ((tab->flags & B_NOT_CLOSABLE) != 0) closeRect.bottom = closeRect.top - offset; - if ((Flags() & B_NOT_ZOOMABLE) != 0) + if ((tab->flags & B_NOT_ZOOMABLE) != 0) zoomRect.top = zoomRect.bottom + offset; } @@ -1687,7 +1690,7 @@ DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect) // TODO: the +2 is there because the title often appeared // truncated for no apparent reason - OTOH the title does // also not appear perfectly in the middle - if (fLook != kLeftTitledWindowLook) + if (tab->look != kLeftTitledWindowLook) size = (zoomRect.left - closeRect.right) - tab->textOffset * 2 + inset; else size = (zoomRect.top - closeRect.bottom) - tab->textOffset * 2 + inset; @@ -1878,8 +1881,8 @@ DefaultDecorator::_GetComponentColors(Component component, float DefaultDecorator::_DefaultTextOffset() const { - return (fLook == B_FLOATING_WINDOW_LOOK - || fLook == kLeftTitledWindowLook) ? 10 : 18; + return (fTopTab->look == B_FLOATING_WINDOW_LOOK + || fTopTab->look == kLeftTitledWindowLook) ? 10 : 18; } @@ -1887,7 +1890,7 @@ float DefaultDecorator::_SingleTabOffsetAndSize(float& tabSize) { float maxLocation; - if (fLook != kLeftTitledWindowLook) { + if (fTopTab->look != kLeftTitledWindowLook) { tabSize = fRightBorder.right - fLeftBorder.left; } else { tabSize = fBottomBorder.bottom - fTopBorder.top; diff --git a/src/servers/app/decorator/DefaultDecorator.h b/src/servers/app/decorator/DefaultDecorator.h index ce6dd3429a..89fd6631d2 100644 --- a/src/servers/app/decorator/DefaultDecorator.h +++ b/src/servers/app/decorator/DefaultDecorator.h @@ -44,8 +44,7 @@ public: }; DefaultDecorator(DesktopSettings& settings, - BRect frame, window_look look, - uint32 flags); + BRect frame); virtual ~DefaultDecorator(); virtual float TabLocation(int32 tab) const; @@ -126,10 +125,10 @@ protected: virtual void _FontsChanged(DesktopSettings& settings, BRegion* updateRegion); - virtual void _SetLook(DesktopSettings& settings, - window_look look, + virtual void _SetLook(Decorator::Tab* tab, + DesktopSettings& settings, window_look look, BRegion* updateRegion = NULL); - virtual void _SetFlags(uint32 flags, + virtual void _SetFlags(Decorator::Tab* tab, uint32 flags, BRegion* updateRegion = NULL); virtual void _MoveBy(BPoint offset); @@ -142,7 +141,8 @@ protected: virtual bool _SetSettings(const BMessage& settings, BRegion* updateRegion = NULL); - virtual bool _AddTab(int32 index = -1, + virtual bool _AddTab(DesktopSettings& settings, + int32 index = -1, BRegion* updateRegion = NULL); virtual bool _RemoveTab(int32 index, BRegion* updateRegion = NULL); diff --git a/src/servers/app/stackandtile/SATDecorator.cpp b/src/servers/app/stackandtile/SATDecorator.cpp index 639d452216..56fa864eb7 100644 --- a/src/servers/app/stackandtile/SATDecorator.cpp +++ b/src/servers/app/stackandtile/SATDecorator.cpp @@ -49,10 +49,9 @@ static const rgb_color kHighlightTabColorShadow = tint_color(kHighlightTabColor, (B_DARKEN_1_TINT + B_NO_TINT) / 2); -SATDecorator::SATDecorator(DesktopSettings& settings, BRect frame, - window_look look, uint32 flags) +SATDecorator::SATDecorator(DesktopSettings& settings, BRect frame) : - DefaultDecorator(settings, frame, look, flags) + DefaultDecorator(settings, frame) { } diff --git a/src/servers/app/stackandtile/SATDecorator.h b/src/servers/app/stackandtile/SATDecorator.h index 6ca099f96d..d7b7348bb6 100644 --- a/src/servers/app/stackandtile/SATDecorator.h +++ b/src/servers/app/stackandtile/SATDecorator.h @@ -23,8 +23,7 @@ public: public: SATDecorator(DesktopSettings& settings, - BRect frame, window_look look, - uint32 flags); + BRect frame); protected: virtual void GetComponentColors(Component component, diff --git a/src/servers/app/stackandtile/SATWindow.cpp b/src/servers/app/stackandtile/SATWindow.cpp index bf505b0b23..9c84e9fed9 100644 --- a/src/servers/app/stackandtile/SATWindow.cpp +++ b/src/servers/app/stackandtile/SATWindow.cpp @@ -379,6 +379,8 @@ SATWindow::RemovedFromGroup(SATGroup* group, bool stayBelowMouse) fWindow->Title()); _RestoreOriginalSize(stayBelowMouse); + if (group->CountItems() == 1) + group->WindowAt(0)->_RestoreOriginalSize(false); if (fShutdown) { fGroupCookie->Uninit(); From 1d5cfc649aeba62066af20336ca69566566500c3 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 3 Aug 2011 03:02:57 +0000 Subject: [PATCH 103/702] * move bios functions into bios.cpp * implement various methods to pull AtomBIOS from card * add some missing registers to headers from linux drm driver git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42553 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon_hd/r600_reg.h | 25 ++ .../accelerants/radeon_hd/accelerant.cpp | 61 +---- .../accelerants/radeon_hd/accelerant.h | 3 +- src/add-ons/accelerants/radeon_hd/bios.cpp | 220 +++++++++++++++++- src/add-ons/accelerants/radeon_hd/bios.h | 2 +- 5 files changed, 250 insertions(+), 61 deletions(-) diff --git a/headers/private/graphics/radeon_hd/r600_reg.h b/headers/private/graphics/radeon_hd/r600_reg.h index 51629338dc..92c1f59211 100644 --- a/headers/private/graphics/radeon_hd/r600_reg.h +++ b/headers/private/graphics/radeon_hd/r600_reg.h @@ -34,14 +34,39 @@ #include "r600_reg_r7xx.h" +/* From Linux DRM Radeon driver for AtomBIOS */ +#define RADEON_SEPROM_CNTL1 0x01c0 +#define RADEON_SCK_PRESCALE_SHIFT 24 +#define RADEON_SCK_PRESCALE_MASK (0xff << 24) + +#define RADEON_VIPH_CONTROL 0x0c40 +#define RADEON_VIPH_EN (1 << 21) + +#define RADEON_GPIOPAD_MASK 0x0198 +#define RADEON_GPIOPAD_A 0x019c +#define RADEON_GPIOPAD_EN 0x01a0 +#define RADEON_GPIOPAD_Y 0x01a4 +#define RADEON_MDGPIO_MASK 0x01a8 +#define RADEON_MDGPIO_A 0x01ac +#define RADEON_MDGPIO_EN 0x01b0 +#define RADEON_MDGPIO_Y 0x01b4 + +#define RV370_BUS_CNTL 0x004c + +#define R600_CG_SPLL_FUNC_CNTL 0x600 +#define R600_CG_SPLL_STATUS 0x60c #define R600_ROM_CNTL 0x1600 #define R600_BUS_CNTL 0x5420 + #define R600_BIOS_ROM_DIS (1 << 1) #define R600_SCK_OVERWRITE (1 << 1) +#define R600_SPLL_CHG_STATUS (1 << 1) +#define R600_SPLL_BYPASS_EN (1 << 3) #define DVGA_CONTROL_MODE_ENABLE (1 << 0) #define DVGA_CONTROL_TIMING_SELECT (1 << 8) #define VGA_VSTATUS_CNTL_MASK (3 << 16) + /* SET_*_REG offsets + ends */ enum { SET_CONFIG_REG_offset = 0x00008000, diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 93e5cf1241..db0be6034c 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -41,6 +41,7 @@ struct accelerant_info *gInfo; display_info *gDisplay[MAX_DISPLAY]; +void *gAtomBIOS; class AreaCloner { @@ -162,15 +163,21 @@ init_common(int device, bool isClone) gInfo->shared_info->rom_area); status = romCloner.InitCheck(); if (status < B_OK) { - //free(gInfo); + free(gInfo); TRACE("%s, failed to create rom area\n", __func__); - //return status; + return status; } sharedCloner.Keep(); regsCloner.Keep(); romCloner.Keep(); + gAtomBIOS = (void*)malloc(gInfo->shared_info->rom_size); + + if (gAtomBIOS == NULL) { + TRACE("%s, failed to malloc AtomBIOS pointer of holding\n", __func__); + } + // Define Radeon PLL default ranges gInfo->shared_info->pll_info.reference_frequency = RHD_PLL_REFERENCE_DEFAULT; @@ -199,6 +206,8 @@ uninit_common(void) free(gInfo); } + free(gAtomBIOS); + for (uint32 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id] != NULL) { free(gDisplay[id]->regs); @@ -208,52 +217,6 @@ uninit_common(void) } -status_t -radeon_init_bios() -{ - radeon_shared_info &info = *gInfo->shared_info; - - uint32 bus_cntl = Read32(OUT, R600_BUS_CNTL); - uint32 d1vga_control = Read32(OUT, D1VGA_CONTROL); - uint32 d2vga_control = Read32(OUT, D2VGA_CONTROL); - uint32 vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); - uint32 rom_cntl = Read32(OUT, R600_ROM_CNTL); - - // Enable rom access - Write32(OUT, R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); - /* Disable VGA mode */ - Write32(OUT, D1VGA_CONTROL, (d1vga_control - & ~(DVGA_CONTROL_MODE_ENABLE - | DVGA_CONTROL_TIMING_SELECT))); - Write32(OUT, D2VGA_CONTROL, (d2vga_control - & ~(DVGA_CONTROL_MODE_ENABLE - | DVGA_CONTROL_TIMING_SELECT))); - Write32(OUT, VGA_RENDER_CONTROL, (vga_render_control - & ~VGA_VSTATUS_CNTL_MASK)); - Write32(OUT, R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); - - void* atomBIOS = (void*)malloc(info.rom_size); - if (atomBIOS == NULL) - return B_NO_MEMORY; - - snooze(2); - - memcpy(atomBIOS, gInfo->rom, info.rom_size); - - /* restore regs */ - Write32(OUT, R600_BUS_CNTL, bus_cntl); - Write32(OUT, D1VGA_CONTROL, d1vga_control); - Write32(OUT, D2VGA_CONTROL, d2vga_control); - Write32(OUT, VGA_RENDER_CONTROL, vga_render_control); - Write32(OUT, R600_ROM_CNTL, rom_cntl); - - // Init AtomBIOS - bios_init(atomBIOS); - - return B_OK; -} - - // #pragma mark - public accelerant functions @@ -272,7 +235,7 @@ radeon_init_accelerant(int device) init_lock(&info.accelerant_lock, "radeon hd accelerant"); init_lock(&info.engine_lock, "radeon hd engine"); - radeon_init_bios(); + radeon_init_bios(gAtomBIOS); status = detect_displays(); //if (status != B_OK) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 282868b668..0c8ffaf25e 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -116,7 +116,8 @@ typedef struct { extern accelerant_info *gInfo; -extern atom_context *gAtomBIOS; +extern void *gAtomBIOS; +extern atom_context *gAtomContext; extern display_info *gDisplay[MAX_DISPLAY]; diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 6118792c5d..591fd10498 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -25,18 +25,218 @@ #endif -atom_context *gAtomBIOS; +atom_context *gAtomContext; status_t -bios_init(void* bios) +bios_read_enabled(void* bios, size_t size) { - if (gInfo->rom == NULL) { - // just incase, this prevents a crash - TRACE("%s: called even though VGA rom hasn't been mapped!\n", - __func__); - return B_ERROR; + status_t result = B_ERROR; + if (gInfo->rom[0] == 0x55 && gInfo->rom[1] == 0xaa) { + TRACE("%s: found AtomBIOS signature!\n", __func__); + bios = gInfo->rom; + result = B_OK; + } else + TRACE("%s: didn't find valid AtomBIOS\n", __func__); + + return result; +} + + +status_t +bios_read_disabled_northern(void* bios, size_t size) +{ + uint32 bus_cntl = Read32(OUT, R600_BUS_CNTL); + uint32 d1vga_control = Read32(OUT, D1VGA_CONTROL); + uint32 d2vga_control = Read32(OUT, D2VGA_CONTROL); + uint32 vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); + uint32 rom_cntl = Read32(OUT, R600_ROM_CNTL); + + // Enable rom access + Write32(OUT, R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); + // Disable VGA mode + Write32(OUT, D1VGA_CONTROL, (d1vga_control + & ~(DVGA_CONTROL_MODE_ENABLE + | DVGA_CONTROL_TIMING_SELECT))); + Write32(OUT, D2VGA_CONTROL, (d2vga_control + & ~(DVGA_CONTROL_MODE_ENABLE + | DVGA_CONTROL_TIMING_SELECT))); + Write32(OUT, VGA_RENDER_CONTROL, (vga_render_control + & ~VGA_VSTATUS_CNTL_MASK)); + Write32(OUT, R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); + + snooze(2); + + status_t result = B_ERROR; + if (gInfo->rom[0] == 0x55 && gInfo->rom[1] == 0xaa) { + TRACE("%s: found AtomBIOS signature!\n", __func__); + memcpy(&bios, gInfo->rom, size); + // grab it while we can + result = B_OK; + } else + TRACE("%s: didn't find valid AtomBIOS\n", __func__); + + // restore regs + Write32(OUT, R600_BUS_CNTL, bus_cntl); + Write32(OUT, D1VGA_CONTROL, d1vga_control); + Write32(OUT, D2VGA_CONTROL, d2vga_control); + Write32(OUT, VGA_RENDER_CONTROL, vga_render_control); + Write32(OUT, R600_ROM_CNTL, rom_cntl); + + return result; +} + + +status_t +bios_read_disabled_avivo(void* bios, size_t size) +{ + uint32 seprom_cntl1 = Read32(OUT, RADEON_SEPROM_CNTL1); + uint32 viph_control = Read32(OUT, RADEON_VIPH_CONTROL); + uint32 bus_cntl = Read32(OUT, RV370_BUS_CNTL); + uint32 d1vga_control = Read32(OUT, D1VGA_CONTROL); + uint32 d2vga_control = Read32(OUT, D2VGA_CONTROL); + uint32 vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); + uint32 gpiopad_a = Read32(OUT, RADEON_GPIOPAD_A); + uint32 gpiopad_en = Read32(OUT, RADEON_GPIOPAD_EN); + uint32 gpiopad_mask = Read32(OUT, RADEON_GPIOPAD_MASK); + + Write32(OUT, RADEON_SEPROM_CNTL1, ((seprom_cntl1 & + ~RADEON_SCK_PRESCALE_MASK) | (0xc << RADEON_SCK_PRESCALE_SHIFT))); + Write32(OUT, RADEON_GPIOPAD_A, 0); + Write32(OUT, RADEON_GPIOPAD_EN, 0); + Write32(OUT, RADEON_GPIOPAD_MASK, 0); + + // Disable VIP + Write32(OUT, RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); + // Disable VGA mode + Write32(OUT, D1VGA_CONTROL, (d1vga_control + & ~(DVGA_CONTROL_MODE_ENABLE + | DVGA_CONTROL_TIMING_SELECT))); + Write32(OUT, D2VGA_CONTROL, (d2vga_control + & ~(DVGA_CONTROL_MODE_ENABLE + | DVGA_CONTROL_TIMING_SELECT))); + Write32(OUT, VGA_RENDER_CONTROL, (vga_render_control + & ~VGA_VSTATUS_CNTL_MASK)); + + snooze(2); + + status_t result = B_ERROR; + if (gInfo->rom[0] == 0x55 && gInfo->rom[1] == 0xaa) { + TRACE("%s: found AtomBIOS signature!\n", __func__); + memcpy(&bios, gInfo->rom, size); + // grab it while we can + result = B_OK; + } else + TRACE("%s: didn't find valid AtomBIOS\n", __func__); + + /* restore regs */ + Write32(OUT, RADEON_SEPROM_CNTL1, seprom_cntl1); + Write32(OUT, RADEON_VIPH_CONTROL, viph_control); + Write32(OUT, RV370_BUS_CNTL, bus_cntl); + Write32(OUT, D1VGA_CONTROL, d1vga_control); + Write32(OUT, D2VGA_CONTROL, d2vga_control); + Write32(OUT, VGA_RENDER_CONTROL, vga_render_control); + Write32(OUT, RADEON_GPIOPAD_A, gpiopad_a); + Write32(OUT, RADEON_GPIOPAD_EN, gpiopad_en); + Write32(OUT, RADEON_GPIOPAD_MASK, gpiopad_mask); + + + return result; +} + + +status_t +bios_read_disabled_r700(void* bios, size_t size) +{ + uint32 viph_control = Read32(OUT, RADEON_VIPH_CONTROL); + uint32 bus_cntl = Read32(OUT, R600_BUS_CNTL); + uint32 d1vga_control = Read32(OUT, D1VGA_CONTROL); + uint32 d2vga_control = Read32(OUT, D2VGA_CONTROL); + uint32 vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); + uint32 rom_cntl = Read32(OUT, R600_ROM_CNTL); + + // Disable VIP + Write32(OUT, RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); + // Enable rom access + Write32(OUT, R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); + // Disable VGA mode + Write32(OUT, D1VGA_CONTROL, (d1vga_control + & ~(DVGA_CONTROL_MODE_ENABLE + | DVGA_CONTROL_TIMING_SELECT))); + Write32(OUT, D2VGA_CONTROL, (d2vga_control + & ~(DVGA_CONTROL_MODE_ENABLE + | DVGA_CONTROL_TIMING_SELECT))); + Write32(OUT, VGA_RENDER_CONTROL, (vga_render_control + & ~VGA_VSTATUS_CNTL_MASK)); + + uint32 cg_spll_func_cntl = 0; + radeon_shared_info &info = *gInfo->shared_info; + if (info.device_chipset == (RADEON_R700 | 0x30)) { + cg_spll_func_cntl = Read32(OUT, R600_CG_SPLL_FUNC_CNTL); + + // Enable bypass mode + Write32(OUT, R600_CG_SPLL_FUNC_CNTL, cg_spll_func_cntl + | R600_SPLL_BYPASS_EN); + + // wait for SPLL_CHG_STATUS to change to 1 + uint32 cg_spll_status = 0; + while (!(cg_spll_status & R600_SPLL_CHG_STATUS)) + cg_spll_status = Read32(OUT, R600_CG_SPLL_STATUS); + + Write32(OUT, R600_ROM_CNTL, (rom_cntl & ~R600_SCK_OVERWRITE)); + } else + Write32(OUT, R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); + + snooze(2); + + status_t result = B_ERROR; + if (gInfo->rom[0] == 0x55 && gInfo->rom[1] == 0xaa) { + TRACE("%s: found AtomBIOS signature!\n", __func__); + memcpy(&bios, gInfo->rom, size); + // grab it while we can + result = B_OK; + } else + TRACE("%s: didn't find valid AtomBIOS\n", __func__); + + // restore regs + if (info.device_chipset == (RADEON_R700 | 0x30)) { + Write32(OUT, R600_CG_SPLL_FUNC_CNTL, cg_spll_func_cntl); + + // wait for SPLL_CHG_STATUS to change to 1 + uint32 cg_spll_status = 0; + while (!(cg_spll_status & R600_SPLL_CHG_STATUS)) + cg_spll_status = Read32(OUT, R600_CG_SPLL_STATUS); } + Write32(OUT, RADEON_VIPH_CONTROL, viph_control); + Write32(OUT, R600_BUS_CNTL, bus_cntl); + Write32(OUT, D1VGA_CONTROL, d1vga_control); + Write32(OUT, D2VGA_CONTROL, d2vga_control); + Write32(OUT, VGA_RENDER_CONTROL, vga_render_control); + Write32(OUT, R600_ROM_CNTL, rom_cntl); + + return result; +} + + +status_t +radeon_init_bios(void* bios) +{ + radeon_shared_info &info = *gInfo->shared_info; + + status_t bios_status; + if (bios_read_enabled(bios, info.rom_size) != B_OK) { + if (info.device_chipset > RADEON_R800) // TODO : >= BARTS + bios_status = bios_read_disabled_northern(bios, info.rom_size); + else if (info.device_chipset >= (RADEON_R700 | 0x70)) + bios_status = bios_read_disabled_r700(bios, info.rom_size); + else if (info.device_chipset >= RADEON_R600) + bios_status = bios_read_disabled_avivo(bios, info.rom_size); + else + bios_status = B_ERROR; + } + + if (bios_status != B_OK) + return bios_status; struct card_info *atom_card_info = (card_info*)malloc(sizeof(card_info)); @@ -61,10 +261,10 @@ bios_init(void* bios) atom_card_info->pll_read = _read32; atom_card_info->pll_write = _write32; - // Point AtomBIOS parser to card bios and malloc gAtomBIOS - gAtomBIOS = atom_parse(atom_card_info, bios); + // Point AtomBIOS parser to card bios and malloc gAtomContext + gAtomContext = atom_parse(atom_card_info, bios); - if (gAtomBIOS == NULL) { + if (gAtomContext == NULL) { TRACE("%s: couldn't parse system AtomBIOS\n", __func__); return B_ERROR; } diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index 97faed79cb..e29d462eaf 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -14,7 +14,7 @@ #include "atom.h" -status_t bios_init(void* bios); +status_t radeon_init_bios(void* bios); #endif /* RADEON_HD_BIOS_H */ From 5cf44dda39962b528f9791e7bfc2f98a9e882478 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 3 Aug 2011 18:16:10 +0000 Subject: [PATCH 104/702] * move obtaining / copying the vga bios into the driver. * add missing r500 header * replace r600 headers with newer one from kernel git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42554 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon_hd/r500_reg.h | 793 ++++++++++++++++++ headers/private/graphics/radeon_hd/r600_reg.h | 311 ++++--- .../private/graphics/radeon_hd/radeon_hd.h | 38 +- .../accelerants/radeon_hd/accelerant.cpp | 24 +- .../accelerants/radeon_hd/accelerant.h | 5 +- src/add-ons/accelerants/radeon_hd/bios.cpp | 210 +---- src/add-ons/accelerants/radeon_hd/bios.h | 2 +- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 174 +++- 8 files changed, 1172 insertions(+), 385 deletions(-) create mode 100644 headers/private/graphics/radeon_hd/r500_reg.h diff --git a/headers/private/graphics/radeon_hd/r500_reg.h b/headers/private/graphics/radeon_hd/r500_reg.h new file mode 100644 index 0000000000..fc43705991 --- /dev/null +++ b/headers/private/graphics/radeon_hd/r500_reg.h @@ -0,0 +1,793 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * Copyright 2008 Red Hat Inc. + * Copyright 2009 Jerome Glisse. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: Dave Airlie + * Alex Deucher + * Jerome Glisse + */ +#ifndef __R500_REG_H__ +#define __R500_REG_H__ + +/* pipe config regs */ +#define R300_GA_POLY_MODE 0x4288 +# define R300_FRONT_PTYPE_POINT (0 << 4) +# define R300_FRONT_PTYPE_LINE (1 << 4) +# define R300_FRONT_PTYPE_TRIANGE (2 << 4) +# define R300_BACK_PTYPE_POINT (0 << 7) +# define R300_BACK_PTYPE_LINE (1 << 7) +# define R300_BACK_PTYPE_TRIANGE (2 << 7) +#define R300_GA_ROUND_MODE 0x428c +# define R300_GEOMETRY_ROUND_TRUNC (0 << 0) +# define R300_GEOMETRY_ROUND_NEAREST (1 << 0) +# define R300_COLOR_ROUND_TRUNC (0 << 2) +# define R300_COLOR_ROUND_NEAREST (1 << 2) +#define R300_GB_MSPOS0 0x4010 +# define R300_MS_X0_SHIFT 0 +# define R300_MS_Y0_SHIFT 4 +# define R300_MS_X1_SHIFT 8 +# define R300_MS_Y1_SHIFT 12 +# define R300_MS_X2_SHIFT 16 +# define R300_MS_Y2_SHIFT 20 +# define R300_MSBD0_Y_SHIFT 24 +# define R300_MSBD0_X_SHIFT 28 +#define R300_GB_MSPOS1 0x4014 +# define R300_MS_X3_SHIFT 0 +# define R300_MS_Y3_SHIFT 4 +# define R300_MS_X4_SHIFT 8 +# define R300_MS_Y4_SHIFT 12 +# define R300_MS_X5_SHIFT 16 +# define R300_MS_Y5_SHIFT 20 +# define R300_MSBD1_SHIFT 24 + +#define R300_GA_ENHANCE 0x4274 +# define R300_GA_DEADLOCK_CNTL (1 << 0) +# define R300_GA_FASTSYNC_CNTL (1 << 1) +#define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c +# define R300_RB3D_DC_FLUSH (2 << 0) +# define R300_RB3D_DC_FREE (2 << 2) +# define R300_RB3D_DC_FINISH (1 << 4) +#define R300_RB3D_ZCACHE_CTLSTAT 0x4f18 +# define R300_ZC_FLUSH (1 << 0) +# define R300_ZC_FREE (1 << 1) +# define R300_ZC_FLUSH_ALL 0x3 +#define R400_GB_PIPE_SELECT 0x402c +#define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */ +#define R500_SU_REG_DEST 0x42c8 +#define R300_GB_TILE_CONFIG 0x4018 +# define R300_ENABLE_TILING (1 << 0) +# define R300_PIPE_COUNT_RV350 (0 << 1) +# define R300_PIPE_COUNT_R300 (3 << 1) +# define R300_PIPE_COUNT_R420_3P (6 << 1) +# define R300_PIPE_COUNT_R420 (7 << 1) +# define R300_TILE_SIZE_8 (0 << 4) +# define R300_TILE_SIZE_16 (1 << 4) +# define R300_TILE_SIZE_32 (2 << 4) +# define R300_SUBPIXEL_1_12 (0 << 16) +# define R300_SUBPIXEL_1_16 (1 << 16) +#define R300_DST_PIPE_CONFIG 0x170c +# define R300_PIPE_AUTO_CONFIG (1 << 31) +#define R300_RB2D_DSTCACHE_MODE 0x3428 +# define R300_DC_AUTOFLUSH_ENABLE (1 << 8) +# define R300_DC_DC_DISABLE_IGNORE_PE (1 << 17) + +#define RADEON_CP_STAT 0x7C0 +#define RADEON_RBBM_CMDFIFO_ADDR 0xE70 +#define RADEON_RBBM_CMDFIFO_DATA 0xE74 +#define RADEON_ISYNC_CNTL 0x1724 +# define RADEON_ISYNC_ANY2D_IDLE3D (1 << 0) +# define RADEON_ISYNC_ANY3D_IDLE2D (1 << 1) +# define RADEON_ISYNC_TRIG2D_IDLE3D (1 << 2) +# define RADEON_ISYNC_TRIG3D_IDLE2D (1 << 3) +# define RADEON_ISYNC_WAIT_IDLEGUI (1 << 4) +# define RADEON_ISYNC_CPSCRATCH_IDLEGUI (1 << 5) + +#define RS480_NB_MC_INDEX 0x168 +# define RS480_NB_MC_IND_WR_EN (1 << 8) +#define RS480_NB_MC_DATA 0x16c + +/* + * RS690 + */ +#define RS690_MCCFG_FB_LOCATION 0x100 +#define RS690_MC_FB_START_MASK 0x0000FFFF +#define RS690_MC_FB_START_SHIFT 0 +#define RS690_MC_FB_TOP_MASK 0xFFFF0000 +#define RS690_MC_FB_TOP_SHIFT 16 +#define RS690_MCCFG_AGP_LOCATION 0x101 +#define RS690_MC_AGP_START_MASK 0x0000FFFF +#define RS690_MC_AGP_START_SHIFT 0 +#define RS690_MC_AGP_TOP_MASK 0xFFFF0000 +#define RS690_MC_AGP_TOP_SHIFT 16 +#define RS690_MCCFG_AGP_BASE 0x102 +#define RS690_MCCFG_AGP_BASE_2 0x103 +#define RS690_MC_INIT_MISC_LAT_TIMER 0x104 +#define RS690_HDP_FB_LOCATION 0x0134 +#define RS690_MC_INDEX 0x78 +# define RS690_MC_INDEX_MASK 0x1ff +# define RS690_MC_INDEX_WR_EN (1 << 9) +# define RS690_MC_INDEX_WR_ACK 0x7f +#define RS690_MC_DATA 0x7c +#define RS690_MC_STATUS 0x90 +#define RS690_MC_STATUS_IDLE (1 << 0) +#define RS480_AGP_BASE_2 0x0164 +#define RS480_MC_MISC_CNTL 0x18 +# define RS480_DISABLE_GTW (1 << 1) +# define RS480_GART_INDEX_REG_EN (1 << 12) +# define RS690_BLOCK_GFX_D3_EN (1 << 14) +#define RS480_GART_FEATURE_ID 0x2b +# define RS480_HANG_EN (1 << 11) +# define RS480_TLB_ENABLE (1 << 18) +# define RS480_P2P_ENABLE (1 << 19) +# define RS480_GTW_LAC_EN (1 << 25) +# define RS480_2LEVEL_GART (0 << 30) +# define RS480_1LEVEL_GART (1 << 30) +# define RS480_PDC_EN (1 << 31) +#define RS480_GART_BASE 0x2c +#define RS480_GART_CACHE_CNTRL 0x2e +# define RS480_GART_CACHE_INVALIDATE (1 << 0) /* wait for it to clear */ +#define RS480_AGP_ADDRESS_SPACE_SIZE 0x38 +# define RS480_GART_EN (1 << 0) +# define RS480_VA_SIZE_32MB (0 << 1) +# define RS480_VA_SIZE_64MB (1 << 1) +# define RS480_VA_SIZE_128MB (2 << 1) +# define RS480_VA_SIZE_256MB (3 << 1) +# define RS480_VA_SIZE_512MB (4 << 1) +# define RS480_VA_SIZE_1GB (5 << 1) +# define RS480_VA_SIZE_2GB (6 << 1) +#define RS480_AGP_MODE_CNTL 0x39 +# define RS480_POST_GART_Q_SIZE (1 << 18) +# define RS480_NONGART_SNOOP (1 << 19) +# define RS480_AGP_RD_BUF_SIZE (1 << 20) +# define RS480_REQ_TYPE_SNOOP_SHIFT 22 +# define RS480_REQ_TYPE_SNOOP_MASK 0x3 +# define RS480_REQ_TYPE_SNOOP_DIS (1 << 24) + +#define RS690_AIC_CTRL_SCRATCH 0x3A +# define RS690_DIS_OUT_OF_PCI_GART_ACCESS (1 << 1) + +/* + * RS600 + */ +#define RS600_MC_STATUS 0x0 +#define RS600_MC_STATUS_IDLE (1 << 0) +#define RS600_MC_INDEX 0x70 +# define RS600_MC_ADDR_MASK 0xffff +# define RS600_MC_IND_SEQ_RBS_0 (1 << 16) +# define RS600_MC_IND_SEQ_RBS_1 (1 << 17) +# define RS600_MC_IND_SEQ_RBS_2 (1 << 18) +# define RS600_MC_IND_SEQ_RBS_3 (1 << 19) +# define RS600_MC_IND_AIC_RBS (1 << 20) +# define RS600_MC_IND_CITF_ARB0 (1 << 21) +# define RS600_MC_IND_CITF_ARB1 (1 << 22) +# define RS600_MC_IND_WR_EN (1 << 23) +#define RS600_MC_DATA 0x74 +#define RS600_MC_STATUS 0x0 +# define RS600_MC_IDLE (1 << 1) +#define RS600_MC_FB_LOCATION 0x4 +#define RS600_MC_FB_START_MASK 0x0000FFFF +#define RS600_MC_FB_START_SHIFT 0 +#define RS600_MC_FB_TOP_MASK 0xFFFF0000 +#define RS600_MC_FB_TOP_SHIFT 16 +#define RS600_MC_AGP_LOCATION 0x5 +#define RS600_MC_AGP_START_MASK 0x0000FFFF +#define RS600_MC_AGP_START_SHIFT 0 +#define RS600_MC_AGP_TOP_MASK 0xFFFF0000 +#define RS600_MC_AGP_TOP_SHIFT 16 +#define RS600_MC_AGP_BASE 0x6 +#define RS600_MC_AGP_BASE_2 0x7 +#define RS600_MC_CNTL1 0x9 +# define RS600_ENABLE_PAGE_TABLES (1 << 26) +#define RS600_MC_PT0_CNTL 0x100 +# define RS600_ENABLE_PT (1 << 0) +# define RS600_EFFECTIVE_L2_CACHE_SIZE(x) ((x) << 15) +# define RS600_EFFECTIVE_L2_QUEUE_SIZE(x) ((x) << 21) +# define RS600_INVALIDATE_ALL_L1_TLBS (1 << 28) +# define RS600_INVALIDATE_L2_CACHE (1 << 29) +#define RS600_MC_PT0_CONTEXT0_CNTL 0x102 +# define RS600_ENABLE_PAGE_TABLE (1 << 0) +# define RS600_PAGE_TABLE_TYPE_FLAT (0 << 1) +#define RS600_MC_PT0_SYSTEM_APERTURE_LOW_ADDR 0x112 +#define RS600_MC_PT0_SYSTEM_APERTURE_HIGH_ADDR 0x114 +#define RS600_MC_PT0_CONTEXT0_DEFAULT_READ_ADDR 0x11c +#define RS600_MC_PT0_CONTEXT0_FLAT_BASE_ADDR 0x12c +#define RS600_MC_PT0_CONTEXT0_FLAT_START_ADDR 0x13c +#define RS600_MC_PT0_CONTEXT0_FLAT_END_ADDR 0x14c +#define RS600_MC_PT0_CLIENT0_CNTL 0x16c +# define RS600_ENABLE_TRANSLATION_MODE_OVERRIDE (1 << 0) +# define RS600_TRANSLATION_MODE_OVERRIDE (1 << 1) +# define RS600_SYSTEM_ACCESS_MODE_MASK (3 << 8) +# define RS600_SYSTEM_ACCESS_MODE_PA_ONLY (0 << 8) +# define RS600_SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 8) +# define RS600_SYSTEM_ACCESS_MODE_IN_SYS (2 << 8) +# define RS600_SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 8) +# define RS600_SYSTEM_APERTURE_UNMAPPED_ACCESS_PASSTHROUGH (0 << 10) +# define RS600_SYSTEM_APERTURE_UNMAPPED_ACCESS_DEFAULT_PAGE (1 << 10) +# define RS600_EFFECTIVE_L1_CACHE_SIZE(x) ((x) << 11) +# define RS600_ENABLE_FRAGMENT_PROCESSING (1 << 14) +# define RS600_EFFECTIVE_L1_QUEUE_SIZE(x) ((x) << 15) +# define RS600_INVALIDATE_L1_TLB (1 << 20) +/* rs600/rs690/rs740 */ +# define RS600_BUS_MASTER_DIS (1 << 14) +# define RS600_MSI_REARM (1 << 20) +/* see RS400_MSI_REARM in AIC_CNTL for rs480 */ + + + +#define RV515_MC_FB_LOCATION 0x01 +#define RV515_MC_FB_START_MASK 0x0000FFFF +#define RV515_MC_FB_START_SHIFT 0 +#define RV515_MC_FB_TOP_MASK 0xFFFF0000 +#define RV515_MC_FB_TOP_SHIFT 16 +#define RV515_MC_AGP_LOCATION 0x02 +#define RV515_MC_AGP_START_MASK 0x0000FFFF +#define RV515_MC_AGP_START_SHIFT 0 +#define RV515_MC_AGP_TOP_MASK 0xFFFF0000 +#define RV515_MC_AGP_TOP_SHIFT 16 +#define RV515_MC_AGP_BASE 0x03 +#define RV515_MC_AGP_BASE_2 0x04 + +#define R520_MC_FB_LOCATION 0x04 +#define R520_MC_FB_START_MASK 0x0000FFFF +#define R520_MC_FB_START_SHIFT 0 +#define R520_MC_FB_TOP_MASK 0xFFFF0000 +#define R520_MC_FB_TOP_SHIFT 16 +#define R520_MC_AGP_LOCATION 0x05 +#define R520_MC_AGP_START_MASK 0x0000FFFF +#define R520_MC_AGP_START_SHIFT 0 +#define R520_MC_AGP_TOP_MASK 0xFFFF0000 +#define R520_MC_AGP_TOP_SHIFT 16 +#define R520_MC_AGP_BASE 0x06 +#define R520_MC_AGP_BASE_2 0x07 + + +#define AVIVO_MC_INDEX 0x0070 +#define R520_MC_STATUS 0x00 +#define R520_MC_STATUS_IDLE (1<<1) +#define RV515_MC_STATUS 0x08 +#define RV515_MC_STATUS_IDLE (1<<4) +#define RV515_MC_INIT_MISC_LAT_TIMER 0x09 +#define AVIVO_MC_DATA 0x0074 + +#define R520_MC_IND_INDEX 0x70 +#define R520_MC_IND_WR_EN (1 << 24) +#define R520_MC_IND_DATA 0x74 + +#define RV515_MC_CNTL 0x5 +# define RV515_MEM_NUM_CHANNELS_MASK 0x3 +#define R520_MC_CNTL0 0x8 +# define R520_MEM_NUM_CHANNELS_MASK (0x3 << 24) +# define R520_MEM_NUM_CHANNELS_SHIFT 24 +# define R520_MC_CHANNEL_SIZE (1 << 23) + +#define AVIVO_CP_DYN_CNTL 0x000f /* PLL */ +# define AVIVO_CP_FORCEON (1 << 0) +#define AVIVO_E2_DYN_CNTL 0x0011 /* PLL */ +# define AVIVO_E2_FORCEON (1 << 0) +#define AVIVO_IDCT_DYN_CNTL 0x0013 /* PLL */ +# define AVIVO_IDCT_FORCEON (1 << 0) + +#define AVIVO_HDP_FB_LOCATION 0x134 + +#define AVIVO_VGA_RENDER_CONTROL 0x0300 +# define AVIVO_VGA_VSTATUS_CNTL_MASK (3 << 16) +#define AVIVO_D1VGA_CONTROL 0x0330 +# define AVIVO_DVGA_CONTROL_MODE_ENABLE (1<<0) +# define AVIVO_DVGA_CONTROL_TIMING_SELECT (1<<8) +# define AVIVO_DVGA_CONTROL_SYNC_POLARITY_SELECT (1<<9) +# define AVIVO_DVGA_CONTROL_OVERSCAN_TIMING_SELECT (1<<10) +# define AVIVO_DVGA_CONTROL_OVERSCAN_COLOR_EN (1<<16) +# define AVIVO_DVGA_CONTROL_ROTATE (1<<24) +#define AVIVO_D2VGA_CONTROL 0x0338 + +#define AVIVO_EXT1_PPLL_REF_DIV_SRC 0x400 +#define AVIVO_EXT1_PPLL_REF_DIV 0x404 +#define AVIVO_EXT1_PPLL_UPDATE_LOCK 0x408 +#define AVIVO_EXT1_PPLL_UPDATE_CNTL 0x40c + +#define AVIVO_EXT2_PPLL_REF_DIV_SRC 0x410 +#define AVIVO_EXT2_PPLL_REF_DIV 0x414 +#define AVIVO_EXT2_PPLL_UPDATE_LOCK 0x418 +#define AVIVO_EXT2_PPLL_UPDATE_CNTL 0x41c + +#define AVIVO_EXT1_PPLL_FB_DIV 0x430 +#define AVIVO_EXT2_PPLL_FB_DIV 0x434 + +#define AVIVO_EXT1_PPLL_POST_DIV_SRC 0x438 +#define AVIVO_EXT1_PPLL_POST_DIV 0x43c + +#define AVIVO_EXT2_PPLL_POST_DIV_SRC 0x440 +#define AVIVO_EXT2_PPLL_POST_DIV 0x444 + +#define AVIVO_EXT1_PPLL_CNTL 0x448 +#define AVIVO_EXT2_PPLL_CNTL 0x44c + +#define AVIVO_P1PLL_CNTL 0x450 +#define AVIVO_P2PLL_CNTL 0x454 +#define AVIVO_P1PLL_INT_SS_CNTL 0x458 +#define AVIVO_P2PLL_INT_SS_CNTL 0x45c +#define AVIVO_P1PLL_TMDSA_CNTL 0x460 +#define AVIVO_P2PLL_LVTMA_CNTL 0x464 + +#define AVIVO_PCLK_CRTC1_CNTL 0x480 +#define AVIVO_PCLK_CRTC2_CNTL 0x484 + +#define AVIVO_D1CRTC_H_TOTAL 0x6000 +#define AVIVO_D1CRTC_H_BLANK_START_END 0x6004 +#define AVIVO_D1CRTC_H_SYNC_A 0x6008 +#define AVIVO_D1CRTC_H_SYNC_A_CNTL 0x600c +#define AVIVO_D1CRTC_H_SYNC_B 0x6010 +#define AVIVO_D1CRTC_H_SYNC_B_CNTL 0x6014 + +#define AVIVO_D1CRTC_V_TOTAL 0x6020 +#define AVIVO_D1CRTC_V_BLANK_START_END 0x6024 +#define AVIVO_D1CRTC_V_SYNC_A 0x6028 +#define AVIVO_D1CRTC_V_SYNC_A_CNTL 0x602c +#define AVIVO_D1CRTC_V_SYNC_B 0x6030 +#define AVIVO_D1CRTC_V_SYNC_B_CNTL 0x6034 + +#define AVIVO_D1CRTC_CONTROL 0x6080 +# define AVIVO_CRTC_EN (1 << 0) +# define AVIVO_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24) +#define AVIVO_D1CRTC_BLANK_CONTROL 0x6084 +#define AVIVO_D1CRTC_INTERLACE_CONTROL 0x6088 +#define AVIVO_D1CRTC_INTERLACE_STATUS 0x608c +#define AVIVO_D1CRTC_STATUS_POSITION 0x60a0 +#define AVIVO_D1CRTC_FRAME_COUNT 0x60a4 +#define AVIVO_D1CRTC_STEREO_CONTROL 0x60c4 + +#define AVIVO_D1MODE_MASTER_UPDATE_MODE 0x60e4 + +/* master controls */ +#define AVIVO_DC_CRTC_MASTER_EN 0x60f8 +#define AVIVO_DC_CRTC_TV_CONTROL 0x60fc + +#define AVIVO_D1GRPH_ENABLE 0x6100 +#define AVIVO_D1GRPH_CONTROL 0x6104 +# define AVIVO_D1GRPH_CONTROL_DEPTH_8BPP (0 << 0) +# define AVIVO_D1GRPH_CONTROL_DEPTH_16BPP (1 << 0) +# define AVIVO_D1GRPH_CONTROL_DEPTH_32BPP (2 << 0) +# define AVIVO_D1GRPH_CONTROL_DEPTH_64BPP (3 << 0) + +# define AVIVO_D1GRPH_CONTROL_8BPP_INDEXED (0 << 8) + +# define AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555 (0 << 8) +# define AVIVO_D1GRPH_CONTROL_16BPP_RGB565 (1 << 8) +# define AVIVO_D1GRPH_CONTROL_16BPP_ARGB4444 (2 << 8) +# define AVIVO_D1GRPH_CONTROL_16BPP_AI88 (3 << 8) +# define AVIVO_D1GRPH_CONTROL_16BPP_MONO16 (4 << 8) + +# define AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888 (0 << 8) +# define AVIVO_D1GRPH_CONTROL_32BPP_ARGB2101010 (1 << 8) +# define AVIVO_D1GRPH_CONTROL_32BPP_DIGITAL (2 << 8) +# define AVIVO_D1GRPH_CONTROL_32BPP_8B_ARGB2101010 (3 << 8) + + +# define AVIVO_D1GRPH_CONTROL_64BPP_ARGB16161616 (0 << 8) + +# define AVIVO_D1GRPH_SWAP_RB (1 << 16) +# define AVIVO_D1GRPH_TILED (1 << 20) +# define AVIVO_D1GRPH_MACRO_ADDRESS_MODE (1 << 21) + +# define R600_D1GRPH_ARRAY_MODE_LINEAR_GENERAL (0 << 20) +# define R600_D1GRPH_ARRAY_MODE_LINEAR_ALIGNED (1 << 20) +# define R600_D1GRPH_ARRAY_MODE_1D_TILED_THIN1 (2 << 20) +# define R600_D1GRPH_ARRAY_MODE_2D_TILED_THIN1 (4 << 20) + +/* The R7xx *_HIGH surface regs are backwards; the D1 regs are in the D2 + * block and vice versa. This applies to GRPH, CUR, etc. + */ +#define AVIVO_D1GRPH_LUT_SEL 0x6108 +#define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 +#define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6914 +#define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 +#define AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS 0x6118 +#define R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x691c +#define R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x611c +#define AVIVO_D1GRPH_PITCH 0x6120 +#define AVIVO_D1GRPH_SURFACE_OFFSET_X 0x6124 +#define AVIVO_D1GRPH_SURFACE_OFFSET_Y 0x6128 +#define AVIVO_D1GRPH_X_START 0x612c +#define AVIVO_D1GRPH_Y_START 0x6130 +#define AVIVO_D1GRPH_X_END 0x6134 +#define AVIVO_D1GRPH_Y_END 0x6138 +#define AVIVO_D1GRPH_UPDATE 0x6144 +# define AVIVO_D1GRPH_SURFACE_UPDATE_PENDING (1 << 2) +# define AVIVO_D1GRPH_UPDATE_LOCK (1 << 16) +#define AVIVO_D1GRPH_FLIP_CONTROL 0x6148 +# define AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN (1 << 0) + +#define AVIVO_D1CUR_CONTROL 0x6400 +# define AVIVO_D1CURSOR_EN (1 << 0) +# define AVIVO_D1CURSOR_MODE_SHIFT 8 +# define AVIVO_D1CURSOR_MODE_MASK (3 << 8) +# define AVIVO_D1CURSOR_MODE_24BPP 2 +#define AVIVO_D1CUR_SURFACE_ADDRESS 0x6408 +#define R700_D1CUR_SURFACE_ADDRESS_HIGH 0x6c0c +#define R700_D2CUR_SURFACE_ADDRESS_HIGH 0x640c +#define AVIVO_D1CUR_SIZE 0x6410 +#define AVIVO_D1CUR_POSITION 0x6414 +#define AVIVO_D1CUR_HOT_SPOT 0x6418 +#define AVIVO_D1CUR_UPDATE 0x6424 +# define AVIVO_D1CURSOR_UPDATE_LOCK (1 << 16) + +#define AVIVO_DC_LUT_RW_SELECT 0x6480 +#define AVIVO_DC_LUT_RW_MODE 0x6484 +#define AVIVO_DC_LUT_RW_INDEX 0x6488 +#define AVIVO_DC_LUT_SEQ_COLOR 0x648c +#define AVIVO_DC_LUT_PWL_DATA 0x6490 +#define AVIVO_DC_LUT_30_COLOR 0x6494 +#define AVIVO_DC_LUT_READ_PIPE_SELECT 0x6498 +#define AVIVO_DC_LUT_WRITE_EN_MASK 0x649c +#define AVIVO_DC_LUT_AUTOFILL 0x64a0 + +#define AVIVO_DC_LUTA_CONTROL 0x64c0 +#define AVIVO_DC_LUTA_BLACK_OFFSET_BLUE 0x64c4 +#define AVIVO_DC_LUTA_BLACK_OFFSET_GREEN 0x64c8 +#define AVIVO_DC_LUTA_BLACK_OFFSET_RED 0x64cc +#define AVIVO_DC_LUTA_WHITE_OFFSET_BLUE 0x64d0 +#define AVIVO_DC_LUTA_WHITE_OFFSET_GREEN 0x64d4 +#define AVIVO_DC_LUTA_WHITE_OFFSET_RED 0x64d8 + +#define AVIVO_DC_LB_MEMORY_SPLIT 0x6520 +# define AVIVO_DC_LB_MEMORY_SPLIT_MASK 0x3 +# define AVIVO_DC_LB_MEMORY_SPLIT_SHIFT 0 +# define AVIVO_DC_LB_MEMORY_SPLIT_D1HALF_D2HALF 0 +# define AVIVO_DC_LB_MEMORY_SPLIT_D1_3Q_D2_1Q 1 +# define AVIVO_DC_LB_MEMORY_SPLIT_D1_ONLY 2 +# define AVIVO_DC_LB_MEMORY_SPLIT_D1_1Q_D2_3Q 3 +# define AVIVO_DC_LB_MEMORY_SPLIT_SHIFT_MODE (1 << 2) +# define AVIVO_DC_LB_DISP1_END_ADR_SHIFT 4 +# define AVIVO_DC_LB_DISP1_END_ADR_MASK 0x7ff + +#define AVIVO_D1MODE_DATA_FORMAT 0x6528 +# define AVIVO_D1MODE_INTERLEAVE_EN (1 << 0) +#define AVIVO_D1MODE_DESKTOP_HEIGHT 0x652C +#define AVIVO_D1MODE_VBLANK_STATUS 0x6534 +# define AVIVO_VBLANK_ACK (1 << 4) +#define AVIVO_D1MODE_VLINE_START_END 0x6538 +#define AVIVO_D1MODE_VLINE_STATUS 0x653c +# define AVIVO_D1MODE_VLINE_STAT (1 << 12) +#define AVIVO_DxMODE_INT_MASK 0x6540 +# define AVIVO_D1MODE_INT_MASK (1 << 0) +# define AVIVO_D2MODE_INT_MASK (1 << 8) +#define AVIVO_D1MODE_VIEWPORT_START 0x6580 +#define AVIVO_D1MODE_VIEWPORT_SIZE 0x6584 +#define AVIVO_D1MODE_EXT_OVERSCAN_LEFT_RIGHT 0x6588 +#define AVIVO_D1MODE_EXT_OVERSCAN_TOP_BOTTOM 0x658c + +#define AVIVO_D1SCL_SCALER_ENABLE 0x6590 +#define AVIVO_D1SCL_SCALER_TAP_CONTROL 0x6594 +#define AVIVO_D1SCL_UPDATE 0x65cc +# define AVIVO_D1SCL_UPDATE_LOCK (1 << 16) + +/* second crtc */ +#define AVIVO_D2CRTC_H_TOTAL 0x6800 +#define AVIVO_D2CRTC_H_BLANK_START_END 0x6804 +#define AVIVO_D2CRTC_H_SYNC_A 0x6808 +#define AVIVO_D2CRTC_H_SYNC_A_CNTL 0x680c +#define AVIVO_D2CRTC_H_SYNC_B 0x6810 +#define AVIVO_D2CRTC_H_SYNC_B_CNTL 0x6814 + +#define AVIVO_D2CRTC_V_TOTAL 0x6820 +#define AVIVO_D2CRTC_V_BLANK_START_END 0x6824 +#define AVIVO_D2CRTC_V_SYNC_A 0x6828 +#define AVIVO_D2CRTC_V_SYNC_A_CNTL 0x682c +#define AVIVO_D2CRTC_V_SYNC_B 0x6830 +#define AVIVO_D2CRTC_V_SYNC_B_CNTL 0x6834 + +#define AVIVO_D2CRTC_CONTROL 0x6880 +#define AVIVO_D2CRTC_BLANK_CONTROL 0x6884 +#define AVIVO_D2CRTC_INTERLACE_CONTROL 0x6888 +#define AVIVO_D2CRTC_INTERLACE_STATUS 0x688c +#define AVIVO_D2CRTC_STATUS_POSITION 0x68a0 +#define AVIVO_D2CRTC_FRAME_COUNT 0x68a4 +#define AVIVO_D2CRTC_STEREO_CONTROL 0x68c4 + +#define AVIVO_D2GRPH_ENABLE 0x6900 +#define AVIVO_D2GRPH_CONTROL 0x6904 +#define AVIVO_D2GRPH_LUT_SEL 0x6908 +#define AVIVO_D2GRPH_PRIMARY_SURFACE_ADDRESS 0x6910 +#define AVIVO_D2GRPH_SECONDARY_SURFACE_ADDRESS 0x6918 +#define AVIVO_D2GRPH_PITCH 0x6920 +#define AVIVO_D2GRPH_SURFACE_OFFSET_X 0x6924 +#define AVIVO_D2GRPH_SURFACE_OFFSET_Y 0x6928 +#define AVIVO_D2GRPH_X_START 0x692c +#define AVIVO_D2GRPH_Y_START 0x6930 +#define AVIVO_D2GRPH_X_END 0x6934 +#define AVIVO_D2GRPH_Y_END 0x6938 +#define AVIVO_D2GRPH_UPDATE 0x6944 +#define AVIVO_D2GRPH_FLIP_CONTROL 0x6948 + +#define AVIVO_D2CUR_CONTROL 0x6c00 +#define AVIVO_D2CUR_SURFACE_ADDRESS 0x6c08 +#define AVIVO_D2CUR_SIZE 0x6c10 +#define AVIVO_D2CUR_POSITION 0x6c14 + +#define AVIVO_D2MODE_VBLANK_STATUS 0x6d34 +#define AVIVO_D2MODE_VLINE_START_END 0x6d38 +#define AVIVO_D2MODE_VLINE_STATUS 0x6d3c +#define AVIVO_D2MODE_VIEWPORT_START 0x6d80 +#define AVIVO_D2MODE_VIEWPORT_SIZE 0x6d84 +#define AVIVO_D2MODE_EXT_OVERSCAN_LEFT_RIGHT 0x6d88 +#define AVIVO_D2MODE_EXT_OVERSCAN_TOP_BOTTOM 0x6d8c + +#define AVIVO_D2SCL_SCALER_ENABLE 0x6d90 +#define AVIVO_D2SCL_SCALER_TAP_CONTROL 0x6d94 + +#define AVIVO_DDIA_BIT_DEPTH_CONTROL 0x7214 + +#define AVIVO_DACA_ENABLE 0x7800 +# define AVIVO_DAC_ENABLE (1 << 0) +#define AVIVO_DACA_SOURCE_SELECT 0x7804 +# define AVIVO_DAC_SOURCE_CRTC1 (0 << 0) +# define AVIVO_DAC_SOURCE_CRTC2 (1 << 0) +# define AVIVO_DAC_SOURCE_TV (2 << 0) + +#define AVIVO_DACA_FORCE_OUTPUT_CNTL 0x783c +# define AVIVO_DACA_FORCE_OUTPUT_CNTL_FORCE_DATA_EN (1 << 0) +# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_SEL_SHIFT (8) +# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_SEL_BLUE (1 << 0) +# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_SEL_GREEN (1 << 1) +# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_SEL_RED (1 << 2) +# define AVIVO_DACA_FORCE_OUTPUT_CNTL_DATA_ON_BLANKB_ONLY (1 << 24) +#define AVIVO_DACA_POWERDOWN 0x7850 +# define AVIVO_DACA_POWERDOWN_POWERDOWN (1 << 0) +# define AVIVO_DACA_POWERDOWN_BLUE (1 << 8) +# define AVIVO_DACA_POWERDOWN_GREEN (1 << 16) +# define AVIVO_DACA_POWERDOWN_RED (1 << 24) + +#define AVIVO_DACB_ENABLE 0x7a00 +#define AVIVO_DACB_SOURCE_SELECT 0x7a04 +#define AVIVO_DACB_FORCE_OUTPUT_CNTL 0x7a3c +# define AVIVO_DACB_FORCE_OUTPUT_CNTL_FORCE_DATA_EN (1 << 0) +# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_SEL_SHIFT (8) +# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_SEL_BLUE (1 << 0) +# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_SEL_GREEN (1 << 1) +# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_SEL_RED (1 << 2) +# define AVIVO_DACB_FORCE_OUTPUT_CNTL_DATA_ON_BLANKB_ONLY (1 << 24) +#define AVIVO_DACB_POWERDOWN 0x7a50 +# define AVIVO_DACB_POWERDOWN_POWERDOWN (1 << 0) +# define AVIVO_DACB_POWERDOWN_BLUE (1 << 8) +# define AVIVO_DACB_POWERDOWN_GREEN (1 << 16) +# define AVIVO_DACB_POWERDOWN_RED + +#define AVIVO_TMDSA_CNTL 0x7880 +# define AVIVO_TMDSA_CNTL_ENABLE (1 << 0) +# define AVIVO_TMDSA_CNTL_HPD_MASK (1 << 4) +# define AVIVO_TMDSA_CNTL_HPD_SELECT (1 << 8) +# define AVIVO_TMDSA_CNTL_SYNC_PHASE (1 << 12) +# define AVIVO_TMDSA_CNTL_PIXEL_ENCODING (1 << 16) +# define AVIVO_TMDSA_CNTL_DUAL_LINK_ENABLE (1 << 24) +# define AVIVO_TMDSA_CNTL_SWAP (1 << 28) +#define AVIVO_TMDSA_SOURCE_SELECT 0x7884 +/* 78a8 appears to be some kind of (reasonably tolerant) clock? + * 78d0 definitely hits the transmitter, definitely clock. */ +/* MYSTERY1 This appears to control dithering? */ +#define AVIVO_TMDSA_BIT_DEPTH_CONTROL 0x7894 +# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TRUNCATE_EN (1 << 0) +# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TRUNCATE_DEPTH (1 << 4) +# define AVIVO_TMDS_BIT_DEPTH_CONTROL_SPATIAL_DITHER_EN (1 << 8) +# define AVIVO_TMDS_BIT_DEPTH_CONTROL_SPATIAL_DITHER_DEPTH (1 << 12) +# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_EN (1 << 16) +# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_DEPTH (1 << 20) +# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TEMPORAL_LEVEL (1 << 24) +# define AVIVO_TMDS_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_RESET (1 << 26) +#define AVIVO_TMDSA_DCBALANCER_CONTROL 0x78d0 +# define AVIVO_TMDSA_DCBALANCER_CONTROL_EN (1 << 0) +# define AVIVO_TMDSA_DCBALANCER_CONTROL_TEST_EN (1 << 8) +# define AVIVO_TMDSA_DCBALANCER_CONTROL_TEST_IN_SHIFT (16) +# define AVIVO_TMDSA_DCBALANCER_CONTROL_FORCE (1 << 24) +#define AVIVO_TMDSA_DATA_SYNCHRONIZATION 0x78d8 +# define AVIVO_TMDSA_DATA_SYNCHRONIZATION_DSYNSEL (1 << 0) +# define AVIVO_TMDSA_DATA_SYNCHRONIZATION_PFREQCHG (1 << 8) +#define AVIVO_TMDSA_CLOCK_ENABLE 0x7900 +#define AVIVO_TMDSA_TRANSMITTER_ENABLE 0x7904 +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_TX0_ENABLE (1 << 0) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKC0EN (1 << 1) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD00EN (1 << 2) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD01EN (1 << 3) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD02EN (1 << 4) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_TX1_ENABLE (1 << 8) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD10EN (1 << 10) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD11EN (1 << 11) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKD12EN (1 << 12) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_TX_ENABLE_HPD_MASK (1 << 16) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKCEN_HPD_MASK (1 << 17) +# define AVIVO_TMDSA_TRANSMITTER_ENABLE_LNKDEN_HPD_MASK (1 << 18) + +#define AVIVO_TMDSA_TRANSMITTER_CONTROL 0x7910 +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_PLL_ENABLE (1 << 0) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_PLL_RESET (1 << 1) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_PLL_HPD_MASK_SHIFT (2) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_IDSCKSEL (1 << 4) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_BGSLEEP (1 << 5) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_PLL_PWRUP_SEQ_EN (1 << 6) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_TMCLK (1 << 8) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_TMCLK_FROM_PADS (1 << 13) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_TDCLK (1 << 14) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_TDCLK_FROM_PADS (1 << 15) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_CLK_PATTERN_SHIFT (16) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_BYPASS_PLL (1 << 28) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_USE_CLK_DATA (1 << 29) +# define AVIVO_TMDSA_TRANSMITTER_CONTROL_INPUT_TEST_CLK_SEL (1 << 31) + +#define AVIVO_LVTMA_CNTL 0x7a80 +# define AVIVO_LVTMA_CNTL_ENABLE (1 << 0) +# define AVIVO_LVTMA_CNTL_HPD_MASK (1 << 4) +# define AVIVO_LVTMA_CNTL_HPD_SELECT (1 << 8) +# define AVIVO_LVTMA_CNTL_SYNC_PHASE (1 << 12) +# define AVIVO_LVTMA_CNTL_PIXEL_ENCODING (1 << 16) +# define AVIVO_LVTMA_CNTL_DUAL_LINK_ENABLE (1 << 24) +# define AVIVO_LVTMA_CNTL_SWAP (1 << 28) +#define AVIVO_LVTMA_SOURCE_SELECT 0x7a84 +#define AVIVO_LVTMA_COLOR_FORMAT 0x7a88 +#define AVIVO_LVTMA_BIT_DEPTH_CONTROL 0x7a94 +# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TRUNCATE_EN (1 << 0) +# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TRUNCATE_DEPTH (1 << 4) +# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_SPATIAL_DITHER_EN (1 << 8) +# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_SPATIAL_DITHER_DEPTH (1 << 12) +# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_EN (1 << 16) +# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_DEPTH (1 << 20) +# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TEMPORAL_LEVEL (1 << 24) +# define AVIVO_LVTMA_BIT_DEPTH_CONTROL_TEMPORAL_DITHER_RESET (1 << 26) + + + +#define AVIVO_LVTMA_DCBALANCER_CONTROL 0x7ad0 +# define AVIVO_LVTMA_DCBALANCER_CONTROL_EN (1 << 0) +# define AVIVO_LVTMA_DCBALANCER_CONTROL_TEST_EN (1 << 8) +# define AVIVO_LVTMA_DCBALANCER_CONTROL_TEST_IN_SHIFT (16) +# define AVIVO_LVTMA_DCBALANCER_CONTROL_FORCE (1 << 24) + +#define AVIVO_LVTMA_DATA_SYNCHRONIZATION 0x78d8 +# define AVIVO_LVTMA_DATA_SYNCHRONIZATION_DSYNSEL (1 << 0) +# define AVIVO_LVTMA_DATA_SYNCHRONIZATION_PFREQCHG (1 << 8) +#define R500_LVTMA_CLOCK_ENABLE 0x7b00 +#define R600_LVTMA_CLOCK_ENABLE 0x7b04 + +#define R500_LVTMA_TRANSMITTER_ENABLE 0x7b04 +#define R600_LVTMA_TRANSMITTER_ENABLE 0x7b08 +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKC0EN (1 << 1) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD00EN (1 << 2) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD01EN (1 << 3) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD02EN (1 << 4) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD03EN (1 << 5) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKC1EN (1 << 9) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD10EN (1 << 10) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD11EN (1 << 11) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKD12EN (1 << 12) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKCEN_HPD_MASK (1 << 17) +# define AVIVO_LVTMA_TRANSMITTER_ENABLE_LNKDEN_HPD_MASK (1 << 18) + +#define R500_LVTMA_TRANSMITTER_CONTROL 0x7b10 +#define R600_LVTMA_TRANSMITTER_CONTROL 0x7b14 +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_PLL_ENABLE (1 << 0) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_PLL_RESET (1 << 1) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_PLL_HPD_MASK_SHIFT (2) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_IDSCKSEL (1 << 4) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_BGSLEEP (1 << 5) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_PLL_PWRUP_SEQ_EN (1 << 6) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_TMCLK (1 << 8) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_TMCLK_FROM_PADS (1 << 13) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_TDCLK (1 << 14) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_TDCLK_FROM_PADS (1 << 15) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_CLK_PATTERN_SHIFT (16) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_BYPASS_PLL (1 << 28) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_USE_CLK_DATA (1 << 29) +# define AVIVO_LVTMA_TRANSMITTER_CONTROL_INPUT_TEST_CLK_SEL (1 << 31) + +#define R500_LVTMA_PWRSEQ_CNTL 0x7af0 +#define R600_LVTMA_PWRSEQ_CNTL 0x7af4 +# define AVIVO_LVTMA_PWRSEQ_EN (1 << 0) +# define AVIVO_LVTMA_PWRSEQ_PLL_ENABLE_MASK (1 << 2) +# define AVIVO_LVTMA_PWRSEQ_PLL_RESET_MASK (1 << 3) +# define AVIVO_LVTMA_PWRSEQ_TARGET_STATE (1 << 4) +# define AVIVO_LVTMA_SYNCEN (1 << 8) +# define AVIVO_LVTMA_SYNCEN_OVRD (1 << 9) +# define AVIVO_LVTMA_SYNCEN_POL (1 << 10) +# define AVIVO_LVTMA_DIGON (1 << 16) +# define AVIVO_LVTMA_DIGON_OVRD (1 << 17) +# define AVIVO_LVTMA_DIGON_POL (1 << 18) +# define AVIVO_LVTMA_BLON (1 << 24) +# define AVIVO_LVTMA_BLON_OVRD (1 << 25) +# define AVIVO_LVTMA_BLON_POL (1 << 26) + +#define R500_LVTMA_PWRSEQ_STATE 0x7af4 +#define R600_LVTMA_PWRSEQ_STATE 0x7af8 +# define AVIVO_LVTMA_PWRSEQ_STATE_TARGET_STATE_R (1 << 0) +# define AVIVO_LVTMA_PWRSEQ_STATE_DIGON (1 << 1) +# define AVIVO_LVTMA_PWRSEQ_STATE_SYNCEN (1 << 2) +# define AVIVO_LVTMA_PWRSEQ_STATE_BLON (1 << 3) +# define AVIVO_LVTMA_PWRSEQ_STATE_DONE (1 << 4) +# define AVIVO_LVTMA_PWRSEQ_STATE_STATUS_SHIFT (8) + +#define AVIVO_LVDS_BACKLIGHT_CNTL 0x7af8 +# define AVIVO_LVDS_BACKLIGHT_CNTL_EN (1 << 0) +# define AVIVO_LVDS_BACKLIGHT_LEVEL_MASK 0x0000ff00 +# define AVIVO_LVDS_BACKLIGHT_LEVEL_SHIFT 8 + +#define AVIVO_DVOA_BIT_DEPTH_CONTROL 0x7988 + +#define AVIVO_DC_GPIO_HPD_A 0x7e94 +#define AVIVO_DC_GPIO_HPD_Y 0x7e9c + +#define AVIVO_DC_I2C_STATUS1 0x7d30 +# define AVIVO_DC_I2C_DONE (1 << 0) +# define AVIVO_DC_I2C_NACK (1 << 1) +# define AVIVO_DC_I2C_HALT (1 << 2) +# define AVIVO_DC_I2C_GO (1 << 3) +#define AVIVO_DC_I2C_RESET 0x7d34 +# define AVIVO_DC_I2C_SOFT_RESET (1 << 0) +# define AVIVO_DC_I2C_ABORT (1 << 8) +#define AVIVO_DC_I2C_CONTROL1 0x7d38 +# define AVIVO_DC_I2C_START (1 << 0) +# define AVIVO_DC_I2C_STOP (1 << 1) +# define AVIVO_DC_I2C_RECEIVE (1 << 2) +# define AVIVO_DC_I2C_EN (1 << 8) +# define AVIVO_DC_I2C_PIN_SELECT(x) ((x) << 16) +# define AVIVO_SEL_DDC1 0 +# define AVIVO_SEL_DDC2 1 +# define AVIVO_SEL_DDC3 2 +#define AVIVO_DC_I2C_CONTROL2 0x7d3c +# define AVIVO_DC_I2C_ADDR_COUNT(x) ((x) << 0) +# define AVIVO_DC_I2C_DATA_COUNT(x) ((x) << 8) +#define AVIVO_DC_I2C_CONTROL3 0x7d40 +# define AVIVO_DC_I2C_DATA_DRIVE_EN (1 << 0) +# define AVIVO_DC_I2C_DATA_DRIVE_SEL (1 << 1) +# define AVIVO_DC_I2C_CLK_DRIVE_EN (1 << 7) +# define AVIVO_DC_I2C_RD_INTRA_BYTE_DELAY(x) ((x) << 8) +# define AVIVO_DC_I2C_WR_INTRA_BYTE_DELAY(x) ((x) << 16) +# define AVIVO_DC_I2C_TIME_LIMIT(x) ((x) << 24) +#define AVIVO_DC_I2C_DATA 0x7d44 +#define AVIVO_DC_I2C_INTERRUPT_CONTROL 0x7d48 +# define AVIVO_DC_I2C_INTERRUPT_STATUS (1 << 0) +# define AVIVO_DC_I2C_INTERRUPT_AK (1 << 8) +# define AVIVO_DC_I2C_INTERRUPT_ENABLE (1 << 16) +#define AVIVO_DC_I2C_ARBITRATION 0x7d50 +# define AVIVO_DC_I2C_SW_WANTS_TO_USE_I2C (1 << 0) +# define AVIVO_DC_I2C_SW_CAN_USE_I2C (1 << 1) +# define AVIVO_DC_I2C_SW_DONE_USING_I2C (1 << 8) +# define AVIVO_DC_I2C_HW_NEEDS_I2C (1 << 9) +# define AVIVO_DC_I2C_ABORT_HDCP_I2C (1 << 16) +# define AVIVO_DC_I2C_HW_USING_I2C (1 << 17) + +#define AVIVO_DC_GPIO_DDC1_MASK 0x7e40 +#define AVIVO_DC_GPIO_DDC1_A 0x7e44 +#define AVIVO_DC_GPIO_DDC1_EN 0x7e48 +#define AVIVO_DC_GPIO_DDC1_Y 0x7e4c + +#define AVIVO_DC_GPIO_DDC2_MASK 0x7e50 +#define AVIVO_DC_GPIO_DDC2_A 0x7e54 +#define AVIVO_DC_GPIO_DDC2_EN 0x7e58 +#define AVIVO_DC_GPIO_DDC2_Y 0x7e5c + +#define AVIVO_DC_GPIO_DDC3_MASK 0x7e60 +#define AVIVO_DC_GPIO_DDC3_A 0x7e64 +#define AVIVO_DC_GPIO_DDC3_EN 0x7e68 +#define AVIVO_DC_GPIO_DDC3_Y 0x7e6c + +#define AVIVO_DISP_INTERRUPT_STATUS 0x7edc +# define AVIVO_D1_VBLANK_INTERRUPT (1 << 4) +# define AVIVO_D2_VBLANK_INTERRUPT (1 << 5) + +#endif diff --git a/headers/private/graphics/radeon_hd/r600_reg.h b/headers/private/graphics/radeon_hd/r600_reg.h index 92c1f59211..adbb61c09b 100644 --- a/headers/private/graphics/radeon_hd/r600_reg.h +++ b/headers/private/graphics/radeon_hd/r600_reg.h @@ -1,8 +1,7 @@ /* - * RadeonHD R6xx, R7xx Register documentation - * - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * Copyright (C) 2008-2009 Matthias Hopf + * Copyright 2008 Advanced Micro Devices, Inc. + * Copyright 2008 Red Hat Inc. + * Copyright 2009 Jerome Glisse. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -11,155 +10,197 @@ * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: Dave Airlie + * Alex Deucher + * Jerome Glisse */ +#ifndef __R600_REG_H__ +#define __R600_REG_H__ -#ifndef _R600_REG_H_ -#define _R600_REG_H_ - -/* - * Register definitions - */ #include "r600_reg_auto_r6xx.h" #include "r600_reg_r6xx.h" #include "r600_reg_r7xx.h" -/* From Linux DRM Radeon driver for AtomBIOS */ -#define RADEON_SEPROM_CNTL1 0x01c0 -#define RADEON_SCK_PRESCALE_SHIFT 24 -#define RADEON_SCK_PRESCALE_MASK (0xff << 24) +#define R600_PCIE_PORT_INDEX 0x0038 +#define R600_PCIE_PORT_DATA 0x003c -#define RADEON_VIPH_CONTROL 0x0c40 -#define RADEON_VIPH_EN (1 << 21) +#define R600_MC_VM_FB_LOCATION 0x2180 +#define R600_MC_FB_BASE_MASK 0x0000FFFF +#define R600_MC_FB_BASE_SHIFT 0 +#define R600_MC_FB_TOP_MASK 0xFFFF0000 +#define R600_MC_FB_TOP_SHIFT 16 +#define R600_MC_VM_AGP_TOP 0x2184 +#define R600_MC_AGP_TOP_MASK 0x0003FFFF +#define R600_MC_AGP_TOP_SHIFT 0 +#define R600_MC_VM_AGP_BOT 0x2188 +#define R600_MC_AGP_BOT_MASK 0x0003FFFF +#define R600_MC_AGP_BOT_SHIFT 0 +#define R600_MC_VM_AGP_BASE 0x218c +#define R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2190 +#define R600_LOGICAL_PAGE_NUMBER_MASK 0x000FFFFF +#define R600_LOGICAL_PAGE_NUMBER_SHIFT 0 +#define R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2194 +#define R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x2198 -#define RADEON_GPIOPAD_MASK 0x0198 -#define RADEON_GPIOPAD_A 0x019c -#define RADEON_GPIOPAD_EN 0x01a0 -#define RADEON_GPIOPAD_Y 0x01a4 -#define RADEON_MDGPIO_MASK 0x01a8 -#define RADEON_MDGPIO_A 0x01ac -#define RADEON_MDGPIO_EN 0x01b0 -#define RADEON_MDGPIO_Y 0x01b4 +#define R700_MC_VM_FB_LOCATION 0x2024 +#define R700_MC_FB_BASE_MASK 0x0000FFFF +#define R700_MC_FB_BASE_SHIFT 0 +#define R700_MC_FB_TOP_MASK 0xFFFF0000 +#define R700_MC_FB_TOP_SHIFT 16 +#define R700_MC_VM_AGP_TOP 0x2028 +#define R700_MC_AGP_TOP_MASK 0x0003FFFF +#define R700_MC_AGP_TOP_SHIFT 0 +#define R700_MC_VM_AGP_BOT 0x202c +#define R700_MC_AGP_BOT_MASK 0x0003FFFF +#define R700_MC_AGP_BOT_SHIFT 0 +#define R700_MC_VM_AGP_BASE 0x2030 +#define R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034 +#define R700_LOGICAL_PAGE_NUMBER_MASK 0x000FFFFF +#define R700_LOGICAL_PAGE_NUMBER_SHIFT 0 +#define R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038 +#define R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203c -#define RV370_BUS_CNTL 0x004c - -#define R600_CG_SPLL_FUNC_CNTL 0x600 -#define R600_CG_SPLL_STATUS 0x60c -#define R600_ROM_CNTL 0x1600 -#define R600_BUS_CNTL 0x5420 - -#define R600_BIOS_ROM_DIS (1 << 1) -#define R600_SCK_OVERWRITE (1 << 1) -#define R600_SPLL_CHG_STATUS (1 << 1) -#define R600_SPLL_BYPASS_EN (1 << 3) -#define DVGA_CONTROL_MODE_ENABLE (1 << 0) -#define DVGA_CONTROL_TIMING_SELECT (1 << 8) -#define VGA_VSTATUS_CNTL_MASK (3 << 16) +#define R600_RAMCFG 0x2408 +# define R600_CHANSIZE (1 << 7) +# define R600_CHANSIZE_OVERRIDE (1 << 10) -/* SET_*_REG offsets + ends */ -enum { - SET_CONFIG_REG_offset = 0x00008000, - SET_CONFIG_REG_end = 0x0000ac00, - SET_CONTEXT_REG_offset = 0x00028000, - SET_CONTEXT_REG_end = 0x00029000, - SET_ALU_CONST_offset = 0x00030000, - SET_ALU_CONST_end = 0x00032000, - SET_RESOURCE_offset = 0x00038000, - SET_RESOURCE_end = 0x0003c000, - SET_SAMPLER_offset = 0x0003c000, - SET_SAMPLER_end = 0x0003cff0, - SET_CTL_CONST_offset = 0x0003cff0, - SET_CTL_CONST_end = 0x0003e200, - SET_LOOP_CONST_offset = 0x0003e200, - SET_LOOP_CONST_end = 0x0003e380, - SET_BOOL_CONST_offset = 0x0003e380, - SET_BOOL_CONST_end = 0x0003e38c -}; +#define R600_GENERAL_PWRMGT 0x618 +# define R600_OPEN_DRAIN_PADS (1 << 11) -/* packet3 IT_SURFACE_BASE_UPDATE bits */ -enum { - DEPTH_BASE = (1 << 0), - COLOR0_BASE = (1 << 1), - COLOR1_BASE = (1 << 2), - COLOR2_BASE = (1 << 3), - COLOR3_BASE = (1 << 4), - COLOR4_BASE = (1 << 5), - COLOR5_BASE = (1 << 6), - COLOR6_BASE = (1 << 7), - COLOR7_BASE = (1 << 8), - STRMOUT_BASE0 = (1 << 9), - STRMOUT_BASE1 = (1 << 10), - STRMOUT_BASE2 = (1 << 11), - STRMOUT_BASE3 = (1 << 12), - COHER_BASE0 = (1 << 13), - COHER_BASE1 = (1 << 14) -}; +#define R600_LOWER_GPIO_ENABLE 0x710 +#define R600_CTXSW_VID_LOWER_GPIO_CNTL 0x718 +#define R600_HIGH_VID_LOWER_GPIO_CNTL 0x71c +#define R600_MEDIUM_VID_LOWER_GPIO_CNTL 0x720 +#define R600_LOW_VID_LOWER_GPIO_CNTL 0x724 -/* packet3 IT_WAIT_REG_MEM operation encoding */ -enum { - WAIT_ALWAYS = (0<<0), - WAIT_LT = (1<<0), - WAIT_LE = (2<<0), - WAIT_EQ = (3<<0), - WAIT_NE = (4<<0), - WAIT_GE = (5<<0), - WAIT_GT = (6<<0), +#define R600_D1GRPH_SWAP_CONTROL 0x610C +# define R600_D1GRPH_SWAP_ENDIAN_NONE (0 << 0) +# define R600_D1GRPH_SWAP_ENDIAN_16BIT (1 << 0) +# define R600_D1GRPH_SWAP_ENDIAN_32BIT (2 << 0) +# define R600_D1GRPH_SWAP_ENDIAN_64BIT (3 << 0) - WAIT_REG = (0<<4), - WAIT_MEM = (1<<4) -}; +#define R600_HDP_NONSURFACE_BASE 0x2c04 -/* Packet3 commands */ -enum { - IT_NOP = 0x10, - IT_INDIRECT_BUFFER_END = 0x17, - IT_SET_PREDICATION = 0x20, - IT_REG_RMW = 0x21, - IT_COND_EXEC = 0x22, - IT_PRED_EXEC = 0x23, - IT_START_3D_CMDBUF = 0x24, - IT_DRAW_INDEX_2 = 0x27, - IT_CONTEXT_CONTROL = 0x28, - IT_DRAW_INDEX_IMMD_BE = 0x29, - IT_INDEX_TYPE = 0x2A, - IT_DRAW_INDEX = 0x2B, - IT_DRAW_INDEX_AUTO = 0x2D, - IT_DRAW_INDEX_IMMD = 0x2E, - IT_NUM_INSTANCES = 0x2F, - IT_STRMOUT_BUFFER_UPDATE = 0x34, - IT_INDIRECT_BUFFER_MP = 0x38, - IT_MEM_SEMAPHORE = 0x39, - IT_MPEG_INDEX = 0x3A, - IT_WAIT_REG_MEM = 0x3C, - IT_MEM_WRITE = 0x3D, - IT_INDIRECT_BUFFER = 0x32, - IT_CP_INTERRUPT = 0x40, - IT_SURFACE_SYNC = 0x43, - IT_ME_INITIALIZE = 0x44, - IT_COND_WRITE = 0x45, - IT_EVENT_WRITE = 0x46, - IT_EVENT_WRITE_EOP = 0x47, - IT_ONE_REG_WRITE = 0x57, - IT_SET_CONFIG_REG = 0x68, - IT_SET_CONTEXT_REG = 0x69, - IT_SET_ALU_CONST = 0x6A, - IT_SET_BOOL_CONST = 0x6B, - IT_SET_LOOP_CONST = 0x6C, - IT_SET_RESOURCE = 0x6D, - IT_SET_SAMPLER = 0x6E, - IT_SET_CTL_CONST = 0x6F, - IT_SURFACE_BASE_UPDATE = 0x73 -}; +#define R600_BUS_CNTL 0x5420 +# define R600_BIOS_ROM_DIS (1 << 1) +#define R600_CONFIG_CNTL 0x5424 +#define R600_CONFIG_MEMSIZE 0x5428 +#define R600_CONFIG_F0_BASE 0x542C +#define R600_CONFIG_APER_SIZE 0x5430 + +#define R600_ROM_CNTL 0x1600 +# define R600_SCK_OVERWRITE (1 << 1) +# define R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT 28 +# define R600_SCK_PRESCALE_CRYSTAL_CLK_MASK (0xf << 28) + +#define R600_CG_SPLL_FUNC_CNTL 0x600 +# define R600_SPLL_BYPASS_EN (1 << 3) +#define R600_CG_SPLL_STATUS 0x60c +# define R600_SPLL_CHG_STATUS (1 << 1) + +#define R600_BIOS_0_SCRATCH 0x1724 +#define R600_BIOS_1_SCRATCH 0x1728 +#define R600_BIOS_2_SCRATCH 0x172c +#define R600_BIOS_3_SCRATCH 0x1730 +#define R600_BIOS_4_SCRATCH 0x1734 +#define R600_BIOS_5_SCRATCH 0x1738 +#define R600_BIOS_6_SCRATCH 0x173c +#define R600_BIOS_7_SCRATCH 0x1740 + +/* Audio, these regs were reverse enginered, + * so the chance is high that the naming is wrong + * R6xx+ ??? */ + +/* Audio clocks */ +#define R600_AUDIO_PLL1_MUL 0x0514 +#define R600_AUDIO_PLL1_DIV 0x0518 +#define R600_AUDIO_PLL2_MUL 0x0524 +#define R600_AUDIO_PLL2_DIV 0x0528 +#define R600_AUDIO_CLK_SRCSEL 0x0534 + +/* Audio general */ +#define R600_AUDIO_ENABLE 0x7300 +#define R600_AUDIO_TIMING 0x7344 + +/* Audio params */ +#define R600_AUDIO_VENDOR_ID 0x7380 +#define R600_AUDIO_REVISION_ID 0x7384 +#define R600_AUDIO_ROOT_NODE_COUNT 0x7388 +#define R600_AUDIO_NID1_NODE_COUNT 0x738c +#define R600_AUDIO_NID1_TYPE 0x7390 +#define R600_AUDIO_SUPPORTED_SIZE_RATE 0x7394 +#define R600_AUDIO_SUPPORTED_CODEC 0x7398 +#define R600_AUDIO_SUPPORTED_POWER_STATES 0x739c +#define R600_AUDIO_NID2_CAPS 0x73a0 +#define R600_AUDIO_NID3_CAPS 0x73a4 +#define R600_AUDIO_NID3_PIN_CAPS 0x73a8 + +/* Audio conn list */ +#define R600_AUDIO_CONN_LIST_LEN 0x73ac +#define R600_AUDIO_CONN_LIST 0x73b0 + +/* Audio verbs */ +#define R600_AUDIO_RATE_BPS_CHANNEL 0x73c0 +#define R600_AUDIO_PLAYING 0x73c4 +#define R600_AUDIO_IMPLEMENTATION_ID 0x73c8 +#define R600_AUDIO_CONFIG_DEFAULT 0x73cc +#define R600_AUDIO_PIN_SENSE 0x73d0 +#define R600_AUDIO_PIN_WIDGET_CNTL 0x73d4 +#define R600_AUDIO_STATUS_BITS 0x73d8 + +/* HDMI base register addresses */ +#define R600_HDMI_BLOCK1 0x7400 +#define R600_HDMI_BLOCK2 0x7700 +#define R600_HDMI_BLOCK3 0x7800 + +/* HDMI registers */ +#define R600_HDMI_ENABLE 0x00 +#define R600_HDMI_STATUS 0x04 +# define R600_HDMI_INT_PENDING (1 << 29) +#define R600_HDMI_CNTL 0x08 +# define R600_HDMI_INT_EN (1 << 28) +# define R600_HDMI_INT_ACK (1 << 29) +#define R600_HDMI_UNKNOWN_0 0x0C +#define R600_HDMI_AUDIOCNTL 0x10 +#define R600_HDMI_VIDEOCNTL 0x14 +#define R600_HDMI_VERSION 0x18 +#define R600_HDMI_UNKNOWN_1 0x28 +#define R600_HDMI_VIDEOINFOFRAME_0 0x54 +#define R600_HDMI_VIDEOINFOFRAME_1 0x58 +#define R600_HDMI_VIDEOINFOFRAME_2 0x5c +#define R600_HDMI_VIDEOINFOFRAME_3 0x60 +#define R600_HDMI_32kHz_CTS 0xac +#define R600_HDMI_32kHz_N 0xb0 +#define R600_HDMI_44_1kHz_CTS 0xb4 +#define R600_HDMI_44_1kHz_N 0xb8 +#define R600_HDMI_48kHz_CTS 0xbc +#define R600_HDMI_48kHz_N 0xc0 +#define R600_HDMI_AUDIOINFOFRAME_0 0xcc +#define R600_HDMI_AUDIOINFOFRAME_1 0xd0 +#define R600_HDMI_IEC60958_1 0xd4 +#define R600_HDMI_IEC60958_2 0xd8 +#define R600_HDMI_UNKNOWN_2 0xdc +#define R600_HDMI_AUDIO_DEBUG_0 0xe0 +#define R600_HDMI_AUDIO_DEBUG_1 0xe4 +#define R600_HDMI_AUDIO_DEBUG_2 0xe8 +#define R600_HDMI_AUDIO_DEBUG_3 0xec + +/* HDMI additional config base register addresses */ +#define R600_HDMI_CONFIG1 0x7600 +#define R600_HDMI_CONFIG2 0x7a00 #endif diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 856595e3a8..5d2b37d35d 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -13,6 +13,7 @@ #include "lock.h" #include "rhd_regs.h" +#include "r500_reg.h" #include "r600_reg.h" #include "r800_reg.h" @@ -71,10 +72,10 @@ struct radeon_shared_info { area_id mode_list_area; // area containing display mode list uint32 mode_count; + bool has_rom; // was rom mapped? uint32 rom_phys; // rom base location - area_id rom_area; // area of mapped rom uint32 rom_size; // rom size - uint8* rom; // virtual memory mapped PCI ROM + uint8* rom; // cloned, memory mapped PCI ROM display_mode current_mode; uint32 bytes_per_row; @@ -212,6 +213,39 @@ struct radeon_free_graphics_memory { #define DISPLAY_CONTROL_RGB16 (5UL << 26) #define DISPLAY_CONTROL_RGB32 (6UL << 26) +/* VIP bus */ +#define RADEON_VIPH_CH0_DATA 0x0c00 +#define RADEON_VIPH_CH1_DATA 0x0c04 +#define RADEON_VIPH_CH2_DATA 0x0c08 +#define RADEON_VIPH_CH3_DATA 0x0c0c +#define RADEON_VIPH_CH0_ADDR 0x0c10 +#define RADEON_VIPH_CH1_ADDR 0x0c14 +#define RADEON_VIPH_CH2_ADDR 0x0c18 +#define RADEON_VIPH_CH3_ADDR 0x0c1c +#define RADEON_VIPH_CH0_SBCNT 0x0c20 +#define RADEON_VIPH_CH1_SBCNT 0x0c24 +#define RADEON_VIPH_CH2_SBCNT 0x0c28 +#define RADEON_VIPH_CH3_SBCNT 0x0c2c +#define RADEON_VIPH_CH0_ABCNT 0x0c30 +#define RADEON_VIPH_CH1_ABCNT 0x0c34 +#define RADEON_VIPH_CH2_ABCNT 0x0c38 +#define RADEON_VIPH_CH3_ABCNT 0x0c3c +#define RADEON_VIPH_CONTROL 0x0c40 +# define RADEON_VIP_BUSY 0 +# define RADEON_VIP_IDLE 1 +# define RADEON_VIP_RESET 2 +# define RADEON_VIPH_EN (1 << 21) +#define RADEON_VIPH_DV_LAT 0x0c44 +#define RADEON_VIPH_BM_CHUNK 0x0c48 +#define RADEON_VIPH_DV_INT 0x0c4c +#define RADEON_VIPH_TIMEOUT_STAT 0x0c50 +#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REG_STAT 0x00000010 +#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REG_AK 0x00000010 +#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REGR_DIS 0x01000000 + +#define RADEON_VIPH_REG_DATA 0x0084 +#define RADEON_VIPH_REG_ADDR 0x0080 + // PCI bridge memory management // overlay diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index db0be6034c..ea1c0678fe 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -41,7 +41,6 @@ struct accelerant_info *gInfo; display_info *gDisplay[MAX_DISPLAY]; -void *gAtomBIOS; class AreaCloner { @@ -157,26 +156,8 @@ init_common(int device, bool isClone) return status; } - AreaCloner romCloner; - gInfo->rom_area = romCloner.Clone("radeon hd rom", - (void **)&gInfo->rom, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, - gInfo->shared_info->rom_area); - status = romCloner.InitCheck(); - if (status < B_OK) { - free(gInfo); - TRACE("%s, failed to create rom area\n", __func__); - return status; - } - sharedCloner.Keep(); regsCloner.Keep(); - romCloner.Keep(); - - gAtomBIOS = (void*)malloc(gInfo->shared_info->rom_size); - - if (gAtomBIOS == NULL) { - TRACE("%s, failed to malloc AtomBIOS pointer of holding\n", __func__); - } // Define Radeon PLL default ranges gInfo->shared_info->pll_info.reference_frequency @@ -195,7 +176,6 @@ uninit_common(void) if (gInfo != NULL) { delete_area(gInfo->regs_area); delete_area(gInfo->shared_info_area); - delete_area(gInfo->rom_area); gInfo->regs_area = gInfo->shared_info_area = -1; @@ -206,8 +186,6 @@ uninit_common(void) free(gInfo); } - free(gAtomBIOS); - for (uint32 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id] != NULL) { free(gDisplay[id]->regs); @@ -235,7 +213,7 @@ radeon_init_accelerant(int device) init_lock(&info.accelerant_lock, "radeon hd accelerant"); init_lock(&info.engine_lock, "radeon hd engine"); - radeon_init_bios(gAtomBIOS); + radeon_init_bios(info.rom); status = detect_displays(); //if (status != B_OK) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 0c8ffaf25e..de48d610a2 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -36,9 +36,6 @@ struct accelerant_info { display_mode *mode_list; // cloned list of standard display modes area_id mode_list_area; - uint8 *rom; - area_id rom_area; - edid1_info edid_info; bool has_edid; @@ -116,7 +113,7 @@ typedef struct { extern accelerant_info *gInfo; -extern void *gAtomBIOS; +//extern void *gAtomBIOS; extern atom_context *gAtomContext; extern display_info *gDisplay[MAX_DISPLAY]; diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 591fd10498..ac43694f19 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -29,215 +29,15 @@ atom_context *gAtomContext; status_t -bios_read_enabled(void* bios, size_t size) -{ - status_t result = B_ERROR; - if (gInfo->rom[0] == 0x55 && gInfo->rom[1] == 0xaa) { - TRACE("%s: found AtomBIOS signature!\n", __func__); - bios = gInfo->rom; - result = B_OK; - } else - TRACE("%s: didn't find valid AtomBIOS\n", __func__); - - return result; -} - - -status_t -bios_read_disabled_northern(void* bios, size_t size) -{ - uint32 bus_cntl = Read32(OUT, R600_BUS_CNTL); - uint32 d1vga_control = Read32(OUT, D1VGA_CONTROL); - uint32 d2vga_control = Read32(OUT, D2VGA_CONTROL); - uint32 vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); - uint32 rom_cntl = Read32(OUT, R600_ROM_CNTL); - - // Enable rom access - Write32(OUT, R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); - // Disable VGA mode - Write32(OUT, D1VGA_CONTROL, (d1vga_control - & ~(DVGA_CONTROL_MODE_ENABLE - | DVGA_CONTROL_TIMING_SELECT))); - Write32(OUT, D2VGA_CONTROL, (d2vga_control - & ~(DVGA_CONTROL_MODE_ENABLE - | DVGA_CONTROL_TIMING_SELECT))); - Write32(OUT, VGA_RENDER_CONTROL, (vga_render_control - & ~VGA_VSTATUS_CNTL_MASK)); - Write32(OUT, R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); - - snooze(2); - - status_t result = B_ERROR; - if (gInfo->rom[0] == 0x55 && gInfo->rom[1] == 0xaa) { - TRACE("%s: found AtomBIOS signature!\n", __func__); - memcpy(&bios, gInfo->rom, size); - // grab it while we can - result = B_OK; - } else - TRACE("%s: didn't find valid AtomBIOS\n", __func__); - - // restore regs - Write32(OUT, R600_BUS_CNTL, bus_cntl); - Write32(OUT, D1VGA_CONTROL, d1vga_control); - Write32(OUT, D2VGA_CONTROL, d2vga_control); - Write32(OUT, VGA_RENDER_CONTROL, vga_render_control); - Write32(OUT, R600_ROM_CNTL, rom_cntl); - - return result; -} - - -status_t -bios_read_disabled_avivo(void* bios, size_t size) -{ - uint32 seprom_cntl1 = Read32(OUT, RADEON_SEPROM_CNTL1); - uint32 viph_control = Read32(OUT, RADEON_VIPH_CONTROL); - uint32 bus_cntl = Read32(OUT, RV370_BUS_CNTL); - uint32 d1vga_control = Read32(OUT, D1VGA_CONTROL); - uint32 d2vga_control = Read32(OUT, D2VGA_CONTROL); - uint32 vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); - uint32 gpiopad_a = Read32(OUT, RADEON_GPIOPAD_A); - uint32 gpiopad_en = Read32(OUT, RADEON_GPIOPAD_EN); - uint32 gpiopad_mask = Read32(OUT, RADEON_GPIOPAD_MASK); - - Write32(OUT, RADEON_SEPROM_CNTL1, ((seprom_cntl1 & - ~RADEON_SCK_PRESCALE_MASK) | (0xc << RADEON_SCK_PRESCALE_SHIFT))); - Write32(OUT, RADEON_GPIOPAD_A, 0); - Write32(OUT, RADEON_GPIOPAD_EN, 0); - Write32(OUT, RADEON_GPIOPAD_MASK, 0); - - // Disable VIP - Write32(OUT, RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); - // Disable VGA mode - Write32(OUT, D1VGA_CONTROL, (d1vga_control - & ~(DVGA_CONTROL_MODE_ENABLE - | DVGA_CONTROL_TIMING_SELECT))); - Write32(OUT, D2VGA_CONTROL, (d2vga_control - & ~(DVGA_CONTROL_MODE_ENABLE - | DVGA_CONTROL_TIMING_SELECT))); - Write32(OUT, VGA_RENDER_CONTROL, (vga_render_control - & ~VGA_VSTATUS_CNTL_MASK)); - - snooze(2); - - status_t result = B_ERROR; - if (gInfo->rom[0] == 0x55 && gInfo->rom[1] == 0xaa) { - TRACE("%s: found AtomBIOS signature!\n", __func__); - memcpy(&bios, gInfo->rom, size); - // grab it while we can - result = B_OK; - } else - TRACE("%s: didn't find valid AtomBIOS\n", __func__); - - /* restore regs */ - Write32(OUT, RADEON_SEPROM_CNTL1, seprom_cntl1); - Write32(OUT, RADEON_VIPH_CONTROL, viph_control); - Write32(OUT, RV370_BUS_CNTL, bus_cntl); - Write32(OUT, D1VGA_CONTROL, d1vga_control); - Write32(OUT, D2VGA_CONTROL, d2vga_control); - Write32(OUT, VGA_RENDER_CONTROL, vga_render_control); - Write32(OUT, RADEON_GPIOPAD_A, gpiopad_a); - Write32(OUT, RADEON_GPIOPAD_EN, gpiopad_en); - Write32(OUT, RADEON_GPIOPAD_MASK, gpiopad_mask); - - - return result; -} - - -status_t -bios_read_disabled_r700(void* bios, size_t size) -{ - uint32 viph_control = Read32(OUT, RADEON_VIPH_CONTROL); - uint32 bus_cntl = Read32(OUT, R600_BUS_CNTL); - uint32 d1vga_control = Read32(OUT, D1VGA_CONTROL); - uint32 d2vga_control = Read32(OUT, D2VGA_CONTROL); - uint32 vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); - uint32 rom_cntl = Read32(OUT, R600_ROM_CNTL); - - // Disable VIP - Write32(OUT, RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); - // Enable rom access - Write32(OUT, R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); - // Disable VGA mode - Write32(OUT, D1VGA_CONTROL, (d1vga_control - & ~(DVGA_CONTROL_MODE_ENABLE - | DVGA_CONTROL_TIMING_SELECT))); - Write32(OUT, D2VGA_CONTROL, (d2vga_control - & ~(DVGA_CONTROL_MODE_ENABLE - | DVGA_CONTROL_TIMING_SELECT))); - Write32(OUT, VGA_RENDER_CONTROL, (vga_render_control - & ~VGA_VSTATUS_CNTL_MASK)); - - uint32 cg_spll_func_cntl = 0; - radeon_shared_info &info = *gInfo->shared_info; - if (info.device_chipset == (RADEON_R700 | 0x30)) { - cg_spll_func_cntl = Read32(OUT, R600_CG_SPLL_FUNC_CNTL); - - // Enable bypass mode - Write32(OUT, R600_CG_SPLL_FUNC_CNTL, cg_spll_func_cntl - | R600_SPLL_BYPASS_EN); - - // wait for SPLL_CHG_STATUS to change to 1 - uint32 cg_spll_status = 0; - while (!(cg_spll_status & R600_SPLL_CHG_STATUS)) - cg_spll_status = Read32(OUT, R600_CG_SPLL_STATUS); - - Write32(OUT, R600_ROM_CNTL, (rom_cntl & ~R600_SCK_OVERWRITE)); - } else - Write32(OUT, R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); - - snooze(2); - - status_t result = B_ERROR; - if (gInfo->rom[0] == 0x55 && gInfo->rom[1] == 0xaa) { - TRACE("%s: found AtomBIOS signature!\n", __func__); - memcpy(&bios, gInfo->rom, size); - // grab it while we can - result = B_OK; - } else - TRACE("%s: didn't find valid AtomBIOS\n", __func__); - - // restore regs - if (info.device_chipset == (RADEON_R700 | 0x30)) { - Write32(OUT, R600_CG_SPLL_FUNC_CNTL, cg_spll_func_cntl); - - // wait for SPLL_CHG_STATUS to change to 1 - uint32 cg_spll_status = 0; - while (!(cg_spll_status & R600_SPLL_CHG_STATUS)) - cg_spll_status = Read32(OUT, R600_CG_SPLL_STATUS); - } - Write32(OUT, RADEON_VIPH_CONTROL, viph_control); - Write32(OUT, R600_BUS_CNTL, bus_cntl); - Write32(OUT, D1VGA_CONTROL, d1vga_control); - Write32(OUT, D2VGA_CONTROL, d2vga_control); - Write32(OUT, VGA_RENDER_CONTROL, vga_render_control); - Write32(OUT, R600_ROM_CNTL, rom_cntl); - - return result; -} - - -status_t -radeon_init_bios(void* bios) +radeon_init_bios(uint8* bios) { radeon_shared_info &info = *gInfo->shared_info; - status_t bios_status; - if (bios_read_enabled(bios, info.rom_size) != B_OK) { - if (info.device_chipset > RADEON_R800) // TODO : >= BARTS - bios_status = bios_read_disabled_northern(bios, info.rom_size); - else if (info.device_chipset >= (RADEON_R700 | 0x70)) - bios_status = bios_read_disabled_r700(bios, info.rom_size); - else if (info.device_chipset >= RADEON_R600) - bios_status = bios_read_disabled_avivo(bios, info.rom_size); - else - bios_status = B_ERROR; + if (info.has_rom == false) { + TRACE("%s: called even though has_rom == false\n", __func__); + return B_ERROR; } - if (bios_status != B_OK) - return bios_status; - struct card_info *atom_card_info = (card_info*)malloc(sizeof(card_info)); @@ -262,7 +62,7 @@ radeon_init_bios(void* bios) atom_card_info->pll_write = _write32; // Point AtomBIOS parser to card bios and malloc gAtomContext - gAtomContext = atom_parse(atom_card_info, bios); + gAtomContext = atom_parse(atom_card_info, &bios); if (gAtomContext == NULL) { TRACE("%s: couldn't parse system AtomBIOS\n", __func__); diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index e29d462eaf..7b9263dca9 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -14,7 +14,7 @@ #include "atom.h" -status_t radeon_init_bios(void* bios); +status_t radeon_init_bios(uint8* bios); #endif /* RADEON_HD_BIOS_H */ diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 21471f9ae9..5e8da2361a 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -5,6 +5,7 @@ * Authors: * Axel Dörfler, axeld@pinc-software.de * Clemens Zeidler, haiku@clemens-zeidler.de + * Fredrik Holmqvis, fredrik.holmqvist@gmail.com * Alexander von Gluck, kallisti5@unixzen.com */ @@ -41,6 +42,159 @@ #define RHD_MMIO_BAR 2 +status_t +radeon_hd_getbios(radeon_info &info) +{ + TRACE("card(%ld): %s: called\n", info.id, __func__); + + uint32 backuprom = get_pci_config(info.pci, PCI_rom_base, 4); + set_pci_config(info.pci, PCI_rom_base, 4, 0xffffffff); + + uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); + if (flags & 1) + dprintf(DEVICE_NAME ": PCI ROM Disabled\n"); + if (flags & 2) + dprintf(DEVICE_NAME ": PCI ROM Shadowed\n"); + if (flags & 4) + dprintf(DEVICE_NAME ": PCI ROM Copied\n"); + if (flags & 8) + dprintf(DEVICE_NAME ": PCI ROM BIOS copied\n"); + + uint32 rom_base = info.pci->u.h0.rom_base; + uint32 rom_size = info.pci->u.h0.rom_size; + + if (rom_base == 0) { + TRACE("%s: no PCI rom, trying shadow rom\n", __func__); + // ROM has been copied by BIOS + rom_base = 0xC0000; + if (rom_size == 0) { + rom_size = 0x7FFF; + // Maximum shadow bios size + // TODO : This is a guess at best + } + } + + uint8* bios; + status_t result = B_ERROR; + + if (rom_base == 0 || rom_size == 0) { + TRACE("%s: no VGA rom located, disabling AtomBIOS\n", __func__); + result = B_ERROR; + } else { + area_id rom_area = map_physical_memory("radeon hd rom", + rom_base, rom_size, B_ANY_KERNEL_ADDRESS, B_READ_AREA, + (void **)&bios); + + if (info.rom_area < B_OK) { + dprintf(DEVICE_NAME ": failed to map rom\n"); + result = B_ERROR;; + } else + result = B_OK; + + if (result == B_OK && (bios[0] != 0x55 || bios[1] != 0xAA)) { + uint16 id = bios[0] + (bios[1] << 8); + dprintf(DEVICE_NAME ": not a PCI rom (%X)!\n", id); + result = B_OK; + } else { + info.shared_info->rom = (uint8*)malloc(rom_size); + if (info.shared_info->rom == NULL) { + dprintf(DEVICE_NAME ": failed to clone atombios!\n"); + result = B_ERROR; + } else { + memcpy(info.shared_info->rom, (void *)bios, rom_size); + result = B_OK; + } + } + delete_area(rom_area); + } + set_pci_config(info.pci, PCI_rom_base, 4, backuprom); + + info.shared_info->rom_phys = rom_base; + info.shared_info->rom_size = rom_size; + + return result; +} + + +status_t +radeon_hd_getbios_r600(radeon_info &info) +{ + TRACE("card(%ld): %s: called\n", info.id, __func__); + uint32 viph_control = read32(info.registers + RADEON_VIPH_CONTROL); + uint32 bus_cntl = read32(info.registers + R600_BUS_CNTL); + uint32 d1vga_control = read32(info.registers + AVIVO_D1VGA_CONTROL); + uint32 d2vga_control = read32(info.registers + AVIVO_D2VGA_CONTROL); + uint32 vga_render_control + = read32(info.registers + AVIVO_VGA_RENDER_CONTROL); + uint32 rom_cntl = read32(info.registers + R600_ROM_CNTL); + uint32 general_pwrmgt = read32(info.registers + R600_GENERAL_PWRMGT); + uint32 low_vid_lower_gpio_cntl + = read32(info.registers + R600_LOW_VID_LOWER_GPIO_CNTL); + uint32 medium_vid_lower_gpio_cntl + = read32(info.registers + R600_MEDIUM_VID_LOWER_GPIO_CNTL); + uint32 high_vid_lower_gpio_cntl + = read32(info.registers + R600_HIGH_VID_LOWER_GPIO_CNTL); + uint32 ctxsw_vid_lower_gpio_cntl + = read32(info.registers + R600_CTXSW_VID_LOWER_GPIO_CNTL); + uint32 lower_gpio_enable + = read32(info.registers + R600_LOWER_GPIO_ENABLE); + + // disable VIP + write32(info.registers + RADEON_VIPH_CONTROL, + (viph_control & ~RADEON_VIPH_EN)); + // enable the rom + write32(info.registers + R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); + // disable VGA mode + write32(info.registers + AVIVO_D1VGA_CONTROL, (d1vga_control + & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE + | AVIVO_DVGA_CONTROL_TIMING_SELECT))); + write32(info.registers + D2VGA_CONTROL, (d2vga_control + & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE + | AVIVO_DVGA_CONTROL_TIMING_SELECT))); + write32(info.registers + AVIVO_VGA_RENDER_CONTROL, + (vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK)); + + write32(info.registers + R600_ROM_CNTL, + ((rom_cntl & ~R600_SCK_PRESCALE_CRYSTAL_CLK_MASK) + | (1 << R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT) | R600_SCK_OVERWRITE)); + + write32(info.registers + R600_GENERAL_PWRMGT, + (general_pwrmgt & ~R600_OPEN_DRAIN_PADS)); + write32(info.registers + R600_LOW_VID_LOWER_GPIO_CNTL, + (low_vid_lower_gpio_cntl & ~0x400)); + write32(info.registers + R600_MEDIUM_VID_LOWER_GPIO_CNTL, + (medium_vid_lower_gpio_cntl & ~0x400)); + write32(info.registers + R600_HIGH_VID_LOWER_GPIO_CNTL, + (high_vid_lower_gpio_cntl & ~0x400)); + write32(info.registers + R600_CTXSW_VID_LOWER_GPIO_CNTL, + (ctxsw_vid_lower_gpio_cntl & ~0x400)); + write32(info.registers + R600_LOWER_GPIO_ENABLE, + (lower_gpio_enable | 0x400)); + + status_t result = radeon_hd_getbios_r600(info); + + // restore regs + write32(info.registers + RADEON_VIPH_CONTROL, viph_control); + write32(info.registers + R600_BUS_CNTL, bus_cntl); + write32(info.registers + AVIVO_D1VGA_CONTROL, d1vga_control); + write32(info.registers + AVIVO_D2VGA_CONTROL, d2vga_control); + write32(info.registers + AVIVO_VGA_RENDER_CONTROL, vga_render_control); + write32(info.registers + R600_ROM_CNTL, rom_cntl); + write32(info.registers + R600_GENERAL_PWRMGT, general_pwrmgt); + write32(info.registers + R600_LOW_VID_LOWER_GPIO_CNTL, + low_vid_lower_gpio_cntl); + write32(info.registers + R600_MEDIUM_VID_LOWER_GPIO_CNTL, + medium_vid_lower_gpio_cntl); + write32(info.registers + R600_HIGH_VID_LOWER_GPIO_CNTL, + high_vid_lower_gpio_cntl); + write32(info.registers + R600_CTXSW_VID_LOWER_GPIO_CNTL, + ctxsw_vid_lower_gpio_cntl); + write32(info.registers + R600_LOWER_GPIO_ENABLE, lower_gpio_enable); + + return result; +} + + status_t radeon_hd_init(radeon_info &info) { @@ -85,17 +239,7 @@ radeon_hd_init(radeon_info &info) } // *** VGA rom / AtomBIOS mapping - AreaKeeper romMapper; - info.rom_area = romMapper.Map("radeon hd rom", - (void *)info.pci->u.h0.rom_base, - info.pci->u.h0.rom_size, - B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, - (void **)&info.shared_info->rom); - if (romMapper.InitCheck() < B_OK) { - dprintf(DEVICE_NAME ": card(%ld): could not map VGA rom!\n", - info.id); - return info.rom_area; - } + status_t foundRom = radeon_hd_getbios(info); // Turn on write combining for the area vm_set_area_memory_type(info.framebuffer_area, @@ -104,7 +248,6 @@ radeon_hd_init(radeon_info &info) sharedCreator.Detach(); mmioMapper.Detach(); frambufferMapper.Detach(); - romMapper.Detach(); // Pass common information to accelerant info.shared_info->device_id = info.device_id; @@ -115,10 +258,11 @@ radeon_hd_init(radeon_info &info) = info.pci->u.h0.base_registers[RHD_FB_BAR]; info.shared_info->frame_buffer_int = read32(info.registers + R6XX_CONFIG_FB_BASE); - info.shared_info->rom_area = info.rom_area; - info.shared_info->rom_phys = info.pci->u.h0.rom_base; - info.shared_info->rom_size = info.pci->u.h0.rom_size; + // populate VGA rom info into shared_info + info.shared_info->has_rom = (foundRom == B_OK) ? true : false; + + // Copy device name into shared_info strcpy(info.shared_info->device_identifier, info.device_identifier); // Pull active monitor VESA EDID from boot loader From cd4c994bdff96b2a5bee49fe20945a62d47d53e9 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 3 Aug 2011 20:36:41 +0000 Subject: [PATCH 105/702] * define PCI add-on rom flags that are normally defined in PCI header files. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42555 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/PCI.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/headers/os/drivers/PCI.h b/headers/os/drivers/PCI.h index 98a1dc90aa..adccd60ab4 100644 --- a/headers/os/drivers/PCI.h +++ b/headers/os/drivers/PCI.h @@ -640,7 +640,10 @@ struct pci_module_info { masks for flags in expansion rom base address registers --- */ -#define PCI_rom_enable 0x00000001 /* 1 = expansion rom decode enabled */ +#define PCI_rom_enable 0x00000001 /* 1 expansion rom decode enabled */ +#define PCI_rom_shadow 0x00000010 /* 2 rom copied at shadow (C0000) */ +#define PCI_rom_copy 0x00000100 /* 4 rom is allocated copy */ +#define PCI_rom_bios 0x00001000 /* 8 rom is bios copy */ #define PCI_rom_address_mask 0xFFFFF800 /* mask to get expansion rom addr */ /** PCI interrupt pin values */ From 77a64ff2c8b16e3762c37b97de5ad019d1035eb1 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 3 Aug 2011 20:46:26 +0000 Subject: [PATCH 106/702] * use new PCI.h rom flags * clean up tracing * remove infinite loop :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42556 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 5e8da2361a..b53bbbd0b4 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -51,14 +51,14 @@ radeon_hd_getbios(radeon_info &info) set_pci_config(info.pci, PCI_rom_base, 4, 0xffffffff); uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); - if (flags & 1) - dprintf(DEVICE_NAME ": PCI ROM Disabled\n"); - if (flags & 2) - dprintf(DEVICE_NAME ": PCI ROM Shadowed\n"); - if (flags & 4) - dprintf(DEVICE_NAME ": PCI ROM Copied\n"); - if (flags & 8) - dprintf(DEVICE_NAME ": PCI ROM BIOS copied\n"); + if (flags & PCI_rom_enable) + dprintf(DEVICE_NAME ": PCI ROM decode enabled\n"); + if (flags & PCI_rom_shadow) + dprintf(DEVICE_NAME ": PCI ROM shadowed\n"); + if (flags & PCI_rom_copy) + dprintf(DEVICE_NAME ": PCI ROM allocated copy\n"); + if (flags & PCI_rom_bios) + dprintf(DEVICE_NAME ": PCI ROM BIOS copy\n"); uint32 rom_base = info.pci->u.h0.rom_base; uint32 rom_size = info.pci->u.h0.rom_size; @@ -74,6 +74,9 @@ radeon_hd_getbios(radeon_info &info) } } + TRACE("%s: seeking rom at 0x%" B_PRIX32 " [size: 0x%" B_PRIX32 "]\n", + __func__, rom_base, rom_size); + uint8* bios; status_t result = B_ERROR; @@ -87,7 +90,7 @@ radeon_hd_getbios(radeon_info &info) if (info.rom_area < B_OK) { dprintf(DEVICE_NAME ": failed to map rom\n"); - result = B_ERROR;; + result = B_ERROR; } else result = B_OK; @@ -107,6 +110,7 @@ radeon_hd_getbios(radeon_info &info) } delete_area(rom_area); } + set_pci_config(info.pci, PCI_rom_base, 4, backuprom); info.shared_info->rom_phys = rom_base; @@ -171,7 +175,7 @@ radeon_hd_getbios_r600(radeon_info &info) write32(info.registers + R600_LOWER_GPIO_ENABLE, (lower_gpio_enable | 0x400)); - status_t result = radeon_hd_getbios_r600(info); + status_t result = radeon_hd_getbios(info); // restore regs write32(info.registers + RADEON_VIPH_CONTROL, viph_control); @@ -239,7 +243,7 @@ radeon_hd_init(radeon_info &info) } // *** VGA rom / AtomBIOS mapping - status_t foundRom = radeon_hd_getbios(info); + status_t foundRom = radeon_hd_getbios_r600(info); // Turn on write combining for the area vm_set_area_memory_type(info.framebuffer_area, From b0b4ce7e95ebdc39e772920cb3df2996506b5334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 3 Aug 2011 20:48:23 +0000 Subject: [PATCH 107/702] Patch from X512 (#7408): only send input method aware messages for active windows git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42557 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index ad8db8133b..77b7b00e5c 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1082,11 +1082,13 @@ FrameMoved(origin); // we notify the input server if we are gaining or losing focus // from a view which has the B_INPUT_METHOD_AWARE on a window - // (de)activation + // activation + if (!active) + break; bool inputMethodAware = false; if (fFocus) inputMethodAware = fFocus->Flags() & B_INPUT_METHOD_AWARE; - BMessage msg(active && inputMethodAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW); + BMessage msg(inputMethodAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW); BMessenger messenger(fFocus); BMessage reply; if (fFocus) From c3cfda776dc7716056b393999bf104d6a10b6c84 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 3 Aug 2011 21:42:28 +0000 Subject: [PATCH 108/702] * don't trample PCI rom config * better error checking * the driver can now locate the AtomBIOS on real hw! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42558 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 52 +++++++++++++------ .../graphics/radeon_hd/radeon_hd_private.h | 6 +++ 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index b53bbbd0b4..ecb852c224 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -42,13 +42,25 @@ #define RHD_MMIO_BAR 2 +inline bool +isAtomBIOS(uint8* bios) +{ + uint16 bios_header = RADEON_BIOS16(bios, 0x48); + + return !memcmp(&bios[bios_header + 4], "ATOM", 4) || + !memcmp(&bios[bios_header + 4], "MOTA", 4); +} + + status_t radeon_hd_getbios(radeon_info &info) { TRACE("card(%ld): %s: called\n", info.id, __func__); - uint32 backuprom = get_pci_config(info.pci, PCI_rom_base, 4); - set_pci_config(info.pci, PCI_rom_base, 4, 0xffffffff); + // Enable ROM decoding + uint32 rom_config = get_pci_config(info.pci, PCI_rom_base, 4); + rom_config |= PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, rom_config); uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); if (flags & PCI_rom_enable) @@ -91,27 +103,35 @@ radeon_hd_getbios(radeon_info &info) if (info.rom_area < B_OK) { dprintf(DEVICE_NAME ": failed to map rom\n"); result = B_ERROR; - } else - result = B_OK; - - if (result == B_OK && (bios[0] != 0x55 || bios[1] != 0xAA)) { - uint16 id = bios[0] + (bios[1] << 8); - dprintf(DEVICE_NAME ": not a PCI rom (%X)!\n", id); - result = B_OK; } else { - info.shared_info->rom = (uint8*)malloc(rom_size); - if (info.shared_info->rom == NULL) { - dprintf(DEVICE_NAME ": failed to clone atombios!\n"); + if (bios[0] != 0x55 || bios[1] != 0xAA) { + uint16 id = bios[0] + (bios[1] << 8); + dprintf(DEVICE_NAME ": not a PCI rom (%X)!\n", id); result = B_ERROR; } else { - memcpy(info.shared_info->rom, (void *)bios, rom_size); - result = B_OK; + TRACE("%s: found a valid VGA bios!\n", __func__); + info.shared_info->rom = (uint8*)malloc(rom_size); + if (info.shared_info->rom == NULL) { + dprintf(DEVICE_NAME ": failed to clone atombios!\n"); + result = B_ERROR; + } else { + memcpy(info.shared_info->rom, (void *)bios, rom_size); + if (isAtomBIOS(info.shared_info->rom)) { + dprintf(DEVICE_NAME ": AtomBIOS found and mapped!\n"); + result = B_OK; + } else { + dprintf(DEVICE_NAME ": AtomBIOS not mapped!\n"); + result = B_ERROR; + } + } } + delete_area(rom_area); } - delete_area(rom_area); } - set_pci_config(info.pci, PCI_rom_base, 4, backuprom); + // Disable ROM decoding + rom_config &= ~PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, rom_config); info.shared_info->rom_phys = rom_base; info.shared_info->rom_size = rom_size; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index c7ab7316dd..96b1e10816 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -19,6 +19,12 @@ #include "lock.h" +#define RADEON_BIOS8(adr, v) (adr[v]) +#define RADEON_BIOS16(adr, v) ((adr[v]) | (adr[(v) + 1] << 8)) +#define RADEON_BIOS32(adr, v) \ + ((RADEON_BIOS16(adr, v) | RADEON_BIOS16(adr, v + 2) << 16)) + + struct radeon_info { int32 open_count; status_t init_status; From fae1d2ab8162a6284bbd8ef75f168af7b8f01cbd Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Wed, 3 Aug 2011 22:25:04 +0000 Subject: [PATCH 109/702] Adding a sample on how to add a gfx driver, which is a driver and an accelerant. Makes a good example imo. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42559 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/UserBuildConfig.sample | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/jam/UserBuildConfig.sample b/build/jam/UserBuildConfig.sample index ba88a5915b..60203e1af9 100644 --- a/build/jam/UserBuildConfig.sample +++ b/build/jam/UserBuildConfig.sample @@ -30,3 +30,8 @@ # Don't add the libraries built with the alternative gcc version. #HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 0 ; + +# Add an optional gfx driver and its accelerant. +# (Drivers just have a special rule because of the need for the symlink in dev/) +AddDriversToHaikuImage graphics : optional_driver ; +AddFilesToHaikuImage system add-ons accelerants : optional_driver.accelerant ; From 3f98c1831c538d84e71cb38ec4e89d19e735d02d Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 3 Aug 2011 23:23:16 +0000 Subject: [PATCH 110/702] * create area for AtomBIOS * clone mapped AtomBIOS area into accelerant git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42560 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 1 + .../accelerants/radeon_hd/accelerant.cpp | 13 ++++++++++- .../accelerants/radeon_hd/accelerant.h | 3 +++ .../drivers/graphics/radeon_hd/radeon_hd.cpp | 22 +++++++++++++------ .../graphics/radeon_hd/radeon_hd_private.h | 3 +++ 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 5d2b37d35d..e80063abe2 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -73,6 +73,7 @@ struct radeon_shared_info { uint32 mode_count; bool has_rom; // was rom mapped? + area_id rom_area; // area of mapped rom uint32 rom_phys; // rom base location uint32 rom_size; // rom size uint8* rom; // cloned, memory mapped PCI ROM diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index ea1c0678fe..e61078a3d0 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -156,6 +156,16 @@ init_common(int device, bool isClone) return status; } + gInfo->rom_area = clone_area("radeon hd AtomBIOS", + (void **)&gInfo->rom, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, + gInfo->shared_info->rom_area); + + if (gInfo->rom_area < 0) + TRACE("%s: Clone of AtomBIOS failed!\n", __func__); + + if (gInfo->rom[0] != 0x55 || gInfo->rom[0] != 0xAA) + TRACE("%s: didn't find a VGA bios in cloned region!\n", __func__); + sharedCloner.Keep(); regsCloner.Keep(); @@ -176,6 +186,7 @@ uninit_common(void) if (gInfo != NULL) { delete_area(gInfo->regs_area); delete_area(gInfo->shared_info_area); + delete_area(gInfo->rom_area); gInfo->regs_area = gInfo->shared_info_area = -1; @@ -213,7 +224,7 @@ radeon_init_accelerant(int device) init_lock(&info.accelerant_lock, "radeon hd accelerant"); init_lock(&info.engine_lock, "radeon hd engine"); - radeon_init_bios(info.rom); + radeon_init_bios(gInfo->rom); status = detect_displays(); //if (status != B_OK) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index de48d610a2..c15d2e7a22 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -36,6 +36,9 @@ struct accelerant_info { display_mode *mode_list; // cloned list of standard display modes area_id mode_list_area; + uint8* rom; + area_id rom_area; + edid1_info edid_info; bool has_edid; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index ecb852c224..f78d37dda1 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -110,13 +110,13 @@ radeon_hd_getbios(radeon_info &info) result = B_ERROR; } else { TRACE("%s: found a valid VGA bios!\n", __func__); - info.shared_info->rom = (uint8*)malloc(rom_size); - if (info.shared_info->rom == NULL) { + info.atom_buffer = (uint8*)malloc(rom_size); + if (info.atom_buffer == NULL) { dprintf(DEVICE_NAME ": failed to clone atombios!\n"); result = B_ERROR; } else { - memcpy(info.shared_info->rom, (void *)bios, rom_size); - if (isAtomBIOS(info.shared_info->rom)) { + memcpy(info.atom_buffer, (void *)bios, rom_size); + if (isAtomBIOS(info.atom_buffer)) { dprintf(DEVICE_NAME ": AtomBIOS found and mapped!\n"); result = B_OK; } else { @@ -263,7 +263,15 @@ radeon_hd_init(radeon_info &info) } // *** VGA rom / AtomBIOS mapping - status_t foundRom = radeon_hd_getbios_r600(info); + status_t biosStatus = radeon_hd_getbios_r600(info); + + // *** AtomBIOS mapping + info.rom_area = create_area("radeon hd AtomBIOS", + (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, + info.shared_info->rom_size, B_READ_AREA | B_WRITE_AREA, B_NO_LOCK); + + if (info.rom_area < 0) + dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__); // Turn on write combining for the area vm_set_area_memory_type(info.framebuffer_area, @@ -284,7 +292,8 @@ radeon_hd_init(radeon_info &info) = read32(info.registers + R6XX_CONFIG_FB_BASE); // populate VGA rom info into shared_info - info.shared_info->has_rom = (foundRom == B_OK) ? true : false; + info.shared_info->has_rom = (biosStatus == B_OK) ? true : false; + info.shared_info->rom_area = info.rom_area; // Copy device name into shared_info strcpy(info.shared_info->device_identifier, info.device_identifier); @@ -349,6 +358,5 @@ radeon_hd_uninit(radeon_info &info) delete_area(info.shared_area); delete_area(info.registers_area); delete_area(info.framebuffer_area); - delete_area(info.rom_area); } diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index 96b1e10816..ca1b9b9dca 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -31,6 +31,9 @@ struct radeon_info { int32 id; pci_info* pci; uint8* registers; + + uint8* atom_buffer; // buffer for atombios + area_id registers_area; area_id framebuffer_area; area_id rom_area; From 2168cdbddd20f4986d829cf31e61b92f1a42c242 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 3 Aug 2011 23:26:26 +0000 Subject: [PATCH 111/702] * bug fix, wrong offset git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42561 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index e61078a3d0..3e2e55b67c 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -163,7 +163,7 @@ init_common(int device, bool isClone) if (gInfo->rom_area < 0) TRACE("%s: Clone of AtomBIOS failed!\n", __func__); - if (gInfo->rom[0] != 0x55 || gInfo->rom[0] != 0xAA) + if (gInfo->rom[0] != 0x55 || gInfo->rom[1] != 0xAA) TRACE("%s: didn't find a VGA bios in cloned region!\n", __func__); sharedCloner.Keep(); From 360ac869d337c7481d89de602ff307d784ef193b Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Wed, 3 Aug 2011 23:34:01 +0000 Subject: [PATCH 112/702] Updated apr to 1.4.5, apr-util to 1.3.12 and subversion to 1.6.17. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42562 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalPackages | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 3f190a78e3..3ba751acce 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -115,13 +115,13 @@ if [ IsOptionalHaikuImagePackageAdded APR ] { Echo "No optional package APR available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - apr-1.4.2-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/apr-1.4.2-r1a3-x86-gcc4-2011-05-24.zip + apr-1.4.5-x86-gcc4-2011-08-03.zip + : $(baseURL)/apr-1.4.5-x86-gcc4-2011-08-03.zip : : true ; } else { InstallOptionalHaikuImagePackage - apr-1.4.2-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/apr-1.4.2-r1a3-x86-gcc2-2011-05-17.zip + apr-1.4.5-x86-gcc2-2011-08-02.zip + : $(baseURL)/apr-1.4.5-x86-gcc2-2011-08-02.zip : : true ; } } @@ -133,13 +133,13 @@ if [ IsOptionalHaikuImagePackageAdded APR-util ] { Echo "No optional package APR-util available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - apr-util-1.3.10-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/apr-util-1.3.10-r1a3-x86-gcc4-2011-05-24.zip + apr-util-1.3.12-x86-gcc4-2011-08-03.zip + : $(baseURL)/apr-util-1.3.12-x86-gcc4-2011-08-03.zip : : true ; } else { InstallOptionalHaikuImagePackage - apr-util-1.3.10-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/apr-util-1.3.10-r1a3-x86-gcc2-2011-05-17.zip + apr-util-1.3.12-x86-gcc2-2011-08-02.zip + : $(baseURL)/apr-util-1.3.12-x86-gcc2-2011-08-02.zip : : true ; } } @@ -1483,13 +1483,13 @@ if [ IsOptionalHaikuImagePackageAdded Subversion ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - subversion-1.6.15-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/subversion-1.6.15-r1a3-x86-gcc4-2011-05-24.zip + subversion-1.6.17-x86-gcc4-2011-08-03.zip + : $(baseURL)/subversion-1.6.17-x86-gcc4-2011-08-03.zip : : true ; } else { InstallOptionalHaikuImagePackage - subversion-1.6.15-r1a3-x86-gcc2-2011-05-20.zip - : $(baseURL)/subversion-1.6.15-r1a3-x86-gcc2-2011-05-20.zip + subversion-1.6.17-x86-gcc2-2011-08-02.zip + : $(baseURL)/subversion-1.6.17-x86-gcc2-2011-08-02.zip : : true ; } } From 01d68c9728b1e931b14ec7bd0d02713f790da2da Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Wed, 3 Aug 2011 23:51:30 +0000 Subject: [PATCH 113/702] Disable S&T debug output and fix typo. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42563 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/stackandtile/StackAndTile.h | 2 +- src/servers/app/stackandtile/Stacking.cpp | 2 +- src/servers/app/stackandtile/Tiling.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/servers/app/stackandtile/StackAndTile.h b/src/servers/app/stackandtile/StackAndTile.h index 7fc77dd042..a6ffe28991 100644 --- a/src/servers/app/stackandtile/StackAndTile.h +++ b/src/servers/app/stackandtile/StackAndTile.h @@ -19,7 +19,7 @@ #include "WindowList.h" -#define DEBUG_STACK_AND_TILE +//#define DEBUG_STACK_AND_TILE #ifdef DEBUG_STACK_AND_TILE # define STRACE_SAT(x...) debug_printf("SAT: "x) diff --git a/src/servers/app/stackandtile/Stacking.cpp b/src/servers/app/stackandtile/Stacking.cpp index dc9ebe13a8..d2e2710ca6 100644 --- a/src/servers/app/stackandtile/Stacking.cpp +++ b/src/servers/app/stackandtile/Stacking.cpp @@ -17,7 +17,7 @@ #include "Window.h" -#define DEBUG_STACKING +//#define DEBUG_STACKING #ifdef DEBUG_STACKING # define STRACE_STACKING(x...) debug_printf("SAT Stacking: "x) diff --git a/src/servers/app/stackandtile/Tiling.cpp b/src/servers/app/stackandtile/Tiling.cpp index 57b1c2d703..c26bd37ea4 100644 --- a/src/servers/app/stackandtile/Tiling.cpp +++ b/src/servers/app/stackandtile/Tiling.cpp @@ -17,9 +17,9 @@ using namespace std; -//#define DEBUG_TILEING +//#define DEBUG_TILING -#ifdef DEBUG_TILEING +#ifdef DEBUG_TILING # define STRACE_TILING(x...) debug_printf("SAT Tiling: "x) #else # define STRACE_TILING(x...) ; From f0b0d6cb37165d71817c17d35329adb266420ba2 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 4 Aug 2011 03:55:01 +0000 Subject: [PATCH 114/702] * use create_area correctly * AtomBIOS is now loaded and passed into the radeon_hd accelerant * correct pointer passing in bios_init * AtomBIOS is now read and initialized by AtomBIOS parser * feel free to start testing the driver again :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42564 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 4 +- .../accelerants/radeon_hd/accelerant.cpp | 4 +- src/add-ons/accelerants/radeon_hd/bios.cpp | 2 +- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 78 +++++++++---------- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 081ce99546..f647e13889 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -119,7 +119,7 @@ SYSTEM_ADD_ONS_ACCELERANTS = $(X86_ONLY)radeon.accelerant $(X86_ONLY)s3.accelerant $(X86_ONLY)vesa.accelerant $(X86_ONLY)ati.accelerant $(X86_ONLY)3dfx.accelerant - #$(X86_ONLY)radeon_hd.accelerant + $(X86_ONLY)radeon_hd.accelerant #$(X86_ONLY)via.accelerant #$(X86_ONLY)vmware.accelerant ; @@ -165,7 +165,7 @@ SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia usb_audio ; SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware - $(X86_ONLY)ati $(X86_ONLY)3dfx #$(X86_ONLY)radeon_hd + $(X86_ONLY)ati $(X86_ONLY)3dfx $(X86_ONLY)radeon_hd ; SYSTEM_ADD_ONS_DRIVERS_MIDI = emuxki usb_midi ; SYSTEM_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)atheros813x diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 3e2e55b67c..35c2d25fee 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -160,8 +160,10 @@ init_common(int device, bool isClone) (void **)&gInfo->rom, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, gInfo->shared_info->rom_area); - if (gInfo->rom_area < 0) + if (gInfo->rom_area < 0) { TRACE("%s: Clone of AtomBIOS failed!\n", __func__); + gInfo->shared_info->has_rom = false; + } if (gInfo->rom[0] != 0x55 || gInfo->rom[1] != 0xAA) TRACE("%s: didn't find a VGA bios in cloned region!\n", __func__); diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index ac43694f19..20428a33e5 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -62,7 +62,7 @@ radeon_init_bios(uint8* bios) atom_card_info->pll_write = _write32; // Point AtomBIOS parser to card bios and malloc gAtomContext - gAtomContext = atom_parse(atom_card_info, &bios); + gAtomContext = atom_parse(atom_card_info, bios); if (gAtomContext == NULL) { TRACE("%s: couldn't parse system AtomBIOS\n", __func__); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index f78d37dda1..4a0b585a48 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -72,26 +72,14 @@ radeon_hd_getbios(radeon_info &info) if (flags & PCI_rom_bios) dprintf(DEVICE_NAME ": PCI ROM BIOS copy\n"); - uint32 rom_base = info.pci->u.h0.rom_base; - uint32 rom_size = info.pci->u.h0.rom_size; - - if (rom_base == 0) { - TRACE("%s: no PCI rom, trying shadow rom\n", __func__); - // ROM has been copied by BIOS - rom_base = 0xC0000; - if (rom_size == 0) { - rom_size = 0x7FFF; - // Maximum shadow bios size - // TODO : This is a guess at best - } - } + uint32 rom_base = info.shared_info->rom_phys; + uint32 rom_size = info.shared_info->rom_size; TRACE("%s: seeking rom at 0x%" B_PRIX32 " [size: 0x%" B_PRIX32 "]\n", __func__, rom_base, rom_size); uint8* bios; status_t result = B_ERROR; - if (rom_base == 0 || rom_size == 0) { TRACE("%s: no VGA rom located, disabling AtomBIOS\n", __func__); result = B_ERROR; @@ -110,19 +98,13 @@ radeon_hd_getbios(radeon_info &info) result = B_ERROR; } else { TRACE("%s: found a valid VGA bios!\n", __func__); - info.atom_buffer = (uint8*)malloc(rom_size); - if (info.atom_buffer == NULL) { - dprintf(DEVICE_NAME ": failed to clone atombios!\n"); - result = B_ERROR; + memcpy(info.atom_buffer, (void *)bios, rom_size); + if (isAtomBIOS(info.atom_buffer)) { + dprintf(DEVICE_NAME ": AtomBIOS found and mapped!\n"); + result = B_OK; } else { - memcpy(info.atom_buffer, (void *)bios, rom_size); - if (isAtomBIOS(info.atom_buffer)) { - dprintf(DEVICE_NAME ": AtomBIOS found and mapped!\n"); - result = B_OK; - } else { - dprintf(DEVICE_NAME ": AtomBIOS not mapped!\n"); - result = B_ERROR; - } + dprintf(DEVICE_NAME ": AtomBIOS not mapped!\n"); + result = B_ERROR; } } delete_area(rom_area); @@ -133,9 +115,6 @@ radeon_hd_getbios(radeon_info &info) rom_config &= ~PCI_rom_enable; set_pci_config(info.pci, PCI_rom_base, 4, rom_config); - info.shared_info->rom_phys = rom_base; - info.shared_info->rom_size = rom_size; - return result; } @@ -262,17 +241,6 @@ radeon_hd_init(radeon_info &info) return info.framebuffer_area; } - // *** VGA rom / AtomBIOS mapping - status_t biosStatus = radeon_hd_getbios_r600(info); - - // *** AtomBIOS mapping - info.rom_area = create_area("radeon hd AtomBIOS", - (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, - info.shared_info->rom_size, B_READ_AREA | B_WRITE_AREA, B_NO_LOCK); - - if (info.rom_area < 0) - dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__); - // Turn on write combining for the area vm_set_area_memory_type(info.framebuffer_area, info.pci->u.h0.base_registers[RHD_FB_BAR], B_MTR_WC); @@ -281,6 +249,35 @@ radeon_hd_init(radeon_info &info) mmioMapper.Detach(); frambufferMapper.Detach(); + // *** AtomBIOS mapping + uint32 rom_base = info.pci->u.h0.rom_base; + uint32 rom_size = info.pci->u.h0.rom_size; + if (rom_base == 0) { + TRACE("%s: no PCI rom, trying shadow rom\n", __func__); + // ROM has been copied by BIOS + rom_base = 0xC0000; + if (rom_size == 0) { + rom_size = 0x7FFF; + // A guess at maximum shadow bios size + } + } + info.shared_info->rom_phys = rom_base; + info.shared_info->rom_size = rom_size; + + info.rom_area = create_area("radeon hd AtomBIOS", + (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, + info.shared_info->rom_size, B_FULL_LOCK, + B_READ_AREA | B_WRITE_AREA); + + status_t biosStatus = B_ERROR; + if (info.rom_area < 0) { + dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__); + biosStatus = B_ERROR; + } else { + //memset(&info.atom_buffer, 0, info.shared_info->rom_size); + biosStatus = radeon_hd_getbios_r600(info); + } + // Pass common information to accelerant info.shared_info->device_id = info.device_id; info.shared_info->device_chipset = info.device_chipset; @@ -358,5 +355,6 @@ radeon_hd_uninit(radeon_info &info) delete_area(info.shared_area); delete_area(info.registers_area); delete_area(info.framebuffer_area); + delete_area(info.rom_area); } From 1c623886b31921a3ef7f74c665ed5acab4a47a2f Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 4 Aug 2011 03:56:54 +0000 Subject: [PATCH 115/702] * undo accidental change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42565 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index f647e13889..081ce99546 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -119,7 +119,7 @@ SYSTEM_ADD_ONS_ACCELERANTS = $(X86_ONLY)radeon.accelerant $(X86_ONLY)s3.accelerant $(X86_ONLY)vesa.accelerant $(X86_ONLY)ati.accelerant $(X86_ONLY)3dfx.accelerant - $(X86_ONLY)radeon_hd.accelerant + #$(X86_ONLY)radeon_hd.accelerant #$(X86_ONLY)via.accelerant #$(X86_ONLY)vmware.accelerant ; @@ -165,7 +165,7 @@ SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia usb_audio ; SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware - $(X86_ONLY)ati $(X86_ONLY)3dfx $(X86_ONLY)radeon_hd + $(X86_ONLY)ati $(X86_ONLY)3dfx #$(X86_ONLY)radeon_hd ; SYSTEM_ADD_ONS_DRIVERS_MIDI = emuxki usb_midi ; SYSTEM_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)atheros813x From 94e15508ec107c204e994b1ed9898cc597114acb Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 4 Aug 2011 04:57:42 +0000 Subject: [PATCH 116/702] * clean up style * remove some un-needed log messages * memset area from create_area just incase * add enabled bios read in addition to disabled one git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42566 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 76 ++++++++++--------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 4a0b585a48..0999126cf7 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -64,13 +64,7 @@ radeon_hd_getbios(radeon_info &info) uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); if (flags & PCI_rom_enable) - dprintf(DEVICE_NAME ": PCI ROM decode enabled\n"); - if (flags & PCI_rom_shadow) - dprintf(DEVICE_NAME ": PCI ROM shadowed\n"); - if (flags & PCI_rom_copy) - dprintf(DEVICE_NAME ": PCI ROM allocated copy\n"); - if (flags & PCI_rom_bios) - dprintf(DEVICE_NAME ": PCI ROM BIOS copy\n"); + TRACE("%s: PCI ROM decode enabled successfully\n", __func__); uint32 rom_base = info.shared_info->rom_phys; uint32 rom_size = info.shared_info->rom_size; @@ -94,16 +88,17 @@ radeon_hd_getbios(radeon_info &info) } else { if (bios[0] != 0x55 || bios[1] != 0xAA) { uint16 id = bios[0] + (bios[1] << 8); - dprintf(DEVICE_NAME ": not a PCI rom (%X)!\n", id); + TRACE("%s: this isn't a PCI rom (%X)\n", __func__, id); result = B_ERROR; } else { - TRACE("%s: found a valid VGA bios!\n", __func__); memcpy(info.atom_buffer, (void *)bios, rom_size); if (isAtomBIOS(info.atom_buffer)) { - dprintf(DEVICE_NAME ": AtomBIOS found and mapped!\n"); + dprintf(DEVICE_NAME ": %s: AtomBIOS found and mapped!\n", + __func__); result = B_OK; } else { - dprintf(DEVICE_NAME ": AtomBIOS not mapped!\n"); + dprintf(DEVICE_NAME ": %s: AtomBIOS not mapped!\n", + __func__); result = B_ERROR; } } @@ -209,13 +204,14 @@ radeon_hd_init(radeon_info &info) (void **)&info.shared_info, B_ANY_KERNEL_ADDRESS, ROUND_TO_PAGE_SIZE(sizeof(radeon_shared_info)), B_FULL_LOCK, 0); if (info.shared_area < B_OK) { + dprintf(DEVICE_NAME ": card (%ld): couldn't map shared area!\n", + info.id); return info.shared_area; } memset((void *)info.shared_info, 0, sizeof(radeon_shared_info)); // *** Map Memory mapped IO - // R6xx_R7xx_3D.pdf, 5.3.3.1 SET_CONFIG_REG AreaKeeper mmioMapper; info.registers_area = mmioMapper.Map("radeon hd mmio", (void *)info.pci->u.h0.base_registers[RHD_MMIO_BAR], @@ -223,7 +219,7 @@ radeon_hd_init(radeon_info &info) B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void **)&info.registers); if (mmioMapper.InitCheck() < B_OK) { - dprintf(DEVICE_NAME ": card (%ld): could not map memory I/O!\n", + dprintf(DEVICE_NAME ": card (%ld): couldn't map memory I/O!\n", info.id); return info.registers_area; } @@ -236,12 +232,12 @@ radeon_hd_init(radeon_info &info) B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, (void **)&info.shared_info->frame_buffer); if (frambufferMapper.InitCheck() < B_OK) { - dprintf(DEVICE_NAME ": card(%ld): could not map framebuffer!\n", + dprintf(DEVICE_NAME ": card(%ld): couldn't map framebuffer!\n", info.id); return info.framebuffer_area; } - // Turn on write combining for the area + // Turn on write combining for the frame buffer area vm_set_area_memory_type(info.framebuffer_area, info.pci->u.h0.base_registers[RHD_FB_BAR], B_MTR_WC); @@ -249,6 +245,18 @@ radeon_hd_init(radeon_info &info) mmioMapper.Detach(); frambufferMapper.Detach(); + // Pass common information to accelerant + info.shared_info->device_id = info.device_id; + info.shared_info->device_chipset = info.device_chipset; + info.shared_info->registers_area = info.registers_area; + strcpy(info.shared_info->device_identifier, info.device_identifier); + + info.shared_info->frame_buffer_area = info.framebuffer_area; + info.shared_info->frame_buffer_phys + = info.pci->u.h0.base_registers[RHD_FB_BAR]; + info.shared_info->frame_buffer_int + = read32(info.registers + R6XX_CONFIG_FB_BASE); + // *** AtomBIOS mapping uint32 rom_base = info.pci->u.h0.rom_base; uint32 rom_size = info.pci->u.h0.rom_size; @@ -272,44 +280,38 @@ radeon_hd_init(radeon_info &info) status_t biosStatus = B_ERROR; if (info.rom_area < 0) { dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__); + dprintf(DEVICE_NAME ": card(%ld): couldn't map kernel AtomBIOS area!\n", + info.id); biosStatus = B_ERROR; } else { - //memset(&info.atom_buffer, 0, info.shared_info->rom_size); - biosStatus = radeon_hd_getbios_r600(info); + memset((void*)info.atom_buffer, 0, info.shared_info->rom_size); + // First we try an active bios read + biosStatus = radeon_hd_getbios(info); + if (biosStatus != B_OK) { + // If the active read fails, we do a disabled read + if (info.device_chipset > RADEON_R600) + biosStatus = radeon_hd_getbios_r600(info); + } } - - // Pass common information to accelerant - info.shared_info->device_id = info.device_id; - info.shared_info->device_chipset = info.device_chipset; - info.shared_info->registers_area = info.registers_area; - info.shared_info->frame_buffer_area = info.framebuffer_area; - info.shared_info->frame_buffer_phys - = info.pci->u.h0.base_registers[RHD_FB_BAR]; - info.shared_info->frame_buffer_int - = read32(info.registers + R6XX_CONFIG_FB_BASE); - - // populate VGA rom info into shared_info info.shared_info->has_rom = (biosStatus == B_OK) ? true : false; info.shared_info->rom_area = info.rom_area; - // Copy device name into shared_info - strcpy(info.shared_info->device_identifier, info.device_identifier); + // *** Pull active monitor VESA EDID from boot loader + edid1_info* edidInfo + = (edid1_info*)get_boot_item(EDID_BOOT_INFO, NULL); - // Pull active monitor VESA EDID from boot loader - edid1_info* edidInfo = (edid1_info*)get_boot_item(EDID_BOOT_INFO, - NULL); if (edidInfo != NULL) { - TRACE("card(%ld): %s found BIOS EDID information.\n", info.id, + TRACE("card(%ld): %s found VESA EDID information.\n", info.id, __func__); info.shared_info->has_edid = true; memcpy(&info.shared_info->edid_info, edidInfo, sizeof(edid1_info)); } else { - TRACE("card(%ld): %s didn't find BIOS EDID modes.\n", info.id, + TRACE("card(%ld): %s didn't find VESA EDID modes.\n", info.id, __func__); info.shared_info->has_edid = false; } - // Populate graphics_memory/aperture_size with KB + // *** Populate graphics_memory/aperture_size with KB if (info.shared_info->device_chipset >= RADEON_R800) { // R800+ has memory stored in MB info.shared_info->graphics_memory_size From 57e0263ceb294333a641d49b312b9483bde1bc0b Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Thu, 4 Aug 2011 05:33:00 +0000 Subject: [PATCH 117/702] Don't remove the window if there is only one window in the group. Fixes #7884. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42567 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/stackandtile/StackAndTile.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/servers/app/stackandtile/StackAndTile.cpp b/src/servers/app/stackandtile/StackAndTile.cpp index b4f76d993a..60c6e02b58 100644 --- a/src/servers/app/stackandtile/StackAndTile.cpp +++ b/src/servers/app/stackandtile/StackAndTile.cpp @@ -357,7 +357,8 @@ StackAndTile::WindowHidden(Window* window) SATGroup* group = satWindow->GetGroup(); if (group == NULL) return; - group->RemoveWindow(satWindow); + if (group->CountItems() > 1) + group->RemoveWindow(satWindow); } @@ -418,7 +419,7 @@ void StackAndTile::WindowFeelChanged(Window* window, window_feel feel) { // check if it is still a compatible feel - if (feel != B_NORMAL_WINDOW_FEEL) + if (feel == B_NORMAL_WINDOW_FEEL) return; SATWindow* satWindow = GetSATWindow(window); if (!satWindow) @@ -426,7 +427,8 @@ StackAndTile::WindowFeelChanged(Window* window, window_feel feel) SATGroup* group = satWindow->GetGroup(); if (!group) return; - group->RemoveWindow(satWindow); + if (group->CountItems() > 1) + group->RemoveWindow(satWindow); } From 38a8938d9ff440ee5c68bc54eb815f300de97947 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Thu, 4 Aug 2011 05:53:26 +0000 Subject: [PATCH 118/702] Only redraw visible region. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42568 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index def7a11792..656a683333 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -2113,6 +2113,7 @@ Window::DetachFromWindowStack(bool ownStackNeeded) if (remainingTop != NULL) { dirty.Include(&remainingTop->VisibleRegion()); + dirty.IntersectWith(&remainingTop->VisibleRegion()); fDesktop->RebuildAndRedrawAfterWindowChange(remainingTop, dirty); } return true; From 747d2bb6dccf2702ad3bc4f35268ed16615a1692 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Thu, 4 Aug 2011 05:57:56 +0000 Subject: [PATCH 119/702] Ok, ok if we redrawn the complete visible region anyway we don't have to calculate any dirt. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42569 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 656a683333..89ee819026 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -2089,10 +2089,9 @@ Window::DetachFromWindowStack(bool ownStackNeeded) if (fCurrentStack->RemoveWindow(this) == false) return false; - BRegion dirty; ::Decorator* decorator = fCurrentStack->Decorator(); if (decorator != NULL) { - decorator->RemoveTab(index, &dirty); + decorator->RemoveTab(index); decorator->SetTopTap(fCurrentStack->LayerOrder().CountItems() - 1); } @@ -2102,7 +2101,7 @@ Window::DetachFromWindowStack(bool ownStackNeeded) decorator->SetDrawingEngine(remainingTop->fDrawingEngine); // propagate focus to the decorator remainingTop->SetFocus(remainingTop->IsFocus()); - remainingTop->SetLook(remainingTop->Look(), &dirty); + remainingTop->SetLook(remainingTop->Look(), NULL); } fCurrentStack = NULL; @@ -2112,9 +2111,8 @@ Window::DetachFromWindowStack(bool ownStackNeeded) SetFocus(IsFocus()); if (remainingTop != NULL) { - dirty.Include(&remainingTop->VisibleRegion()); - dirty.IntersectWith(&remainingTop->VisibleRegion()); - fDesktop->RebuildAndRedrawAfterWindowChange(remainingTop, dirty); + fDesktop->RebuildAndRedrawAfterWindowChange(remainingTop, + remainingTop->VisibleRegion()); } return true; } From 5e1a7a929948ece59f519924b1ab7933ad53d135 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 4 Aug 2011 14:57:34 +0000 Subject: [PATCH 120/702] * these examples should really be commented out git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42572 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/UserBuildConfig.sample | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/jam/UserBuildConfig.sample b/build/jam/UserBuildConfig.sample index 60203e1af9..dc7a5b2131 100644 --- a/build/jam/UserBuildConfig.sample +++ b/build/jam/UserBuildConfig.sample @@ -31,7 +31,7 @@ # Don't add the libraries built with the alternative gcc version. #HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 0 ; -# Add an optional gfx driver and its accelerant. +# Add an example optional gfx driver and its accelerant. # (Drivers just have a special rule because of the need for the symlink in dev/) -AddDriversToHaikuImage graphics : optional_driver ; -AddFilesToHaikuImage system add-ons accelerants : optional_driver.accelerant ; +#AddDriversToHaikuImage graphics : optional_driver ; +#AddFilesToHaikuImage system add-ons accelerants : optional_driver.accelerant ; From 7949c8cbe436b8c054d9b9e9d13dc58bb777253e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 4 Aug 2011 15:28:50 +0000 Subject: [PATCH 121/702] * move create_area for kernel AtomBIOS into radeon_hd_getbios * only create_area if we found a valid AtomBIOS * lock down write access to kernel AtomBIOS area after populating * remove locking on kernel AtomBIOS area as it's not needed git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42573 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 110 ++++++++++-------- 1 file changed, 64 insertions(+), 46 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 0999126cf7..fec20e3ec7 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -66,8 +66,18 @@ radeon_hd_getbios(radeon_info &info) if (flags & PCI_rom_enable) TRACE("%s: PCI ROM decode enabled successfully\n", __func__); - uint32 rom_base = info.shared_info->rom_phys; - uint32 rom_size = info.shared_info->rom_size; + uint32 rom_base = info.pci->u.h0.rom_base; + uint32 rom_size = info.pci->u.h0.rom_size; + + if (rom_base == 0) { + TRACE("%s: no PCI rom, trying shadow rom\n", __func__); + // ROM has been copied by BIOS + rom_base = 0xC0000; + if (rom_size == 0) { + rom_size = 0x7FFF; + // A guess at maximum shadow bios size + } + } TRACE("%s: seeking rom at 0x%" B_PRIX32 " [size: 0x%" B_PRIX32 "]\n", __func__, rom_base, rom_size); @@ -75,6 +85,7 @@ radeon_hd_getbios(radeon_info &info) uint8* bios; status_t result = B_ERROR; if (rom_base == 0 || rom_size == 0) { + // FAIL: we never found a base to work off of. TRACE("%s: no VGA rom located, disabling AtomBIOS\n", __func__); result = B_ERROR; } else { @@ -83,26 +94,51 @@ radeon_hd_getbios(radeon_info &info) (void **)&bios); if (info.rom_area < B_OK) { + // FAIL : rom area wasn't mapped for access dprintf(DEVICE_NAME ": failed to map rom\n"); result = B_ERROR; } else { if (bios[0] != 0x55 || bios[1] != 0xAA) { + // FAIL : not a PCI rom uint16 id = bios[0] + (bios[1] << 8); TRACE("%s: this isn't a PCI rom (%X)\n", __func__, id); result = B_ERROR; - } else { - memcpy(info.atom_buffer, (void *)bios, rom_size); - if (isAtomBIOS(info.atom_buffer)) { - dprintf(DEVICE_NAME ": %s: AtomBIOS found and mapped!\n", - __func__); - result = B_OK; - } else { - dprintf(DEVICE_NAME ": %s: AtomBIOS not mapped!\n", - __func__); + } else if (isAtomBIOS(bios)) { + info.rom_area = create_area("radeon hd AtomBIOS", + (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, + rom_size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + + if (info.rom_area < 0) { + // FAIL : couldn't create kernel AtomBIOS area + dprintf(DEVICE_NAME ": %s: Error creating kernel" + " AtomBIOS area!\n", __func__); result = B_ERROR; + } else { + memset((void*)info.atom_buffer, 0, rom_size); + // Prevent unknown code execution by AtomBIOS parser + memcpy(info.atom_buffer, (void *)bios, rom_size); + // Copy AtomBIOS to kernel area + + if (isAtomBIOS(info.atom_buffer)) { + // SUCCESS : bios copied and verified + dprintf(DEVICE_NAME ": %s: AtomBIOS mapped!\n", + __func__); + set_area_protection(info.rom_area, B_READ_AREA); + // Lock it down + result = B_OK; + } else { + // FAIL : bios didn't copy properly for some reason + dprintf(DEVICE_NAME ": %s: AtomBIOS not mapped!\n", + __func__); + result = B_ERROR; + } } + } else { + dprintf(DEVICE_NAME ": %s: PCI rom found wasn't identified" + " as AtomBIOS!\n", __func__); + result = B_ERROR; } - delete_area(rom_area); + delete_area(rom_area); } } @@ -110,6 +146,11 @@ radeon_hd_getbios(radeon_info &info) rom_config &= ~PCI_rom_enable; set_pci_config(info.pci, PCI_rom_base, 4, rom_config); + if (result == B_OK) { + info.shared_info->rom_phys = rom_base; + info.shared_info->rom_size = rom_size; + } + return result; } @@ -258,43 +299,20 @@ radeon_hd_init(radeon_info &info) = read32(info.registers + R6XX_CONFIG_FB_BASE); // *** AtomBIOS mapping - uint32 rom_base = info.pci->u.h0.rom_base; - uint32 rom_size = info.pci->u.h0.rom_size; - if (rom_base == 0) { - TRACE("%s: no PCI rom, trying shadow rom\n", __func__); - // ROM has been copied by BIOS - rom_base = 0xC0000; - if (rom_size == 0) { - rom_size = 0x7FFF; - // A guess at maximum shadow bios size - } - } - info.shared_info->rom_phys = rom_base; - info.shared_info->rom_size = rom_size; - info.rom_area = create_area("radeon hd AtomBIOS", - (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, - info.shared_info->rom_size, B_FULL_LOCK, - B_READ_AREA | B_WRITE_AREA); - - status_t biosStatus = B_ERROR; - if (info.rom_area < 0) { - dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__); - dprintf(DEVICE_NAME ": card(%ld): couldn't map kernel AtomBIOS area!\n", - info.id); - biosStatus = B_ERROR; - } else { - memset((void*)info.atom_buffer, 0, info.shared_info->rom_size); - // First we try an active bios read - biosStatus = radeon_hd_getbios(info); - if (biosStatus != B_OK) { - // If the active read fails, we do a disabled read - if (info.device_chipset > RADEON_R600) - biosStatus = radeon_hd_getbios_r600(info); - } + // First we try an active bios read + status_t biosStatus = radeon_hd_getbios(info); + if (biosStatus != B_OK) { + // If the active read fails, we do a disabled read + if (info.device_chipset > RADEON_R600) + biosStatus = radeon_hd_getbios_r600(info); } + + // TODO : may want to just return B_ERROR if AtomBIOS isn't + // found as we will require it in the future + info.shared_info->has_rom = (biosStatus == B_OK) ? true : false; - info.shared_info->rom_area = info.rom_area; + info.shared_info->rom_area = (biosStatus == B_OK) ? info.rom_area : -1; // *** Pull active monitor VESA EDID from boot loader edid1_info* edidInfo From 77f593de386af0da168b31b2f754280ea64b2679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 4 Aug 2011 17:49:45 +0000 Subject: [PATCH 122/702] Patch from X512 (ticket #7408): Don't notify input server of focus change if window is not active. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42574 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 77b7b00e5c..a14759f81a 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -3200,7 +3200,7 @@ BWindow::_SetFocus(BView* focusView, bool notifyInputServer) // we notify the input server if we are passing focus // from a view which has the B_INPUT_METHOD_AWARE to a one // which does not, or vice-versa - if (notifyInputServer) { + if (notifyInputServer && fActive) { bool inputMethodAware = false; if (focusView) inputMethodAware = focusView->Flags() & B_INPUT_METHOD_AWARE; From 0839540d1e84ff4829960f08c9d3025987a5ca04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 4 Aug 2011 21:52:03 +0000 Subject: [PATCH 123/702] use locking when messing ITD and SITD queues. itd->prev was becoming NULL, thus leading to KDL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42575 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/usb/ehci.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index 209c40fd25..c0fec9e373 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -2243,6 +2243,7 @@ EHCI::LinkDescriptors(ehci_qtd *first, ehci_qtd *last, ehci_qtd *alt) void EHCI::LinkITDescriptors(ehci_itd *itd, ehci_itd **_last) { + LockIsochronous(); ehci_itd *last = *_last; itd->next_phy = last->next_phy; itd->next = NULL; @@ -2250,12 +2251,14 @@ EHCI::LinkITDescriptors(ehci_itd *itd, ehci_itd **_last) last->next = itd; last->next_phy = itd->this_phy; *_last = itd; + UnlockIsochronous(); } void EHCI::LinkSITDescriptors(ehci_sitd *sitd, ehci_sitd **_last) { + LockIsochronous(); ehci_sitd *last = *_last; sitd->next_phy = last->next_phy; sitd->next = NULL; @@ -2263,29 +2266,34 @@ EHCI::LinkSITDescriptors(ehci_sitd *sitd, ehci_sitd **_last) last->next = sitd; last->next_phy = sitd->this_phy; *_last = sitd; + UnlockIsochronous(); } void EHCI::UnlinkITDescriptors(ehci_itd *itd, ehci_itd **last) { + LockIsochronous(); itd->prev->next_phy = itd->next_phy; itd->prev->next = itd->next; if (itd->next != NULL) itd->next->prev = itd->prev; if (itd == *last) *last = itd->prev; + UnlockIsochronous(); } void EHCI::UnlinkSITDescriptors(ehci_sitd *sitd, ehci_sitd **last) { + LockIsochronous(); sitd->prev->next_phy = sitd->next_phy; sitd->prev->next = sitd->next; if (sitd->next != NULL) sitd->next->prev = sitd->prev; if (sitd == *last) *last = sitd->prev; + UnlockIsochronous(); } From ac4853b49f5b0603deda88baeba0bae3eac0d1cd Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Thu, 4 Aug 2011 22:31:42 +0000 Subject: [PATCH 124/702] When removing a window from the stack keep the mouse at the same tab position. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42576 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/stackandtile/SATWindow.cpp | 11 ++++++----- src/servers/app/stackandtile/SATWindow.h | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/servers/app/stackandtile/SATWindow.cpp b/src/servers/app/stackandtile/SATWindow.cpp index 9c84e9fed9..06f5f92f2f 100644 --- a/src/servers/app/stackandtile/SATWindow.cpp +++ b/src/servers/app/stackandtile/SATWindow.cpp @@ -424,6 +424,10 @@ SATWindow::StackWindow(SATWindow* child) void SATWindow::RemovedFromArea(WindowArea* area) { + SATDecorator* decorator = GetDecorator(); + if (decorator != NULL) + fOldTabLocatiom = decorator->TabRect(fWindow->PositionInStack()).left; + fWindow->DetachFromWindowStack(true); for (int i = 0; i < fSATSnappingBehaviourList.CountItems(); i++) fSATSnappingBehaviourList.ItemAt(i)->RemovedFromArea(area); @@ -776,11 +780,8 @@ SATWindow::_RestoreOriginalSize(bool stayBelowMouse) && mousePosition.x <= frame.right + decorator->BorderWidth() +1 && mousePosition.x >= frame.left + decorator->BorderWidth()) { // verify mouse stays on the tab - float deltaX = 0; - if (tabRect.right < mousePosition.x) - deltaX = mousePosition.x - tabRect.right + 20; - else if (tabRect.left > mousePosition.x) - deltaX = mousePosition.x - tabRect.left - 20; + float oldOffset = mousePosition.x - fOldTabLocatiom; + float deltaX = mousePosition.x - (tabRect.left + oldOffset); fDesktop->MoveWindowBy(fWindow, deltaX, 0); } else { // verify mouse stays on the border diff --git a/src/servers/app/stackandtile/SATWindow.h b/src/servers/app/stackandtile/SATWindow.h index 5de5990fc8..bb21fc8251 100644 --- a/src/servers/app/stackandtile/SATWindow.h +++ b/src/servers/app/stackandtile/SATWindow.h @@ -174,6 +174,8 @@ private: float fOriginalHeight; uint64 fId; + + float fOldTabLocatiom; }; From cdb351d4a49f37ad47fbf01a6e44f8541da245d4 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Thu, 4 Aug 2011 22:35:27 +0000 Subject: [PATCH 125/702] When activating a window also bring all windows in the stack to the front layer. I used the ActivateWindow method because there is some magic involved when changing the layer position, utilising this method seems to be a safe way to do it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42577 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 12 +++++++++++- src/servers/app/Desktop.h | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 2cc554f0e0..8c04962bc8 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1036,11 +1036,21 @@ Desktop::SelectWindow(Window* window) of their subset. */ void -Desktop::ActivateWindow(Window* window) +Desktop::ActivateWindow(Window* window, bool activateStack) { STRACE(("ActivateWindow(%p, %s)\n", window, window ? window->Title() : "")); + WindowStack* stack = window->GetWindowStack(); + if (activateStack && stack != NULL) { + for (int32 i = 0; i < stack->CountWindows(); i++) { + Window* win = stack->LayerOrder().ItemAt(i); + if (window == win) + continue; + ActivateWindow(win, false); + } + } + if (window == NULL) { fBack = NULL; fFront = NULL; diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index c3682e9a45..033a50e8a1 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -160,7 +160,8 @@ public: // Window methods void SelectWindow(Window* window); - void ActivateWindow(Window* window); + void ActivateWindow(Window* window, + bool activateStack = true); void SendWindowBehind(Window* window, Window* behindOf = NULL); From d77ff85e1f6c41e9f46253dc63900dd8fef6f500 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 5 Aug 2011 02:37:05 +0000 Subject: [PATCH 126/702] * add required atombios.h from drm driver from linux 3.0 with a few tweaks (we aren't taking ownership of this one.. yikes) * add first AtomBIOS call to test the waters git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42578 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.h | 2 + .../accelerants/radeon_hd/atombios/atombios.h | 7020 +++++++++++++++++ src/add-ons/accelerants/radeon_hd/bios.cpp | 54 +- src/add-ons/accelerants/radeon_hd/bios.h | 1 + src/add-ons/accelerants/radeon_hd/mode.cpp | 9 +- 5 files changed, 7077 insertions(+), 9 deletions(-) create mode 100644 src/add-ons/accelerants/radeon_hd/atombios/atombios.h diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 8a57c45859..34d47279be 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -25,6 +25,8 @@ #define ATOM_H +#include "atombios.h" + #include #include diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atombios.h b/src/add-ons/accelerants/radeon_hd/atombios/atombios.h new file mode 100644 index 0000000000..ccccff3ace --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/atombios/atombios.h @@ -0,0 +1,7020 @@ +/* + * Copyright 2006-2007 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/****************************************************************************/ +/*Portion I: Definitions shared between VBIOS and Driver */ +/****************************************************************************/ + + +#ifndef _ATOMBIOS_H +#define _ATOMBIOS_H + +#define ATOM_VERSION_MAJOR 0x00020000 +#define ATOM_VERSION_MINOR 0x00000002 + +#define ATOM_HEADER_VERSION (ATOM_VERSION_MAJOR | ATOM_VERSION_MINOR) + +#if defined(__POWERPC__) +#define ATOM_BIG_ENDIAN 1 +#else +#define ATOM_BIG_ENDIAN 0 +#endif + +#ifndef ULONG + typedef unsigned long ULONG; +#endif + +#ifndef UCHAR + typedef unsigned char UCHAR; +#endif + +#ifndef USHORT + typedef unsigned short USHORT; +#endif + +#define ATOM_DAC_A 0 +#define ATOM_DAC_B 1 +#define ATOM_EXT_DAC 2 + +#define ATOM_CRTC1 0 +#define ATOM_CRTC2 1 +#define ATOM_CRTC3 2 +#define ATOM_CRTC4 3 +#define ATOM_CRTC5 4 +#define ATOM_CRTC6 5 +#define ATOM_CRTC_INVALID 0xFF + +#define ATOM_DIGA 0 +#define ATOM_DIGB 1 + +#define ATOM_PPLL1 0 +#define ATOM_PPLL2 1 +#define ATOM_DCPLL 2 +#define ATOM_PPLL0 2 +#define ATOM_EXT_PLL1 8 +#define ATOM_EXT_PLL2 9 +#define ATOM_EXT_CLOCK 10 +#define ATOM_PPLL_INVALID 0xFF + +#define ENCODER_REFCLK_SRC_P1PLL 0 +#define ENCODER_REFCLK_SRC_P2PLL 1 +#define ENCODER_REFCLK_SRC_DCPLL 2 +#define ENCODER_REFCLK_SRC_EXTCLK 3 +#define ENCODER_REFCLK_SRC_INVALID 0xFF + +#define ATOM_SCALER1 0 +#define ATOM_SCALER2 1 + +#define ATOM_SCALER_DISABLE 0 +#define ATOM_SCALER_CENTER 1 +#define ATOM_SCALER_EXPANSION 2 +#define ATOM_SCALER_MULTI_EX 3 + +#define ATOM_DISABLE 0 +#define ATOM_ENABLE 1 +#define ATOM_LCD_BLOFF (ATOM_DISABLE+2) +#define ATOM_LCD_BLON (ATOM_ENABLE+2) +#define ATOM_LCD_BL_BRIGHTNESS_CONTROL (ATOM_ENABLE+3) +#define ATOM_LCD_SELFTEST_START (ATOM_DISABLE+5) +#define ATOM_LCD_SELFTEST_STOP (ATOM_ENABLE+5) +#define ATOM_ENCODER_INIT (ATOM_DISABLE+7) +#define ATOM_GET_STATUS (ATOM_DISABLE+8) + +#define ATOM_BLANKING 1 +#define ATOM_BLANKING_OFF 0 + +#define ATOM_CURSOR1 0 +#define ATOM_CURSOR2 1 + +#define ATOM_ICON1 0 +#define ATOM_ICON2 1 + +#define ATOM_CRT1 0 +#define ATOM_CRT2 1 + +#define ATOM_TV_NTSC 1 +#define ATOM_TV_NTSCJ 2 +#define ATOM_TV_PAL 3 +#define ATOM_TV_PALM 4 +#define ATOM_TV_PALCN 5 +#define ATOM_TV_PALN 6 +#define ATOM_TV_PAL60 7 +#define ATOM_TV_SECAM 8 +#define ATOM_TV_CV 16 + +#define ATOM_DAC1_PS2 1 +#define ATOM_DAC1_CV 2 +#define ATOM_DAC1_NTSC 3 +#define ATOM_DAC1_PAL 4 + +#define ATOM_DAC2_PS2 ATOM_DAC1_PS2 +#define ATOM_DAC2_CV ATOM_DAC1_CV +#define ATOM_DAC2_NTSC ATOM_DAC1_NTSC +#define ATOM_DAC2_PAL ATOM_DAC1_PAL + +#define ATOM_PM_ON 0 +#define ATOM_PM_STANDBY 1 +#define ATOM_PM_SUSPEND 2 +#define ATOM_PM_OFF 3 + +/* Bit0:{=0:single, =1:dual}, + Bit1 {=0:666RGB, =1:888RGB}, + Bit2:3:{Grey level} + Bit4:{=0:LDI format for RGB888, =1 FPDI format for RGB888}*/ + +#define ATOM_PANEL_MISC_DUAL 0x00000001 +#define ATOM_PANEL_MISC_888RGB 0x00000002 +#define ATOM_PANEL_MISC_GREY_LEVEL 0x0000000C +#define ATOM_PANEL_MISC_FPDI 0x00000010 +#define ATOM_PANEL_MISC_GREY_LEVEL_SHIFT 2 +#define ATOM_PANEL_MISC_SPATIAL 0x00000020 +#define ATOM_PANEL_MISC_TEMPORAL 0x00000040 +#define ATOM_PANEL_MISC_API_ENABLED 0x00000080 + + +#define MEMTYPE_DDR1 "DDR1" +#define MEMTYPE_DDR2 "DDR2" +#define MEMTYPE_DDR3 "DDR3" +#define MEMTYPE_DDR4 "DDR4" + +#define ASIC_BUS_TYPE_PCI "PCI" +#define ASIC_BUS_TYPE_AGP "AGP" +#define ASIC_BUS_TYPE_PCIE "PCI_EXPRESS" + +/* Maximum size of that FireGL flag string */ + +#define ATOM_FIREGL_FLAG_STRING "FGL" //Flag used to enable FireGL Support +#define ATOM_MAX_SIZE_OF_FIREGL_FLAG_STRING 3 //sizeof( ATOM_FIREGL_FLAG_STRING ) + +#define ATOM_FAKE_DESKTOP_STRING "DSK" //Flag used to enable mobile ASIC on Desktop +#define ATOM_MAX_SIZE_OF_FAKE_DESKTOP_STRING ATOM_MAX_SIZE_OF_FIREGL_FLAG_STRING + +#define ATOM_M54T_FLAG_STRING "M54T" //Flag used to enable M54T Support +#define ATOM_MAX_SIZE_OF_M54T_FLAG_STRING 4 //sizeof( ATOM_M54T_FLAG_STRING ) + +#define HW_ASSISTED_I2C_STATUS_FAILURE 2 +#define HW_ASSISTED_I2C_STATUS_SUCCESS 1 + +#pragma pack(1) /* BIOS data must use byte aligment */ + +/* Define offset to location of ROM header. */ + +#define OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER 0x00000048L +#define OFFSET_TO_ATOM_ROM_IMAGE_SIZE 0x00000002L + +#define OFFSET_TO_ATOMBIOS_ASIC_BUS_MEM_TYPE 0x94 +#define MAXSIZE_OF_ATOMBIOS_ASIC_BUS_MEM_TYPE 20 /* including the terminator 0x0! */ +#define OFFSET_TO_GET_ATOMBIOS_STRINGS_NUMBER 0x002f +#define OFFSET_TO_GET_ATOMBIOS_STRINGS_START 0x006e + +/* Common header for all ROM Data tables. + Every table pointed _ATOM_MASTER_DATA_TABLE has this common header. + And the pointer actually points to this header. */ + +typedef struct _ATOM_COMMON_TABLE_HEADER +{ + USHORT usStructureSize; + UCHAR ucTableFormatRevision; /*Change it when the Parser is not backward compatible */ + UCHAR ucTableContentRevision; /*Change it only when the table needs to change but the firmware */ + /*Image can't be updated, while Driver needs to carry the new table! */ +}ATOM_COMMON_TABLE_HEADER; + +/****************************************************************************/ +// Structure stores the ROM header. +/****************************************************************************/ +typedef struct _ATOM_ROM_HEADER +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR uaFirmWareSignature[4]; /*Signature to distinguish between Atombios and non-atombios, + atombios should init it as "ATOM", don't change the position */ + USHORT usBiosRuntimeSegmentAddress; + USHORT usProtectedModeInfoOffset; + USHORT usConfigFilenameOffset; + USHORT usCRC_BlockOffset; + USHORT usBIOS_BootupMessageOffset; + USHORT usInt10Offset; + USHORT usPciBusDevInitCode; + USHORT usIoBaseAddress; + USHORT usSubsystemVendorID; + USHORT usSubsystemID; + USHORT usPCI_InfoOffset; + USHORT usMasterCommandTableOffset; /*Offset for SW to get all command table offsets, Don't change the position */ + USHORT usMasterDataTableOffset; /*Offset for SW to get all data table offsets, Don't change the position */ + UCHAR ucExtendedFunctionCode; + UCHAR ucReserved; +}ATOM_ROM_HEADER; + +/*==============================Command Table Portion==================================== */ + +#ifdef UEFI_BUILD + #define UTEMP USHORT + #define USHORT void* +#endif + +/****************************************************************************/ +// Structures used in Command.mtb +/****************************************************************************/ +typedef struct _ATOM_MASTER_LIST_OF_COMMAND_TABLES{ + USHORT ASIC_Init; //Function Table, used by various SW components,latest version 1.1 + USHORT GetDisplaySurfaceSize; //Atomic Table, Used by Bios when enabling HW ICON + USHORT ASIC_RegistersInit; //Atomic Table, indirectly used by various SW components,called from ASIC_Init + USHORT VRAM_BlockVenderDetection; //Atomic Table, used only by Bios + USHORT DIGxEncoderControl; //Only used by Bios + USHORT MemoryControllerInit; //Atomic Table, indirectly used by various SW components,called from ASIC_Init + USHORT EnableCRTCMemReq; //Function Table,directly used by various SW components,latest version 2.1 + USHORT MemoryParamAdjust; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock if needed + USHORT DVOEncoderControl; //Function Table,directly used by various SW components,latest version 1.2 + USHORT GPIOPinControl; //Atomic Table, only used by Bios + USHORT SetEngineClock; //Function Table,directly used by various SW components,latest version 1.1 + USHORT SetMemoryClock; //Function Table,directly used by various SW components,latest version 1.1 + USHORT SetPixelClock; //Function Table,directly used by various SW components,latest version 1.2 + USHORT DynamicClockGating; //Atomic Table, indirectly used by various SW components,called from ASIC_Init + USHORT ResetMemoryDLL; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock + USHORT ResetMemoryDevice; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock + USHORT MemoryPLLInit; + USHORT AdjustDisplayPll; //only used by Bios + USHORT AdjustMemoryController; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock + USHORT EnableASIC_StaticPwrMgt; //Atomic Table, only used by Bios + USHORT ASIC_StaticPwrMgtStatusChange; //Obsolete , only used by Bios + USHORT DAC_LoadDetection; //Atomic Table, directly used by various SW components,latest version 1.2 + USHORT LVTMAEncoderControl; //Atomic Table,directly used by various SW components,latest version 1.3 + USHORT LCD1OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT DAC1EncoderControl; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT DAC2EncoderControl; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT DVOOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT CV1OutputControl; //Atomic Table, Atomic Table, Obsolete from Ry6xx, use DAC2 Output instead + USHORT GetConditionalGoldenSetting; //only used by Bios + USHORT TVEncoderControl; //Function Table,directly used by various SW components,latest version 1.1 + USHORT TMDSAEncoderControl; //Atomic Table, directly used by various SW components,latest version 1.3 + USHORT LVDSEncoderControl; //Atomic Table, directly used by various SW components,latest version 1.3 + USHORT TV1OutputControl; //Atomic Table, Obsolete from Ry6xx, use DAC2 Output instead + USHORT EnableScaler; //Atomic Table, used only by Bios + USHORT BlankCRTC; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT EnableCRTC; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT GetPixelClock; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT EnableVGA_Render; //Function Table,directly used by various SW components,latest version 1.1 + USHORT GetSCLKOverMCLKRatio; //Atomic Table, only used by Bios + USHORT SetCRTC_Timing; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT SetCRTC_OverScan; //Atomic Table, used by various SW components,latest version 1.1 + USHORT SetCRTC_Replication; //Atomic Table, used only by Bios + USHORT SelectCRTC_Source; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT EnableGraphSurfaces; //Atomic Table, used only by Bios + USHORT UpdateCRTC_DoubleBufferRegisters; + USHORT LUT_AutoFill; //Atomic Table, only used by Bios + USHORT EnableHW_IconCursor; //Atomic Table, only used by Bios + USHORT GetMemoryClock; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT GetEngineClock; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT SetCRTC_UsingDTDTiming; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT ExternalEncoderControl; //Atomic Table, directly used by various SW components,latest version 2.1 + USHORT LVTMAOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT VRAM_BlockDetectionByStrap; //Atomic Table, used only by Bios + USHORT MemoryCleanUp; //Atomic Table, only used by Bios + USHORT ProcessI2cChannelTransaction; //Function Table,only used by Bios + USHORT WriteOneByteToHWAssistedI2C; //Function Table,indirectly used by various SW components + USHORT ReadHWAssistedI2CStatus; //Atomic Table, indirectly used by various SW components + USHORT SpeedFanControl; //Function Table,indirectly used by various SW components,called from ASIC_Init + USHORT PowerConnectorDetection; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT MC_Synchronization; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock + USHORT ComputeMemoryEnginePLL; //Atomic Table, indirectly used by various SW components,called from SetMemory/EngineClock + USHORT MemoryRefreshConversion; //Atomic Table, indirectly used by various SW components,called from SetMemory or SetEngineClock + USHORT VRAM_GetCurrentInfoBlock; //Atomic Table, used only by Bios + USHORT DynamicMemorySettings; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock + USHORT MemoryTraining; //Atomic Table, used only by Bios + USHORT EnableSpreadSpectrumOnPPLL; //Atomic Table, directly used by various SW components,latest version 1.2 + USHORT TMDSAOutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT SetVoltage; //Function Table,directly and/or indirectly used by various SW components,latest version 1.1 + USHORT DAC1OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT DAC2OutputControl; //Atomic Table, directly used by various SW components,latest version 1.1 + USHORT SetupHWAssistedI2CStatus; //Function Table,only used by Bios, obsolete soon.Switch to use "ReadEDIDFromHWAssistedI2C" + USHORT ClockSource; //Atomic Table, indirectly used by various SW components,called from ASIC_Init + USHORT MemoryDeviceInit; //Atomic Table, indirectly used by various SW components,called from SetMemoryClock + USHORT EnableYUV; //Atomic Table, indirectly used by various SW components,called from EnableVGARender + USHORT DIG1EncoderControl; //Atomic Table,directly used by various SW components,latest version 1.1 + USHORT DIG2EncoderControl; //Atomic Table,directly used by various SW components,latest version 1.1 + USHORT DIG1TransmitterControl; //Atomic Table,directly used by various SW components,latest version 1.1 + USHORT DIG2TransmitterControl; //Atomic Table,directly used by various SW components,latest version 1.1 + USHORT ProcessAuxChannelTransaction; //Function Table,only used by Bios + USHORT DPEncoderService; //Function Table,only used by Bios +}ATOM_MASTER_LIST_OF_COMMAND_TABLES; + +// For backward compatible +#define ReadEDIDFromHWAssistedI2C ProcessI2cChannelTransaction +#define UNIPHYTransmitterControl DIG1TransmitterControl +#define LVTMATransmitterControl DIG2TransmitterControl +#define SetCRTC_DPM_State GetConditionalGoldenSetting +#define SetUniphyInstance ASIC_StaticPwrMgtStatusChange +#define HPDInterruptService ReadHWAssistedI2CStatus +#define EnableVGA_Access GetSCLKOverMCLKRatio +#define GetDispObjectInfo EnableYUV + +typedef struct _ATOM_MASTER_COMMAND_TABLE +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_MASTER_LIST_OF_COMMAND_TABLES ListOfCommandTables; +}ATOM_MASTER_COMMAND_TABLE; + +/****************************************************************************/ +// Structures used in every command table +/****************************************************************************/ +typedef struct _ATOM_TABLE_ATTRIBUTE +{ +#if ATOM_BIG_ENDIAN + USHORT UpdatedByUtility:1; //[15]=Table updated by utility flag + USHORT PS_SizeInBytes:7; //[14:8]=Size of parameter space in Bytes (multiple of a dword), + USHORT WS_SizeInBytes:8; //[7:0]=Size of workspace in Bytes (in multiple of a dword), +#else + USHORT WS_SizeInBytes:8; //[7:0]=Size of workspace in Bytes (in multiple of a dword), + USHORT PS_SizeInBytes:7; //[14:8]=Size of parameter space in Bytes (multiple of a dword), + USHORT UpdatedByUtility:1; //[15]=Table updated by utility flag +#endif +}ATOM_TABLE_ATTRIBUTE; + +typedef union _ATOM_TABLE_ATTRIBUTE_ACCESS +{ + ATOM_TABLE_ATTRIBUTE sbfAccess; + USHORT susAccess; +}ATOM_TABLE_ATTRIBUTE_ACCESS; + +/****************************************************************************/ +// Common header for all command tables. +// Every table pointed by _ATOM_MASTER_COMMAND_TABLE has this common header. +// And the pointer actually points to this header. +/****************************************************************************/ +typedef struct _ATOM_COMMON_ROM_COMMAND_TABLE_HEADER +{ + ATOM_COMMON_TABLE_HEADER CommonHeader; + ATOM_TABLE_ATTRIBUTE TableAttribute; +}ATOM_COMMON_ROM_COMMAND_TABLE_HEADER; + +/****************************************************************************/ +// Structures used by ComputeMemoryEnginePLLTable +/****************************************************************************/ +#define COMPUTE_MEMORY_PLL_PARAM 1 +#define COMPUTE_ENGINE_PLL_PARAM 2 +#define ADJUST_MC_SETTING_PARAM 3 + +/****************************************************************************/ +// Structures used by AdjustMemoryControllerTable +/****************************************************************************/ +typedef struct _ATOM_ADJUST_MEMORY_CLOCK_FREQ +{ +#if ATOM_BIG_ENDIAN + ULONG ulPointerReturnFlag:1; // BYTE_3[7]=1 - Return the pointer to the right Data Block; BYTE_3[7]=0 - Program the right Data Block + ULONG ulMemoryModuleNumber:7; // BYTE_3[6:0] + ULONG ulClockFreq:24; +#else + ULONG ulClockFreq:24; + ULONG ulMemoryModuleNumber:7; // BYTE_3[6:0] + ULONG ulPointerReturnFlag:1; // BYTE_3[7]=1 - Return the pointer to the right Data Block; BYTE_3[7]=0 - Program the right Data Block +#endif +}ATOM_ADJUST_MEMORY_CLOCK_FREQ; +#define POINTER_RETURN_FLAG 0x80 + +typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS +{ + ULONG ulClock; //When returen, it's the re-calculated clock based on given Fb_div Post_Div and ref_div + UCHAR ucAction; //0:reserved //1:Memory //2:Engine + UCHAR ucReserved; //may expand to return larger Fbdiv later + UCHAR ucFbDiv; //return value + UCHAR ucPostDiv; //return value +}COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS; + +typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V2 +{ + ULONG ulClock; //When return, [23:0] return real clock + UCHAR ucAction; //0:reserved;COMPUTE_MEMORY_PLL_PARAM:Memory;COMPUTE_ENGINE_PLL_PARAM:Engine. it return ref_div to be written to register + USHORT usFbDiv; //return Feedback value to be written to register + UCHAR ucPostDiv; //return post div to be written to register +}COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V2; +#define COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS + + +#define SET_CLOCK_FREQ_MASK 0x00FFFFFF //Clock change tables only take bit [23:0] as the requested clock value +#define USE_NON_BUS_CLOCK_MASK 0x01000000 //Applicable to both memory and engine clock change, when set, it uses another clock as the temporary clock (engine uses memory and vice versa) +#define USE_MEMORY_SELF_REFRESH_MASK 0x02000000 //Only applicable to memory clock change, when set, using memory self refresh during clock transition +#define SKIP_INTERNAL_MEMORY_PARAMETER_CHANGE 0x04000000 //Only applicable to memory clock change, when set, the table will skip predefined internal memory parameter change +#define FIRST_TIME_CHANGE_CLOCK 0x08000000 //Applicable to both memory and engine clock change,when set, it means this is 1st time to change clock after ASIC bootup +#define SKIP_SW_PROGRAM_PLL 0x10000000 //Applicable to both memory and engine clock change, when set, it means the table will not program SPLL/MPLL +#define USE_SS_ENABLED_PIXEL_CLOCK USE_NON_BUS_CLOCK_MASK + +#define b3USE_NON_BUS_CLOCK_MASK 0x01 //Applicable to both memory and engine clock change, when set, it uses another clock as the temporary clock (engine uses memory and vice versa) +#define b3USE_MEMORY_SELF_REFRESH 0x02 //Only applicable to memory clock change, when set, using memory self refresh during clock transition +#define b3SKIP_INTERNAL_MEMORY_PARAMETER_CHANGE 0x04 //Only applicable to memory clock change, when set, the table will skip predefined internal memory parameter change +#define b3FIRST_TIME_CHANGE_CLOCK 0x08 //Applicable to both memory and engine clock change,when set, it means this is 1st time to change clock after ASIC bootup +#define b3SKIP_SW_PROGRAM_PLL 0x10 //Applicable to both memory and engine clock change, when set, it means the table will not program SPLL/MPLL + +typedef struct _ATOM_COMPUTE_CLOCK_FREQ +{ +#if ATOM_BIG_ENDIAN + ULONG ulComputeClockFlag:8; // =1: COMPUTE_MEMORY_PLL_PARAM, =2: COMPUTE_ENGINE_PLL_PARAM + ULONG ulClockFreq:24; // in unit of 10kHz +#else + ULONG ulClockFreq:24; // in unit of 10kHz + ULONG ulComputeClockFlag:8; // =1: COMPUTE_MEMORY_PLL_PARAM, =2: COMPUTE_ENGINE_PLL_PARAM +#endif +}ATOM_COMPUTE_CLOCK_FREQ; + +typedef struct _ATOM_S_MPLL_FB_DIVIDER +{ + USHORT usFbDivFrac; + USHORT usFbDiv; +}ATOM_S_MPLL_FB_DIVIDER; + +typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V3 +{ + union + { + ATOM_COMPUTE_CLOCK_FREQ ulClock; //Input Parameter + ATOM_S_MPLL_FB_DIVIDER ulFbDiv; //Output Parameter + }; + UCHAR ucRefDiv; //Output Parameter + UCHAR ucPostDiv; //Output Parameter + UCHAR ucCntlFlag; //Output Parameter + UCHAR ucReserved; +}COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V3; + +// ucCntlFlag +#define ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN 1 +#define ATOM_PLL_CNTL_FLAG_MPLL_VCO_MODE 2 +#define ATOM_PLL_CNTL_FLAG_FRACTION_DISABLE 4 +#define ATOM_PLL_CNTL_FLAG_SPLL_ISPARE_9 8 + + +// V4 are only used for APU which PLL outside GPU +typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V4 +{ +#if ATOM_BIG_ENDIAN + ULONG ucPostDiv; //return parameter: post divider which is used to program to register directly + ULONG ulClock:24; //Input= target clock, output = actual clock +#else + ULONG ulClock:24; //Input= target clock, output = actual clock + ULONG ucPostDiv; //return parameter: post divider which is used to program to register directly +#endif +}COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V4; + +typedef struct _COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5 +{ + union + { + ATOM_COMPUTE_CLOCK_FREQ ulClock; //Input Parameter + ATOM_S_MPLL_FB_DIVIDER ulFbDiv; //Output Parameter + }; + UCHAR ucRefDiv; //Output Parameter + UCHAR ucPostDiv; //Output Parameter + union + { + UCHAR ucCntlFlag; //Output Flags + UCHAR ucInputFlag; //Input Flags. ucInputFlag[0] - Strobe(1)/Performance(0) mode + }; + UCHAR ucReserved; +}COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5; + +// ucInputFlag +#define ATOM_PLL_INPUT_FLAG_PLL_STROBE_MODE_EN 1 // 1-StrobeMode, 0-PerformanceMode + +typedef struct _DYNAMICE_MEMORY_SETTINGS_PARAMETER +{ + ATOM_COMPUTE_CLOCK_FREQ ulClock; + ULONG ulReserved[2]; +}DYNAMICE_MEMORY_SETTINGS_PARAMETER; + +typedef struct _DYNAMICE_ENGINE_SETTINGS_PARAMETER +{ + ATOM_COMPUTE_CLOCK_FREQ ulClock; + ULONG ulMemoryClock; + ULONG ulReserved; +}DYNAMICE_ENGINE_SETTINGS_PARAMETER; + +/****************************************************************************/ +// Structures used by SetEngineClockTable +/****************************************************************************/ +typedef struct _SET_ENGINE_CLOCK_PARAMETERS +{ + ULONG ulTargetEngineClock; //In 10Khz unit +}SET_ENGINE_CLOCK_PARAMETERS; + +typedef struct _SET_ENGINE_CLOCK_PS_ALLOCATION +{ + ULONG ulTargetEngineClock; //In 10Khz unit + COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION sReserved; +}SET_ENGINE_CLOCK_PS_ALLOCATION; + +/****************************************************************************/ +// Structures used by SetMemoryClockTable +/****************************************************************************/ +typedef struct _SET_MEMORY_CLOCK_PARAMETERS +{ + ULONG ulTargetMemoryClock; //In 10Khz unit +}SET_MEMORY_CLOCK_PARAMETERS; + +typedef struct _SET_MEMORY_CLOCK_PS_ALLOCATION +{ + ULONG ulTargetMemoryClock; //In 10Khz unit + COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_PS_ALLOCATION sReserved; +}SET_MEMORY_CLOCK_PS_ALLOCATION; + +/****************************************************************************/ +// Structures used by ASIC_Init.ctb +/****************************************************************************/ +typedef struct _ASIC_INIT_PARAMETERS +{ + ULONG ulDefaultEngineClock; //In 10Khz unit + ULONG ulDefaultMemoryClock; //In 10Khz unit +}ASIC_INIT_PARAMETERS; + +typedef struct _ASIC_INIT_PS_ALLOCATION +{ + ASIC_INIT_PARAMETERS sASICInitClocks; + SET_ENGINE_CLOCK_PS_ALLOCATION sReserved; //Caller doesn't need to init this structure +}ASIC_INIT_PS_ALLOCATION; + +/****************************************************************************/ +// Structure used by DynamicClockGatingTable.ctb +/****************************************************************************/ +typedef struct _DYNAMIC_CLOCK_GATING_PARAMETERS +{ + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE + UCHAR ucPadding[3]; +}DYNAMIC_CLOCK_GATING_PARAMETERS; +#define DYNAMIC_CLOCK_GATING_PS_ALLOCATION DYNAMIC_CLOCK_GATING_PARAMETERS + +/****************************************************************************/ +// Structure used by EnableASIC_StaticPwrMgtTable.ctb +/****************************************************************************/ +typedef struct _ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS +{ + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE + UCHAR ucPadding[3]; +}ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS; +#define ENABLE_ASIC_STATIC_PWR_MGT_PS_ALLOCATION ENABLE_ASIC_STATIC_PWR_MGT_PARAMETERS + +/****************************************************************************/ +// Structures used by DAC_LoadDetectionTable.ctb +/****************************************************************************/ +typedef struct _DAC_LOAD_DETECTION_PARAMETERS +{ + USHORT usDeviceID; //{ATOM_DEVICE_CRTx_SUPPORT,ATOM_DEVICE_TVx_SUPPORT,ATOM_DEVICE_CVx_SUPPORT} + UCHAR ucDacType; //{ATOM_DAC_A,ATOM_DAC_B, ATOM_EXT_DAC} + UCHAR ucMisc; //Valid only when table revision =1.3 and above +}DAC_LOAD_DETECTION_PARAMETERS; + +// DAC_LOAD_DETECTION_PARAMETERS.ucMisc +#define DAC_LOAD_MISC_YPrPb 0x01 + +typedef struct _DAC_LOAD_DETECTION_PS_ALLOCATION +{ + DAC_LOAD_DETECTION_PARAMETERS sDacload; + ULONG Reserved[2];// Don't set this one, allocation for EXT DAC +}DAC_LOAD_DETECTION_PS_ALLOCATION; + +/****************************************************************************/ +// Structures used by DAC1EncoderControlTable.ctb and DAC2EncoderControlTable.ctb +/****************************************************************************/ +typedef struct _DAC_ENCODER_CONTROL_PARAMETERS +{ + USHORT usPixelClock; // in 10KHz; for bios convenient + UCHAR ucDacStandard; // See definition of ATOM_DACx_xxx, For DEC3.0, bit 7 used as internal flag to indicate DAC2 (==1) or DAC1 (==0) + UCHAR ucAction; // 0: turn off encoder + // 1: setup and turn on encoder + // 7: ATOM_ENCODER_INIT Initialize DAC +}DAC_ENCODER_CONTROL_PARAMETERS; + +#define DAC_ENCODER_CONTROL_PS_ALLOCATION DAC_ENCODER_CONTROL_PARAMETERS + +/****************************************************************************/ +// Structures used by DIG1EncoderControlTable +// DIG2EncoderControlTable +// ExternalEncoderControlTable +/****************************************************************************/ +typedef struct _DIG_ENCODER_CONTROL_PARAMETERS +{ + USHORT usPixelClock; // in 10KHz; for bios convenient + UCHAR ucConfig; + // [2] Link Select: + // =0: PHY linkA if bfLane<3 + // =1: PHY linkB if bfLanes<3 + // =0: PHY linkA+B if bfLanes=3 + // [3] Transmitter Sel + // =0: UNIPHY or PCIEPHY + // =1: LVTMA + UCHAR ucAction; // =0: turn off encoder + // =1: turn on encoder + UCHAR ucEncoderMode; + // =0: DP encoder + // =1: LVDS encoder + // =2: DVI encoder + // =3: HDMI encoder + // =4: SDVO encoder + UCHAR ucLaneNum; // how many lanes to enable + UCHAR ucReserved[2]; +}DIG_ENCODER_CONTROL_PARAMETERS; +#define DIG_ENCODER_CONTROL_PS_ALLOCATION DIG_ENCODER_CONTROL_PARAMETERS +#define EXTERNAL_ENCODER_CONTROL_PARAMETER DIG_ENCODER_CONTROL_PARAMETERS + +//ucConfig +#define ATOM_ENCODER_CONFIG_DPLINKRATE_MASK 0x01 +#define ATOM_ENCODER_CONFIG_DPLINKRATE_1_62GHZ 0x00 +#define ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ 0x01 +#define ATOM_ENCODER_CONFIG_DPLINKRATE_5_40GHZ 0x02 +#define ATOM_ENCODER_CONFIG_LINK_SEL_MASK 0x04 +#define ATOM_ENCODER_CONFIG_LINKA 0x00 +#define ATOM_ENCODER_CONFIG_LINKB 0x04 +#define ATOM_ENCODER_CONFIG_LINKA_B ATOM_TRANSMITTER_CONFIG_LINKA +#define ATOM_ENCODER_CONFIG_LINKB_A ATOM_ENCODER_CONFIG_LINKB +#define ATOM_ENCODER_CONFIG_TRANSMITTER_SEL_MASK 0x08 +#define ATOM_ENCODER_CONFIG_UNIPHY 0x00 +#define ATOM_ENCODER_CONFIG_LVTMA 0x08 +#define ATOM_ENCODER_CONFIG_TRANSMITTER1 0x00 +#define ATOM_ENCODER_CONFIG_TRANSMITTER2 0x08 +#define ATOM_ENCODER_CONFIG_DIGB 0x80 // VBIOS Internal use, outside SW should set this bit=0 +// ucAction +// ATOM_ENABLE: Enable Encoder +// ATOM_DISABLE: Disable Encoder + +//ucEncoderMode +#define ATOM_ENCODER_MODE_DP 0 +#define ATOM_ENCODER_MODE_LVDS 1 +#define ATOM_ENCODER_MODE_DVI 2 +#define ATOM_ENCODER_MODE_HDMI 3 +#define ATOM_ENCODER_MODE_SDVO 4 +#define ATOM_ENCODER_MODE_DP_AUDIO 5 +#define ATOM_ENCODER_MODE_TV 13 +#define ATOM_ENCODER_MODE_CV 14 +#define ATOM_ENCODER_MODE_CRT 15 +#define ATOM_ENCODER_MODE_DVO 16 +#define ATOM_ENCODER_MODE_DP_SST ATOM_ENCODER_MODE_DP // For DP1.2 +#define ATOM_ENCODER_MODE_DP_MST 5 // For DP1.2 + +typedef struct _ATOM_DIG_ENCODER_CONFIG_V2 +{ +#if ATOM_BIG_ENDIAN + UCHAR ucReserved1:2; + UCHAR ucTransmitterSel:2; // =0: UniphyAB, =1: UniphyCD =2: UniphyEF + UCHAR ucLinkSel:1; // =0: linkA/C/E =1: linkB/D/F + UCHAR ucReserved:1; + UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz +#else + UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz + UCHAR ucReserved:1; + UCHAR ucLinkSel:1; // =0: linkA/C/E =1: linkB/D/F + UCHAR ucTransmitterSel:2; // =0: UniphyAB, =1: UniphyCD =2: UniphyEF + UCHAR ucReserved1:2; +#endif +}ATOM_DIG_ENCODER_CONFIG_V2; + + +typedef struct _DIG_ENCODER_CONTROL_PARAMETERS_V2 +{ + USHORT usPixelClock; // in 10KHz; for bios convenient + ATOM_DIG_ENCODER_CONFIG_V2 acConfig; + UCHAR ucAction; + UCHAR ucEncoderMode; + // =0: DP encoder + // =1: LVDS encoder + // =2: DVI encoder + // =3: HDMI encoder + // =4: SDVO encoder + UCHAR ucLaneNum; // how many lanes to enable + UCHAR ucStatus; // = DP_LINK_TRAINING_COMPLETE or DP_LINK_TRAINING_INCOMPLETE, only used by VBIOS with command ATOM_ENCODER_CMD_QUERY_DP_LINK_TRAINING_STATUS + UCHAR ucReserved; +}DIG_ENCODER_CONTROL_PARAMETERS_V2; + +//ucConfig +#define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_MASK 0x01 +#define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_1_62GHZ 0x00 +#define ATOM_ENCODER_CONFIG_V2_DPLINKRATE_2_70GHZ 0x01 +#define ATOM_ENCODER_CONFIG_V2_LINK_SEL_MASK 0x04 +#define ATOM_ENCODER_CONFIG_V2_LINKA 0x00 +#define ATOM_ENCODER_CONFIG_V2_LINKB 0x04 +#define ATOM_ENCODER_CONFIG_V2_TRANSMITTER_SEL_MASK 0x18 +#define ATOM_ENCODER_CONFIG_V2_TRANSMITTER1 0x00 +#define ATOM_ENCODER_CONFIG_V2_TRANSMITTER2 0x08 +#define ATOM_ENCODER_CONFIG_V2_TRANSMITTER3 0x10 + +// ucAction: +// ATOM_DISABLE +// ATOM_ENABLE +#define ATOM_ENCODER_CMD_DP_LINK_TRAINING_START 0x08 +#define ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN1 0x09 +#define ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN2 0x0a +#define ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN3 0x13 +#define ATOM_ENCODER_CMD_DP_LINK_TRAINING_COMPLETE 0x0b +#define ATOM_ENCODER_CMD_DP_VIDEO_OFF 0x0c +#define ATOM_ENCODER_CMD_DP_VIDEO_ON 0x0d +#define ATOM_ENCODER_CMD_QUERY_DP_LINK_TRAINING_STATUS 0x0e +#define ATOM_ENCODER_CMD_SETUP 0x0f +#define ATOM_ENCODER_CMD_SETUP_PANEL_MODE 0x10 + +// ucStatus +#define ATOM_ENCODER_STATUS_LINK_TRAINING_COMPLETE 0x10 +#define ATOM_ENCODER_STATUS_LINK_TRAINING_INCOMPLETE 0x00 + +//ucTableFormatRevision=1 +//ucTableContentRevision=3 +// Following function ENABLE sub-function will be used by driver when TMDS/HDMI/LVDS is used, disable function will be used by driver +typedef struct _ATOM_DIG_ENCODER_CONFIG_V3 +{ +#if ATOM_BIG_ENDIAN + UCHAR ucReserved1:1; + UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F) + UCHAR ucReserved:3; + UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz +#else + UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz + UCHAR ucReserved:3; + UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F) + UCHAR ucReserved1:1; +#endif +}ATOM_DIG_ENCODER_CONFIG_V3; + +#define ATOM_ENCODER_CONFIG_V3_DPLINKRATE_MASK 0x03 +#define ATOM_ENCODER_CONFIG_V3_DPLINKRATE_1_62GHZ 0x00 +#define ATOM_ENCODER_CONFIG_V3_DPLINKRATE_2_70GHZ 0x01 +#define ATOM_ENCODER_CONFIG_V3_ENCODER_SEL 0x70 +#define ATOM_ENCODER_CONFIG_V3_DIG0_ENCODER 0x00 +#define ATOM_ENCODER_CONFIG_V3_DIG1_ENCODER 0x10 +#define ATOM_ENCODER_CONFIG_V3_DIG2_ENCODER 0x20 +#define ATOM_ENCODER_CONFIG_V3_DIG3_ENCODER 0x30 +#define ATOM_ENCODER_CONFIG_V3_DIG4_ENCODER 0x40 +#define ATOM_ENCODER_CONFIG_V3_DIG5_ENCODER 0x50 + +typedef struct _DIG_ENCODER_CONTROL_PARAMETERS_V3 +{ + USHORT usPixelClock; // in 10KHz; for bios convenient + ATOM_DIG_ENCODER_CONFIG_V3 acConfig; + UCHAR ucAction; + union { + UCHAR ucEncoderMode; + // =0: DP encoder + // =1: LVDS encoder + // =2: DVI encoder + // =3: HDMI encoder + // =4: SDVO encoder + // =5: DP audio + UCHAR ucPanelMode; // only valid when ucAction == ATOM_ENCODER_CMD_SETUP_PANEL_MODE + // =0: external DP + // =1: internal DP2 + // =0x11: internal DP1 for NutMeg/Travis DP translator + }; + UCHAR ucLaneNum; // how many lanes to enable + UCHAR ucBitPerColor; // only valid for DP mode when ucAction = ATOM_ENCODER_CMD_SETUP + UCHAR ucReserved; +}DIG_ENCODER_CONTROL_PARAMETERS_V3; + +//ucTableFormatRevision=1 +//ucTableContentRevision=4 +// start from NI +// Following function ENABLE sub-function will be used by driver when TMDS/HDMI/LVDS is used, disable function will be used by driver +typedef struct _ATOM_DIG_ENCODER_CONFIG_V4 +{ +#if ATOM_BIG_ENDIAN + UCHAR ucReserved1:1; + UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F) + UCHAR ucReserved:2; + UCHAR ucDPLinkRate:2; // =0: 1.62Ghz, =1: 2.7Ghz, 2=5.4Ghz <= Changed comparing to previous version +#else + UCHAR ucDPLinkRate:2; // =0: 1.62Ghz, =1: 2.7Ghz, 2=5.4Ghz <= Changed comparing to previous version + UCHAR ucReserved:2; + UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F) + UCHAR ucReserved1:1; +#endif +}ATOM_DIG_ENCODER_CONFIG_V4; + +#define ATOM_ENCODER_CONFIG_V4_DPLINKRATE_MASK 0x03 +#define ATOM_ENCODER_CONFIG_V4_DPLINKRATE_1_62GHZ 0x00 +#define ATOM_ENCODER_CONFIG_V4_DPLINKRATE_2_70GHZ 0x01 +#define ATOM_ENCODER_CONFIG_V4_DPLINKRATE_5_40GHZ 0x02 +#define ATOM_ENCODER_CONFIG_V4_ENCODER_SEL 0x70 +#define ATOM_ENCODER_CONFIG_V4_DIG0_ENCODER 0x00 +#define ATOM_ENCODER_CONFIG_V4_DIG1_ENCODER 0x10 +#define ATOM_ENCODER_CONFIG_V4_DIG2_ENCODER 0x20 +#define ATOM_ENCODER_CONFIG_V4_DIG3_ENCODER 0x30 +#define ATOM_ENCODER_CONFIG_V4_DIG4_ENCODER 0x40 +#define ATOM_ENCODER_CONFIG_V4_DIG5_ENCODER 0x50 + +typedef struct _DIG_ENCODER_CONTROL_PARAMETERS_V4 +{ + USHORT usPixelClock; // in 10KHz; for bios convenient + union{ + ATOM_DIG_ENCODER_CONFIG_V4 acConfig; + UCHAR ucConfig; + }; + UCHAR ucAction; + union { + UCHAR ucEncoderMode; + // =0: DP encoder + // =1: LVDS encoder + // =2: DVI encoder + // =3: HDMI encoder + // =4: SDVO encoder + // =5: DP audio + UCHAR ucPanelMode; // only valid when ucAction == ATOM_ENCODER_CMD_SETUP_PANEL_MODE + // =0: external DP + // =1: internal DP2 + // =0x11: internal DP1 for NutMeg/Travis DP translator + }; + UCHAR ucLaneNum; // how many lanes to enable + UCHAR ucBitPerColor; // only valid for DP mode when ucAction = ATOM_ENCODER_CMD_SETUP + UCHAR ucHPD_ID; // HPD ID (1-6). =0 means to skip HDP programming. New comparing to previous version +}DIG_ENCODER_CONTROL_PARAMETERS_V4; + +// define ucBitPerColor: +#define PANEL_BPC_UNDEFINE 0x00 +#define PANEL_6BIT_PER_COLOR 0x01 +#define PANEL_8BIT_PER_COLOR 0x02 +#define PANEL_10BIT_PER_COLOR 0x03 +#define PANEL_12BIT_PER_COLOR 0x04 +#define PANEL_16BIT_PER_COLOR 0x05 + +//define ucPanelMode +#define DP_PANEL_MODE_EXTERNAL_DP_MODE 0x00 +#define DP_PANEL_MODE_INTERNAL_DP2_MODE 0x01 +#define DP_PANEL_MODE_INTERNAL_DP1_MODE 0x11 + +/****************************************************************************/ +// Structures used by UNIPHYTransmitterControlTable +// LVTMATransmitterControlTable +// DVOOutputControlTable +/****************************************************************************/ +typedef struct _ATOM_DP_VS_MODE +{ + UCHAR ucLaneSel; + UCHAR ucLaneSet; +}ATOM_DP_VS_MODE; + +typedef struct _DIG_TRANSMITTER_CONTROL_PARAMETERS +{ + union + { + USHORT usPixelClock; // in 10KHz; for bios convenient + USHORT usInitInfo; // when init uniphy,lower 8bit is used for connector type defined in objectid.h + ATOM_DP_VS_MODE asMode; // DP Voltage swing mode + }; + UCHAR ucConfig; + // [0]=0: 4 lane Link, + // =1: 8 lane Link ( Dual Links TMDS ) + // [1]=0: InCoherent mode + // =1: Coherent Mode + // [2] Link Select: + // =0: PHY linkA if bfLane<3 + // =1: PHY linkB if bfLanes<3 + // =0: PHY linkA+B if bfLanes=3 + // [5:4]PCIE lane Sel + // =0: lane 0~3 or 0~7 + // =1: lane 4~7 + // =2: lane 8~11 or 8~15 + // =3: lane 12~15 + UCHAR ucAction; // =0: turn off encoder + // =1: turn on encoder + UCHAR ucReserved[4]; +}DIG_TRANSMITTER_CONTROL_PARAMETERS; + +#define DIG_TRANSMITTER_CONTROL_PS_ALLOCATION DIG_TRANSMITTER_CONTROL_PARAMETERS + +//ucInitInfo +#define ATOM_TRAMITTER_INITINFO_CONNECTOR_MASK 0x00ff + +//ucConfig +#define ATOM_TRANSMITTER_CONFIG_8LANE_LINK 0x01 +#define ATOM_TRANSMITTER_CONFIG_COHERENT 0x02 +#define ATOM_TRANSMITTER_CONFIG_LINK_SEL_MASK 0x04 +#define ATOM_TRANSMITTER_CONFIG_LINKA 0x00 +#define ATOM_TRANSMITTER_CONFIG_LINKB 0x04 +#define ATOM_TRANSMITTER_CONFIG_LINKA_B 0x00 +#define ATOM_TRANSMITTER_CONFIG_LINKB_A 0x04 + +#define ATOM_TRANSMITTER_CONFIG_ENCODER_SEL_MASK 0x08 // only used when ATOM_TRANSMITTER_ACTION_ENABLE +#define ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER 0x00 // only used when ATOM_TRANSMITTER_ACTION_ENABLE +#define ATOM_TRANSMITTER_CONFIG_DIG2_ENCODER 0x08 // only used when ATOM_TRANSMITTER_ACTION_ENABLE + +#define ATOM_TRANSMITTER_CONFIG_CLKSRC_MASK 0x30 +#define ATOM_TRANSMITTER_CONFIG_CLKSRC_PPLL 0x00 +#define ATOM_TRANSMITTER_CONFIG_CLKSRC_PCIE 0x20 +#define ATOM_TRANSMITTER_CONFIG_CLKSRC_XTALIN 0x30 +#define ATOM_TRANSMITTER_CONFIG_LANE_SEL_MASK 0xc0 +#define ATOM_TRANSMITTER_CONFIG_LANE_0_3 0x00 +#define ATOM_TRANSMITTER_CONFIG_LANE_0_7 0x00 +#define ATOM_TRANSMITTER_CONFIG_LANE_4_7 0x40 +#define ATOM_TRANSMITTER_CONFIG_LANE_8_11 0x80 +#define ATOM_TRANSMITTER_CONFIG_LANE_8_15 0x80 +#define ATOM_TRANSMITTER_CONFIG_LANE_12_15 0xc0 + +//ucAction +#define ATOM_TRANSMITTER_ACTION_DISABLE 0 +#define ATOM_TRANSMITTER_ACTION_ENABLE 1 +#define ATOM_TRANSMITTER_ACTION_LCD_BLOFF 2 +#define ATOM_TRANSMITTER_ACTION_LCD_BLON 3 +#define ATOM_TRANSMITTER_ACTION_BL_BRIGHTNESS_CONTROL 4 +#define ATOM_TRANSMITTER_ACTION_LCD_SELFTEST_START 5 +#define ATOM_TRANSMITTER_ACTION_LCD_SELFTEST_STOP 6 +#define ATOM_TRANSMITTER_ACTION_INIT 7 +#define ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT 8 +#define ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT 9 +#define ATOM_TRANSMITTER_ACTION_SETUP 10 +#define ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH 11 +#define ATOM_TRANSMITTER_ACTION_POWER_ON 12 +#define ATOM_TRANSMITTER_ACTION_POWER_OFF 13 + +// Following are used for DigTransmitterControlTable ver1.2 +typedef struct _ATOM_DIG_TRANSMITTER_CONFIG_V2 +{ +#if ATOM_BIG_ENDIAN + UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB ) + // =1 Dig Transmitter 2 ( Uniphy CD ) + // =2 Dig Transmitter 3 ( Uniphy EF ) + UCHAR ucReserved:1; + UCHAR fDPConnector:1; //bit4=0: DP connector =1: None DP connector + UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA( DIG inst0 ). =1: Data/clk path source from DIGB ( DIG inst1 ) + UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E + // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F + + UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode ) + UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector +#else + UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector + UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode ) + UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E + // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F + UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA( DIG inst0 ). =1: Data/clk path source from DIGB ( DIG inst1 ) + UCHAR fDPConnector:1; //bit4=0: DP connector =1: None DP connector + UCHAR ucReserved:1; + UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB ) + // =1 Dig Transmitter 2 ( Uniphy CD ) + // =2 Dig Transmitter 3 ( Uniphy EF ) +#endif +}ATOM_DIG_TRANSMITTER_CONFIG_V2; + +//ucConfig +//Bit0 +#define ATOM_TRANSMITTER_CONFIG_V2_DUAL_LINK_CONNECTOR 0x01 + +//Bit1 +#define ATOM_TRANSMITTER_CONFIG_V2_COHERENT 0x02 + +//Bit2 +#define ATOM_TRANSMITTER_CONFIG_V2_LINK_SEL_MASK 0x04 +#define ATOM_TRANSMITTER_CONFIG_V2_LINKA 0x00 +#define ATOM_TRANSMITTER_CONFIG_V2_LINKB 0x04 + +// Bit3 +#define ATOM_TRANSMITTER_CONFIG_V2_ENCODER_SEL_MASK 0x08 +#define ATOM_TRANSMITTER_CONFIG_V2_DIG1_ENCODER 0x00 // only used when ucAction == ATOM_TRANSMITTER_ACTION_ENABLE or ATOM_TRANSMITTER_ACTION_SETUP +#define ATOM_TRANSMITTER_CONFIG_V2_DIG2_ENCODER 0x08 // only used when ucAction == ATOM_TRANSMITTER_ACTION_ENABLE or ATOM_TRANSMITTER_ACTION_SETUP + +// Bit4 +#define ATOM_TRASMITTER_CONFIG_V2_DP_CONNECTOR 0x10 + +// Bit7:6 +#define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER_SEL_MASK 0xC0 +#define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER1 0x00 //AB +#define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER2 0x40 //CD +#define ATOM_TRANSMITTER_CONFIG_V2_TRANSMITTER3 0x80 //EF + +typedef struct _DIG_TRANSMITTER_CONTROL_PARAMETERS_V2 +{ + union + { + USHORT usPixelClock; // in 10KHz; for bios convenient + USHORT usInitInfo; // when init uniphy,lower 8bit is used for connector type defined in objectid.h + ATOM_DP_VS_MODE asMode; // DP Voltage swing mode + }; + ATOM_DIG_TRANSMITTER_CONFIG_V2 acConfig; + UCHAR ucAction; // define as ATOM_TRANSMITER_ACTION_XXX + UCHAR ucReserved[4]; +}DIG_TRANSMITTER_CONTROL_PARAMETERS_V2; + +typedef struct _ATOM_DIG_TRANSMITTER_CONFIG_V3 +{ +#if ATOM_BIG_ENDIAN + UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB ) + // =1 Dig Transmitter 2 ( Uniphy CD ) + // =2 Dig Transmitter 3 ( Uniphy EF ) + UCHAR ucRefClkSource:2; //bit5:4: PPLL1 =0, PPLL2=1, EXT_CLK=2 + UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA/C/E. =1: Data/clk path source from DIGB/D/F + UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E + // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F + UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode ) + UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector +#else + UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector + UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode ) + UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E + // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F + UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA/C/E. =1: Data/clk path source from DIGB/D/F + UCHAR ucRefClkSource:2; //bit5:4: PPLL1 =0, PPLL2=1, EXT_CLK=2 + UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB ) + // =1 Dig Transmitter 2 ( Uniphy CD ) + // =2 Dig Transmitter 3 ( Uniphy EF ) +#endif +}ATOM_DIG_TRANSMITTER_CONFIG_V3; + + +typedef struct _DIG_TRANSMITTER_CONTROL_PARAMETERS_V3 +{ + union + { + USHORT usPixelClock; // in 10KHz; for bios convenient + USHORT usInitInfo; // when init uniphy,lower 8bit is used for connector type defined in objectid.h + ATOM_DP_VS_MODE asMode; // DP Voltage swing mode + }; + ATOM_DIG_TRANSMITTER_CONFIG_V3 acConfig; + UCHAR ucAction; // define as ATOM_TRANSMITER_ACTION_XXX + UCHAR ucLaneNum; + UCHAR ucReserved[3]; +}DIG_TRANSMITTER_CONTROL_PARAMETERS_V3; + +//ucConfig +//Bit0 +#define ATOM_TRANSMITTER_CONFIG_V3_DUAL_LINK_CONNECTOR 0x01 + +//Bit1 +#define ATOM_TRANSMITTER_CONFIG_V3_COHERENT 0x02 + +//Bit2 +#define ATOM_TRANSMITTER_CONFIG_V3_LINK_SEL_MASK 0x04 +#define ATOM_TRANSMITTER_CONFIG_V3_LINKA 0x00 +#define ATOM_TRANSMITTER_CONFIG_V3_LINKB 0x04 + +// Bit3 +#define ATOM_TRANSMITTER_CONFIG_V3_ENCODER_SEL_MASK 0x08 +#define ATOM_TRANSMITTER_CONFIG_V3_DIG1_ENCODER 0x00 +#define ATOM_TRANSMITTER_CONFIG_V3_DIG2_ENCODER 0x08 + +// Bit5:4 +#define ATOM_TRASMITTER_CONFIG_V3_REFCLK_SEL_MASK 0x30 +#define ATOM_TRASMITTER_CONFIG_V3_P1PLL 0x00 +#define ATOM_TRASMITTER_CONFIG_V3_P2PLL 0x10 +#define ATOM_TRASMITTER_CONFIG_V3_REFCLK_SRC_EXT 0x20 + +// Bit7:6 +#define ATOM_TRANSMITTER_CONFIG_V3_TRANSMITTER_SEL_MASK 0xC0 +#define ATOM_TRANSMITTER_CONFIG_V3_TRANSMITTER1 0x00 //AB +#define ATOM_TRANSMITTER_CONFIG_V3_TRANSMITTER2 0x40 //CD +#define ATOM_TRANSMITTER_CONFIG_V3_TRANSMITTER3 0x80 //EF + + +/****************************************************************************/ +// Structures used by UNIPHYTransmitterControlTable V1.4 +// ASIC Families: NI +// ucTableFormatRevision=1 +// ucTableContentRevision=4 +/****************************************************************************/ +typedef struct _ATOM_DP_VS_MODE_V4 +{ + UCHAR ucLaneSel; + union + { + UCHAR ucLaneSet; + struct { +#if ATOM_BIG_ENDIAN + UCHAR ucPOST_CURSOR2:2; //Bit[7:6] Post Cursor2 Level <= New in V4 + UCHAR ucPRE_EMPHASIS:3; //Bit[5:3] Pre-emphasis Level + UCHAR ucVOLTAGE_SWING:3; //Bit[2:0] Voltage Swing Level +#else + UCHAR ucVOLTAGE_SWING:3; //Bit[2:0] Voltage Swing Level + UCHAR ucPRE_EMPHASIS:3; //Bit[5:3] Pre-emphasis Level + UCHAR ucPOST_CURSOR2:2; //Bit[7:6] Post Cursor2 Level <= New in V4 +#endif + }; + }; +}ATOM_DP_VS_MODE_V4; + +typedef struct _ATOM_DIG_TRANSMITTER_CONFIG_V4 +{ +#if ATOM_BIG_ENDIAN + UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB ) + // =1 Dig Transmitter 2 ( Uniphy CD ) + // =2 Dig Transmitter 3 ( Uniphy EF ) + UCHAR ucRefClkSource:2; //bit5:4: PPLL1 =0, PPLL2=1, DCPLL=2, EXT_CLK=3 <= New + UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA/C/E. =1: Data/clk path source from DIGB/D/F + UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E + // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F + UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode ) + UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector +#else + UCHAR fDualLinkConnector:1; //bit0=1: Dual Link DVI connector + UCHAR fCoherentMode:1; //bit1=1: Coherent Mode ( for DVI/HDMI mode ) + UCHAR ucLinkSel:1; //bit2=0: Uniphy LINKA or C or E when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is A or C or E + // =1: Uniphy LINKB or D or F when fDualLinkConnector=0. when fDualLinkConnector=1, it means master link of dual link is B or D or F + UCHAR ucEncoderSel:1; //bit3=0: Data/Clk path source from DIGA/C/E. =1: Data/clk path source from DIGB/D/F + UCHAR ucRefClkSource:2; //bit5:4: PPLL1 =0, PPLL2=1, DCPLL=2, EXT_CLK=3 <= New + UCHAR ucTransmitterSel:2; //bit7:6: =0 Dig Transmitter 1 ( Uniphy AB ) + // =1 Dig Transmitter 2 ( Uniphy CD ) + // =2 Dig Transmitter 3 ( Uniphy EF ) +#endif +}ATOM_DIG_TRANSMITTER_CONFIG_V4; + +typedef struct _DIG_TRANSMITTER_CONTROL_PARAMETERS_V4 +{ + union + { + USHORT usPixelClock; // in 10KHz; for bios convenient + USHORT usInitInfo; // when init uniphy,lower 8bit is used for connector type defined in objectid.h + ATOM_DP_VS_MODE_V4 asMode; // DP Voltage swing mode Redefined comparing to previous version + }; + union + { + ATOM_DIG_TRANSMITTER_CONFIG_V4 acConfig; + UCHAR ucConfig; + }; + UCHAR ucAction; // define as ATOM_TRANSMITER_ACTION_XXX + UCHAR ucLaneNum; + UCHAR ucReserved[3]; +}DIG_TRANSMITTER_CONTROL_PARAMETERS_V4; + +//ucConfig +//Bit0 +#define ATOM_TRANSMITTER_CONFIG_V4_DUAL_LINK_CONNECTOR 0x01 +//Bit1 +#define ATOM_TRANSMITTER_CONFIG_V4_COHERENT 0x02 +//Bit2 +#define ATOM_TRANSMITTER_CONFIG_V4_LINK_SEL_MASK 0x04 +#define ATOM_TRANSMITTER_CONFIG_V4_LINKA 0x00 +#define ATOM_TRANSMITTER_CONFIG_V4_LINKB 0x04 +// Bit3 +#define ATOM_TRANSMITTER_CONFIG_V4_ENCODER_SEL_MASK 0x08 +#define ATOM_TRANSMITTER_CONFIG_V4_DIG1_ENCODER 0x00 +#define ATOM_TRANSMITTER_CONFIG_V4_DIG2_ENCODER 0x08 +// Bit5:4 +#define ATOM_TRANSMITTER_CONFIG_V4_REFCLK_SEL_MASK 0x30 +#define ATOM_TRANSMITTER_CONFIG_V4_P1PLL 0x00 +#define ATOM_TRANSMITTER_CONFIG_V4_P2PLL 0x10 +#define ATOM_TRANSMITTER_CONFIG_V4_DCPLL 0x20 // New in _V4 +#define ATOM_TRANSMITTER_CONFIG_V4_REFCLK_SRC_EXT 0x30 // Changed comparing to V3 +// Bit7:6 +#define ATOM_TRANSMITTER_CONFIG_V4_TRANSMITTER_SEL_MASK 0xC0 +#define ATOM_TRANSMITTER_CONFIG_V4_TRANSMITTER1 0x00 //AB +#define ATOM_TRANSMITTER_CONFIG_V4_TRANSMITTER2 0x40 //CD +#define ATOM_TRANSMITTER_CONFIG_V4_TRANSMITTER3 0x80 //EF + + +/****************************************************************************/ +// Structures used by ExternalEncoderControlTable V1.3 +// ASIC Families: Evergreen, Llano, NI +// ucTableFormatRevision=1 +// ucTableContentRevision=3 +/****************************************************************************/ + +typedef struct _EXTERNAL_ENCODER_CONTROL_PARAMETERS_V3 +{ + union{ + USHORT usPixelClock; // pixel clock in 10Khz, valid when ucAction=SETUP/ENABLE_OUTPUT + USHORT usConnectorId; // connector id, valid when ucAction = INIT + }; + UCHAR ucConfig; // indicate which encoder, and DP link rate when ucAction = SETUP/ENABLE_OUTPUT + UCHAR ucAction; // + UCHAR ucEncoderMode; // encoder mode, only used when ucAction = SETUP/ENABLE_OUTPUT + UCHAR ucLaneNum; // lane number, only used when ucAction = SETUP/ENABLE_OUTPUT + UCHAR ucBitPerColor; // output bit per color, only valid when ucAction = SETUP/ENABLE_OUTPUT and ucEncodeMode= DP + UCHAR ucReserved; +}EXTERNAL_ENCODER_CONTROL_PARAMETERS_V3; + +// ucAction +#define EXTERNAL_ENCODER_ACTION_V3_DISABLE_OUTPUT 0x00 +#define EXTERNAL_ENCODER_ACTION_V3_ENABLE_OUTPUT 0x01 +#define EXTERNAL_ENCODER_ACTION_V3_ENCODER_INIT 0x07 +#define EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP 0x0f +#define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING_OFF 0x10 +#define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING 0x11 +#define EXTERNAL_ENCODER_ACTION_V3_DACLOAD_DETECTION 0x12 +#define EXTERNAL_ENCODER_ACTION_V3_DDC_SETUP 0x14 + +// ucConfig +#define EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_MASK 0x03 +#define EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_1_62GHZ 0x00 +#define EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_2_70GHZ 0x01 +#define EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_5_40GHZ 0x02 +#define EXTERNAL_ENCODER_CONFIG_V3_ENCODER_SEL_MASK 0x70 +#define EXTERNAL_ENCODER_CONFIG_V3_ENCODER1 0x00 +#define EXTERNAL_ENCODER_CONFIG_V3_ENCODER2 0x10 +#define EXTERNAL_ENCODER_CONFIG_V3_ENCODER3 0x20 + +typedef struct _EXTERNAL_ENCODER_CONTROL_PS_ALLOCATION_V3 +{ + EXTERNAL_ENCODER_CONTROL_PARAMETERS_V3 sExtEncoder; + ULONG ulReserved[2]; +}EXTERNAL_ENCODER_CONTROL_PS_ALLOCATION_V3; + + +/****************************************************************************/ +// Structures used by DAC1OuputControlTable +// DAC2OuputControlTable +// LVTMAOutputControlTable (Before DEC30) +// TMDSAOutputControlTable (Before DEC30) +/****************************************************************************/ +typedef struct _DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +{ + UCHAR ucAction; // Possible input:ATOM_ENABLE||ATOMDISABLE + // When the display is LCD, in addition to above: + // ATOM_LCD_BLOFF|| ATOM_LCD_BLON ||ATOM_LCD_BL_BRIGHTNESS_CONTROL||ATOM_LCD_SELFTEST_START|| + // ATOM_LCD_SELFTEST_STOP + + UCHAR aucPadding[3]; // padding to DWORD aligned +}DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS; + +#define DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS + + +#define CRT1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +#define CRT1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION + +#define CRT2_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +#define CRT2_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION + +#define CV1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +#define CV1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION + +#define TV1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +#define TV1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION + +#define DFP1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +#define DFP1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION + +#define DFP2_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +#define DFP2_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION + +#define LCD1_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +#define LCD1_OUTPUT_CONTROL_PS_ALLOCATION DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION + +#define DVO_OUTPUT_CONTROL_PARAMETERS DISPLAY_DEVICE_OUTPUT_CONTROL_PARAMETERS +#define DVO_OUTPUT_CONTROL_PS_ALLOCATION DIG_TRANSMITTER_CONTROL_PS_ALLOCATION +#define DVO_OUTPUT_CONTROL_PARAMETERS_V3 DIG_TRANSMITTER_CONTROL_PARAMETERS + +/****************************************************************************/ +// Structures used by BlankCRTCTable +/****************************************************************************/ +typedef struct _BLANK_CRTC_PARAMETERS +{ + UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 + UCHAR ucBlanking; // ATOM_BLANKING or ATOM_BLANKINGOFF + USHORT usBlackColorRCr; + USHORT usBlackColorGY; + USHORT usBlackColorBCb; +}BLANK_CRTC_PARAMETERS; +#define BLANK_CRTC_PS_ALLOCATION BLANK_CRTC_PARAMETERS + +/****************************************************************************/ +// Structures used by EnableCRTCTable +// EnableCRTCMemReqTable +// UpdateCRTC_DoubleBufferRegistersTable +/****************************************************************************/ +typedef struct _ENABLE_CRTC_PARAMETERS +{ + UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE + UCHAR ucPadding[2]; +}ENABLE_CRTC_PARAMETERS; +#define ENABLE_CRTC_PS_ALLOCATION ENABLE_CRTC_PARAMETERS + +/****************************************************************************/ +// Structures used by SetCRTC_OverScanTable +/****************************************************************************/ +typedef struct _SET_CRTC_OVERSCAN_PARAMETERS +{ + USHORT usOverscanRight; // right + USHORT usOverscanLeft; // left + USHORT usOverscanBottom; // bottom + USHORT usOverscanTop; // top + UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 + UCHAR ucPadding[3]; +}SET_CRTC_OVERSCAN_PARAMETERS; +#define SET_CRTC_OVERSCAN_PS_ALLOCATION SET_CRTC_OVERSCAN_PARAMETERS + +/****************************************************************************/ +// Structures used by SetCRTC_ReplicationTable +/****************************************************************************/ +typedef struct _SET_CRTC_REPLICATION_PARAMETERS +{ + UCHAR ucH_Replication; // horizontal replication + UCHAR ucV_Replication; // vertical replication + UCHAR usCRTC; // ATOM_CRTC1 or ATOM_CRTC2 + UCHAR ucPadding; +}SET_CRTC_REPLICATION_PARAMETERS; +#define SET_CRTC_REPLICATION_PS_ALLOCATION SET_CRTC_REPLICATION_PARAMETERS + +/****************************************************************************/ +// Structures used by SelectCRTC_SourceTable +/****************************************************************************/ +typedef struct _SELECT_CRTC_SOURCE_PARAMETERS +{ + UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 + UCHAR ucDevice; // ATOM_DEVICE_CRT1|ATOM_DEVICE_CRT2|.... + UCHAR ucPadding[2]; +}SELECT_CRTC_SOURCE_PARAMETERS; +#define SELECT_CRTC_SOURCE_PS_ALLOCATION SELECT_CRTC_SOURCE_PARAMETERS + +typedef struct _SELECT_CRTC_SOURCE_PARAMETERS_V2 +{ + UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 + UCHAR ucEncoderID; // DAC1/DAC2/TVOUT/DIG1/DIG2/DVO + UCHAR ucEncodeMode; // Encoding mode, only valid when using DIG1/DIG2/DVO + UCHAR ucPadding; +}SELECT_CRTC_SOURCE_PARAMETERS_V2; + +//ucEncoderID +//#define ASIC_INT_DAC1_ENCODER_ID 0x00 +//#define ASIC_INT_TV_ENCODER_ID 0x02 +//#define ASIC_INT_DIG1_ENCODER_ID 0x03 +//#define ASIC_INT_DAC2_ENCODER_ID 0x04 +//#define ASIC_EXT_TV_ENCODER_ID 0x06 +//#define ASIC_INT_DVO_ENCODER_ID 0x07 +//#define ASIC_INT_DIG2_ENCODER_ID 0x09 +//#define ASIC_EXT_DIG_ENCODER_ID 0x05 + +//ucEncodeMode +//#define ATOM_ENCODER_MODE_DP 0 +//#define ATOM_ENCODER_MODE_LVDS 1 +//#define ATOM_ENCODER_MODE_DVI 2 +//#define ATOM_ENCODER_MODE_HDMI 3 +//#define ATOM_ENCODER_MODE_SDVO 4 +//#define ATOM_ENCODER_MODE_TV 13 +//#define ATOM_ENCODER_MODE_CV 14 +//#define ATOM_ENCODER_MODE_CRT 15 + +/****************************************************************************/ +// Structures used by SetPixelClockTable +// GetPixelClockTable +/****************************************************************************/ +//Major revision=1., Minor revision=1 +typedef struct _PIXEL_CLOCK_PARAMETERS +{ + USHORT usPixelClock; // in 10kHz unit; for bios convenient = (RefClk*FB_Div)/(Ref_Div*Post_Div) + // 0 means disable PPLL + USHORT usRefDiv; // Reference divider + USHORT usFbDiv; // feedback divider + UCHAR ucPostDiv; // post divider + UCHAR ucFracFbDiv; // fractional feedback divider + UCHAR ucPpll; // ATOM_PPLL1 or ATOM_PPL2 + UCHAR ucRefDivSrc; // ATOM_PJITTER or ATO_NONPJITTER + UCHAR ucCRTC; // Which CRTC uses this Ppll + UCHAR ucPadding; +}PIXEL_CLOCK_PARAMETERS; + +//Major revision=1., Minor revision=2, add ucMiscIfno +//ucMiscInfo: +#define MISC_FORCE_REPROG_PIXEL_CLOCK 0x1 +#define MISC_DEVICE_INDEX_MASK 0xF0 +#define MISC_DEVICE_INDEX_SHIFT 4 + +typedef struct _PIXEL_CLOCK_PARAMETERS_V2 +{ + USHORT usPixelClock; // in 10kHz unit; for bios convenient = (RefClk*FB_Div)/(Ref_Div*Post_Div) + // 0 means disable PPLL + USHORT usRefDiv; // Reference divider + USHORT usFbDiv; // feedback divider + UCHAR ucPostDiv; // post divider + UCHAR ucFracFbDiv; // fractional feedback divider + UCHAR ucPpll; // ATOM_PPLL1 or ATOM_PPL2 + UCHAR ucRefDivSrc; // ATOM_PJITTER or ATO_NONPJITTER + UCHAR ucCRTC; // Which CRTC uses this Ppll + UCHAR ucMiscInfo; // Different bits for different purpose, bit [7:4] as device index, bit[0]=Force prog +}PIXEL_CLOCK_PARAMETERS_V2; + +//Major revision=1., Minor revision=3, structure/definition change +//ucEncoderMode: +//ATOM_ENCODER_MODE_DP +//ATOM_ENOCDER_MODE_LVDS +//ATOM_ENOCDER_MODE_DVI +//ATOM_ENOCDER_MODE_HDMI +//ATOM_ENOCDER_MODE_SDVO +//ATOM_ENCODER_MODE_TV 13 +//ATOM_ENCODER_MODE_CV 14 +//ATOM_ENCODER_MODE_CRT 15 + +//ucDVOConfig +//#define DVO_ENCODER_CONFIG_RATE_SEL 0x01 +//#define DVO_ENCODER_CONFIG_DDR_SPEED 0x00 +//#define DVO_ENCODER_CONFIG_SDR_SPEED 0x01 +//#define DVO_ENCODER_CONFIG_OUTPUT_SEL 0x0c +//#define DVO_ENCODER_CONFIG_LOW12BIT 0x00 +//#define DVO_ENCODER_CONFIG_UPPER12BIT 0x04 +//#define DVO_ENCODER_CONFIG_24BIT 0x08 + +//ucMiscInfo: also changed, see below +#define PIXEL_CLOCK_MISC_FORCE_PROG_PPLL 0x01 +#define PIXEL_CLOCK_MISC_VGA_MODE 0x02 +#define PIXEL_CLOCK_MISC_CRTC_SEL_MASK 0x04 +#define PIXEL_CLOCK_MISC_CRTC_SEL_CRTC1 0x00 +#define PIXEL_CLOCK_MISC_CRTC_SEL_CRTC2 0x04 +#define PIXEL_CLOCK_MISC_USE_ENGINE_FOR_DISPCLK 0x08 +#define PIXEL_CLOCK_MISC_REF_DIV_SRC 0x10 +// V1.4 for RoadRunner +#define PIXEL_CLOCK_V4_MISC_SS_ENABLE 0x10 +#define PIXEL_CLOCK_V4_MISC_COHERENT_MODE 0x20 + + +typedef struct _PIXEL_CLOCK_PARAMETERS_V3 +{ + USHORT usPixelClock; // in 10kHz unit; for bios convenient = (RefClk*FB_Div)/(Ref_Div*Post_Div) + // 0 means disable PPLL. For VGA PPLL,make sure this value is not 0. + USHORT usRefDiv; // Reference divider + USHORT usFbDiv; // feedback divider + UCHAR ucPostDiv; // post divider + UCHAR ucFracFbDiv; // fractional feedback divider + UCHAR ucPpll; // ATOM_PPLL1 or ATOM_PPL2 + UCHAR ucTransmitterId; // graphic encoder id defined in objectId.h + union + { + UCHAR ucEncoderMode; // encoder type defined as ATOM_ENCODER_MODE_DP/DVI/HDMI/ + UCHAR ucDVOConfig; // when use DVO, need to know SDR/DDR, 12bit or 24bit + }; + UCHAR ucMiscInfo; // bit[0]=Force program, bit[1]= set pclk for VGA, b[2]= CRTC sel + // bit[3]=0:use PPLL for dispclk source, =1: use engine clock for dispclock source + // bit[4]=0:use XTALIN as the source of reference divider,=1 use the pre-defined clock as the source of reference divider +}PIXEL_CLOCK_PARAMETERS_V3; + +#define PIXEL_CLOCK_PARAMETERS_LAST PIXEL_CLOCK_PARAMETERS_V2 +#define GET_PIXEL_CLOCK_PS_ALLOCATION PIXEL_CLOCK_PARAMETERS_LAST + +typedef struct _PIXEL_CLOCK_PARAMETERS_V5 +{ + UCHAR ucCRTC; // ATOM_CRTC1~6, indicate the CRTC controller to + // drive the pixel clock. not used for DCPLL case. + union{ + UCHAR ucReserved; + UCHAR ucFracFbDiv; // [gphan] temporary to prevent build problem. remove it after driver code is changed. + }; + USHORT usPixelClock; // target the pixel clock to drive the CRTC timing + // 0 means disable PPLL/DCPLL. + USHORT usFbDiv; // feedback divider integer part. + UCHAR ucPostDiv; // post divider. + UCHAR ucRefDiv; // Reference divider + UCHAR ucPpll; // ATOM_PPLL1/ATOM_PPLL2/ATOM_DCPLL + UCHAR ucTransmitterID; // ASIC encoder id defined in objectId.h, + // indicate which graphic encoder will be used. + UCHAR ucEncoderMode; // Encoder mode: + UCHAR ucMiscInfo; // bit[0]= Force program PPLL + // bit[1]= when VGA timing is used. + // bit[3:2]= HDMI panel bit depth: =0: 24bpp =1:30bpp, =2:32bpp + // bit[4]= RefClock source for PPLL. + // =0: XTLAIN( default mode ) + // =1: other external clock source, which is pre-defined + // by VBIOS depend on the feature required. + // bit[7:5]: reserved. + ULONG ulFbDivDecFrac; // 20 bit feedback divider decimal fraction part, range from 1~999999 ( 0.000001 to 0.999999 ) + +}PIXEL_CLOCK_PARAMETERS_V5; + +#define PIXEL_CLOCK_V5_MISC_FORCE_PROG_PPLL 0x01 +#define PIXEL_CLOCK_V5_MISC_VGA_MODE 0x02 +#define PIXEL_CLOCK_V5_MISC_HDMI_BPP_MASK 0x0c +#define PIXEL_CLOCK_V5_MISC_HDMI_24BPP 0x00 +#define PIXEL_CLOCK_V5_MISC_HDMI_30BPP 0x04 +#define PIXEL_CLOCK_V5_MISC_HDMI_32BPP 0x08 +#define PIXEL_CLOCK_V5_MISC_REF_DIV_SRC 0x10 + +typedef struct _CRTC_PIXEL_CLOCK_FREQ +{ +#if ATOM_BIG_ENDIAN + ULONG ucCRTC:8; // ATOM_CRTC1~6, indicate the CRTC controller to + // drive the pixel clock. not used for DCPLL case. + ULONG ulPixelClock:24; // target the pixel clock to drive the CRTC timing. + // 0 means disable PPLL/DCPLL. Expanded to 24 bits comparing to previous version. +#else + ULONG ulPixelClock:24; // target the pixel clock to drive the CRTC timing. + // 0 means disable PPLL/DCPLL. Expanded to 24 bits comparing to previous version. + ULONG ucCRTC:8; // ATOM_CRTC1~6, indicate the CRTC controller to + // drive the pixel clock. not used for DCPLL case. +#endif +}CRTC_PIXEL_CLOCK_FREQ; + +typedef struct _PIXEL_CLOCK_PARAMETERS_V6 +{ + union{ + CRTC_PIXEL_CLOCK_FREQ ulCrtcPclkFreq; // pixel clock and CRTC id frequency + ULONG ulDispEngClkFreq; // dispclk frequency + }; + USHORT usFbDiv; // feedback divider integer part. + UCHAR ucPostDiv; // post divider. + UCHAR ucRefDiv; // Reference divider + UCHAR ucPpll; // ATOM_PPLL1/ATOM_PPLL2/ATOM_DCPLL + UCHAR ucTransmitterID; // ASIC encoder id defined in objectId.h, + // indicate which graphic encoder will be used. + UCHAR ucEncoderMode; // Encoder mode: + UCHAR ucMiscInfo; // bit[0]= Force program PPLL + // bit[1]= when VGA timing is used. + // bit[3:2]= HDMI panel bit depth: =0: 24bpp =1:30bpp, =2:32bpp + // bit[4]= RefClock source for PPLL. + // =0: XTLAIN( default mode ) + // =1: other external clock source, which is pre-defined + // by VBIOS depend on the feature required. + // bit[7:5]: reserved. + ULONG ulFbDivDecFrac; // 20 bit feedback divider decimal fraction part, range from 1~999999 ( 0.000001 to 0.999999 ) + +}PIXEL_CLOCK_PARAMETERS_V6; + +#define PIXEL_CLOCK_V6_MISC_FORCE_PROG_PPLL 0x01 +#define PIXEL_CLOCK_V6_MISC_VGA_MODE 0x02 +#define PIXEL_CLOCK_V6_MISC_HDMI_BPP_MASK 0x0c +#define PIXEL_CLOCK_V6_MISC_HDMI_24BPP 0x00 +#define PIXEL_CLOCK_V6_MISC_HDMI_36BPP 0x04 +#define PIXEL_CLOCK_V6_MISC_HDMI_30BPP 0x08 +#define PIXEL_CLOCK_V6_MISC_HDMI_48BPP 0x0c +#define PIXEL_CLOCK_V6_MISC_REF_DIV_SRC 0x10 + +typedef struct _GET_DISP_PLL_STATUS_INPUT_PARAMETERS_V2 +{ + PIXEL_CLOCK_PARAMETERS_V3 sDispClkInput; +}GET_DISP_PLL_STATUS_INPUT_PARAMETERS_V2; + +typedef struct _GET_DISP_PLL_STATUS_OUTPUT_PARAMETERS_V2 +{ + UCHAR ucStatus; + UCHAR ucRefDivSrc; // =1: reference clock source from XTALIN, =0: source from PCIE ref clock + UCHAR ucReserved[2]; +}GET_DISP_PLL_STATUS_OUTPUT_PARAMETERS_V2; + +typedef struct _GET_DISP_PLL_STATUS_INPUT_PARAMETERS_V3 +{ + PIXEL_CLOCK_PARAMETERS_V5 sDispClkInput; +}GET_DISP_PLL_STATUS_INPUT_PARAMETERS_V3; + +/****************************************************************************/ +// Structures used by AdjustDisplayPllTable +/****************************************************************************/ +typedef struct _ADJUST_DISPLAY_PLL_PARAMETERS +{ + USHORT usPixelClock; + UCHAR ucTransmitterID; + UCHAR ucEncodeMode; + union + { + UCHAR ucDVOConfig; //if DVO, need passing link rate and output 12bitlow or 24bit + UCHAR ucConfig; //if none DVO, not defined yet + }; + UCHAR ucReserved[3]; +}ADJUST_DISPLAY_PLL_PARAMETERS; + +#define ADJUST_DISPLAY_CONFIG_SS_ENABLE 0x10 +#define ADJUST_DISPLAY_PLL_PS_ALLOCATION ADJUST_DISPLAY_PLL_PARAMETERS + +typedef struct _ADJUST_DISPLAY_PLL_INPUT_PARAMETERS_V3 +{ + USHORT usPixelClock; // target pixel clock + UCHAR ucTransmitterID; // GPU transmitter id defined in objectid.h + UCHAR ucEncodeMode; // encoder mode: CRT, LVDS, DP, TMDS or HDMI + UCHAR ucDispPllConfig; // display pll configure parameter defined as following DISPPLL_CONFIG_XXXX + UCHAR ucExtTransmitterID; // external encoder id. + UCHAR ucReserved[2]; +}ADJUST_DISPLAY_PLL_INPUT_PARAMETERS_V3; + +// usDispPllConfig v1.2 for RoadRunner +#define DISPPLL_CONFIG_DVO_RATE_SEL 0x0001 // need only when ucTransmitterID = DVO +#define DISPPLL_CONFIG_DVO_DDR_SPEED 0x0000 // need only when ucTransmitterID = DVO +#define DISPPLL_CONFIG_DVO_SDR_SPEED 0x0001 // need only when ucTransmitterID = DVO +#define DISPPLL_CONFIG_DVO_OUTPUT_SEL 0x000c // need only when ucTransmitterID = DVO +#define DISPPLL_CONFIG_DVO_LOW12BIT 0x0000 // need only when ucTransmitterID = DVO +#define DISPPLL_CONFIG_DVO_UPPER12BIT 0x0004 // need only when ucTransmitterID = DVO +#define DISPPLL_CONFIG_DVO_24BIT 0x0008 // need only when ucTransmitterID = DVO +#define DISPPLL_CONFIG_SS_ENABLE 0x0010 // Only used when ucEncoderMode = DP or LVDS +#define DISPPLL_CONFIG_COHERENT_MODE 0x0020 // Only used when ucEncoderMode = TMDS or HDMI +#define DISPPLL_CONFIG_DUAL_LINK 0x0040 // Only used when ucEncoderMode = TMDS or LVDS + + +typedef struct _ADJUST_DISPLAY_PLL_OUTPUT_PARAMETERS_V3 +{ + ULONG ulDispPllFreq; // return display PPLL freq which is used to generate the pixclock, and related idclk, symclk etc + UCHAR ucRefDiv; // if it is none-zero, it is used to be calculated the other ppll parameter fb_divider and post_div ( if it is not given ) + UCHAR ucPostDiv; // if it is none-zero, it is used to be calculated the other ppll parameter fb_divider + UCHAR ucReserved[2]; +}ADJUST_DISPLAY_PLL_OUTPUT_PARAMETERS_V3; + +typedef struct _ADJUST_DISPLAY_PLL_PS_ALLOCATION_V3 +{ + union + { + ADJUST_DISPLAY_PLL_INPUT_PARAMETERS_V3 sInput; + ADJUST_DISPLAY_PLL_OUTPUT_PARAMETERS_V3 sOutput; + }; +} ADJUST_DISPLAY_PLL_PS_ALLOCATION_V3; + +/****************************************************************************/ +// Structures used by EnableYUVTable +/****************************************************************************/ +typedef struct _ENABLE_YUV_PARAMETERS +{ + UCHAR ucEnable; // ATOM_ENABLE:Enable YUV or ATOM_DISABLE:Disable YUV (RGB) + UCHAR ucCRTC; // Which CRTC needs this YUV or RGB format + UCHAR ucPadding[2]; +}ENABLE_YUV_PARAMETERS; +#define ENABLE_YUV_PS_ALLOCATION ENABLE_YUV_PARAMETERS + +/****************************************************************************/ +// Structures used by GetMemoryClockTable +/****************************************************************************/ +typedef struct _GET_MEMORY_CLOCK_PARAMETERS +{ + ULONG ulReturnMemoryClock; // current memory speed in 10KHz unit +} GET_MEMORY_CLOCK_PARAMETERS; +#define GET_MEMORY_CLOCK_PS_ALLOCATION GET_MEMORY_CLOCK_PARAMETERS + +/****************************************************************************/ +// Structures used by GetEngineClockTable +/****************************************************************************/ +typedef struct _GET_ENGINE_CLOCK_PARAMETERS +{ + ULONG ulReturnEngineClock; // current engine speed in 10KHz unit +} GET_ENGINE_CLOCK_PARAMETERS; +#define GET_ENGINE_CLOCK_PS_ALLOCATION GET_ENGINE_CLOCK_PARAMETERS + +/****************************************************************************/ +// Following Structures and constant may be obsolete +/****************************************************************************/ +//Maxium 8 bytes,the data read in will be placed in the parameter space. +//Read operaion successeful when the paramter space is non-zero, otherwise read operation failed +typedef struct _READ_EDID_FROM_HW_I2C_DATA_PARAMETERS +{ + USHORT usPrescale; //Ratio between Engine clock and I2C clock + USHORT usVRAMAddress; //Address in Frame Buffer where to pace raw EDID + USHORT usStatus; //When use output: lower byte EDID checksum, high byte hardware status + //WHen use input: lower byte as 'byte to read':currently limited to 128byte or 1byte + UCHAR ucSlaveAddr; //Read from which slave + UCHAR ucLineNumber; //Read from which HW assisted line +}READ_EDID_FROM_HW_I2C_DATA_PARAMETERS; +#define READ_EDID_FROM_HW_I2C_DATA_PS_ALLOCATION READ_EDID_FROM_HW_I2C_DATA_PARAMETERS + + +#define ATOM_WRITE_I2C_FORMAT_PSOFFSET_PSDATABYTE 0 +#define ATOM_WRITE_I2C_FORMAT_PSOFFSET_PSTWODATABYTES 1 +#define ATOM_WRITE_I2C_FORMAT_PSCOUNTER_PSOFFSET_IDDATABLOCK 2 +#define ATOM_WRITE_I2C_FORMAT_PSCOUNTER_IDOFFSET_PLUS_IDDATABLOCK 3 +#define ATOM_WRITE_I2C_FORMAT_IDCOUNTER_IDOFFSET_IDDATABLOCK 4 + +typedef struct _WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS +{ + USHORT usPrescale; //Ratio between Engine clock and I2C clock + USHORT usByteOffset; //Write to which byte + //Upper portion of usByteOffset is Format of data + //1bytePS+offsetPS + //2bytesPS+offsetPS + //blockID+offsetPS + //blockID+offsetID + //blockID+counterID+offsetID + UCHAR ucData; //PS data1 + UCHAR ucStatus; //Status byte 1=success, 2=failure, Also is used as PS data2 + UCHAR ucSlaveAddr; //Write to which slave + UCHAR ucLineNumber; //Write from which HW assisted line +}WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS; + +#define WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS + +typedef struct _SET_UP_HW_I2C_DATA_PARAMETERS +{ + USHORT usPrescale; //Ratio between Engine clock and I2C clock + UCHAR ucSlaveAddr; //Write to which slave + UCHAR ucLineNumber; //Write from which HW assisted line +}SET_UP_HW_I2C_DATA_PARAMETERS; + + +/**************************************************************************/ +#define SPEED_FAN_CONTROL_PS_ALLOCATION WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS + + +/****************************************************************************/ +// Structures used by PowerConnectorDetectionTable +/****************************************************************************/ +typedef struct _POWER_CONNECTOR_DETECTION_PARAMETERS +{ + UCHAR ucPowerConnectorStatus; //Used for return value 0: detected, 1:not detected + UCHAR ucPwrBehaviorId; + USHORT usPwrBudget; //how much power currently boot to in unit of watt +}POWER_CONNECTOR_DETECTION_PARAMETERS; + +typedef struct POWER_CONNECTOR_DETECTION_PS_ALLOCATION +{ + UCHAR ucPowerConnectorStatus; //Used for return value 0: detected, 1:not detected + UCHAR ucReserved; + USHORT usPwrBudget; //how much power currently boot to in unit of watt + WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; +}POWER_CONNECTOR_DETECTION_PS_ALLOCATION; + +/****************************LVDS SS Command Table Definitions**********************/ + +/****************************************************************************/ +// Structures used by EnableSpreadSpectrumOnPPLLTable +/****************************************************************************/ +typedef struct _ENABLE_LVDS_SS_PARAMETERS +{ + USHORT usSpreadSpectrumPercentage; + UCHAR ucSpreadSpectrumType; //Bit1=0 Down Spread,=1 Center Spread. Bit1=1 Ext. =0 Int. Others:TBD + UCHAR ucSpreadSpectrumStepSize_Delay; //bits3:2 SS_STEP_SIZE; bit 6:4 SS_DELAY + UCHAR ucEnable; //ATOM_ENABLE or ATOM_DISABLE + UCHAR ucPadding[3]; +}ENABLE_LVDS_SS_PARAMETERS; + +//ucTableFormatRevision=1,ucTableContentRevision=2 +typedef struct _ENABLE_LVDS_SS_PARAMETERS_V2 +{ + USHORT usSpreadSpectrumPercentage; + UCHAR ucSpreadSpectrumType; //Bit1=0 Down Spread,=1 Center Spread. Bit1=1 Ext. =0 Int. Others:TBD + UCHAR ucSpreadSpectrumStep; // + UCHAR ucEnable; //ATOM_ENABLE or ATOM_DISABLE + UCHAR ucSpreadSpectrumDelay; + UCHAR ucSpreadSpectrumRange; + UCHAR ucPadding; +}ENABLE_LVDS_SS_PARAMETERS_V2; + +//This new structure is based on ENABLE_LVDS_SS_PARAMETERS but expands to SS on PPLL, so other devices can use SS. +typedef struct _ENABLE_SPREAD_SPECTRUM_ON_PPLL +{ + USHORT usSpreadSpectrumPercentage; + UCHAR ucSpreadSpectrumType; // Bit1=0 Down Spread,=1 Center Spread. Bit1=1 Ext. =0 Int. Others:TBD + UCHAR ucSpreadSpectrumStep; // + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE + UCHAR ucSpreadSpectrumDelay; + UCHAR ucSpreadSpectrumRange; + UCHAR ucPpll; // ATOM_PPLL1/ATOM_PPLL2 +}ENABLE_SPREAD_SPECTRUM_ON_PPLL; + +typedef struct _ENABLE_SPREAD_SPECTRUM_ON_PPLL_V2 +{ + USHORT usSpreadSpectrumPercentage; + UCHAR ucSpreadSpectrumType; // Bit[0]: 0-Down Spread,1-Center Spread. + // Bit[1]: 1-Ext. 0-Int. + // Bit[3:2]: =0 P1PLL =1 P2PLL =2 DCPLL + // Bits[7:4] reserved + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE + USHORT usSpreadSpectrumAmount; // Includes SS_AMOUNT_FBDIV[7:0] and SS_AMOUNT_NFRAC_SLIP[11:8] + USHORT usSpreadSpectrumStep; // SS_STEP_SIZE_DSFRAC +}ENABLE_SPREAD_SPECTRUM_ON_PPLL_V2; + +#define ATOM_PPLL_SS_TYPE_V2_DOWN_SPREAD 0x00 +#define ATOM_PPLL_SS_TYPE_V2_CENTRE_SPREAD 0x01 +#define ATOM_PPLL_SS_TYPE_V2_EXT_SPREAD 0x02 +#define ATOM_PPLL_SS_TYPE_V2_PPLL_SEL_MASK 0x0c +#define ATOM_PPLL_SS_TYPE_V2_P1PLL 0x00 +#define ATOM_PPLL_SS_TYPE_V2_P2PLL 0x04 +#define ATOM_PPLL_SS_TYPE_V2_DCPLL 0x08 +#define ATOM_PPLL_SS_AMOUNT_V2_FBDIV_MASK 0x00FF +#define ATOM_PPLL_SS_AMOUNT_V2_FBDIV_SHIFT 0 +#define ATOM_PPLL_SS_AMOUNT_V2_NFRAC_MASK 0x0F00 +#define ATOM_PPLL_SS_AMOUNT_V2_NFRAC_SHIFT 8 + +// Used by DCE5.0 + typedef struct _ENABLE_SPREAD_SPECTRUM_ON_PPLL_V3 +{ + USHORT usSpreadSpectrumAmountFrac; // SS_AMOUNT_DSFRAC New in DCE5.0 + UCHAR ucSpreadSpectrumType; // Bit[0]: 0-Down Spread,1-Center Spread. + // Bit[1]: 1-Ext. 0-Int. + // Bit[3:2]: =0 P1PLL =1 P2PLL =2 DCPLL + // Bits[7:4] reserved + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE + USHORT usSpreadSpectrumAmount; // Includes SS_AMOUNT_FBDIV[7:0] and SS_AMOUNT_NFRAC_SLIP[11:8] + USHORT usSpreadSpectrumStep; // SS_STEP_SIZE_DSFRAC +}ENABLE_SPREAD_SPECTRUM_ON_PPLL_V3; + +#define ATOM_PPLL_SS_TYPE_V3_DOWN_SPREAD 0x00 +#define ATOM_PPLL_SS_TYPE_V3_CENTRE_SPREAD 0x01 +#define ATOM_PPLL_SS_TYPE_V3_EXT_SPREAD 0x02 +#define ATOM_PPLL_SS_TYPE_V3_PPLL_SEL_MASK 0x0c +#define ATOM_PPLL_SS_TYPE_V3_P1PLL 0x00 +#define ATOM_PPLL_SS_TYPE_V3_P2PLL 0x04 +#define ATOM_PPLL_SS_TYPE_V3_DCPLL 0x08 +#define ATOM_PPLL_SS_AMOUNT_V3_FBDIV_MASK 0x00FF +#define ATOM_PPLL_SS_AMOUNT_V3_FBDIV_SHIFT 0 +#define ATOM_PPLL_SS_AMOUNT_V3_NFRAC_MASK 0x0F00 +#define ATOM_PPLL_SS_AMOUNT_V3_NFRAC_SHIFT 8 + +#define ENABLE_SPREAD_SPECTRUM_ON_PPLL_PS_ALLOCATION ENABLE_SPREAD_SPECTRUM_ON_PPLL + +/**************************************************************************/ + +typedef struct _SET_PIXEL_CLOCK_PS_ALLOCATION +{ + PIXEL_CLOCK_PARAMETERS sPCLKInput; + ENABLE_SPREAD_SPECTRUM_ON_PPLL sReserved;//Caller doesn't need to init this portion +}SET_PIXEL_CLOCK_PS_ALLOCATION; + +#define ENABLE_VGA_RENDER_PS_ALLOCATION SET_PIXEL_CLOCK_PS_ALLOCATION + +/****************************************************************************/ +// Structures used by ### +/****************************************************************************/ +typedef struct _MEMORY_TRAINING_PARAMETERS +{ + ULONG ulTargetMemoryClock; //In 10Khz unit +}MEMORY_TRAINING_PARAMETERS; +#define MEMORY_TRAINING_PS_ALLOCATION MEMORY_TRAINING_PARAMETERS + + +/****************************LVDS and other encoder command table definitions **********************/ + + +/****************************************************************************/ +// Structures used by LVDSEncoderControlTable (Before DCE30) +// LVTMAEncoderControlTable (Before DCE30) +// TMDSAEncoderControlTable (Before DCE30) +/****************************************************************************/ +typedef struct _LVDS_ENCODER_CONTROL_PARAMETERS +{ + USHORT usPixelClock; // in 10KHz; for bios convenient + UCHAR ucMisc; // bit0=0: Enable single link + // =1: Enable dual link + // Bit1=0: 666RGB + // =1: 888RGB + UCHAR ucAction; // 0: turn off encoder + // 1: setup and turn on encoder +}LVDS_ENCODER_CONTROL_PARAMETERS; + +#define LVDS_ENCODER_CONTROL_PS_ALLOCATION LVDS_ENCODER_CONTROL_PARAMETERS + +#define TMDS1_ENCODER_CONTROL_PARAMETERS LVDS_ENCODER_CONTROL_PARAMETERS +#define TMDS1_ENCODER_CONTROL_PS_ALLOCATION TMDS1_ENCODER_CONTROL_PARAMETERS + +#define TMDS2_ENCODER_CONTROL_PARAMETERS TMDS1_ENCODER_CONTROL_PARAMETERS +#define TMDS2_ENCODER_CONTROL_PS_ALLOCATION TMDS2_ENCODER_CONTROL_PARAMETERS + + +//ucTableFormatRevision=1,ucTableContentRevision=2 +typedef struct _LVDS_ENCODER_CONTROL_PARAMETERS_V2 +{ + USHORT usPixelClock; // in 10KHz; for bios convenient + UCHAR ucMisc; // see PANEL_ENCODER_MISC_xx defintions below + UCHAR ucAction; // 0: turn off encoder + // 1: setup and turn on encoder + UCHAR ucTruncate; // bit0=0: Disable truncate + // =1: Enable truncate + // bit4=0: 666RGB + // =1: 888RGB + UCHAR ucSpatial; // bit0=0: Disable spatial dithering + // =1: Enable spatial dithering + // bit4=0: 666RGB + // =1: 888RGB + UCHAR ucTemporal; // bit0=0: Disable temporal dithering + // =1: Enable temporal dithering + // bit4=0: 666RGB + // =1: 888RGB + // bit5=0: Gray level 2 + // =1: Gray level 4 + UCHAR ucFRC; // bit4=0: 25FRC_SEL pattern E + // =1: 25FRC_SEL pattern F + // bit6:5=0: 50FRC_SEL pattern A + // =1: 50FRC_SEL pattern B + // =2: 50FRC_SEL pattern C + // =3: 50FRC_SEL pattern D + // bit7=0: 75FRC_SEL pattern E + // =1: 75FRC_SEL pattern F +}LVDS_ENCODER_CONTROL_PARAMETERS_V2; + +#define LVDS_ENCODER_CONTROL_PS_ALLOCATION_V2 LVDS_ENCODER_CONTROL_PARAMETERS_V2 + +#define TMDS1_ENCODER_CONTROL_PARAMETERS_V2 LVDS_ENCODER_CONTROL_PARAMETERS_V2 +#define TMDS1_ENCODER_CONTROL_PS_ALLOCATION_V2 TMDS1_ENCODER_CONTROL_PARAMETERS_V2 + +#define TMDS2_ENCODER_CONTROL_PARAMETERS_V2 TMDS1_ENCODER_CONTROL_PARAMETERS_V2 +#define TMDS2_ENCODER_CONTROL_PS_ALLOCATION_V2 TMDS2_ENCODER_CONTROL_PARAMETERS_V2 + +#define LVDS_ENCODER_CONTROL_PARAMETERS_V3 LVDS_ENCODER_CONTROL_PARAMETERS_V2 +#define LVDS_ENCODER_CONTROL_PS_ALLOCATION_V3 LVDS_ENCODER_CONTROL_PARAMETERS_V3 + +#define TMDS1_ENCODER_CONTROL_PARAMETERS_V3 LVDS_ENCODER_CONTROL_PARAMETERS_V3 +#define TMDS1_ENCODER_CONTROL_PS_ALLOCATION_V3 TMDS1_ENCODER_CONTROL_PARAMETERS_V3 + +#define TMDS2_ENCODER_CONTROL_PARAMETERS_V3 LVDS_ENCODER_CONTROL_PARAMETERS_V3 +#define TMDS2_ENCODER_CONTROL_PS_ALLOCATION_V3 TMDS2_ENCODER_CONTROL_PARAMETERS_V3 + +/****************************************************************************/ +// Structures used by ### +/****************************************************************************/ +typedef struct _ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS +{ + UCHAR ucEnable; // Enable or Disable External TMDS encoder + UCHAR ucMisc; // Bit0=0:Enable Single link;=1:Enable Dual link;Bit1 {=0:666RGB, =1:888RGB} + UCHAR ucPadding[2]; +}ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS; + +typedef struct _ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION +{ + ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS sXTmdsEncoder; + WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; //Caller doesn't need to init this portion +}ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION; + +#define ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS_V2 LVDS_ENCODER_CONTROL_PARAMETERS_V2 + +typedef struct _ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION_V2 +{ + ENABLE_EXTERNAL_TMDS_ENCODER_PARAMETERS_V2 sXTmdsEncoder; + WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; //Caller doesn't need to init this portion +}ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION_V2; + +typedef struct _EXTERNAL_ENCODER_CONTROL_PS_ALLOCATION +{ + DIG_ENCODER_CONTROL_PARAMETERS sDigEncoder; + WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; +}EXTERNAL_ENCODER_CONTROL_PS_ALLOCATION; + +/****************************************************************************/ +// Structures used by DVOEncoderControlTable +/****************************************************************************/ +//ucTableFormatRevision=1,ucTableContentRevision=3 + +//ucDVOConfig: +#define DVO_ENCODER_CONFIG_RATE_SEL 0x01 +#define DVO_ENCODER_CONFIG_DDR_SPEED 0x00 +#define DVO_ENCODER_CONFIG_SDR_SPEED 0x01 +#define DVO_ENCODER_CONFIG_OUTPUT_SEL 0x0c +#define DVO_ENCODER_CONFIG_LOW12BIT 0x00 +#define DVO_ENCODER_CONFIG_UPPER12BIT 0x04 +#define DVO_ENCODER_CONFIG_24BIT 0x08 + +typedef struct _DVO_ENCODER_CONTROL_PARAMETERS_V3 +{ + USHORT usPixelClock; + UCHAR ucDVOConfig; + UCHAR ucAction; //ATOM_ENABLE/ATOM_DISABLE/ATOM_HPD_INIT + UCHAR ucReseved[4]; +}DVO_ENCODER_CONTROL_PARAMETERS_V3; +#define DVO_ENCODER_CONTROL_PS_ALLOCATION_V3 DVO_ENCODER_CONTROL_PARAMETERS_V3 + +//ucTableFormatRevision=1 +//ucTableContentRevision=3 structure is not changed but usMisc add bit 1 as another input for +// bit1=0: non-coherent mode +// =1: coherent mode + +//========================================================================================== +//Only change is here next time when changing encoder parameter definitions again! +#define LVDS_ENCODER_CONTROL_PARAMETERS_LAST LVDS_ENCODER_CONTROL_PARAMETERS_V3 +#define LVDS_ENCODER_CONTROL_PS_ALLOCATION_LAST LVDS_ENCODER_CONTROL_PARAMETERS_LAST + +#define TMDS1_ENCODER_CONTROL_PARAMETERS_LAST LVDS_ENCODER_CONTROL_PARAMETERS_V3 +#define TMDS1_ENCODER_CONTROL_PS_ALLOCATION_LAST TMDS1_ENCODER_CONTROL_PARAMETERS_LAST + +#define TMDS2_ENCODER_CONTROL_PARAMETERS_LAST LVDS_ENCODER_CONTROL_PARAMETERS_V3 +#define TMDS2_ENCODER_CONTROL_PS_ALLOCATION_LAST TMDS2_ENCODER_CONTROL_PARAMETERS_LAST + +#define DVO_ENCODER_CONTROL_PARAMETERS_LAST DVO_ENCODER_CONTROL_PARAMETERS +#define DVO_ENCODER_CONTROL_PS_ALLOCATION_LAST DVO_ENCODER_CONTROL_PS_ALLOCATION + +//========================================================================================== +#define PANEL_ENCODER_MISC_DUAL 0x01 +#define PANEL_ENCODER_MISC_COHERENT 0x02 +#define PANEL_ENCODER_MISC_TMDS_LINKB 0x04 +#define PANEL_ENCODER_MISC_HDMI_TYPE 0x08 + +#define PANEL_ENCODER_ACTION_DISABLE ATOM_DISABLE +#define PANEL_ENCODER_ACTION_ENABLE ATOM_ENABLE +#define PANEL_ENCODER_ACTION_COHERENTSEQ (ATOM_ENABLE+1) + +#define PANEL_ENCODER_TRUNCATE_EN 0x01 +#define PANEL_ENCODER_TRUNCATE_DEPTH 0x10 +#define PANEL_ENCODER_SPATIAL_DITHER_EN 0x01 +#define PANEL_ENCODER_SPATIAL_DITHER_DEPTH 0x10 +#define PANEL_ENCODER_TEMPORAL_DITHER_EN 0x01 +#define PANEL_ENCODER_TEMPORAL_DITHER_DEPTH 0x10 +#define PANEL_ENCODER_TEMPORAL_LEVEL_4 0x20 +#define PANEL_ENCODER_25FRC_MASK 0x10 +#define PANEL_ENCODER_25FRC_E 0x00 +#define PANEL_ENCODER_25FRC_F 0x10 +#define PANEL_ENCODER_50FRC_MASK 0x60 +#define PANEL_ENCODER_50FRC_A 0x00 +#define PANEL_ENCODER_50FRC_B 0x20 +#define PANEL_ENCODER_50FRC_C 0x40 +#define PANEL_ENCODER_50FRC_D 0x60 +#define PANEL_ENCODER_75FRC_MASK 0x80 +#define PANEL_ENCODER_75FRC_E 0x00 +#define PANEL_ENCODER_75FRC_F 0x80 + +/****************************************************************************/ +// Structures used by SetVoltageTable +/****************************************************************************/ +#define SET_VOLTAGE_TYPE_ASIC_VDDC 1 +#define SET_VOLTAGE_TYPE_ASIC_MVDDC 2 +#define SET_VOLTAGE_TYPE_ASIC_MVDDQ 3 +#define SET_VOLTAGE_TYPE_ASIC_VDDCI 4 +#define SET_VOLTAGE_INIT_MODE 5 +#define SET_VOLTAGE_GET_MAX_VOLTAGE 6 //Gets the Max. voltage for the soldered Asic + +#define SET_ASIC_VOLTAGE_MODE_ALL_SOURCE 0x1 +#define SET_ASIC_VOLTAGE_MODE_SOURCE_A 0x2 +#define SET_ASIC_VOLTAGE_MODE_SOURCE_B 0x4 + +#define SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE 0x0 +#define SET_ASIC_VOLTAGE_MODE_GET_GPIOVAL 0x1 +#define SET_ASIC_VOLTAGE_MODE_GET_GPIOMASK 0x2 + +typedef struct _SET_VOLTAGE_PARAMETERS +{ + UCHAR ucVoltageType; // To tell which voltage to set up, VDDC/MVDDC/MVDDQ + UCHAR ucVoltageMode; // To set all, to set source A or source B or ... + UCHAR ucVoltageIndex; // An index to tell which voltage level + UCHAR ucReserved; +}SET_VOLTAGE_PARAMETERS; + +typedef struct _SET_VOLTAGE_PARAMETERS_V2 +{ + UCHAR ucVoltageType; // To tell which voltage to set up, VDDC/MVDDC/MVDDQ + UCHAR ucVoltageMode; // Not used, maybe use for state machine for differen power mode + USHORT usVoltageLevel; // real voltage level +}SET_VOLTAGE_PARAMETERS_V2; + +typedef struct _SET_VOLTAGE_PS_ALLOCATION +{ + SET_VOLTAGE_PARAMETERS sASICSetVoltage; + WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; +}SET_VOLTAGE_PS_ALLOCATION; + +/****************************************************************************/ +// Structures used by TVEncoderControlTable +/****************************************************************************/ +typedef struct _TV_ENCODER_CONTROL_PARAMETERS +{ + USHORT usPixelClock; // in 10KHz; for bios convenient + UCHAR ucTvStandard; // See definition "ATOM_TV_NTSC ..." + UCHAR ucAction; // 0: turn off encoder + // 1: setup and turn on encoder +}TV_ENCODER_CONTROL_PARAMETERS; + +typedef struct _TV_ENCODER_CONTROL_PS_ALLOCATION +{ + TV_ENCODER_CONTROL_PARAMETERS sTVEncoder; + WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; // Don't set this one +}TV_ENCODER_CONTROL_PS_ALLOCATION; + +//==============================Data Table Portion==================================== + +/****************************************************************************/ +// Structure used in Data.mtb +/****************************************************************************/ +typedef struct _ATOM_MASTER_LIST_OF_DATA_TABLES +{ + USHORT UtilityPipeLine; // Offest for the utility to get parser info,Don't change this position! + USHORT MultimediaCapabilityInfo; // Only used by MM Lib,latest version 1.1, not configuable from Bios, need to include the table to build Bios + USHORT MultimediaConfigInfo; // Only used by MM Lib,latest version 2.1, not configuable from Bios, need to include the table to build Bios + USHORT StandardVESA_Timing; // Only used by Bios + USHORT FirmwareInfo; // Shared by various SW components,latest version 1.4 + USHORT DAC_Info; // Will be obsolete from R600 + USHORT LCD_Info; // Shared by various SW components,latest version 1.3, was called LVDS_Info + USHORT TMDS_Info; // Will be obsolete from R600 + USHORT AnalogTV_Info; // Shared by various SW components,latest version 1.1 + USHORT SupportedDevicesInfo; // Will be obsolete from R600 + USHORT GPIO_I2C_Info; // Shared by various SW components,latest version 1.2 will be used from R600 + USHORT VRAM_UsageByFirmware; // Shared by various SW components,latest version 1.3 will be used from R600 + USHORT GPIO_Pin_LUT; // Shared by various SW components,latest version 1.1 + USHORT VESA_ToInternalModeLUT; // Only used by Bios + USHORT ComponentVideoInfo; // Shared by various SW components,latest version 2.1 will be used from R600 + USHORT PowerPlayInfo; // Shared by various SW components,latest version 2.1,new design from R600 + USHORT CompassionateData; // Will be obsolete from R600 + USHORT SaveRestoreInfo; // Only used by Bios + USHORT PPLL_SS_Info; // Shared by various SW components,latest version 1.2, used to call SS_Info, change to new name because of int ASIC SS info + USHORT OemInfo; // Defined and used by external SW, should be obsolete soon + USHORT XTMDS_Info; // Will be obsolete from R600 + USHORT MclkSS_Info; // Shared by various SW components,latest version 1.1, only enabled when ext SS chip is used + USHORT Object_Header; // Shared by various SW components,latest version 1.1 + USHORT IndirectIOAccess; // Only used by Bios,this table position can't change at all!! + USHORT MC_InitParameter; // Only used by command table + USHORT ASIC_VDDC_Info; // Will be obsolete from R600 + USHORT ASIC_InternalSS_Info; // New tabel name from R600, used to be called "ASIC_MVDDC_Info" + USHORT TV_VideoMode; // Only used by command table + USHORT VRAM_Info; // Only used by command table, latest version 1.3 + USHORT MemoryTrainingInfo; // Used for VBIOS and Diag utility for memory training purpose since R600. the new table rev start from 2.1 + USHORT IntegratedSystemInfo; // Shared by various SW components + USHORT ASIC_ProfilingInfo; // New table name from R600, used to be called "ASIC_VDDCI_Info" for pre-R600 + USHORT VoltageObjectInfo; // Shared by various SW components, latest version 1.1 + USHORT PowerSourceInfo; // Shared by various SW components, latest versoin 1.1 +}ATOM_MASTER_LIST_OF_DATA_TABLES; + +// For backward compatible +#define LVDS_Info LCD_Info + +typedef struct _ATOM_MASTER_DATA_TABLE +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_MASTER_LIST_OF_DATA_TABLES ListOfDataTables; +}ATOM_MASTER_DATA_TABLE; + + +/****************************************************************************/ +// Structure used in MultimediaCapabilityInfoTable +/****************************************************************************/ +typedef struct _ATOM_MULTIMEDIA_CAPABILITY_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulSignature; // HW info table signature string "$ATI" + UCHAR ucI2C_Type; // I2C type (normal GP_IO, ImpactTV GP_IO, Dedicated I2C pin, etc) + UCHAR ucTV_OutInfo; // Type of TV out supported (3:0) and video out crystal frequency (6:4) and TV data port (7) + UCHAR ucVideoPortInfo; // Provides the video port capabilities + UCHAR ucHostPortInfo; // Provides host port configuration information +}ATOM_MULTIMEDIA_CAPABILITY_INFO; + +/****************************************************************************/ +// Structure used in MultimediaConfigInfoTable +/****************************************************************************/ +typedef struct _ATOM_MULTIMEDIA_CONFIG_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulSignature; // MM info table signature sting "$MMT" + UCHAR ucTunerInfo; // Type of tuner installed on the adapter (4:0) and video input for tuner (7:5) + UCHAR ucAudioChipInfo; // List the audio chip type (3:0) product type (4) and OEM revision (7:5) + UCHAR ucProductID; // Defines as OEM ID or ATI board ID dependent on product type setting + UCHAR ucMiscInfo1; // Tuner voltage (1:0) HW teletext support (3:2) FM audio decoder (5:4) reserved (6) audio scrambling (7) + UCHAR ucMiscInfo2; // I2S input config (0) I2S output config (1) I2S Audio Chip (4:2) SPDIF Output Config (5) reserved (7:6) + UCHAR ucMiscInfo3; // Video Decoder Type (3:0) Video In Standard/Crystal (7:4) + UCHAR ucMiscInfo4; // Video Decoder Host Config (2:0) reserved (7:3) + UCHAR ucVideoInput0Info;// Video Input 0 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) + UCHAR ucVideoInput1Info;// Video Input 1 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) + UCHAR ucVideoInput2Info;// Video Input 2 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) + UCHAR ucVideoInput3Info;// Video Input 3 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) + UCHAR ucVideoInput4Info;// Video Input 4 Type (1:0) F/B setting (2) physical connector ID (5:3) reserved (7:6) +}ATOM_MULTIMEDIA_CONFIG_INFO; + + +/****************************************************************************/ +// Structures used in FirmwareInfoTable +/****************************************************************************/ + +// usBIOSCapability Definition: +// Bit 0 = 0: Bios image is not Posted, =1:Bios image is Posted; +// Bit 1 = 0: Dual CRTC is not supported, =1: Dual CRTC is supported; +// Bit 2 = 0: Extended Desktop is not supported, =1: Extended Desktop is supported; +// Others: Reserved +#define ATOM_BIOS_INFO_ATOM_FIRMWARE_POSTED 0x0001 +#define ATOM_BIOS_INFO_DUAL_CRTC_SUPPORT 0x0002 +#define ATOM_BIOS_INFO_EXTENDED_DESKTOP_SUPPORT 0x0004 +#define ATOM_BIOS_INFO_MEMORY_CLOCK_SS_SUPPORT 0x0008 // (valid from v1.1 ~v1.4):=1: memclk SS enable, =0 memclk SS disable. +#define ATOM_BIOS_INFO_ENGINE_CLOCK_SS_SUPPORT 0x0010 // (valid from v1.1 ~v1.4):=1: engclk SS enable, =0 engclk SS disable. +#define ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU 0x0020 +#define ATOM_BIOS_INFO_WMI_SUPPORT 0x0040 +#define ATOM_BIOS_INFO_PPMODE_ASSIGNGED_BY_SYSTEM 0x0080 +#define ATOM_BIOS_INFO_HYPERMEMORY_SUPPORT 0x0100 +#define ATOM_BIOS_INFO_HYPERMEMORY_SIZE_MASK 0x1E00 +#define ATOM_BIOS_INFO_VPOST_WITHOUT_FIRST_MODE_SET 0x2000 +#define ATOM_BIOS_INFO_BIOS_SCRATCH6_SCL2_REDEFINE 0x4000 +#define ATOM_BIOS_INFO_MEMORY_CLOCK_EXT_SS_SUPPORT 0x0008 // (valid from v2.1 ): =1: memclk ss enable with external ss chip +#define ATOM_BIOS_INFO_ENGINE_CLOCK_EXT_SS_SUPPORT 0x0010 // (valid from v2.1 ): =1: engclk ss enable with external ss chip + +#ifndef _H2INC + +//Please don't add or expand this bitfield structure below, this one will retire soon.! +typedef struct _ATOM_FIRMWARE_CAPABILITY +{ +#if ATOM_BIG_ENDIAN + USHORT Reserved:3; + USHORT HyperMemory_Size:4; + USHORT HyperMemory_Support:1; + USHORT PPMode_Assigned:1; + USHORT WMI_SUPPORT:1; + USHORT GPUControlsBL:1; + USHORT EngineClockSS_Support:1; + USHORT MemoryClockSS_Support:1; + USHORT ExtendedDesktopSupport:1; + USHORT DualCRTC_Support:1; + USHORT FirmwarePosted:1; +#else + USHORT FirmwarePosted:1; + USHORT DualCRTC_Support:1; + USHORT ExtendedDesktopSupport:1; + USHORT MemoryClockSS_Support:1; + USHORT EngineClockSS_Support:1; + USHORT GPUControlsBL:1; + USHORT WMI_SUPPORT:1; + USHORT PPMode_Assigned:1; + USHORT HyperMemory_Support:1; + USHORT HyperMemory_Size:4; + USHORT Reserved:3; +#endif +}ATOM_FIRMWARE_CAPABILITY; + +typedef union _ATOM_FIRMWARE_CAPABILITY_ACCESS +{ + ATOM_FIRMWARE_CAPABILITY sbfAccess; + USHORT susAccess; +}ATOM_FIRMWARE_CAPABILITY_ACCESS; + +#else + +typedef union _ATOM_FIRMWARE_CAPABILITY_ACCESS +{ + USHORT susAccess; +}ATOM_FIRMWARE_CAPABILITY_ACCESS; + +#endif + +typedef struct _ATOM_FIRMWARE_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulFirmwareRevision; + ULONG ulDefaultEngineClock; //In 10Khz unit + ULONG ulDefaultMemoryClock; //In 10Khz unit + ULONG ulDriverTargetEngineClock; //In 10Khz unit + ULONG ulDriverTargetMemoryClock; //In 10Khz unit + ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit + ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit + ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit + ULONG ulASICMaxEngineClock; //In 10Khz unit + ULONG ulASICMaxMemoryClock; //In 10Khz unit + UCHAR ucASICMaxTemperature; + UCHAR ucPadding[3]; //Don't use them + ULONG aulReservedForBIOS[3]; //Don't use them + USHORT usMinEngineClockPLL_Input; //In 10Khz unit + USHORT usMaxEngineClockPLL_Input; //In 10Khz unit + USHORT usMinEngineClockPLL_Output; //In 10Khz unit + USHORT usMinMemoryClockPLL_Input; //In 10Khz unit + USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit + USHORT usMinMemoryClockPLL_Output; //In 10Khz unit + USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk + USHORT usMinPixelClockPLL_Input; //In 10Khz unit + USHORT usMaxPixelClockPLL_Input; //In 10Khz unit + USHORT usMinPixelClockPLL_Output; //In 10Khz unit, the definitions above can't change!!! + ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; + USHORT usReferenceClock; //In 10Khz unit + USHORT usPM_RTS_Location; //RTS PM4 starting location in ROM in 1Kb unit + UCHAR ucPM_RTS_StreamSize; //RTS PM4 packets in Kb unit + UCHAR ucDesign_ID; //Indicate what is the board design + UCHAR ucMemoryModule_ID; //Indicate what is the board design +}ATOM_FIRMWARE_INFO; + +typedef struct _ATOM_FIRMWARE_INFO_V1_2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulFirmwareRevision; + ULONG ulDefaultEngineClock; //In 10Khz unit + ULONG ulDefaultMemoryClock; //In 10Khz unit + ULONG ulDriverTargetEngineClock; //In 10Khz unit + ULONG ulDriverTargetMemoryClock; //In 10Khz unit + ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit + ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit + ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit + ULONG ulASICMaxEngineClock; //In 10Khz unit + ULONG ulASICMaxMemoryClock; //In 10Khz unit + UCHAR ucASICMaxTemperature; + UCHAR ucMinAllowedBL_Level; + UCHAR ucPadding[2]; //Don't use them + ULONG aulReservedForBIOS[2]; //Don't use them + ULONG ulMinPixelClockPLL_Output; //In 10Khz unit + USHORT usMinEngineClockPLL_Input; //In 10Khz unit + USHORT usMaxEngineClockPLL_Input; //In 10Khz unit + USHORT usMinEngineClockPLL_Output; //In 10Khz unit + USHORT usMinMemoryClockPLL_Input; //In 10Khz unit + USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit + USHORT usMinMemoryClockPLL_Output; //In 10Khz unit + USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk + USHORT usMinPixelClockPLL_Input; //In 10Khz unit + USHORT usMaxPixelClockPLL_Input; //In 10Khz unit + USHORT usMinPixelClockPLL_Output; //In 10Khz unit - lower 16bit of ulMinPixelClockPLL_Output + ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; + USHORT usReferenceClock; //In 10Khz unit + USHORT usPM_RTS_Location; //RTS PM4 starting location in ROM in 1Kb unit + UCHAR ucPM_RTS_StreamSize; //RTS PM4 packets in Kb unit + UCHAR ucDesign_ID; //Indicate what is the board design + UCHAR ucMemoryModule_ID; //Indicate what is the board design +}ATOM_FIRMWARE_INFO_V1_2; + +typedef struct _ATOM_FIRMWARE_INFO_V1_3 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulFirmwareRevision; + ULONG ulDefaultEngineClock; //In 10Khz unit + ULONG ulDefaultMemoryClock; //In 10Khz unit + ULONG ulDriverTargetEngineClock; //In 10Khz unit + ULONG ulDriverTargetMemoryClock; //In 10Khz unit + ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit + ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit + ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit + ULONG ulASICMaxEngineClock; //In 10Khz unit + ULONG ulASICMaxMemoryClock; //In 10Khz unit + UCHAR ucASICMaxTemperature; + UCHAR ucMinAllowedBL_Level; + UCHAR ucPadding[2]; //Don't use them + ULONG aulReservedForBIOS; //Don't use them + ULONG ul3DAccelerationEngineClock;//In 10Khz unit + ULONG ulMinPixelClockPLL_Output; //In 10Khz unit + USHORT usMinEngineClockPLL_Input; //In 10Khz unit + USHORT usMaxEngineClockPLL_Input; //In 10Khz unit + USHORT usMinEngineClockPLL_Output; //In 10Khz unit + USHORT usMinMemoryClockPLL_Input; //In 10Khz unit + USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit + USHORT usMinMemoryClockPLL_Output; //In 10Khz unit + USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk + USHORT usMinPixelClockPLL_Input; //In 10Khz unit + USHORT usMaxPixelClockPLL_Input; //In 10Khz unit + USHORT usMinPixelClockPLL_Output; //In 10Khz unit - lower 16bit of ulMinPixelClockPLL_Output + ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; + USHORT usReferenceClock; //In 10Khz unit + USHORT usPM_RTS_Location; //RTS PM4 starting location in ROM in 1Kb unit + UCHAR ucPM_RTS_StreamSize; //RTS PM4 packets in Kb unit + UCHAR ucDesign_ID; //Indicate what is the board design + UCHAR ucMemoryModule_ID; //Indicate what is the board design +}ATOM_FIRMWARE_INFO_V1_3; + +typedef struct _ATOM_FIRMWARE_INFO_V1_4 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulFirmwareRevision; + ULONG ulDefaultEngineClock; //In 10Khz unit + ULONG ulDefaultMemoryClock; //In 10Khz unit + ULONG ulDriverTargetEngineClock; //In 10Khz unit + ULONG ulDriverTargetMemoryClock; //In 10Khz unit + ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit + ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit + ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit + ULONG ulASICMaxEngineClock; //In 10Khz unit + ULONG ulASICMaxMemoryClock; //In 10Khz unit + UCHAR ucASICMaxTemperature; + UCHAR ucMinAllowedBL_Level; + USHORT usBootUpVDDCVoltage; //In MV unit + USHORT usLcdMinPixelClockPLL_Output; // In MHz unit + USHORT usLcdMaxPixelClockPLL_Output; // In MHz unit + ULONG ul3DAccelerationEngineClock;//In 10Khz unit + ULONG ulMinPixelClockPLL_Output; //In 10Khz unit + USHORT usMinEngineClockPLL_Input; //In 10Khz unit + USHORT usMaxEngineClockPLL_Input; //In 10Khz unit + USHORT usMinEngineClockPLL_Output; //In 10Khz unit + USHORT usMinMemoryClockPLL_Input; //In 10Khz unit + USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit + USHORT usMinMemoryClockPLL_Output; //In 10Khz unit + USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk + USHORT usMinPixelClockPLL_Input; //In 10Khz unit + USHORT usMaxPixelClockPLL_Input; //In 10Khz unit + USHORT usMinPixelClockPLL_Output; //In 10Khz unit - lower 16bit of ulMinPixelClockPLL_Output + ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; + USHORT usReferenceClock; //In 10Khz unit + USHORT usPM_RTS_Location; //RTS PM4 starting location in ROM in 1Kb unit + UCHAR ucPM_RTS_StreamSize; //RTS PM4 packets in Kb unit + UCHAR ucDesign_ID; //Indicate what is the board design + UCHAR ucMemoryModule_ID; //Indicate what is the board design +}ATOM_FIRMWARE_INFO_V1_4; + +//the structure below to be used from Cypress +typedef struct _ATOM_FIRMWARE_INFO_V2_1 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulFirmwareRevision; + ULONG ulDefaultEngineClock; //In 10Khz unit + ULONG ulDefaultMemoryClock; //In 10Khz unit + ULONG ulReserved1; + ULONG ulReserved2; + ULONG ulMaxEngineClockPLL_Output; //In 10Khz unit + ULONG ulMaxMemoryClockPLL_Output; //In 10Khz unit + ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit + ULONG ulBinaryAlteredInfo; //Was ulASICMaxEngineClock + ULONG ulDefaultDispEngineClkFreq; //In 10Khz unit + UCHAR ucReserved1; //Was ucASICMaxTemperature; + UCHAR ucMinAllowedBL_Level; + USHORT usBootUpVDDCVoltage; //In MV unit + USHORT usLcdMinPixelClockPLL_Output; // In MHz unit + USHORT usLcdMaxPixelClockPLL_Output; // In MHz unit + ULONG ulReserved4; //Was ulAsicMaximumVoltage + ULONG ulMinPixelClockPLL_Output; //In 10Khz unit + USHORT usMinEngineClockPLL_Input; //In 10Khz unit + USHORT usMaxEngineClockPLL_Input; //In 10Khz unit + USHORT usMinEngineClockPLL_Output; //In 10Khz unit + USHORT usMinMemoryClockPLL_Input; //In 10Khz unit + USHORT usMaxMemoryClockPLL_Input; //In 10Khz unit + USHORT usMinMemoryClockPLL_Output; //In 10Khz unit + USHORT usMaxPixelClock; //In 10Khz unit, Max. Pclk + USHORT usMinPixelClockPLL_Input; //In 10Khz unit + USHORT usMaxPixelClockPLL_Input; //In 10Khz unit + USHORT usMinPixelClockPLL_Output; //In 10Khz unit - lower 16bit of ulMinPixelClockPLL_Output + ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; + USHORT usCoreReferenceClock; //In 10Khz unit + USHORT usMemoryReferenceClock; //In 10Khz unit + USHORT usUniphyDPModeExtClkFreq; //In 10Khz unit, if it is 0, In DP Mode Uniphy Input clock from internal PPLL, otherwise Input clock from external Spread clock + UCHAR ucMemoryModule_ID; //Indicate what is the board design + UCHAR ucReserved4[3]; +}ATOM_FIRMWARE_INFO_V2_1; + +//the structure below to be used from NI +//ucTableFormatRevision=2 +//ucTableContentRevision=2 +typedef struct _ATOM_FIRMWARE_INFO_V2_2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulFirmwareRevision; + ULONG ulDefaultEngineClock; //In 10Khz unit + ULONG ulDefaultMemoryClock; //In 10Khz unit + ULONG ulReserved[2]; + ULONG ulReserved1; //Was ulMaxEngineClockPLL_Output; //In 10Khz unit* + ULONG ulReserved2; //Was ulMaxMemoryClockPLL_Output; //In 10Khz unit* + ULONG ulMaxPixelClockPLL_Output; //In 10Khz unit + ULONG ulBinaryAlteredInfo; //Was ulASICMaxEngineClock ? + ULONG ulDefaultDispEngineClkFreq; //In 10Khz unit. This is the frequency before DCDTO, corresponding to usBootUpVDDCVoltage. + UCHAR ucReserved3; //Was ucASICMaxTemperature; + UCHAR ucMinAllowedBL_Level; + USHORT usBootUpVDDCVoltage; //In MV unit + USHORT usLcdMinPixelClockPLL_Output; // In MHz unit + USHORT usLcdMaxPixelClockPLL_Output; // In MHz unit + ULONG ulReserved4; //Was ulAsicMaximumVoltage + ULONG ulMinPixelClockPLL_Output; //In 10Khz unit + ULONG ulReserved5; //Was usMinEngineClockPLL_Input and usMaxEngineClockPLL_Input + ULONG ulReserved6; //Was usMinEngineClockPLL_Output and usMinMemoryClockPLL_Input + ULONG ulReserved7; //Was usMaxMemoryClockPLL_Input and usMinMemoryClockPLL_Output + USHORT usReserved11; //Was usMaxPixelClock; //In 10Khz unit, Max. Pclk used only for DAC + USHORT usMinPixelClockPLL_Input; //In 10Khz unit + USHORT usMaxPixelClockPLL_Input; //In 10Khz unit + USHORT usBootUpVDDCIVoltage; //In unit of mv; Was usMinPixelClockPLL_Output; + ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability; + USHORT usCoreReferenceClock; //In 10Khz unit + USHORT usMemoryReferenceClock; //In 10Khz unit + USHORT usUniphyDPModeExtClkFreq; //In 10Khz unit, if it is 0, In DP Mode Uniphy Input clock from internal PPLL, otherwise Input clock from external Spread clock + UCHAR ucMemoryModule_ID; //Indicate what is the board design + UCHAR ucReserved9[3]; + USHORT usBootUpMVDDCVoltage; //In unit of mv; Was usMinPixelClockPLL_Output; + USHORT usReserved12; + ULONG ulReserved10[3]; // New added comparing to previous version +}ATOM_FIRMWARE_INFO_V2_2; + +#define ATOM_FIRMWARE_INFO_LAST ATOM_FIRMWARE_INFO_V2_2 + +/****************************************************************************/ +// Structures used in IntegratedSystemInfoTable +/****************************************************************************/ +#define IGP_CAP_FLAG_DYNAMIC_CLOCK_EN 0x2 +#define IGP_CAP_FLAG_AC_CARD 0x4 +#define IGP_CAP_FLAG_SDVO_CARD 0x8 +#define IGP_CAP_FLAG_POSTDIV_BY_2_MODE 0x10 + +typedef struct _ATOM_INTEGRATED_SYSTEM_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulBootUpEngineClock; //in 10kHz unit + ULONG ulBootUpMemoryClock; //in 10kHz unit + ULONG ulMaxSystemMemoryClock; //in 10kHz unit + ULONG ulMinSystemMemoryClock; //in 10kHz unit + UCHAR ucNumberOfCyclesInPeriodHi; + UCHAR ucLCDTimingSel; //=0:not valid.!=0 sel this timing descriptor from LCD EDID. + USHORT usReserved1; + USHORT usInterNBVoltageLow; //An intermidiate PMW value to set the voltage + USHORT usInterNBVoltageHigh; //Another intermidiate PMW value to set the voltage + ULONG ulReserved[2]; + + USHORT usFSBClock; //In MHz unit + USHORT usCapabilityFlag; //Bit0=1 indicates the fake HDMI support,Bit1=0/1 for Dynamic clocking dis/enable + //Bit[3:2]== 0:No PCIE card, 1:AC card, 2:SDVO card + //Bit[4]==1: P/2 mode, ==0: P/1 mode + USHORT usPCIENBCfgReg7; //bit[7:0]=MUX_Sel, bit[9:8]=MUX_SEL_LEVEL2, bit[10]=Lane_Reversal + USHORT usK8MemoryClock; //in MHz unit + USHORT usK8SyncStartDelay; //in 0.01 us unit + USHORT usK8DataReturnTime; //in 0.01 us unit + UCHAR ucMaxNBVoltage; + UCHAR ucMinNBVoltage; + UCHAR ucMemoryType; //[7:4]=1:DDR1;=2:DDR2;=3:DDR3.[3:0] is reserved + UCHAR ucNumberOfCyclesInPeriod; //CG.FVTHROT_PWM_CTRL_REG0.NumberOfCyclesInPeriod + UCHAR ucStartingPWM_HighTime; //CG.FVTHROT_PWM_CTRL_REG0.StartingPWM_HighTime + UCHAR ucHTLinkWidth; //16 bit vs. 8 bit + UCHAR ucMaxNBVoltageHigh; + UCHAR ucMinNBVoltageHigh; +}ATOM_INTEGRATED_SYSTEM_INFO; + +/* Explanation on entries in ATOM_INTEGRATED_SYSTEM_INFO +ulBootUpMemoryClock: For Intel IGP,it's the UMA system memory clock + For AMD IGP,it's 0 if no SidePort memory installed or it's the boot-up SidePort memory clock +ulMaxSystemMemoryClock: For Intel IGP,it's the Max freq from memory SPD if memory runs in ASYNC mode or otherwise (SYNC mode) it's 0 + For AMD IGP,for now this can be 0 +ulMinSystemMemoryClock: For Intel IGP,it's 133MHz if memory runs in ASYNC mode or otherwise (SYNC mode) it's 0 + For AMD IGP,for now this can be 0 + +usFSBClock: For Intel IGP,it's FSB Freq + For AMD IGP,it's HT Link Speed + +usK8MemoryClock: For AMD IGP only. For RevF CPU, set it to 200 +usK8SyncStartDelay: For AMD IGP only. Memory access latency in K8, required for watermark calculation +usK8DataReturnTime: For AMD IGP only. Memory access latency in K8, required for watermark calculation + +VC:Voltage Control +ucMaxNBVoltage: Voltage regulator dependent PWM value. Low 8 bits of the value for the max voltage.Set this one to 0xFF if VC without PWM. Set this to 0x0 if no VC at all. +ucMinNBVoltage: Voltage regulator dependent PWM value. Low 8 bits of the value for the min voltage.Set this one to 0x00 if VC without PWM or no VC at all. + +ucNumberOfCyclesInPeriod: Indicate how many cycles when PWM duty is 100%. low 8 bits of the value. +ucNumberOfCyclesInPeriodHi: Indicate how many cycles when PWM duty is 100%. high 8 bits of the value.If the PWM has an inverter,set bit [7]==1,otherwise set it 0 + +ucMaxNBVoltageHigh: Voltage regulator dependent PWM value. High 8 bits of the value for the max voltage.Set this one to 0xFF if VC without PWM. Set this to 0x0 if no VC at all. +ucMinNBVoltageHigh: Voltage regulator dependent PWM value. High 8 bits of the value for the min voltage.Set this one to 0x00 if VC without PWM or no VC at all. + + +usInterNBVoltageLow: Voltage regulator dependent PWM value. The value makes the the voltage >=Min NB voltage but <=InterNBVoltageHigh. Set this to 0x0000 if VC without PWM or no VC at all. +usInterNBVoltageHigh: Voltage regulator dependent PWM value. The value makes the the voltage >=InterNBVoltageLow but <=Max NB voltage.Set this to 0x0000 if VC without PWM or no VC at all. +*/ + + +/* +The following IGP table is introduced from RS780, which is supposed to be put by SBIOS in FB before IGP VBIOS starts VPOST; +Then VBIOS will copy the whole structure to its image so all GPU SW components can access this data structure to get whatever they need. +The enough reservation should allow us to never change table revisions. Whenever needed, a GPU SW component can use reserved portion for new data entries. + +SW components can access the IGP system infor structure in the same way as before +*/ + + +typedef struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulBootUpEngineClock; //in 10kHz unit + ULONG ulReserved1[2]; //must be 0x0 for the reserved + ULONG ulBootUpUMAClock; //in 10kHz unit + ULONG ulBootUpSidePortClock; //in 10kHz unit + ULONG ulMinSidePortClock; //in 10kHz unit + ULONG ulReserved2[6]; //must be 0x0 for the reserved + ULONG ulSystemConfig; //see explanation below + ULONG ulBootUpReqDisplayVector; + ULONG ulOtherDisplayMisc; + ULONG ulDDISlot1Config; + ULONG ulDDISlot2Config; + UCHAR ucMemoryType; //[3:0]=1:DDR1;=2:DDR2;=3:DDR3.[7:4] is reserved + UCHAR ucUMAChannelNumber; + UCHAR ucDockingPinBit; + UCHAR ucDockingPinPolarity; + ULONG ulDockingPinCFGInfo; + ULONG ulCPUCapInfo; + USHORT usNumberOfCyclesInPeriod; + USHORT usMaxNBVoltage; + USHORT usMinNBVoltage; + USHORT usBootUpNBVoltage; + ULONG ulHTLinkFreq; //in 10Khz + USHORT usMinHTLinkWidth; + USHORT usMaxHTLinkWidth; + USHORT usUMASyncStartDelay; + USHORT usUMADataReturnTime; + USHORT usLinkStatusZeroTime; + USHORT usDACEfuse; //for storing badgap value (for RS880 only) + ULONG ulHighVoltageHTLinkFreq; // in 10Khz + ULONG ulLowVoltageHTLinkFreq; // in 10Khz + USHORT usMaxUpStreamHTLinkWidth; + USHORT usMaxDownStreamHTLinkWidth; + USHORT usMinUpStreamHTLinkWidth; + USHORT usMinDownStreamHTLinkWidth; + USHORT usFirmwareVersion; //0 means FW is not supported. Otherwise it's the FW version loaded by SBIOS and driver should enable FW. + USHORT usFullT0Time; // Input to calculate minimum HT link change time required by NB P-State. Unit is 0.01us. + ULONG ulReserved3[96]; //must be 0x0 +}ATOM_INTEGRATED_SYSTEM_INFO_V2; + +/* +ulBootUpEngineClock: Boot-up Engine Clock in 10Khz; +ulBootUpUMAClock: Boot-up UMA Clock in 10Khz; it must be 0x0 when UMA is not present +ulBootUpSidePortClock: Boot-up SidePort Clock in 10Khz; it must be 0x0 when SidePort Memory is not present,this could be equal to or less than maximum supported Sideport memory clock + +ulSystemConfig: +Bit[0]=1: PowerExpress mode =0 Non-PowerExpress mode; +Bit[1]=1: system boots up at AMD overdrived state or user customized mode. In this case, driver will just stick to this boot-up mode. No other PowerPlay state + =0: system boots up at driver control state. Power state depends on PowerPlay table. +Bit[2]=1: PWM method is used on NB voltage control. =0: GPIO method is used. +Bit[3]=1: Only one power state(Performance) will be supported. + =0: Multiple power states supported from PowerPlay table. +Bit[4]=1: CLMC is supported and enabled on current system. + =0: CLMC is not supported or enabled on current system. SBIOS need to support HT link/freq change through ATIF interface. +Bit[5]=1: Enable CDLW for all driver control power states. Max HT width is from SBIOS, while Min HT width is determined by display requirement. + =0: CDLW is disabled. If CLMC is enabled case, Min HT width will be set equal to Max HT width. If CLMC disabled case, Max HT width will be applied. +Bit[6]=1: High Voltage requested for all power states. In this case, voltage will be forced at 1.1v and powerplay table voltage drop/throttling request will be ignored. + =0: Voltage settings is determined by powerplay table. +Bit[7]=1: Enable CLMC as hybrid Mode. CDLD and CILR will be disabled in this case and we're using legacy C1E. This is workaround for CPU(Griffin) performance issue. + =0: Enable CLMC as regular mode, CDLD and CILR will be enabled. +Bit[8]=1: CDLF is supported and enabled on current system. + =0: CDLF is not supported or enabled on current system. +Bit[9]=1: DLL Shut Down feature is enabled on current system. + =0: DLL Shut Down feature is not enabled or supported on current system. + +ulBootUpReqDisplayVector: This dword is a bit vector indicates what display devices are requested during boot-up. Refer to ATOM_DEVICE_xxx_SUPPORT for the bit vector definitions. + +ulOtherDisplayMisc: [15:8]- Bootup LCD Expansion selection; 0-center, 1-full panel size expansion; + [7:0] - BootupTV standard selection; This is a bit vector to indicate what TV standards are supported by the system. Refer to ucTVSupportedStd definition; + +ulDDISlot1Config: Describes the PCIE lane configuration on this DDI PCIE slot (ADD2 card) or connector (Mobile design). + [3:0] - Bit vector to indicate PCIE lane config of the DDI slot/connector on chassis (bit 0=1 lane 3:0; bit 1=1 lane 7:4; bit 2=1 lane 11:8; bit 3=1 lane 15:12) + [7:4] - Bit vector to indicate PCIE lane config of the same DDI slot/connector on docking station (bit 4=1 lane 3:0; bit 5=1 lane 7:4; bit 6=1 lane 11:8; bit 7=1 lane 15:12) + When a DDI connector is not "paired" (meaming two connections mutualexclusive on chassis or docking, only one of them can be connected at one time. + in both chassis and docking, SBIOS has to duplicate the same PCIE lane info from chassis to docking or vice versa. For example: + one DDI connector is only populated in docking with PCIE lane 8-11, but there is no paired connection on chassis, SBIOS has to copy bit 6 to bit 2. + + [15:8] - Lane configuration attribute; + [23:16]- Connector type, possible value: + CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D + CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D + CONNECTOR_OBJECT_ID_HDMI_TYPE_A + CONNECTOR_OBJECT_ID_DISPLAYPORT + CONNECTOR_OBJECT_ID_eDP + [31:24]- Reserved + +ulDDISlot2Config: Same as Slot1. +ucMemoryType: SidePort memory type, set it to 0x0 when Sideport memory is not installed. Driver needs this info to change sideport memory clock. Not for display in CCC. +For IGP, Hypermemory is the only memory type showed in CCC. + +ucUMAChannelNumber: how many channels for the UMA; + +ulDockingPinCFGInfo: [15:0]-Bus/Device/Function # to CFG to read this Docking Pin; [31:16]-reg offset in CFG to read this pin +ucDockingPinBit: which bit in this register to read the pin status; +ucDockingPinPolarity:Polarity of the pin when docked; + +ulCPUCapInfo: [7:0]=1:Griffin;[7:0]=2:Greyhound;[7:0]=3:K8, [7:0]=4:Pharaoh, other bits reserved for now and must be 0x0 + +usNumberOfCyclesInPeriod:Indicate how many cycles when PWM duty is 100%. + +usMaxNBVoltage:Max. voltage control value in either PWM or GPIO mode. +usMinNBVoltage:Min. voltage control value in either PWM or GPIO mode. + GPIO mode: both usMaxNBVoltage & usMinNBVoltage have a valid value ulSystemConfig.SYSTEM_CONFIG_USE_PWM_ON_VOLTAGE=0 + PWM mode: both usMaxNBVoltage & usMinNBVoltage have a valid value ulSystemConfig.SYSTEM_CONFIG_USE_PWM_ON_VOLTAGE=1 + GPU SW don't control mode: usMaxNBVoltage & usMinNBVoltage=0 and no care about ulSystemConfig.SYSTEM_CONFIG_USE_PWM_ON_VOLTAGE + +usBootUpNBVoltage:Boot-up voltage regulator dependent PWM value. + +ulHTLinkFreq: Bootup HT link Frequency in 10Khz. +usMinHTLinkWidth: Bootup minimum HT link width. If CDLW disabled, this is equal to usMaxHTLinkWidth. + If CDLW enabled, both upstream and downstream width should be the same during bootup. +usMaxHTLinkWidth: Bootup maximum HT link width. If CDLW disabled, this is equal to usMinHTLinkWidth. + If CDLW enabled, both upstream and downstream width should be the same during bootup. + +usUMASyncStartDelay: Memory access latency, required for watermark calculation +usUMADataReturnTime: Memory access latency, required for watermark calculation +usLinkStatusZeroTime:Memory access latency required for watermark calculation, set this to 0x0 for K8 CPU, set a proper value in 0.01 the unit of us +for Griffin or Greyhound. SBIOS needs to convert to actual time by: + if T0Ttime [5:4]=00b, then usLinkStatusZeroTime=T0Ttime [3:0]*0.1us (0.0 to 1.5us) + if T0Ttime [5:4]=01b, then usLinkStatusZeroTime=T0Ttime [3:0]*0.5us (0.0 to 7.5us) + if T0Ttime [5:4]=10b, then usLinkStatusZeroTime=T0Ttime [3:0]*2.0us (0.0 to 30us) + if T0Ttime [5:4]=11b, and T0Ttime [3:0]=0x0 to 0xa, then usLinkStatusZeroTime=T0Ttime [3:0]*20us (0.0 to 200us) + +ulHighVoltageHTLinkFreq: HT link frequency for power state with low voltage. If boot up runs in HT1, this must be 0. + This must be less than or equal to ulHTLinkFreq(bootup frequency). +ulLowVoltageHTLinkFreq: HT link frequency for power state with low voltage or voltage scaling 1.0v~1.1v. If boot up runs in HT1, this must be 0. + This must be less than or equal to ulHighVoltageHTLinkFreq. + +usMaxUpStreamHTLinkWidth: Asymmetric link width support in the future, to replace usMaxHTLinkWidth. Not used for now. +usMaxDownStreamHTLinkWidth: same as above. +usMinUpStreamHTLinkWidth: Asymmetric link width support in the future, to replace usMinHTLinkWidth. Not used for now. +usMinDownStreamHTLinkWidth: same as above. +*/ + +// ATOM_INTEGRATED_SYSTEM_INFO::ulCPUCapInfo - CPU type definition +#define INTEGRATED_SYSTEM_INFO__UNKNOWN_CPU 0 +#define INTEGRATED_SYSTEM_INFO__AMD_CPU__GRIFFIN 1 +#define INTEGRATED_SYSTEM_INFO__AMD_CPU__GREYHOUND 2 +#define INTEGRATED_SYSTEM_INFO__AMD_CPU__K8 3 +#define INTEGRATED_SYSTEM_INFO__AMD_CPU__PHARAOH 4 + +#define INTEGRATED_SYSTEM_INFO__AMD_CPU__MAX_CODE INTEGRATED_SYSTEM_INFO__AMD_CPU__PHARAOH // this deff reflects max defined CPU code + +#define SYSTEM_CONFIG_POWEREXPRESS_ENABLE 0x00000001 +#define SYSTEM_CONFIG_RUN_AT_OVERDRIVE_ENGINE 0x00000002 +#define SYSTEM_CONFIG_USE_PWM_ON_VOLTAGE 0x00000004 +#define SYSTEM_CONFIG_PERFORMANCE_POWERSTATE_ONLY 0x00000008 +#define SYSTEM_CONFIG_CLMC_ENABLED 0x00000010 +#define SYSTEM_CONFIG_CDLW_ENABLED 0x00000020 +#define SYSTEM_CONFIG_HIGH_VOLTAGE_REQUESTED 0x00000040 +#define SYSTEM_CONFIG_CLMC_HYBRID_MODE_ENABLED 0x00000080 +#define SYSTEM_CONFIG_CDLF_ENABLED 0x00000100 +#define SYSTEM_CONFIG_DLL_SHUTDOWN_ENABLED 0x00000200 + +#define IGP_DDI_SLOT_LANE_CONFIG_MASK 0x000000FF + +#define b0IGP_DDI_SLOT_LANE_MAP_MASK 0x0F +#define b0IGP_DDI_SLOT_DOCKING_LANE_MAP_MASK 0xF0 +#define b0IGP_DDI_SLOT_CONFIG_LANE_0_3 0x01 +#define b0IGP_DDI_SLOT_CONFIG_LANE_4_7 0x02 +#define b0IGP_DDI_SLOT_CONFIG_LANE_8_11 0x04 +#define b0IGP_DDI_SLOT_CONFIG_LANE_12_15 0x08 + +#define IGP_DDI_SLOT_ATTRIBUTE_MASK 0x0000FF00 +#define IGP_DDI_SLOT_CONFIG_REVERSED 0x00000100 +#define b1IGP_DDI_SLOT_CONFIG_REVERSED 0x01 + +#define IGP_DDI_SLOT_CONNECTOR_TYPE_MASK 0x00FF0000 + +// IntegratedSystemInfoTable new Rev is V5 after V2, because of the real rev of V2 is v1.4. This rev is used for RR +typedef struct _ATOM_INTEGRATED_SYSTEM_INFO_V5 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulBootUpEngineClock; //in 10kHz unit + ULONG ulDentistVCOFreq; //Dentist VCO clock in 10kHz unit, the source of GPU SCLK, LCLK, UCLK and VCLK. + ULONG ulLClockFreq; //GPU Lclk freq in 10kHz unit, have relationship with NCLK in NorthBridge + ULONG ulBootUpUMAClock; //in 10kHz unit + ULONG ulReserved1[8]; //must be 0x0 for the reserved + ULONG ulBootUpReqDisplayVector; + ULONG ulOtherDisplayMisc; + ULONG ulReserved2[4]; //must be 0x0 for the reserved + ULONG ulSystemConfig; //TBD + ULONG ulCPUCapInfo; //TBD + USHORT usMaxNBVoltage; //high NB voltage, calculated using current VDDNB (D24F2xDC) and VDDNB offset fuse; + USHORT usMinNBVoltage; //low NB voltage, calculated using current VDDNB (D24F2xDC) and VDDNB offset fuse; + USHORT usBootUpNBVoltage; //boot up NB voltage + UCHAR ucHtcTmpLmt; //bit [22:16] of D24F3x64 Hardware Thermal Control (HTC) Register, may not be needed, TBD + UCHAR ucTjOffset; //bit [28:22] of D24F3xE4 Thermtrip Status Register,may not be needed, TBD + ULONG ulReserved3[4]; //must be 0x0 for the reserved + ULONG ulDDISlot1Config; //see above ulDDISlot1Config definition + ULONG ulDDISlot2Config; + ULONG ulDDISlot3Config; + ULONG ulDDISlot4Config; + ULONG ulReserved4[4]; //must be 0x0 for the reserved + UCHAR ucMemoryType; //[3:0]=1:DDR1;=2:DDR2;=3:DDR3.[7:4] is reserved + UCHAR ucUMAChannelNumber; + USHORT usReserved; + ULONG ulReserved5[4]; //must be 0x0 for the reserved + ULONG ulCSR_M3_ARB_CNTL_DEFAULT[10];//arrays with values for CSR M3 arbiter for default + ULONG ulCSR_M3_ARB_CNTL_UVD[10]; //arrays with values for CSR M3 arbiter for UVD playback + ULONG ulCSR_M3_ARB_CNTL_FS3D[10];//arrays with values for CSR M3 arbiter for Full Screen 3D applications + ULONG ulReserved6[61]; //must be 0x0 +}ATOM_INTEGRATED_SYSTEM_INFO_V5; + +#define ATOM_CRT_INT_ENCODER1_INDEX 0x00000000 +#define ATOM_LCD_INT_ENCODER1_INDEX 0x00000001 +#define ATOM_TV_INT_ENCODER1_INDEX 0x00000002 +#define ATOM_DFP_INT_ENCODER1_INDEX 0x00000003 +#define ATOM_CRT_INT_ENCODER2_INDEX 0x00000004 +#define ATOM_LCD_EXT_ENCODER1_INDEX 0x00000005 +#define ATOM_TV_EXT_ENCODER1_INDEX 0x00000006 +#define ATOM_DFP_EXT_ENCODER1_INDEX 0x00000007 +#define ATOM_CV_INT_ENCODER1_INDEX 0x00000008 +#define ATOM_DFP_INT_ENCODER2_INDEX 0x00000009 +#define ATOM_CRT_EXT_ENCODER1_INDEX 0x0000000A +#define ATOM_CV_EXT_ENCODER1_INDEX 0x0000000B +#define ATOM_DFP_INT_ENCODER3_INDEX 0x0000000C +#define ATOM_DFP_INT_ENCODER4_INDEX 0x0000000D + +// define ASIC internal encoder id ( bit vector ), used for CRTC_SourceSelTable +#define ASIC_INT_DAC1_ENCODER_ID 0x00 +#define ASIC_INT_TV_ENCODER_ID 0x02 +#define ASIC_INT_DIG1_ENCODER_ID 0x03 +#define ASIC_INT_DAC2_ENCODER_ID 0x04 +#define ASIC_EXT_TV_ENCODER_ID 0x06 +#define ASIC_INT_DVO_ENCODER_ID 0x07 +#define ASIC_INT_DIG2_ENCODER_ID 0x09 +#define ASIC_EXT_DIG_ENCODER_ID 0x05 +#define ASIC_EXT_DIG2_ENCODER_ID 0x08 +#define ASIC_INT_DIG3_ENCODER_ID 0x0a +#define ASIC_INT_DIG4_ENCODER_ID 0x0b +#define ASIC_INT_DIG5_ENCODER_ID 0x0c +#define ASIC_INT_DIG6_ENCODER_ID 0x0d + +//define Encoder attribute +#define ATOM_ANALOG_ENCODER 0 +#define ATOM_DIGITAL_ENCODER 1 +#define ATOM_DP_ENCODER 2 + +#define ATOM_ENCODER_ENUM_MASK 0x70 +#define ATOM_ENCODER_ENUM_ID1 0x00 +#define ATOM_ENCODER_ENUM_ID2 0x10 +#define ATOM_ENCODER_ENUM_ID3 0x20 +#define ATOM_ENCODER_ENUM_ID4 0x30 +#define ATOM_ENCODER_ENUM_ID5 0x40 +#define ATOM_ENCODER_ENUM_ID6 0x50 + +#define ATOM_DEVICE_CRT1_INDEX 0x00000000 +#define ATOM_DEVICE_LCD1_INDEX 0x00000001 +#define ATOM_DEVICE_TV1_INDEX 0x00000002 +#define ATOM_DEVICE_DFP1_INDEX 0x00000003 +#define ATOM_DEVICE_CRT2_INDEX 0x00000004 +#define ATOM_DEVICE_LCD2_INDEX 0x00000005 +#define ATOM_DEVICE_DFP6_INDEX 0x00000006 +#define ATOM_DEVICE_DFP2_INDEX 0x00000007 +#define ATOM_DEVICE_CV_INDEX 0x00000008 +#define ATOM_DEVICE_DFP3_INDEX 0x00000009 +#define ATOM_DEVICE_DFP4_INDEX 0x0000000A +#define ATOM_DEVICE_DFP5_INDEX 0x0000000B + +#define ATOM_DEVICE_RESERVEDC_INDEX 0x0000000C +#define ATOM_DEVICE_RESERVEDD_INDEX 0x0000000D +#define ATOM_DEVICE_RESERVEDE_INDEX 0x0000000E +#define ATOM_DEVICE_RESERVEDF_INDEX 0x0000000F +#define ATOM_MAX_SUPPORTED_DEVICE_INFO (ATOM_DEVICE_DFP3_INDEX+1) +#define ATOM_MAX_SUPPORTED_DEVICE_INFO_2 ATOM_MAX_SUPPORTED_DEVICE_INFO +#define ATOM_MAX_SUPPORTED_DEVICE_INFO_3 (ATOM_DEVICE_DFP5_INDEX + 1 ) + +#define ATOM_MAX_SUPPORTED_DEVICE (ATOM_DEVICE_RESERVEDF_INDEX+1) + +#define ATOM_DEVICE_CRT1_SUPPORT (0x1L << ATOM_DEVICE_CRT1_INDEX ) +#define ATOM_DEVICE_LCD1_SUPPORT (0x1L << ATOM_DEVICE_LCD1_INDEX ) +#define ATOM_DEVICE_TV1_SUPPORT (0x1L << ATOM_DEVICE_TV1_INDEX ) +#define ATOM_DEVICE_DFP1_SUPPORT (0x1L << ATOM_DEVICE_DFP1_INDEX ) +#define ATOM_DEVICE_CRT2_SUPPORT (0x1L << ATOM_DEVICE_CRT2_INDEX ) +#define ATOM_DEVICE_LCD2_SUPPORT (0x1L << ATOM_DEVICE_LCD2_INDEX ) +#define ATOM_DEVICE_DFP6_SUPPORT (0x1L << ATOM_DEVICE_DFP6_INDEX ) +#define ATOM_DEVICE_DFP2_SUPPORT (0x1L << ATOM_DEVICE_DFP2_INDEX ) +#define ATOM_DEVICE_CV_SUPPORT (0x1L << ATOM_DEVICE_CV_INDEX ) +#define ATOM_DEVICE_DFP3_SUPPORT (0x1L << ATOM_DEVICE_DFP3_INDEX ) +#define ATOM_DEVICE_DFP4_SUPPORT (0x1L << ATOM_DEVICE_DFP4_INDEX ) +#define ATOM_DEVICE_DFP5_SUPPORT (0x1L << ATOM_DEVICE_DFP5_INDEX ) + +#define ATOM_DEVICE_CRT_SUPPORT (ATOM_DEVICE_CRT1_SUPPORT | ATOM_DEVICE_CRT2_SUPPORT) +#define ATOM_DEVICE_DFP_SUPPORT (ATOM_DEVICE_DFP1_SUPPORT | ATOM_DEVICE_DFP2_SUPPORT | ATOM_DEVICE_DFP3_SUPPORT | ATOM_DEVICE_DFP4_SUPPORT | ATOM_DEVICE_DFP5_SUPPORT | ATOM_DEVICE_DFP6_SUPPORT) +#define ATOM_DEVICE_TV_SUPPORT (ATOM_DEVICE_TV1_SUPPORT) +#define ATOM_DEVICE_LCD_SUPPORT (ATOM_DEVICE_LCD1_SUPPORT | ATOM_DEVICE_LCD2_SUPPORT) + +#define ATOM_DEVICE_CONNECTOR_TYPE_MASK 0x000000F0 +#define ATOM_DEVICE_CONNECTOR_TYPE_SHIFT 0x00000004 +#define ATOM_DEVICE_CONNECTOR_VGA 0x00000001 +#define ATOM_DEVICE_CONNECTOR_DVI_I 0x00000002 +#define ATOM_DEVICE_CONNECTOR_DVI_D 0x00000003 +#define ATOM_DEVICE_CONNECTOR_DVI_A 0x00000004 +#define ATOM_DEVICE_CONNECTOR_SVIDEO 0x00000005 +#define ATOM_DEVICE_CONNECTOR_COMPOSITE 0x00000006 +#define ATOM_DEVICE_CONNECTOR_LVDS 0x00000007 +#define ATOM_DEVICE_CONNECTOR_DIGI_LINK 0x00000008 +#define ATOM_DEVICE_CONNECTOR_SCART 0x00000009 +#define ATOM_DEVICE_CONNECTOR_HDMI_TYPE_A 0x0000000A +#define ATOM_DEVICE_CONNECTOR_HDMI_TYPE_B 0x0000000B +#define ATOM_DEVICE_CONNECTOR_CASE_1 0x0000000E +#define ATOM_DEVICE_CONNECTOR_DISPLAYPORT 0x0000000F + + +#define ATOM_DEVICE_DAC_INFO_MASK 0x0000000F +#define ATOM_DEVICE_DAC_INFO_SHIFT 0x00000000 +#define ATOM_DEVICE_DAC_INFO_NODAC 0x00000000 +#define ATOM_DEVICE_DAC_INFO_DACA 0x00000001 +#define ATOM_DEVICE_DAC_INFO_DACB 0x00000002 +#define ATOM_DEVICE_DAC_INFO_EXDAC 0x00000003 + +#define ATOM_DEVICE_I2C_ID_NOI2C 0x00000000 + +#define ATOM_DEVICE_I2C_LINEMUX_MASK 0x0000000F +#define ATOM_DEVICE_I2C_LINEMUX_SHIFT 0x00000000 + +#define ATOM_DEVICE_I2C_ID_MASK 0x00000070 +#define ATOM_DEVICE_I2C_ID_SHIFT 0x00000004 +#define ATOM_DEVICE_I2C_ID_IS_FOR_NON_MM_USE 0x00000001 +#define ATOM_DEVICE_I2C_ID_IS_FOR_MM_USE 0x00000002 +#define ATOM_DEVICE_I2C_ID_IS_FOR_SDVO_USE 0x00000003 //For IGP RS600 +#define ATOM_DEVICE_I2C_ID_IS_FOR_DAC_SCL 0x00000004 //For IGP RS690 + +#define ATOM_DEVICE_I2C_HARDWARE_CAP_MASK 0x00000080 +#define ATOM_DEVICE_I2C_HARDWARE_CAP_SHIFT 0x00000007 +#define ATOM_DEVICE_USES_SOFTWARE_ASSISTED_I2C 0x00000000 +#define ATOM_DEVICE_USES_HARDWARE_ASSISTED_I2C 0x00000001 + +// usDeviceSupport: +// Bits0 = 0 - no CRT1 support= 1- CRT1 is supported +// Bit 1 = 0 - no LCD1 support= 1- LCD1 is supported +// Bit 2 = 0 - no TV1 support= 1- TV1 is supported +// Bit 3 = 0 - no DFP1 support= 1- DFP1 is supported +// Bit 4 = 0 - no CRT2 support= 1- CRT2 is supported +// Bit 5 = 0 - no LCD2 support= 1- LCD2 is supported +// Bit 6 = 0 - no DFP6 support= 1- DFP6 is supported +// Bit 7 = 0 - no DFP2 support= 1- DFP2 is supported +// Bit 8 = 0 - no CV support= 1- CV is supported +// Bit 9 = 0 - no DFP3 support= 1- DFP3 is supported +// Bit 10 = 0 - no DFP4 support= 1- DFP4 is supported +// Bit 11 = 0 - no DFP5 support= 1- DFP5 is supported +// +// + +/****************************************************************************/ +/* Structure used in MclkSS_InfoTable */ +/****************************************************************************/ +// ucI2C_ConfigID +// [7:0] - I2C LINE Associate ID +// = 0 - no I2C +// [7] - HW_Cap = 1, [6:0]=HW assisted I2C ID(HW line selection) +// = 0, [6:0]=SW assisted I2C ID +// [6-4] - HW_ENGINE_ID = 1, HW engine for NON multimedia use +// = 2, HW engine for Multimedia use +// = 3-7 Reserved for future I2C engines +// [3-0] - I2C_LINE_MUX = A Mux number when it's HW assisted I2C or GPIO ID when it's SW I2C + +typedef struct _ATOM_I2C_ID_CONFIG +{ +#if ATOM_BIG_ENDIAN + UCHAR bfHW_Capable:1; + UCHAR bfHW_EngineID:3; + UCHAR bfI2C_LineMux:4; +#else + UCHAR bfI2C_LineMux:4; + UCHAR bfHW_EngineID:3; + UCHAR bfHW_Capable:1; +#endif +}ATOM_I2C_ID_CONFIG; + +typedef union _ATOM_I2C_ID_CONFIG_ACCESS +{ + ATOM_I2C_ID_CONFIG sbfAccess; + UCHAR ucAccess; +}ATOM_I2C_ID_CONFIG_ACCESS; + + +/****************************************************************************/ +// Structure used in GPIO_I2C_InfoTable +/****************************************************************************/ +typedef struct _ATOM_GPIO_I2C_ASSIGMENT +{ + USHORT usClkMaskRegisterIndex; + USHORT usClkEnRegisterIndex; + USHORT usClkY_RegisterIndex; + USHORT usClkA_RegisterIndex; + USHORT usDataMaskRegisterIndex; + USHORT usDataEnRegisterIndex; + USHORT usDataY_RegisterIndex; + USHORT usDataA_RegisterIndex; + ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; + UCHAR ucClkMaskShift; + UCHAR ucClkEnShift; + UCHAR ucClkY_Shift; + UCHAR ucClkA_Shift; + UCHAR ucDataMaskShift; + UCHAR ucDataEnShift; + UCHAR ucDataY_Shift; + UCHAR ucDataA_Shift; + UCHAR ucReserved1; + UCHAR ucReserved2; +}ATOM_GPIO_I2C_ASSIGMENT; + +typedef struct _ATOM_GPIO_I2C_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_GPIO_I2C_ASSIGMENT asGPIO_Info[ATOM_MAX_SUPPORTED_DEVICE]; +}ATOM_GPIO_I2C_INFO; + +/****************************************************************************/ +// Common Structure used in other structures +/****************************************************************************/ + +#ifndef _H2INC + +//Please don't add or expand this bitfield structure below, this one will retire soon.! +typedef struct _ATOM_MODE_MISC_INFO +{ +#if ATOM_BIG_ENDIAN + USHORT Reserved:6; + USHORT RGB888:1; + USHORT DoubleClock:1; + USHORT Interlace:1; + USHORT CompositeSync:1; + USHORT V_ReplicationBy2:1; + USHORT H_ReplicationBy2:1; + USHORT VerticalCutOff:1; + USHORT VSyncPolarity:1; //0=Active High, 1=Active Low + USHORT HSyncPolarity:1; //0=Active High, 1=Active Low + USHORT HorizontalCutOff:1; +#else + USHORT HorizontalCutOff:1; + USHORT HSyncPolarity:1; //0=Active High, 1=Active Low + USHORT VSyncPolarity:1; //0=Active High, 1=Active Low + USHORT VerticalCutOff:1; + USHORT H_ReplicationBy2:1; + USHORT V_ReplicationBy2:1; + USHORT CompositeSync:1; + USHORT Interlace:1; + USHORT DoubleClock:1; + USHORT RGB888:1; + USHORT Reserved:6; +#endif +}ATOM_MODE_MISC_INFO; + +typedef union _ATOM_MODE_MISC_INFO_ACCESS +{ + ATOM_MODE_MISC_INFO sbfAccess; + USHORT usAccess; +}ATOM_MODE_MISC_INFO_ACCESS; + +#else + +typedef union _ATOM_MODE_MISC_INFO_ACCESS +{ + USHORT usAccess; +}ATOM_MODE_MISC_INFO_ACCESS; + +#endif + +// usModeMiscInfo- +#define ATOM_H_CUTOFF 0x01 +#define ATOM_HSYNC_POLARITY 0x02 //0=Active High, 1=Active Low +#define ATOM_VSYNC_POLARITY 0x04 //0=Active High, 1=Active Low +#define ATOM_V_CUTOFF 0x08 +#define ATOM_H_REPLICATIONBY2 0x10 +#define ATOM_V_REPLICATIONBY2 0x20 +#define ATOM_COMPOSITESYNC 0x40 +#define ATOM_INTERLACE 0x80 +#define ATOM_DOUBLE_CLOCK_MODE 0x100 +#define ATOM_RGB888_MODE 0x200 + +//usRefreshRate- +#define ATOM_REFRESH_43 43 +#define ATOM_REFRESH_47 47 +#define ATOM_REFRESH_56 56 +#define ATOM_REFRESH_60 60 +#define ATOM_REFRESH_65 65 +#define ATOM_REFRESH_70 70 +#define ATOM_REFRESH_72 72 +#define ATOM_REFRESH_75 75 +#define ATOM_REFRESH_85 85 + +// ATOM_MODE_TIMING data are exactly the same as VESA timing data. +// Translation from EDID to ATOM_MODE_TIMING, use the following formula. +// +// VESA_HTOTAL = VESA_ACTIVE + 2* VESA_BORDER + VESA_BLANK +// = EDID_HA + EDID_HBL +// VESA_HDISP = VESA_ACTIVE = EDID_HA +// VESA_HSYNC_START = VESA_ACTIVE + VESA_BORDER + VESA_FRONT_PORCH +// = EDID_HA + EDID_HSO +// VESA_HSYNC_WIDTH = VESA_HSYNC_TIME = EDID_HSPW +// VESA_BORDER = EDID_BORDER + +/****************************************************************************/ +// Structure used in SetCRTC_UsingDTDTimingTable +/****************************************************************************/ +typedef struct _SET_CRTC_USING_DTD_TIMING_PARAMETERS +{ + USHORT usH_Size; + USHORT usH_Blanking_Time; + USHORT usV_Size; + USHORT usV_Blanking_Time; + USHORT usH_SyncOffset; + USHORT usH_SyncWidth; + USHORT usV_SyncOffset; + USHORT usV_SyncWidth; + ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo; + UCHAR ucH_Border; // From DFP EDID + UCHAR ucV_Border; + UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 + UCHAR ucPadding[3]; +}SET_CRTC_USING_DTD_TIMING_PARAMETERS; + +/****************************************************************************/ +// Structure used in SetCRTC_TimingTable +/****************************************************************************/ +typedef struct _SET_CRTC_TIMING_PARAMETERS +{ + USHORT usH_Total; // horizontal total + USHORT usH_Disp; // horizontal display + USHORT usH_SyncStart; // horozontal Sync start + USHORT usH_SyncWidth; // horizontal Sync width + USHORT usV_Total; // vertical total + USHORT usV_Disp; // vertical display + USHORT usV_SyncStart; // vertical Sync start + USHORT usV_SyncWidth; // vertical Sync width + ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo; + UCHAR ucCRTC; // ATOM_CRTC1 or ATOM_CRTC2 + UCHAR ucOverscanRight; // right + UCHAR ucOverscanLeft; // left + UCHAR ucOverscanBottom; // bottom + UCHAR ucOverscanTop; // top + UCHAR ucReserved; +}SET_CRTC_TIMING_PARAMETERS; +#define SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION SET_CRTC_TIMING_PARAMETERS + +/****************************************************************************/ +// Structure used in StandardVESA_TimingTable +// AnalogTV_InfoTable +// ComponentVideoInfoTable +/****************************************************************************/ +typedef struct _ATOM_MODE_TIMING +{ + USHORT usCRTC_H_Total; + USHORT usCRTC_H_Disp; + USHORT usCRTC_H_SyncStart; + USHORT usCRTC_H_SyncWidth; + USHORT usCRTC_V_Total; + USHORT usCRTC_V_Disp; + USHORT usCRTC_V_SyncStart; + USHORT usCRTC_V_SyncWidth; + USHORT usPixelClock; //in 10Khz unit + ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo; + USHORT usCRTC_OverscanRight; + USHORT usCRTC_OverscanLeft; + USHORT usCRTC_OverscanBottom; + USHORT usCRTC_OverscanTop; + USHORT usReserve; + UCHAR ucInternalModeNumber; + UCHAR ucRefreshRate; +}ATOM_MODE_TIMING; + +typedef struct _ATOM_DTD_FORMAT +{ + USHORT usPixClk; + USHORT usHActive; + USHORT usHBlanking_Time; + USHORT usVActive; + USHORT usVBlanking_Time; + USHORT usHSyncOffset; + USHORT usHSyncWidth; + USHORT usVSyncOffset; + USHORT usVSyncWidth; + USHORT usImageHSize; + USHORT usImageVSize; + UCHAR ucHBorder; + UCHAR ucVBorder; + ATOM_MODE_MISC_INFO_ACCESS susModeMiscInfo; + UCHAR ucInternalModeNumber; + UCHAR ucRefreshRate; +}ATOM_DTD_FORMAT; + +/****************************************************************************/ +// Structure used in LVDS_InfoTable +// * Need a document to describe this table +/****************************************************************************/ +#define SUPPORTED_LCD_REFRESHRATE_30Hz 0x0004 +#define SUPPORTED_LCD_REFRESHRATE_40Hz 0x0008 +#define SUPPORTED_LCD_REFRESHRATE_50Hz 0x0010 +#define SUPPORTED_LCD_REFRESHRATE_60Hz 0x0020 + +//ucTableFormatRevision=1 +//ucTableContentRevision=1 +typedef struct _ATOM_LVDS_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_DTD_FORMAT sLCDTiming; + USHORT usModePatchTableOffset; + USHORT usSupportedRefreshRate; //Refer to panel info table in ATOMBIOS extension Spec. + USHORT usOffDelayInMs; + UCHAR ucPowerSequenceDigOntoDEin10Ms; + UCHAR ucPowerSequenceDEtoBLOnin10Ms; + UCHAR ucLVDS_Misc; // Bit0:{=0:single, =1:dual},Bit1 {=0:666RGB, =1:888RGB},Bit2:3:{Grey level} + // Bit4:{=0:LDI format for RGB888, =1 FPDI format for RGB888} + // Bit5:{=0:Spatial Dithering disabled;1 Spatial Dithering enabled} + // Bit6:{=0:Temporal Dithering disabled;1 Temporal Dithering enabled} + UCHAR ucPanelDefaultRefreshRate; + UCHAR ucPanelIdentification; + UCHAR ucSS_Id; +}ATOM_LVDS_INFO; + +//ucTableFormatRevision=1 +//ucTableContentRevision=2 +typedef struct _ATOM_LVDS_INFO_V12 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_DTD_FORMAT sLCDTiming; + USHORT usExtInfoTableOffset; + USHORT usSupportedRefreshRate; //Refer to panel info table in ATOMBIOS extension Spec. + USHORT usOffDelayInMs; + UCHAR ucPowerSequenceDigOntoDEin10Ms; + UCHAR ucPowerSequenceDEtoBLOnin10Ms; + UCHAR ucLVDS_Misc; // Bit0:{=0:single, =1:dual},Bit1 {=0:666RGB, =1:888RGB},Bit2:3:{Grey level} + // Bit4:{=0:LDI format for RGB888, =1 FPDI format for RGB888} + // Bit5:{=0:Spatial Dithering disabled;1 Spatial Dithering enabled} + // Bit6:{=0:Temporal Dithering disabled;1 Temporal Dithering enabled} + UCHAR ucPanelDefaultRefreshRate; + UCHAR ucPanelIdentification; + UCHAR ucSS_Id; + USHORT usLCDVenderID; + USHORT usLCDProductID; + UCHAR ucLCDPanel_SpecialHandlingCap; + UCHAR ucPanelInfoSize; // start from ATOM_DTD_FORMAT to end of panel info, include ExtInfoTable + UCHAR ucReserved[2]; +}ATOM_LVDS_INFO_V12; + +//Definitions for ucLCDPanel_SpecialHandlingCap: + +//Once DAL sees this CAP is set, it will read EDID from LCD on its own instead of using sLCDTiming in ATOM_LVDS_INFO_V12. +//Other entries in ATOM_LVDS_INFO_V12 are still valid/useful to DAL +#define LCDPANEL_CAP_READ_EDID 0x1 + +//If a design supports DRR (dynamic refresh rate) on internal panels (LVDS or EDP), this cap is set in ucLCDPanel_SpecialHandlingCap together +//with multiple supported refresh rates@usSupportedRefreshRate. This cap should not be set when only slow refresh rate is supported (static +//refresh rate switch by SW. This is only valid from ATOM_LVDS_INFO_V12 +#define LCDPANEL_CAP_DRR_SUPPORTED 0x2 + +//Use this cap bit for a quick reference whether an embadded panel (LCD1 ) is LVDS or eDP. +#define LCDPANEL_CAP_eDP 0x4 + + +//Color Bit Depth definition in EDID V1.4 @BYTE 14h +//Bit 6 5 4 + // 0 0 0 - Color bit depth is undefined + // 0 0 1 - 6 Bits per Primary Color + // 0 1 0 - 8 Bits per Primary Color + // 0 1 1 - 10 Bits per Primary Color + // 1 0 0 - 12 Bits per Primary Color + // 1 0 1 - 14 Bits per Primary Color + // 1 1 0 - 16 Bits per Primary Color + // 1 1 1 - Reserved + +#define PANEL_COLOR_BIT_DEPTH_MASK 0x70 + +// Bit7:{=0:Random Dithering disabled;1 Random Dithering enabled} +#define PANEL_RANDOM_DITHER 0x80 +#define PANEL_RANDOM_DITHER_MASK 0x80 + +#define ATOM_LVDS_INFO_LAST ATOM_LVDS_INFO_V12 // no need to change this + +/****************************************************************************/ +// Structures used by LCD_InfoTable V1.3 Note: previous version was called ATOM_LVDS_INFO_V12 +// ASIC Families: NI +// ucTableFormatRevision=1 +// ucTableContentRevision=3 +/****************************************************************************/ +typedef struct _ATOM_LCD_INFO_V13 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_DTD_FORMAT sLCDTiming; + USHORT usExtInfoTableOffset; + USHORT usSupportedRefreshRate; //Refer to panel info table in ATOMBIOS extension Spec. + ULONG ulReserved0; + UCHAR ucLCD_Misc; // Reorganized in V13 + // Bit0: {=0:single, =1:dual}, + // Bit1: {=0:LDI format for RGB888, =1 FPDI format for RGB888} // was {=0:666RGB, =1:888RGB}, + // Bit3:2: {Grey level} + // Bit6:4 Color Bit Depth definition (see below definition in EDID V1.4 @BYTE 14h) + // Bit7 Reserved. was for ATOM_PANEL_MISC_API_ENABLED, still need it? + UCHAR ucPanelDefaultRefreshRate; + UCHAR ucPanelIdentification; + UCHAR ucSS_Id; + USHORT usLCDVenderID; + USHORT usLCDProductID; + UCHAR ucLCDPanel_SpecialHandlingCap; // Reorganized in V13 + // Bit0: Once DAL sees this CAP is set, it will read EDID from LCD on its own + // Bit1: See LCDPANEL_CAP_DRR_SUPPORTED + // Bit2: a quick reference whether an embadded panel (LCD1 ) is LVDS (0) or eDP (1) + // Bit7-3: Reserved + UCHAR ucPanelInfoSize; // start from ATOM_DTD_FORMAT to end of panel info, include ExtInfoTable + USHORT usBacklightPWM; // Backlight PWM in Hz. New in _V13 + + UCHAR ucPowerSequenceDIGONtoDE_in4Ms; + UCHAR ucPowerSequenceDEtoVARY_BL_in4Ms; + UCHAR ucPowerSequenceDEtoDIGON_in4Ms; + UCHAR ucPowerSequenceVARY_BLtoDE_in4Ms; + + UCHAR ucOffDelay_in4Ms; + UCHAR ucPowerSequenceVARY_BLtoBLON_in4Ms; + UCHAR ucPowerSequenceBLONtoVARY_BL_in4Ms; + UCHAR ucReserved1; + + ULONG ulReserved[4]; +}ATOM_LCD_INFO_V13; + +#define ATOM_LCD_INFO_LAST ATOM_LCD_INFO_V13 + +//Definitions for ucLCD_Misc +#define ATOM_PANEL_MISC_V13_DUAL 0x00000001 +#define ATOM_PANEL_MISC_V13_FPDI 0x00000002 +#define ATOM_PANEL_MISC_V13_GREY_LEVEL 0x0000000C +#define ATOM_PANEL_MISC_V13_GREY_LEVEL_SHIFT 2 +#define ATOM_PANEL_MISC_V13_COLOR_BIT_DEPTH_MASK 0x70 +#define ATOM_PANEL_MISC_V13_6BIT_PER_COLOR 0x10 +#define ATOM_PANEL_MISC_V13_8BIT_PER_COLOR 0x20 + +//Color Bit Depth definition in EDID V1.4 @BYTE 14h +//Bit 6 5 4 + // 0 0 0 - Color bit depth is undefined + // 0 0 1 - 6 Bits per Primary Color + // 0 1 0 - 8 Bits per Primary Color + // 0 1 1 - 10 Bits per Primary Color + // 1 0 0 - 12 Bits per Primary Color + // 1 0 1 - 14 Bits per Primary Color + // 1 1 0 - 16 Bits per Primary Color + // 1 1 1 - Reserved + +//Definitions for ucLCDPanel_SpecialHandlingCap: + +//Once DAL sees this CAP is set, it will read EDID from LCD on its own instead of using sLCDTiming in ATOM_LVDS_INFO_V12. +//Other entries in ATOM_LVDS_INFO_V12 are still valid/useful to DAL +#define LCDPANEL_CAP_V13_READ_EDID 0x1 // = LCDPANEL_CAP_READ_EDID no change comparing to previous version + +//If a design supports DRR (dynamic refresh rate) on internal panels (LVDS or EDP), this cap is set in ucLCDPanel_SpecialHandlingCap together +//with multiple supported refresh rates@usSupportedRefreshRate. This cap should not be set when only slow refresh rate is supported (static +//refresh rate switch by SW. This is only valid from ATOM_LVDS_INFO_V12 +#define LCDPANEL_CAP_V13_DRR_SUPPORTED 0x2 // = LCDPANEL_CAP_DRR_SUPPORTED no change comparing to previous version + +//Use this cap bit for a quick reference whether an embadded panel (LCD1 ) is LVDS or eDP. +#define LCDPANEL_CAP_V13_eDP 0x4 // = LCDPANEL_CAP_eDP no change comparing to previous version + +typedef struct _ATOM_PATCH_RECORD_MODE +{ + UCHAR ucRecordType; + USHORT usHDisp; + USHORT usVDisp; +}ATOM_PATCH_RECORD_MODE; + +typedef struct _ATOM_LCD_RTS_RECORD +{ + UCHAR ucRecordType; + UCHAR ucRTSValue; +}ATOM_LCD_RTS_RECORD; + +//!! If the record below exits, it shoud always be the first record for easy use in command table!!! +// The record below is only used when LVDS_Info is present. From ATOM_LVDS_INFO_V12, use ucLCDPanel_SpecialHandlingCap instead. +typedef struct _ATOM_LCD_MODE_CONTROL_CAP +{ + UCHAR ucRecordType; + USHORT usLCDCap; +}ATOM_LCD_MODE_CONTROL_CAP; + +#define LCD_MODE_CAP_BL_OFF 1 +#define LCD_MODE_CAP_CRTC_OFF 2 +#define LCD_MODE_CAP_PANEL_OFF 4 + +typedef struct _ATOM_FAKE_EDID_PATCH_RECORD +{ + UCHAR ucRecordType; + UCHAR ucFakeEDIDLength; + UCHAR ucFakeEDIDString[1]; // This actually has ucFakeEdidLength elements. +} ATOM_FAKE_EDID_PATCH_RECORD; + +typedef struct _ATOM_PANEL_RESOLUTION_PATCH_RECORD +{ + UCHAR ucRecordType; + USHORT usHSize; + USHORT usVSize; +}ATOM_PANEL_RESOLUTION_PATCH_RECORD; + +#define LCD_MODE_PATCH_RECORD_MODE_TYPE 1 +#define LCD_RTS_RECORD_TYPE 2 +#define LCD_CAP_RECORD_TYPE 3 +#define LCD_FAKE_EDID_PATCH_RECORD_TYPE 4 +#define LCD_PANEL_RESOLUTION_RECORD_TYPE 5 +#define ATOM_RECORD_END_TYPE 0xFF + +/****************************Spread Spectrum Info Table Definitions **********************/ + +//ucTableFormatRevision=1 +//ucTableContentRevision=2 +typedef struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT +{ + USHORT usSpreadSpectrumPercentage; + UCHAR ucSpreadSpectrumType; //Bit1=0 Down Spread,=1 Center Spread. Bit1=1 Ext. =0 Int. Bit2=1: PCIE REFCLK SS =0 iternal PPLL SS Others:TBD + UCHAR ucSS_Step; + UCHAR ucSS_Delay; + UCHAR ucSS_Id; + UCHAR ucRecommendedRef_Div; + UCHAR ucSS_Range; //it was reserved for V11 +}ATOM_SPREAD_SPECTRUM_ASSIGNMENT; + +#define ATOM_MAX_SS_ENTRY 16 +#define ATOM_DP_SS_ID1 0x0f1 // SS ID for internal DP stream at 2.7Ghz. if ATOM_DP_SS_ID2 does not exist in SS_InfoTable, it is used for internal DP stream at 1.62Ghz as well. +#define ATOM_DP_SS_ID2 0x0f2 // SS ID for internal DP stream at 1.62Ghz, if it exists in SS_InfoTable. +#define ATOM_LVLINK_2700MHz_SS_ID 0x0f3 // SS ID for LV link translator chip at 2.7Ghz +#define ATOM_LVLINK_1620MHz_SS_ID 0x0f4 // SS ID for LV link translator chip at 1.62Ghz + + +#define ATOM_SS_DOWN_SPREAD_MODE_MASK 0x00000000 +#define ATOM_SS_DOWN_SPREAD_MODE 0x00000000 +#define ATOM_SS_CENTRE_SPREAD_MODE_MASK 0x00000001 +#define ATOM_SS_CENTRE_SPREAD_MODE 0x00000001 +#define ATOM_INTERNAL_SS_MASK 0x00000000 +#define ATOM_EXTERNAL_SS_MASK 0x00000002 +#define EXEC_SS_STEP_SIZE_SHIFT 2 +#define EXEC_SS_DELAY_SHIFT 4 +#define ACTIVEDATA_TO_BLON_DELAY_SHIFT 4 + +typedef struct _ATOM_SPREAD_SPECTRUM_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_SPREAD_SPECTRUM_ASSIGNMENT asSS_Info[ATOM_MAX_SS_ENTRY]; +}ATOM_SPREAD_SPECTRUM_INFO; + +/****************************************************************************/ +// Structure used in AnalogTV_InfoTable (Top level) +/****************************************************************************/ +//ucTVBootUpDefaultStd definition: + +//ATOM_TV_NTSC 1 +//ATOM_TV_NTSCJ 2 +//ATOM_TV_PAL 3 +//ATOM_TV_PALM 4 +//ATOM_TV_PALCN 5 +//ATOM_TV_PALN 6 +//ATOM_TV_PAL60 7 +//ATOM_TV_SECAM 8 + +//ucTVSupportedStd definition: +#define NTSC_SUPPORT 0x1 +#define NTSCJ_SUPPORT 0x2 + +#define PAL_SUPPORT 0x4 +#define PALM_SUPPORT 0x8 +#define PALCN_SUPPORT 0x10 +#define PALN_SUPPORT 0x20 +#define PAL60_SUPPORT 0x40 +#define SECAM_SUPPORT 0x80 + +#define MAX_SUPPORTED_TV_TIMING 2 + +typedef struct _ATOM_ANALOG_TV_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucTV_SupportedStandard; + UCHAR ucTV_BootUpDefaultStandard; + UCHAR ucExt_TV_ASIC_ID; + UCHAR ucExt_TV_ASIC_SlaveAddr; + /*ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING];*/ + ATOM_MODE_TIMING aModeTimings[MAX_SUPPORTED_TV_TIMING]; +}ATOM_ANALOG_TV_INFO; + +#define MAX_SUPPORTED_TV_TIMING_V1_2 3 + +typedef struct _ATOM_ANALOG_TV_INFO_V1_2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucTV_SupportedStandard; + UCHAR ucTV_BootUpDefaultStandard; + UCHAR ucExt_TV_ASIC_ID; + UCHAR ucExt_TV_ASIC_SlaveAddr; + ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING_V1_2]; +}ATOM_ANALOG_TV_INFO_V1_2; + +typedef struct _ATOM_DPCD_INFO +{ + UCHAR ucRevisionNumber; //10h : Revision 1.0; 11h : Revision 1.1 + UCHAR ucMaxLinkRate; //06h : 1.62Gbps per lane; 0Ah = 2.7Gbps per lane + UCHAR ucMaxLane; //Bits 4:0 = MAX_LANE_COUNT (1/2/4). Bit 7 = ENHANCED_FRAME_CAP + UCHAR ucMaxDownSpread; //Bit0 = 0: No Down spread; Bit0 = 1: 0.5% (Subject to change according to DP spec) +}ATOM_DPCD_INFO; + +#define ATOM_DPCD_MAX_LANE_MASK 0x1F + +/**************************************************************************/ +// VRAM usage and their defintions + +// One chunk of VRAM used by Bios are for HWICON surfaces,EDID data. +// Current Mode timing and Dail Timing and/or STD timing data EACH device. They can be broken down as below. +// All the addresses below are the offsets from the frame buffer start.They all MUST be Dword aligned! +// To driver: The physical address of this memory portion=mmFB_START(4K aligned)+ATOMBIOS_VRAM_USAGE_START_ADDR+ATOM_x_ADDR +// To Bios: ATOMBIOS_VRAM_USAGE_START_ADDR+ATOM_x_ADDR->MM_INDEX + +#ifndef VESA_MEMORY_IN_64K_BLOCK +#define VESA_MEMORY_IN_64K_BLOCK 0x100 //256*64K=16Mb (Max. VESA memory is 16Mb!) +#endif + +#define ATOM_EDID_RAW_DATASIZE 256 //In Bytes +#define ATOM_HWICON_SURFACE_SIZE 4096 //In Bytes +#define ATOM_HWICON_INFOTABLE_SIZE 32 +#define MAX_DTD_MODE_IN_VRAM 6 +#define ATOM_DTD_MODE_SUPPORT_TBL_SIZE (MAX_DTD_MODE_IN_VRAM*28) //28= (SIZEOF ATOM_DTD_FORMAT) +#define ATOM_STD_MODE_SUPPORT_TBL_SIZE 32*8 //32 is a predefined number,8= (SIZEOF ATOM_STD_FORMAT) +//20 bytes for Encoder Type and DPCD in STD EDID area +#define DFP_ENCODER_TYPE_OFFSET (ATOM_EDID_RAW_DATASIZE + ATOM_DTD_MODE_SUPPORT_TBL_SIZE + ATOM_STD_MODE_SUPPORT_TBL_SIZE - 20) +#define ATOM_DP_DPCD_OFFSET (DFP_ENCODER_TYPE_OFFSET + 4 ) + +#define ATOM_HWICON1_SURFACE_ADDR 0 +#define ATOM_HWICON2_SURFACE_ADDR (ATOM_HWICON1_SURFACE_ADDR + ATOM_HWICON_SURFACE_SIZE) +#define ATOM_HWICON_INFOTABLE_ADDR (ATOM_HWICON2_SURFACE_ADDR + ATOM_HWICON_SURFACE_SIZE) +#define ATOM_CRT1_EDID_ADDR (ATOM_HWICON_INFOTABLE_ADDR + ATOM_HWICON_INFOTABLE_SIZE) +#define ATOM_CRT1_DTD_MODE_TBL_ADDR (ATOM_CRT1_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_CRT1_STD_MODE_TBL_ADDR (ATOM_CRT1_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_LCD1_EDID_ADDR (ATOM_CRT1_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_LCD1_DTD_MODE_TBL_ADDR (ATOM_LCD1_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_LCD1_STD_MODE_TBL_ADDR (ATOM_LCD1_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_TV1_DTD_MODE_TBL_ADDR (ATOM_LCD1_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_DFP1_EDID_ADDR (ATOM_TV1_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_DFP1_DTD_MODE_TBL_ADDR (ATOM_DFP1_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_DFP1_STD_MODE_TBL_ADDR (ATOM_DFP1_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_CRT2_EDID_ADDR (ATOM_DFP1_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_CRT2_DTD_MODE_TBL_ADDR (ATOM_CRT2_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_CRT2_STD_MODE_TBL_ADDR (ATOM_CRT2_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_LCD2_EDID_ADDR (ATOM_CRT2_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_LCD2_DTD_MODE_TBL_ADDR (ATOM_LCD2_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_LCD2_STD_MODE_TBL_ADDR (ATOM_LCD2_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_DFP6_EDID_ADDR (ATOM_LCD2_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_DFP6_DTD_MODE_TBL_ADDR (ATOM_DFP6_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_DFP6_STD_MODE_TBL_ADDR (ATOM_DFP6_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_DFP2_EDID_ADDR (ATOM_DFP6_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_DFP2_DTD_MODE_TBL_ADDR (ATOM_DFP2_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_DFP2_STD_MODE_TBL_ADDR (ATOM_DFP2_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_CV_EDID_ADDR (ATOM_DFP2_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_CV_DTD_MODE_TBL_ADDR (ATOM_CV_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_CV_STD_MODE_TBL_ADDR (ATOM_CV_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_DFP3_EDID_ADDR (ATOM_CV_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_DFP3_DTD_MODE_TBL_ADDR (ATOM_DFP3_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_DFP3_STD_MODE_TBL_ADDR (ATOM_DFP3_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_DFP4_EDID_ADDR (ATOM_DFP3_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_DFP4_DTD_MODE_TBL_ADDR (ATOM_DFP4_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_DFP4_STD_MODE_TBL_ADDR (ATOM_DFP4_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_DFP5_EDID_ADDR (ATOM_DFP4_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) +#define ATOM_DFP5_DTD_MODE_TBL_ADDR (ATOM_DFP5_EDID_ADDR + ATOM_EDID_RAW_DATASIZE) +#define ATOM_DFP5_STD_MODE_TBL_ADDR (ATOM_DFP5_DTD_MODE_TBL_ADDR + ATOM_DTD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_DP_TRAINING_TBL_ADDR (ATOM_DFP5_STD_MODE_TBL_ADDR + ATOM_STD_MODE_SUPPORT_TBL_SIZE) + +#define ATOM_STACK_STORAGE_START (ATOM_DP_TRAINING_TBL_ADDR + 1024) +#define ATOM_STACK_STORAGE_END ATOM_STACK_STORAGE_START + 512 + +//The size below is in Kb! +#define ATOM_VRAM_RESERVE_SIZE ((((ATOM_STACK_STORAGE_END - ATOM_HWICON1_SURFACE_ADDR)>>10)+4)&0xFFFC) + +#define ATOM_VRAM_RESERVE_V2_SIZE 32 + +#define ATOM_VRAM_OPERATION_FLAGS_MASK 0xC0000000L +#define ATOM_VRAM_OPERATION_FLAGS_SHIFT 30 +#define ATOM_VRAM_BLOCK_NEEDS_NO_RESERVATION 0x1 +#define ATOM_VRAM_BLOCK_NEEDS_RESERVATION 0x0 + +/***********************************************************************************/ +// Structure used in VRAM_UsageByFirmwareTable +// Note1: This table is filled by SetBiosReservationStartInFB in CoreCommSubs.asm +// at running time. +// note2: From RV770, the memory is more than 32bit addressable, so we will change +// ucTableFormatRevision=1,ucTableContentRevision=4, the strcuture remains +// exactly same as 1.1 and 1.2 (1.3 is never in use), but ulStartAddrUsedByFirmware +// (in offset to start of memory address) is KB aligned instead of byte aligend. +/***********************************************************************************/ +// Note3: +/* If we change usReserved to "usFBUsedbyDrvInKB", then to VBIOS this usFBUsedbyDrvInKB is a predefined, unchanged constant across VGA or non VGA adapter, +for CAIL, The size of FB access area is known, only thing missing is the Offset of FB Access area, so we can have: + +If (ulStartAddrUsedByFirmware!=0) +FBAccessAreaOffset= ulStartAddrUsedByFirmware - usFBUsedbyDrvInKB; +Reserved area has been claimed by VBIOS including this FB access area; CAIL doesn't need to reserve any extra area for this purpose +else //Non VGA case + if (FB_Size<=2Gb) + FBAccessAreaOffset= FB_Size - usFBUsedbyDrvInKB; + else + FBAccessAreaOffset= Aper_Size - usFBUsedbyDrvInKB + +CAIL needs to claim an reserved area defined by FBAccessAreaOffset and usFBUsedbyDrvInKB in non VGA case.*/ + +#define ATOM_MAX_FIRMWARE_VRAM_USAGE_INFO 1 + +typedef struct _ATOM_FIRMWARE_VRAM_RESERVE_INFO +{ + ULONG ulStartAddrUsedByFirmware; + USHORT usFirmwareUseInKb; + USHORT usReserved; +}ATOM_FIRMWARE_VRAM_RESERVE_INFO; + +typedef struct _ATOM_VRAM_USAGE_BY_FIRMWARE +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_FIRMWARE_VRAM_RESERVE_INFO asFirmwareVramReserveInfo[ATOM_MAX_FIRMWARE_VRAM_USAGE_INFO]; +}ATOM_VRAM_USAGE_BY_FIRMWARE; + +// change verion to 1.5, when allow driver to allocate the vram area for command table access. +typedef struct _ATOM_FIRMWARE_VRAM_RESERVE_INFO_V1_5 +{ + ULONG ulStartAddrUsedByFirmware; + USHORT usFirmwareUseInKb; + USHORT usFBUsedByDrvInKb; +}ATOM_FIRMWARE_VRAM_RESERVE_INFO_V1_5; + +typedef struct _ATOM_VRAM_USAGE_BY_FIRMWARE_V1_5 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_FIRMWARE_VRAM_RESERVE_INFO_V1_5 asFirmwareVramReserveInfo[ATOM_MAX_FIRMWARE_VRAM_USAGE_INFO]; +}ATOM_VRAM_USAGE_BY_FIRMWARE_V1_5; + +/****************************************************************************/ +// Structure used in GPIO_Pin_LUTTable +/****************************************************************************/ +typedef struct _ATOM_GPIO_PIN_ASSIGNMENT +{ + USHORT usGpioPin_AIndex; + UCHAR ucGpioPinBitShift; + UCHAR ucGPIO_ID; +}ATOM_GPIO_PIN_ASSIGNMENT; + +typedef struct _ATOM_GPIO_PIN_LUT +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_GPIO_PIN_ASSIGNMENT asGPIO_Pin[1]; +}ATOM_GPIO_PIN_LUT; + +/****************************************************************************/ +// Structure used in ComponentVideoInfoTable +/****************************************************************************/ +#define GPIO_PIN_ACTIVE_HIGH 0x1 + +#define MAX_SUPPORTED_CV_STANDARDS 5 + +// definitions for ATOM_D_INFO.ucSettings +#define ATOM_GPIO_SETTINGS_BITSHIFT_MASK 0x1F // [4:0] +#define ATOM_GPIO_SETTINGS_RESERVED_MASK 0x60 // [6:5] = must be zeroed out +#define ATOM_GPIO_SETTINGS_ACTIVE_MASK 0x80 // [7] + +typedef struct _ATOM_GPIO_INFO +{ + USHORT usAOffset; + UCHAR ucSettings; + UCHAR ucReserved; +}ATOM_GPIO_INFO; + +// definitions for ATOM_COMPONENT_VIDEO_INFO.ucMiscInfo (bit vector) +#define ATOM_CV_RESTRICT_FORMAT_SELECTION 0x2 + +// definitions for ATOM_COMPONENT_VIDEO_INFO.uc480i/uc480p/uc720p/uc1080i +#define ATOM_GPIO_DEFAULT_MODE_EN 0x80 //[7]; +#define ATOM_GPIO_SETTING_PERMODE_MASK 0x7F //[6:0] + +// definitions for ATOM_COMPONENT_VIDEO_INFO.ucLetterBoxMode +//Line 3 out put 5V. +#define ATOM_CV_LINE3_ASPECTRATIO_16_9_GPIO_A 0x01 //represent gpio 3 state for 16:9 +#define ATOM_CV_LINE3_ASPECTRATIO_16_9_GPIO_B 0x02 //represent gpio 4 state for 16:9 +#define ATOM_CV_LINE3_ASPECTRATIO_16_9_GPIO_SHIFT 0x0 + +//Line 3 out put 2.2V +#define ATOM_CV_LINE3_ASPECTRATIO_4_3_LETBOX_GPIO_A 0x04 //represent gpio 3 state for 4:3 Letter box +#define ATOM_CV_LINE3_ASPECTRATIO_4_3_LETBOX_GPIO_B 0x08 //represent gpio 4 state for 4:3 Letter box +#define ATOM_CV_LINE3_ASPECTRATIO_4_3_LETBOX_GPIO_SHIFT 0x2 + +//Line 3 out put 0V +#define ATOM_CV_LINE3_ASPECTRATIO_4_3_GPIO_A 0x10 //represent gpio 3 state for 4:3 +#define ATOM_CV_LINE3_ASPECTRATIO_4_3_GPIO_B 0x20 //represent gpio 4 state for 4:3 +#define ATOM_CV_LINE3_ASPECTRATIO_4_3_GPIO_SHIFT 0x4 + +#define ATOM_CV_LINE3_ASPECTRATIO_MASK 0x3F // bit [5:0] + +#define ATOM_CV_LINE3_ASPECTRATIO_EXIST 0x80 //bit 7 + +//GPIO bit index in gpio setting per mode value, also represend the block no. in gpio blocks. +#define ATOM_GPIO_INDEX_LINE3_ASPECRATIO_GPIO_A 3 //bit 3 in uc480i/uc480p/uc720p/uc1080i, which represend the default gpio bit setting for the mode. +#define ATOM_GPIO_INDEX_LINE3_ASPECRATIO_GPIO_B 4 //bit 4 in uc480i/uc480p/uc720p/uc1080i, which represend the default gpio bit setting for the mode. + + +typedef struct _ATOM_COMPONENT_VIDEO_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usMask_PinRegisterIndex; + USHORT usEN_PinRegisterIndex; + USHORT usY_PinRegisterIndex; + USHORT usA_PinRegisterIndex; + UCHAR ucBitShift; + UCHAR ucPinActiveState; //ucPinActiveState: Bit0=1 active high, =0 active low + ATOM_DTD_FORMAT sReserved; // must be zeroed out + UCHAR ucMiscInfo; + UCHAR uc480i; + UCHAR uc480p; + UCHAR uc720p; + UCHAR uc1080i; + UCHAR ucLetterBoxMode; + UCHAR ucReserved[3]; + UCHAR ucNumOfWbGpioBlocks; //For Component video D-Connector support. If zere, NTSC type connector + ATOM_GPIO_INFO aWbGpioStateBlock[MAX_SUPPORTED_CV_STANDARDS]; + ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_CV_STANDARDS]; +}ATOM_COMPONENT_VIDEO_INFO; + +//ucTableFormatRevision=2 +//ucTableContentRevision=1 +typedef struct _ATOM_COMPONENT_VIDEO_INFO_V21 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucMiscInfo; + UCHAR uc480i; + UCHAR uc480p; + UCHAR uc720p; + UCHAR uc1080i; + UCHAR ucReserved; + UCHAR ucLetterBoxMode; + UCHAR ucNumOfWbGpioBlocks; //For Component video D-Connector support. If zere, NTSC type connector + ATOM_GPIO_INFO aWbGpioStateBlock[MAX_SUPPORTED_CV_STANDARDS]; + ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_CV_STANDARDS]; +}ATOM_COMPONENT_VIDEO_INFO_V21; + +#define ATOM_COMPONENT_VIDEO_INFO_LAST ATOM_COMPONENT_VIDEO_INFO_V21 + +/****************************************************************************/ +// Structure used in object_InfoTable +/****************************************************************************/ +typedef struct _ATOM_OBJECT_HEADER +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usDeviceSupport; + USHORT usConnectorObjectTableOffset; + USHORT usRouterObjectTableOffset; + USHORT usEncoderObjectTableOffset; + USHORT usProtectionObjectTableOffset; //only available when Protection block is independent. + USHORT usDisplayPathTableOffset; +}ATOM_OBJECT_HEADER; + +typedef struct _ATOM_OBJECT_HEADER_V3 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usDeviceSupport; + USHORT usConnectorObjectTableOffset; + USHORT usRouterObjectTableOffset; + USHORT usEncoderObjectTableOffset; + USHORT usProtectionObjectTableOffset; //only available when Protection block is independent. + USHORT usDisplayPathTableOffset; + USHORT usMiscObjectTableOffset; +}ATOM_OBJECT_HEADER_V3; + +typedef struct _ATOM_DISPLAY_OBJECT_PATH +{ + USHORT usDeviceTag; //supported device + USHORT usSize; //the size of ATOM_DISPLAY_OBJECT_PATH + USHORT usConnObjectId; //Connector Object ID + USHORT usGPUObjectId; //GPU ID + USHORT usGraphicObjIds[1]; //1st Encoder Obj source from GPU to last Graphic Obj destinate to connector. +}ATOM_DISPLAY_OBJECT_PATH; + +typedef struct _ATOM_DISPLAY_EXTERNAL_OBJECT_PATH +{ + USHORT usDeviceTag; //supported device + USHORT usSize; //the size of ATOM_DISPLAY_OBJECT_PATH + USHORT usConnObjectId; //Connector Object ID + USHORT usGPUObjectId; //GPU ID + USHORT usGraphicObjIds[2]; //usGraphicObjIds[0]= GPU internal encoder, usGraphicObjIds[1]= external encoder +}ATOM_DISPLAY_EXTERNAL_OBJECT_PATH; + +typedef struct _ATOM_DISPLAY_OBJECT_PATH_TABLE +{ + UCHAR ucNumOfDispPath; + UCHAR ucVersion; + UCHAR ucPadding[2]; + ATOM_DISPLAY_OBJECT_PATH asDispPath[1]; +}ATOM_DISPLAY_OBJECT_PATH_TABLE; + + +typedef struct _ATOM_OBJECT //each object has this structure +{ + USHORT usObjectID; + USHORT usSrcDstTableOffset; + USHORT usRecordOffset; //this pointing to a bunch of records defined below + USHORT usReserved; +}ATOM_OBJECT; + +typedef struct _ATOM_OBJECT_TABLE //Above 4 object table offset pointing to a bunch of objects all have this structure +{ + UCHAR ucNumberOfObjects; + UCHAR ucPadding[3]; + ATOM_OBJECT asObjects[1]; +}ATOM_OBJECT_TABLE; + +typedef struct _ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT //usSrcDstTableOffset pointing to this structure +{ + UCHAR ucNumberOfSrc; + USHORT usSrcObjectID[1]; + UCHAR ucNumberOfDst; + USHORT usDstObjectID[1]; +}ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT; + + +//Two definitions below are for OPM on MXM module designs + +#define EXT_HPDPIN_LUTINDEX_0 0 +#define EXT_HPDPIN_LUTINDEX_1 1 +#define EXT_HPDPIN_LUTINDEX_2 2 +#define EXT_HPDPIN_LUTINDEX_3 3 +#define EXT_HPDPIN_LUTINDEX_4 4 +#define EXT_HPDPIN_LUTINDEX_5 5 +#define EXT_HPDPIN_LUTINDEX_6 6 +#define EXT_HPDPIN_LUTINDEX_7 7 +#define MAX_NUMBER_OF_EXT_HPDPIN_LUT_ENTRIES (EXT_HPDPIN_LUTINDEX_7+1) + +#define EXT_AUXDDC_LUTINDEX_0 0 +#define EXT_AUXDDC_LUTINDEX_1 1 +#define EXT_AUXDDC_LUTINDEX_2 2 +#define EXT_AUXDDC_LUTINDEX_3 3 +#define EXT_AUXDDC_LUTINDEX_4 4 +#define EXT_AUXDDC_LUTINDEX_5 5 +#define EXT_AUXDDC_LUTINDEX_6 6 +#define EXT_AUXDDC_LUTINDEX_7 7 +#define MAX_NUMBER_OF_EXT_AUXDDC_LUT_ENTRIES (EXT_AUXDDC_LUTINDEX_7+1) + +//ucChannelMapping are defined as following +//for DP connector, eDP, DP to VGA/LVDS +//Bit[1:0]: Define which pin connect to DP connector DP_Lane0, =0: source from GPU pin TX0, =1: from GPU pin TX1, =2: from GPU pin TX2, =3 from GPU pin TX3 +//Bit[3:2]: Define which pin connect to DP connector DP_Lane1, =0: source from GPU pin TX0, =1: from GPU pin TX1, =2: from GPU pin TX2, =3 from GPU pin TX3 +//Bit[5:4]: Define which pin connect to DP connector DP_Lane2, =0: source from GPU pin TX0, =1: from GPU pin TX1, =2: from GPU pin TX2, =3 from GPU pin TX3 +//Bit[7:6]: Define which pin connect to DP connector DP_Lane3, =0: source from GPU pin TX0, =1: from GPU pin TX1, =2: from GPU pin TX2, =3 from GPU pin TX3 +typedef struct _ATOM_DP_CONN_CHANNEL_MAPPING +{ +#if ATOM_BIG_ENDIAN + UCHAR ucDP_Lane3_Source:2; + UCHAR ucDP_Lane2_Source:2; + UCHAR ucDP_Lane1_Source:2; + UCHAR ucDP_Lane0_Source:2; +#else + UCHAR ucDP_Lane0_Source:2; + UCHAR ucDP_Lane1_Source:2; + UCHAR ucDP_Lane2_Source:2; + UCHAR ucDP_Lane3_Source:2; +#endif +}ATOM_DP_CONN_CHANNEL_MAPPING; + +//for DVI/HDMI, in dual link case, both links have to have same mapping. +//Bit[1:0]: Define which pin connect to DVI connector data Lane2, =0: source from GPU pin TX0, =1: from GPU pin TX1, =2: from GPU pin TX2, =3 from GPU pin TX3 +//Bit[3:2]: Define which pin connect to DVI connector data Lane1, =0: source from GPU pin TX0, =1: from GPU pin TX1, =2: from GPU pin TX2, =3 from GPU pin TX3 +//Bit[5:4]: Define which pin connect to DVI connector data Lane0, =0: source from GPU pin TX0, =1: from GPU pin TX1, =2: from GPU pin TX2, =3 from GPU pin TX3 +//Bit[7:6]: Define which pin connect to DVI connector clock lane, =0: source from GPU pin TX0, =1: from GPU pin TX1, =2: from GPU pin TX2, =3 from GPU pin TX3 +typedef struct _ATOM_DVI_CONN_CHANNEL_MAPPING +{ +#if ATOM_BIG_ENDIAN + UCHAR ucDVI_CLK_Source:2; + UCHAR ucDVI_DATA0_Source:2; + UCHAR ucDVI_DATA1_Source:2; + UCHAR ucDVI_DATA2_Source:2; +#else + UCHAR ucDVI_DATA2_Source:2; + UCHAR ucDVI_DATA1_Source:2; + UCHAR ucDVI_DATA0_Source:2; + UCHAR ucDVI_CLK_Source:2; +#endif +}ATOM_DVI_CONN_CHANNEL_MAPPING; + +typedef struct _EXT_DISPLAY_PATH +{ + USHORT usDeviceTag; //A bit vector to show what devices are supported + USHORT usDeviceACPIEnum; //16bit device ACPI id. + USHORT usDeviceConnector; //A physical connector for displays to plug in, using object connector definitions + UCHAR ucExtAUXDDCLutIndex; //An index into external AUX/DDC channel LUT + UCHAR ucExtHPDPINLutIndex; //An index into external HPD pin LUT + USHORT usExtEncoderObjId; //external encoder object id + union{ + UCHAR ucChannelMapping; // if ucChannelMapping=0, using default one to one mapping + ATOM_DP_CONN_CHANNEL_MAPPING asDPMapping; + ATOM_DVI_CONN_CHANNEL_MAPPING asDVIMapping; + }; + UCHAR ucReserved; + USHORT usReserved[2]; +}EXT_DISPLAY_PATH; + +#define NUMBER_OF_UCHAR_FOR_GUID 16 +#define MAX_NUMBER_OF_EXT_DISPLAY_PATH 7 + +typedef struct _ATOM_EXTERNAL_DISPLAY_CONNECTION_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucGuid [NUMBER_OF_UCHAR_FOR_GUID]; // a GUID is a 16 byte long string + EXT_DISPLAY_PATH sPath[MAX_NUMBER_OF_EXT_DISPLAY_PATH]; // total of fixed 7 entries. + UCHAR ucChecksum; // a simple Checksum of the sum of whole structure equal to 0x0. + UCHAR uc3DStereoPinId; // use for eDP panel + UCHAR Reserved [6]; // for potential expansion +}ATOM_EXTERNAL_DISPLAY_CONNECTION_INFO; + +//Related definitions, all records are different but they have a commond header +typedef struct _ATOM_COMMON_RECORD_HEADER +{ + UCHAR ucRecordType; //An emun to indicate the record type + UCHAR ucRecordSize; //The size of the whole record in byte +}ATOM_COMMON_RECORD_HEADER; + + +#define ATOM_I2C_RECORD_TYPE 1 +#define ATOM_HPD_INT_RECORD_TYPE 2 +#define ATOM_OUTPUT_PROTECTION_RECORD_TYPE 3 +#define ATOM_CONNECTOR_DEVICE_TAG_RECORD_TYPE 4 +#define ATOM_CONNECTOR_DVI_EXT_INPUT_RECORD_TYPE 5 //Obsolete, switch to use GPIO_CNTL_RECORD_TYPE +#define ATOM_ENCODER_FPGA_CONTROL_RECORD_TYPE 6 //Obsolete, switch to use GPIO_CNTL_RECORD_TYPE +#define ATOM_CONNECTOR_CVTV_SHARE_DIN_RECORD_TYPE 7 +#define ATOM_JTAG_RECORD_TYPE 8 //Obsolete, switch to use GPIO_CNTL_RECORD_TYPE +#define ATOM_OBJECT_GPIO_CNTL_RECORD_TYPE 9 +#define ATOM_ENCODER_DVO_CF_RECORD_TYPE 10 +#define ATOM_CONNECTOR_CF_RECORD_TYPE 11 +#define ATOM_CONNECTOR_HARDCODE_DTD_RECORD_TYPE 12 +#define ATOM_CONNECTOR_PCIE_SUBCONNECTOR_RECORD_TYPE 13 +#define ATOM_ROUTER_DDC_PATH_SELECT_RECORD_TYPE 14 +#define ATOM_ROUTER_DATA_CLOCK_PATH_SELECT_RECORD_TYPE 15 +#define ATOM_CONNECTOR_HPDPIN_LUT_RECORD_TYPE 16 //This is for the case when connectors are not known to object table +#define ATOM_CONNECTOR_AUXDDC_LUT_RECORD_TYPE 17 //This is for the case when connectors are not known to object table +#define ATOM_OBJECT_LINK_RECORD_TYPE 18 //Once this record is present under one object, it indicats the oobject is linked to another obj described by the record +#define ATOM_CONNECTOR_REMOTE_CAP_RECORD_TYPE 19 +#define ATOM_ENCODER_CAP_RECORD_TYPE 20 + + +//Must be updated when new record type is added,equal to that record definition! +#define ATOM_MAX_OBJECT_RECORD_NUMBER ATOM_ENCODER_CAP_RECORD_TYPE + +typedef struct _ATOM_I2C_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + ATOM_I2C_ID_CONFIG sucI2cId; + UCHAR ucI2CAddr; //The slave address, it's 0 when the record is attached to connector for DDC +}ATOM_I2C_RECORD; + +typedef struct _ATOM_HPD_INT_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucHPDIntGPIOID; //Corresponding block in GPIO_PIN_INFO table gives the pin info + UCHAR ucPlugged_PinState; +}ATOM_HPD_INT_RECORD; + + +typedef struct _ATOM_OUTPUT_PROTECTION_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucProtectionFlag; + UCHAR ucReserved; +}ATOM_OUTPUT_PROTECTION_RECORD; + +typedef struct _ATOM_CONNECTOR_DEVICE_TAG +{ + ULONG ulACPIDeviceEnum; //Reserved for now + USHORT usDeviceID; //This Id is same as "ATOM_DEVICE_XXX_SUPPORT" + USHORT usPadding; +}ATOM_CONNECTOR_DEVICE_TAG; + +typedef struct _ATOM_CONNECTOR_DEVICE_TAG_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucNumberOfDevice; + UCHAR ucReserved; + ATOM_CONNECTOR_DEVICE_TAG asDeviceTag[1]; //This Id is same as "ATOM_DEVICE_XXX_SUPPORT", 1 is only for allocation +}ATOM_CONNECTOR_DEVICE_TAG_RECORD; + + +typedef struct _ATOM_CONNECTOR_DVI_EXT_INPUT_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucConfigGPIOID; + UCHAR ucConfigGPIOState; //Set to 1 when it's active high to enable external flow in + UCHAR ucFlowinGPIPID; + UCHAR ucExtInGPIPID; +}ATOM_CONNECTOR_DVI_EXT_INPUT_RECORD; + +typedef struct _ATOM_ENCODER_FPGA_CONTROL_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucCTL1GPIO_ID; + UCHAR ucCTL1GPIOState; //Set to 1 when it's active high + UCHAR ucCTL2GPIO_ID; + UCHAR ucCTL2GPIOState; //Set to 1 when it's active high + UCHAR ucCTL3GPIO_ID; + UCHAR ucCTL3GPIOState; //Set to 1 when it's active high + UCHAR ucCTLFPGA_IN_ID; + UCHAR ucPadding[3]; +}ATOM_ENCODER_FPGA_CONTROL_RECORD; + +typedef struct _ATOM_CONNECTOR_CVTV_SHARE_DIN_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucGPIOID; //Corresponding block in GPIO_PIN_INFO table gives the pin info + UCHAR ucTVActiveState; //Indicating when the pin==0 or 1 when TV is connected +}ATOM_CONNECTOR_CVTV_SHARE_DIN_RECORD; + +typedef struct _ATOM_JTAG_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucTMSGPIO_ID; + UCHAR ucTMSGPIOState; //Set to 1 when it's active high + UCHAR ucTCKGPIO_ID; + UCHAR ucTCKGPIOState; //Set to 1 when it's active high + UCHAR ucTDOGPIO_ID; + UCHAR ucTDOGPIOState; //Set to 1 when it's active high + UCHAR ucTDIGPIO_ID; + UCHAR ucTDIGPIOState; //Set to 1 when it's active high + UCHAR ucPadding[2]; +}ATOM_JTAG_RECORD; + + +//The following generic object gpio pin control record type will replace JTAG_RECORD/FPGA_CONTROL_RECORD/DVI_EXT_INPUT_RECORD above gradually +typedef struct _ATOM_GPIO_PIN_CONTROL_PAIR +{ + UCHAR ucGPIOID; // GPIO_ID, find the corresponding ID in GPIO_LUT table + UCHAR ucGPIO_PinState; // Pin state showing how to set-up the pin +}ATOM_GPIO_PIN_CONTROL_PAIR; + +typedef struct _ATOM_OBJECT_GPIO_CNTL_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucFlags; // Future expnadibility + UCHAR ucNumberOfPins; // Number of GPIO pins used to control the object + ATOM_GPIO_PIN_CONTROL_PAIR asGpio[1]; // the real gpio pin pair determined by number of pins ucNumberOfPins +}ATOM_OBJECT_GPIO_CNTL_RECORD; + +//Definitions for GPIO pin state +#define GPIO_PIN_TYPE_INPUT 0x00 +#define GPIO_PIN_TYPE_OUTPUT 0x10 +#define GPIO_PIN_TYPE_HW_CONTROL 0x20 + +//For GPIO_PIN_TYPE_OUTPUT the following is defined +#define GPIO_PIN_OUTPUT_STATE_MASK 0x01 +#define GPIO_PIN_OUTPUT_STATE_SHIFT 0 +#define GPIO_PIN_STATE_ACTIVE_LOW 0x0 +#define GPIO_PIN_STATE_ACTIVE_HIGH 0x1 + +// Indexes to GPIO array in GLSync record +#define ATOM_GPIO_INDEX_GLSYNC_REFCLK 0 +#define ATOM_GPIO_INDEX_GLSYNC_HSYNC 1 +#define ATOM_GPIO_INDEX_GLSYNC_VSYNC 2 +#define ATOM_GPIO_INDEX_GLSYNC_SWAP_REQ 3 +#define ATOM_GPIO_INDEX_GLSYNC_SWAP_GNT 4 +#define ATOM_GPIO_INDEX_GLSYNC_INTERRUPT 5 +#define ATOM_GPIO_INDEX_GLSYNC_V_RESET 6 +#define ATOM_GPIO_INDEX_GLSYNC_MAX 7 + +typedef struct _ATOM_ENCODER_DVO_CF_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + ULONG ulStrengthControl; // DVOA strength control for CF + UCHAR ucPadding[2]; +}ATOM_ENCODER_DVO_CF_RECORD; + +// Bit maps for ATOM_ENCODER_CAP_RECORD.ucEncoderCap +#define ATOM_ENCODER_CAP_RECORD_HBR2 0x01 // DP1.2 HBR2 is supported by this path + +typedef struct _ATOM_ENCODER_CAP_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + union { + USHORT usEncoderCap; + struct { +#if ATOM_BIG_ENDIAN + USHORT usReserved:15; // Bit1-15 may be defined for other capability in future + USHORT usHBR2Cap:1; // Bit0 is for DP1.2 HBR2 capability. +#else + USHORT usHBR2Cap:1; // Bit0 is for DP1.2 HBR2 capability. + USHORT usReserved:15; // Bit1-15 may be defined for other capability in future +#endif + }; + }; +}ATOM_ENCODER_CAP_RECORD; + +// value for ATOM_CONNECTOR_CF_RECORD.ucConnectedDvoBundle +#define ATOM_CONNECTOR_CF_RECORD_CONNECTED_UPPER12BITBUNDLEA 1 +#define ATOM_CONNECTOR_CF_RECORD_CONNECTED_LOWER12BITBUNDLEB 2 + +typedef struct _ATOM_CONNECTOR_CF_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + USHORT usMaxPixClk; + UCHAR ucFlowCntlGpioId; + UCHAR ucSwapCntlGpioId; + UCHAR ucConnectedDvoBundle; + UCHAR ucPadding; +}ATOM_CONNECTOR_CF_RECORD; + +typedef struct _ATOM_CONNECTOR_HARDCODE_DTD_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + ATOM_DTD_FORMAT asTiming; +}ATOM_CONNECTOR_HARDCODE_DTD_RECORD; + +typedef struct _ATOM_CONNECTOR_PCIE_SUBCONNECTOR_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; //ATOM_CONNECTOR_PCIE_SUBCONNECTOR_RECORD_TYPE + UCHAR ucSubConnectorType; //CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D|X_ID_DUAL_LINK_DVI_D|HDMI_TYPE_A + UCHAR ucReserved; +}ATOM_CONNECTOR_PCIE_SUBCONNECTOR_RECORD; + + +typedef struct _ATOM_ROUTER_DDC_PATH_SELECT_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucMuxType; //decide the number of ucMuxState, =0, no pin state, =1: single state with complement, >1: multiple state + UCHAR ucMuxControlPin; + UCHAR ucMuxState[2]; //for alligment purpose +}ATOM_ROUTER_DDC_PATH_SELECT_RECORD; + +typedef struct _ATOM_ROUTER_DATA_CLOCK_PATH_SELECT_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucMuxType; + UCHAR ucMuxControlPin; + UCHAR ucMuxState[2]; //for alligment purpose +}ATOM_ROUTER_DATA_CLOCK_PATH_SELECT_RECORD; + +// define ucMuxType +#define ATOM_ROUTER_MUX_PIN_STATE_MASK 0x0f +#define ATOM_ROUTER_MUX_PIN_SINGLE_STATE_COMPLEMENT 0x01 + +typedef struct _ATOM_CONNECTOR_HPDPIN_LUT_RECORD //record for ATOM_CONNECTOR_HPDPIN_LUT_RECORD_TYPE +{ + ATOM_COMMON_RECORD_HEADER sheader; + UCHAR ucHPDPINMap[MAX_NUMBER_OF_EXT_HPDPIN_LUT_ENTRIES]; //An fixed size array which maps external pins to internal GPIO_PIN_INFO table +}ATOM_CONNECTOR_HPDPIN_LUT_RECORD; + +typedef struct _ATOM_CONNECTOR_AUXDDC_LUT_RECORD //record for ATOM_CONNECTOR_AUXDDC_LUT_RECORD_TYPE +{ + ATOM_COMMON_RECORD_HEADER sheader; + ATOM_I2C_ID_CONFIG ucAUXDDCMap[MAX_NUMBER_OF_EXT_AUXDDC_LUT_ENTRIES]; //An fixed size array which maps external pins to internal DDC ID +}ATOM_CONNECTOR_AUXDDC_LUT_RECORD; + +typedef struct _ATOM_OBJECT_LINK_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + USHORT usObjectID; //could be connector, encorder or other object in object.h +}ATOM_OBJECT_LINK_RECORD; + +typedef struct _ATOM_CONNECTOR_REMOTE_CAP_RECORD +{ + ATOM_COMMON_RECORD_HEADER sheader; + USHORT usReserved; +}ATOM_CONNECTOR_REMOTE_CAP_RECORD; + +/****************************************************************************/ +// ASIC voltage data table +/****************************************************************************/ +typedef struct _ATOM_VOLTAGE_INFO_HEADER +{ + USHORT usVDDCBaseLevel; //In number of 50mv unit + USHORT usReserved; //For possible extension table offset + UCHAR ucNumOfVoltageEntries; + UCHAR ucBytesPerVoltageEntry; + UCHAR ucVoltageStep; //Indicating in how many mv increament is one step, 0.5mv unit + UCHAR ucDefaultVoltageEntry; + UCHAR ucVoltageControlI2cLine; + UCHAR ucVoltageControlAddress; + UCHAR ucVoltageControlOffset; +}ATOM_VOLTAGE_INFO_HEADER; + +typedef struct _ATOM_VOLTAGE_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_VOLTAGE_INFO_HEADER viHeader; + UCHAR ucVoltageEntries[64]; //64 is for allocation, the actual number of entry is present at ucNumOfVoltageEntries*ucBytesPerVoltageEntry +}ATOM_VOLTAGE_INFO; + + +typedef struct _ATOM_VOLTAGE_FORMULA +{ + USHORT usVoltageBaseLevel; // In number of 1mv unit + USHORT usVoltageStep; // Indicating in how many mv increament is one step, 1mv unit + UCHAR ucNumOfVoltageEntries; // Number of Voltage Entry, which indicate max Voltage + UCHAR ucFlag; // bit0=0 :step is 1mv =1 0.5mv + UCHAR ucBaseVID; // if there is no lookup table, VID= BaseVID + ( Vol - BaseLevle ) /VoltageStep + UCHAR ucReserved; + UCHAR ucVIDAdjustEntries[32]; // 32 is for allocation, the actual number of entry is present at ucNumOfVoltageEntries +}ATOM_VOLTAGE_FORMULA; + +typedef struct _VOLTAGE_LUT_ENTRY +{ + USHORT usVoltageCode; // The Voltage ID, either GPIO or I2C code + USHORT usVoltageValue; // The corresponding Voltage Value, in mV +}VOLTAGE_LUT_ENTRY; + +typedef struct _ATOM_VOLTAGE_FORMULA_V2 +{ + UCHAR ucNumOfVoltageEntries; // Number of Voltage Entry, which indicate max Voltage + UCHAR ucReserved[3]; + VOLTAGE_LUT_ENTRY asVIDAdjustEntries[32];// 32 is for allocation, the actual number of entries is in ucNumOfVoltageEntries +}ATOM_VOLTAGE_FORMULA_V2; + +typedef struct _ATOM_VOLTAGE_CONTROL +{ + UCHAR ucVoltageControlId; //Indicate it is controlled by I2C or GPIO or HW state machine + UCHAR ucVoltageControlI2cLine; + UCHAR ucVoltageControlAddress; + UCHAR ucVoltageControlOffset; + USHORT usGpioPin_AIndex; //GPIO_PAD register index + UCHAR ucGpioPinBitShift[9]; //at most 8 pin support 255 VIDs, termintate with 0xff + UCHAR ucReserved; +}ATOM_VOLTAGE_CONTROL; + +// Define ucVoltageControlId +#define VOLTAGE_CONTROLLED_BY_HW 0x00 +#define VOLTAGE_CONTROLLED_BY_I2C_MASK 0x7F +#define VOLTAGE_CONTROLLED_BY_GPIO 0x80 +#define VOLTAGE_CONTROL_ID_LM64 0x01 //I2C control, used for R5xx Core Voltage +#define VOLTAGE_CONTROL_ID_DAC 0x02 //I2C control, used for R5xx/R6xx MVDDC,MVDDQ or VDDCI +#define VOLTAGE_CONTROL_ID_VT116xM 0x03 //I2C control, used for R6xx Core Voltage +#define VOLTAGE_CONTROL_ID_DS4402 0x04 +#define VOLTAGE_CONTROL_ID_UP6266 0x05 +#define VOLTAGE_CONTROL_ID_SCORPIO 0x06 +#define VOLTAGE_CONTROL_ID_VT1556M 0x07 +#define VOLTAGE_CONTROL_ID_CHL822x 0x08 +#define VOLTAGE_CONTROL_ID_VT1586M 0x09 + +typedef struct _ATOM_VOLTAGE_OBJECT +{ + UCHAR ucVoltageType; //Indicate Voltage Source: VDDC, MVDDC, MVDDQ or MVDDCI + UCHAR ucSize; //Size of Object + ATOM_VOLTAGE_CONTROL asControl; //describ how to control + ATOM_VOLTAGE_FORMULA asFormula; //Indicate How to convert real Voltage to VID +}ATOM_VOLTAGE_OBJECT; + +typedef struct _ATOM_VOLTAGE_OBJECT_V2 +{ + UCHAR ucVoltageType; //Indicate Voltage Source: VDDC, MVDDC, MVDDQ or MVDDCI + UCHAR ucSize; //Size of Object + ATOM_VOLTAGE_CONTROL asControl; //describ how to control + ATOM_VOLTAGE_FORMULA_V2 asFormula; //Indicate How to convert real Voltage to VID +}ATOM_VOLTAGE_OBJECT_V2; + +typedef struct _ATOM_VOLTAGE_OBJECT_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_VOLTAGE_OBJECT asVoltageObj[3]; //Info for Voltage control +}ATOM_VOLTAGE_OBJECT_INFO; + +typedef struct _ATOM_VOLTAGE_OBJECT_INFO_V2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_VOLTAGE_OBJECT_V2 asVoltageObj[3]; //Info for Voltage control +}ATOM_VOLTAGE_OBJECT_INFO_V2; + +typedef struct _ATOM_LEAKID_VOLTAGE +{ + UCHAR ucLeakageId; + UCHAR ucReserved; + USHORT usVoltage; +}ATOM_LEAKID_VOLTAGE; + +typedef struct _ATOM_ASIC_PROFILE_VOLTAGE +{ + UCHAR ucProfileId; + UCHAR ucReserved; + USHORT usSize; + USHORT usEfuseSpareStartAddr; + USHORT usFuseIndex[8]; //from LSB to MSB, Max 8bit,end of 0xffff if less than 8 efuse id, + ATOM_LEAKID_VOLTAGE asLeakVol[2]; //Leakid and relatd voltage +}ATOM_ASIC_PROFILE_VOLTAGE; + +//ucProfileId +#define ATOM_ASIC_PROFILE_ID_EFUSE_VOLTAGE 1 +#define ATOM_ASIC_PROFILE_ID_EFUSE_PERFORMANCE_VOLTAGE 1 +#define ATOM_ASIC_PROFILE_ID_EFUSE_THERMAL_VOLTAGE 2 + +typedef struct _ATOM_ASIC_PROFILING_INFO +{ + ATOM_COMMON_TABLE_HEADER asHeader; + ATOM_ASIC_PROFILE_VOLTAGE asVoltage; +}ATOM_ASIC_PROFILING_INFO; + +typedef struct _ATOM_POWER_SOURCE_OBJECT +{ + UCHAR ucPwrSrcId; // Power source + UCHAR ucPwrSensorType; // GPIO, I2C or none + UCHAR ucPwrSensId; // if GPIO detect, it is GPIO id, if I2C detect, it is I2C id + UCHAR ucPwrSensSlaveAddr; // Slave address if I2C detect + UCHAR ucPwrSensRegIndex; // I2C register Index if I2C detect + UCHAR ucPwrSensRegBitMask; // detect which bit is used if I2C detect + UCHAR ucPwrSensActiveState; // high active or low active + UCHAR ucReserve[3]; // reserve + USHORT usSensPwr; // in unit of watt +}ATOM_POWER_SOURCE_OBJECT; + +typedef struct _ATOM_POWER_SOURCE_INFO +{ + ATOM_COMMON_TABLE_HEADER asHeader; + UCHAR asPwrbehave[16]; + ATOM_POWER_SOURCE_OBJECT asPwrObj[1]; +}ATOM_POWER_SOURCE_INFO; + + +//Define ucPwrSrcId +#define POWERSOURCE_PCIE_ID1 0x00 +#define POWERSOURCE_6PIN_CONNECTOR_ID1 0x01 +#define POWERSOURCE_8PIN_CONNECTOR_ID1 0x02 +#define POWERSOURCE_6PIN_CONNECTOR_ID2 0x04 +#define POWERSOURCE_8PIN_CONNECTOR_ID2 0x08 + +//define ucPwrSensorId +#define POWER_SENSOR_ALWAYS 0x00 +#define POWER_SENSOR_GPIO 0x01 +#define POWER_SENSOR_I2C 0x02 + +typedef struct _ATOM_CLK_VOLT_CAPABILITY +{ + ULONG ulVoltageIndex; // The Voltage Index indicated by FUSE, same voltage index shared with SCLK DPM fuse table + ULONG ulMaximumSupportedCLK; // Maximum clock supported with specified voltage index, unit in 10kHz +}ATOM_CLK_VOLT_CAPABILITY; + +typedef struct _ATOM_AVAILABLE_SCLK_LIST +{ + ULONG ulSupportedSCLK; // Maximum clock supported with specified voltage index, unit in 10kHz + USHORT usVoltageIndex; // The Voltage Index indicated by FUSE for specified SCLK + USHORT usVoltageID; // The Voltage ID indicated by FUSE for specified SCLK +}ATOM_AVAILABLE_SCLK_LIST; + +// ATOM_INTEGRATED_SYSTEM_INFO_V6 ulSystemConfig cap definition +#define ATOM_IGP_INFO_V6_SYSTEM_CONFIG__PCIE_POWER_GATING_ENABLE 1 // refer to ulSystemConfig bit[0] + +// this IntegrateSystemInfoTable is used for Liano/Ontario APU +typedef struct _ATOM_INTEGRATED_SYSTEM_INFO_V6 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ULONG ulBootUpEngineClock; + ULONG ulDentistVCOFreq; + ULONG ulBootUpUMAClock; + ATOM_CLK_VOLT_CAPABILITY sDISPCLK_Voltage[4]; + ULONG ulBootUpReqDisplayVector; + ULONG ulOtherDisplayMisc; + ULONG ulGPUCapInfo; + ULONG ulSB_MMIO_Base_Addr; + USHORT usRequestedPWMFreqInHz; + UCHAR ucHtcTmpLmt; + UCHAR ucHtcHystLmt; + ULONG ulMinEngineClock; + ULONG ulSystemConfig; + ULONG ulCPUCapInfo; + USHORT usNBP0Voltage; + USHORT usNBP1Voltage; + USHORT usBootUpNBVoltage; + USHORT usExtDispConnInfoOffset; + USHORT usPanelRefreshRateRange; + UCHAR ucMemoryType; + UCHAR ucUMAChannelNumber; + ULONG ulCSR_M3_ARB_CNTL_DEFAULT[10]; + ULONG ulCSR_M3_ARB_CNTL_UVD[10]; + ULONG ulCSR_M3_ARB_CNTL_FS3D[10]; + ATOM_AVAILABLE_SCLK_LIST sAvail_SCLK[5]; + ULONG ulGMCRestoreResetTime; + ULONG ulMinimumNClk; + ULONG ulIdleNClk; + ULONG ulDDR_DLL_PowerUpTime; + ULONG ulDDR_PLL_PowerUpTime; + USHORT usPCIEClkSSPercentage; + USHORT usPCIEClkSSType; + USHORT usLvdsSSPercentage; + USHORT usLvdsSSpreadRateIn10Hz; + USHORT usHDMISSPercentage; + USHORT usHDMISSpreadRateIn10Hz; + USHORT usDVISSPercentage; + USHORT usDVISSpreadRateIn10Hz; + ULONG ulReserved3[21]; + ATOM_EXTERNAL_DISPLAY_CONNECTION_INFO sExtDispConnInfo; +}ATOM_INTEGRATED_SYSTEM_INFO_V6; + +// ulGPUCapInfo +#define INTEGRATED_SYSTEM_INFO_V6_GPUCAPINFO__TMDSHDMI_COHERENT_SINGLEPLL_MODE 0x01 +#define INTEGRATED_SYSTEM_INFO_V6_GPUCAPINFO__DISABLE_AUX_HW_MODE_DETECTION 0x08 + +// ulOtherDisplayMisc +#define INTEGRATED_SYSTEM_INFO__GET_EDID_CALLBACK_FUNC_SUPPORT 0x01 + + +/********************************************************************************************************************** + ATOM_INTEGRATED_SYSTEM_INFO_V6 Description +ulBootUpEngineClock: VBIOS bootup Engine clock frequency, in 10kHz unit. if it is equal 0, then VBIOS use pre-defined bootup engine clock +ulDentistVCOFreq: Dentist VCO clock in 10kHz unit. +ulBootUpUMAClock: System memory boot up clock frequency in 10Khz unit. +sDISPCLK_Voltage: Report Display clock voltage requirement. + +ulBootUpReqDisplayVector: VBIOS boot up display IDs, following are supported devices in Liano/Ontaio projects: + ATOM_DEVICE_CRT1_SUPPORT 0x0001 + ATOM_DEVICE_CRT2_SUPPORT 0x0010 + ATOM_DEVICE_DFP1_SUPPORT 0x0008 + ATOM_DEVICE_DFP6_SUPPORT 0x0040 + ATOM_DEVICE_DFP2_SUPPORT 0x0080 + ATOM_DEVICE_DFP3_SUPPORT 0x0200 + ATOM_DEVICE_DFP4_SUPPORT 0x0400 + ATOM_DEVICE_DFP5_SUPPORT 0x0800 + ATOM_DEVICE_LCD1_SUPPORT 0x0002 +ulOtherDisplayMisc: Other display related flags, not defined yet. +ulGPUCapInfo: bit[0]=0: TMDS/HDMI Coherent Mode use cascade PLL mode. + =1: TMDS/HDMI Coherent Mode use signel PLL mode. + bit[3]=0: Enable HW AUX mode detection logic + =1: Disable HW AUX mode dettion logic +ulSB_MMIO_Base_Addr: Physical Base address to SB MMIO space. Driver needs to initialize it for SMU usage. + +usRequestedPWMFreqInHz: When it's set to 0x0 by SBIOS: the LCD BackLight is not controlled by GPU(SW). + Any attempt to change BL using VBIOS function or enable VariBri from PP table is not effective since ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU==0; + + When it's set to a non-zero frequency, the BackLight is controlled by GPU (SW) in one of two ways below: + 1. SW uses the GPU BL PWM output to control the BL, in chis case, this non-zero frequency determines what freq GPU should use; + VBIOS will set up proper PWM frequency and ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU==1,as the result, + Changing BL using VBIOS function is functional in both driver and non-driver present environment; + and enabling VariBri under the driver environment from PP table is optional. + + 2. SW uses other means to control BL (like DPCD),this non-zero frequency serves as a flag only indicating + that BL control from GPU is expected. + VBIOS will NOT set up PWM frequency but make ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU==1 + Changing BL using VBIOS function could be functional in both driver and non-driver present environment,but + it's per platform + and enabling VariBri under the driver environment from PP table is optional. + +ucHtcTmpLmt: Refer to D18F3x64 bit[22:16], HtcTmpLmt. + Threshold on value to enter HTC_active state. +ucHtcHystLmt: Refer to D18F3x64 bit[27:24], HtcHystLmt. + To calculate threshold off value to exit HTC_active state, which is Threshold on vlaue minus ucHtcHystLmt. +ulMinEngineClock: Minimum SCLK allowed in 10kHz unit. This is calculated based on WRCK Fuse settings. +ulSystemConfig: Bit[0]=0: PCIE Power Gating Disabled + =1: PCIE Power Gating Enabled + Bit[1]=0: DDR-DLL shut-down feature disabled. + 1: DDR-DLL shut-down feature enabled. + Bit[2]=0: DDR-PLL Power down feature disabled. + 1: DDR-PLL Power down feature enabled. +ulCPUCapInfo: TBD +usNBP0Voltage: VID for voltage on NB P0 State +usNBP1Voltage: VID for voltage on NB P1 State +usBootUpNBVoltage: Voltage Index of GNB voltage configured by SBIOS, which is suffcient to support VBIOS DISPCLK requirement. +usExtDispConnInfoOffset: Offset to sExtDispConnInfo inside the structure +usPanelRefreshRateRange: Bit vector for LCD supported refresh rate range. If DRR is requestd by the platform, at least two bits need to be set + to indicate a range. + SUPPORTED_LCD_REFRESHRATE_30Hz 0x0004 + SUPPORTED_LCD_REFRESHRATE_40Hz 0x0008 + SUPPORTED_LCD_REFRESHRATE_50Hz 0x0010 + SUPPORTED_LCD_REFRESHRATE_60Hz 0x0020 +ucMemoryType: [3:0]=1:DDR1;=2:DDR2;=3:DDR3.[7:4] is reserved. +ucUMAChannelNumber: System memory channel numbers. +ulCSR_M3_ARB_CNTL_DEFAULT[10]: Arrays with values for CSR M3 arbiter for default +ulCSR_M3_ARB_CNTL_UVD[10]: Arrays with values for CSR M3 arbiter for UVD playback. +ulCSR_M3_ARB_CNTL_FS3D[10]: Arrays with values for CSR M3 arbiter for Full Screen 3D applications. +sAvail_SCLK[5]: Arrays to provide available list of SLCK and corresponding voltage, order from low to high +ulGMCRestoreResetTime: GMC power restore and GMC reset time to calculate data reconnection latency. Unit in ns. +ulMinimumNClk: Minimum NCLK speed among all NB-Pstates to calcualte data reconnection latency. Unit in 10kHz. +ulIdleNClk: NCLK speed while memory runs in self-refresh state. Unit in 10kHz. +ulDDR_DLL_PowerUpTime: DDR PHY DLL power up time. Unit in ns. +ulDDR_PLL_PowerUpTime: DDR PHY PLL power up time. Unit in ns. +usPCIEClkSSPercentage: PCIE Clock Spread Spectrum Percentage in unit 0.01%; 100 mean 1%. +usPCIEClkSSType: PCIE Clock Spread Spectrum Type. 0 for Down spread(default); 1 for Center spread. +usLvdsSSPercentage: LVDS panel ( not include eDP ) Spread Spectrum Percentage in unit of 0.01%, =0, use VBIOS default setting. +usLvdsSSpreadRateIn10Hz: LVDS panel ( not include eDP ) Spread Spectrum frequency in unit of 10Hz, =0, use VBIOS default setting. +usHDMISSPercentage: HDMI Spread Spectrum Percentage in unit 0.01%; 100 mean 1%, =0, use VBIOS default setting. +usHDMISSpreadRateIn10Hz: HDMI Spread Spectrum frequency in unit of 10Hz, =0, use VBIOS default setting. +usDVISSPercentage: DVI Spread Spectrum Percentage in unit 0.01%; 100 mean 1%, =0, use VBIOS default setting. +usDVISSpreadRateIn10Hz: DVI Spread Spectrum frequency in unit of 10Hz, =0, use VBIOS default setting. +**********************************************************************************************************************/ + +/**************************************************************************/ +// This portion is only used when ext thermal chip or engine/memory clock SS chip is populated on a design +//Memory SS Info Table +//Define Memory Clock SS chip ID +#define ICS91719 1 +#define ICS91720 2 + +//Define one structure to inform SW a "block of data" writing to external SS chip via I2C protocol +typedef struct _ATOM_I2C_DATA_RECORD +{ + UCHAR ucNunberOfBytes; //Indicates how many bytes SW needs to write to the external ASIC for one block, besides to "Start" and "Stop" + UCHAR ucI2CData[1]; //I2C data in bytes, should be less than 16 bytes usually +}ATOM_I2C_DATA_RECORD; + + +//Define one structure to inform SW how many blocks of data writing to external SS chip via I2C protocol, in addition to other information +typedef struct _ATOM_I2C_DEVICE_SETUP_INFO +{ + ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; //I2C line and HW/SW assisted cap. + UCHAR ucSSChipID; //SS chip being used + UCHAR ucSSChipSlaveAddr; //Slave Address to set up this SS chip + UCHAR ucNumOfI2CDataRecords; //number of data block + ATOM_I2C_DATA_RECORD asI2CData[1]; +}ATOM_I2C_DEVICE_SETUP_INFO; + +//========================================================================================== +typedef struct _ATOM_ASIC_MVDD_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_I2C_DEVICE_SETUP_INFO asI2CSetup[1]; +}ATOM_ASIC_MVDD_INFO; + +//========================================================================================== +#define ATOM_MCLK_SS_INFO ATOM_ASIC_MVDD_INFO + +//========================================================================================== +/**************************************************************************/ + +typedef struct _ATOM_ASIC_SS_ASSIGNMENT +{ + ULONG ulTargetClockRange; //Clock Out frequence (VCO ), in unit of 10Khz + USHORT usSpreadSpectrumPercentage; //in unit of 0.01% + USHORT usSpreadRateInKhz; //in unit of kHz, modulation freq + UCHAR ucClockIndication; //Indicate which clock source needs SS + UCHAR ucSpreadSpectrumMode; //Bit1=0 Down Spread,=1 Center Spread. + UCHAR ucReserved[2]; +}ATOM_ASIC_SS_ASSIGNMENT; + +//Define ucClockIndication, SW uses the IDs below to search if the SS is required/enabled on a clock branch/signal type. +//SS is not required or enabled if a match is not found. +#define ASIC_INTERNAL_MEMORY_SS 1 +#define ASIC_INTERNAL_ENGINE_SS 2 +#define ASIC_INTERNAL_UVD_SS 3 +#define ASIC_INTERNAL_SS_ON_TMDS 4 +#define ASIC_INTERNAL_SS_ON_HDMI 5 +#define ASIC_INTERNAL_SS_ON_LVDS 6 +#define ASIC_INTERNAL_SS_ON_DP 7 +#define ASIC_INTERNAL_SS_ON_DCPLL 8 +#define ASIC_EXTERNAL_SS_ON_DP_CLOCK 9 + +typedef struct _ATOM_ASIC_SS_ASSIGNMENT_V2 +{ + ULONG ulTargetClockRange; //For mem/engine/uvd, Clock Out frequence (VCO ), in unit of 10Khz + //For TMDS/HDMI/LVDS, it is pixel clock , for DP, it is link clock ( 27000 or 16200 ) + USHORT usSpreadSpectrumPercentage; //in unit of 0.01% + USHORT usSpreadRateIn10Hz; //in unit of 10Hz, modulation freq + UCHAR ucClockIndication; //Indicate which clock source needs SS + UCHAR ucSpreadSpectrumMode; //Bit0=0 Down Spread,=1 Center Spread, bit1=0: internal SS bit1=1: external SS + UCHAR ucReserved[2]; +}ATOM_ASIC_SS_ASSIGNMENT_V2; + +//ucSpreadSpectrumMode +//#define ATOM_SS_DOWN_SPREAD_MODE_MASK 0x00000000 +//#define ATOM_SS_DOWN_SPREAD_MODE 0x00000000 +//#define ATOM_SS_CENTRE_SPREAD_MODE_MASK 0x00000001 +//#define ATOM_SS_CENTRE_SPREAD_MODE 0x00000001 +//#define ATOM_INTERNAL_SS_MASK 0x00000000 +//#define ATOM_EXTERNAL_SS_MASK 0x00000002 + +typedef struct _ATOM_ASIC_INTERNAL_SS_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_ASIC_SS_ASSIGNMENT asSpreadSpectrum[4]; +}ATOM_ASIC_INTERNAL_SS_INFO; + +typedef struct _ATOM_ASIC_INTERNAL_SS_INFO_V2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_ASIC_SS_ASSIGNMENT_V2 asSpreadSpectrum[1]; //this is point only. +}ATOM_ASIC_INTERNAL_SS_INFO_V2; + +typedef struct _ATOM_ASIC_SS_ASSIGNMENT_V3 +{ + ULONG ulTargetClockRange; //For mem/engine/uvd, Clock Out frequence (VCO ), in unit of 10Khz + //For TMDS/HDMI/LVDS, it is pixel clock , for DP, it is link clock ( 27000 or 16200 ) + USHORT usSpreadSpectrumPercentage; //in unit of 0.01% + USHORT usSpreadRateIn10Hz; //in unit of 10Hz, modulation freq + UCHAR ucClockIndication; //Indicate which clock source needs SS + UCHAR ucSpreadSpectrumMode; //Bit0=0 Down Spread,=1 Center Spread, bit1=0: internal SS bit1=1: external SS + UCHAR ucReserved[2]; +}ATOM_ASIC_SS_ASSIGNMENT_V3; + +typedef struct _ATOM_ASIC_INTERNAL_SS_INFO_V3 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_ASIC_SS_ASSIGNMENT_V3 asSpreadSpectrum[1]; //this is pointer only. +}ATOM_ASIC_INTERNAL_SS_INFO_V3; + + +//==============================Scratch Pad Definition Portion=============================== +#define ATOM_DEVICE_CONNECT_INFO_DEF 0 +#define ATOM_ROM_LOCATION_DEF 1 +#define ATOM_TV_STANDARD_DEF 2 +#define ATOM_ACTIVE_INFO_DEF 3 +#define ATOM_LCD_INFO_DEF 4 +#define ATOM_DOS_REQ_INFO_DEF 5 +#define ATOM_ACC_CHANGE_INFO_DEF 6 +#define ATOM_DOS_MODE_INFO_DEF 7 +#define ATOM_I2C_CHANNEL_STATUS_DEF 8 +#define ATOM_I2C_CHANNEL_STATUS1_DEF 9 + + +// BIOS_0_SCRATCH Definition +#define ATOM_S0_CRT1_MONO 0x00000001L +#define ATOM_S0_CRT1_COLOR 0x00000002L +#define ATOM_S0_CRT1_MASK (ATOM_S0_CRT1_MONO+ATOM_S0_CRT1_COLOR) + +#define ATOM_S0_TV1_COMPOSITE_A 0x00000004L +#define ATOM_S0_TV1_SVIDEO_A 0x00000008L +#define ATOM_S0_TV1_MASK_A (ATOM_S0_TV1_COMPOSITE_A+ATOM_S0_TV1_SVIDEO_A) + +#define ATOM_S0_CV_A 0x00000010L +#define ATOM_S0_CV_DIN_A 0x00000020L +#define ATOM_S0_CV_MASK_A (ATOM_S0_CV_A+ATOM_S0_CV_DIN_A) + + +#define ATOM_S0_CRT2_MONO 0x00000100L +#define ATOM_S0_CRT2_COLOR 0x00000200L +#define ATOM_S0_CRT2_MASK (ATOM_S0_CRT2_MONO+ATOM_S0_CRT2_COLOR) + +#define ATOM_S0_TV1_COMPOSITE 0x00000400L +#define ATOM_S0_TV1_SVIDEO 0x00000800L +#define ATOM_S0_TV1_SCART 0x00004000L +#define ATOM_S0_TV1_MASK (ATOM_S0_TV1_COMPOSITE+ATOM_S0_TV1_SVIDEO+ATOM_S0_TV1_SCART) + +#define ATOM_S0_CV 0x00001000L +#define ATOM_S0_CV_DIN 0x00002000L +#define ATOM_S0_CV_MASK (ATOM_S0_CV+ATOM_S0_CV_DIN) + +#define ATOM_S0_DFP1 0x00010000L +#define ATOM_S0_DFP2 0x00020000L +#define ATOM_S0_LCD1 0x00040000L +#define ATOM_S0_LCD2 0x00080000L +#define ATOM_S0_DFP6 0x00100000L +#define ATOM_S0_DFP3 0x00200000L +#define ATOM_S0_DFP4 0x00400000L +#define ATOM_S0_DFP5 0x00800000L + +#define ATOM_S0_DFP_MASK ATOM_S0_DFP1 | ATOM_S0_DFP2 | ATOM_S0_DFP3 | ATOM_S0_DFP4 | ATOM_S0_DFP5 | ATOM_S0_DFP6 + +#define ATOM_S0_FAD_REGISTER_BUG 0x02000000L // If set, indicates we are running a PCIE asic with + // the FAD/HDP reg access bug. Bit is read by DAL, this is obsolete from RV5xx + +#define ATOM_S0_THERMAL_STATE_MASK 0x1C000000L +#define ATOM_S0_THERMAL_STATE_SHIFT 26 + +#define ATOM_S0_SYSTEM_POWER_STATE_MASK 0xE0000000L +#define ATOM_S0_SYSTEM_POWER_STATE_SHIFT 29 + +#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_AC 1 +#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_DC 2 +#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LITEAC 3 +#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LIT2AC 4 + +//Byte aligned definition for BIOS usage +#define ATOM_S0_CRT1_MONOb0 0x01 +#define ATOM_S0_CRT1_COLORb0 0x02 +#define ATOM_S0_CRT1_MASKb0 (ATOM_S0_CRT1_MONOb0+ATOM_S0_CRT1_COLORb0) + +#define ATOM_S0_TV1_COMPOSITEb0 0x04 +#define ATOM_S0_TV1_SVIDEOb0 0x08 +#define ATOM_S0_TV1_MASKb0 (ATOM_S0_TV1_COMPOSITEb0+ATOM_S0_TV1_SVIDEOb0) + +#define ATOM_S0_CVb0 0x10 +#define ATOM_S0_CV_DINb0 0x20 +#define ATOM_S0_CV_MASKb0 (ATOM_S0_CVb0+ATOM_S0_CV_DINb0) + +#define ATOM_S0_CRT2_MONOb1 0x01 +#define ATOM_S0_CRT2_COLORb1 0x02 +#define ATOM_S0_CRT2_MASKb1 (ATOM_S0_CRT2_MONOb1+ATOM_S0_CRT2_COLORb1) + +#define ATOM_S0_TV1_COMPOSITEb1 0x04 +#define ATOM_S0_TV1_SVIDEOb1 0x08 +#define ATOM_S0_TV1_SCARTb1 0x40 +#define ATOM_S0_TV1_MASKb1 (ATOM_S0_TV1_COMPOSITEb1+ATOM_S0_TV1_SVIDEOb1+ATOM_S0_TV1_SCARTb1) + +#define ATOM_S0_CVb1 0x10 +#define ATOM_S0_CV_DINb1 0x20 +#define ATOM_S0_CV_MASKb1 (ATOM_S0_CVb1+ATOM_S0_CV_DINb1) + +#define ATOM_S0_DFP1b2 0x01 +#define ATOM_S0_DFP2b2 0x02 +#define ATOM_S0_LCD1b2 0x04 +#define ATOM_S0_LCD2b2 0x08 +#define ATOM_S0_DFP6b2 0x10 +#define ATOM_S0_DFP3b2 0x20 +#define ATOM_S0_DFP4b2 0x40 +#define ATOM_S0_DFP5b2 0x80 + + +#define ATOM_S0_THERMAL_STATE_MASKb3 0x1C +#define ATOM_S0_THERMAL_STATE_SHIFTb3 2 + +#define ATOM_S0_SYSTEM_POWER_STATE_MASKb3 0xE0 +#define ATOM_S0_LCD1_SHIFT 18 + +// BIOS_1_SCRATCH Definition +#define ATOM_S1_ROM_LOCATION_MASK 0x0000FFFFL +#define ATOM_S1_PCI_BUS_DEV_MASK 0xFFFF0000L + +// BIOS_2_SCRATCH Definition +#define ATOM_S2_TV1_STANDARD_MASK 0x0000000FL +#define ATOM_S2_CURRENT_BL_LEVEL_MASK 0x0000FF00L +#define ATOM_S2_CURRENT_BL_LEVEL_SHIFT 8 + +#define ATOM_S2_FORCEDLOWPWRMODE_STATE_MASK 0x0C000000L +#define ATOM_S2_FORCEDLOWPWRMODE_STATE_MASK_SHIFT 26 +#define ATOM_S2_FORCEDLOWPWRMODE_STATE_CHANGE 0x10000000L + +#define ATOM_S2_DEVICE_DPMS_STATE 0x00010000L +#define ATOM_S2_VRI_BRIGHT_ENABLE 0x20000000L + +#define ATOM_S2_DISPLAY_ROTATION_0_DEGREE 0x0 +#define ATOM_S2_DISPLAY_ROTATION_90_DEGREE 0x1 +#define ATOM_S2_DISPLAY_ROTATION_180_DEGREE 0x2 +#define ATOM_S2_DISPLAY_ROTATION_270_DEGREE 0x3 +#define ATOM_S2_DISPLAY_ROTATION_DEGREE_SHIFT 30 +#define ATOM_S2_DISPLAY_ROTATION_ANGLE_MASK 0xC0000000L + + +//Byte aligned definition for BIOS usage +#define ATOM_S2_TV1_STANDARD_MASKb0 0x0F +#define ATOM_S2_CURRENT_BL_LEVEL_MASKb1 0xFF +#define ATOM_S2_DEVICE_DPMS_STATEb2 0x01 + +#define ATOM_S2_DEVICE_DPMS_MASKw1 0x3FF +#define ATOM_S2_FORCEDLOWPWRMODE_STATE_MASKb3 0x0C +#define ATOM_S2_FORCEDLOWPWRMODE_STATE_CHANGEb3 0x10 +#define ATOM_S2_VRI_BRIGHT_ENABLEb3 0x20 +#define ATOM_S2_ROTATION_STATE_MASKb3 0xC0 + + +// BIOS_3_SCRATCH Definition +#define ATOM_S3_CRT1_ACTIVE 0x00000001L +#define ATOM_S3_LCD1_ACTIVE 0x00000002L +#define ATOM_S3_TV1_ACTIVE 0x00000004L +#define ATOM_S3_DFP1_ACTIVE 0x00000008L +#define ATOM_S3_CRT2_ACTIVE 0x00000010L +#define ATOM_S3_LCD2_ACTIVE 0x00000020L +#define ATOM_S3_DFP6_ACTIVE 0x00000040L +#define ATOM_S3_DFP2_ACTIVE 0x00000080L +#define ATOM_S3_CV_ACTIVE 0x00000100L +#define ATOM_S3_DFP3_ACTIVE 0x00000200L +#define ATOM_S3_DFP4_ACTIVE 0x00000400L +#define ATOM_S3_DFP5_ACTIVE 0x00000800L + +#define ATOM_S3_DEVICE_ACTIVE_MASK 0x00000FFFL + +#define ATOM_S3_LCD_FULLEXPANSION_ACTIVE 0x00001000L +#define ATOM_S3_LCD_EXPANSION_ASPEC_RATIO_ACTIVE 0x00002000L + +#define ATOM_S3_CRT1_CRTC_ACTIVE 0x00010000L +#define ATOM_S3_LCD1_CRTC_ACTIVE 0x00020000L +#define ATOM_S3_TV1_CRTC_ACTIVE 0x00040000L +#define ATOM_S3_DFP1_CRTC_ACTIVE 0x00080000L +#define ATOM_S3_CRT2_CRTC_ACTIVE 0x00100000L +#define ATOM_S3_LCD2_CRTC_ACTIVE 0x00200000L +#define ATOM_S3_DFP6_CRTC_ACTIVE 0x00400000L +#define ATOM_S3_DFP2_CRTC_ACTIVE 0x00800000L +#define ATOM_S3_CV_CRTC_ACTIVE 0x01000000L +#define ATOM_S3_DFP3_CRTC_ACTIVE 0x02000000L +#define ATOM_S3_DFP4_CRTC_ACTIVE 0x04000000L +#define ATOM_S3_DFP5_CRTC_ACTIVE 0x08000000L + +#define ATOM_S3_DEVICE_CRTC_ACTIVE_MASK 0x0FFF0000L +#define ATOM_S3_ASIC_GUI_ENGINE_HUNG 0x20000000L +//Below two definitions are not supported in pplib, but in the old powerplay in DAL +#define ATOM_S3_ALLOW_FAST_PWR_SWITCH 0x40000000L +#define ATOM_S3_RQST_GPU_USE_MIN_PWR 0x80000000L + +//Byte aligned definition for BIOS usage +#define ATOM_S3_CRT1_ACTIVEb0 0x01 +#define ATOM_S3_LCD1_ACTIVEb0 0x02 +#define ATOM_S3_TV1_ACTIVEb0 0x04 +#define ATOM_S3_DFP1_ACTIVEb0 0x08 +#define ATOM_S3_CRT2_ACTIVEb0 0x10 +#define ATOM_S3_LCD2_ACTIVEb0 0x20 +#define ATOM_S3_DFP6_ACTIVEb0 0x40 +#define ATOM_S3_DFP2_ACTIVEb0 0x80 +#define ATOM_S3_CV_ACTIVEb1 0x01 +#define ATOM_S3_DFP3_ACTIVEb1 0x02 +#define ATOM_S3_DFP4_ACTIVEb1 0x04 +#define ATOM_S3_DFP5_ACTIVEb1 0x08 + +#define ATOM_S3_ACTIVE_CRTC1w0 0xFFF + +#define ATOM_S3_CRT1_CRTC_ACTIVEb2 0x01 +#define ATOM_S3_LCD1_CRTC_ACTIVEb2 0x02 +#define ATOM_S3_TV1_CRTC_ACTIVEb2 0x04 +#define ATOM_S3_DFP1_CRTC_ACTIVEb2 0x08 +#define ATOM_S3_CRT2_CRTC_ACTIVEb2 0x10 +#define ATOM_S3_LCD2_CRTC_ACTIVEb2 0x20 +#define ATOM_S3_DFP6_CRTC_ACTIVEb2 0x40 +#define ATOM_S3_DFP2_CRTC_ACTIVEb2 0x80 +#define ATOM_S3_CV_CRTC_ACTIVEb3 0x01 +#define ATOM_S3_DFP3_CRTC_ACTIVEb3 0x02 +#define ATOM_S3_DFP4_CRTC_ACTIVEb3 0x04 +#define ATOM_S3_DFP5_CRTC_ACTIVEb3 0x08 + +#define ATOM_S3_ACTIVE_CRTC2w1 0xFFF + +// BIOS_4_SCRATCH Definition +#define ATOM_S4_LCD1_PANEL_ID_MASK 0x000000FFL +#define ATOM_S4_LCD1_REFRESH_MASK 0x0000FF00L +#define ATOM_S4_LCD1_REFRESH_SHIFT 8 + +//Byte aligned definition for BIOS usage +#define ATOM_S4_LCD1_PANEL_ID_MASKb0 0x0FF +#define ATOM_S4_LCD1_REFRESH_MASKb1 ATOM_S4_LCD1_PANEL_ID_MASKb0 +#define ATOM_S4_VRAM_INFO_MASKb2 ATOM_S4_LCD1_PANEL_ID_MASKb0 + +// BIOS_5_SCRATCH Definition, BIOS_5_SCRATCH is used by Firmware only !!!! +#define ATOM_S5_DOS_REQ_CRT1b0 0x01 +#define ATOM_S5_DOS_REQ_LCD1b0 0x02 +#define ATOM_S5_DOS_REQ_TV1b0 0x04 +#define ATOM_S5_DOS_REQ_DFP1b0 0x08 +#define ATOM_S5_DOS_REQ_CRT2b0 0x10 +#define ATOM_S5_DOS_REQ_LCD2b0 0x20 +#define ATOM_S5_DOS_REQ_DFP6b0 0x40 +#define ATOM_S5_DOS_REQ_DFP2b0 0x80 +#define ATOM_S5_DOS_REQ_CVb1 0x01 +#define ATOM_S5_DOS_REQ_DFP3b1 0x02 +#define ATOM_S5_DOS_REQ_DFP4b1 0x04 +#define ATOM_S5_DOS_REQ_DFP5b1 0x08 + +#define ATOM_S5_DOS_REQ_DEVICEw0 0x0FFF + +#define ATOM_S5_DOS_REQ_CRT1 0x0001 +#define ATOM_S5_DOS_REQ_LCD1 0x0002 +#define ATOM_S5_DOS_REQ_TV1 0x0004 +#define ATOM_S5_DOS_REQ_DFP1 0x0008 +#define ATOM_S5_DOS_REQ_CRT2 0x0010 +#define ATOM_S5_DOS_REQ_LCD2 0x0020 +#define ATOM_S5_DOS_REQ_DFP6 0x0040 +#define ATOM_S5_DOS_REQ_DFP2 0x0080 +#define ATOM_S5_DOS_REQ_CV 0x0100 +#define ATOM_S5_DOS_REQ_DFP3 0x0200 +#define ATOM_S5_DOS_REQ_DFP4 0x0400 +#define ATOM_S5_DOS_REQ_DFP5 0x0800 + +#define ATOM_S5_DOS_FORCE_CRT1b2 ATOM_S5_DOS_REQ_CRT1b0 +#define ATOM_S5_DOS_FORCE_TV1b2 ATOM_S5_DOS_REQ_TV1b0 +#define ATOM_S5_DOS_FORCE_CRT2b2 ATOM_S5_DOS_REQ_CRT2b0 +#define ATOM_S5_DOS_FORCE_CVb3 ATOM_S5_DOS_REQ_CVb1 +#define ATOM_S5_DOS_FORCE_DEVICEw1 (ATOM_S5_DOS_FORCE_CRT1b2+ATOM_S5_DOS_FORCE_TV1b2+ATOM_S5_DOS_FORCE_CRT2b2+\ + (ATOM_S5_DOS_FORCE_CVb3<<8)) + +// BIOS_6_SCRATCH Definition +#define ATOM_S6_DEVICE_CHANGE 0x00000001L +#define ATOM_S6_SCALER_CHANGE 0x00000002L +#define ATOM_S6_LID_CHANGE 0x00000004L +#define ATOM_S6_DOCKING_CHANGE 0x00000008L +#define ATOM_S6_ACC_MODE 0x00000010L +#define ATOM_S6_EXT_DESKTOP_MODE 0x00000020L +#define ATOM_S6_LID_STATE 0x00000040L +#define ATOM_S6_DOCK_STATE 0x00000080L +#define ATOM_S6_CRITICAL_STATE 0x00000100L +#define ATOM_S6_HW_I2C_BUSY_STATE 0x00000200L +#define ATOM_S6_THERMAL_STATE_CHANGE 0x00000400L +#define ATOM_S6_INTERRUPT_SET_BY_BIOS 0x00000800L +#define ATOM_S6_REQ_LCD_EXPANSION_FULL 0x00001000L //Normal expansion Request bit for LCD +#define ATOM_S6_REQ_LCD_EXPANSION_ASPEC_RATIO 0x00002000L //Aspect ratio expansion Request bit for LCD + +#define ATOM_S6_DISPLAY_STATE_CHANGE 0x00004000L //This bit is recycled when ATOM_BIOS_INFO_BIOS_SCRATCH6_SCL2_REDEFINE is set,previously it's SCL2_H_expansion +#define ATOM_S6_I2C_STATE_CHANGE 0x00008000L //This bit is recycled,when ATOM_BIOS_INFO_BIOS_SCRATCH6_SCL2_REDEFINE is set,previously it's SCL2_V_expansion + +#define ATOM_S6_ACC_REQ_CRT1 0x00010000L +#define ATOM_S6_ACC_REQ_LCD1 0x00020000L +#define ATOM_S6_ACC_REQ_TV1 0x00040000L +#define ATOM_S6_ACC_REQ_DFP1 0x00080000L +#define ATOM_S6_ACC_REQ_CRT2 0x00100000L +#define ATOM_S6_ACC_REQ_LCD2 0x00200000L +#define ATOM_S6_ACC_REQ_DFP6 0x00400000L +#define ATOM_S6_ACC_REQ_DFP2 0x00800000L +#define ATOM_S6_ACC_REQ_CV 0x01000000L +#define ATOM_S6_ACC_REQ_DFP3 0x02000000L +#define ATOM_S6_ACC_REQ_DFP4 0x04000000L +#define ATOM_S6_ACC_REQ_DFP5 0x08000000L + +#define ATOM_S6_ACC_REQ_MASK 0x0FFF0000L +#define ATOM_S6_SYSTEM_POWER_MODE_CHANGE 0x10000000L +#define ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH 0x20000000L +#define ATOM_S6_VRI_BRIGHTNESS_CHANGE 0x40000000L +#define ATOM_S6_CONFIG_DISPLAY_CHANGE_MASK 0x80000000L + +//Byte aligned definition for BIOS usage +#define ATOM_S6_DEVICE_CHANGEb0 0x01 +#define ATOM_S6_SCALER_CHANGEb0 0x02 +#define ATOM_S6_LID_CHANGEb0 0x04 +#define ATOM_S6_DOCKING_CHANGEb0 0x08 +#define ATOM_S6_ACC_MODEb0 0x10 +#define ATOM_S6_EXT_DESKTOP_MODEb0 0x20 +#define ATOM_S6_LID_STATEb0 0x40 +#define ATOM_S6_DOCK_STATEb0 0x80 +#define ATOM_S6_CRITICAL_STATEb1 0x01 +#define ATOM_S6_HW_I2C_BUSY_STATEb1 0x02 +#define ATOM_S6_THERMAL_STATE_CHANGEb1 0x04 +#define ATOM_S6_INTERRUPT_SET_BY_BIOSb1 0x08 +#define ATOM_S6_REQ_LCD_EXPANSION_FULLb1 0x10 +#define ATOM_S6_REQ_LCD_EXPANSION_ASPEC_RATIOb1 0x20 + +#define ATOM_S6_ACC_REQ_CRT1b2 0x01 +#define ATOM_S6_ACC_REQ_LCD1b2 0x02 +#define ATOM_S6_ACC_REQ_TV1b2 0x04 +#define ATOM_S6_ACC_REQ_DFP1b2 0x08 +#define ATOM_S6_ACC_REQ_CRT2b2 0x10 +#define ATOM_S6_ACC_REQ_LCD2b2 0x20 +#define ATOM_S6_ACC_REQ_DFP6b2 0x40 +#define ATOM_S6_ACC_REQ_DFP2b2 0x80 +#define ATOM_S6_ACC_REQ_CVb3 0x01 +#define ATOM_S6_ACC_REQ_DFP3b3 0x02 +#define ATOM_S6_ACC_REQ_DFP4b3 0x04 +#define ATOM_S6_ACC_REQ_DFP5b3 0x08 + +#define ATOM_S6_ACC_REQ_DEVICEw1 ATOM_S5_DOS_REQ_DEVICEw0 +#define ATOM_S6_SYSTEM_POWER_MODE_CHANGEb3 0x10 +#define ATOM_S6_ACC_BLOCK_DISPLAY_SWITCHb3 0x20 +#define ATOM_S6_VRI_BRIGHTNESS_CHANGEb3 0x40 +#define ATOM_S6_CONFIG_DISPLAY_CHANGEb3 0x80 + +#define ATOM_S6_DEVICE_CHANGE_SHIFT 0 +#define ATOM_S6_SCALER_CHANGE_SHIFT 1 +#define ATOM_S6_LID_CHANGE_SHIFT 2 +#define ATOM_S6_DOCKING_CHANGE_SHIFT 3 +#define ATOM_S6_ACC_MODE_SHIFT 4 +#define ATOM_S6_EXT_DESKTOP_MODE_SHIFT 5 +#define ATOM_S6_LID_STATE_SHIFT 6 +#define ATOM_S6_DOCK_STATE_SHIFT 7 +#define ATOM_S6_CRITICAL_STATE_SHIFT 8 +#define ATOM_S6_HW_I2C_BUSY_STATE_SHIFT 9 +#define ATOM_S6_THERMAL_STATE_CHANGE_SHIFT 10 +#define ATOM_S6_INTERRUPT_SET_BY_BIOS_SHIFT 11 +#define ATOM_S6_REQ_SCALER_SHIFT 12 +#define ATOM_S6_REQ_SCALER_ARATIO_SHIFT 13 +#define ATOM_S6_DISPLAY_STATE_CHANGE_SHIFT 14 +#define ATOM_S6_I2C_STATE_CHANGE_SHIFT 15 +#define ATOM_S6_SYSTEM_POWER_MODE_CHANGE_SHIFT 28 +#define ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH_SHIFT 29 +#define ATOM_S6_VRI_BRIGHTNESS_CHANGE_SHIFT 30 +#define ATOM_S6_CONFIG_DISPLAY_CHANGE_SHIFT 31 + +// BIOS_7_SCRATCH Definition, BIOS_7_SCRATCH is used by Firmware only !!!! +#define ATOM_S7_DOS_MODE_TYPEb0 0x03 +#define ATOM_S7_DOS_MODE_VGAb0 0x00 +#define ATOM_S7_DOS_MODE_VESAb0 0x01 +#define ATOM_S7_DOS_MODE_EXTb0 0x02 +#define ATOM_S7_DOS_MODE_PIXEL_DEPTHb0 0x0C +#define ATOM_S7_DOS_MODE_PIXEL_FORMATb0 0xF0 +#define ATOM_S7_DOS_8BIT_DAC_ENb1 0x01 +#define ATOM_S7_DOS_MODE_NUMBERw1 0x0FFFF + +#define ATOM_S7_DOS_8BIT_DAC_EN_SHIFT 8 + +// BIOS_8_SCRATCH Definition +#define ATOM_S8_I2C_CHANNEL_BUSY_MASK 0x00000FFFF +#define ATOM_S8_I2C_HW_ENGINE_BUSY_MASK 0x0FFFF0000 + +#define ATOM_S8_I2C_CHANNEL_BUSY_SHIFT 0 +#define ATOM_S8_I2C_ENGINE_BUSY_SHIFT 16 + +// BIOS_9_SCRATCH Definition +#ifndef ATOM_S9_I2C_CHANNEL_COMPLETED_MASK +#define ATOM_S9_I2C_CHANNEL_COMPLETED_MASK 0x0000FFFF +#endif +#ifndef ATOM_S9_I2C_CHANNEL_ABORTED_MASK +#define ATOM_S9_I2C_CHANNEL_ABORTED_MASK 0xFFFF0000 +#endif +#ifndef ATOM_S9_I2C_CHANNEL_COMPLETED_SHIFT +#define ATOM_S9_I2C_CHANNEL_COMPLETED_SHIFT 0 +#endif +#ifndef ATOM_S9_I2C_CHANNEL_ABORTED_SHIFT +#define ATOM_S9_I2C_CHANNEL_ABORTED_SHIFT 16 +#endif + + +#define ATOM_FLAG_SET 0x20 +#define ATOM_FLAG_CLEAR 0 +#define CLEAR_ATOM_S6_ACC_MODE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_ACC_MODE_SHIFT | ATOM_FLAG_CLEAR) +#define SET_ATOM_S6_DEVICE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DEVICE_CHANGE_SHIFT | ATOM_FLAG_SET) +#define SET_ATOM_S6_VRI_BRIGHTNESS_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_VRI_BRIGHTNESS_CHANGE_SHIFT | ATOM_FLAG_SET) +#define SET_ATOM_S6_SCALER_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_SCALER_CHANGE_SHIFT | ATOM_FLAG_SET) +#define SET_ATOM_S6_LID_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_LID_CHANGE_SHIFT | ATOM_FLAG_SET) + +#define SET_ATOM_S6_LID_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_LID_STATE_SHIFT | ATOM_FLAG_SET) +#define CLEAR_ATOM_S6_LID_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_LID_STATE_SHIFT | ATOM_FLAG_CLEAR) + +#define SET_ATOM_S6_DOCK_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DOCKING_CHANGE_SHIFT | ATOM_FLAG_SET) +#define SET_ATOM_S6_DOCK_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DOCK_STATE_SHIFT | ATOM_FLAG_SET) +#define CLEAR_ATOM_S6_DOCK_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DOCK_STATE_SHIFT | ATOM_FLAG_CLEAR) + +#define SET_ATOM_S6_THERMAL_STATE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_THERMAL_STATE_CHANGE_SHIFT | ATOM_FLAG_SET) +#define SET_ATOM_S6_SYSTEM_POWER_MODE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_SYSTEM_POWER_MODE_CHANGE_SHIFT | ATOM_FLAG_SET) +#define SET_ATOM_S6_INTERRUPT_SET_BY_BIOS ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_INTERRUPT_SET_BY_BIOS_SHIFT | ATOM_FLAG_SET) + +#define SET_ATOM_S6_CRITICAL_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_CRITICAL_STATE_SHIFT | ATOM_FLAG_SET) +#define CLEAR_ATOM_S6_CRITICAL_STATE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_CRITICAL_STATE_SHIFT | ATOM_FLAG_CLEAR) + +#define SET_ATOM_S6_REQ_SCALER ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_REQ_SCALER_SHIFT | ATOM_FLAG_SET) +#define CLEAR_ATOM_S6_REQ_SCALER ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_REQ_SCALER_SHIFT | ATOM_FLAG_CLEAR ) + +#define SET_ATOM_S6_REQ_SCALER_ARATIO ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_REQ_SCALER_ARATIO_SHIFT | ATOM_FLAG_SET ) +#define CLEAR_ATOM_S6_REQ_SCALER_ARATIO ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_REQ_SCALER_ARATIO_SHIFT | ATOM_FLAG_CLEAR ) + +#define SET_ATOM_S6_I2C_STATE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_I2C_STATE_CHANGE_SHIFT | ATOM_FLAG_SET ) + +#define SET_ATOM_S6_DISPLAY_STATE_CHANGE ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_DISPLAY_STATE_CHANGE_SHIFT | ATOM_FLAG_SET ) + +#define SET_ATOM_S6_DEVICE_RECONFIG ((ATOM_ACC_CHANGE_INFO_DEF << 8 )|ATOM_S6_CONFIG_DISPLAY_CHANGE_SHIFT | ATOM_FLAG_SET) +#define CLEAR_ATOM_S0_LCD1 ((ATOM_DEVICE_CONNECT_INFO_DEF << 8 )| ATOM_S0_LCD1_SHIFT | ATOM_FLAG_CLEAR ) +#define SET_ATOM_S7_DOS_8BIT_DAC_EN ((ATOM_DOS_MODE_INFO_DEF << 8 )|ATOM_S7_DOS_8BIT_DAC_EN_SHIFT | ATOM_FLAG_SET ) +#define CLEAR_ATOM_S7_DOS_8BIT_DAC_EN ((ATOM_DOS_MODE_INFO_DEF << 8 )|ATOM_S7_DOS_8BIT_DAC_EN_SHIFT | ATOM_FLAG_CLEAR ) + +/****************************************************************************/ +//Portion II: Definitinos only used in Driver +/****************************************************************************/ + +// Macros used by driver +#ifdef __cplusplus +#define GetIndexIntoMasterTable(MasterOrData, FieldName) ((reinterpret_cast(&(static_cast(0))->FieldName)-static_cast(0))/sizeof(USHORT)) + +#define GET_COMMAND_TABLE_COMMANDSET_REVISION(TABLE_HEADER_OFFSET) (((static_cast(TABLE_HEADER_OFFSET))->ucTableFormatRevision )&0x3F) +#define GET_COMMAND_TABLE_PARAMETER_REVISION(TABLE_HEADER_OFFSET) (((static_cast(TABLE_HEADER_OFFSET))->ucTableContentRevision)&0x3F) +#else // not __cplusplus +#define GetIndexIntoMasterTable(MasterOrData, FieldName) (((char*)(&((ATOM_MASTER_LIST_OF_##MasterOrData##_TABLES*)0)->FieldName)-(char*)0)/sizeof(USHORT)) + +#define GET_COMMAND_TABLE_COMMANDSET_REVISION(TABLE_HEADER_OFFSET) ((((ATOM_COMMON_TABLE_HEADER*)TABLE_HEADER_OFFSET)->ucTableFormatRevision)&0x3F) +#define GET_COMMAND_TABLE_PARAMETER_REVISION(TABLE_HEADER_OFFSET) ((((ATOM_COMMON_TABLE_HEADER*)TABLE_HEADER_OFFSET)->ucTableContentRevision)&0x3F) +#endif // __cplusplus + +#define GET_DATA_TABLE_MAJOR_REVISION GET_COMMAND_TABLE_COMMANDSET_REVISION +#define GET_DATA_TABLE_MINOR_REVISION GET_COMMAND_TABLE_PARAMETER_REVISION + +/****************************************************************************/ +//Portion III: Definitinos only used in VBIOS +/****************************************************************************/ +#define ATOM_DAC_SRC 0x80 +#define ATOM_SRC_DAC1 0 +#define ATOM_SRC_DAC2 0x80 + +typedef struct _MEMORY_PLLINIT_PARAMETERS +{ + ULONG ulTargetMemoryClock; //In 10Khz unit + UCHAR ucAction; //not define yet + UCHAR ucFbDiv_Hi; //Fbdiv Hi byte + UCHAR ucFbDiv; //FB value + UCHAR ucPostDiv; //Post div +}MEMORY_PLLINIT_PARAMETERS; + +#define MEMORY_PLLINIT_PS_ALLOCATION MEMORY_PLLINIT_PARAMETERS + + +#define GPIO_PIN_WRITE 0x01 +#define GPIO_PIN_READ 0x00 + +typedef struct _GPIO_PIN_CONTROL_PARAMETERS +{ + UCHAR ucGPIO_ID; //return value, read from GPIO pins + UCHAR ucGPIOBitShift; //define which bit in uGPIOBitVal need to be update + UCHAR ucGPIOBitVal; //Set/Reset corresponding bit defined in ucGPIOBitMask + UCHAR ucAction; //=GPIO_PIN_WRITE: Read; =GPIO_PIN_READ: Write +}GPIO_PIN_CONTROL_PARAMETERS; + +typedef struct _ENABLE_SCALER_PARAMETERS +{ + UCHAR ucScaler; // ATOM_SCALER1, ATOM_SCALER2 + UCHAR ucEnable; // ATOM_SCALER_DISABLE or ATOM_SCALER_CENTER or ATOM_SCALER_EXPANSION + UCHAR ucTVStandard; // + UCHAR ucPadding[1]; +}ENABLE_SCALER_PARAMETERS; +#define ENABLE_SCALER_PS_ALLOCATION ENABLE_SCALER_PARAMETERS + +//ucEnable: +#define SCALER_BYPASS_AUTO_CENTER_NO_REPLICATION 0 +#define SCALER_BYPASS_AUTO_CENTER_AUTO_REPLICATION 1 +#define SCALER_ENABLE_2TAP_ALPHA_MODE 2 +#define SCALER_ENABLE_MULTITAP_MODE 3 + +typedef struct _ENABLE_HARDWARE_ICON_CURSOR_PARAMETERS +{ + ULONG usHWIconHorzVertPosn; // Hardware Icon Vertical position + UCHAR ucHWIconVertOffset; // Hardware Icon Vertical offset + UCHAR ucHWIconHorzOffset; // Hardware Icon Horizontal offset + UCHAR ucSelection; // ATOM_CURSOR1 or ATOM_ICON1 or ATOM_CURSOR2 or ATOM_ICON2 + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE +}ENABLE_HARDWARE_ICON_CURSOR_PARAMETERS; + +typedef struct _ENABLE_HARDWARE_ICON_CURSOR_PS_ALLOCATION +{ + ENABLE_HARDWARE_ICON_CURSOR_PARAMETERS sEnableIcon; + ENABLE_CRTC_PARAMETERS sReserved; +}ENABLE_HARDWARE_ICON_CURSOR_PS_ALLOCATION; + +typedef struct _ENABLE_GRAPH_SURFACE_PARAMETERS +{ + USHORT usHight; // Image Hight + USHORT usWidth; // Image Width + UCHAR ucSurface; // Surface 1 or 2 + UCHAR ucPadding[3]; +}ENABLE_GRAPH_SURFACE_PARAMETERS; + +typedef struct _ENABLE_GRAPH_SURFACE_PARAMETERS_V1_2 +{ + USHORT usHight; // Image Hight + USHORT usWidth; // Image Width + UCHAR ucSurface; // Surface 1 or 2 + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE + UCHAR ucPadding[2]; +}ENABLE_GRAPH_SURFACE_PARAMETERS_V1_2; + +typedef struct _ENABLE_GRAPH_SURFACE_PARAMETERS_V1_3 +{ + USHORT usHight; // Image Hight + USHORT usWidth; // Image Width + UCHAR ucSurface; // Surface 1 or 2 + UCHAR ucEnable; // ATOM_ENABLE or ATOM_DISABLE + USHORT usDeviceId; // Active Device Id for this surface. If no device, set to 0. +}ENABLE_GRAPH_SURFACE_PARAMETERS_V1_3; + +typedef struct _ENABLE_GRAPH_SURFACE_PS_ALLOCATION +{ + ENABLE_GRAPH_SURFACE_PARAMETERS sSetSurface; + ENABLE_YUV_PS_ALLOCATION sReserved; // Don't set this one +}ENABLE_GRAPH_SURFACE_PS_ALLOCATION; + +typedef struct _MEMORY_CLEAN_UP_PARAMETERS +{ + USHORT usMemoryStart; //in 8Kb boundary, offset from memory base address + USHORT usMemorySize; //8Kb blocks aligned +}MEMORY_CLEAN_UP_PARAMETERS; +#define MEMORY_CLEAN_UP_PS_ALLOCATION MEMORY_CLEAN_UP_PARAMETERS + +typedef struct _GET_DISPLAY_SURFACE_SIZE_PARAMETERS +{ + USHORT usX_Size; //When use as input parameter, usX_Size indicates which CRTC + USHORT usY_Size; +}GET_DISPLAY_SURFACE_SIZE_PARAMETERS; + +typedef struct _INDIRECT_IO_ACCESS +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR IOAccessSequence[256]; +} INDIRECT_IO_ACCESS; + +#define INDIRECT_READ 0x00 +#define INDIRECT_WRITE 0x80 + +#define INDIRECT_IO_MM 0 +#define INDIRECT_IO_PLL 1 +#define INDIRECT_IO_MC 2 +#define INDIRECT_IO_PCIE 3 +#define INDIRECT_IO_PCIEP 4 +#define INDIRECT_IO_NBMISC 5 + +#define INDIRECT_IO_PLL_READ INDIRECT_IO_PLL | INDIRECT_READ +#define INDIRECT_IO_PLL_WRITE INDIRECT_IO_PLL | INDIRECT_WRITE +#define INDIRECT_IO_MC_READ INDIRECT_IO_MC | INDIRECT_READ +#define INDIRECT_IO_MC_WRITE INDIRECT_IO_MC | INDIRECT_WRITE +#define INDIRECT_IO_PCIE_READ INDIRECT_IO_PCIE | INDIRECT_READ +#define INDIRECT_IO_PCIE_WRITE INDIRECT_IO_PCIE | INDIRECT_WRITE +#define INDIRECT_IO_PCIEP_READ INDIRECT_IO_PCIEP | INDIRECT_READ +#define INDIRECT_IO_PCIEP_WRITE INDIRECT_IO_PCIEP | INDIRECT_WRITE +#define INDIRECT_IO_NBMISC_READ INDIRECT_IO_NBMISC | INDIRECT_READ +#define INDIRECT_IO_NBMISC_WRITE INDIRECT_IO_NBMISC | INDIRECT_WRITE + +typedef struct _ATOM_OEM_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; +}ATOM_OEM_INFO; + +typedef struct _ATOM_TV_MODE +{ + UCHAR ucVMode_Num; //Video mode number + UCHAR ucTV_Mode_Num; //Internal TV mode number +}ATOM_TV_MODE; + +typedef struct _ATOM_BIOS_INT_TVSTD_MODE +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usTV_Mode_LUT_Offset; // Pointer to standard to internal number conversion table + USHORT usTV_FIFO_Offset; // Pointer to FIFO entry table + USHORT usNTSC_Tbl_Offset; // Pointer to SDTV_Mode_NTSC table + USHORT usPAL_Tbl_Offset; // Pointer to SDTV_Mode_PAL table + USHORT usCV_Tbl_Offset; // Pointer to SDTV_Mode_PAL table +}ATOM_BIOS_INT_TVSTD_MODE; + + +typedef struct _ATOM_TV_MODE_SCALER_PTR +{ + USHORT ucFilter0_Offset; //Pointer to filter format 0 coefficients + USHORT usFilter1_Offset; //Pointer to filter format 0 coefficients + UCHAR ucTV_Mode_Num; +}ATOM_TV_MODE_SCALER_PTR; + +typedef struct _ATOM_STANDARD_VESA_TIMING +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_DTD_FORMAT aModeTimings[16]; // 16 is not the real array number, just for initial allocation +}ATOM_STANDARD_VESA_TIMING; + + +typedef struct _ATOM_STD_FORMAT +{ + USHORT usSTD_HDisp; + USHORT usSTD_VDisp; + USHORT usSTD_RefreshRate; + USHORT usReserved; +}ATOM_STD_FORMAT; + +typedef struct _ATOM_VESA_TO_EXTENDED_MODE +{ + USHORT usVESA_ModeNumber; + USHORT usExtendedModeNumber; +}ATOM_VESA_TO_EXTENDED_MODE; + +typedef struct _ATOM_VESA_TO_INTENAL_MODE_LUT +{ + ATOM_COMMON_TABLE_HEADER sHeader; + ATOM_VESA_TO_EXTENDED_MODE asVESA_ToExtendedModeInfo[76]; +}ATOM_VESA_TO_INTENAL_MODE_LUT; + +/*************** ATOM Memory Related Data Structure ***********************/ +typedef struct _ATOM_MEMORY_VENDOR_BLOCK{ + UCHAR ucMemoryType; + UCHAR ucMemoryVendor; + UCHAR ucAdjMCId; + UCHAR ucDynClkId; + ULONG ulDllResetClkRange; +}ATOM_MEMORY_VENDOR_BLOCK; + + +typedef struct _ATOM_MEMORY_SETTING_ID_CONFIG{ +#if ATOM_BIG_ENDIAN + ULONG ucMemBlkId:8; + ULONG ulMemClockRange:24; +#else + ULONG ulMemClockRange:24; + ULONG ucMemBlkId:8; +#endif +}ATOM_MEMORY_SETTING_ID_CONFIG; + +typedef union _ATOM_MEMORY_SETTING_ID_CONFIG_ACCESS +{ + ATOM_MEMORY_SETTING_ID_CONFIG slAccess; + ULONG ulAccess; +}ATOM_MEMORY_SETTING_ID_CONFIG_ACCESS; + + +typedef struct _ATOM_MEMORY_SETTING_DATA_BLOCK{ + ATOM_MEMORY_SETTING_ID_CONFIG_ACCESS ulMemoryID; + ULONG aulMemData[1]; +}ATOM_MEMORY_SETTING_DATA_BLOCK; + + +typedef struct _ATOM_INIT_REG_INDEX_FORMAT{ + USHORT usRegIndex; // MC register index + UCHAR ucPreRegDataLength; // offset in ATOM_INIT_REG_DATA_BLOCK.saRegDataBuf +}ATOM_INIT_REG_INDEX_FORMAT; + + +typedef struct _ATOM_INIT_REG_BLOCK{ + USHORT usRegIndexTblSize; //size of asRegIndexBuf + USHORT usRegDataBlkSize; //size of ATOM_MEMORY_SETTING_DATA_BLOCK + ATOM_INIT_REG_INDEX_FORMAT asRegIndexBuf[1]; + ATOM_MEMORY_SETTING_DATA_BLOCK asRegDataBuf[1]; +}ATOM_INIT_REG_BLOCK; + +#define END_OF_REG_INDEX_BLOCK 0x0ffff +#define END_OF_REG_DATA_BLOCK 0x00000000 +#define ATOM_INIT_REG_MASK_FLAG 0x80 +#define CLOCK_RANGE_HIGHEST 0x00ffffff + +#define VALUE_DWORD SIZEOF ULONG +#define VALUE_SAME_AS_ABOVE 0 +#define VALUE_MASK_DWORD 0x84 + +#define INDEX_ACCESS_RANGE_BEGIN (VALUE_DWORD + 1) +#define INDEX_ACCESS_RANGE_END (INDEX_ACCESS_RANGE_BEGIN + 1) +#define VALUE_INDEX_ACCESS_SINGLE (INDEX_ACCESS_RANGE_END + 1) +//#define ACCESS_MCIODEBUGIND 0x40 //defined in BIOS code +#define ACCESS_PLACEHOLDER 0x80 + +typedef struct _ATOM_MC_INIT_PARAM_TABLE +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usAdjustARB_SEQDataOffset; + USHORT usMCInitMemTypeTblOffset; + USHORT usMCInitCommonTblOffset; + USHORT usMCInitPowerDownTblOffset; + ULONG ulARB_SEQDataBuf[32]; + ATOM_INIT_REG_BLOCK asMCInitMemType; + ATOM_INIT_REG_BLOCK asMCInitCommon; +}ATOM_MC_INIT_PARAM_TABLE; + + +#define _4Mx16 0x2 +#define _4Mx32 0x3 +#define _8Mx16 0x12 +#define _8Mx32 0x13 +#define _16Mx16 0x22 +#define _16Mx32 0x23 +#define _32Mx16 0x32 +#define _32Mx32 0x33 +#define _64Mx8 0x41 +#define _64Mx16 0x42 +#define _64Mx32 0x43 +#define _128Mx8 0x51 +#define _128Mx16 0x52 +#define _256Mx8 0x61 + +#define SAMSUNG 0x1 +#define INFINEON 0x2 +#define ELPIDA 0x3 +#define ETRON 0x4 +#define NANYA 0x5 +#define HYNIX 0x6 +#define MOSEL 0x7 +#define WINBOND 0x8 +#define ESMT 0x9 +#define MICRON 0xF + +#define QIMONDA INFINEON +#define PROMOS MOSEL +#define KRETON INFINEON +#define ELIXIR NANYA + +/////////////Support for GDDR5 MC uCode to reside in upper 64K of ROM///////////// + +#define UCODE_ROM_START_ADDRESS 0x1b800 +#define UCODE_SIGNATURE 0x4375434d // 'MCuC' - MC uCode + +//uCode block header for reference + +typedef struct _MCuCodeHeader +{ + ULONG ulSignature; + UCHAR ucRevision; + UCHAR ucChecksum; + UCHAR ucReserved1; + UCHAR ucReserved2; + USHORT usParametersLength; + USHORT usUCodeLength; + USHORT usReserved1; + USHORT usReserved2; +} MCuCodeHeader; + +////////////////////////////////////////////////////////////////////////////////// + +#define ATOM_MAX_NUMBER_OF_VRAM_MODULE 16 + +#define ATOM_VRAM_MODULE_MEMORY_VENDOR_ID_MASK 0xF +typedef struct _ATOM_VRAM_MODULE_V1 +{ + ULONG ulReserved; + USHORT usEMRSValue; + USHORT usMRSValue; + USHORT usReserved; + UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module + UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4;[3:0] reserved; + UCHAR ucMemoryVenderID; // Predefined,never change across designs or memory type/vender + UCHAR ucMemoryDeviceCfg; // [7:4]=0x0:4M;=0x1:8M;=0x2:16M;0x3:32M....[3:0]=0x0:x4;=0x1:x8;=0x2:x16;=0x3:x32... + UCHAR ucRow; // Number of Row,in power of 2; + UCHAR ucColumn; // Number of Column,in power of 2; + UCHAR ucBank; // Nunber of Bank; + UCHAR ucRank; // Number of Rank, in power of 2 + UCHAR ucChannelNum; // Number of channel; + UCHAR ucChannelConfig; // [3:0]=Indication of what channel combination;[4:7]=Channel bit width, in number of 2 + UCHAR ucDefaultMVDDQ_ID; // Default MVDDQ setting for this memory block, ID linking to MVDDQ info table to find real set-up data; + UCHAR ucDefaultMVDDC_ID; // Default MVDDC setting for this memory block, ID linking to MVDDC info table to find real set-up data; + UCHAR ucReserved[2]; +}ATOM_VRAM_MODULE_V1; + + +typedef struct _ATOM_VRAM_MODULE_V2 +{ + ULONG ulReserved; + ULONG ulFlags; // To enable/disable functionalities based on memory type + ULONG ulEngineClock; // Override of default engine clock for particular memory type + ULONG ulMemoryClock; // Override of default memory clock for particular memory type + USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type + USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type + USHORT usEMRSValue; + USHORT usMRSValue; + USHORT usReserved; + UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module + UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4;[3:0] - must not be used for now; + UCHAR ucMemoryVenderID; // Predefined,never change across designs or memory type/vender. If not predefined, vendor detection table gets executed + UCHAR ucMemoryDeviceCfg; // [7:4]=0x0:4M;=0x1:8M;=0x2:16M;0x3:32M....[3:0]=0x0:x4;=0x1:x8;=0x2:x16;=0x3:x32... + UCHAR ucRow; // Number of Row,in power of 2; + UCHAR ucColumn; // Number of Column,in power of 2; + UCHAR ucBank; // Nunber of Bank; + UCHAR ucRank; // Number of Rank, in power of 2 + UCHAR ucChannelNum; // Number of channel; + UCHAR ucChannelConfig; // [3:0]=Indication of what channel combination;[4:7]=Channel bit width, in number of 2 + UCHAR ucDefaultMVDDQ_ID; // Default MVDDQ setting for this memory block, ID linking to MVDDQ info table to find real set-up data; + UCHAR ucDefaultMVDDC_ID; // Default MVDDC setting for this memory block, ID linking to MVDDC info table to find real set-up data; + UCHAR ucRefreshRateFactor; + UCHAR ucReserved[3]; +}ATOM_VRAM_MODULE_V2; + + +typedef struct _ATOM_MEMORY_TIMING_FORMAT +{ + ULONG ulClkRange; // memory clock in 10kHz unit, when target memory clock is below this clock, use this memory timing + union{ + USHORT usMRS; // mode register + USHORT usDDR3_MR0; + }; + union{ + USHORT usEMRS; // extended mode register + USHORT usDDR3_MR1; + }; + UCHAR ucCL; // CAS latency + UCHAR ucWL; // WRITE Latency + UCHAR uctRAS; // tRAS + UCHAR uctRC; // tRC + UCHAR uctRFC; // tRFC + UCHAR uctRCDR; // tRCDR + UCHAR uctRCDW; // tRCDW + UCHAR uctRP; // tRP + UCHAR uctRRD; // tRRD + UCHAR uctWR; // tWR + UCHAR uctWTR; // tWTR + UCHAR uctPDIX; // tPDIX + UCHAR uctFAW; // tFAW + UCHAR uctAOND; // tAOND + union + { + struct { + UCHAR ucflag; // flag to control memory timing calculation. bit0= control EMRS2 Infineon + UCHAR ucReserved; + }; + USHORT usDDR3_MR2; + }; +}ATOM_MEMORY_TIMING_FORMAT; + + +typedef struct _ATOM_MEMORY_TIMING_FORMAT_V1 +{ + ULONG ulClkRange; // memory clock in 10kHz unit, when target memory clock is below this clock, use this memory timing + USHORT usMRS; // mode register + USHORT usEMRS; // extended mode register + UCHAR ucCL; // CAS latency + UCHAR ucWL; // WRITE Latency + UCHAR uctRAS; // tRAS + UCHAR uctRC; // tRC + UCHAR uctRFC; // tRFC + UCHAR uctRCDR; // tRCDR + UCHAR uctRCDW; // tRCDW + UCHAR uctRP; // tRP + UCHAR uctRRD; // tRRD + UCHAR uctWR; // tWR + UCHAR uctWTR; // tWTR + UCHAR uctPDIX; // tPDIX + UCHAR uctFAW; // tFAW + UCHAR uctAOND; // tAOND + UCHAR ucflag; // flag to control memory timing calculation. bit0= control EMRS2 Infineon +////////////////////////////////////GDDR parameters/////////////////////////////////// + UCHAR uctCCDL; // + UCHAR uctCRCRL; // + UCHAR uctCRCWL; // + UCHAR uctCKE; // + UCHAR uctCKRSE; // + UCHAR uctCKRSX; // + UCHAR uctFAW32; // + UCHAR ucMR5lo; // + UCHAR ucMR5hi; // + UCHAR ucTerminator; +}ATOM_MEMORY_TIMING_FORMAT_V1; + +typedef struct _ATOM_MEMORY_TIMING_FORMAT_V2 +{ + ULONG ulClkRange; // memory clock in 10kHz unit, when target memory clock is below this clock, use this memory timing + USHORT usMRS; // mode register + USHORT usEMRS; // extended mode register + UCHAR ucCL; // CAS latency + UCHAR ucWL; // WRITE Latency + UCHAR uctRAS; // tRAS + UCHAR uctRC; // tRC + UCHAR uctRFC; // tRFC + UCHAR uctRCDR; // tRCDR + UCHAR uctRCDW; // tRCDW + UCHAR uctRP; // tRP + UCHAR uctRRD; // tRRD + UCHAR uctWR; // tWR + UCHAR uctWTR; // tWTR + UCHAR uctPDIX; // tPDIX + UCHAR uctFAW; // tFAW + UCHAR uctAOND; // tAOND + UCHAR ucflag; // flag to control memory timing calculation. bit0= control EMRS2 Infineon +////////////////////////////////////GDDR parameters/////////////////////////////////// + UCHAR uctCCDL; // + UCHAR uctCRCRL; // + UCHAR uctCRCWL; // + UCHAR uctCKE; // + UCHAR uctCKRSE; // + UCHAR uctCKRSX; // + UCHAR uctFAW32; // + UCHAR ucMR4lo; // + UCHAR ucMR4hi; // + UCHAR ucMR5lo; // + UCHAR ucMR5hi; // + UCHAR ucTerminator; + UCHAR ucReserved; +}ATOM_MEMORY_TIMING_FORMAT_V2; + +typedef struct _ATOM_MEMORY_FORMAT +{ + ULONG ulDllDisClock; // memory DLL will be disable when target memory clock is below this clock + union{ + USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type + USHORT usDDR3_Reserved; // Not used for DDR3 memory + }; + union{ + USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type + USHORT usDDR3_MR3; // Used for DDR3 memory + }; + UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4;[3:0] - must not be used for now; + UCHAR ucMemoryVenderID; // Predefined,never change across designs or memory type/vender. If not predefined, vendor detection table gets executed + UCHAR ucRow; // Number of Row,in power of 2; + UCHAR ucColumn; // Number of Column,in power of 2; + UCHAR ucBank; // Nunber of Bank; + UCHAR ucRank; // Number of Rank, in power of 2 + UCHAR ucBurstSize; // burst size, 0= burst size=4 1= burst size=8 + UCHAR ucDllDisBit; // position of DLL Enable/Disable bit in EMRS ( Extended Mode Register ) + UCHAR ucRefreshRateFactor; // memory refresh rate in unit of ms + UCHAR ucDensity; // _8Mx32, _16Mx32, _16Mx16, _32Mx16 + UCHAR ucPreamble; //[7:4] Write Preamble, [3:0] Read Preamble + UCHAR ucMemAttrib; // Memory Device Addribute, like RDBI/WDBI etc + ATOM_MEMORY_TIMING_FORMAT asMemTiming[5]; //Memory Timing block sort from lower clock to higher clock +}ATOM_MEMORY_FORMAT; + + +typedef struct _ATOM_VRAM_MODULE_V3 +{ + ULONG ulChannelMapCfg; // board dependent paramenter:Channel combination + USHORT usSize; // size of ATOM_VRAM_MODULE_V3 + USHORT usDefaultMVDDQ; // board dependent parameter:Default Memory Core Voltage + USHORT usDefaultMVDDC; // board dependent parameter:Default Memory IO Voltage + UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module + UCHAR ucChannelNum; // board dependent parameter:Number of channel; + UCHAR ucChannelSize; // board dependent parameter:32bit or 64bit + UCHAR ucVREFI; // board dependnt parameter: EXT or INT +160mv to -140mv + UCHAR ucNPL_RT; // board dependent parameter:NPL round trip delay, used for calculate memory timing parameters + UCHAR ucFlag; // To enable/disable functionalities based on memory type + ATOM_MEMORY_FORMAT asMemory; // describ all of video memory parameters from memory spec +}ATOM_VRAM_MODULE_V3; + + +//ATOM_VRAM_MODULE_V3.ucNPL_RT +#define NPL_RT_MASK 0x0f +#define BATTERY_ODT_MASK 0xc0 + +#define ATOM_VRAM_MODULE ATOM_VRAM_MODULE_V3 + +typedef struct _ATOM_VRAM_MODULE_V4 +{ + ULONG ulChannelMapCfg; // board dependent parameter: Channel combination + USHORT usModuleSize; // size of ATOM_VRAM_MODULE_V4, make it easy for VBIOS to look for next entry of VRAM_MODULE + USHORT usPrivateReserved; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! + // MC_ARB_RAMCFG (includes NOOFBANK,NOOFRANKS,NOOFROWS,NOOFCOLS) + USHORT usReserved; + UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module + UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4; 0x5:DDR5 [3:0] - Must be 0x0 for now; + UCHAR ucChannelNum; // Number of channels present in this module config + UCHAR ucChannelWidth; // 0 - 32 bits; 1 - 64 bits + UCHAR ucDensity; // _8Mx32, _16Mx32, _16Mx16, _32Mx16 + UCHAR ucFlag; // To enable/disable functionalities based on memory type + UCHAR ucMisc; // bit0: 0 - single rank; 1 - dual rank; bit2: 0 - burstlength 4, 1 - burstlength 8 + UCHAR ucVREFI; // board dependent parameter + UCHAR ucNPL_RT; // board dependent parameter:NPL round trip delay, used for calculate memory timing parameters + UCHAR ucPreamble; // [7:4] Write Preamble, [3:0] Read Preamble + UCHAR ucMemorySize; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! + // Total memory size in unit of 16MB for CONFIG_MEMSIZE - bit[23:0] zeros + UCHAR ucReserved[3]; + +//compare with V3, we flat the struct by merging ATOM_MEMORY_FORMAT (as is) into V4 as the same level + union{ + USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type + USHORT usDDR3_Reserved; + }; + union{ + USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type + USHORT usDDR3_MR3; // Used for DDR3 memory + }; + UCHAR ucMemoryVenderID; // Predefined, If not predefined, vendor detection table gets executed + UCHAR ucRefreshRateFactor; // [1:0]=RefreshFactor (00=8ms, 01=16ms, 10=32ms,11=64ms) + UCHAR ucReserved2[2]; + ATOM_MEMORY_TIMING_FORMAT asMemTiming[5];//Memory Timing block sort from lower clock to higher clock +}ATOM_VRAM_MODULE_V4; + +#define VRAM_MODULE_V4_MISC_RANK_MASK 0x3 +#define VRAM_MODULE_V4_MISC_DUAL_RANK 0x1 +#define VRAM_MODULE_V4_MISC_BL_MASK 0x4 +#define VRAM_MODULE_V4_MISC_BL8 0x4 +#define VRAM_MODULE_V4_MISC_DUAL_CS 0x10 + +typedef struct _ATOM_VRAM_MODULE_V5 +{ + ULONG ulChannelMapCfg; // board dependent parameter: Channel combination + USHORT usModuleSize; // size of ATOM_VRAM_MODULE_V4, make it easy for VBIOS to look for next entry of VRAM_MODULE + USHORT usPrivateReserved; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! + // MC_ARB_RAMCFG (includes NOOFBANK,NOOFRANKS,NOOFROWS,NOOFCOLS) + USHORT usReserved; + UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module + UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4; 0x5:DDR5 [3:0] - Must be 0x0 for now; + UCHAR ucChannelNum; // Number of channels present in this module config + UCHAR ucChannelWidth; // 0 - 32 bits; 1 - 64 bits + UCHAR ucDensity; // _8Mx32, _16Mx32, _16Mx16, _32Mx16 + UCHAR ucFlag; // To enable/disable functionalities based on memory type + UCHAR ucMisc; // bit0: 0 - single rank; 1 - dual rank; bit2: 0 - burstlength 4, 1 - burstlength 8 + UCHAR ucVREFI; // board dependent parameter + UCHAR ucNPL_RT; // board dependent parameter:NPL round trip delay, used for calculate memory timing parameters + UCHAR ucPreamble; // [7:4] Write Preamble, [3:0] Read Preamble + UCHAR ucMemorySize; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! + // Total memory size in unit of 16MB for CONFIG_MEMSIZE - bit[23:0] zeros + UCHAR ucReserved[3]; + +//compare with V3, we flat the struct by merging ATOM_MEMORY_FORMAT (as is) into V4 as the same level + USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type + USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type + UCHAR ucMemoryVenderID; // Predefined, If not predefined, vendor detection table gets executed + UCHAR ucRefreshRateFactor; // [1:0]=RefreshFactor (00=8ms, 01=16ms, 10=32ms,11=64ms) + UCHAR ucFIFODepth; // FIFO depth supposes to be detected during vendor detection, but if we dont do vendor detection we have to hardcode FIFO Depth + UCHAR ucCDR_Bandwidth; // [0:3]=Read CDR bandwidth, [4:7] - Write CDR Bandwidth + ATOM_MEMORY_TIMING_FORMAT_V1 asMemTiming[5];//Memory Timing block sort from lower clock to higher clock +}ATOM_VRAM_MODULE_V5; + +typedef struct _ATOM_VRAM_MODULE_V6 +{ + ULONG ulChannelMapCfg; // board dependent parameter: Channel combination + USHORT usModuleSize; // size of ATOM_VRAM_MODULE_V4, make it easy for VBIOS to look for next entry of VRAM_MODULE + USHORT usPrivateReserved; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! + // MC_ARB_RAMCFG (includes NOOFBANK,NOOFRANKS,NOOFROWS,NOOFCOLS) + USHORT usReserved; + UCHAR ucExtMemoryID; // An external indicator (by hardcode, callback or pin) to tell what is the current memory module + UCHAR ucMemoryType; // [7:4]=0x1:DDR1;=0x2:DDR2;=0x3:DDR3;=0x4:DDR4; 0x5:DDR5 [3:0] - Must be 0x0 for now; + UCHAR ucChannelNum; // Number of channels present in this module config + UCHAR ucChannelWidth; // 0 - 32 bits; 1 - 64 bits + UCHAR ucDensity; // _8Mx32, _16Mx32, _16Mx16, _32Mx16 + UCHAR ucFlag; // To enable/disable functionalities based on memory type + UCHAR ucMisc; // bit0: 0 - single rank; 1 - dual rank; bit2: 0 - burstlength 4, 1 - burstlength 8 + UCHAR ucVREFI; // board dependent parameter + UCHAR ucNPL_RT; // board dependent parameter:NPL round trip delay, used for calculate memory timing parameters + UCHAR ucPreamble; // [7:4] Write Preamble, [3:0] Read Preamble + UCHAR ucMemorySize; // BIOS internal reserved space to optimize code size, updated by the compiler, shouldn't be modified manually!! + // Total memory size in unit of 16MB for CONFIG_MEMSIZE - bit[23:0] zeros + UCHAR ucReserved[3]; + +//compare with V3, we flat the struct by merging ATOM_MEMORY_FORMAT (as is) into V4 as the same level + USHORT usEMRS2Value; // EMRS2 Value is used for GDDR2 and GDDR4 memory type + USHORT usEMRS3Value; // EMRS3 Value is used for GDDR2 and GDDR4 memory type + UCHAR ucMemoryVenderID; // Predefined, If not predefined, vendor detection table gets executed + UCHAR ucRefreshRateFactor; // [1:0]=RefreshFactor (00=8ms, 01=16ms, 10=32ms,11=64ms) + UCHAR ucFIFODepth; // FIFO depth supposes to be detected during vendor detection, but if we dont do vendor detection we have to hardcode FIFO Depth + UCHAR ucCDR_Bandwidth; // [0:3]=Read CDR bandwidth, [4:7] - Write CDR Bandwidth + ATOM_MEMORY_TIMING_FORMAT_V2 asMemTiming[5];//Memory Timing block sort from lower clock to higher clock +}ATOM_VRAM_MODULE_V6; + +typedef struct _ATOM_VRAM_MODULE_V7 +{ +// Design Specific Values + ULONG ulChannelMapCfg; // mmMC_SHARED_CHREMAP + USHORT usModuleSize; // Size of ATOM_VRAM_MODULE_V7 + USHORT usPrivateReserved; // MC_ARB_RAMCFG (includes NOOFBANK,NOOFRANKS,NOOFROWS,NOOFCOLS) + USHORT usReserved; + UCHAR ucExtMemoryID; // Current memory module ID + UCHAR ucMemoryType; // MEM_TYPE_DDR2/DDR3/GDDR3/GDDR5 + UCHAR ucChannelNum; // Number of mem. channels supported in this module + UCHAR ucChannelWidth; // CHANNEL_16BIT/CHANNEL_32BIT/CHANNEL_64BIT + UCHAR ucDensity; // _8Mx32, _16Mx32, _16Mx16, _32Mx16 + UCHAR ucReserve; // Former container for Mx_FLAGS like DBI_AC_MODE_ENABLE_ASIC for GDDR4. Not used now. + UCHAR ucMisc; // RANK_OF_THISMEMORY etc. + UCHAR ucVREFI; // Not used. + UCHAR ucNPL_RT; // Round trip delay (MC_SEQ_CAS_TIMING [28:24]:TCL=CL+NPL_RT-2). Always 2. + UCHAR ucPreamble; // [7:4] Write Preamble, [3:0] Read Preamble + UCHAR ucMemorySize; // Total memory size in unit of 16MB for CONFIG_MEMSIZE - bit[23:0] zeros + UCHAR ucReserved[3]; +// Memory Module specific values + USHORT usEMRS2Value; // EMRS2/MR2 Value. + USHORT usEMRS3Value; // EMRS3/MR3 Value. + UCHAR ucMemoryVenderID; // [7:4] Revision, [3:0] Vendor code + UCHAR ucRefreshRateFactor; // [1:0]=RefreshFactor (00=8ms, 01=16ms, 10=32ms,11=64ms) + UCHAR ucFIFODepth; // FIFO depth can be detected during vendor detection, here is hardcoded per memory + UCHAR ucCDR_Bandwidth; // [0:3]=Read CDR bandwidth, [4:7] - Write CDR Bandwidth + char strMemPNString[20]; // part number end with '0'. +}ATOM_VRAM_MODULE_V7; + +typedef struct _ATOM_VRAM_INFO_V2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucNumOfVRAMModule; + ATOM_VRAM_MODULE aVramInfo[ATOM_MAX_NUMBER_OF_VRAM_MODULE]; // just for allocation, real number of blocks is in ucNumOfVRAMModule; +}ATOM_VRAM_INFO_V2; + +typedef struct _ATOM_VRAM_INFO_V3 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usMemAdjustTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory vendor specific MC adjust setting + USHORT usMemClkPatchTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory clock specific MC setting + USHORT usRerseved; + UCHAR aVID_PinsShift[9]; // 8 bit strap maximum+terminator + UCHAR ucNumOfVRAMModule; + ATOM_VRAM_MODULE aVramInfo[ATOM_MAX_NUMBER_OF_VRAM_MODULE]; // just for allocation, real number of blocks is in ucNumOfVRAMModule; + ATOM_INIT_REG_BLOCK asMemPatch; // for allocation + // ATOM_INIT_REG_BLOCK aMemAdjust; +}ATOM_VRAM_INFO_V3; + +#define ATOM_VRAM_INFO_LAST ATOM_VRAM_INFO_V3 + +typedef struct _ATOM_VRAM_INFO_V4 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usMemAdjustTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory vendor specific MC adjust setting + USHORT usMemClkPatchTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory clock specific MC setting + USHORT usRerseved; + UCHAR ucMemDQ7_0ByteRemap; // DQ line byte remap, =0: Memory Data line BYTE0, =1: BYTE1, =2: BYTE2, =3: BYTE3 + ULONG ulMemDQ7_0BitRemap; // each DQ line ( 7~0) use 3bits, like: DQ0=Bit[2:0], DQ1:[5:3], ... DQ7:[23:21] + UCHAR ucReservde[4]; + UCHAR ucNumOfVRAMModule; + ATOM_VRAM_MODULE_V4 aVramInfo[ATOM_MAX_NUMBER_OF_VRAM_MODULE]; // just for allocation, real number of blocks is in ucNumOfVRAMModule; + ATOM_INIT_REG_BLOCK asMemPatch; // for allocation + // ATOM_INIT_REG_BLOCK aMemAdjust; +}ATOM_VRAM_INFO_V4; + +typedef struct _ATOM_VRAM_INFO_HEADER_V2_1 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usMemAdjustTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory vendor specific MC adjust setting + USHORT usMemClkPatchTblOffset; // offset of ATOM_INIT_REG_BLOCK structure for memory clock specific MC setting + USHORT usReserved[4]; + UCHAR ucNumOfVRAMModule; // indicate number of VRAM module + UCHAR ucMemoryClkPatchTblVer; // version of memory AC timing register list + UCHAR ucVramModuleVer; // indicate ATOM_VRAM_MODUE version + UCHAR ucReserved; + ATOM_VRAM_MODULE_V7 aVramInfo[ATOM_MAX_NUMBER_OF_VRAM_MODULE]; // just for allocation, real number of blocks is in ucNumOfVRAMModule; +}ATOM_VRAM_INFO_HEADER_V2_1; + + +typedef struct _ATOM_VRAM_GPIO_DETECTION_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR aVID_PinsShift[9]; //8 bit strap maximum+terminator +}ATOM_VRAM_GPIO_DETECTION_INFO; + + +typedef struct _ATOM_MEMORY_TRAINING_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucTrainingLoop; + UCHAR ucReserved[3]; + ATOM_INIT_REG_BLOCK asMemTrainingSetting; +}ATOM_MEMORY_TRAINING_INFO; + + +typedef struct SW_I2C_CNTL_DATA_PARAMETERS +{ + UCHAR ucControl; + UCHAR ucData; + UCHAR ucSatus; + UCHAR ucTemp; +} SW_I2C_CNTL_DATA_PARAMETERS; + +#define SW_I2C_CNTL_DATA_PS_ALLOCATION SW_I2C_CNTL_DATA_PARAMETERS + +typedef struct _SW_I2C_IO_DATA_PARAMETERS +{ + USHORT GPIO_Info; + UCHAR ucAct; + UCHAR ucData; + } SW_I2C_IO_DATA_PARAMETERS; + +#define SW_I2C_IO_DATA_PS_ALLOCATION SW_I2C_IO_DATA_PARAMETERS + +/****************************SW I2C CNTL DEFINITIONS**********************/ +#define SW_I2C_IO_RESET 0 +#define SW_I2C_IO_GET 1 +#define SW_I2C_IO_DRIVE 2 +#define SW_I2C_IO_SET 3 +#define SW_I2C_IO_START 4 + +#define SW_I2C_IO_CLOCK 0 +#define SW_I2C_IO_DATA 0x80 + +#define SW_I2C_IO_ZERO 0 +#define SW_I2C_IO_ONE 0x100 + +#define SW_I2C_CNTL_READ 0 +#define SW_I2C_CNTL_WRITE 1 +#define SW_I2C_CNTL_START 2 +#define SW_I2C_CNTL_STOP 3 +#define SW_I2C_CNTL_OPEN 4 +#define SW_I2C_CNTL_CLOSE 5 +#define SW_I2C_CNTL_WRITE1BIT 6 + +//==============================VESA definition Portion=============================== +#define VESA_OEM_PRODUCT_REV "01.00" +#define VESA_MODE_ATTRIBUTE_MODE_SUPPORT 0xBB //refer to VBE spec p.32, no TTY support +#define VESA_MODE_WIN_ATTRIBUTE 7 +#define VESA_WIN_SIZE 64 + +typedef struct _PTR_32_BIT_STRUCTURE +{ + USHORT Offset16; + USHORT Segment16; +} PTR_32_BIT_STRUCTURE; + +typedef union _PTR_32_BIT_UNION +{ + PTR_32_BIT_STRUCTURE SegmentOffset; + ULONG Ptr32_Bit; +} PTR_32_BIT_UNION; + +typedef struct _VBE_1_2_INFO_BLOCK_UPDATABLE +{ + UCHAR VbeSignature[4]; + USHORT VbeVersion; + PTR_32_BIT_UNION OemStringPtr; + UCHAR Capabilities[4]; + PTR_32_BIT_UNION VideoModePtr; + USHORT TotalMemory; +} VBE_1_2_INFO_BLOCK_UPDATABLE; + + +typedef struct _VBE_2_0_INFO_BLOCK_UPDATABLE +{ + VBE_1_2_INFO_BLOCK_UPDATABLE CommonBlock; + USHORT OemSoftRev; + PTR_32_BIT_UNION OemVendorNamePtr; + PTR_32_BIT_UNION OemProductNamePtr; + PTR_32_BIT_UNION OemProductRevPtr; +} VBE_2_0_INFO_BLOCK_UPDATABLE; + +typedef union _VBE_VERSION_UNION +{ + VBE_2_0_INFO_BLOCK_UPDATABLE VBE_2_0_InfoBlock; + VBE_1_2_INFO_BLOCK_UPDATABLE VBE_1_2_InfoBlock; +} VBE_VERSION_UNION; + +typedef struct _VBE_INFO_BLOCK +{ + VBE_VERSION_UNION UpdatableVBE_Info; + UCHAR Reserved[222]; + UCHAR OemData[256]; +} VBE_INFO_BLOCK; + +typedef struct _VBE_FP_INFO +{ + USHORT HSize; + USHORT VSize; + USHORT FPType; + UCHAR RedBPP; + UCHAR GreenBPP; + UCHAR BlueBPP; + UCHAR ReservedBPP; + ULONG RsvdOffScrnMemSize; + ULONG RsvdOffScrnMEmPtr; + UCHAR Reserved[14]; +} VBE_FP_INFO; + +typedef struct _VESA_MODE_INFO_BLOCK +{ +// Mandatory information for all VBE revisions + USHORT ModeAttributes; // dw ? ; mode attributes + UCHAR WinAAttributes; // db ? ; window A attributes + UCHAR WinBAttributes; // db ? ; window B attributes + USHORT WinGranularity; // dw ? ; window granularity + USHORT WinSize; // dw ? ; window size + USHORT WinASegment; // dw ? ; window A start segment + USHORT WinBSegment; // dw ? ; window B start segment + ULONG WinFuncPtr; // dd ? ; real mode pointer to window function + USHORT BytesPerScanLine;// dw ? ; bytes per scan line + +//; Mandatory information for VBE 1.2 and above + USHORT XResolution; // dw ? ; horizontal resolution in pixels or characters + USHORT YResolution; // dw ? ; vertical resolution in pixels or characters + UCHAR XCharSize; // db ? ; character cell width in pixels + UCHAR YCharSize; // db ? ; character cell height in pixels + UCHAR NumberOfPlanes; // db ? ; number of memory planes + UCHAR BitsPerPixel; // db ? ; bits per pixel + UCHAR NumberOfBanks; // db ? ; number of banks + UCHAR MemoryModel; // db ? ; memory model type + UCHAR BankSize; // db ? ; bank size in KB + UCHAR NumberOfImagePages;// db ? ; number of images + UCHAR ReservedForPageFunction;//db 1 ; reserved for page function + +//; Direct Color fields(required for direct/6 and YUV/7 memory models) + UCHAR RedMaskSize; // db ? ; size of direct color red mask in bits + UCHAR RedFieldPosition; // db ? ; bit position of lsb of red mask + UCHAR GreenMaskSize; // db ? ; size of direct color green mask in bits + UCHAR GreenFieldPosition; // db ? ; bit position of lsb of green mask + UCHAR BlueMaskSize; // db ? ; size of direct color blue mask in bits + UCHAR BlueFieldPosition; // db ? ; bit position of lsb of blue mask + UCHAR RsvdMaskSize; // db ? ; size of direct color reserved mask in bits + UCHAR RsvdFieldPosition; // db ? ; bit position of lsb of reserved mask + UCHAR DirectColorModeInfo;// db ? ; direct color mode attributes + +//; Mandatory information for VBE 2.0 and above + ULONG PhysBasePtr; // dd ? ; physical address for flat memory frame buffer + ULONG Reserved_1; // dd 0 ; reserved - always set to 0 + USHORT Reserved_2; // dw 0 ; reserved - always set to 0 + +//; Mandatory information for VBE 3.0 and above + USHORT LinBytesPerScanLine; // dw ? ; bytes per scan line for linear modes + UCHAR BnkNumberOfImagePages;// db ? ; number of images for banked modes + UCHAR LinNumberOfImagPages; // db ? ; number of images for linear modes + UCHAR LinRedMaskSize; // db ? ; size of direct color red mask(linear modes) + UCHAR LinRedFieldPosition; // db ? ; bit position of lsb of red mask(linear modes) + UCHAR LinGreenMaskSize; // db ? ; size of direct color green mask(linear modes) + UCHAR LinGreenFieldPosition;// db ? ; bit position of lsb of green mask(linear modes) + UCHAR LinBlueMaskSize; // db ? ; size of direct color blue mask(linear modes) + UCHAR LinBlueFieldPosition; // db ? ; bit position of lsb of blue mask(linear modes) + UCHAR LinRsvdMaskSize; // db ? ; size of direct color reserved mask(linear modes) + UCHAR LinRsvdFieldPosition; // db ? ; bit position of lsb of reserved mask(linear modes) + ULONG MaxPixelClock; // dd ? ; maximum pixel clock(in Hz) for graphics mode + UCHAR Reserved; // db 190 dup (0) +} VESA_MODE_INFO_BLOCK; + +// BIOS function CALLS +#define ATOM_BIOS_EXTENDED_FUNCTION_CODE 0xA0 // ATI Extended Function code +#define ATOM_BIOS_FUNCTION_COP_MODE 0x00 +#define ATOM_BIOS_FUNCTION_SHORT_QUERY1 0x04 +#define ATOM_BIOS_FUNCTION_SHORT_QUERY2 0x05 +#define ATOM_BIOS_FUNCTION_SHORT_QUERY3 0x06 +#define ATOM_BIOS_FUNCTION_GET_DDC 0x0B +#define ATOM_BIOS_FUNCTION_ASIC_DSTATE 0x0E +#define ATOM_BIOS_FUNCTION_DEBUG_PLAY 0x0F +#define ATOM_BIOS_FUNCTION_STV_STD 0x16 +#define ATOM_BIOS_FUNCTION_DEVICE_DET 0x17 +#define ATOM_BIOS_FUNCTION_DEVICE_SWITCH 0x18 + +#define ATOM_BIOS_FUNCTION_PANEL_CONTROL 0x82 +#define ATOM_BIOS_FUNCTION_OLD_DEVICE_DET 0x83 +#define ATOM_BIOS_FUNCTION_OLD_DEVICE_SWITCH 0x84 +#define ATOM_BIOS_FUNCTION_HW_ICON 0x8A +#define ATOM_BIOS_FUNCTION_SET_CMOS 0x8B +#define SUB_FUNCTION_UPDATE_DISPLAY_INFO 0x8000 // Sub function 80 +#define SUB_FUNCTION_UPDATE_EXPANSION_INFO 0x8100 // Sub function 80 + +#define ATOM_BIOS_FUNCTION_DISPLAY_INFO 0x8D +#define ATOM_BIOS_FUNCTION_DEVICE_ON_OFF 0x8E +#define ATOM_BIOS_FUNCTION_VIDEO_STATE 0x8F +#define ATOM_SUB_FUNCTION_GET_CRITICAL_STATE 0x0300 // Sub function 03 +#define ATOM_SUB_FUNCTION_GET_LIDSTATE 0x0700 // Sub function 7 +#define ATOM_SUB_FUNCTION_THERMAL_STATE_NOTICE 0x1400 // Notify caller the current thermal state +#define ATOM_SUB_FUNCTION_CRITICAL_STATE_NOTICE 0x8300 // Notify caller the current critical state +#define ATOM_SUB_FUNCTION_SET_LIDSTATE 0x8500 // Sub function 85 +#define ATOM_SUB_FUNCTION_GET_REQ_DISPLAY_FROM_SBIOS_MODE 0x8900// Sub function 89 +#define ATOM_SUB_FUNCTION_INFORM_ADC_SUPPORT 0x9400 // Notify caller that ADC is supported + + +#define ATOM_BIOS_FUNCTION_VESA_DPMS 0x4F10 // Set DPMS +#define ATOM_SUB_FUNCTION_SET_DPMS 0x0001 // BL: Sub function 01 +#define ATOM_SUB_FUNCTION_GET_DPMS 0x0002 // BL: Sub function 02 +#define ATOM_PARAMETER_VESA_DPMS_ON 0x0000 // BH Parameter for DPMS ON. +#define ATOM_PARAMETER_VESA_DPMS_STANDBY 0x0100 // BH Parameter for DPMS STANDBY +#define ATOM_PARAMETER_VESA_DPMS_SUSPEND 0x0200 // BH Parameter for DPMS SUSPEND +#define ATOM_PARAMETER_VESA_DPMS_OFF 0x0400 // BH Parameter for DPMS OFF +#define ATOM_PARAMETER_VESA_DPMS_REDUCE_ON 0x0800 // BH Parameter for DPMS REDUCE ON (NOT SUPPORTED) + +#define ATOM_BIOS_RETURN_CODE_MASK 0x0000FF00L +#define ATOM_BIOS_REG_HIGH_MASK 0x0000FF00L +#define ATOM_BIOS_REG_LOW_MASK 0x000000FFL + +// structure used for VBIOS only + +//DispOutInfoTable +typedef struct _ASIC_TRANSMITTER_INFO +{ + USHORT usTransmitterObjId; + USHORT usSupportDevice; + UCHAR ucTransmitterCmdTblId; + UCHAR ucConfig; + UCHAR ucEncoderID; //available 1st encoder ( default ) + UCHAR ucOptionEncoderID; //available 2nd encoder ( optional ) + UCHAR uc2ndEncoderID; + UCHAR ucReserved; +}ASIC_TRANSMITTER_INFO; + +#define ASIC_TRANSMITTER_INFO_CONFIG__DVO_SDR_MODE 0x01 +#define ASIC_TRANSMITTER_INFO_CONFIG__COHERENT_MODE 0x02 +#define ASIC_TRANSMITTER_INFO_CONFIG__ENCODEROBJ_ID_MASK 0xc4 +#define ASIC_TRANSMITTER_INFO_CONFIG__ENCODER_A 0x00 +#define ASIC_TRANSMITTER_INFO_CONFIG__ENCODER_B 0x04 +#define ASIC_TRANSMITTER_INFO_CONFIG__ENCODER_C 0x40 +#define ASIC_TRANSMITTER_INFO_CONFIG__ENCODER_D 0x44 +#define ASIC_TRANSMITTER_INFO_CONFIG__ENCODER_E 0x80 +#define ASIC_TRANSMITTER_INFO_CONFIG__ENCODER_F 0x84 + +typedef struct _ASIC_ENCODER_INFO +{ + UCHAR ucEncoderID; + UCHAR ucEncoderConfig; + USHORT usEncoderCmdTblId; +}ASIC_ENCODER_INFO; + +typedef struct _ATOM_DISP_OUT_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT ptrTransmitterInfo; + USHORT ptrEncoderInfo; + ASIC_TRANSMITTER_INFO asTransmitterInfo[1]; + ASIC_ENCODER_INFO asEncoderInfo[1]; +}ATOM_DISP_OUT_INFO; + +typedef struct _ATOM_DISP_OUT_INFO_V2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT ptrTransmitterInfo; + USHORT ptrEncoderInfo; + USHORT ptrMainCallParserFar; // direct address of main parser call in VBIOS binary. + ASIC_TRANSMITTER_INFO asTransmitterInfo[1]; + ASIC_ENCODER_INFO asEncoderInfo[1]; +}ATOM_DISP_OUT_INFO_V2; + +// DispDevicePriorityInfo +typedef struct _ATOM_DISPLAY_DEVICE_PRIORITY_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT asDevicePriority[16]; +}ATOM_DISPLAY_DEVICE_PRIORITY_INFO; + +//ProcessAuxChannelTransactionTable +typedef struct _PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS +{ + USHORT lpAuxRequest; + USHORT lpDataOut; + UCHAR ucChannelID; + union + { + UCHAR ucReplyStatus; + UCHAR ucDelay; + }; + UCHAR ucDataOutLen; + UCHAR ucReserved; +}PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS; + +//ProcessAuxChannelTransactionTable +typedef struct _PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2 +{ + USHORT lpAuxRequest; + USHORT lpDataOut; + UCHAR ucChannelID; + union + { + UCHAR ucReplyStatus; + UCHAR ucDelay; + }; + UCHAR ucDataOutLen; + UCHAR ucHPD_ID; //=0: HPD1, =1: HPD2, =2: HPD3, =3: HPD4, =4: HPD5, =5: HPD6 +}PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2; + +#define PROCESS_AUX_CHANNEL_TRANSACTION_PS_ALLOCATION PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS + +//GetSinkType + +typedef struct _DP_ENCODER_SERVICE_PARAMETERS +{ + USHORT ucLinkClock; + union + { + UCHAR ucConfig; // for DP training command + UCHAR ucI2cId; // use for GET_SINK_TYPE command + }; + UCHAR ucAction; + UCHAR ucStatus; + UCHAR ucLaneNum; + UCHAR ucReserved[2]; +}DP_ENCODER_SERVICE_PARAMETERS; + +// ucAction +#define ATOM_DP_ACTION_GET_SINK_TYPE 0x01 +/* obselete */ +#define ATOM_DP_ACTION_TRAINING_START 0x02 +#define ATOM_DP_ACTION_TRAINING_COMPLETE 0x03 +#define ATOM_DP_ACTION_TRAINING_PATTERN_SEL 0x04 +#define ATOM_DP_ACTION_SET_VSWING_PREEMP 0x05 +#define ATOM_DP_ACTION_GET_VSWING_PREEMP 0x06 +#define ATOM_DP_ACTION_BLANKING 0x07 + +// ucConfig +#define ATOM_DP_CONFIG_ENCODER_SEL_MASK 0x03 +#define ATOM_DP_CONFIG_DIG1_ENCODER 0x00 +#define ATOM_DP_CONFIG_DIG2_ENCODER 0x01 +#define ATOM_DP_CONFIG_EXTERNAL_ENCODER 0x02 +#define ATOM_DP_CONFIG_LINK_SEL_MASK 0x04 +#define ATOM_DP_CONFIG_LINK_A 0x00 +#define ATOM_DP_CONFIG_LINK_B 0x04 +/* /obselete */ +#define DP_ENCODER_SERVICE_PS_ALLOCATION WRITE_ONE_BYTE_HW_I2C_DATA_PARAMETERS + + +typedef struct _DP_ENCODER_SERVICE_PARAMETERS_V2 +{ + USHORT usExtEncoderObjId; // External Encoder Object Id, output parameter only, use when ucAction = DP_SERVICE_V2_ACTION_DET_EXT_CONNECTION + UCHAR ucAuxId; + UCHAR ucAction; + UCHAR ucSinkType; // Iput and Output parameters. + UCHAR ucHPDId; // Input parameter, used when ucAction = DP_SERVICE_V2_ACTION_DET_EXT_CONNECTION + UCHAR ucReserved[2]; +}DP_ENCODER_SERVICE_PARAMETERS_V2; + +typedef struct _DP_ENCODER_SERVICE_PS_ALLOCATION_V2 +{ + DP_ENCODER_SERVICE_PARAMETERS_V2 asDPServiceParam; + PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2 asAuxParam; +}DP_ENCODER_SERVICE_PS_ALLOCATION_V2; + +// ucAction +#define DP_SERVICE_V2_ACTION_GET_SINK_TYPE 0x01 +#define DP_SERVICE_V2_ACTION_DET_LCD_CONNECTION 0x02 + + +// DP_TRAINING_TABLE +#define DPCD_SET_LINKRATE_LANENUM_PATTERN1_TBL_ADDR ATOM_DP_TRAINING_TBL_ADDR +#define DPCD_SET_SS_CNTL_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 8 ) +#define DPCD_SET_LANE_VSWING_PREEMP_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 16 ) +#define DPCD_SET_TRAINING_PATTERN0_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 24 ) +#define DPCD_SET_TRAINING_PATTERN2_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 32) +#define DPCD_GET_LINKRATE_LANENUM_SS_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 40) +#define DPCD_GET_LANE_STATUS_ADJUST_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 48) +#define DP_I2C_AUX_DDC_WRITE_START_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 60) +#define DP_I2C_AUX_DDC_WRITE_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 64) +#define DP_I2C_AUX_DDC_READ_START_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 72) +#define DP_I2C_AUX_DDC_READ_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 76) +#define DP_I2C_AUX_DDC_WRITE_END_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 80) +#define DP_I2C_AUX_DDC_READ_END_TBL_ADDR (ATOM_DP_TRAINING_TBL_ADDR + 84) + +typedef struct _PROCESS_I2C_CHANNEL_TRANSACTION_PARAMETERS +{ + UCHAR ucI2CSpeed; + union + { + UCHAR ucRegIndex; + UCHAR ucStatus; + }; + USHORT lpI2CDataOut; + UCHAR ucFlag; + UCHAR ucTransBytes; + UCHAR ucSlaveAddr; + UCHAR ucLineNumber; +}PROCESS_I2C_CHANNEL_TRANSACTION_PARAMETERS; + +#define PROCESS_I2C_CHANNEL_TRANSACTION_PS_ALLOCATION PROCESS_I2C_CHANNEL_TRANSACTION_PARAMETERS + +//ucFlag +#define HW_I2C_WRITE 1 +#define HW_I2C_READ 0 +#define I2C_2BYTE_ADDR 0x02 + +typedef struct _SET_HWBLOCK_INSTANCE_PARAMETER_V2 +{ + UCHAR ucHWBlkInst; // HW block instance, 0, 1, 2, ... + UCHAR ucReserved[3]; +}SET_HWBLOCK_INSTANCE_PARAMETER_V2; + +#define HWBLKINST_INSTANCE_MASK 0x07 +#define HWBLKINST_HWBLK_MASK 0xF0 +#define HWBLKINST_HWBLK_SHIFT 0x04 + +//ucHWBlock +#define SELECT_DISP_ENGINE 0 +#define SELECT_DISP_PLL 1 +#define SELECT_DCIO_UNIPHY_LINK0 2 +#define SELECT_DCIO_UNIPHY_LINK1 3 +#define SELECT_DCIO_IMPCAL 4 +#define SELECT_DCIO_DIG 6 +#define SELECT_CRTC_PIXEL_RATE 7 +#define SELECT_VGA_BLK 8 + +/****************************************************************************/ +//Portion VI: Definitinos for vbios MC scratch registers that driver used +/****************************************************************************/ + +#define MC_MISC0__MEMORY_TYPE_MASK 0xF0000000 +#define MC_MISC0__MEMORY_TYPE__GDDR1 0x10000000 +#define MC_MISC0__MEMORY_TYPE__DDR2 0x20000000 +#define MC_MISC0__MEMORY_TYPE__GDDR3 0x30000000 +#define MC_MISC0__MEMORY_TYPE__GDDR4 0x40000000 +#define MC_MISC0__MEMORY_TYPE__GDDR5 0x50000000 +#define MC_MISC0__MEMORY_TYPE__DDR3 0xB0000000 + +/****************************************************************************/ +//Portion VI: Definitinos being oboselete +/****************************************************************************/ + +//========================================================================================== +//Remove the definitions below when driver is ready! +typedef struct _ATOM_DAC_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usMaxFrequency; // in 10kHz unit + USHORT usReserved; +}ATOM_DAC_INFO; + + +typedef struct _COMPASSIONATE_DATA +{ + ATOM_COMMON_TABLE_HEADER sHeader; + + //============================== DAC1 portion + UCHAR ucDAC1_BG_Adjustment; + UCHAR ucDAC1_DAC_Adjustment; + USHORT usDAC1_FORCE_Data; + //============================== DAC2 portion + UCHAR ucDAC2_CRT2_BG_Adjustment; + UCHAR ucDAC2_CRT2_DAC_Adjustment; + USHORT usDAC2_CRT2_FORCE_Data; + USHORT usDAC2_CRT2_MUX_RegisterIndex; + UCHAR ucDAC2_CRT2_MUX_RegisterInfo; //Bit[4:0]=Bit position,Bit[7]=1:Active High;=0 Active Low + UCHAR ucDAC2_NTSC_BG_Adjustment; + UCHAR ucDAC2_NTSC_DAC_Adjustment; + USHORT usDAC2_TV1_FORCE_Data; + USHORT usDAC2_TV1_MUX_RegisterIndex; + UCHAR ucDAC2_TV1_MUX_RegisterInfo; //Bit[4:0]=Bit position,Bit[7]=1:Active High;=0 Active Low + UCHAR ucDAC2_CV_BG_Adjustment; + UCHAR ucDAC2_CV_DAC_Adjustment; + USHORT usDAC2_CV_FORCE_Data; + USHORT usDAC2_CV_MUX_RegisterIndex; + UCHAR ucDAC2_CV_MUX_RegisterInfo; //Bit[4:0]=Bit position,Bit[7]=1:Active High;=0 Active Low + UCHAR ucDAC2_PAL_BG_Adjustment; + UCHAR ucDAC2_PAL_DAC_Adjustment; + USHORT usDAC2_TV2_FORCE_Data; +}COMPASSIONATE_DATA; + +/****************************Supported Device Info Table Definitions**********************/ +// ucConnectInfo: +// [7:4] - connector type +// = 1 - VGA connector +// = 2 - DVI-I +// = 3 - DVI-D +// = 4 - DVI-A +// = 5 - SVIDEO +// = 6 - COMPOSITE +// = 7 - LVDS +// = 8 - DIGITAL LINK +// = 9 - SCART +// = 0xA - HDMI_type A +// = 0xB - HDMI_type B +// = 0xE - Special case1 (DVI+DIN) +// Others=TBD +// [3:0] - DAC Associated +// = 0 - no DAC +// = 1 - DACA +// = 2 - DACB +// = 3 - External DAC +// Others=TBD +// + +typedef struct _ATOM_CONNECTOR_INFO +{ +#if ATOM_BIG_ENDIAN + UCHAR bfConnectorType:4; + UCHAR bfAssociatedDAC:4; +#else + UCHAR bfAssociatedDAC:4; + UCHAR bfConnectorType:4; +#endif +}ATOM_CONNECTOR_INFO; + +typedef union _ATOM_CONNECTOR_INFO_ACCESS +{ + ATOM_CONNECTOR_INFO sbfAccess; + UCHAR ucAccess; +}ATOM_CONNECTOR_INFO_ACCESS; + +typedef struct _ATOM_CONNECTOR_INFO_I2C +{ + ATOM_CONNECTOR_INFO_ACCESS sucConnectorInfo; + ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; +}ATOM_CONNECTOR_INFO_I2C; + + +typedef struct _ATOM_SUPPORTED_DEVICES_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usDeviceSupport; + ATOM_CONNECTOR_INFO_I2C asConnInfo[ATOM_MAX_SUPPORTED_DEVICE_INFO]; +}ATOM_SUPPORTED_DEVICES_INFO; + +#define NO_INT_SRC_MAPPED 0xFF + +typedef struct _ATOM_CONNECTOR_INC_SRC_BITMAP +{ + UCHAR ucIntSrcBitmap; +}ATOM_CONNECTOR_INC_SRC_BITMAP; + +typedef struct _ATOM_SUPPORTED_DEVICES_INFO_2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usDeviceSupport; + ATOM_CONNECTOR_INFO_I2C asConnInfo[ATOM_MAX_SUPPORTED_DEVICE_INFO_2]; + ATOM_CONNECTOR_INC_SRC_BITMAP asIntSrcInfo[ATOM_MAX_SUPPORTED_DEVICE_INFO_2]; +}ATOM_SUPPORTED_DEVICES_INFO_2; + +typedef struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usDeviceSupport; + ATOM_CONNECTOR_INFO_I2C asConnInfo[ATOM_MAX_SUPPORTED_DEVICE]; + ATOM_CONNECTOR_INC_SRC_BITMAP asIntSrcInfo[ATOM_MAX_SUPPORTED_DEVICE]; +}ATOM_SUPPORTED_DEVICES_INFO_2d1; + +#define ATOM_SUPPORTED_DEVICES_INFO_LAST ATOM_SUPPORTED_DEVICES_INFO_2d1 + + + +typedef struct _ATOM_MISC_CONTROL_INFO +{ + USHORT usFrequency; + UCHAR ucPLL_ChargePump; // PLL charge-pump gain control + UCHAR ucPLL_DutyCycle; // PLL duty cycle control + UCHAR ucPLL_VCO_Gain; // PLL VCO gain control + UCHAR ucPLL_VoltageSwing; // PLL driver voltage swing control +}ATOM_MISC_CONTROL_INFO; + + +#define ATOM_MAX_MISC_INFO 4 + +typedef struct _ATOM_TMDS_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usMaxFrequency; // in 10Khz + ATOM_MISC_CONTROL_INFO asMiscInfo[ATOM_MAX_MISC_INFO]; +}ATOM_TMDS_INFO; + + +typedef struct _ATOM_ENCODER_ANALOG_ATTRIBUTE +{ + UCHAR ucTVStandard; //Same as TV standards defined above, + UCHAR ucPadding[1]; +}ATOM_ENCODER_ANALOG_ATTRIBUTE; + +typedef struct _ATOM_ENCODER_DIGITAL_ATTRIBUTE +{ + UCHAR ucAttribute; //Same as other digital encoder attributes defined above + UCHAR ucPadding[1]; +}ATOM_ENCODER_DIGITAL_ATTRIBUTE; + +typedef union _ATOM_ENCODER_ATTRIBUTE +{ + ATOM_ENCODER_ANALOG_ATTRIBUTE sAlgAttrib; + ATOM_ENCODER_DIGITAL_ATTRIBUTE sDigAttrib; +}ATOM_ENCODER_ATTRIBUTE; + + +typedef struct _DVO_ENCODER_CONTROL_PARAMETERS +{ + USHORT usPixelClock; + USHORT usEncoderID; + UCHAR ucDeviceType; //Use ATOM_DEVICE_xxx1_Index to indicate device type only. + UCHAR ucAction; //ATOM_ENABLE/ATOM_DISABLE/ATOM_HPD_INIT + ATOM_ENCODER_ATTRIBUTE usDevAttr; +}DVO_ENCODER_CONTROL_PARAMETERS; + +typedef struct _DVO_ENCODER_CONTROL_PS_ALLOCATION +{ + DVO_ENCODER_CONTROL_PARAMETERS sDVOEncoder; + WRITE_ONE_BYTE_HW_I2C_DATA_PS_ALLOCATION sReserved; //Caller doesn't need to init this portion +}DVO_ENCODER_CONTROL_PS_ALLOCATION; + + +#define ATOM_XTMDS_ASIC_SI164_ID 1 +#define ATOM_XTMDS_ASIC_SI178_ID 2 +#define ATOM_XTMDS_ASIC_TFP513_ID 3 +#define ATOM_XTMDS_SUPPORTED_SINGLELINK 0x00000001 +#define ATOM_XTMDS_SUPPORTED_DUALLINK 0x00000002 +#define ATOM_XTMDS_MVPU_FPGA 0x00000004 + + +typedef struct _ATOM_XTMDS_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + USHORT usSingleLinkMaxFrequency; + ATOM_I2C_ID_CONFIG_ACCESS sucI2cId; //Point the ID on which I2C is used to control external chip + UCHAR ucXtransimitterID; + UCHAR ucSupportedLink; // Bit field, bit0=1, single link supported;bit1=1,dual link supported + UCHAR ucSequnceAlterID; // Even with the same external TMDS asic, it's possible that the program seqence alters + // due to design. This ID is used to alert driver that the sequence is not "standard"! + UCHAR ucMasterAddress; // Address to control Master xTMDS Chip + UCHAR ucSlaveAddress; // Address to control Slave xTMDS Chip +}ATOM_XTMDS_INFO; + +typedef struct _DFP_DPMS_STATUS_CHANGE_PARAMETERS +{ + UCHAR ucEnable; // ATOM_ENABLE=On or ATOM_DISABLE=Off + UCHAR ucDevice; // ATOM_DEVICE_DFP1_INDEX.... + UCHAR ucPadding[2]; +}DFP_DPMS_STATUS_CHANGE_PARAMETERS; + +/****************************Legacy Power Play Table Definitions **********************/ + +//Definitions for ulPowerPlayMiscInfo +#define ATOM_PM_MISCINFO_SPLIT_CLOCK 0x00000000L +#define ATOM_PM_MISCINFO_USING_MCLK_SRC 0x00000001L +#define ATOM_PM_MISCINFO_USING_SCLK_SRC 0x00000002L + +#define ATOM_PM_MISCINFO_VOLTAGE_DROP_SUPPORT 0x00000004L +#define ATOM_PM_MISCINFO_VOLTAGE_DROP_ACTIVE_HIGH 0x00000008L + +#define ATOM_PM_MISCINFO_LOAD_PERFORMANCE_EN 0x00000010L + +#define ATOM_PM_MISCINFO_ENGINE_CLOCK_CONTRL_EN 0x00000020L +#define ATOM_PM_MISCINFO_MEMORY_CLOCK_CONTRL_EN 0x00000040L +#define ATOM_PM_MISCINFO_PROGRAM_VOLTAGE 0x00000080L //When this bit set, ucVoltageDropIndex is not an index for GPIO pin, but a voltage ID that SW needs program + +#define ATOM_PM_MISCINFO_ASIC_REDUCED_SPEED_SCLK_EN 0x00000100L +#define ATOM_PM_MISCINFO_ASIC_DYNAMIC_VOLTAGE_EN 0x00000200L +#define ATOM_PM_MISCINFO_ASIC_SLEEP_MODE_EN 0x00000400L +#define ATOM_PM_MISCINFO_LOAD_BALANCE_EN 0x00000800L +#define ATOM_PM_MISCINFO_DEFAULT_DC_STATE_ENTRY_TRUE 0x00001000L +#define ATOM_PM_MISCINFO_DEFAULT_LOW_DC_STATE_ENTRY_TRUE 0x00002000L +#define ATOM_PM_MISCINFO_LOW_LCD_REFRESH_RATE 0x00004000L + +#define ATOM_PM_MISCINFO_DRIVER_DEFAULT_MODE 0x00008000L +#define ATOM_PM_MISCINFO_OVER_CLOCK_MODE 0x00010000L +#define ATOM_PM_MISCINFO_OVER_DRIVE_MODE 0x00020000L +#define ATOM_PM_MISCINFO_POWER_SAVING_MODE 0x00040000L +#define ATOM_PM_MISCINFO_THERMAL_DIODE_MODE 0x00080000L + +#define ATOM_PM_MISCINFO_FRAME_MODULATION_MASK 0x00300000L //0-FM Disable, 1-2 level FM, 2-4 level FM, 3-Reserved +#define ATOM_PM_MISCINFO_FRAME_MODULATION_SHIFT 20 + +#define ATOM_PM_MISCINFO_DYN_CLK_3D_IDLE 0x00400000L +#define ATOM_PM_MISCINFO_DYNAMIC_CLOCK_DIVIDER_BY_2 0x00800000L +#define ATOM_PM_MISCINFO_DYNAMIC_CLOCK_DIVIDER_BY_4 0x01000000L +#define ATOM_PM_MISCINFO_DYNAMIC_HDP_BLOCK_EN 0x02000000L //When set, Dynamic +#define ATOM_PM_MISCINFO_DYNAMIC_MC_HOST_BLOCK_EN 0x04000000L //When set, Dynamic +#define ATOM_PM_MISCINFO_3D_ACCELERATION_EN 0x08000000L //When set, This mode is for acceleated 3D mode + +#define ATOM_PM_MISCINFO_POWERPLAY_SETTINGS_GROUP_MASK 0x70000000L //1-Optimal Battery Life Group, 2-High Battery, 3-Balanced, 4-High Performance, 5- Optimal Performance (Default state with Default clocks) +#define ATOM_PM_MISCINFO_POWERPLAY_SETTINGS_GROUP_SHIFT 28 +#define ATOM_PM_MISCINFO_ENABLE_BACK_BIAS 0x80000000L + +#define ATOM_PM_MISCINFO2_SYSTEM_AC_LITE_MODE 0x00000001L +#define ATOM_PM_MISCINFO2_MULTI_DISPLAY_SUPPORT 0x00000002L +#define ATOM_PM_MISCINFO2_DYNAMIC_BACK_BIAS_EN 0x00000004L +#define ATOM_PM_MISCINFO2_FS3D_OVERDRIVE_INFO 0x00000008L +#define ATOM_PM_MISCINFO2_FORCEDLOWPWR_MODE 0x00000010L +#define ATOM_PM_MISCINFO2_VDDCI_DYNAMIC_VOLTAGE_EN 0x00000020L +#define ATOM_PM_MISCINFO2_VIDEO_PLAYBACK_CAPABLE 0x00000040L //If this bit is set in multi-pp mode, then driver will pack up one with the minior power consumption. + //If it's not set in any pp mode, driver will use its default logic to pick a pp mode in video playback +#define ATOM_PM_MISCINFO2_NOT_VALID_ON_DC 0x00000080L +#define ATOM_PM_MISCINFO2_STUTTER_MODE_EN 0x00000100L +#define ATOM_PM_MISCINFO2_UVD_SUPPORT_MODE 0x00000200L + +//ucTableFormatRevision=1 +//ucTableContentRevision=1 +typedef struct _ATOM_POWERMODE_INFO +{ + ULONG ulMiscInfo; //The power level should be arranged in ascending order + ULONG ulReserved1; // must set to 0 + ULONG ulReserved2; // must set to 0 + USHORT usEngineClock; + USHORT usMemoryClock; + UCHAR ucVoltageDropIndex; // index to GPIO table + UCHAR ucSelectedPanel_RefreshRate;// panel refresh rate + UCHAR ucMinTemperature; + UCHAR ucMaxTemperature; + UCHAR ucNumPciELanes; // number of PCIE lanes +}ATOM_POWERMODE_INFO; + +//ucTableFormatRevision=2 +//ucTableContentRevision=1 +typedef struct _ATOM_POWERMODE_INFO_V2 +{ + ULONG ulMiscInfo; //The power level should be arranged in ascending order + ULONG ulMiscInfo2; + ULONG ulEngineClock; + ULONG ulMemoryClock; + UCHAR ucVoltageDropIndex; // index to GPIO table + UCHAR ucSelectedPanel_RefreshRate;// panel refresh rate + UCHAR ucMinTemperature; + UCHAR ucMaxTemperature; + UCHAR ucNumPciELanes; // number of PCIE lanes +}ATOM_POWERMODE_INFO_V2; + +//ucTableFormatRevision=2 +//ucTableContentRevision=2 +typedef struct _ATOM_POWERMODE_INFO_V3 +{ + ULONG ulMiscInfo; //The power level should be arranged in ascending order + ULONG ulMiscInfo2; + ULONG ulEngineClock; + ULONG ulMemoryClock; + UCHAR ucVoltageDropIndex; // index to Core (VDDC) votage table + UCHAR ucSelectedPanel_RefreshRate;// panel refresh rate + UCHAR ucMinTemperature; + UCHAR ucMaxTemperature; + UCHAR ucNumPciELanes; // number of PCIE lanes + UCHAR ucVDDCI_VoltageDropIndex; // index to VDDCI votage table +}ATOM_POWERMODE_INFO_V3; + + +#define ATOM_MAX_NUMBEROF_POWER_BLOCK 8 + +#define ATOM_PP_OVERDRIVE_INTBITMAP_AUXWIN 0x01 +#define ATOM_PP_OVERDRIVE_INTBITMAP_OVERDRIVE 0x02 + +#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_LM63 0x01 +#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_ADM1032 0x02 +#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_ADM1030 0x03 +#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_MUA6649 0x04 +#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_LM64 0x05 +#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_F75375 0x06 +#define ATOM_PP_OVERDRIVE_THERMALCONTROLLER_ASC7512 0x07 // Andigilog + + +typedef struct _ATOM_POWERPLAY_INFO +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucOverdriveThermalController; + UCHAR ucOverdriveI2cLine; + UCHAR ucOverdriveIntBitmap; + UCHAR ucOverdriveControllerAddress; + UCHAR ucSizeOfPowerModeEntry; + UCHAR ucNumOfPowerModeEntries; + ATOM_POWERMODE_INFO asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; +}ATOM_POWERPLAY_INFO; + +typedef struct _ATOM_POWERPLAY_INFO_V2 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucOverdriveThermalController; + UCHAR ucOverdriveI2cLine; + UCHAR ucOverdriveIntBitmap; + UCHAR ucOverdriveControllerAddress; + UCHAR ucSizeOfPowerModeEntry; + UCHAR ucNumOfPowerModeEntries; + ATOM_POWERMODE_INFO_V2 asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; +}ATOM_POWERPLAY_INFO_V2; + +typedef struct _ATOM_POWERPLAY_INFO_V3 +{ + ATOM_COMMON_TABLE_HEADER sHeader; + UCHAR ucOverdriveThermalController; + UCHAR ucOverdriveI2cLine; + UCHAR ucOverdriveIntBitmap; + UCHAR ucOverdriveControllerAddress; + UCHAR ucSizeOfPowerModeEntry; + UCHAR ucNumOfPowerModeEntries; + ATOM_POWERMODE_INFO_V3 asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; +}ATOM_POWERPLAY_INFO_V3; + +/* New PPlib */ +/**************************************************************************/ +typedef struct _ATOM_PPLIB_THERMALCONTROLLER + +{ + UCHAR ucType; // one of ATOM_PP_THERMALCONTROLLER_* + UCHAR ucI2cLine; // as interpreted by DAL I2C + UCHAR ucI2cAddress; + UCHAR ucFanParameters; // Fan Control Parameters. + UCHAR ucFanMinRPM; // Fan Minimum RPM (hundreds) -- for display purposes only. + UCHAR ucFanMaxRPM; // Fan Maximum RPM (hundreds) -- for display purposes only. + UCHAR ucReserved; // ---- + UCHAR ucFlags; // to be defined +} ATOM_PPLIB_THERMALCONTROLLER; + +#define ATOM_PP_FANPARAMETERS_TACHOMETER_PULSES_PER_REVOLUTION_MASK 0x0f +#define ATOM_PP_FANPARAMETERS_NOFAN 0x80 // No fan is connected to this controller. + +#define ATOM_PP_THERMALCONTROLLER_NONE 0 +#define ATOM_PP_THERMALCONTROLLER_LM63 1 // Not used by PPLib +#define ATOM_PP_THERMALCONTROLLER_ADM1032 2 // Not used by PPLib +#define ATOM_PP_THERMALCONTROLLER_ADM1030 3 // Not used by PPLib +#define ATOM_PP_THERMALCONTROLLER_MUA6649 4 // Not used by PPLib +#define ATOM_PP_THERMALCONTROLLER_LM64 5 +#define ATOM_PP_THERMALCONTROLLER_F75375 6 // Not used by PPLib +#define ATOM_PP_THERMALCONTROLLER_RV6xx 7 +#define ATOM_PP_THERMALCONTROLLER_RV770 8 +#define ATOM_PP_THERMALCONTROLLER_ADT7473 9 +#define ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO 11 +#define ATOM_PP_THERMALCONTROLLER_EVERGREEN 12 +#define ATOM_PP_THERMALCONTROLLER_EMC2103 13 /* 0x0D */ // Only fan control will be implemented, do NOT show this in PPGen. +#define ATOM_PP_THERMALCONTROLLER_SUMO 14 /* 0x0E */ // Sumo type, used internally +#define ATOM_PP_THERMALCONTROLLER_NISLANDS 15 + +// Thermal controller 'combo type' to use an external controller for Fan control and an internal controller for thermal. +// We probably should reserve the bit 0x80 for this use. +// To keep the number of these types low we should also use the same code for all ASICs (i.e. do not distinguish RV6xx and RV7xx Internal here). +// The driver can pick the correct internal controller based on the ASIC. + +#define ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL 0x89 // ADT7473 Fan Control + Internal Thermal Controller +#define ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL 0x8D // EMC2103 Fan Control + Internal Thermal Controller + +typedef struct _ATOM_PPLIB_STATE +{ + UCHAR ucNonClockStateIndex; + UCHAR ucClockStateIndices[1]; // variable-sized +} ATOM_PPLIB_STATE; + +typedef struct _ATOM_PPLIB_FANTABLE +{ + UCHAR ucFanTableFormat; // Change this if the table format changes or version changes so that the other fields are not the same. + UCHAR ucTHyst; // Temperature hysteresis. Integer. + USHORT usTMin; // The temperature, in 0.01 centigrades, below which we just run at a minimal PWM. + USHORT usTMed; // The middle temperature where we change slopes. + USHORT usTHigh; // The high point above TMed for adjusting the second slope. + USHORT usPWMMin; // The minimum PWM value in percent (0.01% increments). + USHORT usPWMMed; // The PWM value (in percent) at TMed. + USHORT usPWMHigh; // The PWM value at THigh. +} ATOM_PPLIB_FANTABLE; + +typedef struct _ATOM_PPLIB_EXTENDEDHEADER +{ + USHORT usSize; + ULONG ulMaxEngineClock; // For Overdrive. + ULONG ulMaxMemoryClock; // For Overdrive. + // Add extra system parameters here, always adjust size to include all fields. +} ATOM_PPLIB_EXTENDEDHEADER; + +//// ATOM_PPLIB_POWERPLAYTABLE::ulPlatformCaps +#define ATOM_PP_PLATFORM_CAP_BACKBIAS 1 +#define ATOM_PP_PLATFORM_CAP_POWERPLAY 2 +#define ATOM_PP_PLATFORM_CAP_SBIOSPOWERSOURCE 4 +#define ATOM_PP_PLATFORM_CAP_ASPM_L0s 8 +#define ATOM_PP_PLATFORM_CAP_ASPM_L1 16 +#define ATOM_PP_PLATFORM_CAP_HARDWAREDC 32 +#define ATOM_PP_PLATFORM_CAP_GEMINIPRIMARY 64 +#define ATOM_PP_PLATFORM_CAP_STEPVDDC 128 +#define ATOM_PP_PLATFORM_CAP_VOLTAGECONTROL 256 +#define ATOM_PP_PLATFORM_CAP_SIDEPORTCONTROL 512 +#define ATOM_PP_PLATFORM_CAP_TURNOFFPLL_ASPML1 1024 +#define ATOM_PP_PLATFORM_CAP_HTLINKCONTROL 2048 +#define ATOM_PP_PLATFORM_CAP_MVDDCONTROL 4096 +#define ATOM_PP_PLATFORM_CAP_GOTO_BOOT_ON_ALERT 0x2000 // Go to boot state on alerts, e.g. on an AC->DC transition. +#define ATOM_PP_PLATFORM_CAP_DONT_WAIT_FOR_VBLANK_ON_ALERT 0x4000 // Do NOT wait for VBLANK during an alert (e.g. AC->DC transition). +#define ATOM_PP_PLATFORM_CAP_VDDCI_CONTROL 0x8000 // Does the driver control VDDCI independently from VDDC. +#define ATOM_PP_PLATFORM_CAP_REGULATOR_HOT 0x00010000 // Enable the 'regulator hot' feature. +#define ATOM_PP_PLATFORM_CAP_BACO 0x00020000 // Does the driver supports BACO state. + +typedef struct _ATOM_PPLIB_POWERPLAYTABLE +{ + ATOM_COMMON_TABLE_HEADER sHeader; + + UCHAR ucDataRevision; + + UCHAR ucNumStates; + UCHAR ucStateEntrySize; + UCHAR ucClockInfoSize; + UCHAR ucNonClockSize; + + // offset from start of this table to array of ucNumStates ATOM_PPLIB_STATE structures + USHORT usStateArrayOffset; + + // offset from start of this table to array of ASIC-specific structures, + // currently ATOM_PPLIB_CLOCK_INFO. + USHORT usClockInfoArrayOffset; + + // offset from start of this table to array of ATOM_PPLIB_NONCLOCK_INFO + USHORT usNonClockInfoArrayOffset; + + USHORT usBackbiasTime; // in microseconds + USHORT usVoltageTime; // in microseconds + USHORT usTableSize; //the size of this structure, or the extended structure + + ULONG ulPlatformCaps; // See ATOM_PPLIB_CAPS_* + + ATOM_PPLIB_THERMALCONTROLLER sThermalController; + + USHORT usBootClockInfoOffset; + USHORT usBootNonClockInfoOffset; + +} ATOM_PPLIB_POWERPLAYTABLE; + +typedef struct _ATOM_PPLIB_POWERPLAYTABLE2 +{ + ATOM_PPLIB_POWERPLAYTABLE basicTable; + UCHAR ucNumCustomThermalPolicy; + USHORT usCustomThermalPolicyArrayOffset; +}ATOM_PPLIB_POWERPLAYTABLE2, *LPATOM_PPLIB_POWERPLAYTABLE2; + +typedef struct _ATOM_PPLIB_POWERPLAYTABLE3 +{ + ATOM_PPLIB_POWERPLAYTABLE2 basicTable2; + USHORT usFormatID; // To be used ONLY by PPGen. + USHORT usFanTableOffset; + USHORT usExtendendedHeaderOffset; +} ATOM_PPLIB_POWERPLAYTABLE3, *LPATOM_PPLIB_POWERPLAYTABLE3; + +typedef struct _ATOM_PPLIB_POWERPLAYTABLE4 +{ + ATOM_PPLIB_POWERPLAYTABLE3 basicTable3; + ULONG ulGoldenPPID; // PPGen use only + ULONG ulGoldenRevision; // PPGen use only + USHORT usVddcDependencyOnSCLKOffset; + USHORT usVddciDependencyOnMCLKOffset; + USHORT usVddcDependencyOnMCLKOffset; + USHORT usMaxClockVoltageOnDCOffset; + USHORT usReserved[2]; +} ATOM_PPLIB_POWERPLAYTABLE4, *LPATOM_PPLIB_POWERPLAYTABLE4; + +typedef struct _ATOM_PPLIB_POWERPLAYTABLE5 +{ + ATOM_PPLIB_POWERPLAYTABLE4 basicTable4; + ULONG ulTDPLimit; + ULONG ulNearTDPLimit; + ULONG ulSQRampingThreshold; + USHORT usCACLeakageTableOffset; // Points to ATOM_PPLIB_CAC_Leakage_Table + ULONG ulCACLeakage; // TBD, this parameter is still under discussion. Change to ulReserved if not needed. + ULONG ulReserved; +} ATOM_PPLIB_POWERPLAYTABLE5, *LPATOM_PPLIB_POWERPLAYTABLE5; + +//// ATOM_PPLIB_NONCLOCK_INFO::usClassification +#define ATOM_PPLIB_CLASSIFICATION_UI_MASK 0x0007 +#define ATOM_PPLIB_CLASSIFICATION_UI_SHIFT 0 +#define ATOM_PPLIB_CLASSIFICATION_UI_NONE 0 +#define ATOM_PPLIB_CLASSIFICATION_UI_BATTERY 1 +#define ATOM_PPLIB_CLASSIFICATION_UI_BALANCED 3 +#define ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE 5 +// 2, 4, 6, 7 are reserved + +#define ATOM_PPLIB_CLASSIFICATION_BOOT 0x0008 +#define ATOM_PPLIB_CLASSIFICATION_THERMAL 0x0010 +#define ATOM_PPLIB_CLASSIFICATION_LIMITEDPOWERSOURCE 0x0020 +#define ATOM_PPLIB_CLASSIFICATION_REST 0x0040 +#define ATOM_PPLIB_CLASSIFICATION_FORCED 0x0080 +#define ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE 0x0100 +#define ATOM_PPLIB_CLASSIFICATION_OVERDRIVETEMPLATE 0x0200 +#define ATOM_PPLIB_CLASSIFICATION_UVDSTATE 0x0400 +#define ATOM_PPLIB_CLASSIFICATION_3DLOW 0x0800 +#define ATOM_PPLIB_CLASSIFICATION_ACPI 0x1000 +#define ATOM_PPLIB_CLASSIFICATION_HD2STATE 0x2000 +#define ATOM_PPLIB_CLASSIFICATION_HDSTATE 0x4000 +#define ATOM_PPLIB_CLASSIFICATION_SDSTATE 0x8000 + +//// ATOM_PPLIB_NONCLOCK_INFO::usClassification2 +#define ATOM_PPLIB_CLASSIFICATION2_LIMITEDPOWERSOURCE_2 0x0001 +#define ATOM_PPLIB_CLASSIFICATION2_ULV 0x0002 + +//// ATOM_PPLIB_NONCLOCK_INFO::ulCapsAndSettings +#define ATOM_PPLIB_SINGLE_DISPLAY_ONLY 0x00000001 +#define ATOM_PPLIB_SUPPORTS_VIDEO_PLAYBACK 0x00000002 + +// 0 is 2.5Gb/s, 1 is 5Gb/s +#define ATOM_PPLIB_PCIE_LINK_SPEED_MASK 0x00000004 +#define ATOM_PPLIB_PCIE_LINK_SPEED_SHIFT 2 + +// lanes - 1: 1, 2, 4, 8, 12, 16 permitted by PCIE spec +#define ATOM_PPLIB_PCIE_LINK_WIDTH_MASK 0x000000F8 +#define ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT 3 + +// lookup into reduced refresh-rate table +#define ATOM_PPLIB_LIMITED_REFRESHRATE_VALUE_MASK 0x00000F00 +#define ATOM_PPLIB_LIMITED_REFRESHRATE_VALUE_SHIFT 8 + +#define ATOM_PPLIB_LIMITED_REFRESHRATE_UNLIMITED 0 +#define ATOM_PPLIB_LIMITED_REFRESHRATE_50HZ 1 +// 2-15 TBD as needed. + +#define ATOM_PPLIB_SOFTWARE_DISABLE_LOADBALANCING 0x00001000 +#define ATOM_PPLIB_SOFTWARE_ENABLE_SLEEP_FOR_TIMESTAMPS 0x00002000 +#define ATOM_PPLIB_DISALLOW_ON_DC 0x00004000 +#define ATOM_PPLIB_ENABLE_VARIBRIGHT 0x00008000 + +//memory related flags +#define ATOM_PPLIB_SWSTATE_MEMORY_DLL_OFF 0x000010000 + +//M3 Arb //2bits, current 3 sets of parameters in total +#define ATOM_PPLIB_M3ARB_MASK 0x00060000 +#define ATOM_PPLIB_M3ARB_SHIFT 17 + +#define ATOM_PPLIB_ENABLE_DRR 0x00080000 + +// remaining 16 bits are reserved +typedef struct _ATOM_PPLIB_THERMAL_STATE +{ + UCHAR ucMinTemperature; + UCHAR ucMaxTemperature; + UCHAR ucThermalAction; +}ATOM_PPLIB_THERMAL_STATE, *LPATOM_PPLIB_THERMAL_STATE; + +// Contained in an array starting at the offset +// in ATOM_PPLIB_POWERPLAYTABLE::usNonClockInfoArrayOffset. +// referenced from ATOM_PPLIB_STATE_INFO::ucNonClockStateIndex +#define ATOM_PPLIB_NONCLOCKINFO_VER1 12 +#define ATOM_PPLIB_NONCLOCKINFO_VER2 24 +typedef struct _ATOM_PPLIB_NONCLOCK_INFO +{ + USHORT usClassification; + UCHAR ucMinTemperature; + UCHAR ucMaxTemperature; + ULONG ulCapsAndSettings; + UCHAR ucRequiredPower; + USHORT usClassification2; + ULONG ulVCLK; + ULONG ulDCLK; + UCHAR ucUnused[5]; +} ATOM_PPLIB_NONCLOCK_INFO; + +// Contained in an array starting at the offset +// in ATOM_PPLIB_POWERPLAYTABLE::usClockInfoArrayOffset. +// referenced from ATOM_PPLIB_STATE::ucClockStateIndices +typedef struct _ATOM_PPLIB_R600_CLOCK_INFO +{ + USHORT usEngineClockLow; + UCHAR ucEngineClockHigh; + + USHORT usMemoryClockLow; + UCHAR ucMemoryClockHigh; + + USHORT usVDDC; + USHORT usUnused1; + USHORT usUnused2; + + ULONG ulFlags; // ATOM_PPLIB_R600_FLAGS_* + +} ATOM_PPLIB_R600_CLOCK_INFO; + +// ulFlags in ATOM_PPLIB_R600_CLOCK_INFO +#define ATOM_PPLIB_R600_FLAGS_PCIEGEN2 1 +#define ATOM_PPLIB_R600_FLAGS_UVDSAFE 2 +#define ATOM_PPLIB_R600_FLAGS_BACKBIASENABLE 4 +#define ATOM_PPLIB_R600_FLAGS_MEMORY_ODT_OFF 8 +#define ATOM_PPLIB_R600_FLAGS_MEMORY_DLL_OFF 16 +#define ATOM_PPLIB_R600_FLAGS_LOWPOWER 32 // On the RV770 use 'low power' setting (sequencer S0). + +typedef struct _ATOM_PPLIB_EVERGREEN_CLOCK_INFO +{ + USHORT usEngineClockLow; + UCHAR ucEngineClockHigh; + + USHORT usMemoryClockLow; + UCHAR ucMemoryClockHigh; + + USHORT usVDDC; + USHORT usVDDCI; + USHORT usUnused; + + ULONG ulFlags; // ATOM_PPLIB_R600_FLAGS_* + +} ATOM_PPLIB_EVERGREEN_CLOCK_INFO; + +typedef struct _ATOM_PPLIB_RS780_CLOCK_INFO + +{ + USHORT usLowEngineClockLow; // Low Engine clock in MHz (the same way as on the R600). + UCHAR ucLowEngineClockHigh; + USHORT usHighEngineClockLow; // High Engine clock in MHz. + UCHAR ucHighEngineClockHigh; + USHORT usMemoryClockLow; // For now one of the ATOM_PPLIB_RS780_SPMCLK_XXXX constants. + UCHAR ucMemoryClockHigh; // Currentyl unused. + UCHAR ucPadding; // For proper alignment and size. + USHORT usVDDC; // For the 780, use: None, Low, High, Variable + UCHAR ucMaxHTLinkWidth; // From SBIOS - {2, 4, 8, 16} + UCHAR ucMinHTLinkWidth; // From SBIOS - {2, 4, 8, 16}. Effective only if CDLW enabled. Minimum down stream width could be bigger as display BW requirement. + USHORT usHTLinkFreq; // See definition ATOM_PPLIB_RS780_HTLINKFREQ_xxx or in MHz(>=200). + ULONG ulFlags; +} ATOM_PPLIB_RS780_CLOCK_INFO; + +#define ATOM_PPLIB_RS780_VOLTAGE_NONE 0 +#define ATOM_PPLIB_RS780_VOLTAGE_LOW 1 +#define ATOM_PPLIB_RS780_VOLTAGE_HIGH 2 +#define ATOM_PPLIB_RS780_VOLTAGE_VARIABLE 3 + +#define ATOM_PPLIB_RS780_SPMCLK_NONE 0 // We cannot change the side port memory clock, leave it as it is. +#define ATOM_PPLIB_RS780_SPMCLK_LOW 1 +#define ATOM_PPLIB_RS780_SPMCLK_HIGH 2 + +#define ATOM_PPLIB_RS780_HTLINKFREQ_NONE 0 +#define ATOM_PPLIB_RS780_HTLINKFREQ_LOW 1 +#define ATOM_PPLIB_RS780_HTLINKFREQ_HIGH 2 + +typedef struct _ATOM_PPLIB_SUMO_CLOCK_INFO{ + USHORT usEngineClockLow; //clockfrequency & 0xFFFF. The unit is in 10khz + UCHAR ucEngineClockHigh; //clockfrequency >> 16. + UCHAR vddcIndex; //2-bit vddc index; + UCHAR leakage; //please use 8-bit absolute value, not the 6-bit % value + //please initalize to 0 + UCHAR rsv; + //please initalize to 0 + USHORT rsv1; + //please initialize to 0s + ULONG rsv2[2]; +}ATOM_PPLIB_SUMO_CLOCK_INFO; + + + +typedef struct _ATOM_PPLIB_STATE_V2 +{ + //number of valid dpm levels in this state; Driver uses it to calculate the whole + //size of the state: sizeof(ATOM_PPLIB_STATE_V2) + (ucNumDPMLevels - 1) * sizeof(UCHAR) + UCHAR ucNumDPMLevels; + + //a index to the array of nonClockInfos + UCHAR nonClockInfoIndex; + /** + * Driver will read the first ucNumDPMLevels in this array + */ + UCHAR clockInfoIndex[1]; +} ATOM_PPLIB_STATE_V2; + +typedef struct StateArray{ + //how many states we have + UCHAR ucNumEntries; + + ATOM_PPLIB_STATE_V2 states[1]; +}StateArray; + + +typedef struct ClockInfoArray{ + //how many clock levels we have + UCHAR ucNumEntries; + + //sizeof(ATOM_PPLIB_SUMO_CLOCK_INFO) + UCHAR ucEntrySize; + + //this is for Sumo + ATOM_PPLIB_SUMO_CLOCK_INFO clockInfo[1]; +}ClockInfoArray; + +typedef struct NonClockInfoArray{ + + //how many non-clock levels we have. normally should be same as number of states + UCHAR ucNumEntries; + //sizeof(ATOM_PPLIB_NONCLOCK_INFO) + UCHAR ucEntrySize; + + ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[1]; +}NonClockInfoArray; + +typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Record +{ + USHORT usClockLow; + UCHAR ucClockHigh; + USHORT usVoltage; +}ATOM_PPLIB_Clock_Voltage_Dependency_Record; + +typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Table +{ + UCHAR ucNumEntries; // Number of entries. + ATOM_PPLIB_Clock_Voltage_Dependency_Record entries[1]; // Dynamically allocate entries. +}ATOM_PPLIB_Clock_Voltage_Dependency_Table; + +typedef struct _ATOM_PPLIB_Clock_Voltage_Limit_Record +{ + USHORT usSclkLow; + UCHAR ucSclkHigh; + USHORT usMclkLow; + UCHAR ucMclkHigh; + USHORT usVddc; + USHORT usVddci; +}ATOM_PPLIB_Clock_Voltage_Limit_Record; + +typedef struct _ATOM_PPLIB_Clock_Voltage_Limit_Table +{ + UCHAR ucNumEntries; // Number of entries. + ATOM_PPLIB_Clock_Voltage_Limit_Record entries[1]; // Dynamically allocate entries. +}ATOM_PPLIB_Clock_Voltage_Limit_Table; + +/**************************************************************************/ + + +// Following definitions are for compatibility issue in different SW components. +#define ATOM_MASTER_DATA_TABLE_REVISION 0x01 +#define Object_Info Object_Header +#define AdjustARB_SEQ MC_InitParameter +#define VRAM_GPIO_DetectionInfo VoltageObjectInfo +#define ASIC_VDDCI_Info ASIC_ProfilingInfo +#define ASIC_MVDDQ_Info MemoryTrainingInfo +#define SS_Info PPLL_SS_Info +#define ASIC_MVDDC_Info ASIC_InternalSS_Info +#define DispDevicePriorityInfo SaveRestoreInfo +#define DispOutInfo TV_VideoMode + + +#define ATOM_ENCODER_OBJECT_TABLE ATOM_OBJECT_TABLE +#define ATOM_CONNECTOR_OBJECT_TABLE ATOM_OBJECT_TABLE + +//New device naming, remove them when both DAL/VBIOS is ready +#define DFP2I_OUTPUT_CONTROL_PARAMETERS CRT1_OUTPUT_CONTROL_PARAMETERS +#define DFP2I_OUTPUT_CONTROL_PS_ALLOCATION DFP2I_OUTPUT_CONTROL_PARAMETERS + +#define DFP1X_OUTPUT_CONTROL_PARAMETERS CRT1_OUTPUT_CONTROL_PARAMETERS +#define DFP1X_OUTPUT_CONTROL_PS_ALLOCATION DFP1X_OUTPUT_CONTROL_PARAMETERS + +#define DFP1I_OUTPUT_CONTROL_PARAMETERS DFP1_OUTPUT_CONTROL_PARAMETERS +#define DFP1I_OUTPUT_CONTROL_PS_ALLOCATION DFP1_OUTPUT_CONTROL_PS_ALLOCATION + +#define ATOM_DEVICE_DFP1I_SUPPORT ATOM_DEVICE_DFP1_SUPPORT +#define ATOM_DEVICE_DFP1X_SUPPORT ATOM_DEVICE_DFP2_SUPPORT + +#define ATOM_DEVICE_DFP1I_INDEX ATOM_DEVICE_DFP1_INDEX +#define ATOM_DEVICE_DFP1X_INDEX ATOM_DEVICE_DFP2_INDEX + +#define ATOM_DEVICE_DFP2I_INDEX 0x00000009 +#define ATOM_DEVICE_DFP2I_SUPPORT (0x1L << ATOM_DEVICE_DFP2I_INDEX) + +#define ATOM_S0_DFP1I ATOM_S0_DFP1 +#define ATOM_S0_DFP1X ATOM_S0_DFP2 + +#define ATOM_S0_DFP2I 0x00200000L +#define ATOM_S0_DFP2Ib2 0x20 + +#define ATOM_S2_DFP1I_DPMS_STATE ATOM_S2_DFP1_DPMS_STATE +#define ATOM_S2_DFP1X_DPMS_STATE ATOM_S2_DFP2_DPMS_STATE + +#define ATOM_S2_DFP2I_DPMS_STATE 0x02000000L +#define ATOM_S2_DFP2I_DPMS_STATEb3 0x02 + +#define ATOM_S3_DFP2I_ACTIVEb1 0x02 + +#define ATOM_S3_DFP1I_ACTIVE ATOM_S3_DFP1_ACTIVE +#define ATOM_S3_DFP1X_ACTIVE ATOM_S3_DFP2_ACTIVE + +#define ATOM_S3_DFP2I_ACTIVE 0x00000200L + +#define ATOM_S3_DFP1I_CRTC_ACTIVE ATOM_S3_DFP1_CRTC_ACTIVE +#define ATOM_S3_DFP1X_CRTC_ACTIVE ATOM_S3_DFP2_CRTC_ACTIVE +#define ATOM_S3_DFP2I_CRTC_ACTIVE 0x02000000L + +#define ATOM_S3_DFP2I_CRTC_ACTIVEb3 0x02 +#define ATOM_S5_DOS_REQ_DFP2Ib1 0x02 + +#define ATOM_S5_DOS_REQ_DFP2I 0x0200 +#define ATOM_S6_ACC_REQ_DFP1I ATOM_S6_ACC_REQ_DFP1 +#define ATOM_S6_ACC_REQ_DFP1X ATOM_S6_ACC_REQ_DFP2 + +#define ATOM_S6_ACC_REQ_DFP2Ib3 0x02 +#define ATOM_S6_ACC_REQ_DFP2I 0x02000000L + +#define TMDS1XEncoderControl DVOEncoderControl +#define DFP1XOutputControl DVOOutputControl + +#define ExternalDFPOutputControl DFP1XOutputControl +#define EnableExternalTMDS_Encoder TMDS1XEncoderControl + +#define DFP1IOutputControl TMDSAOutputControl +#define DFP2IOutputControl LVTMAOutputControl + +#define DAC1_ENCODER_CONTROL_PARAMETERS DAC_ENCODER_CONTROL_PARAMETERS +#define DAC1_ENCODER_CONTROL_PS_ALLOCATION DAC_ENCODER_CONTROL_PS_ALLOCATION + +#define DAC2_ENCODER_CONTROL_PARAMETERS DAC_ENCODER_CONTROL_PARAMETERS +#define DAC2_ENCODER_CONTROL_PS_ALLOCATION DAC_ENCODER_CONTROL_PS_ALLOCATION + +#define ucDac1Standard ucDacStandard +#define ucDac2Standard ucDacStandard + +#define TMDS1EncoderControl TMDSAEncoderControl +#define TMDS2EncoderControl LVTMAEncoderControl + +#define DFP1OutputControl TMDSAOutputControl +#define DFP2OutputControl LVTMAOutputControl +#define CRT1OutputControl DAC1OutputControl +#define CRT2OutputControl DAC2OutputControl + +//These two lines will be removed for sure in a few days, will follow up with Michael V. +#define EnableLVDS_SS EnableSpreadSpectrumOnPPLL +#define ENABLE_LVDS_SS_PARAMETERS_V3 ENABLE_SPREAD_SPECTRUM_ON_PPLL + +//#define ATOM_S2_CRT1_DPMS_STATE 0x00010000L +//#define ATOM_S2_LCD1_DPMS_STATE ATOM_S2_CRT1_DPMS_STATE +//#define ATOM_S2_TV1_DPMS_STATE ATOM_S2_CRT1_DPMS_STATE +//#define ATOM_S2_DFP1_DPMS_STATE ATOM_S2_CRT1_DPMS_STATE +//#define ATOM_S2_CRT2_DPMS_STATE ATOM_S2_CRT1_DPMS_STATE + +#define ATOM_S6_ACC_REQ_TV2 0x00400000L +#define ATOM_DEVICE_TV2_INDEX 0x00000006 +#define ATOM_DEVICE_TV2_SUPPORT (0x1L << ATOM_DEVICE_TV2_INDEX) +#define ATOM_S0_TV2 0x00100000L +#define ATOM_S3_TV2_ACTIVE ATOM_S3_DFP6_ACTIVE +#define ATOM_S3_TV2_CRTC_ACTIVE ATOM_S3_DFP6_CRTC_ACTIVE + +// +#define ATOM_S2_CRT1_DPMS_STATE 0x00010000L +#define ATOM_S2_LCD1_DPMS_STATE 0x00020000L +#define ATOM_S2_TV1_DPMS_STATE 0x00040000L +#define ATOM_S2_DFP1_DPMS_STATE 0x00080000L +#define ATOM_S2_CRT2_DPMS_STATE 0x00100000L +#define ATOM_S2_LCD2_DPMS_STATE 0x00200000L +#define ATOM_S2_TV2_DPMS_STATE 0x00400000L +#define ATOM_S2_DFP2_DPMS_STATE 0x00800000L +#define ATOM_S2_CV_DPMS_STATE 0x01000000L +#define ATOM_S2_DFP3_DPMS_STATE 0x02000000L +#define ATOM_S2_DFP4_DPMS_STATE 0x04000000L +#define ATOM_S2_DFP5_DPMS_STATE 0x08000000L + +#define ATOM_S2_CRT1_DPMS_STATEb2 0x01 +#define ATOM_S2_LCD1_DPMS_STATEb2 0x02 +#define ATOM_S2_TV1_DPMS_STATEb2 0x04 +#define ATOM_S2_DFP1_DPMS_STATEb2 0x08 +#define ATOM_S2_CRT2_DPMS_STATEb2 0x10 +#define ATOM_S2_LCD2_DPMS_STATEb2 0x20 +#define ATOM_S2_TV2_DPMS_STATEb2 0x40 +#define ATOM_S2_DFP2_DPMS_STATEb2 0x80 +#define ATOM_S2_CV_DPMS_STATEb3 0x01 +#define ATOM_S2_DFP3_DPMS_STATEb3 0x02 +#define ATOM_S2_DFP4_DPMS_STATEb3 0x04 +#define ATOM_S2_DFP5_DPMS_STATEb3 0x08 + +#define ATOM_S3_ASIC_GUI_ENGINE_HUNGb3 0x20 +#define ATOM_S3_ALLOW_FAST_PWR_SWITCHb3 0x40 +#define ATOM_S3_RQST_GPU_USE_MIN_PWRb3 0x80 + +/*********************************************************************************/ + +#pragma pack() // BIOS data must use byte aligment + +#endif /* _ATOMBIOS_H */ diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 20428a33e5..8c7e2a80cb 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -28,6 +28,52 @@ atom_context *gAtomContext; +void +atombios_crtc_power(uint8 crt_id, int state) +{ + int index = GetIndexIntoMasterTable(COMMAND, EnableCRTC); + ENABLE_CRTC_PS_ALLOCATION args; + + memset(&args, 0, sizeof(args)); + + args.ucCRTC = crt_id; + args.ucEnable = state; + + atom_execute_table(gAtomContext, index, (uint32*)&args); +} + + +void +radeon_bios_init_scratch() +{ + radeon_shared_info &info = *gInfo->shared_info; + + uint32 bios_2_scratch; + uint32 bios_6_scratch; + + if (info.device_chipset >= RADEON_R600) { + bios_2_scratch = Read32(OUT, R600_BIOS_2_SCRATCH); + bios_6_scratch = Read32(OUT, R600_BIOS_6_SCRATCH); + } else { + bios_2_scratch = Read32(OUT, RADEON_BIOS_2_SCRATCH); + bios_6_scratch = Read32(OUT, RADEON_BIOS_6_SCRATCH); + } + + bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; + // bios should control backlight + bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH; + // bios shouldn't handle mode switching + + if (info.device_chipset >= RADEON_R600) { + Write32(OUT, R600_BIOS_2_SCRATCH, bios_2_scratch); + Write32(OUT, R600_BIOS_6_SCRATCH, bios_6_scratch); + } else { + Write32(OUT, RADEON_BIOS_2_SCRATCH, bios_2_scratch); + Write32(OUT, RADEON_BIOS_6_SCRATCH, bios_6_scratch); + } +} + + status_t radeon_init_bios(uint8* bios) { @@ -69,12 +115,8 @@ radeon_init_bios(uint8* bios) return B_ERROR; } - #if 0 - rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios); - mutex_init(&rdev->mode_info.atom_context->mutex); - radeon_atom_initialize_bios_scratch_regs(rdev->ddev); - atom_allocate_fb_scratch(rdev->mode_info.atom_context); - #endif + // mutex_init(&rdev->mode_info.atom_context->mutex); + radeon_bios_init_scratch(); return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index 7b9263dca9..d79eff680e 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -14,6 +14,7 @@ #include "atom.h" +void atombios_crtc_power(uint8 crt_id, int state); status_t radeon_init_bios(uint8* bios); diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 5ded5f08c8..9d33838003 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -13,6 +13,7 @@ #include "accelerant_protos.h" #include "accelerant.h" +#include "bios.h" #include "utility.h" #include "mode.h" #include "display.h" @@ -343,7 +344,8 @@ radeon_set_display_mode(display_mode *mode) // Skip if display is inactive if (gDisplay[id]->active == false) { CardBlankSet(id, true); - display_power(id, RHD_POWER_SHUTDOWN); + // LEGACY : display_power(id, RHD_POWER_SHUTDOWN); + atombios_crtc_power(id, ATOM_DISABLE); continue; } @@ -352,7 +354,7 @@ radeon_set_display_mode(display_mode *mode) CardModeSet(id, mode); CardModeScale(id, mode); - display_power(id, RHD_POWER_RESET); + // LEGACY : display_power(id, RHD_POWER_RESET); // Program connector controllers switch (gDisplay[id]->connection_type) { @@ -370,7 +372,8 @@ radeon_set_display_mode(display_mode *mode) } // Power CRT Controller - display_power(id, RHD_POWER_ON); + // LEGACY : display_power(id, RHD_POWER_ON); + atombios_crtc_power(id, ATOM_ENABLE); CardBlankSet(id, false); // Power connector controllers From e7f4040697702e0a799bae50fd0387486f3ee842 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 5 Aug 2011 05:34:28 +0000 Subject: [PATCH 127/702] * improve debugging in AtomBIOS atom.c parser git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42579 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 150 +++++++++--------- 1 file changed, 78 insertions(+), 72 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 5a96a8c562..6508d95bb2 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -138,7 +138,7 @@ atom_iio_execute(atom_context *ctx, int base, uint32 index, uint32 data) case ATOM_IIO_END: return temp; default: - TRACE("Unknown IIO opcode.\n"); + TRACE("%s: Unknown IIO opcode.\n", __func__); return 0; } } @@ -162,18 +162,19 @@ atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, val = gctx->card->reg_read(idx); break; case ATOM_IO_PCI: - TRACE("PCI registers are not implemented.\n"); + TRACE("%s: PCI registers are not implemented.\n", __func__); return 0; case ATOM_IO_SYSIO: - TRACE("SYSIO registers are not implemented.\n"); + TRACE("%s: SYSIO registers are not implemented.\n", __func__); return 0; default: if (!(gctx->io_mode&0x80)) { - TRACE("Bad IO mode.\n"); + TRACE("%s: Bad IO mode.\n", __func__); return 0; } if (!gctx->iio[gctx->io_mode&0x7F]) { - TRACE("Undefined indirect IO read method %d.\n", gctx->io_mode&0x7F); + TRACE("%s: Undefined indirect IO read method %d.\n", __func__, + gctx->io_mode&0x7F); return 0; } val = atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0x7F], idx, 0); @@ -224,7 +225,7 @@ atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, case ATOM_ARG_FB: idx = U8(*ptr); (*ptr)++; - TRACE("FB access is not implemented.\n"); + TRACE("%s: FB access is not implemented.\n", __func__); return 0; case ATOM_ARG_IMM: switch(align) { @@ -256,7 +257,7 @@ atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, case ATOM_ARG_MC: idx = U8(*ptr); (*ptr)++; - TRACE("MC registers are not implemented.\n"); + TRACE("%s: MC registers are not implemented.\n", __func__); return 0; } if (saved) @@ -354,14 +355,14 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, gctx->card->reg_write(idx, val); break; case ATOM_IO_PCI: - TRACE("PCI registers are not implemented.\n"); + TRACE("%s: PCI registers are not implemented.\n", __func__); return; case ATOM_IO_SYSIO: - TRACE("SYSIO registers are not implemented.\n"); + TRACE("%s: SYSIO registers are not implemented.\n", __func__); return; default: if (!(gctx->io_mode&0x80)) { - TRACE("Bad IO mode.\n"); + TRACE("%s: Bad IO mode.\n", __func__); return; } if (!gctx->iio[gctx->io_mode&0xFF]) { @@ -407,7 +408,7 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, case ATOM_ARG_FB: idx = U8(*ptr); (*ptr)++; - TRACE("FB access is not implemented.\n"); + TRACE("%s: FB access is not implemented.\n", __func__); return; case ATOM_ARG_PLL: idx = U8(*ptr); @@ -418,7 +419,7 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, case ATOM_ARG_MC: idx = U8(*ptr); (*ptr)++; - TRACE("MC registers are not implemented.\n"); + TRACE("%s: MC registers are not implemented.\n", __func__); return; } } @@ -430,12 +431,13 @@ atom_op_add(atom_exec_context *ctx, int *ptr, int arg) uint8 attr = U8((*ptr)++); uint32 dst, src, saved; int dptr = *ptr; - TRACE(" dst: "); dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - TRACE(" src: "); src = atom_get_src(ctx, attr, ptr); + #ifdef TRACE_ATOM + TRACE("%s: 0x%" B_PRIX32 " + 0x%" B_PRIX32 " is 0x%" B_PRIX32 "\n", + __func__, dst, src, dst + src); + #endif dst += src; - TRACE(" dst: "); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -446,12 +448,13 @@ atom_op_and(atom_exec_context *ctx, int *ptr, int arg) uint8 attr = U8((*ptr)++); uint32 dst, src, saved; int dptr = *ptr; - TRACE(" dst: "); dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - TRACE(" src: "); src = atom_get_src(ctx, attr, ptr); + #ifdef TRACE_ATOM + TRACE("%s: 0x%" B_PRIX32 " & 0x%" B_PRIX32 " is 0x%" B_PRIX32 "\n", + __func__, src, dst, dst & src); + #endif dst &= src; - TRACE(" dst: "); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -459,7 +462,7 @@ atom_op_and(atom_exec_context *ctx, int *ptr, int arg) static void atom_op_beep(atom_exec_context *ctx, int *ptr, int arg) { - TRACE("ATOM BIOS beeped!\n"); + TRACE("%s: Quack!\n", __func__); } @@ -467,7 +470,7 @@ static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) { int idx = U8((*ptr)++); - TRACE(" table: %d\n", idx); + TRACE("%s: table: %d\n", __func__, idx); if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) atom_execute_table(ctx->ctx, idx, ctx->ps + ctx->ps_shift); } @@ -482,7 +485,7 @@ atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) attr &= 0x38; attr |= atom_def_dst[attr>>3]<<6; atom_get_dst(ctx, arg, attr, ptr, &saved, 0); - TRACE(" dst: "); + TRACE("%s\n", __func__); atom_put_dst(ctx, arg, attr, &dptr, 0, saved); } @@ -492,14 +495,12 @@ atom_op_compare(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++); uint32 dst, src; - TRACE(" src1: "); dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); - TRACE(" src2: "); src = atom_get_src(ctx, attr, ptr); ctx->ctx->cs_equal = (dst == src); ctx->ctx->cs_above = (dst > src); - TRACE(" result: %s %s\n", ctx->ctx->cs_equal ? "EQ" : "NE", - ctx->ctx->cs_above ? "GT" : "LE"); + TRACE("%s: 0x%" B_PRIX32 " %s 0x%" B_PRIX32 "\n", __func__, + dst, ctx->ctx->cs_above ? ">" : "<=", src); } @@ -507,11 +508,12 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) { uint8 count = U8((*ptr)++); - TRACE(" count: %d\n", count); if (arg == ATOM_UNIT_MICROSEC) { + TRACE("%s: %" B_PRIu8 " microseconds\n", __func__, count); // Microseconds usleep(count); } else { + TRACE("%s: %" B_PRIu8 " milliseconds\n", __func__, count); // TODO : check // Milliseconds usleep(count); @@ -524,9 +526,7 @@ atom_op_div(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++); uint32 dst, src; - TRACE(" src1: "); dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); - TRACE(" src2: "); src = atom_get_src(ctx, attr, ptr); if (src != 0) { ctx->ctx->divmul[0] = dst / src; @@ -535,6 +535,11 @@ atom_op_div(atom_exec_context *ctx, int *ptr, int arg) ctx->ctx->divmul[0] = 0; ctx->ctx->divmul[1] = 0; } + #ifdef ATOM_TRACE + TRACE("%s: 0x%" B_PRIX32 " / 0x%" B_PRIX32 " is 0x%" B_PRIX32 + " remander 0x%" B_PRIX32 "\n", __func__, dst, src, + ctx->ctx->divmul[0], ctx->ctx->divmul[1]); + #endif } @@ -573,11 +578,10 @@ atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) execute = !ctx->ctx->cs_equal; break; } - if (arg != ATOM_COND_ALWAYS) - TRACE(" taken: %s\n", execute?"yes":"no"); - TRACE(" target: 0x%04X\n", target); + TRACE("%s: execute jump: %s; target: 0x%04X\n", __func__, + execute? "yes" : "no", target); if (execute) - *ptr = ctx->start + target; + *ptr = ctx->start + target; } @@ -587,15 +591,13 @@ atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) uint8 attr = U8((*ptr)++); uint32 dst, src1, src2, saved; int dptr = *ptr; - TRACE(" dst: "); dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - TRACE(" src1: "); src1 = atom_get_src(ctx, attr, ptr); - TRACE(" src2: "); src2 = atom_get_src(ctx, attr, ptr); dst &= src1; dst |= src2; - TRACE(" dst: "); + TRACE("%s: src: 0x%" B_PRIX32 " mask 0x%" B_PRIX32 " is 0x%" B_PRIX32 "\n", + __func__, src1, src2, dst); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -607,14 +609,14 @@ atom_op_move(atom_exec_context *ctx, int *ptr, int arg) uint32 src, saved; int dptr = *ptr; if (((attr>>3)&7) != ATOM_SRC_DWORD) - atom_get_dst(ctx, arg, attr, ptr, &saved, 0); + atom_get_dst(ctx, arg, attr, ptr, &saved, 0); else { - atom_skip_dst(ctx, arg, attr, ptr); - saved = 0xCDCDCDCD; + atom_skip_dst(ctx, arg, attr, ptr); + saved = 0xCDCDCDCD; } - TRACE(" src: "); src = atom_get_src(ctx, attr, ptr); - TRACE(" dst: "); + TRACE("%s: src: 0x%" B_PRIX32 "; saved: 0x%" B_PRIX32 "\n", + __func__, src, saved); atom_put_dst(ctx, arg, attr, &dptr, src, saved); } @@ -624,11 +626,11 @@ atom_op_mul(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++); uint32 dst, src; - TRACE(" src1: "); dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); - TRACE(" src2: "); src = atom_get_src(ctx, attr, ptr); ctx->ctx->divmul[0] = dst * src; + TRACE("%s: 0x%" B_PRIX32 " * 0x%" B_PRIX32 " is 0x%" B_PRIX32 "\n", + __func__, dst, src, ctx->ctx->divmul[0]); } @@ -645,12 +647,13 @@ atom_op_or(atom_exec_context *ctx, int *ptr, int arg) uint8 attr = U8((*ptr)++); uint32 dst, src, saved; int dptr = *ptr; - TRACE(" dst: "); dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - TRACE(" src: "); src = atom_get_src(ctx, attr, ptr); + #ifdef ATOM_TRACE + TRACE("%s: 0x%" B_PRIX32 " | 0x%" B_PRIX32 " is 0x%" B_PRIX32 "\n", + __func__, dst, src, dst | src); + #endif dst |= src; - TRACE(" dst: "); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -658,27 +661,27 @@ atom_op_or(atom_exec_context *ctx, int *ptr, int arg) static void atom_op_postcard(atom_exec_context *ctx, int *ptr, int arg) { - TRACE("unimplemented!\n"); + TRACE("%s: unimplemented!\n", __func__); } static void atom_op_repeat(atom_exec_context *ctx, int *ptr, int arg) { - TRACE("unimplemented!\n"); + TRACE("%s: unimplemented!\n", __func__); } static void atom_op_restorereg(atom_exec_context *ctx, int *ptr, int arg) { - TRACE("unimplemented!\n"); + TRACE("%s: unimplemented!\n", __func__); } static void atom_op_savereg(atom_exec_context *ctx, int *ptr, int arg) { - TRACE("unimplemented!\n"); + TRACE("%s: unimplemented!\n", __func__); } @@ -687,7 +690,7 @@ atom_op_setdatablock(atom_exec_context *ctx, int *ptr, int arg) { int idx = U8(*ptr); (*ptr)++; - TRACE(" block: %d\n", idx); + TRACE("%s: block: %d\n", __func__, idx); if (!idx) ctx->ctx->data_block = 0; else if (idx==255) @@ -701,8 +704,8 @@ static void atom_op_setfbbase(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++); - TRACE(" fb_base: "); ctx->ctx->fb_base = atom_get_src(ctx, attr, ptr); + TRACE("%s: fb_base: 0x%" B_PRIX32 "\n", __func__, ctx->ctx->fb_base); } @@ -713,7 +716,7 @@ atom_op_setport(atom_exec_context *ctx, int *ptr, int arg) switch(arg) { case ATOM_PORT_ATI: port = U16(*ptr); - TRACE(" port: %d\n", port); + TRACE("%s: port: %d\n", __func__, port); if (!port) ctx->ctx->io_mode = ATOM_IO_MM; else @@ -748,12 +751,13 @@ atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) int dptr = *ptr; attr &= 0x38; attr |= atom_def_dst[attr>>3]<<6; - TRACE(" dst: "); dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); shift = U8((*ptr)++); - TRACE(" shift: %d\n", shift); + #ifdef ATOM_TRACE + TRACE("%s: 0x%" B_PRIX32 " << %" B_PRId8 " is 0X%" B_PRIX32 "\n", + __func__, dst, shift, dst << shift); + #endif dst <<= shift; - TRACE(" dst: "); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -766,12 +770,13 @@ atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) int dptr = *ptr; attr &= 0x38; attr |= atom_def_dst[attr>>3]<<6; - TRACE(" dst: "); dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); shift = U8((*ptr)++); - TRACE(" shift: %d\n", shift); + #ifdef ATOM_TRACE + TRACE("%s: 0x%" B_PRIX32 " >> %" B_PRId8 " is 0X%" B_PRIX32 "\n", + __func__, dst, shift, dst >> shift); + #endif dst >>= shift; - TRACE(" dst: "); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -782,12 +787,13 @@ atom_op_sub(atom_exec_context *ctx, int *ptr, int arg) uint8 attr = U8((*ptr)++); uint32 dst, src, saved; int dptr = *ptr; - TRACE(" dst: "); dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - TRACE(" src: "); src = atom_get_src(ctx, attr, ptr); + #ifdef TRACE_ATOM + TRACE("%s: 0x%" B_PRIX32 " - 0x%" B_PRIX32 " is 0x%" B_PRIX32 "\n", + __func__, dst, src, dst - src); + #endif dst -= src; - TRACE(" dst: "); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -797,12 +803,12 @@ atom_op_switch(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++); uint32 src, val, target; - TRACE(" switch: "); + TRACE("%s: switch start\n", __func__); src = atom_get_src(ctx, attr, ptr); while (U16(*ptr) != ATOM_CASE_END) if (U8(*ptr) == ATOM_CASE_MAGIC) { (*ptr)++; - TRACE(" case: "); + TRACE("%s: switch case\n", __func__); val = atom_get_src(ctx, (attr&0x38)|ATOM_ARG_IMM, ptr); target = U16(*ptr); if (val == src) { @@ -811,7 +817,7 @@ atom_op_switch(atom_exec_context *ctx, int *ptr, int arg) } (*ptr) += 2; } else { - TRACE("Bad case.\n"); + TRACE("%s: ERROR bad case\n", __func__); return; } (*ptr) += 2; @@ -823,12 +829,11 @@ atom_op_test(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++); uint32 dst, src; - TRACE(" src1: "); dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1); - TRACE(" src2: "); src = atom_get_src(ctx, attr, ptr); ctx->ctx->cs_equal = ((dst & src) == 0); - TRACE(" result: %s\n", ctx->ctx->cs_equal?"EQ":"NE"); + TRACE("%s: 0x%" B_PRIX32 " and 0x%" B_PRIX32 " are %s\n", __func__, + dst, src, ctx->ctx->cs_equal ? "EQ" : "NE"); } @@ -838,12 +843,13 @@ atom_op_xor(atom_exec_context *ctx, int *ptr, int arg) uint8 attr = U8((*ptr)++); uint32 dst, src, saved; int dptr = *ptr; - TRACE(" dst: "); dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - TRACE(" src: "); src = atom_get_src(ctx, attr, ptr); + #ifdef ATOM_TRACE + TRACE("%s: 0x%" B_PRIX32 " ^ 0X%" B_PRIX32 " is " B_PRIX32 "\n", + __func__, dst, src, dst ^ src); + #endif dst ^= src; - TRACE(" dst: "); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -851,7 +857,7 @@ atom_op_xor(atom_exec_context *ctx, int *ptr, int arg) static void atom_op_debug(atom_exec_context *ctx, int *ptr, int arg) { - TRACE("unimplemented!\n"); + TRACE("%s: unimplemented!\n", __func__); } From 88932cfb416cf14f99ea48f18611a5828537102c Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 5 Aug 2011 05:47:31 +0000 Subject: [PATCH 128/702] * repair time by slowing it down git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42580 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/atombios/atom.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 6508d95bb2..3a48eef3ee 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -507,16 +507,15 @@ atom_op_compare(atom_exec_context *ctx, int *ptr, int arg) static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) { - uint8 count = U8((*ptr)++); + bigtime_t count = U8((*ptr)++); if (arg == ATOM_UNIT_MICROSEC) { - TRACE("%s: %" B_PRIu8 " microseconds\n", __func__, count); + TRACE("%s: %" B_PRId64 " microseconds\n", __func__, count); // Microseconds - usleep(count); + snooze(count); } else { - TRACE("%s: %" B_PRIu8 " milliseconds\n", __func__, count); - // TODO : check + TRACE("%s: %" B_PRId64 " milliseconds\n", __func__, count); // Milliseconds - usleep(count); + snooze(count * 1000); } } From 812f1e5bb87754fd87a97730ca36fc66e7e74fa8 Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Fri, 5 Aug 2011 20:44:50 +0000 Subject: [PATCH 129/702] Updated catkeys from HTA. Thanks all. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42581 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../inbound_filters/match_header/sv.catkeys | 7 +- .../inbound_filters/spam_filter/sv.catkeys | 6 +- data/catalogs/apps/aboutsystem/be.catkeys | 3 +- data/catalogs/apps/aboutsystem/cs.catkeys | 3 +- data/catalogs/apps/aboutsystem/de.catkeys | 5 +- data/catalogs/apps/aboutsystem/eo.catkeys | 3 +- data/catalogs/apps/aboutsystem/es.catkeys | 3 +- data/catalogs/apps/aboutsystem/fi.catkeys | 4 +- data/catalogs/apps/aboutsystem/fr.catkeys | 3 +- data/catalogs/apps/aboutsystem/it.catkeys | 3 +- data/catalogs/apps/aboutsystem/ja.catkeys | 10 +- data/catalogs/apps/aboutsystem/lt.catkeys | 3 +- data/catalogs/apps/aboutsystem/nb.catkeys | 3 +- data/catalogs/apps/aboutsystem/nl.catkeys | 3 +- data/catalogs/apps/aboutsystem/pl.catkeys | 3 +- data/catalogs/apps/aboutsystem/pt_br.catkeys | 3 +- data/catalogs/apps/aboutsystem/ro.catkeys | 3 +- data/catalogs/apps/aboutsystem/sk.catkeys | 3 +- data/catalogs/apps/aboutsystem/sv.catkeys | 5 +- .../catalogs/apps/aboutsystem/zh_hans.catkeys | 3 +- data/catalogs/apps/charactermap/de.catkeys | 4 +- data/catalogs/apps/charactermap/fr.catkeys | 18 +- data/catalogs/apps/charactermap/ja.catkeys | 4 +- data/catalogs/apps/charactermap/sk.catkeys | 154 +++++++++++++++++- data/catalogs/apps/charactermap/sv.catkeys | 3 +- data/catalogs/apps/deskbar/be.catkeys | 3 +- data/catalogs/apps/deskbar/cs.catkeys | 3 +- data/catalogs/apps/deskbar/de.catkeys | 6 +- data/catalogs/apps/deskbar/fr.catkeys | 3 +- data/catalogs/apps/deskbar/ja.catkeys | 5 +- data/catalogs/apps/deskbar/nb.catkeys | 3 +- data/catalogs/apps/deskbar/sk.catkeys | 5 +- data/catalogs/apps/deskbar/sv.catkeys | 2 +- data/catalogs/apps/deskbar/zh_hans.catkeys | 3 +- data/catalogs/apps/installer/de.catkeys | 2 +- data/catalogs/apps/showimage/sk.catkeys | 3 +- data/catalogs/apps/text_search/fi.catkeys | 2 +- data/catalogs/kits/tracker/de.catkeys | 4 +- data/catalogs/kits/tracker/sk.catkeys | 3 +- data/catalogs/kits/tracker/sv.catkeys | 4 +- .../preferences/appearance/de.catkeys | 8 +- .../catalogs/preferences/filetypes/sk.catkeys | 5 +- data/catalogs/preferences/mail/be.catkeys | 6 +- data/catalogs/preferences/mail/cs.catkeys | 6 +- data/catalogs/preferences/mail/de.catkeys | 13 +- data/catalogs/preferences/mail/fr.catkeys | 6 +- data/catalogs/preferences/mail/it.catkeys | 6 +- data/catalogs/preferences/mail/ja.catkeys | 12 +- data/catalogs/preferences/mail/nb.catkeys | 6 +- data/catalogs/preferences/mail/nl.catkeys | 3 +- data/catalogs/preferences/mail/pl.catkeys | 3 +- data/catalogs/preferences/mail/pt_br.catkeys | 3 +- data/catalogs/preferences/mail/ro.catkeys | 3 +- data/catalogs/preferences/mail/sk.catkeys | 11 +- data/catalogs/preferences/mail/sv.catkeys | 11 +- .../catalogs/preferences/mail/zh_hans.catkeys | 6 +- data/catalogs/servers/mail/de.catkeys | 8 +- data/catalogs/servers/mail/ja.catkeys | 6 +- data/catalogs/servers/mail/sv.catkeys | 6 +- 59 files changed, 297 insertions(+), 144 deletions(-) diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/sv.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/sv.catkeys index ba66e04cf3..ce985dbcff 100644 --- a/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/sv.catkeys +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/sv.catkeys @@ -1,14 +1,15 @@ -1 swedish x-vnd.Haiku-MatchHeader 934971625 +1 swedish x-vnd.Haiku-MatchHeader 1205906732 ConfigView ConfigView Delete message ConfigView Radera meddelande If ConfigView Om Move to ConfigView Flytta till Reply with ConfigView Svara med +Rule filter RuleFilter Filterregel Set as read ConfigView Markera som läst Set flags to ConfigView Markera som -Then ConfigView Då +Then ConfigView Åtgärd has ConfigView har header (e.g. Subject) ConfigView huvud (ex Rubrik) this field is based on the action ConfigView detta fält är baserat på åtgärden -value (use REGEX: in from of regular expressions like *spam*) ConfigView värde (använd reguljära uttryck i format som *skräppost*) +value (use REGEX: in from of regular expressions like *spam*) ConfigView värde (använd reguljära uttryck i format som *spam*) diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/sv.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/sv.catkeys index 994b9aa448..073152453e 100644 --- a/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/sv.catkeys +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/sv.catkeys @@ -1,5 +1,9 @@ -1 swedish x-vnd.Haiku-SpamFilter 3701267948 +1 swedish x-vnd.Haiku-SpamFilter 1975155212 +Add spam rating to start of subject SpamFilterConfig Lägg till skräpranking före rubriken Close SpamFilterConfig Stäng +Genuine below and uncertain above: SpamFilterConfig Säkert under eller osäkert över: Learn from all incoming e-mail SpamFilterConfig Lär från all inkommande e-post +Sorry, unable to launch the spamdbm program to let you edit the server settings. SpamFilterConfig Kunde inte starta spamdb-programmet för redigering av serverinställningarna. Spam Filter (AGMS Bayesian) SpamFilter Skräppostfilter (AGMS Bayesian) Spam above: SpamFilterConfig Skräppost över: +or empty e-mail SpamFilterConfig eller tomt e-post diff --git a/data/catalogs/apps/aboutsystem/be.catkeys b/data/catalogs/apps/aboutsystem/be.catkeys index d936ca4e94..c705de6a4c 100644 --- a/data/catalogs/apps/aboutsystem/be.catkeys +++ b/data/catalogs/apps/aboutsystem/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-About 128117018 +1 belarusian x-vnd.Haiku-About 282658629 %.2f GHz AboutView %.2f ГГц %d MiB total AboutView %d MiB усяго %d MiB used (%d%%) AboutView %d MiB выкарыстана (%d%%) @@ -70,7 +70,6 @@ The BeGeistert team\n AboutView Каманада BeGeistert\n The Haiku-Ports team\n AboutView Каманда Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Каманда Haikuware і ихнія ахвяраванні\n The University of Auckland and Christof Lutteroth\n\n AboutView The University of Auckland and Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Код, унікальны для Haiku, асабіста ядро і ўвесь код, да якога могуць звяртацца праграмы, распаўсюджваецца ў межах %MIT licence%. Некаторыя сістэмныя бібліятэкі змяшчаюць код, які распаўсюджваецца ў межах ліцэнзіі LGPL. Аўтарскія правы на код трэціх старон глядзіце ніжэй.\n\n The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Аўтарскія правы на зыходны код Haiku належаць Haiku, Inc. ці суадносным аўтарам якія пазначаны ў зыходных тэкстах. Haiku™ і HAIKU logo® з´яўляюцца зарэгістраванымі гандлёвымі знакамі Haiku, Inc.\n\n Time running: AboutView Час працы: Translations:\n AboutView Пераклады:\n diff --git a/data/catalogs/apps/aboutsystem/cs.catkeys b/data/catalogs/apps/aboutsystem/cs.catkeys index 1068bef547..f862f72bda 100644 --- a/data/catalogs/apps/aboutsystem/cs.catkeys +++ b/data/catalogs/apps/aboutsystem/cs.catkeys @@ -1,4 +1,4 @@ -1 czech x-vnd.Haiku-About 1388347678 +1 czech x-vnd.Haiku-About 1542889289 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB celkem %d MiB used (%d%%) AboutView %d MiB používáno (%d%%) @@ -47,7 +47,6 @@ The BeGeistert team\n AboutView Tým BeGeister\n The Haiku-Ports team\n AboutView Tým Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Tým Haikuware a jejich systém prémií\n The University of Auckland and Christof Lutteroth\n\n AboutView Aucklandská Universita a Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Kód, který je jedinečný pro Haiku, zejména jádro a veškerý kód, ke kterému se mohou odkazovat aplikace, je distribuován pod podmínkami %MIT licence%. Některé knihovny obsahují kód třetích stran distribuovaný pod licencí LGPL. Copyrighty ke kódu třetích stran je možno nalézt níže. The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Autorská práva ke kódu Haiku jsou majetkem společnosti Haiku, Inc., nebo příslušných autorů, je-li to výslovně uvedeno ve zdroji. Haiku a logo Haiku jsou ochranné známky společnosti Haiku, Inc.\n\n Time running: AboutView Uptime: Translations:\n AboutView Překlady:\n diff --git a/data/catalogs/apps/aboutsystem/de.catkeys b/data/catalogs/apps/aboutsystem/de.catkeys index 3f40dd3644..81f1807822 100644 --- a/data/catalogs/apps/aboutsystem/de.catkeys +++ b/data/catalogs/apps/aboutsystem/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-About 128117018 +1 german x-vnd.Haiku-About 3091539351 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB gesamt %d MiB used (%d%%) AboutView %d MiB benutzt (%d%%) @@ -6,6 +6,7 @@ %ld Processors: AboutView %ld Prozessoren: %total MiB total, %inaccessible MiB inaccessible AboutView %total MiB gesamt, %inaccessible MiB nicht verfügbar ... and the many people making donations!\n\n AboutView ... und die vielen Leute, die durch Spenden geholfen haben!\n\n +2001 by Andy Ritger based on the Generalized Timing Formula AboutView Copyright © 2001 Andy Ritger, basierend auf 'Generalized Timing Formula'. About this system AboutWindow Über dieses System AboutSystem System name Über Haiku BSD (2-clause) AboutView 2-Klausel-BSD @@ -70,7 +71,7 @@ The BeGeistert team\n AboutView Das BeGeistert-Team\n The Haiku-Ports team\n AboutView Das Haiku-Ports-Team\n The Haikuware team and their bounty program\n AboutView Das Haikuware-Team und deren Bounty-Programm\n The University of Auckland and Christof Lutteroth\n\n AboutView Die Universität von Auckland und Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Der von Haiku selbst erstellte Quellcode, besonders der Kernel und alle Teile des Codes, gegen den Anwendungen gelinkt werden können, steht unter den Bedingungen der %MIT Lizenz%. Einige Systembibliotheken, die Code von Dritten enthalten, stehen unter der LGPL Lizenz. Angaben zum Copyright von externen Quellen sind unten aufgeführt.\n\n +The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Der von Haiku selbst erstellte Quellcode, besonders der Kernel und alle Teile des Codes, gegen den Anwendungen gelinkt werden können, wird unter den Bedingungen der %MIT Lizenz% veröffentlicht. Einige Systembibliotheken, die Code von Dritten enthalten, stehen unter der LGPL Lizenz. Angaben zum Copyright von externen Quellen sind unten aufgeführt.\n\n The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Die Urheberrechte am Haiku-Code liegen bei Haiku, Inc., beziehungsweise bei den entsprechenden Autoren, die explizit im Quelltext aufgeführt sind. Haiku™ und das HAIKU Logo® sind (registrierte) Marken von Haiku, Inc.\n\n Time running: AboutView Laufzeit: Translations:\n AboutView Übersetzungen:\n diff --git a/data/catalogs/apps/aboutsystem/eo.catkeys b/data/catalogs/apps/aboutsystem/eo.catkeys index d432bd4d87..7670435f60 100644 --- a/data/catalogs/apps/aboutsystem/eo.catkeys +++ b/data/catalogs/apps/aboutsystem/eo.catkeys @@ -1,4 +1,4 @@ -1 esperanto x-vnd.Haiku-About 3149623567 +1 esperanto x-vnd.Haiku-About 3304165178 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiBajtoj ĉiomaj %d MiB used (%d%%) AboutView %d MiBajtoj uzataj (%d%%) @@ -24,7 +24,6 @@ The BeGeistert team\n AboutView La grupo BeGeistert\n The Haiku-Ports team\n AboutView La Hajku-Portantaro\n The Haikuware team and their bounty program\n AboutView La Haikuware grupo kaj ilia premia programo\n The University of Auckland and Christof Lutteroth\n\n AboutView la Universitato de Aŭklando kaj Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView La fontkodo unika je Haiku, speciale la kerno kaj la binditaj aplikaĵoj, disiĝas laŭ la termoj de la %permesilo MIT%. Certaj sistemaj bibliotekoj enhavas eksterpartian fontkodon disiĝintan laŭ la permesilo LGPL. Vi trovos la aŭtorrajtojn pro la eksterpartia fontkodo pieden.\n\n Time running: AboutView Ruldaŭro: Translations:\n AboutView Tradukoj:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (kaj lia NewOS kerno)\n diff --git a/data/catalogs/apps/aboutsystem/es.catkeys b/data/catalogs/apps/aboutsystem/es.catkeys index b5b62978c6..8b17a6bf80 100644 --- a/data/catalogs/apps/aboutsystem/es.catkeys +++ b/data/catalogs/apps/aboutsystem/es.catkeys @@ -1,4 +1,4 @@ -1 spanish x-vnd.Haiku-About 3149623567 +1 spanish x-vnd.Haiku-About 3304165178 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB en total %d MiB used (%d%%) AboutView %d MiB usados (%d%%) @@ -24,7 +24,6 @@ The BeGeistert team\n AboutView El equipo de BeGeistert\n The Haiku-Ports team\n AboutView El equipo Haiku-Ports\n The Haikuware team and their bounty program\n AboutView El equipo de Haikuware y su programa de recompensas\n The University of Auckland and Christof Lutteroth\n\n AboutView La Universidad de Auckland y a Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView El código que es único de Haiku, en especial el núcleo y todo el código al cual se enlazan las aplicaciones, se distribuye bajo los términos de la %licencia MIT%. Algunas librerías del sistema contienen código de terceras personas distribuidas bajo la licencia LGPL. Los derechos de autor de terceras personas se encuentran a continuación.\n\n Time running: AboutView Tiempo en ejecución: Translations:\n AboutView Traducciones:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (y su núcleo NewOS)\n diff --git a/data/catalogs/apps/aboutsystem/fi.catkeys b/data/catalogs/apps/aboutsystem/fi.catkeys index 83ae94d8ae..2ba50dbc31 100644 --- a/data/catalogs/apps/aboutsystem/fi.catkeys +++ b/data/catalogs/apps/aboutsystem/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-About 1190044815 +1 finnish x-vnd.Haiku-About 3091539351 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d mebitavua yhteensä %d MiB used (%d%%) AboutView %d mebitavua käytetty (%d%%) @@ -71,7 +71,7 @@ The BeGeistert team\n AboutView BeGeistert-ryhmä\n The Haiku-Ports team\n AboutView Haiku-Ports -ryhmä\n The Haikuware team and their bounty program\n AboutView Haikuware-ryhmä ja heidän bounty-ohjelmansa\n The University of Auckland and Christof Lutteroth\n\n AboutView Aucklandin yliopisto ja Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Haikulle uniikki koodi, erityisesti ydin ja kaikki koodi, johon sovellukset linkitetään, jaellaan %MIT licence%-lisenssin ehtojen alla. Jotkut järjestelmäkirjastot sisältävät kolmannen osapuolen koodia, joka jaetaan LGPL-lisenssin alla. Löydät kolmannen osapuolen tekijänoikeustiedot alta.\n\n +The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Haikulle uniikki koodi, erityisesti ydin ja kaikki koodi, johon sovellukset ehkä linkitetään, jaellaan %MIT licence%-lisenssin ehtojen alla. Jotkut järjestelmäkirjastot sisältävät kolmannen osapuolen koodia, joka jaetaan LGPL-lisenssin alla. Löydät kolmannen osapuolen tekijänoikeustiedot alta.\n\nHuomautus: %MIT license% ei ole muuttuja ja se on suomennettava. The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Tekijänoikeus Haiku-koodiin on Haiku, Inc.-yrityksen tai vastaavien lähdekoodissa nimenomaisesti ilmaistujen tekijöiden omaisuutta. Haiku™ ja Haiku logo® ovat Haiku, Inc. -yrityksen (rekisteröityjä) tavaramerkkejä.\n\n Time running: AboutView Käynnissäoloaika: Translations:\n AboutView Käännökset:\n diff --git a/data/catalogs/apps/aboutsystem/fr.catkeys b/data/catalogs/apps/aboutsystem/fr.catkeys index 33de8d6cf5..73602d8bf2 100644 --- a/data/catalogs/apps/aboutsystem/fr.catkeys +++ b/data/catalogs/apps/aboutsystem/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-About 128117018 +1 french x-vnd.Haiku-About 282658629 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d Mio au total %d MiB used (%d%%) AboutView %d Mio utilisés (%d%%) @@ -70,7 +70,6 @@ The BeGeistert team\n AboutView L'équipe BeGeistert\n The Haiku-Ports team\n AboutView L'équipe de Haiku-Ports\n The Haikuware team and their bounty program\n AboutView L'équipe Haikuware et son programme de récompenses\n The University of Auckland and Christof Lutteroth\n\n AboutView L'université d'Auckland et Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Le code source spécifique à Haiku, en particulier, celui du noyau et des applications liées, est distribué suivant les termes de la %licence MIT%. Quelques librairies systèmes contiennent du code tiers, distribué sous licence LGPL. Vous pouvez trouver les copyrights de ce code ci-dessous. The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Les droits d'auteurs sur le code d'Haiku sont la propriété d'Haiku, Inc ou de ses auteurs respectifs, conformément à ce qui est expressément indiqué dans les sources. Haiku™ et le logo HAIKU ® sont des marques (déposées) de Haiku, Inc\n\n Time running: AboutView Temps depuis le démarrage : Translations:\n AboutView Traductions :\n diff --git a/data/catalogs/apps/aboutsystem/it.catkeys b/data/catalogs/apps/aboutsystem/it.catkeys index 3c9ee5bf9b..d0fc4acba5 100644 --- a/data/catalogs/apps/aboutsystem/it.catkeys +++ b/data/catalogs/apps/aboutsystem/it.catkeys @@ -1,4 +1,4 @@ -1 italian x-vnd.Haiku-About 3149623567 +1 italian x-vnd.Haiku-About 3304165178 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB totali %d MiB used (%d%%) AboutView %d MiB utilizzati (%d%%) @@ -24,7 +24,6 @@ The BeGeistert team\n AboutView Il team del BeGeistert\n The Haiku-Ports team\n AboutView Il team di Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Il team di Haikuware e il loro programma di bounty\n The University of Auckland and Christof Lutteroth\n\n AboutView L'Università di Auckland e Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Il codice che è unico di Haiku, in particolare il kernel e tutto il codice che le applicazioni possono linkare, è distribuito secondo i termini della %licenza MIT%. Alcune librerie di sistema contengono codice di terze parti distribuito sotto licenza LGPL. È possibile trovare il copyright del codice di terze parti qui sotto.\n\n Time running: AboutView Tempo dall'avvio: Translations:\n AboutView Traduzioni:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (e il suo kernel NewOS)\n diff --git a/data/catalogs/apps/aboutsystem/ja.catkeys b/data/catalogs/apps/aboutsystem/ja.catkeys index 963b9f78f2..546a08a83a 100644 --- a/data/catalogs/apps/aboutsystem/ja.catkeys +++ b/data/catalogs/apps/aboutsystem/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-About 128117018 +1 japanese x-vnd.Haiku-About 1344586426 %.2f GHz AboutView %.2f GHz %d MiB total AboutView 合計 %d MiB %d MiB used (%d%%) AboutView %d MiB 使用中 (%d%%) @@ -6,11 +6,12 @@ %ld Processors: AboutView %ld プロセッサー: %total MiB total, %inaccessible MiB inaccessible AboutView 合計 %total MiB / %inaccessible MiB アクセス不可 ... and the many people making donations!\n\n AboutView ...寄付をしていただいた大勢の方々!\n\n +2001 by Andy Ritger based on the Generalized Timing Formula AboutView 2001 by Andy Ritger based on the Generalized Timing Formula About this system AboutWindow このシステムについて AboutSystem System name このシステムについて -BSD (2-clause) AboutView BSD (第2条) -BSD (3-clause) AboutView BSD (第3条) -BSD (4-clause) AboutView BSD (第4条) +BSD (2-clause) AboutView BSD (2条項) +BSD (3-clause) AboutView BSD (3条項) +BSD (4-clause) AboutView BSD (4条項) Be Inc. and its developer team, for having created BeOS!\n\n AboutView Be Inc. およびその開発チーム: 彼らはBeOSを創造してくれました! Contains software developed by the NetBSD Foundation, Inc. and its contributors:\nftp, tput\nCopyright © 1996-2008 The NetBSD Foundation, Inc. All rights reserved. AboutView 次のソフトウェアはNetBSD Foundation, Inc.およびその貢献者らにより開発されたソフトウェアを含みます:\nftp, tput\nCopyright © 1996-2008 The NetBSD Foundation, Inc. All rights reserved. Contains software from the FreeBSD Project, released under the BSD license:\ncal, ftpd, ping, telnet, telnetd, traceroute\nCopyright © 1994-2008 The FreeBSD Project. All rights reserved. AboutView 次のソフトウェアはFreeBSD Projectで開発され、BSDライセンスで公開されているソフトウェアを含みます:\ncal, ftpd, ping, telnet, telnetd, traceroute\nCopyright © 1994-2008 The FreeBSD Project. All rights reserved. @@ -70,7 +71,6 @@ The BeGeistert team\n AboutView BeGeistert 展チーム\n The Haiku-Ports team\n AboutView Haiku-Ports チーム\n The Haikuware team and their bounty program\n AboutView Haikuware チーム&報奨金プログラム\n The University of Auckland and Christof Lutteroth\n\n AboutView Auckland 大学 と Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Haiku 特有のコード、特にカーネルとカーネルにリンクするアプリケーションのコードは、%MIT licence%で公開しています。一部のシステムライブラリが LPGL ライセンスで公開されている第三者が作のコードを含めています。第三者の著作権情報は下記に記載されています。\n\n The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Haikuのコードの著作権はHaiku, Inc.または各ソースコードに明示された個々の著者に帰属します。Haiku™およびHAIKUロゴ・マーク®はHaiku, Inc.の(登録)商標です。 Time running: AboutView 稼動時間: Translations:\n AboutView 各国語翻訳:\n diff --git a/data/catalogs/apps/aboutsystem/lt.catkeys b/data/catalogs/apps/aboutsystem/lt.catkeys index 97ce15984a..aadfa86d51 100644 --- a/data/catalogs/apps/aboutsystem/lt.catkeys +++ b/data/catalogs/apps/aboutsystem/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-About 3149623567 +1 lithuanian x-vnd.Haiku-About 3304165178 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB iš viso %d MiB used (%d%%) AboutView %d MiB naudojama (%d%%) @@ -24,7 +24,6 @@ The BeGeistert team\n AboutView „BeGeistert“ komandai\n The Haiku-Ports team\n AboutView „Haiku-Ports“ komandai\n The Haikuware team and their bounty program\n AboutView „Haikuware“ komandai ir jos premijavimo programai\n The University of Auckland and Christof Lutteroth\n\n AboutView Oklando universitetui ir Kristofui Luterotui\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Pirminiai tekstai, naudojami išimtinai „Haiku“, ypač branduolio bei visas kodas su kuriuo galima saistyti programas, platinamas pagal %MIT licence%. Kai kuriose sistemos bibliotekose yra trečiųjų šalių kodo, platinamo LGPL licenzijos sąlygomis. Trečiųjų šalių kodo autorių teisės yra išvardintos žemiau žemiau.\n\n Time running: AboutView Veikimo laikas: Translations:\n AboutView Vertimai:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Traviui Geiselbrecht (bei jo NewOS branduoliui)\n diff --git a/data/catalogs/apps/aboutsystem/nb.catkeys b/data/catalogs/apps/aboutsystem/nb.catkeys index f3bb605826..7d9509c873 100644 --- a/data/catalogs/apps/aboutsystem/nb.catkeys +++ b/data/catalogs/apps/aboutsystem/nb.catkeys @@ -1,4 +1,4 @@ -1 norwegian_bokmål x-vnd.Haiku-About 128117018 +1 norwegian_bokmål x-vnd.Haiku-About 282658629 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB totalt %d MiB used (%d%%) AboutView %d MiB brukt (%d%%) @@ -70,7 +70,6 @@ The BeGeistert team\n AboutView BeGeistert-teamet\n The Haiku-Ports team\n AboutView Haiku-Ports-teamet\n The Haikuware team and their bounty program\n AboutView Haikuware-teamet og deres dusørprogram\n The University of Auckland and Christof Lutteroth\n\n AboutView University of Auckland og Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Koden som er unik for Haiku, særlig kjernen og all kode som applikasjoner kan lenkes til, distribueres under %MIT-lisensen%. Noen systembiblioteker inneholder kode fra tredjepart som distribueres under LGPL-lisensen. Opphavsrettighetene til tredjepartskode finner du nedenfor.\n\n The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Opphavsretten til Haiku-koden tilhører Haiku, Inc. eller de respektive forfattere der det er uttrykkelig nevnt i kildekoden. Haiku™ og HAIKU-logoen® er (registrerte) varemerker tilhørende Haiku, Inc.\n\n Time running: AboutView Oppetid: Translations:\n AboutView Oversettelse:\n diff --git a/data/catalogs/apps/aboutsystem/nl.catkeys b/data/catalogs/apps/aboutsystem/nl.catkeys index 2ca54f9646..dcd0db3cc2 100644 --- a/data/catalogs/apps/aboutsystem/nl.catkeys +++ b/data/catalogs/apps/aboutsystem/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch x-vnd.Haiku-About 2763068380 +1 dutch x-vnd.Haiku-About 2917609991 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB totaal %d MiB used (%d%%) AboutView %d MiB gebruikt (%d%%) @@ -24,7 +24,6 @@ The BeGeistert team\n AboutView Het BeGeistert-team\n The Haiku-Ports team\n AboutView Het Haiku-Ports-team\n The Haikuware team and their bounty program\n AboutView Het Haikuware-team en hun bountyprogramma\n The University of Auckland and Christof Lutteroth\n\n AboutView De Universiteit van Auckland en Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView De code die uniek van Haiku is, in het bijzonder de kernel en alle code waar applicaties naar kunnen linken, wordt verspreid onder de %MIT-licence%. Sommige systeembibliotheken bevatten code van een derde partij, verspreid onder de LGPL-licentie. U kunt de copyrights van de code van derde partijen hieronder vinden.\n\n Time running: AboutView Looptijd: Translations:\n AboutView Vertalingen:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (en zijn NewOS kernel)\n diff --git a/data/catalogs/apps/aboutsystem/pl.catkeys b/data/catalogs/apps/aboutsystem/pl.catkeys index 9dedf6389a..23e758ba7d 100644 --- a/data/catalogs/apps/aboutsystem/pl.catkeys +++ b/data/catalogs/apps/aboutsystem/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-About 3149623567 +1 polish x-vnd.Haiku-About 3304165178 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB ogółem %d MiB used (%d%%) AboutView %d MiB użyte (%d%%) @@ -24,7 +24,6 @@ The BeGeistert team\n AboutView Grupy BeGeistert\n The Haiku-Ports team\n AboutView Zespółu Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Zespółu Haikuware i ich program nagród\n The University of Auckland and Christof Lutteroth\n\n AboutView Uniwersytetu w Auckland oraz Christofa Lutterotha -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Kod unikalny dla projektu Haiku, w szczególności jądro systemu oraz kod źródłowy, do którego odwołują się aplikacje systemowe, jest udostępniany na licencji %MIT licence%. Część bibliotek systemowych zawiera kod źródłowy stron trzecich, dystrybuowany na zasadach licencji LGPL. Prawa autorskie do kodu stron trzecich możesz znaleźć na liście poniżej.\n\n Time running: AboutView Czas działania: Translations:\n AboutView Tłumaczenie:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (i jego kernela NewOS)\n diff --git a/data/catalogs/apps/aboutsystem/pt_br.catkeys b/data/catalogs/apps/aboutsystem/pt_br.catkeys index b2d0ae4f41..04d832b20e 100644 --- a/data/catalogs/apps/aboutsystem/pt_br.catkeys +++ b/data/catalogs/apps/aboutsystem/pt_br.catkeys @@ -1,4 +1,4 @@ -1 brazilian_portuguese x-vnd.Haiku-About 2709881985 +1 brazilian_portuguese x-vnd.Haiku-About 2864423596 %d MiB used (%d%%) AboutView %d MiB usados (%d%%) %total MiB total, %inaccessible MiB inaccessible AboutView %total MiB total, %inaccessible MiB inacessíveis ... and the many people making donations!\n\n AboutView ... e as muitas pessoas que fizeram doações!\n\n @@ -11,7 +11,6 @@ Source Code: AboutView Código fonte: The BeGeistert team\n AboutView A equipe BeGeistert\n The Haiku-Ports team\n AboutView A equipe Haiku-Ports\n The Haikuware team and their bounty program\n AboutView A equipe do Haikuware e o seu programa de recompensas\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Este código do Haiku é único, especialmente o kernel e todo o código que pode ser ligado nos aplicativos, são distribuídos sob os termos da %MIT licence%. Algumas bibliotecas do sistema contém código de terceiros distribuído sob a licença LGPL. Você pode encontrar os direitos autorais para o código de terceiros abaixo.\n\n Time running: AboutView Tempo de funcionamento: Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (e seu kernel NewOS)\n Website, marketing & documentation:\n AboutView Website, marketing e documentação:\n diff --git a/data/catalogs/apps/aboutsystem/ro.catkeys b/data/catalogs/apps/aboutsystem/ro.catkeys index 15a66d4912..d4dbac2071 100644 --- a/data/catalogs/apps/aboutsystem/ro.catkeys +++ b/data/catalogs/apps/aboutsystem/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-About 128117018 +1 romanian x-vnd.Haiku-About 282658629 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB total %d MiB used (%d%%) AboutView %d MiB utilizați (%d%%) @@ -70,7 +70,6 @@ The BeGeistert team\n AboutView Echipa BeGeistert\n The Haiku-Ports team\n AboutView Echipa Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Echipa Haikuware și programul lor de recompense\n The University of Auckland and Christof Lutteroth\n\n AboutView Universitatea Auckland și Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Codul sursă care este unic pentru Haiku, în special nucleul și întreg codul sursă utilizat de acesta, este distribuit utilizând termenii descriși de %MIT licence%. O parte din bibliotecile sistemului conțin cod sursă provenind de la terți distribuit sub licența LGPL. Puteți găsi mai jos mențiunile referitoare la drepturile de autor asupra codulului sursă provenit de la terți.\n\n The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Drepturile de autor ale codului Haiku sunt proprietăți ale Haiku, Inc. sau ale autorilor respectivi când este notat în mod special în sursă. Haiku™ și sigla® Haiku sunt mărci (înregistrate) ale Haiku, Inc.\n\n Time running: AboutView Rulează de: Translations:\n AboutView Traduceri:\n diff --git a/data/catalogs/apps/aboutsystem/sk.catkeys b/data/catalogs/apps/aboutsystem/sk.catkeys index 085a27dcf8..6cc23be1e1 100644 --- a/data/catalogs/apps/aboutsystem/sk.catkeys +++ b/data/catalogs/apps/aboutsystem/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-About 128117018 +1 slovak x-vnd.Haiku-About 282658629 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB celkom %d MiB used (%d%%) AboutView %d MiB využitých (%d%%) @@ -70,7 +70,6 @@ The BeGeistert team\n AboutView Tím BeGeistert\n The Haiku-Ports team\n AboutView Tím Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Tím Haikuware a ich program odmien\n The University of Auckland and Christof Lutteroth\n\n AboutView University of Auckland a Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Kód, ktorý je charakteristický pre Haiku, najmä jadro a kód, ktorý využívajú aplikácie môže byť šírený za podmienok %MIT licence%. Niektoré systémové knižnice obsahujú kód tretích strán šírený pod licenciou LGPL. Autorské práva tretích strán nájdete uvedené nižšie. The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Autorské práva ku kódu Haiku sú vlastníctvom Haiku, Inc. alebo jednotlivých autorov, kde sú v kóde výslovne uvedení. Haiku™ a logo HAIKU® sú (registrované) obchodné známky Haiku, Inc.\n\n Time running: AboutView Čas behu: Translations:\n AboutView Preklady:\n diff --git a/data/catalogs/apps/aboutsystem/sv.catkeys b/data/catalogs/apps/aboutsystem/sv.catkeys index ce9b984181..8a7538375b 100644 --- a/data/catalogs/apps/aboutsystem/sv.catkeys +++ b/data/catalogs/apps/aboutsystem/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-About 128117018 +1 swedish x-vnd.Haiku-About 3091539351 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB totalt %d MiB used (%d%%) AboutView %d MiB använt (%d%%) @@ -6,6 +6,7 @@ %ld Processors: AboutView %ld Processorer: %total MiB total, %inaccessible MiB inaccessible AboutView %total MiB totalt, %inaccessible MiB otillgängligt ... and the many people making donations!\n\n AboutView ...och alla de som har skänkt pengar!\n\n +2001 by Andy Ritger based on the Generalized Timing Formula AboutView 2001 av Andy Ritger, baserat på generaliserad tidsformel About this system AboutWindow Om Haiku AboutSystem System name OmHaiku BSD (2-clause) AboutView BSD (2-klausul) @@ -70,7 +71,7 @@ The BeGeistert team\n AboutView BeGeistert-teamet\n The Haiku-Ports team\n AboutView Haiku Ports-teamet\n The Haikuware team and their bounty program\n AboutView Haikuware-teamet och deras belöningsprogram\n The University of Auckland and Christof Lutteroth\n\n AboutView The University of Auckland och Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Koden som är unik för Haiku, speciellt kärnan och all kod som applikationer kan länka till, är distribuerad under villkoren av %MIT licence%. Vissa systembibliotek kan innehålla kod från tredjepart distribuerad under LGPL licensen. Här under kan du finna upphovsrätten till kod från tredjepart.\n\n +The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Koden som är unik för Haiku, särskilt kärnan och all kod som program länkar mot, är distribuerad under villkoren hos %MIT licensen%. Några systembibliotek innehåller tredjepartskod distribuerat under villkoren för LGPL licensen. Du kan finna upphovsrättsvillkoren för tredjepartskod nedan.\n\n The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Upphovsrätten till Haikus källkod är en egendom tillhörande Haiku, Inc eller dess respektive skapare där det uttryckligen är angivet i källkoden. Haiku™ och HAIKU logotyp® är (registrerade) varumärken tillhörande Haiku, Inc.\n\n Time running: AboutView Tid sedan uppstart: Translations:\n AboutView Översättningar:\n diff --git a/data/catalogs/apps/aboutsystem/zh_hans.catkeys b/data/catalogs/apps/aboutsystem/zh_hans.catkeys index b4ca6cfea3..5bcccd9172 100644 --- a/data/catalogs/apps/aboutsystem/zh_hans.catkeys +++ b/data/catalogs/apps/aboutsystem/zh_hans.catkeys @@ -1,4 +1,4 @@ -1 simplified_chinese x-vnd.Haiku-About 3511832710 +1 simplified_chinese x-vnd.Haiku-About 3666374321 %.2f GHz AboutView %.2f GHz %d MiB total AboutView 总计%d MiB %d MiB used (%d%%) AboutView 已用 %d MiB (%d%%) @@ -69,7 +69,6 @@ The BeGeistert team\n AboutView BeGeistert 小组 \n The Haiku-Ports team\n AboutView Haiku-Ports 小组\n The Haikuware team and their bounty program\n AboutView Haikuware 小组及其维护程序\n The University of Auckland and Christof Lutteroth\n\n AboutView 奥克兰大学与 Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView 专用于 Haiku 的代码在 %MIT协议% 下发布,特别是内核与所有应用程序可能链接使用的代码。某些系统库可能包含在 LGPL协议 下发布的第三方代码。在下面的介绍中,您可以找到第三方代码所使用的授权协议。\n\n The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Haiku 源代码版权是 Haiku, Inc 和源码中声明的贡献者所拥有的财产。Haiku™ 和 HAIKU logo® 是 Haiku, Inc 的(注册)商标。\n\n Time running: AboutView 运行时间: Translations:\n AboutView 翻译:\n diff --git a/data/catalogs/apps/charactermap/de.catkeys b/data/catalogs/apps/charactermap/de.catkeys index 8e8d474c82..072b916e33 100644 --- a/data/catalogs/apps/charactermap/de.catkeys +++ b/data/catalogs/apps/charactermap/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-CharacterMap 2137207616 +1 german x-vnd.Haiku-CharacterMap 4082916013 Aegean numbers UnicodeBlocks Ägäische Zahlen Alphabetic presentation forms UnicodeBlocks Alphabetische Präsentationsformen Ancient Greek musical notation UnicodeBlocks Antike griechische musikalische Notation @@ -43,6 +43,8 @@ Combining diacritical marks supplement UnicodeBlocks Kombinierende diakritische Combining half marks UnicodeBlocks Kombinierende halbe diakritische Zeichen Control pictures UnicodeBlocks Steuerzeichensymbole Coptic UnicodeBlocks Koptisch +Copy as escaped byte string CharacterView Zeichen als Byte-Code kopieren +Copy character CharacterView Zeichen kopieren Counting rod numerals UnicodeBlocks Rechenstab-Numerale Cuneiform UnicodeBlocks Keilschrift Cuneiform numbers and punctuation UnicodeBlocks Keilförmige Nummern und Zeichensetzung diff --git a/data/catalogs/apps/charactermap/fr.catkeys b/data/catalogs/apps/charactermap/fr.catkeys index 7e06881c96..74ac34c095 100644 --- a/data/catalogs/apps/charactermap/fr.catkeys +++ b/data/catalogs/apps/charactermap/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-CharacterMap 1169041226 +1 french x-vnd.Haiku-CharacterMap 1451954922 Aegean numbers UnicodeBlocks Nombres égéens Alphabetic presentation forms UnicodeBlocks Formes de présentation alphabétiques Ancient Greek musical notation UnicodeBlocks Musique grecque ancienne @@ -22,20 +22,23 @@ Buhid UnicodeBlocks Bouhid Byzantine musical symbols UnicodeBlocks Symboles musicaux byzantins CJK compatibility UnicodeBlocks Compatibilité CJC CJK compatibility forms UnicodeBlocks Formes compatibles CJC -CJK compatibility ideographs UnicodeBlocks Idéogrammes CJC de compatibilité -CJK compatibility ideographs Supplement UnicodeBlocks Supplément idéogrammes CJC de compatibilité +CJK compatibility ideographs UnicodeBlocks Idéogrammes de compatibilité CJC +CJK compatibility ideographs Supplement UnicodeBlocks Supplément d'idéogrammes de compatibilité CJC CJK radicals supplement UnicodeBlocks Formes supplémentaires de clés CJC CJK strokes UnicodeBlocks Traits CJC CJK symbols and punctuation UnicodeBlocks Ponctuation CJC CJK unified ideographs UnicodeBlocks Idéogrammes unifiés CJC -CJK unified ideographs extension A UnicodeBlocks Supplément A idéogrammes unifiés CJC -CJK unified ideographs extension B UnicodeBlocks Supplément B idéogrammes unifiés CJC +CJK unified ideographs extension A UnicodeBlocks Supplément A aux idéogrammes unifiés CJC +CJK unified ideographs extension B UnicodeBlocks Supplément B aux idéogrammes unifiés CJC Carian UnicodeBlocks Carien Cham UnicodeBlocks Cham CharacterMap System name Table des caractères Cherokee UnicodeBlocks Chérokî Clear CharacterWindow Nettoyer Code CharacterWindow Code +Combining diacritical marks UnicodeBlocks Marques diacritiques d'association +Combining diacritical marks for symbols UnicodeBlocks Marques diacritiques d'association pour les symboles +Combining diacritical marks supplement UnicodeBlocks Supplément aux marques diacritiques d'association Combining half marks UnicodeBlocks Demi-signes combinatoires Control pictures UnicodeBlocks Pictogrammes de commande Coptic UnicodeBlocks Copte @@ -71,6 +74,7 @@ Greek and Coptic UnicodeBlocks Grec et Copte Greek extended UnicodeBlocks Grec étendu Gujarati UnicodeBlocks Goudjarati Gurmukhi UnicodeBlocks Gourmoukhî +Halfwidth and fullwidth forms UnicodeBlocks Formulaires demi-largeur et largeur complète Hangul Jamo UnicodeBlocks Jamos Hangûl Hangul compatibility Jamo UnicodeBlocks Jamos de compatibilité hangûl Hangul syllables UnicodeBlocks Syllabes hangûl @@ -111,7 +115,7 @@ Miscellaneous mathematical symbols B UnicodeBlocks Divers symboles mathématiqu Miscellaneous symbols UnicodeBlocks Symboles divers Miscellaneous symbols and arrows UnicodeBlocks Divers symboles et flèches Miscellaneous technical UnicodeBlocks Signes techniques divers -Modifier tone letters UnicodeBlocks Supplément de modificateurs de ton +Modifier tone letters UnicodeBlocks Lettres modificatives de ton Mongolian UnicodeBlocks Mongol Muscial symbols UnicodeBlocks Symboles musciaux Myanmar UnicodeBlocks Myanmar (Birman) @@ -121,6 +125,7 @@ Number forms UnicodeBlocks Formes numérales Ogham UnicodeBlocks Oġam Ol Chiki UnicodeBlocks Santâlî Old Persian UnicodeBlocks Perse ancien +Old italic UnicodeBlocks Italique ancien Optical character recognition UnicodeBlocks Reconnaissance optique de caractères Oriya UnicodeBlocks Oriyâ Osmanya UnicodeBlocks Osmanya @@ -138,6 +143,7 @@ Shavian UnicodeBlocks Shavien Show private blocks CharacterWindow Montrer les zones privées Sinhala UnicodeBlocks Singhalais Small form variants UnicodeBlocks Petites variantes de forme +Spacing modifier letters UnicodeBlocks Lettres modificatives d'espace Specials UnicodeBlocks Caractères spéciaux Sundanese UnicodeBlocks Soudanais Superscripts and subscripts UnicodeBlocks Exposants et indices diff --git a/data/catalogs/apps/charactermap/ja.catkeys b/data/catalogs/apps/charactermap/ja.catkeys index 9b94bc80df..c100c39e8c 100644 --- a/data/catalogs/apps/charactermap/ja.catkeys +++ b/data/catalogs/apps/charactermap/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-CharacterMap 2137207616 +1 japanese x-vnd.Haiku-CharacterMap 4082916013 Aegean numbers UnicodeBlocks エーゲ数字 Alphabetic presentation forms UnicodeBlocks アルファベット表示形 Ancient Greek musical notation UnicodeBlocks 古代ギリシャ記譜法 @@ -43,6 +43,8 @@ Combining diacritical marks supplement UnicodeBlocks 結合分音記号補助 Combining half marks UnicodeBlocks 半記号(合成可能) Control pictures UnicodeBlocks 制御機能用記号 Coptic UnicodeBlocks コプト文字 +Copy as escaped byte string CharacterView エスケープされた数値としてコピー +Copy character CharacterView 文字をコピー Counting rod numerals UnicodeBlocks 算木 Cuneiform UnicodeBlocks 楔形文字 Cuneiform numbers and punctuation UnicodeBlocks 楔形文字数字と句読点 diff --git a/data/catalogs/apps/charactermap/sk.catkeys b/data/catalogs/apps/charactermap/sk.catkeys index 4f7c3dbcc8..835ce542b4 100644 --- a/data/catalogs/apps/charactermap/sk.catkeys +++ b/data/catalogs/apps/charactermap/sk.catkeys @@ -1,28 +1,178 @@ -1 slovak x-vnd.Haiku-CharacterMap 2467880345 +1 slovak x-vnd.Haiku-CharacterMap 1331216786 +Aegean numbers UnicodeBlocks Egejské čísla +Alphabetic presentation forms UnicodeBlocks Varianty abecedných znakov +Ancient Greek musical notation UnicodeBlocks Starogrécky hudobný zápis +Ancient Greek numbers UnicodeBlocks Starogrécke čísla +Ancient smbols UnicodeBlocks Staroveké symboly +Arabic UnicodeBlocks Arabčina +Arabic presentation forms A UnicodeBlocks Varianty arabských znakov A +Arabic presentation forms B UnicodeBlocks Varianty arabských znakov B +Arabic supplement UnicodeBlocks Arabčina, dodatok +Armenian UnicodeBlocks Arménčina +Arrows UnicodeBlocks Šípky +Balinese UnicodeBlocks Balinézske +Basic Latin UnicodeBlocks Latinka - základné znaky +Bengali UnicodeBlocks Bengálčina Block elements UnicodeBlocks Blokové prvky +Bopomofo UnicodeBlocks Bopomofo +Bopomofo extended UnicodeBlocks Bopomofo - ďalšie znaky +Box drawing UnicodeBlocks Kreslenie rámčekov +Braille patterns UnicodeBlocks Braillove vzory +Buginese UnicodeBlocks Buginézština +Buhid UnicodeBlocks Buhidčina +Byzantine musical symbols UnicodeBlocks Byzantské hudobné symboly +CJK compatibility UnicodeBlocks ČJK - kompatibilné formáty +CJK compatibility forms UnicodeBlocks ČJK - kompatibilné varianty +CJK compatibility ideographs UnicodeBlocks ČJK - kompatibilné idiogramy +CJK compatibility ideographs Supplement UnicodeBlocks ČJK - kompatibilné idiogramy, doplnok +CJK radicals supplement UnicodeBlocks ČJK – radikály, dodatok +CJK strokes UnicodeBlocks Ťahy ČJK +CJK symbols and punctuation UnicodeBlocks ČJK symboly a intepunkcia +CJK unified ideographs UnicodeBlocks Zjednotené ideogramy pre ČJK +CJK unified ideographs extension A UnicodeBlocks Zjednotené ideogramy pre ČJK, rozšírenie A +CJK unified ideographs extension B UnicodeBlocks Zjednotené ideogramy pre ČJK, rozšírenie B +Carian UnicodeBlocks Carian +Cham UnicodeBlocks Cham CharacterMap System name Mapa znakov +Cherokee UnicodeBlocks Cherokee Clear CharacterWindow Vyčistiť Code CharacterWindow Kód Combining diacritical marks UnicodeBlocks Kombinujúce diakritické značky Combining diacritical marks for symbols UnicodeBlocks Kombinujúce diakritické značky pre symboly Combining diacritical marks supplement UnicodeBlocks Kombinujúce diakritické značky - doplnok Combining half marks UnicodeBlocks Kombinujúce poloznačky +Control pictures UnicodeBlocks Riadiace obrázky +Coptic UnicodeBlocks Koptčina +Counting rod numerals UnicodeBlocks Tyčové číslovky +Cuneiform UnicodeBlocks Klinové písmo +Cuneiform numbers and punctuation UnicodeBlocks Klinové písmo - čísla a diakritika Currency symbols UnicodeBlocks Symboly mien +Cypriot syllabary UnicodeBlocks Cyperské slabičné písmo +Cyrillic UnicodeBlocks Cyrilika +Cyrillic extended A UnicodeBlocks Cyrillika, rozšírená A +Cyrillic extended B UnicodeBlocks Cyrillika, rozšírená A +Cyrillic supplement UnicodeBlocks Cyrilika, dodatok +Deseret UnicodeBlocks Deseret +Devanagari UnicodeBlocks Dévanágarí +Dingbats UnicodeBlocks Symboly a znaky dingbats Domino tiles UnicodeBlocks Kocky domino +Enclosed CJK letters and months UnicodeBlocks Uzavreté ČJK znaky a mesiace +Enclosed alphanumerics UnicodeBlocks Uzavreté alfanumerické znaky +Ethiopic UnicodeBlocks Etiópčina +Ethiopic extended UnicodeBlocks Etiópčina – ďalšie znaky +Ethiopic supplement UnicodeBlocks Etiópčina, dodatok File CharacterWindow Súbor Filter: CharacterWindow Filter: Font CharacterWindow Písmo -General punctuation UnicodeBlocks Všeobecná diakritika +Font size: CharacterWindow Veľksť písma: +General punctuation UnicodeBlocks Všeobecná intepunkcia Geometric shapes UnicodeBlocks Geometrické tvary +Georgian UnicodeBlocks Gruzínčina +Georgian supplement UnicodeBlocks Gruzínčina, dodatok +Gothic UnicodeBlocks Gotické +Greek and Coptic UnicodeBlocks Gréčtina a koptčina Off +Greek extended UnicodeBlocks Gréčtina - ďalšie znaky +Gujarati UnicodeBlocks Gudžarátčina +Gurmukhi UnicodeBlocks Gurumukhí +Halfwidth and fullwidth forms UnicodeBlocks Znaky s polovičnou a plnou šírkou +Hangul Jamo UnicodeBlocks Znaky jamo abecedy hangul +Hangul compatibility Jamo UnicodeBlocks Kompatibilné znaky jamo abecedy hangul +Hangul syllables UnicodeBlocks Hangul - slabiky +Hanunoo UnicodeBlocks Hanunóo +Hebrew UnicodeBlocks Hebrejčina +Hiragana UnicodeBlocks Hiragana +IPA extensions UnicodeBlocks Znaky fonetickej abecedy IPA +Ideographic description characters UnicodeBlocks Ideografické popisné znaky +Kanbun UnicodeBlocks Kanbun +Kangxi radicals UnicodeBlocks Kandži – radikály +Kannada UnicodeBlocks Kannadčina +Katakana UnicodeBlocks Katakana +Katakana phonetic extensions UnicodeBlocks Katakana - fonetické rozšírenia +Kayah Li UnicodeBlocks Kayah Li +Kharoshthi UnicodeBlocks Kharoshthi +Khmer UnicodeBlocks Khmérčina +Khmer symbols UnicodeBlocks Khmérske symboly +Lao UnicodeBlocks Laoština +Latin extended A UnicodeBlocks Rozšírená latinka A +Latin extended B UnicodeBlocks Rozšírená latinka B +Latin extended C UnicodeBlocks Rozšírená latinka C +Latin extended D UnicodeBlocks Rozšírená latinka D +Latin extended additional UnicodeBlocks Rozšírená latinka, dodatok +Latin-1 supplement UnicodeBlocks Latinka-1, dodatok +Lepcha UnicodeBlocks Lepcha Letterlike symbols UnicodeBlocks Symboly podpobné písmenám +Limbu UnicodeBlocks Limbu +Linear B ideograms UnicodeBlocks Lineárne písmo B - ideogramy +Linear B syllabary UnicodeBlocks Lineárne písmo B - slabičné písmo +Lycian UnicodeBlocks Lycian +Lydian UnicodeBlocks Lydian +Mahjong tiles UnicodeBlocks Dlaždice Mahjong +Malayalam UnicodeBlocks Malajálamčina +Mathematical alphanumeric symbols UnicodeBlocks Matematické alfanumerické symboly Mathematical operators UnicodeBlocks Matematické operátory +Miscellaneous mathematical symbols A UnicodeBlocks Rozličné matematické symboly A +Miscellaneous mathematical symbols B UnicodeBlocks Rozličné matematické symboly B Miscellaneous symbols UnicodeBlocks Rozličné symboly +Miscellaneous symbols and arrows UnicodeBlocks Rôzne symboly a šípky Miscellaneous technical UnicodeBlocks Rozličné technické +Modifier tone letters UnicodeBlocks Písmená modifikátorov tónu +Mongolian UnicodeBlocks Mongolské +Muscial symbols UnicodeBlocks Hudobné symboly +Myanmar UnicodeBlocks Mjanmarčina +N'Ko UnicodeBlocks N'Ko +New Tai Lue UnicodeBlocks New Tai Lue Number forms UnicodeBlocks Číselné tvary +Ogham UnicodeBlocks Ogam +Ol Chiki UnicodeBlocks Ol Chiki +Old Persian UnicodeBlocks Staroperzské +Old italic UnicodeBlocks Starotalianske Optical character recognition UnicodeBlocks Optické rozpoznávanie znakov +Oriya UnicodeBlocks Uríjčina +Osmanya UnicodeBlocks Osmanya +Phags-pa UnicodeBlocks Phags-pa +Phaistos disc UnicodeBlocks Disk z Faistu +Phoenician UnicodeBlocks Fenické +Phonetic extensions UnicodeBlocks Fonetické rozšírenia +Phonetic extensions supplement UnicodeBlocks Fonetické rozšírenia, doplnok Private use area UnicodeBlocks Oblasť na súkromné použitie +Quit CharacterWindow Ukončiť +Rejang UnicodeBlocks Rejang +Runic UnicodeBlocks Runy +Saurashtra UnicodeBlocks Saurashtra +Shavian UnicodeBlocks Shavianské Show private blocks CharacterWindow Zobrziť privátne bloky +Sinhala UnicodeBlocks Sinhalčina +Small form variants UnicodeBlocks Malé varianty znakov +Spacing modifier letters UnicodeBlocks Písmená na úpravu medzier +Specials UnicodeBlocks Špeciálne znaky +Sundanese UnicodeBlocks Sundčina Superscripts and subscripts UnicodeBlocks Horné a dolné indexy +Supplement punctuation UnicodeBlocks Doplnková intepunkcia +Supplemental arrows A UnicodeBlocks Šípky, doplnok A +Supplemental arrows B UnicodeBlocks Šípky, doplnok B +Supplemental mathematical operators UnicodeBlocks Doplnkové matematické operátory +Supplementary private use area A UnicodeBlocks Doplnková oblasť A pre súkromné použitie +Supplementary private use area B UnicodeBlocks Doplnková oblasť A pre súkromné použitie +Syloti Nagri UnicodeBlocks Syloti Nagri +Syriac UnicodeBlocks Sýrčina +Tagalog UnicodeBlocks Tagalčina +Tagbanwa UnicodeBlocks Tagbanwa Tags UnicodeBlocks Značky +Tai Le UnicodeBlocks Tai Le +Tai Xuan Jing symbols UnicodeBlocks Symboly Tai Xuan Jing +Tamil UnicodeBlocks Tamilčina +Telugu UnicodeBlocks Telugčina +Thaana UnicodeBlocks Thaana +Thai UnicodeBlocks Thajčina +Tibetan UnicodeBlocks Tibetčina +Tifinagh UnicodeBlocks Tifinagh +Ugaritic UnicodeBlocks Ugaritské +Unified Canadian Aboriginal syllabics UnicodeBlocks Zjednotené slabikotvorné hlásky kanadských pôvodných obyvateľov +Vai UnicodeBlocks Vai +Variation selectors UnicodeBlocks Selektory variácií +Variation selectors supplement UnicodeBlocks Selektory variácií, dodatok Vertical forms UnicodeBlocks Zvislé tvary View CharacterWindow Zobraziť +Yi Radicals UnicodeBlocks Yi - radikály +Yi syllables UnicodeBlocks Yi - slabiky +Yijing hexagram symbols UnicodeBlocks Yijing – šesťcípe symboly diff --git a/data/catalogs/apps/charactermap/sv.catkeys b/data/catalogs/apps/charactermap/sv.catkeys index ce751ccd69..744048c2e8 100644 --- a/data/catalogs/apps/charactermap/sv.catkeys +++ b/data/catalogs/apps/charactermap/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-CharacterMap 2137207616 +1 swedish x-vnd.Haiku-CharacterMap 2426642683 Aegean numbers UnicodeBlocks Egeiska siffror Alphabetic presentation forms UnicodeBlocks Alfabetiska presentationsformer Ancient Greek musical notation UnicodeBlocks Gammelgrekiska noter @@ -43,6 +43,7 @@ Combining diacritical marks supplement UnicodeBlocks Kombinerade diakritiska te Combining half marks UnicodeBlocks Kombinerade halvmarkörer Control pictures UnicodeBlocks Kontrollbilder Coptic UnicodeBlocks Koptisk +Copy character CharacterView Kopiera tecken Counting rod numerals UnicodeBlocks Räknestavssiffror Cuneiform UnicodeBlocks Kilskrift Cuneiform numbers and punctuation UnicodeBlocks Kilskrift (siffror och interpunktioner) diff --git a/data/catalogs/apps/deskbar/be.catkeys b/data/catalogs/apps/deskbar/be.catkeys index ccf99ea9a9..ec12a0d912 100644 --- a/data/catalogs/apps/deskbar/be.catkeys +++ b/data/catalogs/apps/deskbar/be.catkeys @@ -1,6 +1,5 @@ -1 belarusian x-vnd.Be-TSKB 1962084612 +1 belarusian x-vnd.Be-TSKB 2472557472 BeMenu -About Haiku BeMenu Пра Haiku Always on top PreferencesWindow Заўсёды наверсе Applications B_USER_DESKBAR_DIRECTORY/Applications Праграмы Applications PreferencesWindow Праграмы diff --git a/data/catalogs/apps/deskbar/cs.catkeys b/data/catalogs/apps/deskbar/cs.catkeys index a4d352653c..00bbba0174 100644 --- a/data/catalogs/apps/deskbar/cs.catkeys +++ b/data/catalogs/apps/deskbar/cs.catkeys @@ -1,6 +1,5 @@ -1 czech x-vnd.Be-TSKB 2722191795 +1 czech x-vnd.Be-TSKB 3232664655 BeMenu -About Haiku BeMenu O Haiku Always on top PreferencesWindow Vždy na vrchu Applications PreferencesWindow Aplikace Auto-raise PreferencesWindow Automatické zvětšení diff --git a/data/catalogs/apps/deskbar/de.catkeys b/data/catalogs/apps/deskbar/de.catkeys index b2739ae365..53890eb021 100644 --- a/data/catalogs/apps/deskbar/de.catkeys +++ b/data/catalogs/apps/deskbar/de.catkeys @@ -1,10 +1,10 @@ -1 german x-vnd.Be-TSKB 1465644101 +1 german x-vnd.Be-TSKB 4265681964 BeMenu -About Haiku BeMenu Über Haiku +About this system BeMenu Über dieses System Always on top PreferencesWindow Immer im Vordergrund Applications B_USER_DESKBAR_DIRECTORY/Applications Anwendungen Applications PreferencesWindow Anwendungen -Auto-hide PreferencesWindow Automatisch in den Hintergrund +Auto-hide PreferencesWindow Automatisch ausblenden Auto-raise PreferencesWindow Automatisch nach vorn holen Change time… TimeView Uhrzeit ändern… Clock PreferencesWindow Uhr diff --git a/data/catalogs/apps/deskbar/fr.catkeys b/data/catalogs/apps/deskbar/fr.catkeys index b1727deab2..4867d932e6 100644 --- a/data/catalogs/apps/deskbar/fr.catkeys +++ b/data/catalogs/apps/deskbar/fr.catkeys @@ -1,6 +1,5 @@ -1 french x-vnd.Be-TSKB 1962084612 +1 french x-vnd.Be-TSKB 2472557472 BeMenu -About Haiku BeMenu À propos d'Haiku Always on top PreferencesWindow Toujours au dessus Applications B_USER_DESKBAR_DIRECTORY/Applications Applications Applications PreferencesWindow Applications diff --git a/data/catalogs/apps/deskbar/ja.catkeys b/data/catalogs/apps/deskbar/ja.catkeys index e6f8bff90f..eb5db436ad 100644 --- a/data/catalogs/apps/deskbar/ja.catkeys +++ b/data/catalogs/apps/deskbar/ja.catkeys @@ -1,9 +1,10 @@ -1 japanese x-vnd.Be-TSKB 1962084612 +1 japanese x-vnd.Be-TSKB 4265681964 BeMenu -About Haiku BeMenu Haiku について +About this system BeMenu このシステムについて Always on top PreferencesWindow 常に手前に Applications B_USER_DESKBAR_DIRECTORY/Applications アプリケーション Applications PreferencesWindow アプリケーション +Auto-hide PreferencesWindow 自動的に隠す Auto-raise PreferencesWindow マウスオーバーで手前に Change time… TimeView 日付と時刻の設定… Clock PreferencesWindow 日付と時刻 diff --git a/data/catalogs/apps/deskbar/nb.catkeys b/data/catalogs/apps/deskbar/nb.catkeys index 8678354ca9..bf06de07fb 100644 --- a/data/catalogs/apps/deskbar/nb.catkeys +++ b/data/catalogs/apps/deskbar/nb.catkeys @@ -1,6 +1,5 @@ -1 norwegian_bokmål x-vnd.Be-TSKB 1962084612 +1 norwegian_bokmål x-vnd.Be-TSKB 2472557472 BeMenu -About Haiku BeMenu Om Haiku Always on top PreferencesWindow Alltid øverst Applications B_USER_DESKBAR_DIRECTORY/Applications B_USER_DESKBAR_DIRECTORY/Programmer Applications PreferencesWindow Programmer diff --git a/data/catalogs/apps/deskbar/sk.catkeys b/data/catalogs/apps/deskbar/sk.catkeys index 6bf1a93426..39f9aa12ee 100644 --- a/data/catalogs/apps/deskbar/sk.catkeys +++ b/data/catalogs/apps/deskbar/sk.catkeys @@ -1,9 +1,10 @@ -1 slovak x-vnd.Be-TSKB 1962084612 +1 slovak x-vnd.Be-TSKB 4265681964 BeMenu -About Haiku BeMenu O Haiku +About this system BeMenu O tomto systéme Always on top PreferencesWindow Vždy na vrchu Applications B_USER_DESKBAR_DIRECTORY/Applications Aplikácie Applications PreferencesWindow Aplikácie +Auto-hide PreferencesWindow Automaticky skrývať Auto-raise PreferencesWindow Automaticky aktivovať Change time… TimeView Zmeniť čas... Clock PreferencesWindow Hodiny diff --git a/data/catalogs/apps/deskbar/sv.catkeys b/data/catalogs/apps/deskbar/sv.catkeys index 10df993961..b025fd4301 100644 --- a/data/catalogs/apps/deskbar/sv.catkeys +++ b/data/catalogs/apps/deskbar/sv.catkeys @@ -5,7 +5,7 @@ Always on top PreferencesWindow Alltid överst Applications B_USER_DESKBAR_DIRECTORY/Applications Program Applications PreferencesWindow Program Auto-hide PreferencesWindow Dölj automatiskt -Auto-raise PreferencesWindow Höj fönstret vid närkontakt +Auto-raise PreferencesWindow Höj vid närkontakt Change time… TimeView Ställ in tid... Clock PreferencesWindow Klocka Close all WindowMenu Stäng alla diff --git a/data/catalogs/apps/deskbar/zh_hans.catkeys b/data/catalogs/apps/deskbar/zh_hans.catkeys index f044ef3020..8c602af38b 100644 --- a/data/catalogs/apps/deskbar/zh_hans.catkeys +++ b/data/catalogs/apps/deskbar/zh_hans.catkeys @@ -1,6 +1,5 @@ -1 simplified_chinese x-vnd.Be-TSKB 1962084612 +1 simplified_chinese x-vnd.Be-TSKB 2472557472 BeMenu -About Haiku BeMenu 关于 Haiku Always on top PreferencesWindow 置顶 Applications B_USER_DESKBAR_DIRECTORY/Applications 应用程序 Applications PreferencesWindow 应用程序 diff --git a/data/catalogs/apps/installer/de.catkeys b/data/catalogs/apps/installer/de.catkeys index 84085ab6c4..0bdbb3719c 100644 --- a/data/catalogs/apps/installer/de.catkeys +++ b/data/catalogs/apps/installer/de.catkeys @@ -98,7 +98,7 @@ Welcome to the Haiku Installer!\n\n InstallerApp Herzlich Willkommen zum Haiku- With GRUB 2 the first logical partition always has the number \"5\", regardless of the number of primary partitions.\n\n InstallerApp Bei GRUB 2 besitzt die erste logische Partition immer die Nummer \"5\", unabhängig von der Anzahl primärer Partitionen.\n\n With GRUB it's: (hdN,n)\n\n InstallerApp Bei GRUB ist es: (hdN,n)\n\n Write boot sector InstallerWindow Bootsektor schreiben -Write boot sector to '%s' InstallerWindow Der Bootsektor wird auf '%s' geschrieben +Write boot sector to '%s' InstallerWindow Bootsektor auf '%s' schreiben You can see the correct partition in GParted for example.\n\n\n InstallerApp Die richtige Partition findet man beispielweise mit GParted.\n\n\n You can't install the contents of a disk onto itself. Please choose a different disk. InstallProgress Der Inhalt eines Laufwerks kann nicht auf sich selbst installiert werden. Bitte ein anderes Ziellaufwerk wählen. You'll note that GRUB uses a different naming strategy for hard drives than Linux.\n\n InstallerApp Wie man sieht, besitzt GRUB ein zu Linux unterschiedliches Benennungsschema für Festplatten.\n\n diff --git a/data/catalogs/apps/showimage/sk.catkeys b/data/catalogs/apps/showimage/sk.catkeys index 906fc7a09f..c590d9dbb8 100644 --- a/data/catalogs/apps/showimage/sk.catkeys +++ b/data/catalogs/apps/showimage/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-ShowImage 2105704395 +1 slovak x-vnd.Haiku-ShowImage 2479358163 %SECONDS seconds Menus Don't translate %SECONDS %SECONDS sekúnd Browse Menus Prechádzať Cancel ClosePrompt Zrušiť @@ -49,6 +49,7 @@ ShowImage System name ZobraziťObrázok Slide delay Menus Oneskorenie snímku Slide show Menus Prezentácia Stretch to window Menus Roztiahnuť do okna +The document '%s' (page %d) has been changed. Do you want to close the document? ClosePrompt Dokument „%s“ (stránka %d) bol zmenený. Chcete dokument zatvoriť? The document '%s' has been changed. Do you want to close the document? ClosePrompt Dokument „%s“ bol zmenený. Chcete dokument zatvoriť? The file '%s' could not be written. SaveToFile Súbor „%s“ nebolo možné zapísať. Undo Menus Vrátiť späť diff --git a/data/catalogs/apps/text_search/fi.catkeys b/data/catalogs/apps/text_search/fi.catkeys index 65e986dbb4..af33bac70c 100644 --- a/data/catalogs/apps/text_search/fi.catkeys +++ b/data/catalogs/apps/text_search/fi.catkeys @@ -1,5 +1,5 @@ 1 finnish x-vnd.Haiku.TextSearch 1180598828 -%APP_NAME couldn't open one or more folders. GrepWindow %APP_NAME ei voitu avata yhtä tai useampaa kansiota. +%APP_NAME couldn't open one or more folders. GrepWindow %APP_NAME ei voinut avata yhtä tai useampaa kansiota. %s: Not enough room to escape the filename. Grepper %s: Ei kylliksi tilaa tiedostonimen ohittamiseen. %s: There was a problem running grep. Grepper %s: Pulma grep-ohjelmaa suoritettaessa. Actions GrepWindow Toiminnot diff --git a/data/catalogs/kits/tracker/de.catkeys b/data/catalogs/kits/tracker/de.catkeys index 7c3b9d31d8..94ab6e33df 100644 --- a/data/catalogs/kits/tracker/de.catkeys +++ b/data/catalogs/kits/tracker/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-libtracker 2699246155 +1 german x-vnd.Haiku-libtracker 3486294898 %BytesPerSecond/s StatusWindow %BytesPerSecond/s %Ld B WidgetAttributeText %Ld B %Ld bytes WidgetAttributeText %Ld Bytes @@ -38,6 +38,7 @@ An item named \"%name\" already exists in this folder. Would you like to replace And FindPanel Und Are you sure you want to delete the selected item(s)? This operation cannot be reverted. FSUtils Sollen die ausgewählten Objekte wirklich gelöscht werden? Diese Aktion kann nicht rückgängig gemacht werden. Are you sure you want to move or copy the selected item(s) to this folder? PoseView Sollen die ausgewählten Dateien wirklich in diesen Ordner kopiert oder bewegt werden? +Arrange by ContainerWindow Icons ordnen nach Ask before delete SettingsView Vor dem Leeren nachfragen At %func \nfind_directory() failed. \nReason: %error TrackerInitialState Bei %func \nfind_directory() fehlgeschlagen \nGrund: %error Attributes ContainerWindow Attribute @@ -301,6 +302,7 @@ Resize to fit QueryContainerWindow Optimale Größe Resize to fit VolumeWindow Optimale Größe Restore ContainerWindow Wiederherstellen Restoring: StatusWindow Wiederherstellen von: +Reverse order ContainerWindow Reihenfolge umkehren Revert TrackerSettingsWindow Rückgängig Save FilePanelPriv Speichern Save FindPanel Speichern diff --git a/data/catalogs/kits/tracker/sk.catkeys b/data/catalogs/kits/tracker/sk.catkeys index e0f57abb12..9541822529 100644 --- a/data/catalogs/kits/tracker/sk.catkeys +++ b/data/catalogs/kits/tracker/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-libtracker 2178365750 +1 slovak x-vnd.Haiku-libtracker 2574176493 %BytesPerSecond/s StatusWindow %BytesPerSecond/s %Ld B WidgetAttributeText %Ld B %Ld bytes WidgetAttributeText %Ld bajtov @@ -137,7 +137,6 @@ Error copying folder \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Error creating link to \"%name\". FSUtils Chyba pri vytváraní odkazu „%name“ Error deleting items FSUtils Chyba pri mazaní položiek Error emptying Trash! FSUtils Chyba pri vyprázdňovaní Koša! -Error in regular expression:\n\n'%errstring' PoseView Chyba v regulárnom výraze:\n\n'%errstring' Error moving \"%name\" FSUtils Chyba pri presúvaní „%name“ Error moving \"%name\" to Trash. (%error) FSUtils Chyba pri presúvaní „%name“ do Koša. (%error) diff --git a/data/catalogs/kits/tracker/sv.catkeys b/data/catalogs/kits/tracker/sv.catkeys index 3416d8776e..b9c815424b 100644 --- a/data/catalogs/kits/tracker/sv.catkeys +++ b/data/catalogs/kits/tracker/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-libtracker 2699246155 +1 swedish x-vnd.Haiku-libtracker 3486294898 %BytesPerSecond/s StatusWindow %BytesPerSecond/s %Ld B WidgetAttributeText %Ld B %Ld bytes WidgetAttributeText %Ld byte @@ -38,6 +38,7 @@ An item named \"%name\" already exists in this folder. Would you like to replace And FindPanel Och Are you sure you want to delete the selected item(s)? This operation cannot be reverted. FSUtils Är du säker på att du vill radera de valda objekten? Denna operation kan inte ångras. Are you sure you want to move or copy the selected item(s) to this folder? PoseView Är du säker på att du vill flytta eller kopiera dom valda objekt(en) till denna mapp? +Arrange by ContainerWindow Sortera efter Ask before delete SettingsView Fråga innan borttagning At %func \nfind_directory() failed. \nReason: %error TrackerInitialState I %func \nfind_directory() misslyckades. \nOrsak: %error Attributes ContainerWindow Attribut @@ -301,6 +302,7 @@ Resize to fit QueryContainerWindow Anpassa Resize to fit VolumeWindow Skala till passform Restore ContainerWindow Återställ Restoring: StatusWindow Återställer: +Reverse order ContainerWindow Omvänd ordning Revert TrackerSettingsWindow Återställ Save FilePanelPriv Spara Save FindPanel Spara diff --git a/data/catalogs/preferences/appearance/de.catkeys b/data/catalogs/preferences/appearance/de.catkeys index 38d28dae98..525d07d5c3 100644 --- a/data/catalogs/preferences/appearance/de.catkeys +++ b/data/catalogs/preferences/appearance/de.catkeys @@ -1,8 +1,11 @@ -1 german x-vnd.Haiku-Appearance 3187486915 +1 german x-vnd.Haiku-Appearance 3577998894 +About DecorSettingsView Über +About Decerator DecorSettingsView Über Dekorator Antialiasing APRWindow Kantenglättung Antialiasing menu AntialiasingSettingsView Kantenglättungs-Menü Antialiasing type: AntialiasingSettingsView Kantenglättungstyp: Appearance System name Erscheinungsbild +Choose Decorator DecorSettingsView Dekorator wählen Colors APRWindow Farben Control background Colors tab Steuerelement - Hintergrund Control border Colors tab Steuerelement - Rahmen @@ -23,6 +26,7 @@ Menu item text Colors tab Menü - Text Monospaced fonts only AntialiasingSettingsView Nur nicht-proportionale Schriften Navigation base Colors tab Navigation - Grundfarbe Navigation pulse Colors tab Navigation - Leuchtfarbe +OK DecorSettingsView OK Off AntialiasingSettingsView Aus On AntialiasingSettingsView Ein Panel background Colors tab Oberfläche - Hintergrund @@ -39,5 +43,7 @@ Subpixel based anti-aliasing in combination with glyph hinting is not available Success Colors tab Erfolg Tooltip background Colors tab Tooltip - Hintergrund Tooltip text Colors tab Tooltip - Text +Window Decorator APRWindow Dekorator +Window Decorator: DecorSettingsView Fenster-Dekorator: Window tab Colors tab Reiter Window tab text Colors tab Reiter - Text diff --git a/data/catalogs/preferences/filetypes/sk.catkeys b/data/catalogs/preferences/filetypes/sk.catkeys index 75a1cea48e..5c1370a62e 100644 --- a/data/catalogs/preferences/filetypes/sk.catkeys +++ b/data/catalogs/preferences/filetypes/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-FileTypes 3046973565 +1 slovak x-vnd.Haiku-FileTypes 473999706 %1 application type Application Type Window %1 typ aplikácie %ld Application type%s could be removed. Application Types Window %ld Typ aplikácie %s možno ostrániť. %s file type FileType Window typ súboru %s @@ -49,6 +49,7 @@ Default application FileType Window Predvolená aplikácia Description FileTypes Window Popis Description: Application Types Window Popis: Description: FileTypes Window Popis: +Development Application Type Window Vývoj Development Application Types Window Vývojové Display as: Attribute Window Tracker offers different display modes for attributes. Zobraziť ako: Do you want to save the changes? Application Type Window Chcete uložiť zmeny? @@ -74,6 +75,7 @@ FileTypes request FileTypes Požiadavka Typy súborov FileTypes request FileTypes Window Požiadavka Typy súborov FileTypes request Preferred App Menu Požiadavka Typy súborov Final Application Type Window Finálne +Final Application Types Window Finálne Gamma Application Type Window Gama Gamma Application Types Window Gama Golden master Application Type Window Hlavný originál @@ -141,6 +143,7 @@ Signature: Application Types Window Podpis: Single launch Application Type Window Jednoduché spustenie Special: Attribute Window Špeciálne: Supported types Application Type Window Podporované typy +The application \"%s\" does not support this file type.\nAre you sure you want to set it anyway? Preferred App Menu Aplikácia „%s“ nepodporuje tento typ súboru.\nSte si istý, že ju chcete nastaviť napriek tomu? This file type already exists New File Type Window Tento typ súboru už existuje Type name: FileTypes Window Názov typu: Type: Attribute Window Typ: diff --git a/data/catalogs/preferences/mail/be.catkeys b/data/catalogs/preferences/mail/be.catkeys index 51bf0492fa..eec3bb7155 100644 --- a/data/catalogs/preferences/mail/be.catkeys +++ b/data/catalogs/preferences/mail/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Mail 2328315862 +1 belarusian x-vnd.Haiku-Mail 458432473 Account name: Config Views Імя акаунту Account name: E-Mail Імя акаунта: Account settings Config Views Наладкі акаунту @@ -42,7 +42,3 @@ While sending and receiving Config Window Пры адпраўцы і атрым days Config Window дзен hours Config Window гадзін minutes Config Window хвілін -never Config Window ніколі -· E-mail filters Config Window · Фільтры пошты -· Incoming Config Window · Прыходзячыя -· Outgoing Config Window · Зыходзячыя diff --git a/data/catalogs/preferences/mail/cs.catkeys b/data/catalogs/preferences/mail/cs.catkeys index 37e8eeedef..1e334f48f1 100644 --- a/data/catalogs/preferences/mail/cs.catkeys +++ b/data/catalogs/preferences/mail/cs.catkeys @@ -1,4 +1,4 @@ -1 czech x-vnd.Haiku-Mail 1290248466 +1 czech x-vnd.Haiku-Mail 3715332373 Account name: Config Views Název účtu: Account settings Config Views Nastavení účtu Accounts Config Window Úcty @@ -28,7 +28,3 @@ While sending and receiving Config Window Během odesílání a přijímání days Config Window dny hours Config Window hodiny minutes Config Window minut/y -never Config Window nikdy -· E-mail filters Config Window · filtry zpráv -· Incoming Config Window · Příchozí -· Outgoing Config Window · Odchozí diff --git a/data/catalogs/preferences/mail/de.catkeys b/data/catalogs/preferences/mail/de.catkeys index 5acd0d6d58..d162f74256 100644 --- a/data/catalogs/preferences/mail/de.catkeys +++ b/data/catalogs/preferences/mail/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-Mail 1746145370 +1 german x-vnd.Haiku-Mail 3957822883 Account name: Config Views Kontoname: Account name: E-Mail Kontoname: Account settings AutoConfigWindow Kontoeinstellungen @@ -13,7 +13,7 @@ Check every Config Window Abrufen alle Choose Protocol E-Mail Protokoll wählen Create new account AutoConfigWindow Neues Konto anlegen E-mail System name E-Mail-Dienst -E-mail address: E-Mail E-Mail-Adresse +E-mail address: E-Mail E-Mail-Adresse: Edit mailbox menu… Config Window Mailbox-Menü bearbeiten... Enter a valid e-mail address. AutoConfigWindow Eine gültige E-Mail-Adresse angeben. Error Config Window Fehler @@ -25,6 +25,7 @@ Incoming mail filters Config Views Filter für eingehende E-Mail Login name: E-Mail Login: Mail checking Config Window E-Mail abfragen Miscellaneous Config Window Verschiedenes +Never Config Window show status window Nie Next AutoConfigWindow Weiter OK AutoConfigWindow OK OK Config Views OK @@ -50,10 +51,10 @@ While sending Config Window Beim Senden While sending and receiving Config Window Beim Senden und Empfangen \nThe general settings couldn't be reverted.\n\nError retrieving general settings:\n%s\n Config Window \nDie allgemeinen Einstellungen konnten nicht zurückgenommen werden.\n\nFehler beim Abrufen der allgemeinen Einstellungen:\n%s\n \n\nCreate a new account with the Add button.\n\nRemove an account with the Remove button on the selected item.\n\nSelect an item in the list to change its settings. Config Window \n\nNeues Konto erstellen über den \"Hinzu\" Button.\n\nZum Löschen, Konto auswählen und \"Entfernen\" klicken.\n\nKonto auswählen, um dessen Einstellungen zu ändern. +\t\t· E-mail filters Config Window \t\t· E-Mail-Filter +\t\t· Incoming Config Window \t\t· Eingang +\t\t· Outgoing Config Window \t\t· Ausgang days Config Window Tage hours Config Window Stunden minutes Config Window Minuten -never Config Window nie -· E-mail filters Config Window · E-Mail-Filter -· Incoming Config Window · Eingang -· Outgoing Config Window · Ausgang +never Config Window mail checking frequency nie diff --git a/data/catalogs/preferences/mail/fr.catkeys b/data/catalogs/preferences/mail/fr.catkeys index cef93b4190..42dcb2e55a 100644 --- a/data/catalogs/preferences/mail/fr.catkeys +++ b/data/catalogs/preferences/mail/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-Mail 936504879 +1 french x-vnd.Haiku-Mail 3361588786 Account name: Config Views Nom du compte : Account settings Config Views Réglages du compte Accounts Config Window Comptes @@ -31,7 +31,3 @@ While sending and receiving Config Window Pendant l'envoi et la réception days Config Window jours hours Config Window heures minutes Config Window minutes -never Config Window jamais -· E-mail filters Config Window . Filtres E-mail -· Incoming Config Window . Réception -· Outgoing Config Window . Envoi diff --git a/data/catalogs/preferences/mail/it.catkeys b/data/catalogs/preferences/mail/it.catkeys index 6c249e3621..f59fd482b6 100644 --- a/data/catalogs/preferences/mail/it.catkeys +++ b/data/catalogs/preferences/mail/it.catkeys @@ -1,4 +1,4 @@ -1 italian x-vnd.Haiku-Mail 3850363888 +1 italian x-vnd.Haiku-Mail 1980480499 Account name: Config Views Nome account: Account settings Config Views Impostazioni account Accounts Config Window Account @@ -27,7 +27,3 @@ While sending and receiving Config Window Durante l'invio e la ricezione days Config Window giorni hours Config Window ore minutes Config Window minuti -never Config Window mai -· E-mail filters Config Window E-mail filtri -· Incoming Config Window In entrata -· Outgoing Config Window In uscita diff --git a/data/catalogs/preferences/mail/ja.catkeys b/data/catalogs/preferences/mail/ja.catkeys index 4e4cdb71ae..f20ddacebe 100644 --- a/data/catalogs/preferences/mail/ja.catkeys +++ b/data/catalogs/preferences/mail/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-Mail 954305167 +1 japanese x-vnd.Haiku-Mail 3957822883 Account name: Config Views アカウント名: Account name: E-Mail アカウント名: Account settings AutoConfigWindow アカウント設定 @@ -10,6 +10,7 @@ Always Config Window 常に Apply Config Window 適用 Back AutoConfigWindow 前へ Check every Config Window メールを +Choose Protocol E-Mail プロトコルを選択してください Create new account AutoConfigWindow 新規アカウント作成 E-mail System name メール E-mail address: E-Mail E-mail アドレス @@ -24,6 +25,7 @@ Incoming mail filters Config Views 受信メールフィルター Login name: E-Mail ログイン名: Mail checking Config Window メールチェック Miscellaneous Config Window その他 +Never Config Window show status window 表示しない Next AutoConfigWindow 次へ OK AutoConfigWindow OK OK Config Views OK @@ -49,10 +51,10 @@ While sending Config Window 送信中に While sending and receiving Config Window 送受信中に \nThe general settings couldn't be reverted.\n\nError retrieving general settings:\n%s\n Config Window \n一般設定をもとに戻せませんでした。\n\n読み取り時に次のエラーが発生しました:\n%s\n \n\nCreate a new account with the Add button.\n\nRemove an account with the Remove button on the selected item.\n\nSelect an item in the list to change its settings. Config Window \n\n追加ボタンで新規アカウントを作成してください。\n\n削除ボタンで選択したアカウントを削除してください。\n\nリストのアイテムを選択して、設定を変更してください。 +\t\t· E-mail filters Config Window \t\t· メールフィルタ +\t\t· Incoming Config Window \t\t· 受信 +\t\t· Outgoing Config Window \t\t· 送信 days Config Window 日毎にチェック hours Config Window 時間毎にチェック minutes Config Window 分毎にチェック -never Config Window 手動でチェック -· E-mail filters Config Window · メールフィルタ -· Incoming Config Window · 受信 -· Outgoing Config Window · 送信 +never Config Window mail checking frequency 手動でチェック diff --git a/data/catalogs/preferences/mail/nb.catkeys b/data/catalogs/preferences/mail/nb.catkeys index 797d8994b9..67803cbc19 100644 --- a/data/catalogs/preferences/mail/nb.catkeys +++ b/data/catalogs/preferences/mail/nb.catkeys @@ -1,4 +1,4 @@ -1 norwegian_bokmål x-vnd.Haiku-Mail 777369824 +1 norwegian_bokmål x-vnd.Haiku-Mail 3202453731 Account name: Config Views Kontonavn Account settings Config Views Kontoinnstillinger Accounts Config Window Kontoer @@ -27,7 +27,3 @@ While sending and receiving Config Window Under sending og mottak days Config Window dager hours Config Window timer minutes Config Window minutter -never Config Window aldri -· E-mail filters Config Window E-postfiltre -· Incoming Config Window Innkommende -· Outgoing Config Window Utgående diff --git a/data/catalogs/preferences/mail/nl.catkeys b/data/catalogs/preferences/mail/nl.catkeys index a325b383ff..e94c01cf8a 100644 --- a/data/catalogs/preferences/mail/nl.catkeys +++ b/data/catalogs/preferences/mail/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch x-vnd.Haiku-Mail 2264289764 +1 dutch x-vnd.Haiku-Mail 3653676147 Account name: Config Views Accountnaam: Account name: E-Mail Accountnaam: Account settings Config Views Accountinstellingen @@ -41,4 +41,3 @@ While sending and receiving Config Window Tijdens versturen en ontvangen days Config Window dagen hours Config Window uren minutes Config Window minuten -never Config Window nooit diff --git a/data/catalogs/preferences/mail/pl.catkeys b/data/catalogs/preferences/mail/pl.catkeys index 45280be353..bc7f7b27da 100644 --- a/data/catalogs/preferences/mail/pl.catkeys +++ b/data/catalogs/preferences/mail/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-Mail 2264289764 +1 polish x-vnd.Haiku-Mail 3653676147 Account name: Config Views Nazwa konta: Account name: E-Mail Nazwa konta: Account settings Config Views Ustawienia konta @@ -41,4 +41,3 @@ While sending and receiving Config Window Podczas wysyłania i odbierania days Config Window dni hours Config Window godzin minutes Config Window minut -never Config Window nigdy diff --git a/data/catalogs/preferences/mail/pt_br.catkeys b/data/catalogs/preferences/mail/pt_br.catkeys index 5844ef0d18..dbc1f0ab17 100644 --- a/data/catalogs/preferences/mail/pt_br.catkeys +++ b/data/catalogs/preferences/mail/pt_br.catkeys @@ -1,4 +1,4 @@ -1 brazilian_portuguese x-vnd.Haiku-Mail 1492060636 +1 brazilian_portuguese x-vnd.Haiku-Mail 2881447019 Account name: Config Views Nome da conta Account settings Config Views Configurações da conta Accounts Config Window Contas @@ -32,4 +32,3 @@ While sending and receiving Config Window Enquanto envia e recebe days Config Window dias hours Config Window horas minutes Config Window minutos -never Config Window nunca diff --git a/data/catalogs/preferences/mail/ro.catkeys b/data/catalogs/preferences/mail/ro.catkeys index ddb5fe81e2..26880ff7d4 100644 --- a/data/catalogs/preferences/mail/ro.catkeys +++ b/data/catalogs/preferences/mail/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-Mail 2470242049 +1 romanian x-vnd.Haiku-Mail 3859628432 Account name: Config Views Nume cont: Account name: E-Mail Nume cont: Account settings Config Views Configurări cont @@ -39,4 +39,3 @@ While sending and receiving Config Window În timp ce se trimite și se recepț days Config Window zile hours Config Window ore minutes Config Window minute -never Config Window niciodată diff --git a/data/catalogs/preferences/mail/sk.catkeys b/data/catalogs/preferences/mail/sk.catkeys index 20de970057..c63c89f7a3 100644 --- a/data/catalogs/preferences/mail/sk.catkeys +++ b/data/catalogs/preferences/mail/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-Mail 3450803213 +1 slovak x-vnd.Haiku-Mail 4171229277 Account name: Config Views Názov účtu: Account name: E-Mail Názov účtu: Account settings AutoConfigWindow Nastavenie účtu @@ -21,10 +21,13 @@ Error retrieving general settings: %s\n Config Window Chyba pri získavaní vš Finish AutoConfigWindow Dokončiť Incoming Config Window Prichádzajúce Incoming E-Mail Prichádzajúce +Incoming mail filters Config Views Filtre prichádzajúcej pošty Login name: E-Mail Prihlasovacie meno: Mail checking Config Window Kontrola pošty Miscellaneous Config Window Rozličné +Next AutoConfigWindow Ďalej OK AutoConfigWindow OK +OK Config Views OK OK Config Window OK Only when dial-up is connected Config Window Iba ak je vytočené spojenie Outgoing Config Window Odchádzajúce @@ -42,13 +45,11 @@ Server Name: E-Mail Názov servera: Settings Config Window Nastavenie Show connection status window: Config Window Zobraziť okno stavu spojenia: Start mail services on startup Config Window Spustiť služby pošty pri štarte +The filter could not be moved. Deleting filter. Config Views Filter nebolo možné presunúť. Filter sa zmaže. While sending Config Window Počas odosielania While sending and receiving Config Window Počas odosielania a prijímania \nThe general settings couldn't be reverted.\n\nError retrieving general settings:\n%s\n Config Window \nVšeobecné nastavenia nebolo možné vrátiť.\n\nChyba pri získavaní všeobecných nastavení:\n%s\n \n\nCreate a new account with the Add button.\n\nRemove an account with the Remove button on the selected item.\n\nSelect an item in the list to change its settings. Config Window \n\nNový účet vytvoríte tlačidlom Pridať.\n\nÚčet odstránite tlačidlom odstrániť na vybranej položke.\n\nNastavenia položky zmeníte jej vybraním v zozname. days Config Window dní +hours Config Window hodín minutes Config Window minút -never Config Window nikdy -· E-mail filters Config Window · Filtre pošty -· Incoming Config Window · Prichádzajúce -· Outgoing Config Window · Odchádzajúce diff --git a/data/catalogs/preferences/mail/sv.catkeys b/data/catalogs/preferences/mail/sv.catkeys index 4d002f895e..8eb256b772 100644 --- a/data/catalogs/preferences/mail/sv.catkeys +++ b/data/catalogs/preferences/mail/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-Mail 1746145370 +1 swedish x-vnd.Haiku-Mail 3957822883 Account name: Config Views Kontonamn: Account name: E-Mail Kontonamn: Account settings AutoConfigWindow Kontoinställningar @@ -25,6 +25,7 @@ Incoming mail filters Config Views Inkommande e-postfilter Login name: E-Mail Inloggningsnamn: Mail checking Config Window Kontrollera e-post Miscellaneous Config Window Diverse +Never Config Window show status window Aldrig Next AutoConfigWindow Nästa OK AutoConfigWindow OK OK Config Views OK @@ -50,10 +51,10 @@ While sending Config Window När sändning sker While sending and receiving Config Window När sändning och mottagning sker \nThe general settings couldn't be reverted.\n\nError retrieving general settings:\n%s\n Config Window \nGrundinställningarna kunde inte återställas.\n\nEtt fel uppstod när grundinställningarna skulle återställas:\n%s\n \n\nCreate a new account with the Add button.\n\nRemove an account with the Remove button on the selected item.\n\nSelect an item in the list to change its settings. Config Window \n\nSkapa ett nytt konto via Lägg till-knappen.\n\nTa bort ett konto med Ta bort-knappen vid den valda objektet.\n\nVälj ett listobjekt för att ändra dess inställningar. +\t\t· E-mail filters Config Window \t\t· E-postfilter +\t\t· Incoming Config Window \t\t· Inkommande +\t\t· Outgoing Config Window \t\t· Utgående days Config Window dagar hours Config Window timmar minutes Config Window minuter -never Config Window aldrig -· E-mail filters Config Window · E-postfilter -· Incoming Config Window · Inkommande -· Outgoing Config Window · Utgående +never Config Window mail checking frequency aldrig diff --git a/data/catalogs/preferences/mail/zh_hans.catkeys b/data/catalogs/preferences/mail/zh_hans.catkeys index b1025a1587..582b85697f 100644 --- a/data/catalogs/preferences/mail/zh_hans.catkeys +++ b/data/catalogs/preferences/mail/zh_hans.catkeys @@ -1,4 +1,4 @@ -1 simplified_chinese x-vnd.Haiku-Mail 2923655424 +1 simplified_chinese x-vnd.Haiku-Mail 1053772035 Account name: Config Views 用户名: Account name: E-Mail 用户名: Account settings Config Views 用户设置 @@ -42,7 +42,3 @@ While sending and receiving Config Window 在发送和接收时 days Config Window 天 hours Config Window 小时 minutes Config Window 分 -never Config Window 从不 -· E-mail filters Config Window 邮件过滤器 -· Incoming Config Window 接收 -· Outgoing Config Window 发送 diff --git a/data/catalogs/servers/mail/de.catkeys b/data/catalogs/servers/mail/de.catkeys index 8e1732a6f8..6a5855448e 100644 --- a/data/catalogs/servers/mail/de.catkeys +++ b/data/catalogs/servers/mail/de.catkeys @@ -1,4 +1,6 @@ -1 german x-vnd.Be-POST 2900218551 +1 german x-vnd.Be-POST 1358359182 +%.1f / %.1f kb (%d / %d messages) StatusWindow %.1f / %.1f KiB (%d / %d Nachrichten) +%d / %d messages StatusWindow %d / %d Nachrichten %num new message DeskbarView %num neue Nachricht %num new message for %name\n MailDaemon %num neue Nachricht für %name\n %num new message. MailDaemon %num neue Nachricht. @@ -7,9 +9,10 @@ %num new messages. MailDaemon %num neue Nachrichten. DeskbarView Check for mail now DeskbarView E-Mails jetzt abrufen -Check for mails only DeskbarView E-Mails nur abrufen +Check for mails only DeskbarView E-Mails nur abrufen für Check mail now StatusWindow E-Mails jetzt abrufen Create new message… DeskbarView Nachricht verfassen… +Fetching mail for %name Notifier E-Mails für %name abrufen Mail Status MailDaemon E-Mail-Status Mail daemon status log MailDaemon E-Mail-Dienst Statusmeldungen New Messages MailDaemon Neue Nachrichten @@ -19,4 +22,5 @@ No new messages. MailDaemon Keine neuen Nachrichten. No new messages. StatusWindow Keine neuen Nachrichten. Preferences… DeskbarView Einstellungen… Send pending mails DeskbarView E-Mails senden +Sending mail for %name Notifier E-Mails von %name senden Shutdown mail services DeskbarView E-Mail-Dienst ausschalten diff --git a/data/catalogs/servers/mail/ja.catkeys b/data/catalogs/servers/mail/ja.catkeys index b599ee141d..e8cab84660 100644 --- a/data/catalogs/servers/mail/ja.catkeys +++ b/data/catalogs/servers/mail/ja.catkeys @@ -1,4 +1,6 @@ -1 japanese x-vnd.Be-POST 2900218551 +1 japanese x-vnd.Be-POST 1358359182 +%.1f / %.1f kb (%d / %d messages) StatusWindow %.1f / %.1f kb (%d / %d メッセージ) +%d / %d messages StatusWindow %d / %d メッセージ %num new message DeskbarView %num 通の新着メッセージがあります %num new message for %name\n MailDaemon %name より %num 通のメッセージが届きました\n %num new message. MailDaemon %num 通の新着メッセージがあります。 @@ -10,6 +12,7 @@ Check for mail now DeskbarView 今すぐメールをチェック Check for mails only DeskbarView メール受信のみ Check mail now StatusWindow 今すぐメールをチェック Create new message… DeskbarView 新規メッセージ作成 +Fetching mail for %name Notifier %name からのメールを受信中 Mail Status MailDaemon メールの状況 Mail daemon status log MailDaemon メールデーモン状況ログ New Messages MailDaemon 新着メッセージ @@ -19,4 +22,5 @@ No new messages. MailDaemon 新着メッセージはありません。 No new messages. StatusWindow 新着メッセージはありません。 Preferences… DeskbarView メールの設定 Send pending mails DeskbarView 保留メールを送信 +Sending mail for %name Notifier %name へのメールを送信中 Shutdown mail services DeskbarView 終了 diff --git a/data/catalogs/servers/mail/sv.catkeys b/data/catalogs/servers/mail/sv.catkeys index 2db40177e7..55d80ac4c9 100644 --- a/data/catalogs/servers/mail/sv.catkeys +++ b/data/catalogs/servers/mail/sv.catkeys @@ -1,4 +1,6 @@ -1 swedish x-vnd.Be-POST 2900218551 +1 swedish x-vnd.Be-POST 1358359182 +%.1f / %.1f kb (%d / %d messages) StatusWindow %.1f / %.1f kb (%d / %d meddelanden) +%d / %d messages StatusWindow %d / %d meddelanden %num new message DeskbarView %num nytt meddelande %num new message for %name\n MailDaemon %num nytt meddelande för %name\n %num new message. MailDaemon %num nytt meddelande. @@ -10,6 +12,7 @@ Check for mail now DeskbarView Kontrollera e-post nu Check for mails only DeskbarView Kontrollera bara e-post Check mail now StatusWindow Kontrollera e-post nu Create new message… DeskbarView Skapa nytt meddelande... +Fetching mail for %name Notifier Hämtar e-post för %name Mail Status MailDaemon E-post status Mail daemon status log MailDaemon Statuslog för e-postdemon New Messages MailDaemon nya meddelanden @@ -19,4 +22,5 @@ No new messages. MailDaemon inga nya meddelanden. No new messages. StatusWindow inga nya meddelanden. Preferences… DeskbarView Inställningar... Send pending mails DeskbarView Skicka väntande meddelanden +Sending mail for %name Notifier Skickar e-post för %name Shutdown mail services DeskbarView Stäng av e-posttjänsterna From 6da3f7d4c1de302697f5d948057a68dd428277f6 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 5 Aug 2011 22:24:57 +0000 Subject: [PATCH 130/702] * lots of changes * add missing header for some radeon registers * begin removing now un-needed direct register calls * move and refactor crtc functions * fix function naming to be clearer * create more AtomBIOS style calls * this will eat your cat at the moment, don't bother testing git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42582 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 4 +- .../private/graphics/radeon_hd/radeon_reg.h | 3700 +++++++++++++++++ .../accelerants/radeon_hd/accelerant.h | 4 +- .../accelerants/radeon_hd/atombios/atom.cpp | 2 +- src/add-ons/accelerants/radeon_hd/bios.cpp | 18 +- src/add-ons/accelerants/radeon_hd/bios.h | 1 - src/add-ons/accelerants/radeon_hd/display.cpp | 359 +- src/add-ons/accelerants/radeon_hd/display.h | 10 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 274 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 74 +- src/add-ons/accelerants/radeon_hd/pll.h | 2 +- 11 files changed, 4144 insertions(+), 304 deletions(-) create mode 100644 headers/private/graphics/radeon_hd/radeon_reg.h diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index e80063abe2..487ba22dba 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -12,7 +12,9 @@ #include "lock.h" -#include "rhd_regs.h" +#include "radeon_reg.h" + +#include "rhd_regs.h" // to phase out #include "r500_reg.h" #include "r600_reg.h" #include "r800_reg.h" diff --git a/headers/private/graphics/radeon_hd/radeon_reg.h b/headers/private/graphics/radeon_hd/radeon_reg.h new file mode 100644 index 0000000000..8af043021b --- /dev/null +++ b/headers/private/graphics/radeon_hd/radeon_reg.h @@ -0,0 +1,3700 @@ +/* + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and + * VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * Rickard E. Faith + * Alan Hourihane + * + * References: + * + * !!!! FIXME !!!! + * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical + * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April + * 1999. + * + * !!!! FIXME !!!! + * RAGE 128 Software Development Manual (Technical Reference Manual P/N + * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999. + * + */ + +/* !!!! FIXME !!!! NOTE: THIS FILE HAS BEEN CONVERTED FROM r128_reg.h + * AND CONTAINS REGISTERS AND REGISTER DEFINITIONS THAT ARE NOT CORRECT + * ON THE RADEON. A FULL AUDIT OF THIS CODE IS NEEDED! */ +#ifndef _RADEON_REG_H_ +#define _RADEON_REG_H_ + +#define RADEON_MC_AGP_LOCATION 0x014c +#define RADEON_MC_AGP_START_MASK 0x0000FFFF +#define RADEON_MC_AGP_START_SHIFT 0 +#define RADEON_MC_AGP_TOP_MASK 0xFFFF0000 +#define RADEON_MC_AGP_TOP_SHIFT 16 +#define RADEON_MC_FB_LOCATION 0x0148 +#define RADEON_MC_FB_START_MASK 0x0000FFFF +#define RADEON_MC_FB_START_SHIFT 0 +#define RADEON_MC_FB_TOP_MASK 0xFFFF0000 +#define RADEON_MC_FB_TOP_SHIFT 16 +#define RADEON_AGP_BASE_2 0x015c /* r200+ only */ +#define RADEON_AGP_BASE 0x0170 + +#define ATI_DATATYPE_VQ 0 +#define ATI_DATATYPE_CI4 1 +#define ATI_DATATYPE_CI8 2 +#define ATI_DATATYPE_ARGB1555 3 +#define ATI_DATATYPE_RGB565 4 +#define ATI_DATATYPE_RGB888 5 +#define ATI_DATATYPE_ARGB8888 6 +#define ATI_DATATYPE_RGB332 7 +#define ATI_DATATYPE_Y8 8 +#define ATI_DATATYPE_RGB8 9 +#define ATI_DATATYPE_CI16 10 +#define ATI_DATATYPE_VYUY_422 11 +#define ATI_DATATYPE_YVYU_422 12 +#define ATI_DATATYPE_AYUV_444 14 +#define ATI_DATATYPE_ARGB4444 15 + + /* Registers for 2D/Video/Overlay */ +#define RADEON_ADAPTER_ID 0x0f2c /* PCI */ +#define RADEON_AGP_BASE 0x0170 +#define RADEON_AGP_CNTL 0x0174 +# define RADEON_AGP_APER_SIZE_256MB (0x00 << 0) +# define RADEON_AGP_APER_SIZE_128MB (0x20 << 0) +# define RADEON_AGP_APER_SIZE_64MB (0x30 << 0) +# define RADEON_AGP_APER_SIZE_32MB (0x38 << 0) +# define RADEON_AGP_APER_SIZE_16MB (0x3c << 0) +# define RADEON_AGP_APER_SIZE_8MB (0x3e << 0) +# define RADEON_AGP_APER_SIZE_4MB (0x3f << 0) +# define RADEON_AGP_APER_SIZE_MASK (0x3f << 0) +#define RADEON_STATUS_PCI_CONFIG 0x06 +# define RADEON_CAP_LIST 0x100000 +#define RADEON_CAPABILITIES_PTR_PCI_CONFIG 0x34 /* offset in PCI config*/ +# define RADEON_CAP_PTR_MASK 0xfc /* mask off reserved bits of CAP_PTR */ +# define RADEON_CAP_ID_NULL 0x00 /* End of capability list */ +# define RADEON_CAP_ID_AGP 0x02 /* AGP capability ID */ +# define RADEON_CAP_ID_EXP 0x10 /* PCI Express */ +#define RADEON_AGP_COMMAND 0x0f60 /* PCI */ +#define RADEON_AGP_COMMAND_PCI_CONFIG 0x0060 /* offset in PCI config*/ +# define RADEON_AGP_ENABLE (1<<8) +#define RADEON_AGP_PLL_CNTL 0x000b /* PLL */ +#define RADEON_AGP_STATUS 0x0f5c /* PCI */ +# define RADEON_AGP_1X_MODE 0x01 +# define RADEON_AGP_2X_MODE 0x02 +# define RADEON_AGP_4X_MODE 0x04 +# define RADEON_AGP_FW_MODE 0x10 +# define RADEON_AGP_MODE_MASK 0x17 +# define RADEON_AGPv3_MODE 0x08 +# define RADEON_AGPv3_4X_MODE 0x01 +# define RADEON_AGPv3_8X_MODE 0x02 +#define RADEON_ATTRDR 0x03c1 /* VGA */ +#define RADEON_ATTRDW 0x03c0 /* VGA */ +#define RADEON_ATTRX 0x03c0 /* VGA */ +#define RADEON_AUX_SC_CNTL 0x1660 +# define RADEON_AUX1_SC_EN (1 << 0) +# define RADEON_AUX1_SC_MODE_OR (0 << 1) +# define RADEON_AUX1_SC_MODE_NAND (1 << 1) +# define RADEON_AUX2_SC_EN (1 << 2) +# define RADEON_AUX2_SC_MODE_OR (0 << 3) +# define RADEON_AUX2_SC_MODE_NAND (1 << 3) +# define RADEON_AUX3_SC_EN (1 << 4) +# define RADEON_AUX3_SC_MODE_OR (0 << 5) +# define RADEON_AUX3_SC_MODE_NAND (1 << 5) +#define RADEON_AUX1_SC_BOTTOM 0x1670 +#define RADEON_AUX1_SC_LEFT 0x1664 +#define RADEON_AUX1_SC_RIGHT 0x1668 +#define RADEON_AUX1_SC_TOP 0x166c +#define RADEON_AUX2_SC_BOTTOM 0x1680 +#define RADEON_AUX2_SC_LEFT 0x1674 +#define RADEON_AUX2_SC_RIGHT 0x1678 +#define RADEON_AUX2_SC_TOP 0x167c +#define RADEON_AUX3_SC_BOTTOM 0x1690 +#define RADEON_AUX3_SC_LEFT 0x1684 +#define RADEON_AUX3_SC_RIGHT 0x1688 +#define RADEON_AUX3_SC_TOP 0x168c +#define RADEON_AUX_WINDOW_HORZ_CNTL 0x02d8 +#define RADEON_AUX_WINDOW_VERT_CNTL 0x02dc + +#define RADEON_BASE_CODE 0x0f0b +#define RADEON_BIOS_0_SCRATCH 0x0010 +# define RADEON_FP_PANEL_SCALABLE (1 << 16) +# define RADEON_FP_PANEL_SCALE_EN (1 << 17) +# define RADEON_FP_CHIP_SCALE_EN (1 << 18) +# define RADEON_DRIVER_BRIGHTNESS_EN (1 << 26) +# define RADEON_DISPLAY_ROT_MASK (3 << 28) +# define RADEON_DISPLAY_ROT_00 (0 << 28) +# define RADEON_DISPLAY_ROT_90 (1 << 28) +# define RADEON_DISPLAY_ROT_180 (2 << 28) +# define RADEON_DISPLAY_ROT_270 (3 << 28) +#define RADEON_BIOS_1_SCRATCH 0x0014 +#define RADEON_BIOS_2_SCRATCH 0x0018 +#define RADEON_BIOS_3_SCRATCH 0x001c +#define RADEON_BIOS_4_SCRATCH 0x0020 +# define RADEON_CRT1_ATTACHED_MASK (3 << 0) +# define RADEON_CRT1_ATTACHED_MONO (1 << 0) +# define RADEON_CRT1_ATTACHED_COLOR (2 << 0) +# define RADEON_LCD1_ATTACHED (1 << 2) +# define RADEON_DFP1_ATTACHED (1 << 3) +# define RADEON_TV1_ATTACHED_MASK (3 << 4) +# define RADEON_TV1_ATTACHED_COMP (1 << 4) +# define RADEON_TV1_ATTACHED_SVIDEO (2 << 4) +# define RADEON_CRT2_ATTACHED_MASK (3 << 8) +# define RADEON_CRT2_ATTACHED_MONO (1 << 8) +# define RADEON_CRT2_ATTACHED_COLOR (2 << 8) +# define RADEON_DFP2_ATTACHED (1 << 11) +#define RADEON_BIOS_5_SCRATCH 0x0024 +# define RADEON_LCD1_ON (1 << 0) +# define RADEON_CRT1_ON (1 << 1) +# define RADEON_TV1_ON (1 << 2) +# define RADEON_DFP1_ON (1 << 3) +# define RADEON_CRT2_ON (1 << 5) +# define RADEON_CV1_ON (1 << 6) +# define RADEON_DFP2_ON (1 << 7) +# define RADEON_LCD1_CRTC_MASK (1 << 8) +# define RADEON_LCD1_CRTC_SHIFT 8 +# define RADEON_CRT1_CRTC_MASK (1 << 9) +# define RADEON_CRT1_CRTC_SHIFT 9 +# define RADEON_TV1_CRTC_MASK (1 << 10) +# define RADEON_TV1_CRTC_SHIFT 10 +# define RADEON_DFP1_CRTC_MASK (1 << 11) +# define RADEON_DFP1_CRTC_SHIFT 11 +# define RADEON_CRT2_CRTC_MASK (1 << 12) +# define RADEON_CRT2_CRTC_SHIFT 12 +# define RADEON_CV1_CRTC_MASK (1 << 13) +# define RADEON_CV1_CRTC_SHIFT 13 +# define RADEON_DFP2_CRTC_MASK (1 << 14) +# define RADEON_DFP2_CRTC_SHIFT 14 +# define RADEON_ACC_REQ_LCD1 (1 << 16) +# define RADEON_ACC_REQ_CRT1 (1 << 17) +# define RADEON_ACC_REQ_TV1 (1 << 18) +# define RADEON_ACC_REQ_DFP1 (1 << 19) +# define RADEON_ACC_REQ_CRT2 (1 << 21) +# define RADEON_ACC_REQ_TV2 (1 << 22) +# define RADEON_ACC_REQ_DFP2 (1 << 23) +#define RADEON_BIOS_6_SCRATCH 0x0028 +# define RADEON_ACC_MODE_CHANGE (1 << 2) +# define RADEON_EXT_DESKTOP_MODE (1 << 3) +# define RADEON_LCD_DPMS_ON (1 << 20) +# define RADEON_CRT_DPMS_ON (1 << 21) +# define RADEON_TV_DPMS_ON (1 << 22) +# define RADEON_DFP_DPMS_ON (1 << 23) +# define RADEON_DPMS_MASK (3 << 24) +# define RADEON_DPMS_ON (0 << 24) +# define RADEON_DPMS_STANDBY (1 << 24) +# define RADEON_DPMS_SUSPEND (2 << 24) +# define RADEON_DPMS_OFF (3 << 24) +# define RADEON_SCREEN_BLANKING (1 << 26) +# define RADEON_DRIVER_CRITICAL (1 << 27) +# define RADEON_DISPLAY_SWITCHING_DIS (1 << 30) +#define RADEON_BIOS_7_SCRATCH 0x002c +# define RADEON_SYS_HOTKEY (1 << 10) +# define RADEON_DRV_LOADED (1 << 12) +#define RADEON_BIOS_ROM 0x0f30 /* PCI */ +#define RADEON_BIST 0x0f0f /* PCI */ +#define RADEON_BRUSH_DATA0 0x1480 +#define RADEON_BRUSH_DATA1 0x1484 +#define RADEON_BRUSH_DATA10 0x14a8 +#define RADEON_BRUSH_DATA11 0x14ac +#define RADEON_BRUSH_DATA12 0x14b0 +#define RADEON_BRUSH_DATA13 0x14b4 +#define RADEON_BRUSH_DATA14 0x14b8 +#define RADEON_BRUSH_DATA15 0x14bc +#define RADEON_BRUSH_DATA16 0x14c0 +#define RADEON_BRUSH_DATA17 0x14c4 +#define RADEON_BRUSH_DATA18 0x14c8 +#define RADEON_BRUSH_DATA19 0x14cc +#define RADEON_BRUSH_DATA2 0x1488 +#define RADEON_BRUSH_DATA20 0x14d0 +#define RADEON_BRUSH_DATA21 0x14d4 +#define RADEON_BRUSH_DATA22 0x14d8 +#define RADEON_BRUSH_DATA23 0x14dc +#define RADEON_BRUSH_DATA24 0x14e0 +#define RADEON_BRUSH_DATA25 0x14e4 +#define RADEON_BRUSH_DATA26 0x14e8 +#define RADEON_BRUSH_DATA27 0x14ec +#define RADEON_BRUSH_DATA28 0x14f0 +#define RADEON_BRUSH_DATA29 0x14f4 +#define RADEON_BRUSH_DATA3 0x148c +#define RADEON_BRUSH_DATA30 0x14f8 +#define RADEON_BRUSH_DATA31 0x14fc +#define RADEON_BRUSH_DATA32 0x1500 +#define RADEON_BRUSH_DATA33 0x1504 +#define RADEON_BRUSH_DATA34 0x1508 +#define RADEON_BRUSH_DATA35 0x150c +#define RADEON_BRUSH_DATA36 0x1510 +#define RADEON_BRUSH_DATA37 0x1514 +#define RADEON_BRUSH_DATA38 0x1518 +#define RADEON_BRUSH_DATA39 0x151c +#define RADEON_BRUSH_DATA4 0x1490 +#define RADEON_BRUSH_DATA40 0x1520 +#define RADEON_BRUSH_DATA41 0x1524 +#define RADEON_BRUSH_DATA42 0x1528 +#define RADEON_BRUSH_DATA43 0x152c +#define RADEON_BRUSH_DATA44 0x1530 +#define RADEON_BRUSH_DATA45 0x1534 +#define RADEON_BRUSH_DATA46 0x1538 +#define RADEON_BRUSH_DATA47 0x153c +#define RADEON_BRUSH_DATA48 0x1540 +#define RADEON_BRUSH_DATA49 0x1544 +#define RADEON_BRUSH_DATA5 0x1494 +#define RADEON_BRUSH_DATA50 0x1548 +#define RADEON_BRUSH_DATA51 0x154c +#define RADEON_BRUSH_DATA52 0x1550 +#define RADEON_BRUSH_DATA53 0x1554 +#define RADEON_BRUSH_DATA54 0x1558 +#define RADEON_BRUSH_DATA55 0x155c +#define RADEON_BRUSH_DATA56 0x1560 +#define RADEON_BRUSH_DATA57 0x1564 +#define RADEON_BRUSH_DATA58 0x1568 +#define RADEON_BRUSH_DATA59 0x156c +#define RADEON_BRUSH_DATA6 0x1498 +#define RADEON_BRUSH_DATA60 0x1570 +#define RADEON_BRUSH_DATA61 0x1574 +#define RADEON_BRUSH_DATA62 0x1578 +#define RADEON_BRUSH_DATA63 0x157c +#define RADEON_BRUSH_DATA7 0x149c +#define RADEON_BRUSH_DATA8 0x14a0 +#define RADEON_BRUSH_DATA9 0x14a4 +#define RADEON_BRUSH_SCALE 0x1470 +#define RADEON_BRUSH_Y_X 0x1474 +#define RADEON_BUS_CNTL 0x0030 +# define RADEON_BUS_MASTER_DIS (1 << 6) +# define RADEON_BUS_BIOS_DIS_ROM (1 << 12) +# define RS600_BUS_MASTER_DIS (1 << 14) +# define RS600_MSI_REARM (1 << 20) /* rs600/rs690/rs740 */ +# define RADEON_BUS_RD_DISCARD_EN (1 << 24) +# define RADEON_BUS_RD_ABORT_EN (1 << 25) +# define RADEON_BUS_MSTR_DISCONNECT_EN (1 << 28) +# define RADEON_BUS_WRT_BURST (1 << 29) +# define RADEON_BUS_READ_BURST (1 << 30) +#define RADEON_BUS_CNTL1 0x0034 +# define RADEON_BUS_WAIT_ON_LOCK_EN (1 << 4) +#define RV370_BUS_CNTL 0x004c +# define RV370_BUS_BIOS_DIS_ROM (1 << 2) +/* rv370/rv380, rv410, r423/r430/r480, r5xx */ +#define RADEON_MSI_REARM_EN 0x0160 +# define RV370_MSI_REARM_EN (1 << 0) + +/* #define RADEON_PCIE_INDEX 0x0030 */ +/* #define RADEON_PCIE_DATA 0x0034 */ +#define RADEON_PCIE_LC_LINK_WIDTH_CNTL 0xa2 /* PCIE */ +# define RADEON_PCIE_LC_LINK_WIDTH_SHIFT 0 +# define RADEON_PCIE_LC_LINK_WIDTH_MASK 0x7 +# define RADEON_PCIE_LC_LINK_WIDTH_X0 0 +# define RADEON_PCIE_LC_LINK_WIDTH_X1 1 +# define RADEON_PCIE_LC_LINK_WIDTH_X2 2 +# define RADEON_PCIE_LC_LINK_WIDTH_X4 3 +# define RADEON_PCIE_LC_LINK_WIDTH_X8 4 +# define RADEON_PCIE_LC_LINK_WIDTH_X12 5 +# define RADEON_PCIE_LC_LINK_WIDTH_X16 6 +# define RADEON_PCIE_LC_LINK_WIDTH_RD_SHIFT 4 +# define RADEON_PCIE_LC_LINK_WIDTH_RD_MASK 0x70 +# define RADEON_PCIE_LC_RECONFIG_NOW (1 << 8) +# define RADEON_PCIE_LC_RECONFIG_LATER (1 << 9) +# define RADEON_PCIE_LC_SHORT_RECONFIG_EN (1 << 10) +# define R600_PCIE_LC_RECONFIG_ARC_MISSING_ESCAPE (1 << 7) +# define R600_PCIE_LC_RENEGOTIATION_SUPPORT (1 << 9) +# define R600_PCIE_LC_RENEGOTIATE_EN (1 << 10) +# define R600_PCIE_LC_SHORT_RECONFIG_EN (1 << 11) +# define R600_PCIE_LC_UPCONFIGURE_SUPPORT (1 << 12) +# define R600_PCIE_LC_UPCONFIGURE_DIS (1 << 13) + +#define R600_TARGET_AND_CURRENT_PROFILE_INDEX 0x70c +#define R700_TARGET_AND_CURRENT_PROFILE_INDEX 0x66c + +#define RADEON_CACHE_CNTL 0x1724 +#define RADEON_CACHE_LINE 0x0f0c /* PCI */ +#define RADEON_CAPABILITIES_ID 0x0f50 /* PCI */ +#define RADEON_CAPABILITIES_PTR 0x0f34 /* PCI */ +#define RADEON_CLK_PIN_CNTL 0x0001 /* PLL */ +# define RADEON_DONT_USE_XTALIN (1 << 4) +# define RADEON_SCLK_DYN_START_CNTL (1 << 15) +#define RADEON_CLOCK_CNTL_DATA 0x000c +#define RADEON_CLOCK_CNTL_INDEX 0x0008 +# define RADEON_PLL_WR_EN (1 << 7) +# define RADEON_PLL_DIV_SEL (3 << 8) +# define RADEON_PLL2_DIV_SEL_MASK (~(3 << 8)) +#define RADEON_CLK_PWRMGT_CNTL 0x0014 +# define RADEON_ENGIN_DYNCLK_MODE (1 << 12) +# define RADEON_ACTIVE_HILO_LAT_MASK (3 << 13) +# define RADEON_ACTIVE_HILO_LAT_SHIFT 13 +# define RADEON_DISP_DYN_STOP_LAT_MASK (1 << 12) +# define RADEON_MC_BUSY (1 << 16) +# define RADEON_DLL_READY (1 << 19) +# define RADEON_CG_NO1_DEBUG_0 (1 << 24) +# define RADEON_CG_NO1_DEBUG_MASK (0x1f << 24) +# define RADEON_DYN_STOP_MODE_MASK (7 << 21) +# define RADEON_TVPLL_PWRMGT_OFF (1 << 30) +# define RADEON_TVCLK_TURNOFF (1 << 31) +#define RADEON_PLL_PWRMGT_CNTL 0x0015 /* PLL */ +# define RADEON_PM_MODE_SEL (1 << 13) +# define RADEON_TCL_BYPASS_DISABLE (1 << 20) +#define RADEON_CLR_CMP_CLR_3D 0x1a24 +#define RADEON_CLR_CMP_CLR_DST 0x15c8 +#define RADEON_CLR_CMP_CLR_SRC 0x15c4 +#define RADEON_CLR_CMP_CNTL 0x15c0 +# define RADEON_SRC_CMP_EQ_COLOR (4 << 0) +# define RADEON_SRC_CMP_NEQ_COLOR (5 << 0) +# define RADEON_CLR_CMP_SRC_SOURCE (1 << 24) +#define RADEON_CLR_CMP_MASK 0x15cc +# define RADEON_CLR_CMP_MSK 0xffffffff +#define RADEON_CLR_CMP_MASK_3D 0x1A28 +#define RADEON_COMMAND 0x0f04 /* PCI */ +#define RADEON_COMPOSITE_SHADOW_ID 0x1a0c +#define RADEON_CONFIG_APER_0_BASE 0x0100 +#define RADEON_CONFIG_APER_1_BASE 0x0104 +#define RADEON_CONFIG_APER_SIZE 0x0108 +#define RADEON_CONFIG_BONDS 0x00e8 +#define RADEON_CONFIG_CNTL 0x00e0 +# define RADEON_CFG_VGA_RAM_EN (1 << 8) +# define RADEON_CFG_VGA_IO_DIS (1 << 9) +# define RADEON_CFG_ATI_REV_A11 (0 << 16) +# define RADEON_CFG_ATI_REV_A12 (1 << 16) +# define RADEON_CFG_ATI_REV_A13 (2 << 16) +# define RADEON_CFG_ATI_REV_ID_MASK (0xf << 16) +#define RADEON_CONFIG_MEMSIZE 0x00f8 +#define RADEON_CONFIG_MEMSIZE_EMBEDDED 0x0114 +#define RADEON_CONFIG_REG_1_BASE 0x010c +#define RADEON_CONFIG_REG_APER_SIZE 0x0110 +#define RADEON_CONFIG_XSTRAP 0x00e4 +#define RADEON_CONSTANT_COLOR_C 0x1d34 +# define RADEON_CONSTANT_COLOR_MASK 0x00ffffff +# define RADEON_CONSTANT_COLOR_ONE 0x00ffffff +# define RADEON_CONSTANT_COLOR_ZERO 0x00000000 +#define RADEON_CRC_CMDFIFO_ADDR 0x0740 +#define RADEON_CRC_CMDFIFO_DOUT 0x0744 +#define RADEON_GRPH_BUFFER_CNTL 0x02f0 +# define RADEON_GRPH_START_REQ_MASK (0x7f) +# define RADEON_GRPH_START_REQ_SHIFT 0 +# define RADEON_GRPH_STOP_REQ_MASK (0x7f<<8) +# define RADEON_GRPH_STOP_REQ_SHIFT 8 +# define RADEON_GRPH_CRITICAL_POINT_MASK (0x7f<<16) +# define RADEON_GRPH_CRITICAL_POINT_SHIFT 16 +# define RADEON_GRPH_CRITICAL_CNTL (1<<28) +# define RADEON_GRPH_BUFFER_SIZE (1<<29) +# define RADEON_GRPH_CRITICAL_AT_SOF (1<<30) +# define RADEON_GRPH_STOP_CNTL (1<<31) +#define RADEON_GRPH2_BUFFER_CNTL 0x03f0 +# define RADEON_GRPH2_START_REQ_MASK (0x7f) +# define RADEON_GRPH2_START_REQ_SHIFT 0 +# define RADEON_GRPH2_STOP_REQ_MASK (0x7f<<8) +# define RADEON_GRPH2_STOP_REQ_SHIFT 8 +# define RADEON_GRPH2_CRITICAL_POINT_MASK (0x7f<<16) +# define RADEON_GRPH2_CRITICAL_POINT_SHIFT 16 +# define RADEON_GRPH2_CRITICAL_CNTL (1<<28) +# define RADEON_GRPH2_BUFFER_SIZE (1<<29) +# define RADEON_GRPH2_CRITICAL_AT_SOF (1<<30) +# define RADEON_GRPH2_STOP_CNTL (1<<31) +#define RADEON_CRTC_CRNT_FRAME 0x0214 +#define RADEON_CRTC_EXT_CNTL 0x0054 +# define RADEON_CRTC_VGA_XOVERSCAN (1 << 0) +# define RADEON_VGA_ATI_LINEAR (1 << 3) +# define RADEON_XCRT_CNT_EN (1 << 6) +# define RADEON_CRTC_HSYNC_DIS (1 << 8) +# define RADEON_CRTC_VSYNC_DIS (1 << 9) +# define RADEON_CRTC_DISPLAY_DIS (1 << 10) +# define RADEON_CRTC_SYNC_TRISTAT (1 << 11) +# define RADEON_CRTC_CRT_ON (1 << 15) +#define RADEON_CRTC_EXT_CNTL_DPMS_BYTE 0x0055 +# define RADEON_CRTC_HSYNC_DIS_BYTE (1 << 0) +# define RADEON_CRTC_VSYNC_DIS_BYTE (1 << 1) +# define RADEON_CRTC_DISPLAY_DIS_BYTE (1 << 2) +#define RADEON_CRTC_GEN_CNTL 0x0050 +# define RADEON_CRTC_DBL_SCAN_EN (1 << 0) +# define RADEON_CRTC_INTERLACE_EN (1 << 1) +# define RADEON_CRTC_CSYNC_EN (1 << 4) +# define RADEON_CRTC_ICON_EN (1 << 15) +# define RADEON_CRTC_CUR_EN (1 << 16) +# define RADEON_CRTC_VSTAT_MODE_MASK (3 << 17) +# define RADEON_CRTC_CUR_MODE_MASK (7 << 20) +# define RADEON_CRTC_CUR_MODE_SHIFT 20 +# define RADEON_CRTC_CUR_MODE_MONO 0 +# define RADEON_CRTC_CUR_MODE_24BPP 2 +# define RADEON_CRTC_EXT_DISP_EN (1 << 24) +# define RADEON_CRTC_EN (1 << 25) +# define RADEON_CRTC_DISP_REQ_EN_B (1 << 26) +#define RADEON_CRTC2_GEN_CNTL 0x03f8 +# define RADEON_CRTC2_DBL_SCAN_EN (1 << 0) +# define RADEON_CRTC2_INTERLACE_EN (1 << 1) +# define RADEON_CRTC2_SYNC_TRISTAT (1 << 4) +# define RADEON_CRTC2_HSYNC_TRISTAT (1 << 5) +# define RADEON_CRTC2_VSYNC_TRISTAT (1 << 6) +# define RADEON_CRTC2_CRT2_ON (1 << 7) +# define RADEON_CRTC2_PIX_WIDTH_SHIFT 8 +# define RADEON_CRTC2_PIX_WIDTH_MASK (0xf << 8) +# define RADEON_CRTC2_ICON_EN (1 << 15) +# define RADEON_CRTC2_CUR_EN (1 << 16) +# define RADEON_CRTC2_CUR_MODE_MASK (7 << 20) +# define RADEON_CRTC2_DISP_DIS (1 << 23) +# define RADEON_CRTC2_EN (1 << 25) +# define RADEON_CRTC2_DISP_REQ_EN_B (1 << 26) +# define RADEON_CRTC2_CSYNC_EN (1 << 27) +# define RADEON_CRTC2_HSYNC_DIS (1 << 28) +# define RADEON_CRTC2_VSYNC_DIS (1 << 29) +#define RADEON_CRTC_MORE_CNTL 0x27c +# define RADEON_CRTC_AUTO_HORZ_CENTER_EN (1<<2) +# define RADEON_CRTC_AUTO_VERT_CENTER_EN (1<<3) +# define RADEON_CRTC_H_CUTOFF_ACTIVE_EN (1<<4) +# define RADEON_CRTC_V_CUTOFF_ACTIVE_EN (1<<5) +#define RADEON_CRTC_GUI_TRIG_VLINE 0x0218 +#define RADEON_CRTC_H_SYNC_STRT_WID 0x0204 +# define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0) +# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x3ff << 3) +# define RADEON_CRTC_H_SYNC_STRT_CHAR_SHIFT 3 +# define RADEON_CRTC_H_SYNC_WID (0x3f << 16) +# define RADEON_CRTC_H_SYNC_WID_SHIFT 16 +# define RADEON_CRTC_H_SYNC_POL (1 << 23) +#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304 +# define RADEON_CRTC2_H_SYNC_STRT_PIX (0x07 << 0) +# define RADEON_CRTC2_H_SYNC_STRT_CHAR (0x3ff << 3) +# define RADEON_CRTC2_H_SYNC_STRT_CHAR_SHIFT 3 +# define RADEON_CRTC2_H_SYNC_WID (0x3f << 16) +# define RADEON_CRTC2_H_SYNC_WID_SHIFT 16 +# define RADEON_CRTC2_H_SYNC_POL (1 << 23) +#define RADEON_CRTC_H_TOTAL_DISP 0x0200 +# define RADEON_CRTC_H_TOTAL (0x03ff << 0) +# define RADEON_CRTC_H_TOTAL_SHIFT 0 +# define RADEON_CRTC_H_DISP (0x01ff << 16) +# define RADEON_CRTC_H_DISP_SHIFT 16 +#define RADEON_CRTC2_H_TOTAL_DISP 0x0300 +# define RADEON_CRTC2_H_TOTAL (0x03ff << 0) +# define RADEON_CRTC2_H_TOTAL_SHIFT 0 +# define RADEON_CRTC2_H_DISP (0x01ff << 16) +# define RADEON_CRTC2_H_DISP_SHIFT 16 + +#define RADEON_CRTC_OFFSET_RIGHT 0x0220 +#define RADEON_CRTC_OFFSET 0x0224 +# define RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET (1<<30) +# define RADEON_CRTC_OFFSET__OFFSET_LOCK (1<<31) + +#define RADEON_CRTC2_OFFSET 0x0324 +# define RADEON_CRTC2_OFFSET__GUI_TRIG_OFFSET (1<<30) +# define RADEON_CRTC2_OFFSET__OFFSET_LOCK (1<<31) +#define RADEON_CRTC_OFFSET_CNTL 0x0228 +# define RADEON_CRTC_TILE_LINE_SHIFT 0 +# define RADEON_CRTC_TILE_LINE_RIGHT_SHIFT 4 +# define R300_CRTC_X_Y_MODE_EN_RIGHT (1 << 6) +# define R300_CRTC_MICRO_TILE_BUFFER_RIGHT_MASK (3 << 7) +# define R300_CRTC_MICRO_TILE_BUFFER_RIGHT_AUTO (0 << 7) +# define R300_CRTC_MICRO_TILE_BUFFER_RIGHT_SINGLE (1 << 7) +# define R300_CRTC_MICRO_TILE_BUFFER_RIGHT_DOUBLE (2 << 7) +# define R300_CRTC_MICRO_TILE_BUFFER_RIGHT_DIS (3 << 7) +# define R300_CRTC_X_Y_MODE_EN (1 << 9) +# define R300_CRTC_MICRO_TILE_BUFFER_MASK (3 << 10) +# define R300_CRTC_MICRO_TILE_BUFFER_AUTO (0 << 10) +# define R300_CRTC_MICRO_TILE_BUFFER_SINGLE (1 << 10) +# define R300_CRTC_MICRO_TILE_BUFFER_DOUBLE (2 << 10) +# define R300_CRTC_MICRO_TILE_BUFFER_DIS (3 << 10) +# define R300_CRTC_MICRO_TILE_EN_RIGHT (1 << 12) +# define R300_CRTC_MICRO_TILE_EN (1 << 13) +# define R300_CRTC_MACRO_TILE_EN_RIGHT (1 << 14) +# define R300_CRTC_MACRO_TILE_EN (1 << 15) +# define RADEON_CRTC_TILE_EN_RIGHT (1 << 14) +# define RADEON_CRTC_TILE_EN (1 << 15) +# define RADEON_CRTC_OFFSET_FLIP_CNTL (1 << 16) +# define RADEON_CRTC_STEREO_OFFSET_EN (1 << 17) +# define RADEON_CRTC_GUI_TRIG_OFFSET_LEFT_EN (1 << 28) +# define RADEON_CRTC_GUI_TRIG_OFFSET_RIGHT_EN (1 << 29) + +#define R300_CRTC_TILE_X0_Y0 0x0350 +#define R300_CRTC2_TILE_X0_Y0 0x0358 + +#define RADEON_CRTC2_OFFSET_CNTL 0x0328 +# define RADEON_CRTC2_OFFSET_FLIP_CNTL (1 << 16) +# define RADEON_CRTC2_TILE_EN (1 << 15) +#define RADEON_CRTC_PITCH 0x022c +# define RADEON_CRTC_PITCH__SHIFT 0 +# define RADEON_CRTC_PITCH__RIGHT_SHIFT 16 + +#define RADEON_CRTC2_PITCH 0x032c +#define RADEON_CRTC_STATUS 0x005c +# define RADEON_CRTC_VBLANK_SAVE (1 << 1) +# define RADEON_CRTC_VBLANK_SAVE_CLEAR (1 << 1) +#define RADEON_CRTC2_STATUS 0x03fc +# define RADEON_CRTC2_VBLANK_SAVE (1 << 1) +# define RADEON_CRTC2_VBLANK_SAVE_CLEAR (1 << 1) +#define RADEON_CRTC_V_SYNC_STRT_WID 0x020c +# define RADEON_CRTC_V_SYNC_STRT (0x7ff << 0) +# define RADEON_CRTC_V_SYNC_STRT_SHIFT 0 +# define RADEON_CRTC_V_SYNC_WID (0x1f << 16) +# define RADEON_CRTC_V_SYNC_WID_SHIFT 16 +# define RADEON_CRTC_V_SYNC_POL (1 << 23) +#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c +# define RADEON_CRTC2_V_SYNC_STRT (0x7ff << 0) +# define RADEON_CRTC2_V_SYNC_STRT_SHIFT 0 +# define RADEON_CRTC2_V_SYNC_WID (0x1f << 16) +# define RADEON_CRTC2_V_SYNC_WID_SHIFT 16 +# define RADEON_CRTC2_V_SYNC_POL (1 << 23) +#define RADEON_CRTC_V_TOTAL_DISP 0x0208 +# define RADEON_CRTC_V_TOTAL (0x07ff << 0) +# define RADEON_CRTC_V_TOTAL_SHIFT 0 +# define RADEON_CRTC_V_DISP (0x07ff << 16) +# define RADEON_CRTC_V_DISP_SHIFT 16 +#define RADEON_CRTC2_V_TOTAL_DISP 0x0308 +# define RADEON_CRTC2_V_TOTAL (0x07ff << 0) +# define RADEON_CRTC2_V_TOTAL_SHIFT 0 +# define RADEON_CRTC2_V_DISP (0x07ff << 16) +# define RADEON_CRTC2_V_DISP_SHIFT 16 +#define RADEON_CRTC_VLINE_CRNT_VLINE 0x0210 +# define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16) +#define RADEON_CRTC2_CRNT_FRAME 0x0314 +#define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318 +#define RADEON_CRTC2_VLINE_CRNT_VLINE 0x0310 +#define RADEON_CRTC8_DATA 0x03d5 /* VGA, 0x3b5 */ +#define RADEON_CRTC8_IDX 0x03d4 /* VGA, 0x3b4 */ +#define RADEON_CUR_CLR0 0x026c +#define RADEON_CUR_CLR1 0x0270 +#define RADEON_CUR_HORZ_VERT_OFF 0x0268 +#define RADEON_CUR_HORZ_VERT_POSN 0x0264 +#define RADEON_CUR_OFFSET 0x0260 +# define RADEON_CUR_LOCK (1 << 31) +#define RADEON_CUR2_CLR0 0x036c +#define RADEON_CUR2_CLR1 0x0370 +#define RADEON_CUR2_HORZ_VERT_OFF 0x0368 +#define RADEON_CUR2_HORZ_VERT_POSN 0x0364 +#define RADEON_CUR2_OFFSET 0x0360 +# define RADEON_CUR2_LOCK (1 << 31) + +#define RADEON_DAC_CNTL 0x0058 +# define RADEON_DAC_RANGE_CNTL (3 << 0) +# define RADEON_DAC_RANGE_CNTL_PS2 (2 << 0) +# define RADEON_DAC_RANGE_CNTL_MASK 0x03 +# define RADEON_DAC_BLANKING (1 << 2) +# define RADEON_DAC_CMP_EN (1 << 3) +# define RADEON_DAC_CMP_OUTPUT (1 << 7) +# define RADEON_DAC_8BIT_EN (1 << 8) +# define RADEON_DAC_TVO_EN (1 << 10) +# define RADEON_DAC_VGA_ADR_EN (1 << 13) +# define RADEON_DAC_PDWN (1 << 15) +# define RADEON_DAC_MASK_ALL (0xff << 24) +#define RADEON_DAC_CNTL2 0x007c +# define RADEON_DAC2_TV_CLK_SEL (0 << 1) +# define RADEON_DAC2_DAC_CLK_SEL (1 << 0) +# define RADEON_DAC2_DAC2_CLK_SEL (1 << 1) +# define RADEON_DAC2_PALETTE_ACC_CTL (1 << 5) +# define RADEON_DAC2_CMP_EN (1 << 7) +# define RADEON_DAC2_CMP_OUT_R (1 << 8) +# define RADEON_DAC2_CMP_OUT_G (1 << 9) +# define RADEON_DAC2_CMP_OUT_B (1 << 10) +# define RADEON_DAC2_CMP_OUTPUT (1 << 11) +#define RADEON_DAC_EXT_CNTL 0x0280 +# define RADEON_DAC2_FORCE_BLANK_OFF_EN (1 << 0) +# define RADEON_DAC2_FORCE_DATA_EN (1 << 1) +# define RADEON_DAC_FORCE_BLANK_OFF_EN (1 << 4) +# define RADEON_DAC_FORCE_DATA_EN (1 << 5) +# define RADEON_DAC_FORCE_DATA_SEL_MASK (3 << 6) +# define RADEON_DAC_FORCE_DATA_SEL_R (0 << 6) +# define RADEON_DAC_FORCE_DATA_SEL_G (1 << 6) +# define RADEON_DAC_FORCE_DATA_SEL_B (2 << 6) +# define RADEON_DAC_FORCE_DATA_SEL_RGB (3 << 6) +# define RADEON_DAC_FORCE_DATA_MASK 0x0003ff00 +# define RADEON_DAC_FORCE_DATA_SHIFT 8 +#define RADEON_DAC_MACRO_CNTL 0x0d04 +# define RADEON_DAC_PDWN_R (1 << 16) +# define RADEON_DAC_PDWN_G (1 << 17) +# define RADEON_DAC_PDWN_B (1 << 18) +#define RADEON_DISP_PWR_MAN 0x0d08 +# define RADEON_DISP_PWR_MAN_D3_CRTC_EN (1 << 0) +# define RADEON_DISP_PWR_MAN_D3_CRTC2_EN (1 << 4) +# define RADEON_DISP_PWR_MAN_DPMS_ON (0 << 8) +# define RADEON_DISP_PWR_MAN_DPMS_STANDBY (1 << 8) +# define RADEON_DISP_PWR_MAN_DPMS_SUSPEND (2 << 8) +# define RADEON_DISP_PWR_MAN_DPMS_OFF (3 << 8) +# define RADEON_DISP_D3_RST (1 << 16) +# define RADEON_DISP_D3_REG_RST (1 << 17) +# define RADEON_DISP_D3_GRPH_RST (1 << 18) +# define RADEON_DISP_D3_SUBPIC_RST (1 << 19) +# define RADEON_DISP_D3_OV0_RST (1 << 20) +# define RADEON_DISP_D1D2_GRPH_RST (1 << 21) +# define RADEON_DISP_D1D2_SUBPIC_RST (1 << 22) +# define RADEON_DISP_D1D2_OV0_RST (1 << 23) +# define RADEON_DIG_TMDS_ENABLE_RST (1 << 24) +# define RADEON_TV_ENABLE_RST (1 << 25) +# define RADEON_AUTO_PWRUP_EN (1 << 26) +#define RADEON_TV_DAC_CNTL 0x088c +# define RADEON_TV_DAC_NBLANK (1 << 0) +# define RADEON_TV_DAC_NHOLD (1 << 1) +# define RADEON_TV_DAC_PEDESTAL (1 << 2) +# define RADEON_TV_MONITOR_DETECT_EN (1 << 4) +# define RADEON_TV_DAC_CMPOUT (1 << 5) +# define RADEON_TV_DAC_STD_MASK (3 << 8) +# define RADEON_TV_DAC_STD_PAL (0 << 8) +# define RADEON_TV_DAC_STD_NTSC (1 << 8) +# define RADEON_TV_DAC_STD_PS2 (2 << 8) +# define RADEON_TV_DAC_STD_RS343 (3 << 8) +# define RADEON_TV_DAC_BGSLEEP (1 << 6) +# define RADEON_TV_DAC_BGADJ_MASK (0xf << 16) +# define RADEON_TV_DAC_BGADJ_SHIFT 16 +# define RADEON_TV_DAC_DACADJ_MASK (0xf << 20) +# define RADEON_TV_DAC_DACADJ_SHIFT 20 +# define RADEON_TV_DAC_RDACPD (1 << 24) +# define RADEON_TV_DAC_GDACPD (1 << 25) +# define RADEON_TV_DAC_BDACPD (1 << 26) +# define RADEON_TV_DAC_RDACDET (1 << 29) +# define RADEON_TV_DAC_GDACDET (1 << 30) +# define RADEON_TV_DAC_BDACDET (1 << 31) +# define R420_TV_DAC_DACADJ_MASK (0x1f << 20) +# define R420_TV_DAC_RDACPD (1 << 25) +# define R420_TV_DAC_GDACPD (1 << 26) +# define R420_TV_DAC_BDACPD (1 << 27) +# define R420_TV_DAC_TVENABLE (1 << 28) +#define RADEON_DISP_HW_DEBUG 0x0d14 +# define RADEON_CRT2_DISP1_SEL (1 << 5) +#define RADEON_DISP_OUTPUT_CNTL 0x0d64 +# define RADEON_DISP_DAC_SOURCE_MASK 0x03 +# define RADEON_DISP_DAC2_SOURCE_MASK 0x0c +# define RADEON_DISP_DAC_SOURCE_CRTC2 0x01 +# define RADEON_DISP_DAC_SOURCE_RMX 0x02 +# define RADEON_DISP_DAC_SOURCE_LTU 0x03 +# define RADEON_DISP_DAC2_SOURCE_CRTC2 0x04 +# define RADEON_DISP_TVDAC_SOURCE_MASK (0x03 << 2) +# define RADEON_DISP_TVDAC_SOURCE_CRTC 0x0 +# define RADEON_DISP_TVDAC_SOURCE_CRTC2 (0x01 << 2) +# define RADEON_DISP_TVDAC_SOURCE_RMX (0x02 << 2) +# define RADEON_DISP_TVDAC_SOURCE_LTU (0x03 << 2) +# define RADEON_DISP_TRANS_MATRIX_MASK (0x03 << 4) +# define RADEON_DISP_TRANS_MATRIX_ALPHA_MSB (0x00 << 4) +# define RADEON_DISP_TRANS_MATRIX_GRAPHICS (0x01 << 4) +# define RADEON_DISP_TRANS_MATRIX_VIDEO (0x02 << 4) +# define RADEON_DISP_TV_SOURCE_CRTC (1 << 16) /* crtc1 or crtc2 */ +# define RADEON_DISP_TV_SOURCE_LTU (0 << 16) /* linear transform unit */ +#define RADEON_DISP_TV_OUT_CNTL 0x0d6c +# define RADEON_DISP_TV_PATH_SRC_CRTC2 (1 << 16) +# define RADEON_DISP_TV_PATH_SRC_CRTC1 (0 << 16) +#define RADEON_DAC_CRC_SIG 0x02cc +#define RADEON_DAC_DATA 0x03c9 /* VGA */ +#define RADEON_DAC_MASK 0x03c6 /* VGA */ +#define RADEON_DAC_R_INDEX 0x03c7 /* VGA */ +#define RADEON_DAC_W_INDEX 0x03c8 /* VGA */ +#define RADEON_DDA_CONFIG 0x02e0 +#define RADEON_DDA_ON_OFF 0x02e4 +#define RADEON_DEFAULT_OFFSET 0x16e0 +#define RADEON_DEFAULT_PITCH 0x16e4 +#define RADEON_DEFAULT_SC_BOTTOM_RIGHT 0x16e8 +# define RADEON_DEFAULT_SC_RIGHT_MAX (0x1fff << 0) +# define RADEON_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16) +#define RADEON_DESTINATION_3D_CLR_CMP_VAL 0x1820 +#define RADEON_DESTINATION_3D_CLR_CMP_MSK 0x1824 +#define RADEON_DEVICE_ID 0x0f02 /* PCI */ +#define RADEON_DISP_MISC_CNTL 0x0d00 +# define RADEON_SOFT_RESET_GRPH_PP (1 << 0) +#define RADEON_DISP_MERGE_CNTL 0x0d60 +# define RADEON_DISP_ALPHA_MODE_MASK 0x03 +# define RADEON_DISP_ALPHA_MODE_KEY 0 +# define RADEON_DISP_ALPHA_MODE_PER_PIXEL 1 +# define RADEON_DISP_ALPHA_MODE_GLOBAL 2 +# define RADEON_DISP_RGB_OFFSET_EN (1 << 8) +# define RADEON_DISP_GRPH_ALPHA_MASK (0xff << 16) +# define RADEON_DISP_OV0_ALPHA_MASK (0xff << 24) +# define RADEON_DISP_LIN_TRANS_BYPASS (0x01 << 9) +#define RADEON_DISP2_MERGE_CNTL 0x0d68 +# define RADEON_DISP2_RGB_OFFSET_EN (1 << 8) +#define RADEON_DISP_LIN_TRANS_GRPH_A 0x0d80 +#define RADEON_DISP_LIN_TRANS_GRPH_B 0x0d84 +#define RADEON_DISP_LIN_TRANS_GRPH_C 0x0d88 +#define RADEON_DISP_LIN_TRANS_GRPH_D 0x0d8c +#define RADEON_DISP_LIN_TRANS_GRPH_E 0x0d90 +#define RADEON_DISP_LIN_TRANS_GRPH_F 0x0d98 +#define RADEON_DP_BRUSH_BKGD_CLR 0x1478 +#define RADEON_DP_BRUSH_FRGD_CLR 0x147c +#define RADEON_DP_CNTL 0x16c0 +# define RADEON_DST_X_LEFT_TO_RIGHT (1 << 0) +# define RADEON_DST_Y_TOP_TO_BOTTOM (1 << 1) +# define RADEON_DP_DST_TILE_LINEAR (0 << 3) +# define RADEON_DP_DST_TILE_MACRO (1 << 3) +# define RADEON_DP_DST_TILE_MICRO (2 << 3) +# define RADEON_DP_DST_TILE_BOTH (3 << 3) +#define RADEON_DP_CNTL_XDIR_YDIR_YMAJOR 0x16d0 +# define RADEON_DST_Y_MAJOR (1 << 2) +# define RADEON_DST_Y_DIR_TOP_TO_BOTTOM (1 << 15) +# define RADEON_DST_X_DIR_LEFT_TO_RIGHT (1 << 31) +#define RADEON_DP_DATATYPE 0x16c4 +# define RADEON_HOST_BIG_ENDIAN_EN (1 << 29) +#define RADEON_DP_GUI_MASTER_CNTL 0x146c +# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) +# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) +# define RADEON_GMC_SRC_CLIPPING (1 << 2) +# define RADEON_GMC_DST_CLIPPING (1 << 3) +# define RADEON_GMC_BRUSH_DATATYPE_MASK (0x0f << 4) +# define RADEON_GMC_BRUSH_8X8_MONO_FG_BG (0 << 4) +# define RADEON_GMC_BRUSH_8X8_MONO_FG_LA (1 << 4) +# define RADEON_GMC_BRUSH_1X8_MONO_FG_BG (4 << 4) +# define RADEON_GMC_BRUSH_1X8_MONO_FG_LA (5 << 4) +# define RADEON_GMC_BRUSH_32x1_MONO_FG_BG (6 << 4) +# define RADEON_GMC_BRUSH_32x1_MONO_FG_LA (7 << 4) +# define RADEON_GMC_BRUSH_32x32_MONO_FG_BG (8 << 4) +# define RADEON_GMC_BRUSH_32x32_MONO_FG_LA (9 << 4) +# define RADEON_GMC_BRUSH_8x8_COLOR (10 << 4) +# define RADEON_GMC_BRUSH_1X8_COLOR (12 << 4) +# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) +# define RADEON_GMC_BRUSH_NONE (15 << 4) +# define RADEON_GMC_DST_8BPP_CI (2 << 8) +# define RADEON_GMC_DST_15BPP (3 << 8) +# define RADEON_GMC_DST_16BPP (4 << 8) +# define RADEON_GMC_DST_24BPP (5 << 8) +# define RADEON_GMC_DST_32BPP (6 << 8) +# define RADEON_GMC_DST_8BPP_RGB (7 << 8) +# define RADEON_GMC_DST_Y8 (8 << 8) +# define RADEON_GMC_DST_RGB8 (9 << 8) +# define RADEON_GMC_DST_VYUY (11 << 8) +# define RADEON_GMC_DST_YVYU (12 << 8) +# define RADEON_GMC_DST_AYUV444 (14 << 8) +# define RADEON_GMC_DST_ARGB4444 (15 << 8) +# define RADEON_GMC_DST_DATATYPE_MASK (0x0f << 8) +# define RADEON_GMC_DST_DATATYPE_SHIFT 8 +# define RADEON_GMC_SRC_DATATYPE_MASK (3 << 12) +# define RADEON_GMC_SRC_DATATYPE_MONO_FG_BG (0 << 12) +# define RADEON_GMC_SRC_DATATYPE_MONO_FG_LA (1 << 12) +# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) +# define RADEON_GMC_BYTE_PIX_ORDER (1 << 14) +# define RADEON_GMC_BYTE_MSB_TO_LSB (0 << 14) +# define RADEON_GMC_BYTE_LSB_TO_MSB (1 << 14) +# define RADEON_GMC_CONVERSION_TEMP (1 << 15) +# define RADEON_GMC_CONVERSION_TEMP_6500 (0 << 15) +# define RADEON_GMC_CONVERSION_TEMP_9300 (1 << 15) +# define RADEON_GMC_ROP3_MASK (0xff << 16) +# define RADEON_DP_SRC_SOURCE_MASK (7 << 24) +# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) +# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) +# define RADEON_GMC_3D_FCN_EN (1 << 27) +# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) +# define RADEON_GMC_AUX_CLIP_DIS (1 << 29) +# define RADEON_GMC_WR_MSK_DIS (1 << 30) +# define RADEON_GMC_LD_BRUSH_Y_X (1 << 31) +# define RADEON_ROP3_ZERO 0x00000000 +# define RADEON_ROP3_DSa 0x00880000 +# define RADEON_ROP3_SDna 0x00440000 +# define RADEON_ROP3_S 0x00cc0000 +# define RADEON_ROP3_DSna 0x00220000 +# define RADEON_ROP3_D 0x00aa0000 +# define RADEON_ROP3_DSx 0x00660000 +# define RADEON_ROP3_DSo 0x00ee0000 +# define RADEON_ROP3_DSon 0x00110000 +# define RADEON_ROP3_DSxn 0x00990000 +# define RADEON_ROP3_Dn 0x00550000 +# define RADEON_ROP3_SDno 0x00dd0000 +# define RADEON_ROP3_Sn 0x00330000 +# define RADEON_ROP3_DSno 0x00bb0000 +# define RADEON_ROP3_DSan 0x00770000 +# define RADEON_ROP3_ONE 0x00ff0000 +# define RADEON_ROP3_DPa 0x00a00000 +# define RADEON_ROP3_PDna 0x00500000 +# define RADEON_ROP3_P 0x00f00000 +# define RADEON_ROP3_DPna 0x000a0000 +# define RADEON_ROP3_D 0x00aa0000 +# define RADEON_ROP3_DPx 0x005a0000 +# define RADEON_ROP3_DPo 0x00fa0000 +# define RADEON_ROP3_DPon 0x00050000 +# define RADEON_ROP3_PDxn 0x00a50000 +# define RADEON_ROP3_PDno 0x00f50000 +# define RADEON_ROP3_Pn 0x000f0000 +# define RADEON_ROP3_DPno 0x00af0000 +# define RADEON_ROP3_DPan 0x005f0000 +#define RADEON_DP_GUI_MASTER_CNTL_C 0x1c84 +#define RADEON_DP_MIX 0x16c8 +#define RADEON_DP_SRC_BKGD_CLR 0x15dc +#define RADEON_DP_SRC_FRGD_CLR 0x15d8 +#define RADEON_DP_WRITE_MASK 0x16cc +#define RADEON_DST_BRES_DEC 0x1630 +#define RADEON_DST_BRES_ERR 0x1628 +#define RADEON_DST_BRES_INC 0x162c +#define RADEON_DST_BRES_LNTH 0x1634 +#define RADEON_DST_BRES_LNTH_SUB 0x1638 +#define RADEON_DST_HEIGHT 0x1410 +#define RADEON_DST_HEIGHT_WIDTH 0x143c +#define RADEON_DST_HEIGHT_WIDTH_8 0x158c +#define RADEON_DST_HEIGHT_WIDTH_BW 0x15b4 +#define RADEON_DST_HEIGHT_Y 0x15a0 +#define RADEON_DST_LINE_START 0x1600 +#define RADEON_DST_LINE_END 0x1604 +#define RADEON_DST_LINE_PATCOUNT 0x1608 +# define RADEON_BRES_CNTL_SHIFT 8 +#define RADEON_DST_OFFSET 0x1404 +#define RADEON_DST_PITCH 0x1408 +#define RADEON_DST_PITCH_OFFSET 0x142c +#define RADEON_DST_PITCH_OFFSET_C 0x1c80 +# define RADEON_PITCH_SHIFT 21 +# define RADEON_DST_TILE_LINEAR (0 << 30) +# define RADEON_DST_TILE_MACRO (1 << 30) +# define RADEON_DST_TILE_MICRO (2 << 30) +# define RADEON_DST_TILE_BOTH (3 << 30) +#define RADEON_DST_WIDTH 0x140c +#define RADEON_DST_WIDTH_HEIGHT 0x1598 +#define RADEON_DST_WIDTH_X 0x1588 +#define RADEON_DST_WIDTH_X_INCY 0x159c +#define RADEON_DST_X 0x141c +#define RADEON_DST_X_SUB 0x15a4 +#define RADEON_DST_X_Y 0x1594 +#define RADEON_DST_Y 0x1420 +#define RADEON_DST_Y_SUB 0x15a8 +#define RADEON_DST_Y_X 0x1438 + +#define RADEON_FCP_CNTL 0x0910 +# define RADEON_FCP0_SRC_PCICLK 0 +# define RADEON_FCP0_SRC_PCLK 1 +# define RADEON_FCP0_SRC_PCLKb 2 +# define RADEON_FCP0_SRC_HREF 3 +# define RADEON_FCP0_SRC_GND 4 +# define RADEON_FCP0_SRC_HREFb 5 +#define RADEON_FLUSH_1 0x1704 +#define RADEON_FLUSH_2 0x1708 +#define RADEON_FLUSH_3 0x170c +#define RADEON_FLUSH_4 0x1710 +#define RADEON_FLUSH_5 0x1714 +#define RADEON_FLUSH_6 0x1718 +#define RADEON_FLUSH_7 0x171c +#define RADEON_FOG_3D_TABLE_START 0x1810 +#define RADEON_FOG_3D_TABLE_END 0x1814 +#define RADEON_FOG_3D_TABLE_DENSITY 0x181c +#define RADEON_FOG_TABLE_INDEX 0x1a14 +#define RADEON_FOG_TABLE_DATA 0x1a18 +#define RADEON_FP_CRTC_H_TOTAL_DISP 0x0250 +#define RADEON_FP_CRTC_V_TOTAL_DISP 0x0254 +# define RADEON_FP_CRTC_H_TOTAL_MASK 0x000003ff +# define RADEON_FP_CRTC_H_DISP_MASK 0x01ff0000 +# define RADEON_FP_CRTC_V_TOTAL_MASK 0x00000fff +# define RADEON_FP_CRTC_V_DISP_MASK 0x0fff0000 +# define RADEON_FP_H_SYNC_STRT_CHAR_MASK 0x00001ff8 +# define RADEON_FP_H_SYNC_WID_MASK 0x003f0000 +# define RADEON_FP_V_SYNC_STRT_MASK 0x00000fff +# define RADEON_FP_V_SYNC_WID_MASK 0x001f0000 +# define RADEON_FP_CRTC_H_TOTAL_SHIFT 0x00000000 +# define RADEON_FP_CRTC_H_DISP_SHIFT 0x00000010 +# define RADEON_FP_CRTC_V_TOTAL_SHIFT 0x00000000 +# define RADEON_FP_CRTC_V_DISP_SHIFT 0x00000010 +# define RADEON_FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003 +# define RADEON_FP_H_SYNC_WID_SHIFT 0x00000010 +# define RADEON_FP_V_SYNC_STRT_SHIFT 0x00000000 +# define RADEON_FP_V_SYNC_WID_SHIFT 0x00000010 +#define RADEON_FP_GEN_CNTL 0x0284 +# define RADEON_FP_FPON (1 << 0) +# define RADEON_FP_BLANK_EN (1 << 1) +# define RADEON_FP_TMDS_EN (1 << 2) +# define RADEON_FP_PANEL_FORMAT (1 << 3) +# define RADEON_FP_EN_TMDS (1 << 7) +# define RADEON_FP_DETECT_SENSE (1 << 8) +# define RADEON_FP_DETECT_INT_POL (1 << 9) +# define R200_FP_SOURCE_SEL_MASK (3 << 10) +# define R200_FP_SOURCE_SEL_CRTC1 (0 << 10) +# define R200_FP_SOURCE_SEL_CRTC2 (1 << 10) +# define R200_FP_SOURCE_SEL_RMX (2 << 10) +# define R200_FP_SOURCE_SEL_TRANS (3 << 10) +# define RADEON_FP_SEL_CRTC1 (0 << 13) +# define RADEON_FP_SEL_CRTC2 (1 << 13) +# define R300_HPD_SEL(x) ((x) << 13) +# define RADEON_FP_CRTC_DONT_SHADOW_HPAR (1 << 15) +# define RADEON_FP_CRTC_DONT_SHADOW_VPAR (1 << 16) +# define RADEON_FP_CRTC_DONT_SHADOW_HEND (1 << 17) +# define RADEON_FP_CRTC_USE_SHADOW_VEND (1 << 18) +# define RADEON_FP_RMX_HVSYNC_CONTROL_EN (1 << 20) +# define RADEON_FP_DFP_SYNC_SEL (1 << 21) +# define RADEON_FP_CRTC_LOCK_8DOT (1 << 22) +# define RADEON_FP_CRT_SYNC_SEL (1 << 23) +# define RADEON_FP_USE_SHADOW_EN (1 << 24) +# define RADEON_FP_CRT_SYNC_ALT (1 << 26) +#define RADEON_FP2_GEN_CNTL 0x0288 +# define RADEON_FP2_BLANK_EN (1 << 1) +# define RADEON_FP2_ON (1 << 2) +# define RADEON_FP2_PANEL_FORMAT (1 << 3) +# define RADEON_FP2_DETECT_SENSE (1 << 8) +# define RADEON_FP2_DETECT_INT_POL (1 << 9) +# define R200_FP2_SOURCE_SEL_MASK (3 << 10) +# define R200_FP2_SOURCE_SEL_CRTC1 (0 << 10) +# define R200_FP2_SOURCE_SEL_CRTC2 (1 << 10) +# define R200_FP2_SOURCE_SEL_RMX (2 << 10) +# define R200_FP2_SOURCE_SEL_TRANS_UNIT (3 << 10) +# define RADEON_FP2_SRC_SEL_MASK (3 << 13) +# define RADEON_FP2_SRC_SEL_CRTC2 (1 << 13) +# define RADEON_FP2_FP_POL (1 << 16) +# define RADEON_FP2_LP_POL (1 << 17) +# define RADEON_FP2_SCK_POL (1 << 18) +# define RADEON_FP2_LCD_CNTL_MASK (7 << 19) +# define RADEON_FP2_PAD_FLOP_EN (1 << 22) +# define RADEON_FP2_CRC_EN (1 << 23) +# define RADEON_FP2_CRC_READ_EN (1 << 24) +# define RADEON_FP2_DVO_EN (1 << 25) +# define RADEON_FP2_DVO_RATE_SEL_SDR (1 << 26) +# define R200_FP2_DVO_RATE_SEL_SDR (1 << 27) +# define R300_FP2_DVO_CLOCK_MODE_SINGLE (1 << 28) +# define R300_FP2_DVO_DUAL_CHANNEL_EN (1 << 29) +#define RADEON_FP_H_SYNC_STRT_WID 0x02c4 +#define RADEON_FP_H2_SYNC_STRT_WID 0x03c4 +#define RADEON_FP_HORZ_STRETCH 0x028c +#define RADEON_FP_HORZ2_STRETCH 0x038c +# define RADEON_HORZ_STRETCH_RATIO_MASK 0xffff +# define RADEON_HORZ_STRETCH_RATIO_MAX 4096 +# define RADEON_HORZ_PANEL_SIZE (0x1ff << 16) +# define RADEON_HORZ_PANEL_SHIFT 16 +# define RADEON_HORZ_STRETCH_PIXREP (0 << 25) +# define RADEON_HORZ_STRETCH_BLEND (1 << 26) +# define RADEON_HORZ_STRETCH_ENABLE (1 << 25) +# define RADEON_HORZ_AUTO_RATIO (1 << 27) +# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 28) +# define RADEON_HORZ_AUTO_RATIO_INC (1 << 31) +#define RADEON_FP_HORZ_VERT_ACTIVE 0x0278 +#define RADEON_FP_V_SYNC_STRT_WID 0x02c8 +#define RADEON_FP_VERT_STRETCH 0x0290 +#define RADEON_FP_V2_SYNC_STRT_WID 0x03c8 +#define RADEON_FP_VERT2_STRETCH 0x0390 +# define RADEON_VERT_PANEL_SIZE (0xfff << 12) +# define RADEON_VERT_PANEL_SHIFT 12 +# define RADEON_VERT_STRETCH_RATIO_MASK 0xfff +# define RADEON_VERT_STRETCH_RATIO_SHIFT 0 +# define RADEON_VERT_STRETCH_RATIO_MAX 4096 +# define RADEON_VERT_STRETCH_ENABLE (1 << 25) +# define RADEON_VERT_STRETCH_LINEREP (0 << 26) +# define RADEON_VERT_STRETCH_BLEND (1 << 26) +# define RADEON_VERT_AUTO_RATIO_EN (1 << 27) +# define RADEON_VERT_AUTO_RATIO_INC (1 << 31) +# define RADEON_VERT_STRETCH_RESERVED 0x71000000 +#define RS400_FP_2ND_GEN_CNTL 0x0384 +# define RS400_FP_2ND_ON (1 << 0) +# define RS400_FP_2ND_BLANK_EN (1 << 1) +# define RS400_TMDS_2ND_EN (1 << 2) +# define RS400_PANEL_FORMAT_2ND (1 << 3) +# define RS400_FP_2ND_EN_TMDS (1 << 7) +# define RS400_FP_2ND_DETECT_SENSE (1 << 8) +# define RS400_FP_2ND_SOURCE_SEL_MASK (3 << 10) +# define RS400_FP_2ND_SOURCE_SEL_CRTC1 (0 << 10) +# define RS400_FP_2ND_SOURCE_SEL_CRTC2 (1 << 10) +# define RS400_FP_2ND_SOURCE_SEL_RMX (2 << 10) +# define RS400_FP_2ND_DETECT_EN (1 << 12) +# define RS400_HPD_2ND_SEL (1 << 13) +#define RS400_FP2_2_GEN_CNTL 0x0388 +# define RS400_FP2_2_BLANK_EN (1 << 1) +# define RS400_FP2_2_ON (1 << 2) +# define RS400_FP2_2_PANEL_FORMAT (1 << 3) +# define RS400_FP2_2_DETECT_SENSE (1 << 8) +# define RS400_FP2_2_SOURCE_SEL_MASK (3 << 10) +# define RS400_FP2_2_SOURCE_SEL_CRTC1 (0 << 10) +# define RS400_FP2_2_SOURCE_SEL_CRTC2 (1 << 10) +# define RS400_FP2_2_SOURCE_SEL_RMX (2 << 10) +# define RS400_FP2_2_DVO2_EN (1 << 25) +#define RS400_TMDS2_CNTL 0x0394 +#define RS400_TMDS2_TRANSMITTER_CNTL 0x03a4 +# define RS400_TMDS2_PLLEN (1 << 0) +# define RS400_TMDS2_PLLRST (1 << 1) + +#define RADEON_GEN_INT_CNTL 0x0040 +# define RADEON_CRTC_VBLANK_MASK (1 << 0) +# define RADEON_FP_DETECT_MASK (1 << 4) +# define RADEON_CRTC2_VBLANK_MASK (1 << 9) +# define RADEON_FP2_DETECT_MASK (1 << 10) +# define RADEON_GUI_IDLE_MASK (1 << 19) +# define RADEON_SW_INT_ENABLE (1 << 25) +#define RADEON_GEN_INT_STATUS 0x0044 +# define AVIVO_DISPLAY_INT_STATUS (1 << 0) +# define RADEON_CRTC_VBLANK_STAT (1 << 0) +# define RADEON_CRTC_VBLANK_STAT_ACK (1 << 0) +# define RADEON_FP_DETECT_STAT (1 << 4) +# define RADEON_FP_DETECT_STAT_ACK (1 << 4) +# define RADEON_CRTC2_VBLANK_STAT (1 << 9) +# define RADEON_CRTC2_VBLANK_STAT_ACK (1 << 9) +# define RADEON_FP2_DETECT_STAT (1 << 10) +# define RADEON_FP2_DETECT_STAT_ACK (1 << 10) +# define RADEON_GUI_IDLE_STAT (1 << 19) +# define RADEON_GUI_IDLE_STAT_ACK (1 << 19) +# define RADEON_SW_INT_FIRE (1 << 26) +# define RADEON_SW_INT_TEST (1 << 25) +# define RADEON_SW_INT_TEST_ACK (1 << 25) +#define RADEON_GENENB 0x03c3 /* VGA */ +#define RADEON_GENFC_RD 0x03ca /* VGA */ +#define RADEON_GENFC_WT 0x03da /* VGA, 0x03ba */ +#define RADEON_GENMO_RD 0x03cc /* VGA */ +#define RADEON_GENMO_WT 0x03c2 /* VGA */ +#define RADEON_GENS0 0x03c2 /* VGA */ +#define RADEON_GENS1 0x03da /* VGA, 0x03ba */ +#define RADEON_GPIO_MONID 0x0068 /* DDC interface via I2C */ /* DDC3 */ +#define RADEON_GPIO_MONIDB 0x006c +#define RADEON_GPIO_CRT2_DDC 0x006c +#define RADEON_GPIO_DVI_DDC 0x0064 /* DDC2 */ +#define RADEON_GPIO_VGA_DDC 0x0060 /* DDC1 */ +# define RADEON_GPIO_A_0 (1 << 0) +# define RADEON_GPIO_A_1 (1 << 1) +# define RADEON_GPIO_Y_0 (1 << 8) +# define RADEON_GPIO_Y_1 (1 << 9) +# define RADEON_GPIO_Y_SHIFT_0 8 +# define RADEON_GPIO_Y_SHIFT_1 9 +# define RADEON_GPIO_EN_0 (1 << 16) +# define RADEON_GPIO_EN_1 (1 << 17) +# define RADEON_GPIO_MASK_0 (1 << 24) /*??*/ +# define RADEON_GPIO_MASK_1 (1 << 25) /*??*/ +#define RADEON_GRPH8_DATA 0x03cf /* VGA */ +#define RADEON_GRPH8_IDX 0x03ce /* VGA */ +#define RADEON_GUI_SCRATCH_REG0 0x15e0 +#define RADEON_GUI_SCRATCH_REG1 0x15e4 +#define RADEON_GUI_SCRATCH_REG2 0x15e8 +#define RADEON_GUI_SCRATCH_REG3 0x15ec +#define RADEON_GUI_SCRATCH_REG4 0x15f0 +#define RADEON_GUI_SCRATCH_REG5 0x15f4 + +#define RADEON_HEADER 0x0f0e /* PCI */ +#define RADEON_HOST_DATA0 0x17c0 +#define RADEON_HOST_DATA1 0x17c4 +#define RADEON_HOST_DATA2 0x17c8 +#define RADEON_HOST_DATA3 0x17cc +#define RADEON_HOST_DATA4 0x17d0 +#define RADEON_HOST_DATA5 0x17d4 +#define RADEON_HOST_DATA6 0x17d8 +#define RADEON_HOST_DATA7 0x17dc +#define RADEON_HOST_DATA_LAST 0x17e0 +#define RADEON_HOST_PATH_CNTL 0x0130 +# define RADEON_HP_LIN_RD_CACHE_DIS (1 << 24) +# define RADEON_HDP_READ_BUFFER_INVALIDATE (1 << 27) +# define RADEON_HDP_SOFT_RESET (1 << 26) +# define RADEON_HDP_APER_CNTL (1 << 23) +#define RADEON_HTOTAL_CNTL 0x0009 /* PLL */ +# define RADEON_HTOT_CNTL_VGA_EN (1 << 28) +#define RADEON_HTOTAL2_CNTL 0x002e /* PLL */ + + /* Multimedia I2C bus */ +#define RADEON_I2C_CNTL_0 0x0090 +# define RADEON_I2C_DONE (1 << 0) +# define RADEON_I2C_NACK (1 << 1) +# define RADEON_I2C_HALT (1 << 2) +# define RADEON_I2C_SOFT_RST (1 << 5) +# define RADEON_I2C_DRIVE_EN (1 << 6) +# define RADEON_I2C_DRIVE_SEL (1 << 7) +# define RADEON_I2C_START (1 << 8) +# define RADEON_I2C_STOP (1 << 9) +# define RADEON_I2C_RECEIVE (1 << 10) +# define RADEON_I2C_ABORT (1 << 11) +# define RADEON_I2C_GO (1 << 12) +# define RADEON_I2C_PRESCALE_SHIFT 16 +#define RADEON_I2C_CNTL_1 0x0094 +# define RADEON_I2C_DATA_COUNT_SHIFT 0 +# define RADEON_I2C_ADDR_COUNT_SHIFT 4 +# define RADEON_I2C_INTRA_BYTE_DELAY_SHIFT 8 +# define RADEON_I2C_SEL (1 << 16) +# define RADEON_I2C_EN (1 << 17) +# define RADEON_I2C_TIME_LIMIT_SHIFT 24 +#define RADEON_I2C_DATA 0x0098 + +#define RADEON_DVI_I2C_CNTL_0 0x02e0 +# define R200_DVI_I2C_PIN_SEL(x) ((x) << 3) +# define R200_SEL_DDC1 0 /* depends on asic */ +# define R200_SEL_DDC2 1 /* depends on asic */ +# define R200_SEL_DDC3 2 /* depends on asic */ +# define RADEON_SW_WANTS_TO_USE_DVI_I2C (1 << 13) +# define RADEON_SW_CAN_USE_DVI_I2C (1 << 13) +# define RADEON_SW_DONE_USING_DVI_I2C (1 << 14) +# define RADEON_HW_NEEDS_DVI_I2C (1 << 14) +# define RADEON_ABORT_HW_DVI_I2C (1 << 15) +# define RADEON_HW_USING_DVI_I2C (1 << 15) +#define RADEON_DVI_I2C_CNTL_1 0x02e4 +#define RADEON_DVI_I2C_DATA 0x02e8 + +#define RADEON_INTERRUPT_LINE 0x0f3c /* PCI */ +#define RADEON_INTERRUPT_PIN 0x0f3d /* PCI */ +#define RADEON_IO_BASE 0x0f14 /* PCI */ + +#define RADEON_LATENCY 0x0f0d /* PCI */ +#define RADEON_LEAD_BRES_DEC 0x1608 +#define RADEON_LEAD_BRES_LNTH 0x161c +#define RADEON_LEAD_BRES_LNTH_SUB 0x1624 +#define RADEON_LVDS_GEN_CNTL 0x02d0 +# define RADEON_LVDS_ON (1 << 0) +# define RADEON_LVDS_DISPLAY_DIS (1 << 1) +# define RADEON_LVDS_PANEL_TYPE (1 << 2) +# define RADEON_LVDS_PANEL_FORMAT (1 << 3) +# define RADEON_LVDS_NO_FM (0 << 4) +# define RADEON_LVDS_2_GREY (1 << 4) +# define RADEON_LVDS_4_GREY (2 << 4) +# define RADEON_LVDS_RST_FM (1 << 6) +# define RADEON_LVDS_EN (1 << 7) +# define RADEON_LVDS_BL_MOD_LEVEL_SHIFT 8 +# define RADEON_LVDS_BL_MOD_LEVEL_MASK (0xff << 8) +# define RADEON_LVDS_BL_MOD_EN (1 << 16) +# define RADEON_LVDS_BL_CLK_SEL (1 << 17) +# define RADEON_LVDS_DIGON (1 << 18) +# define RADEON_LVDS_BLON (1 << 19) +# define RADEON_LVDS_FP_POL_LOW (1 << 20) +# define RADEON_LVDS_LP_POL_LOW (1 << 21) +# define RADEON_LVDS_DTM_POL_LOW (1 << 22) +# define RADEON_LVDS_SEL_CRTC2 (1 << 23) +# define RADEON_LVDS_FPDI_EN (1 << 27) +# define RADEON_LVDS_HSYNC_DELAY_SHIFT 28 +#define RADEON_LVDS_PLL_CNTL 0x02d4 +# define RADEON_HSYNC_DELAY_SHIFT 28 +# define RADEON_HSYNC_DELAY_MASK (0xf << 28) +# define RADEON_LVDS_PLL_EN (1 << 16) +# define RADEON_LVDS_PLL_RESET (1 << 17) +# define R300_LVDS_SRC_SEL_MASK (3 << 18) +# define R300_LVDS_SRC_SEL_CRTC1 (0 << 18) +# define R300_LVDS_SRC_SEL_CRTC2 (1 << 18) +# define R300_LVDS_SRC_SEL_RMX (2 << 18) +#define RADEON_LVDS_SS_GEN_CNTL 0x02ec +# define RADEON_LVDS_PWRSEQ_DELAY1_SHIFT 16 +# define RADEON_LVDS_PWRSEQ_DELAY2_SHIFT 20 + +#define RADEON_MAX_LATENCY 0x0f3f /* PCI */ +#define RADEON_DISPLAY_BASE_ADDR 0x23c +#define RADEON_DISPLAY2_BASE_ADDR 0x33c +#define RADEON_OV0_BASE_ADDR 0x43c +#define RADEON_NB_TOM 0x15c +#define R300_MC_INIT_MISC_LAT_TIMER 0x180 +# define R300_MC_DISP0R_INIT_LAT_SHIFT 8 +# define R300_MC_DISP0R_INIT_LAT_MASK 0xf +# define R300_MC_DISP1R_INIT_LAT_SHIFT 12 +# define R300_MC_DISP1R_INIT_LAT_MASK 0xf +#define RADEON_MCLK_CNTL 0x0012 /* PLL */ +# define RADEON_MCLKA_SRC_SEL_MASK 0x7 +# define RADEON_FORCEON_MCLKA (1 << 16) +# define RADEON_FORCEON_MCLKB (1 << 17) +# define RADEON_FORCEON_YCLKA (1 << 18) +# define RADEON_FORCEON_YCLKB (1 << 19) +# define RADEON_FORCEON_MC (1 << 20) +# define RADEON_FORCEON_AIC (1 << 21) +# define R300_DISABLE_MC_MCLKA (1 << 21) +# define R300_DISABLE_MC_MCLKB (1 << 21) +#define RADEON_MCLK_MISC 0x001f /* PLL */ +# define RADEON_MC_MCLK_MAX_DYN_STOP_LAT (1 << 12) +# define RADEON_IO_MCLK_MAX_DYN_STOP_LAT (1 << 13) +# define RADEON_MC_MCLK_DYN_ENABLE (1 << 14) +# define RADEON_IO_MCLK_DYN_ENABLE (1 << 15) + +#define RADEON_GPIOPAD_MASK 0x0198 +#define RADEON_GPIOPAD_A 0x019c +#define RADEON_GPIOPAD_EN 0x01a0 +#define RADEON_GPIOPAD_Y 0x01a4 +#define RADEON_MDGPIO_MASK 0x01a8 +#define RADEON_MDGPIO_A 0x01ac +#define RADEON_MDGPIO_EN 0x01b0 +#define RADEON_MDGPIO_Y 0x01b4 + +#define RADEON_MEM_ADDR_CONFIG 0x0148 +#define RADEON_MEM_BASE 0x0f10 /* PCI */ +#define RADEON_MEM_CNTL 0x0140 +# define RADEON_MEM_NUM_CHANNELS_MASK 0x01 +# define RADEON_MEM_USE_B_CH_ONLY (1 << 1) +# define RV100_HALF_MODE (1 << 3) +# define R300_MEM_NUM_CHANNELS_MASK 0x03 +# define R300_MEM_USE_CD_CH_ONLY (1 << 2) +#define RADEON_MEM_TIMING_CNTL 0x0144 /* EXT_MEM_CNTL */ +#define RADEON_MEM_INIT_LAT_TIMER 0x0154 +#define RADEON_MEM_INTF_CNTL 0x014c +#define RADEON_MEM_SDRAM_MODE_REG 0x0158 +# define RADEON_SDRAM_MODE_MASK 0xffff0000 +# define RADEON_B3MEM_RESET_MASK 0x6fffffff +# define RADEON_MEM_CFG_TYPE_DDR (1 << 30) +#define RADEON_MEM_STR_CNTL 0x0150 +# define RADEON_MEM_PWRUP_COMPL_A (1 << 0) +# define RADEON_MEM_PWRUP_COMPL_B (1 << 1) +# define R300_MEM_PWRUP_COMPL_C (1 << 2) +# define R300_MEM_PWRUP_COMPL_D (1 << 3) +# define RADEON_MEM_PWRUP_COMPLETE 0x03 +# define R300_MEM_PWRUP_COMPLETE 0x0f +#define RADEON_MC_STATUS 0x0150 +# define RADEON_MC_IDLE (1 << 2) +# define R300_MC_IDLE (1 << 4) +#define RADEON_MEM_VGA_RP_SEL 0x003c +#define RADEON_MEM_VGA_WP_SEL 0x0038 +#define RADEON_MIN_GRANT 0x0f3e /* PCI */ +#define RADEON_MM_DATA 0x0004 +#define RADEON_MM_INDEX 0x0000 +# define RADEON_MM_APER (1 << 31) +#define RADEON_MPLL_CNTL 0x000e /* PLL */ +#define RADEON_MPP_TB_CONFIG 0x01c0 /* ? */ +#define RADEON_MPP_GP_CONFIG 0x01c8 /* ? */ +#define RADEON_SEPROM_CNTL1 0x01c0 +# define RADEON_SCK_PRESCALE_SHIFT 24 +# define RADEON_SCK_PRESCALE_MASK (0xff << 24) +#define R300_MC_IND_INDEX 0x01f8 +# define R300_MC_IND_ADDR_MASK 0x3f +# define R300_MC_IND_WR_EN (1 << 8) +#define R300_MC_IND_DATA 0x01fc +#define R300_MC_READ_CNTL_AB 0x017c +# define R300_MEM_RBS_POSITION_A_MASK 0x03 +#define R300_MC_READ_CNTL_CD_mcind 0x24 +# define R300_MEM_RBS_POSITION_C_MASK 0x03 + +#define RADEON_N_VIF_COUNT 0x0248 + +#define RADEON_OV0_AUTO_FLIP_CNTL 0x0470 +# define RADEON_OV0_AUTO_FLIP_CNTL_SOFT_BUF_NUM 0x00000007 +# define RADEON_OV0_AUTO_FLIP_CNTL_SOFT_REPEAT_FIELD 0x00000008 +# define RADEON_OV0_AUTO_FLIP_CNTL_SOFT_BUF_ODD 0x00000010 +# define RADEON_OV0_AUTO_FLIP_CNTL_IGNORE_REPEAT_FIELD 0x00000020 +# define RADEON_OV0_AUTO_FLIP_CNTL_SOFT_EOF_TOGGLE 0x00000040 +# define RADEON_OV0_AUTO_FLIP_CNTL_VID_PORT_SELECT 0x00000300 +# define RADEON_OV0_AUTO_FLIP_CNTL_P1_FIRST_LINE_EVEN 0x00010000 +# define RADEON_OV0_AUTO_FLIP_CNTL_SHIFT_EVEN_DOWN 0x00040000 +# define RADEON_OV0_AUTO_FLIP_CNTL_SHIFT_ODD_DOWN 0x00080000 +# define RADEON_OV0_AUTO_FLIP_CNTL_FIELD_POL_SOURCE 0x00800000 + +#define RADEON_OV0_COLOUR_CNTL 0x04E0 +#define RADEON_OV0_DEINTERLACE_PATTERN 0x0474 +#define RADEON_OV0_EXCLUSIVE_HORZ 0x0408 +# define RADEON_EXCL_HORZ_START_MASK 0x000000ff +# define RADEON_EXCL_HORZ_END_MASK 0x0000ff00 +# define RADEON_EXCL_HORZ_BACK_PORCH_MASK 0x00ff0000 +# define RADEON_EXCL_HORZ_EXCLUSIVE_EN 0x80000000 +#define RADEON_OV0_EXCLUSIVE_VERT 0x040C +# define RADEON_EXCL_VERT_START_MASK 0x000003ff +# define RADEON_EXCL_VERT_END_MASK 0x03ff0000 +#define RADEON_OV0_FILTER_CNTL 0x04A0 +# define RADEON_FILTER_PROGRAMMABLE_COEF 0x0 +# define RADEON_FILTER_HC_COEF_HORZ_Y 0x1 +# define RADEON_FILTER_HC_COEF_HORZ_UV 0x2 +# define RADEON_FILTER_HC_COEF_VERT_Y 0x4 +# define RADEON_FILTER_HC_COEF_VERT_UV 0x8 +# define RADEON_FILTER_HARDCODED_COEF 0xf +# define RADEON_FILTER_COEF_MASK 0xf + +#define RADEON_OV0_FOUR_TAP_COEF_0 0x04B0 +#define RADEON_OV0_FOUR_TAP_COEF_1 0x04B4 +#define RADEON_OV0_FOUR_TAP_COEF_2 0x04B8 +#define RADEON_OV0_FOUR_TAP_COEF_3 0x04BC +#define RADEON_OV0_FOUR_TAP_COEF_4 0x04C0 +#define RADEON_OV0_FLAG_CNTL 0x04DC +#define RADEON_OV0_GAMMA_000_00F 0x0d40 +#define RADEON_OV0_GAMMA_010_01F 0x0d44 +#define RADEON_OV0_GAMMA_020_03F 0x0d48 +#define RADEON_OV0_GAMMA_040_07F 0x0d4c +#define RADEON_OV0_GAMMA_080_0BF 0x0e00 +#define RADEON_OV0_GAMMA_0C0_0FF 0x0e04 +#define RADEON_OV0_GAMMA_100_13F 0x0e08 +#define RADEON_OV0_GAMMA_140_17F 0x0e0c +#define RADEON_OV0_GAMMA_180_1BF 0x0e10 +#define RADEON_OV0_GAMMA_1C0_1FF 0x0e14 +#define RADEON_OV0_GAMMA_200_23F 0x0e18 +#define RADEON_OV0_GAMMA_240_27F 0x0e1c +#define RADEON_OV0_GAMMA_280_2BF 0x0e20 +#define RADEON_OV0_GAMMA_2C0_2FF 0x0e24 +#define RADEON_OV0_GAMMA_300_33F 0x0e28 +#define RADEON_OV0_GAMMA_340_37F 0x0e2c +#define RADEON_OV0_GAMMA_380_3BF 0x0d50 +#define RADEON_OV0_GAMMA_3C0_3FF 0x0d54 +#define RADEON_OV0_GRAPHICS_KEY_CLR_LOW 0x04EC +#define RADEON_OV0_GRAPHICS_KEY_CLR_HIGH 0x04F0 +#define RADEON_OV0_H_INC 0x0480 +#define RADEON_OV0_KEY_CNTL 0x04F4 +# define RADEON_VIDEO_KEY_FN_MASK 0x00000003L +# define RADEON_VIDEO_KEY_FN_FALSE 0x00000000L +# define RADEON_VIDEO_KEY_FN_TRUE 0x00000001L +# define RADEON_VIDEO_KEY_FN_EQ 0x00000002L +# define RADEON_VIDEO_KEY_FN_NE 0x00000003L +# define RADEON_GRAPHIC_KEY_FN_MASK 0x00000030L +# define RADEON_GRAPHIC_KEY_FN_FALSE 0x00000000L +# define RADEON_GRAPHIC_KEY_FN_TRUE 0x00000010L +# define RADEON_GRAPHIC_KEY_FN_EQ 0x00000020L +# define RADEON_GRAPHIC_KEY_FN_NE 0x00000030L +# define RADEON_CMP_MIX_MASK 0x00000100L +# define RADEON_CMP_MIX_OR 0x00000000L +# define RADEON_CMP_MIX_AND 0x00000100L +#define RADEON_OV0_LIN_TRANS_A 0x0d20 +#define RADEON_OV0_LIN_TRANS_B 0x0d24 +#define RADEON_OV0_LIN_TRANS_C 0x0d28 +#define RADEON_OV0_LIN_TRANS_D 0x0d2c +#define RADEON_OV0_LIN_TRANS_E 0x0d30 +#define RADEON_OV0_LIN_TRANS_F 0x0d34 +#define RADEON_OV0_P1_BLANK_LINES_AT_TOP 0x0430 +# define RADEON_P1_BLNK_LN_AT_TOP_M1_MASK 0x00000fffL +# define RADEON_P1_ACTIVE_LINES_M1 0x0fff0000L +#define RADEON_OV0_P1_H_ACCUM_INIT 0x0488 +#define RADEON_OV0_P1_V_ACCUM_INIT 0x0428 +# define RADEON_OV0_P1_MAX_LN_IN_PER_LN_OUT 0x00000003L +# define RADEON_OV0_P1_V_ACCUM_INIT_MASK 0x01ff8000L +#define RADEON_OV0_P1_X_START_END 0x0494 +#define RADEON_OV0_P2_X_START_END 0x0498 +#define RADEON_OV0_P23_BLANK_LINES_AT_TOP 0x0434 +# define RADEON_P23_BLNK_LN_AT_TOP_M1_MASK 0x000007ffL +# define RADEON_P23_ACTIVE_LINES_M1 0x07ff0000L +#define RADEON_OV0_P23_H_ACCUM_INIT 0x048C +#define RADEON_OV0_P23_V_ACCUM_INIT 0x042C +#define RADEON_OV0_P3_X_START_END 0x049C +#define RADEON_OV0_REG_LOAD_CNTL 0x0410 +# define RADEON_REG_LD_CTL_LOCK 0x00000001L +# define RADEON_REG_LD_CTL_VBLANK_DURING_LOCK 0x00000002L +# define RADEON_REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L +# define RADEON_REG_LD_CTL_LOCK_READBACK 0x00000008L +# define RADEON_REG_LD_CTL_FLIP_READBACK 0x00000010L +#define RADEON_OV0_SCALE_CNTL 0x0420 +# define RADEON_SCALER_HORZ_PICK_NEAREST 0x00000004L +# define RADEON_SCALER_VERT_PICK_NEAREST 0x00000008L +# define RADEON_SCALER_SIGNED_UV 0x00000010L +# define RADEON_SCALER_GAMMA_SEL_MASK 0x00000060L +# define RADEON_SCALER_GAMMA_SEL_BRIGHT 0x00000000L +# define RADEON_SCALER_GAMMA_SEL_G22 0x00000020L +# define RADEON_SCALER_GAMMA_SEL_G18 0x00000040L +# define RADEON_SCALER_GAMMA_SEL_G14 0x00000060L +# define RADEON_SCALER_COMCORE_SHIFT_UP_ONE 0x00000080L +# define RADEON_SCALER_SURFAC_FORMAT 0x00000f00L +# define RADEON_SCALER_SOURCE_15BPP 0x00000300L +# define RADEON_SCALER_SOURCE_16BPP 0x00000400L +# define RADEON_SCALER_SOURCE_32BPP 0x00000600L +# define RADEON_SCALER_SOURCE_YUV9 0x00000900L +# define RADEON_SCALER_SOURCE_YUV12 0x00000A00L +# define RADEON_SCALER_SOURCE_VYUY422 0x00000B00L +# define RADEON_SCALER_SOURCE_YVYU422 0x00000C00L +# define RADEON_SCALER_ADAPTIVE_DEINT 0x00001000L +# define RADEON_SCALER_TEMPORAL_DEINT 0x00002000L +# define RADEON_SCALER_CRTC_SEL 0x00004000L +# define RADEON_SCALER_SMART_SWITCH 0x00008000L +# define RADEON_SCALER_BURST_PER_PLANE 0x007F0000L +# define RADEON_SCALER_DOUBLE_BUFFER 0x01000000L +# define RADEON_SCALER_DIS_LIMIT 0x08000000L +# define RADEON_SCALER_LIN_TRANS_BYPASS 0x10000000L +# define RADEON_SCALER_INT_EMU 0x20000000L +# define RADEON_SCALER_ENABLE 0x40000000L +# define RADEON_SCALER_SOFT_RESET 0x80000000L +#define RADEON_OV0_STEP_BY 0x0484 +#define RADEON_OV0_TEST 0x04F8 +#define RADEON_OV0_V_INC 0x0424 +#define RADEON_OV0_VID_BUF_PITCH0_VALUE 0x0460 +#define RADEON_OV0_VID_BUF_PITCH1_VALUE 0x0464 +#define RADEON_OV0_VID_BUF0_BASE_ADRS 0x0440 +# define RADEON_VIF_BUF0_PITCH_SEL 0x00000001L +# define RADEON_VIF_BUF0_TILE_ADRS 0x00000002L +# define RADEON_VIF_BUF0_BASE_ADRS_MASK 0x03fffff0L +# define RADEON_VIF_BUF0_1ST_LINE_LSBS_MASK 0x48000000L +#define RADEON_OV0_VID_BUF1_BASE_ADRS 0x0444 +# define RADEON_VIF_BUF1_PITCH_SEL 0x00000001L +# define RADEON_VIF_BUF1_TILE_ADRS 0x00000002L +# define RADEON_VIF_BUF1_BASE_ADRS_MASK 0x03fffff0L +# define RADEON_VIF_BUF1_1ST_LINE_LSBS_MASK 0x48000000L +#define RADEON_OV0_VID_BUF2_BASE_ADRS 0x0448 +# define RADEON_VIF_BUF2_PITCH_SEL 0x00000001L +# define RADEON_VIF_BUF2_TILE_ADRS 0x00000002L +# define RADEON_VIF_BUF2_BASE_ADRS_MASK 0x03fffff0L +# define RADEON_VIF_BUF2_1ST_LINE_LSBS_MASK 0x48000000L +#define RADEON_OV0_VID_BUF3_BASE_ADRS 0x044C +#define RADEON_OV0_VID_BUF4_BASE_ADRS 0x0450 +#define RADEON_OV0_VID_BUF5_BASE_ADRS 0x0454 +#define RADEON_OV0_VIDEO_KEY_CLR_HIGH 0x04E8 +#define RADEON_OV0_VIDEO_KEY_CLR_LOW 0x04E4 +#define RADEON_OV0_Y_X_START 0x0400 +#define RADEON_OV0_Y_X_END 0x0404 +#define RADEON_OV1_Y_X_START 0x0600 +#define RADEON_OV1_Y_X_END 0x0604 +#define RADEON_OVR_CLR 0x0230 +#define RADEON_OVR_WID_LEFT_RIGHT 0x0234 +#define RADEON_OVR_WID_TOP_BOTTOM 0x0238 +#define RADEON_OVR2_CLR 0x0330 +#define RADEON_OVR2_WID_LEFT_RIGHT 0x0334 +#define RADEON_OVR2_WID_TOP_BOTTOM 0x0338 + +/* first capture unit */ + +#define RADEON_CAP0_BUF0_OFFSET 0x0920 +#define RADEON_CAP0_BUF1_OFFSET 0x0924 +#define RADEON_CAP0_BUF0_EVEN_OFFSET 0x0928 +#define RADEON_CAP0_BUF1_EVEN_OFFSET 0x092C + +#define RADEON_CAP0_BUF_PITCH 0x0930 +#define RADEON_CAP0_V_WINDOW 0x0934 +#define RADEON_CAP0_H_WINDOW 0x0938 +#define RADEON_CAP0_VBI0_OFFSET 0x093C +#define RADEON_CAP0_VBI1_OFFSET 0x0940 +#define RADEON_CAP0_VBI_V_WINDOW 0x0944 +#define RADEON_CAP0_VBI_H_WINDOW 0x0948 +#define RADEON_CAP0_PORT_MODE_CNTL 0x094C +#define RADEON_CAP0_TRIG_CNTL 0x0950 +#define RADEON_CAP0_DEBUG 0x0954 +#define RADEON_CAP0_CONFIG 0x0958 +# define RADEON_CAP0_CONFIG_CONTINUOS 0x00000001 +# define RADEON_CAP0_CONFIG_START_FIELD_EVEN 0x00000002 +# define RADEON_CAP0_CONFIG_START_BUF_GET 0x00000004 +# define RADEON_CAP0_CONFIG_START_BUF_SET 0x00000008 +# define RADEON_CAP0_CONFIG_BUF_TYPE_ALT 0x00000010 +# define RADEON_CAP0_CONFIG_BUF_TYPE_FRAME 0x00000020 +# define RADEON_CAP0_CONFIG_ONESHOT_MODE_FRAME 0x00000040 +# define RADEON_CAP0_CONFIG_BUF_MODE_DOUBLE 0x00000080 +# define RADEON_CAP0_CONFIG_BUF_MODE_TRIPLE 0x00000100 +# define RADEON_CAP0_CONFIG_MIRROR_EN 0x00000200 +# define RADEON_CAP0_CONFIG_ONESHOT_MIRROR_EN 0x00000400 +# define RADEON_CAP0_CONFIG_VIDEO_SIGNED_UV 0x00000800 +# define RADEON_CAP0_CONFIG_ANC_DECODE_EN 0x00001000 +# define RADEON_CAP0_CONFIG_VBI_EN 0x00002000 +# define RADEON_CAP0_CONFIG_SOFT_PULL_DOWN_EN 0x00004000 +# define RADEON_CAP0_CONFIG_VIP_EXTEND_FLAG_EN 0x00008000 +# define RADEON_CAP0_CONFIG_FAKE_FIELD_EN 0x00010000 +# define RADEON_CAP0_CONFIG_ODD_ONE_MORE_LINE 0x00020000 +# define RADEON_CAP0_CONFIG_EVEN_ONE_MORE_LINE 0x00040000 +# define RADEON_CAP0_CONFIG_HORZ_DIVIDE_2 0x00080000 +# define RADEON_CAP0_CONFIG_HORZ_DIVIDE_4 0x00100000 +# define RADEON_CAP0_CONFIG_VERT_DIVIDE_2 0x00200000 +# define RADEON_CAP0_CONFIG_VERT_DIVIDE_4 0x00400000 +# define RADEON_CAP0_CONFIG_FORMAT_BROOKTREE 0x00000000 +# define RADEON_CAP0_CONFIG_FORMAT_CCIR656 0x00800000 +# define RADEON_CAP0_CONFIG_FORMAT_ZV 0x01000000 +# define RADEON_CAP0_CONFIG_FORMAT_VIP 0x01800000 +# define RADEON_CAP0_CONFIG_FORMAT_TRANSPORT 0x02000000 +# define RADEON_CAP0_CONFIG_HORZ_DECIMATOR 0x04000000 +# define RADEON_CAP0_CONFIG_VIDEO_IN_YVYU422 0x00000000 +# define RADEON_CAP0_CONFIG_VIDEO_IN_VYUY422 0x20000000 +# define RADEON_CAP0_CONFIG_VBI_DIVIDE_2 0x40000000 +# define RADEON_CAP0_CONFIG_VBI_DIVIDE_4 0x80000000 +#define RADEON_CAP0_ANC_ODD_OFFSET 0x095C +#define RADEON_CAP0_ANC_EVEN_OFFSET 0x0960 +#define RADEON_CAP0_ANC_H_WINDOW 0x0964 +#define RADEON_CAP0_VIDEO_SYNC_TEST 0x0968 +#define RADEON_CAP0_ONESHOT_BUF_OFFSET 0x096C +#define RADEON_CAP0_BUF_STATUS 0x0970 +/* #define RADEON_CAP0_DWNSC_XRATIO 0x0978 */ +/* #define RADEON_CAP0_XSHARPNESS 0x097C */ +#define RADEON_CAP0_VBI2_OFFSET 0x0980 +#define RADEON_CAP0_VBI3_OFFSET 0x0984 +#define RADEON_CAP0_ANC2_OFFSET 0x0988 +#define RADEON_CAP0_ANC3_OFFSET 0x098C +#define RADEON_VID_BUFFER_CONTROL 0x0900 + +/* second capture unit */ + +#define RADEON_CAP1_BUF0_OFFSET 0x0990 +#define RADEON_CAP1_BUF1_OFFSET 0x0994 +#define RADEON_CAP1_BUF0_EVEN_OFFSET 0x0998 +#define RADEON_CAP1_BUF1_EVEN_OFFSET 0x099C + +#define RADEON_CAP1_BUF_PITCH 0x09A0 +#define RADEON_CAP1_V_WINDOW 0x09A4 +#define RADEON_CAP1_H_WINDOW 0x09A8 +#define RADEON_CAP1_VBI_ODD_OFFSET 0x09AC +#define RADEON_CAP1_VBI_EVEN_OFFSET 0x09B0 +#define RADEON_CAP1_VBI_V_WINDOW 0x09B4 +#define RADEON_CAP1_VBI_H_WINDOW 0x09B8 +#define RADEON_CAP1_PORT_MODE_CNTL 0x09BC +#define RADEON_CAP1_TRIG_CNTL 0x09C0 +#define RADEON_CAP1_DEBUG 0x09C4 +#define RADEON_CAP1_CONFIG 0x09C8 +#define RADEON_CAP1_ANC_ODD_OFFSET 0x09CC +#define RADEON_CAP1_ANC_EVEN_OFFSET 0x09D0 +#define RADEON_CAP1_ANC_H_WINDOW 0x09D4 +#define RADEON_CAP1_VIDEO_SYNC_TEST 0x09D8 +#define RADEON_CAP1_ONESHOT_BUF_OFFSET 0x09DC +#define RADEON_CAP1_BUF_STATUS 0x09E0 +#define RADEON_CAP1_DWNSC_XRATIO 0x09E8 +#define RADEON_CAP1_XSHARPNESS 0x09EC + +/* misc multimedia registers */ + +#define RADEON_IDCT_RUNS 0x1F80 +#define RADEON_IDCT_LEVELS 0x1F84 +#define RADEON_IDCT_CONTROL 0x1FBC +#define RADEON_IDCT_AUTH_CONTROL 0x1F88 +#define RADEON_IDCT_AUTH 0x1F8C + +#define RADEON_P2PLL_CNTL 0x002a /* P2PLL */ +# define RADEON_P2PLL_RESET (1 << 0) +# define RADEON_P2PLL_SLEEP (1 << 1) +# define RADEON_P2PLL_PVG_MASK (7 << 11) +# define RADEON_P2PLL_PVG_SHIFT 11 +# define RADEON_P2PLL_ATOMIC_UPDATE_EN (1 << 16) +# define RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN (1 << 17) +# define RADEON_P2PLL_ATOMIC_UPDATE_VSYNC (1 << 18) +#define RADEON_P2PLL_DIV_0 0x002c +# define RADEON_P2PLL_FB0_DIV_MASK 0x07ff +# define RADEON_P2PLL_POST0_DIV_MASK 0x00070000 +#define RADEON_P2PLL_REF_DIV 0x002B /* PLL */ +# define RADEON_P2PLL_REF_DIV_MASK 0x03ff +# define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ +# define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ +# define R300_PPLL_REF_DIV_ACC_MASK (0x3ff << 18) +# define R300_PPLL_REF_DIV_ACC_SHIFT 18 +#define RADEON_PALETTE_DATA 0x00b4 +#define RADEON_PALETTE_30_DATA 0x00b8 +#define RADEON_PALETTE_INDEX 0x00b0 +#define RADEON_PCI_GART_PAGE 0x017c +#define RADEON_PIXCLKS_CNTL 0x002d +# define RADEON_PIX2CLK_SRC_SEL_MASK 0x03 +# define RADEON_PIX2CLK_SRC_SEL_CPUCLK 0x00 +# define RADEON_PIX2CLK_SRC_SEL_PSCANCLK 0x01 +# define RADEON_PIX2CLK_SRC_SEL_BYTECLK 0x02 +# define RADEON_PIX2CLK_SRC_SEL_P2PLLCLK 0x03 +# define RADEON_PIX2CLK_ALWAYS_ONb (1<<6) +# define RADEON_PIX2CLK_DAC_ALWAYS_ONb (1<<7) +# define RADEON_PIXCLK_TV_SRC_SEL (1 << 8) +# define RADEON_DISP_TVOUT_PIXCLK_TV_ALWAYS_ONb (1 << 9) +# define R300_DVOCLK_ALWAYS_ONb (1 << 10) +# define RADEON_PIXCLK_BLEND_ALWAYS_ONb (1 << 11) +# define RADEON_PIXCLK_GV_ALWAYS_ONb (1 << 12) +# define RADEON_PIXCLK_DIG_TMDS_ALWAYS_ONb (1 << 13) +# define R300_PIXCLK_DVO_ALWAYS_ONb (1 << 13) +# define RADEON_PIXCLK_LVDS_ALWAYS_ONb (1 << 14) +# define RADEON_PIXCLK_TMDS_ALWAYS_ONb (1 << 15) +# define R300_PIXCLK_TRANS_ALWAYS_ONb (1 << 16) +# define R300_PIXCLK_TVO_ALWAYS_ONb (1 << 17) +# define R300_P2G2CLK_ALWAYS_ONb (1 << 18) +# define R300_P2G2CLK_DAC_ALWAYS_ONb (1 << 19) +# define R300_DISP_DAC_PIXCLK_DAC2_BLANK_OFF (1 << 23) +#define RADEON_PLANE_3D_MASK_C 0x1d44 +#define RADEON_PLL_TEST_CNTL 0x0013 /* PLL */ +# define RADEON_PLL_MASK_READ_B (1 << 9) +#define RADEON_PMI_CAP_ID 0x0f5c /* PCI */ +#define RADEON_PMI_DATA 0x0f63 /* PCI */ +#define RADEON_PMI_NXT_CAP_PTR 0x0f5d /* PCI */ +#define RADEON_PMI_PMC_REG 0x0f5e /* PCI */ +#define RADEON_PMI_PMCSR_REG 0x0f60 /* PCI */ +#define RADEON_PMI_REGISTER 0x0f5c /* PCI */ +#define RADEON_PPLL_CNTL 0x0002 /* PLL */ +# define RADEON_PPLL_RESET (1 << 0) +# define RADEON_PPLL_SLEEP (1 << 1) +# define RADEON_PPLL_PVG_MASK (7 << 11) +# define RADEON_PPLL_PVG_SHIFT 11 +# define RADEON_PPLL_ATOMIC_UPDATE_EN (1 << 16) +# define RADEON_PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17) +# define RADEON_PPLL_ATOMIC_UPDATE_VSYNC (1 << 18) +#define RADEON_PPLL_DIV_0 0x0004 /* PLL */ +#define RADEON_PPLL_DIV_1 0x0005 /* PLL */ +#define RADEON_PPLL_DIV_2 0x0006 /* PLL */ +#define RADEON_PPLL_DIV_3 0x0007 /* PLL */ +# define RADEON_PPLL_FB3_DIV_MASK 0x07ff +# define RADEON_PPLL_POST3_DIV_MASK 0x00070000 +#define RADEON_PPLL_REF_DIV 0x0003 /* PLL */ +# define RADEON_PPLL_REF_DIV_MASK 0x03ff +# define RADEON_PPLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ +# define RADEON_PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ +#define RADEON_PWR_MNGMT_CNTL_STATUS 0x0f60 /* PCI */ + +#define RADEON_RBBM_GUICNTL 0x172c +# define RADEON_HOST_DATA_SWAP_NONE (0 << 0) +# define RADEON_HOST_DATA_SWAP_16BIT (1 << 0) +# define RADEON_HOST_DATA_SWAP_32BIT (2 << 0) +# define RADEON_HOST_DATA_SWAP_HDW (3 << 0) +#define RADEON_RBBM_SOFT_RESET 0x00f0 +# define RADEON_SOFT_RESET_CP (1 << 0) +# define RADEON_SOFT_RESET_HI (1 << 1) +# define RADEON_SOFT_RESET_SE (1 << 2) +# define RADEON_SOFT_RESET_RE (1 << 3) +# define RADEON_SOFT_RESET_PP (1 << 4) +# define RADEON_SOFT_RESET_E2 (1 << 5) +# define RADEON_SOFT_RESET_RB (1 << 6) +# define RADEON_SOFT_RESET_HDP (1 << 7) +#define RADEON_RBBM_STATUS 0x0e40 +# define RADEON_RBBM_FIFOCNT_MASK 0x007f +# define RADEON_RBBM_ACTIVE (1 << 31) +#define RADEON_RB2D_DSTCACHE_CTLSTAT 0x342c +# define RADEON_RB2D_DC_FLUSH (3 << 0) +# define RADEON_RB2D_DC_FREE (3 << 2) +# define RADEON_RB2D_DC_FLUSH_ALL 0xf +# define RADEON_RB2D_DC_BUSY (1 << 31) +#define RADEON_RB2D_DSTCACHE_MODE 0x3428 +#define RADEON_DSTCACHE_CTLSTAT 0x1714 + +#define RADEON_RB3D_ZCACHE_MODE 0x3250 +#define RADEON_RB3D_ZCACHE_CTLSTAT 0x3254 +# define RADEON_RB3D_ZC_FLUSH_ALL 0x5 +#define RADEON_RB3D_DSTCACHE_MODE 0x3258 +# define RADEON_RB3D_DC_CACHE_ENABLE (0) +# define RADEON_RB3D_DC_2D_CACHE_DISABLE (1) +# define RADEON_RB3D_DC_3D_CACHE_DISABLE (2) +# define RADEON_RB3D_DC_CACHE_DISABLE (3) +# define RADEON_RB3D_DC_2D_CACHE_LINESIZE_128 (1 << 2) +# define RADEON_RB3D_DC_3D_CACHE_LINESIZE_128 (2 << 2) +# define RADEON_RB3D_DC_2D_CACHE_AUTOFLUSH (1 << 8) +# define RADEON_RB3D_DC_3D_CACHE_AUTOFLUSH (2 << 8) +# define R200_RB3D_DC_2D_CACHE_AUTOFREE (1 << 10) +# define R200_RB3D_DC_3D_CACHE_AUTOFREE (2 << 10) +# define RADEON_RB3D_DC_FORCE_RMW (1 << 16) +# define RADEON_RB3D_DC_DISABLE_RI_FILL (1 << 24) +# define RADEON_RB3D_DC_DISABLE_RI_READ (1 << 25) + +#define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325C +# define RADEON_RB3D_DC_FLUSH (3 << 0) +# define RADEON_RB3D_DC_FREE (3 << 2) +# define RADEON_RB3D_DC_FLUSH_ALL 0xf +# define RADEON_RB3D_DC_BUSY (1 << 31) + +#define RADEON_REG_BASE 0x0f18 /* PCI */ +#define RADEON_REGPROG_INF 0x0f09 /* PCI */ +#define RADEON_REVISION_ID 0x0f08 /* PCI */ + +#define RADEON_SC_BOTTOM 0x164c +#define RADEON_SC_BOTTOM_RIGHT 0x16f0 +#define RADEON_SC_BOTTOM_RIGHT_C 0x1c8c +#define RADEON_SC_LEFT 0x1640 +#define RADEON_SC_RIGHT 0x1644 +#define RADEON_SC_TOP 0x1648 +#define RADEON_SC_TOP_LEFT 0x16ec +#define RADEON_SC_TOP_LEFT_C 0x1c88 +# define RADEON_SC_SIGN_MASK_LO 0x8000 +# define RADEON_SC_SIGN_MASK_HI 0x80000000 +#define RADEON_M_SPLL_REF_FB_DIV 0x000a /* PLL */ +# define RADEON_M_SPLL_REF_DIV_SHIFT 0 +# define RADEON_M_SPLL_REF_DIV_MASK 0xff +# define RADEON_MPLL_FB_DIV_SHIFT 8 +# define RADEON_MPLL_FB_DIV_MASK 0xff +# define RADEON_SPLL_FB_DIV_SHIFT 16 +# define RADEON_SPLL_FB_DIV_MASK 0xff +#define RADEON_SPLL_CNTL 0x000c /* PLL */ +# define RADEON_SPLL_SLEEP (1 << 0) +# define RADEON_SPLL_RESET (1 << 1) +# define RADEON_SPLL_PCP_MASK 0x7 +# define RADEON_SPLL_PCP_SHIFT 8 +# define RADEON_SPLL_PVG_MASK 0x7 +# define RADEON_SPLL_PVG_SHIFT 11 +# define RADEON_SPLL_PDC_MASK 0x3 +# define RADEON_SPLL_PDC_SHIFT 14 +#define RADEON_SCLK_CNTL 0x000d /* PLL */ +# define RADEON_SCLK_SRC_SEL_MASK 0x0007 +# define RADEON_DYN_STOP_LAT_MASK 0x00007ff8 +# define RADEON_CP_MAX_DYN_STOP_LAT 0x0008 +# define RADEON_SCLK_FORCEON_MASK 0xffff8000 +# define RADEON_SCLK_FORCE_DISP2 (1<<15) +# define RADEON_SCLK_FORCE_CP (1<<16) +# define RADEON_SCLK_FORCE_HDP (1<<17) +# define RADEON_SCLK_FORCE_DISP1 (1<<18) +# define RADEON_SCLK_FORCE_TOP (1<<19) +# define RADEON_SCLK_FORCE_E2 (1<<20) +# define RADEON_SCLK_FORCE_SE (1<<21) +# define RADEON_SCLK_FORCE_IDCT (1<<22) +# define RADEON_SCLK_FORCE_VIP (1<<23) +# define RADEON_SCLK_FORCE_RE (1<<24) +# define RADEON_SCLK_FORCE_PB (1<<25) +# define RADEON_SCLK_FORCE_TAM (1<<26) +# define RADEON_SCLK_FORCE_TDM (1<<27) +# define RADEON_SCLK_FORCE_RB (1<<28) +# define RADEON_SCLK_FORCE_TV_SCLK (1<<29) +# define RADEON_SCLK_FORCE_SUBPIC (1<<30) +# define RADEON_SCLK_FORCE_OV0 (1<<31) +# define R300_SCLK_FORCE_VAP (1<<21) +# define R300_SCLK_FORCE_SR (1<<25) +# define R300_SCLK_FORCE_PX (1<<26) +# define R300_SCLK_FORCE_TX (1<<27) +# define R300_SCLK_FORCE_US (1<<28) +# define R300_SCLK_FORCE_SU (1<<30) +#define R300_SCLK_CNTL2 0x1e /* PLL */ +# define R300_SCLK_TCL_MAX_DYN_STOP_LAT (1<<10) +# define R300_SCLK_GA_MAX_DYN_STOP_LAT (1<<11) +# define R300_SCLK_CBA_MAX_DYN_STOP_LAT (1<<12) +# define R300_SCLK_FORCE_TCL (1<<13) +# define R300_SCLK_FORCE_CBA (1<<14) +# define R300_SCLK_FORCE_GA (1<<15) +#define RADEON_SCLK_MORE_CNTL 0x0035 /* PLL */ +# define RADEON_SCLK_MORE_MAX_DYN_STOP_LAT 0x0007 +# define RADEON_SCLK_MORE_FORCEON 0x0700 +#define RADEON_SDRAM_MODE_REG 0x0158 +#define RADEON_SEQ8_DATA 0x03c5 /* VGA */ +#define RADEON_SEQ8_IDX 0x03c4 /* VGA */ +#define RADEON_SNAPSHOT_F_COUNT 0x0244 +#define RADEON_SNAPSHOT_VH_COUNTS 0x0240 +#define RADEON_SNAPSHOT_VIF_COUNT 0x024c +#define RADEON_SRC_OFFSET 0x15ac +#define RADEON_SRC_PITCH 0x15b0 +#define RADEON_SRC_PITCH_OFFSET 0x1428 +#define RADEON_SRC_SC_BOTTOM 0x165c +#define RADEON_SRC_SC_BOTTOM_RIGHT 0x16f4 +#define RADEON_SRC_SC_RIGHT 0x1654 +#define RADEON_SRC_X 0x1414 +#define RADEON_SRC_X_Y 0x1590 +#define RADEON_SRC_Y 0x1418 +#define RADEON_SRC_Y_X 0x1434 +#define RADEON_STATUS 0x0f06 /* PCI */ +#define RADEON_SUBPIC_CNTL 0x0540 /* ? */ +#define RADEON_SUB_CLASS 0x0f0a /* PCI */ +#define RADEON_SURFACE_CNTL 0x0b00 +# define RADEON_SURF_TRANSLATION_DIS (1 << 8) +# define RADEON_NONSURF_AP0_SWP_16BPP (1 << 20) +# define RADEON_NONSURF_AP0_SWP_32BPP (1 << 21) +# define RADEON_NONSURF_AP1_SWP_16BPP (1 << 22) +# define RADEON_NONSURF_AP1_SWP_32BPP (1 << 23) +#define RADEON_SURFACE0_INFO 0x0b0c +# define RADEON_SURF_TILE_COLOR_MACRO (0 << 16) +# define RADEON_SURF_TILE_COLOR_BOTH (1 << 16) +# define RADEON_SURF_TILE_DEPTH_32BPP (2 << 16) +# define RADEON_SURF_TILE_DEPTH_16BPP (3 << 16) +# define R200_SURF_TILE_NONE (0 << 16) +# define R200_SURF_TILE_COLOR_MACRO (1 << 16) +# define R200_SURF_TILE_COLOR_MICRO (2 << 16) +# define R200_SURF_TILE_COLOR_BOTH (3 << 16) +# define R200_SURF_TILE_DEPTH_32BPP (4 << 16) +# define R200_SURF_TILE_DEPTH_16BPP (5 << 16) +# define R300_SURF_TILE_NONE (0 << 16) +# define R300_SURF_TILE_COLOR_MACRO (1 << 16) +# define R300_SURF_TILE_DEPTH_32BPP (2 << 16) +# define RADEON_SURF_AP0_SWP_16BPP (1 << 20) +# define RADEON_SURF_AP0_SWP_32BPP (1 << 21) +# define RADEON_SURF_AP1_SWP_16BPP (1 << 22) +# define RADEON_SURF_AP1_SWP_32BPP (1 << 23) +#define RADEON_SURFACE0_LOWER_BOUND 0x0b04 +#define RADEON_SURFACE0_UPPER_BOUND 0x0b08 +#define RADEON_SURFACE1_INFO 0x0b1c +#define RADEON_SURFACE1_LOWER_BOUND 0x0b14 +#define RADEON_SURFACE1_UPPER_BOUND 0x0b18 +#define RADEON_SURFACE2_INFO 0x0b2c +#define RADEON_SURFACE2_LOWER_BOUND 0x0b24 +#define RADEON_SURFACE2_UPPER_BOUND 0x0b28 +#define RADEON_SURFACE3_INFO 0x0b3c +#define RADEON_SURFACE3_LOWER_BOUND 0x0b34 +#define RADEON_SURFACE3_UPPER_BOUND 0x0b38 +#define RADEON_SURFACE4_INFO 0x0b4c +#define RADEON_SURFACE4_LOWER_BOUND 0x0b44 +#define RADEON_SURFACE4_UPPER_BOUND 0x0b48 +#define RADEON_SURFACE5_INFO 0x0b5c +#define RADEON_SURFACE5_LOWER_BOUND 0x0b54 +#define RADEON_SURFACE5_UPPER_BOUND 0x0b58 +#define RADEON_SURFACE6_INFO 0x0b6c +#define RADEON_SURFACE6_LOWER_BOUND 0x0b64 +#define RADEON_SURFACE6_UPPER_BOUND 0x0b68 +#define RADEON_SURFACE7_INFO 0x0b7c +#define RADEON_SURFACE7_LOWER_BOUND 0x0b74 +#define RADEON_SURFACE7_UPPER_BOUND 0x0b78 +#define RADEON_SW_SEMAPHORE 0x013c + +#define RADEON_TEST_DEBUG_CNTL 0x0120 +#define RADEON_TEST_DEBUG_CNTL__TEST_DEBUG_OUT_EN 0x00000001 + +#define RADEON_TEST_DEBUG_MUX 0x0124 +#define RADEON_TEST_DEBUG_OUT 0x012c +#define RADEON_TMDS_PLL_CNTL 0x02a8 +#define RADEON_TMDS_TRANSMITTER_CNTL 0x02a4 +# define RADEON_TMDS_TRANSMITTER_PLLEN 1 +# define RADEON_TMDS_TRANSMITTER_PLLRST 2 +#define RADEON_TRAIL_BRES_DEC 0x1614 +#define RADEON_TRAIL_BRES_ERR 0x160c +#define RADEON_TRAIL_BRES_INC 0x1610 +#define RADEON_TRAIL_X 0x1618 +#define RADEON_TRAIL_X_SUB 0x1620 + +#define RADEON_VCLK_ECP_CNTL 0x0008 /* PLL */ +# define RADEON_VCLK_SRC_SEL_MASK 0x03 +# define RADEON_VCLK_SRC_SEL_CPUCLK 0x00 +# define RADEON_VCLK_SRC_SEL_PSCANCLK 0x01 +# define RADEON_VCLK_SRC_SEL_BYTECLK 0x02 +# define RADEON_VCLK_SRC_SEL_PPLLCLK 0x03 +# define RADEON_PIXCLK_ALWAYS_ONb (1<<6) +# define RADEON_PIXCLK_DAC_ALWAYS_ONb (1<<7) +# define R300_DISP_DAC_PIXCLK_DAC_BLANK_OFF (1<<23) + +#define RADEON_VENDOR_ID 0x0f00 /* PCI */ +#define RADEON_VGA_DDA_CONFIG 0x02e8 +#define RADEON_VGA_DDA_ON_OFF 0x02ec +#define RADEON_VID_BUFFER_CONTROL 0x0900 +#define RADEON_VIDEOMUX_CNTL 0x0190 + +/* VIP bus */ +#define RADEON_VIPH_CH0_DATA 0x0c00 +#define RADEON_VIPH_CH1_DATA 0x0c04 +#define RADEON_VIPH_CH2_DATA 0x0c08 +#define RADEON_VIPH_CH3_DATA 0x0c0c +#define RADEON_VIPH_CH0_ADDR 0x0c10 +#define RADEON_VIPH_CH1_ADDR 0x0c14 +#define RADEON_VIPH_CH2_ADDR 0x0c18 +#define RADEON_VIPH_CH3_ADDR 0x0c1c +#define RADEON_VIPH_CH0_SBCNT 0x0c20 +#define RADEON_VIPH_CH1_SBCNT 0x0c24 +#define RADEON_VIPH_CH2_SBCNT 0x0c28 +#define RADEON_VIPH_CH3_SBCNT 0x0c2c +#define RADEON_VIPH_CH0_ABCNT 0x0c30 +#define RADEON_VIPH_CH1_ABCNT 0x0c34 +#define RADEON_VIPH_CH2_ABCNT 0x0c38 +#define RADEON_VIPH_CH3_ABCNT 0x0c3c +#define RADEON_VIPH_CONTROL 0x0c40 +# define RADEON_VIP_BUSY 0 +# define RADEON_VIP_IDLE 1 +# define RADEON_VIP_RESET 2 +# define RADEON_VIPH_EN (1 << 21) +#define RADEON_VIPH_DV_LAT 0x0c44 +#define RADEON_VIPH_BM_CHUNK 0x0c48 +#define RADEON_VIPH_DV_INT 0x0c4c +#define RADEON_VIPH_TIMEOUT_STAT 0x0c50 +#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REG_STAT 0x00000010 +#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REG_AK 0x00000010 +#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REGR_DIS 0x01000000 + +#define RADEON_VIPH_REG_DATA 0x0084 +#define RADEON_VIPH_REG_ADDR 0x0080 + + +#define RADEON_WAIT_UNTIL 0x1720 +# define RADEON_WAIT_CRTC_PFLIP (1 << 0) +# define RADEON_WAIT_RE_CRTC_VLINE (1 << 1) +# define RADEON_WAIT_FE_CRTC_VLINE (1 << 2) +# define RADEON_WAIT_CRTC_VLINE (1 << 3) +# define RADEON_WAIT_DMA_VID_IDLE (1 << 8) +# define RADEON_WAIT_DMA_GUI_IDLE (1 << 9) +# define RADEON_WAIT_CMDFIFO (1 << 10) /* wait for CMDFIFO_ENTRIES */ +# define RADEON_WAIT_OV0_FLIP (1 << 11) +# define RADEON_WAIT_AGP_FLUSH (1 << 13) +# define RADEON_WAIT_2D_IDLE (1 << 14) +# define RADEON_WAIT_3D_IDLE (1 << 15) +# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) +# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) +# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) +# define RADEON_CMDFIFO_ENTRIES_SHIFT 10 +# define RADEON_CMDFIFO_ENTRIES_MASK 0x7f +# define RADEON_WAIT_VAP_IDLE (1 << 28) +# define RADEON_WAIT_BOTH_CRTC_PFLIP (1 << 30) +# define RADEON_ENG_DISPLAY_SELECT_CRTC0 (0 << 31) +# define RADEON_ENG_DISPLAY_SELECT_CRTC1 (1 << 31) + +#define RADEON_X_MPLL_REF_FB_DIV 0x000a /* PLL */ +#define RADEON_XCLK_CNTL 0x000d /* PLL */ +#define RADEON_XDLL_CNTL 0x000c /* PLL */ +#define RADEON_XPLL_CNTL 0x000b /* PLL */ + + + + /* Registers for 3D/TCL */ +#define RADEON_PP_BORDER_COLOR_0 0x1d40 +#define RADEON_PP_BORDER_COLOR_1 0x1d44 +#define RADEON_PP_BORDER_COLOR_2 0x1d48 +#define RADEON_PP_CNTL 0x1c38 +# define RADEON_STIPPLE_ENABLE (1 << 0) +# define RADEON_SCISSOR_ENABLE (1 << 1) +# define RADEON_PATTERN_ENABLE (1 << 2) +# define RADEON_SHADOW_ENABLE (1 << 3) +# define RADEON_TEX_ENABLE_MASK (0xf << 4) +# define RADEON_TEX_0_ENABLE (1 << 4) +# define RADEON_TEX_1_ENABLE (1 << 5) +# define RADEON_TEX_2_ENABLE (1 << 6) +# define RADEON_TEX_3_ENABLE (1 << 7) +# define RADEON_TEX_BLEND_ENABLE_MASK (0xf << 12) +# define RADEON_TEX_BLEND_0_ENABLE (1 << 12) +# define RADEON_TEX_BLEND_1_ENABLE (1 << 13) +# define RADEON_TEX_BLEND_2_ENABLE (1 << 14) +# define RADEON_TEX_BLEND_3_ENABLE (1 << 15) +# define RADEON_PLANAR_YUV_ENABLE (1 << 20) +# define RADEON_SPECULAR_ENABLE (1 << 21) +# define RADEON_FOG_ENABLE (1 << 22) +# define RADEON_ALPHA_TEST_ENABLE (1 << 23) +# define RADEON_ANTI_ALIAS_NONE (0 << 24) +# define RADEON_ANTI_ALIAS_LINE (1 << 24) +# define RADEON_ANTI_ALIAS_POLY (2 << 24) +# define RADEON_ANTI_ALIAS_LINE_POLY (3 << 24) +# define RADEON_BUMP_MAP_ENABLE (1 << 26) +# define RADEON_BUMPED_MAP_T0 (0 << 27) +# define RADEON_BUMPED_MAP_T1 (1 << 27) +# define RADEON_BUMPED_MAP_T2 (2 << 27) +# define RADEON_TEX_3D_ENABLE_0 (1 << 29) +# define RADEON_TEX_3D_ENABLE_1 (1 << 30) +# define RADEON_MC_ENABLE (1 << 31) +#define RADEON_PP_FOG_COLOR 0x1c18 +# define RADEON_FOG_COLOR_MASK 0x00ffffff +# define RADEON_FOG_VERTEX (0 << 24) +# define RADEON_FOG_TABLE (1 << 24) +# define RADEON_FOG_USE_DEPTH (0 << 25) +# define RADEON_FOG_USE_DIFFUSE_ALPHA (2 << 25) +# define RADEON_FOG_USE_SPEC_ALPHA (3 << 25) +#define RADEON_PP_LUM_MATRIX 0x1d00 +#define RADEON_PP_MISC 0x1c14 +# define RADEON_REF_ALPHA_MASK 0x000000ff +# define RADEON_ALPHA_TEST_FAIL (0 << 8) +# define RADEON_ALPHA_TEST_LESS (1 << 8) +# define RADEON_ALPHA_TEST_LEQUAL (2 << 8) +# define RADEON_ALPHA_TEST_EQUAL (3 << 8) +# define RADEON_ALPHA_TEST_GEQUAL (4 << 8) +# define RADEON_ALPHA_TEST_GREATER (5 << 8) +# define RADEON_ALPHA_TEST_NEQUAL (6 << 8) +# define RADEON_ALPHA_TEST_PASS (7 << 8) +# define RADEON_ALPHA_TEST_OP_MASK (7 << 8) +# define RADEON_CHROMA_FUNC_FAIL (0 << 16) +# define RADEON_CHROMA_FUNC_PASS (1 << 16) +# define RADEON_CHROMA_FUNC_NEQUAL (2 << 16) +# define RADEON_CHROMA_FUNC_EQUAL (3 << 16) +# define RADEON_CHROMA_KEY_NEAREST (0 << 18) +# define RADEON_CHROMA_KEY_ZERO (1 << 18) +# define RADEON_SHADOW_ID_AUTO_INC (1 << 20) +# define RADEON_SHADOW_FUNC_EQUAL (0 << 21) +# define RADEON_SHADOW_FUNC_NEQUAL (1 << 21) +# define RADEON_SHADOW_PASS_1 (0 << 22) +# define RADEON_SHADOW_PASS_2 (1 << 22) +# define RADEON_RIGHT_HAND_CUBE_D3D (0 << 24) +# define RADEON_RIGHT_HAND_CUBE_OGL (1 << 24) +#define RADEON_PP_ROT_MATRIX_0 0x1d58 +#define RADEON_PP_ROT_MATRIX_1 0x1d5c +#define RADEON_PP_TXFILTER_0 0x1c54 +#define RADEON_PP_TXFILTER_1 0x1c6c +#define RADEON_PP_TXFILTER_2 0x1c84 +# define RADEON_MAG_FILTER_NEAREST (0 << 0) +# define RADEON_MAG_FILTER_LINEAR (1 << 0) +# define RADEON_MAG_FILTER_MASK (1 << 0) +# define RADEON_MIN_FILTER_NEAREST (0 << 1) +# define RADEON_MIN_FILTER_LINEAR (1 << 1) +# define RADEON_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1) +# define RADEON_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1) +# define RADEON_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1) +# define RADEON_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1) +# define RADEON_MIN_FILTER_ANISO_NEAREST (8 << 1) +# define RADEON_MIN_FILTER_ANISO_LINEAR (9 << 1) +# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1) +# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1) +# define RADEON_MIN_FILTER_MASK (15 << 1) +# define RADEON_MAX_ANISO_1_TO_1 (0 << 5) +# define RADEON_MAX_ANISO_2_TO_1 (1 << 5) +# define RADEON_MAX_ANISO_4_TO_1 (2 << 5) +# define RADEON_MAX_ANISO_8_TO_1 (3 << 5) +# define RADEON_MAX_ANISO_16_TO_1 (4 << 5) +# define RADEON_MAX_ANISO_MASK (7 << 5) +# define RADEON_LOD_BIAS_MASK (0xff << 8) +# define RADEON_LOD_BIAS_SHIFT 8 +# define RADEON_MAX_MIP_LEVEL_MASK (0x0f << 16) +# define RADEON_MAX_MIP_LEVEL_SHIFT 16 +# define RADEON_YUV_TO_RGB (1 << 20) +# define RADEON_YUV_TEMPERATURE_COOL (0 << 21) +# define RADEON_YUV_TEMPERATURE_HOT (1 << 21) +# define RADEON_YUV_TEMPERATURE_MASK (1 << 21) +# define RADEON_WRAPEN_S (1 << 22) +# define RADEON_CLAMP_S_WRAP (0 << 23) +# define RADEON_CLAMP_S_MIRROR (1 << 23) +# define RADEON_CLAMP_S_CLAMP_LAST (2 << 23) +# define RADEON_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23) +# define RADEON_CLAMP_S_CLAMP_BORDER (4 << 23) +# define RADEON_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23) +# define RADEON_CLAMP_S_CLAMP_GL (6 << 23) +# define RADEON_CLAMP_S_MIRROR_CLAMP_GL (7 << 23) +# define RADEON_CLAMP_S_MASK (7 << 23) +# define RADEON_WRAPEN_T (1 << 26) +# define RADEON_CLAMP_T_WRAP (0 << 27) +# define RADEON_CLAMP_T_MIRROR (1 << 27) +# define RADEON_CLAMP_T_CLAMP_LAST (2 << 27) +# define RADEON_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27) +# define RADEON_CLAMP_T_CLAMP_BORDER (4 << 27) +# define RADEON_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27) +# define RADEON_CLAMP_T_CLAMP_GL (6 << 27) +# define RADEON_CLAMP_T_MIRROR_CLAMP_GL (7 << 27) +# define RADEON_CLAMP_T_MASK (7 << 27) +# define RADEON_BORDER_MODE_OGL (0 << 31) +# define RADEON_BORDER_MODE_D3D (1 << 31) +#define RADEON_PP_TXFORMAT_0 0x1c58 +#define RADEON_PP_TXFORMAT_1 0x1c70 +#define RADEON_PP_TXFORMAT_2 0x1c88 +# define RADEON_TXFORMAT_I8 (0 << 0) +# define RADEON_TXFORMAT_AI88 (1 << 0) +# define RADEON_TXFORMAT_RGB332 (2 << 0) +# define RADEON_TXFORMAT_ARGB1555 (3 << 0) +# define RADEON_TXFORMAT_RGB565 (4 << 0) +# define RADEON_TXFORMAT_ARGB4444 (5 << 0) +# define RADEON_TXFORMAT_ARGB8888 (6 << 0) +# define RADEON_TXFORMAT_RGBA8888 (7 << 0) +# define RADEON_TXFORMAT_Y8 (8 << 0) +# define RADEON_TXFORMAT_VYUY422 (10 << 0) +# define RADEON_TXFORMAT_YVYU422 (11 << 0) +# define RADEON_TXFORMAT_DXT1 (12 << 0) +# define RADEON_TXFORMAT_DXT23 (14 << 0) +# define RADEON_TXFORMAT_DXT45 (15 << 0) +# define RADEON_TXFORMAT_SHADOW16 (16 << 0) +# define RADEON_TXFORMAT_SHADOW32 (17 << 0) +# define RADEON_TXFORMAT_DUDV88 (18 << 0) +# define RADEON_TXFORMAT_LDUDV655 (19 << 0) +# define RADEON_TXFORMAT_LDUDUV8888 (20 << 0) +# define RADEON_TXFORMAT_FORMAT_MASK (31 << 0) +# define RADEON_TXFORMAT_FORMAT_SHIFT 0 +# define RADEON_TXFORMAT_APPLE_YUV_MODE (1 << 5) +# define RADEON_TXFORMAT_ALPHA_IN_MAP (1 << 6) +# define RADEON_TXFORMAT_NON_POWER2 (1 << 7) +# define RADEON_TXFORMAT_WIDTH_MASK (15 << 8) +# define RADEON_TXFORMAT_WIDTH_SHIFT 8 +# define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12) +# define RADEON_TXFORMAT_HEIGHT_SHIFT 12 +# define RADEON_TXFORMAT_F5_WIDTH_MASK (15 << 16) +# define RADEON_TXFORMAT_F5_WIDTH_SHIFT 16 +# define RADEON_TXFORMAT_F5_HEIGHT_MASK (15 << 20) +# define RADEON_TXFORMAT_F5_HEIGHT_SHIFT 20 +# define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_STQ2 (2 << 24) +# define RADEON_TXFORMAT_ENDIAN_NO_SWAP (0 << 26) +# define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP (1 << 26) +# define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP (2 << 26) +# define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3 << 26) +# define RADEON_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) +# define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) +# define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) +# define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31) +#define RADEON_PP_CUBIC_FACES_0 0x1d24 +#define RADEON_PP_CUBIC_FACES_1 0x1d28 +#define RADEON_PP_CUBIC_FACES_2 0x1d2c +# define RADEON_FACE_WIDTH_1_SHIFT 0 +# define RADEON_FACE_HEIGHT_1_SHIFT 4 +# define RADEON_FACE_WIDTH_1_MASK (0xf << 0) +# define RADEON_FACE_HEIGHT_1_MASK (0xf << 4) +# define RADEON_FACE_WIDTH_2_SHIFT 8 +# define RADEON_FACE_HEIGHT_2_SHIFT 12 +# define RADEON_FACE_WIDTH_2_MASK (0xf << 8) +# define RADEON_FACE_HEIGHT_2_MASK (0xf << 12) +# define RADEON_FACE_WIDTH_3_SHIFT 16 +# define RADEON_FACE_HEIGHT_3_SHIFT 20 +# define RADEON_FACE_WIDTH_3_MASK (0xf << 16) +# define RADEON_FACE_HEIGHT_3_MASK (0xf << 20) +# define RADEON_FACE_WIDTH_4_SHIFT 24 +# define RADEON_FACE_HEIGHT_4_SHIFT 28 +# define RADEON_FACE_WIDTH_4_MASK (0xf << 24) +# define RADEON_FACE_HEIGHT_4_MASK (0xf << 28) + +#define RADEON_PP_TXOFFSET_0 0x1c5c +#define RADEON_PP_TXOFFSET_1 0x1c74 +#define RADEON_PP_TXOFFSET_2 0x1c8c +# define RADEON_TXO_ENDIAN_NO_SWAP (0 << 0) +# define RADEON_TXO_ENDIAN_BYTE_SWAP (1 << 0) +# define RADEON_TXO_ENDIAN_WORD_SWAP (2 << 0) +# define RADEON_TXO_ENDIAN_HALFDW_SWAP (3 << 0) +# define RADEON_TXO_MACRO_LINEAR (0 << 2) +# define RADEON_TXO_MACRO_TILE (1 << 2) +# define RADEON_TXO_MICRO_LINEAR (0 << 3) +# define RADEON_TXO_MICRO_TILE_X2 (1 << 3) +# define RADEON_TXO_MICRO_TILE_OPT (2 << 3) +# define RADEON_TXO_OFFSET_MASK 0xffffffe0 +# define RADEON_TXO_OFFSET_SHIFT 5 + +#define RADEON_PP_CUBIC_OFFSET_T0_0 0x1dd0 /* bits [31:5] */ +#define RADEON_PP_CUBIC_OFFSET_T0_1 0x1dd4 +#define RADEON_PP_CUBIC_OFFSET_T0_2 0x1dd8 +#define RADEON_PP_CUBIC_OFFSET_T0_3 0x1ddc +#define RADEON_PP_CUBIC_OFFSET_T0_4 0x1de0 +#define RADEON_PP_CUBIC_OFFSET_T1_0 0x1e00 +#define RADEON_PP_CUBIC_OFFSET_T1_1 0x1e04 +#define RADEON_PP_CUBIC_OFFSET_T1_2 0x1e08 +#define RADEON_PP_CUBIC_OFFSET_T1_3 0x1e0c +#define RADEON_PP_CUBIC_OFFSET_T1_4 0x1e10 +#define RADEON_PP_CUBIC_OFFSET_T2_0 0x1e14 +#define RADEON_PP_CUBIC_OFFSET_T2_1 0x1e18 +#define RADEON_PP_CUBIC_OFFSET_T2_2 0x1e1c +#define RADEON_PP_CUBIC_OFFSET_T2_3 0x1e20 +#define RADEON_PP_CUBIC_OFFSET_T2_4 0x1e24 + +#define RADEON_PP_TEX_SIZE_0 0x1d04 /* NPOT */ +#define RADEON_PP_TEX_SIZE_1 0x1d0c +#define RADEON_PP_TEX_SIZE_2 0x1d14 +# define RADEON_TEX_USIZE_MASK (0x7ff << 0) +# define RADEON_TEX_USIZE_SHIFT 0 +# define RADEON_TEX_VSIZE_MASK (0x7ff << 16) +# define RADEON_TEX_VSIZE_SHIFT 16 +# define RADEON_SIGNED_RGB_MASK (1 << 30) +# define RADEON_SIGNED_RGB_SHIFT 30 +# define RADEON_SIGNED_ALPHA_MASK (1 << 31) +# define RADEON_SIGNED_ALPHA_SHIFT 31 +#define RADEON_PP_TEX_PITCH_0 0x1d08 /* NPOT */ +#define RADEON_PP_TEX_PITCH_1 0x1d10 /* NPOT */ +#define RADEON_PP_TEX_PITCH_2 0x1d18 /* NPOT */ +/* note: bits 13-5: 32 byte aligned stride of texture map */ + +#define RADEON_PP_TXCBLEND_0 0x1c60 +#define RADEON_PP_TXCBLEND_1 0x1c78 +#define RADEON_PP_TXCBLEND_2 0x1c90 +# define RADEON_COLOR_ARG_A_SHIFT 0 +# define RADEON_COLOR_ARG_A_MASK (0x1f << 0) +# define RADEON_COLOR_ARG_A_ZERO (0 << 0) +# define RADEON_COLOR_ARG_A_CURRENT_COLOR (2 << 0) +# define RADEON_COLOR_ARG_A_CURRENT_ALPHA (3 << 0) +# define RADEON_COLOR_ARG_A_DIFFUSE_COLOR (4 << 0) +# define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA (5 << 0) +# define RADEON_COLOR_ARG_A_SPECULAR_COLOR (6 << 0) +# define RADEON_COLOR_ARG_A_SPECULAR_ALPHA (7 << 0) +# define RADEON_COLOR_ARG_A_TFACTOR_COLOR (8 << 0) +# define RADEON_COLOR_ARG_A_TFACTOR_ALPHA (9 << 0) +# define RADEON_COLOR_ARG_A_T0_COLOR (10 << 0) +# define RADEON_COLOR_ARG_A_T0_ALPHA (11 << 0) +# define RADEON_COLOR_ARG_A_T1_COLOR (12 << 0) +# define RADEON_COLOR_ARG_A_T1_ALPHA (13 << 0) +# define RADEON_COLOR_ARG_A_T2_COLOR (14 << 0) +# define RADEON_COLOR_ARG_A_T2_ALPHA (15 << 0) +# define RADEON_COLOR_ARG_A_T3_COLOR (16 << 0) +# define RADEON_COLOR_ARG_A_T3_ALPHA (17 << 0) +# define RADEON_COLOR_ARG_B_SHIFT 5 +# define RADEON_COLOR_ARG_B_MASK (0x1f << 5) +# define RADEON_COLOR_ARG_B_ZERO (0 << 5) +# define RADEON_COLOR_ARG_B_CURRENT_COLOR (2 << 5) +# define RADEON_COLOR_ARG_B_CURRENT_ALPHA (3 << 5) +# define RADEON_COLOR_ARG_B_DIFFUSE_COLOR (4 << 5) +# define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA (5 << 5) +# define RADEON_COLOR_ARG_B_SPECULAR_COLOR (6 << 5) +# define RADEON_COLOR_ARG_B_SPECULAR_ALPHA (7 << 5) +# define RADEON_COLOR_ARG_B_TFACTOR_COLOR (8 << 5) +# define RADEON_COLOR_ARG_B_TFACTOR_ALPHA (9 << 5) +# define RADEON_COLOR_ARG_B_T0_COLOR (10 << 5) +# define RADEON_COLOR_ARG_B_T0_ALPHA (11 << 5) +# define RADEON_COLOR_ARG_B_T1_COLOR (12 << 5) +# define RADEON_COLOR_ARG_B_T1_ALPHA (13 << 5) +# define RADEON_COLOR_ARG_B_T2_COLOR (14 << 5) +# define RADEON_COLOR_ARG_B_T2_ALPHA (15 << 5) +# define RADEON_COLOR_ARG_B_T3_COLOR (16 << 5) +# define RADEON_COLOR_ARG_B_T3_ALPHA (17 << 5) +# define RADEON_COLOR_ARG_C_SHIFT 10 +# define RADEON_COLOR_ARG_C_MASK (0x1f << 10) +# define RADEON_COLOR_ARG_C_ZERO (0 << 10) +# define RADEON_COLOR_ARG_C_CURRENT_COLOR (2 << 10) +# define RADEON_COLOR_ARG_C_CURRENT_ALPHA (3 << 10) +# define RADEON_COLOR_ARG_C_DIFFUSE_COLOR (4 << 10) +# define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA (5 << 10) +# define RADEON_COLOR_ARG_C_SPECULAR_COLOR (6 << 10) +# define RADEON_COLOR_ARG_C_SPECULAR_ALPHA (7 << 10) +# define RADEON_COLOR_ARG_C_TFACTOR_COLOR (8 << 10) +# define RADEON_COLOR_ARG_C_TFACTOR_ALPHA (9 << 10) +# define RADEON_COLOR_ARG_C_T0_COLOR (10 << 10) +# define RADEON_COLOR_ARG_C_T0_ALPHA (11 << 10) +# define RADEON_COLOR_ARG_C_T1_COLOR (12 << 10) +# define RADEON_COLOR_ARG_C_T1_ALPHA (13 << 10) +# define RADEON_COLOR_ARG_C_T2_COLOR (14 << 10) +# define RADEON_COLOR_ARG_C_T2_ALPHA (15 << 10) +# define RADEON_COLOR_ARG_C_T3_COLOR (16 << 10) +# define RADEON_COLOR_ARG_C_T3_ALPHA (17 << 10) +# define RADEON_COMP_ARG_A (1 << 15) +# define RADEON_COMP_ARG_A_SHIFT 15 +# define RADEON_COMP_ARG_B (1 << 16) +# define RADEON_COMP_ARG_B_SHIFT 16 +# define RADEON_COMP_ARG_C (1 << 17) +# define RADEON_COMP_ARG_C_SHIFT 17 +# define RADEON_BLEND_CTL_MASK (7 << 18) +# define RADEON_BLEND_CTL_ADD (0 << 18) +# define RADEON_BLEND_CTL_SUBTRACT (1 << 18) +# define RADEON_BLEND_CTL_ADDSIGNED (2 << 18) +# define RADEON_BLEND_CTL_BLEND (3 << 18) +# define RADEON_BLEND_CTL_DOT3 (4 << 18) +# define RADEON_SCALE_SHIFT 21 +# define RADEON_SCALE_MASK (3 << 21) +# define RADEON_SCALE_1X (0 << 21) +# define RADEON_SCALE_2X (1 << 21) +# define RADEON_SCALE_4X (2 << 21) +# define RADEON_CLAMP_TX (1 << 23) +# define RADEON_T0_EQ_TCUR (1 << 24) +# define RADEON_T1_EQ_TCUR (1 << 25) +# define RADEON_T2_EQ_TCUR (1 << 26) +# define RADEON_T3_EQ_TCUR (1 << 27) +# define RADEON_COLOR_ARG_MASK 0x1f +# define RADEON_COMP_ARG_SHIFT 15 +#define RADEON_PP_TXABLEND_0 0x1c64 +#define RADEON_PP_TXABLEND_1 0x1c7c +#define RADEON_PP_TXABLEND_2 0x1c94 +# define RADEON_ALPHA_ARG_A_SHIFT 0 +# define RADEON_ALPHA_ARG_A_MASK (0xf << 0) +# define RADEON_ALPHA_ARG_A_ZERO (0 << 0) +# define RADEON_ALPHA_ARG_A_CURRENT_ALPHA (1 << 0) +# define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA (2 << 0) +# define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA (3 << 0) +# define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA (4 << 0) +# define RADEON_ALPHA_ARG_A_T0_ALPHA (5 << 0) +# define RADEON_ALPHA_ARG_A_T1_ALPHA (6 << 0) +# define RADEON_ALPHA_ARG_A_T2_ALPHA (7 << 0) +# define RADEON_ALPHA_ARG_A_T3_ALPHA (8 << 0) +# define RADEON_ALPHA_ARG_B_SHIFT 4 +# define RADEON_ALPHA_ARG_B_MASK (0xf << 4) +# define RADEON_ALPHA_ARG_B_ZERO (0 << 4) +# define RADEON_ALPHA_ARG_B_CURRENT_ALPHA (1 << 4) +# define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA (2 << 4) +# define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA (3 << 4) +# define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA (4 << 4) +# define RADEON_ALPHA_ARG_B_T0_ALPHA (5 << 4) +# define RADEON_ALPHA_ARG_B_T1_ALPHA (6 << 4) +# define RADEON_ALPHA_ARG_B_T2_ALPHA (7 << 4) +# define RADEON_ALPHA_ARG_B_T3_ALPHA (8 << 4) +# define RADEON_ALPHA_ARG_C_SHIFT 8 +# define RADEON_ALPHA_ARG_C_MASK (0xf << 8) +# define RADEON_ALPHA_ARG_C_ZERO (0 << 8) +# define RADEON_ALPHA_ARG_C_CURRENT_ALPHA (1 << 8) +# define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA (2 << 8) +# define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA (3 << 8) +# define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA (4 << 8) +# define RADEON_ALPHA_ARG_C_T0_ALPHA (5 << 8) +# define RADEON_ALPHA_ARG_C_T1_ALPHA (6 << 8) +# define RADEON_ALPHA_ARG_C_T2_ALPHA (7 << 8) +# define RADEON_ALPHA_ARG_C_T3_ALPHA (8 << 8) +# define RADEON_DOT_ALPHA_DONT_REPLICATE (1 << 9) +# define RADEON_ALPHA_ARG_MASK 0xf + +#define RADEON_PP_TFACTOR_0 0x1c68 +#define RADEON_PP_TFACTOR_1 0x1c80 +#define RADEON_PP_TFACTOR_2 0x1c98 + +#define RADEON_RB3D_BLENDCNTL 0x1c20 +# define RADEON_COMB_FCN_MASK (3 << 12) +# define RADEON_COMB_FCN_ADD_CLAMP (0 << 12) +# define RADEON_COMB_FCN_ADD_NOCLAMP (1 << 12) +# define RADEON_COMB_FCN_SUB_CLAMP (2 << 12) +# define RADEON_COMB_FCN_SUB_NOCLAMP (3 << 12) +# define RADEON_SRC_BLEND_GL_ZERO (32 << 16) +# define RADEON_SRC_BLEND_GL_ONE (33 << 16) +# define RADEON_SRC_BLEND_GL_SRC_COLOR (34 << 16) +# define RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16) +# define RADEON_SRC_BLEND_GL_DST_COLOR (36 << 16) +# define RADEON_SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16) +# define RADEON_SRC_BLEND_GL_SRC_ALPHA (38 << 16) +# define RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16) +# define RADEON_SRC_BLEND_GL_DST_ALPHA (40 << 16) +# define RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16) +# define RADEON_SRC_BLEND_GL_SRC_ALPHA_SATURATE (42 << 16) +# define RADEON_SRC_BLEND_MASK (63 << 16) +# define RADEON_DST_BLEND_GL_ZERO (32 << 24) +# define RADEON_DST_BLEND_GL_ONE (33 << 24) +# define RADEON_DST_BLEND_GL_SRC_COLOR (34 << 24) +# define RADEON_DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24) +# define RADEON_DST_BLEND_GL_DST_COLOR (36 << 24) +# define RADEON_DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24) +# define RADEON_DST_BLEND_GL_SRC_ALPHA (38 << 24) +# define RADEON_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24) +# define RADEON_DST_BLEND_GL_DST_ALPHA (40 << 24) +# define RADEON_DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24) +# define RADEON_DST_BLEND_MASK (63 << 24) +#define RADEON_RB3D_CNTL 0x1c3c +# define RADEON_ALPHA_BLEND_ENABLE (1 << 0) +# define RADEON_PLANE_MASK_ENABLE (1 << 1) +# define RADEON_DITHER_ENABLE (1 << 2) +# define RADEON_ROUND_ENABLE (1 << 3) +# define RADEON_SCALE_DITHER_ENABLE (1 << 4) +# define RADEON_DITHER_INIT (1 << 5) +# define RADEON_ROP_ENABLE (1 << 6) +# define RADEON_STENCIL_ENABLE (1 << 7) +# define RADEON_Z_ENABLE (1 << 8) +# define RADEON_DEPTHXY_OFFSET_ENABLE (1 << 9) +# define RADEON_RB3D_COLOR_FORMAT_SHIFT 10 + +# define RADEON_COLOR_FORMAT_ARGB1555 3 +# define RADEON_COLOR_FORMAT_RGB565 4 +# define RADEON_COLOR_FORMAT_ARGB8888 6 +# define RADEON_COLOR_FORMAT_RGB332 7 +# define RADEON_COLOR_FORMAT_Y8 8 +# define RADEON_COLOR_FORMAT_RGB8 9 +# define RADEON_COLOR_FORMAT_YUV422_VYUY 11 +# define RADEON_COLOR_FORMAT_YUV422_YVYU 12 +# define RADEON_COLOR_FORMAT_aYUV444 14 +# define RADEON_COLOR_FORMAT_ARGB4444 15 + +# define RADEON_CLRCMP_FLIP_ENABLE (1 << 14) +#define RADEON_RB3D_COLOROFFSET 0x1c40 +# define RADEON_COLOROFFSET_MASK 0xfffffff0 +#define RADEON_RB3D_COLORPITCH 0x1c48 +# define RADEON_COLORPITCH_MASK 0x000001ff8 +# define RADEON_COLOR_TILE_ENABLE (1 << 16) +# define RADEON_COLOR_MICROTILE_ENABLE (1 << 17) +# define RADEON_COLOR_ENDIAN_NO_SWAP (0 << 18) +# define RADEON_COLOR_ENDIAN_WORD_SWAP (1 << 18) +# define RADEON_COLOR_ENDIAN_DWORD_SWAP (2 << 18) +#define RADEON_RB3D_DEPTHOFFSET 0x1c24 +#define RADEON_RB3D_DEPTHPITCH 0x1c28 +# define RADEON_DEPTHPITCH_MASK 0x00001ff8 +# define RADEON_DEPTH_ENDIAN_NO_SWAP (0 << 18) +# define RADEON_DEPTH_ENDIAN_WORD_SWAP (1 << 18) +# define RADEON_DEPTH_ENDIAN_DWORD_SWAP (2 << 18) +#define RADEON_RB3D_PLANEMASK 0x1d84 +#define RADEON_RB3D_ROPCNTL 0x1d80 +# define RADEON_ROP_MASK (15 << 8) +# define RADEON_ROP_CLEAR (0 << 8) +# define RADEON_ROP_NOR (1 << 8) +# define RADEON_ROP_AND_INVERTED (2 << 8) +# define RADEON_ROP_COPY_INVERTED (3 << 8) +# define RADEON_ROP_AND_REVERSE (4 << 8) +# define RADEON_ROP_INVERT (5 << 8) +# define RADEON_ROP_XOR (6 << 8) +# define RADEON_ROP_NAND (7 << 8) +# define RADEON_ROP_AND (8 << 8) +# define RADEON_ROP_EQUIV (9 << 8) +# define RADEON_ROP_NOOP (10 << 8) +# define RADEON_ROP_OR_INVERTED (11 << 8) +# define RADEON_ROP_COPY (12 << 8) +# define RADEON_ROP_OR_REVERSE (13 << 8) +# define RADEON_ROP_OR (14 << 8) +# define RADEON_ROP_SET (15 << 8) +#define RADEON_RB3D_STENCILREFMASK 0x1d7c +# define RADEON_STENCIL_REF_SHIFT 0 +# define RADEON_STENCIL_REF_MASK (0xff << 0) +# define RADEON_STENCIL_MASK_SHIFT 16 +# define RADEON_STENCIL_VALUE_MASK (0xff << 16) +# define RADEON_STENCIL_WRITEMASK_SHIFT 24 +# define RADEON_STENCIL_WRITE_MASK (0xff << 24) +#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c +# define RADEON_DEPTH_FORMAT_MASK (0xf << 0) +# define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) +# define RADEON_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) +# define RADEON_DEPTH_FORMAT_24BIT_FLOAT_Z (3 << 0) +# define RADEON_DEPTH_FORMAT_32BIT_INT_Z (4 << 0) +# define RADEON_DEPTH_FORMAT_32BIT_FLOAT_Z (5 << 0) +# define RADEON_DEPTH_FORMAT_16BIT_FLOAT_W (7 << 0) +# define RADEON_DEPTH_FORMAT_24BIT_FLOAT_W (9 << 0) +# define RADEON_DEPTH_FORMAT_32BIT_FLOAT_W (11 << 0) +# define RADEON_Z_TEST_NEVER (0 << 4) +# define RADEON_Z_TEST_LESS (1 << 4) +# define RADEON_Z_TEST_LEQUAL (2 << 4) +# define RADEON_Z_TEST_EQUAL (3 << 4) +# define RADEON_Z_TEST_GEQUAL (4 << 4) +# define RADEON_Z_TEST_GREATER (5 << 4) +# define RADEON_Z_TEST_NEQUAL (6 << 4) +# define RADEON_Z_TEST_ALWAYS (7 << 4) +# define RADEON_Z_TEST_MASK (7 << 4) +# define RADEON_STENCIL_TEST_NEVER (0 << 12) +# define RADEON_STENCIL_TEST_LESS (1 << 12) +# define RADEON_STENCIL_TEST_LEQUAL (2 << 12) +# define RADEON_STENCIL_TEST_EQUAL (3 << 12) +# define RADEON_STENCIL_TEST_GEQUAL (4 << 12) +# define RADEON_STENCIL_TEST_GREATER (5 << 12) +# define RADEON_STENCIL_TEST_NEQUAL (6 << 12) +# define RADEON_STENCIL_TEST_ALWAYS (7 << 12) +# define RADEON_STENCIL_TEST_MASK (0x7 << 12) +# define RADEON_STENCIL_FAIL_KEEP (0 << 16) +# define RADEON_STENCIL_FAIL_ZERO (1 << 16) +# define RADEON_STENCIL_FAIL_REPLACE (2 << 16) +# define RADEON_STENCIL_FAIL_INC (3 << 16) +# define RADEON_STENCIL_FAIL_DEC (4 << 16) +# define RADEON_STENCIL_FAIL_INVERT (5 << 16) +# define RADEON_STENCIL_FAIL_MASK (0x7 << 16) +# define RADEON_STENCIL_ZPASS_KEEP (0 << 20) +# define RADEON_STENCIL_ZPASS_ZERO (1 << 20) +# define RADEON_STENCIL_ZPASS_REPLACE (2 << 20) +# define RADEON_STENCIL_ZPASS_INC (3 << 20) +# define RADEON_STENCIL_ZPASS_DEC (4 << 20) +# define RADEON_STENCIL_ZPASS_INVERT (5 << 20) +# define RADEON_STENCIL_ZPASS_MASK (0x7 << 20) +# define RADEON_STENCIL_ZFAIL_KEEP (0 << 24) +# define RADEON_STENCIL_ZFAIL_ZERO (1 << 24) +# define RADEON_STENCIL_ZFAIL_REPLACE (2 << 24) +# define RADEON_STENCIL_ZFAIL_INC (3 << 24) +# define RADEON_STENCIL_ZFAIL_DEC (4 << 24) +# define RADEON_STENCIL_ZFAIL_INVERT (5 << 24) +# define RADEON_STENCIL_ZFAIL_MASK (0x7 << 24) +# define RADEON_Z_COMPRESSION_ENABLE (1 << 28) +# define RADEON_FORCE_Z_DIRTY (1 << 29) +# define RADEON_Z_WRITE_ENABLE (1 << 30) +#define RADEON_RE_LINE_PATTERN 0x1cd0 +# define RADEON_LINE_PATTERN_MASK 0x0000ffff +# define RADEON_LINE_REPEAT_COUNT_SHIFT 16 +# define RADEON_LINE_PATTERN_START_SHIFT 24 +# define RADEON_LINE_PATTERN_LITTLE_BIT_ORDER (0 << 28) +# define RADEON_LINE_PATTERN_BIG_BIT_ORDER (1 << 28) +# define RADEON_LINE_PATTERN_AUTO_RESET (1 << 29) +#define RADEON_RE_LINE_STATE 0x1cd4 +# define RADEON_LINE_CURRENT_PTR_SHIFT 0 +# define RADEON_LINE_CURRENT_COUNT_SHIFT 8 +#define RADEON_RE_MISC 0x26c4 +# define RADEON_STIPPLE_COORD_MASK 0x1f +# define RADEON_STIPPLE_X_OFFSET_SHIFT 0 +# define RADEON_STIPPLE_X_OFFSET_MASK (0x1f << 0) +# define RADEON_STIPPLE_Y_OFFSET_SHIFT 8 +# define RADEON_STIPPLE_Y_OFFSET_MASK (0x1f << 8) +# define RADEON_STIPPLE_LITTLE_BIT_ORDER (0 << 16) +# define RADEON_STIPPLE_BIG_BIT_ORDER (1 << 16) +#define RADEON_RE_SOLID_COLOR 0x1c1c +#define RADEON_RE_TOP_LEFT 0x26c0 +# define RADEON_RE_LEFT_SHIFT 0 +# define RADEON_RE_TOP_SHIFT 16 +#define RADEON_RE_WIDTH_HEIGHT 0x1c44 +# define RADEON_RE_WIDTH_SHIFT 0 +# define RADEON_RE_HEIGHT_SHIFT 16 + +#define RADEON_RB3D_ZPASS_DATA 0x3290 +#define RADEON_RB3D_ZPASS_ADDR 0x3294 + +#define RADEON_SE_CNTL 0x1c4c +# define RADEON_FFACE_CULL_CW (0 << 0) +# define RADEON_FFACE_CULL_CCW (1 << 0) +# define RADEON_FFACE_CULL_DIR_MASK (1 << 0) +# define RADEON_BFACE_CULL (0 << 1) +# define RADEON_BFACE_SOLID (3 << 1) +# define RADEON_FFACE_CULL (0 << 3) +# define RADEON_FFACE_SOLID (3 << 3) +# define RADEON_FFACE_CULL_MASK (3 << 3) +# define RADEON_BADVTX_CULL_DISABLE (1 << 5) +# define RADEON_FLAT_SHADE_VTX_0 (0 << 6) +# define RADEON_FLAT_SHADE_VTX_1 (1 << 6) +# define RADEON_FLAT_SHADE_VTX_2 (2 << 6) +# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6) +# define RADEON_DIFFUSE_SHADE_SOLID (0 << 8) +# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8) +# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8) +# define RADEON_DIFFUSE_SHADE_MASK (3 << 8) +# define RADEON_ALPHA_SHADE_SOLID (0 << 10) +# define RADEON_ALPHA_SHADE_FLAT (1 << 10) +# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10) +# define RADEON_ALPHA_SHADE_MASK (3 << 10) +# define RADEON_SPECULAR_SHADE_SOLID (0 << 12) +# define RADEON_SPECULAR_SHADE_FLAT (1 << 12) +# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12) +# define RADEON_SPECULAR_SHADE_MASK (3 << 12) +# define RADEON_FOG_SHADE_SOLID (0 << 14) +# define RADEON_FOG_SHADE_FLAT (1 << 14) +# define RADEON_FOG_SHADE_GOURAUD (2 << 14) +# define RADEON_FOG_SHADE_MASK (3 << 14) +# define RADEON_ZBIAS_ENABLE_POINT (1 << 16) +# define RADEON_ZBIAS_ENABLE_LINE (1 << 17) +# define RADEON_ZBIAS_ENABLE_TRI (1 << 18) +# define RADEON_WIDELINE_ENABLE (1 << 20) +# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24) +# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25) +# define RADEON_VTX_PIX_CENTER_D3D (0 << 27) +# define RADEON_VTX_PIX_CENTER_OGL (1 << 27) +# define RADEON_ROUND_MODE_TRUNC (0 << 28) +# define RADEON_ROUND_MODE_ROUND (1 << 28) +# define RADEON_ROUND_MODE_ROUND_EVEN (2 << 28) +# define RADEON_ROUND_MODE_ROUND_ODD (3 << 28) +# define RADEON_ROUND_PREC_16TH_PIX (0 << 30) +# define RADEON_ROUND_PREC_8TH_PIX (1 << 30) +# define RADEON_ROUND_PREC_4TH_PIX (2 << 30) +# define RADEON_ROUND_PREC_HALF_PIX (3 << 30) +#define R200_RE_CNTL 0x1c50 +# define R200_STIPPLE_ENABLE 0x1 +# define R200_SCISSOR_ENABLE 0x2 +# define R200_PATTERN_ENABLE 0x4 +# define R200_PERSPECTIVE_ENABLE 0x8 +# define R200_POINT_SMOOTH 0x20 +# define R200_VTX_STQ0_D3D 0x00010000 +# define R200_VTX_STQ1_D3D 0x00040000 +# define R200_VTX_STQ2_D3D 0x00100000 +# define R200_VTX_STQ3_D3D 0x00400000 +# define R200_VTX_STQ4_D3D 0x01000000 +# define R200_VTX_STQ5_D3D 0x04000000 +#define RADEON_SE_CNTL_STATUS 0x2140 +# define RADEON_VC_NO_SWAP (0 << 0) +# define RADEON_VC_16BIT_SWAP (1 << 0) +# define RADEON_VC_32BIT_SWAP (2 << 0) +# define RADEON_VC_HALF_DWORD_SWAP (3 << 0) +# define RADEON_TCL_BYPASS (1 << 8) +#define RADEON_SE_COORD_FMT 0x1c50 +# define RADEON_VTX_XY_PRE_MULT_1_OVER_W0 (1 << 0) +# define RADEON_VTX_Z_PRE_MULT_1_OVER_W0 (1 << 1) +# define RADEON_VTX_ST0_NONPARAMETRIC (1 << 8) +# define RADEON_VTX_ST1_NONPARAMETRIC (1 << 9) +# define RADEON_VTX_ST2_NONPARAMETRIC (1 << 10) +# define RADEON_VTX_ST3_NONPARAMETRIC (1 << 11) +# define RADEON_VTX_W0_NORMALIZE (1 << 12) +# define RADEON_VTX_W0_IS_NOT_1_OVER_W0 (1 << 16) +# define RADEON_VTX_ST0_PRE_MULT_1_OVER_W0 (1 << 17) +# define RADEON_VTX_ST1_PRE_MULT_1_OVER_W0 (1 << 19) +# define RADEON_VTX_ST2_PRE_MULT_1_OVER_W0 (1 << 21) +# define RADEON_VTX_ST3_PRE_MULT_1_OVER_W0 (1 << 23) +# define RADEON_TEX1_W_ROUTING_USE_W0 (0 << 26) +# define RADEON_TEX1_W_ROUTING_USE_Q1 (1 << 26) +#define RADEON_SE_LINE_WIDTH 0x1db8 +#define RADEON_SE_TCL_LIGHT_MODEL_CTL 0x226c +# define RADEON_LIGHTING_ENABLE (1 << 0) +# define RADEON_LIGHT_IN_MODELSPACE (1 << 1) +# define RADEON_LOCAL_VIEWER (1 << 2) +# define RADEON_NORMALIZE_NORMALS (1 << 3) +# define RADEON_RESCALE_NORMALS (1 << 4) +# define RADEON_SPECULAR_LIGHTS (1 << 5) +# define RADEON_DIFFUSE_SPECULAR_COMBINE (1 << 6) +# define RADEON_LIGHT_ALPHA (1 << 7) +# define RADEON_LOCAL_LIGHT_VEC_GL (1 << 8) +# define RADEON_LIGHT_NO_NORMAL_AMBIENT_ONLY (1 << 9) +# define RADEON_LM_SOURCE_STATE_PREMULT 0 +# define RADEON_LM_SOURCE_STATE_MULT 1 +# define RADEON_LM_SOURCE_VERTEX_DIFFUSE 2 +# define RADEON_LM_SOURCE_VERTEX_SPECULAR 3 +# define RADEON_EMISSIVE_SOURCE_SHIFT 16 +# define RADEON_AMBIENT_SOURCE_SHIFT 18 +# define RADEON_DIFFUSE_SOURCE_SHIFT 20 +# define RADEON_SPECULAR_SOURCE_SHIFT 22 +#define RADEON_SE_TCL_MATERIAL_AMBIENT_RED 0x2220 +#define RADEON_SE_TCL_MATERIAL_AMBIENT_GREEN 0x2224 +#define RADEON_SE_TCL_MATERIAL_AMBIENT_BLUE 0x2228 +#define RADEON_SE_TCL_MATERIAL_AMBIENT_ALPHA 0x222c +#define RADEON_SE_TCL_MATERIAL_DIFFUSE_RED 0x2230 +#define RADEON_SE_TCL_MATERIAL_DIFFUSE_GREEN 0x2234 +#define RADEON_SE_TCL_MATERIAL_DIFFUSE_BLUE 0x2238 +#define RADEON_SE_TCL_MATERIAL_DIFFUSE_ALPHA 0x223c +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED 0x2210 +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_GREEN 0x2214 +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_BLUE 0x2218 +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_ALPHA 0x221c +#define RADEON_SE_TCL_MATERIAL_SPECULAR_RED 0x2240 +#define RADEON_SE_TCL_MATERIAL_SPECULAR_GREEN 0x2244 +#define RADEON_SE_TCL_MATERIAL_SPECULAR_BLUE 0x2248 +#define RADEON_SE_TCL_MATERIAL_SPECULAR_ALPHA 0x224c +#define RADEON_SE_TCL_MATRIX_SELECT_0 0x225c +# define RADEON_MODELVIEW_0_SHIFT 0 +# define RADEON_MODELVIEW_1_SHIFT 4 +# define RADEON_MODELVIEW_2_SHIFT 8 +# define RADEON_MODELVIEW_3_SHIFT 12 +# define RADEON_IT_MODELVIEW_0_SHIFT 16 +# define RADEON_IT_MODELVIEW_1_SHIFT 20 +# define RADEON_IT_MODELVIEW_2_SHIFT 24 +# define RADEON_IT_MODELVIEW_3_SHIFT 28 +#define RADEON_SE_TCL_MATRIX_SELECT_1 0x2260 +# define RADEON_MODELPROJECT_0_SHIFT 0 +# define RADEON_MODELPROJECT_1_SHIFT 4 +# define RADEON_MODELPROJECT_2_SHIFT 8 +# define RADEON_MODELPROJECT_3_SHIFT 12 +# define RADEON_TEXMAT_0_SHIFT 16 +# define RADEON_TEXMAT_1_SHIFT 20 +# define RADEON_TEXMAT_2_SHIFT 24 +# define RADEON_TEXMAT_3_SHIFT 28 + + +#define RADEON_SE_TCL_OUTPUT_VTX_FMT 0x2254 +# define RADEON_TCL_VTX_W0 (1 << 0) +# define RADEON_TCL_VTX_FP_DIFFUSE (1 << 1) +# define RADEON_TCL_VTX_FP_ALPHA (1 << 2) +# define RADEON_TCL_VTX_PK_DIFFUSE (1 << 3) +# define RADEON_TCL_VTX_FP_SPEC (1 << 4) +# define RADEON_TCL_VTX_FP_FOG (1 << 5) +# define RADEON_TCL_VTX_PK_SPEC (1 << 6) +# define RADEON_TCL_VTX_ST0 (1 << 7) +# define RADEON_TCL_VTX_ST1 (1 << 8) +# define RADEON_TCL_VTX_Q1 (1 << 9) +# define RADEON_TCL_VTX_ST2 (1 << 10) +# define RADEON_TCL_VTX_Q2 (1 << 11) +# define RADEON_TCL_VTX_ST3 (1 << 12) +# define RADEON_TCL_VTX_Q3 (1 << 13) +# define RADEON_TCL_VTX_Q0 (1 << 14) +# define RADEON_TCL_VTX_WEIGHT_COUNT_SHIFT 15 +# define RADEON_TCL_VTX_NORM0 (1 << 18) +# define RADEON_TCL_VTX_XY1 (1 << 27) +# define RADEON_TCL_VTX_Z1 (1 << 28) +# define RADEON_TCL_VTX_W1 (1 << 29) +# define RADEON_TCL_VTX_NORM1 (1 << 30) +# define RADEON_TCL_VTX_Z0 (1 << 31) + +#define RADEON_SE_TCL_OUTPUT_VTX_SEL 0x2258 +# define RADEON_TCL_COMPUTE_XYZW (1 << 0) +# define RADEON_TCL_COMPUTE_DIFFUSE (1 << 1) +# define RADEON_TCL_COMPUTE_SPECULAR (1 << 2) +# define RADEON_TCL_FORCE_NAN_IF_COLOR_NAN (1 << 3) +# define RADEON_TCL_FORCE_INORDER_PROC (1 << 4) +# define RADEON_TCL_TEX_INPUT_TEX_0 0 +# define RADEON_TCL_TEX_INPUT_TEX_1 1 +# define RADEON_TCL_TEX_INPUT_TEX_2 2 +# define RADEON_TCL_TEX_INPUT_TEX_3 3 +# define RADEON_TCL_TEX_COMPUTED_TEX_0 8 +# define RADEON_TCL_TEX_COMPUTED_TEX_1 9 +# define RADEON_TCL_TEX_COMPUTED_TEX_2 10 +# define RADEON_TCL_TEX_COMPUTED_TEX_3 11 +# define RADEON_TCL_TEX_0_OUTPUT_SHIFT 16 +# define RADEON_TCL_TEX_1_OUTPUT_SHIFT 20 +# define RADEON_TCL_TEX_2_OUTPUT_SHIFT 24 +# define RADEON_TCL_TEX_3_OUTPUT_SHIFT 28 + +#define RADEON_SE_TCL_PER_LIGHT_CTL_0 0x2270 +# define RADEON_LIGHT_0_ENABLE (1 << 0) +# define RADEON_LIGHT_0_ENABLE_AMBIENT (1 << 1) +# define RADEON_LIGHT_0_ENABLE_SPECULAR (1 << 2) +# define RADEON_LIGHT_0_IS_LOCAL (1 << 3) +# define RADEON_LIGHT_0_IS_SPOT (1 << 4) +# define RADEON_LIGHT_0_DUAL_CONE (1 << 5) +# define RADEON_LIGHT_0_ENABLE_RANGE_ATTEN (1 << 6) +# define RADEON_LIGHT_0_CONSTANT_RANGE_ATTEN (1 << 7) +# define RADEON_LIGHT_0_SHIFT 0 +# define RADEON_LIGHT_1_ENABLE (1 << 16) +# define RADEON_LIGHT_1_ENABLE_AMBIENT (1 << 17) +# define RADEON_LIGHT_1_ENABLE_SPECULAR (1 << 18) +# define RADEON_LIGHT_1_IS_LOCAL (1 << 19) +# define RADEON_LIGHT_1_IS_SPOT (1 << 20) +# define RADEON_LIGHT_1_DUAL_CONE (1 << 21) +# define RADEON_LIGHT_1_ENABLE_RANGE_ATTEN (1 << 22) +# define RADEON_LIGHT_1_CONSTANT_RANGE_ATTEN (1 << 23) +# define RADEON_LIGHT_1_SHIFT 16 +#define RADEON_SE_TCL_PER_LIGHT_CTL_1 0x2274 +# define RADEON_LIGHT_2_SHIFT 0 +# define RADEON_LIGHT_3_SHIFT 16 +#define RADEON_SE_TCL_PER_LIGHT_CTL_2 0x2278 +# define RADEON_LIGHT_4_SHIFT 0 +# define RADEON_LIGHT_5_SHIFT 16 +#define RADEON_SE_TCL_PER_LIGHT_CTL_3 0x227c +# define RADEON_LIGHT_6_SHIFT 0 +# define RADEON_LIGHT_7_SHIFT 16 + +#define RADEON_SE_TCL_SHININESS 0x2250 + +#define RADEON_SE_TCL_TEXTURE_PROC_CTL 0x2268 +# define RADEON_TEXGEN_TEXMAT_0_ENABLE (1 << 0) +# define RADEON_TEXGEN_TEXMAT_1_ENABLE (1 << 1) +# define RADEON_TEXGEN_TEXMAT_2_ENABLE (1 << 2) +# define RADEON_TEXGEN_TEXMAT_3_ENABLE (1 << 3) +# define RADEON_TEXMAT_0_ENABLE (1 << 4) +# define RADEON_TEXMAT_1_ENABLE (1 << 5) +# define RADEON_TEXMAT_2_ENABLE (1 << 6) +# define RADEON_TEXMAT_3_ENABLE (1 << 7) +# define RADEON_TEXGEN_INPUT_MASK 0xf +# define RADEON_TEXGEN_INPUT_TEXCOORD_0 0 +# define RADEON_TEXGEN_INPUT_TEXCOORD_1 1 +# define RADEON_TEXGEN_INPUT_TEXCOORD_2 2 +# define RADEON_TEXGEN_INPUT_TEXCOORD_3 3 +# define RADEON_TEXGEN_INPUT_OBJ 4 +# define RADEON_TEXGEN_INPUT_EYE 5 +# define RADEON_TEXGEN_INPUT_EYE_NORMAL 6 +# define RADEON_TEXGEN_INPUT_EYE_REFLECT 7 +# define RADEON_TEXGEN_INPUT_EYE_NORMALIZED 8 +# define RADEON_TEXGEN_0_INPUT_SHIFT 16 +# define RADEON_TEXGEN_1_INPUT_SHIFT 20 +# define RADEON_TEXGEN_2_INPUT_SHIFT 24 +# define RADEON_TEXGEN_3_INPUT_SHIFT 28 + +#define RADEON_SE_TCL_UCP_VERT_BLEND_CTL 0x2264 +# define RADEON_UCP_IN_CLIP_SPACE (1 << 0) +# define RADEON_UCP_IN_MODEL_SPACE (1 << 1) +# define RADEON_UCP_ENABLE_0 (1 << 2) +# define RADEON_UCP_ENABLE_1 (1 << 3) +# define RADEON_UCP_ENABLE_2 (1 << 4) +# define RADEON_UCP_ENABLE_3 (1 << 5) +# define RADEON_UCP_ENABLE_4 (1 << 6) +# define RADEON_UCP_ENABLE_5 (1 << 7) +# define RADEON_TCL_FOG_MASK (3 << 8) +# define RADEON_TCL_FOG_DISABLE (0 << 8) +# define RADEON_TCL_FOG_EXP (1 << 8) +# define RADEON_TCL_FOG_EXP2 (2 << 8) +# define RADEON_TCL_FOG_LINEAR (3 << 8) +# define RADEON_RNG_BASED_FOG (1 << 10) +# define RADEON_LIGHT_TWOSIDE (1 << 11) +# define RADEON_BLEND_OP_COUNT_MASK (7 << 12) +# define RADEON_BLEND_OP_COUNT_SHIFT 12 +# define RADEON_POSITION_BLEND_OP_ENABLE (1 << 16) +# define RADEON_NORMAL_BLEND_OP_ENABLE (1 << 17) +# define RADEON_VERTEX_BLEND_SRC_0_PRIMARY (1 << 18) +# define RADEON_VERTEX_BLEND_SRC_0_SECONDARY (1 << 18) +# define RADEON_VERTEX_BLEND_SRC_1_PRIMARY (1 << 19) +# define RADEON_VERTEX_BLEND_SRC_1_SECONDARY (1 << 19) +# define RADEON_VERTEX_BLEND_SRC_2_PRIMARY (1 << 20) +# define RADEON_VERTEX_BLEND_SRC_2_SECONDARY (1 << 20) +# define RADEON_VERTEX_BLEND_SRC_3_PRIMARY (1 << 21) +# define RADEON_VERTEX_BLEND_SRC_3_SECONDARY (1 << 21) +# define RADEON_VERTEX_BLEND_WGT_MINUS_ONE (1 << 22) +# define RADEON_CULL_FRONT_IS_CW (0 << 28) +# define RADEON_CULL_FRONT_IS_CCW (1 << 28) +# define RADEON_CULL_FRONT (1 << 29) +# define RADEON_CULL_BACK (1 << 30) +# define RADEON_FORCE_W_TO_ONE (1 << 31) + +#define RADEON_SE_VPORT_XSCALE 0x1d98 +#define RADEON_SE_VPORT_XOFFSET 0x1d9c +#define RADEON_SE_VPORT_YSCALE 0x1da0 +#define RADEON_SE_VPORT_YOFFSET 0x1da4 +#define RADEON_SE_VPORT_ZSCALE 0x1da8 +#define RADEON_SE_VPORT_ZOFFSET 0x1dac +#define RADEON_SE_ZBIAS_FACTOR 0x1db0 +#define RADEON_SE_ZBIAS_CONSTANT 0x1db4 + +#define RADEON_SE_VTX_FMT 0x2080 +# define RADEON_SE_VTX_FMT_XY 0x00000000 +# define RADEON_SE_VTX_FMT_W0 0x00000001 +# define RADEON_SE_VTX_FMT_FPCOLOR 0x00000002 +# define RADEON_SE_VTX_FMT_FPALPHA 0x00000004 +# define RADEON_SE_VTX_FMT_PKCOLOR 0x00000008 +# define RADEON_SE_VTX_FMT_FPSPEC 0x00000010 +# define RADEON_SE_VTX_FMT_FPFOG 0x00000020 +# define RADEON_SE_VTX_FMT_PKSPEC 0x00000040 +# define RADEON_SE_VTX_FMT_ST0 0x00000080 +# define RADEON_SE_VTX_FMT_ST1 0x00000100 +# define RADEON_SE_VTX_FMT_Q1 0x00000200 +# define RADEON_SE_VTX_FMT_ST2 0x00000400 +# define RADEON_SE_VTX_FMT_Q2 0x00000800 +# define RADEON_SE_VTX_FMT_ST3 0x00001000 +# define RADEON_SE_VTX_FMT_Q3 0x00002000 +# define RADEON_SE_VTX_FMT_Q0 0x00004000 +# define RADEON_SE_VTX_FMT_BLND_WEIGHT_CNT_MASK 0x00038000 +# define RADEON_SE_VTX_FMT_N0 0x00040000 +# define RADEON_SE_VTX_FMT_XY1 0x08000000 +# define RADEON_SE_VTX_FMT_Z1 0x10000000 +# define RADEON_SE_VTX_FMT_W1 0x20000000 +# define RADEON_SE_VTX_FMT_N1 0x40000000 +# define RADEON_SE_VTX_FMT_Z 0x80000000 + +#define RADEON_SE_VF_CNTL 0x2084 +# define RADEON_VF_PRIM_TYPE_POINT_LIST 1 +# define RADEON_VF_PRIM_TYPE_LINE_LIST 2 +# define RADEON_VF_PRIM_TYPE_LINE_STRIP 3 +# define RADEON_VF_PRIM_TYPE_TRIANGLE_LIST 4 +# define RADEON_VF_PRIM_TYPE_TRIANGLE_FAN 5 +# define RADEON_VF_PRIM_TYPE_TRIANGLE_STRIP 6 +# define RADEON_VF_PRIM_TYPE_TRIANGLE_FLAG 7 +# define RADEON_VF_PRIM_TYPE_RECTANGLE_LIST 8 +# define RADEON_VF_PRIM_TYPE_POINT_LIST_3 9 +# define RADEON_VF_PRIM_TYPE_LINE_LIST_3 10 +# define RADEON_VF_PRIM_TYPE_SPIRIT_LIST 11 +# define RADEON_VF_PRIM_TYPE_LINE_LOOP 12 +# define RADEON_VF_PRIM_TYPE_QUAD_LIST 13 +# define RADEON_VF_PRIM_TYPE_QUAD_STRIP 14 +# define RADEON_VF_PRIM_TYPE_POLYGON 15 +# define RADEON_VF_PRIM_WALK_STATE (0<<4) +# define RADEON_VF_PRIM_WALK_INDEX (1<<4) +# define RADEON_VF_PRIM_WALK_LIST (2<<4) +# define RADEON_VF_PRIM_WALK_DATA (3<<4) +# define RADEON_VF_COLOR_ORDER_RGBA (1<<6) +# define RADEON_VF_RADEON_MODE (1<<8) +# define RADEON_VF_TCL_OUTPUT_CTL_ENA (1<<9) +# define RADEON_VF_PROG_STREAM_ENA (1<<10) +# define RADEON_VF_INDEX_SIZE_SHIFT 11 +# define RADEON_VF_NUM_VERTICES_SHIFT 16 + +#define RADEON_SE_PORT_DATA0 0x2000 + +#define R200_SE_VAP_CNTL 0x2080 +# define R200_VAP_TCL_ENABLE 0x00000001 +# define R200_VAP_SINGLE_BUF_STATE_ENABLE 0x00000010 +# define R200_VAP_FORCE_W_TO_ONE 0x00010000 +# define R200_VAP_D3D_TEX_DEFAULT 0x00020000 +# define R200_VAP_VF_MAX_VTX_NUM__SHIFT 18 +# define R200_VAP_VF_MAX_VTX_NUM (9 << 18) +# define R200_VAP_DX_CLIP_SPACE_DEF 0x00400000 +#define R200_VF_MAX_VTX_INDX 0x210c +#define R200_VF_MIN_VTX_INDX 0x2110 +#define R200_SE_VTE_CNTL 0x20b0 +# define R200_VPORT_X_SCALE_ENA 0x00000001 +# define R200_VPORT_X_OFFSET_ENA 0x00000002 +# define R200_VPORT_Y_SCALE_ENA 0x00000004 +# define R200_VPORT_Y_OFFSET_ENA 0x00000008 +# define R200_VPORT_Z_SCALE_ENA 0x00000010 +# define R200_VPORT_Z_OFFSET_ENA 0x00000020 +# define R200_VTX_XY_FMT 0x00000100 +# define R200_VTX_Z_FMT 0x00000200 +# define R200_VTX_W0_FMT 0x00000400 +# define R200_VTX_W0_NORMALIZE 0x00000800 +# define R200_VTX_ST_DENORMALIZED 0x00001000 +#define R200_SE_VAP_CNTL_STATUS 0x2140 +# define R200_VC_NO_SWAP (0 << 0) +# define R200_VC_16BIT_SWAP (1 << 0) +# define R200_VC_32BIT_SWAP (2 << 0) +#define R200_PP_TXFILTER_0 0x2c00 +#define R200_PP_TXFILTER_1 0x2c20 +#define R200_PP_TXFILTER_2 0x2c40 +#define R200_PP_TXFILTER_3 0x2c60 +#define R200_PP_TXFILTER_4 0x2c80 +#define R200_PP_TXFILTER_5 0x2ca0 +# define R200_MAG_FILTER_NEAREST (0 << 0) +# define R200_MAG_FILTER_LINEAR (1 << 0) +# define R200_MAG_FILTER_MASK (1 << 0) +# define R200_MIN_FILTER_NEAREST (0 << 1) +# define R200_MIN_FILTER_LINEAR (1 << 1) +# define R200_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1) +# define R200_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1) +# define R200_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1) +# define R200_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1) +# define R200_MIN_FILTER_ANISO_NEAREST (8 << 1) +# define R200_MIN_FILTER_ANISO_LINEAR (9 << 1) +# define R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1) +# define R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1) +# define R200_MIN_FILTER_MASK (15 << 1) +# define R200_MAX_ANISO_1_TO_1 (0 << 5) +# define R200_MAX_ANISO_2_TO_1 (1 << 5) +# define R200_MAX_ANISO_4_TO_1 (2 << 5) +# define R200_MAX_ANISO_8_TO_1 (3 << 5) +# define R200_MAX_ANISO_16_TO_1 (4 << 5) +# define R200_MAX_ANISO_MASK (7 << 5) +# define R200_MAX_MIP_LEVEL_MASK (0x0f << 16) +# define R200_MAX_MIP_LEVEL_SHIFT 16 +# define R200_YUV_TO_RGB (1 << 20) +# define R200_YUV_TEMPERATURE_COOL (0 << 21) +# define R200_YUV_TEMPERATURE_HOT (1 << 21) +# define R200_YUV_TEMPERATURE_MASK (1 << 21) +# define R200_WRAPEN_S (1 << 22) +# define R200_CLAMP_S_WRAP (0 << 23) +# define R200_CLAMP_S_MIRROR (1 << 23) +# define R200_CLAMP_S_CLAMP_LAST (2 << 23) +# define R200_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23) +# define R200_CLAMP_S_CLAMP_BORDER (4 << 23) +# define R200_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23) +# define R200_CLAMP_S_CLAMP_GL (6 << 23) +# define R200_CLAMP_S_MIRROR_CLAMP_GL (7 << 23) +# define R200_CLAMP_S_MASK (7 << 23) +# define R200_WRAPEN_T (1 << 26) +# define R200_CLAMP_T_WRAP (0 << 27) +# define R200_CLAMP_T_MIRROR (1 << 27) +# define R200_CLAMP_T_CLAMP_LAST (2 << 27) +# define R200_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27) +# define R200_CLAMP_T_CLAMP_BORDER (4 << 27) +# define R200_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27) +# define R200_CLAMP_T_CLAMP_GL (6 << 27) +# define R200_CLAMP_T_MIRROR_CLAMP_GL (7 << 27) +# define R200_CLAMP_T_MASK (7 << 27) +# define R200_KILL_LT_ZERO (1 << 30) +# define R200_BORDER_MODE_OGL (0 << 31) +# define R200_BORDER_MODE_D3D (1 << 31) +#define R200_PP_TXFORMAT_0 0x2c04 +#define R200_PP_TXFORMAT_1 0x2c24 +#define R200_PP_TXFORMAT_2 0x2c44 +#define R200_PP_TXFORMAT_3 0x2c64 +#define R200_PP_TXFORMAT_4 0x2c84 +#define R200_PP_TXFORMAT_5 0x2ca4 +# define R200_TXFORMAT_I8 (0 << 0) +# define R200_TXFORMAT_AI88 (1 << 0) +# define R200_TXFORMAT_RGB332 (2 << 0) +# define R200_TXFORMAT_ARGB1555 (3 << 0) +# define R200_TXFORMAT_RGB565 (4 << 0) +# define R200_TXFORMAT_ARGB4444 (5 << 0) +# define R200_TXFORMAT_ARGB8888 (6 << 0) +# define R200_TXFORMAT_RGBA8888 (7 << 0) +# define R200_TXFORMAT_Y8 (8 << 0) +# define R200_TXFORMAT_AVYU4444 (9 << 0) +# define R200_TXFORMAT_VYUY422 (10 << 0) +# define R200_TXFORMAT_YVYU422 (11 << 0) +# define R200_TXFORMAT_DXT1 (12 << 0) +# define R200_TXFORMAT_DXT23 (14 << 0) +# define R200_TXFORMAT_DXT45 (15 << 0) +# define R200_TXFORMAT_DVDU88 (18 << 0) +# define R200_TXFORMAT_LDVDU655 (19 << 0) +# define R200_TXFORMAT_LDVDU8888 (20 << 0) +# define R200_TXFORMAT_GR1616 (21 << 0) +# define R200_TXFORMAT_ABGR8888 (22 << 0) +# define R200_TXFORMAT_BGR111110 (23 << 0) +# define R200_TXFORMAT_FORMAT_MASK (31 << 0) +# define R200_TXFORMAT_FORMAT_SHIFT 0 +# define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6) +# define R200_TXFORMAT_NON_POWER2 (1 << 7) +# define R200_TXFORMAT_WIDTH_MASK (15 << 8) +# define R200_TXFORMAT_WIDTH_SHIFT 8 +# define R200_TXFORMAT_HEIGHT_MASK (15 << 12) +# define R200_TXFORMAT_HEIGHT_SHIFT 12 +# define R200_TXFORMAT_F5_WIDTH_MASK (15 << 16) /* cube face 5 */ +# define R200_TXFORMAT_F5_WIDTH_SHIFT 16 +# define R200_TXFORMAT_F5_HEIGHT_MASK (15 << 20) +# define R200_TXFORMAT_F5_HEIGHT_SHIFT 20 +# define R200_TXFORMAT_ST_ROUTE_STQ0 (0 << 24) +# define R200_TXFORMAT_ST_ROUTE_STQ1 (1 << 24) +# define R200_TXFORMAT_ST_ROUTE_STQ2 (2 << 24) +# define R200_TXFORMAT_ST_ROUTE_STQ3 (3 << 24) +# define R200_TXFORMAT_ST_ROUTE_STQ4 (4 << 24) +# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24) +# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24) +# define R200_TXFORMAT_ST_ROUTE_SHIFT 24 +# define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27) +# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) +# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) +# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) +#define R200_PP_TXFORMAT_X_0 0x2c08 +#define R200_PP_TXFORMAT_X_1 0x2c28 +#define R200_PP_TXFORMAT_X_2 0x2c48 +#define R200_PP_TXFORMAT_X_3 0x2c68 +#define R200_PP_TXFORMAT_X_4 0x2c88 +#define R200_PP_TXFORMAT_X_5 0x2ca8 + +#define R200_PP_TXSIZE_0 0x2c0c /* NPOT only */ +#define R200_PP_TXSIZE_1 0x2c2c /* NPOT only */ +#define R200_PP_TXSIZE_2 0x2c4c /* NPOT only */ +#define R200_PP_TXSIZE_3 0x2c6c /* NPOT only */ +#define R200_PP_TXSIZE_4 0x2c8c /* NPOT only */ +#define R200_PP_TXSIZE_5 0x2cac /* NPOT only */ + +#define R200_PP_TXPITCH_0 0x2c10 /* NPOT only */ +#define R200_PP_TXPITCH_1 0x2c30 /* NPOT only */ +#define R200_PP_TXPITCH_2 0x2c50 /* NPOT only */ +#define R200_PP_TXPITCH_3 0x2c70 /* NPOT only */ +#define R200_PP_TXPITCH_4 0x2c90 /* NPOT only */ +#define R200_PP_TXPITCH_5 0x2cb0 /* NPOT only */ + +#define R200_PP_CUBIC_FACES_0 0x2c18 +#define R200_PP_CUBIC_FACES_1 0x2c38 +#define R200_PP_CUBIC_FACES_2 0x2c58 +#define R200_PP_CUBIC_FACES_3 0x2c78 +#define R200_PP_CUBIC_FACES_4 0x2c98 +#define R200_PP_CUBIC_FACES_5 0x2cb8 + +#define R200_PP_TXOFFSET_0 0x2d00 +# define R200_TXO_ENDIAN_NO_SWAP (0 << 0) +# define R200_TXO_ENDIAN_BYTE_SWAP (1 << 0) +# define R200_TXO_ENDIAN_WORD_SWAP (2 << 0) +# define R200_TXO_ENDIAN_HALFDW_SWAP (3 << 0) +# define R200_TXO_MACRO_LINEAR (0 << 2) +# define R200_TXO_MACRO_TILE (1 << 2) +# define R200_TXO_MICRO_LINEAR (0 << 3) +# define R200_TXO_MICRO_TILE (1 << 3) +# define R200_TXO_OFFSET_MASK 0xffffffe0 +# define R200_TXO_OFFSET_SHIFT 5 +#define R200_PP_CUBIC_OFFSET_F1_0 0x2d04 +#define R200_PP_CUBIC_OFFSET_F2_0 0x2d08 +#define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c +#define R200_PP_CUBIC_OFFSET_F4_0 0x2d10 +#define R200_PP_CUBIC_OFFSET_F5_0 0x2d14 + +#define R200_PP_TXOFFSET_1 0x2d18 +#define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c +#define R200_PP_CUBIC_OFFSET_F2_1 0x2d20 +#define R200_PP_CUBIC_OFFSET_F3_1 0x2d24 +#define R200_PP_CUBIC_OFFSET_F4_1 0x2d28 +#define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c + +#define R200_PP_TXOFFSET_2 0x2d30 +#define R200_PP_CUBIC_OFFSET_F1_2 0x2d34 +#define R200_PP_CUBIC_OFFSET_F2_2 0x2d38 +#define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c +#define R200_PP_CUBIC_OFFSET_F4_2 0x2d40 +#define R200_PP_CUBIC_OFFSET_F5_2 0x2d44 + +#define R200_PP_TXOFFSET_3 0x2d48 +#define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c +#define R200_PP_CUBIC_OFFSET_F2_3 0x2d50 +#define R200_PP_CUBIC_OFFSET_F3_3 0x2d54 +#define R200_PP_CUBIC_OFFSET_F4_3 0x2d58 +#define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c +#define R200_PP_TXOFFSET_4 0x2d60 +#define R200_PP_CUBIC_OFFSET_F1_4 0x2d64 +#define R200_PP_CUBIC_OFFSET_F2_4 0x2d68 +#define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c +#define R200_PP_CUBIC_OFFSET_F4_4 0x2d70 +#define R200_PP_CUBIC_OFFSET_F5_4 0x2d74 +#define R200_PP_TXOFFSET_5 0x2d78 +#define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c +#define R200_PP_CUBIC_OFFSET_F2_5 0x2d80 +#define R200_PP_CUBIC_OFFSET_F3_5 0x2d84 +#define R200_PP_CUBIC_OFFSET_F4_5 0x2d88 +#define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c + +#define R200_PP_TFACTOR_0 0x2ee0 +#define R200_PP_TFACTOR_1 0x2ee4 +#define R200_PP_TFACTOR_2 0x2ee8 +#define R200_PP_TFACTOR_3 0x2eec +#define R200_PP_TFACTOR_4 0x2ef0 +#define R200_PP_TFACTOR_5 0x2ef4 + +#define R200_PP_TXCBLEND_0 0x2f00 +# define R200_TXC_ARG_A_ZERO (0) +# define R200_TXC_ARG_A_CURRENT_COLOR (2) +# define R200_TXC_ARG_A_CURRENT_ALPHA (3) +# define R200_TXC_ARG_A_DIFFUSE_COLOR (4) +# define R200_TXC_ARG_A_DIFFUSE_ALPHA (5) +# define R200_TXC_ARG_A_SPECULAR_COLOR (6) +# define R200_TXC_ARG_A_SPECULAR_ALPHA (7) +# define R200_TXC_ARG_A_TFACTOR_COLOR (8) +# define R200_TXC_ARG_A_TFACTOR_ALPHA (9) +# define R200_TXC_ARG_A_R0_COLOR (10) +# define R200_TXC_ARG_A_R0_ALPHA (11) +# define R200_TXC_ARG_A_R1_COLOR (12) +# define R200_TXC_ARG_A_R1_ALPHA (13) +# define R200_TXC_ARG_A_R2_COLOR (14) +# define R200_TXC_ARG_A_R2_ALPHA (15) +# define R200_TXC_ARG_A_R3_COLOR (16) +# define R200_TXC_ARG_A_R3_ALPHA (17) +# define R200_TXC_ARG_A_R4_COLOR (18) +# define R200_TXC_ARG_A_R4_ALPHA (19) +# define R200_TXC_ARG_A_R5_COLOR (20) +# define R200_TXC_ARG_A_R5_ALPHA (21) +# define R200_TXC_ARG_A_TFACTOR1_COLOR (26) +# define R200_TXC_ARG_A_TFACTOR1_ALPHA (27) +# define R200_TXC_ARG_A_MASK (31 << 0) +# define R200_TXC_ARG_A_SHIFT 0 +# define R200_TXC_ARG_B_ZERO (0 << 5) +# define R200_TXC_ARG_B_CURRENT_COLOR (2 << 5) +# define R200_TXC_ARG_B_CURRENT_ALPHA (3 << 5) +# define R200_TXC_ARG_B_DIFFUSE_COLOR (4 << 5) +# define R200_TXC_ARG_B_DIFFUSE_ALPHA (5 << 5) +# define R200_TXC_ARG_B_SPECULAR_COLOR (6 << 5) +# define R200_TXC_ARG_B_SPECULAR_ALPHA (7 << 5) +# define R200_TXC_ARG_B_TFACTOR_COLOR (8 << 5) +# define R200_TXC_ARG_B_TFACTOR_ALPHA (9 << 5) +# define R200_TXC_ARG_B_R0_COLOR (10 << 5) +# define R200_TXC_ARG_B_R0_ALPHA (11 << 5) +# define R200_TXC_ARG_B_R1_COLOR (12 << 5) +# define R200_TXC_ARG_B_R1_ALPHA (13 << 5) +# define R200_TXC_ARG_B_R2_COLOR (14 << 5) +# define R200_TXC_ARG_B_R2_ALPHA (15 << 5) +# define R200_TXC_ARG_B_R3_COLOR (16 << 5) +# define R200_TXC_ARG_B_R3_ALPHA (17 << 5) +# define R200_TXC_ARG_B_R4_COLOR (18 << 5) +# define R200_TXC_ARG_B_R4_ALPHA (19 << 5) +# define R200_TXC_ARG_B_R5_COLOR (20 << 5) +# define R200_TXC_ARG_B_R5_ALPHA (21 << 5) +# define R200_TXC_ARG_B_TFACTOR1_COLOR (26 << 5) +# define R200_TXC_ARG_B_TFACTOR1_ALPHA (27 << 5) +# define R200_TXC_ARG_B_MASK (31 << 5) +# define R200_TXC_ARG_B_SHIFT 5 +# define R200_TXC_ARG_C_ZERO (0 << 10) +# define R200_TXC_ARG_C_CURRENT_COLOR (2 << 10) +# define R200_TXC_ARG_C_CURRENT_ALPHA (3 << 10) +# define R200_TXC_ARG_C_DIFFUSE_COLOR (4 << 10) +# define R200_TXC_ARG_C_DIFFUSE_ALPHA (5 << 10) +# define R200_TXC_ARG_C_SPECULAR_COLOR (6 << 10) +# define R200_TXC_ARG_C_SPECULAR_ALPHA (7 << 10) +# define R200_TXC_ARG_C_TFACTOR_COLOR (8 << 10) +# define R200_TXC_ARG_C_TFACTOR_ALPHA (9 << 10) +# define R200_TXC_ARG_C_R0_COLOR (10 << 10) +# define R200_TXC_ARG_C_R0_ALPHA (11 << 10) +# define R200_TXC_ARG_C_R1_COLOR (12 << 10) +# define R200_TXC_ARG_C_R1_ALPHA (13 << 10) +# define R200_TXC_ARG_C_R2_COLOR (14 << 10) +# define R200_TXC_ARG_C_R2_ALPHA (15 << 10) +# define R200_TXC_ARG_C_R3_COLOR (16 << 10) +# define R200_TXC_ARG_C_R3_ALPHA (17 << 10) +# define R200_TXC_ARG_C_R4_COLOR (18 << 10) +# define R200_TXC_ARG_C_R4_ALPHA (19 << 10) +# define R200_TXC_ARG_C_R5_COLOR (20 << 10) +# define R200_TXC_ARG_C_R5_ALPHA (21 << 10) +# define R200_TXC_ARG_C_TFACTOR1_COLOR (26 << 10) +# define R200_TXC_ARG_C_TFACTOR1_ALPHA (27 << 10) +# define R200_TXC_ARG_C_MASK (31 << 10) +# define R200_TXC_ARG_C_SHIFT 10 +# define R200_TXC_COMP_ARG_A (1 << 16) +# define R200_TXC_COMP_ARG_A_SHIFT (16) +# define R200_TXC_BIAS_ARG_A (1 << 17) +# define R200_TXC_SCALE_ARG_A (1 << 18) +# define R200_TXC_NEG_ARG_A (1 << 19) +# define R200_TXC_COMP_ARG_B (1 << 20) +# define R200_TXC_COMP_ARG_B_SHIFT (20) +# define R200_TXC_BIAS_ARG_B (1 << 21) +# define R200_TXC_SCALE_ARG_B (1 << 22) +# define R200_TXC_NEG_ARG_B (1 << 23) +# define R200_TXC_COMP_ARG_C (1 << 24) +# define R200_TXC_COMP_ARG_C_SHIFT (24) +# define R200_TXC_BIAS_ARG_C (1 << 25) +# define R200_TXC_SCALE_ARG_C (1 << 26) +# define R200_TXC_NEG_ARG_C (1 << 27) +# define R200_TXC_OP_MADD (0 << 28) +# define R200_TXC_OP_CND0 (2 << 28) +# define R200_TXC_OP_LERP (3 << 28) +# define R200_TXC_OP_DOT3 (4 << 28) +# define R200_TXC_OP_DOT4 (5 << 28) +# define R200_TXC_OP_CONDITIONAL (6 << 28) +# define R200_TXC_OP_DOT2_ADD (7 << 28) +# define R200_TXC_OP_MASK (7 << 28) +#define R200_PP_TXCBLEND2_0 0x2f04 +# define R200_TXC_TFACTOR_SEL_SHIFT 0 +# define R200_TXC_TFACTOR_SEL_MASK 0x7 +# define R200_TXC_TFACTOR1_SEL_SHIFT 4 +# define R200_TXC_TFACTOR1_SEL_MASK (0x7 << 4) +# define R200_TXC_SCALE_SHIFT 8 +# define R200_TXC_SCALE_MASK (7 << 8) +# define R200_TXC_SCALE_1X (0 << 8) +# define R200_TXC_SCALE_2X (1 << 8) +# define R200_TXC_SCALE_4X (2 << 8) +# define R200_TXC_SCALE_8X (3 << 8) +# define R200_TXC_SCALE_INV2 (5 << 8) +# define R200_TXC_SCALE_INV4 (6 << 8) +# define R200_TXC_SCALE_INV8 (7 << 8) +# define R200_TXC_CLAMP_SHIFT 12 +# define R200_TXC_CLAMP_MASK (3 << 12) +# define R200_TXC_CLAMP_WRAP (0 << 12) +# define R200_TXC_CLAMP_0_1 (1 << 12) +# define R200_TXC_CLAMP_8_8 (2 << 12) +# define R200_TXC_OUTPUT_REG_MASK (7 << 16) +# define R200_TXC_OUTPUT_REG_NONE (0 << 16) +# define R200_TXC_OUTPUT_REG_R0 (1 << 16) +# define R200_TXC_OUTPUT_REG_R1 (2 << 16) +# define R200_TXC_OUTPUT_REG_R2 (3 << 16) +# define R200_TXC_OUTPUT_REG_R3 (4 << 16) +# define R200_TXC_OUTPUT_REG_R4 (5 << 16) +# define R200_TXC_OUTPUT_REG_R5 (6 << 16) +# define R200_TXC_OUTPUT_MASK_MASK (7 << 20) +# define R200_TXC_OUTPUT_MASK_RGB (0 << 20) +# define R200_TXC_OUTPUT_MASK_RG (1 << 20) +# define R200_TXC_OUTPUT_MASK_RB (2 << 20) +# define R200_TXC_OUTPUT_MASK_R (3 << 20) +# define R200_TXC_OUTPUT_MASK_GB (4 << 20) +# define R200_TXC_OUTPUT_MASK_G (5 << 20) +# define R200_TXC_OUTPUT_MASK_B (6 << 20) +# define R200_TXC_OUTPUT_MASK_NONE (7 << 20) +# define R200_TXC_REPL_NORMAL 0 +# define R200_TXC_REPL_RED 1 +# define R200_TXC_REPL_GREEN 2 +# define R200_TXC_REPL_BLUE 3 +# define R200_TXC_REPL_ARG_A_SHIFT 26 +# define R200_TXC_REPL_ARG_A_MASK (3 << 26) +# define R200_TXC_REPL_ARG_B_SHIFT 28 +# define R200_TXC_REPL_ARG_B_MASK (3 << 28) +# define R200_TXC_REPL_ARG_C_SHIFT 30 +# define R200_TXC_REPL_ARG_C_MASK (3 << 30) +#define R200_PP_TXABLEND_0 0x2f08 +# define R200_TXA_ARG_A_ZERO (0) +# define R200_TXA_ARG_A_CURRENT_ALPHA (2) /* guess */ +# define R200_TXA_ARG_A_CURRENT_BLUE (3) /* guess */ +# define R200_TXA_ARG_A_DIFFUSE_ALPHA (4) +# define R200_TXA_ARG_A_DIFFUSE_BLUE (5) +# define R200_TXA_ARG_A_SPECULAR_ALPHA (6) +# define R200_TXA_ARG_A_SPECULAR_BLUE (7) +# define R200_TXA_ARG_A_TFACTOR_ALPHA (8) +# define R200_TXA_ARG_A_TFACTOR_BLUE (9) +# define R200_TXA_ARG_A_R0_ALPHA (10) +# define R200_TXA_ARG_A_R0_BLUE (11) +# define R200_TXA_ARG_A_R1_ALPHA (12) +# define R200_TXA_ARG_A_R1_BLUE (13) +# define R200_TXA_ARG_A_R2_ALPHA (14) +# define R200_TXA_ARG_A_R2_BLUE (15) +# define R200_TXA_ARG_A_R3_ALPHA (16) +# define R200_TXA_ARG_A_R3_BLUE (17) +# define R200_TXA_ARG_A_R4_ALPHA (18) +# define R200_TXA_ARG_A_R4_BLUE (19) +# define R200_TXA_ARG_A_R5_ALPHA (20) +# define R200_TXA_ARG_A_R5_BLUE (21) +# define R200_TXA_ARG_A_TFACTOR1_ALPHA (26) +# define R200_TXA_ARG_A_TFACTOR1_BLUE (27) +# define R200_TXA_ARG_A_MASK (31 << 0) +# define R200_TXA_ARG_A_SHIFT 0 +# define R200_TXA_ARG_B_ZERO (0 << 5) +# define R200_TXA_ARG_B_CURRENT_ALPHA (2 << 5) /* guess */ +# define R200_TXA_ARG_B_CURRENT_BLUE (3 << 5) /* guess */ +# define R200_TXA_ARG_B_DIFFUSE_ALPHA (4 << 5) +# define R200_TXA_ARG_B_DIFFUSE_BLUE (5 << 5) +# define R200_TXA_ARG_B_SPECULAR_ALPHA (6 << 5) +# define R200_TXA_ARG_B_SPECULAR_BLUE (7 << 5) +# define R200_TXA_ARG_B_TFACTOR_ALPHA (8 << 5) +# define R200_TXA_ARG_B_TFACTOR_BLUE (9 << 5) +# define R200_TXA_ARG_B_R0_ALPHA (10 << 5) +# define R200_TXA_ARG_B_R0_BLUE (11 << 5) +# define R200_TXA_ARG_B_R1_ALPHA (12 << 5) +# define R200_TXA_ARG_B_R1_BLUE (13 << 5) +# define R200_TXA_ARG_B_R2_ALPHA (14 << 5) +# define R200_TXA_ARG_B_R2_BLUE (15 << 5) +# define R200_TXA_ARG_B_R3_ALPHA (16 << 5) +# define R200_TXA_ARG_B_R3_BLUE (17 << 5) +# define R200_TXA_ARG_B_R4_ALPHA (18 << 5) +# define R200_TXA_ARG_B_R4_BLUE (19 << 5) +# define R200_TXA_ARG_B_R5_ALPHA (20 << 5) +# define R200_TXA_ARG_B_R5_BLUE (21 << 5) +# define R200_TXA_ARG_B_TFACTOR1_ALPHA (26 << 5) +# define R200_TXA_ARG_B_TFACTOR1_BLUE (27 << 5) +# define R200_TXA_ARG_B_MASK (31 << 5) +# define R200_TXA_ARG_B_SHIFT 5 +# define R200_TXA_ARG_C_ZERO (0 << 10) +# define R200_TXA_ARG_C_CURRENT_ALPHA (2 << 10) /* guess */ +# define R200_TXA_ARG_C_CURRENT_BLUE (3 << 10) /* guess */ +# define R200_TXA_ARG_C_DIFFUSE_ALPHA (4 << 10) +# define R200_TXA_ARG_C_DIFFUSE_BLUE (5 << 10) +# define R200_TXA_ARG_C_SPECULAR_ALPHA (6 << 10) +# define R200_TXA_ARG_C_SPECULAR_BLUE (7 << 10) +# define R200_TXA_ARG_C_TFACTOR_ALPHA (8 << 10) +# define R200_TXA_ARG_C_TFACTOR_BLUE (9 << 10) +# define R200_TXA_ARG_C_R0_ALPHA (10 << 10) +# define R200_TXA_ARG_C_R0_BLUE (11 << 10) +# define R200_TXA_ARG_C_R1_ALPHA (12 << 10) +# define R200_TXA_ARG_C_R1_BLUE (13 << 10) +# define R200_TXA_ARG_C_R2_ALPHA (14 << 10) +# define R200_TXA_ARG_C_R2_BLUE (15 << 10) +# define R200_TXA_ARG_C_R3_ALPHA (16 << 10) +# define R200_TXA_ARG_C_R3_BLUE (17 << 10) +# define R200_TXA_ARG_C_R4_ALPHA (18 << 10) +# define R200_TXA_ARG_C_R4_BLUE (19 << 10) +# define R200_TXA_ARG_C_R5_ALPHA (20 << 10) +# define R200_TXA_ARG_C_R5_BLUE (21 << 10) +# define R200_TXA_ARG_C_TFACTOR1_ALPHA (26 << 10) +# define R200_TXA_ARG_C_TFACTOR1_BLUE (27 << 10) +# define R200_TXA_ARG_C_MASK (31 << 10) +# define R200_TXA_ARG_C_SHIFT 10 +# define R200_TXA_COMP_ARG_A (1 << 16) +# define R200_TXA_COMP_ARG_A_SHIFT (16) +# define R200_TXA_BIAS_ARG_A (1 << 17) +# define R200_TXA_SCALE_ARG_A (1 << 18) +# define R200_TXA_NEG_ARG_A (1 << 19) +# define R200_TXA_COMP_ARG_B (1 << 20) +# define R200_TXA_COMP_ARG_B_SHIFT (20) +# define R200_TXA_BIAS_ARG_B (1 << 21) +# define R200_TXA_SCALE_ARG_B (1 << 22) +# define R200_TXA_NEG_ARG_B (1 << 23) +# define R200_TXA_COMP_ARG_C (1 << 24) +# define R200_TXA_COMP_ARG_C_SHIFT (24) +# define R200_TXA_BIAS_ARG_C (1 << 25) +# define R200_TXA_SCALE_ARG_C (1 << 26) +# define R200_TXA_NEG_ARG_C (1 << 27) +# define R200_TXA_OP_MADD (0 << 28) +# define R200_TXA_OP_CND0 (2 << 28) +# define R200_TXA_OP_LERP (3 << 28) +# define R200_TXA_OP_CONDITIONAL (6 << 28) +# define R200_TXA_OP_MASK (7 << 28) +#define R200_PP_TXABLEND2_0 0x2f0c +# define R200_TXA_TFACTOR_SEL_SHIFT 0 +# define R200_TXA_TFACTOR_SEL_MASK 0x7 +# define R200_TXA_TFACTOR1_SEL_SHIFT 4 +# define R200_TXA_TFACTOR1_SEL_MASK (0x7 << 4) +# define R200_TXA_SCALE_SHIFT 8 +# define R200_TXA_SCALE_MASK (7 << 8) +# define R200_TXA_SCALE_1X (0 << 8) +# define R200_TXA_SCALE_2X (1 << 8) +# define R200_TXA_SCALE_4X (2 << 8) +# define R200_TXA_SCALE_8X (3 << 8) +# define R200_TXA_SCALE_INV2 (5 << 8) +# define R200_TXA_SCALE_INV4 (6 << 8) +# define R200_TXA_SCALE_INV8 (7 << 8) +# define R200_TXA_CLAMP_SHIFT 12 +# define R200_TXA_CLAMP_MASK (3 << 12) +# define R200_TXA_CLAMP_WRAP (0 << 12) +# define R200_TXA_CLAMP_0_1 (1 << 12) +# define R200_TXA_CLAMP_8_8 (2 << 12) +# define R200_TXA_OUTPUT_REG_MASK (7 << 16) +# define R200_TXA_OUTPUT_REG_NONE (0 << 16) +# define R200_TXA_OUTPUT_REG_R0 (1 << 16) +# define R200_TXA_OUTPUT_REG_R1 (2 << 16) +# define R200_TXA_OUTPUT_REG_R2 (3 << 16) +# define R200_TXA_OUTPUT_REG_R3 (4 << 16) +# define R200_TXA_OUTPUT_REG_R4 (5 << 16) +# define R200_TXA_OUTPUT_REG_R5 (6 << 16) +# define R200_TXA_DOT_ALPHA (1 << 20) +# define R200_TXA_REPL_NORMAL 0 +# define R200_TXA_REPL_RED 1 +# define R200_TXA_REPL_GREEN 2 +# define R200_TXA_REPL_ARG_A_SHIFT 26 +# define R200_TXA_REPL_ARG_A_MASK (3 << 26) +# define R200_TXA_REPL_ARG_B_SHIFT 28 +# define R200_TXA_REPL_ARG_B_MASK (3 << 28) +# define R200_TXA_REPL_ARG_C_SHIFT 30 +# define R200_TXA_REPL_ARG_C_MASK (3 << 30) + +#define R200_SE_VTX_FMT_0 0x2088 +# define R200_VTX_XY 0 /* always have xy */ +# define R200_VTX_Z0 (1<<0) +# define R200_VTX_W0 (1<<1) +# define R200_VTX_WEIGHT_COUNT_SHIFT (2) +# define R200_VTX_PV_MATRIX_SEL (1<<5) +# define R200_VTX_N0 (1<<6) +# define R200_VTX_POINT_SIZE (1<<7) +# define R200_VTX_DISCRETE_FOG (1<<8) +# define R200_VTX_SHININESS_0 (1<<9) +# define R200_VTX_SHININESS_1 (1<<10) +# define R200_VTX_COLOR_NOT_PRESENT 0 +# define R200_VTX_PK_RGBA 1 +# define R200_VTX_FP_RGB 2 +# define R200_VTX_FP_RGBA 3 +# define R200_VTX_COLOR_MASK 3 +# define R200_VTX_COLOR_0_SHIFT 11 +# define R200_VTX_COLOR_1_SHIFT 13 +# define R200_VTX_COLOR_2_SHIFT 15 +# define R200_VTX_COLOR_3_SHIFT 17 +# define R200_VTX_COLOR_4_SHIFT 19 +# define R200_VTX_COLOR_5_SHIFT 21 +# define R200_VTX_COLOR_6_SHIFT 23 +# define R200_VTX_COLOR_7_SHIFT 25 +# define R200_VTX_XY1 (1<<28) +# define R200_VTX_Z1 (1<<29) +# define R200_VTX_W1 (1<<30) +# define R200_VTX_N1 (1<<31) +#define R200_SE_VTX_FMT_1 0x208c +# define R200_VTX_TEX0_COMP_CNT_SHIFT 0 +# define R200_VTX_TEX1_COMP_CNT_SHIFT 3 +# define R200_VTX_TEX2_COMP_CNT_SHIFT 6 +# define R200_VTX_TEX3_COMP_CNT_SHIFT 9 +# define R200_VTX_TEX4_COMP_CNT_SHIFT 12 +# define R200_VTX_TEX5_COMP_CNT_SHIFT 15 + +#define R200_SE_TCL_OUTPUT_VTX_FMT_0 0x2090 +#define R200_SE_TCL_OUTPUT_VTX_FMT_1 0x2094 +#define R200_SE_TCL_OUTPUT_VTX_COMP_SEL 0x2250 +# define R200_OUTPUT_XYZW (1<<0) +# define R200_OUTPUT_COLOR_0 (1<<8) +# define R200_OUTPUT_COLOR_1 (1<<9) +# define R200_OUTPUT_TEX_0 (1<<16) +# define R200_OUTPUT_TEX_1 (1<<17) +# define R200_OUTPUT_TEX_2 (1<<18) +# define R200_OUTPUT_TEX_3 (1<<19) +# define R200_OUTPUT_TEX_4 (1<<20) +# define R200_OUTPUT_TEX_5 (1<<21) +# define R200_OUTPUT_TEX_MASK (0x3f<<16) +# define R200_OUTPUT_DISCRETE_FOG (1<<24) +# define R200_OUTPUT_PT_SIZE (1<<25) +# define R200_FORCE_INORDER_PROC (1<<31) +#define R200_PP_CNTL_X 0x2cc4 +#define R200_PP_TXMULTI_CTL_0 0x2c1c +#define R200_PP_TXMULTI_CTL_1 0x2c3c +#define R200_PP_TXMULTI_CTL_2 0x2c5c +#define R200_PP_TXMULTI_CTL_3 0x2c7c +#define R200_PP_TXMULTI_CTL_4 0x2c9c +#define R200_PP_TXMULTI_CTL_5 0x2cbc +#define R200_SE_VTX_STATE_CNTL 0x2180 +# define R200_UPDATE_USER_COLOR_0_ENA_MASK (1<<16) + + /* Registers for CP and Microcode Engine */ +#define RADEON_CP_ME_RAM_ADDR 0x07d4 +#define RADEON_CP_ME_RAM_RADDR 0x07d8 +#define RADEON_CP_ME_RAM_DATAH 0x07dc +#define RADEON_CP_ME_RAM_DATAL 0x07e0 + +#define RADEON_CP_RB_BASE 0x0700 +#define RADEON_CP_RB_CNTL 0x0704 +# define RADEON_RB_BUFSZ_SHIFT 0 +# define RADEON_RB_BUFSZ_MASK (0x3f << 0) +# define RADEON_RB_BLKSZ_SHIFT 8 +# define RADEON_RB_BLKSZ_MASK (0x3f << 8) +# define RADEON_BUF_SWAP_32BIT (2 << 16) +# define RADEON_MAX_FETCH_SHIFT 18 +# define RADEON_MAX_FETCH_MASK (0x3 << 18) +# define RADEON_RB_NO_UPDATE (1 << 27) +# define RADEON_RB_RPTR_WR_ENA (1 << 31) +#define RADEON_CP_RB_RPTR_ADDR 0x070c +#define RADEON_CP_RB_RPTR 0x0710 +#define RADEON_CP_RB_WPTR 0x0714 +#define RADEON_CP_RB_RPTR_WR 0x071c + +#define RADEON_SCRATCH_UMSK 0x0770 +#define RADEON_SCRATCH_ADDR 0x0774 + +#define R600_CP_RB_BASE 0xc100 +#define R600_CP_RB_CNTL 0xc104 +# define R600_RB_BUFSZ(x) ((x) << 0) +# define R600_RB_BLKSZ(x) ((x) << 8) +# define R600_RB_NO_UPDATE (1 << 27) +# define R600_RB_RPTR_WR_ENA (1 << 31) +#define R600_CP_RB_RPTR_WR 0xc108 +#define R600_CP_RB_RPTR_ADDR 0xc10c +#define R600_CP_RB_RPTR_ADDR_HI 0xc110 +#define R600_CP_RB_WPTR 0xc114 +#define R600_CP_RB_WPTR_ADDR 0xc118 +#define R600_CP_RB_WPTR_ADDR_HI 0xc11c +#define R600_CP_RB_RPTR 0x8700 +#define R600_CP_RB_WPTR_DELAY 0x8704 + +#define RADEON_CP_IB_BASE 0x0738 +#define RADEON_CP_IB_BUFSZ 0x073c + +#define RADEON_CP_CSQ_CNTL 0x0740 +# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) +# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) +# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) +# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) +# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) +# define RADEON_CSQ_PRIBM_INDBM (4 << 28) +# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) + +#define R300_CP_RESYNC_ADDR 0x778 +#define R300_CP_RESYNC_DATA 0x77c + +#define RADEON_CP_CSQ_STAT 0x07f8 +# define RADEON_CSQ_RPTR_PRIMARY_MASK (0xff << 0) +# define RADEON_CSQ_WPTR_PRIMARY_MASK (0xff << 8) +# define RADEON_CSQ_RPTR_INDIRECT_MASK (0xff << 16) +# define RADEON_CSQ_WPTR_INDIRECT_MASK (0xff << 24) +#define RADEON_CP_CSQ2_STAT 0x07fc +#define RADEON_CP_CSQ_ADDR 0x07f0 +#define RADEON_CP_CSQ_DATA 0x07f4 +#define RADEON_CP_CSQ_APER_PRIMARY 0x1000 +#define RADEON_CP_CSQ_APER_INDIRECT 0x1300 + +#define RADEON_CP_RB_WPTR_DELAY 0x0718 +# define RADEON_PRE_WRITE_TIMER_SHIFT 0 +# define RADEON_PRE_WRITE_LIMIT_SHIFT 23 +#define RADEON_CP_CSQ_MODE 0x0744 +# define RADEON_INDIRECT2_START_SHIFT 0 +# define RADEON_INDIRECT2_START_MASK (0x7f << 0) +# define RADEON_INDIRECT1_START_SHIFT 8 +# define RADEON_INDIRECT1_START_MASK (0x7f << 8) + +#define RADEON_AIC_CNTL 0x01d0 +# define RADEON_PCIGART_TRANSLATE_EN (1 << 0) +# define RADEON_DIS_OUT_OF_PCI_GART_ACCESS (1 << 1) +# define RS400_MSI_REARM (1 << 3) /* rs400/rs480 */ +#define RADEON_AIC_LO_ADDR 0x01dc +#define RADEON_AIC_PT_BASE 0x01d8 +#define RADEON_AIC_HI_ADDR 0x01e0 + + + + /* Constants */ +/* #define RADEON_LAST_FRAME_REG RADEON_GUI_SCRATCH_REG0 */ +/* efine RADEON_LAST_CLEAR_REG RADEON_GUI_SCRATCH_REG2 */ + + + + /* CP packet types */ +#define RADEON_CP_PACKET0 0x00000000 +#define RADEON_CP_PACKET1 0x40000000 +#define RADEON_CP_PACKET2 0x80000000 +#define RADEON_CP_PACKET3 0xC0000000 +# define RADEON_CP_PACKET_MASK 0xC0000000 +# define RADEON_CP_PACKET_COUNT_MASK 0x3fff0000 +# define RADEON_CP_PACKET_MAX_DWORDS (1 << 12) +# define RADEON_CP_PACKET0_REG_MASK 0x000007ff +# define R300_CP_PACKET0_REG_MASK 0x00001fff +# define R600_CP_PACKET0_REG_MASK 0x0000ffff +# define RADEON_CP_PACKET1_REG0_MASK 0x000007ff +# define RADEON_CP_PACKET1_REG1_MASK 0x003ff800 + +#define RADEON_CP_PACKET0_ONE_REG_WR 0x00008000 + +#define RADEON_CP_PACKET3_NOP 0xC0001000 +#define RADEON_CP_PACKET3_NEXT_CHAR 0xC0001900 +#define RADEON_CP_PACKET3_PLY_NEXTSCAN 0xC0001D00 +#define RADEON_CP_PACKET3_SET_SCISSORS 0xC0001E00 +#define RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300 +#define RADEON_CP_PACKET3_LOAD_MICROCODE 0xC0002400 +#define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xC0002600 +#define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xC0002800 +#define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xC0002900 +#define RADEON_CP_PACKET3_3D_DRAW_INDX 0xC0002A00 +#define RADEON_CP_PACKET3_LOAD_PALETTE 0xC0002C00 +#define R200_CP_PACKET3_3D_DRAW_IMMD_2 0xc0003500 +#define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xC0002F00 +#define RADEON_CP_PACKET3_CNTL_PAINT 0xC0009100 +#define RADEON_CP_PACKET3_CNTL_BITBLT 0xC0009200 +#define RADEON_CP_PACKET3_CNTL_SMALLTEXT 0xC0009300 +#define RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT 0xC0009400 +#define RADEON_CP_PACKET3_CNTL_POLYLINE 0xC0009500 +#define RADEON_CP_PACKET3_CNTL_POLYSCANLINES 0xC0009800 +#define RADEON_CP_PACKET3_CNTL_PAINT_MULTI 0xC0009A00 +#define RADEON_CP_PACKET3_CNTL_BITBLT_MULTI 0xC0009B00 +#define RADEON_CP_PACKET3_CNTL_TRANS_BITBLT 0xC0009C00 + + +#define RADEON_CP_VC_FRMT_XY 0x00000000 +#define RADEON_CP_VC_FRMT_W0 0x00000001 +#define RADEON_CP_VC_FRMT_FPCOLOR 0x00000002 +#define RADEON_CP_VC_FRMT_FPALPHA 0x00000004 +#define RADEON_CP_VC_FRMT_PKCOLOR 0x00000008 +#define RADEON_CP_VC_FRMT_FPSPEC 0x00000010 +#define RADEON_CP_VC_FRMT_FPFOG 0x00000020 +#define RADEON_CP_VC_FRMT_PKSPEC 0x00000040 +#define RADEON_CP_VC_FRMT_ST0 0x00000080 +#define RADEON_CP_VC_FRMT_ST1 0x00000100 +#define RADEON_CP_VC_FRMT_Q1 0x00000200 +#define RADEON_CP_VC_FRMT_ST2 0x00000400 +#define RADEON_CP_VC_FRMT_Q2 0x00000800 +#define RADEON_CP_VC_FRMT_ST3 0x00001000 +#define RADEON_CP_VC_FRMT_Q3 0x00002000 +#define RADEON_CP_VC_FRMT_Q0 0x00004000 +#define RADEON_CP_VC_FRMT_BLND_WEIGHT_CNT_MASK 0x00038000 +#define RADEON_CP_VC_FRMT_N0 0x00040000 +#define RADEON_CP_VC_FRMT_XY1 0x08000000 +#define RADEON_CP_VC_FRMT_Z1 0x10000000 +#define RADEON_CP_VC_FRMT_W1 0x20000000 +#define RADEON_CP_VC_FRMT_N1 0x40000000 +#define RADEON_CP_VC_FRMT_Z 0x80000000 + +#define RADEON_CP_VC_CNTL_PRIM_TYPE_NONE 0x00000000 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_POINT 0x00000001 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE 0x00000002 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP 0x00000003 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE_2 0x00000007 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST 0x00000008 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST 0x0000000a +#define RADEON_CP_VC_CNTL_PRIM_WALK_IND 0x00000010 +#define RADEON_CP_VC_CNTL_PRIM_WALK_LIST 0x00000020 +#define RADEON_CP_VC_CNTL_PRIM_WALK_RING 0x00000030 +#define RADEON_CP_VC_CNTL_COLOR_ORDER_BGRA 0x00000000 +#define RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA 0x00000040 +#define RADEON_CP_VC_CNTL_MAOS_ENABLE 0x00000080 +#define RADEON_CP_VC_CNTL_VTX_FMT_NON_RADEON_MODE 0x00000000 +#define RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE 0x00000100 +#define RADEON_CP_VC_CNTL_TCL_DISABLE 0x00000000 +#define RADEON_CP_VC_CNTL_TCL_ENABLE 0x00000200 +#define RADEON_CP_VC_CNTL_NUM_SHIFT 16 + +#define RADEON_VS_MATRIX_0_ADDR 0 +#define RADEON_VS_MATRIX_1_ADDR 4 +#define RADEON_VS_MATRIX_2_ADDR 8 +#define RADEON_VS_MATRIX_3_ADDR 12 +#define RADEON_VS_MATRIX_4_ADDR 16 +#define RADEON_VS_MATRIX_5_ADDR 20 +#define RADEON_VS_MATRIX_6_ADDR 24 +#define RADEON_VS_MATRIX_7_ADDR 28 +#define RADEON_VS_MATRIX_8_ADDR 32 +#define RADEON_VS_MATRIX_9_ADDR 36 +#define RADEON_VS_MATRIX_10_ADDR 40 +#define RADEON_VS_MATRIX_11_ADDR 44 +#define RADEON_VS_MATRIX_12_ADDR 48 +#define RADEON_VS_MATRIX_13_ADDR 52 +#define RADEON_VS_MATRIX_14_ADDR 56 +#define RADEON_VS_MATRIX_15_ADDR 60 +#define RADEON_VS_LIGHT_AMBIENT_ADDR 64 +#define RADEON_VS_LIGHT_DIFFUSE_ADDR 72 +#define RADEON_VS_LIGHT_SPECULAR_ADDR 80 +#define RADEON_VS_LIGHT_DIRPOS_ADDR 88 +#define RADEON_VS_LIGHT_HWVSPOT_ADDR 96 +#define RADEON_VS_LIGHT_ATTENUATION_ADDR 104 +#define RADEON_VS_MATRIX_EYE2CLIP_ADDR 112 +#define RADEON_VS_UCP_ADDR 116 +#define RADEON_VS_GLOBAL_AMBIENT_ADDR 122 +#define RADEON_VS_FOG_PARAM_ADDR 123 +#define RADEON_VS_EYE_VECTOR_ADDR 124 + +#define RADEON_SS_LIGHT_DCD_ADDR 0 +#define RADEON_SS_LIGHT_SPOT_EXPONENT_ADDR 8 +#define RADEON_SS_LIGHT_SPOT_CUTOFF_ADDR 16 +#define RADEON_SS_LIGHT_SPECULAR_THRESH_ADDR 24 +#define RADEON_SS_LIGHT_RANGE_CUTOFF_ADDR 32 +#define RADEON_SS_VERT_GUARD_CLIP_ADJ_ADDR 48 +#define RADEON_SS_VERT_GUARD_DISCARD_ADJ_ADDR 49 +#define RADEON_SS_HORZ_GUARD_CLIP_ADJ_ADDR 50 +#define RADEON_SS_HORZ_GUARD_DISCARD_ADJ_ADDR 51 +#define RADEON_SS_SHININESS 60 + +#define RADEON_TV_MASTER_CNTL 0x0800 +# define RADEON_TV_ASYNC_RST (1 << 0) +# define RADEON_CRT_ASYNC_RST (1 << 1) +# define RADEON_RESTART_PHASE_FIX (1 << 3) +# define RADEON_TV_FIFO_ASYNC_RST (1 << 4) +# define RADEON_VIN_ASYNC_RST (1 << 5) +# define RADEON_AUD_ASYNC_RST (1 << 6) +# define RADEON_DVS_ASYNC_RST (1 << 7) +# define RADEON_CRT_FIFO_CE_EN (1 << 9) +# define RADEON_TV_FIFO_CE_EN (1 << 10) +# define RADEON_RE_SYNC_NOW_SEL_MASK (3 << 14) +# define RADEON_TVCLK_ALWAYS_ONb (1 << 30) +# define RADEON_TV_ON (1 << 31) +#define RADEON_TV_PRE_DAC_MUX_CNTL 0x0888 +# define RADEON_Y_RED_EN (1 << 0) +# define RADEON_C_GRN_EN (1 << 1) +# define RADEON_CMP_BLU_EN (1 << 2) +# define RADEON_DAC_DITHER_EN (1 << 3) +# define RADEON_RED_MX_FORCE_DAC_DATA (6 << 4) +# define RADEON_GRN_MX_FORCE_DAC_DATA (6 << 8) +# define RADEON_BLU_MX_FORCE_DAC_DATA (6 << 12) +# define RADEON_TV_FORCE_DAC_DATA_SHIFT 16 +#define RADEON_TV_RGB_CNTL 0x0804 +# define RADEON_SWITCH_TO_BLUE (1 << 4) +# define RADEON_RGB_DITHER_EN (1 << 5) +# define RADEON_RGB_SRC_SEL_MASK (3 << 8) +# define RADEON_RGB_SRC_SEL_CRTC1 (0 << 8) +# define RADEON_RGB_SRC_SEL_RMX (1 << 8) +# define RADEON_RGB_SRC_SEL_CRTC2 (2 << 8) +# define RADEON_RGB_CONVERT_BY_PASS (1 << 10) +# define RADEON_UVRAM_READ_MARGIN_SHIFT 16 +# define RADEON_FIFORAM_FFMACRO_READ_MARGIN_SHIFT 20 +# define RADEON_RGB_ATTEN_SEL(x) ((x) << 24) +# define RADEON_TVOUT_SCALE_EN (1 << 26) +# define RADEON_RGB_ATTEN_VAL(x) ((x) << 28) +#define RADEON_TV_SYNC_CNTL 0x0808 +# define RADEON_SYNC_OE (1 << 0) +# define RADEON_SYNC_OUT (1 << 1) +# define RADEON_SYNC_IN (1 << 2) +# define RADEON_SYNC_PUB (1 << 3) +# define RADEON_SYNC_PD (1 << 4) +# define RADEON_TV_SYNC_IO_DRIVE (1 << 5) +#define RADEON_TV_HTOTAL 0x080c +#define RADEON_TV_HDISP 0x0810 +#define RADEON_TV_HSTART 0x0818 +#define RADEON_TV_HCOUNT 0x081C +#define RADEON_TV_VTOTAL 0x0820 +#define RADEON_TV_VDISP 0x0824 +#define RADEON_TV_VCOUNT 0x0828 +#define RADEON_TV_FTOTAL 0x082c +#define RADEON_TV_FCOUNT 0x0830 +#define RADEON_TV_FRESTART 0x0834 +#define RADEON_TV_HRESTART 0x0838 +#define RADEON_TV_VRESTART 0x083c +#define RADEON_TV_HOST_READ_DATA 0x0840 +#define RADEON_TV_HOST_WRITE_DATA 0x0844 +#define RADEON_TV_HOST_RD_WT_CNTL 0x0848 +# define RADEON_HOST_FIFO_RD (1 << 12) +# define RADEON_HOST_FIFO_RD_ACK (1 << 13) +# define RADEON_HOST_FIFO_WT (1 << 14) +# define RADEON_HOST_FIFO_WT_ACK (1 << 15) +#define RADEON_TV_VSCALER_CNTL1 0x084c +# define RADEON_UV_INC_MASK 0xffff +# define RADEON_UV_INC_SHIFT 0 +# define RADEON_Y_W_EN (1 << 24) +# define RADEON_RESTART_FIELD (1 << 29) /* restart on field 0 */ +# define RADEON_Y_DEL_W_SIG_SHIFT 26 +#define RADEON_TV_TIMING_CNTL 0x0850 +# define RADEON_H_INC_MASK 0xfff +# define RADEON_H_INC_SHIFT 0 +# define RADEON_REQ_Y_FIRST (1 << 19) +# define RADEON_FORCE_BURST_ALWAYS (1 << 21) +# define RADEON_UV_POST_SCALE_BYPASS (1 << 23) +# define RADEON_UV_OUTPUT_POST_SCALE_SHIFT 24 +#define RADEON_TV_VSCALER_CNTL2 0x0854 +# define RADEON_DITHER_MODE (1 << 0) +# define RADEON_Y_OUTPUT_DITHER_EN (1 << 1) +# define RADEON_UV_OUTPUT_DITHER_EN (1 << 2) +# define RADEON_UV_TO_BUF_DITHER_EN (1 << 3) +#define RADEON_TV_Y_FALL_CNTL 0x0858 +# define RADEON_Y_FALL_PING_PONG (1 << 16) +# define RADEON_Y_COEF_EN (1 << 17) +#define RADEON_TV_Y_RISE_CNTL 0x085c +# define RADEON_Y_RISE_PING_PONG (1 << 16) +#define RADEON_TV_Y_SAW_TOOTH_CNTL 0x0860 +#define RADEON_TV_UPSAMP_AND_GAIN_CNTL 0x0864 +# define RADEON_YUPSAMP_EN (1 << 0) +# define RADEON_UVUPSAMP_EN (1 << 2) +#define RADEON_TV_GAIN_LIMIT_SETTINGS 0x0868 +# define RADEON_Y_GAIN_LIMIT_SHIFT 0 +# define RADEON_UV_GAIN_LIMIT_SHIFT 16 +#define RADEON_TV_LINEAR_GAIN_SETTINGS 0x086c +# define RADEON_Y_GAIN_SHIFT 0 +# define RADEON_UV_GAIN_SHIFT 16 +#define RADEON_TV_MODULATOR_CNTL1 0x0870 +# define RADEON_YFLT_EN (1 << 2) +# define RADEON_UVFLT_EN (1 << 3) +# define RADEON_ALT_PHASE_EN (1 << 6) +# define RADEON_SYNC_TIP_LEVEL (1 << 7) +# define RADEON_BLANK_LEVEL_SHIFT 8 +# define RADEON_SET_UP_LEVEL_SHIFT 16 +# define RADEON_SLEW_RATE_LIMIT (1 << 23) +# define RADEON_CY_FILT_BLEND_SHIFT 28 +#define RADEON_TV_MODULATOR_CNTL2 0x0874 +# define RADEON_TV_U_BURST_LEVEL_MASK 0x1ff +# define RADEON_TV_V_BURST_LEVEL_MASK 0x1ff +# define RADEON_TV_V_BURST_LEVEL_SHIFT 16 +#define RADEON_TV_CRC_CNTL 0x0890 +#define RADEON_TV_UV_ADR 0x08ac +# define RADEON_MAX_UV_ADR_MASK 0x000000ff +# define RADEON_MAX_UV_ADR_SHIFT 0 +# define RADEON_TABLE1_BOT_ADR_MASK 0x0000ff00 +# define RADEON_TABLE1_BOT_ADR_SHIFT 8 +# define RADEON_TABLE3_TOP_ADR_MASK 0x00ff0000 +# define RADEON_TABLE3_TOP_ADR_SHIFT 16 +# define RADEON_HCODE_TABLE_SEL_MASK 0x06000000 +# define RADEON_HCODE_TABLE_SEL_SHIFT 25 +# define RADEON_VCODE_TABLE_SEL_MASK 0x18000000 +# define RADEON_VCODE_TABLE_SEL_SHIFT 27 +# define RADEON_TV_MAX_FIFO_ADDR 0x1a7 +# define RADEON_TV_MAX_FIFO_ADDR_INTERNAL 0x1ff +#define RADEON_TV_PLL_FINE_CNTL 0x0020 /* PLL */ +#define RADEON_TV_PLL_CNTL 0x0021 /* PLL */ +# define RADEON_TV_M0LO_MASK 0xff +# define RADEON_TV_M0HI_MASK 0x7 +# define RADEON_TV_M0HI_SHIFT 18 +# define RADEON_TV_N0LO_MASK 0x1ff +# define RADEON_TV_N0LO_SHIFT 8 +# define RADEON_TV_N0HI_MASK 0x3 +# define RADEON_TV_N0HI_SHIFT 21 +# define RADEON_TV_P_MASK 0xf +# define RADEON_TV_P_SHIFT 24 +# define RADEON_TV_SLIP_EN (1 << 23) +# define RADEON_TV_DTO_EN (1 << 28) +#define RADEON_TV_PLL_CNTL1 0x0022 /* PLL */ +# define RADEON_TVPLL_RESET (1 << 1) +# define RADEON_TVPLL_SLEEP (1 << 3) +# define RADEON_TVPLL_REFCLK_SEL (1 << 4) +# define RADEON_TVPCP_SHIFT 8 +# define RADEON_TVPCP_MASK (7 << 8) +# define RADEON_TVPVG_SHIFT 11 +# define RADEON_TVPVG_MASK (7 << 11) +# define RADEON_TVPDC_SHIFT 14 +# define RADEON_TVPDC_MASK (3 << 14) +# define RADEON_TVPLL_TEST_DIS (1 << 31) +# define RADEON_TVCLK_SRC_SEL_TVPLL (1 << 30) + +#define RS400_DISP2_REQ_CNTL1 0xe30 +# define RS400_DISP2_START_REQ_LEVEL_SHIFT 0 +# define RS400_DISP2_START_REQ_LEVEL_MASK 0x3ff +# define RS400_DISP2_STOP_REQ_LEVEL_SHIFT 12 +# define RS400_DISP2_STOP_REQ_LEVEL_MASK 0x3ff +# define RS400_DISP2_ALLOW_FID_LEVEL_SHIFT 22 +# define RS400_DISP2_ALLOW_FID_LEVEL_MASK 0x3ff +#define RS400_DISP2_REQ_CNTL2 0xe34 +# define RS400_DISP2_CRITICAL_POINT_START_SHIFT 12 +# define RS400_DISP2_CRITICAL_POINT_START_MASK 0x3ff +# define RS400_DISP2_CRITICAL_POINT_STOP_SHIFT 22 +# define RS400_DISP2_CRITICAL_POINT_STOP_MASK 0x3ff +#define RS400_DMIF_MEM_CNTL1 0xe38 +# define RS400_DISP2_START_ADR_SHIFT 0 +# define RS400_DISP2_START_ADR_MASK 0x3ff +# define RS400_DISP1_CRITICAL_POINT_START_SHIFT 12 +# define RS400_DISP1_CRITICAL_POINT_START_MASK 0x3ff +# define RS400_DISP1_CRITICAL_POINT_STOP_SHIFT 22 +# define RS400_DISP1_CRITICAL_POINT_STOP_MASK 0x3ff +#define RS400_DISP1_REQ_CNTL1 0xe3c +# define RS400_DISP1_START_REQ_LEVEL_SHIFT 0 +# define RS400_DISP1_START_REQ_LEVEL_MASK 0x3ff +# define RS400_DISP1_STOP_REQ_LEVEL_SHIFT 12 +# define RS400_DISP1_STOP_REQ_LEVEL_MASK 0x3ff +# define RS400_DISP1_ALLOW_FID_LEVEL_SHIFT 22 +# define RS400_DISP1_ALLOW_FID_LEVEL_MASK 0x3ff + +#define RADEON_PCIE_INDEX 0x0030 +#define RADEON_PCIE_DATA 0x0034 +#define RADEON_PCIE_TX_GART_CNTL 0x10 +# define RADEON_PCIE_TX_GART_EN (1 << 0) +# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_PASS_THRU (0 << 1) +# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_CLAMP_LO (1 << 1) +# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD (3 << 1) +# define RADEON_PCIE_TX_GART_MODE_32_128_CACHE (0 << 3) +# define RADEON_PCIE_TX_GART_MODE_8_4_128_CACHE (1 << 3) +# define RADEON_PCIE_TX_GART_CHK_RW_VALID_EN (1 << 5) +# define RADEON_PCIE_TX_GART_INVALIDATE_TLB (1 << 8) +#define RADEON_PCIE_TX_DISCARD_RD_ADDR_LO 0x11 +#define RADEON_PCIE_TX_DISCARD_RD_ADDR_HI 0x12 +#define RADEON_PCIE_TX_GART_BASE 0x13 +#define RADEON_PCIE_TX_GART_START_LO 0x14 +#define RADEON_PCIE_TX_GART_START_HI 0x15 +#define RADEON_PCIE_TX_GART_END_LO 0x16 +#define RADEON_PCIE_TX_GART_END_HI 0x17 +#define RADEON_PCIE_TX_GART_ERROR 0x18 + +#define RADEON_SCRATCH_REG0 0x15e0 +#define RADEON_SCRATCH_REG1 0x15e4 +#define RADEON_SCRATCH_REG2 0x15e8 +#define RADEON_SCRATCH_REG3 0x15ec +#define RADEON_SCRATCH_REG4 0x15f0 +#define RADEON_SCRATCH_REG5 0x15f4 + +#define RV530_GB_PIPE_SELECT2 0x4124 + +#endif diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index c15d2e7a22..98f9c3393c 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -19,6 +19,7 @@ #include "lvds.h" +#include #include @@ -57,8 +58,8 @@ struct register_info { uint16 grphControl; uint16 grphSwapControl; uint16 grphPrimarySurfaceAddr; - uint16 grphPrimarySurfaceAddrHigh; uint16 grphSecondarySurfaceAddr; + uint16 grphPrimarySurfaceAddrHigh; uint16 grphSecondarySurfaceAddrHigh; uint16 grphPitch; uint16 grphSurfaceOffsetX; @@ -78,6 +79,7 @@ struct register_info { uint16 crtVBlank; uint16 crtHTotal; uint16 crtVTotal; + uint16 crtcOffset; uint16 modeDesktopHeight; uint16 modeDataFormat; uint16 modeCenter; diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 3a48eef3ee..23e3f756d6 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -22,7 +22,7 @@ * Author: Stanislaw Skowronek */ -/* Reworked for the Haiku Operating System Radeon HD driver +/* Rewritten for the Haiku Operating System Radeon HD driver * Author: * Alexander von Gluck, kallisti5@unixzen.com */ diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 8c7e2a80cb..db8df037cc 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -28,21 +28,6 @@ atom_context *gAtomContext; -void -atombios_crtc_power(uint8 crt_id, int state) -{ - int index = GetIndexIntoMasterTable(COMMAND, EnableCRTC); - ENABLE_CRTC_PS_ALLOCATION args; - - memset(&args, 0, sizeof(args)); - - args.ucCRTC = crt_id; - args.ucEnable = state; - - atom_execute_table(gAtomContext, index, (uint32*)&args); -} - - void radeon_bios_init_scratch() { @@ -115,6 +100,9 @@ radeon_init_bios(uint8* bios) return B_ERROR; } + atom_asic_init(gAtomContext); + // Post card + // mutex_init(&rdev->mode_info.atom_context->mutex); radeon_bios_init_scratch(); diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index d79eff680e..7b9263dca9 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -14,7 +14,6 @@ #include "atom.h" -void atombios_crtc_power(uint8 crt_id, int state); status_t radeon_init_bios(uint8* bios); diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 47393bbd0e..4584d9ac59 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -9,6 +9,7 @@ #include "accelerant_protos.h" #include "accelerant.h" +#include "bios.h" #include "display.h" #include @@ -56,15 +57,17 @@ init_registers(register_info* regs, uint8 crtid) regs->vgaControl = D1VGA_CONTROL; } + regs->crtcOffset = offset; + // Evergreen+ is crtoffset + register regs->grphEnable = offset + EVERGREEN_GRPH_ENABLE; regs->grphControl = offset + EVERGREEN_GRPH_CONTROL; regs->grphSwapControl = offset + EVERGREEN_GRPH_SWAP_CONTROL; + regs->grphPrimarySurfaceAddr = offset + EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS; regs->grphSecondarySurfaceAddr = offset + EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS; - regs->grphPrimarySurfaceAddrHigh = offset + EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; regs->grphSecondarySurfaceAddrHigh @@ -104,6 +107,9 @@ init_registers(register_info* regs, uint8 crtid) = crtid == 1 ? D2GRPH_SECONDARY_SURFACE_ADDRESS : D1GRPH_SECONDARY_SURFACE_ADDRESS; + regs->crtcOffset + = crtid == 1 ? (D2GRPH_X_END - D1GRPH_X_END) : 0; + // Surface Address high only used on r770+ regs->grphPrimarySurfaceAddrHigh = crtid == 1 ? R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH @@ -303,28 +309,335 @@ debug_displays() void -display_power(uint8 crtid, int command) +display_crtc_lock(uint8 crtc_id, int command) { - register_info* regs = gDisplay[crtid]->regs; + ENABLE_CRTC_PS_ALLOCATION args; + int index + = GetIndexIntoMasterTable(COMMAND, UpdateCRTC_DoubleBufferRegisters); - switch (command) { - case RHD_POWER_ON: - Write32Mask(OUT, regs->grphEnable, 0x00000001, 0x00000001); - snooze(2); - Write32Mask(OUT, regs->crtControl, 0, 0x01000000); - // Enable read requests - Write32Mask(OUT, regs->crtControl, 1, 1); - return; - case RHD_POWER_RESET: - Write32Mask(OUT, regs->crtControl, 0x01000000, 0x01000000); - // Disable read requestes - //D1CRTCDisable? - return; - case RHD_POWER_SHUTDOWN: - Write32Mask(OUT, regs->crtControl, 0x01000000, 0x01000000); - // Disable read requests - //D1CRTCDisable? - Write32Mask(OUT, regs->grphEnable, 0x00000001, 0x00000001); - return; - } + memset(&args, 0, sizeof(args)); + + args.ucCRTC = crtc_id; + args.ucEnable = command; + + atom_execute_table(gAtomContext, index, (uint32 *)&args); } + + +void +display_crtc_blank(uint8 crtc_id, int command) +{ + int index = GetIndexIntoMasterTable(COMMAND, BlankCRTC); + BLANK_CRTC_PS_ALLOCATION args; + + memset(&args, 0, sizeof(args)); + + args.ucCRTC = crtc_id; + args.ucBlanking = command; + + atom_execute_table(gAtomContext, index, (uint32 *)&args); +} + + +void +display_crtc_scale(uint8 crtc_id, display_mode *mode) +{ + ENABLE_SCALER_PS_ALLOCATION args; + int index = GetIndexIntoMasterTable(COMMAND, EnableScaler); + + memset(&args, 0, sizeof(args)); + + args.ucScaler = crtc_id; + args.ucEnable = ATOM_SCALER_EXPANSION; + + atom_execute_table(gAtomContext, index, (uint32 *)&args); +} + + +void +display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode) +{ + radeon_shared_info &info = *gInfo->shared_info; + register_info* regs = gDisplay[crtc_id]->regs; + + uint32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; + uint32 fb_format; + + uint32 bytesPerPixel; + uint32 bitsPerPixel; + + switch (mode->space) { + case B_CMAP8: + bytesPerPixel = 1; + bitsPerPixel = 8; + fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_8BPP + | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; + break; + case B_RGB15_LITTLE: + bytesPerPixel = 2; + bitsPerPixel = 15; + fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_16BPP + | AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555; + break; + case B_RGB16_LITTLE: + bytesPerPixel = 2; + bitsPerPixel = 16; + fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_16BPP + | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; + #ifdef __POWERPC__ + fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; + #endif + break; + case B_RGB24_LITTLE: + case B_RGB32_LITTLE: + default: + bytesPerPixel = 4; + bitsPerPixel = 32; + fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_32BPP + | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; + #ifdef __POWERPC__ + fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; + #endif + break; + } + + uint32 bytesPerRow = mode->virtual_width * bytesPerPixel; + + Write32(OUT, regs->vgaControl, 0); + + uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; + + Write32(OUT, regs->grphPrimarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); + Write32(OUT, regs->grphSecondarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); + + if (info.device_chipset >= (RADEON_R700 | 0x70)) { + Write32(OUT, regs->grphPrimarySurfaceAddrHigh, + (fbAddressInt >> 32) & 0xf); + Write32(OUT, regs->grphSecondarySurfaceAddrHigh, + (fbAddressInt >> 32) & 0xf); + } + + if (info.device_chipset >= RADEON_R600) + Write32(CRT, regs->grphSwapControl, fb_swap); + + Write32(CRT, regs->grphSurfaceOffsetX, 0); + Write32(CRT, regs->grphSurfaceOffsetY, 0); + Write32(CRT, regs->grphXStart, 0); + Write32(CRT, regs->grphYStart, 0); + Write32(CRT, regs->grphXEnd, mode->virtual_width); + Write32(CRT, regs->grphYEnd, mode->virtual_height); + Write32(CRT, regs->grphPitch, bytesPerRow / 4); + + Write32(CRT, regs->grphEnable, 1); + // Enable Frame buffer + + Write32(CRT, regs->modeDesktopHeight, mode->virtual_height); + + Write32(CRT, regs->viewportStart, 0); + + Write32(CRT, regs->viewportSize, + mode->timing.v_display | (mode->timing.h_display << 16)); + + uint32 tmp = Read32(CRT, AVIVO_D1GRPH_FLIP_CONTROL + regs->crtcOffset); + tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; + Write32(OUT, AVIVO_D1GRPH_FLIP_CONTROL + regs->crtcOffset, tmp); + + Write32(OUT, AVIVO_D1MODE_MASTER_UPDATE_MODE + regs->crtcOffset, 0); + // Pageflip to happen anywhere in vblank +} + + +void +display_crtc_fb_set_legacy(uint8 crtc_id, display_mode *mode) +{ + register_info* regs = gDisplay[crtc_id]->regs; + + uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; + + Write32(CRT, regs->grphUpdate, (1<<16)); + // Lock for update (isn't this normally the other way around on VGA? + + Write32Mask(CRT, regs->grphEnable, 1, 0x00000001); + // Enable Frame buffer + + Write32(CRT, regs->grphControl, 0); + // Reset stored depth, format, etc + + uint32 bytesPerPixel; + uint32 bitsPerPixel; + + // set color mode on video card + switch (mode->space) { + case B_CMAP8: + bytesPerPixel = 1; + bitsPerPixel = 8; + Write32Mask(CRT, regs->grphControl, + 0, 0x00000703); + break; + case B_RGB15_LITTLE: + bytesPerPixel = 2; + bitsPerPixel = 15; + Write32Mask(CRT, regs->grphControl, + 0x000001, 0x00000703); + break; + case B_RGB16_LITTLE: + bytesPerPixel = 2; + bitsPerPixel = 16; + Write32Mask(CRT, regs->grphControl, + 0x000101, 0x00000703); + break; + case B_RGB24_LITTLE: + bytesPerPixel = 4; + bitsPerPixel = 24; + Write32Mask(CRT, regs->grphControl, + 0x000002, 0x00000703); + break; + case B_RGB32_LITTLE: + default: + bytesPerPixel = 4; + bitsPerPixel = 32; + Write32Mask(CRT, regs->grphControl, + 0x000002, 0x00000703); + break; + } + + uint32 bytesPerRow = mode->virtual_width * bytesPerPixel; + + Write32(CRT, regs->grphSwapControl, 0); + // only for chipsets > r600 + + // Tell GPU which frame buffer address to draw from + Write32(CRT, regs->grphPrimarySurfaceAddr, fbAddressInt & 0xFFFFFFFF); + Write32(CRT, regs->grphSecondarySurfaceAddr, fbAddressInt & 0xFFFFFFFF); + + Write32(CRT, regs->grphSurfaceOffsetX, 0); + Write32(CRT, regs->grphSurfaceOffsetY, 0); + Write32(CRT, regs->grphXStart, 0); + Write32(CRT, regs->grphYStart, 0); + Write32(CRT, regs->grphXEnd, mode->virtual_width); + Write32(CRT, regs->grphYEnd, mode->virtual_height); + Write32(CRT, regs->grphPitch, bytesPerRow / 4); + + Write32(CRT, regs->modeDesktopHeight, mode->virtual_height); + + Write32(CRT, regs->grphUpdate, 0); + // Unlock changed registers + + // update shared info + gInfo->shared_info->bytes_per_row = bytesPerRow; + gInfo->shared_info->current_mode = *mode; + gInfo->shared_info->bits_per_pixel = bitsPerPixel; + + // TODO : recompute bandwidth via rv515_bandwidth_avivo_update +} + + +void +display_crtc_set(uint8 crtc_id, display_mode *mode) +{ + display_timing& displayTiming = mode->timing; + + TRACE("%s called to do %dx%d\n", + __func__, displayTiming.h_display, displayTiming.v_display); + + SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION args; + int index = GetIndexIntoMasterTable(COMMAND, SetCRTC_Timing); + uint16 misc = 0; + + memset(&args, 0, sizeof(args)); + + args.usH_Total = B_HOST_TO_LENDIAN_INT16(displayTiming.h_total); + args.usH_Disp = B_HOST_TO_LENDIAN_INT16(displayTiming.h_display); + args.usH_SyncStart = B_HOST_TO_LENDIAN_INT16(displayTiming.h_sync_start); + args.usH_SyncWidth = B_HOST_TO_LENDIAN_INT16(displayTiming.h_sync_end + - displayTiming.h_sync_start); + + args.usV_Total = B_HOST_TO_LENDIAN_INT16(displayTiming.v_total); + args.usV_Disp = B_HOST_TO_LENDIAN_INT16(displayTiming.v_display); + args.usV_SyncStart = B_HOST_TO_LENDIAN_INT16(displayTiming.v_sync_start); + args.usV_SyncWidth = B_HOST_TO_LENDIAN_INT16(displayTiming.v_sync_end + - displayTiming.v_sync_start); + + args.ucOverscanRight = 0; + args.ucOverscanLeft = 0; + args.ucOverscanBottom = 0; + args.ucOverscanTop = 0; + + if ((displayTiming.flags & B_POSITIVE_HSYNC) == 0) + misc |= ATOM_HSYNC_POLARITY; + if ((displayTiming.flags & B_POSITIVE_VSYNC) == 0) + misc |= ATOM_VSYNC_POLARITY; + + args.susModeMiscInfo.usAccess = B_HOST_TO_LENDIAN_INT16(misc); + args.ucCRTC = crtc_id; + + atom_execute_table(gAtomContext, index, (uint32 *)&args); +} + + +void +display_crtc_set_dtd(uint8 crtc_id, display_mode *mode) +{ + display_timing& displayTiming = mode->timing; + + TRACE("%s called to do %dx%d\n", + __func__, displayTiming.h_display, displayTiming.v_display); + + SET_CRTC_USING_DTD_TIMING_PARAMETERS args; + int index = GetIndexIntoMasterTable(COMMAND, SetCRTC_UsingDTDTiming); + uint16 misc = 0; + + memset(&args, 0, sizeof(args)); + + uint16 blankStart + = MIN(displayTiming.h_sync_start, displayTiming.h_display); + uint16 blankEnd + = MAX(displayTiming.h_sync_end, displayTiming.h_total); + args.usH_Size = B_HOST_TO_LENDIAN_INT16(displayTiming.h_display); + args.usH_Blanking_Time = B_HOST_TO_LENDIAN_INT16(blankEnd - blankStart); + + blankStart = MIN(displayTiming.v_sync_start, displayTiming.v_display); + blankEnd = MAX(displayTiming.v_sync_end, displayTiming.v_total); + args.usV_Size = B_HOST_TO_LENDIAN_INT16(displayTiming.v_display); + args.usV_Blanking_Time = B_HOST_TO_LENDIAN_INT16(blankEnd - blankStart); + + args.usH_SyncOffset = B_HOST_TO_LENDIAN_INT16(displayTiming.h_sync_start + - displayTiming.h_display); + args.usH_SyncWidth = B_HOST_TO_LENDIAN_INT16(displayTiming.h_sync_end + - displayTiming.h_sync_start); + + args.usV_SyncOffset = B_HOST_TO_LENDIAN_INT16(displayTiming.v_sync_start + - displayTiming.v_display); + args.usV_SyncWidth = B_HOST_TO_LENDIAN_INT16(displayTiming.v_sync_end + - displayTiming.v_sync_start); + + args.ucH_Border = 0; + args.ucV_Border = 0; + + if ((displayTiming.flags & B_POSITIVE_HSYNC) == 0) + misc |= ATOM_HSYNC_POLARITY; + if ((displayTiming.flags & B_POSITIVE_VSYNC) == 0) + misc |= ATOM_VSYNC_POLARITY; + + args.susModeMiscInfo.usAccess = B_HOST_TO_LENDIAN_INT16(misc); + args.ucCRTC = crtc_id; + + atom_execute_table(gAtomContext, index, (uint32 *)&args); +} + + +void +display_crtc_power(uint8 crt_id, int command) +{ + int index = GetIndexIntoMasterTable(COMMAND, EnableCRTC); + ENABLE_CRTC_PS_ALLOCATION args; + + memset(&args, 0, sizeof(args)); + + args.ucCRTC = crt_id; + args.ucEnable = command; + + atom_execute_table(gAtomContext, index, (uint32*)&args); +} + + diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 20286bfc82..5362d042a8 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -13,7 +13,15 @@ status_t init_registers(register_info* reg, uint8 crtid); status_t detect_crt_ranges(uint32 crtid); status_t detect_displays(); void debug_displays(); -void display_power(uint8 crtid, int command); + +void display_crtc_lock(uint8 crtc_id, int command); +void display_crtc_blank(uint8 crtc_id, int command); +void display_crtc_scale(uint8 crtc_id, display_mode *mode); +void display_crtc_fb_set_legacy(uint8 crtc_id, display_mode *mode); +void display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode); +void display_crtc_set(uint8 crtc_id, display_mode *mode); +void display_crtc_set_dtd(uint8 crtc_id, display_mode *mode); +void display_crtc_power(uint8 crt_id, int command); #endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 9d33838003..e3a84bc97e 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -92,275 +92,34 @@ radeon_get_edid_info(void* info, size_t size, uint32* edid_version) } -static void -get_color_space_format(const display_mode &mode, uint32 &colorMode, - uint32 &bytesPerRow, uint32 &bitsPerPixel) -{ - uint32 bytesPerPixel; - - switch (mode.space) { - case B_RGB32_LITTLE: - colorMode = DISPLAY_CONTROL_RGB32; - bytesPerPixel = 4; - bitsPerPixel = 32; - break; - case B_RGB16_LITTLE: - colorMode = DISPLAY_CONTROL_RGB16; - bytesPerPixel = 2; - bitsPerPixel = 16; - break; - case B_RGB15_LITTLE: - colorMode = DISPLAY_CONTROL_RGB15; - bytesPerPixel = 2; - bitsPerPixel = 15; - break; - case B_CMAP8: - default: - colorMode = DISPLAY_CONTROL_CMAP8; - bytesPerPixel = 1; - bitsPerPixel = 8; - break; - } - - bytesPerRow = mode.virtual_width * bytesPerPixel; -} - - -// Blacks the screen out, useful for mode setting -static void -CardBlankSet(uint8 crtid, bool blank) -{ - int blackColorReg - = crtid == 1 ? D2CRTC_BLACK_COLOR : D1CRTC_BLACK_COLOR; - int blankControlReg - = crtid == 1 ? D2CRTC_BLANK_CONTROL : D1CRTC_BLANK_CONTROL; - - Write32(CRT, blackColorReg, 0); - Write32Mask(CRT, blankControlReg, blank ? 1 << 8 : 0, 1 << 8); -} - - -static void -CardFBSet(uint8 crtid, display_mode *mode) -{ - register_info* regs = gDisplay[crtid]->regs; - - uint32 colorMode; - uint32 bytesPerRow; - uint32 bitsPerPixel; - - get_color_space_format(*mode, colorMode, bytesPerRow, bitsPerPixel); - - LVDSAllIdle(); - // DVI / HDMI / LCD - TMDSAllIdle(); - // DVI / HDMI - DACAllIdle(); - // VGA - - // framebuffersize = w * h * bpp = fb bits / 8 = bytes needed - uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; - - MCFBSetup(); - - Write32(CRT, regs->grphUpdate, (1<<16)); - // Lock for update (isn't this normally the other way around on VGA? - - // Tell GPU which frame buffer address to draw from - Write32(CRT, regs->grphPrimarySurfaceAddr, fbAddressInt & 0xFFFFFFFF); - //Write32(CRT, regs->grphSecondarySurfaceAddr, fbAddressInt); - - if (gInfo->shared_info->device_chipset >= (RADEON_R700 | 0x70)) { - Write32(CRT, regs->grphPrimarySurfaceAddrHigh, - (fbAddressInt >> 32) & 0xf); - Write32(CRT, regs->grphSecondarySurfaceAddrHigh, - (fbAddressInt >> 32) & 0xf); - } - - Write32(CRT, regs->grphControl, 0); - // Reset stored depth, format, etc - - // set color mode on video card - switch (mode->space) { - case B_CMAP8: - Write32Mask(CRT, regs->grphControl, - 0, 0x00000703); - break; - case B_RGB15_LITTLE: - Write32Mask(CRT, regs->grphControl, - 0x000001, 0x00000703); - break; - case B_RGB16_LITTLE: - Write32Mask(CRT, regs->grphControl, - 0x000101, 0x00000703); - break; - case B_RGB24_LITTLE: - case B_RGB32_LITTLE: - default: - Write32Mask(CRT, regs->grphControl, - 0x000002, 0x00000703); - break; - } - - Write32(CRT, regs->grphSwapControl, 0); - // only for chipsets > r600 - // R5xx - RS690 case is GRPH_CONTROL bit 16 - - Write32Mask(CRT, regs->grphEnable, 1, 0x00000001); - // Enable graphics - - Write32(CRT, regs->grphSurfaceOffsetX, 0); - Write32(CRT, regs->grphSurfaceOffsetY, 0); - Write32(CRT, regs->grphXStart, 0); - Write32(CRT, regs->grphYStart, 0); - Write32(CRT, regs->grphXEnd, mode->virtual_width); - Write32(CRT, regs->grphYEnd, mode->virtual_height); - Write32(CRT, regs->grphPitch, bytesPerRow / 4); - - Write32(CRT, regs->modeDesktopHeight, mode->virtual_height); - - Write32(CRT, regs->grphUpdate, 0); - // Unlock changed registers - - // update shared info - gInfo->shared_info->bytes_per_row = bytesPerRow; - gInfo->shared_info->current_mode = *mode; - gInfo->shared_info->bits_per_pixel = bitsPerPixel; -} - - -static void -CardModeSet(uint8 crtid, display_mode *mode) -{ - display_timing& displayTiming = mode->timing; - register_info* regs = gDisplay[crtid]->regs; - - TRACE("%s called to do %dx%d\n", - __func__, displayTiming.h_display, displayTiming.v_display); - - // enable read requests - Write32Mask(CRT, regs->grphControl, 0, 0x01000000); - - // *** Horizontal - Write32(CRT, regs->crtHTotal, - displayTiming.h_total - 1); - - /* - // Blanking - uint16 blankStart = displayTiming.h_total - + displayTiming.h_display - displayTiming.h_sync_start; - uint16 blankEnd = displayTiming.h_total - displayTiming.h_sync_start; - - Write32(CRT, regs->crtHBlank, - blankStart | (blankEnd << 16)); - */ - - Write32(CRT, regs->crtHSync, - (displayTiming.h_sync_end - displayTiming.h_sync_start) << 16); - - // set flag for neg. H sync. M76 Register Reference Guide 2-256 - Write32Mask(CRT, regs->crtHPolarity, - displayTiming.flags & B_POSITIVE_HSYNC ? 0 : 1, 0x1); - - // *** Vertical - Write32(CRT, regs->crtVTotal, - displayTiming.v_total - 1); - - /* - // Blanking - blankStart = displayTiming.v_total - + displayTiming.v_display - displayTiming.v_sync_start; - blankEnd = displayTiming.v_total - displayTiming.v_sync_start; - - Write32(CRT, regs->crtVBlank, - blankStart | (blankEnd << 16)); - */ - - // Set Interlace if specified within mode line - if (displayTiming.flags & B_TIMING_INTERLACED) { - Write32(CRT, regs->crtInterlace, 0x1); - Write32(CRT, regs->modeDataFormat, 0x1); - } else { - Write32(CRT, regs->crtInterlace, 0x0); - Write32(CRT, regs->modeDataFormat, 0x0); - } - - Write32(CRT, regs->crtVSync, - (displayTiming.v_sync_end - displayTiming.v_sync_start) << 16); - - // set flag for neg. V sync. M76 Register Reference Guide 2-258 - Write32Mask(CRT, regs->crtVPolarity, - displayTiming.flags & B_POSITIVE_VSYNC ? 0 : 1, 0x1); - - // TODO : for now fixed non-interlace - Write32(OUT, D1CRTC_INTERLACE_CONTROL, 0x0); - Write32(OUT, D1MODE_DATA_FORMAT, 0x0); - - /* set D1CRTC_HORZ_COUNT_BY2_EN to 0; - should only be set to 1 on 30bpp DVI modes - */ - Write32Mask(CRT, regs->crtCountControl, 0x0, 0x1); -} - - -static void -CardModeScale(uint8 crtid, display_mode *mode) -{ - register_info* regs = gDisplay[crtid]->regs; - - // No scaling - - #if 0 - Write32(CRT, D1MODE_EXT_OVERSCAN_LEFT_RIGHT, - (OVERSCAN << 16) | OVERSCAN); // LEFT | RIGHT - Write32(CRT, D1MODE_EXT_OVERSCAN_TOP_BOTTOM, - (OVERSCAN << 16) | OVERSCAN); // TOP | BOTTOM - #endif - - Write32(CRT, regs->viewportStart, 0); - Write32(CRT, regs->viewportSize, - mode->timing.v_display | (mode->timing.h_display << 16)); - - Write32(CRT, regs->sclEnable, 0); - Write32(CRT, regs->sclTapControl, 0); - Write32(CRT, regs->modeCenter, 2); -} - - status_t radeon_set_display_mode(display_mode *mode) { - // Disable VGA (boo, hiss) - Write32Mask(OUT, VGA_RENDER_CONTROL, 0, 0x00030000); - Write32Mask(OUT, VGA_MODE_CONTROL, 0, 0x00000030); - Write32Mask(OUT, VGA_HDP_CONTROL, 0x00010010, 0x00010010); - Write32(OUT, D1VGA_CONTROL, 0); - Write32(OUT, D2VGA_CONTROL, 0); - // TODO : We set the same VESA EDID mode on each display // Set mode on each display for (uint8 id = 0; id < MAX_DISPLAY; id++) { + display_crtc_lock(id, ATOM_ENABLE); // Skip if display is inactive if (gDisplay[id]->active == false) { - CardBlankSet(id, true); - // LEGACY : display_power(id, RHD_POWER_SHUTDOWN); - atombios_crtc_power(id, ATOM_DISABLE); + display_crtc_blank(id, ATOM_ENABLE); + display_crtc_power(id, ATOM_DISABLE); + display_crtc_lock(id, ATOM_DISABLE); continue; } - // Program CRT Controller - CardFBSet(id, mode); - CardModeSet(id, mode); - CardModeScale(id, mode); + //pll_set(gDisplay[id]->connection_id, + // mode->timing.pixel_clock, id); - // LEGACY : display_power(id, RHD_POWER_RESET); + // Program CRT Controller + display_crtc_set_dtd(id, mode); + //display_crtc_fb_set_dce1(id, mode); + display_crtc_fb_set_legacy(id, mode); + display_crtc_scale(id, mode); // Program connector controllers switch (gDisplay[id]->connection_type) { case CONNECTION_DAC: - PLLSet(gDisplay[id]->connection_id, - mode->timing.pixel_clock); DACSet(gDisplay[id]->connection_id, id); break; case CONNECTION_TMDS: @@ -372,14 +131,14 @@ radeon_set_display_mode(display_mode *mode) } // Power CRT Controller - // LEGACY : display_power(id, RHD_POWER_ON); - atombios_crtc_power(id, ATOM_ENABLE); - CardBlankSet(id, false); + display_crtc_blank(id, ATOM_DISABLE); + display_crtc_power(id, ATOM_ENABLE); + + PLLPower(gDisplay[id]->connection_id, RHD_POWER_ON); // Power connector controllers switch (gDisplay[id]->connection_type) { case CONNECTION_DAC: - PLLPower(gDisplay[id]->connection_id, RHD_POWER_ON); DACPower(gDisplay[id]->connection_id, RHD_POWER_ON); break; case CONNECTION_TMDS: @@ -389,6 +148,9 @@ radeon_set_display_mode(display_mode *mode) LVDSPower(gDisplay[id]->connection_id, RHD_POWER_ON); break; } + + display_crtc_lock(id, ATOM_DISABLE); + // commit } int32 crtstatus = Read32(CRT, D1CRTC_STATUS); diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 9e08b40e47..6f2c1c3b5c 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -9,6 +9,7 @@ #include "accelerant_protos.h" #include "accelerant.h" +#include "bios.h" #include "utility.h" #include "pll.h" @@ -27,6 +28,17 @@ extern "C" void _sPrintf(const char *format, ...); #endif +// For AtomBIOS PLLSet +union set_pixel_clock { + SET_PIXEL_CLOCK_PS_ALLOCATION base; + PIXEL_CLOCK_PARAMETERS v1; + PIXEL_CLOCK_PARAMETERS_V2 v2; + PIXEL_CLOCK_PARAMETERS_V3 v3; + PIXEL_CLOCK_PARAMETERS_V5 v5; + PIXEL_CLOCK_PARAMETERS_V6 v6; +}; + + /* From hardcoded values. */ static struct PLL_Control RV610PLLControl[] = { @@ -221,16 +233,70 @@ PLLPower(uint8 pllIndex, int command) status_t -PLLSet(uint8 pllIndex, uint32 pixelClock) +pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) { - radeon_shared_info &info = *gInfo->shared_info; - uint16 reference = 0; uint16 feedback = 0; uint16 post = 0; PLLCalculate(pixelClock, &reference, &feedback, &post); + int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); + union set_pixel_clock args; + memset(&args, 0, sizeof(args)); + + //uint8 frev; + //uint8 crev; + //atom_parse_cmd_header(gAtomContext, index, &frev, &crev); + + uint8 frev = 1; + uint8 crev = 1; + + switch (crev) { + case 1: + args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); + args.v1.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); + // args.v1.ucFracFbDiv = frac_fb_div; + args.v1.ucFracFbDiv = 0; + args.v1.ucPostDiv = post; + args.v1.ucPpll = pll_id; + args.v1.ucCRTC = crtc_id; + args.v1.ucRefDivSrc = 1; + break; + case 2: + args.v2.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v2.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); + args.v2.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); + // args.v2.ucFracFbDiv = frac_fb_div; + args.v2.ucPostDiv = post; + args.v2.ucPpll = pll_id; + args.v2.ucCRTC = crtc_id; + args.v2.ucRefDivSrc = 1; + break; + #if 0 + case 3: + args.v3.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v3.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); + args.v3.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); + // args.v3.ucFracFbDiv = frac_fb_div; + args.v3.ucPostDiv = post; + args.v3.ucPpll = pll_id; + args.v3.ucMiscInfo = (pll_id << 2); + if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) + args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; + args.v3.ucTransmitterId = encoder_id; + args.v3.ucEncoderMode = encoder_mode; + break; + #endif + default: + TRACE("%s: TODO: table version %d %d\n", __func__, frev, crev); + return B_ERROR; + } + + atom_execute_table(gAtomContext, index, (uint32 *)&args); + + #if 0 if (info.device_chipset >= (RADEON_R600 | 0x20)) { TRACE("%s : setting pixel clock %d on r620+\n", __func__, (int)pixelClock); @@ -242,6 +308,7 @@ PLLSet(uint8 pllIndex, uint32 pixelClock) PLLSetLowLegacy(pllIndex, pixelClock, reference, feedback, post); } + #endif return B_OK; } @@ -617,4 +684,3 @@ DCCGCLKSet(uint8 pllIndex, int set) break; } } - diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index 5733e2b004..8817994911 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -35,7 +35,7 @@ struct PLL_Control { status_t PLLCalculate(uint32 pixelClock, uint16 *reference, uint16 *feedback, uint16 *post); -status_t PLLSet(uint8 pllIndex, uint32 pixelClock); +status_t pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id); void PLLSetLowLegacy(uint8 pllIndex, uint32 pixelClock, uint16 reference, uint16 feedback, uint16 post); void PLLSetLowR620(uint8 pllIndex, uint32 pixelClock, uint16 reference, From 7eb6bbc78c1d608f4e6f8574bf219d05506b8ccf Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 6 Aug 2011 04:39:47 +0000 Subject: [PATCH 131/702] * style cleanup * add some missing functions from drm version git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42583 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 237 +++++++++--------- .../accelerants/radeon_hd/atombios/atom.h | 2 + 2 files changed, 123 insertions(+), 116 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 23e3f756d6..d2084fb190 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -102,38 +102,38 @@ atom_iio_execute(atom_context *ctx, int base, uint32 index, uint32 data) base++; break; case ATOM_IIO_READ: - temp = ctx->card->reg_read(CU16(base + 1)); - base+=3; + temp = ctx->card->ioreg_read(CU16(base + 1)); + base += 3; break; case ATOM_IIO_WRITE: - ctx->card->reg_write(CU16(base + 1), temp); - base+=3; + ctx->card->ioreg_write(CU16(base + 1), temp); + base += 3; break; case ATOM_IIO_CLEAR: temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); - base+=3; + base += 3; break; case ATOM_IIO_SET: temp |= (0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2); - base+=3; + base += 3; break; case ATOM_IIO_MOVE_INDEX: temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); temp |= ((index >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); - base+=4; + base += 4; break; case ATOM_IIO_MOVE_DATA: temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); temp |= ((data >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); - base+=4; + base += 4; break; case ATOM_IIO_MOVE_ATTR: temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); temp |= ((ctx->io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); - base+=4; + base += 4; break; case ATOM_IIO_END: return temp; @@ -153,115 +153,120 @@ atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, arg = attr & 7; align = (attr >> 3) & 7; switch(arg) { - case ATOM_ARG_REG: - idx = U16(*ptr); - (*ptr)+=2; - idx += gctx->reg_block; - switch(gctx->io_mode) { - case ATOM_IO_MM: - val = gctx->card->reg_read(idx); - break; - case ATOM_IO_PCI: - TRACE("%s: PCI registers are not implemented.\n", __func__); - return 0; - case ATOM_IO_SYSIO: - TRACE("%s: SYSIO registers are not implemented.\n", __func__); - return 0; - default: - if (!(gctx->io_mode&0x80)) { - TRACE("%s: Bad IO mode.\n", __func__); - return 0; - } - if (!gctx->iio[gctx->io_mode&0x7F]) { - TRACE("%s: Undefined indirect IO read method %d.\n", __func__, - gctx->io_mode&0x7F); - return 0; - } - val = atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0x7F], idx, 0); - } - break; - case ATOM_ARG_PS: - idx = U8(*ptr); - (*ptr)++; - val = ctx->ps[idx]; - break; - case ATOM_ARG_WS: - idx = U8(*ptr); - (*ptr)++; - switch(idx) { - case ATOM_WS_QUOTIENT: - val = gctx->divmul[0]; - break; - case ATOM_WS_REMAINDER: - val = gctx->divmul[1]; - break; - case ATOM_WS_DATAPTR: - val = gctx->data_block; - break; - case ATOM_WS_SHIFT: - val = gctx->shift; - break; - case ATOM_WS_OR_MASK: - val = 1<shift; - break; - case ATOM_WS_AND_MASK: - val = ~(1<shift); - break; - case ATOM_WS_FB_WINDOW: - val = gctx->fb_base; - break; - case ATOM_WS_ATTRIBUTES: - val = gctx->io_attr; - break; - default: - val = ctx->ws[idx]; - } - break; - case ATOM_ARG_ID: - idx = U16(*ptr); - (*ptr)+=2; - val = U32(idx + gctx->data_block); - break; - case ATOM_ARG_FB: - idx = U8(*ptr); - (*ptr)++; - TRACE("%s: FB access is not implemented.\n", __func__); - return 0; - case ATOM_ARG_IMM: - switch(align) { - case ATOM_SRC_DWORD: - val = U32(*ptr); - (*ptr)+=4; - return val; - case ATOM_SRC_WORD0: - case ATOM_SRC_WORD8: - case ATOM_SRC_WORD16: - val = U16(*ptr); - (*ptr)+=2; - return val; - case ATOM_SRC_BYTE0: - case ATOM_SRC_BYTE8: - case ATOM_SRC_BYTE16: - case ATOM_SRC_BYTE24: - val = U8(*ptr); - (*ptr)++; - return val; - } - return 0; - case ATOM_ARG_PLL: - idx = U8(*ptr); - (*ptr)++; - gctx->card->reg_write(PLL_INDEX, idx); - val = gctx->card->reg_read(PLL_DATA); - break; - case ATOM_ARG_MC: - idx = U8(*ptr); - (*ptr)++; - TRACE("%s: MC registers are not implemented.\n", __func__); - return 0; + case ATOM_ARG_REG: + idx = U16(*ptr); + (*ptr)+=2; + idx += gctx->reg_block; + switch(gctx->io_mode) { + case ATOM_IO_MM: + val = gctx->card->reg_read(idx); + break; + case ATOM_IO_PCI: + TRACE("%s: PCI registers are not implemented.\n", __func__); + return 0; + case ATOM_IO_SYSIO: + TRACE("%s: SYSIO registers are not implemented.\n", + __func__); + return 0; + default: + if (!(gctx->io_mode & 0x80)) { + TRACE("%s: Bad IO mode.\n", __func__); + return 0; + } + if (!gctx->iio[gctx->io_mode & 0x7F]) { + TRACE("%s: Undefined indirect IO read method %d.\n", + __func__, gctx->io_mode & 0x7F); + return 0; + } + val = atom_iio_execute(gctx, + gctx->iio[gctx->io_mode & 0x7F], idx, 0); + } + break; + case ATOM_ARG_PS: + idx = U8(*ptr); + (*ptr)++; + val = ctx->ps[idx]; + // TODO : val = get_unaligned_le32((u32 *)&ctx->ps[idx]); + break; + case ATOM_ARG_WS: + idx = U8(*ptr); + (*ptr)++; + switch(idx) { + case ATOM_WS_QUOTIENT: + val = gctx->divmul[0]; + break; + case ATOM_WS_REMAINDER: + val = gctx->divmul[1]; + break; + case ATOM_WS_DATAPTR: + val = gctx->data_block; + break; + case ATOM_WS_SHIFT: + val = gctx->shift; + break; + case ATOM_WS_OR_MASK: + val = 1 << gctx->shift; + break; + case ATOM_WS_AND_MASK: + val = ~(1 << gctx->shift); + break; + case ATOM_WS_FB_WINDOW: + val = gctx->fb_base; + break; + case ATOM_WS_ATTRIBUTES: + val = gctx->io_attr; + break; + case ATOM_WS_REGPTR: + val = gctx->reg_block; + break; + default: + val = ctx->ws[idx]; + } + break; + case ATOM_ARG_ID: + idx = U16(*ptr); + (*ptr) += 2; + val = U32(idx + gctx->data_block); + break; + case ATOM_ARG_FB: + idx = U8(*ptr); + (*ptr)++; + val = gctx->scratch[((gctx->fb_base + idx) / 4)]; + return 0; + case ATOM_ARG_IMM: + switch(align) { + case ATOM_SRC_DWORD: + val = U32(*ptr); + (*ptr)+=4; + return val; + case ATOM_SRC_WORD0: + case ATOM_SRC_WORD8: + case ATOM_SRC_WORD16: + val = U16(*ptr); + (*ptr) += 2; + return val; + case ATOM_SRC_BYTE0: + case ATOM_SRC_BYTE8: + case ATOM_SRC_BYTE16: + case ATOM_SRC_BYTE24: + val = U8(*ptr); + (*ptr)++; + return val; + } + return 0; + case ATOM_ARG_PLL: + idx = U8(*ptr); + (*ptr)++; + val = gctx->card->pll_read(idx); + break; + case ATOM_ARG_MC: + idx = U8(*ptr); + (*ptr)++; + val = gctx->card->mc_read(idx); + return 0; } if (saved) - *saved = val; + *saved = val; val &= atom_arg_mask[align]; val >>= atom_arg_shift[align]; return val; diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 34d47279be..6445075bd0 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -107,6 +107,7 @@ struct card_info { #define ATOM_WS_AND_MASK 0x45 #define ATOM_WS_FB_WINDOW 0x46 #define ATOM_WS_ATTRIBUTES 0x47 +#define ATOM_WS_REGPTR 0x48 #define ATOM_IIO_NOP 0 #define ATOM_IIO_START 1 @@ -138,6 +139,7 @@ typedef struct atom_context_s { uint8 shift; int cs_equal, cs_above; int io_mode; + uint32 *scratch; } atom_context; extern int atom_debug; From 3bb6075b59ed976f5ae7cd5d88d8b57d465b8fc9 Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Sat, 6 Aug 2011 05:51:37 +0000 Subject: [PATCH 132/702] Removed accidentally inserted white spaces. Thanks taos. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42584 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/apps/aboutsystem/de.catkeys | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/catalogs/apps/aboutsystem/de.catkeys b/data/catalogs/apps/aboutsystem/de.catkeys index 81f1807822..f165327651 100644 --- a/data/catalogs/apps/aboutsystem/de.catkeys +++ b/data/catalogs/apps/aboutsystem/de.catkeys @@ -71,7 +71,7 @@ The BeGeistert team\n AboutView Das BeGeistert-Team\n The Haiku-Ports team\n AboutView Das Haiku-Ports-Team\n The Haikuware team and their bounty program\n AboutView Das Haikuware-Team und deren Bounty-Programm\n The University of Auckland and Christof Lutteroth\n\n AboutView Die Universität von Auckland und Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Der von Haiku selbst erstellte Quellcode, besonders der Kernel und alle Teile des Codes, gegen den Anwendungen gelinkt werden können, wird unter den Bedingungen der %MIT Lizenz% veröffentlicht. Einige Systembibliotheken, die Code von Dritten enthalten, stehen unter der LGPL Lizenz. Angaben zum Copyright von externen Quellen sind unten aufgeführt.\n\n +The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Der von Haiku selbst erstellte Quellcode, besonders der Kernel und alle Teile des Codes, gegen den Anwendungen gelinkt werden können, wird unter den Bedingungen der %MIT Lizenz% veröffentlicht. Einige Systembibliotheken, die Code von Dritten enthalten, stehen unter der LGPL Lizenz. Angaben zum Copyright von externen Quellen sind unten aufgeführt.\n\n The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Die Urheberrechte am Haiku-Code liegen bei Haiku, Inc., beziehungsweise bei den entsprechenden Autoren, die explizit im Quelltext aufgeführt sind. Haiku™ und das HAIKU Logo® sind (registrierte) Marken von Haiku, Inc.\n\n Time running: AboutView Laufzeit: Translations:\n AboutView Übersetzungen:\n From 81e071b76e191a140fe6a79f12d344aed8ba636e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 6 Aug 2011 07:00:49 +0000 Subject: [PATCH 133/702] * more style cleanup * backport additional bugfixes from drm version * add logic to detect infinite execution loops * add a semephore to prevent multiple executions on non-thread safe code ( this needs testing ) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42585 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../radeon_hd/atombios/atom-names.h | 17 +- .../accelerants/radeon_hd/atombios/atom.cpp | 529 +++++++++++------- .../accelerants/radeon_hd/atombios/atom.h | 4 +- src/add-ons/accelerants/radeon_hd/bios.cpp | 8 +- 4 files changed, 350 insertions(+), 208 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom-names.h b/src/add-ons/accelerants/radeon_hd/atombios/atom-names.h index 2cdc170b32..fdc0b547de 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom-names.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom-names.h @@ -1,5 +1,5 @@ /* - * Copyright 2008 Advanced Micro Devices, Inc. + * Copyright 2008 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,10 +27,8 @@ #include "atom.h" -#ifdef ATOM_DEBUG - #define ATOM_OP_NAMES_CNT 123 -static char *atom_op_names[ATOM_OP_NAMES_CNT]={ +const char *atom_op_names[ATOM_OP_NAMES_CNT] = { "RESERVED", "MOVE_REG", "MOVE_PS", "MOVE_WS", "MOVE_FB", "MOVE_PLL", "MOVE_MC", "AND_REG", "AND_PS", "AND_WS", "AND_FB", "AND_PLL", "AND_MC", "OR_REG", "OR_PS", "OR_WS", "OR_FB", "OR_PLL", "OR_MC", "SHIFT_LEFT_REG", @@ -56,7 +54,7 @@ static char *atom_op_names[ATOM_OP_NAMES_CNT]={ }; #define ATOM_TABLE_NAMES_CNT 74 -static char *atom_table_names[ATOM_TABLE_NAMES_CNT]={ +const char *atom_table_names[ATOM_TABLE_NAMES_CNT] = { "ASIC_Init", "GetDisplaySurfaceSize", "ASIC_RegistersInit", "VRAM_BlockVenderDetection", "SetClocksRatio", "MemoryControllerInit", "GPIO_PinInit", "MemoryParamAdjust", "DVOEncoderControl", @@ -85,16 +83,9 @@ static char *atom_table_names[ATOM_TABLE_NAMES_CNT]={ }; #define ATOM_IO_NAMES_CNT 5 -static char *atom_io_names[ATOM_IO_NAMES_CNT]={ +const char *atom_io_names[ATOM_IO_NAMES_CNT] = { "MM", "PLL", "MC", "PCIE", "PCIE PORT", }; -#else - -#define ATOM_OP_NAMES_CNT 0 -#define ATOM_TABLE_NAMES_CNT 0 -#define ATOM_IO_NAMES_CNT 0 - -#endif #endif diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index d2084fb190..083bd41295 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -69,10 +69,15 @@ typedef struct { uint32 *ps, *ws; int ps_shift; uint16 start; + uint16 last_jump; + uint16 last_jump_count; + bool abort; } atom_exec_context; int atom_debug = 0; -void atom_execute_table(atom_context *ctx, int index, uint32 *params); +status_t atom_execute_table_locked(atom_context *ctx, + int index, uint32 *params); +status_t atom_execute_table(atom_context *ctx, int index, uint32 *params); static uint32 atom_arg_mask[8] = {0xFFFFFFFF, 0xFFFF, 0xFFFF00, 0xFFFF0000, 0xFF, 0xFF00, 0xFF0000, 0xFF000000}; @@ -280,7 +285,7 @@ atom_skip_src_int(atom_exec_context *ctx, uint8 attr, int *ptr) switch(arg) { case ATOM_ARG_REG: case ATOM_ARG_ID: - (*ptr)+=2; + (*ptr) += 2; break; case ATOM_ARG_PLL: case ATOM_ARG_MC: @@ -290,23 +295,23 @@ atom_skip_src_int(atom_exec_context *ctx, uint8 attr, int *ptr) (*ptr)++; break; case ATOM_ARG_IMM: - switch(align) { - case ATOM_SRC_DWORD: - (*ptr)+=4; - return; - case ATOM_SRC_WORD0: - case ATOM_SRC_WORD8: - case ATOM_SRC_WORD16: - (*ptr)+=2; - return; - case ATOM_SRC_BYTE0: - case ATOM_SRC_BYTE8: - case ATOM_SRC_BYTE16: - case ATOM_SRC_BYTE24: - (*ptr)++; - return; - } - return; + switch(align) { + case ATOM_SRC_DWORD: + (*ptr) += 4; + return; + case ATOM_SRC_WORD0: + case ATOM_SRC_WORD8: + case ATOM_SRC_WORD16: + (*ptr) += 2; + return; + case ATOM_SRC_BYTE0: + case ATOM_SRC_BYTE8: + case ATOM_SRC_BYTE16: + case ATOM_SRC_BYTE24: + (*ptr)++; + return; + } + return; } } @@ -318,6 +323,34 @@ atom_get_src(atom_exec_context *ctx, uint8 attr, int *ptr) } +static uint32 +atom_get_src_direct(atom_exec_context *ctx, uint8_t align, int *ptr) +{ + uint32 val = 0xCDCDCDCD; + + switch (align) { + case ATOM_SRC_DWORD: + val = U32(*ptr); + (*ptr) += 4; + break; + case ATOM_SRC_WORD0: + case ATOM_SRC_WORD8: + case ATOM_SRC_WORD16: + val = U16(*ptr); + (*ptr) += 2; + break; + case ATOM_SRC_BYTE0: + case ATOM_SRC_BYTE8: + case ATOM_SRC_BYTE16: + case ATOM_SRC_BYTE24: + val = U8(*ptr); + (*ptr)++; + break; + } + return val; +} + + static uint32 atom_get_dst(atom_exec_context *ctx, int arg, uint8 attr, int *ptr, uint32 *saved, int print) @@ -348,84 +381,91 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, saved &= ~atom_arg_mask[align]; val |= saved; switch(arg) { - case ATOM_ARG_REG: - idx = U16(*ptr); - (*ptr)+=2; - idx += gctx->reg_block; - switch(gctx->io_mode) { - case ATOM_IO_MM: - if (idx == 0) - gctx->card->reg_write(idx, val<<2); - else - gctx->card->reg_write(idx, val); - break; - case ATOM_IO_PCI: - TRACE("%s: PCI registers are not implemented.\n", __func__); - return; - case ATOM_IO_SYSIO: - TRACE("%s: SYSIO registers are not implemented.\n", __func__); - return; - default: - if (!(gctx->io_mode&0x80)) { - TRACE("%s: Bad IO mode.\n", __func__); - return; - } - if (!gctx->iio[gctx->io_mode&0xFF]) { + case ATOM_ARG_REG: + idx = U16(*ptr); + (*ptr) += 2; + idx += gctx->reg_block; + switch(gctx->io_mode) { + case ATOM_IO_MM: + if (idx == 0) + gctx->card->reg_write(idx, val<<2); + else + gctx->card->reg_write(idx, val); + break; + case ATOM_IO_PCI: + TRACE("%s: PCI registers are not implemented.\n", + __func__); + return; + case ATOM_IO_SYSIO: + TRACE("%s: SYSIO registers are not implemented.\n", + __func__); + return; + default: + if (!(gctx->io_mode&0x80)) { + TRACE("%s: Bad IO mode.\n", __func__); + return; + } + if (!gctx->iio[gctx->io_mode&0xFF]) { + TRACE("%s: Undefined indirect IO write method %d\n", + __func__, gctx->io_mode & 0x7F); + return; + } + atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0xFF], + idx, val); + } + break; + case ATOM_ARG_PS: + idx = U8(*ptr); + (*ptr)++; + ctx->ps[idx] = B_HOST_TO_LENDIAN_INT32(val); + break; + case ATOM_ARG_WS: + idx = U8(*ptr); + (*ptr)++; + switch(idx) { + case ATOM_WS_QUOTIENT: + gctx->divmul[0] = val; + break; + case ATOM_WS_REMAINDER: + gctx->divmul[1] = val; + break; + case ATOM_WS_DATAPTR: + gctx->data_block = val; + break; + case ATOM_WS_SHIFT: + gctx->shift = val; + break; + case ATOM_WS_OR_MASK: + case ATOM_WS_AND_MASK: + break; + case ATOM_WS_FB_WINDOW: + gctx->fb_base = val; + break; + case ATOM_WS_ATTRIBUTES: + gctx->io_attr = val; + break; + case ATOM_WS_REGPTR: + gctx->reg_block = val; + break; + default: + ctx->ws[idx] = val; + } + break; + case ATOM_ARG_FB: + idx = U8(*ptr); + (*ptr)++; + gctx->scratch[((gctx->fb_base + idx) / 4)] = val; + return; + case ATOM_ARG_PLL: + idx = U8(*ptr); + (*ptr)++; + gctx->card->pll_write(idx, val); + break; + case ATOM_ARG_MC: + idx = U8(*ptr); + (*ptr)++; + gctx->card->mc_write(idx, val); return; - } - atom_iio_execute(gctx, gctx->iio[gctx->io_mode&0xFF], idx, val); - } - break; - case ATOM_ARG_PS: - idx = U8(*ptr); - (*ptr)++; - ctx->ps[idx] = val; - break; - case ATOM_ARG_WS: - idx = U8(*ptr); - (*ptr)++; - switch(idx) { - case ATOM_WS_QUOTIENT: - gctx->divmul[0] = val; - break; - case ATOM_WS_REMAINDER: - gctx->divmul[1] = val; - break; - case ATOM_WS_DATAPTR: - gctx->data_block = val; - break; - case ATOM_WS_SHIFT: - gctx->shift = val; - break; - case ATOM_WS_OR_MASK: - case ATOM_WS_AND_MASK: - break; - case ATOM_WS_FB_WINDOW: - gctx->fb_base = val; - break; - case ATOM_WS_ATTRIBUTES: - gctx->io_attr = val; - break; - default: - ctx->ws[idx] = val; - } - break; - case ATOM_ARG_FB: - idx = U8(*ptr); - (*ptr)++; - TRACE("%s: FB access is not implemented.\n", __func__); - return; - case ATOM_ARG_PLL: - idx = U8(*ptr); - (*ptr)++; - gctx->card->reg_write(PLL_INDEX, idx); - gctx->card->reg_write(PLL_DATA, val); - break; - case ATOM_ARG_MC: - idx = U8(*ptr); - (*ptr)++; - TRACE("%s: MC registers are not implemented.\n", __func__); - return; } } @@ -475,9 +515,20 @@ static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) { int idx = U8((*ptr)++); - TRACE("%s: table: %d\n", __func__, idx); - if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) - atom_execute_table(ctx->ctx, idx, ctx->ps + ctx->ps_shift); + status_t result = B_OK; + + if (idx < ATOM_TABLE_NAMES_CNT) + TRACE("%s: table: %s (%d)\n", __func__, atom_table_names[idx], idx); + else + TRACE("%s: table: unknown (%d)\n", __func__, idx); + + if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) { + result = atom_execute_table_locked(ctx->ctx, + idx, ctx->ps + ctx->ps_shift); + } + + if (result != B_OK) + ctx->abort = true; } @@ -558,34 +609,48 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) { int execute = 0, target = U16(*ptr); - (*ptr)+=2; + (*ptr) += 2; switch(arg) { - case ATOM_COND_ABOVE: - execute = ctx->ctx->cs_above; - break; - case ATOM_COND_ABOVEOREQUAL: - execute = ctx->ctx->cs_above || ctx->ctx->cs_equal; - break; - case ATOM_COND_ALWAYS: - execute = 1; - break; - case ATOM_COND_BELOW: - execute = !(ctx->ctx->cs_above || ctx->ctx->cs_equal); - break; - case ATOM_COND_BELOWOREQUAL: - execute = !ctx->ctx->cs_above; - break; - case ATOM_COND_EQUAL: - execute = ctx->ctx->cs_equal; - break; - case ATOM_COND_NOTEQUAL: - execute = !ctx->ctx->cs_equal; - break; + case ATOM_COND_ABOVE: + execute = ctx->ctx->cs_above; + break; + case ATOM_COND_ABOVEOREQUAL: + execute = ctx->ctx->cs_above || ctx->ctx->cs_equal; + break; + case ATOM_COND_ALWAYS: + execute = 1; + break; + case ATOM_COND_BELOW: + execute = !(ctx->ctx->cs_above || ctx->ctx->cs_equal); + break; + case ATOM_COND_BELOWOREQUAL: + execute = !ctx->ctx->cs_above; + break; + case ATOM_COND_EQUAL: + execute = ctx->ctx->cs_equal; + break; + case ATOM_COND_NOTEQUAL: + execute = !ctx->ctx->cs_equal; + break; } TRACE("%s: execute jump: %s; target: 0x%04X\n", __func__, execute? "yes" : "no", target); - if (execute) + + if (execute) { + if (ctx->last_jump == (ctx->start + target)) { + if (ctx->last_jump_count > 128) { + TRACE("%s: DANGER! AtomBIOS stuck in infinite loop" + " for more then 128 jumps... abort!\n", __func__); + ctx->abort = true; + } else { + ctx->last_jump_count++; + } + } else { + ctx->last_jump = ctx->start + target; + ctx->last_jump_count = 1; + } *ptr = ctx->start + target; + } } @@ -593,15 +658,15 @@ static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++); - uint32 dst, src1, src2, saved; + uint32 dst, mask, src, saved; int dptr = *ptr; dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - src1 = atom_get_src(ctx, attr, ptr); - src2 = atom_get_src(ctx, attr, ptr); - dst &= src1; - dst |= src2; + mask = atom_get_src_direct(ctx, ((attr >> 3) & 7), ptr); + src = atom_get_src(ctx, attr, ptr); + dst &= mask; + dst |= src; TRACE("%s: src: 0x%" B_PRIX32 " mask 0x%" B_PRIX32 " is 0x%" B_PRIX32 "\n", - __func__, src1, src2, dst); + __func__, src, mask, dst); atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } @@ -612,7 +677,7 @@ atom_op_move(atom_exec_context *ctx, int *ptr, int arg) uint8 attr = U8((*ptr)++); uint32 src, saved; int dptr = *ptr; - if (((attr>>3)&7) != ATOM_SRC_DWORD) + if (((attr >> 3) & 7) != ATOM_SRC_DWORD) atom_get_dst(ctx, arg, attr, ptr, &saved, 0); else { atom_skip_dst(ctx, arg, attr, ptr); @@ -665,7 +730,8 @@ atom_op_or(atom_exec_context *ctx, int *ptr, int arg) static void atom_op_postcard(atom_exec_context *ctx, int *ptr, int arg) { - TRACE("%s: unimplemented!\n", __func__); + uint8 val = U8((*ptr)++); + TRACE("%s: POST card output: 0x%" B_PRIX8 "\n", __func__, val); } @@ -696,11 +762,11 @@ atom_op_setdatablock(atom_exec_context *ctx, int *ptr, int arg) (*ptr)++; TRACE("%s: block: %d\n", __func__, idx); if (!idx) - ctx->ctx->data_block = 0; - else if (idx==255) - ctx->ctx->data_block = ctx->start; + ctx->ctx->data_block = 0; + else if (idx == 255) + ctx->ctx->data_block = ctx->start; else - ctx->ctx->data_block = U16(ctx->ctx->data_table + 4 + 2 * idx); + ctx->ctx->data_block = U16(ctx->ctx->data_table + 4 + 2 * idx); } @@ -718,23 +784,27 @@ atom_op_setport(atom_exec_context *ctx, int *ptr, int arg) { int port; switch(arg) { - case ATOM_PORT_ATI: - port = U16(*ptr); - TRACE("%s: port: %d\n", __func__, port); - if (!port) - ctx->ctx->io_mode = ATOM_IO_MM; - else - ctx->ctx->io_mode = ATOM_IO_IIO|port; - (*ptr)+=2; - break; - case ATOM_PORT_PCI: - ctx->ctx->io_mode = ATOM_IO_PCI; - (*ptr)++; - break; - case ATOM_PORT_SYSIO: - ctx->ctx->io_mode = ATOM_IO_SYSIO; - (*ptr)++; - break; + case ATOM_PORT_ATI: + port = U16(*ptr); + if (port < ATOM_IO_NAMES_CNT) { + TRACE("%s: port: %d (%s)\n", __func__, + port, atom_io_names[port]); + } else + TRACE("%s: port: %d\n", __func__, port); + if (!port) + ctx->ctx->io_mode = ATOM_IO_MM; + else + ctx->ctx->io_mode = ATOM_IO_IIO | port; + (*ptr) += 2; + break; + case ATOM_PORT_PCI: + ctx->ctx->io_mode = ATOM_IO_PCI; + (*ptr)++; + break; + case ATOM_PORT_SYSIO: + ctx->ctx->io_mode = ATOM_IO_SYSIO; + (*ptr)++; + break; } } @@ -747,16 +817,15 @@ atom_op_setregblock(atom_exec_context *ctx, int *ptr, int arg) } -static void -atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) +static void atom_op_shift_left(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++), shift; uint32 saved, dst; int dptr = *ptr; attr &= 0x38; - attr |= atom_def_dst[attr>>3]<<6; + attr |= atom_def_dst[attr >> 3] << 6; dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - shift = U8((*ptr)++); + shift = atom_get_src_direct(ctx, ATOM_SRC_BYTE0, ptr); #ifdef ATOM_TRACE TRACE("%s: 0x%" B_PRIX32 " << %" B_PRId8 " is 0X%" B_PRIX32 "\n", __func__, dst, shift, dst << shift); @@ -766,25 +835,66 @@ atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) } -static void -atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) +static void atom_op_shift_right(atom_exec_context *ctx, int *ptr, int arg) { uint8 attr = U8((*ptr)++), shift; uint32 saved, dst; int dptr = *ptr; attr &= 0x38; - attr |= atom_def_dst[attr>>3]<<6; + attr |= atom_def_dst[attr >> 3] << 6; dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); - shift = U8((*ptr)++); + shift = atom_get_src_direct(ctx, ATOM_SRC_BYTE0, ptr); #ifdef ATOM_TRACE TRACE("%s: 0x%" B_PRIX32 " >> %" B_PRId8 " is 0X%" B_PRIX32 "\n", - __func__, dst, shift, dst >> shift); + __func__, dst, shift, dst << shift); #endif dst >>= shift; atom_put_dst(ctx, arg, attr, &dptr, dst, saved); } +static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++), shift; + uint32 saved, dst; + int dptr = *ptr; + uint32 dst_align = atom_dst_to_src[(attr >> 3) & 7][(attr >> 6) & 3]; + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + /* op needs to full dst value */ + dst = saved; + shift = atom_get_src(ctx, attr, ptr); + #ifdef ATOM_TRACE + TRACE("%s: 0x%" B_PRIX32 " << %" B_PRId8 " is 0X%" B_PRIX32 "\n", + __func__, dst, shift, dst << shift); + #endif + dst <<= shift; + dst &= atom_arg_mask[dst_align]; + dst >>= atom_arg_shift[dst_align]; + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + +static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) +{ + uint8 attr = U8((*ptr)++), shift; + uint32 saved, dst; + int dptr = *ptr; + uint32 dst_align = atom_dst_to_src[(attr >> 3) & 7][(attr >> 6) & 3]; + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + /* op needs to full dst value */ + dst = saved; + shift = atom_get_src(ctx, attr, ptr); + #ifdef ATOM_TRACE + TRACE("%s: 0x%" B_PRIX32 " >> %" B_PRId8 " is 0X%" B_PRIX32 "\n", + __func__, dst, shift, dst << shift); + #endif + dst >>= shift; + dst &= atom_arg_mask[dst_align]; + dst >>= atom_arg_shift[dst_align]; + atom_put_dst(ctx, arg, attr, &dptr, dst, saved); +} + + static void atom_op_sub(atom_exec_context *ctx, int *ptr, int arg) { @@ -813,7 +923,7 @@ atom_op_switch(atom_exec_context *ctx, int *ptr, int arg) if (U8(*ptr) == ATOM_CASE_MAGIC) { (*ptr)++; TRACE("%s: switch case\n", __func__); - val = atom_get_src(ctx, (attr&0x38)|ATOM_ARG_IMM, ptr); + val = atom_get_src(ctx, (attr & 0x38) | ATOM_ARG_IMM, ptr); target = U16(*ptr); if (val == src) { *ptr = ctx->start + target; @@ -888,18 +998,18 @@ static struct { { atom_op_or, ATOM_ARG_FB }, { atom_op_or, ATOM_ARG_PLL }, { atom_op_or, ATOM_ARG_MC }, - { atom_op_shl, ATOM_ARG_REG }, - { atom_op_shl, ATOM_ARG_PS }, - { atom_op_shl, ATOM_ARG_WS }, - { atom_op_shl, ATOM_ARG_FB }, - { atom_op_shl, ATOM_ARG_PLL }, - { atom_op_shl, ATOM_ARG_MC }, - { atom_op_shr, ATOM_ARG_REG }, - { atom_op_shr, ATOM_ARG_PS }, - { atom_op_shr, ATOM_ARG_WS }, - { atom_op_shr, ATOM_ARG_FB }, - { atom_op_shr, ATOM_ARG_PLL }, - { atom_op_shr, ATOM_ARG_MC }, + { atom_op_shift_left, ATOM_ARG_REG }, + { atom_op_shift_left, ATOM_ARG_PS }, + { atom_op_shift_left, ATOM_ARG_WS }, + { atom_op_shift_left, ATOM_ARG_FB }, + { atom_op_shift_left, ATOM_ARG_PLL }, + { atom_op_shift_left, ATOM_ARG_MC }, + { atom_op_shift_right, ATOM_ARG_REG }, + { atom_op_shift_right, ATOM_ARG_PS }, + { atom_op_shift_right, ATOM_ARG_WS }, + { atom_op_shift_right, ATOM_ARG_FB }, + { atom_op_shift_right, ATOM_ARG_PLL }, + { atom_op_shift_right, ATOM_ARG_MC }, { atom_op_mul, ATOM_ARG_REG }, { atom_op_mul, ATOM_ARG_PS }, { atom_op_mul, ATOM_ARG_WS }, @@ -994,8 +1104,8 @@ static struct { }; -void -atom_execute_table(atom_context *ctx, int index, uint32 *params) +status_t +atom_execute_table_locked(atom_context *ctx, int index, uint32 * params) { int base = CU16(ctx->cmd_table + 4 + 2 * index); int len, ws, ps, ptr; @@ -1003,41 +1113,74 @@ atom_execute_table(atom_context *ctx, int index, uint32 *params) atom_exec_context ectx; if (!base) - return; + return B_ERROR; len = CU16(base + ATOM_CT_SIZE_PTR); ws = CU8(base + ATOM_CT_WS_PTR); ps = CU8(base + ATOM_CT_PS_PTR) & ATOM_CT_PS_MASK; ptr = base + ATOM_CT_CODE_PTR; - /* reset reg block */ - ctx->reg_block = 0; ectx.ctx = ctx; ectx.ps_shift = ps / 4; ectx.start = base; ectx.ps = params; + ectx.abort = false; + ectx.last_jump = 0; + ectx.last_jump_count = 0; if (ws) ectx.ws = (uint32*)malloc(4 * ws); else - ectx.ws = NULL; + ectx.ws = NULL; debug_depth++; while (1) { - op = CU8(ptr++); + op = CU8(ptr++); + if (op < ATOM_OP_NAMES_CNT) { + TRACE("%s: %s (0x%" B_PRIX16 ")\n", __func__, + atom_op_names[op], ptr - 1); + } else + TRACE("%s: unknown (0x%" B_PRIX16 ")\n", __func__, ptr - 1); - if (op 0) - opcode_table[op].func(&ectx, &ptr, opcode_table[op].arg); - else - break; + if (ectx.abort == true) { + TRACE("AtomBios parser was aborted executing (0x%" B_PRIX16 ")\n", + ptr - 1); + free(ectx.ws); + return B_ERROR; + } - if (op == ATOM_OP_EOT) - break; + if (op < ATOM_OP_CNT && op > 0) + opcode_table[op].func(&ectx, &ptr, opcode_table[op].arg); + else + break; + + if (op == ATOM_OP_EOT) + break; } debug_depth--; - TRACE("<<\n"); - if (ws) free(ectx.ws); + return B_OK; +} + + +status_t +atom_execute_table(atom_context *ctx, int index, uint32 *params) +{ + if (acquire_sem_etc(ctx->exec_sem, 1, B_RELATIVE_TIMEOUT, 5000000) + != B_NO_ERROR) { + TRACE("%s: Timeout to obtain semaphore!\n", __func__); + return B_ERROR; + } + /* reset reg block */ + ctx->reg_block = 0; + /* reset fb window */ + ctx->fb_base = 0; + /* reset io mode */ + ctx->io_mode = ATOM_IO_MM; + status_t result = atom_execute_table_locked(ctx, index, params); + + release_sem(ctx->exec_sem); + return result; } @@ -1049,11 +1192,11 @@ atom_index_iio(atom_context *ctx, int base) { ctx->iio = (uint16*)malloc(2 * 256); while (CU8(base) == ATOM_IIO_START) { - ctx->iio[CU8(base + 1)] = base + 2; - base += 2; - while (CU8(base) != ATOM_IIO_END) - base += atom_iio_len[CU8(base)]; - base += 3; + ctx->iio[CU8(base + 1)] = base + 2; + base += 2; + while (CU8(base) != ATOM_IIO_END) + base += atom_iio_len[CU8(base)]; + base += 3; } } diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 6445075bd0..6ac679643b 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -29,6 +29,7 @@ #include #include +#include struct card_info { @@ -131,6 +132,7 @@ typedef struct atom_context_s { uint32 cmd_table, data_table; uint16 *iio; + sem_id exec_sem; uint16 data_block; uint32 fb_base; uint32 divmul[2]; @@ -145,7 +147,7 @@ typedef struct atom_context_s { extern int atom_debug; atom_context *atom_parse(card_info *, void *); -void atom_execute_table(atom_context *, int, uint32 *); +status_t atom_execute_table(atom_context *, int, uint32 *); int atom_asic_init(atom_context *); void atom_destroy(atom_context *); diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index db8df037cc..3dd39afa79 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -103,7 +103,13 @@ radeon_init_bios(uint8* bios) atom_asic_init(gAtomContext); // Post card - // mutex_init(&rdev->mode_info.atom_context->mutex); + if ((gAtomContext->exec_sem = create_sem(1, "AtomBIOS_exec")) + < B_NO_ERROR) { + TRACE("%s: couldn't create semaphore for AtomBIOS exec thread!\n", + __func__); + return B_ERROR; + } + radeon_bios_init_scratch(); return B_OK; From 9dcd41a8afd79a7743783f689707d6a4a62e25f6 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 6 Aug 2011 09:05:55 +0000 Subject: [PATCH 134/702] Some tweakings to the notificationsystem to make it look more like a regular alert. Feel free to improve on it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42586 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/notification/AppGroupView.cpp | 53 ++++++++----------- src/servers/notification/BorderView.cpp | 4 +- src/servers/notification/NotificationView.cpp | 11 +++- .../notification/NotificationWindow.cpp | 5 +- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/src/servers/notification/AppGroupView.cpp b/src/servers/notification/AppGroupView.cpp index 9612f5431b..caa479de68 100644 --- a/src/servers/notification/AppGroupView.cpp +++ b/src/servers/notification/AppGroupView.cpp @@ -58,14 +58,15 @@ AppGroupView::Draw(BRect updateRect) be_bold_font->GetHeight(&fh); float labelOffset = fh.ascent + fh.leading; - BRect borderRect = Bounds().InsetByCopy(kEdgePadding, kEdgePadding); - borderRect.top = labelOffset; - BRect textRect = borderRect; - textRect.left = kEdgePadding * 2; - textRect.right = textRect.left + be_bold_font->StringWidth(label.String()) - + (kEdgePadding * 3); - textRect.bottom = labelOffset; + BRect textRect = Bounds(); + //textRect.left = kEdgePadding * 2; + //textRect.right = textRect.left + be_bold_font->StringWidth(label.String()) + // + (kEdgePadding * 3); + textRect.bottom = 2 * labelOffset; + + BRect borderRect = Bounds().InsetByCopy(kEdgePadding, kEdgePadding); + borderRect.top = 2 * labelOffset; BRect closeCross = fCloseRect; closeCross.InsetBy(kSmallPadding, kSmallPadding); @@ -137,36 +138,24 @@ AppGroupView::Draw(BRect updateRect) SetFont(be_bold_font); SetPenSize(kPenSize); - // Draw the border - PushState(); - SetHighColor(detailCol); - // StrokeRoundRect(borderRect, kEdgePadding, kEdgePadding * 2); - StrokeRect(borderRect); - PopState(); - + SetLowColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); FillRect(textRect, B_SOLID_LOW); + + SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); // Draw the collapse widget - PushState(); - SetHighColor(detailCol); - StrokeRoundRect(fCollapseRect, kSmallPadding, kSmallPadding); + StrokeRoundRect(fCollapseRect, kSmallPadding, kSmallPadding); - BPoint expandHorStart(fCollapseRect.left + kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); - BPoint expandHorEnd(fCollapseRect.right - kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); + BPoint expandHorStart(fCollapseRect.left + kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); + BPoint expandHorEnd(fCollapseRect.right - kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); - StrokeLine(expandHorStart, expandHorEnd); - PopState(); + StrokeLine(expandHorStart, expandHorEnd); // Draw the dismiss widget - PushState(); - SetHighColor(detailCol); - FillRect(fCloseRect, B_SOLID_LOW); + StrokeRoundRect(fCloseRect, kSmallPadding, kSmallPadding); - StrokeRoundRect(fCloseRect, kSmallPadding, kSmallPadding); - - StrokeLine(closeCross.LeftTop(), closeCross.RightBottom()); - StrokeLine(closeCross.RightTop(), closeCross.LeftBottom()); - PopState(); + StrokeLine(closeCross.LeftTop(), closeCross.RightBottom()); + StrokeLine(closeCross.RightTop(), closeCross.LeftBottom()); // Draw the label DrawString(label.String(), BPoint(fCollapseRect.right + kEdgePadding, labelOffset + kEdgePadding)); @@ -310,7 +299,7 @@ AppGroupView::ResizeViews() font_height fh; be_bold_font->GetHeight(&fh); - float offset = fh.ascent + fh.leading + fh.descent; + float offset = 2 * kEdgePadding + fh.ascent + fh.leading + fh.descent; int32 children = fInfo.size(); if (!fCollapsed) { @@ -318,7 +307,7 @@ AppGroupView::ResizeViews() for (int32 i = 0; i < children; i++) { fInfo[i]->ResizeToPreferred(); - fInfo[i]->MoveTo(kEdgePadding + kPenSize, offset); + fInfo[i]->MoveTo(0, offset); offset += fInfo[i]->Bounds().Height(); if (fInfo[i]->IsHidden()) @@ -342,7 +331,7 @@ AppGroupView::ResizeViews() float labelOffset = fh.ascent + fh.leading; BRect borderRect = Bounds().InsetByCopy(kEdgePadding, kEdgePadding); - borderRect.top = labelOffset; + borderRect.top = 2*labelOffset; fCollapseRect = borderRect; fCollapseRect.right = fCollapseRect.left + kExpandSize; diff --git a/src/servers/notification/BorderView.cpp b/src/servers/notification/BorderView.cpp index e19fb86e3a..659ec195de 100644 --- a/src/servers/notification/BorderView.cpp +++ b/src/servers/notification/BorderView.cpp @@ -77,11 +77,11 @@ BorderView::Draw(BRect rect) SetHighColor(tint_color(col_bg, B_DARKEN_2_TINT)); BRect content = Bounds(); - content.InsetBy(kBorderWidth, kBorderWidth); +// content.InsetBy(kBorderWidth, kBorderWidth); content.top += text_pos + fh.descent + 2; BRect content_line(content); - content_line.InsetBy(-1, -1); +// content_line.InsetBy(-1, -1); StrokeRect(content_line); } diff --git a/src/servers/notification/NotificationView.cpp b/src/servers/notification/NotificationView.cpp index f33d5e027f..28963614e9 100644 --- a/src/servers/notification/NotificationView.cpp +++ b/src/servers/notification/NotificationView.cpp @@ -32,6 +32,8 @@ const char* kSmallIconAttribute = "BEOS:M:STD_ICON"; const char* kLargeIconAttribute = "BEOS:L:STD_ICON"; const char* kIconAttribute = "BEOS:ICON"; +static const int kIconStripeWidth = 30; + property_info message_prop_list[] = { { "type", {B_GET_PROPERTY, B_SET_PROPERTY, 0}, {B_DIRECT_SPECIFIER, 0}, "get the notification type"}, @@ -297,7 +299,14 @@ NotificationView::Draw(BRect updateRect) // Icon size float iconSize = (float)fParent->IconSize(); - + + BRect stripeRect = Bounds(); + int32 iconLayoutScale = max_c(1, ((int32)be_plain_font->Size() + 15) / 16); + stripeRect.right = kIconStripeWidth * iconLayoutScale; + SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); + FillRect(stripeRect); + + SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); // Rectangle for icon and overlay icon BRect iconRect(0, 0, 0, 0); diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index f33e504df9..b7acc38ec9 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "AppGroupView.h" #include "AppUsage.h" @@ -48,13 +49,13 @@ property_info main_prop_list[] = { const float kCloseSize = 8; const float kExpandSize = 8; const float kPenSize = 1; -const float kEdgePadding = 5; +const float kEdgePadding = 2; const float kSmallPadding = 2; NotificationWindow::NotificationWindow() : BWindow(BRect(10, 10, 30, 30), B_TRANSLATE_MARK("Notification"), - B_BORDERED_WINDOW, B_AVOID_FRONT | B_AVOID_FOCUS | B_NOT_CLOSABLE + kLeftTitledWindowLook, B_FLOATING_ALL_WINDOW_FEEL, B_AVOID_FRONT | B_AVOID_FOCUS | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE, B_ALL_WORKSPACES) { From beb636036face95abb3af3a10747509a98c14b30 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 6 Aug 2011 10:41:45 +0000 Subject: [PATCH 135/702] Ensure the window is at the right position before showing it. Fixes #7011. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42587 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/notification/NotificationWindow.cpp | 15 ++++++++++++--- src/servers/notification/NotificationWindow.h | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index b7acc38ec9..4d3187f95f 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -54,7 +54,7 @@ const float kSmallPadding = 2; NotificationWindow::NotificationWindow() : - BWindow(BRect(10, 10, 30, 30), B_TRANSLATE_MARK("Notification"), + BWindow(BRect(0, 0, 0, 0), B_TRANSLATE_MARK("Notification"), kLeftTitledWindowLook, B_FLOATING_ALL_WINDOW_FEEL, B_AVOID_FRONT | B_AVOID_FOCUS | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE, B_ALL_WORKSPACES) @@ -63,6 +63,7 @@ NotificationWindow::NotificationWindow() AddChild(fBorder); + SetPosition(); Show(); Hide(); @@ -363,13 +364,15 @@ NotificationWindow::ResizeAll() } ResizeTo(ViewWidth(), height); - PopupAnimation(Bounds().Width(), Bounds().Height()); + PopupAnimation(); } void -NotificationWindow::PopupAnimation(float width, float height) +NotificationWindow::SetPosition() { + float width = Bounds().Width(); + float height = Bounds().Height(); float x = 0, y = 0, sx, sy; float pad = 0; BDeskbar deskbar; @@ -423,6 +426,12 @@ NotificationWindow::PopupAnimation(float width, float height) } MoveTo(x, y); +} + +void +NotificationWindow::PopupAnimation() +{ + SetPosition(); if (IsHidden() && fViews.size() != 0) Show(); diff --git a/src/servers/notification/NotificationWindow.h b/src/servers/notification/NotificationWindow.h index a246f7e760..f1fbb76171 100644 --- a/src/servers/notification/NotificationWindow.h +++ b/src/servers/notification/NotificationWindow.h @@ -62,7 +62,8 @@ public: private: friend class AppGroupView; - void PopupAnimation(float, float); + void SetPosition(); + void PopupAnimation(); void LoadSettings(bool startMonitor = false); void LoadAppFilters(bool startMonitor = false); void SaveAppFilters(); From ee298c8b81c0aa2b1c683c5c5b249a2c49119d5e Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 6 Aug 2011 21:13:28 +0000 Subject: [PATCH 136/702] * Fix DecoratorFrame() for kLeftTitledWindowLook windows * Use it in notification window for better positionning. Thanks augiedoggie for reporting the problem ! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42588 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 36 ++++++++++++++----- .../notification/NotificationWindow.cpp | 33 ++++++++++------- src/servers/notification/NotificationWindow.h | 2 ++ 3 files changed, 51 insertions(+), 20 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index a14759f81a..aad44398ce 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2078,14 +2078,34 @@ BRect BWindow::DecoratorFrame() const { BRect decoratorFrame(Frame()); - float borderWidth; - float tabHeight; - _GetDecoratorSize(&borderWidth, &tabHeight); - // TODO: Broken for tab on left window side windows... - decoratorFrame.top -= tabHeight; - decoratorFrame.left -= borderWidth; - decoratorFrame.right += borderWidth; - decoratorFrame.bottom += borderWidth; + BRect tabRect(0, 0, 0, 0); + + float borderWidth = 5.0; + + BMessage settings; + if (GetDecoratorSettings(&settings) == B_OK) { + settings.FindRect("tab frame", &tabRect); + settings.FindFloat("border width", &borderWidth); + } else { + // probably no-border window look + if (fLook == B_NO_BORDER_WINDOW_LOOK) { + borderWidth = 0.0; + } + // else use fall-back values from above + } + + if (fLook & kLeftTitledWindowLook) { + decoratorFrame.top -= borderWidth; + decoratorFrame.left -= tabRect.Width(); + decoratorFrame.right += borderWidth; + decoratorFrame.bottom += borderWidth; + } else { + decoratorFrame.top -= tabRect.Height(); + decoratorFrame.left -= borderWidth; + decoratorFrame.right += borderWidth; + decoratorFrame.bottom += borderWidth; + } + return decoratorFrame; } diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index 4d3187f95f..4621ae328f 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -62,8 +62,7 @@ NotificationWindow::NotificationWindow() fBorder = new BorderView(Bounds(), "Notification"); AddChild(fBorder); - - SetPosition(); + Show(); Hide(); @@ -371,8 +370,13 @@ NotificationWindow::ResizeAll() void NotificationWindow::SetPosition() { - float width = Bounds().Width(); - float height = Bounds().Height(); + BRect bounds = DecoratorFrame(); + float width = bounds.Width(); + float height = bounds.Height(); + + float leftOffset = Frame().left - DecoratorFrame().left; + float topOffset = DecoratorFrame().top - Frame().top; + float x = 0, y = 0, sx, sy; float pad = 0; BDeskbar deskbar; @@ -381,10 +385,8 @@ NotificationWindow::SetPosition() switch (deskbar.Location()) { case B_DESKBAR_TOP: // Put it just under, top right corner - sx = frame.right; - sy = frame.bottom + pad; - y = sy; - x = sx - width - pad; + y = frame.bottom + pad + topOffset; + x = frame.right - width; break; case B_DESKBAR_BOTTOM: // Put it just above, lower left corner @@ -396,14 +398,14 @@ NotificationWindow::SetPosition() case B_DESKBAR_LEFT_TOP: // Put it just to the right of the deskbar sx = frame.right + pad; - sy = frame.top - height; - x = sx; + //sy = frame.top - height; + x = sx + leftOffset; y = frame.top + pad; break; case B_DESKBAR_RIGHT_TOP: // Put it just to the left of the deskbar sx = frame.left - width - pad; - sy = frame.top - height; + //sy = frame.top - height; x = sx; y = frame.top + pad; break; @@ -411,7 +413,7 @@ NotificationWindow::SetPosition() // Put it to the right of the deskbar. sx = frame.right + pad; sy = frame.bottom; - x = sx; + x = sx + leftOffset; y = sy - height - pad; break; case B_DESKBAR_RIGHT_BOTTOM: @@ -516,6 +518,13 @@ NotificationWindow::SaveAppFilters() } +void NotificationWindow::Show() +{ + BWindow::Show(); + SetPosition(); +} + + void NotificationWindow::_LoadGeneralSettings(bool startMonitor) { diff --git a/src/servers/notification/NotificationWindow.h b/src/servers/notification/NotificationWindow.h index f1fbb76171..1d1658f402 100644 --- a/src/servers/notification/NotificationWindow.h +++ b/src/servers/notification/NotificationWindow.h @@ -51,6 +51,8 @@ public: virtual void WorkspaceActivated(int32, bool); virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, int32, const char*); + + void Show(); icon_size IconSize(); int32 Timeout(); From ee5d8bd0a8788c9017841a35a2a00a5ac481e6ca Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 7 Aug 2011 03:40:23 +0000 Subject: [PATCH 137/702] * tab fix * add atom_parse_cmd|table_header functions to evaluate data structure versions * convert asic function to status_t and reflect execute_table result * cleanup logic in destroy atombios parser function git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42589 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 57 ++++++++++++++++--- .../accelerants/radeon_hd/atombios/atom.h | 6 +- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 083bd41295..72b3f70e64 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -1248,7 +1248,7 @@ atom_parse(card_info *card, void *bios) } -int +status_t atom_asic_init(atom_context *ctx) { int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); @@ -1258,21 +1258,62 @@ atom_asic_init(atom_context *ctx) ps[0] = CU32(hwi + ATOM_FWI_DEFSCLK_PTR); ps[1] = CU32(hwi + ATOM_FWI_DEFMCLK_PTR); if (!ps[0] || !ps[1]) - return 1; + return B_ERROR; if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) - return 1; + return B_ERROR; - atom_execute_table(ctx, ATOM_CMD_INIT, ps); - - return 0; + return atom_execute_table(ctx, ATOM_CMD_INIT, ps); } void atom_destroy(atom_context *ctx) { - if (ctx->iio) - free(ctx->iio); + if (ctx != NULL) + free(ctx->iio); + free(ctx); } + + +status_t +atom_parse_data_header(atom_context *ctx, int index, uint16 *size, + uint8 *frev, uint8 *crev, uint16 *data_start) +{ + int offset = index * 2 + 4; + int idx = CU16(ctx->data_table + offset); + uint16 *mdt = (uint16 *)ctx->bios + ctx->data_table + 4; + + if (!mdt[index]) + return B_ERROR; + + if (size) + *size = CU16(idx); + if (frev) + *frev = CU8(idx + 2); + if (crev) + *crev = CU8(idx + 3); + *data_start = idx; + return B_OK; +} + + +status_t +atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev, + uint8 * crev) +{ + int offset = index * 2 + 4; + int idx = CU16(ctx->cmd_table + offset); + uint16 *mct = (uint16 *)ctx->bios + ctx->cmd_table + 4; + + if (!mct[index]) + return B_ERROR; + + if (frev) + *frev = CU8(idx + 2); + if (crev) + *crev = CU8(idx + 3); + return B_OK; +} + diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 6ac679643b..4333528a63 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -148,7 +148,11 @@ extern int atom_debug; atom_context *atom_parse(card_info *, void *); status_t atom_execute_table(atom_context *, int, uint32 *); -int atom_asic_init(atom_context *); +status_t atom_parse_data_header(atom_context *ctx, int index, uint16 *size, + uint8 *frev, uint8 *crev, uint16 *data_start); +status_t atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev, + uint8 * crev); +status_t atom_asic_init(atom_context *); void atom_destroy(atom_context *); #endif From 7a2d0c5e92cc77ee5a59c924a2d083e0f711a89a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 7 Aug 2011 03:48:58 +0000 Subject: [PATCH 138/702] * lets not make AtomBIOS calls until our semaphore is created :) * delete semaphore on AtomBIOS destroy git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42590 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/atombios/atom.cpp | 4 +++- src/add-ons/accelerants/radeon_hd/bios.cpp | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 72b3f70e64..3c06cec576 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -1270,8 +1270,10 @@ atom_asic_init(atom_context *ctx) void atom_destroy(atom_context *ctx) { - if (ctx != NULL) + if (ctx != NULL) { free(ctx->iio); + delete_sem(ctx->exec_sem); + } free(ctx); } diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 3dd39afa79..21568d0d90 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -100,9 +100,6 @@ radeon_init_bios(uint8* bios) return B_ERROR; } - atom_asic_init(gAtomContext); - // Post card - if ((gAtomContext->exec_sem = create_sem(1, "AtomBIOS_exec")) < B_NO_ERROR) { TRACE("%s: couldn't create semaphore for AtomBIOS exec thread!\n", @@ -110,6 +107,9 @@ radeon_init_bios(uint8* bios) return B_ERROR; } + atom_asic_init(gAtomContext); + // Post card + radeon_bios_init_scratch(); return B_OK; From 77e8ac07c6bcbc944a7c631f91bbaf64ab99634c Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 7 Aug 2011 05:19:42 +0000 Subject: [PATCH 139/702] * add allocation of atombios fb scratch * add free of allocated fb scratch git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42591 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 30 +++++++++++++++++++ .../accelerants/radeon_hd/atombios/atom.h | 2 ++ src/add-ons/accelerants/radeon_hd/bios.cpp | 1 + 3 files changed, 33 insertions(+) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 3c06cec576..52d0549383 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -1272,6 +1272,7 @@ atom_destroy(atom_context *ctx) { if (ctx != NULL) { free(ctx->iio); + free(ctx->scratch); delete_sem(ctx->exec_sem); } @@ -1319,3 +1320,32 @@ atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev, return B_OK; } + +status_t +atom_allocate_fb_scratch(atom_context *ctx) +{ + int index = GetIndexIntoMasterTable(DATA, VRAM_UsageByFirmware); + uint16 data_offset; + int usage_bytes = 0; + _ATOM_VRAM_USAGE_BY_FIRMWARE *firmware; + + if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) { + firmware = (_ATOM_VRAM_USAGE_BY_FIRMWARE *) + ((uint16*)ctx->bios + data_offset); + + TRACE("Atom firmware requested 0x%" B_PRIX32 " %" B_PRIu16 "kb\n", + firmware->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware, + firmware->asFirmwareVramReserveInfo[0].usFirmwareUseInKb); + + usage_bytes + = firmware->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024; + } + if (usage_bytes == 0) + usage_bytes = 20 * 1024; + /* allocate some scratch memory */ + ctx->scratch = (uint32*)malloc(usage_bytes); + if (!ctx->scratch) + return B_NO_MEMORY; + + return B_OK; +} diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 4333528a63..13a1897b81 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -154,5 +154,7 @@ status_t atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev, uint8 * crev); status_t atom_asic_init(atom_context *); void atom_destroy(atom_context *); +status_t atom_allocate_fb_scratch(atom_context *ctx); + #endif diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 21568d0d90..d128288fc0 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -111,6 +111,7 @@ radeon_init_bios(uint8* bios) // Post card radeon_bios_init_scratch(); + atom_allocate_fb_scratch(gAtomContext); return B_OK; } From 0cd93754a4038ed73c61ce34dd398c14b3ec6dee Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 7 Aug 2011 05:24:23 +0000 Subject: [PATCH 140/702] * init scratch before card post * B_OK != 1!, so don't if (status_t) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42592 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/atombios/atom.cpp | 3 ++- src/add-ons/accelerants/radeon_hd/bios.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 52d0549383..811daf46fa 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -1329,7 +1329,8 @@ atom_allocate_fb_scratch(atom_context *ctx) int usage_bytes = 0; _ATOM_VRAM_USAGE_BY_FIRMWARE *firmware; - if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) { + if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset) + == B_OK) { firmware = (_ATOM_VRAM_USAGE_BY_FIRMWARE *) ((uint16*)ctx->bios + data_offset); diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index d128288fc0..97e2a3981d 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -107,11 +107,11 @@ radeon_init_bios(uint8* bios) return B_ERROR; } - atom_asic_init(gAtomContext); - // Post card - radeon_bios_init_scratch(); atom_allocate_fb_scratch(gAtomContext); + atom_asic_init(gAtomContext); + // Post card + return B_OK; } From bdce14985bcbea5f3f62404df1e877386a11d7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 7 Aug 2011 12:05:22 +0000 Subject: [PATCH 141/702] added std::nothrow for some new calls, and initialize fCheckCookie git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42593 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/bfs/BlockAllocator.cpp | 9 +++++---- src/add-ons/kernel/file_systems/bfs/Volume.cpp | 12 +++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index 48bf78dd23..257fb3d872 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -517,7 +517,8 @@ BlockAllocator::BlockAllocator(Volume* volume) : fVolume(volume), fGroups(NULL), - fCheckBitmap(NULL) + fCheckBitmap(NULL), + fCheckCookie(NULL) { mutex_init(&fLock, "bfs allocator"); } @@ -538,7 +539,7 @@ BlockAllocator::Initialize(bool full) fNumBlocks = (fVolume->NumBlocks() + fVolume->BlockSize() * 8 - 1) / (fVolume->BlockSize() * 8); - fGroups = new AllocationGroup[fNumGroups]; + fGroups = new(std::nothrow) AllocationGroup[fNumGroups]; if (fGroups == NULL) return B_NO_MEMORY; @@ -1215,7 +1216,7 @@ BlockAllocator::StartChecking(const check_control* control) return B_NO_MEMORY; } - fCheckCookie = new check_cookie(); + fCheckCookie = new(std::nothrow) check_cookie(); if (fCheckCookie == NULL) { free(fCheckBitmap); fCheckBitmap = NULL; @@ -1432,7 +1433,7 @@ BlockAllocator::CheckNextNode(check_control* control) fCheckCookie->parent = inode; fCheckCookie->parent_mode = inode->Mode(); - fCheckCookie->iterator = new TreeIterator(tree); + fCheckCookie->iterator = new(std::nothrow) TreeIterator(tree); if (fCheckCookie->iterator == NULL) RETURN_ERROR(B_NO_MEMORY); diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.cpp b/src/add-ons/kernel/file_systems/bfs/Volume.cpp index 9555d6219f..a7166947f3 100644 --- a/src/add-ons/kernel/file_systems/bfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Volume.cpp @@ -356,7 +356,7 @@ Volume::Mount(const char* deviceName, uint32 flags) if ((fBlockCache = opener.InitCache(NumBlocks(), fBlockSize)) == NULL) return B_ERROR; - fJournal = new Journal(this); + fJournal = new(std::nothrow) Journal(this); if (fJournal == NULL) return B_NO_MEMORY; @@ -384,15 +384,17 @@ Volume::Mount(const char* deviceName, uint32 flags) return status; } - fRootNode = new Inode(this, ToVnode(Root())); + fRootNode = new(std::nothrow) Inode(this, ToVnode(Root())); if (fRootNode != NULL && fRootNode->InitCheck() == B_OK) { status = publish_vnode(fVolume, ToVnode(Root()), (void*)fRootNode, &gBFSVnodeOps, fRootNode->Mode(), 0); if (status == B_OK) { // try to get indices root dir - if (!Indices().IsZero()) - fIndicesNode = new Inode(this, ToVnode(Indices())); + if (!Indices().IsZero()) { + fIndicesNode = new(std::nothrow) Inode(this, + ToVnode(Indices())); + } if (fIndicesNode == NULL || fIndicesNode->InitCheck() < B_OK @@ -690,7 +692,7 @@ Volume::Initialize(int fd, const char* name, uint32 blockSize, if ((fBlockCache = opener.InitCache(NumBlocks(), fBlockSize)) == NULL) return B_ERROR; - fJournal = new Journal(this); + fJournal = new(std::nothrow) Journal(this); if (fJournal == NULL || fJournal->InitCheck() < B_OK) RETURN_ERROR(B_ERROR); From 105eeb9c848f63c5e8c18ceff9180383f5977229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 7 Aug 2011 14:53:10 +0000 Subject: [PATCH 142/702] When checkfs stop checking, the block allocator tries to write more blocks than present in fCheckBitmap, so we constrain it to fNumBlocks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42594 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index 257fb3d872..e4643667d4 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -1326,6 +1326,8 @@ BlockAllocator::StopChecking(check_control* control) int32 blocksInBitmap = fNumGroups * fBlocksPerGroup; size_t blockSize = fVolume->BlockSize(); + if (blocksInBitmap > (int32)fNumBlocks) + blocksInBitmap = fNumBlocks; for (int32 i = 0; i < blocksInBitmap; i += 512) { Transaction transaction(fVolume, 1 + i); From dc036ee5e1d054992d0a6daadc51dde35d3225a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 7 Aug 2011 15:42:21 +0000 Subject: [PATCH 143/702] * Minor simplification. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42595 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/bfs/BlockAllocator.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index e4643667d4..ceb5f0dc7f 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -1324,17 +1324,14 @@ BlockAllocator::StopChecking(check_control* control) fVolume->SuperBlock().used_blocks = HOST_ENDIAN_TO_BFS_INT64(usedBlocks); - int32 blocksInBitmap = fNumGroups * fBlocksPerGroup; size_t blockSize = fVolume->BlockSize(); - if (blocksInBitmap > (int32)fNumBlocks) - blocksInBitmap = fNumBlocks; - for (int32 i = 0; i < blocksInBitmap; i += 512) { + for (uint32 i = 0; i < fNumBlocks; i += 512) { Transaction transaction(fVolume, 1 + i); - int32 blocksToWrite = 512; - if (blocksToWrite + i > blocksInBitmap) - blocksToWrite = blocksInBitmap - i; + uint32 blocksToWrite = 512; + if (blocksToWrite + i > fNumBlocks) + blocksToWrite = fNumBlocks - i; status_t status = transaction.WriteBlocks(1 + i, (uint8*)fCheckBitmap + i * blockSize, blocksToWrite); From c9c7be9a542ef73705afae1119f5ad0b1b219628 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 7 Aug 2011 20:16:32 +0000 Subject: [PATCH 144/702] * add initial set of Northern Island cards * add igp property to pciid map * add disabled bios pull for r700 and ni cards * refactor model numbering as >R700 AMD switched to named card families git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42596 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 13 +- src/add-ons/accelerants/radeon_hd/display.cpp | 4 +- .../drivers/graphics/radeon_hd/driver.cpp | 170 +++++++++++------- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 93 +++++++++- 4 files changed, 205 insertions(+), 75 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 487ba22dba..979d44ae56 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -25,11 +25,16 @@ #include -#define VENDOR_ID_ATI 0x1002 +#define VENDOR_ID_ATI 0x1002 -#define RADEON_R600 0x0600 -#define RADEON_R700 0x0700 -#define RADEON_R800 0x0800 +#define RADEON_R520 0x0520 // Fudo +#define RADEON_R580 0x0580 // Rodin +#define RADEON_R600 0x0600 // Pele +#define RADEON_R700 0x0700 // Wekiva +#define RADEON_R1000 0x1000 // Evergreen +#define RADEON_R2000 0x2000 // Northern Islands +#define RADEON_R3000 0x3000 // Southern Islands +#define RADEON_R4000 0x4000 // Not yet known / used #define RADEON_VBIOS_SIZE 0x10000 diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 4584d9ac59..4bae5adabf 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -33,7 +33,7 @@ init_registers(register_info* regs, uint8 crtid) radeon_shared_info &info = *gInfo->shared_info; - if (info.device_chipset >= RADEON_R800) { + if (info.device_chipset >= RADEON_R1000) { uint32 offset = 0; // AMD Eyefinity on Evergreen GPUs @@ -89,7 +89,7 @@ init_registers(register_info* regs, uint8 crtid) regs->viewportSize = offset + EVERGREEN_VIEWPORT_SIZE; } else if (info.device_chipset >= RADEON_R600 - && info.device_chipset < RADEON_R800) { + && info.device_chipset < RADEON_R1000) { // r600 - r700 are D1 or D2 based on primary / secondary crt regs->vgaControl diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 4dc181ba56..5d5fa8b7c1 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -39,87 +39,123 @@ const struct supported_device { uint32 device_id; uint16 chipset; + bool igp; const char* name; } kSupportedDevices[] = { // R600 series (HD24xx - HD42xx) // Codename: Pele - {0x94c7, RADEON_R600 | 0x10, "Radeon HD 2350"}, /*RV610*/ - {0x94c1, RADEON_R600 | 0x10, "Radeon HD 2400"}, /*RV610, IGP*/ - {0x94c3, RADEON_R600 | 0x10, "Radeon HD 2400"}, /*RV610*/ - {0x94cc, RADEON_R600 | 0x10, "Radeon HD 2400"}, /*RV610*/ - {0x9586, RADEON_R600 | 0x30, "Radeon HD 2600"}, /*RV630*/ - {0x9588, RADEON_R600 | 0x30, "Radeon HD 2600"}, /*RV630*/ - {0x958a, RADEON_R600 | 0x30, "Radeon HD 2600 X2"},/*RV630*/ + {0x94c7, RADEON_R600 | 0x10, false, "Radeon HD 2350"}, + {0x94c1, RADEON_R600 | 0x10, true, "Radeon HD 2400"}, + {0x94c3, RADEON_R600 | 0x10, false, "Radeon HD 2400"}, + {0x94cc, RADEON_R600 | 0x10, false, "Radeon HD 2400"}, + {0x9586, RADEON_R600 | 0x30, false, "Radeon HD 2600"}, + {0x9588, RADEON_R600 | 0x30, false, "Radeon HD 2600"}, + {0x958a, RADEON_R600 | 0x30, false, "Radeon HD 2600 X2"}, // Radeon 2700 - RV630 - {0x9400, RADEON_R600 | 0x0, "Radeon HD 2900"}, /*RV600*/ - {0x9405, RADEON_R600 | 0x0, "Radeon HD 2900"}, /*RV600*/ - {0x9611, RADEON_R600 | 0x20, "Radeon HD 3100"}, /*RV620, IGP*/ - {0x9613, RADEON_R600 | 0x20, "Radeon HD 3100"}, /*RV620, IGP*/ - {0x9610, RADEON_R600 | 0x10, "Radeon HD 3200"}, /*RV610, IGP*/ - {0x9612, RADEON_R600 | 0x10, "Radeon HD 3200"}, /*RV610, IGP*/ - {0x9615, RADEON_R600 | 0x10, "Radeon HD 3200"}, /*RV610, IGP*/ - {0x9614, RADEON_R600 | 0x10, "Radeon HD 3300"}, /*RV610, IGP*/ + {0x9400, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x9405, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x9611, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, + {0x9613, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, + {0x9610, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, + {0x9612, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, + {0x9615, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, + {0x9614, RADEON_R600 | 0x10, true, "Radeon HD 3300"}, // Radeon 3430 - RV620 - {0x95c5, RADEON_R600 | 0x20, "Radeon HD 3450"}, /*RV620*/ - {0x95c6, RADEON_R600 | 0x20, "Radeon HD 3450"}, /*RV620*/ - {0x95c7, RADEON_R600 | 0x20, "Radeon HD 3450"}, /*RV620*/ - {0x95c9, RADEON_R600 | 0x20, "Radeon HD 3450"}, /*RV620*/ - {0x95c4, RADEON_R600 | 0x20, "Radeon HD 3470"}, /*RV620*/ - {0x95c0, RADEON_R600 | 0x20, "Radeon HD 3550"}, /*RV620*/ - {0x9581, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ - {0x9583, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ - {0x9598, RADEON_R600 | 0x30, "Radeon HD 3600"}, /*RV630*/ - {0x9591, RADEON_R600 | 0x35, "Radeon HD 3600"}, /*RV635*/ - {0x9589, RADEON_R600 | 0x30, "Radeon HD 3610"}, /*RV630*/ + {0x95c5, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, + {0x95c6, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, + {0x95c7, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, + {0x95c9, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, + {0x95c4, RADEON_R600 | 0x20, false, "Radeon HD 3470"}, + {0x95c0, RADEON_R600 | 0x20, false, "Radeon HD 3550"}, + {0x9581, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, + {0x9583, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, + {0x9598, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, + {0x9591, RADEON_R600 | 0x35, false, "Radeon HD 3600"}, + {0x9589, RADEON_R600 | 0x30, false, "Radeon HD 3610"}, // Radeon 3650 - RV635 // Radeon 3670 - RV635 - {0x9507, RADEON_R600 | 0x70, "Radeon HD 3830"}, /*RV670*/ - {0x9505, RADEON_R600 | 0x70, "Radeon HD 3850"}, /*RV670, IGP*/ - {0x9513, RADEON_R600 | 0x80, "Radeon HD 3850 X2"},/*RV670*/ - {0x9501, RADEON_R600 | 0x70, "Radeon HD 3870"}, /*RV670*/ - {0x950F, RADEON_R600 | 0x80, "Radeon HD 3870 X2"},/*R680*/ - {0x9710, RADEON_R600 | 0x20, "Radeon HD 4200"}, /*RV620, IGP*/ - {0x9715, RADEON_R600 | 0x20, "Radeon HD 4250"}, /*RV620, IGP*/ - {0x9712, RADEON_R600 | 0x20, "Radeon HD 4270"}, /*RV620, IGP*/ - {0x9714, RADEON_R600 | 0x20, "Radeon HD 4290"}, /*RV620, IGP*/ + {0x9507, RADEON_R600 | 0x70, false, "Radeon HD 3830"}, + {0x9505, RADEON_R600 | 0x70, false, "Radeon HD 3850"}, + {0x9513, RADEON_R600 | 0x80, false, "Radeon HD 3850 X2"}, + {0x9501, RADEON_R600 | 0x70, false, "Radeon HD 3870"}, + {0x950F, RADEON_R600 | 0x80, false, "Radeon HD 3870 X2"}, + {0x9710, RADEON_R600 | 0x20, true, "Radeon HD 4200"}, + {0x9715, RADEON_R600 | 0x20, true, "Radeon HD 4250"}, + {0x9712, RADEON_R600 | 0x20, true, "Radeon HD 4270"}, + {0x9714, RADEON_R600 | 0x20, true, "Radeon HD 4290"}, // R700 series (HD4330 - HD4890, HD51xx, HD5xxV) // Codename: Wekiva // Radeon 4330 - RV710 - {0x954f, RADEON_R700 | 0x10, "Radeon HD 4300"}, /*RV710*/ - {0x9552, RADEON_R700 | 0x10, "Radeon HD 4300"}, /*RV710*/ - {0x9555, RADEON_R700 | 0x10, "Radeon HD 4350"}, /*RV710*/ - {0x9540, RADEON_R700 | 0x10, "Radeon HD 4550"}, /*RV710*/ - {0x9498, RADEON_R700 | 0x30, "Radeon HD 4650"}, /*RV740*/ - {0x94b4, RADEON_R700 | 0x40, "Radeon HD 4700"}, /*RV740*/ - {0x9490, RADEON_R700 | 0x30, "Radeon HD 4710"}, /*RV740*/ - {0x94b3, RADEON_R700 | 0x40, "Radeon HD 4770"}, /*RV740*/ - {0x94b5, RADEON_R700 | 0x40, "Radeon HD 4770"}, /*RV740*/ - {0x944a, RADEON_R700 | 0x70, "Radeon HD 4800"}, /*RV740*/ - {0x944e, RADEON_R700 | 0x70, "Radeon HD 4810"}, /*RV740*/ - {0x944c, RADEON_R700 | 0x70, "Radeon HD 4830"}, /*RV740*/ - {0x9442, RADEON_R700 | 0x70, "Radeon HD 4850"}, /*RV770*/ - {0x9443, RADEON_R700 | 0x70, "Radeon HD 4850 X2"},/*RV770*/ - {0x94a1, RADEON_R700 | 0x90, "Radeon HD 4860"}, /*RV780, IGP*/ - {0x9440, RADEON_R700 | 0x70, "Radeon HD 4870"}, /*RV770*/ - {0x9441, RADEON_R700 | 0x70, "Radeon HD 4870 X2"},/*RV770*/ + {0x954f, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, + {0x9552, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, + {0x9555, RADEON_R700 | 0x10, false, "Radeon HD 4350"}, + {0x9540, RADEON_R700 | 0x10, false, "Radeon HD 4550"}, + {0x9498, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, + {0x94b4, RADEON_R700 | 0x40, false, "Radeon HD 4700"}, + {0x9490, RADEON_R700 | 0x30, false, "Radeon HD 4710"}, + {0x94b3, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, + {0x94b5, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, + {0x944a, RADEON_R700 | 0x70, false, "Radeon HD 4800"}, + {0x944e, RADEON_R700 | 0x70, false, "Radeon HD 4810"}, + {0x944c, RADEON_R700 | 0x70, false, "Radeon HD 4830"}, + {0x9442, RADEON_R700 | 0x70, false, "Radeon HD 4850"}, + {0x9443, RADEON_R700 | 0x70, false, "Radeon HD 4850 X2"}, + {0x94a1, RADEON_R700 | 0x90, true, "Radeon HD 4860"}, + {0x9440, RADEON_R700 | 0x70, false, "Radeon HD 4870"}, + {0x9441, RADEON_R700 | 0x70, false, "Radeon HD 4870 X2"}, - // R800 series (HD54xx - HD59xx) + // From here on AMD no longer used numeric identifiers + + // R1000 series (HD54xx - HD59xx) // Codename: Evergreen - {0x68e1, RADEON_R800 | 0x0, "Radeon HD 5430"}, /*RV8XX*/ - {0x68f9, RADEON_R800 | 0x0, "Radeon HD 5450"}, /*RV8XX*/ - {0x68e0, RADEON_R800 | 0x0, "Radeon HD 5470"}, /*RV8XX*/ - {0x68da, RADEON_R800 | 0x0, "Radeon HD 5500"}, /*RV8XX*/ - {0x68d9, RADEON_R800 | 0x0, "Radeon HD 5570"}, /*RV8XX*/ - {0x68b9, RADEON_R800 | 0x0, "Radeon HD 5600"}, /*RV8XX*/ - {0x68c1, RADEON_R800 | 0x0, "Radeon HD 5650"}, /*RV8XX*/ - {0x68d8, RADEON_R800 | 0x0, "Radeon HD 5670"}, /*RV8XX*/ - {0x68be, RADEON_R800 | 0x0, "Radeon HD 5700"}, /*RV8XX*/ - {0x68b8, RADEON_R800 | 0x0, "Radeon HD 5770"}, /*RV8XX*/ - {0x689e, RADEON_R800 | 0x0, "Radeon HD 5800"}, /*RV8XX*/ - {0x6899, RADEON_R800 | 0x0, "Radeon HD 5850"}, /*RV8XX*/ - {0x6898, RADEON_R800 | 0x0, "Radeon HD 5870"}, /*RV8XX*/ - {0x689c, RADEON_R800 | 0x0, "Radeon HD 5900"} /*RV8XX*/ + // Cedar + {0x68e1, RADEON_R1000 | 0x00, false, "Radeon HD 5430"}, + {0x68f9, RADEON_R1000 | 0x00, false, "Radeon HD 5450"}, + {0x68e0, RADEON_R1000 | 0x00, true, "Radeon HD 5470"}, + // Redwood + {0x68da, RADEON_R1000 | 0x10, false, "Radeon HD 5500"}, + {0x68d9, RADEON_R1000 | 0x10, false, "Radeon HD 5570"}, + {0x68b9, RADEON_R1000 | 0x10, false, "Radeon HD 5600"}, + {0x68c1, RADEON_R1000 | 0x10, false, "Radeon HD 5650"}, + {0x68d8, RADEON_R1000 | 0x10, false, "Radeon HD 5670"}, + // Juniper + {0x68be, RADEON_R1000 | 0x20, false, "Radeon HD 5700"}, + {0x68b8, RADEON_R1000 | 0x20, false, "Radeon HD 5770"}, + // Cypress + {0x689e, RADEON_R1000 | 0x30, false, "Radeon HD 5800"}, + {0x6899, RADEON_R1000 | 0x30, false, "Radeon HD 5850"}, + {0x6898, RADEON_R1000 | 0x30, false, "Radeon HD 5870"}, + // Hemlock + {0x689c, RADEON_R1000 | 0x40, false, "Radeon HD 5900"}, + + // R2000 series (HD64xx - HD69xx) + // Codename: Nothern Islands + // Caicos + {0x6770, RADEON_R2000 | 0x00, true, "Radeon HD 6400"}, + {0x6779, RADEON_R2000 | 0x00, false, "Radeon HD 6450"}, + // Turks + {0x6759, RADEON_R2000 | 0x10, false, "Radeon HD 6570"}, + {0x6741, RADEON_R2000 | 0x10, true, "Radeon HD 6650M"}, + // Barts + {0x673e, RADEON_R2000 | 0x20, false, "Radeon HD 6790"}, + {0x6739, RADEON_R2000 | 0x20, false, "Radeon HD 6850"}, + {0x6738, RADEON_R2000 | 0x20, false, "Radeon HD 6870"}, + // Cayman + {0x6718, RADEON_R2000 | 0x30, false, "Radeon HD 6970"}, + // Antilles + {0x671d, RADEON_R2000 | 0x40, false, "Radeon HD 6990"} + + // R3000 series (HD74xx - HD79xx) + // Codename: Southern Islands + // Lombok + // R3000 | 0x00 + // Thames + // R3000 | 0x10 + // Tahiti + // R3000 | 0x20 + // New Zealand + // R3000 | 0x30 }; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index fec20e3ec7..161d008372 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -155,6 +155,89 @@ radeon_hd_getbios(radeon_info &info) } +status_t +radeon_hd_getbios_ni(radeon_info &info) +{ + TRACE("card(%ld): %s: called\n", info.id, __func__); + uint32 bus_cntl = read32(info.registers + R600_BUS_CNTL); + uint32 d1vga_control = read32(info.registers + AVIVO_D1VGA_CONTROL); + uint32 d2vga_control = read32(info.registers + AVIVO_D2VGA_CONTROL); + uint32 vga_render_control + = read32(info.registers + AVIVO_VGA_RENDER_CONTROL); + uint32 rom_cntl = read32(info.registers + R600_ROM_CNTL); + + // enable the rom + write32(info.registers + R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); + // disable VGA mode + write32(info.registers + AVIVO_D1VGA_CONTROL, (d1vga_control + & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE + | AVIVO_DVGA_CONTROL_TIMING_SELECT))); + write32(info.registers + D2VGA_CONTROL, (d2vga_control + & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE + | AVIVO_DVGA_CONTROL_TIMING_SELECT))); + write32(info.registers + AVIVO_VGA_RENDER_CONTROL, + (vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK)); + + write32(info.registers + R600_ROM_CNTL, (rom_cntl | R600_SCK_OVERWRITE)); + + // try to grab the bios + status_t result = radeon_hd_getbios(info); + + // restore regs + write32(info.registers + R600_BUS_CNTL, bus_cntl); + write32(info.registers + AVIVO_D1VGA_CONTROL, d1vga_control); + write32(info.registers + AVIVO_D2VGA_CONTROL, d2vga_control); + write32(info.registers + AVIVO_VGA_RENDER_CONTROL, vga_render_control); + write32(info.registers + R600_ROM_CNTL, rom_cntl); + + return result; +} + + +status_t +radeon_hd_getbios_r700(radeon_info &info) +{ + TRACE("card(%ld): %s: called\n", info.id, __func__); + uint32 viph_control = read32(info.registers + RADEON_VIPH_CONTROL); + uint32 bus_cntl = read32(info.registers + R600_BUS_CNTL); + uint32 d1vga_control = read32(info.registers + AVIVO_D1VGA_CONTROL); + uint32 d2vga_control = read32(info.registers + AVIVO_D2VGA_CONTROL); + uint32 vga_render_control + = read32(info.registers + AVIVO_VGA_RENDER_CONTROL); + uint32 rom_cntl = read32(info.registers + R600_ROM_CNTL); + + // disable VIP + write32(info.registers + RADEON_VIPH_CONTROL, + (viph_control & ~RADEON_VIPH_EN)); + // enable the rom + write32(info.registers + R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); + // disable VGA mode + write32(info.registers + AVIVO_D1VGA_CONTROL, (d1vga_control + & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE + | AVIVO_DVGA_CONTROL_TIMING_SELECT))); + write32(info.registers + D2VGA_CONTROL, (d2vga_control + & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE + | AVIVO_DVGA_CONTROL_TIMING_SELECT))); + write32(info.registers + AVIVO_VGA_RENDER_CONTROL, + (vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK)); + + write32(info.registers + R600_ROM_CNTL, (rom_cntl | R600_SCK_OVERWRITE)); + + // try to grab the bios + status_t result = radeon_hd_getbios(info); + + // restore regs + write32(info.registers + RADEON_VIPH_CONTROL, viph_control); + write32(info.registers + R600_BUS_CNTL, bus_cntl); + write32(info.registers + AVIVO_D1VGA_CONTROL, d1vga_control); + write32(info.registers + AVIVO_D2VGA_CONTROL, d2vga_control); + write32(info.registers + AVIVO_VGA_RENDER_CONTROL, vga_render_control); + write32(info.registers + R600_ROM_CNTL, rom_cntl); + + return result; +} + + status_t radeon_hd_getbios_r600(radeon_info &info) { @@ -304,7 +387,13 @@ radeon_hd_init(radeon_info &info) status_t biosStatus = radeon_hd_getbios(info); if (biosStatus != B_OK) { // If the active read fails, we do a disabled read - if (info.device_chipset > RADEON_R600) + + // TODO : IGP read + if (info.device_chipset >= (RADEON_R1000 | 0x20)) + biosStatus = radeon_hd_getbios_ni(info); + else if (info.device_chipset >= (RADEON_R700 | 0x70)) + biosStatus = radeon_hd_getbios_r700(info); + else if (info.device_chipset >= RADEON_R600) biosStatus = radeon_hd_getbios_r600(info); } @@ -330,7 +419,7 @@ radeon_hd_init(radeon_info &info) } // *** Populate graphics_memory/aperture_size with KB - if (info.shared_info->device_chipset >= RADEON_R800) { + if (info.shared_info->device_chipset >= RADEON_R1000) { // R800+ has memory stored in MB info.shared_info->graphics_memory_size = read32(info.registers + R6XX_CONFIG_MEMSIZE) * 1024; From 5348fbe6893cffbd5ba94dfe88d575eac1d65193 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 7 Aug 2011 20:24:34 +0000 Subject: [PATCH 145/702] * fix trace typedef size to fix iso9660 tracing git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42597 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/iso9660/iso9660.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp index 3561bec2ea..80c7b10ef9 100644 --- a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp @@ -870,7 +870,8 @@ InitNode(iso9660_volume* volume, iso9660_inode* node, char* buffer, // for relocated directories we take the name from the placeholder entry if (!relocated) { node->name_length = nameLength; - TRACE(("InitNode - file id length is %u\n", node->name_length)); + TRACE(("InitNode - file id length is %" B_PRIu32 "\n", + node->name_length)); } // Set defaults, in case there is no RockRidge stuff. From b6455c080b61ccff5a6c3fc6d35761ed040b6fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 7 Aug 2011 21:01:23 +0000 Subject: [PATCH 146/702] * Implemented dladdr() in the runtime loader. This is like a gazillion times faster than before. * This also solves a TODO in dladdr(), although I did not use get_library_symbol() as I didn't quite see how that could fit as the comment suggested; there is now a new function get_symbol_at_address() for this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42598 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/runtime_loader/runtime_loader.h | 9 ++- src/system/libroot/posix/dlfcn.c | 67 ++++++------------- src/system/runtime_loader/elf.cpp | 53 ++++++++++++++- src/system/runtime_loader/export.cpp | 3 +- src/system/runtime_loader/images.cpp | 18 ++++- src/system/runtime_loader/images.h | 3 +- .../runtime_loader/runtime_loader_private.h | 4 +- 7 files changed, 101 insertions(+), 56 deletions(-) diff --git a/headers/private/runtime_loader/runtime_loader.h b/headers/private/runtime_loader/runtime_loader.h index 86e33ee53d..05a2d74f6d 100644 --- a/headers/private/runtime_loader/runtime_loader.h +++ b/headers/private/runtime_loader/runtime_loader.h @@ -1,6 +1,6 @@ /* * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Manuel J. Petit. All rights reserved. @@ -33,8 +33,11 @@ struct rld_export { int32 symbolType, bool recursive, image_id *_inImage, void **_location); status_t (*get_library_symbol)(void* handle, void* caller, const char* symbolName, void **_location); - status_t (*get_nth_image_symbol)(image_id imageID, int32 num, char *symbolName, - int32 *nameLength, int32 *symbolType, void **_location); + status_t (*get_nth_image_symbol)(image_id imageID, int32 num, + char *symbolName, int32 *nameLength, int32 *symbolType, + void **_location); + status_t (*get_symbol_at_address)(void* address, image_id* _imageID, + char* nameBuffer, int32* _nameLength, int32* _type, void** _location); status_t (*test_executable)(const char *path, char *interpreter); status_t (*get_next_image_dependency)(image_id id, uint32 *cookie, const char **_name); diff --git a/src/system/libroot/posix/dlfcn.c b/src/system/libroot/posix/dlfcn.c index 7d34f20f2a..837eb3ae8e 100644 --- a/src/system/libroot/posix/dlfcn.c +++ b/src/system/libroot/posix/dlfcn.c @@ -72,60 +72,31 @@ dlerror(void) int -dladdr(void *addr, Dl_info *info) +dladdr(void *address, Dl_info *info) { -// TODO: This can be implemented more efficiently in the runtime loader. -// get_library_symbol() already has the code doing that. - char curSymName[NAME_MAX]; - static char symName[NAME_MAX]; - static char imageName[MAXPATHLEN]; - void *symLocation; - int32 cookie; - int32 symType, symNameLength; - uint32 symIndex; - image_info imageInfo; + static char sImageName[MAXPATHLEN]; + static char sSymbolName[NAME_MAX]; - if (info == NULL) + image_id image; + int32 nameLength = sizeof(sSymbolName); + void* location; + image_info imageInfo; + sStatus = __gRuntimeLoader->get_symbol_at_address(address, &image, + sSymbolName, &nameLength, NULL, &location); + if (sStatus != B_OK) return 0; - imageName[0] = '\0'; - symName[0] = '\0'; - info->dli_fname = imageName; - info->dli_saddr = NULL; - info->dli_sname = symName; + sStatus = get_image_info(image, &imageInfo); + if (sStatus != B_OK) + return 0; - cookie = 0; - while (get_next_image_info(0, &cookie, &imageInfo) == B_OK) { - // check if the image holds the symbol - if ((addr_t)addr >= (addr_t)imageInfo.text - && (addr_t)addr < (addr_t)imageInfo.text + imageInfo.text_size) { - strlcpy(imageName, imageInfo.name, MAXPATHLEN); - info->dli_fbase = imageInfo.text; - symIndex = 0; - symNameLength = NAME_MAX; + strlcpy(sImageName, imageInfo.name, MAXPATHLEN); + info->dli_fname = sImageName; + info->dli_fbase = imageInfo.text; + info->dli_sname = sSymbolName; + info->dli_saddr = location; - while (get_nth_image_symbol(imageInfo.id, symIndex, curSymName, - &symNameLength, &symType, &symLocation) == B_OK) { - // check if symbol is the nearest until now - if (symLocation <= addr && symLocation >= info->dli_saddr) { - strlcpy(symName, curSymName, NAME_MAX); - info->dli_saddr = symLocation; - - // stop here if exact match - if (info->dli_saddr == addr) - return 1; - } - symIndex++; - symNameLength = NAME_MAX; - } - break; - } - } - - if (info->dli_saddr != NULL) - return 1; - - return 0; + return 1; } diff --git a/src/system/runtime_loader/elf.cpp b/src/system/runtime_loader/elf.cpp index fd7f9b0225..7423149f06 100644 --- a/src/system/runtime_loader/elf.cpp +++ b/src/system/runtime_loader/elf.cpp @@ -1,6 +1,6 @@ /* * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Manuel J. Petit. All rights reserved. @@ -709,6 +709,57 @@ out: } +status_t +get_symbol_at_address(void* address, image_id* _imageID, char* nameBuffer, + int32* _nameLength, int32* _type, void** _location) +{ + rld_lock(); + + image_t* image = find_loaded_image_by_address((addr_t)address); + if (image == NULL) { + rld_unlock(); + return B_BAD_VALUE; + } + + for (uint32 i = 0; i < HASHTABSIZE(image); i++) { + for (int32 j = HASHBUCKETS(image)[i]; j != STN_UNDEF; + j = HASHCHAINS(image)[j]) { + struct Elf32_Sym *symbol = &image->syms[j]; + addr_t location = symbol->st_value + image->regions[0].delta; + + if (location <= (addr_t)address + && location - 1 + symbol->st_size >= (addr_t)address) { + const char* symbolName = SYMNAME(image, symbol); + strlcpy(nameBuffer, symbolName, *_nameLength); + *_nameLength = strlen(symbolName); + + int32 type; + if (ELF32_ST_TYPE(symbol->st_info) == STT_FUNC) + type = B_SYMBOL_TYPE_TEXT; + else if (ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT) + type = B_SYMBOL_TYPE_DATA; + else + type = B_SYMBOL_TYPE_ANY; + // TODO: check with the return types of that BeOS function + + if (_imageID != NULL) + *_imageID = image->id; + if (_type != NULL) + *_type = type; + if (_location != NULL) + *_location = (void*)location; + + rld_unlock(); + return B_OK; + } + } + } + + rld_unlock(); + return B_BAD_VALUE; +} + + status_t get_symbol(image_id imageID, char const *symbolName, int32 symbolType, bool recursive, image_id *_inImage, void **_location) diff --git a/src/system/runtime_loader/export.cpp b/src/system/runtime_loader/export.cpp index 03b72152f1..00d44ac5b3 100644 --- a/src/system/runtime_loader/export.cpp +++ b/src/system/runtime_loader/export.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Manuel J. Petit. All rights reserved. @@ -51,6 +51,7 @@ struct rld_export gRuntimeLoader = { get_symbol, get_library_symbol, get_nth_symbol, + get_symbol_at_address, test_executable, get_next_image_dependency, diff --git a/src/system/runtime_loader/images.cpp b/src/system/runtime_loader/images.cpp index a35bdd5cbb..0446b6d286 100644 --- a/src/system/runtime_loader/images.cpp +++ b/src/system/runtime_loader/images.cpp @@ -1,6 +1,6 @@ /* * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Manuel J. Petit. All rights reserved. @@ -597,6 +597,22 @@ find_loaded_image_by_id(image_id id, bool ignoreDisposable) } +image_t* +find_loaded_image_by_address(addr_t address) +{ + for (image_t* image = sLoadedImages.head; image; image = image->next) { + for (uint32 i = 0; i < image->num_regions; i++) { + elf_region_t& region = image->regions[i]; + if (region.vmstart <= address + && region.vmstart - 1 + region.vmsize >= address) + return image; + } + } + + return NULL; +} + + void set_image_flags_recursively(image_t* image, uint32 flags) { diff --git a/src/system/runtime_loader/images.h b/src/system/runtime_loader/images.h index a9fa9afdf7..a929040b42 100644 --- a/src/system/runtime_loader/images.h +++ b/src/system/runtime_loader/images.h @@ -1,6 +1,6 @@ /* * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Manuel J. Petit. All rights reserved. @@ -66,6 +66,7 @@ void dequeue_disposable_image(image_t* image); image_t* find_loaded_image_by_name(char const* name, uint32 typeMask); image_t* find_loaded_image_by_id(image_id id, bool ignoreDisposable); +image_t* find_loaded_image_by_address(addr_t address); void set_image_flags_recursively(image_t* image, uint32 flags); void clear_image_flags_recursively(image_t* image, uint32 flags); diff --git a/src/system/runtime_loader/runtime_loader_private.h b/src/system/runtime_loader/runtime_loader_private.h index 1ff95cd41e..76a1de7ac9 100644 --- a/src/system/runtime_loader/runtime_loader_private.h +++ b/src/system/runtime_loader/runtime_loader_private.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Manuel J. Petit. All rights reserved. @@ -65,6 +65,8 @@ image_id load_library(char const* path, uint32 flags, bool addOn, status_t unload_library(void* handle, image_id imageID, bool addOn); status_t get_nth_symbol(image_id imageID, int32 num, char* nameBuffer, int32* _nameLength, int32* _type, void** _location); +status_t get_symbol_at_address(void* address, image_id* _imageID, + char* nameBuffer, int32* _nameLength, int32* _type, void** _location); status_t get_symbol(image_id imageID, char const* symbolName, int32 symbolType, bool recursive, image_id* _inImage, void** _location); status_t get_library_symbol(void* handle, void* caller, const char* symbolName, From aca6ac3cc299b784053a218d0072de668ae94b6c Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Mon, 8 Aug 2011 15:29:35 +0000 Subject: [PATCH 147/702] Added missing gcc2 build of jgmod. This fixes trac ticket #7888. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42599 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalLibPackages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/jam/OptionalLibPackages b/build/jam/OptionalLibPackages index 4acc6c387e..071eb986cf 100644 --- a/build/jam/OptionalLibPackages +++ b/build/jam/OptionalLibPackages @@ -54,8 +54,8 @@ if [ IsOptionalHaikuImagePackageAdded AllegroLibs ] { dumb-0.9.3-x86-r1a3-x86-gcc2-2011-05-19.zip : $(baseURL)/lib/dumb-0.9.3-r1a3-x86-gcc2-2011-05-19.zip ; InstallOptionalHaikuImagePackage - jgmod-0.99-r1a3-x86-gcc2-2011-05-26.zip - : $(baseURL)/lib/jgmod-0.99-r1a3-x86-gcc2-2011-05-26.zip ; + jgmod-0.99-x86-gcc2-2011-08-02.zip + : $(baseURL)/lib/jgmod-0.99-x86-gcc2-2011-08-02.zip ; } } From 18fe0231df37b0245159db147a65f429b986220e Mon Sep 17 00:00:00 2001 From: "Bruno G. Albuquerque" Date: Mon, 8 Aug 2011 16:13:56 +0000 Subject: [PATCH 148/702] Add initial vesa modes even if EDID information is present. EDID does not include all supported video modes. Fixes #4166. Note that this change will probably show several weird resolution is some configurations. They are all valid resolutions but are not commom so we need a way to filter those out. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42600 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/vesa/mode.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/add-ons/accelerants/vesa/mode.cpp b/src/add-ons/accelerants/vesa/mode.cpp index 5780015e10..064b88f8f4 100644 --- a/src/add-ons/accelerants/vesa/mode.cpp +++ b/src/add-ons/accelerants/vesa/mode.cpp @@ -76,23 +76,21 @@ create_mode_list(void) const color_space kVesaSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE, B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8}; - // Create the initial list from the support mode list - but only if we don't - // have EDID info available, as that should be good enough. display_mode* initialModes = NULL; uint32 initialModesCount = 0; - if (!gInfo->shared_info->has_edid) { - initialModes = (display_mode*)malloc( - sizeof(display_mode) * gInfo->shared_info->vesa_mode_count); - if (initialModes != NULL) { - initialModesCount = gInfo->shared_info->vesa_mode_count; - vesa_mode* vesaModes = gInfo->vesa_modes; - for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) { - compute_display_timing(vesaModes[i].width, vesaModes[i].height, - 60, false, &initialModes[i].timing); - fill_display_mode(vesaModes[i].width, vesaModes[i].height, - &initialModes[i]); - } + // Add initial VESA modes. + initialModes = (display_mode*)malloc( + sizeof(display_mode) * gInfo->shared_info->vesa_mode_count); + if (initialModes != NULL) { + initialModesCount = gInfo->shared_info->vesa_mode_count; + vesa_mode* vesaModes = gInfo->vesa_modes; + + for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) { + compute_display_timing(vesaModes[i].width, vesaModes[i].height, + 60, false, &initialModes[i].timing); + fill_display_mode(vesaModes[i].width, vesaModes[i].height, + &initialModes[i]); } } From 336835776bbfdf3d63fa587f8b18a4b631eb0752 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 8 Aug 2011 18:36:45 +0000 Subject: [PATCH 149/702] * clean up tracing and exit gracefully to vesa if we can't locate an AtomBIOS for the card. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42601 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 161d008372..b73f5089f1 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -86,7 +86,7 @@ radeon_hd_getbios(radeon_info &info) status_t result = B_ERROR; if (rom_base == 0 || rom_size == 0) { // FAIL: we never found a base to work off of. - TRACE("%s: no VGA rom located, disabling AtomBIOS\n", __func__); + dprintf(DEVICE_NAME ": %s: no rom address located.\n", __func__); result = B_ERROR; } else { area_id rom_area = map_physical_memory("radeon hd rom", @@ -101,7 +101,8 @@ radeon_hd_getbios(radeon_info &info) if (bios[0] != 0x55 || bios[1] != 0xAA) { // FAIL : not a PCI rom uint16 id = bios[0] + (bios[1] << 8); - TRACE("%s: this isn't a PCI rom (%X)\n", __func__, id); + dprintf(DEVICE_NAME ": %s: this isn't a PCI rom (%X)\n", + __func__, id); result = B_ERROR; } else if (isAtomBIOS(bios)) { info.rom_area = create_area("radeon hd AtomBIOS", @@ -134,7 +135,7 @@ radeon_hd_getbios(radeon_info &info) } } } else { - dprintf(DEVICE_NAME ": %s: PCI rom found wasn't identified" + dprintf(DEVICE_NAME ": %s: rom found wasn't identified" " as AtomBIOS!\n", __func__); result = B_ERROR; } @@ -322,6 +323,10 @@ radeon_hd_init(radeon_info &info) { TRACE("card(%ld): %s: called\n", info.id, __func__); + dprintf(DEVICE_NAME ": card(%ld): " + "Radeon r%" B_PRIX16 " 1002:%" B_PRIX32 "\n", + info.id, info.device_chipset, info.device_id); + // *** Map shared info AreaKeeper sharedCreator; info.shared_area = sharedCreator.Create("radeon hd shared info", @@ -397,8 +402,16 @@ radeon_hd_init(radeon_info &info) biosStatus = radeon_hd_getbios_r600(info); } - // TODO : may want to just return B_ERROR if AtomBIOS isn't - // found as we will require it in the future + // Check if a valid AtomBIOS image was found. + if (biosStatus != B_OK) { + dprintf(DEVICE_NAME ": card (%ld): couldn't find AtomBIOS rom!\n", + info.id); + dprintf(DEVICE_NAME ": card (%ld): exiting. Please open a bug ticket" + " at haiku-os.org with your /var/log/syslog\n", + info.id); + // Fallback to VESA + return B_ERROR; + } info.shared_info->has_rom = (biosStatus == B_OK) ? true : false; info.shared_info->rom_area = (biosStatus == B_OK) ? info.rom_area : -1; From 98e30c67df0bd2224c3c2b136f14be4f63f52181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 8 Aug 2011 21:11:03 +0000 Subject: [PATCH 150/702] =?UTF-8?q?*=20Fixed=20style=20violation=20(tab=20?= =?UTF-8?q?before=20'{'=20that=20J=C3=83=C2=A9r=C3=83=C2=B4me=20already=20?= =?UTF-8?q?mentioned),=20and=20=20=20merged=20the=20two=20ifs.=20*=20Autom?= =?UTF-8?q?atic=20white=20space=20cleanup.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42602 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/input/InputServer.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index 767994112d..8b44ef8eb5 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010, Haiku, Inc. All Rights Reserved. + * Copyright 2002-2011, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ @@ -1017,14 +1017,14 @@ InputServer::SetNextMethod(bool direction) int32 index = gInputMethodList.IndexOf(fActiveMethod); int32 oldIndex = index; - + index += (direction ? 1 : -1); if (index < -1) index = gInputMethodList.CountItems() - 1; if (index >= gInputMethodList.CountItems()) index = -1; - + if (index == oldIndex) return B_BAD_INDEX; @@ -1465,7 +1465,7 @@ InputServer::_UpdateMouseAndKeys(EventList& events) // we scan for Alt+Space key down events which means we change // to next input method // (pressing "shift" will let us switch to the previous method) - + // If there is only one input method, SetNextMethod will return // B_BAD_INDEX and the event will be forwarded to the user. @@ -1476,15 +1476,14 @@ InputServer::_UpdateMouseAndKeys(EventList& events) if (event->FindInt8("byte", (int8*)&byte) < B_OK) byte = 0; - if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') - || byte == B_HANKAKU_ZENKAKU) { - if (SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)) - == B_OK) { - // this event isn't sent to the user - events.RemoveItemAt(index); - delete event; - continue; - } + if ((((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') + || byte == B_HANKAKU_ZENKAKU) + && SetNextMethod((fKeyInfo.modifiers & B_SHIFT_KEY) == 0) + == B_OK) { + // this event isn't sent to the user + events.RemoveItemAt(index); + delete event; + continue; } break; } From fac7d5932298b4483205feb7cbf514424ed6aa1e Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Tue, 9 Aug 2011 16:40:03 +0000 Subject: [PATCH 151/702] Added a page on Mail and a little workshop so people can have a look and suggest improvements before putting it into the online tool. Which still has the problem of broken image upload and export of all pages... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42603 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/userguide/en/applications/mail.html | 132 ++++++++++++++- .../images/apps-images/mail-attachments.png | Bin 0 -> 38083 bytes .../images/apps-images/mail-preferences.png | Bin 0 -> 41005 bytes .../en/images/apps-images/mail-read.png | Bin 0 -> 40159 bytes .../en/images/apps-images/mail-signature.png | Bin 0 -> 13911 bytes .../en/images/apps-images/mail-spellcheck.png | Bin 0 -> 29681 bytes .../en/images/apps-images/mail-write.png | Bin 0 -> 28856 bytes .../prefs-images/e-mail-new-account-2.png | Bin 0 -> 15111 bytes .../images/workshop-email-images/browsing.png | Bin 0 -> 77633 bytes .../daemon-in-deskbar.png | Bin 0 -> 8003 bytes .../images/workshop-email-images/query-1.png | Bin 0 -> 9049 bytes .../images/workshop-email-images/query-2.png | Bin 0 -> 9603 bytes .../images/workshop-email-images/query-3.png | Bin 0 -> 12488 bytes .../images/workshop-email-images/query-4.png | Bin 0 -> 12713 bytes .../images/workshop-email-images/status.png | Bin 0 -> 48977 bytes docs/userguide/en/workshop-email.html | 150 ++++++++++++++++++ 16 files changed, 277 insertions(+), 5 deletions(-) create mode 100644 docs/userguide/en/images/apps-images/mail-attachments.png create mode 100644 docs/userguide/en/images/apps-images/mail-preferences.png create mode 100644 docs/userguide/en/images/apps-images/mail-read.png create mode 100644 docs/userguide/en/images/apps-images/mail-signature.png create mode 100644 docs/userguide/en/images/apps-images/mail-spellcheck.png create mode 100644 docs/userguide/en/images/apps-images/mail-write.png create mode 100644 docs/userguide/en/images/prefs-images/e-mail-new-account-2.png create mode 100644 docs/userguide/en/images/workshop-email-images/browsing.png create mode 100644 docs/userguide/en/images/workshop-email-images/daemon-in-deskbar.png create mode 100644 docs/userguide/en/images/workshop-email-images/query-1.png create mode 100644 docs/userguide/en/images/workshop-email-images/query-2.png create mode 100644 docs/userguide/en/images/workshop-email-images/query-3.png create mode 100644 docs/userguide/en/images/workshop-email-images/query-4.png create mode 100644 docs/userguide/en/images/workshop-email-images/status.png create mode 100644 docs/userguide/en/workshop-email.html diff --git a/docs/userguide/en/applications/mail.html b/docs/userguide/en/applications/mail.html index 800d671a90..25145be833 100644 --- a/docs/userguide/en/applications/mail.html +++ b/docs/userguide/en/applications/mail.html @@ -4,7 +4,7 @@ + diff --git a/docs/userguide/en/images/apps-images/mail-attachments.png b/docs/userguide/en/images/apps-images/mail-attachments.png new file mode 100644 index 0000000000000000000000000000000000000000..6e6ea10d8a305c87a0644586c623ac92af7a1150 GIT binary patch literal 38083 zcmZ_0bwE_#)<0~}NSD%$v>-i%beE(c4blxmgGe`sgi-?1IW!EN(hWm*2t!NPd(iKF z?tPx$ea}DYK4=+Pq#Ss979j~+b%J$m$b3eBdO&NPkJzvE?ue=Al{m|!ViKPBELAPM#YCB5U z>QogMWNK==l z53aY{WqZF}a5!9LPfN%ynqM-w#E!l#5tcI!iHt112~RV~lUYWViW5WT&)6bocl9+Y zP!Wv@xxS^p_Ty`*z&QXrmK068{1{(Nb}-Fv7sQstnydvcUuUI`hCts^{JZ}a z(Mi+Wa$?Fw7^0$$x>8IyTQ8{rK{ zL^e_wQ!RDNl9Eejh<~(073Zh=D1IFTt)4|8AFe_oOZ<(kmJ}LDaT$f64MqYvJN@vn z9or(Ek9rStE@|HmJH=~VdGE12g1g4c>H$X%bmo&4q~KtO^Qx|`rzvYnQx?^Itn_~E z({k5`KB`LFl=R9IfxvhY|yT?`;6{VJ%Ra~yEQq$?!Y0MW%M zu)xn#cAq-l$54#*H9EY-TES8IG%uvbu4eIZvi)c zi6D$$Q%p%pxtAkjZcB-lnFe~a@Aq1Gb0PXnpE#%Mmi)jRGfA%bLV3u*#u6n&~{}<9kC-#K{ZcOUNF+KJA~W4th%r9uw7L4j;}D8_^`)Df0}T*y@4oHTtWC` zEmHRKz1f0Gb-_;xH^u_w1K&hg^BdpJ^>>R4bnJ_V>+`?wWp?saeVCz%TF1vJ6lG~q zDPzuy6{s1Y?(V*KB~B5&86(w9XzIeHpYa5K!he(>eEwt1EyfJcl)!oD8%HtZ-n$38 zG|;BSlRwL=^J!oWo_w{ju#i+0PrCMA)gbdFr)dm5mwXY4T}E$HKSd=pJF*4#+b*@V z{o1Fz1fviVRw}!sSqJMO|B$O0I+yOXb>A|6P%seT@8A4oDG%`&hku-c?X5?_x>?A^ zwLnpV@+Dt_k-fUV$o}wd#_|4rsh|4tdk&98w}>#U_}vu0Nbg1hX3a08&gT}`!X`z` zrC@@Y!a1nBM_ca34XR#Imefpkk#}Z5)uSMvq`!`g0F?T%H-O@iBpMlQ!}=dH2XxhA zp9po(&`kSr%@n5l*O{;9yS5o#=VUlbszsJQy8X}ChV~I}x_+F~XVWl|>~`d+?xPKN zR+c!P6l2{(HNJBwL@FK$W>=1#oG>hjl(`NuyNy4&TppL*4V}1EJRCP2o{ySiY1vs< zQ%w!uwle9YaN}k#HFp$693qG}_i#&UbniG>y`^amlR7Oaey_C(`q^o1zDCQR8{ld; zE6>B-BLdfHRIt^hwB^_!OcBwTF3eXw+h#J@rkv6G4+X5A!gXrtr2kvU$Hyx*kpm06kmz>v=q`e7BUUCy5~#{xdmly zq7|PObCudlPFE=LvcHe9qYtayOTPMS^6lNGoj`g^4pn*}((-jP;y9t29mgeJgQjFu zg|ybC81hjK+BI7k87F7OF*A6KL_W50luB${hDSv1k9tOYSvqYRYRrI!M06fF$(SKj zCOnr$_kjsK&vq@RIkPP(;w0y=WW{);y3PKDT>6R!`A(1>3oC3%FlPRi%)qXwh?Cvz z>@q8=1$E%0Gj2fljYrQ9+u!0b-GmO1v5=qysvSg_(bfu*)rOivlfz9C@y8sYy=A+S zGA&bH2Yt0H7|4)_-PW#8 zh`ZLQcgoBz{vT5f!Q=3-_+1P6F~rb^HMmqOevE2=<2*@XjkHnfj_B&lnBb8RN=C+9 z%gMC|{Z~kqbz%s8BEeE6^|9=+f&x=3v;s#evb?R*z4q-_tuWXq#L1fEU(uEp27rKn zMR|syFaH4mJV*#pKaJQPcVY5AK!Go=7b(2^J(cFehyCm=z`)_!V^M4g4@wS>xK2z_ zU;ulAD9AYEgcju!Fw4t+nO$PwpXmoUz#RnDL>xLWxsa#C!*d9#o7k*i-`i8IhbJjR zIYV@ex6bzF9&U+Zo1s;AM%RGFwDMIlCl03A&^`XlDE7R%b7(MySEC&j!Q)2<{w*6O z{)YTZtgbXSw#8CrW&FbyZx?mQw3a2kjRDHHsWK#MHEZ>vX$181_l${W;;zcTd%>#m z@cBANak}{*lrE71J(lQ-V`^X})s3`>+8Q-v)AjYA7w6{%@8G8zI$_c8pLsdk56o0x zq5eXJwYai*59}RwOj;CD0LvC*v2?j65z~sE=1tH4Q8DB2+__&@` z3u|X<`UKf!M9@z*8X6ftacj}JSo$oK)y@Vt2+=>_4i1PyRA3>)hUH=@<>bmvs#4SY zEGoT~e)_?l@oe|P$HcD+i=So9jqiuh&6BO7#;Kk4co6vdW+ngE)?<^WPpgNuGs}s(ktii8JFlu5A-SP9=dpg5p+8O1RGZOV-xRR& z&gawYDM2SfTT&(A+Cakg6U%(Gcm~!zG!|A8xp~%-5(xFxg2(7+f5ff8?DH2?=_Oe* z*LqMwEC3THOiQPEJN4K_#Y|s#yY3`Es66=uF6ismuS_fSh#W>^EqgG84;B_E;%7fw z-xyF_u_zcU$-H89RY_pSw8M>(RZglKAIthH%gv+qus8>oOZq*4PnH?1+A`{ z-mI>ITjv`S`*yRHgzHUSqd7Jg3eW>)CWizV5I0z>1kLU(HXi*g^eI$r@#p@RpjEbK zz-J!)Tmoka3yrO#p(bP=ETc+UejC9R^TK_22(t!E7N?(oCD*Z-(Xtx!F}Yl`7*mQ> zFQz)TX-B({?6a&e_O)6+BhbafwbJUQ#5)PA!cH=Z z7K0LRCM)LIGC#nCviJaN1VDd&U<)%L4*jjy@PLv77Ca~|kByRwkx=^FR%*DW8e#k` zvc}~qOi=Isot7#HltW*gxxhI%5 z-}>n11hU$#zNMJld>gDI&iFWT67mWzVE=R&IilKV^buE&QOfIZ(wdea{!^zt=d~mzTBsz2u7FADJo% zctvLZm8sWzG))DPz@29DSG+YJ?FZi|7}P62eDWG|1`$CzI<))iVvN+1!R7Up5a01> z=D~xhGU0%yASI1=+=JP5uO?5c&AYg`iZx%*cW>suujcq*E6l(I|2@l?-x2spR?^x1 zLbE5-Lw956C9a7GMzESb+3B~2X9Uaw_`9y_eEs^oScQ6sn^M8vcXzdC`3mkAGa43p z{aA$Exy7X196Q$~R+Ab3d+|Ct#G;3R!9xKhw%53W9i5c+T=z?w4dj5A2$Tc#nURq( z5Och)2O+f%-@o4+Yc1lD8`tv+h{TCA_YDIqrNNlUD?Yju3vk_;&#F6>oSZl_J8lHC zMH=7R7+PwD`6$?Pu|asV^YtG*{aCb)F#{uG*n`_g$x@)wfjdxa)O(&X{qg(~U&X3m zR1dd4y(|jF1^rf~e)v0O->EcWLB*eON{INM2qJ16@@I}uol0@9ei(_9Hyj3*j+YsT zRA+i-c`_;JskYF_!13cpj1Wbi1t4H$?uva)@!nr*VJFrj1R3wXymtrwobW}#1<~=V zVvKftqY`(|#1sD%B3-tEO}>M$Q=M@^UtTsOR}36l z@bGMeHYzF17a}eR{}%rIy@E`ZEKeTK-B)O1%0GR8wzS_kkBUSqhr(oInoLXj^0b{y z91sp9yXzK_G(1qrQAxXt72G+6&fsvo5{QXBF0i3cV6&hI#Ve`!#=G*`YSrKD@I&e)+f!c)?3&V+Oxi zoLO^~F|oWKozcm+M8M00H&hQ}M^u$5x5}p0Bgo8RY>tDXOGC*dKPl_1Z#TeR;C7se zRrrl%Nw*W@f)K*UO7_{YaRs{gu@eGeIFB(&6 z%LFn>U_F}PV6KVr=X&^{%loq4fb)Jle(|YdDu{S2Y;?+$jn>6Q68>^li&Ad;iyDN6 z)$_}3BB8{ktEPTXbYIjiT4!|DWaKd$n6IrJ2^-@DHI85drSFd}%-RMTR_|j(%rLS~ zoza?IO5%6X?`OjQEc_bnxGTE7M@xXxO$`m(dplIU8@Bo&AIon@+3;?o+Evf3l9qg1^9aie?4Y=1Ou^3$HmX5t# z`k=7U^+{(v0)cP@EL1W{WAmtwBUBKYx(Yn;7>EoUn-*MER}l~G$;y=Y{S!Uym<7!B zZ35T^W}{Q7O<8nSk1j2EF)Zy}<%c651L7fNWqU9=Em%E_EN!l`QmP)7SqpjC!h9vo z{khgUqM~dQp$>f~rjO9qz-Tc@JT$!H^!kQ?)UqubWNa?uPek6CC2w!Kflgv++KJiZ zsT2!iyh+EuY+~$d_Iof?h`6z|ZCl44)F{+r;r*4i-py3B*eDI1(>8h^paZP?vN)dv zo~tI?9|E6|6+&}1$KP<1Mkbjho&I?MFRDx8D-OsEXU9;AwBY=J1S=->{5R9_0K5cs0|J$6f~^SnS8fsgd>Me} zpz2b7Q78WVP*q;tsmedBUT6mi+=@jKlgJFAQSV+IQ1-y}q#FhI%?74K2(#Fxjg$|X z!<@LKtoO26s&m|2Rk0t`H;sA+A=}z3Yx)X!<@0PS&+i-MU-|sF(PSO9Al4^uU2Ink zO6hMtzszO}O&e1$%kgog;#uWvCYvNqXhh!j)@6$Jj)wtmq+AKx(F~Q;<{J$gtD@1? z&z~}FSO#t(Wl)*{o79oj4%NEPpFdygK%y`-C8Um9)>gr7Zh72=YT6Y`OUGnbHtTzv0a*Aqk*nc( z6?j0E%8Q(n_(Z}8)P*^j<2n0a8{eQluMg+M-lH6`)$HiW+5(i6b-dAZv`mdq4enR{ zA@*NE2;ANaMmC0&I}KlgJvB6mR#r}oY!{wba`xn9232!!hJ+-AR}gdsrlfkK0>P=U zvDA1@$FVpXKMz|~ov82%x95_zawHxp9dID8a8PDK0-L(pXc=% z6a1rBZmqwUp*?8>c5vu8l;h&5-^5-*%91O^gw)|qz|BEGe}IvxN#GQ-^8&JFmBb#_ zbOIyf_0M69L1e}5%-33Ig0pxJ!Z`W$>bbPGyOS7xqJjl^Xg1k0N6fXWA1RGLXp3Z|U*{2H;42&ssX;yGb?^|*kk%>Iou%lld^9F8NINYtK4 z|0tEFHRI8CsjsjjJCVQ*M!Davj2Nedg>20Z;LcFIttG|x48a|vml1E(cx;t-9OLSl zL8bb)8v0tUvpOC+Gk_q(d)ekY1%quV8}0nJ_%aM7GD709 zou73yxcMhlvMR8qjugsMkcNiiX%JnWf+>adSCwSz(P(IN!=MDZsJf&_`_W9RRx%K* zF)_0*Ls+#9xtcKwa0!S8k*DE(ma#s%sGeoy|VvdK@1g6|$tGZHs$f_~gl9m@@Q&5az8Wq)1eX(&u zLX)smRb^34&acPcfROfWVm)c`^n_mE>C-i_h%}dahkxydmLVf34T2F}0imQ?L9vP4 zb6`8@&aO%*$v=yF*-*M8yvU+#EZxi&c=Z;RIeC$k-+%ez7E})Ek7C;A%)Rn7UhR%PJWTI|GI)4>KiP!j!+A>v?8D`iFcW69 zC;=r1kdv>esFe7SW9k@&HFj*K-c(VkP=Xq&+e=*SBGhhd9QQfV|HqGU&Xr)BW2FR8 z2A(#~TWWq`-xkAfV$(TX6GbX|EEe#X53kS4do%}^mrRWc*mPCH(yW89LE*D+-w}e2 zeZ}^qJzJ&${QjxlgY{43HN&`recM08N~c+Canod|G5<~kPHPVBT<0U5t3_;@ZQhl+ z_O-yQl%u!c^itj@513IjT>TJENOj$p3Olkt7EZKV3@V4w_BKD^T@uaO6|+!TIcs(2 z+KW*0@G@+E=EM#LT&dKr8yj-MSg83HTK_@9INCWppUGa)*;zrm5)sFSW+MSTgrm5! zMZsO;_3OY?tOS0)H)dK@DOLC!VZA6&cZ7gh5A<9{7d<)gCbY?}%Xk`C@EzEqhrT+F zVK}LadvPD*==HSLb=2bQ^&ifnAkC8Hh_tQ(A?ku%02My0Y zd_*3IVqMmHjs05lASqBk>j0oRp|y6x`~?m#boC;;+&*lsfy3v zT_S1)=h`d7Z1a+61mp&4UhtA1I9L(Wra~3Uj2xF!qD*} z*YZ^c!5c5wEckoF|HQ-cWASlz`V|FjmQsDeXnp^E3qBk4N%Vh0Wax26?o7b)p4C%% zFJ1&c0VJ*dW#qjFlnu=J2af{|`49dE9MYcwKtnFI{*7zAL;Ms z4=p506wgS>e*pUb-&{aM{`(_HytKEs_tyYohKF|ophq6gqSsJ0;IKQzI%)=T-NAnt z-xj0=A9oH#5V6ZeO2?3+;^N@=hv6|4vVyNpcY(H+D7FB)`NJca3@^!ry|t+ysyx_A zbrwty%`M<^8Lg|2?NnmK0rB(mfBIALq5&?5ng!%!xh(*f3Ix&xVmgqH0v9c~uNcv|HFMdY9FZP_AK-xeF2GR+GM|R69!C7nEE5JHFS*XDs zJlsymqHCFuWL=RI6p^Pz3}}tLGtQTPSz)QkGaw-Ph1+hu?VmS2ELGg@m~A6a6gcmg z@lp;id1maJ)E!pC5}uZHe;3}hCjDKnGT5P_>Z5(h8*dIne4Y$NW^Ru^tqA~4L1@^$ ztLPkl^bQQ*OUxOYgFmuMrT32Xt!Mx8s3g8xZn7+LJXyiJIk};tW`m0k*Kqg$fc4gH zDeoJvH7YOfUvrnhzf|5VG~B#?@_u2|94`1?u^~9m?><0x8n@i7A9tdCr zp)<0hn?aH`Xh*HRfze!Tfa<~=A|W_op^aoI zVRwme(OKV6(|S|By>$dmzfu?}_2Q~0+=C^Vhd9c*F02%~YQa12K{Tx>db_juisRMG zL;>G3ICbM-8f0aMHOS-YS`z8%3ToV0;8MVM-`d_rA+t&fEnId5LEQOn7WPyMtY}!G z8iM+no23-lrTN?^T4#UGWzGG7C6H;{t`4S{YaeUyx4B)WI~EbzYS~25Na(%WmPGgV^g&ZVuc6x4F*#mb?XVX zWJGn*%=WI=&N9Tuw)dSJ7$}#6*2Uc~qKMK;NBV|xFDW_(&3|lP;i0t%Lb)4tW283i zl@Bk5xFc1xJ zR*~#C7E&mSPAxEWY4%79TYpSk(qH#mQeKMMoMh_g>qQn9SCWl}rd2;mm~Z}^>g?#r zd;uoyIljbKKG5%hoi!ttDhC)<#&(W1Hm;#3C%aQStdr8-T|M&B@_V9HO9gxjZAf;Z z!F$8YQ#)?7>3zY(3DKfoL|lFL9|rgbGB|PlHS~;j-;q4+9%voyM|HnU{DJi%EDe_k z2Gjx?J>`ePsL0nT~tDa7y?CB{myl)minj=qy8lSY67)THVyWB04 zxR{%e8fv*OBz*%rx9OOH}4Z#M~e=M$+@omOIZ%LYTa_e>176c?5z;6+Y; zry;gA+#+=oPb3%PcX_M@ltb|nrjXChU_<)5T0HN%?=SN@Z+9leza~7-bRpcKzufmKCkIFc|I~(b1O1T zgUQV{FD)f(oiCl^*9m{Uzv;NY+sa^B^wI0HH8rJaPz)yk6<#4GEu~?Z?Y0i>H;HYX zPgfOb3%fn}L~_yIK1#HJ9F_edIkHnpHk?dJCjZm!{IM^Ol$6W|irap-t##T;C41)Q zNnDPOj<_|!3d=!5fw3i=cal`#3sBPm=zDK69uu-cPdI_m|1Pq&WVM?dFpx`S#LTvL zEIwn?cv60&U6YS=xz$0U&3`JSUdn&DkexKKa8Yb4?)yt$L|Nwf^W;#ue*cZj-reae zau9+0I!$cpv9rP2;vk=QH#v?1e*$B}U10m3Hi;M0Dc{QJE<;wAk~NWTRjRK{`CSj@ z&9i1q!u+v(R{BBRu%D4jT!nu<$bIi6fh(DAh4Tr;rIYQhs{Y(+r~aK|DxZVX4kKRP zZz70^EjsF{Ez+S|>0-svt{^(C97v5AQpU*j)_$1Pd7AfOs1Werk(Z#u0$ z^YM}q$}G&_#=t80vq|)KFMoNJ4Q+#Jv-c$l^ffr4elER!>)F1@_0zJ&#)NsraM=iG zzyg(PQsGb_tFT_zkx;$g=cWR+r*6k*G^mpqDi>ZXBG4R76mp?iIvu#6A8t^M9eDe? zL$>Y8@A}N3(?H4X zOlrWZ_VcR}Y1UD|d2S~|c~>@t1pQ(I=xF95(#wO!2wq>_%{K}NFQ!ly0!mfiL?OJ_ zz3jQT7*nR>Ra9-h)m5qOa#${1b}2pioO<#2nyn7C$kCNI3TTVXMkNyjW|girrR{v* zh#dDQVgZd*g(I_&F`10C$CsD8NoIdYgKVmNQAlS~u>K0*Zt{o|{ls=5ka1UlN(w%+ zxB6+siJESOK;J^`@AX>i=Ur#;s#LIk_RS{R#(_ts!f`NQk&JjCF~5xP-GO6Ypm$|x zbr9{~R&E-Q0TMV%4@WrDBh}dYiAO*{C!-opwr}SdS{4#6dW?Ztn%ueQd*q)JMqtJD zth=zo5iKT)zwQa^&Q-@mC+?l=tl?gct{jO`U%l-%At{2iyc$fPKGU_<2*v9rgjR5C z{Vl?!SNjAES9o&Qq&rt-^daCIXoGTiy_`EA^CaAGL^q+*fZGY>v?5{kaRNcMFjA&J zGORTvEU)#Pw_#Q3&7(IUbY*A|$zb@7?q!|ZQ;Uqw?T}9cu9~##6k=nX74W^;enmRt zvAgC+prb&I1D+Hhfx!rze5Dvi^a)k?f=^JZU-KuEEV`u z@ObPu2jL4K4sg$R)x|@ULss8dG_%kohA%9UeM}%D`h$ze4Jt2D3-xguj#o`|e4on_cG=r!i&keyn$Yc}gYD`DYQ- z|15%qMd3dnFd7}Wu16NQ=$;*h|%>SXBfd0p!z3A0IGj~YxVyn6_}m(R>U^`ekXPtM(N@j3BYkoB=h}h&rd3d zO)Jt5gB}lqN=REo?E2UONavCcRCO)&x%;&#`68-*)S<^b-2gUa2zc!_N+IkmvyIJb zH;*k5U*@FdmvtwBy_EV)y({#+$)j7$;C^cwd3x)Z=QJrJ!J!4G+ zJ8p{Si}-9VfAk2G#XVnu@;h+3N(?PPaa(?LdN{biOA~lBb*|)$hM5)kf6QekulZfl zk(TCS^7WEC%3Sx58AL6AZz$)j{OERylzcRfifFmr(YJ^wO6IllX2&(^1mDw;RoL#u zqX*l9x_=iRF2ezzbkVr@g3nZejt$l4!BI1hXUs#uhLv8_&9T@U=T)gpbt!%L zkW0A}O15L&e*5bJ{vm(bB&0JfnJ;2^mxV`Z^LlSv6>G3rNPlxKpQlU7adT@Tizk2b zl;K6oL?=NxZ`r5IIV_qqTdSxB7hD=)i~Lvn#lI0)h?gGk`_ga?sU^@Kn9S5X4OQ+J zg>RT7!$h!!ACF5UNp5>bbEjE-->Vqk(1BYx10O6q=W#On9H$$K)kQ-Gto7r$ynIC4 z7j{tl!YG<%^#1n627c#{oZi%v@pbm)4dbT_2Rg|OTTg0y$C2;sz~!!|9qiN~JU5=$=3szZjsDK7@$9yN+$DzuWJJRN~SK3-UreO3JKvjhxk3C;6>Kv z)0A5JwM%Ctc1y|1iizh{6%-NmB30;i)Nd0hhZ!VxDI*`z6}WFp>v)<15oKMWoyg#P zecm?KNN;y@MsgthV(dw9Vz32{)7vpSt8coiKml33wgml@L}RbCsf2YZFYlzKvLgDS zwA?e}i!_v$Sc6$pvv;|~aZQxvfkC1D?OS_C3nqP;K-O7ZW?@WknWjbMaM4cL*udd& z=kkcmix$bK+flRAccYF=4Ft$0Cgvp@zmg2H42@Sy&pi5uw#qs-{PW?jb=M#jEZ+wK z{fj2-igvrE;v*xbJDL-u#@_dDayWLPrDo5ND0{?<5DjB-RvH|ZUU>yFx0WHAs%Oen zDl2o?e#@6Q2!ABKwg1VIC=XUJZZ0^)V7k1#6Z5XeS^V}6&ykG{QN(ZQ#ZYMzT@QKc z$g}i8Byj#|YqN3?>k{B?0( zKV8y%g6S<1S9cAq{3@BLzQ*0k!i`HH^`E)bk!wGTvVAg4|I~p_Snq8!y~(+yx|UJi zncH9Jb%TTx}mRbQ;dhx^9~q6?MSciHa|#SPv<}1r;7cf^s%y8bx+PMnf@$ zf_w)BCp~HDb48-g96Dmrac&OGs&7U-eO}#Iu@9$xWP9eXyHUn%wJUZjr2(D0v=pkE z`vUr!p|?aX1(w<_r<(Tp;6pO8TN8i3&^m^zR!bp1R5BOZGr0_W{E?N5%N{$-~Bp5F=7VUHFs1c=9S+DtZ0~540zaqHDB>m`rDsg zUF^(p*Og=q_h$^p#XA#z_`uy)4IABjE^RC=?**<~N-;4ujka$SfMpdO>(61qi4BA&704C0wP3B0&7=x#X7YeRF%FU;PrVUEs<7tA|Ib z*I_kqwv(O-^)L{(S@l>|-BR8RnML#UR0+O%u|-}L%g%8>JEXhhr1DZloeL(|&X7IjQW1&-71PZX`a+U6J0DSnd{R@nT4E2W#9SM+X=-t)-| zHC77e-`B^_tfwCg^~!1zC#f{-;5vf|8n}uuq)Ftrw=ndPkh-(Rhk8nlC21?6;*v(; zeLaeG-zE~cRJSmVhXRcnVH}kw5=rC%>WSQJY)b7@v8Xqcuc%CmB3pR0!0MNd@v`_S z`2=aq6Il2`e-yv1i|#sCj`BbT~q}bdJ{$ zgwFN3<>gVtqb9|OCxDU{{7V&NV(Zq{v|dKZt1f=o(0Vq%aFDE_ixZ#vsW>&o#<<~! z=Io_|7iD5k7xOdguF~D`3pb-9$Nm{tjH&!mHu433S(@vt=Caqt3x%tdj}43#O4sU! z78|jdtZi(HpM~&}u`O%8H)e1%V-UOSiw^f4`J4uo_`v-E(rui#3{Z7|)T*!{Lv;aN zBjozKXp3H>m)6qNA-O){BDXnn)0CL4Uj7nFHS~pV0*9@ax%-uG2ejqrwDTIo(BAKt z`-yXX`Eb**ygWbqtd44;=h^9LTnROs;&mg;(a6dS>o>^lUH8E?rHG5ZW7ddck@MnF zg2{^MJ4EK8PL%HWZ=TqjHtfj)TL!|@Sn2vp7J{0Ih*kU#P)-a|X=(9jt|%5tM8(AA z#xB-cu1Fk4#t{Rtt3Z8=GhZ)u7tq9%*-@1s)Av)tsN9EiXXi|2Tg`LIu16((vEgHPI=N{xfPZn_ate{dJ;G?1#VHyUb>p1kf%=Ifq8UX>F z*i~E*sGE0qq0;#dZMA*aSg!0t*7f7s;qGipgVeq`^AodJXt%NXN%_ZlArQPl(tuwt zUkFsVb2ktjb6Izl(J}yK&o~%{iY)kOy69@wKFFI!UZ;Iv5MgkWY<&T_#Tp5ZSFK9N zQ^H9hE!qciec@qhYPNh4{Z#=zq2V=;y<;-p*EhzjN<1CVa2dCCc;1%3=$I2}ps-F2 z(^YS)O*yBcq9M!7!!oj%MzZQ*llD z{^@D6Hraf(`)%n7zS8w$(Cb zFKGU``WbAwq1$8XOMd=K(W-iLX^j+R^RnF`^5e%|l_P|jO8VQwi=S}ku9CMwNB zvi!NJpsOeqsJx7J55@h{lt+ASF2AuFy@YgG`$RTJzP&>+EP6}dO?X&1g}=1dnB_Dd zE3H5=C$#U(SI%iMyVbQR{^G?8B9-0=a%5OK$nw72M}DMHl@<2wTSt+Vkb<7an>As^ zFAQe4jNwA7>+Lb6DgESH*Bx0|{7f2W(lM%)XpvNfL&~!Jt<9Bcs6;R%J=;jS9D+Y7 zN8c#XmwxAL1~l9kFBn5h@9RSk4-aPO7cnO?Tq4O#zP09EesR)mW*qbxae*rluT4A$ z+|w5t2+d|pF3v^>N)4|h3c#XKY)KA$Z3LI+4CdpkmAi>DHB z$Kv6J9g?|SFMF6zZ0rbGoe~=oE@&bHMQpl<4;Qpy>afYiBlu;a6TJ<(!V}%z0hI4g@)+ub0g!VZdP_i7`%mlWpJo)mAo+9SKiXEI?>l{6{*cW2 zUIV#aJ?z(X8O5JA5=&|vZ1nNN`3~U9jp!Z>dML63M_wMT2iDEM6538oRCFLAm;6A$ zr2buw@^7!m+W}Ac9RcY5qVs4-bpZ1>m;I2+^K=W>x8R4K57#?ujRBS0zf-A3{8xU7 zl_K0i{+T5Wxuh|}Qo2ZeMAV6}KlET)C#}jH`NDYp>$7jgmS%sFYM?I4QJ9OYgP9U` zqLm$s??wRSVV9hyzss>R%ggV=G-o$h6zvMf#66#@Ei2!fYs=r?dx8#?+y1?wFzb2yK7Dmz@$=#D-x334cO2gHq=qZnFMRUKk~*mrRZHMD-|ji)y`|)CvNU}k9cX69x$g>- zn@JkKJ@|$~?5gk^P2Bh5pYBP}R)O4_%fTZT{?yicCD;;y)R~m~yQD!?liJ?wL)l=GP)$LBw}%2_pMYz9s^1P_#*pVAnWwnxm$vtlN0& z7(R7qCq(?UMW}5JH2ta~Cu#diO_TTXNa&IkFI(3u`xM^)`EZ97YP4JMT+s83;m-H$ zQ4xLBnQFI@LxJhFL^56I} zr=`u{^02NFQ7lpcqVT%%*U9sh1>4^EcEd_+nwpAnms?Qig&ig)ETgufea66#uDzRH z8)zz}ZP}}l@ZaC*E(>Z{uA4@R4t}V|+pGBIdvW7}buq2q3$5iX^@qIRCk{(9Bq0HM z7-V1FeAyjRlQ|6x_w*86E2_JI20_>D^??@`At-HTXR1^>hIU^X%Pq82#LSfjZz)^P zCaAb_Y|WtghG1%H@c-;L?!U2E)PU}A^k0&4Wm^-_Mg&!a8GD$nL#yyGIs9>6I@TKD ziT<1{A})DFU}v_)y}uCIVXi-v?8KyoJ5=KN;(=x&RLU_j9U=_UH)zS)mZB3v4fa`j ztk|9Ua=DBt3UCx1{WXmGO$}HKYD9up=Q!^NVE1ME)UCOkaj^Of_vb#sR_It> zuj|xNTaQg<9<1af<4yfuWaOd3&ge)AuQE3w=>2=;oK?@;tFS*`TzTX8gQ+RI_`0438=0;s(Fi3n(fAwfHUxC#RQlKXzX_&XtETiphQK>^Wek1SkG1hO?+PRE+y8 z;**#df5}aQR^Vm68i)P!|7%emSLmoeB#(^bla8L>=OZFH8nCW( zve&n)z1f$GWYxK>3d|{)<7e7AzoO4iTBRe-mS>jO9q+-M^uFpE^n+3qF;W&{^mo3u zytr&ECU|z=w{JpmKt#FK0}InmF?-haNg9R*5fA>%*~`>>HmdEkQHaw3BE+*Zk&$Ih zO}3N_7Dh>TRK;B!8N)@7(d(qCVZ2-{p;g#bm8TcVtU%q6)>w%D6H6GWZ&Dg#a#Gx= zSa?t!$DU+L{(iojwjh%R^fxmEi8j8~visP1rF;dyE}< z+jW#xdtc`>VQymMvqWZ2%Wl&5{)Dc#MpnkC_X4)%XJf2@j?jSXq(LXhU`aY%boJwc zu+jdr4j4?*<<4}e+cOvuzQ<78Sl8X#bW8iiKyrG0pb(P3vWAAP%j^Bh-G9KOAT?ed zXZ-+G%|!k}y)5QMirB_+c7u)BrK;ZfUjjyWAPtG%o1WH&^4Gln)lIKI3HU~n#X$}< zt%mMHr>bv^jBL=bM0o1hVft_2#TlbmzT|KW=CeY(l>IfF>~-5>>*=xb~F-4F?%d>o8W*Bh8$}4 z**hs^OC}Nk#69$Vfs$LW?LJqI2vKIhl-&ij>C*jEEc-kY^>W^C%20K?P9;m$e?7b0 z9`*}vTSSQq60q2sR+7-b^3n!rNKHR>K2nK_;Yb8S)O7kEA|4R(5b`ZPM6l=X0d?v> zBLJD~r4mHk^$%QOq6NFW`3IhiqGA1mbX@TNDWwBQ=pR1(|BHdDl>VXBWER39gz9v0UV>_D}C^Lc)}@m5y^5nXq-bPPgRXlQF^7~UlL zM12ezZbMXsy~3B^8s*!Eqc_A)U4ahd)2)sWEcrkZUOSX_jFE4cJEp%2evi$b6&L_m zYBVEa1P2lyA5VjVv18gm56*uW1t8^<|KQpXPxOYrg?~|>%kvd|5QMaJr;?^-A|+RT z{I74Y%)f(qD4j#M*XIeiZr zWqaCWZCIw#I2MGJN6-3U*MC0UTWauIJgwHnMzl?Pkw}*sM$Vlv*~p9UnNvuo0|N@8 z7Ag$P0BQ36ItlJle0xU22lac$VjS|%uc@&?=lct4KeM{;wkxiR#}1c#q5hI44IRTB zIEhM&&jsz1#!LvPz#nr((~9#uqbq89!^kYp_vU0@aaQ0>{*?%@cX8vqoN8`N2%WRp zN=RO9u-9@DA5lVR@jA-D{`A{lrkSCUkAo}+NLB?DA3s5u& zH>cQUSql@!fuVJT1|uU{N1dqNjK}2>@#G_s!t#|%gbTJs4ddQ>4m3I^tA_tMnuGybDKU9 z`L2vI!?dOxAn*?8^O@Pk@Nl?~02i+w<&03{aBtH`=BJGG z_Al}0v(^5z-UsW64%QQR45bn@beo*H=ay`!YxL-5N1J$LWULQb_RmhwQe0UPcUuk~ zODFAT%?h8Q|A|F8D)9U(5<#Qu#P1&2I_2ElAzG83$qmOJX<0xZj3tbF6#Y_gxzkyD zE59zC(foI|-{(GASy>2~|5`I+lR?kVPF#)M+MXTs(SJ{DrU1vM162Fd$af`8T;n|2 zf9oxf5D9AIOGrqdi2adY+Gi`k)&M3N!0D+3x^yAPf4g)K+9wB5d;34?Y7CrDxjQse z#U>=A|7T}%|CUpvafmLDvYZ?fPFQ+J-^$Xq3=XRpwAw^xrmMZlkwx7cM4A1Hyq zx^&>FLV}@0G`D9Nnv5!FG}__1a0?nC4nT^d1@YcwuKJClY35}s>D*YJGc@08tJ!~_ zX$CFU4!*LRSKoPe+@I}x>t$r{5B5otxKkM2%T$bf+4Q1KL z8N>}N4Nbe|m*oRkj<^-R%pMRtyvoPX(P?p?<30^VM{5(2vErZ?#u5@-T?IS16n(NJ z89MUC+47Uv)wz51n)3^3|7{C+bt@lkfoLs_6?wIi+6ER zu*4Ky9@#BY-z8OqZKn^(#ZLR_RPKkvLyT6e5b=cWqL*bwQZ4~SB?P~7ZUPbFVqyH= z7q3XiYuh>YDA~bQ!u7~asr4iBBv?&&3UIi&OA1EQhh4|*5vqhJv#lY^SG;A}lcIXU z=~*)3EXS74&r@_eI-pFR&(Z<|q+_gXpRm}>{5X*_mcE`A9p?o88-maZ8Zi0NaQn=7 zo(IJF>h}xNyR&lBuAy$>(-G$r*}L=JK_S($X{2hPEIp0~@w*lTh^@;DP4lTo9CO7a zNvZVCcD3&!9H^Lxb$#Jj=n)N0cSn3x9xtC^umYzOwrH{-r#=4gI?o%&0Bq8U z{lpbi%{AIgNwZ*+ai@QUR77CQ&?he7d1P!#%;!@n9xNESWE$$R2Sc+Tl;`VKN&U^1Y_uhAm z_s2If$}Y)f@3rTeYp!QL&s-~kA8#<e1C$o{VQmC9fsUK70YG8tn@o_Tc!a|^eHr@g4TSy9?To~3F2apmhAQyTbFETPd z8j|nr>2b;DtZRAh+u1FsQNj?T2)z#RJ9wYp>Tn~#Q>yuB5`5zByI%#=vtyI-87=D7 zvReqxe)awooK}yo){Idfc;A!S_KO8*ww$|#|F_Q7W04FDV*WgSpR+~u+;DT}!M?|- zHR4&Hx$jk0pTKryP&upR7f zjL*KJg+!EW`t|YB^_|I=D3j<4I2F`n9M1%a(B&asW+79${;OYk&0&dVkg=wY@#?C4~%{KGxfhScEb=ccSP#}?XutP!zYEa~#i7CmFVQ7Ib=Ms> zu%VdEKDQj1F@2b6RGPzWvr`FAJ*@=qKX`C1ZTM)n!EF%CY<w-jg&ViMBvJ>KP$e4bGF>7FOMRz8o9x_NZD#d#CkhVp|6x|7dw=CtIZp2XoS zrPJ>vc+b#>3BtTu$LZ1WS5>t=#+%tfW|NNKq5v8BcJTf!SVdjef+}4<-c!Zx*wlvW071v`+YxNynNeW z1IpologNm~-)bzre&1JbAh_jm(iD+w0vqd7WS?L-BE=EU9PJhYC?iMdgNZy!*E7Dv+k8OT1dYpQfXFs0Cjo^K<7@6sl`0 z7xuHLisF9m35p?PnL_$ttWTLM=6Xg@V$sY5SShVRz)+`@w6d)&T5h9R6Zk3V-WJZ2 z#d+!n+lRYS+zG|{hKJ{B8kDZ(p;@&wk$)_ZhDfiw=R#yUTvn>}y^osRxdVmhb?Y~z z;`Hbt0@c~i(*!-I78XwJ09J|2U->y_h(asO$JDMa*GYa2zIxeJ-rbBmSx!hzdyK2! z_4y~~+@@D|Z&tELOTj*yy0gKmQrjyjkhHb=k6$6n%h zDNoIjX=K-h zwGs!7FQnsS(EnhM%2sk6N#K5Nf&rGd3B<8WG3t(>7^i;6phWUs3#BJg@mQWr%>ubq zC3TD@U%B!6Z4w^M3?Y543@R3~2rQninFiE_vIiy>w>Q^`piGkVJnYUcbNwh%F%mJh zTdcj-ThVJ^X(+=Z6M8lgvEj zuRCy`spPVW||7Zd8#Sa+Uyp)w<0Kh1rOVzFI{jF64!Kcg@leRd;H)F)RvyN)9j z*Ehsb=PDU!F!mL)9Psig!LX__3_3qQ+#Yp%qqt9R`ZOku)#c_U_f}$uDIM4iKzu@I zr{dC2x%9$W`5dWv_@K@1jbBSfT3)n9VbohHxp56U(*;qN)|4j|#Ve8Lfi%@BVtsu8k6;@N#LSGMM?h&J z1LUkOLZhss!FAg`svY{_tI)kSu{f1ucZ&9Ow@U6cpkV))Y4|c=h8n4+Vw0k$6}+Ii z;5~jl=H&HqF>t*)PDbfKdgB0sj3Ml4zk2Pu{aVM^hc&xSA98-p> zmMEOC+&=Bi%3u{l#c^P~;QxkKQ(3(3eHq^2P6etWuNOy)n zvW^nt2zr-n)Hb@c4iBp9YC5aV+;bx%)K-%)TN9HS-^V6-B)J(zJCl)UTb26sg-lbc zUI~QU1qEO$qUS&+rU{A8eK->J2P*CaU%Mqg++0N_F69?g1oMt|E%% z@gZ})g$3g*Y)lI>JjBFjzt)I{r`cPAYU_V8WuAJ)H{1+tSL2f9}!OF*M_vvOicC$O&B&7xukL)e$4n zW_%8EQVun;*bUvQrC33B33Z58ZP?fcN-8^X;gwq)eX7TAKS6cqwS8Ypw>&&%lR1mp zYxtfmV@Tda{%N3uClyqS2^AV2(L#;aR(u~1Z~Xe553gHK>vh!t$-kOk(19aOd`Su!^PDg;H~C_H zoNThVP;nn`uhs$m2XYK!ZIaFMwi6!?73JR_OTF9pruW9P30MQo|D$d@!iEJ>W}6;- zv0%@^S^GzJZni8RIPgNG$VW`B`T2++0QKY8N76n63k6mFaWH-~-^S*59sjcJla8Sj zeuwGzL-$dF7tG?OpDNs6&|n0~JQ~vX_(+1h8Ms{>PGC2D!WZ8iiF+u!Hk0bUvV4~@ zBzw=0gC`>j4Co(^#qV{sIv@cx5Wm)T)MJ9cDG$>mu!T* zd3)H2e3pRo5`4c``!#sZ<;s}@uMQXdf_{^6?Mq4fR*lVp-!hU0o%_boE0vN+P&2uAXdhxC7u&CkUdz9*&!Lv^# z`_eu27;|AhpD&MwmMWK@3y;7eBD6xXOo?$>n@JoKOEIgKYZlXCCzB&P7~YhZH8@(G>O^{4lK4G zwyZt{FujfbUf2q(je^4+km>-EFG zdTu`E6*aBi~N(CT#=>YP)cfGzdSfQ+1$qJXflpA}vi9 z%ZmpEu*{aEw|XFq>Zd4~L9P3pdHbSLWpjSIy^I3Cx8EL!hC!s-`wYeKZZA!Xh)uQ_ z@*X^kO7s(RgEG~gYLxSzcj_coo8#`9o14U4Aq+d#l1NxIGUagui_;d|Kv|Ls44858_Dd7*|0Ivu_ z-|J(dJfD`oG|TdqPZnf@47{*Lkd$vx@vYCiuHqS*Z0F#KL7;q^XBl*qHj*z*E-b_{ zZ-3oxP!z^RAA(Rjvm1J5&z*r)Imas-!o6IA8==Nti#z%jDCft zS<}hIZM60TS=B}FNunv15sZ1QIULrshvhT76|5H5`y%wUo+lLLQ>cx8Y0XOgrS=_X z7rYOXzGX`N@zKtl_+qADX+sen-XTeINUi<+du2s+9uN;`STBQO)8$0O>qKJz$J377 zAi66xrxC*Ff$&=UPVizoZo&&A8#K}1y1^KDbi#xhT0c|V3$F>&LI?KMXP>4KhT9b{ zjLj*_mOeZ`%6?jJ82^1G_kzIi77ogTzckx5LNOh9<+U{Z;U#eHM$PtZdiau+55*dh*gh&-$}8gjFy z3|+L<Dl& zJ?ysCb=jt9xw;g_8R|PFQ&-7DFl1qRZpL6QCQlJi6cN|a{Y>QGN7H=rxk^TwLipDA z1vnj=?~P$6nEvEy^6G}&r175WRFK1SxULxlt5cCpG+-+;*QvGxj9RyjDiY=AN<_v_=zv(*Gcvvzm&rhBfk;^LJW zUG$Za(e)0h(l6qw>lcOxI~CMT(tz+B3TRB%DvTb~-$#j@se|M$H z5^dA?>PsQSj9}YX@dHuq`VQ3od;gqjrX z5;j9rnNP!A^1-^|??#f-T(>8aUTumOh%|d1i*w2$6}X!rJJ#O&8Ww79u5Ua06!s52 z@IpJXF?V+8vD_a`q%yZ}o(s9VU3i~iZ-tPSom99ubysX+@@$uB!>}HB>$a=^jw)K& z2$^hoP$5^1#bO}*JdWARI9y?F@_Vtfd6-_)v?ciyo88}$`|oWI&O`fZ8637hq753f zYcgwEEfup$9EE*}$w*gsFLy(K#*RKMq#-%=2G8|y^;UEvRET#@sWO$-dfX}kx7ENz zqlJ<2fy5h}ezwIWsrzCLhS2PkPcAzc3d2&Bs*wPKPsd>$hpO-sGEfddYHFk9WZGPQ=HqSN zf%7$8@5@2*rpccK*q3q|>|UJ+4CvaxR0+se!J%@8Ib=ymYZqI0*l(^Z{y}Hpskm!eiHgR3Nx0Wp+d?`GO}`hjZ+_NnR#)_9Tx#;1;0im}#H?3? z&X;(rs-Sh9nA=|~(Iivcy~KO)I6-1p`~KQY-s=uFy0|W_x~19+T?>@A&sbrP#*k2c z%s8gz0@(H3UaRIU!1tF^rPS7zkj^|la&r7Ov~Fsa!c_Ot(klVBZ2~U zEjc~&vIL07l6jFq$J^T-+J>Tuqzae^>c`5m38Vv4NhUd?*>(vbgxp@RLwOkz;@JfF zu|%*X5LGN8kEs6=px=stF?Bd&*zvz~&5^5=UodNGCNkl82*& zPgBFwcfu7l2^UMAvfg_%wmn(;)Ofbgw_KZ>>SUG4w6^|Nxq%2-TtC9}lY2+*OPnt? zW+z(J&_Wz?=2`3Jm8#Sq0;I_nEaZ#^%pIoW=iU=y!?E7nHCSOg#RZZu3E*|~lo5$R z-Dv^gv!AmBMnmSw?>-0mADJfDEQCZ(Ryx+|`*__AqdTj4DIxJ`mHi1ec?s-f4?vB1 z$(zdT6R%@34S$7Z$}7PR7zVvfoft~MS)Hq;w{l%|#Vzd(REOcQ5aE*CZlN!=BmBc! z0xJDOiRS$TtFnt8c`GS}=1T7AE!70Mf1BnZvh@7kSnJiJ3@E4K9zFGA>iCp2`4m22 zsAXxnFZ7`8T8i8-AMYjY)qK&-E;|$djjrA3!@D+=`~(^Aifzx%FOoYPN>gH=Sf|$H z;kGIK0Xl-sev*`>-C}8AXzZht8OQMqDk+xecishfooi>^5}I6U2!YMy(ySzGq`NUs zL0GsWU%o5IM`C7nBgKLxb@*oW(G*&_N$s@#an%>%mD#s^hBfO+(GGd>Zx%f+M!~^P zQqq78gN=aQ9^79Te6;@4%kOg$y?99ZWHDcoNqcz6uk7!;Vq6@np;zGH)Kqd9(@>22 zt*nf1x16?2cT7aa+&WdC9|FD&%d~A+}!ytqiE^U*d#}B zUdnwhrW^}+&Ss}&YpmaP5BQHQS@^3DD1s)IOwKK@tao;lw;%Q$=cc3S-a9`yCY+|@Z3jc-fPb|zyY%m`Z}NckZk!=o|x zBMgxrrTRRa;f4;4Z@pGRXU z?#$FU-CTLNQp8f4PZX-69~>N5x6{s}Mu8b7)(S?O6#q#=tRrfSG3e?fK}|;|mAOwtaZ{+jS*A4z=Q!9P zFG7xwuJ zQojx}9m{!jM118~-LSN4wMBf7s(v_@i)cW67DH7Rp<#OPM|IJvjvG_Kj*gZVJSA7h z+y|{M4nu1=tokYEdf#;#dbPf(Sr6Qpuj7NmgBc7L zh@_G^zyS9g+cU>CVRrS>QEm!C@eiDVmoqhkEsw6yy(S`?Q7SK}{N*qSNk{vGv zK%%e**K<6)#l5|9pYd1of3Xuf{D}8yY-}_IN=vqOF^8iOQKBJs zA!SF{qi~nq2=4EOS}|uEZ%rm$9FCzlk5U?siRC$be}M!xE%=Q>sM=Y+gwcphdY-Q) zOdv&L*=9zK@U7C#>_iMqwBwFJVIgHy(jlVo< z4o;YH7=bfj8`fZtSdC2AZix(1oLP>DM~R6&`P3f}bZ%<4E=yFrj8TYonpqwhm|1~U zYUqBUI&#QqH|vuFHt)}4Zyi=(8p>Gk|0F**VzcmU&>3p{di&YWiHeCOaeaBb$+&O1 z1^NgI7hlm+t%mU2LPt@uetHQfZZ+`C>>lyL6TFCYsY{|RhFu#|%Z7jDP`^22OnXqo zq1h+Z<5k>Cjef_032>j+pL>*z6rNBT%1}LEO{CWcHt(h38B?JLZ?=wS&;yH9pgWd` zs#icQ3#C`d9pq4D3QRxUzB0W$G6bXv`Q~*LP{HgF7%0_2pJD(W|lcP`{V=ay!0FjNwqQgKF(X9^dn94_2EDgg^bFnKPj(u0sGJQLe#QE zKATY*mX-w#ytmpspphvyTJ7op89Mq`uPBMi-;SbU!7y3^$N#6KYoZrJ_xbaX8ZOab zXlw_xKeIfyZLXfl=D0qxP+yu>b-QwUOriYw?mBp>ZV&B8y9-zO$Cac-uLGG#&*QDa z$P}q?(n2cvaB@Kvk>{G8t;w7+;PvTB(=CPm;bcT`vpcC5Ab4lutw%*C`?+-E7UnB{ zkp^10#?OFkfs!rXG(R{3OZ|#bZ0$_HF4U@UZ@u`UHu~w!dpgN;tu8IC(ZeSM^OXWT zRcg6)-wdPIW%Vm|#L1blJ-`(Nks-O5RpUg`o@TF_Eq~6=l7ZZI)o?-lbiF8YLFb1U zOKY3j+@Q@uP62ZA5dJc_J+QvB_x3V=D^KRp1Pa+EhoV)%}Bcnq}U9W0x5 z6Dl}*nwnFdDa$IXk}=>HrTM69W2rNAYm$8Pg4xwNUhX;a4}h0=Or4{an08-=Xy4Dq z_T9Uni`JZq3JyKEv*h))#Ae$Kiw~P00NDbcia%zAfu*_lqCas;@_=3q0A!Y=GQRrn zECeGpSeof^NESm#R)|4YSvwEt?i0y4tC7FY`I9ODZzu!l;@t=T*P~igGR3Ao=byh; z&Xo`O=X5ozI2stxP{3}_MG37#a`x;-P(XWtmM2lTw1g@A{UMOC0q5LV46xrnC)g&Z z)o*7`H@dL{o3Z5GnO^)If(vxFy(v4xJ3EMYt$a&)Yi*|>5- z;U3@q`X%PXOkHV~n6{qor9i71Pk^pyEe2fVF{2O+&+DLi<`=n;6D4CIqk!AhSI-MI zce9aX3JGv7Lzt9P;#1jW*%-;YF2RD)GOk^izqBwbxZKLg=~!Nh>&fyB`(qg3b759s zQE5PWe^Ov-s({?~Ua0lS$^M}aI<*xEVG4!16mbB=3Y%V+zIvAn-L8wp0{?g3E?R(Mhd+w;&S5nCRU{Gr3f3) zBF(Wg+z_Iqp3448>~VkjvX(8n8t=~j4*@h$O4p*GAdnP=%yQZ@cnDCFTDA}XGySsk zY`Adqyf6eXkl{=4dMZ=vmyO-|eg@4U$-gh@ucAVUsVXxwZ#%E$a@S70fe16(mk&%s zLTb#rbM*wLr>DQq%skOBNsm+a2px>be$39zu6PY%XIK5ar}Yxt{j<7~=iT<&CL%Jr zy3W<6J6RSmW}*=!y-#y^bwGmOf~dpHqF<^hx`tO}52@KSpj(Y19|QjJ!p*z8`ko+g zDH-@cU86=lC5$qlJLiz&2Cdm^+Jfobqj9}OwL_-y2~5gTKOq}MBTFx9i zq5b#0_`eLthQAwn-xbiiGg9sLO$Ni>*dp+ebQ?hmg{c*X86-9*4SF{opNR@Uf@PA;1l7p)_=j+5KP_BTwo4Q@OLtsB%v$s$_JlQu0l>s^=yG(Nm79`bkM z6B)}16B1f~pypcgd)ksk!ip;%O(H;2X2$C7%3oEC{@g(P&$xg3-wt=f`|kFCs0`pg zKY@(nZqR)G+u8ru!yQd~=iQlz%s*r0@f}@#XP5u=4*$IQKW`Lk4?CK38LkB1-H!(p zpPY87#qaTybiBlmiI>c1f92RD;(WYF>scKP=DKEXfs{HwoJfyGczpb5)&BFRM9y$F z^+HOE_CW7?Tjmb&c=Lmz8FlfAWY-b5@eg`%FHNT&Rbk;@i=4UB%-!%`;qJvQWc4$M zENkp%!@f4%V~!U&SIl2qns}=Rw2~MQ_IZjTcx`;_*lPidttA`VN$^!o;e!=yTJlfu{Z39wsFidr80TD;jC=F?*F*)6p{GQqLfM$0d&j}+SCT34n zaOBGl`Nu7G?6+EPg_mgC_U*H`+)t-Cj;j(3Ziw#tMZ6GV#M|uU)Z#A2-MSo5#Qu8)e_%{aU-J zU8-P}_b)VNLKrGfa=Y}G3oOY1UFtzM7-7hY>rL{kFexJJ>^Wsko}~g$=BKe=>QnOb zTQK)q>}(9}-OXT0PR@EqvkK44Pl3a8PnD#;;dGcHNFz&@IDcRjRCvMu|69n4H-LqIT#TexPYUe<@_JdlB_}> zn>QcJ5f`5UKlttH+;-CO_IPh#;HiLGQDj(C6Y$Ltv{(|2)d4Z3csgz*Ar)A0Sq(Np zE$T(UD*HDU1_lOn230O?hygiy0rb`kKaFsaMU)!ZGT|;zA=Jk7dYAmpc}HY1L7+5g zez!e?fMzK3AV&VbLfWvUxX<1QIh9^x!1tl>Mb0WTgF{5n_LOwC&vnh#>KiJLcAE~Y z&q#Q19Ct%ovBgL5?9O#^d$$8^v|6y1SS2(nF->FXvpY4jY`0w;t(zQWI9v3c6Bh% z@^%wjwdc0r8ep|+Z$;XG2jMpU?_uka6FV2NC`D<&-R#-Z^;?g5s-79DArv%KCZ3na> zBd8iAk6Ri&Hy7o?qSQue(<~6=wf+h6lFn_;Pd8OX@avLCEbx+6d)CyU#3xqC8+Y4s^&izZVK z6R46ca>4lmqc4c^qOX&ZA-TrMDn4sn+*gjiJhth+E}ZQ!K2e<3GM6xl385}>@)>CQekDZehGc zDY3gN9DYfeZQR;aSh|liKg6^YTm0%d1I#~8ZMC0jY6wc+x@%~x^3Do{oG0Nb?y9Js z;n^W%n*D3Ch86r3x-L-#YQ_a-x@4!6!r%STPnBkCpSMvai^GLsJWx)H2P4x9BzRNl z43iqqT-eX3#$CEEXWQj)W=DAvN%I6*=`JXXEyWC!pXU{>TG;n1NOj3f&v??jTE-%0 z=Knb^2zCA0)ipu`qn)@#i$hhMpS{-7tm@k5_FB|iP;iM+d#aG0ZnwHbLxc`@xeM;n z>@gzNOT{TVP>8+Hs|(aw67(=MDDiRe6AerLE!^YZ!}G~)MNI_WQ>iM7ZZ42FVV@@P z3Rjow*A(_FqmB^=jrf^KElvljNiFzMAyVP`0-_t0m=LnM>pfooe+D z8FTAGhHizZc$vI@r6AdoQd{WFAu9tPbIr{ZGAJZ~{<<6LT8V418Ltjd>sukuWOXvN zhi|tAPA9EIM2g0eX*Atdr$=)!Qd1Dwn}>OhmYV?$>=(>TAb35#k*WC?6ncZ{PoTf< z=CI~e3{>chsHu}66G^Xf0_S8t-@=UNq%ABa_BYJ4nQ_X#D8C)IIXit9N~0%2A>4~D zn!zGz8}fuxbLjh?KGk5YScoWyA|LIAATtKpwGe|37R~JFOR4I5eiA>Iy60aVx5?4? zAyZ+NRu>nJC{a?soD#2h5s}{yZ@nmLQqD-QT{O$rHV7ScxS>Md$dXTIa&NBF-J5t{ z>?=AErGLgY8JAxa1=-P;ywTfo_2z9zTdID@N`Y?C4W1?>wNbf9uSO_a2c^FyU1?LR z5>p*}MU)3$wU7}$y@3&w*p_hc{Vp21`o18)$Zei2&=p;2?Ciy}Ls6hjr|D)scsoM9 z<;t&*EVx0QCfqXKS;(?Zm|fs`8MoptxrtRX-RD?k*n^d&%issf!}BCVyT=@kOQ$9{ z1AM@C!EPPzV%DP|Vz+i8BqaIc@`F?hJyhz^DJdTjd#3?`#Ue#hHaNH6vy<&|N32*o4GoVeu|+vKZH_9ewv-Misfp@?o|(7jJ+fR-f8O9mv9R&;xjGXf ztM900|KeBVvuJy7GiiPc3tKON8A%#WC$iME##JPAPxmt#uih_>ZcJ7Fz^#Zb75(pD z6HR`p4(1W=_=)JUTj)5*;Q>Epbj}%(vGb<4 z3@8PV^4}opKM&7@`IiO5(U;$X*E1tf1qHekA|5@NxIkJuIF==V3(Kr;VeY9{C?g ze$5|NyZtPd;xO99b0{v0a3dz8$7v|)voEVPZr7eWc7)6Ph{xFD&lX}A3Pam2Y0nDY zE8Qw6J!)Isrc5>$JYDA4kv3FIF~u$C-FvZO5Rg@WHssm{QNNMB;etv0;%F4*qFjl5 zt85-)^3Wgt*BTMi_Et#&Tx$qziR{AnOdcmhS-5kW!u0|jE5V7rVy|;u^_x99(R1c)jJdU=uZ1pJ6 zc7tCiaGV~g7+xx0Ut`tGAZCYeO!0}~@H z(<#0YF$IRB_jcK&OrH z1ZDg9&_DK}RRy;}7p1dSe?7Ma$9Eskd1*DTN&Xh}ouq+{A&}47Bg?u9K~t1ozLAx` zNs5k~KRmqzIkU^F8iur?dg2;inVXduY=i7qN9l=(;LZ%c#`d_+xNbz3<+`*FFEj`dJo(yHY@ zPL{og|0)3jza~(~IJq0OI8*HXWZor(FU2r#+0ROw_2JqIA%}7@X&kN~0Q*#{t0Jr6 zcWy!@Tpx%A+o?D|d95{E+qIwA?07S(V46HIZ>Wb-2%BDbfZYmw@u<_4kNaWH(jPixb*%nDf=B7O4EtI{-8G|{0^SnmCMD(;DNM?H zT<|L%Foe?1P0qpaKGY*GM`1cB#_Pl%J*191-lFSgofsUm0(km4j=BwwN-VxtnLr%c!I7j{fQ(h;%R)*OMV(bdJ?je8tJj`uLrA6 z*EHKdR)|T)_&(<&-zYoFv1NficfgD}K-9Q|C|)^RCCnltv#7+oAKasXs$_h^iTvWg zV7PL2RKdPwPaL^F?ml9%PS=9zBcbd=$_=78mA!ry{mk)O_Qp0${!biXU7I%kQR>(^ zOVZD6x-pxP%E?)0kV3ZhrRNUXymC;x-SgV?4LPBA6Rw`)LPIxY3&E^=LSH^WNMU2B zo+|1x5HX&gyR*O>)aXTFxMQD>7ZAOyffR;2*X4v^P1wMfHQ1oePEpM0vWF>Oxf~z^ zlDiM_JRw3`LvHxA?+iLRxbvxW`RSlho(oyOiPO&E9vF$&HV*CsFzMsm!9^;Fnv*x1 zBrXB;?c7(bo@(<2Q0R|s-5&?c($zX*#1?xZo)OUH3mP7+jr(<-28pDEMQ1OK0V^f2 z4~Y+!Gc)?A(fx52S~;{b8=P*z3C^=$yWMU4vFy(82Dge&aNqb#PWYq86-;o7z}^c1%%Jp=OlGm z1yipCp}?SveNp9-&FQ4g+Elz=IRcZD=_5*}FkuooDSJKMtcDU=z?A2+XK(@M^W;PV z*y{Ob9-Yj=E(|4+9#eUy%yR%r$(avVj_f~8^Cm0z!Rv;N_N5{iu{UY|Ux}zY8tOk0 z)c^eL@9G%fr2pij?$|CMclf^^fXXaP@H%`womqJiU;5&SSs&M{&px+|b7{;ZSdA=e z^u{DfF}R9Cd|X_2cR9}U*NlCA+VKMsa1XHkoFT-ytqM=m zgL+l+CW&n(j}(-n`99pD6fcRX@ofAcHsiBZD@C64*IZ-TRqv_!$Vt(8%k_YawJTi zULL5Zff~c$=5Zu#+G@yrKZvH)bQ=KHR!|_%J3f`<_40D}X!ZYEjWx*iZ@wo4m)Ov$ zyGDdl`5MH{{SYT^iF-6f#BISezi3U!ywbX(lXLCPeLsven8GOj7n8K7+yDEUTt7oE9*NUZ>MbO-?!xOaN)T{L69Run?E1~; zq?c{KrC=?(@?4>;Zj>Y{M%N=7ePoO>>6|sa4H#*Pu#+6ojSLTEPwXV?!5{*()LMdrlArj%70|ZVDUFc>QYycVQdUv(RzdMr z_TbG^pL#J;K0^Sp{X_BKttppsP>|0g2m-o$`QV@;+?k)yO|@Ty%Y<&u#`~oX4%?5e z2H`SfW8lOBd)9CSEac?0z&5gNq|!f&=Y!*ij;Ly$LCDNGjpiTQuw=Jwll3dYm*3#P zg_(n-zY0VpCI450SVRRZ9%(L*!)=sS*9dwmtysk3R%Dea_SPo#p{z0&Cw3cpMhxki zJ{kT+WugM{sd>}Yi8hdxzDcbXEfpyqkm8U3jT2I13T4aT$1QuCKzD4U`9rFCuCFK+ zoMdx;_zv!iTzS8#QbulTYind@_lVgwah129yz^=xFft=2&n*}I4ZsUIJ^c?}=yN8! z92r?Rmjwh%J|!gsKn=USJxXv{S7040$W~PJ>1139=hc9LKtkPE>d){UMG$ngPmuAw zzg|nvgrdt)i2#7Crn?SRciq3XYYFFW3UeQJDxD`?25Ij$;k!ZTrJBYbV2kJ}{itOU z)q{*KnT~1skoFPD>gvgf)Fn4ky;{F7F{|lP>3`aRlzZ< zMc{f4B;gAAys@Al8~MSen@A1a(4CYNSn_Diz?b(wm0VwENb7qw|HjU1TCpqkJz@~? zh|^O@k!VhYa;jmBd$j{OJV8JkUo8$xznw_hD|K1-R$CwH*Cv0Mu(trUBpgoi&MY*u z3s-wUuK_n#>_a8~V}^HSb9EoA?yrMSEE}2_$#ohscSCPNPVYQoGqzNZG{;-e_FJ4d zTl(6Xwo`1>-CUUA-0fc(pVls=0~zQgl32AULqvhttz2$?K5_C_8~*d~I-|;(hKOXZ zup}EuY$_(!;3Y`#i3I6*=ho4PQ2&6)9@Bi8<6VS-L6ar1)q zlWLZQc?2rZGSfcW7TqpXWxPq<32i8kkajl{=2~)CYLszc5PIQHfBtYid>X`LMIauY3OCg=IRrzS-2c&}zzDCU zO614yf8#p2ZF}cjUtQvoVZY&|CX@`IogS%{%>m=vdDUleMH+a`J~#LX&{*@mxT4k|EmgXUAyTz4&>vLiXDTUOy(LU+F-8@>53h81 zMmp~JNtc3MZl2uQIk)xdh-Li4NJfTp|A62@Pxuf=b@QKiy_QS?cTPyp)+|IZCPyFr z((WZmsHy^h+0^eh1@?PEYZMETmQs0HJZ6P#M(^?ox1uCzuW^Icc0xjytnAYXq)B=y z>YV@2Jm^e>^~abihjPFO1+jm*sv=KIo&c5vo>=~zBeIE*)cG^>$+G2K^i9s04(P#5 zORi#56UrV!KY_0kw7vgr%VD9vS*^8U*jwe)oT@6eAe>OUq$EY^VfUyzNf6xquxd}r z)FfNSeJZS5Y6XBO|Bd*%I~P#=?xaD^dxdULG9-r5YNevcUCE{+f23o%x_|4DJfKcv2+%GQ%l!DQ1Rv~-X2pZh zf)&v#y5@abCFuhi&cEd;q3xBG4r3i(Lp4}kV8SWru}r_w=G_&63s^vMrr>p#?yS$% zWu}4Y5Xf9p>hzoX7P=LihVa+?pr^2a&i4BNQ*GjYX1P8z|j|2;1kmb2*+CqHr zp%5Vj?AKM(_SuH$X|8_%BTO*J-CYZiIQU6rUGGT<)hI=Fk#73F7B(m<(1w^IX?O}2 z@7D<#BsK_+|FSG;%dX1#ue@*FP}Tn!I=O%3U|^~r@Ve`yAe?qPZPGhH&ZrB{@BT~> z^j@*Eth4!NhuZ^L|2x&!ydU*9C;D~&A5JtL?amy1@qY`;|LDvAKK!TJ{6D1SyC?cz zq5OZ5wf`2j|A*Jz-4<}$e-6q$F2f?-$#4ExNDB;kDM1ZtpZ_D1K`lm*MY;s3lnh+2tBgOU+2376lb#oz^6T|<=z7bp!D_FlX#?xbhl zrU`&pW6;y%VgVjZpK3#YYIOB+>emJ;VrX9ag|O=Jv?#8R*rQTXuQo&>Ul;3Kc6xaq zR{OUI)?X`Hc1_Q2wuN88l83Ee>J*jl25sPE( zn&U@$eR2Nb;n*dm0As}`321SGfEMR*o(Ci#v>MoqYpjl zNXP$bfRa8v$28wo6&7r0u?^o#g@6dqFQm~^3&QQB?z&C!<{rBsOyn}(d*LT417;c{ zd1^(y_}A;RWRG}Ij9TaA*|cd--7az-ALE2)2B!^LP%WuxvKu3ile^=u7a&^g$i9n)8t$)B#sYg|uyS}nfSY|MET7iJGdu<~#7i##XN znJLrhGe*E@3^CblJFm!_vexPL!x$L;DnByBVF!3J+a+DQ0MjZcp656FXP) zj0pgf%MFEqhwATZywUSc7Fa7?^p@Ew(VXz(7|NUhu)F!{^09st4_{c(Q}wgkS%l z(8>i*&I8FwIUQ7r4=|btv5+-E8b(@6(ferq3Zm%3&yC^K(*SPu5k^-&9$tq|o53!e zveW0Gl#*C{xZWhW;c=~ShMuc=@cFqR+x_r@(%k~K+g#G98Y%>{i8x%G{M`Z}=og|G z?m1*Zr?3sD^+Vg3dXRb|Am+-}GwDZ5%&%ZXD?cVg29kJ=pMS2wo0!$xbSNpHVbpB- zoR12P0;9QTKjgYPEl$Vu)NO1M5HocgHnWRUL(-B;ShHHIF|G2A&zjJrt3JCLDCTOX zpw_+}J0LmlUA;eKky}AJs8luB_*OgPTUuId2o>a28j+q~#N|3(LA#;sot*qoy`6|@ z*~8kk$dxZkP4|9*+H*XfOrAV3zYnc0ANDc-pRI)~U#=)9QVg4z!C(~A!krnfOO`Fn zmTavI^wk<6FAQXqKWVNN8zaiGxVIcD)FgX6%|}*fb{Z9MoB=pVnsyWrcQMBkP>Zso z2%iWj7L?05NSLRs+WKptu;NllR{E95umf2~czaZMXCSrWo;+`nO@hSy)Zyfw`~C0Z zU)#H?PM+kRr=eImIS3UmYIn#$g?qtO15VN?iDde3!e-$_xw)BHAQ`gDkIvS56$HN-C&&-|pyy7i8Cq z<#rgH2%9Z*8Iz;=(mU5S?Yv{SC4bkdm|mK#rE9k$1Uhjd7YA2jNI9;z#K)f5o zAP7f0F&5H=7m+5}Zm#s)2WptrI+~&D0d_id?I14yI~P&BxcRInmG2+3sM~uj?+6`D z@V4E$wa=aRGvYJ}X-UwAEnQIv4qV78m6QNJ)^6XR+_z6~fIp!Pi&^UKZbl#Gl_`X5 zMX)O_b%2bYK`dtf;`ePZ;-%_*P@S4Sz7>q`VtuB>u9?noUWmMjO z33TW3r;r^PkB*yYs}sm$+EWjcmu6}?U*e;`>ykN^y}c_UfhjhP#w0W9r5Qg6zKdB* zU9Y+`x_3J7I0J2MJ?W1)7z1BD-?>IkMx(4eb-o` z-R}(DnlL$17yJhPHCIU=E=7Hc^rG>{8`4Fqz_3^z^jsP5ZyrKu-qTkS(G6Hxss zvBf^K9!&ppyGgNX)~cIUNFK^h#T|RGG1UVZiWCSswyWXFRx}WG Vbgf2D_Y3R5hu}rrTfaN({C_fk{}})P literal 0 HcmV?d00001 diff --git a/docs/userguide/en/images/apps-images/mail-preferences.png b/docs/userguide/en/images/apps-images/mail-preferences.png new file mode 100644 index 0000000000000000000000000000000000000000..e927b97da68e41b24875893e9343f6d9fe13c68a GIT binary patch literal 41005 zcmeFZWmr^e8#Zhr2nY<)B`wm@AxM|B(hU;Q-Jmi`cMQ@Jf^>Jt&%P~z@9R3R^E|Kdm6H)eeTe_?)~#Ep65_%Nw{G3h1%5;k z5r9`PH58g|-Ade(5EgjtG`b%DK;^M=-LGG;)S@RkUw!T*>-qaWJpk2bELVIRW{YXW zRcr!Du~Nx<(ZhuUAF}HSrRXsh-;dI|-)I~*x&3nb9my*ec}4e zO=rGf+wL#6KRee7cegvgeEC)OwgVd-7X5|G_9y=ZiC4W26K)`VYB=tO1$ktY{wtH-tRB)L1s z^1~F)?K%&IidwDnmQcg47!&453*&aj7s13A7WqXk#plLra!_30e0@ihYqC=I#%YpY z-_JlyB3D-j^Jw3E99XXydKaO6ud3eL~#A#u9$OvdN{n4Q*p0=;g>eDws(p>i>9-?Sqk5&ITHM^?AM`K@%gtq ze`aanmMTR1=HY#mw<*tthO)GkGw;!iH$9pV<4f7r_zwA(3ie^-zf9&r{O$6a()6YfC!j9^Nyuq}sdKwXyOvL6#zQ?;K8}2C_QXtAdvU)sGcJ zN^88?*9Xbu%4F(4caK&(xK|}{+TXdz_8_92G)r+JARmu0-Q_#Cptz{9x&u2vYbn1V z-ak3-^#(NqOEjRFQFo|$_4?___q6ZtuM9;#Q$4DK4fXcbDE6vjzEvncJZ!LIx&t%^R#JonO^> zFa`+xSzlRsH|xv8YT?9Xf7MS$uF+;zOiPco6QP^Ei|J^to~@nI;$ocO7lo+0n(MG{ z6)K5_MSuIJQ1-wy>HQi04z0m&zqAg**v*ZMsK-R5cxY1~sA=a+%4MbdbUCMJnl;L% z#X~C|JipXV-sO~rmU5~LeHM zV6byXDRb^8%>^Gthty>EY}1;`ft&=63lARtG_<@yc8Uw7$G%XZnIqlYI)`&5diT}+ z)30cMHcT!`pZxJSC%4><0;+dqF#!$C+05eMcgoQ2X!S}MU27x9l?Ya@=H}w z{?yStIH*5?WtnpN9?n_2iFamu@N#}VD^3V5IGC(eM{@Efj%1eyKgxMc^O(ta zgP&PD&qK4%_XBiC`>?bnM8}nL7`MWXPv3OgugH9PZQViY?Q~YHDe-x)}TjCLnt1uzDbc&#&;6xHzV2oqu~T z1C1H>U}O6eTB8=F_If37gPZhG|J-gHHFVfg((g5(5_R`)5j)X9R$PC!7A$Z=j46mX zl6)?mI>AbYbXw+l%Arx`5g#Jzy*EJ#MpuxquwbAJ0Er@!fmAIL-T3A$p~`gbx;tzB#%b03$2b0P=z`$&NI zM=*(EhA}BZcb|%6u#b7*o}=2@50+M}^*UdKT%AQ88dD2?!H{AEKOCd`8GJbm;G%2t z5-PKyk+=u1#GJ~xq4EoXMhMkD_65}YE06V8AuN3*Lbo(xc%U5ln3Gz?O)qsaM+d|t z5;KPi3haendh@AxEERrqFdbsFH77oM_nzI{eD1xH$2!xyS)=l}M9X|M*CCG}K24tF zPyTnS#~d27BVDl$y@3Hy2K0$j(lIjjJhczazinYLx;MXM-r6ZCpwY=)-CO3Bd$z^F zXxwr4vrJ1t>aGgYi&wG4=Up@S<_`FnpA4iE^q8|H9o_8N!&par#(1S;54N0S9QapY zjEd$APWzf>L0mrBXLOC(Us5&GJ4{#Y7Fyud-@A6#Ssqa{WQKas+)fN!PATV?2f@H=Wphz=U> z>L^8tq}aY$K0jQ=!v1F3ui!a zb$O`-ZI9zmAW)Z(3+lGBT9T zzsv0RgrW&IfjzXd*UkA)(lGBUxF;^*QYnuZapw^EMDy; z>RDflSW})1N7h5cGBSn#PGxl9i31 zh)uMs9W{p(a}XzGJOrA+J{iXcu;N5R$Q`=RbM1TKp-7g(M>!h{L8Z#p6}@R z?4T)axgm+q_<|wCk>H71_pzr#&${)Sqjk5;mv28XlHFV5!6!h|fJaK5v%NXg-F{m7 z9UM@e*V|M_sZl*TQ-k$j#a(-)aw>S$+7(7aOB;SQu24~)nCNa^LL~&geSN2P!MN)ClF_HbE64t?ZA@InhQz+Ai>q^vR3+;lBCbg?4n+RCaHWZ= zet~~6X<@Z{(6UqpN!mM{DtX&5F;P%cu2Q9;nm(E1_!sZi-B&;~zQJu!4rl&(=iLo4>O`o~u zil>OE50!9tM$=nQ_mxw|3hky^8-&_6@vc^Fpb~Va2$pX#gS>^5knEHywJbiIi>JGV zO5hLfFcGhcdtXrFhR&`J5r{v)=(k!Ee7<7~E1-IZt5z1TS2|T&(?UwhOtkEaggZ2b zQ^W5w82RA9ud&_y!B@BexpMeN5yeD-^wvRy{V~+Up#J3A@ue6Ll53q8BSKx>y~P3N zauY$akD}d;BGP=h$`RA2P2|)48!t4E>w_C+Nciqcj5Iy%mVwUmc_98eN-8y*%6hT2 z)?GBZP&DS<0B^v?;8*(AV@BdfoVOm11xZ2n_L<`+UWD1oC*(DUN!-OUSC^P_tt{8M zNSMng-==*Y-mL?t)isp;X6to^(d$lV(s0AgF6{KQ|J4Iu@^{@9iG8 zm;L#vw1|xilB7)-b4eoqNf%!-E&s87>hRQePU?enru}<{wfG+s6!iivI$-YPXu)A& zAl0i)Yf@|rr645yXeGWGNwQC=dv|<1|JiC84IgA7@i>7=PchU+^J()F#` zTAaSxe&x}<=5!t%m*i37#8h)7dNH5A;=ud&MTc0*%qiVBY5B(5v@L}dl)kpjDK;%f z>SJtmwuq0^;S#w7d{8@UmN-_y^ z;DfCn?9A^nPuHGxL%VYF`pi`eE$3$x=tR9JXW?B<8S*K1otil5v?-T>DYY*Mj5Tkl z*B_?bC_cRB0%3~Gp?|)|fP;AR^wI-;I)tb+7Vu=?Ed1Mcll`E-&7>bz7!qirQRG#`@zXeB{q7p;8NaTO%uZ zS#|tFxp*70$kudbW@b9%3_|MaswQLkg@swWwV~cpN=i{d!%HJ-w_}NjOhaTZ6N5N; zB4(7{6BZbf8oekMF=8937dQJXg_25+w7&CbC{xLCD3cVWSzx{RFuqr4zJQ*c(a+I! zakxQpQikxEbbM5#7$u16oQU>oHXTt{tm`Tac95BulE@)Wn7FUU^JaN1d$aKZ1)hd; zzoco=RTRo^^?|+SNiRvyroZ6JExmB}UQ6v5a%HF2#=8s> z?=+2P3eBFrj;zhMWpHzU@HIRO&7-qTv6vCoIw3}&|Fwbne`07NweHc?+EvEG| z=DT>l=}ZNAB+$v=zDRFwF5QDD+>9oJvs7fU?TyxHwZQ2&5T<2I7%u6#7W8wCcW5Z1 zFuPcwB_BRQVv?iXg2LF~>eAx6Ge3%lJJqb48iP%Lx4vLBBh+xCFOo!^1wDxGVCirl z!~CRG`CMmn?!AC%@Rzl4kJAS~AAx&VEN2W95FWBZ3akV@o5rG6UCUa1eR!;iDHkX? z3mgm3BR8l{i%-(zj!>PD`HA_0p`8Y9b-WKXn|zcGx5uR6-)n1fySt;y+(`=kq(Va7 zKrCY3xDlp{;Qhpp$ji>HQg!cX&d>Xd;C!0SXN949p48J@O^+jdxZWBCtv7&YCRVC} zO%@g!N{W0P*d1h|b87sf(^*ia;$@tfpmrWCpY4!7+uB+?s>nU%Qz>Y9spR0viI89s zROk#_Xvrueo1R;~gCk2KT#fa~t_GuYRDAeAB)r)1l&i9&v6nd!Z`|D3Vb#qJ&G@b> z5B1S~hvw6%wOkw|mi_KZ@GzTGt}I%yRjIeSzY?OS1)WEGcYmamxiYWQMN*WossXL=I`UHRHTQ2k5e}_@)vPpT*hs!jV z{w|ZfN%pLH$NmeC4xFVynp+25@ff`YjJ2Z>gF@M~G(4Xe3ei0^XXDLx>o{C^Ei65= zO(Ae6ixY*%eicSGr#2=nf_uFlrQKUNQ*EkK&3F-}n{JxiX*(NYWlBy5fn2RvXghAb zT3n@W+YEwDsCT+y@#UJQI?HG+*LO4_f#Ld&rXtmq`cMlA5~G@!m=s=@e=+%B8fRZ7 z($ouif375(f4(RoArblqo4sn20wa;`%i7o!UIUsCs%N?|N{nU8aCF#~_{X$+S4E~c zW(3o6OFa6{kM`6OsfdcuezHHS804IP^|AsgL#43MNhyH~||6j^llQVHN zQ%W!^!wt|BhNcc-V+i6uaMR-hs$Fr+@O=J@BQNwFpK`~|1iE)6F`GdKmjKoe2s5oy zHLei!9mH~n^%%NznfTS<64mwP=P`U>b5C?(bsWF; zkPBg;?TJOjne|@KsifrUzVP1ZrgCr7$X)OD_JFw5N6?81xKF)0{G9BL0#*>xVK*6bJ8%~Wsfx1k2d)Co;BF8-zTYEv_!5l6 z^1=_*wwZKzia=%~hiSezk&d5Tq2w|e-`czO(=*poR#STEQ|aT@H2Vr%?>VI5thBRv zD^~DT7NFm7uvABgl@2x|MrvdE@}>!&+oLe){Ughc9`blNKXX zQq1oi;sx%z%6`o+zB43=yww#jx%Aw{zjST1M7Y>tN9gmB^mnyiC;KQzTqUBjC8i}| z`G-75dRwPbRx>89Z+nm?>irY&y z5B%jtR9c#~@$x>eM^z$6eI9BlavOZg+l$28e~#-PaCDZhZIC(`hmw-=CK}-D$PC}& z;K-JIvkF@oFwS^=7j=ag?rJX~An?r0d}5VOm&0aKrHB*j*F|5{! zWNY$Cm$5dmziGkml)S`UZ9HBnver7~htAZgUytd|5J70f8{@*Rm2-`Q*H5TOWQ5zd z@er4GoCDo)FOg!s*TF+%cBEyZ%yL;J-C#5 zuZ@>GNw?OSgseU1OCewKQS(F(ga{lTIF)P$QSyM^2ET2uK${tKL7Cj!Z$3>Ae^*T7 z{$Qu6Rr^h4GMP5*sN^Yyaw4ym!P~dXK7k22SotG;1qjF2MK(eR)4F){=$UwQ#eo_4 z9u`~>np&r?FK({f!?Sm+V}}?FPfNrk*L4Lyr7;o0Pdhf&r(-?7|1|GNL?fZ>vQhT!RGXH#Z>RT`_6j;0WGs>86m9HPZ7iS-qc2=w3ER_OpUcCHP*d{ggvtsMal8n7oVt09joI<6CK%zk zLA6r9$drWcd?s3e;7td_fle5WRN=s(dkgJhQ?}(CN_$o`thD6dv)9V;7hiSeY|{tj ztd8$Jt(4u0+nvszf%Jx^EBIdYLPv-#=+#KiDhiHhcx0_T14?odaq1S3_f{U?I{n#= zxHOETy)O0Kl`b+OGIBxZg45bN`+(=kMhFoH3D;~N(aj1>O;5k(R}f90vYnnP)X_UT z8q6*2AE?y@Uxh?P-DIOwB&p~y2;$J^R2FTYD%4Zn;sYd;wTvc0Ij)P&z3EVHo6X7q&GqO28crec_3PKI*Mz(Y6y&hjO(fV#KD{!SbrXGoQ-`>G ztFG3#URA9PVPCVIUOAgQ8Fl)uvpH~QqJeB{Jt)zB0e~B>OCX2S1M?K|v0SK%^X$y# z_RbGLk+gp4ujJw5v?@g5UuUVfjv>OyX|MzM{Z-tU{q%W-;;HznH$lo+4LU*1M)AFWDZ6 zwCwS@==Fmj23bBhPWm-wi{VLyL}^IzDp9CoN_ffNzqo^+p77yRzO_$X2+IC4=POrI z+=&*8(3-eoCJMUaUem);}a^C%>n#w*8Z<8JO3(7=q#L^7a zgaA6s|H>oG68!sw*tIO^eD(c-lCPEE0((0i2>fsPLRit%)d6+)NAoB?TuCV(w5qN; zqGrdXaAM8jJ@CMGf#!kolU_D-Q&|&(F)}dk6Ixm+F|$3hocCQpL2Rw*SJ;yk{rK27 zzi2m;R2Sd{1CUIDDa9BGvPnoqp$^8Z_A$|n=R~nWD_-9VF$wrSmq|Uy=1&PV_eR$f zH#GcqTg;I-CsgbTaXX9O^XEYs+87O<@8mT|(`<&Yc>kc@TE_>KE;Y%W^%ve{TOm2p z14m=BW1q@u3tM<#2ayES59?~uRT9#iOUDSkYf!lex^F4Cu>IJ9@@+?{0OEHEQPIyg zpxC>yfM|;Bc{UGk+}aF0nbJk9_Ct-y7r)J*YMV4f0_;~pi!b>(*&IdXjB&BexeY?W zUtEmh3(VUirBeOJRwAo0gF~p}_x9|5$ABZ>V_rPaj78GwFM~VX7L?StWh;|fg zoda~zOPq%!ft#oz^Lv|LDki}Gza+)481ow~?5a}vH#YrmirMdy<(f%P-6nsL9SNv* zH-QTSDO^ik7}11q%lG(FpObzCy*Qdf19t!HWQ}WK#^AeJp0LXi(MU$`k$WC)XkG?} z(Gt_bIBt8t>mUVGO9RwcSXjSjm=B()u=T#IUtIPxub&I=bATv65H<@3iMED|IXhQe zzdYdUf11*_xhz-C!~NCVd&5VKKn%&XaSRU0A1kwrrPy7xU;1TdltK7<>CDbEn`18W zQSlLzKSww}oSJY)3`gwj9_@+PnwpwxNl4tTJ-0%+<6bkJvD5q>$B68E(#yOqI^h~Vl$_T= z#>*rDZT_CDw1PIP1X)>jB&qv*-!sX}&=&Qhl4Qki#jUT;VB-1(ryQzY$D#I>TB5D- zlYRu}^dWxlN9RhbFa`eL++e}7kW#BcN0F8djNwQv<3ee{*1HjBpA{~pQ3cbJ%1S+1 z!*6Xnnk>+10(NX9NPma}*KK{*<0od#3@LX~3?>{J(&y~-Dj7D@KM9G%|2<^!9o05_ z^b%ZB%mM@7-}T3V+j1DGb)(kuVD3vBYXPzz!@+T9cQjsc1~`fyMi8kglIh-^7)NJh z@LpPsjBFB0!#8-MD?n~En@mMAL@T*tvHuM71M6J6r?nz=314Sb6@%CkFsU?y{9S18@Fg%_QH5lFxw zh*I!D5~9(3otScc7@7>gZav2TEE4+&Z#?H{B>JoI@=rude(SP1vWhD5uDm?HIy|Au zdkqy8fIcL+UGMh-d%eNJ8YeZ~cq||7=i$us=lf3I^lz=j@{m4BMT=_G$QOrp)|4?= z|FQu)qJ79J-(^m9>>D~U% z4D+Aa#N$I50B11;R}$yv4SwgR*U(fcGT0OqY3fYqJt?Fc{CSD?cu42B0k0Gwyu!c~ z0kU+|sn*wL2P_;d|Khc{!k+Q~$#m(7xOQax1zP_?sDG5)t1};k62m1CO*C%UIUle@ z9z7YD_0dtI+a>IzqWY)yIz`lWIikmae|E%!M(n0)grOliP3`@-Gg&^B8c}OCnBVeJ z^5CCjl%~GsvbK9bi9MAC@?-#tS9&|%0YkzPn-gKs;`}r2`ov(>k9?%JtxC(hWp$qN z1x*^sZMHOpW2|kWioKylaeeVnRYat6CoJra+vyDMy%QH-8%q=?YpSq^59y-vXJ<9& zTsPkqA8vz-l+|BplxuEVhpl>PjJ@fQXn}t%iY1slaf@y1+3>EgBuk2XIJsV_b0Ld^ zUZr#AqdV{PBsZeeEW-+%{uxYX@<{y1r2;zGffG8nD3Ibf?&nvCzJJ10tiY9==E+3G zc+r={Xmgq>47ETqdEWfbBxVZ9@|?=l&(stYrInT%Lsnoj zCXm54(mI%`(>Gw$OJh?)c6;T&@(^pr;+QKT2-F{%5dGe|#=Y;2nvmKL$IA%$vWa}+ZV_+U!Dq|>Jcz)iHfdS zE+6S(*bDr^`7B7pZ0{+n!rOUK`gW@uF&I=Qtp7-`n$BwvYV2D| zGBti3sn}@HN9KPJWSwhTKtHc8EOg3v?Pa&TQYdmvCd~Dl!2(tT^wDZfVRF(FEFfL& zKc}YS{{_;}aCxT2(K(2vk0XMtD@QQV{BGaNt;D6|z(6xH={)^I`J9qUw1w4pK%{!1tR#b&B>zV95@YIV5-0JA^QTV_W`452ghZVrYiqrbMr4-$ z7vT>-6g=XCY5nz!eOhSb7t=Cw)o|aB$)E}Gz_;PG{x=zvIisvuhvHKGQvu@^jC}1I zaMtr!FpjKL0#OY;s3hh5Jy@HTGfjEn-UN60FRFN7VI_u*0{*83>!I$i1+T z;iO4Tcs4p_O<8yMN_b%+nLnwR2p};}49Y#*2LG{O%YP$EutjObGhk z_62S-!$#+{i{|mNf=cbGodjdDR}mnrw21XVUtY<>9?!xGEef+mo|ZhT^y^#Zz|Ogp*rGvaGQ#+&mWj7vnzf(B|m z;;*On{P{H$4-|(w`133PjFNOz;siIz#NE*!lif%jAL6$!II6Iad+Sk=w_df}8s=~m zd?`*s=Ubs8XL*_|fw+U|xLk3gfh|x6CYY-*p~l}mpB@;;6ZopDQoJljzY)|~AGXZs z!-F<4vqJQ~&EKO~hcE7!@2NQt&nhB_!|m9fC#5mQS%e9Jf?3l zT3N@*UJt)|UjLc2YiI>4z4b*jk_9RTYAY@S`111dbtwbONJtT(t0HU*CnXL3%xbL| zNO+ZB<)HtmO&urLTxUNd)BnE+{C_9{voZR!RasIxg7tqT%=5ACT>yfX^WKeDiWMJ; zAX7mg4S#e=2HISzt?ix+X6v4VgT=E@?<%c!b; z0V+w+l#u)moaE^ZVqbAbM`6wK@g>Rta$Q0s*8xEPF1t-1cc*}NgERNc=03HDny(JE ztXV7VJW@o6OHy(1YXDND$cqnu!}z-N!jb==XF0GJBldAHtHiGr#W(+26DD1t*-i<+ zq{XTpv#&o(WO(9GfA8L@(~lZ^^r%M7fgIO=OYSifwHG#kIWMZ_@cHPe6Lchto{C{S zH^W>X6a{g_&mpR@BI8ibJ14xynQ28w-Lhnz8GN4oj`mOOxr%=-#a;R+eqwwJzBu-( zUBvxB#J9M$#Fozx=>&Z5$H*ix--oY9oGyu~T$#1MC@JqB9W*c_?(Kg}X(za=73Z7! z@lMki=+1&(n&(SBFdnb#%U#H$_s*S??_T`tb zVc0SUxl6+@?o`2$rAs9co!^Jq5>N(g4+EC+SLQ@<1&p-Fs;Z~cYrUnPnN+z2i%msw z-5Q$7W^C|b4AeSij3nT$;kR8=sduP$t>t6x*&a$V+GCWTwS#3!=F0Sz&Ly-io(C_n zyQyCZjRoz#@)L63FshpAw^l2DQzJ`VmqeVq=jhN(&A%ol z<8hmTim;g{#WiN#bN~F8$&B3g3j*&W=SduHuE9bdjf+-X zGYzI9#D`y!Hg3<__;_fks#cfJ^S8c){K?h0xrG$hpur8bR8Fi@-YZ2;_WbKxN zo5UMTU1i}CPy`>$-ptn}3^_7^*wl$15bQyXd~Y_!Ow3Orv_|3ZK?Bd-UB>#RwDj2v z3EPQeMMW$kWLsd)rmSN#8?d`vO-+%W0eX+O7bd8$roG4z_)YYb2RqQao$X#$Fh#qT zp(}37cvwg1;24svebcZ=pCEkDj{#F@%5!<=_&>_+$CjQUM;6&i1Rk;gg!wN(;4`HGM2?>2z>Mth1~R}cDUT^(El?%I6(9>?J#Tk2Q!-2HoYG1}Bf zioTd~pC^sgbag8^k27AunISSK&Zweb?{|zesuOi<#^w_m*1uB2bzOA7_PLj(nx8LF z>V9x~>&?3I8k|0H_bYp!hx?{cLFj?2YsJ^0fI#dX`^-Fj3&6NGDiJgVh9sbhnMU5N zzEi1JAH`yLs_p*kMWd1FCDO2VhFu~JQ~+r-jd2{jDA@zj+MGqeg&-4}-{vO|E!`P` z@(R@6v^4WKc}7>o8r}L}tfXFwk?DOi2fJ(mK46urNU1m+U~u|is_a+1fx{nh+Wh*I z4)c}NeqLCFh8LG%*4UQUJAAEuDUgPU(i-MY1Q|$EJ@k{bOX2)ks%=Zrc_i+yG4?GA zlaWqXD$%;!jpiY#7ktqFNCk#-UY)&{h(4+C36fF@j|C4Nl&iS7k;sAXsvFg}efJl^ z{7DXYw}RfK=tr4(COy?o`Ss#WUa89efE>j+EBgTp7=rJ@zI-wH(HAdfIu9@&!6jfK zl~Gyo#u)tLDb#fz4=FTb$bZ-Az+?moi7?zJw-koE9bHToSHx}2VVJawqkArnMmgXo z18qn}WsNWCsa{iSa{4)nA#_+w0kZ5R-~j&xIIPEh8tALNBtRkA@WM;)9=e<+WW`xE z#%pOv?b9Ov$oRB7^VNR*Z!Q4ja7i^(c>j%R(0pvkFWRZO_ZJ2NxCS*hfWeMs{VYm^ zik5z$f^CcIth{4IabQ~Pxbw1DEk#}IU7gDdeP?h;jDdl{rMAHf2Oao9a17%s`N{z{W$Kzg;C;mcM&y?7s$Eg>jl@hnUt0DboF=jJ&~=<#@tuB=fX zB%YXjbnuYZeG$l~3d7NN9#IuzQW;<7+-X2X9mTN)0A}}pBcquVa=(1tdRFU}RFb$D z9`dKGDE{n33f1n*-y(XNQADJ+&$kbd;T{}xkxaImIa1?wgfkOD)6X{CP?m{9}Z+4_g^NgivQVUp<7hCqo)Zghj#e81~l|_4~*CkKDCa`1E z?SphI!0F~WN$6}tdE=@HR_k1hxPC|dp@f<`kKS3K6ET`(bn-PD@&Aot7UWo?_@}+m38%3ecnHE&p+#ZJHg%5#C7Cmc26yf@LhHfzYQ?u%j`s| z>+I|-%1o{M02}RNU?91JPajjD;RC{^r^8824+8wUKPpc({fzc%ZSN86jFA}KVaUtL zDgxX8qvNEkd$Q-mWcQ=C%YznB@Ju}9<6Fwk0qZBgbXNcclrsCXo7rS_1;S5??4&1n z>qLaT&I4-Mcq2%U9(@pJcp8Eg9~S0jUXf+05>IL7sT9SosS=$l4X9KraJ*~% zEF~s^h7hx<0HV9V&{JyxbA$G!oH_@ha_8C$jm;}@Rf=|C?d)qt&?VVme)h_DJBuk< zo5RUDL&x-O8to9yw^2zI-&}1y(qal#d23mmea3hR}A}y?+ssGUjCZ2{6_VEBT>VW;?#c8jF#-Ye^X?*57R1gdFKs+Z;2-o$-+~= zD`;umI1RCpg26dnw0Ayo>kjWKZuQ>}6fsA!vK1PbQQRL*rxs`he6;S@Ub)l*x;9VT zCCe<*GAVH(xj!y9Z2yKuJNaKK_&K{Tx zIG=c3Q}j3FgF>>&Sv61H=KhEj{k zGc1Ci0Ydq89C737x~-;(WSc|UsH6PF@31QoP8+n&(tivvlch2|jY+s-qQx~S=*aa6 zUS|qa?)_%*7%7C@xgYgwA&MRrsJ|-37^Vf$mJxx~!UHv=A7V?pBgB&_tJCR9iuuo% zmi;%ymvQNjE11#`wcaa*Izeowox4`6UIF17m zj_f^OTX)|Yn134A@$3hDfxNG9pL3#8%<$05v+lb%_A0g!ph%JM7lE)@ZKxRD?O4|& z-x!jKCP8jsQe)9>N@|vZ^!*6I0nKC?gR>hCJWt+I<>;7tHKppe6h|16w zRDFUL2x6XP1e)c6EodK>4|u@hdi%NTM-_53zkHC|bP%l0lJ zsA6^2?(Nk+9$Zt z;$=V#+El-@i8Ve?~hm>Txsl0X;0a%}K=H`DGA96y$!qWdfg(n!^dfm5y z?I`wh1~w9|vc2qN?U>3@n$BO&v-1Ooyx2D7AhFhG{EUu}AJ?m(p)xumP>!0qa}sp7 zB$_bMZszGE5uRCocSLE<_F7y?@BB~l<5}kFb2Fas9nkEO&(f~1;h}(qt1JJiHrM8= z8>mpBTW@mM!>|3)`_F^JaMf^hZHFsTI{j)l6`>InaX}UMl?XMgEfKpH0VC1!rIrNE za|O_rjIgWM&Wd@o)aGdt$JwcD{ii+N`84exsaE{q=6I{I9+Q(_bd7no%r!dE&EIM? z4qTX{w$DKV!P<#PoNmnbDbwzA+M1D2p=?rBZ2}eoJUqN>-c9e=7P_X{%brjES+WPI zO2vI3>tC!J3WVJj@xdFj29}nK_v(IhJN=5CKv>P_v1|@usJF7%xK)>Qh36%lN9Z@& z_v~z0U6*AnTmdMg^8Eb%yJz(2asITbR3v;BZY*QC41FGUr+9U@Vha1WK;I zxz(6qmTPX-CM-C366wqWyc@G$4iDK!+$jSwOQOl2T}PA~=NpHp9z zmjssJ-vGqJ%P*6-^st99@fE~{G~fSiF(DSZ%zpol4X&{7?+)-wL;a=B_-~N<^2~E$ zE-JKutL;V&B?D2_l=`5j>yM+X3#%!!{Jv5Nd8gz4{xcnT@ySXfO zu`y9~*{4}zI%L3Qzw-EcbeG0>*=Nt5U9;6-R$Zhj+r>wh>f`>(n`^1jq?pwd9?(->AH7M2N_0m*9|&XHF8$`eFhlW?yX}kJ^3v7Fakw;qg0s!85fV4e5845?WcE zHR!)*@nQJ;rkp}MChkAV)mmb4d&Z!w!QyPz>7H<9wWqjRFsK}$gEp(;J%X%`Q-B}@ zEcZfZpA7y(VH9wmnw$#>i4NLpyce*#?mtP=2sifZ$kOaPEpo3s+ePZ{EuG^{aew%4 zyr%tvs}b6J*`6T`PX-LtHY29PoLV3TcOhb)KL3Z*=ueUD-pERb*+RxoO=Oz<`K$dH zjo+&JGu<$7v8`2o&u9fr%k*q-_e;Sb212p}Bi`<`#bjRXK+150XU}+!tU1pb(x1>& z;Wmv(M31+i&5)23i~kF4=`Wmm!ad5K82f2p9OQp8Vh%OpOjP_x9;@}arUoq`hVYZE z>iywLHwv{l;9(%tn$^P$0W*2SH_`&ITDRriX-_>kQDqCWxle(w1Rd zT-#Rms4N+EYB}(IYO8X7R}8~T7PG5j0&1OVnnsKsQpNkrojM_*}!o2E+wE~N_#pFAW8 zJ+Vua`I$*J@Nv>vT=Qp72hxy{+3P3VGZ^UiD_n@qc}HRQSK4 z5bFj;$Kt>KcpjlpI!^I%ZtRXb9*M5|f6T8|zA(9A_9$-`c26}tqPEYrWV?A}#1VLQ1_b*F){E-h%qWg3`-b78VxTHH!AY9}cfAsd%|vB>{Xh z85NfurDCgx(1kNMb2WTd8`Q$R$*bShW??s58SzOCmi0Wd5)+g*b(O9 zkK}&emoA|hlC5A5C{c~Ag!zpBM|Wl60cChg!#I1}oY>z@tKwdheTNJEA8>0od>oE1 zQP^(A-%%Luz~Nuy^0Ni&NMgR9Pa+m-Uhlx&n)NPb|irlG&>PmkFdUW zp6$6%owqB|D#_*Vtba=LZ0uNuas8|`^Vk#?m#?+CF%T(hGKSyNt%@vd!579z+%VQt zS|kp=qG|d1W`UdcH9<%mkF%1vkE$;9QN9fXjY_>M#X^REp_%pMyy9H-{bjkiZ4| z$1S=!PMy95=g$W}7qBm!&TPdPGO=|xS zn>&s3*bhx<4KT+!_*aR)_}%EBznSIQ)qzZ+{VFpw(QR4L$+_m6X01yJqIS(8=#HA} zkCL~yzA*$20=EmO9v8T7ovchPo=P#$_Q^QK1 z2+p)Qf2;3oomfp8^0`mPK&HRe)~Lxcu&kOup8gVM~%})(VT*U!e3ZNaR;O;D1IIu7e{v;np1rxqwOSwPsS*~th`}5G#@UD zBMjI*z?NlA4dw;3*~@S4hzS92`!4+HVg#e_;0j)KLtcWntNnjPMEx(+_xE@G`AVP5 z1AKm1gBlX)Nbvp?@Lffh24i2z;V?=mMCWAroyRBthrPE9i>htkzAqCHkq!YtT0%k* zX$0vG=@3=fBUM}kwIk07-Io%DdA_=|%EtbF!B7;y^)# ze4Q@m15|3Mc9c316MVrORsWd*(i@mEqYzk;1!j2r$b+dNQbRm7u;+B;;_&Hm27#6g zOr?V*C>0P(O6nNLGk%n2@9bG??3O|8C%Qr-IiG_?uzN}|4IcYylw#ZNCti7@$Ue|OdU-PW+(6-T)85)91e3!oo z@59;%*;pPlzUTP)RLlHLMyO$LB-m)L8&GX5vzpK{50=sZo3dEvC4XkI;ueyf|K7MrbO1-?2&QR}OT7}(1BE8N# z1uL>lrzcZhzKC@qd;5Ly^&fnp>#>TBtMvL~WtQ2GdMkgH;kbAJS@p#UldQ!MQ*))R zJL0~ad%^(J4*pQ&9Oaqc1VsL6x?}G2de3!mwYB7)9Sdn<9FI+%VwoG&`a0%5Q!F*} z8#2mmsE;G5-6|+;-a9*@Jn1?+xvZ^?ZK=07sNS=&a*h5thP;|U!LQ7(xR$Jne}_Lr zx7yg2G7pl7O*y4NP_Dm%P`02Pzs=VC;&y*qpbJK#pGA4bRH*>H*YTLwT|^@B%-YON z*caBr7k!#3uuaIR@-3nC!F#8hXM+n!ra|Z1BvmviGPpg(u&OHHA-~;@6w#_!W zaCV4|^3R3QZ{S7F!p@HF^7D(YtwP4RuoWE4(13_>Tz|Esc__3vf3_%ZE}(QhEitOP_#sH@4cAwEq1=QEzKlg;?G z*F(Q z#2=N9t>*MxNEd@K#Wv$wU(&5NHVP+C%IX{;AwSvbAq~e@uCSZTTuT{qYab({q?CI) z+7sH8(WOCkD8-Y_GFpujE{B{B7uq zd!}E(wdJgqCemAfRxM0pFP=~N@H#3;8CF9V;S1@-3mPt2TqCV1UnN>3+>_ABbum{^{-u@h7S9x5L9ekPmg{G zF`u52j2Z21n(5N5gZn)Pb)5og%=HVag3BR|KJ2E1OnqTh4UFiPkM%Hj6GYM%VNd?K z7AJVaupBJPaDiJG0V|RUvR^7D>z0wi7Vq}UYeorcg~rm`g<$MhmVBKLM;I!(&H*X` zD}l$i|J!yWS;=igi!3>zWs7*I$j+i=x8*uZ6GXb9su}mE8BfcshnnljDz*OSjKCp& z0h{Gh6JLU}JxC>}YulxV(Vd*utB;?MY)niriwh<_91UHIdHgZuy(%_Le)zrf9kg@- zZ{tZp|Frtp+`ouTs+T5pWn_l^mMP91`QUT59XFVr* zo(8%^T;K4gL7k)z*i8Zael@vT0`!Xw!}iCA|v}> zpYNQxe!y1?DBe+#{N~9nLcr)LTQ4Kimu6=>JF`k^r07+ul`E4yklifhsfg9qZBq7i zA`Q(pFo@afxj1wdB~{p$%KM>9`cC*xrKcLhh4zuOB<}9%b*3{SdGo&XU9dHoN3>bo zJ9oe?(O9#-{`_1nXkcRb@*1;}(aV<%%=+PxC)r7nCwuu`M6Dlv*7=j%%CWypWYT;; z-6n>cyys+N+UsVSsJWL$-Q8a7C(L`+k-gmSmOjhHq6=A()UaISV&tK32`R5EtEU{t zi0C4e%JM%=O8nX7h0IRw`VsDNxCS}9c4@=I$70gA{3-MJG0e?m;od2-{!ENbRr{nJ zX(_#TW;Jh{lZMPVMLi_oxE9^&d=eY z{T38k9Jwxd<>y5|V;(5_PlmICrCY)ap41f0RcNp__HDdTBqsW>9-$N8Jh1w0@8REz ze{N9x$464xnab>I=0UKJZRfKM>}PaJm2S}C@08NqK8Sn=U1@DhADbDVe31Pks7lXJ zv`sngDF5ucck$CdPIpe1Lv_fa^Xe_1r+=_(G-ysJ5FP{8Y3YzQI|Evl4e&^8*s3d^ zvKV`8ZSh)R4EyJ?^;GiMw=01{o8t);SsFc>Zfc*yH~T<*(MN6>`+g7ZQa(y;1lxt zn4!)ivC`#L^)}8xzUxa@S3F!nQ<-T);_M_81wzI&J;whS@5qv(cdKDmRag}8aKfH$h$;zmR{!8F?}u1Sft`>7F@6uE9>&_}d#$f2(cklx z*+%fkZg!SY`)?ml0hR@4o?+wE&OG3gp`dq5Q{r2^bk7eT6N6Om^)bkdKI`o&)?P}f z#(DBLP)h`qaT9j3HD?|a*$f|>N)ZbprWi%MyIER>+H?wyf z7&7>eho7BWI>N+h^j&z2o1iCm$%%v_QJbzQj!G^-Y-MEGZrOXRsg5yL?PQ%B*6A|< z8O$Zxd6IojJdp%S$?y1ns9wQ~8de0@NbIC)jr;I1b@Nm^{k<56^wiXgGldKGX4&uQ z576eYf~VUm+nT(*eBMPV3?|FZ6&rVHW$}naCUoz1FN9J9W0tuE)>ax z8cz)wFahNc=wICYEZvxDM@fa{Gp`7~ADv2pQ}w(W$L|HNblyX3$P8l(o%|G~n$Wbe zh~vC@{%w&3$9QFyV_ZR+98Tn;{_0FT)#VKpmCW`>?ZkEH3`=>#cje1UP1PC0`BhuP zt6HL^zCJk@cwkhs=>rF0dF(57b$&iW!NngWH`Iq-Sx%N&YX1z5#}w~CR;gKPz1=T0 z*;6cMg})!Y7=@#L4scmgnz=Q#4bvP$x}@Rp7^yX45lOzrUv|WYVqO?emc-yp&s}rV zMmxN^`z42P&8!rjwa>!X*Y&W}!W0(6c8K#dX$4)K0d1J4BKhfozDAi#kT5cIl7w2X zapS6L_8&Es)7l-k`N&ajrF|3c0L)~EHLI!9E1zrmadHJFo^Pg#4Arq2yd#mzfp57C z_lq@hS&l*vro3S1N&~zy!`53tD>UMb)JFHeyw$`V4J)AZ)Cd{;k;rZccLE0qP2KCG z*?PIFbyD#1%A^~T(b+jPW1uX1v^Z5(sH?vy&BF?R`{rklBJ?TC@wc0g^S&M~@qRgr zbHZ9Jzq5@Ooj3Wqa&y-=*AlaYa{obej+Wo;IhgNvkM~v+K66QL)xQ;MP?zmZY+oa} zy+JdG%ouE4(x(Z~09{w<@o<_9F$<(l$1PJS;LG_gzhWc!Yyms*KE3Ota|sa*zr2C` z@S#gjEKkOrQLGP{Kdk3wba;Aqj+iD8y=|@mBs|&D)?@p3EG%@+Pic!2?(Bx!lcsv<+ly}#{`ln){U=@;QaLVN)G#n5*u!{hJgz&Ymas&LvKhUNx5U-&PdUA=9 zZe`hh#yjj`qOzo0WaBZ= zs;l{oI$}Qoq^u-<82d_S0*=9LRlG9et|Tp7vT7^=orJB?qSC4w2TX4w9-A;{KH{i!OS0sR8#QBT>DQ&N<)v;y^NU1xlV^-!BH&uG_y=eh!Aifg)@MQZ`> zC#Xi#72MF~;x57LJA@Imva{gxn<@=?78OmuDRU-0RVjpAQIG_6xL#2z&=X62 zcpUHJ8sH*C=qn@q{Lp|4&SCcDEmNp$6{pm>wR|{{&k3E1NRdt-s_}hyrLQMTl^IT_ zN=Zq1_4;*#)&9&wPzO?;AUC~YzzGEcAROsf?oZN7oFXg@gM(^(+jKwn!rdjSI7iYI zD4SYa!CuF4JeVdb8~bKGQ_S?$(osObzJ6UF`f7EiWGN%xXf;)5NdQ;Lzd}C~9psOhNUkdT9gYk-I(oNYf$9enHeJ2Qrd6TSIiXhoP62lc#1p4rieVEC(6*$( zWwa`PSM{n=DWE;#o_?|0)#tW4c&H;I$wcEM#iEz{kQ&9Y(wn*)d&BgZY}-9xmG6&} zqY>$G%d6lLOn)pQVG&LkkyW#rKa#=3_Ah@Mjn&$tQsfSYOg97VADy#2kA5lXd*H-` zFAesARW!|3ROalttk!OdaAir2(*g_h`f)>HCFa}en+=P0X1Ygl75AMVKDe30WISB$ zoIEsb!<`gi?g;6CdkxtB+2>PvD*sml`4>QZa9E30N`(_HdSJ7KHrzWyI(eUDE&LZO zl$!RzGUA>+rYRq+nqE^e(2{2A_5ob13j^lhl4|W;*Nu^>(dASWCYD7gv`wb(Xa^J8shP_{1 zs5XK&JhouLV@;=m+g@(j-xeMY)}=qbE0B2kN^Ddjau2 zm})q<0K^8%l0qslT z6mC9@h~q=5lR59}YuDc;1O$C>*U7)va1bQnzjRoWe$Exm5F%U>b`nN9SYw`UwQo_;gZZT;nn#ZaWujSx>phY7G54}*)gd4;g(#=q{+iD=XR9efhM*AB=iXI94?H!NFOp37eXEXazran`Z_=)KL z4c=0{>ebRm2wM$*S=FkKcU5I8>>pQ7oSewKvRTnI#u%gXE!t~OYpbn z@VYDOu1p067MpAiVwi1}XT#VyL_0Reo+)O?5EEJ8#l-uOme?RxRds(^-o0Xx?RN3$J$aIT1hA1&6@9c%tvPcG*mb|X|NesV-=6uN{WQltiIu>>2P{?g zv48SMb6hiXN*#81Wi)I`ZLxb4$hIzPlhqOrOS3hW0#{l%W$sfuwB)7!#7Em{bCLN@ zy%`zbhQ4Q1QVJq#03%BrVci;bd0Rt;7{hI(9Y3O+yk+J-{`AV;HWJ^CQQWosOEntX zqbl5cAqv6=Pd~mAH(psMH3k{2xc^^+uBL;t zlJ&Z8@cKeaasRM_I|JgaEQzt!s}jPalip{!3)DIb-bjN(9U-sx-12K;+80F8ElP_L zEJK&BfUp9AWH}X&yYn`wtN;+0nC>s5^zvof=o!1TORG9RT74d6EVn77xvFbY^gWC? z;n{tT!>G`YxG4-+bV9udKH?CG>OrQGo9n*K5-MALy^PD#LzgKm-)_m(Xq8(ToZJeg zynTx;3Ughzw%cu(HlbSCY)dj$hi@p4aAv0vcUGuR-eiF5YF{**!$cuZM{BZv)&p>% zOqYh3csd!6>&2(!;nUQM_{Y~An%5ot2%{LI*fCam2z#>wQ^Pn`AOXNl3Qv<+!TZcf z-9qdfp=I;jR0w)gONHjF`qP~r>y=CJ?SE^Qu56*(*o*ESiFzaWrdHAt@uTi8N~JNV zbz-dTZOBI;mmj#3J5owLvC?M^Sx4wdYCKK}FJ7C_1Nx=#ri6mjKJg`JTtva20;%9% z0x6bi;9R!0hzE`Hr$qenvt6%+Xpq2 z*XsrGZ3OQVSDG$yP<0UNKRk%FNO9EzxX|R&tK@aDZ^L^pC-9VE+EkzLuG|&sN zxw_86Ew}uqxKx9owX}YycZQpv zXdY{@=-a|icBLSPdx_AXWCfQMV)jqvFkv^_g{6RvNF3d9Qz|tHi%7f_N^~aSh)| z!e}~T==xV}i>@&?k~zUM`Hq*{$}IXQ8^ytEu7YyAw~*(?HD^DpMm)mCyyiqyp;(xo z1Ni9wW&(XL1}=N-b`oXXuQj$cBW3S|JvB9NEr#MdrJIG;SMWKEyU&lGLE^W#vX-I@ z+le;=&%zKvNFt{=N4R&I5c!{<38T<`LbiOOE@=xwXd0Sw!NL!#<^2|-RPsYS;e(|> z4~N4Box(7K66YXpFSWFM9Vwh0!LMW%^0Chx3rlPXvPyP~xICoTEX~)nRtHQw*@&yQ|qxR=g3(X@fA*N@34Me8eE1|J^=cty(iM& zZ8>K6lcfYXU<|4vr1FisZEfQ>AGhAk?U$r^5oOm*zqS}SU^JPUpurf&mj>N86j@miEe-C^mc``nKU8z;;E*g!l?`rVdW)~wVaV^n#A zwWPpXKQ`XOwR23L4Ug@M%CCgBc_3Ms9+z2G&W&3((UNn!;HD9#aaV3)QfUbgL=7e_=xg^cb1x8i#=F;Rbp$0XU)0t+7z-;m@$4>_JeW>=A{u> z&amHX*JF?T-9L5j}4XTQ{%ypCBodi#9@0A)KntBQ5EwLt57vc_>9qEP`p!W1k*{>`yfdXvlZJ`p&tFejxxfAROB$_?OwL$BG&b;F$E_lBpJ`1+OK?^q$%WD zG@d7j{8(}q6HCTNL&A|FS(8Q0+N5y^vots^GakqimY#2+gt08-6jN zQ<&8rbL1KUc=it%^jla7zlTEMZ>x`st4bEv#e-LeRNZ)bS3R`>n*B#vPh;mTE-tQu z!ZP2|sHn1}sHi&^=ZQ`qbe~_(A%8@Q5InBzY|12U&ze!4LITup2rGCu%b$&3o`8k@ zQeMNaF8gNL5$eunxz{vcKGaOt*M5D^0{TMrnfV-wDqjBabrI^=!8PYnL$}`B;MCLT zMl0Ry(mxDdY;V77^~%|)ij7o6sQV8(*^M=IYbS}%bcwAWDkD(L-|8L8@jD|ZAg0s0 zL`ZCKzLbDZT$dk-MR7z5%^;om%~65=^kte@r1}vYPB)SXl7HV$0_keVN(SGO8r4yCxK9NtUf1 zgX}(|VA2FYU4jzFpQ0jSKEj@Z0dgec)qGmqyeYcrNgBIfrD(UA~`0vt(kA2EQA^!CTSv9r!2T$tR6!?{KUB_v2sE+N-1{CdY zBfW+7^fz2fUah{i-X|9;tUzV?TsErtS<+M19%NUrT8w^p{YQoaj29{t>QIeMQ=M@+ zE+&-5%$8*I0HL#0_iZ3%_(AeR-&{U9)KN&2xG2-gGEM!`hu-^Pz5L*6d{?H!LUVJa z#{Oix$>tn}aei5B#jEPPoD4~CmpPi5wS^n%Y!J~97@C|?n4Sw!vL2XIwoA)Elq$Y*2 z;@QEJOyNAd=jVZ=cYL{!czx~FwEDBW`(zs%A@Jtr(S_~pxmh)5^8_4)h3H-}v9Tu0 z{ja6%AD%Mz)Z4jLfCweF3bI8jej|IK>;qlOy#Nha@(E(S4c1pU3Rs&L+S9&)o>mQQ z+t!BO(`Uv?uZ2F-eZD=PyNVyI6yM2Yb=>lf1#oGKCK2{XS6*OJxu0j8Rkv?f!B1#8 z##We-=m!KesC)Dq-k_iXX^5_*xTietpeWYUwK5g^|DrRkD*CU?xO1e<%mrV^VPTQB zLr2JaTUMHGz5qExsh+2Std`%UVw=!B1!Fyhb9MEG=+K{*VT&scZ89kY6Mz1i z4)>#9pfQ=3)gf@Q)4k}yzobvNRc+H0A2-xbJ)>QU{CLr>-|iRsQ=6)xPI0;=Y&lY= z?lwJ=7!_{gc>HSEb(ng#_4{rd{AtfzsmJI-5-V$L{Zd86yHoWS^ob2Q>WwT!!P9~% zg`S&?1kq~KTBeuk;(D}$`7JrLyTa!b)n~#s6#3X##a5TF?CqYOcyL6USJ!Zp^%&50 zF#McwT~pcqWQxAbHS{ql)Q|ZCUlz{r3S$St7Soe3rX*@GCL@CzQ=+x=VxbLVcqt!S z;;!K@ecrtDSGVfMP%tH>;3s}CD}i5{6|DdfBqmXy`>(-!@sU+PvR^lsi{&wc{vv|P z(mc^qd$p8EW?0TfnX_f($5-6m13tLzV`8VRn<)ep)%HW5>oKu~o3M@T*QCdKARu@o z{XBTY1lFP(ML{oK%tcJJ+Us*I{^qJo*S*na&owqS1fNys$S3%|*NZQ0hxnF!4La5n zJ(h=<_L0FhUath0!EGTnI`m$(xKf%v^aouUQ$K8wuAiMRJF^wWmd;h+_`2tJw#*p81qLfI303sjz`Xu@$8cAk@Xn1^GJ&z@ z(`ariS!aOe-u(1QBEg*q-?!%#4F7x>yPZpK8>_BAw6Lo8De=QyRv{2IVoq6Sk~f|J zja&2UkDf{EycxtM@d4q@c3%K(Xi<+lzLfC3wtUZ`oaqSOSW#zV`y>{zjLbX1KYEAZ zI|vtBg+Csvu?83~*ixK~ClTS7J)AM!^hqcphhtsg`4ux_@Iq3H?V&!I-n(@MRu|si zxgtGZnaz*;U&(}cXEMYydz?Ix;J}N%D=34kInB%Crme${-Y~bM_-Xpemb>Eeo4hv~ zZqkO1wT+Fi>Dlc_u{{}S`M|IO`Oty3_ZRO^1S6aLPnjy&z12Jpl3FcYbBt^r(D56f zWU6w787hB>Oqz!#MeLjR9Ww~}IBq&TsqUt`z9u!sS!Tgv{S)alqYCiULu8TIc*iAr zy9(+_dx_kh-jutH8TSRJ9^#$8!7N$1_U6>t6GCwLEiu`M-wpDKJ&c6J>bP+ULu6F9 z;3M}x;n~N@FOd#u>AsLhebM7K1tmfQaZ`iX5uLhR-?S(B&}oKXId)^w{d|QphR)UY zUl0#TM;vcphJKOicvO;lx?mSEOyN;xl*g!AncBh%U(B zXEqotN3NdKY4EuKW7lv|VU34@e1g{*W5xR#kwUA8+U|k(@}}e{O810 zC_4oDV;ofEWkz?&J=S|R*Jws}!}1XgldYG$2Pyh;`|jIP&&nrANV#Chuj{hV=2W+N za1KH+Rx)S)gTM{QPZ_0BE2V!b$1$>AmoDXwpR9d28feDx5@{D_UJIDTv3KKilo{A+R4^UwAo-H+Nz)yP*uL9~LI2KpcbfP7M5nRO4ZaI6COc(TWvuSxcyLAMqnwgo4it+a!be_<2cn#TXxu^u7UQV z3w+!dKnB%(y0YfaeBR;PU zGTT_4Q!j#X7COP>o(e01cBmMI0GbVSo&XHbQr5;>h%%rKS(1`E+F>yJ{EOsP} zy%Nb$Zh6svQUpSg+cFsL@H;lrB`Iw8g=r?g#`Via>bAAEbkTIvKX*-($QZ0A51fHe zJYHsxIo8n$Nh-Ut7xB!y^qS`s?7}tZfQmj%Zv|RAO09GBviRl>(;AcW8PovF&%; z>4m$ewOSz?d3E3Ltw-NSu-kb&I6r6e0nRAfnq$8zNZsJM#^5Ft>A$0IN!t;Qu@kPi zr+W0<3s|#G?F=~0^1nSCXqo+3cIdt-d5Ff^{h9bGV(!R82_5}ZM6G6iU&3k(Yzs(6 zfLNtcF(^)ZX6O>Mb|Q<=i2gIbJw^m~`P_ZzO>L|9UhCOPKQUqcG%*AB{@gZ+&pSD+ z5`MK?C{b@6qSiTwsG?l=xWn!|vBfJBJ6;C172Y$5TyUQKefs^NcS2U*QCP2A;$T$U z%#lu-jeXWSeRNW=D}X}(SE6QIzH{xC4E760M|>q~`QN|yel9LjGwtKs-T~q<+cA1@ zizK0AfE-1NjmcUW^upJO_XQmt)<6`RU@Hu62-N3`#d!YrC+G|+M-c}TOgzCY@ebWo zP}C#WTuK|f21OFkk%)zd{U zuF|ao*$REziOU^?(8O(^D&iHIpj-udEU#UYh<`J*wcGzmq+YHLpF5bFZA0HbAo94d1Bnp)u$#?E-q=Diy8adX`mM{l(GWp1YcR>VIQ$ z?HzPd`~geKr#aQ3E(-5@zM<{m@DdCu1Ik+eNgGRJ{*&G{dkIVO+ikbEB}vBYtb5r5-RE*Z~y8m=e_4w{c^im{dluq@vd<` z>(nh-A=GamsoL;wt2#Q0nV#+Kn{KL?Ny(&A^lJ{NXVO)Ce?wdQ00`?U_kl)kOIPay zNN~ev)59VATyd%xb)zRUQ~a3g$+xzwezX)LkZ(gpf5l-%IC;aYRKK!P#=j*5ChW0i zmU~FTcT0L-1&q{z(~ZDMTU+M{{@A-_%CkCIKwi}}6WOPpzlzE%G=cP+XQ7bcfz1PG z0sjh~8ODENwP91idC=I!NHzl(5RQM`Fh&-y?CBd*ONQ69q+V+E+o#X-WA#+#1rVN+ zB^(CbkIWhc5ihpbR5*_yIOf?Eb+mU^e0;=@ff4PtYYZADW}i=NMo08odG7q-OA?*Q z4tA5NaO5*vp5A_VH&R#EMv?pq@)samag7)oUxea4U6MEi&{zMFIG}*O(^Qi*y>e-p zgH=2}>6x;qOl@=p|OUlp>qGWZkdps&z#Cj|1onCvq9Fv_VN?( z9R)Eo8I3utErfJO&Iw%lsy{};7v1+ZnG+r!)&moYcN61eLxSw6S^(_Ig?J6Ct&IZ|Z`oGY{cWMo^Vp!{9< zP9}(k%*uyvMZOl8^iehM1%dsd7YIyrlZ9LAn}5ja?WQy=H2)(A@8zo%&d0_4LRzV-e|AdFm}KILgEincn53}&IdSK0B$4)^#7mx^3U8C3Q~~o@=!{5%(A03mFj=90)w#<&{F)e0@`o) z#M0$_l4z7oy!$^dxNq<-7Tj|tz&DzRg8yo4FS9VppcLeGmM`D%F;qfd-U>^`Ep1>T z986C$jVUhL|2q1e)J9Wtv_z}+7Sq6UU6?_%oW#--2xocO;NpK}>|8(I`n@Px{r1Wy z+aecgnT@G9hp|IYo5U~CxnL@5--7}laJY3S{zhQmM<|88UX?iq>l9U4qw$xYmIzO- z>~(#5S`VTQN^<{|2KNCKO7I6=ebBk|7X;k>UgrL8EicpV|vSh4e=o+F`@2{Ny?bCZ;mL&3D$Vtt*Wb#8eQEU+gO{EXH_fDrbgY&XPpl>LFSm$=TPXtUvT4<7 zF|$TTuCY-Ly6OJPe{)#5BoaAzyQFl`;5<7=Y24D%W}$rQ=C@J=A)>LG&N5M;GgbsC*;Hj+ma?j|7Opl7fS`ybvrlv@L64!Ky06-P{7jA$gn9Dk-7- z2LGRm@CC{2;~0L_GHSv1baUH4Ny!(7I7)0`asR210$oVxXD#h$y^u)H@pnBC@;>ib z?&T#yA_{2y*dKtys)mw)qEkI;!&AAN^`F^m;4%urq0#5-2o{yY-fmbP*y66By?jR^ zr+;A#U7tB}Wb)*RmnhsH3aRE9-A!=xB&l38EWtvITfnXd9KCorWF=8VkAF>!ZnoN^ z%9lHrgCtQ)#V}PSPbU*PK#rkpTnP4aT3a-F_|S2)L&@gvK=9v83o<*Hnri>fm-r{X zWm~%{ze9hC&R}SnN%mHeJUp{ zy&!rPX`d@rV-KXwlY#*R^g={3!wPkMJ*@iE_Ss?j(cwip9brKQ%eJ%%zEFPB-X=MT zUyB@tA;#MAB6)&Tr|4=kJ_*@kQ2Nw6;EV?0XQ*_ujAnQFUyPYhkPD~t&+U;-p$@go z-$|@exGGfhzvyl=LqxywS*7IVqkl!Qih{R9d%jUZN+DGcdEvh`eGAHx3Q+2K{UX^& zHXb(FijWeYKL)`biOWsYeEWRoC|f$|76uy`UA zmxl6mBNqBI0Zaz$M1k2mRjOcSM#lR;!)Dh}4J-i63}mZc;8^AhQ#6Z>*44pQ(Qj~! zO+r@8qle)K6+I+~Z-zt8g5}%WwioLm$9GWhGYu$;Q7cc`_Ts=9Cwxy`9pLIur4m54 zO`XTsJ!Oa%nr!2JnxoIF->5u{0YK)_sG9C*)K`r$>2h_LhkNYtA$z$xC0wId+=DV* zqSDgt&%g>vELMpB+iEvj&}ZN}%xvS|*WVk-ZPI@x0 zPK=S=CCF6*6_9^$aPI(V69vq!zw*>F8~#bezDX-Wsp5iXJX<#X;~TqkR)YTKY=EA3 z>x{E}US3TFH*x!<+ikc9|IGRT5k9fio66F(021EE8#E`@%ZAoqJk?KF2>QEr{ zZJphs>28^j3Z8dt;%lEHupaBL`@UCRcJC-R4VA;z^crN|{zIvIpYw*;Q`i^1FpWz1 z-Tn_2^JdBgCaVvZ2`aVJ>;8quGw;^>OOyLMCw9cR(vlHg964llXrCZ2``Cr2xBP&c z)_?miunp5>Na6NxlWmZP>YpvScYWnXXXoL(AM#rp+m~kOS7&2;g^{pFY2b#hJ{rjL zKcR0}#@L>2o%x9kdz-p$KyZQ4gL=6uh7rU@KqDX$fk4EQKu_tD$-urdfU}!`XI?b% zuelzXuDG=l%Uy(vaMuqJGpm3$LBv6P;CupJG{c_Y2w`gR%9Uwp{wO)8!u$E{esGO-L4bRx#jfA_;L3bC6_tCB zMywq2AYBBl88L0}5AA$+LqaPBtyufVrW$`3c=<7ckI%N!1HQKC+Xk@~RaW~ni&U?& zMDp8>ai|Rq^F~vU(ZOO$+_lE(G*BV8e>gf)(2tSQpX%L2P}N10PL%cXmZtr8+#d;h zy~-bY!$-xe$ej>koNm*)W|4^Ba$f3^Dxni=K=@YQurd#_-!jyqw5ymedl>*FY?plI zJDKqultJ&GswUEQJS9gXBO@F3Z#M)Xg`=k^`s??I|0!up(j!w#kkjd|tNer}4TKI6 z%|>xgGb#@y1uh8Z%1+;l0Xw<3M~wL*;AWjxO&OlLGikOQhwgHgLpqaeMuQR2dj|)j zkG>+K#?H^o57}W~b(-UVcJtXC%X8h_2mV{pR@y>cK+B-Z2JnaX(>&CumCSF7Hx7~ngTfcRG)cqAm@*tL0X>8v0sPy#g|YEX zZt?Vde>3$3ad0o&>}YjB2b%3(AS5((*XuorfF|2$mb9_42gANoLGt-ofZ?Y+b!#e< zEmgT=D!P&KuCUu*rf7k%-XG&f%+1k=khK9bhu{U(O<19z)wi}DAUo&sN8U-6kvX&Z zMwG&(x-vUESA?@^1?&5}1s`4> z{c|7c)uU8QiLH%q&#zF89BZC|a&9T&eUvTHPRo9FDYVT}#uOGM84H;T;EsxY6WpW{ zJ3NG~zuCI{{oh3Mw*5JP>j6^W!eK82we3#vtCQz9TW-1C)zbA1{klPe@$G&`bC@m+ z6JyP&XF+nsx|d{BiK-Te4y>tP3_rep#08@(2?wVs)x8HyRsQ7SiHaTJ^fmVaMKdmdv)c&;K-{r_&s`Ml(xsC|D1Bp zXH<`zeps#6nd-1?)u?}G**;#_GZhV%6f?~>Pk>=87Z#%TIoAC11GpfcD>nLvsMpl6 zuXXs49uaqWUS-QyFKMrCPIOPQ3b}syIm;%hVr7-T`B%kisi>!u;7!-poYtwf@oJAK zR9a)#Fqcl&N?ZCkN3`)*HOr9ltD2R=yx16GPlylV>%It2D;kRwui#>drQi6r>#bsE zeAUNSzvuJQs%>vFqUpGhO9j>&U|J}sfoIo1{R^|Gug5cKG1hXo{v5p{);QF6jWr4E zXrt19N5rMa`W48c&(*!uoZlei%r*z+LxLKJuN)C@z0pD(ff86gfb7^L?pY=XyPeZ` zvLh_?et6`Kw8o~XFm1lDH}^4~iuKmndh#P{yQ3+WWU%y#PSesFUo}tOQc6JqSf|d3I#7uAvmty87yEB*{+x2tHp`eC@*gT@#LxGVfg1H9 zBJ^D-Dx;Y15WzXTPm3{UQ+~5FR_LEF$A}ic#1ym^)?n)bxD;N?oYid*GJCEZw~WB~p}H9zx9 z#7Z^K0j6F5+sYpN_;3FDzY#>BNI!2Bz%Uk7vWrO4OaqHb>aE{6cF;GVJ`4a>qPl^VZ@#%&k=mVC!=~N(|GTX?-js@)r`mGdE%V>8s>Ex2aYQureMnR z_+2bYUddmG+Y4s8Y+gs09B*hLfFx8J%}()jr`55^9~bp{wx}W6b&j|8!Jwbv)H|Pw zafq0inI+N%xAyE7rk!^>sEL^~Mm6yIafoDDKqC=a&qB-H$RZ+=^?41B2eZ4 zJbW1DuP`F&SfbotD;Re*3}ti8+4e+9P|GU|oe$?$pArHZ zD>qVng1-EB?hZwa!4JJ%)7!y>evd%(PG59E)v{mtsSBhl$@Af86$!=rHo)c z$InlNy>1deG&%4_sxE)PZ8m=0bgnf_DXvxJdO_NpPY0EEodmSFuNfSj!jx=tMH7tG zsK2%0ui0S+Q^c%8H@in@2*|n?xJ-l?^&{CqP)!WPGZVizMob6{Lj(m+UX`(Wz(-XR z#t#IDJOt4wy|{>b;`cxPTva6?ywhq76H96QSbIa%YyWl#F=1Rzdi_L`A%{lQvYq>G z1DY$1?L+h3Oq5q0WF1(j!k!0@+7G^{M2ND`hiqW7IT3SLxPI#TnOUJ@^WzD6$bUw% z0>NM(EKh$x!VqVE=^F8-W9&rLtb;O#Z+}#CI9#;iV<}k-V@0!dXSA4{+woq<(8jICRz*;LCsJS`vLRqNW|8q)=7O)v>lQ~qaJZ?3n} zc@DUlj8qBD?&NbiQ)Y+U2N&_+G~VYf2AKQ1oT3N1M^44YbFwytth#E^AqqmepLFGA zG`ySJLs!0s+=m1|!Z0n`%PMozT=%O~;z8XA1*6lTcvRjx&ag+W4LzJ$9c_PtE*}(j z{Ch92JB?<1qOkDe7ZdFi0saCx9jpv#^=An_@!C@iT8*h)bJC?yb5uQ1?7z0su3V|(%ga z$5V})f^hJO`F>4pcAgF6b*Y1$Ze?Vio`g`>*Uno<26=IXW!nA^P^GVi_E#-QpZ+?a zIT$Is{|R+}Og*Repa4TPtnC|^*f)6YJb$HgD?gTLyGmcewv)!C?*=%z`{;Bz;f*zR z{)iX2w$0szk$TMHC9M9G4^{TO^a@FsvFT`zx}{n4wu)IHc}W~I;m};Li-Jxk>o1~f z)uDMI664eq6isXV4MX&a4ODWKV!ouhfM{>o_6-Uv*eoh~SB6X=!5E8xS=)}ajFv&c zh~Kwv#mwiBpIVLb@i)FYdJ!EWJ_x_^`D0m~3N< zYKZ#@hiB*a+#Nxwi@TNOp~oXFZl^Crx_p zuXeZ#Hc?~naXaC-!)^yfw2=}R(HrzY!3CXya+`p<&X$o-{re4@{Uwz293Bu|&{1My zQ*L&*E>Pg@Nv}Kk2=dY8M1GvaXw%(_gz=wL5)mRyMW@N!yEStc(t*ItGTuwPhqnQPD7bjjC?t zrl@4vIQ}|3W6#5zOvlk0RYI8!2uZN&JgR^`Qbny+R;VEx>3^=x&B8#+5oi-=w@m3GFEx+1kg61Pa3SPKXy||`3lSX0>+a$0q6FK0nVuwRZ>N$bpmwo{6 z)F}eDYCImd3S9%{xnCDRwq5$Mu*G!I1Uns&MJBQt=Do`Q>~lQL{<~-`lVbn^Pgg&e IbxsLQ09?C)%K!iX literal 0 HcmV?d00001 diff --git a/docs/userguide/en/images/apps-images/mail-read.png b/docs/userguide/en/images/apps-images/mail-read.png new file mode 100644 index 0000000000000000000000000000000000000000..dcc805ab07ca1afd5874ecc58cf1fc5821883817 GIT binary patch literal 40159 zcmagF1yo#1w=J9yTpMU4Xyb0d-Q9w_6A12Z!5at=f(8u)3GQye9fCUqZQNa7lXJd% z-@EUB;~xx0Z>ha&*Q#1obI!FY;=PhI8ZrU$t5>hkWMw2&U%i3>zk2oh3=tlBK*TU7mno#sClF^SL=RQm9mfOQt{E+42boM34 z{yvHrBH2i6PZZvU5J9w*4Kg;VSi_byB3bS?(Lk9WZj(PXN`2;usxO^#`QBY6aRjX7h?ChR3zr#qz6E(U zcz7)UK@VxIRVlT}Tj}bb!$%K3z;s-<%X8%(o=j&h^Z)$5UIm}GpCF0&^SHxzw4@Sm z^nhYoqmljTX`PWKl?NjOuP3#e7{;Zx)(Atd_=&ox1ODuSL%@UbVQuQM)>jTu_cps& zY4f$`<`zIkG@7yP66RL2a02mtP58G1qS)Mes_W|1J~^e)ZkHIYib_@~nqnn<;ayRp zIpKQ4g%WDjJ211KVX_cY9?{-jIf0suOAC(&xj)O3_HIi;t)Ka6n3Pn-zFoA|DnU45 zvQWwOaadiQ>g+Qi%shK#7>|TpBH-aR{d3h|*lBSZ(1s$4Ha#fk`Ci*->XMf9TaMuhYdiTu6LAc((>{*VJm5k^ddY&VkzEL^&sJiDU1PB?zKt1Yk|a z37zQ!w&bwG`~7P6Om3uFvj;bFHZ|V!D068SHPl(~FmB*H@IOm>-Q)tE?$2ykOX7Of zG!H+VLaGcCLjwlV3%N#8*FuVHp43>2HCHmr!l-6KVbQhs&c5`=Q( zvu5*@_b1z?t-3Y0>iL#OHS4U)Z?iyQ-7Y1JO|$nN;(B_V)C2`zZNTFCzWQ723IB2H z+Yh{n?ap}-;^w^SndOdt25}hZx-mofrKo7YQ7_poUh)7NB(1E~o`wv@2cHi4s*_c? zv0~`hxd|XRBcobAIz&^CPu_?%3Uk+C=U(?B)bRA49v-4qUnMk`B zX#3_pEjeCz|Di8)nHMe?)```7MI!y%B3wQ-uFSH=uF2iQ6!za1Qa=6pM1t(KJ6+G- zf*~{yvZJm&mOVVbT)v*F{V?LXSnt3hTyT+s{Y2(@>g{gN;^}dm$AH~n6l7Hg{Y$@1Pyi63<^izrqT2bQWXzy=P^Zs313{w~j&I}ADy2(`eHU7Ip z$M*DjD|~CW*dD&|;qF_0o92_AbsX+X+|QC~=S1{i?=|UzLCKhW@5Xp^KIq!V=ndeG z&o~)5&#=yj-!kHq4ag*n-pPVr`yj2Bv7cXd`8dg{HeY$|&O6QPkb0zn zd;7^Y)hMe8fJC73P1($hVrk$T_<8elutuWvUN$C%^>9?e6T7XiGSTWezI}nB$adzS zo1;NV)0BMLw8VcJuez_Np(pgU7JL4EB3* zaJ6iE-9}v^@)6zt9?~h?axuOLnXpc@MxLer8PKadJg?M<_;S<|LGN`7er^-ktvy@B zhTJpERMc|(=2z6{dm4RaUw^{TQfdP1g;ILhNZnx6o zpf}4O`VJ0!rg$9|j=N zeo?{t>02mfSnR=PL1~iGWUk@}sLv{AB~KLO&D0mwB^;a9*~UVQc7s=)(>Eddi_4_( zp%1C}%LP{}mzT?5CNvcTAH0gBh>Co|R6!FTYqrS%E@1<4f+duZ;&kl%y#yHA_5;|8_ne&U7iWoG}25F}J?G_q$`O*I=be_AZDXT-Txkv`$9 zVzfDEd5@$U9(6R4F;&I(!;!ZW5{zH}m;VgcP@pMv>dJp6G6u&GFJ>E&nzcN);XHk_ z82axA&|v;unb=xU$U?qY{MYGp2tZ7RJ@DTNN4r)#6?#6Y#suiGMGKL_3(hF z^Q;EvE##LcgKqSxL%#GX;7E;I*Moescztpq&-Ow@g$ z1TfIkzZ{Fn5Q>ry__Igz1g7zlp8cl{k^Bl%ZJo`w}3WTX3%WWZdO3G`S;bi zWWQxWxOjLr5X(?MA9f^FFf(g%jv>sGxyTo9Z^4%nM#TSc=QfP<~>!9B=K3-0gY64apGIPRFBY& zghs@n0gaEdsEmGYsVxS0C5W~cZ4kb}*OSY!w8Z@DLd0)~4LGip4bJE?n}@apQAs|= zqKAd?8I>2tK%sVxqAM0SnZ;-Z%tI^t(%z4^>T~=fJ(VdEl+q;K{A0YvH-vh%EAn_8 zTk_`DeLswat(nP3^VWU!dA4~L3P;N8YA(oVXix?D=E?ZDwfq^mxe44eyb*(Fqzm{K zpO(5(4t&(FZg*nUjBV{c7p5_EN&8Z-uR-c(ZCdjS5Wefp(l}=C&F#Ajo|wr+D%lAv z4Wk;}kczk)3Ym7r{%N(8mWd?Xxq)4(hoj&XMB&|))oyd7B=I&47Vw`nrMVz!e-(FX zB@-naeY@e!?Y&B9V-nc9yDQf>F?roN;hf$plqWCL<8nXdsYPp9WH@V6WCk7ccGwxP z>v{6Y968n*S*GblW3hUAX7M1}qAndBX%myR+?NivM>BPMpzPS+PE4T0prP`T8T9e1 zx@{!Gzdn5Jb@Qvq*MS00`}ex3E3^BmeNdNNfQLFo6dsGU1W`h6 zH=X|xBkFf4DJfR0{9aTvRAW&0TYP+*)@0_7gUMhXaKYx*Kv!eqfc1GX6O*5;(h3Yi z6lQ<_n6$q?yp*=KNfgN5wX}L^iE>U?h~ATGEL&chkkW#tvsdCqn1)cC$u^GClWxD+ z@Q0HBt27c8lO#Lt78edx2$zsYH^P`QA(H}J+OPc8_rCXPA-N3=8-|{~7l3(SwP@lF zH^;&EsWJ%80w)Vg-uV3rzNqgZZvF#KY+nA6RDqH>#}(bn5KS`*-{+iWdzq9XlweMS z{veHq{4+8I#82#P@mdHMCdyD!yso`AfmDf_#SkVvf0Z75MIc+nEZj-@ZUQ2hHG zhmYYd2v1uV-hC{tE=RcN{d&l5vg%OC*iw@vn2CA=^n>@G6uC@|rQ!1kbAx>AFIFRj ztpA#cHD8yNTaw6L#`U?SVBQj_aybv>OfE<`;x{}2*}u1*MT=g!){G_kWMvg*=WBcLA2AlBzc&u`^3y@>RyI%(VbFp2F-b_*E7H^-u?Qdn1a*uPwIvz>VeW?-0y`@H0r;4UcnaFu_x13Vd_w&E zNLkNj$W3~wIcbj~Ew>r%3lH#q7Z|QMqm$}0O|0b}7#BN&%JR$BWz``eBUR@aW@aDO z=Cmz!=Cn@or#)Kbq9)T<9|_w#z@mP?E5&Ipyo`ZK2)r6gp2r&$}tA4~<|_Hm`n> z6gO7PK{os-gJ9PpVU5H0MwiM^slqNNUSt?&rW|uZH6p?(toHJPdZY`hz#sqG3$Pdr zH9@r$)C3tBiZW5AQw&Dy=B_ZKQbZj#6o)4}Ifsg=SvM|vzk70Nu8^Cz=Y^o|o5}!n zU&gi2p^zHNI)7nOKOgOm78jN^xN%Z)-8q$E@0Vql;|H|X;bF>`6_~7)XaGjV*UHq_ zSKyx|c}oTt{P#}oAxIWonx>U*x3VJvNL zu(R+~+K5qcj4g%;XWAMiPPQR~`O%78h3IB*Xo#vqw8|}#yztP-&tIeE_OkxCE$5CEIbCCgTz+Jt}9^(G1oXFjT8oBCDHFii6I>fn4(s43~a5+yl z6%xRn>>L?e#A6dPL^*A&&{ZV`O+whpty4qR+7|)M^zCQ+XG#N^jm* z6tYHcw5mx1u(6X-p#bRZhv9gA6McD=DKTsgm(v^pY|c8zkFtGM!iA`XDR~rgwQ>sF zY20uobx|d*S3=9Jll&n4IQqnip2nMlq=0vCXI?hFiho^5?j3ni>}^v zCKmK*gutH-B$c{Enrdo9To(%^`6nQ2EM+DGqP?ao)wUnCav)6Ja2E5ZYp`r%dU)7DOVfa*?@L!j39 zxuI^RIIgaS$T_nwOrQ%Y5=-+e5-QJYyOWsYlh?3YS};6Tr32tiFL+WV&eX&=>Y~!; zPy+lG!$j1vBJ2)Xe!d4m&GK{1ekOJHr#Fs*JPz1SLtytjHErf9G@+aV_~p!+u*XGD z&p^HXydvqnIv}j{mZfkCs9F!za_FZO&X+LpG` z$j}F^=Ak|M)8qJ&;7sq=cLUNlVcKPKsK)ko!E4w?zv||4aar7t68A}f;Dv>DLMf>D z0<)pE#}qJ9xT0|x5q3a0q66aEbSbM`)Xx$cCUt3yC%u+>?jWMHsWP$&WF7y6idGzR+> z7FIcmb;4`wC|cLSs8BNOGk%UPrAn;5yR#D>4i`VR7xTqX@cSTJ>OC|p5Sp3K#Y0wO zc6r*;;(EbZ+c|!5Aw`<*;-YpkO~`IyY4#e0kbl^BgCTdS-{sGqr02&^#C-S!a`uxa zer=w1`9FSp4F4W)VUSWv4c^#&Ydu*yEKi@*@(xF^L;)@~=FRqVMd<*n>4$siAAUZB z(O#M@QV%UYhtl{5#u$_6+m86}-li$j{JfZhw*F^P$-)B1J4ZMv!QXfm#QdG^zl?qN z+N4#NIS>N1lOap%9alFef2?jBRiu-@AD<|v=8jzMcI^$iAEl!(GWAht?UFR&J6Itl zyFe0-sJ3`>=*m;?(4l%fvc&20<(NW6h0UYEY%(ldi^W*|nOD}YuKEBGc zxmPp_QDc+ktKIz+$6h&e48l^K_!8%gzS@3?Pm;cy&1Dex9V27&QY#}l9}8Ry^u`iMR*)PMLeb4dP|?t-t=(m1XZNl9z%o%?p|EO@a}A-dT-OG zV)se6)JN7U=Hp;-ew#R=RWA&ipdhRt(~-1E&0jg^_;Gch^Qa49eIy=p#1+ky%EBTR#K9!~Vzg_S1_+L<%n3li8rx>t zQZ7=sWF&kD9;ov}SO}lxKwzBG1|aG1>&`P&psyLlEAzXnoycG-r@~!b;m!ancYwNG z6FD~Aajxnkl9yE~Cs=GzZ~jl5EQ@Jhqj|Jf865zlAa9^+e*RRBWG9IlV3VYwm&T{7 zZG3fo6eJ__{##~#lNCCQ$|@usd_Hy0wzcRt_x#8qaJH>HVvLq^AyiUm8@@zi_NSlo ztbvmP!8G!IP4`3m8PWLEF~=n_RGYvBlQ#>KMy;LKP4TVF&*A^WNf`c%lMJmpJ7byH z+=5y0yZ^EbbE;o2EQ25Ag=M6~Pbvt4dBM>FA$@kurg26;bE`CsvPxJ>zow-zq6TTw z@4JL_Tuts1PY%Grr<{T<2RooEsJ$a}Z-?91tlh!7FTI$fS`5zO= zXrB~U)cNaEyK>P!^jpbc0ZFT{yP@R7EJ&$Sl{QgjDhB-9K!|Jnc# zoWtr^wHGR~He0ZM`nI!t?2teJ%?M*BnrhLqvu#yX$J0vKN8s%V-5u&fzK(+`rflS5 zBy$G*y6yBE6+NAveZfQla3;MVxavX5FZ`&^#gWS!i6o^VdjKA7p5+;K+5cAFN^P95 zVQz@ji4GE%k;bCuQ>e(O2q-%(SqrqYhdC94uJUoLH`_I!K<)FCIxY?U0(awm>76Mk zWyS{I2|;ktYI-I~$aoq|;o$|_>IN2|lX6L^t^E%o)~ox+PW20Ip3jEG@0jeyFjYk8 zpAePg`6(NZp~$sS1ju{DkAfbrNlz?X@!&MS5Z_ub3Zh`Z>BE3Gy_)hdItt$J?Woa` z{%ly;?%X;QIllAJCg}7CA+1#esKaUcD&GMyNnP{Q`=0F_fE)jLGlg}S&*4-nq9#k)P91VG(>OP|q;xd7x{o z3-ew#q+(A1N9XpoGc1--VEPCDlG%FN-??%j(AcPpL{w=8v(jO!w z$YxiFr~0l6;IU1+k~yR7yb4uPUIo%VHKk2ATSjj*&RraenP{a8^0~2g{pyIhS%Lf( zWYPaxe&Fjgn`SFoU%{?~`kat3MGm{ZYZetEIbSYAU+mfXeC=TRy|seycNKsB@SWI( zQd`BN%LkhV=TyhvfP$c;7NIwF1|udb)41%0MnROJMt4PJi4*yldhNZeqOUw`SCOvX zkaQw2^VdewIniw5Rp)^mV=WCoZYy161#m%KFI7!cSH`a{zrL35}0nnoc%?L`;G&!iLz8G72ERTjoe z4!ouxh-AS_p9jQ=jAuGvuihYRh}Ro@y@#$KZ;`u`BwTKWkekq9!VO6JP8wg^3XAFf zc|jDk0AAy%W|3h93_Pv^RP}{tP1l1 zEadLGDy2^VRpEz+^D*DD9a=z-C}gHoFXRh#{?DH>3??QfK(L)GC^DFUEY}{qN`ou` z{dQgY(9lrbY>`}Od*6e&Qbk(4&Z)_ABN}~gt2Ai=bkNVVlK|D(%*H@JCP+S+*(ww! z4yID45-LJ!($S_i>5mi|>WLFV;eHN2HXB!^$Z8;l=^i^ug)n{IJYsh*Fe(zJvZY0z zf}P((3Np%Go2i9eDbQr7mi4nKKn)TBa03E?A46d(qmjG!M0K4iG`StQw?8pc2}frn z-}OtoV1bz=OIFGn!hZe;Uu*9{uphPg)9A#0b$}t|yS;@=0qA)?cV>5_et^{%PJ2U$ zO?X2^U2lbvlP}8f_<*r9vGrD9G7rU{Cu?OLYV4837hwuoT@1!z>U&U~kg}EyHkhd+ z*prh6H*L1jY&Fht(|}&A5yV)Aiv!{nLQd1qsC<+mI;sN%{_M}B!e({Mtrken%8GU) z9qW9>Pne?X)^!8HrQqV%Bgslm4xB!2{q$64U}7nf?(z^;ljbL5~|#_l&)2EXU8{7VF#4E^mp zBS6DG-l(=EBPOOM!77uho%5aK(brlJ`l_lSms!J|B0hvE9#9%M>ccq$M}`)WaLfc} zit@m@k^rMJ&C9tl`2)RUXc=dp>jp&sOz)f{UNPQv6my)ma#Pa-|)`S+-x{ z=Rj+})K;3{@4n>puyYuw!Js)M3R;mI4`q}{M+_^kZ{B>Uuk{`g@PQ>1oJE>#pg4I? zX}{7)(VpKTKuBUUL(Y6$G{{%hpab?Z+;`;p@!nae=jP{^j1%pBnB-cLxwlxM&Y?bX z5#>tl%rI=c^B9_%*jsCltBQdc8$=-zJxG@g7${k8zbfXhGk-L<6Jab$8;SPs;^+2; zn$7QK6yq&=Ryu#n%nDJUD-sn-<=>dZo!}RoEQb?YnO&8!5JrlPW1`7sXWDQ%DkS zrwGEt(JMdjKwL~1URISU!h<9~gav=Pj&!-Si5(oZw3;fFFA3`o!hCP0FK=B8~mZTSt84vP96WEnudRG$AVudm90x-57`jNityR zTq`9Z2ptalzR}=X3yV`f_yzbDd}%1XbvjQ|-|2FX30ws%LAWCw&C?1dE^o&JPv!_d z!>rv+tostJHeOO(cqN>LszW^4vLfB8 zF3poRJ$o+p$pJ3TUyW^TnJ~s`>cTusa|F^eNnlV=q`f>N6LFR{HZ<~uS0=FbH;%n- zvDTO2PI*O1GHLbqlorq$U^BEFD?aF}yDH(vs38&(>J^O~ zCo(`n>j>z01K30Ao>WfIi{)d#^is00DEGFZ4V_G>DG%t>nPdsXz*N45Gi~3E3Nc!e z{Tgr@HH+%+#ukG(3)?6hicajkwl+^nMtMiX^}zauYuR#oz=uu}R3wf^rbdYh^G;b= z(y8=hFp>Gp#iOB#yznBkzNm&$<;Rys+LmV7HlaiJ2+-H1&9y^jW*HTQVh)|%y9|4K z8Ms&_hDTYOPn6bSAelXhq=z7I}}0t8;6v(q!B`49DZ-Z-&zTjd-` zWo7)EYfPh~GUZL%zwg}U2s1v}Y|VZFv}*Yu5BfIAj~3u(Y3JzEL|!Lgm8Y~lk#v^^ zfzuc`S_NhEnUfs78LQRv=o$`y6FV({MjVOh%(GOq}%i0(((pi zPx(Oqg_WrhXT9mY9tAFN!L@>5Lg>%Br%HTFOFS#4g!2fbFgqJb2{{w>lt_iK0O{DG z*<-|Mo_E@WLe$u(Ebd5xY?Uz7M=N|%wKbG4l@f!&u$+m}n?m@O4UtY~zCm4^k#RkC z#yg_HSrIq*otAA8Pk4alV8BJ1cXr`qLs&iAJnU7 z-eWSi_G*Gv{@Nxc6Nhgt zsxG6}3A%Dq2H!?Nf&Y75?vKJ2B%MVwXl-le1@$7Ro*w2~1l`(XrE_X-y20A|`ub6T z8E+pyT$c)Yd?}=BF^z|=)t7X=ttDmuBSK$K^X6&ftPKhVCwrIHlh2pb8n zSLJ5#L`GYr%ZJ z`a2DKRTJnK%uf&wP`(MZ7}|)hcj%n?jXDn@OvXNqPi}yB5=2i|O129*ov(Vs202fh zm`YM+GqhU%(a?J$k)(8bS0b9wictB3_YM_5gl^pjFgA68yKOpIj}lrtc(pUtf%*o4 zf88fb9Jx7VveIbCR9q=z&`-Z1O+V%aw9v31njau$`;7~ENb0I~yt zBYUez`z!P+n@b$of!nl24EzA z2?Np5$ua=J(X@ct$MsoB5Z5%&Wp`Q~_Qp2kylDF5;!0H8H)cglDjohaz$2`wq=OHs z*^YBdUV-63M=__AlS@MFY=_}94zbtQyp5k zfO!nRM+HC$jV1{Bl20X?GBO1ZNB%rzSlnUcnPuoC+sG=ZN9*G@n1nqKbYp5TbVxMn zJbmNy=Y9kJo8|Pf%bU7GfslmsPU-vux(2@2j*WG1JkQbhwg7+?VH$%&BJ-k3q zow<)taaeaWgTDX=%6Gao#Wjc7Y_*T+^~!N8o`G^e!#M@rfL1P7q2fsh&}I2)YK3Y( zssf2jQC43+{a*rT$ta}y5(XG(|#E`laqhx##wB_Ogq+wD4{XZBQ#f6^V-J8Gs5(s7j zLq+?-yh>QpISXZ?QO1(w*Lth_VtxXZ8{InkOmyNsBUqassLW!YdvWOi#lowM&4Dg! zqCu}PvJom1w~noq7`e(_`r0Vg`kU25&LWZZndn8FeSut!d}jA?4Z6Zj+U2=rFiucV zR#K8*^Yb(s%2lCk6{$@Dib~}jC{0TD-IrQiq>J&^kCqo@c-#OhBsP`3Zp3xRXg$%3 z^%|Kzoc!=lX)S+Ryg3D0`~aC>itElx^=gr4aV837o%{*V4==FKb{ReKXH9KHSeaLg zzPOe*doTbzoJqM5z1$7=L%-}OS^B{SN)C82jHMD*Bi^s%;QTfzTUOQ9La1>wl2Zy+qz6O zYhVUV9%wpf*ti*Ad{eAh@-cyrnPn`jFSQmt)LisV8HXFCa?FMp-4aNjs}nPcz*(>7 zJw@i(*lfBCPb#rxB&pPHn?8_5UH}-f32fqCewpY$*dA zv=Jc9-JV@u#Ot6T|Ke5&rAymM^nfubroh@uh2fgI-mgEap#vGFvJ|CzX$k0i*{d)& zul=jD7oC0e2AQt0@sb|O$g!`Vz`v^TYS7>P3)zE;sc4x-`%YU4*9g<|&-9HfEkg<* zYe}p(h73($Y@fQHhrWF+vu5{|v_RnMdtR`o15SQAJM;IN2VD9=dB>|c+=m8s*@;$X zWrw~yrttTUTk!TtK#IMJc2$3FSmHjaY=Qq~4^*pKsR*YPFLuuQmu(oZh|gb=6RqrJ z$BQs3M0MYB9`R%pc@d}sRsJ{HfcfXYXu~q6RD0p5cx5Mtzxb@v|KJQLLr4NnwC}|I zS8CT0OI+F^yrV*mIGKyFh_{T=x6$N8^V>Sbe!fs1^wn`Jy<4y|Hu7@Lmj@MYR_=>0 zmyFE*_e~)>4UqMnp*hkm&b~|~dR^x51Vg(d-aAbH2UaczZG_}Y!b)LEpcOA%gWokX zf<9C<9oqd4W#wR{6VhyBjy?W$7TUD4^ z^zjEL}ggn22;={#quUd_T_#BH{a{o!E!P(@A8M1!KMa?-7<3mog~}H#HQ|{n)>B( z@lV<^9K*&5N$0EtdH|;%OZNkH676hY@qP>++>YF3Q4J^3vI~%8{CPG6#wtw z4yBPYG+HUM2Lklz>6-fa1_`7Cj+skDzr8<(QQ1}j&xK`)O>m;Wv+q=gax8{Q)s#^^ zGV<47DaVmVUb(Fm`LP^Z_R6OYayXJNM2d zM7Or?4;n$ z!O7WCyqpd8^2Ww=nVvdc!Pt$e8i+(mK0ds)CGBikqTgJvG*FD4njV3*wo-q* zl<32hyCi>+KY*%+( zOD|cw~jZ}%I+)C zIlc$yPJL_L@_f+b0%T@8KUF-8oTlT@;b85e`CwYk_Or|4GrH|~nUS`BIt!>dW-+dM zs`+CEy87ybquMb1nK1NFHY8M)Vg_wEd#nhJauFpAHh6m!0%bb1vPimNFWXP{)IgE? zO8nsH*Ok@?-~M88%fDFsFs;Ftj4=F-pL*s#Ht=(L5V`tNp@`_rTa)jrC3WX^7puXW zB?2bDivc0SZrx$<#;w;@ge7CaUIzjg(4+zo0X)}Dhd38guMQa>F|pZ%y|E=SI}gcmp?QLfJY0vsy4+tgzTVX za=Luy=>C2W4~~AIOYQ9TcZfIIn<3)#SX_^2?@pb$#=XOh@ajT5ji{jW@j3DXDFdc- zNbLYA+q~Aadz<_>q`6%PgXf}VSI-EsKR*Up{Xu3jM9v%N8ycvsFf@5D9g;Z|=L>}Z z4rJRmhVyq)$!>;K#JQ@HF?IKHm|!htQas#4(yuR;>?s^TbmA@aqE{FQ>r%59WXCOD%cwrF>f6(P}?l z6)q?LIFu(1;Kd^|*K@#l;CLnSdrc;9_oH7yO2iS&>94^`PvacR(v1~0c$0&{H;MbG z?f6=aqpa_63nAnu(+8E;Gazg5Bv%{b&Ls9^k~bL@1&Whp%=)3#BQ*CGBPF#{@LibN z@Lzk90VI>3zs_3zsw?IlZeB3$-Iq_uN7lMJ18--H&} zTt#0s=BrI8B5r7C>-SZU5zwshC z^8f9?78?rk(=SC{7)B-UO9DJD13)rcWdNC{xwK1}|BB*VN~ab1t;d*ngM6S`In0+! z=*~xI*+5x&w2mMM&G+PJ96tBGAd?vO3j6y?Z)~WR3)*MMNQEYDosU!z^5BtBA~t>T z#^Ezb6LjLK{sI$D@)G@m0()r?Gl^|1((%)${u@g3{9ZGMPk5OmhrbU5z-UYWN&D5d z7>#16ObGQ8inS?GPoI(=f?2n@Hf|ud{pyTtf5M7Pr|#@wgBK)b@ZP#f`cpB3>L9&f zD!0S7NlzqBf4i3&E;Ey2V6n|7^VfNv2iESW58PfIUYFLMp7$UDGA-wCJ+4(7F&okj z7$sO|KlYwHjuJL5Iz$?p%P?WDrHFXb3S9&2ZlTHKe{r{JR#KTArD2-a6%-VgVUK!9 z|H+ogtD_rL?#j;a7fa(ct3B7XMMLb}(!=>Wl+Prbx(D6ei3n#}-I4F-({27?mvR^w z81zXtINIy0*HrCq|YiaT+BihlP`*VOjn`w3R)~T1*TkXdc zlpTjf91AW#)?@wvFM>#p5-3c4(Dru)3Dm*=_+yPE7j^FBdn|PWU$85HliF}C4V&5e z{ftlXx__?uEx#&?c@~N)OvQv770jqs7)$=aukF^i-bfPvfzu%UG8}{M2thqp`g5qJ zPCLVjljY~kAW%<=IZF30FfFVX8Adt}4mVOn2boL2YnvB>9dmyd+iBP^IMEe-*&NTPfN;c_x2 ziT=$Kc1b_@b7Asj(B(RS8_qq(1%QP^z2F&JK7J%5<&C?p9V+ zD=<#sejuD+CJrGN}otcZdw-PP5DorH*}-K&$Fd(GczYj3N0ST7XWQ-p204)l9E3p zq~*yp)%MU03k^<}jswsR1#)kB=S61`{LQ0njD}_&okWdq($;2ty&7fv?M4Am}_eEMR=yUtXH>u zgeP8;v2oax&!aYBQKO+vpUh#srlbv~(p~oh6!aM^PYo{)CYGI@L=VZ%Z5>mjnHs8G zc8RhH+I^TzB2{#QW)VYY0WW*)2;u1Cm2a=~!X=>@z~-TJTT4sk_=I|e0`=9EY@a`W zHa7o=DE{URKB5ymeD9g34Ve%fO~JqnC@C?wYh<2qws_`q#L9OCrj>VvFe*TI&*F~63IK#f!nw$ zQHeBYH#~881K?t_m@f;85mZ`?J~~s&g>X2mHbzB8n&#cho`U3tln-CF;XnmW+kwGI z(fcc|vx-E}0v1q0Pj?|(7iL^-Ab6*6CYVPYnk%m?tKxGk2ZaxVJQSkuw>c_AfDy~< z(cd=*-Td)JkG_^_4KcKZMJ{qX-HLIcBi!vg@+A#fAyl$~G-| zG!__`;wI*lVdzxq=Dl!MaHCVVJthn*sbTXZ_8{<*(QTKLkl9Z2AXa@m9bF-H;;PFf z7n%qEFIG!DDk!yGIQvm}1Wg=(M(PQPq=es;e`*EuXGKhPS8LaLzOzMWVTv{ST|kr1 zbSWk$g}XjV)U!BwH;o0pGTSC&q<%ZVW|G3)OA=kK)+SIC^|z8IohoGVaM5lOet}4Q8|0qs8fK z{~)OSleRW~o}I?FUZ;_3S_b*}jDWJ-T<6HD&2+|e&3ylOnSV4+;DjEUvPpq0RO74y z^O8n0bt)}PcRsdo-BM8B7i~VsV1n0cY;FQymAL2xyLBq9{$Z!J|H^?xWC4|byq?q2!1)BaGi7(DP`>!*1jvwx`PCDW9 zdF&w$F)y!ioNF8?2?UH$;5WXF59j$+5{z_!fZiK!-)xN}@qE16E#hNhS@pp~;oBvg z>ePX0nE$&Sy_Rlr6Aoceqfr~Jk;HwnFol@E^5XfKXwY&&cdJKt*~h8t1>H);SCy6Rc}eS z7h{4)YHgt-n--u4t3uO`?M}z90;&_OGL13m^43~Y#xIlp^`u5Sz6Q53VgTZrt%4?} zK+|V2Yq)EBZB~h1@;Uydm-LvNhaQSUs{|N)7qO*?R(LtgDW-u6V=o{hL?$!i-?INC zpFl7DKhX*Sg5Q%8bTi-Iugasv`k(0@NX3vQ*N%ENwlhaVL;5E7gUG2Cf!oTI6o>KJ z{qtyQfFNG`=cm>Zcz9VE3oFg`+e*5mit*79BOB{l{3Rk#Qe8j!Cr=ZvJ1c8`6J=T4lm`(_w+tNxF z*0@#2Sd2yF29h8@;cp&^ROoVe^!81!-J zuJb*QUu(Sz?0RMCSXchD8V}an*qeR|&!Q|e!xMhy*yH!KdCx|t6?wX7M*Dm4TW`Fi| z$0m~k?6%5nc*Q(MJ1Thn-RujXU%q&$y7=vHYEo&Wpggtl9~nz89^Wh$!?ay+nWn|g z#}yn3nvssv3)IBS_&uAm^Xkf@4IO-A%QtGp_V~|Brrj2n`x#>i39nMVp^Hf+_MQAH z8fSgS-npZJP$Urf7T?@D?AJMjYFU_@8%N&oTO^5Q{?5wc>+^uQ{CGs|rA6HHSjqk_ z%)afey0LKUv9ZC(z)B~rXsbH`A$+BwE7N0D8dU!!X&ZhzlA#g7SQbmgxMax4u^WT3 z=8RRx#)o2;TLLwZg+-WIg`~2rQ1VYsgXKl(#s@bBX`!d_VvMW2{F%mKH>U8qeK$qu zRvlWvVugr;(iL_-FAcpH-OL@agqR$`JJr#(`+AbDV0J-{{L1HMx(b){;4eRUDAO0h zL&x}x=WJJ@q7~l!Rd~2!nRD&4_S)y3d!Fb1E9ma3`bLd0zIVJsYC}Vj^RsE^$@c8B zU;-WYJ2G$VJB^)Fo&s^#0Auz7)`haumQ-VddD%CRH~A|Q^CX8#EMr%9Vc=mtvR}g^ zS}D`Te&{DZxUak!Tnq-j9(o&00Gk+EH!m~1&;ZFXsqQhG4ENv=`BZW!ztUbtGCg)- zVc3t(&MKh&tg`n7KmYeWQEc9t&f-b+N={-b^kxCUxBa1S`>wL+OE1n|z4{b}x4z`o z|0N|3XZ+c;*!EU_$FEC93=x3HiLOUz&|VZ-4lx2W4SZb`3Nu%j1V{u&`7~ zR0%&Z{5;@twE37{Tkx%qNrd5+Ek+=riwzC1yD$=%&m-kb!b+Ihzx!@l+cwfZH6_4_K~eHoFr$mxh6=bZl${X%=0G*%!MzBxR9`yFXQ9A zM~=0y&jY)1+6YDIDxGcIF5jISY`$;9_A8mVr9(A8)i`bR;yxkjrmuB$%;jWdVIidb z@TrX9DF&tzC_Ryu;QbQ;0kj#C@pXyC>^k8v5wYOt6hz^eo;`!MpSa;_-SOp+84Z7X zfRYR;-j%A08QGseROrmzx7Teg-&!SlXrw6JVBJ=fmQ4>{*l|Q{PHyfH+g)be?)Z?j zreIuX_Mwu4=I;VkYn4Cydw*sm;s80p^k2h2m(?vlQ7R6QiV=p-sfSH^?VN$%Tbj=d zW0sLjQc3RgcLLSkUng#Rczoc%qSR(+nfSH4yw~UN3YS)92)I&18dK&f>m2SIa? zG8K;yI+)|@wRZ>M`SZKt{#vY3l1LOsP*Lp8VXI4Bq;OZ4&~D)^RWS5& zwPS-ni{{``td5|jch-28c}uHPn(P);1UgtTvvl_0XY%X09=2YIKzbi+6Iqw@=j^EJ z-B%Qus+TP?cDF=bHXHP&G-kM0Epw~pRD%jAmpcBS+Cj`+1E~m4F#vWXNKYih5A6r(nVjp3B3Nr%v{N%Xz?2%l``mfu9w)uYW6^wXQgj5fo+SEK?p zuByQBg@+%iQo!dhJRH_}1$u6bWB&6~ZnSRsKyAb1kCm0|c}9#tf^+QQd$#)s;MWiu z>2yIFyzs);AsZ%rEdTtbww@6baBIn6(%EIc&dw+*e;MF;t)pMoxCBh9X?8!{{Ea&U zn%2Jh`uC}T3nT^@(xThhU@Q+T1(;No zk0u>A-Wk~lU2v?f3lqEdMTa2I>;*)mz>}cx<#Ou|;Dkq?rV=ZC*uTH4AXynq4L#c4 zCKTKwe{~CtlR@tm^B?G3{21HO-;EZllpa~Sa`%b(r%euFQWKOIzFw)7e0{8kF;U zBINM}h5Mg+G7L=2w-h8?>{dpWfmRH8SJ0J!0nz*0t7FNV#0x6WR7hQdgz%N)v#U5Y zcUfY(OZ`78g~5=mExver#)^;_^|Nc_V7mB6Y;sD62(N6l_@w4zHw0Drxu(Z|KY3Hs?yQil zci%^|5x`>i#XnLTvI70IT+T`ONm!dlrUb7{PUL6Zc;BSNd}~|@Q0h&8Lj87b440aA zP~xVdeP2U$C!HWCE#JD#U~sQLuMA^PIy1gn{cq#21qjYR4=4I1d=}3iiveoN|2B%; z|6dRPWu0U2xnh6B4j+8-VA9j72veRhkEGsp%9N4@DZ3nA1uddD%OPPY~9@iDg-Gj6qxE3F@q*6%CN(!4x>7}96m zB6^-J7<9(T4@54<&T;kTq@@6j4;Ni$$G(vt0&W$Y`v(pVjUC%dJA`E2Jt+*6*>Meq z6i0_Nf9+89_}Yx z=q|MV+(F5-`R3gBx0~6smCmwt=9bI1$}R5P3iwx}d0Lfc8qD%Xuo$D`#7@VpnsLW3F3->C)h&?!r?iH2Jus;oZ`Es$Q0g7wfo_D#>s=9+C!$=em56xdq& zACE(Q#_FBHI}#e2}^TSZ2uF23cT2 zKI!)DyBx#EVUEy?pPykq5Z3-%gjT3u$;*L6{2W`%C{jm zEkW7&8yBoA`PXb?xjTBF2WFBHz$YlL2`|0h&%0=l+Jdv9^dZb`U!?TyJwjcnQYE~EEdylaFOPKgJ`uxR?GDJ**o<+$ zn&7{056ROlR{cSMltf|yM}Sb3iIme6hjUkY%Bpd9bC37(CH`rc-6eUzuaMj-C(APA zk9s1Hlr!Zd1Mu)jnyQIOg)U!89(*C>y$D`xjyqp)e3Kb(lK;rDHUu#H+c%ex8KaH8 zElNkq_~Y1br$D(_j7po>=2ppW+3!XBg3aA^ucc;FKe;FJ^3zODER})|v=tP(?@kro zK!$hUv@K}8HYsYNneKkNr_uHk6uzZ}Fg9n0%Bp$0`iT)loP&`%9`7t>Fu)4v(!BDD z?{@cKCt?>9Tgs@MF zA}*qPxhW{;UYz6ZQb(j8 z#UHWREp^UK#INHnx_BUr(7Js#C2AWcq8CPyr$o_Yi`AAcvh*V9ZJ$fg)`Vf3}m<3gUp zdeO=#IEZ2Mv!OJo)IE!(;5!G8SDb}9&q#3=1{WmD64++<~FCZf_!hSI-WGw7p=o?-HYctLMppDx4m{#!1z4wxZaw2kv(k;OaL)8})gihIenVbHAWs=j`s zJ4x<}O@RPgNgPDaM z8yT&#Lou=*Wnq=d_gLN*nfOuFnCKn)Av+Ib?8I) zXNFji+CWw+-w2L!R_l&6!F9}5#~A-q7s<2U%Pk3oTY)dbQq4Evd@WCLxwwX63TbxW~+oxMR&&( zKTMY#9@KpmXATyt<73X_q*_-NdFmynEJm^4ms-7rmjr5WBevmPRkj0?*~nA@kxk;G z)~gula&4i{zBFe$Tub7k_IYqRr1xac$L2s&{g^S}RCb;?GioX9h6QQBRB(^m3v1zX zd5!q1w%mg~dtA}c>u{2XG$c@p2oD(Hg$n;Vz-Eq(^6a*{+P`70@iDSMu399&gnn{+ z37oVA8(~asryuL;E=fkB98q@S$S(6xB+EYQ>UU88QP9Mwg}eQA?4{JjbLF>3yA!2W zK&%N2p}STA0>RIn%phXv_K$9sSJX6TjP4ofA@4a3wZ{N5Uyv45;y3XG&s1yGX8O>V z_(g1n&PR^`PqgnGTVobZV%?UTFxLGEQv{q0cb)q?XI<_OKixS)m%jTw>T1K5O{su^ zIIqmR7Zu0i6HhoEX=hq^zH_sAi2ruC_d_7nrHGX2S4-@n8( z-TOR?RboZIe=-GL8?LjMQD++YzQOo);l|w4MM6p#-21Yoa)q}gA|mdQ6?=Q(Hm5oh z!9?-yqWYxGPH{p?8L#7^cR#e%sSCu}^iBloj6;0HY)@#3lb#Mg& zC@s!rM#TOGGTA49n)L?#dw5O}cNxdegN1Jb0n_s>M7s@GIU}%8s&^m2^96NY{qwql zQ;AGPQ_Wm%W@QE?OAR&kxg3ndz6z{yNLoFo+ju4NpsCvz>PLt>%w#M!Tb@*6AbnLM=M{)CQF!2$9%g36VTJfJ{4z|bpso8c4GZ1*;8wVJx$N6- z=OLflHA+{YX#G*g`>xIIFNWQiQi17TE@SUD4}^+@-Qt%ZoVSZq<3>m}7~>9>6l?3R zG49%$wqZK9XEv~FDJgC}9_1B7{0jRr9g1(H>LnhQd%tv>HJcr$P78sZ+xyqH#kNzF z&IMJ3|MOr<6s&iyG{FdCO$^)d@rcQFyVTs7YL8hG&z*jynG~zHWw>GXywvJ@UOL8h<-JW%Q{LOO%hQk#*6B8BRoU!=i+HXo)eXS?U7rD-2Xri5*BOh0^(Q~m>YRQ>P z=Ux=Don>*aD#Qo^t}jDT-sUuwL!hCs>|&(cx1#w4mSPCk&flE8r~}SkUuzS0+R}E; zE1dX7x}XD}EsO;qY=^9wj9)L1Vw3pFi&bFvxOhC;JPZr1w!Ex~HJw@!j*1su#)@dU!MUY(|S zLW>tWUbc)a@lmAX5Y4WsC=t#JHN0Zli6X&|Y|t9cscixIomz2?fh_z$t71K^f#&%O z=be%B?>1XGFZgzF^Ckq~5OFH?TH!>LGL5LUZ!s)h-$`-@)(SL#X>mBY{@xZo)VGxT2S%vs+ zIJV{TXuEQAopOyzWr7%TRvcNQg@hR}>`ixhs=UyXsy=0t%>y>w-;;;}Zf>?EaLLuo ztVc2#_R?c1kFI_&mqLv2=N?B^q9d9qbDiTClhTp7z|Hd~u@*)CNbxUfs3C({CP^k( z$EB7RUii-jn1sSMR1IA2NWguEdR2NdbbtbfvoA;&2khtLb`KMOF84F z?Y{fKq>}>KmMO+ti*%xMrxu~cIlG?`81ZPZvq2nrrCd8#+jDT8%43YGC-Q8^F>g(O zoeTp)sp#UZ$>NA~rF!JK)2UjsF*bGqy6mOWZ*oIMpQ#sb{cUBcy#h8LWpT(=?4>bY z`yP{u!l?&Q_mm5s+v&ZuCS#sDEq8A{HaB=v;->mp%p6l=Kp3pYM8L!AfF_#|a!hqM zPoop$iCZ%xoLekx|D;Jl;xLLp>qHy&N|) z78XucO^*L1vj1`??+RMrvyLF4x`i!#ms}dpE52kT#Tt)hE_t>2uzG#Io6XyFvFPQh zVWnPADn}*T33FBl;8BB&i#JxrA+_zYJS9ics8Z|mNJDfY2|nGhm+0P5A)ZhoZZjYWN> zt4N(U+>VF}s~yUurFl}Oha~I5#Yw&=l<#`mTuBXn-L(>_c^uJyc40G&#^=+PSq8{S zd)$#!+|j(Z>frRS-77<}0e>p~b)DPTgIm$Dow2zp)4iJ<&(XvNFp3JrX_5vrC?F@z zH5t~Ej8do1Z-pbP+8w{5r9}R#c1yO||I?W)98HaynPv85TgT=!hcGO44hCtkJ`L|S z6f8>(PBDzoe^QhB6QOym1!htW9F(eFOJ_edLR~E(&GJLhX)jJ6e zKb6-g{n!`qg0RbB>HB-*is0O+EON=z_Ne52hM$$SllA>XpT2c$6*I~~%3(9&jih5@dKOE7EpBJ?ZD{|N_wqdd85#z<8f~=8a?XfyH7<+Cv z9fbAgP2N@<*LokhHD z#yl}2=G)*WhR*Rb}!fDyta@*;t2FImB8YI*xH~z1-+TXlN*5vD`+=5PHAr zuq^yYtew_^4>G-Jb_?Cy6yxzA0jC*Cl#P1bTv2~}(}@D^9a>*B!7XeLhzxs8q03|| zJD^^+Y@ffh>@DVJ@}ghM(@0n&Y;|`ndV|l=wa$pLm%YI%}+gI@MT-DG@Nq97@+ zQM-fiNUi?ld||HncE4c%t)JdjvAbB&S51pKpkIYFrFF}s>~6AO@z7soKWY9InIW+l ziqI9Ql&*zl+hSUMzq&%x=FIJp)k587RjsSNtzTfBD;eaLDW3ItXqi^IExtD#$^1(q zk`x8`JspMGG(gKAipSBSbiRpbxPpRftIJS?eT7fvGvA<|vpSF<*&B>-2N)VYN8jOzj%GtWV1|NJdE%(uhzs7^5bVmG zdPIvAaJ@Vq{XSJ?8~L761;%@3}?uhF&BvKpe)1%>`MXpoh8DHs^ZEN$>91Ue1xaS0Lp)xNx}QdW%)& zH{3Nx#_Wo{2wSEmZqzFMZ zAhPRM2aHAvaMAN+We-XOoX@{_t;W&RZ%`s{Nxmy40jGLxTkek>qpmA88e*1Bfvd9k z1MqSQ0tn)C6ulcOFwo*&fbI|VWU(@LIz>!hRs+k{ zQZV)*@C{|mccaIF5k4MTvBxh^EF8S4<+BmheSDW+vff%;!sBL=l9Gf2_SQm5I+tqN z`x+j#Y=WWg?s{qU3@yV*;QVG?3lJc{L;YB226(6;a_P8Kl1M{)A_*;xu$T7Ul)M6# zmUf;0#&@}UJPivV35k$M98hN&j2qUq*UGIs`=fdq6o464vlazA@}z9{N%CZglgKO2 z__jXFx{wwSBbC&1?_G}9Q1W`EEcAZ4jQF?5=4Grtow~9N&wtZJxL2|XDt!>9jd=m! zrY;mX#FSG7*~Pob0Q1y| z+wyrY8#mh$pbNZDiVcJ=1m17{YJr%jY)mC4czJ$~SZ&qHfPN+#{~X2Q0c7PU^ffx+ z2ib^49APQ$e(q!d31OxOa`nwrnm7|oVjBJGY{51Ma;y*hm@7knc`fZ4Vq9WRs}(TW zR2y=khnk3d?UpJWW-m9RlYI4c5MCBuh@h9X&H>n+8-5&X@go?RvFgF$d2A6ZS;42 zd#D=uh4=#W411lHiL6^3$0f{h5eP*U77BGJ7@Zuryg@@72XH3;`SVgI_%c4ByrE#U z1*Ku7N21Tfn4aqm4R-6Va00=bcdnh8TxX{-DGz%0u{owm$ye1zsvQ=h@$my8TTwKr z*)VmdI~$^5(zzhYr7rFsIpAzS5t(O&J4Yd@`0+I6d2=#Uw){)+O3u&9;JPm=HIg9t zH$bFA<5PBIGTfS`GuN}2`-a}te`|C<(rBoY^S|@Uz$CVRBxPa3ar@qm$hv=?;^B!N zAXH8Kc+UUD7n6zBLt^P9q!h^V0ITU_1!?);;(yozbN!rH}>fCIkr zXBOQ5?ZN*z-wwEu|80r!gOKP!$B41Qr>J_5|6KXFPFzDe+2rUblV0aY)%7=6)ZI|| zZ%t(wL>T*F|H44=$GLHaihvo=;ryV;$T@*gQSGXEuXJvq0Av4lmT8TCV<+s>HXHTN z?waIGe~_OppR~9*yJ4g@kk+aqWdb`i6lS9{$MTXwDMfi$MtEid&YloW6^H(KFHgws zlz-=`YeV8)Z}a{y1DO^<7+(#)vVCgM$*ArqF&AC`rdxO^K(AMFPZ508!?{h zyVSi9<%>XFOilOY8x|W{x1*l%v4@cyEP7yAr|8&mz?BAw#OhGM!x?(~jXo?yPuXHR z(qewcB71ptOibXxjcx{A&T+#_P#`na9Au-TQ*2>!w0V%)H5^p`#pZMIZ z9(g8tp#1yFnQjsdOES(RAG};kYRB{E3M~Y-pjbx;E{(iMq@Kr7w$xkDa9?~m&C@>? zT)*x`as|ao!D?f%B^udm3gvOk#ogh}MH&096YbZ z9W=Kp<=*sExebKvUozeQ0;)1bk4=uqn_d@ujU?*2WWC0CBfqagb|2%W-PPXE_Lh?_T%u2_$ zkFd~-qr$J%?d1NJW!8Uq1sVA5{>v+vOUY-@ju`8WyG=hB(JNzuKUtOkvRA>_e1ies z7ntxx{z7B~9fx@45~x%;!xg`7K`ZV+0SN$4I8yefD9%b)-_aFO_My6*;eE+`R?rYg*6$$H>1ukya>> zp*T_yEewcO5XE*p{`|8Nh~s8c(@O)g(qV-L2u?=2sdu;0#9?b&&&)7vizkfFF7`b( z7ERp!8-*jCWFtCkJ1s2pP08$Ag!E=oU?woU~x|2&_@th z)ZNqvx9donU1lb22MUzHBGWlmG1O1OX8K)6a4v^;E{n6C;?vVdw`_v$_-G5ll z-wu}^WIzeRn|>`hgeF1%MgU1F>0pW(lwdF@q8lQ)qlMMlc0IMny1m$(GKFN~J^$$3 zVM)9_vMFFwFy%F?4aUG=OH}wwGgV_AdH)-18MAZzKO_}E%oJqJD*(wvV%5~@DY%vc z-5izZ-LDZXR~1irN|P6n-MR?=*H03R+C$!YE@PFHu z3s<)P^A`4ZiK+?N;^HE_AkG~-8orA@RIEJ!xLR|MqfJ5-^h0xZwh<4iQBs2uWcZcJ-s}kQ@-+RL(udy5l{x931 z+x~l3%R$pW{gDh! zIuYDO42V* zHIFKnbQp~o~@vE1|?8`SR;pV^R|F%YdCw z^uEur_Uj!d9uDsy9AlVE3aRAk{U!ks#FBnfXN8HcCt$9G>!B{tC6x|6J%C4{uB)Zr zaZB7CZm(!E9~2$8XQZKKM8|MLsPT2Bsdx9RD*^5@i~ z&9ULBnd4rDzn<9AP;CceWK$-XjWQmFdeGYLhd1ADhL&wCf?hZQ<>yDLbKXnrpP=FF z-_&|BH`;2HDaeedNqyePIaUId02_xCyAf%0h(&o|mgnai{w@wb0-O_xr?EN3G;`zP zdvF$j)TyOA5z$A__7@+voyZRXS|tV`pwk=7)7M&-o$oTY=1(g$Gv(9c4lyex1e+)s z80ZedF}@$SP}%1v6K8sLVfNlt2dp+|Noz9^=zaL9OP2mD+^IM;fU0)8Vqc!G^k!$N zSO-%0_E_HjB5B2bStn5Y9@#qV%i>9J-u^=U)z2U+N4;u**FjL-HL~W`nj1{vVgNGf z$Fbu2*CoWmkyj?LLWd%Qmr!rAt-5mM;hSQ;24`US3F3~J!u*OHlL_4*o29|X#lCW)~HZ9;fM)TzrfpY-^Zl9*9qAlHvB z|3J?nvrifY7F=8|o&CYzjWazZvHAq_)2Jv4Fe;TPzU#e`8fWR^afnPF_XH})70m{8=L#Q-=#ZW0Eg$QZh-uY& zSt94?K3}l~(yMo+2|D%S=|UdmQoMfi?_BM0K2R7qc@kX6PU%LU++@dL_3kjLcc&$q zLj0mp7}~EUfCwJ3O0Gw}!1Md1Ti3Br241**Xau`1-Nf7Km~u}BKA5fV@>#&A4tous zGt;GjxH|PXDsA(K`qa-Y|xIVr^x2 zKh+pa6@4y+(jH<_Hy}ikRicQas2j6&#Y2_{TUO2$e}Q}?5N?C`p0n(t;NV2qSH6V+ z=oLF#YH^zJHFVdZP089}T8`-;0CF($>8dD!Nkn zMiRU=S2=ej+4E6W&@&0)b7H>qM2WR@#hQTeB}j*wPHud%O){e>?ZjYRgf%=Q7D^Qd#12H6+3-NzFt=n_QAmkruJJ77__3dMc_o=enhuSaFDYRK9y2}|| z^_kX|#Vi6$hMi_gM?JP)6DA7XMfp9`E};9@17Mi7H9;K_@w7x@W##3h?rl@fP_sOR z;Hj`wS#$ECwZe2ivmOO7#&m@e{p7q`Iz_S;Uv#_X3M{?RyLzmLvD^bwt+`Vt6mh|) zRX$=9nvr6kIe@z0tnWwOeW8miN)F;Pv6pQsC@U&x@KTKac18+vn>_w+{V*TKF~P!!b0N3xV~pj?h+;#@*=M ztzfnL*$LV7%5Ak>VB^~kgs@U|2yW3rG4acoj3@|x=fI3j6rU&zLA`LK^I%tfv{_wA zc>bEjZx%1`k>_Oz_~&uV{Wm5Agsjo_`xY(4_;1f*;_zrq_mW3On`DqR{A{wPT#F23 zIb`U!M0>|M^uQQ?G)OcywOzlQzOb8~YP zZXkIbnY;P`3j$&_e`uK$ug^=Q@AbB!)q(!&PUzyT7NqQI-3fKaBN@=T(yH>W0b=WA zDmZ4hQO37639>;AFZWjXz-L|eN@127ke;Hrc+?*t8ceDsTIXjgJ4$l*Cp<3PF z3VTxhRpQCnmttFNY;4cQ=B_1vgFWkud7BwkMMyf7L;Ak)xolCwilX%LwP9p>x>SfAy$XX*@E@Wk#_L}h22WMl(i5l&@*&Fmqr8p0{#pIjT zud51&J1VC+a9|d!)VMNxG|pS(#)a)-@mk`ZfH>O>Vi~peCIVlkK|+ed^hg-yqlT1e zZ>Y*fRoz7w?PHi3HisH5?J2^xe^VVBd$8~{-=?AWosKD=V+TppbDpPbm?hduVP*SB z1PmV<+V2|X1QKKBB6iLKLbJ_==x``^hEjNOM7s8gx)j?jceRh+)s57jI_~Qxo?47t z9P*eKR)=G4#Yk{R ziGg{NgY{E&_g&56=r;10`cy2v83=5P&TPK1Xb6z3PK&4Ljo1RNc@S(BPa8i2>TiR= zHKMg_+SD~ARYMu+!tEU%Q;JP zu4uZO^Iht8#H_q~vWFRhz|w`Y5uA3%^SM*I3c{s()V1qu-W)78sjt+(&JYaIt+QF% zh!uNjVnRhlO^w+;m-(4$qyq?yjoN&@U^n{}r_7TW@cuw}oaZ%)L>0XqWscsn))kiP zvNPr7xCz_0|(F+pTHzHVxYSN$Fmvv-@lER?}A`u^M#F)mT>fLEX9SW3v*Viht}Rt?@$`wR^YV`uM$qUUW3DwqduG>c_2y9 zr01pH%4|X6B6?MH^okVen3_`)P%Q7yCzKogp!G`XNbB1}X-<$+^M982Ros_f37q$= z0LHl7<+w?Qm!L$~A74dv6TiFurbKghf#A<9s85o#poTjSs!pQm(DG!gI^s~{^?-(F z{NTiu4@Ur{enrIsbQ($mvu-XV!AAEtNq4Gz5qzqVSD)bFFr1bp;|wIMvE`J%*6jIR zbWe5kj>KR8^w~FPV)v#2$J6kTR}_pJ=SNG;RsOf$x5w;!4vX4sPZQXCa;*m7LWI-B zo0PcW8@iL?y>jg-q)>Y`*-2DlOInr0D1SsAri4Jpw*s!e1u&p^xQg999Ey-4p>HTj z9~{M>*ZMe7xRVN5xZefPVoSanl3mm5Ca>EIFKjKTQ>x zA_yQ6w2K;;ECpP1tO?y~lAp64_g|G8jEehzi!sW(q$Zp=iXBHYZXu`?=!#(6dod-( z?uDgx(10}B9#aL(C$epsvN)E5!k?%W%EpjL03(0>yZU~`QIA!dD{R!dI1DWR$gxw@ zX>iE!C#d1vRtKtp)c~IS)g#~)d$3!ulyA#i)%7(wkmBaWWA8BbtMa!bS$8j&U8#H< z?AN$Rcz0HGiR!RS(C)YtJsT~yc1U28(@}yxI9zdezMxILCX3Z$d{c=Rll%s;F>0KMic0FNW?7BX8Ua&n0^p8hjewn4!+ zIwR9$m{b}1LtJsLrgyKlTo-sM7h#yozkpY>?TIP)Z6+z1j+!mLv4gw3d~$vsTo{HT zytuT+y5iw+<*q$?s4GM|Qj0OBjM==Bp?h&cZ{p!wzy9R2YcHwT(WqeW;+joX21^!{ z0rX6rETG2yQ1>=f+T60nq+c1#&|Z||i91D>qeKrvPZy7e4q0`BIVYVpo&q z2kNfbMGj9wZ{IGe|M-$ih7rhLuXE923!(!!;_Yo)P@w{O<}IY6y&%mCB=j+iS+{`t z%vQY*@6jVdermMltDX(*PPyDLR-r|8>1nY3j<%o$6Io9XzngOD0CG;vmMMedl^O-( z~Q!iJ>IeSqz%!k9xBU=%&PAto1yC0^*?| z!kuFOlai%j?~L?&bkEBt;+KzC$8^QJKYy6{+5IR;P0a(ydIbPhZc6pRw}g^vPxh8| zJ1bE-C)E)|dlb%r#}r$?7mL|!hPhsj`FmwgwbnBrg#(rpZV6gke*L?M9zZ z{qIkaaY6%sEQ-DF=3dn%VgJ4LVQx541Vvcn>JDAH=T2V~-}q~6M|+VN89HWH{q z<0mUKL^)Q5EgwKv24Ys#1dY-FOy#oPO(~7#DdA3q($TK?tOdM&ADd#%on|%9w)=maX`BCOXFgfOut&7kMH?+- z0jXeEF;_S-2pAXgK3e@O1bv3L5se#Wy*;?KqU zWL+q>z3(tPFAa}pu~wHHK8rmMUT{TPS6AwnS-!HP*~&pQBz4FX<8e&TCCx8X&}m5I zr}3+hu_EB@zuHSg`X2q)vK^u@xVT=}3jA%3sXYGpo>sl}S-w6|ZNE<|Y}ki)qeM>h z$`%+9sBh_&v*!0LZ_H@^oqXby%-}ofy_AZ-xtwb=AY1Z)5XXrWy`gs9@p%y z$a(dxUhR`SuiV=SW(mMSCH}0=syhRe35>;ZUh_hKfa*QN{Sd%kctU3$F+I{*&t<^Y z?VrF2B;=j_6ejaI>@iz2@9|vlH9}SK{Mm^DUG@fN7nBgvTVP0M@AXaw%6&#*_}BvD z%kFxwbLZ2*H+tPuF;CBqJx~Wz)JE8jD|7AT%I<38Q>e!M{Dxxfzlc_3Ef&(ez^qU( zYJ?&oQyq4&o72^dPXjEg2tl}C=A-@y+0ERF_lN|g_g7g9c-bvS3S2E((`J2m#8Iws zuifX&p(q$KNDfUxs0_9tW?!=6c-M`+?1d{`vckI+7e26G?M!L0__$Z2NcMbL-$@EU z7#rI+_i>JV#>JLYM!RJaD_*N9%aSk5XQUN7p}Ty!bnBnq(oZX)3HM4nz${F3^7|;Z=HV;YNf|eEV3Mg zW@VT-wgzD=u0BsQK(}8pW$jaR8NOVc=)1)8km&qOU12GpJ6!xlh&IJ#;(g^nzw5y2 ztJPJRUKE#!5t>$eDP<|TydfAdS|E5|lra26 zx+mz`Ajdn@FAuRjQ9+t_WQ&38f+Dp#AgD=}a+JwZD~Gdj4mWC!e!^mh^R%6lw8>EK z`TO2mhh)j5oy^ppubzta0>A&C(ylxl%D!#OE_+BJ=0O;R5N{Yvr7T&;zHiwYJsv4* zNGOevu?v-KF_y+yvWAhe71LP8l4PhD+hiE)d)s=R<9LtnJHF$4=db%X=3ai+ec#9L zciz`|UgvcYV0<3=B}EEr!6WNzgfTHkuib35ut8PvTTZD9h75wF8>HZ*b%R7Vp6sfb z7Cw^ctoqiM9MPlAohr&NGf?67p$qi6r5i0aTVCMGmy<1}u%68!{~zS_W+#A5*R{w^D}+`WFttE?DfnVEoKt7BecDYs#-0Wj@wvFK>I1a-)t~jV*G{dk*Ui? z(^)yV8XRx$c+b%}fHrO{ioz$a*!k5=N1aBcxbjU=-O=#i@5e~ACfr!=a=I2#{mu`` zuY0nDLvnmzpZ^scf<_$k> zCq4kH?B*?nF%Yp&u%{KL&sn_xlX?p#`$C4e4le5nQSQuqhtN>T(UiFp?wRHsXYW!# z*`2NlWTP)A|LKnS_n`xZ{u_*l)ux}{-Y)tG&0fyBdF{rEM+x9y>iWoqN)`gXz`z*V zL|zWwk0n*?iku46rS6N`6AiDxMo=6CJ*kdQjpUKetYY+Lgf;cIaP37c0ZZ~7V71=!(#)UO{Ld_YA1W~Bdr z8-GL_fi#wN;uG)Nx~KNTxMuy^be>yW7)e)L3DZ2W%DXrvHNXVig{3BDEgT@AWePuv zeOS|dR8Q4slty}uW(0{J*@#RR!C@Fu83~Q_n;FSG7WLUHswzADi*r2CH#7&REI>~D zT6PMuPVH{w7VZ8Cv8}SAQVqi6x98Uxi+1j|bVquvmpRb7hcTKJX9FxN_KTcuP;)r- zK64w?X8lMsmiQU@r%7^J>QQaw4ab|0HtM#g8sGn*2)Y`#0tNDJuQ;%Wuf zw6!!zf$_plm2H>?*qYF9RU`iCCjFwj;KU;%zt(sX%{WQIP3BUrfi@Yl4@y2Smkspx zh-E9pkl$gCgkI6~842BDQc=qvaM&Bo? zN5rvok&ds8Ko&RUBD;Nc7rahZ%)bLP?tJ}5j5504^iPgnQk_YV{E!ITlPGrOjAI;g?l@y+KglC6hJ8t zaFgSB!f=8pBs0{B*%pEYSeAV#^4wxzcl}aR{NL~gr!!!ZxIgK|+;(&%yN={7{FGd^ zWzlV$?Jp#0w6sJ6VwLYtpmSt4V+#lvaOD-MbsB>|8Hqf^9k+slh*^VIRA=1MNFtuR z+_l8{iF}m&^6EzxxL8ic;5$0C)kiwr7#U{2aEDMlT3afF#vF1kEQ~72MQY5s74J2E zNA;%HBmR#!N{!n#xM2w*Sh&%*rt59+tcKta+wGi5b6Jb-mHkMquTjURXH{l~L&hd^ zL>17OnTw?;{PG0C-#u89F`3pTR*Dcf3@KZ=eC1vvJnXDarySLPJP@EK<1weJ)^RZR zPW|Y@LLxk0$5Hv(I_4eBNG9hi&1FEWgt6U)9o=1>=X>^H$CZ0OW{~66g@I?=OBGL6 z_yuh9yR<8U95QTL6jCH2yF+kuJTa-a?NFo@pn%aJI&8kysEmm)z<0zP``0M!%~TB(1Jo(i^^7^#kuI8@fmZ=@ zbG8?F=REfSQ9QfDXIdx(7B$$*+cDdf3B8^7Pt4({Y`cz;=&w;)=sp5yx+1=R;w7ih zTjL~guK0HHAcX;RBj1nKWC;|OR+Qr`@?))>cr3A}-L)2vVCqZW66{vzj&M+^Kbdl| zFV(60YQ~>xX^A^2Ki;n-`*{<`U>V>BplS@j4`6C9rLeF6`M8A^w)P7c zjGz}=)lh=ZpNt?(MKSe_E5+P!D@|px#3+`oPKSpeq&B5zh90}WEh$;ZhMK{FHKj1W zJ08JQqo)MCX!#32ckVkQ-t0IT%JTri2eMm|UV;ADHX7>BsO)P9`ZJkf2C&%xt5}Dp ziK?CT2v1(!OuPPk>uwzN_4hJ#{45VQ3hm(a0wq#Bs3eK{TB+c6T#PObRZ4i>Us0j{ zv zqg8tN@r3MnY5-+A0g4iH$nX_y#kJ$k@Az#nl0|gj7 z(U{YdVB!O`Nt2;L9Jz$IrTY9m$n3{TB78;&$V*b=tDtWhn=j|q*c3G7%o~^+ulvQ8 z70uD44q7F(|B^?O(N$;vl9P5;ayvCNTB_pA0w-EA1j%O3WeV46)kDqbeX+C93g*mP z3VeJgNj4Eh{_4amJ~X*L3srUWCRi=NbT{Z1_7CnjKFR=|F)VaG@o};`_-;=&kaj=Jnu~Rn5$|c#<*J8Jt zF-c=h5tGs7>le;#3U;j1dW;}#wuYq@fxJfUiDy8QW1#tz5lMaO0(rD?ZAJ8nAa8Gj zVEffNVjNqwRrw~e)3i5D>Dg?M&#Vus+ZZB$pSW9|zngr*=sXBCX8hpyM}0Xsi}rPr zzDW+ZPd@-J&T8=QT+gwwHU(*{?K;=*%3z|eii7Lbp1yyZnQFeaTvo9R&v=jw?o>rn zyls(i+$)O#-WblXEx;T1|5CyBpZolmKx9u32MlyiF*Mb}6%!9IaeLCa%hFtmii#vO z(CK*}%{+N%4=N}u6g1$zhX4}RW1filuIiWC3A_150Q2k`5bSO6+C&6WhMetmb^BP` zN-X8RP9)+EE)Z=F%F(P91X{zjJ|J!Qt`N-UMyfCF1bJ+F9bBVTiYuu+yRAS8{wsGe z+;*oh+`iIX%+S&B05O3d)0(_K!yoTL`iT$r1ybw+LK-2DOuP5S9}P&P1H!V*ry>RKv89dxaDJwf%|w?v!sW z66tc>@G$PwW?Fe$kNiBli=**z!KbQ&S8T8%n(%@){VE`^IqruD@Z=((nW3;?^H`Zy zSYX~`b@n=j2346-|BM8YUm)Q+Sa;{Df&bzqWHI!!YALG068pkEB0Ve18`GTd&e@=v z$#=uSE_LDQgG0Nvm&9^t_ki_anf<$Q(y%aADMoF*CWAu}?}8|(^suq!esDB=XRAgz z!gD?8EW&<$qsW)t#k)1A^4veKJ*+x=_Yw+d+0xf6N9^+~umL#n8`%~X`n$JFs~su3 z6IWYHU-BsT&;_o`F`~%olAX|YQ`U8pXT;+%6#X-27WjMv*ME84r0vU*^!euiZ)?SZ z7f2bv`M!RBW%}FSjk9tu$UqK0-y&U*`@)0Q9lxL4vNlMyxSiL)<0A&WtYIre_ZU(XRv4y=?MGl4bs9;LwCo2 z20fnh{@!z4-*>?UPwZzud#}CLz3#o%dIFRcrE#$-uy5VEg)8&wh3c(aw-u4c{g~*; zzi2FaDYtG3(8#=arsh1knSiD9V5tQLwk+Ld3e0|J{2t_&`ub6JhQmy&Wyx0WYh0^S z7KwfHCEZ%`%;@OZygB~fLao;%QE{oMSfAKZKY3HWdzAW#A^Vf~T+gizJG_-1TfF3N z`xl;GfU<^tYu^1Hk?o#yf2kmn58*Hdad8^p+}AS{)xP)s`C zayGbHWoY=z`JPOP0RW*SCddGW*kF;QxJ$u^Y|q{gh`OSs3%MOaMCThGZ3dMkSvxV< zqUB3#5(5eGy@(yYdBz2n19;|duae(*OXn1~+WuDcS3IcF?LH5Ds3vnhrzP-$&c={I z`M|aJ%ymleZq>gJ-0SbFXiV^_#QN- zw#=vKOCYJ02oV-nK#occ6lZf%5_fo5SrzSaS%24P52NR5`;HooC+@^LO?z316{S7x z*h84Y;_CnmvqNsFYm-&3SOmfUI#YG!PDx2Q z;XI}=cj&AS?Q(f7D8Wmo7Uy-2CV4TO^sOUeQf^r3v1qEcS++DKX!hFuf~#-ajUp$H z=G)16!=Jezf+LVJpJ$XG`=fT$F0#@J7T&_czSC~zoP|pKWYXf>AzR`{=mk7SM|fX_ z&8n@b6X-lc-lBvdhUpyp=)MTx=P3Fm3fxO1~?*CaXs4w0y0r0GX%OlWOU&a{_`YdX%JIu+U0^bN&nsS$NuUpLxL}na+3HFXiE3;1Qdq1Lxzn{;oA;RnbYIupXF+zx^Osj&JDd0b8tZ z@wueK`s%$`DDBHZ4BKzx7%)wYVhl^yjA(Z_Pma`|Pn!$JG&PCdH|cEH?U$$-*Jf;) zcpZ0TFy(=6AhxD!RGWF3N6Nyx)e4o?Rd0W0tR$(Bl(|LkZ6jJC(dD)2Ul6qYR41~` zIwA3Lihj4L!G?jC!tF|Xn6ay4IP2NI9-dv;%9=b8Ps2YnZgV^D`7uKj_Hg<-Q$Etd zMTG~@<`bxXA`IydtV*BxABBE$%csXKO|}0u_6m;%?rkiv{XzEi_wH$d%;g6j(Tac)?q8&F zFv8w{se}nTbnt7c!_}GDw9x>AFPvt?aN~|`SJ(W=hm8yWtTaepiF&AADFZa5%XV1V z^q@Kt;%}_1laOFtQ_ZhoF3$gUmM=CB=PwMrkE_B?5~7|}b=kXcH9!0Plo>O|5#3Ald7&$?+Ix|WV8d^n{T_(n$u=m2n^l8v5ZM%=K00PNZ z-MosL;=X*?f4!p1=25!JUpfG^TG5lFh!ciC9^*%OoSH{^-H+jFdU~No9ifCnOrH*e z2#{{3&)CfD#(B{BW;drp?wj35HueptI1u|H18+0?iUe>>I{s`P#f*%Mo8tnCQ5fQ6 z7ykQ10hW`U{R!15eKfTbP=aw;&}vmR19N|fY!FAL07I+}rj;&kon!Tf1w4DI%?YSI zTPSSAH`pSjwC`>YYEUJ^l>%<%(Jh!`S0H$g<56AV1~I_x7rzr~>eZAH8R{kaEgrBf zE~Oi7cHJd|Y;Oim@uR1Hs3t$R%B_x@$`r~#Jp{6T$D`Namrycm6!7PbqY>$NF$=6s)t{}7gi#gMme zSGz=~f=@Sp-Pm53Pqoo4+gjIu{PN`azQUH=rs%HIjt?gmq-&s8`+V!+og)_t3C!Ie z6{i;U03Ko|u|sfs{eX9lGh%;<)r0WIG3a8?0^M=@$ERHt>h*SQt2d}6EuliLXmaw? zXlPFoH=@J<(|qMFL&D<^i^O>-!9WB9QqZqjlRE)RSkz5Rn45xBb}^TvQ^RE? zA||X?6tqEjx=Ew#FlY|0kU!KU^ll`c?HVgR{=;`TlF9o1`?Poh8-?46^&9 zXtNxlJ3AnM@#nDlpoBW472~+iY&W<8cPHt&->uIFSAL*#-rGEtT#qd3bWrG>Dt4xD z#eDgFu=(x>-BvCHE$hALqOUw8jgmjk_B}66=nU)pzg2`p6f4|WxCT{+kRTg!saD$FF=iSyaVx4FJs;dhWDawvi@v8IKvcf#WI6ZT@V>^5vQl8 zU(ySm((dfJCaWAjL#h*jAudv%W*ginBOBqfZA#j};>{Qb=XxjU>HQWj3U^x6vvjzA z4DiT^h~eZ5w`Jbdg>5XsZM+u$CyYiGFJJm>`=FYnrwkZFk1*%dkz5q{wt{Q{#Rcgk z$E|4@)LVwkRjg1GY z-bYl&1-L;pqk||0Pv;8@KtcP>!GHhzWNd1RdUBEBDSSjeWY}%HK^oaCoFToqI2@KE zM9CPK$`qIy_tNY7d=3PC2SuJBe<8@9n!7>%TB@!6Ip# zpml05;CXYL7&F_RIM-FY+1)X}`U6XavtROP_rCiff~*|hxjDZxJjmxYe8lR2j~L1} zObq6C2|tEY-Ko9v_NZ2;3{lLdfE+e)2vG=dbDK^Qr@bR5rxuZ)zx{KIX7nvghSqGw z##pC5TbpKOJ*dL0e=U=hrF0%aZdB}%IeVtAo;CmTXI@vjPK_-U4b3rmzT3{w6U1?b z+}$Dj#@X_QhAhnpI#P@bK1%J zoSQv5DlRMYN!VHaJ_bVwe=?h$Wm zhm`m{%8=F*sQB1EHa2Ma#&%dXA(wqq<1t5_DW8%>y+S+Z*c{FvZzC{4Lu>e#{#8)G zjTy0mL4a1FXJ)J`5T{X^xIyA{GJ*YNsx0>iXjq zEHmb?&No^}pztK^8scL5M(K67V@83p807F7ErNkaugy`48MP$GbIP)Pw`uJwC z9ZofGc4AftXZZ;@taJ$P6Z*v_6pm1Xw5t6w|oK0zu>QenFLNU7N+~Xr2bYii*mhXfV(e=Jb_|g@XD*bbfWgCs74|q4oMA z8GvaG#9ftxqZC7>cNn1l`t=$?$mj2;`zsEgJhMW*y}g$WpbPZ32``64e$?~gy74#~ zj;`!;ZZAj4D1m|Tcx5r0hqtDtZg)8iZGIaO?3f_AyApeChGaLF zOB>9eFmZkDCy0(Bv4s7R9|1;aIzC6Jy?-O3l*D6z5ecOIae2Rvlyw?r4V5in^YIdtQE=IHrIC7 zLE8e>(uv*>EpcY-ge@<0$}dg^8c4T)+NgLaFTdl{4?j<*{@y9uI$edH;<18NyQJ%e z-@NfepZ>tbPg??p%U?up_j>8_8X&Ymxr zT*Yf%IdqfUD54a9Jw({S8Go!uKP=ySF0KgDC9BjX7j{LcJL%HgS;3Beu?upKh&C89 zJ~-a_b`eR*{)(A-e=YVa*q76KTw!~rj_Bw}&-6GUqU?dS_3;}ksJN1n;2ZI_ZXDY6 zhQ6;+ht$(EX}=U_je$I?EDL+5`y=ib$YikrJ>HdLtqTRCPw0Y(paCps5EIj*IlXhI zyh_^Dx^OnFPB)Gw&+6KM4!qznD<(Fv;rbAu0;@6)71f1WC7^fQ7>e%f z`si;uCs`{%##Tin-zT27DODC-3Qn3Ov$c3|e40G4a6p^(n#mC_3)y{kyb&~T-%-vK zWMR(H7nRgH8(A=PQ0O7m+Yj(Nq6~FODryOxaSQ)ki|Z8}gsVD!=In!g%-YV)B-|nl#D?1e*Z?P*HaRlcsBqLn~pY zExx_IptzN^+U@Iox{ogoeXD}#McpS;`olYROxCPyY1!Erm?t(x|Ken7Mqp zw_P<@CWiqKu6|f-0nqcj#_?Iw#{{>WVjHaY%S~L6Bl%iOMF`RD=a0BfeWC(kh;JWs z*iO3lTjCu**nr@H;h&g#F6`NVY1hnS_=usn^jqAft1~5M7qRc0{=i?RXB_B8n-mx# z;%KxIO}lHXCjFwZydFtNF1O`l<1$gcB@ov6-egeo!6bY2!4}_s^{JMp7 z0+PRQ1i6#`bqN{43n3bPyx_0+;R1XWU`>7b)(&UsZg+;sSiqQGVMu~!#!kVE1k(FP ze0X_s@~y+{4*m#9I3Byn1o5d|UQDwxC+B11oiognZgRl#-msnza^y6NQeIrbBL1Sy`z#TndK} zfeqEh1HMGC{#c6+B_q@BZW$;%{GL6 zOgbvrTE5Yw*f`lr#uUH0@K`EhXeC?T3<38gMtSO2hu_ww)K0&;s^jxm?it@XqG7mf z^lZS^zc_U9y?fd^T8H*g{17iNFSqBlTE<~Jnn6dP=BHrHk9lbrwZ{~p+hLJ$qRP2> z-P}&HRNfb2^9WksYGykXJ>3ww7;J*oA)0ePi2s`Xrq*3a-TKe;?s{`?Mn_k;&rbqGqQ9CgHKy3Y!}+54&3p*L#7{^BHyr4jqE@8YBoMRYv1Mg(n9rep zu3X5Lm&f^VzWsBpbJG<_p2d$@wv;fS_)eyWHR|7pQx=N2d>_@dH&4OH1LBJrjZGDA?F;}V_EbSbc zH+F1Y89>B|T0En9w+=|(JhUoWw7512-BJ4@hI(=bW!(}DM$-#JA6hP>6}scAom?*^E% z<_?`Le6Z>Gn)8E|tw~4a<0uwAA=%!?PBdl^>=s?VGZg?rVx~m(t$R?H>+Q=gPMtSD6dvNuTBl`Ub$6>}(X$ETv5sY> zm0vt!>6RAk9EwT{XZd6H2&eWb_cZO91!2{x%c821z5P8Ks=q^^VPb)Vx*V#upe z3s#sU3pB{Ow|#W)*+#3W~}&-WkzVMoc4?y_)?`aAj_!Y{vf zlk!yoI+t?B;NPn~<8ZVKY4{dPvJX$xh#I4LG|D)IaE}h!91XZMJQ5_Dbh#4o`OItL za^tmzW{6iTYfhLl=Dyf+n?V=*ocI*mSm2RWaLqgZO-1on{x*#J8=;~z_Q5vZpY*Hm zV<q)hF@RK&464E(awgP--Yo5mGO$bsIEm22%28D%>jm<87%FX`%G0QA? z!X|2r6yLWeh}2>D7iYHEdwPExdhK=wn^8a@IQ{B!{nO``mMG`f2k{?_7mkuKrz|b^ zcb@kid7Yf~gj@jZOcfe@1ZA?fwT2AxSv5jiTjAmgFqs@ST9Pd;jVOxDCXVS~PJen) zS44=&+Nw?P2@lX=dL;V8nE}h=S#YHPH*aoQT1UCe4&-`C~mFsGULcWO1 zAvd0R!Nc`+lH8vA;xh-03UET#anYHBoDBzO*O7;J&H$~~N3$n@-SAFqhr=~Z``ua% z0D)pkL4<@XXH3hS=83+;-3Boc_{M17kgF#i-pxi}pvTg}h`yo1&rys{w=PI*H#PnEGg?&yNC!auc%&yiXg zI|vqlWHB6iJ>F$DTx1eqRTT~|qi1!W>FWFIO7wfjYjf_CZWR~4`a$gf)7mZ_AvEL7 z&4HlB#7ZjCULl;{GKm-Z~au zM9fJbiy+tzoz*NO%5@)K?37?wM#lBwfABmk;m3*E z0{g}^$Rp$yL-*QMnF}*-T|Kmd-gTkbYx9feF@+d;rzVDqOT~RnnSDQ>hh3H#lb7uT z)%Lb6$?YKiei$jPH_*)No^H)KOk9F8DEX^%Ix%s|Uf12lty%9F={SjjsIhTFs6Z1n zyRZ6wPu)fp+9%RP7ipzA%i_(E0Yx&gT3*vdTHZMcLsxr+>v+TYWF`)-i4GYH;YTym zTp|!0SwFm?c0V^R4;?2T8`tXUw@ZT&%lk4?nt_)ey)l{sFD5;o0}Xxd9YHp}-J9n{ zPveq3fj0N}bf|SGO-U1tbN;)ekYP#EVNt6O=``8 ze!P}mT)_2u!eI61QXpP4;a5>F_Q~>Hje4ADxsLgym6WizlhDa(I>3f?k505Dfnw>- zYdH}EuVp-UeiP=S=98z+K=x#T*&e$E9|VebRn6T#Yak7t~6C+?Obf4v(EnN3dTwkfR@M{)f|y z^I%nkpxcq8;(JiZ5bJoovUap1Mb?j<*PwBNZv{mGF*_BDZV`jK!yad;RoGWMf9l_7}aO? zZQn_WY@UJLlh()ccKmkes)`?aRl7QU8_1e{R?;)2fTC~OC#!Fy!5Vk$H$%sR#f3Ak z&y~#|F~Hhi!J~wJhvyzNKK7u`$9d%pN$1EPmx#K4AA2&BSp!@kSmboC@0Y-Y0GHQb zBD^$#ZIO`+^ww2I?QAbz-f0~jM4NHL?KqZ}?S+|vo5bL4m~yp

S4}$5)Me8l#7r5>0Jk|8aG}EjT88wTq{B@izI$=(*daT9*?$ zg0Nek*=r<`wmdSAzax6=GP_g6qFcRCeuN512Q}GO$SwNa%#qBme{7`Wqd2}rgEcY< z925*xwwz(y!Z$44(LDQcT#1OzVki5M{GW)=y3W`ccXPf9i{JKGAnJY1w#$1wq)c9s zR1-rP`uJZdm-T7ov7rM*#BJf09*KApr_-&+Sm$^Y1Yu~5eQRU1T=X)By8f!}ZJXO< zybs*`>Z|`IgA+R=cz0N0kP;hBubEl}NxDRWtS7iQ1Z&E>V~g9c8VJvu6=x296T&r- z=NWtyd0}-Tv)9abA86z%+dm`%OF)v=&Mcw&L}-&nFK0sxq(hf3?{1`D;eI{3Qhr>szA=6b0s3O;1R=x`sy zTi1l|XWI19(5=r|?6lQDX7PoiGun>)Twz=c4E?gHpfo$ms^CvfPDe+xx%>K{nm9g2 za@+w>4&;kmoep_S4A{3wT0%`Hk9=GVvLSY2x95o@=*%IoK*D<#7cEf$=LPu&6WPNF zKod_RRp`ztCA+U&S}XTLw|r0-Zowgtd9ET;n%S!y`dbw;4y8HdExOdZOWv9%#1}kdz6$I zqo&X9^-oJxIM0~}Qxh}ucTSE7Jeislrtr<66@*aH*PwkHIXeTX2s=kEq*dStPLeRz zTxe(&GW3qKZOEk^sw7U=1|h3adNOqopTA!=8UXALbIsxDkuQxBy7c_Bq;Vya!+0;i z+aX~@_&J6Buv3RW)G0grAJpk)lAy$~1E!_0v3;LO+lr$frRi7S{XhyeT5kD#YGUuQ z_Y*62ODaS8?R5uTXOICsBqta}XMd50tHnn{xYZ~?KBK@i(?C`U@Gv<_e>6*8UuH_L z7?mWge&~=R;d8a;@4IvcA=-9)pbeE}Z`xN43>zbw{IXhn<^g?;=>bJ&yRmL|nX&{M zZm!0S6HLZ<)rO$K_8@W+N=D#(5}VHZ_k9tNg%khP-5m|n{hpCZSrA{5`No+`G?%a& z=jh>tns5w$@HaG^VP9#$4MloQO=*kZigL_wuX-$IdzyB5kzA=$AXYiDB`xCX6|sy>b|JxcIYzj;8s&O|$SoW)mg~He_q}K{;$ZFP+qRzRRPDy~vJ%X| z0BPB0ge*lmPq((%on6vTeIA04Q| zyXiZaCSvsRio49k)La{7(&MY0ulj^Pb>&5UmyP3umZzzWn*kA`j&IT3-Cr6+hT)si zh??$}q(tHYK^k37azpen5?cNE=G_%^q3rzUgZDEtmU4*;RfV){djytUlt6BBeYmy` z`6Ykrc{ya>0u$dFU!&+&u=5pKny1j{$x%d33nfvrjh(%;v++HW!fq}vFFL-Zrt1wZ z`yE>;|DTxhiA^L{lPB@{KmEND{l!~42XaCvy<4|nJtm!pv*M>uou6|i3*?WJb~RDc z33M{ZQ}}RfivAod#DU4nK8>AC_%hU-MocTGM=DWkg=Ltw<(n13xD_1OKD3w?w}(W5 zCm=2W>IqMP#&x6M7i*k+hMr;j}z3v-zdVN-v zlYk9hN5}ip zMHSiZvqF{S(vsC<+50#RemOZ^QHNO$(0ywYluPE1Lsx?OJkRQb+YfrSb=;Z1LTI~G zzFUGJZukqhx_OF=xI605|0cr+xnJ(GtG!CHiWXLxz-`$wXQQ>8_MT6XeGV{M{{ZgI zELW=elRbY+K&qznN*NW|FIZEdMg_o8?-~T4!iT6-5|Z+CBQ)&FFv>=2y(|{uuX`m1 z3(}GfnyZ)Nl6u)`dT?$sisl(f^zSU6BNLG)yALD`V~}Kpg=2^h=hy8L&}&!#X_R(9 zARz6FhHewGm=G0R3n2or!R@s-0Z$!P`{zmwNgmOA&#$e1*lPF)Kc~-NP#XJ}NEPce z*F5jZ+z1}jWnMCn3q6uu)$3X}PTX$UVxH)_HGOWpNMjyn9?jO^*_F-V*83Et1|P%N zs=dXdqDZ{m=ODYRHoEWnCzy#|1Phrx1;@KGH8@f8(&HSc2-05xsI#m+T3w))KC`v# z64TXOsd3y6VbjA-wVY1vj3vXb3p*GeI5tc4$>4d4H~Nmt55p_yE`;ovh@ZIuXcL<&|Oo7%OQR{}*3a*a$##)+953`z`o!Q1CF4 zSP&9x^IAUBePc`NoN*Ynkf|2BU|%&jtZY*%FQ~)}j*1@Nr2ic`61-k*&cQ?ojT_gu zq{530J%nYuIa5pP@8HaBgw-v)&f!2#n+31xA?_(qWZHW-T*7>aiIkRqigKl{;!r*( z)PkJ|l|On#j|}hP_o}NWeDv`t>a;TSrNdbuEo^HhGBakKp0C#+gy{F)wex&|Ni)TT zm*T_`o~dz!+hO72pD_n%xfO3=p`H0cUCkKh`J=Y4xEj{ivWRf>Dp9M`xA8DEk|G`o zCg9fXqVh)7=@GK5$7vsAqxN2dTxP_(x&>Rt(`Z==M}q?r0Y@|!LM~0YMEy~$9T^6^ zBhjD7+zTYWA5i!lj{f&*RaMF(1I>^}Ap;$qPy;|z1D;YCh3`{Zvy-`5N?Jx59?khe zJ+UATy<=?BRN%Yy#jv67j2$PED-GRe;Ql^ikV4erC&;x^JunMZ|*qFhty-u&hg7xsDg@Zy&$=EOJL` zg$v5f>!|ZrbVSVzc+ND4OrPfRsCH>wcD!Bq5pcF{A(NKlVqV#lnVMfQ!du~>V->56 zOm)4;=R$@SIiGuINx3 z+Q{=pUyeedx6IfLX(W@vg}=rAnkc`X}{Ep!X~Fi%c(-FIx;9tj38ewzr(M-#t77 zfE3bpMdd21Dic9D@XRh>@azpRK7~iJ)zgjib*m4z%U?VFj~jYdITRK3M0SdUmHBff zGU6>WED;?=KCSL`-l;ZUkp8w>sFq%o2OVeJu}g6a&YOe_2a zU=iB^hskc@&4Jq!M0BW;Oy|nZA$2QH3ToFp08kNBiebUSq7HAxoqbxT{x2KzzgtT4 zgJCsqyS{8_^LWOSHu+h95Z`$>Mc&GAftzI_p4|1P@T+@1**>;pI=?}aWjO?ceL;-7*bfju7>%160CGlv4C2C4EU>thOItZzt#pl zZ&~c)QG(vP3ihX#s8rKU_iFmpdAWhOFzR|#?gW$e0Upktf1VS@J&!eN;`N46X6vT^ z+1@IA^!m$#&?Nl!AlUjp$Myez7qzrt82J2T3ZBarm^I%|2CT47v)|L?16{dJkT4d2 zkhpb|--F}9~Kwq~*EQ_Pc?cjdrtc{Vv((8W{3OlX; z2KLBWk$$;t!!WMM{z^_-|1=}U7Y(8~6CH9pqgh4+;y>?}F+AtM(+UCpb|%33(Zy%8 zVRi(o_uo&f+xBL*4)Gy_&Zx!6X5djg1Bm$3Ki~FAgS0#xu;@=5RnSl~ZXM=@y>+|9 zk9_^hRj@?ZE_Fdb0P0Hzd{hX$kWy4cA3QlbJA6|oqZ${|DyvEsIipq|wfAgWyd@$c@&hZZz|zX{Eqy-N z2>#F_xF`0*f=3>=qjLJe_wGyq#mdT1)7CHXV?5&NV8%a^ zqLNjgu=hzY!9Ux1=>HCcJ*j}~wzr+u#S;E`7zGT!tq@s&^?UmNhm-y>-#;nZKkfeY z;lD2;8R!2#{3pNrFL~g<$NJB@ITSkmUnIGaD2f^UW&byIM8DwW9~XZ?8}i}EC|IZJ zUvJDECC|#!C^An?P4z~_?QXKuMUdS5{1G||`p^3-{p$pmiqv=S-u;)EMj{Ier&4^F z&M%!hxe`R2C|pjZNXQvI{&e0>p0!Xv^QOsDtTJPXV-u*;HcOvKZMX7<0ah!nVk54{L38u7vbi-W>LR76uP1f8|Ggjf6?pOFcNnXa5x)CIdy)sAGb#_@b*m2S=Rv-*m~e bf6ar*7MI~VfQkHI?3Rp_;)_Dbx8DB`>Ue}x literal 0 HcmV?d00001 diff --git a/docs/userguide/en/images/apps-images/mail-spellcheck.png b/docs/userguide/en/images/apps-images/mail-spellcheck.png new file mode 100644 index 0000000000000000000000000000000000000000..dc6aca1cc3f987ebccce4876464b8157eab90581 GIT binary patch literal 29681 zcmaI71z1#V*EXy-(#=qk0x}ZP-Ac+(4&4YS-QB3<(A^s;$RH|)K<6eb!8+LI?wFs0v#D?WMh7xc-Kr|Kw3z!Cf8 z{9xdBowWE{WtX|#RAdi)34|`%ml2ET5%PF$*f?gt$q5LcPq*ZrBBHC{Sg5~w(-(lo z&`k4U%=|@Gq_2Z0ik#a4#B*t%mT#Zgxz;^i=ACQ!(nHVQ(EjegZj5tfWqds0YxO6h zC~UsCG?L4-LGZjN=5n#lSU+DJYSJXSAUK^0$k7l)<@?Ug@rk|9+po z@RTAA`CbTVA^54)0iu-^QVA1L7|~GuC4!9=yUlrK(VEK8D{;zfNUUPSv|->1-Q2eK ztID}b-pZFXE76`9W*vWSA_=^GO9a6uFOWs>Q}U?{Q{!8jSjWhtHZsaySv3nc+S^_} z_-%XTRE)NGR=qzw>=B2*9z)wN;QhWz1rx!q>b=h#s~liVOb+bYxCu`pfMNU%)ydxD z)p@wGA zV->+kPw!y`}xWl+j7AqL0O12D@>+|4DLJA6)J-aPm4xQMiU7J!k z&8>ouhITVWbos7ERJ{1q1!h;ygqds(CIZZQx;zdFQCKXkuvjQxH3^kHANmx+Nw;J- z_R6#LnDUREfxX-^JP(9(*NV$yyG4dWAtQ4&roeQ=Iprp{G9WQZ_v{!k$I#DxS2>b= zA5hcN$tXVy*%vU@_-u12Q-FAc-j$asHa5Hq*@C4nvXsv3^W9+-T$Z##9lRHgM9E;{v+eA|$8QnPr7KTk54AM6^=Gl!*%pjN%DM|s&+x@b+xYnY9KMqP(E3(4WbzYpgXO}G{pTt$$__2pHEy3|_9+ftW>4fVLM;mWo5AU2iaf~(JR&;|J;+Mr9ClVyIE%NFb%YPR&yfLcCI{O#{AJ3=a z&o-k&E&^FE?}l*`s}4fSe;OKT{bHl|G*FeqWWRzNYCF9hRw+6s&vE*?z_rsGFFbP4}_BYSy$IVfN&mEgv$@#7$&c&8)lR&`5}eyAOVZvApEs_e+FUp{%w$RZy1lDz~a1ZXecmCSNz1&x=gypQqI5F_Q)$r zgigYZF4gLYu%qYK8){NK`sLDF{>M1tZ`GFL;y`FNP0BMYj`?_J6e5V=r=I+843hb@ zG+bRwaI>gI0iTgiNaLzhS|jkj1K3}Zlanyo!L7z`#={cM#JIDj zsZEEcYE;~BYwN&9mulB1u|CqHVg4lvBR{Brlqz9n5IkLPH&#?ney*?D6pF0c7MeMD z*z?3avtMhzxoGkyc28z9!WLCJAKj*~`kS1uE3cW4>XWsUW|d4F$h%Bl3v!mpCk zG)-g(e!Q=WEtCJrLD}4ja1S3T|1XNn5EUR5&>_E$_3W8;qdRwXjaS+iVEswNqB6E8&SqpPHn#cwm za{g?+^p{-UPis?_^Iz%K|0>?oWmp=rr}MG0zFM`i3p`G!WMqKHM(8r0#5?F}$+!H< zQW$Dxco(y$9q?sr^56KXY-dRu6sDB(MbW8>VKX|at+iYQU$T8_uHb!+f~f;Uz2#Tb z*$H9;W=u(q+&`IC+&(50>Mfw~%R|w_^t^%tul9OvspDRqmCoFsIm^9XG*LAh#-M){ z7hL`y2hzIWQcHJUV42{&Cy9&8UOq7YaCbIHzceto0WkTv#x z#FS`lkKft6w_B8ismHtAdZF9IV5u24t)6?if{B4v!g%#HH?0h)BIX%0H5?Dy@}! zZK>s%tc6fwNmY6P_l(brl$a;0|9Luqccvdz>CR)dlkJxG+VYuOV_Wwq0+a5|lgOSh zY2ALD(`=db%cEx@-nry`0(0L|tZ6ZB4PaBJW1up< z@9M|&fEHSK*)}zXr~8HL@MwUmqW!!?FHkp?q-}DPFwUvOWTpYT=2dQ9%qTR(v$41$ z1W8s$arxqCUh=I8k7x8;i`@7;RoMz>^Tk|*Lr@QM`Z+}bvRkIb))-QHX=w=HPka^( zcIYell#yWGnIFLIH+exwT>?(q^z_sr9_YLmb5;3Hy6mhi#xh6X{*@75=5Cg_(7@ z%F&V8&FY$3TU$or;*H@u{w_nt8cOgw$5h_QSu7isZ^WwKTQCC+jTp<^6nVbC>CM7u zFRDFaW<+IbLf!N8bE>Fm_GdcgaJzObetrX0u7_8X=TZm11j^j^ zK3po_O)MXy;f8cKDtUDd`Ha?=WU$Ca$He%QRidj}1@QBJkUu>+foFO%9Nzpk(f`7$ zKPBb3RBmWnR#rCc?u{Xx>#{pm$D29Kll8~1mVjTkwzk}GkxBXV3(`~lzKkv`kZrVQ zMvoa8v4YwM2424`{e*HoMoWz~#Fn4mw-*y*lDZWe#8_&&(CEm!(AWHhB5j|z!8N?? z7eR}ua6`4_YeA>VugTtW9_J^_8u|e>1EM|MT=?N90~K;cTVtOl`+f&Po@eKDKRS<^ zIEJ9S-0a4{Q0;qnj{iT-8$Y&bX<-NZ;wUx&+lU-w^z@Vpi`%YUS)`VzW%hyDqcT27 zfCZT9cX_NJE)HtZdUD*O%%RgHbOd9&mK-+B)Rfef^@XSTt_-F4MR#Wier*w;DN#Bf z+)Bcg_XD^uv$LqE^aJJ`lhHY#m6LrYPG6RKN=cr5+jHKTJTHD|VPcrN(yV7nY7Sig z_{&Lq!OdqZzqll!<@RwcA_G1%H8pjEdIZPg=3KiDZj!G|mJz91Ed^it(p;MVG&r?T z5v;*o_^sNy1`%@&!$1RePb?q%~B+ z^c1A`2`?~Kt3Udw)RwosLML3a(H3k!x9BXBe`_{TkAOi4C^mnKky)(!=2OP|@_~>u%s%s2^vzL!a}$$IYLtJpz+6sQ-bGOnU)ZaX zOOUK+WuH9IE1Gai_FxQq(YMehrKO1^S<+Siy5D>-1%^_xir!zreOSDJqC|KQM^Ll2 zd6Y*>jMLA~eTbD8bkV9&0F{g+zLS)xGmeLrqExYA=ufO!YH~%NPTt@GpV8OshkyT~lYA(Tz%oI4e1k4GymF|wY@k9>=*z?C z>irlUIf3Zd*(t90^~%xC`!d$vH`N|-MG7os(0Z6d*6;V2GrC@YVk08n{K*E-J|@#0 zNo8YE3d{cI{h!PL4|@&jqMW3D%nWR+J=_}Ve{#e>x#mAFS3e?_KOi<8Wo3<*>WTR1 z^OdI@E2>&J`+^GsN$IF)0&%}ZQq%tY9PBffEffDyDM~J8fxVBfaSEc`UEfpp3-Sko?-&OrtcT6 zwt%?R<0R!#Tf#e^;;?C~WB9H53{z9CqDqdo$LSk(u1(<6_*fuT?osFTu*4Jz64yq_C*JM{Tg z5_~z{0ROkv&B>Td>qn&u*@+W7H|eVcmYz4U${^Y#8htOlBkwRMUO#ou8~SsW9~+3o z^htE0pzLzyw`Sx$!QAgz`ow!RmVm4MdQTRLj~S!iEnw_K-y^=|<`8T64H5(!GkU2q zs3gq;6*KUy&S@7>;mH2@R1QA_#(=lOlZB!D*2#vY{m&R?aAnMxc5zHtMr0rJFmXl) zO9>KWiRQy#BAq2tLDqmcCaPDj2?P%7yYha^9ppK?Vfy1MBCsUD1!c)}^av`7vN1J| zq!k#-Y+TR+BgnL|N@lE*QP<>~EzgxV!LTvz8^r~=7!zM#tj>4-bfL=9tSSXyNJ^+8 zmoi^B3>-8fPJjv`C`x!c!u9W9d|=3qVH4hmZ_1(31^Q#gIgoV)y}X3HP*R?P#9T52 z+I<#2uvy?rr(k*{-r6@997fFv^&1n+0ql)%PrZ)B4swFzt90y9enhHQs>Z?h{rPEHWGkB)}6#2hc;q!Ov1C$4iTXv{1}c>v^Ho&tEh zVyTJ^iCa4=eklSDW6%IY_N_%?*O!2Glf&s6X=1sAZ!n(L=y^5NM&(F-&2L%T0@mK|AaJgFHtncxpN+ zC$BBF^#V$tx2zXZ@R;dU0Ly?w!UJE zcm>{xIh8Z>okpge#H;^+MqpT!%CbqVoJY6!?|xw2Pf9^ zGE)BE8MAn5{3NK3zjL3OEo&^NwkT7mj90GT`5&52Q3|xfamm5A31&*^+6c)lw@947 zKOYd4h>6RRg?0NH9)G{in_H2Z^_Px^9b5B=zf+3Yy-_6YQ_<6CT3hkIsNHuJeqrT_ zZAEc_pVX8%_qtQkXiz-%VyEoJyHhYgSk1Pw`Ub3$DJ?q95iO0 zd&Pq3YjUSi#aoLTgJNJo;j>@$g&MvOcc7})?3;{cV{?ml^)Upe*v;b*N5MHo_Yb<6|n8RbBTJl9s&x;G!m~wY_``4^EQy5fF zhQ?73O{{*KG5Bm;i>j<`y05I1^cno@6w?oEouiBVap$*x1Cw44<;o~9?^KS(Kpq@? zG!%1hZ`AzQ!9oBhgG*R!j{Y$Nu*090Ue?iXpWe|B#jJ|mLh5q~N9eGqafLXXR}Cxn}rqWv+wqlbJkR9Z}ITnt zCt>YZqYUA4(b1W@CYz;9;YnMeP-$xjr0Q+>BGx?@h@4bSP4FvgKgAoFc;;kdP;3D% z^S>r_cIwzL?*z8`w!9Gb;vnniH*`KHN@|a*z157*+-o7ZPN?Pm$D9D}A*tG$Q0U?) znw1yV(d^e$q*{(YOE>`OH3=N22Th&Y13~fUlI|t=wlU3G0`!*$>&6Av;W=gD48_ht z=uog!2ak+EdIjx`e3u1xq+c@mZp>Gfz12Fyjdhni`9YoK#gD< zx($>l#j%KpGBKtFZC1oylFi_5CebdBp048frkn{+dW>HTDuhd1Xrkl2=Dt17a<~(h zH=?Pvx9rfK;}7tv$!xd4HGs`AdnUTePOC&uwswM2U}$Ey>_$ww zeqvI1F+1FX2uQum==nnsZNv4SSu8cirEG3IorT}!fY=J`E*Ev5A}%Ph-zmjHhNE0e z%dIK^({s_|UWlqcakn`DW9*P+5$ev)k&IvX=BJ8$uN9mNOZ7|0gz;8cb0Afp{gl! z@lOxwOUp$N?L|mmH_@+RCRfy;6fNRJZy8iTk_7Ux3_g6P?0Zo2mPR_=oc-hgh<2MUbW9#QD9BkTo5h}C2JpAZ%Y4y3N?>j z=D7nPJ-7CvGu>fG({#ReXBstcPwi>kCyQnB_m~~IOiJi_;3mfnhR)&!7K7mj0IcHx zV7*PCj9=2LR=eAf^zI^?HKtHmBhb}^y2!k|);elOu9+yc7XD{4S3knDwuc+)(=)sX zMAYM|zv%svOlbJX^0>38E$aMWhlkcH>l108-u{~wVfb>3&x2C~!j=zPT1N{rh`t6e z>DS|k&JclsrJHqWxc%ZX-q|-b_?2c08(Ki{GPV$qQ-RSQAvnMe{rks1@Bh5evx9>k zyFk8qH2vZ_O)imt-hAxnas7kawLubp@csYe<=?~Eesy(q)X0pl9y>)K6*}38B8|!* z4CA4c$kf`s`C1Tgg_r5yV13+B=YvI0eeGs9m8if#l#u5f-5)@cKnd`83kk$fPUtKc z!pWdkqU}nRBIv4!H;VJz{ITgp7sQ_0$rc9yn}oc90a@ukoiMr}aKT7YUVl7GD~@~$ zFBR$|pM)qoKfoyL0$zv~cRO(jua& z(>{vn6;j-uJaY^}-wFQ*B;@I1lZARpC!Hqf2OoIKaKjKwU|aQz?fzg+8tjJ~WD&1p z;W=(h|Hf3Nzsxv01rQ`Z9F@d~Myo!y?O+V}V95CU#6I5qsI)X@X|JTbe9XUCJ&cp2 zk$4P;lkv21Q^7+$`HVb=2dRvKGmS_>^U5q$U40<*f>W z95=p~n!H~`_muSZ=|JtVIcaOor!}bhhsa_x-aX~LeL{nF1Q z2t=@F;?XIGEB+|fBieq%k@h1tB`4Bw|5=wu4@dTZq-RLIr-1Gc1ZZ6TS#8uz&B zP~;{WMnhM|U7lcdXH#?SzqsZ(mRuX%IZexy*3?XTc~uQ&$gR|wZDiI>Bx0JSk{a|x zyl0YJ{hcUNmxK!|Z!V4*7_wB9Hc7a3CtgXzT z_#N9Gmy0SHb7M$WJGQJP;)5zpq}M%CNxFdlN`@EEB&cdN{yyIgTC!%pJsPVt#>Vwt zW|5_sq~!8Ud7lA6@eh9>Y&0DE6mR@?g6OEJuQXJu+m94cbw7EjC}4!;f?ik;q7!PQ z;-P<_iz}9Etw!O@y(XZ1c>Bh6s70CyXJmzjDwW6fq}?{eiYQ_yZIYB55w)EQyT}DO zE>75l_ZFS(Zj*g#$ea9^P{0phF61UM4g}h3x89QpxjuDfPW>K!P^;pLd`Ve3ISlGT?qm%PTkwwyyOVuox7^T+14@YqL%EOl7wL;w z^^Jv$Q+ll>3xvb=4i@=mGjXD`AqlnG35kth4XT4BNLweBb!Jp9W6>Vtx088F>iuq= z)E*I!OKdW-q`t=qsdK-GnGdJXfhO}s1!-w{6wJ)?yuEHluIPWq&{SE;p{nC4TxoyS zhc*i~yJ*5*-c?60TxB6%p!eX+L;h>Q0vCUQ#IPmJCvd`^|D?235FOqUxVcAgO{Mb7 zxt_<_=KEAK4?%jsmGYZ|`u?NgV(&7K{l>mE3ZaIOicjgobB_2%2-7<5Y3b(EQ|k@J zTMzezm$wJ4&x7{X80HBH!zy<2wLxb=!RT@5BE@hy12;8YC<}t|ro5~Cfe3xT(YRVV z{8RIjnFhpfJ>SB4(Udr$U4!B%~_pO%U-I+Dpdl5hTV!qVZ^9}e((Pa+~d;t3z zpt(#ISe;|~4Ka~I*Q(q~`H#!Jtw-N3XyhsJs8D1GdU=S|z|2&JP&1;rNhaw-C@#T& zXJ+E~3o!aa9!kcvb>Pm#YiZ~TNu>kY=tFBtD{5oYmyY)blu2PQ){(0 z8g1NX-DX!p%k{fIT+7{qhuIReI9A|qKWpBQ)d#Gz=!mpQhDsu}(vm1k`2IqmD5-++ z>79Nul)R(T_<_pm!ASPHjM5Ax{6w&jyFCzfNq;zUO)@d>wt!`BsQUqGcZ!$Wi4%HfG^8 zXlJV>mGv(w6$W5^d|3O@t|KR9)iIBW+{8~U zsgcEb#O9p4*dD9ZL<5~*UL5X%ZPOSSyNYKd$6Dmlua+7^CSUo*NFm0mzvLKPJBB8S zd|H-}wBnERmZ~@iEkYD!#us538s>0jG+W()kp?iNggz2jRhW|*2mBw4Vf>D`&dkOJ z8;4GPWkMiPKlVONBB!-mwh){taXboVojoxyD7YBI&74`9vXegzyOK*$_`z9{XOD|wNUCI=$6m8=ulNzVn$;w zQ`1IfU>?8lY$icu^PB753v~^kOQC9h+w>4Jd@s+be)wVE3K*^G- zzp+)aU&ISa_1J2$t^!B4t8mtTJ!lA*2Zs|8PGZHX06Bh@RB;K_+QF577B1SgeQA=m zV!ipZ5fskcPO4<>d6nBMfGs8)lfNC@)FXMNwLe{I^)=aM5nkv0F+TS4(rWH|NnQl` z=8xGOzvokSl8JcvZVc1nLY{7vBH;&2P5PT?J!o%(JPL$clJD<#4o`3vxz7(fb`BKO z+)s^n*8~AX1T-gksA*_uSJFK*?65~_eYx1CUI+d)aWps%?Oi1B1P{HfJCxktd)Qxd zaQn;aW&?rKoKxcXwm+VzWAeYshD!nf$T(dQ&921cl%3NX5#jUaRaJSuQ1i0mWOb_01}Wm~4d`fi5a>=mCU# znMlXyjlwH}f{h&ywByEDKE1gQSnT| z-{S?;a658Vx6u0l?jK5>LhchS1O} z9vYQZxfrTeW?kZC9zdQ3NXe9_W$_=sjw1KJzsM<%YH%w22=?8J*o%pXn(G04;WMOh zdxa#b`^+Oc=JDXd&&MGWIp=0<^xKWOB;o+bJx1Ewb;@_-t2w0edZS zeapf#VFsJpZ(38 zZcO@w!@zytvDBm6Kf;-H8nOu3QvG*_v6V|zBBq%v@cry~y>9DX+6fR_T5d?xkWQKt zedN!Y+e$7ex!f@MYIoD_CtIgcPj%9c_^ZV?bLsnFae(ypP;ilZx31Q_t7~t7nP-gs z?bi4To%OFE%l1r)$-8pzVX6LzIh*ntKkrGmgxh{qrfF86W*I(Thu?mfy*;7wN;CfH zN17%Gb+a06*(p487q>V8@~LBPEj2D#Ln5}TEOqLx)QZG6!S*5+j|LQ=cmy+9frIe( z*`*Z};yZCbUEHsK%0Hyd;X5vBW-JK1IRsG`EBW5@7%v6YZhzZ~_a?e(Fou9sBDQ9Q zGr7zh?j$Vrjz{@y%JY3q`+2BT)I-Rsy-63nY1Pdap64GW97(&oAhuXLBr$M#J+F+n ze4`Bkhmp;EWxFGV8~DH~PN*GQetZp^95Ff%Gx&LtQ~}HdI~4h~Khu>NN&%uv20&~F zdD7Ff5kFWVyVTEiEDoZRFOr8R#Nb!kdp*Cvy6xj@|JjNJE}9L_PCt7ak;{?NhitID z?TO?#M8u*y5#&Oie>WF4ilHZ5&BCB+BU=A`?$W><DOJshu^h@j=D0pO{PP{69v2Iq%!Wx`9CRwGow^i`NO1}1?bjD*yV&u z(20f&_GcDRj%@=%mH4W*@7eH%(o}-I??SNObNoP#Yxf*gk-TPod4TK9BC%8=x4iKY znbDnx(~JiPnO&ie`GjmJT?F<#)9uB`Jf_qBJ@M@zLoB;=&%|4um9_mR$j+1w$JddElO=~Cap`Ot+FvNbd!w4q)mnR7pMU(3 zHD~H}%|A1%+|zrqNiaX3!xK=S%9o_Dlv9K~X}MeW_R`-C*;%qY4NnTz(CaK^u zC9)hbdl0f_t=}A2ml{=pBQL*)pKdti9d0zq&_2|Mw)nQ1)oRhm=Z419Qp(<`E1{)x z(u-3%nE$1v^aS8%2ZlOxK=u=os*JGQI}lM$mV1u2CB zjYzbdU0}}xegE5e%(k#Hx?e3_2Ry!N9lA44FYqFfYckXj6gWM+%jftemngo-we!j3 zI^&Y4Ax>}lV?%5rl?-VuvvwY+i8%I2^@`}l* z0aWKB@*z93;!Zc3{Or$kshZ2>O!W9xu4Q9d9A4v={2DK69cjtLC9fgBOS&dLHF+;D zK)$sHqjIOgPdA=M5igWr!c{-XE&5`4fa7xQWuiJK&{cVp@1FSy{cPg`~ zd2_Q=QRB>P777%O48qful^wpnv?5$LUWbt_z_4|#O>DeBzME&uAv-oxFVNI73_qk( zaMa85LEttb1z;+cG;k>5X0q+7o-MV6gfO=TVk)AL3Jr z7UboVN>4ObH_6+1=2P}KjHBM?gjCu!#%9uZsf03K8CRb)@(UPdu--&eGC4iL!jhX< z)nkl_E~$w0p>myGKi#4!tF`{danLYi&JwfIl=ZS$-ym^7L6Jr8Rqm84?a*B)M7hxlsWZbafMx!CRGzeyc1(80g@eQ3gruY8~LPkPD|625!bq}1>%O^rq-sq!Q>#~YW8%IPfAgLaj(tLCon zFWvK{e(`BkUDmJU-H1%HF_$c&e?mj#>z#G;K-rtI0JxdL>Dd z!wpswpjXZAZ9unhjLk)?zb?EiJA*hQ73Yt3QMZR-y_N{A59QzgR0ri zE?9wJDK-~Y?x~JtH7|5=(g`rlv;-5IMa;H{rr@P* zsX?uvgwB^AKc?X!b>AWV5<<3R>QgAU)$HhGPXt{Ez6Q$C4Bcu@hUS}l%`fF0HwAu_ ze0JiYa^4nw)urELm8WEtefJaTg!UMfd7X3Sc1Ob{lk*k;jZr8!^m==4y}&E)R##$T zrxsG)Twtwp*{X(mKbgDT6rgDNu0RMfncMrNC84f~!{aYuB@1uDWuJJpurGQeo0`WF zFu7onuf>*3KJ!`1^K3*dFH=WA@ydMb)!_-tJE2~U*m-+5+%IubH!ZkaA2JV`S~tV| z8+B+0W}nkMSFk%yFT%e<+J#2i&0u>7{S7Zb;c`N~F)Uvc&Hm7g#wCcW z24}XFiG;92?I<==@pM%t{SCM!4IVzUqM3-;GUJVn;gYvtip{Gjqfdv3EuBO3nSvB5 zpU#lRe)i34{yjaTWvo3nmeXL}73hD6N$%@8Dyltt!&;VDs(IO6%HILV@+@YE!Z`KG zyM_iCM{{+UW{;BH8gq)7x>+<~GZUQRlygD2I*k2&jYcWvJ$~(#UJ4dM#GzRU2niFp ziR>0Y`74@sW1z4OB@12f5yosDvFWtS9MfVhW4^|qEF`2LCufp=o0vzC&e^XCs@{BI z(BZ7_QJPaRA72;N+bFGPF|6Bj3dpcV!DdHgNI+%jdxPs~Bb7EKzGaq6Euhwv6Il3= zh7h!e;C{_mv!vcEvndo)um;4K0%6Ov=V;~%GMslC3SH;vdOUvFxdfU6b47wVssSzP zcNY{{pR!gC2-4BP1vPDVk;?P9#$S!dL)aV0Fyz9)$t{+!0`iT5yynpAIu)vH}!;f;^uv{)ltbDl`1I&bs} z>wUBeC@{IY180uuD6@W|lmf+ugCQOstU0-55hIgWP9H z{E8%3Tk1XWbHuV@=rR7#7Neg>@f$(wsJI|0^stL1`BRVe_TF8qf+%@ggl1g1pTY-6 zkHZc#4cFUZ4O8*^FGv1y9zZ6%Le(XJyA z6olY9a`HPL1NTVQ##sA-ZbYS#HwhAzug%e08RQPn`h47OXyn$bQYR^!G1aKByU%Iu z#xsJes+#jY{Q8R7t|>8j7cey_UU|*6{P7b)Yo8;l{yx&I<=_bCmYD*yJyVzMw$x8A zLwfMVOkDX}#HANaTn3PmmbXh+($b{9OR$2^&F$@GVq-cJe`Zc4#H+lCSM8b%o|)S* zTQ3Itu@g+q&aN00b#JWK-qA`xs8?$&z@%S9JV{KD9LiF2MY>c(ofM+mD?If1vDzVi zERU7T>Bg$2pRGVUpL)6|eoz?Kuvu;(z*j zD33bh5S+?IP!6z*JQSI3CRFB`Q2EO;V znC>rt<9p=d{{LT+^57v0l$bO?nI5t;fUN0{&l7RdBX*S^kS&aVY5J+LRj*kgOyB?RqcmBaQI>OL>Ex{~WY zrA(T@khR45ydp4e@)z%;k{#$zOvp_HZZD#cpYxrQg^7yp>KADWqU(?%6Eq~|edUJ2 zDTD2Vh6>5>Y^AlWU|)yBk*$ErJ7hfVElH%h7* z8(Y+Q3H7i4guOAX91Co6S1b42o8#vdaE`TPSH4JHtbI~!j@Y)?hvuc?b98oWGwVvY zHv2!Mk!I<`datF2$R&Xb-#i+JEf=fXB6IbQOt!+=N%SjcR?pvseRaY~tujtmTMWrM zCnBO}pV7)3kJ<~xatnVZgCeyKbuZ!$ZE6ByeUL>P!^HdUkSk8Wu@s)46#m%!!8vggCzf2>{eqiTVyE2HRQhtIg97Ey4ix4nb)qJ<{6R5_ zU6AXHuEp(uOZn8nuQ-|IT3$0NL@f4e60l0=%nyrrwd+~T_8AYY+3=)>wc95{-i7Sx zkWA% zy$d7XiFhMS50iHsz89JOm0M_Gx7uhcOirV9l{qEv; z5Sn|#FzXr(32&*${X>hcW1yXiSH4{09xFDCZSnwnHm5Mqp*Ys+k%i4Cy#I_uKpKIV2*nZqjp-2U~{ zeb|`1p|Qch^ISF}@8%-BeY8Bg4Ga-v`B4sLf4E_pcD*i%OyowJOg6$?t}H}e-6OZA z%G=QHIzN`2WaVcXrvpunjpEX5FiBn4o7aa$M{hQZ-c9F*0p+vvp6kMNNio};xFey_ znyOB7!9t7MC%@g}aTRW}BOL&c{C1pjz3m8i_}-S0zuP38Eu}ZB^k=i#ts2&RP!DH5 zJhAy2TP&dIu;qgZEeA+9N*d~zd0bo(G#_#F;vOd)q?B}Onshw@ugnk1Bn-7$=m>qM z9RZ<9xEy=36NcJ?1i?Iaf~;Qd4eZ(})f_xP!GAbYP?h+6z;|tMpzlY?#{!?74D0#K zqrBq!^PR@-wVvsf&536K`}DO@g-`qLfT2$V{XxVn5Gkys?*6hI3f>+YmHRzjjM=19 z1T9fSxUKr-yDJ!cBpCanw$cyLDqoP={dhfR6buR3$$@BxQ!Yj5cs2BG2Ph&mlQCn(Z|J4b`}L|gJ?C?&%MW ziB$I*qvAPN#Vw_~g-2vuj2F*q|MA_Gsmy~}bycw{z|R=B2UD}`BnXiTq0eZ}A zI=V0U_H>=u9S|u1%3?_agM_k#Il1~hIt&|JhHfykl_xWZOUV*Y1`Q?Vowt8JahDAl zGB+L+moUNPAd*$HdzwrKZRIWunw~N$76|&^D2u6hOFGUDr5cR4p(U+(d+`n3k)Oyv ztQq=oi%8MeWD-_=i7n;gXBL5bPp9h^IMUG-be!zbYyJFHPNcy(1Ev8~uO{R^YJLVX2I|*2LkQ>J>AchsLy?LvS> zF8#)0{iz2ZJoYed^u?#kCrigB0#1YmVc^w~mOu;83p=OV-%BLwG0+>)HCH`h?f91BlPaN)OM|#uwJmFfn~SF&5T30M34MDZYocmiC8I~Ou5l$Al-hX$qA?E^&XCLA(z*p zx1^KXdIH@M?sU}`9iXX5NWh@l1Mm&d8VkPJEhTS(1Hu;2qW{T2*bYr-?Ml{I;a=Kq z3J=L7LtH>{^ef%xx2bb$^#hibIC$#_g%wVD>ebBP2i%-Uio3_ScmGe^o3OaQLv}Dx zCmrIBv#~jP^Ddyaocj33Nn*CpgIFQS+cG9|#Dh2b5tml3%%Ex$JCSE@=++CUrJrl} zk5CO9no^y2)zLP*xQQp9t$k3MBK$H*YH)me#$dhKWw;%owyZXUdcN=VTjYx8(+vAc zv9KEQj`s8hOB|7qPD>MUNl7VDP*uV;PY#;W;vY~D#0vCk+o`n~?`Mh7{%@Lsh!muv zej@oNo%zl-Iz}Cy>i{^yPe>&E?I&v@-ntw3&gW8_uFsV8OuK;Cdm|LU8bF&`se2Cf zKvrAoPxc281R#A*Bm;F-ya2$9EV`UBD(fGtBJpb}1VAc}%tIjRf7DF>En@o5K?Z}) zt}X&Tbv|k7;u{Mh04(K+az_j#aTWfs*%)~4c(}M<*bKXg1=RyZYNR3D4PO0OtP`F!=%N5Cp(T?A!xLBsIEf~lKa|AG5vhRs z``htne%1SxI`8qjL~a26>nnB+4%(FuZ(}(@T~2QwcLOdvG@eDziz*x1-hz*Eg8Ale~urrQln7Zq0p)t|(_FcKpAS#_$#l8Hna?!9*3`*O4#%ZztavYtf zcjnGWL!yalD^g04#j;vG7I@(2Hw*z=YDB%(X-uzQsrm;i0YI6n;t%ujn^<}X3JQwy z{nu_~9qdo~rU8A9^ZNITCK`_EdtZUP24psmS3p$;Ea8b@RwxTz4f|wlE&mL^Einn~r#~mc{yFinT>9IlGx&ej?{{%nI5r+0 zo-T?(E;F(raxmP(``scS4ri$VHXDv;kk*nWwOq^$E)gOI`D;2zpEyBm!!WSnl%c=1 zWKv-4=R~o3__s)JAZEbLyzs>*fcXAz;>Z8QjsKT45;CNx_3DxFq^JME{rBUt;^Z2S zPdo!Z1-y_`zHmwr?!cRigFjDyKSn@Wl1yZ53OZc5s2_mvF*b0KE+8ZX-5QfKi`|jO}9<^XM9K)tig*Oq0wpgeL^0&fD`rIEx|wI z(0PKlfd`{e=IfR8znxPo7G8R94k7T`pJ}eJJ}Mp+4c@7H<$Ws=dkmn;D?Cu5@i4lO z@%tb63r&t7Y1|uv`O#iuIdix};tM6>gj-e~S2>nJ(#I-{z#2qrN5w(Tv%jcPpK;uLIPy);+}Yw+g5_0*gQ z$c&}guKn%P*?94Zlu%B&15Z^}T+W-P&PAoY=;y0geMMKC;hz^fywB9IKSyV>_z%yR zMKu9182bO!^%YQUJ>S+fpg1k=P>Ne|mqKuBihF_LE+IG+_m*PCOK^9GP`r5Y;_gnc zpf9w)zpU?jZ>_u5y^GuoGkeaQ*=Nt037)#Y(s(pBY37C>qb$^mPz10JNLY%sf08CyGu^p{O?7F{X3C8-N~mE6t{7I$}ahB_u80iczI@8 zHgZp6@wNLyNWoC}>>GoAm9Q;2`3n%AHS$L5y>i=7>DzQAH4{(Iz{Q5FORvo#YDDH0 zZ&;XoV+K#w*vl~aZJw;%jSv@4$eTYv@oaI zaz8}El6)d>KvMbeK(S)FQd|JeVoRP1eny693w`I|hnKiH*1AmCD-|j=dNRrjq>Vx4 z8}A?bi24n%`>Q=&VM{C*o3K|t-|}RR!s=u!ePss;Di<&$o(s5)JPb%mNm^d6GOv8d z#&$^(7x<@94&N9|hWq(&YhbZ-7AGSr^=>dxHnPthzro3Cg6Ei;nu;??**tc(M$87K zL3FDLOWgsaTEe*;RxQo#-!Z0YYPwDXdjBbuLBM_UpNvBxkjgencoBs|IHB{aQ!$e#Ulm4Hlhn(GiJ^f$zf4%Xr!Rqfj|M&f$PyQ`& z{7dTiU+(`FLH?=AzpC_K_aLPQNn{W)K_g74JUO5K(pHgO?ZoL*geL7N1+1yO#|^Hf zvyu^lJ#j9A$m#2gJ9b0tkS9)1+KcF0khp7R&RR6@4-(OqN33eM2yzECmGI29+>F?6 zne*QrwpN-@Z0=*)A3DMf1iremwOMCkE?HS4fmNu}B-O?WgnW(R>)%UkKtXczxB{C> zwl6Kj=epP1e)FG&Btg@OJ?~HG({5fNFj0!@RaCp#nOY|0#OS$eh~B*?>nO)DbTRZC z-- zGqo4ic%k>Zl6As&FB~?zkyvh4@SpL(r8SzdDbqu|wKeM#KtJ3u$1JSWE$@(hW-GDH z%jVkjsnhOLem{Pzlqa{LqAWn7+kG`8RBM7a$J9(MbkMxf_KSaAZ#eF3;P-VR<#zUi z52Wi0q_Zmi%m)<)X*77Bk0&0T6X)&y_{V8C^ zd(iaJDOt&L-~Z1Osi%A18@%%1DMFV)VL!dSv5$56o&mr9pg03_$xwtp6TQpWej~m4 zuGYp~`#4>e9IMsO@*BZY$Z`R_i|bY4EH*`UrV7l%Kl4=jz6?y9)_Q*@M3X(H>UxJZ zipU}P{d3_(mFis#IoJU9!6G$y9JRrn@3nHn#qe*JT98X;vh@^R#^HQKPzwm>K-4>V zqWgdjq7rfCQ0)Y`CGh^@b^$GJEK-=)(<@)uQLph<$yku&(Us|3Y|4u?Uo2b2(Gz*3 z91SHBH7P2tw)jfp?fv{=upn7Mc4lS@McS_}7F~W%BQXnAx|;ZQ)LdVb+iPRHxt+!i z{H#?5y}9f}Eq-2tb@(YgfAS+LCsznHgGJ0Mubz;ocg{cXUK@%=-78s!B&Q`Z4(r1_ z$hnD|o=qJZb{tYZ_&qcN!I^OsY_&+m@Gq^%4bh$s*Juffp5%9D^nKyr;UB>k#~nsw zcbP~eSaUSiR9CQlkLScKvJAt!T7tC=Bk+Fy8^*qPN(LccBufY{2KL+i^av0|maU=B z+FQd^r`^DUQuDoAF5a{hp$X{_^@{M}3g)Ko8hN0;^7yhziB*+*oSEOC%qSj-eY>KQ zkC1Z=%(wm9Art51Vke?E{?K<3dB#mKp@YI9*5))EmAc-&)msVyP|-jxtp^eDJ6+$< z92s_HYmS+Bgx4cyXHQd^IG20qsGhbKzk=D?FU`!YW_C3ElH&61Q#37|E2@c7 z5BJnm$5XDMj2<|QYkVLF`YFF4;3?JuG%c;wA?pOZf2uKF?fhfPC<%GJj0&;YU`%1j zM)&FVbgo`$Sl?&itq9ejGmOEeIeyFr-|k#4fnpSRXwgh+3la)q(M52a#5P87oS0Q`8t%?AsVoV?5hn(4WCDlkhS#GmYC6e13gs zicPXY^XW-iSR;ryB9I3dpR7=Zn9;>vOlm+c52v|=JoNLX9v!-Jj z_?eU+Hz@XFteaHq&U;|#20t!r)SUCg<8!1oZVt1ufN#8IdhO@j00wqOL2GP2 zqR$>8KXE0sxp2E9+Y`~z;rSm?&f9LSVeAIF`1aKZ9(b$L<+!Sxs$oNa=&M?B>-4eG z*mIL!>DO9ThQslOw;n%5NW~#HFuh4b3wOe%opa93fn1@RH~yAi_Hf|aQLt(d$>FQ* z0d+l**uaGeW`;$F!ifs8+Q6QbtAKll)jq}n(#020o^JVWxaO3gMeAOu)Ai5F^ZcE(5hN;~Ptax$&~=ex8>+9&~t`Lo2hQ2uBbUtLxJVA$*RuXL&C`f;#suXpnj5SHuGAntjB91R+?$fL z!2Q-tg)t9As-C}s0Hw>G2uTGvd-2rra4m3R+FmTI(bbkGHFd^(kYF!4Og??c0ag@- z+K)TFIMkF84o;a;Z%*TLn4ws949wYkt4q2vEVI?00oA59F^j|yQGuc&_BeNU7l;jL zJ+;)LServ&2GdfcG}4&BoT3oZnDsqW7WN21?r0l*+?Lt$!gq54mc%9k(#+@t$+7W1 zmaxir^6=Ky0AvmnCC+z;}O!m1HgezA3><>UGXunDb zE{3Z?8Qd3V^VJf44<4KcVvreUD`#!2&ZX&IT5D*ITQq$`l1S3Sz8CrYx#(&sElrLE z<8Lq%{<-#!A7i1Nd1ivNIXrZ?PMa#Omlj$w`F)>ZeVFFY8q&XL+kf5V z@5A~8(=}S2u4*1Z@Hr(sA&Wo3iLI18NE4$g9mZIHeMx7m%#|~GMgdN!S@dHiJ-7xs>S<2DV^s(k&;KfC& zsR>QCtJBlzrz~@`gz9GT0k@~(UU)4E`yN+)Roxd*H_t^TjN29poqf^o1m_ob(4*vy z(8kuYulie zuRVOk4l`%?qCvcM#@Vz14)B9Iir)d2Jab(D&4kMYDJL zsb@OC*`5cudWX>H+|4v*(lJ>WX$~kXL^XZ3GwP24zc^|=jO(${SH-qnt-OmiaIw*S zRyLiBF2916^Znw2yPph@ z)!;_t=@Fn~J8V^4u9ER^Biy~nc6jp&k7ydWZQ$!*DXF7=Z-7Q$l%ykqNvnKF$= z3(KBp%vRANArUcAQ5`tBlS}xcHM_!c@d^WomOVT{oLlE2t(1FA zl`d6Zg?aGg{kf2hHp@z4a0#&GozIS+aH2KMEQaplll_hfzR4`q!yn*D{=8LFkwwn> zNWXe-*;dd~M?&yw*8Q`s=!_Q5vYf+K+eiXZLdJE|t_0pjYI*A<4d^EA=e>CA5|{?F zk4_IH9^1^+EbT{jlnBtPnNXTSu(OF-DwHX5qj`K>@>|`lBzKxN1*_&6->I72ZaZlA zTs`jFQlj@;v3t705U(6XUx8~>3_)Ktb?2AvG-n4vORwjk7P-vF#>!_BCGHV%+r#Ff z(HHFL@AO^Txek5SxM3<2u}Q$t(eMn4&>5H8@WB~w5y#;MG2+(eMVH!#n#}suW+noWI8^hgG5MdfZuFpt+(5m8AGR zA1+dUx@drQ7F9+wzo&0 z`k+}oUwU_SwK4eV`5ZU;W?9~<-ijd+-1hsy>U4c6YIr2GKbVb7mDRANQS^zgZuDA8 zuU2gi?M|72Eh_1o8etC^dt4<-IW2-oxr?p^;7zsx-Vx`<<>PriypnqB{X;QGhRkkx z{41YI73m_q*}6nFotavZ=RW(zVjtOv^o zlQxX&t{&rPoN|sci~eZstMkL8T90&oBa`bk?!Hvkp!DXP|3*yzdQ6a#q>MPSWYZW4 zC!6ME3ot@`MLd7Z^#oWs{0aZbhyRUMaaZ|0o%FeL6Gb3Gcg3&IYzlhpDs{=$i zyc~E3!H(v8>HOn^&W6va{^+v<+_{mDa)x`u0|)dtU}M3X)>HqBNDm@>@*Ko5a|}N3 zWsG|=`_{fTreM_kF_!L;q6pIV+lcV3rnAkzAblM~hxzQH+;6V~&316zz*BVk+uP3} zlZe?FztuseL#m9buRF!Kc2rR%>G`7QbJ4b|e}e?Kc>pPQPe#?%7&H>-N;*OBv2rws z@du}KaxAHo1|FbZq}ZAmyDZP$m#juyn^^c z_g)&$b)DVjiSUfc3XAop)ClWx>~!h~7ns)7Q{(5nzD;IpE?1SN{nW7^v2n3pu`bg9 z%~+KI2Ik8=g4lhe{op3c(`=jt-vdtG#<2x5^l5_@_)(6NG%I|}`Ns93dzk_GDAb5N zoKTNvRPxZ4Q5*Q1?8Sz`uPzz6=+xm(8l7LA&{zM+Z!i8T(vatW6*getAJG@WAc05yAb9@QLpaVqDqQH_ul%QkZ|#3Hy%+yW zA%DN}Pf`CV;XmJ1yt-bz_c651qgpYqGJW(vVmd@s4mL4+NiU$CAK@0HKt6?hCxc$8y%O$1~8iERm%uO0Gu|Hh? z^hLkNEr1RnBIqu7V2MlReOsgfKu3b0o!m4fI<$vyhU4Tsh1ku>iYN8-WzLx#$ksas z;G8{@P~$j$o!+H`B{7~AmzSfE@`#b=ES*yRZMrW4p2lJ7oy$z>qY{e9r5z}d(^h?9 z`DS%``DzU5o9YX(r2}nLTcMUu->O{{e(%o`Yw=(4jGveIapGGo1qkS>%|`0nGVZ|L zvuyBv2QFEMUb@0Iki2G?pRdo)y<=aZ-D^tlURG3zkj|KlT3R+hD)T;%IEdwz6&5K~ zP*lqu8$Hid>`j(!@t&<79Je^NpTeV{75-JN?+eJwoo#u}@0r=F5;~e9Q#)CeI4M1* z%DhP4)i&*Q2&`q%FoYJ*4DHWax)oNVoaf~T%q_B;7)s)UvAM10Wk9Jqjz52fO5O8D zEiVJ{%T(qd@`NQPmfVAAuMjkXP-eRTB+9S02Nq9}_R~fB@SC3Qh>>-pjFLyGsqrcM zy=0&ma-0{FXG;p?w6lXrR?9fg`gf0 z|B%@mD`P9)`n*@(@B4(k7WbN&rrrA!^zdm28;R&WSx(Z;;bfVZbgbaS^7b)*uvY{1 z@McrYZXPhyNzJvURK(0S`IM7M^o(icP_%isp>{_=c^5u5OGuS(#9E)o65W$w6E0`{ z$|Wx%Mi@fzHWZEYH`#u!G?lTH5H}@J!e)xkpr76I+YP>KGrg{1^s7vdfZl|1@>s#P zy8RD;j7Gol2*>B%huRahf{}WWou}M3`qSv^{n$T6rx(!0Tlhp}2D((gUAv=)EYW=j2;umX_dtcAfizOs5S6#d^TYEuz@rm)~ z7PJFNl^GNKtoQOSovmtYO*(Y9c*XEw`3mLW-7rxuMZpUUu7I*Bf@Q4w^ zd0MEIuI!xdCwnbqv2pm7e|1CXc)4FKVgS9{Ig?Iz@_LK1y zW7pLzgU5|ywCwHx5eb|#9r(#5C-q}gRKr5$=9~KM#YT|2p5!eHY`(d}+Ibx&E61Ua5NpT1SGsHtgLE(n8OJg-eaQ}c zQs3Ef%~_?G_EmdrQS}+$bjEm6fE$L_=7AK7&mr>l#P1!s3zc0ZuqZ*J_F4v%xN&N^x(#S8%7U&f&W04F^2Z$9EdX2N0TX9eix*FPMy&F65?0 z6zxJ0gXn2g|tHs&`RO zFCW%&vywK=lO()<_M`OT8KA=?vFYI$@B*8W~>QB=$DkYwR~eYkQg-?NX?UrWke zSB!bqr(}WN9ttixpEdC{QlFEHv^We&=YgFu+mwrvk<9HFMEc`9NV!tJ zzfC+;>wl`Ia~YOfZPeEGO#R!4bam>(FQtQEaXD3=g@@I86Cz~kyO3Od;IjM`dhq?@)q9u2vYMZ>uVd<%Woo1Y z2%#hRDAV+X@baK~hqGsN&GQl$jwDJ|{y%9R;^2p&x}VHok6V9Jjk2}a$*n)Gs^R@O zo;hV>b=A3y{+g|~oPR_`;ZYVRIfz@R*;wj&SH9OrYm(=~`%gSd{Rv^Yo#@vrI6S_0 zUX6Y>*pRrC`SrzL^-h|pHU30dQyL{_Bw)(Ol567_A1?A3Qo3-oUUQd>xl~Yj86v1#8IvL}(!g~#hi(Lu3NqaBI1b|S~|;O0B^<^t6UX~}10Si^Q-@$8veW*VvI=9wUet-h{>OOy*^ zhQchKG#m=I{!Ti5KBu;`&knlgN3v}V_f&d)R+;VkT`o1x{p;*SB6aZBPs3c-t{wAN zOoc>h+EarVWb99V>n{EqZSZtRrcJ>Pr16%wF!8i=ITB<3T34(Qo2juO%cw{bCq6ls z8H;#3s%6=j2VozZZnUAsw}kDA*q>1|%1ytji}1 zU<#T=;gdsKkZeTehq=F)z0g$PO4XPBTKKN*JjGKUKiOhtmpU0oME>zz6e~{6hc{TAgxE3dGmoamTU(BzEA22_^B?{-ovW=i9-PN;~R>K=G=RBV!6w+2N4|{lH=_`=#)hLl_`lw?X@Kc@$?ly zKVnH-&54%N|h!eHF+_6=|Pix!d z_M{MsE#=^-aZ$(~{t3mQjK@{7SYd5RFvb}uSG^cqPNKFtUg-*Mb}(Wvu$sk5&k64s z%i|P0zkSE3yWt=pVl1vXA_FB052urBuo>ODIC2@AVNfl679P*=^d9;CM_>a?ZP)8} z84c65+jloh6>h70P6?@~XwW5nfX9!zO1^MH)=zy<%;ST#q{5@U)s&FO!!;689Bvk< zh@Hz@TyrmZr7(=IK2Dr4Pz&BA7HvhO-;=DX&7Db%rwTZ~`S=rO1nD4}4G|3%K02*y zy^W#`gycW@luxUWKy>o+pk_(64wp^|TWaf6ZcD32<`a=~eQN2i`l9F96)Z(+MU2Sa zNA?3~X(8}Tu931Tu|ghi-I{3dKGic{eE%BUlFdJ{62u3i zzGv0>W>A{1TgOJHl$_1IxE{zVfe4}=qLDKk$??$~1WoIgip~>U~+46bur}B8-rDZGJzpx3^bJ7uGKDt_=S3-<_yLlxW=de<~p2 zs>1J7R@0TH!FuwM?mU`){_Z}#Uj_PVhJ?$;(bl!hH#)(;ZWs+Y>g`ecNvoXv)OSG} zYrk_N6fD)s8K?K zMIoG@y?(OZKl1(U)5l+_3BG*2rv@OxPl+cFRRUf-fxLc1BTY=cFXD@`zs) zwimH=eF_vhZNHEDvF8q}aNFht#&Yva2}-KXlKGG3kXqP{Er^;bjW2z9hjOeHJ}kD! zXmEew%yjTF8yS-%5SS&+c;u{#kt^tS^x<@GTD2gaiS>LwO9p$q%+OHW_{HhrBBh+1 zT;Dw+7^Qv)7RM!@0GTz4->j)LP6ey941MF(jT{p3BuOu^-oZ7+s!QjcRf$Yq@VsOg z(5`=8m8Sx@@MCJ2JT4eRRgJe*mZBdS-sz>t;;yr_&oD744RN{~{;;B1RYA3;aEe-( zg4lo~WPBRPs8#Lqg3fDHQ(O&{x5D;Tev%&!ha+-a=H)%o39>q-3f0kRq$6=wG3j3M z^J_J@=7rmj4SwU0Oe$3?c_*_G5%AE&RGKo*Dl$ zF&DCaqYF@6PU4Hrg7qR)WGGdD2Dx(Jy;boVC#up|u2M$~jm)oNZ7!RcYPmU2&ga1K z0BqoiDgo<)VPNO!>tdp5X+D4@t1i8$+zbBqUK%taFBF37)NakkJRj#@bZ>?>xS=_V z9r}6bYrI6r2aV=9H6CX>UdM9{0bTF322ZLn-Ae|_RvBf@17^^kAt5o=yf?#Xq=T}% zpRCFCH}83|`LgRb1_lN`+ncFDM;zx&V7M1HJkcxz#3lpuVkaGx!+`2pI1}&BDn`W+ zGwVx}JwR@@8sz#TF z_g9IRibhE5Zp;zba++lZZGuL@UUcHjowowj+P+TVGKd?k$q$9Ey z>J{&|w^3XqUT}!~7M;cr)umqPq18x_fhVk- za1G-9RBvzZ_{V&vGLF;2^lh@dgSK<^Ksi+jJP-lR9qbl z895}(tac@#yqDm>_eea9W`uiFq!|X*v z3fJe}{bfM(4?8L>$jk#WwNr;4*|%$8jp2W;SeMKFafeWgvqNE~MD| z=F*Xj-{BFL`A}zyJv0oLUYUW9!yWe3s1lW(msg{}`|HK)X<`upfuvOc5D6K$X>!5j zeR}sBgriw%(Do_KmjTvfGK8n+Oo1@}EM(wGyS&h*q3`WPuJ6sUjA@(`eAx)jVJtA; z1h&tqm7ml}69OwgX7)J`VzLO8Z}7mH<+Io5+dX{I%G{d5XWx<3ANJs;@^AbZ%zNT9 z%NS~8&%KUUq}Hq0E4!`w6Ik7LOX}i=+keLNn?~V@i7VnG1LWup`GZ+ka3x=U=e3=Q zq(MzYt2Gh$TOXVBeoyCgk$d=N1`+4S(9)OzRG^xVWZa&b4>gV2Nn_SRey^OS!fFvuHTQ;%6+td?~uR zk)tEZv1LYd{uU4opQ0@2Ev`lZRWFdAI-CxWu`_J z>^%0VR9b^#D8w=uCua;%!jf(~=Dmm;4hr@ip&hN4BNf}wOXxv>xEdyzUrAHe3w*fH zRb76e|7)4$2N>f&^_xRjD6yl3GWKvFsU@Gj%FD|BLIG}Y;AZ10cWQ|a)Uk4s^sYRO znS6LZ7ZrF;em>uyui>0+>H~->bb~j&>AxAHpm;vry2#mjU#86@>x75!bd;u{oK><` zR-6!;y7}ACBZAIU*>@G;JY}*6j>zA$X~nyGdW2Aba)ie5PrqWJ&j!R*b2p(NKtnVn zel}y`xC6bYPHUsC*yphiNVICe6OT3AqA0llmmZ@2WsM;fM+z6Bh&X7aExr5=dR?c1 z>}ViEi;|m@&XYL1P9Oyw!(Y^Aqod~iUb3;FoodZ?+F8IG*RJ(T-$gtGoyL*G5(xFrWcPd21y2N zUwHqat)ZL(Y=R`_?DW$gzop`=BkG-+@Cbz1L*tFJKCqScw=cP=!=Z#Yrh%Gk)m%z$ zqwgz=UqUP%IysQxDkkIs&r0MzJq>b+xREkaT*OBRTMuMtM8xh45B->ns-m3o7@;^I z2Ef=fuVh^F$QY7&(h!Tii;TLp~C4~^-aN%CPdW9$=%rE=u)f@d+uUxBURisI z@PCtco;yf+?~X12)k*Sh%*}Y0IQ{w+=wj*6A5J(b=dVEDy8!L>A8%y&-^FOYear8P z=yTy?&$lz?rnGnONZV@@w{Uo*K?CY->OOv6cQkTxG<581n4RrsJl`6G0{LLK^+XVz zA_&N!8*l`qP|^&M`Ji-;gv+1{V8ntNex;)D>DM=|MJRt@cC0Q>7xtC z_?q<4Jc`1AD*k>t2h>0(G^jP6Mvpys4h!l;ldIDC^Hv*^{&r5jjKdJJ)tl>~SI-1* zEW6*ZI=-G}c@-B2*A2g&e2>Y-4a;`vd3B1rjrLg}fx$o?{Q_H;t)S*^x%}XYYREaj z;zpU*dyWnfM?gki2e*PTtpI2cZV)>ZxtB+C-CZtx2ThO1jUbG8E#lXd zG@+aPSwTp*>u^l-Qo@d6!Fm$~i?qcuFT-2QDa^8(n$}yQO!<33C3|W7bB_ycf!nF- z%=J0-2%H4(eiUx zryC1l7otA3=cc0ZLJ&jLl63dH&B3{9_v1+6YnCEsSXRdOy2A$?1$wwmbE7}qDMiv2 znkeApEttb_9m^yhbg6CF?!b#k_ISh-NeQ8_^0>Cul619Ocd$Dha~slY_3`hn zV^g5}vMf4A=2RN^rdKEm&^SZG&i{<;LO$xzLL~tQY-{~zhTvYVIBggt&&?6Eo6Qx} zxJexU>0Sg3Ygo2WUMjl5QLoSG}WaP6*9R5*0A6ycP|f?h9sDlTtG z<2*1=L1|%fgWmKm)*u^!L;*Krr3JNGCBjknt zgPghPX>K=6B8K!zkQ3r_i>l@zO%$bIgC9fTHJ%)FT|ZaL-yS2b+SO@VuM`=p!N zazmJ`jK6ldd8a=u@JvvXEf1b$gB?<;hJ-cHAZgvVhAju5vZllB_X6dxxYdgky77Ag z_FdhLo9$w<*pD5rlbwld*P0?w4CP(+`=^_IBvns;)kiB4j`yw-I*a zC@wCxCaGp7$g25EY$#Z4FdR41WOp;x;%(RS0*upo(t3j?((RZ`sR4<(`VveWnkvY| z<%)yU3CqcQEI&(~|H>=8$+2K|1h)cK_<4do_M*&w0LO`m2YyUH5_Sog9|$im9`n`y}skb(ih$vmbvD8T{$ zC>*Mh01L{XE5t*nn(}ckla%2G;$6R${qepxCI_4kLhmMdtkMGaJlt|`(?jSoH+QvP zD}~t_&v&5}VogT{3-wkTGS!UMYaO|M-WB7L-@d)S$-DO0jcQuj2_d;89=COM_%!!! z{x?teZ8#wM zW64hUI-+{wZj%_AA5JN#tu(G>A7iuaR2okT2raWAfYnwP!Og+#R#&?U9{)YK=!L=z z{>7ooczTb2HL7CD&HTq)<(%e#_3?aV`DTwoZcW=rjcPoXMZz%FDqH_K%h!`Jr}V!j z9-@dO_(&}laxSu)-C1cVyoCOj7xG)}rImw(_K{SKAOqD&$iTo^F}mJ7%YPPCVkR{E7Fg<1Cls+J3U~~R{Z2aI|44f@1po%=pv*6U6yjh^E3yB9 z0sSf+z@_X4E<^e8Cm$49Yk4i(PUPuQt?mFcG8hm)W_b&6TNf9JfJ+!G2m|s#Ib#|% z>FG%ELE(b|Wm%72XmTLpq-}lxu6)pG0ug4j#o}Hb;}Zt`oC$wCALjl0Nff%C@DvV* zz?av2;<3FE67rV_zR2Z>mwUCR6K6%d+|P#cMwmTa?=F zq+cSaWZj%^xh{Nse1ojF<)V0Q$al-;Ev$v>h+ENs3~y{neO1) zuuSI?;xd81&MnX(@=iG#hGh$!l3GBdOk8gF+$r|b@Lwj1s-(Htld($dZpE!CPWT2FXdrhePR zXuh!XQMmT=4nb`6HeL7LEkyS{RAnUe_{HMu7X)Sgk$WUdgV$U{V*E>{H}<{idj}lE z#EQJ0<8>to?@^mM*J6+TTnB#XsQk$5xp4cyZkm)kOw)I_Ka;bwTernx=m8aEAOqrz zAQB=*eNRK8lbALwZi$>W;(0^K1xL@Rq&IWkn)lpATQSY>Hs3yg%B_~%J@Kmj%HO%; za2e7p(Ri7oL{su3i=N&F)aPd3nV#&?)I_N(Xqy9UR`SsUKS3(1n>su9gy<>Ofo;m|4wh6M)T0f@h%qJns|T2hQre0rOvq$Hj? zK6K%5V*}CJ7A^)5{Eiwp7H_Gm^BrSG=H&e7=rW~fL;m=er)Qg{R~H(;FgTyE-z?)2 z;;3t;|1fdUJG-8#p(R~r&T2c0jIBWq4F&BTDh>_BW1Md^#>W!|KJfffRwMcrA2PP! zv?Kkds5piAI1IFl9;T5Tu6=O}iGGo5WY9MV6(ghE2b&ey4>`B964?61MMc^qTm%(W zWqorM1eK{U7IUc2B7h_m=EbizSm zSOh8}AS89swyH3()}jD!8KRN*SDPPElnY^bQkzt-R3SgD5LGOlMMar-oU`#M*yht4 zrBI;V8^2n)Vzr#Zarvxgotc{B#`ucFO&6%3p~@~Ivuqx$DixEH(k`TbG2fS3mr4yr?p$5!8PV23$X} z9v}`$Nm9cB+9>F@mJIlhixlv@{v2>_KCA>PG%qVaD}7Hm2?+`6i_1qr%bW=h;8k^8 z`ThFOwXQBY9>bqAS?4bd`VXTlFBjpt5A9`CRDbT{{{8bm2R^XkCkVtRZzY6mYv`}n zPzaFC4qFOgmGVVYK5!0;9-klz2(~1(#vB z)qaODp4C3DFSv6oI^UU8KM#)OP5YjdNj_`6_cr4&S0-O+Dr`C^ikysIor(;%;`Ls| z2o;_kEf$|~4->RphhY?FUf?s<)o)w^g3$HuFf21L3oRy-0rXVbm|@R`{t;AxI=jhG zsKsoBFGM`EC{U~({kl0m{DVPHuu3;5gFPPe@~3Ka%3mOZNKVFBvmVG0Bca?>jszY? zSA2P;7Ek6JO|f?_+kIvM;c(+m!3qMCk4BQDM77Bk{VO=snL0xdD*hcMWt~F9Naf6X8fMneRoO_SpL}v*=Xxh6 z2o^N%fwRH)Tlf{1YtfY&3zDlK5RSv?&t^(wNThEUcRwmpDgljOJJU=DCj^1U4Mdqk z;_LA$(#zZC)K}AT=;av0Ai?3XMm^EOeZd$8Mz>4|36Ymy6CvW`!TAWYBg%;t$!EbB z&|zbyU0DQn+bKXBT>}OXbK@RHLA_82)%CLrd*0P1c6s{w)@V4Yt|UZ!=+CFBhXf*U zD6@fv;&<eaod*it6u^BWf`LY+o19C)nz6R^(%|$18e;a4gU!zLMVeebIel2fI-~mjUf!g=fI9LX~}jCPq(ji|^>f67y&=IbgR<&jnvU8`ELT5EEYHwfmQlyNEVQahou#*9&~rgdX!h7z z02$*}kPVEl1>j_Y`Zp6?Kom@fI8XM|iPV{(Ob}6)JT8Nc8k35y^Oaf*h(eDvk^aDh1`=94X4 z2F9Cucn`B~d+xq0kehA~sZ?r_>3yRAeX5J0C=!#tEM(wdDtvIo@zAIz_ol(iVQIbZ63Kk6UptOIN+AO$Z$@t4?b@q&O*0y9cP$!H_0&Qxv9kR ziRJ;5Ui*1m;?M(K0Skf+qsh^xzr%jH&4(Y<8!TShc-m6t(aX{4xDk8wiT(gKq?mz4 z@!0Q&K~&KM=Umiw4%|BR*yB_-at$(-(~>gj8zOPOmW`B15RRkKu-B#W>W(a zr@R9E$5khA_V@WecfXeZ6i;AiO!EoZ`kI;t+IlM8prPZ`^3i*C?hkOvs>-?s?v19L47Q}|>T}U~lD{j>ReZ?E z_7USKf);Gmt_C^tFb<#^Y(rs67BP8`{N?>}vpe+$3J+yQJ0;^25W0R#c~YN!=cfrv z+!YZEY8Psn%OB^|j&yY0JZrGnCWXIoTD^eq`6-+cJ z166V|n8bed@fA=99H=wBlPJ7xZ|#EC{9aAxI%nH?7!3&?3CBPKlRiB!+A)t>juCQj z1}G5LdOJlmE7zLwey%O)2;cr8Q!3@?y3MQf-eT)1|L$QM*+TnJH>9SrvUYmN)R$v; zm{ta2ZXJ%Lia_A!Fn_h_7EGyxS-+{6J&t0I(iVl5N$(*Je0ylwsr!TC#kzj0siF%mq!q+J^khay`f@EV{{BW@F^e=*9e556zm6 z+9p^#y0`IWkNiRO^i{Fu_=P_3^7vnb})#Ia&2d(>^H<*r|4>qsQzB|W1m6+ z)s(nd(9bTdy!K|}k3Np$Qj%^?~9%IW1E>fg>o$ql%7)#aey9 z4iRe4&mWa?_%s^R-MAYvDQu;x8vHE`>-v!yU!%=5pP*8C1EDK6b`#FLXYAake=%-N zxBDoRYa#Q^zZUl>%)bcMecGiQQTU+^sGezb7c>6^qFrh&lDLA&4YGZEf2}r&H z=v>~m+&9+?|G{dB#d{tH5hoo)NeU5XQc9@GHN~ktCnibm+X6=h{a*xyQzDBZ!jWOyoBH|Kv z;B(pj;58!_IdZ!jjO=f<#COD-*d%{H>T0s%A^v;H@Y{*sw22 zL~I91x+%474Ela>+CBD@*^%ZwXGc+myovkB&o`U+GxO6qz$%l4%McNA?h2|K%vHUA zj$aT^ZXbJ3S##9Yy5VfD-UQ<@$7^y>*kbXzp^pV7se;07us@n^#(6elvucuLDEyrt zcMuM|lD3z6q-#o$(u#Jc0ciR(z^uYO@v=KMnOVik#}%s{6xE+;=!%JCmD~g|PYYl2 zP;)2&MfF)xySceDS)qRR?d*QR)+d&&s;iR+2Xq!jbyK(A4;1O`GdTX-@xhM`tlHLo zuV&5q{%FhApxo|!zDqV}WcC^FbK~hc)V(bdOu^*asI3wiKOv!EIegk?R8q?z ztB`|YmxP@A zZDmJW49Mez4llY^9#a8qPS)f>_Vm+TY8fw1iqndu zHGH=~EW0=GKIqWfWZN!G8q79==9L2*PY0-*>3z(A43-a0F0u)zJWon>_WZ13TgL4?$?C_ljh7)o=|he z?(`t;PK4mUvRvlyN4|IPwIXqv;fNJ7PKqnn7cvdND@&bt2hZjv&!=4bddBm}G-C5x z@AjH8v}gvX;d+_(=Bd4QG~ETJkCWq5nIl>wk1;W(r4%KLNj8wV0|aEzbC$>`mp~`M zz{qGo9|KAnV?!aTF^Jdyi|MMd7o;%au%`a8#TnyysnNejqj03bqxgeKkFCS`p31}3 zrq~IRdmN*FHkAk2_0x~8n8s17i#WD$dzk5?r=Tdm52xK3yLsDN{xrw5J=Y|Do1(yY zRbC^^*4u3pqjEMj-bYbqLr}9wa#gU2*#*hPPKRZg9)+Rg>t&PEuAk5qTlbg+_St)^)L|3)x7)R3rnw4o=O!7})5)rYINlXk=kL%ZCC+YJn7$hAdLKjQ14_w4`Nk791N%$9?1eZl9o?>v{uF#=PDLG* z6Rnu$rQfXJRJm?;SIMXQn%(cXd zjaE=xtYm^Ua$%{DAK$2kwY5fV+mKVj>D^E9?ev6jgdsZEwoOPx)Y%>LNaBnB_E{Rd zRBWbaejITbxMp+SNFI`G5G+hpZY05sD_QPZ+{dEZ&Wz1lw)4#}JABT8e@H}bZ`Cuh zIe$QPe|CIde4*%NLM7|-@Zhvfp(yD_!1IleqPb)NVfI)~%SR~&HLzcb#{D?D2F92Z zF2Sf|t#22MJ=(VnWPVPsoleTH+gSIr2@APB-H`*_p4+mnp)*2DDJhhYJN-|!bcD=v z)+#6iU5Qea4m(eKINYjx`kdP-5l8nb7Yl~B$CWY!9C+DcN`L5#*W`t9##}N}xHV<+ z7+rT4qt4uVfKsNd4-a&LkFev9pO`-K;E1#_U(>kZv#>N9GpxydeAs^T6o3DL!Ua)5 zoh$~IA>XlFOxWt{egvESUEnVSRjaOFj zf-{VJ5a{%chErqs58}^`%=XuQ)RX7$9Zp2oTRT{g0csf=A6FidZkJH)g znC0zlzUIvB+qs%+5Uz6-J3hTWdW16C-U=+aOm5(eh2tg3u=*-h=b_f*@%$uEj6+?& zzZWQlMwV;X)99gObKC3dWM|hNC?;i?PNSioGZTIoe~z@EzNag&rqb(n`m~}6b7BA0 zT9`BVRu}X0xD=j(qkxQ6$GIb{M_3MAL$DeLr`~wAS;26-2W95*LH5n|9j`LSJ>sR! z^|991dRr+&v<4W)$U<7)-r>#u!n4J+0k3BTkEiQps>v&z5DPOitWF2n{16h2J6ZZFbuU`-0hjml7t^Yh#W59?@Q?E;st}QX) z;&44#DbNK^)nrhrdNfMbJP5Vi!oA`CC|xb%7W`<-lEE;9{f|%yHfNP)3=X~|C*3=1 z6{*G9?!_7l+l8Sair=0!Rj*CBZ(N_OGK;JeS5qtfZI$VT2t~zxxi}0*2d%m7FKTO-SYJIypbvR zYNZvU%Hh1za#eG0e?kk>5X*5RAtL~t9wX1+~)Ko{_^B`k}vCt>6-n}9b5fb6#OwomQi+>cz?DS zB|2V3l2YdAQa|Ej%OaK9QyAg1pAR?Q$!PRvaKJ`pg*nkvrvDtJ)KkJxxu#3vCX0;AzLhCQK#yfgtbryGm4_WWo! zOow49GVg8ZOv&z;PX(hQ#7KsF#l*#fsd8BKGsaku1P%#!_YWuZJl)^Dwh;Wxu#bMU z)DTcrw}^e}PL$Hk;%bB5hQ?@f-Ks%+lt_+HBypkGJa>4nJy{~0+;U25smUIqMam1` zf~z;N3JMLqFxD46QLM4(E%to?@y4yaAd^iTBnGLR6D1vZiJ*pB5Ci1S8gAYm+j8gD| z07w$VW2kQ-BX{I-xyI*7_J{T0Y@ctJ*~x1ftv`NC4A+83>L96^k(p^gjsPYd5=B6~ zh}h{NTpL!=^R1mL_&wSM%M6~=9=dZ*>F#=Bho|0u*FM#S+UhXBn#)ZFEJV@xVk4Cj zU%2osR#lhaE!>d0pD0-;R)tuHzZ#d(n)kD3h=xGNU%1t+nQ^a6A5E|H%f-ca%Z>`3L%Sk~hbp8=R8*0SflshKx_bHnJ~HDA zpcsgFFX1f>!e=5P1E5fQv8&%@uCu7C1~jyHRgE4@xbR+LU&&jJozqz-N_FvL0Jt3>wQBf zI(#reD1hC+PVT=?@BTS#BeULZOdbfVZ~8z=miJ5p`(U|63-cfR45GY*h`ZazM@L`C zql83#2xitNxqW&;=GpkT42Xd5PKo?0{e{f{FwP?Bmm>3<*o8xQ;m1AHJwOrM*}z6zUsw@9=|MX@_vH|`PrwoUbv^&Uim->fmfBIVD1 zZNsFWon_bTu#XAqL^>_i>j6FCD}lYd!YooPQp3llx<|ufB8OBOcd=+SiL;b#4rb_8 zf^Xq5%+JlweWGi4LV>g)BghwWv)#Ax6Qq|!=Hmfi{QSLSTJ^fG!sTlKsSc1*`5;=` zpGWObWpc!ESTq@_hKq`*R749vXveSTx#nxiAJ}u={ZRFiH9cp|H$YJhRa4qK&LqEQ z!)1WtTxmon13NxFxTN^+GU5{(IxS6c*bm>qx945NKu$*D6h@u zH!nxH2pug^NSoE2UUb+f+$}v`->%kD0j=a zVxkff$b&$T;K%RoNzZPgb`xF>39k1mt-S?Rl9+dA3m*NN#bH}%j~Z+H8RUp6GC4;5 zPKVMB-NUN)vdBX}8ax!lHGUE7w(*_pa3`H!*?~CLheV}1oCqC%IE~B;=H{EuRL0lq zQ-2r>{cL$G7>qOXRsmN^J{hb2Twu!~Kj4b7Hr5nu*axU%fFHjMyJqJ+Jr8Fm#5Ojz zz{A9(9Q#?&$k~mfwRapZWf?ncri!W9&XeGpy+VLC@33t(unB#ppid zlumdP>}i}%l4NTR8&~@rq*ga$wHKq9d;R7b0L!VTbn-KpqF*CrAkSR_j~X_8R|OHTUl)A1b5tKd(Mip zaJ#`(c3%mUS-H$KDDuyz5`Nm9ATPd|cE3j2dwbs|SVw!;*Ml-p&xI%;(!c;<`1UxD zb0pJu_rFV$iGG;Xc7}0&o?PACeSdnZMw<~B_x>Z--Z#U zjby6v+^NI?x2w2EC}~#}5qLZ*PUNW>`vXCC^>IT^>kf}o!&;qGYOqkfErxh(4jNg8 zj^4V(iOb!P(xP9JRa}sHDdoR0oZPPaa-_97zpV zhU;nJ5QpIrp+j3kZ_ppk6jOTtj<}>wb)p=bqJwZE+YSy~X9pG%5?B6(DkPQ4x6o|i zyq!%7UE8^m!%b&4iuPX_2MthC%{W2?@z7XtimKb@lA^L6lA?13b4wZJ z78Zy4;UG>*CQOYTH8-LRm*A3fCf;MToYBtV?offenrkz2H8sw{Fbi6Dv?qFIg{G85 z2BqWbj$t)ltKRx~GO3)O<|?e0j%rv~4;eU0ds3>~*VcCJ?mDDIPHG3Ql2ejQI-mWd zCGXA*5VllPhc5|oYQ+y09~~gM@Qj~7QyPVWua6cdgOloI@eK=@_1CtmalI0WNjCqI z4lUU`bmUvg#b^7;Xjxw~r^qZQBU;&0ma2XPD>K{Qxg^P43YE|VUYc13I@T4MaZYacSnEL7orV<*rzybyKJQNx ziow;&tJ(IE?;JT1p4>L%yG3}gMY`(Dr7#T=ojV9Xv$3`{HUC>tIo(Tra6&!_;6aa) zsi~faZ9;*^&`h&;Oh+fUiX=wy#1g%$EkA#WF&Bw*M$;aop{dN&dc4y#Q^qM4q-NfE z7|#v+-PhOr_0htnI~rI=6JU*iu6l5%dVl48q4#BMKuS{S(8GjmX`N7h~*PhyR-Sqr&QPu5iclxCGSseKCN zw4#IWpK0Q6W5SCRLVp*L-FzRBP!A=!$yLt%ge9LxCtPhM?F$!A*n*$RGBiV7WJX`} zBs?jgv6_K1_>}yXa2rLZ-035iIah=;o6Kd!x3vhW3A;1FNIE@Y0<2mW9?hc#b!RG5 z_+g4my3JZ^?|I#WEB2kGMkFqcj|vXTTtj0O$)ksIO3pN*V^MK?K%U=lRnzpyY<0tj znXieCskG}#sh+>+3HQ6?_xN%W#k0DJ2?Zb)(;m6S!AbJLslX*Y^a{euIRKE5xN(oY z=YD8(Du^)~z#wrn9nKq9LEZ{KPD1FMIJrGC6`hyZvTEjGmLrYGNDFGwJ{azXh$+o6 zT~}lFod|{0eL&kb^>xB9w2vhv!%M#Yp*^&jAJ*PBukh=tyR*}z{OS7g_6j2g)Sn6p zn&1VKjw-6bZc9!lPTnmUgJZoQ<~gGf@x4^>g4HlnD}`_EuPNo{DeqXn{#H{!l{O1p zx&tYBZR}+zw;00i%K3Fae~Jdcl?mKgdq?)-3f>Lxm7A*fW}|f{O+r@R#)9hu#CiH7%SJ(jh@vK~mk%EPBeh6soH( z>)~^nG)1+i7W6O;8ByWrP4G}{?iXFzlopBiu_5MfS`@v@IR*VG4Oy4WS939%kIpSm zOy-cyoP<7sl_@JM+HEiPm6dEBx&Tp|e4(eOuRxChsa@#=9Wd*2UW0gaIlHb+O6rOO z_nZGNn>c6zWfMG$p8r%#P^O!U->HI06|UxEoALt9R)(4i4x2dN7u0BJ)@xWjh8ObM zI@s*Oq$ej{br0ovvtd`GJtjJ5_V#4&ogj{@wGQ<|54JqWRX=WH4eG2L1WhrrtG$D*yxz_8dKMy_RH-$Rf%VHVFOr^ZQtB8izVgU@6Mq+Pw~9j z<8ssag@pQb`b!=n2s4{cvU_rhpxnJpS5vI2=a>7gwY>ep-|NjsjM?uH z5$R!3%>UA}5DlDq0*JAh0-1Bx)zyAp)pzl9ZpEXIvFeEz)w#y2HZ|B!(+|U=MUr$M z`{pt$wCFVP*;V#6`%=;(D->_=EBabkl)t%Jpt zDjU^I(MIy}(NtScxlx}#H-ErvcG68^WsGgYf>2O*#mzm0SjoH_6r`oSydHg798|~| z^hKX~OhmF=(qP+&BE1W`IUjwdckn`#6;01o=lU3Bl_^R5*l{ZiOT#*A9&Oml?yW9R z3HE&vv^rR%gkd}Wk5=@{PrMrxDC*lr7vT>zT?j|p(49>N%}gkV{rzE721dglc?{^@ zP}JugeM^d4ZhyTxiZRaxB0>J+6ta85$#02reb7nnuaDz87YJ1<{*L&H&>e=>CQKqv zGAn%0$vQ%XVVU%Sz%kzKMFgT8MyG~ovXSX8abrg^5bIUQjHZFPgla?wDdf8U$Rpp+7xi(wD+k>3?4g@%oYS zJ|hC%>lG#D(ATiC6t0w zT|b-}OB20fiH+qbeLh)5bZ6XPcWz*ZVf3k{cO7yp-tW(rIzMmsW2Lv4Ip3>WN^8)t zx!t8qI<#9BD*oMPZGGK!-kxK!m_#Ilcd9tdlDD$;R&5*3cv262>}WwDnYI2xIEEXL zK4Jn64#RMT0cvWpc{u9W0-5L2Wz=_=D{5rUxIp9QJ?xI$>|HJvBBFQ8&GYczmr~ox zH%HHIBWB_vGmxaDc>RZ$T~QSpxmH$o{hkPErMuHbWCj6yy%ca(z)4@i;=X5pTSegO zO*XtPtBBrpRqQ(wfrl|Xu>qkyo_{qw7%=LRI>B6XWf6R|kEW1@Hhu9|bpvziBcmIq zj)fAFr(U59gleJ}R*qF*ZK&y<&Ed;yG*?#EFT<0XAH#|&?+6c%p6Zz2aJJBXv_qU8 zBIw!){Vs@C(Ihwb`RCym{nYwE%3Nd}eoC*-&D>IR+w}%lQnbuD=%0ttO?xM}#jd)i zvC8VdJn@`LwSFgusb+W%V+5X)#u4OKZgA}|YE4?Hz=So<%F`*58s&^gj!(BSH* zKhkn=bNUhtezo#;c_EMG`(sj%a?5E?eoKu2(D1uV%`~#jYH{p?M%?B=2hKLs7B9T6 zOUoQK{2UE%Y)F(GqyCa71K!wpJCvENVIKcty&Vb-jRjBuUUO-saj?E3BJkF}|Lx#1ca2m>gGlGI(Z z`ci>x7i1t9K}GjK5aD>c*>9Q(e`tsc_jg!i6C zmXVPvNvV^h%J76i=P8!Mp`I*JRZ;OH=EQhttnCeE z+bIBqF_ahvzq>vwrJ!6b<+$Hxmz)B5{hJ1s_Q(5enWdV~G>=ZO7>7R3$ID7qt7$Ng@F5g7*^z)sYF* z71TZN`hei3N=2=quy#1Rq=WJhEFVTiZ5#Y6J3C~pu{T?&;NVZ5aNvTv|G#V;({NDG zs55^;EG7|xF%3r;#{1F-@2F~y1qGNeNeOBev!0UF<>0eWW}CYu?#ZkEHuG+zgxOC( z!jnnKV$r=^&0or{Wr5jn0;Z!1pIat-&Z*$=xIm$`u%Ve>dN9Ft*aoZbG7_TF;K8Xm zY`z5UFn>Z14Glrh73%$Q_fRS9Wt>75$1^yr;fqrdgKHDOs0xWrE4e705Sr;~H4(^38Zrzu+l3Au9XcURpc zARbd%9=usaXEpOO4)<^^5_@b;sPgwwB zr$7$EdNq8Q^*zdT_boq)hjw>O294x;9Fm#!@R&ycOrUL^4k7dI8=k>QoxfQ>&ZyiK z?iqUd>oUD&@vfNbFJ%K(xWfM_8)PCTU@wn+P2;-HF15Mb6P!G4(W?77*KED&GY9S9V$>NwN%lK9f^Kkr^;XzvENQEYyxy46R^;&$-IXhV!*Jx~pQ~IR| zR=1xOg-{eq`MxrY(?8Yg0|Uo%A7eKi+^HKUcVf_{?_HKmqs2-~+$t=Fj30wk zi?$y;BYu-;^_hvY`zl>b8qeeu(xny~5YKSIexqdn2c0Hg6mpmcoH*wARcbVwoyXmY zrP8P?!yt#n1q!H&KjIm7l3V>DxjZlmu8%EXbAnHs_`x+b>@Yz(XL_x3M`Lhj`4l~Ld4 znSUoBbC7#0_SgyRV0FF7qx$Il#g0+m9P0&dCFFw|tXJFQR$nRv)+_07=&Oe8K~Q#^x* zLnT07HZ}jaAYD6quKXd+vf|%{89KdX_gYn~YfA(3#iofgl!ZSw88I$-(sbxUNf{dE z0Da8MHR!SBO=F7;P2+KUjnTOL<-`B(U9MQRr&JwJWHn8!dDbif*GH z!!>NuckG)F6taRcL|khT==RoCzMM!|jia3W^(@UFlqhc6qsq>ymvZ9FuXS@5Hs99J zi#LPnfuhnI5zp{5X6dyA77h;1i&Ro;KxjriTVA&ejfE}Qd4PtbUxbHa&@%*-G|-gH z%=Dkm!28Ce+9-ccBi{tADMOys^=rE{{~~^fX0AmQn3Q4D_vlW{h;g2K^~0$eHE{2bx`E-!K*R^4Xqw>=`D#^?E+9_mhHpIm zrAF{*gw)lOG55W+(yR#I697AO6PkaK<1!2$78SASASM)M{H-Gafa?z8^n9q3)Xi-6 zZU8H|*H|-uU>rkjcEEoj_aZ&(sZ%;L?}bR*>xO@5z#_ahOGiR`&*X8s^#Kiy2>w4! z=c{;CB4um0DwVcX>e34Q?@%vU&#y{TLoq{4+b5?0%HN(|+d=hS8IjP~Nv9g^@0Lis zWQv>hK`E@l_KxpDN5`iEKtKyvBCx|Vr_|E4gs`&4hQAsbpWaC+_`kij1uMq$3kbZJ ztSc_$z@+UzM$16rHBd+A9~>O*3s^-w@YAG64SZn6jMRAeCSG*(1O0m2r_Z1H{HOzzvqPtn>3zvUv2 zk;&O?fiFw}UwEkuj^jpmNH!5`@B9YK*g}f3CjNZ+WsY-#4G(Aoc&TqJe#DzC8Z~_K zi6;WMd;c3_!2oQ=7f15X;a~sq$GiNe+(Hi+6P${3p{O#0eoSJ+ls{W;0o$c81v_rKW7b$L7BJ|m)mnnL5`zAT>0|^9 zdMq`0gH9~w~QJCS{Ua?w1wcd1z27lM8 zT#lE%2talGLxha>1S=Brx`7O=kCu7E0-88}{>UWSWAb=+%4&%*6TVm<6YN=x*V;Mt zE=2Vjd{)dEI4A||%Z-ec;7@raRp+ME8I0dOp=0ZUGQ9ZM&*n1$=TjI&DCl0>OYHIz z6}-S?Vu<;EgM^IHh<=tP+jl}TC;tDZxvva}s_Vk_6%~~d=@t>`PKRcs1sqaZT0lU$ zL8PQnx}{<07-|SbfuXy*C5LX9dq#b~dhh>xf1Sy5&VKf)z4o)#NwrY`_}Fn`1|)_w zR}m~OCG$0SNtv@)EZEG9UhCU}$C|oL4ixbCL&<>q7{AY6JZML_7@5|#q6#5BlBA1X zP6f`5-Zuxzh?^$zaM{^EHpPnY9M1W)FZ>*@{Tj&H-Ej|Jz!oYx*HA~Jq-6M%%Y@0L z!hG`jN`PQ=)CSm36aKhn)9B1*kRrdoW3kzhq=25zobIULRRvzHz?bz zsUz|U)o4`XrIv;G5BiiBw$1W*sPznMY@cS@7CsQ15~RykH+VAJVEs};%JbQ+mDKJ1 zM$-ZgWqY@Nb7;(R>TjtB64geCU(=1Al3xjme;q^qD8_#r|3CR;%OW3ez(r)g70Zv- zcNvD$@JbH$m}=Vl}3!+mNL}BZZnEG!Yw5d&(pJw$bCh2qWUgJwIwzlrcTVs z!@*~2JgMgg3~>hR^_?093DY7F``H*Xi90{6b*aO`RYBc{N8RHWnu6=g@c^9pMiz*N znoYNw`xgWc`-pVU)*b`~ooB4kV21a~BKKFyrDVr_P*g#xS`3sZq!=yR)coS$LV;sj z$EH3wC#mt1=jCH|YUQ>~KIVlZoDOJNlC^&8=i-ZZtDV-<4erDTVqUo4dYaS-k&Pba z^J={q)GH}=Pb2^0gF$ON$(n7Z!&OOa7vrLOX&9WP-yIZGoT;irw8fPVy9HG@VfJ-$ zutdPWxN-6-(U0+%itrp?6G?+C(DD#cKufW?>DL#Lu40=Gx+e4VY%dV{o^471Vfd=b z=fQ8>&NUI%eGmJ`VWs(}rqa@l%h?4BK@aDr4Gq$TEy#bEq=LRi2O%;qZQl2xl>+BJ z`!#Z)CDiRxqZe(_jx-7v51Rf$4H;J`W$D(*hb)SG7QK1xtIEaKPeV5t`IAbVw+1=e zBi`OIxEr51P`YQ=t?dajC#ynjvwQE}1nXUaOrD`B4o)sLj zICEx3P<4HL1J`qkTyb`~;LXd616bf)sz!0fK9*O))j0!aU7%fjW({{$yX%m_sA4Mo z5cfus4H4?Q#tB$E6JSeWerCYYD<}5M(pb-i0%FE>32#~I@_$2SAM$?kW z_X{G2s*0AG6x+UuIU8h4XQ$juLC$nt7QZE6%PYtxP;M-aQ&i#1)zzbgs5V&PR(=5@J#?2-nhdbuIo_VHfId@>Iy}jcuOVUc$kHb3WRtS<`whxdQ_|xz)`bZff zdedLs5(t_^baS1`<7gQ!OE9DLfEOvh#JhY=mfSnMtDmnSc7fHuEG`zNBmy02d(1nT z5Uu*k7ki>$N%iH#rrtMJ>JPD|T9ia_jF;0@pfsJ-e4;*$jLJ@yf-2b@2`C;qj(`sL zMv+Z+&?DDl?-Gc-E#4?Y^JXTp8T; zvTJ~dhV>)!@C3cFVn@`MPSOVEiTPTrBuwxUui2{H7#(kqjD`Fn@8LC>5U>c-;C*Y2 zVYjVuGiAFFx|vb}dSkkx`w0AW6a{t0eMLS&5$7C7noxGT#FT2-VA+1jEqh7#?|}h+ zsXXv)SfqfcSVno^){nIo@``e4m;UxhpBtg}#CNHx6<}B9dG%$CR=&6g#%fb&kE+qf z8YAdOSa97&X;{H$VvI+nX-m^}Dr;oj$0TLzmn(DJA;5SN{6aIJ?!KSY4)#E*5Yw3% zq9r_qR$*$FtzpY+_i8Q(yVn3h#?ACyrQgG(8(5Fok*hGotm?5V8SfZK44!=s!o1Ui zEzxLWRdp;dk`xfppA`EU3Rlsdt>@R>e3rSBQvc5KXYl(CRiYW8f~w`t&X$`e)K<+p z%p*a-@+bBcIIe8#_9>qSMPgp*;>P-mhM8_WjuKhk$tb#4 zW_4KOKfQfHA3y*Aj~cZ+)NKT6Q``78FA)m%ZAz}H#rE3*QTF=}*;8Lg%xTAt*g{9P zxgSu_E!wT@_|&@Z39g1AZ#GXFn=V}z%6K_yKg^qr&>6gUk zWZ_I)U6A+-Aea~1zHb@uz@1p6k6taL8c*1U{xg8d?<1P4*qX@{O`&4RKxT)ZmAHVc zK%USh+t&l4EsOWA{O7bB{E~Nb-=KmOhMQMns#Y`|ZD$|sIHTEdq3m8Vbl16;6gsK8 zdga_}Z2XXTj#B?ZtGq3(u8?A_8rHd#dR5nDqpa~8 zKP4~a@Cz>GdNjy*qD_Cgb>hJ6+&KA_);W!P@(tZy+N17&?gf`$`A_I8>w52sTcNg- zgMUsj-|FS>y=yT-5-eaVmgpOu4_A3OW>+_bdB4ERUtCC&a?rJ#dBj#Whh7uk09V4z zT&P$u`yA+G0NBJbT9#)?ui9x0veQ_J-0D08^j_f&`}3tU6XxuA_j=Y}W+!Brs)WIvEJ^mqF>p2oAkd!GOLW^~o!_uU1i8V$o!aMQBary9RnDz{H zuYtOBVXI%1JF;UAwz(h65;s$qeeSv5%U$a=qfX_FT5x-DnT5d&G%W)i7)V_D)DY(6 zeAi@u<-~9iq-{GF8Z<=mt@cRp0;f{wJ~<3JQ6u3!g+(rMM>CW3$fUZ_xXGt7 zsGHe4>CYYg=#%RpfS3m|OgEQ?kjX?6)#_6atYI0z3#Z1SFWe~jnjIw;8>jBTEPA%1 z8N8)~+(zav18^?Q1X?tiFbUU`4N~I=XD-Noo>+muy*z#W`t;b-w3s7RC9*kZ$3tT0 zQVHPBfAmZ=M`(jxs~A_Ose!$v8dw6Jl+M=_D?)5rLvB)V7hE!NnWz(o zOJ0r))q0BD&(h%i+yfsz(kL#9MAf)F?T4tHk&Brbf69)2@R1RplQh*=d>kzMI*s79 z_{(%rx2^j>$zp=OAh0mlKmK6+$SM4nRNP-+HOB}ZjK{Yg+`Du4VS+#D=&idGk1hsN z!*?5@fxHFT7tT&j4`oli*F5{zr<@9RQ0!Mn#X9N|9yRhSU9p`4ugVP|y3Z*=ybtvR znm_#b@HQqU*Qh7bM}?~IHpwjawblq4v(J533vzg_jfALhX zk(u%oO_NKsT9XQ;EGZ^(g=2E21h!n~)Bfm^R^yD`i+xGmQLpjGs{P2d$2h3%ZEDe;k&%HdThPn4bk_GIJ0xPH?#MdoBw@GQXyT*S$wKri&XI3Gx*EJhiv>{ogHMxBp z4<1$6y*eaV+9X1q+|};|=2#yT6h5AiUfOK++5RwAn#*{n zYr=!xueWJx1haJ*ocNK>4ZhwjgQ z_hVU=<>54+KTN|?fp(UAe_wLlsEKwatH{6yy$IEdG}h!8hBqg|_O&bz9tX-^2&w6t zSaRSPBAy@FC{t-!jjjG0odYpsNclk5CtdAMTMfx1fb+~I65fZ`)Bb)0@6o#{Lbw?M zsF?~fw1Q{NTqw1jP|iA(9Bpn_RLxh>m8k21gK}(S3z-FS+}P~`haNHrHm%*jTykcI ze$Z6GXTWi8V$2t$Rb08qs2a6+mKtNwGq+zrkw*`L<0R<4E>G8LFu{4_t4=l^%Ob z+2Jo7HHEgSj$1BjouHD&U^Nc~cqo7-$H1h;wDdED9bG39qEE;a`N z;aOXAZfEV2_|zl37jvTbBfS=bHB?YuZ0t%-XRI(c{7lfGCE~f;q^eBZBy7~11w;%H z8J=ggcA@f*GBZa+q=o(nD-Dv%V}%<_9|qyrciJZ$V%bid30i1hftXA3#xAxpWAT>i zD*F}|Vr`jbY4$Q0xN{0z*@WTUSVNJ=V5D`Ys-bU)L2G#k85N$zypWE%nP+jSaL#$? zg!Y-qWYgM5NuJ!cLDA=?B-_f@IbPWsXB(@wOzfj(h^B$HBt?SOp(I*(l- z3&rGjpPSw@+f2V~Oob(AeV@L5{#3#WKANcQ%?>HA=?8z&KYF1D}~ zjgs_sQuph5czCy&ri-0ADC03nvNyRNva*~Dyg<0%pTSiga*~zh_n^w0ucGr1(JkUz zhWwyL)3>vIHDC7QuTryg%?28x5iE&|>c`F8G&;w)(xv%~s*|Bzja;I8UmV>T@N|wN z)vj6%i#@sfYCo*%|P?%!Y>DAK9?Von8ZJ@=I4BRYX5m-yQsCBeD#=tTUmPw zHYyxFluIghVS25xgz8HZvjST0 zENkaN{@8O*?_t%q@U%6x%U!&JZczH8tXMtc>N1BmZaja|1{F=?AyduaQ=p2{X@3z@O5p&>D9eQeHtS{Yu_h?EhG?A}+TUo8|7e*^iGTYz1a)$gzc5zO=Cd&K$Lg_M* z@2=Jfqqf3H&He?enw<}e6@bzM?AVTk#|HRJdI5q<{od<`dRFS~Oxk12P#2F4gbJMa zNC$HEy!|m06X@-jdzxO=UJd*3qzJ)TTpTl!UVyil$|m_;`_fd;Q#O5YZX-W){>IC zGp+6RtuPjsjEIQWq^CcsPEhbmNF@gvYL^)>m-hiQlBh#d7u` z(_uI^sS3*u&gpSUlX2ks04$>yjSL`zef>y|&555MhE$;&075 zm{rKFAoU9sMT^+jiC4VrgtH|jyLg_|ds6hdyj~WMpWZ(4g_rQ?yPjZ>p(-L3XZZoY*Plb2b=zZ{|sh&dg}! zu>;2IyzhH@_?XBG9WKZ^Qk~y_$YGkbY{@*@eHQ(=bipt=s*t1A7h$)1?7io_mO^kB zwI2G(@#x_w8#OL!;8SkZcHf;xjBi=?59`K-ZOb+y&PySUT>G1@OPi;qY0pa`bBTjZ z?)4;h`cTO+=4mnJkKDx$V2Xi7TxNab+{%z5SevREax`LQ)O`-MCUN?`y_2KOq1`}g zOeQ{m(jZE$rcPzX1_w(reGOFt#h!~qhDwy$^4gr3zWTV|1@0GxwH0vzI-gudtPJsa zKpUdfV<*h*$-k&N_$k?$urhtUl$kwlLz$2V_%>X@Z)W-l1_5593ARdfgyD6q_`fif zmg^dajzkrZVLhLsK}}ix>~|yd9-`Qyc9EJ2-Wb)^-7261cFjMLG&Gh!ro$j3V^PC< zZ7I}xv>EVbC^vZ>$(5FNTHnjDH|dr-ICn{}uHj7F+nW|LQB?amx%p*h7e~v8)B8+S zDt31MCU*8~DJL1l5VD~5oBZSk9LGS&7Og_));8KX)MNb)urYB)#e8X*?lsO^)uSGh zttY$lV25n71fF;HjuP^2&qgstBl4Pr3M_qUHu;G`GY`~FNi&BQUP3-uz$fkSVaml^ zR^1@zg`3qL;SnZ&X2J+%JGI55O1}TV0-VGBLZ^wkT}khK6SQ9991t#OumbqVrPz9G zIxMBmONShbm1?byMoe6$^but*hl+Jk6*)I#MmscA#OXOefXp0Y$h1yoXKc2^5U`2K zQb?|r9p2nNuV{9B4eYRPMK~9ygstP^_U7_(kdP4SHrqI~?>RaLMn@A+Qc=yn?jCB5 z$&H@nXmo-?M0+x;v*KcY$YBI<+?Q7pcWF*%!gFu~JzLjKp{+cu8FdZW(A#`(Q82qw zy)jlzRZW$6x4k+d!P!VaSa&k9$+2j=)cGtWbw)i_f{+AqF-%_BmQSbPrW2Z%FZQv_ zIc0xtgdDA2RqPCa9855veAoLTTZ~21-i+kZ>0j{n?lf7jrNu28A-iLXjSEMw^2xAR zt&!UkxV{J8Wd+#U?Iiy(^3R?oDvbt$(GgErM3w?$t$GaTy|}2l0kFGBSkPq?b|_il&Gvw5n)hzJN6P@D(u#yTdcblJwtg zPW?4Q9r?1cdCJM-6{IGU8(|k*&N)Q~QUYWk4D=B2g~C!--zKrO!eYs|+3d>Ie6(>A z-{?YnY{g1ry?;2>z-_fd^F%_YdPa&zMRR}Y0Bhrkl{YB&)am>A95A`o+T?o$$2y9uqFE`3O}iTky))HxSRaIME*iUTbZDN z^WoVYH^q(z$)L_1)CMLd17<_gmj+f5%eNf2*v6Sx5+m7ALZppt(usrmF-m(8ks!v@ z*^cjVQgqfk34L-;cej74^5^lz0-M&#kVY$@W1_oqM5@u{Ry>nVI7;lG&!=$KpiHgC zO=U)!9a|cSx|CKYTRwV;v1TLgY=0z}3TYHLszU++SHNxlC(sO0)pE!(%% z2)E-4`kz}CqG_4DY<^ikp)3khR^fU1voJvK8@o0^lXFOxRQ~)xTOGUbn5ZM#l% ze}{U|ds>31mnu*w_8l+oT>nEZeJ(*dqh?3uEEsg@w<Nlc<} z#1N7QsAgNvsZWW7EK+8m9>#KcQ?h*FUDAx#khbvlS%rXRjrK)?2H33ldN@pB?YJRy zc1aZG@t-&@Wkr)GWMeEXj0Nr0#lQLJJN#NUj`$4MgcB*=eJUjjFc+*0)nZIv&myVY zZsFwJ?P#<>NcZT49xh65z2dtg0_73|8^j+n z`Hnu=j5DQeII5|QLO=;?uJGLKLuOD%r$BKEA?pmb$`~0(!-d}>&p+aqA}{onrl$g5 zcvp3N854M{nI6RPT~dvLd%$BVr@j7GfLtW7@Gv@P_!iQ)mH597`ak}DiloKDLycG> z?yyj&T!b$2WDH(?T$H!z4e5xqv~!~RI*D$ei)ge)I4UVIHaZ!row?bd*XVBUAffMa z@-B{!@BI#&JRLO9cNFC@8P&mK!bNO`5PovtSY6b8s$D7u6b5#Q1E9(l!x`f=Qs6E94bG>xrz@5-E2(TIV8izqAaUR}|=r1M*}EuHKAJ z-2G%DGhqC6Nbs}fk4bcwE1*%Jf`{Y7KSY=RjrV_j{C_9D{OP&{h|_Oj`h5U;WukHZ za{%(m=y!h~{-*=jzbY1XRCeG<(Q0h;Z>v1PPm`&&aB-D(Hx4=XF3UVJHnrxz{L`?K@gHs0w4UjgFZt%@)z`kT#d^UtV zk@n1YH@%5ePLsoMW^rMchRR}c=VH%`>*rB8Vq|ThtL#C5n>+72>`~83Jo-S%EnTtO zO^ssEnm(DpK50*Rko{1E(J{|eIMUXK|AvI2&ZoS-)>St@A~#%Thwo6Yy?#x#M||s~ ztC3hHh3L!6c5#{PpL3Cr$SiHLgY~5?wd%OohG(ek=mpGM|3q*Wa9R)*E)fx#0SQUF zws52Cl{@WZ)w+glx<|HOY3SQ}ToRJG&I1yuG;q$9;=kgnB(^~GD7?B9tYHmWgefnLTcYJ-umW2Php8Ny~hHlWUt)56SpBGPVfy>)Xisp`=EqKr5B>6+UQUa*#HlWBk54t4eF z_`r@--oAW&djN_vQ8P$hF(2>=A+T&{HU6M=?OgQeKJJh7z$TT*TD^tA)?3Q?%vis0 zujDl`_c^0+Jocjcr&mko`WekdpB=f!+(m|eku#K3tY~pB8Ay6WfT~X1C=d9lG_4WK z|E1`sx|hH+L$Xh@-pouAdH3tu+2~A=AHGC z+e;)q;bM5(p{Ua?3DqP|zcIOQgNnw#HD-9KM0)i&`2p7k`_JqM|g-G%H_oqUHz1aEtD2m*PmAq|T$Db~5DA+x+r)+36;LQO% z1o`2)G!q-1L0|x5^&AhwgXnys>l?%k~#7AX08JkH+w|B0X4kdcj zJM3UHB}-rveeuN-D!5hao!uUH4i2DwhC|>MpYo2V)WOa0(yq?lmWhd>n5SZ{mr(&h zi9zxwlA$bh&sa3{y&>+FU*Ef*?R@$mg~ri-jGS8msRb;ML<=44B`us_drnSH1&V>) zgL9d}BB`khPjZAnpsy0{bKkz@=!=fLHAX{i0raQSnj&Q+l}iNeWFfY1|9 zJpy`E^Pn~3E}pW9hT6EAGm8%HRZu9Ue={$!sD8=MVUZj7kn(?>7z%~H z{j9Hz@>UiFb)Z9^9lSrbEQ^%e@7wFoZ);76`d zygl@(T0WMRg@r}6IB8uV@xzCkzu0m4W^^76ky{zd!utmY;hkMwU>lnf$g^k9r1jv= zIGUyUe9S^Z6k1wZ(goZmFp_*N0`yZ~0HRvYOq9i*XhqPVQ5(<%5=K$6_<{8ayg#GsJ#{G6kM2P>0%_Sz9%{DDj6UJ2H)vSTs0j zbXo7y+<}qW+e<*s4a;L%8LJ>uwMK-5hAP(Ei{cOP@tDXEMA3OQIRj6X`FqGCr%5d> zlusy&6KO-G7tdJkvbAgDXzhGHu4qwDNfLV!EJh(lGB=smO520L@}DSZ0Fa8+{< zFyU)@%5s!#firQ&GPdECIXRox7F8gk$fUq;oCMrdLkf%Rix)80mw&+Fa{)hP;p4*B zwBPSO&!`XV1}?L21q?4Ir+~+#dfFoH--uMX(wxEA@|a9JbelXA{}3CYv^a^Az<;_E z-nRXgiM&7a^NgIkcvj~4Wpzq!jKNp}SK;4O$O`re@PvJmN*vH1d*a}S{ckDpfK;dD z7O_?S{VPil6L#Vy<}X+XM-I8kxzA{R{gQE`cOCVYyLcK$GCem0cp~8qIVq**C6cc{ F{2#EPP`UsB literal 0 HcmV?d00001 diff --git a/docs/userguide/en/images/prefs-images/e-mail-new-account-2.png b/docs/userguide/en/images/prefs-images/e-mail-new-account-2.png new file mode 100644 index 0000000000000000000000000000000000000000..d01ac22165b4de23a146b6610eae4e20811e3cb9 GIT binary patch literal 15111 zcmaibWmuGJ+qFq3BO)rukkZoO(5--i(kRlxkV8oiB@GG;9g+e{*C1UANQX#{bW3;F zcMa~npZ&habA0a)JcgT@JFYpewbr@TX`teB8OSxVYZoqDfIN|Xqet4R|EIuD;kn7uMkk91K#H1$TsS?zfGZSTYXbA(tNL3;f$)zTdjNHx!Mc+ zO6bo-U6JnV_R)g&*_DUY_FY+aclMWb&mQ>PG(TPU7i*C_+fcqJDXVw;E6LORjGL0I zDF{6LQbg^rJYLWKT*IYE2#rKcXPG%Z4HvMHQ3Ws*B9zPqzr!5L={> zkQ-ATC(X8KuktW-uF3{F?r6~LM(Gj=( zdRqLG;0Hy@#b&v=3B3(mkexFVVlPnMQ3FryB4L|J@?UQE49H|?VRk&&o%uTzQk5hlcgiNbxyC^ zVwfN7jS;h*t<{@g)?+Mh-BDA#c9)fUjeU__ESV~=(ObC1`~^wIv<@sM?Vb5(Ztk+? zUV!V4%}=(A4E&!hbbB;EK^8Psx>hLeqec&@CMn9McDCLMY9>NGx}rw^d8BR+tJIlE zW!^WHn3dySyPj{>M0`~ZHcv8881PI99i25IQ&b*b{N9O`E;t8rZ* zwyiRYGPtj>Wp{DE4PT~<=JxQ|Y65Lt!IyORei2a=?Lv*JlhbQ^)RtnVqC~sxbaw^% z2;l{ROUW`B+PbF%hWpF)v;_Vt+cF=9>%VIg02{Jf=Ks1tm#eWZ0%H! zQBs}94=HKkS88PRjbmnw*FHEGu4-dfJaX-G{@834v*XdQh1$qZ)6P$ZTKaM8cG}K1 zb`*geN-veiO!9w*Hs@1XhE)BoDSLcoF-I#75gK zad@Ydegfgz*2J6^#trt(4^2aN8|^9XF4fxb$z-PY&H1gim8WNy%_Euy(47V_ew_`- z;>g{8#`s^qEQhP4Orz#kOoL}U#8zlxZrHUd=}^yBW#u>~#J}+n?3Y`uqfc(a-^;0{ zVl`(L8n?_Ei0`Y?{Y0Zc-E7fkFdTljwAnHWRyeUN?bPG6VHvC|M%I3=~)(K{-^H8UurHb1xS4;*jk(`k9k(5jT(5i z8gr8Kp>6PpGThit-CEwo*wQTu_C?{|0m7K2IB7VBm%Dv+@KfYFO}>m;t)ZQidjorG z|6XN*t-lJQXxv>wd{~s!)n)(Uy`z`+vNTU9nO&Dc_(j=YRhEW4?Cr#9c|Gi%v)H~* zG@Fk6bid5c=5@O6{4KQDj-wHBz|U{9C9gbnPkPoBy-+4>Zqy&nfd9DvO7)(5Lfc+b zcD}leW!vMLLhX6nHNI)Vl1etB^aH^R%Md8}(;N;D*VO84nY;&kvWr0ArB$~$O=B-z(aBo>jJQ_MhyMmW( ze$(%LZc1MI9)&nP-K!%8$1A+BZt*C(v1u9IDf&cdEsHU%qvhtf{gT73qMbhoUBDZ*$#ii`& z?S)=7Efl4Q;nD8O&l(p;8O%^3pCn%370LVYb;q+D0_!rcrNIKec1eB)hNcdcDhG=@ zWlkGY8ZFjyum&+>s`1cA=tjUH2pxa_FFSUF>5np`@UoP^6%tY}7xK zR_J&FQ=bpIDS6+Mqjvwk9a>^i@U*4LY^WX2VCec}P*4#0Y!s`8@+UYPp2c}8Ln>wF za8!65SGl>ooF9cWG%^xwYdUfzl9Z*hmNASN7J%wHyY3)35%B(E2~_in=m|vg`#q8P zU?^YZD)@$E({rh~*edNomZ$vbsd9;#+LPzc)i+{oztz&j@9#V9oTWZ~KhqJ%WaoCuA7MOv0hMz+4_Uw`{g6@qPmM+3CaKedRtS?0Rg%IFiy32;}RHvUNj1CeBX zC`a9KIGSdX9?Gs&?lb6Bho6qXgE#nICjnOipC@6D1dPH2WnXkWEVpibfj-!uM$KZ3 zlcS`A$y(j^Mj7)o%c9H1-G#bgDf{86`RW_D3E;%++#eC;GeVdkN|9H$h>77_bDeLN zhqyEEi$aeW$)ML=}*Q?IoeeY%4yP& zIDVVdUu9!0b*G0*$~8#)z<2M$+oD+H92`pHLhKtQj7}rfG8JhwF$fI$akg3x1LO0A z!pP2FCFcF{QX7Y6%SXN>I*RxEw`z|!+m%ZZ8fsnd?y#t8KTywQV$&?;)umsV+i%c@ z@snJ?%c|I{UZ5kQQR`Z9e7x0dbXa$GV)f+NGqw4vdK5O6Wqi?VwMWmNMm?bCvm9Ax zsogW>UORah48zcZCC134ZV<* z^g_msgH0;()8k;4#Cfe|FWtC1=>g#)SX8k?dxT|Ia(|Kj?aN1xYKnB9hNAJ~5bM8Y zPEU?vrc35!J(Wy+*xWz!`nOTv^oOXpJ_OtznyvG z5~|l1hId{j6i%sqDTAVn0_&Mo<}1mM)M;E9tIC{O6N}eWk z#7rbm2|FqFWUI04#NE3-uw%z-xbHe@S-?>qutCp#x7rvl*?ahezxA{2e3#iv{<3B> zHNOHRKp1(^<8>(>j{K6j&iMJvc&=9|F&{JPj#jH4xSgGzyxCpWuxCr1+?yX7Nf2A( zzRRJ*YVqq!Sc5+y3#ZR>Py{p)&!naOg!e{ll|M>e4SfGTg3F*O^Ln?ej6va>*{3`N z%#)Y;p_;sn();}{bfa`?ka7AWdG~^g>);3BkXpsxf#OWhgGK4QIKp*s8uiKR9Qk3e zfdcF^RiB+6896NtF!;Vu8XKL;8M2 zB5*0pNLWVC4<@n0-)Y$y294jFn{zDrzH;7UZ;Fj2MK#@(dL~U8EQY*R?(OxZ&=T+4 zING%pCxv8lCPHB@pqVAbhJcie>1AQcQx>iA!aQnM-^4|7{05V8_oKXfO@bkqmxcKm z9$TG!lnc*?T{te|-iYkad67fINU%WK@Yr&9nhr`J z3Uur82Z-ji`Et0o?FitS+6J|Yvo+-c9%Jx{PhO;Becia&yDySS-do0`vAdsiiL$YE zs!bPI@#xoIao+e&(m$#~4L@k}wtXu=BCCvA8!Afs#ixTGT=i)C)wZ37;k4?!Y$#+V zcYJh;9g{3%qzi8Fx4`TD#UCG~HXDf*%Et)jT=KOlUi)$3&a*-JA~tImLG`HA{9uU_ zu>DNO$k<+}-@w{lUl?1f+tK}dLCTLH3_RhLZB7YGq~9_q5&)W{^WS5+kyPbFI0U5B zv@#*Qy?~JV60V+hcXUMVEDh#3U)S~ey3a*-Vf!F{ByyIH&b4RbQ_nP)j1S@UW*_|u ze@Z0NAR1pfajOzx?H**~k~@uDPqKPT9#nB*&H0Azu;xP@rw@fv{x=pGzOA??As3l< z=*wLX(96SR3T`+RVZn9w_SqzJri*=9X+P$zw$aurzmFa}BL&G^8})B2fpSnBWVjt;$_mcq1N#2KQg~oP&9Un>wYbw0Wu6|<5Enhl4)vP7$jRWZ` z|5DI&cUVvKs*_mUoR!9Nv_#x~6;y=M>s$5HqSxR1dc}G_KWi^Rcqz?W1NKn3FqK8e z8+525FLtsWfeg=n{QmB>T-vUcUG?C>&(Gr10R>Su2tGd&a9mBeb;HkZo$lUT&l_5( z$I_xI2LUb_pZZ~hDN zOU{b|Wtg+xH)2oH4~;je{l?aLna`O;pA9+_91^k{%lHwoy6WW&B`|&c`-YU&+2LTF zlQN(`zx8>uas6D zkMcSv!@mxnlObHn@=S@bRixSvNH5II7<8PFBYW%BZ-+}3fN{gE3~jgOp1pYw<+J4X zdO@cU%jt=wK)BR#6ojk?=$CmH(X(S)8L-p=WgZ#qv-rruOynhP-g-ttvju03F`fPeYbud}B^hW__77Q7kW_1Bn@tk+U_T22BK6 zYB|x3-@mth^}Gz9?@BD)=@ED{6A;OyBqjmiefL1yvw9ndztEQzQR%RbnF{1exBvY^ z0+6xA+-SK?n%&B;{!-S7xdbJc54xfO?J4_#*EF^E$A$WDF{84{!p>-3z(51J8foG> zx@gnU%98ZYpR=px)6?nh2|E=o3DTVHZ%lVuKYjYnZh5GuBWJMKX1XbRRa%GFNmjSS zEDAARtNl>x=5zPoj}KU&HO2-}V}JtfLzEl*6;*huw5VA}h(Fp#pEx38+Lz zO18g(`~Kv-HJ2R(==SN}>S+JNfG>b&nZvZJos?=17glsSx;j3?1l7p3R@z&$sAXjv(vRv}<`y}am&8XX~C6tES zWf#FyprepLT$AK>xUJ;aEbRnT{!g&QT^ZxsV>mQZ_b&Y~xcAU35-40``mn`&9Y&wm zQ6x*hYsmDq3N|)2M3*KhVnF8rg&{Z_svOs%cUOkvCof*c$%Oi!9TuF0gY^&?xL2d~ z*4AsO{(?Sj@SkFW_*Gf&nfY)9`SOcU1P2pIgZ14o)@gc>2Q&q@`2ef^o(525woC-h zJIL4C1&n0n;I^4lQ&Uw>V`F1o`GWkKdaorAR`IUc@$LeQQAc zO19*_~=g3vsbTP)q03u7!10@@8MuNw!mLdP`&vMi`$+3 zDV~G9D+8m;*OLY247ST_-HzITY_ceGUjK#*Kipo}{AFIijDPsxdP?(WZ*khv=b`d(>Pe>4I>4tg?ms*JYJijB9wn2+LO0(#- z@1Zak0dlGlAM?dDqH-BYZwalBd2rK1%Sb#;B+n;45V0IjTUqB!^%40^s^ z0Eji=COs)FI7gCFQ;Ejkysj$eYYCuqP#e5ti*GGH%g0S^ z^pX3Ga*lXa%?u5_H2sm{`GB#mwQ05NtMzfMJBz#m-xZZ=C!2?^4{hh1}P<`KRmhuPty$_SdVSl|9cnpufwu4$B7Vp4yVyuZGJv09C)GYZ#`t60@@ouS2%AmRLD)pC?*lh+0B*kb|IRuYf{rdp8Yw>dD zEGS%RGZ+C-kPY|&5wE|$d$RJY1m2Y(pl@?4PY0i(ZSax*FiWQW9}Xc`0T9hLy;2%@ zJ2!-DsM&3GL;x^OIEP`eaW^GaQ7ffMx5`kt(P@?BQ8?gaqppai3t zSjH5GfLqgTF`8-&+}!R}82$|4RXIE&;uH8Z5Esv_-Wqqr(v+C>EB_?pw@z6espz#o zjN>s@)gCS}XMAYZr?~U2=-xtxLUMH37*g)n7gO3#axv-)(iMX0l6YTM$5Q{pGo{&U z1^@7jeI9T-`f@c?0IV@&JWqV%Hu5dH6Ob0Ggb2XaoW-|I&ry5>96HrZpqo??p?+)M zh>3Du_(`u(@#a%FX%|}vg@X11JS|Ajelc_FA!3MAz;(Yc?i6%ka#-XCjM5g(mQy-d zmiW*-`T^gA2Tv_fTiJsTMMZVo?zX(Q$WhPBMlP3!V3E6+JaL4)tk>oOUotWH8hjD! zzB-`tEe@ep)ilpO@G41JTnL8MenrxbRN9+^CNb*dXirXAIh=q}c*tI`HkZi*>lnBl zIrNL)le`GNf@mBFS!NUNFd>Ct-wx-i6nn=-4D~rLaV`!O8OZPy)UJWuKJd(BnPR3;b0P8mD}Zn1OS^D=IqcGB>+ zsM}#?l^$)7zVPnStbus*?6k4$w%-6=Ya>Zr5hAlVgWoQd(tz6X)YZF6+ zhR_v2Pty+(o;E*J0f5!Nzp!y3`JxZPCx%0pT?DyZ$i~CPr36C^>G?UXjj^o^m+cKP zB15G~2f2~7(xme^eBur}kEbntdWv&j7NweH61g95H23ekp6Oo--pU))6qC;3&zN=) zyz!Qj_3QlGX>Rc$*)#;63#_h{iI%p3V7fh+zYJ2VB3PT?d+m<0-pebdTwGj6m3xX& zVrcv?tCl~1?CZV64Yu1^?C<=@In%!vZ0|PyyqRKIpO@EAU9Ya`@I6Ourk`rf^v1o3 z58U~fOjUu6kO z^13+349Iw%2<6YD=s^(tF)5UVvb2!J_WQd#55)ZPo+t3r0H0AgylgnbksQf9gj?F| zO&W{4QNm`@lj{4$tp6##R`>gEoLiS(HW!gDfG2epuQTjqt^h)=%E3t8>$O=|{R|8Y`Wr3)8;G-aBb|s$oOjNNY^7vSho@JO zMEEhhtWJDsHMsxu!lLFsbUG(d*cr*JBAn!7E4ZrH-n8miQAi~cl&m0;mff6|3t;hs z!j3+LjRQQDU>lE`jU3t~f^={=+74+LPnx)RttCx9j+@(g(=d7XQlxIJtMd-Y0a6EH zE==J5SuH(zFgg5G4Sa*T$+YE^60d^039z%RQH7CAcXJ}|2gyVpQei2*?no& zlGlj}j;Hb=kO}I(AeEqQ>R9Eze_8jOQ9}a`XrA+l;XUypL{^^@Dh&}0lwf}11GOXN zUwkS%)Q$tW*LsAdTN-^9XjR=NqcgEi*zDg|FY5l zOEdRBsrphlWB{MWXGT|&9cz8krK2UjfsQah;>S6umxEsJ|FG!K`$zE6e+z*7vDjGG zDGYeQv8{8!rHiJK@{1<>DU3KTV7ut4@9%RGmx0Z8 zg0jY-;U{-*z{PoM*yhR7p1+?AO_I{*@D$k7FNbX37nw{&F@?r>4@(?nS=V z0#V)T@7M02a9&vrrKP62?iwzWZGdy<>{E&$TL2n-a@kuI*ksp0Kk_}=UZ53nSPmVl zamm4UN7JW(JL!ZRS0gowjk2r(grEE>8@83jqnUgvYiO|Z8J1HGEIO2#9WeVBiBOzV zT>fc%%K$^$q7Xm!X-^X!$CM_49XQi6TxO+vXRJ`)`x-4r{qITs6|0lOow*`fa$@4? z!P=V1_!B%DSCtGoOu4gMe4PkX8%8?zh9w^O^mme@qCVBf#l;D1Mzd=Cq$ND}@t>nN z9`?-{jgPJ8x%-65PKLBF{1AW&e==(PSoXFYbf#IHNaE971k7^8WVq@pXN+1mjtHd( zQhChAa`zb?O;|t#;c6@b^qjfK8|n&algtl=^NeOzetvpymNMTFM+-Vy?gnI=~$MKrpqM;)=*lg!uhThUa z1D{3CiEUp<94k<@{$syL0`m=sLYz90X5aaM>u>|FLA;6Yrom(n!-2)C@T$y`&8qGM z1~qSENNI|IWNisd2uy_+81f*uO`gchM|Q^ZwF8hc1o_qGgf}6&=rh7;u*C3w0EzD!op;$LTPC~*6+(Oj?2(BoAQ3|)U zt&MvtmE^dCr&|_OasR5x+`qGFEObZfQTPY;Zf&vSxH|H=t)cmBx<0{`!vfbKsz zK_Fs18=Dh=K2(#ncfK>85opvfwH)F!W#H+l=gePtv$>Q&xw8j2@r(s5)G%FN;_37ckeDaHex+Vc}r{n#N#i*WB zau>Q594q+u5^i|g?F!(s_X|8GB{@z*iJHy%+SyRno}Id2?Xhq{pXqK+GIqmAbJlXD zuk)T)2d{}@BZ>z<^rl{If-q9ZQC)f4zWPuUw6LFcmvRVncYx;<=ej@XZ=|DT3(BWk ziO-->oI^^%11!0kVEzJ7)Y;~@Aa!ERb92YeF-1-ruR($tj1&?6>i8b?eIR)Z3L-jzo3_r%?x~eb2oG6Fl{NEmJ=ldaVSc_xq+Hyt>21oS!)_ICz4D9;SKjmVqVt zU4sIpl;2n3U=rG_`cKEA2MqV4CsxevrX;BPazLO@1|c1PCIUh(aML-qSfu|Y6aL9IiAAc z9(+ zMyN!$`VyI=|L>CD3n1Igsy%oHPjOXqh~M}mM#V!VEXpGLH=K9^fvY%*B4$Uq$= zH6iiLXXBP62;8>W(3?vqh%s%?^SZ^?w->S5JC6uG{o_u}iL;Ild5t>vnh#a${rd*X zq!DZ4$#t#IG)~)awxsq`tc6L#U4DP`f5R59*T)xb=v{%Q#ZqqDY%LE!NV~Nud&6wF zG!J>z@2Xo41`J{#?9v^k6IO^H zied*d5sQ-j$qWrXLhP;`#=Is!#Dkw4nOPS>k}NNcDSSTAjIKj_>Twn*=f33H>FfSt z+WYqtT>hpY3mjHM_pD zH1zJisUZBC|K=@g>6TIU+`)}3y|M!H-&N6wFC+FpW zMZXz}nCnV}+FV)U$iY7k1Rh~Vs-1bdZKs%y2tF$gztE=;t4r;$t_DP8*aw9$r71nho?wt2gy-2mDz65wzvm`doVHttGLnok9ecy@lvd)t_C zL)+Q5J95^iyTH!rf{@vWjJ>RL+DPq)=Tq2udtrbmWB#!gh_?IYx&JnA-2b+B$nr0` zN;_4`7x>3dgM|td$B5HmDGtP+EY#$@x1Zc>c6IYG{26dN=pQ~*+g%&y zc=F^4x6``bpuObj#&mQ1WMt&+1rT4xy(loAZVFZ#4X!r15>{*0{{U0#R%NzMopAi) z{TmkOv6$<=HIPW*pAbNo(*hQX0YBh!kva3e9lgE1vmjN#Vue~#SgqZHa*4=KLP}w# z(JIFmgW)=;IMrsK6WG9o`NU(MtY<+s1g-q@`?#E&m+E*(EZS+gA9FMJ+pW);MLp z8_1|{^8`H;9wJGg854mvCk2b4CA@uvG(>=BVQ&^dAm#9nz42d6{U*Uu&law}PtA@? z1J8icG4k7}NGmf?^Hb9ruXTe1X;x}~0W=Pj)OC*J=M|2X#%B4KgR8iV)4F~2T&bql z!LXB>GiL}DD~67aE|a@vx~LAEDqEkthJ1NAR;XTZF~56lf`7fPCqRFUp$?KZ`Ks_z zbAdmXSZ{%@7|Ka_#B=N2N6rK>St`Pyp(rpc3fip_5kDSa!6l0r7SiuJx-Vt$dIAXCtc zoecU4Q~4~v;beBB!BQ@oRmpL%sHo^?io|8L=k5`~qieyF`#YTOcX7CTrj-W3JW(ej zF&H$d;;x=nWI#%Xl8Ro|Quyt;c)&%sbOoS^hlKcCcXENBo@51TP{-w&G>Wpbt`$EO zv3V`l9BUfTC7=88N=73kQz4F^HKiFQA%hx-dZIz#XzBiY)6xr9F#(`dYXxk zlXq66`rbsCuQQZbIi+b^+4fU8Xz4e`se zel`QAzQy+k2~hwE?dX6Z0pM7e0a~Sd1J7~);MRXe>9BZx?i-xX%VDSH{u-z|@7CM= z_O~2ibZg(tBLJ-42j<8O#XfEp07xR1_;^06@S9##g7%jRWG56>Kw|so3*yI+cAa~o z4;~+f|1>J#A19tX1Z$kMlAtRbR><&)EOli4lhNP=Vq<3_-k2&+%Yo+ z()2cqy1dz7KAY`a2mbpAlbxr(6>Av;M|33e+UJ0Hik^r)4kR@8vX>v5{R@d_Trj|0 zm%-vFn4a70k)dh@b(j94Ku4b?UiKFioR|_V;If+wlH=ArGnO6Zd$GWbPt5UZg={WtsT`aCE9ifsjB_|=6yXC00T>P}xND=Vji_6s|0 zRZ>&Cf*moe0BB+6k|0BS0<4i+R8$3BBAc&=K`WL`DVQH$PLj+I*8}+t<&WE0v`3Vjo z<+30}@XfZrGhMd@$j7&sVq-awJgOS_toYxcSVWSt0e^Z25$XZj7$Z{q<#Q$&cf>LQ z)=uR_Dt(KDq{k*Dv4bo=CX805ZGEz#a~t?NPeJgYcKFR3_uNA9nKXCN%HbC?AIMc2 z+zB9}6$TxAX&#XGYQD*?n@^k%W@9?-5WOYlFL*c>i?H6kpC1?9^3u!1#nZWXD`X_d z`FhD`|763Vt{l*j9x4%JAFSq|g!m1ZF`MdPvK%SzA)w;779Vx1e74q`fvPO#ttV}g z;%LH~Zm$E=5n7#?E3X_gPCz~+_dqpMZ#UYH;9lyC3D&soemV|v3|vhZFxN}39ND~U z7DT!NE1eQaEY1JFY<9;Qk*=$jPRolIiAeRg=|G#DNoL_g<#B9d??&ouGp#rC{a~dh z&A;2gK3gbXtfm7H&O8%tjp|$5U<0ndP4*ii(3Zb!_K-g|J6R$&73P%p`U1wFct%|^ z+o-TN%x7xS!P((mH3)W0yp(=R&Kh*-PeRaOVltD<^y*7y0>4c??G61#sD59ki;ze@ znAeJKo^o)(qnz)|c5m@tdWl*ZttvY{==M+_zf7R?`gvo^d-L%Ye|s&l+Qms#M?^tP zAQBl95fugZGQXJm?F=alm*O{`<}{xE?07Q(vHo3NPOf;gt{@3QhCA{Q=VvjPj#WR> zEVE1$xYAeW;emPsrqvLBN`!sQE7)Z$H_CMaeJT9(_<+)ebZTk1tl(Z#k&{(MGtC+{ zQr?^VB0?#vfi?_WvgqmkW_=g=Db~1mD|KGq$A-8cG<7^d-Gp0QNR8+A%{LQu82m=7 zmm=fh7B04J0lOV9S-NV6muz*cDd-+8n5J#t;QiH?rP4ogiA=>{Oe)z0PZbtBFMhB; zzMuN~R5H03J7RDc?$UkEW=KpFg~@15(J!j6vF^YNP)kdX@x~!KxHzChRd$|UXkAxl zeOV};sEbG8II&Nq-_p}!u+46_T@J>FGp8F0?;syzt#)O{DiI{}O&BoRNn*SIZM16w zqx}-rXunJ?jjTcL^o7Rhgs6;eh`-hO3`jP{Q{Mzw$Mto^2PZ?Dr$M1S=R1WF0+EX(y#PrG3t>cYw!Uv7S4gYb{bg=Mw&=xJvAj$2 z=UK$v+M`(JdzQG8q;o(s^2-P~MwANm0u%tC4EEx+_n|lOa75S$Rwg~PgaY_BQ`pCb z7i{(g?rz@)Ur0vC_t2=}l_HMq&(tX3RI~u0=w^9c(H-RV{kro@&P90}SEwI((!gll zfXsU^mRxDz66xJt2nIc~UDpI9LjM@w7cXB7p%fA9K6w@b#rUw8Y&VBcn6nfL;m=KD zc@Zvk=@JB=lHjXBv9ktXOjd5KuhvvZvfo_4H~8lr(?p%t8}ZL`-;}>Ovo#0sqe0l@ zTbnMfbkisYzC|Cgsq_3C5Rq8p!d&zHC#&KG1Ajg?1^50)sYOi3D^6#5e!cszU?wxN zV{gwRWLeD6$(sumF6+PO{^HC3X?Oo$H2Tjp`v2*(V~uV=mH%)uF*imp5!mCW^fTv| zlzafaEe}jc(kt57iL3zVKOcC+4aQFbUSfYgpX`+7aPbELwS76&vdU~DYV zr)eKMP=r1Jej3$o_1>5ZxELL`;a0cDDG#fsA#e;PRA7^?2w>8IS!J3q`gky~{Z-yA(`fIa_#GR%Y(0#KD2C3ad4f)`!{JdFw^VYxUB;{ej?Bf|Zt z>V|Gg5$^zsLWm(vIyk(U(xt;ji0?Q2$XgS0#WvY-k(3!KDO(!@X=!T<52u&=FbRf* z+W=*x0|vuRi68VPpVEOLu7|x~(AgaHD`CLfkOe*+90cgma4>8s)fU6S5y7ZXYmV;e zEflpH69z3-h~OA7HnL7$&5o8@#BVS5%gutp=~A%6zuF66mrb{2ZgaL>RKmbCH_aI9 z#x4xx#orqQ!%a`*~KoIkTvZGy_P1Z5C%I?KrkIk^C+hp z%!sLaeb>}G=HcOicf@jK8ylRDGlOiM4(Nt(tig2*W{bFb zx$Jy)yYrVHsAac+mU-zVAw?P5Mvzk1RQ+K2rx+MkzQ?Kewy~+{X|Yk~42Ugkv_txf zz zGOK4i9Ko3*$tjh@m$kW~O-+IMprjBjhl7}#U?4BeFB7Vv!iDJ>l@k+k&K^uptjozcU23m26`xj)I~u^uN5(JL7vjqzsKecwPxa^w4R4 zss&F?2O`&b#UT(eWi9k94zh3+4FB=3gYfson|=WpRs7 zwy5HQBvVsJqcW{i?h7I zX$u-krP#b*z3hs13t8w+f!BJ5!#%MwRk^-OaH8;YJ|ZA5`G62yiyIhl`A3bp#R=XT zcC5cKNrb@A5g1ye5OH9)`(0a#*u5F_37iJZV?{@mzT1C?ORB?k>^C)gy z@_0JC#n-#LDyN|aFy0+?LXiO8aaD=d$_nm()J^M);eeE zx-53ZFmavZ3%Go&ldaEiNT%VHV8XT8p`u(ud}5-*X|avP?d~{EOB+Qi2;*l!^9)AFuC@3H_G)c*G34Ut(KyzcRPqt<=P z{3OND;MWzY=yFhvd@P~>E&GNL{VQkjTW8P2_G_HKm&?ct7+^tW{P|$y>5y$YP-6`D z5Q>JjdIQ|?(%5M56>@#m*#?#HT^wzbQl6Q8eEp-C(s$OcW!O2xT4(qSNr%+COcg-? zZIIEOi@zIr&Og!^^lf2y`dN9~0%_l6Mn~f)Pf;FL#)0t8{2}Z0M>iqml1)J7(S<;U zHfV8<822~4^$S8uVuWZ;t@VCeebd(Jax7-R2YSm#ah)^?oeor92CD&;ACru4bX=;; zl1>vkjia%venceX${~A=#Q2Y|VwnNo!d&-VxeeO7JNyPbiF4*ydz}yG#L1K#l_+>! zO7hnnl*D#+cKXi?qT{&vb#&T9*6D&L^Oa&dJ=47UmNBTk=eAD`Q%_sT+Z?dkCWcB5 zV71caW5^VfA_v8Ul*YrFac?QP)@KT4n;ueDwxQ0Vt4Q#QG*|=JS-)b$;R{G(3m>kQ zrSrRZp6=8hm6bqsx+ha^8|oMh=6jeYxIgv-WIM8+AO@`AIu$f6`eqv^;B5cq_r`W! zYk-L(Q$Dp&P1j67yxmN2#lyy%Y^D}osDg^ea>wkW3*mnqk%*oYL_n-Jko1tI804W; z_be5o(c{WIlYeuhRKRys7zb@xKv+}cK<7mpWAKe0QhqI1McNRkYTZCwD$rz$SH(DPbx9v<4DbTYwAuw=EB0US6?WvohL>~+L8tmAXy~>Z#=<8m^4Joi-T=J z>lWKn1dAgd7kRhB;|@#Z((2dGO!u7MSPL4Y{#CH$JSE%1O@HyJnwxhlj0L3In1F9S z-S7N@|Aw8xw)`w81&w(JmY^~5R_$Op%dJ{{*4{z{K4#ie6*wD;r@z@CaeE}pc4Dd@ zROuY&cPL3(denrli(aA{N8RSvwLRsDzIn=5=ALtcg+U;6%4$;MOK~5v(TN)pJpsITExhya!y>=fIYesOS)90m&0k8^fA;}-lsKQyYc|+$|gHdS-H#lP;coRA1S+Bjnr8n3r86x zH(*vhL;EYnm6^QHOV`LY3mj6IcWQgBk?bXGr#h@pS1xtKko8hnD`kB$BJ0i`FV8Xl z3MYbq+Hi*cpqZikb3#*8f3$)e0g}!m}1rH_?s;Ce%Mu-U-axV zmFM2hkkm*VPO6CWb%Yhh!wc~Up32THj0wWGdPZDHH|@*Dsl1)D+U$ELp_HG5G0~QV z$ETqe>knPxqvwUk(1Ms`mWD6`@Lvv(zoULir2!3S{FsDXiw!HJrE#DvX}I&OW{{ci ztbLJB!g}--zF(?QR!BT}d`bkv=+e)P6@~A2#L66**;CY*ql_^cbC*p>ezD|Q^g2U~ zQi16eOK;kpV%L6Oy(>UmhbvR7<(wKqb$0oD6D*@%zsUoZU%&cU)TE;?;6s(xx9kJ& zBp!FSZxQ%9mR8A&U0cfFt2R9NWdMXHpnhRBps~MO6nOXShg^ji6&HWui zMr%FK)?JqU0A|a(c;53B`8{_oyv{u_+S9{L%@E~BF9qD6UoJWYc?%2YT4_}VuV$T%KaSZg-QnhmF8&)f=@lr9k7S=>0Ol(k|hN)4hoH~r}nQeLR)wf85 zAWL}8Pwg<7;MCi$<@91VGgvo+Gw|;Q z_sun2O<0F+t$85skS`I}pvIG77c#dI!gXVVLO8dP%0MY&s5U5n-|UUYGuXZ=XxNGu z)}^yRPre!)F1eiNNoJj{5>k4`QQ)_B{;XN35m>8?4*M?G;Z-Mk^VaV*rvg*Y#Bn4q zD{Eb>0B1`C!u^gIxIz^Ov=WkMu6j1hUh8iVn%b7_mywxo&Q)^s1;jk+4k4YP-*^YO zq%S0uTr5q_dx@;&yq%?F_di>x!=S|`5w7Hiw#20+XG=@zDG2e zs6|I!-oa~rQXnb7m^bu=?(uLG&v6sy%he=7n(f}x0Je;v$(J-aaIwyogPpJdS7QtL zK7{9T+BF>MQ%#=RhLDEh_&vRtN3)u2qN4V2VJ2}D)?;$*tYQj`X}S}8+7LucN}Bd& z`yfTZOiswaWZ)_y-OP3|Jd7J26VJvU_HiP*uXpAiX+dy|o~CBOnz`IF#6B-c5Gm&- zWu~v=qEPwD7kQhH_k?P;g3e-vWAtJ|)77v(IHsNG#(nKQqz#N=eE3(ursqP_`7uIs z^3WP!rnuju`_+qYXjBAhK5RuW0ndnjTMj0-CNU%*DrEm)rdVu2@HREoNF-68E~lTx zKDrvG5v)$|GqA*Mr*{m}5vIOgrzhj~E|xaupMjtkkBqKOPEQN}nJW`?TVMUPJX)aB z0Wq&p>f8b>Y`8P{nh!SZN1DK+tV}nPhKR3^6G|d z)Y?YoC)qSkNySw?O$(T@7g>(vX>a*y86`G`4n~BY7XAX^;R|YC&vcaFJUkE5g|6>g zvPQS=4x_V;j<6T4$fkcgFh{zrk`O^xV?~h%ko#fK^QY%%my>%kHWoOC+!_Z*-e~YY zG>O(wfkExj3*hweRnYiAd`*G8;Yh@MhR};vL=TbnoNT>ONu)M1-+MdM5cCH+1sa5 z0j`&Cx%7#?#${s`Ep-ENn*!WJpOFLo1U~6P+#?e;)(GGTy$IKs>KT?b$Q! zOh>tAsEf_@^soI2d7qTX<>F+i5i`Ckf z)w%Z#wInx3ABPvGsaQ;11}4_X-4DzfT%Sc_?xi1GFX)EDkYgEmEtg}eT%r|xb6$v^ z(>6*iqNE1#$3stdnN);piiySs((1P78}^RLc>HNyysEoqTU%*=@|DE@ z$`{1^jy2VACIsg`S_>6CN{LRq<5HK_)FOR^;vpP~nQRv&I1gmNVR#PA}wn(q2Q;5qVC5*n({`kEHb4DkaafVl}yB z+T`0QC8fyM$}8{t9OhDrd5#$11c#|TH%Kb3dNq3OU~o^Q+6yP^>UBgwi)D=x=7Q2)B!=1>~a>xWETg8}TMC^gr8xdjNQ zNNH|q`A?u1y|XqYNYXKyznq-h9bkBadq)B^;L>-%BSPvHh}bcLk!WFe&o5)m$s=X{ zKD~X$48D8ub}I5nX!sqfxLrsMG#;3O_UIQce_Mf4ng#ylA6tE0{Tro5?227N$-CDf zI`sI)9UpQr$`<%PY&sIh*6lZPl*_7g~y))+h$1uU8ofn^`x@i!tMwt~k% z3q}@?Wp4*tDgKj}uEC?<=1ZZljQc#q!&B(N9&Ej2#on>Mn`J<9p5uew8bkH$HDy|H z+P@d%@4F4nGyG(Jg?Z~La*#Gl9az@HKhTqp7bl=>w6yn8=%i#EXCq50m{%3F6;_^- z^+$qo#A&F%hLIMm80t`aFLtKeh!%VtsAIIz%)hu#1hnX-jimPt{6}8C20j46OoxKO zr}6F|Iz}OYD3Bi0&(u_8oY3qxf0=Ko^6Xd0AlkmNr~-S!*^CztAgHJyqc!n-G)jqZVLqkXrc{Zj~mk*=NiwhwhRsL#}~ za4-=rZ)y*0if$3AX}|t;If<^i@py-V7`46})#C~;d|-n&BuNI8ul5Q5_Go3`S{t^; zdt8+#(p60)#*rqg3f}Vu8bt5919dbAfM570|Bx6d8G!~A31NJY%(};;cr(XcI<*6Q z5upH{G)E#5l8Gk>vF-Y#2N8EbF|6E+m}Wgt$KFjI=DeyPdTy==+A8<9Wry~q7Un++ z(xE2-@?gxF@hPc+3U7k7>1c|HjCiD^(lU@EH$0556-#d70!N&OM1xTYaTDah^5GF3 z08p+L0!Zinevkh4N<>17O+o?A9mOmmfZamN#4_*V-Ql+L3FFFaH$CFlp93&(J4QzdgK=qO z92^`1NPrU|DsITXhEb#e=X6zV!>yO)bn7OH*Gb=2)q9Ul2ii$#p3~a zIG9Rp9x66Hg6OOm9p$~BN#|P5qdxOGXvc`n%mlO<(b3a$eO!I}f`Q@p14W^QcaS9P zd?SLt$7}Zjyf>_WlSg7~a~z~&UmjE#9ShLt$gRWzC`>k4yMc>|fHswR`0w05Bb%69 zK1I|aJN9sda^4XEBSH0@yqyLEi)N;y*mBHgNaWJ2V;kh=`c(Y#V)3Rsn8r6mMeOV$ zH8r)F-AgvNd^6&U2=Xa-kg-}`#4D}j7sm8r{h+_ib_r9KM-$s`LTKv28>V2REY494u0W# zh0sCKn~EBi;NzQ#QUhidme>LslsZV^aQL{)Pn6%h^Jz+kpcKg)N~zgO0d2Tz{S!jl zx>QFSnuSzXg9i+=eYOSmVQmO=)j;devL-xZ1PAy%muWjLn=MwpMuBpc^TyyS_q}g2 zPAQV)`0;zSmP6FJ1qGAkNbU#!Ib6O^${t4UgD@%3{BFmp!_Thsx$#`M36Nh3>6suaXt{# zH-Y=^W^Z$hZ6``%1^&e3z?Fd+%`R1xyN6V!1}@#XAgy=7b!847$G>$dPTtGskP>K}75PK^46ocf zJ`I=CbF&OsT=V6A6c}T)skY~R57$Z?65Jw>Q;qX&V-pspU}0ei2@mf)UG$4y?hLlg zr`x8t?}neY-55oou0?ChtckvUsvg{2iDI3U{_fHZlgA*>bN$>EpNe}-h5!(-JaWs0hOqN0UGbJ$fc1QUaPOuG3uz&V0Sn zZ29bH176>Dg?)4Ccf*9T2r9kraydpL`IMEFl~q<6hr+xcbaRpvAxpb@m20G-1RO%3lFr>ONvc(x2~329x}Vo_`d z>o|8qLxdeFgFwf`M2&+}7Is)9=C`Xdx;)+*AF}Vy<=9`S?JzwZJUl*(jqygbD4LY$ zeRe?()`^A1glCU{xH$HrA~goCfaR-Z&v$dHjxqTg&Z`|M9zW_a^!Xjj8kD2$uptI3 zk3#EK0=4ahO_zSjO=YH-A2$($bIk@R%>FIaA?wtM} zE1cm9cn*~!yIOGzph=zeCBu%Eh{vN!dOW^d>ai~k5aF)uXsaN-Fnj;Y;S9026zk;l z;pY!x;$@@0%-1(b9pop!CO1@asyE(9dunCwb9oS$5~#<-;RVPAh`vO||FD_FrCOv3 zXe-$^?CNd_rp5(n0CI5fX|M@AQ$v!G?_c!vyo0`We|pX=xiM#~GSsykNEE(ZbNcgx zE@d5BQO(o$dFdU|`Xmaq{`X^oAUBJ8x@S%dWX zgW>k6BFpi1+~tY0QkzrtLrSi-;=($q$G0%98I|0#u;BF)S`5w+6dV`h?P+YHYxwx$ zP5Q*NXUygKW_#g*S4p<>NxBZM2B>(5xVK9OO1Rq1=?=LL1v?&f^7RJ#7;kqwr7=N%q$;0b0=F#(l74uT3S2s@7VG-4j^_@YLv52bUln&Y zHp&Un7ep$7wl+{^iSyB|yNl*Z8pF{1z$?EupEd+wo9RrjV7Aw}xnFNO8?CbJKI+RQ zxcf(Y>P{ufH)@+aPO*#*!#~BycH4^e&zL=RB`4P=k9{e+AjCwPhCZjWddiYq`8MdYZV=BGC%pZn`?;&A4CInpI_@r^|h~ zMt7LI>uhW+&zFf+Gs0Fn8h`Ns-v0-DNW|CNJNWKsog>nCG8uqCNumn+9O~Tf`jR3I zIWkn-D5MmD)840oEv=I@;RKteSq!FDGrYZ;dKcf~U)5YFH8hFQhliN!1D}rtBdcmq zhGC#Qs8-{+-=5E&m@y5CPQ-yekw0-h??S)ka4XFQ%69 zz_HKjTbs=Wn?4-uAZjVEo06C^B9kMjeZaPVC>-AAz9^Fj=J&w^PEWr~(%HIvogQ2M zI)ENn)%HRBd-cVOuFT|si%dgp$85>#ZhiA#&oF;P?(Z>0r8o2oI)LODc) zb`W!nLeS0%3RA@HN^0GlTIWMye7}CfbenRl8SuJBjrC~xaOmw>^ISBnoPDy|Nfsc% z6{*%O7<8scMvjPEa60-*wYBKCCK0KRJ zWHOKEk}!_f6}+koLIL#k4BJXBR5}?!ltBQ!SV`6mnB+dCOc~B$%QzQ$Y^^8wRs>AC zFE+05VV3qTzRuS|70$IkN}iT^^&C|~FHXDm^fIhQM=*WPaXO-Dg^OjP)g{-CNA`3N zp)QpHiA2{740&oHKhX^CeA~AEWXLf%3C`kik2Hv^Y~JuL-<-dtP$HA z=mm+T%hLq_G5G9{hJV8kIea|1!rZc?%(u@fX^6+eMgAcyIz|TR%M|zzj{~@MlZPUE z2Sw=kXEt-H(I{^f`A_U(28UonbRe7`qLN!)rmo4LDF5GY?vnq1p&bU>e@YBFNV?l} z!C%aAmpQmYYx$ZW{JT&7Q)HkJaQLSZfp#~evha)Bx0h?A{?9bSeaZB2!BMk(P`OV@9)#BTYeLX>NIQdjK@WowB0NnV)j{(3$lzK@ zl8OePgv7+u_l6fIR*Syhrd`h8o>d-G8klZgBX$XCyO~*8xv~DqchJe8#9%qaoeLFa z6oMtX%$4r0E;i`}wi-;DZ4m(3k58nmrXKyM8WIqKGZ>Zodmfw^_yZ>#rA}%oToW-E z%3&Hrti-^P8~;moO7V~Pz?mxk2DSo$3?}@)M7vl(7obximU9Gg9yO{$kLYXU1T9RX4mx$v<_b~{lx>Y|!7c88j1h=S# zq402;K-uzGEHkY`j^Lqr5OT!g=o`}?%kTA!hPuh&41V7}El@i+xoidY08@kF8yi!R z{{HOjmj}diumyZ&2ho>^U?(L*Ute-?iU^le8VXndC zD*_-Av3zu5b~DroKfpqz1#>U93Up{j{TvEc%8i7>J@>_;_tIywj0*NVuID{pdGDqU zo>6QlL0abxhx3N$ll@*|HQH7sJTr|gmEns4 zCk<0t0A9Gt$#Et6^56Fnng3I#0chE1g}m3pQ%_^|TvWd;Z-$jKo|iV1c19HDW#n;y>IE!otU+^rtTZ<)j}n zV38~pO}HL6>L!0qr|1aGTrhoa$2IY0r~AynJZ#T(L-`p2t^;lEi7=?{i)Lm9b{~LivLeRvp=;xPnAHq4LYazqaR+;5*K0yzqI#o56^$eiVuua z-5zh^IQb1zI?1+&8IK3Xaly^meS3DYHpN^XDO(VIf4=e}9~a*BXIj{0(9@$gDP(}X zYcEFUPf>!fuYeCuRNjVZ151CC1{j(HNEu{w7T)&%@v9B=$K_m zO6sybj=Sg(E;V+lv9z{8U1oIgZee1D|MqgOaq=MMCNHKiPNU9&xbTo!;3Bj6dn%uC(+d3Z!S@%2it|>2bQOy?w70 zkNMew+W`!Hl9jeMYVR{yv<=ycYybc{ieaW6ywcHm$i!sZk&-g(V!)Qp7Z8e;Oe?{hi4Uf%uO_;;hyrLz^Y$(vSUVJQq zvojU=+)tdVqvjz@Kzd~-GEHW55$uD$uux1q&o(kiS`+)XTkC2mG&rZkts z`GCY8-Z%cHrLo-3YnGh8t-lm{5k(@#06A@TaMeoAGOYRmi}a-81SDgZ0)Mmqu>|e% zl>6$#C!B`0MLWl{N&_DCjBY}Ar zTbVgN{i-di?ooIe+Xq2df>l3w-J%MeW`+|y96bCQ8fy|@a$&X$EqSIlGxb)VDdDqn z-G?e~jp8yg%4mCU*z{0MaWr|(-~QGhR#E|5u5a{Hr59TiHoD$h_LWyx6@Uc zq-o&*&%n)1{Y!#$>ng&1rhJUSOmUi{je$-POnd>yg$DuF3SlFae5{lTKBT4}{;*OG zHT11KT^IVQ_ zS%7>-M{9gjvV@5;QWJU47VlS@t}2*=P`{T~r-82oR4r>*f7-ycd{%8!P`w*o;B5_6 zC%n?2d*goByp9Xx7!ZL2b#l27i;zX?A|cDRZ!%PMq)y`FM#w^JD6uAK>Ata zSYYjt0BNGku$aNKpqg)n-|E8ZWG2c8j`BQR&x~nWKi(P@+Rd zr)Uk)1JOx*kIMW+olOiv0fqE5>&--srm{>L^uTGlg{nxZ-VcmNF=XgZ)LOWtAo_(2 zLiA!>h11OVr(h#rSr-`qD>#YwFv0NSJnQ|eOYoO+_na4mz6 zLTuh#h(uw?l>Tr7jcedSKV({+A-qMKO?KSbVvIaU3JXjRuBW`$E{aCQmNrAa$Fm4+ zI9}?0ZI3AoQ5uxg{>YyH^zi3*JqkYf%tjj4sr$zcf#tMVW7Uwcu7G63<(0*LIaQm_ z9--6C)$A+g-j@O#)Z&WIOe)wP7h zNMn3)0Dgjg?vGoiPi+|R^8kgg31_K+Y%(s%=C)vm#EkZtJn$6gMW?^flRRvJDr|>_ zEKQKySryV9tY0e~y@30!=2#fmgOF`Jyd!J+@+vjfTY+Le7|T5|>H5u77N!gRq>v^# zomcMLp)Koyz1#KZa}_9Fl!5-`B2$GJ!v(&DtKqMlo$)=HK{O%~tU> zc_Vr(73zCWwF>6X&(b!h$|46Vv$GXJ!g3`F34L!%6w;45xFP$bg)6nAsaTo1r)bo~ z4=S{Q{n6aIB!Oe-sBE#tU!sAn2uitF zpC^Eu_gM#T$L3IdR#3W>(G*n9oQh6p|9n6qJck|}NGo<#vW#=OMX1Z+_S}$p1ikdJ ztmK|~4%MaeG^^cXEaIFuSj#IL(G}Rjv3@x=4>#2(-?&JAAS5_UMw5lAu4x*5IdlfehMvZp>HtGw1ij z?Sw!x>jraaHUjbx9gX!d7GUKEh;DH{Rn>~Z+pBnX{&TLo-Y--|^&PZtPGH}a1^jmO z4S_W(<74OKJ0A(PoiYHfyoFl7pc4NSYI?r#374*v07%-EPZ$_;F3n(3nta#9g`!Vk z<;@X&q{^E+ac|*TekGZwoL;W360zWg(|d+gL3|%;Ad`Y;vR_fz0y$ID?ElTibU|{X=~a*+B|OP(QaN3g&;JAp{B#Vl zzRzQ%M8L#wlrNKgY;E|L;bw1L5~wfIzk8E{D&#r^#&rKJ8Ql?F>wDFzf63negZti6 zO%&t(OZ)Dq?%x$}dGOsD|J|GS-*lD;m}??-fJvKM*-o>$Ufse{tMiZVbtUzAr$F-r z#bI@0GK^5Qm_&iR6ZwA%$H>o0x2u5?3IFoR+W`~H#33iKK9+wP0a11LtDo0r8=3Ye zCT4xM<2?x2HZ^t%v?fP)eLvWQ?VDr2`hfLkT*bsfL=6lr!K@sPPxw*J>Gmh*mTvRq>s4FGEdL@! zrGl@(-`oj`6Om@H40`5QIuRpP+=iT-k~Zp;+DI?6`HVMn!}4wK7DVR2&IRoWToBSq z8Bin&@rCzo${;*Z?GAtE#6Av~)P}PC|EP%4C8Xo&&K%wsNOlhRkN3Ys#zL0sj(>24 zRlz(GhX<<*aa=vml)CmJ0^9cKkQkh|BqjaWeQ)l|_5sdA4EAoiMF!n^hDVbQi!yS* zS&+yQsm4J>?;3u(1_Oi45YMWHrzZKr9%#$g*QsgJDuR=hqst3f*_v=_ZQ9)HAlBv{29`heKkW#5{1~Sl zUkm*E@|l8TgJ?>*!WBqLfj|raMQEOcHy^y+mj88v>!V2p$E=c?hwuw+v$Zco@l;z_&nk7B ze$n)d45bn2=L=PN26y1$)loon9GAMsO?UJOzsH0BvXIz=i*tzN&SDj1Rx{6PL;AIX z(}85dQUhrDc_MP3*E<8OB8V~h%evM_*ZHL^Q)yjvbLRs*H)a(kvG+c|<65~3e1>et8&(iYb{MMjq z%d$1Yupj&0@EL3fSYN$+rd+DE^}~zmd-Z{;&FZLQ<1gn=5!cv4sHrENpY;=OJS>}~ zk4nfs*5^7Y!Olh6yn(Wz{h?m<#@5A)$V7&u&GRK#voTX?RP>}q5ri~JD}o>~ z!Kj2JLwr$I?bZ^rsth^0_=&`yrUIIT4U4LP=Skbs`6F7I*1RIv9O2RIrkk2O5~wA2ZHnDVh@!jsLQRu{1@Fu}LPU0*jMr+)J&#DpcHahv zS{vEoWN43hPKfJx>!<8ro(YY1^!7P!=AIfJW+&g&!^&mo zz&H+G*cm=zlYy3}CqHe|aJEa(k5uHjo0R)?zwr&3`M_)0=%ok;2bBB+0@xs^O84J} zC1z+Jr2T%O{^Hd7T3!gQZIb@Hlhj2r?*roa)JOs@R;T96D2s7Mffqs$v0LMY-aK38ez+SxV~2k0p@+B8{a9Q_lu@xaYVGxNOpHRiO}B z)di61d6A`2MtT!YcGf#Vem0XB<6oSo0}(heSaU8XCN;GU5qD$A)Yz#e0CM~eU*=bh z;zJ2~Zo9F_>D8X6rKPA_oh^*(@U*fpdxAnQ%2~hXNEXxn1la z+0v>;6Y1M2O%CW2UGKG`-Z8EuJ+~g1RJSAT(4Bcq{~qD>;v1*tP7dmJ{0>((2%m{; z$u|9(kd(!|(SWB>thhd;>E+XwFlJusYKl=a2{Kwuy|o2yZnqrQqxJC#RX!AHYi5&8 zXO*efWRwAGcFTelMWPu#$2)bNhwLE8J!lP+7loLLh9BhIxWaQ8I$8 z_O09xU9*=c+TzN;dvJ^Xqzinqrc3}YJs3=t*HVaqhrcEU=t@YN&+UZ_xzOR~Yc6jB z*@I90gP=mRufBe@w5ab?r%Z55Jwk!MNA9U?JzIn$doG`$sSA&BFr`4}dg(|fu8+$r zgvRz8Qm8Ak=jMS{*__>liPM{Pu_{g-Dg?0|nOErM(qvQ=d6gH+G5!|u18p}o6X zsAk0^WL$o2|NpM&q_c4G5d(9rZy0qyc(MDpTvZ@`Vyb1=fjVc3>sR-wW(8R@!hTr_{&V-Ukv0zx&@T4Q zCDsk{HY)rsECS068KXtcF*rMCP@q52{WHSqixYg-o>V~|qB)IqsDfD{7Ss39`i*#1 zzop>6g&3MC6sU}iiLb!z>pGXVE;a0`>tr52ue6ecL;m}%KvbiQSl_=$7kdpYZSD1A zYdcjCTyNp)49Y3pI_0KtF+5ZUYGo8No>*U+q<7xGr4;mi_YWZbpZ3uIRkg|f ze^iKWOHQayZZY!z>McdVK8saN#b>+A=7?6+Vk zqf8ZyFUS_KTJUS=C<_J+^WHtjmI8e!AW)xGUDE*ZJ>(wA;aXW^`ZF+qUOMCQlRlu^ z^mmgFKOwM=z_P9>iWUxuEpL_rvHXs9yBwgHblQGPbcvQj@fB%P^1z=y5H(q;VH?_X z(1xnl5jl6e@{+%EX#<&{GR z$A!Ma49h8Dfq(*e`G^e5Uj>JU>Rr-~uYa1-AlY$#e%XBWH8Ba6I}o)Pu=ZJ@tM(GV zk%vS80p(e7qx-c;s*o7;yzGGcQ2C9S=O>!W#7Fd52Vv8f%!LI-!^N2#B$MaxdPg9{ zAKf?XswxOs)W)wJW+og_&xNqnSS$7euHqt`g_aG%@*b_Mqdn%8Qv{eFng^9j=s+ea6d!Y%Gk(f=U-b+6Y zVxq&Zun-6fT$}`unBF9=J)Tde?b$sB`UjA5>bUlDQg#vCq+1M)p0aE#kqegA;o9P? zZ|07ld~nyj*MYOP)fK!G(JqLenbe{elA5Pm3&RU5`}&+uOdeSybq5gbWx;NGt2#;$ z9iQ4tL$$Wgu#+Wdt@>AEw(gAD&oaUn@-n9Eg^s&07PwT=MY#T`1P2R`ElTGn`6@r^ z1)|=QEG6Qt>x2zKf3A=J)p^RHME0>4b;s3Jg~09ubTn&SD2(O?i9ySc`tN6Gan^wY zjeCTLJ7;$Ew>Mb{&_1(+7hNxMpEJ-tihtz&?tn?{(Wt|P2`}n@BqUu7v&lrK!cL8k zJLn0Edu>N`qC2lD1@L^>?{9_5zC7JE3A?JuLkfAr5+{Dih7SG;7DE})@Y%X35?;l(3Sx5jCNN>%kp@ll#UBZ%-ANDMoBB=9-7+F z#n&F9C}w*i;**&>T(wGIL<91fgyoLI;a>8!NN81<<56EPr#9A5=6(*dxcqh@BUFLH zaUZB!!ngfi&Xc7P9EYFVWMig&mA^Fxw26cyjhs(7TCQLIV&UNPbks1nu%E44ZNy_N zs~0wA=$dma&d1Z=Zp$*u2gOX0R6OJ=7*b=$LzT_lF^GVu2Kk`=nk(eH4(HA3Y2wm! zq2=Ej`R{b(o1~#^uk%pYx#(U)gNXIZ-G53dI`hIj;-JKRce+z-q%6j*c%gf6e=XH|tlVejl z$nh}=H?*2kl!gt|?bwnRphOfLEk7<31>e2*x+WdxyBQGt!sm<=T_yrv^kc3!kiBZt zu|A!zs!xdnMyb=>CxRTX3!cbtj@I&m)s!*}V|F$f`}eeoNn1?n6WNL^oudHZ@$#gj zXGAJOUl#hlyziM5BG6@8@Jxq|;z26F%V{)JfPs+(Jjf`P*q4-aiXaxpm3haH>VM*G zdYwplKqVC5d#`g9{OJV?_~Ej-%l4DtLf8Ez@$dFqh}h#b`osNc&=#W6A+;l1mSwik zBM8wA4NdL3lU4x*h}MdLI?keFYh4`Q&Q;95C~QkTG%j~8d!nzg@kg7IGc%td`YVf( z+h2(nPGdn(4VHL0xEz-|Ik8P19!nyHNmw8VQf9VISc4XBnYE69-=41S{+kn z^AB)59*?%lEE3YF7*KmHH@BSIDXxf#n-M+DS<5hx?7oQKICkfki2#jtt3#sDW{hE; zw1EX3>*YTnxL?-5Q7~(_TBf@4de2sP?!HnqTU4Qn3DmNG@1Qb9phm`9Ikkax_ruRN z0#fo`Buu;{du{7gtgbhthP5`BTB)Ep1mc%zL>gNH+vClzpk@T3~_;A^&=O(X&D)cWwKvnOQy+=TJQh@M}qpV~pJ&-bHCz-ST%I%rr4r~U1!7v;3zKgEYo ztwLIoo>{YOf^*kGacJZHo^{_>P}HIuoWIU(x)yM3!|STlRn7wd#Fy&9aQ(3kO5!0I zQN28_S3-h4V!V0lC8Q=Jv67|x=gc@l+0S2qq{hmGr8VoF)|h+zYDZU!dvRxas{tyq zQbTS~Lm`xYPYD-#hRI_U57{EpA3!{_s9@3`h0e{YIiI{fpnM7HqT{E213j?zg!J|| z-%dA8-w2U^6;$<>Z6S_a!=>>Gg@rdSVzS!lGCL70p0MjJpL~}+_G;O(X(ZkHlG^Ep zkjp5x5Ed(*rS{Ak+K!-D7oc7|iYHK?5qwx5N4i87Oq1;Ba0TVAt+uU|-myo4T1Js8 zjE;TkN@;Rb>`Og2G^prT2|-~BQe>jIs{4;@ATivG&>}4#dA=$ZC`~Ob3>bm|@MLKs z`UueIJVXH*np0Gl9Yp@E)tyHvrmMNK-@(dE4M*PzLk2sel!r?yWa|DMj-yVB20)`W z2J9eAcZ0V3TMS<84hw_@bigQXs&>+Bfh0sXVOKH&=+8 zjnZN4__^9jRk9%3Ra_d@U*}z7u`Cn}*FN>pUKXQrb$%xLxQ*0te?#nZS|DaVUj6K@ zmGj}O$Pt&yW=3-7SC)`2yX~D%EV&r6ZrH|j?e~M39qtuYW8Q-po`(wG`?zN4<}v6O zw0(ws^8%W7^OM;@%+q8q^Eg0k#1=p*_JqqS@YRNPhHKfhtYo0xR%%gc|Cgp;jJU9d zqOIi<355c(Cv#nhDa-zawRZ^Y@GGD5S}u^28oWr+B@~K!v@E;{Xh<9tu~etMX}5cFfLvZs^Pt;aIkL z_@iTAAWos?VtJOKO-mXDm?{``S%&ez+GY5>HHXT+@X1R&qmC{>ceE)An29V65c;}&v!(qgYD z5YS!WE1nxF;^NQ+M`*5^_q1b}fu0;F=z5=2DXSL8`#fF|u9VFj;T^5c#9*Z3rGloK zeOw`r-L;=^R*R%t{bS!d$8@>D^qFc#xGGpIoJkjL$Ti3a$9Wz<;0ruRnnY*%Txv5wbs=a@#5>DmOaplKpP(VSWD<_w*OH%kjWj540#}!==iTch#;jr>$(xm@Yr`&k$(A9d?VkVV|J z*u4)eZEVooe!y6mJ+Ws7J8eg7Bhv5n{(V_Q!Y%@(@hqGxZGNMRFtseF6PWyrWM@(y z$EM|f-5z4JF$%=#D`=8#brN4>lcV~TY`*D#oF&c*)7+jOv19!{FCv#l{Da8&|IW+{ ze94#9t_KT&-zj?vqG_)fIdl=L5&n6Z(DqIZsEv&FKbsc$r_MAY z(BPsJ;@GV8a*|AFX zd;e5`4A?+OiBEi-7EixVmGLZlyA75utjosQ94*^EweAe}Z$}PlTZ>r`)wilKCSbyL zho%%apZkrBc45q%y7T!PpWJ3#N-kY6cWa5vHjpLvVN1xx^`&}zk_euCp|L`#j1&zz z{8;c-3}rBZgQyw=}n1TRHSo7!5kDTR=1puJE>l zrjHo#pjL-@#TTUw*$8$Ggiti>)qv?gJ)E*(&u-qF&xigqK$BMxgKf}w5*bWIXBK3Y z(v699A@HBv^o4AyiqBn7MAQ~RAtrxqZA~r?*sIp_ zWL%=XYTWiy097@RRaVI=f)J3;Z`T$L62t?Pm6@5_ttJU>fZ5Pio@g7qsGC;V9P|!M zcsckytz)2xT&CCJJGImxjfAHU)4Kl@N`lgxDs?*lVt-ww6@RI~6PPKRFq!bvE75I3 z3XCfiNxn&RoDH$Vr0!n?!pI!v+tdQ0FR))4h$S=AQQ?k)gPvTWJ@nXoy}RQ+w>b$N zKRA$6-FQ+D?>IHOw8ys)bhVA7vk3J?P@obKb+3*XYmnXuP zaoMpy2MQgIvtuJw_*(QCeKT?zSb}fZ!qS}QUy-1O1d!9 z4cfGYWSE3l=ae6q*ZcebXjFcQ8v`0#Y3${64AK^lz8CRyA?#T8H8XabGZ3Zo_kV9! zm5L~Vedz4eMD*0f4zrEB8_H{>$ ztt3q%rdCQ5LHhc)Q%yz0msti;Dp|!tgT)?)p`SEwf6SMYn%C9iZfr>RmDt4z%YU3% zP6Qp#Ffu>5k+fZ;n{kgfqhI#L99?Nw_3K|z`ia7;%%L>b6(Slbh{2Yjjm0>W@1w2w zc&G9;c6~)0N3XuPe2To=tS?!HqIPWj^hQx?zznUg8fivk>WeEP8 zKa4n2!I06ruZSE`RIos*{$o#Knio;)b(s0ds96^5IILxOrhPz<BKSF&P1F-hWVy6n=gfOZ|M-Wn7oUpuvTUAT_a;xGL<`>}e>X z9gV1+i<29okepiLIibQu1sEN>X=nO{-6G&iVY(q-u|UL=%>!uL0ZGBrC`AHLNJz=+ zhA-^eb}MKvhIjy>pAfU)y46MqmyU`92=@{i8;B}+xp~$9zIMfoF0@4J#A{I(=>L$s z=&DS^yTnh}{E}SwsAwjyV`B>Qp|)*f$ocV_uy)suvWY}Ao|z-r{xM!oiDU*ekac{I z$u_d55>>XZMi!S&839;w`IdjHXkYqw0~L=JqJe53{(hn>Vo;^Kc`|0$vLW@49;)_? zEoEgnTV1AkcQKd+4^EY+9GIN2Kl)mZ0ETLMWzZxyJ%3T>Lzc>OtS`-NgxtAF8+2H_ zV8#`tWUmbqB#zSMsIlf4!7VYf;y+(%8QUiF22M03p7h;OLuo8>Knj924dn@}tD=Ct zA`uzu<_Vb@10J<930yrro^L+*&Shvte1_WJ?sS%dk($fAz_1%*dqV2_37SZ&OOS&z{ZYG-BUiukqqzmYQ6MvRQpKe z>ULO_mk*(4U`>R)Q(%NZRnn2|7Hn3o8oqzIcU5Yfb@Hgy$qRmTkJGp{VK{ou=-_wV zJMyIq1Dc#_lKk4BRDFgB>Cr_-Dwww@5L%=lLa&)10f~~LR6l_nA;zIQzFhRu64D*D zlnQ(sdIjsH>f6lV!2P57~l zTgrY>#sc(B*Ldrj5n$ED-m`j@v{7P3NtqvD1Dc)IAT(F1I#WC&MkQ!uZcUO&ry~8E zHSBa#u&l+j#}4=G4Zh&DOi4Rm6W8V9HAYOJWfX#^=Sr!yvb>qPx0{^2cRzBHzwGu4_V zb{X6NO%F15%uQyC=xmxVwYBTttIu#hR|D|F5||z7mem^8rm6COT^z~7%cFULY0$c} z)}Xof+;wHc;Vb*OPFvNBZWJ0MIiIm2^h4V7+5&O4>MLV7P&x~Ls>(-&!G=s~*yqEl zYoGhYdB`{@MAKKJWE6rEPc(Z;2m49iS41ZFQt;kIpvX!)nlcr7sv8oztgg0WE(?h4XH_LoiSjmtN3h zJr_;TasO4t3nr<}Z<=EDt_NG&yEEm3&c7^u6%`@}+Vs&%ovvf}*R3@S^%_Wn>nWxp z+qM(Tnszm={2!OXmw1iN!+6-h<2md3{FBZZKaP|Kr3VN3Jc5gZY1^E}kjdRoV`=Y2 z=ByqY?K$$5<lsAXR0ur;LT_%eqz8jbWV?%Zh^A`m<7jUD zF2$?-U{YqyR`c*{kKE;Bu}<%|89t)QB-tah6X>h{2F2si6DQ`Q0;BEmLMf~XJYy#Q z-IIy9pwfVbsk#1N*G|8znNrK@$1%bZ`|uNgi%-fNGYVusX4oTJ4P&NOIn!HzksX~~ z^kxg962*%nLU_o!toB6+p~~Fng*K8?GY%~|`M?oDy5-8G6Q3OXiIvJEHWN)vu`B+k zR(>pt;e`~X2EzoK$eRxOc9(n{PvShsF}iu5Xs6yIQ`~9rlUAt*Ffca4sj;)EXYElRlm? z9IZ}>8T9rzJ-hoziCBh`u@xh3wslyu&RCP#uXcj?Uol{U<&ig4fmb+#y(I4KH`RMQABuCgxq)Pe5 z*3^GEX~}}XGsjhRx7?I6Z9MHSww6f6CuKf=lSlQMQOIt)K8 z(TJb-@*_eMFnG7s^h8mz73Cto%?A5s#28r2W;$vhxG&7oCUhjZxu%2T6A2CPodtWS zv+?no)IIK}f0(NC^ZS(1cSQLn%v$m_PcDVdJb6CxGCRHRl9%|c;5v_Mu8+k+$Dc=g z>3z&$O3&TalrE52A2P|e<6d< zIXc;}*@@-SIz>lAA48GpKg%Bs_q#c_t^JHm(tkfTt-y$4Zc7uz_P6FqVF3`2(1(Qu z*xcOwM;j58eazr&VPB2P?Ps#CV)YH5M?UHqFev^@o>*bysdUf_!Wa;*<1&t~Nz4{u z-!u#O)w8F;@7`jFdY9JG4iv~HgvNk6wjh*r{L#1RzHh{8pBKCgjF})6%-#5Arq?yt z)pwS!pzrdOUJN#Y@A>yhB(VU0p9K6K+OORELsZWFo>Ij~1PE7~Worw#<#k$X3qy>1 zMm8OftTZXsz#&*nDsCSOT5{3{yR(EW%C0!5sUJgXP)ayXC%Ym1Dn_s5CHFn0_3^G@ zxf8;;5o>+Zh@JTFYsdi;;fy$sF8fbQcrsj8C&_CcjgqkNK7SG309)vet^Z)VYP(z5 zBR%y@4>mFG+Qnr#!~qEH#>y_l8?!H6q|N$*uCaf7ukEA92z;J{CQ- zm0KR+I3B`#bF_kFQQ}Agm4?Iw#v%W?EN}{PGgn51#CrwW8pNH44x93@g&yBHcgfeY2l#$xd6u|z}BzR4u&f5e1f z4xt9K{>+Tq9na{U+H%b-Ip)#%lIEpoCrj=h0e*&=stcYEM5RH151i>Su5bYpiww6TAvI9 zj<0wVm0XQ8eZqsnXrtKv=xpl~S!ClYa8<}Ubd8UMIyPrkukh;eTcVSb#IG1i;6|nc++gT#=^5M#W z&5?F(Ph2yW`BCAC%^?bPh-QuCL-OV6Y_Y#@mxc=bboBuTxq4l!{l`t!k)Ci}D*fGU z9d>yX2;m*@m;}1jS0|aP3hUmc=rB@&-y^5?L=*me5I!WFdpG!Cfth)kFV&Ba%>Czd zU}0##Ep5=`MP!%1?kt;vd{o~d3!N6Z*U*|?=6|~deWE^HGEP7tB=>f*RNtBLU#r*8 z3Z8A71+FXiOaD=FMW!<5$fD#!EWl^7%AUwP?^CioiRV;haG0TWzNI7+!M>sS9plF8 z5m~S8CnP0LkMAuf@1(lMFg9S&EqfpS1gU$2xm?3>BF)uFg(CdDt*7;|v zpQA@r|0OdmEWm32KeGAPH7|jAse+B$1XL?`0p8 z|2T8_SU*1Bu^ORUHs|jx4O))@00BgLr>ZQ}#vK}Z&hJVZCEFQ}e$k7dpleotb9E7N zUG1kqD_ygEighX?JuoA*C|s4GaqU=L6_?x{^>OqAVt;t`OkxQaAkDiMBluN{vbMA@ zwVdg>f(gjN^rH@%*e3i$E6jZF{#J|mdWTq#;2^inldAcqS%;2GX zXbNfLQiuY5DzY%kFVTMc^WkEyrc@~G!4UJ$okL=NM|8{v(2JtpGFKL6`3}YB;(z>2 z6x*NOxex#MUWNGXpN$X_^Y@3~KK$CsPZ=R+ttHZ)lK(lHiuLBro4(c7nHnE6=i^@_ zFLW1ti;6=W4BXkPQxfCd*Cn1Ej+6+_FtY5VcE!FnOc`0suRg=E3*oetuQTsIgusW? z*zQa>NMszuky%8j{<8%oYeV}*tOptbe~DZZ|J*SC&_JgsElkdyr{%NJ62Bihz{BB@ z;hc^M*uK`7goULPl{b}Y5-^#2OIl>UXS;2!5BgS~&UD%sxZeBSBQ1hoxI>4>!Y)A1w?w-*e!h|5TLeS9m99SSIgE-NyoP;)~?yr5$Trf4r+3=8S;)q`$c+D#N zgbvKQE6fTvo=nNha|(fVLA0j*h2k}weBmizWWm5&x{ugcQm&UbH*g_gBM%bNPW&D2 z5i@{C13d{|6W-0ur8FxTn4&5rNsMBnJsYfC0IKEqp_zVjx)Rzg;*cJ&Tv})mI)B;g z!bz)>S3(Pi8*qQ0>BXQ!Z1Y-@1KC z`7lD>;_Arwb2T&SXn};oa->FMlR|$E^rUS}>Kp|U=r7)%Q`$-x%A^QPl|m@gRW*UkEA;hMR_B1-$T!rDXHb94&g zQ!y`6v%2-RhZ6Lbm-CtXU_+0t$f{5O$5Sg=tp(10kE^7Q{hurOVZ6OR@Nt48--^Al zw}|J(_Ci*fw9jO*^MVsve`MWq`)(U+2hd~$Gpw9@jihu&MyY=D?dpYBImeh|0{Zo{ zqaFA?SH*WfNq{M0tS{qaL?V(k_A*b73RZA*LuL9Yc^O0hWfoWfOKBj2uquB1h$wb} zQ1n|wh>s7OMa0fk|>$4qou#o_7 zr5X|uvx=l7SMwGT8dvA8(z%huoWj7X81xWV%S%2AvfugZL^uHNDwC~j(}_-}pu|{m zid`UXb;7gN4RIDuzu(u5k+V1T-X923t$t8%@eeN*!>h_?ou4 zgoM{fDs48njJMzE&dFSrrSQHRb=W;?DYHRr!J)Tkh@P6-SlVcnuod>XWotk3zJ_aV z@B^V?(e!qoT3YC*4!5085|ayd43l$+ztsHm*M8vn5nmH5G>5E6Mr|V87&zm^nbv!x zoRW!6c-hm1goes+!Uz1mFEq-5^~WUVmdu>FZ+gcY3Wo_@C2HS)rvr?dC{8Yv4rqo4->zdc-Mi%I zWeNary45@|o(9p;p3JTWzU%Qc!SonbdjZTM|i*H9oi9Yq`l046D5FLc! zv|s}G>Vm!cM`~)Ee&fct(I7{6+3v67G}F^u(y8Jzh2fZt3JJtk{5voG(`q_Pl$agZ z$81R%wb&o1eHMfYwC@c{wQ676&DqC1H`)7VL#Q>=wkM8-qTu-cP^c=f5%%{nb51>YhxxANzSwhp6l1mJCjGRdQAqo}LQkx`v-( zIW)pC;{1-`O(T!&=tk$PflN^=vm&SSe{Ise5Jip9aYQH17kMlVDe2YPANaFY?nNHu zU%MY}yD+}C*YY6J{{JI%`JbT-0($vZlJ)L4WbjX5iTL&Jg!K34o3ZYy!0Xm+O?|^N zok!+sPWqqutW?^Hh{%W(Ha79@u}{y5>r zx?nEPFP9dHbz2{wp#Q1FG&2Rx=y;QYY84d^5bpfI5wOxd`;K_|MX}9-_Z!w?u$m9x zEbN|Oxj;mzVJUolcPxB^+7W~H)p@L4uEk^RD;0nBT`A>_wJC_p`A={d9=|lhCj=Hy zq>xS4|JR1+^F@=ZQYX|V!uyhjGcI(t?2nzYrl**T{?9JSf;(lOpZ*SZ{~#Jt<{UAg z8`7@9%cMQm(*vgW!a(V&*LFaT@&g{>i%{h>R6Q4H^<$^EB6Yy8l@usJ; z=e}XF4tq-vVmppO*ErdP0}{iS=R?lj?#Xs}lW^7-zCFnLdyQrMjp_71VrkO=J zZ>&rAM_c7v>@D+fY#p+=u2vP=mg=wQJ36{gnf?8#o>l_8G0J?+x-;{`>vCmD3Z#5xd-g8OAzr0Z_aX1(3wB~XLj(_~tKqIZ5IKqy ziHYm7J0DLkJvcet!_QUpID6UD@`aAowCh=i7Rcm@XZpUIz*Av4q~eFa8VEjPHy0tX z-_@L%Pc}SNWHLMp_{)AF3>%Pm? z`R*nHebx|R;M54-Tz2+Pjy1xlG5D7QXp?3xo>{tff`!FAFSqOnF}Q%fj1>sRnT_bP z$JQt|3NL(G^17caXi!fP55aP6awJ3zEi3b z6MourXBxpED-A<#G7<79)t{zYcTP5|D~3STUv*@qa|h^s8@{ozbj>wp8meXIZ30fR z20FA8{^%de4(J@wSEtXUGA43(C1x{CY`n)P?*@+W`CBddE5Ekk*@|9| zgq?~C85`5;Ah*lK(j)E-SIzF zeu;yF;@QUG>X~Hhj$Y{mb1;2s$DM|1%3HIw{)wKehSQ>F3+*52t&zBAduOLR+A%7z zU&kQ{j$PwefmqJZ-QwHpDMCbV(-*H_m-fV;bXoL<){7Qd4u@0fyf+^TM<$cyyWHIF z>bQD!EMo3!*7Fl}%gM{A%W$)AA=_DBr1lIrkbOFw*{ghu!Zb-G_Qa8P@5?Bw?7?1m z)^ga?y-;3x9%^9vW_0Pw0nIK0&2J$qB*P)uTowjm@a#L(t5eo@%SlC)+30C%j2+Ia z39!F2GPd7oWRU`}>~=|-1w8!|o?jbJmhx;3C(Ls+RTl56HOI_l%j|eG2yY~HK|2Qi zd8gCw_LBC6UV5|$Q~2&>sO>*6K zmZiU{g55UTLD-taVxYy3qsV-pE*=U@S7gs?C3!05)0#Z6Ka*SIU?5R|M14~|JW-;< zxSm&}Ed6CAY2yE^{t4D^8#)tF_w9+ya4IchPy(Xzne~JhrFRh9jP80gT2q!7wPx}M zq{z@+l5V4A^d?`w(HoaZ<=syNndoz=Mj;Jwvgt1nB1!|_4wF*HKlwuPxlri9#~#{D zlb1?zFS_nLaw_+%gjEKLi)Ow@ciwsh$b9+@c>t>63Q9_Ss{%!qb_Ic7gsfwUUmha<1r0Z(0hl|^g=^hYS@ZM6RDF;umtPS;uPgxfllh^PX$II zKNS|*jKOP}$`9;0K!vD*+0Di-0k4Kb^3RK4SW)`D{@+&h@Y@D<_c?%glr+ooZf?wY zj~st_j>YCWIz%P9Hw`P%{my<(Ed~3AC20_0?ag>l4s}>@qHcA0Bq)MI)TY$pL)l7C z|6cSojAqoov2UJeqxHBCdnyw|w^-}(SET_97DA7964#pJ#;?m))LR7rga-+=_Wkc> zZAAf$CMh`V??sNzl+sd|N}iy4#f1-)a2U%t08=~6w5~@b*Uf20qS?^wGnRAvb1gLX zer9e&PQ+E_8P|5~XNHGcCGI969QRLu5_g<}mzU-!?F5{v@yN8*2^jBhf2}*Jk1ylR z81rr&CXGEcf6LW;)^hstx*r3dt=*~HVF>db(J>J!s@xYsSVO=kHZV>UvHl)2Q>`@5 zqS|1w!~W*7;yaCBB}ZTD-Jv-$(a};_DJjQ$?me`s^sKd(?%>6Sak^G_uvd+4ce(av zU#f}k!P)kRoSg4&m+HJbSB_D?RqBC_qcN(ZKYB?vRq#7FXTPqN7LL_8$%Ir2od&rN z)!Vm!wF|Gg03YA=0j?24PRjjR8C$-lev_eD4Lknml;wzGBAj z_Y|#yW~#zh9|u97IO-k=z015eGYNge(@A^$jso2SL5Ole(cRlDt)(Jk+t3Hz5GEXFY5;W;XU*-4_(p=+V=u!s`MPDI)gt zh-5Yf)JWQ_Npi~7Ni}A07g_K`JQBQ}kS@85D>vv}PgQQ8Zr*k~EaAHaKh!PVi(!lF zaMRWS(vSk4)HC9_2wf!1`Z`UdZizMbZyM^BR9H@=3ZEv+2MYkMmW*(*#ZB03(U(Qi z-TQHNR1pPd{e36X$Ot!K`%GC|@{FLO@=}ILzgq+>Sb`W_@T}&#t!Y?g`-r-C`<790 z*d8TAReujYLW6FgG}rMXeJjbMJIi;!^7+c+oep)1GC8U}?{N+61IMpRRQ#A=HDp!g zbv03GNC@%am0CP<=AJ#^>mj5<7~5^>x_mwwmAK=cR~A@hO+^a|4`}oL8rA@ZfJ26` z0hu9shC-(z8jqQvrnc!FhEW&|O6DGuT>Ku>>H@LF3lFPav?>m(8_x7zG(@FkGX?{& zH<4ulYkRTf`65H)Zu2eK`W^Ar>0=Bt?;Dyd)Nbh2Rm4?%S<8<{D)WK?^T%xRABfkc z3cnhrVFa5mB3>NS=IP2S3V!#002rkH{~rK`IrhH+jHLwwq}GMOL4YYh&@eI{z3Pr= zzA80xE2W`HCN((%cbPTx^CYH1^~@gaCMGJ1F++=J=(f1}&F8_)moD0+=Z%Q!eBUN3 zb5-(jQIalQwtIvmpqXqn{u!BF^WZ|wCXSt>|JU?y=Dj^PiA>3c^z_EW1>Sq?u_^s~fp*B1)+Ciw}m;;ca% zkn5S1MfM6hW?}(G8Y7b~zwiRX!Q8J)HeuISIrC^I#g)AU=gh)NtxpHLPx@T(Q~7hf zQjz64u5budPfcMBq6$%8cPn3Za`LOQAl|i+%%~Sg5q+OhVs@LkuCai}n^QLdO;#iW z^Ktf&JU%OPXSul#hE3@vUa+EIf)y7L`{+SX)9HrTpzCDv{?g6NM`BW|IspZx8lOq4 z9YM7;y-5D)WW_bDS|JqbR;HE%yCJm#%7hN|KXz?LqSz*q8aefDR@odj z~)&gaK@=0-ye571Tz+;b_=(crqe**sB!wuG@@L24kj>@$HSKC>H?7gk55SCYyiA z9A)br_!@C*=`3wvAPNF-hkt`eyzxM>_0IK>*&x2n5dqm}Iji5oN!BeNe~8}8t#|lh zw|C6%Ik}W+uny+Gl`f7=4t`sZ{u{@vHLycgV1h=Kk3=v}$qziR$l34kT>&sqZ zmFsZI=m800nd-Zcp*EHF;V!&)b%nb?c~pO)S|X7XqUdml?KYY$lWw(nHNOB#Z}bg+ zH<6;!nCreSx754pS3C8_c-PrfUv7@mQ)$94X=r6$Rijh*s(k@(*H+r|@LcqpA>olz zl*G4sEE62%U9_M|bD~$VpNP-5A{>hhaM-{yVaw48@`_ll!T$2qEDzs%n9QMhVN&y0 z0Qd|PIEX*E*Xj2_{}+{iV=xD?N_mlUEN`a_Os)!`S)0G_l<*zVLY8OUtA^Exu-j_Ul!r?tT#1 z=!|Yr0&i|ft;5PeR13lGsk++LLeo_f&=~7>Ip+oqmP)S;I;=#VuNoE>8>0|%&2ob< zg(6exkZQOFD}8SupcP`vMDjR_&D^uCZMC^X5*=rX;r|wD;GU8Y?I0~n+ax0tK!kOj z86Zoz6vLtk%5et}dy&B5n&9oKj-k{mrQJrN0X*UzDOucK>ox;2|vo23~!qtRV0f&U=&@e8^oQ*WHSCHcI;EXS6 zTm?LnuzkVzr3M-My~UDU*wwUXkRc5|```I*EaHtXX?)h46Y%lwjIp&bq^6gr8-7%` z7b=Bfp0WzZzzzjK0={hp^!UJSRVh6NFzAKpJEk!D`Xe15>c_Zyi89#B-7B2&+ok`8 z>Kv)#|6fp@^?#tc*+@30S5xQ8Ca)||RG;Mtg>U$;$o0RhA~C3_zi=YU2#`fFXczKU0~xwz#yITK?9nA zJNRkHQV*v!hrP}1(*r44GO63c8@ScT0AlO7Slo_J4i;BvOzd!D8UI~mWtt@lOJ^tY1X}feV3@q#sW2XDC9_&lK5r%QvU&9_g)301 zk9O)}_3(pHnxXh76zBLzdLGEp@%)mFLB$J3?b4?x6)y-*A;#YZyd3Zvs-4=OGLfGx zW#>fa6r`=b4w-r38O%T|YH8lBLzUTXTy~@O<)!q2qQ4{+yM>&0T5X=1pp4bN==<6ES1)4mP_Z92z~D70M+wK9lCbE5!0{!YLwEgQ80gpadOY z!55E7^?9E6CmR;Gjj)zMUc(WedkkVE|8G_qih0wSEfXXg&;2(KGML|Y`o0D!ZuA1z zsKac}cEV15B}Q7fJ)}_VbLzZ!7NJxf&d;{GkCZyhCt)q$6GWWLdblmHxz z4qt=ZjU0oe4{~@5z^UL@coo*K{Svkj6EdlU-{_dElc2NA{IW^X619$Xi4+SsvnS#NB>0i{3qrFn-Wf)>gloWs3?kDODcWuoSFT)vLF zv!XlqGUcCtcS8I|cT+H-xG8lg1y^1Y+PcJdZu7Y62L~U6emqTB%6FHemyi_fz0@;J z^aI2D76`kVY=91;SX`&3Th~rD9V><;)_eJ*g6mU5<`P@;Nuz0jxmEm5k6f~sL!Qdt+7A`Afdtfie`GeOi`O}8 zUx55N@|ORuzihDExNxd0+n8+eI(fHkO__uKJ>T>?xI3fSc9E3x)kWt#eU|fZ$E#ZL zEQtMNHf;@Tqx<@lb9gIV=P)d|s+*iQ9% zG$fMVTPH!!UowLOM}xfwc_nd>|QD3wkC7c;%G=SIr-KlSlKnMyJqh zS~pa`3#Fu*kb;mS0|Uuz*?Kt4oGTrofA!xu=|K-{S0;DyUwdo zyfx^^$%3h8rX+S%hNa)Vz?Z|;?Vo_32V;N3>(p4I@S5J(*!K>vzlQ7BE1Na@hvt&E zBr+-09?l^N`!p(8?KQRZ;qOI74^0eRXsxCkVtBhv^-fY4x?B&Vz7P0vsp8the15_- z1+8dK-QGp8wBVO^v^4Q&`dDKeIxf=+W_QhFCFQI#pNpZah3zCJABhkji^c{RPfA>e zwLPy^RJ@YjD)Q5F+p|LWo!bZ67d34Yw}(#qRtfv7Y}XQrVr&u)Y9(;UA)8eGgNN~P z;k1HJDh(d(R}|FbYHZJyt4+xl8e}g`kG&K06gdH3ieY^5JEPB+YBWCP9>qt$JM0Jq!q#&W;AM*sK+b3%MTdb)0{fRCU7s3N?n zJ%Xu2^vGDa0nacR{NwRz!%&ZPUgEC35(^U$j>4lqST8)n^8LdLAyBuVysyvQKE2H8 zX+NGk`}^#d*h=q-OZLPQ){@d!f_K8P)o?_R}EuYPxMbPuc_wRYC>bZF*E z)vQAg|0?Y}#u>uuOAZa+GO;1F4L_yQdmK^Mh2Si`MOk$=T%%cDyg$YGVyJ;8CMJv; zBE4*GHfjC$S|tOqemj3e4^3<&=ogN2?9xg)s!+oK!K3BJ2vXWdp@wgnVR?_VipHAR zo@8~8x2gx^D*B{YNb?k}DJx53eyMLgm9H$redxa#e)3q!ilVi5Z4rS*hsgtJQkCkt zZf`p7{GJh4!^OGL>4LJshEAbVn=DfvR}_tR^*?s81&Y`4BAkmR7Fw-Nb@9@7}2TAyL)yonI0YMk>BLn+yr2q7Y;IdG# zG{|umNQB=!t6&kS<=o}Z4g!K^6IPIOtoF(9Y0zZ*J!QFau%Ck`Kph#SDHDtIynWCT zc+A+!uQx(VuRT65z;Bx++qsT@Mf$pu6&nX{b$dZt@cbXXT}SBZ(;*UB2F2X2${7Bi ze<9lSD83U)lHP>9v9AnI}vKLx@Hn?Q~Nl6jhJ119^4TLMYZvuDf z?Hhkz@MW~M{IFkQ;h>_HJWM%TK=$SPfE&kj6!lZ#?U@Qiy02*N=w+*s1T`26Uy4St zXCE{!`E+jE5L0FA6qV9wNVmPrn?C5qotE$EXSY2(;nWwuf$#3SaQqm>*Djx_K-8Pe z|A|Q1`I|^ND0PIz4C@$N7LC?ICr99yPfPxA-$1_GeK$Gfn~;H%vgD0jG2V}h2LJ&_ z#@KFe$LG#2v{0uvHNSxcbV#fLry<^Clhwbg;=xUONB!Xe!J!G->H;m!j@*akoc@rM zUbsyUgY(E;WRa%BJ*g(k+^1{jk#*dsqAlWwF(jvDb3d6-XC>EIM8Q+f3qre+Xv~FG z40qWQqj^}YibZb^Z_aNtp?Vd4Po685;*S}Rz<0jDw_(xrVzsN@^{)xN6_u;SMGQ68 zQR;1DsZ+hxh-j1F#??tBys?$VK>xxsvPbfq_+SO8cW7Rqd6?L`MT+Jft)9|K|5&I4 z&&Q8s703tH7(amZ{;P&UwZ>1ehO4H8+MuFulxvPOG3r?l`L|X&NUTW}MUfLeM?EE> zy?SdA!b{pe4`T)ko2u#EDKc2>oSSdv-Az$SHAvdO#&iEjTL`&lg)GhlymOsVDK4c1 zYqRn<+|Gy{6hK=3Sx0F1udKq+-7W4V9%B22YIl2EN3k)bT(Z{)i%aVkL7_zg%U)C}mw&zdG%@dy& z$vxaycdk>^4+~qXPI8D^-Wl+c;FXMD5`aLgulElOf?@-8IXW4X;(o3EtvTC-&+fd0 z%R5o)IYeS(vN^W;$_w)=dRkI=pukm^j_aZ@sKeR9D{Ir!9{oNZ^Z6+~CN{WBSm+b+ zcYagJai03_e!ivL$=}-d%&#?*a}0ku`~pUFmu?7swJAl{GjhBl7DkVTE#{PR289av z9cuUT5|A=Oj)|uyC;K2t#1o!6rdX0?-)`R(t)SH0WOlLb;Z$78e8n zIIGu0+NZC%IW$M3*#3Hp{74lARS8j6R!-t}i2hZ+aIjZ&7Ra4?WBQjnS*kU@VsO5@Ta5zLZ0Y0e{h3TeJ-*~KGvNcGkq z>H8lg2PBVkEM1^)*BP_-2!n_3s_TZ&B!J7q>d+k)3!m(AyOJzx zaunZ)A1UP+ys?T7t?1Gy59&fi%^J2ern>POEy>N95-o>bqzRDSHeIi~y!mXxk#~F@ z9Bi;}WWbVPX<{{jY%uItTpXUB{9#hQGv_s7lZu@uTx|&!7HRKv58)L|23C2UL*i4= z>tkBOE(T4_a<9_rBZh|>nN<15;BfYf_)o^$JjDB4VsfVfwZXt`B)3f5wLKyt2L9a^ zV_j&ixaOBHiT}u3M78h%$XI0U5hq&^YLEYbqW0X~WaeM}Clr}JUA zzQ~P_DKOnn@L^|AEsh!dFE~^twCFzc+gn=jqm`8p8(!k)5m>ePeZk<^tl71*RwsIV z5;1k7a6m}K0$@h8jhvx-125x2>8NC3v+}uzq<>n|-lW2)tAct49BX}<*nyzK4B8t2 zGR2Nhw#%^S6VwrDWhnkPiSTm>x3dhu*z9(_XUh6>Ya1&2RQ;CqE}OC7+K+c_!9nPJ zVWg-9b~lSS%WZYYk*DrdkPzD5`(;$P7bT-TqzAQ#=azfDrv*1=uNh9zn&sZl+?eXj zbYqNBR2H7RMH85<|9F-jYhZDrN`r3mIb*Bkqj&kj57}tt&!3x^etY#Ffuy941JjFy zk%s5BKazcR&negC%jFrbBBnJ%FJ(ekm3v$n)MA#8EZvlvlah z30fTFjX6pmgn$B26?C>?Xj?aM>H^Qn21{<_$Hry=N#Pu@Z2h;&Z1>##(}QB3WuqgI zWkhL4*jc~g^lm2FMR|7vGJBwD@>9*qT1@|LyBW+7__Cl0c$Cwtn%yGZE^g{y_Oo$aM81#GQ8Zr_WzS%gDFtf4V zh!kA~X>@wz^|CK44C;Kj0Sl{iWu` zur(@I^<3AN70k9(}fD5|`tR zz;8I8;2@*+6IiT>lUSz&2`-=SYMk;hQ3sWktD>^kdpg{OFUj8Bw@DKH-x6LfwA$o&pg;V*e34#psbLpI>g5IV-r-O6|@PsP#pp*@|2 z`--xDw~k(xhZc>!*x_wdRM~ z9^D(UO=wV%eD;x^sHpfx)GH!oH%D>t;LwU19kU$9qd1LXrI&>2nD175bh4nhK-cWZ z_KdQiIgiO(GDW#{Nzh6^(jozK%`XK^jt=LBuaNjPvA8F2&{xH)vvK?%P4UWFbFbtD zt^)V+hL}RxZ8*X#{F>V1PDoARprpWGprmTtqib(((!O_jJM7Zz$+rsPx=DacbUz4} zl)V35F3qY;0iE3aK{84_Np331KhD7^c0>I>_XjH)quRM74v9n*xqOe&P$*wFXL z%4Ywrp)g&l4tJ6zGd5(jje9qJdQrF>1e?;j5FQBw)O9=z)P_+Z`4usm zmP_baR{G1S*px4x_VwxwFK6blm#5YZvb}QyePhlKH?&JRQ&}GOZs+?@PwT=rzUdPg zJa5Q-gfLxv90<8PKjlC`=KC4|H_=h4M;ky!l{wa4*gMp)uzXQQ{8vZ}fx3Sm`3 z0;bxF1a<%>l0=G;rx+z?@I?#@@-Z-HfcL_34nT+Ox8uN=YR07?Mi(}@H`XRHs<}f$1gJrZKrXwTS zJsi$UnuZ9%?Zt6}Le*c}J!`A{c&Vh?RgsJdymf;b8<#B$uOQHA)d_p`Vr*SZ4^$>a zuuJ~8WXOyFCE67IcI(ucKAo1GdwoBq#&=Cb&3dn9qb;%m=R^?qXu&I;ZKl+| z_o4Ks`yR96pO;oaFel!mm&s0S#V~ZSrT8p5`)+$D78}HK-f9$LrIA+(JKmD5seCGE zd;2Hb|EGvE1OfM}YA=k0Xlsmcu`)p$r;4{*LvxTVY;_4$P0#v#NJ~SUqe6}1QK$~R z@7C2&WS56mxQhVWrhxf=qItE1B%+407OH@`!PARDx(M8WjjUCTnx;bg7KZEvbcDF^ z8d{MJ0uBmAJ&bJRzMf5$BF_OaCY zVPyS9!#*vrobBkH_!c={!x$cWm$#Bm$2G$kc+;jCb&badd1%NoAu*}Qx~l3)KmO2s zs$J~m=A27vyZT3PWU0r-`N^8h#-)mv`SS|vM2Wr|A+k!~&rB*(=wfoQNw3Bk=&f98 z)Qtk*q3C73!YVz}5pQ3FZ%<-z{pEt4s}^?Y!4)zET$Xms&|n8tQT%kxmMdto(0(IG z-IfVD(NKpA&cZ52N^U6_n-ukhVeMv!YXbTGE^31*W5QrA^gEp!3Ai~H4v*`pt}=a5 ztm2zuMHaZcC14{ovY1Xt?FYH3@f)Kr<6O1cmT1i@w7Hwrlnk^E2V7QFoB>jqI4uXu zddsNIV^UwOcLt$*5!i$p#lhZw9!5rUUp6WC7_|5RgR5=7egvfa2p~k)w;COL2urIl zU$*PZ<1dp{1r-@mu6gR}rmU%yzWWyFF$O4h-jA%VcT8{esL&6NSOYiZ#zAkL04Tan zCn2?u{`oLS7dlJ1t`6C6WAr^Ty{eZtcsA=RcabtP&4PC!%_qARv|2zMRVnuq^zOCK ziW-MNi>kJ-)}9|G?9E&Gc_~t}V=!ap@au<-|DF3wnklXTFn(g45+twq1jGX+eoaF? z=SVZgqxIjTIS7~U{5#kE;|e(cN2-4zKRY2}hGX%D2L()<%c;i&>j8|^TFoJRK(&Cc+d*9O+nYAcLv3;tVQ)T`#o|; ze|MU7U7!)T1ttuYxKhJ)BuL;rRM>+mPbSEucWzhBGZKG=fjtwnUgL8{{>8YN$z;Tg z5`I7ELmBNKSXYD;LXfc;&fy_YV-Pq?ywxV>KA%N?Uo@5yLhAgjaiX3mZ`csUT5#VX%dBi#QtRw*ba_9)2N>MX z?}f4E%EAkCk-ya`CSZcr!ShedkUUN9F^$4$qTTF55ipm~0@1vz7mgLmEOI^Wp64$f z!PfOr@UBkDIt-0Duo_c=GW z3pf+lHtpd8+2^t7h!O^w=i+ri6`qokynC5c&ZoV#F7rGl1$2W`2bm00iV@EfA5vk>4 zEEPxQknBh3 z7I+t(*?a(RV5M5F?dIm0wef1jU#XQ&how1Xf{?N75prDM`ii?O@~1nIN=Ee}!`fwt zCp0(tg~%Zh>J4NqDiOzwX3r}yU#CM5L2`c;_FL|iaA=DizJm9CNLH{=I;Y5D9Q;}hRS@IYCSLN z-m49TRjk64l6a^q?pICdw(R@ z&=#%+#1)jn5Av4mSAhT8tpy=a71gtgRSt>zk{EX3JLn|Ku`T((hao`fKZO!xkk0fO zYI=~Zil_=l@cv9Tz>N>!9XNlsfA;qqz^NN7gmns>&%R9VqT-{J$^aLn;s*aUm*Fgq zD&d3Qu(r`lST;X?t8;&MOhpL#ESoG&f1q1^-W}Nkl7Jkmw z?taycw+GkS6f!3_w7lyJQM;NLum8Z4i5}auw@g7)YYkV#$6qT|Xz4T_^Rd5|2U>ta z=DtVxplZ92pumw%1mIC8xbvV!Eoys*Z_mq!>qzj~k{|7Mg0tqjdM#(UA57n;5!Vwx z=gw6W)5ue`ScO2|y4fgT4>j53(t4)Y&Xg3m7Z4kpW1u>KGBGfKOX?}m)n6!LOFqQU zKEyNNFr>()ue=&iD+In$t4gfU+slLJ;XebCoN)W8z2T%;Y%qg&*F!UU)NkXWpglzT zIJ7g;Ig<48M*1H%m#ptMW%YU4_%Up1?%ErBsUW|ie(t=RE)D=L{idSfLGWl`|43d| ztVw}S!;3ipEvyXHyxN;9RQ9M<6=usweU9iyv2XD8JINl~;E0iv_$ys{SE;%bTH{`T zU?s-&)sfN81er3#Obp%W){_E3j8=11w90kw^;KO>v=)ztS^cN2=Q?!$fjMujrBHpU zoj)4YCbw!Z!Y`yC1$ZdOxl&t4R**AUR*YYPogiw{V$!O5BUu5-`%AGWsEx zu0@UBPcnx$^<4L(Q%@=Ea61ordc)H+Xt~g=k@ko zAN>OY;v17t(e*KDAFzTHWMUSiTiv;zGt*=G#{c4|y^-A2DG@ew6cRxuT*zv10nW4XM;(!bNO-bZyGcke(t)8?TX@_d7i_sFkYGBK z6M__q;EJaS5pjg9SCj<%TfUVydNZ7xr#iN6RiC{SL$X(=E$;THoQ7lsXd!C7-5U5u z$0I3xX~8Utxx(j?A3r{G0XA(wAAN$_E|6_>Q$qwkm~Gy2OUWg3ma4kNs9#%tXLH2v zKh8bPoO-!i-(`2TOy{4z5LoqKHST1t00UlGVtCxpW^d6R9cL9)1XsYN7}!rMsNrqb zZ+RdDl;jb0j<+4dyRjO@CX0hDB_m76wKd{<{yOp2T5xOpo zAsRJ@#LmkAr{fDXYbV{g=gx4~+<=G3NKwqtH3Br8fy)r9Em_&Wwu=OXrpfW2n8Aku zULe#R!A($H_DMG~&BmnR-Xb)ArmRNT`TrTBwVFG`Muwd4uE7%xU~FPSEhI$#`1p9f z%0WPM?=5aM{m&Hbg2wGOE&+gpLrPh;fo*ixo#~B0(Xt)fynMB+#nRc?TB6U)Q>rsR z0Dh@tjWIBLvcB?<9;FeDIi`ZwiSZ{dTk^cSW*q`2jaT&)Rz21T7j@0F-*%BJe-TW#ug^7Pu=Gv#kfV~42cY_VllN5|_vI#JWzpl!=M5(thQy+*A^=%RS zZSU)0ZPb`DC!yKS`pLQEtvvWbxd78+;l8(}X$Y|ac!cyDOK5OdbpcHDNoT!hcdp4? zt@E%#o7zp$JnN|N-HDuj3JAt>8nIu40)ReF6R;t1uP+$Ysy2Jw+%iQtSy3;_LI3on zOD_PwP=FsU#XfsP@11<9jjm=o32Q#<*cG0?>H;I|j3yGPc_*q`vllOp&e5x0S6&E3 zp1B5(xk&tm)S>0N+j0c%;0#6s0@<)V(preh%}zh0^)S_dudgE2xr2zK!n zP){=FY4=cwWiwSQ} zptVumsAFD**E3cmHw-kq=davTNH#REMT($8p_0{t+?~50VO>fU{zzX(ZPU@Vb~W91wb~q@3FtdGiDTAy#Bj@ASYs`5{?)8xQPG zv?*oZLv`hpknY4LtHx^`(qm1=6(70K*MZzT=;$Vy$ak%n=s~^B$5w)hEf`OqtkLzP z0xZlfCbx&o>_aP@t?xE3z|V}^Og+@CNh0dx^?K|zyubOB#Wn;lg3^qnI;?#wbp2aW zVOfQ(C{=p;47%|yy(>2xE3~C^96b+V7@y7*4ZIT3mh|K5(ktZgdoStEfS@*6Q7a9z zR_1S)hisN=)*3rPOvO*kfEH*9e;#}Fd(ZRD1D@Q~HUC75B?ylr5od<2Skjt!cK}&$ zxc`?%j}w&BwM9QESD`4k9vmaDQ-5yD*||0i zW-T$pH2Y+B#^0XJ-}L)Z2PZFxiYc3z>UFbZ4Bh(>k&g$;QU9Wlu6Ljf<*L77n_BbglU(8dkd|ur|Eoq!^sz`7LBSV zxqCrfAI4Qa_zWGq`*lFa5U8qSs~+!twn~t{_B!i{h4P?oZ20lr?JT~e5G(L`bjS)C zaG&1TFQK^l5+WoFxtK|`1sUd(@9yaNc=Y39IL!1_w$_+*hEV8!3Om6)em5J~x4qEv zIv%Ie+=HM5*;80-8ujPl>7*J)&*2+DGOfa&^4a$6Fz?933- z#@}`^kCFS2gbH-|mkF`614S&M>AUaZt7O%*CrSakvabP?ZEMMH?-n zoDQ0c=yUH%i$#Qmu}oSQbL?Z0n4eKztJ>PURR+kMD&;wixpMS!RuqhzW*3{e16rA1 zDhFjUzgm~r5X@zWj|wPeszU_(+Z8uev8hiv&|GwRJMr0cQ>^>4n*pv;j%(WskC z%k;0A5$-iMv>x?25$ZFIL)c;NRiu28%TXDPNWb`W&fg4?L{gUZg*!2W1iZtXy5-bd zumw+q$@6!4IB&2kl0U+I54(N7qkoo*=sKVkPU5R~m4HTL(q^qnV|JBd$5-IgP#|&p zsk@CqKBxOuOy}}8Ry>52rr(|&tzfY)WR! zBE!~XAIJw)()3j!iPw8pPZx}tpB`)S<}zHB>sy&t(F>Ls;M@U zQDSj*&;be~ZULvW8)TD@Cw9auZ6=bH+1k(F8uZL+t@y@!iD-pJ z;-yyi@FKM0W?|CE#viRD5cB#k@ON0zhpBT(Akl>Ha1))k4}`8 zoe{wL_Kw_`Ei2wEJTLu+GOFs$Sch-HnDUc$Z7XvaMW80G+L+oWR|Y(f=*P`uvUSnM z4U(-1uL%S&WhB$MX838U2l18I&U>UjXzS|!sS)Me0MV;5%yVbH6(Rs7v3x#x%KFhq zj|GcBFEB6cz?}1B`~^eeB6^Ao^ma(oe>ky9$l5tdHvi+>%aZ18*)5TH$vCFIj(B~$ zIW}Im+cvw?Z;XzaM?$D&v^m9Ub6o>o1Q-Qjpc$}UqcIMi2&;m}WRh8Q5yejWAbuWK zckPvmUNE~XloYP4NKpZ!-cuy4Ze0YLX{#1dHIz;0Qp=X6=j?~x4~tcffB+robe z{lWsxp1}h-6%5eeW7xx5s;yboU8{Bqc^2arp8;^mXyep&)7TkNYIMKjNqN)g3=3>3 z+0BS-s|DYA$rJf}I3wtS2=p@yqw+E4LRT#N~D->5{V`;KPROWNc~PYwG6RP}FK3m%SHc6ytfCqfv1J+7v5RjxdB=i0%Qp}AXA%ySrw7A zcWlu`dT%JzBQ#{hA6 z#9y_w$h=Q#-$O^IL2|xFv-*_?I;4btpoLxU=^_*v=H`Kz2>!5@&d$|*&X~&WBFy;M zDdl>@WBrOErP%5Gnxzl>xApD0&Lv&7{^l0@^l0fv__q3=(FOgl=pq2Jva;ZFvb2ay z8K%3>jm^4#HOAD&J!gL@ zFoyA+qg;Ni=&Wp)j^LDgDA{g$-1jbs#P~z*eMn_>jGRB{k|WKDd)<7JGV89BpuBX* zRp1y~AUuNC)LEMztNhC0j88T*@(sE@Gv1sB?jXMnA_KW|@>Pffo}JZnvvEo?VSQvu zz}+v{wJ8ysR(H2z=zD>Fl2lBm%GE+_-y3?yJnH;B2Cahi@x>%L9cDk~mBQdoPXI!$r;De;! z_THzzb`>aP3Y~Wk9s)FeEb`uimbo;DX7&5(qDiNwKUH=sFI$b zAp!(HCdJ3ctD?@5m=0@lYZ0^)(V7xTUQ2a&hP{e$m&!9{Vrvm4yv8<2?%EHh-o3mQ z3&#R+m<}iTup@CM=@D~m%7WV(H!Ro|9F})z8^f1IFgk-^g0x6r;`gS*?L>$q!)#&1 zGe~&?p4bf4&%0(jGS@Tv6q7#@b7Y!zw-XulhLJ!GyMu6OCBuk04A(<_*x{eNKkxbH zlYf2&S8R~it(s@;%j{hp0TFG_#ixE7FBV(agkQRBRaIG&idDy8*|+KDy6A>5&48*aThMvO)r{e!Q)b#&hsZaIoqdwBG91fd>Q%f4r(einNjtdycy{lJz0C zJ#i~JC_0}>-b|-%pqzMjdE0qut*TNFk?ks;lp_6*^^0wJ*e3t)H=q5@`o^2ZA;fM+Rda*#{$OfmR{e)z#WVOGG9C zK{aW9tditk=Q>_IxA{b15Seqoe$%5lUw882403t?uI+o`*wlUO5JUH(w%lVd>ltV$ zq=hTs7G(6cLHC-i%qDNAOi;@lEPJU~buclASQZv6^f{S6be@xb7Wvnr2!~0m4?6(@ zprfN>`}+=^rsaFo<`%P#4uiTur;O|7;r1D%$)bdQH7y>A9aU4^TDOuxy<{UA(0MZK z*?!EIg_$}hj`sVu^WY#HYdmTy>Ez!f=syW5T@fzxBSaa5tPAUG0=>k9yOGY?4lzLz z`DYz1h&kh<9r$Z6_^5ao3TTcq-+S1_^dJ5-3i&cbc79eyrcbbzQEv@Vv?*62GT#5Qi<}q{)FcGN+$HoDD;Og z=f#EbwhSznT`=f0K>Wsk?T6vgG$NXJdR~t-e2LtjQs=Qfu)3w6)|Ny_mgp&pW?EW} zL@3yDyxRSiu$8XP>9dLC3sIK1u4u(61p~819rVYs&>Md{uJ2rOJ#BB9iCXKC=1kSz zf5|Nkg1~xJZ2}gxONA`JLj{lcDHLUb_ zoG-l!+QfRvEsce0<1Ydn(Nztv#F@1gMzUvaBEN>Hi?Ue)#r6N}QUJ4FTDuc|FG<|62Iu9s3#DvRJ~`s1o5H zC+Vzs>R0P%hE|DR1FM7u>Bn}%hO&T;f)!la^k?Y#<5-?j8&|EQE>uT-blWE4ex>EMi$v+#n2WUv_fiE>>GS+;{dcOt;*z4NMtp3V~ z&8bB?i^phqBo0nTM=(B>=GU!o#xCKY^mln>Za;Y+kg(bnbuhoY_T~1;*Ipw{zE!yd z*sLgp%$S^<21$$;?pRb`af1nth`^x9N;-3d(3nK;kT?Pk;kBf}G9?}6t_(HLM8yY2 zE+K8;`j_5r--;At9G%|oTPj3AI0h&$Kfm+a3{9HQFBJO?k^ke$~JB$Wm`U^ zBW2>lKHyz31L&xg^@tgJ@yZJ<*UKzFhFOZ?55+ zVJji4v6Wgf?3P9&#jySV(RYMdy5{vteMY3Nr`|^M;I=-N&=Nk-G-qDc8j$7niJhW1 ztjWT9w3?xK)X8@1qf;bA{aR-+i}CNyB%m{$x15*mtVPMtPlKbU@~>uq<_>ll;^88W zMY57=!MOYheuUPGsl*XU@Q3ueB@kgZ&)Qz5I23+fEoZp)X|ZVKBdYIcZa}rt;fd|F zUCHHRe=vU>=o|B2Y^rZhY_XIW3?a_6mD^Fr=znFTm~wVeBodG>HRYq;i~kb9z6}E5 z!x#Log+>8MzkqoLynL>;+J8Ss1UCZcqOfI1FW4)tam%>fBEdj0y0TKjOsd%I~l=*iRp*qs7f z>4obu}l(?Z4@3A*|AjNJ%i?b>{^w5e2{gGNZ z2o2K5QZxEar?P+sG=@+Uaz6A&nOf;Hd?#u((%0~9(^d}S-9;(^FAlM`bukM7ur2ci z1=^H$8d`xJMn8omfA0LV^|)3{1dw*`#Fgw~?i(w60#pk%+0atarQl z^6chB+9>h*cws2Q8_i^!8No%H7XP$VHD8Ko<+Is}c=w#Fme%junNMuVKg4oUjz!Vo zRdoT=VFy}1Ocu0KZ{Q#a{zl=Gd(bEJn)crEyeVJa@;HusdZtHu&b7*VQaKus58Er- zF1at^Hl2~w9FPio_w<%is02Sxf~3VWV>c6YFIQMbaLtgllOBmxJKAiRgN50=Jc|Uy zJ!}RYDgt?8iLn1vOJY``a!z_h!YUKFQtXQ&bpP2h4A2ZBl;8VNP-~7GF#veiKiENQ zEPP~YYBM~ zd1z!sqk?oWRgR?f4w#)pZE~FWEfL5~N9&_bjX+vNU=Y$5(M(18@NQ$V)(~ZCp{{|T zH?#$!PO5}Zhhi>VQj!C4$xulR-AFiZB=Gi(4@cp@4m2Cf z+>l;;`DuNqRi4y8@B-PE;p*Dnc#RI9C9iz?JxayjC)qWs$=Qd{JT(<=k$oH~eK2mBtY@_9`1c)ucE9lp<8gqcV z+vY3wv~EYfq6lGVE^{#{W_X9#)17Di|<46AI0^` zU@^(U(8Txj7)NyJXmi_ijTVcwdAjEY`2_(TA~pmV`NaxFcnDyxQ==db^tpjj80Yb2 z4HZ@2OYpSxs#=C9^xJELsr*Aud+{N;_hIx@ip`tasnAb5=hM?~C+c^%bkb67#nZZq z&m=qAuXH|v`{VPO(k|l(YRQ{_Tv0dY)cIJBx!M~PcuUZB*4<6&Ey3o0=8bxMGjNG| z&qKQZwN;t&#hHBZ@6|fBn)Sl0mp9RX!Q-Z$nfZa(%hiFh^FyNKzJ3PSFWh=AegjjyFCg!;>ecb_QCQEo$f3sx3`mt+xem;=!X=pJ5|?_y z*9C&91G16o6y_#j2^6dfDJ;6Mn=4y0-qu!43*mmcf~2N+p9+2?KpX30kX1!9wju?P z=6x5rVol4rpf~nKwGhrh+bijfK0Bcuj8k2Kh_KW<`=O!{ zZ}}^z!re*nXWpMB(OQhQ&%if<_Czd~6xdxhLwR#U%_N4Cr+|qWW0O{^MrBxraqX@d zk)nT3Hx1nhQ%nrPcKKz@ePk%VzrpPy)M-H>nU}6T=fYeSbg!Hj4yvQI2Nc)umZYn6 z%n=(R-&NWrdu$l|Ha4~llOr4Dqy_x>%K1z-swUa%Ki@?1oWDqId-H;oO+f+c6Z+%? z-e#z-MKJ=r0W8d#>_P{8y?mx_3U32*L1?E&{!!Bc!>=$vt){`1B^nPQ&z{uW650~O zzMn8O!!KJr5p|{Aizc1Ko1^+*hMr-}w*|?$Zj81Gu-%J{jz}sRJoPD9Dd?JBmfU^Z z;Ku8Jot(`3%Ir(44HHG_q^it%f6+kc!o!(hlh3;3F)H)J349$PV;?s3!cvm z;NwHhAXM+idtr>QHk@sE6glB7b2KlL=Wlj|)dOEzZaFFAzq)GpA@llYG)im8vD3b* zJ4uG=*_)#_7n-x+7a%RTXD*Hw_VGYIX@bhS^X@PSfxw#&m{ZM8r4AyPIxKrR1y$7A z4OWP;`eI*qTxw|qnFjT4TlCyu{W5Ni=~wOo18KKNfKLKXA4PH$lq@G+|L7Hh#HO<| zK$%1o4|#_Nl&*3mbOxn>z6~1>tNG?r)dU#w?glBK+R$Bb6HzOU;2N@V({qv!Y=xxfH%?~5e>d@AFaz269sj`qao=3%%oqP!yh zTu7e!uKCZ}`~z^5bof;aQVkCd$`rpi+U7LP34yPWxb31(MDaHb6AJeskgu{48}o35 z8pGQ5iSH8e;cTxy1sppVPU1iW!2iv;yzXlJTJnP$vN zBaGKWIgENSKvh@)F@@_LpLpxZgBl&9w?E#21Qozx-z`irKpX&LILa~ve;`frfxmzg zQgkTiDjyCh-lM33mPOsWIchwdsv~wmW>x~-THZ4)T`>q-M$50Xay9b7zTeeMLcf-)O2#Bo5hU*&j@{<&vwVnH#vs8wUkO#88O zbtNCZBR5d~+~1HFXHQYWskhjd3KDjUNaKUPm~+u=uggSar`pIWl78LGi%&#AEx`TS zXDaX_CP0!g^C|#&q9STP@q9_iD%JfXy>;e}{^Uf74tT2SlQ&xh?@g3n&C|dL!9#$G z{uYxWA=^0}`x8D)g+=kNKp)+9AS^dW`}j5|ZhUZ#5`{@!qO!GaAAGz-E$1D3sV(C@ z1}$SSIiX#(pUu-Vw^zR=y0MS~#_ObD>7E5MV%I6#^vpV6Y`4JDNnH2_y)gPi9&p(5 zdD841cA`12O41r?uNtjb*%h=OgCUk|9-T5^Dzm%YOAh#rJ6)QT6tQNP-zv|*FL3|xm<4>LG{aIlq$I!{ z0E_Hj?f!a5r6)iC=c0@FYI-JSPv5$-CI|xVf9D>>e;?DsPwDjOx!Zt&KRIde2}U#& zV>b77N;gm=4QnKI3z&z~n*tUOIiTu~4L}DC42ejzC&Dq;i%%DDn)I+8VD&fw@|9%= z@{faj-;XYP>;NVm&*0+xrk1Tz+2--h(p`3KTDSizI3S0i*QA()S&jdj9&IOK(4b(H zXp{Ln`*a^wzWmQH9b`HjqG}WWEB7=5{-0FdSE5$ITy@T#uKZv182y$1ZkHMOrhgNZ z*-nU_;`gPYFRiaEy{KnRmELNwnM@;!>i@s{?Ez6*fs2SRuaVk6TY4p)pU`k~vxY5; zsXaU3@4&QJ!gs3Roha5>{^%vaeOJC-Sm=fO3H?3uhrlWeuT7LTHT?ZQ>OFBIQ$ zmP5*pw(~AGdmOFQZT+_U*$v88@fkM9I>8dDArZo?3gv>uvJZ_`BWi8aZ!(G7cB{>- zr^~pq>+C`IHTmwoguQS$8UP2E)j$1zGg{#t|7Nt%_2G=x$lr_>_rM)fQcAqqr3Mf| zq4PecKdw+Ej?ko^i}-i0@~Hc7x!blzDhV5-i~Vd;n6FKzEa4+9U}FZX6k;)-J<_!0 z_OW;$X*FLO4^BUI+f+l z1g*yIncYi)#^4lItpmK$BLa@Cijl~OhDZrk?Tq?f@Y1J=x@bwm%X|mk zt5Z+306IEfDd84%=+DY`q|)ADae54u#=L?=wxaq9&mE?=aJY=zB<4??x7ImLpHr-Q z`e#cu;4~XMNX*a9mf^T?B(TVgiryDXbA}I~dU}#AxCYCyQd^>^M`xw&Ow z9#9QUT4SyJ6)JqZ*!J>C{yBjGb_?sqq&_;<5207<1k6)O#>jj|H9lCgq}QL$SKlO8 zdN4F}mSi%{7F&FEe6kM;Z5)y%d`+-Jzdm2+YEY0LaFS!X;bjBv46pXD_N_OXixM_& zDB-a?fw8e2UsVM8S!xtF*I!ooY>TWF1#qQKTtvc+V*;2dw-=QDlrT{^O$zhZJntbe z(_0K6ESLtcm?hi|!RfZddXWB3LO$Z02bV~!hWg)|)|~(I?0ddi9{MScq4nZb!sLK} zmd))!+KJnN0UhnXB5x+4=eCTbz<=m_hzb<1`LB)pvesB4LoCs&txx6wRyc&|-~IP1 z-H`!s_Q~BbC|#}RA_0aDr?29=i;9XWwd+vK6xl>|p^=RqmUO3PQP#p|55dF8mU+*t zmS!zfBo3QnDM$`6^iHCKWMxaLwmh!Cq4BV!U~P@ME6v$N-U!1;vKSdB-#KzNfZh+F z3_LY9BAPGeGGfKZMd?aOHi_yiwaj+Rfv?dghNfQ~vT}c2yz{gYxLM5iL0;i7x_^}o zAT6}mH>`xQq$zyfCM!Y}+6l=pzA0wcaPNPKz-32;da3Wz(bpUH;W2ZmnmjFI8q#>A@aMw!6rxhgDv+JuH-05Qio-FG_QdvK@k zcNSaY$D>fky-|b620R7wlpotrO1pvo_zepM@B_U z7OP*2@+(J8Yt|`o0}5Yx4|5)2)V%a?>)X5BdgVj{BR~+%#vykgbd++6Mm>|-C1GE+ ze}+21*tqVEvF6EDsnD*Ww-_rM_`aZbhBq&Y$An{jUC@bg@2%t5WDBye=JEHSdGR;B zKmH~w|8xWJ*L;#cfP`nQc7c3YLt%rvaLxpbmyt1+=3e~G+A&WE~rjaI@S8Se|Ay4G@ z>q02u zJ5f;xEavly`!`)(IB98&pXrnjD@xoe^zA*~n`_7rXBQqE+&E zX3~F1gGd^GOWz)jJ!za+YVj@Z*`X{c-ytnQ9(UEfUkSN9>A`SvqKUV1fTxJIt2-ZMQp}PPfp33&PP7M4x2`iP%tHu>?3!Q5b-WM~-BTPS z3%sYDgW1tt%`4ocf&~YUj)wz1?@`G|xZyc_T$ZSDmSh@HM@#>?NbR42KujLEKzN{dDyu)8yeJf;a&_;kyV{dD8;R3F+^$j7>&%T(OB<_6f1vLt zR_pdrDKh%3WJzSrIio9~ELDRW0~<3isx0r5I8sM?hxo7!vnVYP=ApTVC%z&XA|)>pGlM_N%hnC zGgk$jNp-R}J%33*uQxiC%xrXVi$mHIsZ$3_-Q~sXyT+Gr+)_}LT2Pg9=25vsq&{j# zGpD_J+Ntesr7r3{Az4_FuHwEYEmf_{vbum;tj`IHY_{c+Opa+(sD z20-q-vdApZY@42sM70a$Dca?G z+mGj79q+n&S{u@GEVRL(Xc%@N>if-#9Fg=|J(VW7^EYKY@Z;LbJK9Vs=zaqE-kIxk zuWV-RP{lJ{aaW``aHZ`?3!Y9p>i3_FJH)Z-7SHpkMveFL({Ni-G5YmWWO=+FYjVB^ z_k3EzQa=M!PT#BWtLl(Cq=7w*+uRRx$1|4@`wBoIs%%HRgf=QM9QWTsAmjguTS(mh zC0;n>KZ+NTUi`=oUFn~a%0%Q+c-q#5jE-PnWr%%Wynbzg&-vmaWxcB|@*5AlwCeQg z;$%D%e8;d2y2(z*7uUlZ?f1LWcAgiPj!auarW#49K^bK5jhcDPArM}&%|&I$>!ID| zXg5G{u=O_F>dJuGn+jB z1&t|gC;2>~zrJBG7ue?&ruC~F+ATD_EIjbgGKlU%8WA#?57WFNH z1@dwSC(h?y;VP$Lw(KFH(yMJhY1a zsw|!}``WbEF5J8u6UjC0xsH-TxD1e7@N$F~NlW&kf+AY+zn>a9#k#ZBN0XK&go7uP zOHy5TcQao@$gR@gQ|7mm=;Lpi>p4v1^ec_DJ`41iyvn1TQaNLch-pwNV7yS-|JZzN z*<;ViwmGmiW_e6fYb=ryD8#t+LpMi+%;Ng9=5Y>q7>7v0J}s;>;!l|)?7jB#>Nd&X zE)@%LA^mHlO2^gNcHc^j(sh_BspDwJj>t}`F5lL*mL=Z3cl3m<(@rCUq3AA$1o89t z|BzJFa_)2ZxMOe7RZ9Hcx4?SP|8q*NC~0{dZBDqDcderKl62ed5pd-2=lKOSbCgpG zu#PnJ+&s{B$FOR#r4JgR=PeAi#~sIBt|DEftNtZjyj6 zt|*k$%aSRoP+-@rD5MTVKctZ1OVFq~meEXNdC1J7yvVzuH8EvT78XIghfmC=4ZFML z(DprVyeC6MvJbeLR`ole#s_2Z)dwK+^|tDJ*(v9YVEJx91QlILbCS-U{xP!TS}OMy zlRvl!>`POTBK~7wZ)|MBWc74a4V@Hr1QK|Rw*1ZVUTe<`{cL(<)PNJCd!Qj;FHM5c zK@J{e&V&>hN~HNQe@=FnVe3h#7U?i{56dQ-CNyIU7uv+Fn zY5LQPPp#bdA?BUtu~Kwfc6*8TXziG}0V9Fkt^;BXnt1F3>;BFhU z>-gO90+!l*^C3@81<)fPAEqy(>ZCoB`+eAs;kVTG91%*FbF;hylhIWsgb5}zr03cj z9KfOEBm7MWugW?%0siB638>S2b`aRI-dw2vkj90y0nf!|C>Siof^kH_s(u*jnr1m2 z`J8rVs`Qxt2964eH32+7GolDzZ8aVMG`0&03y;hO8YnnN(*M%B|DxM1Mm43y?qv^^ zxLr#XFY&{_iWmz8Sj^NgAZ}L`?T^o&7E8|(P1a|vVc)$m`Z_ZXEyDi^A4_EC+5J^Y z&qv?nBRE!OO5R&M@V+gTmJ8`vM$d~r?OYxfe3zK)p<`|@WIEj-{uC4tW28EdG!{Dk z{HN+1^#EN&_|MV&_f5PadGJOR*;zU7E@jUuynb_v?4J(x>U5qFU`hi;0-36DJBx@2 z7rZ{r5ihfBuZ@<5ukITh!jcut7l$wOJ)2^k6WI{Zq@t@UUAob#u2&Fm~6qCx#~= zO5PdTEgd5|T0+ykYHB`!^dxLlokmeX03qD>7alVq4G@pMdwcuk1Ejb?m>!o0L?<-U>pmaHVTrTd-_}4!SHc z9jKQkAp$x~RcM@mT~_x-7O?X84lBGRoM}Jcp7Xmay*EEpfX-;SO&Zy>GUko^>lo&* zuvrX;p8@-XB_hAv!q7}I8yG!>dRiuAWXEVmRh6_URg8t`*c9ajSM(y}n+1H~Qzb8< zoBqkOsf((UORAhCb>6hj!XUxDu5vjNoXd!7xkh8tMCeDY!z{!2n4DVNJ3}*f>M>wv ze##zgyZz?Tr*Wz^aZh_`j&B~#ABFZ_9Ra&TH<#y0-$)GuHFRVr>sX5*lF;-840v29S;J~ULcrt^71Qxn*UAj z&jivK=^qI1p~KFi%;CUFPCl#7BN8hTG*9yTl|US*PU(A;tF8WbqSyG-=+8za3kwF0 zua1c0(~`|}2Pzg8$^}e|9~*j5)Xhlvh2JRYO}&bii?FR`)e-U*AO-|^Jq5k6U6s(h#TFrCILA@*{zyqe%89ar9U|ach%Fv_ zH+-dMIAh1%UTGGnw?Pj?^Nq16h{?x4b_rp3WbL4q$8*(EhauKnvD!Lnwprb@=9JuY zgs*p^_!9QbOEk7?)%|I8%xel>*Mjp=m=3dENlQujjOBj(;B1Al-0apmr$%GRr}Khn z{suE1ZCw26WJSS9X27U@4lC0rUd=QaMr@3tj_BF;*eg?I7Q*)Avmb?XLV znOf_*5W@H;_;6H^|o?{t@c>mXPPXxP5S6#4scK zIn0XY<(Q>gdH6?1yRZvMRaF$%O5D(Xr-Z@LouDJ^26olM=vW7Wn+0Md(YfC)P%rp@$>J`2F{iR2&3b$!)$d!Aixv-I#%FOlq`+9c zz`};rbtF3hfs(lFQJw3OEw%?)$U7d~cP3n0_V8&AFUr@H>l|XlgK$lghB0;WQ70y; zc*~4YIML#LFgIGz@hs3!a^lh#daZ68CAVO#D_4deI@segs_m@n8nSM$C)dAhp7@Iv zctI+8lS1W$D^|VVeW1q=4AIz7@Ww|Y3OyqdMaRPoZH==~cHu!d2(nN2q;J^k8Tz6@ zEHNh?_zXa)Dp?LZ(6G6Hiv=+Jio7Ah-IEfgJX>8|C1GGdht|5b zv^5Thi8}M5?meKy#Kcrtt%=urLcF~(8HU050`#I^sqN({Mn>7{3Fe&6^0U{`w;o6u zI2Z_(QS}uQ?Amlg#TcBNqfe)c8xYs8;l?;GIkAaBmdOz>1w?|UyInv`xtWjR)#dR& z#4C&!+1|XV39tRTzB^%MFgbmX#1Ipa_Sx)&DZ@V(|ioO+siKc|&b_-r3tSdhw zN3Z;!v7NiN<2jgM4ZeZCy}8hg(jhd}*Y^st2L7Vx_o0VlQZW17j4gwJyBa#=c4b&X z5<0S)S+DdTN%%Umm~VH(Ad&w3n3Olk(u{WDI|e>VmbdjD!!X}u@{wPzVt%X9u+;5) zddq4|Vt422AA10Gy7(gyj?0|EGGM!=(lto{jVzy1*xFm^>tFe%^txCK#=m>FVDesv zU`;Va#v+SyK)>wT$2=Z;nZB%~Ir>0*8z(S z53EhlXoyr615jM~_Wk%82-0#YBdC1sKg-I>rp*T9vln%AVBL%6XwN4B-PDZa>LJln z7c&T_sihgyE`&_9g({``h9cRitP~*A#IT~bQV9*PsIgiKJ}XA1Tku%h4E9HU*>n*6~RtCZyYX=5{WRy`{OeNcDl87M`#;aNIp z`FLsad`m!+(*gaE(2?%%wFSCMB{^~Z&f9L+E!Nd&{>*``9FkN!Yiuv>5Qg9f(td^| z4VAV$E4(A1Zr+~^_3imde7JZH^NOd=fAb?|6k9VHOVC@&z51QN@6BdJ@lFqiY}(`C zCzWE*Ix~eS&}Fku;OyyJ%(qE=Or=gtRFk$+UwDTal%2YL@AzPvx=s%)s}d}w>gWwj^{uW_yaLxR zx@G=(Q0!c1vrbujy-0l%=(WO_*V~+QTk?$OC{S0mTa19?i={3y8D0IV6{8rOl#K%c z%?iplcQ|jTZgC59lA4lDI>Ifj`Sur%_>FI^z;|Qss;a6+xh^A~P%-aGACk7`gCB&3 zEl)zi8*b+RPn|VlDDGcnR%8V7hm~|xtvDzfuSP|wDrNnDa&g0rO5j_|vN!J8+ci1a zQff;MSs1K^msPi4Ulo^IuZ2TCQN}w|nRa45m`JxQB_j{j*d7Ep_aP`ttT{lk4Km3< z;me{>%`cksSXI97n@E&gP-eK)-sW#MVYN=uHKFRbI7p`SA?wb%AV#HZe1D9(C0CA$ ze%#V%b(NYF85OqVG1-z-xM>=}7G^`-v^mp{AJ+}!3^{fvRAinUB5gY95fruaj*e=D z7CDxu&1OEY{nu`v_&*A(ALHUp2D}MXDkS8hgfvl#% zN6vrCQ+G+OJvTyj*xG>5n^~L|)*6 z#r|DnwnPUSG+VG+5ml4&SiZ2bu2>X{VJ6~J4aMJ5ytKQ=-SUgi-F<04?ZPS9XQsPP ztjR1;L$}V~2uJ?5W9bxwxR>CjX2n^z<*1pGvw!Hm@QtT_dQlz+&vE{v4hdgyly^%Vtg-t_ zkZKX~eb63;^f+(_MOeTlPDyr;VIjZ>Y9(T9@=jMz-%05>ef93snm@L_@<3DJ)B6BM z?f))J#<}|beJ^KEYm1&x;ia=112VMZE<7&5Z>3i0<>6T6oBY}uP698XpHR6G=2|HJ zdkurPDmmC#Z(RHS{|Y90LW1tGqND4R#KX~mVrx&%MAo5w@!*)as!JQ=yl3xK;{afz z+;J;RG&?ONi47z1h3%n1-udCe%QhOGk9#U3^|_YRFyJ-y$>#_2Z;Q;PBwv4%5^(_y zU1QUJ$bpPwU8Z-5Im;YBZTvpjS7U^!EU{qHG^2QYo5kCR1L6bFVdLwy<2j`PXxK^d z$Djfu&cWsP|5^^-b+Yl_7DOo1c5Lodp{a^-hUu_rpHf3E)5xlPS%~hady|qLdd2@6 z-Z+!a^*6jRGWh^ys74Pz?)3FDn#v5Ur7vIhhd1^7G7NBgw=j1> zoB{kddw942)lNKd7sWI&d)}M36l^IH0`F%QMt6P|PWu{v3#w6z-e50S-*hRWv zJ)^BI-=<-OAdM8^DLx0*yw;F74CrBKq@}s>WNaUVa1H0=^ng)B%Qc5ap6K*Gp7;6n zYF)|scil=MnyER|YO_zF51rT&DBD`F$P4ftnK1s>~rmm|-MoAb=@-anxh zAEslhFMB3b#7=;C6I2xk@EZCu3BcWwgm|ol(?2CdIPQPF%3*4ZWq;cFDAP>KQC(TY zlAZ*u=6y3(jM)tND8=d5XP=N%cJW6Y#xRAxus}N~D$GrLPw<4sJOqx7 zvDY>OPKLq{UbS{jO(PFJ)=CmhC8JSj>SsT=Qy0ZUWuWo}AY)AMn7m@uadM#d_{1Nc zMjmMF!pQ3Q7nuprJV*o}ah;mzPPZc2Tex3TF4CrAI2e4z%~l-@L3!>QPRi3@Jk zYbn}WaY6Ee%qFTKAg~C@8WN=NxP7NI!hvmDleSAhL0dzcm)_i2>4Zw??$M|q7g>Q> z57*9Q8#4Js6xAq6LMvpho>ndwrdL%x!E@c|e74V62f&JvZ~p^RQ%tZxIOhzHq7$6?`0i>e@xzDn&2d)icNs;mIZjr<{PsP`hfQvLM3{* ziYv0OSe26O%|x3-^6=`+THtzQ<#;W|ypF-1G(3)M8DsPSByUVjqkh#t<%q2enh==+ zR0fFa*f{vh>Z+XRxGoMG^*F-s?e}lx*e59NtOSWHc83c1@==NIIvMj6BMyJ@^-6#V ze@A1;W%puB$S%$pW+LTaxmo%l;6s(2XU(I$Q#R@-L)(jL)vnKERhMEK^b!zlfN!bT z=b7;xpn!LJjJb5XGX5Lm0_e6@ij#Yf*uJhU{Q_1Y-!2R1a@?3vmOBJ~KE}cb0teqh zgm4%T?I^;;O8GAszq_Qm`jt{7K=>y=x;%f?jCZ~({j+euEYBo{x#v!=6{UnZVfl)3 zoQ{R>A0^s$4v!_;!Lo9=j|*AxzHK^TeL~%Gecn2Tm)H@w7E#5x8@|x#^FLi?nupd) z)0*J|9X6*p*=EuTWY8ej4{2qr^Ur&!h!PDb;yQy%lH}^`Aqi=%g9#|{oi7Z`Lo|h!j54e=>ll>kR{f%>EIY+wtY`Oz60#J z=Jk%c<*XhQxpzn#7Y?X4zro^1VTf=qfog8c`9t^%u?p0C*avRcZl=&H*dF-sBTihK zjy2@Ue|`Q>zWg_Tsq;@7I_NI}>d%}w*`rniREz`h0A#LmU6BVPt`HC4{wvXj=TLxf+g|@%rtSA^qkE95c_|ydhA| zqw9t>5nU#%j=&9b(^mRpLL7}KHe;vw`uBoP&%YIPCLjOLf=(C;_Q;?xphknsJzFYa znWPK0%T_m&rmVa#ntJCyxgyuUxFU(aaYgwE4OSEwCT^Fn%<(qUgEf_URo1AKLA+L( zS#4TV8#+S*YRN&=3Cnq7noLL5T~yB*_CRb%Z@tV+z#=L05RpMmOR0nGthPn_z@yFl z97L)5eq8e-F74b)|2K|r92X4sDmRU0@n{oR1Vn9llEm_p3=kP)C)$5`dmD3(97l%E zaw+z@e}OkEI~d1zBj60>i7C}G{y~NWUfTe*oeyT=*8PI{zF+>e{I8k%Dd0(8tPWX} z@O2*lx$d#gLW_Y1)I!>HM+LD&blIf0{23K} zO?KUhRau`W`}Q{bpJ@4^eDJ%HlN>VFufF5XKJ}=cvD|uCN$ed`ujQCukacx2J$ZL} z)hhI>1bVgvPI_ZSPAS~vIHhc}%L#ci>u~6hfAPVyGtPm$-MeLbN5H|LPVVC+H0z-0 z>*B@-OFCFfEf3|RHH)U}<8YmUXUsNiiEs~L@6>^FCf@6X?(#-NqzOxI_Ti=>+A|x` ziAxkvy-7{wO$TW!HuI9(mX!~kkn3zg8FzTy!lNX_Z%RREdu>h}M?3Z4R8#l>w%I#! z4z~NT)h4>H3Azo6B%k96i5x1?qdZNnMyI6vj{FQ1JK}P5<}su@orVZSEi)KF#rsn{ zeeoL1<9sfOzR=*-;Mz2Cb+XY_Q;7GjcLqL+sHq-5F+BVT4G9UrmN@l2JUkBP&hY7; zyN0w*UVSKgU{+RDjeuM#ZDWBc$dlZ|*JlvKr3=TO5-(KH{-^9SAFpXNjTOoBwrO)u zVc4YO{%zb2PNuv{Xj_MpdQPVB566=Vt5g|jD8h?i53C8D&UeXVc${m`SXf-HIvEo( zSLBU^nVFiyk$&cOQ#}WYqD8toKVRWNohED!cxY)&gTlr>syRmu9}6Gf@5fE-jA?6g z4=HBwz0{0>zd)=%{B;ojdL{;RdTrK4u&RmTxGQ0VF>)Fo4(ZzzBgbEXF@%%r4rzmVfLCdB8;GHNST!!r5 zW*do!l`e^s101cdwMVk0&Y;*v3+7~lZv7#~7q$uPqNVzMgZV~sOa(=V34e$hyQiS< z9^+4jw@`(+Sb2osii%GVf6OM&2+e*<7r7N%Ui~fixPGu9iBU_Le(P1`Tl$<~RDul>8 zE;#uy-mkbM+{(1nngwG}iP|M-3a%A``zjI){?ynRf3scYfqa5r?s>T#SN(fY?791n zn@?_eI(yEAGam%WeTZAmqL{0!_dYOv+wZvJBKi~z3V}4dhQq;$1pv#JBzljvXu9O- z$9HI5pTg`VgJwV6Gwgfn&97)pnpK}VIkF2$PT$egB;@CxNzqU*L0MT)Xgxe(1gn~bEB1XvVCeX_7zE)E!wYS?+v(J%ZS*A3l8^g8HX{L z6{dU+%5H4p5@tGQ`RepNZSH#iuN%MOOa6Z2mu7*Q&aYauH(lRR(>7$5Z^W`o$ebla zVjvhus1%7mV3#i9$&7=1AHO@e(}}EQ$=ZUA{Phs2ftJ>|N>~y&hfq^YqPdNP@58OW zfC&Cf3o~`iI)+rh{M^{s5-!0TrC5!H7cqryk@=uNBq|UW>*bAxcn_vyO+Wj#HySTP zW2k}G8n48N#LwBkXI3KMKpSlL-uHJmI>SnKmpAJRm)7UPTW9umZoi&i=A!&RgGxXC z4l0$9CI6SYGQz14St~-KZYcFQVtuW>g`er43B{bC^`wK{$Z)K)-8Sq8_d;M+g-U)7L2B+)0#Lv@uz zHQwaZol=aP#kgFNqS&zhNHcLqYfyj7JSH>59iFo@B~+Sa(jrTBCG%fKW8wkFol0L{ zwvqMQ`G+k?{8YyWywpt9MTzI$Ds+wh8GPZi>x7n+F04dzr3!e9ZE?l9$Beazn|#jp zUK|^NfB6AFi#_NO^~IrOm@V@zN=S9{F81$cpJgZ*Oq0IwE>OQBo0_tqDW}ft2 z-+Z5HKFzJ1A$`OicqiB{OU{_uT8lo%JEv)3YHjP~Sp`R@zfcz10oVC2N~qMx?;k3y zU6-lo?0Hj-q~aUj$u2-YFYuc08Oc%v;~c(7@!FT(8|?qZwVtvdu|EneP$&*!JXGLX zl%S|gF!=2js-Lb-aoDIExDRf~WKGDV`Zj;n5QXJ)25#{IZoo*7Oh+O#dvqCddrr4i z8y++s;GFOuXd*?9$LI$wcVa*FJ9>+9bj1~Ck?G&k#{*vSZ-=w$$en&A8MByiiGDRI z8Yy>{PW}1`4;T=hlEF@kUJ^Jo%>fd`U)Po_2P?<;i9?P2oKuuA>^9C(gRBow3v7)y zYxK}}<=z;t?U=0S&Xuy;vOq!XwA4Jg8cyvo}7OAdw4A*S0b~y)uum3bE zSv0^-c5fB|f;Xi@IkIhHs5XTPmoCqZBvm}b89MnT;pj8%6 z797!9Z#L-0)b8F?)Qxmw(DEppIKIY;*8lph%YH)ip)=ED3ut252TpG96O|ZjYb!|r zKTS)O5Kt8{3Kw+uiK#3r5$qu=){9h(9Rd4`=+PrBS-PS+RoS>_XCPvW!XFi?txZK| zr@r9@a!SDZS-?HSiig6VpauzY!OMX$SKTL*2sESBjHWOp)gfNhjMizTu5VK0pP4_s z7aH1FeVw_!&|ZN|{9{0KA)rXhE+O-2sL)d*7IWU9_Td&GllqfGfiRqsfD=nnBhFLy z-U0;Xvr7auxdBqhC8BhPYNJDw(G3vC32^@%|u`VOp2$uEEU>gn~Tl)6o{X zM9A>!4wc|DP-M?JN!;QE{*^9!w=zWB#_&Tp(8RFExU2K*BdE6 zE`TYZO@;I8>E{O;3oBcEMK^Hj?$4M$rl3poA4(R{?!h2-K0bKk%A9NM$7c11!< zY{(YL-LPB(DB(G$XM>iPKj*=Mrj9w$WU5ZN>nALnc0h;Bkp04#{o2eC*Q~0dmz`o> z-}k=8Z)js;3l12)8K&mRG1T}x;{30Jo|d+vwR#7GCkA$}yG@+j=JSYk1u&_t96yvSKRL5P`z z24

$NUZmi-#Lybx~PBF})tHa8RpGdEq}^0@T^nXn(w>i{K3-582%{rQ&nF#RUwG zY=3WW)NvlGR`i6ASeyrheO3LPLQtUP3Jk~xDE0uhEcDt=z=3g{0ZgIshrBU z+a0pF_|>ZM_+@^1ytl@D>EdFMDq!?nWAUn{`Q8153%g6GsB@TB(%aM&_PYr%m%Ijg z;rW#$2)9*haKGMzE`?kDDiHVLA8s1n4jSh9-e>UnC>f68?}&Ck166ZegeN!wJn5gG zUM%hf;rjKfDmAhPAAAI-8DUS}D52LFOP;JJk==N3YTsF<6P)i`Aq%zm<{=&g731tc zzP4$SlxcVl1AV>S8C!Qr8^rl_m%aiaP?}%R26vp6zzbD_Hj3JL?Xc=6`sCd;DW^^R zUHf%7Q=`)PU1HTMT)$F-fj3*<-u|vUdyIm0qG3Vt_K}%)(T$A~RgQd#m|#T0qlm$V zhkLb#MVjaz5_t-N7U!#PT74e;YAY3&UE5!C*IiID5$8ugD>75dA!TAJnQxNR{mE=o zF8YR!wxC`5WGs(rvdEA#h-*hcqn2m>X4SwuJM&XZZ+Us~)$!V~w9B8@{j4l!PK1XS z4vw=yY!A!L?*vboSiPMjUc{Zd63_J4R~Rh{*!SY{d2dcUH-7!FFdxtV(NfRl7M6m9 zgvB_}j|8bzSUu9ugD=&vr`1-M&&{GyKjDysbBx&F;d zQG+1;Uc=EUN&WT2gQSOx+~VTet*l(58pe6v4f`M4V^%lyGnMlXW@FD?>L^!CjpF-L zAW2cUHsz%)nXJXHKYFuik*;2{t*>{+i0@Qn4bw2No44F>0sZ^RFFLg^iZ&G5rKUn{ z)~rREolbX_k?&z8#7@o$D+-^#4#;@yyw@ z0FBc@s{L25`lsO#?fy?_rzrV-4U^$>OZChu=WfS}=5c|&j1JCw=Urw888?*0!E{j0 zn|=YLQYlqc_dYG+=Hiv!8k-AE_sj5`{2Yd8f8;N%Ba3W5THBJB;8 z`qrqym6rM`2|FS7Hw`~g^gcRH7TF-opQ3Ku5uR;dArT_MZ}4mCy zp5`3#LtfRR=NBd8#Y&~^bcO_&=dxS`yY2%M6VlP@6m#&?pjI3KbXWoOY-|w0Knjll zY2tGVNXzK$HGkgaGS_I>O)945TTGzmb-bzOgz)XrDY|o{@ymNx9en2Xid_lI`0)Pk zRD?h~1f^lhqJVP(0xoXUrKP2xg@tUtE~#mG;FM?QZK|iL(9w0 zBJSLdZdn}aG-&k49c)?;C$%hGbP7zla$~u&QyV5Xmv?l<#OCbaoYktdLqn+5A+kL& z<|eN|mKbs*C3~KmtETmBz<|)uP~h&rFHDT3up>f6+~L4FCcGNB%57`UW|x)dc8D%U zKhiVh8;%~(tf)W;@)I;xyd%<=dR#g(DcrwS&TXlN*LXlmJ(j72kT~h(Kw#OBAjk#M zJJzpWEF5Iq=GJY{5DxEDMsL#w*y0qTlI#8?rL3tM*qf;griX?Q^M%0N;4DAfTcbSO zbZE^s)Zr>4*=QjusC$DQOpbmYgIJUxtg(6>z}B!_-@k;1TH2wI6~` z-<2%T22!8-_QtvUJ7EG34pCo%is37eOPk$h=~v%Hap-pXYr$3}3wwjh_t&aM{jt^; zUj+n1+y;~=teB)57k<6))RuFMwv+?biDRU*F{Q|hEi}>C|I;E9)YPISp$baE2odsiyX z8VF;TCw{;U?^kPo&&pk)Z(11CxyGM0Q?e~na4y^|n;1{+(Y0(QHM2|tls{?|v*%{6 zdN(;iRZC3_#(+N9HQ}vFv~bnVL(|js`_P*1s$bU_4_3dLkLm-zn$1b&@PONJI=pTw zRUGF=aT|fwEWjRt)iOS6vy2?O`nKTqqk=bs8tRS0x_ZCiJu$%dUl4u2*uIi?=*J%-{w#AxC%WJ)S&Kbb)#s(;H>kSFPEwMsI>dEY^ zPx71+;>42#OWEs9Xx2P+H0@V1(xQ74Tg0JJID)SLwgg{=;D2u?KcUu1n_!P2-lC5E zCPcaN)rz{Cx+jdF;k!SCh;wg<9O_-Sl>ATQaXqS0_22^x$0Bd#w>hRcPy8eVwH`%I zZZ|fRP~v^PlZNxh%GFPD20FHDDmE#eP3fo^G-&SI8W&(sMN&Xu&BF9~dH zt-qK1yqM*wM=w5U4b+VCoGV!&J2}>!adZqX**ic+lB9#u?P~<56z*wV)vzYb)o5$2 z3M4N}jC;u@p_u0=;#L6mHozILmZ2&U-t@g{!BE>o7PA04m*k>Cdo#qGfNxlVPHd*-Xg{&AsI2I_Nvx}KYS^z4 zBA}&X|swpzHz1 zYin);v0y9`QlNv+?`6kE1EIOwnV7QK8@WtfFMeMm`oovNXmY zE+FW2+&cNERa#bX&x1k4Gwy71Nr<|XeWitgfzdfIkRwhfPzSp#@yVX&w;^v$eVQip z0?SAi_%pv)i9Z&u0QxP^>=E7j>ropV>f_l+f*|}>w{*R4Cet#IO0Puy5&J4(@sJecB{`&hpo+O`s zw;4Hm8AvY#Rj(=r$(sh@kdE}kB(ll#!U{B)m&8IT1(pL_V=+2AI~%*BCD0k5IO_xW z-tdq7JRHp-n zcD#lrQ{@IXuYlIy!CN}*H4rLSn(SjUmwl5@YLRyNABknyCzX|3%6py&zt#KlvBzC+ zXORhm_4)PQrrJJ5TMmQu=#3#gcGGYTtCQ2!@=O);X`O>u${syTqE|bUp!cmH(ZJEf zsW>IjYek}fIf$4Kou-AiHN?nG*fVUio<8_8Jq4m91U|ar z4cKaf12PQTfp&CqiBXqMDsZsn^6W2;&c@-NPTI4;`LuCN60*WqRNQ^~fLCNHR8vc0 zvEUea5B1_nKDw{7?d+uIceLaUX*F-^xZ`<8H+aEQLPHW3IOEL@3t9*g-n z>zqpjU%zyk=Bw_9nvbKkofl*jnRI;Eo##mLhdhaYlE|7tPyW)st4&E8O#b~!rY%jU zV>AG=(h<766OGL1w90^TMjZ0Xx&__s^yhoCng%{LBJOuL4})oYxZDm56~vt6Gt!c? zPuw2105=KMOchoJ%|KbD%v-dwY0`GyNx-!nXzfV|f%n<6m4YOkQEGa4Zv*v&JCXo9Gb8uV0OofiR2X0w^?J)ap8%h^?uq z!(wp|xoR&yXW7(K*L9fs_x6l9q;MwY<{}+Uz2dV$pJ`T{ed;R5E2O0mJzRV<(dX_f zp=L*m{hrc0O_{=FAlKi*j8bq$dameN`R&V=oaUBaSi6LC#rKa)47;J>@R1r;o#uC_NUQ$Id==+diJfPK9qpQchqB=zMJz>fvGY~SO& zbi0bmAvoHBkf~9R#TC-D8`dh>+TuYI_+BR`PdAFpVvLOMGf$q#y#s5*E#PLF&nkRW zyFc`22JhKg9Qbsd#E{(!tJbHCx4)fiLuBq(&!2%h=s!>5{BFptN!_PEFvR8rf&^Dr zNAO8xDV1r4K3WB@&+_u#Vv)D;jS0RyTsYc&39QNt=14L0`+>pXLPZo#A1c~{TGuzj zfe+{k1^sB4Iwm6aY_!U#)GY1!9-ZkB#6v$wjg$3#> zT_vHm*k9oH9?_7VA9$a7px;fVa2Q;E1hyl=r^bLt*9shXc7-(s@U`%$1wtbYk zSX;eA`8S|Fr%=tRi$vVlH5gYP_1@8Rw|vhMI?T5J@MubcDWOcv%u{uRPyIrX+n0!A zz8dt}>`oRF0^Qa5O-Sr{M!tD0sNJlggp;iSoeZiFNoHx9ufM zw4yuy5EZ0)wPT&T+h=+Y2Q#&}I&Vd~??GJan7#ffUSD*`jN#^Tbc%EjpdvURN(u4p z3L5I;XeZw7%1w1G+75FQl)-<*6uZy+1g`kW1+2nlUTMm5A&ZhNF<=<+{PG8|m zuTtDR2#{RaA~xOgjgG=fRM4zZdym55yD3RelrD85#i)wCRF?wEHS zPsg>4j9fmirk1j`Gb6a{8CyX6j4WN5LLz-4j3VtkZziYjc?e^EC53}1l7F@cI!ImJ zqTB@rC$)0ipb+)kP-_I67$r3z60WW8PHLteJX!jVnh&&c zVcz-I{wHVIH|CW2Z2+z(o!54?yy@fN=w)z}%dMJ3R}5HkQ)gJrLu7q8^=)kt6WA+< zF6&CM&RQsFd5UWal~kyjEDS8?&RY9hNVU@a08;=F!2kgfM8|D4^pez)5w+d->%h5+ z9}2O*trqiSSc}<*PS{@H8Uel5*4D30o<_>$ry33o2c89Ll?n1-OVb-uBwmeMjru#{ ztII}TuNPFS-?32jjlAG*I)_6Dx%@C(QjtxHIp{rN$5!jQo_G=srbI0 z1Nm#;6hpqgzCP1TZ*OlZpD*bM=Y07pv3rJ22!)F!CiGWxw0WBN6{|e>Xio8rS;I~~ zZ&u>d?^!)&x)_xXdOb`Wl8%jDYbScSZ&R?r`e@e6rW%KmuFPK`W{V^u+ZayqpC(j@ z=0TACt$}G>S;oJLEwbCcu{cIp-UD{9-he6H;O8T=O<*bowPOm+(kzuCrKXQX4U?9* zOnG-^F}&%MgP|#eT6za450)c|k^@SP;joD@H)-`ZlJyXr**QGkK&WEE$=WPW+~d@> zV}M$G&qS6zzV6<*(w*E4=pENf5>6pg#@H?C?wBFP?)x*5pE3oTk`&Kw{(#C$^Gnw^` zSgAOlg`a`0b1rave81C)PSJMi@gSxq&RYl|$T)%~98aJxOZX9jPb8D;1zpq{#4Z#* zKI2lAeu&@WuGp##xAH4P*k@{{MKa^2u+!*weMPymoEUL3<^(IF^77?t`|=C07|R71(T{n$f}WhPv838#bE=va-)_@`Q4Z&;QnOeF z3fC*%4H~(w2X9RXYoM*l**dr!Xvn^tXW6P`XUB$3kJN0C*Um76)$7zKXu+UGsy3+2 ztKE?5--q9><+h8mJHrg;+>q)W*QdjqSkSUQGil9F1Xx7246ZQ8HT+go50|(bzT@HB{V{cK4QQ?d#$W zc5LCcdA_;aOpapnN=taNu%;}YkdRS#4f|D$ShzC>T&b_kFb8pmV3QldO7m*?Z?FTG`wN&A8T1@YAK9RH{c(rc8eaXF=8(eU zc-LR+H}DLet@|W$pkh!t%}fnAA@>u0@3o z7o?L`Ns9jxOKS>LXMVt&H*HJT3ap%{aM0UrUi?P1tHDLPxV!Hk7R|co9GnFfi zy32!OmON$bOP$AQNgFlOvQdP!n51Q<1!FHmFTBg07RBoxyi!?C_}P3-$ZUhEauu7z zG=e^9x=gr-P5LnTRW?hVCzl`o&h`ei1go{m-jl_q zTqs1sz;jY~1JP-QLLMC7-%&_vlf*vFdr{nFQbAp=c-#dN@}noUJM3e&Jx4k-BSkyU z+*@+EkWy0ap3fRX+reZipZ;qNkVAvYVI3behjRJxs}4+!wO^maXDbg+w*3{yV~R}n z+@YrL9@6qY{yr~r^CXIS4awEQ2Z$=nH1r12+Z|kwr?6ksl$q_|+bckR(YkrJ$G3yA zq=o!Zi2|kbn`Ble5p}$xMOBk$+Z20t*HLM#Y5u?3&NHluZQsLUK@bH(R}e&c2~~iG)%|0$H|nfaBA-oyr)|qF2pVTEn|dWX|xGsrWhp zHbvpenUM31lA?1-wISCiqK(^%DNlB0S5%EuRL*Wn2|L^&F$A0{#oR|CsxpfMXe!_0 zw?g-g$~$NqK19L@{Eq?L$dh8bwcXR$MussU$pB?P?gqDZTOVkXNNd~M9FlKb!i`mxnJK!;A;Diofg}b z0Rh|X1BUp4j&1Qr(-REMjCy;uV7ydrsiypRc5FVYqj1UGl=Z3W36%xe*0Yrchozq@ z%9&b599WP8iLZN`2?RQ?-g036@@lj9L-PcGUWUgU9W3i)F7_jI4^w0+zM((a_uQIx z%M?>2n{V{Xd6CXovNDxfhd1K>##{t~A2cTSwagFJH&JBori+Vks|l?32JsW{t6_$Q zKnu~wqRs3e`h2ZBJIIW(&7lLfz`qdgbWm>OsGRcTW}IxGr^wnDli06ExEIfRQk34R ztg|lma!#AkzF$Ak;zAZIV#jEqNfogW+5NEz@3UmM?7oC#3b!!t5f3a zbWv^JXgDiGXh3WAAhbWk=%#+$E0OxP1R%4Th<37^1Tdb~4dO@T;n-5*)`Ecq=h3$0;H2-IwU-=Ck9T zIx6JyY~fNkQs$gx4CjckLVzoB^_mJWBrA#$4Cow_+pDMn|Cp7!oG;LwHN%oy`y(SN7`b^jrMxv+$1$=*=# z^u8>ve>m8gH^>n;;zp88;HCuDde95T(#W_^r>o0X@ zh~eCVd42&`o{tEF#O-B;g{N}VXRoI<#7DgLK=!^nWqtyfE|)9{x%0E7ojHdZ`?)dF zvRJ@M*pd%dBIZnX&uMe~$gZI4s@q9(_7O6VjlG&4PF}Hnx@l7z`gQ!fbJ2En#qA#% zT>MFfvl0$r@O>QGQZqx^i4V)wdJKmCa7xfRGiD^>%uX( zNBbLPp_z~oG`-96ed%bokqZ0aXXKq~2B}n3c;zo097zLs|K(9?Q{(xvS4Me#I$5?` zi!CKXo;$?LKbEJM#;>2h$OZ`2x{&12|5$xL*?YR1y3Bd|;}@x+g1bM)sPF;w%KsU2 zPME@QQG7+#WkPFtyzQJf_-R2#h*xI&GGd-nN-KA?%O>RQE;g8&&O4&0;>-*^$;Zb* zqg04^he%3}pnm_9C4Ufd;be78Y5CmSYqizDi;2yTcy_GS`qkO-Q@VT|ZXoc8p5%lo z`TELHvm1pAEz!T$>u;&}G*8RU-fxmt^cOKx;9rU6DSh{+CwRbr<^zx7`1p8nZTtMs zK$Ep`;#Z(4Y*d!?M1ALJ=k^veiC3iy3*58K>xC@u6@1Nh3#(ykF0BZ@!YqF7I$9)B zr{8IiEsi0M zSab9POs@zdNzkzfzEsJDEWe9ws#$o0L;|@*yirrv#jZyiAh~@FW<#eCPH<^f*^YAa zq}i(i+^?SBKp5%7Fs;dE&1x+l7(>!N)u|zri;u&b z{w;$;!_;)8q3;8pB{sR(A3P*Bt#mJdoGI4#j2Vmzi`USMiSxDR=-75|`H9;@bH#3X$m|2W#Q`}^*2jyjxcN?3i({pOuYoV;0*_^%@7H$ozNP;2GN{7NoY$l zcmEAR^i(-q_{1bAMCH9$sP79X6;_e`WRiSGixhC%8ZcATr03fw$g%224Di2$7?>5O z^q&;8JSuD(G#yEwyJX1%r62I}ODENtg|m3t3Ula%34K*c+H@!&U_O*C+cc~c7}lq} zQW%-23;SlhR+!Erm8;063cTjI`f_7>$z;Ic*GLb_xw-ZA3Z1%|Kd)gTqvaw|oHVIu z6f0t*C3l6JZhfk{`*pHljqu!!iqlDkoJ{B8*}MmIY{k_m0fr|>y*tr)iOGVIV`QxNYc3|Qwr5_|=O#Y=e@;}%6mCs;ebQKDjSOOWl!u7mZ~NskWRK?@xk8Vcsb?Zn3*tg|@g6$hy2@P7L)$Nf$UM^6-w z4ut`_9BU!m9)RvG9gHaBq6@au>Px*3iQK~l_g7CVP-6W-p>ge0?MG{W<(CF&C zU~&>UMaQqW`Ks|idy&Y8i=0U9g-1K4=8ta7K=h8TD8VQzLYy-Ss~`o=SO}o_B#Aas z%}zBm-L8NK?v2+4iA|ptVr2A@3u_`R#^@Ywaa%|IK-eX)efxLY+Rb8mDy4@>((*g` zNJUXkk5)S}OiZe-ll2&hUP|o)t;bUJMjI?a(9`o#W$(Q>mrf=3T~Zn7e}XDkrg{FR z;nW8@owrt#SsOQ@Z@dpZDt_+5UT`Ac>rivL! z1P{z-o#27XtmH1z0%SoPNQzv|uhhW?ep=hmz!J}ced1BMyL}KoJD!A-6pX3*qNgce zm20-&e3LKk{5qn4Cg}f&B-mjjB*DY2D|w%}d{*(S^5iEMOMCM5ErxYh3nvbg!r8qv z5hpf3xX<~-mj>0YQ>Sdaf!c$`5+ZG++OxsPm{X7oeXWJimt*iA<3Bx{YA(45ie;(jLo zl?emnlw)QRT6^@GvHA09=!-{NS3B*2=gnNd4{qMBaVwN~I(hm5GtPMSBWWQ;B00GY zDJ%3QYNZ3g930O?949T`<+8NL_fA7q$UU zCmkmLqzQWZzi2{68rHoDQar|&@gv%g+Np_F*6T7gx0#qvYz@q#HSr=P_hkW=8Dk%h zR(7PGEB~HCG%7L=wtEN}V0-qmDcSzusG%&s7$k}qdmBqvpZN-L*vsqI^HrU)On_Oh-?Kw? zP$Cmr6T=ff8-9*{P3zqMpkgV@%QOBb|I zAF7F#{z~so1~(M4XI~Z6mSXoE_QtffjkO8fHeRi8bs-bfuMbIi=s&1Y8(#o&L^pJ2 zoWJzq1u;_8EI_DD#|+(Y;4={&wc(AF`}Qn0iTR6ceN1WMWZ%_sglSe&jC{uc4TR{= z{H@J$G&9528hsk*XqvT{c`vf3sbe2xS%fCG(VMv<3ISIYn9_|x;GZk#JIIA%tK%2z zlIj`TUW#lSyMyodbXNxiKAD);12=p(r26Y;qHP=+7BM>-73LVV$Nz4G??mzQZb9nc8>`v5Dx)@ z+z>1DgkT^qZbvXuR29Gk00hC#02l7ijuvm*yICAMq6TA=OVejTo|K#C8gCH?Y)RDQ zY&(cl=ja9;%U7bX>9Q?JZ{Py^sTmnz@bzOg4A$Tu)!{}N0pm@;dOXn9N}xnkSGyk& zdO%k^HU9Q9NMJ)bM%1a|1=KmYrwy{S1GR0r^vBuB1k8K4L+a8$PKfMaf>w_z`~yXP zniGHf7$nic{~sulbsZ_2)lMl$GDsvUe@P^y1~Fq{B#WYb;&2~NN%q;4;=Pj@rwb53 zT0b*s{C_BO5CO#1T!6!RNmD&f9)WtOWGUUii*uT zutO~L7;}kl>Kg_-l%xL3@Cc2o_rp7-6Nu=qN8{XaF``*J+CCsCZXXOIl)pSr!#;{b zJ2#JUu3KEgS*zeYu;ajBzG#e=t5S~0@4J6Rzz88j$0ZHgQ)uT@F+HC#SVZ8V1IXNO zRqFEcuB(xWoSlO1^pPS}L)%1xx)+Lu$n?8U=%C~PXx-~3FAmTg5E*)b#HZAlproH$ z-KFBo9bMJExdE7Ap)JKJm@PK<+R{U5)@M`06<`Yr6I0ZD0#B4j=ZcXS^~>E_u@Q@ein|QZO)ox|gQq!k z%p=2AiZ4q}3$TOzixPj!g`~#{#ql7N!Tvw?Y)+4`M{6MuG5K0M$) z6<@SI-T;!4t)~THFf>?FP$&I0(UW!~mXy%y9Jn&~rlFjO7%$n9CU&r~-eCIJ(2(7u zQ`W@D!u}hcA5l1Dix9udhh#r6;o86LVr9jE>8i4^4`lc)^Ju^*0l&0QOEon!|Elj3 z=Sl9^-Cxg0YoupN_Fis-=oSX%y}kc(;%3nzIyF_&b?jnaZ?DDU$7Swpd__l#f%eOX zqKdo%5)5a2eLfcEi}t4^y;(Wu8I8eqCGdHCL5iq0G%jN8Z?09r47EuU$S=tV6N4b> zxtxK=hv05Rw;yttvnjx|@TCC4rW?CQq(B57%yW=9tpKv9xOl8Jiet>*b>7cnxQnW> zf39sDplLb1D|=r2@!E5BSL>t>w;P88_w=~h86s*obT!Akk2}=v!9W2AMp1rsh>5;E z!6qMwz>D9!F-jCk(ikHe|Iio}7k0D_a6BsBB*;)nxQ`E(Y2P!6-al+Nvr?v(YGTpB z5eg`kEo`js)rrdUT=4%Q_c3h;Ccxf_50tF>zQHDT+HPTi*AJI2jcdov9zD^>lNmeW z|7Qfyk;bpnoxJz{$3asK`EocO{a-B=6%<_a&gLiCbW&;mc6+ubcB}MT{2Q_gyw&7;@59 z@b9refmw(sUX(fcs`e^4o?M}XzrC%3w$m!5iXa8pg%?WXsYU{lqp#R{}-u8YHk1k literal 0 HcmV?d00001 diff --git a/docs/userguide/en/images/workshop-email-images/daemon-in-deskbar.png b/docs/userguide/en/images/workshop-email-images/daemon-in-deskbar.png new file mode 100644 index 0000000000000000000000000000000000000000..2f472f84db41a7014ae907646c96a3b3b2cb0446 GIT binary patch literal 8003 zcmZ{JWmp_bw>1`AhCpx&F2Oap!vH}B*Wm8%65K5i96|=j-~@-@8VEi>f@^>wxXZvd z=e+N|&;9fLXnCrucJHoUy=tx9@tW#Nc-R!!NJvO{KxKIl;@FJX`Y_QE`}mEsP$VQ; zY@oc1j{nk;DTeZeM*84k?#NB=mh4TrkoCYq{0U4;{j7 z+A(w-aRL*Ic~uL2`y&2)M?eJe92qUV&nrOD5~c|#Y#(*(%24elPpIyFTl+P(tgbvU&sv~;7@tEP~^BwyGgD7 zM;D#;FNrzH6@Lt^NaHb>+`bT1OwCSA{Mj+wKtb8dY<)4>nbwpI0Y`IB${h;KE(OaA zH=D{{2vK@rI|K!0R?7g#@}9`? zv`0ni4Uo=ruHJC>vMf-z5zW5b%e?LL?ay{@G@0LCCa*9VCJD zs!l7~cJUU`79m$?B!jC;Mk}GS=(Kb$qkZDI5{###Q4HQ2zu0=5y*SK4q{xIGi3jOv zyaJ936r$-t-$t!#*M@9D-cOt)MAjvR?gUpo{tZ{_=vn^u{aEOBbiWKxJLHI(eo@m< zKiGNkrhfb!8-dSZT4tADgtIR_l_^672pCe@-3yM%yb2bMy|_M8E5NiX)bFU5@ZIr1 z&?Kg#1Cfr_K1|0sDP4mT6Vkq#1&@tU59~zaA|=~PHY@A8UVR~>UEG;@=3r}v^fFas zr#GApP2Cy2cZ2haMeeUZHEFQ`De($kvhr^dGuaiNkGHg-j-=i1{KyQAZ~EyBBm1OC z&?TDPWF%)AS0P53RH~@;gP8wqCW*~)iJVeOz>43*HR`4E!^dD!hT@<5eQ6AVv-;V3 z_?+mmTRPl+fiQroIV4L2XxTN_FZYOz?1(Efak-b*xyM$zeg{NgWcEEgpE`rR-y=|0v zBli?vnz!VDC|_cTmzNiH?1UJB=GN>H)ajfBD$Z3{6c)y-d)yRG<1Adv?rR{uyIj$c zN&fWh@idbw=5KqNUVwCWY7&7saA$LtVy`3fb|Cm=XI$00Zt1=sdyvIEZZ`UhH_e6t z*-JH|sxyZ@U?LVz>fhbbeY{{vk1cuW((%iQ#nCs9yYq{qxTL7ve1Tk-dgPMlr&f0) zh8orq@!T0gyBxFSrt~iNi(DqmF2go~Z{a9M<8KM;kFa0P^f#(p!e>=|T^cIO~~0ECj++@S?5O0=)ee zZ#2lRe`tx-Rr%57*rn-lHn{{@#?M)HjqbEPBh18te^P%D5k}{7oC;=AeU$f`>QUKV zpkaOGa&QBtkqj1zw7?0~fL$Ff@{_e}+<@1<2k;}B)Er~B&z>GmFwh}ZmNA-|%G~VB zfjn6uog`N$>+8N&ZTO#~e)~qxi#g0P-fu(_unG!h-CrHDP*9I6bOiu`KDTw`&reD{@M~k4kDK3Y#^nvItr?jZ88!9v zvdg^WyNH<8N`@zlwPY=^T_ikXJbUiag^rh$^6!1VoG=(^b{v{W-t7>zEU7d5T&?*y zNFUQzb|j!RI8}f_zwcfXL+Nj0(mU*?ib^luKWk*%=eus7M}k zfN~}iCk0DZzu=B({zq`}7_)GB$yb7v`sSX#8t66qA#e)pFLP>43m zoEN2lJwUh4^ixr_cIta7#bqP< zINw?{du|(=EX~EQQsOIqSNUmKKU<6)MvtT3?0t@hz)zC!X4AaO0oMV-_3V9bRY(gN!BsR_D8DnN|QbgJ|?^WJ)u_ewpT5hNrh3*M2XettOVd0!wLzKe{CZW3grSEr6h z;LGm#r^LfL<5sR_r^U%js&chldKz}5@!N7Bt z8QSh;=K(hmT1ypP51u=Uq$QYhs_QCmf~NRMF`kOXMk4{A?iYJz3;ouBkr)IdHgu;s zyjD@%i8wJmPTs1)Ku3W5OHmP#oIGJSF6ES10yly-1`!qxuwp>)Gp5mv7M0D<6mVHQ zp@5wZKWRh0W+r-{fPlwqADD1dKf?p4qB|0@{)-X&WbOTB?JuUQuA8;P1)BRK8BOOe zC!oi<;wS5SYNW&W25)IZR~XW0d%r!&44%zg#b2y6Ib`1AWd|XME8--S4B6>+jH7Nk zPtXZFkp5JL`Gq<@m58*5hX=G&A<>dS&{ZTf^2D%0o%+mO&~?S&wkDZEuyiPq)R^99 zQQd{rPKgg5=up$UI3ih^tZHe$v;mO$YsesLvd|%LyD~eRyj<3YfWKqs;(qhVDmDMxqbQ^|-Ezp5?7~1+~`C#=SslkiN|3G$x^h5D^hY zk0Teqs+*sl*7QJqxIB=n>v`&+Yi4XBhiF|NzlpO}~A6ky?=QkU>{4T-CdZCE|e@ROktoNDaw zC-aq2v#vlbe}DgmbP8eO+O$h@4-*4U?}N=>Map>Z*XK%rQ^%_g>wg$K0-5Ci53@4@ z9sbsYN23%<$uM;7{pECGF(0gB@pe3Sp)=Dl=1X2_g?gOhR}7Gb%qcPcLoY8&h)teKXy8in2Hpr99&o) z9Nm;U%zkTzin1>xPt(yHNJ^BqfxfMC3fch_8ndoESy@@c zh`kJokSelfeg?Yxx3nRbS~IOl>wv_FIDUCw_%3%Cp%0ZrV3Rp5xpJyjnbh;$R4F&f z!0IiMb=CXly%wwgrsgVH) z@5kYeQxD-kr~8AH%oa9)Nu^i;*pJj4K*ytq8&2Pin^V|;Kfxay#z|695$6L(Z1*=KT@Th43K;dmX}?{#4@1n64TPQJ2I&I zVRCYoWQMg?ZDbMB(en}c_$YblORj}q<=n{qj+U4#DXXEeuRVao;!yW4*kT>`!e(HE z0Ae2Gd-?b*k`Cic8UrQfD|Lyi2a^S8Myl23TiQ}~c6L7a;PxE;b1#hQvSAL@XG&R` z%><;p@^}{jGV{2FDWE%kk<#plHC9l7p}A6>BeeZVxbgn9L&3R!b0GEw;hE<4=H!nb zpD}2I>!%kR&T?!ID-UIUF>eXG2OFq=_o)5|Sz53M?+om@h>0y!4FBq;KHqqi)E3!) z4cQyJmKJ|8e4a`z#{8%sB4Mw#9a&mA#|6>7>Z^zn3_fn(8x*a6wQ!bZEK&Zu12J8d zWWlzBeFkjW%{617Wf!}V>rgsb{Hu*GKYl%I#*5nv7y!`18CJ2_WKJin?+}8^k5Cpn z5qWX9`1!HISVFf_hw!PWQ1mFnNSBr#dfc{+Pk0;Y^Ef1G85JVqIDeKNg>-{uqa4@U zqBo}FlIVsSHL*pB>5_!0EVgH}M*;6HrXWoXb+qQ7tDgN!UlNVnLqrSoSD;_VHm*g})YLaObre#+{)aAK1ZFLdANuk0*C zsc>*FzDSY3B$&pLX`;DbC+r(RL|Fh?*;AvO-^Oam*E5>_9jJRkXy;`T$ga~tb=*mKu(D$lu0LATL5PY<2qnaK= zg+!cmKd48+$9#g-wzzH8MEs5mMzs|(Q0Rq{X|oX?;Qgg`*!6F_{#3=wBF1mz=6yDo z^wo&D*(8-N708I4(MUdpj?e@piF)r#KR?~{;4nMzp(-c)J6liiK*&QQ5CTWn!1i{` zU9iMCp$LEU7}4ih7X_^7i_7e53F3c5sh`Ds92ucm!2(>t=BxV4kn|A@H-g*%O^ZNk ze+@`=l`wGO(8~iJ@zB}RbdaA4qQd0}wUeZ~k?)eGk&)ZA(8p_JrPCA#AXZTFE$Zh(P;gm4` zSmH0nE?XPBW+*#5g!dcP`)+w)azfh1?^Qv4thmS?gI0PlXvHXKdbjtI7+@|_-f9S{ zekDyS$2|cU1uvk&C+JvrNO&4K>90fY4_IU@kwO*$LlHj1?jqS|JjBh#M(V<`pZ!^l zHY3;wK~{l+(9h3!qI7|5>;+^Cghx#LIWs(ZSHE>S{Pg&SWSqZvM`~?PrNq3q$P102 z(!gt=0bmS9qeUhigsTwsYi}mX2_Z|cbYt50=cCLijSIyb#)B0`haAA7PuL)}x*TLou zyk{?$DBV^NS}^N-cG1Vp+4W#n_`YsfiIRnG@w>7hyJ#q8epISU`I(*mK%GFwz2cCz zoC@A?anlkHh{+Xlb#5$zmBe*$^?O6nVBSs}Ys!Ev(hWY!kecK8_dTy2oCw1{PiGAN(Z0 zIRhVzfUl_`S6#GeQXCCy1V~RjAA_egl6!JC=au<_Z)NiF>U=LnOFBo4LxecM*|n%C zi`9nwt+CbhaNYmOBN*pW+sYQLhf-@Ne-cw>tTd`B+ZN=N5nh~`$0^8yb;}5pZmxr^@Dvc#h~Pe>8f42ol7SXA z!13(pMfZ~Nz1VDnx-<|xBXZo`I%_AV4-DwA6Lxu`A>5C>hIT@ z9JG0tkHV2rzam_x*&Vdf>TApVCu4_kO8CS85Je%WLhqXZcODqao1Nfr}|Aw|uDW2+wh%S7sOK zegp4ysQ+Ac0b}py3S1gyyMNUbI)(r*nVRE&shms=Hk+^3i-lCcXr9YD5KGW=?1#%8 zMCs(BK$t*;Bmyik04ApkY}dp1r^L4ffq$_gvif)TlqPmCYKKS=!FLFkd&|G^#tjQ@*5TOI^^BJfB^2A&)n zv*e*lK2#3b9eag7Fk^lb*(doAQvdDq-w8tW{^tx66C{U^Y(%bXssysv(SiDi(%~v< zc@nFds1nG>;G=%b)MSHZc6cB33rB6vIiJ6rpXH|)6Ent4%_;NEJ=n@U7?OBA9gxjO z9T)Tc3qTR@&jIt`jp2wfmm6}u?-oahhIkS#6INJ_K|^Vdkb2z{c(zK;*6Tl7GPpkq zD|<|*BV?2@)*Izo?rn;blG4=QU+N3+w%101f#K!=+P>gbTd>gF5dU1F6T(pAQ3|QO zk&{GnRKdc+dU1$wx*V4|fDaKQSVgydHe;B%$klQhrCMJUvs1X&)y~e&`iJ@>(b#x6 zY}i*Nl?fIRPFr&#wX{ILgiYX8XLeDM2vU>8&tS(auA*EsDrn-)#D{9~l>$UXEAc8V z4Iq=(pMpiN{DXg6R6wAbiZ(ood~_dJ`K$V8CT5yhE5YLHvKeqf7B#hm*oZH^ijJxV z!FLMtfU8OwU#7vIms_VD(St|-YP~Xmjk5tCFHuo+M-mB`X5Q=Xp3BRSh>9&S%av@^qV53^YQV$$%1%4l+?wh zDqK$XX7#`Oe$=uY>}jTcQgN-yDG?L$Gly3WQ^C{tl&Aem#9N1H$|xXKc3)Lr-Pe-VB#ikAhySTpMzB0Z zqx$Q9TvVJK8$BtZ6K?QuF94lm2kP~tX3czs$1FI!#hVZv_jV9eXVzteoArP&SmHY$ zw98)tO0c-RnWkc!9R~1lP zwbUoqeNM>A!l9nzL^`tQI4aT#Z{M;Utns20KtTbROP=?hUziJXLyK5e#j@6lR;@-u zehM7?6nNC}u}Wx)!J|wF)Jpjwn(K|vB&ZXYl)aS6T&N;7bz5TadoAB8$6+?t;T8f@ z{Ku(I-%95zL%3s5LmXKHTin*ozA_(-C+B&y!^IgOHO?m!y#GZ0_*utCze?}jSDMf1 zxz5NNq5kZ`_alftR)u;k+%Vpxo_`|_w<;JI}=7*QVfu!bOp{MfMDgI+CzaY1p znP=O7-1Xsn*@lLGjZqembRVpDut$E=(Am}cuph=hcd9*)C!^RV#2WdRw1x9;TcuBo zoN~?o4N$&WQAtUgf#7dKzIHl)MMcDF5&Pr6lE?NV3TPVxec*tV4zc1W-%71KUSdZp Tq6{E@jw1mT)a7es%|HAMg*iNy#@$i06`HDX`y!!kR~m32p}D$_t2#qs)F<; z5PI(&ZsIxTyWjnB|0M4-nVG$3&&=9u?Kh!X8j9p34@huuaLARF6m)QKaO*J7MMMOc z&*jHMRX8~8EXoS9y6%%(X~a-Hi-nfE(^{_V#nHbNL}MRt({Nr`C!`F0j<*G-N4yQBlH=C|Ix2qNNL6B&MN!Lzh$(Gf z-0JA__R6B?R3u{6XRX_Dy#tiT{#32B-DTO)rv(e7G8ce1)Vx^!x&PKJ!qr2E6x(%_ zt&Xqv4TtsBx#pil`wywP-&-m^FvouI1Ke(&;X>2(K+mXHO~l$^#Bp*2rB^oMBB59x zdv{f!WE_As&>$QwI1n9^W0CboOS%GU2x9e8Hz*W6}j| zEMax+IlEDHS9fcNwRk{sMCJET@e~PPn|As|TUqms|F5C*{jmtu^ld#a4LdnXZ@+8h zjz~Aiw1)hD&H*^sm3tLhSvN*$G^;RMWGKy*x6x}Vu|3w-Y;gRIj%nAS{s5XmzfnT| zPdGp$*?+@<;0G1&=iF0?q>?Lo4$Eq^(=N4yyo=|q{&xYrC!B9T!Px_;Y+|4$UgmHA z^>PVG^*={%^f^a|w-pDsZ#VYPh9hs{IZoOsW&X4Uk#_Wj%<-`XQuR7rUwU9|g!p7Z zVCEc{Ci6n83$;?TJ0KC$T5JwStEj3HW7<y|oQEkF!;hlvrx+eaBJjx@Dy7Os!gL5QOG0kFA^1(9_q?BjQv<8Op(y zi|l=RC6?WlR82^BYSO6dJP1VwEMKiyYOhY#NF{LP8|uP5CSt7Su05X4HA}Ho9z1vs zOR!qWn|3pdM=KywKxW5Z!S`aOUk0>T?8Kc=UB0Iol5nksoo3BLA=Lu@Gx82E*miV)+b zNoJ*;T-}!zzjHTHD7*fgpNYzshzl~aEi~tyeb2SoMCp#k^q6r}d9(frPf+G#^~>}q zxnEOrl(vYpqhqkok(hXTT#X^viMVj(vwzE6lhw)yb%5fa+;y(%JqF5On$GP&=FMNB zQwOcU)lnfMitwYEW>MOvOUX=I8;MgHk^37O2;fT@s!$(ks#a}cC4>8)zpuO|-_HNM zRVip%@(evbkDM!H+}@bJ6`Rn(z@J)e$(!ztbItFeMR)}ROkKYd z@qSu*BRadhJF$h zw0q2vR{4a7D2KF%?9%;F&EO;*6MwCyqaDdC$@-hJ_skL!eNzcIN1duaG(ewz(q$mo zP4`EG+MJ||^cE!lJPy>3Qd~NJ)e0^n|rotJl_swN@{{fpoV#0P{ z?Zu)NsidUvW#>WD-g+~TV9eqjCKMMs1r3?rUF$YIu7|n7L@Sx%ckiOis?U)uNw}Cp zkuLC(O?AB46{@YB@F+pbg`*a-L9H7UWEtcvRCyGDzA9a8-9A9?Le03Y&adCZw#bvq zH#Ry?C)!{Eh68^QVT~b2!YDhom#^-Qu6)ZPtAf<>$D$ zuWt@nv6mmb&p=9fFY@)E0ZnkxM>*Ys!XTQGe3v0|f$%q^0UD{d$_ckavayiXbw0e_ z_!NXltbLH49SVfN3m1-TCbd^#g^UOTXy8#(qmsfM8tZrO>V-6PyF}iyM37rosMl9T!_wJ!qBPaf;EK$V|Pfq?y#AzuB2aaZ3rURmK zK6|4rIm|9&eThhBGGkXtjhVienNhwn(g|xl;yJ2jvYj%2uJTEP-pBF0OMb@pT~RZQ zsw!bqB5*WRInv)jl51A4) zKzeYC8~~|>pvDu=k>9zO)lw!n^GmmmyU7%yS_^kVOi$D_$v#h%B1?b1?XL2DvUTwG zMuVW2fPx|Tw4Ga9NBd*@6g$45l&7M!-nA?ltzZR%m{+XwQi|u?(oZ<>kW5T|1^szR zLd^U8z-=$-(dtwcEXcIhgy`y#3HQv;3Z)k>KC%6a*5~HGPAB~p{g^tn$Rn}O|17upp3H&R^x`iKVGYx{(p0;m<_Q#oaE_ZBvf9-@!_U6&RH=?h zPw%cl%WmoFNIzxCLVS2rK$%s$Yl26D z#ZxhC*8AJX+hoVKQPIg8e_^>$nFEp`L1mx=8&&c2tjDfQb%2(_=P{no?BrV~pQOds z;}iLsQT=;~2%f@ob30V>{!c9%Iq$nccd$_?X}({RsuCeL&zsLv$AIOm;EhEDo9Fq2(mIrh!qxe0cJ0SZgAn!e2a6IDF zViFh!xL_`y-TUtQs;&m6grfIK36+w?lBf+V*};&g;8-m0>h}MKkBPluf2yoO#G2DQ z9*7<-eu>c)fzx*vDurxcz}yagzQ*vh$Ov_n$nFpfi!3dbL{<=r? z*4dvoLk95hurRg`o*Lv_Cc20SZ1O+}71I?5kh#2nuArz0hN%nu3Xh;&z)FPdb~M`SqH}^LLY*_SN(~W=)>jyR0e*V zkn=e0tj0zt^}mDS5EN!n(jlzC1Qu1jFw*#kfZ0l1AqujxCnyZTICuQ>=F^9 z7hZ;@(9!f<_x<@22Pa2a?we-{MWBM%vACTNaCUXE*laWpNM%5UQzExPh(JBGE!63( zK$xYz-tk(N)u8%{ub}65!9zZUKD4hp$D1aU+%Vl(cR%?-4d*kTy*m})NY=wnZs+}k zxHuk+uRg%KSW^X7o-aV?R8{LO%A>Zq#I3R<^uuAA-P&IPKU=351(_Ikb$^J`UR~PP zeHKp{v~Rg0d^wjIl5YH@ZREn2jF};n@8&FOphm+sC4BB^^P~8{fG8P;B8I{XzkdA{ zUVkW>7j?$YRImA%du5bb{`!;-AW#xL+=**ZQ1pqEu3~SpjELpXlAQ zyWADJya={2ppmAEikP*of_AOTeCfSWZ$Ar%IA*gkI&~e&wR|OhVu5Fp6dsncV@;t-m^T&EW42z4gtmxoFYmkqA=4`{~Rd=M6|frISszMchIKjl_Je zSu1j`7hl?#`T6e^)DsUU80^hLLXhf5Qqz0+G@6)*!oAvN82wDj$U-d##Lnh>OnuKD zFfp~h=#6MzVcI;~mIPfM46e+tft2#q;AK01g5lZdDh_VDZrYw+;LrM_CKxg(mgeCG zntpRFl-_0`n)6bmL<>Sn=YvQfNXNtiLo*=AM0FZLL5-ihP7Goc?~{okW6#n~H#gri zQgkpO*(2fX=NyUkegZF~hM7-1NMyb|Iq8zzh%!`zL3H=rJ$~%uw#V1{QPl_=4dm#Z3s z)SA>}O=nmfS(->wP`iwi#LhDfM`96h)T?(&A4GRQ$0v`U`I4ozJUHXD_@SoSk&|ic z(sTR&%^)bLZ(wO45RAE6_gm^Kh)nIso;SEg8K}Y78=I)>Htv^P@3LPXY}g|`D&@FK zPXl&aTzVQg`p_EplfUkn-^K19J4k-eOYQT^$d!*w@?K-&yH<15R~Z*T*QMp&wLPF| zyA;z_j(={bj zR6bs=FH%QKR;OR%WVz+6{sywM%VV5ejh$v6jBFkC34L7pB+BRIGAW$2Dhcf?1l6h* zou{=UqDzI=B}JW;N@vANlo?CDFD&`R8(X(+;Y=@jcjckr{9MZ=&GU);M@vyrU>F9C zAk3%7gMqtRf)MhSBjV%%^af2%c|U0fD$J-H8m~Y}OH4uwl@yU9lSPU7V=6z(F^KGI1CHaX#T0CoFt5c{ z4dk#cQORMIBSyVvVj%3VhR4<&0{`Zc|ED1vGff}{II+1#WdPlim!Chyzxe?x_<2<{ zyhkF79hZ9U2Ha?Z=lE8v9KPR?1L$Kldlj)lUFc2#7(P8_>Ze{cUhl$3$j{nQ&gr(; zMP9hFIZ?@_8d-XTyn088@n&Hc-hfFcBk~y0jTx2FxIKjH3~Pb!M}(yT?p#58yN{t44Wd`lkT?Yb(Y9 z+ISso0nQ#y(`iOhXBhMGj~o?Sh@c1`M7V{g{8Nt2@O}6&e`4adXsVVwPIG6UvB6M` zhi)GD6Gf^#YioOTTbj8r*7XdA&(=-RePy!cV7kJTRK;PUXs)uh9EUi)(UrT*s&0>u z$4`=$f>J>A^cH?ZYL>sc23$(<z~&{mMeCem-0F>J&dpQN>O;3hYh*Ohp?Se2nWD zNfLf7I6GIxNRR*galJj~vcmi5gY=1d1%ojzG%am5l7%oep|2fYY?)IPLG4r~wo*fN z;8a6mA(5g>h&^nmWMvrY!n8YJW(750ckS!$<5vM-T38Blc^D7SzgsdAlceJbR?OH1@gVjH*8_Ca^=4#A#3FQFY6AqoC806z!=R(51fZ9EiI zp?&MXtlYa6+Dl!B{(^9IQ07SB&P)BzG7AWto=!bcNNO_f3#DM5yT+?O42x^WNW`o! z-&80HNATetYU+>$I}QjhUor-~5QWexFh5bDr8NJ+%>G7eJ(+Izjzwz#Z((!5rs& zXIy#5J!<4*NmZSpu89eJ#lYlGNtV(1-1;j^C<~YqMA<{sEZ3RyfhMfFU|;jqaUcF; zQ+=)=2vKDL$9!Yb*QJOc8H5;VFe&MhgITND8Wh3hy&9mzKNB1FTS}Gstd$jH@|EJR zIbZ;qqT^{$dH`gOy5)Kzcu%(v*V@C$VrbB6?r;ks;%!Et4t53c! zfdeGPeLyPf*;@{MTtuIk%-+p6B1`;t*NNfaC$$F^QIv1fHJaF^xB4*rzR`PQy~A6f z@tEw1XO%o*%l2t+)?;P!+ENqI^pZeMj>I%3KIq}zTCoFt^CV+<0seuo)43YILDg-q z$h;9%n1w}9$XprV;O$^X-^4+gxBOF*Ao|6vON-NINn4>SQ$5b>ZyNs%gDgz1txm+I zdm8R^`|oA342JV1+BvcOw<-7R)M{M+!9x^g?xQBpLHIvlhe^4&QSrodF3}=?ml6uE z3<~G@x9dzbT9i_z245{6Ah~LbnK?vWRf9HIAd>^+n6KeH|A8~`aSmF|r$3^)l|l(q zAw^8^sbb-^@*OI)7lWN4cf`4|u#2`Uqems5v%JAP=WLTE6&qmzS_%B@A800h( zkyI)g$xKq7EL>bK>K%e2o@1)|f*cS`5#`Euw1{5%+JXA=>MA!ZHz%j;7pD7o4chZ~ zlehnm0_y72mbV0|Z`M6ZPDHUDPG{nd>vghiv51+uTmUta)_Qh&`X|<+@=Fhh1GSwo z2bo8gH{CzTPu%OE(R_8ZKBDzi_q~!_h;g~siCu8FAgASf0y;52wxL)z<-L|mZ~7G{ zjn}P`W~;xy(h%Zf)|ibhg23E>0jc}PRshvgvKyqy=bPE0m>vf$D!EN<*uusS0C{RW z)YY}7RX+SExix}>K5%`A0~2QRF*t*yYf-zy>QC0GIOw}~59?hv2uw{)*E+Ko8qih4 z8R6K$Q`C4*x0X9J0Q4-RzgU8%eSlS#GKuFmG zFB~M>E^G?VZBdM3TKdisI9`pmn?{<|BBZ=VYdE=;i&$`5bkn=+P4gG?D>wjCHF%|; zo<>|>U8t_D<%`Q2dta8kb-1W$;=3ZJzaNsH?y2G_aI3V2BXAs3YsQqLYsZ7o&4V+1 zdr^&7r*0_i%hGjG-(oen>zIfTGRA;;`3v(iI7&&n#v~zah-|xZ1f0_%0fw*vT`88M zm<1W{h`9x;K8@@2$7VYo5I$;Yv(@cR!=CZ6-KB0B^9?VEERMNr32o5P6_{oJ3THMA zcu$eCDB8l(ihxeaFYfSUx?cGdM>R};Pf)nn?|)@hh3w&O0fT#6cOti-tT<)$30 z+WbOiVXDaZR2;}8A>y|1qKm>iqnbwIz-_*^&G?k}zzJ|6idRZO-Zr%;U&beB6g@-S z1VrwYp2S?6XnHf}Cq}jB+n-p+k!p9ixLQs5XJHd=9Ku)GJC##Koh4iU{n&8r;$&Sh z(p8)SGTi)qMRG8` z_1L7#9;#E<-A~~gQma6g+cwQlRXNx>m2|%%?{_VqQRd4chB=XZ@#H$8E4A1ZIin@zWUI584Eqrv^xD^K-)&Z2Z6!L{#6RvJW+j7f_0EKv}(wnEWu2K|9^>R#8{ zIYTHrsPUcNB|ft1*qb(N_S)BKag)E(=Rp0gbjlt{z01D;RFm-|$32a-OG5qr7q7kt zSdDctN-;5p3D7^hNSw}HEDV~MxdLLU8fT) zFq-Qz)DR5LPDIW42wUyT0c5J1M91B!nse{*;zNx&e}$lQWE6W9-Xl1Yd3=S+8qOc=AgXCwIRQ^(-)0vJN7&l z<#Chh`uiJnWbIeR*KfzzZ|zeephk;L1xG3#u$rif4zbC8vLmaJ)G}?1EV8QSvVM-0--#H~J`T z2h1D2IK=-?ugfM z{w_`*^RK%*pHA7{=|cE@>-Z8#vb-*==Ol0En@v<$kSC-qOM^%vsfOa<4Lkt2ZWf0G zes~^9Wzlx*67sm%DD!#vJu6ngJ7-te$5<9t?tFci=jfi;efntz>2y1t6dqp7l~Gvz z{gRSOMtid~{CCx}PeRVrLx;OCdCiLmc3qro6zFj4CV$KN%tQu-idD?BnH;m;^Pw> zP#zz4d=_*3@sLL$sQ!V4MLs95^-y)9*i*hfv@{Ae(je_~cGPK&xqM(-8cNwu*(`SV zNSc#)2S;^el0T$X2Cx6H8$)FNm^hX2S3X_sZ`L`Z*St{5N|pLecYtw$c;EUr{q$D7 z-)kz07nl^TD#+qaJGwa@T+}8~Fp&Qm_1W^z)K)3%+f6bYoHAK+)hHJ*_{e}>H9Q1@sx~c_VDcyY3X~(t-Qu}QLRcu z<#Fh5g@s4^Bcn_AsSoc@Hq`icOELcP>&V!%F!9$VBm-KK$eQ(3aTIm0QJb@)@(Tvk-xJFMdYhWD$MXdy`yy$@=68mxr~SXq}fD}GnVq;Zg{Gw%>Xz+v!IHl=OKrWC{X z1Q_j#(ePt96Gxqyouv$S5lX+qjcw-W$HIY+?V+InQ zG;$#VN+mkTlRlGjNz_clCfkjcmyQ1mhj2Qf7bYf5gn0junU}D6Z;Lb9h3Ic WHs|6w%wJ}3l%H!Tl*qmM_5yDfQb0kZq#Kl8&_zPJS){xB ze&K!Zy}$cB_n+N;W@cy3nK|ckKIhCts6plMaUbK}xpN0!L0($p&YipU!0%%02f*iF zp~0#al^4d;9; zQDXS>K$}ew`*2Ph3K5+6IN#X>3U9mV*TN;MRhhHbGt~7n?`uJxo}PW%zT&g!tj(GI z8L?%*+4|!qZ(IARI^s`fsiL0GUiW7hy(f|i-z@~ug**9!3!kz=q_BB0k-q-Hl&KE= ze{#{-3?0nO$J55tQ=huuc`V-?S6Z?Yi(aAjP&L$T_tJ+`G^7j(V@6oHDPm_9e1gmXFlX;R3-vlC< zf{8Tar#5AtA*v2YX-Z?jzsg>6F{1i+O~K_J`N2U=N3|xMG?PLf ztwN*5{Jxh6M)Pu0p0K?v~sb)L;6w6&5ofkW)=?9ieZ=_4r%=JZRa)?TeFBNlJ|-C;8Pr1(#t3+CeH z)o(S7U&^!g(mU~oXVqr+3>6#Ovt4Wl)_&fh#|(0X6@2}7<4HOXv2P`R%c-;vPAX%s z@HtS{Non<&`ksHNC@oZ%24qyO(;3=dv)58A>lMCQ(` zQiz4SjF;WM;)3L`8S)wHY3TpiporKlk6hr4diDnRjEt`KoLa5jI`_R^W(w<_u8poxt*i{w(-L{l1sfQ2$U1a!m$M=8r zQmO$x2>sVS@)Vdm91|6w7g0D2!ITucCt!uGZhHR?z>dNLh$VESuo=2oI60$lhMRx* zl9WNIfDNn$?iJSrL$bO-Kx^p=sJ^L56d2i2{1GsiU^V!~x7)8^A}Q>f<$;z5AP}h2 z#uUT)oGE{tzD^>lwyanK4%R8H@+dWFg%*ChBqrG;w8QF})R9dx)bd|9?ddukQkD2X zOGqdB8<_;w;jtazP(*crtYbD~F9SBe(;O!afR1F_N7UvfJrXoDuzFJI(B4vo;mN+SH2$U6~h|=d-zB0An{P^@ZNkM)K zUEc9HeyZ8~_-ABpE@P$|{4W#4+17sp5bAGTnT;VlA|mIDRuMV*R>UWCuX>}KeUhV@ zSq?DMev0AgB@DJXtefiW&(q-~f9hPeBL3y4cu}ukDbm;K5felm&iT0dH*3QhVrsh4 z{SV`ovg?~(2l>QWO}}(ZOibY%^iMhXS=C*O>gq_Cfq{sCwAevT!}&{e7ST!591fNN zmPgB6P@I^$tUZ?1fipZXK~o}VE2uZI__hP$A&W$OeAX zKrz+51dSpYc-L6Jfak_DHe|%uaK(?}FRXd;Tc}JC8)EnTe14Tvcg$$1Mr)dZ!Dc@4 zO!4(sg35)SvX2^EZq8X*Y7px50O;g+LhuNdu3%R+vn>Br-FSC#3kRM{v zRn-MMAd1jGDD5_iA1e#pn@dObA&xt)(w`jXTQ0n+s;l>` z+4wt?I_Xc^2s1?u2fjgRt2bX6`BopY7)^4p)dy5p%6)G?WaD?UiKkqPX z4z{&YdGJngD&Vv4+?B>R8uIlJ~}jaNQNW zZ9ypkx`Ha&O4u~J^jy!CM^`y-7Hsk^Npi3)N4ke8m9bwb?S`HGz(hOs-SwESzf$Px zF*DPicZOwejp&u;#~M8qM5J4E#Ah&omM?!OXQ=+_%sG7d`X+{6NZGmg80{r6H8o`j*kCdPL}#`8RZB+VvGtIQ5=@kLPccfkfwIk`4l}x-4ZUa>dzZIG0-aiNBeV zHzuY`q0iIPd*1Szk+kgx^x?Kg9!V%|!xtx`vl;;-r&(;*(L_}P-^1~kh6Bkq*DodG z<8a*^Aux7+*udG#A+N(YRyz|2mxze^N}q}rv%A_V`Ku2fQbJthf~td7+S>>6FAX80 za+C^$5;P^p*1BD`F)?4yS)7}@D#U1Lc)WIn4HZ!ujs0yDu_1Zw&SQ>GwLmHc^=aa6 zAAWB1etev2#O9Z}Mg+J@RmH)x;iXY>sAwYrhOfwv`a)Vex{^F-<^!AkWD`|5yh3>l z?q3*x!cC|dQSgtRI-xtDLJmX23D{d@=QcQRgK#~QijYShH&_tkK-k2&EAzd>ofjj72$d^hvR)RsQpA+y^-~OU)mBxSy&~8@!sTK$MdSB zqE(9&t!pUM$NyF(e&0P?ykl~dg{lEXXh)PXDSIg{g(3HsPqzBx3Xg;{pUFwZiW2{~ zmsb}S!i5A}In$nRa)yzZQ{;T^3kz?2MnUUcHd;q#WM5MHBsLdrHQZUaPPjB#SaT+f zi#1L<@2+MwpOJx`d3aL9gP2T; i(vi3hIUawR&PB3_Cn6OT6=ZGxyc7Q-wOu^VK z7vrCVUG1EtC=XYJwONOh-eC2fvw*Ck>8!|vDtv|0_;~1RbA&$I zqm=F{U=kC5WMS+U5<5$mBuZajE!FB*!UNhvbRDkP*wQ{0XzNwlW&aPwVrg+-&?lC?2=91ya9Gix^-fX_6SzccC zMIBG$pi1f-37mIi4xw4QO%Qe<9X4Z|9X|WJfXOSAX2i2t?R9@*%B!RPuxSHZj`e8= z(ze)aIhYw&%r*h3<)70CAH7w%0nJoPL5~sbfBf<*s9=@OCao0twy(_Lq-}J6H}Ll= z^@zhg9e3^%U%FC6>03Q!adBgo#EesUsDbxH`5WccpHgATEBiBcpKuZg6ZbPD_#eBu zap%71Yrf-JUA?oqom2nPBGYMY!td0@{!k@yCU8`^I?M>epw7#st%}=aG_S6Xh?>Ih zKDWCLKe08J+uo1dUvkkC^r$f3(3Gah_Ldy63Gde6xy)r(+>&QEx`qmiEMDhwi4oH~ zn?1aOVImhrR?<3 zv`4(WyZ{9lyDG+X-Xa_sA+Uj)=#`*57+k!(8uS>R-}C)=(|Py*bP^6BZvGO!dW2Pj zvA78?O3bKf{Gj_N5qFZF_t({TH`69xE7x1zCU!&oq*&{}+67Y}0iO4YyfSVo6rUPk zW^uR-Gv|YL%sTPubR<&P<*=U`a8WsBfXnI5{7dFSON&oLh?Tb>R!#SDa*5 zlT7hVtqo(tH{T2x9~Ry1_iOzrzPK#uY1091oB8?#Tf1z>Qaa9V0o%j zi$3radIFMTg|q;?4Jre7-=6UebWaoPUZ`?`7;5Cct1RIo1%cp(UK8d*BCTM~_kh{Z zz0^=s`$(dQIuojX{a{L8_=oJ9pnO(HxkKtu-_)8CQXQUznA&|}(!^s|O9NFhU=_Fu zk@D?ba3l1-+mcNun1d}kQ((tU$u|W(c!z=jm(Fb~}&|%|;+d~+f8`M8e zKh$_wY#5?1_wYb+NWEJ0)>Qre{nOKPv(YiU&RPeh`Gh|2+)^W>14BOz+}ReRhh<%E zLab3)9pA=yV~RguI`lt(GxeK}R`|H{=!C=57X%Xg=5~bbQ70bK6~j5;z4GwWY#l?v zIy-mnXswqbYVD0$0l_n8XEwF!2+d(Mm3h0cI1A1MD31%{I|$>esfN z^neHVzAjG>cpGrnx$AR=lu5_P6+PF~VqOwAeU|%(&rv1*y-L94K<}mn|KL0{1CF+?%1L*nX$iY_`cZg;=`@hlc_4u8VYioxr4YeLQQ zt{z9aoSfd15XPD(TqcU_hC<{WyqpjxGNBPuSTM}sK(CFZQsRABW z7@b!N1rmvj$2K8*7l47)d%qYrWr!8hw>VyU`OR+K&rm^GQs10|Jj$1t_T0D737rpP zu64L7a$J3WFO12;amhuft9dm5Vcv`^Ex$eKG=)9nPa&*O@ewWQ)k78K9L4w4Ir1u3)<7uWz*U3RMrW#A7$S2YD}e) zbAA&z<;b8Gexg|SKsy;weyI=KEl^}a@47xBV>E97r=_NTi+C5U;@jN!9^hbo!JNk_ z_m^8ml|fmEN}p%XxW1!Gl|qqm14XDD+OTx%ftK~tL^eT zUIO-!$aOb{>ycV5@n{cjcZn?bgSPr@zu{EtcRNeYWsVP7y~XNU4Ytp&P8O;7-B)6= zuTSz`d2PG=2pfP1-<}|q5q!aozx<kGav`4SGyfcC%zfOp)xMdfSwm@0Eot zZG%cxe@P@#=>4vZ2(FJNkIBAn=Nr@Vo*CA7ERb*uZihSgpQ|jNe*~N_PYF8tav!xp z$0)Edu*|JE|9)9cX}-3-|0|kgu{T94M&v)DetLEUpWN|W&}j1^7dIj(=A*Mkw_BM3GJGza@)LO3^oxG}l`i8PK6b`j%LI(jG^$lO<&c!EvYDAGrHpuw0#= zUw^VSSX(+2c?9KpBwNhg%e!!XrV<-uqv%1DRdd`nQ!FC9A88`q-s&ql;k9Gx5VB?f z_bqX>_rrxvU(n28v<$5Ks=*U820#Uy#&M^oyN)o^Ft8LAZ$^qc<`I6jB!Z_%1Cl+q z)0d(Z4esa)q5si0O{Nlj=;?AB$H8hXl)JmTKs4hZEbEG%Z*{^d#ZFM+lA-${hap;} zh^ka);*g*(d35}%?W#?nzSUxTmGzSqGn4r>!Nq0uax_=H#N@b{o-`>Pc7ouRp=x)N zS%1-|Rv}B=T+RL6K8MyP0`R0KVK8`F?G9w4;j6Eu+d|*2qs>;3=IDWl3Z=j`_nT4c z$GD1q-w8pOJL{X;IcJe&<8-Bz&pzS*r7#@&M?VDxRAM+uX(15PD@9ST5ARX-*^=#N z(F14W%RFqB1=`3>(%0(G-QT?85~sG6pkn!%Wf$FrpZ0yah?=}u!qf%H1}*JS3M91) z;r7}TzQVzi%F`MoAuN&XN6~$=XZ0aI@FPp-GE5oDm7onHk5Q@0su||*J3#qg7n!*& z#p()gsZ>20Iae0pRyJ|3kvb$Z!Q9pSyzbJQr)<9+gvdijaY1}xK6bd_u>%8`AUO{M z?!^`jsaeV6!uShGz{wjBL(5&=`7i#V8B$29?ZcgAMzc1gv;66C>svlWlnbb!KRQ+= zAT^Z|NF{?2e5fLqd@G9+dzCySD`Y4s!{f1wTqQ1XCi7Nn%El z5_BjN%7IB298u29Lf3;ma37?D0ZOYIViHJ9~C?pPoL_!dLQ_fO@=c2c!8?E;Ma|c8O#07#TASRMc zX$xroBegkEU6fb~)XxCjSnF+43?*1tgdm4}-pB}g7dB0vcK_$({^fTmD)(>ZF6T!^ zEc^~j?06yR7{nt_WMpa{iMq(`_=+f1c9k!+tAE0cM?7D|vz$Vf;>FJqK4?DXC8-2Y$-rxQY5${g37rrmK7z&?|-CI6u_lG`-!Je;Z z!j+*raxjSYth6@m+VIqEwwKr=#kI7SGyVH>N$tz9O287IH6x>lfiq%n8K@gws{F=yv6b*P>CQbB!cnK(CHNEuxTB4yJ zET0Eq5b@5_V5zPTOUHBuVIQvAF9q$jvNNFwpDS6`>gArOz{B}aU*`hn%vVVd>aW?7 z^^tuJrPmJ`zni|)MB&awJW@@Dq=NJy<-0~e&gGWNGHmur-|aS({Wv-f(3w)>oL+wd zZcp(6!th{z{>_kIDNWYmeB^vs-qH?`tdGSdfx;@EjTXr(>v*ZiLqDtzQ84KddFY+l z`1@x7LA@Olb2pXOqEPV^-6r+6{u_@BZUJk^<;CkB&(8R9;FH)Q>YOWbwYDFj^a@F}b>IJvp!*O42g6wIr`!M4Gc-`A(uO3#eyZs;n=4I${)Vw zH*M`Gn~9AFzUXVi#MEnRuvP>L9muwt*Nnzr{9!Pf*SH1B2_aU#Yaj7$%@qeRBoM&B zvV7leeK`KpC*@4x8X<-#{tnS*pdd9d{Hk7AvG*~Xs-CV+1J_qo_-D({+3m%vcyY^A_?8@BcR8)<8|s~m4Zh$IAqq;x=p(8-NTn$&BDnPv zzIW)D;HJQs=23Ct*4@M99mO8vx1MF$goY+`L0^I&S~5$Uxg3wMKN?Dc$s@^d3-Db5 z#g`TdIE~+tv2ZE%@nUJ4Z6P?r$zR9+{cFX<^%OU~)$mh!Q;j3~i0G{mPT_|hWtH#A zarM~abZiAIEE`0hYVU!AhtkY&knpBbVF0pkyf+Z-Vl?U5Jx(>m-62X$@9hL+hO?gh zBD}PBZ_>iBt~Wqhc&$tNRAFOxLuPZefhQD=Sda=)piid@*>|$>XALC(*?v$sRBk%( zh(?IkfDO5{Y|ZGikNY!IfOg3GS7+p}`5sc)sM!5wi$b0WlCs*RqG1JZ+FK+k2t!AP z*jnYs<4!52W+t@@K$5rV*DRbz)Xg`0^Iu6iYP_MH?Gp7XRQKkl2tgr*JE; zJvqJIQ4)|fK?3W)=%b|zw-S_ij&+bkL%m`FtQD@M1SJiFitB@Z)Z8jf*sWju<+Y?EwH*{uGNRz3R3#?cG1X zyW7rqgTDZ5GbCofgk4tN#l;c5UBGoG2c~!*X9$JH9JFee=%4KE%k1pz#Id`r4uZD$ zf#H8S>tkp|6q$t7;nx?>3Eg203@=0H=6(cCc>**4RDv(bIigS~-DaN$ z6^K}ciu2LqP9gulPh^{}2^w72LxC#>Mlkrj2!hC5ePgzDcCB0<`IhDg8Z6juXqL`n9lMP|4c>Gn8Z~BkP#ZMcDZvylkialIG&*n>2en&|5BzjEH5b zeEw4#uArdsSd~-z^?gAPHEzRS?>_;mlXKR`Gs)@WcgN83sUkZ&I=)X&({gcf4F<_| zS|iyCblmQ{Z;inLpEBP?c%SU#$S{c)RQg|E{RKnR9j%XwyGzg{*hW<05}p!aX6>Q# zD+75IXm-9p5m(3ZgX@FUp$$r4=aQ#_un0Ml`%<{mYthURR?>5$xp*hDzl1Il=_B|W zwav#q>I^h{yR(UL*?>tQ)?ofXkt*Ak1AjGDho-$=@Sp{i&?K-W5r{@0eeN_TMx2W; zee57C4BJ)OdV8VnbGMa3hVin4{Qg<=i|ZDna&x4#boMxFA9NIZtEf8R(>0-mHUopp z^S{xn+?kIAT!KVAIpS$!Z)2@6bBfQMS%r;mcZKs^%`USG!DAscN1EE)m&A`3!b)ed zQYE~Zq4aueeb6CnE{_@0)$1gDk{#y*TxM97<&Lcja0fCdOtBSVxy%$ioO&BS%XNd% zik(N%9kmhXJN8mSbj%x_K__A-;!fOj`P=Q+&yME{g3Fv}HMUuCNWpW5w@k)C^7hM2h4$Th%nw<>gp5= z#YSwmJV+sjezPB>G4guY*5JUU0q;sSEF6|{l0!_?XcWreXuO|dmA4lw&DINAFVLBv zK$6vYE#Q&L`NZT}D3ybEeD&bHOm#^KXXarh+{N_k(fEPDGAv7Y1YH0z`AmrVjUXv6 zvDmf%|I@DcX^^74`ZNW+`d)2hxV^qIH{`_GnQbOoa7{gfgg_) zGIdV37)5dCH{%_TpuTzc;xCeKYa#tDe{pzt*GMjg9 zTE}hJ82e+q!^N^w)^u<(Yvq|&SjN^oAGWPqwzRe}F{vk&uIMgERN_rg2AAUccq>%W z&L)P&{Ul+=aaH({^`eG)oF5gQ#6}@v*7rNJH11^M*Pb6;n3p?IliiQkxdF!qlS3uh zJ2d0uQs&yo{U2_vG4}OM4q=)=eeuc-@)^8U?^L+;%l<{_^*l_E_%(FiclsQ<7Bc59 zN-SDMn@n)rK@qs3jhmZ3rlaM^7#|=1Ac+Q34x3j7$+pL3x)$C#KVA@G3wPt(otV7} z7=nbr&z`Wb*!@EJWtcdT6A*~;mu^o~GXn{}R{V&dRA%D-fvZbL!%yYvrOu0j_mSwG z!}SkeOlFaLAeQK10xrZ;1lq6iMT1|BM_o$fhV;ekcF4izP&}P5{@WbQa#(MX#zn_f zR;u7f+P{Qw$=`Esx))Fp4iag>E3Fik`#N2FOMOKgjTN&HAUD|5?^HsmShf-oHB{RoW6HWAOt^j16*1iXPR(yik<0oeUnB7*V*_ zCI$`>N#5AqX1bo?^xVJCjKe`Y&zW?*zQpk!rb}U+7d7|K!;r%@t?G=4`g<5Y#xE+L z;?MtX0yPkxh_opDQtQ6}9OlbtC@qY`FW1;7mfGa~=DI4x^*HufkpQ+5PZDF=9 z&3`UnrT+}(PRSv9n#hqQbRX8{`r@1%cG8{8Q*!#Jlg;7?VLOzMe-V1N&{3g2$R@9D z!!{^i;!^b#w?x^7qJ<_vjL$@7Fn{;a!U{BTDlrR%See-??IfmQ=vZUcF*LL*Pi;m& z3(*r=NNANASMlt_B4*g`(@>h=mn2UU7AJeH8Hq?|mfun-)29LU8Q@{4D&_)XHzOyz zUB{9@5*)80qgB4eCZRy4VBIn_X`7v_Ql~ky4%Ij(jUjve+F6bu@FF4z9T_~ErN>Ur zQXkpFwexE*n>-N*w!6?NucBfl_XHrUi5YK|p!DOM9?X!Xp@h44?~XONf`KcDF$Qb~ zZHD@`HmUcW3!nlOH>=h#us=l9E^>PdmeRd*C* LpwgvMrh)$j<*TE_ literal 0 HcmV?d00001 diff --git a/docs/userguide/en/images/workshop-email-images/query-3.png b/docs/userguide/en/images/workshop-email-images/query-3.png new file mode 100644 index 0000000000000000000000000000000000000000..b2c91fe757c58f81074a29bd3a50e49d2d26f739 GIT binary patch literal 12488 zcmZ{L1z4NQ)^59L@gfC^yE_yL4O*l~aCfgD#Zp|0y9I3tP&CC01&ULgpvB#TyF1*E z?z8`M?)}fr^Mohg%w#faWX-$YcM+zlEc*nL4D-Q*2T$bXq}3lhcvu5`?nXxi{=Q5U zJ9_YdCq`acLep((Ck;cFNNc%+Kvlv8PvSA*<3TwNg4c*4{uk}t<-HJjCC;;F$witR zl>Tk#7&MhwsWYeX4O*xb-Wr2qpQ?dRtwLCxT5Bc5+=m+lq_wJetKoXI_`hQ`?W>({TZ+|W7^ z6B%eyw14YG8RH7krcRRjMMCZeAFVz(Te1=U-(xgkI6IPk4y|w^q`)-hW-V21Djz94 z3zgPV{vog`h2RCuT8}_-DaXg<yhoe9&%%Sce2%5SWGTJ;bXvc z)O18p<`l?0v)$L7Slazo=U+w>BaBG6>E#t=7K)lt&87l*U{B>{i+M zN3+Z7Gl;TELnbeekF3R8=Tzs6o(w)D)6!dBY*_yo!%o5VcPBqAz)ATy!MD3f2-kXc{l+psP$%?BDA9O17nAIw# zmC_Tf#d3DZe-`GsP}iTql_Lo^EnqD)Kl?G%zF8ou@2QcaB7>Q56! z?TjK9tawUE8AZzXP8H(81(N#UD?&AagY9TCT8-SDYq(O4q!g|KCuLVShLN9Ko@}AM zHZ#lA_PN|(2KPT;cpthG19a?1yIZIqH`6+jjV#Ij`t=oi0tKUv4i9oUv!pU$YDUL{ zwk8{G*#?+Q^t}k57ihbesE!;=Wu};T{TBKL3u-B)g&pVfx9;628kAjVcm(()2 zo@{C*h6-yCZFcK0h99vC56sLM7OO&n=|M(Quaqh)!}|?1gp0#heg|!eQMFWY`rj?j zeXsl;bhdn}Td|`VRTZFqDfIGJbEbXbZa_%B!RH&pRPW?DIlGh1QRwo4(8C@FabX>0TubO^3$1g^Lmps-K`JyVL~re>7fZg(O(8@_8^t%&o=&qqp6oiM*a5`N`jri@^6YPRsRakj3WoSf9pL`F(Mb{|^cu~xvhk#dn3 z4zj zQtgI;f#1oyveLiO9b})*>@{f}t|HaHu31_I?4epFV$IfZWOzh`R@UwpSl%Ii%TJqw zk7i~GgfW_-NH(VnA2$bOI1Z$OL-wX+{)egb4(z?>QZgR?eq(v)Ku2;2Yz=eYX#dBJ=Y}Kt? zJw5Nw+V{;SN>n=pPn+>UPv8Tw` zI;DQ%JeAq`=sXvk8``2hBmVfYmGu@Ag;9*oB`P{xfOBD_0L9-2U59PF5An<>uZUd` zSLwvMZm(dtDV|_lg=nc?Ga0Vnu5^&z;=XNFC_pR5N$LK0EeNXwo_ILw{Y)MYN9grw z$ToMf%)JlguY@Ne5D*cNJLC4YNB2SXw+jbHZ!F%yAA==p)|JD9V`IIK+>y!o*=$Oq z2dY(R*80Ytnej?bebBVX2D*iEoI&ZtG7y8IA$}@Xz=L`1j@MqlsA+F`QPYoAUp1#w93I8{_uRz;DS z=}8x)NRzL`dHfv?tzOYE$-E>9`LC__}}gt^H>e)bc+8O=1Ti5x*$=bCwQHWYax zG+MaRSg5R^Jj*vSViZ5DX*_-uv85UrVnnnEI-)fzfjVe=1wiOawljR z&(ygR_-<$U(6#h5rAqn=LilXeY^UCJVR-|G{h+`7^fu*g$B#^uO4;s`!pLj-SH}#h ztyi6C^J=_)&?(Qov8ckJ#Rd)hl_7c+-v`X_X8kM7*N2DdJVz&U4)|4NKRn4JKR3zS z&U)LdHJ2JGqzG0>_EgP&H#G?ChLBo?{2m^~_uDHS)d!qW$vqIL_xsAk2rq4GYqJc3 z@_8XPTAI19vX{ScqK*fvs{)E5 zd7L2oEq=#N0XD57RM<__&nvvO*twO8`&_$O1-Oi;$O=@XU%$2jdZ$2$Dw4C*Tztis z;S#ZQ*h%gTa6Fa@t}5N!PHk@Q$nBAmItlCQk^@k{2VdvMQesq_`oiD(ytUplGUH@w zXlOjaEW=;_i?Q=mhxp%+#aSD&)WQFb1q5KHrhj24Ay$x*3Lh^M%RQjV_@|H=1b{YY zG;s7iAk+E$d7lnM8yFkXPQ&o?T^|`xmm?WE(8y1M&_ZT*0;p|M0F@P#PR|sGr>-&g z^&b1FLbMvbFYQT3QVM8FhBn@a4X9o!XUD?MBYZ7_#5~VG@7jaal|*lAorLx2D$h)1Pmk zGj_g0h#KB~sDRdaoLGa5ZD&ZZG}Kqz933CRIAE%(h8*zRJdVKlVVj}%j`Rgzl(nF# zsf9$~lHG&haNLE(r3VC=Pd2lWZ5G*FA+?RSn+)*crmd}o2WTOUT0^dzQ{v;S2ud8x zU&~Te-3JK??nA*}m^oCerp9Q2d-zA|3#J+vi~?9b=a}89s+6)dW{`0y>RX+7=xf3h(bh{Eq}s)|zhcJ-S-yLQFok zQJ^L?Zscf>L3IuJTuEAsMxD5n%uU?VIYj0eI2cbtEVy(_#J8|D`&ZJcfaP>1u0Y$n zu3>hr#=u0rkmjBS42~V6-yiqU^^*tMy@*{w7l^P(RIB%A2$}HVRKMaO8kL?<9GRNyzX~KaC$IZZSdVy zlVnQjPu0)FEHIquqaN;|wRzu|;QTOF^T2s<*y3uRQA>XLtBoV^yP4M2fsU-S5Ue7K zFPZcEHPw*4bP-D1i|`&#MqB3e?>{>OSH!Ih=W97?va%@Lbaj`%I%PCJ)HQIUfq#=* zYlQ3_Kd45Flz0OXD2LMVbk9dY*`JmC$X}ZHvbHe0W3%z2v{Ez+l5J`~D-rHHJ4)`| zD9V*gB)G)8xZ5#w-X5`G`TLhdbOhQzfCkfG+D>Sk7}4Dgohb8qhKfx>!)J4W1B!w2 ziRoXRv@f01;ZbG;CY-bMk`80+T>9j?AoHvl&X(Z=EtN+++gK6O$7PfxSN_C8^)=f0 z(VZWc9XLd)^kpGSayG*%2i1;OP3K3aFN(g*QO4lTajm(Ql{IJ451ucVdR9AeVf>g! z|27iJvNpnBv0MG>?Od6e56O3Ny-QfVFy0B}mc_yx)NLqzZBg(#7igIq2Emz=)N1lo4d}a(3TaYA~zs1L!s`SvYtX zYrLj(o6##wH$INGlW#~z!Fi-l1wT6xR*j+=7yt1ufhTErU#fBX`?GT^2K)PUGe|I* zKN`TEmiQ$m5eb@4UWQvmKOy_o+l&3K<>wm>0)h>uhXnDcz~udd!Jf_>FDQXG5?}}M zNiJk#W0dR+HH|HPcg~8D6e`MdXymE=U}u50PT;2OZo0kHJ1;-8@0@Gx$BEar#c!;c zFFLkrvYD*gPieqazJ?gQ^^rK`KYx^f?ot!OY%DJD$aqHwe871dv(&Kt*T#|QB2&dI zu8f!Y`Em^5#Nu6!`s`8$&wbCKTFC%smGH zuw&c$)?&#B-^g|E46?^xLM3xPj3gBQ2uUFHeJlG-9mHGw!Kl5$JL4=Q^$vX-L=?0Q zbD|Lc{)9gLXtbtL&d?C1%>r6pCOw$GE#Jc<&G>ZO`yo@5TH~pnUjAncN?V!FR>$}< z5OGVAe9`SbHljpB-^HG}8S0qj&7FCNy<72WPeGNa`d#|nbuY8FDS2i5@hy8wq0t;l z2}|qcfE`kuiX@}4k{A9e*fQ*UjOt!tuI$(t2IvE_$vtn4@nx);?dG+GpV(e3UEcVx zKWq3RY>G^l9Zg_s`rH1U#@DlhRcqac+}t~}IJ3k%!}+B%0yS7O8Dvr4Cp2?9f)@dx z_s=Zo#ezU(4%U`YmYLBc;;vj|0;_$oG&5THx_>V{eC2;2mzjt0&JFL~Gz!r-lhBC? zUEt>G2#LvM%qyJ@wOo7`ANu{q4c-L6cXvVSz=illu$A!I2|)>>A#A5pnU;|gKg7kh zEwzEF&=DbOWgFEVqP!UF@B@(;k$>*iWdXiOLsgP-gW%j=U#T#Ja1smM^h451zf)Gh zxW`_W(wjsDNLlz^J4yT;_QgoOY8jgStD!NBv!=1CikL&6U$Ti41M<20MQKZRCxi5w zQA>vJO>}RdM#{N4bJ~%@_+J0cqhrU9ZK)ABoB!G?_OYk^yS6;T5CYho`hdaf_04Ro|*6t;OU?izuzM^Y?^Empaemtk$;!y+?QB6 zL5Ej}_k*#8&D1rZ1j5fHM>1JJ-g|;kGLXR7f;d>2uO5T*k%Hho&(~)8hbL5pBv8-> z;(?=~^Z=GbsNM5`ETDVvDL0z{bKCk+)*LL4PMZK5;@*pTe0!b>RM$YDbsyKF=jg=R zG|88?oX<(P)l>YM@zlb zxB>Ew-GCCgx@sK+RKji_mz93&zf4RM16m=Vh4T4{jDHw3m?M2v^OtWLY0$!A9Cx>P zCSAuG-RQeLU)O~Xi;=>2R~ayEFZai=G+E7>YQR+GQU=$RZlc7{C-NF||K_UH_0`mH z{O522JqZjZ1RP}-rX{*q+0+YuFj_L`zxWXn@gA*L{Ao-BR!7TpA3jdswCTa(qg?m( zayx*mgzwSUOl`(yH*I1x#mTOmukV zsW94e2DqQWP`PeNZS_Yo7j>Cio^=VE=h5eQ%<(_UTu*3HQUyB+vfnL8n+uJ34^sCl zg|PO~3kw^tCm8O;Cnow2%u@zx_mQ`D=RcP5xlDs4e7=L$ziuUf~>a#;%DD4ew10RE&j#+H|JO~Q+KAimFX?|qBP`C=q`HU zfV+Ddc{7@M&k*w>h=_>`rAJ?Y+UwI=oCtf)Dt@$X9%F;j;~L3MPY2jW!|;5jnS8i7 zBH2KAgi9w|(`-uI?Cc8WoriiPJf@#|i&lh@BH)tKNudVeFRm2+-pnm=B<>VH=GK|k zY*T)dmZZ(M4f64Zf<6-3U%rrC!yr#!7%3Rgr9h96)`xH;^{)rzamv_GASzF{BHFiH zX@$fvSP#@v`0@y*PHw=(NPeZJfJCCXI~QT-@Q~x?I#nd@w(btp=IT%}$D}^|?rQm& z%cCZA!2#TrYmE%CfHCiRS>uD!^U9aRd!pm|`93MJdk4J?F!syGO@wK!ZE%C7&nm4W z{hrzig7wKs+}=3uGvqfeXRoK31>_E{E6x_?HZ5vCYadbjLsA{gJ_QG#A)JPA&l9R@$0 z%HHP>JwE=So|@ma(Opq7{Jm=Tn>OT2-uz?-s(nAkGX@GHdN_Ogfc)J}DMgd(o)8(o zB}eDgpYJ>k64DfU}oHfMTl?ANy2*qfChmYS(f<8uf>YFy@XmFpz} zxP!-YdV1~H$TXR-#6-=>>(Bs&!P3GQr`jQ8GbyUZaInz0j$*{jPcrV4-S9k@XAahr zR2fC0#yimAggu%M-0j0IXM1=0Tz5J_*G+egj2~2FE01oE1{5d0)X^+YiSgSAXn|9w zibzjQdOk%2i9&Yg5_^PRSU%w6<4eI9pHNa#%(1mGA6m#9lS)1rsi2zbR)-`Q1~D+_ z6-ts7Yth*EwDkilRaiVPt6Uf;3_s0i(0%AxrE^95^3oD;>1_1Kap~Ux?;|!vZ(Hh_-%b4O6QN-C}UbwVd7ii@2F5v$7C# z-Oa7A&Ucj(;|MrdIZXL5WSoQAO|(ohe}=t9Za47vo@TqpdU^VnF{!fcqZT>4kQRX& zM+;%VTWcvoHq)_K1#-fXE2~Tvr#y>H0UcxC?Ko!M@O%(}2F;h}1M^QsP7Vb9%D5#6 z?{iJWi<)?Rxk$`*S$otjciQEfKpRM_1Ha*f$s*%8@_G(qP)~9$ij4OBO|^RC|H4M& zQVP3eYr$qmbJ=nTx#qbi)L77?Vl70F_q7wyGdn;|vb(R8Akttr{30F+h8eZa7Zgkw zu>rJVjhhzD*R2dg?!NB1D_0+DIy1ngnDz!eOPTR*{+18+?K9f=3 z+S!q+P!Y zJ|?7@X5z$qdHK;$=UhVI9uR1$LYAx~culDBALn5uP%NT+A-%uEbCJ>#Bq#|KfY5vY zxUryl#!ny>l*X0Mi3p=4rQQ6Bw3hf63i8%txPGd9uYU4cv)r?7!0+EHpTIi(VbA_A zLi;`LLT7{@wRE(#k#H1@4aSbctExx=jkOZlrn5srrc+|5#txD)%$S;a7l>zm z46XA#E0Lga8CmjNu8{9n9h0TLZ$5&7n5}k{+5>r>7WG5<0#61*Y-IofP!cj;YBKK0 zMhBA8rS_fxy0}MY_alMwy+Ih&xhU=Bha$1fypPRNfiVIzbC2D?{jrRIW;tq|Y24tE z*sYU82Q4f);pM+KlTk;4_1M|rQ-G97Kr-y*-cv=><@HGAhTw(HijVgllcXZslvRnL zOKX_^Skhlsg{Kglyp9olF>=!m(QG9^&ZK*ok%80_zH0+Kxmbf@aRt}Wok zdTc<|Z#X6B2Ma!n8j1*;-p09Y8}U4wvx|1HoI{PkWo9Yz{NIpF(&G{WgyYh2L*+!7 z@HEOKINZhv_0PaIXlj<0%!{wDk3jd-&MP}E$j7tRsTPzqpIg2D`6IIjGbl3jbgWpP z!xl+a_L#z6jeFT@N<(TDRUGGP^booNSML0_ykKSF`meY%baENH(?(S5eA@ux;N z`Q!-cUQj3E?Q#no!&!E-0y}Z`&&rC@c+IO;Sn?S}`yyAOGp|}!+_*hGix6G0%cL8H ziPBk|O#%$?(8@|`x*?SXsx| z)${6o?m(yZnFRSABV_LBoxu8!%M|6FSHR|H0Z}rz9xS~s?map9^|d$?BI2|~<96Pg zxO}g+DXk+FmI19vy|dJ&Q2^M5MtNs@^;me+?j$HPFdoNcR?t5hR__R59upG}es^jL zzp9#vr{QQVpb&C<_xDA8vXBxETt%X9Ia0Vhp~R<+Omfx>?zZCt(iaHs@7}PYBKq%m zLR010)c2eLq8r+Mj3>j+9v{CVBrngN^E}tl_G0Q=DAMV(@uWMv!~T^8J9itpKmPIn zR`xeeD=VS#aYEmYv1ja1=&jLNTWOGuqbTxRXLjoA)%&aO_CBs|XdH>dm7G#1|zHCF{?v3SrdlkZ^~~ za@{I-3;n3RkwPvqJgP`FD z&c*FHRQrK>2Iu44x0Ne4*>nIY?NP8w>GR>QFV*!2H0d$+s|_gBDz3UODuQ)9eS1w@ zRc*bM4(jU(d!OxcINN@Bvei)n$nyf~hlhmSYs;+U(ZWUJpc~Sl2k-@7Ivv3bD$D zJ|Ng!XJmHq4-OPSkWO8WtO@|JW_A)RvyoXT4H>y%71 zV-2;nlaBA=WT~2UO!`BTlanh<@$vCztblH@4In#HmGLqTSxBEccO0GY=ihCQexmQ6 zwSJWd`2K!?YF7m4I+(Ghoc<*G;6XC4V9FqzjH=g~zlGBA7-tvu(UuTK8UbK$y%2XJcU zBT#ZNFSoSCh30@@)*3*Ea`W(L86DN~2+KR)ebIg$LfM@5l0*?W;E~1<*S)zH)@`oJ zr(5F#4vfs0yXRG-EMO7;*tZ`K0{5~>p1(oIp?FE7uxlpcAikr=awG1tO@fOp8LFnR z+Yv=B(=++w{SyNSv~37yvGjWQd~J&LWGx%;#hD+A4OVLZDHp2;AQ9wR37;qr6|L3xXzlMa> z9YnNoT|>WPxelE!8lRfcobiOWNa2-RVqSYS9BlM1zO3^7%pvSdU;UW6iQy*3n2*Xg zko)!ZPlCd0G9xdqQ2st3H^^-tU(#CXPacteq$GsVe45pf?^bpua@vpFaoUmIh1{;) zzH@ej`atC}rkdakCEAw{OX~96VrKo-b+wfrO&tN7tV4E)OTw**_$5f0n=;J4!?`Gl zT&>MYNDz{@{`YwGp9(I&&c|p=3f=MO)i#Wni?n$!xM)2hV;F_qT-imv?`ep>%Z$O` z6Ed4POJM$LgyBEiKlVzLy+6(f;N30A}aG(WFv4X@piqw3-|+f_cpB%E}ahdhuvq zVe+*YuGXN8Bn8TFqkmv6p% z<#1~^uCRxeWHZ#}-{@yLE_a;ox8gEN4{CJ+=|CYQ_nCYnv#M#(k9HGy2x9JnKJNc6 z*~R>~e@<=zU;M-2_uox>GLj?brLBC{~l*)|jlVmlqSCf|1KbB~{&a%-MU zxvU2~DI@LRu2INj4;q{rhmL@APlkR_mbo{-%(){8oN35VP#6Ab!&UBkO{gaj87ApD0!2rZROE^oaT7*Aq~js;EQeCkn+0n5wDq<3KRXl zpk>cNGJ|!Bd@*_yfJK+uU^P4Ctx!HX&b*VgB#y4!*N(kilMGHe_j3MFb9 z+vTf6OU}bB-U+en80fYSY!WSOYmSH{hSB~){sb<%#SmsEL#@;MOj@vaK3`wf;g0L- zZRNfxL*PgivL3~_rNGt`KO;RLGJ(X4w^-0nbUyCrjGN?v;9cB=r+)Rc$Ulh71k}`! zNF;XYBMdDM;?q%+<+b|yQya1K|IwU(0^ntwYtIeHY86QX~Q&Ft(^BInp$gJ7uZ?b!3#&=c%bf?%wA+kG2 zvHGNFVRs{dwOJUftR~i_b8QIrbC5!`U<54C8lqJ=p8lFX613tdWmCcrNH&ak#>w;6 z;XyP96>FM5VQvyb)CgF{ChIpi*X6R%Y~pnBhurx)Sm4WA0!G1_x_E}#WN+&HID7yB zt;ZuVv9O|^0iD!35J#V{+N-(5o1AuLzP9gDS2%xH&%v+d#WbVD3bxClsUh~F$}hYB z8UQ^E8Q-jh1Ym_&6T;+v_Y{NYNY`3{s+?VL$*bzrL0w)lglOdUYJ(~^sj#W`7sW?F)<;$W~|6u&=l=_Mz~=#Ai-ACgc-rT@zdtgZ1< zSw%%`Ty#mfv{*x9oF|bcv*?|NjAkgNOS7 literal 0 HcmV?d00001 diff --git a/docs/userguide/en/images/workshop-email-images/query-4.png b/docs/userguide/en/images/workshop-email-images/query-4.png new file mode 100644 index 0000000000000000000000000000000000000000..5615cd20bd9082ee5a3e46e0fbfceff8e00f4248 GIT binary patch literal 12713 zcmZvj1z1!|`2Y2Sf^Gyy?ght735!N-n(}n27K>9e+YaE zB}p9JyT{|K@Ip%4YicLskrDCeQa2%yln0*F15}hjd3IMR1y{_U`8Dj-Mw(i^9Hy`o z%;YIP<)8euyod*UXCN7km#^pJsf?s&de(e6T6)fIudN=E?RCN{=Y1|R`qwbe?D<@+ z`k;HzG#Fp3!(0#8 zEE#Mzn1zf!>KmA3`|GeIsCoCS>5cmqyG{~kBT0elSOzTlGbKJRKX*a>{H=|5$S<9I zsi1C#V%LxEJT!mIHf8X%EQn&@pn4G6B$dBHys1b0QbJ@krL)(1;xm5JbmQW*g;THP zji(K(ZtOu|y5Bds9=)|HHfaP8H#hfsB$87N=mpS1+-&uorNwl;a@|)|UZLZSOK*R9 zb@-no5_y7sjW`K;;Q5JT4q&b;i1_1qW%~km37vn3f;jq5CC-%=f6Tm+S4!4^T^$~z z9*^gr&wH0ExDXN&!hSpv!&{ysB@~%R9e4{9v1*rt|Ok*HVvK*9>fPYb`UMx9MGa->9XiA~DT!dGp*qq@;>vn_km8*SK*_;-$f z;P66f+=!s;!Xdx%i2j){rk<_)NpC&!rTsMjHA=}9G>Y|)g-R|A|M^k%%{A`W;VlrrC!ih0Bz2G^)Ym5pD2@L{U*uA|-7w-tvolWXB8Oz7BPb z<1|IYffy%{`do$yv4TY60qGAPfaK6=gCWa3bisJi2z(&vcR^`{4jTf2IC&`GTql{6 zb%|0hx8qRqmIcOdH%2P1S7wy0J#iD3xr=L$R$E_cs{_`#E`9DUP-Yr%J-X1~cUh-v zZf?$P)kmqQ+7Ge{+ljqInSM{}SYnU@*m}m=*%3}yVkz81p3v(ily zkcY&22L3Q{(;!(vMY>d1Oo-4apaywjhJ=I|WFwhjzXECZa8F99Mpo*EFcBF-5OpR9 z-213NN<&@!6R~2SGlP}&zm18c7)iH#96ZR;uM&kq*yMs9Vka(LTwDM(VVQzg>fzb7 z!&B{XXQ7+xp+w_8GWAlHbuV@5T#X&snn@Ai5Ld^gFS>60AQ*+9eY@7M}-KS%>dSLpXdh54$5~t?X*4 z5(nqo?&IKGm$*}C7dYOvaccaQ9u`d@sF;&pe`weoXXN0Vq zuE9y+%8qJ*<{6sM%+GEQUAVnMg>tcL3hy2EX7`@uBC+JaAE&g|3lkQX7ynWUeN4*z zmgg`s(q&`lK@AZODt!cXU5ec}Mo8Z{^Bz)$XHKSzIuvo^3AtmGV8q^99J!^ zq#fB-c#^27RGovM`}-7C#txGCMg6Rtecelg zC6%nu8*ZMPV&DhT=|2Fb@BKXyJk{nmsXs*|jQIUjNA;o-HlY;3SK>OP z!||c6@ zys$x$2Nof=v6~udGD&@pSu|-oUDUWTYAI2C7|XSXd*(>!EJ90_MiOH-#U`;XB#}3E z8oDbWFp-w}IWal4fv~Rbz9PhqN(evnTW(w?LFlOKuN?1^gV8aZh)CB(8?$KoA^wtY zfzQO^OI8=8w6fe^dAw`#tAfz;^v$a{%*Kq3=~o;vW0V`om?K$!c)@z7_p@yXPxncgwM`NZg_4N8)l?TKX%edA(oIglaS#fedwK zHxF~)?zmG@mxZP&n~kZlntVSlc6cNBW3pb##pfOxcB9ZKkAoaaE_N(J)Zyl_Q#812 zblj64raU`Kov3D}by|=a{}4HK%hyJDhdU*uR4*tg!*v}Ve?Pcrmw$_FL(dpDBlFwY zNvc=tlC5=zPfwZ89Abwl_h`d@N~fs3Yu+K8aATEWQPXN}+=U;n?)H2VX@F}Qr4{1| z7Bn_hUGZusjT5P%PrsA8zq9z-3OfO9n490>OO^e_1_KC$2uAHsCP!>9;N`ph>8D>l zCYplfK~9ca(Gh!O`TATAK0|=^8L^J7eR}GTf+Ii?pZPfAsMRi&!=(4A+iXv806F1!V?x2uo%cv ze0%$C@4@+czO#!TW+e~iK-rmW?eO5(7&*ovGqawY&d1{GY+upQnx<1}rgZizoMQIO zBzNsCaMP10q(?!a-OQdXIN&_*XgSs-!H~r$VXNxP6sT|$ZfQvs8uH})&?-S$g~Qp1 z^u&6Ljc5Z@gVMQ^0BuqYZ441Q-np!(I@DrKN%O$F&*?$hvS7%61i}UGSD?B0zwAvi+n(E7a5C$B}<+o#cxw)BBf zji>fVv>BF0Jk#vUvs|tIdq$U*mTIK`o=YmF?v%Ng)?0!8<^3|n&PVUf)A-Q3+NK%_ z51)!*sv8<&`rW!et*ssTSWvu^(m!6)6pn8=Sno%nFIe{u?&go08>O4ABMUCBn{{Slx>~kJ(r;+2 zNxVxKb}sb`p}V*!O1*q5*?_(^G1-jG$d0XHc($+#TA%4dS&c4T7_1Xb-igtE$;o%k z{1z@^zJHlsJ65vQQliSBmnMieQh+>8nwZcpRR@3I5;hh(oP6d+SwFlm#eIhMZ7&qd z!Em$@`QoKc@@6uW6Bm1wsY6f0I_Pen)~TaNTkm#p=zg^Xs^5hY}HQ z8(ZTRE!9ewjl%(TKROW+1GYryqI?;z!>8lbAVyO7RajfC=`L>9ATHTdU2(nBLlTOV z-<9X&>cqrVQGTJ#~#e@ZY5KU6FOUsn$*?si2}#O~V;7wBhx zWb9T_#8`a27~Bpa5a!@;7luMj5+owoG)CQu6PlXDfO$WOr5X3Tr$&O7iteCJ17g~x z_&|>3J$Ygbp85s9!NGBMUN`0ND=fQqZHCNLe!3^dZ=OP_reaK2`We)In3%sqen9k> zgoLggr1$5~Q4EmY?Yfy=r0``x;xe|ahDR-nuyFx>GRt$F?;>zC`b+oFY867E+WoI_ zk1*qox@i)jnF^dB7amHg&{tu(^pBYe)WJGQcZ5YlE9gn{g~Lz7ZRaDAB>oHvb}2=U z-2NjL{~ZH-UyjmBQ&RD87Z(t}KPok#T^tPe7 z2hE`Y?`lf)R(u^!WZXoG3z3^t(JCtO@fj+J4fQ(X{>Agvb>Sjh86* z8^UaE-F#4fYASz_y02h8xhbAcyvOfM-p81?3^o&JF%rASAwHjU^bejGeD7~^#u_#` zkm^356&WW%JQm?~PzQH)7Y+O*oovPYIQ6n^rjbSDj65WlrKoD)sfIxG_BNL9>71R{ z%;+PP?T^{rO2c?*@!1SrR9VXHgt2hNp)V{5;tuLg_&1-n$+m}&>-yG(y+k-~Zk!q1 zFSg$t9~^y%4tXFpB_3ocnoC2Ly&;k_47xgNmEjh2%6AdbpjA4Ea@d}kk4d&>^r%y*?w!4R6sCxf)de$jUBETKpmuiw9q7!lm~UeMt>0;N zot&G=)9q4G`2()Tizm*#EU+&P1Zo(bg2|obMu>N5X+e}U>`>FWzi}q0)WI`jEAq9a zr9yC7MkpW)AbuE9u&!wUqqm%KX|Yo07p5RDYb*WqvC4X|$F-!MC|HXhG7Yc5HG)UA zx9u}`K(RVINSX&1fBsZ-7t6{DPQZ8J7l9DUY0^qEE}YKJ?|09pPjJK0GRa%y`u1!s zf{42<_Aj#n7Hw5|A2;Evm(s%yY0tKm#pYbnx;AS3yg7NxX1)dlv<3|PitrGJ1fneHpO;1rx5e|5$D#>OC=Wp)&A3YIH$f29o38sC%sm%8S5NxiwH*IKH| zo5ckz-}D^(h>F&vazE1Qum&+X-qS&@W`0nyU7bG!}fsjDVkYMI-R3~ecx4>c+S5Ss)GC3r8rl2U;_1@8?Rj0 z8K8AB2)keJnwzR&O%pSAfAhc&D%>;AxKzC3Qcf|_Ty_)v)Uv7=)+k-@lJ7|6=L|I8 zIfv*Nr=9pEpDqdPe$Q!iHgWkPXahm-xQ?=q6e(gySxrxr23Y0CctRe~kj+F+EBpyo~= zwZ*R4faUVb+fbjg!%_4Ni6u35V%aYlNTLIuYh!GP5)QVsD~0JcqRFIagSkL~9yYxx z2aX9ub-KNFE(*Bh*uX~=;l`GsSU{k~H>V2`)Yj8J*STC=JL5Rwx|AbDFUck7|g}l);^jvJBG9$5&k~f8f{pJk^wm-- z6P6)PuJ)s#lD)my&-HdXXC-esqDwYX`9|bQkWWkhjEqM^0^yB|z+wFHXIC2ZRt4%Z zEz`8DtO!{7Sx{st2s%6cs(lC#z>++S@&O6-8u*eG_c zPlIQgn~SX&vtMa~_2G%I-?l~c-x*;sF=H4YIe$3Z1dD`nY)jj4UV;J%QN0W==^ zM9Lsqc~zQA{oF*T&u>87ALs69|kO$DtfE3fal!8G8)fCgO z6ujHP3JwaY+uzYOLUWME&GS#m0WvF=19$mX$ZxJm3EoL>9oE@*tfvnCExRekKxu_lXZuA02py8m)r9o)5@JQwR{VMghmk=m1k0G92ZC(bGaq^U3_MiQ6LMB1YS>a~={(deAeQSfh<>dcOQCD{35f!$pcKcx0 zKzBYhWuq3k%nx)Cy*a&&*~ln0FeQR4YabZuGFb+}+Gw`7D%kBCsZSHNHNm_03GtF3 z(c6j4%IMB=U$;?Md#O$5Xm)2A7u=*pc)2LQ)#&*SxcG)a1FX%Q8a&9Nhh2)ktHnwU z7>e_AhRS<*)af$AiW8EOBGl%nK8$gsxAzngcX3`R_QAb)?jOmWg_a~>+e3{81CD(e zjG8_(R2s8ceI1|1Rv|b1c8Qpqa1)X3)5`nO_kS`KYv*U1UvyR;sBQDzD7vew))x(2 zH~39(Sq2i~Dx&`Ly2q;)kxZi4ZHqb6V1KD?jV9415-64ZE3>Vr%%H;MrM&=as#zno zTWYoGX^WmIno&im1m>HwR>_K;+)C@MMJx&ut{+ALfVBa)oVxv_IBF!K6EH9H^Qh4V zpWBupx7dIi&L(53f%Zbeu@2+53-`UY@o$e*W;4I0RO+!A*KN1bSuP$<{#;*P!=}K* z^s4cB*y|yy1x|!|Ad(UjKj(3;QO;4E5KudD8YNVFNX@6rbs@g^3Y*&du52+Egl7r< z#)uy(74>^1Rok!7(Ci6CB)#WC%qnVkIJ;3oGQ6M5e&|`zuBD`V`SK+}w%wZ9z$Yo* zqp=S?-ibz|ll*Wr0}smgL51{jMD7?zbL*UIexmu2&d!I7s?b=O?F&M$YF8zMcy;U4P+m!cjYk1X}-E0d3(q$(1HFs7PFVf2Q3zf5XGq>d{cyY}+JJ!S0``CFQ@w#CpQBuqv3W@LN= zZV8IZ;=C$T8LcWZz=_YxV@Qizn1n36K?`Nh*8=Ml#%53jav7pIn7J7CjQ8XXkK3r%V^(I&?dVFST>gSH^olt6pTx4;~1kO@0KD<~=l$Oh6@%Z(dH_(wH8;HKQLQ;RM zSQR-+>ol%OTDlS&q$cPT-i zQRaK@_hZ!Ks@ZsZ&~>p5qrdQKqqU&@{c=X@tuE{bPP@nD-%v+yFDO@gG(=Qx|59gu zO?HzuifoF+F-B!!sDQ6U$lw{UrA&dC3QF3UUNMjDO~szOEuss79uzw2|>_+bg&`pO%A@ayiRA^fqc%@xn3-*Pj>9@y4R! z*8XXgE1&b`zGIa4oLb+lzlmDS_VL3Qxh{J8MX|>*-nxBu(|M1^UUZ39T^$@80FjMi zI|hAvzC*wtD`?ghUoEh{ZP8A)}>sh?))M2*TVEy=<47+FP)Z`Bw` zP+jP&Vbd9ref0yf!UPGR?ccQO1ba;|g92Xbt#6C#bDrZJt& zoxmTVS)`T3e$(~u-7PR1eCoS@=wxfsbM%r(?&*uP9LFdak{tW^acYLpykc9GgqlhS zaCxJ(nCw;%IN@3E#pWC0^j?gvlK#+|OQ24!%*&Q(j(~Vjo zA8_Twirn3fwq{?THVQBOB$h)qy)*jxmJi#_?q3;jk>b3@^0#vcYBCXRo>!Lx7$2Te?v`LziyX5oZvc#{-U>F ztio}M;Jwoi4UyU+73ulrvyaaAhF`F7*l+#ihSx{;AIMBfo@qIu$<{K&O%<#Q4vm!z z^avhrL}I9YksnDHaOYJqP2{s0CLy zCuthAzjt3BY@>L*+Wx-6l*ZS47l22EO$s15@|HQ$sd2oIjt+?Kd+r+@Bfu=&-u;$G z9W2WUAmwYL*;Ia)uj%cbM<1bbZf-TYfV_wJH`hMwU*JRmS#>}N)waSfy26;bjXxpL zLEX;~WJSmhoJ@6aFvQ{$GD;Po+KoJkHq~@(U9h>FY?uf$OeBtyHt#J%H_8k1D73-f zK$!~=?EeFl=zzJu1;Rh-;$4{dci9qSXp@+T z*%m*;J(%-iU>}4pcrO=sD+*6~GXx0$YW|t_3-E`1zhkouz$U=5JMvZRivxKct*SH^ z(*5uKcQg$21yFw3@8Yo|=-A{>KWnzo5yu;;_|ZHM`khCdC>?-?CM0w$=!FPB;_O5f zi0NA&@kBi>SOW$Q&)gnDC@N(vud2_E?#TTRGsh4b_ocRpIldUlriqW(;1%!mUb8AR z|9SP^dXYzCZG{K*ZcIRW_Yn>>OQG*R1Sti7*HFd`|rl(czg zyF!5e`4;b8e-u^G?m)_Vr7#P;07U)1d3%5F6-B+%uC9&~psfMA_hwMK=y`=PNfPL| zfzThp`?8Cv&tXWnw9KWZqbkjcH*J^z>Oi3$_Aj5zz@z2#rOA17W6d}3qK=NCn%Acm z5?^f=FSqA~h*noQ4vrfp(Up|DlZjClXM7WlPA>!82n+ae@D)f__U3kI=9RoH(nXhP z@DIR~=V58mvy~zo&vnLuhd>>S8zv+~P&&mPw|vw*%X9cDm~zj~DOM#d4J^iIkqeQp zSs4#O5>?jiMtu*I7B&?F!FQHqgiZ8G9~w^YDxT0sM&$L&$P8+VDbmh;jxRORrA%}9 zp?oD%o;}ywmz0eN64$DY=}cWX$f*-%;M4s3wDLr*8U05{X;=3D#|~!N5-l3 zPG%|it5PJ^R%F^ME2-MSt|5Ca7#`77_$*P$?k_(S-z|tD5(wd1ZuoC$MP%wQmqtqq zld``D(sN88%eJMZi4;K~w(@u_T^#LXdA{f$m%wF)DqRDW0r`=kY4n5sCvL9OgeLP9U6*B=mP+DIaKYgn|F7wWVLik=IRxmw(ZHWFS)BG61 z<`Y*=`zaEMwQ)IeA_Dl>+!W}?_Su9NM~ z#dfSSF!?hAZPb`K|8~!;fo<}tQ0VKBATFZ1KC?6bAxBD)bGXaGB@?%*zvR*7iE(RYXE%XnqE!r&D-h z{C4CUkWbk`Gs$$&n&aAFiWgI} zY*^{l#f*i%9W|PzD%DZ+vue90dZEQcQs-9ymo3LqeSc@@GMaqhixPMnaGvQaRqSv5 z$ABT_7{xz+BGi=NY;pWJ=$!46G|m&N6MwqWuM^Ad^r)>Jmg{mjK>pHWQ`Wgxf|B(* zcJe7%tK1ja_T-{b|7cEHGx*b=Aow@f5x(@MGFZ@Q?x{hPG&tY<(qw5ZxcOXIf~bD^ zY{6s3aYkVx$j8R#Ab`y0!0t*==wwAK3jMe{?;xmB@O9b~_%N%S^Rk>r;?2Cs!K1!X z>PRjo_b>4j8XYzwf-VK?cSpuRg$4wYOktXYVQj?Hr4z;tWJgqvCg^R^>r@T+wN!$+ zEo}iy^~?TM&xZ8mrwM~Q6HGduNqH5^I;*P2F0S{~J6|O%LKbW_!NA_02UO|Kc(==w zqTcQD&Q!T^Q07`g9?=IyerL~Y=a=3h1)0Oo$$_`)#VJ@RGtMo6WX5E0ma5a&{x!kH z)=I;;YNv2*(^2%@?Wso-^{?&;sBP=BLD&dqo08_iaty)iA;<`f{#QMAev6yi_b^Ke z)+hY91$+ZCAteroBt-|&G9}H+Vr^Ti2Sp)HkMrvA^;Ap0B_-IoTy)qPiL_wI$VonL ziw`hgTM~SYV2N26Q^xLyA#1L138WEt1hkW(?KsK1Jyok@;4;eb?^!GimFGs4!EwJ7 z+~rlTIMP_(T+~Wuok_^}z7gPDv07Sh;qZcm#!embM>E4B#&|I9EQ#bcn2t)zMOzw4 ze$e1%j?H=7AR9Ne#w_wUN?OYHL8$JN+XY_a&MhfS64k6bw7dtxM$xu&y)I*)IYVaG z{mbmy&_8fpL@~$5>6zVAhbf}!H$NeGGJ1r-VW%Y0yCa|@^Xdt}S+^Nd7QM31Ke^sH-KIdri@V7dBvBHl7D}&(Q5Od^@1yuI~{Qv4BdCa1)6{^EGFgH!L zT2P=lRcj}s&ws@41ru&-Ok-l?oX^$18E6#VKeBnCMpOt>J3HW2pCUqA8HXn;9w6D$#LXDMvgw_z2K1j;dZVpe(&sq|iJ5ScPgvqUoX{ zb5m*g-g!@e+U$|d_b7>oqVn@k%MDcEmipUQU#8vvN)vv-{6nGpkj3}_xu61WVJ_`9 zO^sPkWEb99kZWF?@_yQGt`(Q!abIa}Gh2JkZb3U3^9Zh;8uBypS8m7}+&0CugPB2( z0UF3oq$WjuL$p@c*EP^rR@HRnYjkko!$tpgOW9~f95)TVO1BIb{*Im&!m)=N*Xxiu zh1qLz(pI%tde9#)p$`gkjDFI{^1dgK@DVO8!2o*aK?$bun_%N4ih&+mi4pDUB>Alde@`0_lTC@{wieg$%Xv z8I;Fu{Wf`r%zczy7W53kXZhQjEt#D0SEJfrGKik! z`wjFzsz%A+cKXEj_)(4_YnY=i?l?JB+d()JFl_PA37Rcw6B9~uK}W`J0H(kIOpPY* zIar0JQAo$dWxl^^SNi@_oJpaG-SohftRIse#sz`ssH*9B>)1p9J1eheMBx)FdT}I5 z-kz5!b*YRW&wZa&R91xJ-pn%w2S2@6yt>V!FN-CsV-pw}h2NLyKM8Y8Y}Ja6S)k^; z^*!!u*ahgX{_gUBp=Lr-kF|KP^B5F=Yi_t%|=V z%g?PX4<4MVEBdRQk1d2Lc{_7f?WWmqC>bG7biT$cS#%R+qFS{s>*iLRgb%HQ)4})% zq-~YJcc-TivGb)}&u$ABtSxb-3pm#W_EmhdAZ6+W_e?qeXd1Tm*n6ip`i&=m#_fMe zC$=(4u=+;V`RuSWYGGhVD-rjQSTaR}c}Bg;w};ycWBk4YRQ%v{2rqg?C!fW9A7VFJ zO#B85_v=BDMZQ*C&Ilww-eAL8g~%Xnq|Z+R18#L9wUm;;&@q_73RpZI8^_=b)Dl;!8)p1n1n_L^+WKM^r_|##-ev1&;t{gs1}ia!eF}*w1D)a+B|l zLjQ(W+Ps#(U)Aq$@cD~eWXCOlkzusCx&Su;DDsIxm_2NxusGAF#N?*8l(j literal 0 HcmV?d00001 diff --git a/docs/userguide/en/images/workshop-email-images/status.png b/docs/userguide/en/images/workshop-email-images/status.png new file mode 100644 index 0000000000000000000000000000000000000000..6a7d0126450e084217382d854d78a2fd821479d0 GIT binary patch literal 48977 zcmZ6x1yodB)IP4SNOyOa(v8HRIFyutbc1wD$AC0QOH1h>pmcY4QA2h1A6l0sSi3T@)!GT z81%`LHgW~vn-5;|2U%za#53~`L_St8u-Ikd^UZkZ!D_@*vN0?pvrS<->Pq0=e=cK5 zNS^6D$?fH)&9%#fHE?H^yopzk2O_DXy_V=#Y6q;J3?iAlsCvv^;5y9Rw-_xzZdu=X)Ca1#@FZf z+4BGW+bkrq)wqrM@BQ?8e4W6RvG9)uOSfO9`*T$P9b+BN?Uup|xtidn@LPX?tFGoq zJ$dj#z0*cLp7CwZ(f+(LT7G?ynd9-#O4+m4+xL{lu)CDbqO#V(3Bt2!y+Pe958vO4 z;EU?3UfaaU>D?t|cNq(7ZZFA;m1Omi9$lDdmgXxBjw}|X^Lu>mU{!G^ zw;(ejpMw+888*=9Uj@`iHwPq@yuLn%K{w2wDVm$RUG9FaE5MWUo+HyMV5`P`xLQzM zv$t>W6A-TLEL$m^X>@qOaaN|9&(z)C*7(Gdj5IbjarViiHo;_po(|^G=G}hpB>;jyor97(O4{&#Xug^P0@SZa^ zzEZRA2s&@<;6G_tz;MCvb7{Y^)cwL>Z(Wx}{c7ZmKFD*wR7G$3)_AJw#W}^ajK5%( zhW~{mXU0L4V^*<=nHjbx9vY_}?U$9!Wrt7~bH4h5XFyig6{*=G4FL2>;^w^JHt(iM^~9j)~`aS9Tibd}R`_d^q_-yJf-# zJ0zcn?kIpmYkgP_*4#AHeWLsgPuZsbK{K_sd8MuG79}nh_1IBl?1^q>TPhb&DuHi! zL`anZiDk7dUC&HBX$u8wd6k&C6)nsIzqc&i~puqyET>f2pW8^4A#sxQUs zMT-ym6%n3P6zPLK`eBM|_mG(dO08a5=mASF8&#hGhuo4|AzxKR_h$Or6XUVep}Z<; zg#|RT*JM;WR8*b8c~vjX7!j(=VT}`jvFw^mv%dssRue3kmb`OJv?80J}^OCqx8Z@&*3YtUG~(~zGl95aO4 z#^R1Hoj8%$*xLGDl*IKaHC+l=npmSBahFCk0gR8&3Ssx}#mA%;$zviBW)UUWrri8} z@ur3@u%dLFQeWkxTDozgjSX?}i?yW(jn>aj`(a_MUb@^|eec+8sOA%ebC#FH;MqbK zw{5LA#ZENn-e}gh*}p~tQb)HoGQLH4T_I@4cdny95*#5k`DNh;SLFGcx|36Zl~#3p ztAAY>{nF)X$34GKXAi#>>rN$2PJ3tfZfyoZGxtRID)LH!4vQL z#PO&VQ7KBHFLvf17!|fwx2_vusKdf9tXi0;5?2QYGkc<%k;-pG-?@P~RW7-mY&OW} z(7Y)o$^&fBmL(l#lEik;{XOZ8wnsF+ss7knyFU8rSw!ojAL@0xvKPz|nRt@J;(EOL zeNu1Y;V>cS?4+)F0G(8k?wTSeW=bqa`qXIQXk~1N>B3rd_kNd#K1yI}I^@dNfLCs9 z@qsg~|8`-)WBR2egZp*d*E-Vy&lL)3M(<~q@UqiB7M8PWTm2~)n2cLE!R^H?WQ^$5 zjVs9@-|(P3oUgL7Gs6ka@W~f_kblRvcx;84L6e7r;||X^7M?~0);_j2pfyDk(4Z1d zG6ysl0kzF8m13^SYun<*{v_oi16Yo}cMILaRc_ge+PD1tTJ06M^>B63#Nmb36aT@C zr~)>hGslW7tCnnSWe2n9n)CE~>i~9y9xst9k(?RaL_cQiXMW?%oumHer=(%c{kMH* zq3jLgp>?s&4*nfeb#qmscpge9dU_EjJU*WLo4(W3M-O4m`&;)8!#F1Pme_Q3d;mkL z;W`S2UFSZ7rg37q44=~a$?!NQtBuj7aIKaqfA*}grUzZIEYGN7F?*87BF4xWkxGSk7gAnUR}GrJVG3;D`@g~U5V{}+-%Dg%#j}IqIrk{ zC2eSnDM-EC2>y_L=Hwxe7c;Hq4Cr;^-R`3v)~5oW`Tp2NkXIR>;<+xT^bk<(o*)9a zd{x&L1Cm<|FNRitMdu-tKQ`l|&Y4zs#+t6&DmIshaAPJ49W-zEHSd?4Kbd9u{Envj z4D$%X+$E=^T$@LoFuP=?Zv!nC++c=g3J60v44Y!S+C=FxMFzz9#y{^Vn0ti6jD!t zttF>JoP?f=GD4CEO|ekV2jg8TO|#B=6*2b>@_}_xtvrna#qjjm{cSl-Kxneu{I#(K z5y>#0MI#+TT~L>Fr?2R#SK@u+k%?Wmzs*qJ3{fT?nieURD*@)|igk$Zk3lC)^*H$^ zh?uWuYEQZ?$NkoYs1>-g;UQh1c<=cU7#U#qoMSR5=l}x##7Eo`8?1-hZu?-(g~C|Z zfM7Q43!^nI3;kT#soxm^smijB>m~;`f6$(Z%gcOC4$T^u7@9Fv68Vi^1+{Fi6DY-g z(6|%xb!owLr33x8K09RlRWfx+rj8~(U-qZcrEdkqRP(M_RJ>8;n{;*pd=i=c46|Tu z7XBK021N{Gb`II4S7C{ZzQ1ytxGr<>NY4Lr+MqsQobGu+crF%EPGD8oIznlb&^EMK zKz(RVuCBNC*0YWq>9qTMp6cR-Y`k z|8ZOLtz79^-8%H-4!IS`q!1} z62Bx)7P^IO$|VMX)?+GDQmmW~Ozv_;i61!0)pjJ5Z`k7w|8bqp+F9&*-bNDRkmUPg z_=xVNtFU)9eekZ;-wgvjv*Y@eQby>COTySd5xC*T@uz9fL-69raLm>{j zjsB@i<)zn&`(R5oV1?x8DLmlgdD-4O!J@>S`I+HaTb?sl&$Hy4qdj}pGdco-pYBw| zdT8^t#_kqH9&&CX!HKz1tHKW?k^fU2XNP`>!^>2W*6u3wukG`yH-B$q?>#J?Lxz@55SxNje$thi}eQC2`i4+9VD&g|g>Vi}?4} z{r3qq4I8I|@Vv9%U8EwhJEu;VncgPl z2us_ut~D#x8e#)w-0?<<8jQ*$kGBqzb9ey~)Sn%yiuW=LUeb663~*~Bx>hXG#H*~a ziTpqgr`$(ZPSdod4xXD!G-7T^JvY9wQa-wSRW2Oc*I$!&#}+&KMdw1x1Qa>2h_{;a zHGRGf#y9G9hu_|KY934N@_;B%%3vJz4pXrjK8skFVP&VCyZ7!b-cm=)9zijGlGZhtM1`lTXNI$C`5#*F&@gP@o+708Uu%4m9@M&B%z?qB zjg3}qA(#6abTR3*`NBNs-Xw5;sL;=6r7Y)tPIF}pB5&p|?Aa=b?vx4(kpWRSR^xuS zu(1>S*tg^Tol}PiVq@^eeSao-dC7J@Enawb5t+djo96E>2407#CbgwE+b*`Y!s30p1-p&q@gKnLJn`hbzPc#= z`8sQ5EFY+u>R7Y-wl+rn9?6+VaFQ4@BpF{H51^6{X05#cNW!zD?W6J%#lRrT>*|5z zn#nPg$)}#GE9hd!x7-*;=f4;8@B;f+Vyr!CS`ERnR}&FJ3;%n($7!hwd9OcL6xX?l zxl{D2sadAfl%j*bsJiy6jwvl;;Y-Dg)5-0o>rwPe;lSU4Ur$si$A2FN90~k(H-}=Y zcFfGM9@U&#nOc1Ie|G46;~^F56)*-3z0k0SG`WsQeiQ3?&O(9ED=7GlEpV8}lVV|f zrFG16t7oh0R$WK7Sc}{N+&=^|rd}SZe5)8IbHb^U6%k>I7;c!0^?}ZIplGbPyh-mi zM!K=-58bHjc-&qCn~=p_Ts8MNH>a@v`NNcLt~9LW&%aRRg}CR+6QX1XEzOKlClI>B zOk?5xyuWm|_K&0RPI8`R$v^+7X!-ap97(p5Vx->MUMRhM%x}W6;ED08(59lIVW%j& zsgTbTEzqU=!po!0lyd}`&zPWL>JiA)eAf@eS#DXA+Ie5NZG3ZIl+E!hedTILk}orP zq0#t41m&Wp7vG+PS3JxeFmV7UIU`1!GAIUxha@u zDCs}dpa-1@q#67V#-oHlA2F>^12u=kG9`wOsCnRs4JpJk9;4=ehav@n%={u{6_waY zxEwg{?~mX^@P~7k?EhY~FK4v!f&`SA@!zwT&wT6$>4>nv6udOf1EQhr@C`7sizRoh~}|Pi!S9&`;`%cJ99o{bh~!; zhB<359JxH!>eYlGHkHixSXV#D2w4NDX+XqS%U(D%2PLNV+|pO=7_(iy`!5B+f6+T^M-cJgqEggX9Gb ztZueXiAAbJ@-yYX-Yhj$lP|FWF-Cd%x&$)tXM1Q!Sy`P=_G05M{aM%#mP4(ZMLg&a zWJq}{s>2_S)9ZELvwIr59`A}XRNjhtZYY$T=3&+1ocHz{rjp!oA5miPJe1fj6bRpJ zu4m6RqWBw?@=njp!2R6am5@HJra`WVvHwlpqXXi3Z#HUueQ40Le65yv$isZ5`lzhXtxz!T3aF`Js9Eq{3tuAxpkq>0RR`=8<`&Yn{ECS zB`6#F@K6A!2gsXX_p1c4{CK%(#}hXysux&NM5IsZ7+hVh6oe~t7CSOK9QC#o$xw84 z8PpinjuYhxO&uh495TjPa|{+ob4jZ{Sx)W$-$mi$jgv4^YC4N(R%@ zz7$l{KURk7a37yPi5UFP{+*zLLZocH;8dt9-F7sXF}(u8}glptPoP(uyL#KA_dn2z)m(S0!i%zpqt@c}oeXhwpSj{9x0x&CH-0H{2(Q1v# zn@=U!UxZJ0Zkp4H(viYw?}rzi_Z{1|LyWfvtlc_w!6zo|BVp;c(WsM!7ZW z8}nzE5KesO5qNoN4jQYBanBS~;TT${VnHFxH>8YRwfO6uRZRhvR!?+TQC~sxtp=WU zNN)*{txQO4#7Q~(3*YoKsc>zs+K0Hi>Gu(?eW@ow^76CqJytp|v)Xf`l{U#ptN5bp zh)cyobm5H134N42(+m*CIR^G$VqyA|d4zm-JsRN`VN=o274feT7rzbCy7@5O>Tdji zOankWISz>D>88T}_>Ri*_U)n&%KmIxE0ibBY`=GmV0`B7MvbT_M0;4jcd|=gdNQPs zi{i;ld%C<&T3B_sLK?v;*g5vDqAZ=lW7(S>+Bko@dTCYenHlsV_VW7R@>#OQwe3B5 z{dHS-NX8ZYz)1JhnM;~5xQX-bF1CYr-#Vy0#>)F@4kwUz*ZK>C_}IQ++uojL#+?UV zdaQ;q+ncXE9Wxb0=}_nk_TjNbYC5@|HHBIfyd$H|^@?T8nHa-GI>%tE4b}i-C$njK zk;j-tD>;ivC4g5fmGHSbQ;<1(79CH(&c0E1B5d1Z?{mEBRb@qFgM5Q0#hJ83^eztQN{4El+Rp_!Qmvw1Mx@!_d_v;dSXe?m3x3+KEvXIfRB zmkh26!arST+hM4F2!NQ6Cd1vy;ahYV>^YXXh8C_=h=X{Z=KYH%yvD)+Wab1Peouyq zgWzsaK}4WX`)JBH=xb|TT;&xMbH&~|B&&fPbXnlr$Lufo3b{f8R-@JIqL9=aWZB^* z#q}jy{RutEKpoG<(o=3|6K}rm+1cg^-)y?aYsL&Nm8-wm@*OfaoSd9+VXB;ORfL9P zNR#xn$6p1lK?A)5Ve zD&KVX_6pa>)O>`9_+HwV*c9>ny3}(-VlXWpIN)FkLqK)KfrwOq5QIYnGH5Eq6LDJp zzyS}btw`a9hhVPmT|4NW|9&YR2|(UL$_Zzt2&b>5_|iG}E{|@LjAxMG=A`NP6G@lB zW`t>?Hhpe$CLR?7;TpTXPP{lbXEQoT5@cYOf#wR!%w&%MGJP--xs0MXhSCS+TB#Pd z-JuwVj)le*(b$XonD6I(&|M5qHRELx#5YS|Q7Z06C+DN`%ucp;*qzw^wl_E&mDtTi zJ~{O)1qlW&_5xKI+enG?e{&`$Ki9d3$-CjF3+$)yY|CX5`0=>CfY;YCQNMy&|aZB_{^0mSMcQp59I{wXI#$ua|a4?gku1uMwhKFp2B) z)GsMG09cx{t%O8l$Qi7^bvZ3SL}ttVC{>=zfQ4nC`8F_f0hwGavWEtwiZ+S%HqCiUa_rhY!C(U2EYEa=o^X{(0oYEhQ z_9v)tc=4?ko)4#z>R1F`(Xal{B6q2zRIAQqAhyD96f=#>x@PQ_VuN^nH3sX0EHTgC z!?)yQlfg%XTcsnRyZcl#isu;aMH~Whmg<7}(YVrbR2mWDSDn3S;X$2($ub|UBm5e; z{|pXFAfvM)M0?@e%zH>dX-thQM4QV^w6FZsjx~ zD4k__{wR<=q{miKBQq1ya>`bvQgl<-({l<1r+wW!zg@qt_b%O9 zvXflm1(=d7wunH1pPyH`1asi#$Xfb89po_XFLsN00T)be2zzG`d5ca;D)~Ir=B1*c z;!1+gcF~qDe6pruS|Z`?awD56(jqJYaC`@1C`yV#?GSkW<319QY<7i-Ar)ku4367S z85X>boy}hjus9Q~M;-0#+5C`{M6y0w101H-WcpYtgBzM&g%MP1loBhxK!`#_rhy&R zoKN(0x~ub_B6C6pQzBaa>_y#%)hlM5XS2}^xKc_2p9^5g2UFmS$h zR5JdQ#RvL!IyDPcP2N)d1=X19)oX<6&mJZFOpwYLU#$Fk>DBhKqK@}v;YehwSfcQU zh}K%M-*2@npItj*WL{sowJ0?lK&78fDB2qQ^~seR4-z|))#Wnlg$m6*aPTdZA^(sKoGaX;1;586F{PaU5Oam8SdoU{XAd1p4Kvsa3{iW2Uto zJ2RZL60L?Vt{K`TBmTUI4teXV{IZrfJG-(C3XC8i9mKlZ$q;)iR=B*HTO13tZ z)HuJzGh=Q%_03X~gYBiGcxK0ZwiU84{}{d@Z1U$d4SXQALK$QIoR)>`nZn%A-;Ymv zQ~eCWM&f+&gKK29gw*SlJ)-s3B?EkZzm%96j{bLm4TO!zf3aR7EZ#zIbECGW2A=dq z>Q%)|is$ApuAupe@W@LV*2k0t;RfdXskxdz6$1@+8#{dC#~a~7K7(HVoB&8g1Og6) zJf^Gv9{Wh|!46+q!#E2S@wuKOZ+|pY{@ey16o9y4dsFT6Arjy?B<#ai?e7MnQ#eOz z3rkHXklsem4E1xDnXh0pMJlv&Dg>(vVBk-BnvKFgwfV*FHcsHUp^V&xCU(aV36TrQ zGF2)^E(<24dC2z?f?`eyhLn_LfjYcmKEn=YbOZVQ+KOZ#x^w3)UpB{T49HBH0}?kQ zt@$AUsoOgwa3)OW8;TOyE`F$-1JcPEEk7fth$QJ$b<~S+%;rWi$ud`5PwF;vio0e* zQ%ie{BUp#%CpOLB7A1L601J!zZF}NnnnOI_gy%|}hkPcpZU%{){i6-OpO{eLja{AH zD5Kf_It?6e-Y-?7KvKU|rY76*R$^i$Pb<2(06e$@u(G+$(juvOKbn!NpPt>6^Ga#^ zIU`~@VJ#d*tINJJRf}ivYEw-M-#agk;*#+1@7E|p$;}*MN)Eh}+q6tgQ2{x8l-y<< zI+2FFKD|5r@6}QV?3nzS8Ee*?b~grdnOJ2lMRzo_sgn0g9Eb z@9Ph(?>Q|vpoZ0-{d!*i>4@Nz*=DxM7DdeM+rmpO(BRfl;wJTrcp;u zq>8d6HuFV)Z*1HPPhmjSVyyIGT(kqMYPi6F^q(e}hmS9TejdfZmo=hR`YdkOmxPp& z500G?J=?d7x#mLg#r#foVb;0K5>*IjFIZ%VUPVqtiV1YT_Ldh;Ob!w>qU7~q_hZDp{QD}ATNC%Di?rvP+xJvJZ27CXF)M-~y(_wc5XlnZ=a5yUq^hU-A%LR7L zpO)dt_U6%c)<^AYn%x=iqj}!aWOZI;wI=ecIw+hU`do(u{J8y=ZaT9R&ZT#rwZI!j z7nka_5BPLi>3n#n&@2L$bz4%_8$>Zcmj*I6=eTLx=v73a9&h~9a8hrBmuC(~<%~@Z z9Xp(S%8&zlE2~0FyVMqR!$6C<<4O05rhtc)p@1HZY-5@iGLwk%^bJ@w9U2uITPh+B zFmAV;a1RQtz@Rn|+ZgF7vM^nIHWy#5Pw4QQvm`Q)p+l$Hqu_fzGJ@7J!xtMBOF#v4 z#X7!rRhAho9GuPgXfxa<0zQVOj`mM^qymb?{oXM6;ZwOMTI4WAR{y1QH$sWZjiCih3U|}J#-BwrddztzRghNO0ua?cLgbw{RnOmQW}w%p zR>CASXO?O`UIpEH1|~PWh*m0Dov=d@rioPVpV`4${@heW&Kj2Q>~R!hvB0!->Vxit zxBraFm1tJ9+&EJJpv8^_5p=#M=oB`$5Qvh%|T_ zD=JuX1h8@nonbv%pk~`3p6*tra*MI2)U#F3nfwmd#7&bqo2!1m$S*aB`nAzlVK;=@ zJc^3Y3J3AE;E9W%P&2b2U5hLx#5g_=164&Om=Ca#3ERnt^!NC$aSx+oZJHI713*9uh@r*{B$GoEr$B4)&@~T+3xCP%vKCe zL&v>hSl~v@>~foZN1a2O*scjoVai5<(Wjquue%ia(g-NgEBXmpwaieW(_+NO-o+=^ zWN;~oV<%(oYMPOYm`HLcnm5*{xzp&@nXHpy@9jNRtQ9RO(#G>6ys4S5e8-Rb#$JFp zG&%X*{%b>oY3ORkXYtcH|$Dh1eDEpv`Kq|?LgjTxRtdGf-((v4crx0#3n!iJ5N=mA^wutr< zULW4@D&;_m-j!~)Esf4v{}9%R^07Z!X14aqB+Cs|N00HqB<2B%6MkLglo8Wg8gbv2Sa(asnq@omW2TRI)ILuJtWNxzIV35EWDaSGJB5 zoM}X<6jb>c6k0=A68-*IX+?7`a?lgssu+bbw~@2l=tk&l;S?RagB{n} zLAMe?`SdN-+Ysu+#xgn_*|LEGy%y+3x6$Foy#LfMA`rErp|}~MB>e8gQA!m%igK{G zkFBuOo=UY_9qxCG*_XgwVY0~y-GEv4Qp); z9d3~_dldxt2rdaFD9)1L1#RK#l3!KKr0PE?G&=tZ9Nd?6G{Ssvgq2$^HBCiDf3lN( zF_ikJ`K5TcHDxV`Uv6}K=W|_3sWxR<1=+ChBiA^LG||NYE|WwiGWxYLBv+|I!;ZaqytlJPYvT`Q5oAOXbFj`M*;6>R0ZXS+)0-h-XO zqnB1YvE4qxs7JtIK4C>KA!)eJui;cQs)_Saxgr-)I128;QZ&XhL*i4$fZ|~%A*zX; zRS`;Yyz*w+*+{je?ssDhl&O*giABZLz3Bd~FU-=)HOShKXHCcQI4`i}VQs zgt|tX_d;7vE!u3wk$9mQJ9^74(-SxwL|Pq7zHc+q`hO@Y()Bf#!j28+DL__ir?75a z&|1YL8m<4DEtwTkZ~yZfD(#yjID_Ca`);U)ID~04I;=;-rw8~_qJo&Ds{!=u!^y&a-cC89I3s4ewm|l zR8KExDY9%I8i-XL>X@TRBnAD5C%ZAX@GnrI=@ah&nGTIDyT5@Rj3sBk6$Ehf#&(}7 zqdo6&;DmVo$AD#O3#=4$8DIvA-NR}^L4{~l*k!S%R4r8sBowNSjP}iC(t2@6T){CT z*8TzGTUT^gDs{r&N+XCg2B@Qh4UqawCc~&RDdPQ z8>qoKMDD9K$9rGa#~||t9EaqF$kG2@7*#*gLF*n@>j?iLn+=@E?3qBMsRRu36yrhC6t z+hDyzKa$2x&DlDn)d;m|&P9=JMciE*dNq78<^I%NKEM&LX2fl+D5^X&&58pPb-BH@ z_Z8A6-``gp@_vCTApMMiRJXJHUG!&yDwpuX6AmKANPXU4MQEJLN~?QQ&vJnNCGpFl zAi4_4`X!UmT8gtniXfsFUoDA1i%lgy0S2)8R zJHV=^)aT#{Y{WHEPW4!}XO!i=V`bx^o_0;ouZ;2r7ywQ;9!E!kyt0|rMCQ--7ukF*Ptex6EA!^ zT3YTZbc7WynxMtiT^Lu?lhLe?)I^hGn{)iWJpxMncN7c3`v1*??#k2rXf*9+N|M=F zFIvSvXX-}BHKpmJlW>=cMEcw(R%x@OyfD3r9!W>xV!S z<-C`ZE-S94{|~a{pUMGX@x&d$THgqOVj&k`zV)MvYf zLg)SyNQ)IUja88Xsj{Rb)Bl*8J##u#4?^Dv@;P2=^3h!CfWvz$kB5I+D^bvd#0ux* zd;U$ELPoh<5ddY<&RSMDbNaril?d&|;Xye-V;m`DzN!B3ZdOG4?_y#ASL#+;+xHK0 zt?bBN63Mx9f(WOkYg>Z-c$wGv_eW{|S@{m)f2bG^A}s6ZWQ}`D6h<EL?F`+Ljzd-@M0@2;Q9w)lXi1Y-0vE<(7w)4(ad$oTRBDhk!vQ;`i2$@&Gg z0M(A;qMU*Zh9k4R3AoHNiUd^1YJyG?#|AwAU3s^wckT`q)V@@gYM4Y;8h2KwyWD|14KR~*fyhh7y@;U5z zK7kqfIOVd`x-c9|^VQ;F)S2`FUrs-a4558gEOSM#D|8_6+&y_lqR$fkrDUY0xprGH zDOrHUQ4;PY+SNV#kE4;lPU~%^baPQ(=i16hFy0kZ3|)T=U{e7uE8(2$bYIYJn+)g0 za{6c+v&AFiZrmcX5+{ZDl@y-3EW?&F#ecQ4?C5nh{x&_MN%qin^FArmm2|Uf*vH_I zyI*S9A0J0slr0oTdo`AWgYFC__sQ|?Tf5{N&+H9Vg;j0*?sYdCfdId}ReS zHG;9Z{xM$1MNx_zne61y1Z3rIJ|Xx$6P&WL-m?a3XHD5SpYYbG-^Kiu04CN}qwmE2 zQcKZZZ>8YC5NoI^V==%x$bd4!J&nZBwcKnnGsF9eS{=0o^ zcF6rs?IVb(zfId}$z$%<;$!DMk!(i9(a_JI^cU1HGuD6wE)mIoolsuXaao zM4>C*2w?un5oX`gO~>PW6rpB^%UD;BvKyCJZvDY(SLwL0-f;FB0(xPCJjLECImX(j zFpcTwh;wdBcvHL7K{TfU!cW=JadCHtjWAyGL-e_v2>xYbS?~T(c+TyCkmyxT7*#Ru znZVbRp5cyn$m9Dh==|I*rrH{!-BO!cQSo-f5tUNwrmUE=ea}-49NbT>lI6!IwH__~ zZT`UIyUolKcbne}4X-skd()M%Rwo7swuNbU_gaM5KU9eS^9W=1IN-?o0$u@baBvL; zwLuFXXvDvk6kLxi_RZ1eX!MvBH|MDLJwSrv=t)(#;soeu`yyxo<$}VY8J>8>v!IkV zNB6}ly4Gj6g(taF{&{(X#n}K#?#q<&YR?YnZV`j2BDrSxP~X(1KmOTsAAvO+GiDmk zM*D*8{UN&4R5G)(uOh3<9i&>ZurxCNcYhECC=l|Wd3iQJWujU;4Swg9neRLg(!Nps z*o5Uq+4y;df}UsN={DZ(&-naWaq?daLa#OSq|tI`NI|8+g;wgzeFtw!$p01nmTmk*2I%ojtj;1!5jI#RUl{c=?`qMPjf!@pk5fcAxdI z?)qa3Feg4{8Hq#;)aS?zm8-8|OHMTgTR9nXEN!}e78cn^r@&0UJI*{&wwXdIA5(*E zjY|ZN626)-gsjO0AR!iEVzU!%s-d-tq3{0_09NgnJwkQ`a4))+MryIa1xrqiXU08& z3dX+Q+$V+jEaY4W71#L4*2Bw9(Ip9%jyBd6Vi z>=(sEs)3bK&i^jqpa-{3KPpa~kuUiTi$%XuOK4B7A+zAPeXT)@E(4?jW)xC-KUWCM$=5_Q!2bL#RS9nlLPpT4M1U1@ZR`UP^Y;v*O_9@7p3w6X&KYwL2+scnDtzhj2kE_Vg&6MsvtHTNugRoV{ z2vtjxk+GPrC7Fnd&$f4W(t`f!W8_EFsw@<7&%3=no70lX;r90u?2StuxV%JHEt^|E zxjAEuQ0`{;K^SbOCeY$mczp?iZY)E98|_>{%4ToW1o2DiT7(yb?JX=+=Y(x>G1np& zR;=`M8aj21+eTk4o*)7DkMKCE;h2)u1pyQ`b>}!tO zjF!mTaqcrRPg%`iOJ@hAguk_u{gHbsU3p&f3DOtYGT&EoUkH&se_?0dNDRX5?Um=@ z(4au9%e-Qoqa86SHA{=4=CeP={P=;3m3vd}OQC3T@{NuN8*%C1QWJrgRaPhM==}EC zS|0f@I!=hrM+_nkzJFwgd$X)q>@&KS%4=!E-i2N#lUq8(Ea~dn4zZ0`F-$j$VA24$ zo%c4Qo@b0!%R>qd<8U>>s@hUUr)NYaHp@6Hnkg+D3&AEPHlM#AY8P?_us|&xBdeZ2 zXNJq4BU7wiEwre2y!YvSSX<~dr%YgKd`{UZ($B&B0wt}eEc}Hbr zsfcPK52}A~81y5m?e%yUcJq5e|5tv@NID}+c$>iZztW^qFc%182({A9YRyQG`_lx> z)bcY2D!1Y{Xgbh;blQjbn*Z+^Q_&k|M zhq?1jq!~cJ5m~t3c4L57+w{%g#eP;@HA2*f=iz+CN;EZ}OY}UVfd(hYIsWZWLY5To z!AA?I5rAisk{{x~+g_!#ZtGO$iHbj8GwpCb(S3PVCBPpP82A)>_WA>8TKGZ-*)17O z$q5IBh4m-ykCy!E5B~8(x#cX~Z_KM#@+%H{9)FBk$)XZgF%^eU>|QY^^vk*#12{@cowRzqXh4M75S$T1NOK{Sa1Gb_8!l05s{wQrO`? zNh{q#6`0J^SvUd47hi$W{y*8Hy7b}9om|NFh5_Bp|3hJdm~?;8Ug4g0#77Jji+iH` z1z%!t)1|@~Jla0qBvIQ7Ej5iGi*h>Ooyx*x zz3U&H#_@_z|I(D?N1EaZ@YT^VaaUqwwm+5aP0T>2Ix2b}_n-U~U0cy{dK>pVl_w!a z(v3<24{x@+xH%dvO`yLLw9 z{$Wa>>=jl?vVxqv?GiFjA8id$+b@tJqXz|WWsT1t{hE^?G6%KYY1lNh91Nzm*W<^? z$~rV7)gYSw)9oJq$OQoJWr(sOkLDsvfv?={pfm=@?rev0SX0mn4^i z{T%GvWOyvb1L=Oa*2fvX{oybhv5i=R5c)T>6M@br|D540rZbe>FU|zRzflp-&E@>DG9yKII^u207lh$&%k1ah-3Fy+k=rJ zIU+iSN@OBjJsf-_d-tK<2gL4LcJ9_Oc}<0Be(xda4gN&^y|A2NaXw8|-2#RzmCvSi z%slqhTUiY)-rT5O4;cR!pONw&kYmwT+f->~NryVZpVKvGu@*Vy$W(Wy>M1ZAdOc1TY*m(|I4?3(Sz`fD|~0 zx*vUo=EgBULT|la&<(4jR+B1EC*w{PVP6q#$4f_qh_Trf#Ff49jbR)7we3emr6feUTcxF2>265@>F$mJ zkrHW;E+wVAVdyRyI){d#W2m9NjXuvg=RNQH`~FZIoISJF+V@)bbzj%D)-JMEvC=Cb zlGQJ;{QZZV9#wT6$;kEWaj_VAt<2j8_i*J8#2Mui)4#}NvQ7j0LtGGG)em_Gk-|Q0 zSvvUkAECC^5z}D{R~Sp}#XT46k-}S|`P8Fs%mT<@(eue8sBjb7=k^ilo;{F&CZFwr zEoucBw0ra5@kAI*6$h`;{4e4$?zFvvSirFiVFNwF>*;Ub{9^^Cq^8G=+}Cfr#=Xx2PVU6!Gsy_QO z;$KX0L2BhT-BL&;EXYC4ndtth2*lr+)er!>hSxRxo_+cpR=r-OwJA3mx z4GWIOu=wiG4_yoXHi_wI(XE?OJP?fp5$1D{i}<4n(H)yoVBnO_Z3XRFx#Df2bHeVe zt$j7hC;w?}ZHl0kOj}aH3!YoFUPx7%;j;eWG)dV~Q86m6zjjzc0A7AxO^TbTI6(%M zr$uZ9e^}K~`a-1qu4?g2<{si|VB&c-e%xANnSO&x=>CJ|`u{SQ=C;Ly156%iHB{QO zFyYr*oU^jG;yy~C!_qScn-ix-#c%Vl%uHY_OkX= zIWUMLu4|bI^n8yIlzc5YJN;47G+xAAeS>UzI_z8hImW4YZ!QB3;=boVmGIeIKXZh8 z>lukc-4}pge6f*haMh1h=gt%#s6Qis0Z?%EY`nO%CV_Q;%Z6R@^jn~ti4M8AP`{Gb zv%hoSe~@%AAp6-xZSi0AVbwey=Lhf*^*6O|WyPuBZhlZ28+^=(bD(-HP3)w=f7Qp4J&fV55WDX$+hXY<8k{Dhr=Z5&7oM5t33 z#9vDQ+eQQ+;+eDUz)ehc{nI?mtod#@k7bVSj|TDFljjWGwBr@rh$v?5Y7@C^!hmYe z>i}@T&y{h;Y|UYBg^zlbGF<3F`HA!%%uS&3noJ7*Sk?V4ovc@SU&~VH&~Ev;CdRwHoe3)gJ#`HwsmLx9>2rx8t>ZO zVZ}_Rs=N=EIl2aZsgQ>n@Mb{DD^$~ezEH^%TUlj0JFtpoFtI9+L`c6rKv zHB(EJ3WiOLFVl6(W$$J2Gb2|4l|WRiQz7Zf!-0!AHKIGh zMyJeT0D~m5@yoHk&-*0ktcA}=&0B#g7lt`yx;(%?UE#zTShzB!uV3al%j87Aw-C;- z&SJcezphc{1(gRl&4CvnlE~q`*6)kD9}Ub~ebs~_RX+^r|K>svt&r&#wu^#?%Zn%f z>bP-e6c^C(|Fgu7+RAdBUvk|A^e0_5vm-T?0Q%aNZb|m5jx1=NrMNzP=;2Ig%SD^? zF0T)E&L9<>dd_BDd*y+c?x6a`mSlQE&?fY5d@UZF;agAv-)qeLxGXc|5k#(k`&nQA z_S0HnkNuW&^7m_XV`$g@P@_G4;fK6<@WNazh2e?%F26m})Ir{It?;e6$&0*AFU%#Oce9i1JjpqmCf5n-$d z2#F(jKyA7@T=~3uN?jv&`{a3T%ScVSQ(!q*h)Hn#6FJNAxA@%F>1pxet+^T|^|KY> zW)S}yp8{;DmTQ%-#X4EILI@AQ$<~nwem33C7%6GgB9flW21=#1ABZ<1I!Q_KMwzQ2 z6VryBheO1#uk3`gDmd`<#rL`srfB3}BYb}Lw)z!6jk;2mudfXVUd87klLv+4MMGHVo^^%2Xr0DTN{lqtW;XgCed z^D_tSH+@e*rd=G8vh)5@u z??oV)npb+%8;=MN@;*Wj4!Iu>WHBc;d{zXUw{L;S#|JX}*$R{lyKR0M*-ZBbG4Hgb z&uTYvVB{_N5J#>eAv7Uxc`&5I`+UFqwZluAmQntim5cB}33B|4W0MCsKa}Nxqn?4_dG=UzeQyz8mSWVP)Zx5ZZEvN(7vJ&;?`%7)!!dT&<4SI{Vu%N zfxVA5b5Y;YL&-JMeXnjX=}gnno~sDosfFP*)-3OmN@slq;+VO8V<;FYr!qWbk9@sb zbI7>W#vyNyXd9L{W=ReXj*g)h<1#Pr2RPYw7U?m3mO9eL47`k#*b@n61@o~)yZ$$e8@+eaR50c-Tx66MiEEG_M!zmu(L`c}z& zbGdoY>)kr!x)92Qty6Yq&k<88GwuUNo3@6M>Tp}7HWymw+KGyHqxA`jv6WYa02_2} zMWsAHe1D$+V-ZfEavgE)g!YenhW)4@9H5=SbXYm`QFluz_d4)NZ9Mu*_|>c2KmQLTSF7xuoOj9B*4Iaxe}G(kroe+0}7nd7)bT&gqj`9=X)RE`LfwL z4z#B95?AMj18#|}v%}aAvY_v-$KSuKty zQNg1ZV*HfDPkcUh5|!YCSqW?z{Z!^&9H@zjhE^0I9S|VD*z4|yW3US1WDd#Bm!m;A zSHhKc@y94C_CjMLoy;X8@CM0S?mo}=gvb%-Wg!5+O7(kGG-7J~(AGF^D(SW}|rnv^w7w*fB1XAT)^N zjPT`@=@{lwslp4tZGVc4NcRMv&MQF6jOjly*nJE<`Ng zqkdN({0D?Ie>Nrl{R#i$#Xki9{m)TgzmJ3Rb36rY0wV}fD**?8D^q^>@8(2%Vv1}!P|u; ztFJSJ%h*h}eV$uSRI(hIZo_qJT^N<$sD#T>Xgx5bfQJwhht*@6f@e-gWOwp0gDc$@ z4d(WWo^XAzOZ2H<^W!P;jj*Ns(5TMYiV`uXp&dTD?)BpsGShJw-+CR1(DRZkk`u<9~-)P;vuZF zF_`LRy6CaV>y+C%J3~~?(C=e+nTaE!cM&8-j^nrc{#Ng@#gQ!lo+c0fE6o;DN>6cw zMrgXB1N)ojqjKw^eHq^2p!}ri%Doo%YO}-{=?uF$+r+y|?Q0*3M=duoUr_vYI_P(q zVxz&Uyp623O5_|?OP@V4$hOAKUep+qPXzST*Daj{QyXvZMA{jdaY+)%Blrr`E_Us6 zH{3RsyR55|drKh^yVd$l;f{+{s)SS+~tUtA+Ju znj@t$&>!=IYq-MCc4)<~c;eL)G{ROkH)iir5ghK%FzZV4 zc__(OjSyu_VQ0FW#QQ?R_rkNGZL*JaM1ULP%F!_lGEuBRx;r$C_e>)*uN-N2tYm1^ zvwWHcdHtuE2n>_B9pA$+L9^L%<4l*nF!Bk)LX>RKaX0`Q^Z7BMo-FesyGvg$H1 zZWG8OQj3bCi%*legoTMGCx%_+AY^Ead#dK8=GcrvbYhdd5~qx)u2I~r0wAJ zK~;L}m93DXYi}x0oW!x5I0C6}V5qa*ZS~jm-TS}$NA?)T?`%#>tPA_jUI1_FC%32A zW4)D9_?3;cy>-lob z9x;g)^ocP|$W+J>O3K-yl)(CGNjl3U_`Gnsi!yhE3N$x~AsHKwGgM8Ek;VJG(TsRh*Zz+cP)e>`tX&`1nM^TZAO}LP6s$ zeSZ$A83*bYd1tNNYtS7HcI0)S67Q+`0*{W0!h#h_KoU|?3dnS^$=@SLF))hjEu5WP zyI1_5a<;Iub603sDiVvgz8T|Mt-cjpUR@6JJlo&;f z?wdY`qZi$AG?xCTm)`@ak*l<)tfVdZ5U-|2vr0JJ3llU&6K2%|A@$1^o#_>V69-lD zg7&&;d&!vQt39zEX6SxDY57)?g75Ol#)!Boqb1)OW2xz^?5HR>B9sdU7E1v#r1lkn z;LjSp@R@HQmQ+k@U9O@T^yDNGDyGMQQBzVrJh4~r7npD^7dw}ML^UHelV z9mMHyEJG_NDr{f#?_24CrjSdWR)bxpiWc{T7|CW*HHzMkv9wYgNW|T4?j)x*YlCij z2nn~LgoNaUzNMzrHDU<47L$Sa_a|7myO@o9HTHIE;pw8?tF=u6|Ag#Bs?eP)Zq|F! zX@)@uw3hbUD(5v4-k_qQJ-(xWDd+k)$X34uLOm}h>HYccZu53A+3zl%2Pqm^t4JXN zF0GzAIx&3NT_%4<1-iR&7MS0?IqGA%k^`Hdp@h6eARXtbt$`PFaCoJpq`tu4Uu`ci zUW1(&7Be`$$s4=%XyoG-y6Mc$7`)MW<@t%}>-6~?T@&7Bsi@S$8LNg!*PRFskZ>b^ z${07nPA&a%$;ko{w%G`Ioi<)(&f@gVVl&ec**C|ZQ=DSy4l|B0>M0XpC ztq{~v&5JkT#hF7qhdMJm3$|#+Iqdz7l!keXVzcBk(;0Afy%3w%De&UNS#pKpADZ=7 zpR~?^TaPW3QZAAm84wU4r7u69H`4uJ5j-@iHJ!&I?G|9WnJ|X6GKS3Mvb(f?^`d)N zKTlL@viyBR$?G{8nswxOIr8v4@8*vhQ)E6&8Qp^>!bIW-AH5sO20_w?`21)6<>05Y zF2tV#{9zKXS2>dF?^_Th`a&KQ*W@KC5!op zj?6}MK?=y`9%hpYEmUMkk)xnQ3q61S{5}fA5cfCc_ml^M9wPat;{ku(a}t_Lz47n= z_F$BPmS@c!ZiiaSlDL^oPd8FARy@U{-Q{@2_U5rifo8q+14(?hs{L_HXs!tkjD1uH z)cpk>&y>g3P)}bg0JQ0TX`!ZMV~3>>j3cFW-#op-G^0M~HMss(hdxq``7=7Z^!h4# z7dYrc!Hok>CZ1jTB%}8S@9Fx<1M@B6u={4+w>?Hu8Zo~!+4UoqUc5swLnu&umw;24 zg?pOUOyk0q z5jHR|7pfi+UiO+g^gmmqcXBQkJZ1WEZjmE(5(jLdfbT9I)>`w;*?52E3){$33hN8Y zEJ?(3da*L+;MLl3M&q2@AcMUoEH+BzGbw0~YD3n$Sc8gFxD|eIpq1}C(_yx?b>k)I zohK2~YP@-Six&f`o-%cm^Gltqkyt4NQiaB)*ZN(*I0j5-z7)4%_(B&=B%jJ+XNDB$Ly?@1kt6` zT+3s@8LRnnt61Zmq#CDJo;8>%EsNFeQY1`FJC3IwD$@GvqXIeE2X`k&9sO`&;~CU{ z1@c7G?{qj_-?pC&6`V%ae#pP6vFphoQFcrV8Fvf!%w`!Yix%30&cLjeEDs{bgHNz? z;4dVO7eCZszBOFf0rx;L%%pTpZ!F+Wpq9RgDtI+d@M)CWF|wm#=JYet|C4wLG89%o)vYpY|Guazj*ny6P7F z_$*4yoX}ImTEd_+T&yz|Ek?#KhG1iK_u0!){Q&Z>=p%ZIaHU}s`Cv@2JvaAuefBS9 z2hl?#^^!@>$C_+r=-LQQKalRzi>Kl%P=;C{lFS%P7t~zmF?6Av?K@)^1`C{pZjG3s zlCD1BcL4^_;c|OBR?YbItI0tT&9UyXe5*)0AEu-39;k+v{Plh-vw15VZvOn!=-q96 zjWye7Jk$L;@_VHiZ=GtSQA|h9R-~|#5od;F{k`@_-_LxH0IDc1qriWf{jU{BitHJT z-~EsRMYT3Q-d_bBeeH#_nz1<=a-S9y0$3%{4Tv|rN;gj{DO$f3J_;wbzkJsO^8wk|tb zqE(AM5T<4B zaN2uhNdjY6SEK?>_)-N^n#kN=3(1p5oE0Snm6fr|Y1NMjWV4v{XbX^!#gne+VeW^g zWF8cbIedO~OcNypQe0cFbJplBurbBLHh%nrXAn_j?Q_#p5o;Bdq!slIQ za%sUMO$c2aX>Ug*)AQMycER%Dy{-ic1h0h#o=&1@%?sFAUfCDYtc}g}C;ar7&fd%N z+2!4Nb~KX1=82H0d+Slm72C+4~X&Q@m2P#Q2i9|f1-_gU7$h!ZGs zUC?-Dd0I=~(-+C{iVCv$Dfvt3Po}eA6Ou*z`lS>QEcp=@A(~4M8p`m%F65$L9_%81 z+2DyWu-e$xa&t{@nXRa=ogpwsqD#jja(l^8r{#=daplwf#kNf%=hbFQ^7l|k#d;S` zJ0D;D$|i$`_`Vxv!f;ym{sG>P@B*R9>x0i)(on10^sU2LbnCg4pfS&O?jhL2(l6N4 z@i7sDg2ZeamwyF3)38}JJ$M4%;$0r9CjYC5lepz9)heiv8!3Y_+!XrJ?3EhZWgZhsuPd7bjf;5VzM?f6<*<<&_`I)!qde>1xzX zzF!9ZeOguSRp| ztyaYWPaBkPkGSr68W>5$d*~l5Hk{&bPuf_knQn+*W$7E{BD_pRgfE2I6t&U&+1spKJGl!(iv1h2-sM2cqYA; z&&e)raACuT$zEmBi|Ef%c(lwHQ)5rNCIQ2DlnQtneqttb+P@Qgis`(~j;d1;Y1zK| z;lrVax_Z}XPi@;M8^jzkrJU1l7R(Nm4VWyZX?FCL+x6?yY(odCc^Fv=r1(^zCo$mu zmi5$T9sA>#F*U`acV!aprn^M`dI#xze0W0O6E^77Q=`cA=Qc*Qc6X7NJ5Qd}&JB{& z73>APr5Hzt)b7MOSZ3mLI|?b_rFQxToh#k>*tD^1(1Pey>9XE+B!u_NEl-dhI_!NV zcC-B+S_o{GU@BUvg0!Un#XUmCqoPuPGFSVZ*xRt1;tKBZ0!6Xh&Uq>TbT0BTGq6a7URIEbcDZ+eaU6W_jG66?@u9WU}5k8?UbRKPa;-`-pb0@s(E;5WF)A%+NpXw z|AssoTtMxSO9fhwNx32=A!$da0yXOU5RnSWz3UGqJ%kT50A!^)mZIa|zC5Xt;J!i?g(yXLLk_RK3G0<*R8s zSBQq=4S{JmVOVSTslnz-_-&Til9)sOsF0x{0U$waG{=p=+LdF2JzJGaL0;UW0uAApyV5f#zI4)Rkou1N7;&BzlMn~ zYi%7Q5E!gfFRaud_|ssPc-q?l_`Co~pG?;kj?psgJelr#vtDo+mzP9%kM~nktYn$h zi6{CFQ4xxrfmNvZ)mYv6FE{!2I#OS5T+YfhUScG?~ZxZ9&Go?1uis$`C- zlL^%M8^QRoP3{*cU+IOumq2ipMSLKit;CLblpGCSv!n$*3<#NU+2QhD%P!?}W}}DU z975ZQM?DsOMz2U`Zr`Mg)s7cs+ex-lb&3c505?BVD|v>6%Z(&#x^Ahf`U%&m`+JT) z&h(VaCtoF++h)g5x@)f*!%2CQ9*|(c0nxIH?RD9H@JO2D(6c8?T zq=(T$(vVuvktR=}NEzi0d6rZ(Al&MPKG|n^BkBB_o@i=IXLh z6#G}_qlo<>R)eFnuNq|5r~BWxlzx&B8TJki(NTh$E?H*gS|l>eX1{~eo_&}X9EIgf zmEHBbR6Z|GE(*=xfLox0jY3~v!Rx&cnW9sE7rY(US3v28oIRw;h6}S=!w;LWIxDbg zEUc^?CXO6P;5NtOf>{N7T=le#xn-{Kb|5`m9*qLeRGJYpI-?UWhadqcozE-bErq~v zwjHoCJV671+dXmz(AvXgHX6{?8F1jm&D8|>tvkqTsr5lMiGVv+ettfW^A;8a0*Ojb zj|d9`mcoBwJK*a7`RbwHJ*d3Lg8(p8_hd5$@e+oo+Q>JEhw*N|+a7-=+D;aXpuaD0 zOHG%R5xtUozWL;|0(jYq)*&tBSJe}A&d!eQG5+*c#bX{HcBVBUZo6AtO$bAJ4p+CJ z@MeZ~DzA^q?FutTap}ORrk*i}=P-5&cb%Fw5(EoEn7DW`U~UL7k2Y_$DAK^Zp1ZK- zDU1VD68nslz70r*9nWRDT-?p-D0U-O=KqTfW448(S9_!H+7;J>Eo7fZ#e+!lrFB@( z>g}mOVu&wrY)c{7fXo+3B~|Y6bM)4B-N(sg{BFb4U|&W75)!NzqnLzKp#`1t2*=m$ zI*9g}K4K%`#n%k!1PVE}T^A2VMAqk#*%l-yYwJ3T&R1<5`@J}4(`<^8?O`#9s~lMr zdj}Y051m;`x zzs8LPXVoh{;^8{%&>3)*iBBre9%;7KB{A%o{SufV1VRm+#x?;=L}gCLZ+q|;#fbPZ z@=^yaLJ5|~+~nWA!!V5q8zbq!<94KToL1(SIeh`SJrmBtUfO%WzZtZ}$3rGr1)2Ll zOLd&P9YWF3svkH4-u`S>s;J-;cGL%Yr^}FD@)K?{cPgojCF+5Z8C)>2C?ej~7j;2+ z*6`PkuIj}*J^q!zqgjrTT2$f<%m@ts*nXT2Gn?o=Y7d{xDmX!q;26NF?FB|Vx%JcW z3ivX`3G-SI#XQY-#6D^9-P84({`K~!was*htW6mOo4ER|yUUA#MK#d5eb&Ls3Odg$ zB5P}z@C*o9&%2#BCb-NAFQ_eaecj!|eg)Y0Qa^l`WlDYCZo!zb@c5m>PC=*5q=~?r zEZFrHp;bG)fU=FeCkDqWNu2KS2Xw>A5I_5%!{8 z%I=%h1$xWlsUorf>a9$y#VN86Jhjf+JHU?@mT=gg z%;b$^ZHYXH2aoDj42IEyN-w=KJFM8tZ0v{>c2J-kd1y^k5+8MB_}-jbcP4H=!s7C- z9;F6_;81BcbR6ke;#H{lc9gm5eMyY^sj0Y3_J@`ro(Ya&rRqmhwgcs%od2IJ##W~t zr!kd}$x(~WH3|P%J)20de0z;Qq2_JIK2URRg;0PV&J?{OS`n^jXP!P&{h8 zqG73jKJ?A(MOuaNml2g@Iu^_($K`0Sl%%8t8M{(@1RYbaU_jpuwegizIUk~461kyx zM9FtVYBywwOc-m93ev;9n;KJ*mzlzS^3i5569p%oLM606UBPYvfrEizQ`otnr>RLR zpYQHyf3V0oUN}{yy>IsN72i=0!=cSBAdvL<4Y493aU^!A=IJlHpPil)bH^-i5nT2H zQJMJKd8RZAZA8y~YklSODW;_4`ea6V_JR8_a~SdX(;=d|@9F+e`A!J~nPwz8mmTEt zMk*^_mk5L9(=?2v^(Es_Gf0QWuZIPi62mQ>Rf_WLBWaVgVJ6JWxxhig@8To5_>N+a z`z3CVkI#Pk-j$rr&CW(kWu#lVXDgc6gvZ}3N*phLSR+&Do@3#X3?(CXlFoQ_O;JjE z)b4JRya_y)>6P{oIwi=^CsWXh{HjEM>Vi)-N+|z2slje74lNSiRn`=FZT}c!JyoP{ z;p)jHFo^vNbL4(M^z&Or&Q7~K=e-Se#1I!jOlNa}yj%-%e2>1+w3~| z?uI;RRV1X^mu=vZiH=I`;`{K<-kL0KSu$UZ2(4vqAL_<7s~TpFS2Z;hJ@3K{UJE=4 zDK1VUBZR54-Bi1jSE%$=;FEpW8GpCj?B&_f*+2NL&@Ga5F_?Fi?{DCpq|gp3W@Iw3 zP&8Jx22f(;*Q9=eUM6N!0@S2!zGwCR#3v}w) zG+6nZf8?WGTl=DC*Y)KiSS%S)q8te~=_iN9LR4R_<`jh|+}*B5=J3H>4EHvMOm?Eu zV?$LR=W%9vh#>~KA?L2DEZ3G4|JnW7a@N;wZyC~GNo7QB=ut}`0=V3++8+5In{9)m zHJFEYf3O^E$e*6a#E^_$lU{-dsjYk}j_KE}^zB``eu^(6hg?M`;zbLs2Q{zmz2tH; zXS;pH*jA4d%x3cO8zc3%uk=CjuC5nL=g!~obh`@(9V$?QAXkKVL6&fq77?v?;}55$niI)$)IlRGopUhkiT1(Ep^Xn&i@Zi(@-$5YU<_+_k!CYIIZA81G=|{ z8RsFGvl45vip_d^HY-G5w(02T90>9zlTZqMd84yy`*kiTT8tcF3`fPcbjEj=< zOErvVY{na=GeQBI^fIy$hFk0g+Y^l}BhaB-s%e6?(%8-LpvHdnnvs~}Mw#PQhJ?>) z8C2iP(dNBBv+m6?rj>=s%O1&n5w^A_!NMX6jeBKgysp?kMW#p`#OE?^f4Q$~s4a#- z4(P#grjp#FH<@_%TS{}!j*Kv1C(Fr^oOzg#mroHUW()ZXDFFK^z+V0)F3*ud-_C~N zQh{wLIhu(8wwYr{b}v{jY~0Nn~;YCsJGe*XPM_ev23mL)Z80O9zChXGp%%KD8jvNS>$owwTBD+ynS( zF$8)~?AB&TnG)f1*qA?`b)Ma9SFjZMy}&aoi%1s}RtyO2kCM{Q>0h&X`>JNy&H~1U z?v-2Zi8FMM$`u5QR7vkUP4}`&27f99<*H{i-LSrw z1_c)f)@vPN_gZuR$04sI@Dcgr#RS4jT0c{XDRbvuuBp$$c^D|k-pMa0LD~O8bHg=n z4;bQpDp~nV?0q_ckX7jJ6YPQXiWV>T7b*@8Pe^QTl;QU8aaj%=xjw3^)EZu{!ZNFF z*S56?4Nn#RP}4TPxmBcbFHDRygSqSrHUqdwgD4w+cAAqr{x1s7qUvrfCx850>N0_; zGN?m!J>b`wzjMEM33MVMSM$~#lvUpkFf!|>DZrB`_EwRDqJ?q{YjAko4cZ-e_vm~A z2WT}80jPsc2O4S!la#pC`XJ))`{FNzXhV z*EXEm6#jW$G;v9c|iQp!m*aWv65J?*=#4R?h!}`nh$%t@d1RNz;<^YG6KnDXhr>FVTjfS!M z=dQ)-WU=s!?XC@{0o$$*weSZ&QQkZy$0@iM#zLc8IH~=Dnq<#C-pl_R?~O&h#yDJL zX?(Y~zZcp1t8^S{1{^|XXbUcCN(qIBtSidk)1Kz3DVBS((1QZyFrUZtyoWb0zMqXi zYWY^Qo^x|{qko-0EORpno&Tk(H>;b>Z2_RYUcpPVI2TZj@hQafTij=Mo zC$jBJvVLSMlG`|y*976pPC+0K@pg#}jQSi?N9MmM-*{5|8hGroQ*YEBqn3qs;|y_h zHec@_+`YNy;P7UiL+Uc$_uN@KcRCeyQ*rU%in?zYb%DW9&+A`rG7NZ(WhuLWLMo z>QFs|zn`v|OZmIEP2gtX1ya-OOZuPKcF`F?eGXffythMp1~R@ecTZ+KCocMM0LW05 zIIyuZGnqN%fZ;805Y&(FxWNHX|&%R>JUwkm*9lT|+V_&V7 zNDW#1eszmb;bAOdJoKEDp7CIjOl%eunoY1ObAbKnmCUx{D;Q3p+aLMM;(qX7{%~W> z%q=nTfxVt=!U=f4xNMOa9-v%y}hU@bXpD!^Jm0e^sh0N~*fy zZhLX|WWR@1q{Ww2So}MI`V(~?RT=zL?Rl1Puo#zi?npC2{LC$GnYi%p`wEOe|5@j* zT+t$69vG*CIf`N59P;G2S}b zc$3=f@T`S#H&DIY>L(tp{nZ9EaXb^{$$syTc2;Z{yJ;yk;96iBNMNCdXrR3VQU6en z0T*X9Jz?Q$t1_9}v|s9XDG*0NF3g(k28YC4o#(U4i6OujD`>!~0*Lw(3QAC^pK*X% z=suop*Yy>bhUNnsz5#onEr1h%Y<~ZDQnuZCf81ANSd7*d9w8EboZ$8}Po~yK9=#-Z z`tC)0r>W`(QA3~0;{lc<-~g(^oh-l}l*sQ^l3ayyM@*gjEBtq=FV&XTm)DM?cA5M^ zX(rL%tZ(C=y7$;pbS5qq3_K}YCR$)~FX+3T=;3X9*M&DsL@wo;Xtvs%h94Z|`}+&9 zuc3EWzITdyA8TzFP`SCe2UEBe1tF&B_sz|v0j&+704(L&c^oYi8w;K&)L@7q3*XLqANj!j;3iNrhu*t8inZ=>_eyglp5f7F*q2c2Fw+rm zJ_>%n#5SPfd*mrn$ewErUahfvpY;g{5N~~L6*_o1{4}Hrd2M?=LBG4oV(jo!nw-<- zFliVe`xAiOd>@IJDG#^1g2Vg)jkhK*nRd3;E^Q>ti}s4=E7;@X&rSs&mDy|f(G_LC zB<|p=@>3P0uY$44<$Z8JT3d_Ev-)pDl?T9^>rZAs9Bl&sMC4J}?Xu^UN2r}TY`rNEk8_|5z^qL0j;jvFAJ)b4yekM}7-u^ZU7 zn~$Nzo$_S^&TtvxYze%US^&zYcVQpHw62pj&doygjk2jV9fYK^#VIt}zvzwS$~$cR zqO86_CZ>M+!*|@tv|k2>QFDnV@r!lIb!!K;AWm0 zX<^drXNwsP@RYMia$^%y=x5u*5JLamu}x*?AAiY0w@OgvZY7XDOAJZu2aah9HKKi9 znM_(xHs4gdLMEdu8u<2}v4}u=2XQZ1(J>y?e-x{5*U)U5h^4}UxHT8KJ0ACpRcj?2 z_4W#f4wzvWdPBLk?{26)4PZgKFJCtY4KW0@bFYEqQxB#cc$HPBu|;VUlG39qHsMDQ zHEm3pfk6UDt?3X^mPwZxxxq{R_Wo)I7Qpzm?caOPa<~$B5RO(u0?=A=AQJ$pk#!=Z zMqh8yDAw-YH?oWIj@n9a{7f4L@9OHx4@qNPp>NvXn=YpwPUY=TpsyXQV?x$C$OErl zd2Kg(uwzb6GAEZwxw?CZH{I~9w};Zx`wHmR;^R4%*1H`L@pClhN2I^f_I$0?tIR8( zbNan%FpLt^e$A-bTkt+KQ9&UY+AakJPOI%KsePfhAd{Vcko=Jga*lxHBtvBr!u*;+ zWqrr*RNnWa#Iy39?^cc!Y_6hYD@N^1l@_L1UD~ywpk;ifzP&nVaX4IhcX4s?bMvlv zl4|F3q6oJrph{n!2y$3nKjB|r<|$&_p}3o5D*9p`AtY=pQ^R(=KCv?ZDE0D)ujCjf zXr-tD5v3&J;`w3d7nx;StZJ?gl6SI~wDT}f4;IFVHw8*F8VF$h zP5Oewh}ol}BDIQ@zCLnA4G^t2p9L>p)v-TFm*JEX4{tKlv;UrqkDK&|ykQT5gHDFH zzjjudyy$M`N0U|e4#XY6UtY&=Uz+`yM|a(ft=Lg4jz4JVgaB(dKSbM*6SdySO}4*R z_Jf87R_`aD>J^6>%(d%j=u8NDsPNl_4O{a?vjVygFY)(wa(rT?Lb>|1+x2Gn`S}Y; z&3Q*xLs%caY}&?Eze3Fd&07443j=Au94-t9k`HRmF3wshG-tI9*Ov8{KlJFy1Bi91 z=|AUPmz46?;j!3H_#bqE2lnxZtoVFOBV2~rcXV7*$Bjq%!6CDrVJNeriU`7| zqxX%=IPN6!4j4w(uGj_Ukl9b1-PUv-;pzCVF>~kBg?W{HQ`H*z_HShs>$4*hOnHl@ z3y0>4R$~hb|BMmvysEFpZH=X?FgzdoB8{i65zOw}Ff+E3P?qYF%O^O&_oi02@ye3m zZh4)LojP};0V7*eAuj1$+umR9#|TI!t>33>>{Uw_U5x0f(A!ZZDEd1X^5{=f#I*H1 z)^X2fhedT=!-*>&^A08FNM9v8(elc3{in6spvO*`c&)+ zm5Va)1oKe1Tdxu|Ln0Qum2a(}3433Zf>+G0DAHQW z64=q+|FG07?OR&X|Au{>2K}DzfO;UWDaO@QY&mW9L%JG0l=D= z-Y$@E2AHu}h8zQC=2o*n^%XAfwM}KdeB_1QAFNBcEJMnrP0J%^P?EkR^|%5T8`}>! zexoA)**T3k1*p<=NF`Rtrrq?u^BJ+KW?HVk93JK~=61K*r)E%j-(FjzwSmHs1RP|} zWcbY+BV;1JpIAhK$h_JNnMfpx#NDa6#LSgbB#xBmKY;U3l#n=%K4p2a%V{?0;<%pg z(++}ixSKwZ{`$r8;shtAuyf?f0z*L8`ZVS*y+rfdTukNx{VTuT*RSIzmO|}}4W;CG z)VN*;^q{}nc;*3Qy%8lyLbWGfazmjKw2+ssSZ1nTL9?0vCEttJ!9fIXoGQ0u=K2|I zJuKp>Jr>RD3aw4@@_(;7z++qiAZGFFyB}hrsEk$AU6%o?p4fVA6G(yYOXuT65dqOc z%eVzxf9E8VenKr*mO-XMyUl@Izxm+OV)lrH`2K(QJ{~Sj$!+o1!*(*L(Y*Ox?rezT zy?#vl`EF;ixiR^=8L?fsZKD&QEX zDEr`SsD&+G90#4_BXT;);~#v|8NV!Iq7IE`Doot(Zq6q}DJn`zNIdy1 z3$q5m<783hpe6H?sKaU(FKGDriSM5(tN0U-%MNej4i>6NfrYHd2xE8U%w;>L#45m1 z%zP#^?6F}3X2jw%peO+U^E*r)!6=poW)kYh`QXVyf5e;&2rYL{@lap`_?#) zgB-c@DAn=d$zMAw!PLJBh2|VzVo~S%hCWR#yLzLrs6-XX{*GQ)^pDdJ0Q5hxvm@Q0 zyWx+19p=C5y*;5~zD)}EV_jVJ}gXlyjdW&u_MAWF! zBVs0c1cTArsL@+SCt4VcZuHT%^x#ke&?LM_Bv~?{jBF%$AHWGH44~k zE2{FO>WE@n+4%DK^{c(j8`t&@bza!Hd3(mN*Dj)-+R!SLOO<$YS4dDQs^kbcyz`9K z%F=kV;J|MqYRKQy&1@9cDA66w_w%AI?W3k9N;6hsEkuWyt_L5}zgRtB|2ckLpm3r- zXxC1NABgy#Mzk#D6fCKC*!Um~kAaDNfVTU0MHTCR9%iIlV@eUOSY*0$qoP5p)$U8ULwAHw)! zIqT+%29kg;YNfG0bNosD8}GhUxyKZUgKQMhES5Wpt6@5p>Nd(#Jcg$t9;*aEA)cul z1_Hf&C8tizWVZKmYMtS8?0DuYX0?PQx`04w{U6*u$AWQLP8tU$Zptro{8d%Mq+cFv z3Ya#iSchseS}`o0Ky?M#$P2xFGa10@XDHw3TQgRo8?NUO5#O;~76aqUt3cY&|Y4{Pq245-N zg)U(l04VrmRZEWBiq&Fb>0yoOpEaIT=hqhL6vUGPwNlyWAjb4Au}L{KNF9InZi4wv z$Ph_UPZqMP+F9i^1w2ph@ggbzFNXk_KOTm(>rFqp6ia7*Hhy8SZ>_whtsNa_D*oRP zToWp=>ff=hH!%Gup^(qwSu5T1gsH#o_A#U#vb1HS+azirEYd5TrHxRmY0>b5H#dwmM!yY_l6BtZ}%GEMa~AENa*6QAZp6wUT@u+I;u3m@}mYzN`csvyjb_otvjXU(}NjCkZj! z!F>70aEEK7Ufq`IGfsYkE~2?*GcIqn2h;sX<_Bh>A=f7Nl32~U9JJYymMxdMAj7PT ztdW(bsJTw`WpoincfXRLRi4taZ^&Q#SjK9&Bx))!_8+2E2Acz05za!kUi1Pea}EYi zOtajMdU5Oh_0TTa;H{4g9d&BC#6^1Y@#f|3FkpdDj zHuSuqxeE2!>XX^i1UJf9$!E%JGcL#WX1FIsNCcu;vcY`?XhNBhdFF#53}$#8I2wJc zsm80A^ig94v+1!o{4|=rV@O6pTmvviu+`@L23?QMO*)9WcF!;22{@lDJ*Ucv9oJ1_3y{e}wCmp>`LkLI?3D@)0V|A^(`n z^xgK;0pq?>mOJRcip0v+QfM9O=j88UfX9AweOCy|5!}6|7dL60Lg&Y~wpNUy+Bj-JtjqRG_#~X069*Ry`Ny|(O}PFEqAJM z?)%EU?2)k3l@HkC^u!Xv%}V9`!mxHW)dm0s>lsb6Kx{nNad&tf<>8(J4=&lhieHzWz(SoiAV|RSt9cg$9+J0~u zF78u&L1A=?f~#dW4!}1{$HNAn7tU*%>)vOSdaVLkm(h38@tfK=qn*YoVT+RE0b?h- zX0Gua%YHYg!qh1LV5O+0E#k&`rBWO;3Y&Nol$=Aut357xa83}WWJY|oM^=z0!@gzl zkk%yAkD-4hCzk)Vwa|3gMG|6lcJ00ZC!>*eQlu}uuE+#z0Hx1z==>2rjBZi;74X!8 zF-Th*S@R^yiW8aJI=XFNoD+-S)epC!j8Grv0Ns2SNC%_Wm)IY@}FS zO9v{o#)k0p59wOohnB2J9lc}%dpwydK6_{DSCc&VMKIi{elK(15pHkj>jMO+Ls7`> zk>^Mq^|)3^?_$vE*rRN^9(*?7>OIvi5ACZ5LYDDw~=X^b**O&?^KQv&J0`;Yz7{V z(-)phFkNqKk{O;!UJ{!vyuBN9V&q;HCxon=gO~N0*{lTeF`9ye*g9eikfV^{(W`ij zV8d~P9@mGiEFc@qE?H^6)cEozJRf1}gCh8hl)FVk3RjGwo`BRj?JYNm)qN!Mi1uBv zV&7skVUtn{Z8`oY!DK6?=AU&e?QDJ&H1SfostR>-GT7FW6f$(F1@WEHjbWgNgQZeo z3dj2B$>{KS@Oa(fwO?MFkG-6CBCLN&)T`^ywa35uX!0HM)ltgp0nqn$s;HoVLr-sp zPrm;~Ls{ezlT=_!LL<#Z@XRMiQnWqx_AgWQ_XV3iyZ=LDyza@qW`pCW4FeIDP>1Cw zP{grKKS*i0chS0}IG^4AHnr*X4UUVYjbl8lhahq&0Zvk;#dnJljB{gr^~Xq5z9XuM zTISB6%*u2F91n-wes^V$ed=8Qz_ciUml9;U)2UvmUGO*&Y0+;WOD0;X({2wl`yn$M zQ5mJ`dM#C7;6b`QnYD7AFY-Vl)t^G5u)s06I@(3f#DhC6a~kK&)G52KL`Y8qze_1T zH}@mhs2cM|Wh@UqQ{9k!x&bc!=GUyx%j`1nG-5r(lmShfwmK?Hm9^@7cn^=-A|>_I=##j__caaO zEVbmQT|<9iZiYG+3L_TPCj&(@OSF5NgH|0YAR~Q}>7T=uY^i>;-A3DVT!~IfGu*s1 zjpPrixvA)i{2L^|`G~|;jr*4DXwn@k^(?MU=8BqWna<@*ki2mUNBO{sCx97R?$oFB zigBkBTL=~@ZS zcpDb_PvUTQluCNI(qivDo?Yuyox8V{l!4`zo4)=WYrDW>-?rgkX|1c=C9OQjB=p|B z%5m`XU>URvd075Z7|yV83|V-;COt4Uj~o7o5P)G;gj zo%`-FuBX)V{kGw%kMGclpa(sL`30g^R)avJK$j0M^v4y1nTIBA#p`Gvx7Vq+I7PhR zBjc$eT`T89xdggRE#1VlwM5Naq35s?ha=~K_ztt)t=TonbJ-) z=0Qj&+$cjXwF!i#g}~!VO!mD`*m49!>ucryu7?tcZSg(Hpyvg&rz#rutt(_=j{hiT ze$Y2C(?+&;2dW!-9nB|3@I=2Xm&J*YH9U)Kis`Fm@9^W;Sq}MW+=VC?;CPsD!zL`DtOz!R*W8>_5 zn^`CozA+bEmer_^p5eJ$*x&x{2C;>_DT@b&3rCo=`3njueL4SIeZ+M1}6x(#3 z0+Lww+K<${P{EE2S}a(la|zkP3e3y0CwKs zy*|blv1?!EF3>QM_P@|DaX7OV%ke_2WC`YEBlzWWWxZ}>T@NyH=zV*>r;&J`uS|)! zfh9;+j47NJUHO!B-!6Y<7O)p3uh6KPYtQ*Q#Dw^GYbENC8VS^*s90oY{g!L#kn>2MrVH^Kvy=N6)dV zTiZ~^?nMw{n9^9~D*%G6<;fiO0Hw(cpjY2TY4RTa(SOnV@!iiRZ{FM!4P2lWq7z*> zed7j%8rSa-YD6jq{|%}6oW~+6V&STEXi_#+hF-El{_^?ll{5-fR^xjh z`H@cPjp;MOTc?Vr;EE!l$BT<>toc3%Fgr{~cVGfBNhyVhpwm|Xwo1f`id5J=$?|R5 zNJ%3Re@vNXwUOj7syO)(d9wX$d*b6zSXx5N5QS=9FWVlenefh%kM+>uZ4cOiv##FA zQ%Nx{XPM`&yGINfNxeJ1`8D=c5K)xu=WTkT_)!y_To6q}*}R^< zm`!tdxVoOzufGWPFh1XF>sQ38B(-^o)g_=m8pgv)7d3z-ReiL%!E+g^zjV00j`^}Fn zb`*Wt0_34h_@w_~=TrYYT9pRaXEN}oj4WnZMfs&S`$|R$UyeN}7z;X^B&J(F84Zxo z@+;;@tcO&EPFD7>L|NI{ytg~p0CqIn7?T1{EXGO&nM>T)W4bg|mv?5Q9>?fC6+4s6 zL$J=wM!fg{EPlLz3ebV9kAH2yTKJa%STP?isBJ2TH(@Z!@+UM5&Qh$L`HYjsmaeEI z#YI3t9EMVe?xp^gs|ipM(-PM2-^jxl3=0t&N-c-aF6pFds^$si@cSpuZ%^1-ep_dzv>NndaHNDkSj1!9V)D{SGW6(R#o|CcHLBRJhIZ;d1y%myf{i(h zls^MHw12Bi1MCZ4th)>>x{ynkQOwS39lZ!F>+w1eiawYO?g54KQWI_6?DUnH&-Es} z5_{!5BHOzGm)>*sqN~r#@8$d6oh}&_y4^Wz%uDxE-}naY({ay1dbk7Rg616Gi=Lu56xm>b3Rsf%+JD%- zczalbRhbE)(&dpj##|(B6)e>9L3w;-bDWwWQ}56|ewk&YZJ~9L;4(BH@v(@_A3bFf z>}R780SyqCa+-m~jQ2n7OZqybIoFkGR)Ftbbm?d>CV_ah5*(R0ZWwFc!GCaBH|;R~ z0FLV=y@Vy76@Fh&^*2|KcuZ;CSO(ya_K-gr>~wsDY;==<5$yKhfWPIcX2|n%|{Dz{d}S=u5DAsd1dAXYq6o z$b}ZNR5xtM1jd)`-XRu;ni72aVoCGPynXL>pC~YZX~!3)n-GN5{&sCu=(V;uoOg2LSzPK@XCHnTs)(AWej(NlC&elfkMb5e; z8-^DArbySi%g)l(R!rnDtJ#0uLG;$(_4qC^r_$9=nw4fYiYUYPoI4q(Ke$TP{=oDE z`EB`ILJGXk?KW?;hTuQ5u*2OX|5FZ`vh6kp0MDn}YZ_hn-`(c2S+q8v)%?4D83n(d zCmxna#YLy8YAU_j^uzRxI>_v>fCIkzw97-;u+n7$%Ax>GP=)mg_S&T?rk52yDW@<3 zu{xNyl`--d_Na{nz2ZiWT6D1*aI(lEYtFW|DAWH3KdaO6j#_+!rOl0YIT*iA7)b2D0Jv@6kuJVl|w$H^kn-7I;gWaVQ=yJT% z`6^V+j{cAnh~Z2`C4xgF`!3E+Sb!(>tqRB>N^o0JyO0{zukV>2yEg+p4*BG!!n0Wt zJ+o`pAmda`=I?%h79GbyF=~0-n3j9O39dJoJU6?e+XsV_39|Q?M^!#K=VFK~VF7>)$BCjg0u2S9oU8f&m~aG0b^4#K0?@YPPsHpqPC&-koH-Gb}@y*$g zs4m&PJ?bKZ*tCQHmvykR(E)}XqVJc?wtu;X_;XxKh}eqU)6`@FcV_p~2N0Vf60}hG z>!q|@D+}rbeR}ap0lBFz8~>cgU`1cJ$VA!a3L9I04k7;#06)NJ0x3rYBZLzmqBomA z#}G{Jt^{)Kjs-S1L6SZEd07jF(r~z3%h!l{cQ{<9<~`m>BWK zEZzbB;o=&e-rjUgKjk9}8tKloyIGEDH<@$$;9Zfq5j4L{t^XC%fJv?S>@h1R4e=*C~CwQ3uRhLw|ct_(J zzehl->YW^Ls+LT$vE?n62nv8U^<7J6bMcg)0K!=T*FoH9nSwTmkzG|5pIx55MN00J zoETa#JosbCFc@pp%VVQeV=wXlXi=c0;aD0?tEuqQMU-J4XK8b)X-AIz-oaW_;171+ ziURNc|5uRI27-R9wD_$;DF|5c_iev2HI${wN^G_V>|zHsbfZN6L#kRk*|OKM8K=}B zHbbbWd`y?Du9*Z}N8AUa;e}Uc@lp?{p(?Hes1mR};aQh|K_TMz;bnw^v3tNi^}{=a zL7xKKJDJ;mum6ytnaiZ$VhP7|YC<$CpJO`+uLFzzACf6R-SK~v9_KnAf$K^i-x!puxLH8Db?%S3u|!e112_sKi>LSr-K!6$|>-EWh=y^ZDypn??0( zcc||ZCKleV(=Tg!*Gi^5mL|4DG9yJ!M?^#zz8o64Dg!hs`Zv4#L%tQRWyx`v!vbqk zC}MAwF&!DO)EtthIxfagTJ_PV;rKwQ#0C3?|G?%-JHDTn-MEUfu7a9ih`TjzuD6Qy zpeZGgZMg0J#7w{O`u6z_xr8pWf1S>+I`7$GdSZ3&@WfnAiPx97PpbEjEdcwBS3LUf zUKOi;`j&}_R@TQ)MM1MDRn|?^*x7ldCugIY&H)|ty2A5E?C*KP@IizfT7*GkN`ySR zH-2LOXd;>>$JJi)rgCqsjv~~>)4!>^vc4|-4v+1LdZTyl_g`!zAvyd{a4g~160hCG zyuG3zSPa@q*gQ?Ut>7^}wd23$2vca7N#RO;||`hMukl_x(P@=7NoU`5LlHQw@@(kXe%tMY9vN|O8n z2;DqJwxbi+Q0}C7(lo7dsWg496?#sF4auH~NZfRkHt%NfEw&VNq&r>xaL#)}J7nFpeXdW( zmtZiiUe#ov*!X@<=?==jQEzvH^0;nj9v6D=vHW7MyG-? z$qc6My(_xV$hUHxdMtrzr|7Ki+$pTaCKPT`xKz|eOHKE@!B0wHDrv|n^abd~F_BIt z4C5*;aO$Cf1{tevGKRRJ_`We_*E{vLxOaNa{o$(gTnr)lsc-?4(yeIKNAujk;M3gR zEsM5xN7~?84tEb9oxwGdg>@>jj;Qv zU_yzz>GTd{lv(OkKv0m6vLS_`x2QlBhWm*#>(8aBk8#3;AQ--ec^IdJp;$yvPFs5= zl*2w3Fe@1rzVH$)=U0kvye1X2cyk6Dq@3ha;~`XW7VNQaU+qf;=E@jYDvY2|?Yue= zC{4HaE-@W`LQyr>mWwKwbhQF->&)} z(mpeqb$?sg!o!foOF0bvL19wt8-fEqPEDPhV|x6!$xUA!+UsCl{MqQ~2izHVz($#I zG06-pJh-(6xs21>^BI{xFzc0)e8fL~fNvF9JuyD>SpDsIDTuqbnms^?{l^j>MJb#T zwcr}Q)hX+fq3?OCmFba%$5ZX%MJk@R&CE$JZ4xqD>vdP1PPHlP`{XI|x?l(;@Z3zm zAa~8oW)WULoMeaWp*b~Ac4@hOzLT?>4%WwiH2W<-o_n)=N;2xeV<4nAB{<_dbJT2?Qyu!FUI~j$4TCT`psMlE`)TITuX>{;vb~w!xEN9H%}#r*4BSSvjt#47Dvs_y>967^}#f~P1*Te zP8Gw3+ZOh>cWvDa-OyBd2)_vCK90RTKlC+f>4F3<49kN57e55fvfq2@_>EcB$dD|0H~OJ9GX6 zoEHz=W)#}Qn3Sq0cUr#hXlU42>;`QZxp8uKf1PmB!dtfWg~YYXfkj^1r2>?)#=TF$G_*?m4{A~bBT5b=qG^v2vO7nXYiHIh*!{F2x}<{_ z_`H7mthV<*ITtJ_u^%dg%q;mQd<>(&>=Q)lQ;^G78oJ)rK5^iBb$_*ZKe)C92VBGJ ztHnLJlj2EKbWo?_Kl2mTd6FH^;{`OAfQi3v1G=GMQ+y^`1XYxtwl(j)DX-evFP)F& zb;wjb<7Fx^Y8DhvM!RxFOz|$Ss4^Q$GF}DCI&^aGUc?QbM;G@5V|K`d1EtTr#Mc{J z-|zJ`9d<_z@^H^zrz!Ag(gNR6eSNDnvNzZ?KvE#$u&eJ^@vzzx2bQ0p5)A@Ntl}51 znRuT?0mP$zwN2IVbB!N$*O)B<)(wqz%kY+fsbWd`j74Jz;$ZD! z!^|)KGM;(=5BTUChh|~>v1;PnKFHJW0krGesec+0yjj#rn;DvJ)h~RDo{!3ZY?x>D z&D=ANq_cMZTk?_8=jrCfzM1EIzC>rJWO)_BlPkuCx)1IZ`p^Z&(^Pph5-t=>QIjtZ zCO)0Ab6FP<>gN4XSyingjz%4SMs*B~jDeV*{cXC^rhixfpzkMO-1{klKPC70#d4^M^ z)}2gI|Awd0+E4(nA4uo*7 zO<#9M5TP{Eh+iON897*9+7T%c*PyC1-{(&oe3xVN-dO{ZwFb={opu3dULjeFaFGz2uR$yobGcASZu$R>&FA%s4- zWzy80LE-D?FXTY5vNZ26!12Fs5P?0EmrK9M;N0(SfYXgkrT5pa<>y?P@wxjoiJ%=S zdcBTcZq`x5ZY)e}L1CA^qmu-49>qDk2gPl9tjiTMZl??kMs11&+t)$zS=&HEgH&|a zhF)=Ex%Kn=%FNASu=8=N$QwbyRMyDw40*a)30v+r4!m2n4hYjG%fQHH$rHQ}>~dFf zEOEXILhjjEBsryI@$B#}lPT(jOp#EIxESMOyO+LkNx2!)>KukH;YH(L1;YsZD!$Fv z+v2Y?yss=un44o-WKf{arAZUE%4h`%WJNDLO^-qx(XcEB_gO*KCQsO14x28lU3m z_A&C3K4#u2@U3B7Qze$CdbGKRIdc~QMn|!fbIjmAM6$GuMjRP@9K~W64JQYJyd!_yH<;rsL0Mu_!@fQ0q{g^1HZme@htxNG>H z)xIqo_lhSBsD;zE!3(EG7Th<%vd-Sd6nVTe-c_HYHH^&7dlSKX#7xuYIJQ~#xlB{2 z7<^cZXuyD)b0f0h`0QLJWsjW&hb~^PmtNcsad}lM(0f>yQ3Sq~OmOIwqT>FnzqZr5 z!LsXfxlDyZj*PvY#%1eJn`J&+XYKT&JOMTcs_&0G8S!a8M=PuPgH!68&}2UxGqlJV zRDrD6wu(}iR<6v6s^=LrQ8>Hn1U8>oBx|9==d)v3=C~kF$FLcDefrRA=75Innj`6K zH;B&*aWAOtdrA?(#qEZ*3PL!XpFV1fqzbI1*NaBN)vJ@wIQutUlbxb&?aIi>%>87V zDX(%%5u6y79Mmzf$>}Hjm67=Xjn^IF|1sQL=K~c7obt#*=PF6_fNg6a%3&RA+v z8j5R2bQqGSSM9lq(=PP%;}KsfAGqn)i%rs#8p@~8aXq0WXn=p`+Tm%VaR7DERlno( zGgoD0M0fLNROZF(`7ev@Dsyg73-#f8$1lCuuZyM@y1nVIM@F@*l<2gi<3WCWGSgL2P3DL_VW-|&vCd#y_no^!tE7j&!3lYy!kqGb;U}wc{<()%geM0 zOBy-8+uQec<=0PPbQ4fW+3e*lp7dc5rZz~VnjP9z-8r`*hCqmqk z9KE={Ha2M8!~>ayB+r{k5+RS|xS(94k3AXSrO4T3^dGOZ1#e6(R`h%dK)kbXQT^QF z`w2WKV~6a~AAeGpex1yx9#J0=oHoqy|bFj-PW>df^-hx8<$(E|~GI4xb(VWGqS zSR^Ya$80Wj@?mZ4d@X0~%+Z_|r?ID|RdU+FWgJSN!wzjs{VcDJovEKR{Jjo*%m2eT zR~#NZAa@a}$Yho;UE*TNxcsP=ptr2?A@`5IaAj$FqN z#@N}}NjTOn^&caoEHnmyo*ZTqL6VohwlQBWZP5uIT)SdCX-TX3-gAfy44~aEU zC{$)an*||Q+v+eOnoh!&2s_jp=pgA`MG0M8^yW=&n7poIo~bJQ`xFzD*om>ck{@_W z8@|N)s71f1|=Y8B^dYH3*zVO5}#>+|ti+3N?p_mYMWgGjK}mo|$^ zFN#XD?Yc3!iDoMlMYkJH`wruSEtB06?`@5TNTRS4tiov)Px*iuzMK+4;5*)2Qmyj6 zt0}9B%cbzFd_V0*9X&l8B5Z;9ddh&@HS>^jK7^pq@pHk zb^Yz{!zz1n9sdEv24BwerwzzH@FDc~hv_q^+-p6I`DpU7E5M(EjLLJ^Gn04!2aA@E A4*&oF literal 0 HcmV?d00001 diff --git a/docs/userguide/en/workshop-email.html b/docs/userguide/en/workshop-email.html new file mode 100644 index 0000000000..10e9d2839c --- /dev/null +++ b/docs/userguide/en/workshop-email.html @@ -0,0 +1,150 @@ + + + + + + + + + Workshop: Managing Email + + + + +

+ + + +
+
+ + + + + +
Index
+ Haiku's mail system
+ Using custom statuses
+ Using queries
+ More tips +
+ +

Workshop: Managing Email

+ +

This workshop takes a look on how to manage email under Haiku. It assumes that the email services are correctly configured with the E-Mail preferences and you're familiar with the basic features of the Mail application.

+ +

+index +Haiku's mail system

+

If you come to Haiku from other operating systems, you're probably used to big applications like MS Outlook or Mozilla's Thunderbird. You have to configure them by entering all the info on mail server addresses etc. and they use their own contacts database. They take care of sending and fetching email and store them in some big special file.
+Changing you email client can be a hassle with quite some ex/importing and converting going on. Using more than one client in parallel to check out what else is available is also not without the occasional kerfuffle.

+

Haiku's mail system is different. It breaks down into smaller separate modules.

+

There's the mail_daemon that takes care of the communication with your mail servers. The E-Mail preferences is the one central point to configure your email accounts and how often they're checked, for example.

+

Every message that is fetched or sent is saved as one single email file, with its header information (like sender, subject, date) and status (like New, Replied, Sent) in BFS attributes. This enables searching/filtering them with Haiku's fast queries.

+browsing.png +

With every email being in a separate file, viewing them becomes just as easy as browsing through a folder (or query result) of images with ShowImage. Leaving the Tracker window open, you'll see the moving selection of the currently viewed file while you use the previous/next button to move through them.
+As they are independent files, using a viewer other than Haiku's Mail causes no problems whatsoever.

+

Similarly, creating a new message results in just another file that is handed to the mail_daemon that takes care of sending it off. Contact management is deferred to the People application.

+

In a nutshell, where other mail clients do everything, from communicating with the mail servers to providing a view with all your mails and tools to search and filter them, Haiku uses a chain of smaller tools and general file management: +

    +
  • The mail_daemon to fetch/send mail and save them as normal files.

  • +
  • Tracker windows and queries to find and show email files.

  • +
  • The Mail application to view email files and create new messages relying on system-wide contact management by the People app.

  • +
+Especially using Tracker and queries to manage emails is a powerful idea. The experience you gain can be transferred to any other problem that is dealing with files. Be it images, music, video, contacts or any other documents, using Tracker is at the core of all file managing.
+Also, improvements in any of these system areas benefit not just emailing, but all applications that make use of them.

+ +

+index +Using custom statuses

+

When you browse through your newly arrived email, you may want to come back to some of them later to think about it in more depth. While you could use Mail's menu Close and | Leave as New to keep them in your "New messages" query, things tend to pile up that way...

+

One solution is of course to just start a reply and save it as draft. But if you don't expect to write a reply and just want to re-read the mail later, that isn't ideal.

+status.png +

Better use Close and | Set to... to create a new status and use that to categorize your mail. For example, you could call the status "Later", and then query for that when you find more time.
+Or you use different statuses for specific projects. For example, I created a status "HUG" (for "Haiku user guide") under which I collect every mail that may influence the contents of the user guide, like commit messages about code changes that alter or introduce some feature or anything else I feel could improve the user guide.
+In any case, try to keep the status name short. That way it always fits in a normally wide "Status" column in Tracker.

+

You don't have to open an email with the Mail application to set its status. With the Tracker add-ons Mark as Read and Mark as... you can select some email files and set their status in one go.

+ +

+index +Using queries

+

Sure, you specify a folder to store all your email, you can open it et voilà, there's all you mail. But over time the folder becomes crowded and showing all will take longer and longer as thousands of files and their attributes have to be parsed and sorted. Also, most of the time you don't really care about two year old emails of Nigerian princes and their inheritory trouble ...

+
A lot of time when populating a folder is spent on putting files read from disk into the correct sorting order and displaying that in the window. If you do have to open a folder with a huge number of files, you can shorten the wait by making the Tracker window "invisible", i.e. either minimize it or change to another workspace. Watch ProcessController to see how it affects CPU usage.
+

Queries, to the rescue!

+

By using queries, you can narrow down the view of your mails. Actually, the mailbox icon in the Deskbar uses queries.

+daemon-in-deskbar.png +

The Open Draft submenu does a query for the status "Draft", which is set by Mail when you save a message.

+

Open Inbox Folder and Open Mail Folder are just links to regular folders (and not very useful in my opinion).

+

The # new messages submenu is populated by a query for email with the status "New" (that same query is used to change the mailbox icon to show some letters in it, by the way).

+ +

You can add your own queries (and links to folders) in that context menu too, by putting them into ~/config/settings/Mail/Menu Links.

+
The query ~/config/settings/Mail/mailbox is a special case: It is executed when left-clicking the mailbox icon in the Deskbar. If you want to change that behavior, you can replace it with any other file (or link to a file), just name it "mailbox". It doesn't have to be a query, a link to a folder of queries or a script or application works just as well.
+ +

+index +Query examples

+

Here are a few examples of useful queries:

+ + + + + + +
query-1.png
+This finds all mails with the custom status "Later".
query-2.png
+This finds all mails of the past 2 days.
query-3.png
+This finds all mails by Ingo Weinhold of the past 2 weeks.
query-4.png
+This finds all posts from the Haiku commit list of the past 12 hours.
+ +

+index +More tips

+
    +
  • If you don't save a query as "Query" but as "Query template", invoking it won't show the result window, but the Find... window instead. That way you can easily exchange the search string for the subject or sender, for example, or change a "2 days" time limit to "3 days".

  • +
  • Activating "type-ahead filtering" in Tracker's preferences allows you to very quickly filter a query result even further. Often it's enough to query for all mails of the last 3 days and go with type-ahead filtering from there. The big advantage is, that you don't have to exactly specify which attribute to search for, as all displayed are considered when filtering.

  • +
  • RelatedMail is a nifty little application that will query for all mails with the same subject/sender/time-frame etc. of a dropped email. Kind of what the Queries menu in the Mail app is supposed to do.

  • +
+ +
+
+ + + + + From 5ff6f0d491d624f99fce94b0985772fec0d37189 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 9 Aug 2011 17:12:05 +0000 Subject: [PATCH 153/702] Patch by John Scipione : use B_WOULD_BLOCK when locking fails, to avoid returning B_ERROR like when there's an ICU error. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42605 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/locale/Locale.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/kits/locale/Locale.cpp b/src/kits/locale/Locale.cpp index 53edd1a509..2b0208bed0 100644 --- a/src/kits/locale/Locale.cpp +++ b/src/kits/locale/Locale.cpp @@ -113,7 +113,7 @@ BLocale::GetLanguage(BLanguage* language) const BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; *language = fLanguage; @@ -129,7 +129,7 @@ BLocale::GetFormattingConventions(BFormattingConventions* conventions) const BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; *conventions = fConventions; @@ -198,7 +198,7 @@ BLocale::FormatDate(char* string, size_t maxSize, time_t time, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetDateFormat(style, format); @@ -225,7 +225,7 @@ BLocale::FormatDate(BString *string, time_t time, BDateFormatStyle style, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetDateFormat(style, format); @@ -258,7 +258,7 @@ BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetDateFormat(style, format); @@ -305,7 +305,7 @@ BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetDateFormat(style, format); @@ -360,7 +360,7 @@ BLocale::StartOfWeek() const { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; UErrorCode err = U_ZERO_ERROR; Calendar* c = Calendar::createInstance( @@ -384,7 +384,7 @@ BLocale::FormatDateTime(char* target, size_t maxSize, time_t time, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetDateFormat(dateStyle, format); @@ -421,7 +421,7 @@ BLocale::FormatDateTime(BString* target, time_t time, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetDateFormat(dateStyle, format); @@ -464,7 +464,7 @@ BLocale::FormatTime(char* string, size_t maxSize, time_t time, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetTimeFormat(style, format); @@ -491,7 +491,7 @@ BLocale::FormatTime(BString* string, time_t time, BTimeFormatStyle style, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetTimeFormat(style, format); @@ -524,7 +524,7 @@ BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetTimeFormat(style, format); @@ -570,7 +570,7 @@ BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; BString format; fConventions.GetTimeFormat(style, format); @@ -646,7 +646,7 @@ BLocale::FormatNumber(BString* string, double value) const { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; UErrorCode err = U_ZERO_ERROR; ObjectDeleter numberFormatter(NumberFormat::createInstance( @@ -686,7 +686,7 @@ BLocale::FormatNumber(BString* string, int32 value) const { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; UErrorCode err = U_ZERO_ERROR; ObjectDeleter numberFormatter(NumberFormat::createInstance( @@ -729,7 +729,7 @@ BLocale::FormatMonetary(BString* string, double value) const BAutolock lock(fLock); if (!lock.IsLocked()) - return B_ERROR; + return B_WOULD_BLOCK; UErrorCode err = U_ZERO_ERROR; ObjectDeleter numberFormatter( From ca2c99c2ca940f16d97e55d59113b0b19a0d7b5a Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 9 Aug 2011 19:31:46 +0000 Subject: [PATCH 154/702] * Add BIconUtils documentation to the Haiku Book * Remove comments from the header itself. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42606 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/interface/IconUtils.dox | 127 ++++++++++++++++++++++++++++++ headers/os/interface/IconUtils.h | 27 ------- 2 files changed, 127 insertions(+), 27 deletions(-) create mode 100644 docs/user/interface/IconUtils.dox diff --git a/docs/user/interface/IconUtils.dox b/docs/user/interface/IconUtils.dox new file mode 100644 index 0000000000..15d838f70f --- /dev/null +++ b/docs/user/interface/IconUtils.dox @@ -0,0 +1,127 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Documentation by: + * Adrien Destugues + * Corresponds to: + * /trunk/headers/os/interface/IconUtils.h rev 42600 + * /trunk/src/kits/interface/IconUtils.cpp rev 42600 + */ + + +/*! +\file IconUtils.h +\brief Vector icon handling utility class +*/ + + +/*! \class BIconUtils + \ingroup interface + \ingroup libbe + \brief The BIconUtils class provide utility methods for managing and + drawing vector icons. + + Haiku icons are stored in the HVIF (Haiku Vector Icon Format). This format + was designed specifically for this purpose, and allows the icon data to be + small enough to fit in file's inodes. This way, the icon can be displayed + like any other file attribute, without extra disk access. + + This class provide only static methods to allow access to the icon data and + rendering to BBitmaps for later use in an application. It also supports + older icons in bitmap format. These may still be useful at very small + sizes. Note you can't create an instance of BIconUtils, just call the + static methods. +*/ + + +/*! \fn static status_t BIconUtils::GetIcon(BNode* node, + const char* vectorIconAttrName, const char* smallIconAttrName, + const char* largeIconAttrName, icon_size size, BBitmap* result) + \brief Utility function to import an icon from a node. + + Utility function to import an icon from the node that + has either of the provided attribute names. Which icon type + is preferred (vector, small or large B_CMAP8 icon) depends + on the colorspace of the provided bitmap. + + \note If the colorspace is B_CMAP8, B_CMAP8 icons are preferred. In that + case, the bitmap size must also match the provided icon_size "size"! +*/ + + +/*! \fn static status_t BIconUtils::GetVectorIcon(BNode* node, + const char* attrName, BBitmap* result) + \brief Utility function to import a vector icon in "flat icon" format. + + Utility function to import a vector icon in "flat icon" + format from a BNode attribute into the preallocated BBitmap \a result. + The colorspace of result needs to be B_RGBA32 or at + least B_RGB32 (though that makes less sense). The icon + will be scaled from it's "native" size of 64x64 to the + size of the bitmap. + + \note The scale is derived from the bitmap width, the bitmap should have + square dimension, or the icon will be cut off at the bottom (or have + room left). +*/ + + +/*! \fn static status_t BIconUtils::GetVectorIcon(const uint8* buffer, + const char* attrName, BBitmap* result) + \brief Utility function to import a vector icon in "flat icon" format. + + Utility function to import a vector icon in "flat icon" + format from the given \a buffer into the preallocated BBitmap \a result. + The colorspace of result needs to be B_RGBA32 or at + least B_RGB32 (though that makes less sense). The icon + will be scaled from it's "native" size of 64x64 to the + size of the bitmap. + + \note The scale is derived from the bitmap width, the bitmap should have + square dimension, or the icon will be cut off at the bottom (or have + room left). +*/ + + +/*! \fn static status_t BIconUtils::GetCMAP8Icon(BNode* node, + const char* smallIconAttrName, const char* largeIconAttrName, + icon_size size, BBitmap* icon) + \brief Utility function to import an "old" BeOS icon in B_CMAP8 colorspace. + + Utility function to import an "old" BeOS icon in B_CMAP8 colorspace from + either the small icon attribute or the large icon attribute as given in + \a smallIconAttrName and \a largeIconAttrName. Which icon is loaded depends + on the given \a size. +*/ + + +/*! \fn static status_t BIconUtils::ConvertFromCMAP8(BBitmap* source, BBitmap* result) + \brief Converts an old-style icon to another colorspace. + + Utility function to convert from old icon colorspace into colorspace of + BBitmap \a result + + \note result should be in B_RGBA32 colorspace, and source in B_CMAP8. +*/ + + +/*! \fn static status_t BIconUtils::ConvertToCMAP8(BBitmap* source, BBitmap* result) + \brief Converts a true-color icon to CMAP8 colorspace. + + Utility function to convert data from source into \a result colorspace. + Call this to convert a picture to a format suitable for storage as an + old-style icon. + + \note result should be in B_CMAP8 colorspace, and source in B_RGBA32. +*/ + +/*! \fn static status_t BIconUtil::ConvertFromCMAP8(const uint8* data, uint32 width, + uint32 height, uint32 bytesPerRow, BBitmap* result); + \brief Convert raw data in B_CMAP8 colorspace to a B_RGBA32 BBitmap. +*/ + +/*! \fn static status_t BIconUtils::ConvertToCMAP8(const uint8* data, uint32 width, + uint32 height, uint32 bytesPerRow, BBitmap* result); + \brief Convert B_RGBA32 raw data into a B_CMAP8 BBitmap. +*/ diff --git a/headers/os/interface/IconUtils.h b/headers/os/interface/IconUtils.h index fdcfbd946f..cbb3a030f0 100644 --- a/headers/os/interface/IconUtils.h +++ b/headers/os/interface/IconUtils.h @@ -12,9 +12,6 @@ class BBitmap; class BNode; -// This class is a little different from many other classes. -// You don't create an instance of it; you just call its various -// static member functions for utility-like operations. class BIconUtils { BIconUtils(); ~BIconUtils(); @@ -22,47 +19,23 @@ class BIconUtils { BIconUtils& operator=(const BIconUtils&); public: - - // Utility function to import an icon from the node that - // has either of the provided attribute names. Which icon type - // is preferred (vector, small or large B_CMAP8 icon) depends - // on the colorspace of the provided bitmap. If the colorspace - // is B_CMAP8, B_CMAP8 icons are preferred. In that case, the - // bitmap size must also match the provided icon_size "size"! static status_t GetIcon(BNode* node, const char* vectorIconAttrName, const char* smallIconAttrName, const char* largeIconAttrName, icon_size size, BBitmap* result); - // Utility functions to import a vector icon in "flat icon" - // format from a BNode attribute or from a flat buffer in - // memory into the preallocated BBitmap "result". - // The colorspace of result needs to be B_RGBA32 or at - // least B_RGB32 (though that makes less sense). The icon - // will be scaled from it's "native" size of 64x64 to the - // size of the bitmap, the scale is derived from the bitmap - // width, the bitmap should have square dimension, or the - // icon will be cut off at the bottom (or have room left). static status_t GetVectorIcon(BNode* node, const char* attrName, BBitmap* result); static status_t GetVectorIcon(const uint8* buffer, size_t size, BBitmap* result); - // Utility function to import an "old" BeOS icon in B_CMAP8 - // colorspace from either the small icon attribute or the - // large icon attribute as given in "smallIconAttrName" and - // "largeIconAttrName". Which icon is loaded depends on - // the given "size". static status_t GetCMAP8Icon(BNode* node, const char* smallIconAttrName, const char* largeIconAttrName, icon_size size, BBitmap* icon); - // Utility functions to convert from old icon colorspace - // into colorspace of BBitmap "result" (should be B_RGBA32 - // to make any sense). static status_t ConvertFromCMAP8(BBitmap* source, BBitmap* result); static status_t ConvertToCMAP8(BBitmap* source, From 61a02f6d991274728e13858b38732f242eaf129d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 9 Aug 2011 19:39:10 +0000 Subject: [PATCH 155/702] * Add the header file to doxygen, too * Fix copypaste error. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42607 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/Doxyfile | 1 + docs/user/interface/IconUtils.dox | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/user/Doxyfile b/docs/user/Doxyfile index 8e8b4a8e5c..cd2bc99882 100644 --- a/docs/user/Doxyfile +++ b/docs/user/Doxyfile @@ -478,6 +478,7 @@ INPUT = . \ ../../headers/os/interface/Box.h \ ../../headers/os/interface/GridLayout.h \ ../../headers/os/interface/GroupLayout.h \ + ../../headers/os/interface/IconUtils.h \ ../../headers/os/interface/Layout.h \ ../../headers/os/interface/LayoutBuilder.h \ ../../headers/os/interface/LayoutItem.h \ diff --git a/docs/user/interface/IconUtils.dox b/docs/user/interface/IconUtils.dox index 15d838f70f..a561123cee 100644 --- a/docs/user/interface/IconUtils.dox +++ b/docs/user/interface/IconUtils.dox @@ -68,7 +68,7 @@ /*! \fn static status_t BIconUtils::GetVectorIcon(const uint8* buffer, - const char* attrName, BBitmap* result) + size_t size, BBitmap* result) \brief Utility function to import a vector icon in "flat icon" format. Utility function to import a vector icon in "flat icon" From a33f8fbdec035ff322cc1ef364877a3092e99a09 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 9 Aug 2011 21:46:13 +0000 Subject: [PATCH 156/702] Merge work by John Scipione on the Haiku Book. * Some new classes documented * Screenshots for the interface kit controls * A lot of typo fixes * Some css tweaks This has some backporting to the current version of Doxygen, since there are experiments to get coloring similar to the one in the Be Book that will hopefully be upstreamed in Doxygen. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42608 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/Doxyfile | 9 +- docs/user/app/Application.dox | 550 +++++ docs/user/app/Handler.dox | 5 +- docs/user/app/Looper.dox | 17 +- docs/user/app/Message.dox | 548 ++--- docs/user/book.css | 18 + docs/user/book.dox | 2 + docs/user/drivers/USB3.dox | 867 ++++---- docs/user/drivers/fs_interface.dox | 89 +- docs/user/interface/Alert.dox | 389 ++++ docs/user/interface/BAlert_example.png | Bin 0 -> 8972 bytes docs/user/interface/BBox_example.png | Bin 0 -> 3834 bytes docs/user/interface/BBox_with_checkbox.png | Bin 0 -> 9664 bytes docs/user/interface/BButton_example.png | Bin 0 -> 4803 bytes docs/user/interface/B_FANCY_BORDER.png | Bin 0 -> 3476 bytes docs/user/interface/B_PLAIN_BORDER.png | Bin 0 -> 3369 bytes docs/user/interface/Bitmap.dox | 556 +++++ docs/user/interface/Box.dox | 335 +-- docs/user/interface/Button.dox | 456 +++++ docs/user/interface/GridLayout.dox | 115 +- docs/user/interface/GroupLayout.dox | 124 +- docs/user/interface/InterfaceDefs.dox | 65 + docs/user/interface/Layout.dox | 216 +- docs/user/interface/LayoutBuilder.Group.dox | 68 +- docs/user/interface/LayoutBuilder.dox | 12 +- docs/user/interface/LayoutItem.dox | 108 +- docs/user/interface/TwoDimensionalLayout.dox | 93 +- docs/user/locale/Catalog.dox | 375 ++-- docs/user/locale/Collator.dox | 239 ++- docs/user/locale/Country.dox | 111 +- docs/user/locale/Locale.dox | 543 ++++- docs/user/locale/LocaleRoster.dox | 234 ++- docs/user/locale/TimeZone.cpp | 72 - docs/user/locale/TimeZone.dox | 110 + docs/user/locale/UnicodeChar.dox | 244 ++- docs/user/media/Buffer.dox | 113 ++ docs/user/storage/AppFileInfo.dox | 769 +++++++ docs/user/support/Archivable.dox | 71 +- docs/user/support/Beep.dox | 43 +- docs/user/support/List.dox | 8 +- docs/user/support/SupportDefs.dox | 252 ++- docs/user/support/Unarchiver.dox | 218 +- docs/user/support/string.dox | 1921 +++++++++++------- 43 files changed, 7151 insertions(+), 2814 deletions(-) create mode 100644 docs/user/app/Application.dox create mode 100644 docs/user/interface/Alert.dox create mode 100644 docs/user/interface/BAlert_example.png create mode 100644 docs/user/interface/BBox_example.png create mode 100644 docs/user/interface/BBox_with_checkbox.png create mode 100644 docs/user/interface/BButton_example.png create mode 100644 docs/user/interface/B_FANCY_BORDER.png create mode 100644 docs/user/interface/B_PLAIN_BORDER.png create mode 100644 docs/user/interface/Bitmap.dox create mode 100644 docs/user/interface/Button.dox create mode 100644 docs/user/interface/InterfaceDefs.dox delete mode 100644 docs/user/locale/TimeZone.cpp create mode 100644 docs/user/locale/TimeZone.dox create mode 100644 docs/user/media/Buffer.dox create mode 100644 docs/user/storage/AppFileInfo.dox diff --git a/docs/user/Doxyfile b/docs/user/Doxyfile index cd2bc99882..081015ff96 100644 --- a/docs/user/Doxyfile +++ b/docs/user/Doxyfile @@ -177,7 +177,8 @@ TAB_SIZE = 4 # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = +# For keyboard shortcuts and anything related to pressing keys +ALIASES = "key{1}=\1" # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. @@ -475,16 +476,21 @@ INPUT = . \ ../../headers/os/drivers/USB3.h \ ../../headers/os/drivers/USB_spec.h \ ../../headers/os/interface/AbstractLayout.h \ + ../../headers/os/interface/Alert.h \ + ../../headers/os/interface/Button.h \ + ../../headers/os/interface/Bitmap.h \ ../../headers/os/interface/Box.h \ ../../headers/os/interface/GridLayout.h \ ../../headers/os/interface/GroupLayout.h \ ../../headers/os/interface/IconUtils.h \ + ../../headers/os/interface/InterfaceDefs.h \ ../../headers/os/interface/Layout.h \ ../../headers/os/interface/LayoutBuilder.h \ ../../headers/os/interface/LayoutItem.h \ ../../headers/os/interface/TwoDimensionalLayout.h \ ../../headers/os/locale \ ../../headers/os/midi2 \ + ../../headers/os/storage/AppFileInfo.h \ ../../headers/os/support \ ../../headers/posix/syslog.h @@ -565,6 +571,7 @@ EXAMPLE_RECURSIVE = NO # the \image command). IMAGE_PATH = . \ + interface\ midi2 # The INPUT_FILTER tag can be used to specify a program that doxygen should diff --git a/docs/user/app/Application.dox b/docs/user/app/Application.dox new file mode 100644 index 0000000000..c7418b312f --- /dev/null +++ b/docs/user/app/Application.dox @@ -0,0 +1,550 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * /trunk/headers/os/app/Application.h rev 42274 + * /trunk/src/kits/app/Application.cpp rev 42274 + */ + + +/*! + \file Application.h + \brief Provides the BApplication class. +*/ + + +/*! + \class BApplication + \ingroup app + \brief A container object for an application. + + A BApplication establishes a connection between the application and the + Application Server. + + The most common task performed by a BApplication object is to handle + messages sent to it. The BApplication object also is used + to get information about your application such as the number of windows + it has, its signature, executable location, and launch flags. + + The BApplication object is automatically assigned to the global \c be_app + variable. The \c be_app variable allows you to refer to your BApplication + object from anywhere in the code. + + To use a BApplication you first construct the object and then begin its + message loop by calling the Run() method. The Run() method + continues until the application is told to quit. Once Run() returns you + should then delete the BApplication object to free its memory usage. + + Typically, you initialize the BApplication object in the programs main() + function. A typical main() function looks something like this: + + \code +#include Application.h + +main() +{ + /* Vendor is your vendor name, application is your application name */ + BApplication app("application/x-vnd.vendor-application"); + app->Run(); + delete app; + + return 0; +} + \endcode +*/ + + +/*! + \fn BApplication::BApplication(const char *signature) + \brief Initialize a BApplication with the passed in \a signature. + + The new BApplication is, by default, not running yet. If you have + everything set up properly call Run() to start the application. + + You should call InitCheck() to check for constructor initialization + errors. + + \param signature The \a signature of the application. +*/ + + +/*! + \fn BApplication::BApplication(const char *signature, status_t *_error) + \brief Initialize a BApplication with the passed in \a signature and a + pointer to an error message. + + Any error that occurs while constructing the BApplication will be + set to the \a _error pointer. If \a _error points to a \c status_t + error then you should not call Run(). + + Alternately, you can call InitCheck() to check for constructor + initialization errors. + + \param signature The \a signature of the application. + \param _error A pointer to a \c status_t set by the BApplication + constructor. +*/ + +/*! + \fn status_t BApplication::InitCheck() const + \brief Returns the status of the constructor. + + \returns If initialization succeeded returns \c B_OK, otherwise returns an + error status. +*/ + + +/*! + \name Archiving +*/ + + +//! @{ + + +/*! + \fn BApplication::BApplication(BMessage *data) + \brief Initialize a BApplication object from a message. + + The message must contain the signature of the application you wish to + initialize in the "mime_sig" variable. + + \param data The message to initialize the BApplication from. +*/ + + +/*! + \fn status_t BApplication::Archive(BMessage *data, bool deep) const + \brief Archive the BApplication object into a BMessage. + + \sa BArchivable::Archive() +*/ + + +/*! + \fn BArchivable* BApplication::Instantiate(BMessage* data) + \brief Restores the BApplication object from a BMessage. + + \sa BArchivable::Instantiate() +*/ + + +//! @} + + +/*! + \fn BApplication::~BApplication() + \brief Destructor Method +*/ + + +/*! + \name Message Loop Control +*/ + + +//! @{ + + +/*! + \fn thread_id BApplication::Run() + \brief Starts the message loop in the thread that it is called from, + and doesn't return until the message loop stops. Run() does not spawn + a new thread. + + \returns the thread_id of the thread that the BApplication is called from. +*/ + + +/*! + \fn void BApplication::Quit() + \brief Tells the thread to finish processing the message queue, disallowing + any new messages. + + Quit() doesn't kill the looper thread. After Quit() returns, it doesn't wait + for the message queue to empty. Run() will be then able to return. + + Quit() doesn't delete the BApplication object after Run() is called. You + should delete the BApplication object yourself one Run() returns. + However Quit() does delete the object if it's called before the message loop + starts i.e. before Run() is called. +*/ + + +//! @} + + +/*! + \name Hook Methods +*/ + + +//! @{ + + +/*! + \fn bool BApplication::QuitRequested() + \brief Hook method that gets invoked when the BApplication receives a + \c B_QUIT_REQUESTED message. + + BApplication sends a QuitRequested() message to each of its BWindow objects. + If all of the BWindow s return \c true then the windows are + each destroyed (through BWindow::Quit()) and QuitRequested() returns + \c true. If any of the BWindow returns \c false, the BWindow s + are not destroyed and QuitRequested() returns \c false. + + \retval true The application quit. + \retval false The application failed to quit. +*/ + + +/*! + \fn void BApplication::ReadyToRun() + \brief Hook method that's invoked when the BApplication receives a + \c B_READY_TO_RUN message. + + The ReadyToRun() method is automatically called by the Run() method. It is + sent after the initial \c B_REFS_RECEIVED and \c B_ARGV_RECEIVED messages + (if any) have already been handled. ReadyToRun() is the only message that + every running application is guaranteed to receive. + + The default version of ReadyToRun() is empty. You should override the + ReadyToRun() method to do whatever you want to do. If you haven't + constructed any windows in your application yet then this would be a good + place to do so. +*/ + + +/*! + \fn void BApplication::ArgvReceived(int32 argc, char **argv) + \brief Hook method that gets invoked when the application receives a + \c B_ARGV_RECEIVED message. + + If command line arguments are specified when the application is launched + from the the shell, or if \c argv/argc values are passed to + BRoster::Launch(), then this method is executed. + + \warning ArgvReceived() is not called if no command line arguments are + specified, or if BRoster::Launch() was called without any \c argv/argc + values. + + The arguments passed to ArgvReceived() are the constructed in the same way + as those passed to command line programs. The number of command line + arguments is passed in \a argc and the arguments themselves are passed as an + array of strings in \a argv. The first \a argv string is the name of the + program and the rest of the strings are the command line arguments. + + BRoster::Launch() adds the program name to the front of the \a argv array + and increments the \a argc value. + + The \c B_ARGV_RECEIVED message (if sent) is sent only once, just + before the \c B_READY_TO_RUN message is sent. However, if you try to + relaunch an application that is already running and the application is set + to \c B_EXCLUSIVE_LAUNCH or \c B_SINGLE_LAUNCH then the application will + generate a \c B_ARGV_RECEIVED message and send it to the already running + instance. Thus in this case the \c B_ARGV_RECEIVED message can show + up at any time. +*/ + + +/*! + \fn void BApplication::AppActivated(bool active) + \brief Hook method that gets invoked when the application receives + \c B_APP_ACTIVATED message. + + The message is sent whenever the application changes its active application + status. The active flag set to is \c true when the application becomes + active and is set to \c false when the application becomes inactive. + + The application becomes activated in response to a user action such as + clicking on or unhiding one of its windows. The application can have its + active status set programmatically by calling either the BWindow::Activate() + or BRoster::ActivateApp() methods. + + This method is called after ReadyToRun() provided the application is + displaying a window that can be set active. +*/ + + +/*! + \fn void BApplication::RefsReceived(BMessage *message) + \brief Hook method that gets invoked when the application receives a + \c B_REFS_RECEIVED message. + + The message is sent in response to a user action such as a user + drag-and-dropping a file on your app's icon or opening a file that the + application is set to handle. You can use the IsLaunching() method to + discern whether the message arrived when the application is launched or + after the application has already been running. + + The default implementation is empty. You can override this method to do + something with the received refs. Typically you create BEntry or BFile + objects from the passed in refs. + + \param message contains a single field named "be:refs" that contains one or + more entry_ref (\c B_REF_TYPE) items, one for each file sent. +*/ + + +/*! + \fn void BApplication::AboutRequested() + \brief Hook method that gets invoked when the BApplication receives a + \c B_ABOUT_REQUESTED message. + + You should override this method to pop an alert to provide information + about the application. + + The default implementation pops a basic alert dialog. +*/ + + +//! @} + + +/*! + \name Cursor +*/ + + +//! @{ + + +/*! + \fn BApplication::ShowCursor() + \brief Restores the cursor. +*/ + + +/*! + \fn void BApplication::HideCursor() + \brief Hides the cursor from the screen. +*/ + + +/*! + \fn void BApplication::ObscureCursor() + \brief Hides the cursor until the mouse is moved. +*/ + + +/*! + \fn bool BApplication::IsCursorHidden() const + \brief Returns whether or not the cursor is hidden. + + \returns \c true if the cursor is hidden, \c false if not. +*/ + + +/*! + \fn void BApplication::SetCursor(const void *cursor) + \brief Sets the \a cursor to be used when the application is active. + + You can pass one of the pre-defined cursor constants such as + \c B_HAND_CURSOR or \c B_I_BEAM_CURSOR or you can create your own pass + in your own cursor image. The cursor data format is described in the BCursor + class. + + \param cursor The cursor data to set the cursor to. +*/ + + +/*! + \fn void BApplication::SetCursor(const BCursor *cursor, bool sync) + \brief Sets the \a cursor to be used when the application is active + with \a sync immediately option. + + The default BCursors to use are \c B_CURSOR_SYSTEM_DEFAULT for the hand + cursor and \c B_CURSOR_I_BEAM for the I-beam cursor. + + \param cursor A BCursor object to set the \a cursor to. + \param sync synchronize the cursor immediately. +*/ + + +//! @} + + +/*! + \name Info +*/ + + +//! @{ + + +/*! + \fn int32 BApplication::CountWindows() const + \brief Returns the number of windows created by the application. + + \returns the number of windows created by the application. +*/ + + +/*! + \fn BWindow* BApplication::WindowAt(int32 index) const + \brief Returns the BWindow object at the specified index in the + application's window list. + + If index is out of range, this function returns \c NULL. + + \warning Locking the BApplication object doesn't lock the window list. + + \param index The \a index of the desired BWindow. + + \returns The BWindow object at the specified \a index or \c NULL + if the \a index is out of range. +*/ + + +/*! + \fn int32 BApplication::CountLoopers() const + \brief Returns the number of BLoopers created by the application. + + \warning This method may return \c B_ERROR. + + \returns The number of BLoopers in the application. +*/ + + +/*! + \fn BLooper* BApplication::LooperAt(int32 index) const + \brief Returns the BLooper object at the specified index in the + application's looper list. + + If index is out of range, this function returns \c NULL. + + \returns The BLooper object at the specified \a index or \c NULL + if the \a index is out of range. +*/ + + +//! @} + + +/*! + \name Status +*/ + + +//! @{ + + +/*! + \fn bool BApplication::IsLaunching() const + \brief Returns whether or not the application is in the process of + launching. + + \returns \c true if the application is launching, \c false if the + application is already running. +*/ + + +/*! + \fn status_t BApplication::GetAppInfo(app_info *info) const + \brief Fills out the \a info parameter with information about the + application. + + This is equivalent to + be_roster->GetRunningAppInfo(be_app->Team(), info); + + \returns \c B_NO_INIT on an error or \c B_OK if all goes well. + + \sa BRoster::GetAppInfo() +*/ + + +/*! + \fn BResources* BApplication::AppResources() + \brief Returns a BResources object for the application. +*/ + + +//! @} + + +/*! + \name Message Mechanics +*/ + + +//! @{ + + +/*! + \fn void BApplication::MessageReceived(BMessage *message) + \sa BHandler::MessageReceived() +*/ + + +/*! + \fn void BApplication::DispatchMessage(BMessage *message, + BHandler *handler) + \sa BLooper::DispatchMessage() +*/ + + +//! @} + + +/*! + \name Pulse +*/ + + +//! @{ + + +/*! + \fn void BApplication::Pulse() + \brief Hook method that gets invoked when the BApplication receives a + \c B_PULSE message. + + An action is performed each time app_server calls the Pulse() method. + The pulse rate is set by SetPulseRate(). You can implement Pulse() to do + anything you want. The default version does nothing. The pulse granularity + is no better than once per 100,000 microseconds. + + \sa SetPulseRate() +*/ + + +/*! + \fn void BApplication::SetPulseRate(bigtime_t rate) + \brief Sets the interval that the \c B_PULSE messages are sent. + + If the \a rate is set to 0 then the \c B_PULSE messages are not sent. + The pulse rate can be no faster than once per 100,000 microseconds or so. + + \param rate The rate \a B_PULSE messages are sent to the application. +*/ + + +//! @} + + +/*! + \name Scripting +*/ + + +//! @{ + + +/*! + \fn BHandler* BApplication::ResolveSpecifier(BMessage *message, int32 index, + BMessage *specifier, int32 what, const char *property) + \sa BHandler::ResolveSpecifier() +*/ + + +/*! + \fn status_t BApplication::GetSupportedSuites(BMessage *data) + \sa BHandler::GetSupportedSuites() +*/ + + +//! @} diff --git a/docs/user/app/Handler.dox b/docs/user/app/Handler.dox index 0fcf051f32..04ecddb1c9 100644 --- a/docs/user/app/Handler.dox +++ b/docs/user/app/Handler.dox @@ -444,13 +444,14 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn BHandler * BHandler::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property) - \brief Undocumented. + \brief Determine the proper handler for a scripting message. */ /*! \fn status_t BHandler::GetSupportedSuites(BMessage *data) - \brief Undocumented. + \brief Reports the suites of messages and specifiers that derived classes + understand. */ diff --git a/docs/user/app/Looper.dox b/docs/user/app/Looper.dox index 7ef6428398..cfabdee7e4 100644 --- a/docs/user/app/Looper.dox +++ b/docs/user/app/Looper.dox @@ -147,7 +147,7 @@ \warning This constructor does no type check whatsoever. Since you can pass any BMessage, you should - if you are not sure about the exact type - use the Instantiate() method, which does check the type. - + \see Instantiate() \see Archive() */ @@ -710,13 +710,20 @@ /*! \fn BHandler* BLooper::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, int32 form, const char* property) - \brief Undocumented. + \brief Determine the proper handler for a scripting message. + + \see BHandler::ResolveSpecifier() */ /*! \fn status_t BLooper::GetSupportedSuites(BMessage* data) - \brief Undocumented. + \brief Reports the suites of messages and specifiers that derived classes + understand. + + \param data The message to report the suite of messages and specifiers. + + \see BHandler::GetSupportedSuites() */ @@ -799,7 +806,7 @@ /*! \fn BMessage* BLooper::MessageFromPort(bigtime_t timeout) - \brief Hook function to retrieve a message from the looper's port. + \brief Hook method to retrieve a message from the looper's port. The default implementation is called by the internal message looping thread and retrieves the next message from the port that belongs to this looper. @@ -813,5 +820,3 @@ arriving at the default port. */ - - \ No newline at end of file diff --git a/docs/user/app/Message.dox b/docs/user/app/Message.dox index d6b724f7bb..123c743edd 100644 --- a/docs/user/app/Message.dox +++ b/docs/user/app/Message.dox @@ -95,9 +95,9 @@ This class is at the center of the web of messaging classes, in the sense that it defines the actual structure of the messages. Messages have two - important elements: the #what identifer, and the data members. The + important elements: the #what identifier, and the data members. The first can be directly manipulated, the latter can be manipulated through - AddData(), FindData() and ReplaceData() and their deratives. Neither of + AddData(), FindData() and ReplaceData() and their derivatives. Neither of these elements are mandatory. The second important role of BMessage is that it stores meta data: @@ -115,7 +115,7 @@ All methods can be classified in these areas: - Adding, Finding, Replacing and Removing Data. - - Statistics and Miscelanous information. + - Statistics and Miscellaneous information. - Delivery information. - Utilities to reply to messages. @@ -135,7 +135,7 @@ /*! \fn BMessage::BMessage() \brief Construct an empty message, without any data members and with a - \c what constant set to zero (0). + \a what constant set to \c 0. \see BMessage(uint32 what) \see BMessage(const BMessage &other) @@ -144,7 +144,7 @@ /*! \fn BMessage::BMessage(uint32 what) - \brief Construct an empty message with the \c what member set tot the + \brief Construct an empty message with the \a what member set to the specified value. \see BMessage::BMessage() @@ -156,14 +156,14 @@ \fn BMessage::BMessage(const BMessage &other) \brief Construct a new message that is a copy of another message. - The \c what member and the data values are copied. The metadata, such as + The \a what member and the data values are copied. The metadata, such as whether or not the message is a drop message or reply information, is not copied. So if the original message is a reply to a previous message, which will make IsReply() return \c true, calling the same method on a copy of the message will return \c false. \remarks BeOS R5 did keep the metadata of the message. Haiku deviates from - this behaviour. Please use the Haiku implementation of message copying as + this behavior. Please use the Haiku implementation of message copying as the default behavior. This will keep your applications backwards compatible. @@ -185,13 +185,13 @@ \fn BMessage &BMessage::operator=(const BMessage &other) \brief Copy one message into another. - See the copy constructor, BMessage(const BMessage &other), for details on what is - copied, and what isn't. + See the copy constructor, BMessage(const BMessage &other), for details on + what is copied, and what isn't. */ /*! - \name Statistics and Miscelanous Information + \name Statistics and Miscellaneous Information */ @@ -212,21 +212,21 @@ in a pointer to the internal name buffer in the message. This means that you should not manipulate this name. If you are not interested in the name, you can safely pass \c NULL. - \param[out] typeFound The type of the item at \a index. If you are not - interested in the type (because you specifically asked for a type), you - can safely pass NULL. - \param[out] countFound The number of items at \a index. If data items have - the same name, they will be placed under the same index. + \param[out] typeFound The type of the item at \a index. If you are + not interested in the type (because you specifically asked for a type), + you can safely pass \c NULL. + \param[out] countFound The number of items at \a index. If data + items have the same name, they will be placed under the same index. - \return If the \a index is found, and matches the requested type, the - other parameters will be filled in. If this is not the case, the method - will return with an error. + \return If the \a index is found, and matches the requested type, + then the other parameters will be filled in. If this is not the case, + the method will return with an error. \retval B_OK An match was found. The values have been filled in. - \retval B_BAD_INDEX The \a index was out of range. None of the passed - variables have been altered. - \retval B_BAD_TYPE The data field at \a index does not have the requested - type. + \retval B_BAD_INDEX The \a index was out of range. None of the + passed variables have been altered. + \retval B_BAD_TYPE The data field at \a index does not have the + requested type. */ @@ -244,9 +244,9 @@ label will be in this parameter. In case you are not interested, you can safely pass \c NULL. - \return If the message has data associated with the given \a name, the - other parameters will contain information associated with the data. - Else, the method will return with an error. + \return If the message has data associated with the given \a name, + the other parameters will contain information associated with the data, + else, the method will return with an error. \retval B_OK A match was found. The other parameters have been filled in. \retval B_BAD_VALUE You passed \c NULL as argument to \a name. @@ -260,9 +260,10 @@ \brief Retrieve the type and whether or not the size of the data is fixed associated with a \a name. - This method is the same as GetInfo(const char *,type_code *, int32 *) const , with the difference that you can find out whether or - not the size of the data associated with the \a name is fixed. You will - get this value in the variable you passed as \a fixedSize parameter. + This method is the same as GetInfo(const char *,type_code *, int32 *) const, + with the difference that you can find out whether or not the size of the + data associated with the \a name is fixed. You will get this value + in the variable you passed as \a fixedSize parameter. */ @@ -277,7 +278,7 @@ method will return the total number of data items. \return The number of data items in this message with the specified - \a type, or zero in case no items match the type. + \a type, or \c 0 in case no items match the type. */ @@ -328,8 +329,8 @@ \param newEntry The new name of the data entry. \retval B_OK Renaming succeeded. - \retval B_BAD_VALUE Either the \a oldEntry or the \a newEntry pointers are - \c NULL. + \retval B_BAD_VALUE Either the \a oldEntry or the + \a newEntry pointers are \c NULL. \retval B_NAME_NOT_FOUND There is no data associated with the label \a oldEntry. */ @@ -477,9 +478,9 @@ This method sends a reply to this message to the sender. On your turn, you specify a messenger that handles a reply back to the message you - specify as the \a reply argument. You can set a timeout for the message - to be delivered. This method blocks until the message has been received, - or the \a timeout has been reached. + specify as the \a reply argument. You can set a timeout for the + message to be delivered. This method blocks until the message has been + received, or the \a timeout has been reached. \param reply The message that is in reply to this message. \param replyTo In case the receiver needs to reply to the message you are @@ -492,8 +493,9 @@ \retval B_OK The message has been delivered. \retval B_DUPLICATE_REPLY There already has been a reply to this message. \retval B_BAD_PORT_ID The reply address is not valid (anymore). - \retval B_WOULD_BLOCK The delivery \a timeout was \c B_INFINITE_TIMEOUT - (zero) and the target port was full when trying to deliver the message. + \retval B_WOULD_BLOCK The delivery \a timeout was + \c B_INFINITE_TIMEOUT (\c 0) and the target port was full when trying + to deliver the message. \retval B_TIMED_OUT The timeout expired while trying to deliver the message. \see SendReply(uint32 command, BHandler *replyTo) @@ -517,12 +519,13 @@ \brief Synchronously send a reply to this message, and wait for a reply back. - This method sends a reply to this message to the sender. The \a reply is - delivered, and then the method waits for a reply from the receiver. If a - reply is received, that reply is copied into the \a replyToReply argument. + This method sends a reply to this message to the sender. The + \a reply is delivered, and then the method waits for a reply from + the receiver. If a reply is received, that reply is copied into the + \a replyToReply argument. If the message was delivered properly, but the receiver did not reply - within the specified \a replyTimeout, the \c what member of \a replyToReply - will be set to \c B_NO_REPLY. + within the specified \a replyTimeout, the \a what member of + \a replyToReply will be set to \c B_NO_REPLY. \param reply The message that is in reply to this message. \param[out] replyToReply The reply is copied into this argument. @@ -535,10 +538,12 @@ \retval B_OK The message has been delivered. \retval B_DUPLICATE_REPLY There already has been a reply to this message. - \retval B_BAD_VALUE Either \a reply or \a replyToReply is \c NULL. + \retval B_BAD_VALUE Either \a reply or \a replyToReply is + \c NULL. \retval B_BAD_PORT_ID The reply address is not valid (anymore). - \retval B_WOULD_BLOCK The delivery \a timeout was \c B_INFINITE_TIMEOUT - (zero) and the target port was full when trying to deliver the message. + \retval B_WOULD_BLOCK The delivery \a timeout was + \c B_INFINITE_TIMEOUT (\c 0) and the target port was full when trying + to deliver the message. \retval B_TIMED_OUT The timeout expired while trying to deliver the message. \retval B_NO_MORE_PORTS All reply ports are in use. @@ -721,20 +726,23 @@ const void *data, ssize_t numBytes, bool isFixedSize, int32 count) \brief Add \a data of a certain \a type to the message. - The amount of \a numBytes is copied into the message. The data is stored - at the label specified in \a name. You are responsible for specifying the - correct \a type. The Haiku API already specifies many constants, such as - B_FLOAT_TYPE or B_RECT_TYPE. See TypeConstants.h for more information on - the system-wide defined types. + The amount of \a numBytes is copied into the message. The data is + stored at the label specified in \a name. You are responsible for + specifying the correct \a type. The Haiku API already specifies + many constants, such as \c B_FLOAT_TYPE or \c B_RECT_TYPE. See + TypeConstants.h for more information on the system-wide defined types. - If the field with the \a name already exists, the data is added in an - array-like form. If you are adding a certain \a name for the first time, - you are able to specify some properties of this array. You can fix the size - of each data entry, and you can also instruct BMessage to allocate a - \a count of items. The latter does not mean that the number of items is - fixed; the array will grow nonetheless. Also, note that every \a name can - only be associated with one \a type of data. If consecutive method calls - specify a different \a type than the initial, these calls will fail. + If the field with the \a name already exists, the data is added in + an array-like form. If you are adding a certain \a name for the + first time, you are able to specify some properties of this array. You can + fix the size of each data entry, and you can also instruct BMessage to + allocate a \a count of items. The latter does not mean that the + number of items is fixed; the array will grow nonetheless. Also, note that + every \a name can only be associated with one \a type of + data. + + If consecutive method calls specify a different \a type than the + initial, these calls will fail. There is no limit to the number of labels, or the amount of data, but note that searching of data members is linear, as well as that some @@ -742,31 +750,32 @@ data you need to pass is too big, find another way to pass it. \param name The label to which this data needs to be associated. If the - \a name already exists, the new data will be added in an array-like - style. - \param type The type of data. If you are adding data to the same \a name, - make sure it is the same type. + \a name already exists, the new data will be added in an + array-like style. + \param type The type of data. If you are adding data to the same + \a name, make sure it is the same type. \param data The data buffer to copy the bytes from. \param numBytes The number of bytes to be copied. If this is the first call - to this method for this type of data, and you set \a isFixedSize to - \c true, this will specify the size of all consecutive calls to this + to this method for this type of data, and you set + \a isFixedSize to \c true, this will specify the size of all + consecutive calls to this method. \param isFixedSize If this is the first call to this method with this - \a name, you can specify the whether or not all items in this array - should have the same fixed size. + \a name, you can specify the whether or not all items in this + array should have the same fixed size. \param count If this is the first call to this method with this - \a name, you can instruct this message to allocate a number of items in - advance. This does not limit the amount of items though. The array will - grow if needed. + \a name, you can instruct this message to allocate a number of + items in advance. This does not limit the amount of items though. The + array will grow if needed. \retval B_OK The \a data is succesfully added. - \retval B_BAD_VALUE The \a numBytes is less than, or equal to zero (0), or - the size of this item is larger than the \a name allows, since it has - been specified to have a fixed size. + \retval B_BAD_VALUE The \a numBytes is less than, or equal to \c 0, + or the size of this item is larger than the \a name allows, + since it has been specified to have a fixed size. \retval B_ERROR There was an error whilst creating the label with your \a name. - \retval B_BAD_TYPE The \a type you specified is different than the one - already associated with \a name. + \retval B_BAD_TYPE The \a type you specified is different than the + one already associated with \a name. */ @@ -959,7 +968,8 @@ /*! \fn status_t BMessage::AddRef(const char *name, const entry_ref *ref) - \brief Convenience method to add an \c entry_ref to the label \a name. + \brief Convenience method to add an \c entry_ref to the label + \a name. This method calls AddData() with the \c B_REF_TYPE \a type. @@ -992,9 +1002,9 @@ This method uses BFlattenable::TypeCode() to determine the type. It also uses BFlattenable::IsFixedSize() to determine whether or not the size of - the object is supposedly always the same. You can specify a \a count, to - pre-allocate more entries if you are going to add more than one of this - type. + the object is supposedly always the same. You can specify a + \a count, to pre-allocate more entries if you are going to add + more than one of this type. \param name The label to associate the data with. \param object The object to flatten into the message. @@ -1019,7 +1029,8 @@ /*! \fn status_t BMessage::RemoveData(const char *name, int32 index) - \brief Remove data associated with \a name at a specified \a index. + \brief Remove data associated with \a name at a specified + \a index. If this is the only instance of the data, then the entire label will be removed. This means you can recreate it with another type. @@ -1027,10 +1038,10 @@ \param name The \a name of which the associated data should be cleared. \param index The \a index of the item that should be cleared. \retval B_OK The data has been removed. - \retval B_BAD_VALUE The \a index is less than zero (0). + \retval B_BAD_VALUE The \a index is less than \c 0. \retval B_BAD_INDEX The \a index is out of bounds. - \retval B_NAME_NOT_FOUND The \a name does not hava any data associated with - it. + \retval B_NAME_NOT_FOUND The \a name does not hava any data + associated with it. \see RemoveName() \see MakeEmpty() */ @@ -1043,7 +1054,8 @@ This also removes the label, so that you can recreate it with another type, if you want to. - \param name The \a name that refers to the data you want to clear out. + \param name The \a name that refers to the data you want to clear + out. \retval B_OK All the data is removed. \retval B_BAD_VALUE The \a name pointer points to \c NULL. \retval B_NAME_NOT_FOUND The \a name does not exist in this message. @@ -1059,7 +1071,7 @@ Everything is cleared out, all labels and all associated data, as well as metadata such as reply info. - \return This method always returns B_OK. + \return This method always returns \c B_OK. \see RemoveData() \see RemoveName() */ @@ -1079,7 +1091,7 @@ - +
Type of dataType codeMethod
BRectB_RECT_TYPEFindRect()
BRect\c B_RECT_TYPEFindRect()
*/ @@ -1090,12 +1102,14 @@ /*! \fn status_t BMessage::FindData(const char *name, type_code type, int32 index, const void **data, ssize_t *numBytes) const - \brief Find \a data that is stored in this message at an \a index. + \brief Find \a data that is stored in this message at an + \a index. - This method matches the label \a name with the \a type you are asking for, - and it looks for the data that is stored at a certain \a index number. If - all these things match, you will get a pointer to the internal buffer, and - the method will put the size of the item in \a numBytes. + This method matches the label \a name with the \a type you + are asking for, and it looks for the data that is stored at a certain + \a index number. If all these things match, you will get a pointer + to the internal buffer, and the method will put the size of the item in + \a numBytes. Note that only this method, and FindString(const char *, const char **), pass a pointer to the internal buffer. The other more specific methods, @@ -1110,8 +1124,8 @@ Note that the array is zero-based. \param[out] data A pointer to a pointer where the data can point to. \param[out] numBytes The size of the data will be put in this parameter. - \retval B_OK The \a name was found, matches the type, and the data at - \a index has been put in \a data. + \retval B_OK The \a name was found, matches the type, and the data + at \a index has been put in \a data. \retval B_BAD_VALUE One of the output arguments were \c NULL. \retval B_BAD_INDEX The \a index does not exist. \retval B_NAME_NOT_FOUND There is no field with this \a name. @@ -1125,8 +1139,9 @@ const void **data, ssize_t *numBytes) const \brief Find \a data that is stored in this message. - This is an overloaded method of FindData(const char *, type_code, int32, - const void **, ssize_t *) const, where data is sought at \a index 0. + This is an overloaded method of + FindData(const char *, type_code, int32, const void **, ssize_t *) const + where data is sought at \a index \c 0. */ @@ -1134,8 +1149,9 @@ \fn status_t BMessage::FindRect(const char *name, BRect *rect) const \brief Find a rectangle at the label \a name. - This is an overloaded method of FindRect(const char *, int32, BRect *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindRect(const char *, int32, BRect *) const + where the data is sought at \a index \c 0. */ @@ -1143,7 +1159,7 @@ \fn status_t BMessage::FindRect(const char *name, int32 index, BRect *rect) const \brief Find a rectangle at the label \a name at an \a index. - This method looks for the data with the \a B_RECT_TYPE, and copies it into + This method looks for the data with the \c B_RECT_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1160,8 +1176,9 @@ \fn status_t BMessage::FindPoint(const char *name, BPoint *point) const \brief Find a point at the label \a name. - This is an overloaded method of FindPoint(const char *, int32, BPoint *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindPoint(const char *, int32, BPoint *) const + where the data is sought at \a index \c 0. */ @@ -1169,7 +1186,7 @@ \fn status_t BMessage::FindPoint(const char *name, int32 index, BPoint *point) const \brief Find a point at the label \a name at an \a index. - This method looks for the data with the \a B_POINT_TYPE, and copies it into + This method looks for the data with the \c B_POINT_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1186,8 +1203,9 @@ \fn status_t BMessage::FindString(const char *name, const char **string) const \brief Find a string at the label \a name. - This is an overloaded method of FindString(const char *, int32, const char **) const - where the data is sought at \a index zero. + This is an overloaded method of + FindString(const char *, int32, const char **) const + where the data is sought at \a index \c 0. */ @@ -1196,7 +1214,7 @@ const char ** string) const \brief Find a string at the label \a name at an \a index. - This method looks for the data with the \a B_STRING_TYPE, and returns a + This method looks for the data with the \c B_STRING_TYPE, and returns a pointer to the internal buffer of the message. Note that this pointer is valid, until the message is deleted. @@ -1215,17 +1233,17 @@ \fn status_t BMessage::FindString(const char *name, BString *string) const \brief Find a string at the label \a name. - This is an overloaded method of FindString(const char *, int32, BString *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindString(const char *, int32, BString *) const + where the data is sought at \a index \c 0. */ /*! - \fn status_t BMessage::FindString(const char *name, int32 index, - BString *string) const + \fn status_t BMessage::FindString(const char *name, int32 index, BString *string) const \brief Find a string at the label \a name at an \a index. - This method looks for the data with the \a B_STRING_TYPE, and copies it + This method looks for the data with the \c B_STRING_TYPE, and copies it into the \a string object. \param name The label to which the data is associated. @@ -1244,7 +1262,7 @@ \brief Find an integer at the label \a name. This is an overloaded method of FindInt8(const char *, int32, int8 *) const - where the data is sought at \a index zero. + where the data is sought at \a index \c 0. */ @@ -1252,7 +1270,7 @@ \fn status_t BMessage::FindInt8(const char *name, int32 index, int8 *value) const \brief Find an integer at the label \a name at an \a index. - This method looks for the data with the \a B_INT8_TYPE, and copies it into + This method looks for the data with the \c B_INT8_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1270,7 +1288,7 @@ \brief Find an integer at the label \a name. This is an overloaded method of FindInt8(const char *, int32, int16 *) const - where the data is sought at \a index zero. + where the data is sought at \a index \c 0. */ @@ -1278,7 +1296,7 @@ \fn status_t BMessage::FindInt16(const char *name, int32 index, int16 *value) const \brief Find an integer at the label \a name at an \a index. - This method looks for the data with the \a B_INT16_TYPE, and copies it into + This method looks for the data with the \c B_INT16_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1295,8 +1313,9 @@ \fn status_t BMessage::FindInt32(const char *name, int32 *value) const \brief Find an integer at the label \a name. - This is an overloaded method of FindInt32(const char *, int32, int32 *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindInt32(const char *, int32, int32 *) const + where the data is sought at \a index \c 0. */ @@ -1304,7 +1323,7 @@ \fn status_t BMessage::FindInt32(const char *name, int32 index, int32 *value) const \brief Find an integer at the label \a name at an \a index. - This method looks for the data with the \a B_INT32_TYPE, and copies it into + This method looks for the data with the \c B_INT32_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1321,8 +1340,9 @@ \fn status_t BMessage::FindInt64(const char *name, int64 *value) const \brief Find an integer at the label \a name. - This is an overloaded method of FindInt64(const char *, int32, int64 *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindInt64(const char *, int32, int64 *) const + where the data is sought at \a index \c 0. */ @@ -1330,7 +1350,7 @@ \fn status_t BMessage::FindInt64(const char *name, int32 index, int64 *value) const \brief Find an integer at the label \a name at an \a index. - This method looks for the data with the \a B_INT64_TYPE, and copies it into + This method looks for the data with the \c B_INT64_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1347,8 +1367,9 @@ \fn status_t BMessage::FindBool(const char *name, bool *value) const \brief Find a boolean at the label \a name. - This is an overloaded method of FindBool(const char *, int32, bool *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindBool(const char *, int32, bool *) const + where the data is sought at \a index \c 0. */ @@ -1356,7 +1377,7 @@ \fn status_t BMessage::FindBool(const char *name, int32 index, bool *value) const \brief Find a boolean at the label \a name at an \a index. - This method looks for the data with the \a B_BOOL_TYPE, and copies it into + This method looks for the data with the \c B_BOOL_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1373,8 +1394,9 @@ \fn status_t BMessage::FindFloat(const char *name, float *value) const \brief Find a float at the label \a name. - This is an overloaded method of FindFloat(const char *, int32, float *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindFloat(const char *, int32, float *) const + where the data is sought at \a index \c 0. */ @@ -1382,7 +1404,7 @@ \fn status_t BMessage::FindFloat(const char *name, int32 index, float *value) const \brief Find a float at the label \a name at an \a index. - This method looks for the data with the \a B_FLOAT_TYPE, and copies it into + This method looks for the data with the \c B_FLOAT_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1399,8 +1421,9 @@ \fn status_t BMessage::FindDouble(const char *name, double *value) const \brief Find a double at the label \a name. - This is an overloaded method of FindDouble(const char *, int32, double *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindDouble(const char *, int32, double *) const + where the data is sought at \a index \c 0. */ @@ -1408,7 +1431,7 @@ \fn status_t BMessage::FindDouble(const char *name, int32 index, double *value) const \brief Find a double at the label \a name at an \a index. - This method looks for the data with the \a B_DOUBLE_TYPE, and copies it into + This method looks for the data with the \c B_DOUBLE_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1425,16 +1448,17 @@ \fn status_t BMessage::FindPointer(const char *name, void **pointer) const \brief Find a pointer at the label \a name. - This is an overloaded method of FindPointer(const char *, int32, void *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindPointer(const char *, int32, void *) const + where the data is sought at \a index \c 0. */ /*! - \fn status_t BMessage::FindPointer(const char *name, int32 index, void **pointer) const + \fn status_t BMessage::FindPointer(const char *name, int32 index, void **pointer) const \brief Find a pointer at the label \a name at an \a index. - This method looks for the data with the \a B_POINTER_TYPE, and copies it into + This method looks for the data with the \c B_POINTER_TYPE, and copies it into a provided buffer. \warning If you want to share objects between applications, please remember @@ -1457,18 +1481,18 @@ \fn status_t BMessage::FindMessenger(const char *name, BMessenger *messenger) const \brief Find a messenger at the label \a name. - This is an overloaded method of FindMessenger(const char *, int32, BMessenger *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindMessenger(const char *, int32, BMessenger *) const + where the data is sought at \a index \c 0. */ /*! - \fn status_t BMessage::FindMessenger(const char *name, int32 index, - BMessenger *messenger) const + \fn status_t BMessage::FindMessenger(const char *name, int32 index, BMessenger *messenger) const \brief Find a messenger at the label \a name at an \a index. - This method looks for the data with the \a B_MESSENGER_TYPE, and copies it into - a provided buffer. + This method looks for the data with the \c B_MESSENGER_TYPE, and copies it + into a provided buffer. \param name The label to which the data is associated. \param index The index from which the data should be copied. @@ -1484,16 +1508,18 @@ \fn status_t BMessage::FindRef(const char *name, entry_ref *ref) const \brief Find a reference to a file at the label \a name. - This is an overloaded method of FindRef(const char *, int32, entry_ref *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindRef(const char *, int32, entry_ref *) const + where the data is sought at \a index \c 0. */ /*! \fn status_t BMessage::FindRef(const char *name, int32 index, entry_ref *ref) const - \brief Find a reference to a file at the label \a name at an \a index. + \brief Find a reference to a file at the label \a name at an + \a index. - This method looks for the data with the \a B_REF_TYPE, and copies it into + This method looks for the data with the \c B_REF_TYPE, and copies it into a provided buffer. \param name The label to which the data is associated. @@ -1510,18 +1536,18 @@ \fn status_t BMessage::FindMessage(const char *name, BMessage *message) const \brief Find a message at the label \a name. - This is an overloaded method of FindMessage(const char *, int32, BMessage *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindMessage(const char *, int32, BMessage *) const + where the data is sought at \a index \c 0. */ /*! - \fn status_t BMessage::FindMessage(const char *name, int32 index, - BMessage *message) const + \fn status_t BMessage::FindMessage(const char *name, int32 index, BMessage *message) const \brief Find a message at the label \a name at an \a index. - This method looks for the data with the \a B_MESSAGE_TYPE, and copies it into - a provided buffer. + This method looks for the data with the \c B_MESSAGE_TYPE, and copies it + into a provided buffer. \param name The label to which the data is associated. \param index The index from which the data should be copied. @@ -1537,15 +1563,17 @@ \fn status_t BMessage::FindFlat(const char *name, BFlattenable *object) const \brief Find a flattened object at the label \a name. - This is an overloaded method of FindFlat(const char *, int32, BFlattenable *) const - where the data is sought at \a index zero. + This is an overloaded method of + FindFlat(const char *, int32, BFlattenable *) const + where the data is sought at \a index \c 0. */ /*! \fn status_t BMessage::FindFlat(const char *name, int32 index, BFlattenable *object) const - \brief Find a flattened object at the label \a name at an \a index. + \brief Find a flattened object at the label \a name at an + \a index. The type is determined by the type of the passed object. If that type is available at the specified label, then the Unflatten() method of that @@ -1579,18 +1607,21 @@ const void *data, ssize_t numBytes) \brief Replace the data at label \a name. - This method is an overloaded method that replaces the data at \a index - zero. See ReplaceData(const char *, type_code, int32, const void *, ssize_t). + This method is an overloaded method that replaces the data at + \a index \c 0. See + ReplaceData(const char *, type_code, int32, const void *, ssize_t). */ /*! \fn status_t BMessage::ReplaceData(const char *name, type_code type, int32 index, const void *data, ssize_t numBytes) - \brief Replace the data at label \a name at a specified \a index. + \brief Replace the data at label \a name at a specified + \a index. - The conditions for replacing data are that the \a name is correct, the - \a type matches and the data entry at \a index exists. + The conditions for replacing data are that the\a name is correct, + the \a type matches and the data entry at \a index + exists. There is also a collection of convenience methods, that allow you to efficiently replace rectanges (ReplaceRect()), booleans (ReplaceBool()), @@ -1615,17 +1646,19 @@ \fn status_t BMessage::ReplaceRect(const char *name, BRect aRect) \brief Replace a rectangle at the label \a name. - This method is an overloaded method of ReplaceRect(const char *, int32, BRect). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceRect(const char *, int32, BRect). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceRect(const char *name, int32 index, BRect aRect) - \brief Replace a rectangle at the label \a name at a specified \a index. + \brief Replace a rectangle at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_RECT_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_RECT_TYPE. \param name The name associated with the data to replace. \param index The index in the array to replace. \param aRect The object to store in the message. @@ -1639,17 +1672,19 @@ \fn status_t BMessage::ReplacePoint(const char *name, BPoint aPoint) \brief Replace a point at the label \a name. - This method is an overloaded method of ReplacePoint(const char *, int32, BPoint). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplacePoint(const char *, int32, BPoint). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplacePoint(const char *name, int32 index, BPoint aPoint) - \brief Replace a point at the label \a name at a specified \a index. + \brief Replace a point at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_POINT_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_POINT_TYPE. \param name The name associated with the data to replace. \param index The index in the array to replace. \param aPoint The object to store in the message. @@ -1663,17 +1698,19 @@ \fn status_t BMessage::ReplaceString(const char *name, const char *aString) \brief Replace a string at the label \a name. - This method is an overloaded method of ReplaceString(const char *, int32, const char *). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceString(const char *, int32, const char *). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceString(const char *name, int32 index, const char *aString) - \brief Replace a string at the label \a name at a specified \a index. + \brief Replace a string at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_STRING_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_STRING_TYPE. \param name The name associated with the data to replace. \param index The index in the array to replace. \param aString The object to store in the message. @@ -1687,17 +1724,19 @@ \fn status_t BMessage::ReplaceString(const char *name, const BString &aString) \brief Replace a string at the label \a name. - This method is an overloaded method of ReplaceString(const char *, int32, BString &). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceString(const char *, int32, BString &). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceString(const char *name, int32 index, const BString &aString) - \brief Replace a string at the label \a name at a specified \a index. + \brief Replace a string at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_STRING_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_STRING_TYPE. \param name The name associated with the data to replace. \param index The index in the array to replace. \param aString The object to store in the message. @@ -1711,17 +1750,19 @@ \fn status_t BMessage::ReplaceInt8(const char *name, int8 value) \brief Replace an integer at the label \a name. - This method is an overloaded method of ReplaceInt8(const char *, int32, int8). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceInt8(const char *, int32, int8). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceInt8(const char *name, int32 index, int8 value) - \brief Replace an integer at the label \a name at a specified \a index. + \brief Replace an integer at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_INT8_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_INT8_TYPE. \param name The name associated with the data to replace. \param index The index in the array to replace. \param value The object to store in the message. @@ -1735,17 +1776,19 @@ \fn status_t BMessage::ReplaceInt16(const char *name, int16 value) \brief Replace an integer at the label \a name. - This method is an overloaded method of ReplaceInt16(const char *, int32, int16). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceInt16(const char *, int32, int16). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceInt16(const char *name, int32 index, int16 value) - \brief Replace an integer at the label \a name at a specified \a index. + \brief Replace an integer at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_INT16_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_INT16_TYPE. \param name The name associated with the data to replace. \param index The index in the array to replace. \param value The object to store in the message. @@ -1759,17 +1802,19 @@ \fn status_t BMessage::ReplaceInt32(const char *name, int32 value) \brief Replace an integer at the label \a name. - This method is an overloaded method of ReplaceInt8(const char *, int32, int32). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceInt8(const char *, int32, int32). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceInt32(const char *name, int32 index, int32 value) - \brief Replace an integer at the label \a name at a specified \a index. + \brief Replace an integer at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_INT32_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_INT32_TYPE. \param name The name associated with the data to replace. \param index The index in the array to replace. \param value The object to store in the message. @@ -1783,17 +1828,19 @@ \fn status_t BMessage::ReplaceInt64(const char *name, int64 value) \brief Replace an integer at the label \a name. - This method is an overloaded method of ReplaceInt8(const char *, int32, int64). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceInt8(const char *, int32, int64). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceInt64(const char *name, int32 index, int64 value) - \brief Replace an integer at the label \a name at a specified \a index. + \brief Replace an integer at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_INT64_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_INT64_TYPE. \param name The name associated with the data to replace. \param index The index in the array to replace. \param value The object to store in the message. @@ -1807,17 +1854,20 @@ \fn status_t BMessage::ReplaceBool(const char *name, bool aBoolean) \brief Replace a boolean at the label \a name. - This method is an overloaded method of ReplaceBool(const char *, int32, bool). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceBool(const char *, int32, bool). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceBool(const char *name, int32 index, bool aBoolean) - \brief Replace a boolean at the label \a name at a specified \a index. + \brief Replace a boolean at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_BOOL_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_BOOL_TYPE. + \param name The name associated with the data to replace. \param index The index in the array to replace. \param aBoolean The object to store in the message. @@ -1831,17 +1881,20 @@ \fn status_t BMessage::ReplaceFloat(const char *name, float aFloat) \brief Replace a float at the label \a name. - This method is an overloaded method of ReplaceFloat(const char *, int32, float). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceFloat(const char *, int32, float). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceFloat(const char *name, int32 index, float aFloat) - \brief Replace a float at the label \a name at a specified \a index. + \brief Replace a float at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_FLOAT_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_FLOAT_TYPE. + \param name The name associated with the data to replace. \param index The index in the array to replace. \param aFloat The object to store in the message. @@ -1855,17 +1908,20 @@ \fn status_t BMessage::ReplaceDouble(const char *name, double aDouble) \brief Replace a double at the label \a name. - This method is an overloaded method of ReplaceDouble(const char *, int32, double). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceDouble(const char *, int32, double). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceDouble(const char *name, int32 index, double aDouble) - \brief Replace a double at the label \a name at a specified \a index. + \brief Replace a double at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_DOUBLE_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_DOUBLE_TYPE. + \param name The name associated with the data to replace. \param index The index in the array to replace. \param aDouble The object to store in the message. @@ -1879,17 +1935,19 @@ \fn status_t BMessage::ReplacePointer(const char *name, const void *pointer) \brief Replace a pointer at the label \a name. - This method is an overloaded method of ReplacePointer(const char *, int32, const void *). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplacePointer(const char *, int32, const void *). + It replaces the data at \a index \c 0. */ /*! - \fn status_t BMessage::ReplacePointer(const char *name,int32 index,const void *pointer) + \fn status_t BMessage::ReplacePointer(const char *name,int32 index, const void *pointer) \brief Replace a pointer at the label \a name at a specified \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_POINTER_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_POINTER_TYPE. + \param name The name associated with the data to replace. \param index The index in the array to replace. \param pointer The object to store in the message. @@ -1903,17 +1961,20 @@ \fn status_t BMessage::ReplaceMessenger(const char *name, BMessenger messenger) \brief Replace a messenger at the label \a name. - This method is an overloaded method of ReplaceMessenger(const char *, int32, BMessenger). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceMessenger(const char *, int32, BMessenger). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceMessenger(const char *name, int32 index, BMessenger messenger) - \brief Replace a messenger at the label \a name at a specified \a index. + \brief Replace a messenger at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_MESSENGER_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_MESSENGER_TYPE. + \param name The name associated with the data to replace. \param index The index in the array to replace. \param messenger The object to store in the message. @@ -1927,18 +1988,20 @@ \fn status_t BMessage::ReplaceRef(const char *name,const entry_ref *ref) \brief Replace a reference to a file at the label \a name. - This method is an overloaded method of ReplaceRef(const char *, int32, entry_ref *). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceRef(const char *, int32, entry_ref *). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceRef( const char *name, int32 index, const entry_ref *ref) - \brief Replace a reference to a file at the label \a name at a specified - \a index. + \brief Replace a reference to a file at the label \a name at a + specified \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_REF_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_REF_TYPE. + \param name The name associated with the data to replace. \param index The index in the array to replace. \param ref The object to store in the message. @@ -1952,17 +2015,20 @@ \fn status_t BMessage::ReplaceMessage(const char *name, const BMessage *message) \brief Replace a message at the label \a name. - This method is an overloaded method of ReplaceMessage(const char *, int32, BMessage *). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceMessage(const char *, int32, BMessage *). + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceMessage(const char *name, int32 index, const BMessage *message) - \brief Replace a message at the label \a name at a specified \a index. + \brief Replace a message at the label \a name at a specified + \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the \c B_MESSAGE_TYPE. + The data at the specified \a name and \a index will be + replaced, if it matches the \c B_MESSAGE_TYPE. + \param name The name associated with the data to replace. \param index The index in the array to replace. \param message The object to store in the message. @@ -1976,25 +2042,29 @@ \fn status_t BMessage::ReplaceFlat(const char *name, BFlattenable *object) \brief Replace a flattened object at the label \a name. - This method is an overloaded method of ReplaceFlat(const char *, int32, BFlattenable *). - It replaces the data at \a index zero. + This method is an overloaded method of + ReplaceFlat(const char *, int32, BFlattenable *). + + It replaces the data at \a index \c 0. */ /*! \fn status_t BMessage::ReplaceFlat(const char *name, int32 index, BFlattenable *object) - \brief Replace a flattened object at the label \a name at a specified - \a index. + \brief Replace a flattened object at the label \a name at a + specified \a index. - The data at the specified \a name and \a index will be replaced, if it - matches the type returned by your object. This method uses + The data at the specified \a name and \a index will be + replaced, if it matches the type returned by your object. This method uses BFlattenable::TypeCode() to determine the type of the object. \param name The name associated with the data to replace. \param index The index in the array to replace. \param object The object to store in the message. + \retval B_OK The operation succeeded. \retval B_BAD_INDEX The index was out of range. + \see ReplaceFlat(const char*, BFlattenable *) */ @@ -2005,9 +2075,9 @@ /*! \name Deprecated methods - These methods are very likely to disappear, and they have been - replaced by safer and more powerful methods. These methods are still - implemented for binary compatibility, but they are not documented. + These methods are \e very likely to disappear, and they have been replaced + by safer and more powerful methods. These methods are still implemented + for binary compatibility, but they are not documented. */ diff --git a/docs/user/book.css b/docs/user/book.css index 0ef01740a7..42c2079a55 100644 --- a/docs/user/book.css +++ b/docs/user/book.css @@ -186,6 +186,24 @@ div.contents { background: #ffeae6 url(images/alert_stop_32.png) 15px 15px no-repeat; } + +/* For keyboard shortcuts and the like (also from userguide) */ + +div.contents span.keycap { + -webkit-border-radius: 3px; + -khtml-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + border-color: #c7c7c7; + border-style: solid; + border-width: 1px; + padding: 0px 2px 0px 2px; + background-color: #e8e8e8; + font-family: serif; + font-variant: small-caps; +} + + /* Continue with the rest of the standard Doxygen stuff... */ CAPTION { font-weight: bold } diff --git a/docs/user/book.dox b/docs/user/book.dox index cb23cc1697..d5d392e3ad 100644 --- a/docs/user/book.dox +++ b/docs/user/book.dox @@ -7,8 +7,10 @@ - \ref drivers - \ref interface | \link interface_intro \em Introduction \endlink - \ref locale | \link locale_intro \em Introduction \endlink + - \ref media | \link media_intro \em Introduction \endlink - \ref midi1 - \ref midi2 | \link midi2_intro \em Introduction \endlink + - \ref storage | \link storage_intro \em Introduction \endlink - \ref support | \link support_intro \em Introduction \endlink \section notes General Notes and Information diff --git a/docs/user/drivers/USB3.dox b/docs/user/drivers/USB3.dox index 4f1f0e3d4e..b617a7de48 100644 --- a/docs/user/drivers/USB3.dox +++ b/docs/user/drivers/USB3.dox @@ -9,218 +9,218 @@ */ /*! - \file USB3.h - \ingroup drivers - \brief Interface for the USB module. + \file USB3.h + \ingroup drivers + \brief Interface for the USB module. */ /*! - \typedef struct usb_module_info usb_module_info - \brief The main interface object. See the usb_module_info documentation. + \typedef struct usb_module_info usb_module_info + \brief The main interface object. See the usb_module_info documentation. */ /*! - \typedef uint32 usb_id - \brief Uniquely identify various USB objects that are used in the module. + \typedef uint32 usb_id + \brief Uniquely identify various USB objects that are used in the module. */ /*! - \typedef usb_id usb_device - \brief Uniquely identify USB devices. + \typedef usb_id usb_device + \brief Uniquely identify USB devices. */ /*! - \typedef usb_id usb_interface - \brief Uniquely identify USB interfaces. + \typedef usb_id usb_interface + \brief Uniquely identify USB interfaces. */ /*! - \typedef usb_id usb_pipe - \brief Uniquely identify USB pipes. + \typedef usb_id usb_pipe + \brief Uniquely identify USB pipes. */ /*! - \typedef struct usb_endpoint_info usb_endpoint_info - \brief Container for USB endpoint descriptors. - \see Documentation for usb_endpoint_info. + \typedef struct usb_endpoint_info usb_endpoint_info + \brief Container for USB endpoint descriptors. + \see Documentation for usb_endpoint_info. */ /*! - \typedef struct usb_interface_info usb_interface_info - \brief Container for USB interface descriptors. - \see Documentation for usb_interface_info. + \typedef struct usb_interface_info usb_interface_info + \brief Container for USB interface descriptors. + \see Documentation for usb_interface_info. */ /*! - \typedef struct usb_interface_list usb_interface_list - \brief Container that holds a list of USB interface descriptors. - \see Documentation for usb_interface_list. + \typedef struct usb_interface_list usb_interface_list + \brief Container that holds a list of USB interface descriptors. + \see Documentation for usb_interface_list. */ /*! - \typedef struct usb_configuration_info usb_configuration_info - \brief Container for USB configuration descriptors. - \see Documentation for usb_configuration_info. + \typedef struct usb_configuration_info usb_configuration_info + \brief Container for USB configuration descriptors. + \see Documentation for usb_configuration_info. */ ///// usb_notify_hooks ///// /*! - \struct usb_notify_hooks - \brief Hooks that the USB stack can callback in case of events. + \struct usb_notify_hooks + \brief Hooks that the USB stack can callback in case of events. */ /*! - \fn status_t (*usb_notify_hooks::device_added)(usb_device device, void **cookie) - \brief Called by the stack in case a device is added. - - Once you have registered hooks using the - usb_module_info::install_notify() method, this hook will be called as soon as - a device is inserted that matches your provided usb_support_descriptor. - - \param device A unique id that identifies this USB device. - \param[in] cookie You can store a pointer to an object in this variable. - When the device is removed, this cookie will be provided to you. - \return You should return \c B_OK in case of success. The USB stack will then - request the kernel to republish your device names so that the new device - will be shown in the \c /dev tree. If you return an error value, the - \a device id will become invalid and you will not be notified if this - device is removed. - \see device_removed() + \fn status_t (*usb_notify_hooks::device_added)(usb_device device, void **cookie) + \brief Called by the stack in case a device is added. + + Once you have registered hooks using the + usb_module_info::install_notify() method, this hook will be called as soon as + a device is inserted that matches your provided usb_support_descriptor. + + \param device A unique id that identifies this USB device. + \param[in] cookie You can store a pointer to an object in this variable. + When the device is removed, this cookie will be provided to you. + \return You should return \c B_OK in case of success. The USB stack will then + request the kernel to republish your device names so that the new device + will be shown in the \c /dev tree. If you return an error value, the + \a device id will become invalid and you will not be notified if this + device is removed. + \see device_removed() */ /*! - \var status_t (*usb_notify_hooks::device_removed)(void *cookie) - \brief Called by the stack in case a device you are using is removed. - - If you have accepted a device in the device_added() hook, this hook will - be called as soon as the device is removed. - - \param cookie The cookie you provided in the device_added() hook. Make sure - that you free the cookie if necessary. - \return Currently the return value of this hook is ignored. It is recommended - to return \c B_OK though. + \var status_t (*usb_notify_hooks::device_removed)(void *cookie) + \brief Called by the stack in case a device you are using is removed. + + If you have accepted a device in the device_added() hook, this hook will + be called as soon as the device is removed. + + \param cookie The cookie you provided in the device_added() hook. Make sure + that you free the cookie if necessary. + \return Currently the return value of this hook is ignored. It is recommended + to return \c B_OK though. */ - + ///// usb_support_descriptor ///// - + /*! - \struct usb_support_descriptor - \brief Description of device descriptor that the driver can handle. - - Support descriptors can be used to match any form of class, subclass or - protocol, or they can be used to match a vendor and/or product. - If any field has the value \c 0, it is treated as a wildcard. - - For example, if you want to watch for all the hubs, which have a device - class of \c 0x09, you would pass this descriptor: - - \code - usb_support_descriptor hub_devs = { 9, 0, 0, 0, 0 }; - \endcode - - See usb_module_info::register_driver() for more information on how to use - this object. + \struct usb_support_descriptor + \brief Description of device descriptor that the driver can handle. + + Support descriptors can be used to match any form of class, subclass or + protocol, or they can be used to match a vendor and/or product. + If any field has the value \c 0, it is treated as a wildcard. + + For example, if you want to watch for all the hubs, which have a device + class of \c 0x09, you would pass this descriptor: + + \code + usb_support_descriptor hub_devs = { 9, 0, 0, 0, 0 }; + \endcode + + See usb_module_info::register_driver() for more information on how to use + this object. */ - + /*! - \var usb_support_descriptor::dev_class - \brief The supported device classes. + \var usb_support_descriptor::dev_class + \brief The supported device classes. */ /*! - \var usb_support_descriptor::dev_subclass - \brief The supported device subclasses. + \var usb_support_descriptor::dev_subclass + \brief The supported device subclasses. */ /*! - \var usb_support_descriptor::dev_protocol - \brief The supported device protocols. + \var usb_support_descriptor::dev_protocol + \brief The supported device protocols. */ /*! - \var usb_support_descriptor::vendor - \brief The supported device vendor. + \var usb_support_descriptor::vendor + \brief The supported device vendor. */ /*! - \var usb_support_descriptor::product - \brief The supported device products. + \var usb_support_descriptor::product + \brief The supported device products. */ ///// usb_endpoint_info ///// /*! - \struct usb_endpoint_info - \brief Container for endpoint descriptors and their Haiku USB stack - identifiers. + \struct usb_endpoint_info + \brief Container for endpoint descriptors and their Haiku USB stack + identifiers. */ /*! - \var usb_endpoint_descriptor *usb_endpoint_info::descr - \brief Pointer to the descriptor of the endpoint. + \var usb_endpoint_descriptor *usb_endpoint_info::descr + \brief Pointer to the descriptor of the endpoint. */ /*! - \var usb_pipe usb_endpoint_info::handle - \brief Handle to use when using the stack to transfer data to and from this - endpoint. + \var usb_pipe usb_endpoint_info::handle + \brief Handle to use when using the stack to transfer data to and from this + endpoint. */ ///// usb_interface_info ///// /*! - \struct usb_interface_info - \brief Container for interface descriptors and their Haiku USB stack - identifiers. + \struct usb_interface_info + \brief Container for interface descriptors and their Haiku USB stack + identifiers. */ //! @{ /*! - \var usb_interface_descriptor *usb_interface_info::descr - \brief Pointer to the descriptor of the interface. + \var usb_interface_descriptor *usb_interface_info::descr + \brief Pointer to the descriptor of the interface. */ /*! - \var usb_interface usb_interface_info::handle - \brief Handle to use when using the stack to manipulate this interface. + \var usb_interface usb_interface_info::handle + \brief Handle to use when using the stack to manipulate this interface. */ //! @} /*! - \name Endpoints + \name Endpoints */ //! @{ /*! - \var size_t usb_interface_info::endpoint_count - \brief The number of endpoints in this interface. + \var size_t usb_interface_info::endpoint_count + \brief The number of endpoints in this interface. */ /*! - \var usb_endpoint_info *usb_interface_info::endpoint - \brief An array of endpoints that are associated to this interface. + \var usb_endpoint_info *usb_interface_info::endpoint + \brief An array of endpoints that are associated to this interface. */ //! @} /*! - \name Unparsed descriptors + \name Unparsed descriptors */ //! @{ /*! - \var size_t usb_interface_info::generic_count - \brief The number of unparsed descriptors in this interface. + \var size_t usb_interface_info::generic_count + \brief The number of unparsed descriptors in this interface. */ /*! - \var usb_descriptor **usb_interface_info::generic - \brief Unparsed descriptors in this interface. + \var usb_descriptor **usb_interface_info::generic + \brief Unparsed descriptors in this interface. */ //! @} @@ -228,444 +228,447 @@ ///// usb_interface_list ///// /*! - \struct usb_interface_list - \brief List of interfaces available to a configuration. + \struct usb_interface_list + \brief List of interfaces available to a configuration. */ /*! - \var size_t usb_interface_list::alt_count - \brief Number of available interfaces. + \var size_t usb_interface_list::alt_count + \brief Number of available interfaces. */ /*! - \var usb_interface_info *usb_interface_list::alt - \brief Array of available interfaces. + \var usb_interface_info *usb_interface_list::alt + \brief Array of available interfaces. */ /*! - \var usb_interface_info *usb_interface_list::active - \brief Pointer to active interface. + \var usb_interface_info *usb_interface_list::active + \brief Pointer to active interface. */ ///// usb_configuration_info ///// /*! - \struct usb_configuration_info - \brief Container for a specific configuration descriptor of a device. + \struct usb_configuration_info + \brief Container for a specific configuration descriptor of a device. */ /*! - \var usb_configuration_descriptor *usb_configuration_info::descr - \brief The configuration descriptor. + \var usb_configuration_descriptor *usb_configuration_info::descr + \brief The configuration descriptor. */ /*! - \var size_t usb_configuration_info::interface_count - \brief The number of interfaces in this configuration. + \var size_t usb_configuration_info::interface_count + \brief The number of interfaces in this configuration. */ /*! - \var usb_interface_list *usb_configuration_info::interface - \brief The list of interfaces available to this configuration. + \var usb_interface_list *usb_configuration_info::interface + \brief The list of interfaces available to this configuration. */ ///// usb_iso_packet_descriptor ///// /*! - \struct usb_iso_packet_descriptor - \brief The descriptor for data packets of isochronous transfers. + \struct usb_iso_packet_descriptor + \brief The descriptor for data packets of isochronous transfers. */ /*! - \var int16 usb_iso_packet_descriptor::req_len - \brief Length of the request. + \var int16 usb_iso_packet_descriptor::request_length + \brief Length of the request. */ /*! - \var int16 usb_iso_packet_descriptor::act_len - \brief The USB stack writes the actual transferred length in this variable. + \var int16 usb_iso_packet_descriptor::actual_length + \brief The USB stack writes the actual transferred length in this variable. */ /*! - \var status_t usb_iso_packet_descriptor::status - \brief The status of the transfer. + \var status_t usb_iso_packet_descriptor::status + \brief The status of the transfer. */ - + ///// usb_callback_func ///// /*! - \typedef typedef void (*usb_callback_func)(void *cookie, status_t status, void *data, size_t actualLength) - \brief Callback function for asynchronous transfers. - - \param cookie The cookie you supplied when you queued the transfer. - \param status The status of the transfer. This is one of the following: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
B_OKThe transfer succeeded.
B_CANCELEDThe transfer was cancelled by the user - via a usb_module_info::cancel_queued_transfers() call.
B_DEV_MULTIPLE_ERRORSMore than one of the errors - below occurred. Unfortunately, the stack cannot give you more - information.
B_DEV_STALLEDThe endpoint is stalled. You can use - usb_module_info::clear_feature() method with the associated pipe and - the USB_FEATURE_ENDPOINT_HALT arguments.
B_DEV_DATA_OVERRUNIncoming transfer: more data - flowing in than the size of the buffer.
B_DEV_DATA_UNDERRUNOutgoing transfer: more data - is flowing out than the endpoint accepts.
B_DEV_CRC_ERRORThe internal data consistency - checks of the USB protocol failed. It is best to retry. If you keep - on getting this error there might be something wrong with the - device.
B_DEV_UNEXPECTED_PIDThere was an internal error. - You should retry your transfer.
B_DEV_FIFO_OVERRUNinternal error. - You should retry your transfer.
B_DEV_FIFO_UNDERRUNThere was an internal error. - You should retry your transfer.
- \param data The provided buffer. - \param actualLength The amount of bytes read or written during the transfer. + \typedef typedef void (*usb_callback_func)(void *cookie, status_t status, void *data, size_t actualLength) + \brief Callback function for asynchronous transfers. + \param cookie The cookie you supplied when you queued the transfer. + \param status The status of the transfer. This is one of the following: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
B_OKThe transfer succeeded.
B_CANCELEDThe transfer was cancelled by the user + via a usb_module_info::cancel_queued_transfers() call.
B_DEV_MULTIPLE_ERRORSMore than one of the errors + below occurred. Unfortunately, the stack cannot give you more + information.
B_DEV_STALLEDThe endpoint is stalled. You can + use usb_module_info::clear_feature() method with the associated pipe + and the USB_FEATURE_ENDPOINT_HALT arguments.
B_DEV_DATA_OVERRUNIncoming transfer: more data + flowing in than the size of the buffer.
B_DEV_DATA_UNDERRUNOutgoing transfer: more data + is flowing out than the endpoint accepts.
B_DEV_CRC_ERRORThe internal data consistency + checks of the USB protocol failed. It is best to retry. If you keep + on getting this error there might be something wrong with the + device.
B_DEV_UNEXPECTED_PIDThere was an internal error. + You should retry your transfer.
B_DEV_FIFO_OVERRUNinternal error. + You should retry your transfer.
B_DEV_FIFO_UNDERRUNThere was an internal error. + You should retry your transfer.
+ \param data The provided buffer. + \param actualLength The amount of bytes read or written during the transfer. */ ///// usb_module_info ///// /*! - \struct usb_module_info - \brief Interface for drivers to interact with Haiku's USB stack. + \struct usb_module_info + \brief Interface for drivers to interact with Haiku's USB stack. */ /*! - \var usb_module_info::binfo - \brief Instance of the bus_manager_info object. + \var usb_module_info::binfo + \brief Instance of the bus_manager_info object. */ /*! - \fn status_t (*usb_module_info::register_driver)(const char *driverName, const usb_support_descriptor *supportDescriptors, size_t supportDescriptorCount, const char *optionalRepublishDriverName) - \brief Register your driver. - - To let the USB stack know that a driver is available to support devices, a - driver needs to register itself first. To let the stack know about devices - it needs to notify the driver of, have a look at usb_support_descriptor. - - It is possible to supply a list of support constructors. You should allocate - an array of support constructors and give the amount of constructors in the - array using the \a supportDescriptorCount parameter. - - In case your driver supports all devices or, more likely, you want to - monitor all devices plugged in and removed, it is safe to pass \c NULL to the - \a supportDescriptors paramater and zero (0) to \a supportDescriptorCount. - - \param driverName A unique name that identifies your driver. Avoid names like - \c webcam or \c mouse, instead use vendor names and device types to avoid - nameclashes. The install_notify() and uninstall_notify() functions use the - driver name as an identifier. - \param supportDescriptors An array of the type usb_support_descriptor. Pass - the amount of objects in the next parameter. - \param supportDescriptorCount The number of objects in the array supplied in - the previous parameter. - \param optionalRepublishDriverName Unused parameter. You should pass \c NULL. - \retval B_OK The driver is registered. You can now call install_notify() - \retval B_BAD_VALUE You passed \c NULL as \a driverName. - \retval B_ERROR General internal error in the USB stack. You may retry the - request in this case. - \retval B_NO_MEMORY Error allocating some internal objects. The system is - out of memory. + \fn status_t (*usb_module_info::register_driver)(const char *driverName, const usb_support_descriptor *supportDescriptors, size_t supportDescriptorCount, const char *optionalRepublishDriverName) + \brief Register your driver. + + To let the USB stack know that a driver is available to support devices, a + driver needs to register itself first. To let the stack know about devices + it needs to notify the driver of, have a look at usb_support_descriptor. + + It is possible to supply a list of support constructors. You should allocate + an array of support constructors and give the amount of constructors in the + array using the \a supportDescriptorCount parameter. + + In case your driver supports all devices or, more likely, you want to + monitor all devices plugged in and removed, it is safe to pass \c NULL to + the \a supportDescriptors paramater and zero (0) to + \a supportDescriptorCount. + + \param driverName A unique name that identifies your driver. Avoid names + like \c webcam or \c mouse, instead use vendor names and device types to + avoid nameclashes. The install_notify() and uninstall_notify() functions use + the driver name as an identifier. + + \param supportDescriptors An array of the type usb_support_descriptor. Pass + the amount of objects in the next parameter. + \param supportDescriptorCount The number of objects in the array supplied in + the previous parameter. + \param optionalRepublishDriverName Unused parameter. You should pass + \c NULL. + + \retval B_OK The driver is registered. You can now call install_notify() + \retval B_BAD_VALUE You passed \c NULL as \a driverName. + \retval B_ERROR General internal error in the USB stack. You may retry the + request in this case. + \retval B_NO_MEMORY Error allocating some internal objects. The system is + out of memory. */ /*! - \fn status_t (*usb_module_info::install_notify)(const char *driverName, const usb_notify_hooks *hooks) - \brief Install notify hooks for your driver. - - After your driver is registered, you need to pass hooks to your driver that - are called whenever a device that matches your \link usb_support_descriptor - support descriptor \endlink . - - As soon as the hooks are installed, you'll receive callbacks for devices that - are already attached; so make sure your driver is initialized properly when - calling this method. - - \param driverName The name you passed in register_driver(). - \param hooks The hooks the stack should call in case the status of devices - that match your support descriptor changes. - \retval B_OK Hooks are installed succesfully. - \retval B_NAME_NOT_FOUND Invalid \a driverName. - - \see usb_notify_hooks for information on how your hooks should behave. - \see uninstall_notify() + \fn status_t (*usb_module_info::install_notify)(const char *driverName, const usb_notify_hooks *hooks) + \brief Install notify hooks for your driver. + + After your driver is registered, you need to pass hooks to your driver that + are called whenever a device that matches your \link usb_support_descriptor + support descriptor \endlink . + + As soon as the hooks are installed, you'll receive callbacks for devices + that are already attached; so make sure your driver is initialized properly + when calling this method. + + \param driverName The name you passed in register_driver(). + \param hooks The hooks the stack should call in case the status of devices + that match your support descriptor changes. + + \retval B_OK Hooks are installed succesfully. + \retval B_NAME_NOT_FOUND Invalid \a driverName. + + \see usb_notify_hooks for information on how your hooks should behave. + \see uninstall_notify() */ /*! - \fn status_t (*usb_module_info::uninstall_notify)(const char *driverName) - \brief Uninstall notify hooks for your driver. - - If your driver needs to stop, you can uninstall the notifier hooks. This will - clear the stored hooks in the driver, and you will not receive any - notifications when new devices are attached. This method will also call - usb_notify_hooks::device_removed() for all the devices that you are using and - all the stack's resources that are allocated to your driver are cleared. - - \param driverName The name you passed in register_driver(). - \retval B_OK Hooks are uninstalled. - \retval B_NAME_NOT_FOUND Invalid \a driverName. + \fn status_t (*usb_module_info::uninstall_notify)(const char *driverName) + \brief Uninstall notify hooks for your driver. + + If your driver needs to stop, you can uninstall the notifier hooks. This + will clear the stored hooks in the driver, and you will not receive any + notifications when new devices are attached. This method will also call + usb_notify_hooks::device_removed() for all the devices that you are using + and all the stack's resources that are allocated to your driver are + cleared. + + \param driverName The name you passed in register_driver(). + \retval B_OK Hooks are uninstalled. + \retval B_NAME_NOT_FOUND Invalid \a driverName. */ /*! - \fn const usb_device_descriptor *(*usb_module_info::get_device_descriptor)(usb_device device) - \brief Get the device descriptor. - - \param device The id of the device you want to query. - \return The standard usb_device_descriptor, or \c NULL in case of an error. + \fn const usb_device_descriptor *(*usb_module_info::get_device_descriptor)(usb_device device) + \brief Get the device descriptor. + + \param device The id of the device you want to query. + \return The standard usb_device_descriptor, or \c NULL in case of an error. */ /*! - \fn const usb_configuration_info *(*usb_module_info::get_nth_configuration)(usb_device device, uint index) - \brief Get a configuration descriptor by index. - - \param device The id of the device you want to query. - \param index The (zero based) offset of the list of configurations. - \return This will normally return the usb_configuration_info with the - standard usb configuration descriptor. \c NULL will be returned if the - \a id is invalid or the \a index is out of bounds. + \fn const usb_configuration_info *(*usb_module_info::get_nth_configuration)(usb_device device, uint index) + \brief Get a configuration descriptor by index. + + \param device The id of the device you want to query. + \param index The (zero based) offset of the list of configurations. + \return This will normally return the usb_configuration_info with the + standard usb configuration descriptor. \c NULL will be returned if the + \a id is invalid or the \a index is out of bounds. */ /*! - \fn const usb_configuration_info *(*usb_module_info::get_configuration)(usb_device device) - \brief Get the current configuration. - - \param id The id of the device you want to query. - \retval This will return usb_configuration_info with the standard usb - configuration descriptor, or it will return\c NULL if the \a id is invalid. + \fn const usb_configuration_info *(*usb_module_info::get_configuration)(usb_device device) + \brief Get the current configuration. + + \param id The id of the device you want to query. + \retval This will return usb_configuration_info with the standard usb + configuration descriptor, or it will return\c NULL if the \a id is invalid. */ /*! - \fn status_t (*usb_module_info::set_configuration)(usb_device device, const usb_configuration_info *configuration) - \brief Change the current configuration. - - Changing the configuration will destroy all the current endpoints. If the - \a configuration points to the current configuration, the request will be - ignored and \c B_OK will be returned. - - \param device The id of the device you want to query. - \param configuration The pointer to the new configuration you want to set. - \retval B_OK The new configuration is set succesfully. - \retval B_DEV_INVALID_PIPE The \a device parameter is invalid. - \retval B_BAD_VALUE The configuration does not exist. - - \note This method also allows you to completely unconfigure the device, which - means that all the current endpoints, pipes and transfers will be freed. - Pass \c NULL to the parameter \a configuration if you want to do that. + \fn status_t (*usb_module_info::set_configuration)(usb_device device, const usb_configuration_info *configuration) + \brief Change the current configuration. + + Changing the configuration will destroy all the current endpoints. If the + \a configuration points to the current configuration, the request will be + ignored and \c B_OK will be returned. + + \param device The id of the device you want to query. + \param configuration The pointer to the new configuration you want to set. + \retval B_OK The new configuration is set succesfully. + \retval B_DEV_INVALID_PIPE The \a device parameter is invalid. + \retval B_BAD_VALUE The configuration does not exist. + + \note This method also allows you to completely unconfigure the device, which + means that all the current endpoints, pipes and transfers will be freed. + Pass \c NULL to the parameter \a configuration if you want to do that. */ /*! - \fn status_t (*usb_module_info::set_alt_interface)(usb_device device, const usb_interface_info *interface) - \brief Set an alternative interface. Not implemented. - - This method currently always returns \c B_ERROR. + \fn status_t (*usb_module_info::set_alt_interface)(usb_device device, const usb_interface_info *interface) + \brief Set an alternative interface. Not implemented. + + This method currently always returns \c B_ERROR. */ /*! - \fn status_t (*usb_module_info::set_feature)(usb_id handle, uint16 selector) - \brief Convenience function for standard control pipe set feature requests. - - Both the set_feature() and clear_feature() requests work on all the Stack's - objects: devices, interfaces and pipes. - - \param handle The object you want to query. - \param selector The value you want to pass in the feature request. - \return \c B_OK in case the request succeeded and the device responded - positively, or an error code in case it failed. + \fn status_t (*usb_module_info::set_feature)(usb_id handle, uint16 selector) + \brief Convenience function for standard control pipe set feature requests. + Both the set_feature() and clear_feature() requests work on all the Stack's + objects: devices, interfaces and pipes. + + \param handle The object you want to query. + \param selector The value you want to pass in the feature request. + \return \c B_OK in case the request succeeded and the device responded + positively, or an error code in case it failed. */ /*! - \fn status_t (*usb_module_info::clear_feature)(usb_id handle, uint16 selector) - \brief Convenience function for standard control pipe clear feature requests. - - \see set_feature() to see how this method works. + \fn status_t (*usb_module_info::clear_feature)(usb_id handle, uint16 selector) + \brief Convenience function for standard control pipe clear feature requests. + + \see set_feature() to see how this method works. */ /*! - \fn status_t (*usb_module_info::get_status)(usb_id handle, uint16 *status) - \brief Convenience function for standard usb status requests. - - \param[in] handle The object you want to query. - \param[out] status A variable in which the device can store it's status. - \return \c B_OK is returned in case the request succeeded and the device - responded positively, or an error code is returned in case it failed. + \fn status_t (*usb_module_info::get_status)(usb_id handle, uint16 *status) + \brief Convenience function for standard usb status requests. + + \param[in] handle The object you want to query. + \param[out] status A variable in which the device can store it's status. + \return \c B_OK is returned in case the request succeeded and the device + responded positively, or an error code is returned in case it failed. */ - + /*! - \fn status_t (*usb_module_info::get_descriptor)(usb_device device, uint8 descriptorType, uint8 index, uint16 languageID, void *data, size_t dataLength, size_t *actualLength) - \brief Convenience function to get a descriptor from a device. - - \param[in] device The device you want to query. - \param[in] descriptorType The type of descriptor you are requesting. - \param[in] index In case there are multiple descriptors of this type, you - select which one you want. - \param[in] languageID The language you want the descriptor in (if applicable, - as with string_descriptors). - \param[out] data The buffer in which the descriptor can be written. - \param[in] dataLength The size of the buffer (in bytes). - \param[out] actualLength A pointer to a variable in which the actual number - of bytes written can be stored. - \retval B_OK The request succeeded, and the descriptor is written. - \retval B_DEV_INVALID_PIPE Invalid \a device parameter. - \retval "other errors" Request failed. + \fn status_t (*usb_module_info::get_descriptor)(usb_device device, uint8 descriptorType, uint8 index, uint16 languageID, void *data, size_t dataLength, size_t *actualLength) + \brief Convenience function to get a descriptor from a device. + + \param[in] device The device you want to query. + \param[in] descriptorType The type of descriptor you are requesting. + \param[in] index In case there are multiple descriptors of this type, you + select which one you want. + \param[in] languageID The language you want the descriptor in (if applicable, + as with string_descriptors). + \param[out] data The buffer in which the descriptor can be written. + \param[in] dataLength The size of the buffer (in bytes). + \param[out] actualLength A pointer to a variable in which the actual number + of bytes written can be stored. + \retval B_OK The request succeeded, and the descriptor is written. + \retval B_DEV_INVALID_PIPE Invalid \a device parameter. + \retval "other errors" Request failed. */ - + /*! - \fn status_t (*usb_module_info::send_request)(usb_device device, uint8 requestType, uint8 request, uint16 value, uint16 index, uint16 length, void *data, size_t *actualLength) - \brief Send a generic, synchronous request over the default control pipe. - - See queue_request() for an asynchronous version of this method. - - Most of the standard values of a request are defined in USB_spec.h. - - \param[in] device The device you want to query. - \param[in] requestType The request type. - \param[in] request The request you want to perform. - \param[in] value The value of the request. - \param[in] index The index for the request. - \param[in] length The size of the buffer pointed by \a data - \param[out] data The buffer where to put the result in. - \param[out] actualLength The actual numbers of bytes written. - - \retval B_OK The request succeeded. - \retval B_DEV_INVALID_PIPE Invalid \a device parameter. - \retval "other errors" Request failed. + \fn status_t (*usb_module_info::send_request)(usb_device device, uint8 requestType, uint8 request, uint16 value, uint16 index, uint16 length, void *data, size_t *actualLength) + \brief Send a generic, synchronous request over the default control pipe. + + See queue_request() for an asynchronous version of this method. + + Most of the standard values of a request are defined in USB_spec.h. + + \param[in] device The device you want to query. + \param[in] requestType The request type. + \param[in] request The request you want to perform. + \param[in] value The value of the request. + \param[in] index The index for the request. + \param[in] length The size of the buffer pointed by \a data + \param[out] data The buffer where to put the result in. + \param[out] actualLength The actual numbers of bytes written. + + \retval B_OK The request succeeded. + \retval B_DEV_INVALID_PIPE Invalid \a device parameter. + \retval "other errors" Request failed. */ /*! - \fn status_t (*usb_module_info::queue_interrupt)(usb_pipe pipe, void *data, size_t dataLength, usb_callback_func callback, void *callbackCookie) - \brief Asynchronously queue an interrupt transfer. - - \param pipe The id of the pipe you want to query. - \param data The data buffer you want to pass. - \param dataLength The size of the data buffer. - \param callback The callback function the stack should call after finishing. - \param callbackCookie A cookie that will be supplied to your callback - function when the transfer is finished. - - \return This will return a value indicating whether or not the queueing of - the transfer went well. The return value won't tell you if the transfer - actually succeeded. - \retval B_OK The interrupt transfer is queued. - \retval B_NO_MEMORY Error allocating objects. - \retval B_DEV_INVALID_PIPE The \a pipe is not a valid interrupt pipe. + \fn status_t (*usb_module_info::queue_interrupt)(usb_pipe pipe, void *data, size_t dataLength, usb_callback_func callback, void *callbackCookie) + \brief Asynchronously queue an interrupt transfer. + + \param pipe The id of the pipe you want to query. + \param data The data buffer you want to pass. + \param dataLength The size of the data buffer. + \param callback The callback function the stack should call after finishing. + \param callbackCookie A cookie that will be supplied to your callback + function when the transfer is finished. + + \return This will return a value indicating whether or not the queueing of + the transfer went well. The return value won't tell you if the transfer + actually succeeded. + \retval B_OK The interrupt transfer is queued. + \retval B_NO_MEMORY Error allocating objects. + \retval B_DEV_INVALID_PIPE The \a pipe is not a valid interrupt pipe. */ /*! - \fn status_t (*usb_module_info::queue_bulk)(usb_pipe pipe, void *data, size_t dataLength, usb_callback_func callback, void *callbackCookie) - \brief Asynchronously queue a bulk transfer. - - This method behaves like the queue_interrupt() method, except that it queues - a bulk transfer. + \fn status_t (*usb_module_info::queue_bulk)(usb_pipe pipe, void *data, size_t dataLength, usb_callback_func callback, void *callbackCookie) + \brief Asynchronously queue a bulk transfer. + + This method behaves like the queue_interrupt() method, except that it queues + a bulk transfer. */ /*! - \fn status_t (*usb_module_info::queue_bulk_v)(usb_pipe pipe, iovec *vector, size_t vectorCount, usb_callback_func callback, void *callbackCookie) - \brief Asynchronously queue a bulk vector. - - This method behaves like the queue_interrupt() method, except that it queues - bulk transfers and that it is based on an (array of) io vectors. - - \param vector One or more io vectors. IO vectors are standard POSIX entities. - \param vectorCount The number of elements in the \a vector array. + \fn status_t (*usb_module_info::queue_bulk_v)(usb_pipe pipe, iovec *vector, size_t vectorCount, usb_callback_func callback, void *callbackCookie) + \brief Asynchronously queue a bulk vector. + + This method behaves like the queue_interrupt() method, except that it queues + bulk transfers and that it is based on an (array of) io vectors. + + \param vector One or more io vectors. IO vectors are standard POSIX entities. + \param vectorCount The number of elements in the \a vector array. */ /*! - \fn status_t (*usb_module_info::queue_isochronous)(usb_pipe pipe, void *data, size_t dataLength, usb_iso_packet_descriptor *packetDesc, uint32 packetCount, uint32 *startingFrameNumber, uint32 flags, usb_callback_func callback, void *callbackCookie) - \brief Asynchronously queue a isochronous transfer. Not implemented. - - This is not implemented in the current Haiku USB Stack. + \fn status_t (*usb_module_info::queue_isochronous)(usb_pipe pipe, void *data, size_t dataLength, usb_iso_packet_descriptor *packetDesc, uint32 packetCount, uint32 *startingFrameNumber, uint32 flags, usb_callback_func callback, void *callbackCookie) + \brief Asynchronously queue a isochronous transfer. Not implemented. + + This is not implemented in the current Haiku USB Stack. */ /*! - \fn status_t (*usb_module_info::queue_request)(usb_device device, uint8 requestType, uint8 request, uint16 value, uint16 index, uint16 length, void *data, usb_callback_func callback, void *callbackCookie) - \brief Asynchronously queue a control pipe request. - - This method does roughly the same as send_request(), however, it works - asynchronously. This means that the method will return as soon as the - transfer is queued. - - \param callback The callback function for when the transfer is done. - \param callbackCookie The cookie that the stack should pass to your callback - function. - \return Whether or not the queueing of the transfer went well. The return - value won't tell you if the transfer actually succeeded. - \retval B_OK The control transfer is queued. - \retval B_NO_MEMORY Error allocating objects. - \retval B_DEV_INVALID_PIPE The \a device argument is invalid. + \fn status_t (*usb_module_info::queue_request)(usb_device device, uint8 requestType, uint8 request, uint16 value, uint16 index, uint16 length, void *data, usb_callback_func callback, void *callbackCookie) + \brief Asynchronously queue a control pipe request. + + This method does roughly the same as send_request(), however, it works + asynchronously. This means that the method will return as soon as the + transfer is queued. + + \param callback The callback function for when the transfer is done. + \param callbackCookie The cookie that the stack should pass to your callback + function. + \return Whether or not the queueing of the transfer went well. The return + value won't tell you if the transfer actually succeeded. + \retval B_OK The control transfer is queued. + \retval B_NO_MEMORY Error allocating objects. + \retval B_DEV_INVALID_PIPE The \a device argument is invalid. */ /*! - \fn status_t (*usb_module_info::set_pipe_policy)(usb_pipe pipe, uint8 maxNumQueuedPackets, uint16 maxBufferDurationMS, uint16 sampleSize) - \brief Set some pipe features. - - The USB standard specifies some properties that should be able to be set on - isochronous pipes. If your driver requires the properties to be changed, you - should use this method. - - \param pipe The id of the isochronous pipe you want to alter. - \param maxNumQueuedPackets The maximum number of queued packets allowed on - this pipe. - \param maxBufferDurationMS The maximum time in ms that the buffers are valid. - \param sampleSize The size of the samples through this pipe. - \retval B_OK Pipe policy changed. - \retval B_DEV_INVALID_PIPE The \a pipe argument is invalid or not an - isochronous pipe. + \fn status_t (*usb_module_info::set_pipe_policy)(usb_pipe pipe, uint8 maxNumQueuedPackets, uint16 maxBufferDurationMS, uint16 sampleSize) + \brief Set some pipe features. + + The USB standard specifies some properties that should be able to be set on + isochronous pipes. If your driver requires the properties to be changed, you + should use this method. + + \param pipe The id of the isochronous pipe you want to alter. + \param maxNumQueuedPackets The maximum number of queued packets allowed on + this pipe. + \param maxBufferDurationMS The maximum time in ms that the buffers are valid. + \param sampleSize The size of the samples through this pipe. + \retval B_OK Pipe policy changed. + \retval B_DEV_INVALID_PIPE The \a pipe argument is invalid or not an + isochronous pipe. */ /*! - \fn status_t (*usb_module_info::cancel_queued_transfers)(usb_pipe pipe) - \brief Cancel pending transfers on a pipe. - - All the pending transfers will be cancelled. The stack will perform the - callback on all of them that are cancelled. - - \attention There might be transfers that are being executed the moment you - call this method. These will be executed, and their callbacks will be - performed. Make sure you don't delete any buffers that could still be used - by these transfers. - - \param pipe The id of the pipe to clear. - - \retval B_OK All the pending transfers on this pipe are deleted. - \retval B_DEV_INVALID_PIPE The supplied usb_id is not a valid pipe. - \retval "other errors" There was an error clearing the pipe. + \fn status_t (*usb_module_info::cancel_queued_transfers)(usb_pipe pipe) + \brief Cancel pending transfers on a pipe. + All the pending transfers will be cancelled. The stack will perform the + callback on all of them that are cancelled. + + \attention There might be transfers that are being executed the moment you + call this method. These will be executed, and their callbacks will be + performed. Make sure you don't delete any buffers that could still be used + by these transfers. + + \param pipe The id of the pipe to clear. + + \retval B_OK All the pending transfers on this pipe are deleted. + \retval B_DEV_INVALID_PIPE The supplied usb_id is not a valid pipe. + \retval "other errors" There was an error clearing the pipe. */ /*! - \fn status_t (*usb_module_info::usb_ioctl)(uint32 opcode, void *buffer, size_t bufferSize) - \brief Low level commands to the USB stack. - - This method is used to give lowlevel commands to the Stack. There are - currently no uses documented. + \fn status_t (*usb_module_info::usb_ioctl)(uint32 opcode, void *buffer, size_t bufferSize) + \brief Low level commands to the USB stack. + + This method is used to give lowlevel commands to the Stack. There are + currently no uses documented. */ ///// B_USB_MODULE_NAME ///// /*! - \def B_USB_MODULE_NAME - \brief The identifier string for the USB Stack interface module. + \def B_USB_MODULE_NAME + \brief The identifier string for the USB Stack interface module. */ diff --git a/docs/user/drivers/fs_interface.dox b/docs/user/drivers/fs_interface.dox index 12f24fbbe3..9c50e3b230 100644 --- a/docs/user/drivers/fs_interface.dox +++ b/docs/user/drivers/fs_interface.dox @@ -24,49 +24,6 @@ // TODO: These have been superseded by the B_STAT_* flags in . // Move the documentation there! -/*! - \enum write_stat_mask - \brief This mask is used in file_system_module_info::write_stat() to - determine which values need to be written. -*/ - -/*! - \var write_stat_mask::FS_WRITE_STAT_MODE - \brief The mode parameter should be updated. -*/ - -/*! - \var write_stat_mask::FS_WRITE_STAT_UID - \brief The UID field should be updated. -*/ - -/*! - \var write_stat_mask::FS_WRITE_STAT_GID - \brief The GID field should be updated. -*/ - -/*! - \var write_stat_mask::FS_WRITE_STAT_SIZE - \brief The size field should be updated. If the actual size is less than the - new provided file size, the file should be set to the new size and the - extra space should be filled with zeros. -*/ - -/*! - \var write_stat_mask::FS_WRITE_STAT_ATIME - \brief The access time should be updated. -*/ - -/*! - \var write_stat_mask::FS_WRITE_STAT_MTIME - \brief The 'last modified' field should be updated. -*/ - -/*! - \var write_stat_mask::FS_WRITE_STAT_CRTIME - \brief The 'creation time' should be updated. -*/ - /*! \def B_STAT_SIZE_INSECURE \brief Flag for the fs_vnode_ops::write_stat hook indicating that the FS @@ -249,46 +206,6 @@ //! @{ -/*! - \fn bool (*file_system_module_info::supports_defragmenting)(partition_data - *partition, bool *whileMounted) - \brief Undocumented. TODO. -*/ - -/*! - \fn bool (*file_system_module_info::supports_repairing)(partition_data *partition, - bool checkOnly, bool *whileMounted) - \brief Undocumented. TODO. -*/ - -/*! - \fn bool (*file_system_module_info::supports_resizing)(partition_data *partition, - bool *whileMounted) - \brief Undocumented. TODO. -*/ - -/*! - \fn bool (*file_system_module_info::supports_moving)(partition_data *partition, bool *isNoOp) - \brief Undocumented. TODO. -*/ - -/*! - \fn bool (*file_system_module_info::supports_setting_content_name)(partition_data *partition, - bool *whileMounted) - \brief Undocumented. TODO. -*/ - -/*! - \fn bool (*file_system_module_info::supports_setting_content_parameters)(partition_data *partition, - bool *whileMounted) - \brief Undocumented. TODO. -*/ - -/*! - \fn bool (*file_system_module_info::supports_initializing)(partition_data *partition) - \brief Undocumented. TODO. -*/ - /*! \fn bool (*file_system_module_info::validate_resize)(partition_data *partition, off_t *size) \brief Undocumented. TODO. @@ -638,11 +555,11 @@ \param volume The volume object. \param query The string that represents a query. \param flags Any combination of none or more of these flags: - - \c #B_LIVE_QUERY The query is live. When a query is live, it is + - \c B_LIVE_QUERY The query is live. When a query is live, it is constantly updated using the \a port. The FS must invoke the functions notify_query_entry_created() and notify_query_entry_removed() whenever an entry starts respectively stops to match the query predicate. - - \c #B_QUERY_NON_INDEXED Normally at least one of the attributes used + - \c B_QUERY_NON_INDEXED Normally at least one of the attributes used in the query string should be indexed. If none is, this hook is allowed to fail, unless this flag is specified. Usually an implementation will simply add a wildcard match for any complete @@ -1714,7 +1631,7 @@ \param vnode The node object. \param cookie The cookie you associated with this attribute. \param stat A pointer to the new stats you should write. - \param statMask One or more of the values of #write_stat_mask that tell you + \param statMask One or more of the values of write_stat_mask that tell you which fields of \a stat are to be updated. \return \c B_OK if everything went fine, another error code otherwise. */ diff --git a/docs/user/interface/Alert.dox b/docs/user/interface/Alert.dox new file mode 100644 index 0000000000..53d42cdc58 --- /dev/null +++ b/docs/user/interface/Alert.dox @@ -0,0 +1,389 @@ +/* + * Copyright 2011, Haiku inc. + * Distributed under the terms of the MIT Licence. + * + * Documentation by: + * John Scipione + * Corresponds to: + * /trunk/headers/os/interface/Alert.h rev 42274 + * /trunk/src/kits/interface/Alert.cpp rev 42274 + */ + + +/*! + \file Alert.h + \brief BAlert class definition and support enums. +*/ + + +/*! + \enum alert_type + Determines which icon (if any) is displayed in the alert dialog. + Choose one option. If the constructor doesn't include an + alert_type argument than \c B_EMPTY_ALERT is used. +*/ + +/*! + \var alert_type B_EMPTY_ALERT + No icon +*/ + +/*! + \var alert_type B_INFO_ALERT + \image html http://api.haiku-os.org/images/alert_info_32.png + Info icon +*/ + +/*! + \var alert_type B_IDEA_ALERT + \image html http://api.haiku-os.org/images/alert_idea_32.png + Idea icon +*/ + +/*! + \var alert_type B_WARNING_ALERT + \image html http://api.haiku-os.org/images/alert_warning_32.png + Warning icon +*/ + +/*! + \var alert_type B_STOP_ALERT + \image html http://api.haiku-os.org/images/alert_stop_32.png + Stop icon +*/ + +/*! + \enum button_spacing + Determines how the buttons on the alert dialog are spaced relative + to each other. Choose one option. If the constructor doesn't include a + button_spacing argument than \c B_EVEN_SPACING is used. +*/ + +/*! + \var button_spacing B_EVEN_SPACING + If the alert dialog has more than one button than the buttons are + spaced evenly across the bottom of the alert dialog. +*/ + +/*! + \var button_spacing B_OFFSET_SPACING + If the alert dialog has more than one button than the leftmost button + is offset to the left-hand side of the dialog while the rest of the + buttons are grouped on the right. This is useful to separate off a + leftmost "Cancel" or "Delete" button. +*/ + + +/*! + \class BAlert + \ingroup interface + \brief The BAlert class defines a modal alert dialog which displays a short + message and provides a set of labeled buttons that allow the user to + respond. + + The alert can be configured with a set of one to three buttons. These + buttons are assigned indexes 0, 1, and 2 from right-to-left respectively + and are automatically positioned by the system. The user can either click + on one of the buttons or use a shortcut key to select a button. + + The layout of the buttons can be configured by setting the #button_width + and #button_spacing properties in the BAlert constructor. The icon displayed + in the alert can also be configured by setting the #alert_type property. The + right-most button (index 0) is the default button which can be activated + by pushing the \key{Enter} key. + + Below is an example of an unsaved changes alert dialog: + + \image html BAlert_example.png + + When the user responds by selecting one of the buttons the alert window is + removed from the screen. The index of the selected button is returned to + the calling application and the BAlert object is deleted. + + The code used to create and display an alert dialog like the one shown + above is shown below: + + \code +BAlert* alert = new BAlert("Close and save dialog", "Save changes to...", + "Cancel", "Don't save", "Save", B_WIDTH_AS_USUAL, B_OFFSET_SPACING, + B_WARNING_ALERT); +alert->SetShortcut(0, B_ESCAPE); +int32 button_index = alert->Go(); + \endcode + + The messaged displayed in the dialog window along with the button labels + are set by the strings in the contructor. The Cancel button is offset to + the left relative to the other buttons by setting the \c B_OFFSET_SPACING + flag. The \c B_WARNING_ALERT flag displays the exclamation mark icon in + the dialog. + + Any alert with a Cancel button should map the \key{Escape} key as shown in + the example above. You can setup additional shortcut keys for the buttons + with the SetShortcut() method. + + The Go() method does the work of loading up and removing the alert + window and returns the index of the button that the user selected. +*/ + + +/*! + \fn BAlert::BAlert(const char *title, const char *text, + const char *button1, const char *button2, const char *button3, + button_width width, alert_type type) + \brief Creates and initializes a BAlert dialog. + + \param title The title of the window. Since the alert window doesn't have + a title tab, the title is not actually displayed anywhere but is + useful for debugging purposes. + \param text The text that is displayed at the top of the window. + \param button1 Button 1 label + \param button2 Button 2 label + \param button3 Button 3 label + \param width A constant that describes how the button should be sized. + Options are + \li \c B_WIDTH_AS_USUAL + \li \c B_WIDTH_FROM_WIDEST + \li \c B_WIDTH_FROM_LABEL + + See button_width for details. + \param type Constant that determines which alert icon is displayed. + Options are + \li \c B_EMPTY_ALERT + \li \c B_INFO_ALERT + \li \c B_IDEA_ALERT + \li \c B_WARNING_ALERT + \li \c B_STOP_ALERT + + See alert_type for details. +*/ + +/*! + \fn BAlert::BAlert(const char *title, const char *text, const char *button1, + const char *button2, const char *button3, button_width width, + button_spacing spacing, alert_type type) + \brief Creates and initializes a BAlert dialog. + + You can also set the \a spacing with this constructor. + + \param title The title of the window. Since the alert window doesn't have + a title tab, the title is not actually displayed anywhere but is + useful for debugging purposes. + \param text The text that is displayed at the top of the window. + \param button1 Button 1 label + \param button2 Button 2 label + \param button3 Button 3 label + \param width A constant that describes how the button should be sized. + Options are + \li \c B_WIDTH_AS_USUAL + \li \c B_WIDTH_FROM_WIDEST + \li \c B_WIDTH_FROM_LABEL + + See button_width for details. + \param spacing Determines how the buttons are spaced. Options are + \li \c B_EVEN_SPACING + \li \c B_OFFSET_SPACING + + See button_spacing for details. + \param type Constant that determines which alert icon is displayed. + Options are + \li \c B_EMPTY_ALERT + \li \c B_INFO_ALERT + \li \c B_IDEA_ALERT + \li \c B_WARNING_ALERT + \li \c B_STOP_ALERT + + See alert_type for details. +*/ + +/*! + \fn BAlert::BAlert(BMessage* data) + \brief Unarchives an alert from a BMessage. + + \param data The archive. +*/ + +/*! + \fn BAlert::~BAlert() + \brief Destructor method. + + Standard Destructor method to delete a BAlert. +*/ + +/*! + \fn BArchivable* BAlert::Instantiate(BMessage* data) + \brief Instantiates a BAlert from a BMessage. + \param data The message to instantiate the BAlert. + \returns a BArchivable object of the BAlert. +*/ + +/*! + \fn status_t BAlert::Archive(BMessage* data, bool deep) const + \brief Archives the BAlert into \a archive. + + \param data The target archive which the BAlert \a data will go into. + \param deep Whether or not to recursively archive the BAlert's children. + \retval B_OK The archive operation was successful. + \retval B_BAD_VALUE The archive operation failed. +*/ + +/*! + \fn void BAlert::SetShortcut(int32 index, char key) + \brief Sets the shortcut character which is mapped to a button at the + specified \a index. + + A button can only have one shortcut except for the rightmost button which, + in addition to the shortcut you set, is always mapped to \c B_ENTER. + + If you create a "Cancel" button then you should set its shortcut to + \c B_ESCAPE. + + \param index The \a index of the button to set the shortcut to. + \param key The shortcut character to set. +*/ + +/*! + \fn char BAlert::Shortcut(int32 index) const + \brief Gets the shortcut character which is mapped to a button at the + specified \a index. + + \param index The \a index of the button to get the shortcut of. + + \return The shortcut character mapped to the button at the specified + \a index. +*/ + +/*! + \fn int32 BAlert::Go() + \brief Displays the alert window. + + This version of Go() that does not include an invoker is + synchronous. Go() returns once the user has clicked a button and + the panel has been removed from the screen. The BAlert object is + deleted before the method returns. + + If the BAlert is sent a \c B_QUIT_REQUESTED message while the alert + window is still on screen then Go() returns -1. + + \returns The index of the button clicked. +*/ + +/*! + \fn status_t BAlert::Go(BInvoker* invoker) + \brief Displays the alert window from a specified \a invoker. + + This version of Go() with an \a invoker is asynchronous. It returns + immediately with \c B_OK and the button \a index is set to the field + of the BMessage that is sent to the target of the \a invoker. + + Go() deletes the BAlert object after the message is sent. + + If you call Go() with a \c NULL invoker argument than the BMessage + is not sent. + + If the BAlert is sent a \c B_QUIT_REQUESTED method while the alert + window is still on screen then the message is not sent. + + \returns A status code. +*/ + +/*! + \fn void BAlert::MessageReceived(BMessage* msg) + \brief Initiates an action from a received message. + + \param msg The message + + \see BWindow::MessagedReceived() +*/ + +/*! + \fn void BAlert::FrameResized(float newWidth, float newHeight) + \brief Resizes the alert dialog. + + \param newWidth The new alert dialog width. + \param newHeight The new alert dialog height. + + \see BWindow::FrameResized() +*/ + +/*! + \fn BButton* BAlert::ButtonAt(int32 index) const + \brief Returns a pointer to the BButton at the specified \a index. + + The \a index of the buttons begins at \c 0 and counts from left to right. + If a BButton does not exist for the specified \a index then \c NULL is + returned. + + \param index The \a index of the desired button. + + \return A pointer to the BButton at the specified \a index. +*/ + +/*! + \fn BTextView* BAlert::TextView() const + \brief Returns a TextView containing the text of the Alert. +*/ + +/*! + \fn BHandler* BAlert::ResolveSpecifier(BMessage* msg, int32 index, + BMessage* specifier, int32 form, const char* property) + \brief Resolves specifiers for properties. + \see BHandler::ResolveSpecifier() +*/ + +/*! + \fn status_t BAlert::GetSupportedSuites(BMessage* data) + \brief Reports the suites of messages and specifiers that derived classes + understand. + + \param data The message to report the suite of messages and specifiers. + + \see BWindow::GetSupportedSuites() +*/ + +/*! + \fn void BAlert::DispatchMessage(BMessage* msg, BHandler* handler) + \brief Sends out a message. + + \see BWindow::DispatchMessage() +*/ + +/*! + \fn void BAlert::Quit() + \brief Quits the window closing it. + + \see BWindow::Quit() +*/ + +/*! + \fn bool BAlert::QuitRequested() + \brief Hook method that gets called with the window is closed. + + \returns \c true if the window closes. + + \see BWindow::QuitRequested() +*/ + +/*! + \fn BPoint BAlert::AlertPosition(float width, float height) + \brief Resizes the Alert window to the width and height specified and + return the Point of the top-left corner of the Alert window. + + \param width The desired \a width of the alert window. + \param height The desired \a height of the alert window. + + \returns The BPoint of the top-left corner of the Alert window. +*/ + +/*! + \fn status_t BAlert::Perform(perform_code code, void* _data) + \brief Performs an action give a perform_code and data + + Currently the only perform code available is \c PERFORM_CODE_SET_LAYOUT. + + \param code The perform code + \param _data A pointer to some data to perform on + + \return A status code. + + \see BWindow::Perform(). +*/ diff --git a/docs/user/interface/BAlert_example.png b/docs/user/interface/BAlert_example.png new file mode 100644 index 0000000000000000000000000000000000000000..28aba046dd6084eaa1bb23d5d612bf4a1a44459f GIT binary patch literal 8972 zcmXw;byQT}*T#n)LK=n`TDpdk?vn2APU-F#x}`%vk(LIfhY;zIMv!ihZbaVE@9+I% z?wWhoJ!{{4&a?OVJp0C}tIEH?Aj1Fv0523?%V+`s2)Xe8%0N{35k@nz3jkpFIY>*Z zD@aRIt9!WGIyl<^0DcH_S$6tb!(@Yd1?i^t2p04kt+V z5mo=6N2mZNLnbC*J4RLhQnQVjsYu>GniaPU0Z=5_W@nNIuz87Qqd?OxnUSz3;1XWF zClC;Bv}YB8STL1C2>=pe%afo1?zyUFcv{`?Gr8m9f+*iEnoj|XQuvVS_o$|bs`nDjsa3LsNLLNhW z$*%U*TYIW4_X1InL8^#ZlfP&*6}YwHvLrYNB&fSjRzDQMJ9xUtX|FMv?0aFboui#y zDiQ}yY0Dem1C^m6b9y++6_3)|4WdPHaC3h1S4dHDv*A2McQ`J!qpvwP{((OPY{cYb6O5%Ae$$Ezc**&lyvBUTbda_*}nq zd%Jgv`%>l3XsZ!WZ!do;y|+e2CHf_c7$BqbJkLAzkl=z=+@F-sF{VEhll$0*h>t7F z`VuoEjBE-ObzjgB(Wpm8Z64_^f*KcF7l9)djadRXAO6A|a|j8=9A^<{qzBIpOFMFA zoy{JxrkKJQ>5Bx;K3Yl-E(uCq5Aq$bj0V^ztsRRxEH#pf`VlQx3TuecBfPU1zyywu z*rXQAzRA>kwWn3ahY&fmW*sF5@x7F@`Y?WzsUTnb?D`D+5?o43M>Y z?N5lhI8Ko^R{izvi{6VO&gh>pmczQ@e+?#Eif_6JI1~_1VC*Gh4$^PVZ~1IsZydV6 zX*FE|y5Oe_j&5F``S_WMpcO?=_EUW=>NERxyCHvG1hkIe?#)yc&rWlFc*^`2JtnENRXK8lwDS1QZJx;?kR6`+TILcEWb0%g6IS?KY_|qv8&f(g`)#8s6v*U>}2FPEvkZ34tjVUD3eOCBn zd>pY@y!cT-WkqI1Pee8-`%dAUeA5cw4_yTvgkC69`;{w>6`zh5S|;cD!QElme$YYB zq2#TA0=vRz>kro9+YZAn!|2TD%$}9FmCBVKl?j^C)3MEEyhcI>?dlJouEMUeZQ@7u zM=i5{8S8%e0RamJ%L&T?i@Z*|PMJ=NcBIais`+X$4Z2FMS4Wc4-t1mm-lN{9`@I2K0q6lSR{_@z5AzQ}Pl`{HNbv}x)cwWt z=8Nh-rbgYWEz&p0>AXvTC0%kRa%+j~iRnoxn_h)3ku5ST6*f~C)wYP(-k`d&*97ko!ruh4a(tbtjca~l5ygr0NuLM*DmjvE;IeN+!{4BV9*J1L~IKpJaxUjvd z{af37yK1XJYmKjy=U{ta`>8jTHEUzrG1(0?CUa0OMO7`{uGlVjkB8HQ^SxdI|M9Pl zuF1!SlxUo_@?p?jWAN?0*!j$b(a~+S_{7>IY~|TMOra+_tX9Hs{jeuJoGKC=i4jSO z;)GU?<_nFDmWiH)Dn|*$5JzE0kw(42>LB6(72>Xf!&88974bR78;zFF@!wx340R5L zXBx8d=&kD0e_`>T8<_i0Em%D%Yf&OqqAEA;79^NiFl_JRC3}Uu5EmHs7(cj8botHd z*fQSI^y`lS;(_FWrGZ}wx)0~4@VF1< z$~}8gc4$*iYw<^OTafRI*>8*I!zX^lF{NZMHN|Uji1wk*k0AA@^}}v{J z%39$MejnF|vWxIT+Cyi5*;|#`+6;58G$dM0ro@0xA9Bwa?%QnI-o1_`kRGzT!>IwoD!3L|c29P%J?Z>* zACGD%9YQyoGbiw!aE*5syt)$DyCo%`@J6Y>E*e&7uj9ZDWAbh|!#~hGDP0;}%4S?f zep9!+^+R4r*H@$+-)G0PJk;)1XR>;suFbS#df>1<=;ukm(TjX?kPElVtDlXXbAHR4 zKK-u5Fg`CMAO6*b_L&u{pEJ`Powu4r(q@k)dmRfW4W~a3Zx2o>fRwG`B!U87MZTfO zk{6L*aCj(H#Yg-TgA1NzjunQrqRKO2N54(Qtp&Z@7ya*UntJR~UDyH>HYYggih7Y#aUPFVS>+~%erL(3xX2YC|A3+Ujdwt zf4-t!;!vcAq^pUS1r-#IJimObeBjygT*#i{u5g;KsWZpgew2|L`aR4 z=%X~?hZu+7S(|->762k@FrT>Y)LZ1ayAaC%82|C!p&ALJ$)Hbmm-$adC0l0Fe%#UyfW(wuAp&#+?9y zg?$piQm7II!oC~@=j-h}e{b&rA_EXAhnc$B>n2`o4TKxA} zqiD`PIzR^G{^&nLGf8*Jt zdUg)E6a4ZU6_k`pYK*>24^o9H>(!Z-9?n(IY^8{+dLPcd&&eSf$xg8;W{w4i{|ysv zoEXL~C5N7^CUy^v#v)Y~_W7#SurK9xwQr%QxFYQ&W+GKov&Iso^6N*7!T$Cp_E%Xe z__NCO5Fmc8zzBZ4DSbBPo?|Tx57g_k6RYKTCj(AW4lyu4-<*Mev(qf`KSZ=Hg9mn2I=v`BCWM* zp@>2Ws!kb3=|G5s!*i@qIe|@?&65l87F8CM^f3=7yW}~filOUC3Ps3sH_>LXKr}FG zcjBGWJ7Hf2d&P!^2F-PYECe18sh;?l6%0z%D2y#k*LrRD49r$972W1 zhTKbyKNm7-rC;lcTZ2`AdDULO)Dcad+(~yPmFMFNJWn?V5}4`fqZrf*m2E~c-irp_ zOa-2H$zLBWObUAL{#BtEjoW$;LeZuXsliSSG?w&Kr&{-WtNYe=!Fe8^ll_lohi0z> z%_eJ$;5A|uIod+z z558HlYKfB}k&=}+$nfr!2snDshL&RPY`zdOJ z&x}PuZ(q5rR5bc{5UI6}qyUFPpB}C?^PzI+;(f+xigw%Kt%Zm7x@cCWIjqJVJ~dxI z+KgsF1*PAOjT~2s>QH!v1d#mRk5tLyeXm<%_uN!}@2TqJP23)J!q_2- z>4}?$f1ggszyiiXQKycem)?Dn4R>{i0Xf2motGf}{ zarX*?l*XLenmZ~rym%OQw-M|7tpZHK%ZIVF$dH~~dIXdZrTnwq+hL+W&})B+Ci{h$ z(>$Bw{3lX&qtA)O*AlI4X5GeO8L|n)-all#29qhE5a1`*?)&H|^vCNX`ODq$lDj*< zds^SzIN(aBe-oiOWFh$Bpxo>3%%Z&FXuhW8d~0wNd<)*h=EJf4Dl(T;IPPA90>96yntT(-nBDs9YFu z$V?{SM*Rd|Xpf9UN!*7_TGzuJY>=8h%OAIEzkpW$kkHHdOYIP=5L<74CuutICMO;2 zovORgr)$s)5=fX_GPp8g(K|9MNlMNhNwZa=r^gxpJ2OTuPsP002 z`RcE}40ZNsq@!^QUG))jMCi=73KFNSi+f|Kc5SzRV<9KE&NI_0!bTck`VE#BHW8qa zI0D9x^IV?0$_{2ImnHHkiZAGBXu?CDpL`uCJGPRAt-B%bC7CSF0m?SZUtG%-(iw&W z1sD);5P-MEKjh`&?-}^7;N@MhsUUw@yTwswkp0uQ8If zec*2Vb7Ay9frP9BrJj)w7WO8KvMuf|%S;R1+#wg=wd&0!+ub%Iz(JKCTjg3+!-tH{ z`KvpsUuinjcyVn!e&PWZf4ng#&?3KwFyFe~`0nz*l)D({( z<5d476p71X(%wuc1K+)}P{MqWIt0g5a9`Gs(qci|(p`SGe=kW9W2qbelZvKH3mLyx zEF9T?!Pz-$Q5Zgqi5y;)ZeViKaVqAZ8Sx?rp4FP>00KQ|iX)BNb&AvbUTQUS^oXfT zXg(`t?ZtHe*kSQt6cri8Zr-eie})2M6L+BFB)n#i4lt0gg}JfSz_y*b67TOK>HUgp zx*t!3H761KAVYmi=DC<~wr1x)v$;WM^hAM1Eu_Zl4m4<-q zj0x2Cv>%%_Xas!&Z;qL%h!gvg!Gg4Wq{^nOeIq=H4CnnyXw_3*5&l@V+@E+g%D7iT z;iUkb43APINB9gsrr1NC1bw_n+$@V;P;jY4*J|5BSI#PEi_a8mh@4Xs*xuSIP|jrQ z-CH23sfll4frR{GH*rOyR57y=olDuCE_6HTJL7Mlr+lqnYeIG3_+jxTvmPhGNaPOfMR<20gGGY>E26+!6mLICOIIhxX0PXsgy6Exy4V1EI@u`E;v34QBKT(I@e z{|R5#Rk_+9Q~H#lbwAma&$7*!%A3^E@#vP9$&}}V5)A=iCZ3=cWzs57Np&)_pnI)1lqk%T)Oh|4zvJE$g_`}JFHR=m>(3PBNtslu2N!|FNdE(l8X*5!300O}kx=B74D-SfW z<3@(653?N(F|*3&yjeBk9$h}} zHuyOXp8-`9eJ0pp$+y;^UsQ;AmR_0YTHo6|_qK6fO~wQsh|K;vB>r8Fd!O!vUIWlBeJL zg+sXhLgqRSq5!E@HY17tk{ySZVS=$v*_gGZsvL(?_ZyCm((#o%uiNtJf^VXT1Pscl zyX0*B-v%qXb3|7>cZC0eB z-LRgNxPK5SL1SLhhGnRfwToy$_tdAHg{~r}4T_*Y0^x1^F-n&}=no?Ok8(Yd;kdaA z&(gBE=f}`y-)CkE3W7_nyJ<5=F8%pLMVs7FD9&yp4=8Hg!tyU?hT#o)0^u-NzqxLI z7_8m(ljTs*hw;rLvq3>3dJSq`B0lezdgZ&wic2GT3MG?EaG$aHKc4O*K`?@1WsOoU z!J>R>LJJvi{4=nr+N9W{T}pI}CZ=*dzd)7q+;mT9^BP5>unRaCVB+XoKATnla6gq1 zuij>pDln9uF{v28^aJzLq0M2)B&;$xA@HE%?uk&?hW|58=nDjBCF;2XC(Zo5SF2dE7N9hp}C*)65&#r+sf$`2hl5P zbU)vL<~THSTnfY_4=Ob*WAuWqi*Cbr$^Q8p++^V5?Sl`S5i!A^g9T<x@qLEfNWoLG+m*C~7qcJ#*3d&G33Y+Xfj#AZ3YYh47j_iw4@#JyV9spWq z8d<9M6BKU)e;NyQ$6Ux~c|B}WmCIX>dO0&VymS_dondZ3=@NPzAc?8_-$F+ugau16 zNC%PAiT8{dHahFKC!Rv)26G7At8*L))bwzlE+@r3%B`JClGDj(+-8?3YBwW6>3qNn z>Cc}wi1UnFVJNjG;}2BHinfiY;f*$<4`V~bG;jhU4Y-VqoNX~cuL|QSm^HO|scaVy z%}9I9(s&u1?v`8+%i@Pxh2v0)FqH)0bH|2Jl;?Ux13s62S9>!?`ejOW{Av8*=KAyV z)9=g4c{@s5u(0om@7<#Tguw4KAdWmqv*$=Xq{?65eull3v{V#UeEj;z+(GxZocWM+C4hHCRHG4=V z@qDvEn;Wz8+Z*f~gh~u+xNdx$yW}xvN#jrKdv8u%pRJCA2UpEL>8P&4;&d=De>(Ts zB12WG2w%ZomZ}%o&#NT2{XlAZ4gNga&daBZd15lCg2EKk(-};v1FqBGjwO15sXvlx2_wiAOq~i}w zYF?fqkKM$_`5GfF_=Z@aRjzvV>&x21Ae)S40|On|bk+A4-E1e{OVGTJ=96|Oi_}0I z#;I#>o1GRo^t?dThqZdp0+Je8`z{NJR*kFa8KnVA} z%9zA#ZrfpX$?_?b?0f|Q*N5MQPdn*Q(&EFcD*uB1UvE>TQ$2mQ(f{toK?(HO75wLZ zZ??rr5AIq}*$o`K z-USZy1eATHO4&l2C5*MkZJOQ6J*+G&irwbgOXdOj@OH}e=~~e%*HvXSY_QwMf$L>g z7`qB9RnS>D7=aEalejZ;4FmK$=eKkZR;U}_w{S@BMF>%HHYqCp)?i9DY#;$d@G4d3 zwzpr)OvwM@V+s_93J{fk|Z*6T+>_i+e2?^y@ zX;;!d)|ZP_-*tG{ynnj$92gy`f4DxHNhIa5fBy57EOhkySC8W48WoHRB1~^VvxO`_ z!Qpedsxnut=R0Z*_sbsqh$7ZREZW6fR^P0f7NjuyUgP*&yqAs{LDS%Z5?{g{(`XFE z8WMc6RepYe+pyOmaBXD@YgqB3^!5{y0gFv6q_m))WzFDfO#V&!h_UH^s1%>_A9(+&B+z`(G8d@?wVj>4Wb;18ss(h2MohFw+bd%P$K zFQD$mN4e(ExENyScZ@MRebm}%TI1WTykSb@P6sqAa5Lwa0SmYz$tuFYq~sL-9%JrF zdGIIwmd7gg&CNS0_z*G)B;ZV*30ne1;A~f#S&89u8jfido4G819{(QGb~6OOcV3OCpuVz!%K<9GvaoQH)tEi$#(v;&B_5z)OuSb;`A)_cQ8j^nAR z&&;vOcwalR=raL~ItpPYdLr5+)0;aH!E1@opV)sLev8wBPkZS!t@^F7>}EnS?YfFE z$(H%_^ZOV|k7kP+!xms3&&>hS)76Yxr*G12YPr}7u#L3>YCioEqGL;FqU*33+84c>s` z2Jw3YtV-`&%qJAgOvsY;;Z-i6Q>TRd6H~twiJLa_b?=v~RMC)s$(CN0O^(PA|EcU`w?6pl*b{~@{j%F`lJXww zLwE4QmHVt9r^SwT1K3z5Rxm43;kxf@?3s4)gy8#nQyn|$I^G>vAadGiD9E|UV+-ErC zbudl84)8=x43i3b%$K6QtL>hVIP=6g1^4R?5whwgiqm49c2mv%@C?OdSy9ckC`Z1= zdq4A{8;F6}+0MoU@nrb7g+mz;Evkp1cAlO!q~T|hJwN9eHzFlYDwv(P+e#=}3IDt4 zCA{q{)o9SB`R{Za8{TH#PWD;X{EsT%0_#)Jhi!Kh|GAS?VR+9vUHC`1Qt!XU_G{X8 z5AUT0t3l`LPw)JfbsZ*h{$Vh#Y>&dwy7q|qJ7v-jejY9Vz}_607r6k6^(xisf241Y z{7FgzgY=b#0Se=##eeiag~ybdlk@tH>tDRTT~l4Uv*&H$L#Z{^50dat3jhUKRhe2T H^N9ZgDq!gW literal 0 HcmV?d00001 diff --git a/docs/user/interface/BBox_example.png b/docs/user/interface/BBox_example.png new file mode 100644 index 0000000000000000000000000000000000000000..4e8b6361c3bc820f2a0498ee6315be1f445960ce GIT binary patch literal 3834 zcmeH}=RX?`w8mq{XsCUO(Q2tG(b_ZitXWj;9kDk_wPJ7D+7+WkR7+H?2t}#dn~>Tf zlp3{a)z9@;+*kL-Ip@Xm=J|X-=kt7?WK(0^8w@-Q007{IzMhu(_07JX1R&-0ZcvkE z0{|Ez;F_AI`kI=8ra}H5a36O7AcA5#7iRsWpQm>No#o(3QO<_k6Gy3OFn^UZqo?O{ zVbbnQNWsO3r6d7Ah~a_nmp`&UvruE7yIqQUq0UJYYX2aKVL+ub{H!g+eM1lw&fYsGU#%U>_9+NY1kJ;P8<0YE~6g z`r5PATQcvrK=*$aaq61P@>)fvwsV4zeDG)e+#dk zow_0K7yW5N9vN-B;Tl7U9?Rzk0NFvh+;o7mhaV@UaDkru2TTJ$A{{6N04b^if9E4W z%;c7@zbnhD3rObKjb$B!Y$trd^5cdI3TWJ2hf~NegQIUF^i?r##)N;FSL9c3&>6)u zky&cG3{WBrEBnS%fE0*U;d=H;*|8p>k{|%aeK;(85y_=s^^50oUyO9`-Ymq^Y&0YM z;MrQfMP7w+GB~s4?eGQ{hK?E%~X`q`;D69QO}jUC83%=qOpYIexX=6Dl=7C$Wxd>3dGz3c4=B9(e`T$yrM0qE6`x-;}42% zD+SyGr^KuZs%C?HQBCSJrZ+8U`Qp7w9ZMNal|rbt;`!CO$K;Pd=afQ{G`Vpc&PKC9 zkIo0PY@nE@U4egWt zOJX6$tqI-LyKA1GqNB&rrlxE^{Mb-7-Tw@;E4cQC{4@o@!9}LfA(&qR1 z9wt{|$)(R0)s$Au-m&hk-Jb(zLuZwJ=$jbkP+wDadNW+0s{!(GH0KDzMh0W=-Bki9 zYz4Hk73hm|ms)!(Uj~cnn9zPk< zPZMg=ueRHcnJt|ymp7W%nt!US9hrBkzt6ks${Im$M9)QEtcCslFj!@7GT+N-r8*#ZvXSDyS;eTyr9+0V8dz_zZ7)UVVf* z%5zT{v>tTH-LbQ3uJ$Kpr?oLX5!MlQ#5iCa*Ha(Z6SQUZ!)kr9w%HWY&{%ZGykbjt z&{ML*py9yWKrs1`JURfiKyid{P_h%mz)x^Bl2sqde_`&KDu0O3-fw)?d|5z#?Gy~XxlQ*HX$#$RN{_g$F`?{8RON?csMXY7>N5UsnGoh-7 zQ!djf(~48VQ#sRLr{zA(e1uL3dPz#J%78pW;E&;6@C2{jF`o(W&_;4Vskt`R6K+fIvBe5>l-o`NsmlCLLS$h6V4+q4KCHGQYZ!m zyGsd9v!*}C1_M4hXRYuGg_Z%!zUtWPETxI3Wu<5GLLa@B+?OPJO}HG4Sj=R5+xQ_z z)4bNbnuyiJ?V6TiMB172;RUBOqkk$NCm*Myc+G?O+|XQ-)s~f+6^B(UlYWALD;Ehb zL-;w4tPlNk4C6H{lrF57jUw{Q3KNSP_-wI_${uI?WTCK+Vc^!XFwMUq7xykowiCe? zV0lmuXf)sJF@Jr^SxiN@fm@Nw*Ffnoc12lvV+EqTZ-`g04tfE7Sk!8N$1cWxz^)ko z5&xrwfH%fH!_|a)2lwKiO?jjf%tYZzDz z(6m!Slb2d_;703j9ioc`O(Yu#9y|XvvT2w&Ti(ycKWbDkVwI6;o@|_Ku4IPI!m?qJ zHe6qJ?JyC-(8I7?Kf*{g7ZFQ@*7jC!VE1NAzc>#jtfW_`>&mGYzLyL2v6@4-BBXo8 zE0K(F!-?FbCLVwBpXbiDznXIGdgjsduXp_BybrYw;t;V)KH=aqibKsV<^`qUF#h>7 z@shl#`c7PFxswN1_{^|?(aQ&yfnnj>ySo~LUER+Eo}WIa{j0cLBf$z8kl-P1e66j^ zcR)M-bH3WTlrtDI%m54W=|Lqewk&@}nqDp!$4a^HyI+zs$j2NE97u6>oc<;PmKiDY8&Qg7PhV37l<}}50k&Km$ zj0lG@C!woxvyoJJ+vFG>rn+DUGYxNWz_%|m$!EP>Cqv9Sn9#?{bAcIw*xj}tXDPHc znlFW>@~7p;*_WiJz>D+GzmYU_Q+*A)YZE$(JuTtl9rr@({;+PE?^X~8iFqP()V{TI zq@TKqR^iHc)-bX|Wfbhha`e+oZHq(eM9&sJa$y(w`$i!zm)|2l*@Z7{(-Cv4Vcq_m z9Wo)dVRDOg_{n+Kg~^H5wiELbO~(uSjn-Rs2ugvNA{m%jFrVtW1i#YvT-wDgq!3ov=r+4YJk_zN$8~DZD2$@U8J(GQ?*rI2L!WGwH?HrpkTbX~nKWu3S3Ay<1JKZ5O zU)IYk6DTGUT|97g=c4LdiWEGPHwJ-VW`>tx1|3_GzGv%aJNrHZ+tnzcwV~$})O;(m z)_}z#0E!0$xN+Q5-b4dY7N8J64bOfTb)s+vjrax`H7ez&v{(nQj8F^WZlHp)WyU08 zz6h|P1cgzg@om_zEj}s#J0PUcW5o5XGk(V_ZDi@l7pQ;iO ze_A~2o&Y3Oo)OZPy}y+Nug^ru{bS_m-*nrK3n{s-qVxfJ&w>E}#_K-H$VLHpi{=IZ zsPE}(sar%)?BuH$3Yl^1$fdrz?d0ohTKDW$5~t`t>Teo1*=-q<>2H50Xc*r7N3lv5 z^C8|zRO^+NPu!gx!F*xC+cD|TTlapo@^WLt>j$x^uVBF#-28Lc4}>y|pN%PJkPHF8 zrEd57A$%N8*~j*h`PGc%LHnhAT-3sqnBp+oU*ZvjSX)~=IywrGkkEKHwz|4HH8u77 zw|AYjvWm*^#^L4VWs_@JQDdbwJQk*X`}Mnb@8aX*u~@8AR{s)fgh;J2bW~kit6Mf+QzQPwePn%OLqu3OBO^mrR@S^~YH@LKdD$sormwH>;2@~V z!p6o1i9itN=b4NxMWC=h5}to5yw{49N!KyF$?YA!IdXDx;#*)`N!rI55eNjIA-6}e zBg4au&CMdL$@TS8bAe>yv9GVMxVU&2kxZ^gUtFR2Ga`E$tqYeL@0Lf3v&0>(fzN3z7HE+S({-B@JJ#jW3F)f38j@ zla^$&`peDc78l#`cq9^OV{hL`K0U>y)6vl}GczY9Cd!te(G9OjQou;N#cN>u`+@%c zwJ#_Nii#SO$-I1g3q)dF|Ikocj!$@axRcYeRM4SRx?105Z$s#$>iaemZOLh>=(k>~ zi*3l$93Ew=gE&XP+AWiOR6xkvL}h2nu5md3K^#3$w-V9ECM*apTK|9X{}zJ($AYid z|2_|^#{#Ebfcf-KoDEM30MNUy^}1Yg-3?5`A7=d65@O;kMz~Yiv?fmK}DCDN-GF^~}<{*}c za6k!5DO^zJni5S zUfg;IfG}J`4D<1Y#{`@~E5a%q6cd2(4GaSqf+xV_*Xp{uzJ_~W62;8@32L+DO!-II z`}Q0nz`>A&2D2NcB6t0zqGSgh)3|*tp(X1VTyHTyp)(&zDG0`;eq&D2Qk9e2D|3J{jYArMsJ|nNleH zgDkcsef)r^2pNIH#YQ%Fl*VchIh37?W5632tL$XKag1VpQfNhAd1?f2l$van^L6VU=ru@Fq(9-t1X8Hd9 z;2fJy`9XiD4yFbqcP@3XK|(3gluQUCt@XaZGxZedfSlVKoxwh)GZdEg+yjS;EyF^G zmIx-9LP9ze)PvLSl2%=Se+Z(&#?*#o4@dqe4p<1p_=YwFkN6F132USa#|d3Ccy^N& z1Xr0$ZUEmTj&+C}+l5VxSlxy204Smc^hjxjBMnQA#323Rk2mh8pRKw9kA`i96HO@s-`|JjP97-YHJ0);~`2e*Z9MDL605VE?Z?<6LS&>6&t1CGP7mPY&}P8^Q69Vty!8;-pkvP(-Z zPyZ#Xfy!{m&>Y|$?K`l^$%9UA2CnUIHVgV>Fs3)gFvhO*p@?KQ{HSlOAKi?BbE8JH z0!|ytHrT?fx5jzNeM#63xaetTiZV+(WZ*xA0> zXbs?i8#_3LZYqRRU7+Zr(1#?1D29mk zp!M*mN0mr4P(R^%_pzE%UkcQQdW8unWHS6nXpr|Pp!z~%jaHhdDc7ptqvWH?kf1fZ zU>@KCCm3d+AS%_NLctJFB(LW7Q6*7cLCAuC51}yn3VfBVP-ycdZ4O{V;?Ca)@d+lho+@s@Hz^hoqdKFe z$)^U|O%;yIiBW&hH5glL>ews6#kC+#l zW0*^tZ=dHcSu7Kqqq5=T+2+Lrxmhb&+gL+v&Zg{U$Y$fGO>He~=WRq5iflfEs^_cb zI*Nm5O%Caf$YzeFL*3cjcHBqZ&kwtOl6_Eo!ft$SYo8XLd|wq_CEz1qN2z*q7rrg2 ztxSzNm764NkLzvv2cz zxnlXGvL)L)>e1x-nUDv~F_N5+oY0u9k~K8hJ$Xm_SX*72Ksy*62%$71+G*uoSef>z zcQ3!SB2~=b$*AWGSSDFwSk7)B*RN_6wtT$YqxC5BAZz>OA$8~W%=Dad5=N#;CV-iQ zIhkssL{T5{7*yD+V4h{#?#$zXFT^LHBDgGI?`GpFo4KBOoz-SYXAopKVvyZh);iF# z(5lj`+g#~s>pIx_z4hFk(wwEP<%HxeBrIuAHdaM7!YbD)?SPxZkR$JFB>&0jR{P|0 zZ7c+9qj;F;q0aCAQS@^5O8?(|x!AdAxfb_VT7TWp&vr+(c1{viL$Z(k_E;Bew0L{8f?{>zDG>UM-KfN3QW>t z;r{wphrWr~d%k}@zg)0e!~8k{^kDDNYYr(aE>1VS(}M!$rpUnBA4>pn(>Y^KMIz2r*@z4B^5MB5IYdW zer&YJS}X6T8wF-lsd6?fSf0K$;z_ESXfY?Yay1GnJinQ z85DUjh+TUmJ1k685G_|Ni&YO+98{ez<<^;uLbjqSqUHD{GV=M|?X*`j+q`)O*@}J8 ztQBXHH-3{ivaLLs=pX)0Ht1i=T>E+IuxfiPeHG#z{MpWv>=E`_st0TR^SB4a+9O*| zN)>mf_&y%w=$5)hRvTqD85>4+{*-p+Odf)kl??+$D!Vdo_Q<0>Kx--b@pfAF#<_X z%Aa;FbzWc^e}iX^?C;w5?j1?FNPETJYDi}`NXwe7lgYjI0{7_4S>f{Nath-rf_?Ss z&WfCnwx@6_uE(BHae&pm)@1o&b&FBkO#gAK@A{d~Ka31gA_p!9zV*64^Iogl9=(o) zoxE=P9{hi6TW8nI)@Nth{@j1bkurWZJZM`yt36*ozCSuA2T(MN5eo{q<#-01NL&Rs zVR2Kah>dth`DMOKp8$t7LW`3+|GgNAnG3o(FL^)Q)puFN$~MzhzsbLvS@PTq-g*zC z?Gf>s6`57;RPBgxeEmb_NAJb^Ds--TDaP^_)G7E*bX~oQXM*?3G1Sp&!xHzJ2HB`n*6XJTH!z2KvmS2xF`axMj&<~|Je1Oinv2G}K$ zcZxlzjuH<{#Q+{3OBT`rmDXAoT_gO=P_zBQ_4%3N7UD$?(}6iLp~62t;a@2!@+<|j zBFgS{(E_T~fZ-I;U5MJW?ap!CUku=XK_eMHGCv7%%Yjl+6eoFIR~Q&Hy#E?3OnN3U z3=GK`P+CIM3-&b2dreDYbb>Z*==YrZNxv+yvjwAndW)?Kj<0tswmB0| zmGh#{C-v_&vD9iG0To6c$!qQB#tPG-@?z1XL=XN+XwHdad8*Ie?J2uQ+se%UH#oPWcB>yZVe3?y0h&qBJv;h&!E z#b$TgS?j;Q-_Kw7GaPYu&)UxY$36}ELWh`QFCeBzRy_<-1_-~uT)($(O9d&~s|(F{ z_&q~k`T2x1;LW$C0^AvjBUFef23>`(2F{4^YQ-v9$dtZndM!sq8LjUB z_}mVsB!ZE;d!X|f=nq~&NFAD=j?0JXDj(xhIZb-}?$

J{GUJFB(?2->q;@3h$6~ z{eWPQc3cjS#y>(`bzQD9{JgjyN@R4nSWS5oZ=KN@?_@806b=$eb`f+x*7Wk7l0eRK z9{6w$4FGMdaNSPKXWZY3vToF^G#k=eciRLxa+H22g*} z%?4wX(|OeE|1fIfKE2b3%}g>ETcOin2P&P(v2iqS2HF2!F7m$KFV6Nkez@GB&$(Rk zKFBgzl_j-z`|Ew6oW><{s`~k~;a%^Nx_imCgHASlX)YK1PK+9;sc8M72?SGOMo3(@}AP=*vZKUJ9|?f0iG% zY%--b&#PP(9$#$rT3ii)t#V0C=+H)*)Y@uBNLJ{h_2f<4PJdtT(lw)J9C$THHd&6R zzrI{g#=jkxSL;~&K5T^<2fXs41qZzBP_Aqz>pOh31`V1QJjQ>!3&k!d?XPe1I9;KD zhg>Y^JMPs+b{7B>s#=ekV`2Ft8H-0o!$I)>Tojs%u`Fj}JSsji%BKHh5y{7DPP;fk>%S zpV4&|+NeN8OhQ{Bc$*@zi1Nlw4u*^R#IOb#bqb@qh1A|C%7O8Q(F*Zkex+}|x##Pi z8>a(KlOp##pebV-aH zej}nDYWVaEgUU_E;;LLwsvhi-6;>(U2N|T7>XGh2_nQGSw!}&WM|2xi8q-KPWG??hwnX&=3B@F zzJo2RJwnu!HLcwnw@eox>*Lyj&I*7yZ&r5c#VP`fBLr0uwGGg*#nCm7llaidik$S# ztZBc6sF0dm=X``trnL2YU`7@?mak`DOambT2%5w!w|i2Lm#sfaZ;Xctqzi#aU76UD z2XTnKTu22$UbQZcCMzB?1I!+)0~$Nis|C})mD6X;KbCMt69TsvjRRz|!Z1SD+dLWb z3QLa30$whm(*OD-%kyt(8H$Z~kcU=-^cAB@rhHKWFSDLiz-6YO>ssqxoQfo9dtYwb zcZu&0Xqsk@J7NZpjIdwzEVH8P$~b_>t7Sn^x#p3Gt>j(z()+ly*ub8y(WH~A%@fBp zs4?!LFvTc7f7P**{3j<}qC>}{rH4r<23d$vhi{9InMO?!Q2rZ}UM=v0J#$kD*$fH_ zTV9jHdb;1m&Or2RwwLB{Dm+}$oEn3;C7671j7Eq~2m{Q(#l)EHMKb~f=>NF>6FwN~ zu1j5JxqVceV@dfOfzrw%sll}HNKO+A@t6y!dWaKe1lp;oNc}|!WyTkrdXowqH%=id za+2qesqT2PDc7!ivGn=|X1XOx;w#n*v2+zHBMK+Cp%i9zk0#+o)%;>sf2#8N6u~x4 z5?g!jI9^;RWH>mCHkjXR0DX8Y(#t?6<<{fYEm`r*drBMtD~{cGN!l#P6fLefOx=y$ zTo^Cg-#vb_`T_-ja8a7s!*uJXA=+4k0OuaEsE7hW>mc$SERmZy1s!YuVLWI6Y)k7W zMce#epX9Yb{4dPzfeJPt(_Ds#3Q|w8Sg}fWl!2rlIiD=q)u~e>aAL3Bk{JccgNTfM ze*%e6GCrR*_nK|Cn3qn~Stt&#K~b#bhS=$&o|Syrl}Xx`E(^EEp-P@j*g|v_c940u~k5t6NH^fP1+|8{0*lwBY!nAaE@bZ|XjFIv z_QTOa_A5NK)LUty^psgVeIu#2d$$8x&3M7Li^e$wStIJt`sTbr5VV;Ukietjuml{e z^2c{hL=vmCG{ihD;As~;R$>Qr1bRXjT8j%$o(Q>RmFYhCjP=&7%%gv&?7aZ*QlLOi z_pWPSyoFO$)8*r~Gdi764#KcSZd&K4i7klmYq%&b(wBv`hPACgOkO-K(X-=s!^sLBXf3NE3UA(dJS!KBs)?61-7>!%LQSBiCir_SNLw))(4MpBGS3l=4vnOqxfK63IeN%%$9ya{V9XZ z)$EN7M!9WWs4Y5UhlgHv3SJ++u2!W}YeVAoB&g=P*oi_^)uYPG?Ne9*fBRUpfNbb- zBujgoOk5MHe#6~(WkE@EaB}5H9)j3m@#aM;Aj6lWg75U!4M-j>bOOkH>HSS)ff)Kl z)Nx2qP~=hL&7qg-0vK`~R&McNL-8}P?2+{Yv?pG|5u-Q|imVu#<5t7ao)mN+TLFy! zKseV%R1pHkX*HkH@3p3aLM*)2wJsO5hd%f(i3&Uvd?huP`}#%c*Q=S0cAI)oMD!X> zsp8_MP8K)q-2AgA{gsmZm}G^uo|*7wYTm(yN_H^R+cXeO)~^pgRS|NDcl9(FYHWdk zaYDu4%r$K>Y(gi?mfxLn|BX!eLP?|Nsy+X5o@QUpBEcwu|9108W04Y7cRV(UHx7c= zQqEY+1T;nG=g?KP?5y+M#3T4H*|EoqY-KAZGA*&ko}r*p42{%GtF?QZ+YS-syd;IJ zl3929W3;s_4a(s7Sg>L(709P!?CvH2@T$87f9CQBVNQhO&@MfM*FJZH4O>rFn^HJm zxq*5+yAdx*yD1nx{+g#bq6(;P*(bTXmK6xO(PNRISxn~&d{veNg&=4K z&`y<#B}5N`h(R6Sf2iQPXk~r&v@?i@8hWFYm4rXPx%XYe79vov8bAaStwQx{r`-H`E#SVVhfJLq%e9ZF zf5MmM%PS6BULSZ>Lk?*A5KI3f{0 zk>0B_ZeyBg4=DAC=i*1o?|(BwnnF@Tf&C-llh)sYx3-U+=%T3 zn$8b3A8;<2M^gwdLf6XYwb0Zkq&iq8t?sE$9skucph$5Z^vBxo?eU>b0TcYV!VN3vqo_#o^>DC%tSlSx}RvwFg7@;(t zD70>8kTJLz$u0nSXiU-`CKLz$m;aFq!S(3^!>X4Q81q?8kc9+`n0T?z#^%H6%hMnh zHPhmTdJ#QkVvz7K5%3`d3pkeQsji)UKK}#nkpF7X$BsX(C1I$cARUFsm+74wQTLF; zYr8P?leRFzN5{6ZacXh50k4l2EkYs+iU{ereL;w5*xd(z2yW!@8VnQ4ecxa254|Hq zO%YH~LrcP|P;FMEMrvA1I9+3cmNNnq;L@JvIb=O ziJCWU0A-W=bEO(Y97b!kW^$6%TK{t1)H}08{e-3yzUghlz?^n|h7oEDd6YOwOi&is zvKZ%Gltv=@@TH}4ueuqv{NE31Z1T=`YAFb`9ue%ou3KjgEe>SjYIgejIqazalBLcO z^*l46vkpgwHD;i||1MLQ;st}SH^aN21CKZj6_7{R3T?QYK`92fd@1ah=8)SSj8#gu z!fl0@@=p^x0-Db^xI?}Zsh{A*L2zX-tjq)1`>Cn0(ZP7akDoZoWk6|p8GQE4(RqLo zru++(Ee6$WCCe~O@`uq9S3ONAX_Z$^=Yig8yg?qfx=_vWFM~mXo}3|f_0$y(nZz$| z-gkil&8})_C%YUK7LSUem#S%8q0b+(>?T4b;>dt@?1jc_U1ZaedQYS6r+15#zx5S_ zDu}Am#PrzaSK*ghHfYG6>FbWrM6^TEKxj(|rKApK@}UvS}D;dFm%BgyKCZlHg5l zw?nmLiJ@)9Rb$^v#9yO^0C;&$=6EbD0cX>80!myhB$9or$E&>(Wg4WI0KwbAbLRhV zU+7drk6TcYSO8GUnc8hKTLj3-!f!Jd{^ox@&QB71m%{jCJGW4ap~q)S`$q0xa=fKh zul-nEk{elA_OZ1A*K^Q(in0H&Q?AUUKx-wSl*0ePqzE2ml`T3=ML>!h`2stK-;v@V z7RCU|xIwX{XqyEl+0IXy{o=g6J8Rx1{>^#1P3V-O1`fmprLS4&<)n;AodM~o0?sr| z*yU(v`r1@vQ9boW$)3WwI&jXwAofxtESie9hHyW@GZ?-WLB!eyeA z+Wf3Y7?6++v2&O)rauHz8kVLitD7aLW4r5M3xX^Q%>Dk%uOG6%9*>`Ls4|SlrUCwi z>aSB)CUbeme&B`#qXLw;b_C{*OBo*YlwyWyahBAeH9)Uv5`pCYv6PQY?xoIio0V0XPEGwVa{@apkhqyghaONo+cygng;#>*CTr6U+?Y%bn3s! z%?GKhx=o)%IBSnwbpP7uW{USgOAa63z0xdDy4!~o>8drJdPw)f_$4zhLgA$f4+?4; z_Ru9Mp02u3|Fi5aNIEy*aCBC@2=C2h=i>sIJ*@Lb3z`CsGm`ZEfoRgfo$NP-SqCYt zqF(6kLyyu%Cx#OhZrsB)-xhGoB1&H%mBJm?=K4a!1s0ramo&qE#w7zvtPKlgR)j4t zmOWrvVp;1%deF%bb0r&712jD`45>MF_?Zy{aj{$L7D=&xZGYC8*yVuD8~uP8$#xFa z>er${gzwDIhp&OX>{l^RYI#lzx~vWYe#^92nm&HS;ji{4nIG zQ1Sw!a@q%xV>Sja%MIRRlefQfDoRl?z@eZ-d-|v16l3_?;tr14p$Fzu#br*tV3soB zq~b~Ch6C`g3*(IMM~hl%2CS;k1B0-c_R+^P*(d`L>{@n^kKTMoOSb?Qmh-Ldwx0E> zys$u(!yuCV!8SI%2BwmT4~qy0OPD=xw1?^y6AX+Eb_LEmo4h|`#V9jY8g1+4MtOfX zP{Y8zBpcu75hBLzhOn1-dnk1u1(l^bD~p5I+p^m?=1<&RBD!_wN}Gu?DI7GKE2(Pg&?vLm z2vl;*f_B7ZsK13&m25Rk5a&h16NEyOcRplR$Si~pQxhK!_+};(QW{7tnS@RHCiUr5 zgOJ6B$z}e-1oc)xWD<-5%2CLEo8Jfo7YJb6@_E{XupgnT=-%+#2!5dAgbF+l7cUZ2 zy4pboc!h%I-ObLyWkXuScnw04^_?#&x`{h8FNMh(5P%aCtsMGsttFyNDlGjMIv!*% z=f0Q|co;Z;+|zU6VpbPO3PsR9e@&)~6!_YWSoa-DJ>ZcsNqEA!PnN#yZM;yo4}o!k z$z-3X7c>Z$XGhi5DFAN$lIrJw+s&SM>Y?SPK-KGm$@7)Qaz=DrN2hHRMn>lgB4izp zqnUoQUJIl|`JYp6R8aq3<8)QZ08TU9kTynoW@5#la+S_Bggvm zy-;vo*h2kPhlUhkt(xmwy^#wl6C;`nDvK+g6~9ZaleBQ@7aEkj+m6JLJLY_>H=0uY zai}>CY{hhd2FHzTS5YE%gQ26t0{(TkSp*aOP+WQeFK&sil@Zj~;b8JV9{`aS+L&-h z9r)UqDhmmjP~|l-EUue+2^D99y~7nQ(6tw0gtssmfC@TtEXMi~6sV5NL{AL;fCc4Z z!kJ^tjL?1I%B4nVDGXI>mrh*e{}(5LJ-~O-)K&><;>3XEfHRVer4U)MHC=>=`(x|u zZH_}PAodwuBImGmet_9ov?r$AkLRY>k|4=k2ri-EcKm&tX4a)LXw1Kc#w8t~2EHTH YA5Gt(Z^A@Euft$~GAhzllHY><2Ukf$FaQ7m literal 0 HcmV?d00001 diff --git a/docs/user/interface/BButton_example.png b/docs/user/interface/BButton_example.png new file mode 100644 index 0000000000000000000000000000000000000000..581e708d12d269b02686098f24b819577fd823c2 GIT binary patch literal 4803 zcmV;!54Tx0C)k_mSpzDf~2HfSV&dEIfjae*|EF00_tf6%IF5!1D9+0{_@P4xo`}yK69)>mS4Z z`-C_zCY1{S%uF3ecShnf4r0um5KDD;4EkY zt)LxT1GhjA=m(F$5Euoozy$aRrXdKzLsWLJY_ra)G>{04N-ag5n@P zln!lxwm}6@5mW{pg=(N*pbJntbOY*z9zes;IP?zs0wXX5mV^~yP1p!#z%1Ak4uV(0 zaqwC=8_tDy!=-Q~dVqKRg7#f+rDxkP&G_1u;Mvh!f(AL?E$<5ZQ#}BPB>B zQirr4UC3Qz2ziZs#^5kC3>{;DvBkJ!f-zjoTFfTQE=(Dw8q~&I;#_3&$nm*5h{J4&mx?ZMa_C z2yPOO$IIgN@OF4#JO`hK&%+EMg(?II)Fzhd4@{CW(`@NOq(kQX**!sgzVlx=MOXdQT>kRms+5 ze{upjhg?cNL%vQPCV!?#P;@Cylt@ZCWjEynrH%4{@}5eiYEqfh2x=O2H?@X(h5D5G zNrWb1D8d%uiEI`r7ikpf6L}*_6x9%AiLMgO7A+AyCwfQpwHQ%MQ_M+>BeqGbTS3E_0m-tEX8{%UUcnM7j7YUw3uEa5kD-t6#gr-JwqH$^4Xvb++X`_-j zNi9jXWTIq&i!5E%MK(!xuWXa-6FH2WuAINzI=RDgSLI&IOUm2I zbLI2p&&oekfE9EV0uqKrsaWZf(zr5B*lUDKhz*CuICEp+2`%XRPQ!FrZ@33`Y0diAmT*7|(?O8r3tiUG?Y!=Tn+*ihQg z%W$h3rVHhjWnwLE6|@#Q0Ss&*W^qjp2~bo(g#pX`SmR2(=Cl@8CC zYD^xpiur=2!%AeGV!d%Rb`&}`I8Hg)IBj%lb4Hxqob#Q#T_jwBUCLaZx~jUyxz@T) zxLLTZcWZOUx_i3sbsuCavbpRU_JoI($3~A%Pl{)tXPM_SFI_L8SBp37?cu%8`>~IP z58tQB7x=P$_xV2Y)AC#E_p3k7-_O6?|9OB(z=nXXKw9AHz>|R=gB*hjgB}HI2d4*j zgouVjhSY>ig*t~8g${)og>4MG6)qQ^5Z)Ytj|hpVikMvCvSR;=(MXHPyvTu-S}QYG z-dH8KDtXn#)uO98tItJYqe7!jM$K@1IhCBrXm)f(^aR(5dw~0j$K)0B#$)Vaieg^G z+Qk;dj>Xx5VO1)Wx-zvnO%gRVx6`%Lx2F$h*k_byd|DT>?p&sL zCO`9bmTuP0tQXm?**~wxtmm%p*r2ju%ZA~Ntc^!EL7SpCb!=AKoV$56$1SIN3u#Nz zmfyA-Z!OyTVO!|7mR!Z$oZOM^Zrf|~MDm1rgF9?@9QgtBL&6W;JI!_;-1#k^mw&Us zxS*t9W*2wY%^yvEEd6nIckJ%&Ld(L#dvJUBdj|G8?5!>mFUl?&+2_5lv6x<*U;JVJ z>isuL%u9|OARS0QFjVSQ+I&#`;GTmsW$|VG<&Nd`6$%wQE2a+d4)q;o9jWyvwzv5aHSkB1!Z`kC=_O_f|#LDkn2{1Zdf0o9!~Ry8#z6;2k` z!nNtOyVvfq@7?P6>F*r~9=JakIXHBmcYo|b@`JYzGagPq z%6W`^oc~1ZNy$@%ra9g}{O zPd}!7oSw@6B>SoQGvjmDm(VXSrq|8jXG*{7d~NyW`R(y+%IvIwBjn6`0R$c4*jNDG zodAFu4gd}H#iX_cFFYRsE%Ha+EdDE`qWj z6M!HlfX&R7I#_6_v1X?81d*FiYf>^h`yTa%cpU(~4$jU_H_gs|twKHfLjc-7E_m>{ zXt7fOFg;n;jNog*pL6Ede>eOK8p-Ko?1Xfm00009a7bBm000XU000XU0RWnu7ytkV z@kvBMRCodHoOfsyO%TAp#Lq&o;XhU^C@9w0V{a%bV*Eoy1^>_(5R3&ug9U-_LJhecZb}&Ar^+nz#4IGCMmvGdHs{d+%=N z#oWGq`yX=!ZGqUJ6)^IDTEMtLi*;b!VBDaE1+-A&U#Z278#g3u03R&SzI}Ts#Uv$Z ziXees(IB*V^5jX7>O_a^CQX`HZq(`qhA&^fY#}n;3bequapOLJ{%m1r;|3@;Zro_0 zGu_B7@b>N7$&)AB^09XVq#r(fu$^F#t}RehRHT}#binbN<1|Gd0B zS{}y12!<*V&!0bcAyLK61uLe&O?4^VpqfxFd|FysMn=Y$FJCOPzJLFoo0~gv;>3Ra z`fc61_2b8n5cKZd``*2K0GO;%qeddP+`W4jyk$CbCrz4^nwr|QX;WI@uoH;Xi z@L(}Zwgf@nzI|o4PoF+uL>Ccz_wI%HiWMuiZQHhI&mM^vfURhT4jnp_m6bJZ+B69G zFbw9|vuALlC@+5Q+_{@JZ7L}#37vTO@ZtIM=lAT{vt`ScENAYV zQOr%o2fzX399m#7;6vvEU%7InLx&C$2^{(!Z1(KgJ^sG{@TepcfURhT2nFZ|3>Z+q ze*NXkms@6e-Bms*ef|11a@jDcTet3n2@_VYUcGSPLKq6Rr%#{89CTSeZ{PYl|}E4e$hk(D2%|YhWZz$BrEZ+^JKiS+izIyZ~%P z!v}vaUAj~f3(mCR7&%mdfHE2)3_zx%rC^ejl*H0z7nPV^y?T*|?%%)v;K7534_}~hXhQ}bnDhl;sszUnju2- z;>C-CMz*oBvFsVL8zJD}Hl-UJ=9G7+MvWS*N*1-8ICkvVWy_YGI(6#(`}fzcU!OX4 zsu;q)>({Sm-=<3o3`Wk9z>pzBcI?=(YSk*fj?nJhxid6zk>YUx*SdA<{@Pa>4ei~a zI>%9IZd*D#0P3@H?|{ z14QlGwF@UTn8+<~^5n^KxB+<_ri)yv;Sg#8abh|YBVn^QNK*s}*e4}4()j~=kOuQc zwuuIB>{?E)#tr2(m^b8qlN&NKGrciF@LZL9L$InnefpI1-kc8Mggr;$sTvAaAFrkB z=mx4w_V3?MeZ#0xqxdjR0Z8<^A;2dk4zg3RBdQ!~)~ty$q%s1ar9Oos9~{=Xb7y{R zQZK}UrAY18ty>&Qr}7XEl&esp0)FMnmBWS&ql$#{S99jf@p@^y;ICseVB)S_yE@zq z1*6!Ms;s!UIC2-16kX8*Q?x^2#HUZ6Co3&j$1UP71RMb z80F5LJH!fSdFs`xM@@<-NZP+Ua89nL5&E|yH#V6^oCN-Cp)nlE_|J_FR| z;|Xe>!{rLC9zA+gSXd}VNl>CfjqdB$uPBo$yJcM24F zW~E|TXoC3!K3b0F_J!4;~cw($Z2g5*J9S-X*;Rg1RHAziI{O7!CYZ;OU4m zTlUymwQ8~JTC^unxUqtQf}=-|^0ypvA7<0OaNz5}0?NI?BYB3ctp$u5Y|Y{~(j+CnEp98%M1!qa z{6?B+@Y~|H^6cHfISyNDgY?J(HoqG@l4RIASitNJ4#x3s$hg5jTRTWHZg4P;e?!I% d{@L0=(tnfrS=9|%*2(|?002ovPDHLkV1k09D7OFr literal 0 HcmV?d00001 diff --git a/docs/user/interface/B_FANCY_BORDER.png b/docs/user/interface/B_FANCY_BORDER.png new file mode 100644 index 0000000000000000000000000000000000000000..4f05474f652fb8737601fb192aa5bd875d149168 GIT binary patch literal 3476 zcmeH}`9IT-1IORwn4^*VBUgzI$0)M7=00;IN4f7Aa+{Gd!!V*EDsz0oMDCnZ5y@@B zW(zqMBDds9zJ33V@8kQ!^Y!}W_0#L|`r(yoZE1X(QO3TMAoN78O9c{+G+AYb#^ z!2*2aE#m6N^QD7RI!FeHrLR^5xcpni1CuAMC9jFih+}cb0HEGef?zefj_sWt<`bGW zxahH8TYysT56P}SM~P5~>{Bk_Te79`j!o<3ONGYKI5}P-6Hutzig0-W_*`K3F+E4p z%}!f_2F1T#g2u!g!MZBpIOuE#W(lG~M1rYvCltT3+oG-;WiB*?$+U?Zv9}Y|tQnH^~`M z+jqV_v&}8lOcl#)eKE8oOk`()g!vm44V*{xuqP>Ag?x%O&9n&dfvj*KS4$BxRa?$q zPKB^3c5oe!#Gh4SUF={HDeLwo{`&(nCaRmGbWTzG;jrFJi^zTTJhJL|S)OR#vq6iK znTFQ3rds;m-qHr|1&e(rMmg#$7?8efh!v$I>N^G9p=dF)L~#nJ++UO;sx6?DW<9q4D&0 zoC)E!O&FV%_hYUq5_dk;ti$u2J+p&XgtexFWgkR52kO+fO=0WP>wm;n!v0*3yH_GC z{%sL(Neqvjm(tD#-^DcPvRa?9WfM>GFLEp5vet+=wUQ*E(=`J92|i?&R$|Rb6!fs5 zfqXmUY5ZWULucrwBlPTWQdC!Ih)gVJP~zmAQwUs>r5$_m4Cc`pqyek4jz|jse42q& zT?#Kf@td@aiHuEhgOp3Ji#I6xVeF?_B^7RQFHBu`ix*bedC+lCc2M!gKSa^7l;w|8 z-P~TXN;9>#mCW`$0SP`{UA3XKNSbCKM-%5H<{f^mC&Lpy9|A=ZgoZhnGPrtV=BW(S z9C&Ue^lppm6ex%67IwOQ+M6@pDg=3BuYSm$HA|7&QuRz{z|vu+#z4|M|sb4ThO{BbTZV8Ae)-iV1g=*hhvu;05auW_sQ##&D#s_Sl1MZPe;JCL z^y@)7Ad8JM0xEx;2TYjTFtUS#|e>A0msN$r4hh%+N`4jUq z*9Sjvd%!bi&Dp-WGMJv7{+9cetdXo6(Us`7m?rN+HN0+$stL?m<%gvcstN5=>aAU2 z4hyaW=KYiX;R`zpF^<+j{$;e%qWRkZ)*3%pKKO=D)&uW&O(X6=OS+9nr4QHo>mBg8EwfrgXXT zxF-cqQ6HBbe@b~rQF}E}0Uww0S5lc*1^Y!HZy^1VIREvLz)`WWC!ak7d;%!`T2!LH zhF=Y(di;G^!kEYR3(I1o%b$}X6(Sgs1CblwKg8t3aKt44jM=R_q#ni|n;q+(!ZQs> zbrn(FY1Usx20~tYWX+wGjw}WhzcX?%nn_nk&w7}77Jl`y(v}k4f7Ek(*mfd2z%eL> zobJEq-$bvZuU54dM5iBk>>LTHa0RD{3yBN4DOAZP{sk>+6&qzaGT;Jy@VMg zRqB_|F>fMY?;_5c=c(kqxgJLsrODC@8pNHd8#R3owicvO6)3T`VwC=`h@(qKg{#S8 zwqj85Q!x3N{|$*Z_ycTdmzj6I=etl9lz{qms3nXJy&K^lZbXNpHFO)>YA8iOElUj4~~)@Q5PB^QCJL7s$U3X=+fG0BUc-lH$n8@n(HPSX9Hv^wadxF6D_$}|EP*pY zf;E7>j6Etb1!sU8PrQ+&o-C9EPWmV5E_a)tqHqE4SF!j^Q0goEGv~Q_&lCJ-leFHq zz41>S<*qq=y)DyxC7RMrdHEXlnr!G%tXFJlG!zmGdrIi@Lq!<=WSL04hdILcd=uRH zwqnqBnmUcEXDg}}nmp_|rowIrUv(}c$yzP_V(bN+9w~=p$0(xe) z{jBd<;HfjMMo5dr7q0OIQdUY0RNu8fjr@969(GrnL2m?o33>!go+PLDb<&VR|(kUei;#RJ}nfs`nVc%{{DqXso82_fjn~(0-E87Om2w zP!_|5G#|~GX%Y=q_;Tps^t~y^xqFH*^>{64GGNDGJ25&zBQQ$rfN4j+lV@6E2qiIf zpir0__okzzsKnh@IBH@@(&B;qaVRQkb$wlLptI{<$i4l0Y`@f3s}%Vl{feUWrFS)T z&s+&^zdcS?j@8Tt%`?QL#7*EzwkvjDVy%y73lgsRZ2257WGw6oatdn55y4yFU2$KD zYK@oZlG)zeLcRy2xbZbVuTo#1KIN&pbT4vdve?Gq^Q~};r_Oe|lnMUd{Q49oO1`SS zs_I2SOCf4!<8mXT?7Y=30i`|djIfSsa3#H;<%VWGSX_YIZ09EIYEFh`gjTP={d9n5 zbJTwzJ^qXW{VXt}GA{OY>fQ&2o^je;^R60Pdx4)FQlb4)WZfp;vdwxaeSn^Oagyb3 z%_QTCvATVfCW#NV;93@k*s~+Qo~UVcZ5!=gA;nIw$NV^*cUCy)YS8uR`nMGHcQ;G|&0%vucO=+8&? z9Uk$l2U%8dVl1Jc|K!3^`QbH2_(bjq1VWq`nnjqkuf*OxSUgzU3hZC4#7KV|yvM{M zK1aI^e9Z?iqF~_kZg)u&D@0S0Nnt-K``@@d*Z~~<0YbJYl3=!71bBy8q*_j6!m?FI z6tVS^{1_=&%+O$t`fb1RI$z=r%i}!j0Gq2CM-sa@v^ek{JUncvHZ=U8N>A%ZANZoJ zh~8}VtGfj#Y2Bfw&jx%b3}2jxQ~S*&+PCbznix^|_lk0anA`~m051Oj!UVh^hyVa{ zr>TLiEt+X9M>hj&Ezt2Pl|zHP@EFE~n7y)!>kI64Kv38$Ryeh1wny=E_0>Nd3dzcw z$FSn-%Qf-X`?QT&^})8gleMGEt!zZ3I#`KqvPNMbZ0hq?D%<+r(I!ZXqlw(Sp%L02 zbc}E>STYtQC#)UeYBOg74OKV$;~?S{C<#}kujOX)&nj}0h0~)d__&BG3v;ZD{ECm* z@|bA!2Xxt$I`<0K|Hu9Z3wdxqX{u?BQcAT_+0>+Ik}nRASDh$_+?m)#N5|C$HBW|? zGQv-D$3-&uuUm}OGNwY?j@*lKGjw~~3WZjuxlZpK0~cdu+1aWc|E?JTObsm!s`cEl F{{h$Av6cV; literal 0 HcmV?d00001 diff --git a/docs/user/interface/B_PLAIN_BORDER.png b/docs/user/interface/B_PLAIN_BORDER.png new file mode 100644 index 0000000000000000000000000000000000000000..ab2abd581f343bebdc52788e39cdf517a29fce44 GIT binary patch literal 3369 zcmeHJ_dnE+1Ag0QbYy>Il_(h}kvkn{@4d74-612Kk#df+M`e}^pK!>E5Qm6lkBsAt zY$78hEBW^QGrq6a_lM_setCX+p67=r!Nf@W5)&U2005VCbu`TW>eIi#fT;g+DJ;bw z0GLA2>gp!C>gvKK5B)sRJ{|xNN;Q#%v@!4H>s}|MJEEwHIKp?OuqtY-tqP`$i~_DK zn(eWPjW~(Kcu=VX3G{m54d;Ce70#J!1=z=`+;qVXlJQJ^O6~Z=rr|liqyAU$J147% z-4>+m?u+#k8Wr?1h_?4FFChL~&IOw*q9h5&rAE>^V*yYP4HsC!vVH&Hfcj!e8C>uT z)$A>k{avW@&shuO&G}$1VEf%ZC(c8H)LO`N&->=zFFzael z>-UnPiWkdf8TEy2{TxREfzU7dFc_gx)bSYdP4DN&A;vPCyAk>zy?%gQ}%5*q2WdHt3 zjzxAcJb^#0>E+-$50QZu^3Y4Gp#K`On*lE^3;7(Tn`Y?m0oi0kZxtg&EBEZDY5eJ> z+nLWtqOQo$t+mtgmUOuj|NV{~<5SI&xhk!kGNd-&$op6^cUXSBB$qEYXTb1czOJdc z;VtFpXnmLMy5X_iaxL%{rM;`ZKF=ql^gfFl(6GE9%Z;2S`7#uArsPTw*!0A`IP0Kh zXVa9p&YXee8=Uy8aijzDb~LB%l<4D z(PImeDC)`r0ehPFDy-ia(%RX0>8jglk3qz%pbmA5c=}$ozNhp>3@_AJdITRvwG;q1 z`4e$V!pa%o2iOKxI+M#5^a6OV0;d9IlY2oln|MK$&JpNO@F}&33|&?Xmy6*P$g^E? ziUW+Z?g;o{3%xRg59uuS7mZ-@jhR`r^GCpG+i*87W1n6|YtY?R;f?25O41OniD#q4 ztcZx}h?>RK2|M&SxP!t{B0ew3$gv2xVQab?-Eg<<2W$t#2BZ!CA@YsIZ+x2VVsR6b znSX0hL2bqA9qr-P`8HrGcna>r*uXS{ZB5+nPIW~r`9skJ?jff2ROW8cCGs+65xlq= z@SxFg7UavG*4@8!_yZH_1ZT*P9qttRl;7d>`DjslFCXNNll_>npcgOvgVByrG$uVp zKSsHOxkJu0xm308>M48JCrQ_sibWE2OoGIXGIaD5Jrq`Hi&OTo`+0iBUS==GL0){p3iYw! z_|uG2-54>~n;qPX2|nE7JZR1hjxZ5D&IvY;gevwyZmG*kH^Q}l*7KSgm=EYCi!|s~ z*l*#c3Z{ynhO-*8)^N>;>|@=%D@$(dp^S!%JdAl7RiADrNU)2@#SpauUk9LPP~B*2 zbm4QTu9R+r`)l{86?Cs}FQYi4cwiY@nL*jZvLrM0(fB%|oSou*lF4bsPwdZZkHmhP ze%GvRd#m>qew2*l78Y|cEioseBhhIsNz#F=c~=)x?UTO60ZS%S5!z-In>rs_uR8YY z_s#SLt{$uo_aQ8>TtQsaoMZ`p^TtYEFkg1iE?2y=vkSIrLB?Qsr$_Iac?q|Z%c zl2POR#>x=yz;4nb(r&PjyF_i%7T>R!xXf;?G$Z3gWC8NU`W=V^ z$4}E;++C?%l&mZ>9qZvUz0P&0P1yp=(ct%n)1%getXs~>w`!itjcUP=e?M@Zcy7b2`rc|V8E2!qaRtWa7njtiY$#qMWgfpY{ zN3-S|`23`%PhIT3HDuX$%@SsxZTrr6A872yghk);3E@AXI#BOmox3-P5u81d%Fm8` z*WOrA#(eWetUy56m((I5vX+Fw&YjsVIBf;sn z%f;rog5H3BD!;IR4noFa({eh(LC{s*F6a$cn^Fi;3-&j?{#R= zLQi%+`x8>+_%_O|*wdr;_H0eE+i+SO|L*CFy+FfEdrQ@cNsiwf>JwBGujH-d{ zc+Ld$3+KGtIRDq#M<18fw38m_cUH%?<)JLmQf)VbYkshAnC%o(`YG8rW@sN&&n!=C zD_VuXN$i+a$C60ok>zmtWOb8c^Jv#5DPnFX{QITcD?GlkzIW$pTP8whmN1=u+->qf zb{K`PHKegwx4E&==9VL~e08TYhxO*kotoXb&7+N70gzxLf)@r2$`6U$Qr(Y!&w5AD z2+u$7li4E>2yt?70jbxv8S&s`?PPn;r*EqQE3z{1h>BKVamohx z`U=4Efq_ehT}2Ia5V#PP)Nx40zmZ3<6GZ4o$gp97AhpFBz&1oH+;|E5FhhPs8dodC zffW|R4i01~+Mvp6Jc$Ri&vH$?&1CPL2_D9V3IHF#LqkRigF{a$)s)WEfoWyw&>u~x z8goEK={`Am!TV!=;M!!Q!f$52-VOJyn4tW>SCr9T=YAjnFmwDDRKQCDF91+m>uRW4 zgi>vf-v;AU01Z?5U-nUF`KbO@Y6X*Ap}Klx2rl; b%&ox3pvytbT&bsjcL(Td8fjFiIph8VUsx@b literal 0 HcmV?d00001 diff --git a/docs/user/interface/Bitmap.dox b/docs/user/interface/Bitmap.dox new file mode 100644 index 0000000000..9180c21af6 --- /dev/null +++ b/docs/user/interface/Bitmap.dox @@ -0,0 +1,556 @@ +/* + * Copyright 2011, Haiku inc. + * Distributed under the terms of the MIT Licence. + * + * Documentation by: + * Axel Dörfler + * John Scipione + * Corresponds to: + * /trunk/headers/os/interface/Bitmap.h rev 42274 + * /trunk/src/kits/interface/Bitmap.cpp rev 42274 + */ + +/*! + \file Bitmap.h + \brief Defines the BBitmap class and global operators and functions for + handling bitmaps. +*/ + + +/*! + \class BBitmap + \ingroup interface + \ingroup libbe + \brief Access and manipulate digital images commonly known as bitmaps. + + A BBitmap is a rectangular map of pixel data. The BBitmap class allows you + to create a bitmap by specifying its pixel data and has operations for + altering and accessing the properties of bitmaps. + + To create a BBitmap object use one of the constructor methods below. You + can determine if initialization was successful by calling the InitCheck() + method. You can determine if a BBitmap object is valid at any time by + calling the IsValid() method. + + An example of creating a new 32x32 pixel BBitmap object and assigning the + icon of the current application looks like this: + \code +BBitmap iconBitmap = new BBitmap(BRect(0, 0, 31, 31), B_RGBA32)); +appFileInfo.GetIcon(iconBitmap, B_LARGE_ICON); + \endcode + + You can access the properties of a bitmap by calling the Bounds(), + Flags(), ColorSpace(), Area(), Bits(), BitsLength(), BytesPerRow(), + and GetOverlayRestrictions() methods. + + To directly set the pixel data of a bitmap call the Bits() or SetBits() + methods or you can use the ImportBits() method to copy the bits from an + existing bitmap. + + You can also draw into a bitmap by attaching a child BView to the bitmap. + To add and remove child BView's to a bitmap call the AddChild() and + RemoveChild() methods respectively. You can access the child views of a + bitmap by calling the CountChildren(), ChildAt(), and FindView() methods. + + For off-screen bitmaps it is important to lock the bitmap before drawing + the pixels and then unlock the bitmap when you are done to prevent + flickering. To lock and unlock a bitmap call the LockBits() and UnLockBits() + methods respectively. To lock and unlock the off-screen window that a + bitmap resides in you should call the Lock() and UnLock() methods. To + determine is a bitmap is currently locked you can call the IsLocked() + method. +*/ + + +/*! + \fn BBitmap::BBitmap(BRect bounds, uint32 flags, color_space colorSpace, + int32 bytesPerRow, screen_id screenID) + \brief Creates and initializes a BBitmap object. + + \param bounds The bitmap dimensions. + \param flags Creation flags. + \param colorSpace The bitmap's color space. + \param bytesPerRow The number of bytes per row the bitmap should use. + \c B_ANY_BYTES_PER_ROW to let the constructor choose an appropriate + value. + \param screenID ??? +*/ + + +/*! + \fn BBitmap::BBitmap(BRect bounds, color_space colorSpace, + bool acceptsViews, bool needsContiguous) + \brief Creates and initializes a BBitmap object. + + \param bounds The bitmap dimensions. + \param colorSpace The bitmap's color space. + \param acceptsViews \c true, if the bitmap shall accept BViews, i.e. if + it shall be possible to attach BView to the bitmap and draw into + it. + \param needsContiguous If \c true a physically contiguous chunk of memory + will be allocated. +*/ + + +/*! + \fn BBitmap::BBitmap(const BBitmap* source, bool acceptsViews, + bool needsContiguous) + \brief Creates a BBitmap object as a clone of another bitmap. + + \param source The source bitmap. + \param acceptsViews \c true, if the bitmap shall accept BViews, i.e. if + it shall be possible to attach BView to the bitmap and draw into + it. + \param needsContiguous If \c true a physically contiguous chunk of memory + will be allocated. +*/ + + +/*! + \fn BBitmap::BBitmap(const BBitmap& source, uint32 flags) + \brief Creates a BBitmap object as a clone of another bitmap. + + \param source The source bitmap. + \param flags Creation flags. +*/ + + +/*! + \fn BBitmap::BBitmap(const BBitmap& source) + \brief Creates a BBitmap object as a clone of another bitmap. + + \param source The source bitmap. +*/ + + +/*! + \fn BBitmap::~BBitmap() + \brief Destructor Method + + Frees all resources associated with this object. +*/ + + +/*! + \name Archiving +*/ + + +//! @{ + + +/*! + \fn BBitmap::BBitmap(BMessage* data) + \brief Unarchives a bitmap from a BMessage. + + \param data The archive. +*/ + + +/*! + \fn BArchivable* BBitmap::Instantiate(BMessage* data) + \brief Instantiates a BBitmap from an archive. + + \param data The archive. + \return A bitmap reconstructed from the archive or \c NULL, if an error + occurred. +*/ + + +/*! + \fn status_t BBitmap::Archive(BMessage* data, bool deep) const + \brief Archives the BBitmap object. + + \param data The archive. + \param deep if \c true, child object will be archived as well. + \return \c B_OK, if everything went fine, an error code otherwise. +*/ + + +//! @} + + +/*! + \fn status_t BBitmap::InitCheck() const + \brief Gets the status of the constructor. + + \returns B_OK if initialization succeeded, otherwise returns an + error status. +*/ + + +/*! + \fn bool BBitmap::IsValid() const + \brief Determines whether or not the BBitmap object is valid. + + \return \c true, if the object is properly initialized, \c false otherwise. +*/ + + +/*! + \name Locking +*/ + + +//! @{ + + +/*! + \fn status_t BBitmap::LockBits(uint32* state) + \brief Locks the bitmap bits so that they cannot be relocated. + + This is currently only used for overlay bitmaps; whenever you + need to access their Bits() you must lock them first. + On resolution change overlay bitmaps can be relocated in memory; + using this call prevents you from accessing an invalid pointer + and clobbering memory that doesn't belong you. + + \param state Unused + \returns \c B_OK on success or an error status code. +*/ + + +/*! + \fn void BBitmap::UnlockBits() + \brief Unlocks the bitmap's buffer. + + Counterpart to BBitmap::LockBits(). +*/ + + +/*! + \fn bool BBitmap::Lock() + \brief Locks the off-screen window that belongs to the bitmap. + + The bitmap must accept views, if locking should work. + + \returns \c true, if the lock was acquired successfully. +*/ + + +/*! + \fn void BBitmap::Unlock() + \brief Unlocks the off-screen window that belongs to the bitmap. + + The bitmap must accept views, if locking should work. +*/ + + +/*! + \fn bool BBitmap::IsLocked() const + \brief Determines whether or not the bitmap's off-screen window is locked. + + The bitmap must accept views, if locking should work. + + \return \c true, if the caller owns a lock , \c false otherwise. +*/ + + +//! @} + + +/*! + \name Accessors +*/ + + +//! @{ + + +/*! + \fn area_id BBitmap::Area() const + \brief Gets the ID of the area the bitmap data reside in. + + \return The ID of the area the bitmap data reside in. +*/ + + +/*! + \fn void* BBitmap::Bits() const + \brief Gets the pointer to the bitmap data. + + \return The pointer to the bitmap data. +*/ + + +/*! + \fn int32 BBitmap::BitsLength() const + \brief Gets the length of the bitmap data. + + \return The length of the bitmap data as an int32. +*/ + + +/*! + \fn int32 BBitmap::BytesPerRow() const + \brief Gets the number of bytes used to store a row of bitmap data. + + \return The number of bytes used to store a row of bitmap data. +*/ + + +/*! + \fn color_space BBitmap::ColorSpace() const + \brief Gets the bitmap's color space. + + \return The bitmap's color space. +*/ + + +/*! + \fn BRect BBitmap::Bounds() const + \brief Gets a BRect the size of the bitmap's dimensions. + + \return A BRect the size of the bitmap's dimensions. +*/ + + +/*! + \fn uint32 BBitmap::Flags() const + \brief Accesses the bitmap's creation flags. + + This method informs about which flags have been used to create the + bitmap. It would for example tell you wether this is an overlay + bitmap. If bitmap creation succeeded, all flags are fulfilled. + + \return The bitmap's creation flags. +*/ + + +/*! + \fn status_t BBitmap::GetOverlayRestrictions(overlay_restrictions* + restrictions) const + \brief Gets the overlay_restrictions structure for this bitmap. + + \note This function is not part of the BeOS R5 API. + + \param restrictions The overlay restrictions flag + + \retval B_OK The overlay restriction structure was found. + \retval B_BAD_TYPE The overlay restriction structure for the bitmap could + not be found. +*/ + + +//! @} + + +/*! + \name Setters +*/ + + +//! @{ + + +/*! + \fn void BBitmap::SetBits(const void* data, int32 length, int32 offset, + color_space colorSpace) + \brief Assigns data to the bitmap. + + Data are directly written into the bitmap's data buffer, being converted + beforehand, if necessary. Some conversions do not work intuitively: + - \c B_RGB32: The source buffer is supposed to contain \c B_RGB24_BIG + data without padding at the end of the rows. + - \c B_RGB32: The source buffer is supposed to contain \c B_CMAP8 + data without padding at the end of the rows. + - other color spaces: The source buffer is supposed to contain data + according to the specified color space being padded to int32 row-wise. + + The currently supported source/target color spaces are + B_RGB{32,24,16,15}[_BIG], \c B_CMAP8 and + B_GRAY{8,1}. + + \note Since this methods is a bit strange to use, Haiku has introduced + the ImportBits() method which is the recommended replacement. + + \param data The data to be copied. + \param length The length in bytes of the data to be copied. + \param offset The offset (in bytes) relative to beginning of the bitmap + data specifying the position at which the source data shall be + written. + \param colorSpace Color space of the source data. +*/ + + +/*! + \fn status_t BBitmap::ImportBits(const void* data, int32 length, int32 bpr, + int32 offset, color_space colorSpace) + \brief Assigns data to the bitmap. + + Data are directly written into the bitmap's data buffer, being converted + beforehand, if necessary. Unlike for SetBits(), the meaning of + \a colorSpace is exactly the expected one here, i.e. the source buffer + is supposed to contain data of that color space. \a bpr specifies how + many bytes the source contains per row. \c B_ANY_BYTES_PER_ROW can be + supplied, if standard padding to int32 is used. + + The currently supported source/target color spaces are + B_RGB{32,24,16,15}[_BIG], \c B_CMAP8 and + B_GRAY{8,1}. + + \note This function is not part of the BeOS R5 API. + + \param data The data to be copied. + \param length The length in bytes of the data to be copied. + \param bpr The number of bytes per row in the source data. + \param offset The offset (in bytes) relative to beginning of the bitmap + data specifying the position at which the source data shall be + written. + \param colorSpace Color space of the source data. + + \retval B_OK The bits were imported into the bitmap. + \retval B_BAD_VALUE \c NULL \a data, invalid \a bpr or \a offset, or + unsupported \a colorSpace. +*/ + + +/*! + \fn status_t BBitmap::ImportBits(const void* data, int32 length, + int32 bpr, color_space colorSpace, BPoint from, BPoint to, + int32 width, int32 height) + \brief Assigns data to the bitmap. + + Allows for a BPoint offset in the source and in the bitmap. The region + of the source at \a from extending \a width and \a height is assigned + (and converted if necessary) to the bitmap at \a to. + + The currently supported source/target color spaces are + B_RGB{32,24,16,15}[_BIG], \c B_CMAP8 and + B_GRAY{8,1}. + + \note This function is not part of the BeOS R5 API. + + \param data The data to be copied. + \param length The length in bytes of the data to be copied. + \param bpr The number of bytes per row in the source data. + \param colorSpace Color space of the source data. + \param from The offset in the source where reading should begin. + \param to The offset in the bitmap where the source should be written. + \param width The width (in pixels) to be imported. + \param height The height (in pixels) to be imported. + + \retval B_OK The bits were imported into the bitmap. + \retval B_BAD_VALUE: \c NULL \a data, invalid \a bpr, unsupported + \a colorSpace or invalid \a width or \a height. +*/ + + +/*! + \fn status_t BBitmap::ImportBits(const BBitmap* bitmap) + \brief Assigns another bitmap's data to this bitmap. + + The supplied bitmap must have the exactly same dimensions as this bitmap. + Its data is converted to the color space of this bitmap. + + The currently supported source/target color spaces are + B_RGB{32,24,16,15}[_BIG], \c B_CMAP8 and + B_GRAY{8,1}. + + \note This function is not part of the BeOS R5 API. + + \param bitmap The source bitmap. + + \retval B_OK The bits were imported into the bitmap. + \retval B_BAD_VALUE \c NULL \a bitmap, or \a bitmap has other dimensions, + or the conversion from or to one of the color spaces is not supported. +*/ + + +/*! + \fn status_t BBitmap::ImportBits(const BBitmap* bitmap, BPoint from, + BPoint to,int32 width, int32 height) + \brief Assigns data to the bitmap. + + Allows for a BPoint offset in the source and in the bitmap. The region + of the source at \a from extending \a width and \a height is assigned + (and converted if necessary) to the bitmap at \a to. The source bitmap is + clipped to the bitmap and they don't need to have the same dimensions. + + The currently supported source/target color spaces are + B_RGB{32,24,16,15}[_BIG], \c B_CMAP8 and + B_GRAY{8,1}. + + \note This function is not part of the BeOS R5 API. + + \param bitmap The source bitmap. + \param from The offset in the source where reading should begin. + \param to The offset in the bitmap where the source should be written. + \param width The width (in pixels) to be imported. + \param height The height (in pixels) to be imported. + + \retval B_OK The bits were imported into the bitmap. + \retval B_BAD_VALUE \c NULL \a bitmap, the conversion from or to one of + the color spaces is not supported, or invalid \a width or \a height. +*/ + + +//! @} + + +/*! + \name Child View Methods +*/ + + +//! @{ + + +/*! + \fn void BBitmap::AddChild(BView* view) + \brief Adds a BView to the bitmap's view hierarchy. + + The bitmap must accept views and the supplied view must not be child of + another parent. + + \param view The view to be added. +*/ + + +/*! + \fn bool BBitmap::RemoveChild(BView* view) + \brief Removes a BView from the bitmap's view hierarchy. + + \param view The view to be removed. +*/ + + +/*! + \fn int32 BBitmap::CountChildren() const + \brief Gets the number of BViews currently belonging to the bitmap. + + \returns The number of BViews currently belonging to the bitmap. +*/ + + +/*! + \fn BView* BBitmap::ChildAt(int32 index) const + \brief Gets the BView at a certain index in the bitmap's list of views. + + \param index The index of the BView to be returned. + \returns The BView at index \a index or \c NULL if the index is out of + range. +*/ + + +/*! + \fn BView* BBitmap::FindView(const char* viewName) const + \brief Accesses a bitmap's child BView with a the name \a viewName. + + \param viewName The name of the BView to be returned. + \returns The BView with the name \a name or \c NULL if the bitmap doesn't + know a view with that name. +*/ + + +/*! + \fn BView* BBitmap::FindView(BPoint point) const + \brief Accesses a bitmap's BView at a certain location. + + \param point The location. + \returns The BView with located at \a point or \c NULL if the bitmap + doesn't know a view at this location. +*/ + + +//! @} diff --git a/docs/user/interface/Box.dox b/docs/user/interface/Box.dox index 4eff31f53f..8382b45f82 100644 --- a/docs/user/interface/Box.dox +++ b/docs/user/interface/Box.dox @@ -3,166 +3,253 @@ * Distributed under the terms of the MIT Licence. * * Documentation by: - * Clark Gaeble - * Adrien Destugues + * Clark Gaeble + * Adrien Destugues + * John Scipione * Corresponds to: - * /trunk/headers/os/interface/Box.h rev 39685 - * /trunk/src/kits/interface/Box.cpp rev 39685 + * /trunk/headers/os/interface/Box.h rev 42274 + * /trunk/src/kits/interface/Box.cpp rev 42274 + /*! -\file Box.h -\brief Defines the BBox class + \file Box.h + \brief Defines the BBox class */ -/*! \class BBox + +/*! + \class BBox \ingroup interface - \brief Class just drawing a square box with a label in a window. - - A Box represents a square on the interface with dimensions, an optional - name, and no interactivity. + \brief The BBox class is used to draw a square box in a window with an + optional label to group related subviews. - This would be used to visually group elements together. + A BBox is an organizational interface element used to group related views + together visually. A basic BBox looks like this: + + \image html B_FANCY_BORDER.png + + A box's label can either be text or it can be another control such + as a checkbox or dropdown box. See SetLabel() for more details on setting + the label on a BBox. */ -/*! \fn BBox::BBox(BRect frame, const char *name = NULL, uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, border_style border = B_FANCY_BORDER) - \brief Constructs a Box from a set of dimensions. - This is the only constructor that can be used if the box is to be inserted - in a window that doesn't use the layout system. +/*! + \fn BBox::BBox(BRect frame, const char *name = NULL, + uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, + border_style border = B_FANCY_BORDER) + \brief Constructs a BBox from a set of dimensions. - \param frame The bounds of the box. - \param name The name of the box. - \param resizingMode Defines the behavior of the box as the parent view + \note This is the only constructor that can be used if the BBox is to be + inserted in a window that doesn't use the layout system. + + \param frame The bounds of the BBox. + \param name The name of the BBox. + \param resizingMode Defines the behavior of the BBox as the parent view resizes. - \param flags Behavior flags for the box. See BView page for more - info. - \param border Sets the initial style of the border. See SetBorder for - more details. + \param flags Behavior flags for the BBox. See BView for details. + \param border The border_style of the BBox. */ -/*! \fn BBox::BBox(const char* name, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, border_style border = B_FANCY_BORDER, BView* child = NULL) - \brief Constructs a named Box, with dimensions defined automatically by the +/*! + \fn BBox::BBox(const char* name, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, + border_style border = B_FANCY_BORDER, BView* child = NULL) + \brief Constructs a named BBox with dimensions defined automatically by the Layout Kit. - \param name The name of the box. - \param flags Behavior flags for the box. - \param border Defines the initial border style. - \param child Adds an initial child to the box. See: Layout Kit + \param name The name of the BBox. + \param flags Behavior flags for the BBox. See BView for details. + \param border The border_style of the BBox. + \param child Adds an initial child to the BBox. See the Layout Kit for + details. */ -/*! \fn BBox::BBox(border_style border, BView* child) - \brief Constructs an anonymous Box, with a defined border style and a child. +/*! + \fn BBox::BBox(border_style border, BView* child) + \brief Constructs an anonymous BBox, with a defined border style and + a child. - There can only be a single child view in the box. This view can, however, - act as a nesting container if you need more things to show inside the box. - - \param border The initial border style of the box. - \param child The child of the Box. + There can only be a single child view in the BBox. This view can, however, + act as a nesting container if you need more things to show inside the BBox. */ -/*! \fn BBox::BBox(BMessage* archive) - \brief For archive restoration, allows a box to be constructed from an - archive message. +/*! + \fn BBox::BBox(BMessage* archive) + \brief For archive restoration, allows a BBox to be constructed from an + \a archive message. - You don't usually call this directly, if you want to build a BBox from a - message, prefer calling Instantiate, which can properly handle errors. + This method is usually not called directly. If you want to build a BBox + from a message then you should call Instantiate() which can handle errors + properly. - If the archive is a deep one, the box will also unarchive all of its - children recursively. + If the \a archive is a deep one, the BBox will also unarchive all + of its children recursively. - \param archive The archive to restore from. + \param archive The \a archive to restore from. */ -/*! \fn static BArchivable* BBox::Instantiate(BMessage* archive) - \brief Creates a new BBox from an archive. +/*! + \fn BBox::~BBox() + \brief Destructor method. - If the message is a valid box, an instance of BBox (created from the - archive) will be returned. Otherwise, this function will return NULL. + Calling the destructor will also free the memory used by the box's label + if it has one. */ -/*! \fn virtual status_t BBox::Archive(BMessage* archive, bool deep = true) const; - \brief Archives the box into archive. +/*! + \fn static BArchivable* BBox::Instantiate(BMessage* archive) + \brief Creates a new BBox from an \a archive. - \param archive The target archive which the box data will go into. - \param deep Whether or not to recursively archive the children. - \returns B_OK if the archive was successful. + If the message is a valid BBox then an instance of BBox created from the + passed in \a archive will be returned. Otherwise this method will + return \c NULL. + + \param archive The \a archive message. + + \returns An instance of BBox if the \a archive is valid or \c NULL. */ -/*! \fn virtual void BBox::SetBorder(border_style border) +/*! + \fn virtual status_t BBox::Archive(BMessage* archive, + bool deep = true) const; + \brief Archives the BBox into \a archive. + + \param archive The target \a archive which the BBox data will go + into. + \param deep Whether or not to recursively archive the children. + \returns A status flag indicating if the archive operation was successful. + + \retval B_OK The archive operation was successful. + \retval B_BAD_VALUE The archive operation failed. +*/ + + +/*! + \fn virtual void BBox::SetBorder(border_style border) \brief Sets the border style. - Possible values are B_PLAIN_BORDER (a single 1-pixel line border), - B_FANCY_BORDER (the default, slightly beveled look), and B_NO_BORDER, which - is used to make an invisible box. + Possible values are \c B_PLAIN_BORDER (a single 1-pixel line border), + \c B_FANCY_BORDER (the default, beveled look), and \c B_NO_BORDER, which + is used to make an invisible box. See border_style for more details. */ -/*! \fn border_style BBox::Border() const - \brief Gets the border style. +/*! + \fn border_style BBox::Border() const + \brief Gets the current border_style of a BBox. + + \returns The border_style flag that is currently set to the BBox. */ -/*! \fn float BBox::TopBorderOffset() - \brief Gets the distance from the very top of the Box to the top border - line, in pixels. +/*! + \fn float BBox::TopBorderOffset() + \brief Gets the distance from the very top of the BBox to the top border + line in pixels as a \c float. + + \warning This method is not part of the BeOS R5 API and is not yet + finalized. The distance may vary depending on the text or view used as label, and the - font settings. The border is drawn center aligned with the label. + font settings. The border is drawn center aligned with the label. You can + use this value to line up two boxes visually if one has a label and the + other does not. - You can use this value to line up two boxes visually, if one has a label and - the other has not. + \returns The distance offset of the BBox as a \c float. */ -/*! \fn BRect BBox::InnerFrame() - \brief Returns the rectangle just inside the border. +/*! + \fn BRect BBox::InnerFrame() + \brief Gets the rectangle just inside the border of the BBox as a BRect. + + \warning This method is not part of the BeOS R5 API and is not yet + finalized. + + \returns A BRect of the dimensions of the box's inside border. */ -/*! \fn void BBox::SetLabel(const char* string) - \brief Sets the label's text. +/*! + \fn void BBox::SetLabel(const char* string) + \brief Sets the box's label text. - This text is shown as the box title on screen, so the user can identify the - purpose of it. + Below is an example of a BBox with a simple text label: + + \image html BBox_example.png + + The code to create a BBox with a text label looks like this: + + \code +fIconBox = new BBox("Icon Box"); +fIconBox->SetLabel("Icon"); + \endcode + + \param string The label text string to set as the box's title. */ -/*! \fn status_t BBox::SetLabel(BView* viewLabel) +/*! + \fn status_t BBox::SetLabel(BView* viewLabel) \brief Sets the label from a pre-existing BView. - You can use any type of BView for this, such as a BPopupMenu. - This version of SetLabel is much more powerful than - SetLabel(const char* string). It allows building a box which contents can - be changed depending on the label widget. + This version of SetLabel() allows building a BBox with a control as a + label widget. You can pass in any type of BView derived control for this + such as a BPopupMenu or BCheckBox. + + An example of a BBox with a BCheckBox control attached is shown below: + + \image html BBox_with_checkbox.png + + The code to create such a BBox looks like this: + + \code +fVirtualMemoryEnabledCheckBox = new BCheckBox("Virtual memory check box", + "Enable virtual memory", new BMessage(kVirtualMemoryEnabled)); + +BBox* fVirtualMemoryBox = new BBox("Virtual memory box"); +fVirtualMemoryBox->SetLabel(fVirtualMemoryEnabledCheckBox); + \endcode + + \param viewLabel A BView. + \returns \c B_OK */ -/*! \fn const char* BBox::Label() const +/*! + \fn const char* BBox::Label() const \brief Gets the label's text. This only works if the label was set as text. If you set another view as the label, you have to get its text by other means, likely starting with LabelView. + + \returns The label text of the BBox as a const char* if the BBox + has a text label or \c NULL otherwise. */ -/*! \fn BView* BBox::LabelView() const +/*! + \fn BView* BBox::LabelView() const \brief Gets the BView representing the label. */ -/*! \fn virtual void BBox::Draw(BRect updateRect) - \brief Draws onto the parent window the part of the box that intersects +/*! + \fn virtual void BBox::Draw(BRect updateRect) + \brief Draws onto the parent window the part of the BBox that intersects the dirty area. - This is an hook function called by the interface kit. You don't have to call - it yourself. If you need to force redrawing of (part of) the box, consider + This is an hook method called by the interface kit. You don't have to call + it yourself. If you need to force redrawing of (part of) the BBox, consider using Invalidate instead. \param updateRect The area that needs to be redrawn. Note the box may draw @@ -170,83 +257,95 @@ */ -/*! \fn virtual void BBox::AttachedToWindow() - \brief Hook called when the box is attached to a window. +/*! + \fn virtual void BBox::AttachedToWindow() + \brief Hook method called when the BBox is attached to a window. - This function sets the box background color to the parent's one. + This method sets the box's background color to the background of the + parent view. - If you are using the layout system, the box is also resized depending - on the layout of the parent view. + If you are using the layout system, the BBox is also resized according to + the layout of the parent view. */ -/*! \fn virtual void BBox::FrameResized(float width, float height) - \brief Called when the box needs to change its size. +/*! + \fn virtual void BBox::FrameResized(float width, float height) + \brief Called when the BBox needs to change its size. - This function may be called either because the window in which the box is + This method may be called either because the window in which the BBox is was resized, or because the window layout was otherwise altered. - It recomputes the layouting of the box (including label and contents) and - makes it redraw itself as needed. + It recomputes the layout of the BBox (including label and contents) and + makes it redraw as necessary. */ -/*! \fn virtual void BBox::ResizeToPreferred() - \brief Resizes the box to its preferred dimensions. +/*! + \fn virtual void BBox::ResizeToPreferred() + \brief Resizes the BBox to its preferred dimensions. This only works in the non-layout mode, as it forces the resizing. */ -/*! \fn virtual void BBox::GetPreferredSize(float* _width, float* _height) - \brief Gets the dimensions the box would prefer to be. +/*! + \fn virtual void BBox::GetPreferredSize(float* _width, float* _height) + \brief Gets the dimensions that the BBox would prefer to be. The size is computed from the children sizes, unless it was explicitly set - for the box (which canbe done only in layouted mode). + for the BBox (which can be done only if the BBox is configured to + use the Layout Kit). - \note Either one of the parameters may be set to NULL if you only want to - get the other one. + \note Either the \a _width or \a _height parameter may be set to \c NULL + if you only want to get the other one. - \param _width An output parameter. The width of the preferred size is - placed in here. - \param _height An output parameter. The height of the preferred size is - placed in here. + \param[out] _width The width of the preferred size is placed in here. + \param[out] _height The height of the preferred size is placed in here. */ -/*! \fn virtual BSize BBox::MinSize() - \brief Gets the minimum possible size of the Box. +/*! + \fn virtual BSize BBox::MinSize() + \brief Gets the minimum possible size of the BBox. - Drawing the box at this size ensures the label and the child view are + Drawing the BBox at this size ensures the label and the child view are visible. Going smaller means something may get invisible on screen for lack of space. */ -/*! \fn virtual BSize BBox::MaxSize() - \brief Gets the maximum possible size of the Box. +/*! + \fn virtual BSize BBox::MaxSize() + \brief Gets the maximum possible size of the BBox. The maximum size depends on the child view's one. + + \returns A BSize of the maximum possible size of the BBox. */ -/*! \fn virtual BSize BBox::PreferredSize() +/*! + \fn virtual BSize BBox::PreferredSize() \brief Returns the box's preferred size. This is the same as GetPreferredSize, but using the more convenient BSize struct. + + \returns A BSize of the minimum possible size of the BBox. */ -/*! \fn virtual void BBox::DoLayout() - \brief Lays out the box. Moves everything to its appropriate position. +/*! + \fn virtual void BBox::DoLayout() + \brief Lays out the BBox. Moves everything into its appropriate position. - This only works if the box uses the layout system, ie., was created with - one of the BRect-less constructors. + This only works if the BBox uses the layout system from the Layout Kit, + i.e. it was created with one of the BRect-less constructors. - Once the size of the box is known, from layouting of the parent views, this - function is called so the box can adjust the position and size of the label, - eventually truncating the text if there is not enough space. The exact - border positions are also computed, then the child view is also layouted if - its size constraints changed. + Once the size of the BBox is known, from layouting of the parent views, + this method is called so the BBox can adjust the position and size of the + label, eventually truncating the text if there is not enough space. The + exact border positions are also computed, then the child view is also + layouted if its size constraints changed. */ diff --git a/docs/user/interface/Button.dox b/docs/user/interface/Button.dox new file mode 100644 index 0000000000..d3a510be38 --- /dev/null +++ b/docs/user/interface/Button.dox @@ -0,0 +1,456 @@ +/* + * Copyright 2011, Haiku inc. + * Distributed under the terms of the MIT Licence. + * + * Documentation by: + * John Scipione + * Corresponds to: + * /trunk/headers/os/interface/Button.h + * /trunk/src/kits/interface/Button.cpp + + +/*! + \file Button.h + \brief Describes the BButton class. +*/ + + +/*! + \class BButton Button.h + \ingroup interface + \brief A BButton is a labeled on-screen button. + + A BButton control is used to initiate an action. An action is activated + by clicking on the button with the mouse or by a keyboard button. + If the BButton is the default button for the active window then you can + activate it by pushing the Enter key. + + \image html BButton_example.png + + A BButton, unlike other user interface elements such as check boxes and + radio buttons has only a single state. During a click event the + BButton's value is set to \c 1, (\c B_CONTROL_ON) otherwise this value + is \c 0 (\c B_CONTROL_OFF). + + BButton inherits from the BControl class. +*/ + + +/*! + \fn BButton::BButton(BRect frame, const char* name, const char* label, + BMessage* message, uint32 resizingMode, uint32 flags) + \brief Creates and initializes a BButton control. + + \note A BButton created with a constructor that includes a frame + parameter does \b not utilize the Layout Kit to position and size the + control. + + BControl initializes the button's label and assigns it a message that + identifies the action that should be carried out when the button is + pressed. When the button is attached to a window it is resizes to the + height of the button's frame rectangle to fit the button's border and + label in the button's font. + + The \a frame, \a name, \a resizingMode, and \a flags parameters are + passed up the inheritance chain to the BView class. + + \param frame The frame rectangle that the button is draw into. + \param name The name of the button + \param label The button label text + \param message The BButtons's action message + \param resizingMode Mask sets the parameters by which the BButton can be + resized. It should be set to one option for vertical resizing combined + with one option for horizontal resizing. + \n\n Horizontal resizing options are + \li \c B_FOLLOW_LEFT + \li \c B_FOLLOW_RIGHT + \li \c B_FOLLOW_LEFT_RIGHT + \li \c B_FOLLOW_H_CENTER + + Vertical resizing options are + \li \c B_FOLLOW_TOP + \li \c B_FOLLOW_BOTTOM + \li \c B_FOLLOW_TOP_BOTTOM + \li \c B_FOLLOW_V_CENTER + + There are two other possibilities + \li \c B_FOLLOW_ALL_SIDES + \li \c B_FOLLOW_NONE + + See BView for more information on resizing options. + \param flags The flags mask sets what notifications the BButton can receive. + \n\n Any combination of the following options is allowed + \li \c B_WILL_DRAW + \li \c B_PULSE_NEEDED + \li \c B_FRAME_EVENTS + \li \c B_FULL_UPDATE_ON_RESIZE + \li \c B_NAVIAGBLE + \li \c B_NAVIAGBLE_JUMP + \li \c B_SUBPIXEL_PRECISE + + See BView for more information on \a flags. +*/ + + +/*! + \fn BButton::BButton(const char* name, const char* label, BMessage* message, + uint32 flags) + \brief Creates and initializes a BButton control. + + BControl initializes the button's label and assigns it a message that + identifies the action that should be carried out when the button is + pressed. When the button is attached to a window it is resizes to the + height of the button's frame rectange to fit the button's border and + label in the button's font. + + \param name The \a name of the button + \param label The button's \a label text + \param message The button's action \a message + \param flags The \a flags mask sets what notifications the button can + receive. Any combination of the following options is allowed: + \li \c B_WILL_DRAW + \li \c B_PULSE_NEEDED + \li \c B_FRAME_EVENTS + \li \c B_FULL_UPDATE_ON_RESIZE + \li \c B_NAVIAGBLE + \li \c B_NAVIAGBLE_JUMP + \li \c B_SUBPIXEL_PRECISE + + See BView for more information on \a flags. +*/ + + +/*! + \fn BButton::BButton(const char* label, BMessage* message) + \brief Creates and initializes a BButton control. + + Creates the button with the specified \a label. The action carried out + by the button is specified by the \a message. + + \param label The button's \a label text + \param message The buttons action \a message +*/ + + +/*! + \fn BButton::~BButton() + \brief Destructor method. + + Standard Destructor. +*/ + + +/*! \fn BButton::BButton(BMessage* archive) + \brief Creates a new BButton from an \a archive. + + If the message is a valid button then an instance of BButton created + from the passed in \a archive will be returned. Otherwise this method + will return \c NULL. + + \returns An instance of BButton if the \a archive is valid or \c NULL. +*/ + + +/*! + \fn BArchivable* BButton::Instantiate(BMessage* archive) + \brief Instantiates a BButton from a BMessage. + + \param archive The \c archive message to instantiate the BButton. + + \returns a BArchivable object of the BButton. +*/ + + +/*! + \fn status_t BButton::Archive(BMessage* archive, bool deep) const + \brief Archives the BButton into \a archive. + + \param archive The target \a archive which the BButton data will + go into. + \param deep Whether or not to recursively archive the BButton's children. + + \retval B_OK The archive operation was successful. + \retval B_BAD_VALUE The archive operation failed. +*/ + + +/*! + \fn void BButton::Draw(BRect updateRect) + \brief Draws the button and sets its label. + + \param updateRect The BRect which the button is drawn into. +*/ + + +/*! + \fn void BButton::MouseDown(BPoint point) + \brief Hook method to respond to a MouseDown event. + + \param point The point on the screen that the mouse pointer is located at. +*/ + + +/*! + \fn void BButton::AttachedToWindow() + \brief Hook method that is called when the BButton view is attached + to the window. +*/ + + +/*! + \fn void BButton::KeyDown(const char *bytes, int32 numBytes) + \brief Hook method that is called when a keyboard key is pushed down. + to the window. + + \param bytes The key pressed. + \param numBytes The number of keys pressed. +*/ + + +/*! + \fn void BButton::MakeDefault(bool flag) + \brief Make the BButton the default button i.e. it will be activated + when the user pushes the \key{Enter} key. + + \param flag Pass in \c B_SUPPORTS_LAYOUT if the BButton is positioned + by the Layout Kit. +*/ + + +/*! + \fn void BButton::SetLabel(const char *string) + \brief Sets the BButton's label. + + \param string The string to set the label to. +*/ + + +/*! + \fn bool BButton::IsDefault() const + \brief Returns whether or not the BButton is the default button or not, i.e. + it responds to the \key{Enter} key. + + \retval true The button is the default button. + \retval false The button is \b not the default button. +*/ + + +/*! + \fn void BButton::MessageReceived(BMessage *message) + \brief Hook method that is called when a message is received by the BButton. + + \param message The message received. +*/ + + +/*! + \fn void BButton::WindowActivated(bool active) + \brief Sets the window that the BButton is attached to as activated or not. + + \param active if \c true the window is activated, if \c false the window is + deactivated. +*/ + + +/*! + \fn void BButton::MouseMoved(BPoint point, uint32 transit, + const BMessage *message) + \brief Hook method that is called when the mouse is moved. + + \param point The point on the screen that the mouse pointer is located at. + \param transit ??? + \param message The message that is received when the mouse is moved. +*/ + + +/*! + \fn void BButton::MouseUp(BPoint point) + \brief Hook method that is called when a mouse button is unpressed. + + \param point The point on the screen that the mouse pointer is located at. +*/ + + +/*! + \fn void BButton::DetachedFromWindow() + \brief Detaches the BButton from the window. + + \see BControl::DetachedFromWindow() +*/ + + +/*! + \fn void BButton::SetValue(int32 value) + \brief Sets the value of the BButton. + + \note This method can be overridden in order to take a different action + when the value changes. + + \param value The value to set to the BButton to. Options include: + \li \c 0 (\c B_CONTROL_OFF) + \li \c 1 (\c B_CONTROL_ON) + + \see BControl::SetValue() +*/ + + +/*! + \fn void BButton::GetPreferredSize(float *_width, float *_height) + \brief Gets the dimensions that the BButton would prefer to be. + + The size is computed from the children sizes, unless it was explicitly set + for the BButton (which can be done only if the BButton is configured to + use the Layout Kit). + + \note Either the \a _width or \a _height parameter may be set to \c NULL + if you only want to get the other one. + + \param[out] _width The width of the preferred size is placed in here. + \param[out] _height The height of the preferred size is placed in here. +*/ + + +/*! + \fn void BButton::ResizeToPreferred() + \brief Resizes the BButton to its preferred size. + + \see BControl::ResizeToPreferred() +*/ + + +/*! + \fn status_t BButton::Invoke(BMessage *message) + \brief The BButton is invoked from a message. + + This method is used to post a message when the button is clicked or + activated by a keyboard button. You can set the object that will + handle the message by calling a BControl::SetTarget() from a + BInvoker inherited control. A model for the message is set by the + BButton constructor or by the BControl::SetMessage() method + inherited from BInvoker. + + \returns B_OK If the BButton was invoked, otherwise an error + \a status_t flag is returned. + + \see BControl::Invoke() +*/ + + +/*! + \fn void BButton::FrameMoved(BPoint newLocation) + \brief Move the frame of the BButton. + + \param newLocation The location on the screen that the BButton + is moved to. + + \see BControl::FrameMoved(); +*/ + + +/*! + \fn void BButton::FrameResized(float width, float height) + \brief Resize the BButton. + + \param width the new \a width of the BButton + \param height the new \a height of the BButton + + \see BControl::FrameResized(); +*/ + + +/*! + \fn void BButton::MakeFocus(bool focused) + \brief Focus or unfocus the BButton. + + \param focused If \c true focus the BButton, otherwise unfocus the BButton. + + \see BControl::MakeFocus() +*/ + + +/*! + \fn void BButton::AllAttached() + \brief Hook method that is called when the BButton is attached. + + \see BControl::AllAttached() +*/ + + +/*! + \fn void BButton::AllDetached() + \brief Hook method that is called when the BButton is deattached. + + \see BControl::AllDetached() +*/ + + +/*! + \fn BHandler* BButton::ResolveSpecifier(BMessage *message, int32 index, + BMessage *specifier, int32 what, property) + \brief Resolves specifiers for properties. + \see BHandler::ResolveSpecifier() +*/ + + +/*! + \fn status_t BButton::GetSupportedSuites(BMessage *message) + \brief Reports the suites of messages and specifiers that derived classes + understand. + + \param message The message to report the suite of messages and specifiers. + + \see BWindow::GetSupportedSuites() +*/ + + +/*! + \fn status_t BButton::Perform(perform_code code, void* _data) + \brief Perform an action on the BButton. + + \param code The \a perform_code. One of the following: + \li \c PERFORM_CODE_MIN_SIZE + \li \c PERFORM_CODE_MAX_SIZE + \li \c PERFORM_CODE_PREFERRED_SIZE + \li \c PERFORM_CODE_LAYOUT_ALIGNMENT + \li \c PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH + \li \c PERFORM_CODE_GET_HEIGHT_FOR_WIDTH + \li \c PERFORM_CODE_SET_LAYOUT + \li \c PERFORM_CODE_INVALIDATE_LAYOUT + \li \c PERFORM_CODE_DO_LAYOUT + \param _data Data to use to act on. + + \returns \c B_OK if the action was successful or an error code if not. +*/ + + +/*! + \fn void BButton::InvalidateLayout(bool descendants) + \brief Redraws the BButton. + + \param descendants Redraw subviews as well. +*/ + + +/*! + \fn BSize BButton::MinSize() + \brief Returns the minimum size of the BButton. + + \returns The minimum BButton size as a BSize +*/ + + +/*! + \fn BSize BButton::MaxSize() + \brief Returns the maximum size of the BButton. + + \returns The maximum BButton size as a BSize +*/ + + +/*! + \fn BSize BButton::PreferredSize() + \brief Returns the preferred size of the BButton. + + \returns The preferred BButton size as a BSize +*/ + diff --git a/docs/user/interface/GridLayout.dox b/docs/user/interface/GridLayout.dox index bea3595786..f610cacd0b 100644 --- a/docs/user/interface/GridLayout.dox +++ b/docs/user/interface/GridLayout.dox @@ -1,3 +1,21 @@ +/* + * Copyright 2010, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Documentation by: + * Alex Wilson + * Corresponds to: + * /trunk/headers/os/interface/GridLayout.h rev 38207 + * /trunk/src/kits/interface/GridLayout.cpp rev 38207 + */ + + +/*! + \file GridLayout.h + Provides the BGridLayout class. +*/ + + /*! \class BGridLayout \ingroup interface @@ -18,150 +36,199 @@ /*! \fn BGridLayout::BGridLayout(float horizontal = 0.0f, float vertical = 0.0f) - \brief Create a BGridLayout with \c horizontal space between columns and - \c vertical space between rows. + \brief Create a BGridLayout with \a horizontal space between columns and + \a vertical space between rows. */ /*! \fn BGridLayout::BGridLayout(BMessage* from) \brief Archive constructor. + + \param from The message to build the BGridLayout from. +*/ + + +/*! + \fn BGridLayout::~BGridLayout() + \brief Destructor method. + + Standard Destructor. */ /*! \fn int32 BGridLayout::CountColumns() const \brief Returns the number of active columns in this layout. + + \returns The number of active columns in the layout. */ /*! \fn int32 BGridLayout::CountRows() const \brief Returns the number of active rows in this layout. + + \returns the number of active rows in the layout. */ /*! \fn float BGridLayout::HorizontalSpacing() const \brief Returns the spacing between columns for this layout. + + \returns The spacing between columns for the layout. */ /*! \fn float BGridLayout::VerticalSpacing() const \brief Returns the spacing between rows for this layout. + + \returns The spacing between rows for the layout. */ /*! \fn void BGridLayout::SetHorizontalSpacing(float spacing); \brief Set the spacing between columns for this layout. + + \param spacing The number of pixels of spacing to set. */ /*! \fn void BGridLayout::SetVerticalSpacing(float spacing) \brief Set the spacing between rows for this layout. + + \param spacing The number of pixels of spacing to set. */ /*! \fn void BGridLayout::SetSpacing(float horizontal, float vertical) \brief Set the spacing between columns and rows for this layout. + + \param horizontal The number of \a horizontal pixels of spacing to set. + \param vertical The number of \a vertical pixels of spacing to set. */ /*! \fn float BGridLayout::ColumnWeight(int32 column) const - \brief Returns the weight for \c column. + \brief Returns the weight for the specified \a column. + + \returns The \a column weight as a float. */ /*! \fn void BGridLayout::SetColumnWeight(int32 column, float weight) - \brief Set the weight for \c column to \c weight. + \brief Set the weight for \a column to \a weight. + + \param column The column to set. + \param weight The weight to set. */ /*! \fn float BGridLayout::MinColumnWidth(int32 column) const - \brief Returns the minimum width for \c column. + \brief Returns the minimum width for \a column. + + \param column The column to get the minimum width of. + + \returns The minimum width for \a column as a float. */ /*! \fn void BGridLayout::SetMinColumnWidth(int32 column, float width) - \brief Sets the minimum width for \c column to \c width. + \brief Sets the minimum width for \a column to \a width. + + \param column The \a column to set the minimum width of. + \param width The \a width to set. */ /*! \fn float BGridLayout::MaxColumnWidth(int32 column) const - \brief Returns the maximum width for \c column. + \brief Returns the maximum width for \a column. + + \param column The column to get the maximum width of. + + \returns The maximum width for \a column as a float. */ /*! \fn void BGridLayout::SetMaxColumnWidth(int32 column, float width) - \brief Sets the maximum width for \c column to \c width. + \brief Sets the maximum width for \a column to \a width. + + \param column The column to set the maximum width of. + \param width The \a width to set. */ /*! \fn float BGridLayout::RowWeight(int32 row) const - \brief Returns the weight for \c row. + \brief Returns the weight of the specified \a row. + + \returns The weight of the \a row. */ /*! \fn void BGridLayout::SetRowWeight(int32 row, float weight) - \brief Set the weight for \c row to \c weight. + \brief Set the weight for \a row to \a weight. + + \param row The \a row number. + \param weight The \a */ /*! \fn float BGridLayout::MinRowHeight(int32 row) const - \brief Returns the minimum height for \c row. + \brief Returns the minimum height for \a row. */ /*! \fn void BGridLayout::SetMinRowHeight(int32 row, float height) - \brief Sets the minimum height for \c row to \c width. + \brief Sets the minimum height for \a row to \a width. */ /*! \fn float BGridLayout::MaxRowHeight(int32 row) const - \brief Returns the maximum height for \c row. + \brief Returns the maximum height for \a row. */ /*! \fn void BGridLayout::SetMaxRowHeight(int32 row, float height) - \brief Sets the maximum height for \c row to \c width. + \brief Sets the maximum height for \a row to \a width. */ /*! \fn BLayoutItem* BGridLayout::AddView(BView* child) - \brief Adds \c child to this layout in the first empty cell available, or + \brief Adds \a child to this layout in the first empty cell available, or in a new column in the first row if there are no emtpy cells. */ /*! \fn BLayoutItem* BGridLayout::AddView(int32 index, BView* child); - \copybrief BGridLayout::AddView(BView*) + \brief BGridLayout::AddView(BView*) */ /*! \fn BLayoutItem* BGridLayout::AddView(BView* child, int32 column, int32 row, int32 columnCount = 1, int32 rowCount = 1); - \brief Adds \c child to this layout at \c column and \c row. \c child may - also occupy additional cells if \c columnCount or \c rowCount are - greater than 1. + \brief Adds \a child to this layout at \a column and \a row. \a child may + also occupy additional cells if \a columnCount or \a rowCount are + greater than \c 1. Fails and returns NULL if the requested area is occupied, or if internal memory allocations fail. @@ -170,24 +237,24 @@ /*! \fn BLayoutItem* BGridLayout::AddItem(BLayoutItem* item) - \brief Adds \c item to this layout in the first empty cell available, or + \brief Adds \a item to this layout in the first empty cell available, or in a new column in the first row if there are no emtpy cells. */ /*! \fn BLayoutItem* BGridLayout::AddItem(int32 index, BLayoutItem* item); - \copybrief BGridLayout::AddItem(BLayoutItem*) + \brief BGridLayout::AddItem(BLayoutItem*) */ /*! \fn BLayoutItem* BGridLayout::AddItem(BLayoutItem* item, int32 column, int32 row, int32 columnCount = 1, int32 rowCount = 1); - \brief Adds \c item to this layout at \c column and \c row. \c item may - also occupy additional cells if \c columnCount or \c rowCount are + \brief Adds \a item to this layout at \a column and \a row. \a item may + also occupy additional cells if \a columnCount or \a rowCount are greater than 1. - Fails and returns NULL if the requested area is occupied, or if internal + Fails and returns \c NULL if the requested area is occupied, or if internal memory allocations fail. */ diff --git a/docs/user/interface/GroupLayout.dox b/docs/user/interface/GroupLayout.dox index 4d283d8e96..5562aa00b8 100644 --- a/docs/user/interface/GroupLayout.dox +++ b/docs/user/interface/GroupLayout.dox @@ -1,3 +1,20 @@ +/* + * Copyright 2010, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Documentation by: + * Alex Wilson + * Corresponds to: + * /trunk/headers/os/interface/GroupLayout.h rev 38207 + * /trunk/src/kits/interface/GroupLayout.cpp rev 38207 + */ + + +/*! \file GroupLayout.h + Describes the BGroupLayout class +*/ + + /*! \class BGroupLayout \ingroup interface \ingroup layout @@ -29,118 +46,111 @@ */ -/*! - \fn BGroupLayout::BGroupLayout(enum orientation, float spacing) +/*! \fn BGroupLayout::BGroupLayout(enum orientation orientation, float spacing) \brief Creates a new BGroupLayout. - \param orientation The orientation of this BGroupLayout. + \param orientation The #orientation of this BGroupLayout. \param spacing The spacing between BLayoutItems in this BGroupLayout. */ -/*! - \fn BGroupLayout::BGroupLayout(BMessage* from) - \brief Archive constructor. +/*! \fn BGroupLayout::~BGroupLayout() + \brief Destructor method. + + Standard Destructor. */ -/*! - \fn float BGroupLayout::Spacing() const +/*! \fn BGroupLayout::BGroupLayout(BMessage* from) + \brief Archive constructor. + + \param from The message to construct the BGroupLayout from. +*/ + + +/*! \fn float BGroupLayout::Spacing() const \brief Get the amount of spacing (in pixels) between each item. */ -/*! - \fn void BGroupLayout::SetSpacing(float spacing) +/*! \fn void BGroupLayout::SetSpacing(float spacing) \brief Set the amount of spacing (in pixels) between each item. */ -/*! - \fn orientation BGroupLayout::Orientation() const - \brief Get the orientation of this BGroupLayout. +/*! \fn orientation BGroupLayout::Orientation() const + \brief Get the #orientation of this BGroupLayout. */ -/*! - \fn void BGroupLayout::SetOrientation(enum orientation) - \brief Set the orientation of this BGroupLayout. - \param orientation The new orientation of this BGroupLayout. +/*! \fn void BGroupLayout::SetOrientation(enum orientation orientation) + \brief Set the #orientation of this BGroupLayout. + \param orientation The new #orientation of this BGroupLayout. */ -/*! - \fn float BGroupLayout::ItemWeight(int32 index) const - \brief Get the weight of the item at \c index. +/*! \fn float BGroupLayout::ItemWeight(int32 index) const + \brief Get the weight of the item at \a index. */ -/*! - \fn void BGroupLayout::SetItemWeight(int32 index, float weight) - \brief Set the weight of the item at \c index. +/*! \fn void BGroupLayout::SetItemWeight(int32 index, float weight) + \brief Set the weight of the item at \a index. */ -/*! - \fn BLayoutItem* BGroupLayout::AddView(BView* child) +/*! \fn BLayoutItem* BGroupLayout::AddView(BView* child) \brief Adds \a child to this layout as the last item. In a vertical - BGroupLayout, \c child will be on the right, in a horizontal - BGroupLayout, \c child will be at the bottom. + BGroupLayout, \a child will be on the right, in a horizontal + BGroupLayout, \a child will be at the bottom. - \c child will have a weight of 1.0f. + \a child will have a weight of \c 1.0f. */ -/*! - \fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child) - \brief Adds \c child to this layout at \c index. +/*! \fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child) + \brief Adds \a child to this layout at \a index. - \c child will have a weight of 1.0f. + \a child will have a weight of \c 1.0f. */ -/*! - \fn BLayoutItem* BGroupLayout::AddView(BView* child, float weight) - \brief Adds \c child to the end of this layout with a weight of - \c weight. +/*! \fn BLayoutItem* BGroupLayout::AddView(BView* child, float weight) + \brief Adds \a child to the end of this layout with a weight of + \a weight. */ -/*! - \fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child, +/*! \fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child, float weight) - \brief Adds \c child this layout at \c index with a weight of - \c weight. + \brief Adds \a child this layout at \a index with a weight of + \a weight. */ -/*! - \fn bool BGroupLayout::AddItem(BLayoutItem* item) +/*! \fn bool BGroupLayout::AddItem(BLayoutItem* item) \brief Adds \a item to this layout as the last item. In a vertical - BGroupLayout, \c item will be on the right, in a horizontal - BGroupLayout, \c item will be at the bottom. + BGroupLayout, \a item will be on the right, in a horizontal + BGroupLayout, \a item will be at the bottom. - \c item will have a weight of 1.0f. + \a item will have a weight of \c 1.0f. */ -/*! - \fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item) - \brief Adds \c item to this layout at \c index. +/*! \fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item) + \brief Adds \a item to this layout at \a index. - \c item will have a weight of 1.0f. + \a item will have a weight of \c 1.0f. */ -/*! - \fn bool BGroupLayout::AddItem(BLayoutItem* item, float weight) - \brief Adds \c item to the end of this layout with a weight of - \c weight. +/*! \fn bool BGroupLayout::AddItem(BLayoutItem* item, float weight) + \brief Adds \a item to the end of this layout with a weight of + \a weight. */ -/*! - \fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item, float weight) - \brief Adds \c item this layout at \c index with a weight of - \c weight. +/*! \fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item, float weight) + \brief Adds \a item this layout at \a index with a weight of + \a weight. */ diff --git a/docs/user/interface/InterfaceDefs.dox b/docs/user/interface/InterfaceDefs.dox new file mode 100644 index 0000000000..dc6564a142 --- /dev/null +++ b/docs/user/interface/InterfaceDefs.dox @@ -0,0 +1,65 @@ +/* + * Copyright 2001-2011, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +/*! \file InterfaceDefs.h + \brief Defines standard interface definitions for controls. +*/ + +/*! \enum border_style + Collection of flags that determine the border style drawn around a BBox. +*/ + +/*! \var border_style B_PLAIN_BORDER + + \image html B_PLAIN_BORDER.png + + The right and bottom sides of the box are darker than the top and + left sides to produce a shadow effect and make the box look like it + is raised slightly above the surrounding surface. +*/ + +/*! \var border_style B_FANCY_BORDER + + \image html B_FANCY_BORDER.png + + The border is a bevelled to give it a 3D effect. The border is uniform + in appearance on all four sides. This is the default appearance. +*/ + +/*! \var border_style B_NO_BORDER + No border. +*/ + +/*! \enum orientation +Orientation flag sets the layout to either horizontal or vertical + alignment. +*/ + +/*! \var orientation B_HORIZONTAL + Horizontal alignment +*/ + +/*! \var orientation B_VERTICAL + Vertical alignment +*/ + +/*! \enum button_width + Collection of flags that determine how wide to draw the buttons in a + BAlert dialog. +*/ + +/*! \var button_width B_WIDTH_AS_USUAL + Set the width of each button based on the standard width. +*/ + +/*! \var button_width B_WIDTH_FROM_WIDEST + Set the width of each button based on the width of the widest button. +*/ + +/*! \var button_width B_WIDTH_FROM_LABEL + Set the width of each button to accomidate the width of the button's + label. +*/ + diff --git a/docs/user/interface/Layout.dox b/docs/user/interface/Layout.dox index a346ae2cc2..4345797137 100644 --- a/docs/user/interface/Layout.dox +++ b/docs/user/interface/Layout.dox @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. * * Documentation by: - * Alex Wilson + * Alex Wilson * Corresponds to: * /trunk/headers/os/interface/Layout.h rev 38207 * /trunk/src/kits/interface/Layout.cpp rev 38207 @@ -11,21 +11,22 @@ /*! -\file Layout.h -\brief Defines the BLayout class. + \file Layout.h + \brief Defines the BLayout class. */ -/*! \class BLayout +/*! + \class BLayout \ingroup interface \ingroup layout \ingroup libbe \brief The BLayout class provides an interface, and some basic - implementation to manage the positioning and sizing of BLayoutItems. + implementation to manage the positioning and sizing of BLayoutItem s. - BLayouts can be attached to a BView, managing the BLayoutItems and BViews - that reside in that view, or can be nested within another BLayout as a - BLayoutItem. + BLayouts can be attached to a BView, managing the BLayoutItem's and + BView's that reside in that view, or can be nested within another + BLayout as a BLayoutItem. Before adding a BLayoutItem to a BLayout, that layout must have a target view. When a BLayout is attached directly to a BView via BView::SetLayout() @@ -34,7 +35,7 @@ target of the layout it's nested in, if it does not have a target already. You can retrieve the target view for a layout with the TargetView() method. When adding a BLayoutItem to a BLayout, the item's view (as returned by - BLayoutItem::View()) is added to the layout's target view. + BLayoutItem::View()) is added to the BLayout's target view. \code BView* topView = new BGroupView(); @@ -64,97 +65,107 @@ topLayout->AddItem(nestedLayoutWithView); assume that it will break some time in the future. */ - -/*! \fn BLayout::BLayout() + +/*! + \fn BLayout::BLayout() \brief Default constructor. - After this constructor has finished, this BLayout holds no BLayoutItems and - does not have a target BView. + After this constructor has finished, this BLayout holds no + BLayoutItem's and does not have a target BView. \warning Because a new BLayout does not have a target BView, calls to the AddItem() and AddView() will fail methods will fail. */ -/*! \fn BLayout::BLayout(BMessage* archive) +/*! + \fn BLayout::BLayout(BMessage* archive) \brief Archive constructor. + + \param archive The archive message. */ -/*! \fn BLayout::~BLayout() - \brief Destructor, deletes all BLayoutItems that this layout manages, - and detaches from this BLayout's owner view if there is one. +/*! + \fn BLayout::~BLayout() + \brief Destructor, deletes all BLayoutItem's that this layout manages, + and detaches from this BLayout's owner view if there is one. - Each BLayoutItem's BView (as returned by BLayoutItem::View()) is also + Each BLayoutItem's BView (as returned by BLayoutItem::View()) is also removed from their parent. - \note Because nested BLayouts are treated as BLayoutItems, any layouts - nested in this BLayout will be deleted. + \note Because nested BLayout's are treated as BLayoutItem's, + any layouts nested in this BLayout will be deleted. */ /*! \name BView targeting and attachment information. - - @{ */ -/*! \fn BView* BLayout::Owner() const +//! @{ + + +/*! + \fn BView* BLayout::Owner() const \brief Returns the Owner of this layout, i.e. the view this layout manages. */ -/*! \fn BView* BLayout::TargetView() const +/*! + \fn BView* BLayout::TargetView() const \brief Returns the target view of this layout. - The target view of a layout becomes the parent of any BViews in this layout, - as well as the BViews returned by BLayoutItem::View() for each BLayoutItem - in this layout. + The target view of a layout becomes the parent of any BView's in this + layout, as well as the BView's returned by BLayoutItem::View() for + each BLayoutItem in this layout. */ -/*! \fn BView* BLayout::View() - \brief Returns the same BView* as BLayout::Owner(), this method is inherited - from BLayoutItem. -*/ - - -//@} - - /*! - \name Adding, removing, counting and accessing BViews and BLayoutItems in \ - this BLayout. - - @{ + \fn BView* BLayout::View() + \brief Returns the same BView* as BLayout::Owner(), this method is + inherited from BLayoutItem. */ +//! @} + + +/*! + \name Adding, removing, counting and accessing BLayout children +*/ + + +//! @{ + + /*! \fn BLayoutItem* BLayout::AddView(BView* child) \brief Creates a BLayoutItem to represent a BView, and adds that item to this layout. - \a child is added to this layout's target view. + \a child is added to this BLayout's target view. - \returns The BLayoutItem created to represent \a child is, or NULL if there - was an error. + \returns The BLayoutItem created to represent \a child is, or \c NULL if + there was an error. \param child The BView to be added to this BLayout. */ -/*! \fn BLayoutItem* BLayout::AddView(int32 index, BView* child) +/*! + \fn BLayoutItem* BLayout::AddView(int32 index, BView* child) \brief Creates a BLayoutItem to represent \a child, and adds that item at - \a index to this layout. \a child is added to this layout's target view. + \a index to this layout. \a child is added to this BLayout's target view. */ /*! \fn bool BLayout::AddItem(BLayoutItem* item) \brief Adds a BLayoutItem to this layout, and adds the BView it represents - to this layout's target view. + to this BLayout's target view. \param item The BLayoutItem to be added. \retval true success @@ -165,7 +176,7 @@ topLayout->AddItem(nestedLayoutWithView); /*! \fn bool BLayout::AddItem(int32 index, BLayoutItem* item) \brief Adds \a item to this layout, and adds the BView \a item represents - to this layout's target view. + to this BLayout's target view. \param item The BLayoutItem to be added. \param index The index at which to add \c item. @@ -181,8 +192,8 @@ topLayout->AddItem(nestedLayoutWithView); /*! \fn bool BLayout::RemoveView(BView* child) - \brief Removes and deletes all BLayoutItems representing a BView from this - layout. + \brief Removes and deletes all BLayoutItem representing a BView from + this layout. \param child The BView to be removed. @@ -193,10 +204,10 @@ topLayout->AddItem(nestedLayoutWithView); /*! \fn bool BLayout::RemoveItem(BLayoutItem* item) - \brief Removes a BLayoutITem from this layout, and also removes the view - it represents from this layout's target view. + \brief Removes a BLayoutItem from this layout, and also removes the view + it represents from this BLayout's target view. - \param item The BLayoutitem to be removed + \param item The BLayoutItem to be removed \warning \a item is not deleted, you must delete it manually, or add it to another BLayout. @@ -206,7 +217,8 @@ topLayout->AddItem(nestedLayoutWithView); */ -/*! \fn BLayoutItem* BLayout::RemoveItem(int32 index) +/*! + \fn BLayoutItem* BLayout::RemoveItem(int32 index) \brief Remove the BLayoutItem at \a index. \see RemoveItem(BLayoutItem*) @@ -224,7 +236,7 @@ topLayout->AddItem(nestedLayoutWithView); /*! \fn int32 BLayout::CountItems() const - \brief Get the number of BLayoutItems in this layout. + \brief Get the number of BLayoutItem s in this layout. */ @@ -248,26 +260,28 @@ topLayout->AddItem(nestedLayoutWithView); */ -//@} +//! @} /*! \name Subclass helpers. \brief These methods are meant to ease the development of BLayout subclasses. - - @{ */ -/*! \fn bool BLayout::AncestorsVisible() +//! @{ + + +/*! + \fn bool BLayout::AncestorsVisible() \brief Get the visibility of the ancestors of this layout. If a BLayout is connected to a BView, this will always return \c true. If a BLayout is nested in another layout (it was passed to AddItem()), then - this will reflect the visibility of this layout's parent layout. If any - layout is hidden (by BLayout::SetVisible()) between this layout and its - target view's layout, then this method will return \c false. + this will reflect the visibility of this BLayout's parent layout. If + any layout is hidden (by BLayout::SetVisible()) between this layout and its + target BView's layout, then this method will return \c false. */ @@ -276,8 +290,8 @@ topLayout->AddItem(nestedLayoutWithView); \brief Returns the on-screen area this layout has received to lay out its items in. - The return value is in the coordinate space of this layout's target view. - If this BLayout is attached directly to a BView, then + The return value is in the coordinate space of this BLayout's target + view. If this BLayout is attached directly to a BView, then LayoutArea().LeftTop() == B_ORIGIN . */ @@ -287,27 +301,34 @@ topLayout->AddItem(nestedLayoutWithView); \brief Method to be called by derived classes in their SetVisible() implementation. Calls AncestorVisibilityChanged() on the items in this BLayout. + + \param show \c true to show, \c false to hide. */ -//@} +//! @} /*! \name Methods triggering or related to laying out this BLayout. - -//@{ */ -/*! \fn void BLayout::Relayout(bool immediate = false) +//! @{ + + +/*! + \fn void BLayout::Relayout(bool immediate = false) \brief Request this BLayout to reposition and resize its items as required. If \a immediate is \c false, and there is already a request to have the window this layout resides in re-laid-out, then the layout will happen at that time. If \a immediate is \c true, and there is no such pending - request, nor is this layout's parent layout in the process of laying out - its items, then this BLayout will now layout its items. + request, nor is this BLayout's parent layout in the process of laying + out its items, then this BLayout will now layout its items. + + \param immediate Whether or not to Relayout immediately or wait for pending + requests first. */ @@ -315,10 +336,12 @@ topLayout->AddItem(nestedLayoutWithView); \fn void BLayout::LayoutItems(bool force = false) \brief If there is no layout currently ongoing, and \a force is \c false, creates a new BLayoutContext and calls the DerivedLayoutItems() method - of this BLayout and any BLayouts nested in this BLayout. + of this BLayout and any BLayout s nested in this BLayout. If method also guarantees that the owner view of this layout (as returned by BLayout::Owner()) performs a layout as well (if it is suitable to do so). + + \param force Force the LayoutItems. */ @@ -329,16 +352,17 @@ topLayout->AddItem(nestedLayoutWithView); */ -//@} +//! @} /*! \name Invalidation and state mutators and accessors. - - @{ */ +//! @{ + + /*! \fn void BLayout::RequireLayout() \brief Flag this layout as stale, i.e. any cached data may still be valid, @@ -352,7 +376,7 @@ topLayout->AddItem(nestedLayoutWithView); to positioning and sizing of its items. Invalidating a BLayout also invalidates the view it is connected to - (if there is one) and the BLayout this layout (or this layout's view) + (if there is one) and the BLayout this layout (or this BLayout's view) resides in. This method should be called whenever the layout becomes invalid. This might @@ -379,7 +403,8 @@ topLayout->AddItem(nestedLayoutWithView); */ -/*! \fn void BLayout::DisableLayoutInvalidation() +/*! + \fn void BLayout::DisableLayoutInvalidation() \brief Disable layout invalidation notifications, i.e. calls to this object's InvalidateLayout() method. */ @@ -393,18 +418,19 @@ topLayout->AddItem(nestedLayoutWithView); */ -//@} +//! @} /*! \name Archiving methods \brief These methods relate to the archiving or unarchiving of this object - and the BLayoutItems it contains - - @{ + and the BLayoutItem's it contains */ - + +//! @{ + + /*! \fn status_t BLayout::Archive(BMessage* archive, bool deep = true) const \brief Archives this layout into \a archive. If deep is true, also archives @@ -414,8 +440,8 @@ topLayout->AddItem(nestedLayoutWithView); /*! \fn status_t BLayout::AllUnarchived(const BMessage* from) - \brief Unarchives the BLayoutItems for this layout, calling ItemUnarchived() - for each one. + \brief Unarchives the BLayoutItem's for this layout, calling + ItemUnarchived() for each one. */ @@ -442,16 +468,17 @@ topLayout->AddItem(nestedLayoutWithView); */ -//@} +//! @} /*! \name BLayout Hook methods - - @{ */ +//! @{ + + /*! \fn bool BLayout::ItemAdded(BLayoutItem* item, int32 atIndex) \brief Hook method called when \a item is added to this layout. @@ -490,23 +517,23 @@ topLayout->AddItem(nestedLayoutWithView); \fn void BLayout::OwnerChanged(BView* was) \brief Hook method called when this layout is attached to a BView. - \param was The previous owner of this BLayout, for new BLayouts, this will - be NULL. + \param was The previous owner of this BLayout, for new BLayout s, this + will be \c NULL. */ /*! \fn void BLayout::AttachedToLayout() - \brief Hook method inherited from BLayoutItem, classes derived from BLayout - must include the BLayout version of this method in their + \brief Hook method inherited from BLayoutItem, classes derived from + BLayout must include the BLayout version of this method in their implementation. */ /*! \fn void BLayout::DetachedFromLayout(BLayout* layout) - \brief Hook method inherited from BLayoutItem, classes derived from BLayout - must include the BLayout version of this method in their + \brief Hook method inherited from BLayoutItem, classes derived from + BLayout must include the BLayout version of this method in their implementation. \param layout The BLayout that this BLayout was detached from. @@ -515,11 +542,10 @@ topLayout->AddItem(nestedLayoutWithView); /*! \fn void BLayout::AncestorVisibilityChanged(bool shown) - \brief Hook method inherited from BLayoutItem, classes derived from BLayout - must include the BLayout version of this method in their + \brief Hook method inherited from BLayoutItem, classes derived from + BLayout must include the BLayout version of this method in their implementation. */ -//@} - +//! @} diff --git a/docs/user/interface/LayoutBuilder.Group.dox b/docs/user/interface/LayoutBuilder.Group.dox index fec1bbea41..94ae3527eb 100644 --- a/docs/user/interface/LayoutBuilder.Group.dox +++ b/docs/user/interface/LayoutBuilder.Group.dox @@ -1,3 +1,23 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com + * Ingo Weinhold, bonefish@cs.tu-berlin.de + * + * Corresponds to: + * /trunk/headers/os/interface/GroupLayoutBuilder.h rev 42274 + * /trunk/src/kits/interface/GroupLayoutBuilder.cpp rev 42274 + */ + + +/*! + \file GroupLayoutBuilder.h + \brief Provides the BLayoutBuilder::Group<> class. +*/ + + /*! \class BLayoutBuilder::Group<> \ingroup interface @@ -32,14 +52,16 @@ /*! \name Constructors - - @{ */ +//! @{ + + /*! - \fn BLayoutBuilder::Group::Group(BWindow* window, - enum orientation, float spacing) + \fn BLayoutBuilder::Group::Group(BWindow *window, + enum orientation orientation=B_HORIZONTAL, + float spacing=B_USE_DEFAULT_SPACING) \brief Creates a new BGroupLayout, and attaches it to a BWindow. \note The top BView* in \a window has its ViewColor set to @@ -71,8 +93,9 @@ /*! - \fn template BLayoutBuilder::Group::Group( - enum orientation, float spacing) + \fn BLayoutBuilder::Group::Group( + enum orientation orientation=B_HORIZONTAL, + float spacing=B_USE_DEFAULT_SPACING) \brief Creates a new BGroupView and targets it. Methods called on this builder will be directed to the new BGroupView's @@ -83,15 +106,16 @@ */ -//@} +//! @} /*! \name Adding BViews and BLayoutItems - - @{ */ + +//! @{ + /*! \fn ThisBuilder& BLayoutBuilder::Group::Add(BView* view) \brief Add a BView to the BGroupLayout this builder represents. @@ -133,7 +157,7 @@ */ -//@} +//! @} /*! @@ -142,14 +166,16 @@ BLayoutBuilder::Base subclass representing the newly added object. These methods push a new builder on top of the stack, you will not be using \c this builder again until you call End(). - - @{ */ +//! @{ + + /*! \fn GroupBuilder BLayoutBuilder::Group::AddGroup( - enum orientation, float spacing, float weight) + enum orientation orientation, float spacing=B_USE_DEFAULT_SPACING, + float weight=1.0f) \brief Construct and add a viewless BGroupLayout, then return a GroupBuilder representing the newly added layout. @@ -157,6 +183,7 @@ \param spacing The spacing to use for the new BGroupLayout. \param weight The weight for the new BGroupLayout in the BGroupLayout this builder represents. + \returns A GroupBuilder representing the newly created BGroupLayout. */ @@ -233,7 +260,8 @@ /*! \fn SplitBuilder BLayoutBuilder::Group::AddSplit( - enum orientation, float spacing, float weight) + enum orientation orientation, float spacing=B_USE_DEFAULT_SPACING, + float weight=1.0f) \brief Create and add a new BSplitView with a weight of \c weight, then return a SplitBuilder representing the new BSplitView. @@ -258,17 +286,18 @@ */ -//@} +//! @} /*! \name Adding BSpaceLayoutItems Some convenience methods for adding special BSpaceLayoutItems. - - @{ */ +//! @{ + + /*! \fn ThisBuilder& BLayoutBuilder::Group::AddGlue( float weight = 1.0f) @@ -305,11 +334,12 @@ /*! \name Accessors - - @{ */ +//! @{ + + /*! \fn BGroupLayout* BLayoutBuilder::Group::Layout() const \brief Get the BGroupLayout this builder represents. diff --git a/docs/user/interface/LayoutBuilder.dox b/docs/user/interface/LayoutBuilder.dox index ae899bb9ab..528a398827 100644 --- a/docs/user/interface/LayoutBuilder.dox +++ b/docs/user/interface/LayoutBuilder.dox @@ -1,5 +1,13 @@ -/*! - \class BLayoutBuilder::Base<> +/* + * Copyright 2010, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Documentation by: + * Alex Wilson + */ + + +/*! \class BLayoutBuilder::Base<> \ingroup interface \ingroup layout \brief Base for all other layout builders in the BLayoutBuilder namespace. diff --git a/docs/user/interface/LayoutItem.dox b/docs/user/interface/LayoutItem.dox index bab2552507..57f82de96c 100644 --- a/docs/user/interface/LayoutItem.dox +++ b/docs/user/interface/LayoutItem.dox @@ -1,3 +1,21 @@ +/* + * Copyright 2010, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Documentation by: + * Alex Wilson + * Corresponds to: + * /trunk/headers/os/interface/LayoutItem.h rev 38207 + * /trunk/src/kits/interface/LayoutItem.cpp rev 38207 + */ + + +/*! + \file LayoutItem.h + Describes the BLayoutItem class +*/ + + /*! \class BLayoutItem \ingroup interface @@ -20,7 +38,7 @@ \fn BLayoutItem::BLayoutItem(BMessage* archive) \brief Archive constructor. - Creates a Bunarchiver for \a archive and calls its Finish() method. + Creates a BLayoutItem from the \a archive message. */ @@ -31,10 +49,21 @@ /*! - \name Reporting size and alignment constraints to a BLayout - @{ + \fn BLayout::~BLayout() + \brief Destructor method. + + Standard Destructor. */ + +/*! + \name Reporting size and alignment constraints to a BLayout +*/ + + +//! @{ + + /*! \fn BSize BLayoutItem::MinSize() = 0 \brief Returns the minimum desirable size for this item. @@ -67,7 +96,7 @@ /*! \fn bool BLayoutItem::HasHeightForWidth() - \brief Returns whether or not this BLayoutItem's height constraints are + \brief Returns whether or not this BLayoutItem's height constraints are dependent on its width. \note By default, this method returns \c false. @@ -77,18 +106,18 @@ /*! \fn void BLayoutItem::GetHeightForWidth(float width, float* min, float* max, float* preferred) - \brief Get this BLayoutItem's height constraints for a given \a width. + \brief Get this BLayoutItem's height constraints for a given \a width. If a BLayoutItem does not have height for width constraints (HasHeightForWidth() returns \c false) it does not need to implement this method. - \note It is prudent to compare \a min, \a max, \a preferred to NULL before - dereferencing them. + \note It is prudent to compare \a min, \a max, \a preferred to \c NULL + before dereferencing them. */ -//@} +//! @} /*! @@ -100,11 +129,12 @@ in when reporting these constraints. It is recommended that all subclasses do this as well, the BAbstractLayoutItem class provides any easy way to include this behaviour in your class. - - @{ */ +//! @{ + + /*! \fn void BLayoutItem::SetExplicitMinSize(BSize size) = 0 \brief Set this item's explicit min size, to be used in MinSize(). @@ -130,7 +160,7 @@ */ -//@} +//! @} /*! @@ -138,11 +168,12 @@ These methods take into account only the local visibility of this item, not the visibility of its ancestors. \n - - @{ */ +//! @{ + + /*! \fn bool BLayoutItem::IsVisible() = 0 \brief Return the current local visibility of this item. If an item is not @@ -160,17 +191,17 @@ */ -//@} +//! @} /*! - \name Getting and setting the current on-screen positioning of \ - a BLayoutItem. - - @{ + \name Getting and setting the current on-screen positioning of a BLayoutItem. */ +//! @{ + + /*! \fn void BLayoutItem::AlignInFrame(BRect frame) \brief Position this BLayoutItem within \a frame, given the value returned @@ -191,21 +222,21 @@ \fn void BLayoutItem::SetFrame(BRect frame) = 0 \brief Set the bounding frame of this item. - \a frame is in the coordinate system of the target view of the - BLayout this item belongs to. + \a frame is in the coordinate system of the target view of the BLayout + that this item belongs to. */ -//@} +//! @} /*! \fn BView* BLayoutItem::View() - \brief Return the BView this item is representing, or NULL if it does not + \brief Return the BView this item is representing, or \c NULL if it does not represent any view. When a BLayoutItem is added to a BLayout, this method is called, and the - returned BView will be added to the BLayout's target view. + returned BView will be added to the BLayout's target view. */ @@ -216,11 +247,12 @@ BLayout. In some implementations they may be handled directly by this BLayoutItem, but many implementations will forward these events to another object. - - @{ */ +//! @{ + + /*! \fn void BLayoutItem::InvalidateLayout(bool children = false) \brief Invalidate the layout of this item, or the object it represents. @@ -237,18 +269,19 @@ */ -//@} +//! @} /*! \name Utility methods for BLayout subclasses \brief Utility methods for the BLayout class to attach and retrieve arbitrary data for a BLayoutItem. - - @{ */ +//! @{ + + /*! \fn void* BLayoutItem::LayoutData() const \brief Retrieve arbitrary data attached to this BLayoutItem. @@ -265,15 +298,17 @@ */ -//@} +//! @} -/*! \name Hook methods - - @{ +/*! + \name Hook methods */ +//! @{ + + /*! \fn void BLayoutItem::AttachedToLayout() \brief Hook called when this object is attached to a BLayout (via @@ -288,16 +323,17 @@ \fn void BLayoutItem::DetachedFromLayout(BLayout* layout) \brief Hook called when this object is attached to a BLayout (via BLayout::RemoveItem()) - \param layout The BLayout you were previously attached to. \warning You should not use this hook to reattach \c this to \a BLayout, doing so will cause undefined behaviour (probably a crash). + + \param layout The BLayout you were previously attached to. */ /*! \fn void BLayoutItem::AncestorVisibilityChanged(bool shown) - \brief Hook called when this BLayoutItem's ancestors change visibility, + \brief Hook called when this BLayoutItem's ancestors change visibility, effectively hiding or showing this item. Implementations of this method should alter the onscreen visibility of this @@ -306,7 +342,9 @@ \note This method should not effect the value returned by this object's IsVisible() method. + + \param shown \c true to show, \c false to hide. */ -//@} +//! @} diff --git a/docs/user/interface/TwoDimensionalLayout.dox b/docs/user/interface/TwoDimensionalLayout.dox index 97b13798c9..df46a08e16 100644 --- a/docs/user/interface/TwoDimensionalLayout.dox +++ b/docs/user/interface/TwoDimensionalLayout.dox @@ -1,3 +1,21 @@ +/* + * Copyright 2010, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Documentation by: + * Alex Wilson + * Corresponds to: + * /trunk/headers/os/interface/TwoDimensionalLayout.h rev 38207 + * /trunk/src/kits/interface/TwoDimensionalLayout.cpp rev 38207 + */ + + +/*! + \file TwoDimensionalLayout.h + \brief Defines the BTwoDimensionalLayout class. +*/ + + /*! \class BTwoDimensionalLayout \ingroup interface @@ -8,9 +26,9 @@ This class manages all the tricky work of actually positioning/resizing items, as well as calculating size constraints and providing extra features, - such as spacing/insets and alignment of multiple BTwoDimensionalLayouts. - Derived classes need only implement a few hook methods to get a working - layout. + such as spacing/insets and alignment of multiple + BTwoDimensionalLayout's. Derived classes need only implement a few hook + methods to get a working layout. \warning This class is not yet finalized, if you use it in your software assume that it will break some time in the future. @@ -35,23 +53,23 @@ /*! \fn void BTwoDimensionalLayout::AlignLayoutWith( - BTwoDimensionalLayout* other, enum orientation) - \brief Align the BLayoutItems in two BTwoDimensionalLayouts with each other - within a certain orientation. + BTwoDimensionalLayout* other, enum orientation orientation) + \brief Align the BLayoutItem's in the specified \a orientation within + two or more BTwoDimensionalLayout's. - When two (or more) BTwoDimensionalLayouts are aligned within a certain - orientation, then the BLayoutItems within those BTwoDimensionalLayouts will - have identical widths or heights (depending on how the - BTwoDimensionalLayouts are aligned). + When two (or more) BTwoDimensionalLayout's are aligned within a + certain \a orientation, then the BLayoutItem's within those + BTwoDimensionalLayout's will have identical widths or heights + (depending on how the BTwoDimensionalLayout's are aligned.) - If you align two BGroupLayouts horizontally, for example, then the - BLayoutItems at index 0 in both BGroupLayouts will be given the same - horizontal area. The same is true for the BLayoutItems at index 1, 2, etc.. - Not all BTwoDimensionalLayouts have to have an item at each index for the - alignment to proceed. + If you align two BGroupLayout's horizontally for example, then the + BLayoutItem at index 0 in both BGroupLayout's will be given the same + horizontal area. The same is true for the BLayoutItem at index 1, + 2, etc. Not all BTwoDimensionalLayout's have to have an item at each + index for the alignment to proceed. \param other The BTwoDimensionalLayout to be aligned with. - \param orientation The orientation on which to be aligned. + \param orientation The \a orientation on which to be aligned. */ @@ -61,7 +79,7 @@ \brief Set the insets for this BTwoDimensionalLayout (in pixels). Set the spacing around the edges of this BTwoDimensionalLayout. If you - pass B_USE_DEFAULT_SPACING for a certain parameter, that parameter will + pass \c B_USE_DEFAULT_SPACING for a certain parameter, that parameter will be replaced with the value returned by BControlLook::DefaultItemSpacing(). \see BTwoDimensionalLayout::GetInsets(); @@ -71,9 +89,9 @@ /*! \fn void BTwoDimensionalLayout::GetInsets(float* left, float* top, float* right, float* bottom) const - \brief Get the insets for this BTwoDimensionalLayout (in pixels). + \brief Get the insets for the BTwoDimensionalLayout (in pixels). - Passing NULL for any paramater is not an error, such parameters will + Passing \c NULL for any parameter is not an error, those parameters will be ignored. \see BTwoDimensionalLayout::SetInsets(); @@ -85,16 +103,17 @@ These methods are called automatically as needed during layout, and provide the BTwoDimensionalLayout class with the necessary information - to properly layout the BLayoutItems in this BTwoDimensionalLayout. - - @{ + to properly layout the BLayoutItem in this BTwoDimensionalLayout. */ +//! @{ + + /*! - \fn void BTwoDimensionalLayout::PrepareItems(enum orientation) - \brief Prepare the BLayoutItems in this BTwoDimensionalLayout subclass - for layout within a certain orientation. + \fn void BTwoDimensionalLayout::PrepareItems(enum orientation orientation) + \brief Prepare the BLayoutItem in this BTwoDimensionalLayout subclass + for layout within a certain \a orientation. This is a good place to update cache information that will be used in other hook methods, for example. @@ -104,7 +123,7 @@ /*! \fn bool BTwoDimensionalLayout::HasMultiColumnItems() \brief Tests whether or not this BTwoDimensionalLayout contains any - BLayoutItems spanning more than one column. + BLayoutItem's spanning more than one column. The BTwoDimensionalLayout implementation returns false. */ @@ -113,7 +132,7 @@ /*! \fn bool BTwoDimensionalLayout::HasMultiRowItems() \brief Tests whether or not this BTwoDimensionalLayout contains any - BLayoutItems spanning more than one row. + BLayoutItem's spanning more than one row. The BTwoDimensionalLayout implementation returns false. */ @@ -121,33 +140,37 @@ /*! \fn int32 BTwoDimensionalLayout::InternalCountColumns() - \brief Return the number of columns in this BTwoDimensionalLayout. + \brief Get the number of columns in the BTwoDimensionalLayout. + + \returns The number of columns in the BTwoDimensionalLayout. */ /*! \fn int32 BTwoDimensionalLayout::InternalCountRows() - \brief Return the number of rows in this BTwoDimensionalLayout. + \brief Get the number of rows in the BTwoDimensionalLayout. + + \returns The number of rows in the BTwoDimensionalLayout. */ /*! - \fn void BTwoDimensionalLayout::GetColumnRowConstraints(enum orientation, - int32 index, ColumnRowConstraints* constraints) + \fn void BTwoDimensionalLayout::GetColumnRowConstraints(enum orientation + orientation, int32 index, ColumnRowConstraints* constraints) \brief Fill in the ColumnRowConstraints for a certain column or row in - this BTwoDimensionalLayout. + the BTwoDimensionalLayout. This method is used to communicate the size constraints and weight for - a given row/column in this BTwoDimensionalLayout. + a given row/column in the BTwoDimensionalLayout. */ /*! \fn void BTwoDimensionalLayout::GetItemDimensions(BLayoutItem* item, Dimensions* dimensions) - \brief Tell the base class what column and row a BLayoutItem is in, as + \brief Tell the base class what column and row a BLayoutItem is in as well as how many columns and rows it covers. */ -//@} +//! @} diff --git a/docs/user/locale/Catalog.dox b/docs/user/locale/Catalog.dox index ed2ac31622..c5e3f3208e 100644 --- a/docs/user/locale/Catalog.dox +++ b/docs/user/locale/Catalog.dox @@ -1,221 +1,248 @@ -/*! -\class BCatalog -\ingroup locale -\brief Class handling string localization. +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de + * John Scipione, jscipione@gmail.com + * Oliver Tappe, zooey@hirschkaefer.de + * + * Corresponds to: + * /trunk/headers/os/locale/Catalog.h rev 42274 + * /trunk/src/kits/locale/Catalog.cpp rev 42274 + */ -BCatalog is the class that allows you to perform string localization. This means -you give it a string in english, and it automatically returns the translation of -this string in the user's specified language, if available. - -Most of the time, you don't have to deal with BCatalog directly. You use the -translation macros instead. However, there are some cases where you will have to -use catalogs directly. These include : - \li Tools for managing catalogs : if you want to add, remove or edit -entries in a catalog, you need to do it using the BCatalog class. - \li Accessing catalogs other than your own : the macros only grant you -access to the catalog linked with your application. To access other catalogs -(for example if you create a script interpreter and want to localize the -scripts), you will have to open a catalog associated with your script. - -\section macros Using the macros -You don't have to do much in your program to handle catalogs. You must first -set the B_TRANSLATE_CONTEXT define to a string that identifies which part of the -application the strings you will translate are in. This allows the translators -to keep track of the strings in the catalog more easily, and find where they are -visible in the application. then, all you have to do, is enclose any string you -want to make translatable in the B_TRANSLATE() macro. This macro has two uses, -it will allow your text to be replaced at run-time by the proper localized one, -but it will also allow to build the base catalog, the one that you will send to -the translator team, from your sourcecode. - -\section chaining Chaining of catalogs -The catalogs you get from the locale kit are designed to use a fallback system -so that the user get strings in the language he's the most fluent with, -depending on what catalogs are available. - -For example, if the user sets his language preferences as french(France), -spanish, english, when an application loads a catalog, the following rules are -used : - \li Try to load a french(France) catalog. If it is found, this catalog - will automatically include strings from the generic french catalog. - \li Try to load a generic french catalog. - \li Try to load a generic spanish catalog. - \li Try to load a generic english catalog. - \li If all of them failed, use the strings that are in the source code. - -Note that french(France) will failback to french, but then directly to the -language in the source code. This avoids mixing 3 or more languages in the same -application if the catalogs are incomplete and avoids confusion. - -*/ /*! -\fn BCatalog::BCatalog(const char* signature, const char* language = NULL, uint32 fingerprint = 0) -\brief Construct a catalog for the given application. - -This constructor builds a catalog for the application with the given mime -signature. In Haiku, the mime signature is used as a way to uniquely identify a -catalog and match it with the corresponding application. - -If you don't specify a language, the system default list will be used. -The language is passed here as a 2 letter ISO code. - -The fingerprint is a way to check that the catalog that will be loaded matches -the current version of the application. A catalog made for a different version -of the application can be loaded if you set the fingerprint to 0. This is -usually not a problem, it only means that some strings may not be translated -properly. But if you want to provide different versions of your application, it -may be useful to separate their catalogs. - -\param signature Mime-signature of the application for which to load a catalog. -\param language The language of the catalog to load. If NULL, the user settings -will be used. -\param fingerprint The fingerprint version-info for the catalog to load. If 0, -the fingerprint will not be checked,and any version of the catalog will be -loaded. -*/ - -/*! -\fn const char* BCatalog::GetString(const char* string, const char* context = NULL, const char* comment = NULL) -\brief Get a string from the catalog. - -This method access the data of the catalog and reeturns you the translated -version of the string. You must pass it the context where the string is, as -the same string may appear somewhere else and need a differnet translation. -The comment is optional. It is meant as an help to translators, when the string -alone is not helpful enough or there are special things to note. The comment is -also used as a way to uniquely identify a string, so if two identical strings -share the same context, it is still possible to provide different translations. - -\returns The translated string, or the one passed as a parameter if no -translation was found. -\param string The string to translate. -\param context The context where the string is located. -\param comment Supplementary comment for translators. -*/ - -/*! -\fn const char* BCatalog::GetString(uint32 id) -\brief Get a string by id from the catalog. - -The id based version of this method is slightly faster, as it doesn't have to -compute the hash from the 3 parameters. However, it will fail if there is an -hash collision, so you should still fallback to the first one in case of -problems. Also note that the hash value may be different from one catalog to -another, depending on the file format they are stored in, so you shouldn't rely -on this method unless you are sure you can keep all the catalog files under -control. - -\returns The translated string if found, or an empty string. -\param id The identifier of the string. -*/ - -/*! -\fn const char* BCatalog::GetStringNoAutoCollate(const char* string, const char* context = NULL, const char* comment = NULL) -\fn const char* GetStringNoAutoCollate(uint32 id) -\brief Get a string from the catalog, without registering it for collectcatkeys. - -This function does exactly the same thing as GetString, except it will not be -parsed by the collectcatkeys tool. This allows you, for example, to translate a -string constant that you declared at another place, without getting a warning -message from collectcatkeys. - -\returns The translated string, or the one passed as a parameter if no -translation was found. -\param string The string to translate. -\param context The context where the string is located. -\param comment Supplementary comment for translators. + \file Catalog.h + \brief Provides the BCatalog class. */ /*! -\fn status_t BCatalog::GetData(const char* name, BMessage* msg) -\brief Get custom data from the catalog. + \class BCatalog + \ingroup locale + \brief Class handling string localization. -This function allows you to localize something else than raw text. This may -include pictures, sounds, videos, or anything else. Note there is no support for -generatinga catalog with such data inside, and the current format may not -support it. If you need to localize data that is not text, it is advised to -handle it by yourself. + BCatalog is the class that allows you to perform string localization. This + means you give it a string in english, and it automatically returns the + translation of this string in the user's specified language, if available. -\returns An error code. -\param name The name of the data to retrieve. -\param msg The BMessage to fill in with the data. + Most of the time, you don't have to deal with BCatalog directly. You use + the translation macros instead. However, there are some cases where you + will have to use catalogs directly. These include : + \li Tools for managing catalogs : if you want to add, remove or edit + entries in a catalog, you need to do it using the BCatalog class. + \li Accessing catalogs other than your own : the macros only grant you + access to the catalog linked with your application. To access + other catalogs (for example if you create a script interpreter and + want to localize the scripts), you will have to open a catalog + associated with your script. + + \section macros Using the macros + You don't have to do much in your program to handle catalogs. You must + first set the B_TRANSLATE_CONTEXT define to a string that identifies which + part of the application the strings you will translate are in. This allows + the translators to keep track of the strings in the catalog more easily, + and find where they are visible in the application. then, all you have to + do, is enclose any string you want to make translatable in the + B_TRANSLATE() macro. This macro has two uses, it will allow your text to + be replaced at run-time by the proper localized one, but it will also + allow to build the base catalog, the one that you will send to the + translator team, from your sourcecode. + + \section chaining Chaining of catalogs + The catalogs you get from the locale kit are designed to use a fallback + system so that the user get strings in the language he's the most fluent + with, depending on what catalogs are available. + + For example, if the user sets his language preferences as french(France), + spanish, english, when an application loads a catalog, the following rules + are used : + \li Try to load a french(France) catalog. If it is found, this catalog + will automatically include strings from the generic french catalog. + \li Try to load a generic french catalog. + \li Try to load a generic spanish catalog. + \li Try to load a generic english catalog. + \li If all of them failed, use the strings that are in the source code. + + Note that french(France) will failback to french, but then directly to the + language in the source code. This avoids mixing 3 or more languages in the + same application if the catalogs are incomplete and avoids confusion. */ + /*! -\fn status_t BCatalog::GetData(uint32 id, BMessage* msg) -\brief Get custom data from the catalog. + \fn BCatalog::BCatalog(const char* signature, const char* language = NULL, + uint32 fingerprint = 0) + \brief Construct a catalog for the given application. -As for GetString, the id-based version may be subject to hash-collisions, but is -faster. + This constructor builds a catalog for the application with the given mime + signature. In Haiku, the mime signature is used as a way to uniquely + identify a catalog and match it with the corresponding application. -Note the current catalog format doesn't allow storing custom data in catalogs, -so the only way to use this function is providing your own catalog add-on for -storing the data. + If you don't specify a language, the system default list will be used. + The language is passed here as a 2 letter ISO code. + + The fingerprint is a way to check that the catalog that will be loaded + matches the current version of the application. A catalog made for a + different version of the application can be loaded if you set the + fingerprint to \c 0. This is usually not a problem, it only means that + some strings may not be translated properly. But if you want to provide + different versions of your application, it may be useful to separate their + catalogs. + + \param signature Mime-signature of the application for which to load a + catalog. + \param language The language of the catalog to load. If NULL, the user + settings will be used. + \param fingerprint The fingerprint version-info for the catalog to load. + If \c 0, the fingerprint will not be checked,and any version of the + catalog will be loaded. */ + /*! -\fn status_t BCatalog::GetSignature(BString* sig) -\brief Get the catalog mime-signature. + \fn const char* BCatalog::GetString(const char* string, + const char* context = NULL, const char* comment = NULL) + \brief Get a string from the catalog. -This function fills the sig string with the mime-signature associated to the -catalog. + This method access the data of the catalog and reeturns you the translated + version of the string. You must pass it the context where the string is, as + the same string may appear somewhere else and need a differnet translation. + The comment is optional. It is meant as an help to translators, when the + string alone is not helpful enough or there are special things to note. + The comment is also used as a way to uniquely identify a string, so if two + identical strings share the same context, it is still possible to provide + different translations. -\param sig The string where to copy the signature. -\returns An error code. + \param string The string to translate. + \param context The context where the string is located. + \param comment Supplementary comment for translators. + + \returns The translated string, or the one passed as a parameter if no + translation was found. */ + /*! -\fn status_t BCatalog::GetLanguage(BString* lang) -\brief Get the catalog language. + \fn const char* BCatalog::GetString(uint32 id) + \brief Get a string by id from the catalog. -This function fills the lang string with the language name for the catalog. + The id based version of this method is slightly faster, as it doesn't + have to compute the hash from the 3 parameters. However, it will fail + if there is an hash collision, so you should still fallback to the first + one in case of problems. Also note that the hash value may be different + from one catalog to another, depending on the file format they are stored + in, so you shouldn't rely on this method unless you are sure you can keep + all the catalog files under control. -\param sig The string where to copy the language. -\returns An error code. + \param id The identifier of the string. + \returns The translated string if found, or an empty string. */ + /*! -\fn status_t BCatalog::GetFingerprint(uint32* fp) -\brief Get the catalog fingerprint. + \fn status_t BCatalog::GetData(const char* name, BMessage* msg) + \brief Get custom data from the catalog. -This function setsfp to the fingerprint of the catalog. This allows you to check -which version of the sourcecode this catalog was generated from. + This function allows you to localize something else than raw text. This + may include pictures, sounds, videos, or anything else. Note there is no + support for generating a catalog with such data inside, and the current + format may not support it. If you need to localize data that is not text, + it is advised to handle it by yourself. -\returns An error code. -\param fp The integer to set to the fingerprint value. + \param name The name of the data to retrieve. + \param msg The BMessage to fill in with the data. + + \returns An error code. */ + /*! -\fn status_t BCatalog::SetCatalog(const char* signature, uint32 fingerprint) -\brief Reload the string data. + \fn status_t BCatalog::GetData(uint32 id, BMessage* msg) + \brief Get custom data from the catalog. -This function reloads the data for the given signature and fingerprint. + As for GetString, the id-based version may be subject to hash-collisions, + but is faster. -\returns An error code. -\param signature The signature of the catalog youwant to load -\param fingerprint The fingerprint of the catalog you want to load. + Note the current catalog format doesn't allow storing custom data in + catalogs, so the only way to use this function is providing your own + catalog add-on for storing the data. */ + /*! -\fn status_t BCatalog::InitCheck() const -\brief Check if the catalog is in an useable state. + \fn status_t BCatalog::GetSignature(BString* sig) + \brief Get the catalog mime-signature. -This function returns B_OK if the catalog is initialized properly. + This function fills the sig string with the mime-signature associated to the + catalog. + + \param sig The string where to copy the signature. + + \returns An error code. */ + /*! -\fn int32 BCatalog::CountItems() -\brief Returns the number of items in the catalog. + \fn status_t BCatalog::GetLanguage(BString* lang) + \brief Get the catalog language. -This function returns the number of strings in the catalog. + This function fills the lang string with the language name for the catalog. + + \param lang The string where to copy the language. + + \returns An error code. */ + /*! -\fn BCatalogaddOn* BCatalog::CatalogAddOn() -\brief Returns the internal storage for this catalog. + \fn status_t BCatalog::GetFingerprint(uint32* fp) + \brief Get the catalog fingerprint. -This function returns the internal storage class used by this catalog. -You should not have to use it. + This function setsfp to the fingerprint of the catalog. This allows you + to check which version of the sourcecode this catalog was generated from. + + \param fp The integer to set to the fingerprint value. + + \returns An error code. +*/ + + +/*! + \fn status_t BCatalog::SetCatalog(const char* signature, uint32 fingerprint) + \brief Reload the string data. + + This function reloads the data for the given signature and fingerprint. + + \param signature The signature of the catalog youwant to load + \param fingerprint The fingerprint of the catalog you want to load. + + \returns An error code. +*/ + + +/*! + \fn status_t BCatalog::InitCheck() const + \brief Check if the catalog is in an useable state. + + \returns \c B_OK if the catalog is initialized properly. +*/ + + +/*! + \fn int32 BCatalog::CountItems() + \brief Returns the number of items in the catalog. + + \returns the number of strings in the catalog. +*/ + + +/*! + \fn BCatalogaddOn* BCatalog::CatalogAddOn() + \brief Returns the internal storage for this catalog. + + \returns the internal storage class used by this catalog. You should + not have to use it. */ diff --git a/docs/user/locale/Collator.dox b/docs/user/locale/Collator.dox index 2f47acaf0d..e1405759ce 100644 --- a/docs/user/locale/Collator.dox +++ b/docs/user/locale/Collator.dox @@ -1,154 +1,225 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de + * Adrien Destugues + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * /trunk/headers/os/locale/Collator.h rev 42274 + * /trunk/src/kits/locale/Collator.cpp rev 42274 + */ + + /*! -\class BCollator -\ingroup locale -\brief Class for handling collation of string + \file Collator.h + \brief Provides the BCollator class. +*/ -BCatalog is designed to handle collations (sorting) of strings. -The collation is done using a set of rules that changes from a country to another. -For example, in spanish, 'ch' is consiidered as a letter and is sorted between 'c' and 'd'. -This class is alsoable to perform natural sorting, so that '2' is sorted before '10', -which is not the case when you do a simple ASCII sort. -\warning This class is not multithread-safe, as Compare() and GetKey() change -the ICUCollator (the strength). So if you want to use a BCollator from -more than one thread, you need to protect it with a lock. +/*! + \class BCollator + \ingroup locale + \brief Class for handling collation of string + BCatalog is designed to handle collations (sorting) of strings. + The collation is done using a set of rules that changes from a country + to another. For example, in spanish, 'ch' is consiidered as a letter + and is sorted between 'c' and 'd'. This class is alsoable to perform + natural sorting, so that '2' is sorted before '10', which is not the + case when you do a simple ASCII sort. + + \warning This class is not multithread-safe, as Compare() and GetKey() + change the ICUCollator (the strength). So if you want to use a + BCollator from more than one thread, you need to protect it with a lock. */ /*! -\fn BCollator::BCollator() -\brief Construct a collator for the default locale. + \fn BCollator::BCollator() + \brief Construct a collator for the default locale. + + Empty contructor. */ /*! -\fn BCollator::BCollator(const char* locale, int8 strength = B_COLLATE_PRIMARY, bool ignorePunctiation = false) -\brief Construct a collator for the given locale. + \fn BCollator::BCollator(const char* locale, + int8 strength = B_COLLATE_PRIMARY, bool ignorePunctuation = false) + \brief Construct a collator for the given locale. -This constructor loads the data for the given locale. You can also adjust the strength and -tell if the collator should take punctuation into account when sorting. + This constructor loads the data for the given locale. You can also + adjust the strength and tell if the collator should take punctuation + into account when sorting. + + \param locale The \a locale. + \param strength The collator class provide four level of strength. These + define the handling of various things. + \li \c B_COLLATE_PRIMARY doesn't differentiate e from é, + \li \c B_COLLATE_SECONDARY takes letter accents into account, + \li \c B_COLLATE_TERTIARY is case sensitive, + \li \c B_COLLATE_QUATERNARY is very strict. Most of the time you + shouldn't need to go that far. + \param ignorePunctuation Ignore punctuation in the Collator when sorting. */ /*! -\fn BCollator::BCollator(BMessage* archive) -\brief Unarchive a collator. + \fn BCollator::BCollator(BMessage* archive) + \brief Unarchive a collator from a message. + + \param archive The message to unarchive the BCollator from. */ /*! -\fn BCollator::BCollator(const BCollator& other) -\brief Copy constructor. + \fn BCollator::BCollator(const BCollator& other) + \brief Copy constructor. + + Constructs a BCollator by making a copy of another BCollator. + + \param other The BCollator to copy from. */ /*! -\fn BCollator::~Bcollator() -\brief Destructor. + \fn BCollator::~BCollator() + \brief Destructor. + + Standard destructor method. */ /*! -\fn Bcollator& BCollator::operator=(const BColltr& other) -\brief Assignment operator. + \fn Bcollator& BCollator::operator=(const BCollator& other) + \brief Assignment operator. + + \param other the BCollator to assign from. */ /*! -\fn void BCollator::SetDefaultStrength(int8 strength) -\brief Set the strength of the collator. + \fn void BCollator::SetDefaultStrength(int8 strength) + \brief Set the strength of the collator. -The collator class provide four level of strength. These define the handling of -various things. -\item B_COLLATE_PRIMARY doesn't differenciate e from é, -\item B_COLLATE_SECONDARY takes them into account, -\item B_COLLATE_TERTIARY is case sensitive, -\item B_COLLATE_QUATERNARY is very strict. Most of the time you shouldn't need -to go that far. + Note that the \a strength can also be given on a case-by-case basis + when calling other methods. -Note the strength can also be given on a case-by-case basis when calling other -methods. - -\param strength The strength the catalog should use as default. + \param strength The collator class provide four level of strength. + These define the handling of various things. + \li \c B_COLLATE_PRIMARY doesn't differentiate e from é, + \li \c B_COLLATE_SECONDARY takes letter accents into account, + \li \c B_COLLATE_TERTIARY is case sensitive, + \li \c B_COLLATE_QUATERNARY is very strict. Most of the time you + shouldn't need to go that far. */ /*! -\fn int8 BCollator::DefaultStrength() const -\brief Returns the current strength of this catalog. + \fn int8 BCollator::DefaultStrength() const + \brief Get the current strength of this catalog. + + \returns the current strength of this catalog. */ /*! -\fn void BCollator::SetIgnorePunctuation(bool ignore) -\brief Enable or disable punctuation handling + \fn void BCollator::SetIgnorePunctuation(bool ignore) + \brief Enable or disable punctuation handling -This function enables or disables the handling of punctuations. + This function enables or disables the handling of punctuations. -\param ignore Boolean telling if the punctuation should be ignored. + \param ignore Boolean telling if the punctuation should be ignored. */ /*! -\fn bool BCollator::IgnorePunctuation() const -\brief Return the behaviour ofthe collator regarding punctuation. + \fn bool BCollator::IgnorePunctuation() const + \brief Gets the behavior of the collator regarding punctuation. -This function returns true if the collator will take punctuation into account -when sorting. + This function returns \c true if the collator will take punctuation into + account when sorting. */ /*! -\fn satus_t BCollator::GetSortKey(const char* string, BString* key, int8 strength) const -\brief Compute the sortkey of a string + \fn satus_t BCollator::GetSortKey(const char* string, BString* key, + int8 strength) const + \brief Compute the sortkey of a string. -A sortkey is a modified version of the string that you can use for faster -comparison with other sortkeys, using strcmp or a similar ASCII comparison. If -you need to compare a string with other ones a lot of times, storing the sortkey -will allow you to do the comparisons faster. + A sortkey is a modified version of the string that you can use for faster + comparison with other sortkeys, using strcmp or a similar ASCII comparison. + If you need to compare a string with other ones a lot of times, storing + the sortkey will allow you to do the comparisons faster. -\param string String from which to compute the sortkey. -\param key The resulting sortkey. -\param strength The strength to use for computing the sortkey. + \param string String from which to compute the sortkey. + \param key The resulting sortkey. + \param strength The \a strength to use for computing the sortkey. -\returns B_OK if everything went well. + \returns B_OK if everything went well. */ /*! -\fn int BCollator::Compare(const char* s1, const char* s2, int8 strength) const -\brief Compare two strings. + \fn int BCollator::Compare(const char* s1, const char* s2, + int8 strength) const + \brief Compare two strings. -This function returns the difference betweens the two strings, in a way similar -to strcmp. + Returns the difference betweens the two strings similar to strcmp(). -\param s1,s2 The strings to compare. -\returns The comparison value. 0 if the strings are equal, negative if s1s2. + \param s1 The first string to compare. + \param s2 The second string to compare. + \param strength The \a strength to use for comparing the strings. + + \retval 0 if the strings are equal. + \retval <0 if s1 is less than s2. + \retval >0 if s1 is greater than s2. */ /*! -\fn bool BCollator::Equal(const char* s1, const char* s2, int8 strength) const -\brief Checks two strings for equality. + \fn bool BCollator::Equal(const char* s1, const char* s2, + int8 strength) const + \brief Checks two strings for equality. -Compares two strings for equality. Note that different strings may end up being -equal, for example if the differences are only in case and punctuation, -depending on the strenght used. Quaterary strength will make this function -return true only if the strings are byte-for-byte identical. + Compares two strings for equality. Note that different strings may end + up being equal, for example if the differences are only in case and + punctuation, depending on the strength used. Quaterary strength will + make this function return true only if the strings are byte-for-byte + identical. -\returns True if the two strings are identical. + \param s1 The first string to compare. + \param s2 The second string to compare. + \param strength The \a strength to use for comparing the strings. + + \returns \c true if the strings are identical, otherwise \c false. */ /*! -\fn bool BCollator::Greater(cosnt char* s1, const char* s2, int8 strength) const) -\brief Tell if a string is greater than another. + \fn bool BCollator::Greater(cosnt char* s1, const char* s2, + int8 strength) const + \brief Determine if a string is greater than another. -\returns True if s1 is greater (not equal) than s2. + \note !Greater(s1, s2) does the same thing as Greater(s2, s1) -\note !Greater(s1, s2) does the same thing as Greater(s2, s1) + \param s1 The first string to compare. + \param s2 The second string to compare. + \param strength The \a strength to use for comparing the strings. + + \returns \c true if s1 is greater than, but not equal to, s2. */ /*! -\fn bool BCollator::GreaterOrEqual(cosnt char* s1, const char* s2, int8 strength) const) -\brief Tell if a string is greater than another. + \fn bool BCollator::GreaterOrEqual(cosnt char* s1, const char* s2, + int8 strength) const + \brief Tell if a string is greater than another. -\returns True if s1 is greater or equal to s2. + \param s1 The first string to compare. + \param s2 The second string to compare. + \param strength The \a strength to use for comparing the strings. + + \returns \c true if s1 is greater or equal than s2. */ /*! -\fn static BArchivable* BCollator::Instanciate(BMessage* archive) -\brief Unarchive the collator + \fn static BArchivable* BCollator::Instantiate(BMessage* archive) + \brief Unarchive the collator -Thif function allows you to restore a collator that you previously archived. It -is faster to do that than to buid a collator and set it up by hand every time -you need it with the same settings. + This function allows you to restore a collator that you previously + archived. It is faster to do that than to buid a collator and set + it up by hand every time you need it with the same settings. + + \param archive The message to restore the collator from. + + \returns A BArchivable object containing the BCollator or \c NULL. */ + diff --git a/docs/user/locale/Country.dox b/docs/user/locale/Country.dox index 0247af8894..80231ec1d5 100644 --- a/docs/user/locale/Country.dox +++ b/docs/user/locale/Country.dox @@ -1,70 +1,91 @@ -/*! -\class BCountry -\ingroup locale -\brief Class representing a country +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de. + * Adrien Destugues, pulkomandy@gmail.com. + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * /trunk/headers/os/locale/Country.h rev 42274 + * /trunk/src/kits/locale/Country.cpp rev 42274 + */ -BCountry provides all the information about a particular country. -This includes the country flag (as an HVIF icon), the localized name of the -country, and the iso country code. - -Date, timeand numer formatting also depends to some extent of the language, -so they are done in the BLocale classinstead. +/*! \file Country.h + \brief BCountry class definition. */ -/*! -\fn BCountry::BCountry(const char* languageCode, const char* countryCode) -\brief Constructor. -Construct a BCountry from a language and a country code. +/*! \class BCountry + \ingroup locale + \brief Class representing a country + BCountry provides all the information about a particular country. + This includes the country flag (as an HVIF icon), the localized name + of the country, and the ISO country code. + + Date, time, and numer formatting also depends to some extent on the + language used, so they are found in the BLocale class instead. */ -/*! -\fn bool BCountry::GetName(BString& name) const -\brief Get the name of the country - -Fills in the name parameter with the name of the country, in the user's locale. -*/ /*! -\fn const char* BCountry::Code() const -\brief Returns the country code. + \fn BCountry::BCountry(const char* countryCode) + \brief Initialize a BCountry from a country code. + + \param countryCode The country code to initialize from. */ + /*! -\fn status_t BCountry::GetIcon(BBitmap* result) const; -\brief Render the country's flag to the given BBitmap + \fn BCountry::BCountry(const BCountry& other) + \brief Initialize a BCountry from another BCountry object. -This function renders the Country's flag to the given BBitmap. The bitmap -should already be set to the pixel format and size you want to use. - -The flag is stored in HVIF format and can be rendered atany size and color depth. - -\param result The BBitmap to drag the flag to. -\returns B_OK if the drawing was successful. + \param other The BCountry object to initialize from. */ + /*! -\fn const char* BCountry::GetLocalizedString(uint32 id) const; -\brief Get one of the default localized strings for this country. - -The strings include monetary symbols and other similar things. - + \fn BCountry& BCountry::operator=(const BCountry& other) */ + /*! -\fn int8 BCountry::Measurement() const -\brief Returrns the measurement used in this country. - -\returns B_METRIC for the metric system, or B_US for the USA's system. + \fn BCountry::~BCountry() + \brief Destructor method. */ + /*! -\fn int BCountry::GetTimeZones(BList& timezones) const -\brief Returns all the timeaones used in this country. + \fn bool BCountry::GetName(BString& name) const + \brief Get the name of the country. -The count may vary from 0 for countries where there is no data, to twelve, for Russia. - -\returns The number of timezones that were added to the list. + Fills in the name parameter with the name of the country in the + language set by the user's locale. +*/ + + +/*! + \fn const char* BCountry::Code() const + \brief Gets the ISO country code for the country. + + \returns The ISO country code for the country. +*/ + + +/*! + \fn status_t BCountry::GetIcon(BBitmap* result) const; + \brief Render the country's flag to the given BBitmap. + + This function renders the country's flag to the given BBitmap. The bitmap + should already be set to the pixel format and size you want to use. + + The flag is stored in HVIF format so it can be rendered at any size and + color depth. + + \param result The BBitmap to drag the flag into. + + \returns \c B_OK if the drawing was successful. */ diff --git a/docs/user/locale/Locale.dox b/docs/user/locale/Locale.dox index 4aa20fe1b9..93ace80d9a 100644 --- a/docs/user/locale/Locale.dox +++ b/docs/user/locale/Locale.dox @@ -1,154 +1,517 @@ -/*! -\class BLocale -\ingroup locale -\brief Class for representing a locale and its settings. +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de. + * John Scipione, jscipione@gmail.com + * Oliver Tappe, zooey@hirschkaefer.de. + * + * Corresponds to: + * /trunk/headers/os/locale/Locale.h rev 42274 + * /trunk/src/kits/locale/Locale.cpp rev 42274 + */ -A locale is defined by the combination of a country and a language. Using these -two informations, it is possible to determine the format to use for date, time, -and number formatting. The BLocale class also provide collators, which allows -you to sort a list of strings properly depending on a set of rules about -accented chars and other special cases that vary over the different locales. - -BLocale is also the class to use when you want to perform formatting or parsing -of dates, times, and numbers, in the natural language of the user. - -*/ /*! -\fn const BCollator* BLocale::Collator() const -\brief Returns the collator associated to this locale. - -Returns the collator in use for this locale, allowing you to use it to sort a -set of strings. - + \file Locale.h + \brief Provides the BLocale class. */ + +/*! \class BLocale + \ingroup locale + \brief Class for representing a locale and its settings. + + A locale is defined by the combination of a country and a language. + Using these two informations, it is possible to determine the format + to use for date, time, and number formatting. The BLocale class also + provide collators, which allows you to sort a list of strings properly + depending on a set of rules about accented chars and other special + cases that vary over the different locales. + + BLocale is also the class to use when you want to perform formatting + or parsing of dates, times, and numbers, in the natural language of + the user. +*/ + + /*! -\fn const BCountry* BLocale::Country() const -\brief Returns the country associated to this locale. - -A locale is defined by the combination of a country and a language. This -method gets the country part of this information, so you can access the -data that is not language-dependant (such as the country flag). - + \fn BLocale::BLocale(const BLanguage* language, + const BFormattingConventions* conventions) + \brief Initializes a BLocale object corresponding to the passed in + \a language and \a conventions. */ + /*! -\fn const BLanguage* BLocale::Language() const -\brief Returns the language associated to this locale. - + \fn BLocale::BLocale(const BLocale& other) + \brief Initializes a BLocale object. */ + /*! -\fn const char* BLocale::Code() const -\brief Returns the locale code. + status_t BLocale::GetCollator(BCollator* collator) const + \brief Gets the collator associated to this locale. -This function returns the locale name (such as en_US for united states english). + Returns the collator in use for this locale, allowing you to use it + to sort a set of strings. */ + /*! -\fn bool BLocale::GetName(BString& name) const -\brief Get the name of the locale. - -This function fills the name string with the localized name of this locale. -For example, if the locale us en_US and the user language is french, this function will return "anglais (Etats-Unis)". + \fn BLocale& BLocale::operator=(const BLocale& other) */ + /*! -\fn void BLocale::SetCountry(const BCountry& newCountry) -\brief Set the country for this locale. + \fn BLocale::~BLocale() + \brief Destructor method. */ + /*! -\fn void BLocale::SetCollator(const BCollator& newCollator) -\brief Set the collator for this locale. + \fn status_t BLocale::GetCollator(BCollator* collator) const + \brief Sets \a collator object to the default collator for the BLocale. + + \param collator A pointer to a BCollator object to fill out. + + \returns A status code. + \retval B_OK Everything went well. + \retval B_BAD_VALUE \c NULL \a collator object passed in. + \retval B_ERROR Unable to lock the BLocale. */ + /*! -\fn void BLocale::SetLanguage(const char* languageCode) -\brief Set the language for this locale. + \fn status_t BLocale::GetLanguage(BLanguage* language) const + \brief Sets \a language object to the default language for the BLocale. + + \param language A pointer to a BLanguage object to fill out. + + \returns A status code. + \retval B_OK Everything went well. + \retval B_BAD_VALUE \c NULL \a language object passed in. + \retval B_ERROR Unable to lock the BLocale. */ + /*! -\fn status_t BLocale::FormatDate(char* string, size_t maxSize, time_t time, bool longFormat) -\brief Format a date. + \fn status_t BLocale::GetFormattingConventions( + BFormattingConventions* conventions) const + \brief Sets \a conventions object to the default formatting conventions + for the BLocale. -Fills in the string with a formatted date. The longFormat parameter allows you -to select the short or the full format. + \param conventions A pointer to a BFormattingConventions object to fill out. -\param string The string buffer to fill with the formated date. -\param maxSize The size of the buffer. -\param time The time (in seconds since epoch) to format -\param longFormat If true, uses the long format (with day name, full month name). If false, use the short format, 08/12/2010 or similar. + \returns A status code. + \retval B_OK Everything went well. + \retval B_BAD_VALUE \c NULL \a conventions object passed in. + \retval B_ERROR Unable to lock the BLocale. */ + /*! -\fn status_t BLocale::FormatDate(BString* string, time_t time, bool longFormat) -\brief Formats a date to a BString. + \fn const char* BLocale::GetString(uint32 id) const + \brief Gets the language string for the locale. + + \param id The locale \a id to get the language of. + + \internal Assumes a certain order of the string bases. + + \returns a blank string in the case of an error or the string "UTF-8" + if there is \a id is set to \a B_CODESET. */ + /*! -\fn status_t BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount, time_t time, bool longFormat) -\brief Format a date and get information about the different fields. + \fn void BLocale::SetFormattingConventions( + const BFormattingConventions& conventions) + \brief Sets the formatting convention for this locale. -This works the same way as the other FormatDatz methods, but also gives you the -offset of the beginning of each field in the date. This is useful if you need to -split the date in different parts for an user-modifiable area (see the Time -preflet for an example). - -To identify the content of each field, you can use GetDateFields. - -This function allocates the fieldPositions arrays, you have to free it when you -are finished with it. - -\sa GetDateFields + \param conventions The formatting convention to set. */ + /*! -\fn status_t BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, bool longFormat) const -\brief Get the type of each field in this date format - -This function is most often used in combination with FormatDate. FormatDate -gives you the offset of each field in a formated string, anf GetDateFields gives -you the type of the field at a given offset. With these informations, you can -handle the formatted date string as a list of fields that you can split and -alter at will. + \fn void BLocale::SetCollator(const BCollator& newCollator) + \brief Set the collator for this locale. + \param newCollator The collator to set. */ + /*! -\fn status_t BLocale::GetDateFormat(BString& format, bool longFormat) const -\brief Get the date format string + \fn void BLocale::SetLanguage(const BLanguage& newLanguage) + \brief Set the language for this locale. -This function returns the string used internally to represent a date format. + \param newLanguage The code of the language to set to locale to. */ + /*! -\fn status_t BLocale::SetDateFormat(const char* formatString, bool longFormat) -\brief Set the date format for this locale + \fn ssize_t BLocale::FormatDate(char* string, size_t maxSize, time_t time, + BDateFormatStyle style) const + \brief Fills in \a string with a formatted date up to \a maxSize bytes for + the given \a time and \a style for the locale. -Thisfunction allows you to define your own date format for specific purposes. + \param string The string buffer to fill with the formatted date. + \param maxSize The size of the buffer. + \param time The time (in seconds since epoch) to format + \param style Specify the long format (with day name, full + month name) or the short format, 08/12/2010 or similar. + + \returns The number of bytes written during the date formatting. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + \retval B_BAD_VALUE CheckedArrayByteSink overflowed. + + \sa BLocale::FormatDateTime(char* target, size_t maxSize, + time_t time, BDateFormatStyle dateStyle, + BTimeFormatStyle timeStyle) const + \sa BLocale::FormatTime(char* string, size_t maxSize, time_t time, + BTimeFormatStyle style) const */ + /*! -\fn int BLocale::StartOfWeek() const -\brief Returns the day used as start of week in this locale. + \fn status_t BLocale::FormatDate(BString *string, time_t time, + BDateFormatStyle style, const BTimeZone* timeZone) const + \brief Fills in \a string with a formatted date for the given + \a time, \a style, and \a timeZone for the locale. + \param string The string buffer to fill with the formatted date. + \param time The time (in seconds since epoch) to format + \param style Specify the long format (with day name, full + month name) or the short format, 08/12/2010 or similar. + \param timeZone The time zone. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + + \sa BLocale::FormatDateTime(BString* target, time_t time, + BDateFormatStyle dateStyle, BTimeFormatStyle timeStyle, + const BTimeZone* timeZone) const + \sa status_t BLocale::FormatTime(BString* string, time_t time, + BTimeFormatStyle style, const BTimeZone* timeZone) const */ + /*! -\fn int BLocale::StringCompare(const char* s1, const char* s2) const -\fn int BLocale::StringCompare(const BString* s1, const BString* s2) const -\brief Compares two strings using the locale's collator + \fn status_t BLocale::FormatDate(BString* string, int*& fieldPositions, + int& fieldCount, time_t time, BDateFormatStyle style) const + \brief Fills in \a string with a formatted date for the given + \a time and \a style for the locale. -These methods are short-hands to Collator()->StringCompare. + \param string The string buffer to fill with the formatted date. + \param fieldPositions ??? + \param fieldCount ??? + \param time The time (in seconds since epoch) to format + \param style Specify the long format (with day name, full + month name) or the short format, 08/12/2010 or similar. + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale or an error formatting the date. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + + \sa BLocale::FormatTime(BString* string, int*& fieldPositions, + int& fieldCount, time_t time, BTimeFormatStyle style) const */ + /*! -\fn void BLocale::GetSortKey(const char* string, BString* key) const -\brief Computes the sort key of a string + \fn status_t BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, + BDateFormatStyle style) const + \brief Get the type of each field in the date format of the locale. -This method is a short-hand to Collator()->GetSortKey. + This function is most often used in combination with FormatDate(). + FormatDate() gives you the offset of each field in a formatted string, + and GetDateFields() gives you the type of the field at a given offset. + With these informations, you can handle the formatted date string as + a list of fields that you can split and alter at will. + \param fields Pointer to the fields object. + \param fieldCount The number of fields. + \param style Specify the long format (with day name, full + month name) or the short format, 08/12/2010 or similar. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale or an error getting the date + fields. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + + \sa BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount, + BTimeFormatStyle style) const +*/ + + +/*! + \fn int BLocale::StartOfWeek() const + \brief Returns the number of the day used as start of week in this locale. + + \returns a flag that indicates the day of the week that the week starts or + B_ERROR if there was an error. + \retval B_ERROR Unable to lock the BLocale. + \retval B_WEEK_START_SUNDAY If the beginning of the week starts on Sunday. + \retval B_WEEK_START_MONDAY If the beginning of the week starts on Monday. +*/ + + +/*! + \fn ssize_t BLocale::FormatDateTime(char* target, size_t maxSize, + time_t time, BDateFormatStyle dateStyle, + BTimeFormatStyle timeStyle) const + \brief Fills in \a string with a formatted datetime up to \a maxSize bytes + for the given \a time and \a style for the locale. + + \param target The string buffer to fill with the formatted datetime. + \param maxSize The size of the buffer. + \param time The time (in seconds since epoch) to format + \param dateStyle Specify the long format or the short format of the date. + \param timeStyle Specify the long format or the short format of the time. + + \returns The number of bytes written during the datetime formatting. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + \retval B_BAD_VALUE CheckedArrayByteSink overflowed. + + \sa BLocale::FormatDate(char* string, size_t maxSize, time_t time, + BDateFormatStyle style) const + \sa BLocale::FormatTime(char* string, size_t maxSize, time_t time, + BTimeFormatStyle style) const +*/ + + +/*! + \fn status_t BLocale::FormatDateTime(BString* target, time_t time, + BDateFormatStyle dateStyle, BTimeFormatStyle timeStyle, + const BTimeZone* timeZone) const + \brief Fills in \a string with a formatted datetime for the given + \a time, \a timeStyle, and \a timeZone for the locale. + + \param target The string buffer to fill with the formatted date. + \param time The time (in seconds since epoch) to format + \param dateStyle Specify the long format or the short format of the date. + \param timeStyle Specify the long format or the short format of the time. + \param timeZone The time zone. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + + \sa BLocale::FormatDate(BString *string, time_t time, + BDateFormatStyle style, const BTimeZone* timeZone) const + \sa status_t BLocale::FormatTime(BString* string, time_t time, + BTimeFormatStyle style, const BTimeZone* timeZone) const +*/ + + +/*! + \fn ssize_t BLocale::FormatTime(char* string, size_t maxSize, time_t time, + BTimeFormatStyle style) const + \brief Fills in \a string with a formatted date up to \a maxSize bytes for + the given \a time and \a style for the locale. + + \param string The string buffer to fill with the formatted time. + \param maxSize The size of the buffer. + \param time The time (in seconds since epoch) to format + \param style Specify the long format or the short format. + + \returns The number of bytes written during the time formatting. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + \retval B_BAD_VALUE CheckedArrayByteSink overflowed. + + \sa BLocale::FormatDate(char* string, size_t maxSize, time_t time, + BDateFormatStyle style) const + \sa BLocale::FormatDateTime(char* target, size_t maxSize, + time_t time, BDateFormatStyle dateStyle, + BTimeFormatStyle timeStyle) const +*/ + + +/*! + \fn status_t BLocale::FormatTime(BString* string, time_t time, + BTimeFormatStyle style, const BTimeZone* timeZone) const + \brief Fills in \a string with a formatted time for the given + \a time, \a style, and \a timeZone for the locale. + + \param string The string buffer to fill with the formatted date. + \param time The time (in seconds since epoch) to format + \param style Specify the long format or the short format. + \param timeZone The time zone. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + + \sa BLocale::FormatDate(BString *string, time_t time, + BDateFormatStyle style, const BTimeZone* timeZone) const + \sa BLocale::FormatDateTime(BString* target, time_t time, + BDateFormatStyle dateStyle, BTimeFormatStyle timeStyle, + const BTimeZone* timeZone) const +*/ + + +/*! + \fn status_t BLocale::FormatTime(BString* string, int*& fieldPositions, + int& fieldCount, time_t time, BTimeFormatStyle style) const + \brief Fills in \a string with a formatted time for the given + \a time and \a style for the locale. + + \param string The string buffer to fill with the formatted time. + \param fieldPositions ??? + \param fieldCount ??? + \param time The time (in seconds since epoch) to format. + \param style Specify the long format or the short format. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale or an error formatting the time. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + + \sa BLocale::FormatDate(BString* string, int*& fieldPositions, + int& fieldCount, time_t time, BDateFormatStyle style) const +*/ + + +/*! + \fn status_t BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount, + BTimeFormatStyle style) const + \brief Get the type of each field in the time format of the locale. + + This function is most often used in combination with FormatTime(). + FormatTime() gives you the offset of each field in a formatted string, + and GetTimeFields() gives you the type of the field at a given offset. + With these informations, you can handle the formatted date string as + a list of fields that you can split and alter at will. + + \param fields Pointer to the fields object. + \param fieldCount The number of fields. + \param style Specify the long format or the short format. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale or an error getting the time + fields. + \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + + \sa BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, + BDateFormatStyle style) const +*/ + + +/*! + \fn ssize_t BLocale::FormatNumber(char* string, size_t maxSize, + double value) const + \brief Format the \c double \a value as a string and put the result + into \a string up to \a maxSize bytes in the current locale. + + \param string The string to put the formatted number into. + \param maxSize The maximum of bytes to copy into \a string. + \param value The number that you want to get a formatted version of. + + \returns The length of the string created or an error status code in + the case of an error. + + \sa BLocale::FormatNumber(char* string, size_t maxSize, + int32 value) const + \sa ssize_t BLocale::FormatMonetary(char* string, size_t maxSize, + double value) const +*/ + + +/*! + \fn status_t BLocale::FormatNumber(BString* string, double value) const + \brief \brief Format the \c double \a value as a string and put the result + into \a string in the current locale. + + \param string The string to put the formatted number into. + \param value The number that you want to get a formatted version of. + + \returns The length of the string created or an error status code in + the case of an error. + + \sa BLocale::FormatNumber(BString* string, int32 value) const + \sa BLocale::FormatMonetary(BString* string, double value) const +*/ + + +/*! + \fn ssize_t BLocale::FormatNumber(char* string, size_t maxSize, + int32 value) const + \brief Format the \c int32 \a value as a string and put the result + into \a string up to \a maxSize bytes in the current locale. + + \param string The string to put the formatted number into. + \param maxSize The maximum of bytes to copy into \a string. + \param value The number that you want to get a formatted version of. + + \returns The length of the string created or an error status code in + the case of an error. + + \sa BLocale::FormatNumber(char* string, size_t maxSize, + double value) const + \sa BLocale::FormatMonetary(char* string, size_t maxSize, + double value) const +*/ + + +/*! + \fn status_t BLocale::FormatNumber(BString* string, int32 value) const + \brief \brief Format the \c int32 \a value as a string and put the result + into \a string in the current locale. + + \param string The string to put the formatted number into. + \param value The number that you want to get a formatted version of. + + \returns The length of the string created or an error status code in + the case of an error. + + \sa BLocale::FormatNumber(BString* string, double value) const + \sa BLocale::FormatMonetary(BString* string, double value) const +*/ + + +/*! + \fn ssize_t BLocale::FormatMonetary(char* string, size_t maxSize, + double value) const + \brief Format the \c double \a value as a monetary string and put the + result into \a string up to \a maxSize bytes in the current locale. + + \param string The string to put the monetary formatted number into. + \param maxSize The maximum of bytes to copy into \a string. + \param value The number that you want to get a monetary formatted version + of. + + \returns The length of the string created or an error status code in + the case of an error. + + \sa BLocale::FormatNumber(char* string, size_t maxSize, + double value) const + \sa BLocale::FormatNumber(char* string, size_t maxSize, + int32 value) const +*/ + + +/*! + \fn status_t BLocale::FormatMonetary(BString* string, double value) const + \brief \brief Format the \c double \a value as a monetary string and put + the result into \a string in the current locale. + + \param string The string to put the monetary formatted number into. + \param value The number that you want to get a monetary formatted version + of. + + \returns The length of the string created or an error status code in + the case of an error. + + \sa BLocale::FormatNumber(BString* string, double value) const + \sa BLocale::FormatNumber(BString* string, int32 value) const */ diff --git a/docs/user/locale/LocaleRoster.dox b/docs/user/locale/LocaleRoster.dox index 685487cbaa..f65b404bed 100644 --- a/docs/user/locale/LocaleRoster.dox +++ b/docs/user/locale/LocaleRoster.dox @@ -1,92 +1,214 @@ -/*! -\class BLocaleRoster -\ingroup locale -\brief Main class for accessing the locale kit data +/* + * Copyright 2003-2010, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de + * John Scipione, jscipione@gmail.com + * Oliver Tappe, zooey@hirschkaefer.de + * + * Corresponds to: + * /trunk/headers/os/locale/LocaleRoster.h rev 42274 + * /trunk/src/kits/locale/LocaleRoster.cpp rev 42274 + */ -The Locale Roster is the central part of the locale kit. -It is a global object (be_locale_roster) storing all the useful locale -data. Other classes from the Locale Kit can be constructed on their own, -but only the Locale Roster allows you to do so while taking account of -the user's locale settings. -*/ /*! -\fn status_t BLocaleRoster::GetDefaultCollator(BCollator* collator) const -\brief Get the default collator. + \class BLocaleRoster + \ingroup locale + \brief Main class for accessing the locale kit data + + The Locale Roster is the central part of the locale kit. It is a global + object (\c be_locale_roster) storing all the useful locale data. Other + classes from the Locale Kit can be constructed on their own, but only the + Locale Roster allows you to do so while taking account of the user's locale + settings. */ + /*! -\fn status_t BLocaleRoster::GetDefaultLocale(BLocale* locale) const -\brief Get the default locale. + \fn BLocaleRoster::BLocaleRoster() + \brief Constructor. Does nothing. */ + /*! -\fn status_t BLocaleRoster::GetDefaultCountry(BCountry* country) const -\brief Get the default country. + \fn BLocaleRoster::~BLocaleRoster() + \brief Destructor. Does nothing. */ + /*! -\fn status_t BLocaleRoster::GetDefaultLanguage(BLanguage* language) const -\brief Get the default language. + \fn BLocaleRoster* BLocaleRoster::Default() + \brief Returns default BLocalRoster. */ + /*! -\fn status_t BLocaleRoster::GetDefaultTimeZone(BTimeZone* timezone) const -\brief Get the default timezone. + \fn status_t BLocaleRoster::Refresh() + \brief Refreshes the BLocalRoster. */ + /*! -\fn status_t BLocaleRoster::GetLanguage(const char* languagecode, BLanguage** _language) const -\brief Instanciate a language from its code. + \fn status_t BLocaleRoster::GetDefaultTimeZone(BTimeZone* timezone) const + \brief Get the default timezone. */ + /*! -\fn status_t BLocaleRoster::GetAvailableLanguages(BMessage* message) const -\brief List the available languages - -This function fills the passed BMessage with one or more 'language' string -fields, containing the language(s) ID(s). - + \fn status_t BLocaleRoster::GetLanguage(const char* languagecode, + BLanguage** _language) const + \brief Instantiate a language from its code. */ + /*! -\fn status_t BLocaleRoster::GetAvailableCountries(BMessage* message) const -\brief List the available countries - -This function filles the passed BMessage with one or more 'country' string -fields, containing the (ISO-639) code of each country. + \fn status_t BLocaleRoster::GetPreferredLanguages(BMessage* message) const + \brief Return the list of user preferred languages. + This function fills in the given message with one or more language string + fields. They constitute the ordered list of user-selected languages to use + for string translation. */ + /*! -\fn status_t BLocaleRoster::GetInstalledCatalogs(BMessage* message, const char* sigPattern = NULL, const char* langPattern = NULL, int32 fingerprint = 0) const -\brief Get the available locales and catalogs - -This function fills the passed BMessage with one or more 'locale' string -fields, containing the locale names. - -The optional parameters can be used to filter the list and only get the -locales for which a catalog is available for the given app (sigPattern, fingerprint), -or the locales with a given language. + \fn status_t BLocaleRoster::GetAvailableLanguages(BMessage* message) const + \brief Fills \c message with 'language'-fields containing the language + ID(s) of all available languages. */ + /*! -\fn BCatalog* BLocaleRoster::GetCatalog() -\brief Get the current image catalog. - -This function returns the catalog for the calling image (application, add-on, or shared -library). Note that it doesn't allow to specify a fingerprint. The language will be -selected from the user preferences. - -\returns The catalog, if it was loaded successfully. -\warning This function needs the image to be lined with liblocalestub.a + \fn status_t BLocaleRoster::GetAvailableCountries(BMessage* message) const + \brief Fills in the passed in \a message with one or more 'country' + string fields, containing the (ISO-639) code of each country. */ + /*! -\fn status_t BLocaleRoster::GetPreferredLanguages(BMessage* message) const -\brief Return the list of user preferred languages. + \fn status_t BLocaleRoster::GetAvailableTimeZones(BMessage* timeZones) const + \brief Fills in the passed in \a timeZones message with all time zone + strings for the locale. -This function fills in the given message with one or more language string -fields. They constitute the ordered list of user-selected languages to use for -string translation. + \returns A status code. + \retval B_OK Everything went well. + \retval B_BAD_VALUE A \c NULL \a timeZones message was passed in. + \retval B_ERROR An error occurred trying to retrieve the localized time zone + strings. +*/ + + +/*! + \fn status_t BLocaleRoster::GetAvailableTimeZonesForCountry( + BMessage* timeZones, const char* countryCode) const + \brief Fills in the passed in \a timeZones message with one or more + time zone strings containing the time zones for the + country specified by \a countryCode for the locale. + + \returns A status code. + \retval B_OK Everything went well. + \retval B_BAD_VALUE A \c NULL \a timeZones message was passed in. + \retval B_ERROR An error occurred trying to retrieve the localized time + zones most likely due to an invalid \a countryCode. +*/ + + +/*! + \fn status_t BLocaleRoster::GetFlagIconForCountry(BBitmap* flagIcon, + const char* countryCode) + \brief Sets \a flagIcon to the flag for the passed in \a countryCode. + + \returns A status code. + \retval B_OK Everything went well. + \retval B_BAD_VALUE A \c NULL or invalid \a countryCode was passed in. + \retval B_ERROR Error locking the default RosterData. + \retval B_NAME_NOT_FOUND The flag could not be found for the + \a countryCode. +*/ + + +/*! + \fn status_t BLocaleRoster::GetFlagIconForLanguage(BBitmap* flagIcon, + const char* languageCode) + \brief Sets \a flagIcon to the flag for the passed in \a languageCode. + + If a flag could not be located for the passed in \a languageCode then + GetFlagIconForLanguage() attempts to locate the default country's flag for + the \a languageCode instead. The default country flag for a language is + usually set to the country of the languages origin such as Germany for + German or Spain for Spanish. + + \returns A status code. + \retval B_OK Everything went well. + \retval B_BAD_VALUE A \c NULL or invalid \a languageCode was passed in. + \retval B_ERROR Error locking the default RosterData. + \retval B_NAME_NOT_FOUND The flag could not be found for the + default country's flag for the \a languageCode. +*/ + + +/*! + \fn status_t BLocaleRoster::GetAvailableCatalogs(BMessage* languageList, + const char* sigPattern, const char* langPattern, + int32 fingerprint) const + \brief Get the available locales and catalogs. + + Fills the passed \a languageList message with one or more 'locale' string + fields containing the locale names. + + The optional parameters can be used to filter the list and only get the + locales for which a catalog is available for the given app (sigPattern, + fingerprint), or the locales with a given language. + + \returns A status code. + \retval B_OK Everything went well. + \retval B_BAD_VALUE A \c NULL \a languageList message was passed in. + \retval B_ERROR Error locking the default RosterData. +*/ + + +/*! + \fn bool BLocaleRoster::IsFilesystemTranslationPreferred() const + \brief Returns whether or not filesystem translation is preferred. + + \returns \c B_ERROR if there was an error locking the default RosterData. +*/ + + +/*! + \fn status_t BLocaleRoster::GetLocalizedFileName(BString& localizedFileName, + const entry_ref& ref, bool traverse) + \brief Looks up a localized filename from a catalog. + + Attribute format: "signature:context:string" + (no colon in any of signature, context and string) + + Lookup is done for the top preferred language only. + Lookup fails if a comment is present in the catalog entry. + + \param localizedFileName A pre-allocated BString object for the result + of the lookup. + \param ref An entry_ref with an attribute holding data for catalog lookup. + \param traverse Determines if symlinks should be traversed. + + \returns A status code. + \retval B_OK: success + \retval B_ENTRY_NOT_FOUND: failure. Attribute not found, entry not found + in catalog, etc. +*/ + + +/*! + \fn BCatalog* BLocaleRoster::_GetCatalog() + \brief Get the current image catalog. + + This function returns the catalog for the calling image (application, + add-on, or shared library). Note that it doesn't allow to specify a + fingerprint. The language will be selected from the user preferences. + + \warning This function needs the image to be lined with liblocalestub.a + + \returns The catalog, if it was loaded successfully. */ diff --git a/docs/user/locale/TimeZone.cpp b/docs/user/locale/TimeZone.cpp deleted file mode 100644 index 2836d4fb7f..0000000000 --- a/docs/user/locale/TimeZone.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/*! -\class BTimeZone -\ingroup locale -\brief Class holding information for a time zone. - -*/ - -/*! -\fn BTimeZone::BTimeZone(const char* zoneCode) -\brief Construct a timezone from its code. - -The constructor only allows you to construct a timezone if you already know its -code. If you don't know the code, you can instead go through the BCountry class -which can enumerate all timezones in a country, or use the BLocaleRoster, which -knows the timezone selected by the user. -*/ - -/*! -\fn const BString& BTimeZone::Code() const -\brief Returns the timezone code. - -Note different time zones with different codes may have the same rules. -*/ - -/*! -\fn const BString& BTimeZone::Name() const -\brief Returns the localized name of the time zone - -Use this for displaying information to the user. -*/ - -/*! -\fn const BString& BTimeZone::DaylightSavingName() const -\brief Return the name of the daylight savings rules used in this timezone. -*/ - -/*! -\fn const BString& BTimeZone::ShortName() const -\brief Return the short name of the timezone, in the user's locale. -*/ - -/*! -\fn const BString& BTimeZone::DaylightSavingName() const -\brief Return the short name of the daylight savings rules used in this -timezone. -*/ - -/*! -\fn int BTimeZone::OffsetFromGMT() const -\brief Return the offset from GMT. - -The offset is a number of seconds, positive or negative. -*/ - -/*! -\fn bool BTimeZone::SupportsDaylightSaving() const -\brief Return true if the time zone has daylight saving rules -*/ - -/*! -\fn status_t BTimeZone::InitCheck() const -\brief Return false if there was an error creating the timezone (you called the -constructor or SetTo with an invalid code). -*/ - -/*! -\fn status_t BTimeZone::SetTo(const char* zoneCode) -\brief Set the timezone to another code. - -\returns false if there was an error (likely you given an invalid code) -*/ - diff --git a/docs/user/locale/TimeZone.dox b/docs/user/locale/TimeZone.dox new file mode 100644 index 0000000000..d100ef759e --- /dev/null +++ b/docs/user/locale/TimeZone.dox @@ -0,0 +1,110 @@ +/* + * Copyright 2011, Haiku inc. + * Distributed under the terms of the MIT Licence. + * + * Documentation by: + * Adrien Destugues + * John Scipione + * Oliver Tappe + * Corresponds to: + * /trunk/headers/os/locale/TimeZone.h rev 42274 + * /trunk/src/kits/locale/TimeZone.cpp rev 42274 + */ + + +/*! + \file TimeZone.h + \brief Provides for the BTimeZone class. +*/ + + +/*! + \class BTimeZone + \ingroup locale + \brief Provides information about time zones. +*/ + + +/*! + \fn BTimeZone::BTimeZone(const char* zoneID, const BLanguage* language) + \brief Construct a timezone from its \a zoneID and \a language. + + The constructor only allows you to construct a timezone if you already + know its code. If you don't know the code, you can instead go through the + BCountry class which can enumerate all timezones in a country, or use the + BLocaleRoster, which knows the timezone selected by the user. +*/ + + +/*! + \fn BTimeZone::BTimeZone(const BTimeZone& other) +*/ + + +/*! + \fn BTimeZone& BTimeZone::operator=(const BTimeZone& source) +*/ + + +/*! + \fn const BString& BTimeZone::ID() const + \brief Returns the ID of the time zone. +*/ + + +/*! + \fn const BString& BTimeZone::Name() const + \brief Returns the localized name of the time zone. + + Use this method to display the time zone's name to the user. +*/ + + +/*! + \fn const BString& BTimeZone::DaylightSavingName() const + \brief Returns the name of the daylight savings rules used in this timezone. +*/ + + +/*! + \fn const BString& BTimeZone::ShortName() const + \brief Returns the short name of the timezone, in the user's locale. +*/ + + +/*! + \fn const BString& BTimeZone::ShortDaylightSavingName() const + \brief Returns the short name of the daylight savings rules used in this + timezone. +*/ + + +/*! + \fn int BTimeZone::OffsetFromGMT() const + \brief Return the offset from GMT. + + The offset is a number of seconds, positive or negative. +*/ + + +/*! + \fn bool BTimeZone::SupportsDaylightSaving() const + \brief Return true if the time zone has daylight saving rules +*/ + + +/*! + \fn status_t BTimeZone::InitCheck() const + \brief Return \c false if there was an error creating the timezone + for instance if you called the constructor or SetTo() with an invalid + timezone code.) +*/ + + +/*! + \fn status_t BTimeZone::SetTo(const char* zoneCode) + \brief Set the timezone to another code. + + \returns \c false if there was an error (likely due to an invalid + timezone code.) +*/ diff --git a/docs/user/locale/UnicodeChar.dox b/docs/user/locale/UnicodeChar.dox index d7810a4e63..91709dc4ad 100644 --- a/docs/user/locale/UnicodeChar.dox +++ b/docs/user/locale/UnicodeChar.dox @@ -1,167 +1,245 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the OpenBeOS License. + * + * Authors: + * Axel Drfler + * John Scipione + * + * Corresponds to: + * /trunk/headers/os/locale/UnicodeChar.h rev 42274 + * /trunk/src/kits/locale/UnicodeChar.cpp rev 42274 + */ + /*! -\class BUnicodeChar -\ingroup locale + \class BUnicodeChar + \ingroup locale -\brief Management of all information about characters. + \brief Management of all information about characters. -This class provide a set of tools for managing the whole set of characters -defined in unicode. This include informations such as knowing if the character is -whitespace, if it is alphanumeric, or solething else ; what is the uppercase -equivalent of a character ; or wether it can be ornamented with accents. + This class provide a set of tools for managing the whole set of characters + defined by unicode. This include information about special sets of + characters such as if the character is whitespace, or alphanumeric. It also + provides the uppercase equivalent of a character and determines whether a + character can be ornamented with accents. -This class consists entirely of static methods, which means you don't have to -instanciate it. Just call one of the methods with the char you want examinated. - -Note all the function work with chars encoded in utf-32. This is not the most usual -way to handle characters, but it is the faster. To convert an utf-8 string to an -utf-32 character, pass it to the FromUTF8 function. + This class consists entirely of static methods, so you do not have to + instantiate it. You can call one of the methods passing in the character + that you want to be examined. + Note all the function work with chars encoded in utf-32. This is not the + most usual way to handle characters, but it is the fastest. To convert an + utf-8 string to an utf-32 character use the FromUTF8() method. */ /*! -\fn static bool BUnicodeChar::IsAlpha(uint32 c) -\brief Tell if the character is alphabetic. + \fn static bool BUnicodeChar::IsAlpha(uint32 c) + \brief Determine if \a c is alphabetic. + + \returns \c true if the specified unicode character is an + alphabetic character. */ /*! -\fn static bool BUnicodeChar::IsAlNum(uint32 c) -\brief Tell if the character is alphanumeric. + \fn static bool BUnicodeChar::IsAlNum(uint32 c) + \brief Determine if \a c is alphanumeric. + + \returns \c true if the specified unicode character is a + alphabetic or numeric character. */ /*! -\fn static bool BUnicodeChar::IsDigit(uint32 c) -\brief Tell if the caracter is numeric. + \fn static bool BUnicodeChar::IsDigit(uint32 c) + \brief Determine if \a c is numeric. + + \returns \c true if the specified unicode character is a + number character. */ /*! -\fn static bool BUnicodeChar::IsHexDigit(uint32 c) -\brief Tell if the character is numeric in base 16. + \fn static bool BUnicodeChar::IsHexDigit(uint32 c) + \brief Determine if \a c is a hexadecimal digit. + + \returns \c true if the specified unicode character is a + hexadecimal number character. */ /*! -\fn static bool BUnicodeChar::IsUpper(uint32 c) -\brief Tell if the character is uppercase. + \fn static bool BUnicodeChar::IsUpper(uint32 c) + \brief Determine if \a c is uppercase. + + \returns \c true if the specified unicode character is an + uppercase character. */ /*! -\fn static bool BUnicodeChar::IsLower(uint32 c) -\brief Tell if the character is lowercase. + \fn static bool BUnicodeChar::IsLower(uint32 c) + \brief Determine if \a c is lowercase. + + \returns \c true if the specified unicode character is a + lowercase character. */ /*! -\fn static bool BUnicodeChar::IsSpace(uint32 c) -\brief Tell if the character is space. + \fn static bool BUnicodeChar::IsSpace(uint32 c) + \brief Determine if \a c is a space. -Unlike IsWhitespace, this function will return true for non-breakable -spaces. It is the one to use for determining if the character will render -as an empty space on screen and can be stretched to make the text look -nicer. + Unlike IsWhitespace() this function will return \c true for non-breakable + spaces. This method is useful for determining if the character will render + as an empty space which can be stretched on-screen. + + \returns \c true if the specified unicode character is some + kind of a space character. + + \sa IsWhitespace() */ /*! -\fn static bool BUnicodeChar::IsWhitespace(uint32 c) -\brief Tell if the character is whitespace. + \fn static bool BUnicodeChar::IsWhitespace(uint32 c) + \brief Determine if \a c is whitespace. -Unlike IsSpace, this method will return false for non-breakable spaces. -It is the one to use for selecting where to insert line breaks. + This method is essentially the same as IsSpace(), but excludes all + non-breakable spaces. + + \returns \c true if the specified unicode character is a whitespace + character. + + \sa IsSpace() */ /*! -\fn static bool BUnicodeChar::IsControl(uint32 c) -\brief Tell if the character is a control character. + \fn static bool BUnicodeChar::IsControl(uint32 c) + \brief Determine if \a c is a control character. -Example control characters are the non-printable ASCII characters 0 to 0x1F. + Example control characters are the non-printable ASCII characters from + 0x0 to 0x1F. + + \returns \c true if the specified unicode character is a control + character. + + \sa IsPrintable() */ /*! -\fn static bool BUnicodeChar::IsPunctuation(uint32 c) -\brief Tell if the character is a punctuation. + \fn static bool BUnicodeChar::IsPunctuation(uint32 c) + \brief Determine if \a c is punctuation character. + + \returns \c true if the specified unicode character is a + punctuation character. */ /*! -\fn static bool BUnicodeChar::IsPrintable(uint32 c) -\brief Tell if the character is printable. + \fn static bool BUnicodeChar::IsPrintable(uint32 c) + \brief Determine if \a c is printable. + + Printable characters are not control characters. + + \returns \c true if the specified unicode character is a printable + character. + + \sa IsControl() */ /*! -\fn static bool BUnicodeChar::IsTitle(uint32 c) -\brief Tell if the character is title case. + \fn static bool BUnicodeChar::IsTitle(uint32 c) + \brief Determine if \a c is title case. -Title case is usually a smaller version of upercase letters. + Title case characters are a smaller version of normal uppercase letters. + + \returns \c true if the specified unicode character is a title case + character. */ /*! -\fn static bool BUnicodeChar::IsDefined(uint32 c) -\brief Tell if the character is defined at all. + \fn static bool BUnicodeChar::IsDefined(uint32 c) + \brief Determine if \a c is defined. -In unicode, some codes are not valid, or not attributed yet. -For these, this method wil lreturn false. + In unicode some codes are not valid or not attributed yet. + For these codes this method will return \c false. + + \returns \c true if the specified unicode character is defined. */ /*! -\fn static bool BUnicodeChar::IsBase(uint32 c) -\brief Tell if the character can be used with a diacritic. + \fn static bool BUnicodeChar::IsBase(uint32 c) + \brief Determine if \a c can be used with a diacritic. + + \note IsBase() does not determine if a unicode character is distinct. + + \returns \c true if the specified unicode character is a base + form character that can be used with a diacritic. */ /*! -\fn static int8 BUnicodeChar::Type(uint32 c) -\brief Returns the type of the character. + \fn static int8 BUnicodeChar::Type(uint32 c) + \brief Gets the type of a character. -Return value is a member of the unicode_char_category enum. + \returns A member of the \c unicode_char_category enum. */ /*! -\fn static uint32 ToLower(uint32 c); -\brief Returns the lowercase version of a character. + \fn uint32 BUnicodeChar::ToLower(uint32 c) + \brief Transforms \a c to lowercase. + + \returns The lowercase version of the specified unicode character. */ /*! -\fn static uint32 ToUpper(uint32 c); -\brief Returns the uppercase version of a character. + \fn uint32 BUnicodeChar::ToUpper(uint32 c) + \brief Transforms \a c to uppercase. + + \returns The uppercase version of the specified unicode character. */ /*! -\fn static uint32 ToTitle(uint32 c); -\brief Returns the titlecase version of a character. + \fn uint32 BUnicodeChar::ToTitle(uint32 c) + \brief Transforms \a c to title case. + + \returns The title case version of the specified unicode character. */ /*! -\fn static int32 DigitValue(uint32 c); -\brief Returns the numeric value of the character. + \fn int32 BUnicodeChar::DigitValue(uint32 c) + \brief Gets the numeric value \a c. + + \returns The numeric version of the specified unicode character. */ /*! -\fn static void ToUTF8(uint32c, char ù**ou -\brief Convert a character to utf8 encoding. + \fn void BUnicodeChar::ToUTF8(uint32 c, char **out) + \brief Transform a character to utf-8 encoding. + + \returns The utf-8 encoding of the specified unicode character. */ /*! -\fn static uint32 FromUTF8(const char** in) -\brief Convert an utf-8 string to an utf-32 character. + \fn uint32 BUnicodeChar::FromUTF8(const char **in) + \brief Transform a utf-8 string to an utf-32 character. -If the string contains multiple characters, only the fist one is used. -This function updates the in pointer so that it points on the next -character for the following call. + If the string contains multiple characters, only the fist one is used. + This function updates the in pointer so that it points on the next + character for the following call. + + \returns The utf-32 encoded version of \a in. */ /*! -\fn static uint32 FromUTF8(const char* in) -\brief Convert an utf-8 string to an utf-32 character. + \fn size_t BUnicodeChar::UTF8StringLength(const char *str) + \brief Counts the characters in the given \c NUL terminated string. -If the string contains multiple characters, only the first one is used. -The in pointer is not modified. + \returns the number of utf-8 characters in the \c NUL terminated string. + + \sa BString::CountChars() */ /*! -\fn static size_t UTF8StringLength(const char* str) -\brief This function counts the characters in the given null-terminated string. + \fn size_t BUnicodeChar::UTF8StringLength(const char *str, size_t maxLength) + \brief Counts the characters in the given string up to \a maxLength + characters. -\sa BString::CountChars() -*/ - -/*! -\fn static size_t UTF8StringLength(const char* str, size_t maxLength) -\brief This function counts the characters in the given string. - -The string does not need to be null-terminated if you specify the length. + The string does not need to be \c NUL terminated if you specify a + \a maxLength that is shorter than the maximum length of the string. + + \returns the number of utf-8 characters in the \c NUL terminated string + up to \a maxLength characters. */ diff --git a/docs/user/media/Buffer.dox b/docs/user/media/Buffer.dox new file mode 100644 index 0000000000..71345f9d82 --- /dev/null +++ b/docs/user/media/Buffer.dox @@ -0,0 +1,113 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * /trunk/headers/os/media/Buffer.h rev 42274 + * /trunk/src/kits/media/Buffer.cpp rev 42274 + */ + + +/*! + \file Buffer.h + \brief Defines the buffer_clone_info struct and BBuffer class. +*/ + + +/*! + \struct buffer_clone_info + \brief A struct that stores where in memory a BBuffer object is in memory + as well as the buffer flags. +*/ + + +/*! + \class BBuffer + \ingroup media + \brief A reference to a chunk of memory useful for sharing media data + between applications and nodes. +*/ + + +/*! + \fn void* BBuffer::Data() + \brief Returns a pointer to the data of the buffer. +*/ + + +/*! + \fn size_t BBuffer::SizeAvailable() + \brief Returns the size of the buffer in bytes. Alias for Size(). +*/ + + +/*! + \fn size_t BBuffer::SizeUsed() + \brief Returns the size of the portion of the buffer that is currently in + use in bytes. +*/ + + +/*! + \fn void BBuffer::SetSizeUsed(size_t size_used) + \brief Sets the size of the buffer that is used in bytes. + + This method should be called after writing data to the buffer. +*/ + + +/*! + \fn uint32 BBuffer::Flags() + \brief Returns the flags of the buffer. +*/ + + +/*! + \fn void BBuffer::Recycle() + \brief Recycles the buffer so that it can be reused. +*/ + + +/*! + \fn buffer_clone_info BBuffer::CloneInfo() const + \brief Returns the buffer_clone_info struct that describes the buffer. +*/ + + +/*! + \fn media_buffer_id BBuffer::ID() + \brief Returns the app_server ID of the buffer. +*/ + + +/*! + \fn media_type BBuffer::Type() + \brief Returns the media type of the data in the buffer. +*/ + + +/*! + \fn media_header* BBuffer::Header() + \brief Returns a pointer to the header of the buffer. +*/ + + +/*! + \fn media_audio_header* BBuffer::AudioHeader() + \brief Returns a pointer to a header of the audio buffer. +*/ + + +/*! + \fn media_video_header* BBuffer::VideoHeader() + \brief Returns a pointer to a header of the video buffer. +*/ + + +/*! + \fn size_t BBuffer::Size() + \brief Returns the size of the buffer in bytes. Alias for SizeAvailable(). +*/ diff --git a/docs/user/storage/AppFileInfo.dox b/docs/user/storage/AppFileInfo.dox new file mode 100644 index 0000000000..d6c5d5374d --- /dev/null +++ b/docs/user/storage/AppFileInfo.dox @@ -0,0 +1,769 @@ +/* + * Copyright 2011, Haiku inc. + * Distributed under the terms of the MIT Licence. + * + * Documentation by: + * John Scipione + * Ingo Weinhold + * Corresponds to: + * /trunk/headers/os/storage/AppFileInfo.h rev 42274 + * /trunk/src/kits/storage/AppFileInfo.cpp rev 42274 + */ + + +/*! + \file AppFileInfo.h + \brief Provides the BAppFileInfo class. +*/ + + +/*! + \class BAppFileInfo + \ingroup storage + \brief Provides access to the metadata associated with executables, + libraries and add-ons. + + The BAppFileInfo class allows for information about an executable or + add-on to be accessed or set. Information about an executable that can be + accessed include the signature, catalog entry, supported MIME types, + application flags, icon(s), and version info. + + You should initialize the BAppFileInfo with a BFile object that represents + the executable or add-on that you want to access. If you only want to read + metadata from the file you do not have to open it for reading. However, if + you also want to write metadata then you should open the BFile for writing. + + To associate a BFile with a BAppFileInfo object you can either pass the + BFile object into the constructor or you can use the empty constructor and + then use the SetTo() method to set the BFile to the BAppFileInfo object. + + When accessing information from a BFileInfo object it will first look in the + attributes of the BFile. If the information is not found then the BFileInfo + object will next look at the resource of the BFile. You can tell the + BFileInfo object to look only in the attributes or resources with the + SetInfoLocation() method. +*/ + + +/*! + \fn BAppFileInfo::BAppFileInfo() + \brief Creates an uninitialized BAppFileInfo object. +*/ + + +/*! + \fn BAppFileInfo::BAppFileInfo(BFile* file) + \brief Creates an BAppFileInfo object and initializes it to the supplied + file. + + The caller retains ownership of the supplied BFile object. It must not + be deleted during the life time of the BAppFileInfo. It is not deleted + when the BAppFileInfo is destroyed. + + \param file The BFile object that the BAppFileInfo object shall be + initialized to. +*/ + + +/*! + \fn BAppFileInfo::~BAppFileInfo() + \brief Frees all resources associated with this object. + + The supplied BFile object is not deleted if one is specified. +*/ + + +/*! + \fn status_t BAppFileInfo::SetTo(BFile *file) + \brief Initializes the BAppFileInfo to the supplied file. + + The caller retains ownership of the supplied BFile object. It must not + be deleted during the life time of the BAppFileInfo. The BFile object + is not deleted when the BAppFileInfo is destroyed. + + \param file The BFile object that the BAppFileInfo object shall be + initialized to. + + \returns an status code. + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \c NULL \a file or \a file is not properly initialized. +*/ + + +/*! + \name MIME Type +*/ + + +//! @{ + + +/*! + \fn status_t BAppFileInfo::GetType(char *type) const + \brief Gets the MIME type of the associated file. + + \param type A pointer to a pre-allocated character buffer of size + \c B_MIME_TYPE_LENGTH or larger into which the MIME type of the + file will be written. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a type or the type string stored in the + attribute/resources is longer than \c B_MIME_TYPE_LENGTH. + \retval B_BAD_TYPE The attribute/resources the type string is stored in + has the wrong type. + \retval B_ENTRY_NOT_FOUND No type is set on the file. +*/ + + +/*! + \fn status_t BAppFileInfo::SetType(const char* type) + \brief Sets the MIME type of the associated file. + + If \a type is \c NULL if the file's MIME type is unset. + + \param type The MIME type to be assigned to the file. It must not be + longer than \c B_MIME_TYPE_LENGTH (including the terminating null). + The MIME type may be \c NULL. + + \returns a status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \a type is longer than \c B_MIME_TYPE_LENGTH. +*/ + + +//! @} + + +/*! + \name Signature +*/ + + +//! @{ + + +/*! + \fn status_t BAppFileInfo::GetSignature(char* signature) const + \brief Gets the application signature of the associated file. + + \param signature A pointer to a pre-allocated character buffer of size + \c B_MIME_TYPE_LENGTH or larger into which the application + signature of the file will be written. + + \returns a status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a signature or the signature stored in the + attribute/resources is longer than \c B_MIME_TYPE_LENGTH. + \retval B_BAD_TYPE The attribute/resources the signature is stored in have + the wrong type. + \retval B_ENTRY_NOT_FOUND No signature is set on the file. +*/ + + +/*! + \fn status_t BAppFileInfo::SetSignature(const char* signature) + \brief Sets the application signature of the associated file. + + If \a signature is \c NULL the file's application signature is unset. + + \param signature The application signature to be assigned to the file. + Must not be longer than \c B_MIME_TYPE_LENGTH (including the + terminating \c NUL). The \a signature may be \c NULL. + + \returns a status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \a signature is longer than \c B_MIME_TYPE_LENGTH. +*/ + + +//! @} + + +/*! + \name Catalog Entry +*/ + + +//! @{ + + +/*! + \fn status_t BAppFileInfo::GetCatalogEntry(char *catalogEntry) const + \brief Gets the catalog entry of the associated file used for localization. + + \param catalogEntry A pointer to a pre-allocated character buffer of size + \c B_MIME_TYPE_LENGTH * 3 or larger into which the catalog entry + of the file will be written. + + \returns a status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a catalogEntry or the entry stored in the + attribute/resources is longer than \c B_MIME_TYPE_LENGTH * 3. + \retval B_BAD_TYPE The attribute/resources the entry is stored in have + the wrong type. + \retval B_ENTRY_NOT_FOUND No catalog entry is set on the file. +*/ + + +/*! + \fn status_t BAppFileInfo::SetCatalogEntry(const char* catalogEntry) + \brief Sets the catalog entry of the associated file used for localization. + + If \a catalogEntry is \c NULL the file's catalog entry is unset. + + \param catalogEntry The catalog entry to be assigned to the file. + Of the form "x-vnd.Haiku-app:context:name". Must not be longer than + \c B_MIME_TYPE_LENGTH * 3 (including the terminating \c NUL). + The \a catalogEntry may be \c NULL. + + \returns a status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \a catalogEntry is longer than + \c B_MIME_TYPE_LENGTH * 3. +*/ + + +//! @} + + +/*! + \name Application Flags +*/ + + +//! @{ + + +/*! + \fn status_t BAppFileInfo::GetAppFlags(uint32* flags) const + \brief Gets the application \a flags of the associated file. + + \param flags A pointer to a pre-allocated \c uint32 into which the + application flags of the file are written. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a flags. + \retval B_BAD_TYPE The attribute/resources the flags are stored in have + the wrong type. + \retval B_ENTRY_NOT_FOUND No application flags are set on the file. +*/ + + +/*! + \fn status_t BAppFileInfo::SetAppFlags(uint32 flags) + \brief Sets the application \a flags of the associated file. + + \param flags The application \a flags to be assigned to the file. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object was not properly initialized. +*/ + + +/*! + \fn status_t BAppFileInfo::RemoveAppFlags() + \brief Removes the application flags from the associated file. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object was not properly initialized. +*/ + + +//! @} + + +/*! + \name Supported MIME Types +*/ + + +//! @{ + + +/*! + \fn status_t BAppFileInfo::GetSupportedTypes(BMessage* types) const + \brief Gets the MIME types supported by the application. + + The supported MIME types are added to a field "types" of type + \c B_STRING_TYPE in \a types. + + \param types A pointer to a pre-allocated BMessage into which the + MIME types supported by the application will be written. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a types. + \retval B_BAD_TYPE The attribute/resources that the supported types + are stored in have the wrong type. + \retval B_ENTRY_NOT_FOUND No supported types are set on the file. +*/ + + +/*! + \fn status_t BAppFileInfo::SetSupportedTypes(const BMessage* types, + bool syncAll) + \brief Sets the MIME types that are supported by the application and allows + you to specify whether or not the no longer supported types shall be + updated as well. + + If \a types is \c NULL then the application's supported types are unset. + + The supported MIME types must be stored in a field "types" of type + \c B_STRING_TYPE in \a types. + + The method informs the registrar about this news. + For each supported type the result of BMimeType::GetSupportingApps() + will afterwards include the signature of this application. That is, + the application file needs to have a signature set. + + \a syncAll specifies whether the no longer supported types shall be + updated as well, i.e. whether or not this application shall be removed + from the list of supporting applications. + + \param types The supported types to be assigned to the file. + May be \c NULL. + \param syncAll \c true to also synchronize the no-longer supported + types, \c false otherwise. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. +*/ + + +/*! + \fn status_t BAppFileInfo::SetSupportedTypes(const BMessage* types) + \brief Sets the MIME types supported by the application. + + This method is a short-hand for SetSupportedTypes(types, false). + \see SetSupportedType(const BMessage*, bool) for detailed information. + + \param types The supported types to be assigned to the file. + May be \c NULL. + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. +*/ + + +/*! + \fn bool BAppFileInfo::IsSupportedType(const char* type) const + \brief Returns whether the application supports the supplied MIME type. + + If the application supports the wildcard type "application/octet-stream" + then this method returns \c true for any MIME type. + + \param type The MIME type in question. + + \returns \c true if \a type is a valid MIME type and it is supported by + the application, \c false otherwise. +*/ + + +/*! + \fn bool BAppFileInfo::Supports(BMimeType* type) const + \brief Returns whether the application supports the supplied MIME type + explicitly. + + Unlike IsSupportedType(), this method returns \c true, only if the type + is explicitly supported, regardless of whether it supports + "application/octet-stream". + + \param type The MIME type in question. + + \returns \c true if \a type is a valid MIME type and it is explicitly + supported by the application, \c false otherwise. +*/ + + +//! @} + + +/*! + \name Application Icon +*/ + + +//! @{ + + +/*! + \fn status_t BAppFileInfo::GetIcon(BBitmap* icon, icon_size which) const + \brief Gets the icon of the associated file and puts it into a pre-allocated + BBitmap. + + \param icon A pointer to a pre-allocated BBitmap of the correct dimension + to store the requested icon (16x16 for the \c B_MINI_ICON and 32x32 + for the \c B_LARGE_ICON). + \param which Specifies the size of the icon to be retrieved: + \c B_MINI_ICON for the mini and \c B_LARGE_ICON for the large icon. + For HVIF icons this parameter has no effect. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a icon, unsupported icon size \a which or + bitmap dimensions (\a icon) and icon size (\a which) do not match. +*/ + + +/*! + \fn status_t BAppFileInfo::GetIcon(uint8** data, size_t* size) const + \brief Gets the icon of the associated file and puts it into a buffer. + + \param data The pointer in which the flat icon data will be returned. + \param size The pointer in which the size of the data found will be + returned. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a data or \c NULL size. +*/ + + +/*! + \fn status_t BAppFileInfo::SetIcon(const BBitmap* icon, icon_size which) + \brief Sets the icon of the associated file from a BBitmap. + + If \a icon is \c NULL then the icon of the file is unset. + + \param icon A pointer to the BBitmap containing the icon to be set. + May be \c NULL to specify no icon. + \param which Specifies the size of the icon to be set: \c B_MINI_ICON for + 16x16 mini icon and \c B_LARGE_ICON for the 32x32 large icon. + For HVIF icons this parameter has no effect. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE Unknown icon size \a which or bitmap dimensions + (\a icon) and icon size (\a which) do not match. +*/ + + +/*! + \fn status_t BAppFileInfo::SetIcon(const uint8* data, size_t size) + \brief Sets the icon of the associated file from a buffer. + + If \a data is \c NULL then the icon of the file is unset. + + \param data A pointer to the data buffer containing the vector icon + to be set. May be \c NULL. + \param size Specifies the size of buffer pointed to by \a data. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL data. +*/ + + +/*! + \fn status_t BAppFileInfo::GetIconForType(const char* type, BBitmap* icon, + icon_size size) const + \brief Gets the icon the application provides for a given MIME type and + puts it into a BBitmap. + + \note If \a type is \c NULL, the application's icon is retrieved. + + \param type The MIME type in question. May be \c NULL. + \param icon A pointer to a pre-allocated BBitmap of the correct dimension + to store the requested icon (16x16 for the mini and 32x32 for the + large icon). + \param size Specifies the size of the icon to be retrieved: + \c B_MINI_ICON for the mini and \c B_LARGE_ICON for the large icon. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a icon, unsupported icon size + \a which or bitmap dimensions (\a icon) and icon size (\a which) do + not match. +*/ + + +/*! + \fn status_t BAppFileInfo::GetIconForType(const char* type, uint8** data, + size_t* size) const + \brief Gets the icon the application provides for a given MIME type and + puts it into a buffer. + + \note If \a type is set to \c NULL the the application's icon is retrieved. + + \param type The MIME type in question. May be \c NULL. + \param data A pointer in which the icon data will be returned. When you + are done with the data, you should use free() to deallocate it. + \param size A pointer in which the size of the retrieved data is returned. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a data and/or \a size. Or the supplied + \a type is not a valid MIME type. +*/ + + +/*! + \fn status_t BAppFileInfo::SetIconForType(const char* type, + const BBitmap* icon, icon_size which) + \brief Sets the icon the application provides for a given MIME type from a + BBitmap. + + \note If \a type is \c NULL then the icon is set. + \note If \a icon is \c NULL then the icon is unset. + + If the file has a signature, then the icon is also set on the MIME type. + If the type for the signature has not been installed yet, it is installed + before. + + \param type The MIME type in question. May be \c NULL. + \param icon A pointer to the BBitmap containing the icon to be set. + May be \c NULL. + \param which Specifies the size of the icon to be set: \c B_MINI_ICON + for the mini and \c B_LARGE_ICON for the large icon. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE Either the icon size \a which is unknown, + the bitmap dimensions (\a icon) and icon size (\a which) do not + match, or the provided \a type is not a valid MIME type. +*/ + + +/*! + \fn status_t BAppFileInfo::SetIconForType(const char* type, + const uint8* data, size_t size) + \brief Sets the icon the application provides for a given MIME type from a + buffer. + + \note If \a type is \c NULL then the icon is set. + \note If \a data is \c NULL then the icon is unset. + + If the file has a signature, then the icon is also set on the MIME type. + If the type for the signature has not been installed yet, it is + installed before. + + \param type The MIME type in question. May be \c NULL. + \param data A pointer to the data containing the icon to be set. + May be \c NULL. + \param size Specifies the size of buffer provided in \a data. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE The provided \a type is not a valid MIME type. +*/ + + +//! @} + + +/*! + \name Version Info +*/ + + +//! @{ + + +/*! + \fn status_t BAppFileInfo::GetVersionInfo(version_info* info, + version_kind kind) const + \brief Gets the version info of the associated file. + + \param info A pointer to a pre-allocated version_info structure into + which the version info should be written. + \param kind Specifies the kind of the version info to be retrieved: + - \c B_APP_VERSION_KIND for the application's version info and + - \c B_SYSTEM_VERSION_KIND for the suite's info the application + belongs to. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. + \retval B_BAD_VALUE \c NULL \a info. +*/ + + +/*! + \fn status_t BAppFileInfo::SetVersionInfo(const version_info* info, + version_kind kind) + \brief Sets the version info of the associated file. + + \note If \a info is set to \c NULL then the file's version info is unset. + + \param info The version info to be set. May be \c NULL. + \param kind Specifies kind of version info to be set: + - \c B_APP_VERSION_KIND for the application's version info and + - \c B_SYSTEM_VERSION_KIND for the suite's info the application + belongs to. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT The object is not properly initialized. +*/ + + +//! @} + + +/*! + \name Attributes/Resources +*/ + + +//! @{ + + +/*! + \fn void BAppFileInfo::SetInfoLocation(info_location location) + \brief Specifies the location where the metadata shall be stored. + + The options for \a location are: + - \c B_USE_ATTRIBUTES: Store the data in the attributes. + - \c B_USE_RESOURCES: Store the data in the resources. + - \c B_USE_BOTH_LOCATIONS: Store the data in attributes and resources. + + \param location The location where the metadata shall be stored. +*/ + + +/*! + \fn bool BAppFileInfo::IsUsingAttributes() const + \brief Returns whether the object (also) stores the metadata in the + attributes of the associated file. + + \returns \c true if the metadata are (also) stored in the file's + attributes, \c false otherwise. +*/ + + +/*! + \fn bool BAppFileInfo::IsUsingResources() const + \brief Returns whether the object (also) stores the metadata in the + resources of the associated file. + + \returns \c true if the metadata are (also) stored in the file's + resources, \c false otherwise. +*/ + + +//! @} + + +/*! + \fn BAppFileInfo & BAppFileInfo::operator=(const BAppFileInfo &) + \brief Privatized assignment operator to prevent usage. +*/ + + +/*! + \fn BAppFileInfo::BAppFileInfo(const BAppFileInfo &) + \brief Privatized copy constructor to prevent usage. +*/ + + +/*! + \fn status_t BAppFileInfo::GetMetaMime(BMimeType* meta) const + \brief Initializes a BMimeType to the signature of the associated file. + + \warning The parameter \a meta is not checked. + + \param meta A pointer to a pre-allocated BMimeType that shall be + initialized to the signature of the associated file. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \c NULL \a meta + \retval B_ENTRY_NOT_FOUND The file has not signature or the signature is + (not installed in the MIME database.) no valid MIME string. +*/ + + +/*! + \fn status_t BAppFileInfo::_ReadData(const char* name, int32 id, + type_code type, void* buffer, size_t bufferSize, + size_t &bytesRead, void** allocatedBuffer) const + \brief Reads data from an attribute or resource. + + \note The data is read from the location specified by \a fWhere. + + \warning The object must be properly initialized. The parameters are + \b NOT checked. + + \param name The name of the attribute/resource to be read. + \param id The resource ID of the resource to be read. It is ignored + when < 0. + \param type The type of the attribute/resource to be read. + \param buffer A pre-allocated buffer for the data to be read. + \param bufferSize The size of the supplied buffer. + \param bytesRead A reference parameter, set to the number of bytes + actually read. + \param allocatedBuffer If not \c NULL, the method allocates a buffer + large enough too store the whole data and writes a pointer to it + into this variable. If \c NULL, the supplied buffer is used. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ENTRY_NOT_FOUND The entry was not found. + \retval B_NO_MEMORY Ran out of memory allocating the buffer. + \retval B_BAD_VALUE \a type did not match. +*/ + + +/*! + \fn status_t BAppFileInfo::_WriteData(const char* name, int32 id, + type_code type, const void* buffer, size_t bufferSize, bool findID) + \brief Writes data to an attribute or resource. + + \note The data is written to the location(s) specified by \a fWhere. + + \warning The object must be properly initialized. The parameters are + \b NOT checked. + + \param name The name of the attribute/resource to be written. + \param id The resource ID of the resource to be written. + \param type The type of the attribute/resource to be written. + \param buffer A buffer containing the data to be written. + \param bufferSize The size of the supplied buffer. + \param findID If set to \c true use the ID that is already assigned to the + \a name / \a type pair or take the first unused ID >= \a id. + If \c false, \a id is used. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR An error occurred while trying to write the data. +*/ + + +/*! + \fn status_t BAppFileInfo::_RemoveData(const char* name, type_code type) + \brief Removes an attribute or resource. + + \note The removal location is specified by \a fWhere. + + \warning The object must be properly initialized. The parameters are + \b NOT checked. + + \param name The name of the attribute/resource to be remove. + \param type The type of the attribute/resource to be removed. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_NO_INIT Not using attributes and not using resources. + \retval B_ENTRY_NOT_FOUND The attribute or resource was not found. +*/ diff --git a/docs/user/support/Archivable.dox b/docs/user/support/Archivable.dox index f2b01a76d0..b47ce04c8d 100644 --- a/docs/user/support/Archivable.dox +++ b/docs/user/support/Archivable.dox @@ -16,15 +16,13 @@ */ -/*! - \file Archivable.h +/*! \file Archivable.h \brief Provides the BArchivable interface and declares the BArchiver and BUnarchiver classes. */ -/*! - \class BArchivable +/*! \class BArchivable \ingroup support \ingroup libbe \brief Interface for objects that can be archived into a BMessage. @@ -65,8 +63,7 @@ */ -/*! - \fn BArchivable::BArchivable(BMessage* from) +/*! \fn BArchivable::BArchivable(BMessage* from) \brief Constructor. Does important behind-the-scenes work in the unarchiving process. @@ -77,20 +74,17 @@ */ -/*! - \fn BArchivable::BArchivable() +/*! \fn BArchivable::BArchivable() \brief Constructor. Does nothing. */ -/*! - \fn BArchivable::~BArchivable() +/*! \fn BArchivable::~BArchivable() \brief Destructor. Does nothing. */ -/*! - \fn virtual status_t BArchivable::Archive(BMessage* into, +/*! \fn virtual status_t BArchivable::Archive(BMessage* into, bool deep = true) const \brief Archive the object into a BMessage. @@ -105,8 +99,7 @@ */ -/*! - \fn static BArchivable* BArchivable::Instantiate(BMessage* archive) +/*! \fn static BArchivable* BArchivable::Instantiate(BMessage* archive) \brief Static member to restore objects from messages. You should always check that the \a archive argument actually corresponds to @@ -127,17 +120,15 @@ */ -/*! - \fn virtual status_t BArchivable::Perform(perform_code d, void* arg) - \brief Internal method. +/*! \fn virtual status_t BArchivable::Perform(perform_code d, void* arg) + \brief Internal method defined for binary compatibility purposes. \internal This method is defined for binary compatibility purposes, it is used to ensure that the correct AllUnarchived() and AllArchived() methods are called for objects, as those methods are new to Haiku. */ -/*! - \fn virtual status_t BArchivable::AllUnarchived(const BMessage* archive) +/*! \fn virtual status_t BArchivable::AllUnarchived(const BMessage* archive) \brief Method relating to the use of \c BUnarchiver. This hook function is called triggered in the BUnarchiver::Finish() method. @@ -146,32 +137,31 @@ Implementations of this method should call the implementation of their parent class, the same as for the Archive() method. - \note To guarantee that your AllUnarchived() method will be called during - unarchival, you must create a BUnarchiver object in your archive - constructor. + \warning To guarantee that your AllUnarchived() method will be called + during unarchival, you must create a BUnarchiver object in your + archive constructor. \see BUnarchiver, BUnarchiver::Finish() */ -/*! - \fn virtual status_t BArchivable::AllArchived(BMessage* into) const +/*! \fn virtual status_t BArchivable::AllArchived(BMessage* into) const \brief Method relating to the use of \c BArchiver. This hook function is called once the first BArchiver that was created in - an archiving session is either destroyed, or has its \c Finish() method + an archiving session is either destroyed, or has its Finish() method called. Implementations of this method can be used, in conjunction with BArchiver::IsArchived(), to reference objects in your archive that you do not own, depending on whether or not those objects were archived by their owners. Implementations of this method should call the implementation of their parent class, the same as for the Archive() method. - \note To guarantee that your AllArchived() method will be called during - archival, you must create a BArchiver object in your Archive() - implementation. + \warning To guarantee that your AllArchived() method will be called + during archival, you must create a BArchiver object in your + Archive() implementation. - \note You should archive any objects you own in your Archive() method - implementation, \b NOT your AllArchived() method. + \warning You should archive any objects you own in your Archive() + method implementation, and \b NOT your AllArchived() method. \see BArchiver BArchiver::Finish() */ @@ -184,15 +174,13 @@ */ -/*! - \typedef typedef BArchivable* (*instantiation_func)(BMessage*) +/*! \typedef typedef BArchivable* (*instantiation_func)(BMessage*) \brief Internal definition of a function that can instantiate objects that have been created with the BArchivable API. */ -/*! - \fn BArchivable* instantiate_object(BMessage *from, image_id *id) +/*! \fn BArchivable* instantiate_object(BMessage *from, image_id *id) \brief Instantiate an archived object with the object being defined in a different application or library. @@ -206,8 +194,7 @@ */ -/*! - \fn BArchivable* instantiate_object(BMessage *from) +/*! \fn BArchivable* instantiate_object(BMessage *from) \brief Instantiate an archived object. This global function will determine the base class, based on the \a from @@ -222,30 +209,26 @@ */ -/*! - \fn bool validate_instantiation(BMessage* from, const char* className) +/*! \fn bool validate_instantiation(BMessage* from, const char* className) \brief Internal function that checks if the \a className is the same as the one stored in the \a from message. */ -/*! - \fn instantiation_func find_instantiation_func(const char* className, +/*! \fn instantiation_func find_instantiation_func(const char* className, const char* signature) \brief Internal function that searches for the instantiation func with a specific signature. Use instantiate_object() instead. */ -/*! - \fn instantiation_func find_instantiation_func(const char* className) +/*! \fn instantiation_func find_instantiation_func(const char* className) \brief Internal function that searches for the instantiation func of a specific class. Use instantiate_object() instead. */ -/*! - \fn instantiation_func find_instantiation_func(BMessage* archive) +/*! \fn instantiation_func find_instantiation_func(BMessage* archive) \brief Internal function that searches for the instantiation func that works on the specified \a archive. Use instantiate_object() instead. */ diff --git a/docs/user/support/Beep.dox b/docs/user/support/Beep.dox index a33895133a..c4a30c35ca 100644 --- a/docs/user/support/Beep.dox +++ b/docs/user/support/Beep.dox @@ -13,7 +13,7 @@ ///// and not completely implemented, so this needs revision if everything ///// is finished. - /*! +/*! \file Beep.h \brief Functions to generate sounds from the computer. */ @@ -24,34 +24,31 @@ //! @{ -/*! - \fn status_t beep() - \brief Invoke the standard system beep to alert users. +/*! \fn status_t beep() + \brief Invoke the standard system beep to alert users. - From Beep.h and in libbe.so. - - \see system_beep() and add_system_beep_event() + From Beep.h and in libbe.so. + + \see system_beep() and add_system_beep_event() */ -/*! - \fn status_t system_beep(const char* eventName) - \brief Invokes the sound for event \a eventName. - - You can add the events using add_system_beep_event(). +/*! \fn status_t system_beep(const char* eventName) + \brief Invokes the sound for event \a eventName. - From Beep.h and in libbe.so. + You can add the events using add_system_beep_event(). + + From Beep.h and in libbe.so. */ -/*! - \fn status_t add_system_beep_event(const char* eventName, uint32 flags = 0) - \brief Adds an event to the media server. - - Call this method to add a specific event to the media server. +/*! \fn status_t add_system_beep_event(const char* eventName, uint32 flags = 0) + \brief Adds an event to the media server. - From Beep.h and in libbe.so. - - \param eventName The name of the event. - \param flags Currently unused. Pass \c 0. + Call this method to add a specific event to the media server. + + From Beep.h and in libbe.so. + + \param eventName The name of the event. + \param flags Currently unused. Pass \c 0. */ -//! @} \ No newline at end of file +//! @} diff --git a/docs/user/support/List.dox b/docs/user/support/List.dox index 645129c70a..75deacb4d3 100644 --- a/docs/user/support/List.dox +++ b/docs/user/support/List.dox @@ -26,7 +26,7 @@ \class BList \ingroup support \ingroup libbe - \brief An ordered container that is designed to hold generic \c void * + \brief An ordered container that is designed to hold generic \c void* objects. This class is designed to be used for a variety of tasks. Unlike similar @@ -399,7 +399,7 @@ A C D E F G B H I J If one of the actions on the items fails it means that the \a func function returned \c false and the processing of the list will be stopped. - \param func A function that takes a \c void * argument and returns a + \param func A function that takes a \c void* argument and returns a boolean. \see DoForEach(bool (*func)(void* item, void* arg2), void *arg2) */ @@ -412,8 +412,8 @@ A C D E F G B H I J If one of the actions on the items fails it means that the \a func function returned \c false and the processing of the list will be stopped. - \param func A function with the first \c void * argument being the item - and the second \c void * being the argument that you supply. It should + \param func A function with the first \c void* argument being the item + and the second \c void* being the argument that you supply. It should return a boolean value on whether it succeeded or not. \param arg2 An argument to supply to \a func. \see DoForEach(bool (*func)(void* item)) diff --git a/docs/user/support/SupportDefs.dox b/docs/user/support/SupportDefs.dox index 3adaeb2ff3..104e600d9c 100644 --- a/docs/user/support/SupportDefs.dox +++ b/docs/user/support/SupportDefs.dox @@ -21,7 +21,7 @@ //! @{ /*! - \typedef typedef __haiku_int8 int8 + \typedef typedef __haiku_int8 int8 */ /*! @@ -29,7 +29,7 @@ */ /*! - \typedef typedef __haiku_int16 int16 + \typedef typedef __haiku_int16 int16 */ /*! @@ -37,7 +37,7 @@ */ /*! - \typedef typedef __haiku_int32 int32 + \typedef typedef __haiku_int32 int32 */ /*! @@ -45,7 +45,7 @@ */ /*! - \typedef typedef __haiku_int64 int64 + \typedef typedef __haiku_int64 int64 */ /*! @@ -137,9 +137,7 @@ //! @} -/*! - \name Character Type Formats -*/ +/*! \name Character Type Formats */ //! @{ @@ -153,20 +151,18 @@ //! @} -/*! - \name Descriptive Type Formats -*/ +/*! \name Descriptive Type Formats */ //! @{ /*! - \typedef typedef int32 status_t - \brief Represents one of the status codes defined in Error.h + \typedef typedef int32 status_t + \brief Represents one of the status codes defined in Error.h */ /*! - \typedef typedef int64 bigtime_t - \brief Represents time. The unit depends on the context of the function. + \typedef typedef int64 bigtime_t + \brief Represents time. The unit depends on the context of the function. */ /*! @@ -175,23 +171,21 @@ */ /*! - \typedef typedef uint32 type_code - \brief Represents a certain type of data. See TypeConstants.h for possible - values. + \typedef typedef uint32 type_code + \brief Represents a certain type of data. See TypeConstants.h for + possible values. */ /*! - \typedef typedef uint32 perform_code - \brief Unused. Defined by Be to support 'hidden' commands or - extensions to classes. The Haiku API has none of these. + \typedef typedef uint32 perform_code + \brief Unused. Defined by Be to support 'hidden' commands or + extensions to classes. The Haiku API has none of these. */ //! @} -/*! - \name Format strings for printf()/scanf() -*/ +/*! \name Format strings for printf()/scanf() */ //! @{ @@ -374,9 +368,7 @@ //! @} -/*! - \name Format strings for several standard types -*/ +/*! \name Format strings for several standard types */ //! @{ @@ -474,41 +466,35 @@ //////////////// Odds and ends -/*! - \var const char *B_EMPTY_STRING - \brief Defines an empty string. Currently defined as the C-string "". +/*! \var const char *B_EMPTY_STRING + \brief Defines an empty string. Currently defined as the string "". */ -/*! - \def min_c(a,b) - \brief Returns the minimum of the values a and b. +/*! \def min_c(a,b) + \brief Returns the minimum of the values a and b. - \note When including this header in a C file, use the C equivalent called - \c min(a,b). + \note When including this header in a C file, use the C equivalent called + \c min(a,b). */ -/*! - \def max_c(a,b) - \brief Returns the maximum of values a and b. +/*! \def max_c(a,b) + \brief Returns the maximum of values a and b. - \note When including this header in a C file, use the C equivalent called - \c max(a,b). + \note When including this header in a C file, use the C equivalent called + \c max(a,b). */ -/*! - \def NULL - \brief Defines the constant \c NULL if it hasn't been defined anywhere before. +/*! \def NULL + \brief Defines the constant \c NULL if it hasn't been defined + anywhere before. */ -/*! - \addtogroup support_globals -*/ +/*! \addtogroup support_globals */ //! @{ -/*! - \fn int32 atomic_set(vint32 *value, int32 newValue) - \brief Atomically set the variable \a value to \a newvalue. +/*! \fn int32 atomic_set(vint32 *value, int32 newValue) + \brief Atomically set the variable \a value to \a newvalue. This is a thread-safe way of performing the \c *value \c = \c newValue operation. You should use these function when two or more threads might @@ -518,29 +504,28 @@ \return The original value of \c value. \sa atomic_set64() for a version that works on \c long \c long - \sa atomic_test_and_set(), atomic_add(), atomic_and(), - atomic_or(), atomic_get() + \sa atomic_test_and_set(), atomic_add(), atomic_and(), atomic_or(), + atomic_get() */ -/*! - \fn int32 atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst) - \brief Atomically set the variable \a value to \a newValue if the current +/*! \fn int32 atomic_test_and_set(vint32 *value, int32 newValue, + int32 testAgainst) + \brief Atomically set the variable \a value to \a newValue if the current value is \a testAgainst. This is a thread-safe way of conditionally performing the \c *value \c += - \c newValue operation. You should use these function when two or more threads - might access the variable simultaneously. You don't have to use a semaphore - or a mutex in this case. + \c newValue operation. You should use these function when two or more + threads might access the variable simultaneously. You don't have to use + a semaphore or a mutex in this case. \return The original value of \c value. - \sa atomic_test_and_set64() for a version that works on \c long \c long - \sa atomic_set(), atomic_add(), atomic_and(), - atomic_or(), atomic_get() + + \sa atomic_test_and_set64() for a version that works on \c long \c long + \sa atomic_set(), atomic_add(), atomic_and(), atomic_or(), atomic_get() */ -/*! - \fn int32 atomic_add(vint32 *value, int32 addValue) - \brief Atomically add the value of \a addValue to \a value. +/*! \fn int32 atomic_add(vint32 *value, int32 addValue) + \brief Atomically add the value of \a addValue to \a value. This is a thread-safe way of performing the \c *value \c += \c addValue operation. You should use these function when two or more threads might @@ -548,14 +533,14 @@ mutex in this case. \return The original value of \c value. - \sa atomic_add64() for a version that works on \c long \c long - \sa atomic_set(), atomic_test_and_set(), atomic_and(), - atomic_or(), atomic_get() + + \sa atomic_add64() for a version that works on \c long \c long + \sa atomic_set(), atomic_test_and_set(), atomic_and(), atomic_or(), + atomic_get() */ -/*! - \fn int32 atomic_and(vint32 *value, int32 andValue) - \brief Atomically perform a bitwise AND operation of \a andValue to the +/*! \fn int32 atomic_and(vint32 *value, int32 andValue) + \brief Atomically perform a bitwise AND operation of \a andValue to the variable \a andValue. This is a thread-safe way of performing the \c *value \c &= \c andValue @@ -564,15 +549,15 @@ mutex in this case. \return The original value of \c value. - \sa atomic_and64() for a version that works on \c long \c long - \sa atomic_set(), atomic_test_and_set(), atomic_add(), - atomic_or(), atomic_get() + + \sa atomic_and64() for a version that works on \c long \c long + \sa atomic_set(), atomic_test_and_set(), atomic_add(), atomic_or(), + atomic_get() */ -/*! - \fn int32 atomic_or(vint32 *value, int32 orValue) - \brief Atomically perform a bitwise OR operation of \a orValue to the +/*! \fn int32 atomic_or(vint32 *value, int32 orValue) + \brief Atomically perform a bitwise OR operation of \a orValue to the variable \a andValue. This is a thread-safe way of performing the \c *value \c |= \c orValue @@ -581,14 +566,14 @@ mutex in this case. \return The original value of \c value. - \sa atomic_or64() for a version that works on \c long \c long - \sa atomic_set(), atomic_test_and_set(), atomic_add(), atomic_and(), - atomic_get() + + \sa atomic_or64() for a version that works on \c long \c long + \sa atomic_set(), atomic_test_and_set(), atomic_add(), atomic_and(), + atomic_get() */ -/*! - \fn int32 atomic_get(vint32 *value) - \brief Atomically return the value of \c value. +/*! \fn int32 atomic_get(vint32 *value) + \brief Atomically return the value of \c value. This is a thread-safe way of reading the contents of the \c value operation. You should use these function when two or more threads might @@ -596,14 +581,14 @@ mutex in this case. \return The original value of \c value. - \sa atomic_get64() for a version that works on \c long \c long - \sa atomic_set(), atomic_test_and_set(), atomic_add(), atomic_and(), - atomic_or() + + \sa atomic_get64() for a version that works on \c long \c long + \sa atomic_set(), atomic_test_and_set(), atomic_add(), atomic_and(), + atomic_or() */ -/*! - \fn int64 atomic_set64(vint64 *value, int64 newValue) - \brief Atomically set the variable \a value to \a newvalue. +/*! \fn int64 atomic_set64(vint64 *value, int64 newValue) + \brief Atomically set the variable \a value to \a newvalue. This is a thread-safe way of performing the \c *value \c = \c newValue operation. You should use these function when two or more threads might @@ -612,30 +597,30 @@ \return The original value of \c value. - \sa atomic_set() for a version that works on an \c int32 - \sa atomic_test_and_set64(), atomic_add64(), atomic_and64(), - atomic_or64(), atomic_get64() + \sa atomic_set() for a version that works on an \c int32 + \sa atomic_test_and_set64(), atomic_add64(), atomic_and64(), + atomic_or64(), atomic_get64() */ -/*! - \fn int64 atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst) - \brief Atomically set the variable \a value to \a newValue if the current +/*! \fn int64 atomic_test_and_set64(vint64 *value, int64 newValue, + int64 testAgainst) + \brief Atomically set the variable \a value to \a newValue if the current value is \a testAgainst. - This is a thread-safe way of conditionally performing the \c *value \c += - \c newValue operation. You should use these function when two or more threads - might access the variable simultaneously. You don't have to use a semaphore - or a mutex in this case. - + This is a thread-safe way of conditionally performing the \c *value + \c += \c newValue operation. You should use these function when two + or more threads might access the variable simultaneously. You don't + have to use a semaphore or a mutex in this case. + \return The original value of \c value. - \sa atomic_test_and_set() for a version that works on an \c int32 - \sa atomic_set64(), atomic_add64(), atomic_and64(), - atomic_or64(), atomic_get64() + + \sa atomic_test_and_set() for a version that works on an \c int32 + \sa atomic_set64(), atomic_add64(), atomic_and64(), + atomic_or64(), atomic_get64() */ -/*! - \fn int64 atomic_add64(vint64 *value, int64 addValue) - \brief Atomically add the value of \a addValue to \a value. +/*! \fn int64 atomic_add64(vint64 *value, int64 addValue) + \brief Atomically add the value of \a addValue to \a value. This is a thread-safe way of performing the \c *value \c += \c addValue operation. You should use these function when two or more threads might @@ -643,14 +628,14 @@ mutex in this case. \return The original value of \c value. - \sa atomic_add() for a version that works on an \c int32 - \sa atomic_set64(), atomic_test_and_set64(), atomic_and64(), - atomic_or64(), atomic_get64() + + \sa atomic_add() for a version that works on an \c int32 + \sa atomic_set64(), atomic_test_and_set64(), atomic_and64(), + atomic_or64(), atomic_get64() */ -/*! - \fn int64 atomic_and64(vint64 *value, int64 andValue) - \brief Atomically perform a bitwise AND operation of \a andValue to the +/*! \fn int64 atomic_and64(vint64 *value, int64 andValue) + \brief Atomically perform a bitwise AND operation of \a andValue to the variable \a andValue. This is a thread-safe way of performing the \c *value \c &= \c andValue @@ -659,14 +644,14 @@ mutex in this case. \return The original value of \c value. - \sa atomic_and() for a version that works on an \c int32 - \sa atomic_set64(), atomic_test_and_set64(), atomic_add64(), - atomic_or64(), atomic_get64() + + \sa atomic_and() for a version that works on an \c int32 + \sa atomic_set64(), atomic_test_and_set64(), atomic_add64(), + atomic_or64(), atomic_get64() */ -/*! - \fn int64 atomic_or64(vint64 *value, int64 orValue) - \brief Atomically perform a bitwise OR operation of \a orValue to the +/*! \fn int64 atomic_or64(vint64 *value, int64 orValue) + \brief Atomically perform a bitwise OR operation of \a orValue to the variable \a andValue. This is a thread-safe way of performing the \c *value \c |= \c orValue @@ -675,14 +660,14 @@ mutex in this case. \return The original value of \c value. - \sa atomic_or() for a version that works on an \c int32 - \sa atomic_set64(), atomic_test_and_set64(), atomic_add64(), atomic_and64(), - atomic_get64() + + \sa atomic_or() for a version that works on an \c int32 + \sa atomic_set64(), atomic_test_and_set64(), atomic_add64(), atomic_and64(), + atomic_get64() */ -/*! - \fn int64 atomic_get64(vint64 *value) - \brief Atomically return the value of \c value. +/*! \fn int64 atomic_get64(vint64 *value) + \brief Atomically return the value of \c value. This is a thread-safe way of reading the contents of the \c value operation. You should use these function when two or more threads might @@ -690,33 +675,30 @@ mutex in this case. \return The original value of \c value. - \sa atomic_get() for a version that works on an \c int32 - \sa atomic_set64(), atomic_test_and_set64(), atomic_add64(), atomic_and64(), - atomic_or64() + + \sa atomic_get() for a version that works on an \c int32 + \sa atomic_set64(), atomic_test_and_set64(), atomic_add64(), + atomic_and64(), atomic_or64() */ //! @} -/*! - \fn void* get_stack_frame(void) +/*! \fn void* get_stack_frame(void) \brief Internal function. \internal */ -/*! - \name Deprecated defines -*/ +/*! \name Deprecated defines */ //! @{ -/*! - \def FALSE - \brief Obsolete. Use \c false. +/*! \def FALSE + \brief Obsolete. Use \c false. */ -/*! - \def TRUE - \brief Obsolete. Use \c true. +/*! \def TRUE + \brief Obsolete. Use \c true. */ //! @} + diff --git a/docs/user/support/Unarchiver.dox b/docs/user/support/Unarchiver.dox index de6b6b26d7..1eca4db9e9 100644 --- a/docs/user/support/Unarchiver.dox +++ b/docs/user/support/Unarchiver.dox @@ -11,12 +11,11 @@ */ -/*! -\class BUnarchiver -\ingroup support -\ingroup libbe -\brief A class that simplifies the unarchiving of complicated BArchivable - hierarchies. +/*! \class BUnarchiver + \ingroup support + \ingroup libbe + \brief A class that simplifies the unarchiving of complicated BArchivable + hierarchies. The BUnarchiver class is a small class used to recover BArchivable objects that have been archived with the BArchiver class. It also provides ownership @@ -40,8 +39,7 @@ */ -/*! - \fn BUnarchiver::BUnarchiver(const BMessage* archive) +/*! \fn BUnarchiver::BUnarchiver(const BMessage* archive) \brief Constructs a BUnarchiver object to manage \c archive. \note To guarantee that your AllUnarchived() method will be called during @@ -57,74 +55,87 @@ */ -/*! - \fn BUnarchiver::~BUnarchiver() - \brief Destroys a BUnarchiver object. Calls this objects Finish() method, - if it has not yet been called. +/*! \fn BUnarchiver::~BUnarchiver() + \brief Destroys a BUnarchiver object. + + Calls this objects Finish() method, if it has not yet been called. */ -/*! - \fn status_t BUnarchiver::EnsureUnarchived(int32 token) - \brief Ensure the object represented by \c token is unarchived and +/*! \fn status_t BUnarchiver::EnsureUnarchived(int32 token) + \brief Ensure the object represented by \a token is unarchived and instantiated. + + \param token the object \a token */ -/*! - \fn status_t BUnarchiver::EnsureUnarchived(const char* name, +/*! \fn status_t BUnarchiver::EnsureUnarchived(const char* name, int32 index = 0) - \brief Ensure the object archived under \c name at \c index is unarchived + \brief Ensure the object archived under \a name at \a index is unarchived and instantiated. + + \param name The archive \a name. + \param index The archive \a index. */ -/*! - \fn bool BUnarchiver::IsInstantiated(int32 token) +/*! \fn bool BUnarchiver::IsInstantiated(int32 token) \brief Checks whether the object represented by \c token has been instantiated in this session. + + \param token The object \a token */ -/*! - \fn bool BUnarchiver::IsInstantiated(const char* name, int32 index = 0) - \brief Checks whether the object archived under \c name at \c index has been +/*! \fn bool BUnarchiver::IsInstantiated(const char* name, int32 index = 0) + \brief Checks whether the object archived under \a name at \a index has been instantiated in this session. + + \param name The archive \a name. + \param index The arcive \a token. */ -/*! - \fn template status_t BUnarchiver::GetObject(int32 token, +/*! \fn template status_t BUnarchiver::GetObject(int32 token, ownership_policy owning, T*& object) \brief Recover an object by token that was archived by a BArchiver object. If the object has not yet been instantiated, and this request is not coming from an AllUnarchived() implementation, the object will be instantiated now. - If the retrieved object is not of the type \c T, then this method will fail. + If the retrieved object is not of the type T, then this method will fail. If this method fails, you will not receive ownership of the object, no matter what you specified in \c owning. - \tparam T The type of object you wish to find. + \tparam T The type of \a object you wish to find. - \param token The token you got for this object from + \param token The \a token you got for this object from BArchiver::GetTokenForArchivable() during archival. \param owning Whether or not you wish to take ownership of the retrieved object. - \param object Return parameter for the retrieved object of type \c T. + \param object Return parameter for the retrieved object of type T. - \retval B_BAD_TYPE The object retrieved was not of type \c T. + \retval B_OK The object retrieved was of type T. + \retval B_BAD_TYPE The object retrieved was not of type T. */ -/*! - \fn template status_t BUnarchiver::GetObject(int32 token, +/*! \fn template status_t BUnarchiver::GetObject(int32 token, T*& object) - \brief Recover and take ownership of an object represented by \c token. + \brief Recover and take ownership of an object represented by \a token. - Equivalent to calling GetObject(token, BUnarchiver::B_ASSUME_OWNERSHIP, - object) + Equivalent to calling GetObject(token, \c B_ASSUME_OWNERSHIP, object) + + \tparam T The type of \a object you wish to find. + + \param token The \a token you got for this object from + BArchiver::GetTokenForArchivable() during archival. + \param object The return parameter for the retrieved object of type T. + + \retval B_OK The object retrieved was of type T. + \retval B_BAD_TYPE The object retrieved was not of type T. */ @@ -137,7 +148,7 @@ instantiated, and this request is not coming from an AllUnarchived() implementation, the object will be instantiated now. - If the retrieved object is not of the type \c T, then this method will fail. + If the retrieved object is not of the type T, then this method will fail. If this method fails, you will not receive ownership of the object, no matter what you specified in \c owning. @@ -145,61 +156,90 @@ \param name The name that was passed to BArchiver::AddArchivable() when adding this object. - \param index The index of the object you wish to recover (0 based, like - BMessage::FindData(). + \param index The index of the object you wish to recover (\c 0-based, + like BMessage::FindData(). \param owning Dictates whether or not you wish to take ownership of the retrieved object. - \param object Return parameter for the retrieved object of type \c T. + \param object Return parameter for the retrieved object of type T. - \retval B_BAD_TYPE The object retrieved was not of type \c T. + \retval B_OK The object retrieved was of type T. + \retval B_BAD_TYPE The object retrieved was not of type T. */ -/*! - \fn template status_t BUnarchiver::FindObject(const char* name, +/*! \fn template status_t BUnarchiver::FindObject(const char* name, int32 index, T*& object) \brief Recover and take ownership of an object that had previously been archived using the BArchiver::AddArchivable() method. + + \tparam T The type of object you wish to find. + + \param name The name that was passed to BArchiver::AddArchivable() when + adding this object. + \param index The index of the object you wish to recover (\c 0-based, + like #BMessage::FindData(). + \param object Return parameter for the retrieved object of type T. + + \retval B_OK The object retrieved was of type T. + \retval B_BAD_TYPE The object retrieved was not of type T. */ -/*! - \fn template status_t BUnarchiver::FindObject(const char* name, +/*! \fn template status_t BUnarchiver::FindObject(const char* name, ownership_policy owning, T*& object) - \brief Recover an object at index 0 that had previously been archived using - the BArchiver::AddArchivable() method. + \brief Recover an object at index \c 0 that had previously been + archived using the BArchiver::AddArchivable() method. - Equivalent to calling FindObject(name, 0, owning, object). + Equivalent to calling FindObject(name, \c 0, owning, object). + + \tparam T The type of \a object you wish to find. + + \param name The name that was passed to BArchiver::AddArchivable() when + adding this object. + \param owning Dictates whether or not you wish to take ownership of the + retrieved object. + \param object Return parameter for the retrieved object of type T. + + \retval B_OK The object retrieved was of type T. + \retval B_BAD_TYPE The object retrieved was not of type T. */ -/*! - \fn template status_t BUnarchiver::FindObject(const char* name, +/*! \fn template status_t BUnarchiver::FindObject(const char* name, T*& object) - \brief Recover and take ownership of an object at index 0 that had + \brief Recover and take ownership of an object at index \c 0 that had previously been archived using the BArchiver::AddArchivable() method. - Equivalent to calling FindObject(name, 0, BUnarchiver::B_ASSUME_OWNERSHIP, - object). + Equivalent to calling FindObject(name, \c 0, + BUnarchiver::B_ASSUME_OWNERSHIP, object). + + \tparam T The type of \a object you wish to find. + + \param name The name that was passed to BArchiver::AddArchivable() when + adding this object. + \param object Return parameter for the retrieved \a object of type T. + + \retval B_OK The \a object retrieved was of type T. + \retval B_BAD_TYPE The \a object retrieved was not of type T. */ -/*! - \fn status_t BUnarchiver::Finish(status_t err = B_OK); +/*! \fn status_t BUnarchiver::Finish(status_t err = B_OK); \brief Report any unarchiving errors and possibly complete the archiving session. - \return The first error reported in this unarchiving session, or B_OK. This method may finish an unarchiving session (triggering the call of all instantiated objects' AllUnarchived() methods) if the following conditions are true: - \li No errors have been reported to this or any other BUnarchiver object - within this session. - \li This is the last remaining BUnarchiver that has not had its Finish() - method invoked. + + \li No errors have been reported to this or any other BUnarchiver + object within this session. + \li This is the last remaining BUnarchiver that has not had its + Finish() method invoked. + If you call this method with an error code not equal to B_OK, then this unarchiving session has failed, instantiated objects will not have their AllUnarchived() methods called, and any subsequent calls to this method @@ -207,22 +247,22 @@ Furthermore, any objects that have been instantiated, but have not had their ownership assumed by another object will now be deleted (excluding the root object). + + \return The first error reported in this unarchiving session, or \c B_OK. */ /*! \fn const BMessage* BUnarchiver::ArchiveMessage() const - \brief Returns the BMessage* used to construct this BUnarchiver. This is - the archive that FindObject() uses. + \brief Returns the BMessage* used to construct this BUnarchiver. + + This is the archive that FindObject() uses. */ -/*! - \fn static bool BUnarchiver::IsArchiveManaged(const BMessage* archive) +/*! \fn static bool BUnarchiver::IsArchiveManaged(const BMessage* archive) - \brief Checks whether \c archive was managed by a BArchiver object. - \retval true if \c archive was managed by a BArchiver object. - \retval false otherwise. + \brief Checks whether \a archive was managed by a BArchiver object. This method can be used to maintain archive backwards-compatibility for a class that has been updated to use the BArchiver class. If there is a @@ -231,7 +271,7 @@ object. Here is an example of how you might use this method. Note that you - must still call BUnarchiver::PrepareArchive(archive), either way. + must still call PrepareArchive(archive) either way. \code MyArchivableClas::MyArchivableClass(BMessage* archive) @@ -247,14 +287,14 @@ MyArchivableClas::MyArchivableClass(BMessage* archive) } } \endcode + + \retval true if \a archive was managed by a BArchiver object. + \retval false otherwise. */ -/*! - \fn static BMessage* BUnarchiver::PrepareArchive(BMessage*& archive) +/*! \fn static BMessage* BUnarchiver::PrepareArchive(BMessage* &archive) \brief Prepares \c archive for use by a BUnarchiver. - \param archive The archive you wish to have prepared. - \return The same BMessage as is passed in. This method must be called if you plan to use a BUnarchiver on an archive. It must be called once for each class an object inherits from that @@ -272,33 +312,45 @@ MyArchivableClas::MyArchivableClas(BMessage* archive) // ... } \endcode + + \param archive The archive you wish to have prepared. + + \return The same #BMessage as is passed in. */ -/*! - \fn void BUnarchiver::AssumeOwnership(BArchivable* archivable) - \brief Become the owner of \c archivable. +/*! \fn void BUnarchiver::AssumeOwnership(BArchivable* archivable) + \brief Become the owner of \a archivable. - After calling this method, you are responsible for the deletion - of \c archivable. + After calling this method you are responsible for deleting the + \a archivable. + + \param archivable The \a archivable object. */ -/*! - \fn void BUnarchiver::RelinquishOwnership(BArchivable* archivable) - \brief Relinquish ownership of \c archivable. If \c archivable remains +/*! \fn void BUnarchiver::RelinquishOwnership(BArchivable* archivable) + \brief Relinquish ownership of \a archivable. If \a archivable remains unclaimed at the end of the unarchiving session, it will be deleted (unless it is the root object). + + \param archivable The \a archivable object. */ -/*! - \fn template status_t BUnarchiver::InstantiateObject( +/*! \fn template status_t BUnarchiver::InstantiateObject( BMessage* from, T*& object) - \brief Attempt to instantiate an object of type \c T from BMessage* \c from. + \brief Attempt to instantiate an object of type T from BMessage* + \a from. - If the instantiated object is not of type \c T, then it will be deleted, + If the instantiated object is not of type T, then it will be deleted, and this method will return \c B_BAD_TYPE. This method is similar to the instantiate_object() function, but provides error reporting and protection from memory leaks. + + \param from The #BMessage to instantiate from. + \param object Return parameter for the retrieved object of type T. + + \retval B_OK The object retrieved was of type T. + \retval B_BAD_TYPE The object retrieved was not of type T. */ diff --git a/docs/user/support/string.dox b/docs/user/support/string.dox index 066dfb8603..ac935cd794 100644 --- a/docs/user/support/string.dox +++ b/docs/user/support/string.dox @@ -10,1411 +10,1792 @@ */ /*! -\file String.h -\brief Defines the BString class and global operators and functions for handling strings. + \file String.h + \brief Defines the BString class and global operators and functions for + handling strings. */ /*! -\class BString String.h -\ingroup support -\ingroup libbe -\brief String class supporting common string operations. + \class BString String.h + \ingroup support + \ingroup libbe + \brief String class supporting common string operations. -BString is a string allocation and manipulation class. The object -takes care to allocate and free memory for you, so it will always be -"big enough" to store your strings. - -\author Marc Flerackers \ -\author Stefano Ceccherini \ -\author Oliver Tappe \ + BString is a string allocation and manipulation class. The object + takes care to allocate and free memory for you, so it will always be + "big enough" to store your strings. + + \author Marc Flerackers \ + \author Stefano Ceccherini \ + \author Oliver Tappe \ */ /*! -\var char* BString::fPrivateData -\brief BString's storage for data. + \var char* BString::fPrivateData + \brief BString's storage for data. -This member is deprecated and might even go \c private in future releases. + This member is deprecated and might even go \c private in future releases. -If you are planning to derive from this object and you want to manipulate the raw -string data, please have a look at LockBuffer() and UnlockBuffer(). + If you are planning to derive from this object and you want to manipulate + the raw string data, please have a look at LockBuffer() and UnlockBuffer(). */ /*! -\fn BString::BString() -\brief Create an uninitialized BString. + \fn BString::BString() + \brief Creates an empty BString. */ /*! -\fn BString::BString(const char* str) -\brief Create a BString and initializes it to the given string. -\param str Pointer to a NULL terminated string. + \fn BString::BString(const char* string) + \brief Creates and initializes a BString from a \a string. */ /*! -\fn BString::BString(const BString &string) -\brief Create a BString and makes it a copy of the supplied one. -\param string the BString object to be copied. + \fn BString::BString(const BString &string) + \brief Creates and initializes a BString from another BString. */ /*! -\fn BString::BString(const char *str, int32 maxLength) -\brief Create a BString and initializes it to the given string. -\param str Pointer to a NULL terminated string. -\param maxLength The amount of characters you want to copy from the original -string. + \fn BString::BString(const char *string, int32 maxLength) + \brief Creates and initializes a BString from a \a string up to + \a maxLength characters. + + If \a maxLength is greater than the length of the source \a string then the + entire source \a string is copied. If \a maxLength is less than or equal + to 0 then the result is an empty BString. + + \warning In BeOS R5 passing in a negative \a maxLength argument will copy + the entire \a string. */ /*! -\fn BString::~BString() -\brief Free all resources associated with the object. - -The destructor frees the internal buffer associated with the string. + \fn BString::~BString() + \brief Free all resources associated with the object. + + The destructor also frees the internal buffer associated with the string. */ -/*! -\name Access Methods +/*! + \name Access Methods */ //! @{ /*! -\fn const char* BString::String() const -\brief Return a pointer to the object string, NULL terminated. + \fn const char* BString::String() const + \brief Return a pointer to the object string, \c NUL terminated. -The pointer to the object string is guaranteed to be NULL -terminated. You can't modify or free the pointer. Once the BString -object is deleted, the pointer becomes invalid. + The pointer to the object string is guaranteed to be \c NUL + terminated. You can't modify or free the pointer. Once the BString + object is deleted, the pointer becomes invalid. -If you want to manipulate the internal C-string of the object directly, have -a look at LockBuffer(). - -\return A pointer to the object string. + If you want to manipulate the internal string of the object directly, + have a look at LockBuffer(). + + \return A pointer to the object string. */ /*! -\fn int32 BString::Length() const -\brief Get the length of the string in bytes. + \fn int32 BString::Length() const + \brief Get the length of the string in bytes. -\return An integer with the length of the string, measured in bytes. -\sa CountChars() + \return An integer with the length of the string, measured in bytes. + \sa CountChars() */ /*! -\fn int32 BString::CountChars() const -\brief Returns the length of the object measured in characters. - -BString is somewhat aware of UTF8 characters, so this method will count -the actual number of characters in the string. + \fn int32 BString::CountChars() const + \brief Returns the length of the object measured in characters. + + BString is somewhat aware of UTF8 characters, so this method will count + the actual number of characters in the string. -\return An integer which is the number of characters in the string. -\sa Length() + \return An integer which is the number of characters in the string. + \sa Length() */ //! @} /*! -\name Assignment Methods + \name Assignment Methods -To assign a string to the object, thus overriding the previous string -that was stored, there are different methods to use. Use one of the -overloaded Adopt() methods to take over data from another object. Use -one of the assignment operators to copy data from another object, or -use one of the SetTo() methods for more advanced copying. + To assign a string to the object, thus overriding the previous string + that was stored, there are different methods to use. Use one of the + overloaded Adopt() methods to take over data from another object. Use + one of the assignment operators to copy data from another object, or + use one of the SetTo() methods for more advanced copying. */ //! @{ /*! -\fn BString& BString::operator=(const BString &string) -\brief Re-initialize the object to a copy of the data of a BString. -\param string The string object to copy. -\return The function always returns \c *this . -\sa Adopt(BString &from) -\sa SetTo(const BString &string, int32 length) + \fn BString& BString::operator=(const BString &string) + \brief Re-initialize the object to a copy of the data of a BString. + + \param string The string object to copy. + + \return The function always returns \c *this . + + \sa Adopt(BString &from) + \sa SetTo(const BString &string, int32 length) */ /*! -\fn BString& BString::operator=(const char *str) -\brief Re-initialize the object to a copy of the data of a C-string. -\param str Pointer to a C-string. -\return The function always returns \c *this . -\sa SetTo(const char *str, int32 maxLength) + \fn BString& BString::operator=(const char *str) + \brief Re-initialize the object to a copy of the data of a string. + + \sa SetTo(const char *str, int32 maxLength) */ /*! -\fn BString& BString::operator=(char c) -\brief Re-initialize the object to a character. -\param c The character which you want to initialize the string to. -\return The function always returns \c *this . + \fn BString& BString::operator=(char c) + \brief Re-initialize the object to a character. + + \param c The character which you want to initialize the string to. */ /*! -\fn BString& BString::SetTo(const char *str, int32 maxLength) -\brief Re-initialize the object to a copy of the data of a C-string. -\param str Pointer to a string. -\param maxLength Amount of characters to copy from the original string. -\return The function always returns \c *this . -\sa operator=(const char *str) + \fn BString& BString::SetTo(const char *str, int32 maxLength) + \brief Re-initialize the object to a copy of the data of a string. + + \param str The string to copy. + \param maxLength Amount of characters to copy from the string. + + \sa operator=(const char *str) */ /*! -\fn BString& BString::SetTo(const BString &from) -\brief Re-initialize the object to a copy of the data of a BString. -\param from The string object to copy. -\return The function always returns \c *this . -\sa SetTo(const BString &string, int32 length) -\sa Adopt(BString &from) + \fn BString& BString::SetTo(const BString &from) + \brief Re-initialize the object to a copy of the data of a BString. + + \param from The string object to copy. + + \return The function always returns \c *this . + + \sa SetTo(const BString &string, int32 length) + \sa Adopt(BString &from) */ /*! -\fn BString& BString::SetTo(const char *str) -\brief Re-initialize the object to a copy of the data of a C-string. + \fn BString& BString::SetTo(const char *str) + \brief Re-initialize the object to a copy of the data of a string. -This method calls operator=(const char *str). + This method calls operator=(const char *str). -\param str Pointer to a C-string. -\return The function always returns \c *this . -\sa SetTo(const char *str, int32 maxLength) + \sa SetTo(const char *str, int32 maxLength) */ /*! -\fn BString& BString::Adopt(BString &from) -\brief Adopt the data of the given BString object. + \fn BString& BString::Adopt(BString &from) + \brief Adopt the data of the given BString object. -This method adopts the data. Please note that the object that is adopted -from is not deleted, only its private data is initialized to a null -string. So if the from object was created on the heap, you need to -clean it up yourself. + This method adopts the data from a BString. -\param from The string object to adopt. -\return The function always returns \c *this . -\sa operator=(const BString &string) -\sa SetTo(const BString &string, int32 length) + \note The object that is adopted from is not deleted, only its private + data is initialized to a \c NULL string. So if the from object was + created on the heap, you need to clean it up yourself. + + \param from The string object to adopt. + + \return The function always returns \c *this . + + \sa operator=(const BString &string) */ /*! -\fn BString& BString::SetTo(const BString &string, int32 length) -\brief Re-initialize the string to a copy of the given BString object. -\param string The string object to copy. -\param length Amount of characters to copy from the original BString. -\return The function always returns \c *this . -\sa operator=(const BString &string) -\sa Adopt(BString &from, int32 length) + \fn BString& BString::Adopt(BString &from, int32 maxLength) + \brief Adopt the data of the given BString object up to \a maxLength + characters. + + \param from The string object to adopt. + \param maxLength Number of characters to adopt from the original BString. + + \return The function always returns \c *this . + + \sa SetTo(const BString &string, int32 maxLength) */ /*! -\fn BString& BString::Adopt(BString &from, int32 length) -\brief Adopt the data of the given BString object. + \fn BString& BString::SetTo(const BString &string, int32 maxLength) + \brief Re-initialize the string to a copy of the given BString object. -This method adopts the data. Please note that the object that is adopted -from is not deleted, only its private data is initialized to a null -string. So if the from object was created on the heap, you need to -clean it up yourself. + \param string The BString object to copy. + \param maxLength Amount of characters to copy from the original BString. -\param from The string object to adopt. -\param length Amount of characters to get from the original BString. -\return The function always returns \c *this . -\sa operator=(const BString &string) -\sa SetTo(const BString &string, int32 length) + \return The function always returns \c *this . + + \sa operator=(const BString &string) + \sa Adopt(BString &from, int32 maxLength) */ /*! -\fn BString& BString::SetTo(char c, int32 count) -\brief Re-initialize the object to a string composed of a character you specify. + \fn BString& BString::SetTo(char c, int32 count) + \brief Re-initialize the object to a string composed of a character you + specify. -This method lets you specify the length of a string and what character you want the -string to contain repeatedly. + This method lets you specify the length of a string and what character + you want the string to contain repeatedly. -\param c The character you want to initialize the BString. -\param count The length of the string. -\return The function always returns \c *this . -\sa operator=(char c) + \param c The character you want to initialize the BString. + \param count The length of the string. + + \return The function always returns \c *this . + + \sa operator=(char c) */ //! @} /*! -\name Substring Copying + \name Substring Copying */ //! @{ /*! -\fn BString &BString::CopyInto(BString &into, int32 fromOffset, int32 length) const -\brief Copy the object's data (or part of it) into another BString. + \fn BString &BString::CopyInto(BString &into, int32 fromOffset, + int32 length) const + \brief Copy the object's data (or part of it) into another BString. -This methods makes sure you don't copy more bytes than are available in the string. If -the length exceeds the length of the string, it only copies the number of characters that -are actually available. + This methods makes sure you don't copy more bytes than are available + in the string. If the length exceeds the length of the string, it only + copies the number of characters that are actually available. -\param into The BString to where to copy the object. -\param fromOffset The zero-based offset where to begin the copy. -\param length The amount of bytes to copy. -\return This method always returns a pointer to the string passed as the \c into parameter. + \param into The BString to where to copy the object. + \param fromOffset The (zero-based) offset where to begin the copy. + \param length The amount of bytes to copy. + + \return This method always returns a pointer to the string passed as the + \c into parameter. */ /*! -\fn void BString::CopyInto(char *into, int32 fromOffset, int32 length) const -\brief Copy the BString data (or part of it) into the supplied buffer. + \fn void BString::CopyInto(char *into, int32 fromOffset, int32 length) const + \brief Copy the BString data (or part of it) into the supplied buffer. -This methods makes sure you don't copy more bytes than are available in the string. If -the length exceeds the length of the string, it only copies the number of characters that -are actually available. + This methods makes sure you don't copy more bytes than are available + in the string. If the length exceeds the length of the string, it only + copies the number of characters that are actually available. -It's up to you to make sure your buffer is large enough. + It's up to you to make sure your buffer is large enough. -\param into The buffer where to copy the object. -\param fromOffset The zero-based offset where to begin the copy. -\param length The amount of bytes to copy. + \param into The buffer where to copy the object. + \param fromOffset The (zero-based) offset where to begin the copy. + \param length The amount of bytes to copy. */ //! @} -/*! -\name Appending Methods +/*! + \name Appending Methods */ //! @{ /*! -\fn BString& BString::operator+=(const char *str) -\brief Append the given string to the object. -\param str A pointer to the NULL-terminated C-string to append. -\return This method always returns \c *this . -\sa Append(const char *str, int32 length) + \fn BString& BString::operator+=(const char *str) + \brief Append the given string to the object. + + \param str A pointer to the NULL-terminated string to append. + + \return This method always returns \c *this . + + \sa Append(const char *str, int32 length) */ /*! -\fn BString& BString::operator+=(char c) -\brief Append the given character to the object. -\param c The character to append. -\return This method always returns \c *this . -\sa Append(char c, int32 count) + \fn BString& BString::operator+=(char c) + \brief Append the given character to the object. + + \param c The character to append. + + \return This method always returns \c *this . + + \sa Append(char c, int32 count) */ /*! -\fn BString & BString::operator+=(const BString &string) -\brief Append the given string to the object -\param string The string to append -\return This method always returns \c *this . -\sa Append(const BString &string, int32 length) + \fn BString & BString::operator+=(const BString &string) + \brief Append the given string to the object + + \param string The string to append + + \return This method always returns \c *this . + + \sa Append(const BString &string, int32 length) */ /*! -\fn BString &BString::Append(const BString &string) -\brief Append the given string to the object -\param string The string to append -\return This method always returns \c *this . -\sa Append(const BString &string, int32 length) + \fn BString &BString::Append(const BString &string) + \brief Append the given string to the object + + \param string The string to append + + \return This method always returns \c *this . + + \sa Append(const BString &string, int32 length) */ /*! -\fn BString &BString::Append(const char *str) -\brief Append the given string to the object. + \fn BString &BString::Append(const char *str) + \brief Append the given string to the object. -This method calls operator+=(const char *str). -\sa Append(const char *str, int32 length) + This method calls operator+=(const char *str). + + \sa Append(const char *str, int32 length) */ /*! -\fn BString& BString::Append(const BString &string, int32 length) -\brief Append a part of the given BString to the object. -\param string The BString to append. -\param length The maximum number ofbytes to get from the original object. -\return This method always returns \c *this . -\sa operator+=(const BString &string) + \fn BString& BString::Append(const BString &string, int32 length) + \brief Append a part of the given BString to the object. + + \param string The BString to append. + \param length The maximum number ofbytes to get from the original object. + + \return This method always returns \c *this . + + \sa operator+=(const BString &string) */ /*! -\fn BString& BString::Append(const char *str, int32 length) -\brief Append a part of the given string to the object. -\param str A pointer to the string to append. -\param length The maximum bytes to get from the original string. -\return This method always returns \c *this . -\sa operator+=(const char *str) + \fn BString& BString::Append(const char *str, int32 length) + \brief Append a part of the given string to the object. + + \param str A pointer to the string to append. + \param length The maximum bytes to get from the original string. + + \return This method always returns \c *this . + + \sa operator+=(const char *str) */ /*! -\fn BString& BString::Append(char c, int32 count) -\brief Append the given character repeatedly to the object. -\param c The character to append. -\param count The number of times this character should be appended. -\return This method always returns \c *this . -\sa operator+=(char c) + \fn BString& BString::Append(char c, int32 count) + \brief Append the given character repeatedly to the object. + + \param c The character to append. + \param count The number of times this character should be appended. + + \return This method always returns \c *this . + + \sa operator+=(char c) */ //! @} /*! -\name Prepending Methods + \name Prepending Methods */ //! @{ /*! -\fn BString& BString::Prepend(const char *str) -\brief Prepend the given string to the object. -\param str A pointer to the string to prepend. -\return This method always returns \c *this . -\sa Prepend(const char *str, int32 length) + \fn BString& BString::Prepend(const char *str) + \brief Prepend the given string to the object. + + \param str A pointer to the string to prepend. + + \return This method always returns \c *this . + + \sa Prepend(const char *str, int32 length) */ /*! -\fn BString& BString::Prepend(const BString &string) -\brief Prepend the given BString to the object. -\param string The BString object to prepend. -\return This method always returns \c *this . -\sa Prepend(const BString &string, int32 len) + \fn BString& BString::Prepend(const BString &string) + \brief Prepend the given BString to the object. + + \param string The BString object to prepend. + + \return This method always returns \c *this . + + \sa Prepend(const BString &string, int32 len) */ /*! -\fn BString& BString::Prepend(const char *str, int32 length) -\brief Prepend the given string to the object. -\param str A pointer to the string to prepend. -\param length The maximum amount of bytes to get from the string. -\return This method always returns \c *this . -\sa Prepend(const char *str) + \fn BString& BString::Prepend(const char *str, int32 length) + \brief Prepend the given string to the object. + + \param str A pointer to the string to prepend. + \param length The maximum amount of bytes to get from the string. + + \return This method always returns \c *this . + + \sa Prepend(const char *str) */ /*! -\fn BString& BString::Prepend(const BString &string, int32 len) -\brief Prepend the given BString to the object. -\param string The BString object to prepend. -\param len The maximum amount of bytes to get from the BString. -\return This method always returns \c *this . -\sa Prepend(const BString &string) + \fn BString& BString::Prepend(const BString &string, int32 len) + \brief Prepend the given BString to the object. + + \param string The BString object to prepend. + \param len The maximum amount of bytes to get from the BString. + + \return This method always returns \c *this . + + \sa Prepend(const BString &string) */ /*! -\fn BString& BString::Prepend(char c, int32 count) -\brief Prepend the given character repeatedly to the object. -\param c The character to prepend. -\param count The number of times this character should be prepended. -\return This method always returns \c *this . + \fn BString& BString::Prepend(char c, int32 count) + \brief Prepend the given character repeatedly to the object. + + \param c The character to prepend. + \param count The number of times this character should be prepended. + + \return This method always returns \c *this . */ //! @} /*! -\name Inserting Methods + \name Inserting Methods */ //! @{ /*! -\fn BString& BString::Insert(const char *str, int32 pos) -\brief Insert the given string at the given position into the object's data. -\param str A pointer to the string to insert. -\param pos The offset in bytes into the BString's data where to insert the string. -\return This method always returns \c *this . -\sa Insert(const char *str, int32 length, int32 pos) -\sa Insert(const char *str, int32 fromOffset, int32 length, int32 pos) + \fn BString& BString::Insert(const char *str, int32 pos) + \brief Insert the given string at the given position into the object's + data. + + \param str A pointer to the string to insert. + \param pos The offset in bytes into the BString's data where to insert + the string. + + \return This method always returns \c *this . + + \sa Insert(const char *str, int32 length, int32 pos) + \sa Insert(const char *str, int32 fromOffset, int32 length, int32 pos) */ /*! -\fn BString& BString::Insert(const char *str, int32 length, int32 pos) -\brief Inserts the given string at the given position into the object's data. -\param str A pointer to the string to insert. -\param length The amount of bytes to insert. -\param pos The offset in bytes into the BString's data where to insert the string. -\return This method always returns \c *this . -\sa Insert(const char *str, int32 pos) -\sa Insert(const char *str, int32 fromOffset, int32 length, int32 pos) + \fn BString& BString::Insert(const char *str, int32 length, int32 pos) + \brief Inserts the given string at the given position into the object's + data. + + \param str A pointer to the string to insert. + \param length The amount of bytes to insert. + \param pos The offset in bytes into the BString's data where to insert + the string. + + \return This method always returns \c *this . + + \sa Insert(const char *str, int32 pos) + \sa Insert(const char *str, int32 fromOffset, int32 length, int32 pos) */ /*! -\fn BString& BString::Insert(const char *str, int32 fromOffset, int32 length, int32 pos) -\brief Insert the given string at the given position into the object's data. -\param str A pointer to the string to insert. -\param fromOffset The offset in the string that is to be inserted -\param length The amount of bytes to insert. -\param pos The offset in bytes into the BString's data where to insert the string. -\return This method always returns \c *this . -\sa Insert(const char *str, int32 pos) -\sa Insert(const char *str, int32 length, int32 pos) + \fn BString& BString::Insert(const char *str, int32 fromOffset, + int32 length, int32 pos) + \brief Insert the given string at the given position into the object's + data. + + \param str A pointer to the string to insert. + \param fromOffset The offset in the string that is to be inserted + \param length The amount of bytes to insert. + \param pos The offset in bytes into the BString's data where to insert + the string. + + \return This method always returns \c *this . + + \sa Insert(const char *str, int32 pos) + \sa Insert(const char *str, int32 length, int32 pos) */ /*! -\fn BString& BString::Insert(const BString &string, int32 pos) -\brief Insert the given BString at the given position into the object's data. -\param string The BString object to insert. -\param pos The offset in bytes into the BString's data where to insert the string. -\return This method always returns \c *this . -\sa Insert(const BString &string, int32 length, int32 pos) -\sa Insert(const BString &string, int32 fromOffset, int32 length, int32 pos) + \fn BString& BString::Insert(const BString &string, int32 pos) + \brief Insert the given BString at the given position into the object's + data. + \param string The BString object to insert. + \param pos The offset in bytes into the BString's data where to insert + the string. + + \return This method always returns \c *this . + + \sa Insert(const BString &string, int32 length, int32 pos) + \sa Insert(const BString &string, int32 fromOffset, int32 length, int32 pos) */ /*! -\fn BString& BString::Insert(const BString &string, int32 length, int32 pos) -\brief Insert the given BString at the given position into the object's data. -\param string The BString object to insert. -\param length The amount of bytes to insert. -\param pos The offset in bytes into the BString's data where to insert the string. -\return This method always returns \c *this . -\sa Insert(const BString &string, int32 pos) -\sa Insert(const BString &string, int32 fromOffset, int32 length, int32 pos) + \fn BString& BString::Insert(const BString &string, int32 length, int32 pos) + \brief Insert the given BString at the given position into the object's + data. + \param string The BString object to insert. + \param length The amount of bytes to insert. + \param pos The offset in bytes into the BString's data where to insert + the string. + + \return This method always returns \c *this . + + \sa Insert(const BString &string, int32 pos) + \sa Insert(const BString &string, int32 fromOffset, int32 length, int32 pos) */ /*! -\fn BString& BString::Insert(const BString &string, int32 fromOffset, int32 length, int32 pos) -\brief Insert the given string at the given position into the object's data. -\param string The BString object to insert. -\param fromOffset The offset in the string that is to be inserted -\param length The amount of bytes to insert. -\param pos The offset in bytes into the BString's data where to insert the string. -\return This method always returns \c *this . -\sa Insert(const BString &string, int32 pos) -\sa Insert(const BString &string, int32 length, int32 pos) + \fn BString& BString::Insert(const BString &string, int32 fromOffset, + int32 length, int32 pos) + \brief Insert the given string at the given position into the object's + data. + + \param string The BString object to insert. + \param fromOffset The offset in the string that is to be inserted + \param length The amount of bytes to insert. + \param pos The offset in bytes into the BString's data where to insert + the string. + + \return This method always returns \c *this . + + \sa Insert(const BString &string, int32 pos) + \sa Insert(const BString &string, int32 length, int32 pos) */ /*! -\fn BString& BString::Insert(char c, int32 count, int32 pos) -\brief Insert the given character repeatedly at the given position into the object's data. -\param c The character to insert. -\param count The number of times to insert the character. -\param pos The offset in bytes into the BString's data where to insert the string. -\return This method always returns \c *this . + \fn BString& BString::Insert(char c, int32 count, int32 pos) + \brief Insert the given character repeatedly at the given position + into the object's data. + + \param c The character to insert. + \param count The number of times to insert the character. + \param pos The offset in bytes into the BString's data where to insert + the string. + + \return This method always returns \c *this . */ //! @} /*! -\name Removing Methods + \name Removing Methods */ //! @{ /*! -\fn BString& BString::Truncate(int32 newLength, bool lazy) -\brief Truncate the string to the new length. -\param newLength The new length of the string. -\param lazy If true, the memory-optimization is postponed to later -\return This method always returns \c *this . + \fn BString& BString::Truncate(int32 newLength, bool lazy) + \brief Truncate the string to the new length. + + \param newLength The new length of the string. + \param lazy If true, the memory-optimization is postponed to later + + \return This method always returns \c *this . */ /*! -\fn BString& BString::Remove(int32 from, int32 length) -\brief Remove some bytes, starting at the given offset -\param from The offset from which you want to start removing -\param length The number of bytes to remove -\return This function always returns \c *this . + \fn BString& BString::Remove(int32 from, int32 length) + \brief Remove some bytes, starting at the given offset + + \param from The offset from which you want to start removing + \param length The number of bytes to remove + + \return This function always returns \c *this . */ /*! -\fn BString& BString::RemoveFirst(const BString &string) -\brief Remove the first occurrence of the given BString. -\param string The BString to remove. -\return This function always returns \c *this . + \fn BString& BString::RemoveFirst(const BString &string) + \brief Remove the first occurrence of the given BString. + + \param string The BString to remove. + + \return This function always returns \c *this . */ /*! -\fn BString& BString::RemoveLast(const BString &string) -\brief Remove the last occurrence of the given BString. -\param string The BString to remove. -\return This function always returns \c *this . + \fn BString& BString::RemoveLast(const BString &string) + \brief Remove the last occurrence of the given BString. + + \param string The BString to remove. + + \return This function always returns \c *this . */ /*! -\fn BString& BString::RemoveAll(const BString &string) -\brief Remove all occurrences of the given BString. -\param string The BString to remove. -\return This function always returns \c *this . + \fn BString& BString::RemoveAll(const BString &string) + \brief Remove all occurrences of the given BString. + + \param string The BString to remove. + + \return This function always returns \c *this . */ /*! -\fn BString& BString::RemoveFirst(const char *string) -\brief Remove the first occurrence of the given string. -\param string A pointer to the string to remove. -\return This function always returns \c *this . + \fn BString& BString::RemoveFirst(const char *string) + \brief Remove the first occurrence of the given string. + + \param string A pointer to the string to remove. + + \return This function always returns \c *this . */ /*! -\fn BString& BString::RemoveLast(const char *string) -\brief Remove the last occurrence of the given string. -\param string A pointer to the string to remove. -\return This function always returns \c *this . + \fn BString& BString::RemoveLast(const char *string) + \brief Remove the last occurrence of the given string. + + \param string A pointer to the string to remove. + + \return This function always returns \c *this . */ /*! -\fn BString& BString::RemoveAll(const char *str) -\brief Remove all occurrences of the given string. -\param str A pointer to the string to remove. -\return This function always returns \c *this . + \fn BString& BString::RemoveAll(const char *str) + \brief Remove all occurrences of the given string. + + \param str A pointer to the string to remove. + + \return This function always returns \c *this . */ /*! -\fn BString& BString::RemoveSet(const char *setOfCharsToRemove) -\brief Remove all the characters specified. -\param setOfCharsToRemove The set of characters to remove. -\return This function always returns \c *this . + \fn BString& BString::RemoveSet(const char *setOfCharsToRemove) + \brief Remove all the characters specified. + + \param setOfCharsToRemove The set of characters to remove. + + \return This function always returns \c *this . */ /*! -\fn BString& BString::MoveInto(BString &into, int32 from, int32 length) -\brief Move the BString data (or part of it) into another BString. -\param into The BString where to move the object. -\param from The offset (zero based) where to begin the move -\param length The amount of bytes to move. -\return This method always returns \c into . + \fn BString& BString::MoveInto(BString &into, int32 from, int32 length) + \brief Move the BString data (or part of it) into another BString. + + \param into The BString where to move the object. + \param from The offset (zero-based) where to begin the move. + \param length The amount of bytes to move. + + \return This method always returns \c into . */ /*! -\fn void BString::MoveInto(char *into, int32 from, int32 length) -\brief Move the BString data (or part of it) into the given buffer. -\param into The buffer where to move the object. -\param from The offset (zero based) where to begin the move. -\param length The amount of bytes to move. + \fn void BString::MoveInto(char *into, int32 from, int32 length) + \brief Move the BString data (or part of it) into the given buffer. + + \param into The buffer where to move the object. + \param from The offset (zero-based) where to begin the move. + \param length The amount of bytes to move. */ //! @} /*! -\name Comparison Methods + \name Comparison Methods -There are two different comparison methods. First of all there -is the whole range of operators that return a boolean value, secondly -there are methods that return an integer value, both case sensitive -and case insensitive. + There are two different comparison methods. First of all there + is the whole range of operators that return a boolean value, secondly + there are methods that return an integer value, both case sensitive + and case insensitive. -There are also global comparison operators and global compare functions. -You might need these in case you have a sort routine that takes a generic -comparison function, such as BList::SortItems(). -See the String.h documentation file to see the specifics, though basically -there are the same as implemented in this class. + There are also global comparison operators and global compare functions. + You might need these in case you have a sort routine that takes a generic + comparison function, such as BList::SortItems(). + See the String.h documentation file to see the specifics, though basically + there are the same as implemented in this class. */ //! @{ /*! -\fn bool BString::operator<(const char *string) const -\brief Lexographically compare if this string is less than a given string. + \fn bool BString::operator<(const char *string) const + \brief Lexographically compare if this string is less than a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator<(const BString &string) const -\brief Lexographically compare if this string is less than a given string. + \fn bool BString::operator<(const BString &string) const + \brief Lexographically compare if this string is less than a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator<=(const char *string) const -\brief Lexographically compare if this string is less than or equal to a given string. + \fn bool BString::operator<=(const char *string) const + \brief Lexographically compare if this string is less than or equal to + a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator<=(const BString &string) const -\brief Lexographically compare if this string is less than or equal to a given string. + \fn bool BString::operator<=(const BString &string) const + \brief Lexographically compare if this string is less than or equal to + a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator==(const char *string) const -\brief Lexographically compare if this string is equal to a given string. + \fn bool BString::operator==(const char *string) const + \brief Lexographically compare if this string is equal to a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator==(const BString &string) const -\brief Lexographically compare if this string is equal to a given string. + \fn bool BString::operator==(const BString &string) const + \brief Lexographically compare if this string is equal to a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator>=(const char *string) const -\brief Lexographically compare if this string is more than or equal to a given string. + \fn bool BString::operator>=(const char *string) const + \brief Lexographically compare if this string is more than or equal + to a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator>=(const BString &string) const -\brief Lexographically compare if this string is more than or equal to a given string. + \fn bool BString::operator>=(const BString &string) const + \brief Lexographically compare if this string is more than or equal + to a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator>(const char *string) const -\brief Lexographically compare if this string is more than a given string. + \fn bool BString::operator>(const char *string) const + \brief Lexographically compare if this string is more than a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator>(const BString &string) const -\brief Lexographically compare if this string is more than a given string. + \fn bool BString::operator>(const BString &string) const + \brief Lexographically compare if this string is more than a given string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator!=(const BString &string) const -\brief Lexographically compare if this string is not equal to a given string. + \fn bool BString::operator!=(const BString &string) const + \brief Lexographically compare if this string is not equal to a given + string. + + \param string The string to compare with. */ /*! -\fn bool BString::operator!=(const char *str) const -\brief Lexographically compare if this string is not equal to a given string. + \fn bool BString::operator!=(const char *string) const + \brief Lexographically compare if this string is not equal to a given + string. + + \param string The string to compare with. */ /*! -\fn int BString::Compare(const BString &string) const -\brief Lexographically compare this string to another. + \fn int BString::Compare(const BString &string) const + \brief Lexographically compare this string to another. -\param string The string to compare to. -\retval >0 The object sorts lexographically after \c string. -\retval =0 The object is equal to \c string. -\retval <0 The object sorts lexographically before \c string. + \param string The string to compare to. + + \retval >0 The object sorts lexographically after \c string. + \retval =0 The object is equal to \c string. + \retval <0 The object sorts lexographically before \c string. */ /*! -\fn int BString::Compare(const char *str) const -\brief Lexographically compare this string to another. + \fn int BString::Compare(const char *str) const + \brief Lexographically compare this string to another. -\sa Compare(const BString &string) const + \param str The string to compare to. + + \retval >0 The object sorts lexographically after \c string. + \retval =0 The object is equal to \c string. + \retval <0 The object sorts lexographically before \c string. + + \sa Compare(const BString &string) const */ /*! -\fn int BString::Compare(const BString &string, int32 n) const -\brief Lexographically compare a number of characters of this string to another. + \fn int BString::Compare(const BString &string, int32 n) const + \brief Lexographically compare a number of characters of a string to + another. -\param string The string to compare to. -\param n The number of characters to compare -\retval >0 The object sorts lexographically after \c string. -\retval =0 The object is equal to \c string. -\retval <0 The object sorts lexographically before \c string. + \param string The string to compare to. + \param n The number of characters to compare + + \retval >0 The object sorts lexographically after \c string. + \retval =0 The object is equal to \c string. + \retval <0 The object sorts lexographically before \c string. */ /*! -\fn int BString::Compare(const char *str, int32 n) const -\brief Lexographically compare a number of characters of this string to another. + \fn int BString::Compare(const char *string, int32 n) const + \brief Lexographically compare a number of characters of a string to + another. -\sa Compare(const BString &string, int32 n) const + \param string The string to compare to. + \param n The number of characters to compare. + + \retval >0 The object sorts lexographically after \c string. + \retval =0 The object is equal to \c string. + \retval <0 The object sorts lexographically before \c string. + + \sa Compare(const BString &string, int32 n) const */ /*! -\fn int BString::ICompare(const BString &string) const -\brief Lexographically compare this string to another in a case-insensitive way. + \fn int BString::ICompare(const BString &string) const + \brief Lexographically compare a string to another in a + case-insensitive way. -\sa Compare(const BString &string) const + \param string The string to compare to. + + \retval >0 The object sorts lexographically after \c string. + \retval =0 The object is equal to \c string. + \retval <0 The object sorts lexographically before \c string. + + \sa Compare(const BString &string) const */ /*! -\fn int BString::ICompare(const char *str) const -\brief Lexographically compare this string to another in a case-insensitive way. + \fn int BString::ICompare(const char *str) const + \brief Lexographically compare this string to another in a + case-insensitive way. -\sa Compare(const BString &string) const + \param str The string to compare to. + + \retval >0 The object sorts lexographically after \c string. + \retval =0 The object is equal to \c string. + \retval <0 The object sorts lexographically before \c string. + + \sa Compare(const BString &string) const */ /*! -\fn int BString::ICompare(const BString &string, int32 n) const -\brief Lexographically compare a number of characters of this string to another. + \fn int BString::ICompare(const BString &string, int32 n) const + \brief Lexographically compare a number of characters of this string + to another. -\sa Compare(const BString &string, int32 n) const + \param string The string to compare to. + \param n The number of characters to compare + + \retval >0 The object sorts lexographically after \c string. + \retval =0 The object is equal to \c string. + \retval <0 The object sorts lexographically before \c string. + + \sa Compare(const BString &string, int32 n) const */ /*! -\fn int BString::ICompare(const char *str, int32 n) const -\brief Lexographically compare a number of characters of this string to another. + \fn int BString::ICompare(const char *str, int32 n) const + \brief Lexographically compare a number of characters of this string + to another. -\sa Compare(const BString &string, int32 n) const + \param str The string to compare to. + \param n The number of characters to compare + + \retval >0 The object sorts lexographically after \c string. + \retval =0 The object is equal to \c string. + \retval <0 The object sorts lexographically before \c string. + + \sa Compare(const BString &string, int32 n) const */ //! @} /*! -\name Searching Methods + \name Searching Methods */ //! @{ /*! -\fn int32 BString::FindFirst(const BString &string) const -\brief Find the first occurrence of the given BString. -\param string The BString to search for. -\return The offset(zero based) into the data - where the given BString has been found. -\retval B_ERROR Could not find \c string. -\sa IFindFirst(const BString &string) const + \fn int32 BString::FindFirst(const BString &string) const + \brief Find the first occurrence of the given BString. + + \param string The BString to search for. + + \return The offset (zero-based) into the data where the given BString + has been found. + + \retval B_ERROR Could not find \c string. + + \sa IFindFirst(const BString &string) const */ /*! -\fn int32 BString::FindFirst(const char *str) const -\brief Find the first occurrence of the given string. -\param str The string to search for. -\return The offset(zero based) into the data - where the given string has been found. -\retval B_BAD_VALUE The \c str pointer is invalid. -\retval B_ERROR Could not find \c str. -\sa IFindFirst(const char *str) const + \fn int32 BString::FindFirst(const char *str) const + \brief Find the first occurrence of the given string. + + \param str The string to search for. + + \return The offset (zero-based) into the data where the given string + has been found. + + \retval B_BAD_VALUE The \c str pointer is invalid. + \retval B_ERROR Could not find \c str. + + \sa IFindFirst(const char *str) const */ /*! -\fn int32 BString::FindFirst(const BString &string, int32 fromOffset) const -\brief Find the first occurrence of the given BString, - starting from the given offset. -\param string The BString to search for. -\param fromOffset The offset where to start the search. -\return An integer which is the offset(zero based) into the data - where the given BString has been found. -\retval B_ERROR Could not find \c string. -\sa IFindFirst(const BString &string, int32 fromOffset) const + \fn int32 BString::FindFirst(const BString &string, int32 fromOffset) const + \brief Find the first occurrence of the given BString, starting from + the given offset. + + \param string The BString to search for. + \param fromOffset The offset where to start the search. + + \return An integer which is the offset (zero-based) into the data + where the given BString has been found. + + \retval B_ERROR Could not find \c string. + + \sa IFindFirst(const BString &string, int32 fromOffset) const */ /*! -\fn int32 BString::FindFirst(const char *str, int32 fromOffset) const -\brief Find the first occurrence of the given string, - starting from the given offset. -\param str The string to search for. -\param fromOffset The offset where to start the search. -\return The offset(zero based) into the data - where the given string has been found. -\retval B_BAD_VALUE The \c str pointer is invalid. -\retval B_ERROR Could not find \c str. -\sa IFindFirst(const char *str, int32 fromOffset) const + \fn int32 BString::FindFirst(const char *str, int32 fromOffset) const + \brief Find the first occurrence of the given string, + starting from the given offset. + + \param str The string to search for. + \param fromOffset The offset where to start the search. + + \return The offset (zero-based) into the data where the given string + has been found. + + \retval B_BAD_VALUE The \c str pointer is invalid. + \retval B_ERROR Could not find \c str. + + \sa IFindFirst(const char *str, int32 fromOffset) const */ /*! -\fn int32 BString::FindFirst(char c) const -\brief Find the first occurrence of the given character. -\param c The character to search for. -\return The offset(zero based) into the data - where the given character has been found. -\retval B_ERROR Could not find \c c. + \fn int32 BString::FindFirst(char c) const + \brief Find the first occurrence of the given character. + + \param c The character to search for. + + \return The offset (zero-based) into the data + where the given character has been found. + + \retval B_ERROR Could not find \c c. */ /*! -\fn int32 BString::FindFirst(char c, int32 fromOffset) const -\brief Find the first occurrence of the given character, - starting from the given offset. -\param c The character to search for. -\param fromOffset The offset where to start the search. -\return The offset(zero based) into the data - where the given character has been found. -\retval B_ERROR Could not find \c c. + \fn int32 BString::FindFirst(char c, int32 fromOffset) const + \brief Find the first occurrence of the given character, + starting from the given offset. + + \param c The character to search for. + \param fromOffset The offset where to start the search. + + \return The offset (zero-based) into the data + where the given character has been found. + + \retval B_ERROR Could not find \c c. */ /*! -\fn int32 BString::FindLast(const BString &string) const -\brief Find the last occurrence of the given BString. -\param string The BString to search for. -\return The offset(zero based) into the data - where the given BString has been found. -\retval B_ERROR Could not find \c string. -\sa IFindLast(const BString &string) const + \fn int32 BString::FindLast(const BString &string) const + \brief Find the last occurrence of the given BString. + + \param string The BString to search for. + + \return The offset (zero-based) into the data where the given BString + has been found. + + \retval B_ERROR Could not find \c string. + \sa IFindLast(const BString &string) const */ /*! -\fn int32 BString::FindLast(const char *str) const -\brief Find the last occurrence of the given string. -\param str The string to search for. -\return The offset(zero based) into the data - where the given string has been found. -\retval B_BAD_VALUE The \c str pointer is invalid. -\retval B_ERROR Could not find \c str. -\sa IFindLast(const char *str) const + \fn int32 BString::FindLast(const char *str) const + \brief Find the last occurrence of the given string. + + \param str The string to search for. + + \return The offset (zero-based) into the data where the given string + has been found. + + \retval B_BAD_VALUE The \c str pointer is invalid. + \retval B_ERROR Could not find \c str. + + \sa IFindLast(const char *str) const +/*! /*! -\fn int32 BString::FindLast(const BString &string, int32 beforeOffset) const -\brief Find the last occurrence of the given BString, - starting from the given offset, and going backwards. -\param string The BString to search for. -\param beforeOffset The offset where to start the search. -\return An integer which is the offset(zero based) into the data - where the given BString has been found. -\retval B_ERROR Could not find \c string. -\sa IFindLast(const BString &string, int32 beforeOffset) const + \fn int32 BString::FindLast(const BString &string, int32 beforeOffset) const + \brief Find the last occurrence of the given BString, + starting from the given offset, and going backwards. + + \param string The BString to search for. + \param beforeOffset The offset where to start the search. + + \return An integer which is the offset (zero-based) into the data + where the given BString has been found. + + \retval B_ERROR Could not find \c string. + + \sa IFindLast(const BString &string, int32 beforeOffset) const */ /*! -\fn int32 BString::FindLast(const char *str, int32 beforeOffset) const -\brief Find the last occurrence of the given string, - starting from the given offset, and going backwards. -\param str The string to search for. -\param beforeOffset The offset where to start the search. -\return The offset(zero based) into the data - where the given string has been found. -\retval B_BAD_VALUE The \c str pointer is invalid. -\retval B_ERROR Could not find \c str. -\sa IFindLast(const char *str, int32 beforeOffset) const + \fn int32 BString::FindLast(const char *str, int32 beforeOffset) const + \brief Find the last occurrence of the given string, + starting from the given offset, and going backwards. + + \param str The string to search for. + \param beforeOffset The offset where to start the search. + + \return The offset (zero-based) into the data + where the given string has been found. + + \retval B_BAD_VALUE The \c str pointer is invalid. + \retval B_ERROR Could not find \c str. + + \sa IFindLast(const char *str, int32 beforeOffset) const */ /*! -\fn int32 BString::FindLast(char c) const -\brief Find the last occurrence of the given character. -\param c The character to search for. -\return The offset(zero based) into the data - where the given character has been found. -\retval B_ERROR Could not find \c c. + \fn int32 BString::FindLast(char c) const + \brief Find the last occurrence of the given character. + + \param c The character to search for. + \return The offset (zero-based) into the data where the given character + has been found. + + \retval B_ERROR Could not find \c c. */ /*! -\fn int32 BString::FindLast(char c, int32 beforeOffset) const -\brief Find the last occurrence of the given character, - starting from the given offset and going backwards. -\param c The character to search for. -\param beforeOffset The offset where to start the search. -\return The offset(zero based) into the data - where the given character has been found. -\retval B_ERROR Could not find \c c. + \fn int32 BString::FindLast(char c, int32 beforeOffset) const + \brief Find the last occurrence of the given character, + starting from the given offset and going backwards. + + \param c The character to search for. + \param beforeOffset The offset where to start the search. + + \return The offset (zero-based) into the data where the given character + has been found. + + \retval B_ERROR Could not find \c c. */ /*! -\fn int32 BString::IFindFirst(const BString &string) const -\brief Find the first occurrence of the given BString case-insensitively. + \fn int32 BString::IFindFirst(const BString &string) const + \brief Find the first occurrence of the given BString case-insensitively. -\sa FindFirst(const BString &string) const + \sa FindFirst(const BString &string) const */ /*! -\fn int32 BString::IFindFirst(const char *str) const -\brief Find the first occurrence of the given BString case-insensitively. + \fn int32 BString::IFindFirst(const char *str) const + \brief Find the first occurrence of the given BString case-insensitively. -\sa FindFirst(const char *str) const + \sa FindFirst(const char *str) const */ /*! -\fn int32 BString::IFindFirst(const BString &string, int32 fromOffset) const -\brief Find the first occurrence of the given BString case-insensitively, - starting from the given offset. + \fn int32 BString::IFindFirst(const BString &string, int32 fromOffset) const + \brief Find the first occurrence of the given BString case-insensitively, + starting from the given offset. -\sa FindFirst(const BString &string, int32 fromOffset) const + \sa FindFirst(const BString &string, int32 fromOffset) const */ /*! -\fn int32 BString::IFindFirst(const char *str, int32 fromOffset) const -\brief Find the first occurrence of the given string case-insensitively, - starting from the given offset. + \fn int32 BString::IFindFirst(const char *str, int32 fromOffset) const + \brief Find the first occurrence of the given string case-insensitively, + starting from the given offset. -\sa FindFirst(const char *str, int32 fromOffset) const + \sa FindFirst(const char *str, int32 fromOffset) const */ /*! -\fn int32 BString::IFindLast(const BString &string) const -\brief Find the last occurrence of the given BString case-insensitively. + \fn int32 BString::IFindLast(const BString &string) const + \brief Find the last occurrence of the given BString case-insensitively. -\sa FindLast(const BString &string) const + \sa FindLast(const BString &string) const */ /*! -\fn int32 BString::IFindLast(const char *str) const -\brief Find the last occurrence of the given string case-insensitively. - -\sa FindLast(const char *str) const + \fn int32 BString::IFindLast(const char *str) const + \brief Find the last occurrence of the given string case-insensitively. + + \sa FindLast(const char *str) const */ /*! -\fn int32 BString::IFindLast(const BString &string, int32 beforeOffset) const -\brief Find the last occurrence of the given BString case-insensitively, - starting from the given offset, and going backwards. + \fn int32 BString::IFindLast(const BString &string, int32 beforeOffset) const + \brief Find the last occurrence of the given BString case-insensitively, + starting from the given offset, and going backwards. -\sa FindLast(const BString &string, int32 beforeOffset) const + \sa FindLast(const BString &string, int32 beforeOffset) const */ /*! -\fn int32 BString::IFindLast(const char *str, int32 beforeOffset) const -\brief Find the last occurrence of the given string case-insensitively, - starting from the given offset, and going backwards. + \fn int32 BString::IFindLast(const char *str, int32 beforeOffset) const + \brief Find the last occurrence of the given string case-insensitively, + starting from the given offset, and going backwards. -\sa FindLast(const char *str, int32 beforeOffset) const + \sa FindLast(const char *str, int32 beforeOffset) const */ //! @} /*! -\name Replacing Methods + \name Replacing Methods */ //! @{ /*! -\fn BString& BString::ReplaceFirst(char replaceThis, char withThis) -\brief Replace the first occurrence of a character with another character. -\param replaceThis The character to replace. -\param withThis The character to put in that place -\return This method always returns \c *this. -\sa IReplaceFirst(char replaceThis, char withThis) + \fn BString& BString::ReplaceFirst(char replaceThis, char withThis) + \brief Replace the first occurrence of a character with another character. + + \param replaceThis The character to replace. + \param withThis The character to put in that place + + \return This method always returns \c *this. + + \sa IReplaceFirst(char replaceThis, char withThis) */ /*! -\fn BString& BString::ReplaceLast(char replaceThis, char withThis) -\brief Replace the last occurrence of a character with another character. -\param replaceThis The character to replace. -\param withThis The character to put in that place -\return This method always returns \c *this. -\sa ReplaceLast(char replaceThis, char withThis) + \fn BString& BString::ReplaceLast(char replaceThis, char withThis) + \brief Replace the last occurrence of a character with another character. + + \param replaceThis The character to replace. + \param withThis The character to put in that place + + \return This method always returns \c *this. + + \sa ReplaceLast(char replaceThis, char withThis) */ /*! -\fn BString& BString::ReplaceAll(char replaceThis, char withThis, int32 fromOffset) -\brief Replace all occurrences of a character with another character. -\param replaceThis The character to replace. -\param withThis The character to put in that place -\param fromOffset The offset where to start looking for the character -\return This method always returns \c *this. -\sa IReplaceAll(char replaceThis, char withThis, int32 fromOffset) + \fn BString& BString::ReplaceAll(char replaceThis, char withThis, + int32 fromOffset) + \brief Replace all occurrences of a character with another character. + + \param replaceThis The character to replace. + \param withThis The character to put in that place + \param fromOffset The offset where to start looking for the character. + + \return This method always returns \c *this. + + \sa IReplaceAll(char replaceThis, char withThis, int32 fromOffset) */ /*! -\fn BString& BString::Replace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset) -\brief Replace a number of occurrences of a character with another character. -\param replaceThis The character to replace. -\param withThis The character to put in that place -\param maxReplaceCount The maximum number of characters that should be replaced. -\param fromOffset The offset where to start looking for the character -\return This method always returns \c *this. -\sa IReplace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset) + \fn BString& BString::Replace(char replaceThis, char withThis, + int32 maxReplaceCount, int32 fromOffset) + \brief Replace a number of occurrences of a character with another + character. + + \param replaceThis The character to replace. + \param withThis The character to put in that place + \param maxReplaceCount The maximum number of characters that should be + replaced. + \param fromOffset The offset where to start looking for the character + + \return This method always returns \c *this. + + \sa IReplace(char replaceThis, char withThis, int32 maxReplaceCount, + int32 fromOffset) */ /*! -\fn BString& BString::ReplaceFirst(const char *replaceThis, const char *withThis) -\brief Replace the first occurrence of a string with another string. -\param replaceThis The C-string to replace. -\param withThis The C-string to put in that place -\return This method always returns \c *this. -\sa IReplaceFirst(const char *replaceThis, const char *withThis) + \fn BString& BString::ReplaceFirst(const char *replaceThis, + const char *withThis) + \brief Replace the first occurrence of a string with another string. + + \param replaceThis The string to replace. + \param withThis The string to put in that place + + \return This method always returns \c *this. + + \sa IReplaceFirst(const char *replaceThis, const char *withThis) */ /*! -\fn BString& BString::ReplaceLast(const char *replaceThis, const char *withThis) -\brief Replace the last occurrence of a string with another string. -\param replaceThis The C-string to replace. -\param withThis The C-string to put in that place -\return This method always returns \c *this. -\sa IReplaceLast(const char *replaceThis, const char *withThis) + \fn BString& BString::ReplaceLast(const char *replaceThis, + const char *withThis) + \brief Replace the last occurrence of a string with another string. + + \param replaceThis The string to replace. + \param withThis The string to put in that place + + \return This method always returns \c *this. + + \sa IReplaceLast(const char *replaceThis, const char *withThis) */ /*! -\fn BString& BString::ReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset) -\brief Replace all occurrences of a string with another string. -\param replaceThis The string to replace. -\param withThis The string to put in that place -\param fromOffset The offset where to start looking for the string. -\return This method always returns \c *this. -\sa IReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset) + \fn BString& BString::ReplaceAll(const char *replaceThis, + const char *withThis, int32 fromOffset) + \brief Replace all occurrences of a string with another string. + + \param replaceThis The string to replace. + \param withThis The string to put in that place + \param fromOffset The offset where to start looking for the string. + + \return This method always returns \c *this. + + \sa IReplaceAll(const char *replaceThis, const char *withThis, + int32 fromOffset) */ /*! -\fn BString& BString::Replace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset) -\brief Replace a number of occurrences of a string with another string. -\param replaceThis The string to replace. -\param withThis The string to put in that place -\param maxReplaceCount The maximum number of occurences that should be replaced. -\param fromOffset The offset where to start looking for the string -\return This method always returns \c *this. -\sa IReplace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset) + \fn BString& BString::Replace(const char *replaceThis, + const char *withThis, int32 maxReplaceCount, int32 fromOffset) + \brief Replace a number of occurrences of a string with another string. + + \param replaceThis The string to replace. + \param withThis The string to put in that place + \param maxReplaceCount The maximum number of occurences that should + be replaced. + \param fromOffset The offset where to start looking for the string + + \return This method always returns \c *this. + + \sa IReplace(const char *replaceThis, const char *withThis, + int32 maxReplaceCount, int32 fromOffset) */ /*! -\fn BString& BString::IReplaceFirst(char replaceThis, char withThis) -\brief Replace the first occurrence of a character with another character. Case insensitive. -\sa ReplaceFirst(char replaceThis, char withThis) + \fn BString& BString::IReplaceFirst(char replaceThis, char withThis) + \brief Replace the first occurrence of a character with another + character. Case insensitive. + + \param replaceThis The string to replace. + \param withThis The string to put in that place + + \sa ReplaceFirst(char replaceThis, char withThis) */ /*! -\fn BString& BString::IReplaceLast(char replaceThis, char withThis) -\brief Replace the last occurrence of a character with another character. Case-insensitive. + \fn BString& BString::IReplaceLast(char replaceThis, char withThis) + \brief Replace the last occurrence of a character with another + character. Case-insensitive. -\sa ReplaceLast(char replaceThis, char withThis) + \param replaceThis The string to replace. + \param withThis The string to put in that place + + \sa ReplaceLast(char replaceThis, char withThis) */ /*! -\fn BString& BString::IReplaceAll(char replaceThis, char withThis, int32 fromOffset) -\brief Replace all occurrences of a character with another character. Case-insensitive. + \fn BString& BString::IReplaceAll(char replaceThis, char withThis, + int32 fromOffset) + \brief Replace all occurrences of a character with another character. + Case-insensitive. -\sa ReplaceAll(char replaceThis, char withThis, int32 fromOffset) + \param replaceThis The string to replace. + \param withThis The string to put in that place + \param fromOffset The offset where to start looking for the string + + \sa ReplaceAll(char replaceThis, char withThis, int32 fromOffset) */ /*! -\fn BString& BString::IReplace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset) -\brief Replace a number of occurrences of a character with another character. Case-insensive. + \fn BString& BString::IReplace(char replaceThis, char withThis, + int32 maxReplaceCount, int32 fromOffset) + \brief Replace a number of occurrences of a character with another + character. Case-insensive. -\sa Replace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset) + \param replaceThis The char to replace. + \param withThis The char to put in that place + \param maxReplaceCount The maximum number of occurences that should + be replaced. + \param fromOffset The offset where to start looking for the string + + \sa Replace(char replaceThis, char withThis, int32 maxReplaceCount, + int32 fromOffset) */ /*! -\fn BString& BString::IReplaceFirst(const char *replaceThis, const char *withThis) -\brief Replace the first occurrence of a string with another string. Case-insensitive. + \fn BString& BString::IReplace(const char *replaceThis, + const char *withThis, int32 maxReplaceCount, int32 fromOffset) + \brief Replace a number of occurrences of a string with another string. + Case-insensitive. -\sa ReplaceFirst(const char *replaceThis, const char *withThis) + \param replaceThis The string to replace. + \param withThis The string to put in that place + \param maxReplaceCount The maximum number of occurences that should + be replaced. + \param fromOffset The offset where to start looking for the string + + \sa Replace(const char *replaceThis, const char *withThis, + int32 maxReplaceCount, int32 fromOffset) */ /*! -\fn BString& BString::IReplaceLast(const char *replaceThis, const char *withThis) -\brief Replace the last occurrence of a string with another string. Case-insensitive. + \fn BString& BString::IReplaceFirst(const char *replaceThis, + const char *withThis) + \brief Replace the first occurrence of a string with another string. + Case-insensitive. -\sa ReplaceLast(const char *replaceThis, const char *withThis) + \param replaceThis The string to replace. + \param withThis The string to put in that place + + \sa ReplaceFirst(const char *replaceThis, const char *withThis) */ /*! -\fn BString& BString::IReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset) -\brief Replace all occurrences of a string with another string. Case-insensitive. + \fn BString& BString::IReplaceLast(const char *replaceThis, + const char *withThis) + \brief Replace the last occurrence of a string with another string. Case-insensitive. -\sa ReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset) + \param replaceThis The string to replace. + \param withThis The string to put in that place + + \sa ReplaceLast(const char *replaceThis, const char *withThis) */ /*! -\fn BString& BString::IReplace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset) -\brief Replace a number of occurrences of a string with another string. Case-insensitive. + \fn BString& BString::IReplaceAll(const char *replaceThis, + const char *withThis, int32 fromOffset) + \brief Replace all occurrences of a string with another string. + Case-insensitive. -\sa Replace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset) + \param replaceThis The string to replace. + \param withThis The string to put in that place + \param fromOffset The offset where to start looking for the string + + \sa ReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset) */ /*! -\fn BString& BString::ReplaceSet(const char *setOfChars, char with) -\brief Replaces characters that are in a certain set with a chosen character. -\param setOfChars The set of characters that need to be replaced. -\param with The character to replace the occurences with. -\return This method always returns \c *this. + \fn BString& BString::ReplaceSet(const char *setOfChars, char with) + \brief Replaces characters that are in a certain set with a chosen + character. + + \param setOfChars The set of characters that need to be replaced. + \param with The character to replace the occurences with. + + \return This method always returns \c *this. */ /*! -\fn BString& BString::ReplaceSet(const char *setOfChars, const char *with) -\brief Replaces characters that are in a certain set with a chosen string. -\param setOfChars The set of characters that need to be replaced. -\param with The string to replace the occurences with. -\return This method always returns \c *this. + \fn BString& BString::ReplaceSet(const char *setOfChars, const char *with) + \brief Replaces characters that are in a certain set with a chosen string. + + \param setOfChars The set of characters that need to be replaced. + \param with The string to replace the occurences with. + + \return This method always returns \c *this. */ // @} /*! -\name Character Access + \name Character Access */ //! @{ /*! -\fn char & BString::operator[](int32 index) -\brief Return a reference to the data at the given offset. + \fn char & BString::operator[](int32 index) + \brief Return a reference to the data at the given offset. -This function can be used to read a byte. -There is no bounds checking though, so make sure the \c index -you supply is valid. -\param index The index (zero based) of the byte to get. -\return Returns a reference to the specified byte. -\sa ByteAt(int32 index) for a safer version. + This function can be used to read a byte. + There is no bounds checking though, so make sure the \c index + you supply is valid. + + \param index The index (zero-based) of the byte to get. + + \return Returns a reference to the specified byte. + + \sa ByteAt(int32 index) for a safer version. */ /*! -\fn char BString::operator[](int32 index) const -\brief Returns the character in the string at the given offset. + \fn char BString::operator[](int32 index) const + \brief Returns the character in the string at the given offset. -This function can be used to read a byte. There is no bound checking -though, use ByteAt() if you don't know if the \c index parameter is -valid. -\param index The index (zero based) of the byte to get. -\return Returns a reference to the specified byte. + This function can be used to read a byte. There is no bound checking + though, use ByteAt() if you don't know if the \c index parameter is + valid. + + \param index The index (zero-based) of the byte to get. + + \return Returns a reference to the specified byte. */ /*! -\fn char BString::ByteAt(int32 index) const -\brief Returns the character in the string at the given offset. + \fn char BString::ByteAt(int32 index) const + \brief Returns the character in the string at the given offset. -This function can be used to read a byte. -\param index The index (zero based) of the byte to get. -\return Returns a reference to the specified byte. If you are out of bounds, - it will return 0. + This function can be used to read a single byte. + + \param index The index (zero-based) of the byte to get. + + \return Returns a reference to the specified byte. If you are out of + bounds, it will return 0. */ //! @} /*! -\name Low-Level Manipulation + \name Low-Level Manipulation */ //! @{ /*! -\fn char* BString::LockBuffer(int32 maxLength) -\brief Locks the buffer and return the internal C-string for manipulation. + \fn char* BString::LockBuffer(int32 maxLength) + \brief Locks the buffer and return the internal string for manipulation. -If you want to do any lowlevel string manipulation on the internal buffer, -you should call this method. This method includes the possibility to grow the -buffer so that you don't have to worry about that yourself. + If you want to do any lowlevel string manipulation on the internal buffer, + you should call this method. This method includes the possibility to grow + the buffer so that you don't have to worry about that yourself. -Make sure you call UnlockBuffer() when you're done with the manipulation. + Make sure you call UnlockBuffer() when you're done with the manipulation. -\param maxLength The size of the buffer. If you don't want a bigger buffer, passing - anything under the length of the string will simply return it as is. -\return A pointer to the buffer you may manipulate. -\sa UnlockBuffer() + \param maxLength The size of the buffer. If you don't want a biggerx + buffer, passing anything under the length of the string will simply + return it as is. + + \return A pointer to the buffer you may manipulate. + + \sa UnlockBuffer() */ /*! -\fn BString& BString::UnlockBuffer(int32 length) -\brief Unlocks the buffer after you are done with lowlevel manipulation. + \fn BString& BString::UnlockBuffer(int32 length) + \brief Unlocks the buffer after you are done with lowlevel manipulation. -\param length The length to trim the string to in order to keep the internal - buffer sane. If you don't pass a value in it, a \c strlen call will be used to - determine the length. -\return This method always returns \c *this. + \param length The length to trim the string to in order to keep the + internal buffer sane. If you don't pass a value in it, a \c strlen + call will be used to determine the length. + + \return This method always returns \c *this. */ //! @} /*! -\name Case Manipulation + \name Case Manipulation */ //! @{ /*! -\fn BString& BString::ToLower() -\brief Convert the BString to lowercase. -\return This method always returns \c *this . + \fn BString& BString::ToLower() + \brief Convert the BString to lowercase. + \return This method always returns \c *this . */ /*! -\fn BString& BString::ToUpper() -\brief Convert the BString to uppercase. -\return This method always returns \c *this . + \fn BString& BString::ToUpper() + \brief Convert the BString to uppercase. + \return This method always returns \c *this . */ /*! -\fn BString& BString::Capitalize() -\brief Convert the first character to uppercase, rest to lowercase -\return This method always returns \c *this . + \fn BString& BString::Capitalize() + \brief Convert the first character to uppercase, rest to lowercase + \return This method always returns \c *this . */ /*! -\fn BString& BString::CapitalizeEachWord() -\brief Convert the first character of every word to uppercase, rest to lowercase. + \fn BString& BString::CapitalizeEachWord() + \brief Convert the first character of every word to uppercase, rest + to lowercase. -Converts the first character of every "word" (series of alphabetical characters -separated by non alphabetical characters) to uppercase, and the rest to lowercase. -\return This method always returns \c *this . + Converts the first character of every "word" (series of alphabetical + characters separated by non alphabetical characters) to uppercase, and + the rest to lowercase. + + \return This method always returns \c *this . */ //! @} /*! -\name Escaping and Deescaping Methods + \name Escaping and Deescaping Methods -This class contains some methods to help you with escaping and de-escaping -certain characters. Note that this is the C-style of escaping, where you place a character -before the character that is to be escaped, and not HTML style escaping, -where certain characters are replaced by something else. + This class contains some methods to help you with escaping and + de-escaping certain characters. Note that this is the C-style of + escaping, where you place a character before the character that is + to be escaped, and not HTML style escaping, where certain characters + are replaced by something else. */ //! @{ /*! -\fn BString& BString::CharacterEscape(const char *original, const char *setOfCharsToEscape, char escapeWith) -\brief Escape selected characters on a given string. + \fn BString& BString::CharacterEscape(const char *original, + const char *setOfCharsToEscape, char escapeWith) + \brief Escape selected characters on a given string. -This version sets itself to the string supplied in the \c original paramater, and -then escapes the selected characters with a supplied character. + This version sets itself to the string supplied in the \c original + paramater, and then escapes the selected characters with a supplied + character. -\param original The string to be escaped. -\param setOfCharsToEscape The set of characters that need to be escaped. -\param escapeWith The character to escape with. -\return This method always returns \c *this. -\sa CharacterDeescape(char escapeChar) -\sa CharacterDeescape(const char *original, char escapeChar) + \param original The string to be escaped. + \param setOfCharsToEscape The set of characters that need to be escaped. + \param escapeWith The character to escape with. + + \return This method always returns \c *this. + + \sa CharacterDeescape(char escapeChar) + \sa CharacterDeescape(const char *original, char escapeChar) */ /*! -\fn BString& BString::CharacterEscape(const char *setOfCharsToEscape, char escapeWith) -\brief Escape selected characters of this string. -\param setOfCharsToEscape The set of characters that need to be escaped. -\param escapeWith The character to escape with. -\return This method always returns \c *this. -\sa CharacterDeescape(char escapeChar) + \fn BString& BString::CharacterEscape(const char *setOfCharsToEscape, + char escapeWith) + \brief Escape selected characters of this string. + + \param setOfCharsToEscape The set of characters that need to be escaped. + \param escapeWith The character to escape with. + + \return This method always returns \c *this. + + \sa CharacterDeescape(char escapeChar) */ /*! -\fn BString& BString::CharacterDeescape(const char *original, char escapeChar) -\brief Remove the character to escape with from a given string. + \fn BString& BString::CharacterDeescape(const char *original, + char escapeChar) + \brief Remove the character to escape with from a given string. -This version sets itself to the string supplied in the \c original parameter, and -then removes the escape characters. + This version sets itself to the string supplied in the \c original + parameter, and then removes the escape characters. -\param original The string to be escaped. -\param escapeChar The character that was used to escape with. -\return This method always returns \c *this. -\sa CharacterEscape(const char *original, const char *setOfCharsToEscape, char escapeWith) + \param original The string to be escaped. + \param escapeChar The character that was used to escape with. + + \return This method always returns \c *this. + + \sa CharacterEscape(const char *original, const char *setOfCharsToEscape, + char escapeWith) */ /*! -\fn BString& BString::CharacterDeescape(char escapeChar) -\brief Remove the character to escape with from this string. -\param escapeChar The character that was used to escape with. -\return This method always returns \c *this. -\sa CharacterEscape(const char *setOfCharsToEscape, char escapeWith) + \fn BString& BString::CharacterDeescape(char escapeChar) + \brief Remove the character to escape with from this string. + + \param escapeChar The character that was used to escape with. + + \return This method always returns \c *this. + + \sa CharacterEscape(const char *setOfCharsToEscape, char escapeWith) */ //! @} -/*! -\name Simple sprintf Replacement Methods +/*! + \name Simple sprintf Replacement Methods -These methods may be slower than sprintf(), but they are overflow safe. + These methods may be slower than sprintf(), but they are overflow safe. */ //! @{ /*! -\fn BString& BString::operator<<(const char *str) -\brief Append the string \c str to the object. + \fn BString& BString::operator<<(const char *str) + \brief Append the string \a str. */ /*! -\fn BString& BString::operator<<(const BString &string) -\brief Append the string \c string to the object. + \fn BString& BString::operator<<(const BString &string) + \brief Append the BString \a string. */ /*! -\fn BString& BString::operator<<(char c) -\brief Append the character \c c to the object. + \fn BString& BString::operator<<(char c) + \brief Append the \c char \a c. */ /*! -\fn BString& BString::operator<<(int i) -\brief Convert the integer \c i to a string and append it to the object. + \fn BString& BString::operator<<(int i) + \brief Convert the \c int \a i to a string and append it. */ /*! -\fn BString& BString::operator<<(unsigned int i) -\brief Convert the unsigned integer \c i to a string and append it to the object. + \fn BString& BString::operator<<(unsigned int i) + \brief Convert the \c unsigned \c int \a i to a string and append it. */ /*! -\fn BString& BString::operator<<(uint32 i) -\brief Convert the unsigned integer \c i to a string and append it to the object. + \fn BString& BString::operator<<(unsigned long i) + \brief Convert the \c unsigned \c long \a i to a string and append it. */ /*! -\fn BString& BString::operator<<(int32 i) -\brief Convert the integer \c i to a string and append it to the object. + \fn BString& BString::operator<<(long i) + \brief Convert the \c long \a i to a string and append it. */ /*! -\fn BString& BString::operator<<(uint64 i) -\brief Convert the unsigned integer \c i to a string and append it to the object. + \fn BString& BString::operator<<(unsigned long long i) + \brief Convert the \c unsigned \c long \c long \a i to a string and + append it. */ /*! -\fn BString& BString::operator<<(int64 i) -\brief Convert the integer \c i to a string and append it to the object. + \fn BString& BString::operator<<(long long i) + \brief Convert the \c long \c long \a i to a string and append it. */ /*! -\fn BString& BString::operator<<(float f) -\brief Convert the float \c f to a string and append it to the object. + \fn BString& BString::operator<<(float f) + \brief Convert the \c float \a f to a string and append it. */ //! @} -/************************ end of class BString, start of general operators ************/ + +/************* end of class BString, start of general operators ************/ /*! -\addtogroup support_globals -@{ + \addtogroup support_globals */ +//! @{ /*! -\fn bool operator<(const char *a, const BString &b) -\brief Lexographically compare if \c a is less than a given BString. + \fn bool operator<(const char *a, const BString &b) + \brief Lexographically compare if \c a is less than a given BString. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::operator<(const char *string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::operator<(const char *string) const */ /*! -\fn bool operator<=(const char *a, const BString &b) -\brief Lexographically compare if \c a is less than or equal to a given BString. + \fn bool operator<=(const char *a, const BString &b) + \brief Lexographically compare if \c a is less than or equal to a + given BString. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::operator<=(const char *string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::operator<=(const char *string) const */ /*! -\fn bool operator==(const char *a, const BString &b) -\brief Lexographically compare if \c a is equal to a given BString. + \fn bool operator==(const char *a, const BString &b) + \brief Lexographically compare if \c a is equal to a given BString. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::operator==(const char *string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::operator==(const char *string) const */ /*! -\fn bool operator>(const char *a, const BString &b) -\brief Lexographically compare if \c a is more than a given BString. + \fn bool operator>(const char *a, const BString &b) + \brief Lexographically compare if \c a is more than a given BString. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::operator>(const char *string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::operator>(const char *string) const */ /*! -\fn bool operator>=(const char *a, const BString &b) -\brief Lexographically compare if \c a is more than or equal to a given BString. + \fn bool operator>=(const char *a, const BString &b) + \brief Lexographically compare if \c a is more than or equal to a + given BString. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::operator>=(const char *string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::operator>=(const char *string) const */ /*! -\fn bool operator!=(const char *a, const BString &b) -\brief Lexographically compare if \c a is not equal to given BString. + \fn bool operator!=(const char *a, const BString &b) + \brief Lexographically compare if \c a is not equal to given BString. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::operator!=(const char *string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::operator!=(const char *string) const */ /*! -\fn int Compare(const BString &, const BString &) -\brief Lexographically compare two strings. + \fn int Compare(const BString &a, const BString &b) + \brief Lexographically compare two strings. -This function is useful if you need a global compare function to feed to -BList::SortItems() for example. + This function is useful if you need a global compare function to feed to + BList::SortItems() for example. -From String.h and in libbe.so. + \param a The first string to compare. + \param b The second string to compare. -\sa BString::Compare(const BString &string) const + From String.h and in libbe.so. + + \sa BString::Compare(const BString &string) const */ /*! -\fn int ICompare(const BString &, const BString &) -\brief Lexographically compare two strings in a case insensitive way. + \fn int ICompare(const BString &a, const BString &b) + \brief Lexographically compare two strings in a case insensitive way. -This function is useful if you need a global compare function to feed to -BList::SortItems() for example. + This function is useful if you need a global compare function to feed to + BList::SortItems() for example. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::Compare(const BString &string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::Compare(const BString &string) const */ /*! -\fn int Compare(const BString *, const BString *) -\brief Lexographically compare two strings. + \fn int Compare(const BString *a, const BString *b) + \brief Lexographically compare two strings. -This function is useful if you need a global compare function to feed to -BList::SortItems() for example. + This function is useful if you need a global compare function to feed to + BList::SortItems() for example. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::Compare(const BString &string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::Compare(const BString &string) const */ /*! -\fn int ICompare(const BString *, const BString *) -\brief Lexographically compare two strings in a case insensitive way. + \fn int ICompare(const BString *a, const BString *b) + \brief Lexographically compare two strings in a case insensitive way. -This function is useful if you need a global compare function to feed to -BList::SortItems() for example. + This function is useful if you need a global compare function to feed to + BList::SortItems() for example. -From String.h and in libbe.so. + From String.h and in libbe.so. -\sa BString::Compare(const BString &string) const + \param a The first string to compare. + \param b The second string to compare. + + \sa BString::Compare(const BString &string) const */ //! @} + From d51bfbb57c9588b26b801870d901cf1ddcbcb6bf Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 9 Aug 2011 21:57:31 +0000 Subject: [PATCH 157/702] Patch by John Scipione again : fix the new BIconUtils documentation. thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42609 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/interface/IconUtils.dox | 73 ++++++++++++++++++------------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/docs/user/interface/IconUtils.dox b/docs/user/interface/IconUtils.dox index a561123cee..245ae36d75 100644 --- a/docs/user/interface/IconUtils.dox +++ b/docs/user/interface/IconUtils.dox @@ -3,30 +3,31 @@ * Distributed under the terms of the MIT License. * * Documentation by: - * Adrien Destugues + * Adrien Destugues * Corresponds to: - * /trunk/headers/os/interface/IconUtils.h rev 42600 - * /trunk/src/kits/interface/IconUtils.cpp rev 42600 + * /trunk/headers/os/interface/IconUtils.h rev 42600 + * /trunk/src/kits/interface/IconUtils.cpp rev 42600 */ - + /*! -\file IconUtils.h -\brief Vector icon handling utility class + \file IconUtils.h + \brief Vector icon handling utility class */ -/*! \class BIconUtils +/*! + \class BIconUtils \ingroup interface \ingroup libbe \brief The BIconUtils class provide utility methods for managing and drawing vector icons. - + Haiku icons are stored in the HVIF (Haiku Vector Icon Format). This format was designed specifically for this purpose, and allows the icon data to be small enough to fit in file's inodes. This way, the icon can be displayed like any other file attribute, without extra disk access. - + This class provide only static methods to allow access to the icon data and rendering to BBitmaps for later use in an application. It also supports older icons in bitmap format. These may still be useful at very small @@ -35,60 +36,64 @@ */ -/*! \fn static status_t BIconUtils::GetIcon(BNode* node, +/*! + \fn static status_t BIconUtils::GetIcon(BNode* node, const char* vectorIconAttrName, const char* smallIconAttrName, const char* largeIconAttrName, icon_size size, BBitmap* result) \brief Utility function to import an icon from a node. - + Utility function to import an icon from the node that has either of the provided attribute names. Which icon type is preferred (vector, small or large B_CMAP8 icon) depends on the colorspace of the provided bitmap. - + \note If the colorspace is B_CMAP8, B_CMAP8 icons are preferred. In that case, the bitmap size must also match the provided icon_size "size"! */ -/*! \fn static status_t BIconUtils::GetVectorIcon(BNode* node, +/*! + \fn static status_t BIconUtils::GetVectorIcon(BNode* node, const char* attrName, BBitmap* result) \brief Utility function to import a vector icon in "flat icon" format. - + Utility function to import a vector icon in "flat icon" format from a BNode attribute into the preallocated BBitmap \a result. The colorspace of result needs to be B_RGBA32 or at least B_RGB32 (though that makes less sense). The icon will be scaled from it's "native" size of 64x64 to the size of the bitmap. - + \note The scale is derived from the bitmap width, the bitmap should have square dimension, or the icon will be cut off at the bottom (or have room left). */ -/*! \fn static status_t BIconUtils::GetVectorIcon(const uint8* buffer, +/*! + \fn static status_t BIconUtils::GetVectorIcon(const uint8* buffer, size_t size, BBitmap* result) \brief Utility function to import a vector icon in "flat icon" format. - + Utility function to import a vector icon in "flat icon" format from the given \a buffer into the preallocated BBitmap \a result. The colorspace of result needs to be B_RGBA32 or at least B_RGB32 (though that makes less sense). The icon will be scaled from it's "native" size of 64x64 to the size of the bitmap. - + \note The scale is derived from the bitmap width, the bitmap should have square dimension, or the icon will be cut off at the bottom (or have room left). */ -/*! \fn static status_t BIconUtils::GetCMAP8Icon(BNode* node, +/*! + \fn static status_t BIconUtils::GetCMAP8Icon(BNode* node, const char* smallIconAttrName, const char* largeIconAttrName, icon_size size, BBitmap* icon) \brief Utility function to import an "old" BeOS icon in B_CMAP8 colorspace. - + Utility function to import an "old" BeOS icon in B_CMAP8 colorspace from either the small icon attribute or the large icon attribute as given in \a smallIconAttrName and \a largeIconAttrName. Which icon is loaded depends @@ -96,32 +101,40 @@ */ -/*! \fn static status_t BIconUtils::ConvertFromCMAP8(BBitmap* source, BBitmap* result) +/*! + \fn static status_t BIconUtils::ConvertFromCMAP8(BBitmap* source, + BBitmap* result) \brief Converts an old-style icon to another colorspace. - + Utility function to convert from old icon colorspace into colorspace of BBitmap \a result - + \note result should be in B_RGBA32 colorspace, and source in B_CMAP8. */ -/*! \fn static status_t BIconUtils::ConvertToCMAP8(BBitmap* source, BBitmap* result) +/*! + \fn static status_t BIconUtils::ConvertToCMAP8(BBitmap* source, + BBitmap* result) \brief Converts a true-color icon to CMAP8 colorspace. - + Utility function to convert data from source into \a result colorspace. Call this to convert a picture to a format suitable for storage as an old-style icon. - + \note result should be in B_CMAP8 colorspace, and source in B_RGBA32. */ -/*! \fn static status_t BIconUtil::ConvertFromCMAP8(const uint8* data, uint32 width, - uint32 height, uint32 bytesPerRow, BBitmap* result); + +/*! + \fn static status_t BIconUtils::ConvertFromCMAP8(const uint8* data, + uint32 width, uint32 height, uint32 bytesPerRow, BBitmap* result); \brief Convert raw data in B_CMAP8 colorspace to a B_RGBA32 BBitmap. */ -/*! \fn static status_t BIconUtils::ConvertToCMAP8(const uint8* data, uint32 width, - uint32 height, uint32 bytesPerRow, BBitmap* result); + +/*! + \fn static status_t BIconUtils::ConvertToCMAP8(const uint8* data, + uint32 width, uint32 height, uint32 bytesPerRow, BBitmap* result); \brief Convert B_RGBA32 raw data into a B_CMAP8 BBitmap. */ From e0bc3d9e2bf8beeb2ea7159855079d2c747c7f35 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 9 Aug 2011 22:55:20 +0000 Subject: [PATCH 158/702] * Remove the bad designed GroupCookie class and move its functionality into the WindowArea. As an result each WindowArea only has one set of tabs and constraints. * Fix group splitting. * Style: win -> parentWindow git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42610 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/stackandtile/SATGroup.cpp | 304 +++++++++++++++--- src/servers/app/stackandtile/SATGroup.h | 40 ++- src/servers/app/stackandtile/SATWindow.cpp | 346 +++------------------ src/servers/app/stackandtile/SATWindow.h | 67 +--- src/servers/app/stackandtile/Stacking.cpp | 9 +- 5 files changed, 335 insertions(+), 431 deletions(-) diff --git a/src/servers/app/stackandtile/SATGroup.cpp b/src/servers/app/stackandtile/SATGroup.cpp index 0eb77038f3..4154d970da 100644 --- a/src/servers/app/stackandtile/SATGroup.cpp +++ b/src/servers/app/stackandtile/SATGroup.cpp @@ -22,6 +22,12 @@ using namespace std; +using namespace LinearProgramming; + + +const float kExtentPenalty = 1; +const float kHighPenalty = 100; +const float kInequalityPenalty = 10000; WindowArea::WindowArea(Crossing* leftTop, Crossing* rightTop, @@ -32,33 +38,139 @@ WindowArea::WindowArea(Crossing* leftTop, Crossing* rightTop, fLeftTopCrossing(leftTop), fRightTopCrossing(rightTop), fLeftBottomCrossing(leftBottom), - fRightBottomCrossing(rightBottom) + fRightBottomCrossing(rightBottom), + + fMinWidthConstraint(NULL), + fMinHeightConstraint(NULL), + fMaxWidthConstraint(NULL), + fMaxHeightConstraint(NULL), + fWidthConstraint(NULL), + fHeightConstraint(NULL) { } -bool -WindowArea::SetGroup(SATGroup* group) -{ - if (group && !group->fWindowAreaList.AddItem(this)) - return false; - - if (fGroup) - fGroup->fWindowAreaList.RemoveItem(this); - - fGroup = group; - return true; -} - - WindowArea::~WindowArea() { if (fGroup) fGroup->WindowAreaRemoved(this); _CleanupCorners(); - SetGroup(NULL); + fGroup->fWindowAreaList.RemoveItem(this); + + _UninitConstraints(); +} + + +bool +WindowArea::Init(SATGroup* group) +{ + _UninitConstraints(); + + if (group != NULL && group->fWindowAreaList.AddItem(this) == false) + return false; + + fGroup = group; + + LinearSpec* linearSpec = fGroup->GetLinearSpec(); + + fMinWidthConstraint = linearSpec->AddConstraint(1.0, RightVar(), -1.0, + LeftVar(), kGE, 0); + fMinHeightConstraint = linearSpec->AddConstraint(1.0, BottomVar(), -1.0, + TopVar(), kGE, 0); + + fMaxWidthConstraint = linearSpec->AddConstraint(1.0, RightVar(), -1.0, + LeftVar(), kLE, 0, kInequalityPenalty, kInequalityPenalty); + fMaxHeightConstraint = linearSpec->AddConstraint(1.0, BottomVar(), -1.0, + TopVar(), kLE, 0, kInequalityPenalty, kInequalityPenalty); + + // Width and height have soft constraints + fWidthConstraint = linearSpec->AddConstraint(1.0, RightVar(), -1.0, + LeftVar(), kEQ, 0, kExtentPenalty, + kExtentPenalty); + fHeightConstraint = linearSpec->AddConstraint(-1.0, TopVar(), 1.0, + BottomVar(), kEQ, 0, kExtentPenalty, + kExtentPenalty); + + if (!fMinWidthConstraint || !fMinHeightConstraint || !fWidthConstraint + || !fHeightConstraint || !fMaxWidthConstraint + || !fMaxHeightConstraint) + return false; + + return true; +} + + +void +WindowArea::DoGroupLayout() +{ + SATWindow* parentWindow = fWindowLayerOrder.ItemAt(0); + if (parentWindow == NULL) + return; + + BRect frame = parentWindow->CompleteWindowFrame(); + // Make it also work for solver which don't support negative variables + frame.OffsetBy(kMakePositiveOffset, kMakePositiveOffset); + + // adjust window size soft constraints + fWidthConstraint->SetRightSide(frame.Width()); + fHeightConstraint->SetRightSide(frame.Height()); + + LinearSpec* linearSpec = fGroup->GetLinearSpec(); + Constraint* leftConstraint = linearSpec->AddConstraint(1.0, LeftVar(), + kEQ, frame.left); + Constraint* topConstraint = linearSpec->AddConstraint(1.0, TopVar(), kEQ, + frame.top); + + // give soft constraints a high penalty + fWidthConstraint->SetPenaltyNeg(kHighPenalty); + fWidthConstraint->SetPenaltyPos(kHighPenalty); + fHeightConstraint->SetPenaltyNeg(kHighPenalty); + fHeightConstraint->SetPenaltyPos(kHighPenalty); + + // After we set the new parameter solve and apply the new layout. + ResultType result; + for (int32 tries = 0; tries < 15; tries++) { + result = fGroup->GetLinearSpec()->Solve(); + if (result == kInfeasible) { + debug_printf("can't solve constraints!\n"); + break; + } + if (result == kOptimal) { + const WindowAreaList& areas = fGroup->GetAreaList(); + for (int32 i = 0; i < areas.CountItems(); i++) { + WindowArea* area = areas.ItemAt(i); + area->_MoveToSAT(parentWindow); + } + break; + } + } + + // set penalties back to normal + fWidthConstraint->SetPenaltyNeg(kExtentPenalty); + fWidthConstraint->SetPenaltyPos(kExtentPenalty); + fHeightConstraint->SetPenaltyNeg(kExtentPenalty); + fHeightConstraint->SetPenaltyPos(kExtentPenalty); + + linearSpec->RemoveConstraint(leftConstraint); + linearSpec->RemoveConstraint(topConstraint); +} + + +void +WindowArea::UpdateSizeLimits() +{ + _UpdateConstraintValues(); +} + + +void +WindowArea::UpdateSizeConstaints(const BRect& frame) +{ + // adjust window size soft constraints + fWidthConstraint->SetRightSide(frame.Width()); + fHeightConstraint->SetRightSide(frame.Height()); } @@ -78,6 +190,46 @@ WindowArea::TopWindow() } +void +WindowArea::_UpdateConstraintValues() +{ + SATWindow* topWindow = TopWindow(); + if (topWindow == NULL) + return; + + int32 minWidth, maxWidth; + int32 minHeight, maxHeight; + SATWindow* window = fWindowList.ItemAt(0); + window->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); + for (int32 i = 1; i < fWindowList.CountItems(); i++) { + window = fWindowList.ItemAt(i); + // size limit constraints + int32 minW, maxW; + int32 minH, maxH; + window->GetSizeLimits(&minW, &maxW, &minH, &maxH); + if (minWidth < minW) + minWidth = minW; + if (minHeight < minH) + minHeight = minH; + if (maxWidth < maxW) + maxWidth = maxW; + if (maxHeight < maxH) + maxHeight = maxH; + } + + topWindow->AddDecorator(&minWidth, &maxWidth, &minHeight, &maxHeight); + fMinWidthConstraint->SetRightSide(minWidth); + fMinHeightConstraint->SetRightSide(minHeight); + + fMaxWidthConstraint->SetRightSide(maxWidth); + fMaxHeightConstraint->SetRightSide(maxHeight); + + BRect frame = topWindow->CompleteWindowFrame(); + fWidthConstraint->SetRightSide(frame.Width()); + fHeightConstraint->SetRightSide(frame.Height()); +} + + bool WindowArea::_AddWindow(SATWindow* window, SATWindow* after) { @@ -94,6 +246,8 @@ WindowArea::_AddWindow(SATWindow* window, SATWindow* after) _InitCorners(); fWindowLayerOrder.AddItem(window); + + _UpdateConstraintValues(); return true; } @@ -105,6 +259,8 @@ WindowArea::_RemoveWindow(SATWindow* window) return false; fWindowLayerOrder.RemoveItem(window); + _UpdateConstraintValues(); + window->RemovedFromArea(this); ReleaseReference(); return true; @@ -169,8 +325,24 @@ WindowArea::PropagateToGroup(SATGroup* group) fLeftBottomCrossing = newLeftBottom; fRightBottomCrossing = newRightBottom; - for (int i = 0; i < fWindowList.CountItems(); i++) - fWindowList.ItemAt(i)->PropagateToGroup(group, this); + _InitCorners(); + + BReference oldGroup = fGroup; + // manage constraints + if (Init(group) == false) + return false; + oldGroup->fWindowAreaList.RemoveItem(this); + for (int32 i = 0; i < fWindowList.CountItems(); i++) { + SATWindow* window = fWindowList.ItemAt(i); + if (oldGroup->fSATWindowList.RemoveItem(window) == false) + return false; + if (group->fSATWindowList.AddItem(window) == false) { + _UninitConstraints(); + return false; + } + } + + _UpdateConstraintValues(); return true; } @@ -185,6 +357,24 @@ WindowArea::MoveToTopLayer(SATWindow* window) } +void +WindowArea::_UninitConstraints() +{ + delete fMinWidthConstraint; + delete fMinHeightConstraint; + delete fMaxWidthConstraint; + delete fMaxHeightConstraint; + delete fWidthConstraint; + delete fHeightConstraint; + fMinWidthConstraint = NULL; + fMinHeightConstraint = NULL; + fMaxWidthConstraint = NULL; + fMaxHeightConstraint = NULL; + fWidthConstraint = NULL; + fHeightConstraint = NULL; +} + + BReference WindowArea::_CrossingByPosition(Crossing* crossing, SATGroup* group) { @@ -198,7 +388,7 @@ WindowArea::_CrossingByPosition(Crossing* crossing, SATGroup* group) return crossRef; Tab* oldVTab = crossing->VerticalTab(); - crossRef = hTab->FindCrossing(oldHTab->Position()); + crossRef = hTab->FindCrossing(oldVTab->Position()); if (crossRef) return crossRef; @@ -294,6 +484,38 @@ WindowArea::_UnsetNeighbourCorner(Corner* neighbour, Corner* opponent) } +void +WindowArea::_MoveToSAT(SATWindow* topWindow) +{ + int32 workspace = topWindow->GetWindow()->CurrentWorkspace(); + Desktop* desktop = topWindow->GetWindow()->Desktop(); + + BRect frameSAT(LeftVar()->Value() - kMakePositiveOffset, + TopVar()->Value() - kMakePositiveOffset, + RightVar()->Value() - kMakePositiveOffset, + BottomVar()->Value() - kMakePositiveOffset); + + for (int32 i = 0; i < fWindowList.CountItems(); i++) { + SATWindow* window = fWindowList.ItemAt(i); + window->AdjustSizeLimits(frameSAT); + + BRect frame = window->CompleteWindowFrame(); + float deltaToX = round(frameSAT.left - frame.left); + float deltaToY = round(frameSAT.top - frame.top); + frame.OffsetBy(deltaToX, deltaToY); + float deltaByX = round(frameSAT.right - frame.right); + float deltaByY = round(frameSAT.bottom - frame.bottom); + + desktop->MoveWindowBy(window->GetWindow(), deltaToX, deltaToY, + workspace); + // Update frame to the new position + desktop->ResizeWindowBy(window->GetWindow(), deltaByX, deltaByY); + } + + UpdateSizeConstaints(frameSAT); +} + + Corner::Corner() : status(kNotDockable), @@ -308,21 +530,21 @@ Corner::Trace() const { switch (status) { case kFree: - STRACE_SAT("free corner\n"); + debug_printf("free corner\n"); break; case kUsed: { - STRACE_SAT("attached windows:\n"); + debug_printf("attached windows:\n"); const SATWindowList& list = windowArea->WindowList(); for (int i = 0; i < list.CountItems(); i++) { - STRACE_SAT("- %s\n", list.ItemAt(i)->GetWindow()->Title()); + debug_printf("- %s\n", list.ItemAt(i)->GetWindow()->Title()); } break; } case kNotDockable: - STRACE_SAT("not dockable\n"); + debug_printf("not dockable\n"); break; }; } @@ -333,8 +555,6 @@ Crossing::Crossing(Tab* vertical, Tab* horizontal) fVerticalTab(vertical), fHorizontalTab(horizontal) { - fVerticalTab->AcquireReference(); - fHorizontalTab->AcquireReference(); } @@ -342,9 +562,6 @@ Crossing::~Crossing() { fVerticalTab->RemoveCrossing(this); fHorizontalTab->RemoveCrossing(this); - - fVerticalTab->ReleaseReference(); - fHorizontalTab->ReleaseReference(); } @@ -379,13 +596,13 @@ Crossing::HorizontalTab() const void Crossing::Trace() const { - STRACE_SAT("left-top corner: "); + debug_printf("left-top corner: "); fCorners[Corner::kLeftTop].Trace(); - STRACE_SAT("right-top corner: "); + debug_printf("right-top corner: "); fCorners[Corner::kRightTop].Trace(); - STRACE_SAT("left-bottom corner: "); + debug_printf("left-bottom corner: "); fCorners[Corner::kLeftBottom].Trace(); - STRACE_SAT("right-bottom corner: "); + debug_printf("right-bottom corner: "); fCorners[Corner::kRightBottom].Trace(); } @@ -502,12 +719,14 @@ Tab::FindCrossingIndex(float pos) { if (fOrientation == kVertical) { for (int32 i = 0; i < fCrossingList.CountItems(); i++) { - if (fCrossingList.ItemAt(i)->HorizontalTab()->Position() == pos) + if (fabs(fCrossingList.ItemAt(i)->HorizontalTab()->Position() - pos) + < 0.0001) return i; } } else { for (int32 i = 0; i < fCrossingList.CountItems(); i++) { - if (fCrossingList.ItemAt(i)->VerticalTab()->Position() == pos) + if (fabs(fCrossingList.ItemAt(i)->VerticalTab()->Position() - pos) + < 0.0001) return i; } } @@ -557,7 +776,6 @@ SATGroup::SATGroup() SATGroup::~SATGroup() { - ASSERT(fSATWindowList.CountItems() == 0); // Should be empty //while (fSATWindowList.CountItems() > 0) // RemoveWindow(fSATWindowList.ItemAt(0)); @@ -628,7 +846,7 @@ SATGroup::AddWindow(SATWindow* window, Tab* left, Tab* top, Tab* right, if (!area) return false; // the area register itself in our area list - if (!area->SetGroup(this)) { + if (area->Init(this) == false) { delete area; return false; } @@ -733,18 +951,6 @@ SATGroup::FindVerticalTab(float position) } -void -SATGroup::AdjustWindows(SATWindow* triggerWindow) -{ - // set window locations and sizes - for (int i = 0; i < fSATWindowList.CountItems(); i++) { - SATWindow* windowSAT = fSATWindowList.ItemAt(i); - windowSAT->MoveWindowToSAT( - triggerWindow->GetWindow()->CurrentWorkspace()); - } -} - - void SATGroup::WindowAreaRemoved(WindowArea* area) { @@ -927,7 +1133,7 @@ Tab* SATGroup::_FindTab(const TabList& list, float position) { for (int i = 0; i < list.CountItems(); i++) - if (list.ItemAt(i)->Position() == position) + if (fabs(list.ItemAt(i)->Position() - position) < 0.00001) return list.ItemAt(i); return NULL; diff --git a/src/servers/app/stackandtile/SATGroup.h b/src/servers/app/stackandtile/SATGroup.h index df8feeaefb..74b081adfb 100644 --- a/src/servers/app/stackandtile/SATGroup.h +++ b/src/servers/app/stackandtile/SATGroup.h @@ -14,6 +14,8 @@ #include "ObjectList.h" #include "Referenceable.h" +#include "MagneticBorder.h" + #include "LinearSpec.h" @@ -72,10 +74,10 @@ public: void Trace() const; private: - Corner fCorners[4]; + Corner fCorners[4]; - Tab* fVerticalTab; - Tab* fHorizontalTab; + BReference fVerticalTab; + BReference fHorizontalTab; }; @@ -137,7 +139,12 @@ public: Crossing* rightBottom); ~WindowArea(); - bool SetGroup(SATGroup* group); + bool Init(SATGroup* group); + SATGroup* Group() { return fGroup; } + + void DoGroupLayout(); + void UpdateSizeLimits(); + void UpdateSizeConstaints(const BRect& frame); const SATWindowList& WindowList() { return fWindowList; } const SATWindowList& LayerOrder() { return fWindowLayerOrder; } @@ -159,6 +166,11 @@ public: Tab* TopTab(); Tab* BottomTab(); + Variable* LeftVar() { return LeftTab()->Var(); } + Variable* RightVar() { return RightTab()->Var(); } + Variable* TopVar() { return TopTab()->Var(); } + Variable* BottomVar() { return BottomTab()->Var(); } + BRect Frame(); bool PropagateToGroup(SATGroup* group); @@ -167,6 +179,9 @@ public: private: friend class SATGroup; + void _UninitConstraints(); + void _UpdateConstraintValues(); + /*! SATGroup adds new windows to the area. */ bool _AddWindow(SATWindow* window, SATWindow* after = NULL); @@ -188,7 +203,9 @@ private: BReference _CrossingByPosition(Crossing* crossing, SATGroup* group); - SATGroup* fGroup; + void _MoveToSAT(SATWindow* topWindow); + + BReference fGroup; SATWindowList fWindowList; @@ -198,6 +215,17 @@ private: BReference fRightTopCrossing; BReference fLeftBottomCrossing; BReference fRightBottomCrossing; + + Constraint* fMinWidthConstraint; + Constraint* fMinHeightConstraint; + Constraint* fMaxWidthConstraint; + Constraint* fMaxHeightConstraint; + Constraint* fKeepMaxWidthConstraint; + Constraint* fKeepMaxHeightConstraint; + Constraint* fWidthConstraint; + Constraint* fHeightConstraint; + + MagneticBorder fMagneticBorder; }; @@ -219,8 +247,6 @@ public: LinearSpec* GetLinearSpec() { return &fLinearSpec; } - void AdjustWindows(SATWindow* triggerWindow); - /*! Create a new WindowArea from the crossing and add the window. */ bool AddWindow(SATWindow* window, Tab* left, Tab* top, Tab* right, Tab* bottom); diff --git a/src/servers/app/stackandtile/SATWindow.cpp b/src/servers/app/stackandtile/SATWindow.cpp index 06f5f92f2f..72bed893cf 100644 --- a/src/servers/app/stackandtile/SATWindow.cpp +++ b/src/servers/app/stackandtile/SATWindow.cpp @@ -20,235 +20,6 @@ using namespace BPrivate; -using namespace LinearProgramming; - - -const float kExtentPenalty = 1; -const float kHighPenalty = 10; -const float kInequalityPenalty = 10000; - - -GroupCookie::GroupCookie(SATWindow* satWindow) - : - fSATWindow(satWindow), - - fWindowArea(NULL), - - fLeftBorder(NULL), - fTopBorder(NULL), - fRightBorder(NULL), - fBottomBorder(NULL), - - fMinWidthConstraint(NULL), - fMinHeightConstraint(NULL), - fMaxWidthConstraint(NULL), - fMaxHeightConstraint(NULL), - fWidthConstraint(NULL), - fHeightConstraint(NULL) -{ -} - - -GroupCookie::~GroupCookie() -{ - Uninit(); -} - - -void -GroupCookie::DoGroupLayout() -{ - if (!fSATGroup.Get()) - return; - - BRect frame = fSATWindow->CompleteWindowFrame(); - // Make it also work for solver which don't support negative variables - frame.OffsetBy(kMakePositiveOffset, kMakePositiveOffset); - - // adjust window size soft constraints - fWidthConstraint->SetRightSide(frame.Width()); - fHeightConstraint->SetRightSide(frame.Height()); - - LinearSpec* linearSpec = fSATGroup->GetLinearSpec(); - Constraint* leftConstraint = linearSpec->AddConstraint(1.0, fLeftBorder, - kEQ, frame.left); - Constraint* topConstraint = linearSpec->AddConstraint(1.0, fTopBorder, kEQ, - frame.top); - - // give soft constraints a high penalty - fWidthConstraint->SetPenaltyNeg(kHighPenalty); - fWidthConstraint->SetPenaltyPos(kHighPenalty); - fHeightConstraint->SetPenaltyNeg(kHighPenalty); - fHeightConstraint->SetPenaltyPos(kHighPenalty); - - // After we set the new parameter solve and apply the new layout. - ResultType result; - for (int32 tries = 0; tries < 15; tries++) { - result = fSATGroup->GetLinearSpec()->Solve(); - if (result == kInfeasible) { - debug_printf("can't solve constraints!\n"); - break; - } - if (result == kOptimal) { - fSATGroup->AdjustWindows(fSATWindow); - break; - } - } - - // set penalties back to normal - fWidthConstraint->SetPenaltyNeg(kExtentPenalty); - fWidthConstraint->SetPenaltyPos(kExtentPenalty); - fHeightConstraint->SetPenaltyNeg(kExtentPenalty); - fHeightConstraint->SetPenaltyPos(kExtentPenalty); - - linearSpec->RemoveConstraint(leftConstraint); - linearSpec->RemoveConstraint(topConstraint); -} - - -void -GroupCookie::MoveWindow(int32 workspace) -{ - Window* window = fSATWindow->GetWindow(); - Desktop* desktop = window->Desktop(); - - BRect frame = fSATWindow->CompleteWindowFrame(); - BRect frameSAT(fLeftBorder->Value() - kMakePositiveOffset, - fTopBorder->Value() - kMakePositiveOffset, - fRightBorder->Value() - kMakePositiveOffset, - fBottomBorder->Value() - kMakePositiveOffset); - - fSATWindow->AdjustSizeLimits(frameSAT); - desktop->MoveWindowBy(window, round(frameSAT.left - frame.left), - round(frameSAT.top - frame.top), workspace); - - // Update frame to the new position - frame.OffsetBy(round(frameSAT.left - frame.left), - round(frameSAT.top - frame.top)); - desktop->ResizeWindowBy(window, round(frameSAT.right - frame.right), - round(frameSAT.bottom - frame.bottom)); - - UpdateSizeConstaints(frameSAT); -} - - -void -GroupCookie::SetSizeLimits(int32 minWidth, int32 maxWidth, int32 minHeight, - int32 maxHeight) -{ - fMinWidthConstraint->SetRightSide(minWidth); - fMinHeightConstraint->SetRightSide(minHeight); - fMaxWidthConstraint->SetRightSide(maxWidth); - fMaxHeightConstraint->SetRightSide(maxHeight); -} - - -void -GroupCookie::UpdateSizeConstaints(const BRect& frame) -{ - // adjust window size soft constraints - if (fSATWindow->IsHResizeable() == true) - fWidthConstraint->SetRightSide(frame.Width()); - if (fSATWindow->IsVResizeable() == true) - fHeightConstraint->SetRightSide(frame.Height()); -} - - -bool -GroupCookie::Init(SATGroup* group, WindowArea* area) -{ - ASSERT(fSATGroup.Get() == NULL); - - fSATGroup.SetTo(group); - fWindowArea = area; - - LinearSpec* linearSpec = group->GetLinearSpec(); - // create variables - fLeftBorder = area->LeftTab()->Var(); - fTopBorder = area->TopTab()->Var(); - fRightBorder = area->RightTab()->Var(); - fBottomBorder = area->BottomTab()->Var(); - - // size limit constraints - int32 minWidth, maxWidth; - int32 minHeight, maxHeight; - fSATWindow->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); - fSATWindow->AddDecorator(&minWidth, &maxWidth, &minHeight, &maxHeight); - - fMinWidthConstraint = linearSpec->AddConstraint(1.0, fRightBorder, -1.0, - fLeftBorder, kGE, minWidth); - fMinHeightConstraint = linearSpec->AddConstraint(1.0, fBottomBorder, -1.0, - fTopBorder, kGE, minHeight); - - fMaxWidthConstraint = linearSpec->AddConstraint(1.0, fRightBorder, -1.0, - fLeftBorder, kLE, maxWidth, kInequalityPenalty, kInequalityPenalty); - fMaxHeightConstraint = linearSpec->AddConstraint(1.0, fBottomBorder, -1.0, - fTopBorder, kLE, maxHeight, kInequalityPenalty, kInequalityPenalty); - - // Width and height have soft constraints - BRect frame = fSATWindow->CompleteWindowFrame(); - fWidthConstraint = linearSpec->AddConstraint(1.0, fRightBorder, -1.0, - fLeftBorder, kEQ, frame.Width(), kExtentPenalty, - kExtentPenalty); - fHeightConstraint = linearSpec->AddConstraint(-1.0, fTopBorder, 1.0, - fBottomBorder, kEQ, frame.Height(), kExtentPenalty, - kExtentPenalty); - - if (!fMinWidthConstraint || !fMinHeightConstraint || !fWidthConstraint - || !fHeightConstraint || !fMaxWidthConstraint - || !fMaxHeightConstraint) { - // clean up - Uninit(); - return false; - } - - return true; -} - - -void -GroupCookie::Uninit() -{ - fLeftBorder = NULL; - fTopBorder = NULL; - fRightBorder = NULL; - fBottomBorder = NULL; - - delete fMinWidthConstraint; - delete fMinHeightConstraint; - delete fMaxWidthConstraint; - delete fMaxHeightConstraint; - delete fWidthConstraint; - delete fHeightConstraint; - fMinWidthConstraint = NULL; - fMinHeightConstraint = NULL; - fMaxWidthConstraint = NULL; - fMaxHeightConstraint = NULL; - fWidthConstraint = NULL; - fHeightConstraint = NULL; - - fSATGroup.Unset(); - fWindowArea = NULL; -} - - -bool -GroupCookie::PropagateToGroup(SATGroup* group, WindowArea* area) -{ - if (!fSATGroup->fSATWindowList.RemoveItem(fSATWindow)) - return false; - Uninit(); - - if (!Init(group, area)) - return false; - - if (!area->SetGroup(group) || !group->fSATWindowList.AddItem(fSATWindow)) { - Uninit(); - return false; - } - - return true; -} // #pragma mark - @@ -259,13 +30,11 @@ SATWindow::SATWindow(StackAndTile* sat, Window* window) fWindow(window), fStackAndTile(sat), - fOwnGroupCookie(this), - fForeignGroupCookie(this), + fWindowArea(NULL), fOngoingSnapping(NULL), fSATStacking(this), - fSATTiling(this), - fShutdown(false) + fSATTiling(this) { fId = _GenerateId(); @@ -278,9 +47,6 @@ SATWindow::SATWindow(StackAndTile* sat, Window* window) fOriginalWidth = frame.Width(); fOriginalHeight = frame.Height(); - fGroupCookie = &fOwnGroupCookie; - _InitGroup(); - fSATSnappingBehaviourList.AddItem(&fSATStacking); fSATSnappingBehaviourList.AddItem(&fSATTiling); } @@ -288,12 +54,8 @@ SATWindow::SATWindow(StackAndTile* sat, Window* window) SATWindow::~SATWindow() { - fShutdown = true; - - if (fForeignGroupCookie.GetGroup()) - fForeignGroupCookie.GetGroup()->RemoveWindow(this); - if (fOwnGroupCookie.GetGroup()) - fOwnGroupCookie.GetGroup()->RemoveWindow(this); + if (fWindowArea != NULL) + fWindowArea->Group()->RemoveWindow(this); } @@ -307,22 +69,33 @@ SATWindow::GetDecorator() const SATGroup* SATWindow::GetGroup() { - if (!fGroupCookie->GetGroup()) - _InitGroup(); + if (fWindowArea == NULL) { + SATGroup* group = new (std::nothrow)SATGroup; + if (group == NULL) + return group; + BReference groupRef; + groupRef.SetTo(group, true); - // manually set the tabs of the single window - WindowArea* windowArea = fGroupCookie->GetWindowArea(); - if (!PositionManagedBySAT() && windowArea) { + /* AddWindow also will trigger the window to hold a reference on the new + group. */ + if (group->AddWindow(this, NULL, NULL, NULL, NULL) == false) + return NULL; + } + + ASSERT(fWindowArea != NULL); + + // manually set the tabs of the single window + if (PositionManagedBySAT() == false) { BRect frame = CompleteWindowFrame(); - windowArea->LeftTopCrossing()->VerticalTab()->SetPosition(frame.left); - windowArea->LeftTopCrossing()->HorizontalTab()->SetPosition(frame.top); - windowArea->RightBottomCrossing()->VerticalTab()->SetPosition( + fWindowArea->LeftTopCrossing()->VerticalTab()->SetPosition(frame.left); + fWindowArea->LeftTopCrossing()->HorizontalTab()->SetPosition(frame.top); + fWindowArea->RightBottomCrossing()->VerticalTab()->SetPosition( frame.right); - windowArea->RightBottomCrossing()->HorizontalTab()->SetPosition( + fWindowArea->RightBottomCrossing()->HorizontalTab()->SetPosition( frame.bottom); } - return fGroupCookie->GetGroup(); + return fWindowArea->Group(); } @@ -340,16 +113,11 @@ SATWindow::HandleMessage(SATWindow* sender, BPrivate::LinkReceiver& link, bool -SATWindow::PropagateToGroup(SATGroup* group, WindowArea* area) +SATWindow::PropagateToGroup(SATGroup* group) { - return fGroupCookie->PropagateToGroup(group, area); -} - - -void -SATWindow::MoveWindowToSAT(int32 workspace) -{ - fGroupCookie->MoveWindow(workspace); + if (fWindowArea == NULL) + return false; + return fWindowArea->PropagateToGroup(group); } @@ -358,16 +126,7 @@ SATWindow::AddedToGroup(SATGroup* group, WindowArea* area) { STRACE_SAT("SATWindow::AddedToGroup group: %p window %s\n", group, fWindow->Title()); - if (fGroupCookie == &fForeignGroupCookie) - return false; - if (fOwnGroupCookie.GetGroup()) - fGroupCookie = &fForeignGroupCookie; - - if (!fGroupCookie->Init(group, area)) { - fGroupCookie = &fOwnGroupCookie; - return false; - } - + fWindowArea = area; return true; } @@ -382,18 +141,7 @@ SATWindow::RemovedFromGroup(SATGroup* group, bool stayBelowMouse) if (group->CountItems() == 1) group->WindowAt(0)->_RestoreOriginalSize(false); - if (fShutdown) { - fGroupCookie->Uninit(); - return true; - } - - ASSERT(fGroupCookie->GetGroup() == group); - fGroupCookie->Uninit(); - if (fGroupCookie == &fOwnGroupCookie) - _InitGroup(); - else - fGroupCookie = &fOwnGroupCookie; - + fWindowArea = NULL; return true; } @@ -485,7 +233,8 @@ SATWindow::DoGroupLayout() if (!PositionManagedBySAT()) return; - fGroupCookie->DoGroupLayout(); + if (fWindowArea != NULL) + fWindowArea->DoGroupLayout(); } @@ -584,9 +333,8 @@ SATWindow::SetOriginalSizeLimits(int32 minWidth, int32 maxWidth, fOriginalMinHeight = minHeight; fOriginalMaxHeight = maxHeight; - GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); - AddDecorator(&minWidth, &maxWidth, &minHeight, &maxHeight); - fGroupCookie->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); + if (fWindowArea != NULL) + fWindowArea->UpdateSizeLimits(); } @@ -604,7 +352,8 @@ SATWindow::Resized() if (vResizeable) fOriginalHeight = frame.Height(); - fGroupCookie->UpdateSizeConstaints(CompleteWindowFrame()); + if (fWindowArea != NULL) + fWindowArea->UpdateSizeConstaints(CompleteWindowFrame()); } @@ -653,7 +402,7 @@ SATWindow::CompleteWindowFrame() bool SATWindow::PositionManagedBySAT() { - if (fGroupCookie->GetGroup() && fGroupCookie->GetGroup()->CountItems() == 1) + if (fWindowArea == NULL || fWindowArea->Group()->CountItems() == 1) return false; return true; @@ -723,25 +472,6 @@ SATWindow::GetSettings(BMessage& message) } -void -SATWindow::_InitGroup() -{ - ASSERT(fGroupCookie == &fOwnGroupCookie); - ASSERT(fOwnGroupCookie.GetGroup() == NULL); - STRACE_SAT("SATWindow::_InitGroup %s\n", fWindow->Title()); - SATGroup* group = new (std::nothrow)SATGroup; - if (!group) - return; - BReference groupRef; - groupRef.SetTo(group, true); - - /* AddWindow also will trigger the window to hold a reference on the new - group. */ - if (!groupRef->AddWindow(this, NULL, NULL, NULL, NULL)) - STRACE_SAT("SATWindow::_InitGroup(): adding window to group failed\n"); -} - - uint64 SATWindow::_GenerateId() { diff --git a/src/servers/app/stackandtile/SATWindow.h b/src/servers/app/stackandtile/SATWindow.h index bb21fc8251..0ab566e255 100644 --- a/src/servers/app/stackandtile/SATWindow.h +++ b/src/servers/app/stackandtile/SATWindow.h @@ -11,8 +11,8 @@ #include -#include "MagneticBorder.h" #include "SATDecorator.h" +#include "SATGroup.h" #include "Stacking.h" #include "Tiling.h" @@ -23,53 +23,6 @@ class StackAndTile; class Window; -class GroupCookie -{ -public: - GroupCookie(SATWindow* satWindow); - ~GroupCookie(); - - bool Init(SATGroup* group, WindowArea* area); - void Uninit(); - - void DoGroupLayout(); - void MoveWindow(int32 workspace); - void SetSizeLimits(int32 minWidth, int32 maxWidth, - int32 minHeight, int32 maxHeight); - void UpdateSizeConstaints(const BRect& frame); - - SATGroup* GetGroup() { return fSATGroup.Get(); } - - WindowArea* GetWindowArea() { return fWindowArea; } - - bool PropagateToGroup(SATGroup* group, - WindowArea* area); - -private: - SATWindow* fSATWindow; - - BReference fSATGroup; - - WindowArea* fWindowArea; - - Variable* fLeftBorder; - Variable* fTopBorder; - Variable* fRightBorder; - Variable* fBottomBorder; - - Constraint* fMinWidthConstraint; - Constraint* fMinHeightConstraint; - Constraint* fMaxWidthConstraint; - Constraint* fMaxHeightConstraint; - Constraint* fKeepMaxWidthConstraint; - Constraint* fKeepMaxHeightConstraint; - Constraint* fWidthConstraint; - Constraint* fHeightConstraint; - - MagneticBorder fMagneticBorder; -}; - - class SATWindow { public: SATWindow(StackAndTile* sat, Window* window); @@ -81,18 +34,13 @@ public: Desktop* GetDesktop() { return fDesktop; } //! Can be NULL if memory allocation failed! SATGroup* GetGroup(); - WindowArea* GetWindowArea() { - return fGroupCookie->GetWindowArea(); } + WindowArea* GetWindowArea() { return fWindowArea; } bool HandleMessage(SATWindow* sender, BPrivate::LinkReceiver& link, BPrivate::LinkSender& reply); - bool PropagateToGroup(SATGroup* group, - WindowArea* area); - - //! Move the window to the tab's position. - void MoveWindowToSAT(int32 workspace); + bool PropagateToGroup(SATGroup* group); // hook function called from SATGroup bool AddedToGroup(SATGroup* group, WindowArea* area); @@ -139,7 +87,6 @@ public: bool SetSettings(const BMessage& message); void GetSettings(BMessage& message); private: - void _InitGroup(); uint64 _GenerateId(); void _UpdateSizeLimits(); @@ -151,11 +98,7 @@ private: Desktop* fDesktop; //! Current group. - GroupCookie* fGroupCookie; - /*! If the window is added to another group the own group is cached - here. */ - GroupCookie fOwnGroupCookie; - GroupCookie fForeignGroupCookie; + WindowArea* fWindowArea; SATSnappingBehaviour* fOngoingSnapping; SATStacking fSATStacking; @@ -163,8 +106,6 @@ private: SATSnappingBehaviourList fSATSnappingBehaviourList; - bool fShutdown; - int32 fOriginalMinWidth; int32 fOriginalMaxWidth; int32 fOriginalMinHeight; diff --git a/src/servers/app/stackandtile/Stacking.cpp b/src/servers/app/stackandtile/Stacking.cpp index d2e2710ca6..f7192d8726 100644 --- a/src/servers/app/stackandtile/Stacking.cpp +++ b/src/servers/app/stackandtile/Stacking.cpp @@ -237,13 +237,14 @@ SATStacking::FindSnappingCandidates(SATGroup* group) for (int i = 0; i < group->CountItems(); i++) { SATWindow* satWindow = group->WindowAt(i); // search for stacking parent - Window* win = satWindow->GetWindow(); - if (win == window || !win->Decorator()) + Window* parentWindow = satWindow->GetWindow(); + if (parentWindow == window || parentWindow->Decorator() == NULL) continue; - if (_IsStackableWindow(win) == false + if (_IsStackableWindow(parentWindow) == false || _IsStackableWindow(window) == false) continue; - Decorator::Tab* tab = win->Decorator()->TabAt(win->PositionInStack()); + Decorator::Tab* tab = parentWindow->Decorator()->TabAt( + parentWindow->PositionInStack()); if (tab == NULL) continue; if (tab->tabRect.Contains(mousePosition)) { From cd67c205ff3aae882046fc96fc181e3b601be500 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Wed, 10 Aug 2011 00:03:25 +0000 Subject: [PATCH 159/702] Only remove a window from the S&T group when the hide event is not triggered by a minimize call. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42611 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 6 +++--- src/servers/app/Desktop.h | 3 ++- src/servers/app/DesktopListener.cpp | 4 ++-- src/servers/app/DesktopListener.h | 6 ++++-- src/servers/app/stackandtile/StackAndTile.cpp | 4 ++-- src/servers/app/stackandtile/StackAndTile.h | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 8c04962bc8..d1cef6acb4 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1261,7 +1261,7 @@ Desktop::ShowWindow(Window* window) void -Desktop::HideWindow(Window* window) +Desktop::HideWindow(Window* window, bool fromMinimize) { if (window->IsHidden()) return; @@ -1310,7 +1310,7 @@ Desktop::HideWindow(Window* window) } } - NotifyWindowHidden(window); + NotifyWindowHidden(window, fromMinimize); UnlockAllWindows(); @@ -1326,7 +1326,7 @@ Desktop::MinimizeWindow(Window* window, bool minimize) return; if (minimize && !window->IsHidden()) { - HideWindow(window); + HideWindow(window, true); window->SetMinimized(minimize); NotifyWindowMinimized(window, minimize); } else if (!minimize && window->IsHidden()) { diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index 033a50e8a1..477b03b987 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -166,7 +166,8 @@ public: Window* behindOf = NULL); void ShowWindow(Window* window); - void HideWindow(Window* window); + void HideWindow(Window* window, + bool fromMinimize = false); void MinimizeWindow(Window* window, bool minimize); void MoveWindowBy(Window* window, float x, float y, diff --git a/src/servers/app/DesktopListener.cpp b/src/servers/app/DesktopListener.cpp index cce860ddc5..8f37d73360 100644 --- a/src/servers/app/DesktopListener.cpp +++ b/src/servers/app/DesktopListener.cpp @@ -230,7 +230,7 @@ DesktopObservable::NotifyWindowWorkspacesChanged(Window* window, void -DesktopObservable::NotifyWindowHidden(Window* window) +DesktopObservable::NotifyWindowHidden(Window* window, bool fromMinimize) { if (fWeAreInvoking) return; @@ -238,7 +238,7 @@ DesktopObservable::NotifyWindowHidden(Window* window) for (DesktopListener* listener = fDesktopListenerList.First(); listener != NULL; listener = fDesktopListenerList.GetNext(listener)) - listener->WindowHidden(window); + listener->WindowHidden(window, fromMinimize); } diff --git a/src/servers/app/DesktopListener.h b/src/servers/app/DesktopListener.h index d44d242798..760e6a98d2 100644 --- a/src/servers/app/DesktopListener.h +++ b/src/servers/app/DesktopListener.h @@ -55,7 +55,8 @@ public: Window* behindOf) = 0; virtual void WindowWorkspacesChanged(Window* window, uint32 workspaces) = 0; - virtual void WindowHidden(Window* window) = 0; + virtual void WindowHidden(Window* window, + bool fromMinimize) = 0; virtual void WindowMinimized(Window* window, bool minimize) = 0; @@ -112,7 +113,8 @@ public: Window* behindOf); void NotifyWindowWorkspacesChanged(Window* window, uint32 workspaces); - void NotifyWindowHidden(Window* window); + void NotifyWindowHidden(Window* window, + bool fromMinimize); void NotifyWindowMinimized(Window* window, bool minimize); diff --git a/src/servers/app/stackandtile/StackAndTile.cpp b/src/servers/app/stackandtile/StackAndTile.cpp index 60c6e02b58..acbacd7268 100644 --- a/src/servers/app/stackandtile/StackAndTile.cpp +++ b/src/servers/app/stackandtile/StackAndTile.cpp @@ -349,7 +349,7 @@ StackAndTile::WindowWorkspacesChanged(Window* window, uint32 workspaces) void -StackAndTile::WindowHidden(Window* window) +StackAndTile::WindowHidden(Window* window, bool fromMinimize) { SATWindow* satWindow = GetSATWindow(window); if (satWindow == NULL) @@ -357,7 +357,7 @@ StackAndTile::WindowHidden(Window* window) SATGroup* group = satWindow->GetGroup(); if (group == NULL) return; - if (group->CountItems() > 1) + if (fromMinimize == false && group->CountItems() > 1) group->RemoveWindow(satWindow); } diff --git a/src/servers/app/stackandtile/StackAndTile.h b/src/servers/app/stackandtile/StackAndTile.h index a6ffe28991..d61b0c007e 100644 --- a/src/servers/app/stackandtile/StackAndTile.h +++ b/src/servers/app/stackandtile/StackAndTile.h @@ -72,7 +72,7 @@ public: Window* behindOf); virtual void WindowWorkspacesChanged(Window* window, uint32 workspaces); - virtual void WindowHidden(Window* window); + virtual void WindowHidden(Window* window, bool fromMinimize); virtual void WindowMinimized(Window* window, bool minimize); virtual void WindowTabLocationChanged(Window* window, From 10bc147290c4ef6333963c1048d9f8f5cefecd33 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Wed, 10 Aug 2011 00:08:43 +0000 Subject: [PATCH 160/702] Automatic whitespace cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42612 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/googlefs/attrs.c | 410 +++++++++--------- 1 file changed, 205 insertions(+), 205 deletions(-) diff --git a/src/add-ons/kernel/file_systems/googlefs/attrs.c b/src/add-ons/kernel/file_systems/googlefs/attrs.c index 203e59aefb..8e55c587e0 100644 --- a/src/add-ons/kernel/file_systems/googlefs/attrs.c +++ b/src/add-ons/kernel/file_systems/googlefs/attrs.c @@ -15,87 +15,87 @@ #if 0 /* old one */ const char google_icon_M[] = { -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1e, 0x1b, 0xd9, 0xd9, 0x1d, 0xff, 0xff, -0xff, 0xff, 0x1d, 0x82, 0x82, 0x19, 0xff, 0xff, 0x1e, 0xd8, 0x64, 0x63, 0x63, 0xd8, 0x1b, 0xff, -0xff, 0x1a, 0x2c, 0x2d, 0x2d, 0x2c, 0xc4, 0x1d, 0x62, 0x63, 0x1c, 0x3f, 0x1e, 0x63, 0xd8, 0x1d, -0x1a, 0x2c, 0xca, 0x1a, 0x1d, 0x82, 0x2d, 0xa3, 0xd8, 0x62, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0x1a, -0x82, 0x2d, 0x1a, 0x3f, 0x3f, 0x3f, 0xa3, 0x2d, 0xd8, 0x62, 0x0e, 0x1e, 0x3f, 0x1f, 0xd8, 0x62, -0x82, 0x2d, 0x1d, 0x3f, 0x3f, 0x0f, 0x82, 0x2e, 0x63, 0x83, 0x0a, 0x1e, 0x3f, 0xfd, 0x64, 0x1b, -0x19, 0x2c, 0x5a, 0x3f, 0x1e, 0x0b, 0xc4, 0xeb, 0x1a, 0x64, 0xd8, 0xd9, 0xd9, 0x64, 0x83, 0xff, -0xff, 0xca, 0x2c, 0xa3, 0x5a, 0xc4, 0x2e, 0x82, 0xff, 0x1b, 0x83, 0x8a, 0x89, 0x17, 0x17, 0xff, -0xff, 0x1a, 0xa9, 0x2e, 0x2e, 0xca, 0x82, 0x17, 0xff, 0xff, 0xff, 0x17, 0x17, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0x1a, 0x1a, 0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1e, 0x1b, 0xd9, 0xd9, 0x1d, 0xff, 0xff, +0xff, 0xff, 0x1d, 0x82, 0x82, 0x19, 0xff, 0xff, 0x1e, 0xd8, 0x64, 0x63, 0x63, 0xd8, 0x1b, 0xff, +0xff, 0x1a, 0x2c, 0x2d, 0x2d, 0x2c, 0xc4, 0x1d, 0x62, 0x63, 0x1c, 0x3f, 0x1e, 0x63, 0xd8, 0x1d, +0x1a, 0x2c, 0xca, 0x1a, 0x1d, 0x82, 0x2d, 0xa3, 0xd8, 0x62, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0x1a, +0x82, 0x2d, 0x1a, 0x3f, 0x3f, 0x3f, 0xa3, 0x2d, 0xd8, 0x62, 0x0e, 0x1e, 0x3f, 0x1f, 0xd8, 0x62, +0x82, 0x2d, 0x1d, 0x3f, 0x3f, 0x0f, 0x82, 0x2e, 0x63, 0x83, 0x0a, 0x1e, 0x3f, 0xfd, 0x64, 0x1b, +0x19, 0x2c, 0x5a, 0x3f, 0x1e, 0x0b, 0xc4, 0xeb, 0x1a, 0x64, 0xd8, 0xd9, 0xd9, 0x64, 0x83, 0xff, +0xff, 0xca, 0x2c, 0xa3, 0x5a, 0xc4, 0x2e, 0x82, 0xff, 0x1b, 0x83, 0x8a, 0x89, 0x17, 0x17, 0xff, +0xff, 0x1a, 0xa9, 0x2e, 0x2e, 0xca, 0x82, 0x17, 0xff, 0xff, 0xff, 0x17, 0x17, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0x1a, 0x1a, 0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; const char google_icon_L[] = { -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1c, 0x1b, 0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0x1c, 0x62, 0x63, 0xd8, 0xd8, 0xd8, 0x63, 0x62, 0x1d, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1e, 0x1e, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0x1a, 0xd8, 0xd8, 0xd8, 0xf8, 0xd8, 0xf8, 0xd8, 0xd8, 0x63, 0x1b, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0x1a, 0x18, 0xa3, 0xc4, 0xc4, 0xc4, 0xa9, 0x82, 0x1a, 0xff, 0xff, 0xff, -0xff, 0x1a, 0xd8, 0xd8, 0x64, 0x84, 0x83, 0x63, 0x63, 0x84, 0xf8, 0xd8, 0x63, 0x1b, 0xff, 0xff, -0xff, 0xff, 0xff, 0x1c, 0xa3, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0xc4, 0x1a, 0xff, 0xff, -0x1c, 0x63, 0xf8, 0x84, 0x83, 0x1d, 0x1f, 0x3f, 0x1f, 0x1c, 0x63, 0x64, 0xd8, 0x63, 0x1d, 0xff, -0xff, 0xff, 0x1c, 0xc4, 0x2c, 0x2c, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2c, 0x2c, 0x2c, 0x19, 0xff, -0x62, 0xd8, 0x84, 0x63, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0x63, 0xf8, 0xd8, 0x62, 0xff, -0xff, 0x1a, 0xa3, 0x2c, 0x2d, 0x2e, 0xa3, 0x1a, 0x1c, 0x1a, 0x82, 0x2e, 0x2d, 0x2c, 0xc4, 0x1b, -0x63, 0xf8, 0x84, 0x1d, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1b, 0xf8, 0xd8, 0x63, 0x1a, -0xff, 0x18, 0x2c, 0x2d, 0x2f, 0x82, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1a, 0x2d, 0x2c, 0x2c, 0xa9, -0xd8, 0x64, 0x83, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0xd8, 0x83, 0x1a, -0x1a, 0xa3, 0x2c, 0xeb, 0xa9, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x82, 0x2d, 0x2c, 0xca, -0xd8, 0x64, 0x83, 0x1f, 0x19, 0x1b, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1f, 0xd8, 0xd8, 0x83, 0x1a, -0x1a, 0xc4, 0x2c, 0x2f, 0x61, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1d, 0xc4, 0x2c, 0xeb, -0xd8, 0xf8, 0x83, 0x15, 0x01, 0x03, 0x1b, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0xf8, 0x83, 0x1a, -0x1a, 0xc4, 0x2c, 0x2f, 0x1c, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1c, 0x1b, 0x1e, 0xc4, 0x2d, 0x2f, -0x83, 0xd8, 0x64, 0x0f, 0x00, 0x01, 0x19, 0x3f, 0x3f, 0x3f, 0x3f, 0xfd, 0xd8, 0x64, 0x14, 0x1a, -0x1a, 0xc4, 0x2c, 0x2d, 0xda, 0x3f, 0x3f, 0x3f, 0x3f, 0x1c, 0x04, 0x02, 0x16, 0xc4, 0x2d, 0x2f, -0x89, 0xf8, 0xd8, 0x63, 0x12, 0x15, 0x1f, 0x3f, 0x3f, 0x3f, 0xfe, 0xd8, 0xf8, 0x84, 0x18, 0xff, -0x1a, 0xa9, 0x2c, 0x2c, 0x82, 0x3f, 0x3f, 0x3f, 0x3f, 0x1b, 0x02, 0x00, 0xa9, 0x2c, 0x2e, 0x2f, -0x1a, 0x83, 0xf8, 0xf8, 0xd8, 0xfd, 0x1f, 0x1f, 0x1e, 0xfd, 0xd8, 0xf8, 0x84, 0x89, 0x1a, 0xff, -0xff, 0x82, 0x2d, 0x2c, 0x2c, 0xda, 0x3f, 0x3f, 0x3f, 0x3f, 0x17, 0x13, 0xc4, 0x2d, 0xeb, 0xa9, -0x1a, 0x1a, 0x83, 0x84, 0x64, 0xf8, 0xd8, 0xd8, 0xd8, 0xf8, 0xf8, 0x84, 0x89, 0x1b, 0xff, 0xff, -0xff, 0x1a, 0xca, 0x2d, 0x2c, 0x2c, 0x5a, 0x1e, 0x3f, 0x1f, 0xda, 0xc4, 0x2c, 0xeb, 0x2f, 0x18, -0xff, 0xff, 0x1a, 0x89, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8a, 0x89, 0x1b, 0xff, 0xff, 0xff, -0xff, 0xff, 0x19, 0xeb, 0x2d, 0x2c, 0x2c, 0x2c, 0xc4, 0x2c, 0x2c, 0x2c, 0x2e, 0x2f, 0x13, 0xff, -0xff, 0xff, 0xff, 0x1a, 0x17, 0x89, 0x89, 0x8a, 0x89, 0x89, 0x18, 0x1a, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0x19, 0xca, 0x2e, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0xeb, 0x2f, 0x13, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1a, 0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0x1c, 0xa9, 0xca, 0xeb, 0xeb, 0xeb, 0xca, 0xa9, 0x18, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1a, 0x18, 0x61, 0x1b, 0x1a, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1c, 0x1b, 0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0x1c, 0x62, 0x63, 0xd8, 0xd8, 0xd8, 0x63, 0x62, 0x1d, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1e, 0x1e, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0x1a, 0xd8, 0xd8, 0xd8, 0xf8, 0xd8, 0xf8, 0xd8, 0xd8, 0x63, 0x1b, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0x1a, 0x18, 0xa3, 0xc4, 0xc4, 0xc4, 0xa9, 0x82, 0x1a, 0xff, 0xff, 0xff, +0xff, 0x1a, 0xd8, 0xd8, 0x64, 0x84, 0x83, 0x63, 0x63, 0x84, 0xf8, 0xd8, 0x63, 0x1b, 0xff, 0xff, +0xff, 0xff, 0xff, 0x1c, 0xa3, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0xc4, 0x1a, 0xff, 0xff, +0x1c, 0x63, 0xf8, 0x84, 0x83, 0x1d, 0x1f, 0x3f, 0x1f, 0x1c, 0x63, 0x64, 0xd8, 0x63, 0x1d, 0xff, +0xff, 0xff, 0x1c, 0xc4, 0x2c, 0x2c, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2c, 0x2c, 0x2c, 0x19, 0xff, +0x62, 0xd8, 0x84, 0x63, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0x63, 0xf8, 0xd8, 0x62, 0xff, +0xff, 0x1a, 0xa3, 0x2c, 0x2d, 0x2e, 0xa3, 0x1a, 0x1c, 0x1a, 0x82, 0x2e, 0x2d, 0x2c, 0xc4, 0x1b, +0x63, 0xf8, 0x84, 0x1d, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1b, 0xf8, 0xd8, 0x63, 0x1a, +0xff, 0x18, 0x2c, 0x2d, 0x2f, 0x82, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1a, 0x2d, 0x2c, 0x2c, 0xa9, +0xd8, 0x64, 0x83, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0xd8, 0x83, 0x1a, +0x1a, 0xa3, 0x2c, 0xeb, 0xa9, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x82, 0x2d, 0x2c, 0xca, +0xd8, 0x64, 0x83, 0x1f, 0x19, 0x1b, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1f, 0xd8, 0xd8, 0x83, 0x1a, +0x1a, 0xc4, 0x2c, 0x2f, 0x61, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1d, 0xc4, 0x2c, 0xeb, +0xd8, 0xf8, 0x83, 0x15, 0x01, 0x03, 0x1b, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0xf8, 0x83, 0x1a, +0x1a, 0xc4, 0x2c, 0x2f, 0x1c, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1c, 0x1b, 0x1e, 0xc4, 0x2d, 0x2f, +0x83, 0xd8, 0x64, 0x0f, 0x00, 0x01, 0x19, 0x3f, 0x3f, 0x3f, 0x3f, 0xfd, 0xd8, 0x64, 0x14, 0x1a, +0x1a, 0xc4, 0x2c, 0x2d, 0xda, 0x3f, 0x3f, 0x3f, 0x3f, 0x1c, 0x04, 0x02, 0x16, 0xc4, 0x2d, 0x2f, +0x89, 0xf8, 0xd8, 0x63, 0x12, 0x15, 0x1f, 0x3f, 0x3f, 0x3f, 0xfe, 0xd8, 0xf8, 0x84, 0x18, 0xff, +0x1a, 0xa9, 0x2c, 0x2c, 0x82, 0x3f, 0x3f, 0x3f, 0x3f, 0x1b, 0x02, 0x00, 0xa9, 0x2c, 0x2e, 0x2f, +0x1a, 0x83, 0xf8, 0xf8, 0xd8, 0xfd, 0x1f, 0x1f, 0x1e, 0xfd, 0xd8, 0xf8, 0x84, 0x89, 0x1a, 0xff, +0xff, 0x82, 0x2d, 0x2c, 0x2c, 0xda, 0x3f, 0x3f, 0x3f, 0x3f, 0x17, 0x13, 0xc4, 0x2d, 0xeb, 0xa9, +0x1a, 0x1a, 0x83, 0x84, 0x64, 0xf8, 0xd8, 0xd8, 0xd8, 0xf8, 0xf8, 0x84, 0x89, 0x1b, 0xff, 0xff, +0xff, 0x1a, 0xca, 0x2d, 0x2c, 0x2c, 0x5a, 0x1e, 0x3f, 0x1f, 0xda, 0xc4, 0x2c, 0xeb, 0x2f, 0x18, +0xff, 0xff, 0x1a, 0x89, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8a, 0x89, 0x1b, 0xff, 0xff, 0xff, +0xff, 0xff, 0x19, 0xeb, 0x2d, 0x2c, 0x2c, 0x2c, 0xc4, 0x2c, 0x2c, 0x2c, 0x2e, 0x2f, 0x13, 0xff, +0xff, 0xff, 0xff, 0x1a, 0x17, 0x89, 0x89, 0x8a, 0x89, 0x89, 0x18, 0x1a, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0x19, 0xca, 0x2e, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0xeb, 0x2f, 0x13, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1a, 0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0x1c, 0xa9, 0xca, 0xeb, 0xeb, 0xeb, 0xca, 0xa9, 0x18, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1a, 0x18, 0x61, 0x1b, 0x1a, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; #endif @@ -103,88 +103,88 @@ const char google_icon_L[] = { // icons by ahwayakchih const char google_icon_M[] = { -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1b, 0xd9, 0xd9, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0x82, 0x82, 0x19, 0xff, 0xff, 0xff, 0xd8, 0x64, 0x63, 0x63, 0xd8, 0xff, 0xff, -0xff, 0xff, 0x2c, 0x2d, 0x2d, 0x2c, 0xc4, 0xff, 0x62, 0x63, 0x1c, 0x3f, 0x1e, 0x63, 0xd8, 0xff, -0xff, 0x2c, 0xca, 0x1a, 0x1d, 0x82, 0x2d, 0xa3, 0xd8, 0x62, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0x1a, -0x82, 0x2d, 0x1a, 0x3f, 0x3f, 0x3f, 0xa3, 0x2d, 0xd8, 0x62, 0x0e, 0x1e, 0x3f, 0x1f, 0xd8, 0x62, -0x82, 0x2d, 0x1d, 0x3f, 0x3f, 0x0f, 0x82, 0x2e, 0x63, 0x83, 0x0a, 0x1e, 0x3f, 0xfd, 0x64, 0xff, -0xff, 0x2c, 0x5a, 0x3f, 0x1e, 0x0b, 0xc4, 0xeb, 0xff, 0x64, 0xd8, 0xd9, 0xd9, 0x64, 0x83, 0xff, -0xff, 0xca, 0x2c, 0xa3, 0x5a, 0xc4, 0x2e, 0x82, 0xff, 0xff, 0x83, 0x8a, 0x89, 0x17, 0xff, 0xff, -0xff, 0xff, 0xa9, 0x2e, 0x2e, 0xca, 0x82, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1b, 0xd9, 0xd9, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0x82, 0x82, 0x19, 0xff, 0xff, 0xff, 0xd8, 0x64, 0x63, 0x63, 0xd8, 0xff, 0xff, +0xff, 0xff, 0x2c, 0x2d, 0x2d, 0x2c, 0xc4, 0xff, 0x62, 0x63, 0x1c, 0x3f, 0x1e, 0x63, 0xd8, 0xff, +0xff, 0x2c, 0xca, 0x1a, 0x1d, 0x82, 0x2d, 0xa3, 0xd8, 0x62, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0x1a, +0x82, 0x2d, 0x1a, 0x3f, 0x3f, 0x3f, 0xa3, 0x2d, 0xd8, 0x62, 0x0e, 0x1e, 0x3f, 0x1f, 0xd8, 0x62, +0x82, 0x2d, 0x1d, 0x3f, 0x3f, 0x0f, 0x82, 0x2e, 0x63, 0x83, 0x0a, 0x1e, 0x3f, 0xfd, 0x64, 0xff, +0xff, 0x2c, 0x5a, 0x3f, 0x1e, 0x0b, 0xc4, 0xeb, 0xff, 0x64, 0xd8, 0xd9, 0xd9, 0x64, 0x83, 0xff, +0xff, 0xca, 0x2c, 0xa3, 0x5a, 0xc4, 0x2e, 0x82, 0xff, 0xff, 0x83, 0x8a, 0x89, 0x17, 0xff, 0xff, +0xff, 0xff, 0xa9, 0x2e, 0x2e, 0xca, 0x82, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; const char google_icon_L[] = { -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x1b, -0x09, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x1c, -0x1b, 0x1c, 0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x1b, 0x09, 0x08, -0x1c, 0x1c, 0x1b, 0x1c, 0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x1c, 0x1b, 0x1c, -0x08, 0x09, 0x1c, 0x1b, 0x1c, 0x1b, 0x09, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x1b, 0x09, 0x08, 0x1c, 0x1c, -0x1b, 0x1c, 0x08, 0x09, 0x1c, 0x1b, 0x1c, 0x1b, 0x09, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x1c, 0x1b, 0x1c, 0x08, 0x09, -0x1c, 0x1b, 0x1c, 0x1b, 0x09, 0x08, 0x1c, 0x1c, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x1b, 0x09, 0x08, 0x1c, 0x1c, 0x1b, 0x1c, -0x08, 0x09, 0x1c, 0x1b, 0x1c, 0x1b, 0x09, 0x00, 0x1c, 0x00, 0xd9, 0x00, 0x00, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x04, 0x04, 0x1c, 0x1c, 0x1b, 0x09, 0x08, 0x1c, 0x1b, -0x1c, 0x1c, 0x08, 0x09, 0x1b, 0x1c, 0x1c, 0x00, 0x15, 0x00, 0xd1, 0xd9, 0xd9, 0x00, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x1b, 0x1c, 0x09, 0x08, -0x1c, 0x1b, 0x1c, 0x1c, 0x08, 0x00, 0x1c, 0x00, 0x15, 0x00, 0xd1, 0xd1, 0xd9, 0x00, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0x04, 0x04, 0x04, 0x1c, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x1b, 0x1c, -0x09, 0x08, 0x1c, 0x1b, 0x1c, 0x00, 0x15, 0x00, 0x15, 0x00, 0xd1, 0xd9, 0xaa, 0x01, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0x04, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, -0x1b, 0x1c, 0x09, 0x00, 0x1b, 0x00, 0x15, 0x00, 0x0f, 0x00, 0xd9, 0xaa, 0xaa, 0x00, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0x04, 0x3f, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x3f, 0x3f, 0x08, 0x09, -0x1b, 0x1c, 0x1b, 0x00, 0x16, 0x00, 0x15, 0x00, 0x0f, 0xd9, 0xaa, 0xaa, 0xaa, 0x00, 0xff, 0xff, -0xff, 0xff, 0xff, 0x00, 0x04, 0x3f, 0x1b, 0x1c, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x3f, 0x3f, -0x08, 0x00, 0x1c, 0x00, 0x15, 0x00, 0x0f, 0x00, 0xd9, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0xff, 0xff, -0xff, 0xff, 0x00, 0xd9, 0x04, 0x3f, 0x1b, 0x1c, 0x1b, 0x1c, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, -0x3f, 0x00, 0x15, 0x00, 0x15, 0x00, 0x0f, 0xd9, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x0f, 0xff, -0xff, 0x00, 0xd9, 0xd1, 0x04, 0x15, 0x1a, 0x19, 0x1c, 0x1b, 0x1c, 0x1c, 0x3f, 0x3f, 0x08, 0x00, -0x1c, 0x00, 0x15, 0x00, 0x0f, 0x00, 0x63, 0xd8, 0xd8, 0xd8, 0x63, 0x62, 0xaa, 0x00, 0x0f, 0xff, -0xff, 0x00, 0xd9, 0xd9, 0x04, 0x0f, 0x15, 0x15, 0x1a, 0x19, 0x1c, 0x1c, 0x1b, 0x1c, 0x3f, 0x00, -0x15, 0x00, 0x15, 0x00, 0xd8, 0xd8, 0xd8, 0xf8, 0xd8, 0xf8, 0xd8, 0xd8, 0x63, 0x0f, 0x0f, 0xff, -0xff, 0x00, 0x83, 0x83, 0xd9, 0xd9, 0x0f, 0xa3, 0xc4, 0xc4, 0xc4, 0xa9, 0x82, 0x1c, 0x1b, 0x00, -0x15, 0x00, 0x0f, 0xd8, 0xd8, 0x64, 0x84, 0x83, 0x63, 0x63, 0x84, 0xf8, 0xd8, 0x63, 0xff, 0xff, -0xff, 0x00, 0x83, 0x83, 0x83, 0xa3, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0xc4, 0x1c, 0x00, -0x15, 0x00, 0x63, 0xf8, 0x84, 0x83, 0x1d, 0x3f, 0x3f, 0x3f, 0x1c, 0x63, 0x64, 0xd8, 0x63, 0xff, -0xff, 0x00, 0x83, 0x83, 0xc4, 0x2c, 0x2c, 0x2d, 0xeb, 0xeb, 0xeb, 0xeb, 0x2c, 0x2c, 0x2c, 0x00, -0x0f, 0x62, 0xd8, 0x84, 0x63, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0x63, 0xf8, 0xd8, 0x62, -0xff, 0x00, 0x83, 0xa3, 0x2c, 0x2d, 0xeb, 0xa3, 0x1a, 0x1c, 0x1a, 0x82, 0xeb, 0x2d, 0x2c, 0xc4, -0x0f, 0x63, 0xf8, 0x84, 0x1d, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1b, 0xf8, 0xd8, 0x63, -0xff, 0x00, 0x83, 0x2c, 0x2d, 0x2f, 0x82, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1a, 0x2d, 0x2c, 0x2c, -0xa9, 0xd8, 0x64, 0x83, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0xd8, 0x83, -0xff, 0x00, 0xa3, 0x2c, 0xeb, 0xa9, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x82, 0x2d, 0x2c, -0xca, 0xd8, 0x64, 0x83, 0x3f, 0x19, 0x1b, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xd8, 0xd8, 0x83, -0xff, 0x00, 0xc4, 0x2c, 0x2f, 0x19, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1d, 0xc4, 0x2c, -0xeb, 0xd8, 0xf8, 0x83, 0x15, 0x01, 0x03, 0x1b, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0xf8, 0x83, -0xff, 0x00, 0xc4, 0x2c, 0x2f, 0x1c, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1c, 0x1b, 0x1e, 0xc4, 0x2d, -0x2f, 0x83, 0xd8, 0x64, 0x0f, 0x00, 0x01, 0x19, 0x3f, 0x3f, 0x3f, 0x3f, 0xfd, 0xd8, 0x64, 0x14, -0xff, 0x00, 0xc4, 0x2c, 0x2d, 0xda, 0x3f, 0x3f, 0x3f, 0x3f, 0x1c, 0x04, 0x02, 0x16, 0xc4, 0x2d, -0x2f, 0x89, 0xf8, 0xd8, 0x63, 0x12, 0x15, 0x3f, 0x3f, 0x3f, 0x3f, 0xfe, 0xd8, 0xf8, 0x84, 0x14, -0xff, 0xff, 0xa9, 0x2c, 0x2c, 0x82, 0x3f, 0x3f, 0x3f, 0x3f, 0x1b, 0x02, 0x00, 0xa9, 0x2c, 0xeb, -0x2f, 0xaa, 0x83, 0xf8, 0xf8, 0xd8, 0xfd, 0x3f, 0x3f, 0x1e, 0xfd, 0xd8, 0xf8, 0x84, 0x89, 0xff, -0xff, 0xff, 0x82, 0x2d, 0x2c, 0x2c, 0xda, 0x3f, 0x3f, 0x3f, 0x3f, 0x17, 0x13, 0xc4, 0x2d, 0xeb, -0xa9, 0x00, 0x0f, 0x83, 0x84, 0x64, 0xf8, 0xd8, 0xd8, 0xd8, 0xf8, 0xf8, 0x84, 0x89, 0xff, 0xff, -0xff, 0xff, 0xff, 0xca, 0x2d, 0x2c, 0x2c, 0x5a, 0x1e, 0x3f, 0x3f, 0xda, 0xc4, 0x2c, 0xeb, 0x2f, -0x00, 0x0f, 0x0f, 0xff, 0x89, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8a, 0x89, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xeb, 0x2d, 0x2c, 0x2c, 0x2c, 0xc4, 0x2c, 0x2c, 0x2c, 0xeb, 0x2f, 0x00, -0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0x89, 0x89, 0x8a, 0x89, 0x89, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xca, 0xeb, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0xeb, 0x2f, 0x00, 0x0f, -0x0e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa9, 0xca, 0xeb, 0xeb, 0xeb, 0xca, 0xa9, 0x00, 0x0e, 0x0f, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x1b, +0x09, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x1c, +0x1b, 0x1c, 0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x1b, 0x09, 0x08, +0x1c, 0x1c, 0x1b, 0x1c, 0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x1c, 0x1b, 0x1c, +0x08, 0x09, 0x1c, 0x1b, 0x1c, 0x1b, 0x09, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x1b, 0x09, 0x08, 0x1c, 0x1c, +0x1b, 0x1c, 0x08, 0x09, 0x1c, 0x1b, 0x1c, 0x1b, 0x09, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x1c, 0x1b, 0x1c, 0x08, 0x09, +0x1c, 0x1b, 0x1c, 0x1b, 0x09, 0x08, 0x1c, 0x1c, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x1b, 0x09, 0x08, 0x1c, 0x1c, 0x1b, 0x1c, +0x08, 0x09, 0x1c, 0x1b, 0x1c, 0x1b, 0x09, 0x00, 0x1c, 0x00, 0xd9, 0x00, 0x00, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x04, 0x04, 0x1c, 0x1c, 0x1b, 0x09, 0x08, 0x1c, 0x1b, +0x1c, 0x1c, 0x08, 0x09, 0x1b, 0x1c, 0x1c, 0x00, 0x15, 0x00, 0xd1, 0xd9, 0xd9, 0x00, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x1b, 0x1c, 0x09, 0x08, +0x1c, 0x1b, 0x1c, 0x1c, 0x08, 0x00, 0x1c, 0x00, 0x15, 0x00, 0xd1, 0xd1, 0xd9, 0x00, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0x04, 0x04, 0x04, 0x1c, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x1b, 0x1c, +0x09, 0x08, 0x1c, 0x1b, 0x1c, 0x00, 0x15, 0x00, 0x15, 0x00, 0xd1, 0xd9, 0xaa, 0x01, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0x04, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, +0x1b, 0x1c, 0x09, 0x00, 0x1b, 0x00, 0x15, 0x00, 0x0f, 0x00, 0xd9, 0xaa, 0xaa, 0x00, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0x04, 0x3f, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x3f, 0x3f, 0x08, 0x09, +0x1b, 0x1c, 0x1b, 0x00, 0x16, 0x00, 0x15, 0x00, 0x0f, 0xd9, 0xaa, 0xaa, 0xaa, 0x00, 0xff, 0xff, +0xff, 0xff, 0xff, 0x00, 0x04, 0x3f, 0x1b, 0x1c, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, 0x3f, 0x3f, +0x08, 0x00, 0x1c, 0x00, 0x15, 0x00, 0x0f, 0x00, 0xd9, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0xff, 0xff, +0xff, 0xff, 0x00, 0xd9, 0x04, 0x3f, 0x1b, 0x1c, 0x1b, 0x1c, 0x3f, 0x3f, 0x08, 0x09, 0x1b, 0x1c, +0x3f, 0x00, 0x15, 0x00, 0x15, 0x00, 0x0f, 0xd9, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x0f, 0xff, +0xff, 0x00, 0xd9, 0xd1, 0x04, 0x15, 0x1a, 0x19, 0x1c, 0x1b, 0x1c, 0x1c, 0x3f, 0x3f, 0x08, 0x00, +0x1c, 0x00, 0x15, 0x00, 0x0f, 0x00, 0x63, 0xd8, 0xd8, 0xd8, 0x63, 0x62, 0xaa, 0x00, 0x0f, 0xff, +0xff, 0x00, 0xd9, 0xd9, 0x04, 0x0f, 0x15, 0x15, 0x1a, 0x19, 0x1c, 0x1c, 0x1b, 0x1c, 0x3f, 0x00, +0x15, 0x00, 0x15, 0x00, 0xd8, 0xd8, 0xd8, 0xf8, 0xd8, 0xf8, 0xd8, 0xd8, 0x63, 0x0f, 0x0f, 0xff, +0xff, 0x00, 0x83, 0x83, 0xd9, 0xd9, 0x0f, 0xa3, 0xc4, 0xc4, 0xc4, 0xa9, 0x82, 0x1c, 0x1b, 0x00, +0x15, 0x00, 0x0f, 0xd8, 0xd8, 0x64, 0x84, 0x83, 0x63, 0x63, 0x84, 0xf8, 0xd8, 0x63, 0xff, 0xff, +0xff, 0x00, 0x83, 0x83, 0x83, 0xa3, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0xc4, 0x1c, 0x00, +0x15, 0x00, 0x63, 0xf8, 0x84, 0x83, 0x1d, 0x3f, 0x3f, 0x3f, 0x1c, 0x63, 0x64, 0xd8, 0x63, 0xff, +0xff, 0x00, 0x83, 0x83, 0xc4, 0x2c, 0x2c, 0x2d, 0xeb, 0xeb, 0xeb, 0xeb, 0x2c, 0x2c, 0x2c, 0x00, +0x0f, 0x62, 0xd8, 0x84, 0x63, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0x63, 0xf8, 0xd8, 0x62, +0xff, 0x00, 0x83, 0xa3, 0x2c, 0x2d, 0xeb, 0xa3, 0x1a, 0x1c, 0x1a, 0x82, 0xeb, 0x2d, 0x2c, 0xc4, +0x0f, 0x63, 0xf8, 0x84, 0x1d, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1b, 0xf8, 0xd8, 0x63, +0xff, 0x00, 0x83, 0x2c, 0x2d, 0x2f, 0x82, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1a, 0x2d, 0x2c, 0x2c, +0xa9, 0xd8, 0x64, 0x83, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0xd8, 0x83, +0xff, 0x00, 0xa3, 0x2c, 0xeb, 0xa9, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x82, 0x2d, 0x2c, +0xca, 0xd8, 0x64, 0x83, 0x3f, 0x19, 0x1b, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xd8, 0xd8, 0x83, +0xff, 0x00, 0xc4, 0x2c, 0x2f, 0x19, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1d, 0xc4, 0x2c, +0xeb, 0xd8, 0xf8, 0x83, 0x15, 0x01, 0x03, 0x1b, 0x3f, 0x3f, 0x3f, 0x3f, 0x1e, 0xd8, 0xf8, 0x83, +0xff, 0x00, 0xc4, 0x2c, 0x2f, 0x1c, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1c, 0x1b, 0x1e, 0xc4, 0x2d, +0x2f, 0x83, 0xd8, 0x64, 0x0f, 0x00, 0x01, 0x19, 0x3f, 0x3f, 0x3f, 0x3f, 0xfd, 0xd8, 0x64, 0x14, +0xff, 0x00, 0xc4, 0x2c, 0x2d, 0xda, 0x3f, 0x3f, 0x3f, 0x3f, 0x1c, 0x04, 0x02, 0x16, 0xc4, 0x2d, +0x2f, 0x89, 0xf8, 0xd8, 0x63, 0x12, 0x15, 0x3f, 0x3f, 0x3f, 0x3f, 0xfe, 0xd8, 0xf8, 0x84, 0x14, +0xff, 0xff, 0xa9, 0x2c, 0x2c, 0x82, 0x3f, 0x3f, 0x3f, 0x3f, 0x1b, 0x02, 0x00, 0xa9, 0x2c, 0xeb, +0x2f, 0xaa, 0x83, 0xf8, 0xf8, 0xd8, 0xfd, 0x3f, 0x3f, 0x1e, 0xfd, 0xd8, 0xf8, 0x84, 0x89, 0xff, +0xff, 0xff, 0x82, 0x2d, 0x2c, 0x2c, 0xda, 0x3f, 0x3f, 0x3f, 0x3f, 0x17, 0x13, 0xc4, 0x2d, 0xeb, +0xa9, 0x00, 0x0f, 0x83, 0x84, 0x64, 0xf8, 0xd8, 0xd8, 0xd8, 0xf8, 0xf8, 0x84, 0x89, 0xff, 0xff, +0xff, 0xff, 0xff, 0xca, 0x2d, 0x2c, 0x2c, 0x5a, 0x1e, 0x3f, 0x3f, 0xda, 0xc4, 0x2c, 0xeb, 0x2f, +0x00, 0x0f, 0x0f, 0xff, 0x89, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8a, 0x89, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xeb, 0x2d, 0x2c, 0x2c, 0x2c, 0xc4, 0x2c, 0x2c, 0x2c, 0xeb, 0x2f, 0x00, +0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0x89, 0x89, 0x8a, 0x89, 0x89, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xca, 0xeb, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0xeb, 0x2f, 0x00, 0x0f, +0x0e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa9, 0xca, 0xeb, 0xeb, 0xeb, 0xca, 0xa9, 0x00, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -440,32 +440,32 @@ static uint8 template_1_attrs_8[] = { 0x00, 0x00, 0x82, 0x43, 0x00, 0x00, 0xA0, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x9F, 0x44, 0x00, 0xC0, 0x7F, 0x44, 0xFF, 0xFF, 0xFF, 0xFF }; static uint8 template_1_attrs_9[] = { - 0x00, 0x00, 0x00, 0x00, 0x58, 0x10, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, + 0x00, 0x00, 0x00, 0x00, 0x58, 0x10, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x00, 0x00, 0x0c, 0x44 }; /*static uint8 template_1_attrs_10[] = { - 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x54, 0x69, 0x74, 0x6c, - 0x65, 0x00, 0x00, 0x00, 0x20, 0x42, 0x00, 0x00, 0x50, 0x43, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x00, 0x00, 0x4d, 0x45, 0x54, 0x41, 0x3a, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x00, 0x52, 0x7d, 0xfb, - 0x77, 0x52, 0x54, 0x53, 0x43, 0x00, 0x01, 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x55, 0x52, 0x4c, 0x00, 0x00, 0x80, 0x83, 0x43, 0x00, 0x80, 0x85, 0x43, 0x00, - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4d, 0x45, 0x54, 0x41, 0x3a, 0x75, 0x72, 0x6c, 0x00, - 0x52, 0x54, 0x5b, 0xe3, 0x52, 0x54, 0x53, 0x43, 0x00, 0x01, 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x00, 0x00, - 0x40, 0x08, 0x44, 0x00, 0x00, 0x02, 0x43, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4d, - 0x45, 0x54, 0x41, 0x3a, 0x6b, 0x65, 0x79, 0x77, 0x00, 0x52, 0xdc, 0xf3, 0xdb, 0x52, 0x54, 0x53, - 0x43, 0x00, 0x01, 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4d, - 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x00, 0x00, 0x80, 0x2c, 0x44, 0x00, 0x00, 0x16, 0x43, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x2f, 0x6d, 0x6f, - 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x00, 0x45, 0x6d, 0x4b, 0x5d, 0x45, 0x4d, 0x49, 0x54, 0x01, - 0x00, 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x47, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x00, 0x00, 0xc0, 0x55, 0x44, 0x00, 0x00, - 0x70, 0x41, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x47, 0x4f, 0x4f, 0x47, 0x4c, 0x45, - 0x3a, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x00, 0x47, 0xde, 0xef, 0xfc, 0x47, 0x4e, 0x4f, 0x4c, 0x00, + 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x54, 0x69, 0x74, 0x6c, + 0x65, 0x00, 0x00, 0x00, 0x20, 0x42, 0x00, 0x00, 0x50, 0x43, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, + 0x00, 0x00, 0x4d, 0x45, 0x54, 0x41, 0x3a, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x00, 0x52, 0x7d, 0xfb, + 0x77, 0x52, 0x54, 0x53, 0x43, 0x00, 0x01, 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x55, 0x52, 0x4c, 0x00, 0x00, 0x80, 0x83, 0x43, 0x00, 0x80, 0x85, 0x43, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4d, 0x45, 0x54, 0x41, 0x3a, 0x75, 0x72, 0x6c, 0x00, + 0x52, 0x54, 0x5b, 0xe3, 0x52, 0x54, 0x53, 0x43, 0x00, 0x01, 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x00, 0x00, + 0x40, 0x08, 0x44, 0x00, 0x00, 0x02, 0x43, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4d, + 0x45, 0x54, 0x41, 0x3a, 0x6b, 0x65, 0x79, 0x77, 0x00, 0x52, 0xdc, 0xf3, 0xdb, 0x52, 0x54, 0x53, + 0x43, 0x00, 0x01, 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4d, + 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x00, 0x00, 0x80, 0x2c, 0x44, 0x00, 0x00, 0x16, 0x43, + 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x2f, 0x6d, 0x6f, + 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x00, 0x45, 0x6d, 0x4b, 0x5d, 0x45, 0x4d, 0x49, 0x54, 0x01, + 0x00, 0x52, 0x56, 0xf2, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x47, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x00, 0x00, 0xc0, 0x55, 0x44, 0x00, 0x00, + 0x70, 0x41, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x47, 0x4f, 0x4f, 0x47, 0x4c, 0x45, + 0x3a, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x00, 0x47, 0xde, 0xef, 0xfc, 0x47, 0x4e, 0x4f, 0x4c, 0x00, 0x00 };*/ static uint8 template_1_attrs_11[] = { - 0x52, 0xf5, 0x5e, 0x6f, 0x0a, 0x00, 0x00, 0x00, 0x74, 0x73, 0x6c, 0x54, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0xde, 0xef, 0xfc, 0x47, 0x4e, 0x4f, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0xf5, 0x5e, 0x6f, 0x0a, 0x00, 0x00, 0x00, 0x74, 0x73, 0x6c, 0x54, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x47, 0xde, 0xef, 0xfc, 0x47, 0x4e, 0x4f, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; struct attr_entry template_1_attrs[] = { { "BEOS:TYPE", /*B_MIME_STRING_TYPE*/'MIMS', SZSTR("application/x-vnd.Be-queryTemplate") }, @@ -580,37 +580,37 @@ struct attr_entry mailto_me_bookmark_attrs[] = { #if 0 File: Search Google a -Type Size Name Value +Type Size Name Value ---------- ---------- ---------------------------------- ----------------------------------------------------------------- -'MIMS' 35 "BEOS:TYPE" "application/x-vnd.Be-queryTemplate" +'MIMS' 35 "BEOS:TYPE" "application/x-vnd.Be-queryTemplate" STRING 191 "_trk/qrystr" "((name==\"*[aA][nN][yY] [qQ][uU][eE][sS][tT][iI][oO][nN] [yY][o" "O][uU]\\'[dD] [lL][iI][kK][eE] [tT][oO] [aA][sS][kK] [gG][oO][o" "O][gG][lL][eE] ?*\")&&(BEOS:TYPE==\"application/x-vnd.Be-bookma" - "rk\"))" -BOOL 1 "_trk/queryDynamicDate" TRUE -INT32 4 "_trk/recentQuery" 1 0x00000001 - 01 0F 47 4E 4F 4C 04 0C-63 72 65 61 74 69 6F 6E ..GNOL..creation - 44 61 74 65 51 EA C7 41-0F 47 4E 4C 4C 08 08 63 DateQ..A.GNLL..c - 61 70 61 63 69 74 79 00-00 00 00 00 00 00 00 0B apacity......... - 52 54 53 43 08 0A 64 65-76 69 63 65 4E 61 6D 65 RTSC..deviceName - 01 00 00 00 00 00 70 41-0B 52 54 53 43 10 0A 76 ......pA.RTSC..v - 6F 6C 75 6D 65 4E 61 6D-65 07 00 00 00 47 6F 6F olumeName....Goo - 67 6C 65 00 00 00 00 00-00 0B 52 54 53 43 10 07 gle.......RTSC.. - 66 73 68 4E 61 6D 65 09-00 00 00 67 6F 6F 67 6C fshName....googl - 65 66 73 00 00 00 00 00- efs..... -STRING 9 "_trk/qryinitmime" "Bookmark" -INT32 4 "_trk/qryinitmode" 1180858734 0x4662796E -RAW 36 "_trk/qrymoreoptions_le" 00 00 06 EC 00 00 00 00-01 00 00 00 00 00 00 00 ................ - 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ - 00 00 00 00 - .... -STRING 40 "_trk/qryinitstr" "Any question you'd like to ask google ?" -STRING 12 "_trk/focusedView" "TextControl" -INT32 4 "_trk/focusedSelEnd" 39 0x00000027 -INT32 4 "_trk/focusedSelStart" 0 0x00000000 -RAW 60 "_trk/xtpinfo_le" FF FF FF FF 00 00 00 00-00 00 00 00 00 00 00 00 ................ - 00 00 00 00 00 00 00 00-00 00 00 00 01 00 00 00 ................ - 00 00 82 43 00 00 A0 42-00 00 00 00 00 00 00 00 ...C...B........ - 00 E0 9F 44 00 C0 7F 44-FF FF FF FF ...D...D.... + "rk\"))" +BOOL 1 "_trk/queryDynamicDate" TRUE +INT32 4 "_trk/recentQuery" 1 0x00000001 + 01 0F 47 4E 4F 4C 04 0C-63 72 65 61 74 69 6F 6E ..GNOL..creation + 44 61 74 65 51 EA C7 41-0F 47 4E 4C 4C 08 08 63 DateQ..A.GNLL..c + 61 70 61 63 69 74 79 00-00 00 00 00 00 00 00 0B apacity......... + 52 54 53 43 08 0A 64 65-76 69 63 65 4E 61 6D 65 RTSC..deviceName + 01 00 00 00 00 00 70 41-0B 52 54 53 43 10 0A 76 ......pA.RTSC..v + 6F 6C 75 6D 65 4E 61 6D-65 07 00 00 00 47 6F 6F olumeName....Goo + 67 6C 65 00 00 00 00 00-00 0B 52 54 53 43 10 07 gle.......RTSC.. + 66 73 68 4E 61 6D 65 09-00 00 00 67 6F 6F 67 6C fshName....googl + 65 66 73 00 00 00 00 00- efs..... +STRING 9 "_trk/qryinitmime" "Bookmark" +INT32 4 "_trk/qryinitmode" 1180858734 0x4662796E +RAW 36 "_trk/qrymoreoptions_le" 00 00 06 EC 00 00 00 00-01 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ + 00 00 00 00 - .... +STRING 40 "_trk/qryinitstr" "Any question you'd like to ask google ?" +STRING 12 "_trk/focusedView" "TextControl" +INT32 4 "_trk/focusedSelEnd" 39 0x00000027 +INT32 4 "_trk/focusedSelStart" 0 0x00000000 +RAW 60 "_trk/xtpinfo_le" FF FF FF FF 00 00 00 00-00 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00-00 00 00 00 01 00 00 00 ................ + 00 00 82 43 00 00 A0 42-00 00 00 00 00 00 00 00 ...C...B........ + 00 E0 9F 44 00 C0 7F 44-FF FF FF FF ...D...D.... #endif #if 0 , 0x41, 0x6E, 0x79, 0x20, 0x71, 0x75, 0x65, 0x73-74, 0x69, 0x6F, 0x6E, 0x20, 0x79, 0x6F, 0x75 From 591d9620b5f7cb945210f47783a24d5f46b3b7d1 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Wed, 10 Aug 2011 00:10:58 +0000 Subject: [PATCH 161/702] Updated (TM) to (R). No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42613 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/googlefs/README.googlefs.txt | 6 +++--- src/add-ons/kernel/file_systems/googlefs/attrs.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/kernel/file_systems/googlefs/README.googlefs.txt b/src/add-ons/kernel/file_systems/googlefs/README.googlefs.txt index fb5df39d6c..7eb0742b21 100644 --- a/src/add-ons/kernel/file_systems/googlefs/README.googlefs.txt +++ b/src/add-ons/kernel/file_systems/googlefs/README.googlefs.txt @@ -1,9 +1,9 @@ -Welcome to the Google™ FileSystem for BeOS™, Zeta™ and Haiku™. +Welcome to the Google™ FileSystem for BeOS™, Zeta™ and Haiku®. Copyright© 2004, 2005, François Revol. Google is a trademark of Google,Inc. BeOS is a trademark of PalmSource. Zeta is a trademark of yellowTAB GmbH. -Haiku is a trademark of Haiku Inc. +Haiku is a trademark of Haiku, Inc. REQUIRES BONE @@ -26,4 +26,4 @@ An addon for Ingo Weinhold's UserlandFS is provided, compiled with debug printou To use it, startUserlandFSServer and run: ufs_mount googlefs /dev/zero /google -Enjoy. \ No newline at end of file +Enjoy. diff --git a/src/add-ons/kernel/file_systems/googlefs/attrs.c b/src/add-ons/kernel/file_systems/googlefs/attrs.c index 8e55c587e0..94c56f48b9 100644 --- a/src/add-ons/kernel/file_systems/googlefs/attrs.c +++ b/src/add-ons/kernel/file_systems/googlefs/attrs.c @@ -548,7 +548,7 @@ struct attr_entry text_attrs[] = { }; char *readmestr = \ -"Welcome to the Google™ FileSystem for BeOS™, Zeta™ and Haiku™.\n" +"Welcome to the Google™ FileSystem for BeOS™, Zeta™ and Haiku®.\n" "Copyright© 2004-2008, François Revol.\n" "Google is a trademark of Google, Inc.\n" "BeOS is a trademark of ACCESS.\n" From b6ac45afd279c2148c46c66da6766a8807d9c6e8 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Wed, 10 Aug 2011 00:20:03 +0000 Subject: [PATCH 162/702] Updated (TM) to (R). No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42614 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/aboutsystem/AboutSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index c48e55d40b..4c32e306f3 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -940,9 +940,9 @@ AboutView::_CreateCreditsView() fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey); fCreditsView->Insert(B_TRANSLATE("The copyright to the Haiku code is " "property of Haiku, Inc. or of the respective authors where expressly " - "noted in the source. Haiku" B_UTF8_TRADEMARK + "noted in the source. Haiku" B_UTF8_REGISTERED " and the HAIKU logo" B_UTF8_REGISTERED - " are (registered) trademarks of Haiku, Inc." + " are registered trademarks of Haiku, Inc." "\n\n")); fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue); From fcde9a3249fb92ca05cbb44b4037b4486025d823 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Wed, 10 Aug 2011 01:49:00 +0000 Subject: [PATCH 163/702] When stacking windows, move the new window to the parent position and size. Simplify the part in S&T that took care of it before. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42615 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 14 +++++++++- src/servers/app/stackandtile/SATGroup.cpp | 33 +++++++++++------------ 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 89ee819026..3d43bf34d8 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -2127,8 +2127,20 @@ Window::AddWindowToStack(Window* window) if (stack == NULL) return false; - // first collect dirt from the window to add BRegion dirty; + // move window to the own position + BRect ownFrame = Frame(); + BRect frame = window->Frame(); + float deltaToX = round(ownFrame.left - frame.left); + float deltaToY = round(ownFrame.top - frame.top); + frame.OffsetBy(deltaToX, deltaToY); + float deltaByX = round(ownFrame.right - frame.right); + float deltaByY = round(ownFrame.bottom - frame.bottom); + dirty.Include(&window->VisibleRegion()); + window->MoveBy(deltaToX, deltaToY, false); + window->ResizeBy(deltaByX, deltaByY, &dirty, false); + + // first collect dirt from the window to add ::Decorator* otherDecorator = window->Decorator(); if (otherDecorator != NULL) dirty.Include(otherDecorator->TitleBarRect()); diff --git a/src/servers/app/stackandtile/SATGroup.cpp b/src/servers/app/stackandtile/SATGroup.cpp index 4154d970da..beb1459ed4 100644 --- a/src/servers/app/stackandtile/SATGroup.cpp +++ b/src/servers/app/stackandtile/SATGroup.cpp @@ -485,32 +485,31 @@ WindowArea::_UnsetNeighbourCorner(Corner* neighbour, Corner* opponent) void -WindowArea::_MoveToSAT(SATWindow* topWindow) +WindowArea::_MoveToSAT(SATWindow* triggerWindow) { - int32 workspace = topWindow->GetWindow()->CurrentWorkspace(); - Desktop* desktop = topWindow->GetWindow()->Desktop(); + int32 workspace = triggerWindow->GetWindow()->CurrentWorkspace(); + Desktop* desktop = triggerWindow->GetWindow()->Desktop(); BRect frameSAT(LeftVar()->Value() - kMakePositiveOffset, TopVar()->Value() - kMakePositiveOffset, RightVar()->Value() - kMakePositiveOffset, BottomVar()->Value() - kMakePositiveOffset); - for (int32 i = 0; i < fWindowList.CountItems(); i++) { - SATWindow* window = fWindowList.ItemAt(i); - window->AdjustSizeLimits(frameSAT); + SATWindow* topWindow = TopWindow(); + topWindow->AdjustSizeLimits(frameSAT); - BRect frame = window->CompleteWindowFrame(); - float deltaToX = round(frameSAT.left - frame.left); - float deltaToY = round(frameSAT.top - frame.top); - frame.OffsetBy(deltaToX, deltaToY); - float deltaByX = round(frameSAT.right - frame.right); - float deltaByY = round(frameSAT.bottom - frame.bottom); + BRect frame = topWindow->CompleteWindowFrame(); + float deltaToX = round(frameSAT.left - frame.left); + float deltaToY = round(frameSAT.top - frame.top); + frame.OffsetBy(deltaToX, deltaToY); + float deltaByX = round(frameSAT.right - frame.right); + float deltaByY = round(frameSAT.bottom - frame.bottom); + + desktop->MoveWindowBy(topWindow->GetWindow(), deltaToX, deltaToY, + workspace); + // Update frame to the new position + desktop->ResizeWindowBy(topWindow->GetWindow(), deltaByX, deltaByY); - desktop->MoveWindowBy(window->GetWindow(), deltaToX, deltaToY, - workspace); - // Update frame to the new position - desktop->ResizeWindowBy(window->GetWindow(), deltaByX, deltaByY); - } UpdateSizeConstaints(frameSAT); } From d356bf503359f7581ac6c596588e70eff1f55117 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 10 Aug 2011 15:48:20 +0000 Subject: [PATCH 164/702] * consolidate and remove unneeded Xorg headers * move mc code to more generic gpu source/header * add gpu reset functions (with r600 documented) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42616 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon_hd/r600_reg.h | 5 - .../graphics/radeon_hd/r600_reg_auto_r6xx.h | 3087 ----------------- .../graphics/radeon_hd/r600_reg_r6xx.h | 504 --- .../graphics/radeon_hd/r600_reg_r7xx.h | 149 - src/add-ons/accelerants/radeon_hd/Jamfile | 2 +- .../accelerants/radeon_hd/accelerant.cpp | 2 +- src/add-ons/accelerants/radeon_hd/bios.cpp | 4 + src/add-ons/accelerants/radeon_hd/gpu.cpp | 217 ++ src/add-ons/accelerants/radeon_hd/gpu.h | 168 + src/add-ons/accelerants/radeon_hd/mc.cpp | 70 - src/add-ons/accelerants/radeon_hd/mc.h | 16 - src/add-ons/accelerants/radeon_hd/mode.h | 2 +- 12 files changed, 392 insertions(+), 3834 deletions(-) delete mode 100644 headers/private/graphics/radeon_hd/r600_reg_auto_r6xx.h delete mode 100644 headers/private/graphics/radeon_hd/r600_reg_r6xx.h delete mode 100644 headers/private/graphics/radeon_hd/r600_reg_r7xx.h create mode 100644 src/add-ons/accelerants/radeon_hd/gpu.cpp create mode 100644 src/add-ons/accelerants/radeon_hd/gpu.h delete mode 100644 src/add-ons/accelerants/radeon_hd/mc.cpp delete mode 100644 src/add-ons/accelerants/radeon_hd/mc.h diff --git a/headers/private/graphics/radeon_hd/r600_reg.h b/headers/private/graphics/radeon_hd/r600_reg.h index adbb61c09b..215c2a1de2 100644 --- a/headers/private/graphics/radeon_hd/r600_reg.h +++ b/headers/private/graphics/radeon_hd/r600_reg.h @@ -29,11 +29,6 @@ #define __R600_REG_H__ -#include "r600_reg_auto_r6xx.h" -#include "r600_reg_r6xx.h" -#include "r600_reg_r7xx.h" - - #define R600_PCIE_PORT_INDEX 0x0038 #define R600_PCIE_PORT_DATA 0x003c diff --git a/headers/private/graphics/radeon_hd/r600_reg_auto_r6xx.h b/headers/private/graphics/radeon_hd/r600_reg_auto_r6xx.h deleted file mode 100644 index fbbd45201f..0000000000 --- a/headers/private/graphics/radeon_hd/r600_reg_auto_r6xx.h +++ /dev/null @@ -1,3087 +0,0 @@ -/* - * RadeonHD R6xx, R7xx Register documentation - * - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * Copyright (C) 2008-2009 Matthias Hopf - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef _AUTOREGS -#define _AUTOREGS - -enum { - - VGT_VTX_VECT_EJECT_REG = 0x000088b0, - PRIM_COUNT_mask = 0x3ff << 0, - PRIM_COUNT_shift = 0, - VGT_LAST_COPY_STATE = 0x000088c0, - SRC_STATE_ID_mask = 0x07 << 0, - SRC_STATE_ID_shift = 0, - DST_STATE_ID_mask = 0x07 << 16, - DST_STATE_ID_shift = 16, - VGT_CACHE_INVALIDATION = 0x000088c4, - CACHE_INVALIDATION_mask = 0x03 << 0, - CACHE_INVALIDATION_shift = 0, - VC_ONLY = 0x00, - TC_ONLY = 0x01, - VC_AND_TC = 0x02, - VS_NO_EXTRA_BUFFER_bit = 1 << 5, - VGT_GS_PER_ES = 0x000088c8, - VGT_ES_PER_GS = 0x000088cc, - VGT_GS_VERTEX_REUSE = 0x000088d4, - VERT_REUSE_mask = 0x1f << 0, - VERT_REUSE_shift = 0, - VGT_MC_LAT_CNTL = 0x000088d8, - MC_TIME_STAMP_RES_mask = 0x03 << 0, - MC_TIME_STAMP_RES_shift = 0, - X_0_992_MAX_LATENCY = 0x00, - X_0_496_MAX_LATENCY = 0x01, - X_0_248_MAX_LATENCY = 0x02, - X_0_124_MAX_LATENCY = 0x03, - VGT_GS_PER_VS = 0x000088e8, - GS_PER_VS_mask = 0x0f << 0, - GS_PER_VS_shift = 0, - VGT_CNTL_STATUS = 0x000088f0, - VGT_OUT_INDX_BUSY_bit = 1 << 0, - VGT_OUT_BUSY_bit = 1 << 1, - VGT_PT_BUSY_bit = 1 << 2, - VGT_TE_BUSY_bit = 1 << 3, - VGT_VR_BUSY_bit = 1 << 4, - VGT_GRP_BUSY_bit = 1 << 5, - VGT_DMA_REQ_BUSY_bit = 1 << 6, - VGT_DMA_BUSY_bit = 1 << 7, - VGT_GS_BUSY_bit = 1 << 8, - VGT_BUSY_bit = 1 << 9, - VGT_PRIMITIVE_TYPE = 0x00008958, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask = 0x3f << 0, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift = 0, - DI_PT_NONE = 0x00, - DI_PT_POINTLIST = 0x01, - DI_PT_LINELIST = 0x02, - DI_PT_LINESTRIP = 0x03, - DI_PT_TRILIST = 0x04, - DI_PT_TRIFAN = 0x05, - DI_PT_TRISTRIP = 0x06, - DI_PT_UNUSED_0 = 0x07, - DI_PT_UNUSED_1 = 0x08, - DI_PT_UNUSED_2 = 0x09, - DI_PT_LINELIST_ADJ = 0x0a, - DI_PT_LINESTRIP_ADJ = 0x0b, - DI_PT_TRILIST_ADJ = 0x0c, - DI_PT_TRISTRIP_ADJ = 0x0d, - DI_PT_UNUSED_3 = 0x0e, - DI_PT_UNUSED_4 = 0x0f, - DI_PT_TRI_WITH_WFLAGS = 0x10, - DI_PT_RECTLIST = 0x11, - DI_PT_LINELOOP = 0x12, - DI_PT_QUADLIST = 0x13, - DI_PT_QUADSTRIP = 0x14, - DI_PT_POLYGON = 0x15, - DI_PT_2D_COPY_RECT_LIST_V0 = 0x16, - DI_PT_2D_COPY_RECT_LIST_V1 = 0x17, - DI_PT_2D_COPY_RECT_LIST_V2 = 0x18, - DI_PT_2D_COPY_RECT_LIST_V3 = 0x19, - DI_PT_2D_FILL_RECT_LIST = 0x1a, - DI_PT_2D_LINE_STRIP = 0x1b, - DI_PT_2D_TRI_STRIP = 0x1c, - VGT_INDEX_TYPE = 0x0000895c, - INDEX_TYPE_mask = 0x03 << 0, - INDEX_TYPE_shift = 0, - DI_INDEX_SIZE_16_BIT = 0x00, - DI_INDEX_SIZE_32_BIT = 0x01, - VGT_STRMOUT_BUFFER_FILLED_SIZE_0 = 0x00008960, - VGT_STRMOUT_BUFFER_FILLED_SIZE_1 = 0x00008964, - VGT_STRMOUT_BUFFER_FILLED_SIZE_2 = 0x00008968, - VGT_STRMOUT_BUFFER_FILLED_SIZE_3 = 0x0000896c, - VGT_NUM_INDICES = 0x00008970, - VGT_NUM_INSTANCES = 0x00008974, - PA_CL_CNTL_STATUS = 0x00008a10, - CL_BUSY_bit = 1 << 31, - PA_CL_ENHANCE = 0x00008a14, - CLIP_VTX_REORDER_ENA_bit = 1 << 0, - NUM_CLIP_SEQ_mask = 0x03 << 1, - NUM_CLIP_SEQ_shift = 1, - CLIPPED_PRIM_SEQ_STALL_bit = 1 << 3, - VE_NAN_PROC_DISABLE_bit = 1 << 4, - PA_SU_CNTL_STATUS = 0x00008a50, - SU_BUSY_bit = 1 << 31, - PA_SC_LINE_STIPPLE_STATE = 0x00008b10, - CURRENT_PTR_mask = 0x0f << 0, - CURRENT_PTR_shift = 0, - CURRENT_COUNT_mask = 0xff << 8, - CURRENT_COUNT_shift = 8, - PA_SC_MULTI_CHIP_CNTL = 0x00008b20, - LOG2_NUM_CHIPS_mask = 0x07 << 0, - LOG2_NUM_CHIPS_shift = 0, - MULTI_CHIP_TILE_SIZE_mask = 0x03 << 3, - MULTI_CHIP_TILE_SIZE_shift = 3, - X_16_X_16_PIXEL_TILE_PER_CHIP = 0x00, - X_32_X_32_PIXEL_TILE_PER_CHIP = 0x01, - X_64_X_64_PIXEL_TILE_PER_CHIP = 0x02, - X_128X128_PIXEL_TILE_PER_CHIP = 0x03, - CHIP_TILE_X_LOC_mask = 0x07 << 5, - CHIP_TILE_X_LOC_shift = 5, - CHIP_TILE_Y_LOC_mask = 0x07 << 8, - CHIP_TILE_Y_LOC_shift = 8, - CHIP_SUPER_TILE_B_bit = 1 << 11, - PA_SC_AA_SAMPLE_LOCS_2S = 0x00008b40, - S0_X_mask = 0x0f << 0, - S0_X_shift = 0, - S0_Y_mask = 0x0f << 4, - S0_Y_shift = 4, - S1_X_mask = 0x0f << 8, - S1_X_shift = 8, - S1_Y_mask = 0x0f << 12, - S1_Y_shift = 12, - PA_SC_AA_SAMPLE_LOCS_4S = 0x00008b44, -/* S0_X_mask = 0x0f << 0, */ -/* S0_X_shift = 0, */ -/* S0_Y_mask = 0x0f << 4, */ -/* S0_Y_shift = 4, */ -/* S1_X_mask = 0x0f << 8, */ -/* S1_X_shift = 8, */ -/* S1_Y_mask = 0x0f << 12, */ -/* S1_Y_shift = 12, */ - S2_X_mask = 0x0f << 16, - S2_X_shift = 16, - S2_Y_mask = 0x0f << 20, - S2_Y_shift = 20, - S3_X_mask = 0x0f << 24, - S3_X_shift = 24, - S3_Y_mask = 0x0f << 28, - S3_Y_shift = 28, - PA_SC_AA_SAMPLE_LOCS_8S_WD0 = 0x00008b48, -/* S0_X_mask = 0x0f << 0, */ -/* S0_X_shift = 0, */ -/* S0_Y_mask = 0x0f << 4, */ -/* S0_Y_shift = 4, */ -/* S1_X_mask = 0x0f << 8, */ -/* S1_X_shift = 8, */ -/* S1_Y_mask = 0x0f << 12, */ -/* S1_Y_shift = 12, */ -/* S2_X_mask = 0x0f << 16, */ -/* S2_X_shift = 16, */ -/* S2_Y_mask = 0x0f << 20, */ -/* S2_Y_shift = 20, */ -/* S3_X_mask = 0x0f << 24, */ -/* S3_X_shift = 24, */ -/* S3_Y_mask = 0x0f << 28, */ -/* S3_Y_shift = 28, */ - PA_SC_AA_SAMPLE_LOCS_8S_WD1 = 0x00008b4c, - S4_X_mask = 0x0f << 0, - S4_X_shift = 0, - S4_Y_mask = 0x0f << 4, - S4_Y_shift = 4, - S5_X_mask = 0x0f << 8, - S5_X_shift = 8, - S5_Y_mask = 0x0f << 12, - S5_Y_shift = 12, - S6_X_mask = 0x0f << 16, - S6_X_shift = 16, - S6_Y_mask = 0x0f << 20, - S6_Y_shift = 20, - S7_X_mask = 0x0f << 24, - S7_X_shift = 24, - S7_Y_mask = 0x0f << 28, - S7_Y_shift = 28, - PA_SC_CNTL_STATUS = 0x00008be0, - MPASS_OVERFLOW_bit = 1 << 30, - PA_SC_ENHANCE = 0x00008bf0, - FORCE_EOV_MAX_CLK_CNT_mask = 0xfff << 0, - FORCE_EOV_MAX_CLK_CNT_shift = 0, - FORCE_EOV_MAX_TILE_CNT_mask = 0xfff << 12, - FORCE_EOV_MAX_TILE_CNT_shift = 12, - SQ_CONFIG = 0x00008c00, - VC_ENABLE_bit = 1 << 0, - EXPORT_SRC_C_bit = 1 << 1, - DX9_CONSTS_bit = 1 << 2, - ALU_INST_PREFER_VECTOR_bit = 1 << 3, - SQ_CONFIG__DX10_CLAMP_bit = 1 << 4, - ALU_PREFER_ONE_WATERFALL_bit = 1 << 5, - ALU_MAX_ONE_WATERFALL_bit = 1 << 6, - CLAUSE_SEQ_PRIO_mask = 0x03 << 8, - CLAUSE_SEQ_PRIO_shift = 8, - SQ_CL_PRIO_RND_ROBIN = 0x00, - SQ_CL_PRIO_MACRO_SEQ = 0x01, - SQ_CL_PRIO_NONE = 0x02, - PS_PRIO_mask = 0x03 << 24, - PS_PRIO_shift = 24, - VS_PRIO_mask = 0x03 << 26, - VS_PRIO_shift = 26, - GS_PRIO_mask = 0x03 << 28, - GS_PRIO_shift = 28, - ES_PRIO_mask = 0x03 << 30, - ES_PRIO_shift = 30, - SQ_GPR_RESOURCE_MGMT_1 = 0x00008c04, - NUM_PS_GPRS_mask = 0xff << 0, - NUM_PS_GPRS_shift = 0, - NUM_VS_GPRS_mask = 0xff << 16, - NUM_VS_GPRS_shift = 16, - NUM_CLAUSE_TEMP_GPRS_mask = 0x0f << 28, - NUM_CLAUSE_TEMP_GPRS_shift = 28, - SQ_GPR_RESOURCE_MGMT_2 = 0x00008c08, - NUM_GS_GPRS_mask = 0xff << 0, - NUM_GS_GPRS_shift = 0, - NUM_ES_GPRS_mask = 0xff << 16, - NUM_ES_GPRS_shift = 16, - SQ_THREAD_RESOURCE_MGMT = 0x00008c0c, - NUM_PS_THREADS_mask = 0xff << 0, - NUM_PS_THREADS_shift = 0, - NUM_VS_THREADS_mask = 0xff << 8, - NUM_VS_THREADS_shift = 8, - NUM_GS_THREADS_mask = 0xff << 16, - NUM_GS_THREADS_shift = 16, - NUM_ES_THREADS_mask = 0xff << 24, - NUM_ES_THREADS_shift = 24, - SQ_STACK_RESOURCE_MGMT_1 = 0x00008c10, - NUM_PS_STACK_ENTRIES_mask = 0xfff << 0, - NUM_PS_STACK_ENTRIES_shift = 0, - NUM_VS_STACK_ENTRIES_mask = 0xfff << 16, - NUM_VS_STACK_ENTRIES_shift = 16, - SQ_STACK_RESOURCE_MGMT_2 = 0x00008c14, - NUM_GS_STACK_ENTRIES_mask = 0xfff << 0, - NUM_GS_STACK_ENTRIES_shift = 0, - NUM_ES_STACK_ENTRIES_mask = 0xfff << 16, - NUM_ES_STACK_ENTRIES_shift = 16, - SQ_ESGS_RING_BASE = 0x00008c40, - SQ_ESGS_RING_SIZE = 0x00008c44, - SQ_GSVS_RING_BASE = 0x00008c48, - SQ_GSVS_RING_SIZE = 0x00008c4c, - SQ_ESTMP_RING_BASE = 0x00008c50, - SQ_ESTMP_RING_SIZE = 0x00008c54, - SQ_GSTMP_RING_BASE = 0x00008c58, - SQ_GSTMP_RING_SIZE = 0x00008c5c, - SQ_VSTMP_RING_BASE = 0x00008c60, - SQ_VSTMP_RING_SIZE = 0x00008c64, - SQ_PSTMP_RING_BASE = 0x00008c68, - SQ_PSTMP_RING_SIZE = 0x00008c6c, - SQ_FBUF_RING_BASE = 0x00008c70, - SQ_FBUF_RING_SIZE = 0x00008c74, - SQ_REDUC_RING_BASE = 0x00008c78, - SQ_REDUC_RING_SIZE = 0x00008c7c, - SQ_ALU_WORD1_OP3 = 0x00008dfc, - SRC2_SEL_mask = 0x1ff << 0, - SRC2_SEL_shift = 0, - SQ_ALU_SRC_0 = 0xf8, - SQ_ALU_SRC_1 = 0xf9, - SQ_ALU_SRC_1_INT = 0xfa, - SQ_ALU_SRC_M_1_INT = 0xfb, - SQ_ALU_SRC_0_5 = 0xfc, - SQ_ALU_SRC_LITERAL = 0xfd, - SQ_ALU_SRC_PV = 0xfe, - SQ_ALU_SRC_PS = 0xff, - SRC2_REL_bit = 1 << 9, - SRC2_CHAN_mask = 0x03 << 10, - SRC2_CHAN_shift = 10, - SQ_CHAN_X = 0x00, - SQ_CHAN_Y = 0x01, - SQ_CHAN_Z = 0x02, - SQ_CHAN_W = 0x03, - SRC2_NEG_bit = 1 << 12, - SQ_ALU_WORD1_OP3__ALU_INST_mask = 0x1f << 13, - SQ_ALU_WORD1_OP3__ALU_INST_shift = 13, - SQ_OP3_INST_MUL_LIT = 0x0c, - SQ_OP3_INST_MUL_LIT_M2 = 0x0d, - SQ_OP3_INST_MUL_LIT_M4 = 0x0e, - SQ_OP3_INST_MUL_LIT_D2 = 0x0f, - SQ_OP3_INST_MULADD = 0x10, - SQ_OP3_INST_MULADD_M2 = 0x11, - SQ_OP3_INST_MULADD_M4 = 0x12, - SQ_OP3_INST_MULADD_D2 = 0x13, - SQ_OP3_INST_MULADD_IEEE = 0x14, - SQ_OP3_INST_MULADD_IEEE_M2 = 0x15, - SQ_OP3_INST_MULADD_IEEE_M4 = 0x16, - SQ_OP3_INST_MULADD_IEEE_D2 = 0x17, - SQ_OP3_INST_CNDE = 0x18, - SQ_OP3_INST_CNDGT = 0x19, - SQ_OP3_INST_CNDGE = 0x1a, - SQ_OP3_INST_CNDE_INT = 0x1c, - SQ_OP3_INST_CNDGT_INT = 0x1d, - SQ_OP3_INST_CNDGE_INT = 0x1e, - SQ_TEX_WORD2 = 0x00008dfc, - OFFSET_X_mask = 0x1f << 0, - OFFSET_X_shift = 0, - OFFSET_Y_mask = 0x1f << 5, - OFFSET_Y_shift = 5, - OFFSET_Z_mask = 0x1f << 10, - OFFSET_Z_shift = 10, - SAMPLER_ID_mask = 0x1f << 15, - SAMPLER_ID_shift = 15, - SQ_TEX_WORD2__SRC_SEL_X_mask = 0x07 << 20, - SQ_TEX_WORD2__SRC_SEL_X_shift = 20, - SQ_SEL_X = 0x00, - SQ_SEL_Y = 0x01, - SQ_SEL_Z = 0x02, - SQ_SEL_W = 0x03, - SQ_SEL_0 = 0x04, - SQ_SEL_1 = 0x05, - SRC_SEL_Y_mask = 0x07 << 23, - SRC_SEL_Y_shift = 23, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SRC_SEL_Z_mask = 0x07 << 26, - SRC_SEL_Z_shift = 26, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SRC_SEL_W_mask = 0x07 << 29, - SRC_SEL_W_shift = 29, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_CF_ALLOC_EXPORT_WORD1 = 0x00008dfc, - BURST_COUNT_mask = 0x0f << 17, - BURST_COUNT_shift = 17, - END_OF_PROGRAM_bit = 1 << 21, - VALID_PIXEL_MODE_bit = 1 << 22, - SQ_CF_ALLOC_EXPORT_WORD1__CF_INST_mask = 0x7f << 23, - SQ_CF_ALLOC_EXPORT_WORD1__CF_INST_shift = 23, - SQ_CF_INST_MEM_STREAM0 = 0x20, - SQ_CF_INST_MEM_STREAM1 = 0x21, - SQ_CF_INST_MEM_STREAM2 = 0x22, - SQ_CF_INST_MEM_STREAM3 = 0x23, - SQ_CF_INST_MEM_SCRATCH = 0x24, - SQ_CF_INST_MEM_REDUCTION = 0x25, - SQ_CF_INST_MEM_RING = 0x26, - SQ_CF_INST_EXPORT = 0x27, - SQ_CF_INST_EXPORT_DONE = 0x28, - WHOLE_QUAD_MODE_bit = 1 << 30, - BARRIER_bit = 1 << 31, - SQ_CF_ALU_WORD1 = 0x00008dfc, - KCACHE_MODE1_mask = 0x03 << 0, - KCACHE_MODE1_shift = 0, - SQ_CF_KCACHE_NOP = 0x00, - SQ_CF_KCACHE_LOCK_1 = 0x01, - SQ_CF_KCACHE_LOCK_2 = 0x02, - SQ_CF_KCACHE_LOCK_LOOP_INDEX = 0x03, - KCACHE_ADDR0_mask = 0xff << 2, - KCACHE_ADDR0_shift = 2, - KCACHE_ADDR1_mask = 0xff << 10, - KCACHE_ADDR1_shift = 10, - SQ_CF_ALU_WORD1__COUNT_mask = 0x7f << 18, - SQ_CF_ALU_WORD1__COUNT_shift = 18, - SQ_CF_ALU_WORD1__ALT_CONST_bit = 1 << 25, - SQ_CF_ALU_WORD1__CF_INST_mask = 0x0f << 26, - SQ_CF_ALU_WORD1__CF_INST_shift = 26, - SQ_CF_INST_ALU = 0x08, - SQ_CF_INST_ALU_PUSH_BEFORE = 0x09, - SQ_CF_INST_ALU_POP_AFTER = 0x0a, - SQ_CF_INST_ALU_POP2_AFTER = 0x0b, - SQ_CF_INST_ALU_CONTINUE = 0x0d, - SQ_CF_INST_ALU_BREAK = 0x0e, - SQ_CF_INST_ALU_ELSE_AFTER = 0x0f, -/* WHOLE_QUAD_MODE_bit = 1 << 30, */ -/* BARRIER_bit = 1 << 31, */ - SQ_TEX_WORD1 = 0x00008dfc, - SQ_TEX_WORD1__DST_GPR_mask = 0x7f << 0, - SQ_TEX_WORD1__DST_GPR_shift = 0, - SQ_TEX_WORD1__DST_REL_bit = 1 << 7, - SQ_TEX_WORD1__DST_SEL_X_mask = 0x07 << 9, - SQ_TEX_WORD1__DST_SEL_X_shift = 9, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_SEL_MASK = 0x07, - SQ_TEX_WORD1__DST_SEL_Y_mask = 0x07 << 12, - SQ_TEX_WORD1__DST_SEL_Y_shift = 12, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_TEX_WORD1__DST_SEL_Z_mask = 0x07 << 15, - SQ_TEX_WORD1__DST_SEL_Z_shift = 15, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_TEX_WORD1__DST_SEL_W_mask = 0x07 << 18, - SQ_TEX_WORD1__DST_SEL_W_shift = 18, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_TEX_WORD1__LOD_BIAS_mask = 0x7f << 21, - SQ_TEX_WORD1__LOD_BIAS_shift = 21, - COORD_TYPE_X_bit = 1 << 28, - COORD_TYPE_Y_bit = 1 << 29, - COORD_TYPE_Z_bit = 1 << 30, - COORD_TYPE_W_bit = 1 << 31, - SQ_VTX_WORD0 = 0x00008dfc, - VTX_INST_mask = 0x1f << 0, - VTX_INST_shift = 0, - SQ_VTX_INST_FETCH = 0x00, - SQ_VTX_INST_SEMANTIC = 0x01, - FETCH_TYPE_mask = 0x03 << 5, - FETCH_TYPE_shift = 5, - SQ_VTX_FETCH_VERTEX_DATA = 0x00, - SQ_VTX_FETCH_INSTANCE_DATA = 0x01, - SQ_VTX_FETCH_NO_INDEX_OFFSET = 0x02, - FETCH_WHOLE_QUAD_bit = 1 << 7, - BUFFER_ID_mask = 0xff << 8, - BUFFER_ID_shift = 8, - SRC_GPR_mask = 0x7f << 16, - SRC_GPR_shift = 16, - SRC_REL_bit = 1 << 23, - SQ_VTX_WORD0__SRC_SEL_X_mask = 0x03 << 24, - SQ_VTX_WORD0__SRC_SEL_X_shift = 24, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ - MEGA_FETCH_COUNT_mask = 0x3f << 26, - MEGA_FETCH_COUNT_shift = 26, - SQ_CF_ALLOC_EXPORT_WORD1_SWIZ = 0x00008dfc, - SEL_X_mask = 0x07 << 0, - SEL_X_shift = 0, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SEL_Y_mask = 0x07 << 3, - SEL_Y_shift = 3, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SEL_Z_mask = 0x07 << 6, - SEL_Z_shift = 6, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SEL_W_mask = 0x07 << 9, - SEL_W_shift = 9, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_ALU_WORD1 = 0x00008dfc, - ENCODING_mask = 0x07 << 15, - ENCODING_shift = 15, - BANK_SWIZZLE_mask = 0x07 << 18, - BANK_SWIZZLE_shift = 18, - SQ_ALU_VEC_012 = 0x00, - SQ_ALU_VEC_021 = 0x01, - SQ_ALU_VEC_120 = 0x02, - SQ_ALU_VEC_102 = 0x03, - SQ_ALU_VEC_201 = 0x04, - SQ_ALU_VEC_210 = 0x05, - SQ_ALU_WORD1__DST_GPR_mask = 0x7f << 21, - SQ_ALU_WORD1__DST_GPR_shift = 21, - SQ_ALU_WORD1__DST_REL_bit = 1 << 28, - DST_CHAN_mask = 0x03 << 29, - DST_CHAN_shift = 29, - CHAN_X = 0x00, - CHAN_Y = 0x01, - CHAN_Z = 0x02, - CHAN_W = 0x03, - SQ_ALU_WORD1__CLAMP_bit = 1 << 31, - SQ_CF_ALU_WORD0 = 0x00008dfc, - SQ_CF_ALU_WORD0__ADDR_mask = 0x3fffff << 0, - SQ_CF_ALU_WORD0__ADDR_shift = 0, - KCACHE_BANK0_mask = 0x0f << 22, - KCACHE_BANK0_shift = 22, - KCACHE_BANK1_mask = 0x0f << 26, - KCACHE_BANK1_shift = 26, - KCACHE_MODE0_mask = 0x03 << 30, - KCACHE_MODE0_shift = 30, -/* SQ_CF_KCACHE_NOP = 0x00, */ -/* SQ_CF_KCACHE_LOCK_1 = 0x01, */ -/* SQ_CF_KCACHE_LOCK_2 = 0x02, */ -/* SQ_CF_KCACHE_LOCK_LOOP_INDEX = 0x03, */ - SQ_VTX_WORD2 = 0x00008dfc, - SQ_VTX_WORD2__OFFSET_mask = 0xffff << 0, - SQ_VTX_WORD2__OFFSET_shift = 0, - SQ_VTX_WORD2__ENDIAN_SWAP_mask = 0x03 << 16, - SQ_VTX_WORD2__ENDIAN_SWAP_shift = 16, - SQ_ENDIAN_NONE = 0x00, - SQ_ENDIAN_8IN16 = 0x01, - SQ_ENDIAN_8IN32 = 0x02, - CONST_BUF_NO_STRIDE_bit = 1 << 18, - MEGA_FETCH_bit = 1 << 19, - SQ_VTX_WORD2__ALT_CONST_bit = 1 << 20, - SQ_ALU_WORD1_OP2_V2 = 0x00008dfc, - SRC0_ABS_bit = 1 << 0, - SRC1_ABS_bit = 1 << 1, - UPDATE_EXECUTE_MASK_bit = 1 << 2, - UPDATE_PRED_bit = 1 << 3, - WRITE_MASK_bit = 1 << 4, - SQ_ALU_WORD1_OP2_V2__OMOD_mask = 0x03 << 5, - SQ_ALU_WORD1_OP2_V2__OMOD_shift = 5, - SQ_ALU_OMOD_OFF = 0x00, - SQ_ALU_OMOD_M2 = 0x01, - SQ_ALU_OMOD_M4 = 0x02, - SQ_ALU_OMOD_D2 = 0x03, - SQ_ALU_WORD1_OP2_V2__ALU_INST_mask = 0x7ff << 7, - SQ_ALU_WORD1_OP2_V2__ALU_INST_shift = 7, - SQ_OP2_INST_ADD = 0x00, - SQ_OP2_INST_MUL = 0x01, - SQ_OP2_INST_MUL_IEEE = 0x02, - SQ_OP2_INST_MAX = 0x03, - SQ_OP2_INST_MIN = 0x04, - SQ_OP2_INST_MAX_DX10 = 0x05, - SQ_OP2_INST_MIN_DX10 = 0x06, - SQ_OP2_INST_SETE = 0x08, - SQ_OP2_INST_SETGT = 0x09, - SQ_OP2_INST_SETGE = 0x0a, - SQ_OP2_INST_SETNE = 0x0b, - SQ_OP2_INST_SETE_DX10 = 0x0c, - SQ_OP2_INST_SETGT_DX10 = 0x0d, - SQ_OP2_INST_SETGE_DX10 = 0x0e, - SQ_OP2_INST_SETNE_DX10 = 0x0f, - SQ_OP2_INST_FRACT = 0x10, - SQ_OP2_INST_TRUNC = 0x11, - SQ_OP2_INST_CEIL = 0x12, - SQ_OP2_INST_RNDNE = 0x13, - SQ_OP2_INST_FLOOR = 0x14, - SQ_OP2_INST_MOVA = 0x15, - SQ_OP2_INST_MOVA_FLOOR = 0x16, - SQ_OP2_INST_MOVA_INT = 0x18, - SQ_OP2_INST_MOV = 0x19, - SQ_OP2_INST_NOP = 0x1a, - SQ_OP2_INST_PRED_SETGT_UINT = 0x1e, - SQ_OP2_INST_PRED_SETGE_UINT = 0x1f, - SQ_OP2_INST_PRED_SETE = 0x20, - SQ_OP2_INST_PRED_SETGT = 0x21, - SQ_OP2_INST_PRED_SETGE = 0x22, - SQ_OP2_INST_PRED_SETNE = 0x23, - SQ_OP2_INST_PRED_SET_INV = 0x24, - SQ_OP2_INST_PRED_SET_POP = 0x25, - SQ_OP2_INST_PRED_SET_CLR = 0x26, - SQ_OP2_INST_PRED_SET_RESTORE = 0x27, - SQ_OP2_INST_PRED_SETE_PUSH = 0x28, - SQ_OP2_INST_PRED_SETGT_PUSH = 0x29, - SQ_OP2_INST_PRED_SETGE_PUSH = 0x2a, - SQ_OP2_INST_PRED_SETNE_PUSH = 0x2b, - SQ_OP2_INST_KILLE = 0x2c, - SQ_OP2_INST_KILLGT = 0x2d, - SQ_OP2_INST_KILLGE = 0x2e, - SQ_OP2_INST_KILLNE = 0x2f, - SQ_OP2_INST_AND_INT = 0x30, - SQ_OP2_INST_OR_INT = 0x31, - SQ_OP2_INST_XOR_INT = 0x32, - SQ_OP2_INST_NOT_INT = 0x33, - SQ_OP2_INST_ADD_INT = 0x34, - SQ_OP2_INST_SUB_INT = 0x35, - SQ_OP2_INST_MAX_INT = 0x36, - SQ_OP2_INST_MIN_INT = 0x37, - SQ_OP2_INST_MAX_UINT = 0x38, - SQ_OP2_INST_MIN_UINT = 0x39, - SQ_OP2_INST_SETE_INT = 0x3a, - SQ_OP2_INST_SETGT_INT = 0x3b, - SQ_OP2_INST_SETGE_INT = 0x3c, - SQ_OP2_INST_SETNE_INT = 0x3d, - SQ_OP2_INST_SETGT_UINT = 0x3e, - SQ_OP2_INST_SETGE_UINT = 0x3f, - SQ_OP2_INST_KILLGT_UINT = 0x40, - SQ_OP2_INST_KILLGE_UINT = 0x41, - SQ_OP2_INST_PRED_SETE_INT = 0x42, - SQ_OP2_INST_PRED_SETGT_INT = 0x43, - SQ_OP2_INST_PRED_SETGE_INT = 0x44, - SQ_OP2_INST_PRED_SETNE_INT = 0x45, - SQ_OP2_INST_KILLE_INT = 0x46, - SQ_OP2_INST_KILLGT_INT = 0x47, - SQ_OP2_INST_KILLGE_INT = 0x48, - SQ_OP2_INST_KILLNE_INT = 0x49, - SQ_OP2_INST_PRED_SETE_PUSH_INT = 0x4a, - SQ_OP2_INST_PRED_SETGT_PUSH_INT = 0x4b, - SQ_OP2_INST_PRED_SETGE_PUSH_INT = 0x4c, - SQ_OP2_INST_PRED_SETNE_PUSH_INT = 0x4d, - SQ_OP2_INST_PRED_SETLT_PUSH_INT = 0x4e, - SQ_OP2_INST_PRED_SETLE_PUSH_INT = 0x4f, - SQ_OP2_INST_DOT4 = 0x50, - SQ_OP2_INST_DOT4_IEEE = 0x51, - SQ_OP2_INST_CUBE = 0x52, - SQ_OP2_INST_MAX4 = 0x53, - SQ_OP2_INST_MOVA_GPR_INT = 0x60, - SQ_OP2_INST_EXP_IEEE = 0x61, - SQ_OP2_INST_LOG_CLAMPED = 0x62, - SQ_OP2_INST_LOG_IEEE = 0x63, - SQ_OP2_INST_RECIP_CLAMPED = 0x64, - SQ_OP2_INST_RECIP_FF = 0x65, - SQ_OP2_INST_RECIP_IEEE = 0x66, - SQ_OP2_INST_RECIPSQRT_CLAMPED = 0x67, - SQ_OP2_INST_RECIPSQRT_FF = 0x68, - SQ_OP2_INST_RECIPSQRT_IEEE = 0x69, - SQ_OP2_INST_SQRT_IEEE = 0x6a, - SQ_OP2_INST_FLT_TO_INT = 0x6b, - SQ_OP2_INST_INT_TO_FLT = 0x6c, - SQ_OP2_INST_UINT_TO_FLT = 0x6d, - SQ_OP2_INST_SIN = 0x6e, - SQ_OP2_INST_COS = 0x6f, - SQ_OP2_INST_ASHR_INT = 0x70, - SQ_OP2_INST_LSHR_INT = 0x71, - SQ_OP2_INST_LSHL_INT = 0x72, - SQ_OP2_INST_MULLO_INT = 0x73, - SQ_OP2_INST_MULHI_INT = 0x74, - SQ_OP2_INST_MULLO_UINT = 0x75, - SQ_OP2_INST_MULHI_UINT = 0x76, - SQ_OP2_INST_RECIP_INT = 0x77, - SQ_OP2_INST_RECIP_UINT = 0x78, - SQ_OP2_INST_FLT_TO_UINT = 0x79, - SQ_CF_ALLOC_EXPORT_WORD1_BUF = 0x00008dfc, - ARRAY_SIZE_mask = 0xfff << 0, - ARRAY_SIZE_shift = 0, - COMP_MASK_mask = 0x0f << 12, - COMP_MASK_shift = 12, - SQ_CF_WORD0 = 0x00008dfc, - SQ_CF_ALLOC_EXPORT_WORD0 = 0x00008dfc, - ARRAY_BASE_mask = 0x1fff << 0, - ARRAY_BASE_shift = 0, - SQ_CF_ALLOC_EXPORT_WORD0__TYPE_mask = 0x03 << 13, - SQ_CF_ALLOC_EXPORT_WORD0__TYPE_shift = 13, - SQ_EXPORT_PIXEL = 0x00, - SQ_EXPORT_POS = 0x01, - SQ_EXPORT_PARAM = 0x02, - X_UNUSED_FOR_SX_EXPORTS = 0x03, - RW_GPR_mask = 0x7f << 15, - RW_GPR_shift = 15, - RW_REL_bit = 1 << 22, - INDEX_GPR_mask = 0x7f << 23, - INDEX_GPR_shift = 23, - ELEM_SIZE_mask = 0x03 << 30, - ELEM_SIZE_shift = 30, - SQ_VTX_WORD1 = 0x00008dfc, - SQ_VTX_WORD1__DST_SEL_X_mask = 0x07 << 9, - SQ_VTX_WORD1__DST_SEL_X_shift = 9, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_VTX_WORD1__DST_SEL_Y_mask = 0x07 << 12, - SQ_VTX_WORD1__DST_SEL_Y_shift = 12, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_VTX_WORD1__DST_SEL_Z_mask = 0x07 << 15, - SQ_VTX_WORD1__DST_SEL_Z_shift = 15, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_VTX_WORD1__DST_SEL_W_mask = 0x07 << 18, - SQ_VTX_WORD1__DST_SEL_W_shift = 18, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - USE_CONST_FIELDS_bit = 1 << 21, - SQ_VTX_WORD1__DATA_FORMAT_mask = 0x3f << 22, - SQ_VTX_WORD1__DATA_FORMAT_shift = 22, - SQ_VTX_WORD1__NUM_FORMAT_ALL_mask = 0x03 << 28, - SQ_VTX_WORD1__NUM_FORMAT_ALL_shift = 28, - SQ_NUM_FORMAT_NORM = 0x00, - SQ_NUM_FORMAT_INT = 0x01, - SQ_NUM_FORMAT_SCALED = 0x02, - SQ_VTX_WORD1__FORMAT_COMP_ALL_bit = 1 << 30, - SQ_VTX_WORD1__SRF_MODE_ALL_bit = 1 << 31, - SQ_ALU_WORD1_OP2 = 0x00008dfc, -/* SRC0_ABS_bit = 1 << 0, */ -/* SRC1_ABS_bit = 1 << 1, */ -/* UPDATE_EXECUTE_MASK_bit = 1 << 2, */ -/* UPDATE_PRED_bit = 1 << 3, */ -/* WRITE_MASK_bit = 1 << 4, */ - FOG_MERGE_bit = 1 << 5, - SQ_ALU_WORD1_OP2__OMOD_mask = 0x03 << 6, - SQ_ALU_WORD1_OP2__OMOD_shift = 6, -/* SQ_ALU_OMOD_OFF = 0x00, */ -/* SQ_ALU_OMOD_M2 = 0x01, */ -/* SQ_ALU_OMOD_M4 = 0x02, */ -/* SQ_ALU_OMOD_D2 = 0x03, */ - SQ_ALU_WORD1_OP2__ALU_INST_mask = 0x3ff << 8, - SQ_ALU_WORD1_OP2__ALU_INST_shift = 8, -/* SQ_OP2_INST_ADD = 0x00, */ -/* SQ_OP2_INST_MUL = 0x01, */ -/* SQ_OP2_INST_MUL_IEEE = 0x02, */ -/* SQ_OP2_INST_MAX = 0x03, */ -/* SQ_OP2_INST_MIN = 0x04, */ -/* SQ_OP2_INST_MAX_DX10 = 0x05, */ -/* SQ_OP2_INST_MIN_DX10 = 0x06, */ -/* SQ_OP2_INST_SETE = 0x08, */ -/* SQ_OP2_INST_SETGT = 0x09, */ -/* SQ_OP2_INST_SETGE = 0x0a, */ -/* SQ_OP2_INST_SETNE = 0x0b, */ -/* SQ_OP2_INST_SETE_DX10 = 0x0c, */ -/* SQ_OP2_INST_SETGT_DX10 = 0x0d, */ -/* SQ_OP2_INST_SETGE_DX10 = 0x0e, */ -/* SQ_OP2_INST_SETNE_DX10 = 0x0f, */ -/* SQ_OP2_INST_FRACT = 0x10, */ -/* SQ_OP2_INST_TRUNC = 0x11, */ -/* SQ_OP2_INST_CEIL = 0x12, */ -/* SQ_OP2_INST_RNDNE = 0x13, */ -/* SQ_OP2_INST_FLOOR = 0x14, */ -/* SQ_OP2_INST_MOVA = 0x15, */ -/* SQ_OP2_INST_MOVA_FLOOR = 0x16, */ -/* SQ_OP2_INST_MOVA_INT = 0x18, */ -/* SQ_OP2_INST_MOV = 0x19, */ -/* SQ_OP2_INST_NOP = 0x1a, */ -/* SQ_OP2_INST_PRED_SETGT_UINT = 0x1e, */ -/* SQ_OP2_INST_PRED_SETGE_UINT = 0x1f, */ -/* SQ_OP2_INST_PRED_SETE = 0x20, */ -/* SQ_OP2_INST_PRED_SETGT = 0x21, */ -/* SQ_OP2_INST_PRED_SETGE = 0x22, */ -/* SQ_OP2_INST_PRED_SETNE = 0x23, */ -/* SQ_OP2_INST_PRED_SET_INV = 0x24, */ -/* SQ_OP2_INST_PRED_SET_POP = 0x25, */ -/* SQ_OP2_INST_PRED_SET_CLR = 0x26, */ -/* SQ_OP2_INST_PRED_SET_RESTORE = 0x27, */ -/* SQ_OP2_INST_PRED_SETE_PUSH = 0x28, */ -/* SQ_OP2_INST_PRED_SETGT_PUSH = 0x29, */ -/* SQ_OP2_INST_PRED_SETGE_PUSH = 0x2a, */ -/* SQ_OP2_INST_PRED_SETNE_PUSH = 0x2b, */ -/* SQ_OP2_INST_KILLE = 0x2c, */ -/* SQ_OP2_INST_KILLGT = 0x2d, */ -/* SQ_OP2_INST_KILLGE = 0x2e, */ -/* SQ_OP2_INST_KILLNE = 0x2f, */ -/* SQ_OP2_INST_AND_INT = 0x30, */ -/* SQ_OP2_INST_OR_INT = 0x31, */ -/* SQ_OP2_INST_XOR_INT = 0x32, */ -/* SQ_OP2_INST_NOT_INT = 0x33, */ -/* SQ_OP2_INST_ADD_INT = 0x34, */ -/* SQ_OP2_INST_SUB_INT = 0x35, */ -/* SQ_OP2_INST_MAX_INT = 0x36, */ -/* SQ_OP2_INST_MIN_INT = 0x37, */ -/* SQ_OP2_INST_MAX_UINT = 0x38, */ -/* SQ_OP2_INST_MIN_UINT = 0x39, */ -/* SQ_OP2_INST_SETE_INT = 0x3a, */ -/* SQ_OP2_INST_SETGT_INT = 0x3b, */ -/* SQ_OP2_INST_SETGE_INT = 0x3c, */ -/* SQ_OP2_INST_SETNE_INT = 0x3d, */ -/* SQ_OP2_INST_SETGT_UINT = 0x3e, */ -/* SQ_OP2_INST_SETGE_UINT = 0x3f, */ -/* SQ_OP2_INST_KILLGT_UINT = 0x40, */ -/* SQ_OP2_INST_KILLGE_UINT = 0x41, */ -/* SQ_OP2_INST_PRED_SETE_INT = 0x42, */ -/* SQ_OP2_INST_PRED_SETGT_INT = 0x43, */ -/* SQ_OP2_INST_PRED_SETGE_INT = 0x44, */ -/* SQ_OP2_INST_PRED_SETNE_INT = 0x45, */ -/* SQ_OP2_INST_KILLE_INT = 0x46, */ -/* SQ_OP2_INST_KILLGT_INT = 0x47, */ -/* SQ_OP2_INST_KILLGE_INT = 0x48, */ -/* SQ_OP2_INST_KILLNE_INT = 0x49, */ -/* SQ_OP2_INST_PRED_SETE_PUSH_INT = 0x4a, */ -/* SQ_OP2_INST_PRED_SETGT_PUSH_INT = 0x4b, */ -/* SQ_OP2_INST_PRED_SETGE_PUSH_INT = 0x4c, */ -/* SQ_OP2_INST_PRED_SETNE_PUSH_INT = 0x4d, */ -/* SQ_OP2_INST_PRED_SETLT_PUSH_INT = 0x4e, */ -/* SQ_OP2_INST_PRED_SETLE_PUSH_INT = 0x4f, */ -/* SQ_OP2_INST_DOT4 = 0x50, */ -/* SQ_OP2_INST_DOT4_IEEE = 0x51, */ -/* SQ_OP2_INST_CUBE = 0x52, */ -/* SQ_OP2_INST_MAX4 = 0x53, */ -/* SQ_OP2_INST_MOVA_GPR_INT = 0x60, */ -/* SQ_OP2_INST_EXP_IEEE = 0x61, */ -/* SQ_OP2_INST_LOG_CLAMPED = 0x62, */ -/* SQ_OP2_INST_LOG_IEEE = 0x63, */ -/* SQ_OP2_INST_RECIP_CLAMPED = 0x64, */ -/* SQ_OP2_INST_RECIP_FF = 0x65, */ -/* SQ_OP2_INST_RECIP_IEEE = 0x66, */ -/* SQ_OP2_INST_RECIPSQRT_CLAMPED = 0x67, */ -/* SQ_OP2_INST_RECIPSQRT_FF = 0x68, */ -/* SQ_OP2_INST_RECIPSQRT_IEEE = 0x69, */ -/* SQ_OP2_INST_SQRT_IEEE = 0x6a, */ -/* SQ_OP2_INST_FLT_TO_INT = 0x6b, */ -/* SQ_OP2_INST_INT_TO_FLT = 0x6c, */ -/* SQ_OP2_INST_UINT_TO_FLT = 0x6d, */ -/* SQ_OP2_INST_SIN = 0x6e, */ -/* SQ_OP2_INST_COS = 0x6f, */ -/* SQ_OP2_INST_ASHR_INT = 0x70, */ -/* SQ_OP2_INST_LSHR_INT = 0x71, */ -/* SQ_OP2_INST_LSHL_INT = 0x72, */ -/* SQ_OP2_INST_MULLO_INT = 0x73, */ -/* SQ_OP2_INST_MULHI_INT = 0x74, */ -/* SQ_OP2_INST_MULLO_UINT = 0x75, */ -/* SQ_OP2_INST_MULHI_UINT = 0x76, */ -/* SQ_OP2_INST_RECIP_INT = 0x77, */ -/* SQ_OP2_INST_RECIP_UINT = 0x78, */ -/* SQ_OP2_INST_FLT_TO_UINT = 0x79, */ - SQ_CF_WORD1 = 0x00008dfc, - POP_COUNT_mask = 0x07 << 0, - POP_COUNT_shift = 0, - CF_CONST_mask = 0x1f << 3, - CF_CONST_shift = 3, - COND_mask = 0x03 << 8, - COND_shift = 8, - SQ_CF_COND_ACTIVE = 0x00, - SQ_CF_COND_FALSE = 0x01, - SQ_CF_COND_BOOL = 0x02, - SQ_CF_COND_NOT_BOOL = 0x03, - SQ_CF_WORD1__COUNT_mask = 0x07 << 10, - SQ_CF_WORD1__COUNT_shift = 10, - CALL_COUNT_mask = 0x3f << 13, - CALL_COUNT_shift = 13, - COUNT_3_bit = 1 << 19, -/* END_OF_PROGRAM_bit = 1 << 21, */ -/* VALID_PIXEL_MODE_bit = 1 << 22, */ - SQ_CF_WORD1__CF_INST_mask = 0x7f << 23, - SQ_CF_WORD1__CF_INST_shift = 23, - SQ_CF_INST_NOP = 0x00, - SQ_CF_INST_TEX = 0x01, - SQ_CF_INST_VTX = 0x02, - SQ_CF_INST_VTX_TC = 0x03, - SQ_CF_INST_LOOP_START = 0x04, - SQ_CF_INST_LOOP_END = 0x05, - SQ_CF_INST_LOOP_START_DX10 = 0x06, - SQ_CF_INST_LOOP_START_NO_AL = 0x07, - SQ_CF_INST_LOOP_CONTINUE = 0x08, - SQ_CF_INST_LOOP_BREAK = 0x09, - SQ_CF_INST_JUMP = 0x0a, - SQ_CF_INST_PUSH = 0x0b, - SQ_CF_INST_PUSH_ELSE = 0x0c, - SQ_CF_INST_ELSE = 0x0d, - SQ_CF_INST_POP = 0x0e, - SQ_CF_INST_POP_JUMP = 0x0f, - SQ_CF_INST_POP_PUSH = 0x10, - SQ_CF_INST_POP_PUSH_ELSE = 0x11, - SQ_CF_INST_CALL = 0x12, - SQ_CF_INST_CALL_FS = 0x13, - SQ_CF_INST_RETURN = 0x14, - SQ_CF_INST_EMIT_VERTEX = 0x15, - SQ_CF_INST_EMIT_CUT_VERTEX = 0x16, - SQ_CF_INST_CUT_VERTEX = 0x17, - SQ_CF_INST_KILL = 0x18, -/* WHOLE_QUAD_MODE_bit = 1 << 30, */ -/* BARRIER_bit = 1 << 31, */ - SQ_VTX_WORD1_SEM = 0x00008dfc, - SEMANTIC_ID_mask = 0xff << 0, - SEMANTIC_ID_shift = 0, - SQ_TEX_WORD0 = 0x00008dfc, - TEX_INST_mask = 0x1f << 0, - TEX_INST_shift = 0, - SQ_TEX_INST_VTX_FETCH = 0x00, - SQ_TEX_INST_VTX_SEMANTIC = 0x01, - SQ_TEX_INST_LD = 0x03, - SQ_TEX_INST_GET_TEXTURE_RESINFO = 0x04, - SQ_TEX_INST_GET_NUMBER_OF_SAMPLES = 0x05, - SQ_TEX_INST_GET_LOD = 0x06, - SQ_TEX_INST_GET_GRADIENTS_H = 0x07, - SQ_TEX_INST_GET_GRADIENTS_V = 0x08, - SQ_TEX_INST_GET_LERP = 0x09, - SQ_TEX_INST_RESERVED_10 = 0x0a, - SQ_TEX_INST_SET_GRADIENTS_H = 0x0b, - SQ_TEX_INST_SET_GRADIENTS_V = 0x0c, - SQ_TEX_INST_PASS = 0x0d, - X_Z_SET_INDEX_FOR_ARRAY_OF_CUBEMAPS = 0x0e, - SQ_TEX_INST_SAMPLE = 0x10, - SQ_TEX_INST_SAMPLE_L = 0x11, - SQ_TEX_INST_SAMPLE_LB = 0x12, - SQ_TEX_INST_SAMPLE_LZ = 0x13, - SQ_TEX_INST_SAMPLE_G = 0x14, - SQ_TEX_INST_SAMPLE_G_L = 0x15, - SQ_TEX_INST_SAMPLE_G_LB = 0x16, - SQ_TEX_INST_SAMPLE_G_LZ = 0x17, - SQ_TEX_INST_SAMPLE_C = 0x18, - SQ_TEX_INST_SAMPLE_C_L = 0x19, - SQ_TEX_INST_SAMPLE_C_LB = 0x1a, - SQ_TEX_INST_SAMPLE_C_LZ = 0x1b, - SQ_TEX_INST_SAMPLE_C_G = 0x1c, - SQ_TEX_INST_SAMPLE_C_G_L = 0x1d, - SQ_TEX_INST_SAMPLE_C_G_LB = 0x1e, - SQ_TEX_INST_SAMPLE_C_G_LZ = 0x1f, - BC_FRAC_MODE_bit = 1 << 5, -/* FETCH_WHOLE_QUAD_bit = 1 << 7, */ - RESOURCE_ID_mask = 0xff << 8, - RESOURCE_ID_shift = 8, -/* SRC_GPR_mask = 0x7f << 16, */ -/* SRC_GPR_shift = 16, */ -/* SRC_REL_bit = 1 << 23, */ - SQ_TEX_WORD0__ALT_CONST_bit = 1 << 24, - SQ_VTX_WORD1_GPR = 0x00008dfc, - SQ_VTX_WORD1_GPR__DST_GPR_mask = 0x7f << 0, - SQ_VTX_WORD1_GPR__DST_GPR_shift = 0, - SQ_VTX_WORD1_GPR__DST_REL_bit = 1 << 7, - SQ_ALU_WORD0 = 0x00008dfc, - SRC0_SEL_mask = 0x1ff << 0, - SRC0_SEL_shift = 0, -/* SQ_ALU_SRC_0 = 0xf8, */ -/* SQ_ALU_SRC_1 = 0xf9, */ -/* SQ_ALU_SRC_1_INT = 0xfa, */ -/* SQ_ALU_SRC_M_1_INT = 0xfb, */ -/* SQ_ALU_SRC_0_5 = 0xfc, */ -/* SQ_ALU_SRC_LITERAL = 0xfd, */ -/* SQ_ALU_SRC_PV = 0xfe, */ -/* SQ_ALU_SRC_PS = 0xff, */ - SRC0_REL_bit = 1 << 9, - SRC0_CHAN_mask = 0x03 << 10, - SRC0_CHAN_shift = 10, -/* SQ_CHAN_X = 0x00, */ -/* SQ_CHAN_Y = 0x01, */ -/* SQ_CHAN_Z = 0x02, */ -/* SQ_CHAN_W = 0x03, */ - SRC0_NEG_bit = 1 << 12, - SRC1_SEL_mask = 0x1ff << 13, - SRC1_SEL_shift = 13, -/* SQ_ALU_SRC_0 = 0xf8, */ -/* SQ_ALU_SRC_1 = 0xf9, */ -/* SQ_ALU_SRC_1_INT = 0xfa, */ -/* SQ_ALU_SRC_M_1_INT = 0xfb, */ -/* SQ_ALU_SRC_0_5 = 0xfc, */ -/* SQ_ALU_SRC_LITERAL = 0xfd, */ -/* SQ_ALU_SRC_PV = 0xfe, */ -/* SQ_ALU_SRC_PS = 0xff, */ - SRC1_REL_bit = 1 << 22, - SRC1_CHAN_mask = 0x03 << 23, - SRC1_CHAN_shift = 23, -/* SQ_CHAN_X = 0x00, */ -/* SQ_CHAN_Y = 0x01, */ -/* SQ_CHAN_Z = 0x02, */ -/* SQ_CHAN_W = 0x03, */ - SRC1_NEG_bit = 1 << 25, - INDEX_MODE_mask = 0x07 << 26, - INDEX_MODE_shift = 26, - SQ_INDEX_AR_X = 0x00, - SQ_INDEX_AR_Y = 0x01, - SQ_INDEX_AR_Z = 0x02, - SQ_INDEX_AR_W = 0x03, - SQ_INDEX_LOOP = 0x04, - PRED_SEL_mask = 0x03 << 29, - PRED_SEL_shift = 29, - SQ_PRED_SEL_OFF = 0x00, - SQ_PRED_SEL_ZERO = 0x02, - SQ_PRED_SEL_ONE = 0x03, - LAST_bit = 1 << 31, - SX_EXPORT_BUFFER_SIZES = 0x0000900c, - COLOR_BUFFER_SIZE_mask = 0xff << 0, - COLOR_BUFFER_SIZE_shift = 0, - POSITION_BUFFER_SIZE_mask = 0xff << 8, - POSITION_BUFFER_SIZE_shift = 8, - SMX_BUFFER_SIZE_mask = 0xff << 16, - SMX_BUFFER_SIZE_shift = 16, - SX_MEMORY_EXPORT_BASE = 0x00009010, - SX_MEMORY_EXPORT_SIZE = 0x00009014, - SPI_CONFIG_CNTL = 0x00009100, - GPR_WRITE_PRIORITY_mask = 0x1f << 0, - GPR_WRITE_PRIORITY_shift = 0, - X_PRIORITY_ORDER = 0x00, - X_PRIORITY_ORDER_VS = 0x01, - DISABLE_INTERP_1_bit = 1 << 5, - DEBUG_THREAD_TYPE_SEL_mask = 0x03 << 6, - DEBUG_THREAD_TYPE_SEL_shift = 6, - DEBUG_GROUP_SEL_mask = 0x1f << 8, - DEBUG_GROUP_SEL_shift = 8, - DEBUG_GRBM_OVERRIDE_bit = 1 << 13, - SPI_CONFIG_CNTL_1 = 0x0000913c, - VTX_DONE_DELAY_mask = 0x0f << 0, - VTX_DONE_DELAY_shift = 0, - X_DELAY_10_CLKS = 0x00, - X_DELAY_11_CLKS = 0x01, - X_DELAY_12_CLKS = 0x02, - X_DELAY_13_CLKS = 0x03, - X_DELAY_14_CLKS = 0x04, - X_DELAY_15_CLKS = 0x05, - X_DELAY_16_CLKS = 0x06, - X_DELAY_17_CLKS = 0x07, - X_DELAY_2_CLKS = 0x08, - X_DELAY_3_CLKS = 0x09, - X_DELAY_4_CLKS = 0x0a, - X_DELAY_5_CLKS = 0x0b, - X_DELAY_6_CLKS = 0x0c, - X_DELAY_7_CLKS = 0x0d, - X_DELAY_8_CLKS = 0x0e, - X_DELAY_9_CLKS = 0x0f, - INTERP_ONE_PRIM_PER_ROW_bit = 1 << 4, - TD_FILTER4 = 0x00009400, - WEIGHT_1_mask = 0x7ff << 0, - WEIGHT_1_shift = 0, - WEIGHT_0_mask = 0x7ff << 11, - WEIGHT_0_shift = 11, - WEIGHT_PAIR_bit = 1 << 22, - PHASE_mask = 0x0f << 23, - PHASE_shift = 23, - DIRECTION_bit = 1 << 27, - TD_FILTER4_1 = 0x00009404, - TD_FILTER4_1_num = 35, -/* WEIGHT_1_mask = 0x7ff << 0, */ -/* WEIGHT_1_shift = 0, */ -/* WEIGHT_0_mask = 0x7ff << 11, */ -/* WEIGHT_0_shift = 11, */ - TD_CNTL = 0x00009490, - SYNC_PHASE_SH_mask = 0x03 << 0, - SYNC_PHASE_SH_shift = 0, - SYNC_PHASE_VC_SMX_mask = 0x03 << 4, - SYNC_PHASE_VC_SMX_shift = 4, - TD0_CNTL = 0x00009494, - TD0_CNTL_num = 4, - ID_OVERRIDE_mask = 0x03 << 28, - ID_OVERRIDE_shift = 28, - TD0_STATUS = 0x000094a4, - TD0_STATUS_num = 4, - BUSY_bit = 1 << 31, - TA_CNTL = 0x00009504, - GRADIENT_CREDIT_mask = 0x1f << 0, - GRADIENT_CREDIT_shift = 0, - WALKER_CREDIT_mask = 0x1f << 8, - WALKER_CREDIT_shift = 8, - ALIGNER_CREDIT_mask = 0x1f << 16, - ALIGNER_CREDIT_shift = 16, - TD_FIFO_CREDIT_mask = 0x3ff << 22, - TD_FIFO_CREDIT_shift = 22, - TA_CNTL_AUX = 0x00009508, - DISABLE_CUBE_WRAP_bit = 1 << 0, - SYNC_GRADIENT_bit = 1 << 24, - SYNC_WALKER_bit = 1 << 25, - SYNC_ALIGNER_bit = 1 << 26, - BILINEAR_PRECISION_bit = 1 << 31, - TA0_CNTL = 0x00009510, -/* ID_OVERRIDE_mask = 0x03 << 28, */ -/* ID_OVERRIDE_shift = 28, */ - TA1_CNTL = 0x00009514, -/* ID_OVERRIDE_mask = 0x03 << 28, */ -/* ID_OVERRIDE_shift = 28, */ - TA2_CNTL = 0x00009518, -/* ID_OVERRIDE_mask = 0x03 << 28, */ -/* ID_OVERRIDE_shift = 28, */ - TA3_CNTL = 0x0000951c, -/* ID_OVERRIDE_mask = 0x03 << 28, */ -/* ID_OVERRIDE_shift = 28, */ - TA0_STATUS = 0x00009520, - FG_PFIFO_EMPTYB_bit = 1 << 12, - FG_LFIFO_EMPTYB_bit = 1 << 13, - FG_SFIFO_EMPTYB_bit = 1 << 14, - FL_PFIFO_EMPTYB_bit = 1 << 16, - FL_LFIFO_EMPTYB_bit = 1 << 17, - FL_SFIFO_EMPTYB_bit = 1 << 18, - FA_PFIFO_EMPTYB_bit = 1 << 20, - FA_LFIFO_EMPTYB_bit = 1 << 21, - FA_SFIFO_EMPTYB_bit = 1 << 22, - IN_BUSY_bit = 1 << 24, - FG_BUSY_bit = 1 << 25, - FL_BUSY_bit = 1 << 27, - TA_BUSY_bit = 1 << 28, - FA_BUSY_bit = 1 << 29, - AL_BUSY_bit = 1 << 30, -/* BUSY_bit = 1 << 31, */ - TA1_STATUS = 0x00009524, -/* FG_PFIFO_EMPTYB_bit = 1 << 12, */ -/* FG_LFIFO_EMPTYB_bit = 1 << 13, */ -/* FG_SFIFO_EMPTYB_bit = 1 << 14, */ -/* FL_PFIFO_EMPTYB_bit = 1 << 16, */ -/* FL_LFIFO_EMPTYB_bit = 1 << 17, */ -/* FL_SFIFO_EMPTYB_bit = 1 << 18, */ -/* FA_PFIFO_EMPTYB_bit = 1 << 20, */ -/* FA_LFIFO_EMPTYB_bit = 1 << 21, */ -/* FA_SFIFO_EMPTYB_bit = 1 << 22, */ -/* IN_BUSY_bit = 1 << 24, */ -/* FG_BUSY_bit = 1 << 25, */ -/* FL_BUSY_bit = 1 << 27, */ -/* TA_BUSY_bit = 1 << 28, */ -/* FA_BUSY_bit = 1 << 29, */ -/* AL_BUSY_bit = 1 << 30, */ -/* BUSY_bit = 1 << 31, */ - TA2_STATUS = 0x00009528, -/* FG_PFIFO_EMPTYB_bit = 1 << 12, */ -/* FG_LFIFO_EMPTYB_bit = 1 << 13, */ -/* FG_SFIFO_EMPTYB_bit = 1 << 14, */ -/* FL_PFIFO_EMPTYB_bit = 1 << 16, */ -/* FL_LFIFO_EMPTYB_bit = 1 << 17, */ -/* FL_SFIFO_EMPTYB_bit = 1 << 18, */ -/* FA_PFIFO_EMPTYB_bit = 1 << 20, */ -/* FA_LFIFO_EMPTYB_bit = 1 << 21, */ -/* FA_SFIFO_EMPTYB_bit = 1 << 22, */ -/* IN_BUSY_bit = 1 << 24, */ -/* FG_BUSY_bit = 1 << 25, */ -/* FL_BUSY_bit = 1 << 27, */ -/* TA_BUSY_bit = 1 << 28, */ -/* FA_BUSY_bit = 1 << 29, */ -/* AL_BUSY_bit = 1 << 30, */ -/* BUSY_bit = 1 << 31, */ - TA3_STATUS = 0x0000952c, -/* FG_PFIFO_EMPTYB_bit = 1 << 12, */ -/* FG_LFIFO_EMPTYB_bit = 1 << 13, */ -/* FG_SFIFO_EMPTYB_bit = 1 << 14, */ -/* FL_PFIFO_EMPTYB_bit = 1 << 16, */ -/* FL_LFIFO_EMPTYB_bit = 1 << 17, */ -/* FL_SFIFO_EMPTYB_bit = 1 << 18, */ -/* FA_PFIFO_EMPTYB_bit = 1 << 20, */ -/* FA_LFIFO_EMPTYB_bit = 1 << 21, */ -/* FA_SFIFO_EMPTYB_bit = 1 << 22, */ -/* IN_BUSY_bit = 1 << 24, */ -/* FG_BUSY_bit = 1 << 25, */ -/* FL_BUSY_bit = 1 << 27, */ -/* TA_BUSY_bit = 1 << 28, */ -/* FA_BUSY_bit = 1 << 29, */ -/* AL_BUSY_bit = 1 << 30, */ -/* BUSY_bit = 1 << 31, */ - TC_STATUS = 0x00009600, - TC_BUSY_bit = 1 << 0, - TC_INVALIDATE = 0x00009604, - START_bit = 1 << 0, - TC_CNTL = 0x00009608, - FORCE_HIT_bit = 1 << 0, - FORCE_MISS_bit = 1 << 1, - L2_SIZE_mask = 0x0f << 5, - L2_SIZE_shift = 5, - _256K = 0x00, - _224K = 0x01, - _192K = 0x02, - _160K = 0x03, - _128K = 0x04, - _96K = 0x05, - _64K = 0x06, - _32K = 0x07, - L2_DISABLE_LATE_HIT_bit = 1 << 9, - DISABLE_VERT_PERF_bit = 1 << 10, - DISABLE_INVAL_BUSY_bit = 1 << 11, - DISABLE_INVAL_SAME_SURFACE_bit = 1 << 12, - PARTITION_MODE_mask = 0x03 << 13, - PARTITION_MODE_shift = 13, - X_VERTEX = 0x00, - MISS_ARB_MODE_bit = 1 << 15, - HIT_ARB_MODE_bit = 1 << 16, - DISABLE_WRITE_DELAY_bit = 1 << 17, - HIT_FIFO_DEPTH_bit = 1 << 18, - VC_CNTL = 0x00009700, - L2_INVALIDATE_bit = 1 << 0, - RESERVED_bit = 1 << 1, - CC_FORCE_MISS_bit = 1 << 2, - MI_CHAN_SEL_mask = 0x03 << 3, - MI_CHAN_SEL_shift = 3, - X_MC0_USES_CH_0_1 = 0x00, - X_MC0_USES_CH_0_3 = 0x01, - X_VC_MC0_IS_ACTIVE = 0x02, - X_VC_MC1_IS_DISABLED = 0x03, - MI_STEER_DISABLE_bit = 1 << 5, - MI_CREDIT_CTR_mask = 0x0f << 6, - MI_CREDIT_CTR_shift = 6, - MI_CREDIT_WE_bit = 1 << 10, - MI_REQ_STALL_THLD_mask = 0x07 << 11, - MI_REQ_STALL_THLD_shift = 11, - X_LATENCY_EXCEEDS_399_CLOCKS = 0x00, - X_LATENCY_EXCEEDS_415_CLOCKS = 0x01, - X_LATENCY_EXCEEDS_431_CLOCKS = 0x02, - X_LATENCY_EXCEEDS_447_CLOCKS = 0x03, - X_LATENCY_EXCEEDS_463_CLOCKS = 0x04, - X_LATENCY_EXCEEDS_479_CLOCKS = 0x05, - X_LATENCY_EXCEEDS_495_CLOCKS = 0x06, - X_LATENCY_EXCEEDS_511_CLOCKS = 0x07, - VC_CNTL__MI_TIMESTAMP_RES_mask = 0x1f << 14, - VC_CNTL__MI_TIMESTAMP_RES_shift = 14, - X_1X_SYSTEM_CLOCK = 0x00, - X_2X_SYSTEM_CLOCK = 0x01, - X_4X_SYSTEM_CLOCK = 0x02, - X_8X_SYSTEM_CLOCK = 0x03, - X_16X_SYSTEM_CLOCK = 0x04, - X_32X_SYSTEM_CLOCK = 0x05, - X_64X_SYSTEM_CLOCK = 0x06, - X_128X_SYSTEM_CLOCK = 0x07, - X_256X_SYSTEM_CLOCK = 0x08, - X_512X_SYSTEM_CLOCK = 0x09, - X_1024X_SYSTEM_CLOCK = 0x0a, - X_2048X_SYSTEM_CLOCK = 0x0b, - X_4092X_SYSTEM_CLOCK = 0x0c, - X_8192X_SYSTEM_CLOCK = 0x0d, - X_16384X_SYSTEM_CLOCK = 0x0e, - X_32768X_SYSTEM_CLOCK = 0x0f, - VC_CNTL_STATUS = 0x00009704, - RP_BUSY_bit = 1 << 0, - RG_BUSY_bit = 1 << 1, - VC_BUSY_bit = 1 << 2, - CLAMP_DETECT_bit = 1 << 3, - VC_CONFIG = 0x00009718, - WRITE_DIS_bit = 1 << 0, - GPR_DATA_PHASE_ADJ_mask = 0x07 << 1, - GPR_DATA_PHASE_ADJ_shift = 1, - X_LATENCY_BASE_0_CYCLES = 0x00, - X_LATENCY_BASE_1_CYCLES = 0x01, - X_LATENCY_BASE_2_CYCLES = 0x02, - X_LATENCY_BASE_3_CYCLES = 0x03, - TD_SIMD_SYNC_ADJ_mask = 0x07 << 4, - TD_SIMD_SYNC_ADJ_shift = 4, - X_0_CYCLES_DELAY = 0x00, - X_1_CYCLES_DELAY = 0x01, - X_2_CYCLES_DELAY = 0x02, - X_3_CYCLES_DELAY = 0x03, - X_4_CYCLES_DELAY = 0x04, - X_5_CYCLES_DELAY = 0x05, - X_6_CYCLES_DELAY = 0x06, - X_7_CYCLES_DELAY = 0x07, - SMX_DC_CTL0 = 0x0000a020, - WR_GATHER_STREAM0_bit = 1 << 0, - WR_GATHER_STREAM1_bit = 1 << 1, - WR_GATHER_STREAM2_bit = 1 << 2, - WR_GATHER_STREAM3_bit = 1 << 3, - WR_GATHER_SCRATCH_bit = 1 << 4, - WR_GATHER_REDUC_BUF_bit = 1 << 5, - WR_GATHER_RING_BUF_bit = 1 << 6, - WR_GATHER_F_BUF_bit = 1 << 7, - DISABLE_CACHES_bit = 1 << 8, - AUTO_FLUSH_INVAL_EN_bit = 1 << 10, - AUTO_FLUSH_EN_bit = 1 << 11, - AUTO_FLUSH_CNT_mask = 0xffff << 12, - AUTO_FLUSH_CNT_shift = 12, - MC_RD_STALL_FACTOR_mask = 0x03 << 28, - MC_RD_STALL_FACTOR_shift = 28, - MC_WR_STALL_FACTOR_mask = 0x03 << 30, - MC_WR_STALL_FACTOR_shift = 30, - SMX_DC_CTL1 = 0x0000a024, - OP_FIFO_SKID_mask = 0x7f << 0, - OP_FIFO_SKID_shift = 0, - CACHE_LINE_SIZE_bit = 1 << 8, - MULTI_FLUSH_MODE_bit = 1 << 9, - MULTI_FLUSH_REQ_ABORT_IDX_FIFO_SKID_mask = 0x0f << 10, - MULTI_FLUSH_REQ_ABORT_IDX_FIFO_SKID_shift = 10, - DISABLE_WR_GATHER_RD_HIT_FORCE_EVICT_bit = 1 << 16, - DISABLE_WR_GATHER_RD_HIT_COMP_VLDS_CHECK_bit = 1 << 17, - DISABLE_FLUSH_ES_ALSO_INVALS_bit = 1 << 18, - DISABLE_FLUSH_GS_ALSO_INVALS_bit = 1 << 19, - SMX_DC_CTL2 = 0x0000a028, - INVALIDATE_CACHES_bit = 1 << 0, - CACHES_INVALID_bit = 1 << 1, - CACHES_DIRTY_bit = 1 << 2, - FLUSH_ALL_bit = 1 << 4, - FLUSH_GS_THREADS_bit = 1 << 8, - FLUSH_ES_THREADS_bit = 1 << 9, - SMX_DC_MC_INTF_CTL = 0x0000a02c, - MC_RD_REQ_CRED_mask = 0xff << 0, - MC_RD_REQ_CRED_shift = 0, - MC_WR_REQ_CRED_mask = 0xff << 16, - MC_WR_REQ_CRED_shift = 16, - TD_PS_SAMPLER0_BORDER_RED = 0x0000a400, - TD_PS_SAMPLER0_BORDER_RED_num = 18, - TD_PS_SAMPLER0_BORDER_RED_offset = 16, - TD_PS_SAMPLER0_BORDER_GREEN = 0x0000a404, - TD_PS_SAMPLER0_BORDER_GREEN_num = 18, - TD_PS_SAMPLER0_BORDER_GREEN_offset = 16, - TD_PS_SAMPLER0_BORDER_BLUE = 0x0000a408, - TD_PS_SAMPLER0_BORDER_BLUE_num = 18, - TD_PS_SAMPLER0_BORDER_BLUE_offset = 16, - TD_PS_SAMPLER0_BORDER_ALPHA = 0x0000a40c, - TD_PS_SAMPLER0_BORDER_ALPHA_num = 18, - TD_PS_SAMPLER0_BORDER_ALPHA_offset = 16, - TD_VS_SAMPLER0_BORDER_RED = 0x0000a600, - TD_VS_SAMPLER0_BORDER_RED_num = 18, - TD_VS_SAMPLER0_BORDER_RED_offset = 16, - TD_VS_SAMPLER0_BORDER_GREEN = 0x0000a604, - TD_VS_SAMPLER0_BORDER_GREEN_num = 18, - TD_VS_SAMPLER0_BORDER_GREEN_offset = 16, - TD_VS_SAMPLER0_BORDER_BLUE = 0x0000a608, - TD_VS_SAMPLER0_BORDER_BLUE_num = 18, - TD_VS_SAMPLER0_BORDER_BLUE_offset = 16, - TD_VS_SAMPLER0_BORDER_ALPHA = 0x0000a60c, - TD_VS_SAMPLER0_BORDER_ALPHA_num = 18, - TD_VS_SAMPLER0_BORDER_ALPHA_offset = 16, - TD_GS_SAMPLER0_BORDER_RED = 0x0000a800, - TD_GS_SAMPLER0_BORDER_RED_num = 18, - TD_GS_SAMPLER0_BORDER_RED_offset = 16, - TD_GS_SAMPLER0_BORDER_GREEN = 0x0000a804, - TD_GS_SAMPLER0_BORDER_GREEN_num = 18, - TD_GS_SAMPLER0_BORDER_GREEN_offset = 16, - TD_GS_SAMPLER0_BORDER_BLUE = 0x0000a808, - TD_GS_SAMPLER0_BORDER_BLUE_num = 18, - TD_GS_SAMPLER0_BORDER_BLUE_offset = 16, - TD_GS_SAMPLER0_BORDER_ALPHA = 0x0000a80c, - TD_GS_SAMPLER0_BORDER_ALPHA_num = 18, - TD_GS_SAMPLER0_BORDER_ALPHA_offset = 16, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL = 0x0000aa00, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL_num = 18, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL__WIDTH_mask = 0x07 << 0, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL__WIDTH_shift = 0, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL__HEIGHT_mask = 0x07 << 3, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL__HEIGHT_shift = 3, - DB_DEPTH_SIZE = 0x00028000, - PITCH_TILE_MAX_mask = 0x3ff << 0, - PITCH_TILE_MAX_shift = 0, - SLICE_TILE_MAX_mask = 0xfffff << 10, - SLICE_TILE_MAX_shift = 10, - DB_DEPTH_VIEW = 0x00028004, - SLICE_START_mask = 0x7ff << 0, - SLICE_START_shift = 0, - SLICE_MAX_mask = 0x7ff << 13, - SLICE_MAX_shift = 13, - DB_DEPTH_BASE = 0x0002800c, - DB_DEPTH_INFO = 0x00028010, - DB_DEPTH_INFO__FORMAT_mask = 0x07 << 0, - DB_DEPTH_INFO__FORMAT_shift = 0, - DEPTH_INVALID = 0x00, - DEPTH_16 = 0x01, - DEPTH_X8_24 = 0x02, - DEPTH_8_24 = 0x03, - DEPTH_X8_24_FLOAT = 0x04, - DEPTH_8_24_FLOAT = 0x05, - DEPTH_32_FLOAT = 0x06, - DEPTH_X24_8_32_FLOAT = 0x07, - DB_DEPTH_INFO__READ_SIZE_bit = 1 << 3, - DB_DEPTH_INFO__ARRAY_MODE_mask = 0x0f << 15, - DB_DEPTH_INFO__ARRAY_MODE_shift = 15, - ARRAY_2D_TILED_THIN1 = 0x04, - TILE_SURFACE_ENABLE_bit = 1 << 25, - TILE_COMPACT_bit = 1 << 26, - ZRANGE_PRECISION_bit = 1 << 31, - DB_HTILE_DATA_BASE = 0x00028014, - DB_STENCIL_CLEAR = 0x00028028, - DB_STENCIL_CLEAR__CLEAR_mask = 0xff << 0, - DB_STENCIL_CLEAR__CLEAR_shift = 0, - MIN_mask = 0xff << 16, - MIN_shift = 16, - DB_DEPTH_CLEAR = 0x0002802c, - PA_SC_SCREEN_SCISSOR_TL = 0x00028030, - PA_SC_SCREEN_SCISSOR_TL__TL_X_mask = 0x7fff << 0, - PA_SC_SCREEN_SCISSOR_TL__TL_X_shift = 0, - PA_SC_SCREEN_SCISSOR_TL__TL_Y_mask = 0x7fff << 16, - PA_SC_SCREEN_SCISSOR_TL__TL_Y_shift = 16, - PA_SC_SCREEN_SCISSOR_BR = 0x00028034, - PA_SC_SCREEN_SCISSOR_BR__BR_X_mask = 0x7fff << 0, - PA_SC_SCREEN_SCISSOR_BR__BR_X_shift = 0, - PA_SC_SCREEN_SCISSOR_BR__BR_Y_mask = 0x7fff << 16, - PA_SC_SCREEN_SCISSOR_BR__BR_Y_shift = 16, - CB_COLOR0_BASE = 0x00028040, - CB_COLOR0_BASE_num = 8, - CB_COLOR0_SIZE = 0x00028060, - CB_COLOR0_SIZE_num = 8, -/* PITCH_TILE_MAX_mask = 0x3ff << 0, */ -/* PITCH_TILE_MAX_shift = 0, */ -/* SLICE_TILE_MAX_mask = 0xfffff << 10, */ -/* SLICE_TILE_MAX_shift = 10, */ - CB_COLOR0_VIEW = 0x00028080, - CB_COLOR0_VIEW_num = 8, -/* SLICE_START_mask = 0x7ff << 0, */ -/* SLICE_START_shift = 0, */ -/* SLICE_MAX_mask = 0x7ff << 13, */ -/* SLICE_MAX_shift = 13, */ - CB_COLOR0_INFO = 0x000280a0, - CB_COLOR0_INFO_num = 8, - ENDIAN_mask = 0x03 << 0, - ENDIAN_shift = 0, - ENDIAN_NONE = 0x00, - ENDIAN_8IN16 = 0x01, - ENDIAN_8IN32 = 0x02, - ENDIAN_8IN64 = 0x03, - CB_COLOR0_INFO__FORMAT_mask = 0x3f << 2, - CB_COLOR0_INFO__FORMAT_shift = 2, - COLOR_INVALID = 0x00, - COLOR_8 = 0x01, - COLOR_4_4 = 0x02, - COLOR_3_3_2 = 0x03, - COLOR_16 = 0x05, - COLOR_16_FLOAT = 0x06, - COLOR_8_8 = 0x07, - COLOR_5_6_5 = 0x08, - COLOR_6_5_5 = 0x09, - COLOR_1_5_5_5 = 0x0a, - COLOR_4_4_4_4 = 0x0b, - COLOR_5_5_5_1 = 0x0c, - COLOR_32 = 0x0d, - COLOR_32_FLOAT = 0x0e, - COLOR_16_16 = 0x0f, - COLOR_16_16_FLOAT = 0x10, - COLOR_8_24 = 0x11, - COLOR_8_24_FLOAT = 0x12, - COLOR_24_8 = 0x13, - COLOR_24_8_FLOAT = 0x14, - COLOR_10_11_11 = 0x15, - COLOR_10_11_11_FLOAT = 0x16, - COLOR_11_11_10 = 0x17, - COLOR_11_11_10_FLOAT = 0x18, - COLOR_2_10_10_10 = 0x19, - COLOR_8_8_8_8 = 0x1a, - COLOR_10_10_10_2 = 0x1b, - COLOR_X24_8_32_FLOAT = 0x1c, - COLOR_32_32 = 0x1d, - COLOR_32_32_FLOAT = 0x1e, - COLOR_16_16_16_16 = 0x1f, - COLOR_16_16_16_16_FLOAT = 0x20, - COLOR_32_32_32_32 = 0x22, - COLOR_32_32_32_32_FLOAT = 0x23, - CB_COLOR0_INFO__ARRAY_MODE_mask = 0x0f << 8, - CB_COLOR0_INFO__ARRAY_MODE_shift = 8, - ARRAY_LINEAR_GENERAL = 0x00, - ARRAY_LINEAR_ALIGNED = 0x01, -/* ARRAY_2D_TILED_THIN1 = 0x04, */ - NUMBER_TYPE_mask = 0x07 << 12, - NUMBER_TYPE_shift = 12, - NUMBER_UNORM = 0x00, - NUMBER_SNORM = 0x01, - NUMBER_USCALED = 0x02, - NUMBER_SSCALED = 0x03, - NUMBER_UINT = 0x04, - NUMBER_SINT = 0x05, - NUMBER_SRGB = 0x06, - NUMBER_FLOAT = 0x07, - CB_COLOR0_INFO__READ_SIZE_bit = 1 << 15, - COMP_SWAP_mask = 0x03 << 16, - COMP_SWAP_shift = 16, - SWAP_STD = 0x00, - SWAP_ALT = 0x01, - SWAP_STD_REV = 0x02, - SWAP_ALT_REV = 0x03, - CB_COLOR0_INFO__TILE_MODE_mask = 0x03 << 18, - CB_COLOR0_INFO__TILE_MODE_shift = 18, - TILE_DISABLE = 0x00, - TILE_CLEAR_ENABLE = 0x01, - TILE_FRAG_ENABLE = 0x02, - BLEND_CLAMP_bit = 1 << 20, - CLEAR_COLOR_bit = 1 << 21, - BLEND_BYPASS_bit = 1 << 22, - BLEND_FLOAT32_bit = 1 << 23, - SIMPLE_FLOAT_bit = 1 << 24, - CB_COLOR0_INFO__ROUND_MODE_bit = 1 << 25, -/* TILE_COMPACT_bit = 1 << 26, */ - SOURCE_FORMAT_bit = 1 << 27, - CB_COLOR0_TILE = 0x000280c0, - CB_COLOR0_TILE_num = 8, - CB_COLOR0_FRAG = 0x000280e0, - CB_COLOR0_FRAG_num = 8, - CB_COLOR0_MASK = 0x00028100, - CB_COLOR0_MASK_num = 8, - CMASK_BLOCK_MAX_mask = 0xfff << 0, - CMASK_BLOCK_MAX_shift = 0, - FMASK_TILE_MAX_mask = 0xfffff << 12, - FMASK_TILE_MAX_shift = 12, - CB_CLEAR_RED = 0x00028120, - CB_CLEAR_GREEN = 0x00028124, - CB_CLEAR_BLUE = 0x00028128, - CB_CLEAR_ALPHA = 0x0002812c, - SQ_ALU_CONST_BUFFER_SIZE_PS_0 = 0x00028140, - SQ_ALU_CONST_BUFFER_SIZE_PS_0_num = 16, - SQ_ALU_CONST_BUFFER_SIZE_PS_0__DATA_mask = 0x1ff << 0, - SQ_ALU_CONST_BUFFER_SIZE_PS_0__DATA_shift = 0, - SQ_ALU_CONST_BUFFER_SIZE_VS_0 = 0x00028180, - SQ_ALU_CONST_BUFFER_SIZE_VS_0_num = 16, - SQ_ALU_CONST_BUFFER_SIZE_VS_0__DATA_mask = 0x1ff << 0, - SQ_ALU_CONST_BUFFER_SIZE_VS_0__DATA_shift = 0, - SQ_ALU_CONST_BUFFER_SIZE_GS_0 = 0x000281c0, - SQ_ALU_CONST_BUFFER_SIZE_GS_0_num = 16, - SQ_ALU_CONST_BUFFER_SIZE_GS_0__DATA_mask = 0x1ff << 0, - SQ_ALU_CONST_BUFFER_SIZE_GS_0__DATA_shift = 0, - PA_SC_WINDOW_OFFSET = 0x00028200, - WINDOW_X_OFFSET_mask = 0x7fff << 0, - WINDOW_X_OFFSET_shift = 0, - WINDOW_Y_OFFSET_mask = 0x7fff << 16, - WINDOW_Y_OFFSET_shift = 16, - PA_SC_WINDOW_SCISSOR_TL = 0x00028204, - PA_SC_WINDOW_SCISSOR_TL__TL_X_mask = 0x3fff << 0, - PA_SC_WINDOW_SCISSOR_TL__TL_X_shift = 0, - PA_SC_WINDOW_SCISSOR_TL__TL_Y_mask = 0x3fff << 16, - PA_SC_WINDOW_SCISSOR_TL__TL_Y_shift = 16, - WINDOW_OFFSET_DISABLE_bit = 1 << 31, - PA_SC_WINDOW_SCISSOR_BR = 0x00028208, - PA_SC_WINDOW_SCISSOR_BR__BR_X_mask = 0x3fff << 0, - PA_SC_WINDOW_SCISSOR_BR__BR_X_shift = 0, - PA_SC_WINDOW_SCISSOR_BR__BR_Y_mask = 0x3fff << 16, - PA_SC_WINDOW_SCISSOR_BR__BR_Y_shift = 16, - PA_SC_CLIPRECT_RULE = 0x0002820c, - CLIP_RULE_mask = 0xffff << 0, - CLIP_RULE_shift = 0, - PA_SC_CLIPRECT_0_TL = 0x00028210, - PA_SC_CLIPRECT_0_TL_num = 4, - PA_SC_CLIPRECT_0_TL_offset = 8, - PA_SC_CLIPRECT_0_TL__TL_X_mask = 0x3fff << 0, - PA_SC_CLIPRECT_0_TL__TL_X_shift = 0, - PA_SC_CLIPRECT_0_TL__TL_Y_mask = 0x3fff << 16, - PA_SC_CLIPRECT_0_TL__TL_Y_shift = 16, - PA_SC_CLIPRECT_0_BR = 0x00028214, - PA_SC_CLIPRECT_0_BR_num = 4, - PA_SC_CLIPRECT_0_BR_offset = 8, - PA_SC_CLIPRECT_0_BR__BR_X_mask = 0x3fff << 0, - PA_SC_CLIPRECT_0_BR__BR_X_shift = 0, - PA_SC_CLIPRECT_0_BR__BR_Y_mask = 0x3fff << 16, - PA_SC_CLIPRECT_0_BR__BR_Y_shift = 16, - CB_TARGET_MASK = 0x00028238, - TARGET0_ENABLE_mask = 0x0f << 0, - TARGET0_ENABLE_shift = 0, - TARGET1_ENABLE_mask = 0x0f << 4, - TARGET1_ENABLE_shift = 4, - TARGET2_ENABLE_mask = 0x0f << 8, - TARGET2_ENABLE_shift = 8, - TARGET3_ENABLE_mask = 0x0f << 12, - TARGET3_ENABLE_shift = 12, - TARGET4_ENABLE_mask = 0x0f << 16, - TARGET4_ENABLE_shift = 16, - TARGET5_ENABLE_mask = 0x0f << 20, - TARGET5_ENABLE_shift = 20, - TARGET6_ENABLE_mask = 0x0f << 24, - TARGET6_ENABLE_shift = 24, - TARGET7_ENABLE_mask = 0x0f << 28, - TARGET7_ENABLE_shift = 28, - CB_SHADER_MASK = 0x0002823c, - OUTPUT0_ENABLE_mask = 0x0f << 0, - OUTPUT0_ENABLE_shift = 0, - OUTPUT1_ENABLE_mask = 0x0f << 4, - OUTPUT1_ENABLE_shift = 4, - OUTPUT2_ENABLE_mask = 0x0f << 8, - OUTPUT2_ENABLE_shift = 8, - OUTPUT3_ENABLE_mask = 0x0f << 12, - OUTPUT3_ENABLE_shift = 12, - OUTPUT4_ENABLE_mask = 0x0f << 16, - OUTPUT4_ENABLE_shift = 16, - OUTPUT5_ENABLE_mask = 0x0f << 20, - OUTPUT5_ENABLE_shift = 20, - OUTPUT6_ENABLE_mask = 0x0f << 24, - OUTPUT6_ENABLE_shift = 24, - OUTPUT7_ENABLE_mask = 0x0f << 28, - OUTPUT7_ENABLE_shift = 28, - PA_SC_GENERIC_SCISSOR_TL = 0x00028240, - PA_SC_GENERIC_SCISSOR_TL__TL_X_mask = 0x3fff << 0, - PA_SC_GENERIC_SCISSOR_TL__TL_X_shift = 0, - PA_SC_GENERIC_SCISSOR_TL__TL_Y_mask = 0x3fff << 16, - PA_SC_GENERIC_SCISSOR_TL__TL_Y_shift = 16, -/* WINDOW_OFFSET_DISABLE_bit = 1 << 31, */ - PA_SC_GENERIC_SCISSOR_BR = 0x00028244, - PA_SC_GENERIC_SCISSOR_BR__BR_X_mask = 0x3fff << 0, - PA_SC_GENERIC_SCISSOR_BR__BR_X_shift = 0, - PA_SC_GENERIC_SCISSOR_BR__BR_Y_mask = 0x3fff << 16, - PA_SC_GENERIC_SCISSOR_BR__BR_Y_shift = 16, - PA_SC_VPORT_SCISSOR_0_TL = 0x00028250, - PA_SC_VPORT_SCISSOR_0_TL_num = 16, - PA_SC_VPORT_SCISSOR_0_TL_offset = 8, - PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask = 0x3fff << 0, - PA_SC_VPORT_SCISSOR_0_TL__TL_X_shift = 0, - PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask = 0x3fff << 16, - PA_SC_VPORT_SCISSOR_0_TL__TL_Y_shift = 16, -/* WINDOW_OFFSET_DISABLE_bit = 1 << 31, */ - PA_SC_VPORT_SCISSOR_0_BR = 0x00028254, - PA_SC_VPORT_SCISSOR_0_BR_num = 16, - PA_SC_VPORT_SCISSOR_0_BR_offset = 8, - PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask = 0x3fff << 0, - PA_SC_VPORT_SCISSOR_0_BR__BR_X_shift = 0, - PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask = 0x3fff << 16, - PA_SC_VPORT_SCISSOR_0_BR__BR_Y_shift = 16, - PA_SC_VPORT_ZMIN_0 = 0x000282d0, - PA_SC_VPORT_ZMIN_0_num = 16, - PA_SC_VPORT_ZMIN_0_offset = 8, - PA_SC_VPORT_ZMAX_0 = 0x000282d4, - PA_SC_VPORT_ZMAX_0_num = 16, - PA_SC_VPORT_ZMAX_0_offset = 8, - SX_MISC = 0x00028350, - MULTIPASS_bit = 1 << 0, - SQ_VTX_SEMANTIC_0 = 0x00028380, - SQ_VTX_SEMANTIC_0_num = 32, -/* SEMANTIC_ID_mask = 0xff << 0, */ -/* SEMANTIC_ID_shift = 0, */ - VGT_MAX_VTX_INDX = 0x00028400, - VGT_MIN_VTX_INDX = 0x00028404, - VGT_INDX_OFFSET = 0x00028408, - VGT_MULTI_PRIM_IB_RESET_INDX = 0x0002840c, - SX_ALPHA_TEST_CONTROL = 0x00028410, - ALPHA_FUNC_mask = 0x07 << 0, - ALPHA_FUNC_shift = 0, - REF_NEVER = 0x00, - REF_LESS = 0x01, - REF_EQUAL = 0x02, - REF_LEQUAL = 0x03, - REF_GREATER = 0x04, - REF_NOTEQUAL = 0x05, - REF_GEQUAL = 0x06, - REF_ALWAYS = 0x07, - ALPHA_TEST_ENABLE_bit = 1 << 3, - ALPHA_TEST_BYPASS_bit = 1 << 8, - CB_BLEND_RED = 0x00028414, - CB_BLEND_GREEN = 0x00028418, - CB_BLEND_BLUE = 0x0002841c, - CB_BLEND_ALPHA = 0x00028420, - CB_FOG_RED = 0x00028424, - CB_FOG_GREEN = 0x00028428, - CB_FOG_BLUE = 0x0002842c, - DB_STENCILREFMASK = 0x00028430, - STENCILREF_mask = 0xff << 0, - STENCILREF_shift = 0, - STENCILMASK_mask = 0xff << 8, - STENCILMASK_shift = 8, - STENCILWRITEMASK_mask = 0xff << 16, - STENCILWRITEMASK_shift = 16, - DB_STENCILREFMASK_BF = 0x00028434, - STENCILREF_BF_mask = 0xff << 0, - STENCILREF_BF_shift = 0, - STENCILMASK_BF_mask = 0xff << 8, - STENCILMASK_BF_shift = 8, - STENCILWRITEMASK_BF_mask = 0xff << 16, - STENCILWRITEMASK_BF_shift = 16, - SX_ALPHA_REF = 0x00028438, - PA_CL_VPORT_XSCALE_0 = 0x0002843c, - PA_CL_VPORT_XSCALE_0_num = 16, - PA_CL_VPORT_XSCALE_0_offset = 24, - PA_CL_VPORT_XOFFSET_0 = 0x00028440, - PA_CL_VPORT_XOFFSET_0_num = 16, - PA_CL_VPORT_XOFFSET_0_offset = 24, - PA_CL_VPORT_YSCALE_0 = 0x00028444, - PA_CL_VPORT_YSCALE_0_num = 16, - PA_CL_VPORT_YSCALE_0_offset = 24, - PA_CL_VPORT_YOFFSET_0 = 0x00028448, - PA_CL_VPORT_YOFFSET_0_num = 16, - PA_CL_VPORT_YOFFSET_0_offset = 24, - PA_CL_VPORT_ZSCALE_0 = 0x0002844c, - PA_CL_VPORT_ZSCALE_0_num = 16, - PA_CL_VPORT_ZSCALE_0_offset = 24, - PA_CL_VPORT_ZOFFSET_0 = 0x00028450, - PA_CL_VPORT_ZOFFSET_0_num = 16, - PA_CL_VPORT_ZOFFSET_0_offset = 24, - SPI_VS_OUT_ID_0 = 0x00028614, - SPI_VS_OUT_ID_0_num = 10, - SEMANTIC_0_mask = 0xff << 0, - SEMANTIC_0_shift = 0, - SEMANTIC_1_mask = 0xff << 8, - SEMANTIC_1_shift = 8, - SEMANTIC_2_mask = 0xff << 16, - SEMANTIC_2_shift = 16, - SEMANTIC_3_mask = 0xff << 24, - SEMANTIC_3_shift = 24, - SPI_PS_INPUT_CNTL_0 = 0x00028644, - SPI_PS_INPUT_CNTL_0_num = 32, - SEMANTIC_mask = 0xff << 0, - SEMANTIC_shift = 0, - DEFAULT_VAL_mask = 0x03 << 8, - DEFAULT_VAL_shift = 8, - X_0_0F = 0x00, - FLAT_SHADE_bit = 1 << 10, - SEL_CENTROID_bit = 1 << 11, - SEL_LINEAR_bit = 1 << 12, - CYL_WRAP_mask = 0x0f << 13, - CYL_WRAP_shift = 13, - PT_SPRITE_TEX_bit = 1 << 17, - SEL_SAMPLE_bit = 1 << 18, - SPI_VS_OUT_CONFIG = 0x000286c4, - VS_PER_COMPONENT_bit = 1 << 0, - VS_EXPORT_COUNT_mask = 0x1f << 1, - VS_EXPORT_COUNT_shift = 1, - VS_EXPORTS_FOG_bit = 1 << 8, - VS_OUT_FOG_VEC_ADDR_mask = 0x1f << 9, - VS_OUT_FOG_VEC_ADDR_shift = 9, - SPI_PS_IN_CONTROL_0 = 0x000286cc, - NUM_INTERP_mask = 0x3f << 0, - NUM_INTERP_shift = 0, - POSITION_ENA_bit = 1 << 8, - POSITION_CENTROID_bit = 1 << 9, - POSITION_ADDR_mask = 0x1f << 10, - POSITION_ADDR_shift = 10, - PARAM_GEN_mask = 0x0f << 15, - PARAM_GEN_shift = 15, - PARAM_GEN_ADDR_mask = 0x7f << 19, - PARAM_GEN_ADDR_shift = 19, - BARYC_SAMPLE_CNTL_mask = 0x03 << 26, - BARYC_SAMPLE_CNTL_shift = 26, - CENTROIDS_ONLY = 0x00, - CENTERS_ONLY = 0x01, - CENTROIDS_AND_CENTERS = 0x02, - UNDEF = 0x03, - PERSP_GRADIENT_ENA_bit = 1 << 28, - LINEAR_GRADIENT_ENA_bit = 1 << 29, - POSITION_SAMPLE_bit = 1 << 30, - BARYC_AT_SAMPLE_ENA_bit = 1 << 31, - SPI_PS_IN_CONTROL_1 = 0x000286d0, - GEN_INDEX_PIX_bit = 1 << 0, - GEN_INDEX_PIX_ADDR_mask = 0x7f << 1, - GEN_INDEX_PIX_ADDR_shift = 1, - FRONT_FACE_ENA_bit = 1 << 8, - FRONT_FACE_CHAN_mask = 0x03 << 9, - FRONT_FACE_CHAN_shift = 9, - FRONT_FACE_ALL_BITS_bit = 1 << 11, - FRONT_FACE_ADDR_mask = 0x1f << 12, - FRONT_FACE_ADDR_shift = 12, - FOG_ADDR_mask = 0x7f << 17, - FOG_ADDR_shift = 17, - FIXED_PT_POSITION_ENA_bit = 1 << 24, - FIXED_PT_POSITION_ADDR_mask = 0x1f << 25, - FIXED_PT_POSITION_ADDR_shift = 25, - SPI_INTERP_CONTROL_0 = 0x000286d4, - FLAT_SHADE_ENA_bit = 1 << 0, - PNT_SPRITE_ENA_bit = 1 << 1, - PNT_SPRITE_OVRD_X_mask = 0x07 << 2, - PNT_SPRITE_OVRD_X_shift = 2, - SPI_PNT_SPRITE_SEL_0 = 0x00, - SPI_PNT_SPRITE_SEL_1 = 0x01, - SPI_PNT_SPRITE_SEL_S = 0x02, - SPI_PNT_SPRITE_SEL_T = 0x03, - SPI_PNT_SPRITE_SEL_NONE = 0x04, - PNT_SPRITE_OVRD_Y_mask = 0x07 << 5, - PNT_SPRITE_OVRD_Y_shift = 5, -/* SPI_PNT_SPRITE_SEL_0 = 0x00, */ -/* SPI_PNT_SPRITE_SEL_1 = 0x01, */ -/* SPI_PNT_SPRITE_SEL_S = 0x02, */ -/* SPI_PNT_SPRITE_SEL_T = 0x03, */ -/* SPI_PNT_SPRITE_SEL_NONE = 0x04, */ - PNT_SPRITE_OVRD_Z_mask = 0x07 << 8, - PNT_SPRITE_OVRD_Z_shift = 8, -/* SPI_PNT_SPRITE_SEL_0 = 0x00, */ -/* SPI_PNT_SPRITE_SEL_1 = 0x01, */ -/* SPI_PNT_SPRITE_SEL_S = 0x02, */ -/* SPI_PNT_SPRITE_SEL_T = 0x03, */ -/* SPI_PNT_SPRITE_SEL_NONE = 0x04, */ - PNT_SPRITE_OVRD_W_mask = 0x07 << 11, - PNT_SPRITE_OVRD_W_shift = 11, -/* SPI_PNT_SPRITE_SEL_0 = 0x00, */ -/* SPI_PNT_SPRITE_SEL_1 = 0x01, */ -/* SPI_PNT_SPRITE_SEL_S = 0x02, */ -/* SPI_PNT_SPRITE_SEL_T = 0x03, */ -/* SPI_PNT_SPRITE_SEL_NONE = 0x04, */ - PNT_SPRITE_TOP_1_bit = 1 << 14, - SPI_INPUT_Z = 0x000286d8, - PROVIDE_Z_TO_SPI_bit = 1 << 0, - SPI_FOG_CNTL = 0x000286dc, - PASS_FOG_THROUGH_PS_bit = 1 << 0, - PIXEL_FOG_FUNC_mask = 0x03 << 1, - PIXEL_FOG_FUNC_shift = 1, - SPI_FOG_NONE = 0x00, - SPI_FOG_EXP = 0x01, - SPI_FOG_EXP2 = 0x02, - SPI_FOG_LINEAR = 0x03, - PIXEL_FOG_SRC_SEL_bit = 1 << 3, - VS_FOG_CLAMP_DISABLE_bit = 1 << 4, - SPI_FOG_FUNC_SCALE = 0x000286e0, - SPI_FOG_FUNC_BIAS = 0x000286e4, - CB_BLEND0_CONTROL = 0x00028780, - CB_BLEND0_CONTROL_num = 8, - COLOR_SRCBLEND_mask = 0x1f << 0, - COLOR_SRCBLEND_shift = 0, - COLOR_COMB_FCN_mask = 0x07 << 5, - COLOR_COMB_FCN_shift = 5, - COLOR_DESTBLEND_mask = 0x1f << 8, - COLOR_DESTBLEND_shift = 8, - OPACITY_WEIGHT_bit = 1 << 13, - ALPHA_SRCBLEND_mask = 0x1f << 16, - ALPHA_SRCBLEND_shift = 16, - ALPHA_COMB_FCN_mask = 0x07 << 21, - ALPHA_COMB_FCN_shift = 21, - ALPHA_DESTBLEND_mask = 0x1f << 24, - ALPHA_DESTBLEND_shift = 24, - SEPARATE_ALPHA_BLEND_bit = 1 << 29, - VGT_DMA_BASE_HI = 0x000287e4, - VGT_DMA_BASE_HI__BASE_ADDR_mask = 0xff << 0, - VGT_DMA_BASE_HI__BASE_ADDR_shift = 0, - VGT_DMA_BASE = 0x000287e8, - VGT_DRAW_INITIATOR = 0x000287f0, - SOURCE_SELECT_mask = 0x03 << 0, - SOURCE_SELECT_shift = 0, - DI_SRC_SEL_DMA = 0x00, - DI_SRC_SEL_IMMEDIATE = 0x01, - DI_SRC_SEL_AUTO_INDEX = 0x02, - DI_SRC_SEL_RESERVED = 0x03, - MAJOR_MODE_mask = 0x03 << 2, - MAJOR_MODE_shift = 2, - DI_MAJOR_MODE_0 = 0x00, - DI_MAJOR_MODE_1 = 0x01, - SPRITE_EN_bit = 1 << 4, - NOT_EOP_bit = 1 << 5, - USE_OPAQUE_bit = 1 << 6, - VGT_IMMED_DATA = 0x000287f4, - VGT_EVENT_ADDRESS_REG = 0x000287f8, - ADDRESS_LOW_mask = 0xfffffff << 0, - ADDRESS_LOW_shift = 0, - DB_DEPTH_CONTROL = 0x00028800, - STENCIL_ENABLE_bit = 1 << 0, - Z_ENABLE_bit = 1 << 1, - Z_WRITE_ENABLE_bit = 1 << 2, - ZFUNC_mask = 0x07 << 4, - ZFUNC_shift = 4, - FRAG_NEVER = 0x00, - FRAG_LESS = 0x01, - FRAG_EQUAL = 0x02, - FRAG_LEQUAL = 0x03, - FRAG_GREATER = 0x04, - FRAG_NOTEQUAL = 0x05, - FRAG_GEQUAL = 0x06, - FRAG_ALWAYS = 0x07, - BACKFACE_ENABLE_bit = 1 << 7, - STENCILFUNC_mask = 0x07 << 8, - STENCILFUNC_shift = 8, -/* REF_NEVER = 0x00, */ -/* REF_LESS = 0x01, */ -/* REF_EQUAL = 0x02, */ -/* REF_LEQUAL = 0x03, */ -/* REF_GREATER = 0x04, */ -/* REF_NOTEQUAL = 0x05, */ -/* REF_GEQUAL = 0x06, */ -/* REF_ALWAYS = 0x07, */ - STENCILFAIL_mask = 0x07 << 11, - STENCILFAIL_shift = 11, - STENCIL_KEEP = 0x00, - STENCIL_ZERO = 0x01, - STENCIL_REPLACE = 0x02, - STENCIL_INCR_CLAMP = 0x03, - STENCIL_DECR_CLAMP = 0x04, - STENCIL_INVERT = 0x05, - STENCIL_INCR_WRAP = 0x06, - STENCIL_DECR_WRAP = 0x07, - STENCILZPASS_mask = 0x07 << 14, - STENCILZPASS_shift = 14, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - STENCILZFAIL_mask = 0x07 << 17, - STENCILZFAIL_shift = 17, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - STENCILFUNC_BF_mask = 0x07 << 20, - STENCILFUNC_BF_shift = 20, -/* REF_NEVER = 0x00, */ -/* REF_LESS = 0x01, */ -/* REF_EQUAL = 0x02, */ -/* REF_LEQUAL = 0x03, */ -/* REF_GREATER = 0x04, */ -/* REF_NOTEQUAL = 0x05, */ -/* REF_GEQUAL = 0x06, */ -/* REF_ALWAYS = 0x07, */ - STENCILFAIL_BF_mask = 0x07 << 23, - STENCILFAIL_BF_shift = 23, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - STENCILZPASS_BF_mask = 0x07 << 26, - STENCILZPASS_BF_shift = 26, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - STENCILZFAIL_BF_mask = 0x07 << 29, - STENCILZFAIL_BF_shift = 29, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - CB_BLEND_CONTROL = 0x00028804, -/* COLOR_SRCBLEND_mask = 0x1f << 0, */ -/* COLOR_SRCBLEND_shift = 0, */ - BLEND_ZERO = 0x00, - BLEND_ONE = 0x01, - BLEND_SRC_COLOR = 0x02, - BLEND_ONE_MINUS_SRC_COLOR = 0x03, - BLEND_SRC_ALPHA = 0x04, - BLEND_ONE_MINUS_SRC_ALPHA = 0x05, - BLEND_DST_ALPHA = 0x06, - BLEND_ONE_MINUS_DST_ALPHA = 0x07, - BLEND_DST_COLOR = 0x08, - BLEND_ONE_MINUS_DST_COLOR = 0x09, - BLEND_SRC_ALPHA_SATURATE = 0x0a, - BLEND_BOTH_SRC_ALPHA = 0x0b, - BLEND_BOTH_INV_SRC_ALPHA = 0x0c, - BLEND_CONSTANT_COLOR = 0x0d, - BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0e, - BLEND_SRC1_COLOR = 0x0f, - BLEND_INV_SRC1_COLOR = 0x10, - BLEND_SRC1_ALPHA = 0x11, - BLEND_INV_SRC1_ALPHA = 0x12, - BLEND_CONSTANT_ALPHA = 0x13, - BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x14, -/* COLOR_COMB_FCN_mask = 0x07 << 5, */ -/* COLOR_COMB_FCN_shift = 5, */ - COMB_DST_PLUS_SRC = 0x00, - COMB_SRC_MINUS_DST = 0x01, - COMB_MIN_DST_SRC = 0x02, - COMB_MAX_DST_SRC = 0x03, - COMB_DST_MINUS_SRC = 0x04, -/* COLOR_DESTBLEND_mask = 0x1f << 8, */ -/* COLOR_DESTBLEND_shift = 8, */ -/* BLEND_ZERO = 0x00, */ -/* BLEND_ONE = 0x01, */ -/* BLEND_SRC_COLOR = 0x02, */ -/* BLEND_ONE_MINUS_SRC_COLOR = 0x03, */ -/* BLEND_SRC_ALPHA = 0x04, */ -/* BLEND_ONE_MINUS_SRC_ALPHA = 0x05, */ -/* BLEND_DST_ALPHA = 0x06, */ -/* BLEND_ONE_MINUS_DST_ALPHA = 0x07, */ -/* BLEND_DST_COLOR = 0x08, */ -/* BLEND_ONE_MINUS_DST_COLOR = 0x09, */ -/* BLEND_SRC_ALPHA_SATURATE = 0x0a, */ -/* BLEND_BOTH_SRC_ALPHA = 0x0b, */ -/* BLEND_BOTH_INV_SRC_ALPHA = 0x0c, */ -/* BLEND_CONSTANT_COLOR = 0x0d, */ -/* BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0e, */ -/* BLEND_SRC1_COLOR = 0x0f, */ -/* BLEND_INV_SRC1_COLOR = 0x10, */ -/* BLEND_SRC1_ALPHA = 0x11, */ -/* BLEND_INV_SRC1_ALPHA = 0x12, */ -/* BLEND_CONSTANT_ALPHA = 0x13, */ -/* BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x14, */ -/* OPACITY_WEIGHT_bit = 1 << 13, */ -/* ALPHA_SRCBLEND_mask = 0x1f << 16, */ -/* ALPHA_SRCBLEND_shift = 16, */ -/* BLEND_ZERO = 0x00, */ -/* BLEND_ONE = 0x01, */ -/* BLEND_SRC_COLOR = 0x02, */ -/* BLEND_ONE_MINUS_SRC_COLOR = 0x03, */ -/* BLEND_SRC_ALPHA = 0x04, */ -/* BLEND_ONE_MINUS_SRC_ALPHA = 0x05, */ -/* BLEND_DST_ALPHA = 0x06, */ -/* BLEND_ONE_MINUS_DST_ALPHA = 0x07, */ -/* BLEND_DST_COLOR = 0x08, */ -/* BLEND_ONE_MINUS_DST_COLOR = 0x09, */ -/* BLEND_SRC_ALPHA_SATURATE = 0x0a, */ -/* BLEND_BOTH_SRC_ALPHA = 0x0b, */ -/* BLEND_BOTH_INV_SRC_ALPHA = 0x0c, */ -/* BLEND_CONSTANT_COLOR = 0x0d, */ -/* BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0e, */ -/* BLEND_SRC1_COLOR = 0x0f, */ -/* BLEND_INV_SRC1_COLOR = 0x10, */ -/* BLEND_SRC1_ALPHA = 0x11, */ -/* BLEND_INV_SRC1_ALPHA = 0x12, */ -/* BLEND_CONSTANT_ALPHA = 0x13, */ -/* BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x14, */ -/* ALPHA_COMB_FCN_mask = 0x07 << 21, */ -/* ALPHA_COMB_FCN_shift = 21, */ -/* COMB_DST_PLUS_SRC = 0x00, */ -/* COMB_SRC_MINUS_DST = 0x01, */ -/* COMB_MIN_DST_SRC = 0x02, */ -/* COMB_MAX_DST_SRC = 0x03, */ -/* COMB_DST_MINUS_SRC = 0x04, */ -/* ALPHA_DESTBLEND_mask = 0x1f << 24, */ -/* ALPHA_DESTBLEND_shift = 24, */ -/* BLEND_ZERO = 0x00, */ -/* BLEND_ONE = 0x01, */ -/* BLEND_SRC_COLOR = 0x02, */ -/* BLEND_ONE_MINUS_SRC_COLOR = 0x03, */ -/* BLEND_SRC_ALPHA = 0x04, */ -/* BLEND_ONE_MINUS_SRC_ALPHA = 0x05, */ -/* BLEND_DST_ALPHA = 0x06, */ -/* BLEND_ONE_MINUS_DST_ALPHA = 0x07, */ -/* BLEND_DST_COLOR = 0x08, */ -/* BLEND_ONE_MINUS_DST_COLOR = 0x09, */ -/* BLEND_SRC_ALPHA_SATURATE = 0x0a, */ -/* BLEND_BOTH_SRC_ALPHA = 0x0b, */ -/* BLEND_BOTH_INV_SRC_ALPHA = 0x0c, */ -/* BLEND_CONSTANT_COLOR = 0x0d, */ -/* BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0e, */ -/* BLEND_SRC1_COLOR = 0x0f, */ -/* BLEND_INV_SRC1_COLOR = 0x10, */ -/* BLEND_SRC1_ALPHA = 0x11, */ -/* BLEND_INV_SRC1_ALPHA = 0x12, */ -/* BLEND_CONSTANT_ALPHA = 0x13, */ -/* BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x14, */ -/* SEPARATE_ALPHA_BLEND_bit = 1 << 29, */ - CB_COLOR_CONTROL = 0x00028808, - FOG_ENABLE_bit = 1 << 0, - MULTIWRITE_ENABLE_bit = 1 << 1, - DITHER_ENABLE_bit = 1 << 2, - DEGAMMA_ENABLE_bit = 1 << 3, - SPECIAL_OP_mask = 0x07 << 4, - SPECIAL_OP_shift = 4, - SPECIAL_NORMAL = 0x00, - SPECIAL_DISABLE = 0x01, - SPECIAL_FAST_CLEAR = 0x02, - SPECIAL_FORCE_CLEAR = 0x03, - SPECIAL_EXPAND_COLOR = 0x04, - SPECIAL_EXPAND_TEXTURE = 0x05, - SPECIAL_EXPAND_SAMPLES = 0x06, - SPECIAL_RESOLVE_BOX = 0x07, - PER_MRT_BLEND_bit = 1 << 7, - TARGET_BLEND_ENABLE_mask = 0xff << 8, - TARGET_BLEND_ENABLE_shift = 8, - ROP3_mask = 0xff << 16, - ROP3_shift = 16, - DB_SHADER_CONTROL = 0x0002880c, - Z_EXPORT_ENABLE_bit = 1 << 0, - STENCIL_REF_EXPORT_ENABLE_bit = 1 << 1, - Z_ORDER_mask = 0x03 << 4, - Z_ORDER_shift = 4, - LATE_Z = 0x00, - EARLY_Z_THEN_LATE_Z = 0x01, - RE_Z = 0x02, - EARLY_Z_THEN_RE_Z = 0x03, - KILL_ENABLE_bit = 1 << 6, - COVERAGE_TO_MASK_ENABLE_bit = 1 << 7, - MASK_EXPORT_ENABLE_bit = 1 << 8, - DUAL_EXPORT_ENABLE_bit = 1 << 9, - EXEC_ON_HIER_FAIL_bit = 1 << 10, - EXEC_ON_NOOP_bit = 1 << 11, - PA_CL_CLIP_CNTL = 0x00028810, - UCP_ENA_0_bit = 1 << 0, - UCP_ENA_1_bit = 1 << 1, - UCP_ENA_2_bit = 1 << 2, - UCP_ENA_3_bit = 1 << 3, - UCP_ENA_4_bit = 1 << 4, - UCP_ENA_5_bit = 1 << 5, - PS_UCP_Y_SCALE_NEG_bit = 1 << 13, - PS_UCP_MODE_mask = 0x03 << 14, - PS_UCP_MODE_shift = 14, - CLIP_DISABLE_bit = 1 << 16, - UCP_CULL_ONLY_ENA_bit = 1 << 17, - BOUNDARY_EDGE_FLAG_ENA_bit = 1 << 18, - DX_CLIP_SPACE_DEF_bit = 1 << 19, - DIS_CLIP_ERR_DETECT_bit = 1 << 20, - VTX_KILL_OR_bit = 1 << 21, - DX_LINEAR_ATTR_CLIP_ENA_bit = 1 << 24, - VTE_VPORT_PROVOKE_DISABLE_bit = 1 << 25, - ZCLIP_NEAR_DISABLE_bit = 1 << 26, - ZCLIP_FAR_DISABLE_bit = 1 << 27, - PA_SU_SC_MODE_CNTL = 0x00028814, - CULL_FRONT_bit = 1 << 0, - CULL_BACK_bit = 1 << 1, - FACE_bit = 1 << 2, - POLY_MODE_mask = 0x03 << 3, - POLY_MODE_shift = 3, - X_DISABLE_POLY_MODE = 0x00, - X_DUAL_MODE = 0x01, - POLYMODE_FRONT_PTYPE_mask = 0x07 << 5, - POLYMODE_FRONT_PTYPE_shift = 5, - X_DRAW_POINTS = 0x00, - X_DRAW_LINES = 0x01, - X_DRAW_TRIANGLES = 0x02, - POLYMODE_BACK_PTYPE_mask = 0x07 << 8, - POLYMODE_BACK_PTYPE_shift = 8, -/* X_DRAW_POINTS = 0x00, */ -/* X_DRAW_LINES = 0x01, */ -/* X_DRAW_TRIANGLES = 0x02, */ - POLY_OFFSET_FRONT_ENABLE_bit = 1 << 11, - POLY_OFFSET_BACK_ENABLE_bit = 1 << 12, - POLY_OFFSET_PARA_ENABLE_bit = 1 << 13, - VTX_WINDOW_OFFSET_ENABLE_bit = 1 << 16, - PROVOKING_VTX_LAST_bit = 1 << 19, - PERSP_CORR_DIS_bit = 1 << 20, - MULTI_PRIM_IB_ENA_bit = 1 << 21, - PA_CL_VTE_CNTL = 0x00028818, - VPORT_X_SCALE_ENA_bit = 1 << 0, - VPORT_X_OFFSET_ENA_bit = 1 << 1, - VPORT_Y_SCALE_ENA_bit = 1 << 2, - VPORT_Y_OFFSET_ENA_bit = 1 << 3, - VPORT_Z_SCALE_ENA_bit = 1 << 4, - VPORT_Z_OFFSET_ENA_bit = 1 << 5, - VTX_XY_FMT_bit = 1 << 8, - VTX_Z_FMT_bit = 1 << 9, - VTX_W0_FMT_bit = 1 << 10, - PERFCOUNTER_REF_bit = 1 << 11, - PA_CL_VS_OUT_CNTL = 0x0002881c, - CLIP_DIST_ENA_0_bit = 1 << 0, - CLIP_DIST_ENA_1_bit = 1 << 1, - CLIP_DIST_ENA_2_bit = 1 << 2, - CLIP_DIST_ENA_3_bit = 1 << 3, - CLIP_DIST_ENA_4_bit = 1 << 4, - CLIP_DIST_ENA_5_bit = 1 << 5, - CLIP_DIST_ENA_6_bit = 1 << 6, - CLIP_DIST_ENA_7_bit = 1 << 7, - CULL_DIST_ENA_0_bit = 1 << 8, - CULL_DIST_ENA_1_bit = 1 << 9, - CULL_DIST_ENA_2_bit = 1 << 10, - CULL_DIST_ENA_3_bit = 1 << 11, - CULL_DIST_ENA_4_bit = 1 << 12, - CULL_DIST_ENA_5_bit = 1 << 13, - CULL_DIST_ENA_6_bit = 1 << 14, - CULL_DIST_ENA_7_bit = 1 << 15, - USE_VTX_POINT_SIZE_bit = 1 << 16, - USE_VTX_EDGE_FLAG_bit = 1 << 17, - USE_VTX_RENDER_TARGET_INDX_bit = 1 << 18, - USE_VTX_VIEWPORT_INDX_bit = 1 << 19, - USE_VTX_KILL_FLAG_bit = 1 << 20, - VS_OUT_MISC_VEC_ENA_bit = 1 << 21, - VS_OUT_CCDIST0_VEC_ENA_bit = 1 << 22, - VS_OUT_CCDIST1_VEC_ENA_bit = 1 << 23, - PA_CL_NANINF_CNTL = 0x00028820, - VTE_XY_INF_DISCARD_bit = 1 << 0, - VTE_Z_INF_DISCARD_bit = 1 << 1, - VTE_W_INF_DISCARD_bit = 1 << 2, - VTE_0XNANINF_IS_0_bit = 1 << 3, - VTE_XY_NAN_RETAIN_bit = 1 << 4, - VTE_Z_NAN_RETAIN_bit = 1 << 5, - VTE_W_NAN_RETAIN_bit = 1 << 6, - VTE_W_RECIP_NAN_IS_0_bit = 1 << 7, - VS_XY_NAN_TO_INF_bit = 1 << 8, - VS_XY_INF_RETAIN_bit = 1 << 9, - VS_Z_NAN_TO_INF_bit = 1 << 10, - VS_Z_INF_RETAIN_bit = 1 << 11, - VS_W_NAN_TO_INF_bit = 1 << 12, - VS_W_INF_RETAIN_bit = 1 << 13, - VS_CLIP_DIST_INF_DISCARD_bit = 1 << 14, - VTE_NO_OUTPUT_NEG_0_bit = 1 << 20, - SQ_PGM_START_PS = 0x00028840, - SQ_PGM_RESOURCES_PS = 0x00028850, - NUM_GPRS_mask = 0xff << 0, - NUM_GPRS_shift = 0, - STACK_SIZE_mask = 0xff << 8, - STACK_SIZE_shift = 8, - SQ_PGM_RESOURCES_PS__DX10_CLAMP_bit = 1 << 21, - FETCH_CACHE_LINES_mask = 0x07 << 24, - FETCH_CACHE_LINES_shift = 24, - UNCACHED_FIRST_INST_bit = 1 << 28, - CLAMP_CONSTS_bit = 1 << 31, - SQ_PGM_EXPORTS_PS = 0x00028854, - EXPORT_MODE_mask = 0x1f << 0, - EXPORT_MODE_shift = 0, - SQ_PGM_START_VS = 0x00028858, - SQ_PGM_RESOURCES_VS = 0x00028868, -/* NUM_GPRS_mask = 0xff << 0, */ -/* NUM_GPRS_shift = 0, */ -/* STACK_SIZE_mask = 0xff << 8, */ -/* STACK_SIZE_shift = 8, */ - SQ_PGM_RESOURCES_VS__DX10_CLAMP_bit = 1 << 21, -/* FETCH_CACHE_LINES_mask = 0x07 << 24, */ -/* FETCH_CACHE_LINES_shift = 24, */ -/* UNCACHED_FIRST_INST_bit = 1 << 28, */ - SQ_PGM_START_GS = 0x0002886c, - SQ_PGM_RESOURCES_GS = 0x0002887c, -/* NUM_GPRS_mask = 0xff << 0, */ -/* NUM_GPRS_shift = 0, */ -/* STACK_SIZE_mask = 0xff << 8, */ -/* STACK_SIZE_shift = 8, */ - SQ_PGM_RESOURCES_GS__DX10_CLAMP_bit = 1 << 21, -/* FETCH_CACHE_LINES_mask = 0x07 << 24, */ -/* FETCH_CACHE_LINES_shift = 24, */ -/* UNCACHED_FIRST_INST_bit = 1 << 28, */ - SQ_PGM_START_ES = 0x00028880, - SQ_PGM_RESOURCES_ES = 0x00028890, -/* NUM_GPRS_mask = 0xff << 0, */ -/* NUM_GPRS_shift = 0, */ -/* STACK_SIZE_mask = 0xff << 8, */ -/* STACK_SIZE_shift = 8, */ - SQ_PGM_RESOURCES_ES__DX10_CLAMP_bit = 1 << 21, -/* FETCH_CACHE_LINES_mask = 0x07 << 24, */ -/* FETCH_CACHE_LINES_shift = 24, */ -/* UNCACHED_FIRST_INST_bit = 1 << 28, */ - SQ_PGM_START_FS = 0x00028894, - SQ_PGM_RESOURCES_FS = 0x000288a4, -/* NUM_GPRS_mask = 0xff << 0, */ -/* NUM_GPRS_shift = 0, */ -/* STACK_SIZE_mask = 0xff << 8, */ -/* STACK_SIZE_shift = 8, */ - SQ_PGM_RESOURCES_FS__DX10_CLAMP_bit = 1 << 21, - SQ_ESGS_RING_ITEMSIZE = 0x000288a8, - ITEMSIZE_mask = 0x7fff << 0, - ITEMSIZE_shift = 0, - SQ_GSVS_RING_ITEMSIZE = 0x000288ac, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_ESTMP_RING_ITEMSIZE = 0x000288b0, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_GSTMP_RING_ITEMSIZE = 0x000288b4, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_VSTMP_RING_ITEMSIZE = 0x000288b8, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_PSTMP_RING_ITEMSIZE = 0x000288bc, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_FBUF_RING_ITEMSIZE = 0x000288c0, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_REDUC_RING_ITEMSIZE = 0x000288c4, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_GS_VERT_ITEMSIZE = 0x000288c8, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_PGM_CF_OFFSET_PS = 0x000288cc, - PGM_CF_OFFSET_mask = 0xfffff << 0, - PGM_CF_OFFSET_shift = 0, - SQ_PGM_CF_OFFSET_VS = 0x000288d0, -/* PGM_CF_OFFSET_mask = 0xfffff << 0, */ -/* PGM_CF_OFFSET_shift = 0, */ - SQ_PGM_CF_OFFSET_GS = 0x000288d4, -/* PGM_CF_OFFSET_mask = 0xfffff << 0, */ -/* PGM_CF_OFFSET_shift = 0, */ - SQ_PGM_CF_OFFSET_ES = 0x000288d8, -/* PGM_CF_OFFSET_mask = 0xfffff << 0, */ -/* PGM_CF_OFFSET_shift = 0, */ - SQ_PGM_CF_OFFSET_FS = 0x000288dc, -/* PGM_CF_OFFSET_mask = 0xfffff << 0, */ -/* PGM_CF_OFFSET_shift = 0, */ - SQ_VTX_SEMANTIC_CLEAR = 0x000288e0, - SQ_ALU_CONST_CACHE_PS_0 = 0x00028940, - SQ_ALU_CONST_CACHE_PS_0_num = 16, - SQ_ALU_CONST_CACHE_VS_0 = 0x00028980, - SQ_ALU_CONST_CACHE_VS_0_num = 16, - SQ_ALU_CONST_CACHE_GS_0 = 0x000289c0, - SQ_ALU_CONST_CACHE_GS_0_num = 16, - PA_SU_POINT_SIZE = 0x00028a00, - PA_SU_POINT_SIZE__HEIGHT_mask = 0xffff << 0, - PA_SU_POINT_SIZE__HEIGHT_shift = 0, - PA_SU_POINT_SIZE__WIDTH_mask = 0xffff << 16, - PA_SU_POINT_SIZE__WIDTH_shift = 16, - PA_SU_POINT_MINMAX = 0x00028a04, - MIN_SIZE_mask = 0xffff << 0, - MIN_SIZE_shift = 0, - MAX_SIZE_mask = 0xffff << 16, - MAX_SIZE_shift = 16, - PA_SU_LINE_CNTL = 0x00028a08, - PA_SU_LINE_CNTL__WIDTH_mask = 0xffff << 0, - PA_SU_LINE_CNTL__WIDTH_shift = 0, - PA_SC_LINE_STIPPLE = 0x00028a0c, - LINE_PATTERN_mask = 0xffff << 0, - LINE_PATTERN_shift = 0, - REPEAT_COUNT_mask = 0xff << 16, - REPEAT_COUNT_shift = 16, - PATTERN_BIT_ORDER_bit = 1 << 28, - AUTO_RESET_CNTL_mask = 0x03 << 29, - AUTO_RESET_CNTL_shift = 29, - VGT_OUTPUT_PATH_CNTL = 0x00028a10, - PATH_SELECT_mask = 0x03 << 0, - PATH_SELECT_shift = 0, - VGT_OUTPATH_VTX_REUSE = 0x00, - VGT_OUTPATH_TESS_EN = 0x01, - VGT_OUTPATH_PASSTHRU = 0x02, - VGT_OUTPATH_GS_BLOCK = 0x03, - VGT_HOS_CNTL = 0x00028a14, - TESS_MODE_mask = 0x03 << 0, - TESS_MODE_shift = 0, - VGT_HOS_MAX_TESS_LEVEL = 0x00028a18, - VGT_HOS_MIN_TESS_LEVEL = 0x00028a1c, - VGT_HOS_REUSE_DEPTH = 0x00028a20, - REUSE_DEPTH_mask = 0xff << 0, - REUSE_DEPTH_shift = 0, - VGT_GROUP_PRIM_TYPE = 0x00028a24, - VGT_GROUP_PRIM_TYPE__PRIM_TYPE_mask = 0x1f << 0, - VGT_GROUP_PRIM_TYPE__PRIM_TYPE_shift = 0, - VGT_GRP_3D_POINT = 0x00, - VGT_GRP_3D_LINE = 0x01, - VGT_GRP_3D_TRI = 0x02, - VGT_GRP_3D_RECT = 0x03, - VGT_GRP_3D_QUAD = 0x04, - VGT_GRP_2D_COPY_RECT_V0 = 0x05, - VGT_GRP_2D_COPY_RECT_V1 = 0x06, - VGT_GRP_2D_COPY_RECT_V2 = 0x07, - VGT_GRP_2D_COPY_RECT_V3 = 0x08, - VGT_GRP_2D_FILL_RECT = 0x09, - VGT_GRP_2D_LINE = 0x0a, - VGT_GRP_2D_TRI = 0x0b, - VGT_GRP_PRIM_INDEX_LINE = 0x0c, - VGT_GRP_PRIM_INDEX_TRI = 0x0d, - VGT_GRP_PRIM_INDEX_QUAD = 0x0e, - VGT_GRP_3D_LINE_ADJ = 0x0f, - VGT_GRP_3D_TRI_ADJ = 0x10, - RETAIN_ORDER_bit = 1 << 14, - RETAIN_QUADS_bit = 1 << 15, - PRIM_ORDER_mask = 0x07 << 16, - PRIM_ORDER_shift = 16, - VGT_GRP_LIST = 0x00, - VGT_GRP_STRIP = 0x01, - VGT_GRP_FAN = 0x02, - VGT_GRP_LOOP = 0x03, - VGT_GRP_POLYGON = 0x04, - VGT_GROUP_FIRST_DECR = 0x00028a28, - FIRST_DECR_mask = 0x0f << 0, - FIRST_DECR_shift = 0, - VGT_GROUP_DECR = 0x00028a2c, - DECR_mask = 0x0f << 0, - DECR_shift = 0, - VGT_GROUP_VECT_0_CNTL = 0x00028a30, - COMP_X_EN_bit = 1 << 0, - COMP_Y_EN_bit = 1 << 1, - COMP_Z_EN_bit = 1 << 2, - COMP_W_EN_bit = 1 << 3, - VGT_GROUP_VECT_0_CNTL__STRIDE_mask = 0xff << 8, - VGT_GROUP_VECT_0_CNTL__STRIDE_shift = 8, - SHIFT_mask = 0xff << 16, - SHIFT_shift = 16, - VGT_GROUP_VECT_1_CNTL = 0x00028a34, -/* COMP_X_EN_bit = 1 << 0, */ -/* COMP_Y_EN_bit = 1 << 1, */ -/* COMP_Z_EN_bit = 1 << 2, */ -/* COMP_W_EN_bit = 1 << 3, */ - VGT_GROUP_VECT_1_CNTL__STRIDE_mask = 0xff << 8, - VGT_GROUP_VECT_1_CNTL__STRIDE_shift = 8, -/* SHIFT_mask = 0xff << 16, */ -/* SHIFT_shift = 16, */ - VGT_GROUP_VECT_0_FMT_CNTL = 0x00028a38, - X_CONV_mask = 0x0f << 0, - X_CONV_shift = 0, - VGT_GRP_INDEX_16 = 0x00, - VGT_GRP_INDEX_32 = 0x01, - VGT_GRP_UINT_16 = 0x02, - VGT_GRP_UINT_32 = 0x03, - VGT_GRP_SINT_16 = 0x04, - VGT_GRP_SINT_32 = 0x05, - VGT_GRP_FLOAT_32 = 0x06, - VGT_GRP_AUTO_PRIM = 0x07, - VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, - X_OFFSET_mask = 0x0f << 4, - X_OFFSET_shift = 4, - Y_CONV_mask = 0x0f << 8, - Y_CONV_shift = 8, -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ - Y_OFFSET_mask = 0x0f << 12, - Y_OFFSET_shift = 12, - Z_CONV_mask = 0x0f << 16, - Z_CONV_shift = 16, -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ - Z_OFFSET_mask = 0x0f << 20, - Z_OFFSET_shift = 20, - W_CONV_mask = 0x0f << 24, - W_CONV_shift = 24, -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ - W_OFFSET_mask = 0x0f << 28, - W_OFFSET_shift = 28, - VGT_GROUP_VECT_1_FMT_CNTL = 0x00028a3c, -/* X_CONV_mask = 0x0f << 0, */ -/* X_CONV_shift = 0, */ -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ -/* X_OFFSET_mask = 0x0f << 4, */ -/* X_OFFSET_shift = 4, */ -/* Y_CONV_mask = 0x0f << 8, */ -/* Y_CONV_shift = 8, */ -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ -/* Y_OFFSET_mask = 0x0f << 12, */ -/* Y_OFFSET_shift = 12, */ -/* Z_CONV_mask = 0x0f << 16, */ -/* Z_CONV_shift = 16, */ -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ -/* Z_OFFSET_mask = 0x0f << 20, */ -/* Z_OFFSET_shift = 20, */ -/* W_CONV_mask = 0x0f << 24, */ -/* W_CONV_shift = 24, */ -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ -/* W_OFFSET_mask = 0x0f << 28, */ -/* W_OFFSET_shift = 28, */ - VGT_GS_MODE = 0x00028a40, - MODE_mask = 0x03 << 0, - MODE_shift = 0, - GS_OFF = 0x00, - GS_SCENARIO_A = 0x01, - GS_SCENARIO_B = 0x02, - GS_SCENARIO_G = 0x03, - ES_PASSTHRU_bit = 1 << 2, - CUT_MODE_mask = 0x03 << 3, - CUT_MODE_shift = 3, - GS_CUT_1024 = 0x00, - GS_CUT_512 = 0x01, - GS_CUT_256 = 0x02, - GS_CUT_128 = 0x03, - PA_SC_MPASS_PS_CNTL = 0x00028a48, - MPASS_PIX_VEC_PER_PASS_mask = 0xfffff << 0, - MPASS_PIX_VEC_PER_PASS_shift = 0, - MPASS_PS_ENA_bit = 1 << 31, - PA_SC_MODE_CNTL = 0x00028a4c, - MSAA_ENABLE_bit = 1 << 0, - CLIPRECT_ENABLE_bit = 1 << 1, - LINE_STIPPLE_ENABLE_bit = 1 << 2, - MULTI_CHIP_PRIM_DISCARD_ENAB_bit = 1 << 3, - WALK_ORDER_ENABLE_bit = 1 << 4, - HALVE_DETAIL_SAMPLE_PERF_bit = 1 << 5, - WALK_SIZE_bit = 1 << 6, - WALK_ALIGNMENT_bit = 1 << 7, - WALK_ALIGN8_PRIM_FITS_ST_bit = 1 << 8, - TILE_COVER_NO_SCISSOR_bit = 1 << 9, - KILL_PIX_POST_HI_Z_bit = 1 << 10, - KILL_PIX_POST_DETAIL_MASK_bit = 1 << 11, - MULTI_CHIP_SUPERTILE_ENABLE_bit = 1 << 12, - TILE_COVER_DISABLE_bit = 1 << 13, - FORCE_EOV_CNTDWN_ENABLE_bit = 1 << 14, - FORCE_EOV_TILE_ENABLE_bit = 1 << 15, - FORCE_EOV_REZ_ENABLE_bit = 1 << 16, - PS_ITER_SAMPLE_bit = 1 << 17, - VGT_ENHANCE = 0x00028a50, - VGT_ENHANCE__MI_TIMESTAMP_RES_mask = 0x03 << 0, - VGT_ENHANCE__MI_TIMESTAMP_RES_shift = 0, - X_0_992_CLOCKS_LATENCY_RANGE_IN_STEPS_OF_32 = 0x00, - X_0_496_CLOCKS_LATENCY_RANGE_IN_STEPS_OF_16 = 0x01, - X_0_248_CLOCKS_LATENCY_RANGE_IN_STEPS_OF_8 = 0x02, - X_0_124_CLOCKS_LATENCY_RANGE_IN_STEPS_OF_4 = 0x03, - MISC_mask = 0x3fffffff << 2, - MISC_shift = 2, - VGT_GS_OUT_PRIM_TYPE = 0x00028a6c, - OUTPRIM_TYPE_mask = 0x3f << 0, - OUTPRIM_TYPE_shift = 0, - POINTLIST = 0x00, - LINESTRIP = 0x01, - TRISTRIP = 0x02, - VGT_DMA_SIZE = 0x00028a74, - VGT_DMA_INDEX_TYPE = 0x00028a7c, -/* INDEX_TYPE_mask = 0x03 << 0, */ -/* INDEX_TYPE_shift = 0, */ - VGT_INDEX_16 = 0x00, - VGT_INDEX_32 = 0x01, - SWAP_MODE_mask = 0x03 << 2, - SWAP_MODE_shift = 2, - VGT_DMA_SWAP_NONE = 0x00, - VGT_DMA_SWAP_16_BIT = 0x01, - VGT_DMA_SWAP_32_BIT = 0x02, - VGT_DMA_SWAP_WORD = 0x03, - VGT_PRIMITIVEID_EN = 0x00028a84, - PRIMITIVEID_EN_bit = 1 << 0, - VGT_DMA_NUM_INSTANCES = 0x00028a88, - VGT_EVENT_INITIATOR = 0x00028a90, - EVENT_TYPE_mask = 0x3f << 0, - EVENT_TYPE_shift = 0, - CACHE_FLUSH_TS = 0x04, - CONTEXT_DONE = 0x05, - CACHE_FLUSH = 0x06, - VIZQUERY_START = 0x07, - VIZQUERY_END = 0x08, - SC_WAIT_WC = 0x09, - MPASS_PS_CP_REFETCH = 0x0a, - MPASS_PS_RST_START = 0x0b, - MPASS_PS_INCR_START = 0x0c, - RST_PIX_CNT = 0x0d, - RST_VTX_CNT = 0x0e, - VS_PARTIAL_FLUSH = 0x0f, - PS_PARTIAL_FLUSH = 0x10, - CACHE_FLUSH_AND_INV_TS_EVENT = 0x14, - ZPASS_DONE = 0x15, - CACHE_FLUSH_AND_INV_EVENT = 0x16, - PERFCOUNTER_START = 0x17, - PERFCOUNTER_STOP = 0x18, - PIPELINESTAT_START = 0x19, - PIPELINESTAT_STOP = 0x1a, - PERFCOUNTER_SAMPLE = 0x1b, - FLUSH_ES_OUTPUT = 0x1c, - FLUSH_GS_OUTPUT = 0x1d, - SAMPLE_PIPELINESTAT = 0x1e, - SO_VGTSTREAMOUT_FLUSH = 0x1f, - SAMPLE_STREAMOUTSTATS = 0x20, - RESET_VTX_CNT = 0x21, - BLOCK_CONTEXT_DONE = 0x22, - CR_CONTEXT_DONE = 0x23, - VGT_FLUSH = 0x24, - CR_DONE_TS = 0x25, - SQ_NON_EVENT = 0x26, - SC_SEND_DB_VPZ = 0x27, - BOTTOM_OF_PIPE_TS = 0x28, - DB_CACHE_FLUSH_AND_INV = 0x2a, - ADDRESS_HI_mask = 0xff << 19, - ADDRESS_HI_shift = 19, - EXTENDED_EVENT_bit = 1 << 27, - VGT_MULTI_PRIM_IB_RESET_EN = 0x00028a94, - RESET_EN_bit = 1 << 0, - VGT_INSTANCE_STEP_RATE_0 = 0x00028aa0, - VGT_INSTANCE_STEP_RATE_1 = 0x00028aa4, - VGT_STRMOUT_EN = 0x00028ab0, - STREAMOUT_bit = 1 << 0, - VGT_REUSE_OFF = 0x00028ab4, - REUSE_OFF_bit = 1 << 0, - VGT_VTX_CNT_EN = 0x00028ab8, - VTX_CNT_EN_bit = 1 << 0, - VGT_STRMOUT_BUFFER_SIZE_0 = 0x00028ad0, - VGT_STRMOUT_VTX_STRIDE_0 = 0x00028ad4, - VGT_STRMOUT_VTX_STRIDE_0__STRIDE_mask = 0x3ff << 0, - VGT_STRMOUT_VTX_STRIDE_0__STRIDE_shift = 0, - VGT_STRMOUT_BUFFER_BASE_0 = 0x00028ad8, - VGT_STRMOUT_BUFFER_OFFSET_0 = 0x00028adc, - VGT_STRMOUT_BUFFER_SIZE_1 = 0x00028ae0, - VGT_STRMOUT_VTX_STRIDE_1 = 0x00028ae4, - VGT_STRMOUT_VTX_STRIDE_1__STRIDE_mask = 0x3ff << 0, - VGT_STRMOUT_VTX_STRIDE_1__STRIDE_shift = 0, - VGT_STRMOUT_BUFFER_BASE_1 = 0x00028ae8, - VGT_STRMOUT_BUFFER_OFFSET_1 = 0x00028aec, - VGT_STRMOUT_BUFFER_SIZE_2 = 0x00028af0, - VGT_STRMOUT_VTX_STRIDE_2 = 0x00028af4, - VGT_STRMOUT_VTX_STRIDE_2__STRIDE_mask = 0x3ff << 0, - VGT_STRMOUT_VTX_STRIDE_2__STRIDE_shift = 0, - VGT_STRMOUT_BUFFER_BASE_2 = 0x00028af8, - VGT_STRMOUT_BUFFER_OFFSET_2 = 0x00028afc, - VGT_STRMOUT_BUFFER_SIZE_3 = 0x00028b00, - VGT_STRMOUT_VTX_STRIDE_3 = 0x00028b04, - VGT_STRMOUT_VTX_STRIDE_3__STRIDE_mask = 0x3ff << 0, - VGT_STRMOUT_VTX_STRIDE_3__STRIDE_shift = 0, - VGT_STRMOUT_BUFFER_BASE_3 = 0x00028b08, - VGT_STRMOUT_BUFFER_OFFSET_3 = 0x00028b0c, - VGT_STRMOUT_BASE_OFFSET_0 = 0x00028b10, - VGT_STRMOUT_BASE_OFFSET_1 = 0x00028b14, - VGT_STRMOUT_BASE_OFFSET_2 = 0x00028b18, - VGT_STRMOUT_BASE_OFFSET_3 = 0x00028b1c, - VGT_STRMOUT_BUFFER_EN = 0x00028b20, - BUFFER_0_EN_bit = 1 << 0, - BUFFER_1_EN_bit = 1 << 1, - BUFFER_2_EN_bit = 1 << 2, - BUFFER_3_EN_bit = 1 << 3, - VGT_STRMOUT_DRAW_OPAQUE_OFFSET = 0x00028b28, - VGT_STRMOUT_DRAW_OPAQUE_BUFFER_FILLED_SIZE = 0x00028b2c, - VGT_STRMOUT_DRAW_OPAQUE_VERTEX_STRIDE = 0x00028b30, - VGT_STRMOUT_BASE_OFFSET_HI_0 = 0x00028b44, - VGT_STRMOUT_BASE_OFFSET_HI_0__BASE_OFFSET_mask = 0x3f << 0, - VGT_STRMOUT_BASE_OFFSET_HI_0__BASE_OFFSET_shift = 0, - VGT_STRMOUT_BASE_OFFSET_HI_1 = 0x00028b48, - VGT_STRMOUT_BASE_OFFSET_HI_1__BASE_OFFSET_mask = 0x3f << 0, - VGT_STRMOUT_BASE_OFFSET_HI_1__BASE_OFFSET_shift = 0, - VGT_STRMOUT_BASE_OFFSET_HI_2 = 0x00028b4c, - VGT_STRMOUT_BASE_OFFSET_HI_2__BASE_OFFSET_mask = 0x3f << 0, - VGT_STRMOUT_BASE_OFFSET_HI_2__BASE_OFFSET_shift = 0, - VGT_STRMOUT_BASE_OFFSET_HI_3 = 0x00028b50, - VGT_STRMOUT_BASE_OFFSET_HI_3__BASE_OFFSET_mask = 0x3f << 0, - VGT_STRMOUT_BASE_OFFSET_HI_3__BASE_OFFSET_shift = 0, - PA_SC_LINE_CNTL = 0x00028c00, - BRES_CNTL_mask = 0xff << 0, - BRES_CNTL_shift = 0, - USE_BRES_CNTL_bit = 1 << 8, - EXPAND_LINE_WIDTH_bit = 1 << 9, - LAST_PIXEL_bit = 1 << 10, - PA_SC_AA_CONFIG = 0x00028c04, - MSAA_NUM_SAMPLES_mask = 0x03 << 0, - MSAA_NUM_SAMPLES_shift = 0, - AA_MASK_CENTROID_DTMN_bit = 1 << 4, - MAX_SAMPLE_DIST_mask = 0x0f << 13, - MAX_SAMPLE_DIST_shift = 13, - PA_SU_VTX_CNTL = 0x00028c08, - PIX_CENTER_bit = 1 << 0, - PA_SU_VTX_CNTL__ROUND_MODE_mask = 0x03 << 1, - PA_SU_VTX_CNTL__ROUND_MODE_shift = 1, - X_TRUNCATE = 0x00, - X_ROUND = 0x01, - X_ROUND_TO_EVEN = 0x02, - X_ROUND_TO_ODD = 0x03, - QUANT_MODE_mask = 0x07 << 3, - QUANT_MODE_shift = 3, - X_1_16TH = 0x00, - X_1_8TH = 0x01, - X_1_4TH = 0x02, - X_1_2 = 0x03, - X_1 = 0x04, - X_1_256TH = 0x05, - PA_CL_GB_VERT_CLIP_ADJ = 0x00028c0c, - PA_CL_GB_VERT_DISC_ADJ = 0x00028c10, - PA_CL_GB_HORZ_CLIP_ADJ = 0x00028c14, - PA_CL_GB_HORZ_DISC_ADJ = 0x00028c18, - PA_SC_AA_SAMPLE_LOCS_MCTX = 0x00028c1c, -/* S0_X_mask = 0x0f << 0, */ -/* S0_X_shift = 0, */ -/* S0_Y_mask = 0x0f << 4, */ -/* S0_Y_shift = 4, */ -/* S1_X_mask = 0x0f << 8, */ -/* S1_X_shift = 8, */ -/* S1_Y_mask = 0x0f << 12, */ -/* S1_Y_shift = 12, */ -/* S2_X_mask = 0x0f << 16, */ -/* S2_X_shift = 16, */ -/* S2_Y_mask = 0x0f << 20, */ -/* S2_Y_shift = 20, */ -/* S3_X_mask = 0x0f << 24, */ -/* S3_X_shift = 24, */ -/* S3_Y_mask = 0x0f << 28, */ -/* S3_Y_shift = 28, */ - PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX = 0x00028c20, -/* S4_X_mask = 0x0f << 0, */ -/* S4_X_shift = 0, */ -/* S4_Y_mask = 0x0f << 4, */ -/* S4_Y_shift = 4, */ -/* S5_X_mask = 0x0f << 8, */ -/* S5_X_shift = 8, */ -/* S5_Y_mask = 0x0f << 12, */ -/* S5_Y_shift = 12, */ -/* S6_X_mask = 0x0f << 16, */ -/* S6_X_shift = 16, */ -/* S6_Y_mask = 0x0f << 20, */ -/* S6_Y_shift = 20, */ -/* S7_X_mask = 0x0f << 24, */ -/* S7_X_shift = 24, */ -/* S7_Y_mask = 0x0f << 28, */ -/* S7_Y_shift = 28, */ - CB_CLRCMP_CONTROL = 0x00028c30, - CLRCMP_FCN_SRC_mask = 0x07 << 0, - CLRCMP_FCN_SRC_shift = 0, - CLRCMP_DRAW_ALWAYS = 0x00, - CLRCMP_DRAW_NEVER = 0x01, - CLRCMP_DRAW_ON_NEQ = 0x04, - CLRCMP_DRAW_ON_EQ = 0x05, - CLRCMP_FCN_DST_mask = 0x07 << 8, - CLRCMP_FCN_DST_shift = 8, -/* CLRCMP_DRAW_ALWAYS = 0x00, */ -/* CLRCMP_DRAW_NEVER = 0x01, */ -/* CLRCMP_DRAW_ON_NEQ = 0x04, */ -/* CLRCMP_DRAW_ON_EQ = 0x05, */ - CLRCMP_FCN_SEL_mask = 0x03 << 24, - CLRCMP_FCN_SEL_shift = 24, - CLRCMP_SEL_DST = 0x00, - CLRCMP_SEL_SRC = 0x01, - CLRCMP_SEL_AND = 0x02, - CB_CLRCMP_SRC = 0x00028c34, - CB_CLRCMP_DST = 0x00028c38, - CB_CLRCMP_MSK = 0x00028c3c, - PA_SC_AA_MASK = 0x00028c48, - VGT_VERTEX_REUSE_BLOCK_CNTL = 0x00028c58, - VTX_REUSE_DEPTH_mask = 0xff << 0, - VTX_REUSE_DEPTH_shift = 0, - VGT_OUT_DEALLOC_CNTL = 0x00028c5c, - DEALLOC_DIST_mask = 0x7f << 0, - DEALLOC_DIST_shift = 0, - DB_RENDER_CONTROL = 0x00028d0c, - DEPTH_CLEAR_ENABLE_bit = 1 << 0, - STENCIL_CLEAR_ENABLE_bit = 1 << 1, - DEPTH_COPY_bit = 1 << 2, - STENCIL_COPY_bit = 1 << 3, - RESUMMARIZE_ENABLE_bit = 1 << 4, - STENCIL_COMPRESS_DISABLE_bit = 1 << 5, - DEPTH_COMPRESS_DISABLE_bit = 1 << 6, - COPY_CENTROID_bit = 1 << 7, - COPY_SAMPLE_mask = 0x07 << 8, - COPY_SAMPLE_shift = 8, - ZPASS_INCREMENT_DISABLE_bit = 1 << 11, - DB_RENDER_OVERRIDE = 0x00028d10, - FORCE_HIZ_ENABLE_mask = 0x03 << 0, - FORCE_HIZ_ENABLE_shift = 0, - FORCE_OFF = 0x00, - FORCE_ENABLE = 0x01, - FORCE_DISABLE = 0x02, - FORCE_RESERVED = 0x03, - FORCE_HIS_ENABLE0_mask = 0x03 << 2, - FORCE_HIS_ENABLE0_shift = 2, -/* FORCE_OFF = 0x00, */ -/* FORCE_ENABLE = 0x01, */ -/* FORCE_DISABLE = 0x02, */ -/* FORCE_RESERVED = 0x03, */ - FORCE_HIS_ENABLE1_mask = 0x03 << 4, - FORCE_HIS_ENABLE1_shift = 4, -/* FORCE_OFF = 0x00, */ -/* FORCE_ENABLE = 0x01, */ -/* FORCE_DISABLE = 0x02, */ -/* FORCE_RESERVED = 0x03, */ - FORCE_SHADER_Z_ORDER_bit = 1 << 6, - FAST_Z_DISABLE_bit = 1 << 7, - FAST_STENCIL_DISABLE_bit = 1 << 8, - NOOP_CULL_DISABLE_bit = 1 << 9, - FORCE_COLOR_KILL_bit = 1 << 10, - FORCE_Z_READ_bit = 1 << 11, - FORCE_STENCIL_READ_bit = 1 << 12, - FORCE_FULL_Z_RANGE_mask = 0x03 << 13, - FORCE_FULL_Z_RANGE_shift = 13, -/* FORCE_OFF = 0x00, */ -/* FORCE_ENABLE = 0x01, */ -/* FORCE_DISABLE = 0x02, */ -/* FORCE_RESERVED = 0x03, */ - FORCE_QC_SMASK_CONFLICT_bit = 1 << 15, - DISABLE_VIEWPORT_CLAMP_bit = 1 << 16, - IGNORE_SC_ZRANGE_bit = 1 << 17, - DB_HTILE_SURFACE = 0x00028d24, - HTILE_WIDTH_bit = 1 << 0, - HTILE_HEIGHT_bit = 1 << 1, - LINEAR_bit = 1 << 2, - FULL_CACHE_bit = 1 << 3, - HTILE_USES_PRELOAD_WIN_bit = 1 << 4, - PRELOAD_bit = 1 << 5, - PREFETCH_WIDTH_mask = 0x3f << 6, - PREFETCH_WIDTH_shift = 6, - PREFETCH_HEIGHT_mask = 0x3f << 12, - PREFETCH_HEIGHT_shift = 12, - DB_SRESULTS_COMPARE_STATE1 = 0x00028d2c, - COMPAREFUNC1_mask = 0x07 << 0, - COMPAREFUNC1_shift = 0, -/* REF_NEVER = 0x00, */ -/* REF_LESS = 0x01, */ -/* REF_EQUAL = 0x02, */ -/* REF_LEQUAL = 0x03, */ -/* REF_GREATER = 0x04, */ -/* REF_NOTEQUAL = 0x05, */ -/* REF_GEQUAL = 0x06, */ -/* REF_ALWAYS = 0x07, */ - COMPAREVALUE1_mask = 0xff << 4, - COMPAREVALUE1_shift = 4, - COMPAREMASK1_mask = 0xff << 12, - COMPAREMASK1_shift = 12, - ENABLE1_bit = 1 << 24, - DB_PRELOAD_CONTROL = 0x00028d30, - START_X_mask = 0xff << 0, - START_X_shift = 0, - START_Y_mask = 0xff << 8, - START_Y_shift = 8, - MAX_X_mask = 0xff << 16, - MAX_X_shift = 16, - MAX_Y_mask = 0xff << 24, - MAX_Y_shift = 24, - DB_PREFETCH_LIMIT = 0x00028d34, - DEPTH_HEIGHT_TILE_MAX_mask = 0x3ff << 0, - DEPTH_HEIGHT_TILE_MAX_shift = 0, - PA_SU_POLY_OFFSET_DB_FMT_CNTL = 0x00028df8, - POLY_OFFSET_NEG_NUM_DB_BITS_mask = 0xff << 0, - POLY_OFFSET_NEG_NUM_DB_BITS_shift = 0, - POLY_OFFSET_DB_IS_FLOAT_FMT_bit = 1 << 8, - PA_SU_POLY_OFFSET_CLAMP = 0x00028dfc, - PA_SU_POLY_OFFSET_FRONT_SCALE = 0x00028e00, - PA_SU_POLY_OFFSET_FRONT_OFFSET = 0x00028e04, - PA_SU_POLY_OFFSET_BACK_SCALE = 0x00028e08, - PA_SU_POLY_OFFSET_BACK_OFFSET = 0x00028e0c, - PA_CL_POINT_X_RAD = 0x00028e10, - PA_CL_POINT_Y_RAD = 0x00028e14, - PA_CL_POINT_SIZE = 0x00028e18, - PA_CL_POINT_CULL_RAD = 0x00028e1c, - PA_CL_UCP_0_X = 0x00028e20, - PA_CL_UCP_0_X_num = 6, - PA_CL_UCP_0_X_offset = 16, - PA_CL_UCP_0_Y = 0x00028e24, - PA_CL_UCP_0_Y_num = 6, - PA_CL_UCP_0_Y_offset = 16, - PA_CL_UCP_0_Z = 0x00028e28, - PA_CL_UCP_0_Z_num = 6, - PA_CL_UCP_0_Z_offset = 16, - SQ_ALU_CONSTANT0_0 = 0x00030000, - SQ_ALU_CONSTANT1_0 = 0x00030004, - SQ_ALU_CONSTANT2_0 = 0x00030008, - SQ_ALU_CONSTANT3_0 = 0x0003000c, - SQ_VTX_CONSTANT_WORD0_0 = 0x00038000, - SQ_TEX_RESOURCE_WORD0_0 = 0x00038000, - DIM_mask = 0x07 << 0, - DIM_shift = 0, - SQ_TEX_DIM_1D = 0x00, - SQ_TEX_DIM_2D = 0x01, - SQ_TEX_DIM_3D = 0x02, - SQ_TEX_DIM_CUBEMAP = 0x03, - SQ_TEX_DIM_1D_ARRAY = 0x04, - SQ_TEX_DIM_2D_ARRAY = 0x05, - SQ_TEX_DIM_2D_MSAA = 0x06, - SQ_TEX_DIM_2D_ARRAY_MSAA = 0x07, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask = 0x0f << 3, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift = 3, - TILE_TYPE_bit = 1 << 7, - PITCH_mask = 0x7ff << 8, - PITCH_shift = 8, - TEX_WIDTH_mask = 0x1fff << 19, - TEX_WIDTH_shift = 19, - SQ_VTX_CONSTANT_WORD1_0 = 0x00038004, - SQ_TEX_RESOURCE_WORD1_0 = 0x00038004, - TEX_HEIGHT_mask = 0x1fff << 0, - TEX_HEIGHT_shift = 0, - TEX_DEPTH_mask = 0x1fff << 13, - TEX_DEPTH_shift = 13, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask = 0x3f << 26, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift = 26, - SQ_VTX_CONSTANT_WORD2_0 = 0x00038008, - BASE_ADDRESS_HI_mask = 0xff << 0, - BASE_ADDRESS_HI_shift = 0, - SQ_VTX_CONSTANT_WORD2_0__STRIDE_mask = 0x7ff << 8, - SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift = 8, - SQ_VTX_CONSTANT_WORD2_0__CLAMP_X_bit = 1 << 19, - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask = 0x3f << 20, - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift = 20, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask = 0x03 << 26, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift = 26, -/* SQ_NUM_FORMAT_NORM = 0x00, */ -/* SQ_NUM_FORMAT_INT = 0x01, */ -/* SQ_NUM_FORMAT_SCALED = 0x02, */ - SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit = 1 << 28, - SQ_VTX_CONSTANT_WORD2_0__SRF_MODE_ALL_bit = 1 << 29, - SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_mask = 0x03 << 30, - SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_shift = 30, -/* SQ_ENDIAN_NONE = 0x00, */ -/* SQ_ENDIAN_8IN16 = 0x01, */ -/* SQ_ENDIAN_8IN32 = 0x02, */ - SQ_TEX_RESOURCE_WORD2_0 = 0x00038008, - SQ_VTX_CONSTANT_WORD3_0 = 0x0003800c, - MEM_REQUEST_SIZE_mask = 0x03 << 0, - MEM_REQUEST_SIZE_shift = 0, - SQ_TEX_RESOURCE_WORD3_0 = 0x0003800c, - SQ_TEX_RESOURCE_WORD4_0 = 0x00038010, - FORMAT_COMP_X_mask = 0x03 << 0, - FORMAT_COMP_X_shift = 0, - SQ_FORMAT_COMP_UNSIGNED = 0x00, - SQ_FORMAT_COMP_SIGNED = 0x01, - SQ_FORMAT_COMP_UNSIGNED_BIASED = 0x02, - FORMAT_COMP_Y_mask = 0x03 << 2, - FORMAT_COMP_Y_shift = 2, -/* SQ_FORMAT_COMP_UNSIGNED = 0x00, */ -/* SQ_FORMAT_COMP_SIGNED = 0x01, */ -/* SQ_FORMAT_COMP_UNSIGNED_BIASED = 0x02, */ - FORMAT_COMP_Z_mask = 0x03 << 4, - FORMAT_COMP_Z_shift = 4, -/* SQ_FORMAT_COMP_UNSIGNED = 0x00, */ -/* SQ_FORMAT_COMP_SIGNED = 0x01, */ -/* SQ_FORMAT_COMP_UNSIGNED_BIASED = 0x02, */ - FORMAT_COMP_W_mask = 0x03 << 6, - FORMAT_COMP_W_shift = 6, -/* SQ_FORMAT_COMP_UNSIGNED = 0x00, */ -/* SQ_FORMAT_COMP_SIGNED = 0x01, */ -/* SQ_FORMAT_COMP_UNSIGNED_BIASED = 0x02, */ - SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_mask = 0x03 << 8, - SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_shift = 8, -/* SQ_NUM_FORMAT_NORM = 0x00, */ -/* SQ_NUM_FORMAT_INT = 0x01, */ -/* SQ_NUM_FORMAT_SCALED = 0x02, */ - SQ_TEX_RESOURCE_WORD4_0__SRF_MODE_ALL_bit = 1 << 10, - SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit = 1 << 11, - SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_mask = 0x03 << 12, - SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_shift = 12, -/* SQ_ENDIAN_NONE = 0x00, */ -/* SQ_ENDIAN_8IN16 = 0x01, */ -/* SQ_ENDIAN_8IN32 = 0x02, */ - REQUEST_SIZE_mask = 0x03 << 14, - REQUEST_SIZE_shift = 14, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask = 0x07 << 16, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift = 16, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask = 0x07 << 19, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift = 19, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask = 0x07 << 22, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift = 22, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask = 0x07 << 25, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift = 25, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - BASE_LEVEL_mask = 0x0f << 28, - BASE_LEVEL_shift = 28, - SQ_TEX_RESOURCE_WORD5_0 = 0x00038014, - LAST_LEVEL_mask = 0x0f << 0, - LAST_LEVEL_shift = 0, - BASE_ARRAY_mask = 0x1fff << 4, - BASE_ARRAY_shift = 4, - LAST_ARRAY_mask = 0x1fff << 17, - LAST_ARRAY_shift = 17, - SQ_TEX_RESOURCE_WORD6_0 = 0x00038018, - MPEG_CLAMP_mask = 0x03 << 0, - MPEG_CLAMP_shift = 0, - SQ_TEX_MPEG_CLAMP_OFF = 0x00, - SQ_TEX_MPEG_9 = 0x01, - SQ_TEX_MPEG_10 = 0x02, - PERF_MODULATION_mask = 0x07 << 5, - PERF_MODULATION_shift = 5, - INTERLACED_bit = 1 << 8, - SQ_TEX_RESOURCE_WORD6_0__TYPE_mask = 0x03 << 30, - SQ_TEX_RESOURCE_WORD6_0__TYPE_shift = 30, - SQ_TEX_VTX_INVALID_TEXTURE = 0x00, - SQ_TEX_VTX_INVALID_BUFFER = 0x01, - SQ_TEX_VTX_VALID_TEXTURE = 0x02, - SQ_TEX_VTX_VALID_BUFFER = 0x03, - SQ_VTX_CONSTANT_WORD6_0 = 0x00038018, - SQ_VTX_CONSTANT_WORD6_0__TYPE_mask = 0x03 << 30, - SQ_VTX_CONSTANT_WORD6_0__TYPE_shift = 30, -/* SQ_TEX_VTX_INVALID_TEXTURE = 0x00, */ -/* SQ_TEX_VTX_INVALID_BUFFER = 0x01, */ -/* SQ_TEX_VTX_VALID_TEXTURE = 0x02, */ -/* SQ_TEX_VTX_VALID_BUFFER = 0x03, */ - SQ_TEX_SAMPLER_WORD0_0 = 0x0003c000, - SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask = 0x07 << 0, - SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift = 0, - SQ_TEX_WRAP = 0x00, - SQ_TEX_MIRROR = 0x01, - SQ_TEX_CLAMP_LAST_TEXEL = 0x02, - SQ_TEX_MIRROR_ONCE_LAST_TEXEL = 0x03, - SQ_TEX_CLAMP_HALF_BORDER = 0x04, - SQ_TEX_MIRROR_ONCE_HALF_BORDER = 0x05, - SQ_TEX_CLAMP_BORDER = 0x06, - SQ_TEX_MIRROR_ONCE_BORDER = 0x07, - CLAMP_Y_mask = 0x07 << 3, - CLAMP_Y_shift = 3, -/* SQ_TEX_WRAP = 0x00, */ -/* SQ_TEX_MIRROR = 0x01, */ -/* SQ_TEX_CLAMP_LAST_TEXEL = 0x02, */ -/* SQ_TEX_MIRROR_ONCE_LAST_TEXEL = 0x03, */ -/* SQ_TEX_CLAMP_HALF_BORDER = 0x04, */ -/* SQ_TEX_MIRROR_ONCE_HALF_BORDER = 0x05, */ -/* SQ_TEX_CLAMP_BORDER = 0x06, */ -/* SQ_TEX_MIRROR_ONCE_BORDER = 0x07, */ - CLAMP_Z_mask = 0x07 << 6, - CLAMP_Z_shift = 6, -/* SQ_TEX_WRAP = 0x00, */ -/* SQ_TEX_MIRROR = 0x01, */ -/* SQ_TEX_CLAMP_LAST_TEXEL = 0x02, */ -/* SQ_TEX_MIRROR_ONCE_LAST_TEXEL = 0x03, */ -/* SQ_TEX_CLAMP_HALF_BORDER = 0x04, */ -/* SQ_TEX_MIRROR_ONCE_HALF_BORDER = 0x05, */ -/* SQ_TEX_CLAMP_BORDER = 0x06, */ -/* SQ_TEX_MIRROR_ONCE_BORDER = 0x07, */ - XY_MAG_FILTER_mask = 0x07 << 9, - XY_MAG_FILTER_shift = 9, - SQ_TEX_XY_FILTER_POINT = 0x00, - SQ_TEX_XY_FILTER_BILINEAR = 0x01, - SQ_TEX_XY_FILTER_BICUBIC = 0x02, - XY_MIN_FILTER_mask = 0x07 << 12, - XY_MIN_FILTER_shift = 12, -/* SQ_TEX_XY_FILTER_POINT = 0x00, */ -/* SQ_TEX_XY_FILTER_BILINEAR = 0x01, */ -/* SQ_TEX_XY_FILTER_BICUBIC = 0x02, */ - Z_FILTER_mask = 0x03 << 15, - Z_FILTER_shift = 15, - SQ_TEX_Z_FILTER_NONE = 0x00, - SQ_TEX_Z_FILTER_POINT = 0x01, - SQ_TEX_Z_FILTER_LINEAR = 0x02, - MIP_FILTER_mask = 0x03 << 17, - MIP_FILTER_shift = 17, -/* SQ_TEX_Z_FILTER_NONE = 0x00, */ -/* SQ_TEX_Z_FILTER_POINT = 0x01, */ -/* SQ_TEX_Z_FILTER_LINEAR = 0x02, */ - BORDER_COLOR_TYPE_mask = 0x03 << 22, - BORDER_COLOR_TYPE_shift = 22, - SQ_TEX_BORDER_COLOR_TRANS_BLACK = 0x00, - SQ_TEX_BORDER_COLOR_OPAQUE_BLACK = 0x01, - SQ_TEX_BORDER_COLOR_OPAQUE_WHITE = 0x02, - SQ_TEX_BORDER_COLOR_REGISTER = 0x03, - POINT_SAMPLING_CLAMP_bit = 1 << 24, - TEX_ARRAY_OVERRIDE_bit = 1 << 25, - DEPTH_COMPARE_FUNCTION_mask = 0x07 << 26, - DEPTH_COMPARE_FUNCTION_shift = 26, - SQ_TEX_DEPTH_COMPARE_NEVER = 0x00, - SQ_TEX_DEPTH_COMPARE_LESS = 0x01, - SQ_TEX_DEPTH_COMPARE_EQUAL = 0x02, - SQ_TEX_DEPTH_COMPARE_LESSEQUAL = 0x03, - SQ_TEX_DEPTH_COMPARE_GREATER = 0x04, - SQ_TEX_DEPTH_COMPARE_NOTEQUAL = 0x05, - SQ_TEX_DEPTH_COMPARE_GREATEREQUAL = 0x06, - SQ_TEX_DEPTH_COMPARE_ALWAYS = 0x07, - CHROMA_KEY_mask = 0x03 << 29, - CHROMA_KEY_shift = 29, - SQ_TEX_CHROMA_KEY_DISABLED = 0x00, - SQ_TEX_CHROMA_KEY_KILL = 0x01, - SQ_TEX_CHROMA_KEY_BLEND = 0x02, - LOD_USES_MINOR_AXIS_bit = 1 << 31, - SQ_TEX_SAMPLER_WORD1_0 = 0x0003c004, - MIN_LOD_mask = 0x3ff << 0, - MIN_LOD_shift = 0, - MAX_LOD_mask = 0x3ff << 10, - MAX_LOD_shift = 10, - SQ_TEX_SAMPLER_WORD1_0__LOD_BIAS_mask = 0xfff << 20, - SQ_TEX_SAMPLER_WORD1_0__LOD_BIAS_shift = 20, - SQ_TEX_SAMPLER_WORD2_0 = 0x0003c008, - LOD_BIAS_SEC_mask = 0xfff << 0, - LOD_BIAS_SEC_shift = 0, - MC_COORD_TRUNCATE_bit = 1 << 12, - SQ_TEX_SAMPLER_WORD2_0__FORCE_DEGAMMA_bit = 1 << 13, - HIGH_PRECISION_FILTER_bit = 1 << 14, - PERF_MIP_mask = 0x07 << 15, - PERF_MIP_shift = 15, - PERF_Z_mask = 0x03 << 18, - PERF_Z_shift = 18, - FETCH_4_bit = 1 << 26, - SAMPLE_IS_PCF_bit = 1 << 27, - SQ_TEX_SAMPLER_WORD2_0__TYPE_bit = 1 << 31, - SQ_VTX_BASE_VTX_LOC = 0x0003cff0, - SQ_VTX_START_INST_LOC = 0x0003cff4, - SQ_LOOP_CONST_DX10_0 = 0x0003e200, - SQ_LOOP_CONST_0 = 0x0003e200, - SQ_LOOP_CONST_0__COUNT_mask = 0xfff << 0, - SQ_LOOP_CONST_0__COUNT_shift = 0, - INIT_mask = 0xfff << 12, - INIT_shift = 12, - INC_mask = 0xff << 24, - INC_shift = 24, - SQ_BOOL_CONST_0 = 0x0003e380, - SQ_BOOL_CONST_0_num = 3 - -} ; - -#endif /* _AUTOREGS */ - diff --git a/headers/private/graphics/radeon_hd/r600_reg_r6xx.h b/headers/private/graphics/radeon_hd/r600_reg_r6xx.h deleted file mode 100644 index 0a09074e81..0000000000 --- a/headers/private/graphics/radeon_hd/r600_reg_r6xx.h +++ /dev/null @@ -1,504 +0,0 @@ -/* - * RadeonHD R6xx, R7xx Register documentation - * - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * Copyright (C) 2008-2009 Matthias Hopf - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef _R600_REG_R6xx_H_ -#define _R600_REG_R6xx_H_ - -/* - * Registers for R6xx chips that are not documented yet - */ - -enum { - - MM_INDEX = 0x0000, - MM_DATA = 0x0004, - - SRBM_STATUS = 0x0e50, - RLC_RQ_PENDING_bit = 1 << 3, - RCU_RQ_PENDING_bit = 1 << 4, - GRBM_RQ_PENDING_bit = 1 << 5, - HI_RQ_PENDING_bit = 1 << 6, - IO_EXTERN_SIGNAL_bit = 1 << 7, - VMC_BUSY_bit = 1 << 8, - MCB_BUSY_bit = 1 << 9, - MCDZ_BUSY_bit = 1 << 10, - MCDY_BUSY_bit = 1 << 11, - MCDX_BUSY_bit = 1 << 12, - MCDW_BUSY_bit = 1 << 13, - SEM_BUSY_bit = 1 << 14, - SRBM_STATUS__RLC_BUSY_bit = 1 << 15, - PDMA_BUSY_bit = 1 << 16, - IH_BUSY_bit = 1 << 17, - CSC_BUSY_bit = 1 << 20, - CMC7_BUSY_bit = 1 << 21, - CMC6_BUSY_bit = 1 << 22, - CMC5_BUSY_bit = 1 << 23, - CMC4_BUSY_bit = 1 << 24, - CMC3_BUSY_bit = 1 << 25, - CMC2_BUSY_bit = 1 << 26, - CMC1_BUSY_bit = 1 << 27, - CMC0_BUSY_bit = 1 << 28, - BIF_BUSY_bit = 1 << 29, - IDCT_BUSY_bit = 1 << 30, - - SRBM_READ_ERROR = 0x0e98, - READ_ADDRESS_mask = 0xffff << 2, - READ_ADDRESS_shift = 2, - READ_REQUESTER_HI_bit = 1 << 24, - READ_REQUESTER_GRBM_bit = 1 << 25, - READ_REQUESTER_RCU_bit = 1 << 26, - READ_REQUESTER_RLC_bit = 1 << 27, - READ_ERROR_bit = 1 << 31, - - SRBM_INT_STATUS = 0x0ea4, - RDERR_INT_STAT_bit = 1 << 0, - GFX_CNTX_SWITCH_INT_STAT_bit = 1 << 1, - SRBM_INT_ACK = 0x0ea8, - RDERR_INT_ACK_bit = 1 << 0, - GFX_CNTX_SWITCH_INT_ACK_bit = 1 << 1, - - /* R6XX_MC_VM_FB_LOCATION = 0x2180, */ - - VENDOR_DEVICE_ID = 0x4000, - - HDP_MEM_COHERENCY_FLUSH_CNTL = 0x5480, - - /* D1GRPH_PRIMARY_SURFACE_ADDRESS = 0x6110, */ - /* D1GRPH_PITCH = 0x6120, */ - /* D1GRPH_Y_END = 0x6138, */ - - GRBM_STATUS = 0x8010, - R600_CMDFIFO_AVAIL_mask = 0x1f << 0, - R700_CMDFIFO_AVAIL_mask = 0xf << 0, - CMDFIFO_AVAIL_shift = 0, - SRBM_RQ_PENDING_bit = 1 << 5, - CP_RQ_PENDING_bit = 1 << 6, - CF_RQ_PENDING_bit = 1 << 7, - PF_RQ_PENDING_bit = 1 << 8, - GRBM_EE_BUSY_bit = 1 << 10, - GRBM_STATUS__VC_BUSY_bit = 1 << 11, - DB03_CLEAN_bit = 1 << 12, - CB03_CLEAN_bit = 1 << 13, - VGT_BUSY_NO_DMA_bit = 1 << 16, - GRBM_STATUS__VGT_BUSY_bit = 1 << 17, - TA03_BUSY_bit = 1 << 18, - GRBM_STATUS__TC_BUSY_bit = 1 << 19, - SX_BUSY_bit = 1 << 20, - SH_BUSY_bit = 1 << 21, - SPI03_BUSY_bit = 1 << 22, - SMX_BUSY_bit = 1 << 23, - SC_BUSY_bit = 1 << 24, - PA_BUSY_bit = 1 << 25, - DB03_BUSY_bit = 1 << 26, - CR_BUSY_bit = 1 << 27, - CP_COHERENCY_BUSY_bit = 1 << 28, - GRBM_STATUS__CP_BUSY_bit = 1 << 29, - CB03_BUSY_bit = 1 << 30, - GUI_ACTIVE_bit = 1 << 31, - GRBM_STATUS2 = 0x8014, - CR_CLEAN_bit = 1 << 0, - SMX_CLEAN_bit = 1 << 1, - SPI0_BUSY_bit = 1 << 8, - SPI1_BUSY_bit = 1 << 9, - SPI2_BUSY_bit = 1 << 10, - SPI3_BUSY_bit = 1 << 11, - TA0_BUSY_bit = 1 << 12, - TA1_BUSY_bit = 1 << 13, - TA2_BUSY_bit = 1 << 14, - TA3_BUSY_bit = 1 << 15, - DB0_BUSY_bit = 1 << 16, - DB1_BUSY_bit = 1 << 17, - DB2_BUSY_bit = 1 << 18, - DB3_BUSY_bit = 1 << 19, - CB0_BUSY_bit = 1 << 20, - CB1_BUSY_bit = 1 << 21, - CB2_BUSY_bit = 1 << 22, - CB3_BUSY_bit = 1 << 23, - GRBM_SOFT_RESET = 0x8020, - SOFT_RESET_CP_bit = 1 << 0, - SOFT_RESET_CB_bit = 1 << 1, - SOFT_RESET_CR_bit = 1 << 2, - SOFT_RESET_DB_bit = 1 << 3, - SOFT_RESET_PA_bit = 1 << 5, - SOFT_RESET_SC_bit = 1 << 6, - SOFT_RESET_SMX_bit = 1 << 7, - SOFT_RESET_SPI_bit = 1 << 8, - SOFT_RESET_SH_bit = 1 << 9, - SOFT_RESET_SX_bit = 1 << 10, - SOFT_RESET_TC_bit = 1 << 11, - SOFT_RESET_TA_bit = 1 << 12, - SOFT_RESET_VC_bit = 1 << 13, - SOFT_RESET_VGT_bit = 1 << 14, - SOFT_RESET_GRBM_GCA_bit = 1 << 15, - - WAIT_UNTIL = 0x8040, - WAIT_CP_DMA_IDLE_bit = 1 << 8, - WAIT_CMDFIFO_bit = 1 << 10, - WAIT_2D_IDLE_bit = 1 << 14, - WAIT_3D_IDLE_bit = 1 << 15, - WAIT_2D_IDLECLEAN_bit = 1 << 16, - WAIT_3D_IDLECLEAN_bit = 1 << 17, - WAIT_EXTERN_SIG_bit = 1 << 19, - CMDFIFO_ENTRIES_mask = 0x1f << 20, - CMDFIFO_ENTRIES_shift = 20, - - GRBM_READ_ERROR = 0x8058, -/* READ_ADDRESS_mask = 0xffff << 2, */ -/* READ_ADDRESS_shift = 2, */ - READ_REQUESTER_SRBM_bit = 1 << 28, - READ_REQUESTER_CP_bit = 1 << 29, - READ_REQUESTER_WU_POLL_bit = 1 << 30, -/* READ_ERROR_bit = 1 << 31, */ - - SCRATCH_REG0 = 0x8500, - SCRATCH_REG1 = 0x8504, - SCRATCH_REG2 = 0x8508, - SCRATCH_REG3 = 0x850c, - SCRATCH_REG4 = 0x8510, - SCRATCH_REG5 = 0x8514, - SCRATCH_REG6 = 0x8518, - SCRATCH_REG7 = 0x851c, - SCRATCH_UMSK = 0x8540, - SCRATCH_ADDR = 0x8544, - - CP_COHER_CNTL = 0x85f0, - DEST_BASE_0_ENA_bit = 1 << 0, - DEST_BASE_1_ENA_bit = 1 << 1, - SO0_DEST_BASE_ENA_bit = 1 << 2, - SO1_DEST_BASE_ENA_bit = 1 << 3, - SO2_DEST_BASE_ENA_bit = 1 << 4, - SO3_DEST_BASE_ENA_bit = 1 << 5, - CB0_DEST_BASE_ENA_bit = 1 << 6, - CB1_DEST_BASE_ENA_bit = 1 << 7, - CB2_DEST_BASE_ENA_bit = 1 << 8, - CB3_DEST_BASE_ENA_bit = 1 << 9, - CB4_DEST_BASE_ENA_bit = 1 << 10, - CB5_DEST_BASE_ENA_bit = 1 << 11, - CB6_DEST_BASE_ENA_bit = 1 << 12, - CB7_DEST_BASE_ENA_bit = 1 << 13, - DB_DEST_BASE_ENA_bit = 1 << 14, - CR_DEST_BASE_ENA_bit = 1 << 15, - TC_ACTION_ENA_bit = 1 << 23, - VC_ACTION_ENA_bit = 1 << 24, - CB_ACTION_ENA_bit = 1 << 25, - DB_ACTION_ENA_bit = 1 << 26, - SH_ACTION_ENA_bit = 1 << 27, - SMX_ACTION_ENA_bit = 1 << 28, - CR0_ACTION_ENA_bit = 1 << 29, - CR1_ACTION_ENA_bit = 1 << 30, - CR2_ACTION_ENA_bit = 1 << 31, - CP_COHER_SIZE = 0x85f4, - CP_COHER_BASE = 0x85f8, - CP_COHER_STATUS = 0x85fc, - MATCHING_GFX_CNTX_mask = 0xff << 0, - MATCHING_GFX_CNTX_shift = 0, - MATCHING_CR_CNTX_mask = 0xffff << 8, - MATCHING_CR_CNTX_shift = 8, - STATUS_bit = 1 << 31, - - CP_STALLED_STAT1 = 0x8674, - RBIU_TO_DMA_NOT_RDY_TO_RCV_bit = 1 << 0, - RBIU_TO_IBS_NOT_RDY_TO_RCV_bit = 1 << 1, - RBIU_TO_SEM_NOT_RDY_TO_RCV_bit = 1 << 2, - RBIU_TO_2DREGS_NOT_RDY_TO_RCV_bit = 1 << 3, - RBIU_TO_MEMWR_NOT_RDY_TO_RCV_bit = 1 << 4, - RBIU_TO_MEMRD_NOT_RDY_TO_RCV_bit = 1 << 5, - RBIU_TO_EOPD_NOT_RDY_TO_RCV_bit = 1 << 6, - RBIU_TO_RECT_NOT_RDY_TO_RCV_bit = 1 << 7, - RBIU_TO_STRMO_NOT_RDY_TO_RCV_bit = 1 << 8, - RBIU_TO_PSTAT_NOT_RDY_TO_RCV_bit = 1 << 9, - MIU_WAITING_ON_RDREQ_FREE_bit = 1 << 16, - MIU_WAITING_ON_WRREQ_FREE_bit = 1 << 17, - MIU_NEEDS_AVAIL_WRREQ_PHASE_bit = 1 << 18, - RCIU_WAITING_ON_GRBM_FREE_bit = 1 << 24, - RCIU_WAITING_ON_VGT_FREE_bit = 1 << 25, - RCIU_STALLED_ON_ME_READ_bit = 1 << 26, - RCIU_STALLED_ON_DMA_READ_bit = 1 << 27, - RCIU_HALTED_BY_REG_VIOLATION_bit = 1 << 28, - CP_STALLED_STAT2 = 0x8678, - PFP_TO_CSF_NOT_RDY_TO_RCV_bit = 1 << 0, - PFP_TO_MEQ_NOT_RDY_TO_RCV_bit = 1 << 1, - PFP_TO_VGT_NOT_RDY_TO_RCV_bit = 1 << 2, - PFP_HALTED_BY_INSTR_VIOLATION_bit = 1 << 3, - MULTIPASS_IB_PENDING_IN_PFP_bit = 1 << 4, - ME_BRUSH_WC_NOT_RDY_TO_RCV_bit = 1 << 8, - ME_STALLED_ON_BRUSH_LOGIC_bit = 1 << 9, - CR_CNTX_NOT_AVAIL_TO_ME_bit = 1 << 10, - GFX_CNTX_NOT_AVAIL_TO_ME_bit = 1 << 11, - ME_RCIU_NOT_RDY_TO_RCV_bit = 1 << 12, - ME_TO_CONST_NOT_RDY_TO_RCV_bit = 1 << 13, - ME_WAITING_DATA_FROM_PFP_bit = 1 << 14, - ME_WAITING_ON_PARTIAL_FLUSH_bit = 1 << 15, - RECT_FIFO_NEEDS_CR_RECT_DONE_bit = 1 << 16, - RECT_FIFO_NEEDS_WR_CONFIRM_bit = 1 << 17, - EOPD_FIFO_NEEDS_SC_EOP_DONE_bit = 1 << 18, - EOPD_FIFO_NEEDS_SMX_EOP_DONE_bit = 1 << 19, - EOPD_FIFO_NEEDS_WR_CONFIRM_bit = 1 << 20, - EOPD_FIFO_NEEDS_SIGNAL_SEM_bit = 1 << 21, - SO_NUMPRIM_FIFO_NEEDS_SOADDR_bit = 1 << 22, - SO_NUMPRIM_FIFO_NEEDS_NUMPRIM_bit = 1 << 23, - PIPE_STATS_FIFO_NEEDS_SAMPLE_bit = 1 << 24, - SURF_SYNC_NEEDS_IDLE_CNTXS_bit = 1 << 30, - SURF_SYNC_NEEDS_ALL_CLEAN_bit = 1 << 31, - CP_BUSY_STAT = 0x867c, - REG_BUS_FIFO_BUSY_bit = 1 << 0, - RING_FETCHING_DATA_bit = 1 << 1, - INDR1_FETCHING_DATA_bit = 1 << 2, - INDR2_FETCHING_DATA_bit = 1 << 3, - STATE_FETCHING_DATA_bit = 1 << 4, - PRED_FETCHING_DATA_bit = 1 << 5, - COHER_CNTR_NEQ_ZERO_bit = 1 << 6, - PFP_PARSING_PACKETS_bit = 1 << 7, - ME_PARSING_PACKETS_bit = 1 << 8, - RCIU_PFP_BUSY_bit = 1 << 9, - RCIU_ME_BUSY_bit = 1 << 10, - OUTSTANDING_READ_TAGS_bit = 1 << 11, - SEM_CMDFIFO_NOT_EMPTY_bit = 1 << 12, - SEM_FAILED_AND_HOLDING_bit = 1 << 13, - SEM_POLLING_FOR_PASS_bit = 1 << 14, - _3D_BUSY_bit = 1 << 15, - _2D_BUSY_bit = 1 << 16, - CP_STAT = 0x8680, - CSF_RING_BUSY_bit = 1 << 0, - CSF_WPTR_POLL_BUSY_bit = 1 << 1, - CSF_INDIRECT1_BUSY_bit = 1 << 2, - CSF_INDIRECT2_BUSY_bit = 1 << 3, - CSF_STATE_BUSY_bit = 1 << 4, - CSF_PREDICATE_BUSY_bit = 1 << 5, - CSF_BUSY_bit = 1 << 6, - MIU_RDREQ_BUSY_bit = 1 << 7, - MIU_WRREQ_BUSY_bit = 1 << 8, - ROQ_RING_BUSY_bit = 1 << 9, - ROQ_INDIRECT1_BUSY_bit = 1 << 10, - ROQ_INDIRECT2_BUSY_bit = 1 << 11, - ROQ_STATE_BUSY_bit = 1 << 12, - ROQ_PREDICATE_BUSY_bit = 1 << 13, - ROQ_ALIGN_BUSY_bit = 1 << 14, - PFP_BUSY_bit = 1 << 15, - MEQ_BUSY_bit = 1 << 16, - ME_BUSY_bit = 1 << 17, - QUERY_BUSY_bit = 1 << 18, - SEMAPHORE_BUSY_bit = 1 << 19, - INTERRUPT_BUSY_bit = 1 << 20, - SURFACE_SYNC_BUSY_bit = 1 << 21, - DMA_BUSY_bit = 1 << 22, - RCIU_BUSY_bit = 1 << 23, - CP_STAT__CP_BUSY_bit = 1 << 31, - - CP_ME_CNTL = 0x86d8, - ME_STATMUX_mask = 0xff << 0, - ME_STATMUX_shift = 0, - ME_HALT_bit = 1 << 28, - CP_ME_STATUS = 0x86dc, - - CP_RB_RPTR = 0x8700, - RB_RPTR_mask = 0xfffff << 0, - RB_RPTR_shift = 0, - CP_RB_WPTR_DELAY = 0x8704, - PRE_WRITE_TIMER_mask = 0xfffffff << 0, - PRE_WRITE_TIMER_shift = 0, - PRE_WRITE_LIMIT_mask = 0x0f << 28, - PRE_WRITE_LIMIT_shift = 28, - - CP_ROQ_RB_STAT = 0x8780, - ROQ_RPTR_PRIMARY_mask = 0x3ff << 0, - ROQ_RPTR_PRIMARY_shift = 0, - ROQ_WPTR_PRIMARY_mask = 0x3ff << 16, - ROQ_WPTR_PRIMARY_shift = 16, - CP_ROQ_IB1_STAT = 0x8784, - ROQ_RPTR_INDIRECT1_mask = 0x3ff << 0, - ROQ_RPTR_INDIRECT1_shift = 0, - ROQ_WPTR_INDIRECT1_mask = 0x3ff << 16, - ROQ_WPTR_INDIRECT1_shift = 16, - CP_ROQ_IB2_STAT = 0x8788, - ROQ_RPTR_INDIRECT2_mask = 0x3ff << 0, - ROQ_RPTR_INDIRECT2_shift = 0, - ROQ_WPTR_INDIRECT2_mask = 0x3ff << 16, - ROQ_WPTR_INDIRECT2_shift = 16, - - CP_MEQ_STAT = 0x8794, - MEQ_RPTR_mask = 0x3ff << 0, - MEQ_RPTR_shift = 0, - MEQ_WPTR_mask = 0x3ff << 16, - MEQ_WPTR_shift = 16, - - CC_GC_SHADER_PIPE_CONFIG = 0x8950, - INACTIVE_QD_PIPES_mask = 0xff << 8, - INACTIVE_QD_PIPES_shift = 8, - R6XX_MAX_QD_PIPES = 8, - INACTIVE_SIMDS_mask = 0xff << 16, - INACTIVE_SIMDS_shift = 16, - R6XX_MAX_SIMDS = 8, - GC_USER_SHADER_PIPE_CONFIG = 0x8954, - - VC_ENHANCE = 0x9714, - DB_DEBUG = 0x9830, - PREZ_MUST_WAIT_FOR_POSTZ_DONE = 1 << 31, - - DB_WATERMARKS = 0x00009838, - DEPTH_FREE_mask = 0x1f << 0, - DEPTH_FREE_shift = 0, - DEPTH_FLUSH_mask = 0x3f << 5, - DEPTH_FLUSH_shift = 5, - FORCE_SUMMARIZE_mask = 0x0f << 11, - FORCE_SUMMARIZE_shift = 11, - DEPTH_PENDING_FREE_mask = 0x1f << 15, - DEPTH_PENDING_FREE_shift = 15, - DEPTH_CACHELINE_FREE_mask = 0x1f << 20, - DEPTH_CACHELINE_FREE_shift = 20, - EARLY_Z_PANIC_DISABLE_bit = 1 << 25, - LATE_Z_PANIC_DISABLE_bit = 1 << 26, - RE_Z_PANIC_DISABLE_bit = 1 << 27, - DB_EXTRA_DEBUG_mask = 0x0f << 28, - DB_EXTRA_DEBUG_shift = 28, - - CP_RB_BASE = 0xc100, - CP_RB_CNTL = 0xc104, - RB_BUFSZ_mask = 0x3f << 0, - CP_RB_WPTR = 0xc114, - RB_WPTR_mask = 0xfffff << 0, - RB_WPTR_shift = 0, - CP_RB_RPTR_WR = 0xc108, - RB_RPTR_WR_mask = 0xfffff << 0, - RB_RPTR_WR_shift = 0, - - CP_INT_STATUS = 0xc128, - DISABLE_CNTX_SWITCH_INT_STAT_bit = 1 << 0, - ENABLE_CNTX_SWITCH_INT_STAT_bit = 1 << 1, - SEM_SIGNAL_INT_STAT_bit = 1 << 18, - CNTX_BUSY_INT_STAT_bit = 1 << 19, - CNTX_EMPTY_INT_STAT_bit = 1 << 20, - WAITMEM_SEM_INT_STAT_bit = 1 << 21, - PRIV_INSTR_INT_STAT_bit = 1 << 22, - PRIV_REG_INT_STAT_bit = 1 << 23, - OPCODE_ERROR_INT_STAT_bit = 1 << 24, - SCRATCH_INT_STAT_bit = 1 << 25, - TIME_STAMP_INT_STAT_bit = 1 << 26, - RESERVED_BIT_ERROR_INT_STAT_bit = 1 << 27, - DMA_INT_STAT_bit = 1 << 28, - IB2_INT_STAT_bit = 1 << 29, - IB1_INT_STAT_bit = 1 << 30, - RB_INT_STAT_bit = 1 << 31, - -/* SX_ALPHA_TEST_CONTROL = 0x00028410, */ - ALPHA_FUNC__REF_NEVER = 0, - ALPHA_FUNC__REF_ALWAYS = 7, -/* DB_SHADER_CONTROL = 0x0002880c, */ - Z_ORDER__EARLY_Z_THEN_LATE_Z = 2, -/* PA_SU_SC_MODE_CNTL = 0x00028814, */ -/* POLY_MODE_mask = 0x03 << 3, */ - POLY_MODE__TRIANGLES = 0, POLY_MODE__DUAL_MODE, -/* POLYMODE_FRONT_PTYPE_mask = 0x07 << 5, */ - POLYMODE_PTYPE__POINTS = 0, POLYMODE_PTYPE__LINES, POLYMODE_PTYPE__TRIANGLES, - PA_SC_AA_SAMPLE_LOCS_8S_WD1_M = 0x00028c20, - DB_SRESULTS_COMPARE_STATE0 = 0x00028d28, /* See autoregs: DB_SRESULTS_COMPARE_STATE1 */ -/* DB_SRESULTS_COMPARE_STATE1 = 0x00028d2c, */ - DB_ALPHA_TO_MASK = 0x00028d44, - ALPHA_TO_MASK_ENABLE = 1 << 0, - ALPHA_TO_MASK_OFFSET0_mask = 0x03 << 8, - ALPHA_TO_MASK_OFFSET0_shift = 8, - ALPHA_TO_MASK_OFFSET1_mask = 0x03 << 8, - ALPHA_TO_MASK_OFFSET1_shift = 10, - ALPHA_TO_MASK_OFFSET2_mask = 0x03 << 8, - ALPHA_TO_MASK_OFFSET2_shift = 12, - ALPHA_TO_MASK_OFFSET3_mask = 0x03 << 8, - ALPHA_TO_MASK_OFFSET3_shift = 14, - -/* SQ_VTX_CONSTANT_WORD2_0 = 0x00038008, */ -/* SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask = 0x3f << 20, */ - FMT_INVALID=0, FMT_8, FMT_4_4, FMT_3_3_2, - FMT_16=5, FMT_16_FLOAT, FMT_8_8, - FMT_5_6_5, FMT_6_5_5, FMT_1_5_5_5, FMT_4_4_4_4, - FMT_5_5_5_1, FMT_32, FMT_32_FLOAT, FMT_16_16, - FMT_16_16_FLOAT=16, FMT_8_24, FMT_8_24_FLOAT, FMT_24_8, - FMT_24_8_FLOAT, FMT_10_11_11, FMT_10_11_11_FLOAT, FMT_11_11_10, - FMT_11_11_10_FLOAT, FMT_2_10_10_10, FMT_8_8_8_8, FMT_10_10_10_2, - FMT_X24_8_32_FLOAT, FMT_32_32, FMT_32_32_FLOAT, FMT_16_16_16_16, - FMT_16_16_16_16_FLOAT=32, FMT_32_32_32_32=34, FMT_32_32_32_32_FLOAT, - FMT_1 = 37, FMT_GB_GR=39, - FMT_BG_RG, FMT_32_AS_8, FMT_32_AS_8_8, FMT_5_9_9_9_SHAREDEXP, - FMT_8_8_8, FMT_16_16_16, FMT_16_16_16_FLOAT, FMT_32_32_32, - FMT_32_32_32_FLOAT=48, - -/* High level register file lengths */ - SQ_ALU_CONSTANT = SQ_ALU_CONSTANT0_0, /* 256 PS, 256 VS */ - SQ_ALU_CONSTANT_ps_num = 256, - SQ_ALU_CONSTANT_vs_num = 256, - SQ_ALU_CONSTANT_all_num = 512, - SQ_ALU_CONSTANT_offset = 16, - SQ_ALU_CONSTANT_ps = 0, - SQ_ALU_CONSTANT_vs = SQ_ALU_CONSTANT_ps + SQ_ALU_CONSTANT_ps_num, - SQ_TEX_RESOURCE = SQ_TEX_RESOURCE_WORD0_0, /* 160 PS, 160 VS, 16 FS, 160 GS */ - SQ_TEX_RESOURCE_ps_num = 160, - SQ_TEX_RESOURCE_vs_num = 160, - SQ_TEX_RESOURCE_fs_num = 16, - SQ_TEX_RESOURCE_gs_num = 160, - SQ_TEX_RESOURCE_all_num = 496, - SQ_TEX_RESOURCE_offset = 28, - SQ_TEX_RESOURCE_ps = 0, - SQ_TEX_RESOURCE_vs = SQ_TEX_RESOURCE_ps + SQ_TEX_RESOURCE_ps_num, - SQ_TEX_RESOURCE_fs = SQ_TEX_RESOURCE_vs + SQ_TEX_RESOURCE_vs_num, - SQ_TEX_RESOURCE_gs = SQ_TEX_RESOURCE_fs + SQ_TEX_RESOURCE_fs_num, - SQ_VTX_RESOURCE = SQ_VTX_CONSTANT_WORD0_0, /* 160 PS, 160 VS, 16 FS, 160 GS */ - SQ_VTX_RESOURCE_ps_num = 160, - SQ_VTX_RESOURCE_vs_num = 160, - SQ_VTX_RESOURCE_fs_num = 16, - SQ_VTX_RESOURCE_gs_num = 160, - SQ_VTX_RESOURCE_all_num = 496, - SQ_VTX_RESOURCE_offset = 28, - SQ_VTX_RESOURCE_ps = 0, - SQ_VTX_RESOURCE_vs = SQ_VTX_RESOURCE_ps + SQ_VTX_RESOURCE_ps_num, - SQ_VTX_RESOURCE_fs = SQ_VTX_RESOURCE_vs + SQ_VTX_RESOURCE_vs_num, - SQ_VTX_RESOURCE_gs = SQ_VTX_RESOURCE_fs + SQ_VTX_RESOURCE_fs_num, - SQ_TEX_SAMPLER_WORD = SQ_TEX_SAMPLER_WORD0_0, /* 18 per PS, VS, GS */ - SQ_TEX_SAMPLER_WORD_ps_num = 18, - SQ_TEX_SAMPLER_WORD_vs_num = 18, - SQ_TEX_SAMPLER_WORD_gs_num = 18, - SQ_TEX_SAMPLER_WORD_all_num = 54, - SQ_TEX_SAMPLER_WORD_offset = 12, - SQ_TEX_SAMPLER_WORD_ps = 0, - SQ_TEX_SAMPLER_WORD_vs = SQ_TEX_SAMPLER_WORD_ps + SQ_TEX_SAMPLER_WORD_ps_num, - SQ_TEX_SAMPLER_WORD_gs = SQ_TEX_SAMPLER_WORD_vs + SQ_TEX_SAMPLER_WORD_vs_num, - SQ_LOOP_CONST = SQ_LOOP_CONST_0, /* 32 per PS, VS, GS */ - SQ_LOOP_CONST_ps_num = 32, - SQ_LOOP_CONST_vs_num = 32, - SQ_LOOP_CONST_gs_num = 32, - SQ_LOOP_CONST_all_num = 96, - SQ_LOOP_CONST_offset = 4, - SQ_LOOP_CONST_ps = 0, - SQ_LOOP_CONST_vs = SQ_LOOP_CONST_ps + SQ_LOOP_CONST_ps_num, - SQ_LOOP_CONST_gs = SQ_LOOP_CONST_vs + SQ_LOOP_CONST_vs_num, - SQ_BOOL_CONST = SQ_BOOL_CONST_0, /* 32 bits per PS, VS, GS */ - SQ_BOOL_CONST_ps_num = 1, - SQ_BOOL_CONST_vs_num = 1, - SQ_BOOL_CONST_gs_num = 1, - SQ_BOOL_CONST_all_num = 3, - SQ_BOOL_CONST_offset = 4, - SQ_BOOL_CONST_ps = 0, - SQ_BOOL_CONST_vs = SQ_BOOL_CONST_ps + SQ_BOOL_CONST_ps_num, - SQ_BOOL_CONST_gs = SQ_BOOL_CONST_vs + SQ_BOOL_CONST_vs_num -}; - - -#endif diff --git a/headers/private/graphics/radeon_hd/r600_reg_r7xx.h b/headers/private/graphics/radeon_hd/r600_reg_r7xx.h deleted file mode 100644 index f9c2b661f9..0000000000 --- a/headers/private/graphics/radeon_hd/r600_reg_r7xx.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * RadeonHD R6xx, R7xx Register documentation - * - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * Copyright (C) 2008-2009 Matthias Hopf - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef _R600_REG_R7xx_H_ -#define _R600_REG_R7xx_H_ - -/* - * Register update for R7xx chips - */ - -enum { - - /* R7XX_MC_VM_FB_LOCATION = 0x00002024, */ - -/* GRBM_STATUS = 0x00008010, */ - R7XX_TA_BUSY_bit = 1 << 14, - - R7xx_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ = 0x00008d8c, - RING0_OFFSET_mask = 0xff << 0, - RING0_OFFSET_shift = 0, - ISOLATE_ES_ENABLE_bit = 1 << 12, - ISOLATE_GS_ENABLE_bit = 1 << 13, - VS_PC_LIMIT_ENABLE_bit = 1 << 14, - -/* SQ_ALU_WORD0 = 0x00008dfc, */ -/* SRC0_SEL_mask = 0x1ff << 0, */ -/* SRC1_SEL_mask = 0x1ff << 13, */ - R7xx_SQ_ALU_SRC_1_DBL_L = 0xf4, - R7xx_SQ_ALU_SRC_1_DBL_M = 0xf5, - R7xx_SQ_ALU_SRC_0_5_DBL_L = 0xf6, - R7xx_SQ_ALU_SRC_0_5_DBL_M = 0xf7, -/* INDEX_MODE_mask = 0x07 << 26, */ - R7xx_SQ_INDEX_GLOBAL = 0x05, - R7xx_SQ_INDEX_GLOBAL_AR_X = 0x06, - R6xx_SQ_ALU_WORD1_OP2 = 0x00008dfc, - R7xx_SQ_ALU_WORD1_OP2_V2 = 0x00008dfc, - R6xx_FOG_MERGE_bit = 1 << 5, - R6xx_OMOD_mask = 0x03 << 6, - R7xx_OMOD_mask = 0x03 << 5, - R6xx_OMOD_shift = 6, - R7xx_OMOD_shift = 5, - R6xx_SQ_ALU_WORD1_OP2__ALU_INST_mask = 0x3ff << 8, - R7xx_SQ_ALU_WORD1_OP2_V2__ALU_INST_mask = 0x7ff << 7, - R6xx_SQ_ALU_WORD1_OP2__ALU_INST_shift = 8, - R7xx_SQ_ALU_WORD1_OP2_V2__ALU_INST_shift = 7, - R7xx_SQ_OP2_INST_FREXP_64 = 0x07, - R7xx_SQ_OP2_INST_ADD_64 = 0x17, - R7xx_SQ_OP2_INST_MUL_64 = 0x1b, - R7xx_SQ_OP2_INST_FLT64_TO_FLT32 = 0x1c, - R7xx_SQ_OP2_INST_FLT32_TO_FLT64 = 0x1d, - R7xx_SQ_OP2_INST_LDEXP_64 = 0x7a, - R7xx_SQ_OP2_INST_FRACT_64 = 0x7b, - R7xx_SQ_OP2_INST_PRED_SETGT_64 = 0x7c, - R7xx_SQ_OP2_INST_PRED_SETE_64 = 0x7d, - R7xx_SQ_OP2_INST_PRED_SETGE_64 = 0x7e, -/* SQ_ALU_WORD1_OP3 = 0x00008dfc, */ -/* SRC2_SEL_mask = 0x1ff << 0, */ -/* R7xx_SQ_ALU_SRC_1_DBL_L = 0xf4, */ -/* R7xx_SQ_ALU_SRC_1_DBL_M = 0xf5, */ -/* R7xx_SQ_ALU_SRC_0_5_DBL_L = 0xf6, */ -/* R7xx_SQ_ALU_SRC_0_5_DBL_M = 0xf7, */ -/* SQ_ALU_WORD1_OP3__ALU_INST_mask = 0x1f << 13, */ - R7xx_SQ_OP3_INST_MULADD_64 = 0x08, - R7xx_SQ_OP3_INST_MULADD_64_M2 = 0x09, - R7xx_SQ_OP3_INST_MULADD_64_M4 = 0x0a, - R7xx_SQ_OP3_INST_MULADD_64_D2 = 0x0b, -/* SQ_CF_ALU_WORD1 = 0x00008dfc, */ - R6xx_USES_WATERFALL_bit = 1 << 25, - R7xx_SQ_CF_ALU_WORD1__ALT_CONST_bit = 1 << 25, -/* SQ_CF_ALLOC_EXPORT_WORD0 = 0x00008dfc, */ -/* ARRAY_BASE_mask = 0x1fff << 0, */ -/* TYPE_mask = 0x03 << 13, */ -/* SQ_EXPORT_PARAM = 0x02, */ -/* X_UNUSED_FOR_SX_EXPORTS = 0x03, */ -/* ELEM_SIZE_mask = 0x03 << 30, */ -/* SQ_CF_ALLOC_EXPORT_WORD1 = 0x00008dfc, */ -/* SQ_CF_ALLOC_EXPORT_WORD1__CF_INST_mask = 0x7f << 23, */ - R7xx_SQ_CF_INST_MEM_EXPORT = 0x3a, -/* SQ_CF_WORD1 = 0x00008dfc, */ -/* SQ_CF_WORD1__COUNT_mask = 0x07 << 10, */ - R7xx_COUNT_3_bit = 1 << 19, -/* SQ_CF_WORD1__CF_INST_mask = 0x7f << 23, */ - R7xx_SQ_CF_INST_END_PROGRAM = 0x19, - R7xx_SQ_CF_INST_WAIT_ACK = 0x1a, - R7xx_SQ_CF_INST_TEX_ACK = 0x1b, - R7xx_SQ_CF_INST_VTX_ACK = 0x1c, - R7xx_SQ_CF_INST_VTX_TC_ACK = 0x1d, -/* SQ_VTX_WORD0 = 0x00008dfc, */ -/* VTX_INST_mask = 0x1f << 0, */ - R7xx_SQ_VTX_INST_MEM = 0x02, -/* SQ_VTX_WORD2 = 0x00008dfc, */ - R7xx_SQ_VTX_WORD2__ALT_CONST_bit = 1 << 20, - -/* SQ_TEX_WORD0 = 0x00008dfc, */ -/* TEX_INST_mask = 0x1f << 0, */ - R7xx_X_MEMORY_READ = 0x02, - R7xx_SQ_TEX_INST_KEEP_GRADIENTS = 0x0a, - R7xx_X_FETCH4_LOAD4_INSTRUCTION_FOR_DX10_1 = 0x0f, - R7xx_SQ_TEX_WORD0__ALT_CONST_bit = 1 << 24, - - R7xx_PA_SC_EDGERULE = 0x00028230, - R7xx_SPI_THREAD_GROUPING = 0x000286c8, - PS_GROUPING_mask = 0x1f << 0, - PS_GROUPING_shift = 0, - VS_GROUPING_mask = 0x1f << 8, - VS_GROUPING_shift = 8, - GS_GROUPING_mask = 0x1f << 16, - GS_GROUPING_shift = 16, - ES_GROUPING_mask = 0x1f << 24, - ES_GROUPING_shift = 24, - R7xx_CB_SHADER_CONTROL = 0x000287a0, - RT0_ENABLE_bit = 1 << 0, - RT1_ENABLE_bit = 1 << 1, - RT2_ENABLE_bit = 1 << 2, - RT3_ENABLE_bit = 1 << 3, - RT4_ENABLE_bit = 1 << 4, - RT5_ENABLE_bit = 1 << 5, - RT6_ENABLE_bit = 1 << 6, - RT7_ENABLE_bit = 1 << 7, -/* DB_ALPHA_TO_MASK = 0x00028d44, */ - R7xx_OFFSET_ROUND_bit = 1 << 16, -/* SQ_TEX_SAMPLER_MISC_0 = 0x0003d03c, */ - R7xx_TRUNCATE_COORD_bit = 1 << 9, - R7xx_DISABLE_CUBE_WRAP_bit = 1 << 10 - -} ; - -#endif /* _R600_REG_R7xx_H_ */ diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile b/src/add-ons/accelerants/radeon_hd/Jamfile index e769ff1874..ffdf8dbef8 100644 --- a/src/add-ons/accelerants/radeon_hd/Jamfile +++ b/src/add-ons/accelerants/radeon_hd/Jamfile @@ -11,11 +11,11 @@ UsePrivateHeaders [ FDirName graphics common ] ; Addon radeon_hd.accelerant : atom.cpp + gpu.cpp accelerant.cpp engine.cpp hooks.cpp pll.cpp - mc.cpp dac.cpp display.cpp tmds.cpp diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 35c2d25fee..97f022e5f7 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -13,7 +13,7 @@ #include "bios.h" #include "display.h" -#include "mc.h" +#include "gpu.h" #include "pll.h" #include "utility.h" diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 97e2a3981d..7a507cfee2 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -110,6 +110,10 @@ radeon_init_bios(uint8* bios) radeon_bios_init_scratch(); atom_allocate_fb_scratch(gAtomContext); + // TODO : this is only *required* on cards <= r500 + // is it ok to run on cards > r500 before asic_init? + radeon_gpu_reset(); + atom_asic_init(gAtomContext); // Post card diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp new file mode 100644 index 0000000000..4c0d63220e --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -0,0 +1,217 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include "accelerant_protos.h" +#include "accelerant.h" +#include "utility.h" +#include "gpu.h" + +#include + +#undef TRACE + +#define TRACE_GPU +#ifdef TRACE_GPU +# define TRACE(x...) _sPrintf("radeon_hd: " x) +#else +# define TRACE(x...) ; +#endif + +#define ERROR(x...) _sPrintf("radeon_hd: " x) + + +status_t +radeon_gpu_reset() +{ + radeon_shared_info &info = *gInfo->shared_info; + + // Read GRBM Command Processor status + if (!(Read32(OUT, GRBM_STATUS) & GUI_ACTIVE)) + return B_ERROR; + + TRACE("%s: GPU software reset in progress...\n", __func__); + + // TODO : mc stop + + if (radeon_gpu_mc_idle() > 0) { + ERROR("%s: Timeout waiting for MC to idle!\n", __func__); + } + + if (info.device_chipset < RADEON_R1000) { + Write32(OUT, CP_ME_CNTL, CP_ME_HALT); + // Disable Command Processor parsing / prefetching + + // Register busy masks for early Radeon HD cards + + // GRBM Command Processor Status + uint32 grbm_busy_mask = VC_BUSY; + // Vertex Cache Busy + grbm_busy_mask |= VGT_BUSY_NO_DMA | VGT_BUSY; + // Vertex Grouper Tessellator Busy + grbm_busy_mask |= TA03_BUSY; + // unknown + grbm_busy_mask |= TC_BUSY; + // Texture Cache Busy + grbm_busy_mask |= SX_BUSY; + // Shader Export Busy + grbm_busy_mask |= SH_BUSY; + // Sequencer Instruction Cache Busy + grbm_busy_mask |= SPI_BUSY; + // Shader Processor Interpolator Busy + grbm_busy_mask |= SMX_BUSY; + // Shader Memory Exchange + grbm_busy_mask |= SC_BUSY; + // Scan Converter Busy + grbm_busy_mask |= PA_BUSY; + // Primitive Assembler Busy + grbm_busy_mask |= DB_BUSY; + // Depth Block Busy + grbm_busy_mask |= CR_BUSY; + // unknown + grbm_busy_mask |= CB_BUSY; + // Color Block Busy + grbm_busy_mask |= GUI_ACTIVE; + // unknown (graphics pipeline active?) + + // GRBM Command Processor Detailed Status + uint32 grbm2_busy_mask = SPI0_BUSY | SPI1_BUSY | SPI2_BUSY | SPI3_BUSY; + // Shader Processor Interpolator 0 - 3 Busy + grbm2_busy_mask |= TA0_BUSY | TA1_BUSY | TA2_BUSY | TA3_BUSY; + // unknown 0 - 3 Busy + grbm2_busy_mask |= DB0_BUSY | DB1_BUSY | DB2_BUSY | DB3_BUSY; + // Depth Block 0 - 3 Busy + grbm2_busy_mask |= CB0_BUSY | CB1_BUSY | CB2_BUSY | CB3_BUSY; + // Color Block 0 - 3 Busy + + uint32 tmp; + /* Check if any of the rendering block is busy and reset it */ + if ((Read32(OUT, GRBM_STATUS) & grbm_busy_mask) + || (Read32(OUT, GRBM_STATUS2) & grbm2_busy_mask)) { + tmp = SOFT_RESET_CR + | SOFT_RESET_DB + | SOFT_RESET_CB + | SOFT_RESET_PA + | SOFT_RESET_SC + | SOFT_RESET_SMX + | SOFT_RESET_SPI + | SOFT_RESET_SX + | SOFT_RESET_SH + | SOFT_RESET_TC + | SOFT_RESET_TA + | SOFT_RESET_VC + | SOFT_RESET_VGT; + Write32(OUT, GRBM_SOFT_RESET, tmp); + Read32(OUT, GRBM_SOFT_RESET); + snooze(15000); + Write32(OUT, GRBM_SOFT_RESET, 0); + } + + // Reset CP + tmp = SOFT_RESET_CP; + Write32(OUT, GRBM_SOFT_RESET, tmp); + Read32(OUT, GRBM_SOFT_RESET); + snooze(15000); + Write32(OUT, GRBM_SOFT_RESET, 0); + + // Let things settle + snooze(1000); + } else { + // Northern Islands and higher + + Write32(OUT, CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT); + // Disable Command Processor parsing / prefetching + + // reset the graphics pipeline components + uint32 grbm_reset = (SOFT_RESET_CP + | SOFT_RESET_CB + | SOFT_RESET_DB + | SOFT_RESET_GDS + | SOFT_RESET_PA + | SOFT_RESET_SC + | SOFT_RESET_SPI + | SOFT_RESET_SH + | SOFT_RESET_SX + | SOFT_RESET_TC + | SOFT_RESET_TA + | SOFT_RESET_VGT + | SOFT_RESET_IA); + + Write32(OUT, GRBM_SOFT_RESET, grbm_reset); + Read32(OUT, GRBM_SOFT_RESET); + + snooze(50); + Write32(OUT, GRBM_SOFT_RESET, 0); + Read32(OUT, GRBM_SOFT_RESET); + snooze(50); + } + + + // TODO : mc resume + return B_OK; +} + + +uint32 +radeon_gpu_mc_idle() +{ + uint32 idleStatus; + if (!((idleStatus = Read32(MC, SRBM_STATUS)) & + (VMC_BUSY | MCB_BUSY | + MCDZ_BUSY | MCDY_BUSY | MCDX_BUSY | MCDW_BUSY))) + return 0; + + return idleStatus; +} + + +status_t +radeon_gpu_mc_setup() +{ + uint32 fb_location_int = gInfo->shared_info->frame_buffer_int; + + uint32 fb_location = Read32(OUT, R6XX_MC_VM_FB_LOCATION); + uint16 fb_size = (fb_location >> 16) - (fb_location & 0xFFFF); + uint32 fb_location_tmp = fb_location_int >> 24; + fb_location_tmp |= (fb_location_tmp + fb_size) << 16; + uint32 fb_offset_tmp = (fb_location_int >> 8) & 0xff0000; + + uint32 idleState = radeon_gpu_mc_idle(); + if (idleState > 0) { + TRACE("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", + __func__, idleState); + return B_ERROR; + } + + TRACE("%s: Setting frame buffer from 0x%" B_PRIX32 + " to 0x%" B_PRIX32 " [size 0x%" B_PRIX16 "]\n", + __func__, fb_location, fb_location_tmp, fb_size); + + // The MC Write32 will handle cards needing a special MC read/write register + Write32(MC, R6XX_MC_VM_FB_LOCATION, fb_location_tmp); + Write32(MC, R6XX_HDP_NONSURFACE_BASE, fb_offset_tmp); + + return B_OK; +} + + +status_t +radeon_gpu_irq_setup() +{ + // TODO : Stub for IRQ setup + + // allocate rings via r600_ih_ring_alloc + + // disable irq's via r600_disable_interrupts + + // r600_rlc_init + + // setup interrupt control + + return B_ERROR; +} diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h new file mode 100644 index 0000000000..d3958f4c46 --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -0,0 +1,168 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ +#ifndef RADEON_HD_MC_H +#define RADEON_HD_MC_H + + +// GPU Control registers. These are combined as +// the registers exist on all models, some flags +// are different though and are commented as such +#define CP_ME_CNTL 0x86D8 +#define CP_ME_HALT (1 << 28) +#define CP_PFP_HALT (1 << 26) +#define CP_ME_RAM_DATA 0xC160 +#define CP_ME_RAM_RADDR 0xC158 +#define CP_ME_RAM_WADDR 0xC15C +#define CP_MEQ_THRESHOLDS 0x8764 +#define STQ_SPLIT(x) ((x) << 0) +#define CP_PERFMON_CNTL 0x87FC +#define CP_PFP_UCODE_ADDR 0xC150 +#define CP_PFP_UCODE_DATA 0xC154 +#define CP_QUEUE_THRESHOLDS 0x8760 +#define ROQ_IB1_START(x) ((x) << 0) +#define ROQ_IB2_START(x) ((x) << 8) +#define CP_RB_BASE 0xC100 +#define CP_RB_CNTL 0xC104 +#define RB_BUFSZ(x) ((x) << 0) +#define RB_BLKSZ(x) ((x) << 8) +#define RB_NO_UPDATE (1 << 27) +#define RB_RPTR_WR_ENA (1 << 31) +#define BUF_SWAP_32BIT (2 << 16) +#define CP_RB_RPTR 0x8700 +#define CP_RB_RPTR_ADDR 0xC10C +#define RB_RPTR_SWAP(x) ((x) << 0) +#define CP_RB_RPTR_ADDR_HI 0xC110 +#define CP_RB_RPTR_WR 0xC108 +#define CP_RB_WPTR 0xC114 +#define CP_RB_WPTR_ADDR 0xC118 +#define CP_RB_WPTR_ADDR_HI 0xC11C +#define CP_RB_WPTR_DELAY 0x8704 +#define CP_SEM_WAIT_TIMER 0x85BC +#define CP_DEBUG 0xC1FC + +#define NI_GRBM_CNTL 0x8000 +#define GRBM_READ_TIMEOUT(x) ((x) << 0) +#define GRBM_STATUS 0x8010 +#define CMDFIFO_AVAIL_MASK 0x0000000F +#define RING2_RQ_PENDING (1 << 4) +#define SRBM_RQ_PENDING (1 << 5) +#define RING1_RQ_PENDING (1 << 6) +#define CF_RQ_PENDING (1 << 7) +#define PF_RQ_PENDING (1 << 8) +#define GDS_DMA_RQ_PENDING (1 << 9) +#define GRBM_EE_BUSY (1 << 10) +#define SX_CLEAN (1 << 11) // ni +#define VC_BUSY (1 << 11) // r600 +#define DB_CLEAN (1 << 12) +#define CB_CLEAN (1 << 13) +#define TA_BUSY (1 << 14) +#define GDS_BUSY (1 << 15) +#define VGT_BUSY_NO_DMA (1 << 16) +#define VGT_BUSY (1 << 17) +#define IA_BUSY_NO_DMA (1 << 18) // ni +#define TA03_BUSY (1 << 18) // r600 +#define IA_BUSY (1 << 19) // ni +#define TC_BUSY (1 << 19) // r600 +#define SX_BUSY (1 << 20) +#define SH_BUSY (1 << 21) +#define SPI_BUSY (1 << 22) // AKA SPI03_BUSY r600 +#define SMX_BUSY (1 << 23) +#define SC_BUSY (1 << 24) +#define PA_BUSY (1 << 25) +#define DB_BUSY (1 << 26) // AKA DB03_BUSY r600 +#define CR_BUSY (1 << 27) +#define CP_COHERENCY_BUSY (1 << 28) +#define CP_BUSY (1 << 29) +#define CB_BUSY (1 << 30) +#define GUI_ACTIVE (1 << 31) +#define GRBM_STATUS2 0x8014 // AKA GRBM_STATUS_SE0 ON NI +#define CR_CLEAN (1 << 0) +#define SMX_CLEAN (1 << 1) +#define SPI0_BUSY (1 << 8) +#define SPI1_BUSY (1 << 9) +#define SPI2_BUSY (1 << 10) +#define SPI3_BUSY (1 << 11) +#define TA0_BUSY (1 << 12) +#define TA1_BUSY (1 << 13) +#define TA2_BUSY (1 << 14) +#define TA3_BUSY (1 << 15) +#define DB0_BUSY (1 << 16) +#define DB1_BUSY (1 << 17) +#define DB2_BUSY (1 << 18) +#define DB3_BUSY (1 << 19) +#define CB0_BUSY (1 << 20) +#define CB1_BUSY (1 << 21) +#define CB2_BUSY (1 << 22) +#define CB3_BUSY (1 << 23) +#define NI_GRBM_STATUS_SE1 0x8018 +#define SE_SX_CLEAN (1 << 0) +#define SE_DB_CLEAN (1 << 1) +#define SE_CB_CLEAN (1 << 2) +#define SE_VGT_BUSY (1 << 23) +#define SE_PA_BUSY (1 << 24) +#define SE_TA_BUSY (1 << 25) +#define SE_SX_BUSY (1 << 26) +#define SE_SPI_BUSY (1 << 27) +#define SE_SH_BUSY (1 << 28) +#define SE_SC_BUSY (1 << 29) +#define SE_DB_BUSY (1 << 30) +#define SE_CB_BUSY (1 << 31) +#define GRBM_SOFT_RESET 0x8020 +#define SRBM_STATUS 0x0E50 +#define RLC_RQ_PENDING (1 << 3) +#define RCU_RQ_PENDING (1 << 4) +#define GRBM_RQ_PENDING (1 << 5) +#define HI_RQ_PENDING (1 << 6) +#define IO_EXTERN_SIGNAL (1 << 7) +#define VMC_BUSY (1 << 8) +#define MCB_BUSY (1 << 9) +#define MCDZ_BUSY (1 << 10) +#define MCDY_BUSY (1 << 11) +#define MCDX_BUSY (1 << 12) +#define MCDW_BUSY (1 << 13) +#define SEM_BUSY (1 << 14) +#define SRBM_STATUS__RLC_BUSY (1 << 15) +#define PDMA_BUSY (1 << 16) +#define IH_BUSY (1 << 17) +#define CSC_BUSY (1 << 20) +#define CMC7_BUSY (1 << 21) +#define CMC6_BUSY (1 << 22) +#define CMC5_BUSY (1 << 23) +#define CMC4_BUSY (1 << 24) +#define CMC3_BUSY (1 << 25) +#define CMC2_BUSY (1 << 26) +#define CMC1_BUSY (1 << 27) +#define CMC0_BUSY (1 << 28) +#define BIF_BUSY (1 << 29) +#define IDCT_BUSY (1 << 30) +#define SRBM_SOFT_RESET 0x0E60 +#define SOFT_RESET_CP (1 << 0) +#define SOFT_RESET_CB (1 << 1) +#define SOFT_RESET_CR (1 << 2) +#define SOFT_RESET_DB (1 << 3) +#define SOFT_RESET_GDS (1 << 4) +#define SOFT_RESET_PA (1 << 5) +#define SOFT_RESET_SC (1 << 6) +#define SOFT_RESET_SMX (1 << 7) +#define SOFT_RESET_SPI (1 << 8) +#define SOFT_RESET_SH (1 << 9) +#define SOFT_RESET_SX (1 << 10) +#define SOFT_RESET_TC (1 << 11) +#define SOFT_RESET_TA (1 << 12) +#define SOFT_RESET_VC (1 << 13) +#define SOFT_RESET_VGT (1 << 14) +#define SOFT_RESET_IA (1 << 15) + + +status_t radeon_gpu_reset(); +uint32 radeon_gpu_mc_idle(); +status_t radeon_gpu_mc_setup(); +status_t radeon_gpu_irq_setup(); + + +#endif diff --git a/src/add-ons/accelerants/radeon_hd/mc.cpp b/src/add-ons/accelerants/radeon_hd/mc.cpp deleted file mode 100644 index da514ecfdf..0000000000 --- a/src/add-ons/accelerants/radeon_hd/mc.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ - - -#include "accelerant_protos.h" -#include "accelerant.h" -#include "utility.h" -#include "mc.h" - - -/* Read32/Write32 for MC can hande the fact that some cards need to write - to a special MC interface, while others just write to the card directly. - As of R600 - R800 though the special MC interface doesn't seem to exist -*/ - - -#define TRACE_MC -#ifdef TRACE_MC -extern "C" void _sPrintf(const char *format, ...); -# define TRACE(x...) _sPrintf("radeon_hd: " x) -#else -# define TRACE(x...) ; -#endif - - -uint32 -MCIdle() -{ - uint32 turboencabulator; - if (!((turboencabulator = Read32(MC, SRBM_STATUS)) & - (VMC_BUSY_bit | MCB_BUSY_bit | - MCDZ_BUSY_bit | MCDY_BUSY_bit | MCDX_BUSY_bit | MCDW_BUSY_bit))) - return 0; - - return turboencabulator; -} - - -status_t -MCFBSetup() -{ - uint32 fb_location_int = gInfo->shared_info->frame_buffer_int; - - uint32 fb_location = Read32(OUT, R6XX_MC_VM_FB_LOCATION); - uint16 fb_size = (fb_location >> 16) - (fb_location & 0xFFFF); - uint32 fb_location_tmp = fb_location_int >> 24; - fb_location_tmp |= (fb_location_tmp + fb_size) << 16; - uint32 fb_offset_tmp = (fb_location_int >> 8) & 0xff0000; - - uint32 idleState = MCIdle(); - if (idleState > 0) { - TRACE("%s: Cannot modify non-idle MC! idleState: %X\n", - __func__, idleState); - return B_ERROR; - } - - TRACE("%s: Setting frame buffer from 0x%08X to 0x%08X [size 0x%08X]\n", - __func__, fb_location, fb_location_tmp, fb_size); - - // The MC Write32 will handle cards needing a special MC read/write register - Write32(MC, R6XX_MC_VM_FB_LOCATION, fb_location_tmp); - Write32(MC, R6XX_HDP_NONSURFACE_BASE, fb_offset_tmp); - - return B_OK; -} diff --git a/src/add-ons/accelerants/radeon_hd/mc.h b/src/add-ons/accelerants/radeon_hd/mc.h deleted file mode 100644 index d1858b86a0..0000000000 --- a/src/add-ons/accelerants/radeon_hd/mc.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ -#ifndef RADEON_HD_MC_H -#define RADEON_HD_MC_H - - -uint32 MCIdle(); -status_t MCFBSetup(); - - -#endif diff --git a/src/add-ons/accelerants/radeon_hd/mode.h b/src/add-ons/accelerants/radeon_hd/mode.h index 0b51cd93e2..1527978c97 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.h +++ b/src/add-ons/accelerants/radeon_hd/mode.h @@ -13,7 +13,7 @@ #include #include -#include "mc.h" +#include "gpu.h" #define T_POSITIVE_SYNC (B_POSITIVE_HSYNC | B_POSITIVE_VSYNC) From 93d4d55295f5122d099c396ef99b5e11c0bc2ee7 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 10 Aug 2011 15:51:00 +0000 Subject: [PATCH 165/702] * a few small style fixes to last commit * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42617 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 3 ++- src/add-ons/accelerants/radeon_hd/gpu.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 4c0d63220e..2a37354cd3 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -9,11 +9,12 @@ #include "accelerant_protos.h" #include "accelerant.h" -#include "utility.h" #include "gpu.h" +#include "utility.h" #include + #undef TRACE #define TRACE_GPU diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index d3958f4c46..e8311e4694 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -5,8 +5,8 @@ * Authors: * Alexander von Gluck, kallisti5@unixzen.com */ -#ifndef RADEON_HD_MC_H -#define RADEON_HD_MC_H +#ifndef RADEON_HD_GPU_H +#define RADEON_HD_GPU_H // GPU Control registers. These are combined as From 3d01f69f9ecf048c2fc214dcaa0511081eaf51d8 Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Wed, 10 Aug 2011 19:14:49 +0000 Subject: [PATCH 166/702] Fixed open_memstream(), buf was void, opengroup.org shows that it should be char. Fixes #7905. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42618 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/stdio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headers/posix/stdio.h b/headers/posix/stdio.h index 7d744d5f2a..aa8fd9e5ef 100644 --- a/headers/posix/stdio.h +++ b/headers/posix/stdio.h @@ -97,7 +97,7 @@ extern void perror(const char *errorPrefix); /* memory streams */ extern FILE *fmemopen(void *buf, size_t size, const char *mode); -extern FILE *open_memstream(void **buf, size_t *size); +extern FILE *open_memstream(char **buf, size_t *size); /* file I/O */ extern int fflush(FILE *stream); From 33272012fb9f54a00444e7213a59b7312d201095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 10 Aug 2011 20:53:06 +0000 Subject: [PATCH 167/702] * Fixed reversed handling of O_NOTRAVERSE in attr_open(), and attr_create(). * Added support for O_NOFOLLOW for those two as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42619 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/fs/vfs.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index e1e1d0609c..a2bf3f192a 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -1,6 +1,6 @@ /* * Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -5308,7 +5308,7 @@ file_open_entry_ref(dev_t mountID, ino_t directoryID, const char* name, FUNCTION(("file_open_entry_ref(ref = (%ld, %Ld, %s), openMode = %d)\n", mountID, directoryID, name, openMode)); - bool traverse = ((openMode & (O_NOTRAVERSE | O_NOFOLLOW)) == 0); + bool traverse = (openMode & (O_NOTRAVERSE | O_NOFOLLOW)) == 0; // get the vnode matching the entry_ref struct vnode* vnode; @@ -5337,7 +5337,7 @@ file_open_entry_ref(dev_t mountID, ino_t directoryID, const char* name, static int file_open(int fd, char* path, int openMode, bool kernel) { - bool traverse = ((openMode & (O_NOTRAVERSE | O_NOFOLLOW)) == 0); + bool traverse = (openMode & (O_NOTRAVERSE | O_NOFOLLOW)) == 0; FUNCTION(("file_open: fd: %d, entry path = '%s', omode %d, kernel %d\n", fd, path, openMode, kernel)); @@ -6396,12 +6396,18 @@ attr_create(int fd, char* path, const char* name, uint32 type, if (name == NULL || *name == '\0') return B_BAD_VALUE; + bool traverse = (openMode & (O_NOTRAVERSE | O_NOFOLLOW)) == 0; struct vnode* vnode; - status_t status = fd_and_path_to_vnode(fd, path, - (openMode & O_NOTRAVERSE) != 0, &vnode, NULL, kernel); + status_t status = fd_and_path_to_vnode(fd, path, traverse, &vnode, NULL, + kernel); if (status != B_OK) return status; + if ((openMode & O_NOFOLLOW) != 0 && S_ISLNK(vnode->Type())) { + status = B_LINK_LIMIT; + goto err; + } + if (!HAS_FS_CALL(vnode, create_attr)) { status = B_READ_ONLY_DEVICE; goto err; @@ -6436,12 +6442,18 @@ attr_open(int fd, char* path, const char* name, int openMode, bool kernel) if (name == NULL || *name == '\0') return B_BAD_VALUE; + bool traverse = (openMode & (O_NOTRAVERSE | O_NOFOLLOW)) == 0; struct vnode* vnode; - status_t status = fd_and_path_to_vnode(fd, path, - (openMode & O_NOTRAVERSE) != 0, &vnode, NULL, kernel); + status_t status = fd_and_path_to_vnode(fd, path, traverse, &vnode, NULL, + kernel); if (status != B_OK) return status; + if ((openMode & O_NOFOLLOW) != 0 && S_ISLNK(vnode->Type())) { + status = B_LINK_LIMIT; + goto err; + } + if (!HAS_FS_CALL(vnode, open_attr)) { status = B_NOT_SUPPORTED; goto err; From d5e36fb599b43a6a9dfb3cf8e95018fe15780219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 10 Aug 2011 21:08:00 +0000 Subject: [PATCH 168/702] * Introduced new fs_lopen_attr_dir() function that opens the attribute directory of a file without traversing leaf links (just like lstat()). * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42620 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/kernel/fs_attr.h | 4 +- headers/private/kernel/vfs.h | 5 ++- headers/private/system/syscalls.h | 9 ++-- src/system/kernel/fs/vfs.cpp | 73 +++++++++++++------------------ src/system/libroot/os/fs_attr.cpp | 16 ++++--- 5 files changed, 52 insertions(+), 55 deletions(-) diff --git a/headers/os/kernel/fs_attr.h b/headers/os/kernel/fs_attr.h index 3f24985f05..d0d6a15dd8 100644 --- a/headers/os/kernel/fs_attr.h +++ b/headers/os/kernel/fs_attr.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Haiku Inc. All Rights Reserved. + * Copyright 2002-2011, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _FS_ATTR_H @@ -35,6 +35,7 @@ extern int fs_fopen_attr(int fd, const char *attribute, uint32 type, extern int fs_close_attr(int fd); extern DIR *fs_open_attr_dir(const char *path); +extern DIR *fs_lopen_attr_dir(const char *path); extern DIR *fs_fopen_attr_dir(int fd); extern int fs_close_attr_dir(DIR *dir); extern struct dirent *fs_read_attr_dir(DIR *dir); @@ -44,4 +45,5 @@ extern void fs_rewind_attr_dir(DIR *dir); } #endif + #endif /* _FS_ATTR_H */ diff --git a/headers/private/kernel/vfs.h b/headers/private/kernel/vfs.h index eed16d95df..d3edae5240 100644 --- a/headers/private/kernel/vfs.h +++ b/headers/private/kernel/vfs.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -199,7 +199,8 @@ status_t _user_access(int fd, const char *path, int mode, ssize_t _user_select(int numfds, fd_set *readSet, fd_set *writeSet, fd_set *errorSet, bigtime_t timeout, const sigset_t *sigMask); ssize_t _user_poll(struct pollfd *fds, int numfds, bigtime_t timeout); -int _user_open_attr_dir(int fd, const char *path); +int _user_open_attr_dir(int fd, const char *path, + bool traverseLeafLink); ssize_t _user_read_attr(int fd, const char *attribute, off_t pos, void *buffer, size_t readBytes); ssize_t _user_write_attr(int fd, const char *attribute, uint32 type, diff --git a/headers/private/system/syscalls.h b/headers/private/system/syscalls.h index 3ef1eba1d0..81cd20c10e 100644 --- a/headers/private/system/syscalls.h +++ b/headers/private/system/syscalls.h @@ -280,7 +280,8 @@ extern ssize_t _kern_select(int numfds, struct fd_set *readSet, extern ssize_t _kern_poll(struct pollfd *fds, int numFDs, bigtime_t timeout); -extern int _kern_open_attr_dir(int fd, const char *path); +extern int _kern_open_attr_dir(int fd, const char *path, + bool traverseLeafLink); extern ssize_t _kern_read_attr(int fd, const char *attribute, off_t pos, void *buffer, size_t readBytes); extern ssize_t _kern_write_attr(int fd, const char *attribute, uint32 type, @@ -435,10 +436,8 @@ extern status_t _kern_sync_memory(void *address, size_t size, int flags); extern status_t _kern_memory_advice(void *address, size_t size, uint32 advice); -extern status_t _kern_get_memory_properties(team_id teamID, - const void *address, - uint32* _protected, - uint32* _lock); +extern status_t _kern_get_memory_properties(team_id teamID, + const void *address, uint32* _protected, uint32* _lock); /* kernel port functions */ extern port_id _kern_create_port(int32 queue_length, const char *name); diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index a2bf3f192a..80da3bd3f2 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -5207,9 +5207,7 @@ static int open_dir_vnode(struct vnode* vnode, bool kernel) { void* cookie; - int status; - - status = FS_CALL(vnode, open_dir, &cookie); + status_t status = FS_CALL(vnode, open_dir, &cookie); if (status != B_OK) return status; @@ -5232,18 +5230,17 @@ open_dir_vnode(struct vnode* vnode, bool kernel) static int open_attr_dir_vnode(struct vnode* vnode, bool kernel) { - void* cookie; - int status; - if (!HAS_FS_CALL(vnode, open_attr_dir)) return B_NOT_SUPPORTED; - status = FS_CALL(vnode, open_attr_dir, &cookie); + void* cookie; + status_t status = FS_CALL(vnode, open_attr_dir, &cookie); if (status != B_OK) return status; // directory is opened, create a fd - status = get_new_fd(FDTYPE_ATTR_DIR, NULL, vnode, cookie, O_CLOEXEC, kernel); + status = get_new_fd(FDTYPE_ATTR_DIR, NULL, vnode, cookie, O_CLOEXEC, + kernel); if (status >= 0) return status; @@ -5258,14 +5255,12 @@ static int file_create_entry_ref(dev_t mountID, ino_t directoryID, const char* name, int openMode, int perms, bool kernel) { - struct vnode* directory; - int status; - FUNCTION(("file_create_entry_ref: name = '%s', omode %x, perms %d, " "kernel %d\n", name, openMode, perms, kernel)); // get directory to put the new file in - status = get_vnode(mountID, directoryID, &directory, true, false); + struct vnode* directory; + status_t status = get_vnode(mountID, directoryID, &directory, true, false); if (status != B_OK) return status; @@ -5279,15 +5274,14 @@ file_create_entry_ref(dev_t mountID, ino_t directoryID, const char* name, static int file_create(int fd, char* path, int openMode, int perms, bool kernel) { - char name[B_FILE_NAME_LENGTH]; - struct vnode* directory; - int status; - FUNCTION(("file_create: path '%s', omode %x, perms %d, kernel %d\n", path, openMode, perms, kernel)); // get directory to put the new file in - status = fd_and_path_to_dir_vnode(fd, path, &directory, name, kernel); + char name[B_FILE_NAME_LENGTH]; + struct vnode* directory; + status_t status = fd_and_path_to_dir_vnode(fd, path, &directory, name, + kernel); if (status < 0) return status; @@ -5577,15 +5571,14 @@ dir_create(int fd, char* path, int perms, bool kernel) static int dir_open_entry_ref(dev_t mountID, ino_t parentID, const char* name, bool kernel) { - struct vnode* vnode; - int status; - FUNCTION(("dir_open_entry_ref()\n")); - if (name && *name == '\0') + if (name && name[0] == '\0') return B_BAD_VALUE; // get the vnode matching the entry_ref/node_ref + struct vnode* vnode; + status_t status; if (name) { status = entry_ref_to_vnode(mountID, parentID, name, true, kernel, &vnode); @@ -6261,15 +6254,13 @@ static status_t common_path_read_stat(int fd, char* path, bool traverseLeafLink, struct stat* stat, bool kernel) { - struct vnode* vnode; - status_t status; - FUNCTION(("common_path_read_stat: fd: %d, path '%s', stat %p,\n", fd, path, stat)); - status = fd_and_path_to_vnode(fd, path, traverseLeafLink, &vnode, NULL, - kernel); - if (status < 0) + struct vnode* vnode; + status_t status = fd_and_path_to_vnode(fd, path, traverseLeafLink, &vnode, + NULL, kernel); + if (status != B_OK) return status; status = FS_CALL(vnode, read_stat, stat); @@ -6290,15 +6281,13 @@ static status_t common_path_write_stat(int fd, char* path, bool traverseLeafLink, const struct stat* stat, int statMask, bool kernel) { - struct vnode* vnode; - status_t status; - FUNCTION(("common_write_stat: fd: %d, path '%s', stat %p, stat_mask %d, " "kernel %d\n", fd, path, stat, statMask, kernel)); - status = fd_and_path_to_vnode(fd, path, traverseLeafLink, &vnode, NULL, - kernel); - if (status < 0) + struct vnode* vnode; + status_t status = fd_and_path_to_vnode(fd, path, traverseLeafLink, &vnode, + NULL, kernel); + if (status != B_OK) return status; if (HAS_FS_CALL(vnode, write_stat)) @@ -6313,15 +6302,14 @@ common_path_write_stat(int fd, char* path, bool traverseLeafLink, static int -attr_dir_open(int fd, char* path, bool kernel) +attr_dir_open(int fd, char* path, bool traverseLeafLink, bool kernel) { - struct vnode* vnode; - int status; - FUNCTION(("attr_dir_open(fd = %d, path = '%s', kernel = %d)\n", fd, path, kernel)); - status = fd_and_path_to_vnode(fd, path, true, &vnode, NULL, kernel); + struct vnode* vnode; + status_t status = fd_and_path_to_vnode(fd, path, traverseLeafLink, &vnode, + NULL, kernel); if (status != B_OK) return status; @@ -8252,7 +8240,7 @@ _kern_write_stat(int fd, const char* path, bool traverseLeafLink, int -_kern_open_attr_dir(int fd, const char* path) +_kern_open_attr_dir(int fd, const char* path, bool traverseLeafLink) { KPath pathBuffer(B_PATH_NAME_LENGTH + 1); if (pathBuffer.InitCheck() != B_OK) @@ -8261,7 +8249,8 @@ _kern_open_attr_dir(int fd, const char* path) if (path != NULL) pathBuffer.SetTo(path); - return attr_dir_open(fd, path ? pathBuffer.LockBuffer() : NULL, true); + return attr_dir_open(fd, path ? pathBuffer.LockBuffer() : NULL, + traverseLeafLink, true); } @@ -9225,7 +9214,7 @@ _user_write_stat(int fd, const char* userPath, bool traverseLeafLink, int -_user_open_attr_dir(int fd, const char* userPath) +_user_open_attr_dir(int fd, const char* userPath, bool traverseLeafLink) { KPath pathBuffer(B_PATH_NAME_LENGTH + 1); if (pathBuffer.InitCheck() != B_OK) @@ -9239,7 +9228,7 @@ _user_open_attr_dir(int fd, const char* userPath) return B_BAD_ADDRESS; } - return attr_dir_open(fd, userPath ? path : NULL, false); + return attr_dir_open(fd, userPath ? path : NULL, traverseLeafLink, false); } diff --git a/src/system/libroot/os/fs_attr.cpp b/src/system/libroot/os/fs_attr.cpp index 93a360cabd..7e906066fc 100644 --- a/src/system/libroot/os/fs_attr.cpp +++ b/src/system/libroot/os/fs_attr.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -21,11 +21,11 @@ static DIR * -open_attr_dir(int file, const char *path) +open_attr_dir(int file, const char *path, bool traverse) { DIR *dir; - int fd = _kern_open_attr_dir(file, path); + int fd = _kern_open_attr_dir(file, path, traverse); if (fd < 0) { errno = fd; return NULL; @@ -126,14 +126,20 @@ fs_close_attr(int fd) extern "C" DIR* fs_open_attr_dir(const char* path) { - return open_attr_dir(-1, path); + return open_attr_dir(-1, path, true); } +extern "C" DIR* +fs_lopen_attr_dir(const char* path) +{ + return open_attr_dir(-1, path, false); +} + extern "C" DIR* fs_fopen_attr_dir(int fd) { - return open_attr_dir(fd, NULL); + return open_attr_dir(fd, NULL, false); } From f1383bbf4d8d0eb598c3d504ab5e6a4f67d14624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 10 Aug 2011 23:22:55 +0000 Subject: [PATCH 169/702] * Fixed build; should have been part of r42620. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42621 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/storage/Node.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kits/storage/Node.cpp b/src/kits/storage/Node.cpp index 9021e04334..0def72e11b 100644 --- a/src/kits/storage/Node.cpp +++ b/src/kits/storage/Node.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Haiku Inc. + * Copyright 2002-2011, Haiku Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -814,7 +814,7 @@ status_t BNode::InitAttrDir() { if (fCStatus == B_OK && fAttrFd < 0) { - fAttrFd = _kern_open_attr_dir(fFd, NULL); + fAttrFd = _kern_open_attr_dir(fFd, NULL, false); if (fAttrFd < 0) return fAttrFd; From a8232073639c1688160fa76541136cd9f93b65de Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 11 Aug 2011 05:17:34 +0000 Subject: [PATCH 170/702] * add card instance to accelerant shared info * when TRACE_ATOM is enabled in bios.c, we dump each accelerant instance of the AtomBIOS rom to disk in /boot/common/cache/tmp/ (next to usb hid descriptors in the same file name format) * these images can be parsed with the AtomDis application git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42622 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 1 + src/add-ons/accelerants/radeon_hd/bios.cpp | 34 +++++++++++++++++++ src/add-ons/accelerants/radeon_hd/bios.h | 1 + .../drivers/graphics/radeon_hd/radeon_hd.cpp | 1 + 4 files changed, 37 insertions(+) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 979d44ae56..33c6634921 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -75,6 +75,7 @@ struct overlay_registers; struct radeon_shared_info { + uint32 device_index; // accelerant index uint32 device_id; // device pciid area_id mode_list_area; // area containing display mode list uint32 mode_count; diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 7a507cfee2..1c60c18e97 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -69,6 +69,10 @@ radeon_init_bios(uint8* bios) return B_ERROR; } + #ifdef TRACE_ATOM + radeon_dump_bios(); + #endif + struct card_info *atom_card_info = (card_info*)malloc(sizeof(card_info)); @@ -119,3 +123,33 @@ radeon_init_bios(uint8* bios) return B_OK; } + + +status_t +radeon_dump_bios() +{ + // For debugging use, dump card AtomBIOS + radeon_shared_info &info = *gInfo->shared_info; + + TRACE("%s: Dumping AtomBIOS as ATOM_DEBUG is set...\n", + __func__); + + FILE* fp; + char filename[255]; + sprintf(filename, "/boot/common/cache/tmp/radeon_hd_bios_1002_%" B_PRIx32 + "_%" B_PRIu32 ".bin", info.device_id, info.device_index); + + fp = fopen(filename, "wb"); + if (fp == NULL) { + TRACE("%s: Cannot create AtomBIOS blob at %s\n", __func__, filename); + return B_ERROR; + } + + fwrite(gInfo->rom, info.rom_size, 1, fp); + + fclose(fp); + + TRACE("%s: AtomBIOS dumped to %s\n", __func__, filename); + + return B_OK; +} diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index 7b9263dca9..f686de1425 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -15,6 +15,7 @@ status_t radeon_init_bios(uint8* bios); +status_t radeon_dump_bios(); #endif /* RADEON_HD_BIOS_H */ diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index b73f5089f1..e53d997317 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -375,6 +375,7 @@ radeon_hd_init(radeon_info &info) frambufferMapper.Detach(); // Pass common information to accelerant + info.shared_info->device_index = info.id; info.shared_info->device_id = info.device_id; info.shared_info->device_chipset = info.device_chipset; info.shared_info->registers_area = info.registers_area; From 425eff67d65263031010581ba0f332bceb56a9f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 11 Aug 2011 17:32:14 +0000 Subject: [PATCH 171/702] Locking around descriptors list handling isn't enough, locking is also needed when traversing the list: we instead lock the whole traversing/handling loop. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42623 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/usb/ehci.cpp | 64 +++++++++++--------------- 1 file changed, 27 insertions(+), 37 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index c0fec9e373..82a6f9a737 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -835,20 +835,16 @@ isochronous_transfer_data * EHCI::FindIsochronousTransfer(ehci_itd *itd) { // Simply check every last descriptor of the isochronous transfer list - if (LockIsochronous()) { - isochronous_transfer_data *transfer = fFirstIsochronousTransfer; - if (transfer) { - while (transfer->descriptors[transfer->last_to_process] - != itd) { - transfer = transfer->link; - if (!transfer) - break; - } + isochronous_transfer_data *transfer = fFirstIsochronousTransfer; + if (transfer) { + while (transfer->descriptors[transfer->last_to_process] + != itd) { + transfer = transfer->link; + if (!transfer) + break; } - UnlockIsochronous(); - return transfer; } - return NULL; + return transfer; } @@ -1690,6 +1686,9 @@ EHCI::FinishIsochronousTransfers() " at frame %ld\n", itd, itd->this_phy, itd->prev, itd->prev != NULL ? itd->prev->this_phy : 0, currentFrame); + if (!LockIsochronous()) + continue; + // Process the frame till it has isochronous descriptors in it. while (!(itd->next_phy & EHCI_ITEM_TERMINATE) && itd->prev != NULL) { TRACE("FinishIsochronousTransfers checking itd %p last_token" @@ -1720,25 +1719,22 @@ EHCI::FinishIsochronousTransfers() } // Remove the transfer - if (LockIsochronous()) { - if (transfer == fFirstIsochronousTransfer) { - fFirstIsochronousTransfer = transfer->link; - if (transfer == fLastIsochronousTransfer) - fLastIsochronousTransfer = NULL; - } else { - isochronous_transfer_data *temp - = fFirstIsochronousTransfer; - while (temp != NULL && transfer != temp->link) - temp = temp->link; + if (transfer == fFirstIsochronousTransfer) { + fFirstIsochronousTransfer = transfer->link; + if (transfer == fLastIsochronousTransfer) + fLastIsochronousTransfer = NULL; + } else { + isochronous_transfer_data *temp + = fFirstIsochronousTransfer; + while (temp != NULL && transfer != temp->link) + temp = temp->link; - if (transfer == fLastIsochronousTransfer) - fLastIsochronousTransfer = temp; - if (temp != NULL && temp->link != NULL) - temp->link = temp->link->link; - } - transfer->link = NULL; - UnlockIsochronous(); + if (transfer == fLastIsochronousTransfer) + fLastIsochronousTransfer = temp; + if (temp != NULL && temp->link != NULL) + temp->link = temp->link->link; } + transfer->link = NULL; transfer->transfer->Finished(B_OK, actualLength); @@ -1759,6 +1755,8 @@ EHCI::FinishIsochronousTransfers() itd = itd->prev; } + UnlockIsochronous(); + TRACE("FinishIsochronousTransfers next frame\n"); // Make sure to reset the frame bandwidth @@ -2243,7 +2241,6 @@ EHCI::LinkDescriptors(ehci_qtd *first, ehci_qtd *last, ehci_qtd *alt) void EHCI::LinkITDescriptors(ehci_itd *itd, ehci_itd **_last) { - LockIsochronous(); ehci_itd *last = *_last; itd->next_phy = last->next_phy; itd->next = NULL; @@ -2251,14 +2248,12 @@ EHCI::LinkITDescriptors(ehci_itd *itd, ehci_itd **_last) last->next = itd; last->next_phy = itd->this_phy; *_last = itd; - UnlockIsochronous(); } void EHCI::LinkSITDescriptors(ehci_sitd *sitd, ehci_sitd **_last) { - LockIsochronous(); ehci_sitd *last = *_last; sitd->next_phy = last->next_phy; sitd->next = NULL; @@ -2266,34 +2261,29 @@ EHCI::LinkSITDescriptors(ehci_sitd *sitd, ehci_sitd **_last) last->next = sitd; last->next_phy = sitd->this_phy; *_last = sitd; - UnlockIsochronous(); } void EHCI::UnlinkITDescriptors(ehci_itd *itd, ehci_itd **last) { - LockIsochronous(); itd->prev->next_phy = itd->next_phy; itd->prev->next = itd->next; if (itd->next != NULL) itd->next->prev = itd->prev; if (itd == *last) *last = itd->prev; - UnlockIsochronous(); } void EHCI::UnlinkSITDescriptors(ehci_sitd *sitd, ehci_sitd **last) { - LockIsochronous(); sitd->prev->next_phy = sitd->next_phy; sitd->prev->next = sitd->next; if (sitd->next != NULL) sitd->next->prev = sitd->prev; if (sitd == *last) *last = sitd->prev; - UnlockIsochronous(); } From 5cdfd17b4b661a52301f2b480169f711c539e99a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 12 Aug 2011 01:00:34 +0000 Subject: [PATCH 172/702] * backport some additional linux atom parser fixes * backport fixes to ATOM_IIO_MOVE_ register offsets * small bit of style correction git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42624 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 811daf46fa..2937f21f44 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -111,6 +111,7 @@ atom_iio_execute(atom_context *ctx, int base, uint32 index, uint32 data) base += 3; break; case ATOM_IIO_WRITE: + (void)ctx->card->reg_read(CU16(base + 1)); ctx->card->ioreg_write(CU16(base + 1), temp); base += 3; break; @@ -123,19 +124,19 @@ atom_iio_execute(atom_context *ctx, int base, uint32 index, uint32 data) base += 3; break; case ATOM_IIO_MOVE_INDEX: - temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); temp |= ((index >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); base += 4; break; case ATOM_IIO_MOVE_DATA: - temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); temp |= ((data >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); base += 4; break; case ATOM_IIO_MOVE_ATTR: - temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); temp |= ((ctx->io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); base += 4; @@ -190,7 +191,7 @@ atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, case ATOM_ARG_PS: idx = U8(*ptr); (*ptr)++; - val = ctx->ps[idx]; + val = B_LENDIAN_TO_HOST_INT32(ctx->ps[idx]); // TODO : val = get_unaligned_le32((u32 *)&ctx->ps[idx]); break; case ATOM_ARG_WS: @@ -237,7 +238,7 @@ atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, idx = U8(*ptr); (*ptr)++; val = gctx->scratch[((gctx->fb_base + idx) / 4)]; - return 0; + break; case ATOM_ARG_IMM: switch(align) { case ATOM_SRC_DWORD: @@ -455,7 +456,7 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, idx = U8(*ptr); (*ptr)++; gctx->scratch[((gctx->fb_base + idx) / 4)] = val; - return; + break; case ATOM_ARG_PLL: idx = U8(*ptr); (*ptr)++; @@ -1332,7 +1333,7 @@ atom_allocate_fb_scratch(atom_context *ctx) if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset) == B_OK) { firmware = (_ATOM_VRAM_USAGE_BY_FIRMWARE *) - ((uint16*)ctx->bios + data_offset); + ((uint16*)ctx->bios + data_offset); TRACE("Atom firmware requested 0x%" B_PRIX32 " %" B_PRIu16 "kb\n", firmware->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware, From 7a2bb2b04c6c0bc7d5c1d93095e443185dd53524 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 12 Aug 2011 02:04:32 +0000 Subject: [PATCH 173/702] * backport a missed endian change * clean up some tabs and spaces git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42625 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 109 ++++++++++-------- 1 file changed, 60 insertions(+), 49 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 2937f21f44..be056a3a38 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -103,49 +103,49 @@ atom_iio_execute(atom_context *ctx, int base, uint32 index, uint32 data) uint32 temp = 0xCDCDCDCD; while (1) switch(CU8(base)) { - case ATOM_IIO_NOP: - base++; - break; - case ATOM_IIO_READ: - temp = ctx->card->ioreg_read(CU16(base + 1)); - base += 3; - break; - case ATOM_IIO_WRITE: - (void)ctx->card->reg_read(CU16(base + 1)); - ctx->card->ioreg_write(CU16(base + 1), temp); - base += 3; - break; - case ATOM_IIO_CLEAR: - temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); - base += 3; - break; - case ATOM_IIO_SET: - temp |= (0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2); - base += 3; - break; - case ATOM_IIO_MOVE_INDEX: - temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); - temp |= ((index >> CU8(base + 2)) - & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); - base += 4; - break; - case ATOM_IIO_MOVE_DATA: - temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); - temp |= ((data >> CU8(base + 2)) - & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); - base += 4; - break; - case ATOM_IIO_MOVE_ATTR: - temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); - temp |= ((ctx->io_attr >> CU8(base + 2)) - & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); - base += 4; - break; - case ATOM_IIO_END: - return temp; - default: - TRACE("%s: Unknown IIO opcode.\n", __func__); - return 0; + case ATOM_IIO_NOP: + base++; + break; + case ATOM_IIO_READ: + temp = ctx->card->ioreg_read(CU16(base + 1)); + base += 3; + break; + case ATOM_IIO_WRITE: + (void)ctx->card->reg_read(CU16(base + 1)); + ctx->card->ioreg_write(CU16(base + 1), temp); + base += 3; + break; + case ATOM_IIO_CLEAR: + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2)); + base += 3; + break; + case ATOM_IIO_SET: + temp |= (0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 2); + base += 3; + break; + case ATOM_IIO_MOVE_INDEX: + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); + temp |= ((index >> CU8(base + 2)) + & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); + base += 4; + break; + case ATOM_IIO_MOVE_DATA: + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); + temp |= ((data >> CU8(base + 2)) + & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); + base += 4; + break; + case ATOM_IIO_MOVE_ATTR: + temp &= ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base + 3)); + temp |= ((ctx->io_attr >> CU8(base + 2)) + & (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 3); + base += 4; + break; + case ATOM_IIO_END: + return temp; + default: + TRACE("%s: Unknown IIO opcode.\n", __func__); + return 0; } } @@ -389,7 +389,7 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, switch(gctx->io_mode) { case ATOM_IO_MM: if (idx == 0) - gctx->card->reg_write(idx, val<<2); + gctx->card->reg_write(idx, val << 2); else gctx->card->reg_write(idx, val); break; @@ -402,11 +402,11 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, __func__); return; default: - if (!(gctx->io_mode&0x80)) { + if (!(gctx->io_mode & 0x80)) { TRACE("%s: Bad IO mode.\n", __func__); return; } - if (!gctx->iio[gctx->io_mode&0xFF]) { + if (!gctx->iio[gctx->io_mode & 0xFF]) { TRACE("%s: Undefined indirect IO write method %d\n", __func__, gctx->io_mode & 0x7F); return; @@ -1243,7 +1243,18 @@ atom_parse(card_info *card, void *bios) while (*str && ((*str == '\n') || (*str == '\r'))) str++; - TRACE("ATOM BIOS: %s", str); + int i; + char name[512]; + // Terminate bios string if not 0 terminated + for (i = 0; i < 511; i++) { + name[i] = str[i]; + if (name[i] < '.' || name[i] > 'z') { + name[i] = 0; + break; + } + } + + TRACE("ATOM BIOS: %s", name); return ctx; } @@ -1256,8 +1267,8 @@ atom_asic_init(atom_context *ctx) uint32 ps[16]; memset(ps, 0, 64); - ps[0] = CU32(hwi + ATOM_FWI_DEFSCLK_PTR); - ps[1] = CU32(hwi + ATOM_FWI_DEFMCLK_PTR); + ps[0] = B_HOST_TO_LENDIAN_INT32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR)); + ps[1] = B_HOST_TO_LENDIAN_INT32(CU32(hwi + ATOM_FWI_DEFMCLK_PTR)); if (!ps[0] || !ps[1]) return B_ERROR; From 10751cadb895d644fd868a5abd1b3d65fbd14c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 12 Aug 2011 19:47:07 +0000 Subject: [PATCH 174/702] * Applied patch from luroh as part of #7433 -- sorry for the long delay! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42626 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tools/fs_shell/fuse.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tools/fs_shell/fuse.cpp b/src/tools/fs_shell/fuse.cpp index e80798e3ad..e9b09f8c1f 100644 --- a/src/tools/fs_shell/fuse.cpp +++ b/src/tools/fs_shell/fuse.cpp @@ -602,6 +602,9 @@ main(int argc, char* argv[]) if (fuse_opt_parse(&fuseArgs, &config, fsOptions, process_options) < 0) return 1; + if (!config.mntPoint) + print_usage_and_exit(fuseArgs.argv[0]); + if (!modules[0]) { fprintf(stderr, "Error: Couldn't find FS module!\n"); return 1; From 8998c3201dd5edd796e9c651b499de5b9e29e390 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Fri, 12 Aug 2011 23:40:50 +0000 Subject: [PATCH 175/702] Added the Be Sample Code License. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42627 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../data/licenses/Be Sample Code License | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 data/system/data/licenses/Be Sample Code License diff --git a/data/system/data/licenses/Be Sample Code License b/data/system/data/licenses/Be Sample Code License new file mode 100644 index 0000000000..86a4268fa9 --- /dev/null +++ b/data/system/data/licenses/Be Sample Code License @@ -0,0 +1,31 @@ +---------------------- +Be Sample Code License +---------------------- + +Copyright 1991-1999, Be Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From d98662a8a7614172b7daed98b1d497fc23663598 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sat, 13 Aug 2011 01:53:39 +0000 Subject: [PATCH 176/702] Automatic whitespace cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42628 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalPackages | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 3ba751acce..560d2fbc88 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -114,12 +114,12 @@ if [ IsOptionalHaikuImagePackageAdded APR ] { if $(TARGET_ARCH) != x86 { Echo "No optional package APR available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage apr-1.4.5-x86-gcc4-2011-08-03.zip : $(baseURL)/apr-1.4.5-x86-gcc4-2011-08-03.zip : : true ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage apr-1.4.5-x86-gcc2-2011-08-02.zip : $(baseURL)/apr-1.4.5-x86-gcc2-2011-08-02.zip : : true ; @@ -132,12 +132,12 @@ if [ IsOptionalHaikuImagePackageAdded APR-util ] { if $(TARGET_ARCH) != x86 { Echo "No optional package APR-util available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage apr-util-1.3.12-x86-gcc4-2011-08-03.zip : $(baseURL)/apr-util-1.3.12-x86-gcc4-2011-08-03.zip : : true ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage apr-util-1.3.12-x86-gcc2-2011-08-02.zip : $(baseURL)/apr-util-1.3.12-x86-gcc2-2011-08-02.zip : : true ; @@ -152,7 +152,7 @@ if [ IsOptionalHaikuImagePackageAdded ArmyKnife ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4 && ! $(isHybridBuild) { Echo "No optional package ArmyKnife for gcc4" ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage armyknife-63-r1a3-x86-gcc2-2011-06-04.zip : $(baseURL)/armyknife-63-r1a3-x86-gcc2-2011-06-04.zip ; AddSymlinkToHaikuImage home config be Applications @@ -181,7 +181,7 @@ if [ IsOptionalHaikuImagePackageAdded BeAE ] { Echo "No optional package BeAE available for $(TARGET_ARCH)" ; } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage beae-22-r1a3-x86-gcc4-2011-05-24.zip : $(baseURL)/beae-22-r1a3-x86-gcc4-2011-05-24.zip ; } else { @@ -785,7 +785,7 @@ if [ IsOptionalHaikuImagePackageAdded friss ] { Echo "No optional package friss available for $(TARGET_ARCH)" ; } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage friss-24-r1a3-x86-gcc4-2011-05-31.zip : $(baseURL)/friss-24-r1a3-x86-gcc4-2011-05-31.zip ; } else { @@ -1005,11 +1005,11 @@ if [ IsOptionalHaikuImagePackageAdded Libmng ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Libmng available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage libmng-1.0.10-r1a3-x86-gcc4-2011-05-24.zip : $(baseURL)/lib/libmng-1.0.10-r1a3-x86-gcc4-2011-05-24.zip ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage libmng-1.0.10-r1a3-x86-gcc2-2011-05-18.zip : $(baseURL)/lib/libmng-1.0.10-r1a3-x86-gcc2-2011-05-18.zip ; } @@ -1041,7 +1041,7 @@ if [ IsOptionalHaikuImagePackageAdded LibXSLT ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage libxslt-1.1.26-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/libxslt-1.1.26-r1a3-x86-gcc4-2011-05-24.zip ; + : $(baseURL)/libxslt-1.1.26-r1a3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage libxslt-1.1.26-r1a3-x86-gcc2-2011-05-18.zip @@ -1093,7 +1093,7 @@ if [ IsOptionalHaikuImagePackageAdded Man ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage man-1.6f-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/man-1.6f-r1a3-x86-gcc4-2011-05-24.zip ; + : $(baseURL)/man-1.6f-r1a3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage man-1.6f-r1a3-x86-gcc2-2011-05-18.zip @@ -1200,7 +1200,7 @@ if [ IsOptionalHaikuImagePackageAdded NetSurf ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4 && ! $(isHybridBuild) { Echo "No optional package NetSurf available for gcc4" ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage netsurf-2.7-r1a3-x86-gcc2-2011-06-04.zip : $(baseURL)/netsurf-2.7-r1a3-x86-gcc2-2011-06-04.zip ; AddSymlinkToHaikuImage home config be Applications @@ -1309,11 +1309,11 @@ if [ IsOptionalHaikuImagePackageAdded Paladin ] { Echo "No optional package Paladin available for $(TARGET_ARCH)" ; } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage paladin-1.3-r1a3-x86-gcc4-2011-05-24.zip : $(baseURL)/paladin-1.3-r1a3-x86-gcc4-2011-05-24.zip ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage paladin-1.3-r1a3-x86-gcc2-2011-05-18.zip : $(baseURL)/paladin-1.3-r1a3-x86-gcc2-2011-05-18.zip ; } @@ -1332,7 +1332,7 @@ if [ IsOptionalHaikuImagePackageAdded PCRE ] { Echo "No optional package PCRE available for $(TARGET_ARCH)" ; } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage libpcre-8.12-r1a3-x86-gcc4-2011-05-24.zip : $(baseURL)/libpcre-8.12-r1a3-x86-gcc4-2011-05-24.zip ; } else { @@ -1503,7 +1503,7 @@ if [ IsOptionalHaikuImagePackageAdded TagLib ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage taglib-1.6.3-r1r3-x86-gcc4-2011-05-24.zip - : $(baseURL)/taglib-1.6.3-r1r3-x86-gcc4-2011-05-24.zip ; + : $(baseURL)/taglib-1.6.3-r1r3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage taglib-1.6.3-r1a3-x86-gcc2-2011-05-20.zip @@ -1650,7 +1650,7 @@ if [ IsOptionalHaikuImagePackageAdded Vision ] { InstallOptionalHaikuImagePackage vision-908-r1a3-x86-gcc4-2011-06-07.zip : $(baseURL)/vision-908-r1a3-x86-gcc4-2011-06-07.zip ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage vision-908-r1a3-x86-gcc2-2011-06-07.zip : $(baseURL)/vision-908-r1a3-x86-gcc2-2011-06-07.zip ; } From 5c6260dc232fcb2d4d5d1103c1623dba9663b753 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sat, 13 Aug 2011 02:31:02 +0000 Subject: [PATCH 177/702] Minor cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42629 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/bin/install-wifi-firmwares.sh | 2 +- data/bin/installoptionalpackage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/bin/install-wifi-firmwares.sh b/data/bin/install-wifi-firmwares.sh index e02de1bc1c..db40e771d1 100755 --- a/data/bin/install-wifi-firmwares.sh +++ b/data/bin/install-wifi-firmwares.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2010 Haiku Inc. All rights reserved. +# Copyright (c) 2010 Haiku, Inc. # Distributed under the terms of the MIT License. # # Authors: diff --git a/data/bin/installoptionalpackage b/data/bin/installoptionalpackage index db6e5a6bb3..e2ac6a5262 100755 --- a/data/bin/installoptionalpackage +++ b/data/bin/installoptionalpackage @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2009-2010 Haiku Inc. All rights reserved. +# Copyright (c) 2009-2010 Haiku, Inc. # Distributed under the terms of the MIT License. # # Authors: From 5b9c0414deae013c958bd2a00b6ef1a4fcba805d Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sat, 13 Aug 2011 02:34:16 +0000 Subject: [PATCH 178/702] Added two scripts, which attempt to load the appropriate localized docs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42630 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 8 ++++++++ build/jam/OptionalPackages | 4 ---- data/bin/userguide | 16 ++++++++++++++++ data/bin/welcome | 16 ++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100755 data/bin/userguide create mode 100755 data/bin/welcome diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 081ce99546..1e22fcc013 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -331,6 +331,14 @@ SEARCH on installoptionalpackage = [ FDirName $(HAIKU_TOP) data bin ] ; AddFilesToHaikuImage system bin : installoptionalpackage ; SEARCH on install-wifi-firmwares.sh = [ FDirName $(HAIKU_TOP) data bin ] ; AddFilesToHaikuImage system bin : install-wifi-firmwares.sh ; +SEARCH on welcome = [ FDirName $(HAIKU_TOP) data bin ] ; +AddFilesToHaikuImage system bin : welcome ; +AddSymlinkToHaikuImage home Desktop + : /boot/system/bin/welcome : Welcome ; +SEARCH on userguide = [ FDirName $(HAIKU_TOP) data bin ] ; +AddFilesToHaikuImage system bin : userguide ; +AddSymlinkToHaikuImage home Desktop + : /boot/system/bin/userguide : User\ Guide ; # Add the files to be used by installoptionalpackage. AddDirectoryToHaikuImage common data optional-packages ; diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 560d2fbc88..c14550b84f 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -1684,10 +1684,6 @@ if [ IsOptionalHaikuImagePackageAdded Welcome ] { CopyDirectoryToHaikuImage system documentation : [ FDirName $(HAIKU_TOP) docs userguide ] : userguide : -x .svn ; - AddSymlinkToHaikuImage home Desktop - : /boot/system/documentation/welcome/welcome_en.html : Welcome ; - AddSymlinkToHaikuImage home Desktop - : /boot/system/documentation/userguide/en/contents.html : User\ Guide ; } diff --git a/data/bin/userguide b/data/bin/userguide new file mode 100755 index 0000000000..a0ef1d2977 --- /dev/null +++ b/data/bin/userguide @@ -0,0 +1,16 @@ +#!/bin/bash + +userGuideURL="\ + http://svn.haiku-os.org/haiku/haiku/trunk/docs/userguide/en/contents.html" +userGuideDir=/boot/system/documentation/userguide/ +userGuide=$userGuideDir/en/contents.html +localizedUserGuide=$userGuideDir/"$LANG"/contents.html + +if [ -f $localizedUserGuide ]; then + open file://$localizedUserGuide +elif [ -f $userGuide ]; then + open $userGuide +else + open $userGuideURL +fi + diff --git a/data/bin/welcome b/data/bin/welcome new file mode 100755 index 0000000000..e259f089cb --- /dev/null +++ b/data/bin/welcome @@ -0,0 +1,16 @@ +#!/bin/bash + +welcomeURL="\ + http://svn.haiku-os.org/haiku/haiku/trunk/docs/welcome/welcome_en.html" +welcomeDir=/boot/system/documentation/welcome/ +welcomeFile=$welcomeDir/welcome_en.html +localizedWelcomeFile=$welcomeDir/welcome_"$LANG".html + +if [ -f $localizedWelcomeFile ]; then + open file://$localizedWelcomeFile +elif [ -f $welcomeFile ]; then + open $welcomeFile +else + open $welcomeURL +fi + From 0e400be555c03be3ed8ef4e99f4c18afc2c771da Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sat, 13 Aug 2011 03:07:25 +0000 Subject: [PATCH 179/702] Added the license file for Cortex, from docs/apps/cortex/license.html git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42631 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/system/data/licenses/Cortex | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 data/system/data/licenses/Cortex diff --git a/data/system/data/licenses/Cortex b/data/system/data/licenses/Cortex new file mode 100644 index 0000000000..a088232fab --- /dev/null +++ b/data/system/data/licenses/Cortex @@ -0,0 +1,27 @@ +Copyright (c) 1999-2000, Eric Moon. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file From f33cf3fd44d0877037b3cf8f82c2b40f4189bf28 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sat, 13 Aug 2011 22:59:47 +0000 Subject: [PATCH 180/702] Activating all windows in a stack caused flickering. The reason to activate all windows was to get all windows form a stack into the upper window layers, otherwise it was possible that the top layer stack window is activated but another window in the stack is at the bottommost layer position. Sending this window to the back does not triggered sending the complete stack to the back. The send behind call is now redirected to the top most stack window to ensure the stack is send behind. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42632 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 41 +++++++++++-------- src/servers/app/Desktop.h | 6 +-- src/servers/app/stackandtile/StackAndTile.cpp | 16 -------- 3 files changed, 27 insertions(+), 36 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index d1cef6acb4..0f6080eb19 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1036,21 +1036,11 @@ Desktop::SelectWindow(Window* window) of their subset. */ void -Desktop::ActivateWindow(Window* window, bool activateStack) +Desktop::ActivateWindow(Window* window) { STRACE(("ActivateWindow(%p, %s)\n", window, window ? window->Title() : "")); - WindowStack* stack = window->GetWindowStack(); - if (activateStack && stack != NULL) { - for (int32 i = 0; i < stack->CountWindows(); i++) { - Window* win = stack->LayerOrder().ItemAt(i); - if (window == win) - continue; - ActivateWindow(win, false); - } - } - if (window == NULL) { fBack = NULL; fFront = NULL; @@ -1164,11 +1154,16 @@ Desktop::ActivateWindow(Window* window, bool activateStack) void -Desktop::SendWindowBehind(Window* window, Window* behindOf) +Desktop::SendWindowBehind(Window* window, Window* behindOf, bool sendStack) { if (!LockAllWindows()) return; + Window* orgWindow = window; + WindowStack* stack = window->GetWindowStack(); + if (sendStack && stack != NULL) + window = stack->TopLayerWindow(); + // TODO: should the "not in current workspace" be handled anyway? // (the code below would have to be changed then, though) if (window == BackWindow() @@ -1195,10 +1190,13 @@ Desktop::SendWindowBehind(Window* window, Window* behindOf) BRegion dummy; _RebuildClippingForAllWindows(dummy); - // mark everything dirty that is no longer visible - BRegion clean(window->VisibleRegion()); - dirty.Exclude(&clean); - MarkDirty(dirty); + // only redraw the top layer window to avoid flicker + if (sendStack) { + // mark everything dirty that is no longer visible + BRegion clean(window->VisibleRegion()); + dirty.Exclude(&clean); + MarkDirty(dirty); + } _UpdateFronts(); if (fSettings->MouseMode() == B_FOCUS_FOLLOWS_MOUSE) @@ -1212,7 +1210,16 @@ Desktop::SendWindowBehind(Window* window, Window* behindOf) _WindowChanged(window); - NotifyWindowSentBehind(window, behindOf); + if (sendStack && stack != NULL) { + for (int32 i = 0; i < stack->CountWindows(); i++) { + Window* stackWindow = stack->LayerOrder().ItemAt(i); + if (stackWindow == window) + continue; + SendWindowBehind(stackWindow, behindOf, false); + } + } + + NotifyWindowSentBehind(orgWindow, behindOf); UnlockAllWindows(); diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index 477b03b987..daa6f78c4b 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -160,10 +160,10 @@ public: // Window methods void SelectWindow(Window* window); - void ActivateWindow(Window* window, - bool activateStack = true); + void ActivateWindow(Window* window); void SendWindowBehind(Window* window, - Window* behindOf = NULL); + Window* behindOf = NULL, + bool sendStack = true); void ShowWindow(Window* window); void HideWindow(Window* window, diff --git a/src/servers/app/stackandtile/StackAndTile.cpp b/src/servers/app/stackandtile/StackAndTile.cpp index acbacd7268..6bf2963963 100644 --- a/src/servers/app/stackandtile/StackAndTile.cpp +++ b/src/servers/app/stackandtile/StackAndTile.cpp @@ -308,22 +308,6 @@ StackAndTile::WindowActitvated(Window* window) void StackAndTile::WindowSentBehind(Window* window, Window* behindOf) { - SATWindow* satWindow = GetSATWindow(window); - if (satWindow == NULL) - return; - SATGroup* group = satWindow->GetGroup(); - if (group == NULL) - return; - Desktop* desktop = satWindow->GetWindow()->Desktop(); - if (desktop == NULL) - return; - - WindowIterator iter(group, true); - for (SATWindow* listWindow = iter.NextWindow(); listWindow != NULL; - listWindow = iter.NextWindow()) { - if (listWindow != satWindow) - desktop->SendWindowBehind(listWindow->GetWindow(), behindOf); - } } From 50f2c19dfbfe1dee69d106c1d1ebe4e3a46886a1 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sun, 14 Aug 2011 17:35:41 +0000 Subject: [PATCH 181/702] Remove Cortex license file. It is equal to the BSD (3-clause) license and AboutSystem lists it as such. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42633 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/system/data/licenses/Cortex | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 data/system/data/licenses/Cortex diff --git a/data/system/data/licenses/Cortex b/data/system/data/licenses/Cortex deleted file mode 100644 index a088232fab..0000000000 --- a/data/system/data/licenses/Cortex +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 1999-2000, Eric Moon. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions, and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file From c284bb0ff659027e777dbbb8eae4fb3cf1cb335f Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sun, 14 Aug 2011 17:45:05 +0000 Subject: [PATCH 182/702] Moved Cortex license file into each of its source files. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42634 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/cortex/AddOnHost/AddOnHostApp.cpp | 31 +++++++++++++++++++ src/apps/cortex/AddOnHost/AddOnHostApp.h | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramBox.cpp | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramBox.h | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramDefs.h | 31 +++++++++++++++++++ .../cortex/DiagramView/DiagramEndPoint.cpp | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramEndPoint.h | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramItem.cpp | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramItem.h | 31 +++++++++++++++++++ .../cortex/DiagramView/DiagramItemGroup.cpp | 31 +++++++++++++++++++ .../cortex/DiagramView/DiagramItemGroup.h | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramView.cpp | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramView.h | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramWire.cpp | 31 +++++++++++++++++++ src/apps/cortex/DiagramView/DiagramWire.h | 31 +++++++++++++++++++ .../DormantNodeView/DormantNodeListItem.cpp | 31 +++++++++++++++++++ .../DormantNodeView/DormantNodeListItem.h | 31 +++++++++++++++++++ .../DormantNodeView/DormantNodeView.cpp | 31 +++++++++++++++++++ .../cortex/DormantNodeView/DormantNodeView.h | 31 +++++++++++++++++++ .../DormantNodeView/DormantNodeWindow.cpp | 31 +++++++++++++++++++ .../DormantNodeView/DormantNodeWindow.h | 31 +++++++++++++++++++ src/apps/cortex/InfoView/AppNodeInfoView.cpp | 31 +++++++++++++++++++ src/apps/cortex/InfoView/AppNodeInfoView.h | 31 +++++++++++++++++++ .../cortex/InfoView/ConnectionInfoView.cpp | 31 +++++++++++++++++++ src/apps/cortex/InfoView/ConnectionInfoView.h | 31 +++++++++++++++++++ .../cortex/InfoView/DormantNodeInfoView.cpp | 31 +++++++++++++++++++ .../cortex/InfoView/DormantNodeInfoView.h | 31 +++++++++++++++++++ src/apps/cortex/InfoView/EndPointInfoView.cpp | 31 +++++++++++++++++++ src/apps/cortex/InfoView/EndPointInfoView.h | 31 +++++++++++++++++++ src/apps/cortex/InfoView/FileNodeInfoView.cpp | 31 +++++++++++++++++++ src/apps/cortex/InfoView/FileNodeInfoView.h | 31 +++++++++++++++++++ src/apps/cortex/InfoView/InfoView.cpp | 31 +++++++++++++++++++ src/apps/cortex/InfoView/InfoView.h | 31 +++++++++++++++++++ src/apps/cortex/InfoView/InfoWindow.cpp | 31 +++++++++++++++++++ src/apps/cortex/InfoView/InfoWindow.h | 31 +++++++++++++++++++ .../cortex/InfoView/InfoWindowManager.cpp | 31 +++++++++++++++++++ src/apps/cortex/InfoView/InfoWindowManager.h | 31 +++++++++++++++++++ src/apps/cortex/InfoView/LiveNodeInfoView.cpp | 31 +++++++++++++++++++ src/apps/cortex/InfoView/LiveNodeInfoView.h | 31 +++++++++++++++++++ src/apps/cortex/LICENSE.Cortex | 27 ---------------- .../cortex/MediaRoutingView/MediaJack.cpp | 31 +++++++++++++++++++ src/apps/cortex/MediaRoutingView/MediaJack.h | 31 +++++++++++++++++++ .../MediaRoutingView/MediaNodePanel.cpp | 31 +++++++++++++++++++ .../cortex/MediaRoutingView/MediaNodePanel.h | 31 +++++++++++++++++++ .../MediaRoutingView/MediaRoutingDefs.h | 31 +++++++++++++++++++ .../MediaRoutingView/MediaRoutingView.cpp | 31 +++++++++++++++++++ .../MediaRoutingView/MediaRoutingView.h | 31 +++++++++++++++++++ .../cortex/MediaRoutingView/MediaWire.cpp | 31 +++++++++++++++++++ src/apps/cortex/MediaRoutingView/MediaWire.h | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/AddOnHost.cpp | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/AddOnHost.h | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/Connection.cpp | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/Connection.h | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/NodeGroup.cpp | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/NodeGroup.h | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/NodeManager.cpp | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/NodeManager.h | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/NodeRef.cpp | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/NodeRef.h | 31 +++++++++++++++++++ .../cortex/NodeManager/NodeSyncThread.cpp | 31 +++++++++++++++++++ src/apps/cortex/NodeManager/NodeSyncThread.h | 31 +++++++++++++++++++ .../cortex/NodeManager/node_manager_impl.h | 31 +++++++++++++++++++ .../ParameterView/ParameterContainerView.cpp | 31 +++++++++++++++++++ .../ParameterView/ParameterContainerView.h | 31 +++++++++++++++++++ .../cortex/ParameterView/ParameterWindow.cpp | 31 +++++++++++++++++++ .../cortex/ParameterView/ParameterWindow.h | 31 +++++++++++++++++++ .../ParameterView/ParameterWindowManager.cpp | 31 +++++++++++++++++++ .../ParameterView/ParameterWindowManager.h | 31 +++++++++++++++++++ src/apps/cortex/Persistence/ExportContext.cpp | 31 +++++++++++++++++++ src/apps/cortex/Persistence/ExportContext.h | 31 +++++++++++++++++++ src/apps/cortex/Persistence/IPersistent.h | 31 +++++++++++++++++++ .../cortex/Persistence/IStateArchivable.h | 31 +++++++++++++++++++ src/apps/cortex/Persistence/ImportContext.cpp | 31 +++++++++++++++++++ src/apps/cortex/Persistence/ImportContext.h | 31 +++++++++++++++++++ src/apps/cortex/Persistence/Importer.cpp | 31 +++++++++++++++++++ src/apps/cortex/Persistence/Importer.h | 31 +++++++++++++++++++ src/apps/cortex/Persistence/StringContent.cpp | 31 +++++++++++++++++++ src/apps/cortex/Persistence/StringContent.h | 31 +++++++++++++++++++ .../Persistence/Wrappers/FlatMessageIO.cpp | 31 +++++++++++++++++++ .../Persistence/Wrappers/FlatMessageIO.h | 31 +++++++++++++++++++ .../Persistence/Wrappers/MediaFormatIO.cpp | 31 +++++++++++++++++++ .../Persistence/Wrappers/MediaFormatIO.h | 31 +++++++++++++++++++ .../cortex/Persistence/Wrappers/MessageIO.cpp | 31 +++++++++++++++++++ .../cortex/Persistence/Wrappers/MessageIO.h | 31 +++++++++++++++++++ src/apps/cortex/Persistence/XML.cpp | 31 +++++++++++++++++++ src/apps/cortex/Persistence/XML.h | 31 +++++++++++++++++++ .../cortex/Persistence/XMLElementMapping.h | 31 +++++++++++++++++++ .../cortex/Persistence/xml_export_utils.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/ConnectionIO.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/ConnectionIO.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/DormantNodeIO.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/DormantNodeIO.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/LiveNodeIO.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/LiveNodeIO.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/NodeExportContext.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/NodeKey.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/NodeKey.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/NodeSetIOContext.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/NodeSetIOContext.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/RouteApp.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/RouteApp.h | 31 +++++++++++++++++++ .../cortex/RouteApp/RouteAppNodeManager.cpp | 31 +++++++++++++++++++ .../cortex/RouteApp/RouteAppNodeManager.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/RouteWindow.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/RouteWindow.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/StatusView.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/StatusView.h | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/route_app_io.cpp | 31 +++++++++++++++++++ src/apps/cortex/RouteApp/route_app_io.h | 31 +++++++++++++++++++ src/apps/cortex/TipManager/TipManager.cpp | 31 +++++++++++++++++++ src/apps/cortex/TipManager/TipManager.h | 31 +++++++++++++++++++ src/apps/cortex/TipManager/TipManagerImpl.cpp | 31 +++++++++++++++++++ src/apps/cortex/TipManager/TipManagerImpl.h | 31 +++++++++++++++++++ src/apps/cortex/TipManager/TipView.cpp | 31 +++++++++++++++++++ src/apps/cortex/TipManager/TipView.h | 31 +++++++++++++++++++ src/apps/cortex/TipManager/TipWindow.cpp | 31 +++++++++++++++++++ src/apps/cortex/TipManager/TipWindow.h | 31 +++++++++++++++++++ .../cortex/TransportView/TransportView.cpp | 31 +++++++++++++++++++ src/apps/cortex/TransportView/TransportView.h | 31 +++++++++++++++++++ .../cortex/TransportView/TransportWindow.cpp | 31 +++++++++++++++++++ .../cortex/TransportView/TransportWindow.h | 31 +++++++++++++++++++ .../cortex/ValControl/NumericValControl.cpp | 31 +++++++++++++++++++ .../cortex/ValControl/NumericValControl.h | 31 +++++++++++++++++++ src/apps/cortex/ValControl/StringValControl.h | 31 +++++++++++++++++++ src/apps/cortex/ValControl/ValControl.cpp | 31 +++++++++++++++++++ src/apps/cortex/ValControl/ValControl.h | 31 +++++++++++++++++++ .../ValControl/ValControlDigitSegment.cpp | 31 +++++++++++++++++++ .../ValControl/ValControlDigitSegment.h | 31 +++++++++++++++++++ .../cortex/ValControl/ValControlSegment.cpp | 31 +++++++++++++++++++ .../cortex/ValControl/ValControlSegment.h | 31 +++++++++++++++++++ .../cortex/ValControl/ValCtrlLayoutEntry.cpp | 31 +++++++++++++++++++ .../cortex/ValControl/ValCtrlLayoutEntry.h | 31 +++++++++++++++++++ .../addons/AudioAdapter/AudioAdapterAddOn.cpp | 31 +++++++++++++++++++ .../addons/AudioAdapter/AudioAdapterAddOn.h | 31 +++++++++++++++++++ .../addons/AudioAdapter/AudioAdapterNode.cpp | 31 +++++++++++++++++++ .../addons/AudioAdapter/AudioAdapterNode.h | 31 +++++++++++++++++++ .../AudioAdapter/AudioAdapterParams.cpp | 31 +++++++++++++++++++ .../addons/AudioAdapter/AudioAdapterParams.h | 31 +++++++++++++++++++ .../cortex/addons/Flanger/FlangerAddOn.cpp | 31 +++++++++++++++++++ src/apps/cortex/addons/Flanger/FlangerAddOn.h | 31 +++++++++++++++++++ src/apps/cortex/addons/Flanger/FlangerApp.cpp | 31 +++++++++++++++++++ .../cortex/addons/Flanger/FlangerNode.cpp | 31 +++++++++++++++++++ src/apps/cortex/addons/Flanger/FlangerNode.h | 31 +++++++++++++++++++ .../addons/LoggingConsumer/LogWriter.cpp | 31 +++++++++++++++++++ .../cortex/addons/LoggingConsumer/LogWriter.h | 31 +++++++++++++++++++ .../LoggingConsumer/LoggingConsumer.cpp | 31 +++++++++++++++++++ .../addons/LoggingConsumer/LoggingConsumer.h | 31 +++++++++++++++++++ .../LoggingConsumer/LoggingConsumerAddOn.cpp | 31 +++++++++++++++++++ .../LoggingConsumer/LoggingConsumerAddOn.h | 31 +++++++++++++++++++ .../LoggingConsumer/LoggingConsumerApp.cpp | 31 +++++++++++++++++++ .../addons/LoggingConsumer/NodeHarnessApp.cpp | 31 +++++++++++++++++++ .../addons/LoggingConsumer/NodeHarnessApp.h | 31 +++++++++++++++++++ .../addons/LoggingConsumer/NodeHarnessWin.cpp | 31 +++++++++++++++++++ .../addons/LoggingConsumer/NodeHarnessWin.h | 31 +++++++++++++++++++ .../addons/NullFilter/NullFilterAddOn.cpp | 31 +++++++++++++++++++ .../addons/NullFilter/NullFilterAddOn.h | 31 +++++++++++++++++++ .../addons/ToneProducer/NodeHarnessApp.cpp | 31 +++++++++++++++++++ .../addons/ToneProducer/NodeHarnessApp.h | 31 +++++++++++++++++++ .../addons/ToneProducer/NodeHarnessWin.cpp | 31 +++++++++++++++++++ .../addons/ToneProducer/NodeHarnessWin.h | 31 +++++++++++++++++++ .../addons/ToneProducer/ToneProducer.cpp | 31 +++++++++++++++++++ .../cortex/addons/ToneProducer/ToneProducer.h | 31 +++++++++++++++++++ .../addons/ToneProducer/ToneProducerAddOn.cpp | 31 +++++++++++++++++++ .../addons/ToneProducer/ToneProducerAddOn.h | 31 +++++++++++++++++++ src/apps/cortex/addons/ToneProducer/main.cpp | 31 +++++++++++++++++++ .../cortex/addons/audioOps/AudioAdapterOp.cpp | 31 +++++++++++++++++++ .../cortex/addons/audioOps/AudioAdapterOp.h | 31 +++++++++++++++++++ .../cortex/addons/audioOps/NullAudioOp.cpp | 31 +++++++++++++++++++ src/apps/cortex/addons/audioOps/NullAudioOp.h | 31 +++++++++++++++++++ .../cortex/addons/audioOps/audio_op_tools.h | 31 +++++++++++++++++++ src/apps/cortex/addons/common/AudioBuffer.cpp | 31 +++++++++++++++++++ src/apps/cortex/addons/common/AudioBuffer.h | 31 +++++++++++++++++++ .../cortex/addons/common/AudioFilterNode.cpp | 31 +++++++++++++++++++ .../cortex/addons/common/AudioFilterNode.h | 31 +++++++++++++++++++ .../addons/common/ControlAppLauncher.cpp | 31 +++++++++++++++++++ .../cortex/addons/common/ControlAppLauncher.h | 31 +++++++++++++++++++ .../addons/common/IAudioFilterOpFactory.h | 31 +++++++++++++++++++ src/apps/cortex/addons/common/IAudioOp.h | 31 +++++++++++++++++++ .../cortex/addons/common/IAudioOpFactory.h | 31 +++++++++++++++++++ src/apps/cortex/addons/common/IAudioOpHost.h | 31 +++++++++++++++++++ .../cortex/addons/common/IParameterSet.cpp | 31 +++++++++++++++++++ src/apps/cortex/addons/common/IParameterSet.h | 31 +++++++++++++++++++ .../addons/common/MediaNodeControlApp.cpp | 31 +++++++++++++++++++ .../addons/common/MediaNodeControlApp.h | 31 +++++++++++++++++++ src/apps/cortex/addons/common/RawBuffer.cpp | 31 +++++++++++++++++++ src/apps/cortex/addons/common/RawBuffer.h | 31 +++++++++++++++++++ src/apps/cortex/addons/common/SoundUtils.cpp | 31 +++++++++++++++++++ src/apps/cortex/addons/common/SoundUtils.h | 31 +++++++++++++++++++ .../cortex/addons/common/audio_buffer_tools.h | 31 +++++++++++++++++++ src/apps/cortex/cortex_defs.h | 31 +++++++++++++++++++ src/apps/cortex/support/AddOnHostProtocol.h | 31 +++++++++++++++++++ src/apps/cortex/support/BasicThread.h | 31 +++++++++++++++++++ src/apps/cortex/support/ILockable.h | 31 +++++++++++++++++++ src/apps/cortex/support/IObservable.h | 31 +++++++++++++++++++ src/apps/cortex/support/MediaIcon.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/MediaIcon.h | 31 +++++++++++++++++++ src/apps/cortex/support/MediaIconBits.h | 31 +++++++++++++++++++ src/apps/cortex/support/MediaString.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/MediaString.h | 31 +++++++++++++++++++ .../cortex/support/MouseTrackingHelpers.cpp | 31 +++++++++++++++++++ .../cortex/support/MouseTrackingHelpers.h | 31 +++++++++++++++++++ src/apps/cortex/support/MultiInvoker.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/MultiInvoker.h | 31 +++++++++++++++++++ src/apps/cortex/support/ObservableHandler.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/ObservableHandler.h | 31 +++++++++++++++++++ src/apps/cortex/support/ObservableLooper.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/ObservableLooper.h | 31 +++++++++++++++++++ src/apps/cortex/support/ProfileBlock.h | 31 +++++++++++++++++++ src/apps/cortex/support/ProfileTarget.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/ProfileTarget.h | 31 +++++++++++++++++++ src/apps/cortex/support/ScrollHelpers.h | 31 +++++++++++++++++++ src/apps/cortex/support/SimpleLockable.h | 31 +++++++++++++++++++ src/apps/cortex/support/SoundUtils.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/SoundUtils.h | 31 +++++++++++++++++++ .../cortex/support/TextControlFloater.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/TextControlFloater.h | 31 +++++++++++++++++++ src/apps/cortex/support/array_delete.h | 31 +++++++++++++++++++ src/apps/cortex/support/cortex_ui.h | 31 +++++++++++++++++++ src/apps/cortex/support/debug_tools.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/debug_tools.h | 31 +++++++++++++++++++ src/apps/cortex/support/functional_tools.h | 31 +++++++++++++++++++ src/apps/cortex/support/observe.cpp | 31 +++++++++++++++++++ src/apps/cortex/support/observe.h | 31 +++++++++++++++++++ src/apps/cortex/support/set_tools.h | 31 +++++++++++++++++++ 224 files changed, 6913 insertions(+), 27 deletions(-) delete mode 100644 src/apps/cortex/LICENSE.Cortex diff --git a/src/apps/cortex/AddOnHost/AddOnHostApp.cpp b/src/apps/cortex/AddOnHost/AddOnHostApp.cpp index c1086fa13d..5d3251bf5f 100644 --- a/src/apps/cortex/AddOnHost/AddOnHostApp.cpp +++ b/src/apps/cortex/AddOnHost/AddOnHostApp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AddOnHostApp.cpp #include "AddOnHostApp.h" diff --git a/src/apps/cortex/AddOnHost/AddOnHostApp.h b/src/apps/cortex/AddOnHost/AddOnHostApp.h index ef71793429..fb3f3dd26f 100644 --- a/src/apps/cortex/AddOnHost/AddOnHostApp.h +++ b/src/apps/cortex/AddOnHost/AddOnHostApp.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // cortex::NodeManager::AddOnHostApp.h // * PURPOSE // Definition of (and provisions for communication with) diff --git a/src/apps/cortex/DiagramView/DiagramBox.cpp b/src/apps/cortex/DiagramView/DiagramBox.cpp index 9f1c328203..b5a0e5eb75 100644 --- a/src/apps/cortex/DiagramView/DiagramBox.cpp +++ b/src/apps/cortex/DiagramView/DiagramBox.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramBox.cpp /*! \class DiagramBox diff --git a/src/apps/cortex/DiagramView/DiagramBox.h b/src/apps/cortex/DiagramView/DiagramBox.h index b550fc5d9e..6228b62ae3 100644 --- a/src/apps/cortex/DiagramView/DiagramBox.h +++ b/src/apps/cortex/DiagramView/DiagramBox.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramBox.h (Cortex/DiagramView.h) // // * HISTORY diff --git a/src/apps/cortex/DiagramView/DiagramDefs.h b/src/apps/cortex/DiagramView/DiagramDefs.h index 470a1a75cb..e521e5abfc 100644 --- a/src/apps/cortex/DiagramView/DiagramDefs.h +++ b/src/apps/cortex/DiagramView/DiagramDefs.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramDefs.h (Cortex/DiagramView) // // * PURPOSE diff --git a/src/apps/cortex/DiagramView/DiagramEndPoint.cpp b/src/apps/cortex/DiagramView/DiagramEndPoint.cpp index 2b561f6da6..c3565e2c77 100644 --- a/src/apps/cortex/DiagramView/DiagramEndPoint.cpp +++ b/src/apps/cortex/DiagramView/DiagramEndPoint.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramEndPoint.cpp #include "DiagramEndPoint.h" diff --git a/src/apps/cortex/DiagramView/DiagramEndPoint.h b/src/apps/cortex/DiagramView/DiagramEndPoint.h index 12ed8f61fd..3a50a25d27 100644 --- a/src/apps/cortex/DiagramView/DiagramEndPoint.h +++ b/src/apps/cortex/DiagramView/DiagramEndPoint.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramItem.h (Cortex/DiagramView) // // * PURPOSE diff --git a/src/apps/cortex/DiagramView/DiagramItem.cpp b/src/apps/cortex/DiagramView/DiagramItem.cpp index b6daf6a297..9e0b3ea5ab 100644 --- a/src/apps/cortex/DiagramView/DiagramItem.cpp +++ b/src/apps/cortex/DiagramView/DiagramItem.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramItem.cpp #include "DiagramItem.h" diff --git a/src/apps/cortex/DiagramView/DiagramItem.h b/src/apps/cortex/DiagramView/DiagramItem.h index a039a75eb7..eb6c148b24 100644 --- a/src/apps/cortex/DiagramView/DiagramItem.h +++ b/src/apps/cortex/DiagramView/DiagramItem.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramItem.h (Cortex/DiagramView) // // * PURPOSE diff --git a/src/apps/cortex/DiagramView/DiagramItemGroup.cpp b/src/apps/cortex/DiagramView/DiagramItemGroup.cpp index 84ee67bf67..8ad564c495 100644 --- a/src/apps/cortex/DiagramView/DiagramItemGroup.cpp +++ b/src/apps/cortex/DiagramView/DiagramItemGroup.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramItemGroup.cpp /*! \class DiagramItemGroup. diff --git a/src/apps/cortex/DiagramView/DiagramItemGroup.h b/src/apps/cortex/DiagramView/DiagramItemGroup.h index ce76088968..31007f02ca 100644 --- a/src/apps/cortex/DiagramView/DiagramItemGroup.h +++ b/src/apps/cortex/DiagramView/DiagramItemGroup.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramItemGroup.h (Cortex/DiagramView) // // * HISTORY diff --git a/src/apps/cortex/DiagramView/DiagramView.cpp b/src/apps/cortex/DiagramView/DiagramView.cpp index b885757065..6503a5d25a 100644 --- a/src/apps/cortex/DiagramView/DiagramView.cpp +++ b/src/apps/cortex/DiagramView/DiagramView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramView.cpp #include "DiagramView.h" diff --git a/src/apps/cortex/DiagramView/DiagramView.h b/src/apps/cortex/DiagramView/DiagramView.h index 570c8b9ac5..0e9ac90c62 100644 --- a/src/apps/cortex/DiagramView/DiagramView.h +++ b/src/apps/cortex/DiagramView/DiagramView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramView.h (Cortex/DiagramView) // // * PURPOSE diff --git a/src/apps/cortex/DiagramView/DiagramWire.cpp b/src/apps/cortex/DiagramView/DiagramWire.cpp index 4dcb769f96..98b849bc11 100644 --- a/src/apps/cortex/DiagramView/DiagramWire.cpp +++ b/src/apps/cortex/DiagramView/DiagramWire.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramWire.cpp #include "DiagramWire.h" diff --git a/src/apps/cortex/DiagramView/DiagramWire.h b/src/apps/cortex/DiagramView/DiagramWire.h index 388a7c78de..ac80346bd1 100644 --- a/src/apps/cortex/DiagramView/DiagramWire.h +++ b/src/apps/cortex/DiagramView/DiagramWire.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DiagramWire.h (Cortex/DiagramView) // // * PURPOSE diff --git a/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp b/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp index 7ec070ade2..202fe3c018 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp +++ b/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeListItem.cpp #include "DormantNodeListItem.h" diff --git a/src/apps/cortex/DormantNodeView/DormantNodeListItem.h b/src/apps/cortex/DormantNodeView/DormantNodeListItem.h index fdc0da5766..9aad35540d 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeListItem.h +++ b/src/apps/cortex/DormantNodeView/DormantNodeListItem.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeListItem.h // e.moon 2jun99 // diff --git a/src/apps/cortex/DormantNodeView/DormantNodeView.cpp b/src/apps/cortex/DormantNodeView/DormantNodeView.cpp index 42a22f7d06..2b5471dbea 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeView.cpp +++ b/src/apps/cortex/DormantNodeView/DormantNodeView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeView.cpp #include "DormantNodeView.h" diff --git a/src/apps/cortex/DormantNodeView/DormantNodeView.h b/src/apps/cortex/DormantNodeView/DormantNodeView.h index 2c1a89aa66..7ba819d5a5 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeView.h +++ b/src/apps/cortex/DormantNodeView/DormantNodeView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeView.h // c.lenz 22oct99 // diff --git a/src/apps/cortex/DormantNodeView/DormantNodeWindow.cpp b/src/apps/cortex/DormantNodeView/DormantNodeWindow.cpp index 7ba7f8edfa..52f3aed55d 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeWindow.cpp +++ b/src/apps/cortex/DormantNodeView/DormantNodeWindow.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeWindow.cpp // e.moon 2jun99 diff --git a/src/apps/cortex/DormantNodeView/DormantNodeWindow.h b/src/apps/cortex/DormantNodeView/DormantNodeWindow.h index 4334cdb7e9..7c80246ac1 100644 --- a/src/apps/cortex/DormantNodeView/DormantNodeWindow.h +++ b/src/apps/cortex/DormantNodeView/DormantNodeWindow.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeWindow.h // e.moon 2jun99 diff --git a/src/apps/cortex/InfoView/AppNodeInfoView.cpp b/src/apps/cortex/InfoView/AppNodeInfoView.cpp index 310d16bc35..b5c964d67e 100644 --- a/src/apps/cortex/InfoView/AppNodeInfoView.cpp +++ b/src/apps/cortex/InfoView/AppNodeInfoView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AppNodeInfoView.cpp #include "AppNodeInfoView.h" diff --git a/src/apps/cortex/InfoView/AppNodeInfoView.h b/src/apps/cortex/InfoView/AppNodeInfoView.h index 7de42abf6a..8deaf96ddf 100644 --- a/src/apps/cortex/InfoView/AppNodeInfoView.h +++ b/src/apps/cortex/InfoView/AppNodeInfoView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AppNodeInfoView.h (Cortex/InfoView) // // * PURPOSE diff --git a/src/apps/cortex/InfoView/ConnectionInfoView.cpp b/src/apps/cortex/InfoView/ConnectionInfoView.cpp index fc0afd669d..5b8cf3c761 100644 --- a/src/apps/cortex/InfoView/ConnectionInfoView.cpp +++ b/src/apps/cortex/InfoView/ConnectionInfoView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ConnectionInfoView.cpp #include "ConnectionInfoView.h" diff --git a/src/apps/cortex/InfoView/ConnectionInfoView.h b/src/apps/cortex/InfoView/ConnectionInfoView.h index 50b9dc6964..f9f1ee7622 100644 --- a/src/apps/cortex/InfoView/ConnectionInfoView.h +++ b/src/apps/cortex/InfoView/ConnectionInfoView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ConnectionInfoView.h (Cortex/InfoView) // // * PURPOSE diff --git a/src/apps/cortex/InfoView/DormantNodeInfoView.cpp b/src/apps/cortex/InfoView/DormantNodeInfoView.cpp index 51f99d2731..8193702568 100644 --- a/src/apps/cortex/InfoView/DormantNodeInfoView.cpp +++ b/src/apps/cortex/InfoView/DormantNodeInfoView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeInfoView.cpp #include "DormantNodeInfoView.h" diff --git a/src/apps/cortex/InfoView/DormantNodeInfoView.h b/src/apps/cortex/InfoView/DormantNodeInfoView.h index a0c0556264..d3e1272217 100644 --- a/src/apps/cortex/InfoView/DormantNodeInfoView.h +++ b/src/apps/cortex/InfoView/DormantNodeInfoView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeInfoView.h (Cortex/InfoView) // // * PURPOSE diff --git a/src/apps/cortex/InfoView/EndPointInfoView.cpp b/src/apps/cortex/InfoView/EndPointInfoView.cpp index 494d7cd03c..6107fca31b 100644 --- a/src/apps/cortex/InfoView/EndPointInfoView.cpp +++ b/src/apps/cortex/InfoView/EndPointInfoView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // EndPointInfoView.cpp #include "EndPointInfoView.h" diff --git a/src/apps/cortex/InfoView/EndPointInfoView.h b/src/apps/cortex/InfoView/EndPointInfoView.h index 0501b41311..c2b46d9bc4 100644 --- a/src/apps/cortex/InfoView/EndPointInfoView.h +++ b/src/apps/cortex/InfoView/EndPointInfoView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // EndPointInfoView.h (Cortex/InfoView) // // * PURPOSE diff --git a/src/apps/cortex/InfoView/FileNodeInfoView.cpp b/src/apps/cortex/InfoView/FileNodeInfoView.cpp index 483f5d41c1..1922d92be3 100644 --- a/src/apps/cortex/InfoView/FileNodeInfoView.cpp +++ b/src/apps/cortex/InfoView/FileNodeInfoView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FileNodeInfoView.cpp #include "FileNodeInfoView.h" diff --git a/src/apps/cortex/InfoView/FileNodeInfoView.h b/src/apps/cortex/InfoView/FileNodeInfoView.h index 4ff4f85dd5..ce46e57de9 100644 --- a/src/apps/cortex/InfoView/FileNodeInfoView.h +++ b/src/apps/cortex/InfoView/FileNodeInfoView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FileNodeInfoView.h (Cortex/InfoView) // // * PURPOSE diff --git a/src/apps/cortex/InfoView/InfoView.cpp b/src/apps/cortex/InfoView/InfoView.cpp index 8a6559b7ce..b1d9c77d57 100644 --- a/src/apps/cortex/InfoView/InfoView.cpp +++ b/src/apps/cortex/InfoView/InfoView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // InfoView.cpp #include "InfoView.h" diff --git a/src/apps/cortex/InfoView/InfoView.h b/src/apps/cortex/InfoView/InfoView.h index ec883687b6..bc22b79d49 100644 --- a/src/apps/cortex/InfoView/InfoView.h +++ b/src/apps/cortex/InfoView/InfoView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // InfoView.h (Cortex/InfoView) // // * PURPOSE diff --git a/src/apps/cortex/InfoView/InfoWindow.cpp b/src/apps/cortex/InfoView/InfoWindow.cpp index a95882884a..082d61dd1b 100644 --- a/src/apps/cortex/InfoView/InfoWindow.cpp +++ b/src/apps/cortex/InfoView/InfoWindow.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // InfoWindow.cpp #include "InfoWindow.h" diff --git a/src/apps/cortex/InfoView/InfoWindow.h b/src/apps/cortex/InfoView/InfoWindow.h index 1a3127dade..869c28cf39 100644 --- a/src/apps/cortex/InfoView/InfoWindow.h +++ b/src/apps/cortex/InfoView/InfoWindow.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // InfoWindow.h (Cortex/InfoView) // // * PURPOSE diff --git a/src/apps/cortex/InfoView/InfoWindowManager.cpp b/src/apps/cortex/InfoView/InfoWindowManager.cpp index f65cca3e22..126ec6f879 100644 --- a/src/apps/cortex/InfoView/InfoWindowManager.cpp +++ b/src/apps/cortex/InfoView/InfoWindowManager.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // InfoWindowManager.cpp #include "InfoWindowManager.h" diff --git a/src/apps/cortex/InfoView/InfoWindowManager.h b/src/apps/cortex/InfoView/InfoWindowManager.h index 581610ca7a..63906b2f5a 100644 --- a/src/apps/cortex/InfoView/InfoWindowManager.h +++ b/src/apps/cortex/InfoView/InfoWindowManager.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // InfoWindowManager.h // // * PURPOSE diff --git a/src/apps/cortex/InfoView/LiveNodeInfoView.cpp b/src/apps/cortex/InfoView/LiveNodeInfoView.cpp index 05ac21eccc..354eadd1b9 100644 --- a/src/apps/cortex/InfoView/LiveNodeInfoView.cpp +++ b/src/apps/cortex/InfoView/LiveNodeInfoView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LiveNodeInfoView.cpp #include "LiveNodeInfoView.h" diff --git a/src/apps/cortex/InfoView/LiveNodeInfoView.h b/src/apps/cortex/InfoView/LiveNodeInfoView.h index 869bac3f67..d8ff57aeb5 100644 --- a/src/apps/cortex/InfoView/LiveNodeInfoView.h +++ b/src/apps/cortex/InfoView/LiveNodeInfoView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LiveNodeInfoView.h (Cortex/InfoView) // // * PURPOSE diff --git a/src/apps/cortex/LICENSE.Cortex b/src/apps/cortex/LICENSE.Cortex deleted file mode 100644 index 90005c6fce..0000000000 --- a/src/apps/cortex/LICENSE.Cortex +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 1999-2000, Eric Moon. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions, and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/apps/cortex/MediaRoutingView/MediaJack.cpp b/src/apps/cortex/MediaRoutingView/MediaJack.cpp index 2964801cb3..dda28d7df5 100644 --- a/src/apps/cortex/MediaRoutingView/MediaJack.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaJack.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaJack.cpp // c.lenz 10oct99 diff --git a/src/apps/cortex/MediaRoutingView/MediaJack.h b/src/apps/cortex/MediaRoutingView/MediaJack.h index 0eeadf4ec4..13d262b876 100644 --- a/src/apps/cortex/MediaRoutingView/MediaJack.h +++ b/src/apps/cortex/MediaRoutingView/MediaJack.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaJack.h // c.lenz 10oct99 // diff --git a/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp b/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp index d9cb9f6659..92d6864cf0 100644 --- a/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaNodePanel.cpp // c.lenz 10oct99 diff --git a/src/apps/cortex/MediaRoutingView/MediaNodePanel.h b/src/apps/cortex/MediaRoutingView/MediaNodePanel.h index bac5d92766..30c2f6c938 100644 --- a/src/apps/cortex/MediaRoutingView/MediaNodePanel.h +++ b/src/apps/cortex/MediaRoutingView/MediaNodePanel.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaNodePanel.h // c.lenz 9oct99 // diff --git a/src/apps/cortex/MediaRoutingView/MediaRoutingDefs.h b/src/apps/cortex/MediaRoutingView/MediaRoutingDefs.h index 2485c35800..51db89bd1a 100644 --- a/src/apps/cortex/MediaRoutingView/MediaRoutingDefs.h +++ b/src/apps/cortex/MediaRoutingView/MediaRoutingDefs.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaRoutingDefs.h // c.lenz 9oct99 // diff --git a/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp b/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp index 7d9bac974a..3e4b2cac39 100644 --- a/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaRoutingView.cpp #include "MediaRoutingView.h" diff --git a/src/apps/cortex/MediaRoutingView/MediaRoutingView.h b/src/apps/cortex/MediaRoutingView/MediaRoutingView.h index 8016124d4c..b8b0fc9b47 100644 --- a/src/apps/cortex/MediaRoutingView/MediaRoutingView.h +++ b/src/apps/cortex/MediaRoutingView/MediaRoutingView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaRoutingView.h // c.lenz 9oct99 // diff --git a/src/apps/cortex/MediaRoutingView/MediaWire.cpp b/src/apps/cortex/MediaRoutingView/MediaWire.cpp index 96315da10e..8f40f362ce 100644 --- a/src/apps/cortex/MediaRoutingView/MediaWire.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaWire.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaWire.cpp #include "MediaWire.h" diff --git a/src/apps/cortex/MediaRoutingView/MediaWire.h b/src/apps/cortex/MediaRoutingView/MediaWire.h index 7ff4337880..68802ca2c2 100644 --- a/src/apps/cortex/MediaRoutingView/MediaWire.h +++ b/src/apps/cortex/MediaRoutingView/MediaWire.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaWire.h // c.lenz 10oct99 // diff --git a/src/apps/cortex/NodeManager/AddOnHost.cpp b/src/apps/cortex/NodeManager/AddOnHost.cpp index 94eb430807..ba3aa614dc 100644 --- a/src/apps/cortex/NodeManager/AddOnHost.cpp +++ b/src/apps/cortex/NodeManager/AddOnHost.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + #include "AddOnHost.h" #include "AddOnHostProtocol.h" diff --git a/src/apps/cortex/NodeManager/AddOnHost.h b/src/apps/cortex/NodeManager/AddOnHost.h index b39914a2ee..c27b196170 100644 --- a/src/apps/cortex/NodeManager/AddOnHost.h +++ b/src/apps/cortex/NodeManager/AddOnHost.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // cortex::NodeManager::AddOnHost.h // * PURPOSE // Provides an interface to a separate BApplication whose diff --git a/src/apps/cortex/NodeManager/Connection.cpp b/src/apps/cortex/NodeManager/Connection.cpp index 43383e58d6..dbccdec73d 100644 --- a/src/apps/cortex/NodeManager/Connection.cpp +++ b/src/apps/cortex/NodeManager/Connection.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // Connection.cpp // e.moon 25jun99 diff --git a/src/apps/cortex/NodeManager/Connection.h b/src/apps/cortex/NodeManager/Connection.h index 24b37dc779..c00a299ffd 100644 --- a/src/apps/cortex/NodeManager/Connection.h +++ b/src/apps/cortex/NodeManager/Connection.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // Connection.h (Cortex) // * PURPOSE // Represents a general connection between two media nodes. diff --git a/src/apps/cortex/NodeManager/NodeGroup.cpp b/src/apps/cortex/NodeManager/NodeGroup.cpp index 42e9964d1b..ab1992637d 100644 --- a/src/apps/cortex/NodeManager/NodeGroup.cpp +++ b/src/apps/cortex/NodeManager/NodeGroup.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeGroup.cpp #include "NodeGroup.h" diff --git a/src/apps/cortex/NodeManager/NodeGroup.h b/src/apps/cortex/NodeManager/NodeGroup.h index 64846b366a..0c08f0a20c 100644 --- a/src/apps/cortex/NodeManager/NodeGroup.h +++ b/src/apps/cortex/NodeManager/NodeGroup.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeGroup.h (Cortex/NodeManager) // // * PURPOSE diff --git a/src/apps/cortex/NodeManager/NodeManager.cpp b/src/apps/cortex/NodeManager/NodeManager.cpp index eaa2b3afba..f40b10397c 100644 --- a/src/apps/cortex/NodeManager/NodeManager.cpp +++ b/src/apps/cortex/NodeManager/NodeManager.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeManager.cpp #include "NodeManager.h" diff --git a/src/apps/cortex/NodeManager/NodeManager.h b/src/apps/cortex/NodeManager/NodeManager.h index dfaedcaeee..51abcf9fd7 100644 --- a/src/apps/cortex/NodeManager/NodeManager.h +++ b/src/apps/cortex/NodeManager/NodeManager.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeManager.h (Cortex) // // * PURPOSE diff --git a/src/apps/cortex/NodeManager/NodeRef.cpp b/src/apps/cortex/NodeManager/NodeRef.cpp index cde43f08cb..b8164c9d16 100644 --- a/src/apps/cortex/NodeManager/NodeRef.cpp +++ b/src/apps/cortex/NodeManager/NodeRef.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeRef.cpp #include "NodeRef.h" diff --git a/src/apps/cortex/NodeManager/NodeRef.h b/src/apps/cortex/NodeManager/NodeRef.h index 0b892004a5..8a167f6b9b 100644 --- a/src/apps/cortex/NodeManager/NodeRef.h +++ b/src/apps/cortex/NodeManager/NodeRef.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeRef.h (Cortex/NodeManager) // // * PURPOSE diff --git a/src/apps/cortex/NodeManager/NodeSyncThread.cpp b/src/apps/cortex/NodeManager/NodeSyncThread.cpp index d73135dce3..1707dde901 100644 --- a/src/apps/cortex/NodeManager/NodeSyncThread.cpp +++ b/src/apps/cortex/NodeManager/NodeSyncThread.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeSyncThread.cpp #include "NodeSyncThread.h" diff --git a/src/apps/cortex/NodeManager/NodeSyncThread.h b/src/apps/cortex/NodeManager/NodeSyncThread.h index 9a9d229539..d275cf57d9 100644 --- a/src/apps/cortex/NodeManager/NodeSyncThread.h +++ b/src/apps/cortex/NodeManager/NodeSyncThread.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeSyncThread.h [rewrite 14oct99] // * PURPOSE // Provide continuous synchronization notices on diff --git a/src/apps/cortex/NodeManager/node_manager_impl.h b/src/apps/cortex/NodeManager/node_manager_impl.h index 2e3230710d..ad435c4a01 100644 --- a/src/apps/cortex/NodeManager/node_manager_impl.h +++ b/src/apps/cortex/NodeManager/node_manager_impl.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // node_manager_impl.h // * PURPOSE // Helper classes & functions used by NodeManager, diff --git a/src/apps/cortex/ParameterView/ParameterContainerView.cpp b/src/apps/cortex/ParameterView/ParameterContainerView.cpp index e3dab29b31..11a4f194af 100644 --- a/src/apps/cortex/ParameterView/ParameterContainerView.cpp +++ b/src/apps/cortex/ParameterView/ParameterContainerView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ParameterContainerView.cpp #include "ParameterContainerView.h" diff --git a/src/apps/cortex/ParameterView/ParameterContainerView.h b/src/apps/cortex/ParameterView/ParameterContainerView.h index 71dd9eaed4..c7d4dfb03d 100644 --- a/src/apps/cortex/ParameterView/ParameterContainerView.h +++ b/src/apps/cortex/ParameterView/ParameterContainerView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ParameterContainerView.h (Cortex/ParameterWindow) // // * PURPOSE diff --git a/src/apps/cortex/ParameterView/ParameterWindow.cpp b/src/apps/cortex/ParameterView/ParameterWindow.cpp index 6f861d7544..3f82c1c101 100644 --- a/src/apps/cortex/ParameterView/ParameterWindow.cpp +++ b/src/apps/cortex/ParameterView/ParameterWindow.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ParameterWindow.cpp #include "ParameterWindow.h" diff --git a/src/apps/cortex/ParameterView/ParameterWindow.h b/src/apps/cortex/ParameterView/ParameterWindow.h index 2d57b360d6..d3af88415d 100644 --- a/src/apps/cortex/ParameterView/ParameterWindow.h +++ b/src/apps/cortex/ParameterView/ParameterWindow.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ParameterWindow.h (Cortex/ParameterWindow) // // * PURPOSE diff --git a/src/apps/cortex/ParameterView/ParameterWindowManager.cpp b/src/apps/cortex/ParameterView/ParameterWindowManager.cpp index 7568eebfaa..1395e341b4 100644 --- a/src/apps/cortex/ParameterView/ParameterWindowManager.cpp +++ b/src/apps/cortex/ParameterView/ParameterWindowManager.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ParameterWindowManager.cpp #include "ParameterWindowManager.h" diff --git a/src/apps/cortex/ParameterView/ParameterWindowManager.h b/src/apps/cortex/ParameterView/ParameterWindowManager.h index 09eef64948..d4bf787b6a 100644 --- a/src/apps/cortex/ParameterView/ParameterWindowManager.h +++ b/src/apps/cortex/ParameterView/ParameterWindowManager.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ParameterWindowManager.h // // * PURPOSE diff --git a/src/apps/cortex/Persistence/ExportContext.cpp b/src/apps/cortex/Persistence/ExportContext.cpp index 721ad2fbba..a6f667e0c3 100644 --- a/src/apps/cortex/Persistence/ExportContext.cpp +++ b/src/apps/cortex/Persistence/ExportContext.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ExportContext.cpp // e.moon 30jun99 diff --git a/src/apps/cortex/Persistence/ExportContext.h b/src/apps/cortex/Persistence/ExportContext.h index 81b9747926..3e5ab8aa18 100644 --- a/src/apps/cortex/Persistence/ExportContext.h +++ b/src/apps/cortex/Persistence/ExportContext.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ExportContext.h // * PURPOSE // Describe the state of a serialization ('save') operation. diff --git a/src/apps/cortex/Persistence/IPersistent.h b/src/apps/cortex/Persistence/IPersistent.h index e63efad302..0db2487453 100644 --- a/src/apps/cortex/Persistence/IPersistent.h +++ b/src/apps/cortex/Persistence/IPersistent.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IPersistant.h // * PURPOSE // Interface to be implemented by objects that want to diff --git a/src/apps/cortex/Persistence/IStateArchivable.h b/src/apps/cortex/Persistence/IStateArchivable.h index 52afabd6a0..15700d6ba5 100644 --- a/src/apps/cortex/Persistence/IStateArchivable.h +++ b/src/apps/cortex/Persistence/IStateArchivable.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IStateArchivable.h // * PURPOSE // Similar to BArchivable, but provides for archiving of diff --git a/src/apps/cortex/Persistence/ImportContext.cpp b/src/apps/cortex/Persistence/ImportContext.cpp index d928da9ad5..9727902fd6 100644 --- a/src/apps/cortex/Persistence/ImportContext.cpp +++ b/src/apps/cortex/Persistence/ImportContext.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ImportContext.cpp // e.moon 1jul99 diff --git a/src/apps/cortex/Persistence/ImportContext.h b/src/apps/cortex/Persistence/ImportContext.h index b8d1e70f0d..d11a35a920 100644 --- a/src/apps/cortex/Persistence/ImportContext.h +++ b/src/apps/cortex/Persistence/ImportContext.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ImportContext.h // * PURPOSE // Describe the state of a deserialization ('load') operation. diff --git a/src/apps/cortex/Persistence/Importer.cpp b/src/apps/cortex/Persistence/Importer.cpp index 8db4eeb785..0b35420c2d 100644 --- a/src/apps/cortex/Persistence/Importer.cpp +++ b/src/apps/cortex/Persistence/Importer.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // Importer.cpp // e.moon 28jun99 diff --git a/src/apps/cortex/Persistence/Importer.h b/src/apps/cortex/Persistence/Importer.h index 1c9154c795..e0ee7e230c 100644 --- a/src/apps/cortex/Persistence/Importer.h +++ b/src/apps/cortex/Persistence/Importer.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // Importer.h // // * PURPOSE diff --git a/src/apps/cortex/Persistence/StringContent.cpp b/src/apps/cortex/Persistence/StringContent.cpp index ca4094ab08..6a87b80afb 100644 --- a/src/apps/cortex/Persistence/StringContent.cpp +++ b/src/apps/cortex/Persistence/StringContent.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // StringContent.cpp #include "StringContent.h" diff --git a/src/apps/cortex/Persistence/StringContent.h b/src/apps/cortex/Persistence/StringContent.h index 288280b2c0..1c29fe1590 100644 --- a/src/apps/cortex/Persistence/StringContent.h +++ b/src/apps/cortex/Persistence/StringContent.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // StringContent.h // * PURPOSE // Implements IPersistent to store element content in diff --git a/src/apps/cortex/Persistence/Wrappers/FlatMessageIO.cpp b/src/apps/cortex/Persistence/Wrappers/FlatMessageIO.cpp index 6248776d51..a94769b102 100644 --- a/src/apps/cortex/Persistence/Wrappers/FlatMessageIO.cpp +++ b/src/apps/cortex/Persistence/Wrappers/FlatMessageIO.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FlatMessageIO.cpp // e.moon 6jul99 diff --git a/src/apps/cortex/Persistence/Wrappers/FlatMessageIO.h b/src/apps/cortex/Persistence/Wrappers/FlatMessageIO.h index 3bea951f16..7a76f8c814 100644 --- a/src/apps/cortex/Persistence/Wrappers/FlatMessageIO.h +++ b/src/apps/cortex/Persistence/Wrappers/FlatMessageIO.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FlatMessageIO.h // * PURPOSE // Efficient export/import of BMessages to and from diff --git a/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.cpp b/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.cpp index f3819ccb0b..9d613db451 100644 --- a/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.cpp +++ b/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaFormatIO.cpp // e.moon 2jul99 diff --git a/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.h b/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.h index 79aa51e960..626602b35e 100644 --- a/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.h +++ b/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaFormatIO.h // * PURPOSE // Wrapper class for media_format, providing XML diff --git a/src/apps/cortex/Persistence/Wrappers/MessageIO.cpp b/src/apps/cortex/Persistence/Wrappers/MessageIO.cpp index 8d20d9cdff..7d581dbe1c 100644 --- a/src/apps/cortex/Persistence/Wrappers/MessageIO.cpp +++ b/src/apps/cortex/Persistence/Wrappers/MessageIO.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MessageIO.cpp #include "MessageIO.h" diff --git a/src/apps/cortex/Persistence/Wrappers/MessageIO.h b/src/apps/cortex/Persistence/Wrappers/MessageIO.h index 0eb79ac821..d36b123b32 100644 --- a/src/apps/cortex/Persistence/Wrappers/MessageIO.h +++ b/src/apps/cortex/Persistence/Wrappers/MessageIO.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MessageIO.h // * PURPOSE // Export/import of BMessages to and from diff --git a/src/apps/cortex/Persistence/XML.cpp b/src/apps/cortex/Persistence/XML.cpp index 4dbc019739..07f6c9f519 100644 --- a/src/apps/cortex/Persistence/XML.cpp +++ b/src/apps/cortex/Persistence/XML.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // XML.cpp // e.moon 1jul99 diff --git a/src/apps/cortex/Persistence/XML.h b/src/apps/cortex/Persistence/XML.h index 28c252283e..b83f8a750f 100644 --- a/src/apps/cortex/Persistence/XML.h +++ b/src/apps/cortex/Persistence/XML.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // XML.h // * PURPOSE // A central access point for Cortex's XML import/export diff --git a/src/apps/cortex/Persistence/XMLElementMapping.h b/src/apps/cortex/Persistence/XMLElementMapping.h index b99a02de61..ab86771003 100644 --- a/src/apps/cortex/Persistence/XMLElementMapping.h +++ b/src/apps/cortex/Persistence/XMLElementMapping.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // XMLElementMapping.h // * PURPOSE // A simple class (template implementing a non-template diff --git a/src/apps/cortex/Persistence/xml_export_utils.h b/src/apps/cortex/Persistence/xml_export_utils.h index c7a81360d6..888bdbe6c6 100644 --- a/src/apps/cortex/Persistence/xml_export_utils.h +++ b/src/apps/cortex/Persistence/xml_export_utils.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // xml_export_utils.h // * PURPOSE // helper functions for writing XML representations of diff --git a/src/apps/cortex/RouteApp/ConnectionIO.cpp b/src/apps/cortex/RouteApp/ConnectionIO.cpp index 02b3cab333..7f67dd9ddb 100644 --- a/src/apps/cortex/RouteApp/ConnectionIO.cpp +++ b/src/apps/cortex/RouteApp/ConnectionIO.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ConnectionIO.cpp #include "ConnectionIO.h" diff --git a/src/apps/cortex/RouteApp/ConnectionIO.h b/src/apps/cortex/RouteApp/ConnectionIO.h index cff292aa75..3c2e1e9a87 100644 --- a/src/apps/cortex/RouteApp/ConnectionIO.h +++ b/src/apps/cortex/RouteApp/ConnectionIO.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ConnectionIO.h // * PURPOSE // Manage the import and export of a user-instantiated diff --git a/src/apps/cortex/RouteApp/DormantNodeIO.cpp b/src/apps/cortex/RouteApp/DormantNodeIO.cpp index d40ef77ad2..e210ef4cdb 100644 --- a/src/apps/cortex/RouteApp/DormantNodeIO.cpp +++ b/src/apps/cortex/RouteApp/DormantNodeIO.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeIO.cpp #include "DormantNodeIO.h" diff --git a/src/apps/cortex/RouteApp/DormantNodeIO.h b/src/apps/cortex/RouteApp/DormantNodeIO.h index 95ff6b3573..629f238772 100644 --- a/src/apps/cortex/RouteApp/DormantNodeIO.h +++ b/src/apps/cortex/RouteApp/DormantNodeIO.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // DormantNodeIO.h // * PURPOSE // Manage the import and export of a user-instantiated diff --git a/src/apps/cortex/RouteApp/LiveNodeIO.cpp b/src/apps/cortex/RouteApp/LiveNodeIO.cpp index bece98bf8b..959f11aa04 100644 --- a/src/apps/cortex/RouteApp/LiveNodeIO.cpp +++ b/src/apps/cortex/RouteApp/LiveNodeIO.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LiveNodeIO.cpp #include "LiveNodeIO.h" diff --git a/src/apps/cortex/RouteApp/LiveNodeIO.h b/src/apps/cortex/RouteApp/LiveNodeIO.h index bacf3fda4f..ee3abecc3c 100644 --- a/src/apps/cortex/RouteApp/LiveNodeIO.h +++ b/src/apps/cortex/RouteApp/LiveNodeIO.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LiveNodeIO.h // * PURPOSE // Manage the import and export of an 'existing node' diff --git a/src/apps/cortex/RouteApp/NodeExportContext.h b/src/apps/cortex/RouteApp/NodeExportContext.h index d23d769d86..6a41da143f 100644 --- a/src/apps/cortex/RouteApp/NodeExportContext.h +++ b/src/apps/cortex/RouteApp/NodeExportContext.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeExportContext.h // * PURPOSE // Extends ExportContext to include a set of nodes diff --git a/src/apps/cortex/RouteApp/NodeKey.cpp b/src/apps/cortex/RouteApp/NodeKey.cpp index 25ac7e0e9c..a7839bfd10 100644 --- a/src/apps/cortex/RouteApp/NodeKey.cpp +++ b/src/apps/cortex/RouteApp/NodeKey.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeKey.cpp #include "NodeKey.h" diff --git a/src/apps/cortex/RouteApp/NodeKey.h b/src/apps/cortex/RouteApp/NodeKey.h index d7b07f6960..f99cedb11b 100644 --- a/src/apps/cortex/RouteApp/NodeKey.h +++ b/src/apps/cortex/RouteApp/NodeKey.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeKey.h // * PURPOSE +++++ SUPERCEDED BY LiveNodeIO 20dec99 +++++ // diff --git a/src/apps/cortex/RouteApp/NodeSetIOContext.cpp b/src/apps/cortex/RouteApp/NodeSetIOContext.cpp index 3d63f646b6..821316cc7e 100644 --- a/src/apps/cortex/RouteApp/NodeSetIOContext.cpp +++ b/src/apps/cortex/RouteApp/NodeSetIOContext.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeSetIOContext.cpp #include "NodeSetIOContext.h" diff --git a/src/apps/cortex/RouteApp/NodeSetIOContext.h b/src/apps/cortex/RouteApp/NodeSetIOContext.h index 617f7cef0f..eb7acf650b 100644 --- a/src/apps/cortex/RouteApp/NodeSetIOContext.h +++ b/src/apps/cortex/RouteApp/NodeSetIOContext.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeSetIOContext.h // * PURPOSE // Store state info for import & export of a set diff --git a/src/apps/cortex/RouteApp/RouteApp.cpp b/src/apps/cortex/RouteApp/RouteApp.cpp index 8c78e0c0f5..e1faaf01db 100644 --- a/src/apps/cortex/RouteApp/RouteApp.cpp +++ b/src/apps/cortex/RouteApp/RouteApp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // RouteApp.cpp // e.moon 14may99 diff --git a/src/apps/cortex/RouteApp/RouteApp.h b/src/apps/cortex/RouteApp/RouteApp.h index f90fadd81f..fa3c8caf0a 100644 --- a/src/apps/cortex/RouteApp/RouteApp.h +++ b/src/apps/cortex/RouteApp/RouteApp.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // RouteApp.h // e.moon 14may99 // diff --git a/src/apps/cortex/RouteApp/RouteAppNodeManager.cpp b/src/apps/cortex/RouteApp/RouteAppNodeManager.cpp index fa3753a491..0199bb9e8e 100644 --- a/src/apps/cortex/RouteApp/RouteAppNodeManager.cpp +++ b/src/apps/cortex/RouteApp/RouteAppNodeManager.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // RouteAppNodeManager.cpp #include "RouteAppNodeManager.h" diff --git a/src/apps/cortex/RouteApp/RouteAppNodeManager.h b/src/apps/cortex/RouteApp/RouteAppNodeManager.h index c6899cf51d..956762c303 100644 --- a/src/apps/cortex/RouteApp/RouteAppNodeManager.h +++ b/src/apps/cortex/RouteApp/RouteAppNodeManager.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // RouteAppNodeManager.h // * PURPOSE // Extends NodeManager to provide services to a graphical diff --git a/src/apps/cortex/RouteApp/RouteWindow.cpp b/src/apps/cortex/RouteApp/RouteWindow.cpp index 657cac2ba2..eb6c1648c0 100644 --- a/src/apps/cortex/RouteApp/RouteWindow.cpp +++ b/src/apps/cortex/RouteApp/RouteWindow.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // RouteWindow.cpp // e.moon 14may99 diff --git a/src/apps/cortex/RouteApp/RouteWindow.h b/src/apps/cortex/RouteApp/RouteWindow.h index 5b09b7457f..dfbaa5ecef 100644 --- a/src/apps/cortex/RouteApp/RouteWindow.h +++ b/src/apps/cortex/RouteApp/RouteWindow.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // RouteWindow.h // e.moon 14may99 // diff --git a/src/apps/cortex/RouteApp/StatusView.cpp b/src/apps/cortex/RouteApp/StatusView.cpp index 8a7a42e39a..10658fcba0 100644 --- a/src/apps/cortex/RouteApp/StatusView.cpp +++ b/src/apps/cortex/RouteApp/StatusView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // StatusView.cpp #include "StatusView.h" diff --git a/src/apps/cortex/RouteApp/StatusView.h b/src/apps/cortex/RouteApp/StatusView.h index 978e0b78b6..ac4654e54c 100644 --- a/src/apps/cortex/RouteApp/StatusView.h +++ b/src/apps/cortex/RouteApp/StatusView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // StatusView.h (Cortex/ParameterWindow) // // * PURPOSE diff --git a/src/apps/cortex/RouteApp/route_app_io.cpp b/src/apps/cortex/RouteApp/route_app_io.cpp index c5129a0969..de89922df0 100644 --- a/src/apps/cortex/RouteApp/route_app_io.cpp +++ b/src/apps/cortex/RouteApp/route_app_io.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // route_app_io.cpp #include "route_app_io.h" diff --git a/src/apps/cortex/RouteApp/route_app_io.h b/src/apps/cortex/RouteApp/route_app_io.h index 189642e3df..303981b435 100644 --- a/src/apps/cortex/RouteApp/route_app_io.h +++ b/src/apps/cortex/RouteApp/route_app_io.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // route_app_io.h // * PURPOSE // Central definitions of constants used to import/export diff --git a/src/apps/cortex/TipManager/TipManager.cpp b/src/apps/cortex/TipManager/TipManager.cpp index ada105daa6..bd70a9f4a4 100644 --- a/src/apps/cortex/TipManager/TipManager.cpp +++ b/src/apps/cortex/TipManager/TipManager.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TipManager.cpp // e.moon 12may99 diff --git a/src/apps/cortex/TipManager/TipManager.h b/src/apps/cortex/TipManager/TipManager.h index 505e240ed4..eb52512789 100644 --- a/src/apps/cortex/TipManager/TipManager.h +++ b/src/apps/cortex/TipManager/TipManager.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TipManager.h // // PURPOSE diff --git a/src/apps/cortex/TipManager/TipManagerImpl.cpp b/src/apps/cortex/TipManager/TipManagerImpl.cpp index 44f4c25c0e..29aaa5c9f8 100644 --- a/src/apps/cortex/TipManager/TipManagerImpl.cpp +++ b/src/apps/cortex/TipManager/TipManagerImpl.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TipManagerImpl.cpp // e.moon 13may99 diff --git a/src/apps/cortex/TipManager/TipManagerImpl.h b/src/apps/cortex/TipManager/TipManagerImpl.h index 38228cd900..2256d6c15b 100644 --- a/src/apps/cortex/TipManager/TipManagerImpl.h +++ b/src/apps/cortex/TipManager/TipManagerImpl.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TipManagerImpl.h // e.moon 13may99 // diff --git a/src/apps/cortex/TipManager/TipView.cpp b/src/apps/cortex/TipManager/TipView.cpp index 64b9cc86b6..7ae48627b2 100644 --- a/src/apps/cortex/TipManager/TipView.cpp +++ b/src/apps/cortex/TipManager/TipView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TipView.cpp #include "TipView.h" diff --git a/src/apps/cortex/TipManager/TipView.h b/src/apps/cortex/TipManager/TipView.h index 09de4e33c7..d3c6f38675 100644 --- a/src/apps/cortex/TipManager/TipView.h +++ b/src/apps/cortex/TipManager/TipView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TipView.h // * PURPOSE // Provide a basic, extensible 'ToolTip' view, designed diff --git a/src/apps/cortex/TipManager/TipWindow.cpp b/src/apps/cortex/TipManager/TipWindow.cpp index 940dec30e9..1cda91bde3 100644 --- a/src/apps/cortex/TipManager/TipWindow.cpp +++ b/src/apps/cortex/TipManager/TipWindow.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TipWindow.cpp #include "TipWindow.h" diff --git a/src/apps/cortex/TipManager/TipWindow.h b/src/apps/cortex/TipManager/TipWindow.h index a1eac8d074..a686ba3e3c 100644 --- a/src/apps/cortex/TipManager/TipWindow.h +++ b/src/apps/cortex/TipManager/TipWindow.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TipWindow.h // * PURPOSE // A floating window used to display floating tips diff --git a/src/apps/cortex/TransportView/TransportView.cpp b/src/apps/cortex/TransportView/TransportView.cpp index 96be0ae409..48247ae2ed 100644 --- a/src/apps/cortex/TransportView/TransportView.cpp +++ b/src/apps/cortex/TransportView/TransportView.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TransportView.cpp #include "TransportView.h" diff --git a/src/apps/cortex/TransportView/TransportView.h b/src/apps/cortex/TransportView/TransportView.h index 393858bb69..a82639df4e 100644 --- a/src/apps/cortex/TransportView/TransportView.h +++ b/src/apps/cortex/TransportView/TransportView.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TransportView.h // * PURPOSE // UI component (view) providing access to a selected diff --git a/src/apps/cortex/TransportView/TransportWindow.cpp b/src/apps/cortex/TransportView/TransportWindow.cpp index e1918326c2..023a815272 100644 --- a/src/apps/cortex/TransportView/TransportWindow.cpp +++ b/src/apps/cortex/TransportView/TransportWindow.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TransportWindow.cpp #include "TransportWindow.h" diff --git a/src/apps/cortex/TransportView/TransportWindow.h b/src/apps/cortex/TransportView/TransportWindow.h index a821348483..f323267ba5 100644 --- a/src/apps/cortex/TransportView/TransportWindow.h +++ b/src/apps/cortex/TransportView/TransportWindow.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TransportWindow.h // // * PURPOSE diff --git a/src/apps/cortex/ValControl/NumericValControl.cpp b/src/apps/cortex/ValControl/NumericValControl.cpp index 3ea916627c..08a4c64702 100644 --- a/src/apps/cortex/ValControl/NumericValControl.cpp +++ b/src/apps/cortex/ValControl/NumericValControl.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NumericValControl.cpp // e.moon 30jan99 diff --git a/src/apps/cortex/ValControl/NumericValControl.h b/src/apps/cortex/ValControl/NumericValControl.h index 2e20865e8a..02a51264e6 100644 --- a/src/apps/cortex/ValControl/NumericValControl.h +++ b/src/apps/cortex/ValControl/NumericValControl.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NumericValControl.h // * PURPOSE // Extends ValControl to provide the basis for a variety diff --git a/src/apps/cortex/ValControl/StringValControl.h b/src/apps/cortex/ValControl/StringValControl.h index 052d1023b0..25937a0f6f 100644 --- a/src/apps/cortex/ValControl/StringValControl.h +++ b/src/apps/cortex/ValControl/StringValControl.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // StringValControl.h // e.moon 17jan99 diff --git a/src/apps/cortex/ValControl/ValControl.cpp b/src/apps/cortex/ValControl/ValControl.cpp index 3ef2aec6ce..cf2c1b0d4f 100644 --- a/src/apps/cortex/ValControl/ValControl.cpp +++ b/src/apps/cortex/ValControl/ValControl.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ValControl.cpp #include "ValControl.h" diff --git a/src/apps/cortex/ValControl/ValControl.h b/src/apps/cortex/ValControl/ValControl.h index fca066f4cb..a1e5d4599c 100644 --- a/src/apps/cortex/ValControl/ValControl.h +++ b/src/apps/cortex/ValControl/ValControl.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ValControl.h // +++++ cortex integration 23aug99: // - way too many protected members diff --git a/src/apps/cortex/ValControl/ValControlDigitSegment.cpp b/src/apps/cortex/ValControl/ValControlDigitSegment.cpp index 8373f8f20d..905d1a005b 100644 --- a/src/apps/cortex/ValControl/ValControlDigitSegment.cpp +++ b/src/apps/cortex/ValControl/ValControlDigitSegment.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ValControlDigitSegment.cpp #include "ValControlDigitSegment.h" diff --git a/src/apps/cortex/ValControl/ValControlDigitSegment.h b/src/apps/cortex/ValControl/ValControlDigitSegment.h index 210f300380..2769647389 100644 --- a/src/apps/cortex/ValControl/ValControlDigitSegment.h +++ b/src/apps/cortex/ValControl/ValControlDigitSegment.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ValControlDigitSegment.h // * PURPOSE // Represents a fixed number of digits in a numeric value- diff --git a/src/apps/cortex/ValControl/ValControlSegment.cpp b/src/apps/cortex/ValControl/ValControlSegment.cpp index af695b981d..3ae7a7407e 100644 --- a/src/apps/cortex/ValControl/ValControlSegment.cpp +++ b/src/apps/cortex/ValControl/ValControlSegment.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ValControlSegment.cpp // e.moon 20jan99 diff --git a/src/apps/cortex/ValControl/ValControlSegment.h b/src/apps/cortex/ValControl/ValControlSegment.h index e4525bda3a..8dae0d3b38 100644 --- a/src/apps/cortex/ValControl/ValControlSegment.h +++ b/src/apps/cortex/ValControl/ValControlSegment.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ValControlSegment.h // +++++ cortex integration 23aug99: // - allow adjustment of dragScaleFactor diff --git a/src/apps/cortex/ValControl/ValCtrlLayoutEntry.cpp b/src/apps/cortex/ValControl/ValCtrlLayoutEntry.cpp index 06c6aec001..f2aa04c83c 100644 --- a/src/apps/cortex/ValControl/ValCtrlLayoutEntry.cpp +++ b/src/apps/cortex/ValControl/ValCtrlLayoutEntry.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ValCtrlLayoutEntry.cpp // e.moon 29jan99 diff --git a/src/apps/cortex/ValControl/ValCtrlLayoutEntry.h b/src/apps/cortex/ValControl/ValCtrlLayoutEntry.h index f96431962f..14efbf12d6 100644 --- a/src/apps/cortex/ValControl/ValCtrlLayoutEntry.h +++ b/src/apps/cortex/ValControl/ValCtrlLayoutEntry.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ValCtrlValCtrlLayoutEntry.h // +++++ cortex integration 23aug99: // hide this class! diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.cpp b/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.cpp index 922f194957..bf52579c8d 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.cpp +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioAdapterAddOn.cpp #include "AudioAdapterAddOn.h" diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.h b/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.h index e135172774..42a74b036e 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.h +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioAdapterAddOn.h // * PURPOSE // To test the IAudioOp framework, this add-on creates diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.cpp b/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.cpp index 1b7db738b1..eb52a03eff 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.cpp +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioAdapterNode.cpp #include "AudioAdapterNode.h" diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.h b/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.h index 241fb5755c..a2618bb8ec 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.h +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioAdapterNode.h #ifndef AUDIO_ADAPTER_NODE_H #define AUDIO_ADAPTER_NODE_H diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.cpp b/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.cpp index c84b9aaa1f..bdb2d21f1a 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.cpp +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioAdapterParams.cpp #include "AudioAdapterParams.h" diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.h b/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.h index 40c305a2d9..5500ac332f 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.h +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioAdapterParams.h #ifndef AUDIO_ADAPTER_PARAMS_H #define AUDIO_ADAPTER_PARAMS_H diff --git a/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp b/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp index e3f6c41c64..884a07dcf4 100644 --- a/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp +++ b/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FlangerAddOn.cpp // e.moon 16jun99 diff --git a/src/apps/cortex/addons/Flanger/FlangerAddOn.h b/src/apps/cortex/addons/Flanger/FlangerAddOn.h index 4aa3a1b7c9..20b1aac50e 100644 --- a/src/apps/cortex/addons/Flanger/FlangerAddOn.h +++ b/src/apps/cortex/addons/Flanger/FlangerAddOn.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FlangerAddOn.h // PURPOSE // * add-on class for FlangerNode diff --git a/src/apps/cortex/addons/Flanger/FlangerApp.cpp b/src/apps/cortex/addons/Flanger/FlangerApp.cpp index 5c488fb097..2dc1640cf2 100644 --- a/src/apps/cortex/addons/Flanger/FlangerApp.cpp +++ b/src/apps/cortex/addons/Flanger/FlangerApp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FlangerApp.cpp // e.moon 16jun99 diff --git a/src/apps/cortex/addons/Flanger/FlangerNode.cpp b/src/apps/cortex/addons/Flanger/FlangerNode.cpp index 51225d8da8..157ee1a9b7 100644 --- a/src/apps/cortex/addons/Flanger/FlangerNode.cpp +++ b/src/apps/cortex/addons/Flanger/FlangerNode.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FlangerNode.cpp // e.moon 16jun99 diff --git a/src/apps/cortex/addons/Flanger/FlangerNode.h b/src/apps/cortex/addons/Flanger/FlangerNode.h index e124ed22db..d9adabf4f7 100644 --- a/src/apps/cortex/addons/Flanger/FlangerNode.h +++ b/src/apps/cortex/addons/Flanger/FlangerNode.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // FlangerNode.h // * PURPOSE // - implements a basic audio filter diff --git a/src/apps/cortex/addons/LoggingConsumer/LogWriter.cpp b/src/apps/cortex/addons/LoggingConsumer/LogWriter.cpp index 410892ce3e..77b2eac77f 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LogWriter.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/LogWriter.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LogWriter.cpp #include "LogWriter.h" diff --git a/src/apps/cortex/addons/LoggingConsumer/LogWriter.h b/src/apps/cortex/addons/LoggingConsumer/LogWriter.h index e21842db44..b007bc2984 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LogWriter.h +++ b/src/apps/cortex/addons/LoggingConsumer/LogWriter.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LogWriter.h #ifndef LogWriter_H diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp index f2d8832884..28accd0d3e 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LoggingConsumer.cpp #include "LoggingConsumer.h" diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.h b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.h index 9476c31d64..7d09573185 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.h +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LoggingConsumer.h #ifndef LoggingConsumer_H diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.cpp b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.cpp index 6214ada8a2..925c6f3297 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LoggingConsumerAddOn.cpp // e.moon 4jun99 diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.h b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.h index 4446f4afdd..7d8f0a22a6 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.h +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LoggingConsumerAddOn.h // e.moon 11jun99 // diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerApp.cpp b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerApp.cpp index 6cc67f456b..0424020841 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerApp.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerApp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // LoggingConsumerApp.cpp // // HISTORY diff --git a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.cpp b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.cpp index 25c7c1b909..16c88a7df9 100644 --- a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeHarnessApp.cpp #include "NodeHarnessApp.h" diff --git a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.h b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.h index df212b5da4..d10d133cbf 100644 --- a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.h +++ b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeHarnessApp.h #ifndef NodeHarnessApp_H diff --git a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.cpp b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.cpp index f9a2002bd4..f41a039c9b 100644 --- a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeHarnessWin.cpp #include "NodeHarnessWin.h" diff --git a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.h b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.h index 55e8225f09..08f9edcb1b 100644 --- a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.h +++ b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NodeHarnessWin.h #ifndef NodeHarnessWin_H diff --git a/src/apps/cortex/addons/NullFilter/NullFilterAddOn.cpp b/src/apps/cortex/addons/NullFilter/NullFilterAddOn.cpp index d153a2465a..e1e8c32461 100644 --- a/src/apps/cortex/addons/NullFilter/NullFilterAddOn.cpp +++ b/src/apps/cortex/addons/NullFilter/NullFilterAddOn.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NullFilterAddOn.cpp #include "NullFilterAddOn.h" diff --git a/src/apps/cortex/addons/NullFilter/NullFilterAddOn.h b/src/apps/cortex/addons/NullFilter/NullFilterAddOn.h index 4fb3c59011..3a49cb63cf 100644 --- a/src/apps/cortex/addons/NullFilter/NullFilterAddOn.h +++ b/src/apps/cortex/addons/NullFilter/NullFilterAddOn.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NullFilterAddOn.h // * PURPOSE // To test the IAudioOp framework, this add-on creates diff --git a/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.cpp b/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.cpp index 1fd66eed7a..7cf94aa045 100644 --- a/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.cpp +++ b/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* NodeHarnessApp.cpp diff --git a/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.h b/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.h index afb16e43d3..2ed9d1a68e 100644 --- a/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.h +++ b/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* NodeHarnessApp.h diff --git a/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.cpp b/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.cpp index 81fa3e522f..37b0e3ebf1 100644 --- a/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.cpp +++ b/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* NodeHarnessWin.cpp diff --git a/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.h b/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.h index cf1587f2c1..88857acd01 100644 --- a/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.h +++ b/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* NodeHarnessWin.h diff --git a/src/apps/cortex/addons/ToneProducer/ToneProducer.cpp b/src/apps/cortex/addons/ToneProducer/ToneProducer.cpp index 458aa6f280..fa6d174fcc 100644 --- a/src/apps/cortex/addons/ToneProducer/ToneProducer.cpp +++ b/src/apps/cortex/addons/ToneProducer/ToneProducer.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* ToneProducer.cpp diff --git a/src/apps/cortex/addons/ToneProducer/ToneProducer.h b/src/apps/cortex/addons/ToneProducer/ToneProducer.h index fb6edc7114..644b7c1a0e 100644 --- a/src/apps/cortex/addons/ToneProducer/ToneProducer.h +++ b/src/apps/cortex/addons/ToneProducer/ToneProducer.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* ToneProducer.h diff --git a/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.cpp b/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.cpp index efc6fd728a..d2a710e9b2 100644 --- a/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.cpp +++ b/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ToneProducerAddOn.cpp // e.moon 4jun99 diff --git a/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.h b/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.h index 656c3ae49d..da4cd92133 100644 --- a/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.h +++ b/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ToneProducerAddOn.h // e.moon 4jun99 // diff --git a/src/apps/cortex/addons/ToneProducer/main.cpp b/src/apps/cortex/addons/ToneProducer/main.cpp index 7ba4ef61e6..5adaae9ade 100644 --- a/src/apps/cortex/addons/ToneProducer/main.cpp +++ b/src/apps/cortex/addons/ToneProducer/main.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* ToneProducerApp main.cpp diff --git a/src/apps/cortex/addons/audioOps/AudioAdapterOp.cpp b/src/apps/cortex/addons/audioOps/AudioAdapterOp.cpp index 2d7bd9aef9..66fcfcc233 100644 --- a/src/apps/cortex/addons/audioOps/AudioAdapterOp.cpp +++ b/src/apps/cortex/addons/audioOps/AudioAdapterOp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioAdapterOp.cpp #include "AudioAdapterOp.h" diff --git a/src/apps/cortex/addons/audioOps/AudioAdapterOp.h b/src/apps/cortex/addons/audioOps/AudioAdapterOp.h index 6071abdfd2..f62312de82 100644 --- a/src/apps/cortex/addons/audioOps/AudioAdapterOp.h +++ b/src/apps/cortex/addons/audioOps/AudioAdapterOp.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioAdapterOp.h // * PURPOSE // An IAudioOp/IAudioOpFactory implementation providing diff --git a/src/apps/cortex/addons/audioOps/NullAudioOp.cpp b/src/apps/cortex/addons/audioOps/NullAudioOp.cpp index aa167223ae..902a415b8e 100644 --- a/src/apps/cortex/addons/audioOps/NullAudioOp.cpp +++ b/src/apps/cortex/addons/audioOps/NullAudioOp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NullAudioOp.cpp #include "NullAudioOp.h" diff --git a/src/apps/cortex/addons/audioOps/NullAudioOp.h b/src/apps/cortex/addons/audioOps/NullAudioOp.h index 4f54c59b4b..0957b26253 100644 --- a/src/apps/cortex/addons/audioOps/NullAudioOp.h +++ b/src/apps/cortex/addons/audioOps/NullAudioOp.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // NullAudioOp.h // * PURPOSE // To test the IAudioOp framework, this file includes diff --git a/src/apps/cortex/addons/audioOps/audio_op_tools.h b/src/apps/cortex/addons/audioOps/audio_op_tools.h index 39c974e4f4..13794f548a 100644 --- a/src/apps/cortex/addons/audioOps/audio_op_tools.h +++ b/src/apps/cortex/addons/audioOps/audio_op_tools.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // audio_op_tools.h // * PURPOSE // General-purpose audio processing functions. diff --git a/src/apps/cortex/addons/common/AudioBuffer.cpp b/src/apps/cortex/addons/common/AudioBuffer.cpp index b63b48c86f..47613bb93e 100644 --- a/src/apps/cortex/addons/common/AudioBuffer.cpp +++ b/src/apps/cortex/addons/common/AudioBuffer.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioBuffer.cpp // e.moon 31mar99 // diff --git a/src/apps/cortex/addons/common/AudioBuffer.h b/src/apps/cortex/addons/common/AudioBuffer.h index 67ca422802..11e372ad69 100644 --- a/src/apps/cortex/addons/common/AudioBuffer.h +++ b/src/apps/cortex/addons/common/AudioBuffer.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioBuffer.h // eamoon@meadgroup.com // 31mar99 diff --git a/src/apps/cortex/addons/common/AudioFilterNode.cpp b/src/apps/cortex/addons/common/AudioFilterNode.cpp index c8303bd038..79e413f0c9 100644 --- a/src/apps/cortex/addons/common/AudioFilterNode.cpp +++ b/src/apps/cortex/addons/common/AudioFilterNode.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioFilterNode.cpp #include "AudioFilterNode.h" diff --git a/src/apps/cortex/addons/common/AudioFilterNode.h b/src/apps/cortex/addons/common/AudioFilterNode.h index 3ab9b78e3b..d5c79e3e7a 100644 --- a/src/apps/cortex/addons/common/AudioFilterNode.h +++ b/src/apps/cortex/addons/common/AudioFilterNode.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AudioFilterNode.h // * PURPOSE // A framework class designed to make it easy to develop simple diff --git a/src/apps/cortex/addons/common/ControlAppLauncher.cpp b/src/apps/cortex/addons/common/ControlAppLauncher.cpp index d310303884..454f443fb5 100644 --- a/src/apps/cortex/addons/common/ControlAppLauncher.cpp +++ b/src/apps/cortex/addons/common/ControlAppLauncher.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ControlAppLauncher.cpp // e.moon 17jun99 diff --git a/src/apps/cortex/addons/common/ControlAppLauncher.h b/src/apps/cortex/addons/common/ControlAppLauncher.h index 3fbb4c26c6..f304a8b3f9 100644 --- a/src/apps/cortex/addons/common/ControlAppLauncher.h +++ b/src/apps/cortex/addons/common/ControlAppLauncher.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ControlAppLauncher.h // * PURPOSE // A ControlAppLauncher manages a control-panel application diff --git a/src/apps/cortex/addons/common/IAudioFilterOpFactory.h b/src/apps/cortex/addons/common/IAudioFilterOpFactory.h index 380152b945..dd0132df96 100644 --- a/src/apps/cortex/addons/common/IAudioFilterOpFactory.h +++ b/src/apps/cortex/addons/common/IAudioFilterOpFactory.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IAudioFilterOpFactory.h // * PURPOSE // An interface to an 'algorithm finder' object. Implementations diff --git a/src/apps/cortex/addons/common/IAudioOp.h b/src/apps/cortex/addons/common/IAudioOp.h index b105556b5a..a699e6dbf8 100644 --- a/src/apps/cortex/addons/common/IAudioOp.h +++ b/src/apps/cortex/addons/common/IAudioOp.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IAudioOp.h // * PURPOSE // Abstract audio-operation interface. Each implementation diff --git a/src/apps/cortex/addons/common/IAudioOpFactory.h b/src/apps/cortex/addons/common/IAudioOpFactory.h index a98d09b55f..a7caeffc77 100644 --- a/src/apps/cortex/addons/common/IAudioOpFactory.h +++ b/src/apps/cortex/addons/common/IAudioOpFactory.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IAudioOpFactory.h // * PURPOSE // An interface to an 'algorithm finder' object. Implementations diff --git a/src/apps/cortex/addons/common/IAudioOpHost.h b/src/apps/cortex/addons/common/IAudioOpHost.h index 382cb68a34..02e157e482 100644 --- a/src/apps/cortex/addons/common/IAudioOpHost.h +++ b/src/apps/cortex/addons/common/IAudioOpHost.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IAudioOpHost.h // * PURPOSE // This interface is used by audio-operation hosts (generally diff --git a/src/apps/cortex/addons/common/IParameterSet.cpp b/src/apps/cortex/addons/common/IParameterSet.cpp index 5fb5cd563e..41b1f520a9 100644 --- a/src/apps/cortex/addons/common/IParameterSet.cpp +++ b/src/apps/cortex/addons/common/IParameterSet.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IParameterSet.cpp #include "IParameterSet.h" diff --git a/src/apps/cortex/addons/common/IParameterSet.h b/src/apps/cortex/addons/common/IParameterSet.h index 69086b230e..0d90dd56ce 100644 --- a/src/apps/cortex/addons/common/IParameterSet.h +++ b/src/apps/cortex/addons/common/IParameterSet.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IParameterSet.h // * PURPOSE // An abstract parameter-collection object. Can be shared diff --git a/src/apps/cortex/addons/common/MediaNodeControlApp.cpp b/src/apps/cortex/addons/common/MediaNodeControlApp.cpp index a6053548bf..d90db03881 100644 --- a/src/apps/cortex/addons/common/MediaNodeControlApp.cpp +++ b/src/apps/cortex/addons/common/MediaNodeControlApp.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaNodeControlApp.cpp // e.moon 8jun99 diff --git a/src/apps/cortex/addons/common/MediaNodeControlApp.h b/src/apps/cortex/addons/common/MediaNodeControlApp.h index b4c6b72cc2..d0ecbe3fd7 100644 --- a/src/apps/cortex/addons/common/MediaNodeControlApp.h +++ b/src/apps/cortex/addons/common/MediaNodeControlApp.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaMediaNodeControlApp.h // // TO DO diff --git a/src/apps/cortex/addons/common/RawBuffer.cpp b/src/apps/cortex/addons/common/RawBuffer.cpp index aa7d27f6d4..0686ade91c 100644 --- a/src/apps/cortex/addons/common/RawBuffer.cpp +++ b/src/apps/cortex/addons/common/RawBuffer.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // RawBuffer.cpp // e.moon 31mar99 diff --git a/src/apps/cortex/addons/common/RawBuffer.h b/src/apps/cortex/addons/common/RawBuffer.h index d8bb8d15dc..5b4f213dae 100644 --- a/src/apps/cortex/addons/common/RawBuffer.h +++ b/src/apps/cortex/addons/common/RawBuffer.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // RawBuffer.h // eamoon@meadgroup.com // diff --git a/src/apps/cortex/addons/common/SoundUtils.cpp b/src/apps/cortex/addons/common/SoundUtils.cpp index e1fbd6fe68..cde3be3db4 100644 --- a/src/apps/cortex/addons/common/SoundUtils.cpp +++ b/src/apps/cortex/addons/common/SoundUtils.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /******************************************************************************* / / File: SoundUtils.cpp diff --git a/src/apps/cortex/addons/common/SoundUtils.h b/src/apps/cortex/addons/common/SoundUtils.h index c9e5ec86a9..be1af2a846 100644 --- a/src/apps/cortex/addons/common/SoundUtils.h +++ b/src/apps/cortex/addons/common/SoundUtils.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /******************************************************************************* / / File: SoundUtils.h diff --git a/src/apps/cortex/addons/common/audio_buffer_tools.h b/src/apps/cortex/addons/common/audio_buffer_tools.h index b701b13c85..8eba1bfd19 100644 --- a/src/apps/cortex/addons/common/audio_buffer_tools.h +++ b/src/apps/cortex/addons/common/audio_buffer_tools.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // audio_buffer_tools.h // eamoon@meadgroup.com // diff --git a/src/apps/cortex/cortex_defs.h b/src/apps/cortex/cortex_defs.h index afcd87ea23..a0cc72bdb1 100644 --- a/src/apps/cortex/cortex_defs.h +++ b/src/apps/cortex/cortex_defs.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // cortex_defs.h // * PURPOSE // Preprocessor stuff for the Cortex toolkit. diff --git a/src/apps/cortex/support/AddOnHostProtocol.h b/src/apps/cortex/support/AddOnHostProtocol.h index 8593f92636..731e02d555 100644 --- a/src/apps/cortex/support/AddOnHostProtocol.h +++ b/src/apps/cortex/support/AddOnHostProtocol.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // AddOnHostProtocol.h // * PURPOSE // contains all definitions needed for communications between diff --git a/src/apps/cortex/support/BasicThread.h b/src/apps/cortex/support/BasicThread.h index 10f45db383..18f6bbbb79 100644 --- a/src/apps/cortex/support/BasicThread.h +++ b/src/apps/cortex/support/BasicThread.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // BasicThread.h // based on ThreadPrimitive from the Be Newsletter // diff --git a/src/apps/cortex/support/ILockable.h b/src/apps/cortex/support/ILockable.h index 4a91c7a312..6965798e7b 100644 --- a/src/apps/cortex/support/ILockable.h +++ b/src/apps/cortex/support/ILockable.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ILockable.h (Cortex) // * PURPOSE // Simple interface by which an object's locking capabilites diff --git a/src/apps/cortex/support/IObservable.h b/src/apps/cortex/support/IObservable.h index f8e858baf5..a46d7e425c 100644 --- a/src/apps/cortex/support/IObservable.h +++ b/src/apps/cortex/support/IObservable.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // IObservable.h // * PURPOSE // Defines a general observable-object interface. diff --git a/src/apps/cortex/support/MediaIcon.cpp b/src/apps/cortex/support/MediaIcon.cpp index 1292148029..55c57cf4cc 100644 --- a/src/apps/cortex/support/MediaIcon.cpp +++ b/src/apps/cortex/support/MediaIcon.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaIcon.cpp #include "MediaIcon.h" diff --git a/src/apps/cortex/support/MediaIcon.h b/src/apps/cortex/support/MediaIcon.h index 8779980168..9583f90495 100644 --- a/src/apps/cortex/support/MediaIcon.h +++ b/src/apps/cortex/support/MediaIcon.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaIcon.h (Cortex/Support) // // * PURPOSE diff --git a/src/apps/cortex/support/MediaIconBits.h b/src/apps/cortex/support/MediaIconBits.h index f80f9f7079..59a2deb4f1 100644 --- a/src/apps/cortex/support/MediaIconBits.h +++ b/src/apps/cortex/support/MediaIconBits.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // File: MediaIconBits.h #ifndef __MediaIconBits_H__ diff --git a/src/apps/cortex/support/MediaString.cpp b/src/apps/cortex/support/MediaString.cpp index 34d417aa6f..e156380ad7 100644 --- a/src/apps/cortex/support/MediaString.cpp +++ b/src/apps/cortex/support/MediaString.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaString.cpp #include "MediaString.h" diff --git a/src/apps/cortex/support/MediaString.h b/src/apps/cortex/support/MediaString.h index 9d73b63aff..024375a93b 100644 --- a/src/apps/cortex/support/MediaString.h +++ b/src/apps/cortex/support/MediaString.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MediaStrings.h (Cortex/Support) // // * PURPOSE diff --git a/src/apps/cortex/support/MouseTrackingHelpers.cpp b/src/apps/cortex/support/MouseTrackingHelpers.cpp index 67749d63b9..1b71eb513e 100644 --- a/src/apps/cortex/support/MouseTrackingHelpers.cpp +++ b/src/apps/cortex/support/MouseTrackingHelpers.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MouseTrackingHelpers.cpp // e.moon 8mar99 diff --git a/src/apps/cortex/support/MouseTrackingHelpers.h b/src/apps/cortex/support/MouseTrackingHelpers.h index 423d9826be..404da1a8d3 100644 --- a/src/apps/cortex/support/MouseTrackingHelpers.h +++ b/src/apps/cortex/support/MouseTrackingHelpers.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // MouseTrackingHelpers.h // e.moon 8mar99 // diff --git a/src/apps/cortex/support/MultiInvoker.cpp b/src/apps/cortex/support/MultiInvoker.cpp index 701956ad35..4121820d6f 100644 --- a/src/apps/cortex/support/MultiInvoker.cpp +++ b/src/apps/cortex/support/MultiInvoker.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + //////////////////////////////////////////////////////////// // MultiInvoker.cpp // ---------------- diff --git a/src/apps/cortex/support/MultiInvoker.h b/src/apps/cortex/support/MultiInvoker.h index c38534c850..7fa491dc4a 100644 --- a/src/apps/cortex/support/MultiInvoker.h +++ b/src/apps/cortex/support/MultiInvoker.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + //////////////////////////////////////////////////////////// // MultiInvoker.h // -------------- diff --git a/src/apps/cortex/support/ObservableHandler.cpp b/src/apps/cortex/support/ObservableHandler.cpp index 507664eb23..53babd7ce2 100644 --- a/src/apps/cortex/support/ObservableHandler.cpp +++ b/src/apps/cortex/support/ObservableHandler.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ObservableHandler.cpp #include "ObservableHandler.h" diff --git a/src/apps/cortex/support/ObservableHandler.h b/src/apps/cortex/support/ObservableHandler.h index c03dcb1984..9f7c9e9227 100644 --- a/src/apps/cortex/support/ObservableHandler.h +++ b/src/apps/cortex/support/ObservableHandler.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ObservableHandler.h // * PURPOSE // Implementation of an observable BHandler. diff --git a/src/apps/cortex/support/ObservableLooper.cpp b/src/apps/cortex/support/ObservableLooper.cpp index 21e7338eba..c19c37ab91 100644 --- a/src/apps/cortex/support/ObservableLooper.cpp +++ b/src/apps/cortex/support/ObservableLooper.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ObservableLooper.cpp #include "ObservableLooper.h" diff --git a/src/apps/cortex/support/ObservableLooper.h b/src/apps/cortex/support/ObservableLooper.h index 083e83f4c7..cdef2490e5 100644 --- a/src/apps/cortex/support/ObservableLooper.h +++ b/src/apps/cortex/support/ObservableLooper.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ObservableLooper.h // * PURPOSE // Implementation of an observable (target) derived diff --git a/src/apps/cortex/support/ProfileBlock.h b/src/apps/cortex/support/ProfileBlock.h index c4fadfa547..6d84742f6a 100644 --- a/src/apps/cortex/support/ProfileBlock.h +++ b/src/apps/cortex/support/ProfileBlock.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ProfileBlock.h // e.moon 19may99 // diff --git a/src/apps/cortex/support/ProfileTarget.cpp b/src/apps/cortex/support/ProfileTarget.cpp index dc011d8501..665ab570e1 100644 --- a/src/apps/cortex/support/ProfileTarget.cpp +++ b/src/apps/cortex/support/ProfileTarget.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ProfileTarget.cpp #include "ProfileTarget.h" diff --git a/src/apps/cortex/support/ProfileTarget.h b/src/apps/cortex/support/ProfileTarget.h index 329bfc0e50..89a6a7d1b6 100644 --- a/src/apps/cortex/support/ProfileTarget.h +++ b/src/apps/cortex/support/ProfileTarget.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ProfileTarget.h // e.moon 19may99 // diff --git a/src/apps/cortex/support/ScrollHelpers.h b/src/apps/cortex/support/ScrollHelpers.h index 8a3a2d5972..3f5abe2d9f 100644 --- a/src/apps/cortex/support/ScrollHelpers.h +++ b/src/apps/cortex/support/ScrollHelpers.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // ScrollHelpers.h // e.moon 9mar99 // diff --git a/src/apps/cortex/support/SimpleLockable.h b/src/apps/cortex/support/SimpleLockable.h index 14c5b4afc5..c33a8d94f0 100644 --- a/src/apps/cortex/support/SimpleLockable.h +++ b/src/apps/cortex/support/SimpleLockable.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // SimpleLockable.h // * PURPOSE // Basic BLocker implementation of ILockable. diff --git a/src/apps/cortex/support/SoundUtils.cpp b/src/apps/cortex/support/SoundUtils.cpp index e1fbd6fe68..cde3be3db4 100644 --- a/src/apps/cortex/support/SoundUtils.cpp +++ b/src/apps/cortex/support/SoundUtils.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /******************************************************************************* / / File: SoundUtils.cpp diff --git a/src/apps/cortex/support/SoundUtils.h b/src/apps/cortex/support/SoundUtils.h index c9e5ec86a9..be1af2a846 100644 --- a/src/apps/cortex/support/SoundUtils.h +++ b/src/apps/cortex/support/SoundUtils.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /******************************************************************************* / / File: SoundUtils.h diff --git a/src/apps/cortex/support/TextControlFloater.cpp b/src/apps/cortex/support/TextControlFloater.cpp index 7b62cb049c..e49e94f2b8 100644 --- a/src/apps/cortex/support/TextControlFloater.cpp +++ b/src/apps/cortex/support/TextControlFloater.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TextControlFloater.cpp #include "TextControlFloater.h" diff --git a/src/apps/cortex/support/TextControlFloater.h b/src/apps/cortex/support/TextControlFloater.h index 5bce886ec2..736cfebde3 100644 --- a/src/apps/cortex/support/TextControlFloater.h +++ b/src/apps/cortex/support/TextControlFloater.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // TextControlFloater.h // * PURPOSE // Display an editable text field in a simple pop-up window diff --git a/src/apps/cortex/support/array_delete.h b/src/apps/cortex/support/array_delete.h index 9568203399..72bc13067b 100644 --- a/src/apps/cortex/support/array_delete.h +++ b/src/apps/cortex/support/array_delete.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /******************************************************************************* / / File: array_delete.h diff --git a/src/apps/cortex/support/cortex_ui.h b/src/apps/cortex/support/cortex_ui.h index 345f9f1f53..375b5cdea7 100644 --- a/src/apps/cortex/support/cortex_ui.h +++ b/src/apps/cortex/support/cortex_ui.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // cortex_ui.h // // * PURPOSE diff --git a/src/apps/cortex/support/debug_tools.cpp b/src/apps/cortex/support/debug_tools.cpp index 685b5ac1ca..119668c1e9 100644 --- a/src/apps/cortex/support/debug_tools.cpp +++ b/src/apps/cortex/support/debug_tools.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // debug_tools.cpp #include "debug_tools.h" diff --git a/src/apps/cortex/support/debug_tools.h b/src/apps/cortex/support/debug_tools.h index 17893ff824..44e90ceb80 100644 --- a/src/apps/cortex/support/debug_tools.h +++ b/src/apps/cortex/support/debug_tools.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // debug_tools.h #ifndef __CORTEX_DEBUGTOOLS_H__ diff --git a/src/apps/cortex/support/functional_tools.h b/src/apps/cortex/support/functional_tools.h index a13cc834a9..39583b0da8 100644 --- a/src/apps/cortex/support/functional_tools.h +++ b/src/apps/cortex/support/functional_tools.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // functional_tools.h // // PURPOSE diff --git a/src/apps/cortex/support/observe.cpp b/src/apps/cortex/support/observe.cpp index 9bbb6ab0b7..f55ad9c419 100644 --- a/src/apps/cortex/support/observe.cpp +++ b/src/apps/cortex/support/observe.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // observe.cpp #include "observe.h" diff --git a/src/apps/cortex/support/observe.h b/src/apps/cortex/support/observe.h index 032c3fcea2..37379f7f22 100644 --- a/src/apps/cortex/support/observe.h +++ b/src/apps/cortex/support/observe.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // Observe.h (cortex) // * PURPOSE // Messages used for implementation of the Observer pattern. diff --git a/src/apps/cortex/support/set_tools.h b/src/apps/cortex/support/set_tools.h index 1851f7d9da..23fce8ee0b 100644 --- a/src/apps/cortex/support/set_tools.h +++ b/src/apps/cortex/support/set_tools.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 1999-2000, Eric Moon. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions, and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + // set_tools.h // e.moon 7may99 // From a820304d869a0ca5cf3135c3c8267fdc853cf90a Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sun, 14 Aug 2011 18:05:48 +0000 Subject: [PATCH 183/702] Adjusted the copyright header, to account for Be Sample Code License and copyrights. Automatic whitespace cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42635 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../cortex/addons/LoggingConsumer/LICENSE.Be | 31 ------- .../addons/LoggingConsumer/LogWriter.cpp | 11 +-- .../cortex/addons/LoggingConsumer/LogWriter.h | 1 + .../LoggingConsumer/LoggingConsumer.cpp | 63 ++++++------- .../addons/LoggingConsumer/LoggingConsumer.h | 7 +- .../LoggingConsumer/LoggingConsumerAddOn.cpp | 17 ++-- .../LoggingConsumer/LoggingConsumerAddOn.h | 5 +- .../LoggingConsumer/LoggingConsumerApp.cpp | 3 +- .../addons/LoggingConsumer/NodeHarnessApp.cpp | 3 +- .../addons/LoggingConsumer/NodeHarnessApp.h | 1 + .../addons/LoggingConsumer/NodeHarnessWin.cpp | 9 +- .../addons/LoggingConsumer/NodeHarnessWin.h | 1 + .../cortex/addons/ToneProducer/LICENSE.Be | 31 ------- .../addons/ToneProducer/NodeHarnessApp.cpp | 10 +-- .../addons/ToneProducer/NodeHarnessApp.h | 8 +- .../addons/ToneProducer/NodeHarnessWin.cpp | 18 ++-- .../addons/ToneProducer/NodeHarnessWin.h | 8 +- .../addons/ToneProducer/ToneProducer.cpp | 90 +++++++++---------- .../cortex/addons/ToneProducer/ToneProducer.h | 16 ++-- .../addons/ToneProducer/ToneProducerAddOn.cpp | 19 ++-- .../addons/ToneProducer/ToneProducerAddOn.h | 5 +- src/apps/cortex/addons/ToneProducer/main.cpp | 10 +-- src/apps/cortex/addons/common/LICENSE.Be | 31 ------- src/apps/cortex/addons/common/SoundUtils.cpp | 3 +- src/apps/cortex/addons/common/SoundUtils.h | 5 +- src/apps/cortex/support/LICENSE.Be | 40 --------- src/apps/cortex/support/MultiInvoker.cpp | 10 +-- src/apps/cortex/support/MultiInvoker.h | 21 +++-- src/apps/cortex/support/SoundUtils.cpp | 3 +- src/apps/cortex/support/SoundUtils.h | 5 +- src/apps/cortex/support/array_delete.h | 3 +- 31 files changed, 163 insertions(+), 325 deletions(-) delete mode 100644 src/apps/cortex/addons/LoggingConsumer/LICENSE.Be delete mode 100644 src/apps/cortex/addons/ToneProducer/LICENSE.Be delete mode 100644 src/apps/cortex/addons/common/LICENSE.Be delete mode 100644 src/apps/cortex/support/LICENSE.Be diff --git a/src/apps/cortex/addons/LoggingConsumer/LICENSE.Be b/src/apps/cortex/addons/LoggingConsumer/LICENSE.Be deleted file mode 100644 index 86a4268fa9..0000000000 --- a/src/apps/cortex/addons/LoggingConsumer/LICENSE.Be +++ /dev/null @@ -1,31 +0,0 @@ ----------------------- -Be Sample Code License ----------------------- - -Copyright 1991-1999, Be Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions, and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/apps/cortex/addons/LoggingConsumer/LogWriter.cpp b/src/apps/cortex/addons/LoggingConsumer/LogWriter.cpp index 77b2eac77f..d5e7d97563 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LogWriter.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/LogWriter.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -145,7 +146,7 @@ LogWriter::~LogWriter() // // This method, called by the client, really just enqueues a message to the writer thread, // which will deal with it in the HandleMessage() method. -void +void LogWriter::Log(log_what what, const log_message& data) { bigtime_t now = ::system_time(); @@ -155,7 +156,7 @@ LogWriter::Log(log_what what, const log_message& data) } // Enable or disable a particular log_what code's output -void +void LogWriter::SetEnabled(log_what what, bool enable) { if (enable) mFilters.erase(what); @@ -163,7 +164,7 @@ LogWriter::SetEnabled(log_what what, bool enable) } // enabling everything means just clearing out the filter set -void +void LogWriter::EnableAllMessages() { mFilters.clear(); @@ -171,7 +172,7 @@ LogWriter::EnableAllMessages() // disabling everything is more tedious -- we have to add them all to the // filter set, one by one -void +void LogWriter::DisableAllMessages() { // mFilters.insert(LOG_QUIT); // don't disable our quit messages @@ -222,7 +223,7 @@ LogWriter::DisableAllMessages() // Writer thread's message handling function -- this is where messages are actuall // formatted and written to the log file -void +void LogWriter::HandleMessage(log_what what, const log_message& msg) { char buf[256]; // scratch buffer for building logged output diff --git a/src/apps/cortex/addons/LoggingConsumer/LogWriter.h b/src/apps/cortex/addons/LoggingConsumer/LogWriter.h index b007bc2984..8150d12b51 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LogWriter.h +++ b/src/apps/cortex/addons/LoggingConsumer/LogWriter.h @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp index 28accd0d3e..5d67863007 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -92,7 +93,7 @@ static BParameterWeb* build_parameter_web() LoggingConsumer::LoggingConsumer( const entry_ref& logFile, BMediaAddOn* pAddOn) - + : BMediaNode("LoggingConsumer"), BBufferConsumer(B_MEDIA_UNKNOWN_TYPE), BControllable(), @@ -135,19 +136,19 @@ LoggingConsumer::~LoggingConsumer() // Log message filtering control // -void +void LoggingConsumer::SetEnabled(log_what what, bool enable) { mLogger->SetEnabled(what, enable); } -void +void LoggingConsumer::EnableAllMessages() { mLogger->EnableAllMessages(); } -void +void LoggingConsumer::DisableAllMessages() { mLogger->DisableAllMessages(); @@ -170,7 +171,7 @@ LoggingConsumer::AddOn(int32 *internal_id) const return NULL; } -void +void LoggingConsumer::SetRunMode(run_mode mode) { // !!! Need to handle offline mode etc. properly! @@ -181,7 +182,7 @@ LoggingConsumer::SetRunMode(run_mode mode) BMediaEventLooper::SetRunMode(mode); } -void +void LoggingConsumer::Preroll() { log_message logMsg; @@ -191,7 +192,7 @@ LoggingConsumer::Preroll() BMediaEventLooper::Preroll(); } -void +void LoggingConsumer::SetTimeSource(BTimeSource* time_source) { log_message logMsg; @@ -201,7 +202,7 @@ LoggingConsumer::SetTimeSource(BTimeSource* time_source) BMediaNode::SetTimeSource(time_source); } -status_t +status_t LoggingConsumer::RequestCompleted(const media_request_info &info) { log_message logMsg; @@ -211,7 +212,7 @@ LoggingConsumer::RequestCompleted(const media_request_info &info) return BMediaNode::RequestCompleted(info); } -// e.moon [11jun99; testing add-on] +// e.moon [11jun99; testing add-on] status_t LoggingConsumer::DeleteHook(BMediaNode* pNode) { PRINT(("LoggingConsumer::DeleteHook(%p)\n", pNode)); @@ -225,7 +226,7 @@ LoggingConsumer::DeleteHook(BMediaNode* pNode) { // BControllable methods // -status_t +status_t LoggingConsumer::GetParameterValue(int32 id, bigtime_t* last_change, void* value, size_t* ioSize) { log_message logMsg; @@ -266,7 +267,7 @@ LoggingConsumer::GetParameterValue(int32 id, bigtime_t* last_change, void* value return B_OK; } -void +void LoggingConsumer::SetParameterValue(int32 id, bigtime_t performance_time, const void* value, size_t size) { log_message logMsg; @@ -298,7 +299,7 @@ LoggingConsumer::SetParameterValue(int32 id, bigtime_t performance_time, const v // BBufferConsumer methods // -status_t +status_t LoggingConsumer::HandleMessage(int32 message, const void *data, size_t size) { log_message logMsg; @@ -315,7 +316,7 @@ LoggingConsumer::HandleMessage(int32 message, const void *data, size_t size) // all of these next methods are pure virtual in BBufferConsumer -status_t +status_t LoggingConsumer::AcceptFormat(const media_destination& dest, media_format* format) { char formatStr[256]; @@ -334,14 +335,14 @@ LoggingConsumer::AcceptFormat(const media_destination& dest, media_format* forma return B_OK; } -status_t +status_t LoggingConsumer::GetNextInput(int32* cookie, media_input* out_input) { // we have a single hardcoded input that can accept any kind of media data if (0 == *cookie) { mInput.format.type = B_MEDIA_UNKNOWN_TYPE; // accept any format - + *out_input = mInput; *cookie = 1; return B_OK; @@ -349,14 +350,14 @@ LoggingConsumer::GetNextInput(int32* cookie, media_input* out_input) else return B_BAD_INDEX; } -void +void LoggingConsumer::DisposeInputCookie(int32 /*cookie*/ ) { // we don't use any kind of state or extra storage for iterating over our // inputs, so we don't have to do any special disposal of input cookies. } -void +void LoggingConsumer::BufferReceived(BBuffer* buffer) { bigtime_t bufferStart = buffer->Header()->start_time; @@ -393,7 +394,7 @@ LoggingConsumer::BufferReceived(BBuffer* buffer) } } -void +void LoggingConsumer::ProducerDataStatus(const media_destination& for_whom, int32 status, bigtime_t at_performance_time) { log_message logMsg; @@ -409,7 +410,7 @@ LoggingConsumer::ProducerDataStatus(const media_destination& for_whom, int32 sta } } -status_t +status_t LoggingConsumer::GetLatencyFor(const media_destination& for_whom, bigtime_t* out_latency, media_node_id* out_timesource) { // make sure this is one of my valid inputs @@ -422,7 +423,7 @@ LoggingConsumer::GetLatencyFor(const media_destination& for_whom, bigtime_t* out return B_OK; } -status_t +status_t LoggingConsumer::Connected( const media_source& producer, const media_destination& where, @@ -454,7 +455,7 @@ LoggingConsumer::Connected( return B_OK; } -void +void LoggingConsumer::Disconnected( const media_source& producer, const media_destination& where) @@ -467,7 +468,7 @@ LoggingConsumer::Disconnected( memset(&mInput, 0, sizeof(mInput)); } -status_t +status_t LoggingConsumer::FormatChanged( const media_source& producer, const media_destination& consumer, @@ -481,7 +482,7 @@ LoggingConsumer::FormatChanged( return B_OK; } -status_t +status_t LoggingConsumer::SeekTagRequested( const media_destination& destination, bigtime_t in_target_time, @@ -501,7 +502,7 @@ LoggingConsumer::SeekTagRequested( // BMediaEventLooper virtual methods // -void +void LoggingConsumer::NodeRegistered() { log_message logMsg; @@ -523,7 +524,7 @@ LoggingConsumer::NodeRegistered() strcpy(mInput.name, "Logged input"); } -void +void LoggingConsumer::Start(bigtime_t performance_time) { PRINT(("LoggingConsumer::Start(%Ld): now %Ld\n", performance_time, TimeSource()->Now())); @@ -535,7 +536,7 @@ LoggingConsumer::Start(bigtime_t performance_time) BMediaEventLooper::Start(performance_time); } -void +void LoggingConsumer::Stop(bigtime_t performance_time, bool immediate) { log_message logMsg; @@ -545,7 +546,7 @@ LoggingConsumer::Stop(bigtime_t performance_time, bool immediate) BMediaEventLooper::Stop(performance_time, immediate); } -void +void LoggingConsumer::Seek(bigtime_t media_time, bigtime_t performance_time) { log_message logMsg; @@ -555,7 +556,7 @@ LoggingConsumer::Seek(bigtime_t media_time, bigtime_t performance_time) BMediaEventLooper::Seek(media_time, performance_time); } -void +void LoggingConsumer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time) { log_message logMsg; @@ -565,7 +566,7 @@ LoggingConsumer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time) BMediaEventLooper::TimeWarp(at_real_time, to_performance_time); } -void +void LoggingConsumer::HandleEvent(const media_timed_event *event, bigtime_t /* lateness */, bool /* realTimeEvent */) { log_message logMsg; @@ -628,12 +629,12 @@ LoggingConsumer::HandleEvent(const media_timed_event *event, bigtime_t /* latene break; // !!! change to B_PARAMETER as soon as it's available - + // +++++ e.moon [16jun99] // !!! this can't be right: the parameter value is accessed by the pointer // originally passed to SetParameterValue(). there's no guarantee that // value's still valid, is there? - + case BTimedEventQueue::B_USER_EVENT: { size_t dataSize = size_t(event->data); diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.h b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.h index 7d09573185..015291e37a 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.h +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.h @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -138,7 +139,7 @@ public: /* the format; you should not ask him about it in here. */ status_t FormatChanged( const media_source& producer, - const media_destination& consumer, + const media_destination& consumer, int32 change_tag, const media_format& format); @@ -149,7 +150,7 @@ public: status_t SeekTagRequested( const media_destination& destination, bigtime_t in_target_time, - uint32 in_flags, + uint32 in_flags, media_seek_tag* out_seek_tag, bigtime_t* out_tagged_time, uint32* out_flags); @@ -181,7 +182,7 @@ private: bigtime_t mLastLatencyChange; // when did we last change our latency? bigtime_t mLastSpinChange; // when did we last change our CPU usage? bigtime_t mLastPrioChange; // when did we last change thread priority? - + // host addon // [11jun99] e.moon BMediaAddOn* m_pAddOn; diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.cpp b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.cpp index 925c6f3297..38d5a8a3c7 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -57,7 +58,7 @@ LoggingConsumerAddOn::~LoggingConsumerAddOn() { } LoggingConsumerAddOn::LoggingConsumerAddOn(image_id image) : BMediaAddOn(image) {} - + // -------------------------------------------------------- // // BMediaAddOn impl // -------------------------------------------------------- // @@ -66,7 +67,7 @@ status_t LoggingConsumerAddOn::InitCheck( const char** out_failure_text) { return B_OK; } - + int32 LoggingConsumerAddOn::CountFlavors() { return 1; } @@ -76,7 +77,7 @@ status_t LoggingConsumerAddOn::GetFlavorAt( const flavor_info** out_info) { if(n) return B_ERROR; - + flavor_info* pInfo = new flavor_info; pInfo->internal_id = n; pInfo->name = "LoggingConsumer"; @@ -87,7 +88,7 @@ status_t LoggingConsumerAddOn::GetFlavorAt( pInfo->kinds = B_BUFFER_CONSUMER | B_CONTROLLABLE; pInfo->flavor_flags = 0; pInfo->possible_count = 0; - + pInfo->in_format_count = 1; media_format* pFormat = new media_format; pFormat->type = B_MEDIA_UNKNOWN_TYPE; @@ -95,8 +96,8 @@ status_t LoggingConsumerAddOn::GetFlavorAt( pInfo->out_format_count = 0; pInfo->out_formats = 0; - - + + *out_info = pInfo; return B_OK; } @@ -109,7 +110,7 @@ BMediaNode* LoggingConsumerAddOn::InstantiateNodeFor( // initialize log file entry_ref ref; get_ref_for_path(g_pLogPath, &ref); - LoggingConsumer* pNode = new LoggingConsumer(ref, this); + LoggingConsumer* pNode = new LoggingConsumer(ref, this); // trim down the log's verbosity a touch pNode->SetEnabled(LOG_HANDLE_EVENT, false); @@ -120,7 +121,7 @@ BMediaNode* LoggingConsumerAddOn::InstantiateNodeFor( status_t LoggingConsumerAddOn::GetConfigurationFor( BMediaNode* your_node, BMessage* into_message) { - + // no config yet return B_OK; } diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.h b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.h index 7d8f0a22a6..80185948ee 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.h +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerAddOn.h @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -46,11 +47,11 @@ class LoggingConsumerAddOn : public BMediaAddOn { typedef BMediaAddOn _inherited; - + public: // ctor/dtor virtual ~LoggingConsumerAddOn(); explicit LoggingConsumerAddOn(image_id image); - + public: // BMediaAddOn impl virtual status_t InitCheck( const char** out_failure_text); diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerApp.cpp b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerApp.cpp index 0424020841..e5eb2313df 100644 --- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerApp.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumerApp.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -32,7 +33,7 @@ // LoggingConsumerApp.cpp // // HISTORY -// eamoon@meadgroup.com 11june99 +// eamoon@meadgroup.com 11june99 // [origin: Be Developer Newsletter III.18: 5may99] #include "NodeHarnessApp.h" diff --git a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.cpp b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.cpp index 16c88a7df9..09a53d0fe0 100644 --- a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -39,7 +40,7 @@ NodeHarnessApp::NodeHarnessApp(const char *signature) { } -void +void NodeHarnessApp::ReadyToRun() { BWindow* win = new NodeHarnessWin(BRect(100, 200, 210, 330), "NodeLogger"); diff --git a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.h b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.h index d10d133cbf..24d12144f0 100644 --- a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.h +++ b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessApp.h @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * diff --git a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.cpp b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.cpp index f41a039c9b..df486b62f5 100644 --- a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.cpp +++ b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -98,14 +99,14 @@ NodeHarnessWin::~NodeHarnessWin() } } -void +void NodeHarnessWin::Quit() { be_app->PostMessage(B_QUIT_REQUESTED); BWindow::Quit(); } -void +void NodeHarnessWin::MessageReceived(BMessage *msg) { status_t err; @@ -199,7 +200,7 @@ NodeHarnessWin::MessageReceived(BMessage *msg) bigtime_t latency; r->GetLatencyFor(mConnection.producer, &latency); printf("Setting producer run mode latency to %Ld\n", latency); - r->SetProducerRunModeDelay(mConnection.producer, latency + 6000); + r->SetProducerRunModeDelay(mConnection.producer, latency + 6000); // preroll first, to be a good citizen r->PrerollNode(mConnection.consumer); @@ -239,7 +240,7 @@ NodeHarnessWin::MessageReceived(BMessage *msg) } // Private routines -void +void NodeHarnessWin::StopNodes() { mStartButton->SetEnabled(true); diff --git a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.h b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.h index 08f9edcb1b..ed242a6928 100644 --- a/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.h +++ b/src/apps/cortex/addons/LoggingConsumer/NodeHarnessWin.h @@ -1,4 +1,5 @@ /* + * Copyright 1991-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * diff --git a/src/apps/cortex/addons/ToneProducer/LICENSE.Be b/src/apps/cortex/addons/ToneProducer/LICENSE.Be deleted file mode 100644 index 86a4268fa9..0000000000 --- a/src/apps/cortex/addons/ToneProducer/LICENSE.Be +++ /dev/null @@ -1,31 +0,0 @@ ----------------------- -Be Sample Code License ----------------------- - -Copyright 1991-1999, Be Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions, and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.cpp b/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.cpp index 7cf94aa045..21af8f8bb9 100644 --- a/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.cpp +++ b/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -29,13 +30,6 @@ */ -/* - NodeHarnessApp.cpp - - Copyright 1999, Be Incorporated. All Rights Reserved. - This file may be used under the terms of the Be Sample Code License. -*/ - #include "NodeHarnessApp.h" #include "NodeHarnessWin.h" @@ -44,7 +38,7 @@ NodeHarnessApp::NodeHarnessApp(const char *signature) { } -void +void NodeHarnessApp::ReadyToRun() { BWindow* win = new NodeHarnessWin(BRect(100, 200, 210, 330), "ToneProducer"); diff --git a/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.h b/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.h index 2ed9d1a68e..70d1fdb2bd 100644 --- a/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.h +++ b/src/apps/cortex/addons/ToneProducer/NodeHarnessApp.h @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -29,13 +30,6 @@ */ -/* - NodeHarnessApp.h - - Copyright 1999, Be Incorporated. All Rights Reserved. - This file may be used under the terms of the Be Sample Code License. -*/ - #ifndef NodeHarnessApp_H #define NodeHarnessApp_H 1 diff --git a/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.cpp b/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.cpp index 37b0e3ebf1..f27fc58319 100644 --- a/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.cpp +++ b/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -29,13 +30,6 @@ */ -/* - NodeHarnessWin.cpp - - Copyright 1999, Be Incorporated. All Rights Reserved. - This file may be used under the terms of the Be Sample Code License. -*/ - #include "NodeHarnessWin.h" #include "ToneProducer.h" #include @@ -83,7 +77,7 @@ NodeHarnessWin::NodeHarnessWin(BRect frame, const char *title) mStopButton = new BButton(r, "Stop", "Stop", new BMessage(BUTTON_STOP)); mStopButton->SetEnabled(false); AddChild(mStopButton); - + // e.moon 2jun99: create the node BMediaRoster* roster = BMediaRoster::Roster(); mToneNode = new ToneProducer(); @@ -120,14 +114,14 @@ NodeHarnessWin::~NodeHarnessWin() } } -void +void NodeHarnessWin::Quit() { be_app->PostMessage(B_QUIT_REQUESTED); BWindow::Quit(); } -void +void NodeHarnessWin::MessageReceived(BMessage *msg) { status_t err; @@ -176,7 +170,7 @@ NodeHarnessWin::MessageReceived(BMessage *msg) // got the endpoints; now we connect it! media_format format; - format.type = B_MEDIA_RAW_AUDIO; + format.type = B_MEDIA_RAW_AUDIO; format.u.raw_audio = media_raw_audio_format::wildcard; err = r->Connect(soundOutput.source, mixerInput.destination, &format, &soundOutput, &mixerInput); ErrorCheck(err, "unable to connect nodes"); @@ -228,7 +222,7 @@ NodeHarnessWin::MessageReceived(BMessage *msg) } // Private routines -void +void NodeHarnessWin::StopNodes() { mStartButton->SetEnabled(true); diff --git a/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.h b/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.h index 88857acd01..f37ba35a2d 100644 --- a/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.h +++ b/src/apps/cortex/addons/ToneProducer/NodeHarnessWin.h @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -29,13 +30,6 @@ */ -/* - NodeHarnessWin.h - - Copyright 1999, Be Incorporated. All Rights Reserved. - This file may be used under the terms of the Be Sample Code License. -*/ - #ifndef NodeHarnessWin_H #define NodeHarnessWin_H 1 diff --git a/src/apps/cortex/addons/ToneProducer/ToneProducer.cpp b/src/apps/cortex/addons/ToneProducer/ToneProducer.cpp index fa6d174fcc..4f8445adf4 100644 --- a/src/apps/cortex/addons/ToneProducer/ToneProducer.cpp +++ b/src/apps/cortex/addons/ToneProducer/ToneProducer.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -32,9 +33,6 @@ /* ToneProducer.cpp - Copyright 1999, Be Incorporated. All Rights Reserved. - This file may be used under the terms of the Be Sample Code License. - NOTE: to compile this code under Genki beta releases, do a search- and-replace to change "B_PARAMETER" to "B_USER_EVENT+1" */ @@ -150,7 +148,7 @@ ToneProducer::AddOn(int32 *internal_id) const //#pragma mark - // BControllable methods -status_t +status_t ToneProducer::GetParameterValue(int32 id, bigtime_t* last_change, void* value, size_t* ioSize) { FPRINTF(stderr, "ToneProducer::GetParameterValue\n"); @@ -191,7 +189,7 @@ ToneProducer::GetParameterValue(int32 id, bigtime_t* last_change, void* value, s return B_OK; } -void +void ToneProducer::SetParameterValue(int32 id, bigtime_t performance_time, const void* value, size_t size) { switch (id) @@ -224,14 +222,14 @@ status_t ToneProducer::StartControlPanel( if(pMessenger && pMessenger->IsValid()) { PRINT(("\tgot valid control panel\n")); } - + return err; } //#pragma mark - // BBufferProducer methods -status_t +status_t ToneProducer::FormatSuggestionRequested(media_type type, int32 /*quality*/, media_format* format) { // FormatSuggestionRequested() is not necessarily part of the format negotiation @@ -256,7 +254,7 @@ ToneProducer::FormatSuggestionRequested(media_type type, int32 /*quality*/, medi else return B_OK; } -status_t +status_t ToneProducer::FormatProposal(const media_source& output, media_format* format) { // FormatProposal() is the first stage in the BMediaRoster::Connect() process. We hand @@ -272,7 +270,7 @@ ToneProducer::FormatProposal(const media_source& output, media_format* format) // we only support floating-point raw audio, so we always return that, but we // supply an error code depending on whether we found the proposal acceptable. - + media_type requestedType = format->type; *format = mPreferredFormat; if ((requestedType != B_MEDIA_UNKNOWN_TYPE) && (requestedType != B_MEDIA_RAW_AUDIO)) @@ -283,7 +281,7 @@ ToneProducer::FormatProposal(const media_source& output, media_format* format) else return B_OK; // raw audio or wildcard type, either is okay by us } -status_t +status_t ToneProducer::FormatChangeRequested(const media_source& source, const media_destination& destination, media_format* io_format, int32* _deprecated_) { FPRINTF(stderr, "ToneProducer::FormatChangeRequested\n"); @@ -292,7 +290,7 @@ ToneProducer::FormatChangeRequested(const media_source& source, const media_dest return B_ERROR; } -status_t +status_t ToneProducer::GetNextOutput(int32* cookie, media_output* out_output) { FPRINTF(stderr, "ToneProducer::GetNextOutput\n"); @@ -309,7 +307,7 @@ ToneProducer::GetNextOutput(int32* cookie, media_output* out_output) else return B_BAD_INDEX; } -status_t +status_t ToneProducer::DisposeOutputCookie(int32 cookie) { FPRINTF(stderr, "ToneProducer::DisposeOutputCookie\n"); @@ -318,7 +316,7 @@ ToneProducer::DisposeOutputCookie(int32 cookie) return B_OK; } -status_t +status_t ToneProducer::SetBufferGroup(const media_source& for_source, BBufferGroup* newGroup) { FPRINTF(stderr, "ToneProducer::SetBufferGroup\n"); @@ -353,7 +351,7 @@ ToneProducer::SetBufferGroup(const media_source& for_source, BBufferGroup* newGr return B_OK; } -status_t +status_t ToneProducer::GetLatency(bigtime_t* out_latency) { FPRINTF(stderr, "ToneProducer::GetLatency\n"); @@ -363,7 +361,7 @@ ToneProducer::GetLatency(bigtime_t* out_latency) return B_OK; } -status_t +status_t ToneProducer::PrepareToConnect(const media_source& what, const media_destination& where, media_format* format, media_source* out_source, char* out_name) { // PrepareToConnect() is the second stage of format negotiations that happens @@ -396,7 +394,7 @@ ToneProducer::PrepareToConnect(const media_source& what, const media_destination format->u.raw_audio.channel_count = 2; return B_MEDIA_BAD_FORMAT; } - + // !!! validate all other fields except for buffer_size here, because the consumer might have // supplied different values from AcceptFormat()? @@ -429,13 +427,13 @@ ToneProducer::PrepareToConnect(const media_source& what, const media_destination { FPRINTF(stderr, "\tconsumer suggested buffer_size %lu\n", format->u.raw_audio.buffer_size); } - + // Now reserve the connection, and return information about it mOutput.destination = where; mOutput.format = *format; *out_source = mOutput.source; strncpy(out_name, mOutput.name, B_MEDIA_NAME_LENGTH); - + char formatStr[256]; string_for_format(*format, formatStr, 255); FPRINTF(stderr, "\treturning format: %s\n", formatStr); @@ -443,7 +441,7 @@ ToneProducer::PrepareToConnect(const media_source& what, const media_destination return B_OK; } -void +void ToneProducer::Connect(status_t error, const media_source& source, const media_destination& destination, const media_format& format, char* io_name) { FPRINTF(stderr, "ToneProducer::Connect\n"); @@ -470,7 +468,7 @@ ToneProducer::Connect(status_t error, const media_source& source, const media_de // FPRINTF(stderr, "\tcorrupted format; falling back to last suggested format\n"); // format = mOutput.format; // } -// +// // Okay, the connection has been confirmed. Record the destination and format // that we agreed on, and report our connection name again. @@ -505,7 +503,7 @@ ToneProducer::Connect(status_t error, const media_source& source, const media_de // reset our buffer duration, etc. to avoid later calculations // +++++ e.moon 11jun99: crashes w/ divide-by-zero when connecting to LoggingConsumer ASSERT(mOutput.format.u.raw_audio.frame_rate); - + bigtime_t duration = bigtime_t(1000000) * samplesPerBuffer / bigtime_t(mOutput.format.u.raw_audio.frame_rate); SetBufferDuration(duration); @@ -516,7 +514,7 @@ ToneProducer::Connect(status_t error, const media_source& source, const media_de if (!mBufferGroup) AllocateBuffers(); } -void +void ToneProducer::Disconnect(const media_source& what, const media_destination& where) { FPRINTF(stderr, "ToneProducer::Disconnect\n"); @@ -536,7 +534,7 @@ ToneProducer::Disconnect(const media_source& what, const media_destination& wher } } -void +void ToneProducer::LateNoticeReceived(const media_source& what, bigtime_t how_much, bigtime_t performance_time) { FPRINTF(stderr, "ToneProducer::LateNoticeReceived\n"); @@ -577,7 +575,7 @@ ToneProducer::LateNoticeReceived(const media_source& what, bigtime_t how_much, b } } -void +void ToneProducer::EnableOutput(const media_source& what, bool enabled, int32* _deprecated_) { FPRINTF(stderr, "ToneProducer::EnableOutput\n"); @@ -592,7 +590,7 @@ ToneProducer::EnableOutput(const media_source& what, bool enabled, int32* _depre } } -status_t +status_t ToneProducer::SetPlayRate(int32 numer, int32 denom) { FPRINTF(stderr, "ToneProducer::SetPlayRate\n"); @@ -602,7 +600,7 @@ ToneProducer::SetPlayRate(int32 numer, int32 denom) return B_ERROR; } -status_t +status_t ToneProducer::HandleMessage(int32 message, const void* data, size_t size) { FPRINTF(stderr, "ToneProducer::HandleMessage(%ld = 0x%lx)\n", message, message); @@ -615,7 +613,7 @@ ToneProducer::HandleMessage(int32 message, const void* data, size_t size) return B_ERROR; } -void +void ToneProducer::AdditionalBufferRequested(const media_source& source, media_buffer_id prev_buffer, bigtime_t prev_time, const media_seek_tag* prev_tag) { FPRINTF(stderr, "ToneProducer::AdditionalBufferRequested\n"); @@ -624,7 +622,7 @@ ToneProducer::AdditionalBufferRequested(const media_source& source, media_buffer return; } -void +void ToneProducer::LatencyChanged( const media_source& source, const media_destination& destination, @@ -645,7 +643,7 @@ ToneProducer::LatencyChanged( } /* // Workaround for a Metrowerks PPC compiler bug -status_t +status_t ToneProducer::DeleteHook(BMediaNode* node) { return BMediaEventLooper::DeleteHook(node); @@ -655,7 +653,7 @@ ToneProducer::DeleteHook(BMediaNode* node) */ // BMediaEventLooper methods -void +void ToneProducer::NodeRegistered() { FPRINTF(stderr, "ToneProducer::NodeRegistered\n"); @@ -672,7 +670,7 @@ ToneProducer::NodeRegistered() SetParameterWeb(mWeb); } -void +void ToneProducer::Start(bigtime_t performance_time) { PRINT(("ToneProducer::Start(%Ld): now %Ld\n", performance_time, TimeSource()->Now())); @@ -686,7 +684,7 @@ ToneProducer::Start(bigtime_t performance_time) BMediaEventLooper::Start(performance_time); } -void +void ToneProducer::Stop(bigtime_t performance_time, bool immediate) { // send 'data not available' message @@ -700,7 +698,7 @@ ToneProducer::Stop(bigtime_t performance_time, bool immediate) BMediaEventLooper::Stop(performance_time, immediate); } -void +void ToneProducer::Seek(bigtime_t media_time, bigtime_t performance_time) { // A bug in the current PowerPC compiler demands that we implement @@ -708,7 +706,7 @@ ToneProducer::Seek(bigtime_t media_time, bigtime_t performance_time) BMediaEventLooper::Seek(media_time, performance_time); } -void +void ToneProducer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time) { // A bug in the current PowerPC compiler demands that we implement @@ -716,7 +714,7 @@ ToneProducer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time) BMediaEventLooper::TimeWarp(at_real_time, to_performance_time); } -status_t +status_t ToneProducer::AddTimer(bigtime_t at_performance_time, int32 cookie) { // A bug in the current PowerPC compiler demands that we implement @@ -724,7 +722,7 @@ ToneProducer::AddTimer(bigtime_t at_performance_time, int32 cookie) return BMediaEventLooper::AddTimer(at_performance_time, cookie); } -void +void ToneProducer::SetRunMode(run_mode mode) { FPRINTF(stderr, "ToneProducer::SetRunMode\n"); @@ -737,7 +735,7 @@ ToneProducer::SetRunMode(run_mode mode) } } -void +void ToneProducer::HandleEvent(const media_timed_event* event, bigtime_t lateness, bool realTimeEvent) { // FPRINTF(stderr, "ToneProducer::HandleEvent\n"); @@ -862,7 +860,7 @@ ToneProducer::HandleEvent(const media_timed_event* event, bigtime_t lateness, bo } /* -void +void ToneProducer::CleanUpEvent(const media_timed_event *event) { // A bug in the current PowerPC compiler demands that we implement @@ -870,7 +868,7 @@ ToneProducer::CleanUpEvent(const media_timed_event *event) BMediaEventLooper::CleanUpEvent(event); } -bigtime_t +bigtime_t ToneProducer::OfflineTime() { // A bug in the current PowerPC compiler demands that we implement @@ -878,7 +876,7 @@ ToneProducer::OfflineTime() return BMediaEventLooper::OfflineTime(); } -void +void ToneProducer::ControlLoop() { // A bug in the current PowerPC compiler demands that we implement @@ -889,11 +887,11 @@ ToneProducer::ControlLoop() //#pragma mark - */ -void +void ToneProducer::AllocateBuffers() { FPRINTF(stderr, "ToneProducer::AllocateBuffers\n"); - + // allocate enough buffers to span our downstream latency, plus one size_t size = mOutput.format.u.raw_audio.buffer_size; int32 count = int32(mLatency / BufferDuration() + 1 + 1); @@ -918,7 +916,7 @@ ToneProducer::FillNextBuffer(bigtime_t event_time) // now fill it with data, continuing where the last buffer left off // 20sep99: multichannel support - + size_t numFrames = mOutput.format.u.raw_audio.buffer_size / (sizeof(float)*mOutput.format.u.raw_audio.channel_count); @@ -978,7 +976,7 @@ ToneProducer::FillNextBuffer(bigtime_t event_time) void ToneProducer::FillSineBuffer(float *data, size_t numFrames, bool stereo) { - + // cover 2pi radians in one period double dTheta = 2*M_PI * double(mFrequency) / mOutput.format.u.raw_audio.frame_rate; @@ -992,7 +990,7 @@ ToneProducer::FillSineBuffer(float *data, size_t numFrames, bool stereo) ++data; *data = val; } - + mTheta += dTheta; if (mTheta > 2*M_PI) { @@ -1017,7 +1015,7 @@ ToneProducer::FillTriangleBuffer(float *data, size_t numFrames, bool stereo) ++data; *data = val; } - + mTheta += dTheta; if (mTheta >= 1) { diff --git a/src/apps/cortex/addons/ToneProducer/ToneProducer.h b/src/apps/cortex/addons/ToneProducer/ToneProducer.h index 644b7c1a0e..8e8ab1d388 100644 --- a/src/apps/cortex/addons/ToneProducer/ToneProducer.h +++ b/src/apps/cortex/addons/ToneProducer/ToneProducer.h @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -32,18 +33,15 @@ /* ToneProducer.h - Copyright 1999, Be Incorporated. All Rights Reserved. - This file may be used under the terms of the Be Sample Code License. - NOTES eamoon@meadgroup.com 11june99 - this node has some holes in it, but it's pretty useful starting point for writing producers. - I've tried to clean up the format negotiation a bit, which didn't fare too well when faced with an apathetic downstream node (LoggingConsumer.) - + KNOWN BUGS - eamoon 17jun99 + eamoon 17jun99 * Can't handle 2 channels, but is too polite to refuse. How embarrassing. @@ -89,7 +87,7 @@ public: bigtime_t when, const void* value, size_t size); - + status_t StartControlPanel( BMessenger* pMessenger); @@ -142,7 +140,7 @@ public: char* out_name); void Connect( - status_t error, + status_t error, const media_source& source, const media_destination& destination, const media_format& format, @@ -217,7 +215,7 @@ protected: // Workaround for a Metrowerks PPC compiler bug void ControlLoop(); - + // Workaround for a Metrowerks PPC compiler bug status_t DeleteHook(BMediaNode* node); */ @@ -251,7 +249,7 @@ private: bigtime_t mGainLastChanged; bigtime_t mFreqLastChanged; bigtime_t mWaveLastChanged; - + // host addon // [8jun99] e.moon BMediaAddOn* m_pAddOn; diff --git a/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.cpp b/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.cpp index d2a710e9b2..4a6bd34749 100644 --- a/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.cpp +++ b/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -49,7 +50,7 @@ extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) { ToneProducerAddOn::~ToneProducerAddOn() {} ToneProducerAddOn::ToneProducerAddOn(image_id image) : BMediaAddOn(image) {} - + // -------------------------------------------------------- // // BMediaAddOn impl // -------------------------------------------------------- // @@ -58,7 +59,7 @@ status_t ToneProducerAddOn::InitCheck( const char** out_failure_text) { return B_OK; } - + int32 ToneProducerAddOn::CountFlavors() { return 1; } @@ -68,7 +69,7 @@ status_t ToneProducerAddOn::GetFlavorAt( const flavor_info** out_info) { if(n) return B_ERROR; - + flavor_info* pInfo = new flavor_info; pInfo->internal_id = n; pInfo->name = "ToneProducer"; @@ -79,16 +80,16 @@ status_t ToneProducerAddOn::GetFlavorAt( pInfo->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE; pInfo->flavor_flags = 0; pInfo->possible_count = 0; - + pInfo->in_format_count = 0; pInfo->in_formats = 0; - + pInfo->out_format_count = 1; media_format* pFormat = new media_format; pFormat->type = B_MEDIA_RAW_AUDIO; pFormat->u.raw_audio = media_raw_audio_format::wildcard; pInfo->out_formats = pFormat; - + *out_info = pInfo; return B_OK; } @@ -98,15 +99,15 @@ BMediaNode* ToneProducerAddOn::InstantiateNodeFor( BMessage* config, status_t* out_error) { - return new ToneProducer(this); + return new ToneProducer(this); } status_t ToneProducerAddOn::GetConfigurationFor( BMediaNode* your_node, BMessage* into_message) { - + // no config yet return B_OK; } -// END -- ToneProducerAddOn.cpp \ No newline at end of file +// END -- ToneProducerAddOn.cpp diff --git a/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.h b/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.h index da4cd92133..79182c4c99 100644 --- a/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.h +++ b/src/apps/cortex/addons/ToneProducer/ToneProducerAddOn.h @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -46,11 +47,11 @@ class ToneProducerAddOn : public BMediaAddOn { typedef BMediaAddOn _inherited; - + public: // ctor/dtor virtual ~ToneProducerAddOn(); explicit ToneProducerAddOn(image_id image); - + public: // BMediaAddOn impl virtual status_t InitCheck( const char** out_failure_text); diff --git a/src/apps/cortex/addons/ToneProducer/main.cpp b/src/apps/cortex/addons/ToneProducer/main.cpp index 5adaae9ade..f96fa40034 100644 --- a/src/apps/cortex/addons/ToneProducer/main.cpp +++ b/src/apps/cortex/addons/ToneProducer/main.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -29,13 +30,6 @@ */ -/* - ToneProducerApp main.cpp - - Copyright 1999, Be Incorporated. All Rights Reserved. - This file may be used under the terms of the Be Sample Code License. -*/ - #include "NodeHarnessApp.h" #include "MediaNodeControlApp.h" #include @@ -57,6 +51,6 @@ int main(int argc, char** argv) { MediaNodeControlApp app(g_pAppSignature, id); app.Run(); } - + return 0; } diff --git a/src/apps/cortex/addons/common/LICENSE.Be b/src/apps/cortex/addons/common/LICENSE.Be deleted file mode 100644 index 86a4268fa9..0000000000 --- a/src/apps/cortex/addons/common/LICENSE.Be +++ /dev/null @@ -1,31 +0,0 @@ ----------------------- -Be Sample Code License ----------------------- - -Copyright 1991-1999, Be Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions, and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/apps/cortex/addons/common/SoundUtils.cpp b/src/apps/cortex/addons/common/SoundUtils.cpp index cde3be3db4..e595f27a9d 100644 --- a/src/apps/cortex/addons/common/SoundUtils.cpp +++ b/src/apps/cortex/addons/common/SoundUtils.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1998-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -35,8 +36,6 @@ / / Description: Utility functions for handling audio data. / -/ Copyright 1998-1999, Be Incorporated, All Rights Reserved -/ *******************************************************************************/ #include "SoundUtils.h" diff --git a/src/apps/cortex/addons/common/SoundUtils.h b/src/apps/cortex/addons/common/SoundUtils.h index be1af2a846..388bc18f7e 100644 --- a/src/apps/cortex/addons/common/SoundUtils.h +++ b/src/apps/cortex/addons/common/SoundUtils.h @@ -1,4 +1,5 @@ /* + * Copyright 1998-1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -35,8 +36,6 @@ / / Description: Utility functions for handling audio data. / -/ Copyright 1998-1999, Be Incorporated, All Rights Reserved -/ *******************************************************************************/ #if ! defined( _SoundUtils_h ) @@ -78,7 +77,7 @@ enum { B_DISCONNECTED, // B_FORMAT_CHANGED, // media_raw_audio_format* B_NODE_DIES, // node will die! - B_HOOKS_CHANGED, // + B_HOOKS_CHANGED, // B_OP_TIMED_OUT, // timeout that expired -- Consumer only B_PRODUCER_DATA_STATUS, // status performance_time -- Consumer only B_LATE_NOTICE // how_much performance_time -- Producer only diff --git a/src/apps/cortex/support/LICENSE.Be b/src/apps/cortex/support/LICENSE.Be deleted file mode 100644 index 0d2114b951..0000000000 --- a/src/apps/cortex/support/LICENSE.Be +++ /dev/null @@ -1,40 +0,0 @@ - -This license applies to the following files: - - array_delete.h - MultiInvoker.cpp - MultiInvoker.h - SoundUtils.cpp - SoundUtils.h - ----------------------- -Be Sample Code License ----------------------- - -Copyright 1991-1999, Be Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions, and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/apps/cortex/support/MultiInvoker.cpp b/src/apps/cortex/support/MultiInvoker.cpp index 4121820d6f..0344bb2345 100644 --- a/src/apps/cortex/support/MultiInvoker.cpp +++ b/src/apps/cortex/support/MultiInvoker.cpp @@ -1,4 +1,5 @@ /* + * Copyright 1999, Be Incorporated. * Copyright (c) 1999-2000, Eric Moon. * All rights reserved. * @@ -34,9 +35,6 @@ // ---------------- // Implements the MultiInvoker class. // -// Copyright 1999, Be Incorporated. All Rights Reserved. -// This file may be used under the terms of the Be Sample -// Code License. #include #include "MultiInvoker.h" @@ -111,7 +109,7 @@ status_t MultiInvoker::AddTarget(const BHandler* h, const BLooper* loop) m_messengers.AddItem(msgr); else delete msgr; - return err; + return err; } status_t MultiInvoker::AddTarget(BMessenger* msgr) @@ -204,8 +202,8 @@ status_t MultiInvoker::Invoke(BMessage* msg) if (! sendMsg) return B_BAD_VALUE; - status_t err, finalResult=B_OK; - BMessage replyMsg; + status_t err, finalResult=B_OK; + BMessage replyMsg; int32 len = CountTargets(); for (int32 i=0; i Date: Mon, 15 Aug 2011 23:29:38 +0000 Subject: [PATCH 184/702] Reset the tab region when switching to a tab less look. At least partially fixes #7919. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42636 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/decorator/DefaultDecorator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/servers/app/decorator/DefaultDecorator.cpp b/src/servers/app/decorator/DefaultDecorator.cpp index e6058a4cdf..ea931514c4 100644 --- a/src/servers/app/decorator/DefaultDecorator.cpp +++ b/src/servers/app/decorator/DefaultDecorator.cpp @@ -438,6 +438,11 @@ DefaultDecorator::_DoLayout() return; } else { // no tab + for (int32 i = 0; i < fTabList.CountItems(); i++) { + Decorator::Tab* tab = fTabList.ItemAt(i); + tab->tabRect.Set(0.0, 0.0, -1.0, -1.0); + } + fTabsRegion.MakeEmpty(); fTitleBarRect.Set(0.0, 0.0, -1.0, -1.0); } } From fcb8a5cb4eef0c50fa90e66d9b6a4f9a7aca5e07 Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Wed, 17 Aug 2011 19:16:21 +0000 Subject: [PATCH 185/702] * Updated ACPICA to 20110623. See http://www.acpica.org/download/changes.txt done after 2010-10-13 for info on ACPI changes. * Adapted the embedded controller to match current FreeBSD one. There will probably be some issues with these changes initially. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42637 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/ACPI.h | 10 +- src/add-ons/kernel/bus_managers/acpi/Jamfile | 6 + .../kernel/bus_managers/acpi/acpi_busman.c | 40 +- .../acpi/acpi_embedded_controller.cpp | 211 ++-- .../acpi/acpi_embedded_controller.h | 13 +- .../kernel/bus_managers/acpi/acpi_module.c | 4 + .../kernel/bus_managers/acpi/acpi_priv.h | 17 +- .../kernel/bus_managers/acpi/common/adfile.c | 2 +- .../kernel/bus_managers/acpi/common/adisasm.c | 4 +- .../kernel/bus_managers/acpi/common/adwalk.c | 2 +- .../bus_managers/acpi/common/dmextern.c | 2 +- .../bus_managers/acpi/common/dmrestag.c | 2 +- .../kernel/bus_managers/acpi/common/dmtable.c | 178 +++- .../bus_managers/acpi/common/dmtbdump.c | 166 ++- .../bus_managers/acpi/common/dmtbinfo.c | 111 +- .../kernel/bus_managers/acpi/common/getopt.c | 2 +- .../bus_managers/acpi/dispatcher/dsargs.c | 502 +++++++++ .../bus_managers/acpi/dispatcher/dscontrol.c | 496 +++++++++ .../bus_managers/acpi/dispatcher/dsfield.c | 2 +- .../bus_managers/acpi/dispatcher/dsinit.c | 2 +- .../bus_managers/acpi/dispatcher/dsmethod.c | 57 +- .../bus_managers/acpi/dispatcher/dsmthdat.c | 2 +- .../bus_managers/acpi/dispatcher/dsobject.c | 2 +- .../bus_managers/acpi/dispatcher/dsopcode.c | 748 +------------- .../bus_managers/acpi/dispatcher/dsutils.c | 2 +- .../bus_managers/acpi/dispatcher/dswexec.c | 22 +- .../bus_managers/acpi/dispatcher/dswload.c | 699 +------------ .../bus_managers/acpi/dispatcher/dswload2.c | 819 +++++++++++++++ .../bus_managers/acpi/dispatcher/dswscope.c | 2 +- .../bus_managers/acpi/dispatcher/dswstate.c | 2 +- .../kernel/bus_managers/acpi/events/evevent.c | 62 +- .../kernel/bus_managers/acpi/events/evglock.c | 439 ++++++++ .../kernel/bus_managers/acpi/events/evgpe.c | 324 ++++-- .../bus_managers/acpi/events/evgpeblk.c | 110 +- .../bus_managers/acpi/events/evgpeinit.c | 287 +----- .../bus_managers/acpi/events/evgpeutil.c | 47 +- .../kernel/bus_managers/acpi/events/evmisc.c | 298 +----- .../bus_managers/acpi/events/evregion.c | 134 ++- .../bus_managers/acpi/events/evrgnini.c | 8 +- .../kernel/bus_managers/acpi/events/evsci.c | 2 +- .../kernel/bus_managers/acpi/events/evxface.c | 148 ++- .../bus_managers/acpi/events/evxfevnt.c | 739 +------------ .../kernel/bus_managers/acpi/events/evxfgpe.c | 972 ++++++++++++++++++ .../bus_managers/acpi/events/evxfregn.c | 35 +- .../bus_managers/acpi/executer/exconfig.c | 9 +- .../bus_managers/acpi/executer/exconvrt.c | 2 +- .../bus_managers/acpi/executer/excreate.c | 13 +- .../bus_managers/acpi/executer/exdebug.c | 2 +- .../bus_managers/acpi/executer/exdump.c | 4 +- .../bus_managers/acpi/executer/exfield.c | 2 +- .../bus_managers/acpi/executer/exfldio.c | 6 +- .../bus_managers/acpi/executer/exmisc.c | 2 +- .../bus_managers/acpi/executer/exmutex.c | 2 +- .../bus_managers/acpi/executer/exnames.c | 2 +- .../bus_managers/acpi/executer/exoparg1.c | 2 +- .../bus_managers/acpi/executer/exoparg2.c | 2 +- .../bus_managers/acpi/executer/exoparg3.c | 2 +- .../bus_managers/acpi/executer/exoparg6.c | 2 +- .../bus_managers/acpi/executer/exprep.c | 2 +- .../bus_managers/acpi/executer/exregion.c | 2 +- .../bus_managers/acpi/executer/exresnte.c | 2 +- .../bus_managers/acpi/executer/exresolv.c | 2 +- .../bus_managers/acpi/executer/exresop.c | 2 +- .../bus_managers/acpi/executer/exstore.c | 2 +- .../bus_managers/acpi/executer/exstoren.c | 2 +- .../bus_managers/acpi/executer/exstorob.c | 2 +- .../bus_managers/acpi/executer/exsystem.c | 2 +- .../bus_managers/acpi/executer/exutils.c | 2 +- .../bus_managers/acpi/hardware/hwacpi.c | 2 +- .../kernel/bus_managers/acpi/hardware/hwgpe.c | 2 +- .../kernel/bus_managers/acpi/hardware/hwpci.c | 2 +- .../bus_managers/acpi/hardware/hwregs.c | 2 +- .../bus_managers/acpi/hardware/hwsleep.c | 2 +- .../bus_managers/acpi/hardware/hwtimer.c | 2 +- .../bus_managers/acpi/hardware/hwvalid.c | 2 +- .../bus_managers/acpi/hardware/hwxface.c | 2 +- .../kernel/bus_managers/acpi/include/acapps.h | 4 +- .../bus_managers/acpi/include/accommon.h | 2 +- .../bus_managers/acpi/include/acconfig.h | 6 +- .../bus_managers/acpi/include/acdebug.h | 144 +-- .../bus_managers/acpi/include/acdisasm.h | 27 +- .../bus_managers/acpi/include/acdispat.h | 52 +- .../bus_managers/acpi/include/acevents.h | 65 +- .../bus_managers/acpi/include/acexcep.h | 2 +- .../bus_managers/acpi/include/acglobal.h | 40 +- .../bus_managers/acpi/include/achware.h | 2 +- .../bus_managers/acpi/include/acinterp.h | 2 +- .../bus_managers/acpi/include/aclocal.h | 41 +- .../bus_managers/acpi/include/acmacros.h | 2 +- .../bus_managers/acpi/include/acnames.h | 2 +- .../bus_managers/acpi/include/acnamesp.h | 2 +- .../bus_managers/acpi/include/acobject.h | 16 +- .../bus_managers/acpi/include/acopcode.h | 2 +- .../bus_managers/acpi/include/acoutput.h | 14 +- .../bus_managers/acpi/include/acparser.h | 2 +- .../kernel/bus_managers/acpi/include/acpi.h | 2 +- .../bus_managers/acpi/include/acpiosxf.h | 8 +- .../kernel/bus_managers/acpi/include/acpixf.h | 85 +- .../bus_managers/acpi/include/acpredef.h | 3 +- .../bus_managers/acpi/include/acresrc.h | 2 +- .../bus_managers/acpi/include/acrestyp.h | 2 +- .../bus_managers/acpi/include/acstruct.h | 2 +- .../bus_managers/acpi/include/actables.h | 2 +- .../kernel/bus_managers/acpi/include/actbl.h | 18 +- .../kernel/bus_managers/acpi/include/actbl1.h | 2 +- .../kernel/bus_managers/acpi/include/actbl2.h | 79 +- .../bus_managers/acpi/include/actypes.h | 75 +- .../bus_managers/acpi/include/acutils.h | 2 +- .../bus_managers/acpi/include/amlcode.h | 28 +- .../bus_managers/acpi/include/amlresrc.h | 2 +- .../acpi/include/platform/acefi.h | 2 +- .../acpi/include/platform/acenv.h | 25 +- .../acpi/include/platform/acgcc.h | 2 +- .../acpi/include/platform/acintel.h | 2 +- .../acpi/include/platform/acmsvc.h | 40 +- .../bus_managers/acpi/namespace/nsaccess.c | 6 +- .../bus_managers/acpi/namespace/nsalloc.c | 14 +- .../bus_managers/acpi/namespace/nsdump.c | 18 +- .../bus_managers/acpi/namespace/nsdumpdv.c | 2 +- .../bus_managers/acpi/namespace/nseval.c | 4 +- .../bus_managers/acpi/namespace/nsinit.c | 2 +- .../bus_managers/acpi/namespace/nsload.c | 2 +- .../bus_managers/acpi/namespace/nsnames.c | 2 +- .../bus_managers/acpi/namespace/nsobject.c | 2 +- .../bus_managers/acpi/namespace/nsparse.c | 2 +- .../bus_managers/acpi/namespace/nspredef.c | 21 +- .../bus_managers/acpi/namespace/nsrepair.c | 15 +- .../bus_managers/acpi/namespace/nsrepair2.c | 17 +- .../bus_managers/acpi/namespace/nssearch.c | 2 +- .../bus_managers/acpi/namespace/nsutils.c | 2 +- .../bus_managers/acpi/namespace/nswalk.c | 2 +- .../bus_managers/acpi/namespace/nsxfeval.c | 2 +- .../bus_managers/acpi/namespace/nsxfname.c | 10 +- .../bus_managers/acpi/namespace/nsxfobj.c | 2 +- .../kernel/bus_managers/acpi/parser/psargs.c | 2 +- .../kernel/bus_managers/acpi/parser/psloop.c | 4 +- .../bus_managers/acpi/parser/psopcode.c | 2 +- .../kernel/bus_managers/acpi/parser/psparse.c | 24 +- .../kernel/bus_managers/acpi/parser/psscope.c | 2 +- .../kernel/bus_managers/acpi/parser/pstree.c | 2 +- .../kernel/bus_managers/acpi/parser/psutils.c | 2 +- .../kernel/bus_managers/acpi/parser/pswalk.c | 2 +- .../kernel/bus_managers/acpi/parser/psxface.c | 9 +- .../bus_managers/acpi/resources/rsaddr.c | 2 +- .../bus_managers/acpi/resources/rscalc.c | 2 +- .../bus_managers/acpi/resources/rscreate.c | 2 +- .../bus_managers/acpi/resources/rsdump.c | 2 +- .../bus_managers/acpi/resources/rsinfo.c | 2 +- .../kernel/bus_managers/acpi/resources/rsio.c | 2 +- .../bus_managers/acpi/resources/rsirq.c | 2 +- .../bus_managers/acpi/resources/rslist.c | 2 +- .../bus_managers/acpi/resources/rsmemory.c | 2 +- .../bus_managers/acpi/resources/rsmisc.c | 2 +- .../bus_managers/acpi/resources/rsutils.c | 2 +- .../bus_managers/acpi/resources/rsxface.c | 2 +- .../kernel/bus_managers/acpi/tables/tbfadt.c | 7 +- .../kernel/bus_managers/acpi/tables/tbfind.c | 2 +- .../bus_managers/acpi/tables/tbinstal.c | 28 +- .../kernel/bus_managers/acpi/tables/tbutils.c | 2 +- .../kernel/bus_managers/acpi/tables/tbxface.c | 2 +- .../bus_managers/acpi/tables/tbxfroot.c | 2 +- .../bus_managers/acpi/utilities/utalloc.c | 2 +- .../bus_managers/acpi/utilities/utcache.c | 2 +- .../bus_managers/acpi/utilities/utclib.c | 2 +- .../bus_managers/acpi/utilities/utcopy.c | 2 +- .../bus_managers/acpi/utilities/utdebug.c | 2 +- .../bus_managers/acpi/utilities/utdecode.c | 702 +++++++++++++ .../bus_managers/acpi/utilities/utdelete.c | 2 +- .../bus_managers/acpi/utilities/uteval.c | 2 +- .../bus_managers/acpi/utilities/utglobal.c | 568 +--------- .../bus_managers/acpi/utilities/utids.c | 2 +- .../bus_managers/acpi/utilities/utinit.c | 2 +- .../bus_managers/acpi/utilities/utlock.c | 2 +- .../bus_managers/acpi/utilities/utmath.c | 2 +- .../bus_managers/acpi/utilities/utmisc.c | 2 +- .../bus_managers/acpi/utilities/utmutex.c | 2 +- .../bus_managers/acpi/utilities/utobject.c | 2 +- .../bus_managers/acpi/utilities/utosi.c | 2 +- .../bus_managers/acpi/utilities/utresrc.c | 2 +- .../bus_managers/acpi/utilities/utstate.c | 2 +- .../bus_managers/acpi/utilities/uttrack.c | 2 +- .../bus_managers/acpi/utilities/utxface.c | 23 +- .../bus_managers/acpi/utilities/utxferror.c | 2 +- 183 files changed, 6000 insertions(+), 4204 deletions(-) create mode 100644 src/add-ons/kernel/bus_managers/acpi/dispatcher/dsargs.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/dispatcher/dscontrol.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload2.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/events/evglock.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/events/evxfgpe.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/utilities/utdecode.c diff --git a/headers/os/drivers/ACPI.h b/headers/os/drivers/ACPI.h index 32a5341aa6..73a6b075a1 100644 --- a/headers/os/drivers/ACPI.h +++ b/headers/os/drivers/ACPI.h @@ -145,6 +145,8 @@ typedef uint32 acpi_status; typedef uint32 (*acpi_event_handler)(void *Context); +typedef uint32 (*acpi_gpe_handler) (acpi_handle GpeDevice, uint32 GpeNumber, + void *Context); typedef acpi_status (*acpi_adr_space_handler)(uint32 function, acpi_physical_address address, uint32 bitWidth, int *value, @@ -178,13 +180,17 @@ struct acpi_module_info { /* GPE Handler */ + status_t (*update_all_gpes)(); status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber); + status_t (*disable_gpe)(acpi_handle handle, uint32 gpeNumber); + status_t (*clear_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*set_gpe)(acpi_handle handle, uint32 gpeNumber, uint8 action); + status_t (*finish_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*install_gpe_handler)(acpi_handle handle, uint32 gpeNumber, - uint32 type, acpi_event_handler handler, void *data); + uint32 type, acpi_gpe_handler handler, void *data); status_t (*remove_gpe_handler)(acpi_handle handle, uint32 gpeNumber, - acpi_event_handler address); + acpi_gpe_handler address); /* Address Space Handler */ diff --git a/src/add-ons/kernel/bus_managers/acpi/Jamfile b/src/add-ons/kernel/bus_managers/acpi/Jamfile index fdc8a4aa76..f1a82e530a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/Jamfile +++ b/src/add-ons/kernel/bus_managers/acpi/Jamfile @@ -13,6 +13,8 @@ local common_src = ; local dispatcher_src = + dsargs.c + dscontrol.c dsfield.c dsinit.c dsmethod.c @@ -22,12 +24,14 @@ local dispatcher_src = dsutils.c dswexec.c dswload.c + dswload2.c dswscope.c dswstate.c ; local events_src = evevent.c + evglock.c evgpe.c evgpeblk.c evgpeinit.c @@ -38,6 +42,7 @@ local events_src = evsci.c evxface.c evxfevnt.c + evxfgpe.c evxfregn.c ; @@ -142,6 +147,7 @@ local utilities_src = utcache.c utclib.c utcopy.c + utdecode.c utdebug.c utdelete.c uteval.c diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c index 35fafba3fc..8dc0361e51 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c @@ -270,6 +270,13 @@ remove_notify_handler(acpi_handle device, uint32 handlerType, } +status_t +update_all_gpes() +{ + return AcpiUpdateAllGpes() == AE_OK ? B_OK : B_ERROR; +} + + status_t enable_gpe(acpi_handle handle, uint32 gpeNumber) { @@ -277,6 +284,20 @@ enable_gpe(acpi_handle handle, uint32 gpeNumber) } +status_t +disable_gpe(acpi_handle handle, uint32 gpeNumber) +{ + return AcpiDisableGpe(handle, gpeNumber) == AE_OK ? B_OK : B_ERROR; +} + + +status_t +clear_gpe(acpi_handle handle, uint32 gpeNumber) +{ + return AcpiClearGpe(handle, gpeNumber) == AE_OK ? B_OK : B_ERROR; +} + + status_t set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action) { @@ -284,20 +305,27 @@ set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action) } +status_t +finish_gpe(acpi_handle handle, uint32 gpeNumber) +{ + return AcpiFinishGpe(handle, gpeNumber) == AE_OK ? B_OK : B_ERROR; +} + + status_t install_gpe_handler(acpi_handle handle, uint32 gpeNumber, uint32 type, - acpi_event_handler handler, void *data) + acpi_gpe_handler handler, void *data) { return AcpiInstallGpeHandler(handle, gpeNumber, type, - (ACPI_EVENT_HANDLER)handler, data) == AE_OK ? B_OK : B_ERROR; + (ACPI_GPE_HANDLER)handler, data) == AE_OK ? B_OK : B_ERROR; } status_t remove_gpe_handler(acpi_handle handle, uint32 gpeNumber, - acpi_event_handler address) + acpi_gpe_handler address) { - return AcpiRemoveGpeHandler(handle, gpeNumber, (ACPI_EVENT_HANDLER)address) + return AcpiRemoveGpeHandler(handle, gpeNumber, (ACPI_GPE_HANDLER)address) == AE_OK ? B_OK : B_ERROR; } @@ -701,8 +729,12 @@ struct acpi_module_info gACPIModule = { release_global_lock, install_notify_handler, remove_notify_handler, + update_all_gpes, enable_gpe, + disable_gpe, + clear_gpe, set_gpe, + finish_gpe, install_gpe_handler, remove_gpe_handler, install_address_space_handler, diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp index a9ae6b44a9..92ed85b012 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp @@ -197,7 +197,7 @@ embedded_controller_free(void* cookie) // #pragma mark - driver module API -int32 +static int32 acpi_get_type(device_node* dev) { const char *bus; @@ -481,12 +481,30 @@ struct device_module_info embedded_controller_device_module = { // #pragma mark - +static acpi_status +EcCheckStatus(struct acpi_ec_cookie* sc, const char* msg, EC_EVENT event) +{ + acpi_status status = AE_NO_HARDWARE_RESPONSE; + EC_STATUS ec_status = EC_GET_CSR(sc); + + if (sc->ec_burstactive && !(ec_status & EC_FLAG_BURST_MODE)) { + TRACE("burst disabled in waitevent (%s)\n", msg); + sc->ec_burstactive = false; + } + if (EVENT_READY(event, ec_status)) { + TRACE("%s wait ready, status %#x\n", msg, ec_status); + status = AE_OK; + } + return status; +} + + static void EcGpeQueryHandler(void* context) { struct acpi_ec_cookie* sc = (struct acpi_ec_cookie*)context; - ASSERT(context != NULL);//, ("EcGpeQueryHandler called with NULL")); + ASSERT(context != NULL); // Serialize user access with EcSpaceHandler(). status_t status = EcLock(sc); @@ -500,7 +518,17 @@ EcGpeQueryHandler(void* context) // interrupt source since we are edge-triggered. To prevent the GPE // that may arise from running the query from causing another query // to be queued, we clear the pending flag only after running it. - acpi_status acpi_status = EcCommand(sc, EC_COMMAND_QUERY); + int sci_enqueued = sc->ec_sci_pending; + acpi_status acpi_status; + for (uint8 retry = 0; retry < 2; retry++) { + acpi_status = EcCommand(sc, EC_COMMAND_QUERY); + if (acpi_status == AE_OK) + break; + if (EcCheckStatus(sc, "retr_check", + EC_EVENT_INPUT_BUFFER_EMPTY) != AE_OK) + break; + } + sc->ec_sci_pending = FALSE; if (acpi_status != AE_OK) { EcUnlock(sc); @@ -527,6 +555,14 @@ EcGpeQueryHandler(void* context) if (status != B_OK) { TRACE("evaluation of query method %s failed\n", qxx); } + + // Reenable runtime GPE if its execution was deferred. + if (sci_enqueued) { + status = sc->ec_acpi_module->finish_gpe(sc->ec_gpehandle, sc->ec_gpebit); + if (status != B_OK) + ERROR("reenabling runtime GPE failed.\n"); + } + } @@ -534,7 +570,7 @@ EcGpeQueryHandler(void* context) called from an unknown lock context. */ static uint32 -EcGpeHandler(void* context) +EcGpeHandler(acpi_handle gpeDevice, uint32 gpeNumber, void* context) { struct acpi_ec_cookie* sc = (acpi_ec_cookie*)context; @@ -550,10 +586,10 @@ EcGpeHandler(void* context) // If the EC_SCI bit of the status register is set, queue a query handler. // It will run the query and _Qxx method later, under the lock. - EC_STATUS EcStatus = EC_GET_CSR(sc); - if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pending) { + EC_STATUS ecStatus = EC_GET_CSR(sc); + if ((ecStatus & EC_EVENT_SCI) && !sc->ec_sci_pending) { TRACE("gpe queueing query handler\n"); - ACPI_STATUS status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, + acpi_status status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, context); if (status == AE_OK) sc->ec_sci_pending = TRUE; @@ -585,23 +621,16 @@ EcSpaceHandler(uint32 function, acpi_physical_address address, uint32 width, { TRACE("enter EcSpaceHandler\n"); struct acpi_ec_cookie* sc = (struct acpi_ec_cookie*)context; - uint8 ecData; + if (function != ACPI_READ && function != ACPI_WRITE) return AE_BAD_PARAMETER; if (width % 8 != 0 || value == NULL || context == NULL) return AE_BAD_PARAMETER; - if (address + (width / 8) - 1 > 0xFF) + if (address + width / 8 > 256) return AE_BAD_ADDRESS; - if (function == ACPI_READ) - *value = 0; - uint8 ecAddr = address; - acpi_status status = AE_ERROR; - - /* - * If booting, check if we need to run the query handler. If so, we - * we call it directly here as scheduling and dpc might not be up yet. - * (Not sure if it's needed) - */ + // If booting, check if we need to run the query handler. If so, we + // we call it directly here as scheduling and dpc might not be up yet. + // (Not sure if it's needed) if (gKernelStartup || gKernelShutdown || sc->ec_suspending) { if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { @@ -611,29 +640,43 @@ EcSpaceHandler(uint32 function, acpi_physical_address address, uint32 width, } // Serialize with EcGpeQueryHandler() at transaction granularity. - status = EcLock(sc); + acpi_status status = EcLock(sc); if (status != B_OK) return AE_NOT_ACQUIRED; + // If we can't start burst mode, continue anyway. + status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); + if (status == B_OK) { + if (EC_GET_DATA(sc) == EC_BURST_ACK) { + TRACE("burst enabled.\n"); + sc->ec_burstactive = TRUE; + } + } + // Perform the transaction(s), based on width. - for (uint32 i = 0; i < width; i += 8, ecAddr++) { + acpi_physical_address ecAddr = address; + uint8* ecData = (uint8 *) value; + if (function == ACPI_READ) + *value = 0; + do { switch (function) { case ACPI_READ: - status = EcRead(sc, ecAddr, &ecData); - if (status == AE_OK) - *value |= ((int) ecData) << i; + status = EcRead(sc, ecAddr, ecData); break; case ACPI_WRITE: - ecData = (uint8)((*value) >> i); - status = EcWrite(sc, ecAddr, &ecData); - break; - default: - TRACE("invalid EcSpaceHandler function\n"); - status = AE_BAD_PARAMETER; + status = EcWrite(sc, ecAddr, *ecData); break; } if (status != AE_OK) break; + ecAddr++; + ecData++; + } while (ecAddr < address + width / 8); + + if (sc->ec_burstactive) { + sc->ec_burstactive = FALSE; + if (EcCommand(sc, EC_COMMAND_BURST_DISABLE) == AE_OK) + TRACE("disabled burst ok."); } EcUnlock(sc); @@ -641,24 +684,6 @@ EcSpaceHandler(uint32 function, acpi_physical_address address, uint32 width, } -static acpi_status -EcCheckStatus(struct acpi_ec_cookie* sc, const char* msg, EC_EVENT event) -{ - acpi_status status = AE_NO_HARDWARE_RESPONSE; - EC_STATUS ec_status = EC_GET_CSR(sc); - - if (sc->ec_burstactive && !(ec_status & EC_FLAG_BURST_MODE)) { - TRACE("burst disabled in waitevent (%s)\n", msg); - sc->ec_burstactive = false; - } - if (EVENT_READY(event, ec_status)) { - TRACE("%s wait ready, status %#x\n", msg, ec_status); - status = AE_OK; - } - return status; -} - - static acpi_status EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) { @@ -668,7 +693,7 @@ EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) // int need_poll = cold || rebooting || ec_polled_mode || sc->ec_suspending; int needPoll = ec_polled_mode || sc->ec_suspending || gKernelStartup || gKernelShutdown; - // The main CPU should be much faster than the EC. So the status should + // Wait for event by polling or GPE (interrupt). // be "not ready" when we start waiting. But if the main CPU is really // slow, it's possible we see the current "ready" response. Since that // can't be distinguished from the previous response in polled mode, @@ -695,7 +720,6 @@ EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) count = (ec_timeout * 1000) / EC_POLL_DELAY; if (count == 0) count = 1; - for (i = 0; i < count; i++) { status = EcCheckStatus(sc, "poll", event); if (status == AE_OK) @@ -727,7 +751,7 @@ EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) // We finished waiting for the GPE and it never arrived. Try to // read the register once and trust whatever value we got. This is - // the best we can do at this point. Then, force polled mode on + // the best we can do at this point. // since this system doesn't appear to generate GPEs. if (status != AE_OK) { status = EcCheckStatus(sc, "sleep_end", event); @@ -736,6 +760,8 @@ EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) ec_polled_mode = TRUE; } } + + if (status != AE_OK) TRACE("error: ec wait timed out\n"); @@ -767,11 +793,17 @@ EcCommand(struct acpi_ec_cookie* sc, EC_COMMAND cmd) return AE_BAD_PARAMETER; } + // Ensure empty input buffer before issuing command. + // Use generation count of zero to force a quick check. + acpi_status status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, 0); + if (status != AE_OK) + return status; + // Run the command and wait for the chosen event. TRACE("running command %#x\n", cmd); - u_int gen_count = sc->ec_gencount; + int32 generationCount = sc->ec_gencount; EC_SET_CSR(sc, cmd); - acpi_status status = EcWaitEvent(sc, event, gen_count); + status = EcWaitEvent(sc, event, generationCount); if (status == AE_OK) { // If we succeeded, burst flag should now be present. if (cmd == EC_COMMAND_BURST_ENABLE) { @@ -791,60 +823,39 @@ EcRead(struct acpi_ec_cookie* sc, uint8 address, uint8* readData) { TRACE("read from %#x\n", address); - // If we can't start burst mode, continue anyway. - acpi_status status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); - if (status == AE_OK) { - uint8 data = EC_GET_DATA(sc); - if (data == EC_BURST_ACK) { - TRACE("burst enabled\n"); - sc->ec_burstactive = TRUE; - } - } - - status = EcCommand(sc, EC_COMMAND_READ); - if (status != AE_OK) - return status; - - u_int generationCount = sc->ec_gencount; - - EC_SET_DATA(sc, address); - status = EcWaitEvent(sc, EC_EVENT_OUTPUT_BUFFER_FULL, generationCount); - if (status != AE_OK) { - TRACE("EcRead: failed waiting to get data\n"); - return status; - } - *readData = EC_GET_DATA(sc); - - if (sc->ec_burstactive) { - sc->ec_burstactive = FALSE; - status = EcCommand(sc, EC_COMMAND_BURST_DISABLE); + acpi_status status; + for (uint8 retry = 0; retry < 2; retry++) { + acpi_status status = EcCommand(sc, EC_COMMAND_READ); if (status != AE_OK) return status; - TRACE("disabled burst ok\n"); + + int32 generationCount = sc->ec_gencount; + EC_SET_DATA(sc, address); + status = EcWaitEvent(sc, EC_EVENT_OUTPUT_BUFFER_FULL, generationCount); + if (status != AE_OK) { + if (EcCheckStatus(sc, "retr_check", + EC_EVENT_INPUT_BUFFER_EMPTY) == AE_OK) + continue; + else + break; + } + *readData = EC_GET_DATA(sc); + return AE_OK; } - return AE_OK; + TRACE("EcRead: failed waiting to get data\n"); + return status; } static acpi_status -EcWrite(struct acpi_ec_cookie* sc, uint8 address, uint8* writeData) +EcWrite(struct acpi_ec_cookie* sc, uint8 address, uint8 writeData) { - /* If we can't start burst mode, continue anyway. */ - acpi_status status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); - if (status == AE_OK) { - uint8 data = EC_GET_DATA(sc); - if (data == EC_BURST_ACK) { - TRACE("burst enabled\n"); - sc->ec_burstactive = TRUE; - } - } - - status = EcCommand(sc, EC_COMMAND_WRITE); + acpi_status status = EcCommand(sc, EC_COMMAND_WRITE); if (status != AE_OK) return status; - u_int generationCount = sc->ec_gencount; + int32 generationCount = sc->ec_gencount; EC_SET_DATA(sc, address); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, generationCount); if (status != AE_OK) { @@ -853,20 +864,12 @@ EcWrite(struct acpi_ec_cookie* sc, uint8 address, uint8* writeData) } generationCount = sc->ec_gencount; - EC_SET_DATA(sc, *writeData); + EC_SET_DATA(sc, writeData); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, generationCount); if (status != AE_OK) { TRACE("EcWrite: failed waiting for sent data\n"); return status; } - if (sc->ec_burstactive) { - sc->ec_burstactive = FALSE; - status = EcCommand(sc, EC_COMMAND_BURST_DISABLE); - if (status != AE_OK) - return (status); - TRACE("disabled burst ok\n"); - } - return AE_OK; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h index bc5f9cfaf2..e8e1ef2cf3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h @@ -43,6 +43,7 @@ extern "C" { # include "acpi.h" # include "accommon.h" # include "acnamesp.h" +# include "actypes.h" # include "acpi_priv.h" } @@ -54,11 +55,8 @@ extern "C" { # define TRACE(x...) #endif +#define ERROR(x...) dprintf("EC: " x) -#define ACPI_REGION_DEACTIVATE 1 - -#define ACPI_READ 0 -#define ACPI_WRITE 1 typedef uint8 EC_COMMAND; @@ -128,12 +126,10 @@ typedef uint8 EC_EVENT; #define EC_SET_CSR(sc, v) \ bus_space_write_1((sc)->ec_csr_pci_address, (v)) - #define ACPI_PKG_VALID(pkg, size) \ ((pkg) != NULL && (pkg)->object_type == ACPI_TYPE_PACKAGE && \ (pkg)->data.package.count >= (size)) -int32 acpi_get_type(device_node* dev); /* * Driver cookie. @@ -213,7 +209,8 @@ EcUnlock(struct acpi_ec_cookie *sc) } -static uint32 EcGpeHandler(void *context); +static uint32 EcGpeHandler(acpi_handle gpeDevice, uint32 gpeNumber, + void *context); static acpi_status EcSpaceSetup(acpi_handle region, uint32 function, void *context, void **return_Context); @@ -227,7 +224,7 @@ static acpi_status EcCommand(struct acpi_ec_cookie *sc, EC_COMMAND cmd); static acpi_status EcRead(struct acpi_ec_cookie *sc, uint8 address, uint8 *readData); static acpi_status EcWrite(struct acpi_ec_cookie *sc, uint8 address, - uint8 *writeData); + uint8 writeData); #endif // ACPI_EMBEDDED_CONTROLLER_H diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c b/src/add-ons/kernel/bus_managers/acpi/acpi_module.c index b4a384c7de..fbddef1228 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_module.c @@ -192,8 +192,12 @@ static struct acpi_root_info sACPIRootModule = { release_global_lock, install_notify_handler, remove_notify_handler, + update_all_gpes, enable_gpe, + disable_gpe, + clear_gpe, set_gpe, + finish_gpe, install_gpe_handler, remove_gpe_handler, install_address_space_handler, diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h b/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h index a4d4462bc0..ec8b7a7849 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h @@ -60,14 +60,17 @@ typedef struct acpi_root_info { uint32 handlerType, acpi_notify_handler handler); /* GPE Handler */ - + status_t (*update_all_gpes)(); status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber); + status_t (*disable_gpe)(acpi_handle handle, uint32 gpeNumber); + status_t (*clear_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*set_gpe)(acpi_handle handle, uint32 gpeNumber, uint8 action); + status_t (*finish_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*install_gpe_handler)(acpi_handle handle, uint32 gpeNumber, - uint32 type, acpi_event_handler handler, void *data); + uint32 type, acpi_gpe_handler handler, void *data); status_t (*remove_gpe_handler)(acpi_handle handle, uint32 gpeNumber, - acpi_event_handler address); + acpi_gpe_handler address); /* Address Space Handler */ @@ -162,12 +165,16 @@ status_t install_notify_handler(acpi_handle device, uint32 handlerType, status_t remove_notify_handler(acpi_handle device, uint32 handlerType, acpi_notify_handler handler); +status_t update_all_gpes(); status_t enable_gpe(acpi_handle handle, uint32 gpeNumber); +status_t disable_gpe(acpi_handle handle, uint32 gpeNumber); +status_t clear_gpe(acpi_handle handle, uint32 gpeNumber); status_t set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action); +status_t finish_gpe(acpi_handle handle, uint32 gpeNumber); status_t install_gpe_handler(acpi_handle handle, uint32 gpeNumber, uint32 type, - acpi_event_handler handler, void* data); + acpi_gpe_handler handler, void* data); status_t remove_gpe_handler(acpi_handle handle, uint32 gpeNumber, - acpi_event_handler address); + acpi_gpe_handler address); status_t install_address_space_handler(acpi_handle handle, uint32 spaceID, acpi_adr_space_handler handler, acpi_adr_space_setup setup, void* data); diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adfile.c b/src/add-ons/kernel/bus_managers/acpi/common/adfile.c index 629bd535c4..a7020cb9c2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adfile.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adfile.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c b/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c index 99f91ba050..748561f708 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -667,7 +667,7 @@ AdCreateTableHeader ( if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) { - AcpiOsPrintf (" **** ACPI 1.0, no 64-bit math support"); + AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support"); } break; diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c b/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c index e8f580c1c1..b4e227daba 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c b/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c index 393de1d53b..b2e2acbc80 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c b/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c index 184a856ed6..827dc26684 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c index 05bd5e4945..a9e6a1de63 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -134,6 +134,13 @@ AcpiDmCheckAscii ( UINT32 Count); +/* Common format strings for commented values */ + +#define UINT8_FORMAT "%2.2X [%s]\n" +#define UINT16_FORMAT "%4.4X [%s]\n" +#define UINT32_FORMAT "%8.8X [%s]\n" +#define STRING_FORMAT "[%s]\n" + /* These tables map a subtable type to a description string */ static const char *AcpiDmAsfSubnames[] = @@ -264,6 +271,13 @@ static const char *AcpiDmMadtSubnames[] = "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmSlicSubnames[] = +{ + "Public Key Structure", + "Windows Marker Structure", + "Unknown SubTable Type" /* Reserved */ +}; + static const char *AcpiDmSratSubnames[] = { "Processor Local APIC/SAPIC Affinity", @@ -295,6 +309,19 @@ static const char *AcpiDmFadtProfiles[] = "Unknown Profile Type" }; +#define ACPI_GAS_WIDTH_RESERVED 5 + +static const char *AcpiDmGasAccessWidth[] = +{ + "Undefined/Legacy", + "Byte Access:8", + "Word Access:16", + "DWord Access:32", + "QWord Access:64", + "Unknown Width Encoding" +}; + + /******************************************************************************* * * ACPI Table Data, indexed by signature. @@ -329,13 +356,13 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"}, - {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, NULL, NULL, "Software Licensing Description Table"}, + {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"}, {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"}, {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"}, {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"}, - {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, NULL, TemplateUefi, "UEFI Boot Optimization Table"}, + {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"}, {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"}, {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"}, {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"}, @@ -503,7 +530,8 @@ AcpiDmDumpDataTable ( { /* Dump the raw table data */ - AcpiOsPrintf ("\nRaw Table Data\n\n"); + AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n", + ACPI_RAW_TABLE_DATA_HEADER, Length, Length); AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY); } } @@ -533,30 +561,48 @@ AcpiDmLineHeader ( char *Name) { + /* Allow a null name for fields that span multiple lines (large buffers) */ + + if (!Name) + { + Name = ""; + } + if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ { if (ByteLength) { - AcpiOsPrintf ("[%.3d] %34s : ", - ByteLength, Name); + AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name); } else { - AcpiOsPrintf ("%40s : ", - Name); + if (*Name) + { + AcpiOsPrintf ("%41s : ", Name); + } + else + { + AcpiOsPrintf ("%41s ", Name); + } } } else /* Normal disassembler or verbose template */ { if (ByteLength) { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ", + AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ", Offset, Offset, ByteLength, Name); } else { - AcpiOsPrintf ("%43s : ", - Name); + if (*Name) + { + AcpiOsPrintf ("%44s : ", Name); + } + else + { + AcpiOsPrintf ("%44s ", Name); + } } } } @@ -573,7 +619,7 @@ AcpiDmLineHeader2 ( { if (ByteLength) { - AcpiOsPrintf ("[%.3d] %30s % 3d : ", + AcpiOsPrintf ("[%.4d] %30s %3d : ", ByteLength, Name, Value); } else @@ -586,12 +632,12 @@ AcpiDmLineHeader2 ( { if (ByteLength) { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ", + AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ", Offset, Offset, ByteLength, Name, Value); } else { - AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ", + AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ", Offset, Offset, Name, Value); } } @@ -669,6 +715,7 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT8: case ACPI_DMT_CHKSUM: case ACPI_DMT_SPACEID: + case ACPI_DMT_ACCWIDTH: case ACPI_DMT_IVRS: case ACPI_DMT_MADT: case ACPI_DMT_SRAT: @@ -692,12 +739,14 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT32: case ACPI_DMT_NAME4: case ACPI_DMT_SIG: + case ACPI_DMT_SLIC: ByteLength = 4; break; case ACPI_DMT_NAME6: ByteLength = 6; break; case ACPI_DMT_UINT56: + case ACPI_DMT_BUF7: ByteLength = 7; break; case ACPI_DMT_UINT64: @@ -705,8 +754,12 @@ AcpiDmDumpTable ( ByteLength = 8; break; case ACPI_DMT_BUF16: + case ACPI_DMT_UUID: ByteLength = 16; break; + case ACPI_DMT_BUF128: + ByteLength = 128; + break; case ACPI_DMT_STRING: ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; break; @@ -807,21 +860,43 @@ AcpiDmDumpTable ( ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); break; + case ACPI_DMT_BUF7: case ACPI_DMT_BUF16: + case ACPI_DMT_BUF128: - /* Buffer of length 16 */ - - for (Temp8 = 0; Temp8 < 16; Temp8++) + /* + * Buffer: Size depends on the opcode and was set above. + * Each hex byte is separated with a space. + * Multiple lines are separated by line continuation char. + */ + for (Temp16 = 0; Temp16 < ByteLength; Temp16++) { - AcpiOsPrintf ("%2.2X", Target[Temp8]); - if ((Temp8 + 1) < 16) + AcpiOsPrintf ("%2.2X", Target[Temp16]); + if ((UINT32) (Temp16 + 1) < ByteLength) { - AcpiOsPrintf (","); + if ((Temp16 > 0) && (!((Temp16+1) % 16))) + { + AcpiOsPrintf (" \\\n"); /* Line continuation */ + AcpiDmLineHeader (0, 0, NULL); + } + else + { + AcpiOsPrintf (" "); + } } } AcpiOsPrintf ("\n"); break; + case ACPI_DMT_UUID: + + /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */ + + (void) AuConvertUuidToString ((char *) Target, MsgBuffer); + + AcpiOsPrintf ("%s\n", MsgBuffer); + break; + case ACPI_DMT_STRING: AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target)); @@ -836,9 +911,12 @@ AcpiDmDumpTable ( TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); if (TableData) { - AcpiOsPrintf ("/* %s */", TableData->Name); + AcpiOsPrintf (STRING_FORMAT, TableData->Name); + } + else + { + AcpiOsPrintf ("\n"); } - AcpiOsPrintf ("\n"); break; case ACPI_DMT_NAME4: @@ -881,14 +959,27 @@ AcpiDmDumpTable ( /* Address Space ID */ - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target)); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target)); + break; + + case ACPI_DMT_ACCWIDTH: + + /* Encoded Access Width */ + + Temp8 = *Target; + if (Temp8 > ACPI_GAS_WIDTH_RESERVED) + { + Temp8 = ACPI_GAS_WIDTH_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]); break; case ACPI_DMT_GAS: /* Generic Address Structure */ - AcpiOsPrintf ("\n"); + AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure"); AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); AcpiOsPrintf ("\n"); @@ -905,7 +996,7 @@ AcpiDmDumpTable ( Temp16 = ACPI_ASF_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]); break; case ACPI_DMT_DMAR: @@ -918,7 +1009,7 @@ AcpiDmDumpTable ( Temp16 = ACPI_DMAR_TYPE_RESERVED; } - AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); break; case ACPI_DMT_EINJACT: @@ -931,7 +1022,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_EINJ_ACTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjActions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]); break; case ACPI_DMT_EINJINST: @@ -944,7 +1035,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjInstructions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]); break; case ACPI_DMT_ERSTACT: @@ -957,7 +1048,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_ERST_ACTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstActions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]); break; case ACPI_DMT_ERSTINST: @@ -970,7 +1061,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_ERST_INSTRUCTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstInstructions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]); break; case ACPI_DMT_HEST: @@ -983,12 +1074,12 @@ AcpiDmDumpTable ( Temp16 = ACPI_HEST_TYPE_RESERVED; } - AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); break; case ACPI_DMT_HESTNTFY: - AcpiOsPrintf ("\n"); + AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure"); AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); AcpiOsPrintf ("\n"); @@ -1005,7 +1096,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_HEST_NOTIFY_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]); break; case ACPI_DMT_MADT: @@ -1018,7 +1109,20 @@ AcpiDmDumpTable ( Temp8 = ACPI_MADT_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]); + break; + + case ACPI_DMT_SLIC: + + /* SLIC subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_SLIC_TYPE_RESERVED) + { + Temp8 = ACPI_SLIC_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]); break; case ACPI_DMT_SRAT: @@ -1031,7 +1135,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_SRAT_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]); break; case ACPI_DMT_FADTPM: @@ -1044,7 +1148,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_FADT_PM_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]); break; case ACPI_DMT_IVRS: @@ -1069,7 +1173,7 @@ AcpiDmDumpTable ( break; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name); + AcpiOsPrintf (UINT8_FORMAT, *Target, Name); break; case ACPI_DMT_EXIT: diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c index 8bbaf663fb..2102bab469 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,12 @@ ACPI_MODULE_NAME ("dmtbdump") +static void +AcpiDmValidateFadtLength ( + UINT32 Revision, + UINT32 Length); + + /******************************************************************************* * * FUNCTION: AcpiDmDumpRsdp @@ -273,6 +279,10 @@ AcpiDmDumpXsdt ( * * DESCRIPTION: Format the contents of a FADT * + * NOTE: We cannot depend on the FADT version to indicate the actual + * contents of the FADT because of BIOS bugs. The table length + * is the only reliable indicator. + * ******************************************************************************/ void @@ -280,20 +290,21 @@ AcpiDmDumpFadt ( ACPI_TABLE_HEADER *Table) { - /* Common ACPI 1.0 portion of FADT */ + /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); - /* Check for ACPI 1.0B MS extensions (FADT revision 2) */ + /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */ - if (Table->Revision == 2) + if ((Table->Length > ACPI_FADT_V1_SIZE) && + (Table->Length <= ACPI_FADT_V2_SIZE)) { AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); } - /* Check for ACPI 2.0+ extended data (FADT revision 3+) */ + /* Check for FADT revision 3 fields and up (ACPI 2.0+ extended data) */ - else if (Table->Length >= sizeof (ACPI_TABLE_FADT)) + else if (Table->Length > ACPI_FADT_V2_SIZE) { AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); } @@ -301,6 +312,68 @@ AcpiDmDumpFadt ( /* Validate various fields in the FADT, including length */ AcpiTbCreateLocalFadt (Table, Table->Length); + + /* Validate FADT length against the revision */ + + AcpiDmValidateFadtLength (Table->Revision, Table->Length); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmValidateFadtLength + * + * PARAMETERS: Revision - FADT revision (Header->Revision) + * Length - FADT length (Header->Length + * + * RETURN: None + * + * DESCRIPTION: Check the FADT revision against the expected table length for + * that revision. Issue a warning if the length is not what was + * expected. This seems to be such a common BIOS bug that the + * FADT revision has been rendered virtually meaningless. + * + ******************************************************************************/ + +static void +AcpiDmValidateFadtLength ( + UINT32 Revision, + UINT32 Length) +{ + UINT32 ExpectedLength; + + + switch (Revision) + { + case 0: + AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n"); + return; + + case 1: + ExpectedLength = ACPI_FADT_V1_SIZE; + break; + + case 2: + ExpectedLength = ACPI_FADT_V2_SIZE; + break; + + case 3: + case 4: + ExpectedLength = ACPI_FADT_V3_SIZE; + break; + + default: + return; + } + + if (Length == ExpectedLength) + { + return; + } + + AcpiOsPrintf ( + "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n", + Revision, Length, ExpectedLength); } @@ -1272,6 +1345,81 @@ AcpiDmDumpMsct ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpSlic + * + * PARAMETERS: Table - A SLIC table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a SLIC + * + ******************************************************************************/ + +void +AcpiDmDumpSlic ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_SLIC); + ACPI_SLIC_HEADER *SubTable; + ACPI_DMTABLE_INFO *InfoTable; + + + /* There is no main SLIC table, only subtables */ + + SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common sub-table header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoSlicHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (SubTable->Type) + { + case ACPI_SLIC_TYPE_PUBLIC_KEY: + InfoTable = AcpiDmTableInfoSlic0; + break; + case ACPI_SLIC_TYPE_WINDOWS_MARKER: + InfoTable = AcpiDmTableInfoSlic1; + break; + default: + AcpiOsPrintf ("\n**** Unknown SLIC sub-table type 0x%X\n", SubTable->Type); + + /* Attempt to continue */ + + if (!SubTable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubTable; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + +NextSubTable: + /* Point to next sub-table */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length); + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpSlit @@ -1332,12 +1480,12 @@ AcpiDmDumpSlit ( if ((j+1) < Localities) { - AcpiOsPrintf (","); + AcpiOsPrintf (" "); if (j && (((j+1) % 16) == 0)) { - AcpiOsPrintf ("\n"); - AcpiDmLineHeader (Offset, 0, ""); + AcpiOsPrintf ("\\\n"); /* With line continuation char */ + AcpiDmLineHeader (Offset, 0, NULL); } } } diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c index 9abf586b3f..05e5709c46 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -122,6 +122,31 @@ #define _COMPONENT ACPI_CA_DISASSEMBLER ACPI_MODULE_NAME ("dmtbinfo") +/* + * How to add a new table: + * + * - Add the C table definition to the actbl1.h or actbl2.h header. + * - Add ACPI_xxxx_OFFSET macro(s) for the table (and subtables) to list below. + * - Define the table in this file (for the disassembler). If any + * new data types are required (ACPI_DMT_*), see below. + * - Add an external declaration for the new table definition (AcpiDmTableInfo*) + * in acdisam.h + * - Add new table definition to the dispatch table in dmtable.c (AcpiDmTableData) + * If a simple table (with no subtables), no disassembly code is needed. + * Otherwise, create the AcpiDmDump* function for to disassemble the table + * and add it to the dmtbdump.c file. + * - Add an external declaration for the new AcpiDmDump* function in acdisasm.h + * - Add the new AcpiDmDump* function to the dispatch table in dmtable.c + * - Create a template for the new table + * - Add data table compiler support + * + * How to add a new data type (ACPI_DMT_*): + * + * - Add new type at the end of the ACPI_DMT list in acdisasm.h + * - Add length and implementation cases in dmtable.c (disassembler) + * - Add type and length cases in dtutils.c (DT compiler) + */ + /* * Macros used to generate offsets to specific table fields */ @@ -203,6 +228,9 @@ #define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) #define ACPI_MSCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) +#define ACPI_SLICH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_HEADER,f) +#define ACPI_SLIC0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_KEY,f) +#define ACPI_SLIC1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_MARKER,f) #define ACPI_SRATH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) #define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) @@ -282,7 +310,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] = {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID", 0}, {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width", 0}, {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset", 0}, - {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (AccessWidth), "Access Width", 0}, + {ACPI_DMT_ACCWIDTH, ACPI_GAS_OFFSET (AccessWidth), "Encoded Access Width", 0}, {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address", 0}, ACPI_DMT_TERMINATOR }; @@ -549,7 +577,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] = ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] = { - {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0}, + {ACPI_DMT_BUF7, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0}, {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code", 0}, {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID", 0}, {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command", 0}, @@ -1328,13 +1356,42 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = /******************************************************************************* * - * SLIC - Software Licensing Description Table. NOT FULLY IMPLEMENTED, do not - * have the table definition. + * SLIC - Software Licensing Description Table. There is no common table, just + * the standard ACPI header and then subtables. * ******************************************************************************/ -ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] = +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[] = { + {ACPI_DMT_SLIC, ACPI_SLICH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT32, ACPI_SLICH_OFFSET (Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[] = +{ + {ACPI_DMT_UINT8, ACPI_SLIC0_OFFSET (KeyType), "Key Type", 0}, + {ACPI_DMT_UINT8, ACPI_SLIC0_OFFSET (Version), "Version", 0}, + {ACPI_DMT_UINT16, ACPI_SLIC0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (Algorithm), "Algorithm", 0}, + {ACPI_DMT_NAME4, ACPI_SLIC0_OFFSET (Magic), "Magic", 0}, + {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (BitLength), "BitLength", 0}, + {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (Exponent), "Exponent", 0}, + {ACPI_DMT_BUF128, ACPI_SLIC0_OFFSET (Modulus[0]), "Modulus", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoSlic1[] = +{ + {ACPI_DMT_UINT32, ACPI_SLIC1_OFFSET (Version), "Version", 0}, + {ACPI_DMT_NAME6, ACPI_SLIC1_OFFSET (OemId[0]), "Oem ID", 0}, + {ACPI_DMT_NAME8, ACPI_SLIC1_OFFSET (OemTableId[0]), "Oem Table ID", 0}, + {ACPI_DMT_NAME8, ACPI_SLIC1_OFFSET (WindowsFlag[0]), "Windows Flag", 0}, + {ACPI_DMT_UINT32, ACPI_SLIC1_OFFSET (SlicVersion), "SLIC Version", 0}, + {ACPI_DMT_BUF16, ACPI_SLIC1_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_BUF128, ACPI_SLIC1_OFFSET (Signature[0]), "Signature", 0}, ACPI_DMT_TERMINATOR }; @@ -1503,7 +1560,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] = { - {ACPI_DMT_BUF16, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier", 0}, + {ACPI_DMT_UUID, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier", 0}, {ACPI_DMT_UINT16, ACPI_UEFI_OFFSET (DataOffset), "Data Offset", 0}, ACPI_DMT_TERMINATOR }; @@ -1623,3 +1680,43 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Units), "Counter Units", 0}, ACPI_DMT_TERMINATOR }; + +/* + * Generic types (used in UEFI) + * + * Examples: + * + * Buffer : cc 04 ff bb + * UINT8 : 11 + * UINT16 : 1122 + * UINT24 : 112233 + * UINT32 : 11223344 + * UINT56 : 11223344556677 + * UINT64 : 1122334455667788 + * + * String : "This is string" + * Unicode : "This string encoded to Unicode" + * + * GUID : 11223344-5566-7788-99aa-bbccddeeff00 + * DevicePath : "\PciRoot(0)\Pci(0x1f,1)\Usb(0,0)" + */ + +#define ACPI_DM_GENERIC_ENTRY(FieldType, FieldName)\ + {{FieldType, 0, FieldName, 0}, ACPI_DMT_TERMINATOR} + +ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] = +{ + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT8, "UINT8"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT16, "UINT16"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT24, "UINT24"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT32, "UINT32"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT56, "UINT56"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT64, "UINT64"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "String"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UNICODE, "Unicode"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_BUFFER, "Buffer"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UUID, "GUID"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "DevicePath"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_LABEL, "Label"), + {ACPI_DMT_TERMINATOR} +}; diff --git a/src/add-ons/kernel/bus_managers/acpi/common/getopt.c b/src/add-ons/kernel/bus_managers/acpi/common/getopt.c index 9a8589c995..aaca1ffe27 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/getopt.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/getopt.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsargs.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsargs.c new file mode 100644 index 0000000000..44cc41b339 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsargs.c @@ -0,0 +1,502 @@ +/****************************************************************************** + * + * Module Name: dsargs - Support for execution of dynamic arguments for static + * objects (regions, fields, buffer fields, etc.) + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __DSARGS_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acnamesp.h" + +#define _COMPONENT ACPI_DISPATCHER + ACPI_MODULE_NAME ("dsargs") + +/* Local prototypes */ + +static ACPI_STATUS +AcpiDsExecuteArguments ( + ACPI_NAMESPACE_NODE *Node, + ACPI_NAMESPACE_NODE *ScopeNode, + UINT32 AmlLength, + UINT8 *AmlStart); + + +/******************************************************************************* + * + * FUNCTION: AcpiDsExecuteArguments + * + * PARAMETERS: Node - Object NS node + * ScopeNode - Parent NS node + * AmlLength - Length of executable AML + * AmlStart - Pointer to the AML + * + * RETURN: Status. + * + * DESCRIPTION: Late (deferred) execution of region or field arguments + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDsExecuteArguments ( + ACPI_NAMESPACE_NODE *Node, + ACPI_NAMESPACE_NODE *ScopeNode, + UINT32 AmlLength, + UINT8 *AmlStart) +{ + ACPI_STATUS Status; + ACPI_PARSE_OBJECT *Op; + ACPI_WALK_STATE *WalkState; + + + ACPI_FUNCTION_TRACE (DsExecuteArguments); + + + /* Allocate a new parser op to be the root of the parsed tree */ + + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Save the Node for use in AcpiPsParseAml */ + + Op->Common.Node = ScopeNode; + + /* Create and initialize a new parser state */ + + WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); + if (!WalkState) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, + AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } + + /* Mark this parse as a deferred opcode */ + + WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP; + WalkState->DeferredNode = Node; + + /* Pass1: Parse the entire declaration */ + + Status = AcpiPsParseAml (WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + /* Get and init the Op created above */ + + Op->Common.Node = Node; + AcpiPsDeleteParseTree (Op); + + /* Evaluate the deferred arguments */ + + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Op->Common.Node = ScopeNode; + + /* Create and initialize a new parser state */ + + WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); + if (!WalkState) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Execute the opcode and arguments */ + + Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, + AmlLength, NULL, ACPI_IMODE_EXECUTE); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } + + /* Mark this execution as a deferred opcode */ + + WalkState->DeferredNode = Node; + Status = AcpiPsParseAml (WalkState); + +Cleanup: + AcpiPsDeleteParseTree (Op); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetBufferFieldArguments + * + * PARAMETERS: ObjDesc - A valid BufferField object + * + * RETURN: Status. + * + * DESCRIPTION: Get BufferField Buffer and Index. This implements the late + * evaluation of these field attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetBufferFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_OPERAND_OBJECT *ExtraDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the AML pointer (method object) and BufferField node */ + + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + Node = ObjDesc->BufferField.Node; + + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, + Node, NULL)); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", + AcpiUtGetNodeName (Node))); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, Node->Parent, + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetBankFieldArguments + * + * PARAMETERS: ObjDesc - A valid BankField object + * + * RETURN: Status. + * + * DESCRIPTION: Get BankField BankValue. This implements the late + * evaluation of these field attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetBankFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_OPERAND_OBJECT *ExtraDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the AML pointer (method object) and BankField node */ + + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + Node = ObjDesc->BankField.Node; + + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, + Node, NULL)); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", + AcpiUtGetNodeName (Node))); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, Node->Parent, + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetBufferArguments + * + * PARAMETERS: ObjDesc - A valid Buffer object + * + * RETURN: Status. + * + * DESCRIPTION: Get Buffer length and initializer byte list. This implements + * the late evaluation of these attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetBufferArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the Buffer node */ + + Node = ObjDesc->Buffer.Node; + if (!Node) + { + ACPI_ERROR ((AE_INFO, + "No pointer back to namespace node in buffer object %p", ObjDesc)); + return_ACPI_STATUS (AE_AML_INTERNAL); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n")); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, Node, + ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetPackageArguments + * + * PARAMETERS: ObjDesc - A valid Package object + * + * RETURN: Status. + * + * DESCRIPTION: Get Package length and initializer byte list. This implements + * the late evaluation of these attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetPackageArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the Package node */ + + Node = ObjDesc->Package.Node; + if (!Node) + { + ACPI_ERROR ((AE_INFO, + "No pointer back to namespace node in package %p", ObjDesc)); + return_ACPI_STATUS (AE_AML_INTERNAL); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, Node, + ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetRegionArguments + * + * PARAMETERS: ObjDesc - A valid region object + * + * RETURN: Status. + * + * DESCRIPTION: Get region address and length. This implements the late + * evaluation of these region attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetRegionArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ExtraDesc; + + + ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc); + + + if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + if (!ExtraDesc) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + /* Get the Region node */ + + Node = ObjDesc->Region.Node; + + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL)); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", + AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart)); + + /* Execute the argument AML */ + + Status = AcpiDsExecuteArguments (Node, Node->Parent, + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + return_ACPI_STATUS (Status); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dscontrol.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dscontrol.c new file mode 100644 index 0000000000..41435e072c --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dscontrol.c @@ -0,0 +1,496 @@ +/****************************************************************************** + * + * Module Name: dscontrol - Support for execution control opcodes - + * if/else/while/return + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __DSCONTROL_C__ + +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" + +#define _COMPONENT ACPI_DISPATCHER + ACPI_MODULE_NAME ("dscontrol") + + +/******************************************************************************* + * + * FUNCTION: AcpiDsExecBeginControlOp + * + * PARAMETERS: WalkList - The list that owns the walk stack + * Op - The control Op + * + * RETURN: Status + * + * DESCRIPTION: Handles all control ops encountered during control method + * execution. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsExecBeginControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GENERIC_STATE *ControlState; + + + ACPI_FUNCTION_NAME (DsExecBeginControlOp); + + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", + Op, Op->Common.AmlOpcode, WalkState)); + + switch (Op->Common.AmlOpcode) + { + case AML_WHILE_OP: + + /* + * If this is an additional iteration of a while loop, continue. + * There is no need to allocate a new control state. + */ + if (WalkState->ControlState) + { + if (WalkState->ControlState->Control.AmlPredicateStart == + (WalkState->ParserState.Aml - 1)) + { + /* Reset the state to start-of-loop */ + + WalkState->ControlState->Common.State = + ACPI_CONTROL_CONDITIONAL_EXECUTING; + break; + } + } + + /*lint -fallthrough */ + + case AML_IF_OP: + + /* + * IF/WHILE: Create a new control state to manage these + * constructs. We need to manage these as a stack, in order + * to handle nesting. + */ + ControlState = AcpiUtCreateControlState (); + if (!ControlState) + { + Status = AE_NO_MEMORY; + break; + } + /* + * Save a pointer to the predicate for multiple executions + * of a loop + */ + ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1; + ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd; + ControlState->Control.Opcode = Op->Common.AmlOpcode; + + + /* Push the control state on this walk's control stack */ + + AcpiUtPushGenericState (&WalkState->ControlState, ControlState); + break; + + case AML_ELSE_OP: + + /* Predicate is in the state object */ + /* If predicate is true, the IF was executed, ignore ELSE part */ + + if (WalkState->LastPredicate) + { + Status = AE_CTRL_TRUE; + } + + break; + + case AML_RETURN_OP: + + break; + + default: + break; + } + + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsExecEndControlOp + * + * PARAMETERS: WalkList - The list that owns the walk stack + * Op - The control Op + * + * RETURN: Status + * + * DESCRIPTION: Handles all control ops encountered during control method + * execution. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsExecEndControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GENERIC_STATE *ControlState; + + + ACPI_FUNCTION_NAME (DsExecEndControlOp); + + + switch (Op->Common.AmlOpcode) + { + case AML_IF_OP: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op)); + + /* + * Save the result of the predicate in case there is an + * ELSE to come + */ + WalkState->LastPredicate = + (BOOLEAN) WalkState->ControlState->Common.Value; + + /* + * Pop the control state that was created at the start + * of the IF and free it + */ + ControlState = AcpiUtPopGenericState (&WalkState->ControlState); + AcpiUtDeleteGenericState (ControlState); + break; + + + case AML_ELSE_OP: + + break; + + + case AML_WHILE_OP: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op)); + + ControlState = WalkState->ControlState; + if (ControlState->Common.Value) + { + /* Predicate was true, the body of the loop was just executed */ + + /* + * This loop counter mechanism allows the interpreter to escape + * possibly infinite loops. This can occur in poorly written AML + * when the hardware does not respond within a while loop and the + * loop does not implement a timeout. + */ + ControlState->Control.LoopCount++; + if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS) + { + Status = AE_AML_INFINITE_LOOP; + break; + } + + /* + * Go back and evaluate the predicate and maybe execute the loop + * another time + */ + Status = AE_CTRL_PENDING; + WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; + break; + } + + /* Predicate was false, terminate this while loop */ + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "[WHILE_OP] termination! Op=%p\n",Op)); + + /* Pop this control state and free it */ + + ControlState = AcpiUtPopGenericState (&WalkState->ControlState); + AcpiUtDeleteGenericState (ControlState); + break; + + + case AML_RETURN_OP: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg)); + + /* + * One optional operand -- the return value + * It can be either an immediate operand or a result that + * has been bubbled up the tree + */ + if (Op->Common.Value.Arg) + { + /* Since we have a real Return(), delete any implicit return */ + + AcpiDsClearImplicitReturn (WalkState); + + /* Return statement has an immediate operand */ + + Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * If value being returned is a Reference (such as + * an arg or local), resolve it now because it may + * cease to exist at the end of the method. + */ + Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * Get the return value and save as the last result + * value. This is the only place where WalkState->ReturnDesc + * is set to anything other than zero! + */ + WalkState->ReturnDesc = WalkState->Operands[0]; + } + else if (WalkState->ResultCount) + { + /* Since we have a real Return(), delete any implicit return */ + + AcpiDsClearImplicitReturn (WalkState); + + /* + * The return value has come from a previous calculation. + * + * If value being returned is a Reference (such as + * an arg or local), resolve it now because it may + * cease to exist at the end of the method. + * + * Allow references created by the Index operator to return + * unchanged. + */ + if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) && + ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX)) + { + Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0]; + } + else + { + /* No return operand */ + + if (WalkState->NumOperands) + { + AcpiUtRemoveReference (WalkState->Operands [0]); + } + + WalkState->Operands [0] = NULL; + WalkState->NumOperands = 0; + WalkState->ReturnDesc = NULL; + } + + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Completed RETURN_OP State=%p, RetVal=%p\n", + WalkState, WalkState->ReturnDesc)); + + /* End the control method execution right now */ + + Status = AE_CTRL_TERMINATE; + break; + + + case AML_NOOP_OP: + + /* Just do nothing! */ + break; + + + case AML_BREAK_POINT_OP: + + /* + * Set the single-step flag. This will cause the debugger (if present) + * to break to the console within the AML debugger at the start of the + * next AML instruction. + */ + ACPI_DEBUGGER_EXEC ( + AcpiGbl_CmSingleStep = TRUE); + ACPI_DEBUGGER_EXEC ( + AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n")); + + /* Call to the OSL in case OS wants a piece of the action */ + + Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, + "Executed AML Breakpoint opcode"); + break; + + + case AML_BREAK_OP: + case AML_CONTINUE_OP: /* ACPI 2.0 */ + + + /* Pop and delete control states until we find a while */ + + while (WalkState->ControlState && + (WalkState->ControlState->Control.Opcode != AML_WHILE_OP)) + { + ControlState = AcpiUtPopGenericState (&WalkState->ControlState); + AcpiUtDeleteGenericState (ControlState); + } + + /* No while found? */ + + if (!WalkState->ControlState) + { + return (AE_AML_NO_WHILE); + } + + /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */ + + WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd; + + /* Return status depending on opcode */ + + if (Op->Common.AmlOpcode == AML_BREAK_OP) + { + Status = AE_CTRL_BREAK; + } + else + { + Status = AE_CTRL_CONTINUE; + } + break; + + + default: + + ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p", + Op->Common.AmlOpcode, Op)); + + Status = AE_AML_BAD_OPCODE; + break; + } + + return (Status); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsfield.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsfield.c index 23e33782d5..39d2e885a0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsfield.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsfield.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c index a75bf91dda..f9d1e2498b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c index 37d5f206e6..8f7d6bd15d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +117,6 @@ #include "acpi.h" #include "accommon.h" -#include "amlcode.h" #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" @@ -291,7 +290,7 @@ AcpiDsBeginMethodExecution ( /* * If this method is serialized, we need to acquire the method mutex. */ - if (ObjDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) { /* * Create a mutex for the method if it is defined to be Serialized @@ -517,9 +516,9 @@ AcpiDsCallControlMethod ( /* Invoke an internal method if necessary */ - if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY) { - Status = ObjDesc->Method.Extra.Implementation (NextWalkState); + Status = ObjDesc->Method.Dispatch.Implementation (NextWalkState); if (Status == AE_OK) { Status = AE_CTRL_TERMINATE; @@ -694,11 +693,14 @@ AcpiDsTerminateControlMethod ( /* * Delete any namespace objects created anywhere within the - * namespace by the execution of this method. Unless this method - * is a module-level executable code method, in which case we - * want make the objects permanent. + * namespace by the execution of this method. Unless: + * 1) This method is a module-level executable code method, in which + * case we want make the objects permanent. + * 2) There are other threads executing the method, in which case we + * will wait until the last thread has completed. */ - if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)) + if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) && + (MethodDesc->Method.ThreadCount == 1)) { /* Delete any direct children of (created by) this method */ @@ -707,10 +709,14 @@ AcpiDsTerminateControlMethod ( /* * Delete any objects that were created by this method * elsewhere in the namespace (if any were created). + * Use of the ACPI_METHOD_MODIFIED_NAMESPACE optimizes the + * deletion such that we don't have to perform an entire + * namespace walk for every control method execution. */ - if (MethodDesc->Method.Flags & AOPOBJ_MODIFIED_NAMESPACE) + if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE) { AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); + MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_MODIFIED_NAMESPACE; } } } @@ -748,20 +754,39 @@ AcpiDsTerminateControlMethod ( * Serialized if it appears that the method is incorrectly written and * does not support multiple thread execution. The best example of this * is if such a method creates namespace objects and blocks. A second - * thread will fail with an AE_ALREADY_EXISTS exception + * thread will fail with an AE_ALREADY_EXISTS exception. * * This code is here because we must wait until the last thread exits - * before creating the synchronization semaphore. + * before marking the method as serialized. */ - if ((MethodDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) && - (!MethodDesc->Method.Mutex)) + if (MethodDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED_PENDING) { - (void) AcpiDsCreateMethodMutex (MethodDesc); + if (WalkState) + { + ACPI_INFO ((AE_INFO, + "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", + WalkState->MethodNode->Name.Ascii)); + } + + /* + * Method tried to create an object twice and was marked as + * "pending serialized". The probable cause is that the method + * cannot handle reentrancy. + * + * The method was created as NotSerialized, but it tried to create + * a named object and then blocked, causing the second thread + * entrance to begin and then fail. Workaround this problem by + * marking the method permanently as Serialized when the last + * thread exits here. + */ + MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_SERIALIZED_PENDING; + MethodDesc->Method.InfoFlags |= ACPI_METHOD_SERIALIZED; + MethodDesc->Method.SyncLevel = 0; } /* No more threads, we can free the OwnerId */ - if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)) + if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)) { AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId); } diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c index 3d17763cf1..a264b3aba1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c index 9963bd3b80..abf8672f2e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c index 9d0941d8d5..0f5164e96f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c @@ -1,7 +1,6 @@ /****************************************************************************** * - * Module Name: dsopcode - Dispatcher Op Region support and handling of - * "control" opcodes + * Module Name: dsopcode - Dispatcher suport for regions and fields * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -131,13 +130,6 @@ /* Local prototypes */ -static ACPI_STATUS -AcpiDsExecuteArguments ( - ACPI_NAMESPACE_NODE *Node, - ACPI_NAMESPACE_NODE *ScopeNode, - UINT32 AmlLength, - UINT8 *AmlStart); - static ACPI_STATUS AcpiDsInitBufferField ( UINT16 AmlOpcode, @@ -148,369 +140,6 @@ AcpiDsInitBufferField ( ACPI_OPERAND_OBJECT *ResultDesc); -/******************************************************************************* - * - * FUNCTION: AcpiDsExecuteArguments - * - * PARAMETERS: Node - Object NS node - * ScopeNode - Parent NS node - * AmlLength - Length of executable AML - * AmlStart - Pointer to the AML - * - * RETURN: Status. - * - * DESCRIPTION: Late (deferred) execution of region or field arguments - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsExecuteArguments ( - ACPI_NAMESPACE_NODE *Node, - ACPI_NAMESPACE_NODE *ScopeNode, - UINT32 AmlLength, - UINT8 *AmlStart) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Op; - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_TRACE (DsExecuteArguments); - - - /* - * Allocate a new parser op to be the root of the parsed tree - */ - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Save the Node for use in AcpiPsParseAml */ - - Op->Common.Node = ScopeNode; - - /* Create and initialize a new parser state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - /* Mark this parse as a deferred opcode */ - - WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP; - WalkState->DeferredNode = Node; - - /* Pass1: Parse the entire declaration */ - - Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Get and init the Op created above */ - - Op->Common.Node = Node; - AcpiPsDeleteParseTree (Op); - - /* Evaluate the deferred arguments */ - - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Op->Common.Node = ScopeNode; - - /* Create and initialize a new parser state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Execute the opcode and arguments */ - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_EXECUTE); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - /* Mark this execution as a deferred opcode */ - - WalkState->DeferredNode = Node; - Status = AcpiPsParseAml (WalkState); - -Cleanup: - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBufferFieldArguments - * - * PARAMETERS: ObjDesc - A valid BufferField object - * - * RETURN: Status. - * - * DESCRIPTION: Get BufferField Buffer and Index. This implements the late - * evaluation of these field attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBufferFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_OPERAND_OBJECT *ExtraDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the AML pointer (method object) and BufferField node */ - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - Node = ObjDesc->BufferField.Node; - - ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", - AcpiUtGetNodeName (Node))); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBankFieldArguments - * - * PARAMETERS: ObjDesc - A valid BankField object - * - * RETURN: Status. - * - * DESCRIPTION: Get BankField BankValue. This implements the late - * evaluation of these field attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBankFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_OPERAND_OBJECT *ExtraDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the AML pointer (method object) and BankField node */ - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - Node = ObjDesc->BankField.Node; - - ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", - AcpiUtGetNodeName (Node))); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBufferArguments - * - * PARAMETERS: ObjDesc - A valid Buffer object - * - * RETURN: Status. - * - * DESCRIPTION: Get Buffer length and initializer byte list. This implements - * the late evaluation of these attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBufferArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the Buffer node */ - - Node = ObjDesc->Buffer.Node; - if (!Node) - { - ACPI_ERROR ((AE_INFO, - "No pointer back to namespace node in buffer object %p", ObjDesc)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n")); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetPackageArguments - * - * PARAMETERS: ObjDesc - A valid Package object - * - * RETURN: Status. - * - * DESCRIPTION: Get Package length and initializer byte list. This implements - * the late evaluation of these attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetPackageArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the Package node */ - - Node = ObjDesc->Package.Node; - if (!Node) - { - ACPI_ERROR ((AE_INFO, - "No pointer back to namespace node in package %p", ObjDesc)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); - return_ACPI_STATUS (Status); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiDsGetRegionArguments - * - * PARAMETERS: ObjDesc - A valid region object - * - * RETURN: Status. - * - * DESCRIPTION: Get region address and length. This implements the late - * evaluation of these region attributes. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiDsGetRegionArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ExtraDesc; - - - ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc); - - - if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - if (!ExtraDesc) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Get the Region node */ - - Node = ObjDesc->Region.Node; - - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL)); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", - AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart)); - - /* Execute the argument AML */ - - Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - return_ACPI_STATUS (Status); -} - - /******************************************************************************* * * FUNCTION: AcpiDsInitializeRegion @@ -942,8 +571,9 @@ AcpiDsEvalRegionOperands ( * * RETURN: Status * - * DESCRIPTION: Get region address and length - * Called from AcpiDsExecEndOp during DataTableRegion parse tree walk + * DESCRIPTION: Get region address and length. + * Called from AcpiDsExecEndOp during DataTableRegion parse + * tree walk. * ******************************************************************************/ @@ -1249,371 +879,3 @@ AcpiDsEvalBankFieldOperands ( return_ACPI_STATUS (Status); } - -/******************************************************************************* - * - * FUNCTION: AcpiDsExecBeginControlOp - * - * PARAMETERS: WalkList - The list that owns the walk stack - * Op - The control Op - * - * RETURN: Status - * - * DESCRIPTION: Handles all control ops encountered during control method - * execution. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsExecBeginControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *ControlState; - - - ACPI_FUNCTION_NAME (DsExecBeginControlOp); - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op, - Op->Common.AmlOpcode, WalkState)); - - switch (Op->Common.AmlOpcode) - { - case AML_WHILE_OP: - - /* - * If this is an additional iteration of a while loop, continue. - * There is no need to allocate a new control state. - */ - if (WalkState->ControlState) - { - if (WalkState->ControlState->Control.AmlPredicateStart == - (WalkState->ParserState.Aml - 1)) - { - /* Reset the state to start-of-loop */ - - WalkState->ControlState->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING; - break; - } - } - - /*lint -fallthrough */ - - case AML_IF_OP: - - /* - * IF/WHILE: Create a new control state to manage these - * constructs. We need to manage these as a stack, in order - * to handle nesting. - */ - ControlState = AcpiUtCreateControlState (); - if (!ControlState) - { - Status = AE_NO_MEMORY; - break; - } - /* - * Save a pointer to the predicate for multiple executions - * of a loop - */ - ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1; - ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd; - ControlState->Control.Opcode = Op->Common.AmlOpcode; - - - /* Push the control state on this walk's control stack */ - - AcpiUtPushGenericState (&WalkState->ControlState, ControlState); - break; - - case AML_ELSE_OP: - - /* Predicate is in the state object */ - /* If predicate is true, the IF was executed, ignore ELSE part */ - - if (WalkState->LastPredicate) - { - Status = AE_CTRL_TRUE; - } - - break; - - case AML_RETURN_OP: - - break; - - default: - break; - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsExecEndControlOp - * - * PARAMETERS: WalkList - The list that owns the walk stack - * Op - The control Op - * - * RETURN: Status - * - * DESCRIPTION: Handles all control ops encountered during control method - * execution. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsExecEndControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *ControlState; - - - ACPI_FUNCTION_NAME (DsExecEndControlOp); - - - switch (Op->Common.AmlOpcode) - { - case AML_IF_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op)); - - /* - * Save the result of the predicate in case there is an - * ELSE to come - */ - WalkState->LastPredicate = - (BOOLEAN) WalkState->ControlState->Common.Value; - - /* - * Pop the control state that was created at the start - * of the IF and free it - */ - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - break; - - - case AML_ELSE_OP: - - break; - - - case AML_WHILE_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op)); - - ControlState = WalkState->ControlState; - if (ControlState->Common.Value) - { - /* Predicate was true, the body of the loop was just executed */ - - /* - * This loop counter mechanism allows the interpreter to escape - * possibly infinite loops. This can occur in poorly written AML - * when the hardware does not respond within a while loop and the - * loop does not implement a timeout. - */ - ControlState->Control.LoopCount++; - if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS) - { - Status = AE_AML_INFINITE_LOOP; - break; - } - - /* - * Go back and evaluate the predicate and maybe execute the loop - * another time - */ - Status = AE_CTRL_PENDING; - WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; - break; - } - - /* Predicate was false, terminate this while loop */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[WHILE_OP] termination! Op=%p\n",Op)); - - /* Pop this control state and free it */ - - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - break; - - - case AML_RETURN_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg)); - - /* - * One optional operand -- the return value - * It can be either an immediate operand or a result that - * has been bubbled up the tree - */ - if (Op->Common.Value.Arg) - { - /* Since we have a real Return(), delete any implicit return */ - - AcpiDsClearImplicitReturn (WalkState); - - /* Return statement has an immediate operand */ - - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * If value being returned is a Reference (such as - * an arg or local), resolve it now because it may - * cease to exist at the end of the method. - */ - Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Get the return value and save as the last result - * value. This is the only place where WalkState->ReturnDesc - * is set to anything other than zero! - */ - WalkState->ReturnDesc = WalkState->Operands[0]; - } - else if (WalkState->ResultCount) - { - /* Since we have a real Return(), delete any implicit return */ - - AcpiDsClearImplicitReturn (WalkState); - - /* - * The return value has come from a previous calculation. - * - * If value being returned is a Reference (such as - * an arg or local), resolve it now because it may - * cease to exist at the end of the method. - * - * Allow references created by the Index operator to return unchanged. - */ - if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) && - ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX)) - { - Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0]; - } - else - { - /* No return operand */ - - if (WalkState->NumOperands) - { - AcpiUtRemoveReference (WalkState->Operands [0]); - } - - WalkState->Operands [0] = NULL; - WalkState->NumOperands = 0; - WalkState->ReturnDesc = NULL; - } - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Completed RETURN_OP State=%p, RetVal=%p\n", - WalkState, WalkState->ReturnDesc)); - - /* End the control method execution right now */ - - Status = AE_CTRL_TERMINATE; - break; - - - case AML_NOOP_OP: - - /* Just do nothing! */ - break; - - - case AML_BREAK_POINT_OP: - - /* - * Set the single-step flag. This will cause the debugger (if present) - * to break to the console within the AML debugger at the start of the - * next AML instruction. - */ - ACPI_DEBUGGER_EXEC ( - AcpiGbl_CmSingleStep = TRUE); - ACPI_DEBUGGER_EXEC ( - AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n")); - - /* Call to the OSL in case OS wants a piece of the action */ - - Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, - "Executed AML Breakpoint opcode"); - break; - - - case AML_BREAK_OP: - case AML_CONTINUE_OP: /* ACPI 2.0 */ - - - /* Pop and delete control states until we find a while */ - - while (WalkState->ControlState && - (WalkState->ControlState->Control.Opcode != AML_WHILE_OP)) - { - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - } - - /* No while found? */ - - if (!WalkState->ControlState) - { - return (AE_AML_NO_WHILE); - } - - /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */ - - WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd; - - /* Return status depending on opcode */ - - if (Op->Common.AmlOpcode == AML_BREAK_OP) - { - Status = AE_CTRL_BREAK; - } - else - { - Status = AE_CTRL_CONTINUE; - } - break; - - - default: - - ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p", - Op->Common.AmlOpcode, Op)); - - Status = AE_AML_BAD_OPCODE; - break; - } - - return (Status); -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c index 7eb0637266..22bd0bf900 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswexec.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswexec.c index 3c1f85e261..e243c7f769 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswexec.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswexec.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -400,10 +400,26 @@ AcpiDsExecBeginOp ( * we must enter this object into the namespace. The created * object is temporary and will be deleted upon completion of * the execution of this method. + * + * Note 10/2010: Except for the Scope() op. This opcode does + * not actually create a new object, it refers to an existing + * object. However, for Scope(), we want to indeed open a + * new scope. */ - Status = AcpiDsLoad2BeginOp (WalkState, NULL); + if (Op->Common.AmlOpcode != AML_SCOPE_OP) + { + Status = AcpiDsLoad2BeginOp (WalkState, NULL); + } + else + { + Status = AcpiDsScopeStackPush (Op->Named.Node, + Op->Named.Node->Type, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } } - break; diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload.c index 1a02f9f1c8..f30bbfc193 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: dswload - Dispatcher namespace load callbacks + * Module Name: dswload - Dispatcher first pass namespace load callbacks * *****************************************************************************/ @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -122,7 +122,6 @@ #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#include "acevents.h" #ifdef ACPI_ASL_COMPILER #include "acdisasm.h" @@ -539,7 +538,7 @@ AcpiDsLoad1EndOp ( else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - REGION_DATA_TABLE, WalkState); + ACPI_ADR_SPACE_DATA_TABLE, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -622,695 +621,3 @@ AcpiDsLoad1EndOp ( return_ACPI_STATUS (Status); } - - -/******************************************************************************* - * - * FUNCTION: AcpiDsLoad2BeginOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * OutOp - Wher to return op if a new one is created - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the loading of ACPI tables. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsLoad2BeginOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - char *BufferPtr; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE (DsLoad2BeginOp); - - - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - - if (Op) - { - if ((WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_CONDITIONAL_EXECUTING)) - { - /* We are executing a while loop outside of a method */ - - Status = AcpiDsExecBeginOp (WalkState, OutOp); - return_ACPI_STATUS (Status); - } - - /* We only care about Namespace opcodes here */ - - if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && - (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || - (!(WalkState->OpInfo->Flags & AML_NAMED))) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the name we are going to enter or lookup in the namespace */ - - if (WalkState->Opcode == AML_INT_NAMEPATH_OP) - { - /* For Namepath op, get the path string */ - - BufferPtr = Op->Common.Value.String; - if (!BufferPtr) - { - /* No name, just exit */ - - return_ACPI_STATUS (AE_OK); - } - } - else - { - /* Get name from the op */ - - BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name); - } - } - else - { - /* Get the namestring from the raw AML */ - - BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); - } - - /* Map the opcode into an internal object type */ - - ObjectType = WalkState->OpInfo->ObjectType; - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); - - switch (WalkState->Opcode) - { - case AML_FIELD_OP: - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - - Node = NULL; - Status = AE_OK; - break; - - case AML_INT_NAMEPATH_OP: - /* - * The NamePath is an object reference to an existing object. - * Don't enter the name into the namespace, but look it up - * for use later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - break; - - case AML_SCOPE_OP: - - /* Special case for Scope(\) -> refers to the Root node */ - - if (Op && (Op->Named.Node == AcpiGbl_RootNode)) - { - Node = Op->Named.Node; - - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else - { - /* - * The Path is an object reference to an existing object. - * Don't enter the name into the namespace, but look it up - * for use later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { -#ifdef ACPI_ASL_COMPILER - if (Status == AE_NOT_FOUND) - { - Status = AE_OK; - } - else - { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); - } -#else - ACPI_ERROR_NAMESPACE (BufferPtr, Status); -#endif - return_ACPI_STATUS (Status); - } - } - - /* - * We must check to make sure that the target is - * one of the opcodes that actually opens a scope - */ - switch (Node->Type) - { - case ACPI_TYPE_ANY: - case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* These are acceptable types */ - break; - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* - * These types we will allow, but we will change the type. - * This enables some existing code of the form: - * - * Name (DEB, 0) - * Scope (DEB) { ... } - */ - ACPI_WARNING ((AE_INFO, - "Type override - [%4.4s] had invalid type (%s) " - "for Scope operator, changed to type ANY\n", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); - - Node->Type = ACPI_TYPE_ANY; - WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; - break; - - default: - - /* All other types are an error */ - - ACPI_ERROR ((AE_INFO, - "Invalid type (%s) for target of " - "Scope operator [%4.4s] (Cannot override)", - AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); - - return (AE_AML_OPERAND_TYPE); - } - break; - - default: - - /* All other opcodes */ - - if (Op && Op->Common.Node) - { - /* This op/node was previously entered into the namespace */ - - Node = Op->Common.Node; - - if (AcpiNsOpensScope (ObjectType)) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - return_ACPI_STATUS (AE_OK); - } - - /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that - * involve arguments to the opcode must be created as we go back up the - * parse tree later. - * - * Note: Name may already exist if we are executing a deferred opcode. - */ - if (WalkState->DeferredNode) - { - /* This name is already in the namespace, get the node */ - - Node = WalkState->DeferredNode; - Status = AE_OK; - break; - } - - Flags = ACPI_NS_NO_UPSEARCH; - if (WalkState->PassNumber == ACPI_IMODE_EXECUTE) - { - /* Execution mode, node cannot already exist, node is temporary */ - - Flags |= ACPI_NS_ERROR_IF_FOUND; - - if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) - { - Flags |= ACPI_NS_TEMPORARY; - } - } - - /* Add new entry or lookup existing entry */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); - - if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "***New Node [%4.4s] %p is temporary\n", - AcpiUtGetNodeName (Node), Node)); - } - break; - } - - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); - return_ACPI_STATUS (Status); - } - - if (!Op) - { - /* Create a new op */ - - Op = AcpiPsAllocOp (WalkState->Opcode); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize the new op */ - - if (Node) - { - Op->Named.Name = Node->Name.Integer; - } - *OutOp = Op; - } - - /* - * Put the Node in the "op" object that the parser uses, so we - * can get it again quickly when this scope is closed - */ - Op->Common.Node = Node; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsLoad2EndOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during the loading of the namespace, - * both control methods and everything else. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsLoad2EndOp ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_STATUS Status = AE_OK; - ACPI_OBJECT_TYPE ObjectType; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *Arg; - ACPI_NAMESPACE_NODE *NewNode; -#ifndef ACPI_NO_METHOD_EXECUTION - UINT32 i; - UINT8 RegionSpace; -#endif - - - ACPI_FUNCTION_TRACE (DsLoad2EndOp); - - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", - WalkState->OpInfo->Name, Op, WalkState)); - - /* Check if opcode had an associated namespace object */ - - if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) - { - return_ACPI_STATUS (AE_OK); - } - - if (Op->Common.AmlOpcode == AML_SCOPE_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Ending scope Op=%p State=%p\n", Op, WalkState)); - } - - ObjectType = WalkState->OpInfo->ObjectType; - - /* - * Get the Node/name from the earlier lookup - * (It was saved in the *op structure) - */ - Node = Op->Common.Node; - - /* - * Put the Node on the object stack (Contains the ACPI Name of - * this object) - */ - WalkState->Operands[0] = (void *) Node; - WalkState->NumOperands = 1; - - /* Pop the scope stack */ - - if (AcpiNsOpensScope (ObjectType) && - (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", - AcpiUtGetTypeName (ObjectType), Op)); - - Status = AcpiDsScopeStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - } - - /* - * Named operations are as follows: - * - * AML_ALIAS - * AML_BANKFIELD - * AML_CREATEBITFIELD - * AML_CREATEBYTEFIELD - * AML_CREATEDWORDFIELD - * AML_CREATEFIELD - * AML_CREATEQWORDFIELD - * AML_CREATEWORDFIELD - * AML_DATA_REGION - * AML_DEVICE - * AML_EVENT - * AML_FIELD - * AML_INDEXFIELD - * AML_METHOD - * AML_METHODCALL - * AML_MUTEX - * AML_NAME - * AML_NAMEDFIELD - * AML_OPREGION - * AML_POWERRES - * AML_PROCESSOR - * AML_SCOPE - * AML_THERMALZONE - */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); - - /* Decode the opcode */ - - Arg = Op->Common.Value.Arg; - - switch (WalkState->OpInfo->Type) - { -#ifndef ACPI_NO_METHOD_EXECUTION - - case AML_TYPE_CREATE_FIELD: - /* - * Create the field object, but the field buffer and index must - * be evaluated later during the execution phase - */ - Status = AcpiDsCreateBufferField (Op, WalkState); - break; - - - case AML_TYPE_NAMED_FIELD: - /* - * If we are executing a method, initialize the field - */ - if (WalkState->MethodNode) - { - Status = AcpiDsInitFieldObjects (Op, WalkState); - } - - switch (Op->Common.AmlOpcode) - { - case AML_INDEX_FIELD_OP: - - Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, - WalkState); - break; - - case AML_BANK_FIELD_OP: - - Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); - break; - - case AML_FIELD_OP: - - Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); - break; - - default: - /* All NAMED_FIELD opcodes must be handled above */ - break; - } - break; - - - case AML_TYPE_NAMED_SIMPLE: - - Status = AcpiDsCreateOperands (WalkState, Arg); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - switch (Op->Common.AmlOpcode) - { - case AML_PROCESSOR_OP: - - Status = AcpiExCreateProcessor (WalkState); - break; - - case AML_POWER_RES_OP: - - Status = AcpiExCreatePowerResource (WalkState); - break; - - case AML_MUTEX_OP: - - Status = AcpiExCreateMutex (WalkState); - break; - - case AML_EVENT_OP: - - Status = AcpiExCreateEvent (WalkState); - break; - - - case AML_ALIAS_OP: - - Status = AcpiExCreateAlias (WalkState); - break; - - default: - /* Unknown opcode */ - - Status = AE_OK; - goto Cleanup; - } - - /* Delete operands */ - - for (i = 1; i < WalkState->NumOperands; i++) - { - AcpiUtRemoveReference (WalkState->Operands[i]); - WalkState->Operands[i] = NULL; - } - - break; -#endif /* ACPI_NO_METHOD_EXECUTION */ - - case AML_TYPE_NAMED_COMPLEX: - - switch (Op->Common.AmlOpcode) - { -#ifndef ACPI_NO_METHOD_EXECUTION - case AML_REGION_OP: - case AML_DATA_REGION_OP: - - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - RegionSpace = (ACPI_ADR_SPACE_TYPE) - ((Op->Common.Value.Arg)->Common.Value.Integer); - } - else - { - RegionSpace = REGION_DATA_TABLE; - } - - /* - * The OpRegion is not fully parsed at this time. The only valid - * argument is the SpaceId. (We must save the address of the - * AML of the address and length operands) - * - * If we have a valid region, initialize it. The namespace is - * unlocked at this point. - * - * Need to unlock interpreter if it is locked (if we are running - * a control method), in order to allow _REG methods to be run - * during AcpiEvInitializeRegion. - */ - if (WalkState->MethodNode) - { - /* - * Executing a method: initialize the region and unlock - * the interpreter - */ - Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - RegionSpace, WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiExExitInterpreter (); - } - - Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), - FALSE); - if (WalkState->MethodNode) - { - AcpiExEnterInterpreter (); - } - - if (ACPI_FAILURE (Status)) - { - /* - * If AE_NOT_EXIST is returned, it is not fatal - * because many regions get created before a handler - * is installed for said region. - */ - if (AE_NOT_EXIST == Status) - { - Status = AE_OK; - } - } - break; - - - case AML_NAME_OP: - - Status = AcpiDsCreateNode (WalkState, Node, Op); - break; - - - case AML_METHOD_OP: - /* - * MethodOp PkgLength NameString MethodFlags TermList - * - * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing - * of invocations of the method (need to know the number of - * arguments.) - */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Op->Named.Node)); - - if (!AcpiNsGetAttachedObject (Op->Named.Node)) - { - WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); - WalkState->NumOperands = 1; - - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiExCreateMethod (Op->Named.Data, - Op->Named.Length, WalkState); - } - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - break; - -#endif /* ACPI_NO_METHOD_EXECUTION */ - - default: - /* All NAMED_COMPLEX opcodes must be handled above */ - break; - } - break; - - - case AML_CLASS_INTERNAL: - - /* case AML_INT_NAMEPATH_OP: */ - break; - - - case AML_CLASS_METHOD_CALL: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - - /* - * Lookup the method name and save the Node - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(NewNode)); - if (ACPI_SUCCESS (Status)) - { - /* - * Make sure that what we found is indeed a method - * We didn't search for a method on purpose, to see if the name - * would resolve - */ - if (NewNode->Type != ACPI_TYPE_METHOD) - { - Status = AE_AML_OPERAND_TYPE; - } - - /* We could put the returned object (Node) on the object stack for - * later, but for now, we will put it in the "op" object that the - * parser uses, so we can get it again at the end of this scope - */ - Op->Common.Node = NewNode; - } - else - { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); - } - break; - - - default: - break; - } - -Cleanup: - - /* Remove the Node pushed at the very beginning */ - - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; - return_ACPI_STATUS (Status); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload2.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload2.c new file mode 100644 index 0000000000..8eba533977 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload2.c @@ -0,0 +1,819 @@ +/****************************************************************************** + * + * Module Name: dswload2 - Dispatcher second pass namespace load callbacks + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __DSWLOAD2_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" + +#define _COMPONENT ACPI_DISPATCHER + ACPI_MODULE_NAME ("dswload2") + + +/******************************************************************************* + * + * FUNCTION: AcpiDsLoad2BeginOp + * + * PARAMETERS: WalkState - Current state of the parse tree walk + * OutOp - Wher to return op if a new one is created + * + * RETURN: Status + * + * DESCRIPTION: Descending callback used during the loading of ACPI tables. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsLoad2BeginOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp) +{ + ACPI_PARSE_OBJECT *Op; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + ACPI_OBJECT_TYPE ObjectType; + char *BufferPtr; + UINT32 Flags; + + + ACPI_FUNCTION_TRACE (DsLoad2BeginOp); + + + Op = WalkState->Op; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); + + if (Op) + { + if ((WalkState->ControlState) && + (WalkState->ControlState->Common.State == + ACPI_CONTROL_CONDITIONAL_EXECUTING)) + { + /* We are executing a while loop outside of a method */ + + Status = AcpiDsExecBeginOp (WalkState, OutOp); + return_ACPI_STATUS (Status); + } + + /* We only care about Namespace opcodes here */ + + if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && + (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || + (!(WalkState->OpInfo->Flags & AML_NAMED))) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the name we are going to enter or lookup in the namespace */ + + if (WalkState->Opcode == AML_INT_NAMEPATH_OP) + { + /* For Namepath op, get the path string */ + + BufferPtr = Op->Common.Value.String; + if (!BufferPtr) + { + /* No name, just exit */ + + return_ACPI_STATUS (AE_OK); + } + } + else + { + /* Get name from the op */ + + BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name); + } + } + else + { + /* Get the namestring from the raw AML */ + + BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); + } + + /* Map the opcode into an internal object type */ + + ObjectType = WalkState->OpInfo->ObjectType; + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); + + switch (WalkState->Opcode) + { + case AML_FIELD_OP: + case AML_BANK_FIELD_OP: + case AML_INDEX_FIELD_OP: + + Node = NULL; + Status = AE_OK; + break; + + case AML_INT_NAMEPATH_OP: + /* + * The NamePath is an object reference to an existing object. + * Don't enter the name into the namespace, but look it up + * for use later. + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); + break; + + case AML_SCOPE_OP: + + /* Special case for Scope(\) -> refers to the Root node */ + + if (Op && (Op->Named.Node == AcpiGbl_RootNode)) + { + Node = Op->Named.Node; + + Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + else + { + /* + * The Path is an object reference to an existing object. + * Don't enter the name into the namespace, but look it up + * for use later. + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); + if (ACPI_FAILURE (Status)) + { +#ifdef ACPI_ASL_COMPILER + if (Status == AE_NOT_FOUND) + { + Status = AE_OK; + } + else + { + ACPI_ERROR_NAMESPACE (BufferPtr, Status); + } +#else + ACPI_ERROR_NAMESPACE (BufferPtr, Status); +#endif + return_ACPI_STATUS (Status); + } + } + + /* + * We must check to make sure that the target is + * one of the opcodes that actually opens a scope + */ + switch (Node->Type) + { + case ACPI_TYPE_ANY: + case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + + /* These are acceptable types */ + break; + + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + + /* + * These types we will allow, but we will change the type. + * This enables some existing code of the form: + * + * Name (DEB, 0) + * Scope (DEB) { ... } + */ + ACPI_WARNING ((AE_INFO, + "Type override - [%4.4s] had invalid type (%s) " + "for Scope operator, changed to type ANY\n", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); + + Node->Type = ACPI_TYPE_ANY; + WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; + break; + + default: + + /* All other types are an error */ + + ACPI_ERROR ((AE_INFO, + "Invalid type (%s) for target of " + "Scope operator [%4.4s] (Cannot override)", + AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); + + return (AE_AML_OPERAND_TYPE); + } + break; + + default: + + /* All other opcodes */ + + if (Op && Op->Common.Node) + { + /* This op/node was previously entered into the namespace */ + + Node = Op->Common.Node; + + if (AcpiNsOpensScope (ObjectType)) + { + Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + return_ACPI_STATUS (AE_OK); + } + + /* + * Enter the named type into the internal namespace. We enter the name + * as we go downward in the parse tree. Any necessary subobjects that + * involve arguments to the opcode must be created as we go back up the + * parse tree later. + * + * Note: Name may already exist if we are executing a deferred opcode. + */ + if (WalkState->DeferredNode) + { + /* This name is already in the namespace, get the node */ + + Node = WalkState->DeferredNode; + Status = AE_OK; + break; + } + + Flags = ACPI_NS_NO_UPSEARCH; + if (WalkState->PassNumber == ACPI_IMODE_EXECUTE) + { + /* Execution mode, node cannot already exist, node is temporary */ + + Flags |= ACPI_NS_ERROR_IF_FOUND; + + if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) + { + Flags |= ACPI_NS_TEMPORARY; + } + } + + /* Add new entry or lookup existing entry */ + + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, + ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); + + if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "***New Node [%4.4s] %p is temporary\n", + AcpiUtGetNodeName (Node), Node)); + } + break; + } + + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR_NAMESPACE (BufferPtr, Status); + return_ACPI_STATUS (Status); + } + + if (!Op) + { + /* Create a new op */ + + Op = AcpiPsAllocOp (WalkState->Opcode); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Initialize the new op */ + + if (Node) + { + Op->Named.Name = Node->Name.Integer; + } + *OutOp = Op; + } + + /* + * Put the Node in the "op" object that the parser uses, so we + * can get it again quickly when this scope is closed + */ + Op->Common.Node = Node; + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsLoad2EndOp + * + * PARAMETERS: WalkState - Current state of the parse tree walk + * + * RETURN: Status + * + * DESCRIPTION: Ascending callback used during the loading of the namespace, + * both control methods and everything else. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsLoad2EndOp ( + ACPI_WALK_STATE *WalkState) +{ + ACPI_PARSE_OBJECT *Op; + ACPI_STATUS Status = AE_OK; + ACPI_OBJECT_TYPE ObjectType; + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *Arg; + ACPI_NAMESPACE_NODE *NewNode; +#ifndef ACPI_NO_METHOD_EXECUTION + UINT32 i; + UINT8 RegionSpace; +#endif + + + ACPI_FUNCTION_TRACE (DsLoad2EndOp); + + Op = WalkState->Op; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", + WalkState->OpInfo->Name, Op, WalkState)); + + /* Check if opcode had an associated namespace object */ + + if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) + { + return_ACPI_STATUS (AE_OK); + } + + if (Op->Common.AmlOpcode == AML_SCOPE_OP) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Ending scope Op=%p State=%p\n", Op, WalkState)); + } + + ObjectType = WalkState->OpInfo->ObjectType; + + /* + * Get the Node/name from the earlier lookup + * (It was saved in the *op structure) + */ + Node = Op->Common.Node; + + /* + * Put the Node on the object stack (Contains the ACPI Name of + * this object) + */ + WalkState->Operands[0] = (void *) Node; + WalkState->NumOperands = 1; + + /* Pop the scope stack */ + + if (AcpiNsOpensScope (ObjectType) && + (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", + AcpiUtGetTypeName (ObjectType), Op)); + + Status = AcpiDsScopeStackPop (WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + } + + /* + * Named operations are as follows: + * + * AML_ALIAS + * AML_BANKFIELD + * AML_CREATEBITFIELD + * AML_CREATEBYTEFIELD + * AML_CREATEDWORDFIELD + * AML_CREATEFIELD + * AML_CREATEQWORDFIELD + * AML_CREATEWORDFIELD + * AML_DATA_REGION + * AML_DEVICE + * AML_EVENT + * AML_FIELD + * AML_INDEXFIELD + * AML_METHOD + * AML_METHODCALL + * AML_MUTEX + * AML_NAME + * AML_NAMEDFIELD + * AML_OPREGION + * AML_POWERRES + * AML_PROCESSOR + * AML_SCOPE + * AML_THERMALZONE + */ + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); + + /* Decode the opcode */ + + Arg = Op->Common.Value.Arg; + + switch (WalkState->OpInfo->Type) + { +#ifndef ACPI_NO_METHOD_EXECUTION + + case AML_TYPE_CREATE_FIELD: + /* + * Create the field object, but the field buffer and index must + * be evaluated later during the execution phase + */ + Status = AcpiDsCreateBufferField (Op, WalkState); + break; + + + case AML_TYPE_NAMED_FIELD: + /* + * If we are executing a method, initialize the field + */ + if (WalkState->MethodNode) + { + Status = AcpiDsInitFieldObjects (Op, WalkState); + } + + switch (Op->Common.AmlOpcode) + { + case AML_INDEX_FIELD_OP: + + Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, + WalkState); + break; + + case AML_BANK_FIELD_OP: + + Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); + break; + + case AML_FIELD_OP: + + Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); + break; + + default: + /* All NAMED_FIELD opcodes must be handled above */ + break; + } + break; + + + case AML_TYPE_NAMED_SIMPLE: + + Status = AcpiDsCreateOperands (WalkState, Arg); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + switch (Op->Common.AmlOpcode) + { + case AML_PROCESSOR_OP: + + Status = AcpiExCreateProcessor (WalkState); + break; + + case AML_POWER_RES_OP: + + Status = AcpiExCreatePowerResource (WalkState); + break; + + case AML_MUTEX_OP: + + Status = AcpiExCreateMutex (WalkState); + break; + + case AML_EVENT_OP: + + Status = AcpiExCreateEvent (WalkState); + break; + + + case AML_ALIAS_OP: + + Status = AcpiExCreateAlias (WalkState); + break; + + default: + /* Unknown opcode */ + + Status = AE_OK; + goto Cleanup; + } + + /* Delete operands */ + + for (i = 1; i < WalkState->NumOperands; i++) + { + AcpiUtRemoveReference (WalkState->Operands[i]); + WalkState->Operands[i] = NULL; + } + + break; +#endif /* ACPI_NO_METHOD_EXECUTION */ + + case AML_TYPE_NAMED_COMPLEX: + + switch (Op->Common.AmlOpcode) + { +#ifndef ACPI_NO_METHOD_EXECUTION + case AML_REGION_OP: + case AML_DATA_REGION_OP: + + if (Op->Common.AmlOpcode == AML_REGION_OP) + { + RegionSpace = (ACPI_ADR_SPACE_TYPE) + ((Op->Common.Value.Arg)->Common.Value.Integer); + } + else + { + RegionSpace = ACPI_ADR_SPACE_DATA_TABLE; + } + + /* + * The OpRegion is not fully parsed at this time. The only valid + * argument is the SpaceId. (We must save the address of the + * AML of the address and length operands) + * + * If we have a valid region, initialize it. The namespace is + * unlocked at this point. + * + * Need to unlock interpreter if it is locked (if we are running + * a control method), in order to allow _REG methods to be run + * during AcpiEvInitializeRegion. + */ + if (WalkState->MethodNode) + { + /* + * Executing a method: initialize the region and unlock + * the interpreter + */ + Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, + RegionSpace, WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + AcpiExExitInterpreter (); + } + + Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), + FALSE); + if (WalkState->MethodNode) + { + AcpiExEnterInterpreter (); + } + + if (ACPI_FAILURE (Status)) + { + /* + * If AE_NOT_EXIST is returned, it is not fatal + * because many regions get created before a handler + * is installed for said region. + */ + if (AE_NOT_EXIST == Status) + { + Status = AE_OK; + } + } + break; + + + case AML_NAME_OP: + + Status = AcpiDsCreateNode (WalkState, Node, Op); + break; + + + case AML_METHOD_OP: + /* + * MethodOp PkgLength NameString MethodFlags TermList + * + * Note: We must create the method node/object pair as soon as we + * see the method declaration. This allows later pass1 parsing + * of invocations of the method (need to know the number of + * arguments.) + */ + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "LOADING-Method: State=%p Op=%p NamedObj=%p\n", + WalkState, Op, Op->Named.Node)); + + if (!AcpiNsGetAttachedObject (Op->Named.Node)) + { + WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); + WalkState->NumOperands = 1; + + Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiExCreateMethod (Op->Named.Data, + Op->Named.Length, WalkState); + } + WalkState->Operands[0] = NULL; + WalkState->NumOperands = 0; + + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + break; + +#endif /* ACPI_NO_METHOD_EXECUTION */ + + default: + /* All NAMED_COMPLEX opcodes must be handled above */ + break; + } + break; + + + case AML_CLASS_INTERNAL: + + /* case AML_INT_NAMEPATH_OP: */ + break; + + + case AML_CLASS_METHOD_CALL: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", + WalkState, Op, Node)); + + /* + * Lookup the method name and save the Node + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &(NewNode)); + if (ACPI_SUCCESS (Status)) + { + /* + * Make sure that what we found is indeed a method + * We didn't search for a method on purpose, to see if the name + * would resolve + */ + if (NewNode->Type != ACPI_TYPE_METHOD) + { + Status = AE_AML_OPERAND_TYPE; + } + + /* We could put the returned object (Node) on the object stack for + * later, but for now, we will put it in the "op" object that the + * parser uses, so we can get it again at the end of this scope + */ + Op->Common.Node = NewNode; + } + else + { + ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + } + break; + + + default: + break; + } + +Cleanup: + + /* Remove the Node pushed at the very beginning */ + + WalkState->Operands[0] = NULL; + WalkState->NumOperands = 0; + return_ACPI_STATUS (Status); +} + diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswscope.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswscope.c index 5ab611ec67..b95c42746c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswscope.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswscope.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswstate.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswstate.c index 91f019f6d1..07ed6d4d71 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswstate.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswstate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evevent.c b/src/add-ons/kernel/bus_managers/acpi/events/evevent.c index d9715a8232..a85588f105 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evevent.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evevent.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -178,54 +178,6 @@ AcpiEvInitializeEvents ( } -/******************************************************************************* - * - * FUNCTION: AcpiEvInstallFadtGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks - * (0 and 1). This causes the _PRW methods to be run, so the HW - * must be fully initialized at this point, including global lock - * support. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInstallFadtGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvInstallFadtGpes); - - - /* Namespace must be locked */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* FADT GPE Block 0 */ - - (void) AcpiEvInitializeGpeBlock ( - AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[0]); - - /* FADT GPE Block 1 */ - - (void) AcpiEvInitializeGpeBlock ( - AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[1]); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (AE_OK); -} - - /******************************************************************************* * * FUNCTION: AcpiEvInstallXruptHandlers @@ -366,9 +318,17 @@ AcpiEvFixedEventDetect ( if ((FixedStatus & AcpiGbl_FixedEventInfo[i].StatusBitMask) && (FixedEnable & AcpiGbl_FixedEventInfo[i].EnableBitMask)) { - /* Found an active (signalled) event */ - + /* + * Found an active (signalled) event. Invoke global event + * handler if present. + */ AcpiFixedEventCount[i]++; + if (AcpiGbl_GlobalEventHandler) + { + AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_FIXED, NULL, + i, AcpiGbl_GlobalEventHandlerContext); + } + IntStatus |= AcpiEvFixedEventDispatch (i); } } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evglock.c b/src/add-ons/kernel/bus_managers/acpi/events/evglock.c new file mode 100644 index 0000000000..a7a585a0eb --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/events/evglock.c @@ -0,0 +1,439 @@ +/****************************************************************************** + * + * Module Name: evglock - Global Lock support + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acinterp.h" + +#define _COMPONENT ACPI_EVENTS + ACPI_MODULE_NAME ("evglock") + + +/* Local prototypes */ + +static UINT32 +AcpiEvGlobalLockHandler ( + void *Context); + + +/******************************************************************************* + * + * FUNCTION: AcpiEvInitGlobalLockHandler + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Install a handler for the global lock release event + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvInitGlobalLockHandler ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); + + + /* Attempt installation of the global lock handler */ + + Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, + AcpiEvGlobalLockHandler, NULL); + + /* + * If the global lock does not exist on this platform, the attempt to + * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). + * Map to AE_OK, but mark global lock as not present. Any attempt to + * actually use the global lock will be flagged with an error. + */ + AcpiGbl_GlobalLockPresent = FALSE; + if (Status == AE_NO_HARDWARE_RESPONSE) + { + ACPI_ERROR ((AE_INFO, + "No response from Global Lock hardware, disabling lock")); + + return_ACPI_STATUS (AE_OK); + } + + Status = AcpiOsCreateLock (&AcpiGbl_GlobalLockPendingLock); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiGbl_GlobalLockPending = FALSE; + AcpiGbl_GlobalLockPresent = TRUE; + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvRemoveGlobalLockHandler + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Remove the handler for the Global Lock + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvRemoveGlobalLockHandler ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); + + AcpiGbl_GlobalLockPresent = FALSE; + Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, + AcpiEvGlobalLockHandler); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvGlobalLockHandler + * + * PARAMETERS: Context - From thread interface, not used + * + * RETURN: ACPI_INTERRUPT_HANDLED + * + * DESCRIPTION: Invoked directly from the SCI handler when a global lock + * release interrupt occurs. If there is actually a pending + * request for the lock, signal the waiting thread. + * + ******************************************************************************/ + +static UINT32 +AcpiEvGlobalLockHandler ( + void *Context) +{ + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + /* + * If a request for the global lock is not actually pending, + * we are done. This handles "spurious" global lock interrupts + * which are possible (and have been seen) with bad BIOSs. + */ + if (!AcpiGbl_GlobalLockPending) + { + goto CleanupAndExit; + } + + /* + * Send a unit to the global lock semaphore. The actual acquisition + * of the global lock will be performed by the waiting thread. + */ + Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore")); + } + + AcpiGbl_GlobalLockPending = FALSE; + + +CleanupAndExit: + + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + return (ACPI_INTERRUPT_HANDLED); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiEvAcquireGlobalLock + * + * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. + * + * RETURN: Status + * + * DESCRIPTION: Attempt to gain ownership of the Global Lock. + * + * MUTEX: Interpreter must be locked + * + * Note: The original implementation allowed multiple threads to "acquire" the + * Global Lock, and the OS would hold the lock until the last thread had + * released it. However, this could potentially starve the BIOS out of the + * lock, especially in the case where there is a tight handshake between the + * Embedded Controller driver and the BIOS. Therefore, this implementation + * allows only one thread to acquire the HW Global Lock at a time, and makes + * the global lock appear as a standard mutex on the OS side. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiEvAcquireGlobalLock ( + UINT16 Timeout) +{ + ACPI_CPU_FLAGS Flags; + ACPI_STATUS Status; + BOOLEAN Acquired = FALSE; + + + ACPI_FUNCTION_TRACE (EvAcquireGlobalLock); + + + /* + * Only one thread can acquire the GL at a time, the GlobalLockMutex + * enforces this. This interface releases the interpreter if we must wait. + */ + Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, + Timeout); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Update the global lock handle and check for wraparound. The handle is + * only used for the external global lock interfaces, but it is updated + * here to properly handle the case where a single thread may acquire the + * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The + * handle is therefore updated on the first acquire from a given thread + * regardless of where the acquisition request originated. + */ + AcpiGbl_GlobalLockHandle++; + if (AcpiGbl_GlobalLockHandle == 0) + { + AcpiGbl_GlobalLockHandle = 1; + } + + /* + * Make sure that a global lock actually exists. If not, just + * treat the lock as a standard mutex. + */ + if (!AcpiGbl_GlobalLockPresent) + { + AcpiGbl_GlobalLockAcquired = TRUE; + return_ACPI_STATUS (AE_OK); + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + do + { + /* Attempt to acquire the actual hardware lock */ + + ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); + if (Acquired) + { + AcpiGbl_GlobalLockAcquired = TRUE; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Acquired hardware Global Lock\n")); + break; + } + + /* + * Did not get the lock. The pending bit was set above, and + * we must now wait until we receive the global lock + * released interrupt. + */ + AcpiGbl_GlobalLockPending = TRUE; + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Waiting for hardware Global Lock\n")); + + /* + * Wait for handshake with the global lock interrupt handler. + * This interface releases the interpreter if we must wait. + */ + Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, + ACPI_WAIT_FOREVER); + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + } while (ACPI_SUCCESS (Status)); + + AcpiGbl_GlobalLockPending = FALSE; + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvReleaseGlobalLock + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Releases ownership of the Global Lock. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvReleaseGlobalLock ( + void) +{ + BOOLEAN Pending = FALSE; + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); + + + /* Lock must be already acquired */ + + if (!AcpiGbl_GlobalLockAcquired) + { + ACPI_WARNING ((AE_INFO, + "Cannot release the ACPI Global Lock, it has not been acquired")); + return_ACPI_STATUS (AE_NOT_ACQUIRED); + } + + if (AcpiGbl_GlobalLockPresent) + { + /* Allow any thread to release the lock */ + + ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); + + /* + * If the pending bit was set, we must write GBL_RLS to the control + * register + */ + if (Pending) + { + Status = AcpiWriteBitRegister ( + ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); + } + + AcpiGbl_GlobalLockAcquired = FALSE; + + /* Release the local GL mutex */ + + AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); + return_ACPI_STATUS (Status); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c index f7ab160084..59e5d55879 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -202,12 +202,13 @@ AcpiEvEnableGpe ( /* - * We will only allow a GPE to be enabled if it has either an - * associated method (_Lxx/_Exx) or a handler. Otherwise, the - * GPE will be immediately disabled by AcpiEvGpeDispatch the - * first time it fires. + * We will only allow a GPE to be enabled if it has either an associated + * method (_Lxx/_Exx) or a handler, or is using the implicit notify + * feature. Otherwise, the GPE will be immediately disabled by + * AcpiEvGpeDispatch the first time it fires. */ - if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)) + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_NONE) { return_ACPI_STATUS (AE_NO_HANDLER); } @@ -227,6 +228,104 @@ AcpiEvEnableGpe ( } +/******************************************************************************* + * + * FUNCTION: AcpiEvAddGpeReference + * + * PARAMETERS: GpeEventInfo - Add a reference to this GPE + * + * RETURN: Status + * + * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is + * hardware-enabled. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvAddGpeReference ( + ACPI_GPE_EVENT_INFO *GpeEventInfo) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (EvAddGpeReference); + + + if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX) + { + return_ACPI_STATUS (AE_LIMIT); + } + + GpeEventInfo->RuntimeCount++; + if (GpeEventInfo->RuntimeCount == 1) + { + /* Enable on first reference */ + + Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiEvEnableGpe (GpeEventInfo); + } + + if (ACPI_FAILURE (Status)) + { + GpeEventInfo->RuntimeCount--; + } + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvRemoveGpeReference + * + * PARAMETERS: GpeEventInfo - Remove a reference to this GPE + * + * RETURN: Status + * + * DESCRIPTION: Remove a reference to a GPE. When the last reference is + * removed, the GPE is hardware-disabled. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvRemoveGpeReference ( + ACPI_GPE_EVENT_INFO *GpeEventInfo) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (EvRemoveGpeReference); + + + if (!GpeEventInfo->RuntimeCount) + { + return_ACPI_STATUS (AE_LIMIT); + } + + GpeEventInfo->RuntimeCount--; + if (!GpeEventInfo->RuntimeCount) + { + /* Disable on last reference */ + + Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + } + + if (ACPI_FAILURE (Status)) + { + GpeEventInfo->RuntimeCount++; + } + } + + return_ACPI_STATUS (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiEvLowGetGpeInfo @@ -395,6 +494,16 @@ AcpiEvGpeDetect ( GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; + /* + * Optimization: If there are no GPEs enabled within this + * register, we can safely ignore the entire register. + */ + if (!(GpeRegisterInfo->EnableForRun | + GpeRegisterInfo->EnableForWake)) + { + continue; + } + /* Read the Status Register */ Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress); @@ -412,7 +521,7 @@ AcpiEvGpeDetect ( } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", + "Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n", GpeRegisterInfo->BaseGpeNumber, StatusReg, EnableReg)); /* Check if there is anything active at all in this register */ @@ -437,7 +546,7 @@ AcpiEvGpeDetect ( * Found an active GPE. Dispatch the event to a handler * or method. */ - IntStatus |= AcpiEvGpeDispatch ( + IntStatus |= AcpiEvGpeDispatch (GpeBlock->Node, &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j], j + GpeRegisterInfo->BaseGpeNumber); @@ -521,13 +630,27 @@ AcpiEvAsynchExecuteGpeMethod ( return_VOID; } - /* - * Must check for control method type dispatch one more time to avoid a - * race with EvGpeInstallHandler - */ - if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_METHOD) + /* Do the correct dispatch - normal method or implicit notify */ + + switch (LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) { + case ACPI_GPE_DISPATCH_NOTIFY: + + /* + * Implicit notify. + * Dispatch a DEVICE_WAKE notify to the appropriate handler. + * NOTE: the request is queued for execution after this method + * completes. The notify handlers are NOT invoked synchronously + * from this thread -- because handlers may in turn run other + * control methods. + */ + Status = AcpiEvQueueNotifyRequest ( + LocalGpeEventInfo->Dispatch.DeviceNode, + ACPI_NOTIFY_DEVICE_WAKE); + break; + + case ACPI_GPE_DISPATCH_METHOD: + /* Allocate the evaluation information block */ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); @@ -538,8 +661,8 @@ AcpiEvAsynchExecuteGpeMethod ( else { /* - * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx - * control method that corresponds to this GPE + * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the + * _Lxx/_Exx control method that corresponds to this GPE */ Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode; Info->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -554,6 +677,11 @@ AcpiEvAsynchExecuteGpeMethod ( "while evaluating GPE method [%4.4s]", AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode))); } + + break; + + default: + return_VOID; /* Should never happen */ } /* Defer enabling of GPE until all notify handlers are done */ @@ -573,6 +701,7 @@ AcpiEvAsynchExecuteGpeMethod ( * FUNCTION: AcpiEvAsynchEnableGpe * * PARAMETERS: Context (GpeEventInfo) - Info for this GPE + * Callback from AcpiOsExecute * * RETURN: None * @@ -586,41 +715,66 @@ AcpiEvAsynchEnableGpe ( void *Context) { ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; - ACPI_STATUS Status; - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) - { - /* - * GPE is level-triggered, we clear the GPE status bit after handling - * the event. - */ - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - } + (void) AcpiEvFinishGpe (GpeEventInfo); - /* - * Enable this GPE, conditionally. This means that the GPE will only be - * physically enabled if the EnableForRun bit is set in the EventInfo - */ - (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); - -Exit: ACPI_FREE (GpeEventInfo); return; } +/******************************************************************************* + * + * FUNCTION: AcpiEvFinishGpe + * + * PARAMETERS: GpeEventInfo - Info for this GPE + * + * RETURN: Status + * + * DESCRIPTION: Clear/Enable a GPE. Common code that is used after execution + * of a GPE method or a synchronous or asynchronous GPE handler. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvFinishGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo) +{ + ACPI_STATUS Status; + + + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == + ACPI_GPE_LEVEL_TRIGGERED) + { + /* + * GPE is level-triggered, we clear the GPE status bit after + * handling the event. + */ + Status = AcpiHwClearGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + /* + * Enable this GPE, conditionally. This means that the GPE will + * only be physically enabled if the EnableForRun bit is set + * in the EventInfo. + */ + (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); + return (AE_OK); +} + + /******************************************************************************* * * FUNCTION: AcpiEvGpeDispatch * - * PARAMETERS: GpeEventInfo - Info for this GPE - * GpeNumber - Number relative to the parent GPE block + * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 + * GpeEventInfo - Info for this GPE + * GpeNumber - Number relative to the parent GPE block * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * @@ -633,16 +787,25 @@ Exit: UINT32 AcpiEvGpeDispatch ( + ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber) { ACPI_STATUS Status; + UINT32 ReturnValue; ACPI_FUNCTION_TRACE (EvGpeDispatch); + /* Invoke global event handler if present */ + AcpiGpeCount++; + if (AcpiGbl_GlobalEventHandler) + { + AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE, GpeDevice, + GpeNumber, AcpiGbl_GlobalEventHandlerContext); + } /* * If edge-triggered, clear the GPE status bit now. Note that @@ -655,58 +818,55 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE[0x%2X]", GpeNumber)); + "Unable to clear GPE%02X", GpeNumber)); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } } /* - * Dispatch the GPE to either an installed handler, or the control method - * associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke - * it and do not attempt to run the method. If there is neither a handler - * nor a method, we disable this GPE to prevent further such pointless - * events from firing. + * Always disable the GPE so that it does not keep firing before + * any asynchronous activity completes (either from the execution + * of a GPE method or an asynchronous GPE handler.) + * + * If there is no handler or method to run, just disable the + * GPE and leave it disabled permanently to prevent further such + * pointless events from firing. + */ + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Unable to disable GPE%02X", GpeNumber)); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); + } + + /* + * Dispatch the GPE to either an installed handler or the control + * method associated with this GPE (_Lxx or _Exx). If a handler + * exists, we invoke it and do not attempt to run the method. + * If there is neither a handler nor a method, leave the GPE + * disabled. */ switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) { case ACPI_GPE_DISPATCH_HANDLER: - /* - * Invoke the installed handler (at interrupt level) - * Ignore return status for now. - * TBD: leave GPE disabled on error? - */ - (void) GpeEventInfo->Dispatch.Handler->Address ( - GpeEventInfo->Dispatch.Handler->Context); + /* Invoke the installed handler (at interrupt level) */ - /* It is now safe to clear level-triggered events. */ + ReturnValue = GpeEventInfo->Dispatch.Handler->Address ( + GpeDevice, GpeNumber, + GpeEventInfo->Dispatch.Handler->Context); - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) + /* If requested, clear (if level-triggered) and reenable the GPE */ + + if (ReturnValue & ACPI_REENABLE_GPE) { - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE[0x%2X]", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } + (void) AcpiEvFinishGpe (GpeEventInfo); } break; case ACPI_GPE_DISPATCH_METHOD: - - /* - * Disable the GPE, so it doesn't keep firing before the method has a - * chance to run (it runs asynchronously with interrupts enabled). - */ - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE[0x%2X]", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } + case ACPI_GPE_DISPATCH_NOTIFY: /* * Execute the method associated with the GPE @@ -717,7 +877,7 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to queue handler for GPE[0x%2X] - event disabled", + "Unable to queue handler for GPE%02X - event disabled", GpeNumber)); } break; @@ -730,20 +890,8 @@ AcpiEvGpeDispatch ( * a GPE to be enabled if it has no handler or method. */ ACPI_ERROR ((AE_INFO, - "No handler or method for GPE[0x%2X], disabling event", + "No handler or method for GPE%02X, disabling event", GpeNumber)); - - /* - * Disable the GPE. The GPE will remain disabled until a handler - * is installed or ACPICA is restarted. - */ - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE[0x%2X]", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } break; } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c index 7aaff53150..c3ea571ca4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -467,6 +467,7 @@ AcpiEvCreateGpeBlock ( GpeBlock->Node = GpeDevice; GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH); + GpeBlock->Initialized = FALSE; GpeBlock->RegisterCount = RegisterCount; GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; @@ -493,11 +494,12 @@ AcpiEvCreateGpeBlock ( return_ACPI_STATUS (Status); } + AcpiGbl_AllGpesInitialized = FALSE; + /* Find all GPE methods (_Lxx or_Exx) for this block */ WalkInfo.GpeBlock = GpeBlock; WalkInfo.GpeDevice = GpeDevice; - WalkInfo.EnableThisGpe = FALSE; WalkInfo.ExecuteByOwnerId = FALSE; Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, @@ -529,30 +531,26 @@ AcpiEvCreateGpeBlock ( * * FUNCTION: AcpiEvInitializeGpeBlock * - * PARAMETERS: GpeDevice - Handle to the parent GPE block - * GpeBlock - Gpe Block info + * PARAMETERS: ACPI_GPE_CALLBACK * * RETURN: Status * - * DESCRIPTION: Initialize and enable a GPE block. First find and run any - * _PRT methods associated with the block, then enable the - * appropriate GPEs. + * DESCRIPTION: Initialize and enable a GPE block. Enable GPEs that have + * associated methods. * Note: Assumes namespace is locked. * ******************************************************************************/ ACPI_STATUS AcpiEvInitializeGpeBlock ( - ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GPE_BLOCK_INFO *GpeBlock) + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Ignored) { ACPI_STATUS Status; ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_WALK_INFO WalkInfo; - UINT32 WakeGpeCount; UINT32 GpeEnabledCount; UINT32 GpeIndex; - UINT32 GpeNumber; UINT32 i; UINT32 j; @@ -560,51 +558,22 @@ AcpiEvInitializeGpeBlock ( ACPI_FUNCTION_TRACE (EvInitializeGpeBlock); - /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ - - if (!GpeBlock) + /* + * Ignore a null GPE block (e.g., if no GPE block 1 exists), and + * any GPE blocks that have been initialized already. + */ + if (!GpeBlock || GpeBlock->Initialized) { return_ACPI_STATUS (AE_OK); } /* - * Runtime option: Should wake GPEs be enabled at runtime? The default - * is no, they should only be enabled just as the machine goes to sleep. + * Enable all GPEs that have a corresponding method and have the + * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block + * must be enabled via the acpi_enable_gpe() interface. */ - if (AcpiGbl_LeaveWakeGpesDisabled) - { - /* - * Differentiate runtime vs wake GPEs, via the _PRW control methods. - * Each GPE that has one or more _PRWs that reference it is by - * definition a wake GPE and will not be enabled while the machine - * is running. - */ - WalkInfo.GpeBlock = GpeBlock; - WalkInfo.GpeDevice = GpeDevice; - WalkInfo.ExecuteByOwnerId = FALSE; - - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "While executing _PRW methods")); - } - } - - /* - * Enable all GPEs that have a corresponding method and are not - * capable of generating wakeups. Any other GPEs within this block - * must be enabled via the AcpiEnableGpe interface. - */ - WakeGpeCount = 0; GpeEnabledCount = 0; - if (GpeDevice == AcpiGbl_FadtGpeDevice) - { - GpeDevice = NULL; - } - for (i = 0; i < GpeBlock->RegisterCount; i++) { for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) @@ -613,45 +582,24 @@ AcpiEvInitializeGpeBlock ( GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; - GpeNumber = GpeIndex + GpeBlock->BlockBaseNumber; /* - * If the GPE has already been enabled for runtime - * signalling, make sure that it remains enabled, but - * do not increment its reference count. + * Ignore GPEs that have no corresponding _Lxx/_Exx method + * and GPEs that are used to wake the system */ - if (GpeEventInfo->RuntimeCount) - { - Status = AcpiEvEnableGpe (GpeEventInfo); - goto Enabled; - } - - /* Ignore GPEs that can wake the system */ - - if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) - { - WakeGpeCount++; - if (AcpiGbl_LeaveWakeGpesDisabled) - { - continue; - } - } - - /* Ignore GPEs that have no corresponding _Lxx/_Exx method */ - - if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_METHOD)) + if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_NONE) || + ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) || + (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) { continue; } - /* Enable this GPE */ - - Status = AcpiEnableGpe (GpeDevice, GpeNumber); -Enabled: + Status = AcpiEvAddGpeReference (GpeEventInfo); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Could not enable GPE 0x%02X", GpeNumber)); + "Could not enable GPE 0x%02X", + GpeIndex + GpeBlock->BlockBaseNumber)); continue; } @@ -659,13 +607,13 @@ Enabled: } } - if (GpeEnabledCount || WakeGpeCount) + if (GpeEnabledCount) { ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n", - GpeEnabledCount, WakeGpeCount)); + "Enabled %u GPEs in this block\n", GpeEnabledCount)); } + GpeBlock->Initialized = TRUE; return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c index be38f0cfcd..8bba11166c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -118,12 +118,28 @@ #include "accommon.h" #include "acevents.h" #include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evgpeinit") +/* + * Note: History of _PRW support in ACPICA + * + * Originally (2000 - 2010), the GPE initialization code performed a walk of + * the entire namespace to execute the _PRW methods and detect all GPEs + * capable of waking the system. + * + * As of 10/2010, the _PRW method execution has been removed since it is + * actually unnecessary. The host OS must in fact execute all _PRW methods + * in order to identify the device/power-resource dependencies. We now put + * the onus on the host OS to identify the wake GPEs as part of this process + * and to inform ACPICA of these GPEs via the AcpiSetupGpeForWake interface. This + * not only reduces the complexity of the ACPICA initialization code, but in + * some cases (on systems with very large namespaces) it should reduce the + * kernel boot time as well. + */ + /******************************************************************************* * * FUNCTION: AcpiEvGpeInitialize @@ -288,10 +304,7 @@ Cleanup: * * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a * result of a Load() or LoadTable() operation. If new GPE - * methods have been installed, register the new methods and - * enable and runtime GPEs that are associated with them. Also, - * run any newly loaded _PRW methods in order to discover any - * new CAN_WAKE GPEs. + * methods have been installed, register the new methods. * ******************************************************************************/ @@ -303,49 +316,13 @@ AcpiEvUpdateGpes ( ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_GPE_WALK_INFO WalkInfo; ACPI_STATUS Status = AE_OK; - UINT32 NewWakeGpeCount = 0; - /* We will examine only _PRW/_Lxx/_Exx methods owned by this table */ - - WalkInfo.OwnerId = TableOwnerId; - WalkInfo.ExecuteByOwnerId = TRUE; - WalkInfo.Count = 0; - - if (AcpiGbl_LeaveWakeGpesDisabled) - { - /* - * 1) Run any newly-loaded _PRW methods to find any GPEs that - * can now be marked as CAN_WAKE GPEs. Note: We must run the - * _PRW methods before we process the _Lxx/_Exx methods because - * we will enable all runtime GPEs associated with the new - * _Lxx/_Exx methods at the time we process those methods. - * - * Unlock interpreter so that we can run the _PRW methods. - */ - WalkInfo.GpeBlock = NULL; - WalkInfo.GpeDevice = NULL; - - AcpiExExitInterpreter (); - - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While executing _PRW methods")); - } - - AcpiExEnterInterpreter (); - NewWakeGpeCount = WalkInfo.Count; - } - /* - * 2) Find any _Lxx/_Exx GPE methods that have just been loaded. + * Find any _Lxx/_Exx GPE methods that have just been loaded. * - * Any GPEs that correspond to new _Lxx/_Exx methods and are not - * marked as CAN_WAKE are immediately enabled. + * Any GPEs that correspond to new _Lxx/_Exx methods are immediately + * enabled. * * Examine the namespace underneath each GpeDevice within the * GpeBlock lists. @@ -357,7 +334,8 @@ AcpiEvUpdateGpes ( } WalkInfo.Count = 0; - WalkInfo.EnableThisGpe = TRUE; + WalkInfo.OwnerId = TableOwnerId; + WalkInfo.ExecuteByOwnerId = TRUE; /* Walk the interrupt level descriptor list */ @@ -388,11 +366,9 @@ AcpiEvUpdateGpes ( GpeXruptInfo = GpeXruptInfo->Next; } - if (WalkInfo.Count || NewWakeGpeCount) + if (WalkInfo.Count) { - ACPI_INFO ((AE_INFO, - "Enabled %u new runtime GPEs, added %u new wakeup GPEs", - WalkInfo.Count, NewWakeGpeCount)); + ACPI_INFO ((AE_INFO, "Enabled %u new GPEs", WalkInfo.Count)); } (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); @@ -422,9 +398,7 @@ AcpiEvUpdateGpes ( * xx - is the GPE number [in HEX] * * If WalkInfo->ExecuteByOwnerId is TRUE, we only execute examine GPE methods - * with that owner. - * If WalkInfo->EnableThisGpe is TRUE, the GPE that is referred to by a GPE - * method is immediately enabled (Used for Load/LoadTable operators) + * with that owner. * ******************************************************************************/ @@ -438,8 +412,6 @@ AcpiEvMatchGpeMethod ( ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context); ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_NAMESPACE_NODE *GpeDevice; - ACPI_STATUS Status; UINT32 GpeNumber; char Name[ACPI_NAME_SIZE + 1]; UINT8 Type; @@ -474,9 +446,6 @@ AcpiEvMatchGpeMethod ( /* * 3) Edge/Level determination is based on the 2nd character * of the method name - * - * NOTE: Default GPE type is RUNTIME only. Later, if a _PRW object is - * found that points to this GPE, the ACPI_GPE_CAN_WAKE flag is set. */ switch (Name[1]) { @@ -551,212 +520,12 @@ AcpiEvMatchGpeMethod ( * Add the GPE information from above to the GpeEventInfo block for * use during dispatch of this GPE. */ + GpeEventInfo->Flags &= ~(ACPI_GPE_DISPATCH_MASK); GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD); GpeEventInfo->Dispatch.MethodNode = MethodNode; - /* - * Enable this GPE if requested. This only happens when during the - * execution of a Load or LoadTable operator. We have found a new - * GPE method and want to immediately enable the GPE if it is a - * runtime GPE. - */ - if (WalkInfo->EnableThisGpe) - { - /* Ignore GPEs that can wake the system */ - - if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) || - !AcpiGbl_LeaveWakeGpesDisabled) - { - WalkInfo->Count++; - GpeDevice = WalkInfo->GpeDevice; - - if (GpeDevice == AcpiGbl_FadtGpeDevice) - { - GpeDevice = NULL; - } - - Status = AcpiEnableGpe (GpeDevice, GpeNumber); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not enable GPE 0x%02X", GpeNumber)); - } - } - } - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Registered GPE method %s as GPE number 0x%.2X\n", Name, GpeNumber)); return_ACPI_STATUS (AE_OK); } - - -/******************************************************************************* - * - * FUNCTION: AcpiEvMatchPrwAndGpe - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is - * not aborted on a single _PRW failure. - * - * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a - * Device. Run the _PRW method. If present, extract the GPE - * number and mark the GPE as a CAN_WAKE GPE. Allows a - * per-OwnerId execution if ExecuteByOwnerId is TRUE in the - * WalkInfo parameter block. - * - * If WalkInfo->ExecuteByOwnerId is TRUE, we only execute _PRWs with that - * owner. - * If WalkInfo->GpeDevice is NULL, we execute every _PRW found. Otherwise, - * we only execute _PRWs that refer to the input GpeDevice. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvMatchPrwAndGpe ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context); - ACPI_NAMESPACE_NODE *GpeDevice; - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_NAMESPACE_NODE *TargetGpeDevice; - ACPI_NAMESPACE_NODE *PrwNode; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_OPERAND_OBJECT *PkgDesc; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 GpeNumber; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvMatchPrwAndGpe); - - - /* Check for a _PRW method under this device */ - - Status = AcpiNsGetNode (ObjHandle, METHOD_NAME__PRW, - ACPI_NS_NO_UPSEARCH, &PrwNode); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Check if requested OwnerId matches this OwnerId */ - - if ((WalkInfo->ExecuteByOwnerId) && - (PrwNode->OwnerId != WalkInfo->OwnerId)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Execute the _PRW */ - - Status = AcpiUtEvaluateObject (PrwNode, NULL, - ACPI_BTYPE_PACKAGE, &PkgDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (AE_OK); - } - - /* The returned _PRW package must have at least two elements */ - - if (PkgDesc->Package.Count < 2) - { - goto Cleanup; - } - - /* Extract pointers from the input context */ - - GpeDevice = WalkInfo->GpeDevice; - GpeBlock = WalkInfo->GpeBlock; - - /* - * The _PRW object must return a package, we are only interested - * in the first element - */ - ObjDesc = PkgDesc->Package.Elements[0]; - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Use FADT-defined GPE device (from definition of _PRW) */ - - TargetGpeDevice = NULL; - if (GpeDevice) - { - TargetGpeDevice = AcpiGbl_FadtGpeDevice; - } - - /* Integer is the GPE number in the FADT described GPE blocks */ - - GpeNumber = (UINT32) ObjDesc->Integer.Value; - } - else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - /* Package contains a GPE reference and GPE number within a GPE block */ - - if ((ObjDesc->Package.Count < 2) || - ((ObjDesc->Package.Elements[0])->Common.Type != - ACPI_TYPE_LOCAL_REFERENCE) || - ((ObjDesc->Package.Elements[1])->Common.Type != - ACPI_TYPE_INTEGER)) - { - goto Cleanup; - } - - /* Get GPE block reference and decode */ - - TargetGpeDevice = ObjDesc->Package.Elements[0]->Reference.Node; - GpeNumber = (UINT32) ObjDesc->Package.Elements[1]->Integer.Value; - } - else - { - /* Unknown type, just ignore it */ - - goto Cleanup; - } - - /* Get the GpeEventInfo for this GPE */ - - if (GpeDevice) - { - /* - * Is this GPE within this block? - * - * TRUE if and only if these conditions are true: - * 1) The GPE devices match. - * 2) The GPE index(number) is within the range of the Gpe Block - * associated with the GPE device. - */ - if (GpeDevice != TargetGpeDevice) - { - goto Cleanup; - } - - GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, GpeBlock); - } - else - { - /* GpeDevice is NULL, just match the TargetDevice and GpeNumber */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (TargetGpeDevice, GpeNumber); - } - - if (GpeEventInfo) - { - if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) - { - /* This GPE can wake the system */ - - GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; - WalkInfo->Count++; - } - } - -Cleanup: - AcpiUtRemoveReference (PkgDesc); - return_ACPI_STATUS (AE_OK); -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c index 1bd42b2cac..eb422a17c6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -239,6 +239,51 @@ AcpiEvValidGpeEvent ( } +/******************************************************************************* + * + * FUNCTION: AcpiEvGetGpeDevice + * + * PARAMETERS: GPE_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE + * block device. NULL if the GPE is one of the FADT-defined GPEs. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvGetGpeDevice ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context) +{ + ACPI_GPE_DEVICE_INFO *Info = Context; + + + /* Increment Index by the number of GPEs in this block */ + + Info->NextBlockBaseIndex += GpeBlock->GpeCount; + + if (Info->Index < Info->NextBlockBaseIndex) + { + /* + * The GPE index is within this block, get the node. Leave the node + * NULL for the FADT-defined GPEs + */ + if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE) + { + Info->GpeDevice = GpeBlock->Node; + } + + Info->Status = AE_OK; + return (AE_CTRL_END); + } + + return (AE_OK); +} + + /******************************************************************************* * * FUNCTION: AcpiEvGetGpeXruptBlock diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c b/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c index b0e1cac144..69d6c79ded 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +117,6 @@ #include "accommon.h" #include "acevents.h" #include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evmisc") @@ -129,14 +128,6 @@ static void ACPI_SYSTEM_XFACE AcpiEvNotifyDispatch ( void *Context); -static UINT32 -AcpiEvGlobalLockHandler ( - void *Context); - -static ACPI_STATUS -AcpiEvRemoveGlobalLockHandler ( - void); - /******************************************************************************* * @@ -372,292 +363,6 @@ AcpiEvNotifyDispatch ( } -/******************************************************************************* - * - * FUNCTION: AcpiEvGlobalLockHandler - * - * PARAMETERS: Context - From thread interface, not used - * - * RETURN: ACPI_INTERRUPT_HANDLED - * - * DESCRIPTION: Invoked directly from the SCI handler when a global lock - * release interrupt occurs. Attempt to acquire the global lock, - * if successful, signal the thread waiting for the lock. - * - * NOTE: Assumes that the semaphore can be signaled from interrupt level. If - * this is not possible for some reason, a separate thread will have to be - * scheduled to do this. - * - ******************************************************************************/ - -static UINT32 -AcpiEvGlobalLockHandler ( - void *Context) -{ - BOOLEAN Acquired = FALSE; - ACPI_STATUS Status; - - - /* - * Attempt to get the lock. - * - * If we don't get it now, it will be marked pending and we will - * take another interrupt when it becomes free. - */ - ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); - if (Acquired) - { - /* Got the lock, now wake the thread waiting for it */ - - AcpiGbl_GlobalLockAcquired = TRUE; - - /* Send a unit to the semaphore */ - - Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore")); - } - } - - return (ACPI_INTERRUPT_HANDLED); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInitGlobalLockHandler - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for the global lock release event - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInitGlobalLockHandler ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); - - - /* Attempt installation of the global lock handler */ - - Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler, NULL); - - /* - * If the global lock does not exist on this platform, the attempt to - * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). - * Map to AE_OK, but mark global lock as not present. Any attempt to - * actually use the global lock will be flagged with an error. - */ - if (Status == AE_NO_HARDWARE_RESPONSE) - { - ACPI_ERROR ((AE_INFO, - "No response from Global Lock hardware, disabling lock")); - - AcpiGbl_GlobalLockPresent = FALSE; - return_ACPI_STATUS (AE_OK); - } - - AcpiGbl_GlobalLockPresent = TRUE; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvRemoveGlobalLockHandler - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Remove the handler for the Global Lock - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvRemoveGlobalLockHandler ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); - - AcpiGbl_GlobalLockPresent = FALSE; - Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler); - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEvAcquireGlobalLock - * - * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. - * - * RETURN: Status - * - * DESCRIPTION: Attempt to gain ownership of the Global Lock. - * - * MUTEX: Interpreter must be locked - * - * Note: The original implementation allowed multiple threads to "acquire" the - * Global Lock, and the OS would hold the lock until the last thread had - * released it. However, this could potentially starve the BIOS out of the - * lock, especially in the case where there is a tight handshake between the - * Embedded Controller driver and the BIOS. Therefore, this implementation - * allows only one thread to acquire the HW Global Lock at a time, and makes - * the global lock appear as a standard mutex on the OS side. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiEvAcquireGlobalLock ( - UINT16 Timeout) -{ - ACPI_STATUS Status = AE_OK; - BOOLEAN Acquired = FALSE; - - - ACPI_FUNCTION_TRACE (EvAcquireGlobalLock); - - - /* - * Only one thread can acquire the GL at a time, the GlobalLockMutex - * enforces this. This interface releases the interpreter if we must wait. - */ - Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, - Timeout); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Update the global lock handle and check for wraparound. The handle is - * only used for the external global lock interfaces, but it is updated - * here to properly handle the case where a single thread may acquire the - * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The - * handle is therefore updated on the first acquire from a given thread - * regardless of where the acquisition request originated. - */ - AcpiGbl_GlobalLockHandle++; - if (AcpiGbl_GlobalLockHandle == 0) - { - AcpiGbl_GlobalLockHandle = 1; - } - - /* - * Make sure that a global lock actually exists. If not, just treat the - * lock as a standard mutex. - */ - if (!AcpiGbl_GlobalLockPresent) - { - AcpiGbl_GlobalLockAcquired = TRUE; - return_ACPI_STATUS (AE_OK); - } - - /* Attempt to acquire the actual hardware lock */ - - ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); - if (Acquired) - { - /* We got the lock */ - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired hardware Global Lock\n")); - - AcpiGbl_GlobalLockAcquired = TRUE; - return_ACPI_STATUS (AE_OK); - } - - /* - * Did not get the lock. The pending bit was set above, and we must now - * wait until we get the global lock released interrupt. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for hardware Global Lock\n")); - - /* - * Wait for handshake with the global lock interrupt handler. - * This interface releases the interpreter if we must wait. - */ - Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, - ACPI_WAIT_FOREVER); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvReleaseGlobalLock - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Releases ownership of the Global Lock. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvReleaseGlobalLock ( - void) -{ - BOOLEAN Pending = FALSE; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); - - - /* Lock must be already acquired */ - - if (!AcpiGbl_GlobalLockAcquired) - { - ACPI_WARNING ((AE_INFO, - "Cannot release the ACPI Global Lock, it has not been acquired")); - return_ACPI_STATUS (AE_NOT_ACQUIRED); - } - - if (AcpiGbl_GlobalLockPresent) - { - /* Allow any thread to release the lock */ - - ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); - - /* - * If the pending bit was set, we must write GBL_RLS to the control - * register - */ - if (Pending) - { - Status = AcpiWriteBitRegister ( - ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); - } - - AcpiGbl_GlobalLockAcquired = FALSE; - - /* Release the local GL mutex */ - - AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); - return_ACPI_STATUS (Status); -} - - /****************************************************************************** * * FUNCTION: AcpiEvTerminate @@ -737,4 +442,3 @@ AcpiEvTerminate ( } return_VOID; } - diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evregion.c b/src/add-ons/kernel/bus_managers/acpi/events/evregion.c index f3e10bec8b..bd50228df3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evregion.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -133,6 +133,10 @@ AcpiEvHasDefaultHandler ( ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId); +static void +AcpiEvOrphanEcRegMethod ( + void); + static ACPI_STATUS AcpiEvRegRun ( ACPI_HANDLE ObjHandle, @@ -334,6 +338,8 @@ AcpiEvInitializeOpRegions ( } } + AcpiGbl_RegMethodsExecuted = TRUE; + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } @@ -681,7 +687,7 @@ AcpiEvDetachRegion( /* Now stop region accesses by executing the _REG method */ - Status = AcpiEvExecuteRegMethod (RegionObj, 0); + Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]", @@ -1212,6 +1218,13 @@ AcpiEvExecuteRegMethods ( ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &SpaceId, NULL); + /* Special case for EC: handle "orphan" _REG methods with no region */ + + if (SpaceId == ACPI_ADR_SPACE_EC) + { + AcpiEvOrphanEcRegMethod (); + } + return_ACPI_STATUS (Status); } @@ -1278,7 +1291,122 @@ AcpiEvRegRun ( return (AE_OK); } - Status = AcpiEvExecuteRegMethod (ObjDesc, 1); + Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT); return (Status); } + +/******************************************************************************* + * + * FUNCTION: AcpiEvOrphanEcRegMethod + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC + * device. This is a _REG method that has no corresponding region + * within the EC device scope. The orphan _REG method appears to + * have been enabled by the description of the ECDT in the ACPI + * specification: "The availability of the region space can be + * detected by providing a _REG method object underneath the + * Embedded Controller device." + * + * To quickly access the EC device, we use the EC_ID that appears + * within the ECDT. Otherwise, we would need to perform a time- + * consuming namespace walk, executing _HID methods to find the + * EC device. + * + ******************************************************************************/ + +static void +AcpiEvOrphanEcRegMethod ( + void) +{ + ACPI_TABLE_ECDT *Table; + ACPI_STATUS Status; + ACPI_OBJECT_LIST Args; + ACPI_OBJECT Objects[2]; + ACPI_NAMESPACE_NODE *EcDeviceNode; + ACPI_NAMESPACE_NODE *RegMethod; + ACPI_NAMESPACE_NODE *NextNode; + + + ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); + + + /* Get the ECDT (if present in system) */ + + Status = AcpiGetTable (ACPI_SIG_ECDT, 0, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table)); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + + /* We need a valid EC_ID string */ + + if (!(*Table->Id)) + { + return_VOID; + } + + /* Namespace is currently locked, must release */ + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + /* Get a handle to the EC device referenced in the ECDT */ + + Status = AcpiGetHandle (NULL, + ACPI_CAST_PTR (char, Table->Id), + ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode)); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* Get a handle to a _REG method immediately under the EC device */ + + Status = AcpiGetHandle (EcDeviceNode, + METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod)); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* + * Execute the _REG method only if there is no Operation Region in + * this scope with the Embedded Controller space ID. Otherwise, it + * will already have been executed. Note, this allows for Regions + * with other space IDs to be present; but the code below will then + * execute the _REG method with the EC space ID argument. + */ + NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); + while (NextNode) + { + if ((NextNode->Type == ACPI_TYPE_REGION) && + (NextNode->Object) && + (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) + { + goto Exit; /* Do not execute _REG */ + } + NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); + } + + /* Evaluate the _REG(EC,Connect) method */ + + Args.Count = 2; + Args.Pointer = Objects; + Objects[0].Type = ACPI_TYPE_INTEGER; + Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; + Objects[1].Type = ACPI_TYPE_INTEGER; + Objects[1].Integer.Value = ACPI_REG_CONNECT; + + Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL); + +Exit: + /* We ignore all errors from above, don't care */ + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + return_VOID; +} diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c b/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c index 9fdda23a58..cb9a2fdcd0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -729,9 +729,9 @@ AcpiEvInitializeRegion ( * * See AcpiNsExecModuleCode */ - if (ObjDesc->Method.Flags & AOPOBJ_MODULE_LEVEL) + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) { - HandlerObj = ObjDesc->Method.Extra.Handler; + HandlerObj = ObjDesc->Method.Dispatch.Handler; } break; @@ -768,7 +768,7 @@ AcpiEvInitializeRegion ( } } - Status = AcpiEvExecuteRegMethod (RegionObj, 1); + Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT); if (AcpiNsLocked) { diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evsci.c b/src/add-ons/kernel/bus_managers/acpi/events/evsci.c index ec622d4f82..e0d9261acf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evsci.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evsci.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxface.c b/src/add-ons/kernel/bus_managers/acpi/events/evxface.c index 5019b66315..990ddfb0b8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -175,6 +175,66 @@ Cleanup: ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler) +/******************************************************************************* + * + * FUNCTION: AcpiInstallGlobalEventHandler + * + * PARAMETERS: Handler - Pointer to the global event handler function + * Context - Value passed to the handler on each event + * + * RETURN: Status + * + * DESCRIPTION: Saves the pointer to the handler function. The global handler + * is invoked upon each incoming GPE and Fixed Event. It is + * invoked at interrupt level at the time of the event dispatch. + * Can be used to update event counters, etc. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallGlobalEventHandler ( + ACPI_GBL_EVENT_HANDLER Handler, + void *Context) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiInstallGlobalEventHandler); + + + /* Parameter validation */ + + if (!Handler) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Don't allow two handlers. */ + + if (AcpiGbl_GlobalEventHandler) + { + Status = AE_ALREADY_EXISTS; + goto Cleanup; + } + + AcpiGbl_GlobalEventHandler = Handler; + AcpiGbl_GlobalEventHandlerContext = Context; + + +Cleanup: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallGlobalEventHandler) + + /******************************************************************************* * * FUNCTION: AcpiInstallFixedEventHandler @@ -691,11 +751,11 @@ AcpiInstallGpeHandler ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, - ACPI_EVENT_HANDLER Address, + ACPI_GPE_HANDLER Address, void *Context) { ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_HANDLER_INFO *Handler; + ACPI_GPE_HANDLER_INFO *Handler; ACPI_STATUS Status; ACPI_CPU_FLAGS Flags; @@ -716,13 +776,24 @@ AcpiInstallGpeHandler ( return_ACPI_STATUS (Status); } + /* Allocate and init handler object (before lock) */ + + Handler = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_HANDLER_INFO)); + if (!Handler) + { + Status = AE_NO_MEMORY; + goto UnlockAndExit; + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); if (!GpeEventInfo) { Status = AE_BAD_PARAMETER; - goto UnlockAndExit; + goto FreeAndExit; } /* Make sure that there isn't a handler there already */ @@ -731,28 +802,40 @@ AcpiInstallGpeHandler ( ACPI_GPE_DISPATCH_HANDLER) { Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; + goto FreeAndExit; } - /* Allocate and init handler object */ - - Handler = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_HANDLER_INFO)); - if (!Handler) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - Handler->Address = Address; - Handler->Context = Context; + Handler->Address = Address; + Handler->Context = Context; Handler->MethodNode = GpeEventInfo->Dispatch.MethodNode; + Handler->OriginalFlags = (UINT8) (GpeEventInfo->Flags & + (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK)); + + /* + * If the GPE is associated with a method, it may have been enabled + * automatically during initialization, in which case it has to be + * disabled now to avoid spurious execution of the handler. + */ + if (((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) || + (Handler->OriginalFlags & ACPI_GPE_DISPATCH_NOTIFY)) && + GpeEventInfo->RuntimeCount) + { + Handler->OriginallyEnabled = TRUE; + (void) AcpiEvRemoveGpeReference (GpeEventInfo); + + /* Sanity check of original type against new type */ + + if (Type != (UINT32) (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK)) + { + ACPI_WARNING ((AE_INFO, "GPE type mismatch (level/edge)")); + } + } /* Install the handler */ - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); GpeEventInfo->Dispatch.Handler = Handler; - /* Setup up dispatch flags to indicate handler (vs. method) */ + /* Setup up dispatch flags to indicate handler (vs. method/notify) */ GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER); @@ -763,6 +846,11 @@ AcpiInstallGpeHandler ( UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); + +FreeAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + ACPI_FREE (Handler); + goto UnlockAndExit; } ACPI_EXPORT_SYMBOL (AcpiInstallGpeHandler) @@ -787,10 +875,10 @@ ACPI_STATUS AcpiRemoveGpeHandler ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - ACPI_EVENT_HANDLER Address) + ACPI_GPE_HANDLER Address) { ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_HANDLER_INFO *Handler; + ACPI_GPE_HANDLER_INFO *Handler; ACPI_STATUS Status; ACPI_CPU_FLAGS Flags; @@ -811,6 +899,8 @@ AcpiRemoveGpeHandler ( return_ACPI_STATUS (Status); } + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); @@ -839,18 +929,25 @@ AcpiRemoveGpeHandler ( /* Remove the handler */ - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); Handler = GpeEventInfo->Dispatch.Handler; /* Restore Method node (if any), set dispatch flags */ GpeEventInfo->Dispatch.MethodNode = Handler->MethodNode; - GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */ - if (Handler->MethodNode) + GpeEventInfo->Flags &= + ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); + GpeEventInfo->Flags |= Handler->OriginalFlags; + + /* + * If the GPE was previously associated with a method and it was + * enabled, it should be enabled at this point to restore the + * post-initialization configuration. + */ + if ((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) && + Handler->OriginallyEnabled) { - GpeEventInfo->Flags |= ACPI_GPE_DISPATCH_METHOD; + (void) AcpiEvAddGpeReference (GpeEventInfo); } - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); /* Now we can free the handler object */ @@ -858,6 +955,7 @@ AcpiRemoveGpeHandler ( UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c b/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c index 9c0e9b9ee3..437f6e3137 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -118,21 +118,11 @@ #include "acpi.h" #include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" #include "actables.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evxfevnt") -/* Local prototypes */ - -static ACPI_STATUS -AcpiEvGetGpeDevice ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - /******************************************************************************* * @@ -305,292 +295,11 @@ AcpiEnableEvent ( ACPI_EXPORT_SYMBOL (AcpiEnableEvent) -/******************************************************************************* - * - * FUNCTION: AcpiGpeWakeup - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * Action - Enable or Disable - * - * RETURN: Status - * - * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGpeWakeup ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_CPU_FLAGS Flags; - UINT32 RegisterBit; - - - ACPI_FUNCTION_TRACE (AcpiGpeWakeup); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } - - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); - - /* Perform the action */ - - switch (Action) - { - case ACPI_GPE_ENABLE: - ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); - break; - - case ACPI_GPE_DISABLE: - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); - break; - - default: - ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action)); - Status = AE_BAD_PARAMETER; - break; - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGpeWakeup) - - -/******************************************************************************* - * - * FUNCTION: AcpiEnableGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is - * hardware-enabled. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiEnableGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX) - { - Status = AE_LIMIT; /* Too many references */ - goto UnlockAndExit; - } - - GpeEventInfo->RuntimeCount++; - if (GpeEventInfo->RuntimeCount == 1) - { - Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiEvEnableGpe (GpeEventInfo); - } - if (ACPI_FAILURE (Status)) - { - GpeEventInfo->RuntimeCount--; - } - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnableGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiDisableGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Remove a reference to a GPE. When the last reference is - * removed, only then is the GPE disabled (for runtime GPEs), or - * the GPE mask bit disabled (for wake GPEs) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDisableGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiDisableGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Hardware-disable a runtime GPE on removal of the last reference */ - - if (!GpeEventInfo->RuntimeCount) - { - Status = AE_LIMIT; /* There are no references to remove */ - goto UnlockAndExit; - } - - GpeEventInfo->RuntimeCount--; - if (!GpeEventInfo->RuntimeCount) - { - Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - } - if (ACPI_FAILURE (Status)) - { - GpeEventInfo->RuntimeCount++; - } - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiDisableGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiSetGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE - * - * RETURN: Status - * - * DESCRIPTION: Enable or disable an individual GPE. This function bypasses - * the reference count mechanism used in the AcpiEnableGpe and - * AcpiDisableGpe interfaces -- and should be used with care. - * - * Note: Typically used to disable a runtime GPE for short period of time, - * then re-enable it, without disturbing the existing reference counts. This - * is useful, for example, in the Embedded Controller (EC) driver. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiSetGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Perform the action */ - - switch (Action) - { - case ACPI_GPE_ENABLE: - Status = AcpiEvEnableGpe (GpeEventInfo); - break; - - case ACPI_GPE_DISABLE: - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - break; - - default: - Status = AE_BAD_PARAMETER; - break; - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiSetGpe) - - /******************************************************************************* * * FUNCTION: AcpiDisableEvent * - * PARAMETERS: Event - The fixed eventto be enabled + * PARAMETERS: Event - The fixed event to be disabled * Flags - Reserved * * RETURN: Status @@ -693,53 +402,6 @@ AcpiClearEvent ( ACPI_EXPORT_SYMBOL (AcpiClearEvent) -/******************************************************************************* - * - * FUNCTION: AcpiClearGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Clear an ACPI event (general purpose) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiClearGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiClearGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiHwClearGpe (GpeEventInfo); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiClearGpe) - - /******************************************************************************* * * FUNCTION: AcpiGetEventStatus @@ -788,400 +450,3 @@ AcpiGetEventStatus ( ACPI_EXPORT_SYMBOL (AcpiGetEventStatus) -/******************************************************************************* - * - * FUNCTION: AcpiGetGpeStatus - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * EventStatus - Where the current status of the event will - * be returned - * - * RETURN: Status - * - * DESCRIPTION: Get status of an event (general purpose) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetGpeStatus ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_EVENT_STATUS *EventStatus) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiGetGpeStatus); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Obtain status on the requested GPE number */ - - Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallGpeBlock - * - * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device - * GpeBlockAddress - Address and SpaceID - * RegisterCount - Number of GPE register pairs in the block - * InterruptNumber - H/W interrupt for the block - * - * RETURN: Status - * - * DESCRIPTION: Create and Install a block of GPE registers - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallGpeBlock ( - ACPI_HANDLE GpeDevice, - ACPI_GENERIC_ADDRESS *GpeBlockAddress, - UINT32 RegisterCount, - UINT32 InterruptNumber) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_GPE_BLOCK_INFO *GpeBlock; - - - ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock); - - - if ((!GpeDevice) || - (!GpeBlockAddress) || - (!RegisterCount)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Node = AcpiNsValidateHandle (GpeDevice); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* - * For user-installed GPE Block Devices, the GpeBlockBaseNumber - * is always zero - */ - Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount, - 0, InterruptNumber, &GpeBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Install block in the DeviceObject attached to the node */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - /* - * No object, create a new one (Device nodes do not always have - * an attached object) - */ - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - } - - /* Now install the GPE block in the DeviceObject */ - - ObjDesc->Device.GpeBlock = GpeBlock; - - /* Run the _PRW methods and enable the runtime GPEs in the new block */ - - Status = AcpiEvInitializeGpeBlock (Node, GpeBlock); - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveGpeBlock - * - * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device - * - * RETURN: Status - * - * DESCRIPTION: Remove a previously installed block of GPE registers - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveGpeBlock ( - ACPI_HANDLE GpeDevice) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock); - - - if (!GpeDevice) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Node = AcpiNsValidateHandle (GpeDevice); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Get the DeviceObject attached to the node */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc || - !ObjDesc->Device.GpeBlock) - { - return_ACPI_STATUS (AE_NULL_OBJECT); - } - - /* Delete the GPE block (but not the DeviceObject) */ - - Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock); - if (ACPI_SUCCESS (Status)) - { - ObjDesc->Device.GpeBlock = NULL; - } - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetGpeDevice - * - * PARAMETERS: Index - System GPE index (0-CurrentGpeCount) - * GpeDevice - Where the parent GPE Device is returned - * - * RETURN: Status - * - * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL - * gpe device indicates that the gpe number is contained in one of - * the FADT-defined gpe blocks. Otherwise, the GPE block device. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetGpeDevice ( - UINT32 Index, - ACPI_HANDLE *GpeDevice) -{ - ACPI_GPE_DEVICE_INFO Info; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiGetGpeDevice); - - - if (!GpeDevice) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (Index >= AcpiCurrentGpeCount) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Setup and walk the GPE list */ - - Info.Index = Index; - Info.Status = AE_NOT_EXIST; - Info.GpeDevice = NULL; - Info.NextBlockBaseIndex = 0; - - Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice); - return_ACPI_STATUS (Info.Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice) - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGetGpeDevice - * - * PARAMETERS: GPE_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE - * block device. NULL if the GPE is one of the FADT-defined GPEs. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvGetGpeDevice ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - ACPI_GPE_DEVICE_INFO *Info = Context; - - - /* Increment Index by the number of GPEs in this block */ - - Info->NextBlockBaseIndex += GpeBlock->GpeCount; - - if (Info->Index < Info->NextBlockBaseIndex) - { - /* - * The GPE index is within this block, get the node. Leave the node - * NULL for the FADT-defined GPEs - */ - if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE) - { - Info->GpeDevice = GpeBlock->Node; - } - - Info->Status = AE_OK; - return (AE_CTRL_END); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiDisableAllGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Disable and clear all GPEs in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDisableAllGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiDisableAllGpes); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwDisableAllGpes (); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEnableAllRuntimeGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableAllRuntimeGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwEnableAllRuntimeGpes (); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - return_ACPI_STATUS (Status); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxfgpe.c b/src/add-ons/kernel/bus_managers/acpi/events/evxfgpe.c new file mode 100644 index 0000000000..8cd73b3648 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfgpe.c @@ -0,0 +1,972 @@ +/****************************************************************************** + * + * Module Name: evxfgpe - External Interfaces for General Purpose Events (GPEs) + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + + +#define __EVXFGPE_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" + +#define _COMPONENT ACPI_EVENTS + ACPI_MODULE_NAME ("evxfgpe") + + +/******************************************************************************* + * + * FUNCTION: AcpiUpdateAllGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Complete GPE initialization and enable all GPEs that have + * associated _Lxx or _Exx methods and are not pointed to by any + * device _PRW methods (this indicates that these GPEs are + * generally intended for system or device wakeup. Such GPEs + * have to be enabled directly when the devices whose _PRW + * methods point to them are set up for wakeup signaling.) + * + * NOTE: Should be called after any GPEs are added to the system. Primarily, + * after the system _PRW methods have been run, but also after a GPE Block + * Device has been added or if any new GPE methods have been added via a + * dynamic table load. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUpdateAllGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiUpdateGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + if (AcpiGbl_AllGpesInitialized) + { + goto UnlockAndExit; + } + + Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock, NULL); + if (ACPI_SUCCESS (Status)) + { + AcpiGbl_AllGpesInitialized = TRUE; + } + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiUpdateAllGpes) + + +/******************************************************************************* + * + * FUNCTION: AcpiEnableGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is + * hardware-enabled. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEnableGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiEnableGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + Status = AcpiEvAddGpeReference (GpeEventInfo); + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiEnableGpe) + + +/******************************************************************************* + * + * FUNCTION: AcpiDisableGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Remove a reference to a GPE. When the last reference is + * removed, only then is the GPE disabled (for runtime GPEs), or + * the GPE mask bit disabled (for wake GPEs) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDisableGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiDisableGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + Status = AcpiEvRemoveGpeReference (GpeEventInfo); + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiDisableGpe) + + +/******************************************************************************* + * + * FUNCTION: AcpiSetGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE + * + * RETURN: Status + * + * DESCRIPTION: Enable or disable an individual GPE. This function bypasses + * the reference count mechanism used in the AcpiEnableGpe and + * AcpiDisableGpe interfaces -- and should be used with care. + * + * Note: Typically used to disable a runtime GPE for short period of time, + * then re-enable it, without disturbing the existing reference counts. This + * is useful, for example, in the Embedded Controller (EC) driver. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiSetGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT8 Action) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiSetGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* Perform the action */ + + switch (Action) + { + case ACPI_GPE_ENABLE: + Status = AcpiEvEnableGpe (GpeEventInfo); + break; + + case ACPI_GPE_DISABLE: + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + break; + + default: + Status = AE_BAD_PARAMETER; + break; + } + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiSetGpe) + + +/******************************************************************************* + * + * FUNCTION: AcpiSetupGpeForWake + * + * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW) + * GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Mark a GPE as having the ability to wake the system. This + * interface is intended to be used as the host executes the + * _PRW methods (Power Resources for Wake) in the system tables. + * Each _PRW appears under a Device Object (The WakeDevice), and + * contains the info for the wake GPE associated with the + * WakeDevice. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiSetupGpeForWake ( + ACPI_HANDLE WakeDevice, + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_NAMESPACE_NODE *DeviceNode; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake); + + + /* Parameter Validation */ + + if (!WakeDevice) + { + /* + * By forcing WakeDevice to be valid, we automatically enable the + * implicit notify feature on all hosts. + */ + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Handle root object case */ + + if (WakeDevice == ACPI_ROOT_OBJECT) + { + DeviceNode = AcpiGbl_RootNode; + } + else + { + DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, WakeDevice); + } + + /* Validate WakeDevice is of type Device */ + + if (DeviceNode->Type != ACPI_TYPE_DEVICE) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + /* + * If there is no method or handler for this GPE, then the + * WakeDevice will be notified whenever this GPE fires (aka + * "implicit notify") Note: The GPE is assumed to be + * level-triggered (for windows compatibility). + */ + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_NONE) + { + GpeEventInfo->Flags = + (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED); + GpeEventInfo->Dispatch.DeviceNode = DeviceNode; + } + + GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; + Status = AE_OK; + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiSetupGpeForWake) + + +/******************************************************************************* + * + * FUNCTION: AcpiSetGpeWakeMask + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * Action - Enable or Disable + * + * RETURN: Status + * + * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. The GPE must + * already be marked as a WAKE GPE. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiSetGpeWakeMask ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT8 Action) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + ACPI_CPU_FLAGS Flags; + UINT32 RegisterBit; + + + ACPI_FUNCTION_TRACE (AcpiSetGpeWakeMask); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* + * Ensure that we have a valid GPE number and that this GPE is in + * fact a wake GPE + */ + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) + { + Status = AE_TYPE; + goto UnlockAndExit; + } + + GpeRegisterInfo = GpeEventInfo->RegisterInfo; + if (!GpeRegisterInfo) + { + Status = AE_NOT_EXIST; + goto UnlockAndExit; + } + + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + + /* Perform the action */ + + switch (Action) + { + case ACPI_GPE_ENABLE: + ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); + break; + + case ACPI_GPE_DISABLE: + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); + break; + + default: + ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action)); + Status = AE_BAD_PARAMETER; + break; + } + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiSetGpeWakeMask) + + +/******************************************************************************* + * + * FUNCTION: AcpiClearGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Clear an ACPI event (general purpose) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiClearGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiClearGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiHwClearGpe (GpeEventInfo); + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiClearGpe) + + +/******************************************************************************* + * + * FUNCTION: AcpiGetGpeStatus + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * EventStatus - Where the current status of the event + * will be returned + * + * RETURN: Status + * + * DESCRIPTION: Get the current status of a GPE (signalled/not_signalled) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetGpeStatus ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + ACPI_EVENT_STATUS *EventStatus) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiGetGpeStatus); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* Obtain status on the requested GPE number */ + + Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus); + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus) + + +/******************************************************************************* + * + * FUNCTION: AcpiFinishGpe + * + * PARAMETERS: GpeDevice - Namespace node for the GPE Block + * (NULL for FADT defined GPEs) + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Clear and conditionally reenable a GPE. This completes the GPE + * processing. Intended for use by asynchronous host-installed + * GPE handlers. The GPE is only reenabled if the EnableForRun bit + * is set in the GPE info. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiFinishGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiFinishGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiEvFinishGpe (GpeEventInfo); + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiFinishGpe) + + +/****************************************************************************** + * + * FUNCTION: AcpiDisableAllGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Disable and clear all GPEs in all GPE blocks + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDisableAllGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiDisableAllGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwDisableAllGpes (); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiDisableAllGpes) + + +/****************************************************************************** + * + * FUNCTION: AcpiEnableAllRuntimeGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEnableAllRuntimeGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwEnableAllRuntimeGpes (); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiEnableAllRuntimeGpes) + + +/******************************************************************************* + * + * FUNCTION: AcpiInstallGpeBlock + * + * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device + * GpeBlockAddress - Address and SpaceID + * RegisterCount - Number of GPE register pairs in the block + * InterruptNumber - H/W interrupt for the block + * + * RETURN: Status + * + * DESCRIPTION: Create and Install a block of GPE registers. The GPEs are not + * enabled here. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallGpeBlock ( + ACPI_HANDLE GpeDevice, + ACPI_GENERIC_ADDRESS *GpeBlockAddress, + UINT32 RegisterCount, + UINT32 InterruptNumber) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_GPE_BLOCK_INFO *GpeBlock; + + + ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock); + + + if ((!GpeDevice) || + (!GpeBlockAddress) || + (!RegisterCount)) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Node = AcpiNsValidateHandle (GpeDevice); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* + * For user-installed GPE Block Devices, the GpeBlockBaseNumber + * is always zero + */ + Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount, + 0, InterruptNumber, &GpeBlock); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + /* Install block in the DeviceObject attached to the node */ + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + /* + * No object, create a new one (Device nodes do not always have + * an attached object) + */ + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE); + if (!ObjDesc) + { + Status = AE_NO_MEMORY; + goto UnlockAndExit; + } + + Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE); + + /* Remove local reference to the object */ + + AcpiUtRemoveReference (ObjDesc); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + } + + /* Now install the GPE block in the DeviceObject */ + + ObjDesc->Device.GpeBlock = GpeBlock; + + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock) + + +/******************************************************************************* + * + * FUNCTION: AcpiRemoveGpeBlock + * + * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device + * + * RETURN: Status + * + * DESCRIPTION: Remove a previously installed block of GPE registers + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRemoveGpeBlock ( + ACPI_HANDLE GpeDevice) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; + + + ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock); + + + if (!GpeDevice) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Node = AcpiNsValidateHandle (GpeDevice); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* Get the DeviceObject attached to the node */ + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc || + !ObjDesc->Device.GpeBlock) + { + return_ACPI_STATUS (AE_NULL_OBJECT); + } + + /* Delete the GPE block (but not the DeviceObject) */ + + Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock); + if (ACPI_SUCCESS (Status)) + { + ObjDesc->Device.GpeBlock = NULL; + } + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock) + + +/******************************************************************************* + * + * FUNCTION: AcpiGetGpeDevice + * + * PARAMETERS: Index - System GPE index (0-CurrentGpeCount) + * GpeDevice - Where the parent GPE Device is returned + * + * RETURN: Status + * + * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL + * gpe device indicates that the gpe number is contained in one of + * the FADT-defined gpe blocks. Otherwise, the GPE block device. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetGpeDevice ( + UINT32 Index, + ACPI_HANDLE *GpeDevice) +{ + ACPI_GPE_DEVICE_INFO Info; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiGetGpeDevice); + + + if (!GpeDevice) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + if (Index >= AcpiCurrentGpeCount) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + /* Setup and walk the GPE list */ + + Info.Index = Index; + Info.Status = AE_NOT_EXIST; + Info.GpeDevice = NULL; + Info.NextBlockBaseIndex = 0; + + Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice); + return_ACPI_STATUS (Info.Status); +} + +ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice) diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c b/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c index 9803861cd1..552b0e0f47 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -192,10 +192,43 @@ AcpiInstallAddressSpaceHandler ( goto UnlockAndExit; } + /* + * For the default SpaceIDs, (the IDs for which there are default region handlers + * installed) Only execute the _REG methods if the global initialization _REG + * methods have already been run (via AcpiInitializeObjects). In other words, + * we will defer the execution of the _REG methods for these SpaceIDs until + * execution of AcpiInitializeObjects. This is done because we need the handlers + * for the default spaces (mem/io/pci/table) to be installed before we can run + * any control methods (or _REG methods). There is known BIOS code that depends + * on this. + * + * For all other SpaceIDs, we can safely execute the _REG methods immediately. + * This means that for IDs like EmbeddedController, this function should be called + * only after AcpiEnableSubsystem has been called. + */ + switch (SpaceId) + { + case ACPI_ADR_SPACE_SYSTEM_MEMORY: + case ACPI_ADR_SPACE_SYSTEM_IO: + case ACPI_ADR_SPACE_PCI_CONFIG: + case ACPI_ADR_SPACE_DATA_TABLE: + + if (!AcpiGbl_RegMethodsExecuted) + { + /* We will defer execution of the _REG methods for this space */ + goto UnlockAndExit; + } + break; + + default: + break; + } + /* Run all _REG methods for this address space */ Status = AcpiEvExecuteRegMethods (Node, SpaceId); + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exconfig.c b/src/add-ons/kernel/bus_managers/acpi/executer/exconfig.c index ab2be8a83d..341a05bac3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exconfig.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exconfig.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -206,8 +206,11 @@ AcpiExAddTable ( AcpiNsExecModuleCodeList (); AcpiExEnterInterpreter (); - /* Update GPEs for any new _PRW or _Lxx/_Exx methods. Ignore errors */ - + /* + * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is + * responsible for discovering any new wake GPEs by running _PRW methods + * that may have been loaded by this table. + */ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); if (ACPI_SUCCESS (Status)) { diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exconvrt.c b/src/add-ons/kernel/bus_managers/acpi/executer/exconvrt.c index d0831a32ca..67a0a26dce 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exconvrt.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exconvrt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/excreate.c b/src/add-ons/kernel/bus_managers/acpi/executer/excreate.c index 87c4f8a8f9..a9b92c16f3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/excreate.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/excreate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -400,7 +400,8 @@ AcpiExCreateRegion ( * range */ if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) && - (RegionSpace < ACPI_USER_REGION_BEGIN)) + (RegionSpace < ACPI_USER_REGION_BEGIN) && + (RegionSpace != ACPI_ADR_SPACE_DATA_TABLE)) { ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace)); return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); @@ -595,12 +596,10 @@ AcpiExCreateMethod ( ObjDesc->Method.AmlLength = AmlLength; /* - * Disassemble the method flags. Split off the Arg Count - * for efficiency + * Disassemble the method flags. Split off the ArgCount, Serialized + * flag, and SyncLevel for efficiency. */ MethodFlags = (UINT8) Operand[1]->Integer.Value; - - ObjDesc->Method.MethodFlags = (UINT8) (MethodFlags & ~AML_METHOD_ARG_COUNT); ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT); /* @@ -609,6 +608,8 @@ AcpiExCreateMethod ( */ if (MethodFlags & AML_METHOD_SERIALIZED) { + ObjDesc->Method.InfoFlags = ACPI_METHOD_SERIALIZED; + /* * ACPI 1.0: SyncLevel = 0 * ACPI 2.0: SyncLevel = SyncLevel in method declaration diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c b/src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c index 7347c71f1d..b1d7e072de 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c b/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c index 404a54351f..44f7d3ba5a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -216,7 +216,7 @@ static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.MethodFlags), "Method Flags"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.InfoFlags), "Info Flags"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"}, diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exfield.c b/src/add-ons/kernel/bus_managers/acpi/executer/exfield.c index ad1209da4f..3cec69aafc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exfield.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exfield.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c b/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c index 5ba1b44c55..55aacef4a4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -370,14 +370,14 @@ AcpiExAccessRegion ( if (Status == AE_NOT_IMPLEMENTED) { ACPI_ERROR ((AE_INFO, - "Region %s(0x%X) not implemented", + "Region %s (ID=%u) not implemented", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } else if (Status == AE_NOT_EXIST) { ACPI_ERROR ((AE_INFO, - "Region %s(0x%X) has no handler", + "Region %s (ID=%u) has no handler", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exmisc.c b/src/add-ons/kernel/bus_managers/acpi/executer/exmisc.c index fb3bec984c..41a6d3aadf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exmisc.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c b/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c index 4f7421d4a2..1ce899289b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exnames.c b/src/add-ons/kernel/bus_managers/acpi/executer/exnames.c index 9a2b6e48f4..8fd609823b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exnames.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg1.c b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg1.c index 7a47bb102d..5b37a5e066 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg1.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg1.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg2.c b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg2.c index 6df45ea8ab..b7c19ec775 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg2.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg2.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg3.c b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg3.c index 2bdd56e7dc..e583c53697 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg3.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg3.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg6.c b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg6.c index 0c540ed281..92afffcdea 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg6.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg6.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c b/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c index 6241404973..3355eac2e5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c b/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c index fb84d03000..2a308dbeee 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exresnte.c b/src/add-ons/kernel/bus_managers/acpi/executer/exresnte.c index 59eef550c1..494d154125 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exresnte.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exresnte.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exresolv.c b/src/add-ons/kernel/bus_managers/acpi/executer/exresolv.c index f965293c78..27a6c5273d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exresolv.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exresolv.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exresop.c b/src/add-ons/kernel/bus_managers/acpi/executer/exresop.c index b9700d6dad..3a6be3bba9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exresop.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exresop.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exstore.c b/src/add-ons/kernel/bus_managers/acpi/executer/exstore.c index 3e55fe5b18..30414f0f7e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exstore.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exstore.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exstoren.c b/src/add-ons/kernel/bus_managers/acpi/executer/exstoren.c index 22ccbbf6d4..cee5bc64ce 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exstoren.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exstoren.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exstorob.c b/src/add-ons/kernel/bus_managers/acpi/executer/exstorob.c index 0649fdf698..e9adf5f7ac 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exstorob.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exstorob.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c b/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c index 0217ef53ff..ab36f756e5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exutils.c b/src/add-ons/kernel/bus_managers/acpi/executer/exutils.c index d8815aa517..5a0a9a59db 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exutils.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c index fb88f9663a..b4ceb390ef 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c index c7391b408c..b12bab6bca 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c index 74c5f87a96..d733b1164c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c index cee244450d..2e43a4af90 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c index b195512553..fe796ec273 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c index 2675dadf35..79ddb8e540 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c index 7f2271bad0..92b9a4e71e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwxface.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwxface.c index 9ef6286bdb..e7bcbe0ae9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwxface.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acapps.h b/src/add-ons/kernel/bus_managers/acpi/include/acapps.h index 9670547fdc..4256ef89b2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acapps.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acapps.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -124,7 +124,7 @@ /* Common info for tool signons */ #define ACPICA_NAME "Intel ACPI Component Architecture" -#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2010 Intel Corporation" +#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2011 Intel Corporation" #if ACPI_MACHINE_WIDTH == 64 #define ACPI_WIDTH "-64" diff --git a/src/add-ons/kernel/bus_managers/acpi/include/accommon.h b/src/add-ons/kernel/bus_managers/acpi/include/accommon.h index 36026d768e..7a5739eb0d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/accommon.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/accommon.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h b/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h index 7aa4f47f09..df826fa057 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -240,7 +240,6 @@ /* Operation regions */ -#define ACPI_NUM_PREDEFINED_REGIONS 9 #define ACPI_USER_REGION_BEGIN 0x80 /* Maximum SpaceIds for Operation Regions */ @@ -273,7 +272,8 @@ * *****************************************************************************/ -#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ +#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 2 /* Max command line arguments */ +#define ACPI_DB_LINE_BUFFER_SIZE 512 #define ACPI_DEBUGGER_COMMAND_PROMPT '-' #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h b/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h index 7103e4fdab..05f9aa3e21 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +117,7 @@ #define __ACDEBUG_H__ -#define ACPI_DEBUG_BUFFER_SIZE 4196 +#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ typedef struct CommandInfo { @@ -170,9 +170,9 @@ AcpiDbSingleStep ( /* * dbcmds - debug commands and output routines */ -ACPI_STATUS -AcpiDbDisassembleMethod ( - char *Name); +ACPI_NAMESPACE_NODE * +AcpiDbConvertToNode ( + char *InString); void AcpiDbDisplayTableInfo ( @@ -183,72 +183,20 @@ AcpiDbUnloadAcpiTable ( char *TableArg, char *InstanceArg); -void -AcpiDbSetMethodBreakpoint ( - char *Location, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbSetMethodCallBreakpoint ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbGetBusInfo ( - void); - -void -AcpiDbDisassembleAml ( - char *Statements, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbDumpNamespace ( - char *StartArg, - char *DepthArg); - -void -AcpiDbDumpNamespaceByOwner ( - char *OwnerArg, - char *DepthArg); - void AcpiDbSendNotify ( char *Name, UINT32 Value); -void -AcpiDbSetMethodData ( - char *TypeArg, - char *IndexArg, - char *ValueArg); - -ACPI_STATUS -AcpiDbDisplayObjects ( - char *ObjTypeArg, - char *DisplayCountArg); - void AcpiDbDisplayInterfaces ( char *ActionArg, char *InterfaceNameArg); -ACPI_STATUS -AcpiDbFindNameInNamespace ( - char *NameArg); - -void -AcpiDbSetScope ( - char *Name); - ACPI_STATUS AcpiDbSleep ( char *ObjectArg); -void -AcpiDbFindReferences ( - char *ObjectArg); - void AcpiDbDisplayLocks ( void); @@ -262,7 +210,7 @@ AcpiDbDisplayGpes ( void); void -AcpiDbCheckIntegrity ( +AcpiDbDisplayHandlers ( void); void @@ -270,14 +218,83 @@ AcpiDbGenerateGpe ( char *GpeArg, char *BlockArg); + +/* + * dbmethod - control method commands + */ void -AcpiDbCheckPredefinedNames ( - void); +AcpiDbSetMethodBreakpoint ( + char *Location, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbSetMethodCallBreakpoint ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbSetMethodData ( + char *TypeArg, + char *IndexArg, + char *ValueArg); + +ACPI_STATUS +AcpiDbDisassembleMethod ( + char *Name); + +void +AcpiDbDisassembleAml ( + char *Statements, + ACPI_PARSE_OBJECT *Op); void AcpiDbBatchExecute ( char *CountArg); + +/* + * dbnames - namespace commands + */ +void +AcpiDbSetScope ( + char *Name); + +void +AcpiDbDumpNamespace ( + char *StartArg, + char *DepthArg); + +void +AcpiDbDumpNamespaceByOwner ( + char *OwnerArg, + char *DepthArg); + +ACPI_STATUS +AcpiDbFindNameInNamespace ( + char *NameArg); + +void +AcpiDbCheckPredefinedNames ( + void); + +ACPI_STATUS +AcpiDbDisplayObjects ( + char *ObjTypeArg, + char *DisplayCountArg); + +void +AcpiDbCheckIntegrity ( + void); + +void +AcpiDbFindReferences ( + char *ObjectArg); + +void +AcpiDbGetBusInfo ( + void); + + /* * dbdisply - debug display commands */ @@ -332,6 +349,7 @@ void AcpiDbExecute ( char *Name, char **Args, + ACPI_OBJECT_TYPE *Types, UINT32 Flags); void @@ -412,6 +430,12 @@ AcpiDbUserCommands ( char Prompt, ACPI_PARSE_OBJECT *Op); +char * +AcpiDbGetNextToken ( + char *String, + char **Next, + ACPI_OBJECT_TYPE *ReturnType); + /* * dbstats - Generation and display of ACPI table statistics diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h b/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h index 7e7cea00aa..b151ecdfa7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -125,6 +125,12 @@ #define BLOCK_COMMA_LIST 4 #define ACPI_DEFAULT_RESNAME *(UINT32 *) "__RD" +/* + * Raw table data header. Used by disassembler and data table compiler. + * Do not change. + */ +#define ACPI_RAW_TABLE_DATA_HEADER "Raw Table Data" + typedef const struct acpi_dmtable_info { @@ -189,7 +195,14 @@ typedef const struct acpi_dmtable_info #define ACPI_DMT_EINJINST 38 #define ACPI_DMT_ERSTACT 39 #define ACPI_DMT_ERSTINST 40 - +#define ACPI_DMT_ACCWIDTH 41 +#define ACPI_DMT_UNICODE 42 +#define ACPI_DMT_UUID 43 +#define ACPI_DMT_DEVICE_PATH 44 +#define ACPI_DMT_LABEL 45 +#define ACPI_DMT_BUF7 46 +#define ACPI_DMT_BUF128 47 +#define ACPI_DMT_SLIC 48 typedef void (*ACPI_DMTABLE_HANDLER) ( @@ -322,7 +335,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[]; @@ -339,6 +354,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; + /* * dmtable @@ -436,6 +453,10 @@ void AcpiDmDumpRsdt ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpSlic ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpSlit ( ACPI_TABLE_HEADER *Table); diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h b/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h index d7af8003df..9a47d1dbe6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -123,7 +123,7 @@ /* - * dsopcode - support for late evaluation + * dsargs - execution of dynamic arguments for static objects */ ACPI_STATUS AcpiDsGetBufferFieldArguments ( @@ -145,6 +145,24 @@ ACPI_STATUS AcpiDsGetPackageArguments ( ACPI_OPERAND_OBJECT *ObjDesc); + +/* + * dscontrol - support for execution control opcodes + */ +ACPI_STATUS +AcpiDsExecBeginControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiDsExecEndControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + + +/* + * dsopcode - support for late operand evaluation + */ ACPI_STATUS AcpiDsEvalBufferFieldOperands ( ACPI_WALK_STATE *WalkState, @@ -176,20 +194,6 @@ AcpiDsInitializeRegion ( ACPI_HANDLE ObjHandle); -/* - * dsctrl - Parser/Interpreter interface, control stack routines - */ -ACPI_STATUS -AcpiDsExecBeginControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsExecEndControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - - /* * dsexec - Parser/Interpreter interface, method execution callbacks */ @@ -241,9 +245,14 @@ AcpiDsInitFieldObjects ( /* - * dsload - Parser/Interpreter interface, namespace load callbacks + * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks */ ACPI_STATUS +AcpiDsInitCallbacks ( + ACPI_WALK_STATE *WalkState, + UINT32 PassNumber); + +ACPI_STATUS AcpiDsLoad1BeginOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp); @@ -252,6 +261,10 @@ ACPI_STATUS AcpiDsLoad1EndOp ( ACPI_WALK_STATE *WalkState); + +/* + * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks + */ ACPI_STATUS AcpiDsLoad2BeginOp ( ACPI_WALK_STATE *WalkState, @@ -261,11 +274,6 @@ ACPI_STATUS AcpiDsLoad2EndOp ( ACPI_WALK_STATE *WalkState); -ACPI_STATUS -AcpiDsInitCallbacks ( - ACPI_WALK_STATE *WalkState, - UINT32 PassNumber); - /* * dsmthdat - method data (locals/args) diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acevents.h b/src/add-ons/kernel/bus_managers/acpi/include/acevents.h index c03e9e3657..9944e329d8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acevents.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acevents.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -128,10 +128,6 @@ ACPI_STATUS AcpiEvInstallXruptHandlers ( void); -ACPI_STATUS -AcpiEvInstallFadtGpes ( - void); - UINT32 AcpiEvFixedEventDetect ( void); @@ -144,6 +140,23 @@ BOOLEAN AcpiEvIsNotifyObject ( ACPI_NAMESPACE_NODE *Node); +UINT32 +AcpiEvGetGpeNumberIndex ( + UINT32 GpeNumber); + +ACPI_STATUS +AcpiEvQueueNotifyRequest ( + ACPI_NAMESPACE_NODE *Node, + UINT32 NotifyValue); + + +/* + * evglock - Global Lock support + */ +ACPI_STATUS +AcpiEvInitGlobalLockHandler ( + void); + ACPI_STATUS AcpiEvAcquireGlobalLock( UINT16 Timeout); @@ -153,18 +166,9 @@ AcpiEvReleaseGlobalLock( void); ACPI_STATUS -AcpiEvInitGlobalLockHandler ( +AcpiEvRemoveGlobalLockHandler ( void); -UINT32 -AcpiEvGetGpeNumberIndex ( - UINT32 GpeNumber); - -ACPI_STATUS -AcpiEvQueueNotifyRequest ( - ACPI_NAMESPACE_NODE *Node, - UINT32 NotifyValue); - /* * evgpe - Low-level GPE support @@ -181,6 +185,14 @@ ACPI_STATUS AcpiEvEnableGpe ( ACPI_GPE_EVENT_INFO *GpeEventInfo); +ACPI_STATUS +AcpiEvAddGpeReference ( + ACPI_GPE_EVENT_INFO *GpeEventInfo); + +ACPI_STATUS +AcpiEvRemoveGpeReference ( + ACPI_GPE_EVENT_INFO *GpeEventInfo); + ACPI_GPE_EVENT_INFO * AcpiEvGetGpeEventInfo ( ACPI_HANDLE GpeDevice, @@ -191,6 +203,10 @@ AcpiEvLowGetGpeInfo ( UINT32 GpeNumber, ACPI_GPE_BLOCK_INFO *GpeBlock); +ACPI_STATUS +AcpiEvFinishGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo); + /* * evgpeblk - Upper-level GPE block support @@ -206,8 +222,9 @@ AcpiEvCreateGpeBlock ( ACPI_STATUS AcpiEvInitializeGpeBlock ( - ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GPE_BLOCK_INFO *GpeBlock); + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); ACPI_STATUS AcpiEvDeleteGpeBlock ( @@ -215,6 +232,7 @@ AcpiEvDeleteGpeBlock ( UINT32 AcpiEvGpeDispatch ( + ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber); @@ -236,13 +254,6 @@ AcpiEvMatchGpeMethod ( void *Context, void **ReturnValue); -ACPI_STATUS -AcpiEvMatchPrwAndGpe ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - /* * evgpeutil - GPE utilities */ @@ -255,6 +266,12 @@ BOOLEAN AcpiEvValidGpeEvent ( ACPI_GPE_EVENT_INFO *GpeEventInfo); +ACPI_STATUS +AcpiEvGetGpeDevice ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); + ACPI_GPE_XRUPT_INFO * AcpiEvGetGpeXruptBlock ( UINT32 InterruptNumber); diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h b/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h index 693c61f18b..0985258f97 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h b/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h index 2e158fbf79..1d55d7e986 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -173,13 +173,6 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE); */ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); -/* - * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and - * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only - * be enabled just before going to sleep. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE); - /* * Optionally use default values for the ACPI register widths. Set this to * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. @@ -207,6 +200,12 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE); */ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE); +/* + * Disable runtime checking and repair of values returned by control methods. + * Use only if the repair is causing a problem on a particular machine. + */ +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableAutoRepair, FALSE); + /* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ @@ -269,13 +268,16 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]; /* * Global lock mutex is an actual AML mutex object - * Global lock semaphore works in conjunction with the HW global lock + * Global lock semaphore works in conjunction with the actual global lock + * Global lock spinlock is used for "pending" handshake */ ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex; ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore; +ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GlobalLockPendingLock; ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPending; /* * Spinlocks are used for interfaces that can be possibly called at @@ -324,6 +326,10 @@ ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MAS ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; +/* Initialization sequencing */ + +ACPI_EXTERN BOOLEAN AcpiGbl_RegMethodsExecuted; + /* Misc */ ACPI_EXTERN UINT32 AcpiGbl_OriginalMode; @@ -434,10 +440,13 @@ ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; * ****************************************************************************/ -extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; -ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; +ACPI_EXTERN UINT8 AcpiGbl_AllGpesInitialized; ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead; ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]; +ACPI_EXTERN ACPI_GBL_EVENT_HANDLER AcpiGbl_GlobalEventHandler; +ACPI_EXTERN void *AcpiGbl_GlobalEventHandlerContext; +ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; +extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; /***************************************************************************** @@ -494,10 +503,11 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN char AcpiGbl_DbLineBuf[80]; -ACPI_EXTERN char AcpiGbl_DbParsedBuf[80]; -ACPI_EXTERN char AcpiGbl_DbScopeBuf[40]; -ACPI_EXTERN char AcpiGbl_DbDebugFilename[40]; +ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char AcpiGbl_DbScopeBuf[80]; +ACPI_EXTERN char AcpiGbl_DbDebugFilename[80]; ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile; ACPI_EXTERN char *AcpiGbl_DbBuffer; ACPI_EXTERN char *AcpiGbl_DbFilename; diff --git a/src/add-ons/kernel/bus_managers/acpi/include/achware.h b/src/add-ons/kernel/bus_managers/acpi/include/achware.h index e63fe3f215..32b9a0110a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/achware.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/achware.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h b/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h index e3fa940a10..8cb1e3b1d0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h b/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h index 062972f8e1..22b5dd36b2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -165,25 +165,6 @@ union acpi_parse_object; #define ACPI_MAX_MUTEX 7 #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -#ifdef DEFINE_ACPI_GLOBALS - -/* Debug names for the mutexes above */ - -static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = -{ - "ACPI_MTX_Interpreter", - "ACPI_MTX_Namespace", - "ACPI_MTX_Tables", - "ACPI_MTX_Events", - "ACPI_MTX_Caches", - "ACPI_MTX_Memory", - "ACPI_MTX_CommandComplete", - "ACPI_MTX_CommandReady" -}; - -#endif -#endif /* Lock structure for reader/writer interfaces */ @@ -502,6 +483,7 @@ typedef struct acpi_predefined_data char *Pathname; const ACPI_PREDEFINED_INFO *Predefined; union acpi_operand_object *ParentPackage; + ACPI_NAMESPACE_NODE *Node; UINT32 Flags; UINT8 NodeFlags; @@ -537,18 +519,25 @@ typedef struct acpi_predefined_data /* Dispatch info for each GPE -- either a method or handler, cannot be both */ -typedef struct acpi_handler_info +typedef struct acpi_gpe_handler_info { - ACPI_EVENT_HANDLER Address; /* Address of handler, if any */ + ACPI_GPE_HANDLER Address; /* Address of handler, if any */ void *Context; /* Context to be passed to handler */ ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */ + UINT8 OriginalFlags; /* Original (pre-handler) GPE info */ + BOOLEAN OriginallyEnabled; /* True if GPE was originally enabled */ -} ACPI_HANDLER_INFO; +} ACPI_GPE_HANDLER_INFO; +/* + * GPE dispatch info. At any time, the GPE can have at most one type + * of dispatch - Method, Handler, or Implicit Notify. + */ typedef union acpi_gpe_dispatch_info { ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ - struct acpi_handler_info *Handler; + struct acpi_gpe_handler_info *Handler; /* Installed GPE handler */ + ACPI_NAMESPACE_NODE *DeviceNode; /* Parent _PRW device for implicit notify */ } ACPI_GPE_DISPATCH_INFO; @@ -594,6 +583,7 @@ typedef struct acpi_gpe_block_info UINT32 RegisterCount; /* Number of register pairs in block */ UINT16 GpeCount; /* Number of individual GPEs in block */ UINT8 BlockBaseNumber;/* Base GPE number for this block */ + BOOLEAN Initialized; /* TRUE if this block is initialized */ } ACPI_GPE_BLOCK_INFO; @@ -614,7 +604,6 @@ typedef struct acpi_gpe_walk_info ACPI_GPE_BLOCK_INFO *GpeBlock; UINT16 Count; ACPI_OWNER_ID OwnerId; - BOOLEAN EnableThisGpe; BOOLEAN ExecuteByOwnerId; } ACPI_GPE_WALK_INFO; @@ -1282,6 +1271,7 @@ typedef struct acpi_db_method_info UINT32 NumLoops; char Pathname[128]; char **Args; + ACPI_OBJECT_TYPE *Types; /* * Arguments to be passed to method for the command @@ -1290,6 +1280,7 @@ typedef struct acpi_db_method_info * Index of current thread inside all them created. */ char InitArgs; + ACPI_OBJECT_TYPE ArgTypes[4]; char *Arguments[4]; char NumThreadsStr[11]; char IdOfThreadStr[11]; diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h b/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h index 417cdc3b00..5cc284efdf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acnames.h b/src/add-ons/kernel/bus_managers/acpi/include/acnames.h index 12dd89ce14..3fbc61cc9b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acnames.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acnames.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h b/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h index 5840bbc586..0437a277fe 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acobject.h b/src/add-ons/kernel/bus_managers/acpi/include/acobject.h index ebb656a1b4..6a6ad334e7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acobject.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acobject.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -170,8 +170,6 @@ #define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */ #define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */ #define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */ -#define AOPOBJ_MODULE_LEVEL 0x40 /* Method is actually module-level code */ -#define AOPOBJ_MODIFIED_NAMESPACE 0x80 /* Method modified the namespace */ /****************************************************************************** @@ -284,7 +282,7 @@ typedef struct acpi_object_region typedef struct acpi_object_method { ACPI_OBJECT_COMMON_HEADER - UINT8 MethodFlags; + UINT8 InfoFlags; UINT8 ParamCount; UINT8 SyncLevel; union acpi_operand_object *Mutex; @@ -293,7 +291,7 @@ typedef struct acpi_object_method { ACPI_INTERNAL_METHOD Implementation; union acpi_operand_object *Handler; - } Extra; + } Dispatch; UINT32 AmlLength; UINT8 ThreadCount; @@ -301,6 +299,14 @@ typedef struct acpi_object_method } ACPI_OBJECT_METHOD; +/* Flags for InfoFlags field above */ + +#define ACPI_METHOD_MODULE_LEVEL 0x01 /* Method is actually module-level code */ +#define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ +#define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ +#define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ +#define ACPI_METHOD_MODIFIED_NAMESPACE 0x10 /* Method modified the namespace */ + /****************************************************************************** * diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h b/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h index 94d585d227..5e42cc5b80 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h b/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h index 61884f14d2..0b319c8b10 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -258,13 +258,19 @@ #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) /* - * Module name is included in both debug and non-debug versions primarily for - * error messages. The __FILE__ macro is not very useful for this, because it - * often includes the entire pathname to the module + * The module name is used primarily for error and debug messages. + * The __FILE__ macro is not very useful for this, because it + * usually includes the entire pathname to the module making the + * debug output difficult to read. */ #define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name; #else +/* + * For the no-debug and no-error-msg cases, we must at least define + * a null module name. + */ #define ACPI_MODULE_NAME(Name) +#define _AcpiModuleName "" #endif /* diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acparser.h b/src/add-ons/kernel/bus_managers/acpi/include/acparser.h index 35fe0060f1..3ea2096c9c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acparser.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acparser.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpi.h b/src/add-ons/kernel/bus_managers/acpi/include/acpi.h index fa7cec4568..fcc027d9ae 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpi.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpi.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h b/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h index 9187a4ab34..9f7fc4207c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h @@ -12,7 +12,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -449,9 +449,11 @@ AcpiOsRedirectOutput ( /* * Debug input */ -UINT32 +ACPI_STATUS AcpiOsGetLine ( - char *Buffer); + char *Buffer, + UINT32 BufferLength, + UINT32 *BytesRead); /* diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h b/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h index e2f310d3ee..ca90112409 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +120,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20101013 +#define ACPI_CA_VERSION 0x20110623 #include "actypes.h" #include "actbl.h" @@ -142,17 +142,17 @@ extern UINT32 AcpiDbgLayer; extern UINT8 AcpiGbl_EnableInterpreterSlack; extern UINT8 AcpiGbl_AllMethodsSerialized; extern UINT8 AcpiGbl_CreateOsiMethod; -extern UINT8 AcpiGbl_LeaveWakeGpesDisabled; extern UINT8 AcpiGbl_UseDefaultRegisterWidths; extern ACPI_NAME AcpiGbl_TraceMethodName; extern UINT32 AcpiGbl_TraceFlags; extern UINT8 AcpiGbl_EnableAmlDebugObject; extern UINT8 AcpiGbl_CopyDsdtLocally; extern UINT8 AcpiGbl_TruncateIoAddresses; +extern UINT8 AcpiGbl_DisableAutoRepair; /* - * Global interfaces + * Initialization */ ACPI_STATUS AcpiInitializeTables ( @@ -176,10 +176,10 @@ ACPI_STATUS AcpiTerminate ( void); -ACPI_STATUS -AcpiSubsystemStatus ( - void); +/* + * Miscellaneous global interfaces + */ ACPI_STATUS AcpiEnable ( void); @@ -188,6 +188,10 @@ ACPI_STATUS AcpiDisable ( void); +ACPI_STATUS +AcpiSubsystemStatus ( + void); + ACPI_STATUS AcpiGetSystemInfo ( ACPI_BUFFER *RetBuffer); @@ -212,6 +216,7 @@ ACPI_STATUS AcpiRemoveInterface ( ACPI_STRING InterfaceName); + /* * ACPI Memory management */ @@ -380,6 +385,11 @@ AcpiInstallInitializationHandler ( ACPI_INIT_HANDLER Handler, UINT32 Function); +ACPI_STATUS +AcpiInstallGlobalEventHandler ( + ACPI_GBL_EVENT_HANDLER Handler, + void *Context); + ACPI_STATUS AcpiInstallFixedEventHandler ( UINT32 AcpiEvent, @@ -391,6 +401,20 @@ AcpiRemoveFixedEventHandler ( UINT32 AcpiEvent, ACPI_EVENT_HANDLER Handler); +ACPI_STATUS +AcpiInstallGpeHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Type, + ACPI_GPE_HANDLER Address, + void *Context); + +ACPI_STATUS +AcpiRemoveGpeHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + ACPI_GPE_HANDLER Address); + ACPI_STATUS AcpiInstallNotifyHandler ( ACPI_HANDLE Device, @@ -418,20 +442,6 @@ AcpiRemoveAddressSpaceHandler ( ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler); -ACPI_STATUS -AcpiInstallGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Type, - ACPI_EVENT_HANDLER Address, - void *Context); - -ACPI_STATUS -AcpiRemoveGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_EVENT_HANDLER Address); - ACPI_STATUS AcpiInstallExceptionHandler ( ACPI_EXCEPTION_HANDLER Handler); @@ -442,7 +452,7 @@ AcpiInstallInterfaceHandler ( /* - * Event interfaces + * Global Lock interfaces */ ACPI_STATUS AcpiAcquireGlobalLock ( @@ -453,6 +463,10 @@ ACPI_STATUS AcpiReleaseGlobalLock ( UINT32 Handle); + +/* + * Fixed Event interfaces + */ ACPI_STATUS AcpiEnableEvent ( UINT32 Event, @@ -474,13 +488,11 @@ AcpiGetEventStatus ( /* - * GPE Interfaces + * General Purpose Event (GPE) Interfaces */ ACPI_STATUS -AcpiSetGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action); +AcpiUpdateAllGpes ( + void); ACPI_STATUS AcpiEnableGpe ( @@ -498,7 +510,24 @@ AcpiClearGpe ( UINT32 GpeNumber); ACPI_STATUS -AcpiGpeWakeup ( +AcpiSetGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT8 Action); + +ACPI_STATUS +AcpiFinishGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber); + +ACPI_STATUS +AcpiSetupGpeForWake ( + ACPI_HANDLE ParentDevice, + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber); + +ACPI_STATUS +AcpiSetGpeWakeMask ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT8 Action); diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h b/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h index eb3b646e47..5b3227083f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -542,6 +542,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, {{"_TC2", 0, ACPI_RTYPE_INTEGER}}, + {{"_TDL", 0, ACPI_RTYPE_INTEGER}}, {{"_TIP", 1, ACPI_RTYPE_INTEGER}}, {{"_TIV", 1, ACPI_RTYPE_INTEGER}}, {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h b/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h index 323d040bd0..05ff90c0c1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acrestyp.h b/src/add-ons/kernel/bus_managers/acpi/include/acrestyp.h index 0a85d29f5a..d85e4a9b30 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acrestyp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acrestyp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h b/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h index 53cbea4216..e90d8ecedf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actables.h b/src/add-ons/kernel/bus_managers/acpi/include/actables.h index 9f1c4f00e5..d19e6845d7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actables.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actables.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl.h index e45e2368fc..3cec93028f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -469,4 +469,20 @@ typedef struct acpi_table_desc #define ACPI_FADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FADT, f) +/* + * Sizes of the various flavors of FADT. We need to look closely + * at the FADT length because the version number essentially tells + * us nothing because of many BIOS bugs where the version does not + * match the expected length. In other words, the length of the + * FADT is the bottom line as to what the version really is. + * + * For reference, the values below are as follows: + * FADT V1 size: 0x74 + * FADT V2 size: 0x84 + * FADT V3+ size: 0xF4 + */ +#define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) +#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (Reserved4[0]) + 3) +#define ACPI_FADT_V3_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) + #endif /* __ACTBL_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h index ac11a3fe6b..a593f44170 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h index 881d5ad758..a093e85847 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Name: actbl2.h - ACPI Specification Revision 2.0 Tables + * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec) * *****************************************************************************/ @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -901,6 +901,81 @@ typedef struct acpi_table_mchi } ACPI_TABLE_MCHI; +/******************************************************************************* + * + * SLIC - Software Licensing Description Table + * Version 1 + * + * Conforms to "OEM Activation 2.0 for Windows Vista Operating Systems", + * Copyright 2006 + * + ******************************************************************************/ + +/* Basic SLIC table is only the common ACPI header */ + +typedef struct acpi_table_slic +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_SLIC; + + +/* Common SLIC subtable header */ + +typedef struct acpi_slic_header +{ + UINT32 Type; + UINT32 Length; + +} ACPI_SLIC_HEADER; + +/* Values for Type field above */ + +enum AcpiSlicType +{ + ACPI_SLIC_TYPE_PUBLIC_KEY = 0, + ACPI_SLIC_TYPE_WINDOWS_MARKER = 1, + ACPI_SLIC_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + + +/* + * SLIC Sub-tables, correspond to Type in ACPI_SLIC_HEADER + */ + +/* 0: Public Key Structure */ + +typedef struct acpi_slic_key +{ + ACPI_SLIC_HEADER Header; + UINT8 KeyType; + UINT8 Version; + UINT16 Reserved; + UINT32 Algorithm; + char Magic[4]; + UINT32 BitLength; + UINT32 Exponent; + UINT8 Modulus[128]; + +} ACPI_SLIC_KEY; + + +/* 1: Windows Marker Structure */ + +typedef struct acpi_slic_marker +{ + ACPI_SLIC_HEADER Header; + UINT32 Version; + char OemId[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ + char OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ + char WindowsFlag[8]; + UINT32 SlicVersion; + UINT8 Reserved[16]; + UINT8 Signature[128]; + +} ACPI_SLIC_MARKER; + + /******************************************************************************* * * SPCR - Serial Port Console Redirection table diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actypes.h b/src/add-ons/kernel/bus_managers/acpi/include/actypes.h index e4290ae55d..10b1e67e18 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actypes.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actypes.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -738,25 +738,26 @@ typedef UINT32 ACPI_EVENT_STATUS; /* * GPE info flags - Per GPE - * +-------+---+-+-+ - * | 7:4 |3:2|1|0| - * +-------+---+-+-+ - * | | | | - * | | | +--- Interrupt type: edge or level triggered - * | | +----- GPE can wake the system - * | +-------- Type of dispatch:to method, handler, or none - * +-------------- + * +-------+-+-+---+ + * | 7:4 |3|2|1:0| + * +-------+-+-+---+ + * | | | | + * | | | +-- Type of dispatch:to method, handler, notify, or none + * | | +----- Interrupt type: edge or level triggered + * | +------- Is a Wake GPE + * +------------ */ -#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01 -#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01 +#define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00 +#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01 +#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x02 +#define ACPI_GPE_DISPATCH_NOTIFY (UINT8) 0x03 +#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x03 + +#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x04 #define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00 +#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x04 -#define ACPI_GPE_CAN_WAKE (UINT8) 0x02 - -#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x0C -#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x04 -#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x08 -#define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 +#define ACPI_GPE_CAN_WAKE (UINT8) 0x08 /* * Flags for GPE and Lock interfaces @@ -787,9 +788,24 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 #define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 -#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 8 -#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127 +#define ACPI_NUM_PREDEFINED_REGIONS 8 + +/* + * Special Address Spaces + * + * Note: A Data Table region is a special type of operation region + * that has its own AML opcode. However, internally, the AML + * interpreter simply creates an operation region with an an address + * space type of ACPI_ADR_SPACE_DATA_TABLE. + */ +#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */ +#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 0x7F + +/* Values for _REG connection code */ + +#define ACPI_REG_DISCONNECT 0 +#define ACPI_REG_CONNECT 1 /* * BitRegister IDs @@ -1014,10 +1030,26 @@ typedef void /* * Various handlers and callback procedures */ +typedef +void (*ACPI_GBL_EVENT_HANDLER) ( + UINT32 EventType, + ACPI_HANDLE Device, + UINT32 EventNumber, + void *Context); + +#define ACPI_EVENT_TYPE_GPE 0 +#define ACPI_EVENT_TYPE_FIXED 1 + typedef UINT32 (*ACPI_EVENT_HANDLER) ( void *Context); +typedef +UINT32 (*ACPI_GPE_HANDLER) ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + void *Context); + typedef void (*ACPI_NOTIFY_HANDLER) ( ACPI_HANDLE Device, @@ -1098,6 +1130,11 @@ UINT32 (*ACPI_INTERFACE_HANDLER) ( #define ACPI_INTERRUPT_NOT_HANDLED 0x00 #define ACPI_INTERRUPT_HANDLED 0x01 +/* GPE handler return values */ + +#define ACPI_REENABLE_GPE 0x80 + + /* Length of 32-bit EISAID values when converted back to a string */ #define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acutils.h b/src/add-ons/kernel/bus_managers/acpi/include/acutils.h index 2d73da64fa..cef6ab3e6f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acutils.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acutils.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h b/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h index d6fc7d00ce..c6c62ea9f0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -474,24 +474,6 @@ #define AML_CLASS_UNKNOWN 0x0A -/* Predefined Operation Region SpaceIDs */ - -typedef enum -{ - REGION_MEMORY = 0, - REGION_IO, - REGION_PCI_CONFIG, - REGION_EC, - REGION_SMBUS, - REGION_CMOS, - REGION_PCI_BAR, - REGION_IPMI, - REGION_DATA_TABLE, /* Internal use only */ - REGION_FIXED_HW = 0x7F - -} AML_REGION_TYPES; - - /* Comparison operation codes for MatchOp operator */ typedef enum @@ -579,17 +561,11 @@ typedef enum } AML_ACCESS_ATTRIBUTE; -/* Bit fields in MethodFlags byte */ +/* Bit fields in the AML MethodFlags byte */ #define AML_METHOD_ARG_COUNT 0x07 #define AML_METHOD_SERIALIZED 0x08 #define AML_METHOD_SYNC_LEVEL 0xF0 -/* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */ - -#define AML_METHOD_INTERNAL_ONLY 0x01 -#define AML_METHOD_RESERVED1 0x02 -#define AML_METHOD_RESERVED2 0x04 - #endif /* __AMLCODE_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h b/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h index 4cd2617e22..ba0e324f13 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h index 5c900ef9cf..6ecda765dd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h index cd58839b60..e5b39a17b9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -151,7 +151,7 @@ #define ACPI_SINGLE_THREADED #endif -/* AcpiExec and AcpiBin configuration */ +/* AcpiExec configuration. Multithreaded with full AML debugger */ #ifdef ACPI_EXEC_APP #define ACPI_APPLICATION @@ -160,7 +160,26 @@ #define ACPI_DBG_TRACK_ALLOCATIONS #endif -#ifdef ACPI_BIN_APP +/* AcpiNames configuration. Single threaded with debugger output enabled. */ + +#ifdef ACPI_NAMES_APP +#define ACPI_DEBUGGER +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#endif + +/* + * AcpiBin/AcpiHelp/AcpiSrc configuration. All single threaded, with + * no debug output. + */ +#if (defined ACPI_BIN_APP) || \ + (defined ACPI_SRC_APP) +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#endif + +#ifdef ACPI_HELP_APP +#define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_SINGLE_THREADED #endif diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h index 9c7c9b9444..8743a8f045 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h index 415e9b00df..a93ccf8976 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h index 28a072780f..860869331c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -116,6 +116,40 @@ #ifndef __ACMSVC_H__ #define __ACMSVC_H__ + +/* + * Map low I/O functions for MS. This allows us to disable MS language + * extensions for maximum portability. + */ +#define open _open +#define read _read +#define write _write +#define close _close +#define stat _stat +#define fstat _fstat +#define mkdir _mkdir +#define strlwr _strlwr +#define O_RDONLY _O_RDONLY +#define O_BINARY _O_BINARY +#define O_CREAT _O_CREAT +#define O_WRONLY _O_WRONLY +#define O_TRUNC _O_TRUNC +#define S_IREAD _S_IREAD +#define S_IWRITE _S_IWRITE +#define S_IFDIR _S_IFDIR + +/* Eliminate warnings for "old" (non-secure) versions of clib functions */ + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + +/* Eliminate warnings for POSIX clib function names (open, write, etc.) */ + +#ifndef _CRT_NONSTDC_NO_DEPRECATE +#define _CRT_NONSTDC_NO_DEPRECATE +#endif + #define COMPILER_DEPENDENT_INT64 __int64 #define COMPILER_DEPENDENT_UINT64 unsigned __int64 #define ACPI_INLINE __inline @@ -180,4 +214,8 @@ /* warn C4131: uses old-style declarator (iASL compiler only) */ #pragma warning(disable:4131) +#if _MSC_VER > 1200 /* Versions above VC++ 6 */ +#pragma warning( disable : 4295 ) /* needed for acpredef.h array */ +#endif + #endif /* __ACMSVC_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c index b2af47f215..e098e52b0e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -250,8 +250,8 @@ AcpiNsRootInitialize ( #else /* Mark this as a very SPECIAL method */ - ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY; - ObjDesc->Method.Extra.Implementation = AcpiUtOsiImplementation; + ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY; + ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation; #endif break; diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c index a879fc1ea8..de9f2293b0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -341,7 +341,7 @@ AcpiNsInstallNode ( * modified the namespace. This is used for cleanup when the * method exits. */ - WalkState->MethodDesc->Method.Flags |= AOPOBJ_MODIFIED_NAMESPACE; + WalkState->MethodDesc->Method.InfoFlags |= ACPI_METHOD_MODIFIED_NAMESPACE; } } @@ -459,6 +459,7 @@ AcpiNsDeleteNamespaceSubtree ( { ACPI_NAMESPACE_NODE *ChildNode = NULL; UINT32 Level = 1; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE (NsDeleteNamespaceSubtree); @@ -469,6 +470,14 @@ AcpiNsDeleteNamespaceSubtree ( return_VOID; } + /* Lock namespace for possible update */ + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + /* * Traverse the tree of objects until we bubble back up * to where we started. @@ -521,6 +530,7 @@ AcpiNsDeleteNamespaceSubtree ( } } + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_VOID; } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c index 242033126f..2bc0eba9a0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -725,11 +725,25 @@ AcpiNsDumpObjects ( ACPI_HANDLE StartHandle) { ACPI_WALK_INFO Info; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); + /* + * Just lock the entire namespace for the duration of the dump. + * We don't want any changes to the namespace during this time, + * especially the temporary nodes since we are going to display + * them also. + */ + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not acquire namespace mutex\n"); + return; + } + Info.DebugLevel = ACPI_LV_TABLES; Info.OwnerId = OwnerId; Info.DisplayType = DisplayType; @@ -737,6 +751,8 @@ AcpiNsDumpObjects ( (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c index deabaaee03..98fb8bd0a6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c index 200a957089..c200e92b05 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -486,7 +486,7 @@ AcpiNsExecModuleCode ( */ if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object) { - MethodObj->Method.Extra.Handler = + MethodObj->Method.Dispatch.Handler = ParentNode->Object->Device.Handler; } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c index 39067bb440..d5f9daafbb 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c index bf20ac5f06..45ab0dfc2d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c index f05288e417..59ecfd69a8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c index af5df1983e..d2747f32a9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c index d97c9af702..cd4794079c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nspredef.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nspredef.c index ef76930b51..4c0cc821cf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nspredef.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nspredef.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -288,14 +288,20 @@ AcpiNsCheckPredefinedNames ( } /* - * 1) We have a return value, but if one wasn't expected, just exit, this is - * not a problem. For example, if the "Implicit Return" feature is - * enabled, methods will always return a value. + * Return value validation and possible repair. * - * 2) If the return value can be of any type, then we cannot perform any - * validation, exit. + * 1) Don't perform return value validation/repair if this feature + * has been disabled via a global option. + * + * 2) We have a return value, but if one wasn't expected, just exit, + * this is not a problem. For example, if the "Implicit Return" + * feature is enabled, methods will always return a value. + * + * 3) If the return value can be of any type, then we cannot perform + * any validation, just exit. */ - if ((!Predefined->Info.ExpectedBtypes) || + if (AcpiGbl_DisableAutoRepair || + (!Predefined->Info.ExpectedBtypes) || (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) { goto Cleanup; @@ -309,6 +315,7 @@ AcpiNsCheckPredefinedNames ( goto Cleanup; } Data->Predefined = Predefined; + Data->Node = Node; Data->NodeFlags = Node->Flags; Data->Pathname = Pathname; diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c index 3bc3660da0..702e53e84f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -149,7 +149,6 @@ * * Additional possible repairs: * - * Optional/unnecessary NULL package elements removed * Required package elements that are NULL replaced by Integer/String/Buffer * Incorrect standalone package wrapped with required outer package * @@ -756,17 +755,13 @@ AcpiNsRemoveNullElements ( /* - * PTYPE1 packages contain no subpackages. - * PTYPE2 packages contain a variable number of sub-packages. We can - * safely remove all NULL elements from the PTYPE2 packages. + * We can safely remove all NULL elements from these package types: + * PTYPE1_VAR packages contain a variable number of simple data types. + * PTYPE2 packages contain a variable number of sub-packages. */ switch (PackageType) { - case ACPI_PTYPE1_FIXED: case ACPI_PTYPE1_VAR: - case ACPI_PTYPE1_OPTION: - return; - case ACPI_PTYPE2: case ACPI_PTYPE2_COUNT: case ACPI_PTYPE2_PKG_COUNT: @@ -776,6 +771,8 @@ AcpiNsRemoveNullElements ( break; default: + case ACPI_PTYPE1_FIXED: + case ACPI_PTYPE1_OPTION: return; } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c index 1464a3b2b5..7f8862dc5f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -627,8 +627,23 @@ AcpiNsRepair_TSS ( { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; + /* + * We can only sort the _TSS return package if there is no _PSS in the + * same scope. This is because if _PSS is present, the ACPI specification + * dictates that the _TSS Power Dissipation field is to be ignored, and + * therefore some BIOSs leave garbage values in the _TSS Power field(s). + * In this case, it is best to just return the _TSS package as-is. + * (May, 2011) + */ + Status = AcpiNsGetNode (Data->Node, "^_PSS", ACPI_NS_NO_UPSEARCH, &Node); + if (ACPI_SUCCESS (Status)) + { + return (AE_OK); + } + Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1, ACPI_SORT_DESCENDING, "PowerDissipation"); diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c index 3bee106f2d..c1ba96ede5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c index aee9adcde9..603a00ffe7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c index 2863926060..c7d95e89cf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c index 945690a7c1..c3b96e30b8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c index 8fd3d4c7ea..911fad4086 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -738,11 +738,10 @@ AcpiInstallMethod ( MethodObj->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT); - MethodObj->Method.MethodFlags = (UINT8) - (MethodFlags & ~AML_METHOD_ARG_COUNT); - if (MethodFlags & AML_METHOD_SERIALIZED) { + MethodObj->Method.InfoFlags = ACPI_METHOD_SERIALIZED; + MethodObj->Method.SyncLevel = (UINT8) ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4); } @@ -751,8 +750,7 @@ AcpiInstallMethod ( * Now that it is complete, we can attach the new method object to * the method Node (detaches/deletes any existing object) */ - Status = AcpiNsAttachObject (Node, MethodObj, - ACPI_TYPE_METHOD); + Status = AcpiNsAttachObject (Node, MethodObj, ACPI_TYPE_METHOD); /* * Flag indicates AML buffer is dynamic, must be deleted later. diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c index 8e6ed643e7..5dca29cd81 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psargs.c b/src/add-ons/kernel/bus_managers/acpi/parser/psargs.c index 35cc45188a..1dcb1b77b0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psargs.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psargs.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psloop.c b/src/add-ons/kernel/bus_managers/acpi/parser/psloop.c index e3e2d0ca6b..9791efcc78 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psloop.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psloop.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -767,7 +767,7 @@ AcpiPsLinkModuleCode ( MethodObj->Method.AmlStart = AmlStart; MethodObj->Method.AmlLength = AmlLength; MethodObj->Method.OwnerId = OwnerId; - MethodObj->Method.Flags |= AOPOBJ_MODULE_LEVEL; + MethodObj->Method.InfoFlags |= ACPI_METHOD_MODULE_LEVEL; /* * Save the parent node in NextObject. This is cheating, but we diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psopcode.c b/src/add-ons/kernel/bus_managers/acpi/parser/psopcode.c index e3e32ea555..30a393f1ef 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psopcode.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psparse.c b/src/add-ons/kernel/bus_managers/acpi/parser/psparse.c index 4a1c29d2f4..59af839bec 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psparse.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -128,7 +128,6 @@ #include "acparser.h" #include "acdispat.h" #include "amlcode.h" -#include "acnamesp.h" #include "acinterp.h" #define _COMPONENT ACPI_PARSER @@ -635,23 +634,16 @@ AcpiPsParseAml ( /* Check for possible multi-thread reentrancy problem */ if ((Status == AE_ALREADY_EXISTS) && - (!WalkState->MethodDesc->Method.Mutex)) + (!(WalkState->MethodDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED))) { - ACPI_INFO ((AE_INFO, - "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", - WalkState->MethodNode->Name.Ascii)); - /* - * Method tried to create an object twice. The probable cause is - * that the method cannot handle reentrancy. - * - * The method is marked NotSerialized, but it tried to create - * a named object, causing the second thread entrance to fail. - * Workaround this problem by marking the method permanently - * as Serialized. + * Method is not serialized and tried to create an object + * twice. The probable cause is that the method cannot + * handle reentrancy. Mark as "pending serialized" now, and + * then mark "serialized" when the last thread exits. */ - WalkState->MethodDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED; - WalkState->MethodDesc->Method.SyncLevel = 0; + WalkState->MethodDesc->Method.InfoFlags |= + ACPI_METHOD_SERIALIZED_PENDING; } } diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psscope.c b/src/add-ons/kernel/bus_managers/acpi/parser/psscope.c index bb7e149390..10fe18690f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psscope.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psscope.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/pstree.c b/src/add-ons/kernel/bus_managers/acpi/parser/pstree.c index 6a425e9cf4..950dedf6c2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/pstree.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/pstree.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psutils.c b/src/add-ons/kernel/bus_managers/acpi/parser/psutils.c index 17be364a27..e676a4023a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/pswalk.c b/src/add-ons/kernel/bus_managers/acpi/parser/pswalk.c index 81310ba09f..0de366c4a0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/pswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/pswalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psxface.c b/src/add-ons/kernel/bus_managers/acpi/parser/psxface.c index 6cc5f413b9..54af318284 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -121,7 +121,6 @@ #include "acdispat.h" #include "acinterp.h" #include "actables.h" -#include "amlcode.h" #define _COMPONENT ACPI_PARSER @@ -399,16 +398,16 @@ AcpiPsExecuteMethod ( goto Cleanup; } - if (Info->ObjDesc->Method.Flags & AOPOBJ_MODULE_LEVEL) + if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) { WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL; } /* Invoke an internal method if necessary */ - if (Info->ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) + if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY) { - Status = Info->ObjDesc->Method.Extra.Implementation (WalkState); + Status = Info->ObjDesc->Method.Dispatch.Implementation (WalkState); Info->ReturnObject = WalkState->ReturnDesc; /* Cleanup states */ diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c index eeed1dffdb..0ee032c799 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c b/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c index 3215c9ecdb..ceb8cd9215 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c b/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c index 5f78b9e5ee..11db3a44f1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c index 3c1275f52f..d2db725b2e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c index 8f6aa0aa35..5fca428e3d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c index a29c655c48..26e7988644 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c index 21120f6edb..d424d1215c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c b/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c index 75f50487a3..58bd395114 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c index f4d1cca436..708e604c51 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c index 191c7a91c9..89c59a531b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c index b5c2ab5a73..f3c73f8fd4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c index 2a019d1844..6646ef18ed 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c index a86a55cdaa..fae6428582 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -482,8 +482,11 @@ AcpiTbConvertFadt ( * * The ACPI 1.0 reserved fields that will be zeroed are the bytes located * at offset 45, 55, 95, and the word located at offset 109, 110. + * + * Note: The FADT revision value is unreliable. Only the length can be + * trusted. */ - if (AcpiGbl_FADT.Header.Revision < 3) + if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE) { AcpiGbl_FADT.PreferredProfile = 0; AcpiGbl_FADT.PstateControl = 0; diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c index 4fd988ef9e..48ef81756c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c index 2179b6bf7b..da3ccf497a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -216,12 +216,28 @@ AcpiTbAddTable ( } /* - * Originally, we checked the table signature for "SSDT" or "PSDT" here. - * Next, we added support for OEMx tables, signature "OEM". - * Valid tables were encountered with a null signature, so we've just - * given up on validating the signature, since it seems to be a waste - * of code. The original code was removed (05/2008). + * Validate the incoming table signature. + * + * 1) Originally, we checked the table signature for "SSDT" or "PSDT". + * 2) We added support for OEMx tables, signature "OEM". + * 3) Valid tables were encountered with a null signature, so we just + * gave up on validating the signature, (05/2008). + * 4) We encountered non-AML tables such as the MADT, which caused + * interpreter errors and kernel faults. So now, we once again allow + * only "SSDT", "OEMx", and now, also a null signature. (05/2011). */ + if ((TableDesc->Pointer->Signature[0] != 0x00) && + (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) && + (ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3))) + { + ACPI_ERROR ((AE_INFO, + "Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx", + AcpiUtValidAcpiName (*(UINT32 *) TableDesc->Pointer->Signature) ? + TableDesc->Pointer->Signature : "????", + *(UINT32 *) TableDesc->Pointer->Signature)); + + return_ACPI_STATUS (AE_BAD_SIGNATURE); + } (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c index 100a91d9e5..3cb3cc204c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c index ba1a026e86..507ea0bd68 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c index 6f120063b7..7319a18376 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c index f2478b2962..7a276f8203 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c index 2cee9a13ce..ba131014b6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c index fd7796fee5..340e5b5d4a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c index c1fccaefe1..64484ad023 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c index ad158465e0..b21f07fc9e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utdecode.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utdecode.c new file mode 100644 index 0000000000..94b53d80d2 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdecode.c @@ -0,0 +1,702 @@ +/****************************************************************************** + * + * Module Name: utdecode - Utility decoding routines (value-to-string) + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __UTDECODE_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utdecode") + + +/******************************************************************************* + * + * FUNCTION: AcpiFormatException + * + * PARAMETERS: Status - The ACPI_STATUS code to be formatted + * + * RETURN: A string containing the exception text. A valid pointer is + * always returned. + * + * DESCRIPTION: This function translates an ACPI exception into an ASCII string + * It is here instead of utxface.c so it is always present. + * + ******************************************************************************/ + +const char * +AcpiFormatException ( + ACPI_STATUS Status) +{ + const char *Exception = NULL; + + + ACPI_FUNCTION_ENTRY (); + + + Exception = AcpiUtValidateException (Status); + if (!Exception) + { + /* Exception code was not recognized */ + + ACPI_ERROR ((AE_INFO, + "Unknown exception code: 0x%8.8X", Status)); + + Exception = "UNKNOWN_STATUS_CODE"; + } + + return (ACPI_CAST_PTR (const char, Exception)); +} + +ACPI_EXPORT_SYMBOL (AcpiFormatException) + + +/* + * Properties of the ACPI Object Types, both internal and external. + * The table is indexed by values of ACPI_OBJECT_TYPE + */ +const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = +{ + ACPI_NS_NORMAL, /* 00 Any */ + ACPI_NS_NORMAL, /* 01 Number */ + ACPI_NS_NORMAL, /* 02 String */ + ACPI_NS_NORMAL, /* 03 Buffer */ + ACPI_NS_NORMAL, /* 04 Package */ + ACPI_NS_NORMAL, /* 05 FieldUnit */ + ACPI_NS_NEWSCOPE, /* 06 Device */ + ACPI_NS_NORMAL, /* 07 Event */ + ACPI_NS_NEWSCOPE, /* 08 Method */ + ACPI_NS_NORMAL, /* 09 Mutex */ + ACPI_NS_NORMAL, /* 10 Region */ + ACPI_NS_NEWSCOPE, /* 11 Power */ + ACPI_NS_NEWSCOPE, /* 12 Processor */ + ACPI_NS_NEWSCOPE, /* 13 Thermal */ + ACPI_NS_NORMAL, /* 14 BufferField */ + ACPI_NS_NORMAL, /* 15 DdbHandle */ + ACPI_NS_NORMAL, /* 16 Debug Object */ + ACPI_NS_NORMAL, /* 17 DefField */ + ACPI_NS_NORMAL, /* 18 BankField */ + ACPI_NS_NORMAL, /* 19 IndexField */ + ACPI_NS_NORMAL, /* 20 Reference */ + ACPI_NS_NORMAL, /* 21 Alias */ + ACPI_NS_NORMAL, /* 22 MethodAlias */ + ACPI_NS_NORMAL, /* 23 Notify */ + ACPI_NS_NORMAL, /* 24 Address Handler */ + ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ + ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ + ACPI_NS_NEWSCOPE, /* 27 Scope */ + ACPI_NS_NORMAL, /* 28 Extra */ + ACPI_NS_NORMAL, /* 29 Data */ + ACPI_NS_NORMAL /* 30 Invalid */ +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtHexToAsciiChar + * + * PARAMETERS: Integer - Contains the hex digit + * Position - bit position of the digit within the + * integer (multiple of 4) + * + * RETURN: The converted Ascii character + * + * DESCRIPTION: Convert a hex digit to an Ascii character + * + ******************************************************************************/ + +/* Hex to ASCII conversion table */ + +static const char AcpiGbl_HexToAscii[] = +{ + '0','1','2','3','4','5','6','7', + '8','9','A','B','C','D','E','F' +}; + +char +AcpiUtHexToAsciiChar ( + UINT64 Integer, + UINT32 Position) +{ + + return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetRegionName + * + * PARAMETERS: Space ID - ID for the region + * + * RETURN: Decoded region SpaceId name + * + * DESCRIPTION: Translate a Space ID into a name string (Debug only) + * + ******************************************************************************/ + +/* Region type decoding */ + +const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = +{ + "SystemMemory", + "SystemIO", + "PCI_Config", + "EmbeddedControl", + "SMBus", + "SystemCMOS", + "PCIBARTarget", + "IPMI" +}; + + +char * +AcpiUtGetRegionName ( + UINT8 SpaceId) +{ + + if (SpaceId >= ACPI_USER_REGION_BEGIN) + { + return ("UserDefinedRegion"); + } + else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE) + { + return ("DataTable"); + } + else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE) + { + return ("FunctionalFixedHW"); + } + else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) + { + return ("InvalidSpaceId"); + } + + return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId])); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetEventName + * + * PARAMETERS: EventId - Fixed event ID + * + * RETURN: Decoded event ID name + * + * DESCRIPTION: Translate a Event ID into a name string (Debug only) + * + ******************************************************************************/ + +/* Event type decoding */ + +static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = +{ + "PM_Timer", + "GlobalLock", + "PowerButton", + "SleepButton", + "RealTimeClock", +}; + + +char * +AcpiUtGetEventName ( + UINT32 EventId) +{ + + if (EventId > ACPI_EVENT_MAX) + { + return ("InvalidEventID"); + } + + return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId])); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetTypeName + * + * PARAMETERS: Type - An ACPI object type + * + * RETURN: Decoded ACPI object type name + * + * DESCRIPTION: Translate a Type ID into a name string (Debug only) + * + ******************************************************************************/ + +/* + * Elements of AcpiGbl_NsTypeNames below must match + * one-to-one with values of ACPI_OBJECT_TYPE + * + * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; + * when stored in a table it really means that we have thus far seen no + * evidence to indicate what type is actually going to be stored for this entry. + */ +static const char AcpiGbl_BadType[] = "UNDEFINED"; + +/* Printable names of the ACPI object types */ + +static const char *AcpiGbl_NsTypeNames[] = +{ + /* 00 */ "Untyped", + /* 01 */ "Integer", + /* 02 */ "String", + /* 03 */ "Buffer", + /* 04 */ "Package", + /* 05 */ "FieldUnit", + /* 06 */ "Device", + /* 07 */ "Event", + /* 08 */ "Method", + /* 09 */ "Mutex", + /* 10 */ "Region", + /* 11 */ "Power", + /* 12 */ "Processor", + /* 13 */ "Thermal", + /* 14 */ "BufferField", + /* 15 */ "DdbHandle", + /* 16 */ "DebugObject", + /* 17 */ "RegionField", + /* 18 */ "BankField", + /* 19 */ "IndexField", + /* 20 */ "Reference", + /* 21 */ "Alias", + /* 22 */ "MethodAlias", + /* 23 */ "Notify", + /* 24 */ "AddrHandler", + /* 25 */ "ResourceDesc", + /* 26 */ "ResourceFld", + /* 27 */ "Scope", + /* 28 */ "Extra", + /* 29 */ "Data", + /* 30 */ "Invalid" +}; + + +char * +AcpiUtGetTypeName ( + ACPI_OBJECT_TYPE Type) +{ + + if (Type > ACPI_TYPE_INVALID) + { + return (ACPI_CAST_PTR (char, AcpiGbl_BadType)); + } + + return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type])); +} + + +char * +AcpiUtGetObjectTypeName ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + + if (!ObjDesc) + { + return ("[NULL Object Descriptor]"); + } + + return (AcpiUtGetTypeName (ObjDesc->Common.Type)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetNodeName + * + * PARAMETERS: Object - A namespace node + * + * RETURN: ASCII name of the node + * + * DESCRIPTION: Validate the node and return the node's ACPI name. + * + ******************************************************************************/ + +char * +AcpiUtGetNodeName ( + void *Object) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; + + + /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ + + if (!Object) + { + return ("NULL"); + } + + /* Check for Root node */ + + if ((Object == ACPI_ROOT_OBJECT) || + (Object == AcpiGbl_RootNode)) + { + return ("\"\\\" "); + } + + /* Descriptor must be a namespace node */ + + if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + { + return ("####"); + } + + /* + * Ensure name is valid. The name was validated/repaired when the node + * was created, but make sure it has not been corrupted. + */ + AcpiUtRepairName (Node->Name.Ascii); + + /* Return the name */ + + return (Node->Name.Ascii); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetDescriptorName + * + * PARAMETERS: Object - An ACPI object + * + * RETURN: Decoded name of the descriptor type + * + * DESCRIPTION: Validate object and return the descriptor type + * + ******************************************************************************/ + +/* Printable names of object descriptor types */ + +static const char *AcpiGbl_DescTypeNames[] = +{ + /* 00 */ "Not a Descriptor", + /* 01 */ "Cached", + /* 02 */ "State-Generic", + /* 03 */ "State-Update", + /* 04 */ "State-Package", + /* 05 */ "State-Control", + /* 06 */ "State-RootParseScope", + /* 07 */ "State-ParseScope", + /* 08 */ "State-WalkScope", + /* 09 */ "State-Result", + /* 10 */ "State-Notify", + /* 11 */ "State-Thread", + /* 12 */ "Walk", + /* 13 */ "Parser", + /* 14 */ "Operand", + /* 15 */ "Node" +}; + + +char * +AcpiUtGetDescriptorName ( + void *Object) +{ + + if (!Object) + { + return ("NULL OBJECT"); + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) + { + return ("Not a Descriptor"); + } + + return (ACPI_CAST_PTR (char, + AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)])); + +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetReferenceName + * + * PARAMETERS: Object - An ACPI reference object + * + * RETURN: Decoded name of the type of reference + * + * DESCRIPTION: Decode a reference object sub-type to a string. + * + ******************************************************************************/ + +/* Printable names of reference object sub-types */ + +static const char *AcpiGbl_RefClassNames[] = +{ + /* 00 */ "Local", + /* 01 */ "Argument", + /* 02 */ "RefOf", + /* 03 */ "Index", + /* 04 */ "DdbHandle", + /* 05 */ "Named Object", + /* 06 */ "Debug" +}; + +const char * +AcpiUtGetReferenceName ( + ACPI_OPERAND_OBJECT *Object) +{ + + if (!Object) + { + return ("NULL Object"); + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) + { + return ("Not an Operand object"); + } + + if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) + { + return ("Not a Reference object"); + } + + if (Object->Reference.Class > ACPI_REFCLASS_MAX) + { + return ("Unknown Reference class"); + } + + return (AcpiGbl_RefClassNames[Object->Reference.Class]); +} + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +/* + * Strings and procedures used for debug only + */ + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetMutexName + * + * PARAMETERS: MutexId - The predefined ID for this mutex. + * + * RETURN: Decoded name of the internal mutex + * + * DESCRIPTION: Translate a mutex ID into a name string (Debug only) + * + ******************************************************************************/ + +/* Names for internal mutex objects, used for debug output */ + +static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = +{ + "ACPI_MTX_Interpreter", + "ACPI_MTX_Namespace", + "ACPI_MTX_Tables", + "ACPI_MTX_Events", + "ACPI_MTX_Caches", + "ACPI_MTX_Memory", + "ACPI_MTX_CommandComplete", + "ACPI_MTX_CommandReady" +}; + +char * +AcpiUtGetMutexName ( + UINT32 MutexId) +{ + + if (MutexId > ACPI_MAX_MUTEX) + { + return ("Invalid Mutex ID"); + } + + return (AcpiGbl_MutexNames[MutexId]); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetNotifyName + * + * PARAMETERS: NotifyValue - Value from the Notify() request + * + * RETURN: Decoded name for the notify value + * + * DESCRIPTION: Translate a Notify Value to a notify namestring. + * + ******************************************************************************/ + +/* Names for Notify() values, used for debug output */ + +static const char *AcpiGbl_NotifyValueNames[] = +{ + "Bus Check", + "Device Check", + "Device Wake", + "Eject Request", + "Device Check Light", + "Frequency Mismatch", + "Bus Mode Mismatch", + "Power Fault", + "Capabilities Check", + "Device PLD Check", + "Reserved", + "System Locality Update" +}; + +const char * +AcpiUtGetNotifyName ( + UINT32 NotifyValue) +{ + + if (NotifyValue <= ACPI_NOTIFY_MAX) + { + return (AcpiGbl_NotifyValueNames[NotifyValue]); + } + else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) + { + return ("Reserved"); + } + else /* Greater or equal to 0x80 */ + { + return ("**Device Specific**"); + } +} +#endif + + +/******************************************************************************* + * + * FUNCTION: AcpiUtValidObjectType + * + * PARAMETERS: Type - Object type to be validated + * + * RETURN: TRUE if valid object type, FALSE otherwise + * + * DESCRIPTION: Validate an object type + * + ******************************************************************************/ + +BOOLEAN +AcpiUtValidObjectType ( + ACPI_OBJECT_TYPE Type) +{ + + if (Type > ACPI_TYPE_LOCAL_MAX) + { + /* Note: Assumes all TYPEs are contiguous (external/local) */ + + return (FALSE); + } + + return (TRUE); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c index 7ef61f8b06..801f957d49 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c b/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c index 080bd4c820..eeaaebbbe0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c index a7e1baa2e8..30da582a98 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -118,7 +118,6 @@ #include "acpi.h" #include "accommon.h" -#include "acnamesp.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utglobal") @@ -190,47 +189,6 @@ const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] = }; -/******************************************************************************* - * - * FUNCTION: AcpiFormatException - * - * PARAMETERS: Status - The ACPI_STATUS code to be formatted - * - * RETURN: A string containing the exception text. A valid pointer is - * always returned. - * - * DESCRIPTION: This function translates an ACPI exception into an ASCII string - * It is here instead of utxface.c so it is always present. - * - ******************************************************************************/ - -const char * -AcpiFormatException ( - ACPI_STATUS Status) -{ - const char *Exception = NULL; - - - ACPI_FUNCTION_ENTRY (); - - - Exception = AcpiUtValidateException (Status); - if (!Exception) - { - /* Exception code was not recognized */ - - ACPI_ERROR ((AE_INFO, - "Unknown exception code: 0x%8.8X", Status)); - - Exception = "UNKNOWN_STATUS_CODE"; - } - - return (ACPI_CAST_PTR (const char, Exception)); -} - -ACPI_EXPORT_SYMBOL (AcpiFormatException) - - /******************************************************************************* * * Namespace globals @@ -268,78 +226,6 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = {NULL, ACPI_TYPE_ANY, NULL} }; -/* - * Properties of the ACPI Object Types, both internal and external. - * The table is indexed by values of ACPI_OBJECT_TYPE - */ -const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = -{ - ACPI_NS_NORMAL, /* 00 Any */ - ACPI_NS_NORMAL, /* 01 Number */ - ACPI_NS_NORMAL, /* 02 String */ - ACPI_NS_NORMAL, /* 03 Buffer */ - ACPI_NS_NORMAL, /* 04 Package */ - ACPI_NS_NORMAL, /* 05 FieldUnit */ - ACPI_NS_NEWSCOPE, /* 06 Device */ - ACPI_NS_NORMAL, /* 07 Event */ - ACPI_NS_NEWSCOPE, /* 08 Method */ - ACPI_NS_NORMAL, /* 09 Mutex */ - ACPI_NS_NORMAL, /* 10 Region */ - ACPI_NS_NEWSCOPE, /* 11 Power */ - ACPI_NS_NEWSCOPE, /* 12 Processor */ - ACPI_NS_NEWSCOPE, /* 13 Thermal */ - ACPI_NS_NORMAL, /* 14 BufferField */ - ACPI_NS_NORMAL, /* 15 DdbHandle */ - ACPI_NS_NORMAL, /* 16 Debug Object */ - ACPI_NS_NORMAL, /* 17 DefField */ - ACPI_NS_NORMAL, /* 18 BankField */ - ACPI_NS_NORMAL, /* 19 IndexField */ - ACPI_NS_NORMAL, /* 20 Reference */ - ACPI_NS_NORMAL, /* 21 Alias */ - ACPI_NS_NORMAL, /* 22 MethodAlias */ - ACPI_NS_NORMAL, /* 23 Notify */ - ACPI_NS_NORMAL, /* 24 Address Handler */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ - ACPI_NS_NEWSCOPE, /* 27 Scope */ - ACPI_NS_NORMAL, /* 28 Extra */ - ACPI_NS_NORMAL, /* 29 Data */ - ACPI_NS_NORMAL /* 30 Invalid */ -}; - - -/* Hex to ASCII conversion table */ - -static const char AcpiGbl_HexToAscii[] = -{ - '0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F' -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtHexToAsciiChar - * - * PARAMETERS: Integer - Contains the hex digit - * Position - bit position of the digit within the - * integer (multiple of 4) - * - * RETURN: The converted Ascii character - * - * DESCRIPTION: Convert a hex digit to an Ascii character - * - ******************************************************************************/ - -char -AcpiUtHexToAsciiChar ( - UINT64 Integer, - UINT32 Position) -{ - - return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); -} - /****************************************************************************** * @@ -386,451 +272,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, }; -/******************************************************************************* - * - * FUNCTION: AcpiUtGetRegionName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Space ID into a name string (Debug only) - * - ******************************************************************************/ - -/* Region type decoding */ - -const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = -{ - "SystemMemory", - "SystemIO", - "PCI_Config", - "EmbeddedControl", - "SMBus", - "SystemCMOS", - "PCIBARTarget", - "IPMI", - "DataTable" -}; - - -char * -AcpiUtGetRegionName ( - UINT8 SpaceId) -{ - - if (SpaceId >= ACPI_USER_REGION_BEGIN) - { - return ("UserDefinedRegion"); - } - else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) - { - return ("InvalidSpaceId"); - } - - return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId])); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetEventName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Event ID into a name string (Debug only) - * - ******************************************************************************/ - -/* Event type decoding */ - -static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = -{ - "PM_Timer", - "GlobalLock", - "PowerButton", - "SleepButton", - "RealTimeClock", -}; - - -char * -AcpiUtGetEventName ( - UINT32 EventId) -{ - - if (EventId > ACPI_EVENT_MAX) - { - return ("InvalidEventID"); - } - - return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId])); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetTypeName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Type ID into a name string (Debug only) - * - ******************************************************************************/ - -/* - * Elements of AcpiGbl_NsTypeNames below must match - * one-to-one with values of ACPI_OBJECT_TYPE - * - * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; - * when stored in a table it really means that we have thus far seen no - * evidence to indicate what type is actually going to be stored for this entry. - */ -static const char AcpiGbl_BadType[] = "UNDEFINED"; - -/* Printable names of the ACPI object types */ - -static const char *AcpiGbl_NsTypeNames[] = -{ - /* 00 */ "Untyped", - /* 01 */ "Integer", - /* 02 */ "String", - /* 03 */ "Buffer", - /* 04 */ "Package", - /* 05 */ "FieldUnit", - /* 06 */ "Device", - /* 07 */ "Event", - /* 08 */ "Method", - /* 09 */ "Mutex", - /* 10 */ "Region", - /* 11 */ "Power", - /* 12 */ "Processor", - /* 13 */ "Thermal", - /* 14 */ "BufferField", - /* 15 */ "DdbHandle", - /* 16 */ "DebugObject", - /* 17 */ "RegionField", - /* 18 */ "BankField", - /* 19 */ "IndexField", - /* 20 */ "Reference", - /* 21 */ "Alias", - /* 22 */ "MethodAlias", - /* 23 */ "Notify", - /* 24 */ "AddrHandler", - /* 25 */ "ResourceDesc", - /* 26 */ "ResourceFld", - /* 27 */ "Scope", - /* 28 */ "Extra", - /* 29 */ "Data", - /* 30 */ "Invalid" -}; - - -char * -AcpiUtGetTypeName ( - ACPI_OBJECT_TYPE Type) -{ - - if (Type > ACPI_TYPE_INVALID) - { - return (ACPI_CAST_PTR (char, AcpiGbl_BadType)); - } - - return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type])); -} - - -char * -AcpiUtGetObjectTypeName ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - - if (!ObjDesc) - { - return ("[NULL Object Descriptor]"); - } - - return (AcpiUtGetTypeName (ObjDesc->Common.Type)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetNodeName - * - * PARAMETERS: Object - A namespace node - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Validate the node and return the node's ACPI name. - * - ******************************************************************************/ - -char * -AcpiUtGetNodeName ( - void *Object) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; - - - /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ - - if (!Object) - { - return ("NULL"); - } - - /* Check for Root node */ - - if ((Object == ACPI_ROOT_OBJECT) || - (Object == AcpiGbl_RootNode)) - { - return ("\"\\\" "); - } - - /* Descriptor must be a namespace node */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - return ("####"); - } - - /* - * Ensure name is valid. The name was validated/repaired when the node - * was created, but make sure it has not been corrupted. - */ - AcpiUtRepairName (Node->Name.Ascii); - - /* Return the name */ - - return (Node->Name.Ascii); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetDescriptorName - * - * PARAMETERS: Object - An ACPI object - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Validate object and return the descriptor type - * - ******************************************************************************/ - -/* Printable names of object descriptor types */ - -static const char *AcpiGbl_DescTypeNames[] = -{ - /* 00 */ "Not a Descriptor", - /* 01 */ "Cached", - /* 02 */ "State-Generic", - /* 03 */ "State-Update", - /* 04 */ "State-Package", - /* 05 */ "State-Control", - /* 06 */ "State-RootParseScope", - /* 07 */ "State-ParseScope", - /* 08 */ "State-WalkScope", - /* 09 */ "State-Result", - /* 10 */ "State-Notify", - /* 11 */ "State-Thread", - /* 12 */ "Walk", - /* 13 */ "Parser", - /* 14 */ "Operand", - /* 15 */ "Node" -}; - - -char * -AcpiUtGetDescriptorName ( - void *Object) -{ - - if (!Object) - { - return ("NULL OBJECT"); - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) - { - return ("Not a Descriptor"); - } - - return (ACPI_CAST_PTR (char, - AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)])); - -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetReferenceName - * - * PARAMETERS: Object - An ACPI reference object - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Decode a reference object sub-type to a string. - * - ******************************************************************************/ - -/* Printable names of reference object sub-types */ - -static const char *AcpiGbl_RefClassNames[] = -{ - /* 00 */ "Local", - /* 01 */ "Argument", - /* 02 */ "RefOf", - /* 03 */ "Index", - /* 04 */ "DdbHandle", - /* 05 */ "Named Object", - /* 06 */ "Debug" -}; - -const char * -AcpiUtGetReferenceName ( - ACPI_OPERAND_OBJECT *Object) -{ - - if (!Object) - { - return ("NULL Object"); - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) - { - return ("Not an Operand object"); - } - - if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) - { - return ("Not a Reference object"); - } - - if (Object->Reference.Class > ACPI_REFCLASS_MAX) - { - return ("Unknown Reference class"); - } - - return (AcpiGbl_RefClassNames[Object->Reference.Class]); -} - - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -/* - * Strings and procedures used for debug only - */ - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetMutexName - * - * PARAMETERS: MutexId - The predefined ID for this mutex. - * - * RETURN: String containing the name of the mutex. Always returns a valid - * pointer. - * - * DESCRIPTION: Translate a mutex ID into a name string (Debug only) - * - ******************************************************************************/ - -char * -AcpiUtGetMutexName ( - UINT32 MutexId) -{ - - if (MutexId > ACPI_MAX_MUTEX) - { - return ("Invalid Mutex ID"); - } - - return (AcpiGbl_MutexNames[MutexId]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetNotifyName - * - * PARAMETERS: NotifyValue - Value from the Notify() request - * - * RETURN: String corresponding to the Notify Value. - * - * DESCRIPTION: Translate a Notify Value to a notify namestring. - * - ******************************************************************************/ - -/* Names for Notify() values, used for debug output */ - -static const char *AcpiGbl_NotifyValueNames[] = -{ - "Bus Check", - "Device Check", - "Device Wake", - "Eject Request", - "Device Check Light", - "Frequency Mismatch", - "Bus Mode Mismatch", - "Power Fault", - "Capabilities Check", - "Device PLD Check", - "Reserved", - "System Locality Update" -}; - -const char * -AcpiUtGetNotifyName ( - UINT32 NotifyValue) -{ - - if (NotifyValue <= ACPI_NOTIFY_MAX) - { - return (AcpiGbl_NotifyValueNames[NotifyValue]); - } - else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) - { - return ("Reserved"); - } - else /* Greater or equal to 0x80 */ - { - return ("**Device Specific**"); - } -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidObjectType - * - * PARAMETERS: Type - Object type to be validated - * - * RETURN: TRUE if valid object type, FALSE otherwise - * - * DESCRIPTION: Validate an object type - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidObjectType ( - ACPI_OBJECT_TYPE Type) -{ - - if (Type > ACPI_TYPE_LOCAL_MAX) - { - /* Note: Assumes all TYPEs are contiguous (external/local) */ - - return (FALSE); - } - - return (TRUE); -} - /******************************************************************************* * @@ -840,7 +281,7 @@ AcpiUtValidObjectType ( * * RETURN: Status * - * DESCRIPTION: Init library globals. All globals that require specific + * DESCRIPTION: Init ACPICA globals. All globals that require specific * initialization should be initialized here! * ******************************************************************************/ @@ -895,6 +336,7 @@ AcpiUtInitGlobals ( /* GPE support */ + AcpiGbl_AllGpesInitialized = FALSE; AcpiGbl_GpeXruptListHead = NULL; AcpiGbl_GpeFadtBlocks[0] = NULL; AcpiGbl_GpeFadtBlocks[1] = NULL; @@ -908,6 +350,7 @@ AcpiUtInitGlobals ( AcpiGbl_InitHandler = NULL; AcpiGbl_TableHandler = NULL; AcpiGbl_InterfaceHandler = NULL; + AcpiGbl_GlobalEventHandler = NULL; /* Global Lock support */ @@ -935,6 +378,7 @@ AcpiUtInitGlobals ( AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; AcpiGbl_OsiData = 0; AcpiGbl_OsiMutex = NULL; + AcpiGbl_RegMethodsExecuted = FALSE; /* Hardware oriented */ @@ -977,5 +421,3 @@ ACPI_EXPORT_SYMBOL (AcpiDbgLevel) ACPI_EXPORT_SYMBOL (AcpiDbgLayer) ACPI_EXPORT_SYMBOL (AcpiGpeCount) ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount) - - diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c index 4b52fe4341..c24541da86 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c index 4cb083bd7a..9e06711f47 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utlock.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utlock.c index e17ca3e7d7..6e68ec0043 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utlock.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utlock.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c index 90f3cd58cc..5c6d20e3c9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c index 1867a31fa9..d379a220d3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c index 92a95e15af..01a2422e93 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c index 0a9f1e7f6f..f62ebe01a8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c index 26d143260a..2b64d674b2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c index 02bb1dbfe6..a6b6d9c810 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c index 08218d11c9..c23c701787 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c b/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c index 38dba03ad8..f5599b792f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c index 9e520174f1..d65c8210e1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -411,27 +411,6 @@ AcpiInitializeObjects ( } } - /* - * Initialize the GPE blocks defined in the FADT (GPE block 0 and 1). - * The runtime GPEs are enabled here. - * - * This is where the _PRW methods are executed for the GPEs. These - * methods can only be executed after the SCI and Global Lock handlers are - * installed and initialized. - * - * GPEs can only be enabled after the _REG, _STA, and _INI methods have - * been run. This ensures that all Operation Regions and all Devices have - * been initialized and are ready. - */ - if (!(Flags & ACPI_NO_EVENT_INIT)) - { - Status = AcpiEvInstallFadtGpes (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - /* * Empty the caches (delete the cached objects) on the assumption that * the table load filled them up more than they will be at runtime -- diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c index b397a40c2a..60e6217135 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License From 45f2f22b5250a7be9cdb0a82dee2ca91aaa8398d Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 18 Aug 2011 22:13:06 +0000 Subject: [PATCH 186/702] * update (not-so-)optional package ICU to 4.8.1, which contains interesting stuff for message formatting * adjust LocaleKit to use namespace 'icu', as ICU has been configured to no longer use a version specific namespace * adjust LocaleKit to general API changes in ICU 4.8 Note: all software using ICU (like WebPositive) needs to be rebuilt! Note: the ICU package for PPC needs to be updated before it can be used! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42638 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalBuildFeatures | 29 ++++++++++++------- headers/os/locale/Collator.h | 6 ++-- headers/os/locale/Country.h | 6 ++-- headers/os/locale/DurationFormat.h | 6 ++-- headers/os/locale/FormattingConventions.h | 6 ++-- headers/os/locale/Language.h | 4 +-- headers/os/locale/Locale.h | 8 ++--- headers/os/locale/TimeUnitFormat.h | 6 ++-- headers/os/locale/TimeZone.h | 8 ++--- .../locale/FormattingConventionsPrivate.h | 4 +-- headers/private/locale/LanguagePrivate.h | 4 +-- headers/private/locale/TimeZonePrivate.h | 4 +-- src/kits/locale/Country.cpp | 7 ++--- src/kits/locale/FormattingConventions.cpp | 11 +++---- src/kits/locale/Language.cpp | 5 +--- src/kits/locale/Locale.cpp | 28 +++++++++--------- src/preferences/time/ZoneView.cpp | 3 +- .../libroot/add-ons/icu/ICUNumericData.cpp | 3 +- 18 files changed, 72 insertions(+), 76 deletions(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index 122163e9f8..c74bcd3cea 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -56,10 +56,12 @@ if $(HAIKU_BUILD_FEATURE_SSL) { # ICU # Note ICU isn't actually optional, but is still an external package -HAIKU_ICU_GCC_2_PACKAGE = icu-4.4.1-r1a3-x86-gcc2-2011-05-29.zip ; -HAIKU_ICU_GCC_4_PACKAGE = icu-4.4.1-r1a3-x86-gcc4-2011-05-29.zip ; +HAIKU_ICU_GCC_2_PACKAGE = icu-4.8.1-x86-gcc2-2011-08-18.zip ; +HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1-x86-gcc4-2011-08-18.zip ; +HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-2011-08-18.zip ; + +# TODO: this needs to be upgraded before ICU can be used on PPC! HAIKU_ICU_PPC_PACKAGE = icu-4.4.1-ppc-2010-08-17.zip ; -HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.4.1-2010-07-26.zip ; if $(TARGET_ARCH) = ppc { local icu_package = $(HAIKU_ICU_PPC_PACKAGE) ; @@ -105,13 +107,20 @@ if $(TARGET_ARCH) = ppc { # extract libraries HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR) : - libicudata.so.44 - libicui18n.so.44 - libicuio.so.44 - libicule.so.44 - libiculx.so.44 - libicutu.so.44 - libicuuc.so.44 + libicudata.so.48 + libicudata.so.48.1 + libicui18n.so.48 + libicui18n.so.48.1 + libicuio.so.48 + libicuio.so.48.1 + libicule.so.48 + libicule.so.48.1 + libiculx.so.48 + libiculx.so.48.1 + libicutu.so.48 + libicutu.so.48.1 + libicuuc.so.48 + libicuuc.so.48.1 : $(zipFile) : extracted-icu ] ; diff --git a/headers/os/locale/Collator.h b/headers/os/locale/Collator.h index 3b8c2fd8ad..6f818e68f6 100644 --- a/headers/os/locale/Collator.h +++ b/headers/os/locale/Collator.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010, Haiku, Inc. + * Copyright 2003-2011, Haiku, Inc. * Distributed under the terms of the MIT Licence. */ #ifndef _COLLATOR_H_ @@ -10,7 +10,7 @@ #include -namespace icu_44 { +namespace icu { class Collator; class RuleBasedCollator; }; @@ -75,7 +75,7 @@ public: private: status_t _SetStrength(int8 strength) const; - mutable icu_44::Collator* fICUCollator; + mutable icu::Collator* fICUCollator; int8 fDefaultStrength; bool fIgnorePunctuation; }; diff --git a/headers/os/locale/Country.h b/headers/os/locale/Country.h index 6488a1a973..e8e9c92a21 100644 --- a/headers/os/locale/Country.h +++ b/headers/os/locale/Country.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010, Haiku, Inc. + * Copyright 2003-2011, Haiku, Inc. * Distributed under the terms of the MIT Licence. */ #ifndef _COUNTRY_H_ @@ -16,7 +16,7 @@ class BBitmap; class BLanguage; class BMessage; -namespace icu_44 { +namespace icu { class DateFormat; class Locale; } @@ -45,7 +45,7 @@ public: private: friend class Private; - icu_44::Locale* fICULocale; + icu::Locale* fICULocale; }; diff --git a/headers/os/locale/DurationFormat.h b/headers/os/locale/DurationFormat.h index 0c8aa88a0b..46cda47ad5 100644 --- a/headers/os/locale/DurationFormat.h +++ b/headers/os/locale/DurationFormat.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Haiku, Inc. + * Copyright 2010-2011, Haiku, Inc. * Distributed under the terms of the MIT License. */ #ifndef _B_DURATION_FORMAT_H_ @@ -13,7 +13,7 @@ class BTimeZone; -namespace icu_44 { +namespace icu { class GregorianCalendar; } @@ -42,7 +42,7 @@ public: private: BString fSeparator; BTimeUnitFormat fTimeUnitFormat; - icu_44::GregorianCalendar* fCalendar; + icu::GregorianCalendar* fCalendar; }; diff --git a/headers/os/locale/FormattingConventions.h b/headers/os/locale/FormattingConventions.h index 035442993e..5c2e196da4 100644 --- a/headers/os/locale/FormattingConventions.h +++ b/headers/os/locale/FormattingConventions.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010, Haiku, Inc. + * Copyright 2003-2011, Haiku, Inc. * Distributed under the terms of the MIT Licence. */ #ifndef _FORMATTING_CONVENTIONS_H_ @@ -17,7 +17,7 @@ class BBitmap; class BLanguage; class BMessage; -namespace icu_44 { +namespace icu { class DateFormat; class Locale; } @@ -122,7 +122,7 @@ private: bool fUseStringsFromPreferredLanguage; - icu_44::Locale* fICULocale; + icu::Locale* fICULocale; }; diff --git a/headers/os/locale/Language.h b/headers/os/locale/Language.h index 15ac380e11..133e798c8f 100644 --- a/headers/os/locale/Language.h +++ b/headers/os/locale/Language.h @@ -15,7 +15,7 @@ class BBitmap; // We must not include the icu headers in there as it could mess up binary // compatibility. -namespace icu_44 { +namespace icu { class Locale; } @@ -64,7 +64,7 @@ private: friend class Private; uint8 fDirection; - icu_44::Locale* fICULocale; + icu::Locale* fICULocale; }; diff --git a/headers/os/locale/Locale.h b/headers/os/locale/Locale.h index 77b7c58a9d..7aad721312 100644 --- a/headers/os/locale/Locale.h +++ b/headers/os/locale/Locale.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010, Haiku, Inc. + * Copyright 2003-2011, Haiku, Inc. * Distributed under the terms of the MIT License. */ #ifndef _B_LOCALE_H_ @@ -12,7 +12,7 @@ #include -namespace icu_44 { +namespace icu { class DateFormat; } @@ -145,9 +145,9 @@ public: BString* sortKey) const; private: - icu_44::DateFormat* _CreateDateFormatter( + icu::DateFormat* _CreateDateFormatter( const BString& format) const; - icu_44::DateFormat* _CreateTimeFormatter( + icu::DateFormat* _CreateTimeFormatter( const BString& format) const; mutable BLocker fLock; diff --git a/headers/os/locale/TimeUnitFormat.h b/headers/os/locale/TimeUnitFormat.h index 8837bf90c4..92be2a833a 100644 --- a/headers/os/locale/TimeUnitFormat.h +++ b/headers/os/locale/TimeUnitFormat.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Haiku, Inc. + * Copyright 2010-2011, Haiku, Inc. * Distributed under the terms of the MIT License. */ #ifndef _B_TIME_UNIT_FORMAT_H_ @@ -12,7 +12,7 @@ class BString; -namespace icu_44 { +namespace icu { class TimeUnitFormat; } @@ -53,7 +53,7 @@ public: ) const; private: - icu_44::TimeUnitFormat* fFormatter; + icu::TimeUnitFormat* fFormatter; }; diff --git a/headers/os/locale/TimeZone.h b/headers/os/locale/TimeZone.h index 4fca971d05..28513d888b 100644 --- a/headers/os/locale/TimeZone.h +++ b/headers/os/locale/TimeZone.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Haiku, Inc. All rights reserved. + * Copyright 2010-2011, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _TIME_ZONE_H @@ -9,7 +9,7 @@ #include -namespace icu_44 { +namespace icu { class Locale; class TimeZone; } @@ -46,8 +46,8 @@ public: private: friend class Private; - icu_44::TimeZone* fICUTimeZone; - icu_44::Locale* fICULocale; + icu::TimeZone* fICUTimeZone; + icu::Locale* fICULocale; status_t fInitStatus; mutable uint32 fInitializedFields; diff --git a/headers/private/locale/FormattingConventionsPrivate.h b/headers/private/locale/FormattingConventionsPrivate.h index 881ac43031..9200c7b5ac 100644 --- a/headers/private/locale/FormattingConventionsPrivate.h +++ b/headers/private/locale/FormattingConventionsPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Oliver Tappe + * Copyright 2010-2011, Oliver Tappe * Distributed under the terms of the MIT License. */ #ifndef _FORMATTING_CONVENTIONS_PRIVATE_H @@ -23,7 +23,7 @@ public: fFormattingConventions = conventions; } - icu_44::Locale* + icu::Locale* ICULocale() { return fFormattingConventions->fICULocale; diff --git a/headers/private/locale/LanguagePrivate.h b/headers/private/locale/LanguagePrivate.h index bea1417755..7bdaf876b8 100644 --- a/headers/private/locale/LanguagePrivate.h +++ b/headers/private/locale/LanguagePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Oliver Tappe + * Copyright 2010-2011, Oliver Tappe * Distributed under the terms of the MIT License. */ #ifndef _LANGUAGE_PRIVATE_H @@ -23,7 +23,7 @@ public: fLanguage = language; } - icu_44::Locale* + icu::Locale* ICULocale() { return fLanguage->fICULocale; diff --git a/headers/private/locale/TimeZonePrivate.h b/headers/private/locale/TimeZonePrivate.h index a4ec4eb292..e6f6c1c317 100644 --- a/headers/private/locale/TimeZonePrivate.h +++ b/headers/private/locale/TimeZonePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Oliver Tappe + * Copyright 2010-2011, Oliver Tappe * Distributed under the terms of the MIT License. */ #ifndef _TIME_ZONE_PRIVATE_H @@ -23,7 +23,7 @@ public: fTimeZone = timeZone; } - icu_44::TimeZone* + icu::TimeZone* ICUTimeZone() { return fTimeZone->fICUTimeZone; diff --git a/src/kits/locale/Country.cpp b/src/kits/locale/Country.cpp index 235ed2bcd8..8b67c9e743 100644 --- a/src/kits/locale/Country.cpp +++ b/src/kits/locale/Country.cpp @@ -27,19 +27,16 @@ #include -#define ICU_VERSION icu_44 - - BCountry::BCountry(const char* countryCode) : - fICULocale(new ICU_VERSION::Locale("", countryCode)) + fICULocale(new icu::Locale("", countryCode)) { } BCountry::BCountry(const BCountry& other) : - fICULocale(new ICU_VERSION::Locale(*other.fICULocale)) + fICULocale(new icu::Locale(*other.fICULocale)) { } diff --git a/src/kits/locale/FormattingConventions.cpp b/src/kits/locale/FormattingConventions.cpp index a53c5c0a93..1df6952de6 100644 --- a/src/kits/locale/FormattingConventions.cpp +++ b/src/kits/locale/FormattingConventions.cpp @@ -1,7 +1,7 @@ /* * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009-2010, Adrien Destugues, pulkomandy@gmail.com. - * Copyright 2010, Oliver Tappe . + * Copyright 2010-2011, Oliver Tappe . * Distributed under the terms of the MIT License. */ @@ -32,9 +32,6 @@ #include -#define ICU_VERSION icu_44 - - // #pragma mark - helpers @@ -191,7 +188,7 @@ BFormattingConventions::BFormattingConventions(const char* id) fCachedUse24HourClock(CLOCK_HOURS_UNSET), fExplicitUse24HourClock(CLOCK_HOURS_UNSET), fUseStringsFromPreferredLanguage(false), - fICULocale(new ICU_VERSION::Locale(id)) + fICULocale(new icu::Locale(id)) { } @@ -206,7 +203,7 @@ BFormattingConventions::BFormattingConventions( fExplicitMonetaryFormat(other.fExplicitMonetaryFormat), fExplicitUse24HourClock(other.fExplicitUse24HourClock), fUseStringsFromPreferredLanguage(other.fUseStringsFromPreferredLanguage), - fICULocale(new ICU_VERSION::Locale(*other.fICULocale)) + fICULocale(new icu::Locale(*other.fICULocale)) { for (int s = 0; s < B_DATE_FORMAT_STYLE_COUNT; ++s) fCachedDateFormats[s] = other.fCachedDateFormats[s]; @@ -227,7 +224,7 @@ BFormattingConventions::BFormattingConventions(const BMessage* archive) { BString conventionsID; status_t status = archive->FindString("conventions", &conventionsID); - fICULocale = new ICU_VERSION::Locale(conventionsID); + fICULocale = new icu::Locale(conventionsID); for (int s = 0; s < B_DATE_FORMAT_STYLE_COUNT && status == B_OK; ++s) { BString format; diff --git a/src/kits/locale/Language.cpp b/src/kits/locale/Language.cpp index 919c0b7a8c..1b140c7f48 100644 --- a/src/kits/locale/Language.cpp +++ b/src/kits/locale/Language.cpp @@ -25,9 +25,6 @@ #include -#define ICU_VERSION icu_44 - - BLanguage::BLanguage() : fDirection(B_LEFT_TO_RIGHT), @@ -64,7 +61,7 @@ status_t BLanguage::SetTo(const char* language) { delete fICULocale; - fICULocale = new ICU_VERSION::Locale(language); + fICULocale = new icu::Locale(language); if (fICULocale == NULL) return B_NO_MEMORY; diff --git a/src/kits/locale/Locale.cpp b/src/kits/locale/Locale.cpp index 2b0208bed0..3ad0dfce80 100644 --- a/src/kits/locale/Locale.cpp +++ b/src/kits/locale/Locale.cpp @@ -1,6 +1,6 @@ /* ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. -** Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de. +** Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de. ** All rights reserved. Distributed under the terms of the OpenBeOS License. */ @@ -16,6 +16,8 @@ #include #include +#include + #include #include #include @@ -23,14 +25,10 @@ #include #include #include -#include #include -#define ICU_VERSION icu_44 - - using BPrivate::ObjectDeleter; using BPrivate::B_WEEK_START_MONDAY; using BPrivate::B_WEEK_START_SUNDAY; @@ -268,7 +266,7 @@ BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount, fieldPositions = NULL; UErrorCode error = U_ZERO_ERROR; - ICU_VERSION::FieldPositionIterator positionIterator; + icu::FieldPositionIterator positionIterator; UnicodeString icuString; dateFormatter->format((UDate)time * 1000, icuString, &positionIterator, error); @@ -276,7 +274,7 @@ BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount, if (error != U_ZERO_ERROR) return B_ERROR; - ICU_VERSION::FieldPosition field; + icu::FieldPosition field; std::vector fieldPosStorage; fieldCount = 0; while (positionIterator.next(field)) { @@ -315,7 +313,7 @@ BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, fields = NULL; UErrorCode error = U_ZERO_ERROR; - ICU_VERSION::FieldPositionIterator positionIterator; + icu::FieldPositionIterator positionIterator; UnicodeString icuString; time_t now; dateFormatter->format((UDate)time(&now) * 1000, icuString, @@ -324,7 +322,7 @@ BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, if (U_FAILURE(error)) return B_ERROR; - ICU_VERSION::FieldPosition field; + icu::FieldPosition field; std::vector fieldPosStorage; fieldCount = 0; while (positionIterator.next(field)) { @@ -534,7 +532,7 @@ BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount, fieldPositions = NULL; UErrorCode error = U_ZERO_ERROR; - ICU_VERSION::FieldPositionIterator positionIterator; + icu::FieldPositionIterator positionIterator; UnicodeString icuString; timeFormatter->format((UDate)time * 1000, icuString, &positionIterator, error); @@ -542,7 +540,7 @@ BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount, if (error != U_ZERO_ERROR) return B_ERROR; - ICU_VERSION::FieldPosition field; + icu::FieldPosition field; std::vector fieldPosStorage; fieldCount = 0; while (positionIterator.next(field)) { @@ -580,7 +578,7 @@ BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount, fields = NULL; UErrorCode error = U_ZERO_ERROR; - ICU_VERSION::FieldPositionIterator positionIterator; + icu::FieldPositionIterator positionIterator; UnicodeString icuString; time_t now; timeFormatter->format((UDate)time(&now) * 1000, icuString, @@ -589,7 +587,7 @@ BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount, if (error != U_ZERO_ERROR) return B_ERROR; - ICU_VERSION::FieldPosition field; + icu::FieldPosition field; std::vector fieldPosStorage; fieldCount = 0; while (positionIterator.next(field)) { @@ -651,7 +649,7 @@ BLocale::FormatNumber(BString* string, double value) const UErrorCode err = U_ZERO_ERROR; ObjectDeleter numberFormatter(NumberFormat::createInstance( *BFormattingConventions::Private(&fConventions).ICULocale(), - NumberFormat::kNumberStyle, err)); + UNUM_DECIMAL, err)); if (numberFormatter.Get() == NULL) return B_NO_MEMORY; @@ -691,7 +689,7 @@ BLocale::FormatNumber(BString* string, int32 value) const UErrorCode err = U_ZERO_ERROR; ObjectDeleter numberFormatter(NumberFormat::createInstance( *BFormattingConventions::Private(&fConventions).ICULocale(), - NumberFormat::kNumberStyle, err)); + UNUM_DECIMAL, err)); if (numberFormatter.Get() == NULL) return B_NO_MEMORY; diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index 065053cea5..d8b59e9eec 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -316,7 +316,7 @@ TimeZoneView::_BuildZoneMenu() BString region(zoneID, slashPos); - if (region == B_TRANSLATE("Etc")) + if (region == "Etc") region = kOtherRegion; else if (countryName.Length() == 0) { // skip global timezones from other regions, we are just @@ -324,7 +324,6 @@ TimeZoneView::_BuildZoneMenu() continue; } - // just accept timezones from "proper" regions, others are aliases ZoneItemMap::iterator regionIter = zoneMap.find(region); if (regionIter == zoneMap.end()) diff --git a/src/system/libroot/add-ons/icu/ICUNumericData.cpp b/src/system/libroot/add-ons/icu/ICUNumericData.cpp index 1612c99435..85bec2d9b2 100644 --- a/src/system/libroot/add-ons/icu/ICUNumericData.cpp +++ b/src/system/libroot/add-ons/icu/ICUNumericData.cpp @@ -44,8 +44,7 @@ ICUNumericData::SetTo(const Locale& locale, const char* posixLocaleName) if (result == B_OK) { UErrorCode icuStatus = U_ZERO_ERROR; DecimalFormat* numberFormat = dynamic_cast( - NumberFormat::createInstance(locale, DecimalFormat::kNumberStyle, - icuStatus)); + NumberFormat::createInstance(locale, UNUM_DECIMAL, icuStatus)); if (!U_SUCCESS(icuStatus)) return B_UNSUPPORTED; if (!numberFormat) From e45efadaad2eaf0effb3d521d4c0e092cbdbc229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 19 Aug 2011 12:08:57 +0000 Subject: [PATCH 187/702] Complete the SCREENINFO structure definition; expose a single version of the Setscreen() calls, since they are just the same with magic values and extra args anyway. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42639 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/atari_m68k/toscalls.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/system/boot/platform/atari_m68k/toscalls.h b/src/system/boot/platform/atari_m68k/toscalls.h index ca2d04ae9f..0ede8ff961 100644 --- a/src/system/boot/platform/atari_m68k/toscalls.h +++ b/src/system/boot/platform/atari_m68k/toscalls.h @@ -442,10 +442,17 @@ typedef struct screeninfo { int32 planeWrap; int32 scrFormat; int32 scrClut; - /* int32 redBits; - ... - */ + int32 greenBits; + int32 blueBits; + int32 alphaBits; + int32 genlockBits; + int32 unusedBits; + int32 bitFlags; + int32 maxmem; + int32 pagemem; + int32 max_x; + int32 max_y; } SCREENINFO; @@ -456,8 +463,7 @@ typedef struct screeninfo { #define Physbase() (void *)toscallV(XBIOS_TRAP, 2) #define Logbase() (void *)toscallV(XBIOS_TRAP, 3) #define Getrez() toscallV(XBIOS_TRAP, 4) -#define Setscreen(log, phys, mode) toscallPPWW(XBIOS_TRAP, 5, (void *)log, (void *)phys, (int16)mode, (int16)0) -#define SetscreenM(log, phys, command) toscallPPWW(XBIOS_TRAP, 5, (void *)log, (void *)phys, (int16)MI_MAGIC, (int16)command) +#define Setscreen(log, phys, mode, command) toscallPPWW(XBIOS_TRAP, 5, (void *)log, (void *)phys, (int16)mode, (int16)command) #define VsetScreen(log, phys, mode, modecode) toscallPPWW(XBIOS_TRAP, 5, (void *)log, (void *)phys, (int16)mode, (int16)modecode) #define Floprd(buf, dummy, dev, sect, track, side, count) toscallPLWWWWW(XBIOS_TRAP, 8, (void *)buf, (int32)dummy, (int16)dev, (int16)sect, (int16)track, (int16)side, (int16)count) //#define Mfpint() toscallV(XBIOS_TRAP, 13, ) From f62ad34221ac5836c90077df84f8b9420a30be64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 19 Aug 2011 12:12:22 +0000 Subject: [PATCH 188/702] Add support for enumerating video modes using the Milan API and the ST/TT XBIOS calls. Not really tested, ARAnyM doesn't emulate the Milan stuff, and the ST resolutions aren't exactly chunky anyway (will need patching the framebuffer kernel args to include the mode/4CC instead of just bit depth). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42640 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/atari_m68k/video.cpp | 425 +++++++++++++++++- 1 file changed, 421 insertions(+), 4 deletions(-) diff --git a/src/system/boot/platform/atari_m68k/video.cpp b/src/system/boot/platform/atari_m68k/video.cpp index 7a225ecdf5..402bd2f83c 100644 --- a/src/system/boot/platform/atari_m68k/video.cpp +++ b/src/system/boot/platform/atari_m68k/video.cpp @@ -25,7 +25,7 @@ #include -//#define TRACE_VIDEO +#define TRACE_VIDEO #ifdef TRACE_VIDEO # define TRACE(x) dprintf x #else @@ -204,6 +204,202 @@ ModeOps::MakeLabel(const struct video_mode *mode, char *label, size_t len) } +// #pragma mark - ST/TT XBIOS API + +class STModeOps : public ModeOps { +public: + STModeOps() : ModeOps("ST/TT") {}; + ~STModeOps() {}; + virtual status_t Init(); + + virtual status_t Enumerate(); + virtual status_t Decode(int16 id, struct video_mode *mode); + virtual status_t Get(struct video_mode *mode); + virtual status_t Set(const struct video_mode *mode); + virtual status_t Unset(const struct video_mode *mode); + + virtual status_t SetPalette(const struct video_mode *mode, + const uint8 *palette); + virtual addr_t Framebuffer(); + virtual void MakeLabel(const struct video_mode *mode, + char *label, size_t len); +private: + static int16 fPreviousMode; + static bool fIsTT; +}; + + +int16 STModeOps::fPreviousMode = -1; +bool STModeOps::fIsTT = false; + + +status_t +STModeOps::Init() +{ + const tos_cookie *c = tos_find_cookie('_VDO'); + if (c == NULL) + return ENODEV; + if (c->ivalue >> 16 < 1) + return ENODEV; + if (c->ivalue >= 2) + fIsTT = true; + fInitStatus = B_OK; + return fInitStatus; +} + + + +status_t +STModeOps::Enumerate() +{ + if (fInitStatus < B_OK) + return fInitStatus; + + static int16 modes[] = { 0, /*TT:*/ 4, 7 }; + for (int i = 0; i < sizeof(modes) / sizeof(int16); i++) { + if (!fIsTT && i > 0) + break; + + video_mode *videoMode = AllocMode(); + if (videoMode == NULL) + continue; + + if (Decode(modes[i], videoMode) != B_OK) + continue; + add_video_mode(videoMode); + + } + return B_OK; + +#if 0 + // TODO: use TT video monitor detection and build possible mode list there... + return ENODEV; +#endif +} + + +status_t +STModeOps::Decode(int16 id, struct video_mode *mode) +{ + mode->ops = this; + mode->mode = id; + + switch (id) { + case 0: + mode->width = 320; + mode->height = 200; + mode->bits_per_pixel = 4; + break; + case 4: + mode->width = 640; + mode->height = 480; + mode->bits_per_pixel = 4; + break; + case 7: + mode->width = 320; + mode->height = 480; + mode->bits_per_pixel = 8; + break; + default: + mode->bits_per_pixel = 0; + break; + } + + mode->bytes_per_row = mode->width * mode->bits_per_pixel / 8; + return B_OK; +} + + +status_t +STModeOps::Get(struct video_mode *mode) +{ + if (fInitStatus < B_OK) + return fInitStatus; + + int16 m = Getrez(); + return Decode(m, mode); +} + + +status_t +STModeOps::Set(const struct video_mode *mode) +{ + if (fInitStatus < B_OK) + return fInitStatus; + if (mode == NULL) + return B_BAD_VALUE; + + fPreviousMode = Getrez(); + +#warning M68K: FIXME: allocate framebuffer + dprintf("Switching to mode 0x%04x\n", mode->mode); + //VsetScreen(((uint32)0x00d00000), ((uint32)0x00d00000), 3, mode->mode); + Setscreen(-1, -1, mode->mode, 0); + if (Getrez() != mode->mode) { + dprintf("failed to set mode %d. Current is %d\n", mode->mode, fPreviousMode); + fPreviousMode = -1; + } + + return B_OK; +} + + +status_t +STModeOps::Unset(const struct video_mode *mode) +{ + if (fInitStatus < B_OK) + return fInitStatus; + + if (fPreviousMode != -1) { + dprintf("Reverting to mode 0x%04x\n", fPreviousMode); + Setscreen(-1, -1, fPreviousMode, 0); + fPreviousMode = -1; + } + + return B_OK; +} + + +status_t +STModeOps::SetPalette(const struct video_mode *mode, const uint8 *palette) +{ + switch (mode->bits_per_pixel) { + case 4: + //VsetRGB(0, 16, palette); + //XXX: Use ESet* + break; + case 8: + //VsetRGB(0, 256, palette); + //XXX: Use ESet* + break; + default: + break; + } +} + + +addr_t +STModeOps::Framebuffer() +{ + addr_t fb = (addr_t)Physbase(); + return fb; +} + + +void +STModeOps::MakeLabel(const struct video_mode *mode, char *label, + size_t len) +{ + ModeOps::MakeLabel(mode, label, len); + label += strlen(label); + // XXX no len check + sprintf(label, " 0x%04x", mode->mode); +} + + +static STModeOps sSTModeOps; + + // #pragma mark - Falcon XBIOS API class FalconModeOps : public ModeOps { @@ -345,7 +541,9 @@ FalconModeOps::Set(const struct video_mode *mode) #warning M68K: FIXME: allocate framebuffer dprintf("Switching to mode 0x%04x\n", mode->mode); - VsetScreen(((uint32)0x00d00000), ((uint32)0x00d00000), 3, mode->mode); + //VsetScreen(((uint32)0x00d00000), ((uint32)0x00d00000), 3, mode->mode); + VsetScreen(((uint32)0x00c00000), ((uint32)0x00c00000), 3, mode->mode); + //VsetScreen(((uint32)-1), ((uint32)-1), 3, mode->mode); return B_OK; } @@ -412,6 +610,221 @@ FalconModeOps::MakeLabel(const struct video_mode *mode, char *label, static FalconModeOps sFalconModeOps; +// #pragma mark - Milan XBIOS API + +class MilanModeOps : public ModeOps { +public: + MilanModeOps() : ModeOps("Milan") {}; + ~MilanModeOps() {}; + virtual status_t Init(); + + virtual status_t Enumerate(); + virtual status_t Decode(int16 id, struct video_mode *mode); + virtual status_t Get(struct video_mode *mode); + virtual status_t Set(const struct video_mode *mode); + virtual status_t Unset(const struct video_mode *mode); + + virtual status_t SetPalette(const struct video_mode *mode, + const uint8 *palette); + virtual addr_t Framebuffer(); + virtual void MakeLabel(const struct video_mode *mode, + char *label, size_t len); +private: + static int16 fPreviousMode; +}; + + +int16 MilanModeOps::fPreviousMode = -1; + + +status_t +MilanModeOps::Init() +{ + const tos_cookie *c = tos_find_cookie('_MIL'); + if (c == NULL) + return ENODEV; + fInitStatus = B_OK; + return fInitStatus; +} + + + +status_t +MilanModeOps::Enumerate() +{ + if (fInitStatus < B_OK) + return fInitStatus; + + SCREENINFO info; + info.size = sizeof(info); + + + static int16 modes[] = { + 0x001b, 0x001c, 0x002b, 0x002c, + 0x003a, 0x003b, 0x003c, 0x000c, + 0x0034, 0x0004 + /*0x003a, 0x003b, 0x0003, 0x000c, + 0x000b, 0x0033, 0x000c, 0x001c*/ }; + for (int i = 0; i < sizeof(modes) / sizeof(int16); i++) { + video_mode *videoMode = AllocMode(); + if (videoMode == NULL) + continue; + + if (Decode(modes[i], videoMode) != B_OK) + continue; + add_video_mode(videoMode); + + } + return B_OK; + +#if 0 + // TODO: use Milan video monitor detection and build possible mode list there... + int16 monitor; + bool vga = false; + bool tv = false; + monitor = VgetMonitor(); + switch (monitor) { + case 0: + panic("Monochrome ?\n"); + break; + case 2: + vga = true; + break; + case 3: + tv = true; + break; + //case 4 & 5: check for CT60 + case 1: + default: + dprintf("monitor type %d\n", monitor); + break; + } + return ENODEV; +#endif +} + + +status_t +MilanModeOps::Decode(int16 id, struct video_mode *mode) +{ + SCREENINFO info; + info.size = sizeof(info); + info.devID = mode->mode; + info.scrFlags = 0; + + mode->ops = this; + mode->mode = id; + + Setscreen(-1,&info,MI_MAGIC,CMD_GETINFO); + + if (info.scrFlags & SCRINFO_OK == 0) + return B_ERROR; + + // cf. F30.TXT + mode->width = info.scrWidth; + mode->height = info.scrHeight; + mode->bits_per_pixel = info.scrPlanes; + mode->bytes_per_row = mode->width * mode->bits_per_pixel / 8; + return B_OK; +} + + +status_t +MilanModeOps::Get(struct video_mode *mode) +{ + if (fInitStatus < B_OK) + return fInitStatus; + + int16 m = -1; + Setscreen(-1,&m,MI_MAGIC,CMD_GETMODE); + if (m == -1) + return B_ERROR; + return Decode(m, mode); +} + + +status_t +MilanModeOps::Set(const struct video_mode *mode) +{ + if (fInitStatus < B_OK) + return fInitStatus; + if (mode == NULL) + return B_BAD_VALUE; + + Setscreen(-1,&fPreviousMode,MI_MAGIC,CMD_GETMODE); + +#warning M68K: FIXME: allocate framebuffer + dprintf("Switching to mode 0x%04x\n", mode->mode); + //VsetScreen(((uint32)0x00d00000), ((uint32)0x00d00000), 3, mode->mode); + //VsetScreen(((uint32)-1), ((uint32)-1), 3, mode->mode); + Setscreen(-1,mode->mode,MI_MAGIC,CMD_SETMODE); + + return B_OK; +} + + +status_t +MilanModeOps::Unset(const struct video_mode *mode) +{ + if (fInitStatus < B_OK) + return fInitStatus; + + if (fPreviousMode != -1) { + dprintf("Reverting to mode 0x%04x\n", fPreviousMode); + Setscreen(-1,fPreviousMode,MI_MAGIC,CMD_SETMODE); + fPreviousMode = -1; + } + + return B_OK; +} + + +status_t +MilanModeOps::SetPalette(const struct video_mode *mode, const uint8 *palette) +{ + switch (mode->bits_per_pixel) { + case 4: + //VsetRGB(0, 16, palette); + break; + case 8: + //VsetRGB(0, 256, palette); + break; + default: + break; + } +} + + +addr_t +MilanModeOps::Framebuffer() +{ + //XXX + addr_t fb = (addr_t)Physbase(); + return fb; +} + + +void +MilanModeOps::MakeLabel(const struct video_mode *mode, char *label, + size_t len) +{ + ModeOps::MakeLabel(mode, label, len); + label += strlen(label); + // XXX no len check + int16 m = mode->mode; + sprintf(label, " 0x%04x", mode->mode); + /*sprintf(label, "%s%s%s%s", + m & 0x0010 ? " vga" : " tv", + m & 0x0020 ? " pal" : "", + m & 0x0040 ? " oscan" : "", + //m & 0x0080 ? " tv" : "", + m & 0x0100 ? " ilace" : "");*/ +} + + +static MilanModeOps sMilanModeOps; + + // #pragma mark - ARAnyM NFVDI API /* NatFeat VDI */ @@ -723,7 +1136,7 @@ platform_switch_to_logo(void) } gKernelArgs.frame_buffer.enabled = true; -#if 0 +#if 1 // If the new frame buffer is either larger than the old one or located at // a different address, we need to remap it, so we first have to throw // away its previous mapping @@ -777,7 +1190,11 @@ platform_init_video(void) //sNFVDIModeOps.Init(); //sNFVDIModeOps.Enumerate(); - if (sFalconModeOps.Init() == B_OK) { + if (sMilanModeOps.Init() == B_OK) { + sMilanModeOps.Enumerate(); + } else if (sSTModeOps.Init() == B_OK) { + sSTModeOps.Enumerate(); + } else if (sFalconModeOps.Init() == B_OK) { sFalconModeOps.Enumerate(); } else { dprintf("No usable video API found\n"); From 4b9d79406309d60e671f0d908cd42ad5a9e868a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 19 Aug 2011 12:15:57 +0000 Subject: [PATCH 189/702] Add a hack to detect the Milan which boots with a black&white mode, to make the menu and console readable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42641 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../boot/platform/atari_m68k/console.cpp | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/system/boot/platform/atari_m68k/console.cpp b/src/system/boot/platform/atari_m68k/console.cpp index 1180df4f2e..f65c297a99 100644 --- a/src/system/boot/platform/atari_m68k/console.cpp +++ b/src/system/boot/platform/atari_m68k/console.cpp @@ -16,6 +16,9 @@ #include "keyboard.h" +static bool sForceBW = false; // force black & white for Milan + + // TOS emulates a VT52 class ConsoleHandle : public CharHandle { @@ -163,6 +166,33 @@ InputConsoleHandle::GetChar() // #pragma mark - +static void +dump_colors() +{ + int bg, fg; + dprintf("colors:\n"); + for (bg = 0; bg < 16; bg++) { + for (fg = 0; fg < 16; fg++) { + console_set_color(fg, bg); + dprintf("#"); + } + console_set_color(0, 15); + dprintf("\n"); + } +} + + +static int32 +dump_milan_modes(SCREENINFO *info, uint32 flags) +{ + dprintf("mode: %d '%s':\n flags %08lx @%08lx %dx%d (%dx%d)\n%d planes %d colors fmt %08lx\n", + info->devID, info->name, info->scrFlags, info->frameadr, + info->scrWidth, info->scrHeight, + info->virtWidth, info->virtHeight, + info->scrPlanes, info->scrColors, info->scrFormat); + return ENUMMODE_CONT; +} + status_t console_init(void) { @@ -173,6 +203,17 @@ console_init(void) stdin = (FILE *)&sInput; stdout = stderr = (FILE *)&sOutput; + if (tos_find_cookie('_MIL')) { + dprintf("Milan detected... forcing black & white\n"); + /* + dprintf("Getrez() = %d\n", Getrez()); + Setscreen(-1, &dump_milan_modes, MI_MAGIC, CMD_ENUMMODES); + Setscreen((void*)-1, (void*)-1, 0, 0); + */ + sForceBW = true; + } + //dump_colors(); + return B_OK; } @@ -253,6 +294,15 @@ void console_set_color(int32 foreground, int32 background) { char buff[] = "\033b \033c "; + if (sForceBW) { + if (background == 0) + foreground = 15; + else { + background = 15; + foreground = 0; + } + + } buff[2] += (char)translate_color(foreground); buff[5] += (char)translate_color(background); sInput.WriteAt(NULL, 0LL, buff, 6); From 03e3327d33bef1f1ed3160b8da7df20630412317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 19 Aug 2011 12:18:32 +0000 Subject: [PATCH 190/702] Add some tracing of PCI device reservations. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42642 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/bus_managers/pci/pci.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/add-ons/kernel/bus_managers/pci/pci.cpp b/src/add-ons/kernel/bus_managers/pci/pci.cpp index 54306f25be..0c6ba9c58a 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci.cpp @@ -94,6 +94,7 @@ pci_reserve_device(uchar virtualBus, uchar device, uchar function, status_t status; uint8 bus; int domain; + TRACE(("pci_reserve_device(%d, %d, %d, %s)\n", virtualBus, device, function, driverName)); /* * we add 2 nodes to the PCI devices, one with constant attributes, @@ -189,6 +190,7 @@ pci_unreserve_device(uchar virtualBus, uchar device, uchar function, status_t status; uint8 bus; int domain; + TRACE(("pci_unreserve_device(%d, %d, %d, %s)\n", virtualBus, device, function, driverName)); if (gPCI->ResolveVirtualBus(virtualBus, &domain, &bus) != B_OK) return B_ERROR; From efa3bc3eca82c34429b1acb10f9b4e9182d49081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 19 Aug 2011 19:12:29 +0000 Subject: [PATCH 191/702] * Now reads the irs.conf from /boot/common/settings/network/irs.conf instead of /etc/irs.conf. Untested. * There are more config files, but I'm not even sure what they are used for. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42643 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/network/libbind/irs/gen.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/kits/network/libbind/irs/gen.c b/src/kits/network/libbind/irs/gen.c index 04105b3025..bbfd3bf50f 100644 --- a/src/kits/network/libbind/irs/gen.c +++ b/src/kits/network/libbind/irs/gen.c @@ -26,7 +26,7 @@ static const char rcsid[] = "$Id: gen.c,v 1.7 2005/04/27 04:56:23 sra Exp $"; * The dispatcher is implemented as an accessor class; it is an * accessor class that calls other accessor classes, as controlled by a * configuration file. - * + * * A big difference between this accessor class and others is that the * map class initializers are NULL, and the map classes are already * filled in with method functions that will do the right thing. @@ -44,10 +44,12 @@ static const char rcsid[] = "$Id: gen.c,v 1.7 2005/04/27 04:56:23 sra Exp $"; #include #include -#include +#include #include #include +#include + #include #include @@ -121,7 +123,7 @@ struct irs_acc * irs_gen_acc(const char *options, const char *conf_file) { struct irs_acc *acc; struct gen_p *irs; - + if (!(acc = memget(sizeof *acc))) { errno = ENOMEM; return (NULL); @@ -218,7 +220,7 @@ static void gen_close(struct irs_acc *this) { struct gen_p *irs = (struct gen_p *)this->private; int n; - + /* Search rules. */ for (n = 0; n < irs_nmap; n++) while (irs->map_rules[n] != NULL) @@ -382,10 +384,17 @@ default_map_rules(struct gen_p *irs) { static void init_map_rules(struct gen_p *irs, const char *conf_file) { char line[1024], pattern[40], mapname[20], accname[20], options[100]; + char path[PATH_MAX]; FILE *conf; - if (conf_file == NULL) - conf_file = _PATH_IRS_CONF ; + if (conf_file == NULL) { + if (find_directory(B_COMMON_SETTINGS_DIRECTORY, -1, false, path, + sizeof(path)) == B_OK) { + strlcat(path, "/network/irs.conf", sizeof(path)); + conf_file = path; + } else + conf_file = _PATH_IRS_CONF; + } /* A conf file of "" means compiled in defaults. Irpd wants this */ if (conf_file[0] == '\0' || (conf = fopen(conf_file, "r")) == NULL) { From d3e8b64208159ab71ca24f58ec7e56f1aa4bb5e6 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 19 Aug 2011 23:07:45 +0000 Subject: [PATCH 192/702] * introduce mc control calls * malloc storage for mc state info * redo pll range struct * change to ATOM_ENCODER_MODE for connector info * redo pll calculations to match AtomBIOS requirements * some structure changes * no longer init already posted AtomBIOS as it causes an infinite loop of AtomBIOS calls git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42644 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 48 +- .../accelerants/radeon_hd/accelerant.cpp | 12 +- .../accelerants/radeon_hd/accelerant.h | 93 ++- src/add-ons/accelerants/radeon_hd/bios.cpp | 61 +- src/add-ons/accelerants/radeon_hd/bios.h | 1 + src/add-ons/accelerants/radeon_hd/display.cpp | 57 +- src/add-ons/accelerants/radeon_hd/gpu.cpp | 75 +- src/add-ons/accelerants/radeon_hd/gpu.h | 7 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 30 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 692 +++--------------- src/add-ons/accelerants/radeon_hd/pll.h | 39 +- .../drivers/graphics/radeon_hd/driver.cpp | 8 +- 12 files changed, 423 insertions(+), 700 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 33c6634921..32f7f4ccf0 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -51,15 +51,6 @@ #define RHD_POWER_UNKNOWN 3 /* initial state */ -// info about PLL on graphics card -struct pll_info { - uint32 reference_frequency; - uint32 max_frequency; - uint32 min_frequency; - uint32 divisor_register; -}; - - struct ring_buffer { struct lock lock; uint32 register_base; @@ -129,7 +120,6 @@ struct radeon_shared_info { uint16 device_chipset; char device_identifier[32]; - struct pll_info pll_info; }; //----------------- ioctl() interface ---------------- @@ -171,10 +161,40 @@ struct radeon_free_graphics_memory { #define R6XX_CONFIG_APER_SIZE 0x5430 // r600> #define OLD_CONFIG_APER_SIZE 0x0108 // +#define D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x691c // r700> + +#define D2CRTC_CONTROL 0x6880 +#define D2CRTC_STATUS 0x689c +#define D2CRTC_UPDATE_LOCK 0x68E8 +#define D2GRPH_PRIMARY_SURFACE_ADDRESS 0x6910 +#define D2GRPH_SECONDARY_SURFACE_ADDRESS 0x6918 +#define D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 // r700> +#define D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x611c // r700> + +#define D1VGA_CONTROL 0x0330 +#define DVGA_CONTROL_MODE_ENABLE (1 << 0) +#define DVGA_CONTROL_TIMING_SELECT (1 << 8) +#define DVGA_CONTROL_SYNC_POLARITY_SELECT (1 << 9) +#define DVGA_CONTROL_OVERSCAN_TIMING_SELECT (1 << 10) +#define DVGA_CONTROL_OVERSCAN_COLOR_EN (1 << 16) +#define DVGA_CONTROL_ROTATE (1 << 24) +#define D2VGA_CONTROL 0x0338 + +#define VGA_HDP_CONTROL 0x328 +#define VGA_MEM_PAGE_SELECT_EN (1 << 0) +#define VGA_MEMORY_DISABLE (1 << 4) +#define VGA_RBBM_LOCK_DISABLE (1 << 8) +#define VGA_SOFT_RESET (1 << 16) +#define VGA_MEMORY_BASE_ADDRESS 0x0310 +#define VGA_RENDER_CONTROL 0x0300 +#define VGA_VSTATUS_CNTL_MASK 0x00030000 // cursor #define RADEON_CURSOR_CONTROL 0x70080 diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 97f022e5f7..294365745f 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -108,6 +108,8 @@ init_common(int device, bool isClone) memset(gInfo, 0, sizeof(accelerant_info)); + gInfo->mc_info = (gpu_mc_info *)malloc(sizeof(gpu_mc_info)); + for (uint32 id = 0; id < MAX_DISPLAY; id++) { gDisplay[id] = (display_info *)malloc(sizeof(display_info)); if (gDisplay[id] == NULL) @@ -130,6 +132,7 @@ init_common(int device, bool isClone) if (ioctl(device, RADEON_GET_PRIVATE_DATA, &data, sizeof(radeon_get_private_data)) != 0) { + free(gInfo->mc_info); free(gInfo); return B_ERROR; } @@ -140,6 +143,7 @@ init_common(int device, bool isClone) data.shared_info_area); status_t status = sharedCloner.InitCheck(); if (status < B_OK) { + free(gInfo->mc_info); free(gInfo); TRACE("%s, failed to create shared area\n", __func__); return status; @@ -151,6 +155,7 @@ init_common(int device, bool isClone) gInfo->shared_info->registers_area); status = regsCloner.InitCheck(); if (status < B_OK) { + free(gInfo->mc_info); free(gInfo); TRACE("%s, failed to create mmio area\n", __func__); return status; @@ -171,12 +176,6 @@ init_common(int device, bool isClone) sharedCloner.Keep(); regsCloner.Keep(); - // Define Radeon PLL default ranges - gInfo->shared_info->pll_info.reference_frequency - = RHD_PLL_REFERENCE_DEFAULT; - gInfo->shared_info->pll_info.min_frequency = RHD_PLL_MIN_DEFAULT; - gInfo->shared_info->pll_info.max_frequency = RHD_PLL_MAX_DEFAULT; - return B_OK; } @@ -196,6 +195,7 @@ uninit_common(void) if (gInfo->is_clone) close(gInfo->device); + free(gInfo->mc_info); free(gInfo); } diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 98f9c3393c..ffb9152e8f 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -27,6 +27,16 @@ // Maximum displays (more then two requires AtomBIOS) +typedef struct { + uint32 d1vga_control; + uint32 d2vga_control; + uint32 vga_render_control; + uint32 vga_hdp_control; + uint32 d1crtc_control; + uint32 d2crtc_control; +} gpu_mc_info; + + struct accelerant_info { vuint8 *regs; area_id regs_area; @@ -46,6 +56,8 @@ struct accelerant_info { int device; bool is_clone; + gpu_mc_info *mc_info; // used for last known mc state + // LVDS panel mode passed from the bios/startup. display_mode lvds_panel_mode; }; @@ -91,6 +103,41 @@ struct register_info { }; +struct pll_info { + /* reference frequency */ + uint32 reference_freq; + + /* fixed dividers */ + uint32 reference_div; + uint32 post_div; + + /* pll in/out limits */ + uint32 pll_in_min; + uint32 pll_in_max; + uint32 pll_out_min; + uint32 pll_out_max; + uint32 lcd_pll_out_min; + uint32 lcd_pll_out_max; + uint32 best_vco; + + /* divider limits */ + uint32 min_ref_div; + uint32 max_ref_div; + uint32 min_post_div; + uint32 max_post_div; + uint32 min_feedback_div; + uint32 max_feedback_div; + uint32 min_frac_feedback_div; + uint32 max_frac_feedback_div; + + /* flags for the current clock */ + uint32 flags; + + /* pll id */ + uint32 id; +}; + + typedef struct { bool active; uint32 connection_type; @@ -101,24 +148,19 @@ typedef struct { uint32 vfreq_min; uint32 hfreq_max; uint32 hfreq_min; + pll_info pll; } display_info; -// display_info connection_type -#define CONNECTION_DAC 0x0001 -#define CONNECTION_TMDS 0x0002 -#define CONNECTION_LVDS 0x0004 - // register MMIO modes -#define OUT 0x1 // direct MMIO calls -#define CRT 0x2 // crt controler calls -#define VGA 0x3 // vga calls +#define OUT 0x1 // Direct MMIO calls +#define CRT 0x2 // Crt controller calls +#define VGA 0x3 // Vga calls #define PLL 0x4 // PLL calls -#define MC 0x5 // Memory Controler calls +#define MC 0x5 // Memory controller calls extern accelerant_info *gInfo; -//extern void *gAtomBIOS; extern atom_context *gAtomContext; extern display_info *gDisplay[MAX_DISPLAY]; @@ -139,22 +181,6 @@ _write32(uint32 offset, uint32 value) } -inline uint32 -_read32PLL(uint16 offset) -{ - _write32(CLOCK_CNTL_INDEX, offset & PLL_ADDR); - return _read32(CLOCK_CNTL_DATA); -} - - -inline void -_write32PLL(uint16 offset, uint32 data) -{ - _write32(CLOCK_CNTL_INDEX, (offset & PLL_ADDR) | PLL_WR_EN); - _write32(CLOCK_CNTL_DATA, data); -} - - inline uint32 Read32(uint32 subsystem, uint32 offset) { @@ -162,13 +188,11 @@ Read32(uint32 subsystem, uint32 offset) default: case OUT: case VGA: - case MC: - return _read32(offset); case CRT: - return _read32(offset); case PLL: return _read32(offset); - //return _read32PLL(offset); + case MC: + return _read32(offset); }; } @@ -180,15 +204,12 @@ Write32(uint32 subsystem, uint32 offset, uint32 value) default: case OUT: case VGA: - case MC: - _write32(offset, value); - return; case CRT: - _write32(offset, value); - return; case PLL: _write32(offset, value); - //_write32PLL(offset, value); + return; + case MC: + _write32(offset, value); return; }; } diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 1c60c18e97..242e487e4e 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -59,6 +59,51 @@ radeon_bios_init_scratch() } +bool +radeon_bios_isposted() +{ + // aka, is primary graphics card that POST loaded + + radeon_shared_info &info = *gInfo->shared_info; + uint32 reg; + + if (info.device_chipset == (RADEON_R1000 | 0x50)) { + // palms + reg = Read32(OUT, EVERGREEN_CRTC_CONTROL + + EVERGREEN_CRTC0_REGISTER_OFFSET) + | Read32(OUT, EVERGREEN_CRTC_CONTROL + + EVERGREEN_CRTC1_REGISTER_OFFSET); + if (reg & EVERGREEN_CRTC_MASTER_EN) + return true; + } else if (info.device_chipset >= RADEON_R1000) { + // evergreen or higher + reg = Read32(OUT, EVERGREEN_CRTC_CONTROL + + EVERGREEN_CRTC0_REGISTER_OFFSET) + | Read32(OUT, EVERGREEN_CRTC_CONTROL + + EVERGREEN_CRTC1_REGISTER_OFFSET) + | Read32(OUT, EVERGREEN_CRTC_CONTROL + + EVERGREEN_CRTC2_REGISTER_OFFSET) + | Read32(OUT, EVERGREEN_CRTC_CONTROL + + EVERGREEN_CRTC3_REGISTER_OFFSET) + | Read32(OUT, EVERGREEN_CRTC_CONTROL + + EVERGREEN_CRTC4_REGISTER_OFFSET) + | Read32(OUT, EVERGREEN_CRTC_CONTROL + + EVERGREEN_CRTC5_REGISTER_OFFSET); + if (reg & EVERGREEN_CRTC_MASTER_EN) + return true; + } else if (info.device_chipset > RADEON_R580) { + // avivio through r700 + reg = Read32(OUT, AVIVO_D1CRTC_CONTROL) | + Read32(OUT, AVIVO_D2CRTC_CONTROL); + if (reg & AVIVO_CRTC_EN) { + return true; + } + } + + return false; +} + + status_t radeon_init_bios(uint8* bios) { @@ -114,12 +159,16 @@ radeon_init_bios(uint8* bios) radeon_bios_init_scratch(); atom_allocate_fb_scratch(gAtomContext); - // TODO : this is only *required* on cards <= r500 - // is it ok to run on cards > r500 before asic_init? - radeon_gpu_reset(); - - atom_asic_init(gAtomContext); - // Post card + // post card atombios if needed + if (!radeon_bios_isposted()) { + TRACE("%s: init AtomBIOS for this card as it is not not posted\n", + __func__); + // radeon_gpu_reset(); // <= r500 only? + atom_asic_init(gAtomContext); + } else { + TRACE("%s: AtomBIOS is already posted\n", + __func__); + } return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/bios.h b/src/add-ons/accelerants/radeon_hd/bios.h index f686de1425..9d32c54d91 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.h +++ b/src/add-ons/accelerants/radeon_hd/bios.h @@ -15,6 +15,7 @@ status_t radeon_init_bios(uint8* bios); +bool radeon_bios_isposted(); status_t radeon_dump_bios(); diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 4bae5adabf..616318f5b3 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -112,11 +112,11 @@ init_registers(register_info* regs, uint8 crtid) // Surface Address high only used on r770+ regs->grphPrimarySurfaceAddrHigh - = crtid == 1 ? R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH - : R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; + = crtid == 1 ? D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + : D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; regs->grphSecondarySurfaceAddrHigh - = crtid == 1 ? R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH - : R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH; + = crtid == 1 ? D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + : D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH; regs->grphPitch = crtid == 1 ? D2GRPH_PITCH : D1GRPH_PITCH; @@ -233,7 +233,7 @@ detect_displays() for (uint32 id = 0; id < 2; id++) { if (DACSense(id)) { gDisplay[index]->active = true; - gDisplay[index]->connection_type = CONNECTION_DAC; + gDisplay[index]->connection_type = ATOM_ENCODER_MODE_CRT; gDisplay[index]->connection_id = id; init_registers(gDisplay[index]->regs, index); if (detect_crt_ranges(index) == B_OK) @@ -250,7 +250,8 @@ detect_displays() for (uint32 id = 0; id < 1; id++) { if (TMDSSense(id)) { gDisplay[index]->active = true; - gDisplay[index]->connection_type = CONNECTION_TMDS; + gDisplay[index]->connection_type = ATOM_ENCODER_MODE_DVI; + // or ATOM_ENCODER_MODE_HDMI? gDisplay[index]->connection_id = id; init_registers(gDisplay[index]->regs, index); if (detect_crt_ranges(index) == B_OK) @@ -266,7 +267,7 @@ detect_displays() // No monitors? Lets assume LVDS for now if (index == 0) { gDisplay[index]->active = true; - gDisplay[index]->connection_type = CONNECTION_LVDS; + gDisplay[index]->connection_type = ATOM_ENCODER_MODE_LVDS; gDisplay[index]->connection_id = 1; // 0 : LVDSA ; 1 : LVDSB / TDMSB init_registers(gDisplay[index]->regs, index); @@ -285,14 +286,40 @@ debug_displays() id, gDisplay[id]->active ? "true" : "false"); if (gDisplay[id]->active) { - if (gDisplay[id]->connection_type == CONNECTION_DAC) - TRACE(" + connection: DAC\n"); - else if (gDisplay[id]->connection_type == CONNECTION_TMDS) - TRACE(" + connection: TMDS\n"); - else if (gDisplay[id]->connection_type == CONNECTION_LVDS) - TRACE(" + connection: LVDS\n"); - else - TRACE(" + connection: UNKNOWN\n"); + switch (gDisplay[id]->connection_type) { + case ATOM_ENCODER_MODE_DP: + TRACE(" + connection: DP\n"); + break; + case ATOM_ENCODER_MODE_LVDS: + TRACE(" + connection: LVDS\n"); + break; + case ATOM_ENCODER_MODE_DVI: + TRACE(" + connection: DVI\n"); + break; + case ATOM_ENCODER_MODE_HDMI: + TRACE(" + connection: HDMI\n"); + break; + case ATOM_ENCODER_MODE_SDVO: + TRACE(" + connection: SDVO\n"); + break; + case ATOM_ENCODER_MODE_DP_AUDIO: + TRACE(" + connection: DP AUDIO\n"); + break; + case ATOM_ENCODER_MODE_TV: + TRACE(" + connection: TV\n"); + break; + case ATOM_ENCODER_MODE_CV: + TRACE(" + connection: CV\n"); + break; + case ATOM_ENCODER_MODE_CRT: + TRACE(" + connection: CRT\n"); + break; + case ATOM_ENCODER_MODE_DVO: + TRACE(" + connection: DVO\n"); + break; + default: + TRACE(" + connection: UNKNOWN\n"); + } TRACE(" + connection index: % " B_PRIu8 "\n", gDisplay[id]->connection_id); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 2a37354cd3..249fa0e285 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -38,9 +38,10 @@ radeon_gpu_reset() TRACE("%s: GPU software reset in progress...\n", __func__); - // TODO : mc stop + // Halt memory controller + radeon_gpu_mc_halt(); - if (radeon_gpu_mc_idle() > 0) { + if (radeon_gpu_mc_idlecheck() > 0) { ERROR("%s: Timeout waiting for MC to idle!\n", __func__); } @@ -152,14 +153,66 @@ radeon_gpu_reset() snooze(50); } - - // TODO : mc resume + // Resume memory controller + radeon_gpu_mc_resume(); return B_OK; } +void +radeon_gpu_mc_halt() +{ + // Backup current memory controller state + gInfo->mc_info->d1vga_control = Read32(OUT, D1VGA_CONTROL); + gInfo->mc_info->d2vga_control = Read32(OUT, D2VGA_CONTROL); + gInfo->mc_info->vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); + gInfo->mc_info->vga_hdp_control = Read32(OUT, VGA_HDP_CONTROL); + gInfo->mc_info->d1crtc_control = Read32(OUT, D1CRTC_CONTROL); + gInfo->mc_info->d2crtc_control = Read32(OUT, D2CRTC_CONTROL); + + // halt all memory controller actions + Write32(OUT, D2CRTC_UPDATE_LOCK, 0); + Write32(OUT, VGA_RENDER_CONTROL, 0); + Write32(OUT, D1CRTC_UPDATE_LOCK, 1); + Write32(OUT, D2CRTC_UPDATE_LOCK, 1); + Write32(OUT, D1CRTC_CONTROL, 0); + Write32(OUT, D2CRTC_CONTROL, 0); + Write32(OUT, D1CRTC_UPDATE_LOCK, 0); + Write32(OUT, D2CRTC_UPDATE_LOCK, 0); + Write32(OUT, D1VGA_CONTROL, 0); + Write32(OUT, D2VGA_CONTROL, 0); +} + + +void +radeon_gpu_mc_resume() +{ + // TODO : do surface addresses disappear on mc halt? + //Write32(OUT, D1GRPH_PRIMARY_SURFACE_ADDRESS, rdev->mc.vram_start); + //Write32(OUT, D1GRPH_SECONDARY_SURFACE_ADDRESS, rdev->mc.vram_start); + //Write32(OUT, D2GRPH_PRIMARY_SURFACE_ADDRESS, rdev->mc.vram_start); + //Write32(OUT, D2GRPH_SECONDARY_SURFACE_ADDRESS, rdev->mc.vram_start); + //Write32(OUT, VGA_MEMORY_BASE_ADDRESS, rdev->mc.vram_start); + + // Rnlock host access + Write32(OUT, VGA_HDP_CONTROL, gInfo->mc_info->vga_hdp_control); + snooze(1); + + // Restore memory controller state + Write32(OUT, D1VGA_CONTROL, gInfo->mc_info->d1vga_control); + Write32(OUT, D2VGA_CONTROL, gInfo->mc_info->d2vga_control); + Write32(OUT, D1CRTC_UPDATE_LOCK, 1); + Write32(OUT, D2CRTC_UPDATE_LOCK, 1); + Write32(OUT, D1CRTC_CONTROL, gInfo->mc_info->d1crtc_control); + Write32(OUT, D2CRTC_CONTROL, gInfo->mc_info->d2crtc_control); + Write32(OUT, D1CRTC_UPDATE_LOCK, 0); + Write32(OUT, D2CRTC_UPDATE_LOCK, 0); + Write32(OUT, VGA_RENDER_CONTROL, gInfo->mc_info->vga_render_control); +} + + uint32 -radeon_gpu_mc_idle() +radeon_gpu_mc_idlecheck() { uint32 idleStatus; if (!((idleStatus = Read32(MC, SRBM_STATUS)) & @@ -176,13 +229,15 @@ radeon_gpu_mc_setup() { uint32 fb_location_int = gInfo->shared_info->frame_buffer_int; - uint32 fb_location = Read32(OUT, R6XX_MC_VM_FB_LOCATION); + uint32 fb_location = Read32(OUT, R600_MC_VM_FB_LOCATION); uint16 fb_size = (fb_location >> 16) - (fb_location & 0xFFFF); uint32 fb_location_tmp = fb_location_int >> 24; fb_location_tmp |= (fb_location_tmp + fb_size) << 16; uint32 fb_offset_tmp = (fb_location_int >> 8) & 0xff0000; - uint32 idleState = radeon_gpu_mc_idle(); + radeon_gpu_mc_halt(); + + uint32 idleState = radeon_gpu_mc_idlecheck(); if (idleState > 0) { TRACE("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", __func__, idleState); @@ -194,8 +249,10 @@ radeon_gpu_mc_setup() __func__, fb_location, fb_location_tmp, fb_size); // The MC Write32 will handle cards needing a special MC read/write register - Write32(MC, R6XX_MC_VM_FB_LOCATION, fb_location_tmp); - Write32(MC, R6XX_HDP_NONSURFACE_BASE, fb_offset_tmp); + Write32(MC, R600_MC_VM_FB_LOCATION, fb_location_tmp); + Write32(MC, R600_HDP_NONSURFACE_BASE, fb_offset_tmp); + + radeon_gpu_mc_resume(); return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index e8311e4694..b0779c748a 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -9,6 +9,9 @@ #define RADEON_HD_GPU_H +#include "accelerant.h" + + // GPU Control registers. These are combined as // the registers exist on all models, some flags // are different though and are commented as such @@ -160,7 +163,9 @@ status_t radeon_gpu_reset(); -uint32 radeon_gpu_mc_idle(); +void radeon_gpu_mc_halt(); +void radeon_gpu_mc_resume(); +uint32 radeon_gpu_mc_idlecheck(); status_t radeon_gpu_mc_setup(); status_t radeon_gpu_irq_setup(); diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index e3a84bc97e..c48420a011 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -17,6 +17,7 @@ #include "utility.h" #include "mode.h" #include "display.h" +#include "pll.h" #include #include @@ -108,8 +109,8 @@ radeon_set_display_mode(display_mode *mode) continue; } - //pll_set(gDisplay[id]->connection_id, - // mode->timing.pixel_clock, id); + pll_set(gDisplay[id]->connection_id, + mode->timing.pixel_clock, id); // Program CRT Controller display_crtc_set_dtd(id, mode); @@ -119,13 +120,14 @@ radeon_set_display_mode(display_mode *mode) // Program connector controllers switch (gDisplay[id]->connection_type) { - case CONNECTION_DAC: + case ATOM_ENCODER_MODE_CRT: DACSet(gDisplay[id]->connection_id, id); break; - case CONNECTION_TMDS: + case ATOM_ENCODER_MODE_DVI: + case ATOM_ENCODER_MODE_HDMI: TMDSSet(gDisplay[id]->connection_id, mode); break; - case CONNECTION_LVDS: + case ATOM_ENCODER_MODE_LVDS: LVDSSet(gDisplay[id]->connection_id, mode); break; } @@ -134,17 +136,19 @@ radeon_set_display_mode(display_mode *mode) display_crtc_blank(id, ATOM_DISABLE); display_crtc_power(id, ATOM_ENABLE); - PLLPower(gDisplay[id]->connection_id, RHD_POWER_ON); + //PLLPower(gDisplay[id]->connection_id, RHD_POWER_ON); // Power connector controllers switch (gDisplay[id]->connection_type) { - case CONNECTION_DAC: + case ATOM_ENCODER_MODE_CRT: DACPower(gDisplay[id]->connection_id, RHD_POWER_ON); break; - case CONNECTION_TMDS: + case ATOM_ENCODER_MODE_DVI: + case ATOM_ENCODER_MODE_HDMI: TMDSPower(gDisplay[id]->connection_id, RHD_POWER_ON); break; - case CONNECTION_LVDS: + case ATOM_ENCODER_MODE_LVDS: + LVDSSet(gDisplay[id]->connection_id, mode); LVDSPower(gDisplay[id]->connection_id, RHD_POWER_ON); break; } @@ -197,16 +201,16 @@ radeon_get_pixel_clock_limits(display_mode *mode, uint32 *_low, uint32 *_high) *(uint32)mode->timing.v_total; uint32 low = (totalClocks * 48L) / 1000L; - if (low < gInfo->shared_info->pll_info.min_frequency) - low = gInfo->shared_info->pll_info.min_frequency; - else if (low > gInfo->shared_info->pll_info.max_frequency) + if (low < PLL_MIN_DEFAULT) + low = PLL_MIN_DEFAULT; + else if (low > PLL_MAX_DEFAULT) return B_ERROR; *_low = low; } if (_high != NULL) - *_high = gInfo->shared_info->pll_info.max_frequency; + *_high = PLL_MAX_DEFAULT; //*_low = 48L; //*_high = 100 * 1000000L; diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 6f2c1c3b5c..e912d1828c 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. * * Authors: - * Alexander von Gluck, kallisti5@unixzen.com + * Alexander von Gluck, kallisti5@unixzen.com */ @@ -39,194 +39,129 @@ union set_pixel_clock { }; -/* From hardcoded values. */ -static struct PLL_Control RV610PLLControl[] = -{ - { 0x0049, 0x159F8704 }, - { 0x006C, 0x159B8704 }, - { 0xFFFF, 0x159EC704 } -}; - -/* Some tables are provided by atombios, - * it's just that they are hidden away deliberately and not exposed */ -static struct PLL_Control RV670PLLControl[] = -{ - { 0x004A, 0x159FC704 }, - { 0x0067, 0x159BC704 }, - { 0x00C4, 0x159EC704 }, - { 0x00F4, 0x1593A704 }, - { 0x0136, 0x1595A704 }, - { 0x01A4, 0x1596A704 }, - { 0x022C, 0x159CE504 }, - { 0xFFFF, 0x1591E404 } -}; - - static uint32 -PLLControlTable(struct PLL_Control *table, uint16 feedbackDivider) +pll_compute_post_divider(uint32 targetClock) { - int i; + radeon_shared_info &info = *gInfo->shared_info; - for (i = 0; table[i].feedbackDivider < 0xFFFF ; i++) { - if (table[i].feedbackDivider >= feedbackDivider) - break; + // if RADEON_PLL_USE_POST_DIV + // return pll->post_div; + + uint32 vco; + if (info.device_chipset < (RADEON_R700 | 0x70)) { + if (0) // TODO : RADEON_PLL_IS_LCD + vco = PLL_MIN_DEFAULT; // pll->lcd_pll_out_min; + else + vco = PLL_MIN_DEFAULT; // pll->pll_out_min; + } else { + if (0) // TODO : RADEON_PLL_IS_LCD + vco = PLL_MAX_DEFAULT; // pll->lcd_pll_out_max; + else + vco = PLL_MAX_DEFAULT; // pll->pll_out_min; } - return table[i].control; + uint32 postDivider = vco / targetClock; + uint32 tmp = vco % targetClock; + + if (info.device_chipset < (RADEON_R700 | 0x70)) { + if (tmp) + postDivider++; + } else { + if (!tmp) + postDivider--; + } + + if (postDivider > POST_DIV_LIMIT) + postDivider = POST_DIV_LIMIT; + else if (postDivider < POST_DIV_MIN) + postDivider = POST_DIV_MIN; + + return postDivider; } status_t -PLLCalculate(uint32 pixelClock, uint16 *reference, uint16 *feedback, - uint16 *post) +pll_compute(uint32 pixelClock, uint32 *dotclockOut, uint32 *referenceOut, + uint32 *feedbackOut, uint32 *feedbackFracOut, uint32 *postOut) { - // Freaking phase-locked loops, how do they work? + uint32 targetClock = pixelClock / 10; + uint32 postDivider = pll_compute_post_divider(targetClock); + uint32 referenceDivider = REF_DIV_MIN; + uint32 feedbackDivider = 0; + uint32 feedbackDividerFrac = 0; - float ratio = ((float) pixelClock) - / ((float) gInfo->shared_info->pll_info.reference_frequency); + // if RADEON_PLL_USE_REF_DIV + // ref_div = pll->reference_div; - uint32 bestDiff = 0xFFFFFFFF; - uint32 postDiv; - uint32 referenceDiv; - uint32 feedbackDiv; + // if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { + // avivo_get_fb_div(pll, targetClock, postDivider, referenceDivider, + // &feedbackDivider, &feedbackDividerFrac); + // feedbackDividerFrac = (100 * feedbackDividerFrac) / pll->reference_freq; + // if (frac_fb_div >= 5) { + // frac_fb_div -= 5; + // frac_fb_div = frac_fb_div / 10; + // frac_fb_div++; + // } + // if (frac_fb_div >= 10) { + // fb_div++; + // frac_fb_div = 0; + // } + // } else { + while (referenceDivider <= REF_DIV_LIMIT) { + // get feedback divider + uint32 retroEncabulator = postDivider * referenceDivider; - for (postDiv = 2; postDiv < POST_DIV_LIMIT; postDiv++) { - uint32 vcoOut = pixelClock * postDiv; + retroEncabulator *= targetClock; + feedbackDivider = retroEncabulator / PLL_REFERENCE_DEFAULT; + feedbackDividerFrac = retroEncabulator % PLL_REFERENCE_DEFAULT; - /* we are conservative and avoid the limits */ - if (vcoOut <= gInfo->shared_info->pll_info.min_frequency) - continue; - if (vcoOut >= gInfo->shared_info->pll_info.max_frequency) - break; + if (feedbackDivider > FB_DIV_LIMIT) + feedbackDivider = FB_DIV_LIMIT; + else if (feedbackDivider < FB_DIV_MIN) + feedbackDivider = FB_DIV_MIN; - for (referenceDiv = 1; referenceDiv <= REF_DIV_LIMIT; referenceDiv++) { - feedbackDiv = (uint32)((ratio * postDiv * referenceDiv) + 0.5); + if (feedbackDividerFrac >= (PLL_REFERENCE_DEFAULT / 2)) + feedbackDivider++; - if (feedbackDiv >= FB_DIV_LIMIT) - break; - if (feedbackDiv > (500 + (13 * referenceDiv))) // rv6x0 limit - break; - - uint32 diff = abs(pixelClock - (feedbackDiv - * gInfo->shared_info->pll_info.reference_frequency) - / (postDiv * referenceDiv)); - - if (diff < bestDiff) { - *feedback = feedbackDiv; - *reference = referenceDiv; - *post = postDiv; - bestDiff = diff; + feedbackDividerFrac = 0; + if (referenceDivider == 0 || postDivider == 0 || targetClock == 0) { + TRACE("%s: Caught division by zero\n", + __func__); + return B_ERROR; } + uint32 tmp = (PLL_REFERENCE_DEFAULT * feedbackDivider) + / (postDivider * referenceDivider); + tmp = (tmp * 10000) / targetClock; - if (bestDiff == 0) + if (tmp > (10000 + MAX_TOLERANCE)) + referenceDivider++; + else if (tmp >= (10000 - MAX_TOLERANCE)) break; + else + referenceDivider++; } + // } - if (bestDiff == 0) - break; + if (referenceDivider == 0 || postDivider == 0) { + TRACE("%s: Caught division by zero of post or reference divider\n", + __func__); + return B_ERROR; } - if (bestDiff != 0xFFFFFFFF) { - TRACE("%s: Successful PLL Calculation: %dkHz = " - "(((%i / 0x%X) * 0x%X) / 0x%X) (%dkHz off)\n", __func__, - (int) pixelClock, - (unsigned int) gInfo->shared_info->pll_info.reference_frequency, - *reference, *feedback, *post, (int) bestDiff); - return B_OK; - } + *dotclockOut = ((PLL_REFERENCE_DEFAULT * feedbackDivider * 10) + + (PLL_REFERENCE_DEFAULT * feedbackDividerFrac)) + / (referenceDivider * postDivider * 10); - // Shouldn't ever happen - TRACE("%s: Failed to get a valid PLL setting for %dkHz\n", - __func__, (int) pixelClock); - return B_ERROR; -} + *feedbackOut = feedbackDivider; + *feedbackFracOut = feedbackDividerFrac; + *referenceOut = referenceDivider; + *postOut = postDivider; - -status_t -PLLPower(uint8 pllIndex, int command) -{ - uint16 pllControlReg = pllIndex == 1 ? P2PLL_CNTL : P1PLL_CNTL; - - bool hasDccg = DCCGCLKAvailable(pllIndex); - - TRACE("%s: card has DCCG = %c\n", __func__, hasDccg ? 'y' : 'n'); - - switch (command) { - case RHD_POWER_ON: - { - TRACE("%s: PLL %d Power On\n", __func__, pllIndex); - - if (hasDccg) - DCCGCLKSet(pllIndex, RV620_DCCGCLK_RESET); - - Write32Mask(PLL, pllControlReg, 0, 0x02); - // Power On - snooze(2); - PLLCalibrate(pllIndex); - - if (hasDccg) - DCCGCLKSet(pllIndex, RV620_DCCGCLK_GRAB); - - return B_OK; - } - case RHD_POWER_RESET: - { - TRACE("%s: PLL %d Power Reset\n", __func__, pllIndex); - - if (hasDccg) - DCCGCLKSet(pllIndex, RV620_DCCGCLK_RELEASE); - - Write32Mask(PLL, pllControlReg, 0x01, 0x01); - // Reset - snooze(2); - Write32Mask(PLL, pllControlReg, 0, 0x02); - // Power On - snooze(2); - return B_OK; - } - - case RHD_POWER_SHUTDOWN: - default: - TRACE("%s: PLL %d Power Shutdown\n", __func__, pllIndex); - - radeon_shared_info &info = *gInfo->shared_info; - - if (hasDccg) - DCCGCLKSet(pllIndex, RV620_DCCGCLK_RELEASE); - - Write32Mask(PLL, pllControlReg, 0x01, 0x01); - // Reset - snooze(2); - - if (info.device_chipset >= (RADEON_R600 | 0x20)) { - uint16 pllDiffPostReg - = pllIndex == 1 ? RV620_EXT2_DIFF_POST_DIV_CNTL - : RV620_EXT1_DIFF_POST_DIV_CNTL; - uint16 pllDiffDriverEnable - = pllIndex == 1 ? (uint16)RV62_EXT2_DIFF_DRIVER_ENABLE - : (uint16)RV62_EXT1_DIFF_DRIVER_ENABLE; - - // Sometimes we have to keep an unused PLL running. X Bug #18016 - if ((Read32(PLL, pllDiffPostReg) - & pllDiffDriverEnable) == 0) { - Write32Mask(PLL, pllControlReg, 0x02, 0x02); - // Power Down - } else { - TRACE("%s: PHYA differential clock driver not disabled\n", - __func__); - } - - snooze(200); - - Write32Mask(PLL, pllControlReg, 0x2000, 0x2000); - // Reset anti-glitch? - - } else { - Write32Mask(PLL, pllControlReg, 0x02, 0x02); - // Power Down - snooze(200); - } - } + TRACE("%s: pixel clock: %" B_PRIu32 " gives:" + " feedbackDivider = %" B_PRIu32 ".%" B_PRIu32 + "; referenceDivider = %" B_PRIu32 "; postDivider = %" B_PRIu32 + "; dotClock = %" B_PRIu32 "\n", __func__, pixelClock, feedbackDivider, + feedbackDividerFrac, referenceDivider, postDivider, *dotclockOut); return B_OK; } @@ -235,30 +170,29 @@ PLLPower(uint8 pllIndex, int command) status_t pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) { - uint16 reference = 0; - uint16 feedback = 0; - uint16 post = 0; + uint32 dotclock = 0; + uint32 reference = 0; + uint32 feedback = 0; + uint32 feedbackFrac = 0; + uint32 post = 0; - PLLCalculate(pixelClock, &reference, &feedback, &post); + pll_compute(pixelClock, &dotclock, &reference, &feedback, + &feedbackFrac, &post); int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); union set_pixel_clock args; memset(&args, 0, sizeof(args)); - //uint8 frev; - //uint8 crev; - //atom_parse_cmd_header(gAtomContext, index, &frev, &crev); - - uint8 frev = 1; - uint8 crev = 1; + uint8 frev; + uint8 crev; + atom_parse_cmd_header(gAtomContext, index, &frev, &crev); switch (crev) { case 1: args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); args.v1.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); - // args.v1.ucFracFbDiv = frac_fb_div; - args.v1.ucFracFbDiv = 0; + args.v1.ucFracFbDiv = feedbackFrac; args.v1.ucPostDiv = post; args.v1.ucPpll = pll_id; args.v1.ucCRTC = crtc_id; @@ -268,419 +202,35 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) args.v2.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); args.v2.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); args.v2.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); - // args.v2.ucFracFbDiv = frac_fb_div; + args.v2.ucFracFbDiv = feedbackFrac; args.v2.ucPostDiv = post; args.v2.ucPpll = pll_id; args.v2.ucCRTC = crtc_id; args.v2.ucRefDivSrc = 1; break; - #if 0 case 3: args.v3.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); args.v3.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); args.v3.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); - // args.v3.ucFracFbDiv = frac_fb_div; + args.v3.ucFracFbDiv = feedbackFrac; args.v3.ucPostDiv = post; args.v3.ucPpll = pll_id; args.v3.ucMiscInfo = (pll_id << 2); - if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) - args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; - args.v3.ucTransmitterId = encoder_id; - args.v3.ucEncoderMode = encoder_mode; + // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) + // args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; + args.v3.ucTransmitterId = crtc_id; + // TODO : transmitter id is now CRTC id? + args.v3.ucEncoderMode = gDisplay[crtc_id]->connection_type; break; - #endif default: - TRACE("%s: TODO: table version %d %d\n", __func__, frev, crev); + TRACE("%s: ERROR: table version %d.%d TODO\n", __func__, + frev, crev); return B_ERROR; } + TRACE("%s: setting pixel clock %" B_PRIu32 "\n", __func__, pixelClock); + atom_execute_table(gAtomContext, index, (uint32 *)&args); - #if 0 - if (info.device_chipset >= (RADEON_R600 | 0x20)) { - TRACE("%s : setting pixel clock %d on r620+\n", __func__, - (int)pixelClock); - PLLSetLowR620(pllIndex, pixelClock, reference, - feedback, post); - } else if (info.device_chipset < (RADEON_R600 | 0x20)) { - TRACE("%s : setting pixel clock %d on r600-r610\n", __func__, - (int)pixelClock); - PLLSetLowLegacy(pllIndex, pixelClock, reference, - feedback, post); - } - #endif - return B_OK; } - - -void -PLLSetLowLegacy(uint8 pllIndex, uint32 pixelClock, uint16 reference, - uint16 feedback, uint16 post) -{ - uint32 feedbackTemp = feedback << 16; - uint32 referenceTemp = reference; - - /* Internal PLL Registers */ - uint16 pllCntl = pllIndex == 1 ? P2PLL_CNTL : P1PLL_CNTL; - uint16 pllIntSSCntl - = pllIndex == 1 ? P2PLL_INT_SS_CNTL : P1PLL_INT_SS_CNTL; - - /* External PLL Registers */ - uint16 pllExtCntl - = pllIndex == 1 ? EXT2_PPLL_CNTL : EXT1_PPLL_CNTL; - uint16 pllExtUpdateCntl - = pllIndex == 1 ? EXT2_PPLL_UPDATE_CNTL : EXT1_PPLL_UPDATE_CNTL; - uint16 pllExtUpdateLock - = pllIndex == 1 ? EXT2_PPLL_UPDATE_LOCK : EXT1_PPLL_UPDATE_LOCK; - uint16 pllExtPostDiv - = pllIndex == 1 ? EXT2_PPLL_POST_DIV : EXT1_PPLL_POST_DIV; - uint16 pllExtPostDivSrc - = pllIndex == 1 ? EXT2_PPLL_POST_DIV_SRC : EXT1_PPLL_POST_DIV_SRC; - uint16 pllExtFeedbackDiv - = pllIndex == 1 ? EXT2_PPLL_FB_DIV : EXT1_PPLL_FB_DIV; - uint16 pllExtRefDiv - = pllIndex == 1 ? EXT2_PPLL_REF_DIV : EXT1_PPLL_REF_DIV; - uint16 pllExtRefDivSrc - = pllIndex == 1 ? EXT2_PPLL_REF_DIV_SRC : EXT1_PPLL_REF_DIV_SRC; - - radeon_shared_info &info = *gInfo->shared_info; - - if (info.device_chipset <= RADEON_R600) - feedbackTemp |= 0x00000030; - else { - if (feedback <= 0x24) - feedbackTemp |= 0x00000030; - else if (feedback <= 0x3F) - feedbackTemp |= 0x00000020; - } - - uint32 postTemp = Read32(PLL, pllExtPostDiv) & ~0x0000007F; - postTemp |= post & 0x0000007F; - - uint32 control; - if (info.device_chipset == RADEON_R600) - control = 0x01130704; - else { - control = PLLControlTable(RV610PLLControl, feedback); - if (!control) - control = Read32(PLL, pllExtCntl); - } - - Write32Mask(PLL, pllIntSSCntl, 0, 0x00000001); - // Disable Spread Spectrum - - Write32(PLL, pllExtRefDivSrc, 0x01); /* XTAL */ - Write32(PLL, pllExtPostDivSrc, 0x00); /* source = reference */ - - Write32(PLL, pllExtUpdateLock, 0x01); /* lock */ - - Write32(PLL, pllExtRefDiv, referenceTemp); - Write32(PLL, pllExtFeedbackDiv, feedbackTemp); - Write32(PLL, pllExtPostDiv, postTemp); - Write32(PLL, pllExtCntl, control); - - Write32Mask(PLL, pllExtUpdateCntl, 0x00010000, 0x00010000); - // No autoreset - Write32Mask(PLL, pllCntl, 0, 0x04); - // Don't bypass calibration - - /* We need to reset the anti glitch logic */ - Write32Mask(PLL, pllCntl, 0, 0x00000002); - // Power up - - /* reset anti glitch logic */ - Write32Mask(PLL, pllCntl, 0x00002000, 0x00002000); - snooze(2); - Write32Mask(PLL, pllCntl, 0, 0x00002000); - - /* powerdown and reset */ - Write32Mask(PLL, pllCntl, 0x00000003, 0x00000003); - snooze(2); - - Write32(PLL, pllExtUpdateLock, 0); - // Unlock - Write32Mask(PLL, pllExtUpdateCntl, 0, 0x01); - // Done updating - - Write32Mask(PLL, pllCntl, 0, 0x02); - // Power up PLL - snooze(2); - - PLLCalibrate(pllIndex); - - Write32(PLL, pllExtPostDivSrc, 0x01); - // Set source as PLL - - // TODO : for now we assume crt 0, needs refactoring - PLLCRTCGrab(pllIndex, 0); -} - - -void -PLLSetLowR620(uint8 pllIndex, uint32 pixelClock, uint16 reference, - uint16 feedback, uint16 post) -{ - radeon_shared_info &info = *gInfo->shared_info; - - bool hasDccg = DCCGCLKAvailable(pllIndex); - - TRACE("%s: card has DCCG = %c\n", __func__, hasDccg ? 'y' : 'n'); - - if (hasDccg) - DCCGCLKSet(pllIndex, RV620_DCCGCLK_RESET); - - /* Internal PLL Registers */ - uint16 pllCntl = pllIndex == 1 ? P2PLL_CNTL : P1PLL_CNTL; - uint16 pllIntSSCntl - = pllIndex == 1 ? P2PLL_INT_SS_CNTL : P1PLL_INT_SS_CNTL; - - /* External PLL Registers */ - uint16 pllExtCntl - = pllIndex == 1 ? EXT2_PPLL_CNTL : EXT1_PPLL_CNTL; - //uint16 pllExtUpdateCntl - // = pllIndex == 1 ? EXT2_PPLL_UPDATE_CNTL : EXT1_PPLL_UPDATE_CNTL; - uint16 pllExtUpdateLock - = pllIndex == 1 ? EXT2_PPLL_UPDATE_LOCK : EXT1_PPLL_UPDATE_LOCK; - uint16 pllExtPostDiv - = pllIndex == 1 ? EXT2_PPLL_POST_DIV : EXT1_PPLL_POST_DIV; - uint16 pllExtPostDivSrc - = pllIndex == 1 ? EXT2_PPLL_POST_DIV_SRC : EXT1_PPLL_POST_DIV_SRC; - uint16 pllExtPostDivSym - = pllIndex == 1 ? EXT2_SYM_PPLL_POST_DIV : EXT1_SYM_PPLL_POST_DIV; - uint16 pllExtFeedbackDiv - = pllIndex == 1 ? EXT2_PPLL_FB_DIV : EXT1_PPLL_FB_DIV; - uint16 pllExtRefDiv - = pllIndex == 1 ? EXT2_PPLL_REF_DIV : EXT1_PPLL_REF_DIV; - //uint16 pllExtRefDivSrc - // = pllIndex == 1 ? EXT2_PPLL_REF_DIV_SRC : EXT1_PPLL_REF_DIV_SRC; - uint16 pllExtDispClkCntl - = pllIndex == 1 ? P2PLL_DISP_CLK_CNTL : P1PLL_DISP_CLK_CNTL; - - Write32Mask(PLL, pllIntSSCntl, 0, 0x00000001); - // Disable Spread Spectrum - - uint32 referenceDivider = reference; - - uint32 feedbackDivider = Read32(PLL, pllExtFeedbackDiv) & ~0x07FF003F; - feedbackDivider |= ((feedback << 16) | 0x0030) & 0x07FF003F; - - uint32 postDivider = Read32(PLL, pllExtPostDiv) & ~0x0000007F; - postDivider |= post & 0x0000007F; - - uint32 control; - - if (info.device_chipset >= (RADEON_R600 | 0x70)) - control = PLLControlTable(RV670PLLControl, feedback); - else - control = PLLControlTable(RV610PLLControl, feedback); - - uint8 symPostDiv = post & 0x0000007F; - - /* switch to external */ - Write32(PLL, pllExtPostDivSrc, 0); - Write32Mask(PLL, pllExtDispClkCntl, 0x00000200, 0x00000300); - Write32Mask(PLL, pllExtPostDiv, 0, 0x00000100); - - Write32Mask(PLL, pllCntl, 0x00000001, 0x00000001); - // reset - snooze(2); - Write32Mask(PLL, pllCntl, 0x00000002, 0x00000002); - // power down - snooze(10); - Write32Mask(PLL, pllCntl, 0x00002000, 0x00002000); - // reset antiglitch - - Write32(PLL, pllExtCntl, control); - - Write32Mask(PLL, pllExtDispClkCntl, 2, 0x0000003F); - // Scalar Divider 2 - - Write32(PLL, pllExtUpdateLock, 1); - // Lock PLL - - /* Write PLL clocks */ - Write32(PLL, pllExtPostDivSrc, 0x00000001); - Write32(PLL, pllExtRefDiv, referenceDivider); - Write32(PLL, pllExtFeedbackDiv, feedbackDivider); - Write32Mask(PLL, pllExtPostDiv, postDivider, 0x0000007F); - Write32Mask(PLL, pllExtPostDivSym, symPostDiv, 0x0000007F); - - snooze(10); - - Write32(PLL, pllExtUpdateLock, 0); - // Unlock PLL - - Write32Mask(PLL, pllCntl, 0, 0x00000002); - // power up - snooze(10); - - Write32Mask(PLL, pllCntl, 0, 0x00002000); - // undo reset antiglitch - - PLLCalibrate(pllIndex); - - /* Switch back to PLL */ - Write32Mask(PLL, pllExtDispClkCntl, 0, 0x00000300); - Write32Mask(PLL, pllExtPostDivSym, 0x00000100, 0x00000100); - Write32(PLL, pllExtPostDivSrc, 0x00000001); - - Write32Mask(PLL, pllCntl, 0, 0x80000000); - // needed and undocumented - - // TODO : for now we assume crt 0, needs refactoring - PLLCRTCGrab(pllIndex, 0); - - if (hasDccg) - DCCGCLKSet(pllIndex, RV620_DCCGCLK_GRAB); - - TRACE("%s: PLLSet exit\n", __func__); -} - - -status_t -PLLCalibrate(uint8 pllIndex) -{ - uint16 pllControlReg = pllIndex == 1 ? P2PLL_CNTL : P1PLL_CNTL; - - Write32Mask(PLL, pllControlReg, 1, 0x01); - // PLL Reset - - snooze(2); - - Write32Mask(PLL, pllControlReg, 0, 0x01); - // PLL Set - - int i; - - for (i = 0; i < PLL_CALIBRATE_WAIT; i++) { - if (((Read32(PLL, pllControlReg) >> 20) & 0x03) == 0x03) - break; - } - - if (i >= PLL_CALIBRATE_WAIT) { - if (Read32(PLL, pllControlReg) & 0x00100000) /* Calibration done? */ - TRACE("%s: Calibration Failed\n", __func__); - if (Read32(PLL, pllControlReg) & 0x00200000) /* PLL locked? */ - TRACE("%s: Locking Failed\n", __func__); - TRACE("%s: We encountered a problem calibrating the PLL.\n", __func__); - return B_ERROR; - } else - TRACE("%s: pll calibrated and locked in %d loops\n", __func__, i); - - return B_OK; -} - - -void -PLLCRTCGrab(uint8 pllIndex, uint8 crtid) -{ - bool pll2IsCurrent; - - if (crtid == 0) { - pll2IsCurrent = Read32(PLL, PCLK_CRTC1_CNTL) & 0x00010000; - - Write32Mask(PLL, PCLK_CRTC1_CNTL, pllIndex == 0 ? 0x00010000 : 0, - 0x00010000); - } else { - pll2IsCurrent = Read32(PLL, PCLK_CRTC2_CNTL) & 0x00010000; - - Write32Mask(PLL, PCLK_CRTC2_CNTL, pllIndex == 0 ? 0x00010000 : 0, - 0x00010000); - } - - /* if the current pll is not active, then poke it just enough to flip - * owners */ - if (!pll2IsCurrent) { - uint32 stored = Read32(PLL, P1PLL_CNTL); - - if (stored & 0x03) { - Write32Mask(PLL, P1PLL_CNTL, 0, 0x03); - snooze(10); - Write32Mask(PLL, P1PLL_CNTL, stored, 0x03); - } - - } else { - uint32 stored = Read32(PLL, P2PLL_CNTL); - - if (stored & 0x03) { - Write32Mask(PLL, P2PLL_CNTL, 0, 0x03); - snooze(10); - Write32Mask(PLL, P2PLL_CNTL, stored, 0x03); - } - } -} - - -// See if card has a DCCG available that we need to lock to -// the PLL clock. No one seems really sure what DCCG is. -bool -DCCGCLKAvailable(uint8 pllIndex) -{ - radeon_shared_info &info = *gInfo->shared_info; - - if (info.device_chipset < (RADEON_R600 | 0x20)) - return false; - - uint32 dccg = Read32(PLL, DCCG_DISP_CLK_SRCSEL) & 0x03; - - if (dccg & 0x02) - return true; - - if ((pllIndex == 0) && (dccg == 0)) - return true; - if ((pllIndex == 1) && (dccg == 1)) - return true; - - return false; -} - - -void -DCCGCLKSet(uint8 pllIndex, int set) -{ - uint32 buffer; - - switch(set) { - case RV620_DCCGCLK_GRAB: - if (pllIndex == 0) - Write32Mask(PLL, DCCG_DISP_CLK_SRCSEL, 0, 0x00000003); - else if (pllIndex == 1) - Write32Mask(PLL, DCCG_DISP_CLK_SRCSEL, 1, 0x00000003); - else - Write32Mask(PLL, DCCG_DISP_CLK_SRCSEL, 3, 0x00000003); - break; - case RV620_DCCGCLK_RELEASE: - buffer = Read32(PLL, DCCG_DISP_CLK_SRCSEL) & 0x03; - - if ((pllIndex == 0) && (buffer == 0)) { - /* set to other PLL or external */ - buffer = Read32(PLL, P2PLL_CNTL); - // if powered and not in reset, and calibrated and locked - if (!(buffer & 0x03) && ((buffer & 0x00300000) == 0x00300000)) - Write32Mask(PLL, DCCG_DISP_CLK_SRCSEL, 1, 0x00000003); - else - Write32Mask(PLL, DCCG_DISP_CLK_SRCSEL, 3, 0x00000003); - - } else if ((pllIndex == 1) && (buffer == 1)) { - /* set to other PLL or external */ - buffer = Read32(PLL, P1PLL_CNTL); - // if powered and not in reset, and calibrated and locked - if (!(buffer & 0x03) && ((buffer & 0x00300000) == 0x00300000)) - Write32Mask(PLL, DCCG_DISP_CLK_SRCSEL, 0, 0x00000003); - else - Write32Mask(PLL, DCCG_DISP_CLK_SRCSEL, 3, 0x00000003); - - } // no other action needed - break; - case RV620_DCCGCLK_RESET: - buffer = Read32(PLL, DCCG_DISP_CLK_SRCSEL) & 0x03; - - if (((pllIndex == 0) && (buffer == 0)) - || ((pllIndex == 1) && (buffer == 1))) - Write32Mask(PLL, DCCG_DISP_CLK_SRCSEL, 3, 0x00000003); - break; - default: - break; - } -} diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index 8817994911..144ab1adc6 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -9,42 +9,25 @@ #define RADEON_HD_PLL_H -#define RHD_PLL_MIN_DEFAULT 16000 -#define RHD_PLL_MAX_DEFAULT 400000 -#define RHD_PLL_REFERENCE_DEFAULT 27000 +#define MAX_TOLERANCE 10 -// xorg default is 0x100000 which seems a little much. -#define PLL_CALIBRATE_WAIT 0x010000 +#define PLL_MIN_DEFAULT 16000 +#define PLL_MAX_DEFAULT 400000 +#define PLL_REFERENCE_DEFAULT 27000 /* limited by the number of bits available */ +#define FB_DIV_MIN 4 #define FB_DIV_LIMIT 2048 +#define REF_DIV_MIN 2 #define REF_DIV_LIMIT 1024 -#define POST_DIV_LIMIT 128 - -// DCCGClk Operation Modes -#define RV620_DCCGCLK_RESET 0 -#define RV620_DCCGCLK_GRAB 1 -#define RV620_DCCGCLK_RELEASE 2 +#define POST_DIV_MIN 2 +#define POST_DIV_LIMIT 127 -struct PLL_Control { - uint16 feedbackDivider; // 0xFFFF is the endmarker - uint32 control; -}; - - -status_t PLLCalculate(uint32 pixelClock, uint16 *reference, uint16 *feedback, - uint16 *post); +status_t pll_compute(uint32 pixelClock, uint32 *dotclockOut, + uint32 *referenceOut, uint32 *feedbackOut, uint32 *feedbackFracOut, + uint32 *postOut); status_t pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id); -void PLLSetLowLegacy(uint8 pllIndex, uint32 pixelClock, uint16 reference, - uint16 feedback, uint16 post); -void PLLSetLowR620(uint8 pllIndex, uint32 pixelClock, uint16 reference, - uint16 feedback, uint16 post); -status_t PLLPower(uint8 pllIndex, int command); -status_t PLLCalibrate(uint8 pllIndex); -void PLLCRTCGrab(uint8 pllIndex, uint8 crtid); -bool DCCGCLKAvailable(uint8 pllIndex); -void DCCGCLKSet(uint8 pllIndex, int set); #endif /* RADEON_HD_PLL_H */ diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 5d5fa8b7c1..c7dddb1690 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -107,7 +107,7 @@ const struct supported_device { // From here on AMD no longer used numeric identifiers - // R1000 series (HD54xx - HD59xx) + // R1000 series (HD54xx - HD63xx) // Codename: Evergreen // Cedar {0x68e1, RADEON_R1000 | 0x00, false, "Radeon HD 5430"}, @@ -128,6 +128,12 @@ const struct supported_device { {0x6898, RADEON_R1000 | 0x30, false, "Radeon HD 5870"}, // Hemlock {0x689c, RADEON_R1000 | 0x40, false, "Radeon HD 5900"}, + // Fusion APUS + // Palms + {0x9804, RADEON_R1000 | 0x50, true, "Radeon HD 6250"}, + {0x9805, RADEON_R1000 | 0x50, true, "Radeon HD 6290"}, + {0x9802, RADEON_R1000 | 0x50, true, "Radeon HD 6310"}, + {0x9803, RADEON_R1000 | 0x50, true, "Radeon HD 6310"}, // R2000 series (HD64xx - HD69xx) // Codename: Nothern Islands From c9991cca23ac3c96f381329a856eb57bebe01898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 20 Aug 2011 09:17:11 +0000 Subject: [PATCH 193/702] * Set the real name to the current user's real name by default. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42645 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/mail/AutoConfigView.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/preferences/mail/AutoConfigView.cpp b/src/preferences/mail/AutoConfigView.cpp index 37a9d3599c..b4e57c3fba 100644 --- a/src/preferences/mail/AutoConfigView.cpp +++ b/src/preferences/mail/AutoConfigView.cpp @@ -7,6 +7,8 @@ #include "AutoConfigView.h" +#include + #include #include #include @@ -85,6 +87,10 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config) B_TRANSLATE("Real name:"), "", NULL); AddChild(fNameView); fNameView->SetDivider(divider); + + struct passwd* passwd = getpwent(); + if (passwd != NULL) + fNameView->SetText(passwd->pw_gecos); } From 480a26bc39af134bfcdadb03d40d049d02f00c31 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 20 Aug 2011 13:56:43 +0000 Subject: [PATCH 194/702] Update icu packages again: * update icu packages for x86 in order to incorporate a fix * add updated icu package for ppc, too git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42646 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalBuildFeatures | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index c74bcd3cea..32f1b269fd 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -56,13 +56,11 @@ if $(HAIKU_BUILD_FEATURE_SSL) { # ICU # Note ICU isn't actually optional, but is still an external package -HAIKU_ICU_GCC_2_PACKAGE = icu-4.8.1-x86-gcc2-2011-08-18.zip ; -HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1-x86-gcc4-2011-08-18.zip ; +HAIKU_ICU_GCC_2_PACKAGE = icu-4.8.1-x86-gcc2-2011-08-20.zip ; +HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1-x86-gcc4-2011-08-20.zip ; +HAIKU_ICU_PPC_PACKAGE = icu-4.8.1-ppc-2011-08-20.zip ; HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-2011-08-18.zip ; -# TODO: this needs to be upgraded before ICU can be used on PPC! -HAIKU_ICU_PPC_PACKAGE = icu-4.4.1-ppc-2010-08-17.zip ; - if $(TARGET_ARCH) = ppc { local icu_package = $(HAIKU_ICU_PPC_PACKAGE) ; local zipFile = [ DownloadFile $(icu_package) @@ -107,19 +105,12 @@ if $(TARGET_ARCH) = ppc { # extract libraries HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR) : - libicudata.so.48 libicudata.so.48.1 - libicui18n.so.48 libicui18n.so.48.1 - libicuio.so.48 libicuio.so.48.1 - libicule.so.48 libicule.so.48.1 - libiculx.so.48 libiculx.so.48.1 - libicutu.so.48 libicutu.so.48.1 - libicuuc.so.48 libicuuc.so.48.1 : $(zipFile) : extracted-icu From 11390ce01066c914a90522c71a75a3283f2c6d87 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 20 Aug 2011 14:29:06 +0000 Subject: [PATCH 195/702] * correction to AtomBIOS register loopback calls * cail calls have their registers multiplied by 4 * solves infinite loops git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42647 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.h | 15 +++++++++++++++ src/add-ons/accelerants/radeon_hd/bios.cpp | 14 ++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index ffb9152e8f..1ba3fc0fdf 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -181,6 +181,21 @@ _write32(uint32 offset, uint32 value) } +// AtomBIOS cail register calls (are *4... no clue why) +inline uint32 +Read32Cail(uint32 offset) +{ + return _read32(offset * 4); +} + + +inline void +Write32Cail(uint32 offset, uint32 value) +{ + _write32(offset * 4, value); +} + + inline uint32 Read32(uint32 subsystem, uint32 offset) { diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 242e487e4e..57ad8ec283 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -124,8 +124,8 @@ radeon_init_bios(uint8* bios) if (!atom_card_info) return B_NO_MEMORY; - atom_card_info->reg_read = _read32; - atom_card_info->reg_write = _write32; + atom_card_info->reg_read = Read32Cail; + atom_card_info->reg_write = Write32Cail; if (false) { // TODO : if rio_mem, use ioreg @@ -133,8 +133,8 @@ radeon_init_bios(uint8* bios) //atom_card_info->ioreg_write = cail_ioreg_write; } else { TRACE("%s: Cannot find PCI I/O BAR; using MMIO\n", __func__); - atom_card_info->ioreg_read = _read32; - atom_card_info->ioreg_write = _write32; + atom_card_info->ioreg_read = Read32Cail; + atom_card_info->ioreg_write = Write32Cail; } atom_card_info->mc_read = _read32; atom_card_info->mc_write = _write32; @@ -159,6 +159,11 @@ radeon_init_bios(uint8* bios) radeon_bios_init_scratch(); atom_allocate_fb_scratch(gAtomContext); + // TODO : Always post bios for now... not doing this + // at a later date may save boot time + atom_asic_init(gAtomContext); + + #if 0 // post card atombios if needed if (!radeon_bios_isposted()) { TRACE("%s: init AtomBIOS for this card as it is not not posted\n", @@ -169,6 +174,7 @@ radeon_init_bios(uint8* bios) TRACE("%s: AtomBIOS is already posted\n", __func__); } + #endif return B_OK; } From d29d58edea46b77c78722316bab366692caf9691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sat, 20 Aug 2011 17:46:50 +0000 Subject: [PATCH 196/702] Disable interrupts when updating real time clock. Fixes #7872. Seems to have been introduced in r42116. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42648 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/timer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/timer.cpp b/src/system/kernel/timer.cpp index 3f626c9eeb..50aed760cc 100644 --- a/src/system/kernel/timer.cpp +++ b/src/system/kernel/timer.cpp @@ -94,7 +94,7 @@ static void per_cpu_real_time_clock_changed(void*, int cpu) { per_cpu_timer_data& cpuData = sPerCPU[cpu]; - SpinLocker cpuDataLocker(cpuData.lock); + InterruptsSpinLocker cpuDataLocker(cpuData.lock); bigtime_t realTimeOffset = rtc_boot_time(); if (realTimeOffset == cpuData.real_time_offset) From fefa98aaf82ddf54cf0f76500a9717e1cad4203d Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 20 Aug 2011 18:38:20 +0000 Subject: [PATCH 197/702] Translate all regions in Time prefs git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42649 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/preferences/time/de.catkeys | 10 +++ src/preferences/time/ZoneView.cpp | 84 ++++++++++++++--------- 2 files changed, 61 insertions(+), 33 deletions(-) diff --git a/data/catalogs/preferences/time/de.catkeys b/data/catalogs/preferences/time/de.catkeys index 35c6893bbe..c9ac3d0107 100644 --- a/data/catalogs/preferences/time/de.catkeys +++ b/data/catalogs/preferences/time/de.catkeys @@ -1,17 +1,27 @@ 1 german x-vnd.Haiku-Time 453699369 Time Add Time Hinzu +Africa Time Afrika +America Time Amerika +Antarctica Time Antarktis +Arctic Time Arktis +Asia Time Asien +Atlantic Time Atlantik +Australia Time Australien Could not contact server Time Server konnte nicht erreicht werden Could not create socket Time Socket konnte nicht erzeugt werden Current time: Time Aktuelle Zeit: Date and time Time Datum und Zeit Etc Time Etc +Europe Time Europa GMT Time GMT Hardware clock set to: Time Hardware-Uhr gestellt auf: +Indian Time Indischer Ozean Local time Time Lokale Zeit Message receiving failed Time Nachricht wurde nicht erhalten Network time Time Netzwerkzeit OK Time OK +Pacific Time Pazifik Preview time: Time Vorschau-Zeit: Received invalid time Time Ungültige Zeit erhalten Remove Time Entfernen diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index d8b59e9eec..341ea3876e 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -279,14 +279,30 @@ TimeZoneView::_BuildZoneMenu() * and add an additional region with generic GMT-offset timezones at the end */ typedef std::map ZoneItemMap; - ZoneItemMap zoneMap; - const char* kOtherRegion = B_TRANSLATE(""); + ZoneItemMap zoneItemMap; + const char* kOtherRegion = B_TRANSLATE_MARK(""); const char* kSupportedRegions[] = { - "Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic", - "Australia", "Europe", "Indian", "Pacific", kOtherRegion, NULL + B_TRANSLATE_MARK("Africa"), B_TRANSLATE_MARK("America"), + B_TRANSLATE_MARK("Antarctica"), B_TRANSLATE_MARK("Arctic"), + B_TRANSLATE_MARK("Asia"), B_TRANSLATE_MARK("Atlantic"), + B_TRANSLATE_MARK("Australia"), B_TRANSLATE_MARK("Europe"), + B_TRANSLATE_MARK("Indian"), B_TRANSLATE_MARK("Pacific"), + kOtherRegion, + NULL }; - for (const char** region = kSupportedRegions; *region != NULL; ++region) - zoneMap[*region] = NULL; + // Since the zone-map contains translated country-names (we get those from + // ICU), we need to use translated region names in the zone-map, too: + typedef std::map TranslatedRegionMap; + TranslatedRegionMap regionMap; + for (const char** region = kSupportedRegions; *region != NULL; ++region) { + BString translatedRegion = B_TRANSLATE_NOCOLLECT(*region); + regionMap[*region] = translatedRegion; + + TimeZoneListItem* regionItem + = new TimeZoneListItem(translatedRegion, NULL, NULL); + regionItem->SetOutlineLevel(0); + zoneItemMap[translatedRegion] = regionItem; + } BString countryCode; for (int c = 0; countryList.FindString("country", c, &countryCode) @@ -324,22 +340,18 @@ TimeZoneView::_BuildZoneMenu() continue; } - // just accept timezones from "proper" regions, others are aliases - ZoneItemMap::iterator regionIter = zoneMap.find(region); - if (regionIter == zoneMap.end()) + // just accept timezones from our supported regions, others are + // aliases and would just make the list even longer + TranslatedRegionMap::iterator regionIter = regionMap.find(region); + if (regionIter == zoneItemMap.end()) continue; + const BString& regionName = regionIter->second; - BString fullCountryID = region; - if (countryName != region) + BString fullCountryID = regionName; + bool countryIsRegion = countryName == regionName; + if (!countryIsRegion) fullCountryID << "/" << countryName; - TimeZoneListItem* regionItem = regionIter->second; - if (regionItem == NULL) { - regionItem = new TimeZoneListItem(region, NULL, NULL); - regionItem->SetOutlineLevel(0); - zoneMap[region] = regionItem; - } - BTimeZone* timeZone = new BTimeZone(zoneID, &language); BString tzName = timeZone->Name(); if (tzName == "GMT+00:00") @@ -356,8 +368,8 @@ TimeZoneView::_BuildZoneMenu() fullZoneID << "/" << tzName; // skip duplicates - ZoneItemMap::iterator zoneIter = zoneMap.find(fullZoneID); - if (zoneIter != zoneMap.end()) { + ZoneItemMap::iterator zoneIter = zoneItemMap.find(fullZoneID); + if (zoneIter != zoneItemMap.end()) { delete timeZone; continue; } @@ -365,28 +377,32 @@ TimeZoneView::_BuildZoneMenu() TimeZoneListItem* countryItem = NULL; TimeZoneListItem* zoneItem = NULL; if (count > 1 && countryName.Length() > 0) { - ZoneItemMap::iterator countryIter = zoneMap.find(fullCountryID); - if (countryIter == zoneMap.end()) { + ZoneItemMap::iterator countryIter + = zoneItemMap.find(fullCountryID); + if (countryIter == zoneItemMap.end()) { countryItem = new TimeZoneListItem(countryName, NULL, NULL); countryItem->SetOutlineLevel(1); - zoneMap[fullCountryID] = countryItem; + zoneItemMap[fullCountryID] = countryItem; } else countryItem = countryIter->second; zoneItem = new TimeZoneListItem(tzName, NULL, timeZone); - zoneItem->SetOutlineLevel(2); + zoneItem->SetOutlineLevel(countryIsRegion ? 1 : 2); } else { BString& name = countryName.Length() > 0 ? countryName : tzName; zoneItem = new TimeZoneListItem(name, NULL, timeZone); zoneItem->SetOutlineLevel(1); } - zoneMap[fullZoneID] = zoneItem; + zoneItemMap[fullZoneID] = zoneItem; if (timeZone->ID() == defaultTimeZone.ID()) { fCurrentZoneItem = zoneItem; if (countryItem != NULL) countryItem->SetExpanded(true); - regionItem->SetExpanded(true); + ZoneItemMap::iterator regionItemIter + = zoneItemMap.find(regionName); + if (regionItemIter != zoneItemMap.end()) + regionItemIter->second->SetExpanded(true); } } } @@ -395,8 +411,9 @@ TimeZoneView::_BuildZoneMenu() ZoneItemMap::iterator zoneIter; bool lastWasCountryItem = false; - TimeZoneListItem* lastCountryItem = NULL; - for (zoneIter = zoneMap.begin(); zoneIter != zoneMap.end(); ++zoneIter) { + TimeZoneListItem* currentCountryItem = NULL; + for (zoneIter = zoneItemMap.begin(); zoneIter != zoneItemMap.end(); + ++zoneIter) { if (zoneIter->second->OutlineLevel() == 2 && lastWasCountryItem) { /* Some countries (e.g. Spain and Chile) have their timezones * spread across different regions. As a result, there might still @@ -405,18 +422,19 @@ TimeZoneView::_BuildZoneMenu() */ ZoneItemMap::iterator next = zoneIter; ++next; - if (next != zoneMap.end() && next->second->OutlineLevel() != 2) { - fZoneList->RemoveItem(lastCountryItem); - zoneIter->second->SetText(lastCountryItem->Text()); + if (next != zoneItemMap.end() + && next->second->OutlineLevel() != 2) { + fZoneList->RemoveItem(currentCountryItem); + zoneIter->second->SetText(currentCountryItem->Text()); zoneIter->second->SetOutlineLevel(1); - delete lastCountryItem; + delete currentCountryItem; } } fZoneList->AddItem(zoneIter->second); if (zoneIter->second->OutlineLevel() == 1) { lastWasCountryItem = true; - lastCountryItem = zoneIter->second; + currentCountryItem = zoneIter->second; } else lastWasCountryItem = false; } From 920e575c03b4817d93424a4ed7bc46a5ed288660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sat, 20 Aug 2011 20:09:32 +0000 Subject: [PATCH 198/702] As suggested by Ingo, revert r42648 and apply patch from Alex Smith provided in #7872. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42650 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/smp.cpp | 10 ++++++---- src/system/kernel/timer.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/system/kernel/smp.cpp b/src/system/kernel/smp.cpp index d241ed0974..899d81c259 100644 --- a/src/system/kernel/smp.cpp +++ b/src/system/kernel/smp.cpp @@ -1266,14 +1266,15 @@ smp_get_current_cpu(void) void call_all_cpus(void (*func)(void*, int), void* cookie) { + cpu_status state = disable_interrupts(); + // if inter-CPU communication is not yet enabled, use the early mechanism if (!sICIEnabled) { call_all_cpus_early(func, cookie); + restore_interrupts(state); return; } - cpu_status state = disable_interrupts(); - if (smp_get_num_cpus() > 1) { smp_send_broadcast_ici(SMP_MSG_CALL_FUNCTION, (uint32)cookie, 0, 0, (void*)func, SMP_MSG_FLAG_ASYNC); @@ -1289,14 +1290,15 @@ call_all_cpus(void (*func)(void*, int), void* cookie) void call_all_cpus_sync(void (*func)(void*, int), void* cookie) { + cpu_status state = disable_interrupts(); + // if inter-CPU communication is not yet enabled, use the early mechanism if (!sICIEnabled) { call_all_cpus_early(func, cookie); + restore_interrupts(state); return; } - cpu_status state = disable_interrupts(); - if (smp_get_num_cpus() > 1) { smp_send_broadcast_ici(SMP_MSG_CALL_FUNCTION, (uint32)cookie, 0, 0, (void*)func, SMP_MSG_FLAG_SYNC); diff --git a/src/system/kernel/timer.cpp b/src/system/kernel/timer.cpp index 50aed760cc..3f626c9eeb 100644 --- a/src/system/kernel/timer.cpp +++ b/src/system/kernel/timer.cpp @@ -94,7 +94,7 @@ static void per_cpu_real_time_clock_changed(void*, int cpu) { per_cpu_timer_data& cpuData = sPerCPU[cpu]; - InterruptsSpinLocker cpuDataLocker(cpuData.lock); + SpinLocker cpuDataLocker(cpuData.lock); bigtime_t realTimeOffset = rtc_boot_time(); if (realTimeOffset == cpuData.real_time_offset) From e621fc319855c67873e3179329a3c7730e6202ba Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 20 Aug 2011 20:36:41 +0000 Subject: [PATCH 199/702] * minor formatting cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42651 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/locale/TimeZone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headers/os/locale/TimeZone.h b/headers/os/locale/TimeZone.h index 28513d888b..ced9e9050a 100644 --- a/headers/os/locale/TimeZone.h +++ b/headers/os/locale/TimeZone.h @@ -46,7 +46,7 @@ public: private: friend class Private; - icu::TimeZone* fICUTimeZone; + icu::TimeZone* fICUTimeZone; icu::Locale* fICULocale; status_t fInitStatus; From 20fbef1e74bcc408c73a88a659f55a7b40105142 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 21 Aug 2011 02:57:07 +0000 Subject: [PATCH 200/702] * a few additions to the PCI ID list git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42652 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index c7dddb1690..cd5bea94b1 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -53,7 +53,13 @@ const struct supported_device { {0x958a, RADEON_R600 | 0x30, false, "Radeon HD 2600 X2"}, // Radeon 2700 - RV630 {0x9400, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x9401, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x9402, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x9403, RADEON_R600 | 0x00, false, "Radeon HD 2900 Pro"}, {0x9405, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x940a, RADEON_R600 | 0x00, false, "Radeon FireGL V8650"}, + {0x940b, RADEON_R600 | 0x00, false, "Radeon FireGL V8600"}, + {0x940f, RADEON_R600 | 0x00, false, "Radeon FireGL V7600"}, {0x9611, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, {0x9613, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, {0x9610, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, @@ -96,7 +102,7 @@ const struct supported_device { {0x9490, RADEON_R700 | 0x30, false, "Radeon HD 4710"}, {0x94b3, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, {0x94b5, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, - {0x944a, RADEON_R700 | 0x70, false, "Radeon HD 4800"}, + {0x944a, RADEON_R700 | 0x70, false, "Radeon HD 4850 Mobile"}, // IGP? {0x944e, RADEON_R700 | 0x70, false, "Radeon HD 4810"}, {0x944c, RADEON_R700 | 0x70, false, "Radeon HD 4830"}, {0x9442, RADEON_R700 | 0x70, false, "Radeon HD 4850"}, From 727c05a5df9b4c29497768f64c2afaf1f54128a5 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sun, 21 Aug 2011 09:36:19 +0000 Subject: [PATCH 201/702] Now always retrieve the team icon from the first B_APP_IMAGE image entry_ref. Using team_info.args as before was not safe: when truncated, the entry_ref could be an intermediate folder, which display a folder icon as team's icon! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42653 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../gui/teams_window/TeamsListView.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp index 8c3a8ebb04..5839d22e8c 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp @@ -229,8 +229,25 @@ TeamRow::_SetTo(team_info& info) get_ref_for_path(kernelPath.Path(), &appInfo.ref); } } else { - BEntry entry(teamInfo.args, true); - entry.GetRef(&appInfo.ref); + // Not an application known to be_roster + + // The teamInfo.args string is not safe and could be truncated. + // This could leads to show an intermediate folder icon! + // + // Let's retrieve instead the entry_ref from the first team's image of + // type B_APP_IMAGE + int32 cookie = 0; + image_info imageInfo; + while (get_next_image_info(teamInfo.team, &cookie, &imageInfo) == B_OK) { + if (imageInfo.type == B_APP_IMAGE) { + BPath imagePath(imageInfo.name); + appInfo.ref.device = imageInfo.device; + appInfo.ref.directory = imageInfo.node; + appInfo.ref.set_name(imagePath.Leaf()); + break; + } + } + } BBitmap* icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1), B_RGBA32); From e32a379a72d866a1ea3d1b0ab5773a64d1f399d1 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 21 Aug 2011 10:03:51 +0000 Subject: [PATCH 202/702] Minor cleanup: match indentation level with styleguide. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42654 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/locale/LanguageListView.h | 67 ++++++++++++----------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/preferences/locale/LanguageListView.h b/src/preferences/locale/LanguageListView.h index ae163896ce..4e78359293 100644 --- a/src/preferences/locale/LanguageListView.h +++ b/src/preferences/locale/LanguageListView.h @@ -19,56 +19,57 @@ class LanguageListItem : public BStringItem { public: - LanguageListItem(const char* text, - const char* id, const char* langCode, - const char* countryCode = NULL); - LanguageListItem(const LanguageListItem& other); - virtual ~LanguageListItem(); + LanguageListItem(const char* text, + const char* id, const char* langCode, + const char* countryCode = NULL); + LanguageListItem(const LanguageListItem& other); + virtual ~LanguageListItem(); - const BString& ID() const { return fID; } - const BString& Code() const { return fCode; } + const BString& ID() const { return fID; } + const BString& Code() const { return fCode; } - virtual void DrawItem(BView* owner, BRect frame, - bool complete = false); + virtual void DrawItem(BView* owner, BRect frame, + bool complete = false); - virtual void Update(BView* owner, const BFont* font); + virtual void Update(BView* owner, const BFont* font); private: - BString fID; - BString fCode; - BBitmap* fIcon; + BString fID; + BString fCode; + BBitmap* fIcon; }; class LanguageListView : public BOutlineListView { public: - LanguageListView(const char* name, - list_view_type type); - virtual ~LanguageListView(); + LanguageListView(const char* name, + list_view_type type); + virtual ~LanguageListView(); - LanguageListItem* ItemForLanguageID(const char* code, - int32* _index = NULL) const; - LanguageListItem* ItemForLanguageCode(const char* code, - int32* _index = NULL) const; + LanguageListItem* ItemForLanguageID(const char* code, + int32* _index = NULL) const; + LanguageListItem* ItemForLanguageCode(const char* code, + int32* _index = NULL) const; - void SetDeleteMessage(BMessage* message); - void SetDragMessage(BMessage* message); + void SetDeleteMessage(BMessage* message); + void SetDragMessage(BMessage* message); - virtual bool InitiateDrag(BPoint point, int32 index, - bool wasSelected); - virtual void MouseMoved(BPoint where, uint32 transit, - const BMessage* dragMessage); - virtual void AttachedToWindow(); - virtual void MessageReceived(BMessage* message); - virtual void KeyDown(const char* bytes, int32 numBytes); + virtual bool InitiateDrag(BPoint point, int32 index, + bool wasSelected); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* dragMessage); + virtual void AttachedToWindow(); + virtual void MessageReceived(BMessage* message); + virtual void KeyDown(const char* bytes, int32 numBytes); private: - bool _AcceptsDragMessage(const BMessage* message) const; + bool _AcceptsDragMessage( + const BMessage* message) const; private: - int32 fDropIndex; - BMessage* fDeleteMessage; - BMessage* fDragMessage; + int32 fDropIndex; + BMessage* fDeleteMessage; + BMessage* fDragMessage; }; From 5b059ce37838a11fa7786ee276cb6cce169c2098 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 21 Aug 2011 10:20:15 +0000 Subject: [PATCH 203/702] Drop TODO since the commented code doesn't have any effect and nothing else seems to be missing either. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42655 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/locale/LanguageListView.cpp | 24 +-------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/preferences/locale/LanguageListView.cpp b/src/preferences/locale/LanguageListView.cpp index 81648eed5f..7c50c7e92d 100644 --- a/src/preferences/locale/LanguageListView.cpp +++ b/src/preferences/locale/LanguageListView.cpp @@ -353,30 +353,8 @@ LanguageListView::MouseMoved(BPoint where, uint32 transit, int32 index = FullListIndexOf(where); if (index < 0) index = FullListCountItems(); - if (fDropIndex != index) { + if (fDropIndex != index) fDropIndex = index; - if (fDropIndex >= 0) { -// TODO: find out what this was intended for (as it doesn't have any effect) -// int32 count = FullListCountItems(); -// if (fDropIndex == count) { -// BRect r; -// if (FullListItemAt(count - 1)) { -// r = ItemFrame(count - 1); -// r.top = r.bottom; -// r.bottom = r.top + 1.0; -// } else { -// r = Bounds(); -// r.bottom--; -// // compensate for scrollbars moved slightly -// // out of window -// } -// } else { -// BRect r = ItemFrame(fDropIndex); -// r.top--; -// r.bottom = r.top + 1.0; -// } - } - } break; } } From 283db26d5c13815ee18d3b4a9a51789db2fa98d2 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 21 Aug 2011 12:45:12 +0000 Subject: [PATCH 204/702] * FreeBSD compatibility layer for network drivers is modified to handle NULL-terminated list of driver_t* entries instead of single entry. That allows to combine multiple FreeBSD drivers into single Haiku driver add-ons; * Support for DEC 21140 (Tulip) chipsets (provided by the 'de' driver) incorporated into dec21xxx driver. That brings network connectivity to Haiku systems running in MS Virtual PC VMs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42658 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/network/dec21xxx/dev/Jamfile | 1 + .../drivers/network/dec21xxx/dev/dc/Jamfile | 3 +- .../drivers/network/dec21xxx/dev/dc/glue.c | 69 +- .../drivers/network/dec21xxx/dev/de/Jamfile | 18 + .../network/dec21xxx/dev/de/dc21040reg.h | 583 ++ .../drivers/network/dec21xxx/dev/de/glue.c | 66 + .../drivers/network/dec21xxx/dev/de/if_de.c | 5034 +++++++++++++++++ .../network/dec21xxx/dev/de/if_devar.h | 934 +++ .../freebsd_network/compat/sys/haiku-module.h | 53 +- src/libs/compat/freebsd_network/driver.c | 86 +- 10 files changed, 6790 insertions(+), 57 deletions(-) create mode 100644 src/add-ons/kernel/drivers/network/dec21xxx/dev/de/Jamfile create mode 100644 src/add-ons/kernel/drivers/network/dec21xxx/dev/de/dc21040reg.h create mode 100644 src/add-ons/kernel/drivers/network/dec21xxx/dev/de/glue.c create mode 100644 src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_de.c create mode 100644 src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_devar.h diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/Jamfile b/src/add-ons/kernel/drivers/network/dec21xxx/dev/Jamfile index 155a4cdccb..51d88d94d0 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/Jamfile +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/Jamfile @@ -2,3 +2,4 @@ SubDir HAIKU_TOP src add-ons kernel drivers network dec21xxx dev ; SubInclude HAIKU_TOP src add-ons kernel drivers network dec21xxx dev mii ; SubInclude HAIKU_TOP src add-ons kernel drivers network dec21xxx dev dc ; +SubInclude HAIKU_TOP src add-ons kernel drivers network dec21xxx dev de ; diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/Jamfile b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/Jamfile index c4da39c098..51b38b1471 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/Jamfile +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/Jamfile @@ -1,6 +1,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers network dec21xxx dev dc ; UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ; +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ; UsePrivateHeaders net ; @@ -11,5 +12,5 @@ SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] ; KernelAddon dec21xxx : if_dc.c glue.c - : libfreebsd_network.a dec21xxx_mii.a + : libfreebsd_network.a dec21xxx_mii.a dec21xxx_de.a ; diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/glue.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/glue.c index 60160c0e7e..aaaac1e596 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/glue.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/glue.c @@ -1,6 +1,10 @@ /* - * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All Rights Reserved. + * Copyright 2011, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. + * + * Author(s): + * Axel Dörfler + * Siarzhuk Zharski */ @@ -8,20 +12,33 @@ #include #include #include +#include #include "if_dcreg.h" -HAIKU_FBSD_DRIVER_GLUE(dec21xxx, dc, pci) +HAIKU_FBSD_DRIVERS_GLUE(dec21xxx); HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE | FBSD_SWI_TASKQUEUE); +extern driver_t *DRIVER_MODULE_NAME(dc, pci); +extern driver_t *DRIVER_MODULE_NAME(de, pci); + +status_t __haiku_handle_fbsd_drivers_list(status_t (*handler)(driver_t *[])) +{ + driver_t *drivers[] = { + DRIVER_MODULE_NAME(dc, pci), + DRIVER_MODULE_NAME(de, pci), + NULL + }; + return (*handler)(drivers); +} + extern driver_t *DRIVER_MODULE_NAME(acphy, miibus); extern driver_t *DRIVER_MODULE_NAME(amphy, miibus); extern driver_t *DRIVER_MODULE_NAME(dcphy, miibus); extern driver_t *DRIVER_MODULE_NAME(pnphy, miibus); extern driver_t *DRIVER_MODULE_NAME(ukphy, miibus); - driver_t * __haiku_select_miibus_driver(device_t dev) { @@ -38,8 +55,50 @@ __haiku_select_miibus_driver(device_t dev) } +int check_disable_interrupts_dc(device_t dev); +void reenable_interrupts_dc(device_t dev); + +extern int check_disable_interrupts_de(device_t dev); +extern void reenable_interrupts_de(device_t dev); + + int HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) +{ + uint16 name = *(uint16*)dev->device_name; + switch(name) { + case 'cd': + return check_disable_interrupts_dc(dev); + case 'ed': + return check_disable_interrupts_de(dev); + default: + break; + } + + panic("Unsupported device: %#x (%s)!", name, dev->device_name); + return 0; +} + + +void +HAIKU_REENABLE_INTERRUPTS(device_t dev) +{ + uint16 name = *(uint16*)dev->device_name; + switch(name) { + case 'cd': + reenable_interrupts_dc(dev); + break; + case 'ed': + reenable_interrupts_de(dev); + break; + default: + panic("Unsupported device: %#x (%s)!", name, dev->device_name); + break; + } +} + + +int check_disable_interrupts_dc(device_t dev) { struct dc_softc *sc = device_get_softc(dev); uint16_t status; @@ -72,11 +131,11 @@ HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) } -void -HAIKU_REENABLE_INTERRUPTS(device_t dev) +void reenable_interrupts_dc(device_t dev) { struct dc_softc *sc = device_get_softc(dev); DC_LOCK(sc); CSR_WRITE_4(sc, DC_IMR, DC_INTRS); DC_UNLOCK(sc); } + diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/Jamfile b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/Jamfile new file mode 100644 index 0000000000..a5f1330164 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/Jamfile @@ -0,0 +1,18 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network dec21xxx dev de ; + +UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ; +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ; + +UsePrivateHeaders net system ; +UsePrivateKernelHeaders ; + +SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] ; + +KernelStaticLibrary dec21xxx_de.a + : + glue.c + if_de.c + ; + +ObjectHdrs [ FGristFiles if_de$(SUFOBJ) ] + : [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR) libs compat freebsd_network ] ; diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/dc21040reg.h b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/dc21040reg.h new file mode 100644 index 0000000000..9f733f766d --- /dev/null +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/dc21040reg.h @@ -0,0 +1,583 @@ +/* $NetBSD: dc21040reg.h,v 1.15 1998/05/22 18:50:59 matt Exp $ */ + +/* $FreeBSD: src/sys/dev/de/dc21040reg.h,v 1.7.26.1.6.1 2010/12/21 17:09:25 kensmith Exp $ */ + +/*- + * Copyright (c) 1994, 1995, 1996 Matt Thomas + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Id: dc21040reg.h,v 1.24 1997/05/16 19:47:09 thomas Exp + */ + +#if !defined(_DC21040_H) +#define _DC21040_H + +#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN +#define TULIP_BITFIELD2(a, b) b, a +#define TULIP_BITFIELD3(a, b, c) c, b, a +#define TULIP_BITFIELD4(a, b, c, d) d, c, b, a +#else +#define TULIP_BITFIELD2(a, b) a, b +#define TULIP_BITFIELD3(a, b, c) a, b, c +#define TULIP_BITFIELD4(a, b, c, d) a, b, c, d +#endif + +typedef struct { + u_int32_t d_status; + u_int32_t TULIP_BITFIELD3(d_length1 : 11, + d_length2 : 11, + d_flag : 10); + u_int32_t d_addr1; + u_int32_t d_addr2; +} tulip_desc_t; + +#define TULIP_DSTS_OWNER 0x80000000 /* Owner (1 = 21040) */ +#define TULIP_DSTS_ERRSUM 0x00008000 /* Error Summary */ +/* + * Transmit Status + */ +#define TULIP_DSTS_TxBABBLE 0x00004000 /* Transmitter Babbled */ +#define TULIP_DSTS_TxCARRLOSS 0x00000800 /* Carrier Loss */ +#define TULIP_DSTS_TxNOCARR 0x00000400 /* No Carrier */ +#define TULIP_DSTS_TxLATECOLL 0x00000200 /* Late Collision */ +#define TULIP_DSTS_TxEXCCOLL 0x00000100 /* Excessive Collisions */ +#define TULIP_DSTS_TxNOHRTBT 0x00000080 /* No Heartbeat */ +#define TULIP_DSTS_TxCOLLMASK 0x00000078 /* Collision Count (mask) */ +#define TULIP_DSTS_V_TxCOLLCNT 0x00000003 /* Collision Count (bit) */ +#define TULIP_DSTS_TxLINKFAIL 0x00000004 /* Link Failure */ +#define TULIP_DSTS_TxUNDERFLOW 0x00000002 /* Underflow Error */ +#define TULIP_DSTS_TxDEFERRED 0x00000001 /* Initially Deferred */ +/* + * Receive Status + */ +#define TULIP_DSTS_RxBADLENGTH 0x00004000 /* Length Error */ +#define TULIP_DSTS_RxDATATYPE 0x00003000 /* Data Type */ +#define TULIP_DSTS_RxRUNT 0x00000800 /* Runt Frame */ +#define TULIP_DSTS_RxMULTICAST 0x00000400 /* Multicast Frame */ +#define TULIP_DSTS_RxFIRSTDESC 0x00000200 /* First Descriptor */ +#define TULIP_DSTS_RxLASTDESC 0x00000100 /* Last Descriptor */ +#define TULIP_DSTS_RxTOOLONG 0x00000080 /* Frame Too Long */ +#define TULIP_DSTS_RxCOLLSEEN 0x00000040 /* Collision Seen */ +#define TULIP_DSTS_RxFRAMETYPE 0x00000020 /* Frame Type */ +#define TULIP_DSTS_RxWATCHDOG 0x00000010 /* Receive Watchdog */ +#define TULIP_DSTS_RxDRBBLBIT 0x00000004 /* Dribble Bit */ +#define TULIP_DSTS_RxBADCRC 0x00000002 /* CRC Error */ +#define TULIP_DSTS_RxOVERFLOW 0x00000001 /* Overflow */ + + +#define TULIP_DFLAG_ENDRING 0x0008 /* End of Transmit Ring */ +#define TULIP_DFLAG_CHAIN 0x0004 /* Chain using d_addr2 */ + +#define TULIP_DFLAG_TxWANTINTR 0x0200 /* Signal Interrupt on Completion */ +#define TULIP_DFLAG_TxLASTSEG 0x0100 /* Last Segment */ +#define TULIP_DFLAG_TxFIRSTSEG 0x0080 /* First Segment */ +#define TULIP_DFLAG_TxINVRSFILT 0x0040 /* Inverse Filtering */ +#define TULIP_DFLAG_TxSETUPPKT 0x0020 /* Setup Packet */ +#define TULIP_DFLAG_TxHASCRC 0x0010 /* Don't Append the CRC */ +#define TULIP_DFLAG_TxNOPADDING 0x0002 /* Don't AutoPad */ +#define TULIP_DFLAG_TxHASHFILT 0x0001 /* Hash/Perfect Filtering */ + +/* + * The 21040 Registers (IO Space Addresses) + */ +#define TULIP_REG_BUSMODE 0x00 /* CSR0 -- Bus Mode */ +#define TULIP_REG_TXPOLL 0x08 /* CSR1 -- Transmit Poll Demand */ +#define TULIP_REG_RXPOLL 0x10 /* CSR2 -- Receive Poll Demand */ +#define TULIP_REG_RXLIST 0x18 /* CSR3 -- Receive List Base Addr */ +#define TULIP_REG_TXLIST 0x20 /* CSR4 -- Transmit List Base Addr */ +#define TULIP_REG_STATUS 0x28 /* CSR5 -- Status */ +#define TULIP_REG_CMD 0x30 /* CSR6 -- Command */ +#define TULIP_REG_INTR 0x38 /* CSR7 -- Interrupt Control */ +#define TULIP_REG_MISSES 0x40 /* CSR8 -- Missed Frame Counter */ +#define TULIP_REG_ADDRROM 0x48 /* CSR9 -- ENET ROM Register */ +#define TULIP_REG_RSRVD 0x50 /* CSR10 -- Reserved */ +#define TULIP_REG_FULL_DUPLEX 0x58 /* CSR11 -- Full Duplex */ +#define TULIP_REG_SIA_STATUS 0x60 /* CSR12 -- SIA Status */ +#define TULIP_REG_SIA_CONN 0x68 /* CSR13 -- SIA Connectivity */ +#define TULIP_REG_SIA_TXRX 0x70 /* CSR14 -- SIA Tx Rx */ +#define TULIP_REG_SIA_GEN 0x78 /* CSR15 -- SIA General */ + +/* + * CSR5 -- Status Register + * CSR7 -- Interrupt Control + */ +#define TULIP_STS_ERRORMASK 0x03800000L /* ( R) Error Bits (Valid when SYSERROR is set) */ +#define TULIP_STS_ERR_PARITY 0x00000000L /* 000 - Parity Error (Perform Reset) */ +#define TULIP_STS_ERR_MASTER 0x00800000L /* 001 - Master Abort */ +#define TULIP_STS_ERR_TARGET 0x01000000L /* 010 - Target Abort */ +#define TULIP_STS_ERR_SHIFT 23 +#define TULIP_STS_TXSTATEMASK 0x00700000L /* ( R) Transmission Process State */ +#define TULIP_STS_TXS_RESET 0x00000000L /* 000 - Rset or transmit jabber expired */ +#define TULIP_STS_TXS_FETCH 0x00100000L /* 001 - Fetching transmit descriptor */ +#define TULIP_STS_TXS_WAITEND 0x00200000L /* 010 - Wait for end of transmission */ +#define TULIP_STS_TXS_READING 0x00300000L /* 011 - Read buffer and enqueue data */ +#define TULIP_STS_TXS_RSRVD 0x00400000L /* 100 - Reserved */ +#define TULIP_STS_TXS_SETUP 0x00500000L /* 101 - Setup Packet */ +#define TULIP_STS_TXS_SUSPEND 0x00600000L /* 110 - Transmit FIFO underflow or an + unavailable transmit descriptor */ +#define TULIP_STS_TXS_CLOSE 0x00700000L /* 111 - Close transmit descriptor */ +#define TULIP_STS_RXSTATEMASK 0x000E0000L /* ( R) Receive Process State*/ +#define TULIP_STS_RXS_STOPPED 0x00000000L /* 000 - Stopped */ +#define TULIP_STS_RXS_FETCH 0x00020000L /* 001 - Running -- Fetch receive descriptor */ +#define TULIP_STS_RXS_ENDCHECK 0x00040000L /* 010 - Running -- Check for end of receive + packet before prefetch of next descriptor */ +#define TULIP_STS_RXS_WAIT 0x00060000L /* 011 - Running -- Wait for receive packet */ +#define TULIP_STS_RXS_SUSPEND 0x00080000L /* 100 - Suspended -- As a result of + unavailable receive buffers */ +#define TULIP_STS_RXS_CLOSE 0x000A0000L /* 101 - Running -- Close receive descriptor */ +#define TULIP_STS_RXS_FLUSH 0x000C0000L /* 110 - Running -- Flush the current frame + from the receive FIFO as a result of + an unavailable receive buffer */ +#define TULIP_STS_RXS_DEQUEUE 0x000E0000L /* 111 - Running -- Dequeue the receive frame + from the receive FIFO into the receive + buffer. */ +#define TULIP_STS_NORMALINTR 0x00010000L /* (RW) Normal Interrupt */ +#define TULIP_STS_ABNRMLINTR 0x00008000L /* (RW) Abnormal Interrupt */ +#define TULIP_STS_SYSERROR 0x00002000L /* (RW) System Error */ +#define TULIP_STS_LINKFAIL 0x00001000L /* (RW) Link Failure (21040) */ +#define TULIP_STS_FULDPLXSHRT 0x00000800L /* (RW) Full Duplex Short Fram Rcvd (21040) */ +#define TULIP_STS_GPTIMEOUT 0x00000800L /* (RW) General Purpose Timeout (21140) */ +#define TULIP_STS_AUI 0x00000400L /* (RW) AUI/TP Switch (21040) */ +#define TULIP_STS_RXTIMEOUT 0x00000200L /* (RW) Receive Watchbog Timeout */ +#define TULIP_STS_RXSTOPPED 0x00000100L /* (RW) Receive Process Stopped */ +#define TULIP_STS_RXNOBUF 0x00000080L /* (RW) Receive Buffer Unavailable */ +#define TULIP_STS_RXINTR 0x00000040L /* (RW) Receive Interrupt */ +#define TULIP_STS_TXUNDERFLOW 0x00000020L /* (RW) Transmit Underflow */ +#define TULIP_STS_LINKPASS 0x00000010L /* (RW) LinkPass (21041) */ +#define TULIP_STS_TXBABBLE 0x00000008L /* (RW) Transmit Jabber Timeout */ +#define TULIP_STS_TXNOBUF 0x00000004L /* (RW) Transmit Buffer Unavailable */ +#define TULIP_STS_TXSTOPPED 0x00000002L /* (RW) Transmit Process Stopped */ +#define TULIP_STS_TXINTR 0x00000001L /* (RW) Transmit Interrupt */ + +/* + * CSR6 -- Command (Operation Mode) Register + */ +#define TULIP_CMD_MUSTBEONE 0x02000000L /* (RW) Must Be One (21140) */ +#define TULIP_CMD_SCRAMBLER 0x01000000L /* (RW) Scrambler Mode (21140) */ +#define TULIP_CMD_PCSFUNCTION 0x00800000L /* (RW) PCS Function (21140) */ +#define TULIP_CMD_TXTHRSHLDCTL 0x00400000L /* (RW) Transmit Threshold Mode (21140) */ +#define TULIP_CMD_STOREFWD 0x00200000L /* (RW) Store and Foward (21140) */ +#define TULIP_CMD_NOHEARTBEAT 0x00080000L /* (RW) No Heartbeat (21140) */ +#define TULIP_CMD_PORTSELECT 0x00040000L /* (RW) Post Select (100Mb) (21140) */ +#define TULIP_CMD_ENHCAPTEFFCT 0x00040000L /* (RW) Enhanced Capture Effecty (21041) */ +#define TULIP_CMD_CAPTREFFCT 0x00020000L /* (RW) Capture Effect (!802.3) */ +#define TULIP_CMD_BACKPRESSURE 0x00010000L /* (RW) Back Pressure (!802.3) (21040) */ +#define TULIP_CMD_THRESHOLDCTL 0x0000C000L /* (RW) Threshold Control */ +#define TULIP_CMD_THRSHLD72 0x00000000L /* 00 - 72 Bytes */ +#define TULIP_CMD_THRSHLD96 0x00004000L /* 01 - 96 Bytes */ +#define TULIP_CMD_THRSHLD128 0x00008000L /* 10 - 128 bytes */ +#define TULIP_CMD_THRSHLD160 0x0000C000L /* 11 - 160 Bytes */ +#define TULIP_CMD_TXRUN 0x00002000L /* (RW) Start/Stop Transmitter */ +#define TULIP_CMD_FORCECOLL 0x00001000L /* (RW) Force Collisions */ +#define TULIP_CMD_OPERMODE 0x00000C00L /* (RW) Operating Mode */ +#define TULIP_CMD_FULLDUPLEX 0x00000200L /* (RW) Full Duplex Mode */ +#define TULIP_CMD_FLAKYOSCDIS 0x00000100L /* (RW) Flakey Oscillator Disable */ +#define TULIP_CMD_ALLMULTI 0x00000080L /* (RW) Pass All Multicasts */ +#define TULIP_CMD_PROMISCUOUS 0x00000040L /* (RW) Promiscuous Mode */ +#define TULIP_CMD_BACKOFFCTR 0x00000020L /* (RW) Start/Stop Backoff Counter (!802.3) */ +#define TULIP_CMD_INVFILTER 0x00000010L /* (R ) Inverse Filtering */ +#define TULIP_CMD_PASSBADPKT 0x00000008L /* (RW) Pass Bad Frames */ +#define TULIP_CMD_HASHONLYFLTR 0x00000004L /* (R ) Hash Only Filtering */ +#define TULIP_CMD_RXRUN 0x00000002L /* (RW) Start/Stop Receive Filtering */ +#define TULIP_CMD_HASHPRFCTFLTR 0x00000001L /* (R ) Hash/Perfect Receive Filtering */ + +#define TULIP_SIASTS_OTHERRXACTIVITY 0x00000200L +#define TULIP_SIASTS_RXACTIVITY 0x00000100L +#define TULIP_SIASTS_LINKFAIL 0x00000004L +#define TULIP_SIASTS_LINK100FAIL 0x00000002L +#define TULIP_SIACONN_RESET 0x00000000L + +/* + * 21040 SIA definitions + */ +#define TULIP_21040_PROBE_10BASET_TIMEOUT 2500 +#define TULIP_21040_PROBE_AUIBNC_TIMEOUT 300 +#define TULIP_21040_PROBE_EXTSIA_TIMEOUT 300 + +#define TULIP_21040_SIACONN_10BASET 0x0000EF01L +#define TULIP_21040_SIATXRX_10BASET 0x0000FFFFL +#define TULIP_21040_SIAGEN_10BASET 0x00000000L + +#define TULIP_21040_SIACONN_10BASET_FD 0x0000EF01L +#define TULIP_21040_SIATXRX_10BASET_FD 0x0000FFFDL +#define TULIP_21040_SIAGEN_10BASET_FD 0x00000000L + +#define TULIP_21040_SIACONN_AUIBNC 0x0000EF09L +#define TULIP_21040_SIATXRX_AUIBNC 0x00000705L +#define TULIP_21040_SIAGEN_AUIBNC 0x00000006L + +#define TULIP_21040_SIACONN_EXTSIA 0x00003041L +#define TULIP_21040_SIATXRX_EXTSIA 0x00000000L +#define TULIP_21040_SIAGEN_EXTSIA 0x00000006L + +/* + * 21041 SIA definitions + */ + +#define TULIP_21041_PROBE_10BASET_TIMEOUT 2500 +#define TULIP_21041_PROBE_AUIBNC_TIMEOUT 300 + +#define TULIP_21041_SIACONN_10BASET 0x0000EF01L +#define TULIP_21041_SIATXRX_10BASET 0x0000FF3FL +#define TULIP_21041_SIAGEN_10BASET 0x00000000L + +#define TULIP_21041P2_SIACONN_10BASET 0x0000EF01L +#define TULIP_21041P2_SIATXRX_10BASET 0x0000FFFFL +#define TULIP_21041P2_SIAGEN_10BASET 0x00000000L + +#define TULIP_21041_SIACONN_10BASET_FD 0x0000EF01L +#define TULIP_21041_SIATXRX_10BASET_FD 0x0000FF3DL +#define TULIP_21041_SIAGEN_10BASET_FD 0x00000000L + +#define TULIP_21041P2_SIACONN_10BASET_FD 0x0000EF01L +#define TULIP_21041P2_SIATXRX_10BASET_FD 0x0000FFFFL +#define TULIP_21041P2_SIAGEN_10BASET_FD 0x00000000L + +#define TULIP_21041_SIACONN_AUI 0x0000EF09L +#define TULIP_21041_SIATXRX_AUI 0x0000F73DL +#define TULIP_21041_SIAGEN_AUI 0x0000000EL + +#define TULIP_21041P2_SIACONN_AUI 0x0000EF09L +#define TULIP_21041P2_SIATXRX_AUI 0x0000F7FDL +#define TULIP_21041P2_SIAGEN_AUI 0x0000000EL + +#define TULIP_21041_SIACONN_BNC 0x0000EF09L +#define TULIP_21041_SIATXRX_BNC 0x0000F73DL +#define TULIP_21041_SIAGEN_BNC 0x00000006L + +#define TULIP_21041P2_SIACONN_BNC 0x0000EF09L +#define TULIP_21041P2_SIATXRX_BNC 0x0000F7FDL +#define TULIP_21041P2_SIAGEN_BNC 0x00000006L + +/* + * 21142 SIA definitions + */ + +#define TULIP_21142_PROBE_10BASET_TIMEOUT 2500 +#define TULIP_21142_PROBE_AUIBNC_TIMEOUT 300 + +#define TULIP_21142_SIACONN_10BASET 0x00000001L +#define TULIP_21142_SIATXRX_10BASET 0x00007F3FL +#define TULIP_21142_SIAGEN_10BASET 0x00000008L + +#define TULIP_21142_SIACONN_10BASET_FD 0x00000001L +#define TULIP_21142_SIATXRX_10BASET_FD 0x00007F3DL +#define TULIP_21142_SIAGEN_10BASET_FD 0x00000008L + +#define TULIP_21142_SIACONN_AUI 0x00000009L +#define TULIP_21142_SIATXRX_AUI 0x00000705L +#define TULIP_21142_SIAGEN_AUI 0x0000000EL + +#define TULIP_21142_SIACONN_BNC 0x00000009L +#define TULIP_21142_SIATXRX_BNC 0x00000705L +#define TULIP_21142_SIAGEN_BNC 0x00000006L + + + + +#define TULIP_WATCHDOG_TXDISABLE 0x00000001L +#define TULIP_WATCHDOG_RXDISABLE 0x00000010L + +#define TULIP_BUSMODE_SWRESET 0x00000001L +#define TULIP_BUSMODE_DESCSKIPLEN_MASK 0x0000007CL +#define TULIP_BUSMODE_BIGENDIAN 0x00000080L +#define TULIP_BUSMODE_BURSTLEN_MASK 0x00003F00L +#define TULIP_BUSMODE_BURSTLEN_DEFAULT 0x00000000L +#define TULIP_BUSMODE_BURSTLEN_1LW 0x00000100L +#define TULIP_BUSMODE_BURSTLEN_2LW 0x00000200L +#define TULIP_BUSMODE_BURSTLEN_4LW 0x00000400L +#define TULIP_BUSMODE_BURSTLEN_8LW 0x00000800L +#define TULIP_BUSMODE_BURSTLEN_16LW 0x00001000L +#define TULIP_BUSMODE_BURSTLEN_32LW 0x00002000L +#define TULIP_BUSMODE_CACHE_NOALIGN 0x00000000L +#define TULIP_BUSMODE_CACHE_ALIGN8 0x00004000L +#define TULIP_BUSMODE_CACHE_ALIGN16 0x00008000L +#define TULIP_BUSMODE_CACHE_ALIGN32 0x0000C000L +#define TULIP_BUSMODE_TXPOLL_NEVER 0x00000000L +#define TULIP_BUSMODE_TXPOLL_200000ns 0x00020000L +#define TULIP_BUSMODE_TXPOLL_800000ns 0x00040000L +#define TULIP_BUSMODE_TXPOLL_1600000ns 0x00060000L +#define TULIP_BUSMODE_TXPOLL_12800ns 0x00080000L /* 21041 only */ +#define TULIP_BUSMODE_TXPOLL_25600ns 0x000A0000L /* 21041 only */ +#define TULIP_BUSMODE_TXPOLL_51200ns 0x000C0000L /* 21041 only */ +#define TULIP_BUSMODE_TXPOLL_102400ns 0x000E0000L /* 21041 only */ +#define TULIP_BUSMODE_DESC_BIGENDIAN 0x00100000L /* 21041 only */ +#define TULIP_BUSMODE_READMULTIPLE 0x00200000L /* */ + +#define TULIP_REG_CFDA 0x40 +#define TULIP_CFDA_SLEEP 0x80000000L +#define TULIP_CFDA_SNOOZE 0x40000000L + +#define TULIP_GP_PINSET 0x00000100L +/* + * These are the defintitions used for the DEC 21140 + * evaluation board. + */ +#define TULIP_GP_EB_PINS 0x0000001F /* General Purpose Pin directions */ +#define TULIP_GP_EB_OK10 0x00000080 /* 10 Mb/sec Signal Detect gep<7> */ +#define TULIP_GP_EB_OK100 0x00000040 /* 100 Mb/sec Signal Detect gep<6> */ +#define TULIP_GP_EB_INIT 0x0000000B /* No loopback --- point-to-point */ + +/* + * These are the defintitions used for the SMC9332 (21140) board. + */ +#define TULIP_GP_SMC_9332_PINS 0x0000003F /* General Purpose Pin directions */ +#define TULIP_GP_SMC_9332_OK10 0x00000080 /* 10 Mb/sec Signal Detect gep<7> */ +#define TULIP_GP_SMC_9332_OK100 0x00000040 /* 100 Mb/sec Signal Detect gep<6> */ +#define TULIP_GP_SMC_9332_INIT 0x00000009 /* No loopback --- point-to-point */ + +/* + * There are the definitions used for the DEC DE500 + * 10/100 family of boards + */ +#define TULIP_GP_DE500_PINS 0x0000001FL +#define TULIP_GP_DE500_LINK_PASS 0x00000080L +#define TULIP_GP_DE500_SYM_LINK 0x00000040L +#define TULIP_GP_DE500_SIGNAL_DETECT 0x00000020L +#define TULIP_GP_DE500_PHY_RESET 0x00000010L +#define TULIP_GP_DE500_HALFDUPLEX 0x00000008L +#define TULIP_GP_DE500_PHY_LOOPBACK 0x00000004L +#define TULIP_GP_DE500_FORCE_LED 0x00000002L +#define TULIP_GP_DE500_FORCE_100 0x00000001L + +/* + * These are the defintitions used for the Cogent EM100 + * 21140 board. + */ +#define TULIP_GP_EM100_PINS 0x0000003F /* General Purpose Pin directions */ +#define TULIP_GP_EM100_INIT 0x00000009 /* No loopback --- point-to-point */ +#define TULIP_COGENT_EM100TX_ID 0x12 +#define TULIP_COGENT_EM100FX_ID 0x15 + + +/* + * These are the defintitions used for the Znyx ZX342 + * 10/100 board + */ +#define TULIP_ZNYX_ID_ZX312 0x0602 +#define TULIP_ZNYX_ID_ZX312T 0x0622 +#define TULIP_ZNYX_ID_ZX314_INTA 0x0701 +#define TULIP_ZNYX_ID_ZX314 0x0711 +#define TULIP_ZNYX_ID_ZX315_INTA 0x0801 +#define TULIP_ZNYX_ID_ZX315 0x0811 +#define TULIP_ZNYX_ID_ZX342 0x0901 +#define TULIP_ZNYX_ID_ZX342B 0x0921 +#define TULIP_ZNYX_ID_ZX342_X3 0x0902 +#define TULIP_ZNYX_ID_ZX342_X4 0x0903 +#define TULIP_ZNYX_ID_ZX344 0x0A01 +#define TULIP_ZNYX_ID_ZX351 0x0B01 +#define TULIP_ZNYX_ID_ZX345 0x0C01 +#define TULIP_ZNYX_ID_ZX311 0x0D01 +#define TULIP_ZNYX_ID_ZX346 0x0E01 + +#define TULIP_GP_ZX34X_PINS 0x0000001F /* General Purpose Pin directions */ +#define TULIP_GP_ZX344_PINS 0x0000000B /* General Purpose Pin directions */ +#define TULIP_GP_ZX345_PINS 0x00000003 /* General Purpose Pin directions */ +#define TULIP_GP_ZX346_PINS 0x00000043 /* General Purpose Pin directions */ +#define TULIP_GP_ZX34X_LNKFAIL 0x00000080 /* 10Mb/s Link Failure */ +#define TULIP_GP_ZX34X_SYMDET 0x00000040 /* 100Mb/s Symbol Detect */ +#define TULIP_GP_ZX345_PHYACT 0x00000040 /* PHY Activity */ +#define TULIP_GP_ZX34X_SIGDET 0x00000020 /* 100Mb/s Signal Detect */ +#define TULIP_GP_ZX346_AUTONEG_ENABLED 0x00000020 /* 802.3u autoneg enabled */ +#define TULIP_GP_ZX342_COLENA 0x00000008 /* 10t Ext LB */ +#define TULIP_GP_ZX344_ROTINT 0x00000008 /* PPB IRQ rotation */ +#define TULIP_GP_ZX345_SPEED10 0x00000008 /* 10Mb speed detect */ +#define TULIP_GP_ZX346_SPEED100 0x00000008 /* 100Mb speed detect */ +#define TULIP_GP_ZX34X_NCOLENA 0x00000004 /* 10t Int LB */ +#define TULIP_GP_ZX34X_RXMATCH 0x00000004 /* RX Match */ +#define TULIP_GP_ZX346_FULLDUPLEX 0x00000004 /* Full Duplex Sensed */ +#define TULIP_GP_ZX34X_LB102 0x00000002 /* 100tx twister LB */ +#define TULIP_GP_ZX34X_NLB101 0x00000001 /* PDT/PDR LB */ +#define TULIP_GP_ZX34X_INIT 0x00000009 + +/* + * Asante's stuff... + */ +#define TULIP_GP_ASANTE_PINS 0x000000bf /* GP pin config */ +#define TULIP_GP_ASANTE_PHYRESET 0x00000008 /* Reset PHY */ + +/* + * ACCTON EN1207 specialties + */ + +#define TULIP_CSR8_EN1207 0x08 +#define TULIP_CSR9_EN1207 0x00 +#define TULIP_CSR10_EN1207 0x03 +#define TULIP_CSR11_EN1207 0x1F + +#define TULIP_GP_EN1207_BNC_INIT 0x0000011B +#define TULIP_GP_EN1207_UTP_INIT 0x9E00000B +#define TULIP_GP_EN1207_100_INIT 0x6D00031B + +/* + * SROM definitions for the 21140 and 21041. + */ +#define SROMXREG 0x0400 +#define SROMSEL 0x0800 +#define SROMRD 0x4000 +#define SROMWR 0x2000 +#define SROMDIN 0x0008 +#define SROMDOUT 0x0004 +#define SROMDOUTON 0x0004 +#define SROMDOUTOFF 0x0004 +#define SROMCLKON 0x0002 +#define SROMCLKOFF 0x0002 +#define SROMCSON 0x0001 +#define SROMCSOFF 0x0001 +#define SROMCS 0x0001 + +#define SROMCMD_MODE 4 +#define SROMCMD_WR 5 +#define SROMCMD_RD 6 + +#define SROM_BITWIDTH 6 + +/* + * MII Definitions for the 21041 and 21140/21140A/21142 + */ +#define MII_PREAMBLE (~0) +#define MII_TEST 0xAAAAAAAA +#define MII_RDCMD 0xF6 /* 1111.0110 */ +#define MII_WRCMD 0xF5 /* 1111.0101 */ +#define MII_DIN 0x00080000 +#define MII_RD 0x00040000 +#define MII_WR 0x00000000 +#define MII_DOUT 0x00020000 +#define MII_CLK 0x00010000 +#define MII_CLKON MII_CLK +#define MII_CLKOFF MII_CLK + +#define PHYREG_CONTROL 0 +#define PHYREG_STATUS 1 +#define PHYREG_IDLOW 2 +#define PHYREG_IDHIGH 3 +#define PHYREG_AUTONEG_ADVERTISEMENT 4 +#define PHYREG_AUTONEG_ABILITIES 5 +#define PHYREG_AUTONEG_EXPANSION 6 +#define PHYREG_AUTONEG_NEXTPAGE 7 + +#define PHYSTS_100BASET4 0x8000 +#define PHYSTS_100BASETX_FD 0x4000 +#define PHYSTS_100BASETX 0x2000 +#define PHYSTS_10BASET_FD 0x1000 +#define PHYSTS_10BASET 0x0800 +#define PHYSTS_AUTONEG_DONE 0x0020 +#define PHYSTS_REMOTE_FAULT 0x0010 +#define PHYSTS_CAN_AUTONEG 0x0008 +#define PHYSTS_LINK_UP 0x0004 +#define PHYSTS_JABBER_DETECT 0x0002 +#define PHYSTS_EXTENDED_REGS 0x0001 + +#define PHYCTL_RESET 0x8000 +#define PHYCTL_SELECT_100MB 0x2000 +#define PHYCTL_AUTONEG_ENABLE 0x1000 +#define PHYCTL_ISOLATE 0x0400 +#define PHYCTL_AUTONEG_RESTART 0x0200 +#define PHYCTL_FULL_DUPLEX 0x0100 + +/* + * Definitions for the DE425. + */ +#define DE425_CFID 0x08 /* Configuration Id */ +#define DE425_CFCS 0x0C /* Configuration Command-Status */ +#define DE425_CFRV 0x18 /* Configuration Revision */ +#define DE425_CFLT 0x1C /* Configuration Latency Timer */ +#define DE425_CBIO 0x28 /* Configuration Base IO Address */ +#define DE425_CFDA 0x2C /* Configuration Driver Area */ +#define DE425_ENETROM_OFFSET 0xC90 /* Offset in I/O space for ENETROM */ +#define DE425_CFG0 0xC88 /* IRQ register */ +#define DE425_EISAID 0x10a34250 /* EISA device id */ +#define DE425_EISA_IOSIZE 0x100 + +#define DEC_VENDORID 0x1011 +#define CHIPID_21040 0x0002 +#define CHIPID_21140 0x0009 +#define CHIPID_21041 0x0014 +#define CHIPID_21142 0x0019 +#define PCI_VENDORID(x) ((x) & 0xFFFF) +#define PCI_CHIPID(x) (((x) >> 16) & 0xFFFF) + +/* + * Generic SROM Format + * + * + */ + +typedef struct { + u_int8_t sh_idbuf[18]; + u_int8_t sh_version; + u_int8_t sh_adapter_count; + u_int8_t sh_ieee802_address[6]; +} tulip_srom_header_t; + +typedef struct { + u_int8_t sai_device; + u_int8_t sai_leaf_offset_lowbyte; + u_int8_t sai_leaf_offset_highbyte; +} tulip_srom_adapter_info_t; + +typedef enum { + TULIP_SROM_CONNTYPE_10BASET =0x0000, + TULIP_SROM_CONNTYPE_BNC =0x0001, + TULIP_SROM_CONNTYPE_AUI =0x0002, + TULIP_SROM_CONNTYPE_100BASETX =0x0003, + TULIP_SROM_CONNTYPE_100BASET4 =0x0006, + TULIP_SROM_CONNTYPE_100BASEFX =0x0007, + TULIP_SROM_CONNTYPE_MII_10BASET =0x0009, + TULIP_SROM_CONNTYPE_MII_100BASETX =0x000D, + TULIP_SROM_CONNTYPE_MII_100BASET4 =0x000F, + TULIP_SROM_CONNTYPE_MII_100BASEFX =0x0010, + TULIP_SROM_CONNTYPE_10BASET_NWAY =0x0100, + TULIP_SROM_CONNTYPE_10BASET_FD =0x0204, + TULIP_SROM_CONNTYPE_MII_10BASET_FD =0x020A, + TULIP_SROM_CONNTYPE_100BASETX_FD =0x020E, + TULIP_SROM_CONNTYPE_MII_100BASETX_FD =0x0211, + TULIP_SROM_CONNTYPE_10BASET_NOLINKPASS =0x0400, + TULIP_SROM_CONNTYPE_AUTOSENSE =0x0800, + TULIP_SROM_CONNTYPE_AUTOSENSE_POWERUP =0x8800, + TULIP_SROM_CONNTYPE_AUTOSENSE_NWAY =0x9000, + TULIP_SROM_CONNTYPE_NOT_USED =0xFFFF +} tulip_srom_connection_t; + +typedef enum { + TULIP_SROM_MEDIA_10BASET =0x0000, + TULIP_SROM_MEDIA_BNC =0x0001, + TULIP_SROM_MEDIA_AUI =0x0002, + TULIP_SROM_MEDIA_100BASETX =0x0003, + TULIP_SROM_MEDIA_10BASET_FD =0x0004, + TULIP_SROM_MEDIA_100BASETX_FD =0x0005, + TULIP_SROM_MEDIA_100BASET4 =0x0006, + TULIP_SROM_MEDIA_100BASEFX =0x0007, + TULIP_SROM_MEDIA_100BASEFX_FD =0x0008 +} tulip_srom_media_t; + +#define TULIP_SROM_21041_EXTENDED 0x40 + +#define TULIP_SROM_2114X_NOINDICATOR 0x8000 +#define TULIP_SROM_2114X_DEFAULT 0x4000 +#define TULIP_SROM_2114X_POLARITY 0x0080 +#define TULIP_SROM_2114X_CMDBITS(n) (((n) & 0x0071) << 18) +#define TULIP_SROM_2114X_BITPOS(b) (1 << (((b) & 0x0E) >> 1)) + + + +#endif /* !defined(_DC21040_H) */ diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/glue.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/glue.c new file mode 100644 index 0000000000..f0584b39c6 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/glue.c @@ -0,0 +1,66 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Author(s): + * Siarzhuk Zharski + */ + + +#include +#include +#include +#include +#include +#include + +#include "dc21040reg.h" +#include "if_devar.h" + + +int check_disable_interrupts_de(device_t dev); +void reenable_interrupts_de(device_t dev); + + +int +check_disable_interrupts_de(device_t dev) +{ + struct tulip_softc *sc = device_get_softc(dev); + uint32_t status; + HAIKU_INTR_REGISTER_STATE; + + HAIKU_INTR_REGISTER_ENTER(); + + status = TULIP_CSR_READ(sc, csr_status); + if (status == 0xffffffff) { + HAIKU_INTR_REGISTER_LEAVE(); + return 0; + } + + if (status != 0 && (status & sc->tulip_intrmask) == 0) { + TULIP_CSR_WRITE(sc, csr_status, status); + HAIKU_INTR_REGISTER_LEAVE(); + return 0; + } + + if ((status & sc->tulip_intrmask) == 0) { + HAIKU_INTR_REGISTER_LEAVE(); + return 0; + } + + TULIP_CSR_WRITE(sc, csr_intr, 0); + + HAIKU_INTR_REGISTER_LEAVE(); + + return 1; +} + + +void +reenable_interrupts_de(device_t dev) +{ + struct tulip_softc *sc = device_get_softc(dev); + TULIP_LOCK(sc); + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + TULIP_UNLOCK(sc); +} diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_de.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_de.c new file mode 100644 index 0000000000..e7c49bdbe9 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_de.c @@ -0,0 +1,5034 @@ +/* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */ +/*- + * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Id: if_de.c,v 1.94 1997/07/03 16:55:07 thomas Exp + */ + +/* + * DEC 21040 PCI Ethernet Controller + * + * Written by Matt Thomas + * BPF support code stolen directly from if_ec.c + * + * This driver supports the DEC DE435 or any other PCI + * board which support 21040, 21041, or 21140 (mostly). + */ + +#include +__FBSDID("$FreeBSD: src/sys/dev/de/if_de.c,v 1.186.2.3.4.1 2010/12/21 17:09:25 kensmith Exp $"); + +#define TULIP_HDR_DATA + +#ifndef __HAIKU__ +/* We have no such header in Haiku's compat layer + but nothing of it is required anyway here. */ +#include "opt_ddb.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#ifdef INET +#include +#include +#endif + +#include + +#include +#include +#include +#include +#include + +#ifdef DDB +#include +#endif + +/* + * Intel CPUs should use I/O mapped access. + */ +#if defined(__i386__) +#define TULIP_IOMAPPED +#endif + +#if 0 +/* This enables KTR traces at KTR_DEV. */ +#define KTR_TULIP KTR_DEV +#else +#define KTR_TULIP 0 +#endif + +#if 0 +/* + * This turns on all sort of debugging stuff and make the + * driver much larger. + */ +#define TULIP_DEBUG +#endif + +#if 0 +#define TULIP_PERFSTATS +#endif + +#define TULIP_HZ 10 + +#include + +#define SYNC_NONE 0 +#define SYNC_RX 1 +#define SYNC_TX 2 + +/* + * This module supports + * the DEC 21040 PCI Ethernet Controller. + * the DEC 21041 PCI Ethernet Controller. + * the DEC 21140 PCI Fast Ethernet Controller. + */ +static void tulip_addr_filter(tulip_softc_t * const sc); +static int tulip_ifmedia_change(struct ifnet * const ifp); +static void tulip_ifmedia_status(struct ifnet * const ifp, + struct ifmediareq *req); +static void tulip_init(void *); +static void tulip_init_locked(tulip_softc_t * const sc); +static void tulip_intr_shared(void *arg); +static void tulip_intr_normal(void *arg); +static void tulip_mii_autonegotiate(tulip_softc_t * const sc, + const unsigned phyaddr); +static int tulip_mii_map_abilities(tulip_softc_t * const sc, + unsigned abilities); +static tulip_media_t + tulip_mii_phy_readspecific(tulip_softc_t * const sc); +static unsigned tulip_mii_readreg(tulip_softc_t * const sc, unsigned devaddr, + unsigned regno); +static void tulip_mii_writereg(tulip_softc_t * const sc, unsigned devaddr, + unsigned regno, unsigned data); +static void tulip_reset(tulip_softc_t * const sc); +static void tulip_rx_intr(tulip_softc_t * const sc); +static int tulip_srom_decode(tulip_softc_t * const sc); +static void tulip_start(struct ifnet *ifp); +static void tulip_start_locked(tulip_softc_t * const sc); +static struct mbuf * + tulip_txput(tulip_softc_t * const sc, struct mbuf *m); +static void tulip_txput_setup(tulip_softc_t * const sc); +struct mbuf * tulip_dequeue_mbuf(tulip_ringinfo_t *ri, tulip_descinfo_t *di, + int sync); +static void tulip_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static void tulip_dma_map_rxbuf(void *, bus_dma_segment_t *, int, + bus_size_t, int); + +static void +tulip_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + bus_addr_t *paddr; + + if (error) + return; + + paddr = arg; + *paddr = segs->ds_addr; +} + +static void +tulip_dma_map_rxbuf(void *arg, bus_dma_segment_t *segs, int nseg, + bus_size_t mapsize, int error) +{ + tulip_desc_t *desc; + + if (error) + return; + + desc = arg; + KASSERT(nseg == 1, ("too many DMA segments")); + KASSERT(segs[0].ds_len >= TULIP_RX_BUFLEN, ("receive buffer too small")); + + desc->d_addr1 = segs[0].ds_addr & 0xffffffff; + desc->d_length1 = TULIP_RX_BUFLEN; +#ifdef not_needed + /* These should already always be zero. */ + desc->d_addr2 = 0; + desc->d_length2 = 0; +#endif +} + +struct mbuf * +tulip_dequeue_mbuf(tulip_ringinfo_t *ri, tulip_descinfo_t *di, int sync) +{ + struct mbuf *m; + + m = di->di_mbuf; + if (m != NULL) { + switch (sync) { + case SYNC_NONE: + break; + case SYNC_RX: + TULIP_RXMAP_POSTSYNC(ri, di); + break; + case SYNC_TX: + TULIP_TXMAP_POSTSYNC(ri, di); + break; + default: + panic("bad sync flag: %d", sync); + } + bus_dmamap_unload(ri->ri_data_tag, *di->di_map); + di->di_mbuf = NULL; + } + return (m); +} + +static void +tulip_timeout_callback(void *arg) +{ + tulip_softc_t * const sc = arg; + + TULIP_PERFSTART(timeout) + TULIP_LOCK_ASSERT(sc); + + sc->tulip_flags &= ~TULIP_TIMEOUTPENDING; + sc->tulip_probe_timeout -= 1000 / TULIP_HZ; + (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_TIMER); + + TULIP_PERFEND(timeout); +} + +static void +tulip_timeout(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + if (sc->tulip_flags & TULIP_TIMEOUTPENDING) + return; + sc->tulip_flags |= TULIP_TIMEOUTPENDING; + callout_reset(&sc->tulip_callout, (hz + TULIP_HZ / 2) / TULIP_HZ, + tulip_timeout_callback, sc); +} + +static int +tulip_txprobe(tulip_softc_t * const sc) +{ + struct mbuf *m; + u_char *enaddr; + + /* + * Before we are sure this is the right media we need + * to send a small packet to make sure there's carrier. + * Strangely, BNC and AUI will "see" receive data if + * either is connected so the transmit is the only way + * to verify the connectivity. + */ + TULIP_LOCK_ASSERT(sc); + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) + return 0; + /* + * Construct a LLC TEST message which will point to ourselves. + */ + if (sc->tulip_ifp->if_input != NULL) + enaddr = IF_LLADDR(sc->tulip_ifp); + else + enaddr = sc->tulip_enaddr; + bcopy(enaddr, mtod(m, struct ether_header *)->ether_dhost, ETHER_ADDR_LEN); + bcopy(enaddr, mtod(m, struct ether_header *)->ether_shost, ETHER_ADDR_LEN); + mtod(m, struct ether_header *)->ether_type = htons(3); + mtod(m, unsigned char *)[14] = 0; + mtod(m, unsigned char *)[15] = 0; + mtod(m, unsigned char *)[16] = 0xE3; /* LLC Class1 TEST (no poll) */ + m->m_len = m->m_pkthdr.len = sizeof(struct ether_header) + 3; + /* + * send it! + */ + sc->tulip_cmdmode |= TULIP_CMD_TXRUN; + sc->tulip_intrmask |= TULIP_STS_TXINTR; + sc->tulip_flags |= TULIP_TXPROBE_ACTIVE; + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + if ((m = tulip_txput(sc, m)) != NULL) + m_freem(m); + sc->tulip_probe.probe_txprobes++; + return 1; +} + +static void +tulip_media_set(tulip_softc_t * const sc, tulip_media_t media) +{ + const tulip_media_info_t *mi = sc->tulip_mediums[media]; + + TULIP_LOCK_ASSERT(sc); + if (mi == NULL) + return; + + /* + * If we are switching media, make sure we don't think there's + * any stale RX activity + */ + sc->tulip_flags &= ~TULIP_RXACT; + if (mi->mi_type == TULIP_MEDIAINFO_SIA) { + TULIP_CSR_WRITE(sc, csr_sia_connectivity, TULIP_SIACONN_RESET); + TULIP_CSR_WRITE(sc, csr_sia_tx_rx, mi->mi_sia_tx_rx); + if (sc->tulip_features & TULIP_HAVE_SIAGP) { + TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_sia_gp_control|mi->mi_sia_general); + DELAY(50); + TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_sia_gp_data|mi->mi_sia_general); + } else { + TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_sia_general); + } + TULIP_CSR_WRITE(sc, csr_sia_connectivity, mi->mi_sia_connectivity); + } else if (mi->mi_type == TULIP_MEDIAINFO_GPR) { +#define TULIP_GPR_CMDBITS (TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION|TULIP_CMD_SCRAMBLER|TULIP_CMD_TXTHRSHLDCTL) + /* + * If the cmdmode bits don't match the currently operating mode, + * set the cmdmode appropriately and reset the chip. + */ + if (((mi->mi_cmdmode ^ TULIP_CSR_READ(sc, csr_command)) & TULIP_GPR_CMDBITS) != 0) { + sc->tulip_cmdmode &= ~TULIP_GPR_CMDBITS; + sc->tulip_cmdmode |= mi->mi_cmdmode; + tulip_reset(sc); + } + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_PINSET|sc->tulip_gpinit); + DELAY(10); + TULIP_CSR_WRITE(sc, csr_gp, (u_int8_t) mi->mi_gpdata); + } else if (mi->mi_type == TULIP_MEDIAINFO_SYM) { + /* + * If the cmdmode bits don't match the currently operating mode, + * set the cmdmode appropriately and reset the chip. + */ + if (((mi->mi_cmdmode ^ TULIP_CSR_READ(sc, csr_command)) & TULIP_GPR_CMDBITS) != 0) { + sc->tulip_cmdmode &= ~TULIP_GPR_CMDBITS; + sc->tulip_cmdmode |= mi->mi_cmdmode; + tulip_reset(sc); + } + TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_gpcontrol); + TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_gpdata); + } else if (mi->mi_type == TULIP_MEDIAINFO_MII + && sc->tulip_probe_state != TULIP_PROBE_INACTIVE) { + int idx; + if (sc->tulip_features & TULIP_HAVE_SIAGP) { + const u_int8_t *dp; + dp = &sc->tulip_rombuf[mi->mi_reset_offset]; + for (idx = 0; idx < mi->mi_reset_length; idx++, dp += 2) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_sia_general, (dp[0] + 256 * dp[1]) << 16); + } + sc->tulip_phyaddr = mi->mi_phyaddr; + dp = &sc->tulip_rombuf[mi->mi_gpr_offset]; + for (idx = 0; idx < mi->mi_gpr_length; idx++, dp += 2) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_sia_general, (dp[0] + 256 * dp[1]) << 16); + } + } else { + for (idx = 0; idx < mi->mi_reset_length; idx++) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_reset_offset + idx]); + } + sc->tulip_phyaddr = mi->mi_phyaddr; + for (idx = 0; idx < mi->mi_gpr_length; idx++) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_gpr_offset + idx]); + } + } + if (sc->tulip_flags & TULIP_TRYNWAY) { + tulip_mii_autonegotiate(sc, sc->tulip_phyaddr); + } else if ((sc->tulip_flags & TULIP_DIDNWAY) == 0) { + u_int32_t data = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_CONTROL); + data &= ~(PHYCTL_SELECT_100MB|PHYCTL_FULL_DUPLEX|PHYCTL_AUTONEG_ENABLE); + sc->tulip_flags &= ~TULIP_DIDNWAY; + if (TULIP_IS_MEDIA_FD(media)) + data |= PHYCTL_FULL_DUPLEX; + if (TULIP_IS_MEDIA_100MB(media)) + data |= PHYCTL_SELECT_100MB; + tulip_mii_writereg(sc, sc->tulip_phyaddr, PHYREG_CONTROL, data); + } + } +} + +static void +tulip_linkup(tulip_softc_t * const sc, tulip_media_t media) +{ + TULIP_LOCK_ASSERT(sc); + if ((sc->tulip_flags & TULIP_LINKUP) == 0) + sc->tulip_flags |= TULIP_PRINTLINKUP; + sc->tulip_flags |= TULIP_LINKUP; + sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; +#if 0 /* XXX how does with work with ifmedia? */ + if ((sc->tulip_flags & TULIP_DIDNWAY) == 0) { + if (sc->tulip_ifp->if_flags & IFF_FULLDUPLEX) { + if (TULIP_CAN_MEDIA_FD(media) + && sc->tulip_mediums[TULIP_FD_MEDIA_OF(media)] != NULL) + media = TULIP_FD_MEDIA_OF(media); + } else { + if (TULIP_IS_MEDIA_FD(media) + && sc->tulip_mediums[TULIP_HD_MEDIA_OF(media)] != NULL) + media = TULIP_HD_MEDIA_OF(media); + } + } +#endif + if (sc->tulip_media != media) { +#ifdef TULIP_DEBUG + sc->tulip_dbg.dbg_last_media = sc->tulip_media; +#endif + sc->tulip_media = media; + sc->tulip_flags |= TULIP_PRINTMEDIA; + if (TULIP_IS_MEDIA_FD(sc->tulip_media)) { + sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX; + } else if (sc->tulip_chipid != TULIP_21041 || (sc->tulip_flags & TULIP_DIDNWAY) == 0) { + sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX; + } + } + /* + * We could set probe_timeout to 0 but setting to 3000 puts this + * in one central place and the only matters is tulip_link is + * followed by a tulip_timeout. Therefore setting it should not + * result in aberrant behavour. + */ + sc->tulip_probe_timeout = 3000; + sc->tulip_probe_state = TULIP_PROBE_INACTIVE; + sc->tulip_flags &= ~(TULIP_TXPROBE_ACTIVE|TULIP_TRYNWAY); + if (sc->tulip_flags & TULIP_INRESET) { + tulip_media_set(sc, sc->tulip_media); + } else if (sc->tulip_probe_media != sc->tulip_media) { + /* + * No reason to change media if we have the right media. + */ + tulip_reset(sc); + } + tulip_init_locked(sc); +} + +static void +tulip_media_print(tulip_softc_t * const sc) +{ + + TULIP_LOCK_ASSERT(sc); + if ((sc->tulip_flags & TULIP_LINKUP) == 0) + return; + if (sc->tulip_flags & TULIP_PRINTMEDIA) { + device_printf(sc->tulip_dev, "enabling %s port\n", + tulip_mediums[sc->tulip_media]); + sc->tulip_flags &= ~(TULIP_PRINTMEDIA|TULIP_PRINTLINKUP); + } else if (sc->tulip_flags & TULIP_PRINTLINKUP) { + device_printf(sc->tulip_dev, "link up\n"); + sc->tulip_flags &= ~TULIP_PRINTLINKUP; + } +} + +#if defined(TULIP_DO_GPR_SENSE) +static tulip_media_t +tulip_21140_gpr_media_sense(tulip_softc_t * const sc) +{ + struct ifnet *ifp sc->tulip_ifp; + tulip_media_t maybe_media = TULIP_MEDIA_UNKNOWN; + tulip_media_t last_media = TULIP_MEDIA_UNKNOWN; + tulip_media_t media; + + TULIP_LOCK_ASSERT(sc); + + /* + * If one of the media blocks contained a default media flag, + * use that. + */ + for (media = TULIP_MEDIA_UNKNOWN; media < TULIP_MEDIA_MAX; media++) { + const tulip_media_info_t *mi; + /* + * Media is not supported (or is full-duplex). + */ + if ((mi = sc->tulip_mediums[media]) == NULL || TULIP_IS_MEDIA_FD(media)) + continue; + if (mi->mi_type != TULIP_MEDIAINFO_GPR) + continue; + + /* + * Remember the media is this is the "default" media. + */ + if (mi->mi_default && maybe_media == TULIP_MEDIA_UNKNOWN) + maybe_media = media; + + /* + * No activity mask? Can't see if it is active if there's no mask. + */ + if (mi->mi_actmask == 0) + continue; + + /* + * Does the activity data match? + */ + if ((TULIP_CSR_READ(sc, csr_gp) & mi->mi_actmask) != mi->mi_actdata) + continue; + +#if defined(TULIP_DEBUG) + device_printf(sc->tulip_dev, "%s: %s: 0x%02x & 0x%02x == 0x%02x\n", + __func__, tulip_mediums[media], TULIP_CSR_READ(sc, csr_gp) & 0xFF, + mi->mi_actmask, mi->mi_actdata); +#endif + /* + * It does! If this is the first media we detected, then + * remember this media. If isn't the first, then there were + * multiple matches which we equate to no match (since we don't + * which to select (if any). + */ + if (last_media == TULIP_MEDIA_UNKNOWN) { + last_media = media; + } else if (last_media != media) { + last_media = TULIP_MEDIA_UNKNOWN; + } + } + return (last_media != TULIP_MEDIA_UNKNOWN) ? last_media : maybe_media; +} +#endif /* TULIP_DO_GPR_SENSE */ + +static tulip_link_status_t +tulip_media_link_monitor(tulip_softc_t * const sc) +{ + const tulip_media_info_t * const mi = sc->tulip_mediums[sc->tulip_media]; + tulip_link_status_t linkup = TULIP_LINK_DOWN; + + TULIP_LOCK_ASSERT(sc); + if (mi == NULL) { +#if defined(DIAGNOSTIC) || defined(TULIP_DEBUG) + panic("tulip_media_link_monitor: %s: botch at line %d\n", + tulip_mediums[sc->tulip_media],__LINE__); +#else + return TULIP_LINK_UNKNOWN; +#endif + } + + + /* + * Have we seen some packets? If so, the link must be good. + */ + if ((sc->tulip_flags & (TULIP_RXACT|TULIP_LINKUP)) == (TULIP_RXACT|TULIP_LINKUP)) { + sc->tulip_flags &= ~TULIP_RXACT; + sc->tulip_probe_timeout = 3000; + return TULIP_LINK_UP; + } + + sc->tulip_flags &= ~TULIP_RXACT; + if (mi->mi_type == TULIP_MEDIAINFO_MII) { + u_int32_t status; + /* + * Read the PHY status register. + */ + status = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_STATUS); + if (status & PHYSTS_AUTONEG_DONE) { + /* + * If the PHY has completed autonegotiation, see the if the + * remote systems abilities have changed. If so, upgrade or + * downgrade as appropriate. + */ + u_int32_t abilities = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_AUTONEG_ABILITIES); + abilities = (abilities << 6) & status; + if (abilities != sc->tulip_abilities) { +#if defined(TULIP_DEBUG) + loudprintf("%s(phy%d): autonegotiation changed: 0x%04x -> 0x%04x\n", + ifp->if_xname, sc->tulip_phyaddr, + sc->tulip_abilities, abilities); +#endif + if (tulip_mii_map_abilities(sc, abilities)) { + tulip_linkup(sc, sc->tulip_probe_media); + return TULIP_LINK_UP; + } + /* + * if we had selected media because of autonegotiation, + * we need to probe for the new media. + */ + sc->tulip_probe_state = TULIP_PROBE_INACTIVE; + if (sc->tulip_flags & TULIP_DIDNWAY) + return TULIP_LINK_DOWN; + } + } + /* + * The link is now up. If was down, say its back up. + */ + if ((status & (PHYSTS_LINK_UP|PHYSTS_REMOTE_FAULT)) == PHYSTS_LINK_UP) + linkup = TULIP_LINK_UP; + } else if (mi->mi_type == TULIP_MEDIAINFO_GPR) { + /* + * No activity sensor? Assume all's well. + */ + if (mi->mi_actmask == 0) + return TULIP_LINK_UNKNOWN; + /* + * Does the activity data match? + */ + if ((TULIP_CSR_READ(sc, csr_gp) & mi->mi_actmask) == mi->mi_actdata) + linkup = TULIP_LINK_UP; + } else if (mi->mi_type == TULIP_MEDIAINFO_SIA) { + /* + * Assume non TP ok for now. + */ + if (!TULIP_IS_MEDIA_TP(sc->tulip_media)) + return TULIP_LINK_UNKNOWN; + if ((TULIP_CSR_READ(sc, csr_sia_status) & TULIP_SIASTS_LINKFAIL) == 0) + linkup = TULIP_LINK_UP; +#if defined(TULIP_DEBUG) + if (sc->tulip_probe_timeout <= 0) + device_printf(sc->tulip_dev, "sia status = 0x%08x\n", + TULIP_CSR_READ(sc, csr_sia_status)); +#endif + } else if (mi->mi_type == TULIP_MEDIAINFO_SYM) { + return TULIP_LINK_UNKNOWN; + } + /* + * We will wait for 3 seconds until the link goes into suspect mode. + */ + if (sc->tulip_flags & TULIP_LINKUP) { + if (linkup == TULIP_LINK_UP) + sc->tulip_probe_timeout = 3000; + if (sc->tulip_probe_timeout > 0) + return TULIP_LINK_UP; + + sc->tulip_flags &= ~TULIP_LINKUP; + device_printf(sc->tulip_dev, "link down: cable problem?\n"); + } +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_link_downed++; +#endif + return TULIP_LINK_DOWN; +} + +static void +tulip_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event) +{ + + TULIP_LOCK_ASSERT(sc); +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_events[event]++; +#endif + if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE + && event == TULIP_MEDIAPOLL_TIMER) { + switch (tulip_media_link_monitor(sc)) { + case TULIP_LINK_DOWN: { + /* + * Link Monitor failed. Probe for new media. + */ + event = TULIP_MEDIAPOLL_LINKFAIL; + break; + } + case TULIP_LINK_UP: { + /* + * Check again soon. + */ + tulip_timeout(sc); + return; + } + case TULIP_LINK_UNKNOWN: { + /* + * We can't tell so don't bother. + */ + return; + } + } + } + + if (event == TULIP_MEDIAPOLL_LINKFAIL) { + if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE) { + if (TULIP_DO_AUTOSENSE(sc)) { +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_link_failures++; +#endif + sc->tulip_media = TULIP_MEDIA_UNKNOWN; + if (sc->tulip_ifp->if_flags & IFF_UP) + tulip_reset(sc); /* restart probe */ + } + return; + } +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_link_pollintrs++; +#endif + } + + if (event == TULIP_MEDIAPOLL_START) { + sc->tulip_ifp->if_drv_flags |= IFF_DRV_OACTIVE; + if (sc->tulip_probe_state != TULIP_PROBE_INACTIVE) + return; + sc->tulip_probe_mediamask = 0; + sc->tulip_probe_passes = 0; +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_media_probes++; +#endif + /* + * If the SROM contained an explicit media to use, use it. + */ + sc->tulip_cmdmode &= ~(TULIP_CMD_RXRUN|TULIP_CMD_FULLDUPLEX); + sc->tulip_flags |= TULIP_TRYNWAY|TULIP_PROBE1STPASS; + sc->tulip_flags &= ~(TULIP_DIDNWAY|TULIP_PRINTMEDIA|TULIP_PRINTLINKUP); + /* + * connidx is defaulted to a media_unknown type. + */ + sc->tulip_probe_media = tulip_srom_conninfo[sc->tulip_connidx].sc_media; + if (sc->tulip_probe_media != TULIP_MEDIA_UNKNOWN) { + tulip_linkup(sc, sc->tulip_probe_media); + tulip_timeout(sc); + return; + } + + if (sc->tulip_features & TULIP_HAVE_GPR) { + sc->tulip_probe_state = TULIP_PROBE_GPRTEST; + sc->tulip_probe_timeout = 2000; + } else { + sc->tulip_probe_media = TULIP_MEDIA_MAX; + sc->tulip_probe_timeout = 0; + sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; + } + } + + /* + * Ignore txprobe failures or spurious callbacks. + */ + if (event == TULIP_MEDIAPOLL_TXPROBE_FAILED + && sc->tulip_probe_state != TULIP_PROBE_MEDIATEST) { + sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE; + return; + } + + /* + * If we really transmitted a packet, then that's the media we'll use. + */ + if (event == TULIP_MEDIAPOLL_TXPROBE_OK || event == TULIP_MEDIAPOLL_LINKPASS) { + if (event == TULIP_MEDIAPOLL_LINKPASS) { + /* XXX Check media status just to be sure */ + sc->tulip_probe_media = TULIP_MEDIA_10BASET; +#if defined(TULIP_DEBUG) + } else { + sc->tulip_dbg.dbg_txprobes_ok[sc->tulip_probe_media]++; +#endif + } + tulip_linkup(sc, sc->tulip_probe_media); + tulip_timeout(sc); + return; + } + + if (sc->tulip_probe_state == TULIP_PROBE_GPRTEST) { +#if defined(TULIP_DO_GPR_SENSE) + /* + * Check for media via the general purpose register. + * + * Try to sense the media via the GPR. If the same value + * occurs 3 times in a row then just use that. + */ + if (sc->tulip_probe_timeout > 0) { + tulip_media_t new_probe_media = tulip_21140_gpr_media_sense(sc); +#if defined(TULIP_DEBUG) + device_printf(sc->tulip_dev, "%s: gpr sensing = %s\n", __func__, + tulip_mediums[new_probe_media]); +#endif + if (new_probe_media != TULIP_MEDIA_UNKNOWN) { + if (new_probe_media == sc->tulip_probe_media) { + if (--sc->tulip_probe_count == 0) + tulip_linkup(sc, sc->tulip_probe_media); + } else { + sc->tulip_probe_count = 10; + } + } + sc->tulip_probe_media = new_probe_media; + tulip_timeout(sc); + return; + } +#endif /* TULIP_DO_GPR_SENSE */ + /* + * Brute force. We cycle through each of the media types + * and try to transmit a packet. + */ + sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; + sc->tulip_probe_media = TULIP_MEDIA_MAX; + sc->tulip_probe_timeout = 0; + tulip_timeout(sc); + return; + } + + if (sc->tulip_probe_state != TULIP_PROBE_MEDIATEST + && (sc->tulip_features & TULIP_HAVE_MII)) { + tulip_media_t old_media = sc->tulip_probe_media; + tulip_mii_autonegotiate(sc, sc->tulip_phyaddr); + switch (sc->tulip_probe_state) { + case TULIP_PROBE_FAILED: + case TULIP_PROBE_MEDIATEST: { + /* + * Try the next media. + */ + sc->tulip_probe_mediamask |= sc->tulip_mediums[sc->tulip_probe_media]->mi_mediamask; + sc->tulip_probe_timeout = 0; +#ifdef notyet + if (sc->tulip_probe_state == TULIP_PROBE_FAILED) + break; + if (sc->tulip_probe_media != tulip_mii_phy_readspecific(sc)) + break; + sc->tulip_probe_timeout = TULIP_IS_MEDIA_TP(sc->tulip_probe_media) ? 2500 : 300; +#endif + break; + } + case TULIP_PROBE_PHYAUTONEG: { + return; + } + case TULIP_PROBE_INACTIVE: { + /* + * Only probe if we autonegotiated a media that hasn't failed. + */ + sc->tulip_probe_timeout = 0; + if (sc->tulip_probe_mediamask & TULIP_BIT(sc->tulip_probe_media)) { + sc->tulip_probe_media = old_media; + break; + } + tulip_linkup(sc, sc->tulip_probe_media); + tulip_timeout(sc); + return; + } + default: { +#if defined(DIAGNOSTIC) || defined(TULIP_DEBUG) + panic("tulip_media_poll: botch at line %d\n", __LINE__); +#endif + break; + } + } + } + + if (event == TULIP_MEDIAPOLL_TXPROBE_FAILED) { +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_txprobes_failed[sc->tulip_probe_media]++; +#endif + sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE; + return; + } + + /* + * switch to another media if we tried this one enough. + */ + if (/* event == TULIP_MEDIAPOLL_TXPROBE_FAILED || */ sc->tulip_probe_timeout <= 0) { +#if defined(TULIP_DEBUG) + if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) { + device_printf(sc->tulip_dev, "poll media unknown!\n"); + sc->tulip_probe_media = TULIP_MEDIA_MAX; + } +#endif + /* + * Find the next media type to check for. Full Duplex + * types are not allowed. + */ + do { + sc->tulip_probe_media -= 1; + if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) { + if (++sc->tulip_probe_passes == 3) { + device_printf(sc->tulip_dev, + "autosense failed: cable problem?\n"); + if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) { + sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + sc->tulip_probe_state = TULIP_PROBE_INACTIVE; + return; + } + } + sc->tulip_flags ^= TULIP_TRYNWAY; /* XXX */ + sc->tulip_probe_mediamask = 0; + sc->tulip_probe_media = TULIP_MEDIA_MAX - 1; + } + } while (sc->tulip_mediums[sc->tulip_probe_media] == NULL + || (sc->tulip_probe_mediamask & TULIP_BIT(sc->tulip_probe_media)) + || TULIP_IS_MEDIA_FD(sc->tulip_probe_media)); + +#if defined(TULIP_DEBUG) + device_printf(sc->tulip_dev, "%s: probing %s\n", + event == TULIP_MEDIAPOLL_TXPROBE_FAILED ? "txprobe failed" : "timeout", + tulip_mediums[sc->tulip_probe_media]); +#endif + sc->tulip_probe_timeout = TULIP_IS_MEDIA_TP(sc->tulip_probe_media) ? 2500 : 1000; + sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; + sc->tulip_probe.probe_txprobes = 0; + tulip_reset(sc); + tulip_media_set(sc, sc->tulip_probe_media); + sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE; + } + tulip_timeout(sc); + + /* + * If this is hanging off a phy, we know are doing NWAY and we have + * forced the phy to a specific speed. Wait for link up before + * before sending a packet. + */ + switch (sc->tulip_mediums[sc->tulip_probe_media]->mi_type) { + case TULIP_MEDIAINFO_MII: { + if (sc->tulip_probe_media != tulip_mii_phy_readspecific(sc)) + return; + break; + } + case TULIP_MEDIAINFO_SIA: { + if (TULIP_IS_MEDIA_TP(sc->tulip_probe_media)) { + if (TULIP_CSR_READ(sc, csr_sia_status) & TULIP_SIASTS_LINKFAIL) + return; + tulip_linkup(sc, sc->tulip_probe_media); +#ifdef notyet + if (sc->tulip_features & TULIP_HAVE_MII) + tulip_timeout(sc); +#endif + return; + } + break; + } + case TULIP_MEDIAINFO_RESET: + case TULIP_MEDIAINFO_SYM: + case TULIP_MEDIAINFO_NONE: + case TULIP_MEDIAINFO_GPR: { + break; + } + } + /* + * Try to send a packet. + */ + tulip_txprobe(sc); +} + +static void +tulip_media_select(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + if (sc->tulip_features & TULIP_HAVE_GPR) { + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_PINSET|sc->tulip_gpinit); + DELAY(10); + TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_gpdata); + } + /* + * If this board has no media, just return + */ + if (sc->tulip_features & TULIP_HAVE_NOMEDIA) + return; + + if (sc->tulip_media == TULIP_MEDIA_UNKNOWN) { + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + (*sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_START); + } else { + tulip_media_set(sc, sc->tulip_media); + } +} + +static void +tulip_21040_mediainfo_init(tulip_softc_t * const sc, tulip_media_t media) +{ + TULIP_LOCK_ASSERT(sc); + sc->tulip_cmdmode |= TULIP_CMD_CAPTREFFCT|TULIP_CMD_THRSHLD160 + |TULIP_CMD_BACKOFFCTR; + sc->tulip_ifp->if_baudrate = 10000000; + + if (media == TULIP_MEDIA_10BASET || media == TULIP_MEDIA_UNKNOWN) { + TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[0], 21040, 10BASET); + TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[1], 21040, 10BASET_FD); + sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL; + } + + if (media == TULIP_MEDIA_AUIBNC || media == TULIP_MEDIA_UNKNOWN) { + TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[2], 21040, AUIBNC); + } + + if (media == TULIP_MEDIA_UNKNOWN) { + TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[3], 21040, EXTSIA); + } +} + +static void +tulip_21040_media_probe(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + tulip_21040_mediainfo_init(sc, TULIP_MEDIA_UNKNOWN); + return; +} + +static void +tulip_21040_10baset_only_media_probe(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + tulip_21040_mediainfo_init(sc, TULIP_MEDIA_10BASET); + tulip_media_set(sc, TULIP_MEDIA_10BASET); + sc->tulip_media = TULIP_MEDIA_10BASET; +} + +static void +tulip_21040_10baset_only_media_select(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + sc->tulip_flags |= TULIP_LINKUP; + if (sc->tulip_media == TULIP_MEDIA_10BASET_FD) { + sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX; + sc->tulip_flags &= ~TULIP_SQETEST; + } else { + sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX; + sc->tulip_flags |= TULIP_SQETEST; + } + tulip_media_set(sc, sc->tulip_media); +} + +static void +tulip_21040_auibnc_only_media_probe(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + tulip_21040_mediainfo_init(sc, TULIP_MEDIA_AUIBNC); + sc->tulip_flags |= TULIP_SQETEST|TULIP_LINKUP; + tulip_media_set(sc, TULIP_MEDIA_AUIBNC); + sc->tulip_media = TULIP_MEDIA_AUIBNC; +} + +static void +tulip_21040_auibnc_only_media_select(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + tulip_media_set(sc, TULIP_MEDIA_AUIBNC); + sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX; +} + +static const tulip_boardsw_t tulip_21040_boardsw = { + TULIP_21040_GENERIC, + tulip_21040_media_probe, + tulip_media_select, + tulip_media_poll, +}; + +static const tulip_boardsw_t tulip_21040_10baset_only_boardsw = { + TULIP_21040_GENERIC, + tulip_21040_10baset_only_media_probe, + tulip_21040_10baset_only_media_select, + NULL, +}; + +static const tulip_boardsw_t tulip_21040_auibnc_only_boardsw = { + TULIP_21040_GENERIC, + tulip_21040_auibnc_only_media_probe, + tulip_21040_auibnc_only_media_select, + NULL, +}; + +static void +tulip_21041_mediainfo_init(tulip_softc_t * const sc) +{ + tulip_media_info_t * const mi = sc->tulip_mediainfo; + + TULIP_LOCK_ASSERT(sc); +#ifdef notyet + if (sc->tulip_revinfo >= 0x20) { + TULIP_MEDIAINFO_SIA_INIT(sc, &mi[0], 21041P2, 10BASET); + TULIP_MEDIAINFO_SIA_INIT(sc, &mi[1], 21041P2, 10BASET_FD); + TULIP_MEDIAINFO_SIA_INIT(sc, &mi[0], 21041P2, AUI); + TULIP_MEDIAINFO_SIA_INIT(sc, &mi[1], 21041P2, BNC); + return; + } +#endif + TULIP_MEDIAINFO_SIA_INIT(sc, &mi[0], 21041, 10BASET); + TULIP_MEDIAINFO_SIA_INIT(sc, &mi[1], 21041, 10BASET_FD); + TULIP_MEDIAINFO_SIA_INIT(sc, &mi[2], 21041, AUI); + TULIP_MEDIAINFO_SIA_INIT(sc, &mi[3], 21041, BNC); +} + +static void +tulip_21041_media_probe(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + sc->tulip_ifp->if_baudrate = 10000000; + sc->tulip_cmdmode |= TULIP_CMD_CAPTREFFCT|TULIP_CMD_ENHCAPTEFFCT + |TULIP_CMD_THRSHLD160|TULIP_CMD_BACKOFFCTR; + sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL; + tulip_21041_mediainfo_init(sc); +} + +static void +tulip_21041_media_poll(tulip_softc_t * const sc, + const tulip_mediapoll_event_t event) +{ + u_int32_t sia_status; + + TULIP_LOCK_ASSERT(sc); +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_events[event]++; +#endif + + if (event == TULIP_MEDIAPOLL_LINKFAIL) { + if (sc->tulip_probe_state != TULIP_PROBE_INACTIVE + || !TULIP_DO_AUTOSENSE(sc)) + return; + sc->tulip_media = TULIP_MEDIA_UNKNOWN; + tulip_reset(sc); /* start probe */ + return; + } + + /* + * If we've been been asked to start a poll or link change interrupt + * restart the probe (and reset the tulip to a known state). + */ + if (event == TULIP_MEDIAPOLL_START) { + sc->tulip_ifp->if_drv_flags |= IFF_DRV_OACTIVE; + sc->tulip_cmdmode &= ~(TULIP_CMD_FULLDUPLEX|TULIP_CMD_RXRUN); +#ifdef notyet + if (sc->tulip_revinfo >= 0x20) { + sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX; + sc->tulip_flags |= TULIP_DIDNWAY; + } +#endif + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); + sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; + sc->tulip_probe_media = TULIP_MEDIA_10BASET; + sc->tulip_probe_timeout = TULIP_21041_PROBE_10BASET_TIMEOUT; + tulip_media_set(sc, TULIP_MEDIA_10BASET); + tulip_timeout(sc); + return; + } + + if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE) + return; + + if (event == TULIP_MEDIAPOLL_TXPROBE_OK) { +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_txprobes_ok[sc->tulip_probe_media]++; +#endif + tulip_linkup(sc, sc->tulip_probe_media); + return; + } + + sia_status = TULIP_CSR_READ(sc, csr_sia_status); + TULIP_CSR_WRITE(sc, csr_sia_status, sia_status); + if ((sia_status & TULIP_SIASTS_LINKFAIL) == 0) { + if (sc->tulip_revinfo >= 0x20) { + if (sia_status & (PHYSTS_10BASET_FD << (16 - 6))) + sc->tulip_probe_media = TULIP_MEDIA_10BASET_FD; + } + /* + * If the link has passed LinkPass, 10baseT is the + * proper media to use. + */ + tulip_linkup(sc, sc->tulip_probe_media); + return; + } + + /* + * wait for up to 2.4 seconds for the link to reach pass state. + * Only then start scanning the other media for activity. + * choose media with receive activity over those without. + */ + if (sc->tulip_probe_media == TULIP_MEDIA_10BASET) { + if (event != TULIP_MEDIAPOLL_TIMER) + return; + if (sc->tulip_probe_timeout > 0 + && (sia_status & TULIP_SIASTS_OTHERRXACTIVITY) == 0) { + tulip_timeout(sc); + return; + } + sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT; + sc->tulip_flags |= TULIP_WANTRXACT; + if (sia_status & TULIP_SIASTS_OTHERRXACTIVITY) { + sc->tulip_probe_media = TULIP_MEDIA_BNC; + } else { + sc->tulip_probe_media = TULIP_MEDIA_AUI; + } + tulip_media_set(sc, sc->tulip_probe_media); + tulip_timeout(sc); + return; + } + + /* + * If we failed, clear the txprobe active flag. + */ + if (event == TULIP_MEDIAPOLL_TXPROBE_FAILED) + sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE; + + + if (event == TULIP_MEDIAPOLL_TIMER) { + /* + * If we've received something, then that's our link! + */ + if (sc->tulip_flags & TULIP_RXACT) { + tulip_linkup(sc, sc->tulip_probe_media); + return; + } + /* + * if no txprobe active + */ + if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0 + && ((sc->tulip_flags & TULIP_WANTRXACT) == 0 + || (sia_status & TULIP_SIASTS_RXACTIVITY))) { + sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT; + tulip_txprobe(sc); + tulip_timeout(sc); + return; + } + /* + * Take 2 passes through before deciding to not + * wait for receive activity. Then take another + * two passes before spitting out a warning. + */ + if (sc->tulip_probe_timeout <= 0) { + if (sc->tulip_flags & TULIP_WANTRXACT) { + sc->tulip_flags &= ~TULIP_WANTRXACT; + sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT; + } else { + device_printf(sc->tulip_dev, + "autosense failed: cable problem?\n"); + if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) { + sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + sc->tulip_probe_state = TULIP_PROBE_INACTIVE; + return; + } + } + } + } + + /* + * Since this media failed to probe, try the other one. + */ + sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT; + if (sc->tulip_probe_media == TULIP_MEDIA_AUI) { + sc->tulip_probe_media = TULIP_MEDIA_BNC; + } else { + sc->tulip_probe_media = TULIP_MEDIA_AUI; + } + tulip_media_set(sc, sc->tulip_probe_media); + sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE; + tulip_timeout(sc); +} + +static const tulip_boardsw_t tulip_21041_boardsw = { + TULIP_21041_GENERIC, + tulip_21041_media_probe, + tulip_media_select, + tulip_21041_media_poll +}; + +static const tulip_phy_attr_t tulip_mii_phy_attrlist[] = { + { 0x20005c00, 0, /* 08-00-17 */ + { + { 0x19, 0x0040, 0x0040 }, /* 10TX */ + { 0x19, 0x0040, 0x0000 }, /* 100TX */ + }, +#if defined(TULIP_DEBUG) + "NS DP83840", +#endif + }, + { 0x0281F400, 0, /* 00-A0-7D */ + { + { 0x12, 0x0010, 0x0000 }, /* 10T */ + { }, /* 100TX */ + { 0x12, 0x0010, 0x0010 }, /* 100T4 */ + { 0x12, 0x0008, 0x0008 }, /* FULL_DUPLEX */ + }, +#if defined(TULIP_DEBUG) + "Seeq 80C240" +#endif + }, +#if 0 + { 0x0015F420, 0, /* 00-A0-7D */ + { + { 0x12, 0x0010, 0x0000 }, /* 10T */ + { }, /* 100TX */ + { 0x12, 0x0010, 0x0010 }, /* 100T4 */ + { 0x12, 0x0008, 0x0008 }, /* FULL_DUPLEX */ + }, +#if defined(TULIP_DEBUG) + "Broadcom BCM5000" +#endif + }, +#endif + { 0x0281F400, 0, /* 00-A0-BE */ + { + { 0x11, 0x8000, 0x0000 }, /* 10T */ + { 0x11, 0x8000, 0x8000 }, /* 100TX */ + { }, /* 100T4 */ + { 0x11, 0x4000, 0x4000 }, /* FULL_DUPLEX */ + }, +#if defined(TULIP_DEBUG) + "ICS 1890" +#endif + }, + { 0 } +}; + +static tulip_media_t +tulip_mii_phy_readspecific(tulip_softc_t * const sc) +{ + const tulip_phy_attr_t *attr; + u_int16_t data; + u_int32_t id; + unsigned idx = 0; + static const tulip_media_t table[] = { + TULIP_MEDIA_UNKNOWN, + TULIP_MEDIA_10BASET, + TULIP_MEDIA_100BASETX, + TULIP_MEDIA_100BASET4, + TULIP_MEDIA_UNKNOWN, + TULIP_MEDIA_10BASET_FD, + TULIP_MEDIA_100BASETX_FD, + TULIP_MEDIA_UNKNOWN + }; + + TULIP_LOCK_ASSERT(sc); + + /* + * Don't read phy specific registers if link is not up. + */ + data = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_STATUS); + if ((data & (PHYSTS_LINK_UP|PHYSTS_EXTENDED_REGS)) != (PHYSTS_LINK_UP|PHYSTS_EXTENDED_REGS)) + return TULIP_MEDIA_UNKNOWN; + + id = (tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_IDLOW) << 16) | + tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_IDHIGH); + for (attr = tulip_mii_phy_attrlist;; attr++) { + if (attr->attr_id == 0) + return TULIP_MEDIA_UNKNOWN; + if ((id & ~0x0F) == attr->attr_id) + break; + } + + if (attr->attr_modes[PHY_MODE_100TX].pm_regno) { + const tulip_phy_modedata_t * const pm = &attr->attr_modes[PHY_MODE_100TX]; + data = tulip_mii_readreg(sc, sc->tulip_phyaddr, pm->pm_regno); + if ((data & pm->pm_mask) == pm->pm_value) + idx = 2; + } + if (idx == 0 && attr->attr_modes[PHY_MODE_100T4].pm_regno) { + const tulip_phy_modedata_t * const pm = &attr->attr_modes[PHY_MODE_100T4]; + data = tulip_mii_readreg(sc, sc->tulip_phyaddr, pm->pm_regno); + if ((data & pm->pm_mask) == pm->pm_value) + idx = 3; + } + if (idx == 0 && attr->attr_modes[PHY_MODE_10T].pm_regno) { + const tulip_phy_modedata_t * const pm = &attr->attr_modes[PHY_MODE_10T]; + data = tulip_mii_readreg(sc, sc->tulip_phyaddr, pm->pm_regno); + if ((data & pm->pm_mask) == pm->pm_value) + idx = 1; + } + if (idx != 0 && attr->attr_modes[PHY_MODE_FULLDUPLEX].pm_regno) { + const tulip_phy_modedata_t * const pm = &attr->attr_modes[PHY_MODE_FULLDUPLEX]; + data = tulip_mii_readreg(sc, sc->tulip_phyaddr, pm->pm_regno); + idx += ((data & pm->pm_mask) == pm->pm_value ? 4 : 0); + } + return table[idx]; +} + +static unsigned +tulip_mii_get_phyaddr(tulip_softc_t * const sc, unsigned offset) +{ + unsigned phyaddr; + + TULIP_LOCK_ASSERT(sc); + for (phyaddr = 1; phyaddr < 32; phyaddr++) { + unsigned status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS); + if (status == 0 || status == 0xFFFF || status < PHYSTS_10BASET) + continue; + if (offset == 0) + return phyaddr; + offset--; + } + if (offset == 0) { + unsigned status = tulip_mii_readreg(sc, 0, PHYREG_STATUS); + if (status == 0 || status == 0xFFFF || status < PHYSTS_10BASET) + return TULIP_MII_NOPHY; + return 0; + } + return TULIP_MII_NOPHY; +} + +static int +tulip_mii_map_abilities(tulip_softc_t * const sc, unsigned abilities) +{ + TULIP_LOCK_ASSERT(sc); + sc->tulip_abilities = abilities; + if (abilities & PHYSTS_100BASETX_FD) { + sc->tulip_probe_media = TULIP_MEDIA_100BASETX_FD; + } else if (abilities & PHYSTS_100BASET4) { + sc->tulip_probe_media = TULIP_MEDIA_100BASET4; + } else if (abilities & PHYSTS_100BASETX) { + sc->tulip_probe_media = TULIP_MEDIA_100BASETX; + } else if (abilities & PHYSTS_10BASET_FD) { + sc->tulip_probe_media = TULIP_MEDIA_10BASET_FD; + } else if (abilities & PHYSTS_10BASET) { + sc->tulip_probe_media = TULIP_MEDIA_10BASET; + } else { + sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; + return 0; + } + sc->tulip_probe_state = TULIP_PROBE_INACTIVE; + return 1; +} + +static void +tulip_mii_autonegotiate(tulip_softc_t * const sc, const unsigned phyaddr) +{ + struct ifnet *ifp = sc->tulip_ifp; + + TULIP_LOCK_ASSERT(sc); + switch (sc->tulip_probe_state) { + case TULIP_PROBE_MEDIATEST: + case TULIP_PROBE_INACTIVE: { + sc->tulip_flags |= TULIP_DIDNWAY; + tulip_mii_writereg(sc, phyaddr, PHYREG_CONTROL, PHYCTL_RESET); + sc->tulip_probe_timeout = 3000; + sc->tulip_intrmask |= TULIP_STS_ABNRMLINTR|TULIP_STS_NORMALINTR; + sc->tulip_probe_state = TULIP_PROBE_PHYRESET; + } + /* FALLTHROUGH */ + case TULIP_PROBE_PHYRESET: { + u_int32_t status; + u_int32_t data = tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL); + if (data & PHYCTL_RESET) { + if (sc->tulip_probe_timeout > 0) { + tulip_timeout(sc); + return; + } + printf("%s(phy%d): error: reset of PHY never completed!\n", + ifp->if_xname, phyaddr); + sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE; + sc->tulip_probe_state = TULIP_PROBE_FAILED; + sc->tulip_ifp->if_flags &= ~IFF_UP; + sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + return; + } + status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS); + if ((status & PHYSTS_CAN_AUTONEG) == 0) { +#if defined(TULIP_DEBUG) + loudprintf("%s(phy%d): autonegotiation disabled\n", + ifp->if_xname, phyaddr); +#endif + sc->tulip_flags &= ~TULIP_DIDNWAY; + sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; + return; + } + if (tulip_mii_readreg(sc, phyaddr, PHYREG_AUTONEG_ADVERTISEMENT) != ((status >> 6) | 0x01)) + tulip_mii_writereg(sc, phyaddr, PHYREG_AUTONEG_ADVERTISEMENT, (status >> 6) | 0x01); + tulip_mii_writereg(sc, phyaddr, PHYREG_CONTROL, data|PHYCTL_AUTONEG_RESTART|PHYCTL_AUTONEG_ENABLE); + data = tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL); +#if defined(TULIP_DEBUG) + if ((data & PHYCTL_AUTONEG_ENABLE) == 0) + loudprintf("%s(phy%d): oops: enable autonegotiation failed: 0x%04x\n", + ifp->if_xname, phyaddr, data); + else + loudprintf("%s(phy%d): autonegotiation restarted: 0x%04x\n", + ifp->if_xname, phyaddr, data); + sc->tulip_dbg.dbg_nway_starts++; +#endif + sc->tulip_probe_state = TULIP_PROBE_PHYAUTONEG; + sc->tulip_probe_timeout = 3000; + } + /* FALLTHROUGH */ + case TULIP_PROBE_PHYAUTONEG: { + u_int32_t status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS); + u_int32_t data; + if ((status & PHYSTS_AUTONEG_DONE) == 0) { + if (sc->tulip_probe_timeout > 0) { + tulip_timeout(sc); + return; + } +#if defined(TULIP_DEBUG) + loudprintf("%s(phy%d): autonegotiation timeout: sts=0x%04x, ctl=0x%04x\n", + ifp->if_xname, phyaddr, status, + tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL)); +#endif + sc->tulip_flags &= ~TULIP_DIDNWAY; + sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; + return; + } + data = tulip_mii_readreg(sc, phyaddr, PHYREG_AUTONEG_ABILITIES); +#if defined(TULIP_DEBUG) + loudprintf("%s(phy%d): autonegotiation complete: 0x%04x\n", + ifp->if_xname, phyaddr, data); +#endif + data = (data << 6) & status; + if (!tulip_mii_map_abilities(sc, data)) + sc->tulip_flags &= ~TULIP_DIDNWAY; + return; + } + default: { +#if defined(DIAGNOSTIC) + panic("tulip_media_poll: botch at line %d\n", __LINE__); +#endif + break; + } + } +#if defined(TULIP_DEBUG) + loudprintf("%s(phy%d): autonegotiation failure: state = %d\n", + ifp->if_xname, phyaddr, sc->tulip_probe_state); + sc->tulip_dbg.dbg_nway_failures++; +#endif +} + +static void +tulip_2114x_media_preset(tulip_softc_t * const sc) +{ + const tulip_media_info_t *mi = NULL; + tulip_media_t media = sc->tulip_media; + + TULIP_LOCK_ASSERT(sc); + if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE) + media = sc->tulip_media; + else + media = sc->tulip_probe_media; + + sc->tulip_cmdmode &= ~TULIP_CMD_PORTSELECT; + sc->tulip_flags &= ~TULIP_SQETEST; + if (media != TULIP_MEDIA_UNKNOWN && media != TULIP_MEDIA_MAX) { +#if defined(TULIP_DEBUG) + if (media < TULIP_MEDIA_MAX && sc->tulip_mediums[media] != NULL) { +#endif + mi = sc->tulip_mediums[media]; + if (mi->mi_type == TULIP_MEDIAINFO_MII) { + sc->tulip_cmdmode |= TULIP_CMD_PORTSELECT; + } else if (mi->mi_type == TULIP_MEDIAINFO_GPR + || mi->mi_type == TULIP_MEDIAINFO_SYM) { + sc->tulip_cmdmode &= ~TULIP_GPR_CMDBITS; + sc->tulip_cmdmode |= mi->mi_cmdmode; + } else if (mi->mi_type == TULIP_MEDIAINFO_SIA) { + TULIP_CSR_WRITE(sc, csr_sia_connectivity, TULIP_SIACONN_RESET); + } +#if defined(TULIP_DEBUG) + } else { + device_printf(sc->tulip_dev, "preset: bad media %d!\n", media); + } +#endif + } + switch (media) { + case TULIP_MEDIA_BNC: + case TULIP_MEDIA_AUI: + case TULIP_MEDIA_10BASET: { + sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX; + sc->tulip_cmdmode |= TULIP_CMD_TXTHRSHLDCTL; + sc->tulip_ifp->if_baudrate = 10000000; + sc->tulip_flags |= TULIP_SQETEST; + break; + } + case TULIP_MEDIA_10BASET_FD: { + sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX|TULIP_CMD_TXTHRSHLDCTL; + sc->tulip_ifp->if_baudrate = 10000000; + break; + } + case TULIP_MEDIA_100BASEFX: + case TULIP_MEDIA_100BASET4: + case TULIP_MEDIA_100BASETX: { + sc->tulip_cmdmode &= ~(TULIP_CMD_FULLDUPLEX|TULIP_CMD_TXTHRSHLDCTL); + sc->tulip_cmdmode |= TULIP_CMD_PORTSELECT; + sc->tulip_ifp->if_baudrate = 100000000; + break; + } + case TULIP_MEDIA_100BASEFX_FD: + case TULIP_MEDIA_100BASETX_FD: { + sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX|TULIP_CMD_PORTSELECT; + sc->tulip_cmdmode &= ~TULIP_CMD_TXTHRSHLDCTL; + sc->tulip_ifp->if_baudrate = 100000000; + break; + } + default: { + break; + } + } + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); +} + +/* + ******************************************************************** + * Start of 21140/21140A support which does not use the MII interface + */ + +static void +tulip_null_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event) +{ +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_events[event]++; +#endif +#if defined(DIAGNOSTIC) + device_printf(sc->tulip_dev, "botch(media_poll) at line %d\n", __LINE__); +#endif +} + +__inline static void +tulip_21140_mediainit(tulip_softc_t * const sc, tulip_media_info_t * const mip, + tulip_media_t const media, unsigned gpdata, unsigned cmdmode) +{ + TULIP_LOCK_ASSERT(sc); + sc->tulip_mediums[media] = mip; + mip->mi_type = TULIP_MEDIAINFO_GPR; + mip->mi_cmdmode = cmdmode; + mip->mi_gpdata = gpdata; +} + +static void +tulip_21140_evalboard_media_probe(tulip_softc_t * const sc) +{ + tulip_media_info_t *mip = sc->tulip_mediainfo; + + TULIP_LOCK_ASSERT(sc); + sc->tulip_gpinit = TULIP_GP_EB_PINS; + sc->tulip_gpdata = TULIP_GP_EB_INIT; + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_PINS); + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_INIT); + TULIP_CSR_WRITE(sc, csr_command, + TULIP_CSR_READ(sc, csr_command) | TULIP_CMD_PORTSELECT | + TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE); + TULIP_CSR_WRITE(sc, csr_command, + TULIP_CSR_READ(sc, csr_command) & ~TULIP_CMD_TXTHRSHLDCTL); + DELAY(1000000); + if ((TULIP_CSR_READ(sc, csr_gp) & TULIP_GP_EB_OK100) != 0) { + sc->tulip_media = TULIP_MEDIA_10BASET; + } else { + sc->tulip_media = TULIP_MEDIA_100BASETX; + } + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET, + TULIP_GP_EB_INIT, + TULIP_CMD_TXTHRSHLDCTL); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD, + TULIP_GP_EB_INIT, + TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX, + TULIP_GP_EB_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD, + TULIP_GP_EB_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX); +} + +static const tulip_boardsw_t tulip_21140_eb_boardsw = { + TULIP_21140_DEC_EB, + tulip_21140_evalboard_media_probe, + tulip_media_select, + tulip_null_media_poll, + tulip_2114x_media_preset, +}; + +static void +tulip_21140_accton_media_probe(tulip_softc_t * const sc) +{ + tulip_media_info_t *mip = sc->tulip_mediainfo; + unsigned gpdata; + + TULIP_LOCK_ASSERT(sc); + sc->tulip_gpinit = TULIP_GP_EB_PINS; + sc->tulip_gpdata = TULIP_GP_EB_INIT; + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_PINS); + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_INIT); + TULIP_CSR_WRITE(sc, csr_command, + TULIP_CSR_READ(sc, csr_command) | TULIP_CMD_PORTSELECT | + TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE); + TULIP_CSR_WRITE(sc, csr_command, + TULIP_CSR_READ(sc, csr_command) & ~TULIP_CMD_TXTHRSHLDCTL); + DELAY(1000000); + gpdata = TULIP_CSR_READ(sc, csr_gp); + if ((gpdata & TULIP_GP_EN1207_UTP_INIT) == 0) { + sc->tulip_media = TULIP_MEDIA_10BASET; + } else { + if ((gpdata & TULIP_GP_EN1207_BNC_INIT) == 0) { + sc->tulip_media = TULIP_MEDIA_BNC; + } else { + sc->tulip_media = TULIP_MEDIA_100BASETX; + } + } + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_BNC, + TULIP_GP_EN1207_BNC_INIT, + TULIP_CMD_TXTHRSHLDCTL); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET, + TULIP_GP_EN1207_UTP_INIT, + TULIP_CMD_TXTHRSHLDCTL); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD, + TULIP_GP_EN1207_UTP_INIT, + TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX, + TULIP_GP_EN1207_100_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD, + TULIP_GP_EN1207_100_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX); +} + +static const tulip_boardsw_t tulip_21140_accton_boardsw = { + TULIP_21140_EN1207, + tulip_21140_accton_media_probe, + tulip_media_select, + tulip_null_media_poll, + tulip_2114x_media_preset, +}; + +static void +tulip_21140_smc9332_media_probe(tulip_softc_t * const sc) +{ + tulip_media_info_t *mip = sc->tulip_mediainfo; + int idx, cnt = 0; + + TULIP_LOCK_ASSERT(sc); + TULIP_CSR_WRITE(sc, csr_command, TULIP_CMD_PORTSELECT|TULIP_CMD_MUSTBEONE); + TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET); + DELAY(10); /* Wait 10 microseconds (actually 50 PCI cycles but at + 33MHz that comes to two microseconds but wait a + bit longer anyways) */ + TULIP_CSR_WRITE(sc, csr_command, TULIP_CMD_PORTSELECT | + TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE); + sc->tulip_gpinit = TULIP_GP_SMC_9332_PINS; + sc->tulip_gpdata = TULIP_GP_SMC_9332_INIT; + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_SMC_9332_PINS|TULIP_GP_PINSET); + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_SMC_9332_INIT); + DELAY(200000); + for (idx = 1000; idx > 0; idx--) { + u_int32_t csr = TULIP_CSR_READ(sc, csr_gp); + if ((csr & (TULIP_GP_SMC_9332_OK10|TULIP_GP_SMC_9332_OK100)) == (TULIP_GP_SMC_9332_OK10|TULIP_GP_SMC_9332_OK100)) { + if (++cnt > 100) + break; + } else if ((csr & TULIP_GP_SMC_9332_OK10) == 0) { + break; + } else { + cnt = 0; + } + DELAY(1000); + } + sc->tulip_media = cnt > 100 ? TULIP_MEDIA_100BASETX : TULIP_MEDIA_10BASET; + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX, + TULIP_GP_SMC_9332_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD, + TULIP_GP_SMC_9332_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET, + TULIP_GP_SMC_9332_INIT, + TULIP_CMD_TXTHRSHLDCTL); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD, + TULIP_GP_SMC_9332_INIT, + TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX); +} + +static const tulip_boardsw_t tulip_21140_smc9332_boardsw = { + TULIP_21140_SMC_9332, + tulip_21140_smc9332_media_probe, + tulip_media_select, + tulip_null_media_poll, + tulip_2114x_media_preset, +}; + +static void +tulip_21140_cogent_em100_media_probe(tulip_softc_t * const sc) +{ + tulip_media_info_t *mip = sc->tulip_mediainfo; + u_int32_t cmdmode = TULIP_CSR_READ(sc, csr_command); + + TULIP_LOCK_ASSERT(sc); + sc->tulip_gpinit = TULIP_GP_EM100_PINS; + sc->tulip_gpdata = TULIP_GP_EM100_INIT; + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EM100_PINS); + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EM100_INIT); + + cmdmode = TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION|TULIP_CMD_MUSTBEONE; + cmdmode &= ~(TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_SCRAMBLER); + if (sc->tulip_rombuf[32] == TULIP_COGENT_EM100FX_ID) { + TULIP_CSR_WRITE(sc, csr_command, cmdmode); + sc->tulip_media = TULIP_MEDIA_100BASEFX; + + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASEFX, + TULIP_GP_EM100_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASEFX_FD, + TULIP_GP_EM100_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_FULLDUPLEX); + } else { + TULIP_CSR_WRITE(sc, csr_command, cmdmode|TULIP_CMD_SCRAMBLER); + sc->tulip_media = TULIP_MEDIA_100BASETX; + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX, + TULIP_GP_EM100_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD, + TULIP_GP_EM100_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX); + } +} + +static const tulip_boardsw_t tulip_21140_cogent_em100_boardsw = { + TULIP_21140_COGENT_EM100, + tulip_21140_cogent_em100_media_probe, + tulip_media_select, + tulip_null_media_poll, + tulip_2114x_media_preset +}; + +static void +tulip_21140_znyx_zx34x_media_probe(tulip_softc_t * const sc) +{ + tulip_media_info_t *mip = sc->tulip_mediainfo; + int cnt10 = 0, cnt100 = 0, idx; + + TULIP_LOCK_ASSERT(sc); + sc->tulip_gpinit = TULIP_GP_ZX34X_PINS; + sc->tulip_gpdata = TULIP_GP_ZX34X_INIT; + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ZX34X_PINS); + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ZX34X_INIT); + TULIP_CSR_WRITE(sc, csr_command, + TULIP_CSR_READ(sc, csr_command) | TULIP_CMD_PORTSELECT | + TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE); + TULIP_CSR_WRITE(sc, csr_command, + TULIP_CSR_READ(sc, csr_command) & ~TULIP_CMD_TXTHRSHLDCTL); + + DELAY(200000); + for (idx = 1000; idx > 0; idx--) { + u_int32_t csr = TULIP_CSR_READ(sc, csr_gp); + if ((csr & (TULIP_GP_ZX34X_LNKFAIL|TULIP_GP_ZX34X_SYMDET|TULIP_GP_ZX34X_SIGDET)) == (TULIP_GP_ZX34X_LNKFAIL|TULIP_GP_ZX34X_SYMDET|TULIP_GP_ZX34X_SIGDET)) { + if (++cnt100 > 100) + break; + } else if ((csr & TULIP_GP_ZX34X_LNKFAIL) == 0) { + if (++cnt10 > 100) + break; + } else { + cnt10 = 0; + cnt100 = 0; + } + DELAY(1000); + } + sc->tulip_media = cnt100 > 100 ? TULIP_MEDIA_100BASETX : TULIP_MEDIA_10BASET; + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET, + TULIP_GP_ZX34X_INIT, + TULIP_CMD_TXTHRSHLDCTL); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD, + TULIP_GP_ZX34X_INIT, + TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX, + TULIP_GP_ZX34X_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER); + tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD, + TULIP_GP_ZX34X_INIT, + TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION + |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX); +} + +static const tulip_boardsw_t tulip_21140_znyx_zx34x_boardsw = { + TULIP_21140_ZNYX_ZX34X, + tulip_21140_znyx_zx34x_media_probe, + tulip_media_select, + tulip_null_media_poll, + tulip_2114x_media_preset, +}; + +static void +tulip_2114x_media_probe(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + sc->tulip_cmdmode |= TULIP_CMD_MUSTBEONE + |TULIP_CMD_BACKOFFCTR|TULIP_CMD_THRSHLD72; +} + +static const tulip_boardsw_t tulip_2114x_isv_boardsw = { + TULIP_21140_ISV, + tulip_2114x_media_probe, + tulip_media_select, + tulip_media_poll, + tulip_2114x_media_preset, +}; + +/* + * ******** END of chip-specific handlers. *********** + */ + +/* + * Code the read the SROM and MII bit streams (I2C) + */ +#define EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); DELAY(1); } while (0) + +static void +tulip_srom_idle(tulip_softc_t * const sc) +{ + unsigned bit, csr; + + csr = SROMSEL ; EMIT; + csr = SROMSEL | SROMRD; EMIT; + csr ^= SROMCS; EMIT; + csr ^= SROMCLKON; EMIT; + + /* + * Write 25 cycles of 0 which will force the SROM to be idle. + */ + for (bit = 3 + SROM_BITWIDTH + 16; bit > 0; bit--) { + csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */ + csr ^= SROMCLKON; EMIT; /* clock high; data valid */ + } + csr ^= SROMCLKOFF; EMIT; + csr ^= SROMCS; EMIT; + csr = 0; EMIT; +} + +static void +tulip_srom_read(tulip_softc_t * const sc) +{ + unsigned idx; + const unsigned bitwidth = SROM_BITWIDTH; + const unsigned cmdmask = (SROMCMD_RD << bitwidth); + const unsigned msb = 1 << (bitwidth + 3 - 1); + unsigned lastidx = (1 << bitwidth) - 1; + + tulip_srom_idle(sc); + + for (idx = 0; idx <= lastidx; idx++) { + unsigned lastbit, data, bits, bit, csr; + csr = SROMSEL ; EMIT; + csr = SROMSEL | SROMRD; EMIT; + csr ^= SROMCSON; EMIT; + csr ^= SROMCLKON; EMIT; + + lastbit = 0; + for (bits = idx|cmdmask, bit = bitwidth + 3; bit > 0; bit--, bits <<= 1) { + const unsigned thisbit = bits & msb; + csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */ + if (thisbit != lastbit) { + csr ^= SROMDOUT; EMIT; /* clock low; invert data */ + } else { + EMIT; + } + csr ^= SROMCLKON; EMIT; /* clock high; data valid */ + lastbit = thisbit; + } + csr ^= SROMCLKOFF; EMIT; + + for (data = 0, bits = 0; bits < 16; bits++) { + data <<= 1; + csr ^= SROMCLKON; EMIT; /* clock high; data valid */ + data |= TULIP_CSR_READ(sc, csr_srom_mii) & SROMDIN ? 1 : 0; + csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */ + } + sc->tulip_rombuf[idx*2] = data & 0xFF; + sc->tulip_rombuf[idx*2+1] = data >> 8; + csr = SROMSEL | SROMRD; EMIT; + csr = 0; EMIT; + } + tulip_srom_idle(sc); +} + +#define MII_EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); DELAY(1); } while (0) + +static void +tulip_mii_writebits(tulip_softc_t * const sc, unsigned data, unsigned bits) +{ + unsigned msb = 1 << (bits - 1); + unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK); + unsigned lastbit = (csr & MII_DOUT) ? msb : 0; + + TULIP_LOCK_ASSERT(sc); + csr |= MII_WR; MII_EMIT; /* clock low; assert write */ + + for (; bits > 0; bits--, data <<= 1) { + const unsigned thisbit = data & msb; + if (thisbit != lastbit) { + csr ^= MII_DOUT; MII_EMIT; /* clock low; invert data */ + } + csr ^= MII_CLKON; MII_EMIT; /* clock high; data valid */ + lastbit = thisbit; + csr ^= MII_CLKOFF; MII_EMIT; /* clock low; data not valid */ + } +} + +static void +tulip_mii_turnaround(tulip_softc_t * const sc, unsigned cmd) +{ + unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK); + + TULIP_LOCK_ASSERT(sc); + if (cmd == MII_WRCMD) { + csr |= MII_DOUT; MII_EMIT; /* clock low; change data */ + csr ^= MII_CLKON; MII_EMIT; /* clock high; data valid */ + csr ^= MII_CLKOFF; MII_EMIT; /* clock low; data not valid */ + csr ^= MII_DOUT; MII_EMIT; /* clock low; change data */ + } else { + csr |= MII_RD; MII_EMIT; /* clock low; switch to read */ + } + csr ^= MII_CLKON; MII_EMIT; /* clock high; data valid */ + csr ^= MII_CLKOFF; MII_EMIT; /* clock low; data not valid */ +} + +static unsigned +tulip_mii_readbits(tulip_softc_t * const sc) +{ + unsigned data; + unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK); + int idx; + + TULIP_LOCK_ASSERT(sc); + for (idx = 0, data = 0; idx < 16; idx++) { + data <<= 1; /* this is NOOP on the first pass through */ + csr ^= MII_CLKON; MII_EMIT; /* clock high; data valid */ + if (TULIP_CSR_READ(sc, csr_srom_mii) & MII_DIN) + data |= 1; + csr ^= MII_CLKOFF; MII_EMIT; /* clock low; data not valid */ + } + csr ^= MII_RD; MII_EMIT; /* clock low; turn off read */ + + return data; +} + +static unsigned +tulip_mii_readreg(tulip_softc_t * const sc, unsigned devaddr, unsigned regno) +{ + unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK); + unsigned data; + + TULIP_LOCK_ASSERT(sc); + csr &= ~(MII_RD|MII_CLK); MII_EMIT; + tulip_mii_writebits(sc, MII_PREAMBLE, 32); + tulip_mii_writebits(sc, MII_RDCMD, 8); + tulip_mii_writebits(sc, devaddr, 5); + tulip_mii_writebits(sc, regno, 5); + tulip_mii_turnaround(sc, MII_RDCMD); + + data = tulip_mii_readbits(sc); +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_phyregs[regno][0] = data; + sc->tulip_dbg.dbg_phyregs[regno][1]++; +#endif + return data; +} + +static void +tulip_mii_writereg(tulip_softc_t * const sc, unsigned devaddr, unsigned regno, + unsigned data) +{ + unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK); + + TULIP_LOCK_ASSERT(sc); + csr &= ~(MII_RD|MII_CLK); MII_EMIT; + tulip_mii_writebits(sc, MII_PREAMBLE, 32); + tulip_mii_writebits(sc, MII_WRCMD, 8); + tulip_mii_writebits(sc, devaddr, 5); + tulip_mii_writebits(sc, regno, 5); + tulip_mii_turnaround(sc, MII_WRCMD); + tulip_mii_writebits(sc, data, 16); +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_phyregs[regno][2] = data; + sc->tulip_dbg.dbg_phyregs[regno][3]++; +#endif +} + +#define tulip_mchash(mca) (ether_crc32_le(mca, 6) & 0x1FF) +#define tulip_srom_crcok(databuf) ( \ + ((ether_crc32_le(databuf, 126) & 0xFFFFU) ^ 0xFFFFU) == \ + ((databuf)[126] | ((databuf)[127] << 8))) + +static void +tulip_identify_dec_nic(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + strcpy(sc->tulip_boardid, "DEC "); +#define D0 4 + if (sc->tulip_chipid <= TULIP_21040) + return; + if (bcmp(sc->tulip_rombuf + 29, "DE500", 5) == 0 + || bcmp(sc->tulip_rombuf + 29, "DE450", 5) == 0) { + bcopy(sc->tulip_rombuf + 29, &sc->tulip_boardid[D0], 8); + sc->tulip_boardid[D0+8] = ' '; + } +#undef D0 +} + +static void +tulip_identify_znyx_nic(tulip_softc_t * const sc) +{ + unsigned id = 0; + + TULIP_LOCK_ASSERT(sc); + strcpy(sc->tulip_boardid, "ZNYX ZX3XX "); + if (sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A) { + unsigned znyx_ptr; + sc->tulip_boardid[8] = '4'; + znyx_ptr = sc->tulip_rombuf[124] + 256 * sc->tulip_rombuf[125]; + if (znyx_ptr < 26 || znyx_ptr > 116) { + sc->tulip_boardsw = &tulip_21140_znyx_zx34x_boardsw; + return; + } + /* ZX344 = 0010 .. 0013FF + */ + if (sc->tulip_rombuf[znyx_ptr] == 0x4A + && sc->tulip_rombuf[znyx_ptr + 1] == 0x52 + && sc->tulip_rombuf[znyx_ptr + 2] == 0x01) { + id = sc->tulip_rombuf[znyx_ptr + 5] + 256 * sc->tulip_rombuf[znyx_ptr + 4]; + if ((id >> 8) == (TULIP_ZNYX_ID_ZX342 >> 8)) { + sc->tulip_boardid[9] = '2'; + if (id == TULIP_ZNYX_ID_ZX342B) { + sc->tulip_boardid[10] = 'B'; + sc->tulip_boardid[11] = ' '; + } + sc->tulip_boardsw = &tulip_21140_znyx_zx34x_boardsw; + } else if (id == TULIP_ZNYX_ID_ZX344) { + sc->tulip_boardid[10] = '4'; + sc->tulip_boardsw = &tulip_21140_znyx_zx34x_boardsw; + } else if (id == TULIP_ZNYX_ID_ZX345) { + sc->tulip_boardid[9] = (sc->tulip_rombuf[19] > 1) ? '8' : '5'; + } else if (id == TULIP_ZNYX_ID_ZX346) { + sc->tulip_boardid[9] = '6'; + } else if (id == TULIP_ZNYX_ID_ZX351) { + sc->tulip_boardid[8] = '5'; + sc->tulip_boardid[9] = '1'; + } + } + if (id == 0) { + /* + * Assume it's a ZX342... + */ + sc->tulip_boardsw = &tulip_21140_znyx_zx34x_boardsw; + } + return; + } + sc->tulip_boardid[8] = '1'; + if (sc->tulip_chipid == TULIP_21041) { + sc->tulip_boardid[10] = '1'; + return; + } + if (sc->tulip_rombuf[32] == 0x4A && sc->tulip_rombuf[33] == 0x52) { + id = sc->tulip_rombuf[37] + 256 * sc->tulip_rombuf[36]; + if (id == TULIP_ZNYX_ID_ZX312T) { + sc->tulip_boardid[9] = '2'; + sc->tulip_boardid[10] = 'T'; + sc->tulip_boardid[11] = ' '; + sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw; + } else if (id == TULIP_ZNYX_ID_ZX314_INTA) { + sc->tulip_boardid[9] = '4'; + sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw; + sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM; + } else if (id == TULIP_ZNYX_ID_ZX314) { + sc->tulip_boardid[9] = '4'; + sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw; + sc->tulip_features |= TULIP_HAVE_BASEROM; + } else if (id == TULIP_ZNYX_ID_ZX315_INTA) { + sc->tulip_boardid[9] = '5'; + sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM; + } else if (id == TULIP_ZNYX_ID_ZX315) { + sc->tulip_boardid[9] = '5'; + sc->tulip_features |= TULIP_HAVE_BASEROM; + } else { + id = 0; + } + } + if (id == 0) { + if ((sc->tulip_enaddr[3] & ~3) == 0xF0 && (sc->tulip_enaddr[5] & 2) == 0) { + sc->tulip_boardid[9] = '4'; + sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw; + sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM; + } else if ((sc->tulip_enaddr[3] & ~3) == 0xF4 && (sc->tulip_enaddr[5] & 1) == 0) { + sc->tulip_boardid[9] = '5'; + sc->tulip_boardsw = &tulip_21040_boardsw; + sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM; + } else if ((sc->tulip_enaddr[3] & ~3) == 0xEC) { + sc->tulip_boardid[9] = '2'; + sc->tulip_boardsw = &tulip_21040_boardsw; + } + } +} + +static void +tulip_identify_smc_nic(tulip_softc_t * const sc) +{ + u_int32_t id1, id2, ei; + int auibnc = 0, utp = 0; + char *cp; + + TULIP_LOCK_ASSERT(sc); + strcpy(sc->tulip_boardid, "SMC "); + if (sc->tulip_chipid == TULIP_21041) + return; + if (sc->tulip_chipid != TULIP_21040) { + if (sc->tulip_boardsw != &tulip_2114x_isv_boardsw) { + strcpy(&sc->tulip_boardid[4], "9332DST "); + sc->tulip_boardsw = &tulip_21140_smc9332_boardsw; + } else if (sc->tulip_features & (TULIP_HAVE_BASEROM|TULIP_HAVE_SLAVEDROM)) { + strcpy(&sc->tulip_boardid[4], "9334BDT "); + } else { + strcpy(&sc->tulip_boardid[4], "9332BDT "); + } + return; + } + id1 = sc->tulip_rombuf[0x60] | (sc->tulip_rombuf[0x61] << 8); + id2 = sc->tulip_rombuf[0x62] | (sc->tulip_rombuf[0x63] << 8); + ei = sc->tulip_rombuf[0x66] | (sc->tulip_rombuf[0x67] << 8); + + strcpy(&sc->tulip_boardid[4], "8432"); + cp = &sc->tulip_boardid[8]; + if ((id1 & 1) == 0) + *cp++ = 'B', auibnc = 1; + if ((id1 & 0xFF) > 0x32) + *cp++ = 'T', utp = 1; + if ((id1 & 0x4000) == 0) + *cp++ = 'A', auibnc = 1; + if (id2 == 0x15) { + sc->tulip_boardid[7] = '4'; + *cp++ = '-'; + *cp++ = 'C'; + *cp++ = 'H'; + *cp++ = (ei ? '2' : '1'); + } + *cp++ = ' '; + *cp = '\0'; + if (utp && !auibnc) + sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw; + else if (!utp && auibnc) + sc->tulip_boardsw = &tulip_21040_auibnc_only_boardsw; +} + +static void +tulip_identify_cogent_nic(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + strcpy(sc->tulip_boardid, "Cogent "); + if (sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A) { + if (sc->tulip_rombuf[32] == TULIP_COGENT_EM100TX_ID) { + strcat(sc->tulip_boardid, "EM100TX "); + sc->tulip_boardsw = &tulip_21140_cogent_em100_boardsw; +#if defined(TULIP_COGENT_EM110TX_ID) + } else if (sc->tulip_rombuf[32] == TULIP_COGENT_EM110TX_ID) { + strcat(sc->tulip_boardid, "EM110TX "); + sc->tulip_boardsw = &tulip_21140_cogent_em100_boardsw; +#endif + } else if (sc->tulip_rombuf[32] == TULIP_COGENT_EM100FX_ID) { + strcat(sc->tulip_boardid, "EM100FX "); + sc->tulip_boardsw = &tulip_21140_cogent_em100_boardsw; + } + /* + * Magic number (0x24001109U) is the SubVendor (0x2400) and + * SubDevId (0x1109) for the ANA6944TX (EM440TX). + */ + if (*(u_int32_t *) sc->tulip_rombuf == 0x24001109U + && (sc->tulip_features & TULIP_HAVE_BASEROM)) { + /* + * Cogent (Adaptec) is still mapping all INTs to INTA of + * first 21140. Dumb! Dumb! + */ + strcat(sc->tulip_boardid, "EM440TX "); + sc->tulip_features |= TULIP_HAVE_SHAREDINTR; + } + } else if (sc->tulip_chipid == TULIP_21040) { + sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM; + } +} + +static void +tulip_identify_accton_nic(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + strcpy(sc->tulip_boardid, "ACCTON "); + switch (sc->tulip_chipid) { + case TULIP_21140A: + strcat(sc->tulip_boardid, "EN1207 "); + if (sc->tulip_boardsw != &tulip_2114x_isv_boardsw) + sc->tulip_boardsw = &tulip_21140_accton_boardsw; + break; + case TULIP_21140: + strcat(sc->tulip_boardid, "EN1207TX "); + if (sc->tulip_boardsw != &tulip_2114x_isv_boardsw) + sc->tulip_boardsw = &tulip_21140_eb_boardsw; + break; + case TULIP_21040: + strcat(sc->tulip_boardid, "EN1203 "); + sc->tulip_boardsw = &tulip_21040_boardsw; + break; + case TULIP_21041: + strcat(sc->tulip_boardid, "EN1203 "); + sc->tulip_boardsw = &tulip_21041_boardsw; + break; + default: + sc->tulip_boardsw = &tulip_2114x_isv_boardsw; + break; + } +} + +static void +tulip_identify_asante_nic(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + strcpy(sc->tulip_boardid, "Asante "); + if ((sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A) + && sc->tulip_boardsw != &tulip_2114x_isv_boardsw) { + tulip_media_info_t *mi = sc->tulip_mediainfo; + int idx; + /* + * The Asante Fast Ethernet doesn't always ship with a valid + * new format SROM. So if isn't in the new format, we cheat + * set it up as if we had. + */ + + sc->tulip_gpinit = TULIP_GP_ASANTE_PINS; + sc->tulip_gpdata = 0; + + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ASANTE_PINS|TULIP_GP_PINSET); + TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ASANTE_PHYRESET); + DELAY(100); + TULIP_CSR_WRITE(sc, csr_gp, 0); + + mi->mi_type = TULIP_MEDIAINFO_MII; + mi->mi_gpr_length = 0; + mi->mi_gpr_offset = 0; + mi->mi_reset_length = 0; + mi->mi_reset_offset = 0; + + mi->mi_phyaddr = TULIP_MII_NOPHY; + for (idx = 20; idx > 0 && mi->mi_phyaddr == TULIP_MII_NOPHY; idx--) { + DELAY(10000); + mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, 0); + } + if (mi->mi_phyaddr == TULIP_MII_NOPHY) { + device_printf(sc->tulip_dev, "can't find phy 0\n"); + return; + } + + sc->tulip_features |= TULIP_HAVE_MII; + mi->mi_capabilities = PHYSTS_10BASET|PHYSTS_10BASET_FD|PHYSTS_100BASETX|PHYSTS_100BASETX_FD; + mi->mi_advertisement = PHYSTS_10BASET|PHYSTS_10BASET_FD|PHYSTS_100BASETX|PHYSTS_100BASETX_FD; + mi->mi_full_duplex = PHYSTS_10BASET_FD|PHYSTS_100BASETX_FD; + mi->mi_tx_threshold = PHYSTS_10BASET|PHYSTS_10BASET_FD; + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX_FD); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASET4); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET_FD); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET); + mi->mi_phyid = (tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDLOW) << 16) | + tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDHIGH); + + sc->tulip_boardsw = &tulip_2114x_isv_boardsw; + } +} + +static void +tulip_identify_compex_nic(tulip_softc_t * const sc) +{ + TULIP_LOCK_ASSERT(sc); + strcpy(sc->tulip_boardid, "COMPEX "); + if (sc->tulip_chipid == TULIP_21140A) { + int root_unit; + tulip_softc_t *root_sc = NULL; + + strcat(sc->tulip_boardid, "400TX/PCI "); + /* + * All 4 chips on these boards share an interrupt. This code + * copied from tulip_read_macaddr. + */ + sc->tulip_features |= TULIP_HAVE_SHAREDINTR; + for (root_unit = sc->tulip_unit - 1; root_unit >= 0; root_unit--) { + root_sc = tulips[root_unit]; + if (root_sc == NULL + || !(root_sc->tulip_features & TULIP_HAVE_SLAVEDINTR)) + break; + root_sc = NULL; + } + if (root_sc != NULL + && root_sc->tulip_chipid == sc->tulip_chipid + && root_sc->tulip_pci_busno == sc->tulip_pci_busno) { + sc->tulip_features |= TULIP_HAVE_SLAVEDINTR; + sc->tulip_slaves = root_sc->tulip_slaves; + root_sc->tulip_slaves = sc; + } else if(sc->tulip_features & TULIP_HAVE_SLAVEDINTR) { + printf("\nCannot find master device for %s interrupts", + sc->tulip_ifp->if_xname); + } + } else { + strcat(sc->tulip_boardid, "unknown "); + } + /* sc->tulip_boardsw = &tulip_21140_eb_boardsw; */ + return; +} + +static int +tulip_srom_decode(tulip_softc_t * const sc) +{ + unsigned idx1, idx2, idx3; + + const tulip_srom_header_t *shp = (const tulip_srom_header_t *) &sc->tulip_rombuf[0]; + const tulip_srom_adapter_info_t *saip = (const tulip_srom_adapter_info_t *) (shp + 1); + tulip_srom_media_t srom_media; + tulip_media_info_t *mi = sc->tulip_mediainfo; + const u_int8_t *dp; + u_int32_t leaf_offset, blocks, data; + + TULIP_LOCK_ASSERT(sc); + for (idx1 = 0; idx1 < shp->sh_adapter_count; idx1++, saip++) { + if (shp->sh_adapter_count == 1) + break; + if (saip->sai_device == sc->tulip_pci_devno) + break; + } + /* + * Didn't find the right media block for this card. + */ + if (idx1 == shp->sh_adapter_count) + return 0; + + /* + * Save the hardware address. + */ + bcopy(shp->sh_ieee802_address, sc->tulip_enaddr, 6); + /* + * If this is a multiple port card, add the adapter index to the last + * byte of the hardware address. (if it isn't multiport, adding 0 + * won't hurt. + */ + sc->tulip_enaddr[5] += idx1; + + leaf_offset = saip->sai_leaf_offset_lowbyte + + saip->sai_leaf_offset_highbyte * 256; + dp = sc->tulip_rombuf + leaf_offset; + + sc->tulip_conntype = (tulip_srom_connection_t) (dp[0] + dp[1] * 256); dp += 2; + + for (idx2 = 0;; idx2++) { + if (tulip_srom_conninfo[idx2].sc_type == sc->tulip_conntype + || tulip_srom_conninfo[idx2].sc_type == TULIP_SROM_CONNTYPE_NOT_USED) + break; + } + sc->tulip_connidx = idx2; + + if (sc->tulip_chipid == TULIP_21041) { + blocks = *dp++; + for (idx2 = 0; idx2 < blocks; idx2++) { + tulip_media_t media; + data = *dp++; + srom_media = (tulip_srom_media_t) (data & 0x3F); + for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) { + if (tulip_srom_mediums[idx3].sm_srom_type == srom_media) + break; + } + media = tulip_srom_mediums[idx3].sm_type; + if (media != TULIP_MEDIA_UNKNOWN) { + if (data & TULIP_SROM_21041_EXTENDED) { + mi->mi_type = TULIP_MEDIAINFO_SIA; + sc->tulip_mediums[media] = mi; + mi->mi_sia_connectivity = dp[0] + dp[1] * 256; + mi->mi_sia_tx_rx = dp[2] + dp[3] * 256; + mi->mi_sia_general = dp[4] + dp[5] * 256; + mi++; + } else { + switch (media) { + case TULIP_MEDIA_BNC: { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, BNC); + mi++; + break; + } + case TULIP_MEDIA_AUI: { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, AUI); + mi++; + break; + } + case TULIP_MEDIA_10BASET: { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, 10BASET); + mi++; + break; + } + case TULIP_MEDIA_10BASET_FD: { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, 10BASET_FD); + mi++; + break; + } + default: { + break; + } + } + } + } + if (data & TULIP_SROM_21041_EXTENDED) + dp += 6; + } +#ifdef notdef + if (blocks == 0) { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, BNC); mi++; + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, AUI); mi++; + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, 10BASET); mi++; + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, 10BASET_FD); mi++; + } +#endif + } else { + unsigned length, type; + tulip_media_t gp_media = TULIP_MEDIA_UNKNOWN; + if (sc->tulip_features & TULIP_HAVE_GPR) + sc->tulip_gpinit = *dp++; + blocks = *dp++; + for (idx2 = 0; idx2 < blocks; idx2++) { + const u_int8_t *ep; + if ((*dp & 0x80) == 0) { + length = 4; + type = 0; + } else { + length = (*dp++ & 0x7f) - 1; + type = *dp++ & 0x3f; + } + ep = dp + length; + switch (type & 0x3f) { + case 0: { /* 21140[A] GPR block */ + tulip_media_t media; + srom_media = (tulip_srom_media_t)(dp[0] & 0x3f); + for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) { + if (tulip_srom_mediums[idx3].sm_srom_type == srom_media) + break; + } + media = tulip_srom_mediums[idx3].sm_type; + if (media == TULIP_MEDIA_UNKNOWN) + break; + mi->mi_type = TULIP_MEDIAINFO_GPR; + sc->tulip_mediums[media] = mi; + mi->mi_gpdata = dp[1]; + if (media > gp_media && !TULIP_IS_MEDIA_FD(media)) { + sc->tulip_gpdata = mi->mi_gpdata; + gp_media = media; + } + data = dp[2] + dp[3] * 256; + mi->mi_cmdmode = TULIP_SROM_2114X_CMDBITS(data); + if (data & TULIP_SROM_2114X_NOINDICATOR) { + mi->mi_actmask = 0; + } else { +#if 0 + mi->mi_default = (data & TULIP_SROM_2114X_DEFAULT) != 0; +#endif + mi->mi_actmask = TULIP_SROM_2114X_BITPOS(data); + mi->mi_actdata = (data & TULIP_SROM_2114X_POLARITY) ? 0 : mi->mi_actmask; + } + mi++; + break; + } + case 1: { /* 21140[A] MII block */ + const unsigned phyno = *dp++; + mi->mi_type = TULIP_MEDIAINFO_MII; + mi->mi_gpr_length = *dp++; + mi->mi_gpr_offset = dp - sc->tulip_rombuf; + dp += mi->mi_gpr_length; + mi->mi_reset_length = *dp++; + mi->mi_reset_offset = dp - sc->tulip_rombuf; + dp += mi->mi_reset_length; + + /* + * Before we probe for a PHY, use the GPR information + * to select it. If we don't, it may be inaccessible. + */ + TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_gpinit|TULIP_GP_PINSET); + for (idx3 = 0; idx3 < mi->mi_reset_length; idx3++) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_reset_offset + idx3]); + } + sc->tulip_phyaddr = mi->mi_phyaddr; + for (idx3 = 0; idx3 < mi->mi_gpr_length; idx3++) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_gpr_offset + idx3]); + } + + /* + * At least write something! + */ + if (mi->mi_reset_length == 0 && mi->mi_gpr_length == 0) + TULIP_CSR_WRITE(sc, csr_gp, 0); + + mi->mi_phyaddr = TULIP_MII_NOPHY; + for (idx3 = 20; idx3 > 0 && mi->mi_phyaddr == TULIP_MII_NOPHY; idx3--) { + DELAY(10000); + mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, phyno); + } + if (mi->mi_phyaddr == TULIP_MII_NOPHY) { +#if defined(TULIP_DEBUG) + device_printf(sc->tulip_dev, "can't find phy %d\n", + phyno); +#endif + break; + } + sc->tulip_features |= TULIP_HAVE_MII; + mi->mi_capabilities = dp[0] + dp[1] * 256; dp += 2; + mi->mi_advertisement = dp[0] + dp[1] * 256; dp += 2; + mi->mi_full_duplex = dp[0] + dp[1] * 256; dp += 2; + mi->mi_tx_threshold = dp[0] + dp[1] * 256; dp += 2; + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX_FD); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASET4); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET_FD); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET); + mi->mi_phyid = (tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDLOW) << 16) | + tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDHIGH); + mi++; + break; + } + case 2: { /* 2114[23] SIA block */ + tulip_media_t media; + srom_media = (tulip_srom_media_t)(dp[0] & 0x3f); + for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) { + if (tulip_srom_mediums[idx3].sm_srom_type == srom_media) + break; + } + media = tulip_srom_mediums[idx3].sm_type; + if (media == TULIP_MEDIA_UNKNOWN) + break; + mi->mi_type = TULIP_MEDIAINFO_SIA; + sc->tulip_mediums[media] = mi; + if (dp[0] & 0x40) { + mi->mi_sia_connectivity = dp[1] + dp[2] * 256; + mi->mi_sia_tx_rx = dp[3] + dp[4] * 256; + mi->mi_sia_general = dp[5] + dp[6] * 256; + dp += 6; + } else { + switch (media) { + case TULIP_MEDIA_BNC: { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21142, BNC); + break; + } + case TULIP_MEDIA_AUI: { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21142, AUI); + break; + } + case TULIP_MEDIA_10BASET: { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21142, 10BASET); + sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL; + break; + } + case TULIP_MEDIA_10BASET_FD: { + TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21142, 10BASET_FD); + sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL; + break; + } + default: { + goto bad_media; + } + } + } + mi->mi_sia_gp_control = (dp[1] + dp[2] * 256) << 16; + mi->mi_sia_gp_data = (dp[3] + dp[4] * 256) << 16; + mi++; + bad_media: + break; + } + case 3: { /* 2114[23] MII PHY block */ + const unsigned phyno = *dp++; + const u_int8_t *dp0; + mi->mi_type = TULIP_MEDIAINFO_MII; + mi->mi_gpr_length = *dp++; + mi->mi_gpr_offset = dp - sc->tulip_rombuf; + dp += 2 * mi->mi_gpr_length; + mi->mi_reset_length = *dp++; + mi->mi_reset_offset = dp - sc->tulip_rombuf; + dp += 2 * mi->mi_reset_length; + + dp0 = &sc->tulip_rombuf[mi->mi_reset_offset]; + for (idx3 = 0; idx3 < mi->mi_reset_length; idx3++, dp0 += 2) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_sia_general, (dp0[0] + 256 * dp0[1]) << 16); + } + sc->tulip_phyaddr = mi->mi_phyaddr; + dp0 = &sc->tulip_rombuf[mi->mi_gpr_offset]; + for (idx3 = 0; idx3 < mi->mi_gpr_length; idx3++, dp0 += 2) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_sia_general, (dp0[0] + 256 * dp0[1]) << 16); + } + + if (mi->mi_reset_length == 0 && mi->mi_gpr_length == 0) + TULIP_CSR_WRITE(sc, csr_sia_general, 0); + + mi->mi_phyaddr = TULIP_MII_NOPHY; + for (idx3 = 20; idx3 > 0 && mi->mi_phyaddr == TULIP_MII_NOPHY; idx3--) { + DELAY(10000); + mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, phyno); + } + if (mi->mi_phyaddr == TULIP_MII_NOPHY) { +#if defined(TULIP_DEBUG) + device_printf(sc->tulip_dev, "can't find phy %d\n", + phyno); +#endif + break; + } + sc->tulip_features |= TULIP_HAVE_MII; + mi->mi_capabilities = dp[0] + dp[1] * 256; dp += 2; + mi->mi_advertisement = dp[0] + dp[1] * 256; dp += 2; + mi->mi_full_duplex = dp[0] + dp[1] * 256; dp += 2; + mi->mi_tx_threshold = dp[0] + dp[1] * 256; dp += 2; + mi->mi_mii_interrupt = dp[0] + dp[1] * 256; dp += 2; + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX_FD); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASET4); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET_FD); + TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET); + mi->mi_phyid = (tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDLOW) << 16) | + tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDHIGH); + mi++; + break; + } + case 4: { /* 21143 SYM block */ + tulip_media_t media; + srom_media = (tulip_srom_media_t) dp[0]; + for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) { + if (tulip_srom_mediums[idx3].sm_srom_type == srom_media) + break; + } + media = tulip_srom_mediums[idx3].sm_type; + if (media == TULIP_MEDIA_UNKNOWN) + break; + mi->mi_type = TULIP_MEDIAINFO_SYM; + sc->tulip_mediums[media] = mi; + mi->mi_gpcontrol = (dp[1] + dp[2] * 256) << 16; + mi->mi_gpdata = (dp[3] + dp[4] * 256) << 16; + data = dp[5] + dp[6] * 256; + mi->mi_cmdmode = TULIP_SROM_2114X_CMDBITS(data); + if (data & TULIP_SROM_2114X_NOINDICATOR) { + mi->mi_actmask = 0; + } else { + mi->mi_default = (data & TULIP_SROM_2114X_DEFAULT) != 0; + mi->mi_actmask = TULIP_SROM_2114X_BITPOS(data); + mi->mi_actdata = (data & TULIP_SROM_2114X_POLARITY) ? 0 : mi->mi_actmask; + } + if (TULIP_IS_MEDIA_TP(media)) + sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL; + mi++; + break; + } +#if 0 + case 5: { /* 21143 Reset block */ + mi->mi_type = TULIP_MEDIAINFO_RESET; + mi->mi_reset_length = *dp++; + mi->mi_reset_offset = dp - sc->tulip_rombuf; + dp += 2 * mi->mi_reset_length; + mi++; + break; + } +#endif + default: { + } + } + dp = ep; + } + } + return mi - sc->tulip_mediainfo; +} + +static const struct { + void (*vendor_identify_nic)(tulip_softc_t * const sc); + unsigned char vendor_oui[3]; +} tulip_vendors[] = { + { tulip_identify_dec_nic, { 0x08, 0x00, 0x2B } }, + { tulip_identify_dec_nic, { 0x00, 0x00, 0xF8 } }, + { tulip_identify_smc_nic, { 0x00, 0x00, 0xC0 } }, + { tulip_identify_smc_nic, { 0x00, 0xE0, 0x29 } }, + { tulip_identify_znyx_nic, { 0x00, 0xC0, 0x95 } }, + { tulip_identify_cogent_nic, { 0x00, 0x00, 0x92 } }, + { tulip_identify_asante_nic, { 0x00, 0x00, 0x94 } }, + { tulip_identify_cogent_nic, { 0x00, 0x00, 0xD1 } }, + { tulip_identify_accton_nic, { 0x00, 0x00, 0xE8 } }, + { tulip_identify_compex_nic, { 0x00, 0x80, 0x48 } }, + { NULL } +}; + +/* + * This deals with the vagaries of the address roms and the + * brain-deadness that various vendors commit in using them. + */ +static int +tulip_read_macaddr(tulip_softc_t * const sc) +{ + unsigned cksum, rom_cksum, idx; + u_int32_t csr; + unsigned char tmpbuf[8]; + static const u_char testpat[] = { 0xFF, 0, 0x55, 0xAA, 0xFF, 0, 0x55, 0xAA }; + + sc->tulip_connidx = TULIP_SROM_LASTCONNIDX; + + if (sc->tulip_chipid == TULIP_21040) { + TULIP_CSR_WRITE(sc, csr_enetrom, 1); + for (idx = 0; idx < sizeof(sc->tulip_rombuf); idx++) { + int cnt = 0; + while (((csr = TULIP_CSR_READ(sc, csr_enetrom)) & 0x80000000L) && cnt < 10000) + cnt++; + sc->tulip_rombuf[idx] = csr & 0xFF; + } + sc->tulip_boardsw = &tulip_21040_boardsw; + } else { + if (sc->tulip_chipid == TULIP_21041) { + /* + * Thankfully all 21041's act the same. + */ + sc->tulip_boardsw = &tulip_21041_boardsw; + } else { + /* + * Assume all 21140 board are compatible with the + * DEC 10/100 evaluation board. Not really valid but + * it's the best we can do until every one switches to + * the new SROM format. + */ + + sc->tulip_boardsw = &tulip_21140_eb_boardsw; + } + tulip_srom_read(sc); + if (tulip_srom_crcok(sc->tulip_rombuf)) { + /* + * SROM CRC is valid therefore it must be in the + * new format. + */ + sc->tulip_features |= TULIP_HAVE_ISVSROM|TULIP_HAVE_OKSROM; + } else if (sc->tulip_rombuf[126] == 0xff && sc->tulip_rombuf[127] == 0xFF) { + /* + * No checksum is present. See if the SROM id checks out; + * the first 18 bytes should be 0 followed by a 1 followed + * by the number of adapters (which we don't deal with yet). + */ + for (idx = 0; idx < 18; idx++) { + if (sc->tulip_rombuf[idx] != 0) + break; + } + if (idx == 18 && sc->tulip_rombuf[18] == 1 && sc->tulip_rombuf[19] != 0) + sc->tulip_features |= TULIP_HAVE_ISVSROM; + } else if (sc->tulip_chipid >= TULIP_21142) { + sc->tulip_features |= TULIP_HAVE_ISVSROM; + sc->tulip_boardsw = &tulip_2114x_isv_boardsw; + } + if ((sc->tulip_features & TULIP_HAVE_ISVSROM) && tulip_srom_decode(sc)) { + if (sc->tulip_chipid != TULIP_21041) + sc->tulip_boardsw = &tulip_2114x_isv_boardsw; + + /* + * If the SROM specifies more than one adapter, tag this as a + * BASE rom. + */ + if (sc->tulip_rombuf[19] > 1) + sc->tulip_features |= TULIP_HAVE_BASEROM; + if (sc->tulip_boardsw == NULL) + return -6; + goto check_oui; + } + } + + + if (bcmp(&sc->tulip_rombuf[0], &sc->tulip_rombuf[16], 8) != 0) { + /* + * Some folks don't use the standard ethernet rom format + * but instead just put the address in the first 6 bytes + * of the rom and let the rest be all 0xffs. (Can we say + * ZNYX?) (well sometimes they put in a checksum so we'll + * start at 8). + */ + for (idx = 8; idx < 32; idx++) { + if (sc->tulip_rombuf[idx] != 0xFF) + return -4; + } + /* + * Make sure the address is not multicast or locally assigned + * that the OUI is not 00-00-00. + */ + if ((sc->tulip_rombuf[0] & 3) != 0) + return -4; + if (sc->tulip_rombuf[0] == 0 && sc->tulip_rombuf[1] == 0 + && sc->tulip_rombuf[2] == 0) + return -4; + bcopy(sc->tulip_rombuf, sc->tulip_enaddr, 6); + sc->tulip_features |= TULIP_HAVE_OKROM; + goto check_oui; + } else { + /* + * A number of makers of multiport boards (ZNYX and Cogent) + * only put on one address ROM on their 21040 boards. So + * if the ROM is all zeros (or all 0xFFs), look at the + * previous configured boards (as long as they are on the same + * PCI bus and the bus number is non-zero) until we find the + * master board with address ROM. We then use its address ROM + * as the base for this board. (we add our relative board + * to the last byte of its address). + */ + for (idx = 0; idx < sizeof(sc->tulip_rombuf); idx++) { + if (sc->tulip_rombuf[idx] != 0 && sc->tulip_rombuf[idx] != 0xFF) + break; + } + if (idx == sizeof(sc->tulip_rombuf)) { + int root_unit; + tulip_softc_t *root_sc = NULL; + for (root_unit = sc->tulip_unit - 1; root_unit >= 0; root_unit--) { + root_sc = tulips[root_unit]; + if (root_sc == NULL || (root_sc->tulip_features & (TULIP_HAVE_OKROM|TULIP_HAVE_SLAVEDROM)) == TULIP_HAVE_OKROM) + break; + root_sc = NULL; + } + if (root_sc != NULL && (root_sc->tulip_features & TULIP_HAVE_BASEROM) + && root_sc->tulip_chipid == sc->tulip_chipid + && root_sc->tulip_pci_busno == sc->tulip_pci_busno) { + sc->tulip_features |= TULIP_HAVE_SLAVEDROM; + sc->tulip_boardsw = root_sc->tulip_boardsw; + strcpy(sc->tulip_boardid, root_sc->tulip_boardid); + if (sc->tulip_boardsw->bd_type == TULIP_21140_ISV) { + bcopy(root_sc->tulip_rombuf, sc->tulip_rombuf, + sizeof(sc->tulip_rombuf)); + if (!tulip_srom_decode(sc)) + return -5; + } else { + bcopy(root_sc->tulip_enaddr, sc->tulip_enaddr, 6); + sc->tulip_enaddr[5] += sc->tulip_unit - root_sc->tulip_unit; + } + /* + * Now for a truly disgusting kludge: all 4 21040s on + * the ZX314 share the same INTA line so the mapping + * setup by the BIOS on the PCI bridge is worthless. + * Rather than reprogramming the value in the config + * register, we will handle this internally. + */ + if (root_sc->tulip_features & TULIP_HAVE_SHAREDINTR) { + sc->tulip_slaves = root_sc->tulip_slaves; + root_sc->tulip_slaves = sc; + sc->tulip_features |= TULIP_HAVE_SLAVEDINTR; + } + return 0; + } + } + } + + /* + * This is the standard DEC address ROM test. + */ + + if (bcmp(&sc->tulip_rombuf[24], testpat, 8) != 0) + return -3; + + tmpbuf[0] = sc->tulip_rombuf[15]; tmpbuf[1] = sc->tulip_rombuf[14]; + tmpbuf[2] = sc->tulip_rombuf[13]; tmpbuf[3] = sc->tulip_rombuf[12]; + tmpbuf[4] = sc->tulip_rombuf[11]; tmpbuf[5] = sc->tulip_rombuf[10]; + tmpbuf[6] = sc->tulip_rombuf[9]; tmpbuf[7] = sc->tulip_rombuf[8]; + if (bcmp(&sc->tulip_rombuf[0], tmpbuf, 8) != 0) + return -2; + + bcopy(sc->tulip_rombuf, sc->tulip_enaddr, 6); + + cksum = *(u_int16_t *) &sc->tulip_enaddr[0]; + cksum *= 2; + if (cksum > 65535) cksum -= 65535; + cksum += *(u_int16_t *) &sc->tulip_enaddr[2]; + if (cksum > 65535) cksum -= 65535; + cksum *= 2; + if (cksum > 65535) cksum -= 65535; + cksum += *(u_int16_t *) &sc->tulip_enaddr[4]; + if (cksum >= 65535) cksum -= 65535; + + rom_cksum = *(u_int16_t *) &sc->tulip_rombuf[6]; + + if (cksum != rom_cksum) + return -1; + + check_oui: + /* + * Check for various boards based on OUI. Did I say braindead? + */ + for (idx = 0; tulip_vendors[idx].vendor_identify_nic != NULL; idx++) { + if (bcmp(sc->tulip_enaddr, tulip_vendors[idx].vendor_oui, 3) == 0) { + (*tulip_vendors[idx].vendor_identify_nic)(sc); + break; + } + } + + sc->tulip_features |= TULIP_HAVE_OKROM; + return 0; +} + +static void +tulip_ifmedia_add(tulip_softc_t * const sc) +{ + tulip_media_t media; + int medias = 0; + + TULIP_LOCK_ASSERT(sc); + for (media = TULIP_MEDIA_UNKNOWN; media < TULIP_MEDIA_MAX; media++) { + if (sc->tulip_mediums[media] != NULL) { + ifmedia_add(&sc->tulip_ifmedia, tulip_media_to_ifmedia[media], + 0, 0); + medias++; + } + } + if (medias == 0) { + sc->tulip_features |= TULIP_HAVE_NOMEDIA; + ifmedia_add(&sc->tulip_ifmedia, IFM_ETHER | IFM_NONE, 0, 0); + ifmedia_set(&sc->tulip_ifmedia, IFM_ETHER | IFM_NONE); + } else if (sc->tulip_media == TULIP_MEDIA_UNKNOWN) { + ifmedia_add(&sc->tulip_ifmedia, IFM_ETHER | IFM_AUTO, 0, 0); + ifmedia_set(&sc->tulip_ifmedia, IFM_ETHER | IFM_AUTO); + } else { + ifmedia_set(&sc->tulip_ifmedia, tulip_media_to_ifmedia[sc->tulip_media]); + sc->tulip_flags |= TULIP_PRINTMEDIA; + tulip_linkup(sc, sc->tulip_media); + } +} + +static int +tulip_ifmedia_change(struct ifnet * const ifp) +{ + tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc; + + TULIP_LOCK(sc); + sc->tulip_flags |= TULIP_NEEDRESET; + sc->tulip_probe_state = TULIP_PROBE_INACTIVE; + sc->tulip_media = TULIP_MEDIA_UNKNOWN; + if (IFM_SUBTYPE(sc->tulip_ifmedia.ifm_media) != IFM_AUTO) { + tulip_media_t media; + for (media = TULIP_MEDIA_UNKNOWN; media < TULIP_MEDIA_MAX; media++) { + if (sc->tulip_mediums[media] != NULL + && sc->tulip_ifmedia.ifm_media == tulip_media_to_ifmedia[media]) { + sc->tulip_flags |= TULIP_PRINTMEDIA; + sc->tulip_flags &= ~TULIP_DIDNWAY; + tulip_linkup(sc, media); + TULIP_UNLOCK(sc); + return 0; + } + } + } + sc->tulip_flags &= ~(TULIP_TXPROBE_ACTIVE|TULIP_WANTRXACT); + tulip_reset(sc); + tulip_init_locked(sc); + TULIP_UNLOCK(sc); + return 0; +} + +/* + * Media status callback + */ +static void +tulip_ifmedia_status(struct ifnet * const ifp, struct ifmediareq *req) +{ + tulip_softc_t *sc = (tulip_softc_t *)ifp->if_softc; + + TULIP_LOCK(sc); + if (sc->tulip_media == TULIP_MEDIA_UNKNOWN) { + TULIP_UNLOCK(sc); + return; + } + + req->ifm_status = IFM_AVALID; + if (sc->tulip_flags & TULIP_LINKUP) + req->ifm_status |= IFM_ACTIVE; + + req->ifm_active = tulip_media_to_ifmedia[sc->tulip_media]; + TULIP_UNLOCK(sc); +} + +static void +tulip_addr_filter(tulip_softc_t * const sc) +{ + struct ifmultiaddr *ifma; + struct ifnet *ifp; + u_char *addrp; + u_int16_t eaddr[ETHER_ADDR_LEN/2]; + int multicnt; + + TULIP_LOCK_ASSERT(sc); + sc->tulip_flags &= ~(TULIP_WANTHASHPERFECT|TULIP_WANTHASHONLY|TULIP_ALLMULTI); + sc->tulip_flags |= TULIP_WANTSETUP|TULIP_WANTTXSTART; + sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN; + sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; +#if defined(IFF_ALLMULTI) + if (sc->tulip_ifp->if_flags & IFF_ALLMULTI) + sc->tulip_flags |= TULIP_ALLMULTI ; +#endif + + multicnt = 0; + ifp = sc->tulip_ifp; + if_maddr_rlock(ifp); + + /* Copy MAC address on stack to align. */ + if (ifp->if_input != NULL) + bcopy(IF_LLADDR(ifp), eaddr, ETHER_ADDR_LEN); + else + bcopy(sc->tulip_enaddr, eaddr, ETHER_ADDR_LEN); + + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + + if (ifma->ifma_addr->sa_family == AF_LINK) + multicnt++; + } + + if (multicnt > 14) { + u_int32_t *sp = sc->tulip_setupdata; + unsigned hash; + /* + * Some early passes of the 21140 have broken implementations of + * hash-perfect mode. When we get too many multicasts for perfect + * filtering with these chips, we need to switch into hash-only + * mode (this is better than all-multicast on network with lots + * of multicast traffic). + */ + if (sc->tulip_features & TULIP_HAVE_BROKEN_HASH) + sc->tulip_flags |= TULIP_WANTHASHONLY; + else + sc->tulip_flags |= TULIP_WANTHASHPERFECT; + /* + * If we have more than 14 multicasts, we have + * go into hash perfect mode (512 bit multicast + * hash and one perfect hardware). + */ + bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata)); + + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + + hash = tulip_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); + sp[hash >> 4] |= htole32(1 << (hash & 0xF)); + } + /* + * No reason to use a hash if we are going to be + * receiving every multicast. + */ + if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) { + hash = tulip_mchash(ifp->if_broadcastaddr); + sp[hash >> 4] |= htole32(1 << (hash & 0xF)); + if (sc->tulip_flags & TULIP_WANTHASHONLY) { + hash = tulip_mchash((caddr_t)eaddr); + sp[hash >> 4] |= htole32(1 << (hash & 0xF)); + } else { + sp[39] = TULIP_SP_MAC(eaddr[0]); + sp[40] = TULIP_SP_MAC(eaddr[1]); + sp[41] = TULIP_SP_MAC(eaddr[2]); + } + } + } + if ((sc->tulip_flags & (TULIP_WANTHASHPERFECT|TULIP_WANTHASHONLY)) == 0) { + u_int32_t *sp = sc->tulip_setupdata; + int idx = 0; + if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) { + /* + * Else can get perfect filtering for 16 addresses. + */ + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + addrp = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + *sp++ = TULIP_SP_MAC(((u_int16_t *)addrp)[0]); + *sp++ = TULIP_SP_MAC(((u_int16_t *)addrp)[1]); + *sp++ = TULIP_SP_MAC(((u_int16_t *)addrp)[2]); + idx++; + } + /* + * Add the broadcast address. + */ + idx++; + *sp++ = TULIP_SP_MAC(0xFFFF); + *sp++ = TULIP_SP_MAC(0xFFFF); + *sp++ = TULIP_SP_MAC(0xFFFF); + } + /* + * Pad the rest with our hardware address + */ + for (; idx < 16; idx++) { + *sp++ = TULIP_SP_MAC(eaddr[0]); + *sp++ = TULIP_SP_MAC(eaddr[1]); + *sp++ = TULIP_SP_MAC(eaddr[2]); + } + } + if_maddr_runlock(ifp); +} + +static void +tulip_reset(tulip_softc_t * const sc) +{ + tulip_ringinfo_t *ri; + tulip_descinfo_t *di; + struct mbuf *m; + u_int32_t inreset = (sc->tulip_flags & TULIP_INRESET); + + TULIP_LOCK_ASSERT(sc); + + CTR1(KTR_TULIP, "tulip_reset: inreset %d", inreset); + + /* + * Brilliant. Simply brilliant. When switching modes/speeds + * on a 2114*, you need to set the appriopriate MII/PCS/SCL/PS + * bits in CSR6 and then do a software reset to get the 21140 + * to properly reset its internal pathways to the right places. + * Grrrr. + */ + if ((sc->tulip_flags & TULIP_DEVICEPROBE) == 0 + && sc->tulip_boardsw->bd_media_preset != NULL) + (*sc->tulip_boardsw->bd_media_preset)(sc); + + TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET); + DELAY(10); /* Wait 10 microseconds (actually 50 PCI cycles but at + 33MHz that comes to two microseconds but wait a + bit longer anyways) */ + + if (!inreset) { + sc->tulip_flags |= TULIP_INRESET; + sc->tulip_flags &= ~(TULIP_NEEDRESET|TULIP_RXBUFSLOW); + sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + } + + TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr & 0xffffffff); + TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr & 0xffffffff); + TULIP_CSR_WRITE(sc, csr_busmode, + (1 << (3 /*pci_max_burst_len*/ + 8)) + |TULIP_BUSMODE_CACHE_ALIGN8 + |TULIP_BUSMODE_READMULTIPLE + |(BYTE_ORDER != LITTLE_ENDIAN ? + TULIP_BUSMODE_DESC_BIGENDIAN : 0)); + + sc->tulip_txtimer = 0; + /* + * Free all the mbufs that were on the transmit ring. + */ + CTR0(KTR_TULIP, "tulip_reset: drain transmit ring"); + ri = &sc->tulip_txinfo; + for (di = ri->ri_first; di < ri->ri_last; di++) { + m = tulip_dequeue_mbuf(ri, di, SYNC_NONE); + if (m != NULL) + m_freem(m); + di->di_desc->d_status = 0; + } + + ri->ri_nextin = ri->ri_nextout = ri->ri_first; + ri->ri_free = ri->ri_max; + TULIP_TXDESC_PRESYNC(ri); + + /* + * We need to collect all the mbufs that were on the + * receive ring before we reinit it either to put + * them back on or to know if we have to allocate + * more. + */ + CTR0(KTR_TULIP, "tulip_reset: drain receive ring"); + ri = &sc->tulip_rxinfo; + ri->ri_nextin = ri->ri_nextout = ri->ri_first; + ri->ri_free = ri->ri_max; + for (di = ri->ri_first; di < ri->ri_last; di++) { + di->di_desc->d_status = 0; + di->di_desc->d_length1 = 0; di->di_desc->d_addr1 = 0; + di->di_desc->d_length2 = 0; di->di_desc->d_addr2 = 0; + } + TULIP_RXDESC_PRESYNC(ri); + for (di = ri->ri_first; di < ri->ri_last; di++) { + m = tulip_dequeue_mbuf(ri, di, SYNC_NONE); + if (m != NULL) + m_freem(m); + } + + /* + * If tulip_reset is being called recursively, exit quickly knowing + * that when the outer tulip_reset returns all the right stuff will + * have happened. + */ + if (inreset) + return; + + sc->tulip_intrmask |= TULIP_STS_NORMALINTR|TULIP_STS_RXINTR|TULIP_STS_TXINTR + |TULIP_STS_ABNRMLINTR|TULIP_STS_SYSERROR|TULIP_STS_TXSTOPPED + |TULIP_STS_TXUNDERFLOW|TULIP_STS_TXBABBLE + |TULIP_STS_RXSTOPPED; + + if ((sc->tulip_flags & TULIP_DEVICEPROBE) == 0) + (*sc->tulip_boardsw->bd_media_select)(sc); +#if defined(TULIP_DEBUG) + if ((sc->tulip_flags & TULIP_NEEDRESET) == TULIP_NEEDRESET) + device_printf(sc->tulip_dev, + "tulip_reset: additional reset needed?!?\n"); +#endif + if (bootverbose) + tulip_media_print(sc); + if (sc->tulip_features & TULIP_HAVE_DUALSENSE) + TULIP_CSR_WRITE(sc, csr_sia_status, TULIP_CSR_READ(sc, csr_sia_status)); + + sc->tulip_flags &= ~(TULIP_DOINGSETUP|TULIP_WANTSETUP|TULIP_INRESET + |TULIP_RXACT); +} + + +static void +tulip_init(void *arg) +{ + tulip_softc_t *sc = (tulip_softc_t *)arg; + + TULIP_LOCK(sc); + tulip_init_locked(sc); + TULIP_UNLOCK(sc); +} + +static void +tulip_init_locked(tulip_softc_t * const sc) +{ + CTR0(KTR_TULIP, "tulip_init_locked"); + if (sc->tulip_ifp->if_flags & IFF_UP) { + if ((sc->tulip_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + /* initialize the media */ + CTR0(KTR_TULIP, "tulip_init_locked: up but not running, reset chip"); + tulip_reset(sc); + } + tulip_addr_filter(sc); + sc->tulip_ifp->if_drv_flags |= IFF_DRV_RUNNING; + if (sc->tulip_ifp->if_flags & IFF_PROMISC) { + sc->tulip_flags |= TULIP_PROMISC; + sc->tulip_cmdmode |= TULIP_CMD_PROMISCUOUS; + sc->tulip_intrmask |= TULIP_STS_TXINTR; + } else { + sc->tulip_flags &= ~TULIP_PROMISC; + sc->tulip_cmdmode &= ~TULIP_CMD_PROMISCUOUS; + if (sc->tulip_flags & TULIP_ALLMULTI) { + sc->tulip_cmdmode |= TULIP_CMD_ALLMULTI; + } else { + sc->tulip_cmdmode &= ~TULIP_CMD_ALLMULTI; + } + } + sc->tulip_cmdmode |= TULIP_CMD_TXRUN; + if ((sc->tulip_flags & (TULIP_TXPROBE_ACTIVE|TULIP_WANTSETUP)) == 0) { + tulip_rx_intr(sc); + sc->tulip_cmdmode |= TULIP_CMD_RXRUN; + sc->tulip_intrmask |= TULIP_STS_RXSTOPPED; + } else { + sc->tulip_ifp->if_drv_flags |= IFF_DRV_OACTIVE; + sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN; + sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; + } + CTR2(KTR_TULIP, "tulip_init_locked: intr mask %08x cmdmode %08x", + sc->tulip_intrmask, sc->tulip_cmdmode); + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); + CTR1(KTR_TULIP, "tulip_init_locked: status %08x\n", + TULIP_CSR_READ(sc, csr_status)); + if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP) + tulip_txput_setup(sc); + } else { + CTR0(KTR_TULIP, "tulip_init_locked: not up, reset chip"); + sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + tulip_reset(sc); + tulip_addr_filter(sc); + } +} + +#define DESC_STATUS(di) (((volatile tulip_desc_t *)((di)->di_desc))->d_status) +#define DESC_FLAG(di) ((di)->di_desc->d_flag) + +static void +tulip_rx_intr(tulip_softc_t * const sc) +{ + TULIP_PERFSTART(rxintr) + tulip_ringinfo_t * const ri = &sc->tulip_rxinfo; + struct ifnet * const ifp = sc->tulip_ifp; + int fillok = 1; +#if defined(TULIP_DEBUG) + int cnt = 0; +#endif + + TULIP_LOCK_ASSERT(sc); + CTR0(KTR_TULIP, "tulip_rx_intr: start"); + for (;;) { + TULIP_PERFSTART(rxget) + tulip_descinfo_t *eop = ri->ri_nextin, *dip; + int total_len = 0, last_offset = 0; + struct mbuf *ms = NULL, *me = NULL; + int accept = 0; + int error; + + if (fillok && (ri->ri_max - ri->ri_free) < TULIP_RXQ_TARGET) + goto queue_mbuf; + +#if defined(TULIP_DEBUG) + if (cnt == ri->ri_max) + break; +#endif + /* + * If the TULIP has no descriptors, there can't be any receive + * descriptors to process. + */ + if (eop == ri->ri_nextout) + break; + + /* + * 90% of the packets will fit in one descriptor. So we optimize + * for that case. + */ + TULIP_RXDESC_POSTSYNC(ri); + if ((DESC_STATUS(eop) & (TULIP_DSTS_OWNER|TULIP_DSTS_RxFIRSTDESC|TULIP_DSTS_RxLASTDESC)) == (TULIP_DSTS_RxFIRSTDESC|TULIP_DSTS_RxLASTDESC)) { + ms = tulip_dequeue_mbuf(ri, eop, SYNC_RX); + CTR2(KTR_TULIP, + "tulip_rx_intr: single packet mbuf %p from descriptor %td", ms, + eop - ri->ri_first); + me = ms; + ri->ri_free++; + } else { + /* + * If still owned by the TULIP, don't touch it. + */ + if (DESC_STATUS(eop) & TULIP_DSTS_OWNER) + break; + + /* + * It is possible (though improbable unless MCLBYTES < 1518) for + * a received packet to cross more than one receive descriptor. + * We first loop through the descriptor ring making sure we have + * received a complete packet. If not, we bail until the next + * interrupt. + */ + dip = eop; + while ((DESC_STATUS(eop) & TULIP_DSTS_RxLASTDESC) == 0) { + if (++eop == ri->ri_last) + eop = ri->ri_first; + TULIP_RXDESC_POSTSYNC(ri); + if (eop == ri->ri_nextout || DESC_STATUS(eop) & TULIP_DSTS_OWNER) { +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_rxintrs++; + sc->tulip_dbg.dbg_rxpktsperintr[cnt]++; +#endif + TULIP_PERFEND(rxget); + TULIP_PERFEND(rxintr); + return; + } + total_len++; + } + + /* + * Dequeue the first buffer for the start of the packet. Hopefully + * this will be the only one we need to dequeue. However, if the + * packet consumed multiple descriptors, then we need to dequeue + * those buffers and chain to the starting mbuf. All buffers but + * the last buffer have the same length so we can set that now. + * (we add to last_offset instead of multiplying since we normally + * won't go into the loop and thereby saving ourselves from + * doing a multiplication by 0 in the normal case). + */ + ms = tulip_dequeue_mbuf(ri, dip, SYNC_RX); + CTR2(KTR_TULIP, + "tulip_rx_intr: start packet mbuf %p from descriptor %td", ms, + dip - ri->ri_first); + ri->ri_free++; + for (me = ms; total_len > 0; total_len--) { + me->m_len = TULIP_RX_BUFLEN; + last_offset += TULIP_RX_BUFLEN; + if (++dip == ri->ri_last) + dip = ri->ri_first; + me->m_next = tulip_dequeue_mbuf(ri, dip, SYNC_RX); + ri->ri_free++; + me = me->m_next; + CTR2(KTR_TULIP, + "tulip_rx_intr: cont packet mbuf %p from descriptor %td", + me, dip - ri->ri_first); + } + KASSERT(dip == eop, ("mismatched descinfo structs")); + } + + /* + * Now get the size of received packet (minus the CRC). + */ + total_len = ((DESC_STATUS(eop) >> 16) & 0x7FFF) - ETHER_CRC_LEN; + if ((sc->tulip_flags & TULIP_RXIGNORE) == 0 + && ((DESC_STATUS(eop) & TULIP_DSTS_ERRSUM) == 0)) { + me->m_len = total_len - last_offset; + sc->tulip_flags |= TULIP_RXACT; + accept = 1; + CTR1(KTR_TULIP, "tulip_rx_intr: good packet; length %d", + total_len); + } else { + CTR1(KTR_TULIP, "tulip_rx_intr: bad packet; status %08x", + DESC_STATUS(eop)); + ifp->if_ierrors++; + if (DESC_STATUS(eop) & (TULIP_DSTS_RxBADLENGTH|TULIP_DSTS_RxOVERFLOW|TULIP_DSTS_RxWATCHDOG)) { + sc->tulip_dot3stats.dot3StatsInternalMacReceiveErrors++; + } else { +#if defined(TULIP_VERBOSE) + const char *error = NULL; +#endif + if (DESC_STATUS(eop) & TULIP_DSTS_RxTOOLONG) { + sc->tulip_dot3stats.dot3StatsFrameTooLongs++; +#if defined(TULIP_VERBOSE) + error = "frame too long"; +#endif + } + if (DESC_STATUS(eop) & TULIP_DSTS_RxBADCRC) { + if (DESC_STATUS(eop) & TULIP_DSTS_RxDRBBLBIT) { + sc->tulip_dot3stats.dot3StatsAlignmentErrors++; +#if defined(TULIP_VERBOSE) + error = "alignment error"; +#endif + } else { + sc->tulip_dot3stats.dot3StatsFCSErrors++; +#if defined(TULIP_VERBOSE) + error = "bad crc"; +#endif + } + } +#if defined(TULIP_VERBOSE) + if (error != NULL && (sc->tulip_flags & TULIP_NOMESSAGES) == 0) { + device_printf(sc->tulip_dev, "receive: %6D: %s\n", + mtod(ms, u_char *) + 6, ":", + error); + sc->tulip_flags |= TULIP_NOMESSAGES; + } +#endif + } + + } +#if defined(TULIP_DEBUG) + cnt++; +#endif + ifp->if_ipackets++; + if (++eop == ri->ri_last) + eop = ri->ri_first; + ri->ri_nextin = eop; + queue_mbuf: + /* + * We have received a good packet that needs to be passed up the + * stack. + */ + if (accept) { + struct mbuf *m0; + + KASSERT(ms != NULL, ("no packet to accept")); +#ifndef __NO_STRICT_ALIGNMENT + /* + * Copy the data into a new mbuf that is properly aligned. If + * we fail to allocate a new mbuf, then drop the packet. We will + * reuse the same rx buffer ('ms') below for another packet + * regardless. + */ + m0 = m_devget(mtod(ms, caddr_t), total_len, ETHER_ALIGN, ifp, NULL); + if (m0 == NULL) { + ifp->if_ierrors++; + goto skip_input; + } +#else + /* + * Update the header for the mbuf referencing this receive + * buffer and pass it up the stack. Allocate a new mbuf cluster + * to replace the one we just passed up the stack. + * + * Note that if this packet crossed multiple descriptors + * we don't even try to reallocate all the mbufs here. + * Instead we rely on the test at the beginning of + * the loop to refill for the extra consumed mbufs. + */ + ms->m_pkthdr.len = total_len; + ms->m_pkthdr.rcvif = ifp; + m0 = ms; + ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); +#endif + TULIP_UNLOCK(sc); + CTR1(KTR_TULIP, "tulip_rx_intr: passing %p to upper layer", m0); + (*ifp->if_input)(ifp, m0); + TULIP_LOCK(sc); + } else if (ms == NULL) + /* + * If we are priming the TULIP with mbufs, then allocate + * a new cluster for the next descriptor. + */ + ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + +#ifndef __NO_STRICT_ALIGNMENT + skip_input: +#endif + if (ms == NULL) { + /* + * Couldn't allocate a new buffer. Don't bother + * trying to replenish the receive queue. + */ + fillok = 0; + sc->tulip_flags |= TULIP_RXBUFSLOW; +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_rxlowbufs++; +#endif + TULIP_PERFEND(rxget); + continue; + } + /* + * Now give the buffer(s) to the TULIP and save in our + * receive queue. + */ + do { + tulip_descinfo_t * const nextout = ri->ri_nextout; + + M_ASSERTPKTHDR(ms); + KASSERT(ms->m_data == ms->m_ext.ext_buf, + ("rx mbuf data doesn't point to cluster")); + ms->m_len = ms->m_pkthdr.len = TULIP_RX_BUFLEN; + error = bus_dmamap_load_mbuf(ri->ri_data_tag, *nextout->di_map, ms, + tulip_dma_map_rxbuf, nextout->di_desc, BUS_DMA_NOWAIT); + if (error) { + device_printf(sc->tulip_dev, + "unable to load rx map, error = %d\n", error); + panic("tulip_rx_intr"); /* XXX */ + } + nextout->di_desc->d_status = TULIP_DSTS_OWNER; + KASSERT(nextout->di_mbuf == NULL, ("clobbering earlier rx mbuf")); + nextout->di_mbuf = ms; + CTR2(KTR_TULIP, "tulip_rx_intr: enqueued mbuf %p to descriptor %td", + ms, nextout - ri->ri_first); + TULIP_RXDESC_POSTSYNC(ri); + if (++ri->ri_nextout == ri->ri_last) + ri->ri_nextout = ri->ri_first; + ri->ri_free--; + me = ms->m_next; + ms->m_next = NULL; + } while ((ms = me) != NULL); + + if ((ri->ri_max - ri->ri_free) >= TULIP_RXQ_TARGET) + sc->tulip_flags &= ~TULIP_RXBUFSLOW; + TULIP_PERFEND(rxget); + } + +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_rxintrs++; + sc->tulip_dbg.dbg_rxpktsperintr[cnt]++; +#endif + TULIP_PERFEND(rxintr); +} + +static int +tulip_tx_intr(tulip_softc_t * const sc) +{ + TULIP_PERFSTART(txintr) + tulip_ringinfo_t * const ri = &sc->tulip_txinfo; + struct mbuf *m; + int xmits = 0; + int descs = 0; + + CTR0(KTR_TULIP, "tulip_tx_intr: start"); + TULIP_LOCK_ASSERT(sc); + while (ri->ri_free < ri->ri_max) { + u_int32_t d_flag; + + TULIP_TXDESC_POSTSYNC(ri); + if (DESC_STATUS(ri->ri_nextin) & TULIP_DSTS_OWNER) + break; + + ri->ri_free++; + descs++; + d_flag = DESC_FLAG(ri->ri_nextin); + if (d_flag & TULIP_DFLAG_TxLASTSEG) { + if (d_flag & TULIP_DFLAG_TxSETUPPKT) { + CTR2(KTR_TULIP, + "tulip_tx_intr: setup packet from descriptor %td: %08x", + ri->ri_nextin - ri->ri_first, DESC_STATUS(ri->ri_nextin)); + /* + * We've just finished processing a setup packet. + * Mark that we finished it. If there's not + * another pending, startup the TULIP receiver. + * Make sure we ack the RXSTOPPED so we won't get + * an abormal interrupt indication. + */ + bus_dmamap_sync(sc->tulip_setup_tag, sc->tulip_setup_map, + BUS_DMASYNC_POSTWRITE); + sc->tulip_flags &= ~(TULIP_DOINGSETUP|TULIP_HASHONLY); + if (DESC_FLAG(ri->ri_nextin) & TULIP_DFLAG_TxINVRSFILT) + sc->tulip_flags |= TULIP_HASHONLY; + if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == 0) { + tulip_rx_intr(sc); + sc->tulip_cmdmode |= TULIP_CMD_RXRUN; + sc->tulip_intrmask |= TULIP_STS_RXSTOPPED; + CTR2(KTR_TULIP, + "tulip_tx_intr: intr mask %08x cmdmode %08x", + sc->tulip_intrmask, sc->tulip_cmdmode); + TULIP_CSR_WRITE(sc, csr_status, TULIP_STS_RXSTOPPED); + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); + } + } else { + const u_int32_t d_status = DESC_STATUS(ri->ri_nextin); + + m = tulip_dequeue_mbuf(ri, ri->ri_nextin, SYNC_TX); + CTR2(KTR_TULIP, + "tulip_tx_intr: data packet %p from descriptor %td", m, + ri->ri_nextin - ri->ri_first); + if (m != NULL) { + m_freem(m); +#if defined(TULIP_DEBUG) + } else { + device_printf(sc->tulip_dev, + "tx_intr: failed to dequeue mbuf?!?\n"); +#endif + } + if (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) { + tulip_mediapoll_event_t event = TULIP_MEDIAPOLL_TXPROBE_OK; + if (d_status & (TULIP_DSTS_TxNOCARR|TULIP_DSTS_TxEXCCOLL)) { +#if defined(TULIP_DEBUG) + if (d_status & TULIP_DSTS_TxNOCARR) + sc->tulip_dbg.dbg_txprobe_nocarr++; + if (d_status & TULIP_DSTS_TxEXCCOLL) + sc->tulip_dbg.dbg_txprobe_exccoll++; +#endif + event = TULIP_MEDIAPOLL_TXPROBE_FAILED; + } + (*sc->tulip_boardsw->bd_media_poll)(sc, event); + /* + * Escape from the loop before media poll has reset the TULIP! + */ + break; + } else { + xmits++; + if (d_status & TULIP_DSTS_ERRSUM) { + CTR1(KTR_TULIP, "tulip_tx_intr: output error: %08x", + d_status); + sc->tulip_ifp->if_oerrors++; + if (d_status & TULIP_DSTS_TxEXCCOLL) + sc->tulip_dot3stats.dot3StatsExcessiveCollisions++; + if (d_status & TULIP_DSTS_TxLATECOLL) + sc->tulip_dot3stats.dot3StatsLateCollisions++; + if (d_status & (TULIP_DSTS_TxNOCARR|TULIP_DSTS_TxCARRLOSS)) + sc->tulip_dot3stats.dot3StatsCarrierSenseErrors++; + if (d_status & (TULIP_DSTS_TxUNDERFLOW|TULIP_DSTS_TxBABBLE)) + sc->tulip_dot3stats.dot3StatsInternalMacTransmitErrors++; + if (d_status & TULIP_DSTS_TxUNDERFLOW) + sc->tulip_dot3stats.dot3StatsInternalTransmitUnderflows++; + if (d_status & TULIP_DSTS_TxBABBLE) + sc->tulip_dot3stats.dot3StatsInternalTransmitBabbles++; + } else { + u_int32_t collisions = + (d_status & TULIP_DSTS_TxCOLLMASK) + >> TULIP_DSTS_V_TxCOLLCNT; + + CTR2(KTR_TULIP, + "tulip_tx_intr: output ok, collisions %d, status %08x", + collisions, d_status); + sc->tulip_ifp->if_collisions += collisions; + if (collisions == 1) + sc->tulip_dot3stats.dot3StatsSingleCollisionFrames++; + else if (collisions > 1) + sc->tulip_dot3stats.dot3StatsMultipleCollisionFrames++; + else if (d_status & TULIP_DSTS_TxDEFERRED) + sc->tulip_dot3stats.dot3StatsDeferredTransmissions++; + /* + * SQE is only valid for 10baseT/BNC/AUI when not + * running in full-duplex. In order to speed up the + * test, the corresponding bit in tulip_flags needs to + * set as well to get us to count SQE Test Errors. + */ + if (d_status & TULIP_DSTS_TxNOHRTBT & sc->tulip_flags) + sc->tulip_dot3stats.dot3StatsSQETestErrors++; + } + } + } + } + + if (++ri->ri_nextin == ri->ri_last) + ri->ri_nextin = ri->ri_first; + + if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0) + sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + } + /* + * If nothing left to transmit, disable the timer. + * Else if progress, reset the timer back to 2 ticks. + */ + if (ri->ri_free == ri->ri_max || (sc->tulip_flags & TULIP_TXPROBE_ACTIVE)) + sc->tulip_txtimer = 0; + else if (xmits > 0) + sc->tulip_txtimer = TULIP_TXTIMER; + sc->tulip_ifp->if_opackets += xmits; + TULIP_PERFEND(txintr); + return descs; +} + +static void +tulip_print_abnormal_interrupt(tulip_softc_t * const sc, u_int32_t csr) +{ + const char * const *msgp = tulip_status_bits; + const char *sep; + u_int32_t mask; + const char thrsh[] = "72|128\0\0\0" "96|256\0\0\0" "128|512\0\0" "160|1024"; + + TULIP_LOCK_ASSERT(sc); + csr &= (1 << (sizeof(tulip_status_bits)/sizeof(tulip_status_bits[0]))) - 1; + device_printf(sc->tulip_dev, "abnormal interrupt:"); + for (sep = " ", mask = 1; mask <= csr; mask <<= 1, msgp++) { + if ((csr & mask) && *msgp != NULL) { + printf("%s%s", sep, *msgp); + if (mask == TULIP_STS_TXUNDERFLOW && (sc->tulip_flags & TULIP_NEWTXTHRESH)) { + sc->tulip_flags &= ~TULIP_NEWTXTHRESH; + if (sc->tulip_cmdmode & TULIP_CMD_STOREFWD) { + printf(" (switching to store-and-forward mode)"); + } else { + printf(" (raising TX threshold to %s)", + &thrsh[9 * ((sc->tulip_cmdmode & TULIP_CMD_THRESHOLDCTL) >> 14)]); + } + } + sep = ", "; + } + } + printf("\n"); +} + +static void +tulip_intr_handler(tulip_softc_t * const sc) +{ + TULIP_PERFSTART(intr) + u_int32_t csr; + + CTR0(KTR_TULIP, "tulip_intr_handler invoked"); + TULIP_LOCK_ASSERT(sc); + while ((csr = TULIP_CSR_READ(sc, csr_status)) & sc->tulip_intrmask) { + TULIP_CSR_WRITE(sc, csr_status, csr); + + if (csr & TULIP_STS_SYSERROR) { + sc->tulip_last_system_error = (csr & TULIP_STS_ERRORMASK) >> TULIP_STS_ERR_SHIFT; + if (sc->tulip_flags & TULIP_NOMESSAGES) { + sc->tulip_flags |= TULIP_SYSTEMERROR; + } else { + device_printf(sc->tulip_dev, "system error: %s\n", + tulip_system_errors[sc->tulip_last_system_error]); + } + sc->tulip_flags |= TULIP_NEEDRESET; + sc->tulip_system_errors++; + break; + } + if (csr & (TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL) & sc->tulip_intrmask) { +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_link_intrs++; +#endif + if (sc->tulip_boardsw->bd_media_poll != NULL) { + (*sc->tulip_boardsw->bd_media_poll)(sc, csr & TULIP_STS_LINKFAIL + ? TULIP_MEDIAPOLL_LINKFAIL + : TULIP_MEDIAPOLL_LINKPASS); + csr &= ~TULIP_STS_ABNRMLINTR; + } + tulip_media_print(sc); + } + if (csr & (TULIP_STS_RXINTR|TULIP_STS_RXNOBUF)) { + u_int32_t misses = TULIP_CSR_READ(sc, csr_missed_frames); + if (csr & TULIP_STS_RXNOBUF) + sc->tulip_dot3stats.dot3StatsMissedFrames += misses & 0xFFFF; + /* + * Pass 2.[012] of the 21140A-A[CDE] may hang and/or corrupt data + * on receive overflows. + */ + if ((misses & 0x0FFE0000) && (sc->tulip_features & TULIP_HAVE_RXBADOVRFLW)) { + sc->tulip_dot3stats.dot3StatsInternalMacReceiveErrors++; + /* + * Stop the receiver process and spin until it's stopped. + * Tell rx_intr to drop the packets it dequeues. + */ + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode & ~TULIP_CMD_RXRUN); + while ((TULIP_CSR_READ(sc, csr_status) & TULIP_STS_RXSTOPPED) == 0) + ; + TULIP_CSR_WRITE(sc, csr_status, TULIP_STS_RXSTOPPED); + sc->tulip_flags |= TULIP_RXIGNORE; + } + tulip_rx_intr(sc); + if (sc->tulip_flags & TULIP_RXIGNORE) { + /* + * Restart the receiver. + */ + sc->tulip_flags &= ~TULIP_RXIGNORE; + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); + } + } + if (csr & TULIP_STS_ABNRMLINTR) { + u_int32_t tmp = csr & sc->tulip_intrmask + & ~(TULIP_STS_NORMALINTR|TULIP_STS_ABNRMLINTR); + if (csr & TULIP_STS_TXUNDERFLOW) { + if ((sc->tulip_cmdmode & TULIP_CMD_THRESHOLDCTL) != TULIP_CMD_THRSHLD160) { + sc->tulip_cmdmode += TULIP_CMD_THRSHLD96; + sc->tulip_flags |= TULIP_NEWTXTHRESH; + } else if (sc->tulip_features & TULIP_HAVE_STOREFWD) { + sc->tulip_cmdmode |= TULIP_CMD_STOREFWD; + sc->tulip_flags |= TULIP_NEWTXTHRESH; + } + } + if (sc->tulip_flags & TULIP_NOMESSAGES) { + sc->tulip_statusbits |= tmp; + } else { + tulip_print_abnormal_interrupt(sc, tmp); + sc->tulip_flags |= TULIP_NOMESSAGES; + } + TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); + } + if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_TXPROBE_ACTIVE|TULIP_DOINGSETUP|TULIP_PROMISC)) { + tulip_tx_intr(sc); + if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0) + tulip_start_locked(sc); + } + } + if (sc->tulip_flags & TULIP_NEEDRESET) { + tulip_reset(sc); + tulip_init_locked(sc); + } + TULIP_PERFEND(intr); +} + +static void +tulip_intr_shared(void *arg) +{ + tulip_softc_t * sc = arg; + + for (; sc != NULL; sc = sc->tulip_slaves) { + TULIP_LOCK(sc); +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_intrs++; +#endif + tulip_intr_handler(sc); + TULIP_UNLOCK(sc); + } +} + +static void +tulip_intr_normal(void *arg) +{ + tulip_softc_t * sc = (tulip_softc_t *) arg; + + TULIP_LOCK(sc); +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_intrs++; +#endif + tulip_intr_handler(sc); + TULIP_UNLOCK(sc); +} + +static struct mbuf * +tulip_txput(tulip_softc_t * const sc, struct mbuf *m) +{ + TULIP_PERFSTART(txput) + tulip_ringinfo_t * const ri = &sc->tulip_txinfo; + tulip_descinfo_t *eop, *nextout; + int segcnt, free; + u_int32_t d_status; + bus_dma_segment_t segs[TULIP_MAX_TXSEG]; + bus_dmamap_t *map; + int error, nsegs; + struct mbuf *m0; + + TULIP_LOCK_ASSERT(sc); +#if defined(TULIP_DEBUG) + if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) { + device_printf(sc->tulip_dev, "txput%s: tx not running\n", + (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) ? "(probe)" : ""); + sc->tulip_flags |= TULIP_WANTTXSTART; + sc->tulip_dbg.dbg_txput_finishes[0]++; + goto finish; + } +#endif + + /* + * Now we try to fill in our transmit descriptors. This is + * a bit reminiscent of going on the Ark two by two + * since each descriptor for the TULIP can describe + * two buffers. So we advance through packet filling + * each of the two entries at a time to to fill each + * descriptor. Clear the first and last segment bits + * in each descriptor (actually just clear everything + * but the end-of-ring or chain bits) to make sure + * we don't get messed up by previously sent packets. + * + * We may fail to put the entire packet on the ring if + * there is either not enough ring entries free or if the + * packet has more than MAX_TXSEG segments. In the former + * case we will just wait for the ring to empty. In the + * latter case we have to recopy. + */ +#if defined(KTR) && KTR_TULIP + segcnt = 1; + m0 = m; + while (m0->m_next != NULL) { + segcnt++; + m0 = m0->m_next; + } +#endif + CTR2(KTR_TULIP, "tulip_txput: sending packet %p (%d chunks)", m, segcnt); + d_status = 0; + eop = nextout = ri->ri_nextout; + segcnt = 0; + free = ri->ri_free; + + /* + * Reclaim some tx descriptors if we are out since we need at least one + * free descriptor so that we have a dma_map to load the mbuf. + */ + if (free == 0) { +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_no_txmaps++; +#endif + free += tulip_tx_intr(sc); + } + if (free == 0) { + sc->tulip_flags |= TULIP_WANTTXSTART; +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_txput_finishes[1]++; +#endif + goto finish; + } + error = bus_dmamap_load_mbuf_sg(ri->ri_data_tag, *eop->di_map, m, segs, + &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + if (error == EFBIG) { + /* + * The packet exceeds the number of transmit buffer + * entries that we can use for one packet, so we have + * to recopy it into one mbuf and then try again. If + * we can't recopy it, try again later. + */ + m0 = m_defrag(m, M_DONTWAIT); + if (m0 == NULL) { + sc->tulip_flags |= TULIP_WANTTXSTART; +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_txput_finishes[2]++; +#endif + goto finish; + } + m = m0; + error = bus_dmamap_load_mbuf_sg(ri->ri_data_tag, *eop->di_map, m, + segs, &nsegs, BUS_DMA_NOWAIT); + } + if (error != 0) { + device_printf(sc->tulip_dev, + "unable to load tx map, error = %d\n", error); +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_txput_finishes[3]++; +#endif + goto finish; + } + } + CTR1(KTR_TULIP, "tulip_txput: nsegs %d", nsegs); + + /* + * Each descriptor allows for up to 2 fragments since we don't use + * the descriptor chaining mode in this driver. + */ + if ((free -= (nsegs + 1) / 2) <= 0 + /* + * See if there's any unclaimed space in the transmit ring. + */ + && (free += tulip_tx_intr(sc)) <= 0) { + /* + * There's no more room but since nothing + * has been committed at this point, just + * show output is active, put back the + * mbuf and return. + */ + sc->tulip_flags |= TULIP_WANTTXSTART; +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_txput_finishes[4]++; +#endif + bus_dmamap_unload(ri->ri_data_tag, *eop->di_map); + goto finish; + } + for (; nsegs - segcnt > 1; segcnt += 2) { + eop = nextout; + eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; + eop->di_desc->d_status = d_status; + eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff; + eop->di_desc->d_length1 = segs[segcnt].ds_len; + eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr & 0xffffffff; + eop->di_desc->d_length2 = segs[segcnt+1].ds_len; + d_status = TULIP_DSTS_OWNER; + if (++nextout == ri->ri_last) + nextout = ri->ri_first; + } + if (segcnt < nsegs) { + eop = nextout; + eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; + eop->di_desc->d_status = d_status; + eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff; + eop->di_desc->d_length1 = segs[segcnt].ds_len; + eop->di_desc->d_addr2 = 0; + eop->di_desc->d_length2 = 0; + if (++nextout == ri->ri_last) + nextout = ri->ri_first; + } + + /* + * tulip_tx_intr() harvests the mbuf from the last descriptor in the + * frame. We just used the dmamap in the first descriptor for the + * load operation however. Thus, to let the tulip_dequeue_mbuf() call + * in tulip_tx_intr() unload the correct dmamap, we swap the dmamap + * pointers in the two descriptors if this is a multiple-descriptor + * packet. + */ + if (eop != ri->ri_nextout) { + map = eop->di_map; + eop->di_map = ri->ri_nextout->di_map; + ri->ri_nextout->di_map = map; + } + + /* + * bounce a copy to the bpf listener, if any. + */ + if (!(sc->tulip_flags & TULIP_DEVICEPROBE)) + BPF_MTAP(sc->tulip_ifp, m); + + /* + * The descriptors have been filled in. Now get ready + * to transmit. + */ + CTR3(KTR_TULIP, "tulip_txput: enqueued mbuf %p to descriptors %td - %td", + m, ri->ri_nextout - ri->ri_first, eop - ri->ri_first); + KASSERT(eop->di_mbuf == NULL, ("clobbering earlier tx mbuf")); + eop->di_mbuf = m; + TULIP_TXMAP_PRESYNC(ri, ri->ri_nextout); + m = NULL; + + /* + * Make sure the next descriptor after this packet is owned + * by us since it may have been set up above if we ran out + * of room in the ring. + */ + nextout->di_desc->d_status = 0; + TULIP_TXDESC_PRESYNC(ri); + + /* + * Mark the last and first segments, indicate we want a transmit + * complete interrupt, and tell it to transmit! + */ + eop->di_desc->d_flag |= TULIP_DFLAG_TxLASTSEG|TULIP_DFLAG_TxWANTINTR; + + /* + * Note that ri->ri_nextout is still the start of the packet + * and until we set the OWNER bit, we can still back out of + * everything we have done. + */ + ri->ri_nextout->di_desc->d_flag |= TULIP_DFLAG_TxFIRSTSEG; + TULIP_TXDESC_PRESYNC(ri); + ri->ri_nextout->di_desc->d_status = TULIP_DSTS_OWNER; + TULIP_TXDESC_PRESYNC(ri); + + /* + * This advances the ring for us. + */ + ri->ri_nextout = nextout; + ri->ri_free = free; + + TULIP_PERFEND(txput); + + if (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) { + TULIP_CSR_WRITE(sc, csr_txpoll, 1); + sc->tulip_ifp->if_drv_flags |= IFF_DRV_OACTIVE; + TULIP_PERFEND(txput); + return NULL; + } + + /* + * switch back to the single queueing ifstart. + */ + sc->tulip_flags &= ~TULIP_WANTTXSTART; + if (sc->tulip_txtimer == 0) + sc->tulip_txtimer = TULIP_TXTIMER; +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_txput_finishes[5]++; +#endif + + /* + * If we want a txstart, there must be not enough space in the + * transmit ring. So we want to enable transmit done interrupts + * so we can immediately reclaim some space. When the transmit + * interrupt is posted, the interrupt handler will call tx_intr + * to reclaim space and then txstart (since WANTTXSTART is set). + * txstart will move the packet into the transmit ring and clear + * WANTTXSTART thereby causing TXINTR to be cleared. + */ + finish: +#if defined(TULIP_DEBUG) + sc->tulip_dbg.dbg_txput_finishes[6]++; +#endif + if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_DOINGSETUP)) { + sc->tulip_ifp->if_drv_flags |= IFF_DRV_OACTIVE; + if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) { + sc->tulip_intrmask |= TULIP_STS_TXINTR; + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + } + } else if ((sc->tulip_flags & TULIP_PROMISC) == 0) { + if (sc->tulip_intrmask & TULIP_STS_TXINTR) { + sc->tulip_intrmask &= ~TULIP_STS_TXINTR; + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + } + } + TULIP_CSR_WRITE(sc, csr_txpoll, 1); + TULIP_PERFEND(txput); + return m; +} + +static void +tulip_txput_setup(tulip_softc_t * const sc) +{ + tulip_ringinfo_t * const ri = &sc->tulip_txinfo; + tulip_desc_t *nextout; + + TULIP_LOCK_ASSERT(sc); + + /* + * We will transmit, at most, one setup packet per call to ifstart. + */ + +#if defined(TULIP_DEBUG) + if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) { + device_printf(sc->tulip_dev, "txput_setup: tx not running\n"); + sc->tulip_flags |= TULIP_WANTTXSTART; + return; + } +#endif + /* + * Try to reclaim some free descriptors.. + */ + if (ri->ri_free < 2) + tulip_tx_intr(sc); + if ((sc->tulip_flags & TULIP_DOINGSETUP) || ri->ri_free == 1) { + sc->tulip_flags |= TULIP_WANTTXSTART; + return; + } + bcopy(sc->tulip_setupdata, sc->tulip_setupbuf, + sizeof(sc->tulip_setupdata)); + /* + * Clear WANTSETUP and set DOINGSETUP. Since we know that WANTSETUP is + * set and DOINGSETUP is clear doing an XOR of the two will DTRT. + */ + sc->tulip_flags ^= TULIP_WANTSETUP|TULIP_DOINGSETUP; + ri->ri_free--; + nextout = ri->ri_nextout->di_desc; + nextout->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; + nextout->d_flag |= TULIP_DFLAG_TxFIRSTSEG|TULIP_DFLAG_TxLASTSEG + |TULIP_DFLAG_TxSETUPPKT|TULIP_DFLAG_TxWANTINTR; + if (sc->tulip_flags & TULIP_WANTHASHPERFECT) + nextout->d_flag |= TULIP_DFLAG_TxHASHFILT; + else if (sc->tulip_flags & TULIP_WANTHASHONLY) + nextout->d_flag |= TULIP_DFLAG_TxHASHFILT|TULIP_DFLAG_TxINVRSFILT; + + nextout->d_length2 = 0; + nextout->d_addr2 = 0; + nextout->d_length1 = sizeof(sc->tulip_setupdata); + nextout->d_addr1 = sc->tulip_setup_dma_addr & 0xffffffff; + bus_dmamap_sync(sc->tulip_setup_tag, sc->tulip_setup_map, + BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + TULIP_TXDESC_PRESYNC(ri); + CTR1(KTR_TULIP, "tulip_txput_setup: using descriptor %td", + ri->ri_nextout - ri->ri_first); + + /* + * Advance the ring for the next transmit packet. + */ + if (++ri->ri_nextout == ri->ri_last) + ri->ri_nextout = ri->ri_first; + + /* + * Make sure the next descriptor is owned by us since it + * may have been set up above if we ran out of room in the + * ring. + */ + ri->ri_nextout->di_desc->d_status = 0; + TULIP_TXDESC_PRESYNC(ri); + nextout->d_status = TULIP_DSTS_OWNER; + /* + * Flush the ownwership of the current descriptor + */ + TULIP_TXDESC_PRESYNC(ri); + TULIP_CSR_WRITE(sc, csr_txpoll, 1); + if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) { + sc->tulip_intrmask |= TULIP_STS_TXINTR; + TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); + } +} + +static int +tulip_ifioctl(struct ifnet * ifp, u_long cmd, caddr_t data) +{ + TULIP_PERFSTART(ifioctl) + tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc; + struct ifreq *ifr = (struct ifreq *) data; + int error = 0; + + switch (cmd) { + case SIOCSIFFLAGS: { + TULIP_LOCK(sc); + tulip_init_locked(sc); + TULIP_UNLOCK(sc); + break; + } + + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: { + error = ifmedia_ioctl(ifp, ifr, &sc->tulip_ifmedia, cmd); + break; + } + + case SIOCADDMULTI: + case SIOCDELMULTI: { + /* + * Update multicast listeners + */ + TULIP_LOCK(sc); + tulip_init_locked(sc); + TULIP_UNLOCK(sc); + error = 0; + break; + } + +#ifdef SIOCGADDRROM + case SIOCGADDRROM: { + error = copyout(sc->tulip_rombuf, ifr->ifr_data, sizeof(sc->tulip_rombuf)); + break; + } +#endif +#ifdef SIOCGCHIPID + case SIOCGCHIPID: { + ifr->ifr_metric = (int) sc->tulip_chipid; + break; + } +#endif + default: { + error = ether_ioctl(ifp, cmd, data); + break; + } + } + + TULIP_PERFEND(ifioctl); + return error; +} + +static void +tulip_start(struct ifnet * const ifp) +{ + TULIP_PERFSTART(ifstart) + tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc; + + TULIP_LOCK(sc); + tulip_start_locked(sc); + TULIP_UNLOCK(sc); + + TULIP_PERFEND(ifstart); +} + +static void +tulip_start_locked(tulip_softc_t * const sc) +{ + struct mbuf *m; + + TULIP_LOCK_ASSERT(sc); + + CTR0(KTR_TULIP, "tulip_start_locked invoked"); + if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP) + tulip_txput_setup(sc); + + CTR1(KTR_TULIP, "tulip_start_locked: %d tx packets pending", + sc->tulip_ifp->if_snd.ifq_len); + while (!IFQ_DRV_IS_EMPTY(&sc->tulip_ifp->if_snd)) { + IFQ_DRV_DEQUEUE(&sc->tulip_ifp->if_snd, m); + if(m == NULL) + break; + if ((m = tulip_txput(sc, m)) != NULL) { + IFQ_DRV_PREPEND(&sc->tulip_ifp->if_snd, m); + break; + } + } +} + +/* + * Even though this routine runs at device spl, it does not break + * our use of splnet (splsoftnet under NetBSD) for the majority + * of this driver since + * if_watcbog is called from if_watchdog which is called from + * splsoftclock which is below spl[soft]net. + */ +static void +tulip_ifwatchdog(struct ifnet *ifp) +{ + TULIP_PERFSTART(ifwatchdog) + tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc; +#if defined(TULIP_DEBUG) + u_int32_t rxintrs; +#endif + + TULIP_LOCK(sc); +#if defined(TULIP_DEBUG) + rxintrs = sc->tulip_dbg.dbg_rxintrs - sc->tulip_dbg.dbg_last_rxintrs; + if (rxintrs > sc->tulip_dbg.dbg_high_rxintrs_hz) + sc->tulip_dbg.dbg_high_rxintrs_hz = rxintrs; + sc->tulip_dbg.dbg_last_rxintrs = sc->tulip_dbg.dbg_rxintrs; +#endif /* TULIP_DEBUG */ + + sc->tulip_ifp->if_timer = 1; + /* + * These should be rare so do a bulk test up front so we can just skip + * them if needed. + */ + if (sc->tulip_flags & (TULIP_SYSTEMERROR|TULIP_RXBUFSLOW|TULIP_NOMESSAGES)) { + /* + * If the number of receive buffer is low, try to refill + */ + if (sc->tulip_flags & TULIP_RXBUFSLOW) + tulip_rx_intr(sc); + + if (sc->tulip_flags & TULIP_SYSTEMERROR) { + if_printf(sc->tulip_ifp, "%d system errors: last was %s\n", + sc->tulip_system_errors, + tulip_system_errors[sc->tulip_last_system_error]); + } + if (sc->tulip_statusbits) { + tulip_print_abnormal_interrupt(sc, sc->tulip_statusbits); + sc->tulip_statusbits = 0; + } + + sc->tulip_flags &= ~(TULIP_NOMESSAGES|TULIP_SYSTEMERROR); + } + + if (sc->tulip_txtimer) + tulip_tx_intr(sc); + if (sc->tulip_txtimer && --sc->tulip_txtimer == 0) { + if_printf(sc->tulip_ifp, "transmission timeout\n"); + if (TULIP_DO_AUTOSENSE(sc)) { + sc->tulip_media = TULIP_MEDIA_UNKNOWN; + sc->tulip_probe_state = TULIP_PROBE_INACTIVE; + sc->tulip_flags &= ~(TULIP_WANTRXACT|TULIP_LINKUP); + } + tulip_reset(sc); + tulip_init_locked(sc); + } + + TULIP_PERFEND(ifwatchdog); + TULIP_PERFMERGE(sc, perf_intr_cycles); + TULIP_PERFMERGE(sc, perf_ifstart_cycles); + TULIP_PERFMERGE(sc, perf_ifioctl_cycles); + TULIP_PERFMERGE(sc, perf_ifwatchdog_cycles); + TULIP_PERFMERGE(sc, perf_timeout_cycles); + TULIP_PERFMERGE(sc, perf_ifstart_one_cycles); + TULIP_PERFMERGE(sc, perf_txput_cycles); + TULIP_PERFMERGE(sc, perf_txintr_cycles); + TULIP_PERFMERGE(sc, perf_rxintr_cycles); + TULIP_PERFMERGE(sc, perf_rxget_cycles); + TULIP_PERFMERGE(sc, perf_intr); + TULIP_PERFMERGE(sc, perf_ifstart); + TULIP_PERFMERGE(sc, perf_ifioctl); + TULIP_PERFMERGE(sc, perf_ifwatchdog); + TULIP_PERFMERGE(sc, perf_timeout); + TULIP_PERFMERGE(sc, perf_ifstart_one); + TULIP_PERFMERGE(sc, perf_txput); + TULIP_PERFMERGE(sc, perf_txintr); + TULIP_PERFMERGE(sc, perf_rxintr); + TULIP_PERFMERGE(sc, perf_rxget); + TULIP_UNLOCK(sc); +} + +static void +tulip_attach(tulip_softc_t * const sc) +{ + struct ifnet *ifp; + + ifp = sc->tulip_ifp = if_alloc(IFT_ETHER); + + /* XXX: driver name/unit should be set some other way */ + if_initname(ifp, "de", sc->tulip_unit); + ifp->if_softc = sc; + ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST; + ifp->if_ioctl = tulip_ifioctl; + ifp->if_start = tulip_start; + ifp->if_watchdog = tulip_ifwatchdog; + ifp->if_timer = 1; + ifp->if_init = tulip_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + device_printf(sc->tulip_dev, "%s%s pass %d.%d%s\n", + sc->tulip_boardid, + tulip_chipdescs[sc->tulip_chipid], + (sc->tulip_revinfo & 0xF0) >> 4, + sc->tulip_revinfo & 0x0F, + (sc->tulip_features & (TULIP_HAVE_ISVSROM|TULIP_HAVE_OKSROM)) + == TULIP_HAVE_ISVSROM ? " (invalid EESPROM checksum)" : ""); + + TULIP_LOCK(sc); + (*sc->tulip_boardsw->bd_media_probe)(sc); + ifmedia_init(&sc->tulip_ifmedia, 0, + tulip_ifmedia_change, + tulip_ifmedia_status); + tulip_ifmedia_add(sc); + + tulip_reset(sc); + TULIP_UNLOCK(sc); + + ether_ifattach(sc->tulip_ifp, sc->tulip_enaddr); + + TULIP_LOCK(sc); + sc->tulip_flags &= ~TULIP_DEVICEPROBE; + TULIP_UNLOCK(sc); +} + +/* Release memory for a single descriptor ring. */ +static void +tulip_busdma_freering(tulip_ringinfo_t *ri) +{ + int i; + + /* Release the DMA maps and tag for data buffers. */ + if (ri->ri_data_maps != NULL) { + for (i = 0; i < ri->ri_max; i++) { + if (ri->ri_data_maps[i] != NULL) { + bus_dmamap_destroy(ri->ri_data_tag, ri->ri_data_maps[i]); + ri->ri_data_maps[i] = NULL; + } + } + free(ri->ri_data_maps, M_DEVBUF); + ri->ri_data_maps = NULL; + } + if (ri->ri_data_tag != NULL) { + bus_dma_tag_destroy(ri->ri_data_tag); + ri->ri_data_tag = NULL; + } + + /* Release the DMA memory and tag for the ring descriptors. */ + if (ri->ri_dma_addr != 0) { + bus_dmamap_unload(ri->ri_ring_tag, ri->ri_ring_map); + ri->ri_dma_addr = 0; + } + if (ri->ri_descs != NULL) { + bus_dmamem_free(ri->ri_ring_tag, ri->ri_descs, ri->ri_ring_map); + ri->ri_ring_map = NULL; + ri->ri_descs = NULL; + } + if (ri->ri_ring_tag != NULL) { + bus_dma_tag_destroy(ri->ri_ring_tag); + ri->ri_ring_tag = NULL; + } +} + +/* Allocate memory for a single descriptor ring. */ +static int +tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count, + bus_size_t align, int nsegs, tulip_ringinfo_t *ri, const char *name) +{ + size_t size; + int error, i; + + /* First, setup a tag. */ + ri->ri_max = count; + size = count * sizeof(tulip_desc_t); + error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL, + &ri->ri_ring_tag); + if (error) { + device_printf(dev, "failed to allocate %s descriptor ring dma tag\n", + name); + return (error); + } + + /* Next, allocate memory for the descriptors. */ + error = bus_dmamem_alloc(ri->ri_ring_tag, (void **)&ri->ri_descs, + BUS_DMA_NOWAIT | BUS_DMA_ZERO, &ri->ri_ring_map); + if (error) { + device_printf(dev, "failed to allocate memory for %s descriptor ring\n", + name); + return (error); + } + + /* Map the descriptors. */ + error = bus_dmamap_load(ri->ri_ring_tag, ri->ri_ring_map, ri->ri_descs, + size, tulip_dma_map_addr, &ri->ri_dma_addr, BUS_DMA_NOWAIT); + if (error) { + device_printf(dev, "failed to get dma address for %s descriptor ring\n", + name); + return (error); + } + + /* Allocate a tag for the data buffers. */ + error = bus_dma_tag_create(NULL, align, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag); + if (error) { + device_printf(dev, "failed to allocate %s buffer dma tag\n", name); + return (error); + } + + /* Allocate maps for the data buffers. */ + ri->ri_data_maps = malloc(sizeof(bus_dmamap_t) * count, M_DEVBUF, + M_WAITOK | M_ZERO); + for (i = 0; i < count; i++) { + error = bus_dmamap_create(ri->ri_data_tag, 0, &ri->ri_data_maps[i]); + if (error) { + device_printf(dev, "failed to create map for %s buffer %d\n", + name, i); + return (error); + } + } + + return (0); +} + +/* Release busdma maps, tags, and memory. */ +static void +tulip_busdma_cleanup(tulip_softc_t * const sc) +{ + + /* Release resources for the setup descriptor. */ + if (sc->tulip_setup_dma_addr != 0) { + bus_dmamap_unload(sc->tulip_setup_tag, sc->tulip_setup_map); + sc->tulip_setup_dma_addr = 0; + } + if (sc->tulip_setupbuf != NULL) { + bus_dmamem_free(sc->tulip_setup_tag, sc->tulip_setupbuf, + sc->tulip_setup_map); + bus_dmamap_destroy(sc->tulip_setup_tag, sc->tulip_setup_map); + sc->tulip_setup_map = NULL; + sc->tulip_setupbuf = NULL; + } + if (sc->tulip_setup_tag != NULL) { + bus_dma_tag_destroy(sc->tulip_setup_tag); + sc->tulip_setup_tag = NULL; + } + + /* Release the transmit ring. */ + tulip_busdma_freering(&sc->tulip_txinfo); + + /* Release the receive ring. */ + tulip_busdma_freering(&sc->tulip_rxinfo); +} + +static int +tulip_busdma_init(device_t dev, tulip_softc_t * const sc) +{ + int error; + + /* + * Allocate space and dmamap for transmit ring. + */ + error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, 1, TULIP_MAX_TXSEG, + &sc->tulip_txinfo, "transmit"); + if (error) + return (error); + + /* + * Allocate space and dmamap for receive ring. We tell bus_dma that + * we can map MCLBYTES so that it will accept a full MCLBYTES cluster, + * but we will only map the first TULIP_RX_BUFLEN bytes. This is not + * a waste in practice though as an ethernet frame can easily fit + * in TULIP_RX_BUFLEN bytes. + */ + error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, 4, 1, + &sc->tulip_rxinfo, "receive"); + if (error) + return (error); + + /* + * Allocate a DMA tag, memory, and map for setup descriptor + */ + error = bus_dma_tag_create(NULL, 32, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0, + NULL, NULL, &sc->tulip_setup_tag); + if (error) { + device_printf(dev, "failed to allocate setup descriptor dma tag\n"); + return (error); + } + error = bus_dmamem_alloc(sc->tulip_setup_tag, (void **)&sc->tulip_setupbuf, + BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->tulip_setup_map); + if (error) { + device_printf(dev, "failed to allocate memory for setup descriptor\n"); + return (error); + } + error = bus_dmamap_load(sc->tulip_setup_tag, sc->tulip_setup_map, + sc->tulip_setupbuf, sizeof(sc->tulip_setupdata), + tulip_dma_map_addr, &sc->tulip_setup_dma_addr, BUS_DMA_NOWAIT); + if (error) { + device_printf(dev, "failed to get dma address for setup descriptor\n"); + return (error); + } + + return error; +} + +static void +tulip_initcsrs(tulip_softc_t * const sc, tulip_csrptr_t csr_base, + size_t csr_size) +{ + sc->tulip_csrs.csr_busmode = csr_base + 0 * csr_size; + sc->tulip_csrs.csr_txpoll = csr_base + 1 * csr_size; + sc->tulip_csrs.csr_rxpoll = csr_base + 2 * csr_size; + sc->tulip_csrs.csr_rxlist = csr_base + 3 * csr_size; + sc->tulip_csrs.csr_txlist = csr_base + 4 * csr_size; + sc->tulip_csrs.csr_status = csr_base + 5 * csr_size; + sc->tulip_csrs.csr_command = csr_base + 6 * csr_size; + sc->tulip_csrs.csr_intr = csr_base + 7 * csr_size; + sc->tulip_csrs.csr_missed_frames = csr_base + 8 * csr_size; + sc->tulip_csrs.csr_9 = csr_base + 9 * csr_size; + sc->tulip_csrs.csr_10 = csr_base + 10 * csr_size; + sc->tulip_csrs.csr_11 = csr_base + 11 * csr_size; + sc->tulip_csrs.csr_12 = csr_base + 12 * csr_size; + sc->tulip_csrs.csr_13 = csr_base + 13 * csr_size; + sc->tulip_csrs.csr_14 = csr_base + 14 * csr_size; + sc->tulip_csrs.csr_15 = csr_base + 15 * csr_size; +} + +static int +tulip_initring( + device_t dev, + tulip_softc_t * const sc, + tulip_ringinfo_t * const ri, + int ndescs) +{ + int i; + + ri->ri_descinfo = malloc(sizeof(tulip_descinfo_t) * ndescs, M_DEVBUF, + M_WAITOK | M_ZERO); + for (i = 0; i < ndescs; i++) { + ri->ri_descinfo[i].di_desc = &ri->ri_descs[i]; + ri->ri_descinfo[i].di_map = &ri->ri_data_maps[i]; + } + ri->ri_first = ri->ri_descinfo; + ri->ri_max = ndescs; + ri->ri_last = ri->ri_first + ri->ri_max; + bzero(ri->ri_descs, sizeof(tulip_desc_t) * ri->ri_max); + ri->ri_last[-1].di_desc->d_flag = TULIP_DFLAG_ENDRING; + return (0); +} + +/* + * This is the PCI configuration support. + */ + +#define PCI_CBIO PCIR_BAR(0) /* Configuration Base IO Address */ +#define PCI_CBMA PCIR_BAR(1) /* Configuration Base Memory Address */ +#define PCI_CFDA 0x40 /* Configuration Driver Area */ + +static int +tulip_pci_probe(device_t dev) +{ + const char *name = NULL; + + if (pci_get_vendor(dev) != DEC_VENDORID) + return ENXIO; + + /* + * Some LanMedia WAN cards use the Tulip chip, but they have + * their own driver, and we should not recognize them + */ + if (pci_get_subvendor(dev) == 0x1376) + return ENXIO; + + switch (pci_get_device(dev)) { + case CHIPID_21040: + name = "Digital 21040 Ethernet"; + break; + case CHIPID_21041: + name = "Digital 21041 Ethernet"; + break; + case CHIPID_21140: + if (pci_get_revid(dev) >= 0x20) + name = "Digital 21140A Fast Ethernet"; + else + name = "Digital 21140 Fast Ethernet"; + break; +#ifndef __HAIKU__ + /* + * The card with the same id is supported by if_dc - screen it to + * prevent duplicated dev entries. + */ + case CHIPID_21142: + if (pci_get_revid(dev) >= 0x20) + name = "Digital 21143 Fast Ethernet"; + else + name = "Digital 21142 Fast Ethernet"; + break; +#endif + } + if (name) { + device_set_desc(dev, name); + return BUS_PROBE_LOW_PRIORITY; + } + return ENXIO; +} + +static int +tulip_shutdown(device_t dev) +{ + tulip_softc_t * const sc = device_get_softc(dev); + TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET); + DELAY(10); /* Wait 10 microseconds (actually 50 PCI cycles but at + 33MHz that comes to two microseconds but wait a + bit longer anyways) */ + return 0; +} + +static int +tulip_pci_attach(device_t dev) +{ + tulip_softc_t *sc; + int retval, idx; + u_int32_t revinfo, cfdainfo; + unsigned csroffset = TULIP_PCI_CSROFFSET; + unsigned csrsize = TULIP_PCI_CSRSIZE; + tulip_csrptr_t csr_base; + tulip_chipid_t chipid = TULIP_CHIPID_UNKNOWN; + struct resource *res; + int rid, unit; + + unit = device_get_unit(dev); + + if (unit >= TULIP_MAX_DEVICES) { + device_printf(dev, "not configured; limit of %d reached or exceeded\n", + TULIP_MAX_DEVICES); + return ENXIO; + } + + revinfo = pci_get_revid(dev); + cfdainfo = pci_read_config(dev, PCI_CFDA, 4); + + /* turn busmaster on in case BIOS doesn't set it */ + pci_enable_busmaster(dev); + + if (pci_get_vendor(dev) == DEC_VENDORID) { + if (pci_get_device(dev) == CHIPID_21040) + chipid = TULIP_21040; + else if (pci_get_device(dev) == CHIPID_21041) + chipid = TULIP_21041; + else if (pci_get_device(dev) == CHIPID_21140) + chipid = (revinfo >= 0x20) ? TULIP_21140A : TULIP_21140; + else if (pci_get_device(dev) == CHIPID_21142) + chipid = (revinfo >= 0x20) ? TULIP_21143 : TULIP_21142; + } + if (chipid == TULIP_CHIPID_UNKNOWN) + return ENXIO; + + if (chipid == TULIP_21040 && revinfo < 0x20) { + device_printf(dev, + "not configured; 21040 pass 2.0 required (%d.%d found)\n", + revinfo >> 4, revinfo & 0x0f); + return ENXIO; + } else if (chipid == TULIP_21140 && revinfo < 0x11) { + device_printf(dev, + "not configured; 21140 pass 1.1 required (%d.%d found)\n", + revinfo >> 4, revinfo & 0x0f); + return ENXIO; + } + + sc = device_get_softc(dev); + sc->tulip_dev = dev; + sc->tulip_pci_busno = pci_get_bus(dev); + sc->tulip_pci_devno = pci_get_slot(dev); + sc->tulip_chipid = chipid; + sc->tulip_flags |= TULIP_DEVICEPROBE; + if (chipid == TULIP_21140 || chipid == TULIP_21140A) + sc->tulip_features |= TULIP_HAVE_GPR|TULIP_HAVE_STOREFWD; + if (chipid == TULIP_21140A && revinfo <= 0x22) + sc->tulip_features |= TULIP_HAVE_RXBADOVRFLW; + if (chipid == TULIP_21140) + sc->tulip_features |= TULIP_HAVE_BROKEN_HASH; + if (chipid != TULIP_21040 && chipid != TULIP_21140) + sc->tulip_features |= TULIP_HAVE_POWERMGMT; + if (chipid == TULIP_21041 || chipid == TULIP_21142 || chipid == TULIP_21143) { + sc->tulip_features |= TULIP_HAVE_DUALSENSE; + if (chipid != TULIP_21041 || revinfo >= 0x20) + sc->tulip_features |= TULIP_HAVE_SIANWAY; + if (chipid != TULIP_21041) + sc->tulip_features |= TULIP_HAVE_SIAGP|TULIP_HAVE_RXBADOVRFLW|TULIP_HAVE_STOREFWD; + if (chipid != TULIP_21041 && revinfo >= 0x20) + sc->tulip_features |= TULIP_HAVE_SIA100; + } + + if (sc->tulip_features & TULIP_HAVE_POWERMGMT + && (cfdainfo & (TULIP_CFDA_SLEEP|TULIP_CFDA_SNOOZE))) { + cfdainfo &= ~(TULIP_CFDA_SLEEP|TULIP_CFDA_SNOOZE); + pci_write_config(dev, PCI_CFDA, cfdainfo, 4); + DELAY(11*1000); + } + + sc->tulip_unit = unit; + sc->tulip_revinfo = revinfo; +#if defined(TULIP_IOMAPPED) + rid = PCI_CBIO; + res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); +#else + rid = PCI_CBMA; + res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); +#endif + if (!res) + return ENXIO; + sc->tulip_csrs_bst = rman_get_bustag(res); + sc->tulip_csrs_bsh = rman_get_bushandle(res); + csr_base = 0; + + mtx_init(TULIP_MUTEX(sc), MTX_NETWORK_LOCK, device_get_nameunit(dev), + MTX_DEF); + callout_init_mtx(&sc->tulip_callout, TULIP_MUTEX(sc), 0); + tulips[unit] = sc; + + tulip_initcsrs(sc, csr_base + csroffset, csrsize); + + if ((retval = tulip_busdma_init(dev, sc)) != 0) { + device_printf(dev, "error initing bus_dma: %d\n", retval); + tulip_busdma_cleanup(sc); + mtx_destroy(TULIP_MUTEX(sc)); + return ENXIO; + } + + retval = tulip_initring(dev, sc, &sc->tulip_rxinfo, TULIP_RXDESCS); + if (retval == 0) + retval = tulip_initring(dev, sc, &sc->tulip_txinfo, TULIP_TXDESCS); + if (retval) { + tulip_busdma_cleanup(sc); + mtx_destroy(TULIP_MUTEX(sc)); + return retval; + } + + /* + * Make sure there won't be any interrupts or such... + */ + TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET); + DELAY(100); /* Wait 10 microseconds (actually 50 PCI cycles but at + 33MHz that comes to two microseconds but wait a + bit longer anyways) */ + + TULIP_LOCK(sc); + retval = tulip_read_macaddr(sc); + TULIP_UNLOCK(sc); + if (retval < 0) { + device_printf(dev, "can't read ENET ROM (why=%d) (", retval); + for (idx = 0; idx < 32; idx++) + printf("%02x", sc->tulip_rombuf[idx]); + printf("\n"); + device_printf(dev, "%s%s pass %d.%d\n", + sc->tulip_boardid, tulip_chipdescs[sc->tulip_chipid], + (sc->tulip_revinfo & 0xF0) >> 4, sc->tulip_revinfo & 0x0F); + device_printf(dev, "address unknown\n"); + } else { + void (*intr_rtn)(void *) = tulip_intr_normal; + + if (sc->tulip_features & TULIP_HAVE_SHAREDINTR) + intr_rtn = tulip_intr_shared; + + tulip_attach(sc); + + /* Setup interrupt last. */ + if ((sc->tulip_features & TULIP_HAVE_SLAVEDINTR) == 0) { + void *ih; + + rid = 0; + res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (res == 0 || bus_setup_intr(dev, res, INTR_TYPE_NET | + INTR_MPSAFE, NULL, intr_rtn, sc, &ih)) { + device_printf(dev, "couldn't map interrupt\n"); + tulip_busdma_cleanup(sc); + ether_ifdetach(sc->tulip_ifp); + if_free(sc->tulip_ifp); + mtx_destroy(TULIP_MUTEX(sc)); + return ENXIO; + } + } + } + return 0; +} + +static device_method_t tulip_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, tulip_pci_probe), + DEVMETHOD(device_attach, tulip_pci_attach), + DEVMETHOD(device_shutdown, tulip_shutdown), + { 0, 0 } +}; + +static driver_t tulip_pci_driver = { + "de", + tulip_pci_methods, + sizeof(tulip_softc_t), +}; + +static devclass_t tulip_devclass; + +DRIVER_MODULE(de, pci, tulip_pci_driver, tulip_devclass, 0, 0); + +#ifdef DDB +void tulip_dumpring(int unit, int ring); +void tulip_dumpdesc(int unit, int ring, int desc); +void tulip_status(int unit); + +void +tulip_dumpring(int unit, int ring) +{ + tulip_softc_t *sc; + tulip_ringinfo_t *ri; + tulip_descinfo_t *di; + + if (unit < 0 || unit >= TULIP_MAX_DEVICES) { + db_printf("invalid unit %d\n", unit); + return; + } + sc = tulips[unit]; + if (sc == NULL) { + db_printf("unit %d not present\n", unit); + return; + } + + switch (ring) { + case 0: + db_printf("receive ring:\n"); + ri = &sc->tulip_rxinfo; + break; + case 1: + db_printf("transmit ring:\n"); + ri = &sc->tulip_txinfo; + break; + default: + db_printf("invalid ring %d\n", ring); + return; + } + + db_printf(" nextin: %td, nextout: %td, max: %d, free: %d\n", + ri->ri_nextin - ri->ri_first, ri->ri_nextout - ri->ri_first, + ri->ri_max, ri->ri_free); + for (di = ri->ri_first; di != ri->ri_last; di++) { + if (di->di_mbuf != NULL) + db_printf(" descriptor %td: mbuf %p\n", di - ri->ri_first, + di->di_mbuf); + else if (di->di_desc->d_flag & TULIP_DFLAG_TxSETUPPKT) + db_printf(" descriptor %td: setup packet\n", di - ri->ri_first); + } +} + +void +tulip_dumpdesc(int unit, int ring, int desc) +{ + tulip_softc_t *sc; + tulip_ringinfo_t *ri; + tulip_descinfo_t *di; + char *s; + + if (unit < 0 || unit >= TULIP_MAX_DEVICES) { + db_printf("invalid unit %d\n", unit); + return; + } + sc = tulips[unit]; + if (sc == NULL) { + db_printf("unit %d not present\n", unit); + return; + } + + switch (ring) { + case 0: + s = "receive"; + ri = &sc->tulip_rxinfo; + break; + case 1: + s = "transmit"; + ri = &sc->tulip_txinfo; + break; + default: + db_printf("invalid ring %d\n", ring); + return; + } + + if (desc < 0 || desc >= ri->ri_max) { + db_printf("invalid descriptor %d\n", desc); + return; + } + + db_printf("%s descriptor %d:\n", s, desc); + di = &ri->ri_first[desc]; + db_printf(" mbuf: %p\n", di->di_mbuf); + db_printf(" status: %08x flag: %03x\n", di->di_desc->d_status, + di->di_desc->d_flag); + db_printf(" addr1: %08x len1: %03x\n", di->di_desc->d_addr1, + di->di_desc->d_length1); + db_printf(" addr2: %08x len2: %03x\n", di->di_desc->d_addr2, + di->di_desc->d_length2); +} +#endif diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_devar.h b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_devar.h new file mode 100644 index 0000000000..14df41fdb7 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_devar.h @@ -0,0 +1,934 @@ +/* $NetBSD: if_devar.h,v 1.32 1999/04/01 14:55:25 tsubai Exp $ */ + +/* $FreeBSD: src/sys/dev/de/if_devar.h,v 1.45.10.2.6.1 2010/12/21 17:09:25 kensmith Exp $ */ + +/*- + * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Id: if_devar.h,v 1.28 1997/07/03 16:55:07 thomas Exp + */ + +#ifndef DEV_DE_IF_DEVAR_H +#define DEV_DE_IF_DEVAR_H + +typedef bus_addr_t tulip_csrptr_t; + +#define TULIP_PCI_CSRSIZE 8 +#define TULIP_PCI_CSROFFSET 0 + +#define TULIP_CSR_READ(sc, csr) \ + bus_space_read_4((sc)->tulip_csrs_bst, \ + (sc)->tulip_csrs_bsh, \ + (sc)->tulip_csrs.csr) +#define TULIP_CSR_WRITE(sc, csr, val) \ + bus_space_write_4((sc)->tulip_csrs_bst, \ + (sc)->tulip_csrs_bsh, \ + (sc)->tulip_csrs.csr, val) + +/* + * This structure contains "pointers" for the registers on + * the various 21x4x chips. CSR0 through CSR8 are common + * to all chips. After that, it gets messy... + */ +typedef struct { + tulip_csrptr_t csr_busmode; /* CSR0 */ + tulip_csrptr_t csr_txpoll; /* CSR1 */ + tulip_csrptr_t csr_rxpoll; /* CSR2 */ + tulip_csrptr_t csr_rxlist; /* CSR3 */ + tulip_csrptr_t csr_txlist; /* CSR4 */ + tulip_csrptr_t csr_status; /* CSR5 */ + tulip_csrptr_t csr_command; /* CSR6 */ + tulip_csrptr_t csr_intr; /* CSR7 */ + tulip_csrptr_t csr_missed_frames; /* CSR8 */ + tulip_csrptr_t csr_9; /* CSR9 */ + tulip_csrptr_t csr_10; /* CSR10 */ + tulip_csrptr_t csr_11; /* CSR11 */ + tulip_csrptr_t csr_12; /* CSR12 */ + tulip_csrptr_t csr_13; /* CSR13 */ + tulip_csrptr_t csr_14; /* CSR14 */ + tulip_csrptr_t csr_15; /* CSR15 */ +} tulip_regfile_t; + +#define csr_enetrom csr_9 /* 21040 */ +#define csr_reserved csr_10 /* 21040 */ +#define csr_full_duplex csr_11 /* 21040 */ +#define csr_bootrom csr_10 /* 21041/21140A/?? */ +#define csr_gp csr_12 /* 21140* */ +#define csr_watchdog csr_15 /* 21140* */ +#define csr_gp_timer csr_11 /* 21041/21140* */ +#define csr_srom_mii csr_9 /* 21041/21140* */ +#define csr_sia_status csr_12 /* 2104x */ +#define csr_sia_connectivity csr_13 /* 2104x */ +#define csr_sia_tx_rx csr_14 /* 2104x */ +#define csr_sia_general csr_15 /* 2104x */ + +/* + * While 21x4x allows chaining of its descriptors, this driver + * doesn't take advantage of it. We keep the descriptors in a + * traditional FIFO ring. + */ +typedef struct { + tulip_desc_t *di_desc; + struct mbuf *di_mbuf; + bus_dmamap_t *di_map; +} tulip_descinfo_t; + +typedef struct { + tulip_descinfo_t *ri_first; /* first entry in ring */ + tulip_descinfo_t *ri_last; /* one after last entry */ + tulip_descinfo_t *ri_nextin; /* next to processed by host */ + tulip_descinfo_t *ri_nextout; /* next to processed by adapter */ + int ri_max; + int ri_free; + tulip_desc_t *ri_descs; + tulip_descinfo_t *ri_descinfo; + bus_dma_tag_t ri_ring_tag; + bus_dmamap_t ri_ring_map; + bus_addr_t ri_dma_addr; + bus_dma_tag_t ri_data_tag; + bus_dmamap_t *ri_data_maps; +} tulip_ringinfo_t; + +/* + * The 21040 has a stupid restriction in that the receive + * buffers must be longword aligned. But since Ethernet + * headers are not a multiple of longwords in size this forces + * the data to non-longword aligned. Since IP requires the + * data to be longword aligned, we need to copy it after it has + * been DMA'ed in our memory. + * + * Since we have to copy it anyways, we might as well as allocate + * dedicated receive space for the input. This allows to use a + * small receive buffer size and more ring entries to be able to + * better keep with a flood of tiny Ethernet packets. + * + * The receive space MUST ALWAYS be a multiple of the page size. + * And the number of receive descriptors multiplied by the size + * of the receive buffers must equal the receive space. This + * is so that we can manipulate the page tables so that even if a + * packet wraps around the end of the receive space, we can + * treat it as virtually contiguous. + * + * The above used to be true (the stupid restriction is still true) + * but we gone to directly DMA'ing into MBUFs (unless it's on an + * architecture which can't handle unaligned accesses) because with + * 100Mb/s cards the copying is just too much of a hit. + */ + +#define TULIP_TXTIMER 4 +#define TULIP_RXDESCS 48 +#define TULIP_TXDESCS 128 +#define TULIP_RXQ_TARGET 32 +#if TULIP_RXQ_TARGET >= TULIP_RXDESCS +#error TULIP_RXQ_TARGET must be less than TULIP_RXDESCS +#endif +#define TULIP_RX_BUFLEN ((MCLBYTES < 2048 ? MCLBYTES : 2048) - 16) + +/* + * Forward reference to make C happy. + */ +typedef struct tulip_softc tulip_softc_t; + +/* + * Enumeration of the various controllers supported. + */ +typedef enum { + TULIP_21040, + TULIP_21041, + TULIP_21140, + TULIP_21140A, + TULIP_21142, + TULIP_21143, + TULIP_CHIPID_UNKNOWN +} tulip_chipid_t; + +/* + * Various physical media types supported. + * BNCAUI is BNC or AUI since on the 21040 you can't really tell + * which is in use. + */ +typedef enum { + TULIP_MEDIA_UNKNOWN, + TULIP_MEDIA_10BASET, + TULIP_MEDIA_10BASET_FD, + TULIP_MEDIA_BNC, + TULIP_MEDIA_AUI, + TULIP_MEDIA_EXTSIA, + TULIP_MEDIA_AUIBNC, + TULIP_MEDIA_100BASETX, + TULIP_MEDIA_100BASETX_FD, + TULIP_MEDIA_100BASET4, + TULIP_MEDIA_100BASEFX, + TULIP_MEDIA_100BASEFX_FD, + TULIP_MEDIA_MAX +} tulip_media_t; + +#define TULIP_BIT(b) (1L << ((int)(b))) +#define TULIP_FDBIT(m) (1L << ((int)TULIP_MEDIA_ ## m ## _FD)) +#define TULIP_MBIT(m) (1L << ((int)TULIP_MEDIA_ ## m )) +#define TULIP_IS_MEDIA_FD(m) (TULIP_BIT(m) & \ + (TULIP_FDBIT(10BASET) | \ + TULIP_FDBIT(100BASETX) | \ + TULIP_FDBIT(100BASEFX))) +#define TULIP_CAN_MEDIA_FD(m) (TULIP_BIT(m) & \ + (TULIP_MBIT(10BASET) | \ + TULIP_MBIT(100BASETX) | \ + TULIP_MBIT(100BASEFX))) +#define TULIP_FD_MEDIA_OF(m) ((tulip_media_t)((m) + 1)) +#define TULIP_HD_MEDIA_OF(m) ((tulip_media_t)((m) - 1)) +#define TULIP_IS_MEDIA_100MB(m) ((m) >= TULIP_MEDIA_100BASETX) +#define TULIP_IS_MEDIA_TP(m) ((TULIP_BIT(m) & \ + (TULIP_MBIT(BNC) | \ + TULIP_MBIT(AUI) | \ + TULIP_MBIT(AUIBNC) | \ + TULIP_MBIT(EXTSIA))) == 0) + +#define TULIP_SROM_ATTR_MII 0x0100 +#define TULIP_SROM_ATTR_NWAY 0x0200 +#define TULIP_SROM_ATTR_AUTOSENSE 0x0400 +#define TULIP_SROM_ATTR_POWERUP 0x0800 +#define TULIP_SROM_ATTR_NOLINKPASS 0x1000 + +typedef struct { + enum { + TULIP_MEDIAINFO_NONE, + TULIP_MEDIAINFO_SIA, + TULIP_MEDIAINFO_GPR, + TULIP_MEDIAINFO_MII, + TULIP_MEDIAINFO_RESET, + TULIP_MEDIAINFO_SYM + } mi_type; + union { + struct { + u_int16_t sia_connectivity; + u_int16_t sia_tx_rx; + u_int16_t sia_general; + u_int32_t sia_gp_control; /* 21142/21143 */ + u_int32_t sia_gp_data; /* 21142/21143 */ + } un_sia; + struct { + u_int32_t gpr_cmdmode; + u_int32_t gpr_gpcontrol; /* 21142/21143 */ + u_int32_t gpr_gpdata; + u_int8_t gpr_actmask; + u_int8_t gpr_actdata; + u_int gpr_default:1; + } un_gpr; + struct { + u_int32_t mii_mediamask; + u_int16_t mii_capabilities; + u_int16_t mii_advertisement; + u_int16_t mii_full_duplex; + u_int16_t mii_tx_threshold; + u_int16_t mii_interrupt; /* 21142/21143 */ + u_int8_t mii_phyaddr; + u_int8_t mii_gpr_length; + u_int8_t mii_gpr_offset; + u_int8_t mii_reset_length; + u_int8_t mii_reset_offset; + u_int32_t mii_phyid; + } un_mii; + } mi_un; +} tulip_media_info_t; + +#define mi_sia_connectivity mi_un.un_sia.sia_connectivity +#define mi_sia_tx_rx mi_un.un_sia.sia_tx_rx +#define mi_sia_general mi_un.un_sia.sia_general +#define mi_sia_gp_control mi_un.un_sia.sia_gp_control +#define mi_sia_gp_data mi_un.un_sia.sia_gp_data + +#define mi_gpcontrol mi_un.un_gpr.gpr_gpcontrol +#define mi_gpdata mi_un.un_gpr.gpr_gpdata +#define mi_actmask mi_un.un_gpr.gpr_actmask +#define mi_actdata mi_un.un_gpr.gpr_actdata +#define mi_default mi_un.un_gpr.gpr_default +#define mi_cmdmode mi_un.un_gpr.gpr_cmdmode + +#define mi_phyaddr mi_un.un_mii.mii_phyaddr +#define mi_gpr_length mi_un.un_mii.mii_gpr_length +#define mi_gpr_offset mi_un.un_mii.mii_gpr_offset +#define mi_reset_length mi_un.un_mii.mii_reset_length +#define mi_reset_offset mi_un.un_mii.mii_reset_offset +#define mi_capabilities mi_un.un_mii.mii_capabilities +#define mi_advertisement mi_un.un_mii.mii_advertisement +#define mi_full_duplex mi_un.un_mii.mii_full_duplex +#define mi_tx_threshold mi_un.un_mii.mii_tx_threshold +#define mi_mediamask mi_un.un_mii.mii_mediamask +#define mi_mii_interrupt mi_un.un_mii.mii_interrupt +#define mi_phyid mi_un.un_mii.mii_phyid + +#define TULIP_MEDIAINFO_SIA_INIT(sc, mi, chipid, media) do { \ + (mi)->mi_type = TULIP_MEDIAINFO_SIA; \ + sc->tulip_mediums[TULIP_MEDIA_ ## media] = (mi); \ + (mi)->mi_sia_connectivity = TULIP_ ## chipid ## _SIACONN_ ## media; \ + (mi)->mi_sia_tx_rx = TULIP_ ## chipid ## _SIATXRX_ ## media; \ + (mi)->mi_sia_general = TULIP_ ## chipid ## _SIAGEN_ ## media; \ +} while (0) + +#define TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, media) do { \ + if ((sc)->tulip_mediums[TULIP_MEDIA_ ## media] == NULL \ + && ((mi)->mi_capabilities & PHYSTS_ ## media)) { \ + (sc)->tulip_mediums[TULIP_MEDIA_ ## media] = (mi); \ + (mi)->mi_mediamask |= TULIP_BIT(TULIP_MEDIA_ ## media); \ + } \ +} while (0) + +#define TULIP_MII_NOPHY 32 +/* + * Some boards need to treated specially. The following enumeration + * identifies the cards with quirks (or those we just want to single + * out for special merit or scorn). + */ +typedef enum { + TULIP_21040_GENERIC, /* Generic 21040 (works with most any board) */ + TULIP_21140_ISV, /* Digital Semicondutor 21140 ISV SROM Format */ + TULIP_21142_ISV, /* Digital Semicondutor 21142 ISV SROM Format */ + TULIP_21143_ISV, /* Digital Semicondutor 21143 ISV SROM Format */ + TULIP_21140_DEC_EB, /* Digital Semicondutor 21140 Eval. Board */ + TULIP_21140_MII, /* 21140[A] with MII */ + TULIP_21140_DEC_DE500, /* Digital DE500-?? 10/100 */ + TULIP_21140_SMC_9332, /* SMC 9332 */ + TULIP_21140_COGENT_EM100, /* Cogent EM100 100 only */ + TULIP_21140_ZNYX_ZX34X, /* ZNYX ZX342 10/100 */ + TULIP_21140_ASANTE, /* AsanteFast 10/100 */ + TULIP_21140_EN1207, /* Accton EN2107 10/100 BNC */ + TULIP_21041_GENERIC /* Generic 21041 card */ +} tulip_board_t; + +typedef enum { + TULIP_MEDIAPOLL_TIMER, /* 100ms timer fired */ + TULIP_MEDIAPOLL_FASTTIMER, /* <100ms timer fired */ + TULIP_MEDIAPOLL_LINKFAIL, /* called from interrupt routine */ + TULIP_MEDIAPOLL_LINKPASS, /* called from interrupt routine */ + TULIP_MEDIAPOLL_START, /* start a media probe (from reset) */ + TULIP_MEDIAPOLL_TXPROBE_OK, /* txprobe succeeded */ + TULIP_MEDIAPOLL_TXPROBE_FAILED, /* txprobe failed */ + TULIP_MEDIAPOLL_MAX +} tulip_mediapoll_event_t; + +typedef enum { + TULIP_LINK_DOWN, /* Link is down */ + TULIP_LINK_UP, /* link is ok */ + TULIP_LINK_UNKNOWN /* we can't tell either way */ +} tulip_link_status_t; + +/* + * This data structure is used to abstract out the quirks. + * media_probe = tries to determine the media type. + * media_select = enables the current media (or autosenses) + * media_poll = autosenses media + * media_preset = 21140, etal requires bit to set before the + * the software reset; hence pre-set. Should be + * pre-reset but that's ugly. + */ +typedef struct { + tulip_board_t bd_type; + void (*bd_media_probe)(tulip_softc_t * const sc); + void (*bd_media_select)(tulip_softc_t * const sc); + void (*bd_media_poll)(tulip_softc_t * const sc, + tulip_mediapoll_event_t event); + void (*bd_media_preset) (tulip_softc_t * const sc); +} tulip_boardsw_t; + +/* + * The next few declarations are for MII/PHY based boards. + * + * The first enumeration identifies a superset of various datums + * that can be obtained from various PHY chips. Not all PHYs will + * support all datums. + * The modedata structure indicates what register contains + * a datum, what mask is applied the register contents, and what the + * result should be. + * The attr structure records information about a supported PHY. + * The phy structure records information about a PHY instance. + */ +typedef enum { + PHY_MODE_10T, + PHY_MODE_100TX, + PHY_MODE_100T4, + PHY_MODE_FULLDUPLEX, + PHY_MODE_MAX +} tulip_phy_mode_t; + +typedef struct { + u_int16_t pm_regno; + u_int16_t pm_mask; + u_int16_t pm_value; +} tulip_phy_modedata_t; + +typedef struct { + u_int32_t attr_id; + u_int16_t attr_flags; + tulip_phy_modedata_t attr_modes[PHY_MODE_MAX]; +#ifdef TULIP_DEBUG + const char *attr_name; +#endif +} tulip_phy_attr_t; + +/* Definitions for tulip_phy_attr_t.attr_flags */ +#define PHY_NEED_HARD_RESET 0x0001 +#define PHY_DUAL_CYCLE_TA 0x0002 + +/* + * Various probe states used when trying to autosense the media. + */ +typedef enum { + TULIP_PROBE_INACTIVE, + TULIP_PROBE_PHYRESET, + TULIP_PROBE_PHYAUTONEG, + TULIP_PROBE_GPRTEST, + TULIP_PROBE_MEDIATEST, + TULIP_PROBE_FAILED +} tulip_probe_state_t; + +typedef struct { + /* + * Transmit Statistics + */ + u_int32_t dot3StatsSingleCollisionFrames; + u_int32_t dot3StatsMultipleCollisionFrames; + u_int32_t dot3StatsSQETestErrors; + u_int32_t dot3StatsDeferredTransmissions; + u_int32_t dot3StatsLateCollisions; + u_int32_t dot3StatsExcessiveCollisions; + u_int32_t dot3StatsCarrierSenseErrors; + u_int32_t dot3StatsInternalMacTransmitErrors; + /* not in rfc1650! */ + u_int32_t dot3StatsInternalTransmitUnderflows; + /* not in rfc1650! */ + u_int32_t dot3StatsInternalTransmitBabbles; + /* + * Receive Statistics + */ + u_int32_t dot3StatsMissedFrames; /* not in rfc1650! */ + u_int32_t dot3StatsAlignmentErrors; + u_int32_t dot3StatsFCSErrors; + u_int32_t dot3StatsFrameTooLongs; + u_int32_t dot3StatsInternalMacReceiveErrors; +} tulip_dot3_stats_t; + +/* + * Probe information. + */ +struct tulip_probe_info { + u_int8_t probe_count; /* count of probe operations */ + int32_t probe_timeout; /* time (ms) of probe timeout */ + tulip_probe_state_t probe_state; /* current media probe state */ + tulip_media_t probe_media; /* current media being probed */ + u_int32_t probe_mediamask; /* medias checked */ + u_int32_t probe_passes; /* times autosense failed */ + u_int32_t probe_txprobes; /* txprobes attempted */ +}; + +/* + * Debugging/Statistical information. + */ +struct tulip_dbg_info { + tulip_media_t dbg_last_media; + u_int32_t dbg_intrs; + u_int32_t dbg_media_probes; + u_int32_t dbg_txprobe_nocarr; + u_int32_t dbg_txprobe_exccoll; + u_int32_t dbg_link_downed; + u_int32_t dbg_link_suspected; + u_int32_t dbg_link_intrs; + u_int32_t dbg_link_pollintrs; + u_int32_t dbg_link_failures; + u_int32_t dbg_nway_starts; + u_int32_t dbg_nway_failures; + u_int16_t dbg_phyregs[32][4]; + u_int32_t dbg_rxlowbufs; + u_int32_t dbg_rxintrs; + u_int32_t dbg_last_rxintrs; + u_int32_t dbg_high_rxintrs_hz; + u_int32_t dbg_no_txmaps; + u_int32_t dbg_txput_finishes[8]; + u_int32_t dbg_txprobes_ok[TULIP_MEDIA_MAX]; + u_int32_t dbg_txprobes_failed[TULIP_MEDIA_MAX]; + u_int32_t dbg_events[TULIP_MEDIAPOLL_MAX]; + u_int32_t dbg_rxpktsperintr[TULIP_RXDESCS]; +}; + +/* + * Performance statistics. + */ +struct tulip_perfstat { + u_quad_t perf_intr_cycles; + u_quad_t perf_ifstart_cycles; + u_quad_t perf_ifstart_one_cycles; + u_quad_t perf_ifioctl_cycles; + u_quad_t perf_ifwatchdog_cycles; + u_quad_t perf_timeout_cycles; + u_quad_t perf_txput_cycles; + u_quad_t perf_txintr_cycles; + u_quad_t perf_rxintr_cycles; + u_quad_t perf_rxget_cycles; + unsigned int perf_intr; + unsigned int perf_ifstart; + unsigned int perf_ifstart_one; + unsigned int perf_ifioctl; + unsigned int perf_ifwatchdog; + unsigned int perf_timeout; + unsigned int perf_txput; + unsigned int perf_txintr; + unsigned int perf_rxintr; + unsigned int perf_rxget; +}; +#define TULIP_PERF_CURRENT 0 +#define TULIP_PERF_PREVIOUS 1 +#define TULIP_PERF_TOTAL 2 +#define TULIP_PERF_MAX 3 + +/* + * Per-driver-instance state. + */ +struct tulip_softc { + device_t tulip_dev; + struct ifmedia tulip_ifmedia; + int tulip_unit; + struct ifnet *tulip_ifp; + u_char tulip_enaddr[ETHER_ADDR_LEN]; + bus_space_tag_t tulip_csrs_bst; + bus_space_handle_t tulip_csrs_bsh; + tulip_regfile_t tulip_csrs; + + u_int32_t tulip_flags; + u_int32_t tulip_features; + u_int32_t tulip_intrmask; + u_int32_t tulip_cmdmode; + u_int32_t tulip_last_system_error:3; + u_int32_t tulip_txtimer:3; /* transmission timer */ + u_int32_t tulip_system_errors; + u_int32_t tulip_statusbits; /* status bits from + * CSR5 that may need + * to be printed + */ + tulip_media_info_t *tulip_mediums[TULIP_MEDIA_MAX]; + tulip_media_t tulip_media; /* current media type */ + u_int32_t tulip_abilities; /* remote system's + * abilities (as + * defined in IEEE + * 802.3u) + */ + u_int8_t tulip_revinfo; /* chip revision */ + u_int8_t tulip_phyaddr; /* current phy */ + u_int8_t tulip_gpinit; /* active pins on + * 21140 + */ + u_int8_t tulip_gpdata; /* default gpdata for 21140 */ + struct tulip_probe_info tulip_probe; + tulip_chipid_t tulip_chipid; /* type of chip we are using */ + const tulip_boardsw_t *tulip_boardsw; /* board/chip characteristics */ + tulip_softc_t *tulip_slaves; /* slaved devices (ZX3xx) */ +#if defined(TULIP_DEBUG) + struct tulip_dbg_info tulip_dbg; +#endif +#if defined(TULIP_PERFSTATS) + struct tulip_perfstat tulip_perfstats[TULIP_PERF_MAX]; +#endif + tulip_dot3_stats_t tulip_dot3stats; + tulip_ringinfo_t tulip_rxinfo; + tulip_ringinfo_t tulip_txinfo; + tulip_media_info_t tulip_mediainfo[10]; + /* + * The setup buffers for sending the setup frame to the chip. one is + * the one being sent while the other is the one being filled. + */ + bus_dma_tag_t tulip_setup_tag; + bus_dmamap_t tulip_setup_map; + bus_addr_t tulip_setup_dma_addr; + u_int32_t *tulip_setupbuf; + u_int32_t tulip_setupdata[192 / sizeof(u_int32_t)]; + char tulip_boardid[24]; + u_int8_t tulip_rombuf[128]; /* must be aligned */ + + /* needed for multiport boards */ + u_int8_t tulip_pci_busno; + u_int8_t tulip_pci_devno; + + u_int8_t tulip_connidx; + tulip_srom_connection_t tulip_conntype; + struct callout tulip_callout; + struct mtx tulip_mutex; +}; + +#define tulip_curperfstats tulip_perfstats[TULIP_PERF_CURRENT] +#define tulip_probe_count tulip_probe.probe_count +#define tulip_probe_timeout tulip_probe.probe_timeout +#define tulip_probe_state tulip_probe.probe_state +#define tulip_probe_media tulip_probe.probe_media +#define tulip_probe_mediamask tulip_probe.probe_mediamask +#define tulip_probe_passes tulip_probe.probe_passes + +/* Definitions for tulip_flags. */ +#define TULIP_WANTSETUP 0x00000001 +#define TULIP_WANTHASHPERFECT 0x00000002 +#define TULIP_WANTHASHONLY 0x00000004 +#define TULIP_DOINGSETUP 0x00000008 +#define TULIP_PRINTMEDIA 0x00000010 +#define TULIP_TXPROBE_ACTIVE 0x00000020 +#define TULIP_ALLMULTI 0x00000040 +#define TULIP_WANTRXACT 0x00000080 +#define TULIP_RXACT 0x00000100 +#define TULIP_INRESET 0x00000200 +#define TULIP_NEEDRESET 0x00000400 +#define TULIP_SQETEST 0x00000800 +#define TULIP_xxxxxx0 0x00001000 +#define TULIP_xxxxxx1 0x00002000 +#define TULIP_WANTTXSTART 0x00004000 +#define TULIP_NEWTXTHRESH 0x00008000 +#define TULIP_NOAUTOSENSE 0x00010000 +#define TULIP_PRINTLINKUP 0x00020000 +#define TULIP_LINKUP 0x00040000 +#define TULIP_RXBUFSLOW 0x00080000 +#define TULIP_NOMESSAGES 0x00100000 +#define TULIP_SYSTEMERROR 0x00200000 +#define TULIP_TIMEOUTPENDING 0x00400000 +#define TULIP_xxxxxx2 0x00800000 +#define TULIP_TRYNWAY 0x01000000 +#define TULIP_DIDNWAY 0x02000000 +#define TULIP_RXIGNORE 0x04000000 +#define TULIP_PROBE1STPASS 0x08000000 +#define TULIP_DEVICEPROBE 0x10000000 +#define TULIP_PROMISC 0x20000000 +#define TULIP_HASHONLY 0x40000000 +#define TULIP_xxxxxx3 0x80000000 + +/* Definitions for tulip_features. */ +#define TULIP_HAVE_GPR 0x00000001 /* have gp register (140[A]) */ +#define TULIP_HAVE_RXBADOVRFLW 0x00000002 /* RX corrupts on overflow */ +#define TULIP_HAVE_POWERMGMT 0x00000004 /* Snooze/sleep modes */ +#define TULIP_HAVE_MII 0x00000008 /* Some medium on MII */ +#define TULIP_HAVE_SIANWAY 0x00000010 /* SIA does NWAY */ +#define TULIP_HAVE_DUALSENSE 0x00000020 /* SIA senses both AUI & TP */ +#define TULIP_HAVE_SIAGP 0x00000040 /* SIA has a GP port */ +#define TULIP_HAVE_BROKEN_HASH 0x00000080 /* Broken Multicast Hash */ +#define TULIP_HAVE_ISVSROM 0x00000100 /* uses ISV SROM Format */ +#define TULIP_HAVE_BASEROM 0x00000200 /* Board ROM can be cloned */ +#define TULIP_HAVE_SLAVEDROM 0x00000400 /* Board ROM cloned */ +#define TULIP_HAVE_SLAVEDINTR 0x00000800 /* Board slaved interrupt */ +#define TULIP_HAVE_SHAREDINTR 0x00001000 /* Board shares interrupts */ +#define TULIP_HAVE_OKROM 0x00002000 /* ROM was recognized */ +#define TULIP_HAVE_NOMEDIA 0x00004000 /* did not detect any media */ +#define TULIP_HAVE_STOREFWD 0x00008000 /* have CMD_STOREFWD */ +#define TULIP_HAVE_SIA100 0x00010000 /* has LS100 in SIA status */ +#define TULIP_HAVE_OKSROM 0x00020000 /* SROM CRC is OK */ + +#define TULIP_DO_AUTOSENSE(sc) \ + (IFM_SUBTYPE((sc)->tulip_ifmedia.ifm_media) == IFM_AUTO) + +#if defined(TULIP_HDR_DATA) +static const char *const tulip_chipdescs[] = { + "21040 [10Mb/s]", + "21041 [10Mb/s]", + "21140 [10-100Mb/s]", + "21140A [10-100Mb/s]", + "21142 [10-100Mb/s]", + "21143 [10-100Mb/s]", +}; + +static const char *const tulip_mediums[] = { + "unknown", /* TULIP_MEDIA_UNKNOWN */ + "10baseT", /* TULIP_MEDIA_10BASET */ + "Full Duplex 10baseT", /* TULIP_MEDIA_10BASET_FD */ + "BNC", /* TULIP_MEDIA_BNC */ + "AUI", /* TULIP_MEDIA_AUI */ + "External SIA", /* TULIP_MEDIA_EXTSIA */ + "AUI/BNC", /* TULIP_MEDIA_AUIBNC */ + "100baseTX", /* TULIP_MEDIA_100BASET */ + "Full Duplex 100baseTX",/* TULIP_MEDIA_100BASET_FD */ + "100baseT4", /* TULIP_MEDIA_100BASET4 */ + "100baseFX", /* TULIP_MEDIA_100BASEFX */ + "Full Duplex 100baseFX",/* TULIP_MEDIA_100BASEFX_FD */ +}; + +static const int tulip_media_to_ifmedia[] = { + IFM_ETHER | IFM_NONE, /* TULIP_MEDIA_UNKNOWN */ + IFM_ETHER | IFM_10_T, /* TULIP_MEDIA_10BASET */ + IFM_ETHER | IFM_10_T | IFM_FDX, /* TULIP_MEDIA_10BASET_FD */ + IFM_ETHER | IFM_10_2, /* TULIP_MEDIA_BNC */ + IFM_ETHER | IFM_10_5, /* TULIP_MEDIA_AUI */ + IFM_ETHER | IFM_MANUAL, /* TULIP_MEDIA_EXTSIA */ + IFM_ETHER | IFM_10_5, /* TULIP_MEDIA_AUIBNC */ + IFM_ETHER | IFM_100_TX, /* TULIP_MEDIA_100BASET */ + IFM_ETHER | IFM_100_TX | IFM_FDX, /* TULIP_MEDIA_100BASET_FD */ + IFM_ETHER | IFM_100_T4, /* TULIP_MEDIA_100BASET4 */ + IFM_ETHER | IFM_100_FX, /* TULIP_MEDIA_100BASEFX */ + IFM_ETHER | IFM_100_FX | IFM_FDX, /* TULIP_MEDIA_100BASEFX_FD */ +}; + +static const char *const tulip_system_errors[] = { + "parity error", + "master abort", + "target abort", + "reserved #3", + "reserved #4", + "reserved #5", + "reserved #6", + "reserved #7", +}; + +static const char *const tulip_status_bits[] = { + NULL, + "transmit process stopped", + NULL, + "transmit jabber timeout", + + NULL, + "transmit underflow", + NULL, + "receive underflow", + + "receive process stopped", + "receive watchdog timeout", + NULL, + NULL, + + "link failure", + NULL, + NULL, +}; + +static const struct { + tulip_srom_connection_t sc_type; + tulip_media_t sc_media; + u_int32_t sc_attrs; +} tulip_srom_conninfo[] = { + { + TULIP_SROM_CONNTYPE_10BASET, TULIP_MEDIA_10BASET + }, + { + TULIP_SROM_CONNTYPE_BNC, TULIP_MEDIA_BNC + }, + { + TULIP_SROM_CONNTYPE_AUI, TULIP_MEDIA_AUI + }, + { + TULIP_SROM_CONNTYPE_100BASETX, TULIP_MEDIA_100BASETX + }, + { + TULIP_SROM_CONNTYPE_100BASET4, TULIP_MEDIA_100BASET4 + }, + { + TULIP_SROM_CONNTYPE_100BASEFX, TULIP_MEDIA_100BASEFX + }, + { + TULIP_SROM_CONNTYPE_MII_10BASET, TULIP_MEDIA_10BASET, + TULIP_SROM_ATTR_MII + }, + { + TULIP_SROM_CONNTYPE_MII_100BASETX, TULIP_MEDIA_100BASETX, + TULIP_SROM_ATTR_MII + }, + { + TULIP_SROM_CONNTYPE_MII_100BASET4, TULIP_MEDIA_100BASET4, + TULIP_SROM_ATTR_MII + }, + { + TULIP_SROM_CONNTYPE_MII_100BASEFX, TULIP_MEDIA_100BASEFX, + TULIP_SROM_ATTR_MII + }, + { + TULIP_SROM_CONNTYPE_10BASET_NWAY, TULIP_MEDIA_10BASET, + TULIP_SROM_ATTR_NWAY + }, + { + TULIP_SROM_CONNTYPE_10BASET_FD, TULIP_MEDIA_10BASET_FD + }, + { + TULIP_SROM_CONNTYPE_MII_10BASET_FD, TULIP_MEDIA_10BASET_FD, + TULIP_SROM_ATTR_MII + }, + { + TULIP_SROM_CONNTYPE_100BASETX_FD, TULIP_MEDIA_100BASETX_FD + }, + { + TULIP_SROM_CONNTYPE_MII_100BASETX_FD, TULIP_MEDIA_100BASETX_FD, + TULIP_SROM_ATTR_MII + }, + { + TULIP_SROM_CONNTYPE_10BASET_NOLINKPASS, TULIP_MEDIA_10BASET, + TULIP_SROM_ATTR_NOLINKPASS + }, + { + TULIP_SROM_CONNTYPE_AUTOSENSE, TULIP_MEDIA_UNKNOWN, + TULIP_SROM_ATTR_AUTOSENSE + }, + { + TULIP_SROM_CONNTYPE_AUTOSENSE_POWERUP, TULIP_MEDIA_UNKNOWN, + TULIP_SROM_ATTR_AUTOSENSE | TULIP_SROM_ATTR_POWERUP + }, + { + TULIP_SROM_CONNTYPE_AUTOSENSE_NWAY, TULIP_MEDIA_UNKNOWN, + TULIP_SROM_ATTR_AUTOSENSE | TULIP_SROM_ATTR_NWAY + }, + { + TULIP_SROM_CONNTYPE_NOT_USED, TULIP_MEDIA_UNKNOWN + } +}; +#define TULIP_SROM_LASTCONNIDX \ + (sizeof(tulip_srom_conninfo)/sizeof(tulip_srom_conninfo[0]) - 1) + +static const struct { + tulip_media_t sm_type; + tulip_srom_media_t sm_srom_type; +} tulip_srom_mediums[] = { + { + TULIP_MEDIA_100BASEFX_FD, TULIP_SROM_MEDIA_100BASEFX_FD + }, + { + TULIP_MEDIA_100BASEFX, TULIP_SROM_MEDIA_100BASEFX + }, + { + TULIP_MEDIA_100BASET4, TULIP_SROM_MEDIA_100BASET4 + }, + { + TULIP_MEDIA_100BASETX_FD, TULIP_SROM_MEDIA_100BASETX_FD + }, + { + TULIP_MEDIA_100BASETX, TULIP_SROM_MEDIA_100BASETX + }, + { + TULIP_MEDIA_10BASET_FD, TULIP_SROM_MEDIA_10BASET_FD + }, + { + TULIP_MEDIA_AUI, TULIP_SROM_MEDIA_AUI + }, + { + TULIP_MEDIA_BNC, TULIP_SROM_MEDIA_BNC + }, + { + TULIP_MEDIA_10BASET, TULIP_SROM_MEDIA_10BASET + }, + { + TULIP_MEDIA_UNKNOWN + } +}; + +#endif /* TULIP_HDR_DATA */ + +/* + * Macro to encode 16 bits of a MAC address into the setup buffer. Since + * we are casting the two bytes in the char array to a uint16 and then + * handing them to this macro, we don't need to swap the bytes in the big + * endian case, just shift them left 16. + */ +#if BYTE_ORDER == BIG_ENDIAN +#define TULIP_SP_MAC(x) ((x) << 16) +#else +#define TULIP_SP_MAC(x) (x) +#endif + +/* + * This driver supports a maximum of 32 tulip boards. + * This should be enough for the forseeable future. + */ +#define TULIP_MAX_DEVICES 32 + +#define _TULIP_DESC_SYNC(ri, op) \ + bus_dmamap_sync((ri)->ri_ring_tag, (ri)->ri_ring_map, (op)) +#define _TULIP_MAP_SYNC(ri, di, op) \ + bus_dmamap_sync((ri)->ri_data_tag, *(di)->di_map, (op)) + +/* + * Descriptors are both read from and written to by the card (corresponding + * to DMA WRITE and READ operations in bus-dma speak). Receive maps are + * written to by the card (a DMA READ operation in bus-dma) and transmit + * buffers are read from by the card (a DMA WRITE operation in bus-dma). + */ +#define TULIP_RXDESC_PRESYNC(ri) \ + _TULIP_DESC_SYNC(ri, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE) +#define TULIP_RXDESC_POSTSYNC(ri) \ + _TULIP_DESC_SYNC(ri, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE) +#define TULIP_RXMAP_PRESYNC(ri, di) \ + _TULIP_MAP_SYNC(ri, di, BUS_DMASYNC_PREREAD) +#define TULIP_RXMAP_POSTSYNC(ri, di) \ + _TULIP_MAP_SYNC(ri, di, BUS_DMASYNC_POSTREAD) +#define TULIP_TXDESC_PRESYNC(ri) \ + _TULIP_DESC_SYNC(ri, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE) +#define TULIP_TXDESC_POSTSYNC(ri) \ + _TULIP_DESC_SYNC(ri, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE) +#define TULIP_TXMAP_PRESYNC(ri, di) \ + _TULIP_MAP_SYNC(ri, di, BUS_DMASYNC_PREWRITE) +#define TULIP_TXMAP_POSTSYNC(ri, di) \ + _TULIP_MAP_SYNC(ri, di, BUS_DMASYNC_POSTWRITE) + +#ifdef notyet +#define SIOCGADDRROM _IOW('i', 240, struct ifreq) /* get 128 bytes of ROM */ +#define SIOCGCHIPID _IOWR('i', 241, struct ifreq) /* get chipid */ +#endif + +#if defined(TULIP_HDR_DATA) +static tulip_softc_t *tulips[TULIP_MAX_DEVICES]; +#endif + +#define loudprintf if (bootverbose) printf + +#if defined(TULIP_PERFSTATS) +#define TULIP_PERFMERGE(sc, member) \ + do { (sc)->tulip_perfstats[TULIP_PERF_TOTAL].member \ + += (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member; \ + (sc)->tulip_perfstats[TULIP_PERF_PREVIOUS].member \ + = (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member; \ + (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member = 0; } while (0) +#define TULIP_PERFSTART(name) const tulip_cycle_t perfstart_ ## name = TULIP_PERFREAD(); +#define TULIP_PERFEND(name) do { \ + (sc)->tulip_curperfstats.perf_ ## name ## _cycles += TULIP_PERFDIFF(perfstart_ ## name, TULIP_PERFREAD()); \ + (sc)->tulip_curperfstats.perf_ ## name ++; \ + } while (0) + +typedef u_long tulip_cycle_t; + +static __inline tulip_cycle_t +TULIP_PERFREAD(void) +{ + return (get_cyclecount()); +} + +#define TULIP_PERFDIFF(s, f) ((f) - (s)) +#else +#define TULIP_PERFSTART(name) +#define TULIP_PERFEND(name) do { } while (0) +#define TULIP_PERFMERGE(s,n) do { } while (0) +#endif /* TULIP_PERFSTATS */ + +#define TULIP_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- Little + * Endian */ +#define TULIP_MAX_TXSEG 30 +#define TULIP_MAX_FRAGS 2 + +#define TULIP_ADDREQUAL(a1, a2) \ + (((u_int16_t *)a1)[0] == ((u_int16_t *)a2)[0] \ + && ((u_int16_t *)a1)[1] == ((u_int16_t *)a2)[1] \ + && ((u_int16_t *)a1)[2] == ((u_int16_t *)a2)[2]) +#define TULIP_ADDRBRDCST(a1) \ + (((u_int16_t *)a1)[0] == 0xFFFFU \ + && ((u_int16_t *)a1)[1] == 0xFFFFU \ + && ((u_int16_t *)a1)[2] == 0xFFFFU) + +#define TULIP_MUTEX(sc) (&(sc)->tulip_mutex) +#define TULIP_LOCK(sc) mtx_lock(TULIP_MUTEX(sc)) +#define TULIP_UNLOCK(sc) mtx_unlock(TULIP_MUTEX(sc)) +#define TULIP_LOCK_ASSERT(sc) mtx_assert(TULIP_MUTEX(sc), MA_OWNED) + +#endif /* DEV_DE_IF_DEVAR_H */ diff --git a/src/libs/compat/freebsd_network/compat/sys/haiku-module.h b/src/libs/compat/freebsd_network/compat/sys/haiku-module.h index 24dc3295bc..ec2d98fd1a 100644 --- a/src/libs/compat/freebsd_network/compat/sys/haiku-module.h +++ b/src/libs/compat/freebsd_network/compat/sys/haiku-module.h @@ -46,13 +46,14 @@ typedef struct { #define DRIVER_MODULE_NAME(name, busname) \ __fbsd_ ## name ## _ ## busname -status_t _fbsd_init_hardware(driver_t *driver); -status_t _fbsd_init_driver(driver_t *driver); -void _fbsd_uninit_driver(driver_t *driver); +status_t _fbsd_init_hardware(driver_t *driver[]); +status_t _fbsd_init_drivers(driver_t *driver[]); +status_t _fbsd_uninit_drivers(driver_t *driver[]); extern const char *gDriverName; driver_t *__haiku_select_miibus_driver(device_t dev); driver_t *__haiku_probe_miibus(device_t dev, driver_t *drivers[]); +status_t __haiku_handle_fbsd_drivers_list(status_t (*handler)(driver_t *[])); status_t init_wlan_stack(void); void uninit_wlan_stack(void); @@ -62,27 +63,28 @@ status_t wlan_control(void*, uint32, void*, size_t); status_t wlan_close(void*); status_t wlan_if_l2com_alloc(void*); -/* we define the driver methods with HAIKU_FBSD_DRIVER_GLUE to +/* we define the driver methods with HAIKU_FBSD_DRIVERS_GLUE to * force the rest of the stuff to be linked back with the driver. * While gcc 2.95 packs everything from the static library onto * the final binary, gcc 4.x rightfuly doesn't. */ -#define HAIKU_FBSD_DRIVER_GLUE(publicname, name, busname) \ +#define HAIKU_FBSD_DRIVERS_GLUE(publicname) \ extern const char *gDeviceNameList[]; \ extern device_hooks gDeviceHooks; \ - extern driver_t *DRIVER_MODULE_NAME(name, busname); \ const char *gDriverName = #publicname; \ int32 api_version = B_CUR_DRIVER_API_VERSION; \ status_t init_hardware() \ { \ - return _fbsd_init_hardware(DRIVER_MODULE_NAME(name, busname)); \ + return __haiku_handle_fbsd_drivers_list(_fbsd_init_hardware); \ } \ status_t init_driver() \ { \ - return _fbsd_init_driver(DRIVER_MODULE_NAME(name, busname)); \ + return __haiku_handle_fbsd_drivers_list(_fbsd_init_drivers); \ } \ void uninit_driver() \ - { _fbsd_uninit_driver(DRIVER_MODULE_NAME(name, busname)); } \ + { \ + __haiku_handle_fbsd_drivers_list(_fbsd_uninit_drivers); \ + } \ const char **publish_devices() \ { return gDeviceNameList; } \ device_hooks *find_device(const char *name) \ @@ -102,27 +104,50 @@ status_t wlan_if_l2com_alloc(void*); status_t wlan_if_l2com_alloc(void* ifp) \ { return B_OK; } -#define HAIKU_FBSD_WLAN_DRIVER_GLUE(publicname, name, busname) \ +#define HAIKU_FBSD_DRIVER_GLUE(publicname, name, busname) \ + extern driver_t *DRIVER_MODULE_NAME(name, busname); \ + status_t __haiku_handle_fbsd_drivers_list(status_t (*proc)(driver_t *[])) {\ + driver_t *drivers[] = { \ + DRIVER_MODULE_NAME(name, busname), \ + NULL \ + }; \ + return (*proc)(drivers); \ + } \ + HAIKU_FBSD_DRIVERS_GLUE(publicname); + +#define HAIKU_FBSD_WLAN_DRIVERS_GLUE(publicname) \ extern const char *gDeviceNameList[]; \ extern device_hooks gDeviceHooks; \ - extern driver_t *DRIVER_MODULE_NAME(name, busname); \ const char *gDriverName = #publicname; \ int32 api_version = B_CUR_DRIVER_API_VERSION; \ status_t init_hardware() \ { \ - return _fbsd_init_hardware(DRIVER_MODULE_NAME(name, busname)); \ + return __haiku_handle_fbsd_drivers_list(_fbsd_init_hardware); \ } \ status_t init_driver() \ { \ - return _fbsd_init_driver(DRIVER_MODULE_NAME(name, busname)); \ + return __haiku_handle_fbsd_drivers_list(_fbsd_init_drivers); \ } \ void uninit_driver() \ - { _fbsd_uninit_driver(DRIVER_MODULE_NAME(name, busname)); } \ + { \ + __haiku_handle_fbsd_drivers_list(_fbsd_uninit_drivers); \ + } \ const char **publish_devices() \ { return gDeviceNameList; } \ device_hooks *find_device(const char *name) \ { return &gDeviceHooks; } +#define HAIKU_FBSD_WLAN_DRIVER_GLUE(publicname, name, busname) \ + extern driver_t *DRIVER_MODULE_NAME(name, busname); \ + status_t __haiku_handle_fbsd_drivers_list(status_t (*proc)(driver_t *[])) {\ + driver_t *drivers[] = { \ + DRIVER_MODULE_NAME(name, busname), \ + NULL \ + }; \ + return (*proc)(drivers); \ + } \ + HAIKU_FBSD_WLAN_DRIVERS_GLUE(publicname); + #define HAIKU_FBSD_RETURN_MII_DRIVER(drivers) \ driver_t *__haiku_select_miibus_driver(device_t dev) \ { \ diff --git a/src/libs/compat/freebsd_network/driver.c b/src/libs/compat/freebsd_network/driver.c index 57d943e925..dcefef092e 100644 --- a/src/libs/compat/freebsd_network/driver.c +++ b/src/libs/compat/freebsd_network/driver.c @@ -90,48 +90,53 @@ get_pci_info(struct device *device) status_t -_fbsd_init_hardware(driver_t *driver) +_fbsd_init_hardware(driver_t *drivers[]) { status_t status = B_ENTRY_NOT_FOUND; - device_t child, root; - pci_info *info; - int i; + int index; if (get_module(B_PCI_MODULE_NAME, (module_info **)&gPci) < B_OK) return B_ERROR; - if (init_root_device(driver, &root, &child) != B_OK) { - dprintf("%s: creating device failed.\n", gDriverName); - put_module(B_PCI_MODULE_NAME); - return B_ERROR; - } + for (index = 0; status != B_OK && drivers[index]; index++) { + device_t child, root; + pci_info *info; + int i; - TRACE(("%s: init_hardware(%p)\n", gDriverName, driver)); - - if (child->methods.probe == NULL) { - dprintf("%s: driver has no device_probe method.\n", gDriverName); - device_delete_child(NULL, root); - put_module(B_PCI_MODULE_NAME); - return B_ERROR; - } - - info = get_pci_info(root); - - for (i = 0; gPci->get_nth_pci_info(i, info) == B_OK; i++) { - int result; - result = child->methods.probe(child); - if (result >= 0) { - TRACE(("%s, found %s at %d\n", gDriverName, - device_get_desc(child), i)); - status = B_OK; - break; + if (init_root_device(drivers[index], &root, &child) != B_OK) { + dprintf("%s: creating device failed.\n", gDriverName); + put_module(B_PCI_MODULE_NAME); + return B_ERROR; } + + TRACE(("%s: init_hardware(%p)\n", gDriverName, drivers[index])); + + if (child->methods.probe == NULL) { + dprintf("%s: driver has no device_probe method.\n", gDriverName); + device_delete_child(NULL, root); + put_module(B_PCI_MODULE_NAME); + return B_ERROR; + } + + info = get_pci_info(root); + + for (i = 0; gPci->get_nth_pci_info(i, info) == B_OK; i++) { + int result; + result = child->methods.probe(child); + if (result >= 0) { + TRACE(("%s, found %s at %d\n", gDriverName, + device_get_desc(child), i)); + status = B_OK; + break; + } + } + + device_delete_child(NULL, root); } if (status < B_OK) TRACE(("%s: no hardware found.\n", gDriverName)); - device_delete_child(NULL, root); put_module(B_PCI_MODULE_NAME); return status; @@ -139,12 +144,13 @@ _fbsd_init_hardware(driver_t *driver) status_t -_fbsd_init_driver(driver_t *driver) +_fbsd_init_drivers(driver_t *drivers[]) { status_t status; int i = 0; + int index = 0; - dprintf("%s: init_driver(%p)\n", gDriverName, driver); + dprintf("%s: init_driver(%p)\n", gDriverName, drivers[index]); status = get_module(B_PCI_MODULE_NAME, (module_info **)&gPci); if (status < B_OK) @@ -182,12 +188,12 @@ _fbsd_init_driver(driver_t *driver) if (status < B_OK) goto err6; - while (gDeviceCount < MAX_DEVICES) { + while (drivers[index] && gDeviceCount < MAX_DEVICES) { device_t root, device; bool found = false; pci_info *info; - status = init_root_device(driver, &root, &device); + status = init_root_device(drivers[index], &root, &device); if (status < B_OK) break; @@ -206,7 +212,9 @@ _fbsd_init_driver(driver_t *driver) if (!found) { device_delete_child(NULL, root); - break; + i = 0; + if (drivers[++index]) + dprintf("%s: init_driver(%p)\n", gDriverName, drivers[index]); } } @@ -238,12 +246,13 @@ err1: } -void -_fbsd_uninit_driver(driver_t *driver) +status_t +_fbsd_uninit_drivers(driver_t *drivers[]) { int i; - TRACE(("%s: uninit_driver(%p)\n", gDriverName, driver)); + for (i = 0; drivers[i]; i++) + TRACE(("%s: uninit_driver(%p)\n", gDriverName, drivers[i])); for (i = 0; i < gDeviceCount; i++) { device_delete_child(NULL, gDevices[i]->root_device); @@ -260,4 +269,7 @@ _fbsd_uninit_driver(driver_t *driver) put_module(B_PCI_MODULE_NAME); if (gPCIx86 != NULL) put_module(B_PCI_X86_MODULE_NAME); + + return B_OK; } + From dd537d13a84fad412fb5fa68d5744199232423d4 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sun, 21 Aug 2011 13:00:21 +0000 Subject: [PATCH 205/702] Followed Ingo's suggestion: use private get_app_ref(). This reduce code duplication. Thanks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42659 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../gui/teams_window/TeamsListView.cpp | 38 +++++-------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp index 5839d22e8c..9c23dfdc8a 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -203,51 +204,32 @@ TeamRow::TeamRow(team_id team) status_t TeamRow::_SetTo(team_info& info) { - BPath systemPath; team_info teamInfo = fTeamInfo = info; - find_directory(B_BEOS_SYSTEM_DIRECTORY, &systemPath); - // strip any trailing space(s)... for (int len = strlen(teamInfo.args) - 1; len >= 0 && teamInfo.args[len] == ' '; len--) { teamInfo.args[len] = 0; } - + app_info appInfo; status_t status = be_roster->GetRunningAppInfo(teamInfo.team, &appInfo); - - if (status == B_OK || teamInfo.team == B_SYSTEM_TEAM) { + if (status != B_OK) { + // Not an application known to be_roster + if (teamInfo.team == B_SYSTEM_TEAM) { - // Get icon and name from kernel + // Get icon and name from kernel image system_info systemInfo; get_system_info(&systemInfo); - BPath kernelPath(systemPath); + BPath kernelPath; + find_directory(B_BEOS_SYSTEM_DIRECTORY, &kernelPath); kernelPath.Append(systemInfo.kernel_name); get_ref_for_path(kernelPath.Path(), &appInfo.ref); - } - } else { - // Not an application known to be_roster - - // The teamInfo.args string is not safe and could be truncated. - // This could leads to show an intermediate folder icon! - // - // Let's retrieve instead the entry_ref from the first team's image of - // type B_APP_IMAGE - int32 cookie = 0; - image_info imageInfo; - while (get_next_image_info(teamInfo.team, &cookie, &imageInfo) == B_OK) { - if (imageInfo.type == B_APP_IMAGE) { - BPath imagePath(imageInfo.name); - appInfo.ref.device = imageInfo.device; - appInfo.ref.directory = imageInfo.node; - appInfo.ref.set_name(imagePath.Leaf()); - break; - } - } + } else + BPrivate::get_app_ref(teamInfo.team, &appInfo.ref); } BBitmap* icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1), B_RGBA32); From d90bbcc8132ea57e77a4c3a417581ba000f083a1 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sun, 21 Aug 2011 13:34:50 +0000 Subject: [PATCH 206/702] Fixed in ProcessController the same icon issue than in Debugger's running teams window. Also get right of the ugly raster default app icon that was still used and visible in memory & teams/threads submenus. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42660 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/processcontroller/Jamfile | 2 +- src/apps/processcontroller/Utilities.cpp | 33 +++++++++++++++--------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/apps/processcontroller/Jamfile b/src/apps/processcontroller/Jamfile index 02650fe901..a5494703b6 100644 --- a/src/apps/processcontroller/Jamfile +++ b/src/apps/processcontroller/Jamfile @@ -1,7 +1,7 @@ SubDir HAIKU_TOP src apps processcontroller ; UsePrivateSystemHeaders ; -UsePrivateHeaders shared ; +UsePrivateHeaders app shared ; Application ProcessController : AutoIcon.cpp diff --git a/src/apps/processcontroller/Utilities.cpp b/src/apps/processcontroller/Utilities.cpp index 1958488a47..f9652b706e 100644 --- a/src/apps/processcontroller/Utilities.cpp +++ b/src/apps/processcontroller/Utilities.cpp @@ -23,6 +23,9 @@ #include "ProcessController.h" #include "icons.h" +#ifdef __HAIKU__ + #include +#endif #include #include #include @@ -53,9 +56,9 @@ get_team_name_and_icon(info_pack& infoPack, bool icon) app_info info; status_t status = be_roster->GetRunningAppInfo(infoPack.team_info.team, &info); - if (status == B_OK || infoPack.team_info.team == B_SYSTEM_TEAM) { + if (status != B_OK) { if (infoPack.team_info.team == B_SYSTEM_TEAM) { - // Get icon and name from kernel + // Get icon and name from kernel image system_info systemInfo; get_system_info(&systemInfo); @@ -63,15 +66,21 @@ get_team_name_and_icon(info_pack& infoPack, bool icon) kernelPath.Append(systemInfo.kernel_name); get_ref_for_path(kernelPath.Path(), &info.ref); nameFromArgs = true; - } - } else { - BEntry entry(infoPack.team_info.args, true); - status = entry.GetRef(&info.ref); - if (status != B_OK - || strncmp(infoPack.team_info.args, systemPath.Path(), - strlen(systemPath.Path())) != 0) + } else { +#ifdef __HAIKU__ + status = BPrivate::get_app_ref(infoPack.team_info.team, &info.ref); nameFromArgs = true; - tryTrackerIcon = (status == B_OK); +#else + + BEntry entry(infoPack.team_info.args, true); + status = entry.GetRef(&info.ref); + if (status != B_OK + || strncmp(infoPack.team_info.args, systemPath.Path(), + strlen(systemPath.Path())) != 0) + nameFromArgs = true; +#endif + tryTrackerIcon = (status == B_OK); + } } strncpy(infoPack.team_name, nameFromArgs ? infoPack.team_info.args : info.ref.name, @@ -86,8 +95,8 @@ get_team_name_and_icon(info_pack& infoPack, bool icon) if (!tryTrackerIcon || BNodeInfo::GetTrackerIcon(&info.ref, infoPack.team_icon, B_MINI_ICON) != B_OK) { - // TODO: don't hardcode the "app" icon! - infoPack.team_icon->SetBits(k_app_mini, 256, 0, B_CMAP8); + BMimeType genericAppType(B_APP_MIME_TYPE); + status = genericAppType.GetIcon(infoPack.team_icon, B_MINI_ICON); } } else infoPack.team_icon = NULL; From c3688b17e91e7f1851f7c1a3d9734c843c6abbf2 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sun, 21 Aug 2011 14:02:58 +0000 Subject: [PATCH 207/702] Fix gcc 4.5.2 build (unused static function is now an error). No functional change, sorry. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42661 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/devices/dialup/dialup.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/add-ons/kernel/network/devices/dialup/dialup.cpp b/src/add-ons/kernel/network/devices/dialup/dialup.cpp index 146cf0ff0c..80731146a9 100644 --- a/src/add-ons/kernel/network/devices/dialup/dialup.cpp +++ b/src/add-ons/kernel/network/devices/dialup/dialup.cpp @@ -87,6 +87,7 @@ switch_to_command_mode(dialup_device* device) } +#if 0 static status_t switch_to_data_mode(dialup_device* device) { @@ -106,6 +107,7 @@ switch_to_data_mode(dialup_device* device) device->data_mode = true; return B_OK; } +#endif static status_t From cd73cccda79542b02113909d350009fb7d27b333 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 21 Aug 2011 16:00:45 +0000 Subject: [PATCH 208/702] * add a new generic video electronics define, this seems like it could be useful for more then just radeon_hd. * idea from linux drm driver * feedback / flames welcome * can move into radeon_hd private defines if requested git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42662 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/common/video_electronics.h | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 headers/private/graphics/common/video_electronics.h diff --git a/headers/private/graphics/common/video_electronics.h b/headers/private/graphics/common/video_electronics.h new file mode 100644 index 0000000000..c7fe20735f --- /dev/null +++ b/headers/private/graphics/common/video_electronics.h @@ -0,0 +1,72 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ +#ifndef _VIDEO_ELECTRONICS_H +#define _VIDEO_ELECTRONICS_H + + +// Video connector types +#define VIDEO_CONNECTOR_UNKNOWN 0x00 +#define VIDEO_CONNECTOR_VGA 0x01 +#define VIDEO_CONNECTOR_DVII 0x02 +#define VIDEO_CONNECTOR_DVID 0x03 +#define VIDEO_CONNECTOR_DVIA 0x04 +#define VIDEO_CONNECTOR_COMPOSITE 0x05 +#define VIDEO_CONNECTOR_SVIDEO 0x06 +#define VIDEO_CONNECTOR_LVDS 0x07 +#define VIDEO_CONNECTOR_COMPONENT 0x08 +#define VIDEO_CONNECTOR_9DIN 0x09 +#define VIDEO_CONNECTOR_DP 0x0A +#define VIDEO_CONNECTOR_EDP 0x0B +#define VIDEO_CONNECTOR_HDMIA 0x0C +#define VIDEO_CONNECTOR_HDMIB 0x0D +#define VIDEO_CONNECTOR_TV 0x0E + + +const struct video_connectors { + uint32 type; + const char* name; +} kVideoConnector[] = { + {VIDEO_CONNECTOR_UNKNOWN, "Unknown"}, + {VIDEO_CONNECTOR_VGA, "VGA" }, + {VIDEO_CONNECTOR_DVII, "DVI-I"}, + {VIDEO_CONNECTOR_DVID, "DVI-D"}, + {VIDEO_CONNECTOR_DVIA, "DVI-A"}, + {VIDEO_CONNECTOR_COMPOSITE, "Composite"}, + {VIDEO_CONNECTOR_SVIDEO, "S-Video"}, + {VIDEO_CONNECTOR_LVDS, "LVDS"}, + {VIDEO_CONNECTOR_COMPONENT, "Component"}, + {VIDEO_CONNECTOR_9DIN, "DIN"}, + {VIDEO_CONNECTOR_DP, "DisplayPort"}, + {VIDEO_CONNECTOR_EDP, "Embedded DisplayPort"}, + {VIDEO_CONNECTOR_HDMIA, "HDMI A"}, + {VIDEO_CONNECTOR_HDMIB, "HDMI B"}, + {VIDEO_CONNECTOR_TV, "TV"}, +}; + + +// Video encoder types +#define VIDEO_ENCODER_NONE 0x00 +#define VIDEO_ENCODER_DAC 0x01 +#define VIDEO_ENCODER_TMDS 0x02 +#define VIDEO_ENCODER_LVDS 0x03 +#define VIDEO_ENCODER_TVDAC 0x04 + + +const struct video_encoders { + uint32 type; + const char* name; +} kVideoEncoder[] = { + {VIDEO_ENCODER_NONE, "None"}, + {VIDEO_ENCODER_DAC, "DAC"}, + {VIDEO_ENCODER_TMDS, "TMDS"}, + {VIDEO_ENCODER_LVDS, "LVDS"}, + {VIDEO_ENCODER_TVDAC, "TV"}, +}; + + +#endif /* _VIDEO_ELECTRONICS_H */ From 4e7d39f00fb9188cf00fa581fbc9a21fcdc9b34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 21 Aug 2011 16:24:19 +0000 Subject: [PATCH 209/702] * Applied patch by hamish to fix layouting the clock. * This closes #7937, thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42663 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/AnalogClock.cpp | 15 +++++++-------- src/preferences/time/AnalogClock.h | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/preferences/time/AnalogClock.cpp b/src/preferences/time/AnalogClock.cpp index 122da00fef..41620ea2eb 100644 --- a/src/preferences/time/AnalogClock.cpp +++ b/src/preferences/time/AnalogClock.cpp @@ -98,7 +98,7 @@ TAnalogClock::MouseDown(BPoint point) BView::MouseDown(point); return; } - + if (InMinuteHand(point)) { fMinuteDragging = true; fDirty = true; @@ -124,7 +124,7 @@ TAnalogClock::MouseUp(BPoint point) BView::MouseUp(point); return; } - + if (fHourDragging || fMinuteDragging) { int32 hour, minute, second; GetTime(&hour, &minute, &second); @@ -160,7 +160,7 @@ TAnalogClock::MouseMoved(BPoint point, uint32 transit, const BMessage* message) void -TAnalogClock::FrameResized(float, float) +TAnalogClock::DoLayout() { BRect bounds = Bounds(); @@ -168,8 +168,7 @@ TAnalogClock::FrameResized(float, float) // (important when drawing with B_SUBPIXEL_PRECISE) fCenterX = floorf((bounds.left + bounds.right) / 2 + 0.5) + 0.5; fCenterY = floorf((bounds.top + bounds.bottom) / 2 + 0.5) + 0.5; - fRadius = floorf((MIN(bounds.Width(), bounds.Height()) / 2.0)) - 2.5; - fRadius -= 3; + fRadius = floorf((MIN(bounds.Width(), bounds.Height()) / 2.0)) - 5.5; } @@ -202,7 +201,7 @@ TAnalogClock::SetTime(int32 hour, int32 minute, int32 second) // don't set the time if the hands are in a drag action if (fHourDragging || fMinuteDragging || fTimeChangeIsOngoing) return; - + if (fHours == hour && fMinutes == minute && fSeconds == second) return; @@ -254,7 +253,7 @@ TAnalogClock::DrawClock() rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR); SetHighColor(background); FillRect(bounds); - + bounds.Set(fCenterX - fRadius, fCenterY - fRadius, fCenterX + fRadius, fCenterY + fRadius); @@ -459,7 +458,7 @@ TAnalogClock::_DrawHands(float x, float y, float radius, offsetY = (radius * 0.95) * cosf((fSeconds * M_PI) / 30.0); StrokeLine(BPoint(x, y), BPoint(x + offsetX, y - offsetY)); } - + // draw the center knob SetHighColor(knobColor); FillEllipse(BPoint(x, y), radius * 0.06, radius * 0.06); diff --git a/src/preferences/time/AnalogClock.h b/src/preferences/time/AnalogClock.h index 36c2efa17b..841aee92f7 100644 --- a/src/preferences/time/AnalogClock.h +++ b/src/preferences/time/AnalogClock.h @@ -27,8 +27,8 @@ public: virtual void MouseUp(BPoint point); virtual void MouseMoved(BPoint point, uint32 transit, const BMessage* message); - virtual void FrameResized(float, float); - + virtual void DoLayout(); + virtual BSize MaxSize(); virtual BSize MinSize(); virtual BSize PreferredSize(); @@ -60,7 +60,7 @@ private: int32 fMinutes; int32 fSeconds; bool fDirty; - + float fCenterX; float fCenterY; float fRadius; @@ -70,7 +70,7 @@ private: bool fDrawSecondHand; bool fInteractive; - bool fTimeChangeIsOngoing; + bool fTimeChangeIsOngoing; }; From fab63078c94f9c8cbd888bbaa1d08580fc324555 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 21 Aug 2011 16:56:16 +0000 Subject: [PATCH 210/702] No functional changes. Code style violations fixes. Thanks to Axel for pointing out. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42664 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/network/dec21xxx/dev/dc/glue.c | 34 +++++++++++-------- .../drivers/network/dec21xxx/dev/de/glue.c | 3 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/glue.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/glue.c index aaaac1e596..3d749a0859 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/glue.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/glue.c @@ -16,16 +16,26 @@ #include "if_dcreg.h" + +int check_disable_interrupts_dc(device_t dev); +void reenable_interrupts_dc(device_t dev); + +extern int check_disable_interrupts_de(device_t dev); +extern void reenable_interrupts_de(device_t dev); + + HAIKU_FBSD_DRIVERS_GLUE(dec21xxx); HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE | FBSD_SWI_TASKQUEUE); + extern driver_t *DRIVER_MODULE_NAME(dc, pci); extern driver_t *DRIVER_MODULE_NAME(de, pci); -status_t __haiku_handle_fbsd_drivers_list(status_t (*handler)(driver_t *[])) +status_t +__haiku_handle_fbsd_drivers_list(status_t (*handler)(driver_t *[])) { - driver_t *drivers[] = { + driver_t *drivers[] = { DRIVER_MODULE_NAME(dc, pci), DRIVER_MODULE_NAME(de, pci), NULL @@ -33,6 +43,7 @@ status_t __haiku_handle_fbsd_drivers_list(status_t (*handler)(driver_t *[])) return (*handler)(drivers); } + extern driver_t *DRIVER_MODULE_NAME(acphy, miibus); extern driver_t *DRIVER_MODULE_NAME(amphy, miibus); extern driver_t *DRIVER_MODULE_NAME(dcphy, miibus); @@ -55,18 +66,11 @@ __haiku_select_miibus_driver(device_t dev) } -int check_disable_interrupts_dc(device_t dev); -void reenable_interrupts_dc(device_t dev); - -extern int check_disable_interrupts_de(device_t dev); -extern void reenable_interrupts_de(device_t dev); - - int HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) { uint16 name = *(uint16*)dev->device_name; - switch(name) { + switch (name) { case 'cd': return check_disable_interrupts_dc(dev); case 'ed': @@ -84,7 +88,7 @@ void HAIKU_REENABLE_INTERRUPTS(device_t dev) { uint16 name = *(uint16*)dev->device_name; - switch(name) { + switch (name) { case 'cd': reenable_interrupts_dc(dev); break; @@ -98,7 +102,8 @@ HAIKU_REENABLE_INTERRUPTS(device_t dev) } -int check_disable_interrupts_dc(device_t dev) +int +check_disable_interrupts_dc(device_t dev) { struct dc_softc *sc = device_get_softc(dev); uint16_t status; @@ -126,12 +131,13 @@ int check_disable_interrupts_dc(device_t dev) CSR_WRITE_4(sc, DC_IMR, 0); HAIKU_INTR_REGISTER_LEAVE(); - + return 1; } -void reenable_interrupts_dc(device_t dev) +void +reenable_interrupts_dc(device_t dev) { struct dc_softc *sc = device_get_softc(dev); DC_LOCK(sc); diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/glue.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/glue.c index f0584b39c6..505d09da52 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/glue.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/glue.c @@ -51,7 +51,7 @@ check_disable_interrupts_de(device_t dev) TULIP_CSR_WRITE(sc, csr_intr, 0); HAIKU_INTR_REGISTER_LEAVE(); - + return 1; } @@ -64,3 +64,4 @@ reenable_interrupts_de(device_t dev) TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); TULIP_UNLOCK(sc); } + From 7ba0381def2f27dd6cca27f7c391aa32f8c0cb19 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 21 Aug 2011 17:17:13 +0000 Subject: [PATCH 211/702] * add protected accessor for baseline offset to StringItem, as that value is of interest to derived classes git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42665 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/StringItem.h | 3 +++ src/kits/interface/StringItem.cpp | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/headers/os/interface/StringItem.h b/headers/os/interface/StringItem.h index a6708ade83..75d11115a1 100644 --- a/headers/os/interface/StringItem.h +++ b/headers/os/interface/StringItem.h @@ -30,6 +30,9 @@ public: virtual status_t Perform(perform_code code, void* arg); +protected: + float BaselineOffset() const; + private: // FBC padding and forbidden methods virtual void _ReservedStringItem1(); diff --git a/src/kits/interface/StringItem.cpp b/src/kits/interface/StringItem.cpp index d9afb1337d..42e1f0beef 100644 --- a/src/kits/interface/StringItem.cpp +++ b/src/kits/interface/StringItem.cpp @@ -22,7 +22,7 @@ BStringItem::BStringItem(const char* text, uint32 level, bool expanded) : BListItem(level, expanded), fText(NULL), fBaselineOffset(0) -{ +{ SetText(text); } @@ -106,7 +106,7 @@ BStringItem::SetText(const char *text) { free(fText); fText = NULL; - + if (text) fText = strdup(text); } @@ -142,6 +142,13 @@ BStringItem::Perform(perform_code d, void *arg) } +float +BStringItem::BaselineOffset() const +{ + return fBaselineOffset; +} + + void BStringItem::_ReservedStringItem1() {} void BStringItem::_ReservedStringItem2() {} From e267238ff171df146a3386e2ab6fffbe500385e7 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 21 Aug 2011 17:18:31 +0000 Subject: [PATCH 212/702] * add predicate FormattingConventions::AreCountrySpecific() git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42666 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/locale/FormattingConventions.h | 2 ++ src/kits/locale/FormattingConventions.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/headers/os/locale/FormattingConventions.h b/headers/os/locale/FormattingConventions.h index 5c2e196da4..63ab21cbc7 100644 --- a/headers/os/locale/FormattingConventions.h +++ b/headers/os/locale/FormattingConventions.h @@ -70,6 +70,8 @@ public: const char* LanguageCode() const; const char* CountryCode() const; + bool AreCountrySpecific() const; + status_t GetNativeName(BString& name) const; status_t GetName(BString& name, const BLanguage* displayLanguage = NULL diff --git a/src/kits/locale/FormattingConventions.cpp b/src/kits/locale/FormattingConventions.cpp index 1df6952de6..f57e041a54 100644 --- a/src/kits/locale/FormattingConventions.cpp +++ b/src/kits/locale/FormattingConventions.cpp @@ -345,6 +345,13 @@ BFormattingConventions::CountryCode() const } +bool +BFormattingConventions::AreCountrySpecific() const +{ + return CountryCode() != NULL; +} + + status_t BFormattingConventions::GetNativeName(BString& name) const { From ed3270303877d293339908b02647b374418d513e Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 21 Aug 2011 17:24:27 +0000 Subject: [PATCH 213/702] Fix drawing artefacts in Locale prefs (and IMHO improve the look): * separate LanguageListItemWithFlag from LanguageListItem * draw the flag in front of the text instead of at wherever the right bounds happen to be, fixing the drawing artefacts when scrolling * size the flag to match the size of the list item, which looks much better when using a largish default font * use StringItem::BaselineOffset() instead of manually computed (and wrong) offset when drawing the text git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42667 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/locale/LanguageListView.cpp | 125 +++++++++++++------- src/preferences/locale/LanguageListView.h | 31 ++++- src/preferences/locale/LocaleWindow.cpp | 81 +++++++------ 3 files changed, 149 insertions(+), 88 deletions(-) diff --git a/src/preferences/locale/LanguageListView.cpp b/src/preferences/locale/LanguageListView.cpp index 7c50c7e92d..55a11a6578 100644 --- a/src/preferences/locale/LanguageListView.cpp +++ b/src/preferences/locale/LanguageListView.cpp @@ -30,47 +30,40 @@ #define B_TRANSLATE_CONTEXT "LanguageListView" -static const float kFlagWidth = 17.0; +static const float kLeftInset = 4; LanguageListItem::LanguageListItem(const char* text, const char* id, - const char* code, const char* countryCode) + const char* languageCode) : BStringItem(text), fID(id), - fCode(code) + fCode(languageCode) { - fIcon = new(std::nothrow) BBitmap(BRect(0, 0, 15, 15), B_RGBA32); - if (fIcon != NULL && BLocaleRoster::Default()->GetFlagIconForCountry(fIcon, - countryCode) != B_OK) { - delete fIcon; - fIcon = NULL; - } } LanguageListItem::LanguageListItem(const LanguageListItem& other) : BStringItem(other.Text()), - fID(other.ID()), - fCode(other.Code()), - fIcon(NULL) + fID(other.fID), + fCode(other.fCode) { - if (other.fIcon != NULL) - fIcon = new BBitmap(*other.fIcon); -} - - -LanguageListItem::~LanguageListItem() -{ - delete fIcon; } void LanguageListItem::DrawItem(BView* owner, BRect frame, bool complete) { - rgb_color kHighlight = {140, 140, 140, 0}; - rgb_color kBlack = {0, 0, 0, 0}; + DrawItemWithTextOffset(owner, frame, complete, 0); +} + + +void +LanguageListItem::DrawItemWithTextOffset(BView* owner, BRect frame, + bool complete, float textOffset) +{ + static rgb_color kHighlight = {140, 140, 140, 0}; + static rgb_color kBlack = {0, 0, 0, 0}; if (IsSelected() || complete) { rgb_color color; @@ -90,41 +83,81 @@ LanguageListItem::DrawItem(BView* owner, BRect frame, bool complete) owner->SetHighColor(kBlack); else { owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_3_TINT)); - text += " ["; - text += B_TRANSLATE("already chosen"); - text += "]"; + text << " [" << B_TRANSLATE("already chosen") << "]"; } - BFont font = be_plain_font; - font_height finfo; - font.GetHeight(&finfo); - owner->SetFont(&font); - // TODO: the position is unnecessarily complicated, and not correct either - owner->MovePenTo(frame.left + 8, frame.top - + (frame.Height() - (finfo.ascent + finfo.descent + finfo.leading)) / 2 - + (finfo.ascent + finfo.descent) - 1); + owner->MovePenTo(frame.left + kLeftInset + textOffset, + frame.top + BaselineOffset()); owner->DrawString(text.String()); +} - // Draw the icon - frame.left = frame.right - kFlagWidth; - BRect iconFrame(frame); - iconFrame.Set(iconFrame.left, iconFrame.top + 1, iconFrame.left + kFlagWidth - 2, - iconFrame.top + kFlagWidth - 1); - if (fIcon != NULL && fIcon->IsValid()) { - owner->SetDrawingMode(B_OP_OVER); - owner->DrawBitmap(fIcon, iconFrame); - owner->SetDrawingMode(B_OP_COPY); - } +// #pragma mark - + +LanguageListItemWithFlag::LanguageListItemWithFlag(const char* text, + const char* id, const char* languageCode, const char* countryCode) + : + LanguageListItem(text, id, languageCode), + fCountryCode(countryCode), + fIcon(NULL) +{ +} + + +LanguageListItemWithFlag::LanguageListItemWithFlag( + const LanguageListItemWithFlag& other) + : + LanguageListItem(other), + fCountryCode(other.fCountryCode), + fIcon(other.fIcon != NULL ? new BBitmap(*other.fIcon) : NULL) +{ +} + + +LanguageListItemWithFlag::~LanguageListItemWithFlag() +{ + delete fIcon; } void -LanguageListItem::Update(BView* owner, const BFont* font) +LanguageListItemWithFlag::Update(BView* owner, const BFont* font) { - BStringItem::Update(owner, font); - SetWidth(Width() + kFlagWidth); + LanguageListItem::Update(owner, font); + + float iconSize = Height(); + SetWidth(Width() + iconSize + 4); + + if (fCountryCode.IsEmpty()) + return; + + fIcon = new(std::nothrow) BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), + B_RGBA32); + if (fIcon != NULL && BLocaleRoster::Default()->GetFlagIconForCountry(fIcon, + fCountryCode.String()) != B_OK) { + delete fIcon; + fIcon = NULL; + } +} + + +void +LanguageListItemWithFlag::DrawItem(BView* owner, BRect frame, bool complete) +{ + if (fIcon == NULL || !fIcon->IsValid()) { + DrawItemWithTextOffset(owner, frame, complete, 0); + return; + } + + float iconSize = fIcon->Bounds().Width(); + DrawItemWithTextOffset(owner, frame, complete, iconSize + 4); + + BRect iconFrame(frame.left + kLeftInset, frame.top, + frame.left + kLeftInset + iconSize - 1, frame.top + iconSize - 1); + owner->SetDrawingMode(B_OP_OVER); + owner->DrawBitmap(fIcon, iconFrame); + owner->SetDrawingMode(B_OP_COPY); } diff --git a/src/preferences/locale/LanguageListView.h b/src/preferences/locale/LanguageListView.h index 4e78359293..8d0b0d9482 100644 --- a/src/preferences/locale/LanguageListView.h +++ b/src/preferences/locale/LanguageListView.h @@ -20,10 +20,9 @@ class LanguageListItem : public BStringItem { public: LanguageListItem(const char* text, - const char* id, const char* langCode, - const char* countryCode = NULL); - LanguageListItem(const LanguageListItem& other); - virtual ~LanguageListItem(); + const char* id, const char* languageCode); + LanguageListItem( + const LanguageListItem& other); const BString& ID() const { return fID; } const BString& Code() const { return fCode; } @@ -31,11 +30,33 @@ public: virtual void DrawItem(BView* owner, BRect frame, bool complete = false); - virtual void Update(BView* owner, const BFont* font); +protected: + void DrawItemWithTextOffset(BView* owner, + BRect frame, bool complete, + float textOffset); private: BString fID; BString fCode; +}; + + +class LanguageListItemWithFlag : public LanguageListItem { +public: + LanguageListItemWithFlag(const char* text, + const char* id, const char* languageCode, + const char* countryCode = NULL); + LanguageListItemWithFlag( + const LanguageListItemWithFlag& other); + virtual ~LanguageListItemWithFlag(); + + virtual void Update(BView* owner, const BFont* font); + + virtual void DrawItem(BView* owner, BRect frame, + bool complete = false); + +private: + BString fCountryCode; BBitmap* fIcon; }; diff --git a/src/preferences/locale/LocaleWindow.cpp b/src/preferences/locale/LocaleWindow.cpp index be653de4b5..29b3180a6c 100644 --- a/src/preferences/locale/LocaleWindow.cpp +++ b/src/preferences/locale/LocaleWindow.cpp @@ -98,7 +98,7 @@ LocaleWindow::LocaleWindow() if (BLocaleRoster::Default()->GetAvailableLanguages(&availableLanguages) == B_OK) { BString currentID; - LanguageListItem* lastAddedCountryItem = NULL; + LanguageListItem* currentToplevelItem = NULL; for (int i = 0; availableLanguages.FindString("language", i, ¤tID) == B_OK; i++) { @@ -119,20 +119,23 @@ LocaleWindow::LocaleWindow() } } - LanguageListItem* item = new LanguageListItem(name, - currentID.String(), currentLanguage.Code(), - currentLanguage.CountryCode()); - if (currentLanguage.IsCountrySpecific() - && lastAddedCountryItem != NULL - && lastAddedCountryItem->Code() == item->Code()) { - fLanguageListView->AddUnder(item, lastAddedCountryItem); + LanguageListItem* item; + if (currentLanguage.IsCountrySpecific()) { + item = new LanguageListItemWithFlag(name, currentID.String(), + currentLanguage.Code(), currentLanguage.CountryCode()); } else { - // This is a language variant, add it at top-level + item = new LanguageListItem(name, currentID.String(), + currentLanguage.Code()); + } + if (currentLanguage.IsCountrySpecific() + && currentToplevelItem != NULL + && currentToplevelItem->Code() == item->Code()) { + fLanguageListView->AddUnder(item, currentToplevelItem); + } else { + // This is a generic language, add it at top-level fLanguageListView->AddItem(item); - if (!currentLanguage.IsCountrySpecific()) { - item->SetExpanded(false); - lastAddedCountryItem = item; - } + item->SetExpanded(false); + currentToplevelItem = item; } } @@ -181,38 +184,42 @@ LocaleWindow::LocaleWindow() new BMessage(kMsgConventionsSelection)); // get all available formatting conventions (by language) - BFormattingConventions defaultConventions; - BLocale::Default()->GetFormattingConventions(&defaultConventions); - BString conventionID; + BFormattingConventions initialConventions; + BLocale::Default()->GetFormattingConventions(&initialConventions); + BString conventionsID; fInitialConventionsItem = NULL; - LanguageListItem* lastAddedConventionsItem = NULL; + LanguageListItem* currentToplevelItem = NULL; for (int i = 0; - availableLanguages.FindString("language", i, &conventionID) == B_OK; + availableLanguages.FindString("language", i, &conventionsID) == B_OK; i++) { - BFormattingConventions convention(conventionID); - BString conventionName; - convention.GetName(conventionName); + BFormattingConventions conventions(conventionsID); + BString conventionsName; + conventions.GetName(conventionsName); - LanguageListItem* item = new LanguageListItem(conventionName, - conventionID, convention.LanguageCode(), convention.CountryCode()); - if (!strcmp(conventionID, "en_US")) + LanguageListItem* item; + if (conventions.AreCountrySpecific()) { + item = new LanguageListItemWithFlag(conventionsName, conventionsID, + conventions.LanguageCode(), conventions.CountryCode()); + } else { + item = new LanguageListItem(conventionsName, conventionsID, + conventions.LanguageCode()); + } + if (!strcmp(conventionsID, "en_US")) fDefaultConventionsItem = item; - if (conventionID.FindFirst('_') >= 0 - && lastAddedConventionsItem != NULL - && lastAddedConventionsItem->Code() == item->Code()) { - if (!strcmp(conventionID, defaultConventions.ID())) { - fConventionsListView->Expand(lastAddedConventionsItem); + if (conventions.AreCountrySpecific() + && currentToplevelItem != NULL + && currentToplevelItem->Code() == item->Code()) { + if (!strcmp(conventionsID, initialConventions.ID())) { + fConventionsListView->Expand(currentToplevelItem); fInitialConventionsItem = item; } - fConventionsListView->AddUnder(item, lastAddedConventionsItem); + fConventionsListView->AddUnder(item, currentToplevelItem); } else { // This conventions-item isn't country-specific, add it at top-level fConventionsListView->AddItem(item); - if (conventionID.FindFirst('_') < 0) { - item->SetExpanded(false); - lastAddedConventionsItem = item; - } - if (!strcmp(conventionID, defaultConventions.ID())) + item->SetExpanded(false); + currentToplevelItem = item; + if (!strcmp(conventionsID, initialConventions.ID())) fInitialConventionsItem = item; } } @@ -419,7 +426,7 @@ LocaleWindow::MessageReceived(BMessage* message) { MutableLocaleRoster::Default()->SetFilesystemTranslationPreferred( fFilesystemTranslationCheckbox->Value()); - + BAlert* alert = new BAlert(B_TRANSLATE("Locale"), B_TRANSLATE("Deskbar and Tracker need to be restarted for this " "change to take effect. Would you like to restart them now?"), @@ -430,7 +437,7 @@ LocaleWindow::MessageReceived(BMessage* message) NULL, be_app)); break; } - + default: BWindow::MessageReceived(message); break; From 36714769416d7dd2faf57ba2cc90d090b5f6fdde Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 21 Aug 2011 17:30:55 +0000 Subject: [PATCH 214/702] * add video_electronics.c (.c to keep compatibility with older C accelerants) * use functions for decoding video_electronics * thanks for the guidance Axel! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42668 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/common/video_electronics.h | 46 ++++-------- src/add-ons/accelerants/common/Jamfile | 1 + .../accelerants/common/video_electronics.c | 71 +++++++++++++++++++ 3 files changed, 86 insertions(+), 32 deletions(-) create mode 100644 src/add-ons/accelerants/common/video_electronics.c diff --git a/headers/private/graphics/common/video_electronics.h b/headers/private/graphics/common/video_electronics.h index c7fe20735f..c479f39b07 100644 --- a/headers/private/graphics/common/video_electronics.h +++ b/headers/private/graphics/common/video_electronics.h @@ -27,28 +27,6 @@ #define VIDEO_CONNECTOR_TV 0x0E -const struct video_connectors { - uint32 type; - const char* name; -} kVideoConnector[] = { - {VIDEO_CONNECTOR_UNKNOWN, "Unknown"}, - {VIDEO_CONNECTOR_VGA, "VGA" }, - {VIDEO_CONNECTOR_DVII, "DVI-I"}, - {VIDEO_CONNECTOR_DVID, "DVI-D"}, - {VIDEO_CONNECTOR_DVIA, "DVI-A"}, - {VIDEO_CONNECTOR_COMPOSITE, "Composite"}, - {VIDEO_CONNECTOR_SVIDEO, "S-Video"}, - {VIDEO_CONNECTOR_LVDS, "LVDS"}, - {VIDEO_CONNECTOR_COMPONENT, "Component"}, - {VIDEO_CONNECTOR_9DIN, "DIN"}, - {VIDEO_CONNECTOR_DP, "DisplayPort"}, - {VIDEO_CONNECTOR_EDP, "Embedded DisplayPort"}, - {VIDEO_CONNECTOR_HDMIA, "HDMI A"}, - {VIDEO_CONNECTOR_HDMIB, "HDMI B"}, - {VIDEO_CONNECTOR_TV, "TV"}, -}; - - // Video encoder types #define VIDEO_ENCODER_NONE 0x00 #define VIDEO_ENCODER_DAC 0x01 @@ -57,16 +35,20 @@ const struct video_connectors { #define VIDEO_ENCODER_TVDAC 0x04 -const struct video_encoders { - uint32 type; - const char* name; -} kVideoEncoder[] = { - {VIDEO_ENCODER_NONE, "None"}, - {VIDEO_ENCODER_DAC, "DAC"}, - {VIDEO_ENCODER_TMDS, "TMDS"}, - {VIDEO_ENCODER_LVDS, "LVDS"}, - {VIDEO_ENCODER_TVDAC, "TV"}, -}; +// to ensure compatibility with C accelerants +#ifdef __cplusplus +extern "C" { +#endif + + +// mostly for debugging detected monitors +const char* decode_connector_name(uint32 connector); +const char* decode_encoder_name(uint32 encoder); + + +#ifdef __cplusplus +} +#endif #endif /* _VIDEO_ELECTRONICS_H */ diff --git a/src/add-ons/accelerants/common/Jamfile b/src/add-ons/accelerants/common/Jamfile index c8067157e7..7c9de8cf95 100644 --- a/src/add-ons/accelerants/common/Jamfile +++ b/src/add-ons/accelerants/common/Jamfile @@ -9,6 +9,7 @@ UsePrivateHeaders [ FDirName graphics common ] ; StaticLibrary libaccelerantscommon.a : compute_display_timing.cpp create_display_modes.cpp + video_electronics.c ddc.c decode_edid.c dump_edid.c diff --git a/src/add-ons/accelerants/common/video_electronics.c b/src/add-ons/accelerants/common/video_electronics.c new file mode 100644 index 0000000000..03fc884123 --- /dev/null +++ b/src/add-ons/accelerants/common/video_electronics.c @@ -0,0 +1,71 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include +#include + +#include "video_electronics.h" + + +const char* +decode_connector_name(uint32 connector) +{ + switch (connector) { + case VIDEO_CONNECTOR_VGA: + return "VGA"; + case VIDEO_CONNECTOR_DVII: + return "DVI-I (Digital and Analog)"; + case VIDEO_CONNECTOR_DVID: + return "DVI-D (Digital Only)"; + case VIDEO_CONNECTOR_DVIA: + return "DVI-A (Analog Only)"; + case VIDEO_CONNECTOR_COMPOSITE: + return "Composite"; + case VIDEO_CONNECTOR_SVIDEO: + return "S-Video"; + case VIDEO_CONNECTOR_LVDS: + return "LVDS Panel"; + case VIDEO_CONNECTOR_COMPONENT: + return "Component"; + case VIDEO_CONNECTOR_9DIN: + return "9-Pin DIN"; + case VIDEO_CONNECTOR_DP: + return "DisplayPort"; + case VIDEO_CONNECTOR_EDP: + return "Embedded DisplayPort"; + case VIDEO_CONNECTOR_HDMIA: + return "HDMI A"; + case VIDEO_CONNECTOR_HDMIB: + return "HDMI B"; + case VIDEO_CONNECTOR_TV: + return "TV"; + case VIDEO_CONNECTOR_UNKNOWN: + return "Unknown"; + } + return "Connector Undefined"; +} + + +const char* +decode_encoder_name(uint32 encoder) +{ + switch (encoder) { + case VIDEO_ENCODER_NONE: + return "None"; + case VIDEO_ENCODER_DAC: + return "DAC"; + case VIDEO_ENCODER_TMDS: + return "TMDS"; + case VIDEO_ENCODER_LVDS: + return "LVDS"; + case VIDEO_ENCODER_TVDAC: + return "TV DAC"; + } + return "Encoder Undefined"; +} From 583110831e1d82221da825ae1b45a39a833880f0 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 21 Aug 2011 21:10:24 +0000 Subject: [PATCH 215/702] * remove tracing on AtomBIOS parser * fix a few compile issues when tracing is disabled git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42669 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/atombios/atom.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index be056a3a38..9153799efc 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -37,7 +37,7 @@ #undef TRACE -#define TRACE_ATOM +//#define TRACE_ATOM #ifdef TRACE_ATOM # define TRACE(x...) _sPrintf("radeon_hd: " x) #else @@ -518,10 +518,11 @@ atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) int idx = U8((*ptr)++); status_t result = B_OK; - if (idx < ATOM_TABLE_NAMES_CNT) + if (idx < ATOM_TABLE_NAMES_CNT) { TRACE("%s: table: %s (%d)\n", __func__, atom_table_names[idx], idx); - else + } else { TRACE("%s: table: unknown (%d)\n", __func__, idx); + } if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) { result = atom_execute_table_locked(ctx->ctx, @@ -731,8 +732,10 @@ atom_op_or(atom_exec_context *ctx, int *ptr, int arg) static void atom_op_postcard(atom_exec_context *ctx, int *ptr, int arg) { + #ifdef ATOM_TRACE uint8 val = U8((*ptr)++); TRACE("%s: POST card output: 0x%" B_PRIX8 "\n", __func__, val); + #endif } From aee8efc2449441c243e759cd0ca41ee024894481 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 21 Aug 2011 21:21:36 +0000 Subject: [PATCH 216/702] * add gConnector for card connector storage * add detect_connectors to detect card connectors * add infinitely compex detect_connectors_manual (used when detect_connectors fails) * add missing AtomBIOS header git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42670 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 25 + .../accelerants/radeon_hd/accelerant.h | 11 + .../accelerants/radeon_hd/atombios/ObjectID.h | 691 ++++++++++++++++++ .../accelerants/radeon_hd/atombios/atom.h | 1 + src/add-ons/accelerants/radeon_hd/display.cpp | 277 +++++++ src/add-ons/accelerants/radeon_hd/display.h | 49 ++ 6 files changed, 1054 insertions(+) create mode 100644 src/add-ons/accelerants/radeon_hd/atombios/ObjectID.h diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 294365745f..998ca3e424 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -41,6 +41,7 @@ struct accelerant_info *gInfo; display_info *gDisplay[MAX_DISPLAY]; +connector_info *gConnector[ATOM_MAX_SUPPORTED_DEVICE]; class AreaCloner { @@ -110,6 +111,7 @@ init_common(int device, bool isClone) gInfo->mc_info = (gpu_mc_info *)malloc(sizeof(gpu_mc_info)); + // malloc memory for active display information for (uint32 id = 0; id < MAX_DISPLAY; id++) { gDisplay[id] = (display_info *)malloc(sizeof(display_info)); if (gDisplay[id] == NULL) @@ -122,6 +124,16 @@ init_common(int device, bool isClone) memset(gDisplay[id]->regs, 0, sizeof(register_info)); } + // malloc for possible physical card connectors + for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { + gConnector[id] = (connector_info *)malloc(sizeof(connector_info)); + + if (gConnector[id] == NULL) + return B_NO_MEMORY; + memset(gConnector[id], 0, sizeof(connector_info)); + } + + gInfo->is_clone = isClone; gInfo->device = device; @@ -205,6 +217,12 @@ uninit_common(void) free(gDisplay[id]); } } + + for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { + if (gConnector[id] != NULL) { + free(gConnector[id]); + } + } } @@ -228,6 +246,13 @@ radeon_init_accelerant(int device) radeon_init_bios(gInfo->rom); + status = detect_connectors(); + if (status != B_OK) { + // TODO : detect_connectors_manual to get from object table + TRACE("%s: couldn't detect supported connectors!\n", __func__); + return status; + } + status = detect_displays(); //if (status != B_OK) // return status; diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 1ba3fc0fdf..18d1bbdfe0 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -138,6 +138,16 @@ struct pll_info { }; +typedef struct { + bool valid; + uint16 line_mux; + uint16 devices; + uint32 connector_type; + // TODO struct radeon_i2c_bus_rec ddc_bus; + // TODO struct radeon_hpd hpd; +} connector_info; + + typedef struct { bool active; uint32 connection_type; @@ -163,6 +173,7 @@ typedef struct { extern accelerant_info *gInfo; extern atom_context *gAtomContext; extern display_info *gDisplay[MAX_DISPLAY]; +extern connector_info *gConnector[ATOM_MAX_SUPPORTED_DEVICE]; // register access diff --git a/src/add-ons/accelerants/radeon_hd/atombios/ObjectID.h b/src/add-ons/accelerants/radeon_hd/atombios/ObjectID.h new file mode 100644 index 0000000000..c61c3fe9fb --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/atombios/ObjectID.h @@ -0,0 +1,691 @@ +/* +* Copyright 2006-2007 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ +/* based on stg/asic_reg/drivers/inc/asic_reg/ObjectID.h ver 23 */ + +#ifndef _OBJECTID_H +#define _OBJECTID_H + +#if defined(_X86_) +#pragma pack(1) +#endif + +/****************************************************/ +/* Graphics Object Type Definition */ +/****************************************************/ +#define GRAPH_OBJECT_TYPE_NONE 0x0 +#define GRAPH_OBJECT_TYPE_GPU 0x1 +#define GRAPH_OBJECT_TYPE_ENCODER 0x2 +#define GRAPH_OBJECT_TYPE_CONNECTOR 0x3 +#define GRAPH_OBJECT_TYPE_ROUTER 0x4 +/* deleted */ +#define GRAPH_OBJECT_TYPE_DISPLAY_PATH 0x6 +#define GRAPH_OBJECT_TYPE_GENERIC 0x7 + +/****************************************************/ +/* Encoder Object ID Definition */ +/****************************************************/ +#define ENCODER_OBJECT_ID_NONE 0x00 + +/* Radeon Class Display Hardware */ +#define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01 +#define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02 +#define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03 +#define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04 +#define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */ +#define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06 +#define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07 + +/* External Third Party Encoders */ +#define ENCODER_OBJECT_ID_SI170B 0x08 +#define ENCODER_OBJECT_ID_CH7303 0x09 +#define ENCODER_OBJECT_ID_CH7301 0x0A +#define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */ +#define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C +#define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D +#define ENCODER_OBJECT_ID_TITFP513 0x0E +#define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */ +#define ENCODER_OBJECT_ID_VT1623 0x10 +#define ENCODER_OBJECT_ID_HDMI_SI1930 0x11 +#define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12 +#define ENCODER_OBJECT_ID_ALMOND 0x22 +#define ENCODER_OBJECT_ID_TRAVIS 0x23 +#define ENCODER_OBJECT_ID_NUTMEG 0x22 +/* Kaleidoscope (KLDSCP) Class Display Hardware (internal) */ +#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13 +#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14 +#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15 +#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */ +#define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */ +#define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */ +#define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19 +#define ENCODER_OBJECT_ID_VT1625 0x1A +#define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B +#define ENCODER_OBJECT_ID_DP_AN9801 0x1C +#define ENCODER_OBJECT_ID_DP_DP501 0x1D +#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY 0x1E +#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA 0x1F +#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 0x20 +#define ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 0x21 + +#define ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO 0xFF + +/****************************************************/ +/* Connector Object ID Definition */ +/****************************************************/ +#define CONNECTOR_OBJECT_ID_NONE 0x00 +#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01 +#define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02 +#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03 +#define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D 0x04 +#define CONNECTOR_OBJECT_ID_VGA 0x05 +#define CONNECTOR_OBJECT_ID_COMPOSITE 0x06 +#define CONNECTOR_OBJECT_ID_SVIDEO 0x07 +#define CONNECTOR_OBJECT_ID_YPbPr 0x08 +#define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09 +#define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */ +#define CONNECTOR_OBJECT_ID_SCART 0x0B +#define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C +#define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D +#define CONNECTOR_OBJECT_ID_LVDS 0x0E +#define CONNECTOR_OBJECT_ID_7PIN_DIN 0x0F +#define CONNECTOR_OBJECT_ID_PCIE_CONNECTOR 0x10 +#define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11 +#define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12 +#define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13 +#define CONNECTOR_OBJECT_ID_eDP 0x14 +#define CONNECTOR_OBJECT_ID_MXM 0x15 +#define CONNECTOR_OBJECT_ID_LVDS_eDP 0x16 + +/* deleted */ + +/****************************************************/ +/* Router Object ID Definition */ +/****************************************************/ +#define ROUTER_OBJECT_ID_NONE 0x00 +#define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01 + +/****************************************************/ +/* Generic Object ID Definition */ +/****************************************************/ +#define GENERIC_OBJECT_ID_NONE 0x00 +#define GENERIC_OBJECT_ID_GLSYNC 0x01 +#define GENERIC_OBJECT_ID_PX2_NON_DRIVABLE 0x02 +#define GENERIC_OBJECT_ID_MXM_OPM 0x03 +#define GENERIC_OBJECT_ID_STEREO_PIN 0x04 //This object could show up from Misc Object table, it follows ATOM_OBJECT format, and contains one ATOM_OBJECT_GPIO_CNTL_RECORD for the stereo pin + +/****************************************************/ +/* Graphics Object ENUM ID Definition */ +/****************************************************/ +#define GRAPH_OBJECT_ENUM_ID1 0x01 +#define GRAPH_OBJECT_ENUM_ID2 0x02 +#define GRAPH_OBJECT_ENUM_ID3 0x03 +#define GRAPH_OBJECT_ENUM_ID4 0x04 +#define GRAPH_OBJECT_ENUM_ID5 0x05 +#define GRAPH_OBJECT_ENUM_ID6 0x06 +#define GRAPH_OBJECT_ENUM_ID7 0x07 + +/****************************************************/ +/* Graphics Object ID Bit definition */ +/****************************************************/ +#define OBJECT_ID_MASK 0x00FF +#define ENUM_ID_MASK 0x0700 +#define RESERVED1_ID_MASK 0x0800 +#define OBJECT_TYPE_MASK 0x7000 +#define RESERVED2_ID_MASK 0x8000 + +#define OBJECT_ID_SHIFT 0x00 +#define ENUM_ID_SHIFT 0x08 +#define OBJECT_TYPE_SHIFT 0x0C + + +/****************************************************/ +/* Graphics Object family definition */ +/****************************************************/ +#define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) (GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \ + GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT) +/****************************************************/ +/* GPU Object ID definition - Shared with BIOS */ +/****************************************************/ +#define GPU_ENUM_ID1 ( GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT) + +/****************************************************/ +/* Encoder Object ID definition - Shared with BIOS */ +/****************************************************/ +/* +#define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101 +#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102 +#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103 +#define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104 +#define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105 +#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106 +#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107 +#define ENCODER_SIL170B_ENUM_ID1 0x2108 +#define ENCODER_CH7303_ENUM_ID1 0x2109 +#define ENCODER_CH7301_ENUM_ID1 0x210A +#define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B +#define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 0x210C +#define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 0x210D +#define ENCODER_TITFP513_ENUM_ID1 0x210E +#define ENCODER_INTERNAL_LVTM1_ENUM_ID1 0x210F +#define ENCODER_VT1623_ENUM_ID1 0x2110 +#define ENCODER_HDMI_SI1930_ENUM_ID1 0x2111 +#define ENCODER_HDMI_INTERNAL_ENUM_ID1 0x2112 +#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113 +#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114 +#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115 +#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116 +#define ENCODER_SI178_ENUM_ID1 0x2117 +#define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118 +#define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119 +#define ENCODER_VT1625_ENUM_ID1 0x211A +#define ENCODER_HDMI_SI1932_ENUM_ID1 0x211B +#define ENCODER_ENCODER_DP_AN9801_ENUM_ID1 0x211C +#define ENCODER_DP_DP501_ENUM_ID1 0x211D +#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E +*/ +#define ENCODER_INTERNAL_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT) + +#define ENCODER_SIL170B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT) + +#define ENCODER_CH7303_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT) + +#define ENCODER_CH7301_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT) + +#define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) + +#define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) + + +#define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT) + + +#define ENCODER_TITFP513_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_LVTM1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT) + +#define ENCODER_VT1623_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT) + +#define ENCODER_HDMI_SI1930_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT) + +#define ENCODER_HDMI_INTERNAL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) + + +#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) + + +#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) // Shared with CV/TV and CRT + +#define ENCODER_SI178_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT) + +#define ENCODER_MVPU_FPGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_DDI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT) + +#define ENCODER_VT1625_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT) + +#define ENCODER_HDMI_SI1932_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT) + +#define ENCODER_DP_DP501_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT) + +#define ENCODER_DP_AN9801_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) + +#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) + +#define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT) + +#define ENCODER_ALMOND_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_ALMOND << OBJECT_ID_SHIFT) + +#define ENCODER_ALMOND_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_ALMOND << OBJECT_ID_SHIFT) + +#define ENCODER_TRAVIS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_TRAVIS << OBJECT_ID_SHIFT) + +#define ENCODER_TRAVIS_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_TRAVIS << OBJECT_ID_SHIFT) + +#define ENCODER_NUTMEG_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ENCODER_OBJECT_ID_NUTMEG << OBJECT_ID_SHIFT) + +/****************************************************/ +/* Connector Object ID definition - Shared with BIOS */ +/****************************************************/ +/* +#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 0x3101 +#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 0x3102 +#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 0x3103 +#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 0x3104 +#define CONNECTOR_VGA_ENUM_ID1 0x3105 +#define CONNECTOR_COMPOSITE_ENUM_ID1 0x3106 +#define CONNECTOR_SVIDEO_ENUM_ID1 0x3107 +#define CONNECTOR_YPbPr_ENUM_ID1 0x3108 +#define CONNECTOR_D_CONNECTORE_ENUM_ID1 0x3109 +#define CONNECTOR_9PIN_DIN_ENUM_ID1 0x310A +#define CONNECTOR_SCART_ENUM_ID1 0x310B +#define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 0x310C +#define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 0x310D +#define CONNECTOR_LVDS_ENUM_ID1 0x310E +#define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F +#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110 +*/ +#define CONNECTOR_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) + +#define CONNECTOR_LVDS_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) + +#define CONNECTOR_eDP_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT) + +#define CONNECTOR_eDP_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT) + +#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) + +#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) + +#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) + +#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) + +#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) + +#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) + +#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) + +#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) + +#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) + +#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) + +#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) + +#define CONNECTOR_VGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) + +#define CONNECTOR_VGA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) + +#define CONNECTOR_COMPOSITE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) + +#define CONNECTOR_COMPOSITE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) + +#define CONNECTOR_SVIDEO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) + +#define CONNECTOR_SVIDEO_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) + +#define CONNECTOR_YPbPr_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) + +#define CONNECTOR_YPbPr_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) + +#define CONNECTOR_D_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) + +#define CONNECTOR_D_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) + +#define CONNECTOR_9PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) + +#define CONNECTOR_9PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) + +#define CONNECTOR_SCART_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) + +#define CONNECTOR_SCART_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) + +#define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) + +#define CONNECTOR_HDMI_TYPE_A_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) + +#define CONNECTOR_HDMI_TYPE_A_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) + +#define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) + +#define CONNECTOR_HDMI_TYPE_B_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) + +#define CONNECTOR_7PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) + +#define CONNECTOR_7PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) + +#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) + +#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) + +#define CONNECTOR_CROSSFIRE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) + +#define CONNECTOR_CROSSFIRE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) + + +#define CONNECTOR_HARDCODE_DVI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) + +#define CONNECTOR_HARDCODE_DVI_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) + +#define CONNECTOR_DISPLAYPORT_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) + +#define CONNECTOR_DISPLAYPORT_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) + +#define CONNECTOR_DISPLAYPORT_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) + +#define CONNECTOR_DISPLAYPORT_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) + +#define CONNECTOR_DISPLAYPORT_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) + +#define CONNECTOR_DISPLAYPORT_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) + +#define CONNECTOR_MXM_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_A + +#define CONNECTOR_MXM_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_B + +#define CONNECTOR_MXM_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_C + +#define CONNECTOR_MXM_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_D + +#define CONNECTOR_MXM_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_TXxx + +#define CONNECTOR_MXM_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_UXxx + +#define CONNECTOR_MXM_ENUM_ID7 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID7 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DAC + +#define CONNECTOR_LVDS_eDP_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_LVDS_eDP << OBJECT_ID_SHIFT) + +#define CONNECTOR_LVDS_eDP_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + CONNECTOR_OBJECT_ID_LVDS_eDP << OBJECT_ID_SHIFT) + +/****************************************************/ +/* Router Object ID definition - Shared with BIOS */ +/****************************************************/ +#define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT) + +/* deleted */ + +/****************************************************/ +/* Generic Object ID definition - Shared with BIOS */ +/****************************************************/ +#define GENERICOBJECT_GLSYNC_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + GENERIC_OBJECT_ID_GLSYNC << OBJECT_ID_SHIFT) + +#define GENERICOBJECT_PX2_NON_DRIVABLE_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT) + +#define GENERICOBJECT_PX2_NON_DRIVABLE_ID2 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ + GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT) + +#define GENERICOBJECT_MXM_OPM_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + GENERIC_OBJECT_ID_MXM_OPM << OBJECT_ID_SHIFT) + +#define GENERICOBJECT_STEREO_PIN_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ + GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ + GENERIC_OBJECT_ID_STEREO_PIN << OBJECT_ID_SHIFT) + +/****************************************************/ +/* Object Cap definition - Shared with BIOS */ +/****************************************************/ +#define GRAPHICS_OBJECT_CAP_I2C 0x00000001L +#define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L + + +#define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01 +#define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02 +#define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03 + +#if defined(_X86_) +#pragma pack() +#endif + +#endif /*GRAPHICTYPE */ + + + + diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 13a1897b81..a54b084869 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -26,6 +26,7 @@ #include "atombios.h" +#include "ObjectID.h" #include #include diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 616318f5b3..9b8a585115 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -24,6 +24,8 @@ extern "C" void _sPrintf(const char *format, ...); # define TRACE(x...) ; #endif +#define ERROR(x...) _sPrintf("radeon_hd: " x) + /*! Populate regs with device dependant register locations */ status_t @@ -218,6 +220,281 @@ detect_crt_ranges(uint32 crtid) } +union atom_supported_devices { + struct _ATOM_SUPPORTED_DEVICES_INFO info; + struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2; + struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1; +}; + + +status_t +detect_connectors() +{ + int index = GetIndexIntoMasterTable(DATA, SupportedDevicesInfo); + uint8 frev; + uint8 crev; + uint16 size; + uint16 data_offset; + + if (atom_parse_data_header(gAtomContext, index, &size, &frev, &crev, + &data_offset) != B_OK) { + ERROR("%s: unable to parse data header!\n", __func__); + return B_ERROR; + } + + union atom_supported_devices *supported_devices; + supported_devices + = (union atom_supported_devices *) + ((uint16 *)gAtomContext->bios + data_offset); + + uint16 device_support + = B_LENDIAN_TO_HOST_INT16(supported_devices->info.usDeviceSupport); + + int32 i; + for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { + ATOM_CONNECTOR_INFO_I2C ci + = supported_devices->info.asConnInfo[i]; + + gConnector[i]->valid = false; + + if (!(device_support & (1 << i))) + continue; + + if (i == ATOM_DEVICE_CV_INDEX) { + TRACE("%s: skipping component video\n", + __func__); + continue; + } + + gConnector[i]->connector_type + = connector_convert[ci.sucConnectorInfo.sbfAccess.bfConnectorType]; + + if (gConnector[i]->connector_type + == VIDEO_CONNECTOR_UNKNOWN) { + TRACE("%s: skipping unknown connector at %" B_PRId32 + " of 0x%" B_PRIX8"\n", __func__, i, + ci.sucConnectorInfo.sbfAccess.bfConnectorType); + continue; + } + + // uint8 dac = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC; + gConnector[i]->line_mux = ci.sucI2cId.ucAccess; + + // TODO : give tv unique connector ids + // TODO : ddc bus + + // Always set CRT1 and CRT2 as VGA, some cards incorrectly set + // VGA ports as DVI + if (i == ATOM_DEVICE_CRT1_INDEX || i == ATOM_DEVICE_CRT2_INDEX) + gConnector[i]->connector_type = VIDEO_CONNECTOR_VGA; + + gConnector[i]->valid = true; + gConnector[i]->devices = (1 << i); + + // TODO : add the encoder + #if 0 + radeon_add_atom_encoder(dev, + radeon_get_encoder_enum(dev, + (1 << i), + dac), + (1 << i), + 0); + #endif + } + + // TODO : combine shared connectors + + // TODO : add connectors + + for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE_INFO; i++) { + if (gConnector[i]->valid == true) { + TRACE("%s: connector #%" B_PRId32 " is %s\n", __func__, i, + decode_connector_name(gConnector[i]->connector_type)); + } + } + + return B_OK; +} + + +// TODO : this gets connectors from object table +status_t +detect_connectors_manual() +{ + int index = GetIndexIntoMasterTable(DATA, Object_Header); + + uint8 frev; + uint8 crev; + uint16 size; + uint16 data_offset; + + if (atom_parse_data_header(gAtomContext, index, &size, &frev, &crev, + &data_offset) != B_OK) { + ERROR("%s: ERROR: parsing data header failed!\n", __func__); + return B_ERROR; + } + + if (crev < 2) { + ERROR("%s: ERROR: data header version unknown!\n", __func__); + return B_ERROR; + } + + ATOM_CONNECTOR_OBJECT_TABLE *con_obj; + ATOM_ENCODER_OBJECT_TABLE *enc_obj; + ATOM_OBJECT_TABLE *router_obj; + ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj; + ATOM_OBJECT_HEADER *obj_header; + + obj_header = (ATOM_OBJECT_HEADER *) + ((uint16 *)gAtomContext->bios + data_offset); + path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *) + ((uint16 *)gAtomContext->bios + data_offset + + B_LENDIAN_TO_HOST_INT16(obj_header->usDisplayPathTableOffset)); + con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *) + ((uint16 *)gAtomContext->bios + data_offset + + B_LENDIAN_TO_HOST_INT16(obj_header->usConnectorObjectTableOffset)); + enc_obj = (ATOM_ENCODER_OBJECT_TABLE *) + ((uint16 *)gAtomContext->bios + data_offset + + B_LENDIAN_TO_HOST_INT16(obj_header->usEncoderObjectTableOffset)); + router_obj = (ATOM_OBJECT_TABLE *) + ((uint16 *)gAtomContext->bios + data_offset + + B_LENDIAN_TO_HOST_INT16(obj_header->usRouterObjectTableOffset)); + int device_support = B_LENDIAN_TO_HOST_INT16(obj_header->usDeviceSupport); + + int path_size = 0; + int32 i = 0; + + TRACE("%s: found %" B_PRIu8 " potential display paths.\n", __func__, + path_obj->ucNumOfDispPath); + + for (i = 0; i < path_obj->ucNumOfDispPath; i++) { + uint8 *addr = (uint8*)path_obj->asDispPath; + ATOM_DISPLAY_OBJECT_PATH *path; + addr += path_size; + path = (ATOM_DISPLAY_OBJECT_PATH *) addr; + path_size += B_LENDIAN_TO_HOST_INT16(path->usSize); + + int connector_type; + uint16 connector_object_id; + + if (device_support & B_LENDIAN_TO_HOST_INT16(path->usDeviceTag)) { + TRACE("%s: Display Path #%" B_PRId32 "\n", __func__, i); + + uint16 igp_lane_info; + + uint8 con_obj_id + = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) + & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; + //uint8 con_obj_num + // = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) + // & ENUM_ID_MASK) >> ENUM_ID_SHIFT; + //uint8 con_obj_type + // = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) + // & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; + + // TODO : CV support + if (B_LENDIAN_TO_HOST_INT16(path->usDeviceTag) + == ATOM_DEVICE_CV_SUPPORT) { + continue; + } + + if (0) + ERROR("%s: TODO : IGP chip connector detection\n", __func__); + else { + igp_lane_info = 0; + connector_type = manual_connector_convert[con_obj_id]; + connector_object_id = con_obj_id; + } + + if (connector_type == VIDEO_CONNECTOR_UNKNOWN) { + TRACE("%s: Unknown connector, skipping\n", __func__); + continue; + } else { + TRACE("%s: Found connector %s\n", __func__, + decode_connector_name(connector_type)); + } + + // We have to go deeper! -AMD + // (find encoder for connector) + int32 j; + for (j = 0; j < ((B_LENDIAN_TO_HOST_INT16(path->usSize) - 8) / 2); + j++) { + //uint8 grph_obj_id + // = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & + // OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; + //uint8 grph_obj_num + // = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & + // ENUM_ID_MASK) >> ENUM_ID_SHIFT; + uint8 grph_obj_type + = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & + OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; + if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { + int32 k; + TRACE("%s: Found encoder at #%" B_PRIu32 "\n", __func__, j); + for (k = 0; k < enc_obj->ucNumberOfObjects; k++) { + uint16 encoder_obj + = B_LENDIAN_TO_HOST_INT16( + enc_obj->asObjects[k].usObjectID); + if (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) + == encoder_obj) { + ATOM_COMMON_RECORD_HEADER *record + = (ATOM_COMMON_RECORD_HEADER *) + ((uint16 *)gAtomContext->bios + data_offset + + B_LENDIAN_TO_HOST_INT16( + enc_obj->asObjects[k].usRecordOffset)); + ATOM_ENCODER_CAP_RECORD *cap_record; + uint16 caps = 0; + while (record->ucRecordSize > 0 + && record->ucRecordType > 0 + && record->ucRecordType + <= ATOM_MAX_OBJECT_RECORD_NUMBER) { + switch (record->ucRecordType) { + case ATOM_ENCODER_CAP_RECORD_TYPE: + cap_record = (ATOM_ENCODER_CAP_RECORD *) + record; + caps = B_LENDIAN_TO_HOST_INT16( + cap_record->usEncoderCap); + break; + } + record = (ATOM_COMMON_RECORD_HEADER *) + ((char *)record + record->ucRecordSize); + } + TRACE("%s: add encoder\n", __func__); + // TODO : add the encoder - Finally! + //radeon_add_atom_encoder(dev, + // encoder_obj, + // le16_to_cpu + // (path-> + // usDeviceTag), + // caps); + } + } + } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { + ERROR("%s: TODO : Router object?\n", __func__); + } + } + + // TODO : look up gpio for ddc, hpd + + // TODO : aux chan transactions + + // TODO : add connector + TRACE("%s: add connector\n", __func__); + // radeon_add_atom_connector(dev, + // conn_id, + // le16_to_cpu(path-> usDeviceTag), + // connector_type, &ddc_bus, + // igp_lane_info, + // connector_object_id, + // &hpd, + // &router); + } + } + + return B_OK; +} + + status_t detect_displays() { diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 5362d042a8..7952ae8c1e 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -9,8 +9,57 @@ #define RADEON_HD_DISPLAY_H +#include + + +// convert radeon connector to common connector type +const int connector_convert[] = { + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_VGA, + VIDEO_CONNECTOR_DVII, + VIDEO_CONNECTOR_DVID, + VIDEO_CONNECTOR_DVIA, + VIDEO_CONNECTOR_SVIDEO, + VIDEO_CONNECTOR_COMPOSITE, + VIDEO_CONNECTOR_LVDS, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_HDMIA, + VIDEO_CONNECTOR_HDMIB, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_9DIN, + VIDEO_CONNECTOR_DP +}; + +const int manual_connector_convert[] = { + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_DVII, + VIDEO_CONNECTOR_DVII, + VIDEO_CONNECTOR_DVID, + VIDEO_CONNECTOR_DVID, + VIDEO_CONNECTOR_VGA, + VIDEO_CONNECTOR_COMPOSITE, + VIDEO_CONNECTOR_SVIDEO, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_9DIN, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_HDMIA, + VIDEO_CONNECTOR_HDMIB, + VIDEO_CONNECTOR_LVDS, + VIDEO_CONNECTOR_9DIN, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_UNKNOWN, + VIDEO_CONNECTOR_DP, + VIDEO_CONNECTOR_EDP, + VIDEO_CONNECTOR_UNKNOWN +}; + status_t init_registers(register_info* reg, uint8 crtid); status_t detect_crt_ranges(uint32 crtid); +status_t detect_connectors(); status_t detect_displays(); void debug_displays(); From bafd2297650b322ed6ce5cae0ba92ae20d090db4 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 21 Aug 2011 21:28:24 +0000 Subject: [PATCH 217/702] Fix typo that (suprisingly only) broke the gcc4 build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42671 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/ZoneView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index 341ea3876e..5c97318ec0 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -343,7 +343,7 @@ TimeZoneView::_BuildZoneMenu() // just accept timezones from our supported regions, others are // aliases and would just make the list even longer TranslatedRegionMap::iterator regionIter = regionMap.find(region); - if (regionIter == zoneItemMap.end()) + if (regionIter == regionMap.end()) continue; const BString& regionName = regionIter->second; From dd1bc982f2abc95c72f1b82f06e4a84d90801404 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 21 Aug 2011 21:30:24 +0000 Subject: [PATCH 218/702] Follow hint by Marcus and make colors static *const*. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42672 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/locale/LanguageListView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/preferences/locale/LanguageListView.cpp b/src/preferences/locale/LanguageListView.cpp index 55a11a6578..b823e893fe 100644 --- a/src/preferences/locale/LanguageListView.cpp +++ b/src/preferences/locale/LanguageListView.cpp @@ -62,8 +62,8 @@ void LanguageListItem::DrawItemWithTextOffset(BView* owner, BRect frame, bool complete, float textOffset) { - static rgb_color kHighlight = {140, 140, 140, 0}; - static rgb_color kBlack = {0, 0, 0, 0}; + static const rgb_color kHighlight = {140, 140, 140, 0}; + static const rgb_color kBlack = {0, 0, 0, 0}; if (IsSelected() || complete) { rgb_color color; From ec89b9861735027eafcafa825b4f344a67ac562d Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 21 Aug 2011 22:03:36 +0000 Subject: [PATCH 219/702] * remove excess NULL check git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42673 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 998ca3e424..6701d6ba26 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -218,11 +218,8 @@ uninit_common(void) } } - for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { - if (gConnector[id] != NULL) { + for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) free(gConnector[id]); - } - } } From 77b301cb8b0d4beb85e63c9f5b23df46c30a8b0a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 21 Aug 2011 22:04:34 +0000 Subject: [PATCH 220/702] * tab fix, no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42674 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 6701d6ba26..ea58efe9d5 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -219,7 +219,7 @@ uninit_common(void) } for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) - free(gConnector[id]); + free(gConnector[id]); } From 04cd4adb815ec224a658ce19a2b54f4782e7b47b Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Mon, 22 Aug 2011 18:01:59 +0000 Subject: [PATCH 221/702] Updated catkeys from HTA. (Trying to download all languages takes over an hour and many download attempts fail completely. So I left it to the two new catkeys that came through... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42675 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/apps/aboutsystem/de.catkeys | 4 ++-- data/catalogs/apps/aboutsystem/fi.catkeys | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/catalogs/apps/aboutsystem/de.catkeys b/data/catalogs/apps/aboutsystem/de.catkeys index f165327651..ff94452b5c 100644 --- a/data/catalogs/apps/aboutsystem/de.catkeys +++ b/data/catalogs/apps/aboutsystem/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-About 3091539351 +1 german x-vnd.Haiku-About 1133193730 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB gesamt %d MiB used (%d%%) AboutView %d MiB benutzt (%d%%) @@ -72,7 +72,7 @@ The Haiku-Ports team\n AboutView Das Haiku-Ports-Team\n The Haikuware team and their bounty program\n AboutView Das Haikuware-Team und deren Bounty-Programm\n The University of Auckland and Christof Lutteroth\n\n AboutView Die Universität von Auckland und Christof Lutteroth\n\n The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Der von Haiku selbst erstellte Quellcode, besonders der Kernel und alle Teile des Codes, gegen den Anwendungen gelinkt werden können, wird unter den Bedingungen der %MIT Lizenz% veröffentlicht. Einige Systembibliotheken, die Code von Dritten enthalten, stehen unter der LGPL Lizenz. Angaben zum Copyright von externen Quellen sind unten aufgeführt.\n\n -The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Die Urheberrechte am Haiku-Code liegen bei Haiku, Inc., beziehungsweise bei den entsprechenden Autoren, die explizit im Quelltext aufgeführt sind. Haiku™ und das HAIKU Logo® sind (registrierte) Marken von Haiku, Inc.\n\n +The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku® and the HAIKU logo® are registered trademarks of Haiku, Inc.\n\n AboutView Die Urheberrechte am Haiku-Code liegen bei Haiku, Inc., beziehungsweise bei den entsprechenden Autoren, die explizit im Quelltext aufgeführt sind. Haiku® und das HAIKU Logo® sind registrierte Marken von Haiku, Inc.\n\n Time running: AboutView Laufzeit: Translations:\n AboutView Übersetzungen:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (und seinen NewOS-Kernel)\n diff --git a/data/catalogs/apps/aboutsystem/fi.catkeys b/data/catalogs/apps/aboutsystem/fi.catkeys index 2ba50dbc31..f6534d7797 100644 --- a/data/catalogs/apps/aboutsystem/fi.catkeys +++ b/data/catalogs/apps/aboutsystem/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-About 3091539351 +1 finnish x-vnd.Haiku-About 1133193730 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d mebitavua yhteensä %d MiB used (%d%%) AboutView %d mebitavua käytetty (%d%%) @@ -72,7 +72,7 @@ The Haiku-Ports team\n AboutView Haiku-Ports -ryhmä\n The Haikuware team and their bounty program\n AboutView Haikuware-ryhmä ja heidän bounty-ohjelmansa\n The University of Auckland and Christof Lutteroth\n\n AboutView Aucklandin yliopisto ja Christof Lutteroth\n\n The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Haikulle uniikki koodi, erityisesti ydin ja kaikki koodi, johon sovellukset ehkä linkitetään, jaellaan %MIT licence%-lisenssin ehtojen alla. Jotkut järjestelmäkirjastot sisältävät kolmannen osapuolen koodia, joka jaetaan LGPL-lisenssin alla. Löydät kolmannen osapuolen tekijänoikeustiedot alta.\n\nHuomautus: %MIT license% ei ole muuttuja ja se on suomennettava. -The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Tekijänoikeus Haiku-koodiin on Haiku, Inc.-yrityksen tai vastaavien lähdekoodissa nimenomaisesti ilmaistujen tekijöiden omaisuutta. Haiku™ ja Haiku logo® ovat Haiku, Inc. -yrityksen (rekisteröityjä) tavaramerkkejä.\n\n +The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku® and the HAIKU logo® are registered trademarks of Haiku, Inc.\n\n AboutView Tekijänoikeus Haiku-koodiin on Haiku, Inc.-yrityksen tai vastaavien lähdekoodissa nimenomaisesti ilmaistujen tekijöiden omaisuutta. Haiku® ja HAIKU logo® ovat Haiku, Inc.-yrityksen rekisteröityjä tavaramerkkejä.\n\n Time running: AboutView Käynnissäoloaika: Translations:\n AboutView Käännökset:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (ja hänen NewOS-ytimensä)\n From 886b38122bef640a6a51a04e5827d692d9174cdb Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 22 Aug 2011 21:15:34 +0000 Subject: [PATCH 222/702] Fix icu library extraction for ppc (and unite that jam-block with x86) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42676 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalBuildFeatures | 34 ++++++--------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index 32f1b269fd..8692a97bc2 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -61,39 +61,15 @@ HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1-x86-gcc4-2011-08-20.zip ; HAIKU_ICU_PPC_PACKAGE = icu-4.8.1-ppc-2011-08-20.zip ; HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-2011-08-18.zip ; -if $(TARGET_ARCH) = ppc { - local icu_package = $(HAIKU_ICU_PPC_PACKAGE) ; - local zipFile = [ DownloadFile $(icu_package) - : $(baseURL)/$(icu_package) ] ; - - # zip file and output directory - HAIKU_ICU_ZIP_FILE = $(zipFile) ; - HAIKU_ICU_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(icu_package:B) ] ; - - # extract libraries - HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR) - : - libicudata.so.44.1 - libicui18n.so.44.1 - libicuio.so.44.1 - libicule.so.44.1 - libiculx.so.44.1 - libicutu.so.44.1 - libicuuc.so.44.1 - : $(zipFile) - : extracted-icu - ] ; -} else if $(TARGET_ARCH) != x86 { - Echo "ICU not available for $(TARGET_ARCH)" ; -} else { +if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 { local icu_package ; - if $(HAIKU_GCC_VERSION[1]) = 2 { + if $(TARGET_ARCH) = ppc { + icu_package = $(HAIKU_ICU_PPC_PACKAGE) ; + } else if $(HAIKU_GCC_VERSION[1]) = 2 { icu_package = $(HAIKU_ICU_GCC_2_PACKAGE) ; } else { icu_package = $(HAIKU_ICU_GCC_4_PACKAGE) ; } - local zipFile = [ DownloadFile $(icu_package) : $(baseURL)/$(icu_package) ] ; @@ -115,6 +91,8 @@ if $(TARGET_ARCH) = ppc { : $(zipFile) : extracted-icu ] ; +} else { + Echo "ICU not available for $(TARGET_ARCH)" ; } From 77660b03e844ff20dc766a3033f4ee0d776983fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 23 Aug 2011 18:36:57 +0000 Subject: [PATCH 223/702] * threshold higher bit means a full frame. Also use the threshold for micro frames instead of frames. * introduces fNextStartingFrame to keep track of the next frame to use on next submit. * set the IOC bit for the last ITD * computes multiply field of the ITD based on the packed size (1, 2 or 3). * use locking around linking of ITD * free descriptors on errors * on finishing, whenever a non success status is found, set actual length to zero * on finishing, when copying data to the Transfer object, copy starting on packet boundaries (skipping unused bytes). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42679 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/usb/ehci.cpp | 81 ++++++++++++++----- src/add-ons/kernel/busses/usb/ehci.h | 2 + src/add-ons/kernel/busses/usb/ehci_hardware.h | 6 +- 3 files changed, 69 insertions(+), 20 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index 82a6f9a737..b8ad5190e7 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -123,6 +123,7 @@ EHCI::EHCI(pci_info *info, Stack *stack) fCleanupSem(-1), fCleanupThread(-1), fStopThreads(false), + fNextStartingFrame(-1), fFrameBandwidth(NULL), fFirstIsochronousTransfer(NULL), fLastIsochronousTransfer(NULL), @@ -221,6 +222,11 @@ EHCI::EHCI(pci_info *info, Stack *stack) TRACE("structural parameters: 0x%08lx\n", ReadCapReg32(EHCI_HCSPARAMS)); TRACE("capability parameters: 0x%08lx\n", ReadCapReg32(EHCI_HCCPARAMS)); + if (EHCI_HCCPARAMS_FRAME_CACHE(ReadCapReg32(EHCI_HCCPARAMS))) + fThreshold = 2 + 8; + else + fThreshold = 2 + EHCI_HCCPARAMS_IPT(ReadCapReg32(EHCI_HCCPARAMS)); + // read port count from capability register fPortCount = ReadCapReg32(EHCI_HCSPARAMS) & 0x0f; @@ -730,24 +736,26 @@ EHCI::SubmitIsochronous(Transfer *transfer) if (isochronousData->flags & USB_ISO_ASAP || isochronousData->starting_frame_number == NULL) { - uint32 threshold = (ReadCapReg32(EHCI_HCCPARAMS) - >> EHCI_HCCPARAMS_IPT_SHIFT) & EHCI_HCCPARAMS_IPT_MASK; - TRACE("threshold: %ld\n", threshold); + if (fFirstIsochronousTransfer != NULL && fNextStartingFrame != -1) + currentFrame = fNextStartingFrame; + else { + uint32 threshold = fThreshold; + TRACE("threshold: %ld\n", threshold); - // find the first available frame with enough bandwidth. - // This should always be the case, as defining the starting frame - // number in the driver makes no sense for many reason, one of which - // is that frame numbers value are host controller specific, and the - // driver does not know which host controller is running. - currentFrame = (ReadOpReg(EHCI_FRINDEX) / 8) - & (EHCI_FRAMELIST_ENTRIES_COUNT - 1); + // find the first available frame with enough bandwidth. + // This should always be the case, as defining the starting frame + // number in the driver makes no sense for many reason, one of which + // is that frame numbers value are host controller specific, and the + // driver does not know which host controller is running. + currentFrame = ((ReadOpReg(EHCI_FRINDEX) + threshold) / 8) + & (EHCI_FRAMELIST_ENTRIES_COUNT - 1); + } // Make sure that: // 1. We are at least 5ms ahead the controller // 2. We stay in the range 0-127 // 3. There is enough bandwidth in the first entry - currentFrame = (currentFrame + threshold) - & (EHCI_VFRAMELIST_ENTRIES_COUNT - 1); + currentFrame &= EHCI_VFRAMELIST_ENTRIES_COUNT - 1; } else { // Find out if the frame number specified has enough bandwidth, // otherwise find the first next available frame with enough bandwidth @@ -762,6 +770,7 @@ EHCI::SubmitIsochronous(Transfer *transfer) addr_t bufferPhy; if (fStack->AllocateChunk(&bufferLog, (void**)&bufferPhy, dataLength) < B_OK) { TRACE_ERROR("unable to allocate itd buffer\n"); + delete isoRequest; return B_NO_MEMORY; } @@ -791,6 +800,8 @@ EHCI::SubmitIsochronous(Transfer *transfer) itd->buffer_phy[pg + 1] = currentPhy & 0xfffff000; pg++; } + if (dataLength <= 0) + itd->token[i] |= EHCI_ITD_IOC; } currentPhy += (offset & 0xfff) - (currentPhy & 0xfff); @@ -799,12 +810,17 @@ EHCI::SubmitIsochronous(Transfer *transfer) | (pipe->DeviceAddress() << EHCI_ITD_ADDRESS_SHIFT); itd->buffer_phy[1] |= (pipe->MaxPacketSize() & EHCI_ITD_MAXPACKETSIZE_MASK) | (directionIn << EHCI_ITD_DIR_SHIFT); - itd->buffer_phy[2] |= (1 << EHCI_ITD_MUL_SHIFT); + itd->buffer_phy[2] |= + ((((pipe->MaxPacketSize() >> EHCI_ITD_MAXPACKETSIZE_LENGTH) + 1) + & EHCI_ITD_MUL_MASK) << EHCI_ITD_MUL_SHIFT); TRACE("isochronous filled itd buffer_phy[0,1,2] 0x%lx, 0x%lx 0x%lx\n", itd->buffer_phy[0], itd->buffer_phy[1], itd->buffer_phy[2]); + if (!LockIsochronous()) + continue; LinkITDescriptors(itd, &fItdEntries[currentFrame]); + UnlockIsochronous(); fFrameBandwidth[currentFrame] -= bandwidth; currentFrame = (currentFrame + 1) & (EHCI_VFRAMELIST_ENTRIES_COUNT - 1); frameCount++; @@ -818,11 +834,15 @@ EHCI::SubmitIsochronous(Transfer *transfer) transfer->DataLength()); if (result < B_OK) { TRACE_ERROR("failed to add pending isochronous transfer\n"); + for (uint32 i = 0; i < itdIndex; i++) + FreeDescriptor(isoRequest[i]); + delete isoRequest; return result; } TRACE("appended isochronous transfer by starting at frame number %d\n", currentFrame); + fNextStartingFrame = currentFrame + 1; // Wake up the isochronous finisher thread release_sem_etc(fFinishIsochronousTransfersSem, 1 /*frameCount*/, B_DO_NOT_RESCHEDULE); @@ -2146,7 +2166,8 @@ EHCI::FreeDescriptor(ehci_qtd *descriptor) (void *)descriptor->buffer_phy[0], descriptor->buffer_size); } - fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, sizeof(ehci_qtd)); + fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, + sizeof(ehci_qtd)); } @@ -2208,7 +2229,8 @@ EHCI::FreeDescriptor(ehci_itd *descriptor) if (!descriptor) return; - fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, sizeof(ehci_itd)); + fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, + sizeof(ehci_itd)); } @@ -2218,7 +2240,8 @@ EHCI::FreeDescriptor(ehci_sitd *descriptor) if (!descriptor) return; - fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, sizeof(ehci_sitd)); + fStack->FreeChunk(descriptor, (void *)descriptor->this_phy, + sizeof(ehci_sitd)); } @@ -2372,7 +2395,8 @@ EHCI::ReadDescriptorChain(ehci_qtd *topDescriptor, iovec *vector, if (vectorOffset >= vector[vectorIndex].iov_len) { if (++vectorIndex >= vectorCount) { - TRACE("read descriptor chain (%ld bytes, no more vectors)\n", actualLength); + TRACE("read descriptor chain (%ld bytes, no more vectors)" + "\n", actualLength); *nextDataToggle = dataToggle > 0 ? true : false; return actualLength; } @@ -2437,7 +2461,6 @@ EHCI::ReadIsochronousDescriptorChain(isochronous_transfer_data *transfer) { iovec *vector = transfer->transfer->Vector(); size_t vectorCount = transfer->transfer->VectorCount(); - size_t vectorOffset = 0; size_t vectorIndex = 0; usb_isochronous_data *isochronousData @@ -2456,6 +2479,10 @@ EHCI::ReadIsochronousDescriptorChain(isochronous_transfer_data *transfer) size_t bufferSize = (itd->token[j] >> EHCI_ITD_TLENGTH_SHIFT) & EHCI_ITD_TLENGTH_MASK; + if (((itd->token[j] >> EHCI_ITD_STATUS_SHIFT) + & EHCI_ITD_STATUS_MASK) != 0) { + bufferSize = 0; + } isochronousData->packet_descriptors[packet].actual_length = bufferSize; @@ -2467,6 +2494,7 @@ EHCI::ReadIsochronousDescriptorChain(isochronous_transfer_data *transfer) totalLength += bufferSize; size_t offset = bufferOffset; + size_t skipSize = packetSize - bufferSize; while (bufferSize > 0) { size_t length = min_c(bufferSize, vector[vectorIndex].iov_len - vectorOffset); @@ -2487,6 +2515,23 @@ EHCI::ReadIsochronousDescriptorChain(isochronous_transfer_data *transfer) } } + // skip to next packet offset + while (skipSize > 0) { + size_t length = min_c(skipSize, + vector[vectorIndex].iov_len - vectorOffset); + vectorOffset += length; + skipSize -= length; + if (vectorOffset >= vector[vectorIndex].iov_len) { + if (++vectorIndex >= vectorCount) { + TRACE("read isodescriptor chain (%ld bytes, no more " + "vectors)\n", totalLength); + return totalLength; + } + + vectorOffset = 0; + } + } + bufferOffset += packetSize; if (bufferOffset >= transfer->buffer_size) return totalLength; diff --git a/src/add-ons/kernel/busses/usb/ehci.h b/src/add-ons/kernel/busses/usb/ehci.h index ce6184bc39..8692939b74 100644 --- a/src/add-ons/kernel/busses/usb/ehci.h +++ b/src/add-ons/kernel/busses/usb/ehci.h @@ -195,6 +195,7 @@ static pci_module_info * sPCIModule; pci_info * fPCIInfo; Stack * fStack; uint32 fEnabledInterrupts; + uint32 fThreshold; // Periodic transfer framelist and interrupt entries area_id fPeriodicFrameListArea; @@ -218,6 +219,7 @@ static pci_module_info * sPCIModule; sem_id fCleanupSem; thread_id fCleanupThread; bool fStopThreads; + int32 fNextStartingFrame; // fFrameBandwidth[n] holds the available bandwidth // of the nth frame in microseconds diff --git a/src/add-ons/kernel/busses/usb/ehci_hardware.h b/src/add-ons/kernel/busses/usb/ehci_hardware.h index d01b513f94..5344332bf4 100644 --- a/src/add-ons/kernel/busses/usb/ehci_hardware.h +++ b/src/add-ons/kernel/busses/usb/ehci_hardware.h @@ -112,8 +112,8 @@ #define EHCI_HCCPARAMS_PPCEC (1 << 18) // Per-Port Change Event #define EHCI_HCCPARAMS_LPM (1 << 17) // Link Power Management #define EHCI_HCCPARAMS_HP (1 << 16) // Hardware Prefetch -#define EHCI_HCCPARAMS_IPT_SHIFT 4 // Isochronous Periodic Threshold -#define EHCI_HCCPARAMS_IPT_MASK 0xf +#define EHCI_HCCPARAMS_FRAME_CACHE(x) ((x >> 7) & 0x1) // Isochronous Periodic Threshold +#define EHCI_HCCPARAMS_IPT(x) ((x >> 4) & 0x7) // Isochronous Periodic Threshold // Data Structures (EHCI Spec 3) @@ -161,10 +161,12 @@ typedef struct ehci_itd { #define EHCI_ITD_ENDPOINT_MASK 0xf #define EHCI_ITD_DIR_SHIFT 11 #define EHCI_ITD_MUL_SHIFT 0 +#define EHCI_ITD_MUL_MASK 0x3 #define EHCI_ITD_BUFFERPOINTER_SHIFT 12 #define EHCI_ITD_BUFFERPOINTER_MASK 0xfffff #define EHCI_ITD_MAXPACKETSIZE_SHIFT 0 #define EHCI_ITD_MAXPACKETSIZE_MASK 0x7ff +#define EHCI_ITD_MAXPACKETSIZE_LENGTH 11 // Split Transaction Isochronous Transfer Descriptors (siTD, EHCI Spec 3.3) From d1e1709087f986fa437f3db30d0beff372fd6864 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Tue, 23 Aug 2011 18:54:25 +0000 Subject: [PATCH 224/702] * ipro1000 driver updated to FreeBSD 8.2 level: it incorporate now "em" and "lem" freebsd drivers. Note: if_igb is not used - too much "undeclared" stuff required from the compatibility layer. :-( git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42680 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/network/Jamfile | 2 +- .../network/ipro1000/dev/e1000/Jamfile | 5 +- .../network/ipro1000/dev/e1000/LICENSE | 4 +- .../drivers/network/ipro1000/dev/e1000/README | 2 +- .../ipro1000/dev/e1000/e1000_80003es2lan.c | 343 +- .../ipro1000/dev/e1000/e1000_80003es2lan.h | 12 +- .../network/ipro1000/dev/e1000/e1000_82540.c | 55 +- .../network/ipro1000/dev/e1000/e1000_82541.c | 54 +- .../network/ipro1000/dev/e1000/e1000_82541.h | 2 +- .../network/ipro1000/dev/e1000/e1000_82542.c | 41 +- .../network/ipro1000/dev/e1000/e1000_82543.c | 88 +- .../network/ipro1000/dev/e1000/e1000_82543.h | 2 +- .../network/ipro1000/dev/e1000/e1000_82571.c | 788 ++- .../network/ipro1000/dev/e1000/e1000_82571.h | 10 +- .../network/ipro1000/dev/e1000/e1000_82575.c | 1116 ++-- .../network/ipro1000/dev/e1000/e1000_82575.h | 183 +- .../network/ipro1000/dev/e1000/e1000_api.c | 166 +- .../network/ipro1000/dev/e1000/e1000_api.h | 14 +- .../ipro1000/dev/e1000/e1000_defines.h | 270 +- .../network/ipro1000/dev/e1000/e1000_hw.h | 113 +- .../ipro1000/dev/e1000/e1000_ich8lan.c | 2361 +++++-- .../ipro1000/dev/e1000/e1000_ich8lan.h | 130 +- .../network/ipro1000/dev/e1000/e1000_mac.c | 244 +- .../network/ipro1000/dev/e1000/e1000_mac.h | 12 +- .../network/ipro1000/dev/e1000/e1000_manage.c | 72 +- .../network/ipro1000/dev/e1000/e1000_manage.h | 2 +- .../network/ipro1000/dev/e1000/e1000_mbx.c | 762 +++ .../network/ipro1000/dev/e1000/e1000_mbx.h | 106 + .../network/ipro1000/dev/e1000/e1000_nvm.c | 220 +- .../network/ipro1000/dev/e1000/e1000_nvm.h | 8 +- .../network/ipro1000/dev/e1000/e1000_osdep.c | 32 +- .../network/ipro1000/dev/e1000/e1000_osdep.h | 66 +- .../network/ipro1000/dev/e1000/e1000_phy.c | 1318 +++- .../network/ipro1000/dev/e1000/e1000_phy.h | 106 +- .../network/ipro1000/dev/e1000/e1000_regs.h | 72 +- .../network/ipro1000/dev/e1000/e1000_vf.c | 574 ++ .../network/ipro1000/dev/e1000/e1000_vf.h | 291 + .../drivers/network/ipro1000/dev/e1000/glue.c | 19 +- .../network/ipro1000/dev/e1000/if_em.c | 5403 +++++++++-------- .../network/ipro1000/dev/e1000/if_em.h | 316 +- .../network/ipro1000/dev/e1000/if_igb.c | 4189 +++++++------ .../network/ipro1000/dev/e1000/if_igb.h | 270 +- .../network/ipro1000/dev/e1000/if_lem.c | 4649 ++++++++++++++ .../network/ipro1000/dev/e1000/if_lem.h | 492 ++ 44 files changed, 18596 insertions(+), 6388 deletions(-) create mode 100644 src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.c create mode 100644 src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.h create mode 100644 src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.c create mode 100644 src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.h create mode 100644 src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.c create mode 100644 src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.h diff --git a/src/add-ons/kernel/drivers/network/Jamfile b/src/add-ons/kernel/drivers/network/Jamfile index c8a3a1d181..147cdaab6d 100644 --- a/src/add-ons/kernel/drivers/network/Jamfile +++ b/src/add-ons/kernel/drivers/network/Jamfile @@ -1,7 +1,6 @@ SubDir HAIKU_TOP src add-ons kernel drivers network ; SubInclude HAIKU_TOP src add-ons kernel drivers network etherpci ; -SubInclude HAIKU_TOP src add-ons kernel drivers network ipro1000 ; SubInclude HAIKU_TOP src add-ons kernel drivers network pegasus ; SubInclude HAIKU_TOP src add-ons kernel drivers network rtl8169 ; SubInclude HAIKU_TOP src add-ons kernel drivers network sis900 ; @@ -33,6 +32,7 @@ SubIncludeGPL HAIKU_TOP src add-ons kernel drivers network bcm570x ; SubInclude HAIKU_TOP src add-ons kernel drivers network 3com ; SubInclude HAIKU_TOP src add-ons kernel drivers network atheros813x ; SubInclude HAIKU_TOP src add-ons kernel drivers network ipro100 ; +SubInclude HAIKU_TOP src add-ons kernel drivers network ipro1000 ; SubInclude HAIKU_TOP src add-ons kernel drivers network dec21xxx ; SubInclude HAIKU_TOP src add-ons kernel drivers network rtl8139 ; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile index 5d3e9adb24..3f8ea6f32c 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile @@ -21,12 +21,15 @@ KernelAddon ipro1000 : e1000_ich8lan.c e1000_mac.c e1000_manage.c + e1000_mbx.c e1000_nvm.c e1000_osdep.c e1000_phy.c + e1000_vf.c + if_lem.c if_em.c glue.c - : libfreebsd_network.a + : libfreebsd_network.a # ipro1000_led.a ; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/LICENSE b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/LICENSE index b5d02d8563..3417b58c52 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/LICENSE +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/LICENSE @@ -1,6 +1,6 @@ -$FreeBSD: src/sys/dev/e1000/LICENSE,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $ +$FreeBSD: src/sys/dev/e1000/LICENSE,v 1.1.4.2.4.1 2010/12/21 17:09:25 kensmith Exp $ - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/README b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/README index 292e1b570e..6eb6512f55 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/README +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/README @@ -1,4 +1,4 @@ -$FreeBSD: src/sys/dev/e1000/README,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $ +$FreeBSD: src/sys/dev/e1000/README,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $ FreeBSD* Driver for Intel Network Connection ============================================= diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.c index 77483a5751..6cb7a65da5 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.c,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ /* * 80003ES2LAN Gigabit Ethernet Controller (Copper) @@ -43,9 +43,7 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw); static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw); static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw); static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw); -static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw); static void e1000_release_phy_80003es2lan(struct e1000_hw *hw); -static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw); static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw); static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, @@ -173,7 +171,7 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) break; } - nvm->type = e1000_nvm_eeprom_spi; + nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> E1000_EECD_SIZE_EX_SHIFT); @@ -208,17 +206,22 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_init_mac_params_80003es2lan"); - /* Set media type */ + /* Set media type and media-dependent function pointers */ switch (hw->device_id) { case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: hw->phy.media_type = e1000_media_type_internal_serdes; + mac->ops.check_for_link = e1000_check_for_serdes_link_generic; + mac->ops.setup_physical_interface = + e1000_setup_fiber_serdes_link_generic; break; default: hw->phy.media_type = e1000_media_type_copper; + mac->ops.check_for_link = e1000_check_for_copper_link_generic; + mac->ops.setup_physical_interface = + e1000_setup_copper_link_80003es2lan; break; } @@ -228,10 +231,14 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ mac->asf_firmware_present = TRUE; - /* Set if manageability features are enabled. */ + /* FWSM register */ + mac->has_fwsm = TRUE; + /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) ? TRUE : FALSE; + /* Adaptive IFS not supported */ + mac->adaptive_ifs = FALSE; /* Function pointers */ @@ -243,27 +250,6 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) mac->ops.init_hw = e1000_init_hw_80003es2lan; /* link setup */ mac->ops.setup_link = e1000_setup_link_generic; - /* physical interface link setup */ - mac->ops.setup_physical_interface = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_setup_copper_link_80003es2lan - : e1000_setup_fiber_serdes_link_generic; - /* check for link */ - switch (hw->phy.media_type) { - case e1000_media_type_copper: - mac->ops.check_for_link = e1000_check_for_copper_link_generic; - break; - case e1000_media_type_fiber: - mac->ops.check_for_link = e1000_check_for_fiber_link_generic; - break; - case e1000_media_type_internal_serdes: - mac->ops.check_for_link = e1000_check_for_serdes_link_generic; - break; - default: - ret_val = -E1000_ERR_CONFIG; - goto out; - break; - } /* check management mode */ mac->ops.check_mng_mode = e1000_check_mng_mode_generic; /* multicast address update */ @@ -272,10 +258,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) mac->ops.write_vfta = e1000_write_vfta_generic; /* clearing VFTA */ mac->ops.clear_vfta = e1000_clear_vfta_generic; - /* setting MTA */ - mac->ops.mta_set = e1000_mta_set_generic; /* read mac address */ mac->ops.read_mac_addr = e1000_read_mac_addr_80003es2lan; + /* ID LED init */ + mac->ops.id_led_init = e1000_id_led_init_generic; /* blink LED */ mac->ops.blink_led = e1000_blink_led_generic; /* setup LED */ @@ -290,8 +276,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) /* link info */ mac->ops.get_link_up_info = e1000_get_link_up_info_80003es2lan; -out: - return ret_val; + /* set lan id for port to determine which phy lock to use */ + hw->mac.ops.set_lan_id(hw); + + return E1000_SUCCESS; } /** @@ -307,7 +295,6 @@ void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw) hw->mac.ops.init_params = e1000_init_mac_params_80003es2lan; hw->nvm.ops.init_params = e1000_init_nvm_params_80003es2lan; hw->phy.ops.init_params = e1000_init_phy_params_80003es2lan; - e1000_get_bus_info_pcie_generic(hw); } /** @@ -342,7 +329,6 @@ static void e1000_release_phy_80003es2lan(struct e1000_hw *hw) e1000_release_swfw_sync_80003es2lan(hw, mask); } - /** * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register * @hw: pointer to the HW structure @@ -532,28 +518,36 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, goto out; } - /* - * The "ready" bit in the MDIC register may be incorrectly set - * before the device has completed the "Page Select" MDI - * transaction. So we wait 200us after each MDI command... - */ - usec_delay(200); + if (hw->dev_spec._80003es2lan.mdic_wa_enable == TRUE) { + /* + * The "ready" bit in the MDIC register may be incorrectly set + * before the device has completed the "Page Select" MDI + * transaction. So we wait 200us after each MDI command... + */ + usec_delay(200); - /* ...and verify the command was successful. */ - ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp); + /* ...and verify the command was successful. */ + ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp); - if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { - ret_val = -E1000_ERR_PHY; - e1000_release_phy_80003es2lan(hw); - goto out; + if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { + ret_val = -E1000_ERR_PHY; + e1000_release_phy_80003es2lan(hw); + goto out; + } + + usec_delay(200); + + ret_val = e1000_read_phy_reg_mdic(hw, + MAX_PHY_REG_ADDRESS & offset, + data); + + usec_delay(200); + } else { + ret_val = e1000_read_phy_reg_mdic(hw, + MAX_PHY_REG_ADDRESS & offset, + data); } - usec_delay(200); - - ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); - - usec_delay(200); e1000_release_phy_80003es2lan(hw); out: @@ -599,29 +593,36 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, goto out; } + if (hw->dev_spec._80003es2lan.mdic_wa_enable == TRUE) { + /* + * The "ready" bit in the MDIC register may be incorrectly set + * before the device has completed the "Page Select" MDI + * transaction. So we wait 200us after each MDI command... + */ + usec_delay(200); - /* - * The "ready" bit in the MDIC register may be incorrectly set - * before the device has completed the "Page Select" MDI - * transaction. So we wait 200us after each MDI command... - */ - usec_delay(200); + /* ...and verify the command was successful. */ + ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp); - /* ...and verify the command was successful. */ - ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp); + if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { + ret_val = -E1000_ERR_PHY; + e1000_release_phy_80003es2lan(hw); + goto out; + } - if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { - ret_val = -E1000_ERR_PHY; - e1000_release_phy_80003es2lan(hw); - goto out; + usec_delay(200); + + ret_val = e1000_write_phy_reg_mdic(hw, + MAX_PHY_REG_ADDRESS & offset, + data); + + usec_delay(200); + } else { + ret_val = e1000_write_phy_reg_mdic(hw, + MAX_PHY_REG_ADDRESS & offset, + data); } - usec_delay(200); - - ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); - - usec_delay(200); e1000_release_phy_80003es2lan(hw); out: @@ -802,17 +803,16 @@ static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw) index = phy_data & GG82563_DSPD_CABLE_LENGTH; - if (index < GG82563_CABLE_LENGTH_TABLE_SIZE + 5) { - phy->min_cable_length = e1000_gg82563_cable_length_table[index]; - phy->max_cable_length = - e1000_gg82563_cable_length_table[index+5]; - - phy->cable_length = (phy->min_cable_length + - phy->max_cable_length) / 2; - } else { - ret_val = E1000_ERR_PHY; + if (index >= GG82563_CABLE_LENGTH_TABLE_SIZE - 5) { + ret_val = -E1000_ERR_PHY; + goto out; } + phy->min_cable_length = e1000_gg82563_cable_length_table[index]; + phy->max_cable_length = e1000_gg82563_cable_length_table[index + 5]; + + phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; + out: return ret_val; } @@ -892,7 +892,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); icr = E1000_READ_REG(hw, E1000_ICR); - e1000_check_alt_mac_addr_generic(hw); + ret_val = e1000_check_alt_mac_addr_generic(hw); out: return ret_val; @@ -916,11 +916,10 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) e1000_initialize_hw_bits_80003es2lan(hw); /* Initialize identification LED */ - ret_val = e1000_id_led_init_generic(hw); - if (ret_val) { + ret_val = mac->ops.id_led_init(hw); + if (ret_val) DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ - } /* Disabling VLAN filtering */ DEBUGOUT("Initializing the IEEE VLAN\n"); @@ -970,6 +969,19 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) reg_data &= ~0x00100000; E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data); + /* default to TRUE to enable the MDIC W/A */ + hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE; + + ret_val = e1000_read_kmrn_reg_80003es2lan(hw, + E1000_KMRNCTRLSTA_OFFSET >> + E1000_KMRNCTRLSTA_OFFSET_SHIFT, + &i); + if (!ret_val) { + if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) == + E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO) + hw->dev_spec._80003es2lan.mdic_wa_enable = FALSE; + } + /* * Clear all of the statistics registers (clear on read). It is * important that we do this after we have tried to establish link @@ -1036,77 +1048,78 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan"); - if (!phy->reset_disable) { - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - &data); - if (ret_val) - goto out; + if (phy->reset_disable) + goto skip_reset; - data |= GG82563_MSCR_ASSERT_CRS_ON_TX; - /* Use 25MHz for both link down and 1000Base-T for Tx clock. */ - data |= GG82563_MSCR_TX_CLK_1000MBPS_25; + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + &data); + if (ret_val) + goto out; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - data); - if (ret_val) - goto out; + data |= GG82563_MSCR_ASSERT_CRS_ON_TX; + /* Use 25MHz for both link down and 1000Base-T for Tx clock. */ + data |= GG82563_MSCR_TX_CLK_1000MBPS_25; - /* - * Options: - * MDI/MDI-X = 0 (default) - * 0 - Auto for all speeds - * 1 - MDI mode - * 2 - MDI-X mode - * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) - */ - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_SPEC_CTRL, &data); - if (ret_val) - goto out; + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + data); + if (ret_val) + goto out; - data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK; + /* + * Options: + * MDI/MDI-X = 0 (default) + * 0 - Auto for all speeds + * 1 - MDI mode + * 2 - MDI-X mode + * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) + */ + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_SPEC_CTRL, &data); + if (ret_val) + goto out; - switch (phy->mdix) { - case 1: - data |= GG82563_PSCR_CROSSOVER_MODE_MDI; - break; - case 2: - data |= GG82563_PSCR_CROSSOVER_MODE_MDIX; - break; - case 0: - default: - data |= GG82563_PSCR_CROSSOVER_MODE_AUTO; - break; - } - - /* - * Options: - * disable_polarity_correction = 0 (default) - * Automatic Correction for Reversed Cable Polarity - * 0 - Disabled - * 1 - Enabled - */ - data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE; - if (phy->disable_polarity_correction) - data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE; - - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_SPEC_CTRL, data); - if (ret_val) - goto out; - - /* SW Reset the PHY so all changes take effect */ - ret_val = hw->phy.ops.commit(hw); - if (ret_val) { - DEBUGOUT("Error Resetting the PHY\n"); - goto out; - } + data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK; + switch (phy->mdix) { + case 1: + data |= GG82563_PSCR_CROSSOVER_MODE_MDI; + break; + case 2: + data |= GG82563_PSCR_CROSSOVER_MODE_MDIX; + break; + case 0: + default: + data |= GG82563_PSCR_CROSSOVER_MODE_AUTO; + break; } + /* + * Options: + * disable_polarity_correction = 0 (default) + * Automatic Correction for Reversed Cable Polarity + * 0 - Disabled + * 1 - Enabled + */ + data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE; + if (phy->disable_polarity_correction) + data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE; + + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_SPEC_CTRL, data); + if (ret_val) + goto out; + + /* SW Reset the PHY so all changes take effect */ + ret_val = hw->phy.ops.commit(hw); + if (ret_val) { + DEBUGOUT("Error Resetting the PHY\n"); + goto out; + } + +skip_reset: /* Bypass Rx and Tx FIFO's */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, - E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS | - E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS); + E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, + E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS | + E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS); if (ret_val) goto out; @@ -1147,22 +1160,19 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) if (!(hw->mac.ops.check_mng_mode(hw))) { /* Enable Electrical Idle on the PHY */ data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; - ret_val = hw->phy.ops.write_reg(hw, - GG82563_PHY_PWR_MGMT_CTRL, + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, data); if (ret_val) goto out; - ret_val = hw->phy.ops.read_reg(hw, - GG82563_PHY_KMRN_MODE_CTRL, - &data); - if (ret_val) - goto out; + + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + &data); + if (ret_val) + goto out; data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, - GG82563_PHY_KMRN_MODE_CTRL, + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, data); - if (ret_val) goto out; } @@ -1261,7 +1271,6 @@ static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw) DEBUGFUNC("e1000_configure_on_link_up"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, &speed, &duplex); @@ -1308,7 +1317,6 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) tipg |= DEFAULT_TIPG_IPGT_10_100_80003ES2LAN; E1000_WRITE_REG(hw, E1000_TIPG, tipg); - do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); @@ -1362,7 +1370,6 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) tipg |= DEFAULT_TIPG_IPGT_1000_80003ES2LAN; E1000_WRITE_REG(hw, E1000_TIPG, tipg); - do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); @@ -1393,7 +1400,8 @@ out: * using the kumeran interface. The information retrieved is stored in data. * Release the semaphore before exiting. **/ -s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 *data) +static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, + u16 *data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1429,7 +1437,8 @@ out: * at the offset using the kumeran interface. Release semaphore * before exiting. **/ -s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 data) +static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, + u16 data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1461,9 +1470,19 @@ static s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw) s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_read_mac_addr_80003es2lan"); - if (e1000_check_alt_mac_addr_generic(hw)) - ret_val = e1000_read_mac_addr_generic(hw); + /* + * If there's an alternate MAC address place it in RAR0 + * so that it will override the Si installed default perm + * address. + */ + ret_val = e1000_check_alt_mac_addr_generic(hw); + if (ret_val) + goto out; + + ret_val = e1000_read_mac_addr_generic(hw); + +out: return ret_val; } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.h index 6b77418688..cf6aff238b 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.h @@ -1,6 +1,6 @@ -/******************************************************************************* +/****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2009, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,9 +29,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.h,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $*/ - +******************************************************************************/ +/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.h,v 1.1.4.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_80003ES2LAN_H_ #define _E1000_80003ES2LAN_H_ @@ -49,6 +48,9 @@ #define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 #define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 +#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C +#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 + #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */ #define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82540.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82540.c index 6736755c80..8fbdbb160e 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82540.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82540.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82540.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82540.c,v 1.4.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ /* * 82540EM Gigabit Ethernet Controller @@ -57,6 +57,7 @@ static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw); static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw); static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw); static void e1000_power_down_phy_copper_82540(struct e1000_hw *hw); +static s32 e1000_read_mac_addr_82540(struct e1000_hw *hw); /** * e1000_init_phy_params_82540 - Init PHY func ptrs. @@ -227,8 +228,10 @@ static s32 e1000_init_mac_params_82540(struct e1000_hw *hw) mac->ops.write_vfta = e1000_write_vfta_generic; /* clearing VFTA */ mac->ops.clear_vfta = e1000_clear_vfta_generic; - /* setting MTA */ - mac->ops.mta_set = e1000_mta_set_generic; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_82540; + /* ID LED init */ + mac->ops.id_led_init = e1000_id_led_init_generic; /* setup LED */ mac->ops.setup_led = e1000_setup_led_generic; /* cleanup LED */ @@ -332,7 +335,7 @@ static s32 e1000_init_hw_82540(struct e1000_hw *hw) DEBUGFUNC("e1000_init_hw_82540"); /* Initialize identification LED */ - ret_val = e1000_id_led_init_generic(hw); + ret_val = mac->ops.id_led_init(hw); if (ret_val) { DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ @@ -674,3 +677,45 @@ static void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_MGTPTC); } +/** + * e1000_read_mac_addr_82540 - Read device MAC address + * @hw: pointer to the HW structure + * + * Reads the device MAC address from the EEPROM and stores the value. + * Since devices with two ports use the same EEPROM, we increment the + * last bit in the MAC address for the second port. + * + * This version is being used over generic because of customer issues + * with VmWare and Virtual Box when using generic. It seems in + * the emulated 82545, RAR[0] does NOT have a valid address after a + * reset, this older method works and using this breaks nothing for + * these legacy adapters. + **/ +s32 e1000_read_mac_addr_82540(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 offset, nvm_data, i; + + DEBUGFUNC("e1000_read_mac_addr"); + + for (i = 0; i < ETH_ADDR_LEN; i += 2) { + offset = i >> 1; + ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); + hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); + } + + /* Flip last bit of mac address if we're on second port */ + if (hw->bus.func == E1000_FUNC_1) + hw->mac.perm_addr[5] ^= 1; + + for (i = 0; i < ETH_ADDR_LEN; i++) + hw->mac.addr[i] = hw->mac.perm_addr[i]; + +out: + return ret_val; +} diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.c index 8be67d4e70..c9156c601c 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82541.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82541.c,v 1.4.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ /* * 82541EI Gigabit Ethernet Controller @@ -59,6 +59,7 @@ static s32 e1000_set_d3_lplu_state_82541(struct e1000_hw *hw, static s32 e1000_setup_led_82541(struct e1000_hw *hw); static s32 e1000_cleanup_led_82541(struct e1000_hw *hw); static void e1000_clear_hw_cntrs_82541(struct e1000_hw *hw); +static s32 e1000_read_mac_addr_82541(struct e1000_hw *hw); static s32 e1000_config_dsp_after_link_change_82541(struct e1000_hw *hw, bool link_up); static s32 e1000_phy_init_script_82541(struct e1000_hw *hw); @@ -259,8 +260,10 @@ static s32 e1000_init_mac_params_82541(struct e1000_hw *hw) mac->ops.write_vfta = e1000_write_vfta_generic; /* clearing VFTA */ mac->ops.clear_vfta = e1000_clear_vfta_generic; - /* setting MTA */ - mac->ops.mta_set = e1000_mta_set_generic; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_82541; + /* ID LED init */ + mac->ops.id_led_init = e1000_id_led_init_generic; /* setup LED */ mac->ops.setup_led = e1000_setup_led_82541; /* cleanup LED */ @@ -375,17 +378,25 @@ static s32 e1000_reset_hw_82541(struct e1000_hw *hw) static s32 e1000_init_hw_82541(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; + struct e1000_dev_spec_82541 *dev_spec = &hw->dev_spec._82541; u32 i, txdctl; s32 ret_val; DEBUGFUNC("e1000_init_hw_82541"); /* Initialize identification LED */ - ret_val = e1000_id_led_init_generic(hw); + ret_val = mac->ops.id_led_init(hw); if (ret_val) { DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ } + + /* Storing the Speed Power Down value for later use */ + ret_val = hw->phy.ops.read_reg(hw, + IGP01E1000_GMII_FIFO, + &dev_spec->spd_default); + if (ret_val) + goto out; /* Disabling VLAN filtering */ DEBUGOUT("Initializing the IEEE VLAN\n"); @@ -423,6 +434,7 @@ static s32 e1000_init_hw_82541(struct e1000_hw *hw) */ e1000_clear_hw_cntrs_82541(hw); +out: return ret_val; } @@ -1281,3 +1293,35 @@ static void e1000_clear_hw_cntrs_82541(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_MGTPDC); E1000_READ_REG(hw, E1000_MGTPTC); } + +/** + * e1000_read_mac_addr_82541 - Read device MAC address + * @hw: pointer to the HW structure + * + * Reads the device MAC address from the EEPROM and stores the value. + **/ +static s32 e1000_read_mac_addr_82541(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 offset, nvm_data, i; + + DEBUGFUNC("e1000_read_mac_addr"); + + for (i = 0; i < ETH_ADDR_LEN; i += 2) { + offset = i >> 1; + ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); + hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); + } + + for (i = 0; i < ETH_ADDR_LEN; i++) + hw->mac.addr[i] = hw->mac.perm_addr[i]; + +out: + return ret_val; +} + diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.h index 71e82d8ecb..477707e515 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82541.h,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82541.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_82541_H_ #define _E1000_82541_H_ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82542.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82542.c index 6d835ddd30..30640a8568 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82542.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82542.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82542.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82542.c,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ /* * 82542 Gigabit Ethernet Controller @@ -49,6 +49,8 @@ static s32 e1000_led_on_82542(struct e1000_hw *hw); static s32 e1000_led_off_82542(struct e1000_hw *hw); static void e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index); static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw); +static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw); + /** * e1000_init_phy_params_82542 - Init PHY func ptrs. @@ -132,8 +134,8 @@ static s32 e1000_init_mac_params_82542(struct e1000_hw *hw) mac->ops.write_vfta = e1000_write_vfta_generic; /* clearing VFTA */ mac->ops.clear_vfta = e1000_clear_vfta_generic; - /* setting MTA */ - mac->ops.mta_set = e1000_mta_set_generic; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_82542; /* set RAR */ mac->ops.rar_set = e1000_rar_set_82542; /* turn on/off LED */ @@ -554,3 +556,34 @@ static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_PTC1023); E1000_READ_REG(hw, E1000_PTC1522); } + +/** + * e1000_read_mac_addr_82542 - Read device MAC address + * @hw: pointer to the HW structure + * + * Reads the device MAC address from the EEPROM and stores the value. + **/ +static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 offset, nvm_data, i; + + DEBUGFUNC("e1000_read_mac_addr"); + + for (i = 0; i < ETH_ADDR_LEN; i += 2) { + offset = i >> 1; + ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); + hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); + } + + for (i = 0; i < ETH_ADDR_LEN; i++) + hw->mac.addr[i] = hw->mac.perm_addr[i]; + +out: + return ret_val; +} diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.c index 4bb8fdb4f8..e1fd600a8a 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82543.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82543.c,v 1.2.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ /* * 82543GC Gigabit Ethernet Controller (Fiber) @@ -63,7 +63,6 @@ static s32 e1000_led_on_82543(struct e1000_hw *hw); static s32 e1000_led_off_82543(struct e1000_hw *hw); static void e1000_write_vfta_82543(struct e1000_hw *hw, u32 offset, u32 value); -static void e1000_mta_set_82543(struct e1000_hw *hw, u32 hash_value); static void e1000_clear_hw_cntrs_82543(struct e1000_hw *hw); static s32 e1000_config_mac_to_phy_82543(struct e1000_hw *hw); static bool e1000_init_phy_disabled_82543(struct e1000_hw *hw); @@ -75,6 +74,8 @@ static void e1000_shift_out_mdi_bits_82543(struct e1000_hw *hw, u32 data, u16 count); static bool e1000_tbi_compatibility_enabled_82543(struct e1000_hw *hw); static void e1000_set_tbi_sbp_82543(struct e1000_hw *hw, bool state); +static s32 e1000_read_mac_addr_82543(struct e1000_hw *hw); + /** * e1000_init_phy_params_82543 - Init PHY func ptrs. @@ -244,8 +245,8 @@ static s32 e1000_init_mac_params_82543(struct e1000_hw *hw) mac->ops.write_vfta = e1000_write_vfta_82543; /* clearing VFTA */ mac->ops.clear_vfta = e1000_clear_vfta_generic; - /* setting MTA */ - mac->ops.mta_set = e1000_mta_set_82543; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_82543; /* turn on/off LED */ mac->ops.led_on = e1000_led_on_82543; mac->ops.led_off = e1000_led_off_82543; @@ -1476,45 +1477,6 @@ static void e1000_write_vfta_82543(struct e1000_hw *hw, u32 offset, u32 value) } } -/** - * e1000_mta_set_82543 - Set multicast filter table address - * @hw: pointer to the HW structure - * @hash_value: determines the MTA register and bit to set - * - * The multicast table address is a register array of 32-bit registers. - * The hash_value is used to determine what register the bit is in, the - * current value is read, the new bit is OR'd in and the new value is - * written back into the register. - **/ -static void e1000_mta_set_82543(struct e1000_hw *hw, u32 hash_value) -{ - u32 hash_bit, hash_reg, mta, temp; - - DEBUGFUNC("e1000_mta_set_82543"); - - hash_reg = (hash_value >> 5); - - /* - * If we are on an 82544 and we are trying to write an odd offset - * in the MTA, save off the previous entry before writing and - * restore the old value after writing. - */ - if ((hw->mac.type == e1000_82544) && (hash_reg & 1)) { - hash_reg &= (hw->mac.mta_reg_count - 1); - hash_bit = hash_value & 0x1F; - mta = E1000_READ_REG_ARRAY(hw, E1000_MTA, hash_reg); - mta |= (1 << hash_bit); - temp = E1000_READ_REG_ARRAY(hw, E1000_MTA, hash_reg - 1); - - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, hash_reg, mta); - E1000_WRITE_FLUSH(hw); - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, hash_reg - 1, temp); - E1000_WRITE_FLUSH(hw); - } else { - e1000_mta_set_generic(hw, hash_value); - } -} - /** * e1000_led_on_82543 - Turn on SW controllable LED * @hw: pointer to the HW structure @@ -1600,3 +1562,41 @@ static void e1000_clear_hw_cntrs_82543(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_TSCTC); E1000_READ_REG(hw, E1000_TSCTFC); } + +/** + * e1000_read_mac_addr_82543 - Read device MAC address + * @hw: pointer to the HW structure + * + * Reads the device MAC address from the EEPROM and stores the value. + * Since devices with two ports use the same EEPROM, we increment the + * last bit in the MAC address for the second port. + * + **/ +s32 e1000_read_mac_addr_82543(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 offset, nvm_data, i; + + DEBUGFUNC("e1000_read_mac_addr"); + + for (i = 0; i < ETH_ADDR_LEN; i += 2) { + offset = i >> 1; + ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); + hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); + } + + /* Flip last bit of mac address if we're on second port */ + if (hw->bus.func == E1000_FUNC_1) + hw->mac.perm_addr[5] ^= 1; + + for (i = 0; i < ETH_ADDR_LEN; i++) + hw->mac.addr[i] = hw->mac.perm_addr[i]; + +out: + return ret_val; +} diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.h index 634531fdbd..5388c8beaa 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82543.h,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82543.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_82543_H_ #define _E1000_82543_H_ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.c index d1991963ad..ae6beb1b6c 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82571.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82571.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ /* * 82571EB Gigabit Ethernet Controller @@ -46,6 +46,7 @@ * 82573E Gigabit Ethernet Controller (Copper) * 82573L Gigabit Ethernet Controller * 82574L Gigabit Network Connection + * 82583V Gigabit Network Connection */ #include "e1000_api.h" @@ -67,11 +68,9 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw); static void e1000_clear_vfta_82571(struct e1000_hw *hw); static bool e1000_check_mng_mode_82574(struct e1000_hw *hw); static s32 e1000_led_on_82574(struct e1000_hw *hw); -static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count, - u32 rar_used_count, u32 rar_count); static s32 e1000_setup_link_82571(struct e1000_hw *hw); static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw); +static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw); static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data); static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); @@ -79,6 +78,10 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw); static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); +static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw); +static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw); +static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw); +static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw); static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); @@ -92,6 +95,7 @@ static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw); static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; + struct e1000_dev_spec_82571 *dev_spec = &hw->dev_spec._82571; s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_init_phy_params_82571"); @@ -105,10 +109,7 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->reset_delay_us = 100; - phy->ops.acquire = e1000_get_hw_semaphore_82571; - phy->ops.check_polarity = e1000_check_polarity_igp; phy->ops.check_reset_block = e1000_check_reset_block_generic; - phy->ops.release = e1000_put_hw_semaphore_82571; phy->ops.reset = e1000_phy_hw_reset_generic; phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82571; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; @@ -121,10 +122,13 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) phy->type = e1000_phy_igp_2; phy->ops.get_cfg_done = e1000_get_cfg_done_82571; phy->ops.get_info = e1000_get_phy_info_igp; + phy->ops.check_polarity = e1000_check_polarity_igp; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; phy->ops.get_cable_length = e1000_get_cable_length_igp_2; phy->ops.read_reg = e1000_read_phy_reg_igp; phy->ops.write_reg = e1000_write_phy_reg_igp; + phy->ops.acquire = e1000_get_hw_semaphore_82571; + phy->ops.release = e1000_put_hw_semaphore_82571; /* This uses above function pointers */ ret_val = e1000_get_phy_id_82571(hw); @@ -132,6 +136,7 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) /* Verify PHY ID */ if (phy->id != IGP01E1000_I_PHY_ID) { ret_val = -E1000_ERR_PHY; + DEBUGOUT1("PHY ID unknown: type = 0x%08x\n", phy->id); goto out; } break; @@ -139,11 +144,14 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) phy->type = e1000_phy_m88; phy->ops.get_cfg_done = e1000_get_cfg_done_generic; phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; phy->ops.commit = e1000_phy_sw_reset_generic; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.read_reg = e1000_read_phy_reg_m88; phy->ops.write_reg = e1000_write_phy_reg_m88; + phy->ops.acquire = e1000_get_hw_semaphore_82571; + phy->ops.release = e1000_put_hw_semaphore_82571; /* This uses above function pointers */ ret_val = e1000_get_phy_id_82571(hw); @@ -156,14 +164,20 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) } break; case e1000_82574: + case e1000_82583: + E1000_MUTEX_INIT(&dev_spec->swflag_mutex); + phy->type = e1000_phy_bm; phy->ops.get_cfg_done = e1000_get_cfg_done_generic; phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; phy->ops.commit = e1000_phy_sw_reset_generic; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.read_reg = e1000_read_phy_reg_bm2; phy->ops.write_reg = e1000_write_phy_reg_bm2; + phy->ops.acquire = e1000_get_hw_semaphore_82574; + phy->ops.release = e1000_put_hw_semaphore_82574; /* This uses above function pointers */ ret_val = e1000_get_phy_id_82571(hw); @@ -216,6 +230,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) switch (hw->mac.type) { case e1000_82573: case e1000_82574: + case e1000_82583: if (((eecd >> 15) & 0x3) == 0x3) { nvm->type = e1000_nvm_flash_hw; nvm->word_size = 2048; @@ -246,9 +261,18 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) } /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_82571; + switch (hw->mac.type) { + case e1000_82574: + case e1000_82583: + nvm->ops.acquire = e1000_get_hw_semaphore_82574; + nvm->ops.release = e1000_put_hw_semaphore_82574; + break; + default: + nvm->ops.acquire = e1000_acquire_nvm_82571; + nvm->ops.release = e1000_release_nvm_82571; + break; + } nvm->ops.read = e1000_read_nvm_eerd; - nvm->ops.release = e1000_release_nvm_82571; nvm->ops.update = e1000_update_nvm_checksum_82571; nvm->ops.validate = e1000_validate_nvm_checksum_82571; nvm->ops.valid_led_default = e1000_valid_led_default_82571; @@ -264,25 +288,42 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; - s32 ret_val = E1000_SUCCESS; + u32 swsm = 0; + u32 swsm2 = 0; + bool force_clear_smbi = FALSE; DEBUGFUNC("e1000_init_mac_params_82571"); - /* Set media type */ + /* Set media type and media-dependent function pointers */ switch (hw->device_id) { case E1000_DEV_ID_82571EB_FIBER: case E1000_DEV_ID_82572EI_FIBER: case E1000_DEV_ID_82571EB_QUAD_FIBER: hw->phy.media_type = e1000_media_type_fiber; + mac->ops.setup_physical_interface = + e1000_setup_fiber_serdes_link_82571; + mac->ops.check_for_link = e1000_check_for_fiber_link_generic; + mac->ops.get_link_up_info = + e1000_get_speed_and_duplex_fiber_serdes_generic; break; case E1000_DEV_ID_82571EB_SERDES: case E1000_DEV_ID_82571EB_SERDES_DUAL: case E1000_DEV_ID_82571EB_SERDES_QUAD: case E1000_DEV_ID_82572EI_SERDES: hw->phy.media_type = e1000_media_type_internal_serdes; + mac->ops.setup_physical_interface = + e1000_setup_fiber_serdes_link_82571; + mac->ops.check_for_link = e1000_check_for_serdes_link_82571; + mac->ops.get_link_up_info = + e1000_get_speed_and_duplex_fiber_serdes_generic; break; default: hw->phy.media_type = e1000_media_type_copper; + mac->ops.setup_physical_interface = + e1000_setup_copper_link_82571; + mac->ops.check_for_link = e1000_check_for_copper_link_generic; + mac->ops.get_link_up_info = + e1000_get_speed_and_duplex_copper_generic; break; } @@ -292,96 +333,117 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ mac->asf_firmware_present = TRUE; - /* Set if manageability features are enabled. */ - mac->arc_subsystem_valid = - (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) - ? TRUE : FALSE; + /* Adaptive IFS supported */ + mac->adaptive_ifs = TRUE; /* Function pointers */ /* bus type/speed/width */ mac->ops.get_bus_info = e1000_get_bus_info_pcie_generic; - /* function id */ - switch (hw->mac.type) { - case e1000_82573: - case e1000_82574: - mac->ops.set_lan_id = e1000_set_lan_id_single_port; - break; - default: - break; - } /* reset */ mac->ops.reset_hw = e1000_reset_hw_82571; /* hw initialization */ mac->ops.init_hw = e1000_init_hw_82571; /* link setup */ mac->ops.setup_link = e1000_setup_link_82571; - /* physical interface link setup */ - mac->ops.setup_physical_interface = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_setup_copper_link_82571 - : e1000_setup_fiber_serdes_link_82571; - /* check for link */ - switch (hw->phy.media_type) { - case e1000_media_type_copper: - mac->ops.check_for_link = e1000_check_for_copper_link_generic; - break; - case e1000_media_type_fiber: - mac->ops.check_for_link = e1000_check_for_fiber_link_generic; - break; - case e1000_media_type_internal_serdes: - mac->ops.check_for_link = e1000_check_for_serdes_link_generic; - break; - default: - ret_val = -E1000_ERR_CONFIG; - goto out; - break; - } - /* check management mode */ - switch (hw->mac.type) { - case e1000_82574: - mac->ops.check_mng_mode = e1000_check_mng_mode_82574; - break; - default: - mac->ops.check_mng_mode = e1000_check_mng_mode_generic; - break; - } /* multicast address update */ - mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_82571; + mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; /* writing VFTA */ mac->ops.write_vfta = e1000_write_vfta_generic; /* clearing VFTA */ mac->ops.clear_vfta = e1000_clear_vfta_82571; - /* setting MTA */ - mac->ops.mta_set = e1000_mta_set_generic; /* read mac address */ mac->ops.read_mac_addr = e1000_read_mac_addr_82571; + /* ID LED init */ + mac->ops.id_led_init = e1000_id_led_init_generic; /* blink LED */ mac->ops.blink_led = e1000_blink_led_generic; /* setup LED */ mac->ops.setup_led = e1000_setup_led_generic; /* cleanup LED */ mac->ops.cleanup_led = e1000_cleanup_led_generic; - /* turn on/off LED */ - switch (hw->mac.type) { - case e1000_82574: - mac->ops.led_on = e1000_led_on_82574; - break; - default: - mac->ops.led_on = e1000_led_on_generic; - break; - } + /* turn off LED */ mac->ops.led_off = e1000_led_off_generic; /* clear hardware counters */ mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82571; - /* link info */ - mac->ops.get_link_up_info = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_get_speed_and_duplex_copper_generic - : e1000_get_speed_and_duplex_fiber_serdes_generic; -out: - return ret_val; + /* MAC-specific function pointers */ + switch (hw->mac.type) { + case e1000_82573: + mac->ops.set_lan_id = e1000_set_lan_id_single_port; + mac->ops.check_mng_mode = e1000_check_mng_mode_generic; + mac->ops.led_on = e1000_led_on_generic; + + /* FWSM register */ + mac->has_fwsm = TRUE; + /* + * ARC supported; valid only if manageability features are + * enabled. + */ + mac->arc_subsystem_valid = + (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) + ? TRUE : FALSE; + break; + case e1000_82574: + case e1000_82583: + mac->ops.set_lan_id = e1000_set_lan_id_single_port; + mac->ops.check_mng_mode = e1000_check_mng_mode_82574; + mac->ops.led_on = e1000_led_on_82574; + break; + default: + mac->ops.check_mng_mode = e1000_check_mng_mode_generic; + mac->ops.led_on = e1000_led_on_generic; + + /* FWSM register */ + mac->has_fwsm = TRUE; + break; + } + + /* + * Ensure that the inter-port SWSM.SMBI lock bit is clear before + * first NVM or PHY acess. This should be done for single-port + * devices, and for one port only on dual-port devices so that + * for those devices we can still use the SMBI lock to synchronize + * inter-port accesses to the PHY & NVM. + */ + switch (hw->mac.type) { + case e1000_82571: + case e1000_82572: + swsm2 = E1000_READ_REG(hw, E1000_SWSM2); + + if (!(swsm2 & E1000_SWSM2_LOCK)) { + /* Only do this for the first interface on this card */ + E1000_WRITE_REG(hw, E1000_SWSM2, + swsm2 | E1000_SWSM2_LOCK); + force_clear_smbi = TRUE; + } else + force_clear_smbi = FALSE; + break; + default: + force_clear_smbi = TRUE; + break; + } + + if (force_clear_smbi) { + /* Make sure SWSM.SMBI is clear */ + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (swsm & E1000_SWSM_SMBI) { + /* This bit should not be set on a first interface, and + * indicates that the bootagent or EFI code has + * improperly left this bit enabled + */ + DEBUGOUT("Please update your 82571 Bootagent\n"); + } + E1000_WRITE_REG(hw, E1000_SWSM, swsm & ~E1000_SWSM_SMBI); + } + + /* + * Initialze device specific counter of SMBI acquisition + * timeouts. + */ + hw->dev_spec._82571.smb_counter = 0; + + return E1000_SUCCESS; } /** @@ -429,6 +491,7 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) ret_val = e1000_get_phy_id(hw); break; case e1000_82574: + case e1000_82583: ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); if (ret_val) goto out; @@ -446,7 +509,6 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) ret_val = -E1000_ERR_PHY; break; } - out: return ret_val; } @@ -461,13 +523,39 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) { u32 swsm; s32 ret_val = E1000_SUCCESS; - s32 timeout = hw->nvm.word_size + 1; + s32 sw_timeout = hw->nvm.word_size + 1; + s32 fw_timeout = hw->nvm.word_size + 1; s32 i = 0; DEBUGFUNC("e1000_get_hw_semaphore_82571"); + /* + * If we have timedout 3 times on trying to acquire + * the inter-port SMBI semaphore, there is old code + * operating on the other port, and it is not + * releasing SMBI. Modify the number of times that + * we try for the semaphore to interwork with this + * older code. + */ + if (hw->dev_spec._82571.smb_counter > 2) + sw_timeout = 1; + + /* Get the SW semaphore */ + while (i < sw_timeout) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + i++; + } + + if (i == sw_timeout) { + DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); + hw->dev_spec._82571.smb_counter++; + } /* Get the FW semaphore. */ - for (i = 0; i < timeout; i++) { + for (i = 0; i < fw_timeout; i++) { swsm = E1000_READ_REG(hw, E1000_SWSM); E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); @@ -478,9 +566,9 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) usec_delay(50); } - if (i == timeout) { + if (i == fw_timeout) { /* Release semaphores */ - e1000_put_hw_semaphore_generic(hw); + e1000_put_hw_semaphore_82571(hw); DEBUGOUT("Driver can't access the NVM\n"); ret_val = -E1000_ERR_NVM; goto out; @@ -500,15 +588,110 @@ static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) { u32 swsm; - DEBUGFUNC("e1000_put_hw_semaphore_82571"); + DEBUGFUNC("e1000_put_hw_semaphore_generic"); swsm = E1000_READ_REG(hw, E1000_SWSM); - swsm &= ~E1000_SWSM_SWESMBI; + swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); E1000_WRITE_REG(hw, E1000_SWSM, swsm); } +/** + * e1000_get_hw_semaphore_82573 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore during reset. + * + **/ +static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw) +{ + u32 extcnf_ctrl; + s32 ret_val = E1000_SUCCESS; + s32 i = 0; + + DEBUGFUNC("e1000_get_hw_semaphore_82573"); + + extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; + do { + E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); + extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + + if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) + break; + + extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; + + msec_delay(2); + i++; + } while (i < MDIO_OWNERSHIP_TIMEOUT); + + if (i == MDIO_OWNERSHIP_TIMEOUT) { + /* Release semaphores */ + e1000_put_hw_semaphore_82573(hw); + DEBUGOUT("Driver can't access the PHY\n"); + ret_val = -E1000_ERR_PHY; + goto out; + } + +out: + return ret_val; +} + +/** + * e1000_put_hw_semaphore_82573 - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used during reset. + * + **/ +static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw) +{ + u32 extcnf_ctrl; + + DEBUGFUNC("e1000_put_hw_semaphore_82573"); + + extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + extcnf_ctrl &= ~E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; + E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); +} + +/** + * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore to access the PHY or NVM. + * + **/ +static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw) +{ + s32 ret_val; + + DEBUGFUNC("e1000_get_hw_semaphore_82574"); + + E1000_MUTEX_LOCK(&hw->dev_spec._82571.swflag_mutex); + ret_val = e1000_get_hw_semaphore_82573(hw); + if (ret_val) + E1000_MUTEX_UNLOCK(&hw->dev_spec._82571.swflag_mutex); + return ret_val; +} + +/** + * e1000_put_hw_semaphore_82574 - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used to access the PHY or NVM + * + **/ +static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_put_hw_semaphore_82574"); + + e1000_put_hw_semaphore_82573(hw); + E1000_MUTEX_UNLOCK(&hw->dev_spec._82571.swflag_mutex); +} + /** * e1000_acquire_nvm_82571 - Request for access to the EEPROM * @hw: pointer to the HW structure @@ -528,8 +711,13 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw) if (ret_val) goto out; - if (hw->mac.type != e1000_82573 && hw->mac.type != e1000_82574) + switch (hw->mac.type) { + case e1000_82573: + break; + default: ret_val = e1000_acquire_nvm_generic(hw); + break; + } if (ret_val) e1000_put_hw_semaphore_82571(hw); @@ -574,6 +762,7 @@ static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words, switch (hw->mac.type) { case e1000_82573: case e1000_82574: + case e1000_82583: ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data); break; case e1000_82571: @@ -742,7 +931,8 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) DEBUGFUNC("e1000_get_cfg_done_82571"); while (timeout) { - if (E1000_READ_REG(hw, E1000_EEMNGCTL) & E1000_NVM_CFG_DONE_PORT_0) + if (E1000_READ_REG(hw, E1000_EEMNGCTL) & + E1000_NVM_CFG_DONE_PORT_0) break; msec_delay(1); timeout--; @@ -849,9 +1039,8 @@ out: **/ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) { - u32 ctrl, extcnf_ctrl, ctrl_ext, icr; + u32 ctrl, ctrl_ext, icr; s32 ret_val; - u16 i = 0; DEBUGFUNC("e1000_reset_hw_82571"); @@ -876,29 +1065,35 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) * Must acquire the MDIO ownership before MAC reset. * Ownership defaults to firmware after a reset. */ - if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) { - extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); - extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; - - do { - E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); - extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); - - if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) - break; - - extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; - - msec_delay(2); - i++; - } while (i < MDIO_OWNERSHIP_TIMEOUT); + switch (hw->mac.type) { + case e1000_82573: + ret_val = e1000_get_hw_semaphore_82573(hw); + break; + case e1000_82574: + case e1000_82583: + ret_val = e1000_get_hw_semaphore_82574(hw); + break; + default: + break; } + if (ret_val) + DEBUGOUT("Cannot acquire MDIO ownership\n"); ctrl = E1000_READ_REG(hw, E1000_CTRL); DEBUGOUT("Issuing a global reset to MAC\n"); E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); + /* Must release MDIO ownership and mutex after MAC reset. */ + switch (hw->mac.type) { + case e1000_82574: + case e1000_82583: + e1000_put_hw_semaphore_82574(hw); + break; + default: + break; + } + if (hw->nvm.type == e1000_nvm_flash_hw) { usec_delay(10); ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -917,15 +1112,33 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) * Need to wait for Phy configuration completion before accessing * NVM and Phy. */ - if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) + + switch (hw->mac.type) { + case e1000_82573: + case e1000_82574: + case e1000_82583: msec_delay(25); + break; + default: + break; + } /* Clear any pending interrupt events. */ E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); icr = E1000_READ_REG(hw, E1000_ICR); - if (!(e1000_check_alt_mac_addr_generic(hw))) + if (hw->mac.type == e1000_82571) { + /* Install any alternate MAC address into RAR0 */ + ret_val = e1000_check_alt_mac_addr_generic(hw); + if (ret_val) + goto out; + e1000_set_laa_state_82571(hw, TRUE); + } + + /* Reinitialize the 82571 serdes link state machine */ + if (hw->phy.media_type == e1000_media_type_internal_serdes) + hw->mac.serdes_link_state = e1000_serdes_link_down; out: return ret_val; @@ -949,11 +1162,10 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) e1000_initialize_hw_bits_82571(hw); /* Initialize identification LED */ - ret_val = e1000_id_led_init_generic(hw); - if (ret_val) { + ret_val = mac->ops.id_led_init(hw); + if (ret_val) DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ - } /* Disabling VLAN filtering */ DEBUGOUT("Initializing the IEEE VLAN\n"); @@ -985,17 +1197,23 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data); /* ...for both queues. */ - if (mac->type != e1000_82573 && mac->type != e1000_82574) { + switch (mac->type) { + case e1000_82573: + e1000_enable_tx_pkt_filtering_generic(hw); + /* fall through */ + case e1000_82574: + case e1000_82583: + reg_data = E1000_READ_REG(hw, E1000_GCR); + reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; + E1000_WRITE_REG(hw, E1000_GCR, reg_data); + break; + default: reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data); - } else { - e1000_enable_tx_pkt_filtering_generic(hw); - reg_data = E1000_READ_REG(hw, E1000_GCR); - reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; - E1000_WRITE_REG(hw, E1000_GCR, reg_data); + break; } /* @@ -1062,25 +1280,70 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw) } /* Device Control */ - if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) { + switch (hw->mac.type) { + case e1000_82573: + case e1000_82574: + case e1000_82583: reg = E1000_READ_REG(hw, E1000_CTRL); reg &= ~(1 << 29); E1000_WRITE_REG(hw, E1000_CTRL, reg); + break; + default: + break; } /* Extended Device Control */ - if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) { + switch (hw->mac.type) { + case e1000_82573: + case e1000_82574: + case e1000_82583: reg = E1000_READ_REG(hw, E1000_CTRL_EXT); reg &= ~(1 << 23); reg |= (1 << 22); E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg); + break; + default: + break; } - /* PCI-Ex Control Register */ - if (hw->mac.type == e1000_82574) { + if (hw->mac.type == e1000_82571) { + reg = E1000_READ_REG(hw, E1000_PBA_ECC); + reg |= E1000_PBA_ECC_CORR_EN; + E1000_WRITE_REG(hw, E1000_PBA_ECC, reg); + } + + /* + * Workaround for hardware errata. + * Ensure that DMA Dynamic Clock gating is disabled on 82571 and 82572 + */ + if ((hw->mac.type == e1000_82571) || + (hw->mac.type == e1000_82572)) { + reg = E1000_READ_REG(hw, E1000_CTRL_EXT); + reg &= ~E1000_CTRL_EXT_DMA_DYN_CLK_EN; + E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg); + } + + /* PCI-Ex Control Registers */ + switch (hw->mac.type) { + case e1000_82574: + case e1000_82583: reg = E1000_READ_REG(hw, E1000_GCR); reg |= (1 << 22); E1000_WRITE_REG(hw, E1000_GCR, reg); + + /* + * Workaround for hardware errata. + * apply workaround for hardware errata documented in errata + * docs Fixes issue where some error prone or unreliable PCIe + * completions are occurring, particularly with ASPM enabled. + * Without fix, issue can cause tx timeouts. + */ + reg = E1000_READ_REG(hw, E1000_GCR2); + reg |= 1; + E1000_WRITE_REG(hw, E1000_GCR2, reg); + break; + default: + break; } return; @@ -1102,7 +1365,10 @@ static void e1000_clear_vfta_82571(struct e1000_hw *hw) DEBUGFUNC("e1000_clear_vfta_82571"); - if (hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) { + switch (hw->mac.type) { + case e1000_82573: + case e1000_82574: + case e1000_82583: if (hw->mng_cookie.vlan_id != 0) { /* * The VFTA is a 4096b bit-field, each identifying @@ -1112,11 +1378,13 @@ static void e1000_clear_vfta_82571(struct e1000_hw *hw) * the manageability unit. */ vfta_offset = (hw->mng_cookie.vlan_id >> - E1000_VFTA_ENTRY_SHIFT) & - E1000_VFTA_ENTRY_MASK; + E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK; vfta_bit_in_reg = 1 << (hw->mng_cookie.vlan_id & - E1000_VFTA_ENTRY_BIT_SHIFT_MASK); + E1000_VFTA_ENTRY_BIT_SHIFT_MASK); } + break; + default: + break; } for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { /* @@ -1177,31 +1445,42 @@ static s32 e1000_led_on_82574(struct e1000_hw *hw) } /** - * e1000_update_mc_addr_list_82571 - Update Multicast addresses + * e1000_check_phy_82574 - check 82574 phy hung state * @hw: pointer to the HW structure - * @mc_addr_list: array of multicast addresses to program - * @mc_addr_count: number of multicast addresses to program - * @rar_used_count: the first RAR register free to program - * @rar_count: total number of supported Receive Address Registers * - * Updates the Receive Address Registers and Multicast Table Array. - * The caller must have a packed mc_addr_list of multicast addresses. - * The parameter rar_count will usually be hw->mac.rar_entry_count - * unless there are workarounds that change this. + * Returns whether phy is hung or not **/ -static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count, - u32 rar_used_count, u32 rar_count) +bool e1000_check_phy_82574(struct e1000_hw *hw) { - DEBUGFUNC("e1000_update_mc_addr_list_82571"); + u16 status_1kbt = 0; + u16 receive_errors = 0; + bool phy_hung = FALSE; + s32 ret_val = E1000_SUCCESS; - if (e1000_get_laa_state_82571(hw)) - rar_count--; + DEBUGFUNC("e1000_check_phy_82574"); - e1000_update_mc_addr_list_generic(hw, mc_addr_list, mc_addr_count, - rar_used_count, rar_count); + /* + * Read PHY Receive Error counter first, if its is max - all F's then + * read the Base1000T status register If both are max then PHY is hung. + */ + ret_val = hw->phy.ops.read_reg(hw, E1000_RECEIVE_ERROR_COUNTER, + &receive_errors); + if (ret_val) + goto out; + if (receive_errors == E1000_RECEIVE_ERROR_MAX) { + ret_val = hw->phy.ops.read_reg(hw, E1000_BASE1000T_STATUS, + &status_1kbt); + if (ret_val) + goto out; + if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) == + E1000_IDLE_ERROR_COUNT_MASK) + phy_hung = TRUE; + } +out: + return phy_hung; } + /** * e1000_setup_link_82571 - Setup flow control and link settings * @hw: pointer to the HW structure @@ -1221,10 +1500,16 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw) * the default flow control setting, so we explicitly * set it to full. */ - if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) && - hw->fc.requested_mode == e1000_fc_default) - hw->fc.requested_mode = e1000_fc_full; - + switch (hw->mac.type) { + case e1000_82573: + case e1000_82574: + case e1000_82583: + if (hw->fc.requested_mode == e1000_fc_default) + hw->fc.requested_mode = e1000_fc_full; + break; + default: + break; + } return e1000_setup_link_generic(hw); } @@ -1238,8 +1523,8 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw) **/ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) { - u32 ctrl, led_ctrl; - s32 ret_val; + u32 ctrl; + s32 ret_val; DEBUGFUNC("e1000_setup_copper_link_82571"); @@ -1255,11 +1540,6 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) break; case e1000_phy_igp_2: ret_val = e1000_copper_link_setup_igp(hw); - /* Setup activity LED */ - led_ctrl = E1000_READ_REG(hw, E1000_LEDCTL); - led_ctrl &= IGP_ACTIVITY_LED_MASK; - led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); - E1000_WRITE_REG(hw, E1000_LEDCTL, led_ctrl); break; default: ret_val = -E1000_ERR_PHY; @@ -1305,6 +1585,182 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) return e1000_setup_fiber_serdes_link_generic(hw); } +/** + * e1000_check_for_serdes_link_82571 - Check for link (Serdes) + * @hw: pointer to the HW structure + * + * Reports the link state as up or down. + * + * If autonegotiation is supported by the link partner, the link state is + * determined by the result of autonegotiation. This is the most likely case. + * If autonegotiation is not supported by the link partner, and the link + * has a valid signal, force the link up. + * + * The link state is represented internally here by 4 states: + * + * 1) down + * 2) autoneg_progress + * 3) autoneg_complete (the link sucessfully autonegotiated) + * 4) forced_up (the link has been forced up, it did not autonegotiate) + * + **/ +static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) +{ + struct e1000_mac_info *mac = &hw->mac; + u32 rxcw; + u32 ctrl; + u32 status; + u32 txcw; + u32 i; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_check_for_serdes_link_82571"); + + ctrl = E1000_READ_REG(hw, E1000_CTRL); + status = E1000_READ_REG(hw, E1000_STATUS); + rxcw = E1000_READ_REG(hw, E1000_RXCW); + + if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) { + + /* Receiver is synchronized with no invalid bits. */ + switch (mac->serdes_link_state) { + case e1000_serdes_link_autoneg_complete: + if (!(status & E1000_STATUS_LU)) { + /* + * We have lost link, retry autoneg before + * reporting link failure + */ + mac->serdes_link_state = + e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = FALSE; + DEBUGOUT("AN_UP -> AN_PROG\n"); + } else { + mac->serdes_has_link = TRUE; + } + break; + + case e1000_serdes_link_forced_up: + /* + * If we are receiving /C/ ordered sets, re-enable + * auto-negotiation in the TXCW register and disable + * forced link in the Device Control register in an + * attempt to auto-negotiate with our link partner. + * If the partner code word is null, stop forcing + * and restart auto negotiation. + */ + if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW)) { + /* Enable autoneg, and unforce link up */ + E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); + E1000_WRITE_REG(hw, E1000_CTRL, + (ctrl & ~E1000_CTRL_SLU)); + mac->serdes_link_state = + e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = FALSE; + DEBUGOUT("FORCED_UP -> AN_PROG\n"); + } else { + mac->serdes_has_link = TRUE; + } + break; + + case e1000_serdes_link_autoneg_progress: + if (rxcw & E1000_RXCW_C) { + /* + * We received /C/ ordered sets, meaning the + * link partner has autonegotiated, and we can + * trust the Link Up (LU) status bit. + */ + if (status & E1000_STATUS_LU) { + mac->serdes_link_state = + e1000_serdes_link_autoneg_complete; + DEBUGOUT("AN_PROG -> AN_UP\n"); + mac->serdes_has_link = TRUE; + } else { + /* Autoneg completed, but failed. */ + mac->serdes_link_state = + e1000_serdes_link_down; + DEBUGOUT("AN_PROG -> DOWN\n"); + } + } else { + /* + * The link partner did not autoneg. + * Force link up and full duplex, and change + * state to forced. + */ + E1000_WRITE_REG(hw, E1000_TXCW, + (mac->txcw & ~E1000_TXCW_ANE)); + ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + + /* Configure Flow Control after link up. */ + ret_val = + e1000_config_fc_after_link_up_generic(hw); + if (ret_val) { + DEBUGOUT("Error config flow control\n"); + break; + } + mac->serdes_link_state = + e1000_serdes_link_forced_up; + mac->serdes_has_link = TRUE; + DEBUGOUT("AN_PROG -> FORCED_UP\n"); + } + break; + + case e1000_serdes_link_down: + default: + /* + * The link was down but the receiver has now gained + * valid sync, so lets see if we can bring the link + * up. + */ + E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); + E1000_WRITE_REG(hw, E1000_CTRL, + (ctrl & ~E1000_CTRL_SLU)); + mac->serdes_link_state = + e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = FALSE; + DEBUGOUT("DOWN -> AN_PROG\n"); + break; + } + } else { + if (!(rxcw & E1000_RXCW_SYNCH)) { + mac->serdes_has_link = FALSE; + mac->serdes_link_state = e1000_serdes_link_down; + DEBUGOUT("ANYSTATE -> DOWN\n"); + } else { + /* + * Check several times, if Sync and Config + * both are consistently 1 then simply ignore + * the Invalid bit and restart Autoneg + */ + for (i = 0; i < AN_RETRY_COUNT; i++) { + usec_delay(10); + rxcw = E1000_READ_REG(hw, E1000_RXCW); + if ((rxcw & E1000_RXCW_IV) && + !((rxcw & E1000_RXCW_SYNCH) && + (rxcw & E1000_RXCW_C))) { + mac->serdes_has_link = FALSE; + mac->serdes_link_state = + e1000_serdes_link_down; + DEBUGOUT("ANYSTATE -> DOWN\n"); + break; + } + } + + if (i == AN_RETRY_COUNT) { + txcw = E1000_READ_REG(hw, E1000_TXCW); + txcw |= E1000_TXCW_ANE; + E1000_WRITE_REG(hw, E1000_TXCW, txcw); + mac->serdes_link_state = + e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = FALSE; + DEBUGOUT("ANYSTATE -> AN_PROG\n"); + } + } + } + + return ret_val; +} + /** * e1000_valid_led_default_82571 - Verify a valid default LED config * @hw: pointer to the HW structure @@ -1325,11 +1781,20 @@ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) goto out; } - if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) && - *data == ID_LED_RESERVED_F746) - *data = ID_LED_DEFAULT_82573; - else if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) - *data = ID_LED_DEFAULT; + switch (hw->mac.type) { + case e1000_82573: + case e1000_82574: + case e1000_82583: + if (*data == ID_LED_RESERVED_F746) + *data = ID_LED_DEFAULT_82573; + break; + default: + if (*data == ID_LED_RESERVED_0000 || + *data == ID_LED_RESERVED_FFFF) + *data = ID_LED_DEFAULT; + break; + } + out: return ret_val; } @@ -1435,6 +1900,7 @@ out: return ret_val; } + /** * e1000_read_mac_addr_82571 - Read device MAC address * @hw: pointer to the HW structure @@ -1444,9 +1910,21 @@ static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw) s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_read_mac_addr_82571"); - if (e1000_check_alt_mac_addr_generic(hw)) - ret_val = e1000_read_mac_addr_generic(hw); + if (hw->mac.type == e1000_82571) { + /* + * If there's an alternate MAC address place it in RAR0 + * so that it will override the Si installed default perm + * address. + */ + ret_val = e1000_check_alt_mac_addr_generic(hw); + if (ret_val) + goto out; + } + + ret_val = e1000_read_mac_addr_generic(hw); + +out: return ret_val; } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.h index f299ce86b5..c7ec58bdd3 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82571.h,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82571.h,v 1.1.4.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_82571_H_ #define _E1000_82571_H_ @@ -42,6 +42,7 @@ (ID_LED_DEF1_DEF2)) #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 +#define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */ /* Intr Throttling - RW */ #define E1000_EITR_82574(_n) (0x000E8 + (0x4 * (_n))) @@ -53,6 +54,11 @@ #define E1000_RXCFGL 0x0B634 /* TimeSync Rx EtherType & Msg Type Reg - RW */ +#define E1000_BASE1000T_STATUS 10 +#define E1000_IDLE_ERROR_COUNT_MASK 0xFF +#define E1000_RECEIVE_ERROR_COUNTER 21 +#define E1000_RECEIVE_ERROR_MAX 0xFFFF +bool e1000_check_phy_82574(struct e1000_hw *hw); bool e1000_get_laa_state_82571(struct e1000_hw *hw); void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state); diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.c index 37d7c1fb80..16e4c1ef39 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,13 +30,15 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82575.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82575.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ /* * 82575EB Gigabit Network Connection * 82575EB Gigabit Backplane Connection * 82575GB Gigabit Network Connection + * 82575GB Gigabit Network Connection * 82576 Gigabit Network Connection + * 82576 Quad Port Gigabit Mezzanine Adapter */ #include "e1000_api.h" @@ -57,16 +59,20 @@ static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw); static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 *data); static s32 e1000_reset_hw_82575(struct e1000_hw *hw); +static s32 e1000_reset_hw_82580(struct e1000_hw *hw); +static s32 e1000_read_phy_reg_82580(struct e1000_hw *hw, + u32 offset, u16 *data); +static s32 e1000_write_phy_reg_82580(struct e1000_hw *hw, + u32 offset, u16 data); static s32 e1000_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active); static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw); -static s32 e1000_setup_fiber_serdes_link_82575(struct e1000_hw *hw); +static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw); static s32 e1000_valid_led_default_82575(struct e1000_hw *hw, u16 *data); static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 data); static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw); static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask); -static s32 e1000_configure_pcs_link_82575(struct e1000_hw *hw); static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex); static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); @@ -74,13 +80,49 @@ static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static bool e1000_sgmii_active_82575(struct e1000_hw *hw); static s32 e1000_reset_init_script_82575(struct e1000_hw *hw); static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); +static void e1000_config_collision_dist_82575(struct e1000_hw *hw); static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw); +static void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw); +static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw); +static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw); +static s32 e1000_reset_mdicnfg_82580(struct e1000_hw *hw); -static void e1000_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count); -static void e1000_update_mc_addr_list_82575(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count, - u32 rar_used_count, u32 rar_count); -void e1000_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw); +static const u16 e1000_82580_rxpbs_table[] = + { 36, 72, 144, 1, 2, 4, 8, 16, + 35, 70, 140 }; +#define E1000_82580_RXPBS_TABLE_SIZE \ + (sizeof(e1000_82580_rxpbs_table)/sizeof(u16)) + + +/** + * e1000_sgmii_uses_mdio_82575 - Determine if I2C pins are for external MDIO + * @hw: pointer to the HW structure + * + * Called to determine if the I2C pins are being used for I2C or as an + * external MDIO interface since the two options are mutually exclusive. + **/ +static bool e1000_sgmii_uses_mdio_82575(struct e1000_hw *hw) +{ + u32 reg = 0; + bool ext_mdio = FALSE; + + DEBUGFUNC("e1000_sgmii_uses_mdio_82575"); + + switch (hw->mac.type) { + case e1000_82575: + case e1000_82576: + reg = E1000_READ_REG(hw, E1000_MDIC); + ext_mdio = !!(reg & E1000_MDIC_DEST); + break; + case e1000_82580: + reg = E1000_READ_REG(hw, E1000_MDICNFG); + ext_mdio = !!(reg & E1000_MDICNFG_EXT_MDIO); + break; + default: + break; + } + return ext_mdio; +} /** * e1000_init_phy_params_82575 - Init PHY func ptrs. @@ -90,17 +132,18 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; + u32 ctrl_ext; DEBUGFUNC("e1000_init_phy_params_82575"); if (hw->phy.media_type != e1000_media_type_copper) { phy->type = e1000_phy_none; goto out; - } else { - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82575; } + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_82575; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->reset_delay_us = 100; @@ -110,12 +153,26 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) phy->ops.get_cfg_done = e1000_get_cfg_done_82575; phy->ops.release = e1000_release_phy_82575; + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + if (e1000_sgmii_active_82575(hw)) { phy->ops.reset = e1000_phy_hw_reset_sgmii_82575; - phy->ops.read_reg = e1000_read_phy_reg_sgmii_82575; - phy->ops.write_reg = e1000_write_phy_reg_sgmii_82575; + ctrl_ext |= E1000_CTRL_I2C_ENA; } else { phy->ops.reset = e1000_phy_hw_reset_generic; + ctrl_ext &= ~E1000_CTRL_I2C_ENA; + } + + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); + e1000_reset_mdicnfg_82580(hw); + + if (e1000_sgmii_active_82575(hw) && !e1000_sgmii_uses_mdio_82575(hw)) { + phy->ops.read_reg = e1000_read_phy_reg_sgmii_82575; + phy->ops.write_reg = e1000_write_phy_reg_sgmii_82575; + } else if (hw->mac.type >= e1000_82580) { + phy->ops.read_reg = e1000_read_phy_reg_82580; + phy->ops.write_reg = e1000_write_phy_reg_82580; + } else { phy->ops.read_reg = e1000_read_phy_reg_igp; phy->ops.write_reg = e1000_write_phy_reg_igp; } @@ -142,6 +199,13 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82575; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; break; + case I82580_I_PHY_ID: + phy->type = e1000_phy_82580; + phy->ops.check_polarity = e1000_check_polarity_82577; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_82577; + phy->ops.get_cable_length = e1000_get_cable_length_82577; + phy->ops.get_info = e1000_get_phy_info_82577; + break; default: ret_val = -E1000_ERR_PHY; goto out; @@ -194,7 +258,7 @@ static s32 e1000_init_nvm_params_82575(struct e1000_hw *hw) /* EEPROM access above 16k is unsupported */ if (size > 14) size = 14; - nvm->word_size = 1 << size; + nvm->word_size = 1 << size; /* Function Pointers */ nvm->ops.acquire = e1000_acquire_nvm_82575; @@ -232,27 +296,33 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) dev_spec->sgmii_active = FALSE; ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); - if ((ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) == - E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES) { - hw->phy.media_type = e1000_media_type_internal_serdes; - ctrl_ext |= E1000_CTRL_I2C_ENA; - } else if (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII) { + switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) { + case E1000_CTRL_EXT_LINK_MODE_SGMII: dev_spec->sgmii_active = TRUE; - ctrl_ext |= E1000_CTRL_I2C_ENA; - } else { - ctrl_ext &= ~E1000_CTRL_I2C_ENA; + break; + case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: + case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES: + hw->phy.media_type = e1000_media_type_internal_serdes; + break; + default: + break; } - E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); /* Set mta register count */ mac->mta_reg_count = 128; + /* Set uta register count */ + mac->uta_reg_count = (hw->mac.type == e1000_82575) ? 0 : 128; /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES_82575; if (mac->type == e1000_82576) mac->rar_entry_count = E1000_RAR_ENTRIES_82576; + if (mac->type == e1000_82580) + mac->rar_entry_count = E1000_RAR_ENTRIES_82580; /* Set if part includes ASF firmware */ mac->asf_firmware_present = TRUE; - /* Set if manageability features are enabled. */ + /* FWSM register */ + mac->has_fwsm = TRUE; + /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) ? TRUE : FALSE; @@ -262,6 +332,9 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) /* bus type/speed/width */ mac->ops.get_bus_info = e1000_get_bus_info_pcie_generic; /* reset */ + if (mac->type >= e1000_82580) + mac->ops.reset_hw = e1000_reset_hw_82580; + else mac->ops.reset_hw = e1000_reset_hw_82575; /* hw initialization */ mac->ops.init_hw = e1000_init_hw_82575; @@ -271,23 +344,27 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) mac->ops.setup_physical_interface = (hw->phy.media_type == e1000_media_type_copper) ? e1000_setup_copper_link_82575 - : e1000_setup_fiber_serdes_link_82575; + : e1000_setup_serdes_link_82575; /* physical interface shutdown */ - mac->ops.shutdown_serdes = e1000_shutdown_fiber_serdes_link_82575; + mac->ops.shutdown_serdes = e1000_shutdown_serdes_link_82575; + /* physical interface power up */ + mac->ops.power_up_serdes = e1000_power_up_serdes_link_82575; /* check for link */ mac->ops.check_for_link = e1000_check_for_link_82575; /* receive address register setting */ mac->ops.rar_set = e1000_rar_set_generic; /* read mac address */ mac->ops.read_mac_addr = e1000_read_mac_addr_82575; + /* configure collision distance */ + mac->ops.config_collision_dist = e1000_config_collision_dist_82575; /* multicast address update */ - mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_82575; + mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; /* writing VFTA */ mac->ops.write_vfta = e1000_write_vfta_generic; /* clearing VFTA */ mac->ops.clear_vfta = e1000_clear_vfta_generic; - /* setting MTA */ - mac->ops.mta_set = e1000_mta_set_generic; + /* ID LED init */ + mac->ops.id_led_init = e1000_id_led_init_generic; /* blink LED */ mac->ops.blink_led = e1000_blink_led_generic; /* setup LED */ @@ -302,6 +379,9 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) /* link info */ mac->ops.get_link_up_info = e1000_get_link_up_info_82575; + /* set lan id for port to determine which phy lock to use */ + hw->mac.ops.set_lan_id(hw); + return E1000_SUCCESS; } @@ -318,6 +398,7 @@ void e1000_init_function_pointers_82575(struct e1000_hw *hw) hw->mac.ops.init_params = e1000_init_mac_params_82575; hw->nvm.ops.init_params = e1000_init_nvm_params_82575; hw->phy.ops.init_params = e1000_init_phy_params_82575; + hw->mbx.ops.init_params = e1000_init_mbx_params_pf; } /** @@ -328,11 +409,16 @@ void e1000_init_function_pointers_82575(struct e1000_hw *hw) **/ static s32 e1000_acquire_phy_82575(struct e1000_hw *hw) { - u16 mask; + u16 mask = E1000_SWFW_PHY0_SM; DEBUGFUNC("e1000_acquire_phy_82575"); - mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; + if (hw->bus.func == E1000_FUNC_1) + mask = E1000_SWFW_PHY1_SM; + else if (hw->bus.func == E1000_FUNC_2) + mask = E1000_SWFW_PHY2_SM; + else if (hw->bus.func == E1000_FUNC_3) + mask = E1000_SWFW_PHY3_SM; return e1000_acquire_swfw_sync_82575(hw, mask); } @@ -345,11 +431,17 @@ static s32 e1000_acquire_phy_82575(struct e1000_hw *hw) **/ static void e1000_release_phy_82575(struct e1000_hw *hw) { - u16 mask; + u16 mask = E1000_SWFW_PHY0_SM; DEBUGFUNC("e1000_release_phy_82575"); - mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; + if (hw->bus.func == E1000_FUNC_1) + mask = E1000_SWFW_PHY1_SM; + else if (hw->bus.func == E1000_FUNC_2) + mask = E1000_SWFW_PHY2_SM; + else if (hw->bus.func == E1000_FUNC_3) + mask = E1000_SWFW_PHY3_SM; + e1000_release_swfw_sync_82575(hw, mask); } @@ -365,47 +457,25 @@ static void e1000_release_phy_82575(struct e1000_hw *hw) static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 *data) { - struct e1000_phy_info *phy = &hw->phy; - u32 i, i2ccmd = 0; + s32 ret_val = -E1000_ERR_PARAM; DEBUGFUNC("e1000_read_phy_reg_sgmii_82575"); if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) { DEBUGOUT1("PHY Address %u is out of range\n", offset); - return -E1000_ERR_PARAM; + goto out; } - /* - * Set up Op-code, Phy Address, and register address in the I2CCMD - * register. The MAC will take care of interfacing with the - * PHY to retrieve the desired data. - */ - i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | - (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | - (E1000_I2CCMD_OPCODE_READ)); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; - E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); + ret_val = e1000_read_phy_reg_i2c(hw, offset, data); - /* Poll the ready bit to see if the I2C read completed */ - for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) { - usec_delay(50); - i2ccmd = E1000_READ_REG(hw, E1000_I2CCMD); - if (i2ccmd & E1000_I2CCMD_READY) - break; - } - if (!(i2ccmd & E1000_I2CCMD_READY)) { - DEBUGOUT("I2CCMD Read did not complete\n"); - return -E1000_ERR_PHY; - } - if (i2ccmd & E1000_I2CCMD_ERROR) { - DEBUGOUT("I2CCMD Error bit set\n"); - return -E1000_ERR_PHY; - } + hw->phy.ops.release(hw); - /* Need to byte-swap the 16-bit value. */ - *data = ((i2ccmd >> 8) & 0x00FF) | ((i2ccmd << 8) & 0xFF00); - - return E1000_SUCCESS; +out: + return ret_val; } /** @@ -420,49 +490,25 @@ static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 data) { - struct e1000_phy_info *phy = &hw->phy; - u32 i, i2ccmd = 0; - u16 phy_data_swapped; + s32 ret_val = -E1000_ERR_PARAM; DEBUGFUNC("e1000_write_phy_reg_sgmii_82575"); if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) { DEBUGOUT1("PHY Address %d is out of range\n", offset); - return -E1000_ERR_PARAM; + goto out; } - /* Swap the data bytes for the I2C interface */ - phy_data_swapped = ((data >> 8) & 0x00FF) | ((data << 8) & 0xFF00); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; - /* - * Set up Op-code, Phy Address, and register address in the I2CCMD - * register. The MAC will take care of interfacing with the - * PHY to retrieve the desired data. - */ - i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | - (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | - E1000_I2CCMD_OPCODE_WRITE | - phy_data_swapped); + ret_val = e1000_write_phy_reg_i2c(hw, offset, data); - E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); + hw->phy.ops.release(hw); - /* Poll the ready bit to see if the I2C read completed */ - for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) { - usec_delay(50); - i2ccmd = E1000_READ_REG(hw, E1000_I2CCMD); - if (i2ccmd & E1000_I2CCMD_READY) - break; - } - if (!(i2ccmd & E1000_I2CCMD_READY)) { - DEBUGOUT("I2CCMD Write did not complete\n"); - return -E1000_ERR_PHY; - } - if (i2ccmd & E1000_I2CCMD_ERROR) { - DEBUGOUT("I2CCMD Error bit set\n"); - return -E1000_ERR_PHY; - } - - return E1000_SUCCESS; +out: + return ret_val; } /** @@ -477,6 +523,8 @@ static s32 e1000_get_phy_id_82575(struct e1000_hw *hw) struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; u16 phy_id; + u32 ctrl_ext; + u32 mdic; DEBUGFUNC("e1000_get_phy_id_82575"); @@ -487,12 +535,41 @@ static s32 e1000_get_phy_id_82575(struct e1000_hw *hw) * work. The result of this function should mean phy->phy_addr * and phy->id are set correctly. */ - if (!(e1000_sgmii_active_82575(hw))) { + if (!e1000_sgmii_active_82575(hw)) { phy->addr = 1; ret_val = e1000_get_phy_id(hw); goto out; } + if (e1000_sgmii_uses_mdio_82575(hw)) { + switch (hw->mac.type) { + case e1000_82575: + case e1000_82576: + mdic = E1000_READ_REG(hw, E1000_MDIC); + mdic &= E1000_MDIC_PHY_MASK; + phy->addr = mdic >> E1000_MDIC_PHY_SHIFT; + break; + case e1000_82580: + mdic = E1000_READ_REG(hw, E1000_MDICNFG); + mdic &= E1000_MDICNFG_PHY_MASK; + phy->addr = mdic >> E1000_MDICNFG_PHY_SHIFT; + break; + default: + ret_val = -E1000_ERR_PHY; + goto out; + break; + } + ret_val = e1000_get_phy_id(hw); + goto out; + } + + /* Power on sgmii phy if it is disabled */ + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + E1000_WRITE_REG(hw, E1000_CTRL_EXT, + ctrl_ext & ~E1000_CTRL_EXT_SDP3_DATA); + E1000_WRITE_FLUSH(hw); + msec_delay(300); + /* * The address field in the I2CCMD register is 3 bits and 0 is invalid. * Therefore, we need to test 1-7 @@ -519,10 +596,12 @@ static s32 e1000_get_phy_id_82575(struct e1000_hw *hw) if (phy->addr == 8) { phy->addr = 0; ret_val = -E1000_ERR_PHY; - goto out; + } else { + ret_val = e1000_get_phy_id(hw); } - ret_val = e1000_get_phy_id(hw); + /* restore previous sfp cage power state */ + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); out: return ret_val; @@ -787,24 +866,25 @@ static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_get_cfg_done_82575"); - if (hw->bus.func == 1) + if (hw->bus.func == E1000_FUNC_1) mask = E1000_NVM_CFG_DONE_PORT_1; - + else if (hw->bus.func == E1000_FUNC_2) + mask = E1000_NVM_CFG_DONE_PORT_2; + else if (hw->bus.func == E1000_FUNC_3) + mask = E1000_NVM_CFG_DONE_PORT_3; while (timeout) { if (E1000_READ_REG(hw, E1000_EEMNGCTL) & mask) break; msec_delay(1); timeout--; } - if (!timeout) { + if (!timeout) DEBUGOUT("MNG configuration cycle has not completed.\n"); - } /* If EEPROM is not marked present, init the PHY manually */ if (((E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) == 0) && - (hw->phy.type == e1000_phy_igp_3)) { + (hw->phy.type == e1000_phy_igp_3)) e1000_phy_init_script_igp3(hw); - } return ret_val; } @@ -826,14 +906,12 @@ static s32 e1000_get_link_up_info_82575(struct e1000_hw *hw, u16 *speed, DEBUGFUNC("e1000_get_link_up_info_82575"); - if (hw->phy.media_type != e1000_media_type_copper || - e1000_sgmii_active_82575(hw)) { + if (hw->phy.media_type != e1000_media_type_copper) ret_val = e1000_get_pcs_speed_and_duplex_82575(hw, speed, duplex); - } else { + else ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, duplex); - } return ret_val; } @@ -852,17 +930,51 @@ static s32 e1000_check_for_link_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_check_for_link_82575"); - /* SGMII link check is done through the PCS register. */ - if ((hw->phy.media_type != e1000_media_type_copper) || - (e1000_sgmii_active_82575(hw))) + if (hw->phy.media_type != e1000_media_type_copper) { ret_val = e1000_get_pcs_speed_and_duplex_82575(hw, &speed, &duplex); - else + /* + * Use this flag to determine if link needs to be checked or + * not. If we have link clear the flag so that we do not + * continue to check for link. + */ + hw->mac.get_link_status = !hw->mac.serdes_has_link; + } else { ret_val = e1000_check_for_copper_link_generic(hw); + } return ret_val; } +/** + * e1000_power_up_serdes_link_82575 - Power up the serdes link after shutdown + * @hw: pointer to the HW structure + **/ +static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw) +{ + u32 reg; + + DEBUGFUNC("e1000_power_up_serdes_link_82575"); + + if ((hw->phy.media_type != e1000_media_type_internal_serdes) && + !e1000_sgmii_active_82575(hw)) + return; + + /* Enable PCS to turn on link */ + reg = E1000_READ_REG(hw, E1000_PCS_CFG0); + reg |= E1000_PCS_CFG_PCS_EN; + E1000_WRITE_REG(hw, E1000_PCS_CFG0, reg); + + /* Power up the laser */ + reg = E1000_READ_REG(hw, E1000_CTRL_EXT); + reg &= ~E1000_CTRL_EXT_SDP3_DATA; + E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg); + + /* flush the write to verify completion */ + E1000_WRITE_FLUSH(hw); + msec_delay(1); +} + /** * e1000_get_pcs_speed_and_duplex_82575 - Retrieve current speed/duplex * @hw: pointer to the HW structure @@ -921,126 +1033,23 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, } /** - * e1000_init_rx_addrs_82575 - Initialize receive address's - * @hw: pointer to the HW structure - * @rar_count: receive address registers - * - * Setups the receive address registers by setting the base receive address - * register to the devices MAC address and clearing all the other receive - * address registers to 0. - **/ -static void e1000_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count) -{ - u32 i; - u8 addr[6] = {0,0,0,0,0,0}; - /* - * This function is essentially the same as that of - * e1000_init_rx_addrs_generic. However it also takes care - * of the special case where the register offset of the - * second set of RARs begins elsewhere. This is implicitly taken care by - * function e1000_rar_set_generic. - */ - - DEBUGFUNC("e1000_init_rx_addrs_82575"); - - /* Setup the receive address */ - DEBUGOUT("Programming MAC Address into RAR[0]\n"); - hw->mac.ops.rar_set(hw, hw->mac.addr, 0); - - /* Zero out the other (rar_entry_count - 1) receive addresses */ - DEBUGOUT1("Clearing RAR[1-%u]\n", rar_count-1); - for (i = 1; i < rar_count; i++) { - hw->mac.ops.rar_set(hw, addr, i); - } -} - -/** - * e1000_update_mc_addr_list_82575 - Update Multicast addresses - * @hw: pointer to the HW structure - * @mc_addr_list: array of multicast addresses to program - * @mc_addr_count: number of multicast addresses to program - * @rar_used_count: the first RAR register free to program - * @rar_count: total number of supported Receive Address Registers - * - * Updates the Receive Address Registers and Multicast Table Array. - * The caller must have a packed mc_addr_list of multicast addresses. - * The parameter rar_count will usually be hw->mac.rar_entry_count - * unless there are workarounds that change this. - **/ -static void e1000_update_mc_addr_list_82575(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count, - u32 rar_used_count, u32 rar_count) -{ - u32 hash_value; - u32 i; - u8 addr[6] = {0,0,0,0,0,0}; - /* - * This function is essentially the same as that of - * e1000_update_mc_addr_list_generic. However it also takes care - * of the special case where the register offset of the - * second set of RARs begins elsewhere. This is implicitly taken care by - * function e1000_rar_set_generic. - */ - - DEBUGFUNC("e1000_update_mc_addr_list_82575"); - - /* - * Load the first set of multicast addresses into the exact - * filters (RAR). If there are not enough to fill the RAR - * array, clear the filters. - */ - for (i = rar_used_count; i < rar_count; i++) { - if (mc_addr_count) { - e1000_rar_set_generic(hw, mc_addr_list, i); - mc_addr_count--; - mc_addr_list += ETH_ADDR_LEN; - } else { - e1000_rar_set_generic(hw, addr, i); - } - } - - /* Clear the old settings from the MTA */ - DEBUGOUT("Clearing MTA\n"); - for (i = 0; i < hw->mac.mta_reg_count; i++) { - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); - E1000_WRITE_FLUSH(hw); - } - - /* Load any remaining multicast addresses into the hash table. */ - for (; mc_addr_count > 0; mc_addr_count--) { - hash_value = e1000_hash_mc_addr(hw, mc_addr_list); - DEBUGOUT1("Hash value = 0x%03X\n", hash_value); - hw->mac.ops.mta_set(hw, hash_value); - mc_addr_list += ETH_ADDR_LEN; - } -} - -/** - * e1000_shutdown_fiber_serdes_link_82575 - Remove link during power down + * e1000_shutdown_serdes_link_82575 - Remove link during power down * @hw: pointer to the HW structure * - * In the case of fiber serdes shut down optics and PCS on driver unload + * In the case of serdes shut down sfp and PCS on driver unload * when management pass thru is not enabled. **/ -void e1000_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw) +void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw) { u32 reg; - u16 eeprom_data = 0; - if (hw->mac.type != e1000_82576 || - (hw->phy.media_type != e1000_media_type_fiber && - hw->phy.media_type != e1000_media_type_internal_serdes)) + DEBUGFUNC("e1000_shutdown_serdes_link_82575"); + + if ((hw->phy.media_type != e1000_media_type_internal_serdes) && + !e1000_sgmii_active_82575(hw)) return; - if (hw->bus.func == 0) - hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); - - /* - * If APM is not enabled in the EEPROM and management interface is - * not enabled, then power down. - */ - if (!(eeprom_data & E1000_NVM_APME_82575) && - !e1000_enable_mng_pass_thru(hw)) { + if (!e1000_enable_mng_pass_thru(hw)) { /* Disable PCS to turn off link */ reg = E1000_READ_REG(hw, E1000_PCS_CFG0); reg &= ~E1000_PCS_CFG_PCS_EN; @@ -1048,10 +1057,10 @@ void e1000_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw) /* shutdown the laser */ reg = E1000_READ_REG(hw, E1000_CTRL_EXT); - reg |= E1000_CTRL_EXT_SDP7_DATA; + reg |= E1000_CTRL_EXT_SDP3_DATA; E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg); - /* flush the write to verfiy completion */ + /* flush the write to verify completion */ E1000_WRITE_FLUSH(hw); msec_delay(1); } @@ -1081,6 +1090,12 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) DEBUGOUT("PCI-E Master disable polling has failed.\n"); } + /* set the completion timeout for interface */ + ret_val = e1000_set_pcie_completion_timeout(hw); + if (ret_val) { + DEBUGOUT("PCI-E Set completion timeout has failed.\n"); + } + DEBUGOUT("Masking off all interrupts\n"); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); @@ -1113,7 +1128,8 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); icr = E1000_READ_REG(hw, E1000_ICR); - e1000_check_alt_mac_addr_generic(hw); + /* Install any alternate MAC address into RAR0 */ + ret_val = e1000_check_alt_mac_addr_generic(hw); return ret_val; } @@ -1133,7 +1149,7 @@ static s32 e1000_init_hw_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_init_hw_82575"); /* Initialize identification LED */ - ret_val = e1000_id_led_init_generic(hw); + ret_val = mac->ops.id_led_init(hw); if (ret_val) { DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ @@ -1144,12 +1160,18 @@ static s32 e1000_init_hw_82575(struct e1000_hw *hw) mac->ops.clear_vfta(hw); /* Setup the receive address */ - e1000_init_rx_addrs_82575(hw, rar_count); + e1000_init_rx_addrs_generic(hw, rar_count); + /* Zero out the Multicast HASH table */ DEBUGOUT("Zeroing the MTA\n"); for (i = 0; i < mac->mta_reg_count; i++) E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); + /* Zero out the Unicast HASH table */ + DEBUGOUT("Zeroing the UTA\n"); + for (i = 0; i < mac->uta_reg_count; i++) + E1000_WRITE_REG_ARRAY(hw, E1000_UTA, i, 0); + /* Setup link and flow control */ ret_val = mac->ops.setup_link(hw); @@ -1174,9 +1196,8 @@ static s32 e1000_init_hw_82575(struct e1000_hw *hw) **/ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) { - u32 ctrl, led_ctrl; + u32 ctrl; s32 ret_val; - bool link; DEBUGFUNC("e1000_setup_copper_link_82575"); @@ -1185,17 +1206,29 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + ret_val = e1000_setup_serdes_link_82575(hw); + if (ret_val) + goto out; + + if (e1000_sgmii_active_82575(hw) && !hw->phy.reset_disable) { + /* allow time for SFP cage time to power up phy */ + msec_delay(300); + + ret_val = hw->phy.ops.reset(hw); + if (ret_val) { + DEBUGOUT("Error resetting the PHY.\n"); + goto out; + } + } switch (hw->phy.type) { case e1000_phy_m88: ret_val = e1000_copper_link_setup_m88(hw); break; case e1000_phy_igp_3: ret_val = e1000_copper_link_setup_igp(hw); - /* Setup activity LED */ - led_ctrl = E1000_READ_REG(hw, E1000_LEDCTL); - led_ctrl &= IGP_ACTIVITY_LED_MASK; - led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); - E1000_WRITE_REG(hw, E1000_LEDCTL, led_ctrl); + break; + case e1000_phy_82580: + ret_val = e1000_copper_link_setup_82577(hw); break; default: ret_val = -E1000_ERR_PHY; @@ -1205,66 +1238,30 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) if (ret_val) goto out; - if (hw->mac.autoneg) { - /* - * Setup autoneg and flow control advertisement - * and perform autonegotiation. - */ - ret_val = e1000_copper_link_autoneg(hw); - if (ret_val) - goto out; - } else { - /* - * PHY will be set to 10H, 10F, 100H or 100F - * depending on user settings. - */ - DEBUGOUT("Forcing Speed and Duplex\n"); - ret_val = hw->phy.ops.force_speed_duplex(hw); - if (ret_val) { - DEBUGOUT("Error Forcing Speed and Duplex\n"); - goto out; - } - } - - ret_val = e1000_configure_pcs_link_82575(hw); - if (ret_val) - goto out; - - /* - * Check link status. Wait up to 100 microseconds for link to become - * valid. - */ - ret_val = e1000_phy_has_link_generic(hw, - COPPER_LINK_UP_LIMIT, - 10, - &link); - if (ret_val) - goto out; - - if (link) { - DEBUGOUT("Valid link established!!!\n"); - /* Config the MAC and PHY after link is up */ - e1000_config_collision_dist_generic(hw); - ret_val = e1000_config_fc_after_link_up_generic(hw); - } else { - DEBUGOUT("Unable to establish link!!!\n"); - } - + ret_val = e1000_setup_copper_link_generic(hw); out: return ret_val; } /** - * e1000_setup_fiber_serdes_link_82575 - Setup link for fiber/serdes + * e1000_setup_serdes_link_82575 - Setup link for serdes * @hw: pointer to the HW structure * - * Configures speed and duplex for fiber and serdes links. + * Configure the physical coding sub-layer (PCS) link. The PCS link is + * used on copper connections where the serialized gigabit media independent + * interface (sgmii), or serdes fiber is being used. Configures the link + * for auto-negotiation or forces speed/duplex. **/ -static s32 e1000_setup_fiber_serdes_link_82575(struct e1000_hw *hw) +static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) { - u32 reg; + u32 ctrl_ext, ctrl_reg, reg; + bool pcs_autoneg; - DEBUGFUNC("e1000_setup_fiber_serdes_link_82575"); + DEBUGFUNC("e1000_setup_serdes_link_82575"); + + if ((hw->phy.media_type != e1000_media_type_internal_serdes) && + !e1000_sgmii_active_82575(hw)) + return E1000_SUCCESS; /* * On the 82575, SerDes loopback mode persists until it is @@ -1274,26 +1271,49 @@ static s32 e1000_setup_fiber_serdes_link_82575(struct e1000_hw *hw) */ E1000_WRITE_REG(hw, E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK); - /* Force link up, set 1gb, set both sw defined pins */ - reg = E1000_READ_REG(hw, E1000_CTRL); - reg |= E1000_CTRL_SLU | - E1000_CTRL_SPD_1000 | - E1000_CTRL_FRCSPD | - E1000_CTRL_SWDPIN0 | - E1000_CTRL_SWDPIN1; - E1000_WRITE_REG(hw, E1000_CTRL, reg); + /* power on the sfp cage if present */ + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + ctrl_ext &= ~E1000_CTRL_EXT_SDP3_DATA; + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); - /* Power on phy for 82576 fiber adapters */ - if (hw->mac.type == e1000_82576) { - reg = E1000_READ_REG(hw, E1000_CTRL_EXT); - reg &= ~E1000_CTRL_EXT_SDP7_DATA; - E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg); + ctrl_reg = E1000_READ_REG(hw, E1000_CTRL); + ctrl_reg |= E1000_CTRL_SLU; + + /* set both sw defined pins on 82575/82576*/ + if (hw->mac.type == e1000_82575 || hw->mac.type == e1000_82576) + ctrl_reg |= E1000_CTRL_SWDPIN0 | E1000_CTRL_SWDPIN1; + + reg = E1000_READ_REG(hw, E1000_PCS_LCTL); + + /* default pcs_autoneg to the same setting as mac autoneg */ + pcs_autoneg = hw->mac.autoneg; + + switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) { + case E1000_CTRL_EXT_LINK_MODE_SGMII: + /* sgmii mode lets the phy handle forcing speed/duplex */ + pcs_autoneg = TRUE; + /* autoneg time out should be disabled for SGMII mode */ + reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT); + break; + case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: + /* disable PCS autoneg and support parallel detect only */ + pcs_autoneg = FALSE; + /* fall through to default case */ + default: + /* + * non-SGMII modes only supports a speed of 1000/Full for the + * link so it is best to just force the MAC and let the pcs + * link either autoneg or be forced to 1000/Full + */ + ctrl_reg |= E1000_CTRL_SPD_1000 | E1000_CTRL_FRCSPD | + E1000_CTRL_FD | E1000_CTRL_FRCDPX; + + /* set speed of 1000/Full if speed/duplex is forced */ + reg |= E1000_PCS_LCTL_FSV_1000 | E1000_PCS_LCTL_FDV_FULL; + break; } - /* Set switch control to serdes energy detect */ - reg = E1000_READ_REG(hw, E1000_CONNSW); - reg |= E1000_CONNSW_ENRGSRC; - E1000_WRITE_REG(hw, E1000_CONNSW, reg); + E1000_WRITE_REG(hw, E1000_CTRL, ctrl_reg); /* * New SerDes mode allows for forcing speed or autonegotiating speed @@ -1301,35 +1321,31 @@ static s32 e1000_setup_fiber_serdes_link_82575(struct e1000_hw *hw) * mode that will be compatible with older link partners and switches. * However, both are supported by the hardware and some drivers/tools. */ - reg = E1000_READ_REG(hw, E1000_PCS_LCTL); - reg &= ~(E1000_PCS_LCTL_AN_ENABLE | E1000_PCS_LCTL_FLV_LINK_UP | - E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK); + E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK); - if (hw->mac.autoneg) { + /* + * We force flow control to prevent the CTRL register values from being + * overwritten by the autonegotiated flow control values + */ + reg |= E1000_PCS_LCTL_FORCE_FCTRL; + + if (pcs_autoneg) { /* Set PCS register for autoneg */ - reg |= E1000_PCS_LCTL_FSV_1000 | /* Force 1000 */ - E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */ - E1000_PCS_LCTL_AN_ENABLE | /* Enable Autoneg */ - E1000_PCS_LCTL_AN_RESTART; /* Restart autoneg */ - DEBUGOUT1("Configuring Autoneg; PCS_LCTL = 0x%08X\n", reg); + reg |= E1000_PCS_LCTL_AN_ENABLE | /* Enable Autoneg */ + E1000_PCS_LCTL_AN_RESTART; /* Restart autoneg */ + DEBUGOUT1("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg); } else { - /* Set PCS register for forced speed */ - reg |= E1000_PCS_LCTL_FLV_LINK_UP | /* Force link up */ - E1000_PCS_LCTL_FSV_1000 | /* Force 1000 */ - E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */ - E1000_PCS_LCTL_FSD | /* Force Speed */ - E1000_PCS_LCTL_FORCE_LINK; /* Force Link */ - DEBUGOUT1("Configuring Forced Link; PCS_LCTL = 0x%08X\n", reg); - } - - if (hw->mac.type == e1000_82576) { - reg |= E1000_PCS_LCTL_FORCE_FCTRL; - e1000_force_mac_fc_generic(hw); + /* Set PCS register for forced link */ + reg |= E1000_PCS_LCTL_FSD; /* Force Speed */ + DEBUGOUT1("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg); } E1000_WRITE_REG(hw, E1000_PCS_LCTL, reg); + if (!e1000_sgmii_active_82575(hw)) + e1000_force_mac_fc_generic(hw); + return E1000_SUCCESS; } @@ -1355,7 +1371,6 @@ static s32 e1000_valid_led_default_82575(struct e1000_hw *hw, u16 *data) if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) { switch(hw->phy.media_type) { - case e1000_media_type_fiber: case e1000_media_type_internal_serdes: *data = ID_LED_DEFAULT_82575_SERDES; break; @@ -1369,72 +1384,6 @@ out: return ret_val; } -/** - * e1000_configure_pcs_link_82575 - Configure PCS link - * @hw: pointer to the HW structure - * - * Configure the physical coding sub-layer (PCS) link. The PCS link is - * only used on copper connections where the serialized gigabit media - * independent interface (sgmii) is being used. Configures the link - * for auto-negotiation or forces speed/duplex. - **/ -static s32 e1000_configure_pcs_link_82575(struct e1000_hw *hw) -{ - struct e1000_mac_info *mac = &hw->mac; - u32 reg = 0; - - DEBUGFUNC("e1000_configure_pcs_link_82575"); - - if (hw->phy.media_type != e1000_media_type_copper || - !(e1000_sgmii_active_82575(hw))) - goto out; - - /* For SGMII, we need to issue a PCS autoneg restart */ - reg = E1000_READ_REG(hw, E1000_PCS_LCTL); - - /* AN time out should be disabled for SGMII mode */ - reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT); - - if (mac->autoneg) { - /* Make sure forced speed and force link are not set */ - reg &= ~(E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK); - - /* - * The PHY should be setup prior to calling this function. - * All we need to do is restart autoneg and enable autoneg. - */ - reg |= E1000_PCS_LCTL_AN_RESTART | E1000_PCS_LCTL_AN_ENABLE; - } else { - /* Set PCS register for forced speed */ - - /* Turn off bits for full duplex, speed, and autoneg */ - reg &= ~(E1000_PCS_LCTL_FSV_1000 | - E1000_PCS_LCTL_FSV_100 | - E1000_PCS_LCTL_FDV_FULL | - E1000_PCS_LCTL_AN_ENABLE); - - /* Check for duplex first */ - if (mac->forced_speed_duplex & E1000_ALL_FULL_DUPLEX) - reg |= E1000_PCS_LCTL_FDV_FULL; - - /* Now set speed */ - if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) - reg |= E1000_PCS_LCTL_FSV_100; - - /* Force speed and force link */ - reg |= E1000_PCS_LCTL_FSD | - E1000_PCS_LCTL_FORCE_LINK | - E1000_PCS_LCTL_FLV_LINK_UP; - - DEBUGOUT1("Wrote 0x%08X to PCS_LCTL to configure forced link\n", - reg); - } - E1000_WRITE_REG(hw, E1000_PCS_LCTL, reg); - -out: - return E1000_SUCCESS; -} - /** * e1000_sgmii_active_82575 - Return sgmii state * @hw: pointer to the HW structure @@ -1446,12 +1395,6 @@ out: static bool e1000_sgmii_active_82575(struct e1000_hw *hw) { struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; - - DEBUGFUNC("e1000_sgmii_active_82575"); - - if (hw->mac.type != e1000_82575 && hw->mac.type != e1000_82576) - return FALSE; - return dev_spec->sgmii_active; } @@ -1502,12 +1445,44 @@ static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw) s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_read_mac_addr_82575"); - if (e1000_check_alt_mac_addr_generic(hw)) - ret_val = e1000_read_mac_addr_generic(hw); + /* + * If there's an alternate MAC address place it in RAR0 + * so that it will override the Si installed default perm + * address. + */ + ret_val = e1000_check_alt_mac_addr_generic(hw); + if (ret_val) + goto out; + + ret_val = e1000_read_mac_addr_generic(hw); + +out: return ret_val; } +/** + * e1000_config_collision_dist_82575 - Configure collision distance + * @hw: pointer to the HW structure + * + * Configures the collision distance to the default value and is used + * during link setup. + **/ +static void e1000_config_collision_dist_82575(struct e1000_hw *hw) +{ + u32 tctl_ext; + + DEBUGFUNC("e1000_config_collision_dist_82575"); + + tctl_ext = E1000_READ_REG(hw, E1000_TCTL_EXT); + + tctl_ext &= ~E1000_TCTL_EXT_COLD; + tctl_ext |= E1000_COLLISION_DISTANCE << E1000_TCTL_EXT_COLD_SHIFT; + + E1000_WRITE_REG(hw, E1000_TCTL_EXT, tctl_ext); + E1000_WRITE_FLUSH(hw); +} + /** * e1000_power_down_phy_copper_82575 - Remove link during PHY power down * @hw: pointer to the HW structure @@ -1518,13 +1493,12 @@ static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw) static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; - struct e1000_mac_info *mac = &hw->mac; if (!(phy->ops.check_reset_block)) return; /* If the management interface is not enabled, then power down */ - if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw))) + if (!(e1000_enable_mng_pass_thru(hw) || phy->ops.check_reset_block(hw))) e1000_power_down_phy_copper(hw); return; @@ -1590,9 +1564,11 @@ static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_LENERRS); /* This register should not be read in copper configurations */ - if (hw->phy.media_type == e1000_media_type_internal_serdes) + if ((hw->phy.media_type == e1000_media_type_internal_serdes) || + e1000_sgmii_active_82575(hw)) E1000_READ_REG(hw, E1000_SCVPC); } + /** * e1000_rx_fifo_flush_82575 - Clean rx fifo after RX enable * @hw: pointer to the HW structure @@ -1667,3 +1643,335 @@ void e1000_rx_fifo_flush_82575(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_MPC); } +/** + * e1000_set_pcie_completion_timeout - set pci-e completion timeout + * @hw: pointer to the HW structure + * + * The defaults for 82575 and 82576 should be in the range of 50us to 50ms, + * however the hardware default for these parts is 500us to 1ms which is less + * than the 10ms recommended by the pci-e spec. To address this we need to + * increase the value to either 10ms to 200ms for capability version 1 config, + * or 16ms to 55ms for version 2. + **/ +static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw) +{ + u32 gcr = E1000_READ_REG(hw, E1000_GCR); + s32 ret_val = E1000_SUCCESS; + u16 pcie_devctl2; + + /* only take action if timeout value is defaulted to 0 */ + if (gcr & E1000_GCR_CMPL_TMOUT_MASK) + goto out; + + /* + * if capababilities version is type 1 we can write the + * timeout of 10ms to 200ms through the GCR register + */ + if (!(gcr & E1000_GCR_CAP_VER2)) { + gcr |= E1000_GCR_CMPL_TMOUT_10ms; + goto out; + } + + /* + * for version 2 capabilities we need to write the config space + * directly in order to set the completion timeout value for + * 16ms to 55ms + */ + ret_val = e1000_read_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2, + &pcie_devctl2); + if (ret_val) + goto out; + + pcie_devctl2 |= PCIE_DEVICE_CONTROL2_16ms; + + ret_val = e1000_write_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2, + &pcie_devctl2); +out: + /* disable completion timeout resend */ + gcr &= ~E1000_GCR_CMPL_TMOUT_RESEND; + + E1000_WRITE_REG(hw, E1000_GCR, gcr); + return ret_val; +} + + +/** + * e1000_vmdq_set_anti_spoofing_pf - enable or disable anti-spoofing + * @hw: pointer to the hardware struct + * @enable: state to enter, either enabled or disabled + * @pf: Physical Function pool - do not set anti-spoofing for the PF + * + * enables/disables L2 switch anti-spoofing functionality. + **/ +void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) +{ + u32 dtxswc; + + switch (hw->mac.type) { + case e1000_82576: + dtxswc = E1000_READ_REG(hw, E1000_DTXSWC); + if (enable) { + dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK | + E1000_DTXSWC_VLAN_SPOOF_MASK); + /* The PF can spoof - it has to in order to + * support emulation mode NICs */ + dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); + } else { + dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | + E1000_DTXSWC_VLAN_SPOOF_MASK); + } + E1000_WRITE_REG(hw, E1000_DTXSWC, dtxswc); + break; + default: + break; + } +} + +/** + * e1000_vmdq_set_loopback_pf - enable or disable vmdq loopback + * @hw: pointer to the hardware struct + * @enable: state to enter, either enabled or disabled + * + * enables/disables L2 switch loopback functionality. + **/ +void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable) +{ + u32 dtxswc; + + switch (hw->mac.type) { + case e1000_82576: + dtxswc = E1000_READ_REG(hw, E1000_DTXSWC); + if (enable) + dtxswc |= E1000_DTXSWC_VMDQ_LOOPBACK_EN; + else + dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN; + E1000_WRITE_REG(hw, E1000_DTXSWC, dtxswc); + break; + default: + /* Currently no other hardware supports loopback */ + break; + } + + +} + +/** + * e1000_vmdq_set_replication_pf - enable or disable vmdq replication + * @hw: pointer to the hardware struct + * @enable: state to enter, either enabled or disabled + * + * enables/disables replication of packets across multiple pools. + **/ +void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable) +{ + u32 vt_ctl = E1000_READ_REG(hw, E1000_VT_CTL); + + if (enable) + vt_ctl |= E1000_VT_CTL_VM_REPL_EN; + else + vt_ctl &= ~E1000_VT_CTL_VM_REPL_EN; + + E1000_WRITE_REG(hw, E1000_VT_CTL, vt_ctl); +} + +/** + * e1000_read_phy_reg_82580 - Read 82580 MDI control register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Reads the MDI control register in the PHY at offset and stores the + * information read to data. + **/ +static s32 e1000_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data) +{ + s32 ret_val; + + DEBUGFUNC("e1000_read_phy_reg_82580"); + + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + + ret_val = e1000_read_phy_reg_mdic(hw, offset, data); + + hw->phy.ops.release(hw); + +out: + return ret_val; +} + +/** + * e1000_write_phy_reg_82580 - Write 82580 MDI control register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write to register at offset + * + * Writes data to MDI control register in the PHY at offset. + **/ +static s32 e1000_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data) +{ + s32 ret_val; + + DEBUGFUNC("e1000_write_phy_reg_82580"); + + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + + ret_val = e1000_write_phy_reg_mdic(hw, offset, data); + + hw->phy.ops.release(hw); + +out: + return ret_val; +} + +/** + * e1000_reset_mdicnfg_82580 - Reset MDICNFG destination and com_mdio bits + * @hw: pointer to the HW structure + * + * This resets the the MDICNFG.Destination and MDICNFG.Com_MDIO bits based on + * the values found in the EEPROM. This addresses an issue in which these + * bits are not restored from EEPROM after reset. + **/ +static s32 e1000_reset_mdicnfg_82580(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u32 mdicnfg; + u16 nvm_data; + + DEBUGFUNC("e1000_reset_mdicnfg_82580"); + + if (hw->mac.type != e1000_82580) + goto out; + if (!e1000_sgmii_active_82575(hw)) + goto out; + + ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + + NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, + &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + mdicnfg = E1000_READ_REG(hw, E1000_MDICNFG); + if (nvm_data & NVM_WORD24_EXT_MDIO) + mdicnfg |= E1000_MDICNFG_EXT_MDIO; + if (nvm_data & NVM_WORD24_COM_MDIO) + mdicnfg |= E1000_MDICNFG_COM_MDIO; + E1000_WRITE_REG(hw, E1000_MDICNFG, mdicnfg); +out: + return ret_val; +} + +/** + * e1000_reset_hw_82580 - Reset hardware + * @hw: pointer to the HW structure + * + * This resets function or entire device (all ports, etc.) + * to a known state. + **/ +static s32 e1000_reset_hw_82580(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + /* BH SW mailbox bit in SW_FW_SYNC */ + u16 swmbsw_mask = E1000_SW_SYNCH_MB; + u32 ctrl, icr; + bool global_device_reset = hw->dev_spec._82575.global_device_reset; + + DEBUGFUNC("e1000_reset_hw_82580"); + + hw->dev_spec._82575.global_device_reset = FALSE; + + /* Get current control state. */ + ctrl = E1000_READ_REG(hw, E1000_CTRL); + + /* + * Prevent the PCI-E bus from sticking if there is no TLP connection + * on the last TLP read/write transaction when MAC is reset. + */ + ret_val = e1000_disable_pcie_master_generic(hw); + if (ret_val) + DEBUGOUT("PCI-E Master disable polling has failed.\n"); + + DEBUGOUT("Masking off all interrupts\n"); + E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); + E1000_WRITE_REG(hw, E1000_RCTL, 0); + E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP); + E1000_WRITE_FLUSH(hw); + + msec_delay(10); + + /* Determine whether or not a global dev reset is requested */ + if (global_device_reset && + e1000_acquire_swfw_sync_82575(hw, swmbsw_mask)) + global_device_reset = FALSE; + + if (global_device_reset && + !(E1000_READ_REG(hw, E1000_STATUS) & E1000_STAT_DEV_RST_SET)) + ctrl |= E1000_CTRL_DEV_RST; + else + ctrl |= E1000_CTRL_RST; + + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + + /* Add delay to insure DEV_RST has time to complete */ + if (global_device_reset) + msec_delay(5); + + ret_val = e1000_get_auto_rd_done_generic(hw); + if (ret_val) { + /* + * When auto config read does not complete, do not + * return with an error. This can happen in situations + * where there is no eeprom and prevents getting link. + */ + DEBUGOUT("Auto Read Done did not complete\n"); + } + + /* If EEPROM is not present, run manual init scripts */ + if ((E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) == 0) + e1000_reset_init_script_82575(hw); + + /* clear global device reset status bit */ + E1000_WRITE_REG(hw, E1000_STATUS, E1000_STAT_DEV_RST_SET); + + /* Clear any pending interrupt events. */ + E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); + icr = E1000_READ_REG(hw, E1000_ICR); + + ret_val = e1000_reset_mdicnfg_82580(hw); + if (ret_val) + DEBUGOUT("Could not reset MDICNFG based on EEPROM\n"); + + /* Install any alternate MAC address into RAR0 */ + ret_val = e1000_check_alt_mac_addr_generic(hw); + + /* Release semaphore */ + if (global_device_reset) + e1000_release_swfw_sync_82575(hw, swmbsw_mask); + + return ret_val; +} + +/** + * e1000_rxpbs_adjust_82580 - adjust RXPBS value to reflect actual RX PBA size + * @data: data received by reading RXPBS register + * + * The 82580 uses a table based approach for packet buffer allocation sizes. + * This function converts the retrieved value into the correct table value + * 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 + * 0x0 36 72 144 1 2 4 8 16 + * 0x8 35 70 140 rsv rsv rsv rsv rsv + */ +u16 e1000_rxpbs_adjust_82580(u32 data) +{ + u16 ret_val = 0; + + if (data < E1000_82580_RXPBS_TABLE_SIZE) + ret_val = e1000_82580_rxpbs_table[data]; + + return ret_val; +} diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.h index 16c410061a..b57b54fc72 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82575.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_82575.h,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_82575_H_ #define _E1000_82575_H_ @@ -49,12 +49,16 @@ * For 82576, there are an additional set of RARs that begin at an offset * separate from the first set of RARs. */ -#define E1000_RAR_ENTRIES_82575 16 -#define E1000_RAR_ENTRIES_82576 24 +#define E1000_RAR_ENTRIES_82575 16 +#define E1000_RAR_ENTRIES_82576 24 +#define E1000_RAR_ENTRIES_82580 24 +#define E1000_SW_SYNCH_MB 0x00000100 +#define E1000_STAT_DEV_RST_SET 0x00100000 +#define E1000_CTRL_DEV_RST 0x20000000 #ifdef E1000_BIT_FIELDS struct e1000_adv_data_desc { - u64 buffer_addr; /* Address of the descriptor's data buffer */ + __le64 buffer_addr; /* Address of the descriptor's data buffer */ union { u32 data; struct { @@ -128,6 +132,8 @@ struct e1000_adv_context_desc { #define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION 0x06000000 #define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000 #define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000 +#define E1000_SRRCTL_TIMESTAMP 0x40000000 +#define E1000_SRRCTL_DROP_EN 0x80000000 #define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F #define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00 @@ -137,9 +143,11 @@ struct e1000_adv_context_desc { #define E1000_MRQC_ENABLE_RSS_4Q 0x00000002 #define E1000_MRQC_ENABLE_VMDQ 0x00000003 +#define E1000_MRQC_ENABLE_VMDQ_RSS_2Q 0x00000005 #define E1000_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 #define E1000_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 #define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX 0x01000000 +#define E1000_MRQC_ENABLE_RSS_8Q 0x00000002 #define E1000_VMRCTL_MIRROR_PORT_SHIFT 8 #define E1000_VMRCTL_MIRROR_DSTPORT_MASK (7 << E1000_VMRCTL_MIRROR_PORT_SHIFT) @@ -183,41 +191,43 @@ struct e1000_adv_context_desc { /* Receive Descriptor - Advanced */ union e1000_adv_rx_desc { struct { - u64 pkt_addr; /* Packet buffer address */ - u64 hdr_addr; /* Header buffer address */ + __le64 pkt_addr; /* Packet buffer address */ + __le64 hdr_addr; /* Header buffer address */ } read; struct { struct { union { - u32 data; + __le32 data; struct { - u16 pkt_info; /* RSS type, Packet type */ - u16 hdr_info; /* Split Header, - * header buffer length */ + __le16 pkt_info; /*RSS type, Pkt type*/ + __le16 hdr_info; /* Split Header, + * header buffer len*/ } hs_rss; } lo_dword; union { - u32 rss; /* RSS Hash */ + __le32 rss; /* RSS Hash */ struct { - u16 ip_id; /* IP id */ - u16 csum; /* Packet Checksum */ + __le16 ip_id; /* IP id */ + __le16 csum; /* Packet Checksum */ } csum_ip; } hi_dword; } lower; struct { - u32 status_error; /* ext status/error */ - u16 length; /* Packet length */ - u16 vlan; /* VLAN tag */ + __le32 status_error; /* ext status/error */ + __le16 length; /* Packet length */ + __le16 vlan; /* VLAN tag */ } upper; } wb; /* writeback */ }; -#define E1000_RXDADV_RSSTYPE_MASK 0x0000F000 +#define E1000_RXDADV_RSSTYPE_MASK 0x0000000F #define E1000_RXDADV_RSSTYPE_SHIFT 12 #define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0 #define E1000_RXDADV_HDRBUFLEN_SHIFT 5 #define E1000_RXDADV_SPLITHEADER_EN 0x00001000 #define E1000_RXDADV_SPH 0x8000 +#define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */ +#define E1000_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */ #define E1000_RXDADV_ERR_HBO 0x00800000 /* RSS Hash results */ @@ -267,14 +277,14 @@ union e1000_adv_rx_desc { /* Transmit Descriptor - Advanced */ union e1000_adv_tx_desc { struct { - u64 buffer_addr; /* Address of descriptor's data buf */ - u32 cmd_type_len; - u32 olinfo_status; + __le64 buffer_addr; /* Address of descriptor's data buf */ + __le32 cmd_type_len; + __le32 olinfo_status; } read; struct { - u64 rsvd; /* Reserved */ - u32 nxtseq_seed; - u32 status; + __le64 rsvd; /* Reserved */ + __le32 nxtseq_seed; + __le32 status; } wb; }; @@ -301,10 +311,10 @@ union e1000_adv_tx_desc { /* Context descriptors */ struct e1000_adv_tx_context_desc { - u32 vlan_macip_lens; - u32 seqnum_seed; - u32 type_tucmd_mlhl; - u32 mss_l4len_idx; + __le32 vlan_macip_lens; + __le32 seqnum_seed; + __le32 type_tucmd_mlhl; + __le32 mss_l4len_idx; }; #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ @@ -313,6 +323,7 @@ struct e1000_adv_tx_context_desc { #define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ #define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ #define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ +#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ #define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ /* IPSec Encrypt Enable for ESP */ #define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000 @@ -375,12 +386,22 @@ struct e1000_adv_tx_context_desc { */ #define E1000_ETQF_FILTER_EAPOL 0 +#define E1000_FTQF_VF_BP 0x00008000 +#define E1000_FTQF_1588_TIME_STAMP 0x08000000 +#define E1000_FTQF_MASK 0xF0000000 +#define E1000_FTQF_MASK_PROTO_BP 0x10000000 +#define E1000_FTQF_MASK_SOURCE_ADDR_BP 0x20000000 +#define E1000_FTQF_MASK_DEST_ADDR_BP 0x40000000 +#define E1000_FTQF_MASK_SOURCE_PORT_BP 0x80000000 + #define E1000_NVM_APME_82575 0x0400 #define MAX_NUM_VFS 8 #define E1000_DTXSWC_MAC_SPOOF_MASK 0x000000FF /* Per VF MAC spoof control */ #define E1000_DTXSWC_VLAN_SPOOF_MASK 0x0000FF00 /* Per VF VLAN spoof control */ #define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */ +#define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8 +#define E1000_DTXSWC_LLE_SHIFT 16 #define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */ /* Easy defines for setting default pool, would normally be left a zero */ @@ -393,82 +414,62 @@ struct e1000_adv_tx_context_desc { #define E1000_VT_CTL_VM_REPL_EN (1 << 30) /* Per VM Offload register setup */ +#define E1000_VMOLR_RLPML_MASK 0x00003FFF /* Long Packet Maximum Length mask */ #define E1000_VMOLR_LPE 0x00010000 /* Accept Long packet */ +#define E1000_VMOLR_RSSE 0x00020000 /* Enable RSS */ #define E1000_VMOLR_AUPE 0x01000000 /* Accept untagged packets */ +#define E1000_VMOLR_ROMPE 0x02000000 /* Accept overflow multicast */ +#define E1000_VMOLR_ROPE 0x04000000 /* Accept overflow unicast */ #define E1000_VMOLR_BAM 0x08000000 /* Accept Broadcast packets */ #define E1000_VMOLR_MPME 0x10000000 /* Multicast promiscuous mode */ #define E1000_VMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */ +#define E1000_VMOLR_STRCRC 0x80000000 /* CRC stripping enable */ -#define E1000_V2PMAILBOX_REQ 0x00000001 /* Request for PF Ready bit */ -#define E1000_V2PMAILBOX_ACK 0x00000002 /* Ack PF message received */ -#define E1000_V2PMAILBOX_VFU 0x00000004 /* VF owns the mailbox buffer */ -#define E1000_V2PMAILBOX_PFU 0x00000008 /* PF owns the mailbox buffer */ -#define E1000_V2PMAILBOX_PFSTS 0x00000010 /* PF wrote a message in the MB */ -#define E1000_V2PMAILBOX_PFACK 0x00000020 /* PF ack the previous VF msg */ -#define E1000_V2PMAILBOX_RSTI 0x00000040 /* PF has reset indication */ -#define E1000_P2VMAILBOX_STS 0x00000001 /* Initiate message send to VF */ -#define E1000_P2VMAILBOX_ACK 0x00000002 /* Ack message recv'd from VF */ -#define E1000_P2VMAILBOX_VFU 0x00000004 /* VF owns the mailbox buffer */ -#define E1000_P2VMAILBOX_PFU 0x00000008 /* PF owns the mailbox buffer */ -#define E1000_P2VMAILBOX_RVFU 0x00000010 /* Reset VFU - used when VF stuck */ +#define E1000_VLVF_ARRAY_SIZE 32 +#define E1000_VLVF_VLANID_MASK 0x00000FFF +#define E1000_VLVF_POOLSEL_SHIFT 12 +#define E1000_VLVF_POOLSEL_MASK (0xFF << E1000_VLVF_POOLSEL_SHIFT) +#define E1000_VLVF_LVLAN 0x00100000 +#define E1000_VLVF_VLANID_ENABLE 0x80000000 -#define E1000_VFMAILBOX_SIZE 16 /* 16 32 bit words - 64 bytes */ +#define E1000_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */ +#define E1000_VMVIR_VLANA_NEVER 0x80000000 /* Never insert VLAN tag */ -/* If it's a E1000_VF_* msg then it originates in the VF and is sent to the - * PF. The reverse is TRUE if it is E1000_PF_*. - * Message ACK's are the value or'd with 0xF0000000 - */ -#define E1000_VT_MSGTYPE_ACK 0xF0000000 /* Messages below or'd with - * this are the ACK */ -#define E1000_VT_MSGTYPE_NACK 0xFF000000 /* Messages below or'd with - * this are the NACK */ -#define E1000_VT_MSGINFO_SHIFT 16 -/* bits 23:16 are used for exra info for certain messages */ -#define E1000_VT_MSGINFO_MASK (0xFF << E1000_VT_MSGINFO_SHIFT) +#define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */ -#define E1000_VF_MSGTYPE_REQ_MAC 1 /* VF needs to know its MAC */ -#define E1000_VF_MSGTYPE_VFLR 2 /* VF notifies VFLR to PF */ -#define E1000_VF_SET_MULTICAST 3 /* VF requests PF to set MC addr */ -#define E1000_VF_SET_VLAN 4 /* VF requests PF to set VLAN */ +#define E1000_IOVCTL 0x05BBC +#define E1000_IOVCTL_REUSE_VFQ 0x00000001 -/* Add 100h to all PF msgs, leaves room for up to 255 discrete message types - * from VF to PF - way more than we'll ever need */ -#define E1000_PF_MSGTYPE_RESET (1 + 0x100) /* PF notifies global reset - * imminent to VF */ -#define E1000_PF_MSGTYPE_LSC (2 + 0x100) /* PF notifies VF of LSC... VF - * will see extra msg info for - * status */ +#define E1000_RPLOLR_STRVLAN 0x40000000 +#define E1000_RPLOLR_STRCRC 0x80000000 -#define E1000_PF_MSG_LSCDOWN (1 << E1000_VT_MSGINFO_SHIFT) -#define E1000_PF_MSG_LSCUP (2 << E1000_VT_MSGINFO_SHIFT) +#define E1000_TCTL_EXT_COLD 0x000FFC00 +#define E1000_TCTL_EXT_COLD_SHIFT 10 + +#define E1000_DTXCTL_8023LL 0x0004 +#define E1000_DTXCTL_VLAN_ADDED 0x0008 +#define E1000_DTXCTL_OOS_ENABLE 0x0010 +#define E1000_DTXCTL_MDP_EN 0x0020 +#define E1000_DTXCTL_SPOOF_INT 0x0040 #define ALL_QUEUES 0xFFFF -s32 e1000_send_mail_to_pf_vf(struct e1000_hw *hw, u32 *msg, - s16 size); -s32 e1000_receive_mail_from_pf_vf(struct e1000_hw *hw, - u32 *msg, s16 size); -s32 e1000_send_mail_to_vf(struct e1000_hw *hw, u32 *msg, - u32 vf_number, s16 size); -s32 e1000_receive_mail_from_vf(struct e1000_hw *hw, u32 *msg, - u32 vf_number, s16 size); -void e1000_vmdq_loopback_enable_vf(struct e1000_hw *hw); -void e1000_vmdq_loopback_disable_vf(struct e1000_hw *hw); -void e1000_vmdq_replication_enable_vf(struct e1000_hw *hw, u32 enables); -void e1000_vmdq_replication_disable_vf(struct e1000_hw *hw); -void e1000_vmdq_enable_replication_mode_vf(struct e1000_hw *hw); -void e1000_vmdq_broadcast_replication_enable_vf(struct e1000_hw *hw, - u32 enables); -void e1000_vmdq_multicast_replication_enable_vf(struct e1000_hw *hw, - u32 enables); -void e1000_vmdq_broadcast_replication_disable_vf(struct e1000_hw *hw, - u32 disables); -void e1000_vmdq_multicast_replication_disable_vf(struct e1000_hw *hw, - u32 disables); -bool e1000_check_for_pf_ack_vf(struct e1000_hw *hw); +/* RX packet buffer size defines */ +#define E1000_RXPBS_SIZE_MASK_82576 0x0000007F +void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable); +void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf); +void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable); +enum e1000_promisc_type { + e1000_promisc_disabled = 0, /* all promisc modes disabled */ + e1000_promisc_unicast = 1, /* unicast promiscuous enabled */ + e1000_promisc_multicast = 2, /* multicast promiscuous enabled */ + e1000_promisc_enabled = 3, /* both uni and multicast promisc */ + e1000_num_promisc_types +}; -bool e1000_check_for_pf_mail_vf(struct e1000_hw *hw, u32*); - - -#endif +void e1000_vfta_set_vf(struct e1000_hw *, u16, bool); +void e1000_rlpml_set_vf(struct e1000_hw *, u16); +s32 e1000_promisc_set_vf(struct e1000_hw *, enum e1000_promisc_type type); +u16 e1000_rxpbs_adjust_82580(u32 data); +#endif /* _E1000_82575_H_ */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.c index 8dd1192ce6..0a21c2d7eb 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_api.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_api.c,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #include "e1000_api.h" @@ -112,6 +112,32 @@ out: return ret_val; } +/** + * e1000_init_mbx_params - Initialize mailbox function pointers + * @hw: pointer to the HW structure + * + * This function initializes the function pointers for the PHY + * set of functions. Called by drivers or by e1000_setup_init_funcs. + **/ +s32 e1000_init_mbx_params(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + + if (hw->mbx.ops.init_params) { + ret_val = hw->mbx.ops.init_params(hw); + if (ret_val) { + DEBUGOUT("Mailbox Initialization Error\n"); + goto out; + } + } else { + DEBUGOUT("mbx.init_mbx_params was NULL\n"); + ret_val = -E1000_ERR_CONFIG; + } + +out: + return ret_val; +} + /** * e1000_set_mac_type - Sets MAC type * @hw: pointer to the HW structure @@ -212,8 +238,12 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) mac->type = e1000_82573; break; case E1000_DEV_ID_82574L: + case E1000_DEV_ID_82574LA: mac->type = e1000_82574; break; + case E1000_DEV_ID_82583V: + mac->type = e1000_82583; + break; case E1000_DEV_ID_80003ES2LAN_COPPER_DPT: case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: case E1000_DEV_ID_80003ES2LAN_COPPER_SPT: @@ -227,6 +257,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_ICH8_IGP_M_AMT: case E1000_DEV_ID_ICH8_IGP_AMT: case E1000_DEV_ID_ICH8_IGP_C: + case E1000_DEV_ID_ICH8_82567V_3: mac->type = e1000_ich8lan; break; case E1000_DEV_ID_ICH9_IFE: @@ -245,19 +276,49 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) break; case E1000_DEV_ID_ICH10_D_BM_LM: case E1000_DEV_ID_ICH10_D_BM_LF: + case E1000_DEV_ID_ICH10_D_BM_V: + case E1000_DEV_ID_ICH10_HANKSVILLE: mac->type = e1000_ich10lan; break; + case E1000_DEV_ID_PCH_D_HV_DM: + case E1000_DEV_ID_PCH_D_HV_DC: + case E1000_DEV_ID_PCH_M_HV_LM: + case E1000_DEV_ID_PCH_M_HV_LC: + mac->type = e1000_pchlan; + break; + case E1000_DEV_ID_PCH2_LV_LM: + case E1000_DEV_ID_PCH2_LV_V: + mac->type = e1000_pch2lan; + break; case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: + case E1000_DEV_ID_82575GB_QUAD_COPPER_PM: mac->type = e1000_82575; break; case E1000_DEV_ID_82576: case E1000_DEV_ID_82576_FIBER: case E1000_DEV_ID_82576_SERDES: case E1000_DEV_ID_82576_QUAD_COPPER: + case E1000_DEV_ID_82576_QUAD_COPPER_ET2: + case E1000_DEV_ID_82576_NS: + case E1000_DEV_ID_82576_NS_SERDES: + case E1000_DEV_ID_82576_SERDES_QUAD: mac->type = e1000_82576; break; + case E1000_DEV_ID_82580_COPPER: + case E1000_DEV_ID_82580_FIBER: + case E1000_DEV_ID_82580_SERDES: + case E1000_DEV_ID_82580_SGMII: + case E1000_DEV_ID_82580_COPPER_DUAL: + case E1000_DEV_ID_82580_QUAD_FIBER: + case E1000_DEV_ID_DH89XXCC_SGMII: + case E1000_DEV_ID_DH89XXCC_SERDES: + mac->type = e1000_82580; + break; + case E1000_DEV_ID_82576_VF: + mac->type = e1000_vfadapt; + break; default: /* Should never have loaded on this device */ ret_val = -E1000_ERR_MAC_INIT; @@ -303,6 +364,7 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) e1000_init_mac_ops_generic(hw); e1000_init_phy_ops_generic(hw); e1000_init_nvm_ops_generic(hw); + e1000_init_mbx_ops_generic(hw); /* * Set up the init function pointers. These are functions within the @@ -334,6 +396,7 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) case e1000_82572: case e1000_82573: case e1000_82574: + case e1000_82583: e1000_init_function_pointers_82571(hw); break; case e1000_80003es2lan: @@ -342,12 +405,18 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) case e1000_ich8lan: case e1000_ich9lan: case e1000_ich10lan: + case e1000_pchlan: + case e1000_pch2lan: e1000_init_function_pointers_ich8lan(hw); break; case e1000_82575: case e1000_82576: + case e1000_82580: e1000_init_function_pointers_82575(hw); break; + case e1000_vfadapt: + e1000_init_function_pointers_vf(hw); + break; default: DEBUGOUT("Hardware not supported\n"); ret_val = -E1000_ERR_CONFIG; @@ -371,6 +440,9 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) if (ret_val) goto out; + ret_val = e1000_init_mbx_params(hw); + if (ret_val) + goto out; } out: @@ -426,26 +498,16 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) * @hw: pointer to the HW structure * @mc_addr_list: array of multicast addresses to program * @mc_addr_count: number of multicast addresses to program - * @rar_used_count: the first RAR register free to program - * @rar_count: total number of supported Receive Address Registers * - * Updates the Receive Address Registers and Multicast Table Array. + * Updates the Multicast Table Array. * The caller must have a packed mc_addr_list of multicast addresses. - * The parameter rar_count will usually be hw->mac.rar_entry_count - * unless there are workarounds that change this. Currently no func pointer - * exists and all implementations are handled in the generic version of this - * function. **/ void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, - u32 mc_addr_count, u32 rar_used_count, - u32 rar_count) + u32 mc_addr_count) { if (hw->mac.ops.update_mc_addr_list) - hw->mac.ops.update_mc_addr_list(hw, - mc_addr_list, - mc_addr_count, - rar_used_count, - rar_count); + hw->mac.ops.update_mc_addr_list(hw, mc_addr_list, + mc_addr_count); } /** @@ -616,6 +678,21 @@ s32 e1000_blink_led(struct e1000_hw *hw) return E1000_SUCCESS; } +/** + * e1000_id_led_init - store LED configurations in SW + * @hw: pointer to the HW structure + * + * Initializes the LED config in SW. This is a function pointer entry point + * called by drivers. + **/ +s32 e1000_id_led_init(struct e1000_hw *hw) +{ + if (hw->mac.ops.id_led_init) + return hw->mac.ops.id_led_init(hw); + + return E1000_SUCCESS; +} + /** * e1000_led_on - Turn on SW controllable LED * @hw: pointer to the HW structure @@ -724,20 +801,6 @@ s32 e1000_validate_mdi_setting(struct e1000_hw *hw) return E1000_SUCCESS; } -/** - * e1000_mta_set - Sets multicast table bit - * @hw: pointer to the HW structure - * @hash_value: Multicast hash value. - * - * This sets the bit in the multicast table corresponding to the - * hash value. This is a function pointer entry point called by drivers. - **/ -void e1000_mta_set(struct e1000_hw *hw, u32 hash_value) -{ - if (hw->mac.ops.mta_set) - hw->mac.ops.mta_set(hw, hash_value); -} - /** * e1000_hash_mc_addr - Determines address location in multicast table * @hw: pointer to the HW structure @@ -1078,6 +1141,37 @@ s32 e1000_read_mac_addr(struct e1000_hw *hw) return e1000_read_mac_addr_generic(hw); } +/** + * e1000_read_pba_string - Read device part number string + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * @pba_num_size: size of part number buffer + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + * Currently no func pointer exists and all implementations are handled in the + * generic version of this function. + **/ +s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size) +{ + return e1000_read_pba_string_generic(hw, pba_num, pba_num_size); +} + +/** + * e1000_read_pba_length - Read device part number string length + * @hw: pointer to the HW structure + * @pba_num_size: size of part number buffer + * + * Reads the product board assembly (PBA) number length from the EEPROM and + * stores the value in pba_num. + * Currently no func pointer exists and all implementations are handled in the + * generic version of this function. + **/ +s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size) +{ + return e1000_read_pba_length_generic(hw, pba_num_size); +} + /** * e1000_read_pba_num - Read device part number * @hw: pointer to the HW structure @@ -1216,6 +1310,18 @@ void e1000_power_down_phy(struct e1000_hw *hw) hw->phy.ops.power_down(hw); } +/** + * e1000_power_up_fiber_serdes_link - Power up serdes link + * @hw: pointer to the HW structure + * + * Power on the optics and PCS. + **/ +void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw) +{ + if (hw->mac.ops.power_up_serdes) + hw->mac.ops.power_up_serdes(hw); +} + /** * e1000_shutdown_fiber_serdes_link - Remove link during power down * @hw: pointer to the HW structure diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.h index b5c8b579fd..af149ef1a6 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_api.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_api.h,v 1.3.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_API_H_ #define _E1000_API_H_ @@ -47,6 +47,7 @@ extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw); extern void e1000_init_function_pointers_vf(struct e1000_hw *hw); +extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw); extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw); s32 e1000_set_mac_type(struct e1000_hw *hw); @@ -54,6 +55,7 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device); s32 e1000_init_mac_params(struct e1000_hw *hw); s32 e1000_init_nvm_params(struct e1000_hw *hw); s32 e1000_init_phy_params(struct e1000_hw *hw); +s32 e1000_init_mbx_params(struct e1000_hw *hw); s32 e1000_get_bus_info(struct e1000_hw *hw); void e1000_clear_vfta(struct e1000_hw *hw); void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value); @@ -67,17 +69,16 @@ s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, s32 e1000_disable_pcie_master(struct e1000_hw *hw); void e1000_config_collision_dist(struct e1000_hw *hw); void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); -void e1000_mta_set(struct e1000_hw *hw, u32 hash_value); u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr); void e1000_update_mc_addr_list(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count, - u32 rar_used_count, u32 rar_count); + u8 *mc_addr_list, u32 mc_addr_count); s32 e1000_setup_led(struct e1000_hw *hw); s32 e1000_cleanup_led(struct e1000_hw *hw); s32 e1000_check_reset_block(struct e1000_hw *hw); s32 e1000_blink_led(struct e1000_hw *hw); s32 e1000_led_on(struct e1000_hw *hw); s32 e1000_led_off(struct e1000_hw *hw); +s32 e1000_id_led_init(struct e1000_hw *hw); void e1000_reset_adaptive(struct e1000_hw *hw); void e1000_update_adaptive(struct e1000_hw *hw); s32 e1000_get_cable_length(struct e1000_hw *hw); @@ -96,6 +97,9 @@ void e1000_power_up_phy(struct e1000_hw *hw); void e1000_power_down_phy(struct e1000_hw *hw); s32 e1000_read_mac_addr(struct e1000_hw *hw); s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); +s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, + u32 pba_num_size); +s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); void e1000_reload_nvm(struct e1000_hw *hw); s32 e1000_update_nvm_checksum(struct e1000_hw *hw); s32 e1000_validate_nvm_checksum(struct e1000_hw *hw); diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_defines.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_defines.h index 598bf8ba2b..ee4a4ef1f0 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_defines.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_defines.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_defines.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_defines.h,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_DEFINES_H_ #define _E1000_DEFINES_H_ @@ -49,6 +49,8 @@ #define E1000_WUC_LSCWO 0x00000020 /* Link Status wake up override */ #define E1000_WUC_SPM 0x80000000 /* Enable SPM */ #define E1000_WUC_PHY_WAKE 0x00000100 /* if PHY supports wakeup */ +#define E1000_WUC_FLX6_PHY 0x4000 /* Flexible Filter 6 Enable */ +#define E1000_WUC_FLX7_PHY 0x8000 /* Flexible Filter 7 Enable */ /* Wake Up Filter Control */ #define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ @@ -64,6 +66,8 @@ #define E1000_WUFC_FLX1_PHY 0x00002000 /* Flexible Filter 1 Enable */ #define E1000_WUFC_FLX2_PHY 0x00004000 /* Flexible Filter 2 Enable */ #define E1000_WUFC_FLX3_PHY 0x00008000 /* Flexible Filter 3 Enable */ +#define E1000_WUFC_FLX4_PHY 0x00000200 /* Flexible Filter 4 Enable */ +#define E1000_WUFC_FLX5_PHY 0x00000400 /* Flexible Filter 5 Enable */ #define E1000_WUFC_IGNORE_TCO 0x00008000 /* Ignore WakeOn TCO packets */ #define E1000_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */ #define E1000_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */ @@ -71,12 +75,20 @@ #define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ #define E1000_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */ #define E1000_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */ +#define E1000_WUFC_FLX6 0x00400000 /* Flexible Filter 6 Enable */ +#define E1000_WUFC_FLX7 0x00800000 /* Flexible Filter 7 Enable */ #define E1000_WUFC_ALL_FILTERS_PHY_4 0x0000F0FF /*Mask for all wakeup filters*/ #define E1000_WUFC_FLX_OFFSET_PHY 12 /* Offset to the Flexible Filters bits */ #define E1000_WUFC_FLX_FILTERS_PHY_4 0x0000F000 /*Mask for 4 flexible filters*/ +#define E1000_WUFC_ALL_FILTERS_PHY_6 0x0000F6FF /*Mask for 6 wakeup filters */ +#define E1000_WUFC_FLX_FILTERS_PHY_6 0x0000F600 /*Mask for 6 flexible filters*/ #define E1000_WUFC_ALL_FILTERS 0x000F00FF /* Mask for all wakeup filters */ +#define E1000_WUFC_ALL_FILTERS_6 0x003F00FF /* Mask for all 6 wakeup filters*/ +#define E1000_WUFC_ALL_FILTERS_8 0x00FF00FF /* Mask for all 8 wakeup filters*/ #define E1000_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ #define E1000_WUFC_FLX_FILTERS 0x000F0000 /*Mask for the 4 flexible filters */ +#define E1000_WUFC_FLX_FILTERS_6 0x003F0000 /* Mask for 6 flexible filters */ +#define E1000_WUFC_FLX_FILTERS_8 0x00FF0000 /* Mask for 8 flexible filters */ /* * For 82576 to utilize Extended filter masks in addition to * existing (filter) masks @@ -101,13 +113,28 @@ #define E1000_WUS_FLX1 E1000_WUFC_FLX1 #define E1000_WUS_FLX2 E1000_WUFC_FLX2 #define E1000_WUS_FLX3 E1000_WUFC_FLX3 +#define E1000_WUS_FLX4 E1000_WUFC_FLX4 +#define E1000_WUS_FLX5 E1000_WUFC_FLX5 +#define E1000_WUS_FLX6 E1000_WUFC_FLX6 +#define E1000_WUS_FLX7 E1000_WUFC_FLX7 +#define E1000_WUS_FLX4_PHY E1000_WUFC_FLX4_PHY +#define E1000_WUS_FLX5_PHY E1000_WUFC_FLX5_PHY +#define E1000_WUS_FLX6_PHY 0x0400 +#define E1000_WUS_FLX7_PHY 0x0800 #define E1000_WUS_FLX_FILTERS E1000_WUFC_FLX_FILTERS +#define E1000_WUS_FLX_FILTERS_6 E1000_WUFC_FLX_FILTERS_6 +#define E1000_WUS_FLX_FILTERS_8 E1000_WUFC_FLX_FILTERS_8 +#define E1000_WUS_FLX_FILTERS_PHY_6 E1000_WUFC_FLX_FILTERS_PHY_6 /* Wake Up Packet Length */ #define E1000_WUPL_LENGTH_MASK 0x0FFF /* Only the lower 12 bits are valid */ /* Four Flexible Filters are supported */ #define E1000_FLEXIBLE_FILTER_COUNT_MAX 4 +/* Six Flexible Filters are supported */ +#define E1000_FLEXIBLE_FILTER_COUNT_MAX_6 6 +/* Eight Flexible Filters are supported */ +#define E1000_FLEXIBLE_FILTER_COUNT_MAX_8 8 /* Two Extended Flexible Filters are supported (82576) */ #define E1000_EXT_FLEXIBLE_FILTER_COUNT_MAX 2 #define E1000_FHFT_LENGTH_OFFSET 0xFC /* Length byte in FHFT */ @@ -117,6 +144,8 @@ #define E1000_FLEXIBLE_FILTER_SIZE_MAX 128 #define E1000_FFLT_SIZE E1000_FLEXIBLE_FILTER_COUNT_MAX +#define E1000_FFLT_SIZE_6 E1000_FLEXIBLE_FILTER_COUNT_MAX_6 +#define E1000_FFLT_SIZE_8 E1000_FLEXIBLE_FILTER_COUNT_MAX_8 #define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX #define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX @@ -131,12 +160,12 @@ #define E1000_CTRL_EXT_SDP5_DATA 0x00000020 /* Value of SW Definable Pin 5 */ #define E1000_CTRL_EXT_PHY_INT E1000_CTRL_EXT_SDP5_DATA #define E1000_CTRL_EXT_SDP6_DATA 0x00000040 /* Value of SW Definable Pin 6 */ -#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Definable Pin 7 */ +#define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Definable Pin 3 */ /* SDP 4/5 (bits 8,9) are reserved in >= 82575 */ #define E1000_CTRL_EXT_SDP4_DIR 0x00000100 /* Direction of SDP4 0=in 1=out */ #define E1000_CTRL_EXT_SDP5_DIR 0x00000200 /* Direction of SDP5 0=in 1=out */ #define E1000_CTRL_EXT_SDP6_DIR 0x00000400 /* Direction of SDP6 0=in 1=out */ -#define E1000_CTRL_EXT_SDP7_DIR 0x00000800 /* Direction of SDP7 0=in 1=out */ +#define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* Direction of SDP3 0=in 1=out */ #define E1000_CTRL_EXT_ASDCHK 0x00001000 /* Initiate an ASD sequence */ #define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ #define E1000_CTRL_EXT_IPS 0x00004000 /* Invert Power State */ @@ -144,7 +173,10 @@ #define E1000_CTRL_EXT_PFRSTD 0x00004000 #define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ #define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ +#define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clock Gating */ #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 +#define E1000_CTRL_EXT_LINK_MODE_82580_MASK 0x01C00000 /*82580 bit 24:22*/ +#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000 #define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 #define E1000_CTRL_EXT_LINK_MODE_TBI 0x00C00000 #define E1000_CTRL_EXT_LINK_MODE_KMRN 0x00000000 @@ -161,9 +193,7 @@ #define E1000_CTRL_EXT_CANC 0x04000000 /* Int delay cancellation */ #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ /* IAME enable bit (27) was removed in >= 82575 */ -#define E1000_CTRL_EXT_IAME 0x08000000 /* Int acknowledge Auto-mask */ -#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers - * after IMS clear */ +#define E1000_CTRL_EXT_IAME 0x08000000 /* Int acknowledge Auto-mask */ #define E1000_CRTL_EXT_PB_PAREN 0x01000000 /* packet buffer parity error * detection enabled */ #define E1000_CTRL_EXT_DF_PAREN 0x02000000 /* descriptor FIFO parity @@ -171,6 +201,7 @@ #define E1000_CTRL_EXT_GHOST_PAREN 0x40000000 #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ #define E1000_CTRL_EXT_LSECCK 0x00001000 +#define E1000_CTRL_EXT_PHYPDEN 0x00100000 #define E1000_I2CCMD_REG_ADDR_SHIFT 16 #define E1000_I2CCMD_REG_ADDR 0x00FF0000 #define E1000_I2CCMD_PHY_ADDR_SHIFT 24 @@ -297,12 +328,17 @@ #define E1000_MANC_SMB_DATA_OUT_SHIFT 28 /* SMBus Data Out Shift */ #define E1000_MANC_SMB_CLK_OUT_SHIFT 29 /* SMBus Clock Out Shift */ +#define E1000_MANC2H_PORT_623 0x00000020 /* Port 0x26f */ +#define E1000_MANC2H_PORT_664 0x00000040 /* Port 0x298 */ +#define E1000_MDEF_PORT_623 0x00000800 /* Port 0x26f */ +#define E1000_MDEF_PORT_664 0x00000400 /* Port 0x298 */ + /* Receive Control */ #define E1000_RCTL_RST 0x00000001 /* Software reset */ #define E1000_RCTL_EN 0x00000002 /* enable */ #define E1000_RCTL_SBP 0x00000004 /* store bad packet */ -#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */ -#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */ +#define E1000_RCTL_UPE 0x00000008 /* unicast promisc enable */ +#define E1000_RCTL_MPE 0x00000010 /* multicast promisc enable */ #define E1000_RCTL_LPE 0x00000020 /* long packet enable */ #define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */ #define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ @@ -310,9 +346,9 @@ #define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ #define E1000_RCTL_DTYP_MASK 0x00000C00 /* Descriptor type mask */ #define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */ -#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */ -#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min threshold size */ -#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min threshold size */ +#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min thresh size */ +#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min thresh size */ +#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min thresh size */ #define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ #define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */ #define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */ @@ -367,10 +403,12 @@ #define E1000_PSRCTL_BSIZE3_SHIFT 14 /* Shift _left_ 14 */ /* SWFW_SYNC Definitions */ -#define E1000_SWFW_EEP_SM 0x1 -#define E1000_SWFW_PHY0_SM 0x2 -#define E1000_SWFW_PHY1_SM 0x4 -#define E1000_SWFW_CSR_SM 0x8 +#define E1000_SWFW_EEP_SM 0x01 +#define E1000_SWFW_PHY0_SM 0x02 +#define E1000_SWFW_PHY1_SM 0x04 +#define E1000_SWFW_CSR_SM 0x08 +#define E1000_SWFW_PHY2_SM 0x20 +#define E1000_SWFW_PHY3_SM 0x40 /* FACTPS Definitions */ #define E1000_FACTPS_LFS 0x40000000 /* LAN Function Select */ @@ -378,7 +416,7 @@ #define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */ #define E1000_CTRL_BEM 0x00000002 /* Endian Mode.0=little,1=big */ #define E1000_CTRL_PRIOR 0x00000004 /* Priority on PCI. 0=rx,1=fair */ -#define E1000_CTRL_GIO_MASTER_DISABLE 0x00000004 /*Blocks new Master requests */ +#define E1000_CTRL_GIO_MASTER_DISABLE 0x00000004 /*Blocks new Master reqs */ #define E1000_CTRL_LRST 0x00000008 /* Link reset. 0=normal,1=reset */ #define E1000_CTRL_TME 0x00000010 /* Test mode. 0=normal,1=test */ #define E1000_CTRL_SLE 0x00000020 /* Serial Link on 0=dis,1=en */ @@ -399,9 +437,12 @@ * PHYRST_N pin */ #define E1000_CTRL_EXT_LINK_EN 0x00010000 /* enable link status from external * LINK_0 and LINK_1 pins */ +#define E1000_CTRL_LANPHYPC_OVERRIDE 0x00010000 /* SW control of LANPHYPC */ +#define E1000_CTRL_LANPHYPC_VALUE 0x00020000 /* SW value of LANPHYPC */ #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ #define E1000_CTRL_SWDPIN2 0x00100000 /* SWDPIN 2 value */ +#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ #define E1000_CTRL_SWDPIN3 0x00200000 /* SWDPIN 3 value */ #define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ #define E1000_CTRL_SWDPIO1 0x00800000 /* SWDPIN 1 input or output */ @@ -475,8 +516,9 @@ #define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ -#define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ +#define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ #define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */ +#define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ #define E1000_STATUS_DOCK_CI 0x00000800 /* Change in Dock/Undock state. * Clear on write '0'. */ #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Master request status */ @@ -498,9 +540,9 @@ #define E1000_STATUS_SERDES1_DIS 0x20000000 /* SERDES disabled on port 1 */ /* Constants used to interpret the masked PCI-X bus speed. */ -#define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus speed 50-66 MHz */ -#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus speed 66-100 MHz */ -#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus speed 100-133 MHz */ +#define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus speed 50-66 MHz */ +#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus speed 66-100 MHz */ +#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /*PCI-X bus speed 100-133 MHz*/ #define SPEED_10 10 #define SPEED_100 100 @@ -532,6 +574,11 @@ #define AUTONEG_ADVERTISE_SPEED_DEFAULT E1000_ALL_SPEED_DUPLEX /* LED Control */ +#define E1000_PHY_LED0_MODE_MASK 0x00000007 +#define E1000_PHY_LED0_IVRT 0x00000008 +#define E1000_PHY_LED0_BLINK 0x00000010 +#define E1000_PHY_LED0_MASK 0x0000001F + #define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F #define E1000_LEDCTL_LED0_MODE_SHIFT 0 #define E1000_LEDCTL_LED0_BLINK_RATE 0x00000020 @@ -675,7 +722,9 @@ /* Extended Configuration Control and Size */ #define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 #define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001 +#define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE 0x00000008 #define E1000_EXTCNF_CTRL_SWFLAG 0x00000020 +#define E1000_EXTCNF_CTRL_GATE_PHY_CFG 0x00000080 #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000 #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16 #define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK 0x0FFF0000 @@ -690,16 +739,21 @@ #define E1000_KABGTXD_BGSQLBIAS 0x00050000 /* PBA constants */ -#define E1000_PBA_6K 0x0006 /* 6KB */ +#define E1000_PBA_6K 0x0006 /* 6KB */ #define E1000_PBA_8K 0x0008 /* 8KB */ +#define E1000_PBA_10K 0x000A /* 10KB */ #define E1000_PBA_12K 0x000C /* 12KB */ +#define E1000_PBA_14K 0x000E /* 14KB */ #define E1000_PBA_16K 0x0010 /* 16KB */ +#define E1000_PBA_18K 0x0012 #define E1000_PBA_20K 0x0014 #define E1000_PBA_22K 0x0016 #define E1000_PBA_24K 0x0018 +#define E1000_PBA_26K 0x001A #define E1000_PBA_30K 0x001E #define E1000_PBA_32K 0x0020 #define E1000_PBA_34K 0x0022 +#define E1000_PBA_35K 0x0023 #define E1000_PBA_38K 0x0026 #define E1000_PBA_40K 0x0028 #define E1000_PBA_48K 0x0030 /* 48KB */ @@ -720,6 +774,8 @@ #define E1000_SWSM_WMNG 0x00000004 /* Wake MNG Clock */ #define E1000_SWSM_DRV_LOAD 0x00000008 /* Driver Loaded Bit */ +#define E1000_SWSM2_LOCK 0x00000002 /* Secondary driver semaphore bit */ + /* Interrupt Cause Read */ #define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ #define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */ @@ -740,11 +796,12 @@ #define E1000_ICR_ACK 0x00020000 /* Receive Ack frame */ #define E1000_ICR_MNG 0x00040000 /* Manageability event */ #define E1000_ICR_DOCK 0x00080000 /* Dock/Undock */ +#define E1000_ICR_DRSTA 0x40000000 /* Device Reset Asserted */ #define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver * should claim the interrupt */ #define E1000_ICR_RXD_FIFO_PAR0 0x00100000 /* Q0 Rx desc FIFO parity error */ #define E1000_ICR_TXD_FIFO_PAR0 0x00200000 /* Q0 Tx desc FIFO parity error */ -#define E1000_ICR_HOST_ARB_PAR 0x00400000 /* host arb read buffer parity err */ +#define E1000_ICR_HOST_ARB_PAR 0x00400000 /* host arb read buffer parity err */ #define E1000_ICR_PB_PAR 0x00800000 /* packet buffer parity error */ #define E1000_ICR_RXD_FIFO_PAR1 0x01000000 /* Q1 Rx desc FIFO parity error */ #define E1000_ICR_TXD_FIFO_PAR1 0x02000000 /* Q1 Tx desc FIFO parity error */ @@ -760,6 +817,14 @@ #define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */ #define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */ #define E1000_ICR_OTHER 0x01000000 /* Other Interrupts */ +#define E1000_ICR_FER 0x00400000 /* Fatal Error */ + +/* PBA ECC Register */ +#define E1000_PBA_ECC_COUNTER_MASK 0xFFF00000 /* ECC counter mask */ +#define E1000_PBA_ECC_COUNTER_SHIFT 20 /* ECC counter shift value */ +#define E1000_PBA_ECC_CORR_EN 0x00000001 /* Enable ECC error correction */ +#define E1000_PBA_ECC_STAT_CLR 0x00000002 /* Clear ECC error counter */ +#define E1000_PBA_ECC_INT_EN 0x00000004 /* Enable ICR bit 5 on ECC error */ /* Extended Interrupt Cause Read */ #define E1000_EICR_RX_QUEUE0 0x00000001 /* Rx Queue 0 Interrupt */ @@ -805,7 +870,7 @@ E1000_IMS_LSC) /* Interrupt Mask Set */ -#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ +#define E1000_IMS_TXDW E1000_ICR_TXDW /* Tx desc written back */ #define E1000_IMS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ #define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ #define E1000_IMS_VMMB E1000_ICR_VMMB /* Mail box activity */ @@ -824,6 +889,7 @@ #define E1000_IMS_ACK E1000_ICR_ACK /* Receive Ack frame */ #define E1000_IMS_MNG E1000_ICR_MNG /* Manageability event */ #define E1000_IMS_DOCK E1000_ICR_DOCK /* Dock/Undock */ +#define E1000_IMS_DRSTA E1000_ICR_DRSTA /* Device Reset Asserted */ #define E1000_IMS_RXD_FIFO_PAR0 E1000_ICR_RXD_FIFO_PAR0 /* Q0 Rx desc FIFO * parity error */ #define E1000_IMS_TXD_FIFO_PAR0 E1000_ICR_TXD_FIFO_PAR0 /* Q0 Tx desc FIFO @@ -845,6 +911,7 @@ #define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */ #define E1000_IMS_TXQ1 E1000_ICR_TXQ1 /* Tx Queue 1 Interrupt */ #define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupts */ +#define E1000_IMS_FER E1000_ICR_FER /* Fatal Error */ /* Extended Interrupt Mask Set */ #define E1000_EIMS_RX_QUEUE0 E1000_EICR_RX_QUEUE0 /* Rx Queue 0 Interrupt */ @@ -859,7 +926,7 @@ #define E1000_EIMS_OTHER E1000_EICR_OTHER /* Interrupt Cause Active */ /* Interrupt Cause Set */ -#define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ +#define E1000_ICS_TXDW E1000_ICR_TXDW /* Tx desc written back */ #define E1000_ICS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ #define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ #define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ @@ -877,6 +944,7 @@ #define E1000_ICS_ACK E1000_ICR_ACK /* Receive Ack frame */ #define E1000_ICS_MNG E1000_ICR_MNG /* Manageability event */ #define E1000_ICS_DOCK E1000_ICR_DOCK /* Dock/Undock */ +#define E1000_ICS_DRSTA E1000_ICR_DRSTA /* Device Reset Aserted */ #define E1000_ICS_RXD_FIFO_PAR0 E1000_ICR_RXD_FIFO_PAR0 /* Q0 Rx desc FIFO * parity error */ #define E1000_ICS_TXD_FIFO_PAR0 E1000_ICR_TXD_FIFO_PAR0 /* Q0 Tx desc FIFO @@ -906,6 +974,10 @@ #define E1000_EICS_TCP_TIMER E1000_EICR_TCP_TIMER /* TCP Timer */ #define E1000_EICS_OTHER E1000_EICR_OTHER /* Interrupt Cause Active */ +#define E1000_EITR_ITR_INT_MASK 0x0000FFFF +/* E1000_EITR_CNT_IGNR is only for 82576 and newer */ +#define E1000_EITR_CNT_IGNR 0x80000000 /* Don't reset counters on write */ + /* Transmit Descriptor Control */ #define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */ #define E1000_TXDCTL_HTHRESH 0x00003F00 /* TXDCTL Host Threshold */ @@ -936,6 +1008,10 @@ */ #define E1000_RAR_ENTRIES 15 #define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */ +#define E1000_RAL_MAC_ADDR_LEN 4 +#define E1000_RAH_MAC_ADDR_LEN 2 +#define E1000_RAH_POOL_MASK 0x03FC0000 +#define E1000_RAH_POOL_1 0x00040000 /* Error Codes */ #define E1000_SUCCESS 0 @@ -951,6 +1027,10 @@ #define E1000_BLK_PHY_RESET 12 #define E1000_ERR_SWFW_SYNC 13 #define E1000_NOT_IMPLEMENTED 14 +#define E1000_ERR_MBX 15 +#define E1000_ERR_INVALID_ARGUMENT 16 +#define E1000_ERR_NO_SPACE 17 +#define E1000_ERR_NVM_PBA_SECTION 18 /* Loop limit on how long we wait for auto-negotiation to complete */ #define FIBER_LINK_UP_LIMIT 50 @@ -993,6 +1073,62 @@ #define E1000_RXCW_SYNCH 0x40000000 /* Receive config synch */ #define E1000_RXCW_ANC 0x80000000 /* Auto-neg complete */ +#define E1000_TSYNCTXCTL_VALID 0x00000001 /* tx timestamp valid */ +#define E1000_TSYNCTXCTL_ENABLED 0x00000010 /* enable tx timestampping */ + +#define E1000_TSYNCRXCTL_VALID 0x00000001 /* rx timestamp valid */ +#define E1000_TSYNCRXCTL_TYPE_MASK 0x0000000E /* rx type mask */ +#define E1000_TSYNCRXCTL_TYPE_L2_V2 0x00 +#define E1000_TSYNCRXCTL_TYPE_L4_V1 0x02 +#define E1000_TSYNCRXCTL_TYPE_L2_L4_V2 0x04 +#define E1000_TSYNCRXCTL_TYPE_ALL 0x08 +#define E1000_TSYNCRXCTL_TYPE_EVENT_V2 0x0A +#define E1000_TSYNCRXCTL_ENABLED 0x00000010 /* enable rx timestampping */ + +#define E1000_TSYNCRXCFG_PTP_V1_CTRLT_MASK 0x000000FF +#define E1000_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE 0x00 +#define E1000_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE 0x01 +#define E1000_TSYNCRXCFG_PTP_V1_FOLLOWUP_MESSAGE 0x02 +#define E1000_TSYNCRXCFG_PTP_V1_DELAY_RESP_MESSAGE 0x03 +#define E1000_TSYNCRXCFG_PTP_V1_MANAGEMENT_MESSAGE 0x04 + +#define E1000_TSYNCRXCFG_PTP_V2_MSGID_MASK 0x00000F00 +#define E1000_TSYNCRXCFG_PTP_V2_SYNC_MESSAGE 0x0000 +#define E1000_TSYNCRXCFG_PTP_V2_DELAY_REQ_MESSAGE 0x0100 +#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_REQ_MESSAGE 0x0200 +#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_RESP_MESSAGE 0x0300 +#define E1000_TSYNCRXCFG_PTP_V2_FOLLOWUP_MESSAGE 0x0800 +#define E1000_TSYNCRXCFG_PTP_V2_DELAY_RESP_MESSAGE 0x0900 +#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_FOLLOWUP_MESSAGE 0x0A00 +#define E1000_TSYNCRXCFG_PTP_V2_ANNOUNCE_MESSAGE 0x0B00 +#define E1000_TSYNCRXCFG_PTP_V2_SIGNALLING_MESSAGE 0x0C00 +#define E1000_TSYNCRXCFG_PTP_V2_MANAGEMENT_MESSAGE 0x0D00 + +#define E1000_TIMINCA_16NS_SHIFT 24 +/* TUPLE Filtering Configuration */ +#define E1000_TTQF_DISABLE_MASK 0xF0008000 /* TTQF Disable Mask */ +#define E1000_TTQF_QUEUE_ENABLE 0x100 /* TTQF Queue Enable Bit */ +#define E1000_TTQF_PROTOCOL_MASK 0xFF /* TTQF Protocol Mask */ +/* TTQF TCP Bit, shift with E1000_TTQF_PROTOCOL SHIFT */ +#define E1000_TTQF_PROTOCOL_TCP 0x0 +/* TTQF UDP Bit, shift with E1000_TTQF_PROTOCOL_SHIFT */ +#define E1000_TTQF_PROTOCOL_UDP 0x1 +/* TTQF SCTP Bit, shift with E1000_TTQF_PROTOCOL_SHIFT */ +#define E1000_TTQF_PROTOCOL_SCTP 0x2 +#define E1000_TTQF_PROTOCOL_SHIFT 5 /* TTQF Protocol Shift */ +#define E1000_TTQF_QUEUE_SHIFT 16 /* TTQF Queue Shfit */ +#define E1000_TTQF_RX_QUEUE_MASK 0x70000 /* TTQF Queue Mask */ +#define E1000_TTQF_MASK_ENABLE 0x10000000 /* TTQF Mask Enable Bit */ +#define E1000_IMIR_CLEAR_MASK 0xF001FFFF /* IMIR Reg Clear Mask */ +#define E1000_IMIR_PORT_BYPASS 0x20000 /* IMIR Port Bypass Bit */ +#define E1000_IMIR_PRIORITY_SHIFT 29 /* IMIR Priority Shift */ +#define E1000_IMIREXT_CLEAR_MASK 0x7FFFF /* IMIREXT Reg Clear Mask */ + +#define E1000_MDICNFG_EXT_MDIO 0x80000000 /* MDI ext/int destination */ +#define E1000_MDICNFG_COM_MDIO 0x40000000 /* MDI shared w/ lan 0 */ +#define E1000_MDICNFG_PHY_MASK 0x03E00000 +#define E1000_MDICNFG_PHY_SHIFT 21 + /* PCI Express Control */ #define E1000_GCR_RXD_NO_SNOOP 0x00000001 #define E1000_GCR_RXDSCW_NO_SNOOP 0x00000002 @@ -1000,6 +1136,10 @@ #define E1000_GCR_TXD_NO_SNOOP 0x00000008 #define E1000_GCR_TXDSCW_NO_SNOOP 0x00000010 #define E1000_GCR_TXDSCR_NO_SNOOP 0x00000020 +#define E1000_GCR_CMPL_TMOUT_MASK 0x0000F000 +#define E1000_GCR_CMPL_TMOUT_10ms 0x00001000 +#define E1000_GCR_CMPL_TMOUT_RESEND 0x00010000 +#define E1000_GCR_CAP_VER2 0x00040000 #define PCIE_NO_SNOOP_ALL (E1000_GCR_RXD_NO_SNOOP | \ E1000_GCR_RXDSCW_NO_SNOOP | \ @@ -1080,7 +1220,7 @@ /* 0=DTE device */ #define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */ /* 0=Configure PHY as Slave */ -#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */ +#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */ /* 0=Automatic Master/Slave config */ #define CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */ #define CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */ @@ -1090,7 +1230,7 @@ /* 1000BASE-T Status Register */ #define SR_1000T_IDLE_ERROR_CNT 0x00FF /* Num idle errors since last read */ -#define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asymmetric pause direction bit */ +#define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asymmetric pause direction bit */ #define SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */ #define SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */ #define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ @@ -1115,6 +1255,8 @@ #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ +#define PHY_CONTROL_LB 0x4000 /* PHY Loopback bit */ + /* NVM Control */ #define E1000_EECD_SK 0x00000001 /* NVM Clock */ #define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ @@ -1145,10 +1287,11 @@ #define E1000_EECD_SHADV 0x00200000 /* Shadow RAM Data Valid */ #define E1000_EECD_SEC1VAL 0x00400000 /* Sector One Valid */ #define E1000_EECD_SECVAL_SHIFT 22 +#define E1000_EECD_SEC1VAL_VALID_MASK (E1000_EECD_AUTO_RD | E1000_EECD_PRES) #define E1000_NVM_SWDPIN0 0x0001 /* SWDPIN 0 NVM Value */ #define E1000_NVM_LED_LOGIC 0x0020 /* Led Logic Word */ -#define E1000_NVM_RW_REG_DATA 16 /* Offset to data in NVM read/write regs */ +#define E1000_NVM_RW_REG_DATA 16 /* Offset to data in NVM read/write regs */ #define E1000_NVM_RW_REG_DONE 2 /* Offset to READ/WRITE done bit */ #define E1000_NVM_RW_REG_START 1 /* Start operation */ #define E1000_NVM_RW_ADDR_SHIFT 2 /* Shift to the address bits */ @@ -1174,8 +1317,16 @@ #define NVM_ALT_MAC_ADDR_PTR 0x0037 #define NVM_CHECKSUM_REG 0x003F -#define E1000_NVM_CFG_DONE_PORT_0 0x40000 /* MNG config cycle done */ -#define E1000_NVM_CFG_DONE_PORT_1 0x80000 /* ...for second port */ +#define E1000_NVM_CFG_DONE_PORT_0 0x040000 /* MNG config cycle done */ +#define E1000_NVM_CFG_DONE_PORT_1 0x080000 /* ...for second port */ +#define E1000_NVM_CFG_DONE_PORT_2 0x100000 /* ...for third port */ +#define E1000_NVM_CFG_DONE_PORT_3 0x200000 /* ...for fourth port */ + +#define NVM_82580_LAN_FUNC_OFFSET(a) (a ? (0x40 + (0x40 * a)) : 0) + +/* Mask bits for fields in Word 0x24 of the NVM */ +#define NVM_WORD24_COM_MDIO 0x0008 /* MDIO interface shared */ +#define NVM_WORD24_EXT_MDIO 0x0004 /* MDIO accesses routed external */ /* Mask bits for fields in Word 0x0f of the NVM */ #define NVM_WORD0F_PAUSE_MASK 0x3000 @@ -1188,12 +1339,19 @@ /* Mask bits for fields in Word 0x1a of the NVM */ #define NVM_WORD1A_ASPM_MASK 0x000C +/* Mask bits for fields in Word 0x03 of the EEPROM */ +#define NVM_COMPAT_LOM 0x0800 + +/* length of string needed to store PBA number */ +#define E1000_PBANUM_LENGTH 11 + /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ #define NVM_SUM 0xBABA #define NVM_MAC_ADDR_OFFSET 0 #define NVM_PBA_OFFSET_0 8 #define NVM_PBA_OFFSET_1 9 +#define NVM_PBA_PTR_GUARD 0xFAFA #define NVM_RESERVED_WORD 0xFFFF #define NVM_PHY_CLASS_A 0x8000 #define NVM_SERDES_AMPLITUDE_MASK 0x000F @@ -1253,6 +1411,7 @@ #define PCIX_STATUS_REGISTER_HI 0xEA #define PCI_HEADER_TYPE_REGISTER 0x0E #define PCIE_LINK_STATUS 0x12 +#define PCIE_DEVICE_CONTROL2 0x28 #define PCIX_COMMAND_MMRBC_MASK 0x000C #define PCIX_COMMAND_MMRBC_SHIFT 0x2 @@ -1264,6 +1423,10 @@ #define PCI_HEADER_TYPE_MULTIFUNC 0x80 #define PCIE_LINK_WIDTH_MASK 0x3F0 #define PCIE_LINK_WIDTH_SHIFT 4 +#define PCIE_LINK_SPEED_MASK 0x0F +#define PCIE_LINK_SPEED_2500 0x01 +#define PCIE_LINK_SPEED_5000 0x02 +#define PCIE_DEVICE_CONTROL2_16ms 0x0005 #ifndef ETH_ADDR_LEN #define ETH_ADDR_LEN 6 @@ -1291,6 +1454,10 @@ #define IFE_C_E_PHY_ID 0x02A80310 #define BME1000_E_PHY_ID 0x01410CB0 #define BME1000_E_PHY_ID_R2 0x01410CB1 +#define I82577_E_PHY_ID 0x01540050 +#define I82578_E_PHY_ID 0x004DD040 +#define I82579_E_PHY_ID 0x01540090 +#define I82580_I_PHY_ID 0x015403A0 #define IGP04E1000_E_PHY_ID 0x02A80391 #define M88_VENDOR 0x0141 @@ -1310,11 +1477,11 @@ /* M88E1000 PHY Specific Control Register */ #define M88E1000_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Function disabled */ -#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */ +#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reverse enabled */ #define M88E1000_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */ /* 1=CLK125 low, 0=CLK125 toggling */ #define M88E1000_PSCR_CLK125_DISABLE 0x0010 -#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */ +#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */ /* Manual MDI configuration */ #define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ /* 1000BASE-T: Auto crossover, 100BASE-TX/10BASE-T: MDI Mode */ @@ -1330,7 +1497,7 @@ #define M88E1000_PSCR_MII_5BIT_ENABLE 0x0100 #define M88E1000_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler disable */ #define M88E1000_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */ -#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ +#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Tx */ /* M88E1000 PHY Specific Status Register */ #define M88E1000_PSSR_JABBER 0x0001 /* 1=Jabber */ @@ -1387,6 +1554,7 @@ #define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ #define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */ + /* M88EC018 Rev 2 specific DownShift settings */ #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00 #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_1X 0x0000 @@ -1398,6 +1566,9 @@ #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_7X 0x0C00 #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_8X 0x0E00 +#define I82578_EPSCR_DOWNSHIFT_ENABLE 0x0020 +#define I82578_EPSCR_DOWNSHIFT_COUNTER_MASK 0x001C + /* BME1000 PHY Specific Control Register */ #define BME1000_PSCR_ENABLE_DOWNSHIFT 0x0800 /* 1 = enable downshift */ @@ -1486,6 +1657,7 @@ #define E1000_MDIC_READY 0x10000000 #define E1000_MDIC_INT_EN 0x20000000 #define E1000_MDIC_ERROR 0x40000000 +#define E1000_MDIC_DEST 0x80000000 /* SerDes Control */ #define E1000_GEN_CTL_READY 0x80000000 @@ -1516,4 +1688,36 @@ #define E1000_LSECRXCTRL_RP 0x00000080 #define E1000_LSECRXCTRL_RSV_MASK 0xFFFFFF33 + +/* DMA Coalescing register fields */ +#define E1000_DMACR_DMACWT_MASK 0x00003FFF /* DMA Coalescing + * Watchdog Timer */ +#define E1000_DMACR_DMACTHR_MASK 0x00FF0000 /* DMA Coalescing Receive + * Threshold */ +#define E1000_DMACR_DMACTHR_SHIFT 16 +#define E1000_DMACR_DMAC_LX_MASK 0x30000000 /* Lx when no PCIe + * transactions */ +#define E1000_DMACR_DMAC_LX_SHIFT 28 +#define E1000_DMACR_DMAC_EN 0x80000000 /* Enable DMA Coalescing */ + +#define E1000_DMCTXTH_DMCTTHR_MASK 0x00000FFF /* DMA Coalescing Transmit + * Threshold */ + +#define E1000_DMCTLX_TTLX_MASK 0x00000FFF /* Time to LX request */ + +#define E1000_DMCRTRH_UTRESH_MASK 0x0007FFFF /* Receive Traffic Rate + * Threshold */ +#define E1000_DMCRTRH_LRPRCW 0x80000000 /* Rcv packet rate in + * current window */ + +#define E1000_DMCCNT_CCOUNT_MASK 0x01FFFFFF /* DMA Coal Rcv Traffic + * Current Cnt */ + +#define E1000_FCRTC_RTH_COAL_MASK 0x0003FFF0 /* Flow ctrl Rcv Threshold + * High val */ +#define E1000_FCRTC_RTH_COAL_SHIFT 4 +#define E1000_PCIEMISC_LX_DECISION 0x00000080 /* Lx power decision based + on DMA coal */ + + #endif /* _E1000_DEFINES_H_ */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_hw.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_hw.h index 593aac9778..a02f598b0f 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_hw.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_hw.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_hw.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_hw.h,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_HW_H_ #define _E1000_HW_H_ @@ -94,10 +94,13 @@ struct e1000_hw; #define E1000_DEV_ID_82573E_IAMT 0x108C #define E1000_DEV_ID_82573L 0x109A #define E1000_DEV_ID_82574L 0x10D3 +#define E1000_DEV_ID_82574LA 0x10F6 +#define E1000_DEV_ID_82583V 0x150C #define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096 #define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098 #define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA #define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB +#define E1000_DEV_ID_ICH8_82567V_3 0x1501 #define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049 #define E1000_DEV_ID_ICH8_IGP_AMT 0x104A #define E1000_DEV_ID_ICH8_IGP_C 0x104B @@ -117,16 +120,38 @@ struct e1000_hw; #define E1000_DEV_ID_ICH10_R_BM_LM 0x10CC #define E1000_DEV_ID_ICH10_R_BM_LF 0x10CD #define E1000_DEV_ID_ICH10_R_BM_V 0x10CE +#define E1000_DEV_ID_ICH10_HANKSVILLE 0xF0FE #define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE #define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF +#define E1000_DEV_ID_ICH10_D_BM_V 0x1525 + +#define E1000_DEV_ID_PCH_M_HV_LM 0x10EA +#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB +#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF +#define E1000_DEV_ID_PCH_D_HV_DC 0x10F0 +#define E1000_DEV_ID_PCH2_LV_LM 0x1502 +#define E1000_DEV_ID_PCH2_LV_V 0x1503 #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 #define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8 +#define E1000_DEV_ID_82576_QUAD_COPPER_ET2 0x1526 +#define E1000_DEV_ID_82576_NS 0x150A +#define E1000_DEV_ID_82576_NS_SERDES 0x1518 +#define E1000_DEV_ID_82576_SERDES_QUAD 0x150D #define E1000_DEV_ID_82576_VF 0x10CA #define E1000_DEV_ID_82575EB_COPPER 0x10A7 #define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9 #define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6 +#define E1000_DEV_ID_82575GB_QUAD_COPPER_PM 0x10E2 +#define E1000_DEV_ID_82580_COPPER 0x150E +#define E1000_DEV_ID_82580_FIBER 0x150F +#define E1000_DEV_ID_82580_SERDES 0x1510 +#define E1000_DEV_ID_82580_SGMII 0x1511 +#define E1000_DEV_ID_82580_COPPER_DUAL 0x1516 +#define E1000_DEV_ID_82580_QUAD_FIBER 0x1527 +#define E1000_DEV_ID_DH89XXCC_SGMII 0x0436 +#define E1000_DEV_ID_DH89XXCC_SERDES 0x0438 #define E1000_REVISION_0 0 #define E1000_REVISION_1 1 #define E1000_REVISION_2 2 @@ -135,6 +160,13 @@ struct e1000_hw; #define E1000_FUNC_0 0 #define E1000_FUNC_1 1 +#define E1000_FUNC_2 2 +#define E1000_FUNC_3 3 + +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN2 6 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN3 9 enum e1000_mac_type { e1000_undefined = 0, @@ -154,12 +186,16 @@ enum e1000_mac_type { e1000_82572, e1000_82573, e1000_82574, + e1000_82583, e1000_80003es2lan, e1000_ich8lan, e1000_ich9lan, e1000_ich10lan, + e1000_pchlan, + e1000_pch2lan, e1000_82575, e1000_82576, + e1000_82580, e1000_vfadapt, e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */ }; @@ -199,6 +235,10 @@ enum e1000_phy_type { e1000_phy_igp_3, e1000_phy_ife, e1000_phy_bm, + e1000_phy_82578, + e1000_phy_82577, + e1000_phy_82579, + e1000_phy_82580, e1000_phy_vf, }; @@ -279,6 +319,16 @@ enum e1000_smart_speed { e1000_smart_speed_off }; +enum e1000_serdes_link_state { + e1000_serdes_link_down = 0, + e1000_serdes_link_autoneg_progress, + e1000_serdes_link_autoneg_complete, + e1000_serdes_link_forced_up +}; + +#define __le16 u16 +#define __le32 u32 +#define __le64 u64 /* Receive Descriptor */ struct e1000_rx_desc { __le64 buffer_addr; /* Address of the descriptor's data buffer */ @@ -577,10 +627,12 @@ struct e1000_host_mng_command_info { #include "e1000_phy.h" #include "e1000_nvm.h" #include "e1000_manage.h" +#include "e1000_mbx.h" struct e1000_mac_operations { /* Function pointers for the MAC. */ s32 (*init_params)(struct e1000_hw *); + s32 (*id_led_init)(struct e1000_hw *); s32 (*blink_led)(struct e1000_hw *); s32 (*check_for_link)(struct e1000_hw *); bool (*check_mng_mode)(struct e1000_hw *hw); @@ -592,15 +644,15 @@ struct e1000_mac_operations { s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); s32 (*led_on)(struct e1000_hw *); s32 (*led_off)(struct e1000_hw *); - void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32, u32, u32); + void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32); s32 (*reset_hw)(struct e1000_hw *); s32 (*init_hw)(struct e1000_hw *); void (*shutdown_serdes)(struct e1000_hw *); + void (*power_up_serdes)(struct e1000_hw *); s32 (*setup_link)(struct e1000_hw *); s32 (*setup_physical_interface)(struct e1000_hw *); s32 (*setup_led)(struct e1000_hw *); void (*write_vfta)(struct e1000_hw *, u32, u32); - void (*mta_set)(struct e1000_hw *, u32); void (*config_collision_dist)(struct e1000_hw *); void (*rar_set)(struct e1000_hw *, u8*, u32); s32 (*read_mac_addr)(struct e1000_hw *); @@ -624,11 +676,13 @@ struct e1000_phy_operations { s32 (*get_cable_length)(struct e1000_hw *); s32 (*get_info)(struct e1000_hw *); s32 (*read_reg)(struct e1000_hw *, u32, u16 *); + s32 (*read_reg_locked)(struct e1000_hw *, u32, u16 *); void (*release)(struct e1000_hw *); s32 (*reset)(struct e1000_hw *); s32 (*set_d0_lplu_state)(struct e1000_hw *, bool); s32 (*set_d3_lplu_state)(struct e1000_hw *, bool); s32 (*write_reg)(struct e1000_hw *, u32, u16); + s32 (*write_reg_locked)(struct e1000_hw *, u32, u16); void (*power_up)(struct e1000_hw *); void (*power_down)(struct e1000_hw *); }; @@ -666,11 +720,17 @@ struct e1000_mac_info { u16 ifs_ratio; u16 ifs_step_size; u16 mta_reg_count; + u16 uta_reg_count; + + /* Maximum size of the MTA register table in all supported adapters */ + #define MAX_MTA_REG 128 + u32 mta_shadow[MAX_MTA_REG]; u16 rar_entry_count; u8 forced_speed_duplex; bool adaptive_ifs; + bool has_fwsm; bool arc_subsystem_valid; bool asf_firmware_present; bool autoneg; @@ -678,6 +738,7 @@ struct e1000_mac_info { bool get_link_status; bool in_ifs_mode; bool report_tx_early; + enum e1000_serdes_link_state serdes_link_state; bool serdes_has_link; bool tx_pkt_filtering; }; @@ -744,12 +805,41 @@ struct e1000_fc_info { u32 high_water; /* Flow control high-water mark */ u32 low_water; /* Flow control low-water mark */ u16 pause_time; /* Flow control pause timer */ + u16 refresh_time; /* Flow control refresh timer */ bool send_xon; /* Flow control send XON */ bool strict_ieee; /* Strict IEEE mode */ enum e1000_fc_mode current_mode; /* FC mode in effect */ enum e1000_fc_mode requested_mode; /* FC mode requested by caller */ }; +struct e1000_mbx_operations { + s32 (*init_params)(struct e1000_hw *hw); + s32 (*read)(struct e1000_hw *, u32 *, u16, u16); + s32 (*write)(struct e1000_hw *, u32 *, u16, u16); + s32 (*read_posted)(struct e1000_hw *, u32 *, u16, u16); + s32 (*write_posted)(struct e1000_hw *, u32 *, u16, u16); + s32 (*check_for_msg)(struct e1000_hw *, u16); + s32 (*check_for_ack)(struct e1000_hw *, u16); + s32 (*check_for_rst)(struct e1000_hw *, u16); +}; + +struct e1000_mbx_stats { + u32 msgs_tx; + u32 msgs_rx; + + u32 acks; + u32 reqs; + u32 rsts; +}; + +struct e1000_mbx_info { + struct e1000_mbx_operations ops; + struct e1000_mbx_stats stats; + u32 timeout; + u32 usec_delay; + u16 size; +}; + struct e1000_dev_spec_82541 { enum e1000_dsp_config dsp_config; enum e1000_ffe_config ffe_config; @@ -769,6 +859,12 @@ struct e1000_dev_spec_82543 { struct e1000_dev_spec_82571 { bool laa_is_present; + u32 smb_counter; + E1000_MUTEX swflag_mutex; +}; + +struct e1000_dev_spec_80003es2lan { + bool mdic_wa_enable; }; struct e1000_shadow_ram { @@ -781,14 +877,20 @@ struct e1000_shadow_ram { struct e1000_dev_spec_ich8lan { bool kmrn_lock_loss_workaround_enabled; struct e1000_shadow_ram shadow_ram[E1000_SHADOW_RAM_WORDS]; + E1000_MUTEX nvm_mutex; + E1000_MUTEX swflag_mutex; + bool nvm_k1_enabled; + bool eee_disable; }; struct e1000_dev_spec_82575 { bool sgmii_active; + bool global_device_reset; }; struct e1000_dev_spec_vf { u32 vf_number; + u32 v2p_mailbox; }; struct e1000_hw { @@ -803,6 +905,7 @@ struct e1000_hw { struct e1000_phy_info phy; struct e1000_nvm_info nvm; struct e1000_bus_info bus; + struct e1000_mbx_info mbx; struct e1000_host_mng_dhcp_cookie mng_cookie; union { @@ -810,6 +913,7 @@ struct e1000_hw { struct e1000_dev_spec_82542 _82542; struct e1000_dev_spec_82543 _82543; struct e1000_dev_spec_82571 _82571; + struct e1000_dev_spec_80003es2lan _80003es2lan; struct e1000_dev_spec_ich8lan ich8lan; struct e1000_dev_spec_82575 _82575; struct e1000_dev_spec_vf vf; @@ -834,6 +938,7 @@ struct e1000_hw { void e1000_pci_clear_mwi(struct e1000_hw *hw); void e1000_pci_set_mwi(struct e1000_hw *hw); s32 e1000_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); +s32 e1000_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); void e1000_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); void e1000_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.c index e0ef3b5a14..6462e3add2 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_ich8lan.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_ich8lan.c,v 1.5.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ /* * 82562G 10/100 Network Connection @@ -54,21 +54,30 @@ * 82567LF-3 Gigabit Network Connection * 82567LM-3 Gigabit Network Connection * 82567LM-4 Gigabit Network Connection + * 82577LM Gigabit Network Connection + * 82577LC Gigabit Network Connection + * 82578DM Gigabit Network Connection + * 82578DC Gigabit Network Connection + * 82579LM Gigabit Network Connection + * 82579V Gigabit Network Connection */ #include "e1000_api.h" static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw); +static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw); static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw); static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw); static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw); static void e1000_release_swflag_ich8lan(struct e1000_hw *hw); +static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw); +static void e1000_release_nvm_ich8lan(struct e1000_hw *hw); static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); -static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw); +static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); +static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index); static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw); -static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw); static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw); -static s32 e1000_get_phy_info_ich8lan(struct e1000_hw *hw); +static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active); static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active); static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, @@ -81,6 +90,7 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw); static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw); static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, u16 *data); +static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw); static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw); static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw); static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw); @@ -91,11 +101,15 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw); static s32 e1000_led_on_ich8lan(struct e1000_hw *hw); static s32 e1000_led_off_ich8lan(struct e1000_hw *hw); +static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link); +static s32 e1000_setup_led_pchlan(struct e1000_hw *hw); +static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw); +static s32 e1000_led_on_pchlan(struct e1000_hw *hw); +static s32 e1000_led_off_pchlan(struct e1000_hw *hw); static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank); static s32 e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout); static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw); -static s32 e1000_get_phy_info_ife_ich8lan(struct e1000_hw *hw); static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw); static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, @@ -112,6 +126,12 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, u8 size, u16 data); static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw); static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw); +static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw); +static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw); +static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw); +static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); +static s32 e1000_k1_workaround_lv(struct e1000_hw *hw); +static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate); /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ /* Offset 04h HSFSTS */ @@ -154,6 +174,129 @@ union ich8_hws_flash_regacc { u16 regval; }; +/** + * e1000_init_phy_params_pchlan - Initialize PHY function pointers + * @hw: pointer to the HW structure + * + * Initialize family-specific PHY parameters and function pointers. + **/ +static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + u32 ctrl, fwsm; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_init_phy_params_pchlan"); + + phy->addr = 1; + phy->reset_delay_us = 100; + + phy->ops.acquire = e1000_acquire_swflag_ich8lan; + phy->ops.check_reset_block = e1000_check_reset_block_ich8lan; + phy->ops.get_cfg_done = e1000_get_cfg_done_ich8lan; + phy->ops.read_reg = e1000_read_phy_reg_hv; + phy->ops.read_reg_locked = e1000_read_phy_reg_hv_locked; + phy->ops.release = e1000_release_swflag_ich8lan; + phy->ops.reset = e1000_phy_hw_reset_ich8lan; + phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan; + phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan; + phy->ops.write_reg = e1000_write_phy_reg_hv; + phy->ops.write_reg_locked = e1000_write_phy_reg_hv_locked; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + + /* + * The MAC-PHY interconnect may still be in SMBus mode + * after Sx->S0. If the manageability engine (ME) is + * disabled, then toggle the LANPHYPC Value bit to force + * the interconnect to PCIe mode. + */ + fwsm = E1000_READ_REG(hw, E1000_FWSM); + if (!(fwsm & E1000_ICH_FWSM_FW_VALID)) { + ctrl = E1000_READ_REG(hw, E1000_CTRL); + ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; + ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + usec_delay(10); + ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + msec_delay(50); + + /* + * Gate automatic PHY configuration by hardware on + * non-managed 82579 + */ + if (hw->mac.type == e1000_pch2lan) + e1000_gate_hw_phy_config_ich8lan(hw, TRUE); + } + + /* + * Reset the PHY before any acccess to it. Doing so, ensures that + * the PHY is in a known good state before we read/write PHY registers. + * The generic reset is sufficient here, because we haven't determined + * the PHY type yet. + */ + ret_val = e1000_phy_hw_reset_generic(hw); + if (ret_val) + goto out; + + /* Ungate automatic PHY configuration on non-managed 82579 */ + if ((hw->mac.type == e1000_pch2lan) && + !(fwsm & E1000_ICH_FWSM_FW_VALID)) { + msec_delay(10); + e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + } + + phy->id = e1000_phy_unknown; + switch (hw->mac.type) { + default: + ret_val = e1000_get_phy_id(hw); + if (ret_val) + goto out; + if ((phy->id != 0) && (phy->id != PHY_REVISION_MASK)) + break; + /* fall-through */ + case e1000_pch2lan: + /* + * In case the PHY needs to be in mdio slow mode, + * set slow mode and try to get the PHY id again. + */ + ret_val = e1000_set_mdio_slow_mode_hv(hw); + if (ret_val) + goto out; + ret_val = e1000_get_phy_id(hw); + if (ret_val) + goto out; + break; + } + phy->type = e1000_get_phy_type_from_id(phy->id); + + switch (phy->type) { + case e1000_phy_82577: + case e1000_phy_82579: + phy->ops.check_polarity = e1000_check_polarity_82577; + phy->ops.force_speed_duplex = + e1000_phy_force_speed_duplex_82577; + phy->ops.get_cable_length = e1000_get_cable_length_82577; + phy->ops.get_info = e1000_get_phy_info_82577; + phy->ops.commit = e1000_phy_sw_reset_generic; + break; + case e1000_phy_82578: + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + break; + default: + ret_val = -E1000_ERR_PHY; + break; + } + +out: + return ret_val; +} + /** * e1000_init_phy_params_ich8lan - Initialize PHY function pointers * @hw: pointer to the HW structure @@ -172,12 +315,9 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) phy->reset_delay_us = 100; phy->ops.acquire = e1000_acquire_swflag_ich8lan; - phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; phy->ops.check_reset_block = e1000_check_reset_block_ich8lan; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_ich8lan; phy->ops.get_cable_length = e1000_get_cable_length_igp_2; phy->ops.get_cfg_done = e1000_get_cfg_done_ich8lan; - phy->ops.get_info = e1000_get_phy_info_ich8lan; phy->ops.read_reg = e1000_read_phy_reg_igp; phy->ops.release = e1000_release_swflag_ich8lan; phy->ops.reset = e1000_phy_hw_reset_ich8lan; @@ -197,7 +337,7 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) phy->ops.read_reg = e1000_read_phy_reg_bm; ret_val = e1000_determine_phy_address(hw); if (ret_val) { - DEBUGOUT("Cannot determine PHY address. Erroring out\n"); + DEBUGOUT("Cannot determine PHY addr. Erroring out\n"); goto out; } } @@ -216,12 +356,20 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) case IGP03E1000_E_PHY_ID: phy->type = e1000_phy_igp_3; phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->ops.read_reg_locked = e1000_read_phy_reg_igp_locked; + phy->ops.write_reg_locked = e1000_write_phy_reg_igp_locked; + phy->ops.get_info = e1000_get_phy_info_igp; + phy->ops.check_polarity = e1000_check_polarity_igp; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; break; case IFE_E_PHY_ID: case IFE_PLUS_E_PHY_ID: case IFE_C_E_PHY_ID: phy->type = e1000_phy_ife; phy->autoneg_mask = E1000_ALL_NOT_GIG; + phy->ops.get_info = e1000_get_phy_info_ife; + phy->ops.check_polarity = e1000_check_polarity_ife; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_ife; break; case BME1000_E_PHY_ID: phy->type = e1000_phy_bm; @@ -229,6 +377,9 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) phy->ops.read_reg = e1000_read_phy_reg_bm; phy->ops.write_reg = e1000_write_phy_reg_bm; phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; break; default: ret_val = -E1000_ERR_PHY; @@ -296,10 +447,13 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) dev_spec->shadow_ram[i].value = 0xFFFF; } + E1000_MUTEX_INIT(&dev_spec->nvm_mutex); + E1000_MUTEX_INIT(&dev_spec->swflag_mutex); + /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_swflag_ich8lan; + nvm->ops.acquire = e1000_acquire_nvm_ich8lan; + nvm->ops.release = e1000_release_nvm_ich8lan; nvm->ops.read = e1000_read_nvm_ich8lan; - nvm->ops.release = e1000_release_swflag_ich8lan; nvm->ops.update = e1000_update_nvm_checksum_ich8lan; nvm->ops.valid_led_default = e1000_valid_led_default_ich8lan; nvm->ops.validate = e1000_validate_nvm_checksum_ich8lan; @@ -319,6 +473,7 @@ out: static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; + u16 pci_cfg; DEBUGFUNC("e1000_init_mac_params_ich8lan"); @@ -333,8 +488,12 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) mac->rar_entry_count--; /* Set if part includes ASF firmware */ mac->asf_firmware_present = TRUE; - /* Set if manageability features are enabled. */ - mac->arc_subsystem_valid = TRUE; + /* FWSM register */ + mac->has_fwsm = TRUE; + /* ARC subsystem not supported */ + mac->arc_subsystem_valid = FALSE; + /* Adaptive IFS supported */ + mac->adaptive_ifs = TRUE; /* Function pointers */ @@ -351,35 +510,200 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /* physical interface setup */ mac->ops.setup_physical_interface = e1000_setup_copper_link_ich8lan; /* check for link */ - mac->ops.check_for_link = e1000_check_for_copper_link_generic; - /* check management mode */ - mac->ops.check_mng_mode = e1000_check_mng_mode_ich8lan; + mac->ops.check_for_link = e1000_check_for_copper_link_ich8lan; /* link info */ mac->ops.get_link_up_info = e1000_get_link_up_info_ich8lan; /* multicast address update */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; - /* setting MTA */ - mac->ops.mta_set = e1000_mta_set_generic; - /* blink LED */ - mac->ops.blink_led = e1000_blink_led_generic; - /* setup LED */ - mac->ops.setup_led = e1000_setup_led_generic; - /* cleanup LED */ - mac->ops.cleanup_led = e1000_cleanup_led_ich8lan; - /* turn on/off LED */ - mac->ops.led_on = e1000_led_on_ich8lan; - mac->ops.led_off = e1000_led_off_ich8lan; /* clear hardware counters */ mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan; + /* LED operations */ + switch (mac->type) { + case e1000_ich8lan: + case e1000_ich9lan: + case e1000_ich10lan: + /* check management mode */ + mac->ops.check_mng_mode = e1000_check_mng_mode_ich8lan; + /* ID LED init */ + mac->ops.id_led_init = e1000_id_led_init_generic; + /* blink LED */ + mac->ops.blink_led = e1000_blink_led_generic; + /* setup LED */ + mac->ops.setup_led = e1000_setup_led_generic; + /* cleanup LED */ + mac->ops.cleanup_led = e1000_cleanup_led_ich8lan; + /* turn on/off LED */ + mac->ops.led_on = e1000_led_on_ich8lan; + mac->ops.led_off = e1000_led_off_ich8lan; + break; + case e1000_pch2lan: + mac->rar_entry_count = E1000_PCH2_RAR_ENTRIES; + mac->ops.rar_set = e1000_rar_set_pch2lan; + /* fall-through */ + case e1000_pchlan: + /* save PCH revision_id */ + e1000_read_pci_cfg(hw, 0x2, &pci_cfg); + hw->revision_id = (u8)(pci_cfg &= 0x000F); + /* check management mode */ + mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan; + /* ID LED init */ + mac->ops.id_led_init = e1000_id_led_init_pchlan; + /* setup LED */ + mac->ops.setup_led = e1000_setup_led_pchlan; + /* cleanup LED */ + mac->ops.cleanup_led = e1000_cleanup_led_pchlan; + /* turn on/off LED */ + mac->ops.led_on = e1000_led_on_pchlan; + mac->ops.led_off = e1000_led_off_pchlan; + break; + default: + break; + } + /* Enable PCS Lock-loss workaround for ICH8 */ if (mac->type == e1000_ich8lan) e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, TRUE); + /* Gate automatic PHY configuration by hardware on managed 82579 */ + if ((mac->type == e1000_pch2lan) && + (E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID)) + e1000_gate_hw_phy_config_ich8lan(hw, TRUE); return E1000_SUCCESS; } +/** + * e1000_set_eee_pchlan - Enable/disable EEE support + * @hw: pointer to the HW structure + * + * Enable/disable EEE based on setting in dev_spec structure. The bits in + * the LPI Control register will remain set only if/when link is up. + **/ +static s32 e1000_set_eee_pchlan(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 phy_reg; + + DEBUGFUNC("e1000_set_eee_pchlan"); + + if (hw->phy.type != e1000_phy_82579) + goto out; + + ret_val = hw->phy.ops.read_reg(hw, I82579_LPI_CTRL, &phy_reg); + if (ret_val) + goto out; + + if (hw->dev_spec.ich8lan.eee_disable) + phy_reg &= ~I82579_LPI_CTRL_ENABLE_MASK; + else + phy_reg |= I82579_LPI_CTRL_ENABLE_MASK; + + ret_val = hw->phy.ops.write_reg(hw, I82579_LPI_CTRL, phy_reg); +out: + return ret_val; +} + +/** + * e1000_check_for_copper_link_ich8lan - Check for link (Copper) + * @hw: pointer to the HW structure + * + * Checks to see of the link status of the hardware has changed. If a + * change in link status has been detected, then we read the PHY registers + * to get the current speed/duplex if link exists. + **/ +static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) +{ + struct e1000_mac_info *mac = &hw->mac; + s32 ret_val; + bool link; + + DEBUGFUNC("e1000_check_for_copper_link_ich8lan"); + + /* + * We only want to go out to the PHY registers to see if Auto-Neg + * has completed and/or if our link status has changed. The + * get_link_status flag is set upon receiving a Link Status + * Change or Rx Sequence Error interrupt. + */ + if (!mac->get_link_status) { + ret_val = E1000_SUCCESS; + goto out; + } + + /* + * First we want to see if the MII Status Register reports + * link. If so, then we want to get the current speed/duplex + * of the PHY. + */ + ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); + if (ret_val) + goto out; + + if (hw->mac.type == e1000_pchlan) { + ret_val = e1000_k1_gig_workaround_hv(hw, link); + if (ret_val) + goto out; + } + + if (!link) + goto out; /* No link detected */ + + mac->get_link_status = FALSE; + + if (hw->phy.type == e1000_phy_82578) { + ret_val = e1000_link_stall_workaround_hv(hw); + if (ret_val) + goto out; + } + + if (hw->mac.type == e1000_pch2lan) { + ret_val = e1000_k1_workaround_lv(hw); + if (ret_val) + goto out; + } + + /* + * Check if there was DownShift, must be checked + * immediately after link-up + */ + e1000_check_downshift_generic(hw); + + /* Enable/Disable EEE after link up */ + ret_val = e1000_set_eee_pchlan(hw); + if (ret_val) + goto out; + + /* + * If we are forcing speed/duplex, then we simply return since + * we have already determined whether we have link or not. + */ + if (!mac->autoneg) { + ret_val = -E1000_ERR_CONFIG; + goto out; + } + + /* + * Auto-Neg is enabled. Auto Speed Detection takes care + * of MAC speed/duplex configuration. So we only need to + * configure Collision Distance in the MAC. + */ + e1000_config_collision_dist_generic(hw); + + /* + * Configure Flow Control now that Auto-Neg has completed. + * First, we need to restore the desired flow control + * settings because we may have had to re-autoneg with a + * different link partner. + */ + ret_val = e1000_config_fc_after_link_up_generic(hw); + if (ret_val) + DEBUGOUT("Error configuring flow control\n"); + +out: + return ret_val; +} + /** * e1000_init_function_pointers_ich8lan - Initialize ICH8 function pointers * @hw: pointer to the HW structure @@ -392,16 +716,57 @@ void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw) hw->mac.ops.init_params = e1000_init_mac_params_ich8lan; hw->nvm.ops.init_params = e1000_init_nvm_params_ich8lan; - hw->phy.ops.init_params = e1000_init_phy_params_ich8lan; + switch (hw->mac.type) { + case e1000_ich8lan: + case e1000_ich9lan: + case e1000_ich10lan: + hw->phy.ops.init_params = e1000_init_phy_params_ich8lan; + break; + case e1000_pchlan: + case e1000_pch2lan: + hw->phy.ops.init_params = e1000_init_phy_params_pchlan; + break; + default: + break; + } +} + +/** + * e1000_acquire_nvm_ich8lan - Acquire NVM mutex + * @hw: pointer to the HW structure + * + * Acquires the mutex for performing NVM operations. + **/ +static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_acquire_nvm_ich8lan"); + + E1000_MUTEX_LOCK(&hw->dev_spec.ich8lan.nvm_mutex); + + return E1000_SUCCESS; +} + +/** + * e1000_release_nvm_ich8lan - Release NVM mutex + * @hw: pointer to the HW structure + * + * Releases the mutex used while performing NVM operations. + **/ +static void e1000_release_nvm_ich8lan(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_release_nvm_ich8lan"); + + E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.nvm_mutex); + + return; } /** * e1000_acquire_swflag_ich8lan - Acquire software control flag * @hw: pointer to the HW structure * - * Acquires the software control flag for performing NVM and PHY - * operations. This is a function pointer entry point only called by - * read/write routines for the PHY and NVM parts. + * Acquires the software control flag for performing PHY and select + * MAC CSR accesses. **/ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) { @@ -410,20 +775,39 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) DEBUGFUNC("e1000_acquire_swflag_ich8lan"); + E1000_MUTEX_LOCK(&hw->dev_spec.ich8lan.swflag_mutex); + while (timeout) { extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); - extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; - E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); - - extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); - if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) + if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) break; + msec_delay_irq(1); timeout--; } if (!timeout) { - DEBUGOUT("FW or HW has locked the resource for too long.\n"); + DEBUGOUT("SW/FW/HW has locked the resource for too long.\n"); + ret_val = -E1000_ERR_CONFIG; + goto out; + } + + timeout = SW_FLAG_TIMEOUT; + + extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; + E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); + + while (timeout) { + extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) + break; + + msec_delay_irq(1); + timeout--; + } + + if (!timeout) { + DEBUGOUT("Failed to acquire the semaphore.\n"); extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); ret_val = -E1000_ERR_CONFIG; @@ -431,6 +815,9 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) } out: + if (ret_val) + E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); + return ret_val; } @@ -438,9 +825,8 @@ out: * e1000_release_swflag_ich8lan - Release software control flag * @hw: pointer to the HW structure * - * Releases the software control flag for performing NVM and PHY operations. - * This is a function pointer entry point only called by read/write - * routines for the PHY and NVM parts. + * Releases the software control flag for performing PHY and select + * MAC CSR accesses. **/ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) { @@ -452,6 +838,8 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); + E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); + return; } @@ -459,7 +847,7 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) * e1000_check_mng_mode_ich8lan - Checks management mode * @hw: pointer to the HW structure * - * This checks if the adapter has manageability enabled. + * This checks if the adapter has any manageability enabled. * This is a function pointer entry point only called by read/write * routines for the PHY and NVM parts. **/ @@ -471,8 +859,86 @@ static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw) fwsm = E1000_READ_REG(hw, E1000_FWSM); - return (fwsm & E1000_FWSM_MODE_MASK) == - (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT); + return (fwsm & E1000_ICH_FWSM_FW_VALID) && + ((fwsm & E1000_FWSM_MODE_MASK) == + (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)); +} + +/** + * e1000_check_mng_mode_pchlan - Checks management mode + * @hw: pointer to the HW structure + * + * This checks if the adapter has iAMT enabled. + * This is a function pointer entry point only called by read/write + * routines for the PHY and NVM parts. + **/ +static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw) +{ + u32 fwsm; + + DEBUGFUNC("e1000_check_mng_mode_pchlan"); + + fwsm = E1000_READ_REG(hw, E1000_FWSM); + + return (fwsm & E1000_ICH_FWSM_FW_VALID) && + (fwsm & (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)); +} + +/** + * e1000_rar_set_pch2lan - Set receive address register + * @hw: pointer to the HW structure + * @addr: pointer to the receive address + * @index: receive address array register + * + * Sets the receive address array register at index to the address passed + * in by addr. For 82579, RAR[0] is the base address register that is to + * contain the MAC address but RAR[1-6] are reserved for manageability (ME). + * Use SHRA[0-3] in place of those reserved for ME. + **/ +static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) +{ + u32 rar_low, rar_high; + + DEBUGFUNC("e1000_rar_set_pch2lan"); + + /* + * HW expects these in little endian so we reverse the byte order + * from network order (big endian) to little endian + */ + rar_low = ((u32) addr[0] | + ((u32) addr[1] << 8) | + ((u32) addr[2] << 16) | ((u32) addr[3] << 24)); + + rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); + + /* If MAC address zero, no need to set the AV bit */ + if (rar_low || rar_high) + rar_high |= E1000_RAH_AV; + + if (index == 0) { + E1000_WRITE_REG(hw, E1000_RAL(index), rar_low); + E1000_WRITE_FLUSH(hw); + E1000_WRITE_REG(hw, E1000_RAH(index), rar_high); + E1000_WRITE_FLUSH(hw); + return; + } + + if (index < hw->mac.rar_entry_count) { + E1000_WRITE_REG(hw, E1000_SHRAL(index - 1), rar_low); + E1000_WRITE_FLUSH(hw); + E1000_WRITE_REG(hw, E1000_SHRAH(index - 1), rar_high); + E1000_WRITE_FLUSH(hw); + + /* verify the register updates */ + if ((E1000_READ_REG(hw, E1000_SHRAL(index - 1)) == rar_low) && + (E1000_READ_REG(hw, E1000_SHRAH(index - 1)) == rar_high)) + return; + + DEBUGOUT2("SHRA[%d] might be locked by ME - FWSM=0x%8.8x\n", + (index - 1), E1000_READ_REG(hw, E1000_FWSM)); + } + + DEBUGOUT1("Failed to write receive address at index %d\n", index); } /** @@ -489,6 +955,9 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) DEBUGFUNC("e1000_check_reset_block_ich8lan"); + if (hw->phy.reset_disable) + return E1000_BLK_PHY_RESET; + fwsm = E1000_READ_REG(hw, E1000_FWSM); return (fwsm & E1000_ICH_FWSM_RSPCIPHY) ? E1000_SUCCESS @@ -496,75 +965,959 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) } /** - * e1000_phy_force_speed_duplex_ich8lan - Force PHY speed & duplex + * e1000_write_smbus_addr - Write SMBus address to PHY needed during Sx states * @hw: pointer to the HW structure * - * Forces the speed and duplex settings of the PHY. - * This is a function pointer entry point only called by - * PHY setup routines. + * Assumes semaphore already acquired. + * **/ -static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw) +static s32 e1000_write_smbus_addr(struct e1000_hw *hw) +{ + u16 phy_data; + u32 strap = E1000_READ_REG(hw, E1000_STRAP); + s32 ret_val = E1000_SUCCESS; + + strap &= E1000_STRAP_SMBUS_ADDRESS_MASK; + + ret_val = e1000_read_phy_reg_hv_locked(hw, HV_SMB_ADDR, &phy_data); + if (ret_val) + goto out; + + phy_data &= ~HV_SMB_ADDR_MASK; + phy_data |= (strap >> E1000_STRAP_SMBUS_ADDRESS_SHIFT); + phy_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID; + ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, phy_data); + +out: + return ret_val; +} + +/** + * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration + * @hw: pointer to the HW structure + * + * SW should configure the LCD from the NVM extended configuration region + * as a workaround for certain parts. + **/ +static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; - s32 ret_val; - u16 data; - bool link; + u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; + s32 ret_val = E1000_SUCCESS; + u16 word_addr, reg_data, reg_addr, phy_page = 0; - DEBUGFUNC("e1000_phy_force_speed_duplex_ich8lan"); + DEBUGFUNC("e1000_sw_lcd_config_ich8lan"); - if (phy->type != e1000_phy_ife) { - ret_val = e1000_phy_force_speed_duplex_igp(hw); - goto out; + /* + * Initialize the PHY from the NVM on ICH platforms. This + * is needed due to an issue where the NVM configuration is + * not properly autoloaded after power transitions. + * Therefore, after each PHY reset, we will load the + * configuration data out of the NVM manually. + */ + switch (hw->mac.type) { + case e1000_ich8lan: + if (phy->type != e1000_phy_igp_3) + return ret_val; + + if ((hw->device_id == E1000_DEV_ID_ICH8_IGP_AMT) || + (hw->device_id == E1000_DEV_ID_ICH8_IGP_C)) { + sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; + break; + } + /* Fall-thru */ + case e1000_pchlan: + case e1000_pch2lan: + sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; + break; + default: + return ret_val; } - ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &data); + ret_val = hw->phy.ops.acquire(hw); if (ret_val) + return ret_val; + + data = E1000_READ_REG(hw, E1000_FEXTNVM); + if (!(data & sw_cfg_mask)) goto out; - e1000_phy_force_speed_duplex_setup(hw, &data); + /* + * Make sure HW does not configure LCD from PHY + * extended configuration before SW configuration + */ + data = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + if (!(hw->mac.type == e1000_pch2lan)) { + if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) + goto out; + } - ret_val = phy->ops.write_reg(hw, PHY_CONTROL, data); - if (ret_val) + cnf_size = E1000_READ_REG(hw, E1000_EXTCNF_SIZE); + cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; + cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT; + if (!cnf_size) goto out; - /* Disable MDI-X support for 10/100 */ - ret_val = phy->ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, &data); - if (ret_val) - goto out; + cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; + cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; - data &= ~IFE_PMC_AUTO_MDIX; - data &= ~IFE_PMC_FORCE_MDIX; - - ret_val = phy->ops.write_reg(hw, IFE_PHY_MDIX_CONTROL, data); - if (ret_val) - goto out; - - DEBUGOUT1("IFE PMC: %X\n", data); - - usec_delay(1); - - if (phy->autoneg_wait_to_complete) { - DEBUGOUT("Waiting for forced speed/duplex link on IFE phy.\n"); - - ret_val = e1000_phy_has_link_generic(hw, - PHY_FORCE_LIMIT, - 100000, - &link); + if ((!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && + (hw->mac.type == e1000_pchlan)) || + (hw->mac.type == e1000_pch2lan)) { + /* + * HW configures the SMBus address and LEDs when the + * OEM and LCD Write Enable bits are set in the NVM. + * When both NVM bits are cleared, SW will configure + * them instead. + */ + ret_val = e1000_write_smbus_addr(hw); if (ret_val) goto out; - if (!link) - DEBUGOUT("Link taking longer than expected.\n"); - - /* Try once more */ - ret_val = e1000_phy_has_link_generic(hw, - PHY_FORCE_LIMIT, - 100000, - &link); + data = E1000_READ_REG(hw, E1000_LEDCTL); + ret_val = e1000_write_phy_reg_hv_locked(hw, HV_LED_CONFIG, + (u16)data); if (ret_val) goto out; } + /* Configure LCD from extended configuration region. */ + + /* cnf_base_addr is in DWORD */ + word_addr = (u16)(cnf_base_addr << 1); + + for (i = 0; i < cnf_size; i++) { + ret_val = hw->nvm.ops.read(hw, (word_addr + i * 2), 1, + ®_data); + if (ret_val) + goto out; + + ret_val = hw->nvm.ops.read(hw, (word_addr + i * 2 + 1), + 1, ®_addr); + if (ret_val) + goto out; + + /* Save off the PHY page for future writes. */ + if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) { + phy_page = reg_data; + continue; + } + + reg_addr &= PHY_REG_MASK; + reg_addr |= phy_page; + + ret_val = phy->ops.write_reg_locked(hw, (u32)reg_addr, + reg_data); + if (ret_val) + goto out; + } + +out: + hw->phy.ops.release(hw); + return ret_val; +} + +/** + * e1000_k1_gig_workaround_hv - K1 Si workaround + * @hw: pointer to the HW structure + * @link: link up bool flag + * + * If K1 is enabled for 1Gbps, the MAC might stall when transitioning + * from a lower speed. This workaround disables K1 whenever link is at 1Gig + * If link is down, the function will restore the default K1 setting located + * in the NVM. + **/ +static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) +{ + s32 ret_val = E1000_SUCCESS; + u16 status_reg = 0; + bool k1_enable = hw->dev_spec.ich8lan.nvm_k1_enabled; + + DEBUGFUNC("e1000_k1_gig_workaround_hv"); + + if (hw->mac.type != e1000_pchlan) + goto out; + + /* Wrap the whole flow with the sw flag */ + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + + /* Disable K1 when link is 1Gbps, otherwise use the NVM setting */ + if (link) { + if (hw->phy.type == e1000_phy_82578) { + ret_val = hw->phy.ops.read_reg_locked(hw, BM_CS_STATUS, + &status_reg); + if (ret_val) + goto release; + + status_reg &= BM_CS_STATUS_LINK_UP | + BM_CS_STATUS_RESOLVED | + BM_CS_STATUS_SPEED_MASK; + + if (status_reg == (BM_CS_STATUS_LINK_UP | + BM_CS_STATUS_RESOLVED | + BM_CS_STATUS_SPEED_1000)) + k1_enable = FALSE; + } + + if (hw->phy.type == e1000_phy_82577) { + ret_val = hw->phy.ops.read_reg_locked(hw, HV_M_STATUS, + &status_reg); + if (ret_val) + goto release; + + status_reg &= HV_M_STATUS_LINK_UP | + HV_M_STATUS_AUTONEG_COMPLETE | + HV_M_STATUS_SPEED_MASK; + + if (status_reg == (HV_M_STATUS_LINK_UP | + HV_M_STATUS_AUTONEG_COMPLETE | + HV_M_STATUS_SPEED_1000)) + k1_enable = FALSE; + } + + /* Link stall fix for link up */ + ret_val = hw->phy.ops.write_reg_locked(hw, PHY_REG(770, 19), + 0x0100); + if (ret_val) + goto release; + + } else { + /* Link stall fix for link down */ + ret_val = hw->phy.ops.write_reg_locked(hw, PHY_REG(770, 19), + 0x4100); + if (ret_val) + goto release; + } + + ret_val = e1000_configure_k1_ich8lan(hw, k1_enable); + +release: + hw->phy.ops.release(hw); +out: + return ret_val; +} + +/** + * e1000_configure_k1_ich8lan - Configure K1 power state + * @hw: pointer to the HW structure + * @enable: K1 state to configure + * + * Configure the K1 power state based on the provided parameter. + * Assumes semaphore already acquired. + * + * Success returns 0, Failure returns -E1000_ERR_PHY (-2) + **/ +s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable) +{ + s32 ret_val = E1000_SUCCESS; + u32 ctrl_reg = 0; + u32 ctrl_ext = 0; + u32 reg = 0; + u16 kmrn_reg = 0; + + DEBUGFUNC("e1000_configure_k1_ich8lan"); + + ret_val = e1000_read_kmrn_reg_locked(hw, + E1000_KMRNCTRLSTA_K1_CONFIG, + &kmrn_reg); + if (ret_val) + goto out; + + if (k1_enable) + kmrn_reg |= E1000_KMRNCTRLSTA_K1_ENABLE; + else + kmrn_reg &= ~E1000_KMRNCTRLSTA_K1_ENABLE; + + ret_val = e1000_write_kmrn_reg_locked(hw, + E1000_KMRNCTRLSTA_K1_CONFIG, + kmrn_reg); + if (ret_val) + goto out; + + usec_delay(20); + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + ctrl_reg = E1000_READ_REG(hw, E1000_CTRL); + + reg = ctrl_reg & ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); + reg |= E1000_CTRL_FRCSPD; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS); + usec_delay(20); + E1000_WRITE_REG(hw, E1000_CTRL, ctrl_reg); + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); + usec_delay(20); + +out: + return ret_val; +} + +/** + * e1000_oem_bits_config_ich8lan - SW-based LCD Configuration + * @hw: pointer to the HW structure + * @d0_state: boolean if entering d0 or d3 device state + * + * SW will configure Gbe Disable and LPLU based on the NVM. The four bits are + * collectively called OEM bits. The OEM Write Enable bit and SW Config bit + * in NVM determines whether HW should configure LPLU and Gbe Disable. + **/ +s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) +{ + s32 ret_val = 0; + u32 mac_reg; + u16 oem_reg; + + DEBUGFUNC("e1000_oem_bits_config_ich8lan"); + + if ((hw->mac.type != e1000_pch2lan) && (hw->mac.type != e1000_pchlan)) + return ret_val; + + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + + if (!(hw->mac.type == e1000_pch2lan)) { + mac_reg = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) + goto out; + } + + mac_reg = E1000_READ_REG(hw, E1000_FEXTNVM); + if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M)) + goto out; + + mac_reg = E1000_READ_REG(hw, E1000_PHY_CTRL); + + ret_val = hw->phy.ops.read_reg_locked(hw, HV_OEM_BITS, &oem_reg); + if (ret_val) + goto out; + + oem_reg &= ~(HV_OEM_BITS_GBE_DIS | HV_OEM_BITS_LPLU); + + if (d0_state) { + if (mac_reg & E1000_PHY_CTRL_GBE_DISABLE) + oem_reg |= HV_OEM_BITS_GBE_DIS; + + if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) + oem_reg |= HV_OEM_BITS_LPLU; + } else { + if (mac_reg & E1000_PHY_CTRL_NOND0A_GBE_DISABLE) + oem_reg |= HV_OEM_BITS_GBE_DIS; + + if (mac_reg & E1000_PHY_CTRL_NOND0A_LPLU) + oem_reg |= HV_OEM_BITS_LPLU; + } + /* Restart auto-neg to activate the bits */ + if (!hw->phy.ops.check_reset_block(hw)) + oem_reg |= HV_OEM_BITS_RESTART_AN; + ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); + +out: + hw->phy.ops.release(hw); + + return ret_val; +} + + +/** + * e1000_hv_phy_powerdown_workaround_ich8lan - Power down workaround on Sx + * @hw: pointer to the HW structure + **/ +s32 e1000_hv_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_hv_phy_powerdown_workaround_ich8lan"); + + if ((hw->phy.type != e1000_phy_82577) || (hw->revision_id > 2)) + return E1000_SUCCESS; + + return hw->phy.ops.write_reg(hw, PHY_REG(768, 25), 0x0444); +} + +/** + * e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode + * @hw: pointer to the HW structure + **/ +static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw) +{ + s32 ret_val; + u16 data; + + DEBUGFUNC("e1000_set_mdio_slow_mode_hv"); + + ret_val = hw->phy.ops.read_reg(hw, HV_KMRN_MODE_CTRL, &data); + if (ret_val) + return ret_val; + + data |= HV_KMRN_MDIO_SLOW; + + ret_val = hw->phy.ops.write_reg(hw, HV_KMRN_MODE_CTRL, data); + + return ret_val; +} + +/** + * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be + * done after every PHY reset. + **/ +static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 phy_data; + + DEBUGFUNC("e1000_hv_phy_workarounds_ich8lan"); + + if (hw->mac.type != e1000_pchlan) + goto out; + + /* Set MDIO slow mode before any other MDIO access */ + if (hw->phy.type == e1000_phy_82577) { + ret_val = e1000_set_mdio_slow_mode_hv(hw); + if (ret_val) + goto out; + } + + /* Hanksville M Phy init for IEEE. */ + if ((hw->revision_id == 2) && + (hw->phy.type == e1000_phy_82577) && + ((hw->phy.revision == 2) || (hw->phy.revision == 3))) { + hw->phy.ops.write_reg(hw, 0x10, 0x8823); + hw->phy.ops.write_reg(hw, 0x11, 0x0018); + hw->phy.ops.write_reg(hw, 0x10, 0x8824); + hw->phy.ops.write_reg(hw, 0x11, 0x0016); + hw->phy.ops.write_reg(hw, 0x10, 0x8825); + hw->phy.ops.write_reg(hw, 0x11, 0x001A); + hw->phy.ops.write_reg(hw, 0x10, 0x888C); + hw->phy.ops.write_reg(hw, 0x11, 0x0007); + hw->phy.ops.write_reg(hw, 0x10, 0x888D); + hw->phy.ops.write_reg(hw, 0x11, 0x0007); + hw->phy.ops.write_reg(hw, 0x10, 0x888E); + hw->phy.ops.write_reg(hw, 0x11, 0x0007); + hw->phy.ops.write_reg(hw, 0x10, 0x8827); + hw->phy.ops.write_reg(hw, 0x11, 0x0001); + hw->phy.ops.write_reg(hw, 0x10, 0x8835); + hw->phy.ops.write_reg(hw, 0x11, 0x0001); + hw->phy.ops.write_reg(hw, 0x10, 0x8834); + hw->phy.ops.write_reg(hw, 0x11, 0x0001); + hw->phy.ops.write_reg(hw, 0x10, 0x8833); + hw->phy.ops.write_reg(hw, 0x11, 0x0002); + } + + if (((hw->phy.type == e1000_phy_82577) && + ((hw->phy.revision == 1) || (hw->phy.revision == 2))) || + ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) { + /* Disable generation of early preamble */ + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 25), 0x4431); + if (ret_val) + goto out; + + /* Preamble tuning for SSC */ + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(770, 16), 0xA204); + if (ret_val) + goto out; + } + + if (hw->phy.type == e1000_phy_82578) { + if (hw->revision_id < 3) { + /* PHY config */ + ret_val = hw->phy.ops.write_reg(hw, (1 << 6) | 0x29, + 0x66C0); + if (ret_val) + goto out; + + /* PHY config */ + ret_val = hw->phy.ops.write_reg(hw, (1 << 6) | 0x1E, + 0xFFFF); + if (ret_val) + goto out; + } + + /* + * Return registers to default by doing a soft reset then + * writing 0x3140 to the control register. + */ + if (hw->phy.revision < 2) { + e1000_phy_sw_reset_generic(hw); + ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, + 0x3140); + } + } + + if ((hw->revision_id == 2) && + (hw->phy.type == e1000_phy_82577) && + ((hw->phy.revision == 2) || (hw->phy.revision == 3))) { + /* + * Workaround for OEM (GbE) not operating after reset - + * restart AN (twice) + */ + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(768, 25), 0x0400); + if (ret_val) + goto out; + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(768, 25), 0x0400); + if (ret_val) + goto out; + } + + /* Select page 0 */ + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + + hw->phy.addr = 1; + ret_val = e1000_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0); + hw->phy.ops.release(hw); + if (ret_val) + goto out; + + /* + * Configure the K1 Si workaround during phy reset assuming there is + * link so that it disables K1 if link is in 1Gbps. + */ + ret_val = e1000_k1_gig_workaround_hv(hw, TRUE); + if (ret_val) + goto out; + + /* Workaround for link disconnects on a busy hub in half duplex */ + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + ret_val = hw->phy.ops.read_reg_locked(hw, + PHY_REG(BM_PORT_CTRL_PAGE, 17), + &phy_data); + if (ret_val) + goto release; + ret_val = hw->phy.ops.write_reg_locked(hw, + PHY_REG(BM_PORT_CTRL_PAGE, 17), + phy_data & 0x00FF); +release: + hw->phy.ops.release(hw); +out: + return ret_val; +} + +/** + * e1000_copy_rx_addrs_to_phy_ich8lan - Copy Rx addresses from MAC to PHY + * @hw: pointer to the HW structure + **/ +void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw) +{ + u32 mac_reg; + u16 i; + + DEBUGFUNC("e1000_copy_rx_addrs_to_phy_ich8lan"); + + /* Copy both RAL/H (rar_entry_count) and SHRAL/H (+4) to PHY */ + for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) { + mac_reg = E1000_READ_REG(hw, E1000_RAL(i)); + hw->phy.ops.write_reg(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF)); + hw->phy.ops.write_reg(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF)); + mac_reg = E1000_READ_REG(hw, E1000_RAH(i)); + hw->phy.ops.write_reg(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF)); + hw->phy.ops.write_reg(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0x8000)); + } +} + +static u32 e1000_calc_rx_da_crc(u8 mac[]) +{ + u32 poly = 0xEDB88320; /* Polynomial for 802.3 CRC calculation */ + u32 i, j, mask, crc; + + DEBUGFUNC("e1000_calc_rx_da_crc"); + + crc = 0xffffffff; + for (i = 0; i < 6; i++) { + crc = crc ^ mac[i]; + for (j = 8; j > 0; j--) { + mask = (crc & 1) * (-1); + crc = (crc >> 1) ^ (poly & mask); + } + } + return ~crc; +} + +/** + * e1000_lv_jumbo_workaround_ich8lan - required for jumbo frame operation + * with 82579 PHY + * @hw: pointer to the HW structure + * @enable: flag to enable/disable workaround when enabling/disabling jumbos + **/ +s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) +{ + s32 ret_val = E1000_SUCCESS; + u16 phy_reg, data; + u32 mac_reg; + u16 i; + + DEBUGFUNC("e1000_lv_jumbo_workaround_ich8lan"); + + if (hw->mac.type != e1000_pch2lan) + goto out; + + /* disable Rx path while enabling/disabling workaround */ + hw->phy.ops.read_reg(hw, PHY_REG(769, 20), &phy_reg); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 20), phy_reg | (1 << 14)); + if (ret_val) + goto out; + + if (enable) { + /* + * Write Rx addresses (rar_entry_count for RAL/H, +4 for + * SHRAL/H) and initial CRC values to the MAC + */ + for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) { + u8 mac_addr[ETH_ADDR_LEN] = {0}; + u32 addr_high, addr_low; + + addr_high = E1000_READ_REG(hw, E1000_RAH(i)); + if (!(addr_high & E1000_RAH_AV)) + continue; + addr_low = E1000_READ_REG(hw, E1000_RAL(i)); + mac_addr[0] = (addr_low & 0xFF); + mac_addr[1] = ((addr_low >> 8) & 0xFF); + mac_addr[2] = ((addr_low >> 16) & 0xFF); + mac_addr[3] = ((addr_low >> 24) & 0xFF); + mac_addr[4] = (addr_high & 0xFF); + mac_addr[5] = ((addr_high >> 8) & 0xFF); + + E1000_WRITE_REG(hw, E1000_PCH_RAICC(i), + e1000_calc_rx_da_crc(mac_addr)); + } + + /* Write Rx addresses to the PHY */ + e1000_copy_rx_addrs_to_phy_ich8lan(hw); + + /* Enable jumbo frame workaround in the MAC */ + mac_reg = E1000_READ_REG(hw, E1000_FFLT_DBG); + mac_reg &= ~(1 << 14); + mac_reg |= (7 << 15); + E1000_WRITE_REG(hw, E1000_FFLT_DBG, mac_reg); + + mac_reg = E1000_READ_REG(hw, E1000_RCTL); + mac_reg |= E1000_RCTL_SECRC; + E1000_WRITE_REG(hw, E1000_RCTL, mac_reg); + + ret_val = e1000_read_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_CTRL_OFFSET, + &data); + if (ret_val) + goto out; + ret_val = e1000_write_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_CTRL_OFFSET, + data | (1 << 0)); + if (ret_val) + goto out; + ret_val = e1000_read_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_HD_CTRL, + &data); + if (ret_val) + goto out; + data &= ~(0xF << 8); + data |= (0xB << 8); + ret_val = e1000_write_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_HD_CTRL, + data); + if (ret_val) + goto out; + + /* Enable jumbo frame workaround in the PHY */ + hw->phy.ops.read_reg(hw, PHY_REG(769, 23), &data); + data &= ~(0x7F << 5); + data |= (0x37 << 5); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 23), data); + if (ret_val) + goto out; + hw->phy.ops.read_reg(hw, PHY_REG(769, 16), &data); + data &= ~(1 << 13); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 16), data); + if (ret_val) + goto out; + hw->phy.ops.read_reg(hw, PHY_REG(776, 20), &data); + data &= ~(0x3FF << 2); + data |= (0x1A << 2); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(776, 20), data); + if (ret_val) + goto out; + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(776, 23), 0xFE00); + if (ret_val) + goto out; + hw->phy.ops.read_reg(hw, HV_PM_CTRL, &data); + ret_val = hw->phy.ops.write_reg(hw, HV_PM_CTRL, data | (1 << 10)); + if (ret_val) + goto out; + } else { + /* Write MAC register values back to h/w defaults */ + mac_reg = E1000_READ_REG(hw, E1000_FFLT_DBG); + mac_reg &= ~(0xF << 14); + E1000_WRITE_REG(hw, E1000_FFLT_DBG, mac_reg); + + mac_reg = E1000_READ_REG(hw, E1000_RCTL); + mac_reg &= ~E1000_RCTL_SECRC; + E1000_WRITE_REG(hw, E1000_RCTL, mac_reg); + + ret_val = e1000_read_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_CTRL_OFFSET, + &data); + if (ret_val) + goto out; + ret_val = e1000_write_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_CTRL_OFFSET, + data & ~(1 << 0)); + if (ret_val) + goto out; + ret_val = e1000_read_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_HD_CTRL, + &data); + if (ret_val) + goto out; + data &= ~(0xF << 8); + data |= (0xB << 8); + ret_val = e1000_write_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_HD_CTRL, + data); + if (ret_val) + goto out; + + /* Write PHY register values back to h/w defaults */ + hw->phy.ops.read_reg(hw, PHY_REG(769, 23), &data); + data &= ~(0x7F << 5); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 23), data); + if (ret_val) + goto out; + hw->phy.ops.read_reg(hw, PHY_REG(769, 16), &data); + data |= (1 << 13); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 16), data); + if (ret_val) + goto out; + hw->phy.ops.read_reg(hw, PHY_REG(776, 20), &data); + data &= ~(0x3FF << 2); + data |= (0x8 << 2); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(776, 20), data); + if (ret_val) + goto out; + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(776, 23), 0x7E00); + if (ret_val) + goto out; + hw->phy.ops.read_reg(hw, HV_PM_CTRL, &data); + ret_val = hw->phy.ops.write_reg(hw, HV_PM_CTRL, data & ~(1 << 10)); + if (ret_val) + goto out; + } + + /* re-enable Rx path after enabling/disabling workaround */ + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 20), phy_reg & ~(1 << 14)); + +out: + return ret_val; +} + +/** + * e1000_lv_phy_workarounds_ich8lan - A series of Phy workarounds to be + * done after every PHY reset. + **/ +static s32 e1000_lv_phy_workarounds_ich8lan(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_lv_phy_workarounds_ich8lan"); + + if (hw->mac.type != e1000_pch2lan) + goto out; + + /* Set MDIO slow mode before any other MDIO access */ + ret_val = e1000_set_mdio_slow_mode_hv(hw); + +out: + return ret_val; +} + +/** + * e1000_k1_gig_workaround_lv - K1 Si workaround + * @hw: pointer to the HW structure + * + * Workaround to set the K1 beacon duration for 82579 parts + **/ +static s32 e1000_k1_workaround_lv(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 status_reg = 0; + u32 mac_reg; + + DEBUGFUNC("e1000_k1_workaround_lv"); + + if (hw->mac.type != e1000_pch2lan) + goto out; + + /* Set K1 beacon duration based on 1Gbps speed or otherwise */ + ret_val = hw->phy.ops.read_reg(hw, HV_M_STATUS, &status_reg); + if (ret_val) + goto out; + + if ((status_reg & (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE)) + == (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE)) { + mac_reg = E1000_READ_REG(hw, E1000_FEXTNVM4); + mac_reg &= ~E1000_FEXTNVM4_BEACON_DURATION_MASK; + + if (status_reg & HV_M_STATUS_SPEED_1000) + mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_8USEC; + else + mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_16USEC; + + E1000_WRITE_REG(hw, E1000_FEXTNVM4, mac_reg); + } + +out: + return ret_val; +} + +/** + * e1000_gate_hw_phy_config_ich8lan - disable PHY config via hardware + * @hw: pointer to the HW structure + * @gate: boolean set to TRUE to gate, FALSE to un-gate + * + * Gate/ungate the automatic PHY configuration via hardware; perform + * the configuration via software instead. + **/ +static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate) +{ + u32 extcnf_ctrl; + + DEBUGFUNC("e1000_gate_hw_phy_config_ich8lan"); + + if (hw->mac.type != e1000_pch2lan) + return; + + extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + + if (gate) + extcnf_ctrl |= E1000_EXTCNF_CTRL_GATE_PHY_CFG; + else + extcnf_ctrl &= ~E1000_EXTCNF_CTRL_GATE_PHY_CFG; + + E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); + return; +} + +/** + * e1000_hv_phy_tuning_workaround_ich8lan - This is a Phy tuning work around + * needed for Nahum3 + Hanksville testing, requested by HW team + **/ +static s32 e1000_hv_phy_tuning_workaround_ich8lan(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_hv_phy_tuning_workaround_ich8lan"); + + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 25), 0x4431); + if (ret_val) + goto out; + + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(770, 16), 0xA204); + if (ret_val) + goto out; + + ret_val = hw->phy.ops.write_reg(hw, (1 << 6) | 0x29, 0x66C0); + if (ret_val) + goto out; + + ret_val = hw->phy.ops.write_reg(hw, (1 << 6) | 0x1E, 0xFFFF); + +out: + return ret_val; +} + +/** + * e1000_lan_init_done_ich8lan - Check for PHY config completion + * @hw: pointer to the HW structure + * + * Check the appropriate indication the MAC has finished configuring the + * PHY after a software reset. + **/ +static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw) +{ + u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT; + + DEBUGFUNC("e1000_lan_init_done_ich8lan"); + + /* Wait for basic configuration completes before proceeding */ + do { + data = E1000_READ_REG(hw, E1000_STATUS); + data &= E1000_STATUS_LAN_INIT_DONE; + usec_delay(100); + } while ((!data) && --loop); + + /* + * If basic configuration is incomplete before the above loop + * count reaches 0, loading the configuration from NVM will + * leave the PHY in a bad state possibly resulting in no link. + */ + if (loop == 0) + DEBUGOUT("LAN_INIT_DONE not set, increase timeout\n"); + + /* Clear the Init Done bit for the next init event */ + data = E1000_READ_REG(hw, E1000_STATUS); + data &= ~E1000_STATUS_LAN_INIT_DONE; + E1000_WRITE_REG(hw, E1000_STATUS, data); +} + +/** + * e1000_post_phy_reset_ich8lan - Perform steps required after a PHY reset + * @hw: pointer to the HW structure + **/ +static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 reg; + + DEBUGFUNC("e1000_post_phy_reset_ich8lan"); + + if (hw->phy.ops.check_reset_block(hw)) + goto out; + + /* Allow time for h/w to get to quiescent state after reset */ + msec_delay(10); + + /* Perform any necessary post-reset workarounds */ + switch (hw->mac.type) { + case e1000_pchlan: + ret_val = e1000_hv_phy_workarounds_ich8lan(hw); + if (ret_val) + goto out; + break; + case e1000_pch2lan: + ret_val = e1000_lv_phy_workarounds_ich8lan(hw); + if (ret_val) + goto out; + break; + default: + break; + } + + if (hw->device_id == E1000_DEV_ID_ICH10_HANKSVILLE) { + ret_val = e1000_hv_phy_tuning_workaround_ich8lan(hw); + if (ret_val) + goto out; + } + + /* Dummy read to clear the phy wakeup bit after lcd reset */ + if (hw->mac.type >= e1000_pchlan) + hw->phy.ops.read_reg(hw, BM_WUC, ®); + + /* Configure the LCD with the extended configuration region in NVM */ + ret_val = e1000_sw_lcd_config_ich8lan(hw); + if (ret_val) + goto out; + + /* Configure the LCD with the OEM bits in NVM */ + ret_val = e1000_oem_bits_config_ich8lan(hw, TRUE); + + /* Ungate automatic PHY configuration on non-managed 82579 */ + if ((hw->mac.type == e1000_pch2lan) && + !(E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID)) { + msec_delay(10); + e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + } + out: return ret_val; } @@ -579,231 +1932,59 @@ out: **/ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) { - struct e1000_phy_info *phy = &hw->phy; - u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; - s32 ret_val; - u16 loop = E1000_ICH8_LAN_INIT_TIMEOUT; - u16 word_addr, reg_data, reg_addr, phy_page = 0; + s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_phy_hw_reset_ich8lan"); + /* Gate automatic PHY configuration by hardware on non-managed 82579 */ + if ((hw->mac.type == e1000_pch2lan) && + !(E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID)) + e1000_gate_hw_phy_config_ich8lan(hw, TRUE); + ret_val = e1000_phy_hw_reset_generic(hw); if (ret_val) goto out; - /* - * Initialize the PHY from the NVM on ICH platforms. This - * is needed due to an issue where the NVM configuration is - * not properly autoloaded after power transitions. - * Therefore, after each PHY reset, we will load the - * configuration data out of the NVM manually. - */ - if (hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) { - /* Check if SW needs configure the PHY */ - if ((hw->device_id == E1000_DEV_ID_ICH8_IGP_M_AMT) || - (hw->device_id == E1000_DEV_ID_ICH8_IGP_M)) - sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; - else - sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; - - data = E1000_READ_REG(hw, E1000_FEXTNVM); - if (!(data & sw_cfg_mask)) - goto out; - - /* Wait for basic configuration completes before proceeding*/ - do { - data = E1000_READ_REG(hw, E1000_STATUS); - data &= E1000_STATUS_LAN_INIT_DONE; - usec_delay(100); - } while ((!data) && --loop); - - /* - * If basic configuration is incomplete before the above loop - * count reaches 0, loading the configuration from NVM will - * leave the PHY in a bad state possibly resulting in no link. - */ - if (loop == 0) - DEBUGOUT("LAN_INIT_DONE not set, increase timeout\n"); - - /* Clear the Init Done bit for the next init event */ - data = E1000_READ_REG(hw, E1000_STATUS); - data &= ~E1000_STATUS_LAN_INIT_DONE; - E1000_WRITE_REG(hw, E1000_STATUS, data); - - /* - * Make sure HW does not configure LCD from PHY - * extended configuration before SW configuration - */ - data = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); - if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) - goto out; - - cnf_size = E1000_READ_REG(hw, E1000_EXTCNF_SIZE); - cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; - cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT; - if (!cnf_size) - goto out; - - cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; - cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; - - /* Configure LCD from extended configuration region. */ - - /* cnf_base_addr is in DWORD */ - word_addr = (u16)(cnf_base_addr << 1); - - for (i = 0; i < cnf_size; i++) { - ret_val = hw->nvm.ops.read(hw, (word_addr + i * 2), 1, - ®_data); - if (ret_val) - goto out; - - ret_val = hw->nvm.ops.read(hw, (word_addr + i * 2 + 1), - 1, ®_addr); - if (ret_val) - goto out; - - /* Save off the PHY page for future writes. */ - if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) { - phy_page = reg_data; - continue; - } - - reg_addr |= phy_page; - - ret_val = phy->ops.write_reg(hw, (u32)reg_addr, reg_data); - if (ret_val) - goto out; - } - } + ret_val = e1000_post_phy_reset_ich8lan(hw); out: return ret_val; } /** - * e1000_get_phy_info_ich8lan - Calls appropriate PHY type get_phy_info + * e1000_set_lplu_state_pchlan - Set Low Power Link Up state * @hw: pointer to the HW structure + * @active: TRUE to enable LPLU, FALSE to disable * - * Wrapper for calling the get_phy_info routines for the appropriate phy type. + * Sets the LPLU state according to the active flag. For PCH, if OEM write + * bit are disabled in the NVM, writing the LPLU bits in the MAC will not set + * the phy speed. This function will manually set the LPLU bit and restart + * auto-neg as hw would do. D3 and D0 LPLU will call the same function + * since it configures the same bit. **/ -static s32 e1000_get_phy_info_ich8lan(struct e1000_hw *hw) +static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active) { - s32 ret_val = -E1000_ERR_PHY_TYPE; + s32 ret_val = E1000_SUCCESS; + u16 oem_reg; - DEBUGFUNC("e1000_get_phy_info_ich8lan"); + DEBUGFUNC("e1000_set_lplu_state_pchlan"); - switch (hw->phy.type) { - case e1000_phy_ife: - ret_val = e1000_get_phy_info_ife_ich8lan(hw); - break; - case e1000_phy_igp_3: - case e1000_phy_bm: - ret_val = e1000_get_phy_info_igp(hw); - break; - default: - break; - } - - return ret_val; -} - -/** - * e1000_get_phy_info_ife_ich8lan - Retrieves various IFE PHY states - * @hw: pointer to the HW structure - * - * Populates "phy" structure with various feature states. - * This function is only called by other family-specific - * routines. - **/ -static s32 e1000_get_phy_info_ife_ich8lan(struct e1000_hw *hw) -{ - struct e1000_phy_info *phy = &hw->phy; - s32 ret_val; - u16 data; - bool link; - - DEBUGFUNC("e1000_get_phy_info_ife_ich8lan"); - - ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); + ret_val = hw->phy.ops.read_reg(hw, HV_OEM_BITS, &oem_reg); if (ret_val) goto out; - if (!link) { - DEBUGOUT("Phy info is only valid if link is up\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; - } + if (active) + oem_reg |= HV_OEM_BITS_LPLU; + else + oem_reg &= ~HV_OEM_BITS_LPLU; - ret_val = phy->ops.read_reg(hw, IFE_PHY_SPECIAL_CONTROL, &data); - if (ret_val) - goto out; - phy->polarity_correction = (data & IFE_PSC_AUTO_POLARITY_DISABLE) - ? FALSE : TRUE; - - if (phy->polarity_correction) { - ret_val = e1000_check_polarity_ife_ich8lan(hw); - if (ret_val) - goto out; - } else { - /* Polarity is forced */ - phy->cable_polarity = (data & IFE_PSC_FORCE_POLARITY) - ? e1000_rev_polarity_reversed - : e1000_rev_polarity_normal; - } - - ret_val = phy->ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, &data); - if (ret_val) - goto out; - - phy->is_mdix = (data & IFE_PMC_MDIX_STATUS) ? TRUE : FALSE; - - /* The following parameters are undefined for 10/100 operation. */ - phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; - phy->local_rx = e1000_1000t_rx_status_undefined; - phy->remote_rx = e1000_1000t_rx_status_undefined; + oem_reg |= HV_OEM_BITS_RESTART_AN; + ret_val = hw->phy.ops.write_reg(hw, HV_OEM_BITS, oem_reg); out: return ret_val; } -/** - * e1000_check_polarity_ife_ich8lan - Check cable polarity for IFE PHY - * @hw: pointer to the HW structure - * - * Polarity is determined on the polarity reversal feature being enabled. - * This function is only called by other family-specific - * routines. - **/ -static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw) -{ - struct e1000_phy_info *phy = &hw->phy; - s32 ret_val; - u16 phy_data, offset, mask; - - DEBUGFUNC("e1000_check_polarity_ife_ich8lan"); - - /* - * Polarity is determined based on the reversal feature being enabled. - */ - if (phy->polarity_correction) { - offset = IFE_PHY_EXTENDED_STATUS_CONTROL; - mask = IFE_PESC_POLARITY_REVERSED; - } else { - offset = IFE_PHY_SPECIAL_CONTROL; - mask = IFE_PSC_FORCE_POLARITY; - } - - ret_val = phy->ops.read_reg(hw, offset, &phy_data); - - if (!ret_val) - phy->cable_polarity = (phy_data & mask) - ? e1000_rev_polarity_reversed - : e1000_rev_polarity_normal; - - return ret_val; -} - /** * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state * @hw: pointer to the HW structure @@ -835,12 +2016,14 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); + if (phy->type != e1000_phy_igp_3) + goto out; + /* * Call gig speed drop workaround on LPLU before accessing * any PHY registers */ - if ((hw->mac.type == e1000_ich8lan) && - (hw->phy.type == e1000_phy_igp_3)) + if (hw->mac.type == e1000_ich8lan) e1000_gig_downshift_workaround_ich8lan(hw); /* When LPLU is enabled, we should disable SmartSpeed */ @@ -857,6 +2040,9 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); + if (phy->type != e1000_phy_igp_3) + goto out; + /* * LPLU and SmartSpeed are mutually exclusive. LPLU is used * during Dx states where the power conservation is most @@ -923,6 +2109,10 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) if (!active) { phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); + + if (phy->type != e1000_phy_igp_3) + goto out; + /* * LPLU and SmartSpeed are mutually exclusive. LPLU is used * during Dx states where the power conservation is most @@ -962,12 +2152,14 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); + if (phy->type != e1000_phy_igp_3) + goto out; + /* * Call gig speed drop workaround on LPLU before accessing * any PHY registers */ - if ((hw->mac.type == e1000_ich8lan) && - (hw->phy.type == e1000_phy_igp_3)) + if (hw->mac.type == e1000_ich8lan) e1000_gig_downshift_workaround_ich8lan(hw); /* When LPLU is enabled, we should disable SmartSpeed */ @@ -993,48 +2185,67 @@ out: * @bank: pointer to the variable that returns the active bank * * Reads signature byte from the NVM using the flash access registers. + * Word 0x13 bits 15:14 = 10b indicate a valid signature for that bank. **/ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) { - s32 ret_val = E1000_SUCCESS; + u32 eecd; struct e1000_nvm_info *nvm = &hw->nvm; - /* flash bank size is in words */ u32 bank1_offset = nvm->flash_bank_size * sizeof(u16); u32 act_offset = E1000_ICH_NVM_SIG_WORD * 2 + 1; - u8 bank_high_byte = 0; + u8 sig_byte = 0; + s32 ret_val = E1000_SUCCESS; - if (hw->mac.type != e1000_ich10lan) { - if (E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_SEC1VAL) - *bank = 1; - else - *bank = 0; - } else { - /* - * Make sure the signature for bank 0 is valid, - * if not check for bank1 - */ - e1000_read_flash_byte_ich8lan(hw, act_offset, &bank_high_byte); - if ((bank_high_byte & 0xC0) == 0x80) { - *bank = 0; - } else { - /* - * find if segment 1 is valid by verifying - * bit 15:14 = 10b in word 0x13 - */ - e1000_read_flash_byte_ich8lan(hw, - act_offset + bank1_offset, - &bank_high_byte); + DEBUGFUNC("e1000_valid_nvm_bank_detect_ich8lan"); - /* bank1 has a valid signature equivalent to SEC1V */ - if ((bank_high_byte & 0xC0) == 0x80) { + switch (hw->mac.type) { + case e1000_ich8lan: + case e1000_ich9lan: + eecd = E1000_READ_REG(hw, E1000_EECD); + if ((eecd & E1000_EECD_SEC1VAL_VALID_MASK) == + E1000_EECD_SEC1VAL_VALID_MASK) { + if (eecd & E1000_EECD_SEC1VAL) *bank = 1; - } else { - DEBUGOUT("ERROR: EEPROM not present\n"); - ret_val = -E1000_ERR_NVM; - } - } - } + else + *bank = 0; + goto out; + } + DEBUGOUT("Unable to determine valid NVM bank via EEC - " + "reading flash signature\n"); + /* fall-thru */ + default: + /* set bank to 0 in case flash read fails */ + *bank = 0; + + /* Check bank 0 */ + ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset, + &sig_byte); + if (ret_val) + goto out; + if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) == + E1000_ICH_NVM_SIG_VALUE) { + *bank = 0; + goto out; + } + + /* Check bank 1 */ + ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset + + bank1_offset, + &sig_byte); + if (ret_val) + goto out; + if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) == + E1000_ICH_NVM_SIG_VALUE) { + *bank = 1; + goto out; + } + + DEBUGOUT("ERROR: No valid NVM bank present\n"); + ret_val = -E1000_ERR_NVM; + break; + } +out: return ret_val; } @@ -1066,17 +2277,18 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, goto out; } - ret_val = nvm->ops.acquire(hw); - if (ret_val) - goto out; + nvm->ops.acquire(hw); ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); - if (ret_val != E1000_SUCCESS) - goto out; + if (ret_val != E1000_SUCCESS) { + DEBUGOUT("Could not detect valid bank, assuming bank 0\n"); + bank = 0; + } act_offset = (bank) ? nvm->flash_bank_size : 0; act_offset += offset; + ret_val = E1000_SUCCESS; for (i = 0; i < words; i++) { if ((dev_spec->shadow_ram) && (dev_spec->shadow_ram[offset+i].modified)) { @@ -1094,6 +2306,9 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, nvm->ops.release(hw); out: + if (ret_val) + DEBUGOUT1("NVM read error: %d\n", ret_val); + return ret_val; } @@ -1373,9 +2588,7 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, goto out; } - ret_val = nvm->ops.acquire(hw); - if (ret_val) - goto out; + nvm->ops.acquire(hw); for (i = 0; i < words; i++) { dev_spec->shadow_ram[offset+i].modified = TRUE; @@ -1416,9 +2629,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) if (nvm->type != e1000_nvm_flash_sw) goto out; - ret_val = nvm->ops.acquire(hw); - if (ret_val) - goto out; + nvm->ops.acquire(hw); /* * We're writing to the opposite bank so if we're on bank 1, @@ -1426,17 +2637,23 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) * is going to be written */ ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); - if (ret_val != E1000_SUCCESS) - goto out; + if (ret_val != E1000_SUCCESS) { + DEBUGOUT("Could not detect valid bank, assuming bank 0\n"); + bank = 0; + } if (bank == 0) { new_bank_offset = nvm->flash_bank_size; old_bank_offset = 0; - e1000_erase_flash_bank_ich8lan(hw, 1); + ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); + if (ret_val) + goto release; } else { old_bank_offset = nvm->flash_bank_size; new_bank_offset = 0; - e1000_erase_flash_bank_ich8lan(hw, 0); + ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); + if (ret_val) + goto release; } for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) { @@ -1448,9 +2665,11 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) if (dev_spec->shadow_ram[i].modified) { data = dev_spec->shadow_ram[i].value; } else { - e1000_read_flash_word_ich8lan(hw, - i + old_bank_offset, - &data); + ret_val = e1000_read_flash_word_ich8lan(hw, i + + old_bank_offset, + &data); + if (ret_val) + break; } /* @@ -1489,8 +2708,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) */ if (ret_val) { DEBUGOUT("Flash commit failed.\n"); - nvm->ops.release(hw); - goto out; + goto release; } /* @@ -1500,15 +2718,16 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) * and we need to change bit 14 to 0b */ act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; - e1000_read_flash_word_ich8lan(hw, act_offset, &data); + ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); + if (ret_val) + goto release; + data &= 0xBFFF; ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset * 2 + 1, (u8)(data >> 8)); - if (ret_val) { - nvm->ops.release(hw); - goto out; - } + if (ret_val) + goto release; /* * And invalidate the previously valid segment by setting @@ -1518,10 +2737,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) */ act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); - if (ret_val) { - nvm->ops.release(hw); - goto out; - } + if (ret_val) + goto release; /* Great! Everything worked, we can now clear the cached entries. */ for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) { @@ -1529,16 +2746,22 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) dev_spec->shadow_ram[i].value = 0xFFFF; } +release: nvm->ops.release(hw); /* * Reload the EEPROM, or else modifications will not appear * until after the next adapter reset. */ - nvm->ops.reload(hw); - msec_delay(10); + if (!ret_val) { + nvm->ops.reload(hw); + msec_delay(10); + } out: + if (ret_val) + DEBUGOUT1("NVM update error: %d\n", ret_val); + return ret_val; } @@ -1649,10 +2872,10 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, * try...ICH_FLASH_CYCLE_REPEAT_COUNT times. */ hsfsts.regval = E1000_READ_FLASH_REG16(hw, ICH_FLASH_HSFSTS); - if (hsfsts.hsf_status.flcerr == 1) { + if (hsfsts.hsf_status.flcerr == 1) /* Repeat for some time before giving up. */ continue; - } else if (hsfsts.hsf_status.flcdone == 0) { + if (hsfsts.hsf_status.flcdone == 0) { DEBUGOUT("Timeout error - flash cycle " "did not complete."); break; @@ -1763,20 +2986,15 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) break; case 1: sector_size = ICH_FLASH_SEG_SIZE_4K; - iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_4K; + iteration = 1; break; case 2: - if (hw->mac.type == e1000_ich9lan) { - sector_size = ICH_FLASH_SEG_SIZE_8K; - iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_8K; - } else { - ret_val = -E1000_ERR_NVM; - goto out; - } + sector_size = ICH_FLASH_SEG_SIZE_8K; + iteration = 1; break; case 3: sector_size = ICH_FLASH_SEG_SIZE_64K; - iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_64K; + iteration = 1; break; default: ret_val = -E1000_ERR_NVM; @@ -1785,7 +3003,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) /* Start with the base address, then add the sector offset. */ flash_linear_addr = hw->nvm.flash_base_addr; - flash_linear_addr += (bank) ? (sector_size * iteration) : 0; + flash_linear_addr += (bank) ? flash_bank_size : 0; for (j = 0; j < iteration ; j++) { do { @@ -1866,6 +3084,81 @@ out: return ret_val; } +/** + * e1000_id_led_init_pchlan - store LED configurations + * @hw: pointer to the HW structure + * + * PCH does not control LEDs via the LEDCTL register, rather it uses + * the PHY LED configuration register. + * + * PCH also does not have an "always on" or "always off" mode which + * complicates the ID feature. Instead of using the "on" mode to indicate + * in ledctl_mode2 the LEDs to use for ID (see e1000_id_led_init_generic()), + * use "link_up" mode. The LEDs will still ID on request if there is no + * link based on logic in e1000_led_[on|off]_pchlan(). + **/ +static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw) +{ + struct e1000_mac_info *mac = &hw->mac; + s32 ret_val; + const u32 ledctl_on = E1000_LEDCTL_MODE_LINK_UP; + const u32 ledctl_off = E1000_LEDCTL_MODE_LINK_UP | E1000_PHY_LED0_IVRT; + u16 data, i, temp, shift; + + DEBUGFUNC("e1000_id_led_init_pchlan"); + + /* Get default ID LED modes */ + ret_val = hw->nvm.ops.valid_led_default(hw, &data); + if (ret_val) + goto out; + + mac->ledctl_default = E1000_READ_REG(hw, E1000_LEDCTL); + mac->ledctl_mode1 = mac->ledctl_default; + mac->ledctl_mode2 = mac->ledctl_default; + + for (i = 0; i < 4; i++) { + temp = (data >> (i << 2)) & E1000_LEDCTL_LED0_MODE_MASK; + shift = (i * 5); + switch (temp) { + case ID_LED_ON1_DEF2: + case ID_LED_ON1_ON2: + case ID_LED_ON1_OFF2: + mac->ledctl_mode1 &= ~(E1000_PHY_LED0_MASK << shift); + mac->ledctl_mode1 |= (ledctl_on << shift); + break; + case ID_LED_OFF1_DEF2: + case ID_LED_OFF1_ON2: + case ID_LED_OFF1_OFF2: + mac->ledctl_mode1 &= ~(E1000_PHY_LED0_MASK << shift); + mac->ledctl_mode1 |= (ledctl_off << shift); + break; + default: + /* Do nothing */ + break; + } + switch (temp) { + case ID_LED_DEF1_ON2: + case ID_LED_ON1_ON2: + case ID_LED_OFF1_ON2: + mac->ledctl_mode2 &= ~(E1000_PHY_LED0_MASK << shift); + mac->ledctl_mode2 |= (ledctl_on << shift); + break; + case ID_LED_DEF1_OFF2: + case ID_LED_ON1_OFF2: + case ID_LED_OFF1_OFF2: + mac->ledctl_mode2 &= ~(E1000_PHY_LED0_MASK << shift); + mac->ledctl_mode2 |= (ledctl_off << shift); + break; + default: + /* Do nothing */ + break; + } + } + +out: + return ret_val; +} + /** * e1000_get_bus_info_ich8lan - Get/Set the bus type and width * @hw: pointer to the HW structure @@ -1903,6 +3196,8 @@ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw) **/ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) { + struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; + u16 reg; u32 ctrl, icr, kab; s32 ret_val; @@ -1938,31 +3233,62 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_PBS, E1000_PBS_16K); } + if (hw->mac.type == e1000_pchlan) { + /* Save the NVM K1 bit setting*/ + ret_val = e1000_read_nvm(hw, E1000_NVM_K1_CONFIG, 1, ®); + if (ret_val) + return ret_val; + + if (reg & E1000_NVM_K1_ENABLE) + dev_spec->nvm_k1_enabled = TRUE; + else + dev_spec->nvm_k1_enabled = FALSE; + } + ctrl = E1000_READ_REG(hw, E1000_CTRL); - if (!hw->phy.ops.check_reset_block(hw) && !hw->phy.reset_disable) { + if (!hw->phy.ops.check_reset_block(hw)) { /* - * PHY HW reset requires MAC CORE reset at the same + * Full-chip reset requires MAC and PHY reset at the same * time to make sure the interface between MAC and the * external PHY is reset. */ ctrl |= E1000_CTRL_PHY_RST; + + /* + * Gate automatic PHY configuration by hardware on + * non-managed 82579 + */ + if ((hw->mac.type == e1000_pch2lan) && + !(E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID)) + e1000_gate_hw_phy_config_ich8lan(hw, TRUE); } ret_val = e1000_acquire_swflag_ich8lan(hw); DEBUGOUT("Issuing a global reset to ich8lan\n"); E1000_WRITE_REG(hw, E1000_CTRL, (ctrl | E1000_CTRL_RST)); msec_delay(20); - ret_val = e1000_get_auto_rd_done_generic(hw); - if (ret_val) { - /* - * When auto config read does not complete, do not - * return with an error. This can happen in situations - * where there is no eeprom and prevents getting link. - */ - DEBUGOUT("Auto Read Done did not complete\n"); + if (!ret_val) + e1000_release_swflag_ich8lan(hw); + + if (ctrl & E1000_CTRL_PHY_RST) { + ret_val = hw->phy.ops.get_cfg_done(hw); + if (ret_val) + goto out; + + ret_val = e1000_post_phy_reset_ich8lan(hw); + if (ret_val) + goto out; } + /* + * For PCH, this write will make sure that any noise + * will be detected as a CRC error and be dropped rather than show up + * as a bad packet to the DMA engine. + */ + if (hw->mac.type == e1000_pchlan) + E1000_WRITE_REG(hw, E1000_CRC_OFFSET, 0x65656565); + E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); icr = E1000_READ_REG(hw, E1000_ICR); @@ -1970,6 +3296,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) kab |= E1000_KABGTXD_BGSQLBIAS; E1000_WRITE_REG(hw, E1000_KABGTXD, kab); +out: return ret_val; } @@ -1997,11 +3324,10 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) e1000_initialize_hw_bits_ich8lan(hw); /* Initialize identification LED */ - ret_val = e1000_id_led_init_generic(hw); - if (ret_val) { + ret_val = mac->ops.id_led_init(hw); + if (ret_val) DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ - } /* Setup the receive address. */ e1000_init_rx_addrs_generic(hw, mac->rar_entry_count); @@ -2011,6 +3337,18 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) for (i = 0; i < mac->mta_reg_count; i++) E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); + /* + * The 82578 Rx buffer will stall if wakeup is enabled in host and + * the ME. Reading the BM_WUC register will clear the host wakeup bit. + * Reset the phy after disabling host wakeup to reset the Rx buffer. + */ + if (hw->phy.type == e1000_phy_82578) { + hw->phy.ops.read_reg(hw, BM_WUC, &i); + ret_val = e1000_phy_hw_reset_ich8lan(hw); + if (ret_val) + return ret_val; + } + /* Setup link and flow control */ ret_val = mac->ops.setup_link(hw); @@ -2035,7 +3373,7 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) if (mac->type == e1000_ich8lan) snoop = PCIE_ICH8_SNOOP_ALL; else - snoop = (u32)~(PCIE_NO_SNOOP_ALL); + snoop = (u32) ~(PCIE_NO_SNOOP_ALL); e1000_set_pcie_no_snoop_generic(hw, snoop); ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -2068,6 +3406,9 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw) /* Extended Device Control */ reg = E1000_READ_REG(hw, E1000_CTRL_EXT); reg |= (1 << 22); + /* Enable PHY low-power state when MAC is at D3 w/o WoL */ + if (hw->mac.type >= e1000_pchlan) + reg |= E1000_CTRL_EXT_PHYPDEN; E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg); /* Transmit Descriptor Control 0 */ @@ -2103,6 +3444,14 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_STATUS, reg); } + /* + * work-around descriptor data corruption issue during nfs v2 udp + * traffic, just disable the nfs filtering capability + */ + reg = E1000_READ_REG(hw, E1000_RFCTL); + reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS); + E1000_WRITE_REG(hw, E1000_RFCTL, reg); + return; } @@ -2140,7 +3489,7 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw) hw->fc.current_mode = hw->fc.requested_mode; DEBUGOUT1("After fix-ups FlowControl is now = %x\n", - hw->fc.current_mode); + hw->fc.current_mode); /* Continue to configure the copper link. */ ret_val = hw->mac.ops.setup_physical_interface(hw); @@ -2148,6 +3497,17 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw) goto out; E1000_WRITE_REG(hw, E1000_FCTTV, hw->fc.pause_time); + if ((hw->phy.type == e1000_phy_82578) || + (hw->phy.type == e1000_phy_82579) || + (hw->phy.type == e1000_phy_82577)) { + E1000_WRITE_REG(hw, E1000_FCRTV_PCH, hw->fc.refresh_time); + + ret_val = hw->phy.ops.write_reg(hw, + PHY_REG(BM_PORT_CTRL_PAGE, 27), + hw->fc.pause_time); + if (ret_val) + goto out; + } ret_val = e1000_set_fc_watermarks_generic(hw); @@ -2181,31 +3541,41 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw) * and increase the max iterations when polling the phy; * this fixes erroneous timeouts at 10Mbps. */ - ret_val = e1000_write_kmrn_reg_generic(hw, GG82563_REG(0x34, 4), + ret_val = e1000_write_kmrn_reg_generic(hw, E1000_KMRNCTRLSTA_TIMEOUTS, 0xFFFF); if (ret_val) goto out; - ret_val = e1000_read_kmrn_reg_generic(hw, GG82563_REG(0x34, 9), + ret_val = e1000_read_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_INBAND_PARAM, ®_data); if (ret_val) goto out; reg_data |= 0x3F; - ret_val = e1000_write_kmrn_reg_generic(hw, GG82563_REG(0x34, 9), + ret_val = e1000_write_kmrn_reg_generic(hw, + E1000_KMRNCTRLSTA_INBAND_PARAM, reg_data); if (ret_val) goto out; - if (hw->phy.type == e1000_phy_igp_3) { + switch (hw->phy.type) { + case e1000_phy_igp_3: ret_val = e1000_copper_link_setup_igp(hw); if (ret_val) goto out; - } else if (hw->phy.type == e1000_phy_bm) { + break; + case e1000_phy_bm: + case e1000_phy_82578: ret_val = e1000_copper_link_setup_m88(hw); if (ret_val) goto out; - } - - if (hw->phy.type == e1000_phy_ife) { + break; + case e1000_phy_82577: + case e1000_phy_82579: + ret_val = e1000_copper_link_setup_82577(hw); + if (ret_val) + goto out; + break; + case e1000_phy_ife: ret_val = hw->phy.ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, ®_data); if (ret_val) @@ -2229,6 +3599,9 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw) reg_data); if (ret_val) goto out; + break; + default: + break; } ret_val = e1000_setup_copper_link_generic(hw); @@ -2476,18 +3849,26 @@ out: * 'LPLU Enabled' and 'Gig Disable' to force link speed negotiation * to a lower speed. * - * Should only be called for ICH9 and ICH10 devices. + * Should only be called for applicable parts. **/ void e1000_disable_gig_wol_ich8lan(struct e1000_hw *hw) { u32 phy_ctrl; + s32 ret_val; - if ((hw->mac.type == e1000_ich10lan) || - (hw->mac.type == e1000_ich9lan)) { - phy_ctrl = E1000_READ_REG(hw, E1000_PHY_CTRL); - phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | - E1000_PHY_CTRL_GBE_DISABLE; - E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); + DEBUGFUNC("e1000_disable_gig_wol_ich8lan"); + + phy_ctrl = E1000_READ_REG(hw, E1000_PHY_CTRL); + phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE; + E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); + + if (hw->mac.type >= e1000_pchlan) { + e1000_oem_bits_config_ich8lan(hw, FALSE); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return; + e1000_write_smbus_addr(hw); + hw->phy.ops.release(hw); } return; @@ -2501,17 +3882,14 @@ void e1000_disable_gig_wol_ich8lan(struct e1000_hw *hw) **/ static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; - DEBUGFUNC("e1000_cleanup_led_ich8lan"); if (hw->phy.type == e1000_phy_ife) - ret_val = hw->phy.ops.write_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, - 0); - else - E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_default); + return hw->phy.ops.write_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, + 0); - return ret_val; + E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_default); + return E1000_SUCCESS; } /** @@ -2522,17 +3900,14 @@ static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw) **/ static s32 e1000_led_on_ich8lan(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; - DEBUGFUNC("e1000_led_on_ich8lan"); if (hw->phy.type == e1000_phy_ife) - ret_val = hw->phy.ops.write_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, + return hw->phy.ops.write_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON)); - else - E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode2); - return ret_val; + E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode2); + return E1000_SUCCESS; } /** @@ -2543,39 +3918,157 @@ static s32 e1000_led_on_ich8lan(struct e1000_hw *hw) **/ static s32 e1000_led_off_ich8lan(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; - DEBUGFUNC("e1000_led_off_ich8lan"); if (hw->phy.type == e1000_phy_ife) - ret_val = hw->phy.ops.write_reg(hw, - IFE_PHY_SPECIAL_CONTROL_LED, + return hw->phy.ops.write_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF)); - else - E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode1); - return ret_val; + E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode1); + return E1000_SUCCESS; } /** - * e1000_get_cfg_done_ich8lan - Read config done bit + * e1000_setup_led_pchlan - Configures SW controllable LED * @hw: pointer to the HW structure * - * Read the management control register for the config done bit for - * completion status. NOTE: silicon which is EEPROM-less will fail trying - * to read the config done bit, so an error is *ONLY* logged and returns - * E1000_SUCCESS. If we were to return with error, EEPROM-less silicon - * would not be able to be reset or change link. + * This prepares the SW controllable LED for use. + **/ +static s32 e1000_setup_led_pchlan(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_setup_led_pchlan"); + + return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, + (u16)hw->mac.ledctl_mode1); +} + +/** + * e1000_cleanup_led_pchlan - Restore the default LED operation + * @hw: pointer to the HW structure + * + * Return the LED back to the default configuration. + **/ +static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_cleanup_led_pchlan"); + + return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, + (u16)hw->mac.ledctl_default); +} + +/** + * e1000_led_on_pchlan - Turn LEDs on + * @hw: pointer to the HW structure + * + * Turn on the LEDs. + **/ +static s32 e1000_led_on_pchlan(struct e1000_hw *hw) +{ + u16 data = (u16)hw->mac.ledctl_mode2; + u32 i, led; + + DEBUGFUNC("e1000_led_on_pchlan"); + + /* + * If no link, then turn LED on by setting the invert bit + * for each LED that's mode is "link_up" in ledctl_mode2. + */ + if (!(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) { + for (i = 0; i < 3; i++) { + led = (data >> (i * 5)) & E1000_PHY_LED0_MASK; + if ((led & E1000_PHY_LED0_MODE_MASK) != + E1000_LEDCTL_MODE_LINK_UP) + continue; + if (led & E1000_PHY_LED0_IVRT) + data &= ~(E1000_PHY_LED0_IVRT << (i * 5)); + else + data |= (E1000_PHY_LED0_IVRT << (i * 5)); + } + } + + return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, data); +} + +/** + * e1000_led_off_pchlan - Turn LEDs off + * @hw: pointer to the HW structure + * + * Turn off the LEDs. + **/ +static s32 e1000_led_off_pchlan(struct e1000_hw *hw) +{ + u16 data = (u16)hw->mac.ledctl_mode1; + u32 i, led; + + DEBUGFUNC("e1000_led_off_pchlan"); + + /* + * If no link, then turn LED off by clearing the invert bit + * for each LED that's mode is "link_up" in ledctl_mode1. + */ + if (!(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) { + for (i = 0; i < 3; i++) { + led = (data >> (i * 5)) & E1000_PHY_LED0_MASK; + if ((led & E1000_PHY_LED0_MODE_MASK) != + E1000_LEDCTL_MODE_LINK_UP) + continue; + if (led & E1000_PHY_LED0_IVRT) + data &= ~(E1000_PHY_LED0_IVRT << (i * 5)); + else + data |= (E1000_PHY_LED0_IVRT << (i * 5)); + } + } + + return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, data); +} + +/** + * e1000_get_cfg_done_ich8lan - Read config done bit after Full or PHY reset + * @hw: pointer to the HW structure + * + * Read appropriate register for the config done bit for completion status + * and configure the PHY through s/w for EEPROM-less parts. + * + * NOTE: some silicon which is EEPROM-less will fail trying to read the + * config done bit, so only an error is logged and continues. If we were + * to return with error, EEPROM-less silicon would not be able to be reset + * or change link. **/ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) { s32 ret_val = E1000_SUCCESS; u32 bank = 0; + u32 status; + + DEBUGFUNC("e1000_get_cfg_done_ich8lan"); e1000_get_cfg_done_generic(hw); + /* Wait for indication from h/w that it has completed basic config */ + if (hw->mac.type >= e1000_ich10lan) { + e1000_lan_init_done_ich8lan(hw); + } else { + ret_val = e1000_get_auto_rd_done_generic(hw); + if (ret_val) { + /* + * When auto config read does not complete, do not + * return with an error. This can happen in situations + * where there is no eeprom and prevents getting link. + */ + DEBUGOUT("Auto Read Done did not complete\n"); + ret_val = E1000_SUCCESS; + } + } + + /* Clear PHY Reset Asserted bit */ + status = E1000_READ_REG(hw, E1000_STATUS); + if (status & E1000_STATUS_PHYRA) + E1000_WRITE_REG(hw, E1000_STATUS, status & ~E1000_STATUS_PHYRA); + else + DEBUGOUT("PHY Reset Asserted not set - needs delay\n"); + /* If EEPROM is not marked present, init the IGP 3 PHY manually */ - if (hw->mac.type != e1000_ich10lan) { + if (hw->mac.type <= e1000_ich9lan) { if (((E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) == 0) && (hw->phy.type == e1000_phy_igp_3)) { e1000_phy_init_script_igp3(hw); @@ -2617,6 +4110,8 @@ static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw) **/ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) { + u16 phy_data; + DEBUGFUNC("e1000_clear_hw_cntrs_ich8lan"); e1000_clear_hw_cntrs_base_generic(hw); @@ -2634,5 +4129,25 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_IAC); E1000_READ_REG(hw, E1000_ICRXOC); + + /* Clear PHY statistics registers */ + if ((hw->phy.type == e1000_phy_82578) || + (hw->phy.type == e1000_phy_82579) || + (hw->phy.type == e1000_phy_82577)) { + hw->phy.ops.read_reg(hw, HV_SCC_UPPER, &phy_data); + hw->phy.ops.read_reg(hw, HV_SCC_LOWER, &phy_data); + hw->phy.ops.read_reg(hw, HV_ECOL_UPPER, &phy_data); + hw->phy.ops.read_reg(hw, HV_ECOL_LOWER, &phy_data); + hw->phy.ops.read_reg(hw, HV_MCC_UPPER, &phy_data); + hw->phy.ops.read_reg(hw, HV_MCC_LOWER, &phy_data); + hw->phy.ops.read_reg(hw, HV_LATECOL_UPPER, &phy_data); + hw->phy.ops.read_reg(hw, HV_LATECOL_LOWER, &phy_data); + hw->phy.ops.read_reg(hw, HV_COLC_UPPER, &phy_data); + hw->phy.ops.read_reg(hw, HV_COLC_LOWER, &phy_data); + hw->phy.ops.read_reg(hw, HV_DC_UPPER, &phy_data); + hw->phy.ops.read_reg(hw, HV_DC_LOWER, &phy_data); + hw->phy.ops.read_reg(hw, HV_TNCRS_UPPER, &phy_data); + hw->phy.ops.read_reg(hw, HV_TNCRS_LOWER, &phy_data); + } } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.h index 18ae843514..19cf302a1f 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_ich8lan.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_ich8lan.h,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_ICH8LAN_H_ #define _E1000_ICH8LAN_H_ @@ -41,9 +41,10 @@ #define ICH_FLASH_FADDR 0x0008 #define ICH_FLASH_FDATA0 0x0010 -#define ICH_FLASH_READ_COMMAND_TIMEOUT 500 -#define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500 -#define ICH_FLASH_ERASE_COMMAND_TIMEOUT 3000000 +/* Requires up to 10 seconds when MNG might be accessing part. */ +#define ICH_FLASH_READ_COMMAND_TIMEOUT 10000000 +#define ICH_FLASH_WRITE_COMMAND_TIMEOUT 10000000 +#define ICH_FLASH_ERASE_COMMAND_TIMEOUT 10000000 #define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF #define ICH_FLASH_CYCLE_REPEAT_COUNT 10 @@ -69,22 +70,46 @@ #define E1000_ICH_MNG_IAMT_MODE 0x2 +#define E1000_FWSM_PROXY_MODE 0x00000008 /* FW is in proxy mode */ + +/* Shared Receive Address Registers */ +#define E1000_SHRAL(_i) (0x05438 + ((_i) * 8)) +#define E1000_SHRAH(_i) (0x0543C + ((_i) * 8)) +#define E1000_SHRAH_AV 0x80000000 /* Addr Valid bit */ +#define E1000_SHRAH_MAV 0x40000000 /* Multicast Addr Valid bit */ + +#define E1000_H2ME 0x05B50 /* Host to ME */ +#define E1000_H2ME_LSECREQ 0x00000001 /* Linksec Request */ +#define E1000_H2ME_LSECA 0x00000002 /* Linksec Active */ +#define E1000_H2ME_LSECSF 0x00000004 /* Linksec Failed */ +#define E1000_H2ME_LSECD 0x00000008 /* Linksec Disabled */ +#define E1000_H2ME_SLCAPD 0x00000010 /* Start LCAPD */ +#define E1000_H2ME_IPV4_ARP_EN 0x00000020 /* Arp Offload enable bit */ +#define E1000_H2ME_IPV6_NS_EN 0x00000040 /* NS Offload enable bit */ + #define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \ - (ID_LED_DEF1_OFF2 << 8) | \ - (ID_LED_DEF1_ON2 << 4) | \ + (ID_LED_OFF1_OFF2 << 8) | \ + (ID_LED_OFF1_ON2 << 4) | \ (ID_LED_DEF1_DEF2)) #define E1000_ICH_NVM_SIG_WORD 0x13 #define E1000_ICH_NVM_SIG_MASK 0xC000 +#define E1000_ICH_NVM_VALID_SIG_MASK 0xC0 +#define E1000_ICH_NVM_SIG_VALUE 0x80 #define E1000_ICH8_LAN_INIT_TIMEOUT 1500 #define E1000_FEXTNVM_SW_CONFIG 1 #define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M */ +#define E1000_FEXTNVM4_BEACON_DURATION_MASK 0x7 +#define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7 +#define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3 + #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL #define E1000_ICH_RAR_ENTRIES 7 +#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */ #define PHY_PAGE_SHIFT 5 #define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \ @@ -99,6 +124,89 @@ #define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200 #define IGP3_PM_CTRL_FORCE_PWR_DOWN 0x0020 +/* PHY Wakeup Registers and defines */ +#define BM_RCTL PHY_REG(BM_WUC_PAGE, 0) +#define BM_WUC PHY_REG(BM_WUC_PAGE, 1) +#define BM_WUFC PHY_REG(BM_WUC_PAGE, 2) +#define BM_WUS PHY_REG(BM_WUC_PAGE, 3) +#define BM_RAR_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 16 + ((_i) << 2))) +#define BM_RAR_M(_i) (BM_PHY_REG(BM_WUC_PAGE, 17 + ((_i) << 2))) +#define BM_RAR_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 18 + ((_i) << 2))) +#define BM_RAR_CTRL(_i) (BM_PHY_REG(BM_WUC_PAGE, 19 + ((_i) << 2))) +#define BM_MTA(_i) (BM_PHY_REG(BM_WUC_PAGE, 128 + ((_i) << 1))) +#define BM_IPAV (BM_PHY_REG(BM_WUC_PAGE, 64)) +#define BM_IP4AT_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 82 + ((_i) * 2))) +#define BM_IP4AT_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 83 + ((_i) * 2))) + +#define BM_SHRAL_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 44 + ((_i) * 4))) +#define BM_SHRAL_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 45 + ((_i) * 4))) +#define BM_SHRAH_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 46 + ((_i) * 4))) +#define BM_SHRAH_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 47 + ((_i) * 4))) + +#define BM_RCTL_UPE 0x0001 /* Unicast Promiscuous Mode */ +#define BM_RCTL_MPE 0x0002 /* Multicast Promiscuous Mode */ +#define BM_RCTL_MO_SHIFT 3 /* Multicast Offset Shift */ +#define BM_RCTL_MO_MASK (3 << 3) /* Multicast Offset Mask */ +#define BM_RCTL_BAM 0x0020 /* Broadcast Accept Mode */ +#define BM_RCTL_PMCF 0x0040 /* Pass MAC Control Frames */ +#define BM_RCTL_RFCE 0x0080 /* Rx Flow Control Enable */ + +#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ +#define HV_MUX_DATA_CTRL PHY_REG(776, 16) +#define HV_MUX_DATA_CTRL_GEN_TO_MAC 0x0400 +#define HV_MUX_DATA_CTRL_FORCE_SPEED 0x0004 +#define HV_SCC_UPPER PHY_REG(778, 16) /* Single Collision Count */ +#define HV_SCC_LOWER PHY_REG(778, 17) +#define HV_ECOL_UPPER PHY_REG(778, 18) /* Excessive Collision Count */ +#define HV_ECOL_LOWER PHY_REG(778, 19) +#define HV_MCC_UPPER PHY_REG(778, 20) /* Multiple Collision Count */ +#define HV_MCC_LOWER PHY_REG(778, 21) +#define HV_LATECOL_UPPER PHY_REG(778, 23) /* Late Collision Count */ +#define HV_LATECOL_LOWER PHY_REG(778, 24) +#define HV_COLC_UPPER PHY_REG(778, 25) /* Collision Count */ +#define HV_COLC_LOWER PHY_REG(778, 26) +#define HV_DC_UPPER PHY_REG(778, 27) /* Defer Count */ +#define HV_DC_LOWER PHY_REG(778, 28) +#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ +#define HV_TNCRS_LOWER PHY_REG(778, 30) + +#define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */ + +#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */ +#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */ + +/* SMBus Address Phy Register */ +#define HV_SMB_ADDR PHY_REG(768, 26) +#define HV_SMB_ADDR_MASK 0x007F +#define HV_SMB_ADDR_PEC_EN 0x0200 +#define HV_SMB_ADDR_VALID 0x0080 + +/* Strapping Option Register - RO */ +#define E1000_STRAP 0x0000C +#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 +#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17 + +/* OEM Bits Phy Register */ +#define HV_OEM_BITS PHY_REG(768, 25) +#define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */ +#define HV_OEM_BITS_GBE_DIS 0x0040 /* Gigabit Disable */ +#define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */ + +#define LCD_CFG_PHY_ADDR_BIT 0x0020 /* Phy address bit from LCD Config word */ + +/* KMRN Mode Control */ +#define HV_KMRN_MODE_CTRL PHY_REG(769, 16) +#define HV_KMRN_MDIO_SLOW 0x0400 + +/* PHY Power Management Control */ +#define HV_PM_CTRL PHY_REG(770, 17) + +#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */ + +/* PHY Low Power Idle Control */ +#define I82579_LPI_CTRL PHY_REG(772, 20) +#define I82579_LPI_CTRL_ENABLE_MASK 0x6000 + /* * Additional interrupts need to be handled for ICH family: * DSW = The FW changed the status of the DISSW bit in FWSM @@ -122,11 +230,17 @@ #define E1000_RXDEXT_LINKSEC_ERROR_REPLAY_ERROR 0x40000000 #define E1000_RXDEXT_LINKSEC_ERROR_BAD_SIG 0x60000000 +/* Receive Address Initial CRC Calculation */ +#define E1000_PCH_RAICC(_n) (0x05F50 + ((_n) * 4)) void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, bool state); void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); void e1000_disable_gig_wol_ich8lan(struct e1000_hw *hw); - +s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); +s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_config); +s32 e1000_hv_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); +void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw); +s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable); #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.c index 9e483a8ed2..6e030daea1 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,11 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_mac.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_mac.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #include "e1000_api.h" static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw); +static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); /** * e1000_init_mac_ops_generic - Initialize MAC function pointers @@ -77,7 +78,6 @@ void e1000_init_mac_ops_generic(struct e1000_hw *hw) mac->ops.update_mc_addr_list = e1000_null_update_mc; mac->ops.clear_vfta = e1000_null_mac_generic; mac->ops.write_vfta = e1000_null_write_vfta; - mac->ops.mta_set = e1000_null_mta_set; mac->ops.rar_set = e1000_rar_set_generic; mac->ops.validate_mdi_setting = e1000_validate_mdi_setting_generic; } @@ -126,7 +126,7 @@ bool e1000_null_mng_mode(struct e1000_hw *hw) * e1000_null_update_mc - No-op function, return void * @hw: pointer to the HW structure **/ -void e1000_null_update_mc(struct e1000_hw *hw, u8 *h, u32 a, u32 b, u32 c) +void e1000_null_update_mc(struct e1000_hw *hw, u8 *h, u32 a) { DEBUGFUNC("e1000_null_update_mc"); return; @@ -142,16 +142,6 @@ void e1000_null_write_vfta(struct e1000_hw *hw, u32 a, u32 b) return; } -/** - * e1000_null_set_mta - No-op function, return void - * @hw: pointer to the HW structure - **/ -void e1000_null_mta_set(struct e1000_hw *hw, u32 a) -{ - DEBUGFUNC("e1000_null_mta_set"); - return; -} - /** * e1000_null_rar_set - No-op function, return void * @hw: pointer to the HW structure @@ -229,24 +219,36 @@ s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; struct e1000_bus_info *bus = &hw->bus; - s32 ret_val; u16 pcie_link_status; DEBUGFUNC("e1000_get_bus_info_pcie_generic"); bus->type = e1000_bus_type_pci_express; - bus->speed = e1000_bus_speed_2500; ret_val = e1000_read_pcie_cap_reg(hw, PCIE_LINK_STATUS, &pcie_link_status); - if (ret_val) + if (ret_val) { bus->width = e1000_bus_width_unknown; - else + bus->speed = e1000_bus_speed_unknown; + } else { + switch (pcie_link_status & PCIE_LINK_SPEED_MASK) { + case PCIE_LINK_SPEED_2500: + bus->speed = e1000_bus_speed_2500; + break; + case PCIE_LINK_SPEED_5000: + bus->speed = e1000_bus_speed_5000; + break; + default: + bus->speed = e1000_bus_speed_unknown; + break; + } + bus->width = (enum e1000_bus_width)((pcie_link_status & PCIE_LINK_WIDTH_MASK) >> PCIE_LINK_WIDTH_SHIFT); + } mac->ops.set_lan_id(hw); @@ -261,18 +263,17 @@ s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw) * Determines the LAN function id by reading memory-mapped registers * and swaps the port value if requested. **/ -void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw) +static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw) { struct e1000_bus_info *bus = &hw->bus; u32 reg; + /* + * The status register reports the correct function number + * for the device regardless of function swap state. + */ reg = E1000_READ_REG(hw, E1000_STATUS); bus->func = (reg & E1000_STATUS_FUNC_MASK) >> E1000_STATUS_FUNC_SHIFT; - - /* check for a port swap */ - reg = E1000_READ_REG(hw, E1000_FACTPS); - if (reg & E1000_FACTPS_LFS) - bus->func ^= 0x1; } /** @@ -358,6 +359,7 @@ void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value) void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count) { u32 i; + u8 mac_addr[ETH_ADDR_LEN] = {0}; DEBUGFUNC("e1000_init_rx_addrs_generic"); @@ -368,12 +370,8 @@ void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count) /* Zero out the other (rar_entry_count - 1) receive addresses */ DEBUGOUT1("Clearing RAR[1-%u]\n", rar_count-1); - for (i = 1; i < rar_count; i++) { - E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1), 0); - E1000_WRITE_FLUSH(hw); - E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((i << 1) + 1), 0); - E1000_WRITE_FLUSH(hw); - } + for (i = 1; i < rar_count; i++) + hw->mac.ops.rar_set(hw, mac_addr, i); } /** @@ -382,10 +380,11 @@ void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count) * * Checks the nvm for an alternate MAC address. An alternate MAC address * can be setup by pre-boot software and must be treated like a permanent - * address and must override the actual permanent MAC address. If an - * alternate MAC address is found it is saved in the hw struct and - * programmed into RAR0 and the function returns success, otherwise the - * function returns an error. + * address and must override the actual permanent MAC address. If an + * alternate MAC address is found it is programmed into RAR0, replacing + * the permanent address that was installed into RAR0 by the Si on reset. + * This function will return SUCCESS unless it encounters an error while + * reading the EEPROM. **/ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) { @@ -396,6 +395,16 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) DEBUGFUNC("e1000_check_alt_mac_addr_generic"); + ret_val = hw->nvm.ops.read(hw, NVM_COMPAT, 1, &nvm_data); + if (ret_val) + goto out; + + /* Check for LOM (vs. NIC) or one of two valid mezzanine cards */ + if (!((nvm_data & NVM_COMPAT_LOM) || + (hw->device_id == E1000_DEV_ID_82571EB_SERDES_DUAL) || + (hw->device_id == E1000_DEV_ID_82571EB_SERDES_QUAD))) + goto out; + ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1, &nvm_alt_mac_addr_offset); if (ret_val) { @@ -404,13 +413,17 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) } if (nvm_alt_mac_addr_offset == 0xFFFF) { - ret_val = -(E1000_NOT_IMPLEMENTED); + /* There is no Alternate MAC Address */ goto out; } if (hw->bus.func == E1000_FUNC_1) - nvm_alt_mac_addr_offset += ETH_ADDR_LEN/sizeof(u16); + nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN1; + if (hw->bus.func == E1000_FUNC_2) + nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN2; + if (hw->bus.func == E1000_FUNC_3) + nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN3; for (i = 0; i < ETH_ADDR_LEN; i += 2) { offset = nvm_alt_mac_addr_offset + (i >> 1); ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); @@ -425,14 +438,16 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) /* if multicast bit is set, the alternate address will not be used */ if (alt_mac_addr[0] & 0x01) { - ret_val = -(E1000_NOT_IMPLEMENTED); + DEBUGOUT("Ignoring Alternate Mac Address with MC bit set\n"); goto out; } - for (i = 0; i < ETH_ADDR_LEN; i++) - hw->mac.addr[i] = hw->mac.perm_addr[i] = alt_mac_addr[i]; - - hw->mac.ops.rar_set(hw, hw->mac.perm_addr, 0); + /* + * We have a valid alternate MAC address, and we want to treat it the + * same as the normal permanent MAC address stored by the HW into the + * RAR. Do this by mapping this address into RAR0. + */ + hw->mac.ops.rar_set(hw, alt_mac_addr, 0); out: return ret_val; @@ -467,43 +482,14 @@ void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) if (rar_low || rar_high) rar_high |= E1000_RAH_AV; - E1000_WRITE_REG(hw, E1000_RAL(index), rar_low); - E1000_WRITE_REG(hw, E1000_RAH(index), rar_high); -} - -/** - * e1000_mta_set_generic - Set multicast filter table address - * @hw: pointer to the HW structure - * @hash_value: determines the MTA register and bit to set - * - * The multicast table address is a register array of 32-bit registers. - * The hash_value is used to determine what register the bit is in, the - * current value is read, the new bit is OR'd in and the new value is - * written back into the register. - **/ -void e1000_mta_set_generic(struct e1000_hw *hw, u32 hash_value) -{ - u32 hash_bit, hash_reg, mta; - - DEBUGFUNC("e1000_mta_set_generic"); /* - * The MTA is a register array of 32-bit registers. It is - * treated like an array of (32*mta_reg_count) bits. We want to - * set bit BitArray[hash_value]. So we figure out what register - * the bit is in, read it, OR in the new bit, then write - * back the new value. The (hw->mac.mta_reg_count - 1) serves as a - * mask to bits 31:5 of the hash value which gives us the - * register we're modifying. The hash bit within that register - * is determined by the lower 5 bits of the hash value. + * Some bridges will combine consecutive 32-bit writes into + * a single burst write, which will malfunction on some parts. + * The flushes avoid this. */ - hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); - hash_bit = hash_value & 0x1F; - - mta = E1000_READ_REG_ARRAY(hw, E1000_MTA, hash_reg); - - mta |= (1 << hash_bit); - - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, hash_reg, mta); + E1000_WRITE_REG(hw, E1000_RAL(index), rar_low); + E1000_WRITE_FLUSH(hw); + E1000_WRITE_REG(hw, E1000_RAH(index), rar_high); E1000_WRITE_FLUSH(hw); } @@ -512,55 +498,36 @@ void e1000_mta_set_generic(struct e1000_hw *hw, u32 hash_value) * @hw: pointer to the HW structure * @mc_addr_list: array of multicast addresses to program * @mc_addr_count: number of multicast addresses to program - * @rar_used_count: the first RAR register free to program - * @rar_count: total number of supported Receive Address Registers * - * Updates the Receive Address Registers and Multicast Table Array. + * Updates entire Multicast Table Array. * The caller must have a packed mc_addr_list of multicast addresses. - * The parameter rar_count will usually be hw->mac.rar_entry_count - * unless there are workarounds that change this. **/ void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count, - u32 rar_used_count, u32 rar_count) + u8 *mc_addr_list, u32 mc_addr_count) { - u32 hash_value; - u32 i; + u32 hash_value, hash_bit, hash_reg; + int i; DEBUGFUNC("e1000_update_mc_addr_list_generic"); - /* - * Load the first set of multicast addresses into the exact - * filters (RAR). If there are not enough to fill the RAR - * array, clear the filters. - */ - for (i = rar_used_count; i < rar_count; i++) { - if (mc_addr_count) { - hw->mac.ops.rar_set(hw, mc_addr_list, i); - mc_addr_count--; - mc_addr_list += ETH_ADDR_LEN; - } else { - E1000_WRITE_REG_ARRAY(hw, E1000_RA, i << 1, 0); - E1000_WRITE_FLUSH(hw); - E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1) + 1, 0); - E1000_WRITE_FLUSH(hw); - } - } + /* clear mta_shadow */ + memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); - /* Clear the old settings from the MTA */ - DEBUGOUT("Clearing MTA\n"); - for (i = 0; i < hw->mac.mta_reg_count; i++) { - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); - E1000_WRITE_FLUSH(hw); - } - - /* Load any remaining multicast addresses into the hash table. */ - for (; mc_addr_count > 0; mc_addr_count--) { + /* update mta_shadow from mc_addr_list */ + for (i = 0; (u32) i < mc_addr_count; i++) { hash_value = e1000_hash_mc_addr_generic(hw, mc_addr_list); - DEBUGOUT1("Hash value = 0x%03X\n", hash_value); - hw->mac.ops.mta_set(hw, hash_value); - mc_addr_list += ETH_ADDR_LEN; + + hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); + hash_bit = hash_value & 0x1F; + + hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit); + mc_addr_list += (ETH_ADDR_LEN); } + + /* replace the entire MTA table */ + for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) + E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, hw->mac.mta_shadow[i]); + E1000_WRITE_FLUSH(hw); } /** @@ -569,8 +536,7 @@ void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, * @mc_addr: pointer to a multicast address * * Generates a multicast address hash value which is used to determine - * the multicast filter table array address and new table value. See - * e1000_mta_set_generic() + * the multicast filter table array address and new table value. **/ u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr) { @@ -783,7 +749,7 @@ s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw) * of MAC speed/duplex configuration. So we only need to * configure Collision Distance in the MAC. */ - e1000_config_collision_dist_generic(hw); + mac->ops.config_collision_dist(hw); /* * Configure Flow Control now that Auto-Neg has completed. @@ -1001,9 +967,8 @@ s32 e1000_setup_link_generic(struct e1000_hw *hw) * In the case of the phy reset being blocked, we already have a link. * We do not need to set it up again. */ - if (hw->phy.ops.check_reset_block) - if (hw->phy.ops.check_reset_block(hw)) - goto out; + if (e1000_check_reset_block(hw)) + goto out; /* * If requested flow control is set to default, set flow control @@ -1022,7 +987,7 @@ s32 e1000_setup_link_generic(struct e1000_hw *hw) hw->fc.current_mode = hw->fc.requested_mode; DEBUGOUT1("After fix-ups FlowControl is now = %x\n", - hw->fc.current_mode); + hw->fc.current_mode); /* Call the necessary media_type subroutine to configure the link. */ ret_val = hw->mac.ops.setup_physical_interface(hw); @@ -1057,6 +1022,7 @@ out: **/ s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw) { + struct e1000_mac_info *mac = &hw->mac; u32 ctrl; s32 ret_val = E1000_SUCCESS; @@ -1067,7 +1033,7 @@ s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw) /* Take the link out of reset */ ctrl &= ~E1000_CTRL_LRST; - e1000_config_collision_dist_generic(hw); + mac->ops.config_collision_dist(hw); ret_val = e1000_commit_fc_settings_generic(hw); if (ret_val) @@ -1107,8 +1073,7 @@ out: * @hw: pointer to the HW structure * * Configures the collision distance to the default value and is used - * during link setup. Currently no func pointer exists and all - * implementations are handled in the generic version of this function. + * during link setup. **/ void e1000_config_collision_dist_generic(struct e1000_hw *hw) { @@ -1162,7 +1127,7 @@ s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw) * link up if we detect a signal. This will allow us to * communicate with non-autonegotiating link partners. */ - ret_val = hw->mac.ops.check_for_link(hw); + ret_val = mac->ops.check_for_link(hw); if (ret_val) { DEBUGOUT("Error while checking for link\n"); goto out; @@ -1219,7 +1184,7 @@ s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw) * Rx Flow control is enabled and Tx Flow control is disabled * by a software over-ride. Since there really isn't a way to * advertise that we are capable of Rx Pause ONLY, we will - * advertise that we support both symmetric and asymmetric RX + * advertise that we support both symmetric and asymmetric Rx * PAUSE. Later, we will disable the adapter's ability to send * PAUSE frames. */ @@ -1263,7 +1228,6 @@ out: **/ s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; u32 fcrtl = 0, fcrth = 0; DEBUGFUNC("e1000_set_fc_watermarks_generic"); @@ -1290,7 +1254,7 @@ s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_FCRTL, fcrtl); E1000_WRITE_REG(hw, E1000_FCRTH, fcrth); - return ret_val; + return E1000_SUCCESS; } /** @@ -1519,7 +1483,7 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) /* * Now we need to check if the user selected Rx ONLY * of pause frames. In this case, we had to advertise - * FULL flow control because we could not advertise RX + * FULL flow control because we could not advertise Rx * ONLY. Hence, we must now check to see if we need to * turn OFF the TRANSMISSION of PAUSE frames. */ @@ -1529,7 +1493,7 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) } else { hw->fc.current_mode = e1000_fc_rx_pause; DEBUGOUT("Flow Control = " - "RX PAUSE frames only.\r\n"); + "Rx PAUSE frames only.\r\n"); } } /* @@ -1545,7 +1509,7 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { hw->fc.current_mode = e1000_fc_tx_pause; - DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n"); + DEBUGOUT("Flow Control = Tx PAUSE frames only.\r\n"); } /* * For transmitting PAUSE frames ONLY. @@ -1560,7 +1524,7 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { hw->fc.current_mode = e1000_fc_rx_pause; - DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); + DEBUGOUT("Flow Control = Rx PAUSE frames only.\r\n"); } else { /* * Per the IEEE spec, at this point flow control @@ -1902,19 +1866,10 @@ out: **/ s32 e1000_cleanup_led_generic(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; - DEBUGFUNC("e1000_cleanup_led_generic"); - if (hw->mac.ops.cleanup_led != e1000_cleanup_led_generic) { - ret_val = -E1000_ERR_CONFIG; - goto out; - } - E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_default); - -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -2040,7 +1995,7 @@ out: * e1000_disable_pcie_master_generic - Disables PCI-express master access * @hw: pointer to the HW structure * - * Returns 0 (E1000_SUCCESS) if successful, else returns -10 + * Returns E1000_SUCCESS if successful, else returns -10 * (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused * the master requests to be disabled. * @@ -2073,7 +2028,6 @@ s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw) if (!timeout) { DEBUGOUT("Master requests are pending.\n"); ret_val = -E1000_ERR_MASTER_REQUESTS_PENDING; - goto out; } out: @@ -2158,7 +2112,7 @@ out: * Verify that when not using auto-negotiation that MDI/MDIx is correctly * set, which is forced to MDI mode only. **/ -s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw) +static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw) { s32 ret_val = E1000_SUCCESS; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.h index b07fd6728f..8f2652d10a 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_mac.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_mac.h,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_MAC_H_ #define _E1000_MAC_H_ @@ -44,9 +44,8 @@ void e1000_null_mac_generic(struct e1000_hw *hw); s32 e1000_null_ops_generic(struct e1000_hw *hw); s32 e1000_null_link_info(struct e1000_hw *hw, u16 *s, u16 *d); bool e1000_null_mng_mode(struct e1000_hw *hw); -void e1000_null_update_mc(struct e1000_hw *hw, u8 *h, u32 a, u32 b, u32 c); +void e1000_null_update_mc(struct e1000_hw *hw, u8 *h, u32 a); void e1000_null_write_vfta(struct e1000_hw *hw, u32 a, u32 b); -void e1000_null_mta_set(struct e1000_hw *hw, u32 a); void e1000_null_rar_set(struct e1000_hw *hw, u8 *h, u32 a); s32 e1000_blink_led_generic(struct e1000_hw *hw); s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw); @@ -63,7 +62,6 @@ s32 e1000_get_bus_info_pci_generic(struct e1000_hw *hw); s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw); void e1000_set_lan_id_single_port(struct e1000_hw *hw); void e1000_set_lan_id_multi_port_pci(struct e1000_hw *hw); -void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw); s32 e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed, u16 *duplex); @@ -73,8 +71,7 @@ s32 e1000_id_led_init_generic(struct e1000_hw *hw); s32 e1000_led_on_generic(struct e1000_hw *hw); s32 e1000_led_off_generic(struct e1000_hw *hw); void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count, - u32 rar_used_count, u32 rar_count); + u8 *mc_addr_list, u32 mc_addr_count); s32 e1000_set_default_fc_generic(struct e1000_hw *hw); s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw); s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw); @@ -89,7 +86,6 @@ void e1000_clear_hw_cntrs_base_generic(struct e1000_hw *hw); void e1000_clear_vfta_generic(struct e1000_hw *hw); void e1000_config_collision_dist_generic(struct e1000_hw *hw); void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count); -void e1000_mta_set_generic(struct e1000_hw *hw, u32 hash_value); void e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw); void e1000_put_hw_semaphore_generic(struct e1000_hw *hw); void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.c index b4db177d8a..52af1ef03c 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_manage.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_manage.c,v 1.2.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ #include "e1000_api.h" @@ -74,10 +74,16 @@ s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw) { u32 hicr; s32 ret_val = E1000_SUCCESS; - u8 i; + u8 i; DEBUGFUNC("e1000_mng_enable_host_if_generic"); + if (!(hw->mac.arc_subsystem_valid)) { + DEBUGOUT("ARC subsystem not valid.\n"); + ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND; + goto out; + } + /* Check that the host interface is enabled. */ hicr = E1000_READ_REG(hw, E1000_HICR); if ((hicr & E1000_HICR_EN) == 0) { @@ -112,18 +118,17 @@ out: **/ bool e1000_check_mng_mode_generic(struct e1000_hw *hw) { - u32 fwsm; + u32 fwsm = E1000_READ_REG(hw, E1000_FWSM); DEBUGFUNC("e1000_check_mng_mode_generic"); - fwsm = E1000_READ_REG(hw, E1000_FWSM); return (fwsm & E1000_FWSM_MODE_MASK) == (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT); } /** - * e1000_enable_tx_pkt_filtering_generic - Enable packet filtering on TX + * e1000_enable_tx_pkt_filtering_generic - Enable packet filtering on Tx * @hw: pointer to the HW structure * * Enables packet filtering on transmit packets if manageability is enabled @@ -136,13 +141,14 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) u32 offset; s32 ret_val, hdr_csum, csum; u8 i, len; - bool tx_filter = TRUE; DEBUGFUNC("e1000_enable_tx_pkt_filtering_generic"); + hw->mac.tx_pkt_filtering = TRUE; + /* No manageability, no filtering */ if (!hw->mac.ops.check_mng_mode(hw)) { - tx_filter = FALSE; + hw->mac.tx_pkt_filtering = FALSE; goto out; } @@ -152,18 +158,16 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) */ ret_val = hw->mac.ops.mng_enable_host_if(hw); if (ret_val != E1000_SUCCESS) { - tx_filter = FALSE; + hw->mac.tx_pkt_filtering = FALSE; goto out; } /* Read in the header. Length and offset are in dwords. */ len = E1000_MNG_DHCP_COOKIE_LENGTH >> 2; offset = E1000_MNG_DHCP_COOKIE_OFFSET >> 2; - for (i = 0; i < len; i++) { - *(buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw, - E1000_HOST_IF, + for (i = 0; i < len; i++) + *(buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i); - } hdr_csum = hdr->checksum; hdr->checksum = 0; csum = e1000_calculate_checksum((u8 *)hdr, @@ -173,18 +177,19 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) * the cookie area isn't considered valid, in which case we * take the safe route of assuming Tx filtering is enabled. */ - if (hdr_csum != csum) - goto out; - if (hdr->signature != E1000_IAMT_SIGNATURE) + if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { + hw->mac.tx_pkt_filtering = TRUE; goto out; + } /* Cookie area is valid, make the final check for filtering. */ - if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) - tx_filter = FALSE; + if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) { + hw->mac.tx_pkt_filtering = FALSE; + goto out; + } out: - hw->mac.tx_pkt_filtering = tx_filter; - return tx_filter; + return hw->mac.tx_pkt_filtering; } /** @@ -344,10 +349,11 @@ out: } /** - * e1000_enable_mng_pass_thru - Enable processing of ARP's + * e1000_enable_mng_pass_thru - Check if management passthrough is needed * @hw: pointer to the HW structure * - * Verifies the hardware needs to allow ARPs to be processed by the host. + * Verifies the hardware needs to leave interface enabled so that frames can + * be directed to and from the management interface. **/ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw) { @@ -362,11 +368,10 @@ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw) manc = E1000_READ_REG(hw, E1000_MANC); - if (!(manc & E1000_MANC_RCV_TCO_EN) || - !(manc & E1000_MANC_EN_MAC_ADDR_FILTER)) + if (!(manc & E1000_MANC_RCV_TCO_EN)) goto out; - if (hw->mac.arc_subsystem_valid) { + if (hw->mac.has_fwsm) { fwsm = E1000_READ_REG(hw, E1000_FWSM); factps = E1000_READ_REG(hw, E1000_FACTPS); @@ -376,12 +381,23 @@ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw) ret_val = TRUE; goto out; } - } else { - if ((manc & E1000_MANC_SMBUS_EN) && - !(manc & E1000_MANC_ASF_EN)) { + } else if ((hw->mac.type == e1000_82574) || + (hw->mac.type == e1000_82583)) { + u16 data; + + factps = E1000_READ_REG(hw, E1000_FACTPS); + e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); + + if (!(factps & E1000_FACTPS_MNGCG) && + ((data & E1000_NVM_INIT_CTRL2_MNGM) == + (e1000_mng_mode_pt << 13))) { ret_val = TRUE; goto out; } + } else if ((manc & E1000_MANC_SMBUS_EN) && + !(manc & E1000_MANC_ASF_EN)) { + ret_val = TRUE; + goto out; } out: diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.h index be6545cca1..51ddd5160e 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_manage.h,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_manage.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_MANAGE_H_ #define _E1000_MANAGE_H_ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.c new file mode 100644 index 0000000000..b9818087a1 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.c @@ -0,0 +1,762 @@ +/****************************************************************************** + + Copyright (c) 2001-2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD: src/sys/dev/e1000/e1000_mbx.c,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ + +#include "e1000_mbx.h" + +/** + * e1000_null_mbx_check_for_flag - No-op function, return 0 + * @hw: pointer to the HW structure + **/ +static s32 e1000_null_mbx_check_for_flag(struct e1000_hw *hw, u16 mbx_id) +{ + DEBUGFUNC("e1000_null_mbx_check_flag"); + + return E1000_SUCCESS; +} + +/** + * e1000_null_mbx_transact - No-op function, return 0 + * @hw: pointer to the HW structure + **/ +static s32 e1000_null_mbx_transact(struct e1000_hw *hw, u32 *msg, u16 size, + u16 mbx_id) +{ + DEBUGFUNC("e1000_null_mbx_rw_msg"); + + return E1000_SUCCESS; +} + +/** + * e1000_read_mbx - Reads a message from the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to read + * + * returns SUCCESS if it successfuly read message from buffer + **/ +s32 e1000_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_read_mbx"); + + /* limit read to size of mailbox */ + if (size > mbx->size) + size = mbx->size; + + if (mbx->ops.read) + ret_val = mbx->ops.read(hw, msg, size, mbx_id); + + return ret_val; +} + +/** + * e1000_write_mbx - Write a message to the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully copied message into the buffer + **/ +s32 e1000_write_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_write_mbx"); + + if (size > mbx->size) + ret_val = -E1000_ERR_MBX; + + else if (mbx->ops.write) + ret_val = mbx->ops.write(hw, msg, size, mbx_id); + + return ret_val; +} + +/** + * e1000_check_for_msg - checks to see if someone sent us mail + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the Status bit was found or else ERR_MBX + **/ +s32 e1000_check_for_msg(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_msg"); + + if (mbx->ops.check_for_msg) + ret_val = mbx->ops.check_for_msg(hw, mbx_id); + + return ret_val; +} + +/** + * e1000_check_for_ack - checks to see if someone sent us ACK + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the Status bit was found or else ERR_MBX + **/ +s32 e1000_check_for_ack(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_ack"); + + if (mbx->ops.check_for_ack) + ret_val = mbx->ops.check_for_ack(hw, mbx_id); + + return ret_val; +} + +/** + * e1000_check_for_rst - checks to see if other side has reset + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the Status bit was found or else ERR_MBX + **/ +s32 e1000_check_for_rst(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_rst"); + + if (mbx->ops.check_for_rst) + ret_val = mbx->ops.check_for_rst(hw, mbx_id); + + return ret_val; +} + +/** + * e1000_poll_for_msg - Wait for message notification + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully received a message notification + **/ +static s32 e1000_poll_for_msg(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + int countdown = mbx->timeout; + + DEBUGFUNC("e1000_poll_for_msg"); + + if (!countdown || !mbx->ops.check_for_msg) + goto out; + + while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) { + countdown--; + if (!countdown) + break; + usec_delay(mbx->usec_delay); + } + + /* if we failed, all future posted messages fail until reset */ + if (!countdown) + mbx->timeout = 0; +out: + return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; +} + +/** + * e1000_poll_for_ack - Wait for message acknowledgement + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully received a message acknowledgement + **/ +static s32 e1000_poll_for_ack(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + int countdown = mbx->timeout; + + DEBUGFUNC("e1000_poll_for_ack"); + + if (!countdown || !mbx->ops.check_for_ack) + goto out; + + while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) { + countdown--; + if (!countdown) + break; + usec_delay(mbx->usec_delay); + } + + /* if we failed, all future posted messages fail until reset */ + if (!countdown) + mbx->timeout = 0; +out: + return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; +} + +/** + * e1000_read_posted_mbx - Wait for message notification and receive message + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully received a message notification and + * copied it into the receive buffer. + **/ +s32 e1000_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_read_posted_mbx"); + + if (!mbx->ops.read) + goto out; + + ret_val = e1000_poll_for_msg(hw, mbx_id); + + /* if ack received read message, otherwise we timed out */ + if (!ret_val) + ret_val = mbx->ops.read(hw, msg, size, mbx_id); +out: + return ret_val; +} + +/** + * e1000_write_posted_mbx - Write a message to the mailbox, wait for ack + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully copied message into the buffer and + * received an ack to that message within delay * timeout period + **/ +s32 e1000_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_write_posted_mbx"); + + /* exit if either we can't write or there isn't a defined timeout */ + if (!mbx->ops.write || !mbx->timeout) + goto out; + + /* send msg */ + ret_val = mbx->ops.write(hw, msg, size, mbx_id); + + /* if msg sent wait until we receive an ack */ + if (!ret_val) + ret_val = e1000_poll_for_ack(hw, mbx_id); +out: + return ret_val; +} + +/** + * e1000_init_mbx_ops_generic - Initialize mbx function pointers + * @hw: pointer to the HW structure + * + * Sets the function pointers to no-op functions + **/ +void e1000_init_mbx_ops_generic(struct e1000_hw *hw) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + mbx->ops.init_params = e1000_null_ops_generic; + mbx->ops.read = e1000_null_mbx_transact; + mbx->ops.write = e1000_null_mbx_transact; + mbx->ops.check_for_msg = e1000_null_mbx_check_for_flag; + mbx->ops.check_for_ack = e1000_null_mbx_check_for_flag; + mbx->ops.check_for_rst = e1000_null_mbx_check_for_flag; + mbx->ops.read_posted = e1000_read_posted_mbx; + mbx->ops.write_posted = e1000_write_posted_mbx; +} + +/** + * e1000_read_v2p_mailbox - read v2p mailbox + * @hw: pointer to the HW structure + * + * This function is used to read the v2p mailbox without losing the read to + * clear status bits. + **/ +static u32 e1000_read_v2p_mailbox(struct e1000_hw *hw) +{ + u32 v2p_mailbox = E1000_READ_REG(hw, E1000_V2PMAILBOX(0)); + + v2p_mailbox |= hw->dev_spec.vf.v2p_mailbox; + hw->dev_spec.vf.v2p_mailbox |= v2p_mailbox & E1000_V2PMAILBOX_R2C_BITS; + + return v2p_mailbox; +} + +/** + * e1000_check_for_bit_vf - Determine if a status bit was set + * @hw: pointer to the HW structure + * @mask: bitmask for bits to be tested and cleared + * + * This function is used to check for the read to clear bits within + * the V2P mailbox. + **/ +static s32 e1000_check_for_bit_vf(struct e1000_hw *hw, u32 mask) +{ + u32 v2p_mailbox = e1000_read_v2p_mailbox(hw); + s32 ret_val = -E1000_ERR_MBX; + + if (v2p_mailbox & mask) + ret_val = E1000_SUCCESS; + + hw->dev_spec.vf.v2p_mailbox &= ~mask; + + return ret_val; +} + +/** + * e1000_check_for_msg_vf - checks to see if the PF has sent mail + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the PF has set the Status bit or else ERR_MBX + **/ +static s32 e1000_check_for_msg_vf(struct e1000_hw *hw, u16 mbx_id) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_msg_vf"); + + if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFSTS)) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.reqs++; + } + + return ret_val; +} + +/** + * e1000_check_for_ack_vf - checks to see if the PF has ACK'd + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the PF has set the ACK bit or else ERR_MBX + **/ +static s32 e1000_check_for_ack_vf(struct e1000_hw *hw, u16 mbx_id) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_ack_vf"); + + if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFACK)) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.acks++; + } + + return ret_val; +} + +/** + * e1000_check_for_rst_vf - checks to see if the PF has reset + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns TRUE if the PF has set the reset done bit or else FALSE + **/ +static s32 e1000_check_for_rst_vf(struct e1000_hw *hw, u16 mbx_id) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_rst_vf"); + + if (!e1000_check_for_bit_vf(hw, (E1000_V2PMAILBOX_RSTD | + E1000_V2PMAILBOX_RSTI))) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.rsts++; + } + + return ret_val; +} + +/** + * e1000_obtain_mbx_lock_vf - obtain mailbox lock + * @hw: pointer to the HW structure + * + * return SUCCESS if we obtained the mailbox lock + **/ +static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_obtain_mbx_lock_vf"); + + /* Take ownership of the buffer */ + E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_VFU); + + /* reserve mailbox for vf use */ + if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU) + ret_val = E1000_SUCCESS; + + return ret_val; +} + +/** + * e1000_write_mbx_vf - Write a message to the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully copied message into the buffer + **/ +static s32 e1000_write_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size, + u16 mbx_id) +{ + s32 ret_val; + u16 i; + + + DEBUGFUNC("e1000_write_mbx_vf"); + + /* lock the mailbox to prevent pf/vf race condition */ + ret_val = e1000_obtain_mbx_lock_vf(hw); + if (ret_val) + goto out_no_write; + + /* flush msg and acks as we are overwriting the message buffer */ + e1000_check_for_msg_vf(hw, 0); + e1000_check_for_ack_vf(hw, 0); + + /* copy the caller specified message to the mailbox memory buffer */ + for (i = 0; i < size; i++) + E1000_WRITE_REG_ARRAY(hw, E1000_VMBMEM(0), i, msg[i]); + + /* update stats */ + hw->mbx.stats.msgs_tx++; + + /* Drop VFU and interrupt the PF to tell it a message has been sent */ + E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_REQ); + +out_no_write: + return ret_val; +} + +/** + * e1000_read_mbx_vf - Reads a message from the inbox intended for vf + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to read + * + * returns SUCCESS if it successfuly read message from buffer + **/ +static s32 e1000_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size, + u16 mbx_id) +{ + s32 ret_val = E1000_SUCCESS; + u16 i; + + DEBUGFUNC("e1000_read_mbx_vf"); + + /* lock the mailbox to prevent pf/vf race condition */ + ret_val = e1000_obtain_mbx_lock_vf(hw); + if (ret_val) + goto out_no_read; + + /* copy the message from the mailbox memory buffer */ + for (i = 0; i < size; i++) + msg[i] = E1000_READ_REG_ARRAY(hw, E1000_VMBMEM(0), i); + + /* Acknowledge receipt and release mailbox, then we're done */ + E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_ACK); + + /* update stats */ + hw->mbx.stats.msgs_rx++; + +out_no_read: + return ret_val; +} + +/** + * e1000_init_mbx_params_vf - set initial values for vf mailbox + * @hw: pointer to the HW structure + * + * Initializes the hw->mbx struct to correct values for vf mailbox + */ +s32 e1000_init_mbx_params_vf(struct e1000_hw *hw) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + + /* start mailbox as timed out and let the reset_hw call set the timeout + * value to begin communications */ + mbx->timeout = 0; + mbx->usec_delay = E1000_VF_MBX_INIT_DELAY; + + mbx->size = E1000_VFMAILBOX_SIZE; + + mbx->ops.read = e1000_read_mbx_vf; + mbx->ops.write = e1000_write_mbx_vf; + mbx->ops.read_posted = e1000_read_posted_mbx; + mbx->ops.write_posted = e1000_write_posted_mbx; + mbx->ops.check_for_msg = e1000_check_for_msg_vf; + mbx->ops.check_for_ack = e1000_check_for_ack_vf; + mbx->ops.check_for_rst = e1000_check_for_rst_vf; + + mbx->stats.msgs_tx = 0; + mbx->stats.msgs_rx = 0; + mbx->stats.reqs = 0; + mbx->stats.acks = 0; + mbx->stats.rsts = 0; + + return E1000_SUCCESS; +} + +static s32 e1000_check_for_bit_pf(struct e1000_hw *hw, u32 mask) +{ + u32 mbvficr = E1000_READ_REG(hw, E1000_MBVFICR); + s32 ret_val = -E1000_ERR_MBX; + + if (mbvficr & mask) { + ret_val = E1000_SUCCESS; + E1000_WRITE_REG(hw, E1000_MBVFICR, mask); + } + + return ret_val; +} + +/** + * e1000_check_for_msg_pf - checks to see if the VF has sent mail + * @hw: pointer to the HW structure + * @vf_number: the VF index + * + * returns SUCCESS if the VF has set the Status bit or else ERR_MBX + **/ +static s32 e1000_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_msg_pf"); + + if (!e1000_check_for_bit_pf(hw, E1000_MBVFICR_VFREQ_VF1 << vf_number)) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.reqs++; + } + + return ret_val; +} + +/** + * e1000_check_for_ack_pf - checks to see if the VF has ACKed + * @hw: pointer to the HW structure + * @vf_number: the VF index + * + * returns SUCCESS if the VF has set the Status bit or else ERR_MBX + **/ +static s32 e1000_check_for_ack_pf(struct e1000_hw *hw, u16 vf_number) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_ack_pf"); + + if (!e1000_check_for_bit_pf(hw, E1000_MBVFICR_VFACK_VF1 << vf_number)) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.acks++; + } + + return ret_val; +} + +/** + * e1000_check_for_rst_pf - checks to see if the VF has reset + * @hw: pointer to the HW structure + * @vf_number: the VF index + * + * returns SUCCESS if the VF has set the Status bit or else ERR_MBX + **/ +static s32 e1000_check_for_rst_pf(struct e1000_hw *hw, u16 vf_number) +{ + u32 vflre = E1000_READ_REG(hw, E1000_VFLRE); + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_rst_pf"); + + if (vflre & (1 << vf_number)) { + ret_val = E1000_SUCCESS; + E1000_WRITE_REG(hw, E1000_VFLRE, (1 << vf_number)); + hw->mbx.stats.rsts++; + } + + return ret_val; +} + +/** + * e1000_obtain_mbx_lock_pf - obtain mailbox lock + * @hw: pointer to the HW structure + * @vf_number: the VF index + * + * return SUCCESS if we obtained the mailbox lock + **/ +static s32 e1000_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number) +{ + s32 ret_val = -E1000_ERR_MBX; + u32 p2v_mailbox; + + DEBUGFUNC("e1000_obtain_mbx_lock_pf"); + + /* Take ownership of the buffer */ + E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU); + + /* reserve mailbox for vf use */ + p2v_mailbox = E1000_READ_REG(hw, E1000_P2VMAILBOX(vf_number)); + if (p2v_mailbox & E1000_P2VMAILBOX_PFU) + ret_val = E1000_SUCCESS; + + return ret_val; +} + +/** + * e1000_write_mbx_pf - Places a message in the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @vf_number: the VF index + * + * returns SUCCESS if it successfully copied message into the buffer + **/ +static s32 e1000_write_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, + u16 vf_number) +{ + s32 ret_val; + u16 i; + + DEBUGFUNC("e1000_write_mbx_pf"); + + /* lock the mailbox to prevent pf/vf race condition */ + ret_val = e1000_obtain_mbx_lock_pf(hw, vf_number); + if (ret_val) + goto out_no_write; + + /* flush msg and acks as we are overwriting the message buffer */ + e1000_check_for_msg_pf(hw, vf_number); + e1000_check_for_ack_pf(hw, vf_number); + + /* copy the caller specified message to the mailbox memory buffer */ + for (i = 0; i < size; i++) + E1000_WRITE_REG_ARRAY(hw, E1000_VMBMEM(vf_number), i, msg[i]); + + /* Interrupt VF to tell it a message has been sent and release buffer*/ + E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_STS); + + /* update stats */ + hw->mbx.stats.msgs_tx++; + +out_no_write: + return ret_val; + +} + +/** + * e1000_read_mbx_pf - Read a message from the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @vf_number: the VF index + * + * This function copies a message from the mailbox buffer to the caller's + * memory buffer. The presumption is that the caller knows that there was + * a message due to a VF request so no polling for message is needed. + **/ +static s32 e1000_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, + u16 vf_number) +{ + s32 ret_val; + u16 i; + + DEBUGFUNC("e1000_read_mbx_pf"); + + /* lock the mailbox to prevent pf/vf race condition */ + ret_val = e1000_obtain_mbx_lock_pf(hw, vf_number); + if (ret_val) + goto out_no_read; + + /* copy the message to the mailbox memory buffer */ + for (i = 0; i < size; i++) + msg[i] = E1000_READ_REG_ARRAY(hw, E1000_VMBMEM(vf_number), i); + + /* Acknowledge the message and release buffer */ + E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK); + + /* update stats */ + hw->mbx.stats.msgs_rx++; + +out_no_read: + return ret_val; +} + +/** + * e1000_init_mbx_params_pf - set initial values for pf mailbox + * @hw: pointer to the HW structure + * + * Initializes the hw->mbx struct to correct values for pf mailbox + */ +s32 e1000_init_mbx_params_pf(struct e1000_hw *hw) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + + if (hw->mac.type == e1000_82576) { + mbx->timeout = 0; + mbx->usec_delay = 0; + + mbx->size = E1000_VFMAILBOX_SIZE; + + mbx->ops.read = e1000_read_mbx_pf; + mbx->ops.write = e1000_write_mbx_pf; + mbx->ops.read_posted = e1000_read_posted_mbx; + mbx->ops.write_posted = e1000_write_posted_mbx; + mbx->ops.check_for_msg = e1000_check_for_msg_pf; + mbx->ops.check_for_ack = e1000_check_for_ack_pf; + mbx->ops.check_for_rst = e1000_check_for_rst_pf; + + mbx->stats.msgs_tx = 0; + mbx->stats.msgs_rx = 0; + mbx->stats.reqs = 0; + mbx->stats.acks = 0; + mbx->stats.rsts = 0; + } + + return E1000_SUCCESS; +} + diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.h new file mode 100644 index 0000000000..7a451d6c97 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.h @@ -0,0 +1,106 @@ +/****************************************************************************** + + Copyright (c) 2001-2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD: src/sys/dev/e1000/e1000_mbx.h,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ + +#ifndef _E1000_MBX_H_ +#define _E1000_MBX_H_ + +#include "e1000_api.h" + +/* Define mailbox register bits */ +#define E1000_V2PMAILBOX_REQ 0x00000001 /* Request for PF Ready bit */ +#define E1000_V2PMAILBOX_ACK 0x00000002 /* Ack PF message received */ +#define E1000_V2PMAILBOX_VFU 0x00000004 /* VF owns the mailbox buffer */ +#define E1000_V2PMAILBOX_PFU 0x00000008 /* PF owns the mailbox buffer */ +#define E1000_V2PMAILBOX_PFSTS 0x00000010 /* PF wrote a message in the MB */ +#define E1000_V2PMAILBOX_PFACK 0x00000020 /* PF ack the previous VF msg */ +#define E1000_V2PMAILBOX_RSTI 0x00000040 /* PF has reset indication */ +#define E1000_V2PMAILBOX_RSTD 0x00000080 /* PF has indicated reset done */ +#define E1000_V2PMAILBOX_R2C_BITS 0x000000B0 /* All read to clear bits */ + +#define E1000_P2VMAILBOX_STS 0x00000001 /* Initiate message send to VF */ +#define E1000_P2VMAILBOX_ACK 0x00000002 /* Ack message recv'd from VF */ +#define E1000_P2VMAILBOX_VFU 0x00000004 /* VF owns the mailbox buffer */ +#define E1000_P2VMAILBOX_PFU 0x00000008 /* PF owns the mailbox buffer */ +#define E1000_P2VMAILBOX_RVFU 0x00000010 /* Reset VFU - used when VF stuck */ + +#define E1000_MBVFICR_VFREQ_MASK 0x000000FF /* bits for VF messages */ +#define E1000_MBVFICR_VFREQ_VF1 0x00000001 /* bit for VF 1 message */ +#define E1000_MBVFICR_VFACK_MASK 0x00FF0000 /* bits for VF acks */ +#define E1000_MBVFICR_VFACK_VF1 0x00010000 /* bit for VF 1 ack */ + +#define E1000_VFMAILBOX_SIZE 16 /* 16 32 bit words - 64 bytes */ + +/* If it's a E1000_VF_* msg then it originates in the VF and is sent to the + * PF. The reverse is TRUE if it is E1000_PF_*. + * Message ACK's are the value or'd with 0xF0000000 + */ +#define E1000_VT_MSGTYPE_ACK 0x80000000 /* Messages below or'd with + * this are the ACK */ +#define E1000_VT_MSGTYPE_NACK 0x40000000 /* Messages below or'd with + * this are the NACK */ +#define E1000_VT_MSGTYPE_CTS 0x20000000 /* Indicates that VF is still + clear to send requests */ +#define E1000_VT_MSGINFO_SHIFT 16 +/* bits 23:16 are used for exra info for certain messages */ +#define E1000_VT_MSGINFO_MASK (0xFF << E1000_VT_MSGINFO_SHIFT) + +#define E1000_VF_RESET 0x01 /* VF requests reset */ +#define E1000_VF_SET_MAC_ADDR 0x02 /* VF requests to set MAC addr */ +#define E1000_VF_SET_MULTICAST 0x03 /* VF requests to set MC addr */ +#define E1000_VF_SET_MULTICAST_COUNT_MASK (0x1F << E1000_VT_MSGINFO_SHIFT) +#define E1000_VF_SET_MULTICAST_OVERFLOW (0x80 << E1000_VT_MSGINFO_SHIFT) +#define E1000_VF_SET_VLAN 0x04 /* VF requests to set VLAN */ +#define E1000_VF_SET_VLAN_ADD (0x01 << E1000_VT_MSGINFO_SHIFT) +#define E1000_VF_SET_LPE 0x05 /* VF requests to set VMOLR.LPE */ +#define E1000_VF_SET_PROMISC 0x06 /*VF requests to clear VMOLR.ROPE/MPME*/ +#define E1000_VF_SET_PROMISC_UNICAST (0x01 << E1000_VT_MSGINFO_SHIFT) +#define E1000_VF_SET_PROMISC_MULTICAST (0x02 << E1000_VT_MSGINFO_SHIFT) + +#define E1000_PF_CONTROL_MSG 0x0100 /* PF control message */ + +#define E1000_VF_MBX_INIT_TIMEOUT 2000 /* number of retries on mailbox */ +#define E1000_VF_MBX_INIT_DELAY 500 /* microseconds between retries */ + +s32 e1000_read_mbx(struct e1000_hw *, u32 *, u16, u16); +s32 e1000_write_mbx(struct e1000_hw *, u32 *, u16, u16); +s32 e1000_read_posted_mbx(struct e1000_hw *, u32 *, u16, u16); +s32 e1000_write_posted_mbx(struct e1000_hw *, u32 *, u16, u16); +s32 e1000_check_for_msg(struct e1000_hw *, u16); +s32 e1000_check_for_ack(struct e1000_hw *, u16); +s32 e1000_check_for_rst(struct e1000_hw *, u16); +void e1000_init_mbx_ops_generic(struct e1000_hw *hw); +s32 e1000_init_mbx_params_vf(struct e1000_hw *); +s32 e1000_init_mbx_params_pf(struct e1000_hw *); + +#endif /* _E1000_MBX_H_ */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.c index d82edd8551..da4ef6236e 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,10 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_nvm.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_nvm.c,v 1.3.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #include "e1000_api.h" +static void e1000_reload_nvm_generic(struct e1000_hw *hw); + /** * e1000_init_nvm_ops_generic - Initialize NVM function pointers * @hw: pointer to the HW structure @@ -772,6 +774,184 @@ out: return ret_val; } +/** + * e1000_read_pba_string_generic - Read device part number + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * @pba_num_size: size of part number buffer + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + **/ +s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, + u32 pba_num_size) +{ + s32 ret_val; + u16 nvm_data; + u16 pba_ptr; + u16 offset; + u16 length; + + DEBUGFUNC("e1000_read_pba_string_generic"); + + if (pba_num == NULL) { + DEBUGOUT("PBA string buffer was null\n"); + ret_val = E1000_ERR_INVALID_ARGUMENT; + goto out; + } + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &pba_ptr); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + /* + * if nvm_data is not ptr guard the PBA must be in legacy format which + * means pba_ptr is actually our second data word for the PBA number + * and we can decode it into an ascii string + */ + if (nvm_data != NVM_PBA_PTR_GUARD) { + DEBUGOUT("NVM PBA number is not stored as string\n"); + + /* we will need 11 characters to store the PBA */ + if (pba_num_size < 11) { + DEBUGOUT("PBA string buffer too small\n"); + return E1000_ERR_NO_SPACE; + } + + /* extract hex string from data and pba_ptr */ + pba_num[0] = (nvm_data >> 12) & 0xF; + pba_num[1] = (nvm_data >> 8) & 0xF; + pba_num[2] = (nvm_data >> 4) & 0xF; + pba_num[3] = nvm_data & 0xF; + pba_num[4] = (pba_ptr >> 12) & 0xF; + pba_num[5] = (pba_ptr >> 8) & 0xF; + pba_num[6] = '-'; + pba_num[7] = 0; + pba_num[8] = (pba_ptr >> 4) & 0xF; + pba_num[9] = pba_ptr & 0xF; + + /* put a null character on the end of our string */ + pba_num[10] = '\0'; + + /* switch all the data but the '-' to hex char */ + for (offset = 0; offset < 10; offset++) { + if (pba_num[offset] < 0xA) + pba_num[offset] += '0'; + else if (pba_num[offset] < 0x10) + pba_num[offset] += 'A' - 0xA; + } + + goto out; + } + + ret_val = hw->nvm.ops.read(hw, pba_ptr, 1, &length); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + if (length == 0xFFFF || length == 0) { + DEBUGOUT("NVM PBA number section invalid length\n"); + ret_val = E1000_ERR_NVM_PBA_SECTION; + goto out; + } + /* check if pba_num buffer is big enough */ + if (pba_num_size < (((u32)length * 2) - 1)) { + DEBUGOUT("PBA string buffer too small\n"); + ret_val = E1000_ERR_NO_SPACE; + goto out; + } + + /* trim pba length from start of string */ + pba_ptr++; + length--; + + for (offset = 0; offset < length; offset++) { + ret_val = hw->nvm.ops.read(hw, pba_ptr + offset, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + pba_num[offset * 2] = (u8)(nvm_data >> 8); + pba_num[(offset * 2) + 1] = (u8)(nvm_data & 0xFF); + } + pba_num[offset * 2] = '\0'; + +out: + return ret_val; +} + +/** + * e1000_read_pba_length_generic - Read device part number length + * @hw: pointer to the HW structure + * @pba_num_size: size of part number buffer + * + * Reads the product board assembly (PBA) number length from the EEPROM and + * stores the value in pba_num_size. + **/ +s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size) +{ + s32 ret_val; + u16 nvm_data; + u16 pba_ptr; + u16 length; + + DEBUGFUNC("e1000_read_pba_length_generic"); + + if (pba_num_size == NULL) { + DEBUGOUT("PBA buffer size was null\n"); + ret_val = E1000_ERR_INVALID_ARGUMENT; + goto out; + } + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &pba_ptr); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + /* if data is not ptr guard the PBA must be in legacy format */ + if (nvm_data != NVM_PBA_PTR_GUARD) { + *pba_num_size = 11; + goto out; + } + + ret_val = hw->nvm.ops.read(hw, pba_ptr, 1, &length); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + if (length == 0xFFFF || length == 0) { + DEBUGOUT("NVM PBA number section invalid length\n"); + ret_val = E1000_ERR_NVM_PBA_SECTION; + goto out; + } + + /* + * Convert from length in u16 values to u8 chars, add 1 for NULL, + * and subtract 2 because length field is included in length. + */ + *pba_num_size = ((u32)length * 2) - 1; + +out: + return ret_val; +} + /** * e1000_read_pba_num_generic - Read device part number * @hw: pointer to the HW structure @@ -791,6 +971,10 @@ s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num) if (ret_val) { DEBUGOUT("NVM Read Error\n"); goto out; + } else if (nvm_data == NVM_PBA_PTR_GUARD) { + DEBUGOUT("NVM Not Supported\n"); + ret_val = E1000_NOT_IMPLEMENTED; + goto out; } *pba_num = (u32)(nvm_data << 16); @@ -815,31 +999,23 @@ out: **/ s32 e1000_read_mac_addr_generic(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; - u16 offset, nvm_data, i; + u32 rar_high; + u32 rar_low; + u16 i; - DEBUGFUNC("e1000_read_mac_addr"); + rar_high = E1000_READ_REG(hw, E1000_RAH(0)); + rar_low = E1000_READ_REG(hw, E1000_RAL(0)); - for (i = 0; i < ETH_ADDR_LEN; i += 2) { - offset = i >> 1; - ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); - if (ret_val) { - DEBUGOUT("NVM Read Error\n"); - goto out; - } - hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); - hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); - } + for (i = 0; i < E1000_RAL_MAC_ADDR_LEN; i++) + hw->mac.perm_addr[i] = (u8)(rar_low >> (i*8)); - /* Flip last bit of mac address if we're on second port */ - if (hw->bus.func == E1000_FUNC_1) - hw->mac.perm_addr[5] ^= 1; + for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++) + hw->mac.perm_addr[i+4] = (u8)(rar_high >> (i*8)); for (i = 0; i < ETH_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -886,7 +1062,7 @@ out: **/ s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw) { - s32 ret_val; + s32 ret_val; u16 checksum = 0; u16 i, nvm_data; @@ -916,7 +1092,7 @@ out: * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the * extended control register. **/ -void e1000_reload_nvm_generic(struct e1000_hw *hw) +static void e1000_reload_nvm_generic(struct e1000_hw *hw) { u32 ctrl_ext; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.h index 605ee090e4..39774743d0 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_nvm.h,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_nvm.h,v 1.2.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_NVM_H_ #define _E1000_NVM_H_ @@ -45,6 +45,9 @@ s32 e1000_acquire_nvm_generic(struct e1000_hw *hw); s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg); s32 e1000_read_mac_addr_generic(struct e1000_hw *hw); s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num); +s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, + u32 pba_num_size); +s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size); s32 e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); s32 e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); @@ -61,7 +64,6 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw); void e1000_stop_nvm(struct e1000_hw *hw); void e1000_release_nvm_generic(struct e1000_hw *hw); -void e1000_reload_nvm_generic(struct e1000_hw *hw); #define E1000_STM_OPCODE 0xDB00 diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.c index 374b13b55a..6a75bf1fd9 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2009, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_osdep.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_osdep.c,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/ #include "e1000_api.h" @@ -41,13 +41,13 @@ */ void -e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) +e1000_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value) { pci_write_config(((struct e1000_osdep *)hw->back)->dev, reg, *value, 2); } void -e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) +e1000_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value) { *value = pci_read_config(((struct e1000_osdep *)hw->back)->dev, reg, 2); } @@ -70,12 +70,26 @@ e1000_pci_clear_mwi(struct e1000_hw *hw) * Read the PCI Express capabilities */ int32_t -e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) +e1000_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) { - u32 result; + device_t dev = ((struct e1000_osdep *)hw->back)->dev; + u32 offset; - pci_find_extcap(((struct e1000_osdep *)hw->back)->dev, - reg, &result); - *value = (u16)result; + pci_find_extcap(dev, PCIY_EXPRESS, &offset); + *value = pci_read_config(dev, offset + reg, 2); + return (E1000_SUCCESS); +} + +/* + * Write the PCI Express capabilities + */ +int32_t +e1000_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) +{ + device_t dev = ((struct e1000_osdep *)hw->back)->dev; + u32 offset; + + pci_find_extcap(dev, PCIY_EXPRESS, &offset); + pci_write_config(dev, offset + reg, *value, 2); return (E1000_SUCCESS); } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h index e4a84dc0f2..b6d0a463c7 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_osdep.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_osdep.h,v 1.2.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _FREEBSD_OS_H_ @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include #include #include @@ -57,32 +59,40 @@ #define ASSERT(x) if(!(x)) panic("EM: x") -/* The happy-fun DELAY macro is defined in /usr/src/sys/i386/include/clock.h */ #define usec_delay(x) DELAY(x) #define msec_delay(x) DELAY(1000*(x)) -/* TODO: Should we be paranoid about delaying in interrupt context? */ #define msec_delay_irq(x) DELAY(1000*(x)) #define MSGOUT(S, A, B) printf(S "\n", A, B) #define DEBUGFUNC(F) DEBUGOUT(F); - #define DEBUGOUT(S) - #define DEBUGOUT1(S,A) - #define DEBUGOUT2(S,A,B) - #define DEBUGOUT3(S,A,B,C) - #define DEBUGOUT7(S,A,B,C,D,E,F,G) +#define DEBUGOUT(S) do {} while (0) +#define DEBUGOUT1(S,A) do {} while (0) +#define DEBUGOUT2(S,A,B) do {} while (0) +#define DEBUGOUT3(S,A,B,C) do {} while (0) +#define DEBUGOUT7(S,A,B,C,D,E,F,G) do {} while (0) #define STATIC static +#ifndef __HAIKU__ #define FALSE 0 -//#define false FALSE /* shared code stupidity */ +#define false FALSE #define TRUE 1 -//#define true TRUE +#define true TRUE +#else +#define FALSE 0 +#define TRUE 1 +#endif #define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */ #define PCI_COMMAND_REGISTER PCIR_COMMAND -/* -** These typedefs are necessary due to the new -** shared code, they are native to Linux. -*/ +/* Mutex used in the shared code */ +#define E1000_MUTEX struct mtx +#define E1000_MUTEX_INIT(mutex) mtx_init((mutex), #mutex, \ + MTX_NETWORK_LOCK, MTX_DEF) +#define E1000_MUTEX_DESTROY(mutex) mtx_destroy(mutex) +#define E1000_MUTEX_LOCK(mutex) mtx_lock(mutex) +#define E1000_MUTEX_TRYLOCK(mutex) mtx_trylock(mutex) +#define E1000_MUTEX_UNLOCK(mutex) mtx_unlock(mutex) + typedef uint64_t u64; typedef uint32_t u32; typedef uint16_t u16; @@ -91,12 +101,36 @@ typedef int64_t s64; typedef int32_t s32; typedef int16_t s16; typedef int8_t s8; -//typedef boolean_t bool; +#ifndef __HAIKU__ +typedef boolean_t bool; +#endif #define __le16 u16 #define __le32 u32 #define __le64 u64 +#if __FreeBSD_version < 800000 /* Now in HEAD */ +#if defined(__i386__) || defined(__amd64__) +#define mb() __asm volatile("mfence" ::: "memory") +#define wmb() __asm volatile("sfence" ::: "memory") +#define rmb() __asm volatile("lfence" ::: "memory") +#else +#define mb() +#define rmb() +#define wmb() +#endif +#endif /*__FreeBSD_version < 800000 */ + +#if defined(__i386__) || defined(__amd64__) +static __inline +void prefetch(void *x) +{ + __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); +} +#else +#define prefetch(x) +#endif + struct e1000_osdep { bus_space_tag_t mem_bus_space_tag; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.c index e4023ec6e2..ae1b3793ea 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,13 +30,17 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_phy.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_phy.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #include "e1000_api.h" static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg); static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data, bool read); +static u32 e1000_get_phy_addr_for_hv_page(u32 page); +static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, + u16 *data, bool read); + /* Cable length tables */ static const u16 e1000_m88_cable_length_table[] = { 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED }; @@ -79,11 +83,13 @@ void e1000_init_phy_ops_generic(struct e1000_hw *hw) phy->ops.get_cable_length = e1000_null_ops_generic; phy->ops.get_info = e1000_null_ops_generic; phy->ops.read_reg = e1000_null_read_reg; + phy->ops.read_reg_locked = e1000_null_read_reg; phy->ops.release = e1000_null_phy_generic; phy->ops.reset = e1000_null_ops_generic; phy->ops.set_d0_lplu_state = e1000_null_lplu_state; phy->ops.set_d3_lplu_state = e1000_null_lplu_state; phy->ops.write_reg = e1000_null_write_reg; + phy->ops.write_reg_locked = e1000_null_write_reg; phy->ops.power_up = e1000_null_phy_generic; phy->ops.power_down = e1000_null_phy_generic; phy->ops.cfg_on_link_up = e1000_null_ops_generic; @@ -161,25 +167,32 @@ s32 e1000_get_phy_id(struct e1000_hw *hw) struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; u16 phy_id; + u16 retry_count = 0; DEBUGFUNC("e1000_get_phy_id"); if (!(phy->ops.read_reg)) goto out; - ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); - if (ret_val) - goto out; + while (retry_count < 2) { + ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); + if (ret_val) + goto out; - phy->id = (u32)(phy_id << 16); - usec_delay(20); - ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); - if (ret_val) - goto out; + phy->id = (u32)(phy_id << 16); + usec_delay(20); + ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); + if (ret_val) + goto out; - phy->id |= (u32)(phy_id & PHY_REVISION_MASK); - phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); + phy->id |= (u32)(phy_id & PHY_REVISION_MASK); + phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); + if (phy->id != 0 && phy->id != PHY_REVISION_MASK) + goto out; + + retry_count++; + } out: return ret_val; } @@ -226,6 +239,11 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) DEBUGFUNC("e1000_read_phy_reg_mdic"); + if (offset > MAX_PHY_REG_ADDRESS) { + DEBUGOUT1("PHY Address %d is out of range\n", offset); + return -E1000_ERR_PARAM; + } + /* * Set up Op-code, Phy Address, and register offset in the MDI * Control register. The MAC will take care of interfacing with the @@ -237,6 +255,10 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) E1000_WRITE_REG(hw, E1000_MDIC, mdic); + /* Workaround for Si errata */ + if ((hw->phy.type == e1000_phy_82577) && (hw->revision_id <= 2)) + msec_delay(10); + /* * Poll the ready bit to see if the MDI read completed * Increasing the time out as testing showed failures with @@ -259,6 +281,13 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) goto out; } *data = (u16) mdic; + + /* + * Allow some time after each MDIC transaction to avoid + * reading duplicate data in the next MDIC transaction. + */ + if (hw->mac.type == e1000_pch2lan) + usec_delay(100); out: return ret_val; @@ -280,6 +309,11 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) DEBUGFUNC("e1000_write_phy_reg_mdic"); + if (offset > MAX_PHY_REG_ADDRESS) { + DEBUGOUT1("PHY Address %d is out of range\n", offset); + return -E1000_ERR_PARAM; + } + /* * Set up Op-code, Phy Address, and register offset in the MDI * Control register. The MAC will take care of interfacing with the @@ -292,6 +326,10 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) E1000_WRITE_REG(hw, E1000_MDIC, mdic); + /* Workaround for Si errata */ + if ((hw->phy.type == e1000_phy_82577) && (hw->revision_id <= 2)) + msec_delay(10); + /* * Poll the ready bit to see if the MDI read completed * Increasing the time out as testing showed failures with @@ -314,10 +352,116 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) goto out; } + /* + * Allow some time after each MDIC transaction to avoid + * reading duplicate data in the next MDIC transaction. + */ + if (hw->mac.type == e1000_pch2lan) + usec_delay(100); + out: return ret_val; } +/** + * e1000_read_phy_reg_i2c - Read PHY register using i2c + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Reads the PHY register at offset using the i2c interface and stores the + * retrieved information in data. + **/ +s32 e1000_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data) +{ + struct e1000_phy_info *phy = &hw->phy; + u32 i, i2ccmd = 0; + + DEBUGFUNC("e1000_read_phy_reg_i2c"); + + /* + * Set up Op-code, Phy Address, and register address in the I2CCMD + * register. The MAC will take care of interfacing with the + * PHY to retrieve the desired data. + */ + i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | + (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | + (E1000_I2CCMD_OPCODE_READ)); + + E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); + + /* Poll the ready bit to see if the I2C read completed */ + for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) { + usec_delay(50); + i2ccmd = E1000_READ_REG(hw, E1000_I2CCMD); + if (i2ccmd & E1000_I2CCMD_READY) + break; + } + if (!(i2ccmd & E1000_I2CCMD_READY)) { + DEBUGOUT("I2CCMD Read did not complete\n"); + return -E1000_ERR_PHY; + } + if (i2ccmd & E1000_I2CCMD_ERROR) { + DEBUGOUT("I2CCMD Error bit set\n"); + return -E1000_ERR_PHY; + } + + /* Need to byte-swap the 16-bit value. */ + *data = ((i2ccmd >> 8) & 0x00FF) | ((i2ccmd << 8) & 0xFF00); + + return E1000_SUCCESS; +} + +/** + * e1000_write_phy_reg_i2c - Write PHY register using i2c + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Writes the data to PHY register at the offset using the i2c interface. + **/ +s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) +{ + struct e1000_phy_info *phy = &hw->phy; + u32 i, i2ccmd = 0; + u16 phy_data_swapped; + + DEBUGFUNC("e1000_write_phy_reg_i2c"); + + /* Swap the data bytes for the I2C interface */ + phy_data_swapped = ((data >> 8) & 0x00FF) | ((data << 8) & 0xFF00); + + /* + * Set up Op-code, Phy Address, and register address in the I2CCMD + * register. The MAC will take care of interfacing with the + * PHY to retrieve the desired data. + */ + i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | + (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | + E1000_I2CCMD_OPCODE_WRITE | + phy_data_swapped); + + E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); + + /* Poll the ready bit to see if the I2C read completed */ + for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) { + usec_delay(50); + i2ccmd = E1000_READ_REG(hw, E1000_I2CCMD); + if (i2ccmd & E1000_I2CCMD_READY) + break; + } + if (!(i2ccmd & E1000_I2CCMD_READY)) { + DEBUGOUT("I2CCMD Write did not complete\n"); + return -E1000_ERR_PHY; + } + if (i2ccmd & E1000_I2CCMD_ERROR) { + DEBUGOUT("I2CCMD Error bit set\n"); + return -E1000_ERR_PHY; + } + + return E1000_SUCCESS; +} + /** * e1000_read_phy_reg_m88 - Read m88 PHY register * @hw: pointer to the HW structure @@ -382,42 +526,119 @@ out: } /** - * e1000_read_phy_reg_igp - Read igp PHY register + * __e1000_read_phy_reg_igp - Read igp PHY register * @hw: pointer to the HW structure * @offset: register offset to be read * @data: pointer to the read data + * @locked: semaphore has already been acquired or not * * Acquires semaphore, if necessary, then reads the PHY register at offset - * and storing the retrieved information in data. Release any acquired + * and stores the retrieved information in data. Release any acquired * semaphores before exiting. **/ -s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) +static s32 __e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, + bool locked) { s32 ret_val = E1000_SUCCESS; - DEBUGFUNC("e1000_read_phy_reg_igp"); + DEBUGFUNC("__e1000_read_phy_reg_igp"); - if (!(hw->phy.ops.acquire)) - goto out; + if (!locked) { + if (!(hw->phy.ops.acquire)) + goto out; - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) - goto out; + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + } if (offset > MAX_PHY_MULTI_PAGE_REG) { ret_val = e1000_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, (u16)offset); - if (ret_val) { - hw->phy.ops.release(hw); - goto out; - } + if (ret_val) + goto release; } ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); - hw->phy.ops.release(hw); +release: + if (!locked) + hw->phy.ops.release(hw); +out: + return ret_val; +} + +/** + * e1000_read_phy_reg_igp - Read igp PHY register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Acquires semaphore then reads the PHY register at offset and stores the + * retrieved information in data. + * Release the acquired semaphore before exiting. + **/ +s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) +{ + return __e1000_read_phy_reg_igp(hw, offset, data, FALSE); +} + +/** + * e1000_read_phy_reg_igp_locked - Read igp PHY register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Reads the PHY register at offset and stores the retrieved information + * in data. Assumes semaphore already acquired. + **/ +s32 e1000_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data) +{ + return __e1000_read_phy_reg_igp(hw, offset, data, TRUE); +} + +/** + * e1000_write_phy_reg_igp - Write igp PHY register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * @locked: semaphore has already been acquired or not + * + * Acquires semaphore, if necessary, then writes the data to PHY register + * at the offset. Release any acquired semaphores before exiting. + **/ +static s32 __e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data, + bool locked) +{ + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_write_phy_reg_igp"); + + if (!locked) { + if (!(hw->phy.ops.acquire)) + goto out; + + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + } + + if (offset > MAX_PHY_MULTI_PAGE_REG) { + ret_val = e1000_write_phy_reg_mdic(hw, + IGP01E1000_PHY_PAGE_SELECT, + (u16)offset); + if (ret_val) + goto release; + } + + ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, + data); + +release: + if (!locked) + hw->phy.ops.release(hw); out: return ret_val; @@ -429,64 +650,55 @@ out: * @offset: register offset to write to * @data: data to write at register offset * - * Acquires semaphore, if necessary, then writes the data to PHY register + * Acquires semaphore then writes the data to PHY register * at the offset. Release any acquired semaphores before exiting. **/ s32 e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) { - s32 ret_val = E1000_SUCCESS; - - DEBUGFUNC("e1000_write_phy_reg_igp"); - - if (!(hw->phy.ops.acquire)) - goto out; - - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) - goto out; - - if (offset > MAX_PHY_MULTI_PAGE_REG) { - ret_val = e1000_write_phy_reg_mdic(hw, - IGP01E1000_PHY_PAGE_SELECT, - (u16)offset); - if (ret_val) { - hw->phy.ops.release(hw); - goto out; - } - } - - ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); - - hw->phy.ops.release(hw); - -out: - return ret_val; + return __e1000_write_phy_reg_igp(hw, offset, data, FALSE); } /** - * e1000_read_kmrn_reg_generic - Read kumeran register + * e1000_write_phy_reg_igp_locked - Write igp PHY register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Writes the data to PHY register at the offset. + * Assumes semaphore already acquired. + **/ +s32 e1000_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data) +{ + return __e1000_write_phy_reg_igp(hw, offset, data, TRUE); +} + +/** + * __e1000_read_kmrn_reg - Read kumeran register * @hw: pointer to the HW structure * @offset: register offset to be read * @data: pointer to the read data + * @locked: semaphore has already been acquired or not * * Acquires semaphore, if necessary. Then reads the PHY register at offset * using the kumeran interface. The information retrieved is stored in data. * Release any acquired semaphores before exiting. **/ -s32 e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data) +static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data, + bool locked) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; - DEBUGFUNC("e1000_read_kmrn_reg_generic"); + DEBUGFUNC("__e1000_read_kmrn_reg"); - if (!(hw->phy.ops.acquire)) - goto out; + if (!locked) { + if (!(hw->phy.ops.acquire)) + goto out; - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) - goto out; + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + } kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; @@ -497,42 +709,149 @@ s32 e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data) kmrnctrlsta = E1000_READ_REG(hw, E1000_KMRNCTRLSTA); *data = (u16)kmrnctrlsta; - hw->phy.ops.release(hw); + if (!locked) + hw->phy.ops.release(hw); out: return ret_val; } /** - * e1000_write_kmrn_reg_generic - Write kumeran register + * e1000_read_kmrn_reg_generic - Read kumeran register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Acquires semaphore then reads the PHY register at offset using the + * kumeran interface. The information retrieved is stored in data. + * Release the acquired semaphore before exiting. + **/ +s32 e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data) +{ + return __e1000_read_kmrn_reg(hw, offset, data, FALSE); +} + +/** + * e1000_read_kmrn_reg_locked - Read kumeran register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Reads the PHY register at offset using the kumeran interface. The + * information retrieved is stored in data. + * Assumes semaphore already acquired. + **/ +s32 e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) +{ + return __e1000_read_kmrn_reg(hw, offset, data, TRUE); +} + +/** + * __e1000_write_kmrn_reg - Write kumeran register * @hw: pointer to the HW structure * @offset: register offset to write to * @data: data to write at register offset + * @locked: semaphore has already been acquired or not * * Acquires semaphore, if necessary. Then write the data to PHY register * at the offset using the kumeran interface. Release any acquired semaphores * before exiting. **/ -s32 e1000_write_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 data) +static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data, + bool locked) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_write_kmrn_reg_generic"); - if (!(hw->phy.ops.acquire)) - goto out; + if (!locked) { + if (!(hw->phy.ops.acquire)) + goto out; - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) - goto out; + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + } kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & E1000_KMRNCTRLSTA_OFFSET) | data; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); usec_delay(2); - hw->phy.ops.release(hw); + + if (!locked) + hw->phy.ops.release(hw); + +out: + return ret_val; +} + +/** + * e1000_write_kmrn_reg_generic - Write kumeran register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Acquires semaphore then writes the data to the PHY register at the offset + * using the kumeran interface. Release the acquired semaphore before exiting. + **/ +s32 e1000_write_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 data) +{ + return __e1000_write_kmrn_reg(hw, offset, data, FALSE); +} + +/** + * e1000_write_kmrn_reg_locked - Write kumeran register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Write the data to PHY register at the offset using the kumeran interface. + * Assumes semaphore already acquired. + **/ +s32 e1000_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data) +{ + return __e1000_write_kmrn_reg(hw, offset, data, TRUE); +} + +/** + * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link + * @hw: pointer to the HW structure + * + * Sets up Carrier-sense on Transmit and downshift values. + **/ +s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) +{ + s32 ret_val; + u16 phy_data; + + DEBUGFUNC("e1000_copper_link_setup_82577"); + + if (hw->phy.reset_disable) { + ret_val = E1000_SUCCESS; + goto out; + } + + if (hw->phy.type == e1000_phy_82580) { + ret_val = hw->phy.ops.reset(hw); + if (ret_val) { + DEBUGOUT("Error resetting the PHY.\n"); + goto out; + } + } + + /* Enable CRS on TX. This must be set for half-duplex operation. */ + ret_val = hw->phy.ops.read_reg(hw, I82577_CFG_REG, &phy_data); + if (ret_val) + goto out; + + phy_data |= I82577_CFG_ASSERT_CRS_ON_TX; + + /* Enable downshift */ + phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; + + ret_val = hw->phy.ops.write_reg(hw, I82577_CFG_REG, phy_data); out: return ret_val; @@ -558,14 +877,15 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) goto out; } - /* Enable CRS on TX. This must be set for half-duplex operation. */ + /* Enable CRS on Tx. This must be set for half-duplex operation. */ ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); if (ret_val) goto out; - /* For newer PHYs this bit is downshift enable */ - if (phy->type == e1000_phy_m88) - phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; + phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; + /* For BM PHY this bit is downshift enable */ + if (phy->type == e1000_phy_bm) + phy_data &= ~M88E1000_PSCR_ASSERT_CRS_ON_TX; /* * Options: @@ -663,6 +983,21 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) goto out; } + if (phy->type == e1000_phy_82578) { + ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, + &phy_data); + if (ret_val) + goto out; + + /* 82578 PHY - set the downshift count to 1x. */ + phy_data |= I82578_EPSCR_DOWNSHIFT_ENABLE; + phy_data &= ~I82578_EPSCR_DOWNSHIFT_COUNTER_MASK; + ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, + phy_data); + if (ret_val) + goto out; + } + out: return ret_val; } @@ -1235,18 +1570,22 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw) goto out; if (!link) { - /* - * We didn't get link. - * Reset the DSP and cross our fingers. - */ - ret_val = phy->ops.write_reg(hw, - M88E1000_PHY_PAGE_SELECT, - 0x001d); - if (ret_val) - goto out; - ret_val = e1000_phy_reset_dsp_generic(hw); - if (ret_val) - goto out; + if (hw->phy.type != e1000_phy_m88) { + DEBUGOUT("Link taking longer than expected.\n"); + } else { + /* + * We didn't get link. + * Reset the DSP and cross our fingers. + */ + ret_val = phy->ops.write_reg(hw, + M88E1000_PHY_PAGE_SELECT, + 0x001d); + if (ret_val) + goto out; + ret_val = e1000_phy_reset_dsp_generic(hw); + if (ret_val) + goto out; + } } /* Try once more */ @@ -1256,6 +1595,9 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw) goto out; } + if (hw->phy.type != e1000_phy_m88) + goto out; + ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); if (ret_val) goto out; @@ -1285,6 +1627,75 @@ out: return ret_val; } +/** + * e1000_phy_force_speed_duplex_ife - Force PHY speed & duplex + * @hw: pointer to the HW structure + * + * Forces the speed and duplex settings of the PHY. + * This is a function pointer entry point only called by + * PHY setup routines. + **/ +s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 data; + bool link; + + DEBUGFUNC("e1000_phy_force_speed_duplex_ife"); + + ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &data); + if (ret_val) + goto out; + + e1000_phy_force_speed_duplex_setup(hw, &data); + + ret_val = phy->ops.write_reg(hw, PHY_CONTROL, data); + if (ret_val) + goto out; + + /* Disable MDI-X support for 10/100 */ + ret_val = phy->ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, &data); + if (ret_val) + goto out; + + data &= ~IFE_PMC_AUTO_MDIX; + data &= ~IFE_PMC_FORCE_MDIX; + + ret_val = phy->ops.write_reg(hw, IFE_PHY_MDIX_CONTROL, data); + if (ret_val) + goto out; + + DEBUGOUT1("IFE PMC: %X\n", data); + + usec_delay(1); + + if (phy->autoneg_wait_to_complete) { + DEBUGOUT("Waiting for forced speed/duplex link on IFE phy.\n"); + + ret_val = e1000_phy_has_link_generic(hw, + PHY_FORCE_LIMIT, + 100000, + &link); + if (ret_val) + goto out; + + if (!link) + DEBUGOUT("Link taking longer than expected.\n"); + + /* Try once more */ + ret_val = e1000_phy_has_link_generic(hw, + PHY_FORCE_LIMIT, + 100000, + &link); + if (ret_val) + goto out; + } + +out: + return ret_val; +} + /** * e1000_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex * @hw: pointer to the HW structure @@ -1459,11 +1870,12 @@ s32 e1000_check_downshift_generic(struct e1000_hw *hw) case e1000_phy_m88: case e1000_phy_gg82563: case e1000_phy_bm: + case e1000_phy_82578: offset = M88E1000_PHY_SPEC_STATUS; mask = M88E1000_PSSR_DOWNSHIFT; break; - case e1000_phy_igp_2: case e1000_phy_igp: + case e1000_phy_igp_2: case e1000_phy_igp_3: offset = IGP01E1000_PHY_LINK_HEALTH; mask = IGP01E1000_PLHR_SS_DOWNGRADE; @@ -1559,6 +1971,41 @@ out: return ret_val; } +/** + * e1000_check_polarity_ife - Check cable polarity for IFE PHY + * @hw: pointer to the HW structure + * + * Polarity is determined on the polarity reversal feature being enabled. + **/ +s32 e1000_check_polarity_ife(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 phy_data, offset, mask; + + DEBUGFUNC("e1000_check_polarity_ife"); + + /* + * Polarity is determined based on the reversal feature being enabled. + */ + if (phy->polarity_correction) { + offset = IFE_PHY_EXTENDED_STATUS_CONTROL; + mask = IFE_PESC_POLARITY_REVERSED; + } else { + offset = IFE_PHY_SPECIAL_CONTROL; + mask = IFE_PSC_FORCE_POLARITY; + } + + ret_val = phy->ops.read_reg(hw, offset, &phy_data); + + if (!ret_val) + phy->cable_polarity = (phy_data & mask) + ? e1000_rev_polarity_reversed + : e1000_rev_polarity_normal; + + return ret_val; +} + /** * e1000_wait_autoneg_generic - Wait for auto-neg completion * @hw: pointer to the HW structure @@ -1624,7 +2071,12 @@ s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, */ ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); if (ret_val) - break; + /* + * If the first read fails, another entity may have + * ownership of the resources, wait and try again to + * see if they have relinquished the resources yet. + */ + usec_delay(usec_interval); ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); if (ret_val) break; @@ -1670,16 +2122,16 @@ s32 e1000_get_cable_length_m88(struct e1000_hw *hw) index = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >> M88E1000_PSSR_CABLE_LENGTH_SHIFT; - if (index < M88E1000_CABLE_LENGTH_TABLE_SIZE + 1) { - phy->min_cable_length = e1000_m88_cable_length_table[index]; - phy->max_cable_length = e1000_m88_cable_length_table[index+1]; - - phy->cable_length = (phy->min_cable_length + - phy->max_cable_length) / 2; - } else { - ret_val = E1000_ERR_PHY; + if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) { + ret_val = -E1000_ERR_PHY; + goto out; } + phy->min_cable_length = e1000_m88_cable_length_table[index]; + phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; + + phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; + out: return ret_val; } @@ -1777,7 +2229,7 @@ s32 e1000_get_phy_info_m88(struct e1000_hw *hw) DEBUGFUNC("e1000_get_phy_info_m88"); - if (hw->phy.media_type != e1000_media_type_copper) { + if (phy->media_type != e1000_media_type_copper) { DEBUGOUT("Phy info is only valid for copper media\n"); ret_val = -E1000_ERR_CONFIG; goto out; @@ -1879,7 +2331,7 @@ s32 e1000_get_phy_info_igp(struct e1000_hw *hw) if ((data & IGP01E1000_PSSR_SPEED_MASK) == IGP01E1000_PSSR_SPEED_1000MBPS) { - ret_val = hw->phy.ops.get_cable_length(hw); + ret_val = phy->ops.get_cable_length(hw); if (ret_val) goto out; @@ -1904,6 +2356,63 @@ out: return ret_val; } +/** + * e1000_get_phy_info_ife - Retrieves various IFE PHY states + * @hw: pointer to the HW structure + * + * Populates "phy" structure with various feature states. + **/ +s32 e1000_get_phy_info_ife(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 data; + bool link; + + DEBUGFUNC("e1000_get_phy_info_ife"); + + ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); + if (ret_val) + goto out; + + if (!link) { + DEBUGOUT("Phy info is only valid if link is up\n"); + ret_val = -E1000_ERR_CONFIG; + goto out; + } + + ret_val = phy->ops.read_reg(hw, IFE_PHY_SPECIAL_CONTROL, &data); + if (ret_val) + goto out; + phy->polarity_correction = (data & IFE_PSC_AUTO_POLARITY_DISABLE) + ? FALSE : TRUE; + + if (phy->polarity_correction) { + ret_val = e1000_check_polarity_ife(hw); + if (ret_val) + goto out; + } else { + /* Polarity is forced */ + phy->cable_polarity = (data & IFE_PSC_FORCE_POLARITY) + ? e1000_rev_polarity_reversed + : e1000_rev_polarity_normal; + } + + ret_val = phy->ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, &data); + if (ret_val) + goto out; + + phy->is_mdix = (data & IFE_PMC_MDIX_STATUS) ? TRUE : FALSE; + + /* The following parameters are undefined for 10/100 operation. */ + phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; + phy->local_rx = e1000_1000t_rx_status_undefined; + phy->remote_rx = e1000_1000t_rx_status_undefined; + +out: + return ret_val; +} + /** * e1000_phy_sw_reset_generic - PHY software reset * @hw: pointer to the HW structure @@ -2093,7 +2602,7 @@ enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id) { enum e1000_phy_type phy_type = e1000_phy_unknown; - switch (phy_id) { + switch (phy_id) { case M88E1000_I_PHY_ID: case M88E1000_E_PHY_ID: case M88E1111_I_PHY_ID: @@ -2118,6 +2627,18 @@ enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id) case BME1000_E_PHY_ID_R2: phy_type = e1000_phy_bm; break; + case I82578_E_PHY_ID: + phy_type = e1000_phy_82578; + break; + case I82577_E_PHY_ID: + phy_type = e1000_phy_82577; + break; + case I82579_E_PHY_ID: + phy_type = e1000_phy_82579; + break; + case I82580_I_PHY_ID: + phy_type = e1000_phy_82580; + break; default: phy_type = e1000_phy_unknown; break; @@ -2140,6 +2661,8 @@ s32 e1000_determine_phy_address(struct e1000_hw *hw) u32 i; enum e1000_phy_type phy_type = e1000_phy_unknown; + hw->phy.id = phy_type; + for (phy_addr = 0; phy_addr < E1000_MAX_PHY_ADDR; phy_addr++) { hw->phy.addr = phy_addr; i = 0; @@ -2199,6 +2722,10 @@ s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) DEBUGFUNC("e1000_write_phy_reg_bm"); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, @@ -2206,10 +2733,6 @@ s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) goto out; } - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) - goto out; - hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); if (offset > MAX_PHY_MULTI_PAGE_REG) { @@ -2229,18 +2752,15 @@ s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) /* Page is shifted left, PHY expects (page x 32) */ ret_val = e1000_write_phy_reg_mdic(hw, page_select, (page << page_shift)); - if (ret_val) { - hw->phy.ops.release(hw); + if (ret_val) goto out; - } } ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); - hw->phy.ops.release(hw); - out: + hw->phy.ops.release(hw); return ret_val; } @@ -2263,6 +2783,10 @@ s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) DEBUGFUNC("e1000_read_phy_reg_bm"); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, @@ -2270,10 +2794,6 @@ s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) goto out; } - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) - goto out; - hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); if (offset > MAX_PHY_MULTI_PAGE_REG) { @@ -2293,17 +2813,14 @@ s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) /* Page is shifted left, PHY expects (page x 32) */ ret_val = e1000_write_phy_reg_mdic(hw, page_select, (page << page_shift)); - if (ret_val) { - hw->phy.ops.release(hw); + if (ret_val) goto out; - } } ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); - hw->phy.ops.release(hw); - out: + hw->phy.ops.release(hw); return ret_val; } @@ -2324,6 +2841,10 @@ s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) DEBUGFUNC("e1000_write_phy_reg_bm2"); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, @@ -2331,10 +2852,6 @@ s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) goto out; } - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) - goto out; - hw->phy.addr = 1; if (offset > MAX_PHY_MULTI_PAGE_REG) { @@ -2343,17 +2860,14 @@ s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) ret_val = e1000_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, page); - if (ret_val) { - hw->phy.ops.release(hw); + if (ret_val) goto out; - } } ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); - hw->phy.ops.release(hw); - out: + hw->phy.ops.release(hw); return ret_val; } @@ -2373,6 +2887,10 @@ s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) DEBUGFUNC("e1000_write_phy_reg_bm2"); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, @@ -2380,10 +2898,6 @@ s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) goto out; } - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) - goto out; - hw->phy.addr = 1; if (offset > MAX_PHY_MULTI_PAGE_REG) { @@ -2391,18 +2905,15 @@ s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) ret_val = e1000_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, page); - if (ret_val) { - hw->phy.ops.release(hw); + if (ret_val) goto out; - } } ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); - hw->phy.ops.release(hw); - out: + hw->phy.ops.release(hw); return ret_val; } @@ -2422,23 +2933,22 @@ out: * 3) Write the address using the address opcode (0x11) * 4) Read or write the data using the data opcode (0x12) * 5) Restore 769_17.2 to its original value + * + * Assumes semaphore already acquired. **/ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data, bool read) { s32 ret_val; - u16 reg = ((u16)offset); + u16 reg = BM_PHY_REG_NUM(offset); u16 phy_reg = 0; - u8 phy_acquired = 1; - DEBUGFUNC("e1000_read_phy_wakeup_reg_bm"); + DEBUGFUNC("e1000_access_phy_wakeup_reg_bm"); - ret_val = hw->phy.ops.acquire(hw); - if (ret_val) { - DEBUGOUT("Could not acquire PHY\n"); - phy_acquired = 0; - goto out; - } + /* Gig must be disabled for MDIO accesses to page 800 */ + if ((hw->mac.type == e1000_pchlan) && + (!(E1000_READ_REG(hw, E1000_PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE))) + DEBUGOUT("Attempting to access page 800 while gig enabled.\n"); /* All operations in this function are phy address 1 */ hw->phy.addr = 1; @@ -2484,15 +2994,15 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, if (read) { /* Read the page 800 value using opcode 0x12 */ ret_val = e1000_read_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, - data); + data); } else { - /* Read the page 800 value using opcode 0x12 */ + /* Write the page 800 value using opcode 0x12 */ ret_val = e1000_write_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, - *data); + *data); } if (ret_val) { - DEBUGOUT("Could not read data value from page 800\n"); + DEBUGOUT("Could not access data value from page 800\n"); goto out; } @@ -2511,8 +3021,6 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, } out: - if (phy_acquired == 1) - hw->phy.ops.release(hw); return ret_val; } @@ -2552,3 +3060,509 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw) hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); msec_delay(1); } + +/** + * __e1000_read_phy_reg_hv - Read HV PHY register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * @locked: semaphore has already been acquired or not + * + * Acquires semaphore, if necessary, then reads the PHY register at offset + * and stores the retrieved information in data. Release any acquired + * semaphore before exiting. + **/ +static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, + bool locked) +{ + s32 ret_val; + u16 page = BM_PHY_REG_PAGE(offset); + u16 reg = BM_PHY_REG_NUM(offset); + + DEBUGFUNC("__e1000_read_phy_reg_hv"); + + if (!locked) { + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + } + + /* Page 800 works differently than the rest so it has its own func */ + if (page == BM_WUC_PAGE) { + ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, + data, TRUE); + goto out; + } + + if (page > 0 && page < HV_INTC_FC_PAGE_START) { + ret_val = e1000_access_phy_debug_regs_hv(hw, offset, + data, TRUE); + goto out; + } + + hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); + + if (page == HV_INTC_FC_PAGE_START) + page = 0; + + if (reg > MAX_PHY_MULTI_PAGE_REG) { + u32 phy_addr = hw->phy.addr; + + hw->phy.addr = 1; + + /* Page is shifted left, PHY expects (page x 32) */ + ret_val = e1000_write_phy_reg_mdic(hw, + IGP01E1000_PHY_PAGE_SELECT, + (page << IGP_PAGE_SHIFT)); + hw->phy.addr = phy_addr; + + if (ret_val) + goto out; + } + + ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, + data); +out: + if (!locked) + hw->phy.ops.release(hw); + + return ret_val; +} + +/** + * e1000_read_phy_reg_hv - Read HV PHY register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Acquires semaphore then reads the PHY register at offset and stores + * the retrieved information in data. Release the acquired semaphore + * before exiting. + **/ +s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) +{ + return __e1000_read_phy_reg_hv(hw, offset, data, FALSE); +} + +/** + * e1000_read_phy_reg_hv_locked - Read HV PHY register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Reads the PHY register at offset and stores the retrieved information + * in data. Assumes semaphore already acquired. + **/ +s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) +{ + return __e1000_read_phy_reg_hv(hw, offset, data, TRUE); +} + +/** + * __e1000_write_phy_reg_hv - Write HV PHY register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * @locked: semaphore has already been acquired or not + * + * Acquires semaphore, if necessary, then writes the data to PHY register + * at the offset. Release any acquired semaphores before exiting. + **/ +static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, + bool locked) +{ + s32 ret_val; + u16 page = BM_PHY_REG_PAGE(offset); + u16 reg = BM_PHY_REG_NUM(offset); + + DEBUGFUNC("__e1000_write_phy_reg_hv"); + + if (!locked) { + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + } + + /* Page 800 works differently than the rest so it has its own func */ + if (page == BM_WUC_PAGE) { + ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, + &data, FALSE); + goto out; + } + + if (page > 0 && page < HV_INTC_FC_PAGE_START) { + ret_val = e1000_access_phy_debug_regs_hv(hw, offset, + &data, FALSE); + goto out; + } + + hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); + + if (page == HV_INTC_FC_PAGE_START) + page = 0; + + /* + * Workaround MDIO accesses being disabled after entering IEEE Power + * Down (whenever bit 11 of the PHY Control register is set) + */ + if ((hw->phy.type == e1000_phy_82578) && + (hw->phy.revision >= 1) && + (hw->phy.addr == 2) && + ((MAX_PHY_REG_ADDRESS & reg) == 0) && + (data & (1 << 11))) { + u16 data2 = 0x7EFF; + ret_val = e1000_access_phy_debug_regs_hv(hw, (1 << 6) | 0x3, + &data2, FALSE); + if (ret_val) + goto out; + } + + if (reg > MAX_PHY_MULTI_PAGE_REG) { + u32 phy_addr = hw->phy.addr; + + hw->phy.addr = 1; + + /* Page is shifted left, PHY expects (page x 32) */ + ret_val = e1000_write_phy_reg_mdic(hw, + IGP01E1000_PHY_PAGE_SELECT, + (page << IGP_PAGE_SHIFT)); + hw->phy.addr = phy_addr; + + if (ret_val) + goto out; + } + + ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, + data); + +out: + if (!locked) + hw->phy.ops.release(hw); + + return ret_val; +} + +/** + * e1000_write_phy_reg_hv - Write HV PHY register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Acquires semaphore then writes the data to PHY register at the offset. + * Release the acquired semaphores before exiting. + **/ +s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) +{ + return __e1000_write_phy_reg_hv(hw, offset, data, FALSE); +} + +/** + * e1000_write_phy_reg_hv_locked - Write HV PHY register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Writes the data to PHY register at the offset. Assumes semaphore + * already acquired. + **/ +s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) +{ + return __e1000_write_phy_reg_hv(hw, offset, data, TRUE); +} + +/** + * e1000_get_phy_addr_for_hv_page - Get PHY adrress based on page + * @page: page to be accessed + **/ +static u32 e1000_get_phy_addr_for_hv_page(u32 page) +{ + u32 phy_addr = 2; + + if (page >= HV_INTC_FC_PAGE_START) + phy_addr = 1; + + return phy_addr; +} + +/** + * e1000_access_phy_debug_regs_hv - Read HV PHY vendor specific high registers + * @hw: pointer to the HW structure + * @offset: register offset to be read or written + * @data: pointer to the data to be read or written + * @read: determines if operation is read or written + * + * Reads the PHY register at offset and stores the retreived information + * in data. Assumes semaphore already acquired. Note that the procedure + * to read these regs uses the address port and data port to read/write. + **/ +static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, + u16 *data, bool read) +{ + s32 ret_val; + u32 addr_reg = 0; + u32 data_reg = 0; + + DEBUGFUNC("e1000_access_phy_debug_regs_hv"); + + /* This takes care of the difference with desktop vs mobile phy */ + addr_reg = (hw->phy.type == e1000_phy_82578) ? + I82578_ADDR_REG : I82577_ADDR_REG; + data_reg = addr_reg + 1; + + /* All operations in this function are phy address 2 */ + hw->phy.addr = 2; + + /* masking with 0x3F to remove the page from offset */ + ret_val = e1000_write_phy_reg_mdic(hw, addr_reg, (u16)offset & 0x3F); + if (ret_val) { + DEBUGOUT("Could not write PHY the HV address register\n"); + goto out; + } + + /* Read or write the data value next */ + if (read) + ret_val = e1000_read_phy_reg_mdic(hw, data_reg, data); + else + ret_val = e1000_write_phy_reg_mdic(hw, data_reg, *data); + + if (ret_val) { + DEBUGOUT("Could not read data value from HV data register\n"); + goto out; + } + +out: + return ret_val; +} + +/** + * e1000_link_stall_workaround_hv - Si workaround + * @hw: pointer to the HW structure + * + * This function works around a Si bug where the link partner can get + * a link up indication before the PHY does. If small packets are sent + * by the link partner they can be placed in the packet buffer without + * being properly accounted for by the PHY and will stall preventing + * further packets from being received. The workaround is to clear the + * packet buffer after the PHY detects link up. + **/ +s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 data; + + DEBUGFUNC("e1000_link_stall_workaround_hv"); + + if (hw->phy.type != e1000_phy_82578) + goto out; + + /* Do not apply workaround if in PHY loopback bit 14 set */ + hw->phy.ops.read_reg(hw, PHY_CONTROL, &data); + if (data & PHY_CONTROL_LB) + goto out; + + /* check if link is up and at 1Gbps */ + ret_val = hw->phy.ops.read_reg(hw, BM_CS_STATUS, &data); + if (ret_val) + goto out; + + data &= BM_CS_STATUS_LINK_UP | + BM_CS_STATUS_RESOLVED | + BM_CS_STATUS_SPEED_MASK; + + if (data != (BM_CS_STATUS_LINK_UP | + BM_CS_STATUS_RESOLVED | + BM_CS_STATUS_SPEED_1000)) + goto out; + + msec_delay(200); + + /* flush the packets in the fifo buffer */ + ret_val = hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, + HV_MUX_DATA_CTRL_GEN_TO_MAC | + HV_MUX_DATA_CTRL_FORCE_SPEED); + if (ret_val) + goto out; + + ret_val = hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, + HV_MUX_DATA_CTRL_GEN_TO_MAC); + +out: + return ret_val; +} + +/** + * e1000_check_polarity_82577 - Checks the polarity. + * @hw: pointer to the HW structure + * + * Success returns 0, Failure returns -E1000_ERR_PHY (-2) + * + * Polarity is determined based on the PHY specific status register. + **/ +s32 e1000_check_polarity_82577(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 data; + + DEBUGFUNC("e1000_check_polarity_82577"); + + ret_val = phy->ops.read_reg(hw, I82577_PHY_STATUS_2, &data); + + if (!ret_val) + phy->cable_polarity = (data & I82577_PHY_STATUS2_REV_POLARITY) + ? e1000_rev_polarity_reversed + : e1000_rev_polarity_normal; + + return ret_val; +} + +/** + * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY + * @hw: pointer to the HW structure + * + * Calls the PHY setup function to force speed and duplex. + **/ +s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 phy_data; + bool link; + + DEBUGFUNC("e1000_phy_force_speed_duplex_82577"); + + ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); + if (ret_val) + goto out; + + e1000_phy_force_speed_duplex_setup(hw, &phy_data); + + ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); + if (ret_val) + goto out; + + usec_delay(1); + + if (phy->autoneg_wait_to_complete) { + DEBUGOUT("Waiting for forced speed/duplex link on 82577 phy\n"); + + ret_val = e1000_phy_has_link_generic(hw, + PHY_FORCE_LIMIT, + 100000, + &link); + if (ret_val) + goto out; + + if (!link) + DEBUGOUT("Link taking longer than expected.\n"); + + /* Try once more */ + ret_val = e1000_phy_has_link_generic(hw, + PHY_FORCE_LIMIT, + 100000, + &link); + if (ret_val) + goto out; + } + +out: + return ret_val; +} + +/** + * e1000_get_phy_info_82577 - Retrieve I82577 PHY information + * @hw: pointer to the HW structure + * + * Read PHY status to determine if link is up. If link is up, then + * set/determine 10base-T extended distance and polarity correction. Read + * PHY port status to determine MDI/MDIx and speed. Based on the speed, + * determine on the cable length, local and remote receiver. + **/ +s32 e1000_get_phy_info_82577(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 data; + bool link; + + DEBUGFUNC("e1000_get_phy_info_82577"); + + ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); + if (ret_val) + goto out; + + if (!link) { + DEBUGOUT("Phy info is only valid if link is up\n"); + ret_val = -E1000_ERR_CONFIG; + goto out; + } + + phy->polarity_correction = TRUE; + + ret_val = e1000_check_polarity_82577(hw); + if (ret_val) + goto out; + + ret_val = phy->ops.read_reg(hw, I82577_PHY_STATUS_2, &data); + if (ret_val) + goto out; + + phy->is_mdix = (data & I82577_PHY_STATUS2_MDIX) ? TRUE : FALSE; + + if ((data & I82577_PHY_STATUS2_SPEED_MASK) == + I82577_PHY_STATUS2_SPEED_1000MBPS) { + ret_val = hw->phy.ops.get_cable_length(hw); + if (ret_val) + goto out; + + ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data); + if (ret_val) + goto out; + + phy->local_rx = (data & SR_1000T_LOCAL_RX_STATUS) + ? e1000_1000t_rx_status_ok + : e1000_1000t_rx_status_not_ok; + + phy->remote_rx = (data & SR_1000T_REMOTE_RX_STATUS) + ? e1000_1000t_rx_status_ok + : e1000_1000t_rx_status_not_ok; + } else { + phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; + phy->local_rx = e1000_1000t_rx_status_undefined; + phy->remote_rx = e1000_1000t_rx_status_undefined; + } + +out: + return ret_val; +} + +/** + * e1000_get_cable_length_82577 - Determine cable length for 82577 PHY + * @hw: pointer to the HW structure + * + * Reads the diagnostic status register and verifies result is valid before + * placing it in the phy_cable_length field. + **/ +s32 e1000_get_cable_length_82577(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 phy_data, length; + + DEBUGFUNC("e1000_get_cable_length_82577"); + + ret_val = phy->ops.read_reg(hw, I82577_PHY_DIAG_STATUS, &phy_data); + if (ret_val) + goto out; + + length = (phy_data & I82577_DSTATUS_CABLE_LENGTH) >> + I82577_DSTATUS_CABLE_LENGTH_SHIFT; + + if (length == E1000_CABLE_LENGTH_UNDEFINED) + ret_val = -E1000_ERR_PHY; + + phy->cable_length = length; + +out: + return ret_val; +} diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.h index 06ef276f17..7a4b5a0eac 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_phy.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_phy.h,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_PHY_H_ #define _E1000_PHY_H_ @@ -43,46 +43,65 @@ s32 e1000_null_write_reg(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_check_downshift_generic(struct e1000_hw *hw); s32 e1000_check_polarity_m88(struct e1000_hw *hw); s32 e1000_check_polarity_igp(struct e1000_hw *hw); +s32 e1000_check_polarity_ife(struct e1000_hw *hw); s32 e1000_check_reset_block_generic(struct e1000_hw *hw); +s32 e1000_phy_setup_autoneg(struct e1000_hw *hw); s32 e1000_copper_link_autoneg(struct e1000_hw *hw); s32 e1000_copper_link_setup_igp(struct e1000_hw *hw); s32 e1000_copper_link_setup_m88(struct e1000_hw *hw); s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw); s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw); +s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw); s32 e1000_get_cable_length_m88(struct e1000_hw *hw); s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw); s32 e1000_get_cfg_done_generic(struct e1000_hw *hw); s32 e1000_get_phy_id(struct e1000_hw *hw); s32 e1000_get_phy_info_igp(struct e1000_hw *hw); s32 e1000_get_phy_info_m88(struct e1000_hw *hw); +s32 e1000_get_phy_info_ife(struct e1000_hw *hw); s32 e1000_phy_sw_reset_generic(struct e1000_hw *hw); void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw); s32 e1000_phy_reset_dsp_generic(struct e1000_hw *hw); -s32 e1000_phy_setup_autoneg(struct e1000_hw *hw); s32 e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_set_d3_lplu_state_generic(struct e1000_hw *hw, bool active); s32 e1000_setup_copper_link_generic(struct e1000_hw *hw); s32 e1000_wait_autoneg_generic(struct e1000_hw *hw); s32 e1000_write_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_phy_reset_dsp(struct e1000_hw *hw); s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, u32 usec_interval, bool *success); s32 e1000_phy_init_script_igp3(struct e1000_hw *hw); enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id); -s32 e1000_determine_phy_address(struct e1000_hw *hw); -s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data); -s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data); -s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data); -s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_determine_phy_address(struct e1000_hw *hw); +s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data); void e1000_power_up_phy_copper(struct e1000_hw *hw); void e1000_power_down_phy_copper(struct e1000_hw *hw); -s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data); -s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); +s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); +s32 e1000_check_polarity_82577(struct e1000_hw *hw); +s32 e1000_get_phy_info_82577(struct e1000_hw *hw); +s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw); +s32 e1000_get_cable_length_82577(struct e1000_hw *hw); #define E1000_MAX_PHY_ADDR 4 @@ -99,21 +118,76 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); #define IGP_PAGE_SHIFT 5 #define PHY_REG_MASK 0x1F +/* BM/HV Specific Registers */ +#define BM_PORT_CTRL_PAGE 769 +#define BM_PCIE_PAGE 770 #define BM_WUC_PAGE 800 #define BM_WUC_ADDRESS_OPCODE 0x11 #define BM_WUC_DATA_OPCODE 0x12 -#define BM_WUC_ENABLE_PAGE 769 +#define BM_WUC_ENABLE_PAGE BM_PORT_CTRL_PAGE #define BM_WUC_ENABLE_REG 17 #define BM_WUC_ENABLE_BIT (1 << 2) #define BM_WUC_HOST_WU_BIT (1 << 4) +#define PHY_UPPER_SHIFT 21 +#define BM_PHY_REG(page, reg) \ + (((reg) & MAX_PHY_REG_ADDRESS) |\ + (((page) & 0xFFFF) << PHY_PAGE_SHIFT) |\ + (((reg) & ~MAX_PHY_REG_ADDRESS) << (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT))) +#define BM_PHY_REG_PAGE(offset) \ + ((u16)(((offset) >> PHY_PAGE_SHIFT) & 0xFFFF)) +#define BM_PHY_REG_NUM(offset) \ + ((u16)(((offset) & MAX_PHY_REG_ADDRESS) |\ + (((offset) >> (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)) &\ + ~MAX_PHY_REG_ADDRESS))) + +#define HV_INTC_FC_PAGE_START 768 +#define I82578_ADDR_REG 29 +#define I82577_ADDR_REG 16 +#define I82577_CFG_REG 22 +#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15) +#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */ +#define I82577_CTRL_REG 23 + +/* 82577 specific PHY registers */ +#define I82577_PHY_CTRL_2 18 +#define I82577_PHY_LBK_CTRL 19 +#define I82577_PHY_STATUS_2 26 +#define I82577_PHY_DIAG_STATUS 31 + +/* I82577 PHY Status 2 */ +#define I82577_PHY_STATUS2_REV_POLARITY 0x0400 +#define I82577_PHY_STATUS2_MDIX 0x0800 +#define I82577_PHY_STATUS2_SPEED_MASK 0x0300 +#define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200 +#define I82577_PHY_STATUS2_SPEED_100MBPS 0x0100 + +/* I82577 PHY Control 2 */ +#define I82577_PHY_CTRL2_AUTO_MDIX 0x0400 +#define I82577_PHY_CTRL2_FORCE_MDI_MDIX 0x0200 + +/* I82577 PHY Diagnostics Status */ +#define I82577_DSTATUS_CABLE_LENGTH 0x03FC +#define I82577_DSTATUS_CABLE_LENGTH_SHIFT 2 + /* BM PHY Copper Specific Control 1 */ #define BM_CS_CTRL1 16 #define BM_CS_CTRL1_ENERGY_DETECT 0x0300 /* Enable Energy Detect */ -/* BM PHY Copper Specific States */ +/* BM PHY Copper Specific Status */ #define BM_CS_STATUS 17 #define BM_CS_STATUS_ENERGY_DETECT 0x0010 /* Energy Detect Status */ +#define BM_CS_STATUS_LINK_UP 0x0400 +#define BM_CS_STATUS_RESOLVED 0x0800 +#define BM_CS_STATUS_SPEED_MASK 0xC000 +#define BM_CS_STATUS_SPEED_1000 0x8000 + +/* 82577 Mobile Phy Status Register */ +#define HV_M_STATUS 26 +#define HV_M_STATUS_AUTONEG_COMPLETE 0x1000 +#define HV_M_STATUS_SPEED_MASK 0x0300 +#define HV_M_STATUS_SPEED_1000 0x0200 +#define HV_M_STATUS_LINK_UP 0x0040 #define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 #define IGP01E1000_PHY_POLARITY_MASK 0x0078 @@ -134,7 +208,7 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); #define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000 #define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002 -#define IGP01E1000_PSSR_MDIX 0x0008 +#define IGP01E1000_PSSR_MDIX 0x0800 #define IGP01E1000_PSSR_SPEED_MASK 0xC000 #define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000 @@ -156,8 +230,14 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); #define E1000_KMRNCTRLSTA_OFFSET 0x001F0000 #define E1000_KMRNCTRLSTA_OFFSET_SHIFT 16 #define E1000_KMRNCTRLSTA_REN 0x00200000 +#define E1000_KMRNCTRLSTA_CTRL_OFFSET 0x1 /* Kumeran Control */ #define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ +#define E1000_KMRNCTRLSTA_TIMEOUTS 0x4 /* Kumeran Timeouts */ +#define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9 /* Kumeran InBand Parameters */ #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ +#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 +#define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002 +#define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */ #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_regs.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_regs.h index 6a6fe40879..ccf2986ee8 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_regs.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_regs.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_regs.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/e1000_regs.h,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _E1000_REGS_H_ #define _E1000_REGS_H_ @@ -43,10 +43,17 @@ #define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ #define E1000_FLA 0x0001C /* Flash Access - RW */ #define E1000_MDIC 0x00020 /* MDI Control - RW */ +#define E1000_MDICNFG 0x00E04 /* MDI Config - RW */ +#define E1000_REGISTER_SET_SIZE 0x20000 /* CSR Size */ +#define E1000_EEPROM_INIT_CTRL_WORD_2 0x0F /* EEPROM Init Ctrl Word 2 */ +#define E1000_BARCTRL 0x5BBC /* BAR ctrl reg */ +#define E1000_BARCTRL_FLSIZE 0x0700 /* BAR ctrl Flsize */ +#define E1000_BARCTRL_CSRSIZE 0x2000 /* BAR ctrl CSR size */ #define E1000_SCTL 0x00024 /* SerDes Control - RW */ #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ #define E1000_FEXT 0x0002C /* Future Extended - RW */ +#define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ #define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ #define E1000_FCT 0x00030 /* Flow Control Type - RW */ #define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ @@ -58,10 +65,13 @@ #define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ #define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ #define E1000_IVAR 0x000E4 /* Interrupt Vector Allocation Register - RW */ +#define E1000_SVCR 0x000F0 +#define E1000_SVT 0x000F4 #define E1000_RCTL 0x00100 /* Rx Control - RW */ #define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ #define E1000_TXCW 0x00178 /* Tx Configuration Word - RW */ #define E1000_RXCW 0x00180 /* Rx Configuration Word - RO */ +#define E1000_PBA_ECC 0x01100 /* PBA ECC Register */ #define E1000_EICR 0x01580 /* Ext. Interrupt Cause Read - R/clr */ #define E1000_EITR(_n) (0x01680 + (0x4 * (_n))) #define E1000_EICS 0x01520 /* Ext. Interrupt Cause Set - W0 */ @@ -118,11 +128,7 @@ #define E1000_RDPUCTL 0x025DC /* DMA Rx Descriptor uC Control - RW */ #define E1000_PBDIAG 0x02458 /* Packet Buffer Diagnostic - RW */ #define E1000_RXPBS 0x02404 /* Rx Packet Buffer Size - RW */ -#define E1000_RXCTL(_n) (0x0C014 + (0x40 * (_n))) -#define E1000_RQDPC(_n) (0x0C030 + (0x40 * (_n))) -#define E1000_TXCTL(_n) (0x0E014 + (0x40 * (_n))) -#define E1000_RXCTL(_n) (0x0C014 + (0x40 * (_n))) -#define E1000_RQDPC(_n) (0x0C030 + (0x40 * (_n))) +#define E1000_IRPBS 0x02404 /* Same as RXPBS, renamed for newer adapters - RW */ #define E1000_RDTR 0x02820 /* Rx Delay Timer - RW */ #define E1000_RADV 0x0282C /* Rx Interrupt Absolute Delay Timer - RW */ /* @@ -143,10 +149,15 @@ (0x0C00C + ((_n) * 0x40))) #define E1000_RDH(_n) ((_n) < 4 ? (0x02810 + ((_n) * 0x100)) : \ (0x0C010 + ((_n) * 0x40))) +#define E1000_RXCTL(_n) ((_n) < 4 ? (0x02814 + ((_n) * 0x100)) : \ + (0x0C014 + ((_n) * 0x40))) +#define E1000_DCA_RXCTRL(_n) E1000_RXCTL(_n) #define E1000_RDT(_n) ((_n) < 4 ? (0x02818 + ((_n) * 0x100)) : \ (0x0C018 + ((_n) * 0x40))) #define E1000_RXDCTL(_n) ((_n) < 4 ? (0x02828 + ((_n) * 0x100)) : \ (0x0C028 + ((_n) * 0x40))) +#define E1000_RQDPC(_n) ((_n) < 4 ? (0x02830 + ((_n) * 0x100)) : \ + (0x0C030 + ((_n) * 0x40))) #define E1000_TDBAL(_n) ((_n) < 4 ? (0x03800 + ((_n) * 0x100)) : \ (0x0E000 + ((_n) * 0x40))) #define E1000_TDBAH(_n) ((_n) < 4 ? (0x03804 + ((_n) * 0x100)) : \ @@ -155,17 +166,18 @@ (0x0E008 + ((_n) * 0x40))) #define E1000_TDH(_n) ((_n) < 4 ? (0x03810 + ((_n) * 0x100)) : \ (0x0E010 + ((_n) * 0x40))) +#define E1000_TXCTL(_n) ((_n) < 4 ? (0x03814 + ((_n) * 0x100)) : \ + (0x0E014 + ((_n) * 0x40))) +#define E1000_DCA_TXCTRL(_n) E1000_TXCTL(_n) #define E1000_TDT(_n) ((_n) < 4 ? (0x03818 + ((_n) * 0x100)) : \ (0x0E018 + ((_n) * 0x40))) #define E1000_TXDCTL(_n) ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) : \ (0x0E028 + ((_n) * 0x40))) -#define E1000_TARC(_n) (0x03840 + (_n << 8)) -#define E1000_DCA_TXCTRL(_n) (0x03814 + (_n << 8)) -#define E1000_DCA_RXCTRL(_n) (0x02814 + (_n << 8)) #define E1000_TDWBAL(_n) ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) : \ (0x0E038 + ((_n) * 0x40))) #define E1000_TDWBAH(_n) ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) : \ (0x0E03C + ((_n) * 0x40))) +#define E1000_TARC(_n) (0x03840 + ((_n) * 0x100)) #define E1000_RSRPD 0x02C00 /* Rx Small Packet Detect - RW */ #define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */ #define E1000_TXDMAC 0x03000 /* Tx DMA Control - RW */ @@ -175,6 +187,8 @@ (0x054E0 + ((_i - 16) * 8))) #define E1000_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \ (0x054E4 + ((_i - 16) * 8))) +#define E1000_SHRAL(_i) (0x05438 + ((_i) * 8)) +#define E1000_SHRAH(_i) (0x0543C + ((_i) * 8)) #define E1000_IP4AT_REG(_i) (0x05840 + ((_i) * 8)) #define E1000_IP6AT_REG(_i) (0x05880 + ((_i) * 4)) #define E1000_WUPM_REG(_i) (0x05A00 + ((_i) * 4)) @@ -184,6 +198,7 @@ #define E1000_PBSLAC 0x03100 /* Packet Buffer Slave Access Control */ #define E1000_PBSLAD(_n) (0x03110 + (0x4 * (_n))) /* Packet Buffer DWORD (_n) */ #define E1000_TXPBS 0x03404 /* Tx Packet Buffer Size - RW */ +#define E1000_ITPBS 0x03404 /* Same as TXPBS, renamed for newer adpaters - RW */ #define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */ #define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */ #define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */ @@ -268,6 +283,7 @@ #define E1000_ICTXQMTC 0x0411C /* Interrupt Cause Tx Queue Min Thresh Count */ #define E1000_ICRXDMTC 0x04120 /* Interrupt Cause Rx Desc Min Thresh Count */ #define E1000_ICRXOC 0x04124 /* Interrupt Cause Receiver Overrun Count */ +#define E1000_CRC_OFFSET 0x05F50 /* CRC Offset register */ #define E1000_VFGPRC 0x00F10 #define E1000_VFGORC 0x00F18 @@ -278,6 +294,17 @@ #define E1000_VFGPTLBC 0x00F44 #define E1000_VFGORLBC 0x00F48 #define E1000_VFGPRLBC 0x00F40 +/* Virtualization statistical counters */ +#define E1000_PFVFGPRC(_n) (0x010010 + (0x100 * (_n))) +#define E1000_PFVFGPTC(_n) (0x010014 + (0x100 * (_n))) +#define E1000_PFVFGORC(_n) (0x010018 + (0x100 * (_n))) +#define E1000_PFVFGOTC(_n) (0x010034 + (0x100 * (_n))) +#define E1000_PFVFMPRC(_n) (0x010038 + (0x100 * (_n))) +#define E1000_PFVFGPRLBC(_n) (0x010040 + (0x100 * (_n))) +#define E1000_PFVFGPTLBC(_n) (0x010044 + (0x100 * (_n))) +#define E1000_PFVFGORLBC(_n) (0x010048 + (0x100 * (_n))) +#define E1000_PFVFGOTLBC(_n) (0x010050 + (0x100 * (_n))) + #define E1000_LSECTXUT 0x04300 /* LinkSec Tx Untagged Packet Count - OutPktsUntagged */ #define E1000_LSECTXPKTE 0x04304 /* LinkSec Encrypted Tx Packets Count - OutPktsEncrypted */ #define E1000_LSECTXPKTP 0x04308 /* LinkSec Protected Tx Packet Count - OutPktsProtected */ @@ -382,11 +409,13 @@ #define E1000_KMRNCTRLSTA 0x00034 /* MAC-PHY interface - RW */ #define E1000_MDPHYA 0x0003C /* PHY address - RW */ #define E1000_MANC2H 0x05860 /* Management Control To Host - RW */ +#define E1000_MDEF(_n) (0x05890 + (4 * (_n))) /* Mngmt Decision Filters */ #define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */ #define E1000_CCMCTL 0x05B48 /* CCM Control Register */ #define E1000_GIOCTL 0x05B44 /* GIO Analog Control Register */ #define E1000_SCCTL 0x05B4C /* PCIc PLL Configuration Register */ #define E1000_GCR 0x05B00 /* PCI-Ex Control */ +#define E1000_GCR2 0x05B64 /* PCI-Ex Control #2 */ #define E1000_GSCL_1 0x05B10 /* PCI-Ex Statistic Control #1 */ #define E1000_GSCL_2 0x05B14 /* PCI-Ex Statistic Control #2 */ #define E1000_GSCL_3 0x05B18 /* PCI-Ex Statistic Control #3 */ @@ -394,8 +423,10 @@ #define E1000_FACTPS 0x05B30 /* Function Active and Power State to MNG */ #define E1000_SWSM 0x05B50 /* SW Semaphore */ #define E1000_FWSM 0x05B54 /* FW Semaphore */ +#define E1000_SWSM2 0x05B58 /* Driver-only SW semaphore (not used by BOOT agents) */ #define E1000_DCA_ID 0x05B70 /* DCA Requester ID Information - RO */ #define E1000_DCA_CTRL 0x05B74 /* DCA Control - RW */ +#define E1000_UFUSE 0x05B78 /* UFUSE - RO */ #define E1000_FFLT_DBG 0x05F04 /* Debug Register */ #define E1000_HICR 0x08F00 /* Host Interface Control */ @@ -429,7 +460,7 @@ #define E1000_VFTE 0x00C90 /* VF Transmit Enables */ #define E1000_QDE 0x02408 /* Queue Drop Enable - RW */ #define E1000_DTXSWC 0x03500 /* DMA Tx Switch Control - RW */ -#define E1000_VLVF 0x05D00 /* VLAN Virtual Machine Filter - RW */ +#define E1000_WVBR 0x03554 /* VM Wrong Behavior - RWS */ #define E1000_RPLOLR 0x05AF0 /* Replication Offload - RW */ #define E1000_UTA 0x0A000 /* Unicast Table Array - RW */ #define E1000_IOVTCL 0x05BBC /* IOV Control Register */ @@ -440,6 +471,9 @@ #define E1000_VMBMEM(_n) (0x00800 + (64 * (_n))) #define E1000_VFVMBMEM(_n) (0x00800 + (_n)) #define E1000_VMOLR(_n) (0x05AD0 + (4 * (_n))) +#define E1000_VLVF(_n) (0x05D00 + (4 * (_n))) /* VLAN Virtual Machine + * Filter - RW */ +#define E1000_VMVIR(_n) (0x03700 + (4 * (_n))) /* Time Sync */ #define E1000_TSYNCRXCTL 0x0B620 /* Rx Time Sync Control register - RW */ #define E1000_TSYNCTXCTL 0x0B614 /* Tx Time Sync Control register - RW */ @@ -453,6 +487,8 @@ #define E1000_SYSTIML 0x0B600 /* System time register Low - RO */ #define E1000_SYSTIMH 0x0B604 /* System time register High - RO */ #define E1000_TIMINCA 0x0B608 /* Increment attributes register - RW */ +#define E1000_TSAUXC 0x0B640 /* Timesync Auxiliary Control register */ +#define E1000_SYSTIMR 0x0B6F8 /* System time register Residue */ #define E1000_RXMTRL 0x0B634 /* Time sync Rx EtherType and Msg Type - RW */ #define E1000_RXUDP 0x0B638 /* Time Sync Rx UDP Port - RW */ @@ -461,6 +497,7 @@ #define E1000_DAQF(_n) (0x059A0 + (4 * (_n))) /* Dest Address Queue Fltr */ #define E1000_SPQF(_n) (0x059C0 + (4 * (_n))) /* Source Port Queue Fltr */ #define E1000_FTQF(_n) (0x059E0 + (4 * (_n))) /* 5-tuple Queue Fltr */ +#define E1000_TTQF(_n) (0x059E0 + (4 * (_n))) /* 2-tuple Queue Fltr */ #define E1000_SYNQF(_n) (0x055FC + (4 * (_n))) /* SYN Packet Queue Fltr */ #define E1000_ETQF(_n) (0x05CB0 + (4 * (_n))) /* EType Queue Fltr */ @@ -495,4 +532,17 @@ #define E1000_RTTBCNACH 0x0B214 /* Tx BCN Control High */ #define E1000_RTTBCNACL 0x0B210 /* Tx BCN Control Low */ +/* DMA Coalescing registers */ +#define E1000_DMACR 0x02508 /* Control Register */ +#define E1000_DMCTXTH 0x03550 /* Transmit Threshold */ +#define E1000_DMCTLX 0x02514 /* Time to Lx Request */ +#define E1000_DMCRTRH 0x05DD0 /* Receive Packet Rate Threshold */ +#define E1000_DMCCNT 0x05DD4 /* Current RX Count */ +#define E1000_FCRTC 0x02170 /* Flow Control Rx high watermark */ +#define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */ + +/* PCIe Parity Status Register */ +#define E1000_PCIEERRSTS 0x05BA8 + + #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.c new file mode 100644 index 0000000000..8601099c87 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.c @@ -0,0 +1,574 @@ +/****************************************************************************** + + Copyright (c) 2001-2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD: src/sys/dev/e1000/e1000_vf.c,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ + + +#include "e1000_api.h" + + +static s32 e1000_init_phy_params_vf(struct e1000_hw *hw); +static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw); +static void e1000_release_vf(struct e1000_hw *hw); +static s32 e1000_acquire_vf(struct e1000_hw *hw); +static s32 e1000_setup_link_vf(struct e1000_hw *hw); +static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw); +static s32 e1000_init_mac_params_vf(struct e1000_hw *hw); +static s32 e1000_check_for_link_vf(struct e1000_hw *hw); +static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, + u16 *duplex); +static s32 e1000_init_hw_vf(struct e1000_hw *hw); +static s32 e1000_reset_hw_vf(struct e1000_hw *hw); +static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, u32); +static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32); +static s32 e1000_read_mac_addr_vf(struct e1000_hw *); + +/** + * e1000_init_phy_params_vf - Inits PHY params + * @hw: pointer to the HW structure + * + * Doesn't do much - there's no PHY available to the VF. + **/ +static s32 e1000_init_phy_params_vf(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_init_phy_params_vf"); + hw->phy.type = e1000_phy_vf; + hw->phy.ops.acquire = e1000_acquire_vf; + hw->phy.ops.release = e1000_release_vf; + + return E1000_SUCCESS; +} + +/** + * e1000_init_nvm_params_vf - Inits NVM params + * @hw: pointer to the HW structure + * + * Doesn't do much - there's no NVM available to the VF. + **/ +static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_init_nvm_params_vf"); + hw->nvm.type = e1000_nvm_none; + hw->nvm.ops.acquire = e1000_acquire_vf; + hw->nvm.ops.release = e1000_release_vf; + + return E1000_SUCCESS; +} + +/** + * e1000_init_mac_params_vf - Inits MAC params + * @hw: pointer to the HW structure + **/ +static s32 e1000_init_mac_params_vf(struct e1000_hw *hw) +{ + struct e1000_mac_info *mac = &hw->mac; + + DEBUGFUNC("e1000_init_mac_params_vf"); + + /* Set media type */ + /* + * Virtual functions don't care what they're media type is as they + * have no direct access to the PHY, or the media. That is handled + * by the physical function driver. + */ + hw->phy.media_type = e1000_media_type_unknown; + + /* No ASF features for the VF driver */ + mac->asf_firmware_present = FALSE; + /* ARC subsystem not supported */ + mac->arc_subsystem_valid = FALSE; + /* Disable adaptive IFS mode so the generic funcs don't do anything */ + mac->adaptive_ifs = FALSE; + /* VF's have no MTA Registers - PF feature only */ + mac->mta_reg_count = 128; + /* VF's have no access to RAR entries */ + mac->rar_entry_count = 1; + + /* Function pointers */ + /* link setup */ + mac->ops.setup_link = e1000_setup_link_vf; + /* bus type/speed/width */ + mac->ops.get_bus_info = e1000_get_bus_info_pcie_vf; + /* reset */ + mac->ops.reset_hw = e1000_reset_hw_vf; + /* hw initialization */ + mac->ops.init_hw = e1000_init_hw_vf; + /* check for link */ + mac->ops.check_for_link = e1000_check_for_link_vf; + /* link info */ + mac->ops.get_link_up_info = e1000_get_link_up_info_vf; + /* multicast address update */ + mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_vf; + /* set mac address */ + mac->ops.rar_set = e1000_rar_set_vf; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_vf; + + + return E1000_SUCCESS; +} + +/** + * e1000_init_function_pointers_vf - Inits function pointers + * @hw: pointer to the HW structure + **/ +void e1000_init_function_pointers_vf(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_init_function_pointers_vf"); + + hw->mac.ops.init_params = e1000_init_mac_params_vf; + hw->nvm.ops.init_params = e1000_init_nvm_params_vf; + hw->phy.ops.init_params = e1000_init_phy_params_vf; + hw->mbx.ops.init_params = e1000_init_mbx_params_vf; +} + +/** + * e1000_acquire_vf - Acquire rights to access PHY or NVM. + * @hw: pointer to the HW structure + * + * There is no PHY or NVM so we want all attempts to acquire these to fail. + * In addition, the MAC registers to access PHY/NVM don't exist so we don't + * even want any SW to attempt to use them. + **/ +static s32 e1000_acquire_vf(struct e1000_hw *hw) +{ + return -E1000_ERR_PHY; +} + +/** + * e1000_release_vf - Release PHY or NVM + * @hw: pointer to the HW structure + * + * There is no PHY or NVM so we want all attempts to acquire these to fail. + * In addition, the MAC registers to access PHY/NVM don't exist so we don't + * even want any SW to attempt to use them. + **/ +static void e1000_release_vf(struct e1000_hw *hw) +{ + return; +} + +/** + * e1000_setup_link_vf - Sets up link. + * @hw: pointer to the HW structure + * + * Virtual functions cannot change link. + **/ +static s32 e1000_setup_link_vf(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_setup_link_vf"); + + return E1000_SUCCESS; +} + +/** + * e1000_get_bus_info_pcie_vf - Gets the bus info. + * @hw: pointer to the HW structure + * + * Virtual functions are not really on their own bus. + **/ +static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw) +{ + struct e1000_bus_info *bus = &hw->bus; + + DEBUGFUNC("e1000_get_bus_info_pcie_vf"); + + /* Do not set type PCI-E because we don't want disable master to run */ + bus->type = e1000_bus_type_reserved; + bus->speed = e1000_bus_speed_2500; + + return 0; +} + +/** + * e1000_get_link_up_info_vf - Gets link info. + * @hw: pointer to the HW structure + * @speed: pointer to 16 bit value to store link speed. + * @duplex: pointer to 16 bit value to store duplex. + * + * Since we cannot read the PHY and get accurate link info, we must rely upon + * the status register's data which is often stale and inaccurate. + **/ +static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, + u16 *duplex) +{ + s32 status; + + DEBUGFUNC("e1000_get_link_up_info_vf"); + + status = E1000_READ_REG(hw, E1000_STATUS); + if (status & E1000_STATUS_SPEED_1000) { + *speed = SPEED_1000; + DEBUGOUT("1000 Mbs, "); + } else if (status & E1000_STATUS_SPEED_100) { + *speed = SPEED_100; + DEBUGOUT("100 Mbs, "); + } else { + *speed = SPEED_10; + DEBUGOUT("10 Mbs, "); + } + + if (status & E1000_STATUS_FD) { + *duplex = FULL_DUPLEX; + DEBUGOUT("Full Duplex\n"); + } else { + *duplex = HALF_DUPLEX; + DEBUGOUT("Half Duplex\n"); + } + + return E1000_SUCCESS; +} + +/** + * e1000_reset_hw_vf - Resets the HW + * @hw: pointer to the HW structure + * + * VF's provide a function level reset. This is done using bit 26 of ctrl_reg. + * This is all the reset we can perform on a VF. + **/ +static s32 e1000_reset_hw_vf(struct e1000_hw *hw) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + u32 timeout = E1000_VF_INIT_TIMEOUT; + s32 ret_val = -E1000_ERR_MAC_INIT; + u32 ctrl, msgbuf[3]; + u8 *addr = (u8 *)(&msgbuf[1]); + + DEBUGFUNC("e1000_reset_hw_vf"); + + DEBUGOUT("Issuing a function level reset to MAC\n"); + ctrl = E1000_READ_REG(hw, E1000_CTRL); + E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); + + /* we cannot reset while the RSTI / RSTD bits are asserted */ + while (!mbx->ops.check_for_rst(hw, 0) && timeout) { + timeout--; + usec_delay(5); + } + + if (timeout) { + /* mailbox timeout can now become active */ + mbx->timeout = E1000_VF_MBX_INIT_TIMEOUT; + + msgbuf[0] = E1000_VF_RESET; + mbx->ops.write_posted(hw, msgbuf, 1, 0); + + msec_delay(10); + + /* set our "perm_addr" based on info provided by PF */ + ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0); + if (!ret_val) { + if (msgbuf[0] == (E1000_VF_RESET | + E1000_VT_MSGTYPE_ACK)) + memcpy(hw->mac.perm_addr, addr, 6); + else + ret_val = -E1000_ERR_MAC_INIT; + } + } + + return ret_val; +} + +/** + * e1000_init_hw_vf - Inits the HW + * @hw: pointer to the HW structure + * + * Not much to do here except clear the PF Reset indication if there is one. + **/ +static s32 e1000_init_hw_vf(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_init_hw_vf"); + + /* attempt to set and restore our mac address */ + e1000_rar_set_vf(hw, hw->mac.addr, 0); + + return E1000_SUCCESS; +} + +/** + * e1000_rar_set_vf - set device MAC address + * @hw: pointer to the HW structure + * @addr: pointer to the receive address + * @index receive address array register + **/ +static void e1000_rar_set_vf(struct e1000_hw *hw, u8 * addr, u32 index) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + u32 msgbuf[3]; + u8 *msg_addr = (u8 *)(&msgbuf[1]); + s32 ret_val; + + memset(msgbuf, 0, 12); + msgbuf[0] = E1000_VF_SET_MAC_ADDR; + memcpy(msg_addr, addr, 6); + ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0); + + if (!ret_val) + ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0); + + msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS; + + /* if nacked the address was rejected, use "perm_addr" */ + if (!ret_val && + (msgbuf[0] == (E1000_VF_SET_MAC_ADDR | E1000_VT_MSGTYPE_NACK))) + e1000_read_mac_addr_vf(hw); +} + +/** + * e1000_hash_mc_addr_vf - Generate a multicast hash value + * @hw: pointer to the HW structure + * @mc_addr: pointer to a multicast address + * + * Generates a multicast address hash value which is used to determine + * the multicast filter table array address and new table value. + **/ +static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr) +{ + u32 hash_value, hash_mask; + u8 bit_shift = 0; + + DEBUGFUNC("e1000_hash_mc_addr_generic"); + + /* Register count multiplied by bits per register */ + hash_mask = (hw->mac.mta_reg_count * 32) - 1; + + /* + * The bit_shift is the number of left-shifts + * where 0xFF would still fall within the hash mask. + */ + while (hash_mask >> bit_shift != 0xFF) + bit_shift++; + + hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | + (((u16) mc_addr[5]) << bit_shift))); + + return hash_value; +} + +/** + * e1000_update_mc_addr_list_vf - Update Multicast addresses + * @hw: pointer to the HW structure + * @mc_addr_list: array of multicast addresses to program + * @mc_addr_count: number of multicast addresses to program + * + * Updates the Multicast Table Array. + * The caller must have a packed mc_addr_list of multicast addresses. + **/ +void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, + u8 *mc_addr_list, u32 mc_addr_count) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + u32 msgbuf[E1000_VFMAILBOX_SIZE]; + u16 *hash_list = (u16 *)&msgbuf[1]; + u32 hash_value; + u32 i; + + DEBUGFUNC("e1000_update_mc_addr_list_vf"); + + /* Each entry in the list uses 1 16 bit word. We have 30 + * 16 bit words available in our HW msg buffer (minus 1 for the + * msg type). That's 30 hash values if we pack 'em right. If + * there are more than 30 MC addresses to add then punt the + * extras for now and then add code to handle more than 30 later. + * It would be unusual for a server to request that many multi-cast + * addresses except for in large enterprise network environments. + */ + + DEBUGOUT1("MC Addr Count = %d\n", mc_addr_count); + + if (mc_addr_count > 30) { + msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW; + mc_addr_count = 30; + } + + msgbuf[0] = E1000_VF_SET_MULTICAST; + msgbuf[0] |= mc_addr_count << E1000_VT_MSGINFO_SHIFT; + + for (i = 0; i < mc_addr_count; i++) { + hash_value = e1000_hash_mc_addr_vf(hw, mc_addr_list); + DEBUGOUT1("Hash value = 0x%03X\n", hash_value); + hash_list[i] = hash_value & 0x0FFF; + mc_addr_list += ETH_ADDR_LEN; + } + + mbx->ops.write_posted(hw, msgbuf, E1000_VFMAILBOX_SIZE, 0); +} + +/** + * e1000_vfta_set_vf - Set/Unset vlan filter table address + * @hw: pointer to the HW structure + * @vid: determines the vfta register and bit to set/unset + * @set: if TRUE then set bit, else clear bit + **/ +void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + u32 msgbuf[2]; + + msgbuf[0] = E1000_VF_SET_VLAN; + msgbuf[1] = vid; + /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */ + if (set) + msgbuf[0] |= E1000_VF_SET_VLAN_ADD; + + mbx->ops.write_posted(hw, msgbuf, 2, 0); +} + +/** e1000_rlpml_set_vf - Set the maximum receive packet length + * @hw: pointer to the HW structure + * @max_size: value to assign to max frame size + **/ +void e1000_rlpml_set_vf(struct e1000_hw *hw, u16 max_size) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + u32 msgbuf[2]; + + msgbuf[0] = E1000_VF_SET_LPE; + msgbuf[1] = max_size; + + mbx->ops.write_posted(hw, msgbuf, 2, 0); +} + +/** + * e1000_promisc_set_vf - Set flags for Unicast or Multicast promisc + * @hw: pointer to the HW structure + * @uni: boolean indicating unicast promisc status + * @multi: boolean indicating multicast promisc status + **/ +s32 e1000_promisc_set_vf(struct e1000_hw *hw, enum e1000_promisc_type type) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + u32 msgbuf = E1000_VF_SET_PROMISC; + s32 ret_val; + + switch (type) { + case e1000_promisc_multicast: + msgbuf |= E1000_VF_SET_PROMISC_MULTICAST; + break; + case e1000_promisc_enabled: + msgbuf |= E1000_VF_SET_PROMISC_MULTICAST; + case e1000_promisc_unicast: + msgbuf |= E1000_VF_SET_PROMISC_UNICAST; + case e1000_promisc_disabled: + break; + default: + return -E1000_ERR_MAC_INIT; + } + + ret_val = mbx->ops.write_posted(hw, &msgbuf, 1, 0); + + if (!ret_val) + ret_val = mbx->ops.read_posted(hw, &msgbuf, 1, 0); + + if (!ret_val && !(msgbuf & E1000_VT_MSGTYPE_ACK)) + ret_val = -E1000_ERR_MAC_INIT; + + return ret_val; +} + +/** + * e1000_read_mac_addr_vf - Read device MAC address + * @hw: pointer to the HW structure + **/ +static s32 e1000_read_mac_addr_vf(struct e1000_hw *hw) +{ + int i; + + for (i = 0; i < ETH_ADDR_LEN; i++) + hw->mac.addr[i] = hw->mac.perm_addr[i]; + + return E1000_SUCCESS; +} + +/** + * e1000_check_for_link_vf - Check for link for a virtual interface + * @hw: pointer to the HW structure + * + * Checks to see if the underlying PF is still talking to the VF and + * if it is then it reports the link state to the hardware, otherwise + * it reports link down and returns an error. + **/ +static s32 e1000_check_for_link_vf(struct e1000_hw *hw) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + struct e1000_mac_info *mac = &hw->mac; + s32 ret_val = E1000_SUCCESS; + u32 in_msg = 0; + + DEBUGFUNC("e1000_check_for_link_vf"); + + /* + * We only want to run this if there has been a rst asserted. + * in this case that could mean a link change, device reset, + * or a virtual function reset + */ + + /* If we were hit with a reset drop the link */ + if (!mbx->ops.check_for_rst(hw, 0)) + mac->get_link_status = TRUE; + + if (!mac->get_link_status) + goto out; + + /* if link status is down no point in checking to see if pf is up */ + if (!(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) + goto out; + + /* if the read failed it could just be a mailbox collision, best wait + * until we are called again and don't report an error */ + if (mbx->ops.read(hw, &in_msg, 1, 0)) + goto out; + + /* if incoming message isn't clear to send we are waiting on response */ + if (!(in_msg & E1000_VT_MSGTYPE_CTS)) { + /* message is not CTS and is NACK we have lost CTS status */ + if (in_msg & E1000_VT_MSGTYPE_NACK) + ret_val = -E1000_ERR_MAC_INIT; + goto out; + } + + /* at this point we know the PF is talking to us, check and see if + * we are still accepting timeout or if we had a timeout failure. + * if we failed then we will need to reinit */ + if (!mbx->timeout) { + ret_val = -E1000_ERR_MAC_INIT; + goto out; + } + + /* if we passed all the tests above then the link is up and we no + * longer need to check for link */ + mac->get_link_status = FALSE; + +out: + return ret_val; +} + diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.h new file mode 100644 index 0000000000..4d8ba57c6d --- /dev/null +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.h @@ -0,0 +1,291 @@ +/****************************************************************************** + + Copyright (c) 2001-2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD: src/sys/dev/e1000/e1000_vf.h,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ + +#ifndef _E1000_VF_H_ +#define _E1000_VF_H_ + +#include "e1000_osdep.h" +#include "e1000_regs.h" +#include "e1000_defines.h" + +struct e1000_hw; + +#define E1000_DEV_ID_82576_VF 0x10CA + +#define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */ + +/* Additional Descriptor Control definitions */ +#define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */ +#define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Rx Queue */ + +/* SRRCTL bit definitions */ +#define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ +#define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00 +#define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */ +#define E1000_SRRCTL_DESCTYPE_LEGACY 0x00000000 +#define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000 +#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000 +#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000 +#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION 0x06000000 +#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000 +#define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000 +#define E1000_SRRCTL_DROP_EN 0x80000000 + +#define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F +#define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00 + +/* Interrupt Defines */ +#define E1000_EICR 0x01580 /* Ext. Interrupt Cause Read - R/clr */ +#define E1000_EITR(_n) (0x01680 + ((_n) << 2)) +#define E1000_EICS 0x01520 /* Ext. Interrupt Cause Set - W0 */ +#define E1000_EIMS 0x01524 /* Ext. Interrupt Mask Set/Read - RW */ +#define E1000_EIMC 0x01528 /* Ext. Interrupt Mask Clear - WO */ +#define E1000_EIAC 0x0152C /* Ext. Interrupt Auto Clear - RW */ +#define E1000_EIAM 0x01530 /* Ext. Interrupt Ack Auto Clear Mask - RW */ +#define E1000_IVAR0 0x01700 /* Interrupt Vector Allocation (array) - RW */ +#define E1000_IVAR_MISC 0x01740 /* IVAR for "other" causes - RW */ +#define E1000_IVAR_VALID 0x80 + +/* Receive Descriptor - Advanced */ +union e1000_adv_rx_desc { + struct { + u64 pkt_addr; /* Packet buffer address */ + u64 hdr_addr; /* Header buffer address */ + } read; + struct { + struct { + union { + u32 data; + struct { + u16 pkt_info; /* RSS type, Packet type */ + u16 hdr_info; /* Split Header, + * header buffer length */ + } hs_rss; + } lo_dword; + union { + u32 rss; /* RSS Hash */ + struct { + u16 ip_id; /* IP id */ + u16 csum; /* Packet Checksum */ + } csum_ip; + } hi_dword; + } lower; + struct { + u32 status_error; /* ext status/error */ + u16 length; /* Packet length */ + u16 vlan; /* VLAN tag */ + } upper; + } wb; /* writeback */ +}; + +#define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0 +#define E1000_RXDADV_HDRBUFLEN_SHIFT 5 + +/* Transmit Descriptor - Advanced */ +union e1000_adv_tx_desc { + struct { + u64 buffer_addr; /* Address of descriptor's data buf */ + u32 cmd_type_len; + u32 olinfo_status; + } read; + struct { + u64 rsvd; /* Reserved */ + u32 nxtseq_seed; + u32 status; + } wb; +}; + +/* Adv Transmit Descriptor Config Masks */ +#define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ +#define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ +#define E1000_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */ +#define E1000_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ +#define E1000_ADVTXD_DCMD_RS 0x08000000 /* Report Status */ +#define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */ +#define E1000_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */ +#define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */ +#define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ + +/* Context descriptors */ +struct e1000_adv_tx_context_desc { + u32 vlan_macip_lens; + u32 seqnum_seed; + u32 type_tucmd_mlhl; + u32 mss_l4len_idx; +}; + +#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ +#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ +#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ +#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ +#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ + +enum e1000_mac_type { + e1000_undefined = 0, + e1000_vfadapt, + e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */ +}; + +struct e1000_vf_stats { + u64 base_gprc; + u64 base_gptc; + u64 base_gorc; + u64 base_gotc; + u64 base_mprc; + u64 base_gotlbc; + u64 base_gptlbc; + u64 base_gorlbc; + u64 base_gprlbc; + + u32 last_gprc; + u32 last_gptc; + u32 last_gorc; + u32 last_gotc; + u32 last_mprc; + u32 last_gotlbc; + u32 last_gptlbc; + u32 last_gorlbc; + u32 last_gprlbc; + + u64 gprc; + u64 gptc; + u64 gorc; + u64 gotc; + u64 mprc; + u64 gotlbc; + u64 gptlbc; + u64 gorlbc; + u64 gprlbc; +}; + +#include "e1000_mbx.h" + +struct e1000_mac_operations { + /* Function pointers for the MAC. */ + s32 (*init_params)(struct e1000_hw *); + s32 (*check_for_link)(struct e1000_hw *); + void (*clear_vfta)(struct e1000_hw *); + s32 (*get_bus_info)(struct e1000_hw *); + s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); + void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32); + s32 (*reset_hw)(struct e1000_hw *); + s32 (*init_hw)(struct e1000_hw *); + s32 (*setup_link)(struct e1000_hw *); + void (*write_vfta)(struct e1000_hw *, u32, u32); + void (*rar_set)(struct e1000_hw *, u8*, u32); + s32 (*read_mac_addr)(struct e1000_hw *); +}; + +struct e1000_mac_info { + struct e1000_mac_operations ops; + u8 addr[6]; + u8 perm_addr[6]; + + enum e1000_mac_type type; + + u16 mta_reg_count; + u16 rar_entry_count; + + bool get_link_status; +}; + +struct e1000_mbx_operations { + s32 (*init_params)(struct e1000_hw *hw); + s32 (*read)(struct e1000_hw *, u32 *, u16, u16); + s32 (*write)(struct e1000_hw *, u32 *, u16, u16); + s32 (*read_posted)(struct e1000_hw *, u32 *, u16, u16); + s32 (*write_posted)(struct e1000_hw *, u32 *, u16, u16); + s32 (*check_for_msg)(struct e1000_hw *, u16); + s32 (*check_for_ack)(struct e1000_hw *, u16); + s32 (*check_for_rst)(struct e1000_hw *, u16); +}; + +struct e1000_mbx_stats { + u32 msgs_tx; + u32 msgs_rx; + + u32 acks; + u32 reqs; + u32 rsts; +}; + +struct e1000_mbx_info { + struct e1000_mbx_operations ops; + struct e1000_mbx_stats stats; + u32 timeout; + u32 usec_delay; + u16 size; +}; + +struct e1000_dev_spec_vf { + u32 vf_number; + u32 v2p_mailbox; +}; + +struct e1000_hw { + void *back; + + u8 *hw_addr; + u8 *flash_address; + unsigned long io_base; + + struct e1000_mac_info mac; + struct e1000_mbx_info mbx; + + union { + struct e1000_dev_spec_vf vf; + } dev_spec; + + u16 device_id; + u16 subsystem_vendor_id; + u16 subsystem_device_id; + u16 vendor_id; + + u8 revision_id; +}; + +enum e1000_promisc_type { + e1000_promisc_disabled = 0, /* all promisc modes disabled */ + e1000_promisc_unicast = 1, /* unicast promiscuous enabled */ + e1000_promisc_multicast = 2, /* multicast promiscuous enabled */ + e1000_promisc_enabled = 3, /* both uni and multicast promisc */ + e1000_num_promisc_types +}; + +/* These functions must be implemented by drivers */ +s32 e1000_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); +void e1000_vfta_set_vf(struct e1000_hw *, u16, bool); +void e1000_rlpml_set_vf(struct e1000_hw *, u16); +s32 e1000_promisc_set_vf(struct e1000_hw *, enum e1000_promisc_type); +#endif /* _E1000_VF_H_ */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/glue.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/glue.c index bff06809e9..08bea120eb 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/glue.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/glue.c @@ -1,11 +1,28 @@ #include -HAIKU_FBSD_DRIVER_GLUE(ipro1000, em, pci) + +extern driver_t *DRIVER_MODULE_NAME(em, pci); +extern driver_t *DRIVER_MODULE_NAME(lem, pci); + +HAIKU_FBSD_DRIVERS_GLUE(ipro1000); NO_HAIKU_CHECK_DISABLE_INTERRUPTS(); NO_HAIKU_REENABLE_INTERRUPTS(); NO_HAIKU_FBSD_MII_DRIVER(); + +status_t +__haiku_handle_fbsd_drivers_list(status_t (*handler)(driver_t *[])) +{ + driver_t *drivers[] = { + DRIVER_MODULE_NAME(em, pci), + DRIVER_MODULE_NAME(lem, pci), + NULL + }; + return (*handler)(drivers); +} + + #ifdef EM_FAST_INTR HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE); #else diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c index 9c93ebe6f5..cc903d564b 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,14 +30,22 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_em.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/if_em.c,v 1.21.2.18.2.3 2011/01/25 23:20:22 jfv Exp $*/ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" +#include "opt_inet.h" #endif #include #include + +#ifndef __HAIKU__ +#if __FreeBSD_version >= 800000 +#include +#endif +#endif + #include #include #include @@ -51,10 +59,6 @@ #include #include #include -#ifdef EM_TIMESYNC -#include -#include -#endif #include #include @@ -77,6 +81,11 @@ #include #include + +#ifndef __HAIKU__ +#include +#endif + #include #include @@ -92,8 +101,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "6.9.6"; - +char em_driver_version[] = "7.1.9"; /********************************************************************* * PCI Device ID Table @@ -108,51 +116,6 @@ char em_driver_version[] = "6.9.6"; static em_vendor_info_t em_vendor_info_array[] = { /* Intel(R) PRO/1000 Network Connection */ - { 0x8086, E1000_DEV_ID_82540EM, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82540EM_LOM, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82540EP, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82540EP_LOM, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82540EP_LP, PCI_ANY_ID, PCI_ANY_ID, 0}, - - { 0x8086, E1000_DEV_ID_82541EI, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82541ER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82541ER_LOM, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82541EI_MOBILE, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82541GI, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82541GI_LF, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82541GI_MOBILE, PCI_ANY_ID, PCI_ANY_ID, 0}, - - { 0x8086, E1000_DEV_ID_82542, PCI_ANY_ID, PCI_ANY_ID, 0}, - - { 0x8086, E1000_DEV_ID_82543GC_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82543GC_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - - { 0x8086, E1000_DEV_ID_82544EI_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82544EI_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82544GC_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82544GC_LOM, PCI_ANY_ID, PCI_ANY_ID, 0}, - - { 0x8086, E1000_DEV_ID_82545EM_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82545EM_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82545GM_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82545GM_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82545GM_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, - - { 0x8086, E1000_DEV_ID_82546EB_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82546EB_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82546EB_QUAD_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82546GB_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82546GB_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82546GB_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82546GB_PCIE, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82546GB_QUAD_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3, - PCI_ANY_ID, PCI_ANY_ID, 0}, - - { 0x8086, E1000_DEV_ID_82547EI, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82547EI_MOBILE, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82547GI, PCI_ANY_ID, PCI_ANY_ID, 0}, - { 0x8086, E1000_DEV_ID_82571EB_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82571EB_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82571EB_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, @@ -176,6 +139,7 @@ static em_vendor_info_t em_vendor_info_array[] = { 0x8086, E1000_DEV_ID_82573E, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82573E_IAMT, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82573L, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82583V, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_80003ES2LAN_COPPER_SPT, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_80003ES2LAN_SERDES_SPT, @@ -191,7 +155,7 @@ static em_vendor_info_t em_vendor_info_array[] = { 0x8086, E1000_DEV_ID_ICH8_IFE_GT, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH8_IFE_G, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH8_IGP_M, PCI_ANY_ID, PCI_ANY_ID, 0}, - + { 0x8086, E1000_DEV_ID_ICH8_82567V_3, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH9_IGP_M_AMT, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH9_IGP_AMT, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH9_IGP_C, PCI_ANY_ID, PCI_ANY_ID, 0}, @@ -202,11 +166,19 @@ static em_vendor_info_t em_vendor_info_array[] = { 0x8086, E1000_DEV_ID_ICH9_IFE_G, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH9_BM, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82574L, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82574LA, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH10_R_BM_LM, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH10_R_BM_LF, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH10_R_BM_V, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH10_D_BM_LM, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_ICH10_D_BM_LF, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_ICH10_D_BM_V, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_M_HV_LM, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_M_HV_LC, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_D_HV_DM, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_D_HV_DC, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH2_LV_LM, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH2_LV_V, PCI_ANY_ID, PCI_ANY_ID, 0}, /* required last entry */ { 0, 0, 0, 0, 0} }; @@ -229,9 +201,14 @@ static int em_shutdown(device_t); static int em_suspend(device_t); static int em_resume(device_t); static void em_start(struct ifnet *); -static void em_start_locked(struct ifnet *ifp); +static void em_start_locked(struct ifnet *, struct tx_ring *); +#ifdef EM_MULTIQUEUE +static int em_mq_start(struct ifnet *, struct mbuf *); +static int em_mq_start_locked(struct ifnet *, + struct tx_ring *, struct mbuf *); +static void em_qflush(struct ifnet *); +#endif static int em_ioctl(struct ifnet *, u_long, caddr_t); -static void em_watchdog(struct adapter *); static void em_init(void *); static void em_init_locked(struct adapter *); static void em_stop(void *); @@ -239,66 +216,58 @@ static void em_media_status(struct ifnet *, struct ifmediareq *); static int em_media_change(struct ifnet *); static void em_identify_hardware(struct adapter *); static int em_allocate_pci_resources(struct adapter *); -static int em_allocate_legacy(struct adapter *adapter); -static int em_allocate_msix(struct adapter *adapter); +static int em_allocate_legacy(struct adapter *); +static int em_allocate_msix(struct adapter *); +static int em_allocate_queues(struct adapter *); static int em_setup_msix(struct adapter *); static void em_free_pci_resources(struct adapter *); static void em_local_timer(void *); -static int em_hardware_init(struct adapter *); -static void em_setup_interface(device_t, struct adapter *); +static void em_reset(struct adapter *); +static int em_setup_interface(device_t, struct adapter *); + static void em_setup_transmit_structures(struct adapter *); static void em_initialize_transmit_unit(struct adapter *); +static int em_allocate_transmit_buffers(struct tx_ring *); +static void em_free_transmit_structures(struct adapter *); +static void em_free_transmit_buffers(struct tx_ring *); + static int em_setup_receive_structures(struct adapter *); +static int em_allocate_receive_buffers(struct rx_ring *); static void em_initialize_receive_unit(struct adapter *); +static void em_free_receive_structures(struct adapter *); +static void em_free_receive_buffers(struct rx_ring *); + static void em_enable_intr(struct adapter *); static void em_disable_intr(struct adapter *); -static void em_free_transmit_structures(struct adapter *); -static void em_free_receive_structures(struct adapter *); static void em_update_stats_counters(struct adapter *); -static void em_txeof(struct adapter *); -static void em_tx_purge(struct adapter *); -static int em_allocate_receive_structures(struct adapter *); -static int em_allocate_transmit_structures(struct adapter *); -static int em_rxeof(struct adapter *, int); +static void em_add_hw_stats(struct adapter *adapter); +static bool em_txeof(struct tx_ring *); +static bool em_rxeof(struct rx_ring *, int, int *); #ifndef __NO_STRICT_ALIGNMENT -static int em_fixup_rx(struct adapter *); +static int em_fixup_rx(struct rx_ring *); #endif -static void em_receive_checksum(struct adapter *, struct e1000_rx_desc *, - struct mbuf *); -static void em_transmit_checksum_setup(struct adapter *, struct mbuf *, - u32 *, u32 *); -#if __FreeBSD_version >= 700000 -static bool em_tso_setup(struct adapter *, struct mbuf *, - u32 *, u32 *); -#endif /* FreeBSD_version >= 700000 */ +static void em_receive_checksum(struct e1000_rx_desc *, struct mbuf *); +static void em_transmit_checksum_setup(struct tx_ring *, struct mbuf *, int, + struct ip *, u32 *, u32 *); +static void em_tso_setup(struct tx_ring *, struct mbuf *, int, struct ip *, + struct tcphdr *, u32 *, u32 *); static void em_set_promisc(struct adapter *); static void em_disable_promisc(struct adapter *); static void em_set_multi(struct adapter *); -static void em_print_hw_stats(struct adapter *); static void em_update_link_status(struct adapter *); -static int em_get_buf(struct adapter *, int); - -#ifdef EM_HW_VLAN_SUPPORT +static void em_refresh_mbufs(struct rx_ring *, int); static void em_register_vlan(void *, struct ifnet *, u16); static void em_unregister_vlan(void *, struct ifnet *, u16); -#endif - -static int em_xmit(struct adapter *, struct mbuf **); -static void em_smartspeed(struct adapter *); -static int em_82547_fifo_workaround(struct adapter *, int); -static void em_82547_update_fifo_head(struct adapter *, int); -static int em_82547_tx_fifo_reset(struct adapter *); -static void em_82547_move_tail(void *); +static void em_setup_vlan_hw_support(struct adapter *); +static int em_xmit(struct tx_ring *, struct mbuf **); static int em_dma_malloc(struct adapter *, bus_size_t, struct em_dma_alloc *, int); static void em_dma_free(struct adapter *, struct em_dma_alloc *); -static void em_print_debug_info(struct adapter *); +static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void em_print_nvm_info(struct adapter *); -static int em_is_valid_ether_addr(u8 *); -static int em_sysctl_stats(SYSCTL_HANDLER_ARGS); static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); -static u32 em_fill_descriptors (bus_addr_t address, u32 length, - PDESC_ARRAY desc_array); +static void em_print_debug_info(struct adapter *); +static int em_is_valid_ether_addr(u8 *); static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); static void em_add_int_delay_sysctl(struct adapter *, const char *, const char *, struct em_int_delay_info *, int, int); @@ -307,33 +276,28 @@ static void em_init_manageability(struct adapter *); static void em_release_manageability(struct adapter *); static void em_get_hw_control(struct adapter *); static void em_release_hw_control(struct adapter *); +static void em_get_wakeup(device_t); static void em_enable_wakeup(device_t); +static int em_enable_phy_wakeup(struct adapter *); +static void em_led_func(void *, int); +static void em_disable_aspm(struct adapter *); -#ifdef EM_TIMESYNC -/* Precision Time sync support */ -static int em_tsync_init(struct adapter *); -static void em_tsync_disable(struct adapter *); -#endif - -#ifdef EM_LEGACY_IRQ -static void em_intr(void *); -#else /* FAST IRQ */ -#if __FreeBSD_version < 700000 -static void em_irq_fast(void *); -#else static int em_irq_fast(void *); -#endif + /* MSIX handlers */ static void em_msix_tx(void *); static void em_msix_rx(void *); static void em_msix_link(void *); +static void em_handle_tx(void *context, int pending); +static void em_handle_rx(void *context, int pending); +static void em_handle_link(void *context, int pending); + static void em_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); -static void em_handle_rxtx(void *context, int pending); -static void em_handle_rx(void *context, int pending); -static void em_handle_tx(void *context, int pending); -static void em_handle_link(void *context, int pending); -#endif /* EM_LEGACY_IRQ */ +static void em_set_flow_cntrl(struct adapter *, const char *, + const char *, int *, int); + +static __inline void em_rx_discard(struct rx_ring *, int); #ifdef DEVICE_POLLING static poll_handler_t em_poll; @@ -358,7 +322,7 @@ static driver_t em_driver = { "em", em_methods, sizeof(struct adapter), }; -static devclass_t em_devclass; +devclass_t em_devclass; DRIVER_MODULE(em, pci, em_driver, em_devclass, 0, 0); MODULE_DEPEND(em, pci, 1, 1, 1); MODULE_DEPEND(em, ether, 1, 1, 1); @@ -378,31 +342,36 @@ MODULE_DEPEND(em, ether, 1, 1, 1); static int em_tx_int_delay_dflt = EM_TICKS_TO_USECS(EM_TIDV); static int em_rx_int_delay_dflt = EM_TICKS_TO_USECS(EM_RDTR); -static int em_tx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_TADV); -static int em_rx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_RADV); -static int em_rxd = EM_DEFAULT_RXD; -static int em_txd = EM_DEFAULT_TXD; -static int em_smart_pwr_down = FALSE; -/* Controls whether promiscuous also shows bad packets */ -static int em_debug_sbp = FALSE; -/* Local switch for MSI/MSIX */ -static int em_enable_msi = TRUE; - TUNABLE_INT("hw.em.tx_int_delay", &em_tx_int_delay_dflt); TUNABLE_INT("hw.em.rx_int_delay", &em_rx_int_delay_dflt); + +static int em_tx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_TADV); +static int em_rx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_RADV); TUNABLE_INT("hw.em.tx_abs_int_delay", &em_tx_abs_int_delay_dflt); TUNABLE_INT("hw.em.rx_abs_int_delay", &em_rx_abs_int_delay_dflt); + +static int em_rxd = EM_DEFAULT_RXD; +static int em_txd = EM_DEFAULT_TXD; TUNABLE_INT("hw.em.rxd", &em_rxd); TUNABLE_INT("hw.em.txd", &em_txd); -TUNABLE_INT("hw.em.smart_pwr_down", &em_smart_pwr_down); -TUNABLE_INT("hw.em.sbp", &em_debug_sbp); -TUNABLE_INT("hw.em.enable_msi", &em_enable_msi); -#ifndef EM_LEGACY_IRQ +static int em_smart_pwr_down = FALSE; +TUNABLE_INT("hw.em.smart_pwr_down", &em_smart_pwr_down); + +/* Controls whether promiscuous also shows bad packets */ +static int em_debug_sbp = FALSE; +TUNABLE_INT("hw.em.sbp", &em_debug_sbp); + +static int em_enable_msix = TRUE; +TUNABLE_INT("hw.em.enable_msix", &em_enable_msix); + /* How many packets rxeof tries to clean at a time */ static int em_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &em_rx_process_limit); -#endif + +/* Flow control setting - default to FULL */ +static int em_fc_setting = e1000_fc_full; +TUNABLE_INT("hw.em.fc_setting", &em_fc_setting); /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; @@ -472,31 +441,26 @@ static int em_attach(device_t dev) { struct adapter *adapter; - int tsize, rsize; int error = 0; - u16 eeprom_data, device_id; INIT_DEBUGOUT("em_attach: begin"); adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; EM_CORE_LOCK_INIT(adapter, device_get_nameunit(dev)); - EM_TX_LOCK_INIT(adapter, device_get_nameunit(dev)); - EM_RX_LOCK_INIT(adapter, device_get_nameunit(dev)); /* SYSCTL stuff */ + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + em_sysctl_nvm_info, "I", "NVM Information"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, em_sysctl_debug_info, "I", "Debug Information"); - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, - em_sysctl_stats, "I", "Statistics"); - callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); - callout_init_mtx(&adapter->tx_fifo_timer, &adapter->tx_mtx, 0); /* Determine hardware and mac info */ em_identify_hardware(adapter); @@ -515,8 +479,10 @@ em_attach(device_t dev) ** identified */ if ((adapter->hw.mac.type == e1000_ich8lan) || + (adapter->hw.mac.type == e1000_ich9lan) || (adapter->hw.mac.type == e1000_ich10lan) || - (adapter->hw.mac.type == e1000_ich9lan)) { + (adapter->hw.mac.type == e1000_pchlan) || + (adapter->hw.mac.type == e1000_pch2lan)) { int rid = EM_BAR_TYPE_FLASH; adapter->flash = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -549,25 +515,26 @@ em_attach(device_t dev) em_add_int_delay_sysctl(adapter, "tx_int_delay", "transmit interrupt delay in usecs", &adapter->tx_int_delay, E1000_REGISTER(&adapter->hw, E1000_TIDV), em_tx_int_delay_dflt); - if (adapter->hw.mac.type >= e1000_82540) { - em_add_int_delay_sysctl(adapter, "rx_abs_int_delay", - "receive interrupt delay limit in usecs", - &adapter->rx_abs_int_delay, - E1000_REGISTER(&adapter->hw, E1000_RADV), - em_rx_abs_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "tx_abs_int_delay", - "transmit interrupt delay limit in usecs", - &adapter->tx_abs_int_delay, - E1000_REGISTER(&adapter->hw, E1000_TADV), - em_tx_abs_int_delay_dflt); - } + em_add_int_delay_sysctl(adapter, "rx_abs_int_delay", + "receive interrupt delay limit in usecs", + &adapter->rx_abs_int_delay, + E1000_REGISTER(&adapter->hw, E1000_RADV), + em_rx_abs_int_delay_dflt); + em_add_int_delay_sysctl(adapter, "tx_abs_int_delay", + "transmit interrupt delay limit in usecs", + &adapter->tx_abs_int_delay, + E1000_REGISTER(&adapter->hw, E1000_TADV), + em_tx_abs_int_delay_dflt); -#ifndef EM_LEGACY_IRQ - /* Sysctls for limiting the amount of work done in the taskqueue */ + /* Sysctl for limiting the amount of work done in the taskqueue */ em_add_rx_process_limit(adapter, "rx_processing_limit", "max number of rx packets to process", &adapter->rx_process_limit, em_rx_process_limit); -#endif + + /* Sysctl for setting the interface flow control */ + em_set_flow_cntrl(adapter, "flow_control", + "configure flow control", + &adapter->fc_setting, em_fc_setting); /* * Validate number of transmit and receive descriptors. It @@ -575,18 +542,15 @@ em_attach(device_t dev) * of E1000_DBA_ALIGN. */ if (((em_txd * sizeof(struct e1000_tx_desc)) % EM_DBA_ALIGN) != 0 || - (adapter->hw.mac.type >= e1000_82544 && em_txd > EM_MAX_TXD) || - (adapter->hw.mac.type < e1000_82544 && em_txd > EM_MAX_TXD_82543) || - (em_txd < EM_MIN_TXD)) { + (em_txd > EM_MAX_TXD) || (em_txd < EM_MIN_TXD)) { device_printf(dev, "Using %d TX descriptors instead of %d!\n", EM_DEFAULT_TXD, em_txd); adapter->num_tx_desc = EM_DEFAULT_TXD; } else adapter->num_tx_desc = em_txd; + if (((em_rxd * sizeof(struct e1000_rx_desc)) % EM_DBA_ALIGN) != 0 || - (adapter->hw.mac.type >= e1000_82544 && em_rxd > EM_MAX_RXD) || - (adapter->hw.mac.type < e1000_82544 && em_rxd > EM_MAX_RXD_82543) || - (em_rxd < EM_MIN_RXD)) { + (em_rxd > EM_MAX_RXD) || (em_rxd < EM_MIN_RXD)) { device_printf(dev, "Using %d RX descriptors instead of %d!\n", EM_DEFAULT_RXD, em_rxd); adapter->num_rx_desc = EM_DEFAULT_RXD; @@ -596,10 +560,6 @@ em_attach(device_t dev) adapter->hw.mac.autoneg = DO_AUTO_NEG; adapter->hw.phy.autoneg_wait_to_complete = FALSE; adapter->hw.phy.autoneg_advertised = AUTONEG_ADV_DEFAULT; - adapter->rx_buffer_len = 2048; - - e1000_init_script_state_82541(&adapter->hw, TRUE); - e1000_set_tbi_compatibility_82543(&adapter->hw, TRUE); /* Copper options */ if (adapter->hw.phy.media_type == e1000_media_type_copper) { @@ -621,29 +581,34 @@ em_attach(device_t dev) */ adapter->hw.mac.report_tx_early = 1; - tsize = roundup2(adapter->num_tx_desc * sizeof(struct e1000_tx_desc), - EM_DBA_ALIGN); - - /* Allocate Transmit Descriptor ring */ - if (em_dma_malloc(adapter, tsize, &adapter->txdma, BUS_DMA_NOWAIT)) { - device_printf(dev, "Unable to allocate tx_desc memory\n"); + /* + ** Get queue/ring memory + */ + if (em_allocate_queues(adapter)) { error = ENOMEM; - goto err_tx_desc; + goto err_pci; } - adapter->tx_desc_base = - (struct e1000_tx_desc *)adapter->txdma.dma_vaddr; - rsize = roundup2(adapter->num_rx_desc * sizeof(struct e1000_rx_desc), - EM_DBA_ALIGN); - - /* Allocate Receive Descriptor ring */ - if (em_dma_malloc(adapter, rsize, &adapter->rxdma, BUS_DMA_NOWAIT)) { - device_printf(dev, "Unable to allocate rx_desc memory\n"); + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); error = ENOMEM; - goto err_rx_desc; + goto err_late; } - adapter->rx_desc_base = - (struct e1000_rx_desc *)adapter->rxdma.dma_vaddr; + + /* Check SOL/IDER usage */ + if (e1000_check_reset_block(&adapter->hw)) + device_printf(dev, "PHY reset is blocked" + " due to SOL/IDER session.\n"); + + /* + ** Start from a known state, this is + ** important in reading the nvm and + ** mac from that. + */ + e1000_reset_hw(&adapter->hw); /* Make sure we have a good EEPROM before we read from it */ if (e1000_validate_nvm_checksum(&adapter->hw) < 0) { @@ -656,57 +621,44 @@ em_attach(device_t dev) device_printf(dev, "The EEPROM Checksum Is Not Valid\n"); error = EIO; - goto err_hw_init; + goto err_late; } } - /* Initialize the hardware */ - if (em_hardware_init(adapter)) { - device_printf(dev, "Unable to initialize the hardware\n"); - error = EIO; - goto err_hw_init; - } - /* Copy the permanent MAC address out of the EEPROM */ if (e1000_read_mac_addr(&adapter->hw) < 0) { device_printf(dev, "EEPROM read error while reading MAC" " address\n"); error = EIO; - goto err_hw_init; + goto err_late; } if (!em_is_valid_ether_addr(adapter->hw.mac.addr)) { device_printf(dev, "Invalid MAC address\n"); error = EIO; - goto err_hw_init; - } - - /* Allocate transmit descriptors and buffers */ - if (em_allocate_transmit_structures(adapter)) { - device_printf(dev, "Could not setup transmit structures\n"); - error = ENOMEM; - goto err_tx_struct; - } - - /* Allocate receive descriptors and buffers */ - if (em_allocate_receive_structures(adapter)) { - device_printf(dev, "Could not setup receive structures\n"); - error = ENOMEM; - goto err_rx_struct; + goto err_late; } /* ** Do interrupt configuration */ - if (adapter->msi > 1) /* Do MSI/X */ + if (adapter->msix > 1) /* Do MSIX */ error = em_allocate_msix(adapter); else /* MSI or Legacy */ error = em_allocate_legacy(adapter); if (error) - goto err_rx_struct; + goto err_late; + + /* + * Get Wake-on-Lan and Management info for later use + */ + em_get_wakeup(dev); /* Setup OS specific network interface */ - em_setup_interface(dev, adapter); + if (em_setup_interface(dev, adapter) != 0) + goto err_late; + + em_reset(adapter); /* Initialize statistics */ em_update_stats_counters(adapter); @@ -714,109 +666,39 @@ em_attach(device_t dev) adapter->hw.mac.get_link_status = 1; em_update_link_status(adapter); - /* Indicate SOL/IDER usage */ - if (e1000_check_reset_block(&adapter->hw)) - device_printf(dev, - "PHY reset is blocked due to SOL/IDER session.\n"); - - /* Determine if we have to control management hardware */ - adapter->has_manage = e1000_enable_mng_pass_thru(&adapter->hw); - - /* - * Setup Wake-on-Lan - */ - switch (adapter->hw.mac.type) { - - case e1000_82542: - case e1000_82543: - break; - case e1000_82546: - case e1000_82546_rev_3: - case e1000_82571: - case e1000_80003es2lan: - if (adapter->hw.bus.func == 1) - e1000_read_nvm(&adapter->hw, - NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); - else - e1000_read_nvm(&adapter->hw, - NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); - eeprom_data &= EM_EEPROM_APME; - break; - default: - /* APME bit in EEPROM is mapped to WUC.APME */ - eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC) & - E1000_WUC_APME; - break; - } - if (eeprom_data) - adapter->wol = E1000_WUFC_MAG; - /* - * We have the eeprom settings, now apply the special cases - * where the eeprom may be wrong or the board won't support - * wake on lan on a particular port - */ - device_id = pci_get_device(dev); - switch (device_id) { - case E1000_DEV_ID_82546GB_PCIE: - adapter->wol = 0; - break; - case E1000_DEV_ID_82546EB_FIBER: - case E1000_DEV_ID_82546GB_FIBER: - case E1000_DEV_ID_82571EB_FIBER: - /* Wake events only supported on port A for dual fiber - * regardless of eeprom setting */ - if (E1000_READ_REG(&adapter->hw, E1000_STATUS) & - E1000_STATUS_FUNC_1) - adapter->wol = 0; - break; - case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: - case E1000_DEV_ID_82571EB_QUAD_COPPER: - case E1000_DEV_ID_82571EB_QUAD_FIBER: - case E1000_DEV_ID_82571EB_QUAD_COPPER_LP: - /* if quad port adapter, disable WoL on all but port A */ - if (global_quad_port_a != 0) - adapter->wol = 0; - /* Reset for multiple quad port adapters */ - if (++global_quad_port_a == 4) - global_quad_port_a = 0; - break; - } - - /* Do we need workaround for 82544 PCI-X adapter? */ - if (adapter->hw.bus.type == e1000_bus_type_pcix && - adapter->hw.mac.type == e1000_82544) - adapter->pcix_82544 = TRUE; - else - adapter->pcix_82544 = FALSE; - -#ifdef EM_HW_VLAN_SUPPORT /* Register for VLAN events */ adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, - em_register_vlan, 0, EVENTHANDLER_PRI_FIRST); + em_register_vlan, adapter, EVENTHANDLER_PRI_FIRST); adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, - em_unregister_vlan, 0, EVENTHANDLER_PRI_FIRST); -#endif + em_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); + + em_add_hw_stats(adapter); + + /* Non-AMT based hardware can now take control from firmware */ + if (adapter->has_manage && !adapter->has_amt) + em_get_hw_control(adapter); /* Tell the stack that the interface is not active */ adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); +#ifndef __HAIKU__ + adapter->led_dev = led_create(em_led_func, adapter, + device_get_nameunit(dev)); +#endif + INIT_DEBUGOUT("em_attach: end"); return (0); -err_rx_struct: +err_late: em_free_transmit_structures(adapter); -err_tx_struct: -err_hw_init: + em_free_receive_structures(adapter); em_release_hw_control(adapter); - em_dma_free(adapter, &adapter->rxdma); -err_rx_desc: - em_dma_free(adapter, &adapter->txdma); -err_tx_desc: + if (adapter->ifp != NULL) + if_free(adapter->ifp); err_pci: em_free_pci_resources(adapter); - EM_TX_LOCK_DESTROY(adapter); - EM_RX_LOCK_DESTROY(adapter); + free(adapter->mta, M_DEVBUF); EM_CORE_LOCK_DESTROY(adapter); return (error); @@ -841,11 +723,7 @@ em_detach(device_t dev) INIT_DEBUGOUT("em_detach: begin"); /* Make sure VLANS are not using driver */ -#if __FreeBSD_version >= 700000 if (adapter->ifp->if_vlantrunk != NULL) { -#else - if (adapter->ifp->if_nvlans != 0) { -#endif device_printf(dev,"Vlan in use, detach first\n"); return (EBUSY); } @@ -855,41 +733,30 @@ em_detach(device_t dev) ether_poll_deregister(ifp); #endif +#ifndef __HAIKU__ + if (adapter->led_dev != NULL) + led_destroy(adapter->led_dev); +#endif + EM_CORE_LOCK(adapter); - EM_TX_LOCK(adapter); adapter->in_detach = 1; em_stop(adapter); + EM_CORE_UNLOCK(adapter); + EM_CORE_LOCK_DESTROY(adapter); + e1000_phy_hw_reset(&adapter->hw); em_release_manageability(adapter); + em_release_hw_control(adapter); - if (((adapter->hw.mac.type == e1000_82573) || - (adapter->hw.mac.type == e1000_ich8lan) || - (adapter->hw.mac.type == e1000_ich10lan) || - (adapter->hw.mac.type == e1000_ich9lan)) && - e1000_check_mng_mode(&adapter->hw)) - em_release_hw_control(adapter); - - if (adapter->wol) { - E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); - E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); - em_enable_wakeup(dev); - } - - EM_TX_UNLOCK(adapter); - EM_CORE_UNLOCK(adapter); - -#ifdef EM_HW_VLAN_SUPPORT /* Unregister VLAN events */ if (adapter->vlan_attach != NULL) EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); if (adapter->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); -#endif ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); - callout_drain(&adapter->tx_fifo_timer); em_free_pci_resources(adapter); bus_generic_detach(dev); @@ -898,21 +765,8 @@ em_detach(device_t dev) em_free_transmit_structures(adapter); em_free_receive_structures(adapter); - /* Free Transmit Descriptor ring */ - if (adapter->tx_desc_base) { - em_dma_free(adapter, &adapter->txdma); - adapter->tx_desc_base = NULL; - } - - /* Free Receive Descriptor ring */ - if (adapter->rx_desc_base) { - em_dma_free(adapter, &adapter->rxdma); - adapter->rx_desc_base = NULL; - } - - EM_TX_LOCK_DESTROY(adapter); - EM_RX_LOCK_DESTROY(adapter); - EM_CORE_LOCK_DESTROY(adapter); + em_release_hw_control(adapter); + free(adapter->mta, M_DEVBUF); return (0); } @@ -939,24 +793,9 @@ em_suspend(device_t dev) EM_CORE_LOCK(adapter); - EM_TX_LOCK(adapter); - em_stop(adapter); - EM_TX_UNLOCK(adapter); - em_release_manageability(adapter); - - if (((adapter->hw.mac.type == e1000_82573) || - (adapter->hw.mac.type == e1000_ich8lan) || - (adapter->hw.mac.type == e1000_ich10lan) || - (adapter->hw.mac.type == e1000_ich9lan)) && - e1000_check_mng_mode(&adapter->hw)) - em_release_hw_control(adapter); - - if (adapter->wol) { - E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); - E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); - em_enable_wakeup(dev); - } + em_release_hw_control(adapter); + em_enable_wakeup(dev); EM_CORE_UNLOCK(adapter); @@ -989,30 +828,134 @@ em_resume(device_t dev) * the packet is requeued. **********************************************************************/ +#ifdef EM_MULTIQUEUE +static int +em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) +{ + struct adapter *adapter = txr->adapter; + struct mbuf *next; + int err = 0, enq = 0; + + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || adapter->link_active == 0) { + if (m != NULL) + err = drbr_enqueue(ifp, txr->br, m); + return (err); + } + + /* Call cleanup if number of TX descriptors low */ + if (txr->tx_avail <= EM_TX_CLEANUP_THRESHOLD) + em_txeof(txr); + + enq = 0; + if (m == NULL) { + next = drbr_dequeue(ifp, txr->br); + } else if (drbr_needs_enqueue(ifp, txr->br)) { + if ((err = drbr_enqueue(ifp, txr->br, m)) != 0) + return (err); + next = drbr_dequeue(ifp, txr->br); + } else + next = m; + + /* Process the queue */ + while (next != NULL) { + if ((err = em_xmit(txr, &next)) != 0) { + if (next != NULL) + err = drbr_enqueue(ifp, txr->br, next); + break; + } + enq++; + drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ETHER_BPF_MTAP(ifp, next); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; + if (txr->tx_avail < EM_MAX_SCATTER) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + next = drbr_dequeue(ifp, txr->br); + } + + if (enq > 0) { + /* Set the watchdog */ + txr->queue_status = EM_QUEUE_WORKING; + txr->watchdog_time = ticks; + } + return (err); +} + +/* +** Multiqueue capable stack interface +*/ +static int +em_mq_start(struct ifnet *ifp, struct mbuf *m) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = adapter->tx_rings; + int error; + + if (EM_TX_TRYLOCK(txr)) { + error = em_mq_start_locked(ifp, txr, m); + EM_TX_UNLOCK(txr); + } else + error = drbr_enqueue(ifp, txr->br, m); + + return (error); +} + +/* +** Flush all ring buffers +*/ static void -em_start_locked(struct ifnet *ifp) +em_qflush(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = adapter->tx_rings; + struct mbuf *m; + + for (int i = 0; i < adapter->num_queues; i++, txr++) { + EM_TX_LOCK(txr); + while ((m = buf_ring_dequeue_sc(txr->br)) != NULL) + m_freem(m); + EM_TX_UNLOCK(txr); + } + if_qflush(ifp); +} + +#endif /* EM_MULTIQUEUE */ + +static void +em_start_locked(struct ifnet *ifp, struct tx_ring *txr) { struct adapter *adapter = ifp->if_softc; struct mbuf *m_head; - EM_TX_LOCK_ASSERT(adapter); + EM_TX_LOCK_ASSERT(txr); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; + if (!adapter->link_active) return; - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + /* Call cleanup if number of TX descriptors low */ + if (txr->tx_avail <= EM_TX_CLEANUP_THRESHOLD) + em_txeof(txr); - IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + if (txr->tx_avail < EM_MAX_SCATTER) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; /* * Encapsulation can modify our pointer, and or make it * NULL on failure. In that event, we can't requeue. */ - if (em_xmit(adapter, &m_head)) { + if (em_xmit(txr, &m_head)) { if (m_head == NULL) break; ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -1024,19 +967,25 @@ em_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); /* Set timeout in case hardware has problems transmitting. */ - adapter->watchdog_timer = EM_TX_TIMEOUT; + txr->watchdog_time = ticks; + txr->queue_status = EM_QUEUE_WORKING; } + + return; } static void em_start(struct ifnet *ifp) { - struct adapter *adapter = ifp->if_softc; + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = adapter->tx_rings; - EM_TX_LOCK(adapter); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - em_start_locked(ifp); - EM_TX_UNLOCK(adapter); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + EM_TX_LOCK(txr); + em_start_locked(ifp, txr); + EM_TX_UNLOCK(txr); + } + return; } /********************************************************************* @@ -1053,7 +1002,9 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; +#ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; +#endif int error = 0; if (adapter->in_detach) @@ -1061,6 +1012,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) switch (command) { case SIOCSIFADDR: +#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) { /* * XXX @@ -1077,39 +1029,31 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } arp_ifinit(ifp, ifa); } else +#endif error = ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: { int max_frame_size; - u16 eeprom_data = 0; IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); EM_CORE_LOCK(adapter); switch (adapter->hw.mac.type) { - case e1000_82573: - /* - * 82573 only supports jumbo frames - * if ASPM is disabled. - */ - e1000_read_nvm(&adapter->hw, - NVM_INIT_3GIO_3, 1, &eeprom_data); - if (eeprom_data & NVM_WORD1A_ASPM_MASK) { - max_frame_size = ETHER_MAX_LEN; - break; - } - /* Allow Jumbo frames - fall thru */ case e1000_82571: case e1000_82572: case e1000_ich9lan: case e1000_ich10lan: + case e1000_pch2lan: case e1000_82574: - case e1000_80003es2lan: /* Limit Jumbo Frame size */ + case e1000_80003es2lan: /* 9K Jumbo Frame size */ max_frame_size = 9234; break; + case e1000_pchlan: + max_frame_size = 4096; + break; /* Adapters that do not support jumbo frames */ - case e1000_82542: + case e1000_82583: case e1000_ich8lan: max_frame_size = ETHER_MAX_LEN; break; @@ -1144,11 +1088,8 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } else em_init_locked(adapter); } else - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - EM_TX_LOCK(adapter); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) em_stop(adapter); - EM_TX_UNLOCK(adapter); - } adapter->if_flags = ifp->if_flags; EM_CORE_UNLOCK(adapter); break; @@ -1159,10 +1100,6 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) EM_CORE_LOCK(adapter); em_disable_intr(adapter); em_set_multi(adapter); - if (adapter->hw.mac.type == e1000_82542 && - adapter->hw.revision_id == E1000_REVISION_2) { - em_initialize_receive_unit(adapter); - } #ifdef DEVICE_POLLING if (!(ifp->if_capenable & IFCAP_POLLING)) #endif @@ -1171,6 +1108,11 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; case SIOCSIFMEDIA: + /* + ** As the speed/duplex settings are being + ** changed, we need to reset the PHY. + */ + adapter->hw.phy.reset_disable = FALSE; /* Check SOL/IDER usage */ EM_CORE_LOCK(adapter); if (e1000_check_reset_block(&adapter->hw)) { @@ -1180,6 +1122,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } EM_CORE_UNLOCK(adapter); + /* falls thru */ case SIOCGIFMEDIA: IOCTL_DEBUGOUT("ioctl rcv'd: \ SIOCxIFMEDIA (Get/Set Interface Media)"); @@ -1216,89 +1159,31 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_HWCSUM; reinit = 1; } -#if __FreeBSD_version >= 700000 if (mask & IFCAP_TSO4) { ifp->if_capenable ^= IFCAP_TSO4; reinit = 1; } -#endif - if (mask & IFCAP_VLAN_HWTAGGING) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; reinit = 1; } + if (mask & IFCAP_VLAN_HWFILTER) { + ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; + reinit = 1; + } + if ((mask & IFCAP_WOL) && + (ifp->if_capabilities & IFCAP_WOL) != 0) { + if (mask & IFCAP_WOL_MCAST) + ifp->if_capenable ^= IFCAP_WOL_MCAST; + if (mask & IFCAP_WOL_MAGIC) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; + } if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) em_init(adapter); -#if __FreeBSD_version >= 700000 VLAN_CAPABILITIES(ifp); -#endif break; } -#ifdef EM_TIMESYNC - /* - ** IOCTL support for Precision Time (IEEE 1588) Support - */ - case EM_TIMESYNC_READTS: - { - u32 rx_ctl, tx_ctl; - struct em_tsync_read *tdata; - - tdata = (struct em_tsync_read *) ifr->ifr_data; - - IOCTL_DEBUGOUT("Reading Timestamp\n"); - - if (tdata->read_current_time) { - getnanotime(&tdata->system_time); - tdata->network_time = E1000_READ_REG(&adapter->hw, E1000_SYSTIML); - tdata->network_time |= - (u64)E1000_READ_REG(&adapter->hw, E1000_SYSTIMH ) << 32; - } - - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - - IOCTL_DEBUGOUT1("RX_CTL value = %u\n", rx_ctl); - IOCTL_DEBUGOUT1("TX_CTL value = %u\n", tx_ctl); - - if (rx_ctl & 0x1) { - IOCTL_DEBUGOUT("RX timestamp is valid\n"); - u32 tmp; - unsigned char *tmp_cp; - - tdata->rx_valid = 1; - tdata->rx_stamp = E1000_READ_REG(&adapter->hw, E1000_RXSTMPL); - tdata->rx_stamp |= (u64)E1000_READ_REG(&adapter->hw, - E1000_RXSTMPH) << 32; - - tmp = E1000_READ_REG(&adapter->hw, E1000_RXSATRL); - tmp_cp = (unsigned char *) &tmp; - tdata->srcid[0] = tmp_cp[0]; - tdata->srcid[1] = tmp_cp[1]; - tdata->srcid[2] = tmp_cp[2]; - tdata->srcid[3] = tmp_cp[3]; - tmp = E1000_READ_REG(&adapter->hw, E1000_RXSATRH); - tmp_cp = (unsigned char *) &tmp; - tdata->srcid[4] = tmp_cp[0]; - tdata->srcid[5] = tmp_cp[1]; - tdata->seqid = tmp >> 16; - tdata->seqid = htons(tdata->seqid); - } else - tdata->rx_valid = 0; - - if (tx_ctl & 0x1) { - IOCTL_DEBUGOUT("TX timestamp is valid\n"); - tdata->tx_valid = 1; - tdata->tx_stamp = E1000_READ_REG(&adapter->hw, E1000_TXSTMPL); - tdata->tx_stamp |= (u64) E1000_READ_REG(&adapter->hw, - E1000_TXSTMPH) << 32; - } else - tdata->tx_valid = 0; - - return (0); - } -#endif /* EM_TIMESYNC */ - default: error = ether_ioctl(ifp, command, data); break; @@ -1307,53 +1192,6 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) return (error); } -/********************************************************************* - * Watchdog timer: - * - * This routine is called from the local timer every second. - * As long as transmit descriptors are being cleaned the value - * is non-zero and we do nothing. Reaching 0 indicates a tx hang - * and we then reset the device. - * - **********************************************************************/ - -static void -em_watchdog(struct adapter *adapter) -{ - - EM_CORE_LOCK_ASSERT(adapter); - - /* - ** The timer is set to 5 every time start queues a packet. - ** Then txeof keeps resetting it as long as it cleans at - ** least one descriptor. - ** Finally, anytime all descriptors are clean the timer is - ** set to 0. - */ - EM_TX_LOCK(adapter); - if ((adapter->watchdog_timer == 0) || (--adapter->watchdog_timer)) { - EM_TX_UNLOCK(adapter); - return; - } - - /* If we are in this routine because of pause frames, then - * don't reset the hardware. - */ - if (E1000_READ_REG(&adapter->hw, E1000_STATUS) & - E1000_STATUS_TXOFF) { - adapter->watchdog_timer = EM_TX_TIMEOUT; - EM_TX_UNLOCK(adapter); - return; - } - - if (e1000_check_for_link(&adapter->hw) == 0) - device_printf(adapter->dev, "watchdog timeout -- resetting\n"); - adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - adapter->watchdog_events++; - EM_TX_UNLOCK(adapter); - - em_init_locked(adapter); -} /********************************************************************* * Init entry point @@ -1377,33 +1215,15 @@ em_init_locked(struct adapter *adapter) EM_CORE_LOCK_ASSERT(adapter); - EM_TX_LOCK(adapter); - em_stop(adapter); - EM_TX_UNLOCK(adapter); + em_disable_intr(adapter); + callout_stop(&adapter->timer); /* * Packet Buffer Allocation (PBA) * Writing PBA sets the receive portion of the buffer * the remainder is used for the transmit buffer. - * - * Devices before the 82547 had a Packet Buffer of 64K. - * Default allocation: PBA=48K for Rx, leaving 16K for Tx. - * After the 82547 the buffer was reduced to 40K. - * Default allocation: PBA=30K for Rx, leaving 10K for Tx. - * Note: default does not leave enough room for Jumbo Frame >10k. */ switch (adapter->hw.mac.type) { - case e1000_82547: - case e1000_82547_rev_2: /* 82547: Total Packet Buffer is 40K */ - if (adapter->max_frame_size > 8192) - pba = E1000_PBA_22K; /* 22K for Rx, 18K for Tx */ - else - pba = E1000_PBA_30K; /* 30K for Rx, 10K for Tx */ - adapter->tx_fifo_head = 0; - adapter->tx_head_addr = pba << EM_TX_HEAD_ADDR_SHIFT; - adapter->tx_fifo_size = - (E1000_PBA_40K - pba) << EM_PBA_BYTES_SHIFT; - break; /* Total Packet Buffer on these is 48K */ case e1000_82571: case e1000_82572: @@ -1414,18 +1234,21 @@ em_init_locked(struct adapter *adapter) pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ break; case e1000_82574: + case e1000_82583: pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ break; - case e1000_ich9lan: - case e1000_ich10lan: -#define E1000_PBA_10K 0x000A - pba = E1000_PBA_10K; - break; case e1000_ich8lan: pba = E1000_PBA_8K; break; + case e1000_ich9lan: + case e1000_ich10lan: + pba = E1000_PBA_10K; + break; + case e1000_pchlan: + case e1000_pch2lan: + pba = E1000_PBA_26K; + break; default: - /* Devices before 82547 had a Packet Buffer of 64K. */ if (adapter->max_frame_size > 8192) pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ else @@ -1455,33 +1278,18 @@ em_init_locked(struct adapter *adapter) } /* Initialize the hardware */ - if (em_hardware_init(adapter)) { - device_printf(dev, "Unable to initialize the hardware\n"); - return; - } + em_reset(adapter); em_update_link_status(adapter); /* Setup VLAN support, basic and offload if available */ E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); -#ifndef EM_HW_VLAN_SUPPORT - if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } -#endif /* Set hardware offload abilities */ ifp->if_hwassist = 0; - if (adapter->hw.mac.type >= e1000_82543) { - if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); -#if __FreeBSD_version >= 700000 - if (ifp->if_capenable & IFCAP_TSO4) - ifp->if_hwassist |= CSUM_TSO; -#endif - } + if (ifp->if_capenable & IFCAP_TXCSUM) + ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); + if (ifp->if_capenable & IFCAP_TSO4) + ifp->if_hwassist |= CSUM_TSO; /* Configure for OS presence */ em_init_manageability(adapter); @@ -1493,16 +1301,38 @@ em_init_locked(struct adapter *adapter) /* Setup Multicast table */ em_set_multi(adapter); + /* + ** Figure out the desired mbuf + ** pool for doing jumbos + */ + if (adapter->max_frame_size <= 2048) + adapter->rx_mbuf_sz = MCLBYTES; + else if (adapter->max_frame_size <= 4096) + adapter->rx_mbuf_sz = MJUMPAGESIZE; + else + adapter->rx_mbuf_sz = MJUM9BYTES; + /* Prepare receive descriptors and buffers */ if (em_setup_receive_structures(adapter)) { device_printf(dev, "Could not setup receive structures\n"); - EM_TX_LOCK(adapter); em_stop(adapter); - EM_TX_UNLOCK(adapter); return; } em_initialize_receive_unit(adapter); + /* Use real VLAN Filter support? */ + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + /* Use real VLAN Filter support */ + em_setup_vlan_hw_support(adapter); + else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + } + } + /* Don't lose promiscuous settings */ em_set_promisc(adapter); @@ -1518,14 +1348,8 @@ em_init_locked(struct adapter *adapter) tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); tmp |= E1000_CTRL_EXT_PBA_CLR; E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); - /* - ** Set the IVAR - interrupt vector routing. - ** Each nibble represents a vector, high bit - ** is enable, other 3 bits are the MSIX table - ** entry, we map RXQ0 to 0, TXQ0 to 1, and - ** Link (other) to 2, hence the magic number. - */ - E1000_WRITE_REG(&adapter->hw, E1000_IVAR, 0x800A0908); + /* Set the IVAR - interrupt vector routing. */ + E1000_WRITE_REG(&adapter->hw, E1000_IVAR, adapter->ivars); } #ifdef DEVICE_POLLING @@ -1539,12 +1363,9 @@ em_init_locked(struct adapter *adapter) #endif /* DEVICE_POLLING */ em_enable_intr(adapter); -#ifdef EM_TIMESYNC - /* Initializae IEEE 1588 Precision Time hardware */ - if ((adapter->hw.mac.type == e1000_82574) || - (adapter->hw.mac.type == e1000_ich10lan)) - em_tsync_init(adapter); -#endif + /* AMT based hardware can now take control from firmware */ + if (adapter->has_manage && adapter->has_amt) + em_get_hw_control(adapter); /* Don't reset the phy next time init gets called */ adapter->hw.phy.reset_disable = TRUE; @@ -1564,19 +1385,22 @@ em_init(void *arg) #ifdef DEVICE_POLLING /********************************************************************* * - * Legacy polling routine + * Legacy polling routine: note this only works with single queue * *********************************************************************/ -static void +static int em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; u32 reg_icr; + int rx_done; EM_CORE_LOCK(adapter); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { EM_CORE_UNLOCK(adapter); - return; + return (0); } if (cmd == POLL_AND_CHECK_STATUS) { @@ -1591,166 +1415,30 @@ em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) } EM_CORE_UNLOCK(adapter); - em_rxeof(adapter, count); - - EM_TX_LOCK(adapter); - em_txeof(adapter); + em_rxeof(rxr, count, &rx_done); + EM_TX_LOCK(txr); + em_txeof(txr); +#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) + em_mq_start_locked(ifp, txr, NULL); +#else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - em_start_locked(ifp); - EM_TX_UNLOCK(adapter); + em_start_locked(ifp, txr); +#endif + EM_TX_UNLOCK(txr); + + return (rx_done); } #endif /* DEVICE_POLLING */ -#ifdef EM_LEGACY_IRQ -/********************************************************************* - * - * Legacy Interrupt Service routine - * - *********************************************************************/ - -static void -em_intr(void *arg) -{ - struct adapter *adapter = arg; - struct ifnet *ifp = adapter->ifp; - u32 reg_icr; - - - if (ifp->if_capenable & IFCAP_POLLING) - return; - - EM_CORE_LOCK(adapter); - for (;;) { - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); - - if (adapter->hw.mac.type >= e1000_82571 && - (reg_icr & E1000_ICR_INT_ASSERTED) == 0) - break; - else if (reg_icr == 0) - break; - - /* - * XXX: some laptops trigger several spurious interrupts - * on em(4) when in the resume cycle. The ICR register - * reports all-ones value in this case. Processing such - * interrupts would lead to a freeze. I don't know why. - */ - if (reg_icr == 0xffffffff) - break; - - EM_CORE_UNLOCK(adapter); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - em_rxeof(adapter, -1); - EM_TX_LOCK(adapter); - em_txeof(adapter); - EM_TX_UNLOCK(adapter); - } - EM_CORE_LOCK(adapter); - - /* Link status change */ - if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { - callout_stop(&adapter->timer); - adapter->hw.mac.get_link_status = 1; - em_update_link_status(adapter); - /* Deal with TX cruft when link lost */ - em_tx_purge(adapter); - callout_reset(&adapter->timer, hz, - em_local_timer, adapter); - } - - if (reg_icr & E1000_ICR_RXO) - adapter->rx_overruns++; - } - EM_CORE_UNLOCK(adapter); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - em_start(ifp); -} - -#else /* EM_FAST_IRQ, then fast interrupt routines only */ - -static void -em_handle_link(void *context, int pending) -{ - struct adapter *adapter = context; - struct ifnet *ifp = adapter->ifp; - - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - return; - - EM_CORE_LOCK(adapter); - callout_stop(&adapter->timer); - em_update_link_status(adapter); - /* Deal with TX cruft when link lost */ - em_tx_purge(adapter); - callout_reset(&adapter->timer, hz, em_local_timer, adapter); - EM_CORE_UNLOCK(adapter); -} - - -/* Combined RX/TX handler, used by Legacy and MSI */ -static void -em_handle_rxtx(void *context, int pending) -{ - struct adapter *adapter = context; - struct ifnet *ifp = adapter->ifp; - - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (em_rxeof(adapter, adapter->rx_process_limit) != 0) - taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); - EM_TX_LOCK(adapter); - em_txeof(adapter); - - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - em_start_locked(ifp); - EM_TX_UNLOCK(adapter); - } - - em_enable_intr(adapter); -} - -static void -em_handle_rx(void *context, int pending) -{ - struct adapter *adapter = context; - struct ifnet *ifp = adapter->ifp; - - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && - (em_rxeof(adapter, adapter->rx_process_limit) != 0)) - taskqueue_enqueue(adapter->tq, &adapter->rx_task); - -} - -static void -em_handle_tx(void *context, int pending) -{ - struct adapter *adapter = context; - struct ifnet *ifp = adapter->ifp; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - EM_TX_LOCK(adapter); - em_txeof(adapter); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - em_start_locked(ifp); - EM_TX_UNLOCK(adapter); - } -} /********************************************************************* * * Fast Legacy/MSI Combined Interrupt Service routine * *********************************************************************/ -#if __FreeBSD_version < 700000 -#define FILTER_STRAY -#define FILTER_HANDLED -static void -#else static int -#endif em_irq_fast(void *arg) { struct adapter *adapter = arg; @@ -1777,13 +1465,8 @@ em_irq_fast(void *arg) (reg_icr & E1000_ICR_INT_ASSERTED) == 0) return FILTER_STRAY; - /* - * Mask interrupts until the taskqueue is finished running. This is - * cheap, just assume that it is needed. This also works around the - * MSI message reordering errata on certain systems. - */ em_disable_intr(adapter); - taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); + taskqueue_enqueue(adapter->tq, &adapter->que_task); /* Link status change */ if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { @@ -1796,30 +1479,63 @@ em_irq_fast(void *arg) return FILTER_HANDLED; } +/* Combined RX/TX handler, used by Legacy and MSI */ +static void +em_handle_que(void *context, int pending) +{ + struct adapter *adapter = context; + struct ifnet *ifp = adapter->ifp; + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + bool more; + + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + more = em_rxeof(rxr, adapter->rx_process_limit, NULL); + + EM_TX_LOCK(txr); + em_txeof(txr); +#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) + em_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + em_start_locked(ifp, txr); +#endif + em_txeof(txr); + EM_TX_UNLOCK(txr); + if (more) { + taskqueue_enqueue(adapter->tq, &adapter->que_task); + return; + } + } + + em_enable_intr(adapter); + return; +} + + /********************************************************************* * * MSIX Interrupt Service Routines * **********************************************************************/ -#define EM_MSIX_TX 0x00040000 -#define EM_MSIX_RX 0x00010000 -#define EM_MSIX_LINK 0x00100000 - static void em_msix_tx(void *arg) { - struct adapter *adapter = arg; - struct ifnet *ifp = adapter->ifp; + struct tx_ring *txr = arg; + struct adapter *adapter = txr->adapter; + bool more; - ++adapter->tx_irq; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - EM_TX_LOCK(adapter); - em_txeof(adapter); - EM_TX_UNLOCK(adapter); - taskqueue_enqueue(adapter->tq, &adapter->tx_task); - } - /* Reenable this interrupt */ - E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_TX); + ++txr->tx_irq; + EM_TX_LOCK(txr); + more = em_txeof(txr); + EM_TX_UNLOCK(txr); + if (more) + taskqueue_enqueue(txr->tq, &txr->tx_task); + else + /* Reenable this interrupt */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); return; } @@ -1832,15 +1548,17 @@ em_msix_tx(void *arg) static void em_msix_rx(void *arg) { - struct adapter *adapter = arg; - struct ifnet *ifp = adapter->ifp; + struct rx_ring *rxr = arg; + struct adapter *adapter = rxr->adapter; + bool more; - ++adapter->rx_irq; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && - (em_rxeof(adapter, adapter->rx_process_limit) != 0)) - taskqueue_enqueue(adapter->tq, &adapter->rx_task); - /* Reenable this interrupt */ - E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_RX); + ++rxr->rx_irq; + more = em_rxeof(rxr, adapter->rx_process_limit, NULL); + if (more) + taskqueue_enqueue(rxr->tq, &rxr->rx_task); + else + /* Reenable this interrupt */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxr->ims); return; } @@ -1849,7 +1567,6 @@ em_msix_rx(void *arg) * MSIX Link Fast Interrupt Service routine * **********************************************************************/ - static void em_msix_link(void *arg) { @@ -1861,13 +1578,67 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { adapter->hw.mac.get_link_status = 1; - taskqueue_enqueue(taskqueue_fast, &adapter->link_task); - } - E1000_WRITE_REG(&adapter->hw, E1000_IMS, - EM_MSIX_LINK | E1000_IMS_LSC); + em_handle_link(adapter, 0); + } else + E1000_WRITE_REG(&adapter->hw, E1000_IMS, + EM_MSIX_LINK | E1000_IMS_LSC); return; } -#endif /* EM_FAST_IRQ */ + +static void +em_handle_rx(void *context, int pending) +{ + struct rx_ring *rxr = context; + struct adapter *adapter = rxr->adapter; + bool more; + + more = em_rxeof(rxr, adapter->rx_process_limit, NULL); + if (more) + taskqueue_enqueue(rxr->tq, &rxr->rx_task); + else + /* Reenable this interrupt */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxr->ims); +} + +static void +em_handle_tx(void *context, int pending) +{ + struct tx_ring *txr = context; + struct adapter *adapter = txr->adapter; + struct ifnet *ifp = adapter->ifp; + + EM_TX_LOCK(txr); + em_txeof(txr); +#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) + em_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + em_start_locked(ifp, txr); +#endif + em_txeof(txr); + E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); + EM_TX_UNLOCK(txr); +} + +static void +em_handle_link(void *context, int pending) +{ + struct adapter *adapter = context; + struct ifnet *ifp = adapter->ifp; + + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + return; + + EM_CORE_LOCK(adapter); + callout_stop(&adapter->timer); + em_update_link_status(adapter); + callout_reset(&adapter->timer, hz, em_local_timer, adapter); + E1000_WRITE_REG(&adapter->hw, E1000_IMS, + EM_MSIX_LINK | E1000_IMS_LSC); + EM_CORE_UNLOCK(adapter); +} + /********************************************************************* * @@ -1900,8 +1671,6 @@ em_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) if ((adapter->hw.phy.media_type == e1000_media_type_fiber) || (adapter->hw.phy.media_type == e1000_media_type_internal_serdes)) { - if (adapter->hw.mac.type == e1000_82545) - fiber_type = IFM_1000_LX; ifmr->ifm_active |= fiber_type | IFM_FDX; } else { switch (adapter->link_speed) { @@ -1974,11 +1743,6 @@ em_media_change(struct ifnet *ifp) device_printf(adapter->dev, "Unsupported media type\n"); } - /* As the speed/duplex settings my have changed we need to - * reset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; - em_init_locked(adapter); EM_CORE_UNLOCK(adapter); @@ -1993,52 +1757,132 @@ em_media_change(struct ifnet *ifp) **********************************************************************/ static int -em_xmit(struct adapter *adapter, struct mbuf **m_headp) +em_xmit(struct tx_ring *txr, struct mbuf **m_headp) { + struct adapter *adapter = txr->adapter; bus_dma_segment_t segs[EM_MAX_SCATTER]; bus_dmamap_t map; struct em_buffer *tx_buffer, *tx_buffer_mapped; struct e1000_tx_desc *ctxd = NULL; struct mbuf *m_head; + struct ether_header *eh; + struct ip *ip = NULL; + struct tcphdr *tp = NULL; u32 txd_upper, txd_lower, txd_used, txd_saved; + int ip_off, poff; int nsegs, i, j, first, last = 0; int error, do_tso, tso_desc = 0; -#if __FreeBSD_version < 700000 - struct m_tag *mtag; -#endif + m_head = *m_headp; txd_upper = txd_lower = txd_used = txd_saved = 0; - -#if __FreeBSD_version >= 700000 do_tso = ((m_head->m_pkthdr.csum_flags & CSUM_TSO) != 0); -#else - do_tso = 0; -#endif - - /* - * Force a cleanup if number of TX descriptors - * available hits the threshold - */ - if (adapter->num_tx_desc_avail <= EM_TX_CLEANUP_THRESHOLD) { - em_txeof(adapter); - /* Now do we at least have a minimal? */ - if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD) { - adapter->no_tx_desc_avail1++; - return (ENOBUFS); - } - } - + ip_off = poff = 0; /* - * TSO workaround: - * If an mbuf is only header we need - * to pull 4 bytes of data into it. + * Intel recommends entire IP/TCP header length reside in a single + * buffer. If multiple descriptors are used to describe the IP and + * TCP header, each descriptor should describe one or more + * complete headers; descriptors referencing only parts of headers + * are not supported. If all layer headers are not coalesced into + * a single buffer, each buffer should not cross a 4KB boundary, + * or be larger than the maximum read request size. + * Controller also requires modifing IP/TCP header to make TSO work + * so we firstly get a writable mbuf chain then coalesce ethernet/ + * IP/TCP header into a single buffer to meet the requirement of + * controller. This also simplifies IP/TCP/UDP checksum offloading + * which also has similiar restrictions. */ - if (do_tso && (m_head->m_len <= M_TSO_LEN)) { - m_head = m_pullup(m_head, M_TSO_LEN + 4); - *m_headp = m_head; - if (m_head == NULL) + if (do_tso || m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) { + if (do_tso || (m_head->m_next != NULL && + m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD)) { + if (M_WRITABLE(*m_headp) == 0) { + m_head = m_dup(*m_headp, M_DONTWAIT); + m_freem(*m_headp); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + *m_headp = m_head; + } + } + /* + * XXX + * Assume IPv4, we don't have TSO/checksum offload support + * for IPv6 yet. + */ + ip_off = sizeof(struct ether_header); + m_head = m_pullup(m_head, ip_off); + if (m_head == NULL) { + *m_headp = NULL; return (ENOBUFS); + } + eh = mtod(m_head, struct ether_header *); + if (eh->ether_type == htons(ETHERTYPE_VLAN)) { + ip_off = sizeof(struct ether_vlan_header); + m_head = m_pullup(m_head, ip_off); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + } + m_head = m_pullup(m_head, ip_off + sizeof(struct ip)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m_head, char *) + ip_off); + poff = ip_off + (ip->ip_hl << 2); + if (do_tso) { + m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + tp = (struct tcphdr *)(mtod(m_head, char *) + poff); + /* + * TSO workaround: + * pull 4 more bytes of data into it. + */ + m_head = m_pullup(m_head, poff + (tp->th_off << 2) + 4); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m_head, char *) + ip_off); + ip->ip_len = 0; + ip->ip_sum = 0; + /* + * The pseudo TCP checksum does not include TCP payload + * length so driver should recompute the checksum here + * what hardware expect to see. This is adherence of + * Microsoft's Large Send specification. + */ + tp = (struct tcphdr *)(mtod(m_head, char *) + poff); + tp->th_sum = in_pseudo(ip->ip_src.s_addr, + ip->ip_dst.s_addr, htons(IPPROTO_TCP)); + } else if (m_head->m_pkthdr.csum_flags & CSUM_TCP) { + m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + tp = (struct tcphdr *)(mtod(m_head, char *) + poff); + m_head = m_pullup(m_head, poff + (tp->th_off << 2)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m_head, char *) + ip_off); + tp = (struct tcphdr *)(mtod(m_head, char *) + poff); + } else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) { + m_head = m_pullup(m_head, poff + sizeof(struct udphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m_head, char *) + ip_off); + } + *m_headp = m_head; } /* @@ -2049,12 +1893,12 @@ em_xmit(struct adapter *adapter, struct mbuf **m_headp) * of the EOP which is the only one that * now gets a DONE bit writeback. */ - first = adapter->next_avail_tx_desc; - tx_buffer = &adapter->tx_buffer_area[first]; + first = txr->next_avail_desc; + tx_buffer = &txr->tx_buffers[first]; tx_buffer_mapped = tx_buffer; map = tx_buffer->map; - error = bus_dmamap_load_mbuf_sg(adapter->txtag, map, + error = bus_dmamap_load_mbuf_sg(txr->txtag, map, *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); /* @@ -2079,7 +1923,7 @@ em_xmit(struct adapter *adapter, struct mbuf **m_headp) *m_headp = m; /* Try it again */ - error = bus_dmamap_load_mbuf_sg(adapter->txtag, map, + error = bus_dmamap_load_mbuf_sg(txr->txtag, map, *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); if (error == ENOMEM) { @@ -2091,6 +1935,7 @@ em_xmit(struct adapter *adapter, struct mbuf **m_headp) *m_headp = NULL; return (error); } + } else if (error == ENOMEM) { adapter->no_tx_dma_setup++; return (error); @@ -2107,154 +1952,90 @@ em_xmit(struct adapter *adapter, struct mbuf **m_headp) * it follows a TSO burst, then we need to add a * sentinel descriptor to prevent premature writeback. */ - if ((do_tso == 0) && (adapter->tx_tso == TRUE)) { + if ((do_tso == 0) && (txr->tx_tso == TRUE)) { if (nsegs == 1) tso_desc = TRUE; - adapter->tx_tso = FALSE; + txr->tx_tso = FALSE; } - if (nsegs > (adapter->num_tx_desc_avail - 2)) { - adapter->no_tx_desc_avail2++; - bus_dmamap_unload(adapter->txtag, map); + if (nsegs > (txr->tx_avail - 2)) { + txr->no_desc_avail++; + bus_dmamap_unload(txr->txtag, map); return (ENOBUFS); } m_head = *m_headp; /* Do hardware assists */ -#if __FreeBSD_version >= 700000 if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { - error = em_tso_setup(adapter, m_head, &txd_upper, &txd_lower); - if (error != TRUE) - return (ENXIO); /* something foobar */ + em_tso_setup(txr, m_head, ip_off, ip, tp, + &txd_upper, &txd_lower); /* we need to make a final sentinel transmit desc */ tso_desc = TRUE; - } else -#endif -#ifndef EM_TIMESYNC - /* - ** Timesync needs to check the packet header - ** so call checksum code to do so, but don't - ** penalize the code if not defined. - */ - if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) -#endif - em_transmit_checksum_setup(adapter, m_head, - &txd_upper, &txd_lower); + } else if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) + em_transmit_checksum_setup(txr, m_head, + ip_off, ip, &txd_upper, &txd_lower); - i = adapter->next_avail_tx_desc; - if (adapter->pcix_82544) - txd_saved = i; + i = txr->next_avail_desc; /* Set up our transmit descriptors */ for (j = 0; j < nsegs; j++) { bus_size_t seg_len; bus_addr_t seg_addr; - /* If adapter is 82544 and on PCIX bus */ - if(adapter->pcix_82544) { - DESC_ARRAY desc_array; - u32 array_elements, counter; - /* - * Check the Address and Length combination and - * split the data accordingly - */ - array_elements = em_fill_descriptors(segs[j].ds_addr, - segs[j].ds_len, &desc_array); - for (counter = 0; counter < array_elements; counter++) { - if (txd_used == adapter->num_tx_desc_avail) { - adapter->next_avail_tx_desc = txd_saved; - adapter->no_tx_desc_avail2++; - bus_dmamap_unload(adapter->txtag, map); - return (ENOBUFS); - } - tx_buffer = &adapter->tx_buffer_area[i]; - ctxd = &adapter->tx_desc_base[i]; - ctxd->buffer_addr = htole64( - desc_array.descriptor[counter].address); - ctxd->lower.data = htole32( - (adapter->txd_cmd | txd_lower | (u16) - desc_array.descriptor[counter].length)); - ctxd->upper.data = - htole32((txd_upper)); - last = i; - if (++i == adapter->num_tx_desc) - i = 0; - tx_buffer->m_head = NULL; - tx_buffer->next_eop = -1; - txd_used++; - } + + tx_buffer = &txr->tx_buffers[i]; + ctxd = &txr->tx_base[i]; + seg_addr = segs[j].ds_addr; + seg_len = segs[j].ds_len; + /* + ** TSO Workaround: + ** If this is the last descriptor, we want to + ** split it so we have a small final sentinel + */ + if (tso_desc && (j == (nsegs -1)) && (seg_len > 8)) { + seg_len -= 4; + ctxd->buffer_addr = htole64(seg_addr); + ctxd->lower.data = htole32( + adapter->txd_cmd | txd_lower | seg_len); + ctxd->upper.data = + htole32(txd_upper); + if (++i == adapter->num_tx_desc) + i = 0; + /* Now make the sentinel */ + ++txd_used; /* using an extra txd */ + ctxd = &txr->tx_base[i]; + tx_buffer = &txr->tx_buffers[i]; + ctxd->buffer_addr = + htole64(seg_addr + seg_len); + ctxd->lower.data = htole32( + adapter->txd_cmd | txd_lower | 4); + ctxd->upper.data = + htole32(txd_upper); + last = i; + if (++i == adapter->num_tx_desc) + i = 0; } else { - tx_buffer = &adapter->tx_buffer_area[i]; - ctxd = &adapter->tx_desc_base[i]; - seg_addr = segs[j].ds_addr; - seg_len = segs[j].ds_len; - /* - ** TSO Workaround: - ** If this is the last descriptor, we want to - ** split it so we have a small final sentinel - */ - if (tso_desc && (j == (nsegs -1)) && (seg_len > 8)) { - seg_len -= 4; - ctxd->buffer_addr = htole64(seg_addr); - ctxd->lower.data = htole32( - adapter->txd_cmd | txd_lower | seg_len); - ctxd->upper.data = - htole32(txd_upper); - if (++i == adapter->num_tx_desc) - i = 0; - /* Now make the sentinel */ - ++txd_used; /* using an extra txd */ - ctxd = &adapter->tx_desc_base[i]; - tx_buffer = &adapter->tx_buffer_area[i]; - ctxd->buffer_addr = - htole64(seg_addr + seg_len); - ctxd->lower.data = htole32( - adapter->txd_cmd | txd_lower | 4); - ctxd->upper.data = - htole32(txd_upper); - last = i; - if (++i == adapter->num_tx_desc) - i = 0; - } else { - ctxd->buffer_addr = htole64(seg_addr); - ctxd->lower.data = htole32( - adapter->txd_cmd | txd_lower | seg_len); - ctxd->upper.data = - htole32(txd_upper); - last = i; - if (++i == adapter->num_tx_desc) - i = 0; - } - tx_buffer->m_head = NULL; - tx_buffer->next_eop = -1; + ctxd->buffer_addr = htole64(seg_addr); + ctxd->lower.data = htole32( + adapter->txd_cmd | txd_lower | seg_len); + ctxd->upper.data = + htole32(txd_upper); + last = i; + if (++i == adapter->num_tx_desc) + i = 0; } + tx_buffer->m_head = NULL; + tx_buffer->next_eop = -1; } - adapter->next_avail_tx_desc = i; - if (adapter->pcix_82544) - adapter->num_tx_desc_avail -= txd_used; - else { - adapter->num_tx_desc_avail -= nsegs; - if (tso_desc) /* TSO used an extra for sentinel */ - adapter->num_tx_desc_avail -= txd_used; - } + txr->next_avail_desc = i; + txr->tx_avail -= nsegs; + if (tso_desc) /* TSO used an extra for sentinel */ + txr->tx_avail -= txd_used; - /* - ** Handle VLAN tag, this is the - ** biggest difference between - ** 6.x and 7 - */ -#if __FreeBSD_version < 700000 - /* Find out if we are in vlan mode. */ - mtag = VLAN_OUTPUT_TAG(ifp, m_head); - if (mtag != NULL) { - ctxd->upper.fields.special = - htole16(VLAN_TAG_VALUE(mtag)); -#else /* FreeBSD 7 */ if (m_head->m_flags & M_VLANTAG) { /* Set the vlan id. */ ctxd->upper.fields.special = htole16(m_head->m_pkthdr.ether_vtag); -#endif /* Tell hardware to add tag */ ctxd->lower.data |= htole32(E1000_TXD_CMD_VLE); } @@ -2262,7 +2043,7 @@ em_xmit(struct adapter *adapter, struct mbuf **m_headp) tx_buffer->m_head = m_head; tx_buffer_mapped->map = tx_buffer->map; tx_buffer->map = map; - bus_dmamap_sync(adapter->txtag, map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); /* * Last Descriptor of Packet @@ -2275,150 +2056,22 @@ em_xmit(struct adapter *adapter, struct mbuf **m_headp) * Keep track in the first buffer which * descriptor will be written back */ - tx_buffer = &adapter->tx_buffer_area[first]; + tx_buffer = &txr->tx_buffers[first]; tx_buffer->next_eop = last; + /* Update the watchdog time early and often */ + txr->watchdog_time = ticks; /* * Advance the Transmit Descriptor Tail (TDT), this tells the E1000 * that this frame is available to transmit. */ - bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - if (adapter->hw.mac.type == e1000_82547 && - adapter->link_duplex == HALF_DUPLEX) - em_82547_move_tail(adapter); - else { - E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), i); - if (adapter->hw.mac.type == e1000_82547) - em_82547_update_fifo_head(adapter, - m_head->m_pkthdr.len); - } - -#ifdef EM_TIMESYNC - if (ctxd->upper.data & E1000_TXD_EXTCMD_TSTAMP) { - HW_DEBUGOUT( "@@@ Timestamp bit is set in transmit descriptor\n" ); - } -#endif - return (0); -} - -/********************************************************************* - * - * 82547 workaround to avoid controller hang in half-duplex environment. - * The workaround is to avoid queuing a large packet that would span - * the internal Tx FIFO ring boundary. We need to reset the FIFO pointers - * in this case. We do that only when FIFO is quiescent. - * - **********************************************************************/ -static void -em_82547_move_tail(void *arg) -{ - struct adapter *adapter = arg; - struct e1000_tx_desc *tx_desc; - u16 hw_tdt, sw_tdt, length = 0; - bool eop = 0; - - EM_TX_LOCK_ASSERT(adapter); - - hw_tdt = E1000_READ_REG(&adapter->hw, E1000_TDT(0)); - sw_tdt = adapter->next_avail_tx_desc; - - while (hw_tdt != sw_tdt) { - tx_desc = &adapter->tx_desc_base[hw_tdt]; - length += tx_desc->lower.flags.length; - eop = tx_desc->lower.data & E1000_TXD_CMD_EOP; - if (++hw_tdt == adapter->num_tx_desc) - hw_tdt = 0; - - if (eop) { - if (em_82547_fifo_workaround(adapter, length)) { - adapter->tx_fifo_wrk_cnt++; - callout_reset(&adapter->tx_fifo_timer, 1, - em_82547_move_tail, adapter); - break; - } - E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), hw_tdt); - em_82547_update_fifo_head(adapter, length); - length = 0; - } - } -} - -static int -em_82547_fifo_workaround(struct adapter *adapter, int len) -{ - int fifo_space, fifo_pkt_len; - - fifo_pkt_len = roundup2(len + EM_FIFO_HDR, EM_FIFO_HDR); - - if (adapter->link_duplex == HALF_DUPLEX) { - fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head; - - if (fifo_pkt_len >= (EM_82547_PKT_THRESH + fifo_space)) { - if (em_82547_tx_fifo_reset(adapter)) - return (0); - else - return (1); - } - } + E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), i); return (0); } -static void -em_82547_update_fifo_head(struct adapter *adapter, int len) -{ - int fifo_pkt_len = roundup2(len + EM_FIFO_HDR, EM_FIFO_HDR); - - /* tx_fifo_head is always 16 byte aligned */ - adapter->tx_fifo_head += fifo_pkt_len; - if (adapter->tx_fifo_head >= adapter->tx_fifo_size) { - adapter->tx_fifo_head -= adapter->tx_fifo_size; - } -} - - -static int -em_82547_tx_fifo_reset(struct adapter *adapter) -{ - u32 tctl; - - if ((E1000_READ_REG(&adapter->hw, E1000_TDT(0)) == - E1000_READ_REG(&adapter->hw, E1000_TDH(0))) && - (E1000_READ_REG(&adapter->hw, E1000_TDFT) == - E1000_READ_REG(&adapter->hw, E1000_TDFH)) && - (E1000_READ_REG(&adapter->hw, E1000_TDFTS) == - E1000_READ_REG(&adapter->hw, E1000_TDFHS)) && - (E1000_READ_REG(&adapter->hw, E1000_TDFPC) == 0)) { - /* Disable TX unit */ - tctl = E1000_READ_REG(&adapter->hw, E1000_TCTL); - E1000_WRITE_REG(&adapter->hw, E1000_TCTL, - tctl & ~E1000_TCTL_EN); - - /* Reset FIFO pointers */ - E1000_WRITE_REG(&adapter->hw, E1000_TDFT, - adapter->tx_head_addr); - E1000_WRITE_REG(&adapter->hw, E1000_TDFH, - adapter->tx_head_addr); - E1000_WRITE_REG(&adapter->hw, E1000_TDFTS, - adapter->tx_head_addr); - E1000_WRITE_REG(&adapter->hw, E1000_TDFHS, - adapter->tx_head_addr); - - /* Re-enable TX unit */ - E1000_WRITE_REG(&adapter->hw, E1000_TCTL, tctl); - E1000_WRITE_FLUSH(&adapter->hw); - - adapter->tx_fifo_head = 0; - adapter->tx_fifo_reset_cnt++; - - return (TRUE); - } - else { - return (FALSE); - } -} - static void em_set_promisc(struct adapter *adapter) { @@ -2467,11 +2120,14 @@ em_set_multi(struct adapter *adapter) struct ifnet *ifp = adapter->ifp; struct ifmultiaddr *ifma; u32 reg_rctl = 0; - u8 mta[512]; /* Largest MTS is 4096 bits */ + u8 *mta; /* Multicast array memory */ int mcnt = 0; IOCTL_DEBUGOUT("em_set_multi: begin"); + mta = adapter->mta; + bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES); + if (adapter->hw.mac.type == e1000_82542 && adapter->hw.revision_id == E1000_REVISION_2) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); @@ -2482,7 +2138,11 @@ em_set_multi(struct adapter *adapter) msec_delay(5); } +#if __FreeBSD_version < 800000 IF_ADDR_LOCK(ifp); +#else + if_maddr_rlock(ifp); +#endif TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -2494,15 +2154,17 @@ em_set_multi(struct adapter *adapter) &mta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN); mcnt++; } +#if __FreeBSD_version < 800000 IF_ADDR_UNLOCK(ifp); - +#else + if_maddr_runlock(ifp); +#endif if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); reg_rctl |= E1000_RCTL_MPE; E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); } else - e1000_update_mc_addr_list(&adapter->hw, mta, - mcnt, 1, adapter->hw.mac.rar_entry_count); + e1000_update_mc_addr_list(&adapter->hw, mta, mcnt); if (adapter->hw.mac.type == e1000_82542 && adapter->hw.revision_id == E1000_REVISION_2) { @@ -2528,6 +2190,8 @@ em_local_timer(void *arg) { struct adapter *adapter = arg; struct ifnet *ifp = adapter->ifp; + struct tx_ring *txr = adapter->tx_rings; + int i = 0; EM_CORE_LOCK_ASSERT(adapter); @@ -2535,30 +2199,51 @@ em_local_timer(void *arg) em_update_stats_counters(adapter); /* Reset LAA into RAR[0] on 82571 */ - if (e1000_get_laa_state_82571(&adapter->hw) == TRUE) + if ((adapter->hw.mac.type == e1000_82571) && + e1000_get_laa_state_82571(&adapter->hw)) e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); - if (em_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING) - em_print_hw_stats(adapter); - - em_smartspeed(adapter); - + /* + ** Don't do TX watchdog check if we've been paused + */ + if (adapter->pause_frames) { + adapter->pause_frames = 0; + goto out; + } /* - * Each second we check the watchdog to - * protect against hardware hangs. - */ - em_watchdog(adapter); - + ** Check on the state of the TX queue(s), this + ** can be done without the lock because its RO + ** and the HUNG state will be static if set. + */ + for (i = 0; i < adapter->num_queues; i++, txr++) + if (txr->queue_status == EM_QUEUE_HUNG) + goto hung; +out: callout_reset(&adapter->timer, hz, em_local_timer, adapter); - + return; +hung: + /* Looks like we're hung */ + device_printf(adapter->dev, "Watchdog timeout -- resetting\n"); + device_printf(adapter->dev, + "Queue(%d) tdh = %d, hw tdt = %d\n", txr->me, + E1000_READ_REG(&adapter->hw, E1000_TDH(txr->me)), + E1000_READ_REG(&adapter->hw, E1000_TDT(txr->me))); + device_printf(adapter->dev,"TX(%d) desc avail = %d," + "Next TX to Clean = %d\n", + txr->me, txr->tx_avail, txr->next_to_clean); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + adapter->watchdog_events++; + em_init_locked(adapter); } + static void em_update_link_status(struct adapter *adapter) { struct e1000_hw *hw = &adapter->hw; struct ifnet *ifp = adapter->ifp; device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; u32 link_check = 0; /* Get the cached link value or read phy for real */ @@ -2610,13 +2295,15 @@ em_update_link_status(struct adapter *adapter) ifp->if_baudrate = adapter->link_speed * 1000000; if_link_state_change(ifp, LINK_STATE_UP); } else if (!link_check && (adapter->link_active == 1)) { + int i = 0; ifp->if_baudrate = adapter->link_speed = 0; adapter->link_duplex = 0; if (bootverbose) device_printf(dev, "Link is Down\n"); adapter->link_active = 0; /* Link down, disable watchdog */ - adapter->watchdog_timer = FALSE; + for (i = 0; i < adapter->num_queues; i++, txr++) + txr->queue_status = EM_QUEUE_IDLE; if_link_state_change(ifp, LINK_STATE_DOWN); } } @@ -2635,29 +2322,31 @@ em_stop(void *arg) { struct adapter *adapter = arg; struct ifnet *ifp = adapter->ifp; + struct tx_ring *txr = adapter->tx_rings; + int i = 0; EM_CORE_LOCK_ASSERT(adapter); - EM_TX_LOCK_ASSERT(adapter); INIT_DEBUGOUT("em_stop: begin"); em_disable_intr(adapter); callout_stop(&adapter->timer); - callout_stop(&adapter->tx_fifo_timer); /* Tell the stack that the interface is no longer active */ ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); -#ifdef EM_TIMESYNC - /* Disable IEEE 1588 Time hardware */ - if ((adapter->hw.mac.type == e1000_82574) || - (adapter->hw.mac.type == e1000_ich10lan)) - em_tsync_disable(adapter); -#endif + /* Unarm watchdog timer. */ + for (i = 0; i < adapter->num_queues; i++, txr++) { + EM_TX_LOCK(txr); + txr->queue_status = EM_QUEUE_IDLE; + EM_TX_UNLOCK(txr); + } e1000_reset_hw(&adapter->hw); - if (adapter->hw.mac.type >= e1000_82544) - E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); + E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); + + e1000_led_off(&adapter->hw); + e1000_cleanup_led(&adapter->hw); } @@ -2703,7 +2392,7 @@ static int em_allocate_pci_resources(struct adapter *adapter) { device_t dev = adapter->dev; - int i, val, rid, error = E1000_SUCCESS; + int rid; rid = PCIR_BAR(0); adapter->memory = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -2718,58 +2407,17 @@ em_allocate_pci_resources(struct adapter *adapter) rman_get_bushandle(adapter->memory); adapter->hw.hw_addr = (u8 *)&adapter->osdep.mem_bus_space_handle; - /* Only older adapters use IO mapping */ - if ((adapter->hw.mac.type > e1000_82543) && - (adapter->hw.mac.type < e1000_82571)) { - /* Figure our where our IO BAR is ? */ - for (rid = PCIR_BAR(0); rid < PCIR_CIS;) { - val = pci_read_config(dev, rid, 4); - if (EM_BAR_TYPE(val) == EM_BAR_TYPE_IO) { - adapter->io_rid = rid; - break; - } - rid += 4; - /* check for 64bit BAR */ - if (EM_BAR_MEM_TYPE(val) == EM_BAR_MEM_TYPE_64BIT) - rid += 4; - } - if (rid >= PCIR_CIS) { - device_printf(dev, "Unable to locate IO BAR\n"); - return (ENXIO); - } - adapter->ioport = bus_alloc_resource_any(dev, - SYS_RES_IOPORT, &adapter->io_rid, RF_ACTIVE); - if (adapter->ioport == NULL) { - device_printf(dev, "Unable to allocate bus resource: " - "ioport\n"); - return (ENXIO); - } - adapter->hw.io_base = 0; - adapter->osdep.io_bus_space_tag = - rman_get_bustag(adapter->ioport); - adapter->osdep.io_bus_space_handle = - rman_get_bushandle(adapter->ioport); - } - - /* - ** Init the resource arrays - ** used by MSIX setup - */ - for (i = 0; i < 3; i++) { - adapter->rid[i] = i + 1; /* MSI/X RID starts at 1 */ - adapter->tag[i] = NULL; - adapter->res[i] = NULL; - } + /* Default to a single queue */ + adapter->num_queues = 1; /* * Setup MSI/X or MSI if PCI Express */ - if (em_enable_msi) - adapter->msi = em_setup_msix(adapter); + adapter->msix = em_setup_msix(adapter); adapter->hw.back = &adapter->osdep; - return (error); + return (0); } /********************************************************************* @@ -2781,63 +2429,40 @@ int em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; - int error; + int error, rid = 0; /* Manually turn off all interrupts */ E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); - /* Legacy RID is 0 */ - if (adapter->msi == 0) - adapter->rid[0] = 0; - + if (adapter->msix == 1) /* using MSI */ + rid = 1; /* We allocate a single interrupt resource */ - adapter->res[0] = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &adapter->rid[0], RF_SHAREABLE | RF_ACTIVE); - if (adapter->res[0] == NULL) { + adapter->res = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); + if (adapter->res == NULL) { device_printf(dev, "Unable to allocate bus resource: " "interrupt\n"); return (ENXIO); } -#ifdef EM_LEGACY_IRQ - /* We do Legacy setup */ - if ((error = bus_setup_intr(dev, adapter->res[0], -#if __FreeBSD_version > 700000 - INTR_TYPE_NET | INTR_MPSAFE, NULL, em_intr, adapter, -#else /* 6.X */ - INTR_TYPE_NET | INTR_MPSAFE, em_intr, adapter, -#endif - &adapter->tag[0])) != 0) { - device_printf(dev, "Failed to register interrupt handler"); - return (error); - } - -#else /* FAST_IRQ */ /* - * Try allocating a fast interrupt and the associated deferred - * processing contexts. + * Allocate a fast interrupt and the associated + * deferred processing contexts. */ - TASK_INIT(&adapter->rxtx_task, 0, em_handle_rxtx, adapter); + TASK_INIT(&adapter->que_task, 0, em_handle_que, adapter); TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); adapter->tq = taskqueue_create_fast("em_taskq", M_NOWAIT, taskqueue_thread_enqueue, &adapter->tq); taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", device_get_nameunit(adapter->dev)); -#if __FreeBSD_version < 700000 - if ((error = bus_setup_intr(dev, adapter->res[0], - INTR_TYPE_NET | INTR_FAST, em_irq_fast, adapter, -#else - if ((error = bus_setup_intr(dev, adapter->res[0], - INTR_TYPE_NET, em_irq_fast, NULL, adapter, -#endif - &adapter->tag[0])) != 0) { + if ((error = bus_setup_intr(dev, adapter->res, INTR_TYPE_NET, + em_irq_fast, NULL, adapter, &adapter->tag)) != 0) { device_printf(dev, "Failed to register fast interrupt " "handler: %d\n", error); taskqueue_free(adapter->tq); adapter->tq = NULL; return (error); } -#endif /* EM_LEGACY_IRQ */ return (0); } @@ -2852,112 +2477,174 @@ em_allocate_legacy(struct adapter *adapter) int em_allocate_msix(struct adapter *adapter) { - device_t dev = adapter->dev; - int error, i; + device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + int error, rid, vector = 0, i = 0; + /* Make sure all interrupts are disabled */ E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); - /* First get the resources */ - for (i = 0; i < adapter->msi; i++) { - adapter->res[i] = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &adapter->rid[i], RF_ACTIVE); - if (adapter->res[i] == NULL) { + /* First set up ring resources */ + for (i = 0; i < adapter->num_queues; i++, txr++, rxr++) { + + /* RX ring */ + rid = vector + 1; + + rxr->res = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_ACTIVE); + if (rxr->res == NULL) { device_printf(dev, "Unable to allocate bus resource: " - "MSIX Interrupt\n"); + "RX MSIX Interrupt %d\n", i); return (ENXIO); } + if ((error = bus_setup_intr(dev, rxr->res, + INTR_TYPE_NET | INTR_MPSAFE, NULL, em_msix_rx, + rxr, &rxr->tag)) != 0) { + device_printf(dev, "Failed to register RX handler"); + return (error); + } +#if __FreeBSD_version >= 800504 + bus_describe_intr(dev, rxr->res, rxr->tag, "rx %d", i); +#endif + rxr->msix = vector++; /* NOTE increment vector for TX */ + TASK_INIT(&rxr->rx_task, 0, em_handle_rx, rxr); + rxr->tq = taskqueue_create_fast("em_rxq", M_NOWAIT, + taskqueue_thread_enqueue, &rxr->tq); + taskqueue_start_threads(&rxr->tq, 1, PI_NET, "%s rxq", + device_get_nameunit(adapter->dev)); + /* + ** Set the bit to enable interrupt + ** in E1000_IMS -- bits 20 and 21 + ** are for RX0 and RX1, note this has + ** NOTHING to do with the MSIX vector + */ + rxr->ims = 1 << (20 + i); + adapter->ivars |= (8 | rxr->msix) << (i * 4); + + /* TX ring */ + rid = vector + 1; + txr->res = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_ACTIVE); + if (txr->res == NULL) { + device_printf(dev, + "Unable to allocate bus resource: " + "TX MSIX Interrupt %d\n", i); + return (ENXIO); + } + if ((error = bus_setup_intr(dev, txr->res, + INTR_TYPE_NET | INTR_MPSAFE, NULL, em_msix_tx, + txr, &txr->tag)) != 0) { + device_printf(dev, "Failed to register TX handler"); + return (error); + } +#if __FreeBSD_version >= 800504 + bus_describe_intr(dev, txr->res, txr->tag, "tx %d", i); +#endif + txr->msix = vector++; /* Increment vector for next pass */ + TASK_INIT(&txr->tx_task, 0, em_handle_tx, txr); + txr->tq = taskqueue_create_fast("em_txq", M_NOWAIT, + taskqueue_thread_enqueue, &txr->tq); + taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq", + device_get_nameunit(adapter->dev)); + /* + ** Set the bit to enable interrupt + ** in E1000_IMS -- bits 22 and 23 + ** are for TX0 and TX1, note this has + ** NOTHING to do with the MSIX vector + */ + txr->ims = 1 << (22 + i); + adapter->ivars |= (8 | txr->msix) << (8 + (i * 4)); } - /* - * Now allocate deferred processing contexts. - */ - TASK_INIT(&adapter->rx_task, 0, em_handle_rx, adapter); - TASK_INIT(&adapter->tx_task, 0, em_handle_tx, adapter); - TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); - adapter->tq = taskqueue_create_fast("em_taskq", M_NOWAIT, - taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", - device_get_nameunit(adapter->dev)); - - /* - * And setup the interrupt handlers - */ - - /* First slot to RX */ - if ((error = bus_setup_intr(dev, adapter->res[0], -#if __FreeBSD_version > 700000 - INTR_TYPE_NET | INTR_MPSAFE, NULL, em_msix_rx, adapter, -#else /* 6.X */ - INTR_TYPE_NET | INTR_MPSAFE, em_msix_rx, adapter, -#endif - &adapter->tag[0])) != 0) { - device_printf(dev, "Failed to register RX handler"); + /* Link interrupt */ + ++rid; + adapter->res = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_ACTIVE); + if (!adapter->res) { + device_printf(dev,"Unable to allocate " + "bus resource: Link interrupt [%d]\n", rid); + return (ENXIO); + } + /* Set the link handler function */ + error = bus_setup_intr(dev, adapter->res, + INTR_TYPE_NET | INTR_MPSAFE, NULL, + em_msix_link, adapter, &adapter->tag); + if (error) { + adapter->res = NULL; + device_printf(dev, "Failed to register LINK handler"); return (error); } - - /* Next TX */ - if ((error = bus_setup_intr(dev, adapter->res[1], -#if __FreeBSD_version > 700000 - INTR_TYPE_NET | INTR_MPSAFE, NULL, em_msix_tx, adapter, -#else /* 6.X */ - INTR_TYPE_NET | INTR_MPSAFE, em_msix_tx, adapter, +#if __FreeBSD_version >= 800504 + bus_describe_intr(dev, adapter->res, adapter->tag, "link"); #endif - &adapter->tag[1])) != 0) { - device_printf(dev, "Failed to register TX handler"); - return (error); - } - - /* And Link */ - if ((error = bus_setup_intr(dev, adapter->res[2], -#if __FreeBSD_version > 700000 - INTR_TYPE_NET | INTR_MPSAFE, NULL, em_msix_link, adapter, -#else /* 6.X */ - INTR_TYPE_NET | INTR_MPSAFE, em_msix_link, adapter, -#endif - &adapter->tag[2])) != 0) { - device_printf(dev, "Failed to register TX handler"); - return (error); - } + adapter->linkvec = vector; + adapter->ivars |= (8 | vector) << 16; + adapter->ivars |= 0x80000000; return (0); } + static void em_free_pci_resources(struct adapter *adapter) { - device_t dev = adapter->dev; - int i; + device_t dev = adapter->dev; + struct tx_ring *txr; + struct rx_ring *rxr; + int rid; + int i = 0; - /* Make sure the for loop below runs once */ - if (adapter->msi == 0) - adapter->msi = 1; /* - * First release all the interrupt resources: - * notice that since these are just kept - * in an array we can do the same logic - * whether its MSIX or just legacy. - */ - for (i = 0; i < adapter->msi; i++) { - if (adapter->tag[i] != NULL) { - bus_teardown_intr(dev, adapter->res[i], - adapter->tag[i]); - adapter->tag[i] = NULL; + ** Release all the queue interrupt resources: + */ + for (i = 0; i < adapter->num_queues; i++) { + txr = &adapter->tx_rings[i]; + rxr = &adapter->rx_rings[i]; + /* an early abort? */ + if ((txr == NULL) || (rxr == NULL)) + break; + rid = txr->msix +1; + if (txr->tag != NULL) { + bus_teardown_intr(dev, txr->res, txr->tag); + txr->tag = NULL; } - if (adapter->res[i] != NULL) { + if (txr->res != NULL) bus_release_resource(dev, SYS_RES_IRQ, - adapter->rid[i], adapter->res[i]); + rid, txr->res); + rid = rxr->msix +1; + if (rxr->tag != NULL) { + bus_teardown_intr(dev, rxr->res, rxr->tag); + rxr->tag = NULL; } + if (rxr->res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rid, rxr->res); } - if (adapter->msi) + if (adapter->linkvec) /* we are doing MSIX */ + rid = adapter->linkvec + 1; + else + (adapter->msix != 0) ? (rid = 1):(rid = 0); + + if (adapter->tag != NULL) { + bus_teardown_intr(dev, adapter->res, adapter->tag); + adapter->tag = NULL; + } + + if (adapter->res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, rid, adapter->res); + + + if (adapter->msix) pci_release_msi(dev); - if (adapter->msix != NULL) + if (adapter->msix_mem != NULL) bus_release_resource(dev, SYS_RES_MEMORY, - PCIR_BAR(EM_MSIX_BAR), adapter->msix); + PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem); if (adapter->memory != NULL) bus_release_resource(dev, SYS_RES_MEMORY, @@ -2966,14 +2653,10 @@ em_free_pci_resources(struct adapter *adapter) if (adapter->flash != NULL) bus_release_resource(dev, SYS_RES_MEMORY, EM_FLASH, adapter->flash); - - if (adapter->ioport != NULL) - bus_release_resource(dev, SYS_RES_IOPORT, - adapter->io_rid, adapter->ioport); } /* - * Setup MSI/X + * Setup MSI or MSI/X */ static int em_setup_msix(struct adapter *adapter) @@ -2981,81 +2664,82 @@ em_setup_msix(struct adapter *adapter) device_t dev = adapter->dev; int val = 0; - if (adapter->hw.mac.type < e1000_82571) - return (0); - /* Setup MSI/X for Hartwell */ - if (adapter->hw.mac.type == e1000_82574) { + /* + ** Setup MSI/X for Hartwell: tests have shown + ** use of two queues to be unstable, and to + ** provide no great gain anyway, so we simply + ** seperate the interrupts and use a single queue. + */ + if ((adapter->hw.mac.type == e1000_82574) && + (em_enable_msix == TRUE)) { /* Map the MSIX BAR */ int rid = PCIR_BAR(EM_MSIX_BAR); - adapter->msix = bus_alloc_resource_any(dev, + adapter->msix_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (!adapter->msix) { + if (!adapter->msix_mem) { /* May not be enabled */ device_printf(adapter->dev, "Unable to map MSIX table \n"); goto msi; } val = pci_msix_count(dev); - /* - ** 82574 can be configured for 5 but - ** we limit use to 3. - */ - if (val > 3) val = 3; - if ((val) && pci_alloc_msix(dev, &val) == 0) { - device_printf(adapter->dev,"Using MSIX interrupts\n"); - return (val); + if (val < 3) { + bus_release_resource(dev, SYS_RES_MEMORY, + PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem); + adapter->msix_mem = NULL; + device_printf(adapter->dev, + "MSIX: insufficient vectors, using MSI\n"); + goto msi; } + val = 3; + adapter->num_queues = 1; + if (pci_alloc_msix(dev, &val) == 0) { + device_printf(adapter->dev, + "Using MSIX interrupts " + "with %d vectors\n", val); + } + + return (val); } msi: val = pci_msi_count(dev); if (val == 1 && pci_alloc_msi(dev, &val) == 0) { - adapter->msi = 1; - device_printf(adapter->dev,"Using MSI interrupt\n"); + adapter->msix = 1; + device_printf(adapter->dev,"Using an MSI interrupt\n"); return (val); } + /* Should only happen due to manual configuration */ + device_printf(adapter->dev,"No MSI/MSIX using a Legacy IRQ\n"); return (0); } + /********************************************************************* * * Initialize the hardware to a configuration * as specified by the adapter structure. * **********************************************************************/ -static int -em_hardware_init(struct adapter *adapter) +static void +em_reset(struct adapter *adapter) { - device_t dev = adapter->dev; - u16 rx_buffer_size; + device_t dev = adapter->dev; + struct ifnet *ifp = adapter->ifp; + struct e1000_hw *hw = &adapter->hw; + u16 rx_buffer_size; - INIT_DEBUGOUT("em_hardware_init: begin"); - - /* Issue a global reset */ - e1000_reset_hw(&adapter->hw); - - /* Get control from any management/hw control */ - if (((adapter->hw.mac.type == e1000_82573) || - (adapter->hw.mac.type == e1000_ich8lan) || - (adapter->hw.mac.type == e1000_ich10lan) || - (adapter->hw.mac.type == e1000_ich9lan)) && - e1000_check_mng_mode(&adapter->hw)) - em_get_hw_control(adapter); - - /* When hardware is reset, fifo_head is also reset */ - adapter->tx_fifo_head = 0; + INIT_DEBUGOUT("em_reset: begin"); /* Set up smart power down as default off on newer adapters. */ - if (!em_smart_pwr_down && (adapter->hw.mac.type == e1000_82571 || - adapter->hw.mac.type == e1000_82572)) { + if (!em_smart_pwr_down && (hw->mac.type == e1000_82571 || + hw->mac.type == e1000_82572)) { u16 phy_tmp = 0; /* Speed up time to link by disabling smart power down. */ - e1000_read_phy_reg(&adapter->hw, - IGP02E1000_PHY_POWER_MGMT, &phy_tmp); + e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_tmp); phy_tmp &= ~IGP02E1000_PM_SPD; - e1000_write_phy_reg(&adapter->hw, - IGP02E1000_PHY_POWER_MGMT, phy_tmp); + e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_tmp); } /* @@ -3072,28 +2756,53 @@ em_hardware_init(struct adapter *adapter) * by 1500. * - The pause time is fairly large at 1000 x 512ns = 512 usec. */ - rx_buffer_size = ((E1000_READ_REG(&adapter->hw, E1000_PBA) & - 0xffff) << 10 ); + rx_buffer_size = ((E1000_READ_REG(hw, E1000_PBA) & 0xffff) << 10 ); - adapter->hw.fc.high_water = rx_buffer_size - + hw->fc.high_water = rx_buffer_size - roundup2(adapter->max_frame_size, 1024); - adapter->hw.fc.low_water = adapter->hw.fc.high_water - 1500; + hw->fc.low_water = hw->fc.high_water - 1500; - if (adapter->hw.mac.type == e1000_80003es2lan) - adapter->hw.fc.pause_time = 0xFFFF; + if (hw->mac.type == e1000_80003es2lan) + hw->fc.pause_time = 0xFFFF; else - adapter->hw.fc.pause_time = EM_FC_PAUSE_TIME; - adapter->hw.fc.send_xon = TRUE; - adapter->hw.fc.requested_mode = e1000_fc_full; + hw->fc.pause_time = EM_FC_PAUSE_TIME; - if (e1000_init_hw(&adapter->hw) < 0) { - device_printf(dev, "Hardware Initialization Failed\n"); - return (EIO); + hw->fc.send_xon = TRUE; + + /* Set Flow control, use the tunable location if sane */ + hw->fc.requested_mode = adapter->fc_setting; + + /* Workaround: no TX flow ctrl for PCH */ + if (hw->mac.type == e1000_pchlan) + hw->fc.requested_mode = e1000_fc_rx_pause; + + /* Override - settings for PCH2LAN, ya its magic :) */ + if (hw->mac.type == e1000_pch2lan) { + hw->fc.high_water = 0x5C20; + hw->fc.low_water = 0x5048; + hw->fc.pause_time = 0x0650; + hw->fc.refresh_time = 0x0400; + /* Jumbos need adjusted PBA */ + if (ifp->if_mtu > ETHERMTU) + E1000_WRITE_REG(hw, E1000_PBA, 12); + else + E1000_WRITE_REG(hw, E1000_PBA, 26); } - e1000_check_for_link(&adapter->hw); + /* Issue a global reset */ + e1000_reset_hw(hw); + E1000_WRITE_REG(hw, E1000_WUC, 0); + em_disable_aspm(adapter); - return (0); + if (e1000_init_hw(hw) < 0) { + device_printf(dev, "Hardware Initialization Failed\n"); + return; + } + + E1000_WRITE_REG(hw, E1000_VET, ETHERTYPE_VLAN); + e1000_get_phy_info(hw); + e1000_check_for_link(hw); + return; } /********************************************************************* @@ -3101,7 +2810,7 @@ em_hardware_init(struct adapter *adapter) * Setup networking device structure and register an interface. * **********************************************************************/ -static void +static int em_setup_interface(device_t dev, struct adapter *adapter) { struct ifnet *ifp; @@ -3109,8 +2818,10 @@ em_setup_interface(device_t dev, struct adapter *adapter) INIT_DEBUGOUT("em_setup_interface: begin"); ifp = adapter->ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) - panic("%s: can not if_alloc()", device_get_nameunit(dev)); + if (ifp == NULL) { + device_printf(dev, "can not allocate ifnet structure\n"); + return (-1); + } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; ifp->if_init = em_init; @@ -3126,41 +2837,47 @@ em_setup_interface(device_t dev, struct adapter *adapter) ifp->if_capabilities = ifp->if_capenable = 0; - if (adapter->hw.mac.type >= e1000_82543) { - int version_cap; -#if __FreeBSD_version < 700000 - version_cap = IFCAP_HWCSUM; -#else - version_cap = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; -#endif - ifp->if_capabilities |= version_cap; - ifp->if_capenable |= version_cap; - } +#ifdef EM_MULTIQUEUE + /* Multiqueue tx functions */ + ifp->if_transmit = em_mq_start; + ifp->if_qflush = em_qflush; +#endif -#if __FreeBSD_version >= 700000 - /* Identify TSO capable adapters */ - if ((adapter->hw.mac.type > e1000_82544) && - (adapter->hw.mac.type != e1000_82547)) - ifp->if_capabilities |= IFCAP_TSO4; - /* - * By default only enable on PCI-E, this - * can be overriden by ifconfig. - */ - if (adapter->hw.mac.type >= e1000_82571) - ifp->if_capenable |= IFCAP_TSO4; -#endif + ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; + ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; + + /* Enable TSO by default, can disable with ifconfig */ + ifp->if_capabilities |= IFCAP_TSO4; + ifp->if_capenable |= IFCAP_TSO4; /* - * Tell the upper layer(s) we support long frames. + * Tell the upper layer(s) we + * support full VLAN capability */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + /* + ** Dont turn this on by default, if vlans are + ** created on another pseudo device (eg. lagg) + ** then vlan events are not passed thru, breaking + ** operation, but with HW FILTER off it works. If + ** using vlans directly on the em driver you can + ** enable this and get full hardware tag filtering. + */ + ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; + #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; #endif + /* Enable only WOL MAGIC by default */ + if (adapter->wol) { + ifp->if_capabilities |= IFCAP_WOL; + ifp->if_capenable |= IFCAP_WOL_MAGIC; + } + /* * Specify the media types supported by this adapter and register * callbacks to update media and link information @@ -3171,8 +2888,6 @@ em_setup_interface(device_t dev, struct adapter *adapter) (adapter->hw.phy.media_type == e1000_media_type_internal_serdes)) { u_char fiber_type = IFM_1000_SX; /* default type */ - if (adapter->hw.mac.type == e1000_82545) - fiber_type = IFM_1000_LX; ifmedia_add(&adapter->media, IFM_ETHER | fiber_type | IFM_FDX, 0, NULL); ifmedia_add(&adapter->media, IFM_ETHER | fiber_type, 0, NULL); @@ -3193,67 +2908,7 @@ em_setup_interface(device_t dev, struct adapter *adapter) } ifmedia_add(&adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO); -} - - -/********************************************************************* - * - * Workaround for SmartSpeed on 82541 and 82547 controllers - * - **********************************************************************/ -static void -em_smartspeed(struct adapter *adapter) -{ - u16 phy_tmp; - - if (adapter->link_active || (adapter->hw.phy.type != e1000_phy_igp) || - adapter->hw.mac.autoneg == 0 || - (adapter->hw.phy.autoneg_advertised & ADVERTISE_1000_FULL) == 0) - return; - - if (adapter->smartspeed == 0) { - /* If Master/Slave config fault is asserted twice, - * we assume back-to-back */ - e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_tmp); - if (!(phy_tmp & SR_1000T_MS_CONFIG_FAULT)) - return; - e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_tmp); - if (phy_tmp & SR_1000T_MS_CONFIG_FAULT) { - e1000_read_phy_reg(&adapter->hw, - PHY_1000T_CTRL, &phy_tmp); - if(phy_tmp & CR_1000T_MS_ENABLE) { - phy_tmp &= ~CR_1000T_MS_ENABLE; - e1000_write_phy_reg(&adapter->hw, - PHY_1000T_CTRL, phy_tmp); - adapter->smartspeed++; - if(adapter->hw.mac.autoneg && - !e1000_phy_setup_autoneg(&adapter->hw) && - !e1000_read_phy_reg(&adapter->hw, - PHY_CONTROL, &phy_tmp)) { - phy_tmp |= (MII_CR_AUTO_NEG_EN | - MII_CR_RESTART_AUTO_NEG); - e1000_write_phy_reg(&adapter->hw, - PHY_CONTROL, phy_tmp); - } - } - } - return; - } else if(adapter->smartspeed == EM_SMARTSPEED_DOWNSHIFT) { - /* If still no link, perhaps using 2/3 pair cable */ - e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_tmp); - phy_tmp |= CR_1000T_MS_ENABLE; - e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_tmp); - if(adapter->hw.mac.autoneg && - !e1000_phy_setup_autoneg(&adapter->hw) && - !e1000_read_phy_reg(&adapter->hw, PHY_CONTROL, &phy_tmp)) { - phy_tmp |= (MII_CR_AUTO_NEG_EN | - MII_CR_RESTART_AUTO_NEG); - e1000_write_phy_reg(&adapter->hw, PHY_CONTROL, phy_tmp); - } - } - /* Restart process after EM_SMARTSPEED_MAX iterations */ - if(adapter->smartspeed++ == EM_SMARTSPEED_MAX) - adapter->smartspeed = 0; + return (0); } @@ -3274,11 +2929,7 @@ em_dma_malloc(struct adapter *adapter, bus_size_t size, { int error; -#if __FreeBSD_version >= 700000 error = bus_dma_tag_create(bus_get_dma_tag(adapter->dev), /* parent */ -#else - error = bus_dma_tag_create(NULL, /* parent */ -#endif EM_DBA_ALIGN, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ @@ -3349,98 +3000,263 @@ em_dma_free(struct adapter *adapter, struct em_dma_alloc *dma) /********************************************************************* * - * Allocate memory for tx_buffer structures. The tx_buffer stores all - * the information needed to transmit a packet on the wire. + * Allocate memory for the transmit and receive rings, and then + * the descriptors associated with each, called only once at attach. * **********************************************************************/ static int -em_allocate_transmit_structures(struct adapter *adapter) +em_allocate_queues(struct adapter *adapter) { - device_t dev = adapter->dev; - struct em_buffer *tx_buffer; - int error, i; + device_t dev = adapter->dev; + struct tx_ring *txr = NULL; + struct rx_ring *rxr = NULL; + int rsize, tsize, error = E1000_SUCCESS; + int txconf = 0, rxconf = 0; + int i = 0; - /* - * Create DMA tags for tx descriptors - */ -#if __FreeBSD_version >= 700000 - if ((error = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ -#else - if ((error = bus_dma_tag_create(NULL, /* parent */ -#endif - 1, 0, /* alignment, bounds */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - EM_TSO_SIZE, /* maxsize */ - EM_MAX_SCATTER, /* nsegments */ - EM_TSO_SEG_SIZE, /* maxsegsize */ - 0, /* flags */ - NULL, /* lockfunc */ - NULL, /* lockarg */ - &adapter->txtag)) != 0) { - device_printf(dev, "Unable to allocate TX DMA tag\n"); + + /* Allocate the TX ring struct memory */ + if (!(adapter->tx_rings = + (struct tx_ring *) malloc(sizeof(struct tx_ring) * + adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate TX ring memory\n"); + error = ENOMEM; goto fail; } - adapter->tx_buffer_area = malloc(sizeof(struct em_buffer) * - adapter->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO); - if (adapter->tx_buffer_area == NULL) { + /* Now allocate the RX */ + if (!(adapter->rx_rings = + (struct rx_ring *) malloc(sizeof(struct rx_ring) * + adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate RX ring memory\n"); + error = ENOMEM; + goto rx_fail; + } + + tsize = roundup2(adapter->num_tx_desc * + sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); + /* + * Now set up the TX queues, txconf is needed to handle the + * possibility that things fail midcourse and we need to + * undo memory gracefully + */ + for (i = 0; i < adapter->num_queues; i++, txconf++) { + /* Set up some basics */ + txr = &adapter->tx_rings[i]; + txr->adapter = adapter; + txr->me = i; + + /* Initialize the TX lock */ + snprintf(txr->mtx_name, sizeof(txr->mtx_name), "%s:tx(%d)", + device_get_nameunit(dev), txr->me); + mtx_init(&txr->tx_mtx, txr->mtx_name, NULL, MTX_DEF); + + if (em_dma_malloc(adapter, tsize, + &txr->txdma, BUS_DMA_NOWAIT)) { + device_printf(dev, + "Unable to allocate TX Descriptor memory\n"); + error = ENOMEM; + goto err_tx_desc; + } + txr->tx_base = (struct e1000_tx_desc *)txr->txdma.dma_vaddr; + bzero((void *)txr->tx_base, tsize); + + if (em_allocate_transmit_buffers(txr)) { + device_printf(dev, + "Critical Failure setting up transmit buffers\n"); + error = ENOMEM; + goto err_tx_desc; + } + +#ifndef __HAIKU__ +#if __FreeBSD_version >= 800000 + /* Allocate a buf ring */ + txr->br = buf_ring_alloc(4096, M_DEVBUF, + M_WAITOK, &txr->tx_mtx); +#endif +#endif + + } + + /* + * Next the RX queues... + */ + rsize = roundup2(adapter->num_rx_desc * + sizeof(struct e1000_rx_desc), EM_DBA_ALIGN); + for (i = 0; i < adapter->num_queues; i++, rxconf++) { + rxr = &adapter->rx_rings[i]; + rxr->adapter = adapter; + rxr->me = i; + + /* Initialize the RX lock */ + snprintf(rxr->mtx_name, sizeof(rxr->mtx_name), "%s:rx(%d)", + device_get_nameunit(dev), txr->me); + mtx_init(&rxr->rx_mtx, rxr->mtx_name, NULL, MTX_DEF); + + if (em_dma_malloc(adapter, rsize, + &rxr->rxdma, BUS_DMA_NOWAIT)) { + device_printf(dev, + "Unable to allocate RxDescriptor memory\n"); + error = ENOMEM; + goto err_rx_desc; + } + rxr->rx_base = (struct e1000_rx_desc *)rxr->rxdma.dma_vaddr; + bzero((void *)rxr->rx_base, rsize); + + /* Allocate receive buffers for the ring*/ + if (em_allocate_receive_buffers(rxr)) { + device_printf(dev, + "Critical Failure setting up receive buffers\n"); + error = ENOMEM; + goto err_rx_desc; + } + } + + return (0); + +err_rx_desc: + for (rxr = adapter->rx_rings; rxconf > 0; rxr++, rxconf--) + em_dma_free(adapter, &rxr->rxdma); +err_tx_desc: + for (txr = adapter->tx_rings; txconf > 0; txr++, txconf--) + em_dma_free(adapter, &txr->txdma); + free(adapter->rx_rings, M_DEVBUF); +rx_fail: + +#ifndef __HAIKU__ +#if __FreeBSD_version >= 800000 + buf_ring_free(txr->br, M_DEVBUF); +#endif +#endif + + free(adapter->tx_rings, M_DEVBUF); +fail: + return (error); +} + + +/********************************************************************* + * + * Allocate memory for tx_buffer structures. The tx_buffer stores all + * the information needed to transmit a packet on the wire. This is + * called only once at attach, setup is done every reset. + * + **********************************************************************/ +static int +em_allocate_transmit_buffers(struct tx_ring *txr) +{ + struct adapter *adapter = txr->adapter; + device_t dev = adapter->dev; + struct em_buffer *txbuf; + int error, i; + + /* + * Setup DMA descriptor areas. + */ + if ((error = bus_dma_tag_create(bus_get_dma_tag(dev), + 1, 0, /* alignment, bounds */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + EM_TSO_SIZE, /* maxsize */ + EM_MAX_SCATTER, /* nsegments */ + PAGE_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &txr->txtag))) { + device_printf(dev,"Unable to allocate TX DMA tag\n"); + goto fail; + } + + if (!(txr->tx_buffers = + (struct em_buffer *) malloc(sizeof(struct em_buffer) * + adapter->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate tx_buffer memory\n"); error = ENOMEM; goto fail; } - /* Create the descriptor buffer dma maps */ - for (i = 0; i < adapter->num_tx_desc; i++) { - tx_buffer = &adapter->tx_buffer_area[i]; - error = bus_dmamap_create(adapter->txtag, 0, &tx_buffer->map); + /* Create the descriptor buffer dma maps */ + txbuf = txr->tx_buffers; + for (i = 0; i < adapter->num_tx_desc; i++, txbuf++) { + error = bus_dmamap_create(txr->txtag, 0, &txbuf->map); if (error != 0) { device_printf(dev, "Unable to create TX DMA map\n"); goto fail; } - tx_buffer->next_eop = -1; } - return (0); + return 0; fail: + /* We free all, it handles case where we are in the middle */ em_free_transmit_structures(adapter); return (error); } /********************************************************************* * - * (Re)Initialize transmit structures. + * Initialize a transmit ring. + * + **********************************************************************/ +static void +em_setup_transmit_ring(struct tx_ring *txr) +{ + struct adapter *adapter = txr->adapter; + struct em_buffer *txbuf; + int i; + + /* Clear the old descriptor contents */ + EM_TX_LOCK(txr); + bzero((void *)txr->tx_base, + (sizeof(struct e1000_tx_desc)) * adapter->num_tx_desc); + /* Reset indices */ + txr->next_avail_desc = 0; + txr->next_to_clean = 0; + + /* Free any existing tx buffers. */ + txbuf = txr->tx_buffers; + for (i = 0; i < adapter->num_tx_desc; i++, txbuf++) { + if (txbuf->m_head != NULL) { + bus_dmamap_sync(txr->txtag, txbuf->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(txr->txtag, txbuf->map); + m_freem(txbuf->m_head); + txbuf->m_head = NULL; + } + /* clear the watch index */ + txbuf->next_eop = -1; + } + + /* Set number of descriptors available */ + txr->tx_avail = adapter->num_tx_desc; + txr->queue_status = EM_QUEUE_IDLE; + + /* Clear checksum offload context. */ + txr->last_hw_offload = 0; + txr->last_hw_ipcss = 0; + txr->last_hw_ipcso = 0; + txr->last_hw_tucss = 0; + txr->last_hw_tucso = 0; + + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + EM_TX_UNLOCK(txr); +} + +/********************************************************************* + * + * Initialize all transmit rings. * **********************************************************************/ static void em_setup_transmit_structures(struct adapter *adapter) { - struct em_buffer *tx_buffer; - int i; + struct tx_ring *txr = adapter->tx_rings; + int i = 0; - /* Clear the old ring contents */ - bzero(adapter->tx_desc_base, - (sizeof(struct e1000_tx_desc)) * adapter->num_tx_desc); - - /* Free any existing TX buffers */ - for (i = 0; i < adapter->num_tx_desc; i++, tx_buffer++) { - tx_buffer = &adapter->tx_buffer_area[i]; - bus_dmamap_sync(adapter->txtag, tx_buffer->map, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(adapter->txtag, tx_buffer->map); - m_freem(tx_buffer->m_head); - tx_buffer->m_head = NULL; - tx_buffer->next_eop = -1; - } - - /* Reset state */ - adapter->next_avail_tx_desc = 0; - adapter->next_tx_to_clean = 0; - adapter->num_tx_desc_avail = adapter->num_tx_desc; - - bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + for (i = 0; i < adapter->num_queues; i++, txr++) + em_setup_transmit_ring(txr); return; } @@ -3453,25 +3269,32 @@ em_setup_transmit_structures(struct adapter *adapter) static void em_initialize_transmit_unit(struct adapter *adapter) { + struct tx_ring *txr = adapter->tx_rings; + struct e1000_hw *hw = &adapter->hw; u32 tctl, tarc, tipg = 0; - u64 bus_addr; + int i = 0; INIT_DEBUGOUT("em_initialize_transmit_unit: begin"); - /* Setup the Base and Length of the Tx Descriptor Ring */ - bus_addr = adapter->txdma.dma_paddr; - E1000_WRITE_REG(&adapter->hw, E1000_TDLEN(0), - adapter->num_tx_desc * sizeof(struct e1000_tx_desc)); - E1000_WRITE_REG(&adapter->hw, E1000_TDBAH(0), - (u32)(bus_addr >> 32)); - E1000_WRITE_REG(&adapter->hw, E1000_TDBAL(0), - (u32)bus_addr); - /* Setup the HW Tx Head and Tail descriptor pointers */ - E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), 0); - E1000_WRITE_REG(&adapter->hw, E1000_TDH(0), 0); - HW_DEBUGOUT2("Base = %x, Length = %x\n", - E1000_READ_REG(&adapter->hw, E1000_TDBAL(0)), - E1000_READ_REG(&adapter->hw, E1000_TDLEN(0))); + for (i = 0; i < adapter->num_queues; i++, txr++) { + u64 bus_addr = txr->txdma.dma_paddr; + /* Base and Len of TX Ring */ + E1000_WRITE_REG(hw, E1000_TDLEN(i), + adapter->num_tx_desc * sizeof(struct e1000_tx_desc)); + E1000_WRITE_REG(hw, E1000_TDBAH(i), + (u32)(bus_addr >> 32)); + E1000_WRITE_REG(hw, E1000_TDBAL(i), + (u32)bus_addr); + /* Init the HEAD/TAIL indices */ + E1000_WRITE_REG(hw, E1000_TDT(i), 0); + E1000_WRITE_REG(hw, E1000_TDH(i), 0); + + HW_DEBUGOUT2("Base = %x, Length = %x\n", + E1000_READ_REG(&adapter->hw, E1000_TDBAL(i)), + E1000_READ_REG(&adapter->hw, E1000_TDLEN(i))); + + txr->queue_status = EM_QUEUE_IDLE; + } /* Set the default values for the Tx Inter Packet Gap timer */ switch (adapter->hw.mac.type) { @@ -3498,6 +3321,7 @@ em_initialize_transmit_unit(struct adapter *adapter) E1000_WRITE_REG(&adapter->hw, E1000_TIPG, tipg); E1000_WRITE_REG(&adapter->hw, E1000_TIDV, adapter->tx_int_delay.value); + if(adapter->hw.mac.type >= e1000_82540) E1000_WRITE_REG(&adapter->hw, E1000_TADV, adapter->tx_abs_int_delay.value); @@ -3516,6 +3340,10 @@ em_initialize_transmit_unit(struct adapter *adapter) E1000_WRITE_REG(&adapter->hw, E1000_TARC(1), tarc); } + adapter->txd_cmd = E1000_TXD_CMD_IFCS; + if (adapter->tx_int_delay.value > 0) + adapter->txd_cmd |= E1000_TXD_CMD_IDE; + /* Program the Transmit Control Register */ tctl = E1000_READ_REG(&adapter->hw, E1000_TCTL); tctl &= ~E1000_TCTL_CT; @@ -3528,348 +3356,289 @@ em_initialize_transmit_unit(struct adapter *adapter) /* This write will effectively turn on the transmit unit. */ E1000_WRITE_REG(&adapter->hw, E1000_TCTL, tctl); - /* Setup Transmit Descriptor Base Settings */ - adapter->txd_cmd = E1000_TXD_CMD_IFCS; - - if (adapter->tx_int_delay.value > 0) - adapter->txd_cmd |= E1000_TXD_CMD_IDE; } + /********************************************************************* * - * Free all transmit related data structures. + * Free all transmit rings. * **********************************************************************/ static void em_free_transmit_structures(struct adapter *adapter) { - struct em_buffer *tx_buffer; - int i; + struct tx_ring *txr = adapter->tx_rings; + int i = 0; - INIT_DEBUGOUT("free_transmit_structures: begin"); + for (i = 0; i < adapter->num_queues; i++, txr++) { + EM_TX_LOCK(txr); + em_free_transmit_buffers(txr); + em_dma_free(adapter, &txr->txdma); + EM_TX_UNLOCK(txr); + EM_TX_LOCK_DESTROY(txr); + } - if (adapter->tx_buffer_area != NULL) { - for (i = 0; i < adapter->num_tx_desc; i++) { - tx_buffer = &adapter->tx_buffer_area[i]; - if (tx_buffer->m_head != NULL) { - bus_dmamap_sync(adapter->txtag, tx_buffer->map, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(adapter->txtag, - tx_buffer->map); - m_freem(tx_buffer->m_head); - tx_buffer->m_head = NULL; - } else if (tx_buffer->map != NULL) - bus_dmamap_unload(adapter->txtag, - tx_buffer->map); - if (tx_buffer->map != NULL) { - bus_dmamap_destroy(adapter->txtag, - tx_buffer->map); - tx_buffer->map = NULL; - } - } - } - if (adapter->tx_buffer_area != NULL) { - free(adapter->tx_buffer_area, M_DEVBUF); - adapter->tx_buffer_area = NULL; - } - if (adapter->txtag != NULL) { - bus_dma_tag_destroy(adapter->txtag); - adapter->txtag = NULL; - } + free(adapter->tx_rings, M_DEVBUF); } /********************************************************************* * - * The offload context needs to be set when we transfer the first - * packet of a particular protocol (TCP/UDP). This routine has been - * enhanced to deal with inserted VLAN headers, and IPV6 (not complete) + * Free transmit ring related data structures. * **********************************************************************/ static void -em_transmit_checksum_setup(struct adapter *adapter, struct mbuf *mp, - u32 *txd_upper, u32 *txd_lower) +em_free_transmit_buffers(struct tx_ring *txr) { - struct e1000_context_desc *TXD; - struct em_buffer *tx_buffer; - struct ether_vlan_header *eh; - struct ip *ip = NULL; - struct ip6_hdr *ip6; - struct tcp_hdr *th; - int curr_txd, ehdrlen; - u32 cmd, hdr_len, ip_hlen; - u16 etype; - u8 ipproto; + struct adapter *adapter = txr->adapter; + struct em_buffer *txbuf; + int i = 0; - cmd = hdr_len = ipproto = 0; - /* Setup checksum offload context. */ - curr_txd = adapter->next_avail_tx_desc; - tx_buffer = &adapter->tx_buffer_area[curr_txd]; - TXD = (struct e1000_context_desc *) &adapter->tx_desc_base[curr_txd]; + INIT_DEBUGOUT("free_transmit_ring: begin"); - /* - * Determine where frame payload starts. - * Jump over vlan headers if already present, - * helpful for QinQ too. - */ - eh = mtod(mp, struct ether_vlan_header *); - if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { - etype = ntohs(eh->evl_proto); - ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; - } else { - etype = ntohs(eh->evl_encap_proto); - ehdrlen = ETHER_HDR_LEN; - } - - /* - * We only support TCP/UDP for IPv4 and IPv6 for the moment. - * TODO: Support SCTP too when it hits the tree. - */ - switch (etype) { - case ETHERTYPE_IP: - ip = (struct ip *)(mp->m_data + ehdrlen); - ip_hlen = ip->ip_hl << 2; - - /* Setup of IP header checksum. */ - if (mp->m_pkthdr.csum_flags & CSUM_IP) { - /* - * Start offset for header checksum calculation. - * End offset for header checksum calculation. - * Offset of place to put the checksum. - */ - TXD->lower_setup.ip_fields.ipcss = ehdrlen; - TXD->lower_setup.ip_fields.ipcse = - htole16(ehdrlen + ip_hlen); - TXD->lower_setup.ip_fields.ipcso = - ehdrlen + offsetof(struct ip, ip_sum); - cmd |= E1000_TXD_CMD_IP; - *txd_upper |= E1000_TXD_POPTS_IXSM << 8; - } - - if (mp->m_len < ehdrlen + ip_hlen) - return; /* failure */ - - hdr_len = ehdrlen + ip_hlen; - ipproto = ip->ip_p; - - break; - case ETHERTYPE_IPV6: - ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); - ip_hlen = sizeof(struct ip6_hdr); /* XXX: No header stacking. */ - - if (mp->m_len < ehdrlen + ip_hlen) - return; /* failure */ - - /* IPv6 doesn't have a header checksum. */ - - hdr_len = ehdrlen + ip_hlen; - ipproto = ip6->ip6_nxt; - - break; -#ifdef EM_TIMESYNC - case ETHERTYPE_IEEE1588: - *txd_upper |= E1000_TXD_EXTCMD_TSTAMP; - break; -#endif - default: - *txd_upper = 0; - *txd_lower = 0; + if (txr->tx_buffers == NULL) return; + + for (i = 0; i < adapter->num_tx_desc; i++) { + txbuf = &txr->tx_buffers[i]; + if (txbuf->m_head != NULL) { + bus_dmamap_sync(txr->txtag, txbuf->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(txr->txtag, + txbuf->map); + m_freem(txbuf->m_head); + txbuf->m_head = NULL; + if (txbuf->map != NULL) { + bus_dmamap_destroy(txr->txtag, + txbuf->map); + txbuf->map = NULL; + } + } else if (txbuf->map != NULL) { + bus_dmamap_unload(txr->txtag, + txbuf->map); + bus_dmamap_destroy(txr->txtag, + txbuf->map); + txbuf->map = NULL; + } } - switch (ipproto) { - case IPPROTO_TCP: - if (mp->m_pkthdr.csum_flags & CSUM_TCP) { - /* - * Start offset for payload checksum calculation. - * End offset for payload checksum calculation. - * Offset of place to put the checksum. - */ - th = (struct tcp_hdr *)(mp->m_data + hdr_len); - TXD->upper_setup.tcp_fields.tucss = hdr_len; - TXD->upper_setup.tcp_fields.tucse = htole16(0); - TXD->upper_setup.tcp_fields.tucso = - hdr_len + offsetof(struct tcphdr, th_sum); - cmd |= E1000_TXD_CMD_TCP; - *txd_upper |= E1000_TXD_POPTS_TXSM << 8; - } - break; - case IPPROTO_UDP: - { -#ifdef EM_TIMESYNC - void *hdr = (caddr_t) ip + ip_hlen; - struct udphdr *uh = (struct udphdr *)hdr; - - if (uh->uh_dport == htons(TSYNC_PORT)) { - *txd_upper |= E1000_TXD_EXTCMD_TSTAMP; - IOCTL_DEBUGOUT("@@@ Sending Event Packet\n"); - } +#ifndef __HAIKU__ +#if __FreeBSD_version >= 800000 + if (txr->br != NULL) + buf_ring_free(txr->br, M_DEVBUF); #endif - if (mp->m_pkthdr.csum_flags & CSUM_UDP) { - /* - * Start offset for header checksum calculation. - * End offset for header checksum calculation. - * Offset of place to put the checksum. - */ - TXD->upper_setup.tcp_fields.tucss = hdr_len; - TXD->upper_setup.tcp_fields.tucse = htole16(0); - TXD->upper_setup.tcp_fields.tucso = - hdr_len + offsetof(struct udphdr, uh_sum); - *txd_upper |= E1000_TXD_POPTS_TXSM << 8; - } - /* Fall Thru */ +#endif + + if (txr->tx_buffers != NULL) { + free(txr->tx_buffers, M_DEVBUF); + txr->tx_buffers = NULL; } - default: - break; + if (txr->txtag != NULL) { + bus_dma_tag_destroy(txr->txtag); + txr->txtag = NULL; } - -#ifdef EM_TIMESYNC - /* - ** We might be here just for TIMESYNC - ** which means we don't need the context - ** descriptor. - */ - if (!mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) - return; -#endif - *txd_lower = E1000_TXD_CMD_DEXT | /* Extended descr type */ - E1000_TXD_DTYP_D; /* Data descr */ - TXD->tcp_seg_setup.data = htole32(0); - TXD->cmd_and_length = - htole32(adapter->txd_cmd | E1000_TXD_CMD_DEXT | cmd); - tx_buffer->m_head = NULL; - tx_buffer->next_eop = -1; - - if (++curr_txd == adapter->num_tx_desc) - curr_txd = 0; - - adapter->num_tx_desc_avail--; - adapter->next_avail_tx_desc = curr_txd; + return; +} + + +/********************************************************************* + * The offload context is protocol specific (TCP/UDP) and thus + * only needs to be set when the protocol changes. The occasion + * of a context change can be a performance detriment, and + * might be better just disabled. The reason arises in the way + * in which the controller supports pipelined requests from the + * Tx data DMA. Up to four requests can be pipelined, and they may + * belong to the same packet or to multiple packets. However all + * requests for one packet are issued before a request is issued + * for a subsequent packet and if a request for the next packet + * requires a context change, that request will be stalled + * until the previous request completes. This means setting up + * a new context effectively disables pipelined Tx data DMA which + * in turn greatly slow down performance to send small sized + * frames. + **********************************************************************/ +static void +em_transmit_checksum_setup(struct tx_ring *txr, struct mbuf *mp, int ip_off, + struct ip *ip, u32 *txd_upper, u32 *txd_lower) +{ + struct adapter *adapter = txr->adapter; + struct e1000_context_desc *TXD = NULL; + struct em_buffer *tx_buffer; + int cur, hdr_len; + u32 cmd = 0; + u16 offload = 0; + u8 ipcso, ipcss, tucso, tucss; + + ipcss = ipcso = tucss = tucso = 0; + hdr_len = ip_off + (ip->ip_hl << 2); + cur = txr->next_avail_desc; + + /* Setup of IP header checksum. */ + if (mp->m_pkthdr.csum_flags & CSUM_IP) { + *txd_upper |= E1000_TXD_POPTS_IXSM << 8; + offload |= CSUM_IP; + ipcss = ip_off; + ipcso = ip_off + offsetof(struct ip, ip_sum); + /* + * Start offset for header checksum calculation. + * End offset for header checksum calculation. + * Offset of place to put the checksum. + */ + TXD = (struct e1000_context_desc *)&txr->tx_base[cur]; + TXD->lower_setup.ip_fields.ipcss = ipcss; + TXD->lower_setup.ip_fields.ipcse = htole16(hdr_len); + TXD->lower_setup.ip_fields.ipcso = ipcso; + cmd |= E1000_TXD_CMD_IP; + } + + if (mp->m_pkthdr.csum_flags & CSUM_TCP) { + *txd_lower = E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; + *txd_upper |= E1000_TXD_POPTS_TXSM << 8; + offload |= CSUM_TCP; + tucss = hdr_len; + tucso = hdr_len + offsetof(struct tcphdr, th_sum); + /* + * Setting up new checksum offload context for every frames + * takes a lot of processing time for hardware. This also + * reduces performance a lot for small sized frames so avoid + * it if driver can use previously configured checksum + * offload context. + */ + if (txr->last_hw_offload == offload) { + if (offload & CSUM_IP) { + if (txr->last_hw_ipcss == ipcss && + txr->last_hw_ipcso == ipcso && + txr->last_hw_tucss == tucss && + txr->last_hw_tucso == tucso) + return; + } else { + if (txr->last_hw_tucss == tucss && + txr->last_hw_tucso == tucso) + return; + } + } + txr->last_hw_offload = offload; + txr->last_hw_tucss = tucss; + txr->last_hw_tucso = tucso; + /* + * Start offset for payload checksum calculation. + * End offset for payload checksum calculation. + * Offset of place to put the checksum. + */ + TXD = (struct e1000_context_desc *)&txr->tx_base[cur]; + TXD->upper_setup.tcp_fields.tucss = hdr_len; + TXD->upper_setup.tcp_fields.tucse = htole16(0); + TXD->upper_setup.tcp_fields.tucso = tucso; + cmd |= E1000_TXD_CMD_TCP; + } else if (mp->m_pkthdr.csum_flags & CSUM_UDP) { + *txd_lower = E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; + *txd_upper |= E1000_TXD_POPTS_TXSM << 8; + tucss = hdr_len; + tucso = hdr_len + offsetof(struct udphdr, uh_sum); + /* + * Setting up new checksum offload context for every frames + * takes a lot of processing time for hardware. This also + * reduces performance a lot for small sized frames so avoid + * it if driver can use previously configured checksum + * offload context. + */ + if (txr->last_hw_offload == offload) { + if (offload & CSUM_IP) { + if (txr->last_hw_ipcss == ipcss && + txr->last_hw_ipcso == ipcso && + txr->last_hw_tucss == tucss && + txr->last_hw_tucso == tucso) + return; + } else { + if (txr->last_hw_tucss == tucss && + txr->last_hw_tucso == tucso) + return; + } + } + txr->last_hw_offload = offload; + txr->last_hw_tucss = tucss; + txr->last_hw_tucso = tucso; + /* + * Start offset for header checksum calculation. + * End offset for header checksum calculation. + * Offset of place to put the checksum. + */ + TXD = (struct e1000_context_desc *)&txr->tx_base[cur]; + TXD->upper_setup.tcp_fields.tucss = tucss; + TXD->upper_setup.tcp_fields.tucse = htole16(0); + TXD->upper_setup.tcp_fields.tucso = tucso; + } + + if (offload & CSUM_IP) { + txr->last_hw_ipcss = ipcss; + txr->last_hw_ipcso = ipcso; + } + + TXD->tcp_seg_setup.data = htole32(0); + TXD->cmd_and_length = + htole32(adapter->txd_cmd | E1000_TXD_CMD_DEXT | cmd); + tx_buffer = &txr->tx_buffers[cur]; + tx_buffer->m_head = NULL; + tx_buffer->next_eop = -1; + + if (++cur == adapter->num_tx_desc) + cur = 0; + + txr->tx_avail--; + txr->next_avail_desc = cur; } -#if __FreeBSD_version >= 700000 /********************************************************************** * * Setup work for hardware segmentation offload (TSO) * **********************************************************************/ -static bool -em_tso_setup(struct adapter *adapter, struct mbuf *mp, u32 *txd_upper, - u32 *txd_lower) +static void +em_tso_setup(struct tx_ring *txr, struct mbuf *mp, int ip_off, + struct ip *ip, struct tcphdr *tp, u32 *txd_upper, u32 *txd_lower) { - struct e1000_context_desc *TXD; - struct em_buffer *tx_buffer; - struct ether_vlan_header *eh; - struct ip *ip; - struct ip6_hdr *ip6; - struct tcphdr *th; - int curr_txd, ehdrlen, hdr_len, ip_hlen, isip6; - u16 etype; + struct adapter *adapter = txr->adapter; + struct e1000_context_desc *TXD; + struct em_buffer *tx_buffer; + int cur, hdr_len; /* - * This function could/should be extended to support IP/IPv6 - * fragmentation as well. But as they say, one step at a time. + * In theory we can use the same TSO context if and only if + * frame is the same type(IP/TCP) and the same MSS. However + * checking whether a frame has the same IP/TCP structure is + * hard thing so just ignore that and always restablish a + * new TSO context. */ - - /* - * Determine where frame payload starts. - * Jump over vlan headers if already present, - * helpful for QinQ too. - */ - eh = mtod(mp, struct ether_vlan_header *); - if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { - etype = ntohs(eh->evl_proto); - ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; - } else { - etype = ntohs(eh->evl_encap_proto); - ehdrlen = ETHER_HDR_LEN; - } - - /* Ensure we have at least the IP+TCP header in the first mbuf. */ - if (mp->m_len < ehdrlen + sizeof(struct ip) + sizeof(struct tcphdr)) - return FALSE; /* -1 */ - - /* - * We only support TCP for IPv4 and IPv6 (notyet) for the moment. - * TODO: Support SCTP too when it hits the tree. - */ - switch (etype) { - case ETHERTYPE_IP: - isip6 = 0; - ip = (struct ip *)(mp->m_data + ehdrlen); - if (ip->ip_p != IPPROTO_TCP) - return FALSE; /* 0 */ - ip->ip_len = 0; - ip->ip_sum = 0; - ip_hlen = ip->ip_hl << 2; - if (mp->m_len < ehdrlen + ip_hlen + sizeof(struct tcphdr)) - return FALSE; /* -1 */ - th = (struct tcphdr *)((caddr_t)ip + ip_hlen); -#if 1 - th->th_sum = in_pseudo(ip->ip_src.s_addr, - ip->ip_dst.s_addr, htons(IPPROTO_TCP)); -#else - th->th_sum = mp->m_pkthdr.csum_data; -#endif - break; - case ETHERTYPE_IPV6: - isip6 = 1; - return FALSE; /* Not supported yet. */ - ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); - if (ip6->ip6_nxt != IPPROTO_TCP) - return FALSE; /* 0 */ - ip6->ip6_plen = 0; - ip_hlen = sizeof(struct ip6_hdr); /* XXX: no header stacking. */ - if (mp->m_len < ehdrlen + ip_hlen + sizeof(struct tcphdr)) - return FALSE; /* -1 */ - th = (struct tcphdr *)((caddr_t)ip6 + ip_hlen); -#if 0 - th->th_sum = in6_pseudo(ip6->ip6_src, ip->ip6_dst, - htons(IPPROTO_TCP)); /* XXX: function notyet. */ -#else - th->th_sum = mp->m_pkthdr.csum_data; -#endif - break; - default: - return FALSE; - } - hdr_len = ehdrlen + ip_hlen + (th->th_off << 2); - + hdr_len = ip_off + (ip->ip_hl << 2) + (tp->th_off << 2); *txd_lower = (E1000_TXD_CMD_DEXT | /* Extended descr type */ E1000_TXD_DTYP_D | /* Data descr type */ E1000_TXD_CMD_TSE); /* Do TSE on this packet */ /* IP and/or TCP header checksum calculation and insertion. */ - *txd_upper = ((isip6 ? 0 : E1000_TXD_POPTS_IXSM) | - E1000_TXD_POPTS_TXSM) << 8; + *txd_upper = (E1000_TXD_POPTS_IXSM | E1000_TXD_POPTS_TXSM) << 8; - curr_txd = adapter->next_avail_tx_desc; - tx_buffer = &adapter->tx_buffer_area[curr_txd]; - TXD = (struct e1000_context_desc *) &adapter->tx_desc_base[curr_txd]; + cur = txr->next_avail_desc; + tx_buffer = &txr->tx_buffers[cur]; + TXD = (struct e1000_context_desc *) &txr->tx_base[cur]; - /* IPv6 doesn't have a header checksum. */ - if (!isip6) { - /* - * Start offset for header checksum calculation. - * End offset for header checksum calculation. - * Offset of place put the checksum. - */ - TXD->lower_setup.ip_fields.ipcss = ehdrlen; - TXD->lower_setup.ip_fields.ipcse = - htole16(ehdrlen + ip_hlen - 1); - TXD->lower_setup.ip_fields.ipcso = - ehdrlen + offsetof(struct ip, ip_sum); - } + /* + * Start offset for header checksum calculation. + * End offset for header checksum calculation. + * Offset of place put the checksum. + */ + TXD->lower_setup.ip_fields.ipcss = ip_off; + TXD->lower_setup.ip_fields.ipcse = + htole16(ip_off + (ip->ip_hl << 2) - 1); + TXD->lower_setup.ip_fields.ipcso = ip_off + offsetof(struct ip, ip_sum); /* * Start offset for payload checksum calculation. * End offset for payload checksum calculation. * Offset of place to put the checksum. */ - TXD->upper_setup.tcp_fields.tucss = - ehdrlen + ip_hlen; + TXD->upper_setup.tcp_fields.tucss = ip_off + (ip->ip_hl << 2); TXD->upper_setup.tcp_fields.tucse = 0; TXD->upper_setup.tcp_fields.tucso = - ehdrlen + ip_hlen + offsetof(struct tcphdr, th_sum); + ip_off + (ip->ip_hl << 2) + offsetof(struct tcphdr, th_sum); /* * Payload size per packet w/o any headers. * Length of all headers up to payload. @@ -3880,24 +3649,21 @@ em_tso_setup(struct adapter *adapter, struct mbuf *mp, u32 *txd_upper, TXD->cmd_and_length = htole32(adapter->txd_cmd | E1000_TXD_CMD_DEXT | /* Extended descr */ E1000_TXD_CMD_TSE | /* TSE context */ - (isip6 ? 0 : E1000_TXD_CMD_IP) | /* Do IP csum */ + E1000_TXD_CMD_IP | /* Do IP csum */ E1000_TXD_CMD_TCP | /* Do TCP checksum */ (mp->m_pkthdr.len - (hdr_len))); /* Total len */ tx_buffer->m_head = NULL; tx_buffer->next_eop = -1; - if (++curr_txd == adapter->num_tx_desc) - curr_txd = 0; + if (++cur == adapter->num_tx_desc) + cur = 0; - adapter->num_tx_desc_avail--; - adapter->next_avail_tx_desc = curr_txd; - adapter->tx_tso = TRUE; - - return TRUE; + txr->tx_avail--; + txr->next_avail_desc = cur; + txr->tx_tso = TRUE; } -#endif /* __FreeBSD_version >= 700000 */ /********************************************************************** * @@ -3906,25 +3672,29 @@ em_tso_setup(struct adapter *adapter, struct mbuf *mp, u32 *txd_upper, * tx_buffer is put back on the free queue. * **********************************************************************/ -static void -em_txeof(struct adapter *adapter) +static bool +em_txeof(struct tx_ring *txr) { - int first, last, done, num_avail; + struct adapter *adapter = txr->adapter; + int first, last, done, processed; struct em_buffer *tx_buffer; struct e1000_tx_desc *tx_desc, *eop_desc; struct ifnet *ifp = adapter->ifp; - EM_TX_LOCK_ASSERT(adapter); + EM_TX_LOCK_ASSERT(txr); - if (adapter->num_tx_desc_avail == adapter->num_tx_desc) - return; + /* No work, make sure watchdog is off */ + if (txr->tx_avail == adapter->num_tx_desc) { + txr->queue_status = EM_QUEUE_IDLE; + return (FALSE); + } - num_avail = adapter->num_tx_desc_avail; - first = adapter->next_tx_to_clean; - tx_desc = &adapter->tx_desc_base[first]; - tx_buffer = &adapter->tx_buffer_area[first]; + processed = 0; + first = txr->next_to_clean; + tx_desc = &txr->tx_base[first]; + tx_buffer = &txr->tx_buffers[first]; last = tx_buffer->next_eop; - eop_desc = &adapter->tx_desc_base[last]; + eop_desc = &txr->tx_base[last]; /* * What this does is get the index of the @@ -3936,7 +3706,7 @@ em_txeof(struct adapter *adapter) last = 0; done = last; - bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_POSTREAD); while (eop_desc->upper.fields.status & E1000_TXD_STAT_DD) { @@ -3945,136 +3715,140 @@ em_txeof(struct adapter *adapter) tx_desc->upper.data = 0; tx_desc->lower.data = 0; tx_desc->buffer_addr = 0; - num_avail++; + ++txr->tx_avail; + ++processed; if (tx_buffer->m_head) { - ifp->if_opackets++; - bus_dmamap_sync(adapter->txtag, + bus_dmamap_sync(txr->txtag, tx_buffer->map, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(adapter->txtag, + bus_dmamap_unload(txr->txtag, tx_buffer->map); - m_freem(tx_buffer->m_head); tx_buffer->m_head = NULL; } tx_buffer->next_eop = -1; + txr->watchdog_time = ticks; if (++first == adapter->num_tx_desc) first = 0; - tx_buffer = &adapter->tx_buffer_area[first]; - tx_desc = &adapter->tx_desc_base[first]; + tx_buffer = &txr->tx_buffers[first]; + tx_desc = &txr->tx_base[first]; } + ++ifp->if_opackets; /* See if we can continue to the next packet */ last = tx_buffer->next_eop; if (last != -1) { - eop_desc = &adapter->tx_desc_base[last]; + eop_desc = &txr->tx_base[last]; /* Get new done point */ if (++last == adapter->num_tx_desc) last = 0; done = last; } else break; } - bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - adapter->next_tx_to_clean = first; + txr->next_to_clean = first; + + /* + ** Watchdog calculation, we know there's + ** work outstanding or the first return + ** would have been taken, so none processed + ** for too long indicates a hang. local timer + ** will examine this and do a reset if needed. + */ + if ((!processed) && ((ticks - txr->watchdog_time) > EM_WATCHDOG)) + txr->queue_status = EM_QUEUE_HUNG; /* - * If we have enough room, clear IFF_DRV_OACTIVE to tell the stack - * that it is OK to send packets. - * If there are no pending descriptors, clear the timeout. Otherwise, - * if some descriptors have been freed, restart the timeout. + * If we have enough room, clear IFF_DRV_OACTIVE + * to tell the stack that it is OK to send packets. */ - if (num_avail > EM_TX_CLEANUP_THRESHOLD) { + if (txr->tx_avail > EM_TX_CLEANUP_THRESHOLD) { ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - /* All clean, turn off the timer */ - if (num_avail == adapter->num_tx_desc) { - adapter->watchdog_timer = 0; - } else - /* Some cleaned, reset the timer */ - if (num_avail != adapter->num_tx_desc_avail) - adapter->watchdog_timer = EM_TX_TIMEOUT; + /* Disable watchdog if all clean */ + if (txr->tx_avail == adapter->num_tx_desc) { + txr->queue_status = EM_QUEUE_IDLE; + return (FALSE); + } } - adapter->num_tx_desc_avail = num_avail; - return; + + return (TRUE); } + /********************************************************************* * - * When Link is lost sometimes there is work still in the TX ring - * which will result in a watchdog, rather than allow that do an - * attempted cleanup and then reinit here. Note that this has been - * seens mostly with fiber adapters. + * Refresh RX descriptor mbufs from system mbuf buffer pool. * **********************************************************************/ static void -em_tx_purge(struct adapter *adapter) -{ - if ((!adapter->link_active) && (adapter->watchdog_timer)) { - EM_TX_LOCK(adapter); - em_txeof(adapter); - EM_TX_UNLOCK(adapter); - if (adapter->watchdog_timer) { /* Still not clean? */ - adapter->watchdog_timer = 0; - em_init_locked(adapter); - } - } -} - -/********************************************************************* - * - * Get a buffer from system mbuf buffer pool. - * - **********************************************************************/ -static int -em_get_buf(struct adapter *adapter, int i) +em_refresh_mbufs(struct rx_ring *rxr, int limit) { + struct adapter *adapter = rxr->adapter; struct mbuf *m; bus_dma_segment_t segs[1]; - bus_dmamap_t map; - struct em_buffer *rx_buffer; - int error, nsegs; + struct em_buffer *rxbuf; + int i, error, nsegs, cleaned; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - if (m == NULL) { - adapter->mbuf_cluster_failed++; - return (ENOBUFS); + i = rxr->next_to_refresh; + cleaned = -1; + while (i != limit) { + rxbuf = &rxr->rx_buffers[i]; + if (rxbuf->m_head == NULL) { + m = m_getjcl(M_DONTWAIT, MT_DATA, + M_PKTHDR, adapter->rx_mbuf_sz); + /* + ** If we have a temporary resource shortage + ** that causes a failure, just abort refresh + ** for now, we will return to this point when + ** reinvoked from em_rxeof. + */ + if (m == NULL) + goto update; + } else + m = rxbuf->m_head; + + m->m_len = m->m_pkthdr.len = adapter->rx_mbuf_sz; + m->m_flags |= M_PKTHDR; + m->m_data = m->m_ext.ext_buf; + + /* Use bus_dma machinery to setup the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map, + m, segs, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("Refresh mbufs: hdr dmamap load" + " failure - %d\n", error); + m_free(m); + rxbuf->m_head = NULL; + goto update; + } + rxbuf->m_head = m; + bus_dmamap_sync(rxr->rxtag, + rxbuf->map, BUS_DMASYNC_PREREAD); + rxr->rx_base[i].buffer_addr = htole64(segs[0].ds_addr); + + cleaned = i; + /* Calculate next index */ + if (++i == adapter->num_rx_desc) + i = 0; + rxr->next_to_refresh = i; } - m->m_len = m->m_pkthdr.len = MCLBYTES; - - if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) - m_adj(m, ETHER_ALIGN); - +update: /* - * Using memory from the mbuf cluster pool, invoke the - * bus_dma machinery to arrange the memory mapping. - */ - error = bus_dmamap_load_mbuf_sg(adapter->rxtag, - adapter->rx_sparemap, m, segs, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - m_free(m); - return (error); - } + ** Update the tail pointer only if, + ** and as far as we have refreshed. + */ + if (cleaned != -1) /* Update tail index */ + E1000_WRITE_REG(&adapter->hw, + E1000_RDT(rxr->me), cleaned); - /* If nsegs is wrong then the stack is corrupt. */ - KASSERT(nsegs == 1, ("Too many segments returned!")); - - rx_buffer = &adapter->rx_buffer_area[i]; - if (rx_buffer->m_head != NULL) - bus_dmamap_unload(adapter->rxtag, rx_buffer->map); - - map = rx_buffer->map; - rx_buffer->map = adapter->rx_sparemap; - adapter->rx_sparemap = map; - bus_dmamap_sync(adapter->rxtag, rx_buffer->map, BUS_DMASYNC_PREREAD); - rx_buffer->m_head = m; - - adapter->rx_desc_base[i].buffer_addr = htole64(segs[0].ds_addr); - return (0); + return; } + /********************************************************************* * * Allocate memory for rx_buffer structures. Since we use one @@ -4084,54 +3858,44 @@ em_get_buf(struct adapter *adapter, int i) * **********************************************************************/ static int -em_allocate_receive_structures(struct adapter *adapter) +em_allocate_receive_buffers(struct rx_ring *rxr) { - device_t dev = adapter->dev; - struct em_buffer *rx_buffer; - int i, error; + struct adapter *adapter = rxr->adapter; + device_t dev = adapter->dev; + struct em_buffer *rxbuf; + int error; + int i = 0; - adapter->rx_buffer_area = malloc(sizeof(struct em_buffer) * + rxr->rx_buffers = malloc(sizeof(struct em_buffer) * adapter->num_rx_desc, M_DEVBUF, M_NOWAIT | M_ZERO); - if (adapter->rx_buffer_area == NULL) { + if (rxr->rx_buffers == NULL) { device_printf(dev, "Unable to allocate rx_buffer memory\n"); return (ENOMEM); } -#if __FreeBSD_version >= 700000 error = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ -#else - error = bus_dma_tag_create(NULL, /* parent */ -#endif 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MCLBYTES, /* maxsize */ + MJUM9BYTES, /* maxsize */ 1, /* nsegments */ - MCLBYTES, /* maxsegsize */ + MJUM9BYTES, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockarg */ - &adapter->rxtag); + &rxr->rxtag); if (error) { device_printf(dev, "%s: bus_dma_tag_create failed %d\n", __func__, error); goto fail; } - /* Create the spare map (used by getbuf) */ - error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT, - &adapter->rx_sparemap); - if (error) { - device_printf(dev, "%s: bus_dmamap_create failed: %d\n", - __func__, error); - goto fail; - } - - rx_buffer = adapter->rx_buffer_area; - for (i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) { - error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT, - &rx_buffer->map); + rxbuf = rxr->rx_buffers; + for (i = 0; i < adapter->num_rx_desc; i++, rxbuf++) { + rxbuf = &rxr->rx_buffers[i]; + error = bus_dmamap_create(rxr->rxtag, BUS_DMA_NOWAIT, + &rxbuf->map); if (error) { device_printf(dev, "%s: bus_dmamap_create failed: %d\n", __func__, error); @@ -4146,48 +3910,186 @@ fail: return (error); } + /********************************************************************* * - * (Re)initialize receive structures. + * Initialize a receive ring and its buffers. + * + **********************************************************************/ +static int +em_setup_receive_ring(struct rx_ring *rxr) +{ + struct adapter *adapter = rxr->adapter; + struct em_buffer *rxbuf; + bus_dma_segment_t seg[1]; + int rsize, nsegs, error; + int i = 0, j = 0; + + + /* Clear the ring contents */ + EM_RX_LOCK(rxr); + rsize = roundup2(adapter->num_rx_desc * + sizeof(struct e1000_rx_desc), EM_DBA_ALIGN); + bzero((void *)rxr->rx_base, rsize); + + /* + ** Free current RX buffer structs and their mbufs + */ + for (i = 0; i < adapter->num_rx_desc; i++) { + rxbuf = &rxr->rx_buffers[i]; + if (rxbuf->m_head != NULL) { + bus_dmamap_sync(rxr->rxtag, rxbuf->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->rxtag, rxbuf->map); + m_freem(rxbuf->m_head); + } + } + + /* Now replenish the mbufs */ + for (j = 0; j != adapter->num_rx_desc; ++j) { + + rxbuf = &rxr->rx_buffers[j]; + rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, + M_PKTHDR, adapter->rx_mbuf_sz); + if (rxbuf->m_head == NULL) + return (ENOBUFS); + rxbuf->m_head->m_len = adapter->rx_mbuf_sz; + rxbuf->m_head->m_flags &= ~M_HASFCS; /* we strip it */ + rxbuf->m_head->m_pkthdr.len = adapter->rx_mbuf_sz; + + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->rxtag, + rxbuf->map, rxbuf->m_head, seg, + &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + m_freem(rxbuf->m_head); + rxbuf->m_head = NULL; + return (error); + } + bus_dmamap_sync(rxr->rxtag, + rxbuf->map, BUS_DMASYNC_PREREAD); + + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(seg[0].ds_addr); + } + + + /* Setup our descriptor indices */ + rxr->next_to_check = 0; + rxr->next_to_refresh = 0; + + bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + EM_RX_UNLOCK(rxr); + return (0); +} + +/********************************************************************* + * + * Initialize all receive rings. * **********************************************************************/ static int em_setup_receive_structures(struct adapter *adapter) { - struct em_buffer *rx_buffer; - int i, error; + struct rx_ring *rxr = adapter->rx_rings; + int j; + int i = 0; - /* Reset descriptor ring */ - bzero(adapter->rx_desc_base, - (sizeof(struct e1000_rx_desc)) * adapter->num_rx_desc); - - /* Free current RX buffers. */ - rx_buffer = adapter->rx_buffer_area; - for (i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) { - if (rx_buffer->m_head != NULL) { - bus_dmamap_sync(adapter->rxtag, rx_buffer->map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(adapter->rxtag, rx_buffer->map); - m_freem(rx_buffer->m_head); - rx_buffer->m_head = NULL; - } - } - - /* Allocate new ones. */ - for (i = 0; i < adapter->num_rx_desc; i++) { - error = em_get_buf(adapter, i); - if (error) - return (error); - } - - /* Setup our descriptor pointers */ - adapter->next_rx_desc_to_check = 0; - bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + for (j = 0; j < adapter->num_queues; j++, rxr++) + if (em_setup_receive_ring(rxr)) + goto fail; return (0); +fail: + /* + * Free RX buffers allocated so far, we will only handle + * the rings that completed, the failing case will have + * cleaned up for itself. 'j' failed, so its the terminus. + */ + for (i = 0; i < j; ++i) { + int n = 0; + rxr = &adapter->rx_rings[i]; + for (n = 0; n < adapter->num_rx_desc; n++) { + struct em_buffer *rxbuf; + rxbuf = &rxr->rx_buffers[n]; + if (rxbuf->m_head != NULL) { + bus_dmamap_sync(rxr->rxtag, rxbuf->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->rxtag, rxbuf->map); + m_freem(rxbuf->m_head); + rxbuf->m_head = NULL; + } + } + } + + return (ENOBUFS); } +/********************************************************************* + * + * Free all receive rings. + * + **********************************************************************/ +static void +em_free_receive_structures(struct adapter *adapter) +{ + struct rx_ring *rxr = adapter->rx_rings; + int i = 0; + + for (i = 0; i < adapter->num_queues; i++, rxr++) { + em_free_receive_buffers(rxr); + /* Free the ring memory as well */ + em_dma_free(adapter, &rxr->rxdma); + EM_RX_LOCK_DESTROY(rxr); + } + + free(adapter->rx_rings, M_DEVBUF); +} + + +/********************************************************************* + * + * Free receive ring data structures + * + **********************************************************************/ +static void +em_free_receive_buffers(struct rx_ring *rxr) +{ + struct adapter *adapter = rxr->adapter; + struct em_buffer *rxbuf = NULL; + int i = 0; + + INIT_DEBUGOUT("free_receive_buffers: begin"); + + if (rxr->rx_buffers != NULL) { + for (i = 0; i < adapter->num_rx_desc; i++) { + rxbuf = &rxr->rx_buffers[i]; + if (rxbuf->map != NULL) { + bus_dmamap_sync(rxr->rxtag, rxbuf->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->rxtag, rxbuf->map); + bus_dmamap_destroy(rxr->rxtag, rxbuf->map); + } + if (rxbuf->m_head != NULL) { + m_freem(rxbuf->m_head); + rxbuf->m_head = NULL; + } + } + free(rxr->rx_buffers, M_DEVBUF); + rxr->rx_buffers = NULL; + } + + if (rxr->rxtag != NULL) { + bus_dma_tag_destroy(rxr->rxtag); + rxr->rxtag = NULL; + } + + return; +} + + /********************************************************************* * * Enable receive unit. @@ -4199,97 +4101,47 @@ em_setup_receive_structures(struct adapter *adapter) static void em_initialize_receive_unit(struct adapter *adapter) { + struct rx_ring *rxr = adapter->rx_rings; struct ifnet *ifp = adapter->ifp; + struct e1000_hw *hw = &adapter->hw; u64 bus_addr; u32 rctl, rxcsum; - int i; + int i = 0; - INIT_DEBUGOUT("em_initialize_receive_unit: begin"); + INIT_DEBUGOUT("em_initialize_receive_units: begin"); /* * Make sure receives are disabled while setting * up the descriptor ring */ - rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + rctl = E1000_READ_REG(hw, E1000_RCTL); + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); - if (adapter->hw.mac.type >= e1000_82540) { - E1000_WRITE_REG(&adapter->hw, E1000_RADV, - adapter->rx_abs_int_delay.value); - /* - * Set the interrupt throttling rate. Value is calculated - * as DEFAULT_ITR = 1/(MAX_INTS_PER_SEC * 256ns) - */ - E1000_WRITE_REG(&adapter->hw, E1000_ITR, DEFAULT_ITR); - } + E1000_WRITE_REG(&adapter->hw, E1000_RADV, + adapter->rx_abs_int_delay.value); + /* + * Set the interrupt throttling rate. Value is calculated + * as DEFAULT_ITR = 1/(MAX_INTS_PER_SEC * 256ns) + */ + E1000_WRITE_REG(hw, E1000_ITR, DEFAULT_ITR); /* ** When using MSIX interrupts we need to throttle ** using the EITR register (82574 only) */ - if (adapter->msix) + if (hw->mac.type == e1000_82574) for (i = 0; i < 4; i++) - E1000_WRITE_REG(&adapter->hw, - E1000_EITR_82574(i), DEFAULT_ITR); + E1000_WRITE_REG(hw, E1000_EITR_82574(i), + DEFAULT_ITR); /* Disable accelerated ackknowledge */ if (adapter->hw.mac.type == e1000_82574) - E1000_WRITE_REG(&adapter->hw, - E1000_RFCTL, E1000_RFCTL_ACK_DIS); + E1000_WRITE_REG(hw, E1000_RFCTL, E1000_RFCTL_ACK_DIS); - /* Setup the Base and Length of the Rx Descriptor Ring */ - bus_addr = adapter->rxdma.dma_paddr; - E1000_WRITE_REG(&adapter->hw, E1000_RDLEN(0), - adapter->num_rx_desc * sizeof(struct e1000_rx_desc)); - E1000_WRITE_REG(&adapter->hw, E1000_RDBAH(0), - (u32)(bus_addr >> 32)); - E1000_WRITE_REG(&adapter->hw, E1000_RDBAL(0), - (u32)bus_addr); - - /* Setup the Receive Control Register */ - rctl &= ~(3 << E1000_RCTL_MO_SHIFT); - rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_LBM_NO | - E1000_RCTL_RDMTS_HALF | - (adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT); - - /* Make sure VLAN Filters are off */ - rctl &= ~E1000_RCTL_VFE; - - if (e1000_tbi_sbp_enabled_82543(&adapter->hw)) - rctl |= E1000_RCTL_SBP; - else - rctl &= ~E1000_RCTL_SBP; - - switch (adapter->rx_buffer_len) { - default: - case 2048: - rctl |= E1000_RCTL_SZ_2048; - break; - case 4096: - rctl |= E1000_RCTL_SZ_4096 | - E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - case 8192: - rctl |= E1000_RCTL_SZ_8192 | - E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - case 16384: - rctl |= E1000_RCTL_SZ_16384 | - E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - } - - if (ifp->if_mtu > ETHERMTU) - rctl |= E1000_RCTL_LPE; - else - rctl &= ~E1000_RCTL_LPE; - - /* Enable 82543 Receive Checksum Offload for TCP and UDP */ - if ((adapter->hw.mac.type >= e1000_82543) && - (ifp->if_capenable & IFCAP_RXCSUM)) { - rxcsum = E1000_READ_REG(&adapter->hw, E1000_RXCSUM); + if (ifp->if_capenable & IFCAP_RXCSUM) { + rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); rxcsum |= (E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); - E1000_WRITE_REG(&adapter->hw, E1000_RXCSUM, rxcsum); + E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); } /* @@ -4299,72 +4151,69 @@ em_initialize_receive_unit(struct adapter *adapter) ** values in RDTR is a known source of problems on other ** platforms another solution is being sought. */ - if (adapter->hw.mac.type == e1000_82573) - E1000_WRITE_REG(&adapter->hw, E1000_RDTR, 0x20); + if (hw->mac.type == e1000_82573) + E1000_WRITE_REG(hw, E1000_RDTR, 0x20); - /* Enable Receives */ - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); + for (i = 0; i < adapter->num_queues; i++, rxr++) { + /* Setup the Base and Length of the Rx Descriptor Ring */ + bus_addr = rxr->rxdma.dma_paddr; + E1000_WRITE_REG(hw, E1000_RDLEN(i), + adapter->num_rx_desc * sizeof(struct e1000_rx_desc)); + E1000_WRITE_REG(hw, E1000_RDBAH(i), (u32)(bus_addr >> 32)); + E1000_WRITE_REG(hw, E1000_RDBAL(i), (u32)bus_addr); + /* Setup the Head and Tail Descriptor Pointers */ + E1000_WRITE_REG(hw, E1000_RDH(i), 0); + E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); + } - /* - * Setup the HW Rx Head and - * Tail Descriptor Pointers - */ - E1000_WRITE_REG(&adapter->hw, E1000_RDH(0), 0); - E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), adapter->num_rx_desc - 1); + /* Set early receive threshold on appropriate hw */ + if (((adapter->hw.mac.type == e1000_ich9lan) || + (adapter->hw.mac.type == e1000_pch2lan) || + (adapter->hw.mac.type == e1000_ich10lan)) && + (ifp->if_mtu > ETHERMTU)) { + u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); + E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); + E1000_WRITE_REG(hw, E1000_ERT, 0x100 | (1 << 13)); + } + + if (adapter->hw.mac.type == e1000_pch2lan) { + if (ifp->if_mtu > ETHERMTU) + e1000_lv_jumbo_workaround_ich8lan(hw, TRUE); + else + e1000_lv_jumbo_workaround_ich8lan(hw, FALSE); + } + + /* Setup the Receive Control Register */ + rctl &= ~(3 << E1000_RCTL_MO_SHIFT); + rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | + E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | + (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT); + + /* Strip the CRC */ + rctl |= E1000_RCTL_SECRC; + + /* Make sure VLAN Filters are off */ + rctl &= ~E1000_RCTL_VFE; + rctl &= ~E1000_RCTL_SBP; + + if (adapter->rx_mbuf_sz == MCLBYTES) + rctl |= E1000_RCTL_SZ_2048; + else if (adapter->rx_mbuf_sz == MJUMPAGESIZE) + rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX; + else if (adapter->rx_mbuf_sz > MJUMPAGESIZE) + rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX; + + if (ifp->if_mtu > ETHERMTU) + rctl |= E1000_RCTL_LPE; + else + rctl &= ~E1000_RCTL_LPE; + + /* Write out the settings */ + E1000_WRITE_REG(hw, E1000_RCTL, rctl); return; } -/********************************************************************* - * - * Free receive related data structures. - * - **********************************************************************/ -static void -em_free_receive_structures(struct adapter *adapter) -{ - struct em_buffer *rx_buffer; - int i; - - INIT_DEBUGOUT("free_receive_structures: begin"); - - if (adapter->rx_sparemap) { - bus_dmamap_destroy(adapter->rxtag, adapter->rx_sparemap); - adapter->rx_sparemap = NULL; - } - - /* Cleanup any existing buffers */ - if (adapter->rx_buffer_area != NULL) { - rx_buffer = adapter->rx_buffer_area; - for (i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) { - if (rx_buffer->m_head != NULL) { - bus_dmamap_sync(adapter->rxtag, rx_buffer->map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(adapter->rxtag, - rx_buffer->map); - m_freem(rx_buffer->m_head); - rx_buffer->m_head = NULL; - } else if (rx_buffer->map != NULL) - bus_dmamap_unload(adapter->rxtag, - rx_buffer->map); - if (rx_buffer->map != NULL) { - bus_dmamap_destroy(adapter->rxtag, - rx_buffer->map); - rx_buffer->map = NULL; - } - } - } - - if (adapter->rx_buffer_area != NULL) { - free(adapter->rx_buffer_area, M_DEVBUF); - adapter->rx_buffer_area = NULL; - } - - if (adapter->rxtag != NULL) { - bus_dma_tag_destroy(adapter->rxtag); - adapter->rxtag = NULL; - } -} /********************************************************************* * @@ -4374,189 +4223,158 @@ em_free_receive_structures(struct adapter *adapter) * * We loop at most count times if count is > 0, or until done if * count < 0. - * + * + * For polling we also now return the number of cleaned packets *********************************************************************/ -static int -em_rxeof(struct adapter *adapter, int count) +static bool +em_rxeof(struct rx_ring *rxr, int count, int *done) { - struct ifnet *ifp = adapter->ifp; - struct mbuf *mp; - u8 status, accept_frame = 0, eop = 0; - u16 len, desc_len, prev_len_adj; - int i; - struct e1000_rx_desc *current_desc; + struct adapter *adapter = rxr->adapter; + struct ifnet *ifp = adapter->ifp; + struct mbuf *mp, *sendmp; + u8 status = 0; + u16 len; + int i, processed, rxdone = 0; + bool eop; + struct e1000_rx_desc *cur; - EM_RX_LOCK(adapter); - i = adapter->next_rx_desc_to_check; - current_desc = &adapter->rx_desc_base[i]; - bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, - BUS_DMASYNC_POSTREAD); + EM_RX_LOCK(rxr); - if (!((current_desc->status) & E1000_RXD_STAT_DD)) { - EM_RX_UNLOCK(adapter); - return (0); - } + for (i = rxr->next_to_check, processed = 0; count != 0;) { - while ((current_desc->status & E1000_RXD_STAT_DD) && - (count != 0) && - (ifp->if_drv_flags & IFF_DRV_RUNNING)) { - struct mbuf *m = NULL; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; - mp = adapter->rx_buffer_area[i].m_head; - /* - * Can't defer bus_dmamap_sync(9) because TBI_ACCEPT - * needs to access the last received byte in the mbuf. - */ - bus_dmamap_sync(adapter->rxtag, adapter->rx_buffer_area[i].map, - BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - accept_frame = 1; - prev_len_adj = 0; - desc_len = le16toh(current_desc->length); - status = current_desc->status; - if (status & E1000_RXD_STAT_EOP) { - count--; - eop = 1; - if (desc_len < ETHER_CRC_LEN) { - len = 0; - prev_len_adj = ETHER_CRC_LEN - desc_len; - } else - len = desc_len - ETHER_CRC_LEN; + cur = &rxr->rx_base[i]; + status = cur->status; + mp = sendmp = NULL; + + if ((status & E1000_RXD_STAT_DD) == 0) + break; + + len = le16toh(cur->length); + eop = (status & E1000_RXD_STAT_EOP) != 0; + + if ((cur->errors & E1000_RXD_ERR_FRAME_ERR_MASK) || + (rxr->discard == TRUE)) { + ifp->if_ierrors++; + ++rxr->rx_discarded; + if (!eop) /* Catch subsequent segs */ + rxr->discard = TRUE; + else + rxr->discard = FALSE; + em_rx_discard(rxr, i); + goto next_desc; + } + + /* Assign correct length to the current fragment */ + mp = rxr->rx_buffers[i].m_head; + mp->m_len = len; + + /* Trigger for refresh */ + rxr->rx_buffers[i].m_head = NULL; + + /* First segment? */ + if (rxr->fmp == NULL) { + mp->m_pkthdr.len = len; + rxr->fmp = rxr->lmp = mp; } else { - eop = 0; - len = desc_len; + /* Chain mbuf's together */ + mp->m_flags &= ~M_PKTHDR; + rxr->lmp->m_next = mp; + rxr->lmp = mp; + rxr->fmp->m_pkthdr.len += len; } - if (current_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK) { - u8 last_byte; - u32 pkt_len = desc_len; - - if (adapter->fmp != NULL) - pkt_len += adapter->fmp->m_pkthdr.len; - - last_byte = *(mtod(mp, caddr_t) + desc_len - 1); - if (TBI_ACCEPT(&adapter->hw, status, - current_desc->errors, pkt_len, last_byte, - adapter->min_frame_size, adapter->max_frame_size)) { - e1000_tbi_adjust_stats_82543(&adapter->hw, - &adapter->stats, pkt_len, - adapter->hw.mac.addr, - adapter->max_frame_size); - if (len > 0) - len--; - } else - accept_frame = 0; - } - - if (accept_frame) { - if (em_get_buf(adapter, i) != 0) { - ifp->if_iqdrops++; - goto discard; - } - - /* Assign correct length to the current fragment */ - mp->m_len = len; - - if (adapter->fmp == NULL) { - mp->m_pkthdr.len = len; - adapter->fmp = mp; /* Store the first mbuf */ - adapter->lmp = mp; - } else { - /* Chain mbuf's together */ - mp->m_flags &= ~M_PKTHDR; - /* - * Adjust length of previous mbuf in chain if - * we received less than 4 bytes in the last - * descriptor. - */ - if (prev_len_adj > 0) { - adapter->lmp->m_len -= prev_len_adj; - adapter->fmp->m_pkthdr.len -= - prev_len_adj; - } - adapter->lmp->m_next = mp; - adapter->lmp = adapter->lmp->m_next; - adapter->fmp->m_pkthdr.len += len; - } - - if (eop) { - adapter->fmp->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; - em_receive_checksum(adapter, current_desc, - adapter->fmp); + if (eop) { + --count; + sendmp = rxr->fmp; + sendmp->m_pkthdr.rcvif = ifp; + ifp->if_ipackets++; + em_receive_checksum(cur, sendmp); #ifndef __NO_STRICT_ALIGNMENT - if (adapter->max_frame_size > - (MCLBYTES - ETHER_ALIGN) && - em_fixup_rx(adapter) != 0) - goto skip; + if (adapter->max_frame_size > + (MCLBYTES - ETHER_ALIGN) && + em_fixup_rx(rxr) != 0) + goto skip; #endif - if (status & E1000_RXD_STAT_VP) { -#if __FreeBSD_version < 700000 - VLAN_INPUT_TAG_NEW(ifp, adapter->fmp, - (le16toh(current_desc->special) & - E1000_RXD_SPC_VLAN_MASK)); -#else - adapter->fmp->m_pkthdr.ether_vtag = - (le16toh(current_desc->special) & - E1000_RXD_SPC_VLAN_MASK); - adapter->fmp->m_flags |= M_VLANTAG; + if (status & E1000_RXD_STAT_VP) { + sendmp->m_pkthdr.ether_vtag = + (le16toh(cur->special) & + E1000_RXD_SPC_VLAN_MASK); + sendmp->m_flags |= M_VLANTAG; + } +#ifdef EM_MULTIQUEUE + sendmp->m_pkthdr.flowid = rxr->msix; + sendmp->m_flags |= M_FLOWID; #endif - } #ifndef __NO_STRICT_ALIGNMENT skip: #endif - m = adapter->fmp; - adapter->fmp = NULL; - adapter->lmp = NULL; - } - } else { - ifp->if_ierrors++; -discard: - /* Reuse loaded DMA map and just update mbuf chain */ - mp = adapter->rx_buffer_area[i].m_head; - mp->m_len = mp->m_pkthdr.len = MCLBYTES; - mp->m_data = mp->m_ext.ext_buf; - mp->m_next = NULL; - if (adapter->max_frame_size <= - (MCLBYTES - ETHER_ALIGN)) - m_adj(mp, ETHER_ALIGN); - if (adapter->fmp != NULL) { - m_freem(adapter->fmp); - adapter->fmp = NULL; - adapter->lmp = NULL; - } - m = NULL; + rxr->fmp = rxr->lmp = NULL; } - +next_desc: /* Zero out the receive descriptors status. */ - current_desc->status = 0; - bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + cur->status = 0; + ++rxdone; /* cumulative for POLL */ + ++processed; /* Advance our pointers to the next descriptor. */ if (++i == adapter->num_rx_desc) i = 0; - if (m != NULL) { - adapter->next_rx_desc_to_check = i; - /* Unlock for call into stack */ - EM_RX_UNLOCK(adapter); - (*ifp->if_input)(ifp, m); - EM_RX_LOCK(adapter); - i = adapter->next_rx_desc_to_check; + + /* Send to the stack */ + if (sendmp != NULL) { + rxr->next_to_check = i; + EM_RX_UNLOCK(rxr); + (*ifp->if_input)(ifp, sendmp); + EM_RX_LOCK(rxr); + i = rxr->next_to_check; + } + + /* Only refresh mbufs every 8 descriptors */ + if (processed == 8) { + em_refresh_mbufs(rxr, i); + processed = 0; } - current_desc = &adapter->rx_desc_base[i]; } - adapter->next_rx_desc_to_check = i; - /* Advance the E1000's Receive Queue #0 "Tail Pointer". */ - if (--i < 0) - i = adapter->num_rx_desc - 1; - E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), i); - EM_RX_UNLOCK(adapter); - if (!((current_desc->status) & E1000_RXD_STAT_DD)) - return (0); + /* Catch any remaining refresh work */ + em_refresh_mbufs(rxr, i); - return (1); + rxr->next_to_check = i; + if (done != NULL) + *done = rxdone; + EM_RX_UNLOCK(rxr); + + return ((status & E1000_RXD_STAT_DD) ? TRUE : FALSE); +} + +static __inline void +em_rx_discard(struct rx_ring *rxr, int i) +{ + struct em_buffer *rbuf; + + rbuf = &rxr->rx_buffers[i]; + /* Free any previous pieces */ + if (rxr->fmp != NULL) { + rxr->fmp->m_flags |= M_PKTHDR; + m_freem(rxr->fmp); + rxr->fmp = NULL; + rxr->lmp = NULL; + } + /* + ** Free buffer and allow em_refresh_mbufs() + ** to clean up and recharge buffer. + */ + if (rbuf->m_head) { + m_free(rbuf->m_head); + rbuf->m_head = NULL; + } + return; } #ifndef __NO_STRICT_ALIGNMENT @@ -4575,13 +4393,14 @@ discard: * not used at all on architectures with strict alignment. */ static int -em_fixup_rx(struct adapter *adapter) +em_fixup_rx(struct rx_ring *rxr) { + struct adapter *adapter = rxr->adapter; struct mbuf *m, *n; int error; error = 0; - m = adapter->fmp; + m = rxr->fmp; if (m->m_len <= (MCLBYTES - ETHER_HDR_LEN)) { bcopy(m->m_data, m->m_data + ETHER_HDR_LEN, m->m_len); m->m_data += ETHER_HDR_LEN; @@ -4594,11 +4413,11 @@ em_fixup_rx(struct adapter *adapter) n->m_len = ETHER_HDR_LEN; M_MOVE_PKTHDR(n, m); n->m_next = m; - adapter->fmp = n; + rxr->fmp = n; } else { adapter->dropped_pkts++; - m_freem(adapter->fmp); - adapter->fmp = NULL; + m_freem(rxr->fmp); + rxr->fmp = NULL; error = ENOMEM; } } @@ -4615,13 +4434,10 @@ em_fixup_rx(struct adapter *adapter) * *********************************************************************/ static void -em_receive_checksum(struct adapter *adapter, - struct e1000_rx_desc *rx_desc, struct mbuf *mp) +em_receive_checksum(struct e1000_rx_desc *rx_desc, struct mbuf *mp) { - /* 82543 or newer only */ - if ((adapter->hw.mac.type < e1000_82543) || - /* Ignore Checksum bit is set */ - (rx_desc->status & E1000_RXD_STAT_IXSM)) { + /* Ignore Checksum bit is set */ + if (rx_desc->status & E1000_RXD_STAT_IXSM) { mp->m_pkthdr.csum_flags = 0; return; } @@ -4648,38 +4464,31 @@ em_receive_checksum(struct adapter *adapter, } } - -#ifdef EM_HW_VLAN_SUPPORT /* * This routine is run via an vlan * config EVENT */ static void -em_register_vlan(void *unused, struct ifnet *ifp, u16 vtag) +em_register_vlan(void *arg, struct ifnet *ifp, u16 vtag) { struct adapter *adapter = ifp->if_softc; - u32 ctrl, rctl, index, vfta; + u32 index, bit; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + if (ifp->if_softc != arg) /* Not our event */ + return; - /* Setup for Hardware Filter */ - rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); - rctl |= E1000_RCTL_VFE; - rctl &= ~E1000_RCTL_CFIEN; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); - - /* Make entry in the hardware filter table */ - index = ((vtag >> 5) & 0x7F); - vfta = E1000_READ_REG_ARRAY(&adapter->hw, E1000_VFTA, index); - vfta |= (1 << (vtag & 0x1F)); - E1000_WRITE_REG_ARRAY(&adapter->hw, E1000_VFTA, index, vfta); - - /* Update the frame size */ - E1000_WRITE_REG(&adapter->hw, E1000_RLPML, - adapter->max_frame_size + VLAN_TAG_SIZE); + if ((vtag == 0) || (vtag > 4095)) /* Invalid ID */ + return; + EM_CORE_LOCK(adapter); + index = (vtag >> 5) & 0x7F; + bit = vtag & 0x1F; + adapter->shadow_vfta[index] |= (1 << bit); + ++adapter->num_vlans; + /* Re-init to load the changes */ + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + em_init_locked(adapter); + EM_CORE_UNLOCK(adapter); } /* @@ -4687,30 +4496,63 @@ em_register_vlan(void *unused, struct ifnet *ifp, u16 vtag) * unconfig EVENT */ static void -em_unregister_vlan(void *unused, struct ifnet *ifp, u16 vtag) +em_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag) { struct adapter *adapter = ifp->if_softc; - u32 index, vfta; + u32 index, bit; - /* Remove entry in the hardware filter table */ - index = ((vtag >> 5) & 0x7F); - vfta = E1000_READ_REG_ARRAY(&adapter->hw, E1000_VFTA, index); - vfta &= ~(1 << (vtag & 0x1F)); - E1000_WRITE_REG_ARRAY(&adapter->hw, E1000_VFTA, index, vfta); - /* Have all vlans unregistered? */ - if (adapter->ifp->if_vlantrunk == NULL) { - u32 rctl; - /* Turn off the filter table */ - rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); - rctl &= ~E1000_RCTL_VFE; - rctl |= E1000_RCTL_CFIEN; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); - /* Reset the frame size */ - E1000_WRITE_REG(&adapter->hw, E1000_RLPML, - adapter->max_frame_size); - } + if (ifp->if_softc != arg) + return; + + if ((vtag == 0) || (vtag > 4095)) /* Invalid */ + return; + + EM_CORE_LOCK(adapter); + index = (vtag >> 5) & 0x7F; + bit = vtag & 0x1F; + adapter->shadow_vfta[index] &= ~(1 << bit); + --adapter->num_vlans; + /* Re-init to load the changes */ + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + em_init_locked(adapter); + EM_CORE_UNLOCK(adapter); +} + +static void +em_setup_vlan_hw_support(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + int i = 0; + + /* + ** We get here thru init_locked, meaning + ** a soft reset, this has already cleared + ** the VFTA and other state, so if there + ** have been no vlan's registered do nothing. + */ + if (adapter->num_vlans == 0) + return; + + /* + ** A soft reset zero's out the VFTA, so + ** we need to repopulate it now. + */ + for (i = 0; i < EM_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) + E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, + i, adapter->shadow_vfta[i]); + + reg = E1000_READ_REG(hw, E1000_CTRL); + reg |= E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + + /* Enable the Filter Table */ + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~E1000_RCTL_CFIEN; + reg |= E1000_RCTL_VFE; + E1000_WRITE_REG(hw, E1000_RCTL, reg); } -#endif /* EM_HW_VLAN_SUPPORT */ static void em_enable_intr(struct adapter *adapter) @@ -4718,7 +4560,7 @@ em_enable_intr(struct adapter *adapter) struct e1000_hw *hw = &adapter->hw; u32 ims_mask = IMS_ENABLE_MASK; - if (adapter->msix) { + if (hw->mac.type == e1000_82574) { E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK); ims_mask |= EM_MSIX_MASK; } @@ -4730,7 +4572,7 @@ em_disable_intr(struct adapter *adapter) { struct e1000_hw *hw = &adapter->hw; - if (adapter->msix) + if (hw->mac.type == e1000_82574) E1000_WRITE_REG(hw, EM_EIAC, 0); E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); } @@ -4753,15 +4595,12 @@ em_init_manageability(struct adapter *adapter) manc &= ~(E1000_MANC_ARP_EN); /* enable receiving management packets to the host */ - if (adapter->hw.mac.type >= e1000_82571) { - manc |= E1000_MANC_EN_MNG2HOST; + manc |= E1000_MANC_EN_MNG2HOST; #define E1000_MNG2HOST_PORT_623 (1 << 5) #define E1000_MNG2HOST_PORT_664 (1 << 6) - manc2h |= E1000_MNG2HOST_PORT_623; - manc2h |= E1000_MNG2HOST_PORT_664; - E1000_WRITE_REG(&adapter->hw, E1000_MANC2H, manc2h); - } - + manc2h |= E1000_MNG2HOST_PORT_623; + manc2h |= E1000_MNG2HOST_PORT_664; + E1000_WRITE_REG(&adapter->hw, E1000_MANC2H, manc2h); E1000_WRITE_REG(&adapter->hw, E1000_MANC, manc); } } @@ -4778,81 +4617,61 @@ em_release_manageability(struct adapter *adapter) /* re-enable hardware interception of ARP */ manc |= E1000_MANC_ARP_EN; - - if (adapter->hw.mac.type >= e1000_82571) - manc &= ~E1000_MANC_EN_MNG2HOST; + manc &= ~E1000_MANC_EN_MNG2HOST; E1000_WRITE_REG(&adapter->hw, E1000_MANC, manc); } } /* - * em_get_hw_control sets {CTRL_EXT|FWSM}:DRV_LOAD bit. - * For ASF and Pass Through versions of f/w this means that - * the driver is loaded. For AMT version (only with 82573) - * of the f/w this means that the network i/f is open. - * + * em_get_hw_control sets the {CTRL_EXT|FWSM}:DRV_LOAD bit. + * For ASF and Pass Through versions of f/w this means + * that the driver is loaded. For AMT version type f/w + * this means that the network i/f is open. */ static void em_get_hw_control(struct adapter *adapter) { u32 ctrl_ext, swsm; - /* Let firmware know the driver has taken over */ - switch (adapter->hw.mac.type) { - case e1000_82573: + if (adapter->hw.mac.type == e1000_82573) { swsm = E1000_READ_REG(&adapter->hw, E1000_SWSM); E1000_WRITE_REG(&adapter->hw, E1000_SWSM, swsm | E1000_SWSM_DRV_LOAD); - break; - case e1000_82571: - case e1000_82572: - case e1000_80003es2lan: - case e1000_ich8lan: - case e1000_ich9lan: - case e1000_ich10lan: - ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, - ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); - break; - default: - break; + return; } + /* else */ + ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, + ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); + return; } /* * em_release_hw_control resets {CTRL_EXT|FWSM}:DRV_LOAD bit. - * For ASF and Pass Through versions of f/w this means that the - * driver is no longer loaded. For AMT version (only with 82573) i - * of the f/w this means that the network i/f is closed. - * + * For ASF and Pass Through versions of f/w this means that + * the driver is no longer loaded. For AMT versions of the + * f/w this means that the network i/f is closed. */ static void em_release_hw_control(struct adapter *adapter) { u32 ctrl_ext, swsm; - /* Let firmware taken over control of h/w */ - switch (adapter->hw.mac.type) { - case e1000_82573: + if (!adapter->has_manage) + return; + + if (adapter->hw.mac.type == e1000_82573) { swsm = E1000_READ_REG(&adapter->hw, E1000_SWSM); E1000_WRITE_REG(&adapter->hw, E1000_SWSM, swsm & ~E1000_SWSM_DRV_LOAD); - break; - case e1000_82571: - case e1000_82572: - case e1000_80003es2lan: - case e1000_ich8lan: - case e1000_ich9lan: - case e1000_ich10lan: - ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, - ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); - break; - default: - break; - + return; } + /* else */ + ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, + ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); + return; } static int @@ -4868,83 +4687,273 @@ em_is_valid_ether_addr(u8 *addr) } /* - * Enable PCI Wake On Lan capability - */ -void -em_enable_wakeup(device_t dev) +** Parse the interface capabilities with regard +** to both system management and wake-on-lan for +** later use. +*/ +static void +em_get_wakeup(device_t dev) { - u16 cap, status; - u8 id; + struct adapter *adapter = device_get_softc(dev); + u16 eeprom_data = 0, device_id, apme_mask; - /* First find the capabilities pointer*/ - cap = pci_read_config(dev, PCIR_CAP_PTR, 2); - /* Read the PM Capabilities */ - id = pci_read_config(dev, cap, 1); - if (id != PCIY_PMG) /* Something wrong */ - return; - /* OK, we have the power capabilities, so - now get the status register */ - cap += PCIR_POWER_STATUS; - status = pci_read_config(dev, cap, 2); - status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(dev, cap, status, 2); + adapter->has_manage = e1000_enable_mng_pass_thru(&adapter->hw); + apme_mask = EM_EEPROM_APME; + + switch (adapter->hw.mac.type) { + case e1000_82573: + case e1000_82583: + adapter->has_amt = TRUE; + /* Falls thru */ + case e1000_82571: + case e1000_82572: + case e1000_80003es2lan: + if (adapter->hw.bus.func == 1) { + e1000_read_nvm(&adapter->hw, + NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); + break; + } else + e1000_read_nvm(&adapter->hw, + NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); + break; + case e1000_ich8lan: + case e1000_ich9lan: + case e1000_ich10lan: + case e1000_pchlan: + case e1000_pch2lan: + apme_mask = E1000_WUC_APME; + adapter->has_amt = TRUE; + eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); + break; + default: + e1000_read_nvm(&adapter->hw, + NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); + break; + } + if (eeprom_data & apme_mask) + adapter->wol = (E1000_WUFC_MAG | E1000_WUFC_MC); + /* + * We have the eeprom settings, now apply the special cases + * where the eeprom may be wrong or the board won't support + * wake on lan on a particular port + */ + device_id = pci_get_device(dev); + switch (device_id) { + case E1000_DEV_ID_82571EB_FIBER: + /* Wake events only supported on port A for dual fiber + * regardless of eeprom setting */ + if (E1000_READ_REG(&adapter->hw, E1000_STATUS) & + E1000_STATUS_FUNC_1) + adapter->wol = 0; + break; + case E1000_DEV_ID_82571EB_QUAD_COPPER: + case E1000_DEV_ID_82571EB_QUAD_FIBER: + case E1000_DEV_ID_82571EB_QUAD_COPPER_LP: + /* if quad port adapter, disable WoL on all but port A */ + if (global_quad_port_a != 0) + adapter->wol = 0; + /* Reset for multiple quad port adapters */ + if (++global_quad_port_a == 4) + global_quad_port_a = 0; + break; + } return; } -/********************************************************************* -* 82544 Coexistence issue workaround. -* There are 2 issues. -* 1. Transmit Hang issue. -* To detect this issue, following equation can be used... -* SIZE[3:0] + ADDR[2:0] = SUM[3:0]. -* If SUM[3:0] is in between 1 to 4, we will have this issue. -* -* 2. DAC issue. -* To detect this issue, following equation can be used... -* SIZE[3:0] + ADDR[2:0] = SUM[3:0]. -* If SUM[3:0] is in between 9 to c, we will have this issue. -* -* -* WORKAROUND: -* Make sure we do not have ending address -* as 1,2,3,4(Hang) or 9,a,b,c (DAC) -* -*************************************************************************/ -static u32 -em_fill_descriptors (bus_addr_t address, u32 length, - PDESC_ARRAY desc_array) +/* + * Enable PCI Wake On Lan capability + */ +static void +em_enable_wakeup(device_t dev) { - u32 safe_terminator; + struct adapter *adapter = device_get_softc(dev); + struct ifnet *ifp = adapter->ifp; + u32 pmc, ctrl, ctrl_ext, rctl; + u16 status; - /* Since issue is sensitive to length and address.*/ - /* Let us first check the address...*/ - if (length <= 4) { - desc_array->descriptor[0].address = address; - desc_array->descriptor[0].length = length; - desc_array->elements = 1; - return (desc_array->elements); - } - safe_terminator = (u32)((((u32)address & 0x7) + - (length & 0xF)) & 0xF); - /* if it does not fall between 0x1 to 0x4 and 0x9 to 0xC then return */ - if (safe_terminator == 0 || - (safe_terminator > 4 && - safe_terminator < 9) || - (safe_terminator > 0xC && - safe_terminator <= 0xF)) { - desc_array->descriptor[0].address = address; - desc_array->descriptor[0].length = length; - desc_array->elements = 1; - return (desc_array->elements); + if ((pci_find_extcap(dev, PCIY_PMG, &pmc) != 0)) + return; + + /* Advertise the wakeup capability */ + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); + + if ((adapter->hw.mac.type == e1000_ich8lan) || + (adapter->hw.mac.type == e1000_pchlan) || + (adapter->hw.mac.type == e1000_ich9lan) || + (adapter->hw.mac.type == e1000_ich10lan)) { + e1000_disable_gig_wol_ich8lan(&adapter->hw); + e1000_hv_phy_powerdown_workaround_ich8lan(&adapter->hw); } - desc_array->descriptor[0].address = address; - desc_array->descriptor[0].length = length - 4; - desc_array->descriptor[1].address = address + (length - 4); - desc_array->descriptor[1].length = 4; - desc_array->elements = 2; - return (desc_array->elements); + /* Keep the laser running on Fiber adapters */ + if (adapter->hw.phy.media_type == e1000_media_type_fiber || + adapter->hw.phy.media_type == e1000_media_type_internal_serdes) { + ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + ctrl_ext |= E1000_CTRL_EXT_SDP3_DATA; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, ctrl_ext); + } + + /* + ** Determine type of Wakeup: note that wol + ** is set with all bits on by default. + */ + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) == 0) + adapter->wol &= ~E1000_WUFC_MAG; + + if ((ifp->if_capenable & IFCAP_WOL_MCAST) == 0) + adapter->wol &= ~E1000_WUFC_MC; + else { + rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + rctl |= E1000_RCTL_MPE; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); + } + + if ((adapter->hw.mac.type == e1000_pchlan) || + (adapter->hw.mac.type == e1000_pch2lan)) { + if (em_enable_phy_wakeup(adapter)) + return; + } else { + E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); + E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); + } + + if (adapter->hw.phy.type == e1000_phy_igp_3) + e1000_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); + + /* Request PME */ + status = pci_read_config(dev, pmc + PCIR_POWER_STATUS, 2); + status &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if (ifp->if_capenable & IFCAP_WOL) + status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(dev, pmc + PCIR_POWER_STATUS, status, 2); + + return; +} + +/* +** WOL in the newer chipset interfaces (pchlan) +** require thing to be copied into the phy +*/ +static int +em_enable_phy_wakeup(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 mreg, ret = 0; + u16 preg; + int i = 0; + + /* copy MAC RARs to PHY RARs */ + e1000_copy_rx_addrs_to_phy_ich8lan(hw); + + /* copy MAC MTA to PHY MTA */ + for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) { + mreg = E1000_READ_REG_ARRAY(hw, E1000_MTA, i); + e1000_write_phy_reg(hw, BM_MTA(i), (u16)(mreg & 0xFFFF)); + e1000_write_phy_reg(hw, BM_MTA(i) + 1, + (u16)((mreg >> 16) & 0xFFFF)); + } + + /* configure PHY Rx Control register */ + e1000_read_phy_reg(&adapter->hw, BM_RCTL, &preg); + mreg = E1000_READ_REG(hw, E1000_RCTL); + if (mreg & E1000_RCTL_UPE) + preg |= BM_RCTL_UPE; + if (mreg & E1000_RCTL_MPE) + preg |= BM_RCTL_MPE; + preg &= ~(BM_RCTL_MO_MASK); + if (mreg & E1000_RCTL_MO_3) + preg |= (((mreg & E1000_RCTL_MO_3) >> E1000_RCTL_MO_SHIFT) + << BM_RCTL_MO_SHIFT); + if (mreg & E1000_RCTL_BAM) + preg |= BM_RCTL_BAM; + if (mreg & E1000_RCTL_PMCF) + preg |= BM_RCTL_PMCF; + mreg = E1000_READ_REG(hw, E1000_CTRL); + if (mreg & E1000_CTRL_RFCE) + preg |= BM_RCTL_RFCE; + e1000_write_phy_reg(&adapter->hw, BM_RCTL, preg); + + /* enable PHY wakeup in MAC register */ + E1000_WRITE_REG(hw, E1000_WUC, + E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN); + E1000_WRITE_REG(hw, E1000_WUFC, adapter->wol); + + /* configure and enable PHY wakeup in PHY registers */ + e1000_write_phy_reg(&adapter->hw, BM_WUFC, adapter->wol); + e1000_write_phy_reg(&adapter->hw, BM_WUC, E1000_WUC_PME_EN); + + /* activate PHY wakeup */ + ret = hw->phy.ops.acquire(hw); + if (ret) { + printf("Could not acquire PHY\n"); + return ret; + } + e1000_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, + (BM_WUC_ENABLE_PAGE << IGP_PAGE_SHIFT)); + ret = e1000_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, &preg); + if (ret) { + printf("Could not read PHY page 769\n"); + goto out; + } + preg |= BM_WUC_ENABLE_BIT | BM_WUC_HOST_WU_BIT; + ret = e1000_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, preg); + if (ret) + printf("Could not set PHY Host Wakeup bit\n"); +out: + hw->phy.ops.release(hw); + + return ret; +} + +static void +em_led_func(void *arg, int onoff) +{ + struct adapter *adapter = arg; + + EM_CORE_LOCK(adapter); + if (onoff) { + e1000_setup_led(&adapter->hw); + e1000_led_on(&adapter->hw); + } else { + e1000_led_off(&adapter->hw); + e1000_cleanup_led(&adapter->hw); + } + EM_CORE_UNLOCK(adapter); +} + +/* +** Disable the L0S and L1 LINK states +*/ +static void +em_disable_aspm(struct adapter *adapter) +{ + int base, reg; + u16 link_cap,link_ctrl; + device_t dev = adapter->dev; + + switch (adapter->hw.mac.type) { + case e1000_82573: + case e1000_82574: + case e1000_82583: + break; + default: + return; + } + if (pci_find_extcap(dev, PCIY_EXPRESS, &base) != 0) + return; + reg = base + PCIR_EXPRESS_LINK_CAP; + link_cap = pci_read_config(dev, reg, 2); + if ((link_cap & PCIM_LINK_CAP_ASPM) == 0) + return; + reg = base + PCIR_EXPRESS_LINK_CTL; + link_ctrl = pci_read_config(dev, reg, 2); + link_ctrl &= 0xFFFC; /* turn off bit 1 and 2 */ + pci_write_config(dev, reg, link_ctrl, 2); + return; } /********************************************************************** @@ -4974,7 +4983,12 @@ em_update_stats_counters(struct adapter *adapter) adapter->stats.rlec += E1000_READ_REG(&adapter->hw, E1000_RLEC); adapter->stats.xonrxc += E1000_READ_REG(&adapter->hw, E1000_XONRXC); adapter->stats.xontxc += E1000_READ_REG(&adapter->hw, E1000_XONTXC); - adapter->stats.xoffrxc += E1000_READ_REG(&adapter->hw, E1000_XOFFRXC); + /* + ** For watchdog management we need to know if we have been + ** paused during the last interval, so capture that here. + */ + adapter->pause_frames = E1000_READ_REG(&adapter->hw, E1000_XOFFRXC); + adapter->stats.xoffrxc += adapter->pause_frames; adapter->stats.xofftxc += E1000_READ_REG(&adapter->hw, E1000_XOFFTXC); adapter->stats.fcruc += E1000_READ_REG(&adapter->hw, E1000_FCRUC); adapter->stats.prc64 += E1000_READ_REG(&adapter->hw, E1000_PRC64); @@ -4991,8 +5005,10 @@ em_update_stats_counters(struct adapter *adapter) /* For the 64-bit byte counters the low dword must be read first. */ /* Both registers clear on the read of the high dword */ - adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCH); - adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCH); + adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCL) + + ((u64)E1000_READ_REG(&adapter->hw, E1000_GORCH) << 32); + adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCL) + + ((u64)E1000_READ_REG(&adapter->hw, E1000_GOTCH) << 32); adapter->stats.rnbc += E1000_READ_REG(&adapter->hw, E1000_RNBC); adapter->stats.ruc += E1000_READ_REG(&adapter->hw, E1000_RUC); @@ -5014,6 +5030,18 @@ em_update_stats_counters(struct adapter *adapter) adapter->stats.mptc += E1000_READ_REG(&adapter->hw, E1000_MPTC); adapter->stats.bptc += E1000_READ_REG(&adapter->hw, E1000_BPTC); + /* Interrupt Counts */ + + adapter->stats.iac += E1000_READ_REG(&adapter->hw, E1000_IAC); + adapter->stats.icrxptc += E1000_READ_REG(&adapter->hw, E1000_ICRXPTC); + adapter->stats.icrxatc += E1000_READ_REG(&adapter->hw, E1000_ICRXATC); + adapter->stats.ictxptc += E1000_READ_REG(&adapter->hw, E1000_ICTXPTC); + adapter->stats.ictxatc += E1000_READ_REG(&adapter->hw, E1000_ICTXATC); + adapter->stats.ictxqec += E1000_READ_REG(&adapter->hw, E1000_ICTXQEC); + adapter->stats.ictxqmtc += E1000_READ_REG(&adapter->hw, E1000_ICTXQMTC); + adapter->stats.icrxdmtc += E1000_READ_REG(&adapter->hw, E1000_ICRXDMTC); + adapter->stats.icrxoc += E1000_READ_REG(&adapter->hw, E1000_ICRXOC); + if (adapter->hw.mac.type >= e1000_82543) { adapter->stats.algnerrc += E1000_READ_REG(&adapter->hw, E1000_ALGNERRC); @@ -5043,113 +5071,308 @@ em_update_stats_counters(struct adapter *adapter) adapter->stats.latecol + adapter->watchdog_events; } - -/********************************************************************** - * - * This routine is called only when em_display_debug_stats is enabled. - * This routine provides a way to take a look at important statistics - * maintained by the driver and hardware. - * - **********************************************************************/ -static void -em_print_debug_info(struct adapter *adapter) +/* Export a single 32-bit register via a read-only sysctl. */ +static int +em_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) { - device_t dev = adapter->dev; - u8 *hw_addr = adapter->hw.hw_addr; + struct adapter *adapter; + u_int val; - device_printf(dev, "Adapter hardware address = %p \n", hw_addr); - device_printf(dev, "CTRL = 0x%x RCTL = 0x%x \n", - E1000_READ_REG(&adapter->hw, E1000_CTRL), - E1000_READ_REG(&adapter->hw, E1000_RCTL)); - device_printf(dev, "Packet buffer = Tx=%dk Rx=%dk \n", - ((E1000_READ_REG(&adapter->hw, E1000_PBA) & 0xffff0000) >> 16),\ - (E1000_READ_REG(&adapter->hw, E1000_PBA) & 0xffff) ); - device_printf(dev, "Flow control watermarks high = %d low = %d\n", - adapter->hw.fc.high_water, - adapter->hw.fc.low_water); - device_printf(dev, "tx_int_delay = %d, tx_abs_int_delay = %d\n", - E1000_READ_REG(&adapter->hw, E1000_TIDV), - E1000_READ_REG(&adapter->hw, E1000_TADV)); - device_printf(dev, "rx_int_delay = %d, rx_abs_int_delay = %d\n", - E1000_READ_REG(&adapter->hw, E1000_RDTR), - E1000_READ_REG(&adapter->hw, E1000_RADV)); - device_printf(dev, "fifo workaround = %lld, fifo_reset_count = %lld\n", - (long long)adapter->tx_fifo_wrk_cnt, - (long long)adapter->tx_fifo_reset_cnt); - device_printf(dev, "hw tdh = %d, hw tdt = %d\n", - E1000_READ_REG(&adapter->hw, E1000_TDH(0)), - E1000_READ_REG(&adapter->hw, E1000_TDT(0))); - device_printf(dev, "hw rdh = %d, hw rdt = %d\n", - E1000_READ_REG(&adapter->hw, E1000_RDH(0)), - E1000_READ_REG(&adapter->hw, E1000_RDT(0))); - device_printf(dev, "Num Tx descriptors avail = %d\n", - adapter->num_tx_desc_avail); - device_printf(dev, "Tx Descriptors not avail1 = %ld\n", - adapter->no_tx_desc_avail1); - device_printf(dev, "Tx Descriptors not avail2 = %ld\n", - adapter->no_tx_desc_avail2); - device_printf(dev, "Std mbuf failed = %ld\n", - adapter->mbuf_alloc_failed); - device_printf(dev, "Std mbuf cluster failed = %ld\n", - adapter->mbuf_cluster_failed); - device_printf(dev, "Driver dropped packets = %ld\n", - adapter->dropped_pkts); - device_printf(dev, "Driver tx dma failure in encap = %ld\n", - adapter->no_tx_dma_setup); +#ifndef __HAIKU__ + adapter = oidp->oid_arg1; + val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2); +#endif + + return (sysctl_handle_int(oidp, &val, 0, req)); } +/* + * Add sysctl variables, one per statistic, to the system. + */ static void -em_print_hw_stats(struct adapter *adapter) +em_add_hw_stats(struct adapter *adapter) { device_t dev = adapter->dev; - device_printf(dev, "Excessive collisions = %lld\n", - (long long)adapter->stats.ecol); -#if (DEBUG_HW > 0) /* Dont output these errors normally */ - device_printf(dev, "Symbol errors = %lld\n", - (long long)adapter->stats.symerrs); -#endif - device_printf(dev, "Sequence errors = %lld\n", - (long long)adapter->stats.sec); - device_printf(dev, "Defer count = %lld\n", - (long long)adapter->stats.dc); - device_printf(dev, "Missed Packets = %lld\n", - (long long)adapter->stats.mpc); - device_printf(dev, "Receive No Buffers = %lld\n", - (long long)adapter->stats.rnbc); - /* RLEC is inaccurate on some hardware, calculate our own. */ - device_printf(dev, "Receive Length Errors = %lld\n", - ((long long)adapter->stats.roc + (long long)adapter->stats.ruc)); - device_printf(dev, "Receive errors = %lld\n", - (long long)adapter->stats.rxerrc); - device_printf(dev, "Crc errors = %lld\n", - (long long)adapter->stats.crcerrs); - device_printf(dev, "Alignment errors = %lld\n", - (long long)adapter->stats.algnerrc); - device_printf(dev, "Collision/Carrier extension errors = %lld\n", - (long long)adapter->stats.cexterr); - device_printf(dev, "RX overruns = %ld\n", adapter->rx_overruns); - device_printf(dev, "watchdog timeouts = %ld\n", - adapter->watchdog_events); - device_printf(dev, "RX MSIX IRQ = %ld TX MSIX IRQ = %ld" - " LINK MSIX IRQ = %ld\n", adapter->rx_irq, - adapter->tx_irq , adapter->link_irq); - device_printf(dev, "XON Rcvd = %lld\n", - (long long)adapter->stats.xonrxc); - device_printf(dev, "XON Xmtd = %lld\n", - (long long)adapter->stats.xontxc); - device_printf(dev, "XOFF Rcvd = %lld\n", - (long long)adapter->stats.xoffrxc); - device_printf(dev, "XOFF Xmtd = %lld\n", - (long long)adapter->stats.xofftxc); - device_printf(dev, "Good Packets Rcvd = %lld\n", - (long long)adapter->stats.gprc); - device_printf(dev, "Good Packets Xmtd = %lld\n", - (long long)adapter->stats.gptc); - device_printf(dev, "TSO Contexts Xmtd = %lld\n", - (long long)adapter->stats.tsctc); - device_printf(dev, "TSO Contexts Failed = %lld\n", - (long long)adapter->stats.tsctfc); + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); + struct sysctl_oid *tree = device_get_sysctl_tree(dev); + struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + struct e1000_hw_stats *stats = &adapter->stats; + + struct sysctl_oid *stat_node, *queue_node, *int_node; + struct sysctl_oid_list *stat_list, *queue_list, *int_list; + int i = 0; + +#define QUEUE_NAME_LEN 32 + char namebuf[QUEUE_NAME_LEN]; + + /* Driver Statistics */ + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "link_irq", + CTLFLAG_RD, &adapter->link_irq, 0, + "Link MSIX IRQ Handled"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_alloc_fail", + CTLFLAG_RD, &adapter->mbuf_alloc_failed, + "Std mbuf failed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "cluster_alloc_fail", + CTLFLAG_RD, &adapter->mbuf_cluster_failed, + "Std mbuf cluster failed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", + CTLFLAG_RD, &adapter->dropped_pkts, + "Driver dropped packets"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", + CTLFLAG_RD, &adapter->no_tx_dma_setup, + "Driver tx dma failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", + CTLFLAG_RD, &adapter->rx_overruns, + "RX overruns"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_timeouts", + CTLFLAG_RD, &adapter->watchdog_events, + "Watchdog timeouts"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "device_control", + CTLFLAG_RD, adapter, E1000_CTRL, + em_sysctl_reg_handler, "IU", + "Device Control Register"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_control", + CTLFLAG_RD, adapter, E1000_RCTL, + em_sysctl_reg_handler, "IU", + "Receiver Control Register"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_high_water", + CTLFLAG_RD, &adapter->hw.fc.high_water, 0, + "Flow Control High Watermark"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_low_water", + CTLFLAG_RD, &adapter->hw.fc.low_water, 0, + "Flow Control Low Watermark"); + + for (i = 0; i < adapter->num_queues; i++, rxr++, txr++) { + snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); + queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, + CTLFLAG_RD, NULL, "Queue Name"); + queue_list = SYSCTL_CHILDREN(queue_node); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", + CTLFLAG_RD, adapter, E1000_TDH(txr->me), + em_sysctl_reg_handler, "IU", + "Transmit Descriptor Head"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail", + CTLFLAG_RD, adapter, E1000_TDT(txr->me), + em_sysctl_reg_handler, "IU", + "Transmit Descriptor Tail"); + SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "tx_irq", + CTLFLAG_RD, &txr->tx_irq, + "Queue MSI-X Transmit Interrupts"); + SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "no_desc_avail", + CTLFLAG_RD, &txr->no_desc_avail, + "Queue No Descriptor Available"); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head", + CTLFLAG_RD, adapter, E1000_RDH(rxr->me), + em_sysctl_reg_handler, "IU", + "Receive Descriptor Head"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail", + CTLFLAG_RD, adapter, E1000_RDT(rxr->me), + em_sysctl_reg_handler, "IU", + "Receive Descriptor Tail"); + SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "rx_irq", + CTLFLAG_RD, &rxr->rx_irq, + "Queue MSI-X Receive Interrupts"); + } + + /* MAC stats get their own sub node */ + + stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac_stats", + CTLFLAG_RD, NULL, "Statistics"); + stat_list = SYSCTL_CHILDREN(stat_node); + + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "excess_coll", + CTLFLAG_RD, &stats->ecol, + "Excessive collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "single_coll", + CTLFLAG_RD, &stats->scc, + "Single collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "multiple_coll", + CTLFLAG_RD, &stats->mcc, + "Multiple collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "late_coll", + CTLFLAG_RD, &stats->latecol, + "Late collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "collision_count", + CTLFLAG_RD, &stats->colc, + "Collision Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "symbol_errors", + CTLFLAG_RD, &adapter->stats.symerrs, + "Symbol Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "sequence_errors", + CTLFLAG_RD, &adapter->stats.sec, + "Sequence Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "defer_count", + CTLFLAG_RD, &adapter->stats.dc, + "Defer Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "missed_packets", + CTLFLAG_RD, &adapter->stats.mpc, + "Missed Packets"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_no_buff", + CTLFLAG_RD, &adapter->stats.rnbc, + "Receive No Buffers"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_undersize", + CTLFLAG_RD, &adapter->stats.ruc, + "Receive Undersize"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_fragmented", + CTLFLAG_RD, &adapter->stats.rfc, + "Fragmented Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_oversize", + CTLFLAG_RD, &adapter->stats.roc, + "Oversized Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_jabber", + CTLFLAG_RD, &adapter->stats.rjc, + "Recevied Jabber"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_errs", + CTLFLAG_RD, &adapter->stats.rxerrc, + "Receive Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "crc_errs", + CTLFLAG_RD, &adapter->stats.crcerrs, + "CRC errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "alignment_errs", + CTLFLAG_RD, &adapter->stats.algnerrc, + "Alignment Errors"); + /* On 82575 these are collision counts */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "coll_ext_errs", + CTLFLAG_RD, &adapter->stats.cexterr, + "Collision/Carrier extension errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_recvd", + CTLFLAG_RD, &adapter->stats.xonrxc, + "XON Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_txd", + CTLFLAG_RD, &adapter->stats.xontxc, + "XON Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_recvd", + CTLFLAG_RD, &adapter->stats.xoffrxc, + "XOFF Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_txd", + CTLFLAG_RD, &adapter->stats.xofftxc, + "XOFF Transmitted"); + + /* Packet Reception Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_recvd", + CTLFLAG_RD, &adapter->stats.tpr, + "Total Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_recvd", + CTLFLAG_RD, &adapter->stats.gprc, + "Good Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_recvd", + CTLFLAG_RD, &adapter->stats.bprc, + "Broadcast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_recvd", + CTLFLAG_RD, &adapter->stats.mprc, + "Multicast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_64", + CTLFLAG_RD, &adapter->stats.prc64, + "64 byte frames received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_65_127", + CTLFLAG_RD, &adapter->stats.prc127, + "65-127 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_128_255", + CTLFLAG_RD, &adapter->stats.prc255, + "128-255 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_256_511", + CTLFLAG_RD, &adapter->stats.prc511, + "256-511 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_512_1023", + CTLFLAG_RD, &adapter->stats.prc1023, + "512-1023 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_1024_1522", + CTLFLAG_RD, &adapter->stats.prc1522, + "1023-1522 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_recvd", + CTLFLAG_RD, &adapter->stats.gorc, + "Good Octets Received"); + + /* Packet Transmission Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", + CTLFLAG_RD, &adapter->stats.gotc, + "Good Octets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", + CTLFLAG_RD, &adapter->stats.tpt, + "Total Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_txd", + CTLFLAG_RD, &adapter->stats.gptc, + "Good Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_txd", + CTLFLAG_RD, &adapter->stats.bptc, + "Broadcast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_txd", + CTLFLAG_RD, &adapter->stats.mptc, + "Multicast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_64", + CTLFLAG_RD, &adapter->stats.ptc64, + "64 byte frames transmitted "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_65_127", + CTLFLAG_RD, &adapter->stats.ptc127, + "65-127 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_128_255", + CTLFLAG_RD, &adapter->stats.ptc255, + "128-255 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_256_511", + CTLFLAG_RD, &adapter->stats.ptc511, + "256-511 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_512_1023", + CTLFLAG_RD, &adapter->stats.ptc1023, + "512-1023 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_1024_1522", + CTLFLAG_RD, &adapter->stats.ptc1522, + "1024-1522 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_txd", + CTLFLAG_RD, &adapter->stats.tsctc, + "TSO Contexts Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_ctx_fail", + CTLFLAG_RD, &adapter->stats.tsctfc, + "TSO Contexts Failed"); + + + /* Interrupt Stats */ + + int_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "interrupts", + CTLFLAG_RD, NULL, "Interrupt Statistics"); + int_list = SYSCTL_CHILDREN(int_node); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "asserts", + CTLFLAG_RD, &adapter->stats.iac, + "Interrupt Assertion Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_pkt_timer", + CTLFLAG_RD, &adapter->stats.icrxptc, + "Interrupt Cause Rx Pkt Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_abs_timer", + CTLFLAG_RD, &adapter->stats.icrxatc, + "Interrupt Cause Rx Abs Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_pkt_timer", + CTLFLAG_RD, &adapter->stats.ictxptc, + "Interrupt Cause Tx Pkt Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_abs_timer", + CTLFLAG_RD, &adapter->stats.ictxatc, + "Interrupt Cause Tx Abs Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_queue_empty", + CTLFLAG_RD, &adapter->stats.ictxqec, + "Interrupt Cause Tx Queue Empty Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_queue_min_thresh", + CTLFLAG_RD, &adapter->stats.ictxqmtc, + "Interrupt Cause Tx Queue Min Thresh Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_desc_min_thresh", + CTLFLAG_RD, &adapter->stats.icrxdmtc, + "Interrupt Cause Rx Desc Min Thresh Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_overrun", + CTLFLAG_RD, &adapter->stats.icrxoc, + "Interrupt Cause Receiver Overrun Count"); } /********************************************************************** @@ -5159,6 +5382,32 @@ em_print_hw_stats(struct adapter *adapter) * 32 words, stuff that matters is in that extent. * **********************************************************************/ +static int +em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter; + int error; + int result; + + result = -1; + error = sysctl_handle_int(oidp, &result, 0, req); + + if (error || !req->newptr) + return (error); + + /* + * This value will cause a hex dump of the + * first 32 16-bit words of the EEPROM to + * the screen. + */ + if (result == 1) { + adapter = (struct adapter *)arg1; + em_print_nvm_info(adapter); + } + + return (error); +} + static void em_print_nvm_info(struct adapter *adapter) { @@ -5179,67 +5428,13 @@ em_print_nvm_info(struct adapter *adapter) printf("\n"); } -static int -em_sysctl_debug_info(SYSCTL_HANDLER_ARGS) -{ - struct adapter *adapter; - int error; - int result; - - result = -1; - error = sysctl_handle_int(oidp, &result, 0, req); - - if (error || !req->newptr) - return (error); - - if (result == 1) { - adapter = (struct adapter *)arg1; - em_print_debug_info(adapter); - } - /* - * This value will cause a hex dump of the - * first 32 16-bit words of the EEPROM to - * the screen. - */ - if (result == 2) { - adapter = (struct adapter *)arg1; - em_print_nvm_info(adapter); - } - - return (error); -} - - -static int -em_sysctl_stats(SYSCTL_HANDLER_ARGS) -{ - struct adapter *adapter; - int error; - int result; - - result = -1; - error = sysctl_handle_int(oidp, &result, 0, req); - - if (error || !req->newptr) - return (error); - - if (result == 1) { - adapter = (struct adapter *)arg1; - em_print_hw_stats(adapter); - } - - return (error); -} - static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS) { struct em_int_delay_info *info; struct adapter *adapter; u32 regval; - int error; - int usecs; - int ticks; + int error, usecs, ticks; info = (struct em_int_delay_info *)arg1; usecs = info->value; @@ -5288,7 +5483,6 @@ em_add_int_delay_sysctl(struct adapter *adapter, const char *name, info, 0, em_sysctl_int_delay, "I", description); } -#ifndef EM_LEGACY_IRQ static void em_add_rx_process_limit(struct adapter *adapter, const char *name, const char *description, int *limit, int value) @@ -5298,102 +5492,71 @@ em_add_rx_process_limit(struct adapter *adapter, const char *name, SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } -#endif -#ifdef EM_TIMESYNC -/* - * Initialize the Time Sync Feature - */ -static int -em_tsync_init(struct adapter *adapter) -{ - device_t dev = adapter->dev; - u32 tx_ctl, rx_ctl; - - - E1000_WRITE_REG(&adapter->hw, E1000_TIMINCA, (1<<24) | - 20833/PICOSECS_PER_TICK); - - adapter->last_stamp = E1000_READ_REG(&adapter->hw, E1000_SYSTIML); - adapter->last_stamp |= (u64)E1000_READ_REG(&adapter->hw, - E1000_SYSTIMH) << 32ULL; - - /* Enable the TX side */ - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - tx_ctl |= 0x10; - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCTXCTL, tx_ctl); - E1000_WRITE_FLUSH(&adapter->hw); - - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - if ((tx_ctl & 0x10) == 0) { - device_printf(dev, "Failed to enable TX timestamping\n"); - return (ENXIO); - } - - /* Enable RX */ - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - rx_ctl |= 0x10; /* Enable the feature */ - rx_ctl |= 0x0a; /* This value turns on Ver 1 and 2 */ - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCRXCTL, rx_ctl); - - /* - * Ethertype Stamping (Ethertype = 0x88F7) - */ - E1000_WRITE_REG(&adapter->hw, E1000_RXMTRL, htonl(0x440088f7)); - - /* - * Source Port Queue Filter Setup: - * this is for UDP port filtering - */ - E1000_WRITE_REG(&adapter->hw, E1000_RXUDP, htons(TSYNC_PORT)); - /* Protocol = UDP, enable Timestamp, and filter on source/protocol */ - - E1000_WRITE_FLUSH(&adapter->hw); - - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - if ((rx_ctl & 0x10) == 0) { - device_printf(dev, "Failed to enable RX timestamping\n"); - return (ENXIO); - } - - device_printf(dev, "IEEE 1588 Precision Time Protocol enabled\n"); - - return (0); -} - -/* - * Disable the Time Sync Feature - */ static void -em_tsync_disable(struct adapter *adapter) +em_set_flow_cntrl(struct adapter *adapter, const char *name, + const char *description, int *limit, int value) { - u32 tx_ctl, rx_ctl; - - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - tx_ctl &= ~0x10; - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCTXCTL, tx_ctl); - E1000_WRITE_FLUSH(&adapter->hw); - - /* Invalidate TX Timestamp */ - E1000_READ_REG(&adapter->hw, E1000_TXSTMPH); - - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - if (tx_ctl & 0x10) - HW_DEBUGOUT("Failed to disable TX timestamping\n"); - - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - rx_ctl &= ~0x10; - - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCRXCTL, rx_ctl); - E1000_WRITE_FLUSH(&adapter->hw); - - /* Invalidate RX Timestamp */ - E1000_READ_REG(&adapter->hw, E1000_RXSATRH); - - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - if (rx_ctl & 0x10) - HW_DEBUGOUT("Failed to disable RX timestamping\n"); - - return; + *limit = value; + SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), + OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); +} + +static int +em_sysctl_debug_info(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter; + int error; + int result; + + result = -1; + error = sysctl_handle_int(oidp, &result, 0, req); + + if (error || !req->newptr) + return (error); + + if (result == 1) { + adapter = (struct adapter *)arg1; + em_print_debug_info(adapter); + } + + return (error); +} + +/* +** This routine is meant to be fluid, add whatever is +** needed for debugging a problem. -jfv +*/ +static void +em_print_debug_info(struct adapter *adapter) +{ + device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + + if (adapter->ifp->if_drv_flags & IFF_DRV_RUNNING) + printf("Interface is RUNNING "); + else + printf("Interface is NOT RUNNING\n"); + if (adapter->ifp->if_drv_flags & IFF_DRV_OACTIVE) + printf("and ACTIVE\n"); + else + printf("and INACTIVE\n"); + + device_printf(dev, "hw tdh = %d, hw tdt = %d\n", + E1000_READ_REG(&adapter->hw, E1000_TDH(0)), + E1000_READ_REG(&adapter->hw, E1000_TDT(0))); + device_printf(dev, "hw rdh = %d, hw rdt = %d\n", + E1000_READ_REG(&adapter->hw, E1000_RDH(0)), + E1000_READ_REG(&adapter->hw, E1000_RDT(0))); + device_printf(dev, "Tx Queue Status = %d\n", txr->queue_status); + device_printf(dev, "TX descriptors avail = %d\n", + txr->tx_avail); + device_printf(dev, "Tx Descriptors avail failure = %ld\n", + txr->no_desc_avail); + device_printf(dev, "RX discarded packets = %ld\n", + rxr->rx_discarded); + device_printf(dev, "RX Next to Check = %d\n", rxr->next_to_check); + device_printf(dev, "RX Next to Refresh = %d\n", rxr->next_to_refresh); } -#endif /* EM_TIMESYNC */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.h index ba5a286c3d..200d1091c6 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,12 +30,13 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_em.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/if_em.h,v 1.5.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _EM_H_DEFINED_ #define _EM_H_DEFINED_ + /* Tunables */ /* @@ -51,9 +52,8 @@ * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ #define EM_MIN_TXD 80 -#define EM_MAX_TXD_82543 256 #define EM_MAX_TXD 4096 -#define EM_DEFAULT_TXD EM_MAX_TXD_82543 +#define EM_DEFAULT_TXD 1024 /* * EM_RXD - Maximum number of receive Descriptors @@ -69,9 +69,8 @@ * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ #define EM_MIN_RXD 80 -#define EM_MAX_RXD_82543 256 #define EM_MAX_RXD 4096 -#define EM_DEFAULT_RXD EM_MAX_RXD_82543 +#define EM_DEFAULT_RXD 1024 /* * EM_TIDV - Transmit Interrupt Delay Value @@ -134,16 +133,15 @@ #define EM_RADV 64 /* - * This parameter controls the duration of transmit watchdog timer. + * This parameter controls the max duration of transmit watchdog. */ -#define EM_TX_TIMEOUT 5 +#define EM_WATCHDOG (10 * hz) /* * This parameter controls when the driver calls the routine to reclaim * transmit descriptors. */ #define EM_TX_CLEANUP_THRESHOLD (adapter->num_tx_desc / 8) -#define EM_TX_OP_THRESHOLD (adapter->num_tx_desc / 32) /* * This parameter controls whether or not autonegotation is enabled. @@ -181,18 +179,18 @@ #define EM_DEFAULT_PBA 0x00000030 #define EM_SMARTSPEED_DOWNSHIFT 3 #define EM_SMARTSPEED_MAX 15 -#define EM_MAX_INTR 10 +#define EM_MAX_LOOP 10 #define MAX_NUM_MULTICAST_ADDRESSES 128 #define PCI_ANY_ID (~0U) #define ETHER_ALIGN 2 #define EM_FC_PAUSE_TIME 0x0680 #define EM_EEPROM_APME 0x400; +#define EM_82544_APME 0x0004; -/* Code compatilbility between 6 and 7 */ -#ifndef ETHER_BPF_MTAP -#define ETHER_BPF_MTAP BPF_MTAP -#endif +#define EM_QUEUE_IDLE 0 +#define EM_QUEUE_WORKING 1 +#define EM_QUEUE_HUNG 2 /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be @@ -207,7 +205,6 @@ #define EM_BAR_TYPE(v) ((v) & EM_BAR_TYPE_MASK) #define EM_BAR_TYPE_MASK 0x00000001 #define EM_BAR_TYPE_MMEM 0x00000000 -#define EM_BAR_TYPE_IO 0x00000001 #define EM_BAR_TYPE_FLASH 0x0014 #define EM_BAR_MEM_TYPE(v) ((v) & EM_BAR_MEM_TYPE_MASK) #define EM_BAR_MEM_TYPE_MASK 0x00000006 @@ -230,10 +227,12 @@ #define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) -#define EM_MAX_SCATTER 64 +#define EM_MAX_SCATTER 32 +#define EM_VFTA_SIZE 128 #define EM_TSO_SIZE (65535 + sizeof(struct ether_vlan_header)) #define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */ #define EM_MSIX_MASK 0x01F00000 /* For 82574 use */ +#define EM_MSIX_LINK 0x01000000 /* For 82574 use */ #define ETH_ZLEN 60 #define ETH_ADDR_LEN 6 #define CSUM_OFFLOAD 7 /* Offload bits in mbuf flag */ @@ -246,45 +245,6 @@ */ #define EM_EIAC 0x000DC -/* Used in for 82547 10Mb Half workaround */ -#define EM_PBA_BYTES_SHIFT 0xA -#define EM_TX_HEAD_ADDR_SHIFT 7 -#define EM_PBA_TX_MASK 0xFFFF0000 -#define EM_FIFO_HDR 0x10 -#define EM_82547_PKT_THRESH 0x3e0 - -#ifdef EM_TIMESYNC -/* Precision Time Sync (IEEE 1588) defines */ -#define ETHERTYPE_IEEE1588 0x88F7 -#define PICOSECS_PER_TICK 20833 -#define TSYNC_PORT 319 /* UDP port for the protocol */ - -/* TIMESYNC IOCTL defines */ -#define EM_TIMESYNC_READTS _IOWR('i', 127, struct em_tsync_read) - -/* Used in the READTS IOCTL */ -struct em_tsync_read { - int read_current_time; - struct timespec system_time; - u64 network_time; - u64 rx_stamp; - u64 tx_stamp; - u16 seqid; - unsigned char srcid[6]; - int rx_valid; - int tx_valid; -}; - -#endif /* EM_TIMESYNC */ - -struct adapter; - -struct em_int_delay_info { - struct adapter *adapter; /* Back-pointer to the adapter struct */ - int offset; /* Register offset to read/write */ - int value; /* Current value in usecs */ -}; - /* * Bus dma allocation structure used by * e1000_dma_malloc and e1000_dma_free. @@ -298,6 +258,86 @@ struct em_dma_alloc { int dma_nseg; }; +struct adapter; + +struct em_int_delay_info { + struct adapter *adapter; /* Back-pointer to the adapter struct */ + int offset; /* Register offset to read/write */ + int value; /* Current value in usecs */ +}; + +/* + * The transmit ring, one per tx queue + */ +struct tx_ring { + struct adapter *adapter; + struct mtx tx_mtx; + char mtx_name[16]; + u32 me; + u32 msix; + u32 ims; + int queue_status; + int watchdog_time; + struct em_dma_alloc txdma; + struct e1000_tx_desc *tx_base; + struct task tx_task; + struct taskqueue *tq; + u32 next_avail_desc; + u32 next_to_clean; + struct em_buffer *tx_buffers; + volatile u16 tx_avail; + u32 tx_tso; /* last tx was tso */ + u16 last_hw_offload; + u8 last_hw_ipcso; + u8 last_hw_ipcss; + u8 last_hw_tucso; + u8 last_hw_tucss; +#if __FreeBSD_version >= 800000 + struct buf_ring *br; +#endif + /* Interrupt resources */ + bus_dma_tag_t txtag; + void *tag; + struct resource *res; + unsigned long tx_irq; + unsigned long no_desc_avail; +}; + +/* + * The Receive ring, one per rx queue + */ +struct rx_ring { + struct adapter *adapter; + u32 me; + u32 msix; + u32 ims; + struct mtx rx_mtx; + char mtx_name[16]; + u32 payload; + struct task rx_task; + struct taskqueue *tq; + struct e1000_rx_desc *rx_base; + struct em_dma_alloc rxdma; + u32 next_to_refresh; + u32 next_to_check; + struct em_buffer *rx_buffers; + struct mbuf *fmp; + struct mbuf *lmp; + + /* Interrupt resources */ + void *tag; + struct resource *res; + bus_dma_tag_t rxtag; + bool discard; + + /* Soft stats */ + unsigned long rx_irq; + unsigned long rx_discarded; + unsigned long rx_packets; + unsigned long rx_bytes; +}; + + /* Our adapter structure */ struct adapter { struct ifnet *ifp; @@ -306,145 +346,105 @@ struct adapter { /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; struct device *dev; + struct cdev *led_dev; struct resource *memory; struct resource *flash; - struct resource *msix; + struct resource *msix_mem; - struct resource *ioport; - int io_rid; - - /* 82574 uses 3 int vectors */ - struct resource *res[3]; - void *tag[3]; - int rid[3]; + struct resource *res; + void *tag; + u32 linkvec; + u32 ivars; struct ifmedia media; struct callout timer; - struct callout tx_fifo_timer; - int watchdog_timer; - int msi; + int msix; int if_flags; int max_frame_size; int min_frame_size; + int pause_frames; struct mtx core_mtx; - struct mtx tx_mtx; - struct mtx rx_mtx; int em_insert_vlan_header; + u32 ims; + bool in_detach; /* Task for FAST handling */ struct task link_task; - struct task rxtx_task; - struct task rx_task; - struct task tx_task; + struct task que_task; struct taskqueue *tq; /* private task queue */ -#ifdef EM_HW_VLAN_SUPPORT eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; -#endif + + u16 num_vlans; + u16 num_queues; + + /* + * Transmit rings: + * Allocated at run time, an array of rings. + */ + struct tx_ring *tx_rings; + int num_tx_desc; + u32 txd_cmd; + + /* + * Receive rings: + * Allocated at run time, an array of rings. + */ + struct rx_ring *rx_rings; + int num_rx_desc; + u32 rx_process_limit; + u32 rx_mbuf_sz; /* Management and WOL features */ - int wol; - int has_manage; + u32 wol; + bool has_manage; + bool has_amt; + + /* Multicast array memory */ + u8 *mta; + + /* + ** Shadow VFTA table, this is needed because + ** the real vlan filter table gets cleared during + ** a soft reset and the driver needs to be able + ** to repopulate it. + */ + u32 shadow_vfta[EM_VFTA_SIZE]; + + /* Info about the interface */ + u8 link_active; + u16 link_speed; + u16 link_duplex; + u32 smartspeed; + u32 fc_setting; - /* Info about the board itself */ - uint8_t link_active; - uint16_t link_speed; - uint16_t link_duplex; - uint32_t smartspeed; struct em_int_delay_info tx_int_delay; struct em_int_delay_info tx_abs_int_delay; struct em_int_delay_info rx_int_delay; struct em_int_delay_info rx_abs_int_delay; - /* - * Transmit definitions - * - * We have an array of num_tx_desc descriptors (handled - * by the controller) paired with an array of tx_buffers - * (at tx_buffer_area). - * The index of the next available descriptor is next_avail_tx_desc. - * The number of remaining tx_desc is num_tx_desc_avail. - */ - struct em_dma_alloc txdma; /* bus_dma glue for tx desc */ - struct e1000_tx_desc *tx_desc_base; - uint32_t next_avail_tx_desc; - uint32_t next_tx_to_clean; - volatile uint16_t num_tx_desc_avail; - uint16_t num_tx_desc; - uint32_t txd_cmd; - struct em_buffer *tx_buffer_area; - bus_dma_tag_t txtag; /* dma tag for tx */ - uint32_t tx_tso; /* last tx was tso */ - - /* - * Receive definitions - * - * we have an array of num_rx_desc rx_desc (handled by the - * controller), and paired with an array of rx_buffers - * (at rx_buffer_area). - * The next pair to check on receive is at offset next_rx_desc_to_check - */ - struct em_dma_alloc rxdma; /* bus_dma glue for rx desc */ - struct e1000_rx_desc *rx_desc_base; - uint32_t next_rx_desc_to_check; - uint32_t rx_buffer_len; - uint16_t num_rx_desc; - int rx_process_limit; - struct em_buffer *rx_buffer_area; - bus_dma_tag_t rxtag; - bus_dmamap_t rx_sparemap; - - /* - * First/last mbuf pointers, for - * collecting multisegment RX packets. - */ - struct mbuf *fmp; - struct mbuf *lmp; - /* Misc stats maintained by the driver */ unsigned long dropped_pkts; unsigned long mbuf_alloc_failed; unsigned long mbuf_cluster_failed; - unsigned long no_tx_desc_avail1; - unsigned long no_tx_desc_avail2; unsigned long no_tx_map_avail; unsigned long no_tx_dma_setup; - unsigned long watchdog_events; unsigned long rx_overruns; - unsigned long rx_irq; - unsigned long tx_irq; + unsigned long watchdog_events; unsigned long link_irq; - /* 82547 workaround */ - uint32_t tx_fifo_size; - uint32_t tx_fifo_head; - uint32_t tx_fifo_head_addr; - uint64_t tx_fifo_reset_cnt; - uint64_t tx_fifo_wrk_cnt; - uint32_t tx_head_addr; - - /* For 82544 PCIX Workaround */ - boolean_t pcix_82544; - boolean_t in_detach; - -#ifdef EM_TIMESYNC - u64 last_stamp; - u64 last_sec; - u32 last_ns; -#endif - struct e1000_hw_stats stats; }; -/* ****************************************************************************** +/******************************************************************************** * vendor_info_array * * This array contains the list of Subvendor/Subdevice IDs on which the driver * should load. * - * ******************************************************************************/ + ********************************************************************************/ typedef struct _em_vendor_info_t { unsigned int vendor_id; unsigned int device_id; @@ -453,26 +453,12 @@ typedef struct _em_vendor_info_t { unsigned int index; } em_vendor_info_t; - struct em_buffer { int next_eop; /* Index of the desc to watch */ struct mbuf *m_head; bus_dmamap_t map; /* bus_dma map for packet */ }; -/* For 82544 PCIX Workaround */ -typedef struct _ADDRESS_LENGTH_PAIR -{ - uint64_t address; - uint32_t length; -} ADDRESS_LENGTH_PAIR, *PADDRESS_LENGTH_PAIR; - -typedef struct _DESCRIPTOR_PAIR -{ - ADDRESS_LENGTH_PAIR descriptor[4]; - uint32_t elements; -} DESC_ARRAY, *PDESC_ARRAY; - #define EM_CORE_LOCK_INIT(_sc, _name) \ mtx_init(&(_sc)->core_mtx, _name, "EM Core Lock", MTX_DEF) #define EM_TX_LOCK_INIT(_sc, _name) \ @@ -484,11 +470,13 @@ typedef struct _DESCRIPTOR_PAIR #define EM_RX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_mtx) #define EM_CORE_LOCK(_sc) mtx_lock(&(_sc)->core_mtx) #define EM_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_mtx) +#define EM_TX_TRYLOCK(_sc) mtx_trylock(&(_sc)->tx_mtx) #define EM_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_mtx) #define EM_CORE_UNLOCK(_sc) mtx_unlock(&(_sc)->core_mtx) #define EM_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_mtx) #define EM_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_mtx) #define EM_CORE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->core_mtx, MA_OWNED) #define EM_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_mtx, MA_OWNED) +#define EM_RX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rx_mtx, MA_OWNED) #endif /* _EM_H_DEFINED_ */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.c index 62b6201cda..2c72d4cd39 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,15 +30,20 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_igb.c,v 1.3.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/if_igb.c,v 1.21.2.18.2.1 2010/12/21 17:09:25 kensmith Exp $*/ + #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" #include "opt_inet.h" +#include "opt_altq.h" #endif #include #include +#if __FreeBSD_version >= 800000 +#include +#endif #include #include #include @@ -53,10 +58,8 @@ #include #include #include -#ifdef IGB_TIMESYNC -#include -#include -#endif +#include +#include #include #include @@ -80,6 +83,7 @@ #include #include +#include #include #include @@ -95,7 +99,7 @@ int igb_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char igb_driver_version[] = "version - 1.4.1"; +char igb_driver_version[] = "version - 2.0.7"; /********************************************************************* @@ -116,8 +120,27 @@ static igb_vendor_info_t igb_vendor_info_array[] = { 0x8086, E1000_DEV_ID_82575GB_QUAD_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82576, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82576_NS, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82576_NS_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82576_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82576_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82576_SERDES_QUAD, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82576_QUAD_COPPER, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82576_QUAD_COPPER_ET2, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82576_VF, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82580_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82580_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82580_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82580_SGMII, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82580_COPPER_DUAL, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82580_QUAD_FIBER, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_DH89XXCC_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_DH89XXCC_SGMII, PCI_ANY_ID, PCI_ANY_ID, 0}, /* required last entry */ { 0, 0, 0, 0, 0} }; @@ -141,8 +164,13 @@ static int igb_suspend(device_t); static int igb_resume(device_t); static void igb_start(struct ifnet *); static void igb_start_locked(struct tx_ring *, struct ifnet *ifp); +#if __FreeBSD_version >= 800000 +static int igb_mq_start(struct ifnet *, struct mbuf *); +static int igb_mq_start_locked(struct ifnet *, + struct tx_ring *, struct mbuf *); +static void igb_qflush(struct ifnet *); +#endif static int igb_ioctl(struct ifnet *, u_long, caddr_t); -static void igb_watchdog(struct adapter *); static void igb_init(void *); static void igb_init_locked(struct adapter *); static void igb_stop(void *); @@ -155,8 +183,8 @@ static int igb_allocate_legacy(struct adapter *); static int igb_setup_msix(struct adapter *); static void igb_free_pci_resources(struct adapter *); static void igb_local_timer(void *); -static int igb_hardware_init(struct adapter *); -static void igb_setup_interface(device_t, struct adapter *); +static void igb_reset(struct adapter *); +static int igb_setup_interface(device_t, struct adapter *); static int igb_allocate_queues(struct adapter *); static void igb_configure_queues(struct adapter *); @@ -173,67 +201,64 @@ static int igb_setup_receive_ring(struct rx_ring *); static void igb_initialize_receive_units(struct adapter *); static void igb_free_receive_structures(struct adapter *); static void igb_free_receive_buffers(struct rx_ring *); +static void igb_free_receive_ring(struct rx_ring *); static void igb_enable_intr(struct adapter *); static void igb_disable_intr(struct adapter *); static void igb_update_stats_counters(struct adapter *); static bool igb_txeof(struct tx_ring *); -static bool igb_rxeof(struct rx_ring *, int); -#ifndef __NO_STRICT_ALIGNMENT -static int igb_fixup_rx(struct rx_ring *); -#endif -static void igb_rx_checksum(u32, struct mbuf *); + +static __inline void igb_rx_discard(struct rx_ring *, int); +static __inline void igb_rx_input(struct rx_ring *, + struct ifnet *, struct mbuf *, u32); + +static bool igb_rxeof(struct igb_queue *, int, int *); +static void igb_rx_checksum(u32, struct mbuf *, u32); static int igb_tx_ctx_setup(struct tx_ring *, struct mbuf *); static bool igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *); static void igb_set_promisc(struct adapter *); static void igb_disable_promisc(struct adapter *); static void igb_set_multi(struct adapter *); -static void igb_print_hw_stats(struct adapter *); static void igb_update_link_status(struct adapter *); -static int igb_get_buf(struct rx_ring *, int); +static void igb_refresh_mbufs(struct rx_ring *, int); -#ifdef IGB_HW_VLAN_SUPPORT static void igb_register_vlan(void *, struct ifnet *, u16); static void igb_unregister_vlan(void *, struct ifnet *, u16); -#endif +static void igb_setup_vlan_hw_support(struct adapter *); static int igb_xmit(struct tx_ring *, struct mbuf **); static int igb_dma_malloc(struct adapter *, bus_size_t, struct igb_dma_alloc *, int); static void igb_dma_free(struct adapter *, struct igb_dma_alloc *); -static void igb_print_debug_info(struct adapter *); +static int igb_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void igb_print_nvm_info(struct adapter *); static int igb_is_valid_ether_addr(u8 *); -static int igb_sysctl_stats(SYSCTL_HANDLER_ARGS); -static int igb_sysctl_debug_info(SYSCTL_HANDLER_ARGS); +static void igb_add_hw_stats(struct adapter *); + +static void igb_vf_init_stats(struct adapter *); +static void igb_update_vf_stats_counters(struct adapter *); + /* Management and WOL Support */ static void igb_init_manageability(struct adapter *); static void igb_release_manageability(struct adapter *); static void igb_get_hw_control(struct adapter *); static void igb_release_hw_control(struct adapter *); static void igb_enable_wakeup(device_t); - -#ifdef IGB_TIMESYNC -/* Precision Time sync support */ -static int igb_tsync_init(struct adapter *); -static void igb_tsync_disable(struct adapter *); -#endif +static void igb_led_func(void *, int); static int igb_irq_fast(void *); static void igb_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); -static void igb_handle_rxtx(void *context, int pending); -static void igb_handle_tx(void *context, int pending); -static void igb_handle_rx(void *context, int pending); +static void igb_handle_que(void *context, int pending); static void igb_handle_link(void *context, int pending); /* These are MSIX only irq handlers */ -static void igb_msix_rx(void *); -static void igb_msix_tx(void *); +static void igb_msix_que(void *); static void igb_msix_link(void *); -/* Adaptive Interrupt Moderation */ -static void igb_update_aim(struct rx_ring *); +#ifdef DEVICE_POLLING +static poll_handler_t igb_poll; +#endif /* POLLING */ /********************************************************************* * FreeBSD Device Interface Entry Points @@ -270,49 +295,53 @@ TUNABLE_INT("hw.igb.rxd", &igb_rxd); TUNABLE_INT("hw.igb.txd", &igb_txd); /* -** These parameters are used in Adaptive -** Interrupt Moderation. The value is set -** into EITR and controls the interrupt -** frequency. They can be modified but -** be careful in tuning them. +** AIM: Adaptive Interrupt Moderation +** which means that the interrupt rate +** is varied over time based on the +** traffic for that interrupt vector */ static int igb_enable_aim = TRUE; TUNABLE_INT("hw.igb.enable_aim", &igb_enable_aim); -static int igb_low_latency = IGB_LOW_LATENCY; -TUNABLE_INT("hw.igb.low_latency", &igb_low_latency); -static int igb_ave_latency = IGB_AVE_LATENCY; -TUNABLE_INT("hw.igb.ave_latency", &igb_low_latency); -static int igb_bulk_latency = IGB_BULK_LATENCY; -TUNABLE_INT("hw.igb.bulk_latency", &igb_bulk_latency); - + /* -** IF YOU CHANGE THESE: be sure and change IGB_MSIX_VEC in -** if_igb.h to match. These can be autoconfigured if set to -** 0, it will then be based on number of cpus. + * MSIX should be the default for best performance, + * but this allows it to be forced off for testing. + */ +static int igb_enable_msix = 1; +TUNABLE_INT("hw.igb.enable_msix", &igb_enable_msix); + +/* +** Tuneable Interrupt rate */ -static int igb_tx_queues = 1; -static int igb_rx_queues = 4; -TUNABLE_INT("hw.igb.tx_queues", &igb_tx_queues); -TUNABLE_INT("hw.igb.rx_queues", &igb_rx_queues); +static int igb_max_interrupt_rate = 8000; +TUNABLE_INT("hw.igb.max_interrupt_rate", &igb_max_interrupt_rate); + +/* +** Header split causes the packet header to +** be dma'd to a seperate mbuf from the payload. +** this can have memory alignment benefits. But +** another plus is that small packets often fit +** into the header and thus use no cluster. Its +** a very workload dependent type feature. +*/ +static bool igb_header_split = FALSE; +TUNABLE_INT("hw.igb.hdr_split", &igb_header_split); + +/* +** This will autoconfigure based on +** the number of CPUs if left at 0. +*/ +static int igb_num_queues = 0; +TUNABLE_INT("hw.igb.num_queues", &igb_num_queues); /* How many packets rxeof tries to clean at a time */ static int igb_rx_process_limit = 100; TUNABLE_INT("hw.igb.rx_process_limit", &igb_rx_process_limit); -/* Flow control setting - default to none */ -static int igb_fc_setting = 0; +/* Flow control setting - default to FULL */ +static int igb_fc_setting = e1000_fc_full; TUNABLE_INT("hw.igb.fc_setting", &igb_fc_setting); -/* - * Should the driver do LRO on the RX end - * this can be toggled on the fly, but the - * interface must be reset (down/up) for it - * to take effect. - */ -static int igb_enable_lro = 1; -TUNABLE_INT("hw.igb.enable_lro", &igb_enable_lro); - -extern int mp_ncpus; /********************************************************************* * Device identification routine * @@ -390,44 +419,19 @@ igb_attach(device_t dev) /* SYSCTL stuff */ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, - igb_sysctl_debug_info, "I", "Debug Information"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, - igb_sysctl_stats, "I", "Statistics"); + OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + igb_sysctl_nvm_info, "I", "NVM Information"); SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), OID_AUTO, "flow_control", CTLTYPE_INT|CTLFLAG_RW, &igb_fc_setting, 0, "Flow Control"); - SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), - OID_AUTO, "enable_lro", CTLTYPE_INT|CTLFLAG_RW, - &igb_enable_lro, 0, "Large Receive Offload"); - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW, &igb_enable_aim, 1, "Interrupt Moderation"); - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "low_latency", CTLTYPE_INT|CTLFLAG_RW, - &igb_low_latency, 1, "Low Latency"); - - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "ave_latency", CTLTYPE_INT|CTLFLAG_RW, - &igb_ave_latency, 1, "Average Latency"); - - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "bulk_latency", CTLTYPE_INT|CTLFLAG_RW, - &igb_bulk_latency, 1, "Bulk Latency"); - callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); /* Determine hardware and mac info */ @@ -477,7 +481,6 @@ igb_attach(device_t dev) adapter->hw.mac.autoneg = DO_AUTO_NEG; adapter->hw.phy.autoneg_wait_to_complete = FALSE; adapter->hw.phy.autoneg_advertised = AUTONEG_ADV_DEFAULT; - adapter->rx_buffer_len = 2048; /* Copper options */ if (adapter->hw.phy.media_type == e1000_media_type_copper) { @@ -501,6 +504,38 @@ igb_attach(device_t dev) goto err_pci; } + /* Allocate the appropriate stats memory */ + if (adapter->hw.mac.type == e1000_vfadapt) { + adapter->stats = + (struct e1000_vf_stats *)malloc(sizeof \ + (struct e1000_vf_stats), M_DEVBUF, M_NOWAIT | M_ZERO); + igb_vf_init_stats(adapter); + } else + adapter->stats = + (struct e1000_hw_stats *)malloc(sizeof \ + (struct e1000_hw_stats), M_DEVBUF, M_NOWAIT | M_ZERO); + if (adapter->stats == NULL) { + device_printf(dev, "Can not allocate stats memory\n"); + error = ENOMEM; + goto err_late; + } + + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_late; + } + + /* + ** Start from a known state, this is + ** important in reading the nvm and + ** mac from that. + */ + e1000_reset_hw(&adapter->hw); + /* Make sure we have a good EEPROM before we read from it */ if (e1000_validate_nvm_checksum(&adapter->hw) < 0) { /* @@ -516,21 +551,16 @@ igb_attach(device_t dev) } } - /* Initialize the hardware */ - if (igb_hardware_init(adapter)) { - device_printf(dev, "Unable to initialize the hardware\n"); - error = EIO; - goto err_late; - } - - /* Copy the permanent MAC address out of the EEPROM */ + /* + ** Copy the permanent MAC address out of the EEPROM + */ if (e1000_read_mac_addr(&adapter->hw) < 0) { device_printf(dev, "EEPROM read error while reading MAC" " address\n"); error = EIO; goto err_late; } - + /* Check its sanity */ if (!igb_is_valid_ether_addr(adapter->hw.mac.addr)) { device_printf(dev, "Invalid MAC address\n"); error = EIO; @@ -540,7 +570,7 @@ igb_attach(device_t dev) /* ** Configure Interrupts */ - if (adapter->msix > 1) /* MSIX */ + if ((adapter->msix > 1) && (igb_enable_msix)) error = igb_allocate_msix(adapter); else /* MSI or Legacy */ error = igb_allocate_legacy(adapter); @@ -548,7 +578,11 @@ igb_attach(device_t dev) goto err_late; /* Setup OS specific network interface */ - igb_setup_interface(dev, adapter); + if (igb_setup_interface(dev, adapter) != 0) + goto err_late; + + /* Now get a good starting state */ + igb_reset(adapter); /* Initialize statistics */ igb_update_stats_counters(adapter); @@ -572,17 +606,20 @@ igb_attach(device_t dev) if (eeprom_data) adapter->wol = E1000_WUFC_MAG; -#ifdef IGB_HW_VLAN_SUPPORT /* Register for VLAN events */ adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, - igb_register_vlan, 0, EVENTHANDLER_PRI_FIRST); + igb_register_vlan, adapter, EVENTHANDLER_PRI_FIRST); adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, - igb_unregister_vlan, 0, EVENTHANDLER_PRI_FIRST); -#endif + igb_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); + + igb_add_hw_stats(adapter); /* Tell the stack that the interface is not active */ adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + adapter->led_dev = led_create(igb_led_func, adapter, + device_get_nameunit(dev)); + INIT_DEBUGOUT("igb_attach: end"); return (0); @@ -591,8 +628,11 @@ err_late: igb_free_transmit_structures(adapter); igb_free_receive_structures(adapter); igb_release_hw_control(adapter); + if (adapter->ifp != NULL) + if_free(adapter->ifp); err_pci: igb_free_pci_resources(adapter); + free(adapter->mta, M_DEVBUF); IGB_CORE_LOCK_DESTROY(adapter); return (error); @@ -622,6 +662,14 @@ igb_detach(device_t dev) return (EBUSY); } + if (adapter->led_dev != NULL) + led_destroy(adapter->led_dev); + +#ifdef DEVICE_POLLING + if (ifp->if_capenable & IFCAP_POLLING) + ether_poll_deregister(ifp); +#endif + IGB_CORE_LOCK(adapter); adapter->in_detach = 1; igb_stop(adapter); @@ -639,13 +687,11 @@ igb_detach(device_t dev) igb_enable_wakeup(dev); } -#ifdef IGB_HW_VLAN_SUPPORT /* Unregister VLAN events */ if (adapter->vlan_attach != NULL) EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); if (adapter->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); -#endif ether_ifdetach(adapter->ifp); @@ -657,6 +703,7 @@ igb_detach(device_t dev) igb_free_transmit_structures(adapter); igb_free_receive_structures(adapter); + free(adapter->mta, M_DEVBUF); IGB_CORE_LOCK_DESTROY(adapter); @@ -745,8 +792,15 @@ igb_start_locked(struct tx_ring *txr, struct ifnet *ifp) if (!adapter->link_active) return; - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + /* Call cleanup if number of TX descriptors low */ + if (txr->tx_avail <= IGB_TX_CLEANUP_THRESHOLD) + igb_txeof(txr); + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + if (txr->tx_avail <= IGB_TX_OP_THRESHOLD) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -765,36 +819,138 @@ igb_start_locked(struct tx_ring *txr, struct ifnet *ifp) /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, m_head); - /* Set timeout in case hardware has problems transmitting. */ - txr->watchdog_timer = IGB_TX_TIMEOUT; + /* Set watchdog on */ + txr->watchdog_time = ticks; + txr->queue_status = IGB_QUEUE_WORKING; } } +/* + * Legacy TX driver routine, called from the + * stack, always uses tx[0], and spins for it. + * Should not be used with multiqueue tx + */ static void igb_start(struct ifnet *ifp) { struct adapter *adapter = ifp->if_softc; - struct tx_ring *txr; - u32 queue = 0; + struct tx_ring *txr = adapter->tx_rings; - /* - ** This is really just here for testing - ** TX multiqueue, ultimately what is - ** needed is the flow support in the stack - ** and appropriate logic here to deal with - ** it. -jfv - */ - if (adapter->num_tx_queues > 1) - queue = (curcpu % adapter->num_tx_queues); - - txr = &adapter->tx_rings[queue]; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { IGB_TX_LOCK(txr); igb_start_locked(txr, ifp); IGB_TX_UNLOCK(txr); } + return; } +#if __FreeBSD_version >= 800000 +/* +** Multiqueue Transmit driver +** +*/ +static int +igb_mq_start(struct ifnet *ifp, struct mbuf *m) +{ + struct adapter *adapter = ifp->if_softc; + struct igb_queue *que; + struct tx_ring *txr; + int i = 0, err = 0; + + /* Which queue to use */ + if ((m->m_flags & M_FLOWID) != 0) + i = m->m_pkthdr.flowid % adapter->num_queues; + + txr = &adapter->tx_rings[i]; + que = &adapter->queues[i]; + + if (IGB_TX_TRYLOCK(txr)) { + err = igb_mq_start_locked(ifp, txr, m); + IGB_TX_UNLOCK(txr); + } else { + err = drbr_enqueue(ifp, txr->br, m); + taskqueue_enqueue(que->tq, &que->que_task); + } + + return (err); +} + +static int +igb_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) +{ + struct adapter *adapter = txr->adapter; + struct mbuf *next; + int err = 0, enq; + + IGB_TX_LOCK_ASSERT(txr); + + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || adapter->link_active == 0) { + if (m != NULL) + err = drbr_enqueue(ifp, txr->br, m); + return (err); + } + + /* Call cleanup if number of TX descriptors low */ + if (txr->tx_avail <= IGB_TX_CLEANUP_THRESHOLD) + igb_txeof(txr); + + enq = 0; + if (m == NULL) { + next = drbr_dequeue(ifp, txr->br); + } else if (drbr_needs_enqueue(ifp, txr->br)) { + if ((err = drbr_enqueue(ifp, txr->br, m)) != 0) + return (err); + next = drbr_dequeue(ifp, txr->br); + } else + next = m; + + /* Process the queue */ + while (next != NULL) { + if ((err = igb_xmit(txr, &next)) != 0) { + if (next != NULL) + err = drbr_enqueue(ifp, txr->br, next); + break; + } + enq++; + drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ETHER_BPF_MTAP(ifp, next); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; + if (txr->tx_avail <= IGB_TX_OP_THRESHOLD) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + next = drbr_dequeue(ifp, txr->br); + } + if (enq > 0) { + /* Set the watchdog */ + txr->queue_status = IGB_QUEUE_WORKING; + txr->watchdog_time = ticks; + } + return (err); +} + +/* +** Flush all ring buffers +*/ +static void +igb_qflush(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = adapter->tx_rings; + struct mbuf *m; + + for (int i = 0; i < adapter->num_queues; i++, txr++) { + IGB_TX_LOCK(txr); + while ((m = buf_ring_dequeue_sc(txr->br)) != NULL) + m_freem(m); + IGB_TX_UNLOCK(txr); + } + if_qflush(ifp); +} +#endif /* __FreeBSD_version >= 800000 */ + /********************************************************************* * Ioctl entry point * @@ -809,7 +965,9 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; +#ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; +#endif int error = 0; if (adapter->in_detach) @@ -817,6 +975,7 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) switch (command) { case SIOCSIFADDR: +#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) { /* * XXX @@ -831,8 +990,10 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) igb_init_locked(adapter); IGB_CORE_UNLOCK(adapter); } - arp_ifinit(ifp, ifa); + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); } else +#endif error = ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: @@ -883,11 +1044,19 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) IGB_CORE_LOCK(adapter); igb_disable_intr(adapter); igb_set_multi(adapter); +#ifdef DEVICE_POLLING + if (!(ifp->if_capenable & IFCAP_POLLING)) +#endif igb_enable_intr(adapter); IGB_CORE_UNLOCK(adapter); } break; case SIOCSIFMEDIA: + /* + ** As the speed/duplex settings are being + ** changed, we need toreset the PHY. + */ + adapter->hw.phy.reset_disable = FALSE; /* Check SOL/IDER usage */ IGB_CORE_LOCK(adapter); if (e1000_check_reset_block(&adapter->hw)) { @@ -909,6 +1078,26 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFCAP (Set Capabilities)"); reinit = 0; mask = ifr->ifr_reqcap ^ ifp->if_capenable; +#ifdef DEVICE_POLLING + if (mask & IFCAP_POLLING) { + if (ifr->ifr_reqcap & IFCAP_POLLING) { + error = ether_poll_register(igb_poll, ifp); + if (error) + return (error); + IGB_CORE_LOCK(adapter); + igb_disable_intr(adapter); + ifp->if_capenable |= IFCAP_POLLING; + IGB_CORE_UNLOCK(adapter); + } else { + error = ether_poll_deregister(ifp); + /* Enable interrupt even in error case */ + IGB_CORE_LOCK(adapter); + igb_enable_intr(adapter); + ifp->if_capenable &= ~IFCAP_POLLING; + IGB_CORE_UNLOCK(adapter); + } + } +#endif if (mask & IFCAP_HWCSUM) { ifp->if_capenable ^= IFCAP_HWCSUM; reinit = 1; @@ -921,77 +1110,20 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; reinit = 1; } -#ifdef IGB_HW_VLAN_SUPPORT if (mask & IFCAP_VLAN_HWFILTER) { ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; reinit = 1; } -#endif + if (mask & IFCAP_LRO) { + ifp->if_capenable ^= IFCAP_LRO; + reinit = 1; + } if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) igb_init(adapter); VLAN_CAPABILITIES(ifp); break; } -#ifdef IGB_TIMESYNC - /* - ** IOCTL support for Precision Time (IEEE 1588) Support - */ - case IGB_TIMESYNC_READTS: - { - u32 rx_ctl, tx_ctl; - struct igb_tsync_read *tdata; - - tdata = (struct igb_tsync_read *) ifr->ifr_data; - - if (tdata->read_current_time) { - getnanotime(&tdata->system_time); - tdata->network_time = E1000_READ_REG(&adapter->hw, - E1000_SYSTIML); - tdata->network_time |= - (u64)E1000_READ_REG(&adapter->hw, - E1000_SYSTIMH ) << 32; - } - - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - - if (rx_ctl & 0x1) { - u32 tmp; - unsigned char *tmp_cp; - - tdata->rx_valid = 1; - tdata->rx_stamp = E1000_READ_REG(&adapter->hw, E1000_RXSTMPL); - tdata->rx_stamp |= (u64)E1000_READ_REG(&adapter->hw, - E1000_RXSTMPH) << 32; - - tmp = E1000_READ_REG(&adapter->hw, E1000_RXSATRL); - tmp_cp = (unsigned char *) &tmp; - tdata->srcid[0] = tmp_cp[0]; - tdata->srcid[1] = tmp_cp[1]; - tdata->srcid[2] = tmp_cp[2]; - tdata->srcid[3] = tmp_cp[3]; - tmp = E1000_READ_REG(&adapter->hw, E1000_RXSATRH); - tmp_cp = (unsigned char *) &tmp; - tdata->srcid[4] = tmp_cp[0]; - tdata->srcid[5] = tmp_cp[1]; - tdata->seqid = tmp >> 16; - tdata->seqid = htons(tdata->seqid); - } else - tdata->rx_valid = 0; - - if (tx_ctl & 0x1) { - tdata->tx_valid = 1; - tdata->tx_stamp = E1000_READ_REG(&adapter->hw, E1000_TXSTMPL); - tdata->tx_stamp |= (u64) E1000_READ_REG(&adapter->hw, - E1000_TXSTMPH) << 32; - } else - tdata->tx_valid = 0; - - return (0); - } -#endif /* IGB_TIMESYNC */ - default: error = ether_ioctl(ifp, command, data); break; @@ -1000,80 +1132,6 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) return (error); } -/********************************************************************* - * Watchdog timer: - * - * This routine is called from the local timer every second. - * As long as transmit descriptors are being cleaned the value - * is non-zero and we do nothing. Reaching 0 indicates a tx hang - * and we then reset the device. - * - **********************************************************************/ - -static void -igb_watchdog(struct adapter *adapter) -{ - struct tx_ring *txr = adapter->tx_rings; - bool tx_hang = FALSE; - - IGB_CORE_LOCK_ASSERT(adapter); - - /* - ** The timer is set to 5 every time start() queues a packet. - ** Then txeof keeps resetting it as long as it cleans at - ** least one descriptor. - ** Finally, anytime all descriptors are clean the timer is - ** set to 0. - ** - ** With TX Multiqueue we need to check every queue's timer, - ** if any time out we do the reset. - */ - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { - IGB_TX_LOCK(txr); - if (txr->watchdog_timer == 0 || - (--txr->watchdog_timer)) { - IGB_TX_UNLOCK(txr); - continue; - } else { - tx_hang = TRUE; - IGB_TX_UNLOCK(txr); - break; - } - } - if (tx_hang == FALSE) - return; - - /* If we are in this routine because of pause frames, then - * don't reset the hardware. - */ - if (E1000_READ_REG(&adapter->hw, E1000_STATUS) & - E1000_STATUS_TXOFF) { - txr = adapter->tx_rings; /* reset pointer */ - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { - IGB_TX_LOCK(txr); - txr->watchdog_timer = IGB_TX_TIMEOUT; - IGB_TX_UNLOCK(txr); - } - return; - } - - if (e1000_check_for_link(&adapter->hw) == 0) - device_printf(adapter->dev, "watchdog timeout -- resetting\n"); - - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { - device_printf(adapter->dev, "Queue(%d) tdh = %d, tdt = %d\n", - i, E1000_READ_REG(&adapter->hw, E1000_TDH(i)), - E1000_READ_REG(&adapter->hw, E1000_TDT(i))); - device_printf(adapter->dev, "Queue(%d) desc avail = %d," - " Next Desc to Clean = %d\n", i, txr->tx_avail, - txr->next_to_clean); - } - - adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - adapter->watchdog_events++; - - igb_init_locked(adapter); -} /********************************************************************* * Init entry point @@ -1089,29 +1147,16 @@ igb_watchdog(struct adapter *adapter) static void igb_init_locked(struct adapter *adapter) { - struct rx_ring *rxr = adapter->rx_rings; - struct tx_ring *txr = adapter->tx_rings; struct ifnet *ifp = adapter->ifp; device_t dev = adapter->dev; - u32 pba = 0; INIT_DEBUGOUT("igb_init: begin"); IGB_CORE_LOCK_ASSERT(adapter); - igb_stop(adapter); + igb_disable_intr(adapter); + callout_stop(&adapter->timer); - /* - * Packet Buffer Allocation (PBA) - * Writing PBA sets the receive portion of the buffer - * the remainder is used for the transmit buffer. - */ - if (adapter->hw.mac.type == e1000_82575) { - INIT_DEBUGOUT1("igb_init: pba=%dK",pba); - pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ - E1000_WRITE_REG(&adapter->hw, E1000_PBA, pba); - } - /* Get the latest mac address, User can use a LAA */ bcopy(IF_LLADDR(adapter->ifp), adapter->hw.mac.addr, ETHER_ADDR_LEN); @@ -1119,29 +1164,21 @@ igb_init_locked(struct adapter *adapter) /* Put the address into the Receive Address Array */ e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); - /* Initialize the hardware */ - if (igb_hardware_init(adapter)) { - device_printf(dev, "Unable to initialize the hardware\n"); - return; - } + igb_reset(adapter); igb_update_link_status(adapter); E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); -#ifndef IGB_HW_VLAN_SUPPORT - /* Vlan's enabled but HW Filtering off */ - if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } -#endif - /* Set hardware offload abilities */ ifp->if_hwassist = 0; - if (ifp->if_capenable & IFCAP_TXCSUM) + if (ifp->if_capenable & IFCAP_TXCSUM) { ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); +#if __FreeBSD_version >= 800000 + if (adapter->hw.mac.type == e1000_82576) + ifp->if_hwassist |= CSUM_SCTP; +#endif + } + if (ifp->if_capenable & IFCAP_TSO4) ifp->if_hwassist |= CSUM_TSO; @@ -1155,14 +1192,37 @@ igb_init_locked(struct adapter *adapter) /* Setup Multicast table */ igb_set_multi(adapter); + /* + ** Figure out the desired mbuf pool + ** for doing jumbo/packetsplit + */ + if (adapter->max_frame_size <= 2048) + adapter->rx_mbuf_sz = MCLBYTES; + else if (adapter->max_frame_size <= 4096) + adapter->rx_mbuf_sz = MJUMPAGESIZE; + else + adapter->rx_mbuf_sz = MJUM9BYTES; + /* Prepare receive descriptors and buffers */ if (igb_setup_receive_structures(adapter)) { device_printf(dev, "Could not setup receive structures\n"); - igb_stop(adapter); return; } igb_initialize_receive_units(adapter); + /* Use real VLAN Filter support? */ + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + /* Use real VLAN Filter support */ + igb_setup_vlan_hw_support(adapter); + else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + } + } + /* Don't lose promiscuous settings */ igb_set_promisc(adapter); @@ -1175,30 +1235,21 @@ igb_init_locked(struct adapter *adapter) if (adapter->msix > 1) /* Set up queue routing */ igb_configure_queues(adapter); - /* Set default RX interrupt moderation */ - for (int i = 0; i < adapter->num_rx_queues; i++, rxr++) { - E1000_WRITE_REG(&adapter->hw, - E1000_EITR(rxr->msix), igb_ave_latency); - rxr->eitr_setting = igb_ave_latency; - } - - /* Set TX interrupt rate & reset TX watchdog */ - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { - E1000_WRITE_REG(&adapter->hw, - E1000_EITR(txr->msix), igb_ave_latency); - txr->watchdog_timer = FALSE; - } - /* this clears any pending interrupts */ E1000_READ_REG(&adapter->hw, E1000_ICR); +#ifdef DEVICE_POLLING + /* + * Only enable interrupts if we are not polling, make sure + * they are off otherwise. + */ + if (ifp->if_capenable & IFCAP_POLLING) + igb_disable_intr(adapter); + else +#endif /* DEVICE_POLLING */ + { igb_enable_intr(adapter); E1000_WRITE_REG(&adapter->hw, E1000_ICS, E1000_ICS_LSC); - -#ifdef IGB_TIMESYNC - /* Initialize IEEE 1588 Time sync if available */ - if (adapter->hw.mac.type == e1000_82576) - igb_tsync_init(adapter); -#endif + } /* Don't reset the phy next time init gets called */ adapter->hw.phy.reset_disable = TRUE; @@ -1215,79 +1266,57 @@ igb_init(void *arg) } +static void +igb_handle_que(void *context, int pending) +{ + struct igb_queue *que = context; + struct adapter *adapter = que->adapter; + struct tx_ring *txr = que->txr; + struct ifnet *ifp = adapter->ifp; + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + bool more; + + more = igb_rxeof(que, -1, NULL); + + IGB_TX_LOCK(txr); + if (igb_txeof(txr)) + more = TRUE; +#if __FreeBSD_version >= 800000 + if (!drbr_empty(ifp, txr->br)) + igb_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + igb_start_locked(txr, ifp); +#endif + IGB_TX_UNLOCK(txr); + if (more) { + taskqueue_enqueue(que->tq, &que->que_task); + return; + } + } + +#ifdef DEVICE_POLLING + if (ifp->if_capenable & IFCAP_POLLING) + return; +#endif + /* Reenable this interrupt */ + if (que->eims) + E1000_WRITE_REG(&adapter->hw, E1000_EIMS, que->eims); + else + igb_enable_intr(adapter); +} + +/* Deal with link in a sleepable context */ static void igb_handle_link(void *context, int pending) { - struct adapter *adapter = context; - struct ifnet *ifp; + struct adapter *adapter = context; - ifp = adapter->ifp; - - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - return; - - IGB_CORE_LOCK(adapter); - callout_stop(&adapter->timer); + adapter->hw.mac.get_link_status = 1; igb_update_link_status(adapter); - callout_reset(&adapter->timer, hz, igb_local_timer, adapter); - IGB_CORE_UNLOCK(adapter); } -static void -igb_handle_rxtx(void *context, int pending) -{ - struct adapter *adapter = context; - struct tx_ring *txr = adapter->tx_rings; - struct rx_ring *rxr = adapter->rx_rings; - struct ifnet *ifp; - - ifp = adapter->ifp; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (igb_rxeof(rxr, adapter->rx_process_limit) != 0) - taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); - IGB_TX_LOCK(txr); - igb_txeof(txr); - - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - igb_start_locked(txr, ifp); - IGB_TX_UNLOCK(txr); - } - - igb_enable_intr(adapter); -} - -static void -igb_handle_rx(void *context, int pending) -{ - struct rx_ring *rxr = context; - struct adapter *adapter = rxr->adapter; - struct ifnet *ifp = adapter->ifp; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - if (igb_rxeof(rxr, adapter->rx_process_limit) != 0) - /* More to clean, schedule another task */ - taskqueue_enqueue(adapter->tq, &rxr->rx_task); - -} - -static void -igb_handle_tx(void *context, int pending) -{ - struct tx_ring *txr = context; - struct adapter *adapter = txr->adapter; - struct ifnet *ifp = adapter->ifp; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - IGB_TX_LOCK(txr); - igb_txeof(txr); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - igb_start_locked(txr, ifp); - IGB_TX_UNLOCK(txr); - } -} - - /********************************************************************* * * MSI/Legacy Deferred @@ -1297,8 +1326,9 @@ igb_handle_tx(void *context, int pending) static int igb_irq_fast(void *arg) { - struct adapter *adapter = arg; - uint32_t reg_icr; + struct adapter *adapter = arg; + struct igb_queue *que = adapter->queues; + u32 reg_icr; reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); @@ -1320,124 +1350,160 @@ igb_irq_fast(void *arg) * MSI message reordering errata on certain systems. */ igb_disable_intr(adapter); - taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); + taskqueue_enqueue(que->tq, &que->que_task); /* Link status change */ - if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { - adapter->hw.mac.get_link_status = 1; - taskqueue_enqueue(adapter->tq, &adapter->link_task); - } + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) + taskqueue_enqueue(que->tq, &adapter->link_task); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; return FILTER_HANDLED; } +#ifdef DEVICE_POLLING +/********************************************************************* + * + * Legacy polling routine : if using this code you MUST be sure that + * multiqueue is not defined, ie, set igb_num_queues to 1. + * + *********************************************************************/ +#if __FreeBSD_version >= 800000 +#define POLL_RETURN_COUNT(a) (a) +static int +#else +#define POLL_RETURN_COUNT(a) +static void +#endif +igb_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) +{ + struct adapter *adapter = ifp->if_softc; + struct igb_queue *que = adapter->queues; + struct tx_ring *txr = adapter->tx_rings; + u32 reg_icr, rx_done = 0; + u32 loop = IGB_MAX_LOOP; + bool more; + + IGB_CORE_LOCK(adapter); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + IGB_CORE_UNLOCK(adapter); + return POLL_RETURN_COUNT(rx_done); + } + + if (cmd == POLL_AND_CHECK_STATUS) { + reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + /* Link status change */ + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) + igb_handle_link(adapter, 0); + + if (reg_icr & E1000_ICR_RXO) + adapter->rx_overruns++; + } + IGB_CORE_UNLOCK(adapter); + + igb_rxeof(que, count, &rx_done); + + IGB_TX_LOCK(txr); + do { + more = igb_txeof(txr); + } while (loop-- && more); +#if __FreeBSD_version >= 800000 + if (!drbr_empty(ifp, txr->br)) + igb_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + igb_start_locked(txr, ifp); +#endif + IGB_TX_UNLOCK(txr); + return POLL_RETURN_COUNT(rx_done); +} +#endif /* DEVICE_POLLING */ /********************************************************************* * * MSIX TX Interrupt Service routine * **********************************************************************/ - static void -igb_msix_tx(void *arg) +igb_msix_que(void *arg) { - struct tx_ring *txr = arg; - struct adapter *adapter = txr->adapter; - struct ifnet *ifp = adapter->ifp; + struct igb_queue *que = arg; + struct adapter *adapter = que->adapter; + struct tx_ring *txr = que->txr; + struct rx_ring *rxr = que->rxr; + u32 newitr = 0; + bool more_tx, more_rx; - ++txr->tx_irq; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - IGB_TX_LOCK(txr); - igb_txeof(txr); - IGB_TX_UNLOCK(txr); - taskqueue_enqueue(adapter->tq, &txr->tx_task); - } - /* Reenable this interrupt */ - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, txr->eims); + E1000_WRITE_REG(&adapter->hw, E1000_EIMC, que->eims); + ++que->irqs; + + IGB_TX_LOCK(txr); + more_tx = igb_txeof(txr); + IGB_TX_UNLOCK(txr); + + more_rx = igb_rxeof(que, adapter->rx_process_limit, NULL); + + if (igb_enable_aim == FALSE) + goto no_calc; + /* + ** Do Adaptive Interrupt Moderation: + ** - Write out last calculated setting + ** - Calculate based on average size over + ** the last interval. + */ + if (que->eitr_setting) + E1000_WRITE_REG(&adapter->hw, + E1000_EITR(que->msix), que->eitr_setting); + + que->eitr_setting = 0; + + /* Idle, do nothing */ + if ((txr->bytes == 0) && (rxr->bytes == 0)) + goto no_calc; + + /* Used half Default if sub-gig */ + if (adapter->link_speed != 1000) + newitr = IGB_DEFAULT_ITR / 2; + else { + if ((txr->bytes) && (txr->packets)) + newitr = txr->bytes/txr->packets; + if ((rxr->bytes) && (rxr->packets)) + newitr = max(newitr, + (rxr->bytes / rxr->packets)); + newitr += 24; /* account for hardware frame, crc */ + /* set an upper boundary */ + newitr = min(newitr, 3000); + /* Be nice to the mid range */ + if ((newitr > 300) && (newitr < 1200)) + newitr = (newitr / 3); + else + newitr = (newitr / 2); + } + newitr &= 0x7FFC; /* Mask invalid bits */ + if (adapter->hw.mac.type == e1000_82575) + newitr |= newitr << 16; + else + newitr |= E1000_EITR_CNT_IGNR; + + /* save for next interrupt */ + que->eitr_setting = newitr; + + /* Reset state */ + txr->bytes = 0; + txr->packets = 0; + rxr->bytes = 0; + rxr->packets = 0; + +no_calc: + /* Schedule a clean task if needed*/ + if (more_tx || more_rx) + taskqueue_enqueue(que->tq, &que->que_task); + else + /* Reenable this interrupt */ + E1000_WRITE_REG(&adapter->hw, E1000_EIMS, que->eims); return; } -/********************************************************************* - * - * MSIX RX Interrupt Service routine - * - **********************************************************************/ - -static void -igb_msix_rx(void *arg) -{ - struct rx_ring *rxr = arg; - struct adapter *adapter = rxr->adapter; - u32 more, loop = 5; - - ++rxr->rx_irq; - do { - more = igb_rxeof(rxr, adapter->rx_process_limit); - } while (loop-- || more != 0); - - taskqueue_enqueue(adapter->tq, &rxr->rx_task); - - /* Update interrupt rate */ - if (igb_enable_aim == TRUE) - igb_update_aim(rxr); - - /* Reenable this interrupt */ - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, rxr->eims); - return; -} - - -/* -** Routine to adjust the RX EITR value based on traffic, -** its a simple three state model, but seems to help. -** -** Note that the three EITR values are tuneable using -** sysctl in real time. The feature can be effectively -** nullified by setting them equal. -*/ -#define BULK_THRESHOLD 10000 -#define AVE_THRESHOLD 1600 - -static void -igb_update_aim(struct rx_ring *rxr) -{ - struct adapter *adapter = rxr->adapter; - u32 olditr, newitr; - - /* Update interrupt moderation based on traffic */ - olditr = rxr->eitr_setting; - newitr = olditr; - - /* Idle, don't change setting */ - if (rxr->bytes == 0) - return; - - if (olditr == igb_low_latency) { - if (rxr->bytes > AVE_THRESHOLD) - newitr = igb_ave_latency; - } else if (olditr == igb_ave_latency) { - if (rxr->bytes < AVE_THRESHOLD) - newitr = igb_low_latency; - else if (rxr->bytes > BULK_THRESHOLD) - newitr = igb_bulk_latency; - } else if (olditr == igb_bulk_latency) { - if (rxr->bytes < BULK_THRESHOLD) - newitr = igb_ave_latency; - } - - if (olditr != newitr) { - /* Change interrupt rate */ - rxr->eitr_setting = newitr; - E1000_WRITE_REG(&adapter->hw, E1000_EITR(rxr->me), - newitr | (newitr << 16)); - } - - rxr->bytes = 0; - return; -} - /********************************************************************* * @@ -1455,8 +1521,7 @@ igb_msix_link(void *arg) icr = E1000_READ_REG(&adapter->hw, E1000_ICR); if (!(icr & E1000_ICR_LSC)) goto spurious; - adapter->hw.mac.get_link_status = 1; - taskqueue_enqueue(adapter->tq, &adapter->link_task); + igb_handle_link(adapter, 0); spurious: /* Rearm */ @@ -1569,11 +1634,6 @@ igb_media_change(struct ifnet *ifp) device_printf(adapter->dev, "Unsupported media type\n"); } - /* As the speed/duplex settings my have changed we need to - * reset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; - igb_init_locked(adapter); IGB_CORE_UNLOCK(adapter); @@ -1594,12 +1654,12 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) struct adapter *adapter = txr->adapter; bus_dma_segment_t segs[IGB_MAX_SCATTER]; bus_dmamap_t map; - struct igb_buffer *tx_buffer, *tx_buffer_mapped; + struct igb_tx_buffer *tx_buffer, *tx_buffer_mapped; union e1000_adv_tx_desc *txd = NULL; struct mbuf *m_head; u32 olinfo_status = 0, cmd_type_len = 0; int nsegs, i, j, error, first, last = 0; - u32 hdrlen = 0, offload = 0; + u32 hdrlen = 0; m_head = *m_headp; @@ -1644,7 +1704,7 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) m = m_defrag(*m_headp, M_DONTWAIT); if (m == NULL) { - adapter->mbuf_alloc_failed++; + adapter->mbuf_defrag_failed++; m_freem(*m_headp); *m_headp = NULL; return (ENOBUFS); @@ -1695,19 +1755,17 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) olinfo_status |= E1000_TXD_POPTS_TXSM << 8; } else return (ENXIO); - } else - /* Do all other context descriptor setup */ - offload = igb_tx_ctx_setup(txr, m_head); - if (offload == TRUE) + } else if (igb_tx_ctx_setup(txr, m_head)) olinfo_status |= E1000_TXD_POPTS_TXSM << 8; -#ifdef IGB_TIMESYNC - if (offload == IGB_TIMESTAMP) - cmd_type_len |= E1000_ADVTXD_MAC_TSTAMP; -#endif + /* Calculate payload length */ olinfo_status |= ((m_head->m_pkthdr.len - hdrlen) << E1000_ADVTXD_PAYLEN_SHIFT); + /* 82575 needs the queue index added */ + if (adapter->hw.mac.type == e1000_82575) + olinfo_status |= txr->me << 4; + /* Set up our transmit descriptors */ i = txr->next_avail_desc; for (j = 0; j < nsegs; j++) { @@ -1720,8 +1778,7 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) seg_len = segs[j].ds_len; txd->read.buffer_addr = htole64(seg_addr); - txd->read.cmd_type_len = htole32( - adapter->txd_cmd | cmd_type_len | seg_len); + txd->read.cmd_type_len = htole32(cmd_type_len | seg_len); txd->read.olinfo_status = htole32(olinfo_status); last = i; if (++i == adapter->num_tx_desc) @@ -1744,13 +1801,14 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) * and Report Status (RS) */ txd->read.cmd_type_len |= - htole32(E1000_TXD_CMD_EOP | E1000_TXD_CMD_RS); + htole32(E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS); /* * Keep track in the first buffer which * descriptor will be written back */ tx_buffer = &txr->tx_buffers[first]; tx_buffer->next_eop = last; + txr->watchdog_time = ticks; /* * Advance the Transmit Descriptor Tail (TDT), this tells the E1000 @@ -1769,30 +1827,39 @@ static void igb_set_promisc(struct adapter *adapter) { struct ifnet *ifp = adapter->ifp; - uint32_t reg_rctl; + struct e1000_hw *hw = &adapter->hw; + u32 reg; - reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + if (hw->mac.type == e1000_vfadapt) { + e1000_promisc_set_vf(hw, e1000_promisc_enabled); + return; + } + reg = E1000_READ_REG(hw, E1000_RCTL); if (ifp->if_flags & IFF_PROMISC) { - reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + reg |= (E1000_RCTL_UPE | E1000_RCTL_MPE); + E1000_WRITE_REG(hw, E1000_RCTL, reg); } else if (ifp->if_flags & IFF_ALLMULTI) { - reg_rctl |= E1000_RCTL_MPE; - reg_rctl &= ~E1000_RCTL_UPE; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + reg |= E1000_RCTL_MPE; + reg &= ~E1000_RCTL_UPE; + E1000_WRITE_REG(hw, E1000_RCTL, reg); } } static void igb_disable_promisc(struct adapter *adapter) { - uint32_t reg_rctl; + struct e1000_hw *hw = &adapter->hw; + u32 reg; - reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); - - reg_rctl &= (~E1000_RCTL_UPE); - reg_rctl &= (~E1000_RCTL_MPE); - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + if (hw->mac.type == e1000_vfadapt) { + e1000_promisc_set_vf(hw, e1000_promisc_disabled); + return; + } + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= (~E1000_RCTL_UPE); + reg &= (~E1000_RCTL_MPE); + E1000_WRITE_REG(hw, E1000_RCTL, reg); } @@ -1809,13 +1876,21 @@ igb_set_multi(struct adapter *adapter) struct ifnet *ifp = adapter->ifp; struct ifmultiaddr *ifma; u32 reg_rctl = 0; - u8 mta[MAX_NUM_MULTICAST_ADDRESSES * ETH_ADDR_LEN]; + u8 *mta; int mcnt = 0; IOCTL_DEBUGOUT("igb_set_multi: begin"); + mta = adapter->mta; + bzero(mta, sizeof(uint8_t) * ETH_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES); + +#if __FreeBSD_version < 800000 IF_ADDR_LOCK(ifp); +#else + if_maddr_rlock(ifp); +#endif TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1827,47 +1902,71 @@ igb_set_multi(struct adapter *adapter) &mta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN); mcnt++; } +#if __FreeBSD_version < 800000 IF_ADDR_UNLOCK(ifp); +#else + if_maddr_runlock(ifp); +#endif if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); reg_rctl |= E1000_RCTL_MPE; E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); } else - e1000_update_mc_addr_list(&adapter->hw, mta, - mcnt, 1, adapter->hw.mac.rar_entry_count); + e1000_update_mc_addr_list(&adapter->hw, mta, mcnt); } /********************************************************************* - * Timer routine - * - * This routine checks for link status and updates statistics. + * Timer routine: + * This routine checks for link status, + * updates statistics, and does the watchdog. * **********************************************************************/ static void igb_local_timer(void *arg) { - struct adapter *adapter = arg; - struct ifnet *ifp = adapter->ifp; + struct adapter *adapter = arg; + device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; + IGB_CORE_LOCK_ASSERT(adapter); igb_update_link_status(adapter); igb_update_stats_counters(adapter); - if (igb_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING) - igb_print_hw_stats(adapter); - - /* - * Each second we check the watchdog to - * protect against hardware hangs. - */ - igb_watchdog(adapter); + /* + ** If flow control has paused us since last checking + ** it invalidates the watchdog timing, so dont run it. + */ + if (adapter->pause_frames) { + adapter->pause_frames = 0; + goto out; + } + /* + ** Watchdog: check for time since any descriptor was cleaned + */ + for (int i = 0; i < adapter->num_queues; i++, txr++) + if (txr->queue_status == IGB_QUEUE_HUNG) + goto timeout; +out: callout_reset(&adapter->timer, hz, igb_local_timer, adapter); + return; +timeout: + device_printf(adapter->dev, "Watchdog timeout -- resetting\n"); + device_printf(dev,"Queue(%d) tdh = %d, hw tdt = %d\n", txr->me, + E1000_READ_REG(&adapter->hw, E1000_TDH(txr->me)), + E1000_READ_REG(&adapter->hw, E1000_TDT(txr->me))); + device_printf(dev,"TX(%d) desc avail = %d," + "Next TX to Clean = %d\n", + txr->me, txr->tx_avail, txr->next_to_clean); + adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + adapter->watchdog_events++; + igb_init_locked(adapter); } static void @@ -1898,8 +1997,12 @@ igb_update_link_status(struct adapter *adapter) e1000_check_for_link(hw); link_check = adapter->hw.mac.serdes_has_link; break; - default: + /* VF device is type_unknown */ case e1000_media_type_unknown: + e1000_check_for_link(hw); + link_check = !hw->mac.get_link_status; + /* Fall thru */ + default: break; } @@ -1914,6 +2017,7 @@ igb_update_link_status(struct adapter *adapter) "Full Duplex" : "Half Duplex")); adapter->link_active = 1; ifp->if_baudrate = adapter->link_speed * 1000000; + /* This can sleep */ if_link_state_change(ifp, LINK_STATE_UP); } else if (!link_check && (adapter->link_active == 1)) { ifp->if_baudrate = adapter->link_speed = 0; @@ -1921,10 +2025,11 @@ igb_update_link_status(struct adapter *adapter) if (bootverbose) device_printf(dev, "Link is Down\n"); adapter->link_active = 0; + /* This can sleep */ if_link_state_change(ifp, LINK_STATE_DOWN); /* Turn off watchdogs */ - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) - txr->watchdog_timer = FALSE; + for (int i = 0; i < adapter->num_queues; i++, txr++) + txr->queue_status = IGB_QUEUE_IDLE; } } @@ -1940,6 +2045,7 @@ igb_stop(void *arg) { struct adapter *adapter = arg; struct ifnet *ifp = adapter->ifp; + struct tx_ring *txr = adapter->tx_rings; IGB_CORE_LOCK_ASSERT(adapter); @@ -1952,14 +2058,18 @@ igb_stop(void *arg) /* Tell the stack that the interface is no longer active */ ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); -#ifdef IGB_TIMESYNC - /* Disable IEEE 1588 Time sync */ - if (adapter->hw.mac.type == e1000_82576) - igb_tsync_disable(adapter); -#endif + /* Unarm watchdog timer. */ + for (int i = 0; i < adapter->num_queues; i++, txr++) { + IGB_TX_LOCK(txr); + txr->queue_status = IGB_QUEUE_IDLE; + IGB_TX_UNLOCK(txr); + } e1000_reset_hw(&adapter->hw); E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); + + e1000_led_off(&adapter->hw); + e1000_cleanup_led(&adapter->hw); } @@ -1977,8 +2087,8 @@ igb_identify_hardware(struct adapter *adapter) adapter->hw.bus.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2); if (!((adapter->hw.bus.pci_cmd_word & PCIM_CMD_BUSMASTEREN) && (adapter->hw.bus.pci_cmd_word & PCIM_CMD_MEMEN))) { - device_printf(dev, "Memory Access and/or Bus Master bits " - "were not set!\n"); + INIT_DEBUGOUT("Memory Access and/or Bus Master " + "bits were not set!\n"); adapter->hw.bus.pci_cmd_word |= (PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN); pci_write_config(dev, PCIR_COMMAND, @@ -1994,18 +2104,15 @@ igb_identify_hardware(struct adapter *adapter) adapter->hw.subsystem_device_id = pci_read_config(dev, PCIR_SUBDEV_0, 2); - /* Do Shared Code Init and Setup */ - if (e1000_set_mac_type(&adapter->hw)) { - device_printf(dev, "Setup init failure\n"); - return; - } + /* Set MAC type early for PCI setup */ + e1000_set_mac_type(&adapter->hw); } static int igb_allocate_pci_resources(struct adapter *adapter) { device_t dev = adapter->dev; - int rid, error = 0; + int rid; rid = PCIR_BAR(0); adapter->pci_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -2018,26 +2125,15 @@ igb_allocate_pci_resources(struct adapter *adapter) rman_get_bustag(adapter->pci_mem); adapter->osdep.mem_bus_space_handle = rman_get_bushandle(adapter->pci_mem); - adapter->hw.hw_addr = (uint8_t *)&adapter->osdep.mem_bus_space_handle; + adapter->hw.hw_addr = (u8 *)&adapter->osdep.mem_bus_space_handle; - /* - ** Init the resource arrays - */ - for (int i = 0; i < IGB_MSIX_VEC; i++) { - adapter->rid[i] = i + 1; /* MSI/X RID starts at 1 */ - adapter->tag[i] = NULL; - adapter->res[i] = NULL; - } - - adapter->num_tx_queues = 1; /* Defaults for Legacy or MSI */ - adapter->num_rx_queues = 1; + adapter->num_queues = 1; /* Defaults for Legacy or MSI */ /* This will setup either MSI/X or MSI */ adapter->msix = igb_setup_msix(adapter); - adapter->hw.back = &adapter->osdep; - return (error); + return (0); } /********************************************************************* @@ -2048,20 +2144,21 @@ igb_allocate_pci_resources(struct adapter *adapter) static int igb_allocate_legacy(struct adapter *adapter) { - device_t dev = adapter->dev; - int error; + device_t dev = adapter->dev; + struct igb_queue *que = adapter->queues; + int error, rid = 0; /* Turn off all interrupts */ E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); - /* Legacy RID at 0 */ - if (adapter->msix == 0) - adapter->rid[0] = 0; + /* MSI RID is 1 */ + if (adapter->msix == 1) + rid = 1; /* We allocate a single interrupt resource */ - adapter->res[0] = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &adapter->rid[0], RF_SHAREABLE | RF_ACTIVE); - if (adapter->res[0] == NULL) { + adapter->res = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); + if (adapter->res == NULL) { device_printf(dev, "Unable to allocate bus resource: " "interrupt\n"); return (ENXIO); @@ -2071,19 +2168,20 @@ igb_allocate_legacy(struct adapter *adapter) * Try allocating a fast interrupt and the associated deferred * processing contexts. */ - TASK_INIT(&adapter->rxtx_task, 0, igb_handle_rxtx, adapter); + TASK_INIT(&que->que_task, 0, igb_handle_que, que); + /* Make tasklet for deferred link handling */ TASK_INIT(&adapter->link_task, 0, igb_handle_link, adapter); - adapter->tq = taskqueue_create_fast("igb_taskq", M_NOWAIT, - taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", + que->tq = taskqueue_create_fast("igb_taskq", M_NOWAIT, + taskqueue_thread_enqueue, &que->tq); + taskqueue_start_threads(&que->tq, 1, PI_NET, "%s taskq", device_get_nameunit(adapter->dev)); - if ((error = bus_setup_intr(dev, adapter->res[0], - INTR_TYPE_NET | INTR_MPSAFE, igb_irq_fast, NULL, adapter, - &adapter->tag[0])) != 0) { + if ((error = bus_setup_intr(dev, adapter->res, + INTR_TYPE_NET | INTR_MPSAFE, igb_irq_fast, NULL, + adapter, &adapter->tag)) != 0) { device_printf(dev, "Failed to register fast interrupt " "handler: %d\n", error); - taskqueue_free(adapter->tq); - adapter->tq = NULL; + taskqueue_free(que->tq); + que->tq = NULL; return (error); } @@ -2093,162 +2191,127 @@ igb_allocate_legacy(struct adapter *adapter) /********************************************************************* * - * Setup the MSIX Interrupt handlers: + * Setup the MSIX Queue Interrupt handlers: * **********************************************************************/ static int igb_allocate_msix(struct adapter *adapter) { - device_t dev = adapter->dev; - struct tx_ring *txr = adapter->tx_rings; - struct rx_ring *rxr = adapter->rx_rings; - int error, vector = 0; + device_t dev = adapter->dev; + struct igb_queue *que = adapter->queues; + int error, rid, vector = 0; - /* - * Setup the interrupt handlers - */ - /* TX Setup */ - for (int i = 0; i < adapter->num_tx_queues; i++, vector++, txr++) { - adapter->res[vector] = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &adapter->rid[vector], - RF_SHAREABLE | RF_ACTIVE); - if (adapter->res[vector] == NULL) { + for (int i = 0; i < adapter->num_queues; i++, vector++, que++) { + rid = vector +1; + que->res = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); + if (que->res == NULL) { device_printf(dev, "Unable to allocate bus resource: " - "MSIX TX Interrupt\n"); + "MSIX Queue Interrupt\n"); return (ENXIO); } - error = bus_setup_intr(dev, adapter->res[vector], - INTR_TYPE_NET | INTR_MPSAFE, NULL, igb_msix_tx, - txr, &adapter->tag[vector]); + error = bus_setup_intr(dev, que->res, + INTR_TYPE_NET | INTR_MPSAFE, NULL, + igb_msix_que, que, &que->tag); if (error) { - adapter->res[vector] = NULL; - device_printf(dev, "Failed to register TX handler"); + que->res = NULL; + device_printf(dev, "Failed to register Queue handler"); return (error); } - /* Make tasklet for deferred handling - one per queue */ - TASK_INIT(&txr->tx_task, 0, igb_handle_tx, txr); - if (adapter->hw.mac.type == e1000_82575) { - txr->eims = E1000_EICR_TX_QUEUE0 << i; - /* MSIXBM registers start at 0 */ - txr->msix = adapter->rid[vector] - 1; - } else { - txr->eims = 1 << vector; - txr->msix = vector; - } - } - - /* RX Setup */ - for (int i = 0; i < adapter->num_rx_queues; i++, vector++, rxr++) { - adapter->res[vector] = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &adapter->rid[vector], - RF_SHAREABLE | RF_ACTIVE); - if (adapter->res[vector] == NULL) { - device_printf(dev, - "Unable to allocate bus resource: " - "MSIX RX Interrupt\n"); - return (ENXIO); - } - error = bus_setup_intr(dev, adapter->res[vector], - INTR_TYPE_NET | INTR_MPSAFE, NULL, igb_msix_rx, - rxr, &adapter->tag[vector]); - if (error) { - adapter->res[vector] = NULL; - device_printf(dev, "Failed to register RX handler"); - return (error); - } - TASK_INIT(&rxr->rx_task, 0, igb_handle_rx, rxr); - if (adapter->hw.mac.type == e1000_82575) { - rxr->eims = E1000_EICR_RX_QUEUE0 << i; - rxr->msix = adapter->rid[vector] - 1; - } else { - rxr->eims = 1 << vector; - rxr->msix = vector; - } +#if __FreeBSD_version >= 800504 + bus_describe_intr(dev, que->res, que->tag, "que %d", i); +#endif + que->msix = vector; + if (adapter->hw.mac.type == e1000_82575) + que->eims = E1000_EICR_TX_QUEUE0 << i; + else + que->eims = 1 << vector; + /* + ** Bind the msix vector, and thus the + ** rings to the corresponding cpu. + */ + if (adapter->num_queues > 1) + bus_bind_intr(dev, que->res, i); + /* Make tasklet for deferred handling */ + TASK_INIT(&que->que_task, 0, igb_handle_que, que); + que->tq = taskqueue_create_fast("igb_que", M_NOWAIT, + taskqueue_thread_enqueue, &que->tq); + taskqueue_start_threads(&que->tq, 1, PI_NET, "%s que", + device_get_nameunit(adapter->dev)); } /* And Link */ - adapter->res[vector] = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &adapter->rid[vector], - RF_SHAREABLE | RF_ACTIVE); - if (adapter->res[vector] == NULL) { + rid = vector + 1; + adapter->res = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); + if (adapter->res == NULL) { device_printf(dev, "Unable to allocate bus resource: " "MSIX Link Interrupt\n"); return (ENXIO); } - if ((error = bus_setup_intr(dev, adapter->res[vector], - INTR_TYPE_NET | INTR_MPSAFE, NULL, igb_msix_link, - adapter, &adapter->tag[vector])) != 0) { + if ((error = bus_setup_intr(dev, adapter->res, + INTR_TYPE_NET | INTR_MPSAFE, NULL, + igb_msix_link, adapter, &adapter->tag)) != 0) { device_printf(dev, "Failed to register Link handler"); return (error); } - if (adapter->hw.mac.type == e1000_82575) - adapter->linkvec = adapter->rid[vector] - 1; - else - adapter->linkvec = vector; - - /* Make tasklet for deferred link interrupt handling */ - TASK_INIT(&adapter->link_task, 0, igb_handle_link, adapter); - - adapter->tq = taskqueue_create_fast("igb_taskq", M_NOWAIT, - taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", - device_get_nameunit(adapter->dev)); +#if __FreeBSD_version >= 800504 + bus_describe_intr(dev, adapter->res, adapter->tag, "link"); +#endif + adapter->linkvec = vector; return (0); } + static void igb_configure_queues(struct adapter *adapter) { - struct e1000_hw *hw = &adapter->hw; - struct tx_ring *txr; - struct rx_ring *rxr; + struct e1000_hw *hw = &adapter->hw; + struct igb_queue *que; + u32 tmp, ivar = 0, newitr = 0; + + /* First turn on RSS capability */ + if (adapter->hw.mac.type > e1000_82575) + E1000_WRITE_REG(hw, E1000_GPIE, + E1000_GPIE_MSIX_MODE | E1000_GPIE_EIAME | + E1000_GPIE_PBA | E1000_GPIE_NSICR); /* Turn on MSIX */ - /* - ** 82576 uses IVARs to route MSI/X - ** interrupts, its not very intuitive, - ** study the code carefully :) - */ - if (adapter->hw.mac.type == e1000_82576) { - u32 ivar = 0; - /* First turn on the capability */ - E1000_WRITE_REG(hw, E1000_GPIE, - E1000_GPIE_MSIX_MODE | - E1000_GPIE_EIAME | - E1000_GPIE_PBA | E1000_GPIE_NSICR); - /* RX */ - for (int i = 0; i < adapter->num_rx_queues; i++) { - u32 index = i & 0x7; /* Each IVAR has two entries */ + switch (adapter->hw.mac.type) { + case e1000_82580: + case e1000_vfadapt: + /* RX entries */ + for (int i = 0; i < adapter->num_queues; i++) { + u32 index = i >> 1; ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index); - rxr = &adapter->rx_rings[i]; - if (i < 8) { - ivar &= 0xFFFFFF00; - ivar |= rxr->msix | E1000_IVAR_VALID; - } else { + que = &adapter->queues[i]; + if (i & 1) { ivar &= 0xFF00FFFF; - ivar |= (rxr->msix | E1000_IVAR_VALID) << 16; - } - E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar); - adapter->eims_mask |= rxr->eims; - } - /* TX */ - for (int i = 0; i < adapter->num_tx_queues; i++) { - u32 index = i & 0x7; /* Each IVAR has two entries */ - ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index); - txr = &adapter->tx_rings[i]; - if (i < 8) { - ivar &= 0xFFFF00FF; - ivar |= (txr->msix | E1000_IVAR_VALID) << 8; + ivar |= (que->msix | E1000_IVAR_VALID) << 16; } else { - ivar &= 0x00FFFFFF; - ivar |= (txr->msix | E1000_IVAR_VALID) << 24; + ivar &= 0xFFFFFF00; + ivar |= que->msix | E1000_IVAR_VALID; } E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar); - adapter->eims_mask |= txr->eims; + } + /* TX entries */ + for (int i = 0; i < adapter->num_queues; i++) { + u32 index = i >> 1; + ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index); + que = &adapter->queues[i]; + if (i & 1) { + ivar &= 0x00FFFFFF; + ivar |= (que->msix | E1000_IVAR_VALID) << 24; + } else { + ivar &= 0xFFFF00FF; + ivar |= (que->msix | E1000_IVAR_VALID) << 8; + } + E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar); + adapter->eims_mask |= que->eims; } /* And for the link interrupt */ @@ -2256,11 +2319,48 @@ igb_configure_queues(struct adapter *adapter) adapter->link_mask = 1 << adapter->linkvec; adapter->eims_mask |= adapter->link_mask; E1000_WRITE_REG(hw, E1000_IVAR_MISC, ivar); - } else - { /* 82575 */ - int tmp; + break; + case e1000_82576: + /* RX entries */ + for (int i = 0; i < adapter->num_queues; i++) { + u32 index = i & 0x7; /* Each IVAR has two entries */ + ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index); + que = &adapter->queues[i]; + if (i < 8) { + ivar &= 0xFFFFFF00; + ivar |= que->msix | E1000_IVAR_VALID; + } else { + ivar &= 0xFF00FFFF; + ivar |= (que->msix | E1000_IVAR_VALID) << 16; + } + E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar); + adapter->eims_mask |= que->eims; + } + /* TX entries */ + for (int i = 0; i < adapter->num_queues; i++) { + u32 index = i & 0x7; /* Each IVAR has two entries */ + ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index); + que = &adapter->queues[i]; + if (i < 8) { + ivar &= 0xFFFF00FF; + ivar |= (que->msix | E1000_IVAR_VALID) << 8; + } else { + ivar &= 0x00FFFFFF; + ivar |= (que->msix | E1000_IVAR_VALID) << 24; + } + E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar); + adapter->eims_mask |= que->eims; + } - /* enable MSI-X PBA support*/ + /* And for the link interrupt */ + ivar = (adapter->linkvec | E1000_IVAR_VALID) << 8; + adapter->link_mask = 1 << adapter->linkvec; + adapter->eims_mask |= adapter->link_mask; + E1000_WRITE_REG(hw, E1000_IVAR_MISC, ivar); + break; + + case e1000_82575: + /* enable MSI-X support*/ tmp = E1000_READ_REG(hw, E1000_CTRL_EXT); tmp |= E1000_CTRL_EXT_PBA_CLR; /* Auto-Mask interrupts upon ICR read. */ @@ -2268,20 +2368,15 @@ igb_configure_queues(struct adapter *adapter) tmp |= E1000_CTRL_EXT_IRCA; E1000_WRITE_REG(hw, E1000_CTRL_EXT, tmp); - /* TX */ - for (int i = 0; i < adapter->num_tx_queues; i++) { - txr = &adapter->tx_rings[i]; - E1000_WRITE_REG(hw, E1000_MSIXBM(txr->msix), - txr->eims); - adapter->eims_mask |= txr->eims; - } - - /* RX */ - for (int i = 0; i < adapter->num_rx_queues; i++) { - rxr = &adapter->rx_rings[i]; - E1000_WRITE_REG(hw, E1000_MSIXBM(rxr->msix), - rxr->eims); - adapter->eims_mask |= rxr->eims; + /* Queues */ + for (int i = 0; i < adapter->num_queues; i++) { + que = &adapter->queues[i]; + tmp = E1000_EICR_RX_QUEUE0 << i; + tmp |= E1000_EICR_TX_QUEUE0 << i; + que->eims = tmp; + E1000_WRITE_REG_ARRAY(hw, E1000_MSIXBM(0), + i, que->eims); + adapter->eims_mask |= que->eims; } /* Link */ @@ -2289,7 +2384,24 @@ igb_configure_queues(struct adapter *adapter) E1000_EIMS_OTHER); adapter->link_mask |= E1000_EIMS_OTHER; adapter->eims_mask |= adapter->link_mask; + default: + break; } + + /* Set the starting interrupt rate */ + if (igb_max_interrupt_rate > 0) + newitr = (4000000 / igb_max_interrupt_rate) & 0x7FFC; + + if (hw->mac.type == e1000_82575) + newitr |= newitr << 16; + else + newitr |= E1000_EITR_CNT_IGNR; + + for (int i = 0; i < adapter->num_queues; i++) { + que = &adapter->queues[i]; + E1000_WRITE_REG(hw, E1000_EITR(que->msix), newitr); + } + return; } @@ -2297,30 +2409,49 @@ igb_configure_queues(struct adapter *adapter) static void igb_free_pci_resources(struct adapter *adapter) { - device_t dev = adapter->dev; + struct igb_queue *que = adapter->queues; + device_t dev = adapter->dev; + int rid; - /* Make sure the for loop below runs once */ - if (adapter->msix == 0) - adapter->msix = 1; + /* + ** There is a slight possibility of a failure mode + ** in attach that will result in entering this function + ** before interrupt resources have been initialized, and + ** in that case we do not want to execute the loops below + ** We can detect this reliably by the state of the adapter + ** res pointer. + */ + if (adapter->res == NULL) + goto mem; /* * First release all the interrupt resources: - * notice that since these are just kept - * in an array we can do the same logic - * whether its MSIX or just legacy. */ - for (int i = 0; i < adapter->msix; i++) { - if (adapter->tag[i] != NULL) { - bus_teardown_intr(dev, adapter->res[i], - adapter->tag[i]); - adapter->tag[i] = NULL; - } - if (adapter->res[i] != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, - adapter->rid[i], adapter->res[i]); + for (int i = 0; i < adapter->num_queues; i++, que++) { + rid = que->msix + 1; + if (que->tag != NULL) { + bus_teardown_intr(dev, que->res, que->tag); + que->tag = NULL; } + if (que->res != NULL) + bus_release_resource(dev, + SYS_RES_IRQ, rid, que->res); } + /* Clean the Legacy or Link interrupt last */ + if (adapter->linkvec) /* we are doing MSIX */ + rid = adapter->linkvec + 1; + else + (adapter->msix != 0) ? (rid = 1):(rid = 0); + + if (adapter->tag != NULL) { + bus_teardown_intr(dev, adapter->res, adapter->tag); + adapter->tag = NULL; + } + if (adapter->res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, rid, adapter->res); + +mem: if (adapter->msix) pci_release_msi(dev); @@ -2343,6 +2474,10 @@ igb_setup_msix(struct adapter *adapter) device_t dev = adapter->dev; int rid, want, queues, msgs; + /* tuneable override */ + if (igb_enable_msix == 0) + goto msi; + /* First try MSI/X */ rid = PCIR_BAR(IGB_MSIX_BAR); adapter->msix_mem = bus_alloc_resource_any(dev, @@ -2362,18 +2497,28 @@ igb_setup_msix(struct adapter *adapter) goto msi; } - /* Limit by the number set in header */ - if (msgs > IGB_MSIX_VEC) - msgs = IGB_MSIX_VEC; - /* Figure out a reasonable auto config value */ - queues = (mp_ncpus > ((msgs-1)/2)) ? (msgs-1)/2 : mp_ncpus; + queues = (mp_ncpus > (msgs-1)) ? (msgs-1) : mp_ncpus; - if (igb_tx_queues == 0) - igb_tx_queues = queues; - if (igb_rx_queues == 0) - igb_rx_queues = queues; - want = igb_tx_queues + igb_rx_queues + 1; + /* Manual override */ + if (igb_num_queues != 0) + queues = igb_num_queues; + if (queues > 8) /* max queues */ + queues = 8; + + /* Can have max of 4 queues on 82575 */ + if ((adapter->hw.mac.type == e1000_82575) && (queues > 4)) + queues = 4; + + /* Limit the VF adapter to one queue */ + if (adapter->hw.mac.type == e1000_vfadapt) + queues = 1; + + /* + ** One vector (RX/TX pair) per queue + ** plus an additional for Link interrupt + */ + want = queues + 1; if (msgs >= want) msgs = want; else { @@ -2386,8 +2531,7 @@ igb_setup_msix(struct adapter *adapter) if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) { device_printf(adapter->dev, "Using MSIX interrupts with %d vectors\n", msgs); - adapter->num_tx_queues = igb_tx_queues; - adapter->num_rx_queues = igb_rx_queues; + adapter->num_queues = queues; return (msgs); } msi: @@ -2399,24 +2543,71 @@ msi: /********************************************************************* * - * Initialize the hardware to a configuration - * as specified by the adapter structure. + * Set up an fresh starting state * **********************************************************************/ -static int -igb_hardware_init(struct adapter *adapter) +static void +igb_reset(struct adapter *adapter) { device_t dev = adapter->dev; - u32 rx_buffer_size; + struct e1000_hw *hw = &adapter->hw; + struct e1000_fc_info *fc = &hw->fc; + struct ifnet *ifp = adapter->ifp; + u32 pba = 0; + u16 hwm; - INIT_DEBUGOUT("igb_hardware_init: begin"); - - /* Issue a global reset */ - e1000_reset_hw(&adapter->hw); + INIT_DEBUGOUT("igb_reset: begin"); /* Let the firmware know the OS is in control */ igb_get_hw_control(adapter); + /* + * Packet Buffer Allocation (PBA) + * Writing PBA sets the receive portion of the buffer + * the remainder is used for the transmit buffer. + */ + switch (hw->mac.type) { + case e1000_82575: + pba = E1000_PBA_32K; + break; + case e1000_82576: + case e1000_vfadapt: + pba = E1000_PBA_64K; + break; + case e1000_82580: + pba = E1000_PBA_35K; + default: + break; + } + + /* Special needs in case of Jumbo frames */ + if ((hw->mac.type == e1000_82575) && (ifp->if_mtu > ETHERMTU)) { + u32 tx_space, min_tx, min_rx; + pba = E1000_READ_REG(hw, E1000_PBA); + tx_space = pba >> 16; + pba &= 0xffff; + min_tx = (adapter->max_frame_size + + sizeof(struct e1000_tx_desc) - ETHERNET_FCS_SIZE) * 2; + min_tx = roundup2(min_tx, 1024); + min_tx >>= 10; + min_rx = adapter->max_frame_size; + min_rx = roundup2(min_rx, 1024); + min_rx >>= 10; + if (tx_space < min_tx && + ((min_tx - tx_space) < pba)) { + pba = pba - (min_tx - tx_space); + /* + * if short on rx space, rx wins + * and must trump tx adjustment + */ + if (pba < min_rx) + pba = min_rx; + } + E1000_WRITE_REG(hw, E1000_PBA, pba); + } + + INIT_DEBUGOUT1("igb_init: pba=%dK",pba); + /* * These parameters control the automatic generation (Tx) and * response (Rx) to Ethernet PAUSE frames. @@ -2424,41 +2615,74 @@ igb_hardware_init(struct adapter *adapter) * received after sending an XOFF. * - Low water mark works best when it is very near the high water mark. * This allows the receiver to restart by sending XON when it has - * drained a bit. Here we use an arbitary value of 1500 which will - * restart after one full frame is pulled from the buffer. There - * could be several smaller frames in the buffer and if so they will - * not trigger the XON until their total number reduces the buffer - * by 1500. - * - The pause time is fairly large at 1000 x 512ns = 512 usec. + * drained a bit. */ - if (adapter->hw.mac.type == e1000_82576) - rx_buffer_size = ((E1000_READ_REG(&adapter->hw, - E1000_RXPBS) & 0xffff) << 10 ); - else - rx_buffer_size = ((E1000_READ_REG(&adapter->hw, - E1000_PBA) & 0xffff) << 10 ); + hwm = min(((pba << 10) * 9 / 10), + ((pba << 10) - 2 * adapter->max_frame_size)); - adapter->hw.fc.high_water = rx_buffer_size - - roundup2(adapter->max_frame_size, 1024); - adapter->hw.fc.low_water = adapter->hw.fc.high_water - 1500; - - adapter->hw.fc.pause_time = IGB_FC_PAUSE_TIME; - adapter->hw.fc.send_xon = TRUE; - - /* Set Flow control, use the tunable location if sane */ - if ((igb_fc_setting >= 0) || (igb_fc_setting < 4)) - adapter->hw.fc.requested_mode = igb_fc_setting; - else - adapter->hw.fc.requested_mode = e1000_fc_none; - - if (e1000_init_hw(&adapter->hw) < 0) { - device_printf(dev, "Hardware Initialization Failed\n"); - return (EIO); + if (hw->mac.type < e1000_82576) { + fc->high_water = hwm & 0xFFF8; /* 8-byte granularity */ + fc->low_water = fc->high_water - 8; + } else { + fc->high_water = hwm & 0xFFF0; /* 16-byte granularity */ + fc->low_water = fc->high_water - 16; } - e1000_check_for_link(&adapter->hw); + fc->pause_time = IGB_FC_PAUSE_TIME; + fc->send_xon = TRUE; - return (0); + /* Set Flow control, use the tunable location if sane */ + if ((igb_fc_setting >= 0) && (igb_fc_setting < 4)) + fc->requested_mode = igb_fc_setting; + else + fc->requested_mode = e1000_fc_none; + + fc->current_mode = fc->requested_mode; + + /* Issue a global reset */ + e1000_reset_hw(hw); + E1000_WRITE_REG(hw, E1000_WUC, 0); + + if (e1000_init_hw(hw) < 0) + device_printf(dev, "Hardware Initialization Failed\n"); + + if (hw->mac.type == e1000_82580) { + u32 reg; + + hwm = (pba << 10) - (2 * adapter->max_frame_size); + /* + * 0x80000000 - enable DMA COAL + * 0x10000000 - use L0s as low power + * 0x20000000 - use L1 as low power + * X << 16 - exit dma coal when rx data exceeds X kB + * Y - upper limit to stay in dma coal in units of 32usecs + */ + E1000_WRITE_REG(hw, E1000_DMACR, + 0xA0000006 | ((hwm << 6) & 0x00FF0000)); + + /* set hwm to PBA - 2 * max frame size */ + E1000_WRITE_REG(hw, E1000_FCRTC, hwm); + /* + * This sets the time to wait before requesting transition to + * low power state to number of usecs needed to receive 1 512 + * byte frame at gigabit line rate + */ + E1000_WRITE_REG(hw, E1000_DMCTLX, 4); + + /* free space in tx packet buffer to wake from DMA coal */ + E1000_WRITE_REG(hw, E1000_DMCTXTH, + (20480 - (2 * adapter->max_frame_size)) >> 6); + + /* make low power state decision controlled by DMA coal */ + reg = E1000_READ_REG(hw, E1000_PCIEMISC); + E1000_WRITE_REG(hw, E1000_PCIEMISC, + reg | E1000_PCIEMISC_LX_DECISION); + } + + E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); + e1000_get_phy_info(hw); + e1000_check_for_link(hw); + return; } /********************************************************************* @@ -2466,7 +2690,7 @@ igb_hardware_init(struct adapter *adapter) * Setup networking device structure and register an interface. * **********************************************************************/ -static void +static int igb_setup_interface(device_t dev, struct adapter *adapter) { struct ifnet *ifp; @@ -2474,8 +2698,10 @@ igb_setup_interface(device_t dev, struct adapter *adapter) INIT_DEBUGOUT("igb_setup_interface: begin"); ifp = adapter->ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) - panic("%s: can not if_alloc()", device_get_nameunit(dev)); + if (ifp == NULL) { + device_printf(dev, "can not allocate ifnet structure\n"); + return (-1); + } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; ifp->if_init = igb_init; @@ -2483,6 +2709,10 @@ igb_setup_interface(device_t dev, struct adapter *adapter) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = igb_ioctl; ifp->if_start = igb_start; +#if __FreeBSD_version >= 800000 + ifp->if_transmit = igb_mq_start; + ifp->if_qflush = igb_qflush; +#endif IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1); ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1; IFQ_SET_READY(&ifp->if_snd); @@ -2493,21 +2723,33 @@ igb_setup_interface(device_t dev, struct adapter *adapter) ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; ifp->if_capabilities |= IFCAP_TSO4; + ifp->if_capabilities |= IFCAP_JUMBO_MTU; ifp->if_capenable = ifp->if_capabilities; + /* Don't enable LRO by default */ + ifp->if_capabilities |= IFCAP_LRO; + +#ifdef DEVICE_POLLING + ifp->if_capabilities |= IFCAP_POLLING; +#endif + /* - * Tell the upper layer(s) what we support. + * Tell the upper layer(s) we + * support full VLAN capability. */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; - ifp->if_capabilities |= IFCAP_VLAN_MTU; - ifp->if_capenable |= IFCAP_VLAN_HWTAGGING; - ifp->if_capenable |= IFCAP_VLAN_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; -#ifdef IGB_HW_VLAN_SUPPORT + /* + ** Dont turn this on by default, if vlans are + ** created on another pseudo device (eg. lagg) + ** then vlan events are not passed thru, breaking + ** operation, but with HW FILTER off it works. If + ** using vlans directly on the em driver you can + ** enable this and get full hardware tag filtering. + */ ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; - ifp->if_capenable |= IFCAP_VLAN_HWFILTER; -#endif /* * Specify the media types supported by this adapter and register @@ -2537,6 +2779,7 @@ igb_setup_interface(device_t dev, struct adapter *adapter) } ifmedia_add(&adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO); + return (0); } @@ -2636,30 +2879,38 @@ static int igb_allocate_queues(struct adapter *adapter) { device_t dev = adapter->dev; - struct tx_ring *txr; - struct rx_ring *rxr; + struct igb_queue *que = NULL; + struct tx_ring *txr = NULL; + struct rx_ring *rxr = NULL; int rsize, tsize, error = E1000_SUCCESS; int txconf = 0, rxconf = 0; - /* First allocate the TX ring struct memory */ - if (!(adapter->tx_rings = - (struct tx_ring *) malloc(sizeof(struct tx_ring) * - adapter->num_tx_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { - device_printf(dev, "Unable to allocate TX ring memory\n"); + /* First allocate the top level queue structs */ + if (!(adapter->queues = + (struct igb_queue *) malloc(sizeof(struct igb_queue) * + adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate queue memory\n"); error = ENOMEM; goto fail; } - txr = adapter->tx_rings; - /* Next allocate the RX */ + /* Next allocate the TX ring struct memory */ + if (!(adapter->tx_rings = + (struct tx_ring *) malloc(sizeof(struct tx_ring) * + adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate TX ring memory\n"); + error = ENOMEM; + goto tx_fail; + } + + /* Now allocate the RX */ if (!(adapter->rx_rings = (struct rx_ring *) malloc(sizeof(struct rx_ring) * - adapter->num_rx_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate RX ring memory\n"); error = ENOMEM; goto rx_fail; } - rxr = adapter->rx_rings; tsize = roundup2(adapter->num_tx_desc * sizeof(union e1000_adv_tx_desc), IGB_DBA_ALIGN); @@ -2668,7 +2919,7 @@ igb_allocate_queues(struct adapter *adapter) * possibility that things fail midcourse and we need to * undo memory gracefully */ - for (int i = 0; i < adapter->num_tx_queues; i++, txconf++) { + for (int i = 0; i < adapter->num_queues; i++, txconf++) { /* Set up some basics */ txr = &adapter->tx_rings[i]; txr->adapter = adapter; @@ -2696,7 +2947,11 @@ igb_allocate_queues(struct adapter *adapter) error = ENOMEM; goto err_tx_desc; } - +#if __FreeBSD_version >= 800000 + /* Allocate a buf ring */ + txr->br = buf_ring_alloc(IGB_BR_SIZE, M_DEVBUF, + M_WAITOK, &txr->tx_mtx); +#endif } /* @@ -2704,7 +2959,7 @@ igb_allocate_queues(struct adapter *adapter) */ rsize = roundup2(adapter->num_rx_desc * sizeof(union e1000_adv_rx_desc), IGB_DBA_ALIGN); - for (int i = 0; i < adapter->num_rx_queues; i++, rxconf++) { + for (int i = 0; i < adapter->num_queues; i++, rxconf++) { rxr = &adapter->rx_rings[i]; rxr->adapter = adapter; rxr->me = i; @@ -2733,6 +2988,16 @@ igb_allocate_queues(struct adapter *adapter) } } + /* + ** Finally set up the queue holding structs + */ + for (int i = 0; i < adapter->num_queues; i++) { + que = &adapter->queues[i]; + que->adapter = adapter; + que->txr = &adapter->tx_rings[i]; + que->rxr = &adapter->rx_rings[i]; + } + return (0); err_rx_desc: @@ -2743,7 +3008,12 @@ err_tx_desc: igb_dma_free(adapter, &txr->txdma); free(adapter->rx_rings, M_DEVBUF); rx_fail: +#if __FreeBSD_version >= 800000 + buf_ring_free(txr->br, M_DEVBUF); +#endif free(adapter->tx_rings, M_DEVBUF); +tx_fail: + free(adapter->queues, M_DEVBUF); fail: return (error); } @@ -2760,14 +3030,14 @@ igb_allocate_transmit_buffers(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; device_t dev = adapter->dev; - struct igb_buffer *txbuf; + struct igb_tx_buffer *txbuf; int error, i; /* * Setup DMA descriptor areas. */ - if ((error = bus_dma_tag_create(NULL, /* parent */ - PAGE_SIZE, 0, /* alignment, bounds */ + if ((error = bus_dma_tag_create(bus_get_dma_tag(dev), + 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ @@ -2783,7 +3053,7 @@ igb_allocate_transmit_buffers(struct tx_ring *txr) } if (!(txr->tx_buffers = - (struct igb_buffer *) malloc(sizeof(struct igb_buffer) * + (struct igb_tx_buffer *) malloc(sizeof(struct igb_tx_buffer) * adapter->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate tx_buffer memory\n"); error = ENOMEM; @@ -2816,10 +3086,11 @@ static void igb_setup_transmit_ring(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; - struct igb_buffer *txbuf; + struct igb_tx_buffer *txbuf; int i; - /* Clear the old ring contents */ + /* Clear the old descriptor contents */ + IGB_TX_LOCK(txr); bzero((void *)txr->tx_base, (sizeof(union e1000_adv_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -2845,7 +3116,7 @@ igb_setup_transmit_ring(struct tx_ring *txr) bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - + IGB_TX_UNLOCK(txr); } /********************************************************************* @@ -2858,7 +3129,7 @@ igb_setup_transmit_structures(struct adapter *adapter) { struct tx_ring *txr = adapter->tx_rings; - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) + for (int i = 0; i < adapter->num_queues; i++, txr++) igb_setup_transmit_ring(txr); return; @@ -2873,48 +3144,53 @@ static void igb_initialize_transmit_units(struct adapter *adapter) { struct tx_ring *txr = adapter->tx_rings; + struct e1000_hw *hw = &adapter->hw; u32 tctl, txdctl; - INIT_DEBUGOUT("igb_initialize_transmit_units: begin"); + INIT_DEBUGOUT("igb_initialize_transmit_units: begin"); + tctl = txdctl = 0; - /* Setup the Base and Length of the Tx Descriptor Rings */ - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { + /* Setup the Tx Descriptor Rings */ + for (int i = 0; i < adapter->num_queues; i++, txr++) { u64 bus_addr = txr->txdma.dma_paddr; - E1000_WRITE_REG(&adapter->hw, E1000_TDLEN(i), + E1000_WRITE_REG(hw, E1000_TDLEN(i), adapter->num_tx_desc * sizeof(struct e1000_tx_desc)); - E1000_WRITE_REG(&adapter->hw, E1000_TDBAH(i), + E1000_WRITE_REG(hw, E1000_TDBAH(i), (uint32_t)(bus_addr >> 32)); - E1000_WRITE_REG(&adapter->hw, E1000_TDBAL(i), + E1000_WRITE_REG(hw, E1000_TDBAL(i), (uint32_t)bus_addr); /* Setup the HW Tx Head and Tail descriptor pointers */ - E1000_WRITE_REG(&adapter->hw, E1000_TDT(i), 0); - E1000_WRITE_REG(&adapter->hw, E1000_TDH(i), 0); + E1000_WRITE_REG(hw, E1000_TDT(i), 0); + E1000_WRITE_REG(hw, E1000_TDH(i), 0); HW_DEBUGOUT2("Base = %x, Length = %x\n", - E1000_READ_REG(&adapter->hw, E1000_TDBAL(i)), - E1000_READ_REG(&adapter->hw, E1000_TDLEN(i))); + E1000_READ_REG(hw, E1000_TDBAL(i)), + E1000_READ_REG(hw, E1000_TDLEN(i))); - /* Setup Transmit Descriptor Base Settings */ - adapter->txd_cmd = E1000_TXD_CMD_IFCS; + txr->queue_status = IGB_QUEUE_IDLE; - txdctl = E1000_READ_REG(&adapter->hw, E1000_TXDCTL(i)); + txdctl |= IGB_TX_PTHRESH; + txdctl |= IGB_TX_HTHRESH << 8; + txdctl |= IGB_TX_WTHRESH << 16; txdctl |= E1000_TXDCTL_QUEUE_ENABLE; - E1000_WRITE_REG(&adapter->hw, E1000_TXDCTL(i), txdctl); + E1000_WRITE_REG(hw, E1000_TXDCTL(i), txdctl); } + if (adapter->hw.mac.type == e1000_vfadapt) + return; + + e1000_config_collision_dist(hw); + /* Program the Transmit Control Register */ - tctl = E1000_READ_REG(&adapter->hw, E1000_TCTL); + tctl = E1000_READ_REG(hw, E1000_TCTL); tctl &= ~E1000_TCTL_CT; tctl |= (E1000_TCTL_PSP | E1000_TCTL_RTLC | E1000_TCTL_EN | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT)); - e1000_config_collision_dist(&adapter->hw); - /* This write will effectively turn on the transmit unit. */ - E1000_WRITE_REG(&adapter->hw, E1000_TCTL, tctl); - + E1000_WRITE_REG(hw, E1000_TCTL, tctl); } /********************************************************************* @@ -2927,7 +3203,7 @@ igb_free_transmit_structures(struct adapter *adapter) { struct tx_ring *txr = adapter->tx_rings; - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { + for (int i = 0; i < adapter->num_queues; i++, txr++) { IGB_TX_LOCK(txr); igb_free_transmit_buffers(txr); igb_dma_free(adapter, &txr->txdma); @@ -2946,7 +3222,7 @@ static void igb_free_transmit_buffers(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; - struct igb_buffer *tx_buffer; + struct igb_tx_buffer *tx_buffer; int i; INIT_DEBUGOUT("free_transmit_ring: begin"); @@ -2976,7 +3252,10 @@ igb_free_transmit_buffers(struct tx_ring *txr) tx_buffer->map = NULL; } } - +#if __FreeBSD_version >= 800000 + if (txr->br != NULL) + buf_ring_free(txr->br, M_DEVBUF); +#endif if (txr->tx_buffers != NULL) { free(txr->tx_buffers, M_DEVBUF); txr->tx_buffers = NULL; @@ -2990,8 +3269,7 @@ igb_free_transmit_buffers(struct tx_ring *txr) /********************************************************************** * - * Setup work for hardware segmentation offload (TSO) on - * adapters using advanced tx descriptors (82575) + * Setup work for hardware segmentation offload (TSO) * **********************************************************************/ static boolean_t @@ -2999,7 +3277,7 @@ igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *hdrlen) { struct adapter *adapter = txr->adapter; struct e1000_adv_tx_context_desc *TXD; - struct igb_buffer *tx_buffer; + struct igb_tx_buffer *tx_buffer; u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; u32 mss_l4len_idx = 0; u16 vtag = 0; @@ -3062,6 +3340,9 @@ igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *hdrlen) /* MSS L4LEN IDX */ mss_l4len_idx |= (mp->m_pkthdr.tso_segsz << E1000_ADVTXD_MSS_SHIFT); mss_l4len_idx |= (tcp_hlen << E1000_ADVTXD_L4LEN_SHIFT); + /* 82575 needs the queue index added */ + if (adapter->hw.mac.type == e1000_82575) + mss_l4len_idx |= txr->me << 4; TXD->mss_l4len_idx = htole32(mss_l4len_idx); TXD->seqnum_seed = htole32(0); @@ -3083,37 +3364,40 @@ igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *hdrlen) * **********************************************************************/ -static int +static bool igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp) { struct adapter *adapter = txr->adapter; struct e1000_adv_tx_context_desc *TXD; - struct igb_buffer *tx_buffer; - uint32_t vlan_macip_lens = 0, type_tucmd_mlhl = 0; + struct igb_tx_buffer *tx_buffer; + u32 vlan_macip_lens, type_tucmd_mlhl, mss_l4len_idx; struct ether_vlan_header *eh; struct ip *ip = NULL; struct ip6_hdr *ip6; - int ehdrlen, ip_hlen = 0; - u16 etype; + int ehdrlen, ctxd, ip_hlen = 0; + u16 etype, vtag = 0; u8 ipproto = 0; bool offload = TRUE; - u16 vtag = 0; - int ctxd = txr->next_avail_desc; + if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0) + offload = FALSE; + + vlan_macip_lens = type_tucmd_mlhl = mss_l4len_idx = 0; + ctxd = txr->next_avail_desc; tx_buffer = &txr->tx_buffers[ctxd]; TXD = (struct e1000_adv_tx_context_desc *) &txr->tx_base[ctxd]; - if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0) - offload = FALSE; /* Only here to handle VLANs */ /* ** In advanced descriptors the vlan tag must - ** be placed into the descriptor itself. + ** be placed into the context descriptor, thus + ** we need to be here just for that setup. */ if (mp->m_flags & M_VLANTAG) { vtag = htole16(mp->m_pkthdr.ether_vtag); vlan_macip_lens |= (vtag << E1000_ADVTXD_VLAN_SHIFT); } else if (offload == FALSE) return FALSE; + /* * Determine where frame payload starts. * Jump over vlan headers if already present, @@ -3145,16 +3429,9 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp) case ETHERTYPE_IPV6: ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); ip_hlen = sizeof(struct ip6_hdr); - if (mp->m_len < ehdrlen + ip_hlen) - return FALSE; /* failure */ ipproto = ip6->ip6_nxt; type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_IPV6; break; -#ifdef IGB_TIMESYNC - case ETHERTYPE_IEEE1588: - offload = IGB_TIMESTAMP; - break; -#endif default: offload = FALSE; break; @@ -3169,28 +3446,29 @@ igb_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp) type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP; break; case IPPROTO_UDP: - { -#ifdef IGB_TIMESYNC - void *hdr = (caddr_t) ip + ip_hlen; - struct udphdr *uh = (struct udphdr *)hdr; - - if (uh->uh_dport == htons(TSYNC_PORT)) - offload = IGB_TIMESTAMP; -#endif if (mp->m_pkthdr.csum_flags & CSUM_UDP) type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP; break; - } +#if __FreeBSD_version >= 800000 + case IPPROTO_SCTP: + if (mp->m_pkthdr.csum_flags & CSUM_SCTP) + type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP; + break; +#endif default: offload = FALSE; break; } + /* 82575 needs the queue index added */ + if (adapter->hw.mac.type == e1000_82575) + mss_l4len_idx = txr->me << 4; + /* Now copy bits into descriptor */ TXD->vlan_macip_lens |= htole32(vlan_macip_lens); TXD->type_tucmd_mlhl |= htole32(type_tucmd_mlhl); TXD->seqnum_seed = htole32(0); - TXD->mss_l4len_idx = htole32(0); + TXD->mss_l4len_idx = htole32(mss_l4len_idx); tx_buffer->m_head = NULL; tx_buffer->next_eop = -1; @@ -3217,17 +3495,19 @@ static bool igb_txeof(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; - int first, last, done, num_avail; - struct igb_buffer *tx_buffer; + int first, last, done, processed; + struct igb_tx_buffer *tx_buffer; struct e1000_tx_desc *tx_desc, *eop_desc; struct ifnet *ifp = adapter->ifp; IGB_TX_LOCK_ASSERT(txr); - if (txr->tx_avail == adapter->num_tx_desc) + if (txr->tx_avail == adapter->num_tx_desc) { + txr->queue_status = IGB_QUEUE_IDLE; return FALSE; + } - num_avail = txr->tx_avail; + processed = 0; first = txr->next_to_clean; tx_desc = &txr->tx_base[first]; tx_buffer = &txr->tx_buffers[first]; @@ -3245,7 +3525,7 @@ igb_txeof(struct tx_ring *txr) done = last; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); while (eop_desc->upper.fields.status & E1000_TXD_STAT_DD) { /* We clean the range of the packet */ @@ -3253,10 +3533,12 @@ igb_txeof(struct tx_ring *txr) tx_desc->upper.data = 0; tx_desc->lower.data = 0; tx_desc->buffer_addr = 0; - num_avail++; + ++txr->tx_avail; + ++processed; if (tx_buffer->m_head) { - ifp->if_opackets++; + txr->bytes += + tx_buffer->m_head->m_pkthdr.len; bus_dmamap_sync(txr->txtag, tx_buffer->map, BUS_DMASYNC_POSTWRITE); @@ -3267,6 +3549,7 @@ igb_txeof(struct tx_ring *txr) tx_buffer->m_head = NULL; } tx_buffer->next_eop = -1; + txr->watchdog_time = ticks; if (++first == adapter->num_tx_desc) first = 0; @@ -3274,6 +3557,8 @@ igb_txeof(struct tx_ring *txr) tx_buffer = &txr->tx_buffers[first]; tx_desc = &txr->tx_base[first]; } + ++txr->packets; + ++ifp->if_opackets; /* See if we can continue to the next packet */ last = tx_buffer->next_eop; if (last != -1) { @@ -3289,80 +3574,121 @@ igb_txeof(struct tx_ring *txr) txr->next_to_clean = first; + /* + ** Watchdog calculation, we know there's + ** work outstanding or the first return + ** would have been taken, so none processed + ** for too long indicates a hang. + */ + if ((!processed) && ((ticks - txr->watchdog_time) > IGB_WATCHDOG)) + txr->queue_status = IGB_QUEUE_HUNG; + /* - * If we have enough room, clear IFF_DRV_OACTIVE to tell the stack - * that it is OK to send packets. - * If there are no pending descriptors, clear the timeout. Otherwise, - * if some descriptors have been freed, restart the timeout. + * If we have enough room, clear IFF_DRV_OACTIVE + * to tell the stack that it is OK to send packets. */ - if (num_avail > IGB_TX_CLEANUP_THRESHOLD) { + if (txr->tx_avail > IGB_TX_CLEANUP_THRESHOLD) { ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - /* All clean, turn off the timer */ - if (num_avail == adapter->num_tx_desc) { - txr->watchdog_timer = 0; - txr->tx_avail = num_avail; - return FALSE; + /* All clean, turn off the watchdog */ + if (txr->tx_avail == adapter->num_tx_desc) { + txr->queue_status = IGB_QUEUE_IDLE; + return (FALSE); } - /* Some cleaned, reset the timer */ - else if (num_avail != txr->tx_avail) - txr->watchdog_timer = IGB_TX_TIMEOUT; } - txr->tx_avail = num_avail; - return TRUE; + + return (TRUE); } /********************************************************************* * - * Get a buffer from system mbuf buffer pool. + * Refresh mbuf buffers for RX descriptor rings + * - now keeps its own state so discards due to resource + * exhaustion are unnecessary, if an mbuf cannot be obtained + * it just returns, keeping its placeholder, thus it can simply + * be recalled to try again. * **********************************************************************/ -static int -igb_get_buf(struct rx_ring *rxr, int i) +static void +igb_refresh_mbufs(struct rx_ring *rxr, int limit) { struct adapter *adapter = rxr->adapter; - struct mbuf *m; - bus_dma_segment_t segs[1]; - bus_dmamap_t map; - struct igb_buffer *rx_buffer; - int error, nsegs; + bus_dma_segment_t hseg[1]; + bus_dma_segment_t pseg[1]; + struct igb_rx_buf *rxbuf; + struct mbuf *mh, *mp; + int i, nsegs, error, cleaned; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - if (m == NULL) { - adapter->mbuf_cluster_failed++; - return (ENOBUFS); + i = rxr->next_to_refresh; + cleaned = -1; /* Signify no completions */ + while (i != limit) { + rxbuf = &rxr->rx_buffers[i]; + /* No hdr mbuf used with header split off */ + if (rxr->hdr_split == FALSE) + goto no_split; + if (rxbuf->m_head == NULL) { + mh = m_gethdr(M_DONTWAIT, MT_DATA); + if (mh == NULL) + goto update; + } else + mh = rxbuf->m_head; + + mh->m_pkthdr.len = mh->m_len = MHLEN; + mh->m_len = MHLEN; + mh->m_flags |= M_PKTHDR; + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->htag, + rxbuf->hmap, mh, hseg, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("Refresh mbufs: hdr dmamap load" + " failure - %d\n", error); + m_free(mh); + rxbuf->m_head = NULL; + goto update; + } + rxbuf->m_head = mh; + bus_dmamap_sync(rxr->htag, rxbuf->hmap, + BUS_DMASYNC_PREREAD); + rxr->rx_base[i].read.hdr_addr = + htole64(hseg[0].ds_addr); +no_split: + if (rxbuf->m_pack == NULL) { + mp = m_getjcl(M_DONTWAIT, MT_DATA, + M_PKTHDR, adapter->rx_mbuf_sz); + if (mp == NULL) + goto update; + } else + mp = rxbuf->m_pack; + + mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->ptag, + rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("Refresh mbufs: payload dmamap load" + " failure - %d\n", error); + m_free(mp); + rxbuf->m_pack = NULL; + goto update; + } + rxbuf->m_pack = mp; + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + BUS_DMASYNC_PREREAD); + rxr->rx_base[i].read.pkt_addr = + htole64(pseg[0].ds_addr); + + cleaned = i; + /* Calculate next index */ + if (++i == adapter->num_rx_desc) + i = 0; + /* This is the work marker for refresh */ + rxr->next_to_refresh = i; } - m->m_len = m->m_pkthdr.len = MCLBYTES; - - if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) - m_adj(m, ETHER_ALIGN); - - /* - * Using memory from the mbuf cluster pool, invoke the - * bus_dma machinery to arrange the memory mapping. - */ - error = bus_dmamap_load_mbuf_sg(rxr->rxtag, - rxr->rx_spare_map, m, segs, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - m_free(m); - return (error); - } - - /* If nsegs is wrong then the stack is corrupt. */ - KASSERT(nsegs == 1, ("Too many segments returned!")); - - rx_buffer = &rxr->rx_buffers[i]; - if (rx_buffer->m_head != NULL) - bus_dmamap_unload(rxr->rxtag, rx_buffer->map); - - map = rx_buffer->map; - rx_buffer->map = rxr->rx_spare_map; - rxr->rx_spare_map = map; - bus_dmamap_sync(rxr->rxtag, rx_buffer->map, BUS_DMASYNC_PREREAD); - rx_buffer->m_head = m; - - rxr->rx_base[i].read.pkt_addr = htole64(segs[0].ds_addr); - return (0); +update: + if (cleaned != -1) /* If we refreshed some, bump tail */ + E1000_WRITE_REG(&adapter->hw, + E1000_RDT(rxr->me), cleaned); + return; } @@ -3379,49 +3705,64 @@ igb_allocate_receive_buffers(struct rx_ring *rxr) { struct adapter *adapter = rxr->adapter; device_t dev = adapter->dev; - struct igb_buffer *rxbuf; + struct igb_rx_buf *rxbuf; int i, bsize, error; - bsize = sizeof(struct igb_buffer) * adapter->num_rx_desc; + bsize = sizeof(struct igb_rx_buf) * adapter->num_rx_desc; if (!(rxr->rx_buffers = - (struct igb_buffer *) malloc(bsize, + (struct igb_rx_buf *) malloc(bsize, M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate rx_buffer memory\n"); error = ENOMEM; goto fail; } - if ((error = bus_dma_tag_create(NULL, /* parent */ - PAGE_SIZE, 0, /* alignment, bounds */ + if ((error = bus_dma_tag_create(bus_get_dma_tag(dev), + 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MCLBYTES, /* maxsize */ + MSIZE, /* maxsize */ 1, /* nsegments */ - MCLBYTES, /* maxsegsize */ + MSIZE, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ - &rxr->rxtag))) { - device_printf(dev, "Unable to create RX Small DMA tag\n"); + &rxr->htag))) { + device_printf(dev, "Unable to create RX DMA tag\n"); goto fail; } - /* Create the spare map (used by getbuf) */ - error = bus_dmamap_create(rxr->rxtag, BUS_DMA_NOWAIT, - &rxr->rx_spare_map); - if (error) { - device_printf(dev, "%s: bus_dmamap_create failed: %d\n", - __func__, error); + if ((error = bus_dma_tag_create(bus_get_dma_tag(dev), + 1, 0, /* alignment, bounds */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MJUM9BYTES, /* maxsize */ + 1, /* nsegments */ + MJUM9BYTES, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &rxr->ptag))) { + device_printf(dev, "Unable to create RX payload DMA tag\n"); goto fail; } - for (i = 0; i < adapter->num_rx_desc; i++, rxbuf++) { + for (i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; - error = bus_dmamap_create(rxr->rxtag, - BUS_DMA_NOWAIT, &rxbuf->map); + error = bus_dmamap_create(rxr->htag, + BUS_DMA_NOWAIT, &rxbuf->hmap); if (error) { - device_printf(dev, "Unable to create Small RX DMA map\n"); + device_printf(dev, + "Unable to create RX head DMA maps\n"); + goto fail; + } + error = bus_dmamap_create(rxr->ptag, + BUS_DMA_NOWAIT, &rxbuf->pmap); + if (error) { + device_printf(dev, + "Unable to create RX packet DMA maps\n"); goto fail; } } @@ -3434,6 +3775,37 @@ fail: return (error); } + +static void +igb_free_receive_ring(struct rx_ring *rxr) +{ + struct adapter *adapter; + struct igb_rx_buf *rxbuf; + int i; + + adapter = rxr->adapter; + for (i = 0; i < adapter->num_rx_desc; i++) { + rxbuf = &rxr->rx_buffers[i]; + if (rxbuf->m_head != NULL) { + bus_dmamap_sync(rxr->htag, rxbuf->hmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->htag, rxbuf->hmap); + rxbuf->m_head->m_flags |= M_PKTHDR; + m_freem(rxbuf->m_head); + } + if (rxbuf->m_pack != NULL) { + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->ptag, rxbuf->pmap); + rxbuf->m_pack->m_flags |= M_PKTHDR; + m_freem(rxbuf->m_pack); + } + rxbuf->m_head = NULL; + rxbuf->m_pack = NULL; + } +} + + /********************************************************************* * * Initialize a receive ring and its buffers. @@ -3443,77 +3815,121 @@ static int igb_setup_receive_ring(struct rx_ring *rxr) { struct adapter *adapter; + struct ifnet *ifp; device_t dev; - struct igb_buffer *rxbuf; + struct igb_rx_buf *rxbuf; + bus_dma_segment_t pseg[1], hseg[1]; struct lro_ctrl *lro = &rxr->lro; - int j, rsize; + int rsize, nsegs, error = 0; adapter = rxr->adapter; dev = adapter->dev; - rsize = roundup2(adapter->num_rx_desc * - sizeof(union e1000_adv_rx_desc), 4096); + ifp = adapter->ifp; + /* Clear the ring contents */ + IGB_RX_LOCK(rxr); + rsize = roundup2(adapter->num_rx_desc * + sizeof(union e1000_adv_rx_desc), IGB_DBA_ALIGN); bzero((void *)rxr->rx_base, rsize); /* - ** Free current RX buffers: the size buffer - ** that is loaded is indicated by the buffer - ** bigbuf value. + ** Free current RX buffer structures and their mbufs */ - for (int i = 0; i < adapter->num_rx_desc; i++) { - rxbuf = &rxr->rx_buffers[i]; - if (rxbuf->m_head != NULL) { - bus_dmamap_sync(rxr->rxtag, rxbuf->map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->rxtag, rxbuf->map); - m_freem(rxbuf->m_head); - rxbuf->m_head = NULL; - } - } + igb_free_receive_ring(rxr); - for (j = 0; j < adapter->num_rx_desc; j++) { - if (igb_get_buf(rxr, j) == ENOBUFS) { - rxr->rx_buffers[j].m_head = NULL; - rxr->rx_base[j].read.pkt_addr = 0; - goto fail; + /* Configure for header split? */ + if (igb_header_split) + rxr->hdr_split = TRUE; + + /* Now replenish the ring mbufs */ + for (int j = 0; j < adapter->num_rx_desc; ++j) { + struct mbuf *mh, *mp; + + rxbuf = &rxr->rx_buffers[j]; + if (rxr->hdr_split == FALSE) + goto skip_head; + + /* First the header */ + rxbuf->m_head = m_gethdr(M_DONTWAIT, MT_DATA); + if (rxbuf->m_head == NULL) { + error = ENOBUFS; + goto fail; } - } + m_adj(rxbuf->m_head, ETHER_ALIGN); + mh = rxbuf->m_head; + mh->m_len = mh->m_pkthdr.len = MHLEN; + mh->m_flags |= M_PKTHDR; + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->htag, + rxbuf->hmap, rxbuf->m_head, hseg, + &nsegs, BUS_DMA_NOWAIT); + if (error != 0) /* Nothing elegant to do here */ + goto fail; + bus_dmamap_sync(rxr->htag, + rxbuf->hmap, BUS_DMASYNC_PREREAD); + /* Update descriptor */ + rxr->rx_base[j].read.hdr_addr = htole64(hseg[0].ds_addr); + +skip_head: + /* Now the payload cluster */ + rxbuf->m_pack = m_getjcl(M_DONTWAIT, MT_DATA, + M_PKTHDR, adapter->rx_mbuf_sz); + if (rxbuf->m_pack == NULL) { + error = ENOBUFS; + goto fail; + } + mp = rxbuf->m_pack; + mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->ptag, + rxbuf->pmap, mp, pseg, + &nsegs, BUS_DMA_NOWAIT); + if (error != 0) + goto fail; + bus_dmamap_sync(rxr->ptag, + rxbuf->pmap, BUS_DMASYNC_PREREAD); + /* Update descriptor */ + rxr->rx_base[j].read.pkt_addr = htole64(pseg[0].ds_addr); + } /* Setup our descriptor indices */ rxr->next_to_check = 0; - rxr->last_cleaned = 0; + rxr->next_to_refresh = 0; + rxr->lro_enabled = FALSE; + rxr->rx_split_packets = 0; + rxr->rx_bytes = 0; + + rxr->fmp = NULL; + rxr->lmp = NULL; + rxr->discard = FALSE; bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - /* Now set up the LRO interface */ - if (igb_enable_lro) { - int err = tcp_lro_init(lro); - if (err) { - device_printf(dev,"LRO Initialization failed!\n"); + /* + ** Now set up the LRO interface, we + ** also only do head split when LRO + ** is enabled, since so often they + ** are undesireable in similar setups. + */ + if (ifp->if_capenable & IFCAP_LRO) { + error = tcp_lro_init(lro); + if (error) { + device_printf(dev, "LRO Initialization failed!\n"); goto fail; } INIT_DEBUGOUT("RX LRO Initialized\n"); + rxr->lro_enabled = TRUE; lro->ifp = adapter->ifp; } + IGB_RX_UNLOCK(rxr); return (0); + fail: - /* - * We need to clean up any buffers allocated - * so far, 'j' is the failing index. - */ - for (int i = 0; i < j; i++) { - rxbuf = &rxr->rx_buffers[i]; - if (rxbuf->m_head != NULL) { - bus_dmamap_sync(rxr->rxtag, rxbuf->map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->rxtag, rxbuf->map); - m_freem(rxbuf->m_head); - rxbuf->m_head = NULL; - } - } - return (ENOBUFS); + igb_free_receive_ring(rxr); + IGB_RX_UNLOCK(rxr); + return (error); } /********************************************************************* @@ -3525,9 +3941,9 @@ static int igb_setup_receive_structures(struct adapter *adapter) { struct rx_ring *rxr = adapter->rx_rings; - int j; + int i; - for (j = 0; j < adapter->num_rx_queues; j++, rxr++) + for (i = 0; i < adapter->num_queues; i++, rxr++) if (igb_setup_receive_ring(rxr)) goto fail; @@ -3536,21 +3952,13 @@ fail: /* * Free RX buffers allocated so far, we will only handle * the rings that completed, the failing case will have - * cleaned up for itself. Clean up til 'j', the failure. + * cleaned up for itself. 'i' is the endpoint. */ - for (int i = 0; i < j; i++) { + for (int j = 0; j > i; ++j) { rxr = &adapter->rx_rings[i]; - for (int n = 0; n < adapter->num_rx_desc; n++) { - struct igb_buffer *rxbuf; - rxbuf = &rxr->rx_buffers[n]; - if (rxbuf->m_head != NULL) { - bus_dmamap_sync(rxr->rxtag, rxbuf->map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->rxtag, rxbuf->map); - m_freem(rxbuf->m_head); - rxbuf->m_head = NULL; - } - } + IGB_RX_LOCK(rxr); + igb_free_receive_ring(rxr); + IGB_RX_UNLOCK(rxr); } return (ENOBUFS); @@ -3566,7 +3974,8 @@ igb_initialize_receive_units(struct adapter *adapter) { struct rx_ring *rxr = adapter->rx_rings; struct ifnet *ifp = adapter->ifp; - u32 rctl, rxcsum, psize; + struct e1000_hw *hw = &adapter->hw; + u32 rctl, rxcsum, psize, srrctl = 0; INIT_DEBUGOUT("igb_initialize_receive_unit: begin"); @@ -3574,38 +3983,70 @@ igb_initialize_receive_units(struct adapter *adapter) * Make sure receives are disabled while setting * up the descriptor ring */ - rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + rctl = E1000_READ_REG(hw, E1000_RCTL); + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + + /* + ** Set up for header split + */ + if (rxr->hdr_split) { + /* Use a standard mbuf for the header */ + srrctl |= IGB_HDR_BUF << E1000_SRRCTL_BSIZEHDRSIZE_SHIFT; + srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS; + } else + srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF; + + /* + ** Set up for jumbo frames + */ + if (ifp->if_mtu > ETHERMTU) { + rctl |= E1000_RCTL_LPE; + if (adapter->rx_mbuf_sz == MJUMPAGESIZE) { + srrctl |= 4096 >> E1000_SRRCTL_BSIZEPKT_SHIFT; + rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX; + } else if (adapter->rx_mbuf_sz > MJUMPAGESIZE) { + srrctl |= 8192 >> E1000_SRRCTL_BSIZEPKT_SHIFT; + rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX; + } + /* Set maximum packet len */ + psize = adapter->max_frame_size; + /* are we on a vlan? */ + if (adapter->ifp->if_vlantrunk != NULL) + psize += VLAN_TAG_SIZE; + E1000_WRITE_REG(&adapter->hw, E1000_RLPML, psize); + } else { + rctl &= ~E1000_RCTL_LPE; + srrctl |= 2048 >> E1000_SRRCTL_BSIZEPKT_SHIFT; + rctl |= E1000_RCTL_SZ_2048; + } /* Setup the Base and Length of the Rx Descriptor Rings */ - for (int i = 0; i < adapter->num_rx_queues; i++, rxr++) { + for (int i = 0; i < adapter->num_queues; i++, rxr++) { u64 bus_addr = rxr->rxdma.dma_paddr; - u32 rxdctl, srrctl; + u32 rxdctl; - E1000_WRITE_REG(&adapter->hw, E1000_RDLEN(i), + E1000_WRITE_REG(hw, E1000_RDLEN(i), adapter->num_rx_desc * sizeof(struct e1000_rx_desc)); - E1000_WRITE_REG(&adapter->hw, E1000_RDBAH(i), + E1000_WRITE_REG(hw, E1000_RDBAH(i), (uint32_t)(bus_addr >> 32)); - E1000_WRITE_REG(&adapter->hw, E1000_RDBAL(i), + E1000_WRITE_REG(hw, E1000_RDBAL(i), (uint32_t)bus_addr); - /* Use Advanced Descriptor type */ - srrctl = E1000_READ_REG(&adapter->hw, E1000_SRRCTL(i)); - srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF; - E1000_WRITE_REG(&adapter->hw, E1000_SRRCTL(i), srrctl); + E1000_WRITE_REG(hw, E1000_SRRCTL(i), srrctl); /* Enable this Queue */ - rxdctl = E1000_READ_REG(&adapter->hw, E1000_RXDCTL(i)); + rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(i)); rxdctl |= E1000_RXDCTL_QUEUE_ENABLE; rxdctl &= 0xFFF00000; rxdctl |= IGB_RX_PTHRESH; rxdctl |= IGB_RX_HTHRESH << 8; rxdctl |= IGB_RX_WTHRESH << 16; - E1000_WRITE_REG(&adapter->hw, E1000_RXDCTL(i), rxdctl); + E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl); } /* ** Setup for RX MultiQueue */ - if (adapter->num_rx_queues >1) { + rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); + if (adapter->num_queues >1) { u32 random[10], mrqc, shift = 0; union igb_reta { u32 dword; @@ -3618,15 +4059,15 @@ igb_initialize_receive_units(struct adapter *adapter) /* Warning FM follows */ for (int i = 0; i < 128; i++) { reta.bytes[i & 3] = - (i % adapter->num_rx_queues) << shift; + (i % adapter->num_queues) << shift; if ((i & 3) == 3) - E1000_WRITE_REG(&adapter->hw, - E1000_RETA(i & ~3), reta.dword); + E1000_WRITE_REG(hw, + E1000_RETA(i >> 2), reta.dword); } /* Now fill in hash table */ mrqc = E1000_MRQC_ENABLE_RSS_4Q; for (int i = 0; i < 10; i++) - E1000_WRITE_REG_ARRAY(&adapter->hw, + E1000_WRITE_REG_ARRAY(hw, E1000_RSSRK(0), i, random[i]); mrqc |= (E1000_MRQC_RSS_FIELD_IPV4 | @@ -3638,7 +4079,7 @@ igb_initialize_receive_units(struct adapter *adapter) mrqc |=( E1000_MRQC_RSS_FIELD_IPV6_UDP_EX | E1000_MRQC_RSS_FIELD_IPV6_TCP_EX); - E1000_WRITE_REG(&adapter->hw, E1000_MRQC, mrqc); + E1000_WRITE_REG(hw, E1000_MRQC, mrqc); /* ** NOTE: Receive Full-Packet Checksum Offload @@ -3646,66 +4087,48 @@ igb_initialize_receive_units(struct adapter *adapter) ** this is not the same as TCP/IP checksums which ** still work. */ - rxcsum = E1000_READ_REG(&adapter->hw, E1000_RXCSUM); rxcsum |= E1000_RXCSUM_PCSD; - E1000_WRITE_REG(&adapter->hw, E1000_RXCSUM, rxcsum); - } else if (ifp->if_capenable & IFCAP_RXCSUM) { - rxcsum = E1000_READ_REG(&adapter->hw, E1000_RXCSUM); - rxcsum |= (E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); - E1000_WRITE_REG(&adapter->hw, E1000_RXCSUM, rxcsum); +#if __FreeBSD_version >= 800000 + /* For SCTP Offload */ + if ((hw->mac.type == e1000_82576) + && (ifp->if_capenable & IFCAP_RXCSUM)) + rxcsum |= E1000_RXCSUM_CRCOFL; +#endif + } else { + /* Non RSS setup */ + if (ifp->if_capenable & IFCAP_RXCSUM) { + rxcsum |= E1000_RXCSUM_IPPCSE; +#if __FreeBSD_version >= 800000 + if (adapter->hw.mac.type == e1000_82576) + rxcsum |= E1000_RXCSUM_CRCOFL; +#endif + } else + rxcsum &= ~E1000_RXCSUM_TUOFL; } + E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); /* Setup the Receive Control Register */ rctl &= ~(3 << E1000_RCTL_MO_SHIFT); rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | - (adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT); - + (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT); + /* Strip CRC bytes. */ + rctl |= E1000_RCTL_SECRC; /* Make sure VLAN Filters are off */ rctl &= ~E1000_RCTL_VFE; - + /* Don't store bad packets */ rctl &= ~E1000_RCTL_SBP; - switch (adapter->rx_buffer_len) { - default: - case 2048: - rctl |= E1000_RCTL_SZ_2048; - break; - case 4096: - rctl |= E1000_RCTL_SZ_4096 | - E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - case 8192: - rctl |= E1000_RCTL_SZ_8192 | - E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - case 16384: - rctl |= E1000_RCTL_SZ_16384 | - E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - } - - if (ifp->if_mtu > ETHERMTU) { - /* Set maximum packet len */ - psize = adapter->max_frame_size; - /* are we on a vlan? */ - if (adapter->ifp->if_vlantrunk != NULL) - psize += VLAN_TAG_SIZE; - E1000_WRITE_REG(&adapter->hw, E1000_RLPML, psize); - rctl |= E1000_RCTL_LPE; - } else - rctl &= ~E1000_RCTL_LPE; - /* Enable Receives */ - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); + E1000_WRITE_REG(hw, E1000_RCTL, rctl); /* * Setup the HW Rx Head and Tail Descriptor Pointers * - needs to be after enable */ - for (int i = 0; i < adapter->num_rx_queues; i++) { - E1000_WRITE_REG(&adapter->hw, E1000_RDH(i), 0); - E1000_WRITE_REG(&adapter->hw, E1000_RDT(i), + for (int i = 0; i < adapter->num_queues; i++) { + E1000_WRITE_REG(hw, E1000_RDH(i), 0); + E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); } return; @@ -3721,7 +4144,7 @@ igb_free_receive_structures(struct adapter *adapter) { struct rx_ring *rxr = adapter->rx_rings; - for (int i = 0; i < adapter->num_rx_queues; i++, rxr++) { + for (int i = 0; i < adapter->num_queues; i++, rxr++) { struct lro_ctrl *lro = &rxr->lro; igb_free_receive_buffers(rxr); tcp_lro_free(lro); @@ -3739,48 +4162,123 @@ igb_free_receive_structures(struct adapter *adapter) static void igb_free_receive_buffers(struct rx_ring *rxr) { - struct adapter *adapter = rxr->adapter; - struct igb_buffer *rx_buffer; + struct adapter *adapter = rxr->adapter; + struct igb_rx_buf *rxbuf; + int i; INIT_DEBUGOUT("free_receive_structures: begin"); - if (rxr->rx_spare_map) { - bus_dmamap_destroy(rxr->rxtag, rxr->rx_spare_map); - rxr->rx_spare_map = NULL; - } - /* Cleanup any existing buffers */ if (rxr->rx_buffers != NULL) { - rx_buffer = &rxr->rx_buffers[0]; - for (int i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) { - if (rx_buffer->m_head != NULL) { - bus_dmamap_sync(rxr->rxtag, rx_buffer->map, + for (i = 0; i < adapter->num_rx_desc; i++) { + rxbuf = &rxr->rx_buffers[i]; + if (rxbuf->m_head != NULL) { + bus_dmamap_sync(rxr->htag, rxbuf->hmap, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->rxtag, - rx_buffer->map); - m_freem(rx_buffer->m_head); - rx_buffer->m_head = NULL; - } else if (rx_buffer->map != NULL) - bus_dmamap_unload(rxr->rxtag, - rx_buffer->map); - if (rx_buffer->map != NULL) { - bus_dmamap_destroy(rxr->rxtag, - rx_buffer->map); - rx_buffer->map = NULL; + bus_dmamap_unload(rxr->htag, rxbuf->hmap); + rxbuf->m_head->m_flags |= M_PKTHDR; + m_freem(rxbuf->m_head); } + if (rxbuf->m_pack != NULL) { + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->ptag, rxbuf->pmap); + rxbuf->m_pack->m_flags |= M_PKTHDR; + m_freem(rxbuf->m_pack); + } + rxbuf->m_head = NULL; + rxbuf->m_pack = NULL; + if (rxbuf->hmap != NULL) { + bus_dmamap_destroy(rxr->htag, rxbuf->hmap); + rxbuf->hmap = NULL; + } + if (rxbuf->pmap != NULL) { + bus_dmamap_destroy(rxr->ptag, rxbuf->pmap); + rxbuf->pmap = NULL; + } + } + if (rxr->rx_buffers != NULL) { + free(rxr->rx_buffers, M_DEVBUF); + rxr->rx_buffers = NULL; } } - if (rxr->rx_buffers != NULL) { - free(rxr->rx_buffers, M_DEVBUF); - rxr->rx_buffers = NULL; + if (rxr->htag != NULL) { + bus_dma_tag_destroy(rxr->htag); + rxr->htag = NULL; } - - if (rxr->rxtag != NULL) { - bus_dma_tag_destroy(rxr->rxtag); - rxr->rxtag = NULL; + if (rxr->ptag != NULL) { + bus_dma_tag_destroy(rxr->ptag); + rxr->ptag = NULL; } } + +static __inline void +igb_rx_discard(struct rx_ring *rxr, int i) +{ + struct igb_rx_buf *rbuf; + + rbuf = &rxr->rx_buffers[i]; + + /* Partially received? Free the chain */ + if (rxr->fmp != NULL) { + rxr->fmp->m_flags |= M_PKTHDR; + m_freem(rxr->fmp); + rxr->fmp = NULL; + rxr->lmp = NULL; + } + + /* + ** With advanced descriptors the writeback + ** clobbers the buffer addrs, so its easier + ** to just free the existing mbufs and take + ** the normal refresh path to get new buffers + ** and mapping. + */ + if (rbuf->m_head) { + m_free(rbuf->m_head); + rbuf->m_head = NULL; + } + + if (rbuf->m_pack) { + m_free(rbuf->m_pack); + rbuf->m_pack = NULL; + } + + return; +} + +static __inline void +igb_rx_input(struct rx_ring *rxr, struct ifnet *ifp, struct mbuf *m, u32 ptype) +{ + + /* + * ATM LRO is only for IPv4/TCP packets and TCP checksum of the packet + * should be computed by hardware. Also it should not have VLAN tag in + * ethernet header. + */ + if (rxr->lro_enabled && + (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + (ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & (E1000_RXDADV_PKTTYPE_IPV4 | E1000_RXDADV_PKTTYPE_TCP)) == + (E1000_RXDADV_PKTTYPE_IPV4 | E1000_RXDADV_PKTTYPE_TCP) && + (m->m_pkthdr.csum_flags & (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) == + (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) { + /* + * Send to the stack if: + ** - LRO not enabled, or + ** - no LRO resources, or + ** - lro enqueue fails + */ + if (rxr->lro.lro_cnt != 0) + if (tcp_lro_rx(&rxr->lro, m, 0) == 0) + return; + } + IGB_RX_UNLOCK(rxr); + (*ifp->if_input)(ifp, m); + IGB_RX_LOCK(rxr); +} + /********************************************************************* * * This routine executes in interrupt context. It replenishes @@ -3790,246 +4288,209 @@ igb_free_receive_buffers(struct rx_ring *rxr) * We loop at most count times if count is > 0, or until done if * count < 0. * - * Return TRUE if all clean, FALSE otherwise + * Return TRUE if more to clean, FALSE otherwise *********************************************************************/ static bool -igb_rxeof(struct rx_ring *rxr, int count) +igb_rxeof(struct igb_queue *que, int count, int *done) { - struct adapter *adapter = rxr->adapter; - struct ifnet *ifp; + struct adapter *adapter = que->adapter; + struct rx_ring *rxr = que->rxr; + struct ifnet *ifp = adapter->ifp; struct lro_ctrl *lro = &rxr->lro; struct lro_entry *queued; - struct mbuf *mp; - uint8_t accept_frame = 0; - uint8_t eop = 0; - uint16_t len, desc_len, prev_len_adj; - int i; - u32 staterr; + int i, processed = 0, rxdone = 0; + u32 ptype, staterr = 0; union e1000_adv_rx_desc *cur; IGB_RX_LOCK(rxr); - ifp = adapter->ifp; - i = rxr->next_to_check; - cur = &rxr->rx_base[i]; - staterr = cur->wb.upper.status_error; - + /* Sync the ring. */ bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - if (!(staterr & E1000_RXD_STAT_DD)) { - IGB_RX_UNLOCK(rxr); - return FALSE; - } - - while ((staterr & E1000_RXD_STAT_DD) && - (count != 0) && - (ifp->if_drv_flags & IFF_DRV_RUNNING)) { - struct mbuf *m = NULL; - - mp = rxr->rx_buffers[i].m_head; - /* - * Can't defer bus_dmamap_sync(9) because TBI_ACCEPT - * needs to access the last received byte in the mbuf. - */ - bus_dmamap_sync(rxr->rxtag, rxr->rx_buffers[i].map, - BUS_DMASYNC_POSTREAD); - - accept_frame = 1; - prev_len_adj = 0; - desc_len = le16toh(cur->wb.upper.length); - if (staterr & E1000_RXD_STAT_EOP) { - count--; - eop = 1; - if (desc_len < ETHER_CRC_LEN) { - len = 0; - prev_len_adj = ETHER_CRC_LEN - desc_len; - } else - len = desc_len - ETHER_CRC_LEN; - } else { - eop = 0; - len = desc_len; - } - - if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) { - u32 pkt_len = desc_len; - - if (rxr->fmp != NULL) - pkt_len += rxr->fmp->m_pkthdr.len; - - accept_frame = 0; - } - - if (accept_frame) { - if (igb_get_buf(rxr, i) != 0) { - ifp->if_iqdrops++; - goto discard; - } - - /* Assign correct length to the current fragment */ - mp->m_len = len; - - if (rxr->fmp == NULL) { - mp->m_pkthdr.len = len; - rxr->fmp = mp; /* Store the first mbuf */ - rxr->lmp = mp; - } else { - /* Chain mbuf's together */ - mp->m_flags &= ~M_PKTHDR; - /* - * Adjust length of previous mbuf in chain if - * we received less than 4 bytes in the last - * descriptor. - */ - if (prev_len_adj > 0) { - rxr->lmp->m_len -= prev_len_adj; - rxr->fmp->m_pkthdr.len -= - prev_len_adj; - } - rxr->lmp->m_next = mp; - rxr->lmp = rxr->lmp->m_next; - rxr->fmp->m_pkthdr.len += len; - } - - if (eop) { - rxr->fmp->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; - rxr->rx_packets++; - rxr->bytes += rxr->fmp->m_pkthdr.len; - rxr->rx_bytes += rxr->bytes; - - igb_rx_checksum(staterr, rxr->fmp); -#ifndef __NO_STRICT_ALIGNMENT - if (adapter->max_frame_size > - (MCLBYTES - ETHER_ALIGN) && - igb_fixup_rx(rxr) != 0) - goto skip; -#endif - if (staterr & E1000_RXD_STAT_VP) { - rxr->fmp->m_pkthdr.ether_vtag = - le16toh(cur->wb.upper.vlan); - rxr->fmp->m_flags |= M_VLANTAG; - } -#ifndef __NO_STRICT_ALIGNMENT -skip: -#endif - m = rxr->fmp; - rxr->fmp = NULL; - rxr->lmp = NULL; - } - } else { - ifp->if_ierrors++; -discard: - /* Reuse loaded DMA map and just update mbuf chain */ - mp = rxr->rx_buffers[i].m_head; - mp->m_len = mp->m_pkthdr.len = MCLBYTES; - mp->m_data = mp->m_ext.ext_buf; - mp->m_next = NULL; - if (adapter->max_frame_size <= - (MCLBYTES - ETHER_ALIGN)) - m_adj(mp, ETHER_ALIGN); - if (rxr->fmp != NULL) { - m_freem(rxr->fmp); - rxr->fmp = NULL; - rxr->lmp = NULL; - } - m = NULL; - } - - /* Zero out the receive descriptors status. */ + /* Main clean loop */ + for (i = rxr->next_to_check; count != 0;) { + struct mbuf *sendmp, *mh, *mp; + struct igb_rx_buf *rxbuf; + u16 hlen, plen, hdr, vtag; + bool eop = FALSE; + + cur = &rxr->rx_base[i]; + staterr = le32toh(cur->wb.upper.status_error); + if ((staterr & E1000_RXD_STAT_DD) == 0) + break; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; + count--; + sendmp = mh = mp = NULL; cur->wb.upper.status_error = 0; + rxbuf = &rxr->rx_buffers[i]; + plen = le16toh(cur->wb.upper.length); + ptype = le32toh(cur->wb.lower.lo_dword.data) & IGB_PKTTYPE_MASK; + vtag = le16toh(cur->wb.upper.vlan); + hdr = le16toh(cur->wb.lower.lo_dword.hs_rss.hdr_info); + eop = ((staterr & E1000_RXD_STAT_EOP) == E1000_RXD_STAT_EOP); + + /* Make sure all segments of a bad packet are discarded */ + if (((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) != 0) || + (rxr->discard)) { + ifp->if_ierrors++; + ++rxr->rx_discarded; + if (!eop) /* Catch subsequent segs */ + rxr->discard = TRUE; + else + rxr->discard = FALSE; + igb_rx_discard(rxr, i); + goto next_desc; + } + + /* + ** The way the hardware is configured to + ** split, it will ONLY use the header buffer + ** when header split is enabled, otherwise we + ** get normal behavior, ie, both header and + ** payload are DMA'd into the payload buffer. + ** + ** The fmp test is to catch the case where a + ** packet spans multiple descriptors, in that + ** case only the first header is valid. + */ + if (rxr->hdr_split && rxr->fmp == NULL) { + hlen = (hdr & E1000_RXDADV_HDRBUFLEN_MASK) >> + E1000_RXDADV_HDRBUFLEN_SHIFT; + if (hlen > IGB_HDR_BUF) + hlen = IGB_HDR_BUF; + mh = rxr->rx_buffers[i].m_head; + mh->m_len = hlen; + /* clear buf pointer for refresh */ + rxbuf->m_head = NULL; + /* + ** Get the payload length, this + ** could be zero if its a small + ** packet. + */ + if (plen > 0) { + mp = rxr->rx_buffers[i].m_pack; + mp->m_len = plen; + mh->m_next = mp; + /* clear buf pointer */ + rxbuf->m_pack = NULL; + rxr->rx_split_packets++; + } + } else { + /* + ** Either no header split, or a + ** secondary piece of a fragmented + ** split packet. + */ + mh = rxr->rx_buffers[i].m_pack; + mh->m_len = plen; + /* clear buf info for refresh */ + rxbuf->m_pack = NULL; + } + + ++processed; /* So we know when to refresh */ + + /* Initial frame - setup */ + if (rxr->fmp == NULL) { + mh->m_pkthdr.len = mh->m_len; + /* Save the head of the chain */ + rxr->fmp = mh; + rxr->lmp = mh; + if (mp != NULL) { + /* Add payload if split */ + mh->m_pkthdr.len += mp->m_len; + rxr->lmp = mh->m_next; + } + } else { + /* Chain mbuf's together */ + rxr->lmp->m_next = mh; + rxr->lmp = rxr->lmp->m_next; + rxr->fmp->m_pkthdr.len += mh->m_len; + } + + if (eop) { + rxr->fmp->m_pkthdr.rcvif = ifp; + ifp->if_ipackets++; + rxr->rx_packets++; + /* capture data for AIM */ + rxr->packets++; + rxr->bytes += rxr->fmp->m_pkthdr.len; + rxr->rx_bytes += rxr->fmp->m_pkthdr.len; + + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + igb_rx_checksum(staterr, rxr->fmp, ptype); + + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + (staterr & E1000_RXD_STAT_VP) != 0) { + rxr->fmp->m_pkthdr.ether_vtag = vtag; + rxr->fmp->m_flags |= M_VLANTAG; + } +#if __FreeBSD_version >= 800000 + rxr->fmp->m_pkthdr.flowid = que->msix; + rxr->fmp->m_flags |= M_FLOWID; +#endif + sendmp = rxr->fmp; + /* Make sure to set M_PKTHDR. */ + sendmp->m_flags |= M_PKTHDR; + rxr->fmp = NULL; + rxr->lmp = NULL; + } + +next_desc: bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - rxr->last_cleaned = i; /* For updating tail */ - /* Advance our pointers to the next descriptor. */ if (++i == adapter->num_rx_desc) i = 0; - - if (m != NULL) { + /* + ** Send to the stack or LRO + */ + if (sendmp != NULL) { rxr->next_to_check = i; - /* Use LRO if possible */ - if ((!lro->lro_cnt) || (tcp_lro_rx(lro, m, 0))) { - /* Pass up to the stack */ - (*ifp->if_input)(ifp, m); - i = rxr->next_to_check; - } + igb_rx_input(rxr, ifp, sendmp, ptype); + i = rxr->next_to_check; + rxdone++; } - /* Get the next descriptor */ - cur = &rxr->rx_base[i]; - staterr = cur->wb.upper.status_error; - } - rxr->next_to_check = i; - /* Advance the E1000's Receive Queue #0 "Tail Pointer". */ - E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), rxr->last_cleaned); + /* Every 8 descriptors we go to refresh mbufs */ + if (processed == 8) { + igb_refresh_mbufs(rxr, i); + processed = 0; + } + } + + /* Catch any remainders */ + if (processed != 0) { + igb_refresh_mbufs(rxr, i); + processed = 0; + } + + rxr->next_to_check = i; /* * Flush any outstanding LRO work */ - while (!SLIST_EMPTY(&lro->lro_active)) { - queued = SLIST_FIRST(&lro->lro_active); + while ((queued = SLIST_FIRST(&lro->lro_active)) != NULL) { SLIST_REMOVE_HEAD(&lro->lro_active, next); tcp_lro_flush(lro, queued); } IGB_RX_UNLOCK(rxr); - if (!((staterr) & E1000_RXD_STAT_DD)) - return FALSE; + if (done != NULL) + *done = rxdone; - return TRUE; + /* + ** We still have cleaning to do? + ** Schedule another interrupt if so. + */ + if ((staterr & E1000_RXD_STAT_DD) != 0) + return (TRUE); + + return (FALSE); } -#ifndef __NO_STRICT_ALIGNMENT -/* - * When jumbo frames are enabled we should realign entire payload on - * architecures with strict alignment. This is serious design mistake of 8254x - * as it nullifies DMA operations. 8254x just allows RX buffer size to be - * 2048/4096/8192/16384. What we really want is 2048 - ETHER_ALIGN to align its - * payload. On architecures without strict alignment restrictions 8254x still - * performs unaligned memory access which would reduce the performance too. - * To avoid copying over an entire frame to align, we allocate a new mbuf and - * copy ethernet header to the new mbuf. The new mbuf is prepended into the - * existing mbuf chain. - * - * Be aware, best performance of the 8254x is achived only when jumbo frame is - * not used at all on architectures with strict alignment. - */ -static int -igb_fixup_rx(struct rx_ring *rxr) -{ - struct adapter *adapter = rxr->adapter; - struct mbuf *m, *n; - int error; - - error = 0; - m = rxr->fmp; - if (m->m_len <= (MCLBYTES - ETHER_HDR_LEN)) { - bcopy(m->m_data, m->m_data + ETHER_HDR_LEN, m->m_len); - m->m_data += ETHER_HDR_LEN; - } else { - MGETHDR(n, M_DONTWAIT, MT_DATA); - if (n != NULL) { - bcopy(m->m_data, n->m_data, ETHER_HDR_LEN); - m->m_data += ETHER_HDR_LEN; - m->m_len -= ETHER_HDR_LEN; - n->m_len = ETHER_HDR_LEN; - M_MOVE_PKTHDR(n, m); - n->m_next = m; - rxr->fmp = n; - } else { - adapter->dropped_pkts++; - m_freem(rxr->fmp); - rxr->fmp = NULL; - error = ENOMEM; - } - } - - return (error); -} -#endif - /********************************************************************* * * Verify that the hardware indicated that the checksum is valid. @@ -4038,10 +4499,11 @@ igb_fixup_rx(struct rx_ring *rxr) * *********************************************************************/ static void -igb_rx_checksum(u32 staterr, struct mbuf *mp) +igb_rx_checksum(u32 staterr, struct mbuf *mp, u32 ptype) { u16 status = (u16)staterr; u8 errors = (u8) (staterr >> 24); + int sctp; /* Ignore Checksum bit is set */ if (status & E1000_RXD_STAT_IXSM) { @@ -4049,63 +4511,62 @@ igb_rx_checksum(u32 staterr, struct mbuf *mp) return; } + if ((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0) + sctp = 1; + else + sctp = 0; if (status & E1000_RXD_STAT_IPCS) { /* Did it pass? */ if (!(errors & E1000_RXD_ERR_IPE)) { /* IP Checksum Good */ mp->m_pkthdr.csum_flags = CSUM_IP_CHECKED; mp->m_pkthdr.csum_flags |= CSUM_IP_VALID; - } else mp->m_pkthdr.csum_flags = 0; } - if (status & E1000_RXD_STAT_TCPCS) { + if (status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)) { + u16 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); +#if __FreeBSD_version >= 800000 + if (sctp) /* reassign */ + type = CSUM_SCTP_VALID; +#endif /* Did it pass? */ if (!(errors & E1000_RXD_ERR_TCPE)) { - mp->m_pkthdr.csum_flags |= - (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); - mp->m_pkthdr.csum_data = htons(0xffff); + mp->m_pkthdr.csum_flags |= type; + if (sctp == 0) + mp->m_pkthdr.csum_data = htons(0xffff); } } return; } -#ifdef IGB_HW_VLAN_SUPPORT /* * This routine is run via an vlan * config EVENT */ static void -igb_register_vlan(void *unused, struct ifnet *ifp, u16 vtag) +igb_register_vlan(void *arg, struct ifnet *ifp, u16 vtag) { struct adapter *adapter = ifp->if_softc; - u32 ctrl, rctl, index, vfta; + u32 index, bit; - /* Shouldn't happen */ - if ((ifp->if_capenable & IFCAP_VLAN_HWFILTER) == 0) + if (ifp->if_softc != arg) /* Not our event */ return; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - - /* Setup for Hardware Filter */ - rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); - rctl |= E1000_RCTL_VFE; - rctl &= ~E1000_RCTL_CFIEN; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); - - /* Make entry in the hardware filter table */ - index = ((vtag >> 5) & 0x7F); - vfta = E1000_READ_REG_ARRAY(&adapter->hw, E1000_VFTA, index); - vfta |= (1 << (vtag & 0x1F)); - E1000_WRITE_REG_ARRAY(&adapter->hw, E1000_VFTA, index, vfta); - - /* Update the frame size */ - E1000_WRITE_REG(&adapter->hw, E1000_RLPML, - adapter->max_frame_size + VLAN_TAG_SIZE); + if ((vtag == 0) || (vtag > 4095)) /* Invalid */ + return; + IGB_CORE_LOCK(adapter); + index = (vtag >> 5) & 0x7F; + bit = vtag & 0x1F; + adapter->shadow_vfta[index] |= (1 << bit); + ++adapter->num_vlans; + /* Re-init to load the changes */ + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + igb_init_locked(adapter); + IGB_CORE_UNLOCK(adapter); } /* @@ -4113,34 +4574,76 @@ igb_register_vlan(void *unused, struct ifnet *ifp, u16 vtag) * unconfig EVENT */ static void -igb_unregister_vlan(void *unused, struct ifnet *ifp, u16 vtag) +igb_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag) { struct adapter *adapter = ifp->if_softc; - u32 index, vfta; + u32 index, bit; - /* Shouldn't happen */ - if ((ifp->if_capenable & IFCAP_VLAN_HWFILTER) == 0) + if (ifp->if_softc != arg) return; - /* Remove entry in the hardware filter table */ - index = ((vtag >> 5) & 0x7F); - vfta = E1000_READ_REG_ARRAY(&adapter->hw, E1000_VFTA, index); - vfta &= ~(1 << (vtag & 0x1F)); - E1000_WRITE_REG_ARRAY(&adapter->hw, E1000_VFTA, index, vfta); - /* Have all vlans unregistered? */ - if (adapter->ifp->if_vlantrunk == NULL) { - u32 rctl; - /* Turn off the filter table */ - rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); - rctl &= ~E1000_RCTL_VFE; - rctl |= E1000_RCTL_CFIEN; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); - /* Reset the frame size */ + if ((vtag == 0) || (vtag > 4095)) /* Invalid */ + return; + + IGB_CORE_LOCK(adapter); + index = (vtag >> 5) & 0x7F; + bit = vtag & 0x1F; + adapter->shadow_vfta[index] &= ~(1 << bit); + --adapter->num_vlans; + /* Re-init to load the changes */ + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + igb_init_locked(adapter); + IGB_CORE_UNLOCK(adapter); +} + +static void +igb_setup_vlan_hw_support(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + + /* + ** We get here thru init_locked, meaning + ** a soft reset, this has already cleared + ** the VFTA and other state, so if there + ** have been no vlan's registered do nothing. + */ + if (adapter->num_vlans == 0) + return; + + /* + ** A soft reset zero's out the VFTA, so + ** we need to repopulate it now. + */ + for (int i = 0; i < IGB_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) { + if (hw->mac.type == e1000_vfadapt) + e1000_vfta_set_vf(hw, + adapter->shadow_vfta[i], TRUE); + else + E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, + i, adapter->shadow_vfta[i]); + } + + if (hw->mac.type == e1000_vfadapt) + e1000_rlpml_set_vf(hw, + adapter->max_frame_size + VLAN_TAG_SIZE); + else { + reg = E1000_READ_REG(hw, E1000_CTRL); + reg |= E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + + /* Enable the Filter Table */ + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~E1000_RCTL_CFIEN; + reg |= E1000_RCTL_VFE; + E1000_WRITE_REG(hw, E1000_RCTL, reg); + + /* Update the frame size */ E1000_WRITE_REG(&adapter->hw, E1000_RLPML, - adapter->max_frame_size); + adapter->max_frame_size + VLAN_TAG_SIZE); } } -#endif /* IGB_HW_VLAN_SUPPORT */ static void igb_enable_intr(struct adapter *adapter) @@ -4184,8 +4687,6 @@ igb_disable_intr(struct adapter *adapter) static void igb_init_manageability(struct adapter *adapter) { - /* A shared code workaround */ -#define E1000_82542_MANC2H E1000_MANC2H if (adapter->has_manage) { int manc2h = E1000_READ_REG(&adapter->hw, E1000_MANC2H); int manc = E1000_READ_REG(&adapter->hw, E1000_MANC); @@ -4195,12 +4696,9 @@ igb_init_manageability(struct adapter *adapter) /* enable receiving management packets to the host */ manc |= E1000_MANC_EN_MNG2HOST; -#define E1000_MNG2HOST_PORT_623 (1 << 5) -#define E1000_MNG2HOST_PORT_664 (1 << 6) - manc2h |= E1000_MNG2HOST_PORT_623; - manc2h |= E1000_MNG2HOST_PORT_664; + manc2h |= 1 << 5; /* Mng Port 623 */ + manc2h |= 1 << 6; /* Mng Port 664 */ E1000_WRITE_REG(&adapter->hw, E1000_MANC2H, manc2h); - E1000_WRITE_REG(&adapter->hw, E1000_MANC, manc); } } @@ -4234,6 +4732,9 @@ igb_get_hw_control(struct adapter *adapter) { u32 ctrl_ext; + if (adapter->hw.mac.type == e1000_vfadapt) + return; + /* Let firmware know the driver has taken over */ ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, @@ -4251,6 +4752,9 @@ igb_release_hw_control(struct adapter *adapter) { u32 ctrl_ext; + if (adapter->hw.mac.type == e1000_vfadapt) + return; + /* Let firmware taken over control of h/w */ ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, @@ -4273,7 +4777,7 @@ igb_is_valid_ether_addr(uint8_t *addr) /* * Enable PCI Wake On Lan capability */ -void +static void igb_enable_wakeup(device_t dev) { u16 cap, status; @@ -4294,6 +4798,21 @@ igb_enable_wakeup(device_t dev) return; } +static void +igb_led_func(void *arg, int onoff) +{ + struct adapter *adapter = arg; + + IGB_CORE_LOCK(adapter); + if (onoff) { + e1000_setup_led(&adapter->hw); + e1000_led_on(&adapter->hw); + } else { + e1000_led_off(&adapter->hw); + e1000_cleanup_led(&adapter->hw); + } + IGB_CORE_UNLOCK(adapter); +} /********************************************************************** * @@ -4303,219 +4822,619 @@ igb_enable_wakeup(device_t dev) static void igb_update_stats_counters(struct adapter *adapter) { - struct ifnet *ifp; + struct ifnet *ifp; + struct e1000_hw *hw = &adapter->hw; + struct e1000_hw_stats *stats; + + /* + ** The virtual function adapter has only a + ** small controlled set of stats, do only + ** those and return. + */ + if (adapter->hw.mac.type == e1000_vfadapt) { + igb_update_vf_stats_counters(adapter); + return; + } + + stats = (struct e1000_hw_stats *)adapter->stats; if(adapter->hw.phy.media_type == e1000_media_type_copper || - (E1000_READ_REG(&adapter->hw, E1000_STATUS) & E1000_STATUS_LU)) { - adapter->stats.symerrs += E1000_READ_REG(&adapter->hw, E1000_SYMERRS); - adapter->stats.sec += E1000_READ_REG(&adapter->hw, E1000_SEC); + (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) { + stats->symerrs += + E1000_READ_REG(hw,E1000_SYMERRS); + stats->sec += E1000_READ_REG(hw, E1000_SEC); } - adapter->stats.crcerrs += E1000_READ_REG(&adapter->hw, E1000_CRCERRS); - adapter->stats.mpc += E1000_READ_REG(&adapter->hw, E1000_MPC); - adapter->stats.scc += E1000_READ_REG(&adapter->hw, E1000_SCC); - adapter->stats.ecol += E1000_READ_REG(&adapter->hw, E1000_ECOL); - adapter->stats.mcc += E1000_READ_REG(&adapter->hw, E1000_MCC); - adapter->stats.latecol += E1000_READ_REG(&adapter->hw, E1000_LATECOL); - adapter->stats.colc += E1000_READ_REG(&adapter->hw, E1000_COLC); - adapter->stats.dc += E1000_READ_REG(&adapter->hw, E1000_DC); - adapter->stats.rlec += E1000_READ_REG(&adapter->hw, E1000_RLEC); - adapter->stats.xonrxc += E1000_READ_REG(&adapter->hw, E1000_XONRXC); - adapter->stats.xontxc += E1000_READ_REG(&adapter->hw, E1000_XONTXC); - adapter->stats.xoffrxc += E1000_READ_REG(&adapter->hw, E1000_XOFFRXC); - adapter->stats.xofftxc += E1000_READ_REG(&adapter->hw, E1000_XOFFTXC); - adapter->stats.fcruc += E1000_READ_REG(&adapter->hw, E1000_FCRUC); - adapter->stats.prc64 += E1000_READ_REG(&adapter->hw, E1000_PRC64); - adapter->stats.prc127 += E1000_READ_REG(&adapter->hw, E1000_PRC127); - adapter->stats.prc255 += E1000_READ_REG(&adapter->hw, E1000_PRC255); - adapter->stats.prc511 += E1000_READ_REG(&adapter->hw, E1000_PRC511); - adapter->stats.prc1023 += E1000_READ_REG(&adapter->hw, E1000_PRC1023); - adapter->stats.prc1522 += E1000_READ_REG(&adapter->hw, E1000_PRC1522); - adapter->stats.gprc += E1000_READ_REG(&adapter->hw, E1000_GPRC); - adapter->stats.bprc += E1000_READ_REG(&adapter->hw, E1000_BPRC); - adapter->stats.mprc += E1000_READ_REG(&adapter->hw, E1000_MPRC); - adapter->stats.gptc += E1000_READ_REG(&adapter->hw, E1000_GPTC); + stats->crcerrs += E1000_READ_REG(hw, E1000_CRCERRS); + stats->mpc += E1000_READ_REG(hw, E1000_MPC); + stats->scc += E1000_READ_REG(hw, E1000_SCC); + stats->ecol += E1000_READ_REG(hw, E1000_ECOL); + + stats->mcc += E1000_READ_REG(hw, E1000_MCC); + stats->latecol += E1000_READ_REG(hw, E1000_LATECOL); + stats->colc += E1000_READ_REG(hw, E1000_COLC); + stats->dc += E1000_READ_REG(hw, E1000_DC); + stats->rlec += E1000_READ_REG(hw, E1000_RLEC); + stats->xonrxc += E1000_READ_REG(hw, E1000_XONRXC); + stats->xontxc += E1000_READ_REG(hw, E1000_XONTXC); + /* + ** For watchdog management we need to know if we have been + ** paused during the last interval, so capture that here. + */ + adapter->pause_frames = E1000_READ_REG(&adapter->hw, E1000_XOFFRXC); + stats->xoffrxc += adapter->pause_frames; + stats->xofftxc += E1000_READ_REG(hw, E1000_XOFFTXC); + stats->fcruc += E1000_READ_REG(hw, E1000_FCRUC); + stats->prc64 += E1000_READ_REG(hw, E1000_PRC64); + stats->prc127 += E1000_READ_REG(hw, E1000_PRC127); + stats->prc255 += E1000_READ_REG(hw, E1000_PRC255); + stats->prc511 += E1000_READ_REG(hw, E1000_PRC511); + stats->prc1023 += E1000_READ_REG(hw, E1000_PRC1023); + stats->prc1522 += E1000_READ_REG(hw, E1000_PRC1522); + stats->gprc += E1000_READ_REG(hw, E1000_GPRC); + stats->bprc += E1000_READ_REG(hw, E1000_BPRC); + stats->mprc += E1000_READ_REG(hw, E1000_MPRC); + stats->gptc += E1000_READ_REG(hw, E1000_GPTC); /* For the 64-bit byte counters the low dword must be read first. */ /* Both registers clear on the read of the high dword */ - adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCH); - adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCH); + stats->gorc += E1000_READ_REG(hw, E1000_GORCL) + + ((u64)E1000_READ_REG(hw, E1000_GORCH) << 32); + stats->gotc += E1000_READ_REG(hw, E1000_GOTCL) + + ((u64)E1000_READ_REG(hw, E1000_GOTCH) << 32); - adapter->stats.rnbc += E1000_READ_REG(&adapter->hw, E1000_RNBC); - adapter->stats.ruc += E1000_READ_REG(&adapter->hw, E1000_RUC); - adapter->stats.rfc += E1000_READ_REG(&adapter->hw, E1000_RFC); - adapter->stats.roc += E1000_READ_REG(&adapter->hw, E1000_ROC); - adapter->stats.rjc += E1000_READ_REG(&adapter->hw, E1000_RJC); + stats->rnbc += E1000_READ_REG(hw, E1000_RNBC); + stats->ruc += E1000_READ_REG(hw, E1000_RUC); + stats->rfc += E1000_READ_REG(hw, E1000_RFC); + stats->roc += E1000_READ_REG(hw, E1000_ROC); + stats->rjc += E1000_READ_REG(hw, E1000_RJC); - adapter->stats.tor += E1000_READ_REG(&adapter->hw, E1000_TORH); - adapter->stats.tot += E1000_READ_REG(&adapter->hw, E1000_TOTH); + stats->tor += E1000_READ_REG(hw, E1000_TORH); + stats->tot += E1000_READ_REG(hw, E1000_TOTH); - adapter->stats.tpr += E1000_READ_REG(&adapter->hw, E1000_TPR); - adapter->stats.tpt += E1000_READ_REG(&adapter->hw, E1000_TPT); - adapter->stats.ptc64 += E1000_READ_REG(&adapter->hw, E1000_PTC64); - adapter->stats.ptc127 += E1000_READ_REG(&adapter->hw, E1000_PTC127); - adapter->stats.ptc255 += E1000_READ_REG(&adapter->hw, E1000_PTC255); - adapter->stats.ptc511 += E1000_READ_REG(&adapter->hw, E1000_PTC511); - adapter->stats.ptc1023 += E1000_READ_REG(&adapter->hw, E1000_PTC1023); - adapter->stats.ptc1522 += E1000_READ_REG(&adapter->hw, E1000_PTC1522); - adapter->stats.mptc += E1000_READ_REG(&adapter->hw, E1000_MPTC); - adapter->stats.bptc += E1000_READ_REG(&adapter->hw, E1000_BPTC); + stats->tpr += E1000_READ_REG(hw, E1000_TPR); + stats->tpt += E1000_READ_REG(hw, E1000_TPT); + stats->ptc64 += E1000_READ_REG(hw, E1000_PTC64); + stats->ptc127 += E1000_READ_REG(hw, E1000_PTC127); + stats->ptc255 += E1000_READ_REG(hw, E1000_PTC255); + stats->ptc511 += E1000_READ_REG(hw, E1000_PTC511); + stats->ptc1023 += E1000_READ_REG(hw, E1000_PTC1023); + stats->ptc1522 += E1000_READ_REG(hw, E1000_PTC1522); + stats->mptc += E1000_READ_REG(hw, E1000_MPTC); + stats->bptc += E1000_READ_REG(hw, E1000_BPTC); + + /* Interrupt Counts */ + + stats->iac += E1000_READ_REG(hw, E1000_IAC); + stats->icrxptc += E1000_READ_REG(hw, E1000_ICRXPTC); + stats->icrxatc += E1000_READ_REG(hw, E1000_ICRXATC); + stats->ictxptc += E1000_READ_REG(hw, E1000_ICTXPTC); + stats->ictxatc += E1000_READ_REG(hw, E1000_ICTXATC); + stats->ictxqec += E1000_READ_REG(hw, E1000_ICTXQEC); + stats->ictxqmtc += E1000_READ_REG(hw, E1000_ICTXQMTC); + stats->icrxdmtc += E1000_READ_REG(hw, E1000_ICRXDMTC); + stats->icrxoc += E1000_READ_REG(hw, E1000_ICRXOC); + + /* Host to Card Statistics */ + + stats->cbtmpc += E1000_READ_REG(hw, E1000_CBTMPC); + stats->htdpmc += E1000_READ_REG(hw, E1000_HTDPMC); + stats->cbrdpc += E1000_READ_REG(hw, E1000_CBRDPC); + stats->cbrmpc += E1000_READ_REG(hw, E1000_CBRMPC); + stats->rpthc += E1000_READ_REG(hw, E1000_RPTHC); + stats->hgptc += E1000_READ_REG(hw, E1000_HGPTC); + stats->htcbdpc += E1000_READ_REG(hw, E1000_HTCBDPC); + stats->hgorc += (E1000_READ_REG(hw, E1000_HGORCL) + + ((u64)E1000_READ_REG(hw, E1000_HGORCH) << 32)); + stats->hgotc += (E1000_READ_REG(hw, E1000_HGOTCL) + + ((u64)E1000_READ_REG(hw, E1000_HGOTCH) << 32)); + stats->lenerrs += E1000_READ_REG(hw, E1000_LENERRS); + stats->scvpc += E1000_READ_REG(hw, E1000_SCVPC); + stats->hrmpc += E1000_READ_REG(hw, E1000_HRMPC); + + stats->algnerrc += E1000_READ_REG(hw, E1000_ALGNERRC); + stats->rxerrc += E1000_READ_REG(hw, E1000_RXERRC); + stats->tncrs += E1000_READ_REG(hw, E1000_TNCRS); + stats->cexterr += E1000_READ_REG(hw, E1000_CEXTERR); + stats->tsctc += E1000_READ_REG(hw, E1000_TSCTC); + stats->tsctfc += E1000_READ_REG(hw, E1000_TSCTFC); - adapter->stats.algnerrc += - E1000_READ_REG(&adapter->hw, E1000_ALGNERRC); - adapter->stats.rxerrc += - E1000_READ_REG(&adapter->hw, E1000_RXERRC); - adapter->stats.tncrs += - E1000_READ_REG(&adapter->hw, E1000_TNCRS); - adapter->stats.cexterr += - E1000_READ_REG(&adapter->hw, E1000_CEXTERR); - adapter->stats.tsctc += - E1000_READ_REG(&adapter->hw, E1000_TSCTC); - adapter->stats.tsctfc += - E1000_READ_REG(&adapter->hw, E1000_TSCTFC); ifp = adapter->ifp; - - ifp->if_collisions = adapter->stats.colc; + ifp->if_collisions = stats->colc; /* Rx Errors */ - ifp->if_ierrors = adapter->dropped_pkts + adapter->stats.rxerrc + - adapter->stats.crcerrs + adapter->stats.algnerrc + - adapter->stats.ruc + adapter->stats.roc + - adapter->stats.mpc + adapter->stats.cexterr; + ifp->if_ierrors = adapter->dropped_pkts + stats->rxerrc + + stats->crcerrs + stats->algnerrc + + stats->ruc + stats->roc + stats->mpc + stats->cexterr; /* Tx Errors */ - ifp->if_oerrors = adapter->stats.ecol + - adapter->stats.latecol + adapter->watchdog_events; + ifp->if_oerrors = stats->ecol + + stats->latecol + adapter->watchdog_events; + + /* Driver specific counters */ + adapter->device_control = E1000_READ_REG(hw, E1000_CTRL); + adapter->rx_control = E1000_READ_REG(hw, E1000_RCTL); + adapter->int_mask = E1000_READ_REG(hw, E1000_IMS); + adapter->eint_mask = E1000_READ_REG(hw, E1000_EIMS); + adapter->packet_buf_alloc_tx = + ((E1000_READ_REG(hw, E1000_PBA) & 0xffff0000) >> 16); + adapter->packet_buf_alloc_rx = + (E1000_READ_REG(hw, E1000_PBA) & 0xffff); } /********************************************************************** * - * This routine is called only when igb_display_debug_stats is enabled. - * This routine provides a way to take a look at important statistics - * maintained by the driver and hardware. + * Initialize the VF board statistics counters. * **********************************************************************/ static void -igb_print_debug_info(struct adapter *adapter) +igb_vf_init_stats(struct adapter *adapter) { - device_t dev = adapter->dev; - struct rx_ring *rxr = adapter->rx_rings; - struct tx_ring *txr = adapter->tx_rings; - uint8_t *hw_addr = adapter->hw.hw_addr; + struct e1000_hw *hw = &adapter->hw; + struct e1000_vf_stats *stats; - device_printf(dev, "Adapter hardware address = %p \n", hw_addr); - device_printf(dev, "CTRL = 0x%x RCTL = 0x%x \n", - E1000_READ_REG(&adapter->hw, E1000_CTRL), - E1000_READ_REG(&adapter->hw, E1000_RCTL)); - -#if (DEBUG_HW > 0) /* Dont output these errors normally */ - device_printf(dev, "IMS = 0x%x EIMS = 0x%x \n", - E1000_READ_REG(&adapter->hw, E1000_IMS), - E1000_READ_REG(&adapter->hw, E1000_EIMS)); -#endif - - device_printf(dev, "Packet buffer = Tx=%dk Rx=%dk \n", - ((E1000_READ_REG(&adapter->hw, E1000_PBA) & 0xffff0000) >> 16),\ - (E1000_READ_REG(&adapter->hw, E1000_PBA) & 0xffff) ); - device_printf(dev, "Flow control watermarks high = %d low = %d\n", - adapter->hw.fc.high_water, - adapter->hw.fc.low_water); - - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { - device_printf(dev, "Queue(%d) tdh = %d, tdt = %d\n", i, - E1000_READ_REG(&adapter->hw, E1000_TDH(i)), - E1000_READ_REG(&adapter->hw, E1000_TDT(i))); - device_printf(dev, "no descriptors avail event = %lld\n", - (long long)txr->no_desc_avail); - device_printf(dev, "TX(%d) MSIX IRQ Handled = %lld\n", txr->me, - (long long)txr->tx_irq); - device_printf(dev, "TX(%d) Packets sent = %lld\n", txr->me, - (long long)txr->tx_packets); - } - - for (int i = 0; i < adapter->num_rx_queues; i++, rxr++) { - struct lro_ctrl *lro = &rxr->lro; - device_printf(dev, "Queue(%d) rdh = %d, rdt = %d\n", i, - E1000_READ_REG(&adapter->hw, E1000_RDH(i)), - E1000_READ_REG(&adapter->hw, E1000_RDT(i))); - device_printf(dev, "RX(%d) Packets received = %lld\n", rxr->me, - (long long)rxr->rx_packets); - device_printf(dev, "RX(%d) Byte count = %lld\n", rxr->me, - (long long)rxr->rx_bytes); - device_printf(dev, "RX(%d) MSIX IRQ Handled = %lld\n", rxr->me, - (long long)rxr->rx_irq); - device_printf(dev,"RX(%d) LRO Queued= %d\n", - rxr->me, lro->lro_queued); - device_printf(dev,"RX(%d) LRO Flushed= %d\n", - rxr->me, lro->lro_flushed); - } - - device_printf(dev, "LINK MSIX IRQ Handled = %u\n", adapter->link_irq); - - device_printf(dev, "Std mbuf failed = %ld\n", - adapter->mbuf_alloc_failed); - device_printf(dev, "Std mbuf cluster failed = %ld\n", - adapter->mbuf_cluster_failed); - device_printf(dev, "Driver dropped packets = %ld\n", - adapter->dropped_pkts); - device_printf(dev, "Driver tx dma failure in xmit = %ld\n", - adapter->no_tx_dma_setup); + stats = (struct e1000_vf_stats *)adapter->stats; + if (stats == NULL) + return; + stats->last_gprc = E1000_READ_REG(hw, E1000_VFGPRC); + stats->last_gorc = E1000_READ_REG(hw, E1000_VFGORC); + stats->last_gptc = E1000_READ_REG(hw, E1000_VFGPTC); + stats->last_gotc = E1000_READ_REG(hw, E1000_VFGOTC); + stats->last_mprc = E1000_READ_REG(hw, E1000_VFMPRC); } - + +/********************************************************************** + * + * Update the VF board statistics counters. + * + **********************************************************************/ static void -igb_print_hw_stats(struct adapter *adapter) +igb_update_vf_stats_counters(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + struct e1000_vf_stats *stats; + + if (adapter->link_speed == 0) + return; + + stats = (struct e1000_vf_stats *)adapter->stats; + + UPDATE_VF_REG(E1000_VFGPRC, + stats->last_gprc, stats->gprc); + UPDATE_VF_REG(E1000_VFGORC, + stats->last_gorc, stats->gorc); + UPDATE_VF_REG(E1000_VFGPTC, + stats->last_gptc, stats->gptc); + UPDATE_VF_REG(E1000_VFGOTC, + stats->last_gotc, stats->gotc); + UPDATE_VF_REG(E1000_VFMPRC, + stats->last_mprc, stats->mprc); +} + +/* Export a single 32-bit register via a read-only sysctl. */ +static int +igb_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter; + u_int val; + + adapter = oidp->oid_arg1; + val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2); + return (sysctl_handle_int(oidp, &val, 0, req)); +} + +/* +** Tuneable interrupt rate handler +*/ +static int +igb_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS) +{ + struct igb_queue *que = ((struct igb_queue *)oidp->oid_arg1); + int error; + u32 reg, usec, rate; + + reg = E1000_READ_REG(&que->adapter->hw, E1000_EITR(que->msix)); + usec = ((reg & 0x7FFC) >> 2); + if (usec > 0) + rate = 1000000 / usec; + else + rate = 0; + error = sysctl_handle_int(oidp, &rate, 0, req); + if (error || !req->newptr) + return error; + return 0; +} + +/* + * Add sysctl variables, one per statistic, to the system. + */ +static void +igb_add_hw_stats(struct adapter *adapter) { device_t dev = adapter->dev; - device_printf(dev, "Excessive collisions = %lld\n", - (long long)adapter->stats.ecol); -#if (DEBUG_HW > 0) /* Dont output these errors normally */ - device_printf(dev, "Symbol errors = %lld\n", - (long long)adapter->stats.symerrs); -#endif - device_printf(dev, "Sequence errors = %lld\n", - (long long)adapter->stats.sec); - device_printf(dev, "Defer count = %lld\n", - (long long)adapter->stats.dc); - device_printf(dev, "Missed Packets = %lld\n", - (long long)adapter->stats.mpc); - device_printf(dev, "Receive No Buffers = %lld\n", - (long long)adapter->stats.rnbc); - /* RLEC is inaccurate on some hardware, calculate our own. */ - device_printf(dev, "Receive Length Errors = %lld\n", - ((long long)adapter->stats.roc + (long long)adapter->stats.ruc)); - device_printf(dev, "Receive errors = %lld\n", - (long long)adapter->stats.rxerrc); - device_printf(dev, "Crc errors = %lld\n", - (long long)adapter->stats.crcerrs); - device_printf(dev, "Alignment errors = %lld\n", - (long long)adapter->stats.algnerrc); + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); + struct sysctl_oid *tree = device_get_sysctl_tree(dev); + struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + struct e1000_hw_stats *stats = adapter->stats; + + struct sysctl_oid *stat_node, *queue_node, *int_node, *host_node; + struct sysctl_oid_list *stat_list, *queue_list, *int_list, *host_list; + +#define QUEUE_NAME_LEN 32 + char namebuf[QUEUE_NAME_LEN]; + + /* Driver Statistics */ + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "link_irq", + CTLFLAG_RD, &adapter->link_irq, 0, + "Link MSIX IRQ Handled"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", + CTLFLAG_RD, &adapter->dropped_pkts, + "Driver dropped packets"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", + CTLFLAG_RD, &adapter->no_tx_dma_setup, + "Driver tx dma failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", + CTLFLAG_RD, &adapter->rx_overruns, + "RX overruns"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_timeouts", + CTLFLAG_RD, &adapter->watchdog_events, + "Watchdog timeouts"); + + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "device_control", + CTLFLAG_RD, &adapter->device_control, + "Device Control Register"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_control", + CTLFLAG_RD, &adapter->rx_control, + "Receiver Control Register"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "interrupt_mask", + CTLFLAG_RD, &adapter->int_mask, + "Interrupt Mask"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "extended_int_mask", + CTLFLAG_RD, &adapter->eint_mask, + "Extended Interrupt Mask"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_buf_alloc", + CTLFLAG_RD, &adapter->packet_buf_alloc_tx, + "Transmit Buffer Packet Allocation"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_buf_alloc", + CTLFLAG_RD, &adapter->packet_buf_alloc_rx, + "Receive Buffer Packet Allocation"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_high_water", + CTLFLAG_RD, &adapter->hw.fc.high_water, 0, + "Flow Control High Watermark"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_low_water", + CTLFLAG_RD, &adapter->hw.fc.low_water, 0, + "Flow Control Low Watermark"); + + for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { + struct lro_ctrl *lro = &rxr->lro; + + snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); + queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, + CTLFLAG_RD, NULL, "Queue Name"); + queue_list = SYSCTL_CHILDREN(queue_node); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "interrupt_rate", + CTLFLAG_RD, &adapter->queues[i], + sizeof(&adapter->queues[i]), + igb_sysctl_interrupt_rate_handler, + "IU", "Interrupt Rate"); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", + CTLFLAG_RD, adapter, E1000_TDH(txr->me), + igb_sysctl_reg_handler, "IU", + "Transmit Descriptor Head"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail", + CTLFLAG_RD, adapter, E1000_TDT(txr->me), + igb_sysctl_reg_handler, "IU", + "Transmit Descriptor Tail"); + SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "no_desc_avail", + CTLFLAG_RD, &txr->no_desc_avail, + "Queue No Descriptor Available"); + SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "tx_packets", + CTLFLAG_RD, &txr->tx_packets, + "Queue Packets Transmitted"); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head", + CTLFLAG_RD, adapter, E1000_RDH(rxr->me), + igb_sysctl_reg_handler, "IU", + "Receive Descriptor Head"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail", + CTLFLAG_RD, adapter, E1000_RDT(rxr->me), + igb_sysctl_reg_handler, "IU", + "Receive Descriptor Tail"); + SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "rx_packets", + CTLFLAG_RD, &rxr->rx_packets, + "Queue Packets Received"); + SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "rx_bytes", + CTLFLAG_RD, &rxr->rx_bytes, + "Queue Bytes Received"); + SYSCTL_ADD_UINT(ctx, queue_list, OID_AUTO, "lro_queued", + CTLFLAG_RD, &lro->lro_queued, 0, + "LRO Queued"); + SYSCTL_ADD_UINT(ctx, queue_list, OID_AUTO, "lro_flushed", + CTLFLAG_RD, &lro->lro_flushed, 0, + "LRO Flushed"); + } + + /* MAC stats get their own sub node */ + + stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac_stats", + CTLFLAG_RD, NULL, "MAC Statistics"); + stat_list = SYSCTL_CHILDREN(stat_node); + + /* + ** VF adapter has a very limited set of stats + ** since its not managing the metal, so to speak. + */ + if (adapter->hw.mac.type == e1000_vfadapt) { + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_recvd", + CTLFLAG_RD, &stats->gprc, + "Good Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_txd", + CTLFLAG_RD, &stats->gptc, + "Good Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_recvd", + CTLFLAG_RD, &stats->gorc, + "Good Octets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", + CTLFLAG_RD, &stats->gotc, + "Good Octets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_recvd", + CTLFLAG_RD, &stats->mprc, + "Multicast Packets Received"); + return; + } + + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "excess_coll", + CTLFLAG_RD, &stats->ecol, + "Excessive collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "single_coll", + CTLFLAG_RD, &stats->scc, + "Single collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "multiple_coll", + CTLFLAG_RD, &stats->mcc, + "Multiple collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "late_coll", + CTLFLAG_RD, &stats->latecol, + "Late collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "collision_count", + CTLFLAG_RD, &stats->colc, + "Collision Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "symbol_errors", + CTLFLAG_RD, &stats->symerrs, + "Symbol Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "sequence_errors", + CTLFLAG_RD, &stats->sec, + "Sequence Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "defer_count", + CTLFLAG_RD, &stats->dc, + "Defer Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "missed_packets", + CTLFLAG_RD, &stats->mpc, + "Missed Packets"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_no_buff", + CTLFLAG_RD, &stats->rnbc, + "Receive No Buffers"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_undersize", + CTLFLAG_RD, &stats->ruc, + "Receive Undersize"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_fragmented", + CTLFLAG_RD, &stats->rfc, + "Fragmented Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_oversize", + CTLFLAG_RD, &stats->roc, + "Oversized Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_jabber", + CTLFLAG_RD, &stats->rjc, + "Recevied Jabber"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_errs", + CTLFLAG_RD, &stats->rxerrc, + "Receive Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "crc_errs", + CTLFLAG_RD, &stats->crcerrs, + "CRC errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "alignment_errs", + CTLFLAG_RD, &stats->algnerrc, + "Alignment Errors"); /* On 82575 these are collision counts */ - device_printf(dev, "Collision/Carrier extension errors = %lld\n", - (long long)adapter->stats.cexterr); - device_printf(dev, "RX overruns = %ld\n", adapter->rx_overruns); - device_printf(dev, "watchdog timeouts = %ld\n", - adapter->watchdog_events); - device_printf(dev, "XON Rcvd = %lld\n", - (long long)adapter->stats.xonrxc); - device_printf(dev, "XON Xmtd = %lld\n", - (long long)adapter->stats.xontxc); - device_printf(dev, "XOFF Rcvd = %lld\n", - (long long)adapter->stats.xoffrxc); - device_printf(dev, "XOFF Xmtd = %lld\n", - (long long)adapter->stats.xofftxc); - device_printf(dev, "Good Packets Rcvd = %lld\n", - (long long)adapter->stats.gprc); - device_printf(dev, "Good Packets Xmtd = %lld\n", - (long long)adapter->stats.gptc); - device_printf(dev, "TSO Contexts Xmtd = %lld\n", - (long long)adapter->stats.tsctc); - device_printf(dev, "TSO Contexts Failed = %lld\n", - (long long)adapter->stats.tsctfc); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "coll_ext_errs", + CTLFLAG_RD, &stats->cexterr, + "Collision/Carrier extension errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_recvd", + CTLFLAG_RD, &stats->xonrxc, + "XON Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_txd", + CTLFLAG_RD, &stats->xontxc, + "XON Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_recvd", + CTLFLAG_RD, &stats->xoffrxc, + "XOFF Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_txd", + CTLFLAG_RD, &stats->xofftxc, + "XOFF Transmitted"); + /* Packet Reception Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_recvd", + CTLFLAG_RD, &stats->tpr, + "Total Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_recvd", + CTLFLAG_RD, &stats->gprc, + "Good Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_recvd", + CTLFLAG_RD, &stats->bprc, + "Broadcast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_recvd", + CTLFLAG_RD, &stats->mprc, + "Multicast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_64", + CTLFLAG_RD, &stats->prc64, + "64 byte frames received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_65_127", + CTLFLAG_RD, &stats->prc127, + "65-127 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_128_255", + CTLFLAG_RD, &stats->prc255, + "128-255 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_256_511", + CTLFLAG_RD, &stats->prc511, + "256-511 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_512_1023", + CTLFLAG_RD, &stats->prc1023, + "512-1023 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_1024_1522", + CTLFLAG_RD, &stats->prc1522, + "1023-1522 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_recvd", + CTLFLAG_RD, &stats->gorc, + "Good Octets Received"); + + /* Packet Transmission Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", + CTLFLAG_RD, &stats->gotc, + "Good Octets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", + CTLFLAG_RD, &stats->tpt, + "Total Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_txd", + CTLFLAG_RD, &stats->gptc, + "Good Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_txd", + CTLFLAG_RD, &stats->bptc, + "Broadcast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_txd", + CTLFLAG_RD, &stats->mptc, + "Multicast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_64", + CTLFLAG_RD, &stats->ptc64, + "64 byte frames transmitted "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_65_127", + CTLFLAG_RD, &stats->ptc127, + "65-127 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_128_255", + CTLFLAG_RD, &stats->ptc255, + "128-255 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_256_511", + CTLFLAG_RD, &stats->ptc511, + "256-511 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_512_1023", + CTLFLAG_RD, &stats->ptc1023, + "512-1023 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_1024_1522", + CTLFLAG_RD, &stats->ptc1522, + "1024-1522 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_txd", + CTLFLAG_RD, &stats->tsctc, + "TSO Contexts Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_ctx_fail", + CTLFLAG_RD, &stats->tsctfc, + "TSO Contexts Failed"); + + + /* Interrupt Stats */ + + int_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "interrupts", + CTLFLAG_RD, NULL, "Interrupt Statistics"); + int_list = SYSCTL_CHILDREN(int_node); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "asserts", + CTLFLAG_RD, &stats->iac, + "Interrupt Assertion Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_pkt_timer", + CTLFLAG_RD, &stats->icrxptc, + "Interrupt Cause Rx Pkt Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_abs_timer", + CTLFLAG_RD, &stats->icrxatc, + "Interrupt Cause Rx Abs Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_pkt_timer", + CTLFLAG_RD, &stats->ictxptc, + "Interrupt Cause Tx Pkt Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_abs_timer", + CTLFLAG_RD, &stats->ictxatc, + "Interrupt Cause Tx Abs Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_queue_empty", + CTLFLAG_RD, &stats->ictxqec, + "Interrupt Cause Tx Queue Empty Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_queue_min_thresh", + CTLFLAG_RD, &stats->ictxqmtc, + "Interrupt Cause Tx Queue Min Thresh Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_desc_min_thresh", + CTLFLAG_RD, &stats->icrxdmtc, + "Interrupt Cause Rx Desc Min Thresh Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_overrun", + CTLFLAG_RD, &stats->icrxoc, + "Interrupt Cause Receiver Overrun Count"); + + /* Host to Card Stats */ + + host_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "host", + CTLFLAG_RD, NULL, + "Host to Card Statistics"); + + host_list = SYSCTL_CHILDREN(host_node); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_tx_pkt", + CTLFLAG_RD, &stats->cbtmpc, + "Circuit Breaker Tx Packet Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "host_tx_pkt_discard", + CTLFLAG_RD, &stats->htdpmc, + "Host Transmit Discarded Packets"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "rx_pkt", + CTLFLAG_RD, &stats->rpthc, + "Rx Packets To Host"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_rx_pkts", + CTLFLAG_RD, &stats->cbrmpc, + "Circuit Breaker Rx Packet Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_rx_pkt_drop", + CTLFLAG_RD, &stats->cbrdpc, + "Circuit Breaker Rx Dropped Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "tx_good_pkt", + CTLFLAG_RD, &stats->hgptc, + "Host Good Packets Tx Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_tx_pkt_drop", + CTLFLAG_RD, &stats->htcbdpc, + "Host Tx Circuit Breaker Dropped Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "rx_good_bytes", + CTLFLAG_RD, &stats->hgorc, + "Host Good Octets Received Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "tx_good_bytes", + CTLFLAG_RD, &stats->hgotc, + "Host Good Octets Transmit Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "length_errors", + CTLFLAG_RD, &stats->lenerrs, + "Length Errors"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "serdes_violation_pkt", + CTLFLAG_RD, &stats->scvpc, + "SerDes/SGMII Code Violation Pkt Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "header_redir_missed", + CTLFLAG_RD, &stats->hrmpc, + "Header Redirection Missed Packet Count"); } + /********************************************************************** * * This routine provides a way to dump out the adapter eeprom, @@ -4523,6 +5442,32 @@ igb_print_hw_stats(struct adapter *adapter) * 32 words, stuff that matters is in that extent. * **********************************************************************/ +static int +igb_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter; + int error; + int result; + + result = -1; + error = sysctl_handle_int(oidp, &result, 0, req); + + if (error || !req->newptr) + return (error); + + /* + * This value will cause a hex dump of the + * first 32 16-bit words of the EEPROM to + * the screen. + */ + if (result == 1) { + adapter = (struct adapter *)arg1; + igb_print_nvm_info(adapter); + } + + return (error); +} + static void igb_print_nvm_info(struct adapter *adapter) { @@ -4543,58 +5488,6 @@ igb_print_nvm_info(struct adapter *adapter) printf("\n"); } -static int -igb_sysctl_debug_info(SYSCTL_HANDLER_ARGS) -{ - struct adapter *adapter; - int error; - int result; - - result = -1; - error = sysctl_handle_int(oidp, &result, 0, req); - - if (error || !req->newptr) - return (error); - - if (result == 1) { - adapter = (struct adapter *)arg1; - igb_print_debug_info(adapter); - } - /* - * This value will cause a hex dump of the - * first 32 16-bit words of the EEPROM to - * the screen. - */ - if (result == 2) { - adapter = (struct adapter *)arg1; - igb_print_nvm_info(adapter); - } - - return (error); -} - - -static int -igb_sysctl_stats(SYSCTL_HANDLER_ARGS) -{ - struct adapter *adapter; - int error; - int result; - - result = -1; - error = sysctl_handle_int(oidp, &result, 0, req); - - if (error || !req->newptr) - return (error); - - if (result == 1) { - adapter = (struct adapter *)arg1; - igb_print_hw_stats(adapter); - } - - return (error); -} - static void igb_add_rx_process_limit(struct adapter *adapter, const char *name, const char *description, int *limit, int value) @@ -4604,107 +5497,3 @@ igb_add_rx_process_limit(struct adapter *adapter, const char *name, SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } - -#ifdef IGB_TIMESYNC -/* - * Initialize the Time Sync Feature - */ -static int -igb_tsync_init(struct adapter *adapter) -{ - device_t dev = adapter->dev; - u32 tx_ctl, rx_ctl, val; - - - E1000_WRITE_REG(&adapter->hw, E1000_TIMINCA, (1<<24) | - 20833/PICOSECS_PER_TICK); - - adapter->last_stamp = E1000_READ_REG(&adapter->hw, E1000_SYSTIML); - adapter->last_stamp |= (u64)E1000_READ_REG(&adapter->hw, - E1000_SYSTIMH) << 32ULL; - - /* Enable the TX side */ - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - tx_ctl |= 0x10; - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCTXCTL, tx_ctl); - E1000_WRITE_FLUSH(&adapter->hw); - - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - if ((tx_ctl & 0x10) == 0) { - device_printf(dev, "Failed to enable TX timestamping\n"); - return (ENXIO); - } - - /* Enable RX */ - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - rx_ctl |= 0x10; /* Enable the feature */ - rx_ctl |= 0x04; /* This value turns on Ver 1 and 2 */ - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCRXCTL, rx_ctl); - - /* - * Ethertype Filter Queue Filter[0][15:0] = 0x88F7 (Ethertype) - * Ethertype Filter Queue Filter[0][26] = 0x1 (Enable filter) - * Ethertype Filter Queue Filter[0][31] = 0x1 (Enable Timestamping) - */ - E1000_WRITE_REG(&adapter->hw, E1000_ETQF(0), 0x440088f7); - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCRXCFG, 0x0); - - /* - * Source Port Queue Filter Setup: - * this is for UDP port filtering - */ - E1000_WRITE_REG(&adapter->hw, E1000_SPQF(0), TSYNC_PORT); - /* Protocol = UDP, enable Timestamp, and filter on source/protocol */ - val = (0x11 | (1 << 27) | (6 << 28)); - E1000_WRITE_REG(&adapter->hw, E1000_FTQF(0), val); - - E1000_WRITE_FLUSH(&adapter->hw); - - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - if ((rx_ctl & 0x10) == 0) { - device_printf(dev, "Failed to enable RX timestamping\n"); - return (ENXIO); - } - - device_printf(dev, "IEEE 1588 Precision Time Protocol enabled\n"); - - return (0); -} - -/* - * Disable the Time Sync Feature - */ -static void -igb_tsync_disable(struct adapter *adapter) -{ - u32 tx_ctl, rx_ctl; - - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - tx_ctl &= ~0x10; - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCTXCTL, tx_ctl); - E1000_WRITE_FLUSH(&adapter->hw); - - /* Invalidate TX Timestamp */ - E1000_READ_REG(&adapter->hw, E1000_TXSTMPH); - - tx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCTXCTL); - if (tx_ctl & 0x10) - HW_DEBUGOUT("Failed to disable TX timestamping\n"); - - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - rx_ctl &= ~0x10; - - E1000_WRITE_REG(&adapter->hw, E1000_TSYNCRXCTL, rx_ctl); - E1000_WRITE_FLUSH(&adapter->hw); - - /* Invalidate RX Timestamp */ - E1000_READ_REG(&adapter->hw, E1000_RXSATRH); - - rx_ctl = E1000_READ_REG(&adapter->hw, E1000_TSYNCRXCTL); - if (rx_ctl & 0x10) - HW_DEBUGOUT("Failed to disable RX timestamping\n"); - - return; -} - -#endif /* IGB_TIMESYNC */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.h index bfb1f0b853..fc0ed491f1 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_igb.h,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ +/*$FreeBSD: src/sys/dev/e1000/if_igb.h,v 1.4.2.6.2.1 2010/12/21 17:09:25 kensmith Exp $*/ #ifndef _IGB_H_DEFINED_ #define _IGB_H_DEFINED_ @@ -47,8 +47,8 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define IGB_MIN_TXD 80 -#define IGB_DEFAULT_TXD 256 +#define IGB_MIN_TXD 256 +#define IGB_DEFAULT_TXD 1024 #define IGB_MAX_TXD 4096 /* @@ -62,8 +62,8 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define IGB_MIN_RXD 80 -#define IGB_DEFAULT_RXD 256 +#define IGB_MIN_RXD 256 +#define IGB_DEFAULT_RXD 1024 #define IGB_MAX_RXD 4096 /* @@ -128,7 +128,7 @@ /* * This parameter controls the duration of transmit watchdog timer. */ -#define IGB_TX_TIMEOUT 5 /* set to 5 seconds */ +#define IGB_WATCHDOG (10 * hz) /* * This parameter controls when the driver calls the routine to reclaim @@ -172,25 +172,27 @@ #define IGB_DEFAULT_PBA 0x00000030 #define IGB_SMARTSPEED_DOWNSHIFT 3 #define IGB_SMARTSPEED_MAX 15 -#define IGB_MAX_INTR 10 -#define IGB_RX_PTHRESH 16 +#define IGB_MAX_LOOP 10 + +#define IGB_RX_PTHRESH (hw->mac.type <= e1000_82576 ? 16 : 8) #define IGB_RX_HTHRESH 8 #define IGB_RX_WTHRESH 1 +#define IGB_TX_PTHRESH 8 +#define IGB_TX_HTHRESH 1 +#define IGB_TX_WTHRESH (((hw->mac.type == e1000_82576 || \ + hw->mac.type == e1000_vfadapt) && \ + adapter->msix_mem) ? 1 : 16) + #define MAX_NUM_MULTICAST_ADDRESSES 128 #define PCI_ANY_ID (~0U) #define ETHER_ALIGN 2 #define IGB_TX_BUFFER_SIZE ((uint32_t) 1514) #define IGB_FC_PAUSE_TIME 0x0680 #define IGB_EEPROM_APME 0x400; - -#define MAX_INTS_PER_SEC 8000 -#define DEFAULT_ITR 1000000000/(MAX_INTS_PER_SEC * 256) - -/* Code compatilbility between 6 and 7 */ -#ifndef ETHER_BPF_MTAP -#define ETHER_BPF_MTAP BPF_MTAP -#endif +#define IGB_QUEUE_IDLE 0 +#define IGB_QUEUE_WORKING 1 +#define IGB_QUEUE_HUNG 2 /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be @@ -204,14 +206,6 @@ /* PCI Config defines */ #define IGB_MSIX_BAR 3 -/* -** This is the total number of MSIX vectors you wish -** to use, it also controls the size of resources. -** The 82575 has a total of 10, 82576 has 25. Set this -** to the real amount you need to streamline data storage. -*/ -#define IGB_MSIX_VEC 6 /* MSIX vectors configured */ - /* Defines for printing debug information */ #define DEBUG_INIT 0 #define DEBUG_IOCTL 0 @@ -228,53 +222,33 @@ #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) #define IGB_MAX_SCATTER 64 +#define IGB_VFTA_SIZE 128 +#define IGB_BR_SIZE 4096 /* ring buf size */ #define IGB_TSO_SIZE (65535 + sizeof(struct ether_vlan_header)) #define IGB_TSO_SEG_SIZE 4096 /* Max dma segment size */ +#define IGB_HDR_BUF 128 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define ETH_ZLEN 60 #define ETH_ADDR_LEN 6 -#define CSUM_OFFLOAD 7 /* Offload bits in mbuf flag */ -/* - * Interrupt Moderation parameters - */ -#define IGB_LOW_LATENCY 128 -#define IGB_AVE_LATENCY 450 -#define IGB_BULK_LATENCY 1200 +/* Offload bits in mbuf flag */ +#if __FreeBSD_version >= 800000 +#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) +#else +#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP) +#endif + +/* Define the starting Interrupt rate per Queue */ +#define IGB_INTS_PER_SEC 8000 +#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) + #define IGB_LINK_ITR 2000 -#ifdef IGB_TIMESYNC /* Precision Time Sync (IEEE 1588) defines */ #define ETHERTYPE_IEEE1588 0x88F7 #define PICOSECS_PER_TICK 20833 #define TSYNC_PORT 319 /* UDP port for the protocol */ -/* TIMESYNC IOCTL defines */ -#define IGB_TIMESYNC_READTS _IOWR('i', 127, struct igb_tsync_read) -#define IGB_TIMESTAMP 5 /* A unique return value */ - -/* Used in the READTS IOCTL */ -struct igb_tsync_read { - int read_current_time; - struct timespec system_time; - u64 network_time; - u64 rx_stamp; - u64 tx_stamp; - u16 seqid; - unsigned char srcid[6]; - int rx_valid; - int tx_valid; -}; - -#endif /* IGB_TIMESYNC */ - -struct adapter; /* forward reference */ - -struct igb_int_delay_info { - struct adapter *adapter; /* Back-pointer to the adapter struct */ - int offset; /* Register offset to read/write */ - int value; /* Current value in usecs */ -}; - /* * Bus dma allocation structure used by * e1000_dma_malloc and e1000_dma_free. @@ -290,48 +264,72 @@ struct igb_dma_alloc { /* - * Transmit ring: one per tx queue +** Driver queue struct: this is the interrupt container +** for the associated tx and rx ring. +*/ +struct igb_queue { + struct adapter *adapter; + u32 msix; /* This queue's MSIX vector */ + u32 eims; /* This queue's EIMS bit */ + u32 eitr_setting; + struct resource *res; + void *tag; + struct tx_ring *txr; + struct rx_ring *rxr; + struct task que_task; + struct taskqueue *tq; + u64 irqs; +}; + +/* + * Transmit ring: one per queue */ struct tx_ring { struct adapter *adapter; u32 me; - u32 msix; /* This ring's MSIX vector */ - u32 eims; /* This ring's EIMS bit */ struct mtx tx_mtx; char mtx_name[16]; - struct igb_dma_alloc txdma; /* bus_dma glue for tx desc */ + struct igb_dma_alloc txdma; struct e1000_tx_desc *tx_base; - struct task tx_task; /* cleanup tasklet */ u32 next_avail_desc; u32 next_to_clean; volatile u16 tx_avail; - struct igb_buffer *tx_buffers; - bus_dma_tag_t txtag; /* dma tag for tx */ - u32 watchdog_timer; + struct igb_tx_buffer *tx_buffers; +#if __FreeBSD_version >= 800000 + struct buf_ring *br; +#endif + bus_dma_tag_t txtag; + + u32 bytes; + u32 packets; + + int queue_status; + int watchdog_time; + int tdt; + int tdh; u64 no_desc_avail; - u64 tx_irq; u64 tx_packets; }; /* - * Receive ring: one per rx queue + * Receive ring: one per queue */ struct rx_ring { struct adapter *adapter; u32 me; - u32 msix; /* This ring's MSIX vector */ - u32 eims; /* This ring's EIMS bit */ - struct igb_dma_alloc rxdma; /* bus_dma glue for tx desc */ + struct igb_dma_alloc rxdma; union e1000_adv_rx_desc *rx_base; struct lro_ctrl lro; - struct task rx_task; /* cleanup tasklet */ + bool lro_enabled; + bool hdr_split; + bool discard; struct mtx rx_mtx; char mtx_name[16]; - u32 last_cleaned; + u32 next_to_refresh; u32 next_to_check; - struct igb_buffer *rx_buffers; - bus_dma_tag_t rxtag; /* dma tag for tx */ - bus_dmamap_t rx_spare_map; + struct igb_rx_buf *rx_buffers; + bus_dma_tag_t htag; /* dma tag for rx head */ + bus_dma_tag_t ptag; /* dma tag for rx packet */ /* * First/last mbuf pointers, for * collecting multisegment RX packets. @@ -340,10 +338,13 @@ struct rx_ring { struct mbuf *lmp; u32 bytes; - u32 eitr_setting; + u32 packets; + int rdt; + int rdh; /* Soft stats */ - u64 rx_irq; + u64 rx_split_packets; + u64 rx_discarded; u64 rx_packets; u64 rx_bytes; }; @@ -352,19 +353,19 @@ struct adapter { struct ifnet *ifp; struct e1000_hw hw; - /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; struct device *dev; + struct cdev *led_dev; struct resource *pci_mem; struct resource *msix_mem; - struct resource *res[IGB_MSIX_VEC]; - void *tag[IGB_MSIX_VEC]; - int rid[IGB_MSIX_VEC]; + struct resource *res; + void *tag; u32 eims_mask; int linkvec; int link_mask; + struct task link_task; int link_irq; struct ifmedia media; @@ -373,62 +374,82 @@ struct adapter { int if_flags; int max_frame_size; int min_frame_size; + int pause_frames; struct mtx core_mtx; int igb_insert_vlan_header; - struct task link_task; - struct task rxtx_task; - struct taskqueue *tq; /* private task queue */ + u16 num_queues; -#ifdef IGB_HW_VLAN_SUPPORT eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; -#endif + u32 num_vlans; /* Management and WOL features */ int wol; int has_manage; - /* Info about the board itself */ + /* + ** Shadow VFTA table, this is needed because + ** the real vlan filter table gets cleared during + ** a soft reset and the driver needs to be able + ** to repopulate it. + */ + u32 shadow_vfta[IGB_VFTA_SIZE]; + + /* Info about the interface */ u8 link_active; u16 link_speed; u16 link_duplex; u32 smartspeed; + /* Interface queues */ + struct igb_queue *queues; + /* * Transmit rings */ struct tx_ring *tx_rings; u16 num_tx_desc; - u16 num_tx_queues; - u32 txd_cmd; + + /* Multicast array pointer */ + u8 *mta; /* * Receive rings */ struct rx_ring *rx_rings; + bool rx_hdr_split; u16 num_rx_desc; - u16 num_rx_queues; int rx_process_limit; - u32 rx_buffer_len; + u32 rx_mbuf_sz; + u32 rx_mask; /* Misc stats maintained by the driver */ unsigned long dropped_pkts; - unsigned long mbuf_alloc_failed; - unsigned long mbuf_cluster_failed; + unsigned long mbuf_defrag_failed; + unsigned long mbuf_header_failed; + unsigned long mbuf_packet_failed; unsigned long no_tx_map_avail; unsigned long no_tx_dma_setup; unsigned long watchdog_events; unsigned long rx_overruns; + unsigned long device_control; + unsigned long rx_control; + unsigned long int_mask; + unsigned long eint_mask; + unsigned long packet_buf_alloc_rx; + unsigned long packet_buf_alloc_tx; boolean_t in_detach; -#ifdef IGB_TIMESYNC - u64 last_stamp; - u64 last_sec; - u32 last_ns; +#ifdef IGB_IEEE1588 + /* IEEE 1588 precision time support */ + struct cyclecounter cycles; + struct nettimer clock; + struct nettime_compare compare; + struct hwtstamp_ctrl hwtstamp; #endif - struct e1000_hw_stats stats; + void *stats; }; /* ****************************************************************************** @@ -447,26 +468,59 @@ typedef struct _igb_vendor_info_t { } igb_vendor_info_t; -struct igb_buffer { +struct igb_tx_buffer { int next_eop; /* Index of the desc to watch */ struct mbuf *m_head; bus_dmamap_t map; /* bus_dma map for packet */ }; +struct igb_rx_buf { + struct mbuf *m_head; + struct mbuf *m_pack; + bus_dmamap_t hmap; /* bus_dma map for header */ + bus_dmamap_t pmap; /* bus_dma map for packet */ +}; + #define IGB_CORE_LOCK_INIT(_sc, _name) \ mtx_init(&(_sc)->core_mtx, _name, "IGB Core Lock", MTX_DEF) #define IGB_CORE_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->core_mtx) -#define IGB_TX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->tx_mtx) -#define IGB_RX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_mtx) #define IGB_CORE_LOCK(_sc) mtx_lock(&(_sc)->core_mtx) -#define IGB_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_mtx) -#define IGB_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_mtx) #define IGB_CORE_UNLOCK(_sc) mtx_unlock(&(_sc)->core_mtx) -#define IGB_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_mtx) -#define IGB_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_mtx) #define IGB_CORE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->core_mtx, MA_OWNED) + +#define IGB_TX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->tx_mtx) +#define IGB_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_mtx) +#define IGB_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_mtx) +#define IGB_TX_TRYLOCK(_sc) mtx_trylock(&(_sc)->tx_mtx) #define IGB_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_mtx, MA_OWNED) +#define IGB_RX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_mtx) +#define IGB_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_mtx) +#define IGB_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_mtx) +#define IGB_RX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rx_mtx, MA_OWNED) + +#define UPDATE_VF_REG(reg, last, cur) \ +{ \ + u32 new = E1000_READ_REG(hw, reg); \ + if (new < last) \ + cur += 0x100000000LL; \ + last = new; \ + cur &= 0xFFFFFFFF00000000LL; \ + cur |= new; \ +} + +#if __FreeBSD_version < 800504 +static __inline int +drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + return (1); +#endif + return (!buf_ring_empty(br)); +} +#endif + #endif /* _IGB_H_DEFINED_ */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.c new file mode 100644 index 0000000000..753ccbf0dc --- /dev/null +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.c @@ -0,0 +1,4649 @@ +/****************************************************************************** + + Copyright (c) 2001-2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD: src/sys/dev/e1000/if_lem.c,v 1.3.2.10.2.1 2010/12/21 17:09:25 kensmith Exp $*/ + +#ifdef HAVE_KERNEL_OPTION_HEADERS +#include "opt_device_polling.h" +#include "opt_inet.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifndef __HAIKU__ +#include +#endif + +#include +#include + +#include "e1000_api.h" +#include "if_lem.h" + +/********************************************************************* + * Legacy Em Driver version: + *********************************************************************/ +char lem_driver_version[] = "1.0.3"; + +/********************************************************************* + * PCI Device ID Table + * + * Used by probe to select devices to load on + * Last field stores an index into e1000_strings + * Last entry must be all 0s + * + * { Vendor ID, Device ID, SubVendor ID, SubDevice ID, String Index } + *********************************************************************/ + +static em_vendor_info_t lem_vendor_info_array[] = +{ + /* Intel(R) PRO/1000 Network Connection */ + { 0x8086, E1000_DEV_ID_82540EM, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82540EM_LOM, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82540EP, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82540EP_LOM, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82540EP_LP, PCI_ANY_ID, PCI_ANY_ID, 0}, + + { 0x8086, E1000_DEV_ID_82541EI, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82541ER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82541ER_LOM, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82541EI_MOBILE, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82541GI, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82541GI_LF, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82541GI_MOBILE, PCI_ANY_ID, PCI_ANY_ID, 0}, + + { 0x8086, E1000_DEV_ID_82542, PCI_ANY_ID, PCI_ANY_ID, 0}, + + { 0x8086, E1000_DEV_ID_82543GC_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82543GC_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + + { 0x8086, E1000_DEV_ID_82544EI_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82544EI_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82544GC_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82544GC_LOM, PCI_ANY_ID, PCI_ANY_ID, 0}, + + { 0x8086, E1000_DEV_ID_82545EM_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82545EM_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82545GM_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82545GM_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82545GM_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, + + { 0x8086, E1000_DEV_ID_82546EB_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82546EB_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82546EB_QUAD_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82546GB_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82546GB_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82546GB_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82546GB_PCIE, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82546GB_QUAD_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3, + PCI_ANY_ID, PCI_ANY_ID, 0}, + + { 0x8086, E1000_DEV_ID_82547EI, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82547EI_MOBILE, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82547GI, PCI_ANY_ID, PCI_ANY_ID, 0}, + /* required last entry */ + { 0, 0, 0, 0, 0} +}; + +/********************************************************************* + * Table of branding strings for all supported NICs. + *********************************************************************/ + +static char *lem_strings[] = { + "Intel(R) PRO/1000 Legacy Network Connection" +}; + +/********************************************************************* + * Function prototypes + *********************************************************************/ +static int lem_probe(device_t); +static int lem_attach(device_t); +static int lem_detach(device_t); +static int lem_shutdown(device_t); +static int lem_suspend(device_t); +static int lem_resume(device_t); +static void lem_start(struct ifnet *); +static void lem_start_locked(struct ifnet *ifp); +static int lem_ioctl(struct ifnet *, u_long, caddr_t); +static void lem_init(void *); +static void lem_init_locked(struct adapter *); +static void lem_stop(void *); +static void lem_media_status(struct ifnet *, struct ifmediareq *); +static int lem_media_change(struct ifnet *); +static void lem_identify_hardware(struct adapter *); +static int lem_allocate_pci_resources(struct adapter *); +static int lem_allocate_irq(struct adapter *adapter); +static void lem_free_pci_resources(struct adapter *); +static void lem_local_timer(void *); +static int lem_hardware_init(struct adapter *); +static int lem_setup_interface(device_t, struct adapter *); +static void lem_setup_transmit_structures(struct adapter *); +static void lem_initialize_transmit_unit(struct adapter *); +static int lem_setup_receive_structures(struct adapter *); +static void lem_initialize_receive_unit(struct adapter *); +static void lem_enable_intr(struct adapter *); +static void lem_disable_intr(struct adapter *); +static void lem_free_transmit_structures(struct adapter *); +static void lem_free_receive_structures(struct adapter *); +static void lem_update_stats_counters(struct adapter *); +static void lem_add_hw_stats(struct adapter *adapter); +static void lem_txeof(struct adapter *); +static void lem_tx_purge(struct adapter *); +static int lem_allocate_receive_structures(struct adapter *); +static int lem_allocate_transmit_structures(struct adapter *); +static bool lem_rxeof(struct adapter *, int, int *); +#ifndef __NO_STRICT_ALIGNMENT +static int lem_fixup_rx(struct adapter *); +#endif +static void lem_receive_checksum(struct adapter *, struct e1000_rx_desc *, + struct mbuf *); +static void lem_transmit_checksum_setup(struct adapter *, struct mbuf *, + u32 *, u32 *); +static void lem_set_promisc(struct adapter *); +static void lem_disable_promisc(struct adapter *); +static void lem_set_multi(struct adapter *); +static void lem_update_link_status(struct adapter *); +static int lem_get_buf(struct adapter *, int); +static void lem_register_vlan(void *, struct ifnet *, u16); +static void lem_unregister_vlan(void *, struct ifnet *, u16); +static void lem_setup_vlan_hw_support(struct adapter *); +static int lem_xmit(struct adapter *, struct mbuf **); +static void lem_smartspeed(struct adapter *); +static int lem_82547_fifo_workaround(struct adapter *, int); +static void lem_82547_update_fifo_head(struct adapter *, int); +static int lem_82547_tx_fifo_reset(struct adapter *); +static void lem_82547_move_tail(void *); +static int lem_dma_malloc(struct adapter *, bus_size_t, + struct em_dma_alloc *, int); +static void lem_dma_free(struct adapter *, struct em_dma_alloc *); +static int lem_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); +static void lem_print_nvm_info(struct adapter *); +static int lem_is_valid_ether_addr(u8 *); +static u32 lem_fill_descriptors (bus_addr_t address, u32 length, + PDESC_ARRAY desc_array); +static int lem_sysctl_int_delay(SYSCTL_HANDLER_ARGS); +static void lem_add_int_delay_sysctl(struct adapter *, const char *, + const char *, struct em_int_delay_info *, int, int); +static void lem_set_flow_cntrl(struct adapter *, const char *, + const char *, int *, int); +/* Management and WOL Support */ +static void lem_init_manageability(struct adapter *); +static void lem_release_manageability(struct adapter *); +static void lem_get_hw_control(struct adapter *); +static void lem_release_hw_control(struct adapter *); +static void lem_get_wakeup(device_t); +static void lem_enable_wakeup(device_t); +static int lem_enable_phy_wakeup(struct adapter *); +static void lem_led_func(void *, int); + +#ifdef EM_LEGACY_IRQ +static void lem_intr(void *); +#else /* FAST IRQ */ +static int lem_irq_fast(void *); +static void lem_handle_rxtx(void *context, int pending); +static void lem_handle_link(void *context, int pending); +static void lem_add_rx_process_limit(struct adapter *, const char *, + const char *, int *, int); +#endif /* ~EM_LEGACY_IRQ */ + +#ifdef DEVICE_POLLING +static poll_handler_t lem_poll; +#endif /* POLLING */ + +/********************************************************************* + * FreeBSD Device Interface Entry Points + *********************************************************************/ + +static device_method_t lem_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, lem_probe), + DEVMETHOD(device_attach, lem_attach), + DEVMETHOD(device_detach, lem_detach), + DEVMETHOD(device_shutdown, lem_shutdown), + DEVMETHOD(device_suspend, lem_suspend), + DEVMETHOD(device_resume, lem_resume), + {0, 0} +}; + +#ifndef __HAIKU__ +static driver_t lem_driver = { + "em", lem_methods, sizeof(struct adapter), +}; + +extern devclass_t em_devclass; +DRIVER_MODULE(lem, pci, lem_driver, em_devclass, 0, 0); +#else +static driver_t lem_driver = { + "lem", lem_methods, sizeof(struct adapter), +}; + +devclass_t lem_devclass; +DRIVER_MODULE(lem, pci, lem_driver, lem_devclass, 0, 0); +#endif + +MODULE_DEPEND(lem, pci, 1, 1, 1); +MODULE_DEPEND(lem, ether, 1, 1, 1); + +/********************************************************************* + * Tunable default values. + *********************************************************************/ + +#define EM_TICKS_TO_USECS(ticks) ((1024 * (ticks) + 500) / 1000) +#define EM_USECS_TO_TICKS(usecs) ((1000 * (usecs) + 512) / 1024) + +static int lem_tx_int_delay_dflt = EM_TICKS_TO_USECS(EM_TIDV); +static int lem_rx_int_delay_dflt = EM_TICKS_TO_USECS(EM_RDTR); +static int lem_tx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_TADV); +static int lem_rx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_RADV); +static int lem_rxd = EM_DEFAULT_RXD; +static int lem_txd = EM_DEFAULT_TXD; +static int lem_smart_pwr_down = FALSE; + +/* Controls whether promiscuous also shows bad packets */ +static int lem_debug_sbp = FALSE; + +TUNABLE_INT("hw.em.tx_int_delay", &lem_tx_int_delay_dflt); +TUNABLE_INT("hw.em.rx_int_delay", &lem_rx_int_delay_dflt); +TUNABLE_INT("hw.em.tx_abs_int_delay", &lem_tx_abs_int_delay_dflt); +TUNABLE_INT("hw.em.rx_abs_int_delay", &lem_rx_abs_int_delay_dflt); +TUNABLE_INT("hw.em.rxd", &lem_rxd); +TUNABLE_INT("hw.em.txd", &lem_txd); +TUNABLE_INT("hw.em.smart_pwr_down", &lem_smart_pwr_down); +TUNABLE_INT("hw.em.sbp", &lem_debug_sbp); + +#ifndef EM_LEGACY_IRQ +/* How many packets rxeof tries to clean at a time */ +static int lem_rx_process_limit = 100; +TUNABLE_INT("hw.em.rx_process_limit", &lem_rx_process_limit); +#endif + +/* Flow control setting - default to FULL */ +static int lem_fc_setting = e1000_fc_full; +TUNABLE_INT("hw.em.fc_setting", &lem_fc_setting); + +/* Global used in WOL setup with multiport cards */ +static int global_quad_port_a = 0; + +/********************************************************************* + * Device identification routine + * + * em_probe determines if the driver should be loaded on + * adapter based on PCI vendor/device id of the adapter. + * + * return BUS_PROBE_DEFAULT on success, positive on failure + *********************************************************************/ + +static int +lem_probe(device_t dev) +{ + char adapter_name[60]; + u16 pci_vendor_id = 0; + u16 pci_device_id = 0; + u16 pci_subvendor_id = 0; + u16 pci_subdevice_id = 0; + em_vendor_info_t *ent; + + INIT_DEBUGOUT("em_probe: begin"); + + pci_vendor_id = pci_get_vendor(dev); + if (pci_vendor_id != EM_VENDOR_ID) + return (ENXIO); + + pci_device_id = pci_get_device(dev); + pci_subvendor_id = pci_get_subvendor(dev); + pci_subdevice_id = pci_get_subdevice(dev); + + ent = lem_vendor_info_array; + while (ent->vendor_id != 0) { + if ((pci_vendor_id == ent->vendor_id) && + (pci_device_id == ent->device_id) && + + ((pci_subvendor_id == ent->subvendor_id) || + (ent->subvendor_id == PCI_ANY_ID)) && + + ((pci_subdevice_id == ent->subdevice_id) || + (ent->subdevice_id == PCI_ANY_ID))) { + sprintf(adapter_name, "%s %s", + lem_strings[ent->index], + lem_driver_version); + device_set_desc_copy(dev, adapter_name); + return (BUS_PROBE_DEFAULT); + } + ent++; + } + + return (ENXIO); +} + +/********************************************************************* + * Device initialization routine + * + * The attach entry point is called when the driver is being loaded. + * This routine identifies the type of hardware, allocates all resources + * and initializes the hardware. + * + * return 0 on success, positive on failure + *********************************************************************/ + +static int +lem_attach(device_t dev) +{ + struct adapter *adapter; + int tsize, rsize; + int error = 0; + + INIT_DEBUGOUT("lem_attach: begin"); + + adapter = device_get_softc(dev); + adapter->dev = adapter->osdep.dev = dev; + EM_CORE_LOCK_INIT(adapter, device_get_nameunit(dev)); + EM_TX_LOCK_INIT(adapter, device_get_nameunit(dev)); + EM_RX_LOCK_INIT(adapter, device_get_nameunit(dev)); + + /* SYSCTL stuff */ + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + lem_sysctl_nvm_info, "I", "NVM Information"); + + callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); + callout_init_mtx(&adapter->tx_fifo_timer, &adapter->tx_mtx, 0); + + /* Determine hardware and mac info */ + lem_identify_hardware(adapter); + + /* Setup PCI resources */ + if (lem_allocate_pci_resources(adapter)) { + device_printf(dev, "Allocation of PCI resources failed\n"); + error = ENXIO; + goto err_pci; + } + + /* Do Shared Code initialization */ + if (e1000_setup_init_funcs(&adapter->hw, TRUE)) { + device_printf(dev, "Setup of Shared code failed\n"); + error = ENXIO; + goto err_pci; + } + + e1000_get_bus_info(&adapter->hw); + + /* Set up some sysctls for the tunable interrupt delays */ + lem_add_int_delay_sysctl(adapter, "rx_int_delay", + "receive interrupt delay in usecs", &adapter->rx_int_delay, + E1000_REGISTER(&adapter->hw, E1000_RDTR), lem_rx_int_delay_dflt); + lem_add_int_delay_sysctl(adapter, "tx_int_delay", + "transmit interrupt delay in usecs", &adapter->tx_int_delay, + E1000_REGISTER(&adapter->hw, E1000_TIDV), lem_tx_int_delay_dflt); + if (adapter->hw.mac.type >= e1000_82540) { + lem_add_int_delay_sysctl(adapter, "rx_abs_int_delay", + "receive interrupt delay limit in usecs", + &adapter->rx_abs_int_delay, + E1000_REGISTER(&adapter->hw, E1000_RADV), + lem_rx_abs_int_delay_dflt); + lem_add_int_delay_sysctl(adapter, "tx_abs_int_delay", + "transmit interrupt delay limit in usecs", + &adapter->tx_abs_int_delay, + E1000_REGISTER(&adapter->hw, E1000_TADV), + lem_tx_abs_int_delay_dflt); + } + +#ifndef EM_LEGACY_IRQ + /* Sysctls for limiting the amount of work done in the taskqueue */ + lem_add_rx_process_limit(adapter, "rx_processing_limit", + "max number of rx packets to process", &adapter->rx_process_limit, + lem_rx_process_limit); +#endif + + /* Sysctl for setting the interface flow control */ + lem_set_flow_cntrl(adapter, "flow_control", + "max number of rx packets to process", + &adapter->fc_setting, lem_fc_setting); + + /* + * Validate number of transmit and receive descriptors. It + * must not exceed hardware maximum, and must be multiple + * of E1000_DBA_ALIGN. + */ + if (((lem_txd * sizeof(struct e1000_tx_desc)) % EM_DBA_ALIGN) != 0 || + (adapter->hw.mac.type >= e1000_82544 && lem_txd > EM_MAX_TXD) || + (adapter->hw.mac.type < e1000_82544 && lem_txd > EM_MAX_TXD_82543) || + (lem_txd < EM_MIN_TXD)) { + device_printf(dev, "Using %d TX descriptors instead of %d!\n", + EM_DEFAULT_TXD, lem_txd); + adapter->num_tx_desc = EM_DEFAULT_TXD; + } else + adapter->num_tx_desc = lem_txd; + if (((lem_rxd * sizeof(struct e1000_rx_desc)) % EM_DBA_ALIGN) != 0 || + (adapter->hw.mac.type >= e1000_82544 && lem_rxd > EM_MAX_RXD) || + (adapter->hw.mac.type < e1000_82544 && lem_rxd > EM_MAX_RXD_82543) || + (lem_rxd < EM_MIN_RXD)) { + device_printf(dev, "Using %d RX descriptors instead of %d!\n", + EM_DEFAULT_RXD, lem_rxd); + adapter->num_rx_desc = EM_DEFAULT_RXD; + } else + adapter->num_rx_desc = lem_rxd; + + adapter->hw.mac.autoneg = DO_AUTO_NEG; + adapter->hw.phy.autoneg_wait_to_complete = FALSE; + adapter->hw.phy.autoneg_advertised = AUTONEG_ADV_DEFAULT; + adapter->rx_buffer_len = 2048; + + e1000_init_script_state_82541(&adapter->hw, TRUE); + e1000_set_tbi_compatibility_82543(&adapter->hw, TRUE); + + /* Copper options */ + if (adapter->hw.phy.media_type == e1000_media_type_copper) { + adapter->hw.phy.mdix = AUTO_ALL_MODES; + adapter->hw.phy.disable_polarity_correction = FALSE; + adapter->hw.phy.ms_type = EM_MASTER_SLAVE; + } + + /* + * Set the frame limits assuming + * standard ethernet sized frames. + */ + adapter->max_frame_size = ETHERMTU + ETHER_HDR_LEN + ETHERNET_FCS_SIZE; + adapter->min_frame_size = ETH_ZLEN + ETHERNET_FCS_SIZE; + + /* + * This controls when hardware reports transmit completion + * status. + */ + adapter->hw.mac.report_tx_early = 1; + + tsize = roundup2(adapter->num_tx_desc * sizeof(struct e1000_tx_desc), + EM_DBA_ALIGN); + + /* Allocate Transmit Descriptor ring */ + if (lem_dma_malloc(adapter, tsize, &adapter->txdma, BUS_DMA_NOWAIT)) { + device_printf(dev, "Unable to allocate tx_desc memory\n"); + error = ENOMEM; + goto err_tx_desc; + } + adapter->tx_desc_base = + (struct e1000_tx_desc *)adapter->txdma.dma_vaddr; + + rsize = roundup2(adapter->num_rx_desc * sizeof(struct e1000_rx_desc), + EM_DBA_ALIGN); + + /* Allocate Receive Descriptor ring */ + if (lem_dma_malloc(adapter, rsize, &adapter->rxdma, BUS_DMA_NOWAIT)) { + device_printf(dev, "Unable to allocate rx_desc memory\n"); + error = ENOMEM; + goto err_rx_desc; + } + adapter->rx_desc_base = + (struct e1000_rx_desc *)adapter->rxdma.dma_vaddr; + + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_hw_init; + } + + /* + ** Start from a known state, this is + ** important in reading the nvm and + ** mac from that. + */ + e1000_reset_hw(&adapter->hw); + + /* Make sure we have a good EEPROM before we read from it */ + if (e1000_validate_nvm_checksum(&adapter->hw) < 0) { + /* + ** Some PCI-E parts fail the first check due to + ** the link being in sleep state, call it again, + ** if it fails a second time its a real issue. + */ + if (e1000_validate_nvm_checksum(&adapter->hw) < 0) { + device_printf(dev, + "The EEPROM Checksum Is Not Valid\n"); + error = EIO; + goto err_hw_init; + } + } + + /* Copy the permanent MAC address out of the EEPROM */ + if (e1000_read_mac_addr(&adapter->hw) < 0) { + device_printf(dev, "EEPROM read error while reading MAC" + " address\n"); + error = EIO; + goto err_hw_init; + } + + if (!lem_is_valid_ether_addr(adapter->hw.mac.addr)) { + device_printf(dev, "Invalid MAC address\n"); + error = EIO; + goto err_hw_init; + } + + /* Initialize the hardware */ + if (lem_hardware_init(adapter)) { + device_printf(dev, "Unable to initialize the hardware\n"); + error = EIO; + goto err_hw_init; + } + + /* Allocate transmit descriptors and buffers */ + if (lem_allocate_transmit_structures(adapter)) { + device_printf(dev, "Could not setup transmit structures\n"); + error = ENOMEM; + goto err_tx_struct; + } + + /* Allocate receive descriptors and buffers */ + if (lem_allocate_receive_structures(adapter)) { + device_printf(dev, "Could not setup receive structures\n"); + error = ENOMEM; + goto err_rx_struct; + } + + /* + ** Do interrupt configuration + */ + error = lem_allocate_irq(adapter); + if (error) + goto err_rx_struct; + + /* + * Get Wake-on-Lan and Management info for later use + */ + lem_get_wakeup(dev); + + /* Setup OS specific network interface */ + if (lem_setup_interface(dev, adapter) != 0) + goto err_rx_struct; + + /* Initialize statistics */ + lem_update_stats_counters(adapter); + + adapter->hw.mac.get_link_status = 1; + lem_update_link_status(adapter); + + /* Indicate SOL/IDER usage */ + if (e1000_check_reset_block(&adapter->hw)) + device_printf(dev, + "PHY reset is blocked due to SOL/IDER session.\n"); + + /* Do we need workaround for 82544 PCI-X adapter? */ + if (adapter->hw.bus.type == e1000_bus_type_pcix && + adapter->hw.mac.type == e1000_82544) + adapter->pcix_82544 = TRUE; + else + adapter->pcix_82544 = FALSE; + + /* Register for VLAN events */ + adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, + lem_register_vlan, adapter, EVENTHANDLER_PRI_FIRST); + adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, + lem_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); + + lem_add_hw_stats(adapter); + + /* Non-AMT based hardware can now take control from firmware */ + if (adapter->has_manage && !adapter->has_amt) + lem_get_hw_control(adapter); + + /* Tell the stack that the interface is not active */ + adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + +#ifndef __HAIKU__ + adapter->led_dev = led_create(lem_led_func, adapter, + device_get_nameunit(dev)); +#endif + + INIT_DEBUGOUT("lem_attach: end"); + + return (0); + +err_rx_struct: + lem_free_transmit_structures(adapter); +err_tx_struct: +err_hw_init: + lem_release_hw_control(adapter); + lem_dma_free(adapter, &adapter->rxdma); +err_rx_desc: + lem_dma_free(adapter, &adapter->txdma); +err_tx_desc: +err_pci: + if (adapter->ifp != NULL) + if_free(adapter->ifp); + lem_free_pci_resources(adapter); + free(adapter->mta, M_DEVBUF); + EM_TX_LOCK_DESTROY(adapter); + EM_RX_LOCK_DESTROY(adapter); + EM_CORE_LOCK_DESTROY(adapter); + + return (error); +} + +/********************************************************************* + * Device removal routine + * + * The detach entry point is called when the driver is being removed. + * This routine stops the adapter and deallocates all the resources + * that were allocated for driver operation. + * + * return 0 on success, positive on failure + *********************************************************************/ + +static int +lem_detach(device_t dev) +{ + struct adapter *adapter = device_get_softc(dev); + struct ifnet *ifp = adapter->ifp; + + INIT_DEBUGOUT("em_detach: begin"); + + /* Make sure VLANS are not using driver */ + if (adapter->ifp->if_vlantrunk != NULL) { + device_printf(dev,"Vlan in use, detach first\n"); + return (EBUSY); + } + +#ifdef DEVICE_POLLING + if (ifp->if_capenable & IFCAP_POLLING) + ether_poll_deregister(ifp); +#endif + +#ifndef __HAIKU__ + if (adapter->led_dev != NULL) + led_destroy(adapter->led_dev); +#endif + + EM_CORE_LOCK(adapter); + EM_TX_LOCK(adapter); + adapter->in_detach = 1; + lem_stop(adapter); + e1000_phy_hw_reset(&adapter->hw); + + lem_release_manageability(adapter); + + EM_TX_UNLOCK(adapter); + EM_CORE_UNLOCK(adapter); + + /* Unregister VLAN events */ + if (adapter->vlan_attach != NULL) + EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); + if (adapter->vlan_detach != NULL) + EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); + + ether_ifdetach(adapter->ifp); + callout_drain(&adapter->timer); + callout_drain(&adapter->tx_fifo_timer); + + lem_free_pci_resources(adapter); + bus_generic_detach(dev); + if_free(ifp); + + lem_free_transmit_structures(adapter); + lem_free_receive_structures(adapter); + + /* Free Transmit Descriptor ring */ + if (adapter->tx_desc_base) { + lem_dma_free(adapter, &adapter->txdma); + adapter->tx_desc_base = NULL; + } + + /* Free Receive Descriptor ring */ + if (adapter->rx_desc_base) { + lem_dma_free(adapter, &adapter->rxdma); + adapter->rx_desc_base = NULL; + } + + lem_release_hw_control(adapter); + free(adapter->mta, M_DEVBUF); + EM_TX_LOCK_DESTROY(adapter); + EM_RX_LOCK_DESTROY(adapter); + EM_CORE_LOCK_DESTROY(adapter); + + return (0); +} + +/********************************************************************* + * + * Shutdown entry point + * + **********************************************************************/ + +static int +lem_shutdown(device_t dev) +{ + return lem_suspend(dev); +} + +/* + * Suspend/resume device methods. + */ +static int +lem_suspend(device_t dev) +{ + struct adapter *adapter = device_get_softc(dev); + + EM_CORE_LOCK(adapter); + + lem_release_manageability(adapter); + lem_release_hw_control(adapter); + lem_enable_wakeup(dev); + + EM_CORE_UNLOCK(adapter); + + return bus_generic_suspend(dev); +} + +static int +lem_resume(device_t dev) +{ + struct adapter *adapter = device_get_softc(dev); + struct ifnet *ifp = adapter->ifp; + + EM_CORE_LOCK(adapter); + lem_init_locked(adapter); + lem_init_manageability(adapter); + EM_CORE_UNLOCK(adapter); + lem_start(ifp); + + return bus_generic_resume(dev); +} + + +static void +lem_start_locked(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + struct mbuf *m_head; + + EM_TX_LOCK_ASSERT(adapter); + + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return; + if (!adapter->link_active) + return; + + /* + * Force a cleanup if number of TX descriptors + * available hits the threshold + */ + if (adapter->num_tx_desc_avail <= EM_TX_CLEANUP_THRESHOLD) { + lem_txeof(adapter); + /* Now do we at least have a minimal? */ + if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD) { + adapter->no_tx_desc_avail1++; + return; + } + } + + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) + break; + /* + * Encapsulation can modify our pointer, and or make it + * NULL on failure. In that event, we can't requeue. + */ + if (lem_xmit(adapter, &m_head)) { + if (m_head == NULL) + break; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + break; + } + + /* Send a copy of the frame to the BPF listener */ + ETHER_BPF_MTAP(ifp, m_head); + + /* Set timeout in case hardware has problems transmitting. */ + adapter->watchdog_check = TRUE; + adapter->watchdog_time = ticks; + } + if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + + return; +} + +static void +lem_start(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + + EM_TX_LOCK(adapter); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + lem_start_locked(ifp); + EM_TX_UNLOCK(adapter); +} + +/********************************************************************* + * Ioctl entry point + * + * em_ioctl is called when the user wants to configure the + * interface. + * + * return 0 on success, positive on failure + **********************************************************************/ + +static int +lem_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct adapter *adapter = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *)data; +#ifdef INET + struct ifaddr *ifa = (struct ifaddr *)data; +#endif + int error = 0; + + if (adapter->in_detach) + return (error); + + switch (command) { + case SIOCSIFADDR: +#ifdef INET + if (ifa->ifa_addr->sa_family == AF_INET) { + /* + * XXX + * Since resetting hardware takes a very long time + * and results in link renegotiation we only + * initialize the hardware only when it is absolutely + * required. + */ + ifp->if_flags |= IFF_UP; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + EM_CORE_LOCK(adapter); + lem_init_locked(adapter); + EM_CORE_UNLOCK(adapter); + } + arp_ifinit(ifp, ifa); + } else +#endif + error = ether_ioctl(ifp, command, data); + break; + case SIOCSIFMTU: + { + int max_frame_size; + + IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); + + EM_CORE_LOCK(adapter); + switch (adapter->hw.mac.type) { + case e1000_82542: + max_frame_size = ETHER_MAX_LEN; + break; + default: + max_frame_size = MAX_JUMBO_FRAME_SIZE; + } + if (ifr->ifr_mtu > max_frame_size - ETHER_HDR_LEN - + ETHER_CRC_LEN) { + EM_CORE_UNLOCK(adapter); + error = EINVAL; + break; + } + + ifp->if_mtu = ifr->ifr_mtu; + adapter->max_frame_size = + ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + lem_init_locked(adapter); + EM_CORE_UNLOCK(adapter); + break; + } + case SIOCSIFFLAGS: + IOCTL_DEBUGOUT("ioctl rcv'd:\ + SIOCSIFFLAGS (Set Interface Flags)"); + EM_CORE_LOCK(adapter); + if (ifp->if_flags & IFF_UP) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { + if ((ifp->if_flags ^ adapter->if_flags) & + (IFF_PROMISC | IFF_ALLMULTI)) { + lem_disable_promisc(adapter); + lem_set_promisc(adapter); + } + } else + lem_init_locked(adapter); + } else + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + EM_TX_LOCK(adapter); + lem_stop(adapter); + EM_TX_UNLOCK(adapter); + } + adapter->if_flags = ifp->if_flags; + EM_CORE_UNLOCK(adapter); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + IOCTL_DEBUGOUT("ioctl rcv'd: SIOC(ADD|DEL)MULTI"); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + EM_CORE_LOCK(adapter); + lem_disable_intr(adapter); + lem_set_multi(adapter); + if (adapter->hw.mac.type == e1000_82542 && + adapter->hw.revision_id == E1000_REVISION_2) { + lem_initialize_receive_unit(adapter); + } +#ifdef DEVICE_POLLING + if (!(ifp->if_capenable & IFCAP_POLLING)) +#endif + lem_enable_intr(adapter); + EM_CORE_UNLOCK(adapter); + } + break; + case SIOCSIFMEDIA: + /* Check SOL/IDER usage */ + EM_CORE_LOCK(adapter); + if (e1000_check_reset_block(&adapter->hw)) { + EM_CORE_UNLOCK(adapter); + device_printf(adapter->dev, "Media change is" + " blocked due to SOL/IDER session.\n"); + break; + } + EM_CORE_UNLOCK(adapter); + case SIOCGIFMEDIA: + IOCTL_DEBUGOUT("ioctl rcv'd: \ + SIOCxIFMEDIA (Get/Set Interface Media)"); + error = ifmedia_ioctl(ifp, ifr, &adapter->media, command); + break; + case SIOCSIFCAP: + { + int mask, reinit; + + IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFCAP (Set Capabilities)"); + reinit = 0; + mask = ifr->ifr_reqcap ^ ifp->if_capenable; +#ifdef DEVICE_POLLING + if (mask & IFCAP_POLLING) { + if (ifr->ifr_reqcap & IFCAP_POLLING) { + error = ether_poll_register(lem_poll, ifp); + if (error) + return (error); + EM_CORE_LOCK(adapter); + lem_disable_intr(adapter); + ifp->if_capenable |= IFCAP_POLLING; + EM_CORE_UNLOCK(adapter); + } else { + error = ether_poll_deregister(ifp); + /* Enable interrupt even in error case */ + EM_CORE_LOCK(adapter); + lem_enable_intr(adapter); + ifp->if_capenable &= ~IFCAP_POLLING; + EM_CORE_UNLOCK(adapter); + } + } +#endif + if (mask & IFCAP_HWCSUM) { + ifp->if_capenable ^= IFCAP_HWCSUM; + reinit = 1; + } + if (mask & IFCAP_VLAN_HWTAGGING) { + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + reinit = 1; + } + if ((mask & IFCAP_WOL) && + (ifp->if_capabilities & IFCAP_WOL) != 0) { + if (mask & IFCAP_WOL_MCAST) + ifp->if_capenable ^= IFCAP_WOL_MCAST; + if (mask & IFCAP_WOL_MAGIC) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; + } + if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) + lem_init(adapter); + VLAN_CAPABILITIES(ifp); + break; + } + + default: + error = ether_ioctl(ifp, command, data); + break; + } + + return (error); +} + + +/********************************************************************* + * Init entry point + * + * This routine is used in two ways. It is used by the stack as + * init entry point in network interface structure. It is also used + * by the driver as a hw/sw initialization routine to get to a + * consistent state. + * + * return 0 on success, positive on failure + **********************************************************************/ + +static void +lem_init_locked(struct adapter *adapter) +{ + struct ifnet *ifp = adapter->ifp; + device_t dev = adapter->dev; + u32 pba; + + INIT_DEBUGOUT("lem_init: begin"); + + EM_CORE_LOCK_ASSERT(adapter); + + EM_TX_LOCK(adapter); + lem_stop(adapter); + EM_TX_UNLOCK(adapter); + + /* + * Packet Buffer Allocation (PBA) + * Writing PBA sets the receive portion of the buffer + * the remainder is used for the transmit buffer. + * + * Devices before the 82547 had a Packet Buffer of 64K. + * Default allocation: PBA=48K for Rx, leaving 16K for Tx. + * After the 82547 the buffer was reduced to 40K. + * Default allocation: PBA=30K for Rx, leaving 10K for Tx. + * Note: default does not leave enough room for Jumbo Frame >10k. + */ + switch (adapter->hw.mac.type) { + case e1000_82547: + case e1000_82547_rev_2: /* 82547: Total Packet Buffer is 40K */ + if (adapter->max_frame_size > 8192) + pba = E1000_PBA_22K; /* 22K for Rx, 18K for Tx */ + else + pba = E1000_PBA_30K; /* 30K for Rx, 10K for Tx */ + adapter->tx_fifo_head = 0; + adapter->tx_head_addr = pba << EM_TX_HEAD_ADDR_SHIFT; + adapter->tx_fifo_size = + (E1000_PBA_40K - pba) << EM_PBA_BYTES_SHIFT; + break; + default: + /* Devices before 82547 had a Packet Buffer of 64K. */ + if (adapter->max_frame_size > 8192) + pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ + else + pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ + } + + INIT_DEBUGOUT1("lem_init: pba=%dK",pba); + E1000_WRITE_REG(&adapter->hw, E1000_PBA, pba); + + /* Get the latest mac address, User can use a LAA */ + bcopy(IF_LLADDR(adapter->ifp), adapter->hw.mac.addr, + ETHER_ADDR_LEN); + + /* Put the address into the Receive Address Array */ + e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); + + /* Initialize the hardware */ + if (lem_hardware_init(adapter)) { + device_printf(dev, "Unable to initialize the hardware\n"); + return; + } + lem_update_link_status(adapter); + + /* Setup VLAN support, basic and offload if available */ + E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); + + /* Set hardware offload abilities */ + ifp->if_hwassist = 0; + if (adapter->hw.mac.type >= e1000_82543) { + if (ifp->if_capenable & IFCAP_TXCSUM) + ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); + } + + /* Configure for OS presence */ + lem_init_manageability(adapter); + + /* Prepare transmit descriptors and buffers */ + lem_setup_transmit_structures(adapter); + lem_initialize_transmit_unit(adapter); + + /* Setup Multicast table */ + lem_set_multi(adapter); + + /* Prepare receive descriptors and buffers */ + if (lem_setup_receive_structures(adapter)) { + device_printf(dev, "Could not setup receive structures\n"); + EM_TX_LOCK(adapter); + lem_stop(adapter); + EM_TX_UNLOCK(adapter); + return; + } + lem_initialize_receive_unit(adapter); + + /* Use real VLAN Filter support? */ + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + /* Use real VLAN Filter support */ + lem_setup_vlan_hw_support(adapter); + else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + } + } + + /* Don't lose promiscuous settings */ + lem_set_promisc(adapter); + + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + + callout_reset(&adapter->timer, hz, lem_local_timer, adapter); + e1000_clear_hw_cntrs_base_generic(&adapter->hw); + + /* MSI/X configuration for 82574 */ + if (adapter->hw.mac.type == e1000_82574) { + int tmp; + tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + tmp |= E1000_CTRL_EXT_PBA_CLR; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); + /* + ** Set the IVAR - interrupt vector routing. + ** Each nibble represents a vector, high bit + ** is enable, other 3 bits are the MSIX table + ** entry, we map RXQ0 to 0, TXQ0 to 1, and + ** Link (other) to 2, hence the magic number. + */ + E1000_WRITE_REG(&adapter->hw, E1000_IVAR, 0x800A0908); + } + +#ifdef DEVICE_POLLING + /* + * Only enable interrupts if we are not polling, make sure + * they are off otherwise. + */ + if (ifp->if_capenable & IFCAP_POLLING) + lem_disable_intr(adapter); + else +#endif /* DEVICE_POLLING */ + lem_enable_intr(adapter); + + /* AMT based hardware can now take control from firmware */ + if (adapter->has_manage && adapter->has_amt) + lem_get_hw_control(adapter); + + /* Don't reset the phy next time init gets called */ + adapter->hw.phy.reset_disable = TRUE; +} + +static void +lem_init(void *arg) +{ + struct adapter *adapter = arg; + + EM_CORE_LOCK(adapter); + lem_init_locked(adapter); + EM_CORE_UNLOCK(adapter); +} + + +#ifdef DEVICE_POLLING +/********************************************************************* + * + * Legacy polling routine + * + *********************************************************************/ +static int +lem_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) +{ + struct adapter *adapter = ifp->if_softc; + u32 reg_icr, rx_done = 0; + + EM_CORE_LOCK(adapter); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + EM_CORE_UNLOCK(adapter); + return (rx_done); + } + + if (cmd == POLL_AND_CHECK_STATUS) { + reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { + callout_stop(&adapter->timer); + adapter->hw.mac.get_link_status = 1; + lem_update_link_status(adapter); + callout_reset(&adapter->timer, hz, + lem_local_timer, adapter); + } + } + EM_CORE_UNLOCK(adapter); + + lem_rxeof(adapter, count, &rx_done); + + EM_TX_LOCK(adapter); + lem_txeof(adapter); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + lem_start_locked(ifp); + EM_TX_UNLOCK(adapter); + return (rx_done); +} +#endif /* DEVICE_POLLING */ + +#ifdef EM_LEGACY_IRQ +/********************************************************************* + * + * Legacy Interrupt Service routine + * + *********************************************************************/ +static void +lem_intr(void *arg) +{ + struct adapter *adapter = arg; + struct ifnet *ifp = adapter->ifp; + u32 reg_icr; + + + if (ifp->if_capenable & IFCAP_POLLING) + return; + + EM_CORE_LOCK(adapter); + reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + if (reg_icr & E1000_ICR_RXO) + adapter->rx_overruns++; + + if ((reg_icr == 0xffffffff) || (reg_icr == 0)) + goto out; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto out; + + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { + callout_stop(&adapter->timer); + adapter->hw.mac.get_link_status = 1; + lem_update_link_status(adapter); + /* Deal with TX cruft when link lost */ + lem_tx_purge(adapter); + callout_reset(&adapter->timer, hz, + lem_local_timer, adapter); + goto out; + } + + EM_TX_LOCK(adapter); + lem_rxeof(adapter, -1, NULL); + lem_txeof(adapter); + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + lem_start_locked(ifp); + EM_TX_UNLOCK(adapter); + +out: + EM_CORE_UNLOCK(adapter); + return; +} + +#else /* EM_FAST_IRQ, then fast interrupt routines only */ + +static void +lem_handle_link(void *context, int pending) +{ + struct adapter *adapter = context; + struct ifnet *ifp = adapter->ifp; + + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + return; + + EM_CORE_LOCK(adapter); + callout_stop(&adapter->timer); + lem_update_link_status(adapter); + /* Deal with TX cruft when link lost */ + lem_tx_purge(adapter); + callout_reset(&adapter->timer, hz, lem_local_timer, adapter); + EM_CORE_UNLOCK(adapter); +} + + +/* Combined RX/TX handler, used by Legacy and MSI */ +static void +lem_handle_rxtx(void *context, int pending) +{ + struct adapter *adapter = context; + struct ifnet *ifp = adapter->ifp; + + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + lem_rxeof(adapter, adapter->rx_process_limit, NULL); + EM_TX_LOCK(adapter); + lem_txeof(adapter); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + lem_start_locked(ifp); + EM_TX_UNLOCK(adapter); + } + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + lem_enable_intr(adapter); +} + +/********************************************************************* + * + * Fast Legacy/MSI Combined Interrupt Service routine + * + *********************************************************************/ +static int +lem_irq_fast(void *arg) +{ + struct adapter *adapter = arg; + struct ifnet *ifp; + u32 reg_icr; + + ifp = adapter->ifp; + + reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + + /* Hot eject? */ + if (reg_icr == 0xffffffff) + return FILTER_STRAY; + + /* Definitely not our interrupt. */ + if (reg_icr == 0x0) + return FILTER_STRAY; + + /* + * Mask interrupts until the taskqueue is finished running. This is + * cheap, just assume that it is needed. This also works around the + * MSI message reordering errata on certain systems. + */ + lem_disable_intr(adapter); + taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); + + /* Link status change */ + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { + adapter->hw.mac.get_link_status = 1; + taskqueue_enqueue(taskqueue_fast, &adapter->link_task); + } + + if (reg_icr & E1000_ICR_RXO) + adapter->rx_overruns++; + return FILTER_HANDLED; +} +#endif /* ~EM_LEGACY_IRQ */ + + +/********************************************************************* + * + * Media Ioctl callback + * + * This routine is called whenever the user queries the status of + * the interface using ifconfig. + * + **********************************************************************/ +static void +lem_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct adapter *adapter = ifp->if_softc; + u_char fiber_type = IFM_1000_SX; + + INIT_DEBUGOUT("lem_media_status: begin"); + + EM_CORE_LOCK(adapter); + lem_update_link_status(adapter); + + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; + + if (!adapter->link_active) { + EM_CORE_UNLOCK(adapter); + return; + } + + ifmr->ifm_status |= IFM_ACTIVE; + + if ((adapter->hw.phy.media_type == e1000_media_type_fiber) || + (adapter->hw.phy.media_type == e1000_media_type_internal_serdes)) { + if (adapter->hw.mac.type == e1000_82545) + fiber_type = IFM_1000_LX; + ifmr->ifm_active |= fiber_type | IFM_FDX; + } else { + switch (adapter->link_speed) { + case 10: + ifmr->ifm_active |= IFM_10_T; + break; + case 100: + ifmr->ifm_active |= IFM_100_TX; + break; + case 1000: + ifmr->ifm_active |= IFM_1000_T; + break; + } + if (adapter->link_duplex == FULL_DUPLEX) + ifmr->ifm_active |= IFM_FDX; + else + ifmr->ifm_active |= IFM_HDX; + } + EM_CORE_UNLOCK(adapter); +} + +/********************************************************************* + * + * Media Ioctl callback + * + * This routine is called when the user changes speed/duplex using + * media/mediopt option with ifconfig. + * + **********************************************************************/ +static int +lem_media_change(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + struct ifmedia *ifm = &adapter->media; + + INIT_DEBUGOUT("lem_media_change: begin"); + + if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) + return (EINVAL); + + EM_CORE_LOCK(adapter); + switch (IFM_SUBTYPE(ifm->ifm_media)) { + case IFM_AUTO: + adapter->hw.mac.autoneg = DO_AUTO_NEG; + adapter->hw.phy.autoneg_advertised = AUTONEG_ADV_DEFAULT; + break; + case IFM_1000_LX: + case IFM_1000_SX: + case IFM_1000_T: + adapter->hw.mac.autoneg = DO_AUTO_NEG; + adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL; + break; + case IFM_100_TX: + adapter->hw.mac.autoneg = FALSE; + adapter->hw.phy.autoneg_advertised = 0; + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) + adapter->hw.mac.forced_speed_duplex = ADVERTISE_100_FULL; + else + adapter->hw.mac.forced_speed_duplex = ADVERTISE_100_HALF; + break; + case IFM_10_T: + adapter->hw.mac.autoneg = FALSE; + adapter->hw.phy.autoneg_advertised = 0; + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) + adapter->hw.mac.forced_speed_duplex = ADVERTISE_10_FULL; + else + adapter->hw.mac.forced_speed_duplex = ADVERTISE_10_HALF; + break; + default: + device_printf(adapter->dev, "Unsupported media type\n"); + } + + /* As the speed/duplex settings my have changed we need to + * reset the PHY. + */ + adapter->hw.phy.reset_disable = FALSE; + + lem_init_locked(adapter); + EM_CORE_UNLOCK(adapter); + + return (0); +} + +/********************************************************************* + * + * This routine maps the mbufs to tx descriptors. + * + * return 0 on success, positive on failure + **********************************************************************/ + +static int +lem_xmit(struct adapter *adapter, struct mbuf **m_headp) +{ + bus_dma_segment_t segs[EM_MAX_SCATTER]; + bus_dmamap_t map; + struct em_buffer *tx_buffer, *tx_buffer_mapped; + struct e1000_tx_desc *ctxd = NULL; + struct mbuf *m_head; + u32 txd_upper, txd_lower, txd_used, txd_saved; + int error, nsegs, i, j, first, last = 0; + + m_head = *m_headp; + txd_upper = txd_lower = txd_used = txd_saved = 0; + + /* + ** When doing checksum offload, it is critical to + ** make sure the first mbuf has more than header, + ** because that routine expects data to be present. + */ + if ((m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) && + (m_head->m_len < ETHER_HDR_LEN + sizeof(struct ip))) { + m_head = m_pullup(m_head, ETHER_HDR_LEN + sizeof(struct ip)); + *m_headp = m_head; + if (m_head == NULL) + return (ENOBUFS); + } + + /* + * Map the packet for DMA + * + * Capture the first descriptor index, + * this descriptor will have the index + * of the EOP which is the only one that + * now gets a DONE bit writeback. + */ + first = adapter->next_avail_tx_desc; + tx_buffer = &adapter->tx_buffer_area[first]; + tx_buffer_mapped = tx_buffer; + map = tx_buffer->map; + + error = bus_dmamap_load_mbuf_sg(adapter->txtag, map, + *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); + + /* + * There are two types of errors we can (try) to handle: + * - EFBIG means the mbuf chain was too long and bus_dma ran + * out of segments. Defragment the mbuf chain and try again. + * - ENOMEM means bus_dma could not obtain enough bounce buffers + * at this point in time. Defer sending and try again later. + * All other errors, in particular EINVAL, are fatal and prevent the + * mbuf chain from ever going through. Drop it and report error. + */ + if (error == EFBIG) { + struct mbuf *m; + + m = m_defrag(*m_headp, M_DONTWAIT); + if (m == NULL) { + adapter->mbuf_alloc_failed++; + m_freem(*m_headp); + *m_headp = NULL; + return (ENOBUFS); + } + *m_headp = m; + + /* Try it again */ + error = bus_dmamap_load_mbuf_sg(adapter->txtag, map, + *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); + + if (error) { + adapter->no_tx_dma_setup++; + m_freem(*m_headp); + *m_headp = NULL; + return (error); + } + } else if (error != 0) { + adapter->no_tx_dma_setup++; + return (error); + } + + if (nsegs > (adapter->num_tx_desc_avail - 2)) { + adapter->no_tx_desc_avail2++; + bus_dmamap_unload(adapter->txtag, map); + return (ENOBUFS); + } + m_head = *m_headp; + + /* Do hardware assists */ + if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) + lem_transmit_checksum_setup(adapter, m_head, + &txd_upper, &txd_lower); + + i = adapter->next_avail_tx_desc; + if (adapter->pcix_82544) + txd_saved = i; + + /* Set up our transmit descriptors */ + for (j = 0; j < nsegs; j++) { + bus_size_t seg_len; + bus_addr_t seg_addr; + /* If adapter is 82544 and on PCIX bus */ + if(adapter->pcix_82544) { + DESC_ARRAY desc_array; + u32 array_elements, counter; + /* + * Check the Address and Length combination and + * split the data accordingly + */ + array_elements = lem_fill_descriptors(segs[j].ds_addr, + segs[j].ds_len, &desc_array); + for (counter = 0; counter < array_elements; counter++) { + if (txd_used == adapter->num_tx_desc_avail) { + adapter->next_avail_tx_desc = txd_saved; + adapter->no_tx_desc_avail2++; + bus_dmamap_unload(adapter->txtag, map); + return (ENOBUFS); + } + tx_buffer = &adapter->tx_buffer_area[i]; + ctxd = &adapter->tx_desc_base[i]; + ctxd->buffer_addr = htole64( + desc_array.descriptor[counter].address); + ctxd->lower.data = htole32( + (adapter->txd_cmd | txd_lower | (u16) + desc_array.descriptor[counter].length)); + ctxd->upper.data = + htole32((txd_upper)); + last = i; + if (++i == adapter->num_tx_desc) + i = 0; + tx_buffer->m_head = NULL; + tx_buffer->next_eop = -1; + txd_used++; + } + } else { + tx_buffer = &adapter->tx_buffer_area[i]; + ctxd = &adapter->tx_desc_base[i]; + seg_addr = segs[j].ds_addr; + seg_len = segs[j].ds_len; + ctxd->buffer_addr = htole64(seg_addr); + ctxd->lower.data = htole32( + adapter->txd_cmd | txd_lower | seg_len); + ctxd->upper.data = + htole32(txd_upper); + last = i; + if (++i == adapter->num_tx_desc) + i = 0; + tx_buffer->m_head = NULL; + tx_buffer->next_eop = -1; + } + } + + adapter->next_avail_tx_desc = i; + + if (adapter->pcix_82544) + adapter->num_tx_desc_avail -= txd_used; + else + adapter->num_tx_desc_avail -= nsegs; + + if (m_head->m_flags & M_VLANTAG) { + /* Set the vlan id. */ + ctxd->upper.fields.special = + htole16(m_head->m_pkthdr.ether_vtag); + /* Tell hardware to add tag */ + ctxd->lower.data |= htole32(E1000_TXD_CMD_VLE); + } + + tx_buffer->m_head = m_head; + tx_buffer_mapped->map = tx_buffer->map; + tx_buffer->map = map; + bus_dmamap_sync(adapter->txtag, map, BUS_DMASYNC_PREWRITE); + + /* + * Last Descriptor of Packet + * needs End Of Packet (EOP) + * and Report Status (RS) + */ + ctxd->lower.data |= + htole32(E1000_TXD_CMD_EOP | E1000_TXD_CMD_RS); + /* + * Keep track in the first buffer which + * descriptor will be written back + */ + tx_buffer = &adapter->tx_buffer_area[first]; + tx_buffer->next_eop = last; + adapter->watchdog_time = ticks; + + /* + * Advance the Transmit Descriptor Tail (TDT), this tells the E1000 + * that this frame is available to transmit. + */ + bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if (adapter->hw.mac.type == e1000_82547 && + adapter->link_duplex == HALF_DUPLEX) + lem_82547_move_tail(adapter); + else { + E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), i); + if (adapter->hw.mac.type == e1000_82547) + lem_82547_update_fifo_head(adapter, + m_head->m_pkthdr.len); + } + + return (0); +} + +/********************************************************************* + * + * 82547 workaround to avoid controller hang in half-duplex environment. + * The workaround is to avoid queuing a large packet that would span + * the internal Tx FIFO ring boundary. We need to reset the FIFO pointers + * in this case. We do that only when FIFO is quiescent. + * + **********************************************************************/ +static void +lem_82547_move_tail(void *arg) +{ + struct adapter *adapter = arg; + struct e1000_tx_desc *tx_desc; + u16 hw_tdt, sw_tdt, length = 0; + bool eop = 0; + + EM_TX_LOCK_ASSERT(adapter); + + hw_tdt = E1000_READ_REG(&adapter->hw, E1000_TDT(0)); + sw_tdt = adapter->next_avail_tx_desc; + + while (hw_tdt != sw_tdt) { + tx_desc = &adapter->tx_desc_base[hw_tdt]; + length += tx_desc->lower.flags.length; + eop = tx_desc->lower.data & E1000_TXD_CMD_EOP; + if (++hw_tdt == adapter->num_tx_desc) + hw_tdt = 0; + + if (eop) { + if (lem_82547_fifo_workaround(adapter, length)) { + adapter->tx_fifo_wrk_cnt++; + callout_reset(&adapter->tx_fifo_timer, 1, + lem_82547_move_tail, adapter); + break; + } + E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), hw_tdt); + lem_82547_update_fifo_head(adapter, length); + length = 0; + } + } +} + +static int +lem_82547_fifo_workaround(struct adapter *adapter, int len) +{ + int fifo_space, fifo_pkt_len; + + fifo_pkt_len = roundup2(len + EM_FIFO_HDR, EM_FIFO_HDR); + + if (adapter->link_duplex == HALF_DUPLEX) { + fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head; + + if (fifo_pkt_len >= (EM_82547_PKT_THRESH + fifo_space)) { + if (lem_82547_tx_fifo_reset(adapter)) + return (0); + else + return (1); + } + } + + return (0); +} + +static void +lem_82547_update_fifo_head(struct adapter *adapter, int len) +{ + int fifo_pkt_len = roundup2(len + EM_FIFO_HDR, EM_FIFO_HDR); + + /* tx_fifo_head is always 16 byte aligned */ + adapter->tx_fifo_head += fifo_pkt_len; + if (adapter->tx_fifo_head >= adapter->tx_fifo_size) { + adapter->tx_fifo_head -= adapter->tx_fifo_size; + } +} + + +static int +lem_82547_tx_fifo_reset(struct adapter *adapter) +{ + u32 tctl; + + if ((E1000_READ_REG(&adapter->hw, E1000_TDT(0)) == + E1000_READ_REG(&adapter->hw, E1000_TDH(0))) && + (E1000_READ_REG(&adapter->hw, E1000_TDFT) == + E1000_READ_REG(&adapter->hw, E1000_TDFH)) && + (E1000_READ_REG(&adapter->hw, E1000_TDFTS) == + E1000_READ_REG(&adapter->hw, E1000_TDFHS)) && + (E1000_READ_REG(&adapter->hw, E1000_TDFPC) == 0)) { + /* Disable TX unit */ + tctl = E1000_READ_REG(&adapter->hw, E1000_TCTL); + E1000_WRITE_REG(&adapter->hw, E1000_TCTL, + tctl & ~E1000_TCTL_EN); + + /* Reset FIFO pointers */ + E1000_WRITE_REG(&adapter->hw, E1000_TDFT, + adapter->tx_head_addr); + E1000_WRITE_REG(&adapter->hw, E1000_TDFH, + adapter->tx_head_addr); + E1000_WRITE_REG(&adapter->hw, E1000_TDFTS, + adapter->tx_head_addr); + E1000_WRITE_REG(&adapter->hw, E1000_TDFHS, + adapter->tx_head_addr); + + /* Re-enable TX unit */ + E1000_WRITE_REG(&adapter->hw, E1000_TCTL, tctl); + E1000_WRITE_FLUSH(&adapter->hw); + + adapter->tx_fifo_head = 0; + adapter->tx_fifo_reset_cnt++; + + return (TRUE); + } + else { + return (FALSE); + } +} + +static void +lem_set_promisc(struct adapter *adapter) +{ + struct ifnet *ifp = adapter->ifp; + u32 reg_rctl; + + reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + + if (ifp->if_flags & IFF_PROMISC) { + reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); + /* Turn this on if you want to see bad packets */ + if (lem_debug_sbp) + reg_rctl |= E1000_RCTL_SBP; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } else if (ifp->if_flags & IFF_ALLMULTI) { + reg_rctl |= E1000_RCTL_MPE; + reg_rctl &= ~E1000_RCTL_UPE; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } +} + +static void +lem_disable_promisc(struct adapter *adapter) +{ + u32 reg_rctl; + + reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + + reg_rctl &= (~E1000_RCTL_UPE); + reg_rctl &= (~E1000_RCTL_MPE); + reg_rctl &= (~E1000_RCTL_SBP); + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); +} + + +/********************************************************************* + * Multicast Update + * + * This routine is called whenever multicast address list is updated. + * + **********************************************************************/ + +static void +lem_set_multi(struct adapter *adapter) +{ + struct ifnet *ifp = adapter->ifp; + struct ifmultiaddr *ifma; + u32 reg_rctl = 0; + u8 *mta; /* Multicast array memory */ + int mcnt = 0; + + IOCTL_DEBUGOUT("lem_set_multi: begin"); + + mta = adapter->mta; + bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES); + + if (adapter->hw.mac.type == e1000_82542 && + adapter->hw.revision_id == E1000_REVISION_2) { + reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + if (adapter->hw.bus.pci_cmd_word & CMD_MEM_WRT_INVALIDATE) + e1000_pci_clear_mwi(&adapter->hw); + reg_rctl |= E1000_RCTL_RST; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + msec_delay(5); + } + +#if __FreeBSD_version < 800000 + IF_ADDR_LOCK(ifp); +#else + if_maddr_rlock(ifp); +#endif + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + + if (mcnt == MAX_NUM_MULTICAST_ADDRESSES) + break; + + bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), + &mta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN); + mcnt++; + } +#if __FreeBSD_version < 800000 + IF_ADDR_UNLOCK(ifp); +#else + if_maddr_runlock(ifp); +#endif + if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { + reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + reg_rctl |= E1000_RCTL_MPE; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } else + e1000_update_mc_addr_list(&adapter->hw, mta, mcnt); + + if (adapter->hw.mac.type == e1000_82542 && + adapter->hw.revision_id == E1000_REVISION_2) { + reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + reg_rctl &= ~E1000_RCTL_RST; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + msec_delay(5); + if (adapter->hw.bus.pci_cmd_word & CMD_MEM_WRT_INVALIDATE) + e1000_pci_set_mwi(&adapter->hw); + } +} + + +/********************************************************************* + * Timer routine + * + * This routine checks for link status and updates statistics. + * + **********************************************************************/ + +static void +lem_local_timer(void *arg) +{ + struct adapter *adapter = arg; + + EM_CORE_LOCK_ASSERT(adapter); + + lem_update_link_status(adapter); + lem_update_stats_counters(adapter); + + lem_smartspeed(adapter); + + /* + * We check the watchdog: the time since + * the last TX descriptor was cleaned. + * This implies a functional TX engine. + */ + if ((adapter->watchdog_check == TRUE) && + (ticks - adapter->watchdog_time > EM_WATCHDOG)) + goto hung; + + callout_reset(&adapter->timer, hz, lem_local_timer, adapter); + return; +hung: + device_printf(adapter->dev, "Watchdog timeout -- resetting\n"); + adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + adapter->watchdog_events++; + lem_init_locked(adapter); +} + +static void +lem_update_link_status(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + struct ifnet *ifp = adapter->ifp; + device_t dev = adapter->dev; + u32 link_check = 0; + + /* Get the cached link value or read phy for real */ + switch (hw->phy.media_type) { + case e1000_media_type_copper: + if (hw->mac.get_link_status) { + /* Do the work to read phy */ + e1000_check_for_link(hw); + link_check = !hw->mac.get_link_status; + if (link_check) /* ESB2 fix */ + e1000_cfg_on_link_up(hw); + } else + link_check = TRUE; + break; + case e1000_media_type_fiber: + e1000_check_for_link(hw); + link_check = (E1000_READ_REG(hw, E1000_STATUS) & + E1000_STATUS_LU); + break; + case e1000_media_type_internal_serdes: + e1000_check_for_link(hw); + link_check = adapter->hw.mac.serdes_has_link; + break; + default: + case e1000_media_type_unknown: + break; + } + + /* Now check for a transition */ + if (link_check && (adapter->link_active == 0)) { + e1000_get_speed_and_duplex(hw, &adapter->link_speed, + &adapter->link_duplex); + if (bootverbose) + device_printf(dev, "Link is up %d Mbps %s\n", + adapter->link_speed, + ((adapter->link_duplex == FULL_DUPLEX) ? + "Full Duplex" : "Half Duplex")); + adapter->link_active = 1; + adapter->smartspeed = 0; + ifp->if_baudrate = adapter->link_speed * 1000000; + if_link_state_change(ifp, LINK_STATE_UP); + } else if (!link_check && (adapter->link_active == 1)) { + ifp->if_baudrate = adapter->link_speed = 0; + adapter->link_duplex = 0; + if (bootverbose) + device_printf(dev, "Link is Down\n"); + adapter->link_active = 0; + /* Link down, disable watchdog */ + adapter->watchdog_check = FALSE; + if_link_state_change(ifp, LINK_STATE_DOWN); + } +} + +/********************************************************************* + * + * This routine disables all traffic on the adapter by issuing a + * global reset on the MAC and deallocates TX/RX buffers. + * + * This routine should always be called with BOTH the CORE + * and TX locks. + **********************************************************************/ + +static void +lem_stop(void *arg) +{ + struct adapter *adapter = arg; + struct ifnet *ifp = adapter->ifp; + + EM_CORE_LOCK_ASSERT(adapter); + EM_TX_LOCK_ASSERT(adapter); + + INIT_DEBUGOUT("lem_stop: begin"); + + lem_disable_intr(adapter); + callout_stop(&adapter->timer); + callout_stop(&adapter->tx_fifo_timer); + + /* Tell the stack that the interface is no longer active */ + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + e1000_reset_hw(&adapter->hw); + if (adapter->hw.mac.type >= e1000_82544) + E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); + + e1000_led_off(&adapter->hw); + e1000_cleanup_led(&adapter->hw); +} + + +/********************************************************************* + * + * Determine hardware revision. + * + **********************************************************************/ +static void +lem_identify_hardware(struct adapter *adapter) +{ + device_t dev = adapter->dev; + + /* Make sure our PCI config space has the necessary stuff set */ + adapter->hw.bus.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2); + if (!((adapter->hw.bus.pci_cmd_word & PCIM_CMD_BUSMASTEREN) && + (adapter->hw.bus.pci_cmd_word & PCIM_CMD_MEMEN))) { + device_printf(dev, "Memory Access and/or Bus Master bits " + "were not set!\n"); + adapter->hw.bus.pci_cmd_word |= + (PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN); + pci_write_config(dev, PCIR_COMMAND, + adapter->hw.bus.pci_cmd_word, 2); + } + + /* Save off the information about this board */ + adapter->hw.vendor_id = pci_get_vendor(dev); + adapter->hw.device_id = pci_get_device(dev); + adapter->hw.revision_id = pci_read_config(dev, PCIR_REVID, 1); + adapter->hw.subsystem_vendor_id = + pci_read_config(dev, PCIR_SUBVEND_0, 2); + adapter->hw.subsystem_device_id = + pci_read_config(dev, PCIR_SUBDEV_0, 2); + + /* Do Shared Code Init and Setup */ + if (e1000_set_mac_type(&adapter->hw)) { + device_printf(dev, "Setup init failure\n"); + return; + } +} + +static int +lem_allocate_pci_resources(struct adapter *adapter) +{ + device_t dev = adapter->dev; + int val, rid, error = E1000_SUCCESS; + + rid = PCIR_BAR(0); + adapter->memory = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); + if (adapter->memory == NULL) { + device_printf(dev, "Unable to allocate bus resource: memory\n"); + return (ENXIO); + } + adapter->osdep.mem_bus_space_tag = + rman_get_bustag(adapter->memory); + adapter->osdep.mem_bus_space_handle = + rman_get_bushandle(adapter->memory); + adapter->hw.hw_addr = (u8 *)&adapter->osdep.mem_bus_space_handle; + + /* Only older adapters use IO mapping */ + if (adapter->hw.mac.type > e1000_82543) { + /* Figure our where our IO BAR is ? */ + for (rid = PCIR_BAR(0); rid < PCIR_CIS;) { + val = pci_read_config(dev, rid, 4); + if (EM_BAR_TYPE(val) == EM_BAR_TYPE_IO) { + adapter->io_rid = rid; + break; + } + rid += 4; + /* check for 64bit BAR */ + if (EM_BAR_MEM_TYPE(val) == EM_BAR_MEM_TYPE_64BIT) + rid += 4; + } + if (rid >= PCIR_CIS) { + device_printf(dev, "Unable to locate IO BAR\n"); + return (ENXIO); + } + adapter->ioport = bus_alloc_resource_any(dev, + SYS_RES_IOPORT, &adapter->io_rid, RF_ACTIVE); + if (adapter->ioport == NULL) { + device_printf(dev, "Unable to allocate bus resource: " + "ioport\n"); + return (ENXIO); + } + adapter->hw.io_base = 0; + adapter->osdep.io_bus_space_tag = + rman_get_bustag(adapter->ioport); + adapter->osdep.io_bus_space_handle = + rman_get_bushandle(adapter->ioport); + } + + adapter->hw.back = &adapter->osdep; + + return (error); +} + +/********************************************************************* + * + * Setup the Legacy or MSI Interrupt handler + * + **********************************************************************/ +int +lem_allocate_irq(struct adapter *adapter) +{ + device_t dev = adapter->dev; + int error, rid = 0; + + /* Manually turn off all interrupts */ + E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); + + /* We allocate a single interrupt resource */ + adapter->res[0] = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); + if (adapter->res[0] == NULL) { + device_printf(dev, "Unable to allocate bus resource: " + "interrupt\n"); + return (ENXIO); + } + +#ifdef EM_LEGACY_IRQ + /* We do Legacy setup */ + if ((error = bus_setup_intr(dev, adapter->res[0], + INTR_TYPE_NET | INTR_MPSAFE, NULL, lem_intr, adapter, + &adapter->tag[0])) != 0) { + device_printf(dev, "Failed to register interrupt handler"); + return (error); + } + +#else /* FAST_IRQ */ + /* + * Try allocating a fast interrupt and the associated deferred + * processing contexts. + */ + TASK_INIT(&adapter->rxtx_task, 0, lem_handle_rxtx, adapter); + TASK_INIT(&adapter->link_task, 0, lem_handle_link, adapter); + adapter->tq = taskqueue_create_fast("lem_taskq", M_NOWAIT, + taskqueue_thread_enqueue, &adapter->tq); + taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", + device_get_nameunit(adapter->dev)); + if ((error = bus_setup_intr(dev, adapter->res[0], + INTR_TYPE_NET, lem_irq_fast, NULL, adapter, + &adapter->tag[0])) != 0) { + device_printf(dev, "Failed to register fast interrupt " + "handler: %d\n", error); + taskqueue_free(adapter->tq); + adapter->tq = NULL; + return (error); + } +#endif /* EM_LEGACY_IRQ */ + + return (0); +} + + +static void +lem_free_pci_resources(struct adapter *adapter) +{ + device_t dev = adapter->dev; + + + if (adapter->tag[0] != NULL) { + bus_teardown_intr(dev, adapter->res[0], + adapter->tag[0]); + adapter->tag[0] = NULL; + } + + if (adapter->res[0] != NULL) { + bus_release_resource(dev, SYS_RES_IRQ, + 0, adapter->res[0]); + } + + if (adapter->memory != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + PCIR_BAR(0), adapter->memory); + + if (adapter->ioport != NULL) + bus_release_resource(dev, SYS_RES_IOPORT, + adapter->io_rid, adapter->ioport); +} + + +/********************************************************************* + * + * Initialize the hardware to a configuration + * as specified by the adapter structure. + * + **********************************************************************/ +static int +lem_hardware_init(struct adapter *adapter) +{ + device_t dev = adapter->dev; + u16 rx_buffer_size; + + INIT_DEBUGOUT("lem_hardware_init: begin"); + + /* Issue a global reset */ + e1000_reset_hw(&adapter->hw); + + /* When hardware is reset, fifo_head is also reset */ + adapter->tx_fifo_head = 0; + + /* + * These parameters control the automatic generation (Tx) and + * response (Rx) to Ethernet PAUSE frames. + * - High water mark should allow for at least two frames to be + * received after sending an XOFF. + * - Low water mark works best when it is very near the high water mark. + * This allows the receiver to restart by sending XON when it has + * drained a bit. Here we use an arbitary value of 1500 which will + * restart after one full frame is pulled from the buffer. There + * could be several smaller frames in the buffer and if so they will + * not trigger the XON until their total number reduces the buffer + * by 1500. + * - The pause time is fairly large at 1000 x 512ns = 512 usec. + */ + rx_buffer_size = ((E1000_READ_REG(&adapter->hw, E1000_PBA) & + 0xffff) << 10 ); + + adapter->hw.fc.high_water = rx_buffer_size - + roundup2(adapter->max_frame_size, 1024); + adapter->hw.fc.low_water = adapter->hw.fc.high_water - 1500; + + adapter->hw.fc.pause_time = EM_FC_PAUSE_TIME; + adapter->hw.fc.send_xon = TRUE; + + /* Set Flow control, use the tunable location if sane */ + if ((lem_fc_setting >= 0) && (lem_fc_setting < 4)) + adapter->hw.fc.requested_mode = lem_fc_setting; + else + adapter->hw.fc.requested_mode = e1000_fc_none; + + if (e1000_init_hw(&adapter->hw) < 0) { + device_printf(dev, "Hardware Initialization Failed\n"); + return (EIO); + } + + e1000_check_for_link(&adapter->hw); + + return (0); +} + +/********************************************************************* + * + * Setup networking device structure and register an interface. + * + **********************************************************************/ +static int +lem_setup_interface(device_t dev, struct adapter *adapter) +{ + struct ifnet *ifp; + + INIT_DEBUGOUT("lem_setup_interface: begin"); + + ifp = adapter->ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "can not allocate ifnet structure\n"); + return (-1); + } + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_mtu = ETHERMTU; + ifp->if_init = lem_init; + ifp->if_softc = adapter; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = lem_ioctl; + ifp->if_start = lem_start; + IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1); + ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1; + IFQ_SET_READY(&ifp->if_snd); + + ether_ifattach(ifp, adapter->hw.mac.addr); + + ifp->if_capabilities = ifp->if_capenable = 0; + + if (adapter->hw.mac.type >= e1000_82543) { + ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; + ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; + } + + /* + * Tell the upper layer(s) we support long frames. + */ + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + + /* + ** Dont turn this on by default, if vlans are + ** created on another pseudo device (eg. lagg) + ** then vlan events are not passed thru, breaking + ** operation, but with HW FILTER off it works. If + ** using vlans directly on the em driver you can + ** enable this and get full hardware tag filtering. + */ + ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; + +#ifdef DEVICE_POLLING + ifp->if_capabilities |= IFCAP_POLLING; +#endif + + /* Enable only WOL MAGIC by default */ + if (adapter->wol) { + ifp->if_capabilities |= IFCAP_WOL; + ifp->if_capenable |= IFCAP_WOL_MAGIC; + } + + /* + * Specify the media types supported by this adapter and register + * callbacks to update media and link information + */ + ifmedia_init(&adapter->media, IFM_IMASK, + lem_media_change, lem_media_status); + if ((adapter->hw.phy.media_type == e1000_media_type_fiber) || + (adapter->hw.phy.media_type == e1000_media_type_internal_serdes)) { + u_char fiber_type = IFM_1000_SX; /* default type */ + + if (adapter->hw.mac.type == e1000_82545) + fiber_type = IFM_1000_LX; + ifmedia_add(&adapter->media, IFM_ETHER | fiber_type | IFM_FDX, + 0, NULL); + ifmedia_add(&adapter->media, IFM_ETHER | fiber_type, 0, NULL); + } else { + ifmedia_add(&adapter->media, IFM_ETHER | IFM_10_T, 0, NULL); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_10_T | IFM_FDX, + 0, NULL); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_100_TX, + 0, NULL); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_100_TX | IFM_FDX, + 0, NULL); + if (adapter->hw.phy.type != e1000_phy_ife) { + ifmedia_add(&adapter->media, + IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); + ifmedia_add(&adapter->media, + IFM_ETHER | IFM_1000_T, 0, NULL); + } + } + ifmedia_add(&adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO); + return (0); +} + + +/********************************************************************* + * + * Workaround for SmartSpeed on 82541 and 82547 controllers + * + **********************************************************************/ +static void +lem_smartspeed(struct adapter *adapter) +{ + u16 phy_tmp; + + if (adapter->link_active || (adapter->hw.phy.type != e1000_phy_igp) || + adapter->hw.mac.autoneg == 0 || + (adapter->hw.phy.autoneg_advertised & ADVERTISE_1000_FULL) == 0) + return; + + if (adapter->smartspeed == 0) { + /* If Master/Slave config fault is asserted twice, + * we assume back-to-back */ + e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_tmp); + if (!(phy_tmp & SR_1000T_MS_CONFIG_FAULT)) + return; + e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_tmp); + if (phy_tmp & SR_1000T_MS_CONFIG_FAULT) { + e1000_read_phy_reg(&adapter->hw, + PHY_1000T_CTRL, &phy_tmp); + if(phy_tmp & CR_1000T_MS_ENABLE) { + phy_tmp &= ~CR_1000T_MS_ENABLE; + e1000_write_phy_reg(&adapter->hw, + PHY_1000T_CTRL, phy_tmp); + adapter->smartspeed++; + if(adapter->hw.mac.autoneg && + !e1000_copper_link_autoneg(&adapter->hw) && + !e1000_read_phy_reg(&adapter->hw, + PHY_CONTROL, &phy_tmp)) { + phy_tmp |= (MII_CR_AUTO_NEG_EN | + MII_CR_RESTART_AUTO_NEG); + e1000_write_phy_reg(&adapter->hw, + PHY_CONTROL, phy_tmp); + } + } + } + return; + } else if(adapter->smartspeed == EM_SMARTSPEED_DOWNSHIFT) { + /* If still no link, perhaps using 2/3 pair cable */ + e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_tmp); + phy_tmp |= CR_1000T_MS_ENABLE; + e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_tmp); + if(adapter->hw.mac.autoneg && + !e1000_copper_link_autoneg(&adapter->hw) && + !e1000_read_phy_reg(&adapter->hw, PHY_CONTROL, &phy_tmp)) { + phy_tmp |= (MII_CR_AUTO_NEG_EN | + MII_CR_RESTART_AUTO_NEG); + e1000_write_phy_reg(&adapter->hw, PHY_CONTROL, phy_tmp); + } + } + /* Restart process after EM_SMARTSPEED_MAX iterations */ + if(adapter->smartspeed++ == EM_SMARTSPEED_MAX) + adapter->smartspeed = 0; +} + + +/* + * Manage DMA'able memory. + */ +static void +lem_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + if (error) + return; + *(bus_addr_t *) arg = segs[0].ds_addr; +} + +static int +lem_dma_malloc(struct adapter *adapter, bus_size_t size, + struct em_dma_alloc *dma, int mapflags) +{ + int error; + + error = bus_dma_tag_create(bus_get_dma_tag(adapter->dev), /* parent */ + EM_DBA_ALIGN, 0, /* alignment, bounds */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + size, /* maxsize */ + 1, /* nsegments */ + size, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockarg */ + &dma->dma_tag); + if (error) { + device_printf(adapter->dev, + "%s: bus_dma_tag_create failed: %d\n", + __func__, error); + goto fail_0; + } + + error = bus_dmamem_alloc(dma->dma_tag, (void**) &dma->dma_vaddr, + BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &dma->dma_map); + if (error) { + device_printf(adapter->dev, + "%s: bus_dmamem_alloc(%ju) failed: %d\n", + __func__, (uintmax_t)size, error); + goto fail_2; + } + + dma->dma_paddr = 0; + error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, + size, lem_dmamap_cb, &dma->dma_paddr, mapflags | BUS_DMA_NOWAIT); + if (error || dma->dma_paddr == 0) { + device_printf(adapter->dev, + "%s: bus_dmamap_load failed: %d\n", + __func__, error); + goto fail_3; + } + + return (0); + +fail_3: + bus_dmamap_unload(dma->dma_tag, dma->dma_map); +fail_2: + bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); + bus_dma_tag_destroy(dma->dma_tag); +fail_0: + dma->dma_map = NULL; + dma->dma_tag = NULL; + + return (error); +} + +static void +lem_dma_free(struct adapter *adapter, struct em_dma_alloc *dma) +{ + if (dma->dma_tag == NULL) + return; + if (dma->dma_map != NULL) { + bus_dmamap_sync(dma->dma_tag, dma->dma_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(dma->dma_tag, dma->dma_map); + bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); + dma->dma_map = NULL; + } + bus_dma_tag_destroy(dma->dma_tag); + dma->dma_tag = NULL; +} + + +/********************************************************************* + * + * Allocate memory for tx_buffer structures. The tx_buffer stores all + * the information needed to transmit a packet on the wire. + * + **********************************************************************/ +static int +lem_allocate_transmit_structures(struct adapter *adapter) +{ + device_t dev = adapter->dev; + struct em_buffer *tx_buffer; + int error; + int i = 0; + + /* + * Create DMA tags for tx descriptors + */ + if ((error = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ + 1, 0, /* alignment, bounds */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES * EM_MAX_SCATTER, /* maxsize */ + EM_MAX_SCATTER, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockarg */ + &adapter->txtag)) != 0) { + device_printf(dev, "Unable to allocate TX DMA tag\n"); + goto fail; + } + + adapter->tx_buffer_area = malloc(sizeof(struct em_buffer) * + adapter->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO); + if (adapter->tx_buffer_area == NULL) { + device_printf(dev, "Unable to allocate tx_buffer memory\n"); + error = ENOMEM; + goto fail; + } + + /* Create the descriptor buffer dma maps */ + for (i = 0; i < adapter->num_tx_desc; i++) { + tx_buffer = &adapter->tx_buffer_area[i]; + error = bus_dmamap_create(adapter->txtag, 0, &tx_buffer->map); + if (error != 0) { + device_printf(dev, "Unable to create TX DMA map\n"); + goto fail; + } + tx_buffer->next_eop = -1; + } + + return (0); +fail: + lem_free_transmit_structures(adapter); + return (error); +} + +/********************************************************************* + * + * (Re)Initialize transmit structures. + * + **********************************************************************/ +static void +lem_setup_transmit_structures(struct adapter *adapter) +{ + struct em_buffer *tx_buffer; + int i = 0; + + /* Clear the old ring contents */ + bzero(adapter->tx_desc_base, + (sizeof(struct e1000_tx_desc)) * adapter->num_tx_desc); + + /* Free any existing TX buffers */ + for (i = 0; i < adapter->num_tx_desc; i++, tx_buffer++) { + tx_buffer = &adapter->tx_buffer_area[i]; + bus_dmamap_sync(adapter->txtag, tx_buffer->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(adapter->txtag, tx_buffer->map); + m_freem(tx_buffer->m_head); + tx_buffer->m_head = NULL; + tx_buffer->next_eop = -1; + } + + /* Reset state */ + adapter->next_avail_tx_desc = 0; + adapter->next_tx_to_clean = 0; + adapter->num_tx_desc_avail = adapter->num_tx_desc; + + bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + return; +} + +/********************************************************************* + * + * Enable transmit unit. + * + **********************************************************************/ +static void +lem_initialize_transmit_unit(struct adapter *adapter) +{ + u32 tctl, tipg = 0; + u64 bus_addr; + + INIT_DEBUGOUT("lem_initialize_transmit_unit: begin"); + /* Setup the Base and Length of the Tx Descriptor Ring */ + bus_addr = adapter->txdma.dma_paddr; + E1000_WRITE_REG(&adapter->hw, E1000_TDLEN(0), + adapter->num_tx_desc * sizeof(struct e1000_tx_desc)); + E1000_WRITE_REG(&adapter->hw, E1000_TDBAH(0), + (u32)(bus_addr >> 32)); + E1000_WRITE_REG(&adapter->hw, E1000_TDBAL(0), + (u32)bus_addr); + /* Setup the HW Tx Head and Tail descriptor pointers */ + E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), 0); + E1000_WRITE_REG(&adapter->hw, E1000_TDH(0), 0); + + HW_DEBUGOUT2("Base = %x, Length = %x\n", + E1000_READ_REG(&adapter->hw, E1000_TDBAL(0)), + E1000_READ_REG(&adapter->hw, E1000_TDLEN(0))); + + /* Set the default values for the Tx Inter Packet Gap timer */ + switch (adapter->hw.mac.type) { + case e1000_82542: + tipg = DEFAULT_82542_TIPG_IPGT; + tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; + tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; + break; + default: + if ((adapter->hw.phy.media_type == e1000_media_type_fiber) || + (adapter->hw.phy.media_type == + e1000_media_type_internal_serdes)) + tipg = DEFAULT_82543_TIPG_IPGT_FIBER; + else + tipg = DEFAULT_82543_TIPG_IPGT_COPPER; + tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; + tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; + } + + E1000_WRITE_REG(&adapter->hw, E1000_TIPG, tipg); + E1000_WRITE_REG(&adapter->hw, E1000_TIDV, adapter->tx_int_delay.value); + if(adapter->hw.mac.type >= e1000_82540) + E1000_WRITE_REG(&adapter->hw, E1000_TADV, + adapter->tx_abs_int_delay.value); + + /* Program the Transmit Control Register */ + tctl = E1000_READ_REG(&adapter->hw, E1000_TCTL); + tctl &= ~E1000_TCTL_CT; + tctl |= (E1000_TCTL_PSP | E1000_TCTL_RTLC | E1000_TCTL_EN | + (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT)); + + /* This write will effectively turn on the transmit unit. */ + E1000_WRITE_REG(&adapter->hw, E1000_TCTL, tctl); + + /* Setup Transmit Descriptor Base Settings */ + adapter->txd_cmd = E1000_TXD_CMD_IFCS; + + if (adapter->tx_int_delay.value > 0) + adapter->txd_cmd |= E1000_TXD_CMD_IDE; +} + +/********************************************************************* + * + * Free all transmit related data structures. + * + **********************************************************************/ +static void +lem_free_transmit_structures(struct adapter *adapter) +{ + struct em_buffer *tx_buffer; + int i = 0; + + INIT_DEBUGOUT("free_transmit_structures: begin"); + + if (adapter->tx_buffer_area != NULL) { + for (i = 0; i < adapter->num_tx_desc; i++) { + tx_buffer = &adapter->tx_buffer_area[i]; + if (tx_buffer->m_head != NULL) { + bus_dmamap_sync(adapter->txtag, tx_buffer->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(adapter->txtag, + tx_buffer->map); + m_freem(tx_buffer->m_head); + tx_buffer->m_head = NULL; + } else if (tx_buffer->map != NULL) + bus_dmamap_unload(adapter->txtag, + tx_buffer->map); + if (tx_buffer->map != NULL) { + bus_dmamap_destroy(adapter->txtag, + tx_buffer->map); + tx_buffer->map = NULL; + } + } + } + if (adapter->tx_buffer_area != NULL) { + free(adapter->tx_buffer_area, M_DEVBUF); + adapter->tx_buffer_area = NULL; + } + if (adapter->txtag != NULL) { + bus_dma_tag_destroy(adapter->txtag); + adapter->txtag = NULL; + } + +#ifndef __HAIKU__ +#if __FreeBSD_version >= 800000 + if (adapter->br != NULL) + buf_ring_free(adapter->br, M_DEVBUF); +#endif +#endif +} + +/********************************************************************* + * + * The offload context needs to be set when we transfer the first + * packet of a particular protocol (TCP/UDP). This routine has been + * enhanced to deal with inserted VLAN headers, and IPV6 (not complete) + * + * Added back the old method of keeping the current context type + * and not setting if unnecessary, as this is reported to be a + * big performance win. -jfv + **********************************************************************/ +static void +lem_transmit_checksum_setup(struct adapter *adapter, struct mbuf *mp, + u32 *txd_upper, u32 *txd_lower) +{ + struct e1000_context_desc *TXD = NULL; + struct em_buffer *tx_buffer; + struct ether_vlan_header *eh; + struct ip *ip = NULL; + struct ip6_hdr *ip6; + int curr_txd, ehdrlen; + u32 cmd, hdr_len, ip_hlen; + u16 etype; + u8 ipproto; + + + cmd = hdr_len = ipproto = 0; + *txd_upper = *txd_lower = 0; + curr_txd = adapter->next_avail_tx_desc; + + /* + * Determine where frame payload starts. + * Jump over vlan headers if already present, + * helpful for QinQ too. + */ + eh = mtod(mp, struct ether_vlan_header *); + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + etype = ntohs(eh->evl_proto); + ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + etype = ntohs(eh->evl_encap_proto); + ehdrlen = ETHER_HDR_LEN; + } + + /* + * We only support TCP/UDP for IPv4 and IPv6 for the moment. + * TODO: Support SCTP too when it hits the tree. + */ + switch (etype) { + case ETHERTYPE_IP: + ip = (struct ip *)(mp->m_data + ehdrlen); + ip_hlen = ip->ip_hl << 2; + + /* Setup of IP header checksum. */ + if (mp->m_pkthdr.csum_flags & CSUM_IP) { + /* + * Start offset for header checksum calculation. + * End offset for header checksum calculation. + * Offset of place to put the checksum. + */ + TXD = (struct e1000_context_desc *) + &adapter->tx_desc_base[curr_txd]; + TXD->lower_setup.ip_fields.ipcss = ehdrlen; + TXD->lower_setup.ip_fields.ipcse = + htole16(ehdrlen + ip_hlen); + TXD->lower_setup.ip_fields.ipcso = + ehdrlen + offsetof(struct ip, ip_sum); + cmd |= E1000_TXD_CMD_IP; + *txd_upper |= E1000_TXD_POPTS_IXSM << 8; + } + + hdr_len = ehdrlen + ip_hlen; + ipproto = ip->ip_p; + + break; + case ETHERTYPE_IPV6: + ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); + ip_hlen = sizeof(struct ip6_hdr); /* XXX: No header stacking. */ + + /* IPv6 doesn't have a header checksum. */ + + hdr_len = ehdrlen + ip_hlen; + ipproto = ip6->ip6_nxt; + break; + + default: + return; + } + + switch (ipproto) { + case IPPROTO_TCP: + if (mp->m_pkthdr.csum_flags & CSUM_TCP) { + *txd_lower = E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; + *txd_upper |= E1000_TXD_POPTS_TXSM << 8; + /* no need for context if already set */ + if (adapter->last_hw_offload == CSUM_TCP) + return; + adapter->last_hw_offload = CSUM_TCP; + /* + * Start offset for payload checksum calculation. + * End offset for payload checksum calculation. + * Offset of place to put the checksum. + */ + TXD = (struct e1000_context_desc *) + &adapter->tx_desc_base[curr_txd]; + TXD->upper_setup.tcp_fields.tucss = hdr_len; + TXD->upper_setup.tcp_fields.tucse = htole16(0); + TXD->upper_setup.tcp_fields.tucso = + hdr_len + offsetof(struct tcphdr, th_sum); + cmd |= E1000_TXD_CMD_TCP; + } + break; + case IPPROTO_UDP: + { + if (mp->m_pkthdr.csum_flags & CSUM_UDP) { + *txd_lower = E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; + *txd_upper |= E1000_TXD_POPTS_TXSM << 8; + /* no need for context if already set */ + if (adapter->last_hw_offload == CSUM_UDP) + return; + adapter->last_hw_offload = CSUM_UDP; + /* + * Start offset for header checksum calculation. + * End offset for header checksum calculation. + * Offset of place to put the checksum. + */ + TXD = (struct e1000_context_desc *) + &adapter->tx_desc_base[curr_txd]; + TXD->upper_setup.tcp_fields.tucss = hdr_len; + TXD->upper_setup.tcp_fields.tucse = htole16(0); + TXD->upper_setup.tcp_fields.tucso = + hdr_len + offsetof(struct udphdr, uh_sum); + } + /* Fall Thru */ + } + default: + break; + } + + if (TXD == NULL) + return; + TXD->tcp_seg_setup.data = htole32(0); + TXD->cmd_and_length = + htole32(adapter->txd_cmd | E1000_TXD_CMD_DEXT | cmd); + tx_buffer = &adapter->tx_buffer_area[curr_txd]; + tx_buffer->m_head = NULL; + tx_buffer->next_eop = -1; + + if (++curr_txd == adapter->num_tx_desc) + curr_txd = 0; + + adapter->num_tx_desc_avail--; + adapter->next_avail_tx_desc = curr_txd; +} + + +/********************************************************************** + * + * Examine each tx_buffer in the used queue. If the hardware is done + * processing the packet then free associated resources. The + * tx_buffer is put back on the free queue. + * + **********************************************************************/ +static void +lem_txeof(struct adapter *adapter) +{ + int first, last, done, num_avail; + struct em_buffer *tx_buffer; + struct e1000_tx_desc *tx_desc, *eop_desc; + struct ifnet *ifp = adapter->ifp; + + EM_TX_LOCK_ASSERT(adapter); + + if (adapter->num_tx_desc_avail == adapter->num_tx_desc) + return; + + num_avail = adapter->num_tx_desc_avail; + first = adapter->next_tx_to_clean; + tx_desc = &adapter->tx_desc_base[first]; + tx_buffer = &adapter->tx_buffer_area[first]; + last = tx_buffer->next_eop; + eop_desc = &adapter->tx_desc_base[last]; + + /* + * What this does is get the index of the + * first descriptor AFTER the EOP of the + * first packet, that way we can do the + * simple comparison on the inner while loop. + */ + if (++last == adapter->num_tx_desc) + last = 0; + done = last; + + bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, + BUS_DMASYNC_POSTREAD); + + while (eop_desc->upper.fields.status & E1000_TXD_STAT_DD) { + /* We clean the range of the packet */ + while (first != done) { + tx_desc->upper.data = 0; + tx_desc->lower.data = 0; + tx_desc->buffer_addr = 0; + ++num_avail; + + if (tx_buffer->m_head) { + ifp->if_opackets++; + bus_dmamap_sync(adapter->txtag, + tx_buffer->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(adapter->txtag, + tx_buffer->map); + + m_freem(tx_buffer->m_head); + tx_buffer->m_head = NULL; + } + tx_buffer->next_eop = -1; + adapter->watchdog_time = ticks; + + if (++first == adapter->num_tx_desc) + first = 0; + + tx_buffer = &adapter->tx_buffer_area[first]; + tx_desc = &adapter->tx_desc_base[first]; + } + /* See if we can continue to the next packet */ + last = tx_buffer->next_eop; + if (last != -1) { + eop_desc = &adapter->tx_desc_base[last]; + /* Get new done point */ + if (++last == adapter->num_tx_desc) last = 0; + done = last; + } else + break; + } + bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + adapter->next_tx_to_clean = first; + adapter->num_tx_desc_avail = num_avail; + + /* + * If we have enough room, clear IFF_DRV_OACTIVE to + * tell the stack that it is OK to send packets. + * If there are no pending descriptors, clear the watchdog. + */ + if (adapter->num_tx_desc_avail > EM_TX_CLEANUP_THRESHOLD) { + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if (adapter->num_tx_desc_avail == adapter->num_tx_desc) { + adapter->watchdog_check = FALSE; + return; + } + } +} + +/********************************************************************* + * + * When Link is lost sometimes there is work still in the TX ring + * which may result in a watchdog, rather than allow that we do an + * attempted cleanup and then reinit here. Note that this has been + * seens mostly with fiber adapters. + * + **********************************************************************/ +static void +lem_tx_purge(struct adapter *adapter) +{ + if ((!adapter->link_active) && (adapter->watchdog_check)) { + EM_TX_LOCK(adapter); + lem_txeof(adapter); + EM_TX_UNLOCK(adapter); + if (adapter->watchdog_check) /* Still outstanding? */ + lem_init_locked(adapter); + } +} + +/********************************************************************* + * + * Get a buffer from system mbuf buffer pool. + * + **********************************************************************/ +static int +lem_get_buf(struct adapter *adapter, int i) +{ + struct mbuf *m; + bus_dma_segment_t segs[1]; + bus_dmamap_t map; + struct em_buffer *rx_buffer; + int error, nsegs; + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) { + adapter->mbuf_cluster_failed++; + return (ENOBUFS); + } + m->m_len = m->m_pkthdr.len = MCLBYTES; + + if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) + m_adj(m, ETHER_ALIGN); + + /* + * Using memory from the mbuf cluster pool, invoke the + * bus_dma machinery to arrange the memory mapping. + */ + error = bus_dmamap_load_mbuf_sg(adapter->rxtag, + adapter->rx_sparemap, m, segs, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + m_free(m); + return (error); + } + + /* If nsegs is wrong then the stack is corrupt. */ + KASSERT(nsegs == 1, ("Too many segments returned!")); + + rx_buffer = &adapter->rx_buffer_area[i]; + if (rx_buffer->m_head != NULL) + bus_dmamap_unload(adapter->rxtag, rx_buffer->map); + + map = rx_buffer->map; + rx_buffer->map = adapter->rx_sparemap; + adapter->rx_sparemap = map; + bus_dmamap_sync(adapter->rxtag, rx_buffer->map, BUS_DMASYNC_PREREAD); + rx_buffer->m_head = m; + + adapter->rx_desc_base[i].buffer_addr = htole64(segs[0].ds_addr); + return (0); +} + +/********************************************************************* + * + * Allocate memory for rx_buffer structures. Since we use one + * rx_buffer per received packet, the maximum number of rx_buffer's + * that we'll need is equal to the number of receive descriptors + * that we've allocated. + * + **********************************************************************/ +static int +lem_allocate_receive_structures(struct adapter *adapter) +{ + device_t dev = adapter->dev; + struct em_buffer *rx_buffer; + int i, error; + + adapter->rx_buffer_area = malloc(sizeof(struct em_buffer) * + adapter->num_rx_desc, M_DEVBUF, M_NOWAIT | M_ZERO); + if (adapter->rx_buffer_area == NULL) { + device_printf(dev, "Unable to allocate rx_buffer memory\n"); + return (ENOMEM); + } + + error = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ + 1, 0, /* alignment, bounds */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES, /* maxsize */ + 1, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockarg */ + &adapter->rxtag); + if (error) { + device_printf(dev, "%s: bus_dma_tag_create failed %d\n", + __func__, error); + goto fail; + } + + /* Create the spare map (used by getbuf) */ + error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT, + &adapter->rx_sparemap); + if (error) { + device_printf(dev, "%s: bus_dmamap_create failed: %d\n", + __func__, error); + goto fail; + } + + rx_buffer = adapter->rx_buffer_area; + for (i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) { + error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT, + &rx_buffer->map); + if (error) { + device_printf(dev, "%s: bus_dmamap_create failed: %d\n", + __func__, error); + goto fail; + } + } + + return (0); + +fail: + lem_free_receive_structures(adapter); + return (error); +} + +/********************************************************************* + * + * (Re)initialize receive structures. + * + **********************************************************************/ +static int +lem_setup_receive_structures(struct adapter *adapter) +{ + struct em_buffer *rx_buffer; + int i, error; + + /* Reset descriptor ring */ + bzero(adapter->rx_desc_base, + (sizeof(struct e1000_rx_desc)) * adapter->num_rx_desc); + + /* Free current RX buffers. */ + rx_buffer = adapter->rx_buffer_area; + for (i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) { + if (rx_buffer->m_head != NULL) { + bus_dmamap_sync(adapter->rxtag, rx_buffer->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(adapter->rxtag, rx_buffer->map); + m_freem(rx_buffer->m_head); + rx_buffer->m_head = NULL; + } + } + + /* Allocate new ones. */ + for (i = 0; i < adapter->num_rx_desc; i++) { + error = lem_get_buf(adapter, i); + if (error) + return (error); + } + + /* Setup our descriptor pointers */ + adapter->next_rx_desc_to_check = 0; + bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + return (0); +} + +/********************************************************************* + * + * Enable receive unit. + * + **********************************************************************/ +#define MAX_INTS_PER_SEC 8000 +#define DEFAULT_ITR 1000000000/(MAX_INTS_PER_SEC * 256) + +static void +lem_initialize_receive_unit(struct adapter *adapter) +{ + struct ifnet *ifp = adapter->ifp; + u64 bus_addr; + u32 rctl, rxcsum; + int i = 0; + + INIT_DEBUGOUT("lem_initialize_receive_unit: begin"); + + /* + * Make sure receives are disabled while setting + * up the descriptor ring + */ + rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + + if (adapter->hw.mac.type >= e1000_82540) { + E1000_WRITE_REG(&adapter->hw, E1000_RADV, + adapter->rx_abs_int_delay.value); + /* + * Set the interrupt throttling rate. Value is calculated + * as DEFAULT_ITR = 1/(MAX_INTS_PER_SEC * 256ns) + */ + E1000_WRITE_REG(&adapter->hw, E1000_ITR, DEFAULT_ITR); + } + + /* + ** When using MSIX interrupts we need to throttle + ** using the EITR register (82574 only) + */ + if (adapter->msix) + for (i = 0; i < 4; i++) + E1000_WRITE_REG(&adapter->hw, + E1000_EITR_82574(i), DEFAULT_ITR); + + /* Disable accelerated ackknowledge */ + if (adapter->hw.mac.type == e1000_82574) + E1000_WRITE_REG(&adapter->hw, + E1000_RFCTL, E1000_RFCTL_ACK_DIS); + + /* Setup the Base and Length of the Rx Descriptor Ring */ + bus_addr = adapter->rxdma.dma_paddr; + E1000_WRITE_REG(&adapter->hw, E1000_RDLEN(0), + adapter->num_rx_desc * sizeof(struct e1000_rx_desc)); + E1000_WRITE_REG(&adapter->hw, E1000_RDBAH(0), + (u32)(bus_addr >> 32)); + E1000_WRITE_REG(&adapter->hw, E1000_RDBAL(0), + (u32)bus_addr); + + /* Setup the Receive Control Register */ + rctl &= ~(3 << E1000_RCTL_MO_SHIFT); + rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_LBM_NO | + E1000_RCTL_RDMTS_HALF | + (adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT); + + /* Make sure VLAN Filters are off */ + rctl &= ~E1000_RCTL_VFE; + + if (e1000_tbi_sbp_enabled_82543(&adapter->hw)) + rctl |= E1000_RCTL_SBP; + else + rctl &= ~E1000_RCTL_SBP; + + switch (adapter->rx_buffer_len) { + default: + case 2048: + rctl |= E1000_RCTL_SZ_2048; + break; + case 4096: + rctl |= E1000_RCTL_SZ_4096 | + E1000_RCTL_BSEX | E1000_RCTL_LPE; + break; + case 8192: + rctl |= E1000_RCTL_SZ_8192 | + E1000_RCTL_BSEX | E1000_RCTL_LPE; + break; + case 16384: + rctl |= E1000_RCTL_SZ_16384 | + E1000_RCTL_BSEX | E1000_RCTL_LPE; + break; + } + + if (ifp->if_mtu > ETHERMTU) + rctl |= E1000_RCTL_LPE; + else + rctl &= ~E1000_RCTL_LPE; + + /* Enable 82543 Receive Checksum Offload for TCP and UDP */ + if ((adapter->hw.mac.type >= e1000_82543) && + (ifp->if_capenable & IFCAP_RXCSUM)) { + rxcsum = E1000_READ_REG(&adapter->hw, E1000_RXCSUM); + rxcsum |= (E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); + E1000_WRITE_REG(&adapter->hw, E1000_RXCSUM, rxcsum); + } + + /* Enable Receives */ + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); + + /* + * Setup the HW Rx Head and + * Tail Descriptor Pointers + */ + E1000_WRITE_REG(&adapter->hw, E1000_RDH(0), 0); + E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), adapter->num_rx_desc - 1); + + return; +} + +/********************************************************************* + * + * Free receive related data structures. + * + **********************************************************************/ +static void +lem_free_receive_structures(struct adapter *adapter) +{ + struct em_buffer *rx_buffer; + int i; + + INIT_DEBUGOUT("free_receive_structures: begin"); + + if (adapter->rx_sparemap) { + bus_dmamap_destroy(adapter->rxtag, adapter->rx_sparemap); + adapter->rx_sparemap = NULL; + } + + /* Cleanup any existing buffers */ + if (adapter->rx_buffer_area != NULL) { + rx_buffer = adapter->rx_buffer_area; + for (i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) { + if (rx_buffer->m_head != NULL) { + bus_dmamap_sync(adapter->rxtag, rx_buffer->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(adapter->rxtag, + rx_buffer->map); + m_freem(rx_buffer->m_head); + rx_buffer->m_head = NULL; + } else if (rx_buffer->map != NULL) + bus_dmamap_unload(adapter->rxtag, + rx_buffer->map); + if (rx_buffer->map != NULL) { + bus_dmamap_destroy(adapter->rxtag, + rx_buffer->map); + rx_buffer->map = NULL; + } + } + } + + if (adapter->rx_buffer_area != NULL) { + free(adapter->rx_buffer_area, M_DEVBUF); + adapter->rx_buffer_area = NULL; + } + + if (adapter->rxtag != NULL) { + bus_dma_tag_destroy(adapter->rxtag); + adapter->rxtag = NULL; + } +} + +/********************************************************************* + * + * This routine executes in interrupt context. It replenishes + * the mbufs in the descriptor and sends data which has been + * dma'ed into host memory to upper layer. + * + * We loop at most count times if count is > 0, or until done if + * count < 0. + * + * For polling we also now return the number of cleaned packets + *********************************************************************/ +static bool +lem_rxeof(struct adapter *adapter, int count, int *done) +{ + struct ifnet *ifp = adapter->ifp; + struct mbuf *mp; + u8 status = 0, accept_frame = 0, eop = 0; + u16 len, desc_len, prev_len_adj; + int i, rx_sent = 0; + struct e1000_rx_desc *current_desc; + + EM_RX_LOCK(adapter); + i = adapter->next_rx_desc_to_check; + current_desc = &adapter->rx_desc_base[i]; + bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, + BUS_DMASYNC_POSTREAD); + + if (!((current_desc->status) & E1000_RXD_STAT_DD)) { + if (done != NULL) + *done = rx_sent; + EM_RX_UNLOCK(adapter); + return (FALSE); + } + + while (count != 0 && ifp->if_drv_flags & IFF_DRV_RUNNING) { + struct mbuf *m = NULL; + + status = current_desc->status; + if ((status & E1000_RXD_STAT_DD) == 0) + break; + + mp = adapter->rx_buffer_area[i].m_head; + /* + * Can't defer bus_dmamap_sync(9) because TBI_ACCEPT + * needs to access the last received byte in the mbuf. + */ + bus_dmamap_sync(adapter->rxtag, adapter->rx_buffer_area[i].map, + BUS_DMASYNC_POSTREAD); + + accept_frame = 1; + prev_len_adj = 0; + desc_len = le16toh(current_desc->length); + if (status & E1000_RXD_STAT_EOP) { + count--; + eop = 1; + if (desc_len < ETHER_CRC_LEN) { + len = 0; + prev_len_adj = ETHER_CRC_LEN - desc_len; + } else + len = desc_len - ETHER_CRC_LEN; + } else { + eop = 0; + len = desc_len; + } + + if (current_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK) { + u8 last_byte; + u32 pkt_len = desc_len; + + if (adapter->fmp != NULL) + pkt_len += adapter->fmp->m_pkthdr.len; + + last_byte = *(mtod(mp, caddr_t) + desc_len - 1); + if (TBI_ACCEPT(&adapter->hw, status, + current_desc->errors, pkt_len, last_byte, + adapter->min_frame_size, adapter->max_frame_size)) { + e1000_tbi_adjust_stats_82543(&adapter->hw, + &adapter->stats, pkt_len, + adapter->hw.mac.addr, + adapter->max_frame_size); + if (len > 0) + len--; + } else + accept_frame = 0; + } + + if (accept_frame) { + if (lem_get_buf(adapter, i) != 0) { + ifp->if_iqdrops++; + goto discard; + } + + /* Assign correct length to the current fragment */ + mp->m_len = len; + + if (adapter->fmp == NULL) { + mp->m_pkthdr.len = len; + adapter->fmp = mp; /* Store the first mbuf */ + adapter->lmp = mp; + } else { + /* Chain mbuf's together */ + mp->m_flags &= ~M_PKTHDR; + /* + * Adjust length of previous mbuf in chain if + * we received less than 4 bytes in the last + * descriptor. + */ + if (prev_len_adj > 0) { + adapter->lmp->m_len -= prev_len_adj; + adapter->fmp->m_pkthdr.len -= + prev_len_adj; + } + adapter->lmp->m_next = mp; + adapter->lmp = adapter->lmp->m_next; + adapter->fmp->m_pkthdr.len += len; + } + + if (eop) { + adapter->fmp->m_pkthdr.rcvif = ifp; + ifp->if_ipackets++; + lem_receive_checksum(adapter, current_desc, + adapter->fmp); +#ifndef __NO_STRICT_ALIGNMENT + if (adapter->max_frame_size > + (MCLBYTES - ETHER_ALIGN) && + lem_fixup_rx(adapter) != 0) + goto skip; +#endif + if (status & E1000_RXD_STAT_VP) { + adapter->fmp->m_pkthdr.ether_vtag = + (le16toh(current_desc->special) & + E1000_RXD_SPC_VLAN_MASK); + adapter->fmp->m_flags |= M_VLANTAG; + } +#ifndef __NO_STRICT_ALIGNMENT +skip: +#endif + m = adapter->fmp; + adapter->fmp = NULL; + adapter->lmp = NULL; + } + } else { + ifp->if_ierrors++; +discard: + /* Reuse loaded DMA map and just update mbuf chain */ + mp = adapter->rx_buffer_area[i].m_head; + mp->m_len = mp->m_pkthdr.len = MCLBYTES; + mp->m_data = mp->m_ext.ext_buf; + mp->m_next = NULL; + if (adapter->max_frame_size <= + (MCLBYTES - ETHER_ALIGN)) + m_adj(mp, ETHER_ALIGN); + if (adapter->fmp != NULL) { + m_freem(adapter->fmp); + adapter->fmp = NULL; + adapter->lmp = NULL; + } + m = NULL; + } + + /* Zero out the receive descriptors status. */ + current_desc->status = 0; + bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + /* Advance our pointers to the next descriptor. */ + if (++i == adapter->num_rx_desc) + i = 0; + /* Call into the stack */ + if (m != NULL) { + adapter->next_rx_desc_to_check = i; + EM_RX_UNLOCK(adapter); + (*ifp->if_input)(ifp, m); + EM_RX_LOCK(adapter); + rx_sent++; + i = adapter->next_rx_desc_to_check; + } + current_desc = &adapter->rx_desc_base[i]; + } + adapter->next_rx_desc_to_check = i; + + /* Advance the E1000's Receive Queue #0 "Tail Pointer". */ + if (--i < 0) + i = adapter->num_rx_desc - 1; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), i); + if (done != NULL) + *done = rx_sent; + EM_RX_UNLOCK(adapter); + return ((status & E1000_RXD_STAT_DD) ? TRUE : FALSE); +} + +#ifndef __NO_STRICT_ALIGNMENT +/* + * When jumbo frames are enabled we should realign entire payload on + * architecures with strict alignment. This is serious design mistake of 8254x + * as it nullifies DMA operations. 8254x just allows RX buffer size to be + * 2048/4096/8192/16384. What we really want is 2048 - ETHER_ALIGN to align its + * payload. On architecures without strict alignment restrictions 8254x still + * performs unaligned memory access which would reduce the performance too. + * To avoid copying over an entire frame to align, we allocate a new mbuf and + * copy ethernet header to the new mbuf. The new mbuf is prepended into the + * existing mbuf chain. + * + * Be aware, best performance of the 8254x is achived only when jumbo frame is + * not used at all on architectures with strict alignment. + */ +static int +lem_fixup_rx(struct adapter *adapter) +{ + struct mbuf *m, *n; + int error; + + error = 0; + m = adapter->fmp; + if (m->m_len <= (MCLBYTES - ETHER_HDR_LEN)) { + bcopy(m->m_data, m->m_data + ETHER_HDR_LEN, m->m_len); + m->m_data += ETHER_HDR_LEN; + } else { + MGETHDR(n, M_DONTWAIT, MT_DATA); + if (n != NULL) { + bcopy(m->m_data, n->m_data, ETHER_HDR_LEN); + m->m_data += ETHER_HDR_LEN; + m->m_len -= ETHER_HDR_LEN; + n->m_len = ETHER_HDR_LEN; + M_MOVE_PKTHDR(n, m); + n->m_next = m; + adapter->fmp = n; + } else { + adapter->dropped_pkts++; + m_freem(adapter->fmp); + adapter->fmp = NULL; + error = ENOMEM; + } + } + + return (error); +} +#endif + +/********************************************************************* + * + * Verify that the hardware indicated that the checksum is valid. + * Inform the stack about the status of checksum so that stack + * doesn't spend time verifying the checksum. + * + *********************************************************************/ +static void +lem_receive_checksum(struct adapter *adapter, + struct e1000_rx_desc *rx_desc, struct mbuf *mp) +{ + /* 82543 or newer only */ + if ((adapter->hw.mac.type < e1000_82543) || + /* Ignore Checksum bit is set */ + (rx_desc->status & E1000_RXD_STAT_IXSM)) { + mp->m_pkthdr.csum_flags = 0; + return; + } + + if (rx_desc->status & E1000_RXD_STAT_IPCS) { + /* Did it pass? */ + if (!(rx_desc->errors & E1000_RXD_ERR_IPE)) { + /* IP Checksum Good */ + mp->m_pkthdr.csum_flags = CSUM_IP_CHECKED; + mp->m_pkthdr.csum_flags |= CSUM_IP_VALID; + + } else { + mp->m_pkthdr.csum_flags = 0; + } + } + + if (rx_desc->status & E1000_RXD_STAT_TCPCS) { + /* Did it pass? */ + if (!(rx_desc->errors & E1000_RXD_ERR_TCPE)) { + mp->m_pkthdr.csum_flags |= + (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); + mp->m_pkthdr.csum_data = htons(0xffff); + } + } +} + +/* + * This routine is run via an vlan + * config EVENT + */ +static void +lem_register_vlan(void *arg, struct ifnet *ifp, u16 vtag) +{ + struct adapter *adapter = ifp->if_softc; + u32 index, bit; + + if (ifp->if_softc != arg) /* Not our event */ + return; + + if ((vtag == 0) || (vtag > 4095)) /* Invalid ID */ + return; + + EM_CORE_LOCK(adapter); + index = (vtag >> 5) & 0x7F; + bit = vtag & 0x1F; + adapter->shadow_vfta[index] |= (1 << bit); + ++adapter->num_vlans; + /* Re-init to load the changes */ + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + lem_init_locked(adapter); + EM_CORE_UNLOCK(adapter); +} + +/* + * This routine is run via an vlan + * unconfig EVENT + */ +static void +lem_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag) +{ + struct adapter *adapter = ifp->if_softc; + u32 index, bit; + + if (ifp->if_softc != arg) + return; + + if ((vtag == 0) || (vtag > 4095)) /* Invalid */ + return; + + EM_CORE_LOCK(adapter); + index = (vtag >> 5) & 0x7F; + bit = vtag & 0x1F; + adapter->shadow_vfta[index] &= ~(1 << bit); + --adapter->num_vlans; + /* Re-init to load the changes */ + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + lem_init_locked(adapter); + EM_CORE_UNLOCK(adapter); +} + +static void +lem_setup_vlan_hw_support(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + int i = 0; + + /* + ** We get here thru init_locked, meaning + ** a soft reset, this has already cleared + ** the VFTA and other state, so if there + ** have been no vlan's registered do nothing. + */ + if (adapter->num_vlans == 0) + return; + + /* + ** A soft reset zero's out the VFTA, so + ** we need to repopulate it now. + */ + for (i = 0; i < EM_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) + E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, + i, adapter->shadow_vfta[i]); + + reg = E1000_READ_REG(hw, E1000_CTRL); + reg |= E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + + /* Enable the Filter Table */ + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~E1000_RCTL_CFIEN; + reg |= E1000_RCTL_VFE; + E1000_WRITE_REG(hw, E1000_RCTL, reg); + + /* Update the frame size */ + E1000_WRITE_REG(&adapter->hw, E1000_RLPML, + adapter->max_frame_size + VLAN_TAG_SIZE); +} + +static void +lem_enable_intr(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 ims_mask = IMS_ENABLE_MASK; + + if (adapter->msix) { + E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK); + ims_mask |= EM_MSIX_MASK; + } + E1000_WRITE_REG(hw, E1000_IMS, ims_mask); +} + +static void +lem_disable_intr(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + + if (adapter->msix) + E1000_WRITE_REG(hw, EM_EIAC, 0); + E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); +} + +/* + * Bit of a misnomer, what this really means is + * to enable OS management of the system... aka + * to disable special hardware management features + */ +static void +lem_init_manageability(struct adapter *adapter) +{ + /* A shared code workaround */ + if (adapter->has_manage) { + int manc = E1000_READ_REG(&adapter->hw, E1000_MANC); + /* disable hardware interception of ARP */ + manc &= ~(E1000_MANC_ARP_EN); + E1000_WRITE_REG(&adapter->hw, E1000_MANC, manc); + } +} + +/* + * Give control back to hardware management + * controller if there is one. + */ +static void +lem_release_manageability(struct adapter *adapter) +{ + if (adapter->has_manage) { + int manc = E1000_READ_REG(&adapter->hw, E1000_MANC); + + /* re-enable hardware interception of ARP */ + manc |= E1000_MANC_ARP_EN; + E1000_WRITE_REG(&adapter->hw, E1000_MANC, manc); + } +} + +/* + * lem_get_hw_control sets the {CTRL_EXT|FWSM}:DRV_LOAD bit. + * For ASF and Pass Through versions of f/w this means + * that the driver is loaded. For AMT version type f/w + * this means that the network i/f is open. + */ +static void +lem_get_hw_control(struct adapter *adapter) +{ + u32 ctrl_ext; + + ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, + ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); + return; +} + +/* + * lem_release_hw_control resets {CTRL_EXT|FWSM}:DRV_LOAD bit. + * For ASF and Pass Through versions of f/w this means that + * the driver is no longer loaded. For AMT versions of the + * f/w this means that the network i/f is closed. + */ +static void +lem_release_hw_control(struct adapter *adapter) +{ + u32 ctrl_ext; + + if (!adapter->has_manage) + return; + + ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, + ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); + return; +} + +static int +lem_is_valid_ether_addr(u8 *addr) +{ + char zero_addr[6] = { 0, 0, 0, 0, 0, 0 }; + + if ((addr[0] & 1) || (!bcmp(addr, zero_addr, ETHER_ADDR_LEN))) { + return (FALSE); + } + + return (TRUE); +} + +/* +** Parse the interface capabilities with regard +** to both system management and wake-on-lan for +** later use. +*/ +static void +lem_get_wakeup(device_t dev) +{ + struct adapter *adapter = device_get_softc(dev); + u16 eeprom_data = 0, device_id, apme_mask; + + adapter->has_manage = e1000_enable_mng_pass_thru(&adapter->hw); + apme_mask = EM_EEPROM_APME; + + switch (adapter->hw.mac.type) { + case e1000_82542: + case e1000_82543: + break; + case e1000_82544: + e1000_read_nvm(&adapter->hw, + NVM_INIT_CONTROL2_REG, 1, &eeprom_data); + apme_mask = EM_82544_APME; + break; + case e1000_82546: + case e1000_82546_rev_3: + if (adapter->hw.bus.func == 1) { + e1000_read_nvm(&adapter->hw, + NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); + break; + } else + e1000_read_nvm(&adapter->hw, + NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); + break; + default: + e1000_read_nvm(&adapter->hw, + NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); + break; + } + if (eeprom_data & apme_mask) + adapter->wol = (E1000_WUFC_MAG | E1000_WUFC_MC); + /* + * We have the eeprom settings, now apply the special cases + * where the eeprom may be wrong or the board won't support + * wake on lan on a particular port + */ + device_id = pci_get_device(dev); + switch (device_id) { + case E1000_DEV_ID_82546GB_PCIE: + adapter->wol = 0; + break; + case E1000_DEV_ID_82546EB_FIBER: + case E1000_DEV_ID_82546GB_FIBER: + /* Wake events only supported on port A for dual fiber + * regardless of eeprom setting */ + if (E1000_READ_REG(&adapter->hw, E1000_STATUS) & + E1000_STATUS_FUNC_1) + adapter->wol = 0; + break; + case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: + /* if quad port adapter, disable WoL on all but port A */ + if (global_quad_port_a != 0) + adapter->wol = 0; + /* Reset for multiple quad port adapters */ + if (++global_quad_port_a == 4) + global_quad_port_a = 0; + break; + } + return; +} + + +/* + * Enable PCI Wake On Lan capability + */ +static void +lem_enable_wakeup(device_t dev) +{ + struct adapter *adapter = device_get_softc(dev); + struct ifnet *ifp = adapter->ifp; + u32 pmc, ctrl, ctrl_ext, rctl; + u16 status; + + if ((pci_find_extcap(dev, PCIY_PMG, &pmc) != 0)) + return; + + /* Advertise the wakeup capability */ + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); + + /* Keep the laser running on Fiber adapters */ + if (adapter->hw.phy.media_type == e1000_media_type_fiber || + adapter->hw.phy.media_type == e1000_media_type_internal_serdes) { + ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + ctrl_ext |= E1000_CTRL_EXT_SDP3_DATA; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, ctrl_ext); + } + + /* + ** Determine type of Wakeup: note that wol + ** is set with all bits on by default. + */ + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) == 0) + adapter->wol &= ~E1000_WUFC_MAG; + + if ((ifp->if_capenable & IFCAP_WOL_MCAST) == 0) + adapter->wol &= ~E1000_WUFC_MC; + else { + rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + rctl |= E1000_RCTL_MPE; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); + } + + if (adapter->hw.mac.type == e1000_pchlan) { + if (lem_enable_phy_wakeup(adapter)) + return; + } else { + E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); + E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); + } + + + /* Request PME */ + status = pci_read_config(dev, pmc + PCIR_POWER_STATUS, 2); + status &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if (ifp->if_capenable & IFCAP_WOL) + status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(dev, pmc + PCIR_POWER_STATUS, status, 2); + + return; +} + +/* +** WOL in the newer chipset interfaces (pchlan) +** require thing to be copied into the phy +*/ +static int +lem_enable_phy_wakeup(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 mreg, ret = 0; + u16 preg; + int i = 0; + + /* copy MAC RARs to PHY RARs */ + for (i = 0; i < adapter->hw.mac.rar_entry_count; i++) { + mreg = E1000_READ_REG(hw, E1000_RAL(i)); + e1000_write_phy_reg(hw, BM_RAR_L(i), (u16)(mreg & 0xFFFF)); + e1000_write_phy_reg(hw, BM_RAR_M(i), + (u16)((mreg >> 16) & 0xFFFF)); + mreg = E1000_READ_REG(hw, E1000_RAH(i)); + e1000_write_phy_reg(hw, BM_RAR_H(i), (u16)(mreg & 0xFFFF)); + e1000_write_phy_reg(hw, BM_RAR_CTRL(i), + (u16)((mreg >> 16) & 0xFFFF)); + } + + /* copy MAC MTA to PHY MTA */ + for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) { + mreg = E1000_READ_REG_ARRAY(hw, E1000_MTA, i); + e1000_write_phy_reg(hw, BM_MTA(i), (u16)(mreg & 0xFFFF)); + e1000_write_phy_reg(hw, BM_MTA(i) + 1, + (u16)((mreg >> 16) & 0xFFFF)); + } + + /* configure PHY Rx Control register */ + e1000_read_phy_reg(&adapter->hw, BM_RCTL, &preg); + mreg = E1000_READ_REG(hw, E1000_RCTL); + if (mreg & E1000_RCTL_UPE) + preg |= BM_RCTL_UPE; + if (mreg & E1000_RCTL_MPE) + preg |= BM_RCTL_MPE; + preg &= ~(BM_RCTL_MO_MASK); + if (mreg & E1000_RCTL_MO_3) + preg |= (((mreg & E1000_RCTL_MO_3) >> E1000_RCTL_MO_SHIFT) + << BM_RCTL_MO_SHIFT); + if (mreg & E1000_RCTL_BAM) + preg |= BM_RCTL_BAM; + if (mreg & E1000_RCTL_PMCF) + preg |= BM_RCTL_PMCF; + mreg = E1000_READ_REG(hw, E1000_CTRL); + if (mreg & E1000_CTRL_RFCE) + preg |= BM_RCTL_RFCE; + e1000_write_phy_reg(&adapter->hw, BM_RCTL, preg); + + /* enable PHY wakeup in MAC register */ + E1000_WRITE_REG(hw, E1000_WUC, + E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN); + E1000_WRITE_REG(hw, E1000_WUFC, adapter->wol); + + /* configure and enable PHY wakeup in PHY registers */ + e1000_write_phy_reg(&adapter->hw, BM_WUFC, adapter->wol); + e1000_write_phy_reg(&adapter->hw, BM_WUC, E1000_WUC_PME_EN); + + /* activate PHY wakeup */ + ret = hw->phy.ops.acquire(hw); + if (ret) { + printf("Could not acquire PHY\n"); + return ret; + } + e1000_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, + (BM_WUC_ENABLE_PAGE << IGP_PAGE_SHIFT)); + ret = e1000_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, &preg); + if (ret) { + printf("Could not read PHY page 769\n"); + goto out; + } + preg |= BM_WUC_ENABLE_BIT | BM_WUC_HOST_WU_BIT; + ret = e1000_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, preg); + if (ret) + printf("Could not set PHY Host Wakeup bit\n"); +out: + hw->phy.ops.release(hw); + + return ret; +} + +static void +lem_led_func(void *arg, int onoff) +{ + struct adapter *adapter = arg; + + EM_CORE_LOCK(adapter); + if (onoff) { + e1000_setup_led(&adapter->hw); + e1000_led_on(&adapter->hw); + } else { + e1000_led_off(&adapter->hw); + e1000_cleanup_led(&adapter->hw); + } + EM_CORE_UNLOCK(adapter); +} + +/********************************************************************* +* 82544 Coexistence issue workaround. +* There are 2 issues. +* 1. Transmit Hang issue. +* To detect this issue, following equation can be used... +* SIZE[3:0] + ADDR[2:0] = SUM[3:0]. +* If SUM[3:0] is in between 1 to 4, we will have this issue. +* +* 2. DAC issue. +* To detect this issue, following equation can be used... +* SIZE[3:0] + ADDR[2:0] = SUM[3:0]. +* If SUM[3:0] is in between 9 to c, we will have this issue. +* +* +* WORKAROUND: +* Make sure we do not have ending address +* as 1,2,3,4(Hang) or 9,a,b,c (DAC) +* +*************************************************************************/ +static u32 +lem_fill_descriptors (bus_addr_t address, u32 length, + PDESC_ARRAY desc_array) +{ + u32 safe_terminator; + + /* Since issue is sensitive to length and address.*/ + /* Let us first check the address...*/ + if (length <= 4) { + desc_array->descriptor[0].address = address; + desc_array->descriptor[0].length = length; + desc_array->elements = 1; + return (desc_array->elements); + } + safe_terminator = (u32)((((u32)address & 0x7) + + (length & 0xF)) & 0xF); + /* if it does not fall between 0x1 to 0x4 and 0x9 to 0xC then return */ + if (safe_terminator == 0 || + (safe_terminator > 4 && + safe_terminator < 9) || + (safe_terminator > 0xC && + safe_terminator <= 0xF)) { + desc_array->descriptor[0].address = address; + desc_array->descriptor[0].length = length; + desc_array->elements = 1; + return (desc_array->elements); + } + + desc_array->descriptor[0].address = address; + desc_array->descriptor[0].length = length - 4; + desc_array->descriptor[1].address = address + (length - 4); + desc_array->descriptor[1].length = 4; + desc_array->elements = 2; + return (desc_array->elements); +} + +/********************************************************************** + * + * Update the board statistics counters. + * + **********************************************************************/ +static void +lem_update_stats_counters(struct adapter *adapter) +{ + struct ifnet *ifp; + + if(adapter->hw.phy.media_type == e1000_media_type_copper || + (E1000_READ_REG(&adapter->hw, E1000_STATUS) & E1000_STATUS_LU)) { + adapter->stats.symerrs += E1000_READ_REG(&adapter->hw, E1000_SYMERRS); + adapter->stats.sec += E1000_READ_REG(&adapter->hw, E1000_SEC); + } + adapter->stats.crcerrs += E1000_READ_REG(&adapter->hw, E1000_CRCERRS); + adapter->stats.mpc += E1000_READ_REG(&adapter->hw, E1000_MPC); + adapter->stats.scc += E1000_READ_REG(&adapter->hw, E1000_SCC); + adapter->stats.ecol += E1000_READ_REG(&adapter->hw, E1000_ECOL); + + adapter->stats.mcc += E1000_READ_REG(&adapter->hw, E1000_MCC); + adapter->stats.latecol += E1000_READ_REG(&adapter->hw, E1000_LATECOL); + adapter->stats.colc += E1000_READ_REG(&adapter->hw, E1000_COLC); + adapter->stats.dc += E1000_READ_REG(&adapter->hw, E1000_DC); + adapter->stats.rlec += E1000_READ_REG(&adapter->hw, E1000_RLEC); + adapter->stats.xonrxc += E1000_READ_REG(&adapter->hw, E1000_XONRXC); + adapter->stats.xontxc += E1000_READ_REG(&adapter->hw, E1000_XONTXC); + adapter->stats.xoffrxc += E1000_READ_REG(&adapter->hw, E1000_XOFFRXC); + adapter->stats.xofftxc += E1000_READ_REG(&adapter->hw, E1000_XOFFTXC); + adapter->stats.fcruc += E1000_READ_REG(&adapter->hw, E1000_FCRUC); + adapter->stats.prc64 += E1000_READ_REG(&adapter->hw, E1000_PRC64); + adapter->stats.prc127 += E1000_READ_REG(&adapter->hw, E1000_PRC127); + adapter->stats.prc255 += E1000_READ_REG(&adapter->hw, E1000_PRC255); + adapter->stats.prc511 += E1000_READ_REG(&adapter->hw, E1000_PRC511); + adapter->stats.prc1023 += E1000_READ_REG(&adapter->hw, E1000_PRC1023); + adapter->stats.prc1522 += E1000_READ_REG(&adapter->hw, E1000_PRC1522); + adapter->stats.gprc += E1000_READ_REG(&adapter->hw, E1000_GPRC); + adapter->stats.bprc += E1000_READ_REG(&adapter->hw, E1000_BPRC); + adapter->stats.mprc += E1000_READ_REG(&adapter->hw, E1000_MPRC); + adapter->stats.gptc += E1000_READ_REG(&adapter->hw, E1000_GPTC); + + /* For the 64-bit byte counters the low dword must be read first. */ + /* Both registers clear on the read of the high dword */ + + adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCL) + + ((u64)E1000_READ_REG(&adapter->hw, E1000_GORCH) << 32); + adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCL) + + ((u64)E1000_READ_REG(&adapter->hw, E1000_GOTCH) << 32); + + adapter->stats.rnbc += E1000_READ_REG(&adapter->hw, E1000_RNBC); + adapter->stats.ruc += E1000_READ_REG(&adapter->hw, E1000_RUC); + adapter->stats.rfc += E1000_READ_REG(&adapter->hw, E1000_RFC); + adapter->stats.roc += E1000_READ_REG(&adapter->hw, E1000_ROC); + adapter->stats.rjc += E1000_READ_REG(&adapter->hw, E1000_RJC); + + adapter->stats.tor += E1000_READ_REG(&adapter->hw, E1000_TORH); + adapter->stats.tot += E1000_READ_REG(&adapter->hw, E1000_TOTH); + + adapter->stats.tpr += E1000_READ_REG(&adapter->hw, E1000_TPR); + adapter->stats.tpt += E1000_READ_REG(&adapter->hw, E1000_TPT); + adapter->stats.ptc64 += E1000_READ_REG(&adapter->hw, E1000_PTC64); + adapter->stats.ptc127 += E1000_READ_REG(&adapter->hw, E1000_PTC127); + adapter->stats.ptc255 += E1000_READ_REG(&adapter->hw, E1000_PTC255); + adapter->stats.ptc511 += E1000_READ_REG(&adapter->hw, E1000_PTC511); + adapter->stats.ptc1023 += E1000_READ_REG(&adapter->hw, E1000_PTC1023); + adapter->stats.ptc1522 += E1000_READ_REG(&adapter->hw, E1000_PTC1522); + adapter->stats.mptc += E1000_READ_REG(&adapter->hw, E1000_MPTC); + adapter->stats.bptc += E1000_READ_REG(&adapter->hw, E1000_BPTC); + + if (adapter->hw.mac.type >= e1000_82543) { + adapter->stats.algnerrc += + E1000_READ_REG(&adapter->hw, E1000_ALGNERRC); + adapter->stats.rxerrc += + E1000_READ_REG(&adapter->hw, E1000_RXERRC); + adapter->stats.tncrs += + E1000_READ_REG(&adapter->hw, E1000_TNCRS); + adapter->stats.cexterr += + E1000_READ_REG(&adapter->hw, E1000_CEXTERR); + adapter->stats.tsctc += + E1000_READ_REG(&adapter->hw, E1000_TSCTC); + adapter->stats.tsctfc += + E1000_READ_REG(&adapter->hw, E1000_TSCTFC); + } + ifp = adapter->ifp; + + ifp->if_collisions = adapter->stats.colc; + + /* Rx Errors */ + ifp->if_ierrors = adapter->dropped_pkts + adapter->stats.rxerrc + + adapter->stats.crcerrs + adapter->stats.algnerrc + + adapter->stats.ruc + adapter->stats.roc + + adapter->stats.mpc + adapter->stats.cexterr; + + /* Tx Errors */ + ifp->if_oerrors = adapter->stats.ecol + + adapter->stats.latecol + adapter->watchdog_events; +} + +/* Export a single 32-bit register via a read-only sysctl. */ +static int +lem_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter; + u_int val; + +#ifndef __HAIKU__ + adapter = oidp->oid_arg1; + val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2); +#endif + + return (sysctl_handle_int(oidp, &val, 0, req)); +} + +/* + * Add sysctl variables, one per statistic, to the system. + */ +static void +lem_add_hw_stats(struct adapter *adapter) +{ + device_t dev = adapter->dev; + + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); + struct sysctl_oid *tree = device_get_sysctl_tree(dev); + struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + struct e1000_hw_stats *stats = &adapter->stats; + + struct sysctl_oid *stat_node; + struct sysctl_oid_list *stat_list; + + /* Driver Statistics */ + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_alloc_fail", + CTLFLAG_RD, &adapter->mbuf_alloc_failed, + "Std mbuf failed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "cluster_alloc_fail", + CTLFLAG_RD, &adapter->mbuf_cluster_failed, + "Std mbuf cluster failed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", + CTLFLAG_RD, &adapter->dropped_pkts, + "Driver dropped packets"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", + CTLFLAG_RD, &adapter->no_tx_dma_setup, + "Driver tx dma failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_desc_fail1", + CTLFLAG_RD, &adapter->no_tx_desc_avail1, + "Not enough tx descriptors failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_desc_fail2", + CTLFLAG_RD, &adapter->no_tx_desc_avail2, + "Not enough tx descriptors failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", + CTLFLAG_RD, &adapter->rx_overruns, + "RX overruns"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_timeouts", + CTLFLAG_RD, &adapter->watchdog_events, + "Watchdog timeouts"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "device_control", + CTLFLAG_RD, adapter, E1000_CTRL, + lem_sysctl_reg_handler, "IU", + "Device Control Register"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_control", + CTLFLAG_RD, adapter, E1000_RCTL, + lem_sysctl_reg_handler, "IU", + "Receiver Control Register"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_high_water", + CTLFLAG_RD, &adapter->hw.fc.high_water, 0, + "Flow Control High Watermark"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_low_water", + CTLFLAG_RD, &adapter->hw.fc.low_water, 0, + "Flow Control Low Watermark"); + SYSCTL_ADD_QUAD(ctx, child, OID_AUTO, "fifo_workaround", + CTLFLAG_RD, &adapter->tx_fifo_wrk_cnt, + "TX FIFO workaround events"); + SYSCTL_ADD_QUAD(ctx, child, OID_AUTO, "fifo_reset", + CTLFLAG_RD, &adapter->tx_fifo_reset_cnt, + "TX FIFO resets"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "txd_head", + CTLFLAG_RD, adapter, E1000_TDH(0), + lem_sysctl_reg_handler, "IU", + "Transmit Descriptor Head"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "txd_tail", + CTLFLAG_RD, adapter, E1000_TDT(0), + lem_sysctl_reg_handler, "IU", + "Transmit Descriptor Tail"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxd_head", + CTLFLAG_RD, adapter, E1000_RDH(0), + lem_sysctl_reg_handler, "IU", + "Receive Descriptor Head"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxd_tail", + CTLFLAG_RD, adapter, E1000_RDT(0), + lem_sysctl_reg_handler, "IU", + "Receive Descriptor Tail"); + + + /* MAC stats get their own sub node */ + + stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac_stats", + CTLFLAG_RD, NULL, "Statistics"); + stat_list = SYSCTL_CHILDREN(stat_node); + + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "excess_coll", + CTLFLAG_RD, &stats->ecol, + "Excessive collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "single_coll", + CTLFLAG_RD, &stats->scc, + "Single collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "multiple_coll", + CTLFLAG_RD, &stats->mcc, + "Multiple collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "late_coll", + CTLFLAG_RD, &stats->latecol, + "Late collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "collision_count", + CTLFLAG_RD, &stats->colc, + "Collision Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "symbol_errors", + CTLFLAG_RD, &adapter->stats.symerrs, + "Symbol Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "sequence_errors", + CTLFLAG_RD, &adapter->stats.sec, + "Sequence Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "defer_count", + CTLFLAG_RD, &adapter->stats.dc, + "Defer Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "missed_packets", + CTLFLAG_RD, &adapter->stats.mpc, + "Missed Packets"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_no_buff", + CTLFLAG_RD, &adapter->stats.rnbc, + "Receive No Buffers"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_undersize", + CTLFLAG_RD, &adapter->stats.ruc, + "Receive Undersize"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_fragmented", + CTLFLAG_RD, &adapter->stats.rfc, + "Fragmented Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_oversize", + CTLFLAG_RD, &adapter->stats.roc, + "Oversized Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_jabber", + CTLFLAG_RD, &adapter->stats.rjc, + "Recevied Jabber"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_errs", + CTLFLAG_RD, &adapter->stats.rxerrc, + "Receive Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "crc_errs", + CTLFLAG_RD, &adapter->stats.crcerrs, + "CRC errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "alignment_errs", + CTLFLAG_RD, &adapter->stats.algnerrc, + "Alignment Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "coll_ext_errs", + CTLFLAG_RD, &adapter->stats.cexterr, + "Collision/Carrier extension errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_recvd", + CTLFLAG_RD, &adapter->stats.xonrxc, + "XON Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_txd", + CTLFLAG_RD, &adapter->stats.xontxc, + "XON Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_recvd", + CTLFLAG_RD, &adapter->stats.xoffrxc, + "XOFF Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_txd", + CTLFLAG_RD, &adapter->stats.xofftxc, + "XOFF Transmitted"); + + /* Packet Reception Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_recvd", + CTLFLAG_RD, &adapter->stats.tpr, + "Total Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_recvd", + CTLFLAG_RD, &adapter->stats.gprc, + "Good Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_recvd", + CTLFLAG_RD, &adapter->stats.bprc, + "Broadcast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_recvd", + CTLFLAG_RD, &adapter->stats.mprc, + "Multicast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_64", + CTLFLAG_RD, &adapter->stats.prc64, + "64 byte frames received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_65_127", + CTLFLAG_RD, &adapter->stats.prc127, + "65-127 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_128_255", + CTLFLAG_RD, &adapter->stats.prc255, + "128-255 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_256_511", + CTLFLAG_RD, &adapter->stats.prc511, + "256-511 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_512_1023", + CTLFLAG_RD, &adapter->stats.prc1023, + "512-1023 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_1024_1522", + CTLFLAG_RD, &adapter->stats.prc1522, + "1023-1522 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_recvd", + CTLFLAG_RD, &adapter->stats.gorc, + "Good Octets Received"); + + /* Packet Transmission Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", + CTLFLAG_RD, &adapter->stats.gotc, + "Good Octets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", + CTLFLAG_RD, &adapter->stats.tpt, + "Total Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_txd", + CTLFLAG_RD, &adapter->stats.gptc, + "Good Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_txd", + CTLFLAG_RD, &adapter->stats.bptc, + "Broadcast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_txd", + CTLFLAG_RD, &adapter->stats.mptc, + "Multicast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_64", + CTLFLAG_RD, &adapter->stats.ptc64, + "64 byte frames transmitted "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_65_127", + CTLFLAG_RD, &adapter->stats.ptc127, + "65-127 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_128_255", + CTLFLAG_RD, &adapter->stats.ptc255, + "128-255 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_256_511", + CTLFLAG_RD, &adapter->stats.ptc511, + "256-511 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_512_1023", + CTLFLAG_RD, &adapter->stats.ptc1023, + "512-1023 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_1024_1522", + CTLFLAG_RD, &adapter->stats.ptc1522, + "1024-1522 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_txd", + CTLFLAG_RD, &adapter->stats.tsctc, + "TSO Contexts Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_ctx_fail", + CTLFLAG_RD, &adapter->stats.tsctfc, + "TSO Contexts Failed"); +} + +/********************************************************************** + * + * This routine provides a way to dump out the adapter eeprom, + * often a useful debug/service tool. This only dumps the first + * 32 words, stuff that matters is in that extent. + * + **********************************************************************/ + +static int +lem_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter; + int error; + int result; + + result = -1; + error = sysctl_handle_int(oidp, &result, 0, req); + + if (error || !req->newptr) + return (error); + + /* + * This value will cause a hex dump of the + * first 32 16-bit words of the EEPROM to + * the screen. + */ + if (result == 1) { + adapter = (struct adapter *)arg1; + lem_print_nvm_info(adapter); + } + + return (error); +} + +static void +lem_print_nvm_info(struct adapter *adapter) +{ + u16 eeprom_data; + int i, j, row = 0; + + /* Its a bit crude, but it gets the job done */ + printf("\nInterface EEPROM Dump:\n"); + printf("Offset\n0x0000 "); + for (i = 0, j = 0; i < 32; i++, j++) { + if (j == 8) { /* Make the offset block */ + j = 0; ++row; + printf("\n0x00%x0 ",row); + } + e1000_read_nvm(&adapter->hw, i, 1, &eeprom_data); + printf("%04x ", eeprom_data); + } + printf("\n"); +} + +static int +lem_sysctl_int_delay(SYSCTL_HANDLER_ARGS) +{ + struct em_int_delay_info *info; + struct adapter *adapter; + u32 regval; + int error; + int usecs; + int ticks; + + info = (struct em_int_delay_info *)arg1; + usecs = info->value; + error = sysctl_handle_int(oidp, &usecs, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (usecs < 0 || usecs > EM_TICKS_TO_USECS(65535)) + return (EINVAL); + info->value = usecs; + ticks = EM_USECS_TO_TICKS(usecs); + + adapter = info->adapter; + + EM_CORE_LOCK(adapter); + regval = E1000_READ_OFFSET(&adapter->hw, info->offset); + regval = (regval & ~0xffff) | (ticks & 0xffff); + /* Handle a few special cases. */ + switch (info->offset) { + case E1000_RDTR: + break; + case E1000_TIDV: + if (ticks == 0) { + adapter->txd_cmd &= ~E1000_TXD_CMD_IDE; + /* Don't write 0 into the TIDV register. */ + regval++; + } else + adapter->txd_cmd |= E1000_TXD_CMD_IDE; + break; + } + E1000_WRITE_OFFSET(&adapter->hw, info->offset, regval); + EM_CORE_UNLOCK(adapter); + return (0); +} + +static void +lem_add_int_delay_sysctl(struct adapter *adapter, const char *name, + const char *description, struct em_int_delay_info *info, + int offset, int value) +{ + info->adapter = adapter; + info->offset = offset; + info->value = value; + SYSCTL_ADD_PROC(device_get_sysctl_ctx(adapter->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), + OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, + info, 0, lem_sysctl_int_delay, "I", description); +} + +static void +lem_set_flow_cntrl(struct adapter *adapter, const char *name, + const char *description, int *limit, int value) +{ + *limit = value; + SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), + OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); +} + +#ifndef EM_LEGACY_IRQ +static void +lem_add_rx_process_limit(struct adapter *adapter, const char *name, + const char *description, int *limit, int value) +{ + *limit = value; + SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), + OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); +} +#endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.h new file mode 100644 index 0000000000..02307a743c --- /dev/null +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.h @@ -0,0 +1,492 @@ +/****************************************************************************** + + Copyright (c) 2001-2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD: src/sys/dev/e1000/if_lem.h,v 1.2.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $*/ + + +#ifndef _LEM_H_DEFINED_ +#define _LEM_H_DEFINED_ + + +/* Tunables */ + +/* + * EM_TXD: Maximum number of Transmit Descriptors + * Valid Range: 80-256 for 82542 and 82543-based adapters + * 80-4096 for others + * Default Value: 256 + * This value is the number of transmit descriptors allocated by the driver. + * Increasing this value allows the driver to queue more transmits. Each + * descriptor is 16 bytes. + * Since TDLEN should be multiple of 128bytes, the number of transmit + * desscriptors should meet the following condition. + * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 + */ +#define EM_MIN_TXD 80 +#define EM_MAX_TXD_82543 256 +#define EM_MAX_TXD 4096 +#define EM_DEFAULT_TXD EM_MAX_TXD_82543 + +/* + * EM_RXD - Maximum number of receive Descriptors + * Valid Range: 80-256 for 82542 and 82543-based adapters + * 80-4096 for others + * Default Value: 256 + * This value is the number of receive descriptors allocated by the driver. + * Increasing this value allows the driver to buffer more incoming packets. + * Each descriptor is 16 bytes. A receive buffer is also allocated for each + * descriptor. The maximum MTU size is 16110. + * Since TDLEN should be multiple of 128bytes, the number of transmit + * desscriptors should meet the following condition. + * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 + */ +#define EM_MIN_RXD 80 +#define EM_MAX_RXD_82543 256 +#define EM_MAX_RXD 4096 +#define EM_DEFAULT_RXD EM_MAX_RXD_82543 + +/* + * EM_TIDV - Transmit Interrupt Delay Value + * Valid Range: 0-65535 (0=off) + * Default Value: 64 + * This value delays the generation of transmit interrupts in units of + * 1.024 microseconds. Transmit interrupt reduction can improve CPU + * efficiency if properly tuned for specific network traffic. If the + * system is reporting dropped transmits, this value may be set too high + * causing the driver to run out of available transmit descriptors. + */ +#define EM_TIDV 64 + +/* + * EM_TADV - Transmit Absolute Interrupt Delay Value + * (Not valid for 82542/82543/82544) + * Valid Range: 0-65535 (0=off) + * Default Value: 64 + * This value, in units of 1.024 microseconds, limits the delay in which a + * transmit interrupt is generated. Useful only if EM_TIDV is non-zero, + * this value ensures that an interrupt is generated after the initial + * packet is sent on the wire within the set amount of time. Proper tuning, + * along with EM_TIDV, may improve traffic throughput in specific + * network conditions. + */ +#define EM_TADV 64 + +/* + * EM_RDTR - Receive Interrupt Delay Timer (Packet Timer) + * Valid Range: 0-65535 (0=off) + * Default Value: 0 + * This value delays the generation of receive interrupts in units of 1.024 + * microseconds. Receive interrupt reduction can improve CPU efficiency if + * properly tuned for specific network traffic. Increasing this value adds + * extra latency to frame reception and can end up decreasing the throughput + * of TCP traffic. If the system is reporting dropped receives, this value + * may be set too high, causing the driver to run out of available receive + * descriptors. + * + * CAUTION: When setting EM_RDTR to a value other than 0, adapters + * may hang (stop transmitting) under certain network conditions. + * If this occurs a WATCHDOG message is logged in the system + * event log. In addition, the controller is automatically reset, + * restoring the network connection. To eliminate the potential + * for the hang ensure that EM_RDTR is set to 0. + */ +#define EM_RDTR 0 + +/* + * Receive Interrupt Absolute Delay Timer (Not valid for 82542/82543/82544) + * Valid Range: 0-65535 (0=off) + * Default Value: 64 + * This value, in units of 1.024 microseconds, limits the delay in which a + * receive interrupt is generated. Useful only if EM_RDTR is non-zero, + * this value ensures that an interrupt is generated after the initial + * packet is received within the set amount of time. Proper tuning, + * along with EM_RDTR, may improve traffic throughput in specific network + * conditions. + */ +#define EM_RADV 64 + +/* + * This parameter controls the max duration of transmit watchdog. + */ +#define EM_WATCHDOG (10 * hz) + +/* + * This parameter controls when the driver calls the routine to reclaim + * transmit descriptors. + */ +#define EM_TX_CLEANUP_THRESHOLD (adapter->num_tx_desc / 8) +#define EM_TX_OP_THRESHOLD (adapter->num_tx_desc / 32) + +/* + * This parameter controls whether or not autonegotation is enabled. + * 0 - Disable autonegotiation + * 1 - Enable autonegotiation + */ +#define DO_AUTO_NEG 1 + +/* + * This parameter control whether or not the driver will wait for + * autonegotiation to complete. + * 1 - Wait for autonegotiation to complete + * 0 - Don't wait for autonegotiation to complete + */ +#define WAIT_FOR_AUTO_NEG_DEFAULT 0 + +/* Tunables -- End */ + +#define AUTONEG_ADV_DEFAULT (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \ + ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ + ADVERTISE_1000_FULL) + +#define AUTO_ALL_MODES 0 + +/* PHY master/slave setting */ +#define EM_MASTER_SLAVE e1000_ms_hw_default + +/* + * Micellaneous constants + */ +#define EM_VENDOR_ID 0x8086 +#define EM_FLASH 0x0014 + +#define EM_JUMBO_PBA 0x00000028 +#define EM_DEFAULT_PBA 0x00000030 +#define EM_SMARTSPEED_DOWNSHIFT 3 +#define EM_SMARTSPEED_MAX 15 +#define EM_MAX_LOOP 10 + +#define MAX_NUM_MULTICAST_ADDRESSES 128 +#define PCI_ANY_ID (~0U) +#define ETHER_ALIGN 2 +#define EM_FC_PAUSE_TIME 0x0680 +#define EM_EEPROM_APME 0x400; +#define EM_82544_APME 0x0004; + +/* Code compatilbility between 6 and 7 */ +#ifndef ETHER_BPF_MTAP +#define ETHER_BPF_MTAP BPF_MTAP +#endif + +/* + * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be + * multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This will + * also optimize cache line size effect. H/W supports up to cache line size 128. + */ +#define EM_DBA_ALIGN 128 + +#define SPEED_MODE_BIT (1<<21) /* On PCI-E MACs only */ + +/* PCI Config defines */ +#define EM_BAR_TYPE(v) ((v) & EM_BAR_TYPE_MASK) +#define EM_BAR_TYPE_MASK 0x00000001 +#define EM_BAR_TYPE_MMEM 0x00000000 +#define EM_BAR_TYPE_IO 0x00000001 +#define EM_BAR_TYPE_FLASH 0x0014 +#define EM_BAR_MEM_TYPE(v) ((v) & EM_BAR_MEM_TYPE_MASK) +#define EM_BAR_MEM_TYPE_MASK 0x00000006 +#define EM_BAR_MEM_TYPE_32BIT 0x00000000 +#define EM_BAR_MEM_TYPE_64BIT 0x00000004 +#define EM_MSIX_BAR 3 /* On 82575 */ + +/* Defines for printing debug information */ +#define DEBUG_INIT 0 +#define DEBUG_IOCTL 0 +#define DEBUG_HW 0 + +#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") +#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) +#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) +#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") +#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) +#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) +#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") +#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) +#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) + +#define EM_MAX_SCATTER 64 +#define EM_VFTA_SIZE 128 +#define EM_TSO_SIZE (65535 + sizeof(struct ether_vlan_header)) +#define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */ +#define EM_MSIX_MASK 0x01F00000 /* For 82574 use */ +#define ETH_ZLEN 60 +#define ETH_ADDR_LEN 6 +#define CSUM_OFFLOAD 7 /* Offload bits in mbuf flag */ + +/* + * 82574 has a nonstandard address for EIAC + * and since its only used in MSIX, and in + * the em driver only 82574 uses MSIX we can + * solve it just using this define. + */ +#define EM_EIAC 0x000DC + +/* Used in for 82547 10Mb Half workaround */ +#define EM_PBA_BYTES_SHIFT 0xA +#define EM_TX_HEAD_ADDR_SHIFT 7 +#define EM_PBA_TX_MASK 0xFFFF0000 +#define EM_FIFO_HDR 0x10 +#define EM_82547_PKT_THRESH 0x3e0 + +/* Precision Time Sync (IEEE 1588) defines */ +#define ETHERTYPE_IEEE1588 0x88F7 +#define PICOSECS_PER_TICK 20833 +#define TSYNC_PORT 319 /* UDP port for the protocol */ + +/* + * Bus dma allocation structure used by + * e1000_dma_malloc and e1000_dma_free. + */ +struct em_dma_alloc { + bus_addr_t dma_paddr; + caddr_t dma_vaddr; + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + bus_dma_segment_t dma_seg; + int dma_nseg; +}; + +struct adapter; + +struct em_int_delay_info { + struct adapter *adapter; /* Back-pointer to the adapter struct */ + int offset; /* Register offset to read/write */ + int value; /* Current value in usecs */ +}; + +/* Our adapter structure */ +struct adapter { + struct ifnet *ifp; +#if __FreeBSD_version >= 800000 + struct buf_ring *br; +#endif + struct e1000_hw hw; + + /* FreeBSD operating-system-specific structures. */ + struct e1000_osdep osdep; + struct device *dev; + struct cdev *led_dev; + + struct resource *memory; + struct resource *flash; + struct resource *msix; + + struct resource *ioport; + int io_rid; + + /* 82574 may use 3 int vectors */ + struct resource *res[3]; + void *tag[3]; + int rid[3]; + + struct ifmedia media; + struct callout timer; + struct callout tx_fifo_timer; + bool watchdog_check; + int watchdog_time; + int msi; + int if_flags; + int max_frame_size; + int min_frame_size; + struct mtx core_mtx; + struct mtx tx_mtx; + struct mtx rx_mtx; + int em_insert_vlan_header; + + /* Task for FAST handling */ + struct task link_task; + struct task rxtx_task; + struct task rx_task; + struct task tx_task; + struct taskqueue *tq; /* private task queue */ + + eventhandler_tag vlan_attach; + eventhandler_tag vlan_detach; + u32 num_vlans; + + /* Management and WOL features */ + u32 wol; + bool has_manage; + bool has_amt; + + /* Multicast array memory */ + u8 *mta; + + /* + ** Shadow VFTA table, this is needed because + ** the real vlan filter table gets cleared during + ** a soft reset and the driver needs to be able + ** to repopulate it. + */ + u32 shadow_vfta[EM_VFTA_SIZE]; + + /* Info about the interface */ + uint8_t link_active; + uint16_t link_speed; + uint16_t link_duplex; + uint32_t smartspeed; + uint32_t fc_setting; + + struct em_int_delay_info tx_int_delay; + struct em_int_delay_info tx_abs_int_delay; + struct em_int_delay_info rx_int_delay; + struct em_int_delay_info rx_abs_int_delay; + + /* + * Transmit definitions + * + * We have an array of num_tx_desc descriptors (handled + * by the controller) paired with an array of tx_buffers + * (at tx_buffer_area). + * The index of the next available descriptor is next_avail_tx_desc. + * The number of remaining tx_desc is num_tx_desc_avail. + */ + struct em_dma_alloc txdma; /* bus_dma glue for tx desc */ + struct e1000_tx_desc *tx_desc_base; + uint32_t next_avail_tx_desc; + uint32_t next_tx_to_clean; + volatile uint16_t num_tx_desc_avail; + uint16_t num_tx_desc; + uint16_t last_hw_offload; + uint32_t txd_cmd; + struct em_buffer *tx_buffer_area; + bus_dma_tag_t txtag; /* dma tag for tx */ + uint32_t tx_tso; /* last tx was tso */ + + /* + * Receive definitions + * + * we have an array of num_rx_desc rx_desc (handled by the + * controller), and paired with an array of rx_buffers + * (at rx_buffer_area). + * The next pair to check on receive is at offset next_rx_desc_to_check + */ + struct em_dma_alloc rxdma; /* bus_dma glue for rx desc */ + struct e1000_rx_desc *rx_desc_base; + uint32_t next_rx_desc_to_check; + uint32_t rx_buffer_len; + uint16_t num_rx_desc; + int rx_process_limit; + struct em_buffer *rx_buffer_area; + bus_dma_tag_t rxtag; + bus_dmamap_t rx_sparemap; + + /* + * First/last mbuf pointers, for + * collecting multisegment RX packets. + */ + struct mbuf *fmp; + struct mbuf *lmp; + + /* Misc stats maintained by the driver */ + unsigned long dropped_pkts; + unsigned long mbuf_alloc_failed; + unsigned long mbuf_cluster_failed; + unsigned long no_tx_desc_avail1; + unsigned long no_tx_desc_avail2; + unsigned long no_tx_map_avail; + unsigned long no_tx_dma_setup; + unsigned long watchdog_events; + unsigned long rx_overruns; + unsigned long rx_irq; + unsigned long tx_irq; + unsigned long link_irq; + + /* 82547 workaround */ + uint32_t tx_fifo_size; + uint32_t tx_fifo_head; + uint32_t tx_fifo_head_addr; + uint64_t tx_fifo_reset_cnt; + uint64_t tx_fifo_wrk_cnt; + uint32_t tx_head_addr; + + /* For 82544 PCIX Workaround */ + boolean_t pcix_82544; + boolean_t in_detach; + + + struct e1000_hw_stats stats; +}; + +/* ****************************************************************************** + * vendor_info_array + * + * This array contains the list of Subvendor/Subdevice IDs on which the driver + * should load. + * + * ******************************************************************************/ +typedef struct _em_vendor_info_t { + unsigned int vendor_id; + unsigned int device_id; + unsigned int subvendor_id; + unsigned int subdevice_id; + unsigned int index; +} em_vendor_info_t; + +struct em_buffer { + int next_eop; /* Index of the desc to watch */ + struct mbuf *m_head; + bus_dmamap_t map; /* bus_dma map for packet */ +}; + +/* For 82544 PCIX Workaround */ +typedef struct _ADDRESS_LENGTH_PAIR +{ + uint64_t address; + uint32_t length; +} ADDRESS_LENGTH_PAIR, *PADDRESS_LENGTH_PAIR; + +typedef struct _DESCRIPTOR_PAIR +{ + ADDRESS_LENGTH_PAIR descriptor[4]; + uint32_t elements; +} DESC_ARRAY, *PDESC_ARRAY; + +#define EM_CORE_LOCK_INIT(_sc, _name) \ + mtx_init(&(_sc)->core_mtx, _name, "EM Core Lock", MTX_DEF) +#define EM_TX_LOCK_INIT(_sc, _name) \ + mtx_init(&(_sc)->tx_mtx, _name, "EM TX Lock", MTX_DEF) +#define EM_RX_LOCK_INIT(_sc, _name) \ + mtx_init(&(_sc)->rx_mtx, _name, "EM RX Lock", MTX_DEF) +#define EM_CORE_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->core_mtx) +#define EM_TX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->tx_mtx) +#define EM_RX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_mtx) +#define EM_CORE_LOCK(_sc) mtx_lock(&(_sc)->core_mtx) +#define EM_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_mtx) +#define EM_TX_TRYLOCK(_sc) mtx_trylock(&(_sc)->tx_mtx) +#define EM_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_mtx) +#define EM_CORE_UNLOCK(_sc) mtx_unlock(&(_sc)->core_mtx) +#define EM_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_mtx) +#define EM_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_mtx) +#define EM_CORE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->core_mtx, MA_OWNED) +#define EM_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_mtx, MA_OWNED) + +#endif /* _LEM_H_DEFINED_ */ From 56a2d99762b1d976bcd66287bd7755ab5f0e2b12 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Tue, 23 Aug 2011 19:55:46 +0000 Subject: [PATCH 225/702] * add tests for BString that expose a problem in the looping Replace() implementations on single chars * automatic whitespace cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42681 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../support/bstring/StringReplaceTest.cpp | 68 +++++++++++++++---- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/src/tests/kits/support/bstring/StringReplaceTest.cpp b/src/tests/kits/support/bstring/StringReplaceTest.cpp index 23c0a6d89d..ba04aae0a7 100644 --- a/src/tests/kits/support/bstring/StringReplaceTest.cpp +++ b/src/tests/kits/support/bstring/StringReplaceTest.cpp @@ -7,20 +7,20 @@ StringReplaceTest::StringReplaceTest(std::string name) : { } - + StringReplaceTest::~StringReplaceTest() { } -void +void StringReplaceTest::PerformTest(void) { BString *str1; const int32 sz = 1024*50; char* buf; - + //&ReplaceFirst(char, char); NextSubTest(); str1 = new BString("test string"); @@ -60,6 +60,12 @@ StringReplaceTest::PerformTest(void) CPPUNIT_ASSERT(strcmp(str1->String(), "test string") == 0); delete str1; + NextSubTest(); + str1 = new BString("test string"); + str1->ReplaceAll('t', 't'); + CPPUNIT_ASSERT(strcmp(str1->String(), "test string") == 0); + delete str1; + NextSubTest(); str1 = new BString("test string"); str1->ReplaceAll('t', 'i', 2); @@ -73,6 +79,12 @@ StringReplaceTest::PerformTest(void) CPPUNIT_ASSERT(strcmp(str1->String(), "she tellt tea thells on the sea shore") == 0); delete str1; + NextSubTest(); + str1 = new BString("she sells sea shells on the sea shore"); + str1->Replace('s', 's', 4, 2); + CPPUNIT_ASSERT(strcmp(str1->String(), "she sells sea shells on the sea shore") == 0); + delete str1; + NextSubTest(); str1 = new BString(); str1->Replace('s', 'x', 12, 32); @@ -113,8 +125,13 @@ StringReplaceTest::PerformTest(void) NextSubTest(); str1 = new BString("abc abc abc"); str1->ReplaceAll("ab", "abc"); - CPPUNIT_ASSERT(strcmp(str1->String(), - "abcc abcc abcc") == 0); + CPPUNIT_ASSERT(strcmp(str1->String(), "abcc abcc abcc") == 0); + delete str1; + + NextSubTest(); + str1 = new BString("abc abc abc"); + str1->ReplaceAll("abc", "abc"); + CPPUNIT_ASSERT(strcmp(str1->String(), "abc abc abc") == 0); delete str1; NextSubTest(); @@ -130,7 +147,14 @@ StringReplaceTest::PerformTest(void) CPPUNIT_ASSERT(strcmp(str1->String(), "she sells sea shells on the theshore") == 0); delete str1; - + + NextSubTest(); + str1 = new BString("she sells sea shells on the seashore"); + str1->IReplaceAll("sea", "sea", 11); + CPPUNIT_ASSERT(strcmp(str1->String(), + "she sells sea shells on the seashore") == 0); + delete str1; + //&IReplaceFirst(char, char); NextSubTest(); str1 = new BString("test string"); @@ -164,6 +188,12 @@ StringReplaceTest::PerformTest(void) CPPUNIT_ASSERT(strcmp(str1->String(), "iESi siring") == 0); delete str1; + NextSubTest(); + str1 = new BString("TEST string"); + str1->IReplaceAll('t', 'T'); + CPPUNIT_ASSERT(strcmp(str1->String(), "TEST sTring") == 0); + delete str1; + NextSubTest(); str1 = new BString("test string"); str1->IReplaceAll('x', 'b'); @@ -183,6 +213,12 @@ StringReplaceTest::PerformTest(void) CPPUNIT_ASSERT(strcmp(str1->String(), "She tellt tea thells on the sea shore") == 0); delete str1; + NextSubTest(); + str1 = new BString("She sells Sea shells on the sea shore"); + str1->IReplace('s', 's', 4, 2); + CPPUNIT_ASSERT(strcmp(str1->String(), "She sells sea shells on the sea shore") == 0); + delete str1; + NextSubTest(); str1 = new BString(); str1->IReplace('s', 'x', 12, 32); @@ -205,7 +241,7 @@ StringReplaceTest::PerformTest(void) delete str1; //&IReplaceLast(const char*, const char*) -#ifndef TEST_R5 +#ifndef TEST_R5 NextSubTest(); str1 = new BString("she sells sea shells on the SEashore"); str1->IReplaceLast("sea", "the"); @@ -241,20 +277,26 @@ StringReplaceTest::PerformTest(void) CPPUNIT_ASSERT(strcmp(str1->String(), "she sells SeA shells on the theshore") == 0); delete str1; - + //ReplaceSet(const char*, char) NextSubTest(); str1 = new BString("abc abc abc"); str1->ReplaceSet("ab", 'x'); CPPUNIT_ASSERT(strcmp(str1->String(), "xxc xxc xxc") == 0); delete str1; - + NextSubTest(); str1 = new BString("abcabcabcbababc"); str1->ReplaceSet("abc", 'c'); CPPUNIT_ASSERT(strcmp(str1->String(), "ccccccccccccccc") == 0); delete str1; - + + NextSubTest(); + str1 = new BString("abcabcabcbababc"); + str1->ReplaceSet("c", 'c'); + CPPUNIT_ASSERT(strcmp(str1->String(), "abcabcabcbababc") == 0); + delete str1; + #ifndef TEST_R5 //ReplaceSet(const char*, const char*) NextSubTest(); @@ -282,7 +324,7 @@ StringReplaceTest::PerformTest(void) delete str1; #endif - // we repeat some test, but this time with a bit of data + // we repeat some test, but this time with a bit of data // to test the performance: // ReplaceSet(const char*, const char*) @@ -336,9 +378,9 @@ StringReplaceTest::PerformTest(void) CppUnit::Test *StringReplaceTest::suite(void) -{ +{ typedef CppUnit::TestCaller StringReplaceTestCaller; - + return(new StringReplaceTestCaller("BString::Replace Test", &StringReplaceTest::PerformTest)); } From 04c60f4472a61b1a0e7b5e2add1de79d42b51c30 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Tue, 23 Aug 2011 19:59:50 +0000 Subject: [PATCH 226/702] * fix stuck loops in Replace...() on single chars in case the old and new character are the same (Eclipse was complaining about 'assignment to self', which got me looking at the code ...) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42682 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/support/String.cpp | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/kits/support/String.cpp b/src/kits/support/String.cpp index e1be1c00a4..2550bb94c6 100644 --- a/src/kits/support/String.cpp +++ b/src/kits/support/String.cpp @@ -1389,13 +1389,8 @@ BString::ReplaceAll(char replaceThis, char withThis, int32 fromOffset) // detach and set first match if (pos >= 0 && _MakeWritable() == B_OK) { - fPrivateData[pos] = withThis; - for (pos = pos;;) { - pos = FindFirst(replaceThis, pos); - if (pos < 0) - break; + for( ; pos >= 0; pos = FindFirst(replaceThis, pos + 1)) fPrivateData[pos] = withThis; - } } return *this; } @@ -1409,13 +1404,10 @@ BString::Replace(char replaceThis, char withThis, int32 maxReplaceCount, int32 pos = FindFirst(replaceThis, fromOffset); if (maxReplaceCount > 0 && pos >= 0 && _MakeWritable() == B_OK) { - maxReplaceCount--; - fPrivateData[pos] = withThis; - for (pos = pos; maxReplaceCount > 0; maxReplaceCount--) { - pos = FindFirst(replaceThis, pos); - if (pos < 0) - break; + for( ; maxReplaceCount > 0 && pos >= 0; + pos = FindFirst(replaceThis, pos + 1)) { fPrivateData[pos] = withThis; + maxReplaceCount--; } } return *this; @@ -1546,13 +1538,8 @@ BString::IReplaceAll(char replaceThis, char withThis, int32 fromOffset) int32 pos = _IFindAfter(tmp, fromOffset, 1); if (pos >= 0 && _MakeWritable() == B_OK) { - fPrivateData[pos] = withThis; - for (pos = pos;;) { - pos = _IFindAfter(tmp, pos, 1); - if (pos < 0) - break; + for( ; pos >= 0; pos = _IFindAfter(tmp, pos + 1, 1)) fPrivateData[pos] = withThis; - } } return *this; } @@ -1567,13 +1554,10 @@ BString::IReplace(char replaceThis, char withThis, int32 maxReplaceCount, int32 pos = _IFindAfter(tmp, fromOffset, 1); if (maxReplaceCount > 0 && pos >= 0 && _MakeWritable() == B_OK) { - fPrivateData[pos] = withThis; - maxReplaceCount--; - for (pos = pos; maxReplaceCount > 0; maxReplaceCount--) { - pos = _IFindAfter(tmp, pos, 1); - if (pos < 0) - break; + for( ; maxReplaceCount > 0 && pos >= 0; + pos = _IFindAfter(tmp, pos + 1, 1)) { fPrivateData[pos] = withThis; + maxReplaceCount--; } } From 2c062f84e5ff05c782c321d9ceceffb05b909738 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 24 Aug 2011 04:28:46 +0000 Subject: [PATCH 227/702] * as we are doing a lot of math on bios in gAtomContext, lets make it a uint8 vs a void pointer. * guys at AMD confirmed that the method looking directly at the object table should be the only method used on modern cards (r600 or later) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42683 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 1 + .../accelerants/radeon_hd/atombios/atom.cpp | 9 +- .../accelerants/radeon_hd/atombios/atom.h | 6 +- src/add-ons/accelerants/radeon_hd/display.cpp | 84 +++++++++++-------- src/add-ons/accelerants/radeon_hd/display.h | 7 +- 5 files changed, 60 insertions(+), 47 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 18d1bbdfe0..e001e7fdd5 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -143,6 +143,7 @@ typedef struct { uint16 line_mux; uint16 devices; uint32 connector_type; + uint16 connector_object_id; // TODO struct radeon_i2c_bus_rec ddc_bus; // TODO struct radeon_hpd hpd; } connector_info; diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 9153799efc..a98781dea3 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -1206,7 +1206,7 @@ atom_index_iio(atom_context *ctx, int base) atom_context* -atom_parse(card_info *card, void *bios) +atom_parse(card_info *card, uint8 *bios) { atom_context *ctx = (atom_context*)malloc(sizeof(atom_context)); @@ -1301,7 +1301,7 @@ atom_parse_data_header(atom_context *ctx, int index, uint16 *size, { int offset = index * 2 + 4; int idx = CU16(ctx->data_table + offset); - uint16 *mdt = (uint16 *)ctx->bios + ctx->data_table + 4; + uint8 *mdt = ctx->bios + ctx->data_table + 4; if (!mdt[index]) return B_ERROR; @@ -1323,7 +1323,7 @@ atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev, { int offset = index * 2 + 4; int idx = CU16(ctx->cmd_table + offset); - uint16 *mct = (uint16 *)ctx->bios + ctx->cmd_table + 4; + uint8 *mct = ctx->bios + ctx->cmd_table + 4; if (!mct[index]) return B_ERROR; @@ -1346,8 +1346,7 @@ atom_allocate_fb_scratch(atom_context *ctx) if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset) == B_OK) { - firmware = (_ATOM_VRAM_USAGE_BY_FIRMWARE *) - ((uint16*)ctx->bios + data_offset); + firmware = (_ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); TRACE("Atom firmware requested 0x%" B_PRIX32 " %" B_PRIu16 "kb\n", firmware->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware, diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index a54b084869..c0f7fec688 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -129,7 +129,7 @@ struct card_info { typedef struct atom_context_s { card_info *card; - void *bios; + uint8 *bios; uint32 cmd_table, data_table; uint16 *iio; @@ -147,8 +147,8 @@ typedef struct atom_context_s { extern int atom_debug; -atom_context *atom_parse(card_info *, void *); -status_t atom_execute_table(atom_context *, int, uint32 *); +atom_context *atom_parse(card_info *card, uint8 *bios); +status_t atom_execute_table(atom_context *ctx, int index, uint32 *params); status_t atom_parse_data_header(atom_context *ctx, int index, uint16 *size, uint8 *frev, uint8 *crev, uint16 *data_start); status_t atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev, diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 9b8a585115..75874388db 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -227,8 +227,9 @@ union atom_supported_devices { }; +// only used on r4xx, r5xx, and rs600/rs690/rs740 status_t -detect_connectors() +detect_connectors_legacy() { int index = GetIndexIntoMasterTable(DATA, SupportedDevicesInfo); uint8 frev; @@ -245,18 +246,17 @@ detect_connectors() union atom_supported_devices *supported_devices; supported_devices = (union atom_supported_devices *) - ((uint16 *)gAtomContext->bios + data_offset); + (gAtomContext->bios + data_offset); uint16 device_support = B_LENDIAN_TO_HOST_INT16(supported_devices->info.usDeviceSupport); int32 i; for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { - ATOM_CONNECTOR_INFO_I2C ci - = supported_devices->info.asConnInfo[i]; gConnector[i]->valid = false; + // check if this connector is used if (!(device_support & (1 << i))) continue; @@ -266,13 +266,16 @@ detect_connectors() continue; } - gConnector[i]->connector_type - = connector_convert[ci.sucConnectorInfo.sbfAccess.bfConnectorType]; + ATOM_CONNECTOR_INFO_I2C ci + = supported_devices->info.asConnInfo[i]; - if (gConnector[i]->connector_type - == VIDEO_CONNECTOR_UNKNOWN) { + gConnector[i]->connector_type + = connector_convert_legacy[ + ci.sucConnectorInfo.sbfAccess.bfConnectorType]; + + if (gConnector[i]->connector_type == VIDEO_CONNECTOR_UNKNOWN) { TRACE("%s: skipping unknown connector at %" B_PRId32 - " of 0x%" B_PRIX8"\n", __func__, i, + " of 0x%" B_PRIX8 "\n", __func__, i, ci.sucConnectorInfo.sbfAccess.bfConnectorType); continue; } @@ -317,9 +320,9 @@ detect_connectors() } -// TODO : this gets connectors from object table +// r600+ status_t -detect_connectors_manual() +detect_connectors() { int index = GetIndexIntoMasterTable(DATA, Object_Header); @@ -345,19 +348,18 @@ detect_connectors_manual() ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj; ATOM_OBJECT_HEADER *obj_header; - obj_header = (ATOM_OBJECT_HEADER *) - ((uint16 *)gAtomContext->bios + data_offset); + obj_header = (ATOM_OBJECT_HEADER *)(gAtomContext->bios + data_offset); path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *) - ((uint16 *)gAtomContext->bios + data_offset + (gAtomContext->bios + data_offset + B_LENDIAN_TO_HOST_INT16(obj_header->usDisplayPathTableOffset)); con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *) - ((uint16 *)gAtomContext->bios + data_offset + (gAtomContext->bios + data_offset + B_LENDIAN_TO_HOST_INT16(obj_header->usConnectorObjectTableOffset)); enc_obj = (ATOM_ENCODER_OBJECT_TABLE *) - ((uint16 *)gAtomContext->bios + data_offset + (gAtomContext->bios + data_offset + B_LENDIAN_TO_HOST_INT16(obj_header->usEncoderObjectTableOffset)); router_obj = (ATOM_OBJECT_TABLE *) - ((uint16 *)gAtomContext->bios + data_offset + (gAtomContext->bios + data_offset + B_LENDIAN_TO_HOST_INT16(obj_header->usRouterObjectTableOffset)); int device_support = B_LENDIAN_TO_HOST_INT16(obj_header->usDeviceSupport); @@ -367,24 +369,25 @@ detect_connectors_manual() TRACE("%s: found %" B_PRIu8 " potential display paths.\n", __func__, path_obj->ucNumOfDispPath); + uint32 connector_index = 0; for (i = 0; i < path_obj->ucNumOfDispPath; i++) { + + if (connector_index >= ATOM_MAX_SUPPORTED_DEVICE) + continue; + uint8 *addr = (uint8*)path_obj->asDispPath; ATOM_DISPLAY_OBJECT_PATH *path; addr += path_size; - path = (ATOM_DISPLAY_OBJECT_PATH *) addr; + path = (ATOM_DISPLAY_OBJECT_PATH *)addr; path_size += B_LENDIAN_TO_HOST_INT16(path->usSize); - int connector_type; + uint32 connector_type; uint16 connector_object_id; if (device_support & B_LENDIAN_TO_HOST_INT16(path->usDeviceTag)) { - TRACE("%s: Display Path #%" B_PRId32 "\n", __func__, i); - - uint16 igp_lane_info; - - uint8 con_obj_id - = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) + uint8 con_obj_id = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; + //uint8 con_obj_num // = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) // & ENUM_ID_MASK) >> ENUM_ID_SHIFT; @@ -392,30 +395,31 @@ detect_connectors_manual() // = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) // & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; - // TODO : CV support if (B_LENDIAN_TO_HOST_INT16(path->usDeviceTag) == ATOM_DEVICE_CV_SUPPORT) { + TRACE("%s: Path #%" B_PRId32 ": skipping component video.\n", + __func__, i); continue; } + + uint16 igp_lane_info; if (0) ERROR("%s: TODO : IGP chip connector detection\n", __func__); else { igp_lane_info = 0; - connector_type = manual_connector_convert[con_obj_id]; + connector_type = connector_convert[con_obj_id]; connector_object_id = con_obj_id; } if (connector_type == VIDEO_CONNECTOR_UNKNOWN) { - TRACE("%s: Unknown connector, skipping\n", __func__); + TRACE("%s: Path #%" B_PRId32 ": skipping unknown connector.\n", + __func__, i); continue; - } else { - TRACE("%s: Found connector %s\n", __func__, - decode_connector_name(connector_type)); } - // We have to go deeper! -AMD - // (find encoder for connector) + // TODO : to find encoder for connector + #if 0 int32 j; for (j = 0; j < ((B_LENDIAN_TO_HOST_INT16(path->usSize) - 8) / 2); j++) { @@ -473,13 +477,21 @@ detect_connectors_manual() ERROR("%s: TODO : Router object?\n", __func__); } } + #endif // TODO : look up gpio for ddc, hpd // TODO : aux chan transactions - // TODO : add connector - TRACE("%s: add connector\n", __func__); + TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 ")\n", + __func__, i, decode_connector_name(connector_type), + connector_type); + gConnector[connector_index]->valid = true; + gConnector[connector_index]->connector_type = connector_type; + gConnector[connector_index]->connector_object_id + = connector_object_id; + connector_index++; + // radeon_add_atom_connector(dev, // conn_id, // le16_to_cpu(path-> usDeviceTag), @@ -489,7 +501,7 @@ detect_connectors_manual() // &hpd, // &router); } - } + } // end for each display path return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 7952ae8c1e..f5a9f084ad 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -13,7 +13,7 @@ // convert radeon connector to common connector type -const int connector_convert[] = { +const int connector_convert_legacy[] = { VIDEO_CONNECTOR_UNKNOWN, VIDEO_CONNECTOR_VGA, VIDEO_CONNECTOR_DVII, @@ -32,7 +32,7 @@ const int connector_convert[] = { VIDEO_CONNECTOR_DP }; -const int manual_connector_convert[] = { +const int connector_convert[] = { VIDEO_CONNECTOR_UNKNOWN, VIDEO_CONNECTOR_DVII, VIDEO_CONNECTOR_DVII, @@ -58,8 +58,9 @@ const int manual_connector_convert[] = { }; status_t init_registers(register_info* reg, uint8 crtid); -status_t detect_crt_ranges(uint32 crtid); +status_t detect_connectors_legacy(); status_t detect_connectors(); +status_t detect_crt_ranges(uint32 crtid); status_t detect_displays(); void debug_displays(); From b81f42ecbc0b4bd7db38f7f5239fe25d7cfa5ba7 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 24 Aug 2011 14:49:31 +0000 Subject: [PATCH 228/702] * complete encoder detection * need to break out connector and encoder addition into seperate functions as the linux kernel did... that function is getting pretty large and deep. * my card seems to map everything as TV DAC or TMDS... weird. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42684 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 2 + src/add-ons/accelerants/radeon_hd/display.cpp | 93 ++++++++++++++++--- 2 files changed, 81 insertions(+), 14 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index e001e7fdd5..1d38516c98 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -144,6 +144,8 @@ typedef struct { uint16 devices; uint32 connector_type; uint16 connector_object_id; + uint32 encoder_type; + uint16 encoder_object_id; // TODO struct radeon_i2c_bus_rec ddc_bus; // TODO struct radeon_hpd hpd; } connector_info; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 75874388db..344bf30042 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -418,14 +418,14 @@ detect_connectors() continue; } - // TODO : to find encoder for connector - #if 0 + uint32 encoder_type = VIDEO_ENCODER_NONE; + uint16 encoder_object_id = 0; int32 j; for (j = 0; j < ((B_LENDIAN_TO_HOST_INT16(path->usSize) - 8) / 2); j++) { - //uint8 grph_obj_id - // = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & - // OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; + uint16 grph_obj_id + = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) + & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; //uint8 grph_obj_num // = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & // ENUM_ID_MASK) >> ENUM_ID_SHIFT; @@ -463,21 +463,81 @@ detect_connectors() record = (ATOM_COMMON_RECORD_HEADER *) ((char *)record + record->ucRecordSize); } - TRACE("%s: add encoder\n", __func__); - // TODO : add the encoder - Finally! - //radeon_add_atom_encoder(dev, - // encoder_obj, - // le16_to_cpu - // (path-> - // usDeviceTag), - // caps); + uint32 encoder_id = (encoder_obj & OBJECT_ID_MASK) + >> OBJECT_ID_SHIFT; + uint32 encoder_support + = B_LENDIAN_TO_HOST_INT16(path->usDeviceTag); + + switch(encoder_id) { + case ENCODER_OBJECT_ID_INTERNAL_LVDS: + case ENCODER_OBJECT_ID_INTERNAL_TMDS1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: + case ENCODER_OBJECT_ID_INTERNAL_LVTM1: + if (encoder_support + & ATOM_DEVICE_LCD_SUPPORT) { + encoder_type = VIDEO_ENCODER_LVDS; + // radeon_atombios_get_lvds_info + } else { + encoder_type = VIDEO_ENCODER_TMDS; + // radeon_atombios_set_dig_info + } + // drm_encoder_helper_add + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC1: + encoder_type = VIDEO_ENCODER_DAC; + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: + encoder_type = VIDEO_ENCODER_TVDAC; + // drm_encoder_helper_add + break; + case ENCODER_OBJECT_ID_INTERNAL_DVO1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: + case ENCODER_OBJECT_ID_INTERNAL_DDI: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: + if (encoder_support + & ATOM_DEVICE_LCD_SUPPORT) { + encoder_type = VIDEO_ENCODER_LVDS; + } else if (encoder_support + & ATOM_DEVICE_CRT_SUPPORT) { + encoder_type = VIDEO_ENCODER_DAC; + } else { + encoder_type = VIDEO_ENCODER_TMDS; + } + // drm_encoder_helper_add + break; + case ENCODER_OBJECT_ID_SI170B: + case ENCODER_OBJECT_ID_CH7303: + case ENCODER_OBJECT_ID_EXTERNAL_SDVOA: + case ENCODER_OBJECT_ID_EXTERNAL_SDVOB: + case ENCODER_OBJECT_ID_TITFP513: + case ENCODER_OBJECT_ID_VT1623: + case ENCODER_OBJECT_ID_HDMI_SI1930: + case ENCODER_OBJECT_ID_TRAVIS: + case ENCODER_OBJECT_ID_NUTMEG: + if (encoder_support + & ATOM_DEVICE_LCD_SUPPORT) { + encoder_type = VIDEO_ENCODER_LVDS; + } else if (encoder_support + & ATOM_DEVICE_CRT_SUPPORT) { + encoder_type = VIDEO_ENCODER_DAC; + } else { + encoder_type = VIDEO_ENCODER_TMDS; + } + // drm_encoder_helper_add + break; + } + encoder_object_id = grph_obj_id; } } } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { ERROR("%s: TODO : Router object?\n", __func__); } } - #endif // TODO : look up gpio for ddc, hpd @@ -486,10 +546,15 @@ detect_connectors() TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 ")\n", __func__, i, decode_connector_name(connector_type), connector_type); + TRACE("%s: Path #%" B_PRId32 ": Found encoder %s\n", __func__, + i, decode_encoder_name(encoder_type)); + gConnector[connector_index]->valid = true; gConnector[connector_index]->connector_type = connector_type; gConnector[connector_index]->connector_object_id = connector_object_id; + gConnector[connector_index]->encoder_type = encoder_type; + gConnector[connector_index]->encoder_object_id = encoder_object_id; connector_index++; // radeon_add_atom_connector(dev, From fdecfdb35c43042531ab1722ba068cc69798a157 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Wed, 24 Aug 2011 21:04:55 +0000 Subject: [PATCH 229/702] Increase the size of the default raw and default vmware image. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42685 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/BuildSetup | 2 +- build/jam/HaikuImage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 5099d523c2..0a97eb6c67 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -65,7 +65,7 @@ HAIKU_DEFAULT_IMAGE_NAME = haiku.image ; HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ; HAIKU_DEFAULT_VMWARE_IMAGE_NAME = haiku.vmdk ; HAIKU_DEFAULT_INSTALL_DIR = /Haiku ; -HAIKU_DEFAULT_IMAGE_SIZE ?= 230 ; # 230 MB +HAIKU_DEFAULT_IMAGE_SIZE ?= 300 ; # 300 MB HAIKU_DEFAULT_IMAGE_LABEL ?= Haiku ; # Haiku CD defaults diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 1e22fcc013..c18ada62be 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -775,7 +775,7 @@ UserBuildConfigRulePreImage ; HAIKU_IMAGE_NAME ?= $(HAIKU_DEFAULT_IMAGE_NAME) ; HAIKU_IMAGE_DIR ?= $(HAIKU_DEFAULT_IMAGE_DIR) ; HAIKU_IMAGE = $(HAIKU_IMAGE_NAME) ; -HAIKU_IMAGE_SIZE ?= $(HAIKU_DEFAULT_IMAGE_SIZE) ; # 230 MB +HAIKU_IMAGE_SIZE ?= $(HAIKU_DEFAULT_IMAGE_SIZE) ; # 300 MB HAIKU_IMAGE_LABEL ?= $(HAIKU_DEFAULT_IMAGE_LABEL) ; MakeLocate $(HAIKU_IMAGE) : $(HAIKU_IMAGE_DIR) ; From f6102c6fba34f639d328d3480948f21ec76f80c9 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 24 Aug 2011 22:06:24 +0000 Subject: [PATCH 230/702] Improve drag'n'drop in Locale preflet: * following a hint by Stephan: implement drawing of a drop target indicator, a global one (bounds) for the available languages and an individual drop target indicator ("between" the items) for the preferred languages * fix drag'n'drop within preferred languages listview * finish support for manipulating multiple items in preferred languages listview git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42686 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/locale/LanguageListView.cpp | 104 +++++++++++++++----- src/preferences/locale/LanguageListView.h | 5 + src/preferences/locale/LocaleWindow.cpp | 38 ++++--- 3 files changed, 109 insertions(+), 38 deletions(-) diff --git a/src/preferences/locale/LanguageListView.cpp b/src/preferences/locale/LanguageListView.cpp index b823e893fe..9787ae00a4 100644 --- a/src/preferences/locale/LanguageListView.cpp +++ b/src/preferences/locale/LanguageListView.cpp @@ -62,25 +62,21 @@ void LanguageListItem::DrawItemWithTextOffset(BView* owner, BRect frame, bool complete, float textOffset) { - static const rgb_color kHighlight = {140, 140, 140, 0}; - static const rgb_color kBlack = {0, 0, 0, 0}; - if (IsSelected() || complete) { rgb_color color; if (IsSelected()) - color = kHighlight; + color = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR); else color = owner->ViewColor(); owner->SetHighColor(color); owner->SetLowColor(color); owner->FillRect(frame); - owner->SetHighColor(kBlack); } else owner->SetLowColor(owner->ViewColor()); BString text = Text(); if (IsEnabled()) - owner->SetHighColor(kBlack); + owner->SetHighColor(ui_color(B_CONTROL_TEXT_COLOR)); else { owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_3_TINT)); text << " [" << B_TRANSLATE("already chosen") << "]"; @@ -168,6 +164,8 @@ LanguageListView::LanguageListView(const char* name, list_view_type type) : BOutlineListView(name, type), fDropIndex(-1), + fDropTargetHighlightFrame(), + fGlobalDropTargetIndicator(false), fDeleteMessage(NULL), fDragMessage(NULL) { @@ -231,6 +229,13 @@ LanguageListView::SetDragMessage(BMessage* message) } +void +LanguageListView::SetGlobalDropTargetIndicator(bool isGlobal) +{ + fGlobalDropTargetIndicator = isGlobal; +} + + void LanguageListView::AttachedToWindow() { @@ -247,13 +252,24 @@ LanguageListView::MessageReceived(BMessage* message) BMessage dragMessage(*message); dragMessage.AddInt32("drop_index", fDropIndex); dragMessage.AddPointer("drop_target", this); - - Invoke(&dragMessage); + Messenger().SendMessage(&dragMessage); } else BOutlineListView::MessageReceived(message); } +void +LanguageListView::Draw(BRect updateRect) +{ + BOutlineListView::Draw(updateRect); + + if (fDropIndex >= 0 && fDropTargetHighlightFrame.IsValid()) { + SetHighColor(ui_color(B_CONTROL_HIGHLIGHT_COLOR)); + StrokeRect(fDropTargetHighlightFrame); + } +} + + bool LanguageListView::InitiateDrag(BPoint point, int32 dragIndex, bool /*wasSelected*/) @@ -261,7 +277,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 dragIndex, if (fDragMessage == NULL) return false; - BListItem* item = FullListItemAt(CurrentSelection(0)); + BListItem* item = ItemAt(CurrentSelection(0)); if (item == NULL) { // workaround for a timing problem // TODO: this should support extending the selection @@ -276,7 +292,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 dragIndex, message.AddPointer("listview", this); for (int32 i = 0;; i++) { - int32 index = FullListCurrentSelection(i); + int32 index = CurrentSelection(i); if (index < 0) break; @@ -292,7 +308,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 dragIndex, // figure out, how many items fit into our bitmap for (int32 i = 0, index; message.FindInt32("index", i, &index) == B_OK; i++) { - BListItem* item = FullListItemAt(index); + BListItem* item = ItemAt(index); if (item == NULL) break; @@ -318,7 +334,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 dragIndex, for (int32 i = 0; i < numItems; i++) { int32 index = message.FindInt32("index", i); LanguageListItem* item - = static_cast(FullListItemAt(index)); + = static_cast(ItemAt(index)); itemBounds.bottom = itemBounds.top + ceilf(item->Height()); if (itemBounds.bottom > dragRect.bottom) itemBounds.bottom = dragRect.bottom; @@ -378,21 +394,63 @@ LanguageListView::MouseMoved(BPoint where, uint32 transit, case B_ENTERED_VIEW: case B_INSIDE_VIEW: { - // set drop target through virtual function - // offset where by half of item height - BRect r = ItemFrame(0); - where.y += r.Height() / 2.0; + BRect highlightFrame; - int32 index = FullListIndexOf(where); - if (index < 0) - index = FullListCountItems(); - if (fDropIndex != index) + if (fGlobalDropTargetIndicator) { + highlightFrame = Bounds(); + fDropIndex = 0; + } else { + // offset where by half of item height + BRect r = ItemFrame(0); + where.y += r.Height() / 2.0; + + int32 index = IndexOf(where); + if (index < 0) + index = CountItems(); + highlightFrame = ItemFrame(index); + if (highlightFrame.IsValid()) + highlightFrame.bottom = highlightFrame.top; + else { + highlightFrame = ItemFrame(index - 1); + if (highlightFrame.IsValid()) + highlightFrame.top = highlightFrame.bottom; + else { + // empty view, show indicator at top + highlightFrame = Bounds(); + highlightFrame.bottom = highlightFrame.top; + } + } fDropIndex = index; - break; + } + + if (fDropTargetHighlightFrame != highlightFrame) { + Invalidate(fDropTargetHighlightFrame); + fDropTargetHighlightFrame = highlightFrame; + Invalidate(fDropTargetHighlightFrame); + } + + BOutlineListView::MouseMoved(where, transit, dragMessage); + return; } } - } else - BOutlineListView::MouseMoved(where, transit, dragMessage); + } + + if (fDropTargetHighlightFrame.IsValid()) { + Invalidate(fDropTargetHighlightFrame); + fDropTargetHighlightFrame = BRect(); + } + BOutlineListView::MouseMoved(where, transit, dragMessage); +} + + +void +LanguageListView::MouseUp(BPoint point) +{ + BOutlineListView::MouseUp(point); + if (fDropTargetHighlightFrame.IsValid()) { + Invalidate(fDropTargetHighlightFrame); + fDropTargetHighlightFrame = BRect(); + } } diff --git a/src/preferences/locale/LanguageListView.h b/src/preferences/locale/LanguageListView.h index 8d0b0d9482..79f5fa1365 100644 --- a/src/preferences/locale/LanguageListView.h +++ b/src/preferences/locale/LanguageListView.h @@ -74,11 +74,14 @@ public: void SetDeleteMessage(BMessage* message); void SetDragMessage(BMessage* message); + void SetGlobalDropTargetIndicator(bool isGlobal); + virtual void Draw(BRect updateRect); virtual bool InitiateDrag(BPoint point, int32 index, bool wasSelected); virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage); + virtual void MouseUp(BPoint point); virtual void AttachedToWindow(); virtual void MessageReceived(BMessage* message); virtual void KeyDown(const char* bytes, int32 numBytes); @@ -89,6 +92,8 @@ private: private: int32 fDropIndex; + BRect fDropTargetHighlightFrame; + bool fGlobalDropTargetIndicator; BMessage* fDeleteMessage; BMessage* fDragMessage; }; diff --git a/src/preferences/locale/LocaleWindow.cpp b/src/preferences/locale/LocaleWindow.cpp index 29b3180a6c..56757f9fe8 100644 --- a/src/preferences/locale/LocaleWindow.cpp +++ b/src/preferences/locale/LocaleWindow.cpp @@ -89,6 +89,7 @@ LocaleWindow::LocaleWindow() fLanguageListView->SetInvocationMessage(new BMessage(kMsgLanguageInvoked)); fLanguageListView->SetDragMessage(new BMessage(kMsgLanguageDragged)); + fLanguageListView->SetGlobalDropTargetIndicator(true); BFont font; fLanguageListView->GetFont(&font); @@ -335,7 +336,7 @@ LocaleWindow::MessageReceived(BMessage* message) for (int32 i = 0; message->FindInt32("index", i, &index) == B_OK; i++) { LanguageListItem* item = static_cast( - fLanguageListView->FullListItemAt(index)); + fLanguageListView->ItemAt(index)); _InsertPreferredLanguage(item, dropIndex++); } break; @@ -363,15 +364,18 @@ LocaleWindow::MessageReceived(BMessage* message) // change ordering int32 dropIndex = message->FindInt32("drop_index"); int32 index = 0; - if (message->FindInt32("index", &index) == B_OK - && dropIndex != index) { + for (int32 i = 0; + message->FindInt32("index", i, &index) == B_OK; + i++, dropIndex++) { + if (dropIndex > index) { + dropIndex--; + index -= i; + } BListItem* item = fPreferredListView->RemoveItem(index); - if (dropIndex > index) - index--; fPreferredListView->AddItem(item, dropIndex); - - _PreferredLanguagesChanged(); } + + _PreferredLanguagesChanged(); break; } @@ -385,13 +389,18 @@ LocaleWindow::MessageReceived(BMessage* message) // Remove from preferred languages int32 index = 0; - if (message->FindInt32("index", &index) == B_OK) { - delete fPreferredListView->RemoveItem(index); - _PreferredLanguagesChanged(); + for (int32 i = 0; message->FindInt32("index", i, &index) == B_OK; + i++) { + delete fPreferredListView->RemoveItem(index - i); - if (message->what == kMsgPreferredLanguageDeleted) - fPreferredListView->Select(index); + if (message->what == kMsgPreferredLanguageDeleted) { + int32 count = fPreferredListView->CountItems(); + fPreferredListView->Select( + index < count ? index : count - 1); + } } + + _PreferredLanguagesChanged(); break; } @@ -495,10 +504,9 @@ LocaleWindow::_PreferredLanguagesChanged() { BMessage preferredLanguages; int index = 0; - while (index < fPreferredListView->FullListCountItems()) { - // only include subitems: we can guess the superitem from them anyway + while (index < fPreferredListView->CountItems()) { LanguageListItem* item = static_cast( - fPreferredListView->FullListItemAt(index)); + fPreferredListView->ItemAt(index)); if (item != NULL) preferredLanguages.AddString("language", item->ID()); index++; From 61f3c5c1c70ec0f97268c23ee0095cb43912384d Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 24 Aug 2011 23:38:22 +0000 Subject: [PATCH 231/702] Upped alpha profile image size to 750MB. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42687 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/ReleaseBuildProfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/ReleaseBuildProfiles b/build/jam/ReleaseBuildProfiles index 5e6472e0dc..2958c676ad 100644 --- a/build/jam/ReleaseBuildProfiles +++ b/build/jam/ReleaseBuildProfiles @@ -16,7 +16,7 @@ switch $(HAIKU_BUILD_PROFILE) { HAIKU_ROOT_USER_REAL_NAME = "Yourself" ; AddGroupToHaikuImage party : 101 : user sshd ; HAIKU_IMAGE_HOST_NAME = shredder ; - HAIKU_IMAGE_SIZE = 690 ; + HAIKU_IMAGE_SIZE = 750 ; HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ; AddOptionalHaikuImagePackages TimGMSoundFont TrackerNewTemplates From 51a01ea03b482556ca9780c879a727fad22201c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 25 Aug 2011 16:36:48 +0000 Subject: [PATCH 232/702] Patch from Gabriel Hartmann for his GSoC UVC project. Coding style updates by myself. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42688 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../media-add-ons/usb_webcam/CamDevice.cpp | 24 +- .../media/media-add-ons/usb_webcam/Jamfile | 2 +- .../usb_webcam/addons/uvc/UVCCamDevice.cpp | 844 ++++++++++++++++-- .../usb_webcam/addons/uvc/UVCCamDevice.h | 48 + .../usb_webcam/addons/uvc/UVCDeframer.cpp | 79 ++ .../usb_webcam/addons/uvc/UVCDeframer.h | 31 + src/bin/listusb.cpp | 2 +- 7 files changed, 940 insertions(+), 90 deletions(-) create mode 100644 src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCDeframer.cpp create mode 100644 src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCDeframer.h diff --git a/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp b/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp index 01ad8b1c1e..81d83fba02 100644 --- a/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp +++ b/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp @@ -565,8 +565,15 @@ CamDevice::DataPumpThread() } #ifdef SUPPORT_ISO else if (SupportsIsochronous()) { - int numPacketDescriptors = 20; + int numPacketDescriptors = 16; usb_iso_packet_descriptor packetDescriptors[numPacketDescriptors]; + + // Initialize packetDescriptor request lengths + for (int i = 0; iIsochronousTransfer(fBuffer, fBufferLen, packetDescriptors, numPacketDescriptors); + len = fIsoIn->IsochronousTransfer(fBuffer, fBufferLen, packetDescriptors, + numPacketDescriptors); #endif //PRINT((CH ": got %d bytes" CT, len)); @@ -594,8 +602,16 @@ CamDevice::DataPumpThread() #ifndef DEBUG_DISCARD_DATA if (fDataInput) { - fDataInput->Write(fBuffer, len); - // else drop + int fBufferIndex = 0; + for (int i = 0; i < numPacketDescriptors; i++) { + int actual_length = ((usb_iso_packet_descriptor) + packetDescriptors[i]).actual_length; + if (actual_length > 0) { + fDataInput->Write(&fBuffer[fBufferIndex], + actual_length); + } + fBufferIndex += actual_length; + } } #endif //snooze(2000); diff --git a/src/add-ons/media/media-add-ons/usb_webcam/Jamfile b/src/add-ons/media/media-add-ons/usb_webcam/Jamfile index 994f6e6a0b..c8f5e3f1a2 100644 --- a/src/add-ons/media/media-add-ons/usb_webcam/Jamfile +++ b/src/add-ons/media/media-add-ons/usb_webcam/Jamfile @@ -35,7 +35,7 @@ addonSources = QuickCamDevice.cpp SonixCamDevice.cpp NW80xCamDevice.cpp -# UVCCamDevice.cpp +# UVCCamDevice.cpp UVCDeframer.cpp ; ## colorspace transforms sources diff --git a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp index 1fe8479863..21b3b06cb7 100644 --- a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp +++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2011, Gabriel Hartmann, gabriel.hartmann@gmail.com. * Copyright 2011, Jérôme Duval, korli@users.berlios.de. * Copyright 2009, Ithamar Adema, . * Distributed under the terms of the MIT License. @@ -6,10 +7,12 @@ #include "UVCCamDevice.h" +#include "UVCDeframer.h" #include - -#include "CamStreamingDeframer.h" +#include +#include +#include usb_webcam_support_descriptor kSupportedDevices[] = { @@ -60,27 +63,14 @@ print_guid(const usbvc_guid guid) } -// TODO dumb sof_marks and eof_marks -static const uint8 sof_mark_1[] = { 0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96, 0x00 }; -static const uint8 sof_mark_2[] = { 0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96, 0x01 }; -static const uint8 *sof_marks[] = { sof_mark_1, sof_mark_2 }; - -static const uint8 eof_mark_1[] = { 0x00, 0x00, 0x00, 0x00 }; -static const uint8 eof_mark_2[] = { 0x40, 0x00, 0x00, 0x00 }; -static const uint8 eof_mark_3[] = { 0x80, 0x00, 0x00, 0x00 }; -static const uint8 eof_mark_4[] = { 0xc0, 0x00, 0x00, 0x00 }; -static const uint8 *eof_marks[] = { eof_mark_1, eof_mark_2, eof_mark_3, eof_mark_4 }; - - - -UVCCamDevice::UVCCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) +UVCCamDevice::UVCCamDevice(CamDeviceAddon& _addon, BUSBDevice* _device) : CamDevice(_addon, _device), fHeaderDescriptor(NULL), - fInterruptIn(NULL) + fInterruptIn(NULL), + fUncompressedFormatIndex(1), + fUncompressedFrameIndex(1) { - fDeframer = new CamStreamingDeframer(this); - fDeframer->RegisterSOFTags(sof_marks, 2, sizeof(sof_mark_1), 12); - fDeframer->RegisterEOFTags(eof_marks, 4, sizeof(eof_mark_1), sizeof(eof_mark_1)); + fDeframer = new UVCDeframer(this); SetDataInput(fDeframer); const BUSBConfiguration* config; @@ -88,7 +78,7 @@ UVCCamDevice::UVCCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) usb_descriptor* generic; uint8 buffer[1024]; - generic = (usb_descriptor *)buffer; + generic = (usb_descriptor*)buffer; for (uint32 i = 0; i < _device->CountConfigurations(); i++) { config = _device->ConfigurationAt(i); @@ -111,9 +101,8 @@ UVCCamDevice::UVCCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) _ParseVideoControl((const usbvc_class_descriptor*)generic, generic->generic.length); } - for (uint32 k = 0; k < interface->CountEndpoints(); k++) { - const BUSBEndpoint *e = interface->EndpointAt(i); + const BUSBEndpoint* e = interface->EndpointAt(i); if (e && e->IsInterrupt() && e->IsInput()) { fInterruptIn = e; break; @@ -137,7 +126,7 @@ UVCCamDevice::UVCCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) } for (uint32 k = 0; k < interface->CountEndpoints(); k++) { - const BUSBEndpoint *e = interface->EndpointAt(i); + const BUSBEndpoint* e = interface->EndpointAt(i); if (e && e->IsIsochronous() && e->IsInput()) { fIsoIn = e; break; @@ -151,6 +140,7 @@ UVCCamDevice::UVCCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) UVCCamDevice::~UVCCamDevice() { + free(fHeaderDescriptor); } @@ -158,11 +148,11 @@ void UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, size_t len) { - switch(_descriptor->descriptorSubtype) { + switch (_descriptor->descriptorSubtype) { case VS_INPUT_HEADER: { - const usbvc_input_header_descriptor* descriptor = - (const usbvc_input_header_descriptor*)_descriptor; + const usbvc_input_header_descriptor* descriptor + = (const usbvc_input_header_descriptor*)_descriptor; printf("VS_INPUT_HEADER:\t#fmts=%d,ept=0x%x\n", descriptor->numFormats, descriptor->endpointAddress); if (descriptor->info & 1) @@ -173,7 +163,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, printf("\ttrigger button fixed to still capture=%s\n", descriptor->triggerUsage ? "no" : "yes"); } - const uint8 *controls = descriptor->controls; + const uint8* controls = descriptor->controls; for (uint8 i = 0; i < descriptor->numFormats; i++, controls += descriptor->controlSize) { printf("\tfmt%d: %s %s %s %s - %s %s\n", i, @@ -188,8 +178,9 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, } case VS_FORMAT_UNCOMPRESSED: { - const usbvc_format_descriptor* descriptor = - (const usbvc_format_descriptor*)_descriptor; + const usbvc_format_descriptor* descriptor + = (const usbvc_format_descriptor*)_descriptor; + fUncompressedFormatIndex = descriptor->formatIndex; printf("VS_FORMAT_UNCOMPRESSED:\tbFormatIdx=%d,#frmdesc=%d,guid=", descriptor->formatIndex, descriptor->numFrameDescriptors); print_guid(descriptor->uncompressed.format); @@ -206,7 +197,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, if (descriptor->uncompressed.interlaceFlags & 4) printf("\tField 1 first\n"); printf("\tField Pattern: "); - switch((descriptor->uncompressed.interlaceFlags & 0x30) >> 4) { + switch ((descriptor->uncompressed.interlaceFlags & 0x30) >> 4) { case 0: printf("Field 1 only\n"); break; case 1: printf("Field 2 only\n"); break; case 2: printf("Regular pattern of fields 1 and 2\n"); break; @@ -217,13 +208,18 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, break; } case VS_FRAME_MJPEG: - printf("VS_FRAME_MJPEG:"); // fall through case VS_FRAME_UNCOMPRESSED: { - if (_descriptor->descriptorSubtype == VS_FRAME_UNCOMPRESSED) + const usbvc_frame_descriptor* descriptor + = (const usbvc_frame_descriptor*)_descriptor; + if (_descriptor->descriptorSubtype == VS_FRAME_UNCOMPRESSED) { printf("VS_FRAME_UNCOMPRESSED:"); - const usbvc_frame_descriptor* descriptor = - (const usbvc_frame_descriptor*)_descriptor; + fUncompressedFrames.AddItem( + new usbvc_frame_descriptor(*descriptor)); + } else { + printf("VS_FRAME_MJPEG:"); + fMJPEGFrames.AddItem(new usbvc_frame_descriptor(*descriptor)); + } printf("\tbFrameIdx=%d,stillsupported=%s," "fixedframerate=%s\n", descriptor->frameIndex, (descriptor->capabilities & 1) ? "yes" : "no", @@ -240,17 +236,17 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, descriptor->continuous.maxFrameInterval, descriptor->continuous.frameIntervalStep); } else for (uint8 i = 0; i < descriptor->frameIntervalType; i++) { - printf("discrete frame interval: %lu\n", + printf("\tdiscrete frame interval: %lu\n", descriptor->discreteFrameIntervals[i]); } break; } case VS_COLORFORMAT: { - const usbvc_color_matching_descriptor* descriptor = - (const usbvc_color_matching_descriptor*)_descriptor; + const usbvc_color_matching_descriptor* descriptor + = (const usbvc_color_matching_descriptor*)_descriptor; printf("VS_COLORFORMAT:\n\tbColorPrimaries: "); - switch(descriptor->colorPrimaries) { + switch (descriptor->colorPrimaries) { case 0: printf("Unspecified\n"); break; case 1: printf("BT.709,sRGB\n"); break; case 2: printf("BT.470-2(M)\n"); break; @@ -260,7 +256,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, default: printf("Invalid (%d)\n", descriptor->colorPrimaries); } printf("\tbTransferCharacteristics: "); - switch(descriptor->transferCharacteristics) { + switch (descriptor->transferCharacteristics) { case 0: printf("Unspecified\n"); break; case 1: printf("BT.709\n"); break; case 2: printf("BT.470-2(M)\n"); break; @@ -273,7 +269,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, descriptor->transferCharacteristics); } printf("\tbMatrixCoefficients: "); - switch(descriptor->matrixCoefficients) { + switch (descriptor->matrixCoefficients) { case 0: printf("Unspecified\n"); break; case 1: printf("BT.709\n"); break; case 2: printf("FCC\n"); break; @@ -286,12 +282,12 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, } case VS_OUTPUT_HEADER: { - const usbvc_output_header_descriptor* descriptor = - (const usbvc_output_header_descriptor*)_descriptor; + const usbvc_output_header_descriptor* descriptor + = (const usbvc_output_header_descriptor*)_descriptor; printf("VS_OUTPUT_HEADER:\t#fmts=%d,ept=0x%x\n", descriptor->numFormats, descriptor->endpointAddress); printf("\toutput terminal id=%d\n", descriptor->terminalLink); - const uint8 *controls = descriptor->controls; + const uint8* controls = descriptor->controls; for (uint8 i = 0; i < descriptor->numFormats; i++, controls += descriptor->controlSize) { printf("\tfmt%d: %s %s %s %s\n", i, @@ -304,8 +300,8 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, } case VS_STILL_IMAGE_FRAME: { - const usbvc_still_image_frame_descriptor* descriptor = - (const usbvc_still_image_frame_descriptor*)_descriptor; + const usbvc_still_image_frame_descriptor* descriptor + = (const usbvc_still_image_frame_descriptor*)_descriptor; printf("VS_STILL_IMAGE_FRAME:\t#imageSizes=%d,compressions=%d," "ept=0x%x\n", descriptor->numImageSizePatterns, descriptor->NumCompressionPatterns(), @@ -323,8 +319,9 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, } case VS_FORMAT_MJPEG: { - const usbvc_format_descriptor* descriptor = - (const usbvc_format_descriptor*)_descriptor; + const usbvc_format_descriptor* descriptor + = (const usbvc_format_descriptor*)_descriptor; + fMJPEGFormatIndex = descriptor->formatIndex; printf("VS_FORMAT_MJPEG:\tbFormatIdx=%d,#frmdesc=%d\n", descriptor->formatIndex, descriptor->numFrameDescriptors); printf("\t#flgs=%d,optfrmidx=%d,aspRX=%d,aspRY=%d\n", @@ -340,7 +337,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, if (descriptor->mjpeg.interlaceFlags & 4) printf("\tField 1 first\n"); printf("\tField Pattern: "); - switch((descriptor->mjpeg.interlaceFlags & 0x30) >> 4) { + switch ((descriptor->mjpeg.interlaceFlags & 0x30) >> 4) { case 0: printf("Field 1 only\n"); break; case 1: printf("Field 2 only\n"); break; case 2: printf("Regular pattern of fields 1 and 2\n"); break; @@ -376,10 +373,15 @@ void UVCCamDevice::_ParseVideoControl(const usbvc_class_descriptor* _descriptor, size_t len) { - switch(_descriptor->descriptorSubtype) { + switch (_descriptor->descriptorSubtype) { case VC_HEADER: { - fHeaderDescriptor = (usbvc_interface_header_descriptor*)_descriptor; + if (fHeaderDescriptor != NULL) { + printf("ERROR: multiple VC_HEADER! Skipping...\n"); + break; + } + fHeaderDescriptor = (usbvc_interface_header_descriptor*)malloc(len); + memcpy(fHeaderDescriptor, _descriptor, len); printf("VC_HEADER:\tUVC v%x.%02x, clk %.5f MHz\n", fHeaderDescriptor->version >> 8, fHeaderDescriptor->version & 0xff, @@ -392,16 +394,16 @@ UVCCamDevice::_ParseVideoControl(const usbvc_class_descriptor* _descriptor, } case VC_INPUT_TERMINAL: { - const usbvc_input_terminal_descriptor* descriptor = - (const usbvc_input_terminal_descriptor*)_descriptor; + const usbvc_input_terminal_descriptor* descriptor + = (const usbvc_input_terminal_descriptor*)_descriptor; printf("VC_INPUT_TERMINAL:\tid=%d,type=%04x,associated terminal=" "%d\n", descriptor->terminalID, descriptor->terminalType, descriptor->associatedTerminal); printf("\tDesc: %s\n", fDevice->DecodeStringDescriptor(descriptor->terminal)); if (descriptor->terminalType == 0x201) { - const usbvc_camera_terminal_descriptor* desc = - (const usbvc_camera_terminal_descriptor*)descriptor; + const usbvc_camera_terminal_descriptor* desc + = (const usbvc_camera_terminal_descriptor*)descriptor; printf("\tObjectiveFocalLength Min/Max %d/%d\n", desc->objectiveFocalLengthMin, desc->objectiveFocalLengthMax); @@ -412,8 +414,8 @@ UVCCamDevice::_ParseVideoControl(const usbvc_class_descriptor* _descriptor, } case VC_OUTPUT_TERMINAL: { - const usbvc_output_terminal_descriptor* descriptor = - (const usbvc_output_terminal_descriptor*)_descriptor; + const usbvc_output_terminal_descriptor* descriptor + = (const usbvc_output_terminal_descriptor*)_descriptor; printf("VC_OUTPUT_TERMINAL:\tid=%d,type=%04x,associated terminal=" "%d, src id=%d\n", descriptor->terminalID, descriptor->terminalType, descriptor->associatedTerminal, @@ -424,8 +426,8 @@ UVCCamDevice::_ParseVideoControl(const usbvc_class_descriptor* _descriptor, } case VC_SELECTOR_UNIT: { - const usbvc_selector_unit_descriptor* descriptor = - (const usbvc_selector_unit_descriptor*)_descriptor; + const usbvc_selector_unit_descriptor* descriptor + = (const usbvc_selector_unit_descriptor*)_descriptor; printf("VC_SELECTOR_UNIT:\tid=%d,#pins=%d\n", descriptor->unitID, descriptor->numInputPins); printf("\t"); @@ -438,9 +440,10 @@ UVCCamDevice::_ParseVideoControl(const usbvc_class_descriptor* _descriptor, } case VC_PROCESSING_UNIT: { - const usbvc_processing_unit_descriptor* descriptor = - (const usbvc_processing_unit_descriptor*)_descriptor; - printf("VC_PROCESSING_UNIT:\tid=%d,src id=%d, digmul=%d\n", + const usbvc_processing_unit_descriptor* descriptor + = (const usbvc_processing_unit_descriptor*)_descriptor; + fControlRequestIndex = fControlIndex + (descriptor->unitID << 8); + printf("VC_PROCESSING_UNIT:\t unit id=%d,src id=%d, digmul=%d\n", descriptor->unitID, descriptor->sourceID, descriptor->maxMultiplier); printf("\tbControlSize=%d\n", descriptor->controlSize); @@ -502,8 +505,8 @@ UVCCamDevice::_ParseVideoControl(const usbvc_class_descriptor* _descriptor, } case VC_EXTENSION_UNIT: { - const usbvc_extension_unit_descriptor* descriptor = - (const usbvc_extension_unit_descriptor*)_descriptor; + const usbvc_extension_unit_descriptor* descriptor + = (const usbvc_extension_unit_descriptor*)_descriptor; printf("VC_EXTENSION_UNIT:\tid=%d, guid=", descriptor->unitID); print_guid(descriptor->guidExtensionCode); printf("\n\t#ctrls=%d, #pins=%d\n", descriptor->numControls, @@ -547,34 +550,81 @@ UVCCamDevice::StopTransfer() status_t -UVCCamDevice::SuggestVideoFrame(uint32 &width, uint32 &height) +UVCCamDevice::SuggestVideoFrame(uint32& width, uint32& height) { + printf("UVCCamDevice::SuggestVideoFrame(%ld, %ld)\n", width, height); + // As in AcceptVideoFrame(), the suggestion should probably just be the + // first advertised uncompressed format, but current applications prefer + // 320x240, so this is tried first here as a suggestion. width = 320; height = 240; + if (!AcceptVideoFrame(width, height)) { + const usbvc_frame_descriptor* descriptor + = (const usbvc_frame_descriptor*)fUncompressedFrames.FirstItem(); + width = (*descriptor).width; + height = (*descriptor).height; + } return B_OK; } status_t -UVCCamDevice::AcceptVideoFrame(uint32 &width, uint32 &height) +UVCCamDevice::AcceptVideoFrame(uint32& width, uint32& height) { - width = 320; - height = 240; + printf("UVCCamDevice::AcceptVideoFrame(%ld, %ld)\n", width, height); + if (width <= 0 || height <= 0) { + // Uncomment below when applications support dimensions other than 320x240 + // This code selects the first listed available uncompressed frame format + /* + const usbvc_frame_descriptor* descriptor + = (const usbvc_frame_descriptor*)fUncompressedFrames.FirstItem(); + width = (*descriptor).width; + height = (*descriptor).height; + SetVideoFrame(BRect(0, 0, width - 1, height - 1)); + return B_OK; + */ + + width = 320; + height = 240; + } - SetVideoFrame(BRect(0, 0, width - 1, height - 1)); - return B_OK; + for (int i = 0; iControlTransfer( + USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, GET_CUR, + VS_STREAM_ERROR_CODE_CONTROL << 8, fStreamingIndex, 1, &error); + printf("Error code = Ox%x\n", error); + */ + usbvc_probecommit request; memset(&request, 0, sizeof(request)); - request.hint = 1 << 8; + request.hint = 1; request.SetFrameInterval(333333); - request.formatIndex = 1; - request.frameIndex = 3; + request.formatIndex = fUncompressedFormatIndex; + request.frameIndex = fUncompressedFrameIndex; size_t length = fHeaderDescriptor->version > 0x100 ? 34 : 26; size_t actualLength = fDevice->ControlTransfer( USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, SET_CUR, @@ -584,7 +634,8 @@ UVCCamDevice::_ProbeCommitFormat() " failed %ld\n", actualLength); return B_ERROR; } - + + /* usbvc_probecommit response; actualLength = fDevice->ControlTransfer( USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, GET_MAX, @@ -597,7 +648,16 @@ UVCCamDevice::_ProbeCommitFormat() printf("usbvc_probecommit response.compQuality %d\n", response.compQuality); request.compQuality = response.compQuality; - + */ + + + usbvc_probecommit response; + memset(&response, 0, sizeof(response)); + actualLength = fDevice->ControlTransfer( + USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, GET_CUR, + VS_PROBE_CONTROL << 8, fStreamingIndex, length, &response); + + /* actualLength = fDevice->ControlTransfer( USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, SET_CUR, VS_PROBE_CONTROL << 8, fStreamingIndex, length, &request); @@ -606,6 +666,7 @@ UVCCamDevice::_ProbeCommitFormat() " failed\n"); return B_ERROR; } + */ actualLength = fDevice->ControlTransfer( USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, SET_CUR, @@ -616,12 +677,14 @@ UVCCamDevice::_ProbeCommitFormat() return B_ERROR; } + fMaxVideoFrameSize = response.maxVideoFrameSize; fMaxPayloadTransferSize = response.maxPayloadTransferSize; printf("usbvc_probecommit setup done maxVideoFrameSize:%ld" " maxPayloadTransferSize:%ld\n", fMaxVideoFrameSize, fMaxPayloadTransferSize); + printf("UVCCamDevice::_ProbeCommitFormat()\n --> SUCCESSFUL\n"); return B_OK; } @@ -629,17 +692,18 @@ UVCCamDevice::_ProbeCommitFormat() status_t UVCCamDevice::_SelectBestAlternate() { - const BUSBConfiguration *config = fDevice->ActiveConfiguration(); - const BUSBInterface *streaming = config->InterfaceAt(fStreamingIndex); + printf("UVCCamDevice::_SelectBestAlternate()\n"); + const BUSBConfiguration* config = fDevice->ActiveConfiguration(); + const BUSBInterface* streaming = config->InterfaceAt(fStreamingIndex); uint32 bestBandwidth = 0; uint32 alternateIndex = 0; uint32 endpointIndex = 0; for (uint32 i = 0; i < streaming->CountAlternates(); i++) { - const BUSBInterface *alternate = streaming->AlternateAt(i); + const BUSBInterface* alternate = streaming->AlternateAt(i); for (uint32 j = 0; j < alternate->CountEndpoints(); j++) { - const BUSBEndpoint *endpoint = alternate->EndpointAt(j); + const BUSBEndpoint* endpoint = alternate->EndpointAt(j); if (!endpoint->IsIsochronous() || !endpoint->IsInput()) continue; if (fMaxPayloadTransferSize > endpoint->MaxPacketSize()) @@ -660,7 +724,7 @@ UVCCamDevice::_SelectBestAlternate() } printf("UVCCamDevice::_SelectBestAlternate() %ld\n", bestBandwidth); - if (((BUSBInterface *)streaming)->SetAlternate(alternateIndex) != B_OK) { + if (((BUSBInterface*)streaming)->SetAlternate(alternateIndex) != B_OK) { fprintf(stderr, "UVCCamDevice::_SelectBestAlternate()" " selecting alternate failed\n"); return B_ERROR; @@ -675,9 +739,10 @@ UVCCamDevice::_SelectBestAlternate() status_t UVCCamDevice::_SelectIdleAlternate() { - const BUSBConfiguration *config = fDevice->ActiveConfiguration(); - const BUSBInterface *streaming = config->InterfaceAt(fStreamingIndex); - if (((BUSBInterface *)streaming)->SetAlternate(0) != B_OK) { + printf("UVCCamDevice::_SelectIdleAlternate()\n"); + const BUSBConfiguration* config = fDevice->ActiveConfiguration(); + const BUSBInterface* streaming = config->InterfaceAt(fStreamingIndex); + if (((BUSBInterface*)streaming)->SetAlternate(0) != B_OK) { fprintf(stderr, "UVCCamDevice::_SelectIdleAlternate()" " selecting alternate failed\n"); return B_ERROR; @@ -692,6 +757,7 @@ UVCCamDevice::_SelectIdleAlternate() UVCCamDeviceAddon::UVCCamDeviceAddon(WebCamMediaAddOn* webcam) : CamDeviceAddon(webcam) { + printf("UVCCamDeviceAddon::UVCCamDeviceAddon(WebCamMediaAddOn* webcam)\n"); SetSupportedDevices(kSupportedDevices); } @@ -704,17 +770,627 @@ UVCCamDeviceAddon::~UVCCamDeviceAddon() const char * UVCCamDeviceAddon::BrandName() { + printf("UVCCamDeviceAddon::BrandName()\n"); return "USB Video Class"; } UVCCamDevice * -UVCCamDeviceAddon::Instantiate(CamRoster &roster, BUSBDevice *from) +UVCCamDeviceAddon::Instantiate(CamRoster& roster, BUSBDevice* from) { + printf("UVCCamDeviceAddon::Instantiate()\n"); return new UVCCamDevice(*this, from); } +float +UVCCamDevice::_AddParameter(BParameterGroup* group, + BParameterGroup** subgroup, int32 index, uint16 wValue, const char* name) +{ + float minValue = 0.0; + float maxValue = 100.0; + float currValue = 0.0; + + BContinuousParameter* p; + uint16 data; + + wValue = wValue << 8; + + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_MAX, wValue, fControlRequestIndex, 2, &data); + maxValue = (float)(*((uint16*)data)); + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_MIN, wValue, fControlRequestIndex, 2, &data); + minValue = (float)(*((uint16*)data)); + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, 2, &data); + currValue = (float)data; + + *subgroup = group->MakeGroup(name); + p = (*subgroup)->MakeContinuousParameter(index, + B_MEDIA_RAW_VIDEO, name, + B_GAIN, "", minValue, maxValue, 1.0 / (maxValue - minValue)); + + return currValue; +} + + +int UVCCamDevice::_AddAutoParameter(BParameterGroup* subgroup, int32 index, + uint16 wValue) +{ + uint8 data; + wValue <<= 8; + + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, 1, &data); + subgroup->MakeDiscreteParameter(index, B_MEDIA_RAW_VIDEO, "Auto", + B_ENABLE); + + return data; +} + + +void +UVCCamDevice::AddParameters(BParameterGroup* group, int32& index) +{ + printf("UVCCamDevice::AddParameters()\n"); + fFirstParameterID = index; +// debug_printf("fIndex = %d\n",fIndex); + BParameterGroup* subgroup; + BContinuousParameter* p; + CamDevice::AddParameters(group, index); + + const BUSBConfiguration* config; + const BUSBInterface* interface; + usb_descriptor* generic; + uint8 buffer[1024]; + + void* data = (void*)(new uint16); + + generic = (usb_descriptor*)buffer; + + for (uint32 i = 0; i < fDevice->CountConfigurations(); i++) { + config = fDevice->ConfigurationAt(i); + fDevice->SetConfiguration(config); + for (uint32 j = 0; j < config->CountInterfaces(); j++) { + interface = config->InterfaceAt(j); + if (interface->Class() == CC_VIDEO && interface->Subclass() + == SC_VIDEOCONTROL) { + for (uint32 k = 0; interface->OtherDescriptorAt(k, generic, + sizeof(buffer)) == B_OK; k++) { + if (generic->generic.descriptor_type != (USB_REQTYPE_CLASS + | USB_DESCRIPTOR_INTERFACE)) + continue; + + if (((const usbvc_class_descriptor*)generic)->descriptorSubtype + == VC_PROCESSING_UNIT) { + const usbvc_processing_unit_descriptor* descriptor + = (const usbvc_processing_unit_descriptor*)generic; + uint16 wValue = 0; // Control Selector + float minValue = 0.0; + float maxValue = 100.0; + if (descriptor->controlSize >= 1) { + if (descriptor->controls[0] & 1) { + // debug_printf("\tBRIGHTNESS\n"); + fBrightness = _AddParameter(group, &subgroup, index, + PU_BRIGHTNESS_CONTROL, "Brightness"); + } + if (descriptor->controls[0] & 2) { + // debug_printf("\tCONSTRAST\n"); + fContrast = _AddParameter(group, &subgroup, index + 1, + PU_CONTRAST_CONTROL, "Contrast"); + } + if (descriptor->controls[0] & 4) { + // debug_printf("\tHUE\n"); + fHue = _AddParameter(group, &subgroup, index + 2, + PU_HUE_CONTROL, "Hue"); + if (descriptor->controlSize >= 2) { + if (descriptor->controls[1] & 8) { + fHueAuto = _AddAutoParameter(subgroup, index + 3, + PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL); + } + } + } + if (descriptor->controls[0] & 8) { + // debug_printf("\tSATURATION\n"); + fSaturation = _AddParameter(group, &subgroup, index + 4, + PU_SATURATION_CONTROL, "Saturation"); + } + if (descriptor->controls[0] & 16) { + // debug_printf("\tSHARPNESS\n"); + fSharpness = _AddParameter(group, &subgroup, index + 5, + PU_SHARPNESS_CONTROL, "Sharpness"); + } + if (descriptor->controls[0] & 32) { + // debug_printf("\tGamma\n"); + fGamma = _AddParameter(group, &subgroup, index + 6, + PU_GAMMA_CONTROL, "Gamma"); + } + if (descriptor->controls[0] & 64) { + // debug_printf("\tWHITE BALANCE TEMPERATURE\n"); + fWBTemp = _AddParameter(group, &subgroup, index + 7, + PU_WHITE_BALANCE_TEMPERATURE_CONTROL, "WB Temperature"); + if (descriptor->controlSize >= 2) { + if (descriptor->controls[1] & 16) { + fWBTempAuto = _AddAutoParameter(subgroup, index + 8, + PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL); + } + } + } + if (descriptor->controls[0] & 128) { + // debug_printf("\tWhite Balance Component\n"); + fWBComponent = _AddParameter(group, &subgroup, index + 9, + PU_WHITE_BALANCE_COMPONENT_CONTROL, "WB Component"); + if (descriptor->controlSize >= 2) { + if (descriptor->controls[1] & 32) { + fWBTempAuto = _AddAutoParameter(subgroup, index + 10, + PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL); + } + } + } + } + if (descriptor->controlSize >= 2) { + if (descriptor->controls[1] & 1) { + // debug_printf("\tBACKLIGHT COMPENSATION\n"); + wValue = PU_BACKLIGHT_COMPENSATION_CONTROL; + wValue = wValue << 8; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_MAX, wValue, fControlRequestIndex, 2, data); + maxValue = (float)(*((uint16*)data)); + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_MIN, wValue, fControlRequestIndex, 2, data); + minValue = (float)(*((uint16*)data)); + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, 2, data); + fBacklightCompensation = (float)(*((uint16*)data)); + subgroup = group->MakeGroup("Backlight Compensation"); + if (maxValue - minValue == 1) { // Binary Switch + fBinaryBacklightCompensation = true; + subgroup->MakeDiscreteParameter(index + 11, + B_MEDIA_RAW_VIDEO, "Backlight Compensation", + B_ENABLE); + } else { // Range of values + fBinaryBacklightCompensation = false; + p = subgroup->MakeContinuousParameter(index + 11, + B_MEDIA_RAW_VIDEO, "Backlight Compensation", + B_GAIN, "", minValue, maxValue, 1.0/(maxValue - minValue)); + } + } + if (descriptor->controls[1] & 2) { + // debug_printf("\tGAIN\n"); + fGain = _AddParameter(group, &subgroup, index + 12, PU_GAIN_CONTROL, + "Gain"); + } + if (descriptor->controls[1] & 4) { + // debug_printf("\tPOWER LINE FREQUENCY\n"); + wValue = PU_POWER_LINE_FREQUENCY_CONTROL; + wValue = wValue << 8; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, 1, data); + fPowerlineFrequency = (uint16)(*((uint8*)data)); + subgroup = group->MakeGroup("Power Line Frequency"); + p = subgroup->MakeContinuousParameter(index + 13, + B_MEDIA_RAW_VIDEO, "Frequency", + B_GAIN, "", 0, 60.0, 1.0 / 60.0); + } + // TODO Determine whether controls apply to these + /* + if (descriptor->controls[1] & 64) + debug_printf("\tDigital Multiplier\n"); + if (descriptor->controls[1] & 128) + debug_printf("\tDigital Multiplier Limit\n"); + */ + } + // TODO Determine whether controls apply to these + /* + if (descriptor->controlSize >= 3) { + if (descriptor->controls[2] & 1) + debug_printf("\tAnalog Video Standard\n"); + if (descriptor->controls[2] & 2) + debug_printf("\tAnalog Video Lock Status\n"); + } + */ + } + } + } + } + } +} + + +status_t +UVCCamDevice::GetParameterValue(int32 id, bigtime_t* last_change, void* value, + size_t* size) +{ + printf("UVCCAmDevice::GetParameterValue(%ld)\n", id - fFirstParameterID); + float* currValue; + int* currValueInt; + void* data; + uint16 wValue = 0; + switch (id - fFirstParameterID) { + case 0: + // debug_printf("\tBrightness:\n"); + // debug_printf("\tValue = %f\n",fBrightness); + *size = sizeof(float); + currValue = ((float*)value); + *currValue = fBrightness; + *last_change = fLastParameterChanges; + return B_OK; + case 1: + // debug_printf("\tContrast:\n"); + // debug_printf("\tValue = %f\n",fContrast); + *size = sizeof(float); + currValue = ((float*)value); + *currValue = fContrast; + *last_change = fLastParameterChanges; + return B_OK; + case 2: + // debug_printf("\tHue:\n"); + // debug_printf("\tValue = %f\n",fHue); + *size = sizeof(float); + currValue = ((float*)value); + *currValue = fHue; + *last_change = fLastParameterChanges; + return B_OK; + case 4: + // debug_printf("\tSaturation:\n"); + // debug_printf("\tValue = %f\n",fSaturation); + *size = sizeof(float); + currValue = ((float*)value); + *currValue = fSaturation; + *last_change = fLastParameterChanges; + return B_OK; + case 5: + // debug_printf("\tSharpness:\n"); + // debug_printf("\tValue = %f\n",fSharpness); + *size = sizeof(float); + currValue = ((float*)value); + *currValue = fSharpness; + *last_change = fLastParameterChanges; + return B_OK; + case 7: + // debug_printf("\tWB Temperature:\n"); + *size = sizeof(float); + currValue = ((float*)value); + wValue = PU_WHITE_BALANCE_TEMPERATURE_CONTROL; + wValue = wValue << 8; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, 2, data); + fWBTemp = (float)(*((uint16*)data)); + // debug_printf("\tValue = %f\n",fWBTemp); + *currValue = fWBTemp; + *last_change = fLastParameterChanges; + return B_OK; + case 8: + // debug_printf("\tWB Temperature Auto:\n"); + // debug_printf("\tValue = %d\n",fWBTempAuto); + *size = sizeof(int); + currValueInt = ((int*)value); + *currValueInt = fWBTempAuto; + *last_change = fLastParameterChanges; + return B_OK; + case 11: + if (!fBinaryBacklightCompensation) { + // debug_printf("\tBacklight Compensation:\n"); + // debug_printf("\tValue = %f\n",fBacklightCompensation); + *size = sizeof(float); + currValue = ((float*)value); + *currValue = fBacklightCompensation; + *last_change = fLastParameterChanges; + } else { + // debug_printf("\tBacklight Compensation:\n"); + // debug_printf("\tValue = %d\n",fBacklightCompensationBinary); + currValueInt = ((int*)value); + *currValueInt = fBacklightCompensationBinary; + *last_change = fLastParameterChanges; + } + return B_OK; + case 12: + // debug_printf("\tGain:\n"); + // debug_printf("\tValue = %f\n",fGain); + *size = sizeof(float); + currValue = ((float*)value); + *currValue = fGain; + *last_change = fLastParameterChanges; + return B_OK; + case 13: + // debug_printf("\tPowerline Frequency:\n"); + // debug_printf("\tValue = %d\n",fPowerlineFrequency); + *size = sizeof(float); + currValue = ((float*)value); + switch (fPowerlineFrequency) { + case 0: + *currValue = 0.0; + break; + case 1: + *currValue = 50.0; + break; + case 2: + *currValue = 60.0; + break; + } + *last_change = fLastParameterChanges; + return B_OK; + + } + return B_BAD_VALUE; +} + + +status_t +UVCCamDevice::SetParameterValue(int32 id, bigtime_t when, const void* value, + size_t size) +{ + printf("UVCCamDevice::SetParameterValue(%ld)\n", id - fFirstParameterID); + uint16 wValue = 0; //Control Selector + uint16 setValue = 0; + switch (id - fFirstParameterID) { + case 0: + // debug_printf("\tBrightness:\n"); + // debug_printf("\tValue = %f\n",*((float*)value)); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + wValue = PU_BRIGHTNESS_CONTROL; + wValue = wValue << 8; + fBrightness = *((float*)value); + fLastParameterChanges = when; + setValue = (uint16)fBrightness; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + return B_OK; + case 1: + // debug_printf("\tContrast:\n"); + // debug_printf("\tValue = %f\n",*((float*)value)); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + wValue = PU_CONTRAST_CONTROL; + wValue = wValue << 8; + fContrast = *((float*)value); + fLastParameterChanges = when; + setValue = (uint16)fContrast; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + return B_OK; + case 2: + // debug_printf("\tHue:\n"); + // debug_printf("\tValue = %f\n",*((float*)value)); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + wValue = PU_HUE_CONTROL; + wValue = wValue << 8; + fHue = *((float*)value); + fLastParameterChanges = when; + setValue = (uint16)fHue; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + return B_OK; + case 4: + // debug_printf("\tSaturation:\n"); + // debug_printf("\tValue = %f\n",*((float*)value)); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + wValue = PU_SATURATION_CONTROL; + wValue = wValue << 8; + fSaturation = *((float*)value); + fLastParameterChanges = when; + setValue = (uint16)fSaturation; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + return B_OK; + case 5: + // debug_printf("\tSharpness:\n"); + // debug_printf("\tValue = %f\n",*((float*)value)); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + wValue = PU_SHARPNESS_CONTROL; + wValue = wValue << 8; + fSharpness = *((float*)value); + fLastParameterChanges = when; + setValue = (uint16)fSharpness; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + return B_OK; + case 7: + if (!fWBTempAuto) { + // debug_printf("\tWB Temperature:\n"); + // debug_printf("\tValue = %f\n",*((float*)value)); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + wValue = PU_WHITE_BALANCE_TEMPERATURE_CONTROL; + wValue = wValue << 8; + fWBTemp = *((float*)value); + fLastParameterChanges = when; + setValue = (uint16)fWBTemp; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + } + return B_OK; + case 8: + // debug_printf("\tWB Temperature Auto:\n"); + if (!value || (size != sizeof(int))) + return B_BAD_VALUE; + // debug_printf("\tValue = %d\n",*((int*)value)); + wValue = PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL; + wValue = wValue << 8; + fWBTempAuto = *((int*)value); + fLastParameterChanges = when; + setValue = fWBTempAuto; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 1, &setValue); + return B_OK; + case 11: + if (!fBinaryBacklightCompensation) { + // debug_printf("\tBacklight Compensation:\n"); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + // debug_printf("\tValue = %f\n",*((float*)value)); + wValue = PU_BACKLIGHT_COMPENSATION_CONTROL; + wValue = wValue << 8; + fBacklightCompensation = *((float*)value); + fLastParameterChanges = when; + setValue = (uint16)fBacklightCompensation; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + }else{ + // debug_printf("\tBacklight Compensation:\n"); + if (!value || (size != sizeof(int))) + return B_BAD_VALUE; + // debug_printf("\tValue = %d\n",*((int*)value)); + wValue = PU_BACKLIGHT_COMPENSATION_CONTROL; + wValue = wValue << 8; + fBacklightCompensationBinary = *((int*)value); + fLastParameterChanges = when; + setValue = fBacklightCompensationBinary; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + } + return B_OK; + case 12: + // debug_printf("\tGain:\n"); + // debug_printf("\tValue = %f\n",*((float*)value)); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + wValue = PU_GAIN_CONTROL; + wValue = wValue << 8; + fGain = *((float*)value); + fLastParameterChanges = when; + setValue = (uint16)fGain; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 2, &setValue); + return B_OK; + case 13: + // debug_printf("\tPowerline Frequency:\n"); + // debug_printf("\tValue = %f\n",*((float*)value)); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + wValue = PU_POWER_LINE_FREQUENCY_CONTROL; + wValue = wValue << 8; + float inValue = *((float*)value); + fPowerlineFrequency = 0; + if (inValue > 45.0 && inValue < 55.0) { + fPowerlineFrequency = 1; + } + if (inValue >= 55.0) { + fPowerlineFrequency = 2; + } + fLastParameterChanges = when; + setValue = (uint8)fPowerlineFrequency; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, + SET_CUR, wValue, fControlRequestIndex, 1, &setValue); + return B_OK; + + } + return B_BAD_VALUE; +} + + +status_t +UVCCamDevice::FillFrameBuffer(BBuffer* buffer, bigtime_t* stamp) +{ + memset(buffer->Data(), 0, buffer->SizeAvailable()); + status_t err = fDeframer->WaitFrame(2000000); + if (err < B_OK) { + fprintf(stderr, "WaitFrame: %lx\n", err); + return err; + } + + CamFrame* f; + err = fDeframer->GetFrame(&f, stamp); + if (err < B_OK) { + fprintf(stderr, "GetFrame: %lx\n", err); + return err; + } + + long int w = (long)(VideoFrame().right - VideoFrame().left + 1); + long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1); + + if (buffer->SizeAvailable() >= (size_t)w * h * 4) { + // TODO: The Video Producer only outputs B_RGB32. This is OK for most + // applications. This could be leveraged if applications can + // consume B_YUV422. + _DecodeColor((unsigned char*)buffer->Data(), + (unsigned char*)f->Buffer(), w, h); + } + delete f; + return B_OK; +} + + +void +UVCCamDevice::_DecodeColor(unsigned char* dst, unsigned char* src, + int32 width, int32 height) +{ + long int i; + unsigned char* rawpt, * scanpt; + long int size; + + rawpt = src; + scanpt = dst; + size = width*height; + + for ( i = 0; i < size; i++ ) { + if ( (i/width) % 2 == 0 ) { + if ( (i % 2) == 0 ) { + /* B */ + if ( (i > width) && ((i % width) > 0) ) { + *scanpt++ = (*(rawpt-width-1)+*(rawpt-width+1) + + *(rawpt+width-1)+*(rawpt+width+1))/4; /* R */ + *scanpt++ = (*(rawpt-1)+*(rawpt+1) + + *(rawpt+width)+*(rawpt-width))/4; /* G */ + *scanpt++ = *rawpt; /* B */ + } else { + /* first line or left column */ + *scanpt++ = *(rawpt+width+1); /* R */ + *scanpt++ = (*(rawpt+1)+*(rawpt+width))/2; /* G */ + *scanpt++ = *rawpt; /* B */ + } + } else { + /* (B)G */ + if ( (i > width) && ((i % width) < (width-1)) ) { + *scanpt++ = (*(rawpt+width)+*(rawpt-width))/2; /* R */ + *scanpt++ = *rawpt; /* G */ + *scanpt++ = (*(rawpt-1)+*(rawpt+1))/2; /* B */ + } else { + /* first line or right column */ + *scanpt++ = *(rawpt+width); /* R */ + *scanpt++ = *rawpt; /* G */ + *scanpt++ = *(rawpt-1); /* B */ + } + } + } else { + if ( (i % 2) == 0 ) { + /* G(R) */ + if ( (i < (width*(height-1))) && ((i % width) > 0) ) { + *scanpt++ = (*(rawpt-1)+*(rawpt+1))/2; /* R */ + *scanpt++ = *rawpt; /* G */ + *scanpt++ = (*(rawpt+width)+*(rawpt-width))/2; /* B */ + } else { + /* bottom line or left column */ + *scanpt++ = *(rawpt+1); /* R */ + *scanpt++ = *rawpt; /* G */ + *scanpt++ = *(rawpt-width); /* B */ + } + } else { + /* R */ + if ( i < (width*(height-1)) && ((i % width) < (width-1)) ) { + *scanpt++ = *rawpt; /* R */ + *scanpt++ = (*(rawpt-1)+*(rawpt+1) + + *(rawpt-width)+*(rawpt+width))/4; /* G */ + *scanpt++ = (*(rawpt-width-1)+*(rawpt-width+1) + + *(rawpt+width-1)+*(rawpt+width+1))/4; /* B */ + } else { + /* bottom line or right column */ + *scanpt++ = *rawpt; /* R */ + *scanpt++ = (*(rawpt-1)+*(rawpt-width))/2; /* G */ + *scanpt++ = *(rawpt-width-1); /* B */ + } + } + } + rawpt++; + } +} + + extern "C" status_t B_WEBCAM_MKINTFUNC(uvccam) (WebCamMediaAddOn* webcam, CamDeviceAddon **addon) diff --git a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h index f8960c778d..26ecbf2d26 100644 --- a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h +++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h @@ -1,4 +1,5 @@ /* + * Copyright 2011, Gabriel Hartmann, gabriel.hartmann@gmail.com. * Copyright 2011, Jérôme Duval, korli@users.berlios.de. * Copyright 2009, Ithamar Adema, . * Distributed under the terms of the MIT License. @@ -24,6 +25,15 @@ public: uint32 &height); virtual status_t AcceptVideoFrame(uint32 &width, uint32 &height); + virtual void AddParameters(BParameterGroup *group, + int32 &index); + virtual status_t GetParameterValue(int32 id, + bigtime_t *last_change, void *value, + size_t *size); + virtual status_t SetParameterValue(int32 id, bigtime_t when, + const void *value, size_t size); + virtual status_t FillFrameBuffer(BBuffer *buffer, + bigtime_t *stamp = NULL); private: void _ParseVideoControl( @@ -35,14 +45,52 @@ private: status_t _ProbeCommitFormat(); status_t _SelectBestAlternate(); status_t _SelectIdleAlternate(); + void _DecodeColor(unsigned char *dst, + unsigned char *src, int32 width, + int32 height); + float _AddParameter(BParameterGroup* group, + BParameterGroup** subgroup, int32 index, + uint16 wValue, const char* name); + int _AddAutoParameter(BParameterGroup* subgroup, + int32 index, uint16 wValue); + usbvc_interface_header_descriptor *fHeaderDescriptor; const BUSBEndpoint* fInterruptIn; uint32 fControlIndex; + uint16 fControlRequestIndex; uint32 fStreamingIndex; + uint32 fUncompressedFormatIndex; + uint32 fUncompressedFrameIndex; + uint32 fMJPEGFormatIndex; + uint32 fMJPEGFrameIndex; uint32 fMaxVideoFrameSize; uint32 fMaxPayloadTransferSize; + + BList fUncompressedFrames; + BList fMJPEGFrames; + + float fBrightness; + float fContrast; + float fHue; + float fSaturation; + float fSharpness; + float fGamma; + float fWBTemp; + float fWBComponent; + float fBacklightCompensation; + float fGain; + + bool fBinaryBacklightCompensation; + + int fWBTempAuto; + int fWBCompAuto; + int fHueAuto; + int fBacklightCompensationBinary; + int fPowerlineFrequency; + + }; diff --git a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCDeframer.cpp b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCDeframer.cpp new file mode 100644 index 0000000000..de84f3840c --- /dev/null +++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCDeframer.cpp @@ -0,0 +1,79 @@ +/* + * Copyright 2011, Gabriel Hartmann, gabriel.hartmann@gmail.com. + * Distributed under the terms of the MIT License. + */ + + +#include "UVCDeframer.h" + +#include "CamDebug.h" +#include "CamDevice.h" + +#include + + +#define MAX_TAG_LEN CAMDEFRAMER_MAX_TAG_LEN +#define MAXFRAMEBUF CAMDEFRAMER_MAX_QUEUED_FRAMES + + +UVCDeframer::UVCDeframer(CamDevice* device) + : CamDeframer(device), + fFrameCount(0), + fID(0) +{ +} + + +UVCDeframer::~UVCDeframer() +{ +} + + +ssize_t +UVCDeframer::Write(const void* buffer, size_t size) +{ + const uint8* buf = (const uint8*)buffer; + int payloadSize = size - buf[0]; // total length - header length + + // This packet is just a header + if (size == buf[0]) + return 0; + + // Allocate frame + if (!fCurrentFrame) { + BAutolock l(fLocker); + if (fFrames.CountItems() < MAXFRAMEBUF) + fCurrentFrame = AllocFrame(); + else { + printf("Dropped %ld bytes. Too many queued frames.)\n", size); + return size; + } + } + + // Write payload to buffer + fInputBuffer.Write(&buf[buf[0]], payloadSize); + + // If end of frame add frame to list of frames + if ((buf[1] & 2) || (buf[1] & 1) != fID) { + fID = buf[1] & 1; + fFrameCount++; + buf = (uint8*)fInputBuffer.Buffer(); + fCurrentFrame->Write(buf, fInputBuffer.BufferLength()); + fFrames.AddItem(fCurrentFrame); + release_sem(fFrameSem); + fCurrentFrame = NULL; + } + + return size; +} + + +void +UVCDeframer::_PrintBuffer(const void* buffer, size_t size) +{ + uint8* b = (uint8*)buffer; + for (size_t i = 0; i < size; i++) + printf("0x%x\t", b[i]); + printf("\n"); +} + diff --git a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCDeframer.h b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCDeframer.h new file mode 100644 index 0000000000..f642bafdc7 --- /dev/null +++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCDeframer.h @@ -0,0 +1,31 @@ +/* + * Copyright 2011, Gabriel Hartmann, gabriel.hartmann@gmail.com. + * Distributed under the terms of the MIT License. + */ +#ifndef _UVC_DEFRAMER_H +#define _UVC_DEFRAMER_H + + +#include "CamDeframer.h" + +#include + + +class UVCDeframer : public CamDeframer { +public: + UVCDeframer(CamDevice *device); + virtual ~UVCDeframer(); + // BPositionIO interface + // write from usb transfers + virtual ssize_t Write(const void *buffer, size_t size); + +private: + void _PrintBuffer(const void* buffer, size_t size); + + int32 fFrameCount; + int32 fID; + BMallocIO fInputBuffer; +}; + +#endif /* _UVC_DEFRAMER_H */ + diff --git a/src/bin/listusb.cpp b/src/bin/listusb.cpp index f884b87690..f1e9782a1e 100644 --- a/src/bin/listusb.cpp +++ b/src/bin/listusb.cpp @@ -52,7 +52,7 @@ ClassName(int classNumber) { case 0xE0: return "Wireless controller"; case 0xEF: - return "Miscelaneous"; + return "Miscellaneous"; case 0xFE: return "Application specific"; case 0xFF: From a3ab429e0760a86e91e881e3f88015dbe2d280cd Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 25 Aug 2011 20:20:32 +0000 Subject: [PATCH 233/702] * improve look of drop target indicator in Locale prefs, as it was too ugly even for my not so visually inclined taste - we now use a gradient which IMHO gives much more pleasant results * add TODO about whether or not code for drawing drop target inidicators should be added to ControlLook (or some other class with similar purpose) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42689 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/locale/LanguageListView.cpp | 22 +++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/preferences/locale/LanguageListView.cpp b/src/preferences/locale/LanguageListView.cpp index 9787ae00a4..cabd665262 100644 --- a/src/preferences/locale/LanguageListView.cpp +++ b/src/preferences/locale/LanguageListView.cpp @@ -19,7 +19,9 @@ #include #include #include +#include #include +#include #include @@ -264,8 +266,24 @@ LanguageListView::Draw(BRect updateRect) BOutlineListView::Draw(updateRect); if (fDropIndex >= 0 && fDropTargetHighlightFrame.IsValid()) { - SetHighColor(ui_color(B_CONTROL_HIGHLIGHT_COLOR)); - StrokeRect(fDropTargetHighlightFrame); + // TODO: decide if drawing of a drop target indicator should be moved + // into ControlLook + BGradientLinear gradient; + int step = fGlobalDropTargetIndicator ? 64 : 128; + for (int i = 0; i < 256; i += step) + gradient.AddColor(i % (step * 2) == 0 + ? ViewColor() : ui_color(B_CONTROL_HIGHLIGHT_COLOR), i); + gradient.AddColor(ViewColor(), 255); + gradient.SetStart(fDropTargetHighlightFrame.LeftTop()); + gradient.SetEnd(fDropTargetHighlightFrame.RightBottom()); + if (fGlobalDropTargetIndicator) { + BRegion region(fDropTargetHighlightFrame); + region.Exclude(fDropTargetHighlightFrame.InsetByCopy(2.0, 2.0)); + ConstrainClippingRegion(®ion); + FillRect(fDropTargetHighlightFrame, gradient); + ConstrainClippingRegion(NULL); + } else + FillRect(fDropTargetHighlightFrame, gradient); } } From 26fbe862cfa75e6b8f18ba1c2a8f6900f7a2529a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 26 Aug 2011 10:31:29 +0000 Subject: [PATCH 234/702] Patch by John Scipione: Added cbrt() function to the supported functions and factrorial expression support. Closes ticket #7945, thanks a bunch! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42690 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/ExpressionParser.h | 1 + src/kits/shared/ExpressionParser.cpp | 69 +++++++++++++++-------- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/headers/private/shared/ExpressionParser.h b/headers/private/shared/ExpressionParser.h index 5052448533..9c835b3e93 100644 --- a/headers/private/shared/ExpressionParser.h +++ b/headers/private/shared/ExpressionParser.h @@ -59,6 +59,7 @@ class ExpressionParser { int32 argumentCount); MAPM _ParseFunction(const Token& token); MAPM _ParseAtom(); + MAPM _ParseFactorial(MAPM value); void _EatToken(int32 type); diff --git a/src/kits/shared/ExpressionParser.cpp b/src/kits/shared/ExpressionParser.cpp index 549a46bb76..1b2658d468 100644 --- a/src/kits/shared/ExpressionParser.cpp +++ b/src/kits/shared/ExpressionParser.cpp @@ -33,6 +33,7 @@ enum { TOKEN_MODULO, TOKEN_POWER, + TOKEN_FACTORIAL, TOKEN_OPENING_BRACKET, TOKEN_CLOSING_BRACKET, @@ -230,6 +231,9 @@ class Tokenizer { case '^': type = TOKEN_POWER; break; + case '!': + type = TOKEN_FACTORIAL; + break; case '(': type = TOKEN_OPENING_BRACKET; @@ -456,7 +460,7 @@ ExpressionParser::_ParseSum() default: fTokenizer->RewindToken(); - return value; + return _ParseFactorial(value); } } } @@ -491,7 +495,7 @@ ExpressionParser::_ParseProduct() default: fTokenizer->RewindToken(); - return value; + return _ParseFactorial(value); } } } @@ -506,7 +510,7 @@ ExpressionParser::_ParsePower() Token token = fTokenizer->NextToken(); if (token.type != TOKEN_POWER) { fTokenizer->RewindToken(); - return value; + return _ParseFactorial(value); } value = value.pow(_ParseUnary()); } @@ -565,9 +569,9 @@ MAPM ExpressionParser::_ParseFunction(const Token& token) { if (strcasecmp("e", token.string.String()) == 0) - return MAPM(MM_E); + return _ParseFactorial(MAPM(MM_E)); else if (strcasecmp("pi", token.string.String()) == 0) - return MAPM(MM_PI); + return _ParseFactorial(MAPM(MM_PI)); // hard coded cases for different count of arguments // supports functions with 3 arguments at most @@ -576,68 +580,71 @@ ExpressionParser::_ParseFunction(const Token& token) if (strcasecmp("abs", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].abs(); + return _ParseFactorial(values[0].abs()); } else if (strcasecmp("acos", token.string.String()) == 0) { _InitArguments(values, 1); if (values[0] < -1 || values[0] > 1) throw ParseException("out of domain", token.position); - return values[0].acos(); + return _ParseFactorial(values[0].acos()); } else if (strcasecmp("asin", token.string.String()) == 0) { _InitArguments(values, 1); if (values[0] < -1 || values[0] > 1) throw ParseException("out of domain", token.position); - return values[0].asin(); + return _ParseFactorial(values[0].asin()); } else if (strcasecmp("atan", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].atan(); + return _ParseFactorial(values[0].atan()); } else if (strcasecmp("atan2", token.string.String()) == 0) { _InitArguments(values, 2); - return values[0].atan2(values[1]); + return _ParseFactorial(values[0].atan2(values[1])); + } else if (strcasecmp("cbrt", token.string.String()) == 0) { + _InitArguments(values, 1); + return _ParseFactorial(values[0].cbrt()); } else if (strcasecmp("ceil", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].ceil(); + return _ParseFactorial(values[0].ceil()); } else if (strcasecmp("cos", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].cos(); + return _ParseFactorial(values[0].cos()); } else if (strcasecmp("cosh", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].cosh(); + return _ParseFactorial(values[0].cosh()); } else if (strcasecmp("exp", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].exp(); + return _ParseFactorial(values[0].exp()); } else if (strcasecmp("floor", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].floor(); + return _ParseFactorial(values[0].floor()); } else if (strcasecmp("ln", token.string.String()) == 0) { _InitArguments(values, 1); if (values[0] <= 0) throw ParseException("out of domain", token.position); - return values[0].log(); + return _ParseFactorial(values[0].log()); } else if (strcasecmp("log", token.string.String()) == 0) { _InitArguments(values, 1); if (values[0] <= 0) throw ParseException("out of domain", token.position); - return values[0].log10(); + return _ParseFactorial(values[0].log10()); } else if (strcasecmp("pow", token.string.String()) == 0) { _InitArguments(values, 2); - return values[0].pow(values[1]); + return _ParseFactorial(values[0].pow(values[1])); } else if (strcasecmp("sin", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].sin(); + return _ParseFactorial(values[0].sin()); } else if (strcasecmp("sinh", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].sinh(); + return _ParseFactorial(values[0].sinh()); } else if (strcasecmp("sqrt", token.string.String()) == 0) { _InitArguments(values, 1); if (values[0] < 0) throw ParseException("out of domain", token.position); - return values[0].sqrt(); + return _ParseFactorial(values[0].sqrt()); } else if (strcasecmp("tan", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].tan(); + return _ParseFactorial(values[0].tan()); } else if (strcasecmp("tanh", token.string.String()) == 0) { _InitArguments(values, 1); - return values[0].tanh(); + return _ParseFactorial(values[0].tanh()); } throw ParseException("unknown identifier", token.position); @@ -652,7 +659,7 @@ ExpressionParser::_ParseAtom() throw ParseException("unexpected end of expression", token.position); if (token.type == TOKEN_CONSTANT) - return token.value; + return _ParseFactorial(token.value); fTokenizer->RewindToken(); @@ -662,6 +669,20 @@ ExpressionParser::_ParseAtom() _EatToken(TOKEN_CLOSING_BRACKET); + return _ParseFactorial(value); +} + + +MAPM +ExpressionParser::_ParseFactorial(MAPM value) +{ + if (fTokenizer->NextToken().type == TOKEN_FACTORIAL) { + fTokenizer->RewindToken(); + _EatToken(TOKEN_FACTORIAL); + return value.factorial(); + } + + fTokenizer->RewindToken(); return value; } From 00912ff31761a083a08db13f3b8d072b8e81dc05 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 26 Aug 2011 19:28:39 +0000 Subject: [PATCH 235/702] * fix ICU-devel optional package to include link-time libraries (as links to the actual libs in /system/lib) * adjust installation code for ICU-devel to generate link for the non-versioned form (libicu*.so) and one matching the soname (libicu*.so.48) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42691 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalBuildFeatures | 2 +- build/jam/OptionalPackages | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index 8692a97bc2..b12bbd1999 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -59,7 +59,7 @@ if $(HAIKU_BUILD_FEATURE_SSL) { HAIKU_ICU_GCC_2_PACKAGE = icu-4.8.1-x86-gcc2-2011-08-20.zip ; HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1-x86-gcc4-2011-08-20.zip ; HAIKU_ICU_PPC_PACKAGE = icu-4.8.1-ppc-2011-08-20.zip ; -HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-2011-08-18.zip ; +HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-2011-08-26.zip ; if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 { local icu_package ; diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index c14550b84f..2be931295f 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -919,7 +919,7 @@ if [ IsOptionalHaikuImagePackageAdded ICU-devel ] { local arch = $(TARGET_ARCH) ; local abi = gcc$(HAIKU_GCC_VERSION[1]) ; for abiVersionedLib in $(HAIKU_ICU_LIBS) { - abiVersionedLib = $(abiVersionedLib:G=) ; + abiVersionedLib = $(abiVersionedLib:B:G=) ; local lib = $(abiVersionedLib:B) ; AddSymlinkToHaikuHybridImage develop abi $(arch) $(abi) lib : /system/lib $(abiVersionedLib) : : true ; From 20cc5ae73c4deeb6a070f9f455c96873ffb52395 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Fri, 26 Aug 2011 22:16:24 +0000 Subject: [PATCH 236/702] Update WebPositive package, new build was needed due to the new ICU 4.8. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42692 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalPackages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 2be931295f..12c5e08b12 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -1668,8 +1668,8 @@ if [ IsOptionalHaikuImagePackageAdded WebPositive ] { Echo "No optional package WebPositive available for gcc2" ; } else { InstallOptionalHaikuImagePackage - WebPositive-r1a3-gcc4-x86-r580-2011-06-02.zip - : $(baseURL)/WebPositive-r1a3-gcc4-x86-r580-2011-06-02.zip ; + WebPositive-gcc4-x86-r583-2011-08-26.zip + : $(baseURL)/WebPositive-gcc4-x86-r583-2011-08-26.zip ; AddSymlinkToHaikuImage home config be Applications : /boot/apps/WebPositive/WebPositive ; } From a46e462db934f9db9093930723715acf43194c39 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sat, 27 Aug 2011 05:54:55 +0000 Subject: [PATCH 237/702] * Fix the "USB USB Webcam" name: now generic UVC USB webcam will be named, well, that: Generic UVC USB Webcam. * Added my own Logitech HD Pro C910, which publish a compound device class, not an UVC class. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42693 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp index 21b3b06cb7..3db7689d47 100644 --- a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp +++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp @@ -17,7 +17,7 @@ usb_webcam_support_descriptor kSupportedDevices[] = { // ofcourse we support a generic UVC device... - {{ CC_VIDEO, SC_VIDEOCONTROL, 0, 0, 0 }, "USB", "Video Class", "??" }, + {{ CC_VIDEO, SC_VIDEOCONTROL, 0, 0, 0 }, "Generic UVC", "Video Class", "??" }, // ...whilst the following IDs were 'stolen' from a recent Linux driver: {{ 0, 0, 0, 0x045e, 0x00f8, }, "Microsoft", "Lifecam NX-6000", "??" }, {{ 0, 0, 0, 0x045e, 0x0723, }, "Microsoft", "Lifecam VX-7000", "??" }, @@ -27,6 +27,7 @@ usb_webcam_support_descriptor kSupportedDevices[] = { {{ 0, 0, 0, 0x046d, 0x08c5, }, "Logitech", "QuickCam Pro 5000", "??" }, {{ 0, 0, 0, 0x046d, 0x08c6, }, "Logitech", "QuickCam OEM Dell Notebook", "??" }, {{ 0, 0, 0, 0x046d, 0x08c7, }, "Logitech", "QuickCam OEM Cisco VT Camera II", "??" }, + {{ 0, 0, 0, 0x046d, 0x0821, }, "Logitech", "HD Pro Webcam C910", "??" }, {{ 0, 0, 0, 0x05ac, 0x8501, }, "Apple", "Built-In iSight", "??" }, {{ 0, 0, 0, 0x05e3, 0x0505, }, "Genesys Logic", "USB 2.0 PC Camera", "??" }, {{ 0, 0, 0, 0x0e8d, 0x0004, }, "N/A", "MT6227", "??" }, From 07658a130ee68ac167d6ad5b00289fd0a540c445 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 27 Aug 2011 09:15:50 +0000 Subject: [PATCH 238/702] Add some documentation for find_directory. This is very incomplete yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42694 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/Doxyfile | 2 + docs/user/storage/FindDirectory.dox | 179 ++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 docs/user/storage/FindDirectory.dox diff --git a/docs/user/Doxyfile b/docs/user/Doxyfile index 081015ff96..70b2a7bd50 100644 --- a/docs/user/Doxyfile +++ b/docs/user/Doxyfile @@ -470,6 +470,7 @@ INPUT = . \ locale \ midi \ midi2 \ + storage \ support \ ../../headers/os/app \ ../../headers/os/drivers/fs_interface.h \ @@ -491,6 +492,7 @@ INPUT = . \ ../../headers/os/locale \ ../../headers/os/midi2 \ ../../headers/os/storage/AppFileInfo.h \ + ../../headers/os/storage/FindDirectory.h \ ../../headers/os/support \ ../../headers/posix/syslog.h diff --git a/docs/user/storage/FindDirectory.dox b/docs/user/storage/FindDirectory.dox new file mode 100644 index 0000000000..f4754c93c1 --- /dev/null +++ b/docs/user/storage/FindDirectory.dox @@ -0,0 +1,179 @@ +/* + * Copyright 2011, Haiku inc. + * Distributed under the terms of the MIT Licence. + * + * Documentation by: + * Adrien Destugues + * Corresponds to: + * /trunk/headers/os/storage/FindDirectory.h rev 42600 + * /trunk/src/kits/storage/FindDirectory.cpp rev 42600 + */ + + +/*! + \file FindDirectory.h + \ingroup storage + \brief Provides the find_dirctory function. + + Haiku provides a set of directories for applications to use. These can be + accessed using the find_directory function. It is very important to use the + function at runtime and not hardcode the path, as it may change in future + versions of Haiku, and already changed in past ones. Using this function + makes your application more future-proof, and makes sure everyone puts data + in the same place, which makes the system cleaner and easier to manage. + + Note this function can be accessed from C code, to make it easy to use also + in ported applications. +*/ + +/*! + \enum directory_which + \brief Directory constants to use with find_directory. + + There are four kind of directories. Volume-local directories exist on each + volume. They may be at a different place in each of them, for example the + trash location depends on the filesystem. System and common directories are + system-wide. They live on only one volume. The difference is system is + only meant for internal system management and shouldn't be used by + applications. The common directories have a similar hierarchy, and they are + ignored when the user disable user add-ons in the boot menu. User + directories have a different value depending on the UID of the application + calling the function. They are usually located in the user home directory. + + Use common directories for system-wide filessuch as drivers. Use user + directories for application settings, since each user may want different + settings. +*/ + +/*! + \var directory_which B_DESKTOP_DIRECTORY + The desktop for a given volume. + + \var directory_which B_TRASH_DIRECTORY + The trash for a given volume. + + \var directory_which B_SYSTEM_DIRECTORY + The system directory. + + \var directory_which B_SYSTEM_ADDONS_DIRECTORY + The system add-ons directory + + \var directory_which B_SYSTEM_BOOT_DIRECTORY + The system boot directory. Contains the minimal set of files required for + booting Haiku. + + \var directory_which B_SYSTEM_FONTS_DIRECTORY + The system fonts directory + + \var directory_which B_SYSTEM_LIB_DIRECTORY + The system lib directory. + + \var directory_which B_SYSTEM_SERVERS_DIRECTORY + The system servers directory. + + \var directory_which B_SYSTEM_APPS_DIRECTORY + The system applications direcotry. Contains applications executable from + Tracker. + + \var directory_which B_SYSTEM_BIN_DIRECTORY + The system bin directory. Contains command-line applications runnable from + Terminal. + + \var directory_which B_SYSTEM_DOCUMENTATION_DIRECTORY + The system documentation directory. Contains manpages. + + \var directory_which B_SYSTEM_PREFERENCES_DIRECTORY + The system preferences directory. + + \var directory_which B_SYSTEM_TRANSLATORS_DIRECTORY + The system translator directory. + + \var directory_which B_SYSTEM_MEDIA_NODES_DIRECTORY + The system media nodes directory. + + \var directory_which B_SYSTEM_SOUNDS_DIRECTORY + The system sounds directory. + + \var directory_which B_SYSTEM_DATA_DIRECTORY + The system data directory. + + \var directory_which B_COMMON_DIRECTORY + The common directory. + + \var directory_which B_COMMON_SYSTEM_DIRECTORY + \var directory_which B_COMMON_ADDONS_DIRECTORY + \var directory_which B_COMMON_BOOT_DIRECTORY + \var directory_which B_COMMON_FONTS_DIRECTORY + \var directory_which B_COMMON_LIB_DIRECTORY + \var directory_which B_COMMON_SERVERS_DIRECTORY + \var directory_which B_COMMON_BIN_DIRECTORY + \var directory_which B_COMMON_ETC_DIRECTORY + \var directory_which B_COMMON_DOCUMENTATION_DIRECTORY + \var directory_which B_COMMON_SETTINGS_DIRECTORY + \var directory_which B_COMMON_DEVELOP_DIRECTORY + The common development directory. Contains toolchains, include files, + and other tools related to application development. + + \var directory_which B_COMMON_LOG_DIRECTORY + The common log directory. Log files are stored here. + + \var directory_which B_COMMON_SPOOL_DIRECTORY + \var directory_which B_COMMON_TEMP_DIRECTORY + \var directory_which B_COMMON_VAR_DIRECTORY + \var directory_which B_COMMON_TRANSLATORS_DIRECTORY + \var directory_which B_COMMON_MEDIA_NODES_DIRECTORY + \var directory_which B_COMMON_SOUNDS_DIRECTORY + \var directory_which B_COMMON_DATA_DIRECTORY + The common data directory. You may store application data here, such as + resources (graphics, music) for your application. + + \var directory_which B_COMMON_CACHE_DIRECTORY + The common cache directory. You may store temporary data here, such as + thumbnails for a picture viewer application, or a web browser data cache. + + \var directory_which B_USER_DIRECTORY + The user home directory. Do NOT store application settings here as on unix, + instead use B_USER_SETTINGS_DIRECTORY. + + \var directory_which B_USER_CONFIG_DIRECTORY + \var directory_which B_USER_ADDONS_DIRECTORY + \var directory_which B_USER_BOOT_DIRECTORY + \var directory_which B_USER_FONTS_DIRECTORY + \var directory_which B_USER_LIB_DIRECTORY + \var directory_which B_USER_SETTINGS_DIRECTORY + The user settings directory. You may store your application settings here. + Create a subdirectory for your application if you have multiple files to + store, else, put a single file. The file or directory should have the same + name as your application, so the user knows what it's used for. + + \var directory_which B_USER_DESKBAR_DIRECTORY + The user deskbar directory. You may add a link to your application here, so + it shows up in the user deskbar's leaf menu. + + \var directory_which B_USER_PRINTERS_DIRECTORY + \var directory_which B_USER_TRANSLATORS_DIRECTORY + \var directory_which B_USER_MEDIA_NODES_DIRECTORY + \var directory_which B_USER_SOUNDS_DIRECTORY + \var directory_which B_USER_DATA_DIRECTORY + \var directory_which B_USER_CACHE_DIRECTORY + + \var directory_which B_APPS_DIRECTORY + \var directory_which B_PREFERENCES_DIRECTORY + \var directory_which B_UTILITIES_DIRECTORY +*/ + +/*! + \fn status_t find_directory(directory_which which, dev_t volume, bool createIt, char* pathString, int32 length) + \brief C interface to find_directory + + Fills up to \a length characters of \a pathString with the path to \a which + on \a volume. Creates the directory if it doesn't exists and \a creqteIt is + set. +*/ + +/*! + \fn status_t find_directory(directory_which which, BPath* path, bool createIt = false, BVolume* volume = NULL) + \brief C++ interface to find_directory + + Set \a path to \a which on \a volume. +*/ From 68eccf0d5c4fdfe8d19d86298dc44457122382e5 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 27 Aug 2011 19:41:09 +0000 Subject: [PATCH 239/702] The description for frameMoved and FrameResized was wrong. Thank Skipp_OSX for noticing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42695 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/interface/Button.dox | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user/interface/Button.dox b/docs/user/interface/Button.dox index d3a510be38..5977c4e11e 100644 --- a/docs/user/interface/Button.dox +++ b/docs/user/interface/Button.dox @@ -338,7 +338,7 @@ /*! \fn void BButton::FrameMoved(BPoint newLocation) - \brief Move the frame of the BButton. + \brief Hook method that is called when the BButton has moved. \param newLocation The location on the screen that the BButton is moved to. @@ -349,7 +349,7 @@ /*! \fn void BButton::FrameResized(float width, float height) - \brief Resize the BButton. + \brief Hook method that is called when the BButton changes size. \param width the new \a width of the BButton \param height the new \a height of the BButton From 6041c9cd565f8e8598720b51863e346d1b5bb8b3 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 27 Aug 2011 19:56:26 +0000 Subject: [PATCH 240/702] Patch by jscipione : make sure deskbar calendar is always above deskbar. Thanks! Fixes #7855. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42696 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/CalendarMenuWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/apps/deskbar/CalendarMenuWindow.cpp b/src/apps/deskbar/CalendarMenuWindow.cpp index 9b77e805ec..162afbf5b4 100644 --- a/src/apps/deskbar/CalendarMenuWindow.cpp +++ b/src/apps/deskbar/CalendarMenuWindow.cpp @@ -88,6 +88,8 @@ CalendarMenuWindow::CalendarMenuWindow(BPoint where) fCalendarView(NULL), fSuppressFirstClose(true) { + SetFeel(B_FLOATING_ALL_WINDOW_FEEL); + BPrivate::week_start startOfWeek = (BPrivate::week_start)BLocale::Default()->StartOfWeek(); From 1e07062b408258cd82f9590761e8d0fc4ce33765 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 27 Aug 2011 21:19:56 +0000 Subject: [PATCH 241/702] Apply patch by Hamish, closing #7947 - thanks! * determine first day of week and draw calendarview accordingly * some cleanup: drop superfluous DateTimeView::Draw() * automatic whitespace cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42697 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/CalendarView.h | 7 ++++-- src/kits/shared/CalendarView.cpp | 19 ++++++++++++++++ src/preferences/time/DateTimeView.cpp | 32 +++++---------------------- src/preferences/time/DateTimeView.h | 1 - 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/headers/private/shared/CalendarView.h b/headers/private/shared/CalendarView.h index d61b7010a7..624f6e6980 100644 --- a/headers/private/shared/CalendarView.h +++ b/headers/private/shared/CalendarView.h @@ -36,10 +36,13 @@ class BCalendarView : public BView, public BInvoker { BCalendarView(BRect frame, const char *name, week_start start, uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); - + BCalendarView(const char* name, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); + BCalendarView(const char* name, week_start start, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); + virtual ~BCalendarView(); BCalendarView(BMessage *archive); @@ -91,7 +94,7 @@ class BCalendarView : public BView, public BInvoker { virtual void ResizeToPreferred(); virtual void GetPreferredSize(float *width, float *height); - + virtual BSize MaxSize(); virtual BSize MinSize(); virtual BSize PreferredSize(); diff --git a/src/kits/shared/CalendarView.cpp b/src/kits/shared/CalendarView.cpp index 7dcc8e92aa..ce1894342d 100644 --- a/src/kits/shared/CalendarView.cpp +++ b/src/kits/shared/CalendarView.cpp @@ -91,6 +91,25 @@ BCalendarView::BCalendarView(const char* name, uint32 flags) } +BCalendarView::BCalendarView(const char* name, week_start start, + uint32 flags) + : + BView(name, flags), + BInvoker(), + fSelectionMessage(NULL), + fDay(0), + fYear(0), + fMonth(0), + fFocusChanged(false), + fSelectionChanged(false), + fWeekStart(start), + fDayNameHeaderVisible(true), + fWeekNumberHeaderVisible(true) +{ + _InitObject(); +} + + BCalendarView::~BCalendarView() { SetSelectionMessage(NULL); diff --git a/src/preferences/time/DateTimeView.cpp b/src/preferences/time/DateTimeView.cpp index 6eea1f7b8b..7a7ef43bed 100644 --- a/src/preferences/time/DateTimeView.cpp +++ b/src/preferences/time/DateTimeView.cpp @@ -46,7 +46,7 @@ using BPrivate::B_LOCAL_TIME; DateTimeView::DateTimeView(const char* name) - : + : BGroupView(name, B_HORIZONTAL, 5), fGmtTime(NULL), fUseGmtTime(false), @@ -81,30 +81,6 @@ DateTimeView::AttachedToWindow() } -void -DateTimeView::Draw(BRect /*updateRect*/) -{ - rgb_color viewcolor = ViewColor(); - rgb_color dark = tint_color(viewcolor, B_DARKEN_4_TINT); - rgb_color light = tint_color(viewcolor, B_LIGHTEN_MAX_TINT); - - // draw a separator line - BRect bounds(Bounds()); - BPoint start(bounds.Width() / 2.0f, bounds.top + 5.0f); - BPoint end(bounds.Width() / 2.0, bounds.bottom - 5.0f); - - BeginLineArray(2); - AddLine(start, end, dark); - start.x++; - end.x++; - AddLine(start, end, light); - EndLineArray(); - - fTimeEdit->Draw(bounds); - fDateEdit->Draw(bounds); -} - - void DateTimeView::MessageReceived(BMessage* message) { @@ -211,7 +187,9 @@ DateTimeView::_PrefletUptime() const void DateTimeView::_InitView() { - fCalendarView = new BCalendarView("calendar"); + BPrivate::week_start weekStart = (BPrivate::week_start) + BLocale::Default()->StartOfWeek(); + fCalendarView = new BCalendarView("calendar", weekStart); fCalendarView->SetWeekNumberHeaderVisible(false); fCalendarView->SetSelectionMessage(new BMessage(kDayChanged)); fCalendarView->SetInvocationMessage(new BMessage(kDayChanged)); @@ -219,7 +197,7 @@ DateTimeView::_InitView() fDateEdit = new TDateEdit("dateEdit", 3); fTimeEdit = new TTimeEdit("timeEdit", 4); fClock = new TAnalogClock("analogClock"); - + BTime time(BTime::CurrentTime(B_LOCAL_TIME)); fClock->SetTime(time.Hour(), time.Minute(), time.Second()); diff --git a/src/preferences/time/DateTimeView.h b/src/preferences/time/DateTimeView.h index 3c97d50dca..9426610e2c 100644 --- a/src/preferences/time/DateTimeView.h +++ b/src/preferences/time/DateTimeView.h @@ -34,7 +34,6 @@ public: virtual ~DateTimeView(); virtual void AttachedToWindow(); - virtual void Draw(BRect updaterect); virtual void MessageReceived(BMessage* message); bool CheckCanRevert(); From 87663db420980bdfe50101b6d067dea5e4ded7b2 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 28 Aug 2011 10:15:41 +0000 Subject: [PATCH 242/702] Minor cleanup: respect 80-chars line length limit git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42698 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/CalendarView.h | 66 ++++++++++++++++++--------- src/kits/shared/CalendarView.cpp | 34 +++++++++----- 2 files changed, 66 insertions(+), 34 deletions(-) diff --git a/headers/private/shared/CalendarView.h b/headers/private/shared/CalendarView.h index 624f6e6980..6525de165d 100644 --- a/headers/private/shared/CalendarView.h +++ b/headers/private/shared/CalendarView.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2011, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _CALENDAR_VIEW_H_ @@ -30,24 +30,32 @@ enum week_start { class BCalendarView : public BView, public BInvoker { public: BCalendarView(BRect frame, const char *name, - uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, - uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); + uint32 resizeMask = B_FOLLOW_LEFT + | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS + | B_NAVIGABLE); - BCalendarView(BRect frame, const char *name, week_start start, - uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, - uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); + BCalendarView(BRect frame, const char *name, + week_start start, + uint32 resizeMask = B_FOLLOW_LEFT + | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS + | B_NAVIGABLE); BCalendarView(const char* name, - uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS + | B_NAVIGABLE); - BCalendarView(const char* name, week_start start, - uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); + BCalendarView(const char* name, + week_start start, uint32 flags = B_WILL_DRAW + | B_FRAME_EVENTS | B_NAVIGABLE); virtual ~BCalendarView(); BCalendarView(BMessage *archive); static BArchivable* Instantiate(BMessage *archive); - virtual status_t Archive(BMessage *archive, bool deep = true) const; + virtual status_t Archive(BMessage *archive, + bool deep = true) const; virtual void AttachedToWindow(); virtual void DetachedFromWindow(); @@ -60,11 +68,13 @@ class BCalendarView : public BView, public BInvoker { virtual void Draw(BRect updateRect); - virtual void DrawDay(BView *owner, BRect frame, const char *text, - bool isSelected = false, bool isEnabled = true, - bool focus = false); - virtual void DrawDayName(BView *owner, BRect frame, const char *text); - virtual void DrawWeekNumber(BView *owner, BRect frame, const char *text); + virtual void DrawDay(BView *owner, BRect frame, + const char *text, bool isSelected = false, + bool isEnabled = true, bool focus = false); + virtual void DrawDayName(BView *owner, BRect frame, + const char *text); + virtual void DrawWeekNumber(BView *owner, BRect frame, + const char *text); virtual void MessageReceived(BMessage *message); @@ -88,7 +98,8 @@ class BCalendarView : public BView, public BInvoker { virtual void KeyDown(const char *bytes, int32 numBytes); virtual BHandler* ResolveSpecifier(BMessage *message, int32 index, - BMessage *specifier, int32 form, const char *property); + BMessage *specifier, int32 form, + const char *property); virtual status_t GetSupportedSuites(BMessage *data); virtual status_t Perform(perform_code code, void* arg); @@ -133,10 +144,11 @@ class BCalendarView : public BView, public BInvoker { void _DrawWeekHeader(); void _DrawDay(int32 curRow, int32 curColumn, int32 row, int32 column, int32 counter, - BRect frame, const char *text, bool focus = false); - void _DrawItem(BView *owner, BRect frame, const char *text, - bool isSelected = false, bool isEnabled = true, + BRect frame, const char *text, bool focus = false); + void _DrawItem(BView *owner, BRect frame, + const char *text, bool isSelected = false, + bool isEnabled = true, bool focus = false); void _UpdateSelection(); BRect _FirstCalendarItemFrame() const; @@ -157,13 +169,23 @@ class BCalendarView : public BView, public BInvoker { int32 column; Selection& operator=(const Selection &s) - { row = s.row; column = s.column; return *this; } + { + row = s.row; + column = s.column; + return *this; + } bool operator==(const Selection &s) const - { return row == s.row && column == s.column; } + { + return row == s.row + && column == s.column; + } bool operator!=(const Selection &s) const - { return row != s.row || column != s.column; } + { + return row != s.row + || column != s.column; + } }; BRect _RectOfDay(const Selection &selection) const; diff --git a/src/kits/shared/CalendarView.cpp b/src/kits/shared/CalendarView.cpp index ce1894342d..e1b08d45da 100644 --- a/src/kits/shared/CalendarView.cpp +++ b/src/kits/shared/CalendarView.cpp @@ -478,7 +478,8 @@ BCalendarView::MouseDown(BPoint where) void -BCalendarView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage) +BCalendarView::MouseMoved(BPoint point, uint32 code, + const BMessage *dragMessage) { BView::MouseMoved(point, code, dragMessage); } @@ -806,7 +807,8 @@ BCalendarView::_SetToDay() for (int32 row = 0; row < 6; ++row) { for (int32 column = 0; column < 7; ++column) { int32 day = counter - (firstDay - 1); - if (counter >= firstDay && counter <= dayCountCurrent + firstDay - 1) { + if (counter >= firstDay + && counter <= dayCountCurrent + firstDay - 1) { if (day == fDay) { fNewFocusedDay.SetTo(row, column); fNewSelectedDay.SetTo(row, column); @@ -845,7 +847,8 @@ BCalendarView::_GetYearMonth(int32 *year, int32 *month) const int32 counter = 0; for (int32 row = 0; row < 6; ++row) { for (int32 column = 0; column < 7; ++column) { - if (counter < firstDay || counter > dayCountCurrent + firstDay - 1) { + if (counter < firstDay + || counter > dayCountCurrent + firstDay - 1) { if (counter - firstDay < 0) { if (row == currRow && column == currColumn) { *year = date.Year(); @@ -954,7 +957,8 @@ BCalendarView::_SetupDayNumbers() for (int32 row = 0; row < 6; ++row) { for (int32 column = 0; column < 7; ++column) { int32 day = counter - (firstDay - 1); - if (counter < firstDay || counter > dayCountCurrent + firstDay - 1) { + if (counter < firstDay + || counter > dayCountCurrent + firstDay - 1) { if (counter - firstDay < 0) day += lastDayBefore; else @@ -997,8 +1001,8 @@ BCalendarView::_SetupWeekNumbers() void -BCalendarView::_DrawDay(int32 currRow, int32 currColumn, int32 row, int32 column, - int32 counter, BRect frame, const char *text, bool focus) +BCalendarView::_DrawDay(int32 currRow, int32 currColumn, int32 row, + int32 column, int32 counter, BRect frame, const char *text, bool focus) { const BDate date(fYear, fMonth, 1); const int32 daysMonth = date.DaysInMonth(); @@ -1044,7 +1048,8 @@ BCalendarView::_DrawDays() counter++; const char *day = fDayNumbers[row][column].String(); bool focus = isFocus && focusRow == row && focusColumn == column; - _DrawDay(currRow, currColumn, row, column, counter, tmp, day, focus); + _DrawDay(currRow, currColumn, row, column, counter, tmp, day, + focus); tmp.OffsetBy(tmp.Width(), 0.0); } @@ -1074,11 +1079,13 @@ BCalendarView::_DrawFocusRect() bool focus = IsFocus() && true; const char *day = fDayNumbers[row][column].String(); - _DrawDay(currRow, currColumn, row, column, counter, tmp, day, focus); + _DrawDay(currRow, currColumn, row, column, counter, tmp, day, + focus); } else if (focusRow == row && focusColumn == column) { const char *day = fDayNumbers[row][column].String(); - _DrawDay(currRow, currColumn, row, column, counter, tmp, day, false); + _DrawDay(currRow, currColumn, row, column, counter, tmp, day, + false); } tmp.OffsetBy(tmp.Width(), 0.0); } @@ -1198,16 +1205,19 @@ BCalendarView::_UpdateSelection() BRect tmp = frame; for (int32 column = 0; column < 7; ++column) { counter++; - if (fNewSelectedDay.row == row && fNewSelectedDay.column == column) { + if (fNewSelectedDay.row == row + && fNewSelectedDay.column == column) { fSelectedDay.SetTo(row, column); const char *day = fDayNumbers[row][column].String(); - bool focus = IsFocus() && focusRow == row && focusColumn == column; + bool focus = IsFocus() && focusRow == row + && focusColumn == column; _DrawDay(row, column, row, column, counter, tmp, day, focus); } else if (currRow == row && currColumn == column) { const char *day = fDayNumbers[row][column].String(); - bool focus = IsFocus() && focusRow == row && focusColumn == column; + bool focus = IsFocus() && focusRow == row + && focusColumn == column; _DrawDay(currRow, currColumn, -1, -1, counter, tmp, day, focus); } tmp.OffsetBy(tmp.Width(), 0.0); From 52d1086f2dea1208d0bbf26e2b80bc7b49e42474 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 28 Aug 2011 13:47:07 +0000 Subject: [PATCH 243/702] Header was not self-containing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42699 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/game/PushGameSound.h | 1 + 1 file changed, 1 insertion(+) diff --git a/headers/os/game/PushGameSound.h b/headers/os/game/PushGameSound.h index 007d9a8257..51e559ea87 100644 --- a/headers/os/game/PushGameSound.h +++ b/headers/os/game/PushGameSound.h @@ -11,6 +11,7 @@ #include +class BList; class BPushGameSound : public BStreamingGameSound { public: From 5da635640e2c0f93c2a7c8d23efe2760b22e0c6b Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Tue, 30 Aug 2011 13:29:10 +0000 Subject: [PATCH 244/702] Updated Belarusian and Russian catkeys from HTA. Unfortunately I have failed snatching out Ukrainian ones for 3 days of attempts. :-( git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42700 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../inbound_filters/match_header/be.catkeys | 15 +++++++++++ .../inbound_filters/notifier/be.catkeys | 16 ++++++++++++ .../inbound_filters/spam_filter/be.catkeys | 9 +++++++ .../inbound_protocols/imap/be.catkeys | 9 +++++++ .../inbound_protocols/pop3/be.catkeys | 18 +++++++++++++ .../outbound_filters/fortune/be.catkeys | 3 ++- .../outbound_protocols/smtp/be.catkeys | 13 ++++++++++ data/catalogs/apps/aboutsystem/be.catkeys | 6 +++-- data/catalogs/apps/aboutsystem/ru.catkeys | 4 +-- data/catalogs/apps/charactermap/be.catkeys | 6 +++-- data/catalogs/apps/codycam/be.catkeys | 2 +- data/catalogs/apps/codycam/ru.catkeys | 2 +- data/catalogs/apps/deskbar/be.catkeys | 4 ++- data/catalogs/apps/deskbar/ru.catkeys | 4 +-- data/catalogs/apps/installer/be.catkeys | 4 ++- data/catalogs/apps/poorman/be.catkeys | 2 +- data/catalogs/apps/poorman/ru.catkeys | 2 +- data/catalogs/kits/mail/be.catkeys | 10 +++++++ .../preferences/appearance/be.catkeys | 8 +++++- data/catalogs/preferences/mail/be.catkeys | 18 ++++++++++++- data/catalogs/preferences/mail/ru.catkeys | 6 +---- data/catalogs/preferences/time/be.catkeys | 3 +-- data/catalogs/preferences/time/ru.catkeys | 6 +++-- data/catalogs/servers/mail/be.catkeys | 26 +++++++++++++++++++ data/catalogs/servers/mount/ru.catkeys | 2 +- 25 files changed, 170 insertions(+), 28 deletions(-) create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/be.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_filters/notifier/be.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/be.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_protocols/imap/be.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_protocols/pop3/be.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys create mode 100644 data/catalogs/kits/mail/be.catkeys create mode 100644 data/catalogs/servers/mail/be.catkeys diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/be.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/be.catkeys new file mode 100644 index 0000000000..ae4eadb623 --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/be.catkeys @@ -0,0 +1,15 @@ +1 belarusian x-vnd.Haiku-MatchHeader 1205906732 + ConfigView <абярыце рахунак> + ConfigView <абярыце аперацыю> +Delete message ConfigView Выдаліць паведамленне +If ConfigView If +Move to ConfigView Перасунуць у +Reply with ConfigView Адказаць з +Rule filter RuleFilter Правіла фільтра +Set as read ConfigView Пазначыць як прагледжанае +Set flags to ConfigView Меткі паведамлення ў +Then ConfigView Then +has ConfigView меў +header (e.g. Subject) ConfigView загаловак (Subject) +this field is based on the action ConfigView гэты параметр грунтуецца на аперацыі +value (use REGEX: in from of regular expressions like *spam*) ConfigView параметр (выкарыстайце REGEX: у выглядзе regular expressions, напрыклад *spam*) diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/notifier/be.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/notifier/be.catkeys new file mode 100644 index 0000000000..839008bf3f --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/notifier/be.catkeys @@ -0,0 +1,16 @@ +1 belarusian x-vnd.Haiku-NewMailNotification 3624191291 +%num new message filter %num новae паведамленнe +%num new messages filter %num новых паведамленняў +Alert ConfigView Папярэджанне +Beep ConfigView Біп +Central alert ConfigView Цэнтральная папярэджанне +Central beep ConfigView Цэнтральны гук +Keyboard LEDs ConfigView Клавіятурныя LED +Log window ConfigView Вакно пратаколу +Method: ConfigView Метад: +New mails notification ConfigView Інфа пра новыя паведамленні +New messages filter Новыя паведамленні +OK filter ОК +You have %num new message for %name. filter Вы маеце %num новae паведамленнe для %name +You have %num new messages for %name. filter Вы маеце %num новых паведамленняў для %name +none ConfigView няма diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/be.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/be.catkeys new file mode 100644 index 0000000000..2d5da31456 --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/be.catkeys @@ -0,0 +1,9 @@ +1 belarusian x-vnd.Haiku-SpamFilter 1975155212 +Add spam rating to start of subject SpamFilterConfig Дадаць спам-рэйтынг ў пачатак тэмы +Close SpamFilterConfig Закрыць +Genuine below and uncertain above: SpamFilterConfig Сапраўдныя ніжэй і нявызначаныя вышэй: +Learn from all incoming e-mail SpamFilterConfig Навучаць з ўсіх уваходных паведамленняў +Sorry, unable to launch the spamdbm program to let you edit the server settings. SpamFilterConfig Прабачце, немагчыма запусціць праграму spamdbm каб даць вам магчымасць рэдагаваць наладкі. +Spam Filter (AGMS Bayesian) SpamFilter Фільтар спаму (AGMS Bayesian) +Spam above: SpamFilterConfig Спам вышэй: +or empty e-mail SpamFilterConfig ці пустыя паведамленні diff --git a/data/catalogs/add-ons/mail_daemon/inbound_protocols/imap/be.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_protocols/imap/be.catkeys new file mode 100644 index 0000000000..cb8065d1d2 --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_protocols/imap/be.catkeys @@ -0,0 +1,9 @@ +1 belarusian x-vnd.Haiku-IMAP 3892875357 +Apply IMAPFolderConfig Прымяніць +Destination: imap_config Прызначэнне: +Failed to fetch available storage. IMAPFolderConfig Памылка падчас атрымання дадзеных +Fetching IMAP folders, have patience... IMAPFolderConfig Атрыманне IMAP папак, пачакайце... +IMAP Folders IMAPFolderConfig IMAP папкі +IMAP Folders imap_config Папкі IMAP +Subcribe / Unsuscribe IMAP folders, have patience... IMAPFolderConfig Апрацоўка IMAP папак, пачакайце... +status IMAPFolderConfig статус diff --git a/data/catalogs/add-ons/mail_daemon/inbound_protocols/pop3/be.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_protocols/pop3/be.catkeys new file mode 100644 index 0000000000..63bbe496ae --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_protocols/pop3/be.catkeys @@ -0,0 +1,18 @@ +1 belarusian x-vnd.Haiku-POP3 1324485597 +. The server said:\n pop3 . Паведамленне сервера:\n +: Connection refused or host not found pop3 : Адмова ў далучэнні альбо хост не знойдзены +: Could not allocate socket. pop3 : Немагчыма вылучыць сокет. +: No reply.\n pop3 : Няма адказу.\n +: The server does not support APOP. pop3 : Сервер не падтрымлівае пратакол APOP. +APOP ConfigView APOP +Connect to server… pop3 Далучэнне да сервера… +Connecting to POP3 server… pop3 Далучэнне да POP3 сервера… +Destination: ConfigView Прызначэнне: +Error while authenticating user %user pop3 Памылка падчас аўтэнтыфікацыі %user +Error while connecting to server %serv pop3 Памылка падчас далучэння %user да сервера +Getting UniqueIDs… pop3 Атрыманне ідэнтыфікатараў… +Getting mailbox size… pop3 Вылічэнне памеру паштовай скрыні… +Plain text ConfigView Просты тэкст +Sending APOP authentication… pop3 Дасыланне APOP аўтэнтыфікацыі… +Sending password… pop3 Дасыланне пароля… +Sending username… pop3 Дасыланне імя карыстальніка… diff --git a/data/catalogs/add-ons/mail_daemon/outbound_filters/fortune/be.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_filters/fortune/be.catkeys index 4f24b81d77..8559e45848 100644 --- a/data/catalogs/add-ons/mail_daemon/outbound_filters/fortune/be.catkeys +++ b/data/catalogs/add-ons/mail_daemon/outbound_filters/fortune/be.catkeys @@ -1,3 +1,4 @@ -1 belarusian x-vnd.Haiku-Fortune 3616007799 +1 belarusian x-vnd.Haiku-Fortune 1292458430 +Fortune cookie says:\n\n ConfigView Пажаданне:\n\n Fortune file: ConfigView Файл цытатаў: Tag line: ConfigView Радок: diff --git a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys new file mode 100644 index 0000000000..14f96ca2df --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys @@ -0,0 +1,13 @@ +1 belarusian x-vnd.Haiku-SMTP 1052586247 +. The server said:\n smtp . Паведамленне сервера:\n +. The server says:\n smtp . Паведамленне сервера:\n +: Connection refused or host not found. smtp : Адмоўлена ў злучэнні ці сервер не знойдзены. +Connecting to server… smtp Далучэнне да сервера… +Destination: ConfigView Прызначэнне: +ESMTP ConfigView ESMTP +Error while logging in to %serv smtp Памылка падчас лагіну ў %serv +Error while opening connection to %serv smtp Памылка падчас далучэння да %serv +None ConfigView Няма +POP3 authentication failed. The server said:\n smtp Аўтэнтыфікацыя не ўдалася. Паведамленне сервера:\n +POP3 before SMTP ConfigView POP3 перад SMTP +SMTP server: ConfigView Сервер SMTP: diff --git a/data/catalogs/apps/aboutsystem/be.catkeys b/data/catalogs/apps/aboutsystem/be.catkeys index c705de6a4c..408553a32f 100644 --- a/data/catalogs/apps/aboutsystem/be.catkeys +++ b/data/catalogs/apps/aboutsystem/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-About 282658629 +1 belarusian x-vnd.Haiku-About 1133193730 %.2f GHz AboutView %.2f ГГц %d MiB total AboutView %d MiB усяго %d MiB used (%d%%) AboutView %d MiB выкарыстана (%d%%) @@ -6,6 +6,7 @@ %ld Processors: AboutView %ld Працэсараў: %total MiB total, %inaccessible MiB inaccessible AboutView %total MiB усяго %inaccessible MiB недаступна ... and the many people making donations!\n\n AboutView ... і тыя, хто рабіў саве ахвяраванні!\n\n +2001 by Andy Ritger based on the Generalized Timing Formula AboutView 2001 by Andy Ritger грунтуецца на Generalized Timing Formula About this system AboutWindow Інфармацыя пра сістэму AboutSystem System name Пра Сістэму BSD (2-clause) AboutView BSD (2 часткі) @@ -70,7 +71,8 @@ The BeGeistert team\n AboutView Каманада BeGeistert\n The Haiku-Ports team\n AboutView Каманда Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Каманда Haikuware і ихнія ахвяраванні\n The University of Auckland and Christof Lutteroth\n\n AboutView The University of Auckland and Christof Lutteroth\n\n -The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Аўтарскія правы на зыходны код Haiku належаць Haiku, Inc. ці суадносным аўтарам якія пазначаны ў зыходных тэкстах. Haiku™ і HAIKU logo® з´яўляюцца зарэгістраванымі гандлёвымі знакамі Haiku, Inc.\n\n +The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Код, унікальны для Haiku, асабіста ядро і ўвесь код, да якога могуць звяртацца праграмы, распаўсюджваецца ў межах %ліцэнзіі MIT%. Некаторыя сістэмныя бібліятэкі змяшчаюць код, які распаўсюджваецца ў межах ліцэнзіі LGPL. Аўтарскія правы на код трэціх старон глядзіце ніжэй.\n\n +The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku® and the HAIKU logo® are registered trademarks of Haiku, Inc.\n\n AboutView Аўтарскія правы на зыходны код Haiku належаць Haiku, Inc. ці суадносным аўтарам якія пазначаны ў зыходных тэкстах. Haiku® і HAIKU logo® з´яўляюцца зарэгістраванымі гандлёвымі знакамі Haiku, Inc.\n\n Time running: AboutView Час працы: Translations:\n AboutView Пераклады:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (асабіста за ядро NewOS)\n diff --git a/data/catalogs/apps/aboutsystem/ru.catkeys b/data/catalogs/apps/aboutsystem/ru.catkeys index fa963bfbde..bf5fc23203 100644 --- a/data/catalogs/apps/aboutsystem/ru.catkeys +++ b/data/catalogs/apps/aboutsystem/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-About 345253943 +1 russian x-vnd.Haiku-About 2392344107 %.2f GHz AboutView %.2f ГГц %d MiB total AboutView Всего %d Мбайт %d MiB used (%d%%) AboutView %d Мбайт использовано (%d%%) @@ -45,8 +45,6 @@ The BeGeistert team\n AboutView Команде BeGeistert\n The Haiku-Ports team\n AboutView Команде Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Команде Haikuware и их программе пожертвований\n The University of Auckland and Christof Lutteroth\n\n AboutView Университету Окленда и Christof Lutteroth\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Код, написанный специально для Haiku, особенно ядро и весь код, с которым могут быть связаны приложения, распространяется на условиях %MIT licence%. Некоторые системные библиотеки содержат сторонний код, распространяемый под лицензией LGPL. Вы можете найти авторские права на этот код ниже.\n\n -The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Права на код Haiku принадлежат Haiku, Inc. или конкретным авторам, указанным в исходном коде. Haiku™ и логотип HAIKU® являются (зарегистрированными) торговыми марками Haiku, Inc.\n\n Time running: AboutView Время работы: Translations:\n AboutView Переводчики:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (за его ядро NewOS)\n diff --git a/data/catalogs/apps/charactermap/be.catkeys b/data/catalogs/apps/charactermap/be.catkeys index ad491c66e7..0e5832b409 100644 --- a/data/catalogs/apps/charactermap/be.catkeys +++ b/data/catalogs/apps/charactermap/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-CharacterMap 2137207616 +1 belarusian x-vnd.Haiku-CharacterMap 4082916013 Aegean numbers UnicodeBlocks Эгейскія лічбы Alphabetic presentation forms UnicodeBlocks Формы алфавітнага прадстаўлення Ancient Greek musical notation UnicodeBlocks Старажытнагрэчаскія музыкальныя сімвалы @@ -33,7 +33,7 @@ CJK unified ideographs extension A UnicodeBlocks Іерогліфы CJK дап CJK unified ideographs extension B UnicodeBlocks Іерогліфы CJK дапаўненне B Carian UnicodeBlocks Карыянскі Cham UnicodeBlocks Чам -CharacterMap System name Таблица сімвалаў +CharacterMap System name Табліца сімвалаў Cherokee UnicodeBlocks Чырокі Clear CharacterWindow Ачысціць Code CharacterWindow Код @@ -43,6 +43,8 @@ Combining diacritical marks supplement UnicodeBlocks Камбінаванне Combining half marks UnicodeBlocks Камбінаванне паўметак Control pictures UnicodeBlocks Выявы ўпраўлення Coptic UnicodeBlocks Коптскі +Copy as escaped byte string CharacterView Капіяваць кадаваным радком +Copy character CharacterView Капіяваць сімвал Counting rod numerals UnicodeBlocks Лічбы злічальных палачак Cuneiform UnicodeBlocks Клінапіс Cuneiform numbers and punctuation UnicodeBlocks Клінапісныя лічбы і пунктуацыя diff --git a/data/catalogs/apps/codycam/be.catkeys b/data/catalogs/apps/codycam/be.catkeys index df9c624962..b391a88d58 100644 --- a/data/catalogs/apps/codycam/be.catkeys +++ b/data/catalogs/apps/codycam/be.catkeys @@ -17,7 +17,7 @@ Capture Rate Menu CodyCam Меню частаты захвату Capture controls CodyCam Кіраванне захватам Capturing Image… VideoConsumer.cpp Захват выявы... Closing the window\n VideoConsumer.cpp Закрываю акно\n -CodyCam System name Камера +CodyCam Application name Камера Connected… VideoConsumer.cpp Падключаны... Couldn't find requested directory on server VideoConsumer.cpp Немагчыма знайсці запрошаны каталёг на серверы Directory: CodyCam Каталёг: diff --git a/data/catalogs/apps/codycam/ru.catkeys b/data/catalogs/apps/codycam/ru.catkeys index cdbd9e7e05..435cff05e7 100644 --- a/data/catalogs/apps/codycam/ru.catkeys +++ b/data/catalogs/apps/codycam/ru.catkeys @@ -17,7 +17,7 @@ Capture Rate Menu CodyCam Меню периодичности захвата Capture controls CodyCam Настройки захвата Capturing Image… VideoConsumer.cpp Захват изображения… Closing the window\n VideoConsumer.cpp Закрытие окна\n -CodyCam System name Вебкамера +CodyCam Application name Вебкамера Connected… VideoConsumer.cpp Подключен… Couldn't find requested directory on server VideoConsumer.cpp Невозможно найти запрашиваемый каталог на сервере Directory: CodyCam Каталог: diff --git a/data/catalogs/apps/deskbar/be.catkeys b/data/catalogs/apps/deskbar/be.catkeys index ec12a0d912..b1f13ddbb0 100644 --- a/data/catalogs/apps/deskbar/be.catkeys +++ b/data/catalogs/apps/deskbar/be.catkeys @@ -1,8 +1,10 @@ -1 belarusian x-vnd.Be-TSKB 2472557472 +1 belarusian x-vnd.Be-TSKB 4265681964 BeMenu +About this system BeMenu Пра гэтую Сістэму Always on top PreferencesWindow Заўсёды наверсе Applications B_USER_DESKBAR_DIRECTORY/Applications Праграмы Applications PreferencesWindow Праграмы +Auto-hide PreferencesWindow Схаваць аўтаматычна Auto-raise PreferencesWindow Узнікаць аўтаматычна Change time… TimeView Змяніць час... Clock PreferencesWindow Гадзіннік diff --git a/data/catalogs/apps/deskbar/ru.catkeys b/data/catalogs/apps/deskbar/ru.catkeys index 9b38905b16..f11293a481 100644 --- a/data/catalogs/apps/deskbar/ru.catkeys +++ b/data/catalogs/apps/deskbar/ru.catkeys @@ -1,6 +1,6 @@ -1 russian x-vnd.Be-TSKB 1465644101 +1 russian x-vnd.Be-TSKB 4265681964 BeMenu <Папка Be пуста> -About Haiku BeMenu О системе Haiku +About this system BeMenu Об этой системе Always on top PreferencesWindow Всегда сверху Applications B_USER_DESKBAR_DIRECTORY/Applications Приложения Applications PreferencesWindow Приложения diff --git a/data/catalogs/apps/installer/be.catkeys b/data/catalogs/apps/installer/be.catkeys index b86cd3711f..e67ae78374 100644 --- a/data/catalogs/apps/installer/be.catkeys +++ b/data/catalogs/apps/installer/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Installer 1384722558 +1 belarusian x-vnd.Haiku-Installer 3852628561 %1ld of %2ld InstallerWindow number of files copied %1ld з %2ld 1) If you are installing Haiku onto real hardware (not inside an emulator) it is recommended that you have already prepared a hard disk partition. The Installer and the DriveSetup tool offer to initialize existing partitions with the Haiku native file system, but the options to change the actual partition layout may not have been tested on a sufficiently great variety of computer configurations so we do not recommend using it.\n InstallerApp 1) Калі вы ўсталёўваеце Haiku на рэальнае жалеза (не на эмулятар), мы рэкамендуем загадзя падрыхтаваць падзел на дыску.Усталёўшчык і утыліта DriveSetup дапамогуць усталяваць на падзеле родную для Haiku файлавую сістэму, але опыці па змене цякучай табліцы падзелаў яшчэ недадакова пратэсціраваныя, таму іх ужыванне не рэкамендуецца.\n 2) The Installer will make the Haiku partition itself bootable, but takes no steps to integrate Haiku into an existing boot menu. If you have GRUB already installed, you can add Haiku to its boot menu. Depending on what version of GRUB you use, this is done differently.\n\n\n InstallerApp 2)Усталёўшчык зробіць падзел Haiku загрузачным, але не дадасць Haiku да вашага меню загрузкі. Калі у вас ужо ўсталяваны GRUB, вы можаце самастойна дадаць Haiku да яго меню. Гэта робіцца па-рознаму у залежнасці ад вашай версіі загрузчыка.\n\n\n @@ -46,6 +46,7 @@ Install from: InstallerWindow Усталяваць з: Install progress: InstallerWindow Прагрэс усталёўкі: Installation canceled. InstallProgress Усталёўка адмененая. Installation completed. Boot sector has been written to '%s'. Press Quit to leave the Installer or choose a new target volume to perform another installation. InstallerWindow Усталёўка завершана. Загрузачны сектар запісаны ў '%s'.Націсніце Выйсці, каб пакінуць усталёўшчык ці абраць іншы том для новай усталёўкі. +Installation completed. Boot sector has been written to '%s'. Press Restart to restart the computer or choose a new target volume to perform another installation. InstallerWindow Усталёўка завершана. Загрузачны сектар запісаны ў '%s'.Націсніце Перазапусціць, каб перазапусціць кампутар ці абрярыце іншы том для яшчэ адной усталёўкі. Installer System name Усталёўшчык Installer\n\twritten by Jérôme Duval and Stephan Aßmus\n\tCopyright 2005-2010, Haiku.\n\n InstallerApp Installer\n\tАўтары: Jérôme Duval, Stephan Aßmus\n\tCopyright 2005-2010, Haiku.\n\n Launch the DriveSetup utility to partition\navailable hard drives and other media.\nPartitions can be initialized with the\nBe File System needed for a Haiku boot\npartition. InstallerWindow Запусціце утыліту DriveSetup каб размеціць\nдаступныя дыскі.\nПадзелы могуць быць ініцыялізаваны файлавай сістэмай\nBe File System, патрэбнай для загрузачнага падзелу Haiku. @@ -69,6 +70,7 @@ Quit Boot Manager InstallerWindow Выйсці з Менеджэра Запус Quit Boot Manager and DriveSetup InstallerWindow Выйсці з Менеджэра Запуску і DriveSetup Quit DriveSetup InstallerWindow Выйсці з DriveSetup README InstallerApp README +Restart InstallerWindow Перазапусціць Restart system InstallerWindow Перазагрузіць сістэму Running Boot Manager and DriveSetup…\n\nClose both applications to continue with the installation. InstallerWindow Працуюць Boot Manager і DriveSetup...\n\nЗакрыйце абедзве праграмы для працягу. Running Boot Manager…\n\nClose Boot Manager to continue with the installation. InstallerWindow Працуе Boot Manager…\n\nЗакрыйце Boot Manager для працягу ўсталёўкі. diff --git a/data/catalogs/apps/poorman/be.catkeys b/data/catalogs/apps/poorman/be.catkeys index 5f9076b684..a66b1723f3 100644 --- a/data/catalogs/apps/poorman/be.catkeys +++ b/data/catalogs/apps/poorman/be.catkeys @@ -34,7 +34,7 @@ Logging view PoorMan Від пратакаліравання Max. simultaneous connections: PoorMan Макс. колькасць адначасовых спалучэнняў: OK PoorMan ОК Please choose the folder to publish on the web.\n\nYou can have PoorMan create a default \"public_html\" in your home folder.\nOr you select one of your own folders instead. PoorMan Калі ласка, выберыце каталог, які трэба апублікаваць.\n\nPoorMan можа стварыць для вас стандартны каталог \"public_html\" у хатнім каталозе.\nАбо вы можаце самі выбраць пажаданы каталог. -PoorMan System name Валацуга (Web-сервер) +PoorMan Application name Валацуга (Web-сервер) PoorMan settings PoorMan Наладкі PoorMan Quit PoorMan Выйсці Run server PoorMan Запусціць сервер diff --git a/data/catalogs/apps/poorman/ru.catkeys b/data/catalogs/apps/poorman/ru.catkeys index 9cf8be8a55..c1cef690fd 100644 --- a/data/catalogs/apps/poorman/ru.catkeys +++ b/data/catalogs/apps/poorman/ru.catkeys @@ -34,7 +34,7 @@ Logging view PoorMan Окно логирования Max. simultaneous connections: PoorMan Максимум одновременных соединений: OK PoorMan ОК Please choose the folder to publish on the web.\n\nYou can have PoorMan create a default \"public_html\" in your home folder.\nOr you select one of your own folders instead. PoorMan Пожалуйста, выберите папку для публикации.\n\nPoorMan может создать папку по умолчанию public_html в вашей домашней папке.\nИли вы можете выбрать любую другую папку. -PoorMan System name Вебсервер +PoorMan Application name Вебсервер PoorMan settings PoorMan Настройки PoorMan Quit PoorMan Выход Run server PoorMan Запустиь сервер diff --git a/data/catalogs/kits/mail/be.catkeys b/data/catalogs/kits/mail/be.catkeys new file mode 100644 index 0000000000..e1a5b4d8e5 --- /dev/null +++ b/data/catalogs/kits/mail/be.catkeys @@ -0,0 +1,10 @@ +1 belarusian x-vnd.Haiku-libmail 161731481 +Connection type: ProtocolConfigView Тып злучэння: +Leave mail on server ProtocolConfigView Пакідаць паведамленні на серверы +Login type: ProtocolConfigView Тып уваходу: +Mail server: ProtocolConfigView Сервер пошты: +Partially download messages larger than ProtocolConfigView Часткова спампоўваць паведамленні большыя за +Password: ProtocolConfigView Пароль: +Remove mail from server when deleted ProtocolConfigView Выдаляць паведамленні з сервера +Select… MailKit Абраць… +Username: ProtocolConfigView Імя карыстальніка: diff --git a/data/catalogs/preferences/appearance/be.catkeys b/data/catalogs/preferences/appearance/be.catkeys index 5412fbb051..9387a02948 100644 --- a/data/catalogs/preferences/appearance/be.catkeys +++ b/data/catalogs/preferences/appearance/be.catkeys @@ -1,8 +1,11 @@ -1 belarusian x-vnd.Haiku-Appearance 3187486915 +1 belarusian x-vnd.Haiku-Appearance 3577998894 +About DecorSettingsView Пра Праграму +About Decerator DecorSettingsView Пра Дэкаратар Antialiasing APRWindow Згладжванне Antialiasing menu AntialiasingSettingsView Меню згладжвання Antialiasing type: AntialiasingSettingsView Тып згладжвання Appearance System name Афармленне +Choose Decorator DecorSettingsView Абраць Дэкаратар Colors APRWindow Колеры Control background Colors tab Фон кнопак Control border Colors tab Аблямоўка кнопак @@ -23,6 +26,7 @@ Menu item text Colors tab Тэкст пунктаў меню Monospaced fonts only AntialiasingSettingsView Толькі монашырынныя шрыфты Navigation base Colors tab Базавы колер навігацыі Navigation pulse Colors tab Колер падсветкі навігацыі +OK DecorSettingsView Так Off AntialiasingSettingsView Выкл. On AntialiasingSettingsView Укл. Panel background Colors tab Фон панэлі @@ -39,5 +43,7 @@ Subpixel based anti-aliasing in combination with glyph hinting is not available Success Colors tab Паспяхова Tooltip background Colors tab Фон падказкі Tooltip text Colors tab Тэкст падказак +Window Decorator APRWindow Дэкаратар Вакон +Window Decorator: DecorSettingsView Дэкаратар Вакон: Window tab Colors tab Ўкладка вакна Window tab text Colors tab Тэкст загалоўку акна diff --git a/data/catalogs/preferences/mail/be.catkeys b/data/catalogs/preferences/mail/be.catkeys index eec3bb7155..8a4627f840 100644 --- a/data/catalogs/preferences/mail/be.catkeys +++ b/data/catalogs/preferences/mail/be.catkeys @@ -1,26 +1,38 @@ -1 belarusian x-vnd.Haiku-Mail 458432473 +1 belarusian x-vnd.Haiku-Mail 3957822883 Account name: Config Views Імя акаунту Account name: E-Mail Імя акаунта: +Account settings AutoConfigWindow Наладкі рахунка Account settings Config Views Наладкі акаунту Accounts Config Window Акаунты Add Config Window Дадаць Add filter Config Views Дадаць фільтр Always Config Window Заўсёды Apply Config Window Прымяніць +Back AutoConfigWindow Назад Check every Config Window Правяраць кожныя Choose Protocol E-Mail Выбраць пратакол +Create new account AutoConfigWindow Стварыць новы рахунак E-mail System name Е-Пошта E-mail address: E-Mail Адрас E-mail Edit mailbox menu… Config Window Правіць меню паштовай скрыні... +Enter a valid e-mail address. AutoConfigWindow Увядзіце адрас е-пошты. Error Config Window Памылка Error retrieving general settings: %s\n Config Window Памылка пры атрыманні агульных наладак: %s\n +Finish AutoConfigWindow Скончыць +Incoming Config Window Уваходны +Incoming E-Mail Уваходны Incoming mail filters Config Views Уваходныя фільтры пошты Login name: E-Mail Імя карыстача: Mail checking Config Window Праверка пошты Miscellaneous Config Window Розныя +Never Config Window show status window Ніколі +Next AutoConfigWindow Далей +OK AutoConfigWindow ОК OK Config Views ОК OK Config Window ОК Only when dial-up is connected Config Window Толькі пры падключаным дайл-апе +Outgoing Config Window Выходны +Outgoing E-Mail Выходны Outgoing mail filters Config Views Фільтры выходнай пошты Password: E-Mail Пароль: Real name: Config Views Рэальнае імя: @@ -39,6 +51,10 @@ While sending Config Window Пры адапраўленні While sending and receiving Config Window Пры адпраўцы і атрыманні \nThe general settings couldn't be reverted.\n\nError retrieving general settings:\n%s\n Config Window \nАгульныя опцыі немагчыма адмяніць.\n\nПамылка пры атрыманні агульных опцый:\n%s\n \n\nCreate a new account with the Add button.\n\nRemove an account with the Remove button on the selected item.\n\nSelect an item in the list to change its settings. Config Window \n\nСтварыце акаунт з дапамогай кнопкі Дадаць.\n\nВыдаліце акаунт кнопкай Выдаліць.\n\nВыберыце элемент у спісе, каб змяніць яго параметры. +\t\t· E-mail filters Config Window \t\t· Фільтры е-пошты +\t\t· Incoming Config Window \t\t· Уваходны +\t\t· Outgoing Config Window \t\t· Выходны days Config Window дзен hours Config Window гадзін minutes Config Window хвілін +never Config Window mail checking frequency ніколі diff --git a/data/catalogs/preferences/mail/ru.catkeys b/data/catalogs/preferences/mail/ru.catkeys index 8cc5cd2ca6..d468d81596 100644 --- a/data/catalogs/preferences/mail/ru.catkeys +++ b/data/catalogs/preferences/mail/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Mail 2328315862 +1 russian x-vnd.Haiku-Mail 458432473 Account name: Config Views Имя аккаунта: Account name: E-Mail Имя аккаунта: Account settings Config Views Настройки аккаунта @@ -42,7 +42,3 @@ While sending and receiving Config Window во время отправки и days Config Window дней hours Config Window часов minutes Config Window минут -never Config Window не проверять -· E-mail filters Config Window · Почтовые фильтры -· Incoming Config Window · Входящие -· Outgoing Config Window · Исходящие diff --git a/data/catalogs/preferences/time/be.catkeys b/data/catalogs/preferences/time/be.catkeys index 4f1d5643b8..5d0b2cb39c 100644 --- a/data/catalogs/preferences/time/be.catkeys +++ b/data/catalogs/preferences/time/be.catkeys @@ -1,11 +1,10 @@ -1 belarusian x-vnd.Haiku-Time 453699369 +1 belarusian x-vnd.Haiku-Time 265526963 Time <іншае> Add Time Дадаць Could not contact server Time Няма далучэння да сервера Could not create socket Time Немагчыма стварыць сеткавы сокет. Current time: Time Сапраўдны час: Date and time Time Дата і Час -Etc Time І г. д. GMT Time GMT Hardware clock set to: Time Гадзіннік кампутара усталяваны на: Local time Time Лакальны час diff --git a/data/catalogs/preferences/time/ru.catkeys b/data/catalogs/preferences/time/ru.catkeys index f62e44f605..4b821fd2f2 100644 --- a/data/catalogs/preferences/time/ru.catkeys +++ b/data/catalogs/preferences/time/ru.catkeys @@ -1,13 +1,14 @@ -1 russian x-vnd.Haiku-Time 2002728485 +1 russian x-vnd.Haiku-Time 2447986513 Time <Другой> Add Time Добавить Could not contact server Time Ну удалось связаться с сервером Could not create socket Time Не удалось создать сокет Current time: Time Текущее время: Date and time Time Дата и время -Etc Time И т.д. GMT Time GMT +Hardware clock set to: Time Часы настроены на: Local time Time Местное время +Message receiving failed Time Не удалось получить данные Network time Time Синхронизация времени OK Time ОК Preview time: Time Предварительное время: @@ -28,5 +29,6 @@ Time Time Время Time & Date, writen by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\tJulun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2008, Haiku. Time Time & Date, разработал:\n\n\tAndrew Edward McCall\n\tMike Berg\n\tJulun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2008, Haiku. Time zone Time Часовой пояс Try all servers Time Пробовать все сервера +Waiting for answer failed Time Истекло время ожидания \nNow: Time \nСейчас: about Time о программе diff --git a/data/catalogs/servers/mail/be.catkeys b/data/catalogs/servers/mail/be.catkeys new file mode 100644 index 0000000000..31e1502a25 --- /dev/null +++ b/data/catalogs/servers/mail/be.catkeys @@ -0,0 +1,26 @@ +1 belarusian x-vnd.Be-POST 1358359182 +%.1f / %.1f kb (%d / %d messages) StatusWindow %.1f / %.1f kb (%d / %d паведамленняў) +%d / %d messages StatusWindow %d / %d паведамленняў +%num new message DeskbarView %num новае паведамленне +%num new message for %name\n MailDaemon %num новых паведамленняў для %name\n +%num new message. MailDaemon %num новае паведамленне. +%num new messages DeskbarView %num новых паведамленняў +%num new messages for %name\n MailDaemon %num новых паведамленняў для %name\n +%num new messages. MailDaemon %num новых паведамленняў. + DeskbarView <няма рахункаў> +Check for mail now DeskbarView Праверыць пошту +Check for mails only DeskbarView Толькі праверыць пошту +Check mail now StatusWindow Праверыць пошту +Create new message… DeskbarView Стварыць новае паведамленне… +Fetching mail for %name Notifier Атрымліваю пошту для %name +Mail Status MailDaemon Статус Пошты +Mail daemon status log MailDaemon Пратакол паштовай службы +New Messages MailDaemon Новыя паведамленні +No new messages DeskbarView Няма новых паведамленняў +No new messages MailDaemon Няма новых паведамленняў +No new messages. MailDaemon Няма новых паведамленняў. +No new messages. StatusWindow Няма новых паведамленняў. +Preferences… DeskbarView Наладкі… +Send pending mails DeskbarView Даслаць паведамленні што чакаюць +Sending mail for %name Notifier Дасылаю пошту для %name +Shutdown mail services DeskbarView Спыніць паштовыя службы diff --git a/data/catalogs/servers/mount/ru.catkeys b/data/catalogs/servers/mount/ru.catkeys index 9113c408e5..efbb009f74 100644 --- a/data/catalogs/servers/mount/ru.catkeys +++ b/data/catalogs/servers/mount/ru.catkeys @@ -1,7 +1,7 @@ 1 russian x-vnd.Haiku-mount_server 1422362183 Cancel AutoMounter Отмена Could not unmount disk \"%s\":\n\t%s AutoMounter Невозможно отключить диск \"%s\":\n\t%s -Could not unmount disk \"%s\":\n\t%s\n\nShould unmounting be forced?\n\nNote: If an application is currently writing to the volume, unmounting it now might result in loss of data.\n AutoMounter Невозможно отключить диск \"%s\":\n\t%s\n\nОтключить принудительно?\n\nВнимание: если какое-либо приложение в данный момент записывает данные на этот раздел, то его отключение может привести к потере данных.\n +Could not unmount disk \"%s\":\n\t%s\n\nShould unmounting be forced?\n\nNote: If an application is currently writing to the volume, unmounting it now might result in loss of data.\n AutoMounter Невозможно отключить диск \"%s\":\n\t%s\n\nОтключить этот диск принудительно?\n\nВнимание: если какое-нибудь приложение в данный момент записывает данные на этот раздел, то отключение диска может привести к потере данных.\n Error mounting volume:\n\n%s AutoMounter Ошибка подключения раздела:\n\n%s Force unmount AutoMounter Отключить принудительно It is suggested to mount all additional Haiku volumes in read-only mode. This will prevent unintentional data loss because of errors in Haiku. AutoMounter Рекомендуется подключать дополнительные разделы Haiku в режиме только для чтения. Это предотвратит возможную потерю данных из-за потенциальных ошибок в Haiku. From f7ca82dc00e7f2c657b00d8b0da15429344ea177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 30 Aug 2011 20:46:07 +0000 Subject: [PATCH 245/702] Read the previous descriptor pointer before freeing transfer and transfer descriptors. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42701 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/usb/ehci.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index b8ad5190e7..a5625a7a6a 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -1758,6 +1758,8 @@ EHCI::FinishIsochronousTransfers() transfer->transfer->Finished(B_OK, actualLength); + itd = itd->prev; + for (uint32 i = 0; i <= transfer->last_to_process; i++) FreeDescriptor(transfer->descriptors[i]); @@ -1771,8 +1773,8 @@ EHCI::FinishIsochronousTransfers() transferDone = true; } else { TRACE("FinishIsochronousTransfers not end of transfer\n"); + itd = itd->prev; } - itd = itd->prev; } UnlockIsochronous(); From 67eb6cdee80a9b30e0bb8e922dcf9b4ba4ea76d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 30 Aug 2011 22:10:46 +0000 Subject: [PATCH 246/702] * extracted some private methods to have a more readable code * fixed negative parameter values handling * clean up and method shuffle git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42703 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../usb_webcam/addons/uvc/UVCCamDevice.cpp | 665 +++++++++--------- .../usb_webcam/addons/uvc/UVCCamDevice.h | 27 +- 2 files changed, 334 insertions(+), 358 deletions(-) diff --git a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp index 3db7689d47..8973d756d3 100644 --- a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp +++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp @@ -73,7 +73,7 @@ UVCCamDevice::UVCCamDevice(CamDeviceAddon& _addon, BUSBDevice* _device) { fDeframer = new UVCDeframer(this); SetDataInput(fDeframer); - + const BUSBConfiguration* config; const BUSBInterface* interface; usb_descriptor* generic; @@ -125,7 +125,7 @@ UVCCamDevice::UVCCamDevice(CamDeviceAddon& _addon, BUSBDevice* _device) _ParseVideoStreaming((const usbvc_class_descriptor*)generic, generic->generic.length); } - + for (uint32 k = 0; k < interface->CountEndpoints(); k++) { const BUSBEndpoint* e = interface->EndpointAt(i); if (e && e->IsIsochronous() && e->IsInput()) { @@ -178,7 +178,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, break; } case VS_FORMAT_UNCOMPRESSED: - { + { const usbvc_format_descriptor* descriptor = (const usbvc_format_descriptor*)_descriptor; fUncompressedFormatIndex = descriptor->formatIndex; @@ -216,7 +216,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, if (_descriptor->descriptorSubtype == VS_FRAME_UNCOMPRESSED) { printf("VS_FRAME_UNCOMPRESSED:"); fUncompressedFrames.AddItem( - new usbvc_frame_descriptor(*descriptor)); + new usbvc_frame_descriptor(*descriptor)); } else { printf("VS_FRAME_MJPEG:"); fMJPEGFrames.AddItem(new usbvc_frame_descriptor(*descriptor)); @@ -229,7 +229,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, descriptor->width, descriptor->height, descriptor->minBitRate, descriptor->maxBitRate, descriptor->maxVideoFrameBufferSize); - printf("\tdefault frame interval: %lu, #intervals(0=cont): %d\n", + printf("\tdefault frame interval: %lu, #intervals(0=cont): %d\n", descriptor->defaultFrameInterval, descriptor->frameIntervalType); if (descriptor->frameIntervalType == 0) { printf("min/max frame interval=%lu/%lu, step=%lu\n", @@ -319,7 +319,7 @@ UVCCamDevice::_ParseVideoStreaming(const usbvc_class_descriptor* _descriptor, break; } case VS_FORMAT_MJPEG: - { + { const usbvc_format_descriptor* descriptor = (const usbvc_format_descriptor*)_descriptor; fMJPEGFormatIndex = descriptor->formatIndex; @@ -379,7 +379,7 @@ UVCCamDevice::_ParseVideoControl(const usbvc_class_descriptor* _descriptor, { if (fHeaderDescriptor != NULL) { printf("ERROR: multiple VC_HEADER! Skipping...\n"); - break; + break; } fHeaderDescriptor = (usbvc_interface_header_descriptor*)malloc(len); memcpy(fHeaderDescriptor, _descriptor, len); @@ -584,11 +584,11 @@ UVCCamDevice::AcceptVideoFrame(uint32& width, uint32& height) SetVideoFrame(BRect(0, 0, width - 1, height - 1)); return B_OK; */ - + width = 320; height = 240; } - + for (int i = 0; iControlTransfer( @@ -646,18 +646,18 @@ UVCCamDevice::_ProbeCommitFormat() " failed\n"); return B_ERROR; } - + printf("usbvc_probecommit response.compQuality %d\n", response.compQuality); request.compQuality = response.compQuality; */ - - + + usbvc_probecommit response; memset(&response, 0, sizeof(response)); actualLength = fDevice->ControlTransfer( USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, GET_CUR, VS_PROBE_CONTROL << 8, fStreamingIndex, length, &response); - + /* actualLength = fDevice->ControlTransfer( USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, SET_CUR, @@ -677,14 +677,14 @@ UVCCamDevice::_ProbeCommitFormat() " failed\n"); return B_ERROR; } - - + + fMaxVideoFrameSize = response.maxVideoFrameSize; - fMaxPayloadTransferSize = response.maxPayloadTransferSize; + fMaxPayloadTransferSize = response.maxPayloadTransferSize; printf("usbvc_probecommit setup done maxVideoFrameSize:%ld" " maxPayloadTransferSize:%ld\n", fMaxVideoFrameSize, fMaxPayloadTransferSize); - + printf("UVCCamDevice::_ProbeCommitFormat()\n --> SUCCESSFUL\n"); return B_OK; } @@ -696,11 +696,11 @@ UVCCamDevice::_SelectBestAlternate() printf("UVCCamDevice::_SelectBestAlternate()\n"); const BUSBConfiguration* config = fDevice->ActiveConfiguration(); const BUSBInterface* streaming = config->InterfaceAt(fStreamingIndex); - + uint32 bestBandwidth = 0; uint32 alternateIndex = 0; uint32 endpointIndex = 0; - + for (uint32 i = 0; i < streaming->CountAlternates(); i++) { const BUSBInterface* alternate = streaming->AlternateAt(i); for (uint32 j = 0; j < alternate->CountEndpoints(); j++) { @@ -717,22 +717,22 @@ UVCCamDevice::_SelectBestAlternate() alternateIndex = i; } } - + if (bestBandwidth == 0) { fprintf(stderr, "UVCCamDevice::_SelectBestAlternate()" " couldn't find a valid alternate\n"); return B_ERROR; } - + printf("UVCCamDevice::_SelectBestAlternate() %ld\n", bestBandwidth); if (((BUSBInterface*)streaming)->SetAlternate(alternateIndex) != B_OK) { fprintf(stderr, "UVCCamDevice::_SelectBestAlternate()" " selecting alternate failed\n"); return B_ERROR; } - + fIsoIn = streaming->EndpointAt(endpointIndex); - + return B_OK; } @@ -748,85 +748,195 @@ UVCCamDevice::_SelectIdleAlternate() " selecting alternate failed\n"); return B_ERROR; } - + fIsoIn = NULL; - + return B_OK; } -UVCCamDeviceAddon::UVCCamDeviceAddon(WebCamMediaAddOn* webcam) - : CamDeviceAddon(webcam) +void +UVCCamDevice::_AddProcessingParameter(BParameterGroup* group, + int32 index, const usbvc_processing_unit_descriptor* descriptor) { - printf("UVCCamDeviceAddon::UVCCamDeviceAddon(WebCamMediaAddOn* webcam)\n"); - SetSupportedDevices(kSupportedDevices); + BParameterGroup* subgroup; + BContinuousParameter* p; + uint16 wValue = 0; // Control Selector + float minValue = 0.0; + float maxValue = 100.0; + if (descriptor->controlSize >= 1) { + if (descriptor->controls[0] & 1) { + // debug_printf("\tBRIGHTNESS\n"); + fBrightness = _AddParameter(group, &subgroup, index, + PU_BRIGHTNESS_CONTROL, "Brightness"); + } + if (descriptor->controls[0] & 2) { + // debug_printf("\tCONSTRAST\n"); + fContrast = _AddParameter(group, &subgroup, index + 1, + PU_CONTRAST_CONTROL, "Contrast"); + } + if (descriptor->controls[0] & 4) { + // debug_printf("\tHUE\n"); + fHue = _AddParameter(group, &subgroup, index + 2, + PU_HUE_CONTROL, "Hue"); + if (descriptor->controlSize >= 2) { + if (descriptor->controls[1] & 8) { + fHueAuto = _AddAutoParameter(subgroup, index + 3, + PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL); + } + } + } + if (descriptor->controls[0] & 8) { + // debug_printf("\tSATURATION\n"); + fSaturation = _AddParameter(group, &subgroup, index + 4, + PU_SATURATION_CONTROL, "Saturation"); + } + if (descriptor->controls[0] & 16) { + // debug_printf("\tSHARPNESS\n"); + fSharpness = _AddParameter(group, &subgroup, index + 5, + PU_SHARPNESS_CONTROL, "Sharpness"); + } + if (descriptor->controls[0] & 32) { + // debug_printf("\tGamma\n"); + fGamma = _AddParameter(group, &subgroup, index + 6, + PU_GAMMA_CONTROL, "Gamma"); + } + if (descriptor->controls[0] & 64) { + // debug_printf("\tWHITE BALANCE TEMPERATURE\n"); + fWBTemp = _AddParameter(group, &subgroup, index + 7, + PU_WHITE_BALANCE_TEMPERATURE_CONTROL, "WB Temperature"); + if (descriptor->controlSize >= 2) { + if (descriptor->controls[1] & 16) { + fWBTempAuto = _AddAutoParameter(subgroup, index + 8, + PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL); + } + } + } + if (descriptor->controls[0] & 128) { + // debug_printf("\tWhite Balance Component\n"); + fWBComponent = _AddParameter(group, &subgroup, index + 9, + PU_WHITE_BALANCE_COMPONENT_CONTROL, "WB Component"); + if (descriptor->controlSize >= 2) { + if (descriptor->controls[1] & 32) { + fWBTempAuto = _AddAutoParameter(subgroup, index + 10, + PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL); + } + } + } + } + if (descriptor->controlSize >= 2) { + if (descriptor->controls[1] & 1) { + // debug_printf("\tBACKLIGHT COMPENSATION\n"); + int16 data; + wValue = PU_BACKLIGHT_COMPENSATION_CONTROL << 8; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_MAX, wValue, fControlRequestIndex, sizeof(data), &data); + maxValue = (float)data; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_MIN, wValue, fControlRequestIndex, sizeof(data), &data); + minValue = (float)data; + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, sizeof(data), &data); + fBacklightCompensation = (float)data; + subgroup = group->MakeGroup("Backlight Compensation"); + if (maxValue - minValue == 1) { // Binary Switch + fBinaryBacklightCompensation = true; + subgroup->MakeDiscreteParameter(index + 11, + B_MEDIA_RAW_VIDEO, "Backlight Compensation", + B_ENABLE); + } else { // Range of values + fBinaryBacklightCompensation = false; + p = subgroup->MakeContinuousParameter(index + 11, + B_MEDIA_RAW_VIDEO, "Backlight Compensation", + B_GAIN, "", minValue, maxValue, 1.0 / (maxValue - minValue)); + } + } + if (descriptor->controls[1] & 2) { + // debug_printf("\tGAIN\n"); + fGain = _AddParameter(group, &subgroup, index + 12, PU_GAIN_CONTROL, + "Gain"); + } + if (descriptor->controls[1] & 4) { + // debug_printf("\tPOWER LINE FREQUENCY\n"); + wValue = PU_POWER_LINE_FREQUENCY_CONTROL << 8; + int8 data; + if (fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, sizeof(data), &data) == sizeof(data)) { + fPowerlineFrequency = data; + } + subgroup = group->MakeGroup("Power Line Frequency"); + p = subgroup->MakeContinuousParameter(index + 13, + B_MEDIA_RAW_VIDEO, "Frequency", B_GAIN, "", 0, 60.0, 1.0 / 60.0); + } + // TODO Determine whether controls apply to these + /* + if (descriptor->controls[1] & 64) + debug_printf("\tDigital Multiplier\n"); + if (descriptor->controls[1] & 128) + debug_printf("\tDigital Multiplier Limit\n"); + */ + } + // TODO Determine whether controls apply to these + /* + if (descriptor->controlSize >= 3) { + if (descriptor->controls[2] & 1) + debug_printf("\tAnalog Video Standard\n"); + if (descriptor->controls[2] & 2) + debug_printf("\tAnalog Video Lock Status\n"); + } + */ + } -UVCCamDeviceAddon::~UVCCamDeviceAddon() -{ -} - - -const char * -UVCCamDeviceAddon::BrandName() -{ - printf("UVCCamDeviceAddon::BrandName()\n"); - return "USB Video Class"; -} - - -UVCCamDevice * -UVCCamDeviceAddon::Instantiate(CamRoster& roster, BUSBDevice* from) -{ - printf("UVCCamDeviceAddon::Instantiate()\n"); - return new UVCCamDevice(*this, from); -} - float -UVCCamDevice::_AddParameter(BParameterGroup* group, +UVCCamDevice::_AddParameter(BParameterGroup* group, BParameterGroup** subgroup, int32 index, uint16 wValue, const char* name) { - float minValue = 0.0; - float maxValue = 100.0; - float currValue = 0.0; - - BContinuousParameter* p; - uint16 data; - - wValue = wValue << 8; - - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, - GET_MAX, wValue, fControlRequestIndex, 2, &data); - maxValue = (float)(*((uint16*)data)); - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, - GET_MIN, wValue, fControlRequestIndex, 2, &data); - minValue = (float)(*((uint16*)data)); - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, - GET_CUR, wValue, fControlRequestIndex, 2, &data); - currValue = (float)data; + float minValue = 0.0; + float maxValue = 100.0; + float currValue = 0.0; + int16 data; - *subgroup = group->MakeGroup(name); - p = (*subgroup)->MakeContinuousParameter(index, - B_MEDIA_RAW_VIDEO, name, - B_GAIN, "", minValue, maxValue, 1.0 / (maxValue - minValue)); - - return currValue; + wValue <<= 8; + + if (fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_MAX, wValue, fControlRequestIndex, sizeof(data), &data) + == sizeof(data)) { + maxValue = (float)data; + } + if (fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_MIN, wValue, fControlRequestIndex, sizeof(data), &data) + == sizeof(data)) { + minValue = (float)data; + } + if (fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, sizeof(data), &data) + == sizeof(data)) { + currValue = (float)data; + } + + *subgroup = group->MakeGroup(name); + BContinuousParameter* p = (*subgroup)->MakeContinuousParameter(index, + B_MEDIA_RAW_VIDEO, name, B_GAIN, "", minValue, maxValue, + 1.0 / (maxValue - minValue)); + return currValue; } -int UVCCamDevice::_AddAutoParameter(BParameterGroup* subgroup, int32 index, - uint16 wValue) +uint8 +UVCCamDevice::_AddAutoParameter(BParameterGroup* subgroup, int32 index, + uint16 wValue) { uint8 data; wValue <<= 8; - + fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, GET_CUR, wValue, fControlRequestIndex, 1, &data); subgroup->MakeDiscreteParameter(index, B_MEDIA_RAW_VIDEO, "Auto", B_ENABLE); - + return data; } @@ -837,163 +947,34 @@ UVCCamDevice::AddParameters(BParameterGroup* group, int32& index) printf("UVCCamDevice::AddParameters()\n"); fFirstParameterID = index; // debug_printf("fIndex = %d\n",fIndex); - BParameterGroup* subgroup; - BContinuousParameter* p; CamDevice::AddParameters(group, index); - + const BUSBConfiguration* config; const BUSBInterface* interface; - usb_descriptor* generic; uint8 buffer[1024]; - - void* data = (void*)(new uint16); - generic = (usb_descriptor*)buffer; - + usb_descriptor* generic = (usb_descriptor*)buffer; + for (uint32 i = 0; i < fDevice->CountConfigurations(); i++) { config = fDevice->ConfigurationAt(i); fDevice->SetConfiguration(config); for (uint32 j = 0; j < config->CountInterfaces(); j++) { interface = config->InterfaceAt(j); - if (interface->Class() == CC_VIDEO && interface->Subclass() - == SC_VIDEOCONTROL) { - for (uint32 k = 0; interface->OtherDescriptorAt(k, generic, - sizeof(buffer)) == B_OK; k++) { - if (generic->generic.descriptor_type != (USB_REQTYPE_CLASS - | USB_DESCRIPTOR_INTERFACE)) - continue; - - if (((const usbvc_class_descriptor*)generic)->descriptorSubtype - == VC_PROCESSING_UNIT) { - const usbvc_processing_unit_descriptor* descriptor - = (const usbvc_processing_unit_descriptor*)generic; - uint16 wValue = 0; // Control Selector - float minValue = 0.0; - float maxValue = 100.0; - if (descriptor->controlSize >= 1) { - if (descriptor->controls[0] & 1) { - // debug_printf("\tBRIGHTNESS\n"); - fBrightness = _AddParameter(group, &subgroup, index, - PU_BRIGHTNESS_CONTROL, "Brightness"); - } - if (descriptor->controls[0] & 2) { - // debug_printf("\tCONSTRAST\n"); - fContrast = _AddParameter(group, &subgroup, index + 1, - PU_CONTRAST_CONTROL, "Contrast"); - } - if (descriptor->controls[0] & 4) { - // debug_printf("\tHUE\n"); - fHue = _AddParameter(group, &subgroup, index + 2, - PU_HUE_CONTROL, "Hue"); - if (descriptor->controlSize >= 2) { - if (descriptor->controls[1] & 8) { - fHueAuto = _AddAutoParameter(subgroup, index + 3, - PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL); - } - } - } - if (descriptor->controls[0] & 8) { - // debug_printf("\tSATURATION\n"); - fSaturation = _AddParameter(group, &subgroup, index + 4, - PU_SATURATION_CONTROL, "Saturation"); - } - if (descriptor->controls[0] & 16) { - // debug_printf("\tSHARPNESS\n"); - fSharpness = _AddParameter(group, &subgroup, index + 5, - PU_SHARPNESS_CONTROL, "Sharpness"); - } - if (descriptor->controls[0] & 32) { - // debug_printf("\tGamma\n"); - fGamma = _AddParameter(group, &subgroup, index + 6, - PU_GAMMA_CONTROL, "Gamma"); - } - if (descriptor->controls[0] & 64) { - // debug_printf("\tWHITE BALANCE TEMPERATURE\n"); - fWBTemp = _AddParameter(group, &subgroup, index + 7, - PU_WHITE_BALANCE_TEMPERATURE_CONTROL, "WB Temperature"); - if (descriptor->controlSize >= 2) { - if (descriptor->controls[1] & 16) { - fWBTempAuto = _AddAutoParameter(subgroup, index + 8, - PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL); - } - } - } - if (descriptor->controls[0] & 128) { - // debug_printf("\tWhite Balance Component\n"); - fWBComponent = _AddParameter(group, &subgroup, index + 9, - PU_WHITE_BALANCE_COMPONENT_CONTROL, "WB Component"); - if (descriptor->controlSize >= 2) { - if (descriptor->controls[1] & 32) { - fWBTempAuto = _AddAutoParameter(subgroup, index + 10, - PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL); - } - } - } - } - if (descriptor->controlSize >= 2) { - if (descriptor->controls[1] & 1) { - // debug_printf("\tBACKLIGHT COMPENSATION\n"); - wValue = PU_BACKLIGHT_COMPENSATION_CONTROL; - wValue = wValue << 8; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, - GET_MAX, wValue, fControlRequestIndex, 2, data); - maxValue = (float)(*((uint16*)data)); - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, - GET_MIN, wValue, fControlRequestIndex, 2, data); - minValue = (float)(*((uint16*)data)); - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, - GET_CUR, wValue, fControlRequestIndex, 2, data); - fBacklightCompensation = (float)(*((uint16*)data)); - subgroup = group->MakeGroup("Backlight Compensation"); - if (maxValue - minValue == 1) { // Binary Switch - fBinaryBacklightCompensation = true; - subgroup->MakeDiscreteParameter(index + 11, - B_MEDIA_RAW_VIDEO, "Backlight Compensation", - B_ENABLE); - } else { // Range of values - fBinaryBacklightCompensation = false; - p = subgroup->MakeContinuousParameter(index + 11, - B_MEDIA_RAW_VIDEO, "Backlight Compensation", - B_GAIN, "", minValue, maxValue, 1.0/(maxValue - minValue)); - } - } - if (descriptor->controls[1] & 2) { - // debug_printf("\tGAIN\n"); - fGain = _AddParameter(group, &subgroup, index + 12, PU_GAIN_CONTROL, - "Gain"); - } - if (descriptor->controls[1] & 4) { - // debug_printf("\tPOWER LINE FREQUENCY\n"); - wValue = PU_POWER_LINE_FREQUENCY_CONTROL; - wValue = wValue << 8; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, - GET_CUR, wValue, fControlRequestIndex, 1, data); - fPowerlineFrequency = (uint16)(*((uint8*)data)); - subgroup = group->MakeGroup("Power Line Frequency"); - p = subgroup->MakeContinuousParameter(index + 13, - B_MEDIA_RAW_VIDEO, "Frequency", - B_GAIN, "", 0, 60.0, 1.0 / 60.0); - } - // TODO Determine whether controls apply to these - /* - if (descriptor->controls[1] & 64) - debug_printf("\tDigital Multiplier\n"); - if (descriptor->controls[1] & 128) - debug_printf("\tDigital Multiplier Limit\n"); - */ - } - // TODO Determine whether controls apply to these - /* - if (descriptor->controlSize >= 3) { - if (descriptor->controls[2] & 1) - debug_printf("\tAnalog Video Standard\n"); - if (descriptor->controls[2] & 2) - debug_printf("\tAnalog Video Lock Status\n"); - } - */ - } + if (interface->Class() != CC_VIDEO || interface->Subclass() + != SC_VIDEOCONTROL) + continue; + for (uint32 k = 0; interface->OtherDescriptorAt(k, generic, + sizeof(buffer)) == B_OK; k++) { + if (generic->generic.descriptor_type != (USB_REQTYPE_CLASS + | USB_DESCRIPTOR_INTERFACE)) + continue; + + if (((const usbvc_class_descriptor*)generic)->descriptorSubtype + == VC_PROCESSING_UNIT) { + _AddProcessingParameter(group, index, + (const usbvc_processing_unit_descriptor*)generic); } - } + } } } } @@ -1006,60 +987,61 @@ UVCCamDevice::GetParameterValue(int32 id, bigtime_t* last_change, void* value, printf("UVCCAmDevice::GetParameterValue(%ld)\n", id - fFirstParameterID); float* currValue; int* currValueInt; - void* data; + int16 data; uint16 wValue = 0; switch (id - fFirstParameterID) { case 0: // debug_printf("\tBrightness:\n"); // debug_printf("\tValue = %f\n",fBrightness); *size = sizeof(float); - currValue = ((float*)value); - *currValue = fBrightness; + currValue = (float*)value; + *currValue = fBrightness; *last_change = fLastParameterChanges; return B_OK; case 1: // debug_printf("\tContrast:\n"); // debug_printf("\tValue = %f\n",fContrast); *size = sizeof(float); - currValue = ((float*)value); - *currValue = fContrast; + currValue = (float*)value; + *currValue = fContrast; *last_change = fLastParameterChanges; return B_OK; case 2: // debug_printf("\tHue:\n"); // debug_printf("\tValue = %f\n",fHue); *size = sizeof(float); - currValue = ((float*)value); - *currValue = fHue; + currValue = (float*)value; + *currValue = fHue; *last_change = fLastParameterChanges; return B_OK; case 4: // debug_printf("\tSaturation:\n"); // debug_printf("\tValue = %f\n",fSaturation); *size = sizeof(float); - currValue = ((float*)value); - *currValue = fSaturation; + currValue = (float*)value; + *currValue = fSaturation; *last_change = fLastParameterChanges; return B_OK; case 5: // debug_printf("\tSharpness:\n"); // debug_printf("\tValue = %f\n",fSharpness); *size = sizeof(float); - currValue = ((float*)value); - *currValue = fSharpness; + currValue = (float*)value; + *currValue = fSharpness; *last_change = fLastParameterChanges; return B_OK; case 7: // debug_printf("\tWB Temperature:\n"); *size = sizeof(float); - currValue = ((float*)value); - wValue = PU_WHITE_BALANCE_TEMPERATURE_CONTROL; - wValue = wValue << 8; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, - GET_CUR, wValue, fControlRequestIndex, 2, data); - fWBTemp = (float)(*((uint16*)data)); + currValue = (float*)value; + wValue = PU_WHITE_BALANCE_TEMPERATURE_CONTROL << 8; + if (fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN, + GET_CUR, wValue, fControlRequestIndex, sizeof(data), &data) + == sizeof(data)) { + fWBTemp = (float)data; + } // debug_printf("\tValue = %f\n",fWBTemp); - *currValue = fWBTemp; + *currValue = fWBTemp; *last_change = fLastParameterChanges; return B_OK; case 8: @@ -1067,7 +1049,7 @@ UVCCamDevice::GetParameterValue(int32 id, bigtime_t* last_change, void* value, // debug_printf("\tValue = %d\n",fWBTempAuto); *size = sizeof(int); currValueInt = ((int*)value); - *currValueInt = fWBTempAuto; + *currValueInt = fWBTempAuto; *last_change = fLastParameterChanges; return B_OK; case 11: @@ -1075,14 +1057,14 @@ UVCCamDevice::GetParameterValue(int32 id, bigtime_t* last_change, void* value, // debug_printf("\tBacklight Compensation:\n"); // debug_printf("\tValue = %f\n",fBacklightCompensation); *size = sizeof(float); - currValue = ((float*)value); - *currValue = fBacklightCompensation; + currValue = (float*)value; + *currValue = fBacklightCompensation; *last_change = fLastParameterChanges; } else { // debug_printf("\tBacklight Compensation:\n"); // debug_printf("\tValue = %d\n",fBacklightCompensationBinary); - currValueInt = ((int*)value); - *currValueInt = fBacklightCompensationBinary; + currValueInt = (int*)value; + *currValueInt = fBacklightCompensationBinary; *last_change = fLastParameterChanges; } return B_OK; @@ -1090,15 +1072,15 @@ UVCCamDevice::GetParameterValue(int32 id, bigtime_t* last_change, void* value, // debug_printf("\tGain:\n"); // debug_printf("\tValue = %f\n",fGain); *size = sizeof(float); - currValue = ((float*)value); - *currValue = fGain; + currValue = (float*)value; + *currValue = fGain; *last_change = fLastParameterChanges; return B_OK; case 13: // debug_printf("\tPowerline Frequency:\n"); // debug_printf("\tValue = %d\n",fPowerlineFrequency); *size = sizeof(float); - currValue = ((float*)value); + currValue = (float*)value; switch (fPowerlineFrequency) { case 0: *currValue = 0.0; @@ -1112,7 +1094,7 @@ UVCCamDevice::GetParameterValue(int32 id, bigtime_t* last_change, void* value, } *last_change = fLastParameterChanges; return B_OK; - + } return B_BAD_VALUE; } @@ -1123,149 +1105,87 @@ UVCCamDevice::SetParameterValue(int32 id, bigtime_t when, const void* value, size_t size) { printf("UVCCamDevice::SetParameterValue(%ld)\n", id - fFirstParameterID); - uint16 wValue = 0; //Control Selector - uint16 setValue = 0; switch (id - fFirstParameterID) { case 0: // debug_printf("\tBrightness:\n"); - // debug_printf("\tValue = %f\n",*((float*)value)); if (!value || (size != sizeof(float))) return B_BAD_VALUE; - wValue = PU_BRIGHTNESS_CONTROL; - wValue = wValue << 8; fBrightness = *((float*)value); fLastParameterChanges = when; - setValue = (uint16)fBrightness; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); - return B_OK; + return _SetParameterValue(PU_BRIGHTNESS_CONTROL, (int16)fBrightness); case 1: // debug_printf("\tContrast:\n"); - // debug_printf("\tValue = %f\n",*((float*)value)); if (!value || (size != sizeof(float))) return B_BAD_VALUE; - wValue = PU_CONTRAST_CONTROL; - wValue = wValue << 8; fContrast = *((float*)value); fLastParameterChanges = when; - setValue = (uint16)fContrast; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); - return B_OK; + return _SetParameterValue(PU_CONTRAST_CONTROL, (int16)fContrast); case 2: // debug_printf("\tHue:\n"); - // debug_printf("\tValue = %f\n",*((float*)value)); if (!value || (size != sizeof(float))) return B_BAD_VALUE; - wValue = PU_HUE_CONTROL; - wValue = wValue << 8; fHue = *((float*)value); fLastParameterChanges = when; - setValue = (uint16)fHue; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); - return B_OK; + return _SetParameterValue(PU_HUE_CONTROL, (int16)fHue); case 4: // debug_printf("\tSaturation:\n"); - // debug_printf("\tValue = %f\n",*((float*)value)); if (!value || (size != sizeof(float))) return B_BAD_VALUE; - wValue = PU_SATURATION_CONTROL; - wValue = wValue << 8; fSaturation = *((float*)value); fLastParameterChanges = when; - setValue = (uint16)fSaturation; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); - return B_OK; + return _SetParameterValue(PU_SATURATION_CONTROL, (int16)fSaturation); case 5: // debug_printf("\tSharpness:\n"); - // debug_printf("\tValue = %f\n",*((float*)value)); if (!value || (size != sizeof(float))) return B_BAD_VALUE; - wValue = PU_SHARPNESS_CONTROL; - wValue = wValue << 8; fSharpness = *((float*)value); fLastParameterChanges = when; - setValue = (uint16)fSharpness; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); - return B_OK; + return _SetParameterValue(PU_SHARPNESS_CONTROL, (int16)fSharpness); case 7: - if (!fWBTempAuto) { - // debug_printf("\tWB Temperature:\n"); - // debug_printf("\tValue = %f\n",*((float*)value)); - if (!value || (size != sizeof(float))) - return B_BAD_VALUE; - wValue = PU_WHITE_BALANCE_TEMPERATURE_CONTROL; - wValue = wValue << 8; - fWBTemp = *((float*)value); - fLastParameterChanges = when; - setValue = (uint16)fWBTemp; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); - } - return B_OK; + if (fWBTempAuto) + return B_OK; + // debug_printf("\tWB Temperature:\n"); + if (!value || (size != sizeof(float))) + return B_BAD_VALUE; + fWBTemp = *((float*)value); + fLastParameterChanges = when; + return _SetParameterValue(PU_WHITE_BALANCE_TEMPERATURE_CONTROL, + (int16)fWBTemp); case 8: // debug_printf("\tWB Temperature Auto:\n"); if (!value || (size != sizeof(int))) return B_BAD_VALUE; - // debug_printf("\tValue = %d\n",*((int*)value)); - wValue = PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL; - wValue = wValue << 8; fWBTempAuto = *((int*)value); fLastParameterChanges = when; - setValue = fWBTempAuto; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 1, &setValue); - return B_OK; + return _SetParameterValue( + PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL, (int8)fWBTempAuto); case 11: if (!fBinaryBacklightCompensation) { // debug_printf("\tBacklight Compensation:\n"); if (!value || (size != sizeof(float))) return B_BAD_VALUE; - // debug_printf("\tValue = %f\n",*((float*)value)); - wValue = PU_BACKLIGHT_COMPENSATION_CONTROL; - wValue = wValue << 8; fBacklightCompensation = *((float*)value); - fLastParameterChanges = when; - setValue = (uint16)fBacklightCompensation; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); - }else{ + } else { // debug_printf("\tBacklight Compensation:\n"); if (!value || (size != sizeof(int))) return B_BAD_VALUE; - // debug_printf("\tValue = %d\n",*((int*)value)); - wValue = PU_BACKLIGHT_COMPENSATION_CONTROL; - wValue = wValue << 8; fBacklightCompensationBinary = *((int*)value); - fLastParameterChanges = when; - setValue = fBacklightCompensationBinary; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); } - return B_OK; + fLastParameterChanges = when; + return _SetParameterValue(PU_BACKLIGHT_COMPENSATION_CONTROL, + (int16)fBacklightCompensationBinary); case 12: // debug_printf("\tGain:\n"); - // debug_printf("\tValue = %f\n",*((float*)value)); if (!value || (size != sizeof(float))) return B_BAD_VALUE; - wValue = PU_GAIN_CONTROL; - wValue = wValue << 8; fGain = *((float*)value); fLastParameterChanges = when; - setValue = (uint16)fGain; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 2, &setValue); - return B_OK; + return _SetParameterValue(PU_GAIN_CONTROL, (int16)fGain); case 13: // debug_printf("\tPowerline Frequency:\n"); // debug_printf("\tValue = %f\n",*((float*)value)); if (!value || (size != sizeof(float))) return B_BAD_VALUE; - wValue = PU_POWER_LINE_FREQUENCY_CONTROL; - wValue = wValue << 8; float inValue = *((float*)value); fPowerlineFrequency = 0; if (inValue > 45.0 && inValue < 55.0) { @@ -1275,19 +1195,35 @@ UVCCamDevice::SetParameterValue(int32 id, bigtime_t when, const void* value, fPowerlineFrequency = 2; } fLastParameterChanges = when; - setValue = (uint8)fPowerlineFrequency; - fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_OUT, - SET_CUR, wValue, fControlRequestIndex, 1, &setValue); - return B_OK; - + return _SetParameterValue(PU_POWER_LINE_FREQUENCY_CONTROL, + (int8)fPowerlineFrequency); + } return B_BAD_VALUE; } +status_t +UVCCamDevice::_SetParameterValue(uint16 wValue, int16 setValue) +{ + return (fDevice->ControlTransfer(USB_REQTYPE_CLASS + | USB_REQTYPE_INTERFACE_OUT, SET_CUR, wValue << 8, fControlRequestIndex, + sizeof(setValue), &setValue)) == sizeof(setValue); +} + + +status_t +UVCCamDevice::_SetParameterValue(uint16 wValue, int8 setValue) +{ + return (fDevice->ControlTransfer(USB_REQTYPE_CLASS + | USB_REQTYPE_INTERFACE_OUT, SET_CUR, wValue << 8, fControlRequestIndex, + sizeof(setValue), &setValue)) == sizeof(setValue); +} + + status_t UVCCamDevice::FillFrameBuffer(BBuffer* buffer, bigtime_t* stamp) -{ +{ memset(buffer->Data(), 0, buffer->SizeAvailable()); status_t err = fDeframer->WaitFrame(2000000); if (err < B_OK) { @@ -1304,21 +1240,21 @@ UVCCamDevice::FillFrameBuffer(BBuffer* buffer, bigtime_t* stamp) long int w = (long)(VideoFrame().right - VideoFrame().left + 1); long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1); - + if (buffer->SizeAvailable() >= (size_t)w * h * 4) { // TODO: The Video Producer only outputs B_RGB32. This is OK for most // applications. This could be leveraged if applications can // consume B_YUV422. - _DecodeColor((unsigned char*)buffer->Data(), + _DecodeColor((unsigned char*)buffer->Data(), (unsigned char*)f->Buffer(), w, h); - } + } delete f; - return B_OK; + return B_OK; } void -UVCCamDevice::_DecodeColor(unsigned char* dst, unsigned char* src, +UVCCamDevice::_DecodeColor(unsigned char* dst, unsigned char* src, int32 width, int32 height) { long int i; @@ -1392,6 +1328,37 @@ UVCCamDevice::_DecodeColor(unsigned char* dst, unsigned char* src, } + + +UVCCamDeviceAddon::UVCCamDeviceAddon(WebCamMediaAddOn* webcam) + : CamDeviceAddon(webcam) +{ + printf("UVCCamDeviceAddon::UVCCamDeviceAddon(WebCamMediaAddOn* webcam)\n"); + SetSupportedDevices(kSupportedDevices); +} + + +UVCCamDeviceAddon::~UVCCamDeviceAddon() +{ +} + + +const char * +UVCCamDeviceAddon::BrandName() +{ + printf("UVCCamDeviceAddon::BrandName()\n"); + return "USB Video Class"; +} + + +UVCCamDevice * +UVCCamDeviceAddon::Instantiate(CamRoster& roster, BUSBDevice* from) +{ + printf("UVCCamDeviceAddon::Instantiate()\n"); + return new UVCCamDevice(*this, from); +} + + extern "C" status_t B_WEBCAM_MKINTFUNC(uvccam) (WebCamMediaAddOn* webcam, CamDeviceAddon **addon) diff --git a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h index 26ecbf2d26..b40ef1fad5 100644 --- a/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h +++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h @@ -49,14 +49,23 @@ private: unsigned char *src, int32 width, int32 height); + void _AddProcessingParameter(BParameterGroup* group, + int32 index, + const usbvc_processing_unit_descriptor* + descriptor); float _AddParameter(BParameterGroup* group, BParameterGroup** subgroup, int32 index, uint16 wValue, const char* name); - int _AddAutoParameter(BParameterGroup* subgroup, + uint8 _AddAutoParameter(BParameterGroup* subgroup, int32 index, uint16 wValue); - + status_t _SetParameterValue(uint16 wValue, + int16 setValue); + status_t _SetParameterValue(uint16 wValue, + int8 setValue); + + usbvc_interface_header_descriptor *fHeaderDescriptor; - + const BUSBEndpoint* fInterruptIn; uint32 fControlIndex; uint16 fControlRequestIndex; @@ -67,10 +76,10 @@ private: uint32 fMJPEGFrameIndex; uint32 fMaxVideoFrameSize; uint32 fMaxPayloadTransferSize; - + BList fUncompressedFrames; BList fMJPEGFrames; - + float fBrightness; float fContrast; float fHue; @@ -81,16 +90,16 @@ private: float fWBComponent; float fBacklightCompensation; float fGain; - + bool fBinaryBacklightCompensation; - + int fWBTempAuto; int fWBCompAuto; int fHueAuto; int fBacklightCompensationBinary; int fPowerlineFrequency; - - + + }; From e53d637520ce91031ff9ac5ea4a5044156136a27 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 1 Sep 2011 15:27:57 +0000 Subject: [PATCH 247/702] * reformulate display and connector storage to match AtomBIOS requirements * each active gDisplay references a gConnector index * add atombios DAC sense.. this really won't be the main call used... AtomBIOS expects you to attempt an EDID read to detect connected displays * remove old manual DACSense * next we attempt to add ddc / edid git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42705 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 5 +- src/add-ons/accelerants/radeon_hd/dac.cpp | 110 +++++------ src/add-ons/accelerants/radeon_hd/dac.h | 2 +- src/add-ons/accelerants/radeon_hd/display.cpp | 172 +++++++++--------- src/add-ons/accelerants/radeon_hd/display.h | 1 + src/add-ons/accelerants/radeon_hd/mode.cpp | 43 +++-- src/add-ons/accelerants/radeon_hd/pll.cpp | 5 +- 7 files changed, 174 insertions(+), 164 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 1d38516c98..96edf4f794 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -141,7 +141,7 @@ struct pll_info { typedef struct { bool valid; uint16 line_mux; - uint16 devices; + uint16 connector_flags; uint32 connector_type; uint16 connector_object_id; uint32 encoder_type; @@ -153,8 +153,7 @@ typedef struct { typedef struct { bool active; - uint32 connection_type; - uint8 connection_id; + uint32 connector_index; // matches connector id in connector_info register_info *regs; bool found_ranges; uint32 vfreq_max; diff --git a/src/add-ons/accelerants/radeon_hd/dac.cpp b/src/add-ons/accelerants/radeon_hd/dac.cpp index d45306b4c8..94307f2c72 100644 --- a/src/add-ons/accelerants/radeon_hd/dac.cpp +++ b/src/add-ons/accelerants/radeon_hd/dac.cpp @@ -23,69 +23,75 @@ extern "C" void _sPrintf(const char *format, ...); bool -DACSense(uint8 dacIndex) +dac_sense(uint32 connector_id) { - uint32 dacOffset = dacIndex == 1 ? REG_DACB_OFFSET : REG_DACA_OFFSET; + uint16 flags = gConnector[connector_id]->connector_flags; - // Backup current DAC values - uint32 compEnable = Read32(OUT, dacOffset + DACA_COMPARATOR_ENABLE); - uint32 control1 = Read32(OUT, dacOffset + DACA_CONTROL1); - uint32 control2 = Read32(OUT, dacOffset + DACA_CONTROL2); - uint32 detectControl = Read32(OUT, dacOffset + DACA_AUTODETECT_CONTROL); - uint32 enable = Read32(OUT, dacOffset + DACA_ENABLE); + if (flags & (ATOM_DEVICE_CRT_SUPPORT + | ATOM_DEVICE_CV_SUPPORT + | ATOM_DEVICE_TV_SUPPORT)) { - Write32(OUT, dacOffset + DACA_ENABLE, 1); - // Acknowledge autodetect - Write32Mask(OUT, dacOffset + DACA_AUTODETECT_INT_CONTROL, 0x01, 0x01); - Write32Mask(OUT, dacOffset + DACA_AUTODETECT_CONTROL, 0, 0x00000003); - Write32Mask(OUT, dacOffset + DACA_CONTROL2, 0, 0x00000001); - Write32Mask(OUT, dacOffset + DACA_CONTROL2, 0, 0x00ff0000); + DAC_LOAD_DETECTION_PS_ALLOCATION args; + int index = GetIndexIntoMasterTable(COMMAND, DAC_LoadDetection); + uint8 frev, crev; + memset(&args, 0, sizeof(args)); - Write32(OUT, dacOffset + DACA_FORCE_DATA, 0); - Write32Mask(OUT, dacOffset + DACA_CONTROL2, 0x00000001, 0x0000001); + if (!atom_parse_cmd_header(gAtomContext, index, &frev, &crev)) + return false; - Write32Mask(OUT, dacOffset + DACA_COMPARATOR_ENABLE, - 0x00070000, 0x00070101); - Write32(OUT, dacOffset + DACA_CONTROL1, 0x00050802); - Write32Mask(OUT, dacOffset + DACA_POWERDOWN, 0, 0x00000001); - // Shutdown Bandgap voltage reference + args.sDacload.ucMisc = 0; - snooze(5); + if ((flags & ENCODER_OBJECT_ID_INTERNAL_DAC1) + || (flags & ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1)) + args.sDacload.ucDacType = ATOM_DAC_A; + else + args.sDacload.ucDacType = ATOM_DAC_B; - Write32Mask(OUT, dacOffset + DACA_POWERDOWN, 0, 0x01010100); - // Shutdown RGB + if (flags & ATOM_DEVICE_CRT1_SUPPORT) { + args.sDacload.usDeviceID + = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CRT1_SUPPORT); + } else if (flags & ATOM_DEVICE_CRT2_SUPPORT) { + args.sDacload.usDeviceID + = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CRT2_SUPPORT); + } else if (flags & ATOM_DEVICE_CV_SUPPORT) { + args.sDacload.usDeviceID + = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CV_SUPPORT); + if (crev >= 3) + args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; + } else if (flags & ATOM_DEVICE_TV1_SUPPORT) { + args.sDacload.usDeviceID + = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_TV1_SUPPORT); + if (crev >= 3) + args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; + } - Write32(OUT, dacOffset + DACA_FORCE_DATA, 0x1e6); - // 486 out of 1024 - snooze(200); + atom_execute_table(gAtomContext, index, (uint32*)&args); - Write32Mask(OUT, dacOffset + DACA_POWERDOWN, 0x01010100, 0x01010100); - // Enable RGB - snooze(88); + uint32 bios_0_scratch; - Write32Mask(OUT, dacOffset + DACA_POWERDOWN, 0, 0x01010100); - // Shutdown RGB + bios_0_scratch = Read32(OUT, R600_BIOS_0_SCRATCH); - Write32Mask(OUT, dacOffset + DACA_COMPARATOR_ENABLE, - 0x00000100, 0x00000100); - - snooze(100); - - // Get detected RGB channels - // If only G is found, it could be a monochrome monitor, but we - // don't bother checking. - uint8 out = (Read32(OUT, dacOffset + DACA_COMPARATOR_OUTPUT) & 0x0E) >> 1; - - // Restore stored DAC values - Write32Mask(OUT, dacOffset + DACA_COMPARATOR_ENABLE, - compEnable, 0x00FFFFFF); - Write32(OUT, dacOffset + DACA_CONTROL1, control1); - Write32Mask(OUT, dacOffset + DACA_CONTROL2, control2, 0x000001FF); - Write32Mask(OUT, dacOffset + DACA_AUTODETECT_CONTROL, - detectControl, 0x000000FF); - Write32Mask(OUT, dacOffset + DACA_ENABLE, enable, 0x000000FF); - - return (out == 0x7); + if (flags & ATOM_DEVICE_CRT1_SUPPORT) { + if (bios_0_scratch & ATOM_S0_CRT1_MASK) + return true; + } + if (flags & ATOM_DEVICE_CRT2_SUPPORT) { + if (bios_0_scratch & ATOM_S0_CRT2_MASK) + return true; + } + if (flags & ATOM_DEVICE_CV_SUPPORT) { + if (bios_0_scratch & (ATOM_S0_CV_MASK|ATOM_S0_CV_MASK_A)) + return true; + } + if (flags & ATOM_DEVICE_TV1_SUPPORT) { + if (bios_0_scratch + & (ATOM_S0_TV1_COMPOSITE | ATOM_S0_TV1_COMPOSITE_A)) + return true; /* CTV */ + else if (bios_0_scratch & (ATOM_S0_TV1_SVIDEO | ATOM_S0_TV1_SVIDEO_A)) + return true; /* STV */ + } + } + return false; } diff --git a/src/add-ons/accelerants/radeon_hd/dac.h b/src/add-ons/accelerants/radeon_hd/dac.h index 9aa34f3b8a..2176170e82 100644 --- a/src/add-ons/accelerants/radeon_hd/dac.h +++ b/src/add-ons/accelerants/radeon_hd/dac.h @@ -22,7 +22,7 @@ #define FORMAT_TvCV 0x3 -bool DACSense(uint8 dacIndex); +bool dac_sense(uint32 connector_id); void DACGetElectrical(uint8 type, uint8 dac, uint8 *bandgap, uint8 *whitefine); void DACSet(uint8 dacIndex, uint32 crtid); void DACPower(uint8 dacIndex, int mode); diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 344bf30042..596e750068 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -197,7 +197,7 @@ detect_crt_ranges(uint32 crtid) { edid1_info *edid = &gInfo->shared_info->edid_info; - // TODO : VESA edid is just for primary monitor? + // TODO : use radeon ddc to get to connector EDID instead of VESA // Scan each VESA EDID description for monitor ranges for (uint32 index = 0; index < EDID1_NUM_DETAILED_MONITOR_DESC; index++) { @@ -292,7 +292,7 @@ detect_connectors_legacy() gConnector[i]->connector_type = VIDEO_CONNECTOR_VGA; gConnector[i]->valid = true; - gConnector[i]->devices = (1 << i); + gConnector[i]->connector_flags = (1 << i); // TODO : add the encoder #if 0 @@ -383,8 +383,9 @@ detect_connectors() uint32 connector_type; uint16 connector_object_id; + uint16 connector_flags = B_LENDIAN_TO_HOST_INT16(path->usDeviceTag); - if (device_support & B_LENDIAN_TO_HOST_INT16(path->usDeviceTag)) { + if (device_support & connector_flags) { uint8 con_obj_id = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; @@ -395,8 +396,7 @@ detect_connectors() // = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) // & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; - if (B_LENDIAN_TO_HOST_INT16(path->usDeviceTag) - == ATOM_DEVICE_CV_SUPPORT) { + if (connector_flags == ATOM_DEVICE_CV_SUPPORT) { TRACE("%s: Path #%" B_PRId32 ": skipping component video.\n", __func__, i); continue; @@ -465,15 +465,13 @@ detect_connectors() } uint32 encoder_id = (encoder_obj & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; - uint32 encoder_support - = B_LENDIAN_TO_HOST_INT16(path->usDeviceTag); switch(encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if (encoder_support + if (connector_flags & ATOM_DEVICE_LCD_SUPPORT) { encoder_type = VIDEO_ENCODER_LVDS; // radeon_atombios_get_lvds_info @@ -499,10 +497,10 @@ detect_connectors() case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: - if (encoder_support + if (connector_flags & ATOM_DEVICE_LCD_SUPPORT) { encoder_type = VIDEO_ENCODER_LVDS; - } else if (encoder_support + } else if (connector_flags & ATOM_DEVICE_CRT_SUPPORT) { encoder_type = VIDEO_ENCODER_DAC; } else { @@ -519,10 +517,10 @@ detect_connectors() case ENCODER_OBJECT_ID_HDMI_SI1930: case ENCODER_OBJECT_ID_TRAVIS: case ENCODER_OBJECT_ID_NUTMEG: - if (encoder_support + if (connector_flags & ATOM_DEVICE_LCD_SUPPORT) { encoder_type = VIDEO_ENCODER_LVDS; - } else if (encoder_support + } else if (connector_flags & ATOM_DEVICE_CRT_SUPPORT) { encoder_type = VIDEO_ENCODER_DAC; } else { @@ -550,6 +548,8 @@ detect_connectors() i, decode_encoder_name(encoder_type)); gConnector[connector_index]->valid = true; + + gConnector[connector_index]->connector_flags = connector_flags; gConnector[connector_index]->connector_type = connector_type; gConnector[connector_index]->connector_object_id = connector_object_id; @@ -581,52 +581,35 @@ detect_displays() gDisplay[id]->found_ranges = false; } - uint32 index = 0; + uint32 displayIndex = 0; + for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { + if (gConnector[id]->valid == false) + continue; + if (displayIndex >= MAX_DISPLAY) + continue; - // Probe for DAC monitors connected - for (uint32 id = 0; id < 2; id++) { - if (DACSense(id)) { - gDisplay[index]->active = true; - gDisplay[index]->connection_type = ATOM_ENCODER_MODE_CRT; - gDisplay[index]->connection_id = id; - init_registers(gDisplay[index]->regs, index); - if (detect_crt_ranges(index) == B_OK) - gDisplay[index]->found_ranges = true; - - if (index < MAX_DISPLAY) - index++; - else - return B_OK; + bool found = false; + switch(gConnector[id]->encoder_type) { + case VIDEO_ENCODER_DAC: + found = dac_sense(id); + break; + default: + found = false; } - } - // Probe for TMDS monitors connected - for (uint32 id = 0; id < 1; id++) { - if (TMDSSense(id)) { - gDisplay[index]->active = true; - gDisplay[index]->connection_type = ATOM_ENCODER_MODE_DVI; - // or ATOM_ENCODER_MODE_HDMI? - gDisplay[index]->connection_id = id; - init_registers(gDisplay[index]->regs, index); - if (detect_crt_ranges(index) == B_OK) - gDisplay[index]->found_ranges = true; + if (found == true) { + gDisplay[displayIndex]->active = true; + // set this display as active + gDisplay[displayIndex]->connector_index = id; + // set physical connector index from gConnector + init_registers(gDisplay[displayIndex]->regs, displayIndex); - if (index < MAX_DISPLAY) - index++; - else - return B_OK; + if (detect_crt_ranges(displayIndex) == B_OK) + gDisplay[displayIndex]->found_ranges = true; + displayIndex++; } } - // No monitors? Lets assume LVDS for now - if (index == 0) { - gDisplay[index]->active = true; - gDisplay[index]->connection_type = ATOM_ENCODER_MODE_LVDS; - gDisplay[index]->connection_id = 1; - // 0 : LVDSA ; 1 : LVDSB / TDMSB - init_registers(gDisplay[index]->regs, index); - } - return B_OK; } @@ -639,44 +622,13 @@ debug_displays() TRACE("Display #%" B_PRIu32 " active = %s\n", id, gDisplay[id]->active ? "true" : "false"); - if (gDisplay[id]->active) { - switch (gDisplay[id]->connection_type) { - case ATOM_ENCODER_MODE_DP: - TRACE(" + connection: DP\n"); - break; - case ATOM_ENCODER_MODE_LVDS: - TRACE(" + connection: LVDS\n"); - break; - case ATOM_ENCODER_MODE_DVI: - TRACE(" + connection: DVI\n"); - break; - case ATOM_ENCODER_MODE_HDMI: - TRACE(" + connection: HDMI\n"); - break; - case ATOM_ENCODER_MODE_SDVO: - TRACE(" + connection: SDVO\n"); - break; - case ATOM_ENCODER_MODE_DP_AUDIO: - TRACE(" + connection: DP AUDIO\n"); - break; - case ATOM_ENCODER_MODE_TV: - TRACE(" + connection: TV\n"); - break; - case ATOM_ENCODER_MODE_CV: - TRACE(" + connection: CV\n"); - break; - case ATOM_ENCODER_MODE_CRT: - TRACE(" + connection: CRT\n"); - break; - case ATOM_ENCODER_MODE_DVO: - TRACE(" + connection: DVO\n"); - break; - default: - TRACE(" + connection: UNKNOWN\n"); - } + uint32 connector_index = gDisplay[id]->connector_index; - TRACE(" + connection index: % " B_PRIu8 "\n", - gDisplay[id]->connection_id); + if (gDisplay[id]->active) { + uint32 connector_type = gConnector[connector_index]->connector_type; + uint32 encoder_type = gConnector[connector_index]->encoder_type; + TRACE(" + connector: %s\n", decode_connector_name(connector_type)); + TRACE(" + encoder: %s\n", decode_encoder_name(encoder_type)); TRACE(" + limits: Vert Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", gDisplay[id]->vfreq_min, gDisplay[id]->vfreq_max); @@ -689,6 +641,50 @@ debug_displays() } +uint32 +display_get_encoder_mode(uint32 connector_index) +{ + uint32 connector_type = gConnector[connector_index]->connector_type; + switch (connector_type) { + case VIDEO_CONNECTOR_DVII: + case VIDEO_CONNECTOR_HDMIB: /* HDMI-B is DL-DVI; analog works fine */ + // TODO : if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI + // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI + // if (gConnector[connector_index]->use_digital) + // return ATOM_ENCODER_MODE_DVI; + // else + return ATOM_ENCODER_MODE_CRT; + break; + case VIDEO_CONNECTOR_DVID: + case VIDEO_CONNECTOR_HDMIA: + default: + // TODO : if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI + // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI + return ATOM_ENCODER_MODE_DVI; + case VIDEO_CONNECTOR_LVDS: + return ATOM_ENCODER_MODE_LVDS; + case VIDEO_CONNECTOR_DP: + // dig_connector = radeon_connector->con_priv; + // if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) + // || (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { + // return ATOM_ENCODER_MODE_DP; + // } + // TODO : if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI + // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI + return ATOM_ENCODER_MODE_DVI; + case VIDEO_CONNECTOR_EDP: + return ATOM_ENCODER_MODE_DP; + case VIDEO_CONNECTOR_DVIA: + case VIDEO_CONNECTOR_VGA: + return ATOM_ENCODER_MODE_CRT; + case VIDEO_CONNECTOR_COMPOSITE: + case VIDEO_CONNECTOR_SVIDEO: + case VIDEO_CONNECTOR_9DIN: + return ATOM_ENCODER_MODE_TV; + } +} + + void display_crtc_lock(uint8 crtc_id, int command) { diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index f5a9f084ad..517a28d6f6 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -64,6 +64,7 @@ status_t detect_crt_ranges(uint32 crtid); status_t detect_displays(); void debug_displays(); +uint32 display_get_encoder_mode(uint32 connector_index); void display_crtc_lock(uint8 crtc_id, int command); void display_crtc_blank(uint8 crtc_id, int command); void display_crtc_scale(uint8 crtc_id, display_mode *mode); diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index c48420a011..417d7690ec 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -109,8 +109,13 @@ radeon_set_display_mode(display_mode *mode) continue; } - pll_set(gDisplay[id]->connection_id, - mode->timing.pixel_clock, id); + uint32 connector_index = gDisplay[id]->connector_index; + // uint32 connector_type = gConnector[connector_index]->connector_type; + uint32 encoder_type = gConnector[connector_index]->encoder_type; + + // TODO : the first id is the pll we use... this won't work for + // more then two monitors + pll_set(id, mode->timing.pixel_clock, id); // Program CRT Controller display_crtc_set_dtd(id, mode); @@ -119,16 +124,16 @@ radeon_set_display_mode(display_mode *mode) display_crtc_scale(id, mode); // Program connector controllers - switch (gDisplay[id]->connection_type) { - case ATOM_ENCODER_MODE_CRT: - DACSet(gDisplay[id]->connection_id, id); + switch (encoder_type) { + case VIDEO_ENCODER_DAC: + case VIDEO_ENCODER_TVDAC: + // DACSet(connector_index, id); break; - case ATOM_ENCODER_MODE_DVI: - case ATOM_ENCODER_MODE_HDMI: - TMDSSet(gDisplay[id]->connection_id, mode); + case VIDEO_ENCODER_TMDS: + // TMDSSet(connector_index, mode); break; - case ATOM_ENCODER_MODE_LVDS: - LVDSSet(gDisplay[id]->connection_id, mode); + case VIDEO_ENCODER_LVDS: + // LVDSSet(connector_index, mode); break; } @@ -139,17 +144,17 @@ radeon_set_display_mode(display_mode *mode) //PLLPower(gDisplay[id]->connection_id, RHD_POWER_ON); // Power connector controllers - switch (gDisplay[id]->connection_type) { - case ATOM_ENCODER_MODE_CRT: - DACPower(gDisplay[id]->connection_id, RHD_POWER_ON); + switch (encoder_type) { + case VIDEO_ENCODER_DAC: + case VIDEO_ENCODER_TVDAC: + // DACPower(connector_index, RHD_POWER_ON); break; - case ATOM_ENCODER_MODE_DVI: - case ATOM_ENCODER_MODE_HDMI: - TMDSPower(gDisplay[id]->connection_id, RHD_POWER_ON); + case VIDEO_ENCODER_TMDS: + // TMDSPower(connector_index, RHD_POWER_ON); break; - case ATOM_ENCODER_MODE_LVDS: - LVDSSet(gDisplay[id]->connection_id, mode); - LVDSPower(gDisplay[id]->connection_id, RHD_POWER_ON); + case VIDEO_ENCODER_LVDS: + // LVDSSet(connector_index, mode); + // LVDSPower(connector_index, RHD_POWER_ON); break; } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index e912d1828c..5305de61a0 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -10,6 +10,7 @@ #include "accelerant_protos.h" #include "accelerant.h" #include "bios.h" +#include "display.h" #include "utility.h" #include "pll.h" @@ -187,6 +188,8 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) uint8 crev; atom_parse_cmd_header(gAtomContext, index, &frev, &crev); + uint32 connector_index = gDisplay[crtc_id]->connector_index; + switch (crev) { case 1: args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); @@ -220,7 +223,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) // args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; args.v3.ucTransmitterId = crtc_id; // TODO : transmitter id is now CRTC id? - args.v3.ucEncoderMode = gDisplay[crtc_id]->connection_type; + args.v3.ucEncoderMode = display_get_encoder_mode(connector_index); break; default: TRACE("%s: ERROR: table version %d.%d TODO\n", __func__, From 2bd5013756a6dea9bdb61cfc82dd49ba191f687e Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Fri, 2 Sep 2011 06:02:36 +0000 Subject: [PATCH 248/702] Remove last usage of hardcoded k_app_mini old BeOS generic app icon. That should gracefully close #7219. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42706 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/processcontroller/AutoIcon.cpp | 7 +++++-- src/apps/processcontroller/PCWorld.h | 1 - src/apps/processcontroller/Utilities.h | 1 - src/apps/processcontroller/icons.h | 11 ----------- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/apps/processcontroller/AutoIcon.cpp b/src/apps/processcontroller/AutoIcon.cpp index dd66359905..f5ef2818e1 100644 --- a/src/apps/processcontroller/AutoIcon.cpp +++ b/src/apps/processcontroller/AutoIcon.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -45,8 +46,10 @@ AutoIcon::Bitmap() if (fSignature) { entry_ref ref; be_roster->FindApp (fSignature, &ref); - if (BNodeInfo::GetTrackerIcon(&ref, fBitmap, B_MINI_ICON) != B_OK) - fBitmap->SetBits(k_app_mini, 256, 0, B_CMAP8); + if (BNodeInfo::GetTrackerIcon(&ref, fBitmap, B_MINI_ICON) != B_OK) { + BMimeType genericAppType(B_APP_MIME_TYPE); + genericAppType.GetIcon(fBitmap, B_MINI_ICON); + } } if (fbits) diff --git a/src/apps/processcontroller/PCWorld.h b/src/apps/processcontroller/PCWorld.h index bdcdb810c7..f07b85d7ef 100644 --- a/src/apps/processcontroller/PCWorld.h +++ b/src/apps/processcontroller/PCWorld.h @@ -35,7 +35,6 @@ extern const char* kVersionName; extern const int kCurrentVersion; -extern const uchar k_app_mini[]; extern const char* kProgramName; extern const char* kPCSemaphoreName; diff --git a/src/apps/processcontroller/Utilities.h b/src/apps/processcontroller/Utilities.h index a4909ed3ee..85e765cc45 100644 --- a/src/apps/processcontroller/Utilities.h +++ b/src/apps/processcontroller/Utilities.h @@ -44,6 +44,5 @@ void move_to_deskbar(BDeskbar& deskbar); void make_window_visible(BWindow* window, bool mayResize = false); extern const uchar k_cpu_mini[]; -extern const uchar k_app_mini[]; #endif // UTILITIES_H diff --git a/src/apps/processcontroller/icons.h b/src/apps/processcontroller/icons.h index d0048b996c..6f4e70fc30 100644 --- a/src/apps/processcontroller/icons.h +++ b/src/apps/processcontroller/icons.h @@ -17,17 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -const uchar k_app_mini[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x0,0xfa,0xfa,0x0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xfa,0xfa,0xfa,0xfa,0xfa,0x0,0x0,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0x0,0x1f,0xfa,0xfa,0xfa,0xfa,0x1f,0x5d,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xf9,0x1f,0x1f,0xfa,0x1f,0x5d,0x5d,0x0,0xff, -0xff,0xff,0xff,0xff,0xff,0x0,0x0,0xf9,0xf9,0xf9,0x1f,0x5d,0x5d,0x5d,0x0,0xff,0xff,0xff,0xff,0xff,0x0,0x60,0x1,0xf9,0xf9,0xf9,0xf9,0x5d, -0x5d,0x5d,0x0,0x0,0xff,0xff,0xff,0x0,0x60,0x60,0x1,0xf9,0xf9,0xf9,0xf9,0x5d,0x5d,0x5d,0x0,0xa3,0x0,0x0,0x0,0x1f,0x60,0x60,0x60,0x1,0xf9, -0xf9,0xf9,0x5d,0x5d,0x0,0xa3,0x1f,0x2d,0x0,0x0,0x86,0x1f,0x1f,0x60,0x1f,0x0,0x0,0xf9,0x5d,0x0,0xa3,0x1f,0x2d,0x2d,0x0,0x0,0x86,0x86, -0x86,0x1f,0xd5,0x27,0x0,0x0,0x0,0xa3,0x1f,0x2d,0x2d,0x2e,0x0,0x0,0x86,0x86,0x86,0x86,0xd5,0x28,0x1,0xca,0xca,0xa3,0xa3,0x2d,0x2d,0x2e, -0x0,0x0,0x86,0x86,0x86,0x86,0xd5,0xd5,0x0,0xca,0xa3,0xa3,0xa3,0x2d,0x2d,0x2d,0x0,0x0,0x86,0x86,0x86,0x86,0xd5,0xd5,0x0,0xa3,0xa3,0xa3, -0xa3,0x2d,0x2d,0x2e,0x1,0xff,0x0,0x0,0x86,0x86,0xd5,0xd5,0x1,0x0,0x0,0xa3,0xa3,0x2d,0x2e,0x0,0x11,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x11, -0x11,0xff,0x0,0x0,0x0,0x0,0x11,0x11}; - const uchar k_cpu_mini[] = { 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0B, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0xFF, 0xFF, From f78f38a51c1b42bf25bc6fa1c35006263f6589fb Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 2 Sep 2011 16:27:35 +0000 Subject: [PATCH 249/702] * rename wimax driver directory to wwan to be more generic * given the rise of other 4G wwan technology such as lte, this seems cleaner and better matches wlan directory for wifi. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42707 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/network/Jamfile | 3 +-- src/add-ons/kernel/drivers/network/wimax/Jamfile | 3 --- src/add-ons/kernel/drivers/network/wwan/Jamfile | 3 +++ .../network/{wimax => wwan}/usb_beceemwmx/BeceemCPU.cpp | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemCPU.h | 0 .../network/{wimax => wwan}/usb_beceemwmx/BeceemDDR.cpp | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemDDR.h | 0 .../network/{wimax => wwan}/usb_beceemwmx/BeceemDevice.cpp | 0 .../network/{wimax => wwan}/usb_beceemwmx/BeceemDevice.h | 0 .../network/{wimax => wwan}/usb_beceemwmx/BeceemLED.cpp | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemLED.h | 0 .../network/{wimax => wwan}/usb_beceemwmx/BeceemNVM.cpp | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemNVM.h | 0 .../network/{wimax => wwan}/usb_beceemwmx/DeviceStruct.h | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/Driver.cpp | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/Driver.h | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/Jamfile | 2 +- .../drivers/network/{wimax => wwan}/usb_beceemwmx/README | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/Settings.cpp | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/Settings.h | 0 .../{wimax => wwan}/usb_beceemwmx/usb_beceemwmx.settings | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/util.cpp | 0 .../drivers/network/{wimax => wwan}/usb_beceemwmx/util.h | 0 23 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 src/add-ons/kernel/drivers/network/wimax/Jamfile create mode 100644 src/add-ons/kernel/drivers/network/wwan/Jamfile rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemCPU.cpp (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemCPU.h (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemDDR.cpp (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemDDR.h (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemDevice.cpp (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemDevice.h (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemLED.cpp (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemLED.h (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemNVM.cpp (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/BeceemNVM.h (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/DeviceStruct.h (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/Driver.cpp (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/Driver.h (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/Jamfile (75%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/README (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/Settings.cpp (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/Settings.h (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/usb_beceemwmx.settings (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/util.cpp (100%) rename src/add-ons/kernel/drivers/network/{wimax => wwan}/usb_beceemwmx/util.h (100%) diff --git a/src/add-ons/kernel/drivers/network/Jamfile b/src/add-ons/kernel/drivers/network/Jamfile index 147cdaab6d..5bd657ea13 100644 --- a/src/add-ons/kernel/drivers/network/Jamfile +++ b/src/add-ons/kernel/drivers/network/Jamfile @@ -37,5 +37,4 @@ SubInclude HAIKU_TOP src add-ons kernel drivers network dec21xxx ; SubInclude HAIKU_TOP src add-ons kernel drivers network rtl8139 ; SubInclude HAIKU_TOP src add-ons kernel drivers network wlan ; - -SubInclude HAIKU_TOP src add-ons kernel drivers network wimax ; +SubInclude HAIKU_TOP src add-ons kernel drivers network wwan ; diff --git a/src/add-ons/kernel/drivers/network/wimax/Jamfile b/src/add-ons/kernel/drivers/network/wimax/Jamfile deleted file mode 100644 index ed4175c363..0000000000 --- a/src/add-ons/kernel/drivers/network/wimax/Jamfile +++ /dev/null @@ -1,3 +0,0 @@ -SubDir HAIKU_TOP src add-ons kernel drivers network wimax ; - -SubIncludeGPL HAIKU_TOP src add-ons kernel drivers network wimax usb_beceemwmx ; diff --git a/src/add-ons/kernel/drivers/network/wwan/Jamfile b/src/add-ons/kernel/drivers/network/wwan/Jamfile new file mode 100644 index 0000000000..4108d65fda --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wwan/Jamfile @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network wwan ; + +SubIncludeGPL HAIKU_TOP src add-ons kernel drivers network wwan usb_beceemwmx ; diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemCPU.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.cpp similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemCPU.cpp rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.cpp diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemCPU.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemCPU.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.h diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.cpp similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.cpp rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.cpp diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDDR.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.h diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.cpp similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.cpp diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.h diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemLED.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.cpp similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemLED.cpp rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.cpp diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemLED.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemLED.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.h diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.cpp similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.cpp diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.h diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/DeviceStruct.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/DeviceStruct.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/DeviceStruct.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/DeviceStruct.h diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Driver.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Driver.cpp similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Driver.cpp rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Driver.cpp diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Driver.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Driver.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Driver.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Driver.h diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Jamfile b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Jamfile similarity index 75% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Jamfile rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Jamfile index 082adfe93c..ec19bd901e 100644 --- a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Jamfile +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Jamfile @@ -1,4 +1,4 @@ -SubDir HAIKU_TOP src add-ons kernel drivers network wimax usb_beceemwmx ; +SubDir HAIKU_TOP src add-ons kernel drivers network wwan usb_beceemwmx ; SetSubDirSupportedPlatformsBeOSCompatible ; diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/README b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/README similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/README rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/README diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Settings.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Settings.cpp similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Settings.cpp rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Settings.cpp diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Settings.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Settings.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/Settings.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/Settings.h diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/usb_beceemwmx.settings b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/usb_beceemwmx.settings similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/usb_beceemwmx.settings rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/usb_beceemwmx.settings diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/util.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.cpp similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/util.cpp rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.cpp diff --git a/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/util.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.h similarity index 100% rename from src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/util.h rename to src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.h From a88394e56e36fd5f66dbb1f13f65ece4f75551b3 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 2 Sep 2011 17:47:14 +0000 Subject: [PATCH 250/702] * find GPIO pin connector i2c is on for DDC / EDID * add i2c_bus to connector information git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42708 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 1 + src/add-ons/accelerants/radeon_hd/display.cpp | 52 ++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 96edf4f794..4312cb019b 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -144,6 +144,7 @@ typedef struct { uint16 connector_flags; uint32 connector_type; uint16 connector_object_id; + i2c_bus connector_i2c; uint32 encoder_type; uint16 encoder_object_id; // TODO struct radeon_i2c_bus_rec ddc_bus; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 596e750068..183811ce0b 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -537,7 +537,57 @@ detect_connectors() } } - // TODO : look up gpio for ddc, hpd + // Set up information buses such as ddc + if ((connector_flags + & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) == 0) { + for (j = 0; j < con_obj->ucNumberOfObjects; j++) { + if (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) + == B_LENDIAN_TO_HOST_INT16( + con_obj->asObjects[j].usObjectID)) { + ATOM_COMMON_RECORD_HEADER *record + = (ATOM_COMMON_RECORD_HEADER*)(gAtomContext->bios + + data_offset + B_LENDIAN_TO_HOST_INT16( + con_obj->asObjects[j].usRecordOffset)); + while (record->ucRecordSize > 0 + && record->ucRecordType > 0 + && record->ucRecordType + <= ATOM_MAX_OBJECT_RECORD_NUMBER) { + ATOM_I2C_RECORD *i2c_record; + ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; + //ATOM_HPD_INT_RECORD *hpd_record; + + switch (record->ucRecordType) { + case ATOM_I2C_RECORD_TYPE: + i2c_record + = (ATOM_I2C_RECORD *)record; + i2c_config + = (ATOM_I2C_ID_CONFIG_ACCESS *) + &i2c_record->sucI2cId; + + // i2c_config->ucAccess is gpio_id + + // ddc_bus = radeon_lookup_i2c_gpio(rdev, + // i2c_config->ucAccess); + + TRACE("Found i2c record: GPIO: 0x%" + B_PRIx32 "\n", i2c_config->ucAccess); + + // ddc2_init_timing( + // &gConnector[connector_index]->connector_i2c); + + break; + case ATOM_HPD_INT_RECORD_TYPE: + // TODO : HPD (Hot Plug) + break; + } + + // move to next record + record = (ATOM_COMMON_RECORD_HEADER *) + ((char *)record + record->ucRecordSize); + } + } + } + } // TODO : aux chan transactions From cfda569d7f1b3c08a0f74240666341d5b147f66e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 2 Sep 2011 21:11:01 +0000 Subject: [PATCH 251/702] * add function to set up i2c bus for connector * few tab fixes * add Axel as author as the base i2c stuff is from intel_extreme git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42709 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 14 +-- src/add-ons/accelerants/radeon_hd/gpu.cpp | 109 +++++++++++++++++- src/add-ons/accelerants/radeon_hd/gpu.h | 3 +- 3 files changed, 113 insertions(+), 13 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 183811ce0b..38ccb95558 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -564,17 +564,9 @@ detect_connectors() = (ATOM_I2C_ID_CONFIG_ACCESS *) &i2c_record->sucI2cId; - // i2c_config->ucAccess is gpio_id - - // ddc_bus = radeon_lookup_i2c_gpio(rdev, - // i2c_config->ucAccess); - - TRACE("Found i2c record: GPIO: 0x%" - B_PRIx32 "\n", i2c_config->ucAccess); - - // ddc2_init_timing( - // &gConnector[connector_index]->connector_i2c); - + // set up i2c bus for connector + radeon_gpu_i2c_setup(connector_index, + i2c_config->ucAccess); break; case ATOM_HPD_INT_RECORD_TYPE: // TODO : HPD (Hot Plug) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 249fa0e285..faa48fb8af 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -3,7 +3,8 @@ * Distributed under the terms of the MIT License. * * Authors: - * Alexander von Gluck, kallisti5@unixzen.com + * Alexander von Gluck, kallisti5@unixzen.com + * Axel Dörfler, axeld@pinc-software.de */ @@ -273,3 +274,109 @@ radeon_gpu_irq_setup() return B_ERROR; } + + +static status_t +get_i2c_signals(void* cookie, int* _clock, int* _data) +{ + #if 0 + uint32 ioRegister = (uint32)cookie; + uint32 value = read32(ioRegister); + + *_clock = (value & I2C_CLOCK_VALUE_IN) != 0; + *_data = (value & I2C_DATA_VALUE_IN) != 0; + #endif + + return B_OK; +} + + +static status_t +set_i2c_signals(void* cookie, int clock, int data) +{ + #if 0 + uint32 ioRegister = (uint32)cookie; + uint32 value = read32(OUT, ioRegister) & I2C_RESERVED; + + if (data != 0) + value |= I2C_DATA_DIRECTION_MASK; + else { + value |= I2C_DATA_DIRECTION_MASK + | I2C_DATA_DIRECTION_OUT + | I2C_DATA_VALUE_MASK; + } + + if (clock != 0) + value |= I2C_CLOCK_DIRECTION_MASK; + else + value |= I2C_CLOCK_DIRECTION_MASK + | I2C_CLOCK_DIRECTION_OUT + | I2C_CLOCK_VALUE_MASK; + + write32(OUT, ioRegister, value); + read32(OUT, ioRegister); + // make sure the PCI bus has flushed the write + #endif + + return B_OK; +} + + +status_t +radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) +{ + // aka radeon_lookup_i2c_gpio + TRACE("%s: Path #%" B_PRId32 ": GPIO Pin 0x%" B_PRIx8 "\n", __func__, + connector, gpio_id); + + ATOM_GPIO_I2C_ASSIGMENT *gpio; + struct _ATOM_GPIO_I2C_INFO *i2c_info; + int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); + uint16 offset; + uint16 size; + + if (atom_parse_data_header(gAtomContext, index, + &size, NULL, NULL, &offset)) { + + i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + offset); + + uint32 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) + / sizeof(ATOM_GPIO_I2C_ASSIGMENT); + + for (uint32 i = 0; i < num_indices; i++) { + gpio = &i2c_info->asGPIO_Info[i]; + + // TODO : if DCE 4 and i == 7 ... manual override for evergreen + // TODO : if DCE 3 and i == 4 ... manual override + + if (gpio->sucI2cId.ucAccess == gpio_id) { + i2c_bus bus; + + // successful lookup + TRACE("%s: successful i2c gpio lookup\n", __func__); + + // pull registers for data and clock... + uint16 analogDataReg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; + //uint16 analogClockReg + // = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; + //uint16 digitalDataReg + // = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) * 4; + //uint16 digitalClockReg + // = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; + + // populate cookie with analog data register + bus.cookie = (void*)analogDataReg; + bus.set_signals = &set_i2c_signals; + bus.get_signals = &get_i2c_signals; + + ddc2_init_timing(&bus); + // TODO : check for valid analog edid + // TODO : check for valid digital edid no results on analog + } + } + + } + + return B_OK; +} diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index b0779c748a..618a49961b 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. * * Authors: - * Alexander von Gluck, kallisti5@unixzen.com + * Alexander von Gluck, kallisti5@unixzen.com */ #ifndef RADEON_HD_GPU_H #define RADEON_HD_GPU_H @@ -168,6 +168,7 @@ void radeon_gpu_mc_resume(); uint32 radeon_gpu_mc_idlecheck(); status_t radeon_gpu_mc_setup(); status_t radeon_gpu_irq_setup(); +status_t radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id); #endif From beeda30637c48d5cb8a5b0a562c59e9fbf8d2444 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 3 Sep 2011 14:26:32 +0000 Subject: [PATCH 252/702] More tweakings to the notification view : * Use a BStatusBar for progress. * Smaller icon stripe on the left * Shift the message title aligned with the rest of the message * Fix drawing bugs at the right of the window Thanks to diver for the suggestion mockups! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42710 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/notification/NotificationView.cpp | 72 +++++++------------ 1 file changed, 25 insertions(+), 47 deletions(-) diff --git a/src/servers/notification/NotificationView.cpp b/src/servers/notification/NotificationView.cpp index 28963614e9..c645373435 100644 --- a/src/servers/notification/NotificationView.cpp +++ b/src/servers/notification/NotificationView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010, Haiku, Inc. All Rights Reserved. + * Copyright 2010-2011, Haiku, Inc. All Rights Reserved. * Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved. * Copyright 2004-2008, Michael Davidson. All Rights Reserved. * Copyright 2004-2007, Mikael Eiman. All Rights Reserved. @@ -10,6 +10,7 @@ * Mikael Eiman, mikael@eiman.tv * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com * Stephan Aßmus + * Adrien Destugues */ #include @@ -22,6 +23,7 @@ #include #include #include +#include #include #include @@ -32,7 +34,7 @@ const char* kSmallIconAttribute = "BEOS:M:STD_ICON"; const char* kLargeIconAttribute = "BEOS:L:STD_ICON"; const char* kIconAttribute = "BEOS:ICON"; -static const int kIconStripeWidth = 30; +static const int kIconStripeWidth = 16; property_info message_prop_list[] = { { "type", {B_GET_PROPERTY, B_SET_PROPERTY, 0}, @@ -100,6 +102,21 @@ NotificationView::NotificationView(NotificationWindow* win, SetViewColor(ui_color(B_FAILURE_COLOR)); SetLowColor(ui_color(B_FAILURE_COLOR)); break; + case B_PROGRESS_NOTIFICATION: + { + BRect frame(kIconStripeWidth * 3, Bounds().bottom - 36, + Bounds().right - kEdgePadding, Bounds().bottom - kEdgePadding); + BStatusBar* progress = new BStatusBar(frame, "progress"); + progress->SetBarHeight(12.0f); + progress->SetMaxValue(1.0f); + progress->Update(fProgress); + + BString label = ""; + label << (int)(fProgress * 100) << " %"; + progress->SetTrailingText(label); + + AddChild(progress); + } default: SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -241,15 +258,12 @@ NotificationView::MessageReceived(BMessage* msg) void NotificationView::GetPreferredSize(float* w, float* h) { - // Parent width, minus the edge padding, minus the pensize - *w = fParent->ViewWidth() - (kEdgePadding * 2) - (kPenSize * 2); + *w = fParent->ViewWidth(); *h = fHeight; if (fType == B_PROGRESS_NOTIFICATION) { - font_height fh; - be_plain_font->GetHeight(&fh); - float fontHeight = fh.ascent + fh.descent + fh.leading; - *h += (kSmallPadding * 2) + (kEdgePadding * 1) + fontHeight; + *h += 16 + kEdgePadding; + // 16 is progress bar default size as stated in the BeBook } } @@ -259,41 +273,6 @@ NotificationView::Draw(BRect updateRect) { BRect progRect; - // Draw progress background - if (fType == B_PROGRESS_NOTIFICATION) { - PushState(); - - font_height fh; - be_plain_font->GetHeight(&fh); - float fontHeight = fh.ascent + fh.descent + fh.leading; - - progRect = Bounds(); - progRect.InsetBy(kEdgePadding, kEdgePadding); - progRect.top = progRect.bottom - (kSmallPadding * 2) - fontHeight; - StrokeRect(progRect); - - BRect barRect = progRect; - barRect.InsetBy(1.0, 1.0); - barRect.right *= fProgress; - SetHighColor(ui_color(B_CONTROL_HIGHLIGHT_COLOR)); - FillRect(barRect); - - SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); - - BString label = ""; - label << (int)(fProgress * 100) << " %"; - - float labelWidth = be_plain_font->StringWidth(label.String()); - float labelX = progRect.left + (progRect.IntegerWidth() / 2) - (labelWidth / 2); - - SetLowColor(B_TRANSPARENT_COLOR); - SetDrawingMode(B_OP_ALPHA); - DrawString(label.String(), label.Length(), - BPoint(labelX, progRect.top + fh.ascent + fh.leading + kSmallPadding)); - - PopState(); - } - SetDrawingMode(B_OP_ALPHA); SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); @@ -361,6 +340,8 @@ NotificationView::Draw(BRect updateRect) PopState(); Sync(); + + BView::Draw(updateRect); } @@ -524,10 +505,7 @@ NotificationView::SetText(const char* app, const char* title, const char* text, titleLine->text = fTitle; titleLine->font = *be_bold_font; - if (fParent->Layout() == AllTextRightOfIcon) - titleLine->location = BPoint(iconRight, y); - else - titleLine->location = BPoint(kEdgePadding, y); + titleLine->location = BPoint(iconRight, y); fLines.push_front(titleLine); y += fontHeight; From f2fc3a86c22470b335dd04f6fd814e2775ae307b Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 3 Sep 2011 15:13:05 +0000 Subject: [PATCH 253/702] Remove useless method call. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42711 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/notification/NotificationView.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/servers/notification/NotificationView.cpp b/src/servers/notification/NotificationView.cpp index c645373435..39e8499f01 100644 --- a/src/servers/notification/NotificationView.cpp +++ b/src/servers/notification/NotificationView.cpp @@ -10,7 +10,7 @@ * Mikael Eiman, mikael@eiman.tv * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com * Stephan Aßmus - * Adrien Destugues + * Adrien Destugues */ #include @@ -340,8 +340,6 @@ NotificationView::Draw(BRect updateRect) PopState(); Sync(); - - BView::Draw(updateRect); } From 9bf2d4869067b2829b835a76035937d6d9b13bfa Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 3 Sep 2011 20:11:27 +0000 Subject: [PATCH 254/702] Some more work on usb_davicom driver : * Setup the interrupt endpoint on device setup, not start * Fixup some flags I was setting wrong * Add even more debug traces git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42712 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/usb_davicom/DavicomDevice.cpp | 125 +++++++++++------- .../network/usb_davicom/DavicomDevice.h | 9 +- .../drivers/network/usb_davicom/Driver.cpp | 28 ++-- 3 files changed, 103 insertions(+), 59 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp index e5a3823a93..9cfe2c2f03 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp @@ -33,8 +33,11 @@ #define NSR 0x01 // Network status #define RCR 0x05 // RX Control #define PAR 0x10 // 6 bits - Physical address (MAC) -#define GPCR 0x1E // General purpose control -#define GPR 0x1F // General purpose +#define GPCR 0x1E // GPIO pins direction +#define GPR 0x1F // GPIO pins data +#define VID 0x28 // Vendor ID (16bit) +#define PID 0x2A // Product ID (16bit) +#define CHIPR 0x2C // Chip revision #define NCR_EXT_PHY 0x80 // External PHY #define NCR_FDX 0x08 // Full duplex @@ -60,7 +63,7 @@ status_t -DavicomDevice::_ReadRegister(uint8 reg, size_t size, uint8* buffer) +DavicomDevice::_ReadRegister(uint8 reg, size_t size, void* buffer) { if (size > 255) return B_BAD_VALUE; size_t actualLength; @@ -184,14 +187,6 @@ DavicomDevice::Open(uint32 flags) return result; } - // setup state notifications - result = gUSBModule->queue_interrupt(fNotifyEndpoint, fNotifyBuffer, - kNotifyBufferSize, _NotifyCallback, this); - if(result != B_OK) { - TRACE_ALWAYS("Error of requesting notify interrupt:%#010x\n", result); - return result; - } - fNonBlocking = (flags & O_NONBLOCK) == O_NONBLOCK; fOpen = true; return result; @@ -362,9 +357,11 @@ DavicomDevice::Control(uint32 op, void *buffer, size_t length) { switch (op) { case ETHER_INIT: + TRACE_ALWAYS("ETHER_INIT\n"); return B_OK; case ETHER_GETADDR: + TRACE_ALWAYS("ETHER_GETADDR\n"); memcpy(buffer, &fMACAddress, sizeof(fMACAddress)); return B_OK; @@ -395,6 +392,7 @@ DavicomDevice::Control(uint32 op, void *buffer, size_t length) return B_OK; case ETHER_GET_LINK_STATE: + TRACE_ALWAYS("ETHER_GET_LINK_STATE\n"); return GetLinkState((ether_link_state *)buffer); #endif @@ -433,10 +431,10 @@ DavicomDevice::Removed() status_t DavicomDevice::SetupDevice(bool deviceReplugged) { + /* First of all, we need to know the MAC address */ ether_address address; status_t result = ReadMACAddress(&address); if(result != B_OK) { - TRACE_ALWAYS("Error reading MAC address:%#010x\n", result); return result; } @@ -445,18 +443,45 @@ DavicomDevice::SetupDevice(bool deviceReplugged) address.ebyte[3], address.ebyte[4], address.ebyte[5]); if(deviceReplugged) { - // this might be the same device that was replugged - read the MAC address - // (which should be at the same index) to make sure + // this might be the same device that was replugged - read the MAC + // address (which should be at the same index) to make sure if(memcmp(&address, &fMACAddress, sizeof(address)) != 0) { TRACE_ALWAYS("Cannot replace device with MAC address:" - "%02x:%02x:%02x:%02x:%02x:%02x\n", - fMACAddress.ebyte[0], fMACAddress.ebyte[1], fMACAddress.ebyte[2], - fMACAddress.ebyte[3], fMACAddress.ebyte[4], fMACAddress.ebyte[5]); + "%02x:%02x:%02x:%02x:%02x:%02x\n", + fMACAddress.ebyte[0], fMACAddress.ebyte[1], + fMACAddress.ebyte[2], fMACAddress.ebyte[3], + fMACAddress.ebyte[4], fMACAddress.ebyte[5]); return B_BAD_VALUE; // is not the same } } else fMACAddress = address; + + /* Read the product ID, vendor ID, and chip revision (not used so far, but + I feel the quirks coming in sooner or later !) */ + + uint16 vidpid[3]; + vidpid[2] = 0; // We overwrite only the fist byte of this one. + + result = _ReadRegister(VID, 5, vidpid); + if (result != B_OK) + TRACE_ALWAYS("Error reading CHIPR: %#010x.\n", result); + else + TRACE_ALWAYS("Chip %#04x:%#04x revision %d\n", vidpid[0], vidpid[1], + vidpid[2]); + + // setup state notifications (we need this to get linkup/linkdown events) + result = gUSBModule->queue_interrupt(fNotifyEndpoint, fNotifyBuffer, + kNotifyBufferSize, _NotifyCallback, this); + if(result != B_OK) { + TRACE_ALWAYS("Error of requesting notify interrupt:%#010x\n", result); + return result; + } + + // TODO enable "wakeup" at the device level or we'll never get anything ! + // TODO check if link was already up before enabling interrupts. If so, we + // need to notify the network stack right now. + return B_OK; } @@ -532,34 +557,41 @@ DavicomDevice::_SetupEndpoints() int writeEndpoint = -1; for(size_t ep = 0; ep < interface->endpoint_count; ep++) { - usb_endpoint_descriptor *epd = interface->endpoint[ep].descr; - if((epd->attributes & USB_ENDPOINT_ATTR_MASK) == USB_ENDPOINT_ATTR_INTERRUPT) { - notifyEndpoint = ep; - continue; - } + usb_endpoint_descriptor *epd = interface->endpoint[ep].descr; + + // Is it an interrupt enpoint ? + if((epd->attributes & USB_ENDPOINT_ATTR_MASK) + == USB_ENDPOINT_ATTR_INTERRUPT) { + notifyEndpoint = ep; + continue; + } + + // Is it a bulk one ? + if((epd->attributes & USB_ENDPOINT_ATTR_MASK) != USB_ENDPOINT_ATTR_BULK) { + TRACE_ALWAYS("Error: USB endpoint type %#04x is unknown.\n", + epd->attributes); + continue; + } - if((epd->attributes & USB_ENDPOINT_ATTR_MASK) != USB_ENDPOINT_ATTR_BULK) { - TRACE_ALWAYS("Error: USB endpoint type %#04x is unknown.\n", epd->attributes); - continue; - } + // If so, which direction ? + if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) + == USB_ENDPOINT_ADDR_DIR_IN) { + readEndpoint = ep; + continue; + } - if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) - == USB_ENDPOINT_ADDR_DIR_IN) { - readEndpoint = ep; - continue; - } - - if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_OUT) - == USB_ENDPOINT_ADDR_DIR_OUT) { - writeEndpoint = ep; - continue; - } + if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_OUT) + == USB_ENDPOINT_ADDR_DIR_OUT) { + writeEndpoint = ep; + continue; + } } + // Did we find all the needed endpoints ? if (notifyEndpoint == -1 || readEndpoint == -1 || writeEndpoint == -1) { TRACE_ALWAYS("Error: not all USB endpoints were found: " - "notify:%d; read:%d; write:%d\n", - notifyEndpoint, readEndpoint, writeEndpoint); + "notify:%d; read:%d; write:%d\n", notifyEndpoint, readEndpoint, + writeEndpoint); return B_ERROR; } @@ -576,7 +608,8 @@ DavicomDevice::_SetupEndpoints() status_t DavicomDevice::ReadMACAddress(ether_address_t *address) { - status_t result = _ReadRegister(PAR, sizeof(ether_address), (uint8*)address); + status_t result = _ReadRegister(PAR, sizeof(ether_address), + (uint8*)address); if(result != B_OK) { TRACE_ALWAYS("Error of reading MAC address:%#010x\n", result); return result; @@ -687,7 +720,6 @@ DavicomDevice::_NotifyCallback(void *cookie, int32 status, void *data, */ } - // parse data in overriden class device->OnNotify(actualLength); // schedule next notification buffer @@ -701,9 +733,10 @@ status_t DavicomDevice::StartDevice() { uint8 registerValue = 0; - + status_t result; + /* disable loopback */ - status_t result = _ReadRegister(NCR, 1, ®isterValue); + result = _ReadRegister(NCR, 1, ®isterValue); if (result != B_OK) { TRACE_ALWAYS("Error reading NCR: %#010x.\n", result); return result; @@ -736,7 +769,7 @@ DavicomDevice::StartDevice() TRACE_ALWAYS("Error reading GPCR: %#010x.\n", result); return result; } - registerValue &= GPCR_GEP_CNTL0; + registerValue |= GPCR_GEP_CNTL0; result = _Write1Register(GPCR, registerValue); if (result != B_OK) { TRACE_ALWAYS("Error writing %#02X to GPCR: %#010x.\n", registerValue, result); @@ -787,7 +820,7 @@ DavicomDevice::OnNotify(uint32 actualLength) TRACE("Link is now up at %s Mb/s\n", (fNotifyBuffer[0] & NSR_SPEED) ? "10" : "100"); } else - TRACE("Link is now down"); + TRACE("Link is now down.\n"); } if (rxOverflow) @@ -826,7 +859,7 @@ DavicomDevice::GetLinkState(ether_link_state *linkState) linkState->media |= IFM_ACTIVE; result = _ReadRegister(NCR, 1, ®isterValue); if (result != B_OK) { - TRACE_ALWAYS("Error reading NCR register! %x\n",result); + TRACE_ALWAYS("Error reading NCR register: %s\n",strerror(result)); return result; } diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h index f0631925bf..13028d3f24 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h @@ -23,7 +23,8 @@ class DavicomDevice { public: - DavicomDevice(usb_device device, const char *description); + DavicomDevice(usb_device device, + const char *description); virtual ~DavicomDevice(); status_t InitCheck() { return fStatus; }; @@ -54,8 +55,10 @@ static void _NotifyCallback(void *cookie, int32 status, status_t _SetupEndpoints(); - status_t _ReadRegister(uint8 reg, size_t size, uint8* buffer); - status_t _WriteRegister(uint8 reg, size_t size, uint8* buffer); + status_t _ReadRegister(uint8 reg, size_t size, + void* buffer); + status_t _WriteRegister(uint8 reg, size_t size, + uint8* buffer); status_t _Write1Register(uint8 reg, uint8 buffer); static const int kFrameSize = 1518; diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp index 06a0ca299a..169f6c4129 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp @@ -35,9 +35,9 @@ char *gDeviceNames[MAX_DEVICES + 1]; usb_module_info *gUSBModule = NULL; usb_support_descriptor gSupportedDevices[] = { - { 0, 0, 0, 0x0fe6, 0x8101}, // "Sunrising JP108" + { 0, 0, 0, 0x0fe6, 0x8101}, // "Supereal SR9600" { 0, 0, 0, 0x07aa, 0x9601}, // "Corega FEther USB-TXC" - { 0, 0, 0, 0x0a46, 0x9601}, // "Davicom USB-100" + { 0, 0, 0, 0x0a46, 0x9601}, // "Davicom DM9601" { 0, 0, 0, 0x0a46, 0x6688}, // "ZT6688 USB NIC" { 0, 0, 0, 0x0a46, 0x0268}, // "ShanTou ST268 USB NIC" { 0, 0, 0, 0x0a46, 0x8515}, // "ADMtek ADM8515 USB NIC" @@ -67,14 +67,22 @@ create_davicom_device(usb_device device) #define IDS(__vendor, __product) (((__vendor) << 16) | (__product)) switch(IDS(deviceDescriptor->vendor_id, deviceDescriptor->product_id)) { - case IDS(0x0fe6, 0x8101): return new DavicomDevice(device, "Sunrising JP108"); - case IDS(0x07aa, 0x9601): return new DavicomDevice(device, "Corega FEther USB-TXC"); - case IDS(0x0a46, 0x9601): return new DavicomDevice(device, "Davicom USB-100"); - case IDS(0x0a46, 0x6688): return new DavicomDevice(device, "ZT6688 USB NIC"); - case IDS(0x0a46, 0x0268): return new DavicomDevice(device, "ShanTou ST268 USB NIC"); - case IDS(0x0a46, 0x8515): return new DavicomDevice(device, "ADMtek ADM8515 USB NIC"); - case IDS(0x0a47, 0x9601): return new DavicomDevice(device, "Hirose USB-100"); - case IDS(0x0a46, 0x9000): return new DavicomDevice(device, "DM9000E"); + case IDS(0x0fe6, 0x8101): + return new DavicomDevice(device, "Sunrising JP108"); + case IDS(0x07aa, 0x9601): + return new DavicomDevice(device, "Corega FEther USB-TXC"); + case IDS(0x0a46, 0x9601): + return new DavicomDevice(device, "Davicom USB-100"); + case IDS(0x0a46, 0x6688): + return new DavicomDevice(device, "ZT6688 USB NIC"); + case IDS(0x0a46, 0x0268): + return new DavicomDevice(device, "ShanTou ST268 USB NIC"); + case IDS(0x0a46, 0x8515): + return new DavicomDevice(device, "ADMtek ADM8515 USB NIC"); + case IDS(0x0a47, 0x9601): + return new DavicomDevice(device, "Hirose USB-100"); + case IDS(0x0a46, 0x9000): + return new DavicomDevice(device, "DM9000E"); } return NULL; } From dbc35acfc97ccc8949c6f7cca75451599fffc835 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 4 Sep 2011 17:07:21 +0000 Subject: [PATCH 255/702] * Ukrainian catkeys updated from HTA; * Belarusian, Russian, Swedish catkeys for PoorMan and CodyCam fixed for "Application name" -> "System name" HTA bug; * "apps/networktime" folder finally deleted - functionality was superseeded by time preflet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42713 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../add-ons/disk_systems/bfs/uk.catkeys | 9 +++- .../add-ons/disk_systems/intel/uk.catkeys | 3 +- .../input_server/devices/keyboard/uk.catkeys | 10 ++++ .../inbound_filters/match_header/uk.catkeys | 15 ++++++ .../inbound_protocols/imap/uk.catkeys | 9 ++++ .../outbound_filters/fortune/uk.catkeys | 4 ++ .../screen_savers/butterfly/uk.catkeys | 3 +- .../add-ons/screen_savers/debugnow/uk.catkeys | 3 +- .../add-ons/screen_savers/flurry/uk.catkeys | 2 + .../add-ons/screen_savers/haiku/uk.catkeys | 3 +- .../add-ons/screen_savers/icons/uk.catkeys | 3 +- .../add-ons/screen_savers/ifs/uk.catkeys | 5 +- .../add-ons/screen_savers/message/uk.catkeys | 4 +- .../add-ons/tracker/zipomatic/uk.catkeys | 4 +- .../add-ons/translators/exr/uk.catkeys | 3 +- .../add-ons/translators/gif/uk.catkeys | 9 +++- .../add-ons/translators/hvif/uk.catkeys | 3 +- .../add-ons/translators/ico/uk.catkeys | 5 +- .../add-ons/translators/jpeg/uk.catkeys | 8 ++- .../add-ons/translators/jpeg2000/uk.catkeys | 9 +++- .../add-ons/translators/rtf/uk.catkeys | 7 ++- .../add-ons/translators/tga/uk.catkeys | 4 +- data/catalogs/apps/3dmov/uk.catkeys | 2 + data/catalogs/apps/aboutsystem/uk.catkeys | 52 ++++++++++++++++++- data/catalogs/apps/activitymonitor/uk.catkeys | 5 +- data/catalogs/apps/bootmanager/uk.catkeys | 12 ++++- data/catalogs/apps/cdplayer/uk.catkeys | 4 +- data/catalogs/apps/charactermap/uk.catkeys | 21 ++++++-- data/catalogs/apps/clock/uk.catkeys | 2 + data/catalogs/apps/codycam/be.catkeys | 2 +- data/catalogs/apps/codycam/ru.catkeys | 2 +- data/catalogs/apps/codycam/sv.catkeys | 2 +- data/catalogs/apps/codycam/uk.catkeys | 6 ++- data/catalogs/apps/deskbar/uk.catkeys | 10 +++- data/catalogs/apps/deskcalc/uk.catkeys | 3 +- data/catalogs/apps/devices/uk.catkeys | 39 +++++++++++++- data/catalogs/apps/diskprobe/uk.catkeys | 22 +++++++- data/catalogs/apps/diskusage/uk.catkeys | 25 ++++++++- data/catalogs/apps/drivesetup/uk.catkeys | 10 +++- data/catalogs/apps/expander/uk.catkeys | 13 +++-- data/catalogs/apps/glteapot/uk.catkeys | 24 +++++++++ data/catalogs/apps/icon-o-matic/uk.catkeys | 12 ++++- .../apps/installedpackages/uk.catkeys | 3 +- data/catalogs/apps/installer/uk.catkeys | 14 ++++- data/catalogs/apps/launchbox/uk.catkeys | 10 +++- data/catalogs/apps/magnify/uk.catkeys | 7 ++- data/catalogs/apps/mail/uk.catkeys | 32 ++++++++++-- data/catalogs/apps/mandelbrot/uk.catkeys | 10 ++++ data/catalogs/apps/mediaconverter/uk.catkeys | 42 ++++++++++++++- data/catalogs/apps/mediaplayer/uk.catkeys | 21 ++++++-- data/catalogs/apps/midiplayer/uk.catkeys | 3 +- data/catalogs/apps/musiccollection/uk.catkeys | 2 + data/catalogs/apps/networkstatus/uk.catkeys | 10 +++- .../catalogs/apps/networktime/zh_hans.catkeys | 1 - data/catalogs/apps/poorman/be.catkeys | 2 +- data/catalogs/apps/poorman/ru.catkeys | 2 +- data/catalogs/apps/powerstatus/uk.catkeys | 25 ++++++++- data/catalogs/apps/workspaces/uk.catkeys | 4 +- data/catalogs/bin/desklink/uk.catkeys | 14 +++++ data/catalogs/bin/dstcheck/uk.catkeys | 8 +-- data/catalogs/bin/screen_blanker/uk.catkeys | 4 ++ data/catalogs/kits/locale/uk.catkeys | 21 +++++++- data/catalogs/kits/mail/uk.catkeys | 10 ++++ .../preferences/appearance/uk.catkeys | 9 +++- .../preferences/backgrounds/uk.catkeys | 3 +- .../catalogs/preferences/bluetooth/uk.catkeys | 3 +- .../preferences/cpufrequency/uk.catkeys | 5 +- .../preferences/datatranslations/uk.catkeys | 6 ++- data/catalogs/preferences/deskbar/uk.catkeys | 2 + .../catalogs/preferences/filetypes/uk.catkeys | 13 ++++- data/catalogs/preferences/fonts/uk.catkeys | 4 +- data/catalogs/preferences/keyboard/uk.catkeys | 3 +- data/catalogs/preferences/keymap/uk.catkeys | 3 +- data/catalogs/preferences/locale/uk.catkeys | 9 +++- data/catalogs/preferences/mail/uk.catkeys | 22 +++++++- data/catalogs/preferences/media/uk.catkeys | 3 +- data/catalogs/preferences/mouse/uk.catkeys | 4 +- data/catalogs/preferences/network/uk.catkeys | 4 +- .../preferences/notifications/uk.catkeys | 6 ++- data/catalogs/preferences/time/uk.catkeys | 3 +- data/catalogs/preferences/tracker/uk.catkeys | 2 + data/catalogs/servers/mail/uk.catkeys | 26 ++++++++++ data/catalogs/servers/mount/uk.catkeys | 5 +- .../tools/translation/inspector/uk.catkeys | 16 +++++- 84 files changed, 701 insertions(+), 88 deletions(-) create mode 100644 data/catalogs/add-ons/input_server/devices/keyboard/uk.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/uk.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_protocols/imap/uk.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/outbound_filters/fortune/uk.catkeys create mode 100644 data/catalogs/add-ons/screen_savers/flurry/uk.catkeys create mode 100644 data/catalogs/apps/3dmov/uk.catkeys create mode 100644 data/catalogs/apps/clock/uk.catkeys create mode 100644 data/catalogs/apps/glteapot/uk.catkeys create mode 100644 data/catalogs/apps/mandelbrot/uk.catkeys create mode 100644 data/catalogs/apps/musiccollection/uk.catkeys delete mode 100644 data/catalogs/apps/networktime/zh_hans.catkeys create mode 100644 data/catalogs/bin/desklink/uk.catkeys create mode 100644 data/catalogs/bin/screen_blanker/uk.catkeys create mode 100644 data/catalogs/kits/mail/uk.catkeys create mode 100644 data/catalogs/preferences/deskbar/uk.catkeys create mode 100644 data/catalogs/preferences/tracker/uk.catkeys create mode 100644 data/catalogs/servers/mail/uk.catkeys diff --git a/data/catalogs/add-ons/disk_systems/bfs/uk.catkeys b/data/catalogs/add-ons/disk_systems/bfs/uk.catkeys index f6fc5a7298..1328c198d0 100644 --- a/data/catalogs/add-ons/disk_systems/bfs/uk.catkeys +++ b/data/catalogs/add-ons/disk_systems/bfs/uk.catkeys @@ -1 +1,8 @@ -1 ukrainian application/x-vnd.Haiku-BFSAddOn 0 +1 ukrainian application/x-vnd.Haiku-BFSAddOn 1074880496 +1024 (Mostly small files) BFS_Initialize_Parameter 1024 (Найменші файли) +2048 (Recommended) BFS_Initialize_Parameter 2048 (Рекомендовано) +8192 (Mostly large files) BFS_Initialize_Parameter 8192 (Найбільші файли) +Blocksize: BFS_Initialize_Parameter Розмір блоків: +Disabling query support may speed up certain file system operations, but should only be used if one is absolutely certain that one will not need queries.\nAny volume that is intended for booting Haiku must have query support enabled. BFS_Initialize_Parameter Заборона підтримки , but should only be used if one is absolutely certain that one will not need queries.\nAny volume that is intended for booting Haiku must have query support enabled. +Enable query support BFS_Initialize_Parameter Дозвіл підтримку запитів +Name: BFS_Initialize_Parameter Ім'я: diff --git a/data/catalogs/add-ons/disk_systems/intel/uk.catkeys b/data/catalogs/add-ons/disk_systems/intel/uk.catkeys index c27baea2da..e7ddf7a60d 100644 --- a/data/catalogs/add-ons/disk_systems/intel/uk.catkeys +++ b/data/catalogs/add-ons/disk_systems/intel/uk.catkeys @@ -1 +1,2 @@ -1 ukrainian application/x-vnd.Haiku-IntelDiskAddOn 0 +1 ukrainian application/x-vnd.Haiku-IntelDiskAddOn 4191422532 +Active partition BFS_Creation_Parameter Активний розділ diff --git a/data/catalogs/add-ons/input_server/devices/keyboard/uk.catkeys b/data/catalogs/add-ons/input_server/devices/keyboard/uk.catkeys new file mode 100644 index 0000000000..883beeeb3a --- /dev/null +++ b/data/catalogs/add-ons/input_server/devices/keyboard/uk.catkeys @@ -0,0 +1,10 @@ +1 ukrainian x-vnd.Haiku-KeyboardInputServerDevice 2536418998 +(This team is a system component) Team monitor (Ця команда є системним компонентом) +Cancel Team monitor Відмінити +Force reboot Team monitor Примусове перезавантаження +If the application will not quit you may have to kill it. Team monitor If the application will not quit you may have to kill it. +Kill application Team monitor Вбити додаток +Quit application Team monitor Закрити додаток +Restart the desktop Team monitor Перезавантажити робочий стіл +Select an application from the list above and click one of the buttons 'Kill application' and 'Quit application' in order to close it.\n\nHold CONTROL+ALT+DELETE for %ld seconds to reboot. Team monitor Виберіть додаток зі списку нижче і клікніть на кнопки 'Вбити додаток' і 'Закрити додаток' у випадку закриття її.\n\nУтримуйте CONTROL+ALT+DELETE для перезавантаження через %ld секунд. +Team monitor Team monitor Монітор команд diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/uk.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/uk.catkeys new file mode 100644 index 0000000000..4137ea93db --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/uk.catkeys @@ -0,0 +1,15 @@ +1 ukrainian x-vnd.Haiku-MatchHeader 1205906732 + ConfigView <Вибір акаунта> + ConfigView <Вибір дії> +Delete message ConfigView Видалити повідомлення +If ConfigView Якщо +Move to ConfigView Перемістити до +Reply with ConfigView Відповісти з +Rule filter RuleFilter Фільтр правил +Set as read ConfigView Встановити як прочитані +Set flags to ConfigView Встановити флаги для +Then ConfigView Тоді +has ConfigView має +header (e.g. Subject) ConfigView заголовок (e.g. Subject) +this field is based on the action ConfigView це поле засноване на дії +value (use REGEX: in from of regular expressions like *spam*) ConfigView величина (використовуйте REGEX: в широкому розумінні *spam*) diff --git a/data/catalogs/add-ons/mail_daemon/inbound_protocols/imap/uk.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_protocols/imap/uk.catkeys new file mode 100644 index 0000000000..72be3fe457 --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_protocols/imap/uk.catkeys @@ -0,0 +1,9 @@ +1 ukrainian x-vnd.Haiku-IMAP 3892875357 +Apply IMAPFolderConfig Застосувати +Destination: imap_config Позамовчуванню: +Failed to fetch available storage. IMAPFolderConfig Призупинено отримання доступних масивів. +Fetching IMAP folders, have patience... IMAPFolderConfig Отримання папок IMAP, зачекайте ... +IMAP Folders IMAPFolderConfig Папки IMAP +IMAP Folders imap_config Папки IMAP +Subcribe / Unsuscribe IMAP folders, have patience... IMAPFolderConfig Підписка/відписка для папок IMAP , зачекайте... +status IMAPFolderConfig стан diff --git a/data/catalogs/add-ons/mail_daemon/outbound_filters/fortune/uk.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_filters/fortune/uk.catkeys new file mode 100644 index 0000000000..d16ce52916 --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/outbound_filters/fortune/uk.catkeys @@ -0,0 +1,4 @@ +1 ukrainian x-vnd.Haiku-Fortune 1292458430 +Fortune cookie says:\n\n ConfigView Куки Fortune кажуть:\n\n +Fortune file: ConfigView Файл Fortune: +Tag line: ConfigView Tag line: diff --git a/data/catalogs/add-ons/screen_savers/butterfly/uk.catkeys b/data/catalogs/add-ons/screen_savers/butterfly/uk.catkeys index d255845f7c..e6753a8bae 100644 --- a/data/catalogs/add-ons/screen_savers/butterfly/uk.catkeys +++ b/data/catalogs/add-ons/screen_savers/butterfly/uk.catkeys @@ -1 +1,2 @@ -1 ukrainian x-vnd.Haiku-ButterflyScreensaver 0 +1 ukrainian x-vnd.Haiku-ButterflyScreensaver 3604552753 +by Geoffry Song Screensaver Butterfly автор Geoffry Song diff --git a/data/catalogs/add-ons/screen_savers/debugnow/uk.catkeys b/data/catalogs/add-ons/screen_savers/debugnow/uk.catkeys index e1d7e8029b..2fa9ad7d73 100644 --- a/data/catalogs/add-ons/screen_savers/debugnow/uk.catkeys +++ b/data/catalogs/add-ons/screen_savers/debugnow/uk.catkeys @@ -1 +1,2 @@ -1 ukrainian x-vnd.Haiku-DebugNowScreensaver 0 +1 ukrainian x-vnd.Haiku-DebugNowScreensaver 822203648 +by Ryan Leavengood Screensaver DebugNow автор Ryan Leavengood diff --git a/data/catalogs/add-ons/screen_savers/flurry/uk.catkeys b/data/catalogs/add-ons/screen_savers/flurry/uk.catkeys new file mode 100644 index 0000000000..42d48aacd2 --- /dev/null +++ b/data/catalogs/add-ons/screen_savers/flurry/uk.catkeys @@ -0,0 +1,2 @@ +1 ukrainian x-vnd.Haiku-Flurry 3686556109 +Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/haiku/uk.catkeys b/data/catalogs/add-ons/screen_savers/haiku/uk.catkeys index cead9914bc..6aa474dc9f 100644 --- a/data/catalogs/add-ons/screen_savers/haiku/uk.catkeys +++ b/data/catalogs/add-ons/screen_savers/haiku/uk.catkeys @@ -1 +1,2 @@ -1 ukrainian x-vnd.Haiku-HaikuScreensaver 0 +1 ukrainian x-vnd.Haiku-HaikuScreensaver 1031480431 +by Marcus Overhagen Screensaver Haiku автор Marcus Overhagen diff --git a/data/catalogs/add-ons/screen_savers/icons/uk.catkeys b/data/catalogs/add-ons/screen_savers/icons/uk.catkeys index ec0d6c90e0..0f0f590384 100644 --- a/data/catalogs/add-ons/screen_savers/icons/uk.catkeys +++ b/data/catalogs/add-ons/screen_savers/icons/uk.catkeys @@ -1 +1,2 @@ -1 ukrainian x-vnd.Haiku-IconsScreensaver 0 +1 ukrainian x-vnd.Haiku-IconsScreensaver 3278763328 +by Vincent Duvert Screensaver Icons автор Vincent Duvert diff --git a/data/catalogs/add-ons/screen_savers/ifs/uk.catkeys b/data/catalogs/add-ons/screen_savers/ifs/uk.catkeys index 28db0f4066..d23e9361ea 100644 --- a/data/catalogs/add-ons/screen_savers/ifs/uk.catkeys +++ b/data/catalogs/add-ons/screen_savers/ifs/uk.catkeys @@ -1 +1,4 @@ -1 ukrainian x-vnd.Haiku-IFSScreensaver 0 +1 ukrainian x-vnd.Haiku-IFSScreensaver 1843903800 +Iterated Function System\n\n© 1997 Massimino Pascal\n\nxscreensaver port by Stephan Aßmus\n Screensaver IFS Iterated Function System\n\n© 1997 Massimino Pascal\n\nавтор портування Stephan Aßmus\n +Morphing speed: Screensaver IFS Швидкість морфізму: +Render dots additive Screensaver IFS Додатковий рендер точок diff --git a/data/catalogs/add-ons/screen_savers/message/uk.catkeys b/data/catalogs/add-ons/screen_savers/message/uk.catkeys index 0d2bd39432..fa47d82a18 100644 --- a/data/catalogs/add-ons/screen_savers/message/uk.catkeys +++ b/data/catalogs/add-ons/screen_savers/message/uk.catkeys @@ -1 +1,3 @@ -1 ukrainian x-vnd.Haiku-MessageScreensaver 0 +1 ukrainian x-vnd.Haiku-MessageScreensaver 854294461 +Insert clever anecdote or phrase here! Screensaver Message Вставте класний анекдот або фразу сюди! +by Ryan Leavengood Screensaver Message автор Ryan Leavengood diff --git a/data/catalogs/add-ons/tracker/zipomatic/uk.catkeys b/data/catalogs/add-ons/tracker/zipomatic/uk.catkeys index 10d2493985..a6496bb105 100644 --- a/data/catalogs/add-ons/tracker/zipomatic/uk.catkeys +++ b/data/catalogs/add-ons/tracker/zipomatic/uk.catkeys @@ -1,11 +1,13 @@ -1 ukrainian x-vnd.haiku.zip-o-matic 4030963969 +1 ukrainian x-vnd.haiku.zip-o-matic 2207848100 %ld files added. file:ZipOMaticWindow.cpp %ld файлів додано. +1 file added. file:ZipOMaticWindow.cpp Додано 1 файл. Archive file:ZipperThread.cpp Архів Archive created OK file:ZipOMaticWindow.cpp Архів успішно створений Are you sure you want to stop creating this archive? file:ZipOMaticWindow.cpp Ви впевнені, що хочете зупинити створення цього архіву? Continue file:ZipOMaticWindow.cpp Продовжити Creating archive: %s file:ZipOMaticWindow.cpp Створення архіву: %s Do you want to stop them? file:ZipOMatic.cpp Ви хочете зупинити це? +Drop files here. file:ZipOMaticWindow.cpp Перенесіть файли сюди. Error creating archive file:ZipOMaticWindow.cpp Помилка створення архіву Filename: %s file:ZipOMaticWindow.cpp Ім'я файлу: %s Let them continue file:ZipOMatic.cpp Нехай це продовжується diff --git a/data/catalogs/add-ons/translators/exr/uk.catkeys b/data/catalogs/add-ons/translators/exr/uk.catkeys index 0adca488c8..10e0564d42 100644 --- a/data/catalogs/add-ons/translators/exr/uk.catkeys +++ b/data/catalogs/add-ons/translators/exr/uk.catkeys @@ -1,8 +1,9 @@ -1 ukrainian x-vnd.Haiku-EXRTranslator 976342086 +1 ukrainian x-vnd.Haiku-EXRTranslator 3390292316 Based on OpenEXR (http://www.openexr.com) ConfigView Базоване на OpenEXR (http://www.openexr.com) EXR Images ConfigView Зображення EXR EXR Images EXRTranslator Зображення EXR EXR Settings main Настройки EXR +EXR image EXRTranslator Зображення EXR EXR image translator EXRTranslator Перетворювач зображень EXR Version %d.%d.%d, %s ConfigView Версія %d.%d.%d, %s a division of Lucasfilm Entertainment Company Ltd ConfigView відділення Lucasfilm Entertainment Company Ltd diff --git a/data/catalogs/add-ons/translators/gif/uk.catkeys b/data/catalogs/add-ons/translators/gif/uk.catkeys index 9346fd5a2d..34010d52e5 100644 --- a/data/catalogs/add-ons/translators/gif/uk.catkeys +++ b/data/catalogs/add-ons/translators/gif/uk.catkeys @@ -1,10 +1,15 @@ -1 ukrainian x-vnd.Haiku-GIFTranslator 2939496153 +1 ukrainian x-vnd.Haiku-GIFTranslator 829368084 +Automatic (from alpha channel) GIFView Автоматично (з альфа каналу) Be Bitmap Format (GIFTranslator) GIFTranslator Формат Be Bitmap (Перетворювач GIF) BeOS system GIFView Система BeOS Colors GIFView Кольори +GIF Settings GIFTranslator Настройки GIF GIF image GIFTranslator Зображення GIF -Greyscale GIFView сірий +Greyscale GIFView Сірий +Optimal GIFView Оптимальний +Palette GIFView Палітра Use RGB color GIFView Використовувати кольори RGB Use dithering GIFView Використовувати згладжування +Websafe GIFView Придатний для Web Write interlaced images GIFView Записати зображення, що переплітаються Write transparent images GIFView Записати прозорі зображення diff --git a/data/catalogs/add-ons/translators/hvif/uk.catkeys b/data/catalogs/add-ons/translators/hvif/uk.catkeys index 202cd12123..0c84817efa 100644 --- a/data/catalogs/add-ons/translators/hvif/uk.catkeys +++ b/data/catalogs/add-ons/translators/hvif/uk.catkeys @@ -1,6 +1,7 @@ -1 ukrainian x-vnd.Haiku-HVIFTranslator 1594129735 +1 ukrainian x-vnd.Haiku-HVIFTranslator 813066125 HVIF Settings HVIFMain Настройки HVIF HVIF icons HVIFTranslator Іконки HVIF +HVIFTranslator Settings HVIFTranslator Настройки перетворювача HVIFТ Native Haiku icon format translator HVIFView Перетворювач формату рідних векторних іконок Haiku Native Haiku vector icon translator HVIFTranslator Перетворювач рідних векторних іконок Haiku Render size: HVIFView Розмір рендера: diff --git a/data/catalogs/add-ons/translators/ico/uk.catkeys b/data/catalogs/add-ons/translators/ico/uk.catkeys index 73e7b17821..5bb485dd91 100644 --- a/data/catalogs/add-ons/translators/ico/uk.catkeys +++ b/data/catalogs/add-ons/translators/ico/uk.catkeys @@ -1,11 +1,14 @@ -1 ukrainian x-vnd.Haiku-ICOTranslator 2616402112 +1 ukrainian x-vnd.Haiku-ICOTranslator 3151213372 Cursor ICOTranslator Курсор Enforce valid icon sizes ConfigView Змусити доступні розміри іконок ICO Settings main Настройки ICO +ICOTranslator Settings ConfigView Настройки перетворювача ICO Icon ICOTranslator Іконка Valid icon sizes are 16, 32, or 48 ConfigView Доступні розміри іконок є 16, 32, або 48 Version %d.%d.%d, %s ConfigView Версія %d.%d.%d, %s +Windows %s %ld bit image ICOTranslator Вікна зображення %s %ld bit Windows icon images ConfigView Вікна зображень іконок Windows icon images ICOTranslator Вікна зображень іконки Windows icon translator ICOTranslator Перетворювач вікон іконок Write 32 bit images on true color input ConfigView Записати зображення 32 bit на вхід true color +pixels in either direction. ConfigView пікселів в кожному напрямку. diff --git a/data/catalogs/add-ons/translators/jpeg/uk.catkeys b/data/catalogs/add-ons/translators/jpeg/uk.catkeys index e93c4e4a1a..d7a713fce2 100644 --- a/data/catalogs/add-ons/translators/jpeg/uk.catkeys +++ b/data/catalogs/add-ons/translators/jpeg/uk.catkeys @@ -1,8 +1,10 @@ -1 ukrainian x-vnd.Haiku-JPEGTranslator 2438630007 +1 ukrainian x-vnd.Haiku-JPEGTranslator 965709535 About JPEGTranslator Про Be Bitmap Format (JPEGTranslator) JPEGTranslator Формат Be Bitmap (Перетворювач JPEG) High JPEGTranslator Високе JPEG Library Error: %s\n be_jerror Помилка бібліотеки JPEG: %s\n +JPEG Library Warning: %s\n be_jerror Попередження бібліотеки JPEG: %s\n +JPEG images JPEGTranslator Зображення JPEG Low JPEGTranslator Низьке Make file smaller (sligthtly worse quality) JPEGTranslator Зробити файл меньшим (можлива втрата якості) None JPEGTranslator Жоден @@ -12,5 +14,9 @@ Prevent colors 'washing out' JPEGTranslator попереджати втрату Read JPEGTranslator Читати Read greyscale images as RGB32 JPEGTranslator Читати сірі зображення як RGB32 Show warning messages JPEGTranslator Показувати попередження +Use CMYK code with 0 for 100% ink coverage JPEGTranslator Використовувати код CMYK 0 для 100% охоплення чорнила Use progressive compression JPEGTranslator Використовувати прогресивний зтиск +Write JPEGTranslator Записати Write black-and-white images as RGB24 JPEGTranslator Записувати чорно-білі зображення як RGB24 +©2002-2003, Marcin Konicki\n©2005-2007, Haiku\n\nBased on IJG library © 1994-2009, Thomas G. Lane, Guido Vollbeding.\n\thttp://www.ijg.org/files/\n\nwith \"lossless\" encoding support patch by Ken Murchison\n\thttp://www.oceana.com/ftp/ljpeg/\n\nWith some colorspace conversion routines by Magnus Hellman\n\thttp://www.bebits.com/app/802\n JPEGTranslator ©2002-2003, Marcin Konicki\n©2005-2007, Haiku\n\n На основі бібліотеки IJG © 1994-2009, Thomas G. Lane, Guido Vollbeding.\n\thttp://www.ijg.org/files/\n\nз заплаткою для \"lossless\" кодування Ken Murchison\n\thttp://www.oceana.com/ftp/ljpeg/\n\nЗ деякою зміною передачі кольору від Magnus Hellman\n\thttp://www.bebits.com/app/802\n + diff --git a/data/catalogs/add-ons/translators/jpeg2000/uk.catkeys b/data/catalogs/add-ons/translators/jpeg2000/uk.catkeys index cea87062bb..8f72190cf9 100644 --- a/data/catalogs/add-ons/translators/jpeg2000/uk.catkeys +++ b/data/catalogs/add-ons/translators/jpeg2000/uk.catkeys @@ -1,6 +1,13 @@ -1 ukrainian x-vnd.Haiku-JPEG2000Translator 3397102117 +1 ukrainian x-vnd.Haiku-JPEG2000Translator 547915409 About JPEG2000Translator Про Be Bitmap Format (JPEG2000Translator) JPEG2000Translator Be Bitmap Format (Перетворювач JPEG2000) +High JPEG2000Translator Висока +JPEG2000 images JPEG2000Translator Зображення JPEG2000 +Low JPEG2000Translator Низька Output only codestream (.jpc) JPEG2000Translator Виводити тільки кодовий потік (.jpc) Output quality JPEG2000Translator Якість вихідних +Read JPEG2000Translator Читати +Read greyscale images as RGB32 JPEG2000Translator Читати сірі зображення як RGB32 +Write JPEG2000Translator Записати Write black-and-white images as RGB24 JPEG2000Translator Записати чорно-білі зображення як RGB24 +©2002-2003, Shard\n©2005-2006, Haiku\n\nBased on JasPer library:\n© 1999-2000, Image Power, Inc. and\nthe University of British Columbia, Canada.\n© 2001-2003 Michael David Adams.\n\thttp://www.ece.uvic.ca/~mdadams/jasper/\n\nImageMagick's jp2 codec was used as \"tutorial\".\n\thttp://www.imagemagick.org/\n JPEG2000Translator ©2002-2003, Shard\n©2005-2006, Haiku\n\nБазоване на бібліотеці JasPer:\n© 1999-2000, Image Power, Inc. і\nуніверситету Британської Колумбії, Canada.\n© 2001-2003 Michael David Adams.\n\thttp://www.ece.uvic.ca/~mdadams/jasper/\n\nImageMagick's jp2 кодек був використаний як \"tutorial\".\n\thttp://www.imagemagick.org/\n diff --git a/data/catalogs/add-ons/translators/rtf/uk.catkeys b/data/catalogs/add-ons/translators/rtf/uk.catkeys index f689b33a18..823ee1beec 100644 --- a/data/catalogs/add-ons/translators/rtf/uk.catkeys +++ b/data/catalogs/add-ons/translators/rtf/uk.catkeys @@ -1,4 +1,9 @@ -1 ukrainian x-vnd.Haiku-RTFTranslator 2402784437 +1 ukrainian x-vnd.Haiku-RTFTranslator 526958155 +RTF Settings main Настройки RTF +RTF text files RTFTranslator Текстові файли RTF RTF-Translator Settings ConfigView Настройки Перетворювача RTF +Rich Text Format (RTF) files ConfigView Файли Rich Text Format (RTF) +Rich Text Format Translator RTFTranslator Перетворювач Rich Text Format Rich Text Format translator v%d.%d.%d %s RTFTranslator Перетворювач Rich Text Format v%d.%d.%d %s RichTextFormat file RTFTranslator Файл формату RichText +Version %d.%d.%d, %s ConfigView Версія %d.%d.%d, %s diff --git a/data/catalogs/add-ons/translators/tga/uk.catkeys b/data/catalogs/add-ons/translators/tga/uk.catkeys index b580cf8bfe..2c454c9390 100644 --- a/data/catalogs/add-ons/translators/tga/uk.catkeys +++ b/data/catalogs/add-ons/translators/tga/uk.catkeys @@ -1,8 +1,10 @@ -1 ukrainian x-vnd.Haiku-TGATranslator 1321391055 +1 ukrainian x-vnd.Haiku-TGATranslator 2221210336 Ignore TGA alpha channel TGAView Ігнорувати альфа канал TGA Save with RLE Compression TGAView Зберегти зі стиском RLE +TGA Settings TGAMain Настройки TGA TGA image translator TGATranslator Перетворювач зображеньTGA TGA images TGATranslator Зображення TGA +TGATranslator Settings TGATranslator Настройки Перетворювача TGA Targa image (%d bits RLE colormap) TGATranslator Зображення Targa (палітра кольорів RLE %d біт) Targa image (%d bits RLE gray) TGATranslator Зображення Targa (сіре RLE %d біт) Targa image (%d bits RLE truecolor) TGATranslator Зображення Targa (повнокольрове RLE %d біт) diff --git a/data/catalogs/apps/3dmov/uk.catkeys b/data/catalogs/apps/3dmov/uk.catkeys new file mode 100644 index 0000000000..ae6f54b6bc --- /dev/null +++ b/data/catalogs/apps/3dmov/uk.catkeys @@ -0,0 +1,2 @@ +1 ukrainian x-vnd.Haiku-3DMov 40426706 +3DMov System name 3D відео diff --git a/data/catalogs/apps/aboutsystem/uk.catkeys b/data/catalogs/apps/aboutsystem/uk.catkeys index b69649ce16..7af0bb24c0 100644 --- a/data/catalogs/apps/aboutsystem/uk.catkeys +++ b/data/catalogs/apps/aboutsystem/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-About 2326505773 +1 ukrainian x-vnd.Haiku-About 1133193730 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB заг. %d MiB used (%d%%) AboutView %d MiB викор. (%d%%) @@ -6,18 +6,65 @@ %ld Processors: AboutView %ld Процесори: %total MiB total, %inaccessible MiB inaccessible AboutView %total MiB заг., %inaccessible MiB недоступно ... and the many people making donations!\n\n AboutView ...і багатьом людям, що зробили внески!\n\n +2001 by Andy Ritger based on the Generalized Timing Formula AboutView 2001 by Andy Ritger based on the Generalized Timing Formula About this system AboutWindow Про цю систему +AboutSystem System name Про систему +BSD (2-clause) AboutView BSD (2-clause) +BSD (3-clause) AboutView BSD (3-clause) +BSD (4-clause) AboutView BSD (4-clause) Be Inc. and its developer team, for having created BeOS!\n\n AboutView Be Inc. і команді розробників, за створення BeOS!\n\n +Contains software developed by the NetBSD Foundation, Inc. and its contributors:\nftp, tput\nCopyright © 1996-2008 The NetBSD Foundation, Inc. All rights reserved. AboutView Містить програмне забезпечення NetBSD Foundation, Inc. і її контрибуторів:\nftp, tput\nCopyright © 1996-2008 NetBSD Foundation, Inc. Всі права застережені. +Contains software from the FreeBSD Project, released under the BSD license:\ncal, ftpd, ping, telnet, telnetd, traceroute\nCopyright © 1994-2008 The FreeBSD Project. All rights reserved. AboutView Містить програмне забезпечення проекту FreeBSD , зреалізоване під ліцензією BSD:\ncal, ftpd, ping, telnet, telnetd, traceroute\nCopyright © 1994-2008 Проект FreeBSD . Всі права застережені. +Contains software from the GNU Project, released under the GPL and LGPL licenses:\nGNU C Library, GNU coretools, diffutils, findutils, sharutils, gawk, bison, m4, make, gdb, wget, ncurses, termcap, Bourne Again Shell.\nCopyright © The Free Software Foundation. AboutView Містить програмне забезпечення проекту GNU , реалізоване під ліцензіями GPL і LGPL licenses:\nGNU C Library, GNU coretools, diffutils, findutils, sharutils, gawk, bison, m4, make, gdb, wget, ncurses, termcap, Bourne Again Shell.\nCopyright © The Free Software Foundation. Contributors:\n AboutView Співробітники:\n +Copyright © 1987-1988 Digital Equipment Corporation, Maynard, Massachusetts.\nAll rights reserved. AboutView Copyright © 1987-1988 Digital Equipment Corporation, Maynard, Massachusetts.\nВсі права застережені. +Copyright © 1990-2002 Info-ZIP. All rights reserved. AboutView Copyright © 1990-2002 Info-ZIP. Всі права застережені. +Copyright © 1990-2003 Wada Laboratory, the University of Tokyo. AboutView Copyright © 1990-2003 Wada Laboratory, університет Токіо. +Copyright © 1991-2000 Silicon Graphics, Inc. SGI's Software FreeB license. All rights reserved. AboutView Copyright © 1991-2000 Silicon Graphics, Inc. Ліцензія SGI's Software FreeB. Всі права застережені. +Copyright © 1994-1997 Mark Kilgard. All rights reserved. AboutView Copyright © 1994-1997 Mark Kilgard. Всі права застережені. +Copyright © 1994-2008 Xiph.Org. All rights reserved. AboutView Copyright © 1994-2008 Xiph.Org. Всі права застережені. +Copyright © 1994-2009, Thomas G. Lane, Guido Vollbeding. This software is based in part on the work of the Independent JPEG Group. AboutView Copyright © 1994-2009, Thomas G. Lane, Guido Vollbeding. Це програмне забезпечення базується на роботах Independent JPEG Group. +Copyright © 1995, 1998-2001 Jef Poskanzer. All rights reserved. AboutView Copyright © 1995, 1998-2001 Jef Poskanzer. Всі права застережені. +Copyright © 1995-2001 Lars Düning. All rights reserved. AboutView Copyright © 1995-2001 Lars Düning. Всі права застережені. +Copyright © 1995-2004 Jean-loup Gailly and Mark Adler. AboutView Copyright © 1995-2004 Jean-loup Gailly і Mark Adler. +Copyright © 1996-1997 Jeff Prosise. All rights reserved. AboutView Copyright © 1996-1997 Jeff Prosise. Всі права застережені. +Copyright © 1996-2005 Julian R Seward. All rights reserved. AboutView Copyright © 1996-2005 Julian R Seward. Всі права застережені. +Copyright © 1997-2006 PDFlib GmbH and Thomas Merz. All rights reserved.\nPDFlib and PDFlib logo are registered trademarks of PDFlib GmbH. AboutView Copyright © 1997-2006 PDFlib GmbH і Thomas Merz. Всі права застережені.\nPDFlib і логотип PDFlib є зареєстрованими торговими марками PDFlib GmbH. +Copyright © 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper. AboutView Copyright © 1998-2000 Thai Open Source Software Center Ltd і Clark Cooper. +Copyright © 1998-2003 Daniel Veillard. All rights reserved. AboutView Copyright © 1998-2003 Daniel Veillard. Всі права застережені. + +Copyright © 1999-2000 Y.Takagi. All rights reserved. AboutView Copyright © 1999-2000 Y.Takagi. Всі права застережені. +Copyright © 1999-2006 Brian Paul. Mesa3D Project. All rights reserved. AboutView Copyright © 1999-2006 Brian Paul. Проект Mesa3D. Всі права застережені. +Copyright © 1999-2007 Michael C. Ring. All rights reserved. AboutView Copyright © 1999-2007 Michael C. Ring. Всі права застережені. +Copyright © 1999-2010 by the authors of Gutenprint. All rights reserved. AboutView Copyright © 1999-2010 авторів програми Gutenprint. Всі права застережені. +Copyright © 2000 Jean-Pierre ervbefeL and Remi Lefebvre. AboutView Copyright © 2000 Jean-Pierre ervbefeL і Remi Lefebvre. +Copyright © 2000-2007 Fabrice Bellard, et al. AboutView Copyright © 2000-2007 Fabrice Bellard, та інші. +Copyright © 2001-2002 Thomas Broyer, Charlie Bozeman and Daniel Veillard. All rights reserved. AboutView Copyright © 2001-2002 Thomas Broyer, Charlie Bozeman і Daniel Veillard. Всі права застережені. +Copyright © 2001-2003 Expat maintainers. AboutView Copyright © 2001-2003 Розробники Expat. +Copyright © 2002-2003 Steve Lhomme. All rights reserved. AboutView Copyright © 2002-2003 Steve Lhomme. Всі права застережені. +Copyright © 2002-2004 Vivek Mohan. All rights reserved. AboutView Copyright © 2002-2004 Vivek Mohan. Всі права застережені. +Copyright © 2002-2005 Industrial Light & Magic, a division of Lucas Digital Ltd. LLC. AboutView Copyright © 2002-2005 Industrial Light & Magic, і відділення Lucas Digital Ltd. LLC. +Copyright © 2002-2006 Maxim Shemanarev (McSeem). AboutView Copyright © 2002-2006 Maxim Shemanarev (McSeem). +Copyright © 2002-2008 Alexander L. Roshal. All rights reserved. AboutView Copyright © 2002-2008 Alexander L. Roshal. Всі права застережені. +Copyright © 2003 Peter Hanappe and others. AboutView Copyright © 2003 Peter Hanappe і інші. +Copyright © 2003-2006 Intel Corporation. All rights reserved. AboutView Copyright © 2003-2006 Intel Corporation. Всі права застережені. +Copyright © 2004-2005 Intel Corporation. All rights reserved. AboutView Copyright © 2004-2005 Intel Corporation. Всі права застережені. +Copyright © 2006-2007 Intel Corporation. All rights reserved. AboutView Copyright © 2006-2007 Intel Corporation. Всі права застережені. +Copyright © 2007 Ralink Technology Corporation. All rights reserved. AboutView Copyright © 2007 Ralink Technology Corporation. Всі права застережені. +Copyright © 2007-2009 Marvell Semiconductor, Inc. All rights reserved. AboutView Copyright © 2007-2009 Marvell Semiconductor, Inc. Всі права застережені. +Copyright © 2010-2011 Google Inc. All rights reserved. AboutView Copyright © 2010-2011 Google Inc. Всі права застережені. Current maintainers:\n AboutView Розробники:\n GCC %d Hybrid AboutView GCC %d гібрид Google & their Google Summer of Code program\n AboutView Google і їхній програмі Google Summer of Code\n Kernel: AboutView Ядро: License: AboutView Ліцензія: Licenses: AboutView Ліцензії: +MIT (no promotion) AboutView MIT (без підтримки) +MIT license. All rights reserved. AboutView Ліцензія MIT. Всі права застережені. Memory: AboutView Пам’ять: Michael Phipps (project founder)\n\n AboutView Michael Phipps (засновнику проекту)\n\n Past maintainers:\n AboutView Попередні розробники:\n +Portions of this software are copyright. Copyright © 1996-2006 The FreeType Project. All rights reserved. AboutView Це програмне забезпечення захищене авторськими правами. Copyright © 1996-2006 Проект FreeType . Всі права застережені. Processor: AboutView Процесор: Revision AboutView Ревізія Source Code: AboutView Код: @@ -25,7 +72,8 @@ The BeGeistert team\n AboutView Команді BeGeistert\n The Haiku-Ports team\n AboutView Команді Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Команді Haikuware з їхньою програмою заохочень\n The University of Auckland and Christof Lutteroth\n\n AboutView Університету Окленда і Крістофу Люттероту\n\n -The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT licence%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView Код що є унікальним для Haiku, особливо ядро і весь код, що додатки можуть використовувати, поширюються за умовами %MIT licence%. Деякі системні бібліотеки містять другорядні частини коду під ліцензією LGPL. Ви можете знайти авторські права цих частин нижче.\n\n +The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Код є унікальним для Haiku, особливо ядро і коди всіх додатків, котрі згадуються, поширюються за умовами ліцензії MIT. Деякі системні бібліотеки містять вторинні частини коду, що поширюються під умовами ліцензії LGPL. Авторські права дивись нижче.\n\n +The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku® and the HAIKU logo® are registered trademarks of Haiku, Inc.\n\n AboutView Авторські права коду Haiku є власністю Haiku, Inc. або сторонніх авторів про що згадується в коді. Haiku® і лого HAIKU ® є зареєстрованою торговою маркою Haiku, Inc.\n\n Time running: AboutView Час роботи: Translations:\n AboutView Переклади:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (і ядро його NewOS)\n diff --git a/data/catalogs/apps/activitymonitor/uk.catkeys b/data/catalogs/apps/activitymonitor/uk.catkeys index 912c4054b7..ecc2e68813 100644 --- a/data/catalogs/apps/activitymonitor/uk.catkeys +++ b/data/catalogs/apps/activitymonitor/uk.catkeys @@ -1,9 +1,10 @@ -1 ukrainian x-vnd.Haiku-ActivityMonitor 3373427116 +1 ukrainian x-vnd.Haiku-ActivityMonitor 3704566709 %.1f KB/s DataSource %.1f KB/іек %.1f MB DataSource %.1f MB %.1f faults/s DataSource %.1f помилок/сек %lld ms SettingsWindow %lld мілісек. %lld sec. SettingsWindow %lld сек. +ActivityMonitor System name Монітор активності Add graph ActivityWindow Додати графік Additional items ActivityView Додаткові елементи Apps DataSource Додатки @@ -26,6 +27,7 @@ Page faults DataSource Помилки на сторінці Ports DataSource Порти Quit ActivityWindow Вийти RX DataSource Shorter version for Receiving. RX +Raw clipboard DataSource Буфер обміну Receiving DataSource Отримання Remove graph ActivityView Видалити графік Running applications DataSource Запущені додатки @@ -39,6 +41,7 @@ Swap DataSource Підкачка Swap space DataSource Розмір підкачки TX DataSource Shorter version for Sending TX Teams DataSource Команди +Text clipboard DataSource Буфер обміну тексту Threads DataSource Потоки Update time interval: SettingsWindow Інтервал часу поновлення: Used memory DataSource Використана пам'ять diff --git a/data/catalogs/apps/bootmanager/uk.catkeys b/data/catalogs/apps/bootmanager/uk.catkeys index 11acd43d41..c453be01c1 100644 --- a/data/catalogs/apps/bootmanager/uk.catkeys +++ b/data/catalogs/apps/bootmanager/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-BootManager 2981479428 +1 ukrainian x-vnd.Haiku-BootManager 3014946856 About to restore the Master Boot Record (MBR) of %disk from %file. Do you wish to continue? BootManagerController Don't translate the place holders: %disk and %file Про відновлення MBR %disk з %file. Ви дійсно бажаєте продовжити? About to write the boot menu to disk. Are you sure you want to continue? BootManagerController Про запис бутменю на диск. Ви дійсно бажаєте продовжити? About to write the following boot menu to the boot disk (%s). Please verify the information below before continuing. BootManagerController Про запис бутменю до загрузочного диску (%s). Перевірте інформацію перед продовженням. @@ -13,10 +13,11 @@ At least one partition must be selected! BootManagerController Принаймн Back BootManagerController Button Назад Backup Master Boot Record BootManagerController Title Відновлення основного загрузочного запису Boot Manager is unable to read the partition table! BootManagerController Завантажувач не зміг прочитати таблицю розділів! +BootManager System name Завантажувач Cannot access! DrivesPage Cannot install В доступі заборонено! Default Partition DefaultPartitionPage Title Розділ по замовчуванню Default Partition: DefaultPartitionPage Menu field label Розділ по замовчуванню: -Done BootManagerController Button Зроблено +Done BootManagerController Button Готово Drives DrivesPage Title Пристрої Error reading partition table BootManagerController Title Помилка при читанні таблиці розділів File: FileSelectionPage Text control label Файл: @@ -34,6 +35,8 @@ Old Master Boot Record saved BootManagerController Title Збереження с Partition table not compatible BootManagerController Title Таблиця розділів несумісна Partitions DefaultPartitionPage Pop up menu title Розділи Partitions PartitionsPage Title Розділи +Please locate the Master Boot Record (MBR) save file to restore from. This is the file that was created when the boot manager was first installed. BootManagerController Будь-ласка виберіть файл з якого відновлюватиметься MBR. Це файл, що було створено при першому встановленні завантажувача. +Please locate the Master Boot Record (MBR) save file to restore from. This is the file that was created when the boot manager was first installed. UninstallPage Виберіть файл з якого треба провести відновлення MBR. Цей файл було створено при першому встановленні завантажувача. Please select the drive you want the boot manager to be installed to or uninstalled from. DrivesPage Виберіть пристрій на який треба встановити або з якого треба видалити завантажувач. Please specify a default partition and a timeout.\nThe boot menu will load the default partition after the timeout unless you select another partition. You can also have the boot menu wait indefinitely for you to select a partition.\nKeep the 'ALT' key pressed to disable the timeout at boot time. DefaultPartitionPage Визначте розділ по замовчуванню і затримку.\nБутменю загрузить розділ по замовчуванню після затримки, якщо Ви не вкажете іншого розділу. Ви також можете встановити невизначене очікування для вибраного Вами розділу.\nУтримуйте клавішу 'ALT' для невілювання затримки під час завантаження. Previous WizardView Button Попереднє @@ -41,7 +44,11 @@ Quit DrivesPage Button Вийти Restore MBR BootManagerController Button Відновлення MBR Select FileSelectionPage Button Вибрати Summary BootManagerController Title Підсумок +The Master Boot Record (MBR) of the boot device:\n\t%s\nwill now be saved to disk. Please select a file to save the MBR into.\n\nIf something goes wrong with the installation or if you later wish to remove the boot menu, simply run the bootman program and choose the 'Uninstall' option. BootManagerController Основний загрузочний запис (MBR) загрузочного пристрою:\n\t%s\nзараз буде збережено на диск. Виберіть файл для збереження MBR.\n\nКоли під час встановлення щось піде не так або Ви бажатимете видалити бутменю просто запустіть програму завантажувача і виберіть опцію 'Uninstall'. The Master Boot Record could not be restored! BootManagerController Основний загрузочний запис неможливо відновити! +The Master Boot Record of the boot device (%DISK) has been successfully restored from %FILE. BootManagerController Основний загрузочний запис пристрою (%DISK) був успішно відновлений з %FILE. +The boot manager has been successfully installed on your system. BootManagerController Завантажувач успішно встановлений на Вашу систему. +The following partitions were detected. Please check the box next to the partitions to be included in the boot menu. You can also set the names of the partitions as you would like them to appear in the boot menu. PartitionsPage Були знайдені наступні розділи. Відмітьте які з них треба включити до загрузочного меню. Ви також можете обрати імена розділів за вашим смаком, які буде видно при відображення бутменю на екрані. The old Master Boot Record could not be saved to %s BootManagerController Старий MBR не було збережено до %s The old Master Boot Record was successfully saved to %s. BootManagerController Старий MBR успішно збережено в %s. The partition table of the first hard disk is not compatible with Boot Manager.\nBoot Manager needs 2 KB available space before the first partition. BootManagerController Таблиця розділів першого жорсткого диску несумісна з Завантажувачем.\nЗавантажувач потребує 2 KB вільного простору до першого розділу. @@ -53,5 +60,6 @@ Uninstall boot manager BootManagerController Title Видалити завант Uninstallation of boot menu completed BootManagerController Title Видалення бутменю завершене Uninstallation of boot menu failed BootManagerController Title Видалення бутменю призупинено Unknown LegacyBootMenu Text is shown for an unknown partition type Невідомий +Unnamed %d LegacyBootMenu Default name of a partition whose name could not be read from disk; characters in codepage 437 are allowed only Неназваний %d Update DrivesPage Button Обновити Write boot menu BootManagerController Button Записати бутменю diff --git a/data/catalogs/apps/cdplayer/uk.catkeys b/data/catalogs/apps/cdplayer/uk.catkeys index a15666e781..8efcb5269f 100644 --- a/data/catalogs/apps/cdplayer/uk.catkeys +++ b/data/catalogs/apps/cdplayer/uk.catkeys @@ -1,6 +1,8 @@ -1 ukrainian x-vnd.Haiku-CDPlayer 2145467092 +1 ukrainian x-vnd.Haiku-CDPlayer 592310631 Audio CD CDPlayer Аудіо CD +CD CDPlayer CD CD drive is empty CDPlayer CD пристрій пустий +CDPlayer System name Програвач CD Disc: %ld:%.2ld / %ld:%.2ld CDPlayer Диск: %ld:%.2ld / %ld:%.2ld Disc: --:-- / --:-- CDPlayer Диск: --:-- / --:-- Disc: 88:88 / 88:88 CDPlayer Диск: 88:88 / 88:88 diff --git a/data/catalogs/apps/charactermap/uk.catkeys b/data/catalogs/apps/charactermap/uk.catkeys index 9eb2d66ce2..84ab1c4025 100644 --- a/data/catalogs/apps/charactermap/uk.catkeys +++ b/data/catalogs/apps/charactermap/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-CharacterMap 2687645748 +1 ukrainian x-vnd.Haiku-CharacterMap 4082916013 Aegean numbers UnicodeBlocks Егейські номери Alphabetic presentation forms UnicodeBlocks Алфавітні форми презентацій Ancient Greek musical notation UnicodeBlocks Давньогрецький нотний запис @@ -7,6 +7,7 @@ Ancient smbols UnicodeBlocks Давні символи Arabic UnicodeBlocks Арабська Arabic presentation forms A UnicodeBlocks Арабські форми презентацій А Arabic presentation forms B UnicodeBlocks Арабська форма B +Arabic supplement UnicodeBlocks Доповнення до арабської Armenian UnicodeBlocks Вірменська Arrows UnicodeBlocks Стрілки Balinese UnicodeBlocks Балійська @@ -22,6 +23,9 @@ Buhid UnicodeBlocks Бухід Byzantine musical symbols UnicodeBlocks Візантійські музичні символи CJK compatibility UnicodeBlocks CJK сумісність CJK compatibility forms UnicodeBlocks Форми CJK сумісності +CJK compatibility ideographs UnicodeBlocks Сумісні ієрогліфи CJK +CJK compatibility ideographs Supplement UnicodeBlocks Доповнення CJK-суміснісних ієрогліфів +CJK radicals supplement UnicodeBlocks Доповнення CJK радикалів CJK strokes UnicodeBlocks CJK наголоси CJK symbols and punctuation UnicodeBlocks CJK символи і знаки пунктуації CJK unified ideographs UnicodeBlocks CJK єдині ієрогліфи @@ -29,6 +33,7 @@ CJK unified ideographs extension A UnicodeBlocks CJK єдине розшире CJK unified ideographs extension B UnicodeBlocks CJK єдиного розширення ієрогліфів B Carian UnicodeBlocks Каріан Cham UnicodeBlocks Чам +CharacterMap System name CharacterMap Cherokee UnicodeBlocks Черокі Clear CharacterWindow Очистити Code CharacterWindow Код @@ -38,10 +43,13 @@ Combining diacritical marks supplement UnicodeBlocks Об'єднуючі доп Combining half marks UnicodeBlocks Об'єднуючі половини знаків Control pictures UnicodeBlocks Управління фотографіями Coptic UnicodeBlocks Коптська +Copy as escaped byte string CharacterView Копіювати як пусту стрічку +Copy character CharacterView Копіювати символ Counting rod numerals UnicodeBlocks Підрахунок стрижня цифр Cuneiform UnicodeBlocks Клинопис Cuneiform numbers and punctuation UnicodeBlocks Клинописні цифри і знаки пунктуації Currency symbols UnicodeBlocks Символи валют +Cypriot syllabary UnicodeBlocks Складові кіпрської Cyrillic UnicodeBlocks Кирилиця Cyrillic extended A UnicodeBlocks Кирилиця розширена А Cyrillic extended B UnicodeBlocks Розширення кирилиці B @@ -62,7 +70,7 @@ Font size: CharacterWindow Розмір шрифту: General punctuation UnicodeBlocks Знаки пунктуації Geometric shapes UnicodeBlocks Геометричні форми Georgian UnicodeBlocks Грузинська -Georgian supplement UnicodeBlocks Грузинська додаток +Georgian supplement UnicodeBlocks Грузинська варіант Glagotic UnicodeBlocks Глаготік Gothic UnicodeBlocks Готична Greek and Coptic UnicodeBlocks Грецька і коптська @@ -79,6 +87,7 @@ Hiragana UnicodeBlocks Хірагана IPA extensions UnicodeBlocks Розширення IPA Ideographic description characters UnicodeBlocks Символи ідеографічного опису Kanbun UnicodeBlocks Канбун +Kangxi radicals UnicodeBlocks Радикали Кангксі Kannada UnicodeBlocks Каннада Katakana UnicodeBlocks Катакана Katakana phonetic extensions UnicodeBlocks Фонетичні розширення катакани @@ -91,7 +100,8 @@ Latin extended A UnicodeBlocks Розширена латиниця Latin extended B UnicodeBlocks Розширена латиниця B Latin extended C UnicodeBlocks Розширена латиниця C Latin extended D UnicodeBlocks Розширена латиниця D -Latin-1 supplement UnicodeBlocks Латинська-1 додаток +Latin extended additional UnicodeBlocks Розширена додаткова латиниця +Latin-1 supplement UnicodeBlocks Латинська-1 варіант Lepcha UnicodeBlocks Лепха Letterlike symbols UnicodeBlocks Буквоподібні символи Limbu UnicodeBlocks Лімбу @@ -114,7 +124,7 @@ Muscial symbols UnicodeBlocks Muscial символи Myanmar UnicodeBlocks М'янми N'Ko UnicodeBlocks Нко New Tai Lue UnicodeBlocks Нові Тай Лю -Number forms UnicodeBlocks Кількість форм +Number forms UnicodeBlocks Форми цифр Ogham UnicodeBlocks Огам Ol Chiki UnicodeBlocks Ол Чікі Old Persian UnicodeBlocks Староперська @@ -160,9 +170,12 @@ Thai UnicodeBlocks Тайська Tibetan UnicodeBlocks Тибетська Tifinagh UnicodeBlocks Тіфінаг Ugaritic UnicodeBlocks Угаритська +Unified Canadian Aboriginal syllabics UnicodeBlocks Єдина складова канадських аборигенів Vai UnicodeBlocks Ваі Variation selectors UnicodeBlocks Селектори зміни +Variation selectors supplement UnicodeBlocks Доповнення змінних селекторів Vertical forms UnicodeBlocks Вертикальні форми View CharacterWindow Вигляд Yi Radicals UnicodeBlocks Ї Радикали +Yi syllables UnicodeBlocks Склади Yi Yijing hexagram symbols UnicodeBlocks Гексаграмні символи Yijing diff --git a/data/catalogs/apps/clock/uk.catkeys b/data/catalogs/apps/clock/uk.catkeys new file mode 100644 index 0000000000..9e2fb9c5ac --- /dev/null +++ b/data/catalogs/apps/clock/uk.catkeys @@ -0,0 +1,2 @@ +1 ukrainian x-vnd.Haiku-Clock 1361795373 +Clock System name Годинник diff --git a/data/catalogs/apps/codycam/be.catkeys b/data/catalogs/apps/codycam/be.catkeys index b391a88d58..df9c624962 100644 --- a/data/catalogs/apps/codycam/be.catkeys +++ b/data/catalogs/apps/codycam/be.catkeys @@ -17,7 +17,7 @@ Capture Rate Menu CodyCam Меню частаты захвату Capture controls CodyCam Кіраванне захватам Capturing Image… VideoConsumer.cpp Захват выявы... Closing the window\n VideoConsumer.cpp Закрываю акно\n -CodyCam Application name Камера +CodyCam System name Камера Connected… VideoConsumer.cpp Падключаны... Couldn't find requested directory on server VideoConsumer.cpp Немагчыма знайсці запрошаны каталёг на серверы Directory: CodyCam Каталёг: diff --git a/data/catalogs/apps/codycam/ru.catkeys b/data/catalogs/apps/codycam/ru.catkeys index 435cff05e7..cdbd9e7e05 100644 --- a/data/catalogs/apps/codycam/ru.catkeys +++ b/data/catalogs/apps/codycam/ru.catkeys @@ -17,7 +17,7 @@ Capture Rate Menu CodyCam Меню периодичности захвата Capture controls CodyCam Настройки захвата Capturing Image… VideoConsumer.cpp Захват изображения… Closing the window\n VideoConsumer.cpp Закрытие окна\n -CodyCam Application name Вебкамера +CodyCam System name Вебкамера Connected… VideoConsumer.cpp Подключен… Couldn't find requested directory on server VideoConsumer.cpp Невозможно найти запрашиваемый каталог на сервере Directory: CodyCam Каталог: diff --git a/data/catalogs/apps/codycam/sv.catkeys b/data/catalogs/apps/codycam/sv.catkeys index 0cb05ef207..b3c4382ec9 100644 --- a/data/catalogs/apps/codycam/sv.catkeys +++ b/data/catalogs/apps/codycam/sv.catkeys @@ -17,7 +17,7 @@ Capture Rate Menu CodyCam Bildfrekvensmeny Capture controls CodyCam Inhämtningsinställningar Capturing Image… VideoConsumer.cpp Fångar bild… Closing the window\n VideoConsumer.cpp Stänger fönstret\n -CodyCam Application name CodyKamera +CodyCam System name CodyKamera Connected… VideoConsumer.cpp Ansluen... Couldn't find requested directory on server VideoConsumer.cpp Kunde inte hitta den begärda katalogen på servern Directory: CodyCam Katalog: diff --git a/data/catalogs/apps/codycam/uk.catkeys b/data/catalogs/apps/codycam/uk.catkeys index 243358eff4..8a8bce142a 100644 --- a/data/catalogs/apps/codycam/uk.catkeys +++ b/data/catalogs/apps/codycam/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku.CodyCam 719498491 +1 ukrainian x-vnd.Haiku.CodyCam 441085909 Can't find an available connection to the video window CodyCam Неможливо знайти доступне вікно відео Cannot connect the video source to the video window CodyCam Неможливо підключити відео джерело до відео вікна Cannot create a video window CodyCam Неможливо створити вікно відео @@ -8,6 +8,7 @@ Cannot find the media roster CodyCam Неможливо знайти медіа Cannot get a time source CodyCam Неможливо отримати тривалість Cannot register the video window CodyCam Неможливо зареєструвати вікно відео Cannot seek time source! CodyCam Неможливо звернутися до лічильника часу! +Cannot set the time source for the video source CodyCam Неможливо встановити лічильник для джерела відео Cannot set the time source for the video window CodyCam Неможливо встановити лічильник для відео вікна Cannot start the video source CodyCam Неможливо запустити джерело відео Cannot start the video window CodyCam Неможливо запустити вікно відео @@ -16,6 +17,7 @@ Capture Rate Menu CodyCam Меню періодичності захоплен Capture controls CodyCam Керування захопленням Capturing Image… VideoConsumer.cpp Захоплення зображення… Closing the window\n VideoConsumer.cpp Закриття вікна\n +CodyCam System name CodyCam Connected… VideoConsumer.cpp Підключення… Couldn't find requested directory on server VideoConsumer.cpp Неможливо знайти очікуваний каталог на сервері Directory: CodyCam Каталог: @@ -45,6 +47,7 @@ File transmission failed VideoConsumer.cpp Передача файлу приз Format: CodyCam Формат: Image Format Menu CodyCam Меню формата зображення JPEG image CodyCam Зображення JPEG +Last Capture: VideoConsumer.cpp Останнє захоплення: Local CodyCam Локальний Locking the window\n VideoConsumer.cpp Закриття вікна\n Logging in… VideoConsumer.cpp Авторизація… @@ -71,6 +74,7 @@ Type: CodyCam Тип: Video settings CodyCam Налаштування відео Waiting… CodyCam Очікування… capture rate expected CodyCam вкажіть періодичність захоплення +cmd: '%s'\n FtpClient команда: '%s'\n destination directory expected CodyCam вкажіть папку призначення image file format expected CodyCam вкажіть формат зображення invalid upload client %ld\n VideoConsumer.cpp неналежний клієнт вивантаження %ld\n diff --git a/data/catalogs/apps/deskbar/uk.catkeys b/data/catalogs/apps/deskbar/uk.catkeys index 51c1cb28fa..b1e221ca0d 100644 --- a/data/catalogs/apps/deskbar/uk.catkeys +++ b/data/catalogs/apps/deskbar/uk.catkeys @@ -1,12 +1,19 @@ -1 ukrainian x-vnd.Be-TSKB 900486640 +1 ukrainian x-vnd.Be-TSKB 4265681964 BeMenu <Папка Ве пуста> +About this system BeMenu Про систему Always on top PreferencesWindow Завжди зверху +Applications B_USER_DESKBAR_DIRECTORY/Applications Додатки Applications PreferencesWindow Додатки +Auto-hide PreferencesWindow Автозникнення Auto-raise PreferencesWindow Автоспливання Change time… TimeView Змінити час… Clock PreferencesWindow Годинник Close all WindowMenu Закрити все +Demos B_USER_DESKBAR_DIRECTORY/Demos Демо +Deskbar System name Deskbar +Deskbar preferences PreferencesWindow Налаштування Deskbar Deskbar preferences… BeMenu Налаштування Deskbar… +Desktop applets B_USER_DESKBAR_DIRECTORY/Desktop applets Аплети екрану Edit menu… PreferencesWindow Редагувати меню… Expand new applications PreferencesWindow Розпакувати нові додатки Find… BeMenu Знайти… @@ -16,6 +23,7 @@ Menu PreferencesWindow Меню Mount BeMenu Змонтувати No windows WindowMenu Немає вікон Power off BeMenu Вимкнути +Preferences B_USER_DESKBAR_DIRECTORY/Preferences Настройки Quit application WindowMenu Вийти з додатку Recent applications BeMenu Недавні додатки Recent applications: PreferencesWindow Недавні додатки: diff --git a/data/catalogs/apps/deskcalc/uk.catkeys b/data/catalogs/apps/deskcalc/uk.catkeys index 8de9ab55e6..4290a6f682 100644 --- a/data/catalogs/apps/deskcalc/uk.catkeys +++ b/data/catalogs/apps/deskcalc/uk.catkeys @@ -1,4 +1,5 @@ -1 ukrainian x-vnd.Haiku-DeskCalc 1432606073 +1 ukrainian x-vnd.Haiku-DeskCalc 2547506672 Audio Feedback CalcView Озвучка віддачі +DeskCalc System name Калькулятор Enable Num Lock on startup CalcView Включати Num Lock при запуску Show keypad CalcView Показати клавіатуру diff --git a/data/catalogs/apps/devices/uk.catkeys b/data/catalogs/apps/devices/uk.catkeys index fc5d378359..04290a07d2 100644 --- a/data/catalogs/apps/devices/uk.catkeys +++ b/data/catalogs/apps/devices/uk.catkeys @@ -1,36 +1,73 @@ -1 ukrainian x-vnd.Haiku-Devices 197304729 +1 ukrainian x-vnd.Haiku-Devices 1943893993 +ACPI Information DeviceACPI Інформація про ACPI +ACPI Processor Namespace '%2' DeviceACPI Місце імені процесора ACPI '%2' +ACPI System Bus DeviceACPI Шина системи ACPI +ACPI System Indicator DeviceACPI Індикатор системи ACPI +ACPI Thermal Zone DeviceACPI Теплова зона ACPI +ACPI bus Device Шина ACPI +ACPI bus DevicesView ШинаACPI ACPI controller Device ACPI контролер +ACPI node '%1' DeviceACPI Вузол ACPI '%1' Basic information DevicesView Основна інформація Bridge Device Міст Bus DevicesView Шина +Bus Information Device Інфо про шину Category DevicesView Категорії +Class Info:\t\t\t\t: %classInfo% DeviceACPI Інфо про клас:\t\t\t\t: %classInfo% +Class info DevicePCI Інфо про клас Communication controller Device Контролер зв’язку Computer Device Комп’ютер +Computer DevicesView Компютер Connection DevicesView Підключенню Detailed DevicesView Докладно +Device Device Пристрій +Device Name\t\t\t\t: %Name%\nManufacturer\t\t\t: %Manufacturer%\nDriver used\t\t\t\t: %DriverUsed%\nDevice paths\t: %DevicePaths% Device Ім'я пристрою\t\t\t\t: %Name%\nВиробник\t\t\t: %Manufacturer%\nВикор. драйвер \t\t\t\t: %DriverUsed%\nШляхи пристрою\t: %DevicePaths% Device name Device Назва пристрою +Device name DeviceACPI Ім'я пристрою +Device name DevicePCI Ім'я пристрою Device name: Device Назва пристрою: Device paths Device Шляхи пристрою +Device paths DevicePCI Шляхи пристрою Devices DevicesView Пристрої +Devices System name Пристрої Display controller Device Контролер дисплея Docking station Device Док-станція Driver used Device Використовує драйвер +Driver used DevicePCI Використовує драйвер +Encryption controller Device Контроллер шифрування Generate system information DevicesView Створення системної інформації Generic system peripheral Device Периферійні пристрої +ISA bus Device ISA bus +ISA bus DevicesView Шина ISA Input device controller Device Контролер ввідних пристроїв Intelligent controller Device Інтелектуальний контролер Manufacturer Device Виробник +Manufacturer DeviceACPI Виробник +Manufacturer DevicePCI Виробник Manufacturer: Device Виробник: Mass storage controller Device Контролер накопичувачів Memory controller Device Контролер пам’яті Multimedia controller Device Мультимедійний контролер +Name PropertyList Імя Network controller Device Мережевий контролер +None Device Жоден +Not implemented DeviceACPI Не підтримується +Not implemented DevicePCI Не підтримується Order by: DevicesView Сортувати по: +PCI Information DevicePCI Інформація про PCI +PCI bus Device ШинаPCI +PCI bus DevicesView Шина PCI Processor Device Процесор Quit DevicesView Вийти Refresh devices DevicesView Оновлення пристроїв Report compatibility DevicesView Повідомити про сумісність Satellite communications controller Device Контроллер супутникового зв’язку Serial bus controller Device Контроллер послідовної шини +Signal processing controller Device Контроллер обробки сигналів Unclassified device Device Некласифіковані пристрої +Unknown DevicePCI Невідомий +Unknown device Device Невідомий пристрій +Unknown device DevicesView Невідомий пристрій +Value PropertyList Значення Wireless controller Device Бездротовий контролер +unknown Device невідомий diff --git a/data/catalogs/apps/diskprobe/uk.catkeys b/data/catalogs/apps/diskprobe/uk.catkeys index 77dd3f2491..cbc2c18929 100644 --- a/data/catalogs/apps/diskprobe/uk.catkeys +++ b/data/catalogs/apps/diskprobe/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-DiskProbe 2710260630 +1 ukrainian x-vnd.Haiku-DiskProbe 3441574721 %ld (native) ProbeView %ld (рідна) (native) ProbeView (рідний) 15 bit TypeEditors 15 біт @@ -20,11 +20,17 @@ Add ProbeView Додати Attribute AttributeWindow Атрибут Attribute ProbeView Атрибут +Attribute offset: ProbeView Зміщення атрибуту: +Attribute type: ProbeView Тип атрибуту: +Attribute: ProbeView Атрибут: Attributes ProbeView Атрибути Back ProbeView Назад +Base ProbeView A menu item, the number that is basis for a system of calculation. The base 10 system is a decimal system. This is in the same menu window than 'Font size' and 'BlockSize' Основа Block ProbeView Блок Block %Ld (0x%Lx) ProbeView Блок %Ld (0x%Lx) Block 0x%Lx ProbeView Блок 0x%Lx +Block: ProbeView Блок: +BlockSize ProbeView A menu item, a shortened form from 'block size'. This is in the same menu windowthan 'Base' and 'Font size' Розмір блоку Bookmarks ProbeView Закладки Boolean TypeEditors This is the type of editor Булевий Boolean editor TypeEditors Булевий редактор @@ -44,7 +50,11 @@ Could not open file \"%s\": %s\n DiskProbe Неможливо відкрити Could not read image TypeEditors Image means here a picture file, not a disk image. Неможливо прочитати образ Decimal ProbeView A menu item, as short as possible, noun is recommended if it is shorter than adjective. Десятковий Device ProbeView Пристрій +Device offset: ProbeView Зміщення пристрою: +Device: ProbeView Пристрій: +DiskProbe System name DiskProbe DiskProbe request AttributeWindow Запит DiskProbe +DiskProbe request DiskProbe Запит DiskProbe DiskProbe request ProbeView Запит DiskProbe Do you really want to remove the attribute \"%s\" from the file \"%s\"?\n\nYou cannot undo this action. AttributeWindow Ви дійсно бажаєте видалити атрибут \"%s\" для файлу \"%s\"?\n\nЦя дія незворотня. Don't save ProbeView Не зберігати @@ -53,6 +63,8 @@ Edit ProbeView Редагувати Examine device: OpenWindow Перевірка пристрою: File FileWindow Файл File ProbeView Файл +File offset: ProbeView Зміщення файлу: +File: ProbeView Файл: Find FindWindow Знайти Find again ProbeView Знайти знову Find… ProbeView Знайти… @@ -61,7 +73,7 @@ Flattened bitmap TypeEditors Плаский образ Floating-point value: TypeEditors Значення з плаваючою комою: Font size ProbeView Розмір шрифту Grayscale TypeEditors Відтінки сірого -Hex ProbeView A menu item, as short as possible, noun is recommended if it is shorter than adjective. Шіснадцятичний +Hex ProbeView A menu item, as short as possible, noun is recommended if it is shorter than adjective. Шіснадцятковий Hexadecimal FindWindow A menu item, as short as possible, noun is recommended if it is shorter than adjective. Шістнадцятичний Icon TypeEditors Іконка Icon view TypeEditors У вигляді іконки @@ -82,17 +94,20 @@ Number editor TypeEditors Редактор номеру Number: TypeEditors Номер: OK DiskProbe Гаразд OK ProbeView Гаразд +Offset: ProbeView Зміщення: Open device FileWindow Відкрити пристрій Open file… FileWindow Відкрити файл… PNG format TypeEditors PNG формат Page setup… ProbeView Налаштування сторінки… Paste ProbeView Вставити Previous ProbeView Попереднє +Print… ProbeView Друк… Probe device OpenWindow Перевірити пристрій Probe file… OpenWindow Перевірити файл… Quit FileWindow Вийти Raw editor AttributeWindow Raw редактор Redo ProbeView Відмінити відміну +Remove AttributeWindow Видалити Remove from file AttributeWindow Видалити для файлу Save ProbeView Зберегти Save changes before closing? ProbeView Зберегти зміни перед закриттям? @@ -110,6 +125,9 @@ Type editor not supported ProbeView Редактор типу не підтри Undo ProbeView Відмінити Unknown format TypeEditors Невідомий формат Unknown type TypeEditors Невідомий тип +View ProbeView This is the last menubar item 'File Edit Block View' Перегляд Writing to the file failed:\n%s\n\nAll changes will be lost when you quit. ProbeView Запис до файлу зупинено:\n%s\n\nКоли Ви вийдете зміни не збережуться. none ProbeView No attributes немає +of ProbeView з +of 0x0 ProbeView This is a part of 'Block 0xXXXX of 0x0026' message. In languages without 'of' structure it can be replaced simply with '/'. з 0x0 what: '%.4s'\n\n TypeEditors 'What' is a message specifier that defines the type of the message. what: '%.4s'\n\n diff --git a/data/catalogs/apps/diskusage/uk.catkeys b/data/catalogs/apps/diskusage/uk.catkeys index 914461423f..487175b851 100644 --- a/data/catalogs/apps/diskusage/uk.catkeys +++ b/data/catalogs/apps/diskusage/uk.catkeys @@ -1 +1,24 @@ -1 ukrainian x-vnd.Haiku-DiskUsage 0 +1 ukrainian x-vnd.Haiku-DiskUsage 2324691237 +%a, %d %b %Y, %r Info Window %a, %d %b %Y, %r +%d file Status View %d файл +%d files Status View %d файлів +9999.99 GB Status View 9999.99 +Created Info Window Створено +DiskUsage System name Використання дисків +Free on %refName% Scanner Вільно на %refName% +Get Info Pie View Інформація +Kind Info Window Тип +Modified Info Window Змінено +Open Pie View Відкрити +Open With Pie View Відкрити в +Outdated view Pie View Вікно перегляду +Path Info Window Шлях +Rescan Pie View Пересканувати +Rescan Volume View Пересканувати +Scan Status View Сканувати +Scanning %refName% Scanner Сканування %refName% +Size Info Window Розмір +file unavailable Pie View файл недоступний +file unavailable Status View файл недоступний +in %d files Info Window в %d файлах +no supporting apps Pie View відсутні підтримувані додатки diff --git a/data/catalogs/apps/drivesetup/uk.catkeys b/data/catalogs/apps/drivesetup/uk.catkeys index 6b26c92c8c..02edf785ea 100644 --- a/data/catalogs/apps/drivesetup/uk.catkeys +++ b/data/catalogs/apps/drivesetup/uk.catkeys @@ -1,9 +1,12 @@ -1 ukrainian x-vnd.Haiku-DriveSetup 696879283 +1 ukrainian x-vnd.Haiku-DriveSetup 1209826930 %ld MiB Support %ld MiB DiskView <пусто> PartitionList <пусто> Active PartitionList Активний Are you sure you want to delete the selected partition?\n\nAll data on the partition will be irretrievably lost if you do so! MainWindow Ви впевнені що бажаєте видалити вибраний розділ?\n\nВсі дані на розділі будуть безповоротно втрачені! +Are you sure you want to initialize the partition \"%s\"? You will be asked again before changes are written to the disk. MainWindow Ви впевнені , що бажаєте ініціалізувати розділ \"%s\"? Ви повинні будете відповісти повторно при запису на диск. +Are you sure you want to initialize the partition? You will be asked again before changes are written to the disk. MainWindow Ви впевнені , що бажаєте ініціалізувати розділ? Ви повинні будете відповісти повторно при запису на диск. +Are you sure you want to write the changes back to disk now?\n\nAll data on the disk %s will be irretrievably lost if you do so! MainWindow Ви впевнені що бажаєте записати зміни на диск зараз?\n\nВсі дані на диску %s будуть безповоротно втрачені! Are you sure you want to write the changes back to disk now?\n\nAll data on the partition %s will be irretrievably lost if you do so! MainWindow Ви впевнені що бажаєте записати зміни на диск зараз?\n\nВсі дані в розділі %s будуть безповоротно втрачені! Are you sure you want to write the changes back to disk now?\n\nAll data on the partition will be irretrievably lost if you do so! MainWindow Ви впевнені, що бажаєте записати зміни на диск?\n\nВсі дані на розділі будуть безповоротно втрачені! Are you sure you want to write the changes back to disk now?\n\nAll data on the selected disk will be irretrievably lost if you do so! MainWindow Ви впевнені, що бажаєте записати зміни на диск зараз?\n\nВсі дані на вибраному диску будуть безповоротно втрачені! @@ -26,8 +29,10 @@ Device DiskView Пристрій Device PartitionList Пристрій Disk MainWindow Диск Disk system \"%s\"\" not found! MainWindow Системний диск \"%s\"\" не знайдено! +DriveSetup System name DriveSetup Eject MainWindow Виштовхнути End: %ld MB Support Кінець: %ld MB +Error: MainWindow in any error alert Помилка: Failed to delete the partition. No changes have been written to disk. MainWindow Видалення розділу призупинене. Жодні зміни не були записані на диск. Failed to initialize the partition %s!\n MainWindow Призупинена ініціалізація розділу %s!\n Failed to initialize the partition. No changes have been written to disk. MainWindow Ініціалізація розділу призупинена. Жодні зміни не були записані на диск. @@ -39,6 +44,7 @@ Initialize MainWindow Ініціалізація Mount MainWindow Змонтувати Mount all MainWindow Підмонтувати все Mounted at PartitionList Змонтувати на +No disk devices have been recognized. DiskView Не розпізнано жодного дискового пристрою. OK MainWindow Гаразд Offset: %ld MB Support Початок: %ld MB Parameters PartitionList Параметри @@ -56,7 +62,7 @@ The currently selected partition is not empty. MainWindow Поточний ви The partition %s has been successfully initialized.\n MainWindow Розділ %s був успішно ініціалізований.\n The partition %s is already mounted. MainWindow Розділ %s повністю підмонтований. The partition %s is already unmounted. MainWindow Розділ %s повністю відмонтований. -The partition %s is currently mounted. MainWindow Розділ %s Повністю підмонтовано. +The partition %s is currently mounted. MainWindow Розділ %s повністю підмонтовано. The selected disk is read-only. MainWindow Вибраний диск тільки для читання. The selected partition does not contain a partitioning system. MainWindow Вибраний розділ не містить системної розмітки. There was an error acquiring the partition row. MainWindow Сталася помилка при одержанні параметрів розділу. diff --git a/data/catalogs/apps/expander/uk.catkeys b/data/catalogs/apps/expander/uk.catkeys index 8b3952a375..bae2325386 100644 --- a/data/catalogs/apps/expander/uk.catkeys +++ b/data/catalogs/apps/expander/uk.catkeys @@ -1,10 +1,11 @@ -1 ukrainian x-vnd.Haiku-Expander 2487745131 +1 ukrainian x-vnd.Haiku-Expander 187676748 Are you sure you want to stop expanding this\narchive? The expanded items may not be complete. ExpanderWindow Ви впевнені, що хочете зупинити розпаковку цього архіва? Розпаковка елементів може бути неповною. Automatically expand files ExpanderPreferences Автоматично розпакувати файли Automatically show contents listing ExpanderPreferences Автоматично показувати список вмісту Cancel ExpanderPreferences Відміна Cancel ExpanderWindow Відмінити Close ExpanderMenu Закрити +Close window when done expanding ExpanderPreferences Закрити вікно після розпаковки Continue ExpanderWindow Продовжити Creating listing for '%s' ExpanderWindow Створення списку для '%s' Destination ExpanderWindow Папка призначення @@ -12,20 +13,23 @@ Destination folder: ExpanderPreferences Папка призначення: Error when expanding archive ExpanderWindow Помилка при розпаковці архіва Expand ExpanderMenu Розпакувати Expand ExpanderWindow Розпакувати +Expander System name Розпаковувач Expander settings ExpanderPreferences Настройки Розпаковувача -Expander: Choose destination DirectoryFilePanel Expander: Виберіть ціль +Expander: Choose destination DirectoryFilePanel Розпаковувач: Виберіть ціль Expander: Open ExpanderWindow Expander: Відкрити -Expanding '%s' ExpanderWindow Розтиск '%s' +Expanding '%s' ExpanderWindow Розпаковка '%s' Expansion: ExpanderPreferences Розширення: File ExpanderMenu Файл -File expanded ExpanderWindow Файл розпаковано +File expanded ExpanderWindow Розпаковка файлу Hide contents ExpanderWindow Сховати вміст Leave destination folder path empty ExpanderPreferences Зберегти шлях папки призначення пустим +OK ExpanderPreferences Гаразд Open destination folder after extraction ExpanderPreferences Відкрити папку призначення після розтиску Other: ExpanderPreferences Інший: Same directory as source (archive) file ExpanderPreferences Та ж папка що і джерела (архіву) Select DirectoryFilePanel Вибрати Select ExpanderPreferences Вибрати +Select '%s' DirectoryFilePanel Вибрати '%s' Select current DirectoryFilePanel Вибрати поточний Set destination… ExpanderMenu Встановити ціль… Set source… ExpanderMenu Встановити джерело… @@ -42,3 +46,4 @@ The destination is read only. ExpanderWindow Ціль тільки для чи The file doesn't exist ExpanderWindow Файл відсутній The folder was either moved, renamed or not\nsupported. ExpanderWindow Папка була переіменована, видалена або не\nпідтримується. Use: ExpanderPreferences Використати: +is not supported ExpanderWindow не підтримується diff --git a/data/catalogs/apps/glteapot/uk.catkeys b/data/catalogs/apps/glteapot/uk.catkeys new file mode 100644 index 0000000000..b6693e348e --- /dev/null +++ b/data/catalogs/apps/glteapot/uk.catkeys @@ -0,0 +1,24 @@ +1 ukrainian x-vnd.Haiku-GLTeapot 2890609668 +Add a teapot TeapotWindow Додати чайник +Backface culling TeapotWindow Backface culling +Blue TeapotWindow Голубий +FPS display TeapotWindow Показати FPS +File TeapotWindow Файл +Filled polygons TeapotWindow Заповнити багатокутники +Fog TeapotWindow Туман +GLTeapot System name Чайник GL +Gouraud shading TeapotWindow Затінення Гуро +Green TeapotWindow Зелений +Lighting TeapotWindow Свічення +Lights TeapotWindow Світло +Lower left TeapotWindow Нижній лівий +Off TeapotWindow Вимкнути +Options TeapotWindow Опції +Perspective TeapotWindow Перспектива +Quit TeapotWindow Вийти +Red TeapotWindow Червоний +Right TeapotWindow Вправо +Upper center TeapotWindow Вище центру +White TeapotWindow Білий +Yellow TeapotWindow Жовтий +Z-buffered TeapotWindow Z-буферизація diff --git a/data/catalogs/apps/icon-o-matic/uk.catkeys b/data/catalogs/apps/icon-o-matic/uk.catkeys index 38b7c578a6..52e589d8f0 100644 --- a/data/catalogs/apps/icon-o-matic/uk.catkeys +++ b/data/catalogs/apps/icon-o-matic/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.haiku-icon_o_matic 4031165655 +1 ukrainian x-vnd.haiku-icon_o_matic 2326864078 Icon-O-Matic-PathCmd <змінити шлях> Icon-O-Matic-Menu-Edit <нічого не переробляти> Icon-O-Matic-Menu-Edit <нічого, щоб скасувати> @@ -26,6 +26,7 @@ Add with path Icon-O-Matic-ShapesList Додати зі шляхом Add with path & style Icon-O-Matic-ShapesList Додати зі шляху і стилю Add with style Icon-O-Matic-ShapesList Додати зі стилем All Icon-O-Matic-Properties Всі +Append… Icon-O-Matic-Menu-File Додати… Assign Path Icon-O-Matic-AddPathsCmd Призначити шлях Assign Paths Icon-O-Matic-AddPathsCmd Призначення шляхів Assign Style Icon-O-Matic-AssignStyleCmd Прив'язати стиль @@ -33,6 +34,7 @@ BEOS:ICON Attribute Icon-O-Matic-SavePanel Атрибут BEOS:ICON Bleep! Exporter - Continue in error dialog Bleep! Bummer Cancel button - error alert Помилка Cancel Icon-O-Matic-ColorPicker Відмінити +Cancel Icon-O-Matic-Menu-Settings Відміна Cancel Icon-O-Matic-SVGExport Відмінити Caps Icon-O-Matic-PropertyNames Шапки Change Color Icon-O-Matic-SetColorCmd Змінити Колір @@ -40,6 +42,7 @@ Clean Up Path Icon-O-Matic-CleanUpPathCmd Очистити шлях Clean up Icon-O-Matic-PathsList Очистити Click on a shape above Empty transformers list - 1st line Натиснути на фігуру нижче Click on an object in Empty property list - 1st line Натисніть на об'єкт в +Close Icon-O-Matic-Menu-File Закрити Closed Icon-O-Matic-PropertyNames Закрити Color Icon-O-Matic-PropertyNames Колір Color Icon-O-Matic-StyleTypes Колір @@ -50,11 +53,13 @@ Contour Transformation Контур Copy Icon-O-Matic-Properties Копіювати Detect Orient. Icon-O-Matic-PropertyNames Виявляти орієнт. Diamond Icon-O-Matic-StyleTypes Ромб +Discard Icon-O-Matic-Menu-Settings Витягнути Duplicate Icon-O-Matic-PathsList Дублювати Duplicate Icon-O-Matic-ShapesList Дублювати Duplicate Icon-O-Matic-StylesList Дублювати Edit Icon-O-Matic-Menus Редагувати Edit Gradient Icon-O-Matic-SetGradientCmd Редагувати градієнт +Error: Icon-O-Matic-Exporter Помилка: Error: Icon-O-Matic-Main Помилка: Export Icon-O-Matic-Menu-File Експорт Export Icon Dialog title Експорт іконки @@ -72,6 +77,8 @@ Gradient Icon-O-Matic-StyleTypes Градієнт Gradient type Icon-O-Matic-StyleTypes Тип градієнту HVIF Source Code Icon-O-Matic-SavePanel Код джерела HVIF Height Icon-O-Matic-PropertyNames Висота +Icon-O-Matic System name Icon-O-Matic +Icon-O-Matic might not have interpreted all data from the SVG when it was loaded. By overwriting the original file, this information would now be lost. Icon-O-Matic-SVGExport Icon-O-Matic може неправильно інтерпретувати дані з SVG , коли буде завантажений. При перезаписі файлу ця інформація може бути втрачена. Insert Control Point Icon-O-Matic-InsertPointCmd Вставити контрольну точку Invert selection Icon-O-Matic-Properties Обернути виділення Joins Icon-O-Matic-PropertyNames З'єднання @@ -148,8 +155,10 @@ Rotate indices forwards Icon-O-Matic-PathsList обертати за годин Rotation Icon-O-Matic-PropertyNames Обертання Rounding Icon-O-Matic-PropertyNames Округлення Save Icon-O-Matic-Menu-File Зберегти +Save Icon-O-Matic-Menu-Settings Зберегти Save Icon Dialog title Зберегти Іконку Save as… Icon-O-Matic-Menu-File Зберегти як… +Save changes to current icon? Icon-O-Matic-Menu-Settings Зберегти зміни для біжучої іконки? Saving your document failed! Icon-O-Matic-Exporter Збереження вашого документу призупинене! Scale Icon-O-Matic-TransformationBoxStates Масштаб Scale X Icon-O-Matic-PropertyNames Маштаб по X @@ -178,6 +187,7 @@ Translation X Icon-O-Matic-PropertyNames Перетворення по X Translation Y Icon-O-Matic-PropertyNames Перетворення по Y Unassign Path Icon-O-Matic-UnassignPathCmd Відв'язати шлях Undo Icon-O-Matic-Main Скасувати +Untitled Icon-O-Matic-Main Неназваний Width Icon-O-Matic-PropertyNames Ширина Yes Icon-O-Matic-StyledTextImport Так any of the other lists to Empty property list - 2nd line будь-який з інших списків до diff --git a/data/catalogs/apps/installedpackages/uk.catkeys b/data/catalogs/apps/installedpackages/uk.catkeys index 8e161f27f6..b3a7f3ac28 100644 --- a/data/catalogs/apps/installedpackages/uk.catkeys +++ b/data/catalogs/apps/installedpackages/uk.catkeys @@ -1,4 +1,5 @@ -1 ukrainian x-vnd.Haiku-InstalledPackages 148986533 +1 ukrainian x-vnd.Haiku-InstalledPackages 4131220089 +InstalledPackages System name Встановлення пакунків No package selected. UninstallView Пакунок не вибрано OK UninstallView Гаразд Package description UninstallView Опис пакунків diff --git a/data/catalogs/apps/installer/uk.catkeys b/data/catalogs/apps/installer/uk.catkeys index 9bd644fb6c..78dcd3bb31 100644 --- a/data/catalogs/apps/installer/uk.catkeys +++ b/data/catalogs/apps/installer/uk.catkeys @@ -1,23 +1,28 @@ -1 ukrainian x-vnd.Haiku-Installer 2747618228 +1 ukrainian x-vnd.Haiku-Installer 3852628561 %1ld of %2ld InstallerWindow number of files copied %1ld з %2ld 1) If you are installing Haiku onto real hardware (not inside an emulator) it is recommended that you have already prepared a hard disk partition. The Installer and the DriveSetup tool offer to initialize existing partitions with the Haiku native file system, but the options to change the actual partition layout may not have been tested on a sufficiently great variety of computer configurations so we do not recommend using it.\n InstallerApp 1) Якщо ви встановлюєте Haiku на реальному залізі (не в середині емулятора) рекомендується розбити жорсткий диск на розділи заздалегідь. Встановлювач і утиліта DriveSetup здатні до ініціалізації присутніх розділів у рідній файловій системі Haiku, але опції зміни існуючих розділів протестовані недостатньо і ми не рекомендуємо їх поки що до використання.\n 2) The Installer will make the Haiku partition itself bootable, but takes no steps to integrate Haiku into an existing boot menu. If you have GRUB already installed, you can add Haiku to its boot menu. Depending on what version of GRUB you use, this is done differently.\n\n\n InstallerApp 2) Встановлювач сам зробить розділ Haiku загрузочним, але він не робить жодних кроків для інтеграції Haiku в меню завантаження. Якщо Ви маєте встановлений GRUB, то можете додати Haiku до його меню завантаження. В залежності від версії GRUB, це робиться по різному.\n\n\n 2.1) GRUB 1\n InstallerApp 2.1) GRUB 1\n 2.2) GRUB 2\n InstallerApp 2.2) GRUB 2\n +3) When you successfully boot into Haiku for the first time, make sure to read our \"Welcome\" documentation, there is a link on the Desktop.\n\n InstallerApp 3) Коли Ви успішно зануритесь у Haiku почніть з прочитання документації \"Welcome\", її лінк Ви знайдете на робочому столі.\n\n InstallerWindow No partition available <немає> ?? of ?? InstallerWindow Unknown progress ?? з ?? ??? InstallerWindow Unknown currently copied item ??? ??? InstallerWindow Unknown partition name ??? +Abort InstallerWindow Відмінити Additional disk space required: %s InstallerWindow Очікується збільшення дискового простору: %s Additional disk space required: 0.0 KiB InstallerWindow Необхідно додатковий дисковий простір: 0.0 KiB Additionally you have to edit another file to actually display the boot menu:\n\n InstallerApp Додатково доведеться змінити ще один файл, щоб з’явилося меню завантаження:\n\n All hard disks start with \"hd\".\n InstallerApp Всі жорсткі диски починаються з \"hd\".\n +An error was encountered and the installation was not completed:\n\nError: %s InstallerWindow Сталася помилка і встановлення некомплектне:\n\nПомилка: %s Are you sure you want to abort the installation and restart the system? InstallerWindow Ви впевнені що бажаєте зупинити встановлення і перезавантажити систему? +Are you sure you want to abort the installation? InstallerWindow Ви дійсно бажаєте відмінити встановлення? Are you sure you want to install onto the current boot disk? The Installer will have to reboot your machine if you proceed. InstallProgress Ви впевнені що, хочете встановлювати на поточний загрузочний диск? Встановлювач перезавантажить машину, якщо ви продовжите. Are you sure you want to to stop the installation? InstallerWindow Ви впевнені, що бажаєте зупинити встановлення? Begin InstallerWindow Почати Boot sector not written because of an internal error. InstallProgress Загрузочний сектор не записано через внутрішню помилку. Boot sector successfully written. InstallProgress Завантажувальний сектор успішно записаний. +BootManager, the application to configure the Haiku boot menu, could not be launched. InstallerWindow Завантажувач (BootManager), додаток для конфігурування загрузочного меню Haiku, не є запущеним. Cancel InstallProgress Відмінити Cancel InstallerWindow Відмінити Choose the disk you want to install onto from the pop-up menu. Then click \"Begin\". InstallerWindow Виберіть диск для встановлення з випадаючого меню. Тоді клікніть \"Почати\". @@ -32,16 +37,21 @@ Finally, you have to update the boot menu by entering:\n\n InstallerApp Вре Finishing Installation. InstallProgress Завершення встановлення. GRUB's naming scheme is still: (hdN,n)\n\n InstallerApp Схема іменування в GRUB залишилась така: (hdN,n)\n\n Have fun and thanks a lot for trying out Haiku! We hope you like it! InstallerApp Насолоджуйтесь і дякуємо за спробу використання Haiku! Маємо надію що вона вам сподобається! +Here you have to comment out the line \"GRUB_HIDDEN_TIMEOUT=0\" by putting a \"#\" in front of it in order to actually display the boot menu.\n\n InstallerApp Там ви можете закоментувати рядок \"GRUB_HIDDEN_TIMEOUT=0\" помістивши \"#\" перед ним, з метою появи меню завантаження.\n\n Hide optional packages InstallerWindow Сховати необов’язкові пакети IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n InstallerApp ВАЖЛИВА ІНФОРМАЦІЯ ПЕРЕД ВСТАНОВЛЕННЯМ HAIKU\n\n If you have not created a partition yet, simply reboot, create the partition using whatever tool you feel most comfortable with, and reboot into Haiku to continue with the installation. You could for example use the GParted Live-CD, it can also resize existing partitions to make room.\n\n\n InstallerApp Якщо Ви досі не створили розділ, перезавантажтесь, створіть його за допомогою звичної Вам програми, завантажтесь в Haiku для продовження інсталяції. Для прикладу використайте GParted Live-CD, Який також може змінити розміри присутніх розділів.\n\n\n Install anyway InstallProgress Встановити в будь-якому разі Install from: InstallerWindow Встановити з: +Install progress: InstallerWindow Хід встановлення: Installation canceled. InstallProgress Встановлення призупинено. Installation completed. Boot sector has been written to '%s'. Press Quit to leave the Installer or choose a new target volume to perform another installation. InstallerWindow Встановлення завершене. Завантажувальний сектор записано до '%s'. Натисніть Вихід щоб покинути Встановлювач або виберіть інший цільовий том для виконання другого встановлення. +Installation completed. Boot sector has been written to '%s'. Press Restart to restart the computer or choose a new target volume to perform another installation. InstallerWindow Встановлення завершене. Загрузочний сектор записано до '%s'. Натисніть Перезавантажити для рестарту або вибрати іншу ціль для встановлення. +Installer System name Встановлювач Installer\n\twritten by Jérôme Duval and Stephan Aßmus\n\tCopyright 2005-2010, Haiku.\n\n InstallerApp Встановлювач\n\tАвтори Jérôme Duval і Stephan Aßmus\n\tCopyright 2005–2010, Haiku.\n\n Launch the DriveSetup utility to partition\navailable hard drives and other media.\nPartitions can be initialized with the\nBe File System needed for a Haiku boot\npartition. InstallerWindow Запустіть утиліту DriveSetup для розбиття\nдоступних вінчестерів і пристроїв.\nРозділи будуть зініціалізовані у \nBe File System необхідній для завантаження розділу з Haiku\n NOTE: While the naming strategy for hard disks is still as described under 2.1) the naming scheme for partitions has changed.\n\n InstallerApp Заувага: Хоча принцип іменування жорстких дисків такий самий, як описано в п. 2.1 іменування розділів змінилося.\n\n +Newer versions of GRUB use an extra configuration file to add custom entries to the boot menu. To add them to the top, you have to create/edit a file by launching your favorite editor from a Terminal like this:\n\n InstallerApp Найновіші версії GRUB використовують спеціальний конфігураційний файл, щоб додати пункти до бутменю. Для додавання у список досить створити/редагувати файл у вашому улюбленому текстовому редакторі запустивши його з Terminal'у, наприклад, так:\n\n No optional packages available. PackagesView Необов’язкові пакети відсутні. No partitions have been found that are suitable for installation. Please set up partitions and initialize at least one partition with the Be File System. InstallerWindow Не знайдено жодного розділу, що підходить для встановлення. Перевстановіть розділи або зініціалізуйте один з них в Be File System. OK InstallProgress Гаразд @@ -60,6 +70,7 @@ Quit Boot Manager InstallerWindow Вийти з Бутменеджера Quit Boot Manager and DriveSetup InstallerWindow Вийти з Бутменеджера і утиліти DriveSetup Quit DriveSetup InstallerWindow Вийти з DriveSetup README InstallerApp ПРОЧИТАЙ +Restart InstallerWindow Перезавантажити Restart system InstallerWindow Перезавантажити систему Running Boot Manager and DriveSetup…\n\nClose both applications to continue with the installation. InstallerWindow Працюють Бутменеджер і DriveSetup…\n\nЗакрийте обидва додатки для продовження встановлення. Running Boot Manager…\n\nClose Boot Manager to continue with the installation. InstallerWindow Працює Бутменеджер…\n\nЗакрийте його для продовження встановлення. @@ -90,6 +101,7 @@ Write boot sector InstallerWindow Записати загрузочний се Write boot sector to '%s' InstallerWindow Записати загрузочний сектор до '%s' You can see the correct partition in GParted for example.\n\n\n InstallerApp Ви можете подивитись правильний розподіл розділів, наприклад, у GParted.\n\n\n You can't install the contents of a disk onto itself. Please choose a different disk. InstallProgress Неможливо встановити розділ на самого себе. Виберіть інший диск. +You'll note that GRUB uses a different naming strategy for hard drives than Linux.\n\n InstallerApp Слід зауважити, що GRUB використовує інший спосіб іменування жорстких дисків ніж Linux.\n\n \"N\" is the hard disk number, starting with \"0\".\n InstallerApp \"N\" номер жорсткого диску, що починається з \"0\".\n \"n\" is the partition number, also starting with \"0\".\n InstallerApp \"n\" є номер розділу, завжди починається з \"0\".\n \"n\" is the partition number, which for GRUB 2 starts with \"1\"\n InstallerApp \"n\" є номер розділу, який для GRUB 2 починається з \"1\"\n diff --git a/data/catalogs/apps/launchbox/uk.catkeys b/data/catalogs/apps/launchbox/uk.catkeys index ba7f5568c8..9a5c636971 100644 --- a/data/catalogs/apps/launchbox/uk.catkeys +++ b/data/catalogs/apps/launchbox/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-LaunchBox 1555134888 +1 ukrainian x-vnd.Haiku-LaunchBox 1440389990 Add button here LaunchBox Додати кнопку тут Auto-raise LaunchBox Автоматичне спливання Bummer LaunchBox Помилка @@ -6,18 +6,26 @@ Cancel LaunchBox Відміна Clear button LaunchBox Очистити кнопку Clone LaunchBox Клонувати Close LaunchBox Закрити +Description for '%3' LaunchBox Опис для '%3' +Failed to launch '%1'.\n\nError: LaunchBox Призупинено запуск '%1'.\n\nПомилка: Failed to launch 'something',error in Pad data. LaunchBox Невдалося запустити 'щось', помилка в даних панелі. +Failed to launch application with signature '%2'.\n\nError: LaunchBox Призупинено запуск додатку з сигнатурою '%2'.\n\nПомилка: +Failed to send 'open folder' command to Tracker.\n\nError: LaunchBox Призупинено команду 'відкрити папку' для Tracker.\n\nПомилка: Horizontal layout LaunchBox Горизонтальне розташування Icon size LaunchBox Розмір Іконки Ignore double-click LaunchBox Ігнорувати подвійне натискання +LaunchBox System name LaunchBox Name Panel LaunchBox Панель назви New LaunchBox Новий OK LaunchBox Гаразд Pad LaunchBox Панель +Pad %1 LaunchBox Панель %1 Pad 1 LaunchBox Панель 1 Quit LaunchBox Вийти Really close this pad?\n(The pad will not be remembered.) LaunchBox Дійсно закрити цю панель?\n(Вона не збережеться.) Remove button LaunchBox Видалити кнопку +Set description… LaunchBox Встановити Опис… +Settings LaunchBox Настройки Show on all workspaces LaunchBox Показати на всіх робочих просторах Show window border LaunchBox Показувати межі вікна Vertical layout LaunchBox Вертикальне розташування diff --git a/data/catalogs/apps/magnify/uk.catkeys b/data/catalogs/apps/magnify/uk.catkeys index 3c132543ae..56a452dcaf 100644 --- a/data/catalogs/apps/magnify/uk.catkeys +++ b/data/catalogs/apps/magnify/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-Magnify 1821981944 +1 ukrainian x-vnd.Haiku-Magnify 3748875992 %width x %height @ %pixelSize pixels/pixel Magnify-Main %width x %height @ %pixelSize pixels/pixel Add a crosshair Magnify-Main Додати перехрестя Copy image Magnify-Main Копіювати зображення @@ -7,18 +7,23 @@ Decrease pixel size Magnify-Main Зменшити розмір пікселів Decrease window size Magnify-Main Зменшити розмір вікна Freeze/Unfreeze image Magnify-Main заморозити/відморозити зображення General:\n 32 x 32 - the top left numbers are the number of visible\n pixels (width x height)\n 8 pixels/pixel - represents the number of pixels that are\n used to magnify a pixel\n R:152 G:52 B:10 - the RGB values for the pixel under\n the red square\n Magnify-Help Основне:\n 32 x 32 - Верхнє ліве число кількість видимих\n пікселів (ширина x висота)\n 8 pixels/pixel - являє собою кількість пікселів які\n використовуются для збільшення пікселів\n R:152 G:52 B:10 - Значення RGB для пікселів під\n червоною площею\n +Help Magnify-Main Допомога Hide/Show grid Magnify-Main приховати/показати сітку Hide/Show info Magnify-Main приховати/показати Інформацію Increase pixel size Magnify-Main Збільшити розмір пікселя Increase window size Magnify-Main Збільшити розмір вікна Info Magnify-Main Інформація Info:\n hide/show info - hides/shows all these new features\n note: when showing, a red square will appear which signifies\n which pixel's rgb values will be displayed\n add/remove crosshairs - 2 crosshairs can be added (or removed)\n to aid in the alignment and placement of objects.\n The crosshairs are represented by blue squares and blue lines.\n hide/show grid - hides/shows the grid that separates each pixel\n Magnify-Help Інформація:\n hide/show info - сховати/показати всі нові можливості\n заувага: при показі, з'явиться червона площа яка означає\n скільки пікселів rgb буде показано\n add/remove crosshairs - 2 перехрестя може бути додано (або знято)\n для надання допомоги у вирівнюванні чи розташуванні об'єктів .\n Перехрестки позначені синіми квадратами і лініями.\n hide/show grid - приховати/показати сітку, яка відокремлює кожен піксель\n +Magnify System name Збільшення Magnify help Magnify-Help Допомога Magnify Make square Magnify-Main Задати площу Navigation:\n arrow keys - move the current selection (rgb indicator or crosshair)\n around 1 pixel at a time\n option-arrow key - moves the mouse location 1 pixel at a time\n x marks the selection - the current selection has an 'x' in it\n Magnify-Help Навігація:\n стрілочки - переміщують курсор вибору (rgb індикатора або перехрестя)\n довкола 1 пікселя за раз\n опція стрілочки - переміщає курсор 1 піксель за раз\n x зробіть вибір - поточний вибір має 'x' в собі\n Remove a crosshair Magnify-Main Зняти перехрестя Save image Magnify-Main Зберегти зображення +Sizing/Resizing:\n make square - sets the width and the height to the larger\n of the two making a square image\n increase/decrease window size - grows or shrinks the window\n size by 4 pixels.\n note: this window can also be resized to any size via the\n resizing region of the window\n increase/decrease pixel size - increases or decreases the number\n of pixels used to magnify a 'real' pixel. Range is 1 to 16.\n Magnify-Help Sizing/Resizing:\nзадає площу- виставляє висоту і ширину більш\n ніж двох площ зображень\n increase/decrease window size - звужує розширює вікно\n розміром 4 пікселі.\n заувага: це вікно може також бути змінене до іншого \n зміною його меж\n increase/decrease pixel size - змінює число\n пікселів, що використовуються для збільшення реального пікселя. Діапазон від 1 до 16.\n Stick coordinates Magnify-Main Вісь кординат +freeze - freezes/unfreezes magnification of whatever the\n cursor is currently over\n Magnify-Help Замороження - заморозити/розморозити будь-яке збільшення незалежно\n від положення курсора\n magnify: size must be a multiple of 4\n Console збільшення: Розмір має бути кратним 4\n no clip msg\n In console, when clipboard is empty after clicking Copy image немає кліпу msg\n +size must be > 4 and a multiple of 4\n Console розмір має бути > 4 і кратний 4\n usage: magnify [size] (magnify size * size pixels)\n Console Використання: Magnify [розмір] (Розмір збільшення * розмір пікселів)\n diff --git a/data/catalogs/apps/mail/uk.catkeys b/data/catalogs/apps/mail/uk.catkeys index 5fb57ce677..4753e973f5 100644 --- a/data/catalogs/apps/mail/uk.catkeys +++ b/data/catalogs/apps/mail/uk.catkeys @@ -1,7 +1,12 @@ -1 ukrainian x-vnd.Be-MAIL 3539940090 +1 ukrainian x-vnd.Be-MAIL 2276629278 %d - Date Mail %d - Дата %e - E-mail address Mail %e - поштова адреса +%e wrote:\\n Mail %e написано:\\n %n - Full name Mail %n - Повне ім'я +(Address unavailable) Mail (Адреса недоступна) +(Date unavailable) Mail (Дата недоступна) +(Name unavailable) Mail (Ім'я недоступне) + Mail <жодного> Account from mail Mail Аккаунт для пошти Account: Mail Аккаунт: Accounts… Mail Аккаунти… @@ -12,20 +17,25 @@ An error occurred trying to open this signature. Mail Помилка при с An error occurred trying to save the attachment. Mail Сталася помилка при збереженні вкладення. An error occurred trying to save this signature. Mail Помилка при збереженні цього підпису. Attach attributes: Mail Додати атрибути: +Attachments: Mail Вкладення: Auto signature: Mail Автопідпис: +Automatic Mail Автоматично Automatically mark mail as read: Mail Автоматично помітити як прочитане: Bcc: Mail Bcc: Beginner Mail Початківець Button bar: Mail Панель кнопок: Cancel Mail Відмінити +Cc: Mail Cc: Check spelling Mail Перевірити правопис Close Mail Закрити +Close and Mail Закрити і Colored quotes: Mail Забарвлення цитат: Copy Mail Копіювати Copy link location Mail Скопіювати розміщення посилання Copy to new Mail Копіювати до нового -Couldn't open this signature. Sorry. Mail Прикро,неможливо відкрити цей підпис. +Couldn't open this signature. Sorry. Mail Прикро, неможливо відкрити цей підпис. Cut Mail Вирізати +Date: Mail Дата: Decoding: Mail Розкодування: Default account: Mail Аккаунт по замовчуванню: Delete Mail Видалити @@ -54,6 +64,7 @@ Initial spell check mode: Mail Режим перевірки правопису Leave as '%s' Mail Зберегти як '%s' Leave as New Mail Зберегти як новий Leave same Mail Зберегти саме це +Mail System name Пошта Mail couldn't find its dictionary. Mail Пошта не може знайти цього словника. Mail preferences Mail Настройки пошти Mailing Mail Відправлення @@ -65,8 +76,11 @@ New mail message Mail Новий лист Next Mail Наступний Next message Mail Наступний лист No file attributes, just plain data Mail Жодних атрибутів,тільки чисті дані -None Mail Жоден +No matches Mail Не відповідати +None Mail Жодного OK Mail Гаразд +Off Mail Вимкнути +On Mail Включити Only files can be added as attachments. Mail Тільки файли можуть бути додані як вкладення. Open Mail Відкрити Open attachment Mail Відкрити вкладення @@ -79,10 +93,12 @@ Previous Mail Попередній Previous message Mail Попередній лист Print Mail Друкувати Print… Mail Друкувати… +Put your favorite e-mail queries and query templates in this folder. Mail Покладіть улюблені поштові запити і шаблони запитів у цю папку. Queries Mail Запити Quit Mail Завершити Quote Mail Цитата Random Mail Випадковий +Read Mail Читати Really delete this signature? This cannot be undone. Mail Дійсно видалити цей підпис? Це буде незворотним. Redo Mail Відмінити відміну Remove attachment Mail Видалити вкладення @@ -116,10 +132,12 @@ Signature: Mail Підпис Signatures Mail Підписи Size: Mail Розмір: Sorry Mail Вибачте +Sorry, could not find an application that supports the 'Person' data type. Mail Вибачте не знайдено жодного додатка що підтримує дані типу 'Person'. Start now Mail Запустити зараз Subject: Mail Тема: Text wrapping: Mail Обтікання тексту: The mail_daemon could not be started:\n\t Mail Mail_daemon не запущено:\n\t +The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail Mail_daemon не запущено. Лист стоїть в черзі і буде відправлений після запуску демона. There is no installed handler for URL links. Mail Не встановлено обробник посилань URL Title: Mail Назва: To: Mail До: @@ -132,3 +150,11 @@ View Mail Вигляд Warn unencodable: Mail Увага нерозкодоване: Your main text contains %ld unencodable characters. Perhaps a different character set would work better? Hit Send to send it anyway (a substitute character will be used in place of the unencodable ones), or choose Cancel to go back and try fixing it up. Mail Ваш основний текст містить %ld нерозкодованих символів. Можливо інше кодування спрацює краще? Виберіть Відправити якщо хочете зробити це не зважаючи(нерозкодований символ буде замінено таким що ситуативно підходить), або натисніть Відмінити щоб п.овернутися назад і виправити ситуацію. \\n - Newline Mail \\n - Нова стрічка +draft B_USER_DIRECTORY/mail/draft чорновик +helpful message Mail щасливе повідомлення +in B_USER_DIRECTORY/mail/in вхідні +mail B_USER_DIRECTORY/mail пошта +out B_USER_DIRECTORY/mail/out вихідні +queries B_USER_DIRECTORY/mail/queries запити +sent B_USER_DIRECTORY/mail/sent відіслати +spam B_USER_DIRECTORY/mail/spam спам diff --git a/data/catalogs/apps/mandelbrot/uk.catkeys b/data/catalogs/apps/mandelbrot/uk.catkeys new file mode 100644 index 0000000000..0bf89abfc4 --- /dev/null +++ b/data/catalogs/apps/mandelbrot/uk.catkeys @@ -0,0 +1,10 @@ +1 ukrainian x-vnd.Haiku-Mandelbrot 3766380907 +File Mandelbrot Файл +Iterations Mandelbrot Наближення +Mandelbrot System name Mandelbrot +Palette Mandelbrot Палітра +Palette 1 Mandelbrot Палітра 1 +Palette 2 Mandelbrot Палітра 2 +Palette 3 Mandelbrot Палітра 3 +Palette 4 Mandelbrot Палітра 4 +Quit Mandelbrot Вийти diff --git a/data/catalogs/apps/mediaconverter/uk.catkeys b/data/catalogs/apps/mediaconverter/uk.catkeys index f908e6f6ba..9cc40be1c3 100644 --- a/data/catalogs/apps/mediaconverter/uk.catkeys +++ b/data/catalogs/apps/mediaconverter/uk.catkeys @@ -1 +1,41 @@ -1 ukrainian x-vnd.Haiku-MediaConverter 0 +1 ukrainian x-vnd.Haiku-MediaConverter 283511503 +%d bit MediaFileInfo %d біт +%d byte MediaFileInfo %d біт +Audio: MediaConverter-FileInfo Аудіо: +Cancel MediaConverter Відмінити +Cancelling MediaConverter Відміна +Cancelling… MediaConverter Відміна… +Continue MediaConverter Продовжити +Conversion cancelled MediaConverter Конверсію відмінено +Conversion completed MediaConverter Конверсія завершена +Encoder parameters MediaConverter-EncoderWindow Параметри декодера +End   [ms]: MediaConverter Кінець [ms]: +Error MediaConverter Помилка +Error converting '%filename' MediaConverter Помилка перетворення '%filename' +Error creating '%filename' MediaConverter Помилка створення '%filename' +Error loading a file MediaConverter Помилка загрузки файла +Error loading files MediaConverter Помилка загрузки файлів +Error writing audio frame %Ld MediaConverter Помилка запису аудіо фрагменту %Ld +File Error MediaConverter-FileInfo Помилка файлу +File details MediaConverter Деталі файлу +File format: MediaConverter Формат файлу: +Low MediaConverter Низька +No audio Audio codecs list без звуку +No video Video codecs list Немає відео +None available Audio codecs Не доступний жоден +None available Video codecs Недоступний +OK MediaConverter Гаразд +OK MediaConverter-FileInfo Гаразд +Open… Menu Відкрити… +Output file '%filename' created MediaConverter Вихідний файл '%filename' створено +Output format MediaConverter Вихідний формат +Preview MediaConverter Попередній перегляд +Quit Menu Вийти +Select MediaConverter Вибрати +Select this folder MediaConverter Вибрати цю папку +Source files MediaConverter Джерело файлів +Start [ms]: MediaConverter Старт [ms]: +Video encoding: MediaConverter Кодування відео: +Video quality not supported MediaConverter Якість відео не підтримується +Video: MediaConverter-FileInfo Відео: +seconds MediaFileInfo секунд diff --git a/data/catalogs/apps/mediaplayer/uk.catkeys b/data/catalogs/apps/mediaplayer/uk.catkeys index da7f21eba9..a6f4e5063e 100644 --- a/data/catalogs/apps/mediaplayer/uk.catkeys +++ b/data/catalogs/apps/mediaplayer/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-MediaPlayer 612300642 +1 ukrainian x-vnd.Haiku-MediaPlayer 3494573104 1.85 : 1 (American) MediaPlayer-Main 1.85 : 1 (Амер.) 100% scale MediaPlayer-Main Масштаб 100% 2.35 : 1 (Cinemascope) MediaPlayer-Main 2.35 : 1 (Сінемаскоп) @@ -12,6 +12,7 @@ PlaylistItem-author <невідомий> PlaylistItem-name <неназваний> PlaylistItem-title <безіменний> +All files could not be moved into Trash. MediaPlayer-RemovePLItemsCmd Не вдалося відправити всі файли до кошика. Always on top MediaPlayer-Main Завжди зверху Aspect ratio MediaPlayer-Main Співідношення сторін Attributes MediaPlayer-Main Атрибути @@ -27,8 +28,12 @@ Copy Entries MediaPlayer-CopyPLItemsCmd Копіювати записи Copy Entry MediaPlayer-CopyPLItemsCmd Копіювати запис Drop files to play MediaPlayer-Main Скинути файли для відтворення Edit MediaPlayer-PlaylistWindow Редагувати +Error: MediaPlayer-Main Помилка: +Error: MediaPlayer-RemovePLItemsCmd Помилка: +File info… MediaPlayer-Main Інформація про файл… Full screen MediaPlayer-Main Повний екран Full volume MediaPlayer-SettingsWindow Повна гучність +Gets the URI of the currently playing item. MediaPlayer-Main Отримати URI, який відтворюєтся в даний момент. Gets/sets the volume (0.0-2.0). MediaPlayer-Main Отримання/встановлення гучності (0.0-2.0). Hide interface MediaPlayer-Main Приховати інтерфейс Import Entries MediaPlayer-ImportPLItemsCmd Імпортувати записи @@ -36,6 +41,7 @@ Import Entry MediaPlayer-ImportPLItemsCmd Імпортувати запис Internal error (locking failed). Saving the playlist failed. MediaPlayer-PlaylistWindow Внутрішня помилка (закриття призупинено). Збереження списку відтворення призупинено. Internal error (malformed message). Saving the playlist failed. MediaPlayer-PlaylistWindow Внутрішня помилка (неправильне повідомлення). Збереження списку відтворення призупинено. Internal error (out of memory). Saving the playlist failed. MediaPlayer-PlaylistWindow Внутрішня помилка (закінчилась память). Збереження списку відтворення призупинено. +It appears the media server is not running.\nWould you like to start it ? MediaPlayer-Main Схоже медіа сервер не працює.\nБажаєте запустити його? Large MediaPlayer-SettingsWindow Великий Lock Peaks MediaPlayer-PeakView Блокувати Піки Low volume MediaPlayer-SettingsWindow Мала гучність @@ -46,7 +52,9 @@ Move Entry MediaPlayer-MovePLItemsCmd Перемістити запис Move Into Trash Error MediaPlayer-RemovePLItemsCmd Помилка переміщення в корзину Mute MediaPlayer-Main Заглушити Muted MediaPlayer-SettingsWindow Приглушений +New player… MediaPlayer-Main Новий програвач… Next MediaPlayer-Main Наступний +No aspect correction MediaPlayer-Main Немає корекції погляду None of the files you wanted to play appear to be media files. MediaPlayer-Main Жоден з файлів, які ви хотіли відкрити не є медіа файлами. Nothing to Play MediaPlayer-Main Нічого для відтворення OK MediaPlayer-Main Гаразд @@ -58,11 +66,14 @@ Open MediaPlayer-Main Відкрити Open MediaPlayer-PlaylistWindow Відкрити Open Clips MediaPlayer-Main Відкрити Кліпи Open Playlist MediaPlayer-PlaylistWindow Відкрити список відтворення +Open file… MediaPlayer-Main Відкрити файл… +Open… MediaPlayer-PlaylistWindow Відкрити… Pause MediaPlayer-Main Пауза Pause playback. MediaPlayer-Main Пауза відтворення. Play MediaPlayer-Main Відтворити Play mode MediaPlayer-SettingsWindow Режим відтворення Playlist MediaPlayer-PlaylistWindow Список відтворення +Playlist… MediaPlayer-Main Список відтворення… Prev MediaPlayer-Main Попереднє Quit MediaPlayer-Main Вийти Randomize MediaPlayer-PlaylistWindow Випадковий @@ -72,7 +83,7 @@ Redo MediaPlayer-PlaylistWindow Переробити Remove Entries MediaPlayer-RemovePLItemsCmd Видалити записи Remove Entries into Trash MediaPlayer-RemovePLItemsCmd Знищити записи в кошику Remove Entry MediaPlayer-RemovePLItemsCmd Видалити запис -Remove Entry into Trash MediaPlayer-RemovePLItemsCmd Видалити запис в корзині +Remove Entry into Trash MediaPlayer-RemovePLItemsCmd Видалити запис з кошика Revert MediaPlayer-SettingsWindow Повернути Save MediaPlayer-Main Зберегти Save MediaPlayer-PlaylistWindow Зберегти @@ -80,16 +91,20 @@ Save Playlist MediaPlayer-PlaylistWindow Зберегти список відт Save as… MediaPlayer-PlaylistWindow Зберегти як… Save error MediaPlayer-PlaylistWindow Помилка збереження Saving the playlist failed.\n\nError: MediaPlayer-PlaylistWindow Збереження списку відтворення призупинено.\n\nПомилка: +Saving the playlist failed:\n\nError: MediaPlayer-PlaylistWindow Збереження списку відтворення призупинено:\n\nПомилка: Scale movies smoothly (non-overlay mode) MediaPlayer-SettingsWindow Масштаб зображення зглажений (без режиму накладання) +Settings… MediaPlayer-Main Налаштування… Skip to the next track. MediaPlayer-Main Пропустити до наступного треку Skip to the previous track. MediaPlayer-Main Повернутися до попереднього треку Small MediaPlayer-SettingsWindow Малий +Some files could not be moved into Trash. MediaPlayer-RemovePLItemsCmd Деякі файли не можуть бути переміщені в кошик. Start media server MediaPlayer-Main Запустити Медіа сервер Start playing. MediaPlayer-Main Почати відтворення Stop MediaPlayer-Main Зупинити Stop playing. MediaPlayer-Main Зупинити відтворення Stream settings MediaPlayer-Main Настройки потоку Subtitles MediaPlayer-Main Субтитри +The file'%filename' could not be opened.\n\n MediaPlayer-Main Файл'%filename' неможливо відкрити.\n\n There is no decoder installed to handle the file format, or the decoder has trouble with the specific version of the format. MediaPlayer-Main Немає встановленого декодера щоб підтримував файл цього формату, або у декодера є проблема з спеціальною версією формату. Toggle mute. MediaPlayer-Main Вимкнути звук. Toggle pause/play. MediaPlayer-Main Перемикання пауза/відтворення @@ -102,7 +117,7 @@ Undo MediaPlayer-PlaylistWindow Скасувати Use hardware video overlays if available MediaPlayer-SettingsWindow Використати апаратне відеонакладення Якщо доступне Video MediaPlayer-Main Відео Video track MediaPlayer-Main Відео трек -View options MediaPlayer-SettingsWindow Переглянути налаштування +View options MediaPlayer-SettingsWindow Налаштування перегляду Volume MediaPlayer-Main Гучність none Audio track menu нічого none Subtitles menu нічого diff --git a/data/catalogs/apps/midiplayer/uk.catkeys b/data/catalogs/apps/midiplayer/uk.catkeys index b192dfc000..efa4ebab10 100644 --- a/data/catalogs/apps/midiplayer/uk.catkeys +++ b/data/catalogs/apps/midiplayer/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-MidiPlayer 3885957623 +1 ukrainian x-vnd.Haiku-MidiPlayer 4180509704 Cavern Main Window Печера Closet Main Window Комірка Could not load song Main Window Не вдалося завантажити мелодію @@ -8,6 +8,7 @@ Garage Main Window Гараж Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Haiku MIDI Player 1.0.0 beta\n\nЦя крихітна програма\nвміє відтворювати тисячі\nпростих мелодій Igor's lab Main Window Лабораторія Ігоря Live input: Main Window Прямий вхід: +MidiPlayer System name Програвач Midi None Main Window Жоден OK Main Window Гаразд Off Main Window Вимкнути diff --git a/data/catalogs/apps/musiccollection/uk.catkeys b/data/catalogs/apps/musiccollection/uk.catkeys new file mode 100644 index 0000000000..6f25bf5faf --- /dev/null +++ b/data/catalogs/apps/musiccollection/uk.catkeys @@ -0,0 +1,2 @@ +1 ukrainian x-vnd.MusicCollection 3521119930 +Music Collection System name Музична колекція diff --git a/data/catalogs/apps/networkstatus/uk.catkeys b/data/catalogs/apps/networkstatus/uk.catkeys index d3a77eb6fc..76e58d4b2d 100644 --- a/data/catalogs/apps/networkstatus/uk.catkeys +++ b/data/catalogs/apps/networkstatus/uk.catkeys @@ -1,14 +1,22 @@ -1 ukrainian x-vnd.Haiku-NetworkStatus 2046228013 +1 ukrainian x-vnd.Haiku-NetworkStatus 853756860 +%ifaceName information:\n NetworkStatusView %ifaceName інформація:\n NetworkStatusView <Бездротова мережа не знайдена> +Address NetworkStatusView Адреса Broadcast NetworkStatusView Передача Configuring NetworkStatusView Конфігурування Could not join wireless network:\n NetworkStatusView Бездротові мережі не під'єднані:\n Install in Deskbar NetworkStatus Встановити у Deskbar +Launching the network preflet failed.\n\nError: NetworkStatusView Під'єднання мережевого придатку призупинене.\n\nПомилка: Netmask NetworkStatusView Нетмаска +NetworkStatus System name Стан мережі +NetworkStatus options:\n\t--deskbar\tautomatically add replicant to Deskbar\n\t--help\t\tprint this info and exit\n NetworkStatus Стан мережі опції:\n\t--deskbar\tавтоматично додати реплікант до Deskbar\n\t--help\t\tвидрукувати це повідомлення і вийти\n NetworkStatus\n\twritten by %1 and Hugo Santos\n\t%2, Haiku, Inc.\n NetworkStatusView Стан мережі\n\tавтор %1 і Hugo Santos\n\t%2, Haiku, Inc.\n No link NetworkStatusView Посилання відсутнє No stateful configuration NetworkStatusView Немає стабільної конфігурації +OK NetworkStatusView Гаразд Open network preferences… NetworkStatusView Відкрити настройки мережі… +Quit NetworkStatusView Вийти Ready NetworkStatusView Готово Run in window NetworkStatus Запустити у вікні Unknown NetworkStatusView Невідомий +You can run NetworkStatus in a window or install it in the Deskbar. NetworkStatus Ви можете переглянути стан мережі у вікні або встановити в Deskbar. diff --git a/data/catalogs/apps/networktime/zh_hans.catkeys b/data/catalogs/apps/networktime/zh_hans.catkeys deleted file mode 100644 index e96f779887..0000000000 --- a/data/catalogs/apps/networktime/zh_hans.catkeys +++ /dev/null @@ -1 +0,0 @@ -1 simplified_chinese x-vnd.Haiku-NetworkTime 0 diff --git a/data/catalogs/apps/poorman/be.catkeys b/data/catalogs/apps/poorman/be.catkeys index a66b1723f3..5f9076b684 100644 --- a/data/catalogs/apps/poorman/be.catkeys +++ b/data/catalogs/apps/poorman/be.catkeys @@ -34,7 +34,7 @@ Logging view PoorMan Від пратакаліравання Max. simultaneous connections: PoorMan Макс. колькасць адначасовых спалучэнняў: OK PoorMan ОК Please choose the folder to publish on the web.\n\nYou can have PoorMan create a default \"public_html\" in your home folder.\nOr you select one of your own folders instead. PoorMan Калі ласка, выберыце каталог, які трэба апублікаваць.\n\nPoorMan можа стварыць для вас стандартны каталог \"public_html\" у хатнім каталозе.\nАбо вы можаце самі выбраць пажаданы каталог. -PoorMan Application name Валацуга (Web-сервер) +PoorMan System name Валацуга (Web-сервер) PoorMan settings PoorMan Наладкі PoorMan Quit PoorMan Выйсці Run server PoorMan Запусціць сервер diff --git a/data/catalogs/apps/poorman/ru.catkeys b/data/catalogs/apps/poorman/ru.catkeys index c1cef690fd..9cf8be8a55 100644 --- a/data/catalogs/apps/poorman/ru.catkeys +++ b/data/catalogs/apps/poorman/ru.catkeys @@ -34,7 +34,7 @@ Logging view PoorMan Окно логирования Max. simultaneous connections: PoorMan Максимум одновременных соединений: OK PoorMan ОК Please choose the folder to publish on the web.\n\nYou can have PoorMan create a default \"public_html\" in your home folder.\nOr you select one of your own folders instead. PoorMan Пожалуйста, выберите папку для публикации.\n\nPoorMan может создать папку по умолчанию public_html в вашей домашней папке.\nИли вы можете выбрать любую другую папку. -PoorMan Application name Вебсервер +PoorMan System name Вебсервер PoorMan settings PoorMan Настройки PoorMan Quit PoorMan Выход Run server PoorMan Запустиь сервер diff --git a/data/catalogs/apps/powerstatus/uk.catkeys b/data/catalogs/apps/powerstatus/uk.catkeys index f0b5b2d539..aedf42cbd8 100644 --- a/data/catalogs/apps/powerstatus/uk.catkeys +++ b/data/catalogs/apps/powerstatus/uk.catkeys @@ -1,22 +1,45 @@ -1 ukrainian x-vnd.Haiku-PowerStatus 1297803567 +1 ukrainian x-vnd.Haiku-PowerStatus 1335646776 About PowerStatus про +About… PowerStatus Про… Battery charging PowerStatus Батарея заряджається Battery discharging PowerStatus Батарея розряджена Battery info PowerStatus Дані батареї Battery info… PowerStatus Дані батареї… Battery unused PowerStatus Батарея не використовується +Capacity granularity 1: PowerStatus Градація ємності 1: +Capacity granularity 2: PowerStatus Градація ємності 2: +Capacity: PowerStatus Ємність: +Current rate: PowerStatus Біжучий розряд: +Design capacity low warning: PowerStatus Попередження про зниження проектної ємності: +Design capacity warning: PowerStatus Попередження про проектну ємність: Design capacity: PowerStatus Проектна ємність: +Design voltage: PowerStatus Проектна напруга: +Empty battery slot PowerStatus Слот підключення батареї пустий +Extended battery info PowerStatus Розширені дані батареї Install in Deskbar PowerStatus Встановити в Deskbar +Last full charge: PowerStatus Остання повна зарядка: +Model number: PowerStatus Номер моделі: +OEM info: PowerStatus Дані OEM: OK PowerStatus Гаразд Power status box PowerStatus Вікно стану живлення PowerStatus\nwritten by Axel Dörfler, Clemens Zeidler\nCopyright 2006, Haiku, Inc.\n PowerStatus PowerStatus\nавтори Axel Dörfler, Clemens Zeidler\nCopyright 2006, Haiku, Inc.\n Quit PowerStatus Вийти Run in window PowerStatus Запустити у вікні +Serial number: PowerStatus Серійний номер: Show percent PowerStatus Показати процент Show status icon PowerStatus Показати іконку стану Show text label PowerStatus Показати текстові мітки Show time PowerStatus Показати час +Technology: PowerStatus Технологія: +Type: PowerStatus Тип: +You can run PowerStatus in a window or install it in the Deskbar. PowerStatus Ви можете запустити Стан живлення у вікні або встановити його у Deskbar. charging PowerStatus зарядка discharging PowerStatus розрядка +mA PowerStatus mA +mAh PowerStatus mAh +mV PowerStatus mV +mW PowerStatus mW +mWh PowerStatus mWh +no battery PowerStatus батарея відсутня non-rechargeable PowerStatus той що не може перезаряджатись rechargeable PowerStatus та що може перезаряджатись diff --git a/data/catalogs/apps/workspaces/uk.catkeys b/data/catalogs/apps/workspaces/uk.catkeys index 8b293f97bc..7b2b1432b6 100644 --- a/data/catalogs/apps/workspaces/uk.catkeys +++ b/data/catalogs/apps/workspaces/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Be-WORK 576959994 +1 ukrainian x-vnd.Be-WORK 3592128290 About Workspaces… Workspaces Про Робочі простори… Always on top Workspaces Завжди поверх усіх Auto-raise Workspaces Автоматичне спливання @@ -7,5 +7,7 @@ Invalid argument: %s\n Workspaces Невірний аргумент: %s\n OK Workspaces Гаразд Quit Workspaces Вийти Show window border Workspaces Показувати рамку вікна +Show window tab Workspaces Показати закладку вікна Usage: %s [options] [workspace]\nwhere \"options\" is one of:\n --notitle\t\ttitle bar removed. border and resize kept.\n --noborder\t\ttitle, border, and resize removed.\n --avoidfocus\t\tprevents the window from being the target of keyboard events.\n --alwaysontop\t\tkeeps window on top\n --notmovable\t\twindow can't be moved around\n --autoraise\t\tauto-raise the workspace window when it's at the screen corner\n --help\t\tdisplay this help and exit\nand \"workspace\" is the number of the Workspace to which to switch (0-31)\n Workspaces Використання: %s [опції] [простір]\nде \"опції\" одне з:\n --notitle\t\показувати без заголовка зі збереженням його меж.\n --noborder\t\те ж саме але без збереження меж.\n --avoidfocus\t\tне давати вікну захоплювати клавіатуру.\n --alwaysontop\t\tрозташовувати вікно спереду\n --notmovable\t\tзаборона переміщення вікна\n --autoraise\t\Вікно простору спливає коли знаходиться біля краю екрану\n --help\t\tпоказати цей текст і вийти\nі \"простір\" номер потрібного простору, переключається в межах (0-31)\n +Workspaces System name Робочі простори Workspaces\nwritten by %1, and %2.\n\nCopyright %3, Haiku.\n\nSend windows behind using the Option key. Move windows to front using the Control key.\n Workspaces Робочі простори\nавтори by %1, and %2.\n\nCopyright %3, Haiku.\n\nВідправляйте вікно у тло кнопкою Option. Рухайте вікна вперед кнопкою CTRL.\n diff --git a/data/catalogs/bin/desklink/uk.catkeys b/data/catalogs/bin/desklink/uk.catkeys new file mode 100644 index 0000000000..6a78c17167 --- /dev/null +++ b/data/catalogs/bin/desklink/uk.catkeys @@ -0,0 +1,14 @@ +1 ukrainian x-vnd.Haiku-desklink 3053930521 +%g dB MediaReplicant %g dB +%ld dB VolumeControl %ld dB +Beep MediaReplicant Біп +Control physical output MediaReplicant Регулятор фізичного виходу +Couldn't launch MediaReplicant Під'єднання відсутнє +Media preferences… MediaReplicant Настройки медіа… +No media server running VolumeControl Не запущено медіа сервер +OK MediaReplicant Гаразд +Open MediaPlayer MediaReplicant Відкрити MediaPlayer +Options MediaReplicant Опції +Sound preferences… MediaReplicant Настройки звуку… +Volume VolumeControl Гучність +desklink MediaReplicant desklink diff --git a/data/catalogs/bin/dstcheck/uk.catkeys b/data/catalogs/bin/dstcheck/uk.catkeys index 127a1c0ca7..62807cade2 100644 --- a/data/catalogs/bin/dstcheck/uk.catkeys +++ b/data/catalogs/bin/dstcheck/uk.catkeys @@ -1,4 +1,6 @@ -1 ukrainian x-vnd.Haiku-cmd-dstconfig 1891332014 +1 ukrainian x-vnd.Haiku-cmd-dstconfig 2337923203 .\n\nIs this the correct time? dstcheck .\n\nЦей час правильний? -Ask me later dstcheck Запитати мене пізніше -Attention!\n\nBecause of the switch from daylight saving time, your computer's clock may be an hour off.\nYour computer thinks it is dstcheck Увага!\n\nЧерез перехід з літнього часу, годинник вашого комп’ютера може бути зміщеним на годину.\nВін думає, що зараз +Ask me later dstcheck Запитати пізніше +Attention!\n\nBecause of the switch from daylight saving time, your computer's clock may be an hour off.\nYour computer thinks it is dstcheck Увага!\n\nЧерез перехід з літнього часу, годинник вашого комп’ютера може бути зміщеним на годину.\nВін думає, що зараз це є +Manually adjust time… dstcheck Ручна зміна часу… +Use this time dstcheck Використовувати цей час diff --git a/data/catalogs/bin/screen_blanker/uk.catkeys b/data/catalogs/bin/screen_blanker/uk.catkeys new file mode 100644 index 0000000000..4c55932b91 --- /dev/null +++ b/data/catalogs/bin/screen_blanker/uk.catkeys @@ -0,0 +1,4 @@ +1 ukrainian x-vnd.Haiku.screenblanker 3643966493 +Enter password: Screensaver password dialog Введіть гасло: +Unlock Screensaver password dialog Розблокувати +Unlock screen saver Screensaver password dialog Розблокувати Зберігач екрану diff --git a/data/catalogs/kits/locale/uk.catkeys b/data/catalogs/kits/locale/uk.catkeys index 24ed293e08..30f0f72f9c 100644 --- a/data/catalogs/kits/locale/uk.catkeys +++ b/data/catalogs/kits/locale/uk.catkeys @@ -1,15 +1,34 @@ -1 ukrainian system 845452856 +1 ukrainian system 180647795 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB %3.2f MiB StringForSize %3.2f MiB %d bytes StringForSize %d байт + Menu <пусто> +About %app% AboutMenuItem Про %app% +About %app… Dragger Про %app… About… AboutWindow Про… Blue: ColorControl Синій: +Can't delete this replicant from its original application. Life goes on. Dragger Неможливо видалити реплікант з рідного додатку. Життя продовжується. +Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Неможливо створити реплікант для \"%опису\".\n%помилки +Cannot locate the application for the replicant. No application signature supplied.\n%error ZombieReplicantView Неможливо визначити додаток для репліканту. Незнайдено сигнатуру додатку.\n%помилка Close AboutWindow Закрити Copy TextView Копіювати +Copyright © %years% Haiku, Inc. AboutWindow Copyright © %years% Haiku, Inc. +Cut TextView Вирізати +Error PrintJob Помилка +Error ZombieReplicantView Помилка Green: ColorControl Зелений: +No Pages to print! PrintJob Жодної сторінки для друку! +OK Dragger Гаразд +OK PrintJob Гаразд +OK ZombieReplicantView Гаразд +Paste TextView Вставити +Print Server is not responding. PrintJob Принт сервер недоступний. Red: ColorControl Червоний: Redo TextView Відмінити відміну +Remove replicant Dragger Видалити реплікант +Select All TextView Вибрати все Undo TextView Відмінити +Warning Dragger Увага Written by: AboutWindow Автор: diff --git a/data/catalogs/kits/mail/uk.catkeys b/data/catalogs/kits/mail/uk.catkeys new file mode 100644 index 0000000000..ad403ab52f --- /dev/null +++ b/data/catalogs/kits/mail/uk.catkeys @@ -0,0 +1,10 @@ +1 ukrainian x-vnd.Haiku-libmail 161731481 +Connection type: ProtocolConfigView Тип підключення: +Leave mail on server ProtocolConfigView Зберігати пошту на сервер +Login type: ProtocolConfigView Тип логування: +Mail server: ProtocolConfigView Поштовий сервер: +Partially download messages larger than ProtocolConfigView Завантажувати частково повідомлення більші ніж +Password: ProtocolConfigView Гасло: +Remove mail from server when deleted ProtocolConfigView Видалити пошту з серверу після знищення +Select… MailKit Вибрати… +Username: ProtocolConfigView Користувач: diff --git a/data/catalogs/preferences/appearance/uk.catkeys b/data/catalogs/preferences/appearance/uk.catkeys index 04d37c387b..48dfd32ce2 100644 --- a/data/catalogs/preferences/appearance/uk.catkeys +++ b/data/catalogs/preferences/appearance/uk.catkeys @@ -1,7 +1,11 @@ -1 ukrainian x-vnd.Haiku-Appearance 1227622574 +1 ukrainian x-vnd.Haiku-Appearance 3577998894 +About DecorSettingsView Про +About Decerator DecorSettingsView Про Декоратор Antialiasing APRWindow Зглажування Antialiasing menu AntialiasingSettingsView Меню зглажування Antialiasing type: AntialiasingSettingsView Тип зглажування: +Appearance System name Оформлення +Choose Decorator DecorSettingsView Вибір декоратора Colors APRWindow Кольори Control background Colors tab Тло елементу Control border Colors tab Межа елемента @@ -22,6 +26,7 @@ Menu item text Colors tab Текст пункта меню Monospaced fonts only AntialiasingSettingsView Тільки моноширинні шрифти Navigation base Colors tab Основа навігації Navigation pulse Colors tab Навігація рulse +OK DecorSettingsView Згода Off AntialiasingSettingsView Слабе On AntialiasingSettingsView Увімкнути Panel background Colors tab Панель @@ -38,5 +43,7 @@ Subpixel based anti-aliasing in combination with glyph hinting is not available Success Colors tab Успіх Tooltip background Colors tab Тло підказки Tooltip text Colors tab Текст підказки +Window Decorator APRWindow Декоратор вікна +Window Decorator: DecorSettingsView Декоратор вікна: Window tab Colors tab Заголовок вікна Window tab text Colors tab Текст заголовка вікна diff --git a/data/catalogs/preferences/backgrounds/uk.catkeys b/data/catalogs/preferences/backgrounds/uk.catkeys index 534ebd1016..9e067a1db9 100644 --- a/data/catalogs/preferences/backgrounds/uk.catkeys +++ b/data/catalogs/preferences/backgrounds/uk.catkeys @@ -1,6 +1,7 @@ -1 ukrainian x-vnd.Haiku-Backgrounds 4220509773 +1 ukrainian x-vnd.Haiku-Backgrounds 3513602073 All workspaces Main View На всі робочі простори Apply Main View Використати +Backgrounds System name Тло Center Main View Відцентрувати Current workspace Main View Поточний робочий простір Default Main View По замовчуванню diff --git a/data/catalogs/preferences/bluetooth/uk.catkeys b/data/catalogs/preferences/bluetooth/uk.catkeys index fe4d49d12e..12e9ecdeeb 100644 --- a/data/catalogs/preferences/bluetooth/uk.catkeys +++ b/data/catalogs/preferences/bluetooth/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-BluetoothPrefs 4253957200 +1 ukrainian x-vnd.Haiku-BluetoothPrefs 4055730587 15 secs Settings view 15 сек. 61 secs Settings view 61 сек. About Bluetooth… Window Про Bluetooth… @@ -7,6 +7,7 @@ Add… Remote devices Додати… Always ask Settings view Завжди питати As blocked Remote devices Як заблокований Authenticate Extended local device view Справдити +Bluetooth System name Bluetooth Check that the Bluetooth capabilities of your remote device are activated. Press 'Inquiry' to start scanning. The needed time for the retrieval of the names is unknown, although should not take more than 3 seconds per device. Afterwards you will be able to add them to your main list, where you will be able to pair with them. Inquiry panel Переконайтесь, що функція Bluetooth віддаленого пристрою активована. Натисніть «Запит» для початку сканування. Час для отримання імен не повинен перевищувати 3 секунди. Після цього ви зможете додати їх до головного списку, де потім з’єднуватися з ними. Connections & channels… Window Список під'єднань і каналів… Default inquiry time: Settings view Час запиту по замовчуванню: diff --git a/data/catalogs/preferences/cpufrequency/uk.catkeys b/data/catalogs/preferences/cpufrequency/uk.catkeys index 519bdc87d2..2c20666d13 100644 --- a/data/catalogs/preferences/cpufrequency/uk.catkeys +++ b/data/catalogs/preferences/cpufrequency/uk.catkeys @@ -1,11 +1,13 @@ -1 ukrainian x-vnd.Haiku-CPUFrequencyPref 407096520 +1 ukrainian x-vnd.Haiku-CPUFrequencyPref 3079996868 CPU frequency status view CPU Frequency View Статистика частоти ЦП +CPUFrequency System name Частота процесора CPUFrequency\n\twritten by Clemens Zeidler\n\tCopyright 2009, Haiku, Inc.\n Status view Частота процесора\n\Автор Клеменс Зейдлер\n\tCopyright 2009, Haiku, Inc.\n Defaults Pref Window По замовчуванню Dynamic performance Status view Динамічна продуктивність Dynamic stepping CPU Frequency View Динамічна зміна High performance Status view Висока продуктивність Install replicant into Deskbar CPU Frequency View Встановити реплікант в Deskbar +Integration time [ms]: CPU Frequency View Час інтеграції [мс]: Launching the CPU frequency preflet failed.\n\nError: Status view Програму Частота процесора не вдалося запустити.\n\nПомилка: Low energy Status view Мале споживання Ok Status view Гаразд @@ -15,3 +17,4 @@ Revert Pref Window Повернути Set state Status view Встановити стан Step up by CPU usage Color Step View Крок вгору по продуктивності ЦП: Stepping policy CPU Frequency View Настройка кроку зміни частоти ЦП +Stepping policy: CPU Frequency View Настройка кроку зміни частоти ЦП: diff --git a/data/catalogs/preferences/datatranslations/uk.catkeys b/data/catalogs/preferences/datatranslations/uk.catkeys index 5d9461ae29..ff476ddcc0 100644 --- a/data/catalogs/preferences/datatranslations/uk.catkeys +++ b/data/catalogs/preferences/datatranslations/uk.catkeys @@ -1,14 +1,18 @@ -1 ukrainian x-vnd.Haiku-DataTranslations 3458095697 +1 ukrainian x-vnd.Haiku-DataTranslations 3820343452 An item named '%name' already exists in the Translators folder! Shall the existing translator be overwritten? DataTranslations Елемент з назвою '%name' повністю присутній у папці Перетворювачів! Переписати існуючий Перетворювач? Cancel DataTranslations Відміна Could not install %s:\n%s DataTranslations Неможливо встановити %s:\n%s +DataTranslations System name Перетворення даних +DataTranslations - Error DataTranslations Перетворення даних - Помилка DataTranslations - Note DataTranslations Перетворення даних — Заувага Info DataTranslations інформація Info: DataTranslations Інформація: Name: DataTranslations І’мя: +Name: %s \nVersion: %ld.%ld.%ld\n\nInfo:\n%s\n\nPath:\n%s\n DataTranslations Ім'я: %s \nВерсія: %ld.%ld.%ld\n\nІнфо:\n%s\n\nШлях:\n%s\n OK DataTranslations Гаразд Overwrite DataTranslations Перезаписати Path: DataTranslations Шлях: The item '%name' does not appear to be a Translator and will not be installed. DataTranslations Елемент '%name' не є перетворювачем і його не буде встановлено. The new translator has been installed successfully. DataTranslations Новий транслятор був успішно встановлений. +Use this control panel to set default values for translators, to be used when no other settings are specified by an application. DataTranslations Використовуйте цю панель для встановлення параметрів по замовчуванню для перетворювачів, особливо коли вони не визначені додатком. Version: DataTranslations Версія: diff --git a/data/catalogs/preferences/deskbar/uk.catkeys b/data/catalogs/preferences/deskbar/uk.catkeys new file mode 100644 index 0000000000..93d6b76ba5 --- /dev/null +++ b/data/catalogs/preferences/deskbar/uk.catkeys @@ -0,0 +1,2 @@ +1 ukrainian x-vnd.Haiku-DeskbarPreferences 2340471461 +Deskbar System name Deskbar diff --git a/data/catalogs/preferences/filetypes/uk.catkeys b/data/catalogs/preferences/filetypes/uk.catkeys index e56d7fc30f..c5b73ee1fc 100644 --- a/data/catalogs/preferences/filetypes/uk.catkeys +++ b/data/catalogs/preferences/filetypes/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-FileTypes 15913470 +1 ukrainian x-vnd.Haiku-FileTypes 473999706 %1 application type Application Type Window %1 тип додатку %ld Application type%s could be removed. Application Types Window %ld Додаток type%s Неможливо видалити. %s file type FileType Window %s тип файлу @@ -12,15 +12,18 @@ Add icon… Icon View Додати іконку… Add new group New File Type Window Додати нову групу Add type New File Type Window Додати тип Add… Application Type Window Додати… +Add… FileTypes Window Додати… Alignment: Attribute Window Вирівнювання: Alpha Application Type Window Альфа Alpha Application Types Window Aльфа Application flags Application Type Window Флаги додатку Application type Application Type Window Тип додатку Application types Application Types Window Типи додатків +Application types… FileTypes Window Типи додатків… Args only Application Type Window Тільки аргументи Attribute Attribute Window Атрибут Attribute name: Attribute Window Ім'я атрибута: +Background app Application Type Window Додаток Тло Beta Application Type Window Бета Beta Application Types Window Бета Cancel Application Type Window Відмінити @@ -67,6 +70,7 @@ File could not be opened Preferred App Menu Файл неможливо від File recognition FileTypes Window Розпізнання файлу File type FileType Window Тип файлу FileTypes FileTypes Типи Файлів +FileTypes System name Типи файлів FileTypes request FileTypes Запит Типів Файлів FileTypes request FileTypes Window Запит Типів Файлів FileTypes request Preferred App Menu Запит Типів Файлів @@ -98,6 +102,7 @@ New resource file… FileTypes Window Новий файл ресурсів… None FileTypes Window Немає OK FileTypes Гаразд Open file FileTypes Відкрити файл +Open… FileTypes Window Відкрити… Path: Application Types Window Шлях: Preferred application FileType Window Бажаний додаток Preferred application FileTypes Window Бажаний додаток @@ -114,6 +119,9 @@ Removing a super type cannot be reverted.\nAll file types that belong to this su Removing uninstalled application types Application Types Window Видалення типів для невстановлених додатків Right Attribute Window Attribute column alignment in Tracker Вправо Rule: FileTypes Window Правило: +Same as… FileType Window The same APPLICATION as ... Такий як… Заувага: такий додаток як ... +Same as… FileType Window The same TYPE as ... Такий як… Заувага: такий тип як ... +Same as… FileTypes Window Такий як… Save Application Type Window Зберегти Save into resource file… Application Type Window Зберегти інформацію про джерело файлу… Save request Application Type Window Зберегти запит @@ -121,8 +129,9 @@ Select preferred application FileType Window Вибрати бажаний до Select preferred application FileTypes Window Вибрати бажаний додаток Select same preferred application as FileType Window Вибрати за бажаний додаток Select same preferred application as FileTypes Window Вибрати такий самий бажаний додаток як -Select same type as FileType Window Вибрати такий самий тип як +Select same type as FileType Window Вибрати такий тип як Select… FileType Window Вибрати… +Select… FileTypes Window Вибрати… Set Preferred Application Preferred App Menu Встановити бажаний додаток Settings FileTypes Window Налаштування Short description: Application Type Window Короткий опис: diff --git a/data/catalogs/preferences/fonts/uk.catkeys b/data/catalogs/preferences/fonts/uk.catkeys index a251598f19..9c6e6461c8 100644 --- a/data/catalogs/preferences/fonts/uk.catkeys +++ b/data/catalogs/preferences/fonts/uk.catkeys @@ -1,7 +1,9 @@ -1 ukrainian x-vnd.Haiku-Fonts 2902081521 +1 ukrainian x-vnd.Haiku-Fonts 4164233892 Bold font: Font view Виділений шрифт: Defaults Main window По замовчуванню Fixed font: Font view Моноширний шрифт: +Fonts System name Шрифти +Fonts\n\tCopyright 2004-2005, Haiku.\n\n main Шрифти\n\tCopyright 2004-2005, Haiku.\n\n Menu font: Font view Шрифт меню: OK main Гаразд Plain font: Font view Простий шрифт: diff --git a/data/catalogs/preferences/keyboard/uk.catkeys b/data/catalogs/preferences/keyboard/uk.catkeys index 58c37f7b0f..03f05c5249 100644 --- a/data/catalogs/preferences/keyboard/uk.catkeys +++ b/data/catalogs/preferences/keyboard/uk.catkeys @@ -1,8 +1,9 @@ -1 ukrainian x-vnd.Haiku-Keyboard 1078858058 +1 ukrainian x-vnd.Haiku-Keyboard 1711838804 Defaults KeyboardWindow По замовчуванню Delay until key repeat KeyboardView Затримка при повторі Fast KeyboardView Швидко Key repeat rate KeyboardView Швидкість повтору клавіші +Keyboard System name Клавіатура Long KeyboardView Довго OK KeyboardApplication Гаразд Revert KeyboardWindow Повернути diff --git a/data/catalogs/preferences/keymap/uk.catkeys b/data/catalogs/preferences/keymap/uk.catkeys index ae94a8f3f4..8c59a684d1 100644 --- a/data/catalogs/preferences/keymap/uk.catkeys +++ b/data/catalogs/preferences/keymap/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-Keymap 3858687220 +1 ukrainian x-vnd.Haiku-Keymap 1259868356 (Current) Keymap window (Активна) Acute trigger Keymap window Акюте Circumflex trigger Keymap window Ціркумфлекс @@ -6,6 +6,7 @@ Diaeresis trigger Keymap window Діарезіс File Keymap window Файл Font Keymap window Шрифт Grave trigger Keymap window Апостроф +Keymap System name Розкладка Layout Keymap window Макет Open… Keymap window Відкрити… Quit Keymap window Вихід diff --git a/data/catalogs/preferences/locale/uk.catkeys b/data/catalogs/preferences/locale/uk.catkeys index 5325f95906..bb106f2951 100644 --- a/data/catalogs/preferences/locale/uk.catkeys +++ b/data/catalogs/preferences/locale/uk.catkeys @@ -1,24 +1,31 @@ -1 ukrainian x-vnd.Haiku-Locale 558426720 +1 ukrainian x-vnd.Haiku-Locale 1488345554 12 hour TimeFormatSettings 12 годин 24 hour TimeFormatSettings 24 години Available languages Locale Preflet Window Доступні мови +Cancel Locale Preflet Window Відміна Currency TimeFormatSettings Валюта Date TimeFormatSettings Дата Defaults Locale Preflet Window По замовчуванню +Deskbar and Tracker need to be restarted for this change to take effect. Would you like to restart them now? Locale Preflet Window Deskbar і Tracker потребують перезавантаження для вступу змін в силу. Ви бажаєте перезавантажитись? Formatting Locale Preflet Window Форматування Full format: TimeFormatSettings Повний формат: Language Locale Preflet Window Мова Locale Locale Preflet Локаль Locale Locale Preflet Window Локаль +Locale System name Локаль +Long format: TimeFormatSettings Звичний формат: Medium format: TimeFormatSettings Середній формат: Negative: TimeFormatSettings Негатив: Numbers TimeFormatSettings Номери OK Locale Preflet Window Гаразд +Options Locale Preflet Window Опції Positive: TimeFormatSettings Позитив: Preferred languages Locale Preflet Window Мови, що переважають +Restart Locale Preflet Window Перезавантаження Revert Locale Preflet Window Повернути Short format: TimeFormatSettings Скорочений формат: Time TimeFormatSettings Час +Translate application and folder names in Deskbar and Tracker. Locale Preflet Window Перекласти додатки і назви папок в Deskbar і Tracker. Unable to find the available languages! You can't use this preflet! Locale Preflet Window Неможливо знайти доступні мови! Ви не можете використовувати цю функцію! Use month/day-names from preferred language TimeFormatSettings Використовувати назви місяця/дня для вибраної мови already chosen LanguageListView повністю закритий diff --git a/data/catalogs/preferences/mail/uk.catkeys b/data/catalogs/preferences/mail/uk.catkeys index 46b29a41b2..7d9858569e 100644 --- a/data/catalogs/preferences/mail/uk.catkeys +++ b/data/catalogs/preferences/mail/uk.catkeys @@ -1,24 +1,38 @@ -1 ukrainian x-vnd.Haiku-Mail 2363284004 +1 ukrainian x-vnd.Haiku-Mail 3957822883 Account name: Config Views Ім'я аккаунта: Account name: E-Mail Ім'я акаунту: +Account settings AutoConfigWindow Настройка аакунта Account settings Config Views Настройка аккаунта Accounts Config Window Аккаунти Add Config Window Додати Add filter Config Views Додати фільтр Always Config Window Завжди Apply Config Window Прийняти +Back AutoConfigWindow Назад Check every Config Window Перевіряти кожні Choose Protocol E-Mail Вибрати протокол +Create new account AutoConfigWindow Створити новий аккаунт +E-mail System name Пошта E-mail address: E-Mail Адреса E-mail : Edit mailbox menu… Config Window Редагувати почтове меню… +Enter a valid e-mail address. AutoConfigWindow Введіть дійсну поштову адресу. Error Config Window Помилка Error retrieving general settings: %s\n Config Window Помилка при відновленні основних настройок: %s\n +Finish AutoConfigWindow Фініш +Incoming Config Window Вхідні +Incoming E-Mail Вхідні Incoming mail filters Config Views Вхідний поштовий фільтр Login name: E-Mail Логін: Mail checking Config Window Перевірка пошти Miscellaneous Config Window Змішаний +Never Config Window show status window Ніколи +Next AutoConfigWindow Наступне +OK AutoConfigWindow Гаразд OK Config Views Гаразд OK Config Window Гаразд +Only when dial-up is connected Config Window Тільки при включеному діалапі +Outgoing Config Window Вихідні +Outgoing E-Mail Вихідні Outgoing mail filters Config Views Фільтри вихідної пошти Password: E-Mail Пароль: Real name: Config Views Справжнє ім'я: @@ -36,7 +50,11 @@ The filter could not be moved. Deleting filter. Config Views Фільтр не While sending Config Window Поки відправляється While sending and receiving Config Window При відправці і отриманні \nThe general settings couldn't be reverted.\n\nError retrieving general settings:\n%s\n Config Window \nОсновні налаштування неможливо повернути.\n\nПомилка при відновленні налаштувань:\n%s\n +\n\nCreate a new account with the Add button.\n\nRemove an account with the Remove button on the selected item.\n\nSelect an item in the list to change its settings. Config Window \n\nСтворіть новий аккаунт натиснувши кнопку Додати .\n\nВидаліть аккаунт при допомозі кнопки Видалити на вибраному пункті\n\nВиберіть пункт зі списку при необхідності змініть його налаштувань. +\t\t· E-mail filters Config Window \t\t· поштовий фільтр +\t\t· Incoming Config Window \t\t· Вхідні +\t\t· Outgoing Config Window \t\t· Вхідні days Config Window днів hours Config Window годин minutes Config Window хвилин -never Config Window ніколи +never Config Window mail checking frequency ніколи diff --git a/data/catalogs/preferences/media/uk.catkeys b/data/catalogs/preferences/media/uk.catkeys index 7f4efb1c6b..3abb1a861c 100644 --- a/data/catalogs/preferences/media/uk.catkeys +++ b/data/catalogs/preferences/media/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-Media 293613603 +1 ukrainian x-vnd.Haiku-Media 1473363280 Media views <немає> Audio input: Media views Вхід звуку: Audio mixer Media Window Аудіо міксер @@ -11,6 +11,7 @@ Couldn't add volume control in Deskbar: %s\n Media views Неможливо д Couldn't remove volume control in Deskbar: %s\n Media views Неможливо видалити регулятор гучності з Deskbar: %s\n Defaults Media views По замовчуванню Done shutting down. Media Window Відбувається закриття. +Media System name Mедіа OK Media Window Гаразд Quit Media Window Вихід Ready for use… Media Window Готовий для використання… diff --git a/data/catalogs/preferences/mouse/uk.catkeys b/data/catalogs/preferences/mouse/uk.catkeys index 8ccc1922e5..97a6100ccf 100644 --- a/data/catalogs/preferences/mouse/uk.catkeys +++ b/data/catalogs/preferences/mouse/uk.catkeys @@ -1,10 +1,11 @@ -1 ukrainian x-vnd.Haiku-Mouse 1036956709 +1 ukrainian x-vnd.Haiku-Mouse 1033564338 ...by Andrew Edward McCall MouseApplication ...автор Andrew Edward McCall 1-Button SettingsView Однокнопочна 2-Button SettingsView Двухкнопочна 3-Button SettingsView Трикнопочна Accept first click SettingsView Сприймати перший клік Click to focus SettingsView Клацніть для встановлення фокуса +Click to focus and raise SettingsView натиснути для фокусування і спливання Defaults MouseWindow За замовчуванням Dig Deal MouseApplication Чудово Double-click speed SettingsView Швидкість подвійного кліку @@ -13,6 +14,7 @@ Fast SettingsView Швидко Focus follows mouse SettingsView Фокус слідкує за вказівником Focus mode: SettingsView Режим фокуса: Instant warp SettingsView Миттєве переміщення +Mouse System name Мишка Mouse acceleration SettingsView Прискорення вказівника Mouse speed SettingsView Швидкість переміщення вказівника Mouse type: SettingsView Тип миші: diff --git a/data/catalogs/preferences/network/uk.catkeys b/data/catalogs/preferences/network/uk.catkeys index 2185d31d27..64bf23d022 100644 --- a/data/catalogs/preferences/network/uk.catkeys +++ b/data/catalogs/preferences/network/uk.catkeys @@ -1,7 +1,8 @@ -1 ukrainian x-vnd.Haiku-Network 826313819 +1 ukrainian x-vnd.Haiku-Network 2324385456 EthernetSettingsView <немає жодної бездротової мережі> Adapter: EthernetSettingsView Адаптер: Apply EthernetSettingsView Застосовувати +Auto-configuring failed: EthernetSettingsView Автоматична настройка не вдалася: Choose automatically EthernetSettingsView Вибрати автоматично DHCP EthernetSettingsView DHCP DNS #1: EthernetSettingsView DNS #1: @@ -12,6 +13,7 @@ Gateway: EthernetSettingsView Шлюз: IP address: EthernetSettingsView IP адреса: Mode: EthernetSettingsView Режим: Netmask: EthernetSettingsView Маска: +Network System name Мережа Network: EthernetSettingsView Мережа: OK EthernetSettingsView Гаразд Revert EthernetSettingsView Повернутися diff --git a/data/catalogs/preferences/notifications/uk.catkeys b/data/catalogs/preferences/notifications/uk.catkeys index 985fe8e688..c85ed60281 100644 --- a/data/catalogs/preferences/notifications/uk.catkeys +++ b/data/catalogs/preferences/notifications/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-Notifications 3646488837 +1 ukrainian x-vnd.Haiku-Notifications 3818404871 Above icon DisplayView Про іконку Allowed NotificationView Дозволити An error occurred saving the preferences.\nIt's possible you are running out of disk space. GeneralView Виникла помилка збереження настройок.\nМожливо, що закінчилось місце на диску. @@ -8,6 +8,7 @@ Can't enable notifications at startup time, you probably don't have write permis Can't save preferences, you probably don't have write access to the boot settings directory. GeneralView Неможливо зберегти настройки, бо Ви не маєте доступу до директорії налаштувань загрузки. Can't save preferenes, you probably don't have write access to the settings directory or the disk is full. DisplayView Настройки зберегти не вдалося, можливо у Вас немає дозволу на запис для директорії настройок або диск повний. Cannot disable notifications because the server can't be reached. GeneralView Неможливо відмінити повідомлення, бо сервер недоступний. +Cannot enable notifications because the server cannot be found.\nThis means your InfoPopper installation was not successfully completed. GeneralView Неможливо включити повідомлення бо сервер не знайдено.\nЦе означає, що ваш InfoPopper встановлений не повністю. Disable notifications GeneralView Вимкнути повідомлення Display PrefletView Дисплей Enable notifications GeneralView Включити повідомлення @@ -27,15 +28,18 @@ Mini icon DisplayView Міні іконки No NotificationView Ні Notifications GeneralView Повідомлення Notifications NotificationView Повідомлення +Notifications System name Notifications Notifications cannot be stopped, because the server can't be reached. GeneralView Повідомлення не можуть бути зупинені, бо сервер недоступний. OK DisplayView Гаразд OK GeneralView Гаразд OK NotificationView Гаразд Progress NotificationView Хід Revert PrefletWin Повернути +Right of icon DisplayView Справа від значка Save PrefletWin Зберегти Search: NotificationView Пошук: The notifications server cannot be found, this means your InfoPopper installation was not successfully completed. GeneralView Невдалося знайти сервер повідомлень, Це означає, що установка InfoPopper Вами була завершена невдало. +The notifications server cannot be found.\nA possible cause is an installation not done correctly GeneralView Сервер повідомлень не знайдено.\nМожливо через некоректне встановлення There was a problem saving the preferences.\nIt's possible you don't have write access to the settings directory. DisplayView Виникли проблеми в збереженні настройок.\nМожливо у Вас немає дозволу на запис в директорію настройок. There was a problem saving the preferences.\nIt's possible you don't have write access to the settings directory. GeneralView Виникла проблема в збережені настройок.\nМожливо у Вас немає доступу на запис до директорії налаштувань. There was a problem saving the preferences.\nIt's possible you don't have write access to the settings directory. NotificationView Виникла проблема в збереженні настройок.\nМожливо у Вас немає доступу на запис до директорії налаштувань. diff --git a/data/catalogs/preferences/time/uk.catkeys b/data/catalogs/preferences/time/uk.catkeys index 9fb370c726..9e15f10006 100644 --- a/data/catalogs/preferences/time/uk.catkeys +++ b/data/catalogs/preferences/time/uk.catkeys @@ -1,7 +1,6 @@ -1 ukrainian x-vnd.Haiku-Time 4087029862 +1 ukrainian x-vnd.Haiku-Time 3898857456 Time <Інше> Current time: Time Поточний час: -Etc Time І т.д. OK Time Гаразд Preview time: Time Попередній час: Revert Time Повернути diff --git a/data/catalogs/preferences/tracker/uk.catkeys b/data/catalogs/preferences/tracker/uk.catkeys new file mode 100644 index 0000000000..561ef646c5 --- /dev/null +++ b/data/catalogs/preferences/tracker/uk.catkeys @@ -0,0 +1,2 @@ +1 ukrainian x-vnd.Haiku-TrackerPreferences 1627828833 +Tracker System name Tracker diff --git a/data/catalogs/servers/mail/uk.catkeys b/data/catalogs/servers/mail/uk.catkeys new file mode 100644 index 0000000000..9cd3cf01b0 --- /dev/null +++ b/data/catalogs/servers/mail/uk.catkeys @@ -0,0 +1,26 @@ +1 ukrainian x-vnd.Be-POST 1358359182 +%.1f / %.1f kb (%d / %d messages) StatusWindow %.1f / %.1f kb (%d / %d повідомлень) +%d / %d messages StatusWindow %d / %d повідомлень +%num new message DeskbarView %num нове повідомлення +%num new message for %name\n MailDaemon %num нове повідомлення для %name\n +%num new message. MailDaemon %num нове повідомлення. +%num new messages DeskbarView %num нових повідомлень +%num new messages for %name\n MailDaemon %num нових повідомлень для %name\n +%num new messages. MailDaemon %num нових повідомлень. + DeskbarView <акаунти відсутні> +Check for mail now DeskbarView Перевірити пошту зараз +Check for mails only DeskbarView Перевірити тільки пошту +Check mail now StatusWindow Перевірити пошту зараз +Create new message… DeskbarView Створити нове повідомлення… +Fetching mail for %name Notifier Отримання пошти для %name +Mail Status MailDaemon Стан пошти +Mail daemon status log MailDaemon Лог стану почтового демона +New Messages MailDaemon Нові повідомлення +No new messages DeskbarView Немає нових повідомлень +No new messages MailDaemon Немає нових повідомлень +No new messages. MailDaemon Немає нових повідомлень. +No new messages. StatusWindow Немає нових повідомлень. +Preferences… DeskbarView Настройки… +Send pending mails DeskbarView Відправити чергову пошту +Sending mail for %name Notifier Відправка пошти для %name +Shutdown mail services DeskbarView Закрити поштові сервіси diff --git a/data/catalogs/servers/mount/uk.catkeys b/data/catalogs/servers/mount/uk.catkeys index 166ac8a500..dfbc17cf73 100644 --- a/data/catalogs/servers/mount/uk.catkeys +++ b/data/catalogs/servers/mount/uk.catkeys @@ -1,8 +1,10 @@ -1 ukrainian x-vnd.Haiku-mount_server 676706323 +1 ukrainian x-vnd.Haiku-mount_server 1422362183 Cancel AutoMounter Відмінити Could not unmount disk \"%s\":\n\t%s AutoMounter Неможливо відмонтувати диск \"%s\":\n\t%s +Could not unmount disk \"%s\":\n\t%s\n\nShould unmounting be forced?\n\nNote: If an application is currently writing to the volume, unmounting it now might result in loss of data.\n AutoMounter Неможливо відмонтувати диск \"%s\":\n\t%s\n\nПрискорити відмонтування?\n\nПримітка: Якщо додаток продовжить запис на розділ можлива втрата даних.\n Error mounting volume:\n\n%s AutoMounter Помилка підмонтування розділу:\n\n%s Force unmount AutoMounter Швидке відмонтування +It is suggested to mount all additional Haiku volumes in read-only mode. This will prevent unintentional data loss because of errors in Haiku. AutoMounter Рекомендується підмонтовувати всі доступні томи Haiku тільки в режимі для читання. Це вбереже від втрати даних при помилках у Haiku. Mount error AutoMounter Помилка підмонтування Mount read-only AutoMounter Змонтувати тільки для читання Mount read/write AutoMounter Підмонтувати дл запису/читання @@ -11,4 +13,5 @@ Mounting volume '%s'\n\n AutoMounter Підмонтування розділу Mounting volume \n\n AutoMounter Монтування тому <безіменний том>\n\n OK AutoMounter Гаразд Previous volumes mounted. AutoMounter Попередні томи підмонтовані +The file system on this volume is not the Haiku file system. It is strongly suggested to mount it in read-only mode. This will prevent unintentional data loss because of errors in Haiku. AutoMounter Файлова система на цьому томі не є файловою системою Haiku. Рекомендуємо підмонтування у режимі тільки для читання, це поможе вберегти дані при виникненні помилок в Haiku. Unmount error AutoMounter Помилка відмонтування diff --git a/data/catalogs/tools/translation/inspector/uk.catkeys b/data/catalogs/tools/translation/inspector/uk.catkeys index d79c5c12c4..fd25d7dcb3 100644 --- a/data/catalogs/tools/translation/inspector/uk.catkeys +++ b/data/catalogs/tools/translation/inspector/uk.catkeys @@ -1,18 +1,32 @@ -1 ukrainian x.vnd.OBOS-Inspector 2081327042 +1 ukrainian x.vnd.OBOS-Inspector 2075781936 Active Translators ImageWindow Активні транслятори Active Translators InspectorApp Активні транслятори Bummer ImageWindow Помилка File ImageWindow Файл First Page ImageWindow Перша сторінка +Image: %1\nColor Space: %2 (%3)\nDimensions: %4 x %5\nBytes per Row: %6\nTotal Bytes: %7\n\nIdentify Info:\nID String: %8\nMIME Type: %9\nType: '%10' (%11)\nTranslator ID: %12\nGroup: '%13' (%14)\nQuality: %15\nCapability: %16\n\nExtension Info:\n ImageView Образ: %1\nКолір простору: %2 (%3)\nDРозміри: %4 x %5\nБіти в стрічці: %6\nВсього бітів: %7\n\nідентифікаційна інформація:\nID Стрічка: %8\nТипMIME: %9\nТип: '%10' (%11)\nТранслятор ID: %12\nГрупа: '%13' (%14)\nЯкість: %15\nЄмність: %16\n\nІнформація про розширення:\n +Info ImageWindow Інформація +Info Win InspectorApp This is a quite narrow info window and title 'Info Win' is therefore shortened. Info Win +Last Page ImageWindow Остання сторінка Next Page ImageWindow Наступна сторінка No image available to save. ImageWindow Немає доступних для збереження образів. Number of Documents: %1\n\nTranslator Used:\nName: %2\nInfo: %3\nVersion: %4\n ImageView Кількість документів: %1\n\nВикористати транслятор:\nName: %2\nІнфо: %3\nВерсія: %4\n +OK ImageView Гаразд +OK ImageWindow Гаразд +Open... ImageWindow Відкрити… Previous Page ImageWindow Попередня сторінка +Quit ImageWindow Вийти Save feature not implemented yet. ImageWindow Функція збереження не реалізована. +Save... ImageWindow Зберегти… Selected Document: %1\n\nTranslator Used:\nName: %2\nInfo: %3\nVersion: %4\n ImageView Вибрати документ: %1\n\nВикористати транслятор:\nІ'мя: %2\nІнформація: %3\nВерсія: %4\n Sorry, unable to load the image. ImageView Прикро , неможливо завантажити образ. Sorry, unable to write the image file. ImageView Прикро, неможливо записати файл образу. System Translators ActiveTranslatorsWindow Системні транслятори Unknown ImageView Невідомий User Translators ActiveTranslatorsWindow Транслятори користувача +View ImageWindow Вигляд +Window ImageWindow Вікно \nInput Formats: ImageView \nВхідні формати: +\nOutput Formats: ImageView \nВихідні формати: +\nTranslator Used:\nName: %1\nInfo: %2\nVersion: %3\n ImageView \nВикористати транслятор:\nІ'мя: %1\nІнформація: %2\nВерсія: %3\n +\nType: '%1' (%2)\nGroup: '%3' (%4)\nQuality: %5\nCapability: %6\nMIME Type: %7\nName: %8\n ImageView \nТип: '%1' (%2)\nГрупа: '%3' (%4)\nЯкість: %5\nЄмність: %6\nТип MIME: %7\nІ'мя: %8\n From 0e07be0657199891e6bb66383b722763223e9f5c Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 4 Sep 2011 21:34:34 +0000 Subject: [PATCH 256/702] More fixes to the notification windows : * Rewrite the positionning code properly. There's a remaining bug when deskbar is on the left, but I think it comes from DecoratorFrame() Tweak the position of UI elements : * Shift the close cross a bit * Make the icon stripe the same as in alerts, and align the icon the same way * Adjust the text position, too AppGroupView: * remove the remaining "lines" in collapsed mode (looked like artifacts) * Grey out the title in collapsed mode git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42714 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/notification/AppGroupView.cpp | 120 ++++++------------ src/servers/notification/NotificationView.cpp | 36 +++--- .../notification/NotificationWindow.cpp | 62 ++++----- 3 files changed, 79 insertions(+), 139 deletions(-) diff --git a/src/servers/notification/AppGroupView.cpp b/src/servers/notification/AppGroupView.cpp index caa479de68..2e8b8c5b91 100644 --- a/src/servers/notification/AppGroupView.cpp +++ b/src/servers/notification/AppGroupView.cpp @@ -60,7 +60,6 @@ AppGroupView::Draw(BRect updateRect) BRect textRect = Bounds(); - //textRect.left = kEdgePadding * 2; //textRect.right = textRect.left + be_bold_font->StringWidth(label.String()) // + (kEdgePadding * 3); textRect.bottom = 2 * labelOffset; @@ -75,92 +74,49 @@ AppGroupView::Draw(BRect updateRect) detailCol = tint_color(detailCol, B_LIGHTEN_2_TINT); // detailCol = tint_color(detailCol, B_LIGHTEN_1_TINT); + PushState(); + SetFont(be_bold_font); + SetPenSize(kPenSize); + if (fCollapsed) { + // Draw the expand widget PushState(); - SetFont(be_bold_font); - SetPenSize(kPenSize); - float linePos = textRect.top + textRect.Height() / 2; - - // Draw the line to the expand widget - PushState(); - SetHighColor(detailCol); - StrokeLine(BPoint(kEdgePadding, linePos), BPoint(fCollapseRect.left, linePos)); - PopState(); - - // Draw the expand widget - PushState(); - SetHighColor(detailCol); - StrokeRoundRect(fCollapseRect, kSmallPadding, kSmallPadding); - - BPoint expandHorStart(fCollapseRect.left + kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); - BPoint expandHorEnd(fCollapseRect.right - kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); - StrokeLine(expandHorStart, expandHorEnd); - - BPoint expandVerStart(fCollapseRect.Width() / 2 + fCollapseRect.left, fCollapseRect.top + kSmallPadding); - BPoint expandVerEnd(fCollapseRect.Width() / 2 + fCollapseRect.left, fCollapseRect.bottom - kSmallPadding); - StrokeLine(expandVerStart, expandVerEnd); - PopState(); - - // Draw the app title - DrawString(label.String(), BPoint(fCollapseRect.right + kEdgePadding, labelOffset + kEdgePadding)); - - // Draw the line from the label to the close widget - PushState(); - SetHighColor(detailCol); - - BPoint lineSeg2Start(textRect.right + kSmallPadding / 2, linePos); - BPoint lineSeg2End(fCloseRect.left, linePos); - StrokeLine(lineSeg2Start, lineSeg2End); - PopState(); - - // Draw the dismiss widget - PushState(); - SetHighColor(detailCol); - - StrokeRoundRect(fCloseRect, kSmallPadding, kSmallPadding); - - StrokeLine(closeCross.LeftTop(), closeCross.RightBottom()); - StrokeLine(closeCross.RightTop(), closeCross.LeftBottom()); - PopState(); - - // Draw the line from the dismiss widget - PushState(); - SetHighColor(detailCol); - - BPoint lineSeg3Start(fCloseRect.right, linePos); - BPoint lineSeg3End(borderRect.right, linePos); - StrokeLine(lineSeg3Start, lineSeg3End); - PopState(); - - PopState(); - } else { - PushState(); - SetFont(be_bold_font); - SetPenSize(kPenSize); - - SetLowColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); - FillRect(textRect, B_SOLID_LOW); - - SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); - - // Draw the collapse widget + SetHighColor(detailCol); StrokeRoundRect(fCollapseRect, kSmallPadding, kSmallPadding); - + BPoint expandHorStart(fCollapseRect.left + kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); - BPoint expandHorEnd(fCollapseRect.right - kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); - + BPoint expandHorEnd(fCollapseRect.right - kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); StrokeLine(expandHorStart, expandHorEnd); - - // Draw the dismiss widget - StrokeRoundRect(fCloseRect, kSmallPadding, kSmallPadding); - - StrokeLine(closeCross.LeftTop(), closeCross.RightBottom()); - StrokeLine(closeCross.RightTop(), closeCross.LeftBottom()); - - // Draw the label - DrawString(label.String(), BPoint(fCollapseRect.right + kEdgePadding, labelOffset + kEdgePadding)); + + BPoint expandVerStart(fCollapseRect.Width() / 2 + fCollapseRect.left, fCollapseRect.top + kSmallPadding); + BPoint expandVerEnd(fCollapseRect.Width() / 2 + fCollapseRect.left, fCollapseRect.bottom - kSmallPadding); + StrokeLine(expandVerStart, expandVerEnd); PopState(); + + SetHighColor(tint_color(ui_color(B_PANEL_TEXT_COLOR), B_LIGHTEN_1_TINT)); + } else { + SetLowColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); + FillRect(textRect, B_SOLID_LOW); + + SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); + + // Draw the collapse widget + StrokeRoundRect(fCollapseRect, kSmallPadding, kSmallPadding); + + BPoint expandHorStart(fCollapseRect.left + kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); + BPoint expandHorEnd(fCollapseRect.right - kSmallPadding, fCollapseRect.Height() / 2 + fCollapseRect.top); + + StrokeLine(expandHorStart, expandHorEnd); } + // Draw the dismiss widget + StrokeRoundRect(fCloseRect, kSmallPadding, kSmallPadding); + + StrokeLine(closeCross.LeftTop(), closeCross.RightBottom()); + StrokeLine(closeCross.RightTop(), closeCross.LeftBottom()); + + // Draw the label + DrawString(label.String(), BPoint(fCollapseRect.right + 2 * kEdgePadding, labelOffset + kEdgePadding)); + PopState(); Sync(); } @@ -339,10 +295,10 @@ AppGroupView::ResizeViews() fCollapseRect.OffsetTo(kEdgePadding * 2, kEdgePadding * 1.5); fCloseRect = borderRect; - fCloseRect.right -= kEdgePadding * 4; + fCloseRect.right -= kEdgePadding * 2; + fCloseRect.top += kEdgePadding * 1.5; fCloseRect.left = fCloseRect.right - kCloseSize; fCloseRect.bottom = fCloseRect.top + kCloseSize; - fCloseRect.OffsetTo(fCloseRect.left, kEdgePadding * 1.5); fParent->ResizeAll(); } diff --git a/src/servers/notification/NotificationView.cpp b/src/servers/notification/NotificationView.cpp index 39e8499f01..601f2b939b 100644 --- a/src/servers/notification/NotificationView.cpp +++ b/src/servers/notification/NotificationView.cpp @@ -34,7 +34,7 @@ const char* kSmallIconAttribute = "BEOS:M:STD_ICON"; const char* kLargeIconAttribute = "BEOS:L:STD_ICON"; const char* kIconAttribute = "BEOS:ICON"; -static const int kIconStripeWidth = 16; +static const int kIconStripeWidth = 32; property_info message_prop_list[] = { { "type", {B_GET_PROPERTY, B_SET_PROPERTY, 0}, @@ -280,8 +280,7 @@ NotificationView::Draw(BRect updateRect) float iconSize = (float)fParent->IconSize(); BRect stripeRect = Bounds(); - int32 iconLayoutScale = max_c(1, ((int32)be_plain_font->Size() + 15) / 16); - stripeRect.right = kIconStripeWidth * iconLayoutScale; + stripeRect.right = kIconStripeWidth; SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); FillRect(stripeRect); @@ -291,23 +290,16 @@ NotificationView::Draw(BRect updateRect) // Draw icon if (fBitmap) { - LineInfo* appLine = fLines.back(); - font_height fh; - appLine->font.GetHeight(&fh); - - float title_bottom = appLine->location.y + fh.descent; - - float ix = kEdgePadding; - float iy = 0; - if (fParent->Layout() == TitleAboveIcon) - iy = title_bottom + kEdgePadding + (Bounds().Height() - title_bottom - - kEdgePadding * 2 - iconSize) / 2; - else - iy = (Bounds().Height() - iconSize) / 2.0; + float ix = kIconStripeWidth - iconSize / 3.0; + // Icon is centered around stripe right border + float iy = (Bounds().Height() - iconSize) / 2.0; + // Icon is vertically centered in view if (fType == B_PROGRESS_NOTIFICATION) + { // Move icon up by half progress bar height if it's present - iy -= (progRect.Height() + kEdgePadding) / 2.0; + iy -= (progRect.Height() + kEdgePadding); + } iconRect.Set(ix, iy, ix + iconSize - 1.0, iy + iconSize - 1.0); DrawBitmapAsync(fBitmap, fBitmap->Bounds(), iconRect); @@ -327,7 +319,7 @@ NotificationView::Draw(BRect updateRect) // Draw the close widget BRect closeRect = Bounds(); - closeRect.InsetBy(kEdgePadding, kEdgePadding); + closeRect.InsetBy(2 * kEdgePadding, 2 * kEdgePadding); closeRect.left = closeRect.right - kCloseSize; closeRect.bottom = closeRect.top + kCloseSize; @@ -488,15 +480,17 @@ NotificationView::SetText(const char* app, const char* title, const char* text, fTitle = title; fText = text; - float iconRight = kEdgePadding + kEdgePadding; + float iconRight = kIconStripeWidth; if (fBitmap != NULL) - iconRight += fParent->IconSize(); + iconRight += fParent->IconSize() * 0.75; + else + iconRight += 24; font_height fh; be_bold_font->GetHeight(&fh); float fontHeight = ceilf(fh.leading) + ceilf(fh.descent) + ceilf(fh.ascent); - float y = fontHeight; + float y = 2 * fontHeight; // Title LineInfo* titleLine = new LineInfo; diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index 4621ae328f..a633c38321 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -56,7 +56,7 @@ NotificationWindow::NotificationWindow() : BWindow(BRect(0, 0, 0, 0), B_TRANSLATE_MARK("Notification"), kLeftTitledWindowLook, B_FLOATING_ALL_WINDOW_FEEL, B_AVOID_FRONT | B_AVOID_FOCUS | B_NOT_CLOSABLE - | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE, + | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_NOT_MOVABLE, B_ALL_WORKSPACES) { fBorder = new BorderView(Bounds(), "Notification"); @@ -371,57 +371,47 @@ void NotificationWindow::SetPosition() { BRect bounds = DecoratorFrame(); - float width = bounds.Width(); - float height = bounds.Height(); + float width = Bounds().Width() + 1; + float height = Bounds().Height() + 1; - float leftOffset = Frame().left - DecoratorFrame().left; - float topOffset = DecoratorFrame().top - Frame().top; + float leftOffset = Frame().left - bounds.left; + float topOffset = Frame().top - bounds.top; + float rightOffset = bounds.right - Frame().right; + float bottomOffset = bounds.bottom - Frame().bottom; + // Size of the borders around the window - float x = 0, y = 0, sx, sy; - float pad = 0; + float x = Frame().left, y = Frame().top; + // If we can't guess, don't move... + BDeskbar deskbar; BRect frame = deskbar.Frame(); switch (deskbar.Location()) { case B_DESKBAR_TOP: // Put it just under, top right corner - y = frame.bottom + pad + topOffset; - x = frame.right - width; + y = frame.bottom + topOffset; + x = frame.right - width - rightOffset; break; case B_DESKBAR_BOTTOM: // Put it just above, lower left corner - sx = frame.right; - sy = frame.top - height - pad; - y = sy; - x = sx - width - pad; - break; - case B_DESKBAR_LEFT_TOP: - // Put it just to the right of the deskbar - sx = frame.right + pad; - //sy = frame.top - height; - x = sx + leftOffset; - y = frame.top + pad; + y = frame.top - height - bottomOffset; + x = frame.right - width - rightOffset; break; case B_DESKBAR_RIGHT_TOP: - // Put it just to the left of the deskbar - sx = frame.left - width - pad; - //sy = frame.top - height; - x = sx; - y = frame.top + pad; + x = frame.left - width - rightOffset; + y = frame.top + topOffset; break; - case B_DESKBAR_LEFT_BOTTOM: - // Put it to the right of the deskbar. - sx = frame.right + pad; - sy = frame.bottom; - x = sx + leftOffset; - y = sy - height - pad; + case B_DESKBAR_LEFT_TOP: + x = frame.right + leftOffset; + y = frame.top + topOffset; break; case B_DESKBAR_RIGHT_BOTTOM: - // Put it to the left of the deskbar. - sx = frame.left - width - pad; - sy = frame.bottom; - y = sy - height - pad; - x = sx; + y = frame.bottom - height - bottomOffset; + x = frame.left - width - rightOffset; + break; + case B_DESKBAR_LEFT_BOTTOM: + y = frame.bottom - height - bottomOffset; + x = frame.right + leftOffset; break; default: break; From d230708bcfbe50b9fb09fb510b96586e1d7f8046 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Mon, 5 Sep 2011 10:49:32 +0000 Subject: [PATCH 257/702] * Expand kernel_args addresses ranges size, 8 is somewhat too small, leading to a panic at boot. * Make the panic message more explicit when there is no more room left. This should hopefully fix #7869. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42715 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/boot/platform/bios_ia32/platform_kernel_args.h | 6 +++--- src/system/boot/platform/bios_ia32/mmu.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h b/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h index ef24b3ad7a..e66bebe92c 100644 --- a/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h +++ b/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h @@ -16,9 +16,9 @@ // must match SMP_MAX_CPUS in arch_smp.h #define MAX_BOOT_CPUS 8 -#define MAX_PHYSICAL_MEMORY_RANGE 8 -#define MAX_PHYSICAL_ALLOCATED_RANGE 8 -#define MAX_VIRTUAL_ALLOCATED_RANGE 8 +#define MAX_PHYSICAL_MEMORY_RANGE 32 +#define MAX_PHYSICAL_ALLOCATED_RANGE 32 +#define MAX_VIRTUAL_ALLOCATED_RANGE 32 #define MAX_SERIAL_PORTS 4 diff --git a/src/system/boot/platform/bios_ia32/mmu.cpp b/src/system/boot/platform/bios_ia32/mmu.cpp index 05cb1c68c6..a808be9eaf 100644 --- a/src/system/boot/platform/bios_ia32/mmu.cpp +++ b/src/system/boot/platform/bios_ia32/mmu.cpp @@ -676,7 +676,12 @@ mmu_init(void) if (end <= base) continue; - if (insert_physical_memory_range(base, end - base) != B_OK) { + status_t status = insert_physical_memory_range(base, end - base); + if (status == B_ENTRY_NOT_FOUND) { + panic("mmu_init(): Failed to add physical memory range " + "%#" B_PRIx64 " - %#" B_PRIx64 " : all %d entries are " + "used already!\n", base, end, MAX_PHYSICAL_MEMORY_RANGE); + } else if (status != B_OK) { panic("mmu_init(): Failed to add physical memory range " "%#" B_PRIx64 " - %#" B_PRIx64 "\n", base, end); } From 5414f4dceb079bb6d75b1ffb39fb3320caae4fc4 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 5 Sep 2011 20:20:36 +0000 Subject: [PATCH 258/702] More tweaking ofthe element positions in notification view : * Progress bar is 8 pixels away fom bottom, right, and icon stripe * Icon is horizontally positionned like in BAlert * Move text a bit more to the right Thanks to diver for the great suggestion mockups. Note : some of the settings in Notification preflet are now ignored ("title above icon" comes to mind). I think they don't make much sense anyway, anyone cares if they get removed ? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42716 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/notification/NotificationView.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/servers/notification/NotificationView.cpp b/src/servers/notification/NotificationView.cpp index 601f2b939b..215b1e1958 100644 --- a/src/servers/notification/NotificationView.cpp +++ b/src/servers/notification/NotificationView.cpp @@ -15,6 +15,7 @@ #include +#include #include #include #include @@ -104,8 +105,8 @@ NotificationView::NotificationView(NotificationWindow* win, break; case B_PROGRESS_NOTIFICATION: { - BRect frame(kIconStripeWidth * 3, Bounds().bottom - 36, - Bounds().right - kEdgePadding, Bounds().bottom - kEdgePadding); + BRect frame(kIconStripeWidth + 8, Bounds().bottom - 36, + Bounds().right - 8, Bounds().bottom - 8); BStatusBar* progress = new BStatusBar(frame, "progress"); progress->SetBarHeight(12.0f); progress->SetMaxValue(1.0f); @@ -290,9 +291,8 @@ NotificationView::Draw(BRect updateRect) // Draw icon if (fBitmap) { - float ix = kIconStripeWidth - iconSize / 3.0; - // Icon is centered around stripe right border - float iy = (Bounds().Height() - iconSize) / 2.0; + float ix = 18; + float iy = (Bounds().Height() - iconSize) / 4.0; // Icon is vertically centered in view if (fType == B_PROGRESS_NOTIFICATION) @@ -331,6 +331,11 @@ NotificationView::Draw(BRect updateRect) StrokeLine(closeCross.LeftBottom(), closeCross.RightTop()); PopState(); + SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); + BPoint left(Bounds().left, Bounds().bottom - 1); + BPoint right(Bounds().right, Bounds().bottom - 1); + StrokeLine(left, right); + Sync(); } @@ -482,9 +487,9 @@ NotificationView::SetText(const char* app, const char* title, const char* text, float iconRight = kIconStripeWidth; if (fBitmap != NULL) - iconRight += fParent->IconSize() * 0.75; + iconRight += fParent->IconSize(); else - iconRight += 24; + iconRight += 32; font_height fh; be_bold_font->GetHeight(&fh); From 440381c60f930ef5b27f44a33b674bbee313628b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 6 Sep 2011 16:01:33 +0000 Subject: [PATCH 259/702] * rename video_electronics to video_configuration as per Axel * rename decode_* to get_* * clean up get_* text when unknown connector/encoder git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42717 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../{video_electronics.h => video_configuration.h} | 10 +++++----- src/add-ons/accelerants/common/Jamfile | 2 +- .../{video_electronics.c => video_configuration.cpp} | 10 +++++----- src/add-ons/accelerants/radeon_hd/display.cpp | 10 +++++----- src/add-ons/accelerants/radeon_hd/display.h | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) rename headers/private/graphics/common/{video_electronics.h => video_configuration.h} (84%) rename src/add-ons/accelerants/common/{video_electronics.c => video_configuration.cpp} (89%) diff --git a/headers/private/graphics/common/video_electronics.h b/headers/private/graphics/common/video_configuration.h similarity index 84% rename from headers/private/graphics/common/video_electronics.h rename to headers/private/graphics/common/video_configuration.h index c479f39b07..57bf96e5eb 100644 --- a/headers/private/graphics/common/video_electronics.h +++ b/headers/private/graphics/common/video_configuration.h @@ -5,8 +5,8 @@ * Authors: * Alexander von Gluck, kallisti5@unixzen.com */ -#ifndef _VIDEO_ELECTRONICS_H -#define _VIDEO_ELECTRONICS_H +#ifndef _VIDEO_CONFIGURATION_H +#define _VIDEO_CONFIGURATION_H // Video connector types @@ -42,8 +42,8 @@ extern "C" { // mostly for debugging detected monitors -const char* decode_connector_name(uint32 connector); -const char* decode_encoder_name(uint32 encoder); +const char* get_connector_name(uint32 connector); +const char* get_encoder_name(uint32 encoder); #ifdef __cplusplus @@ -51,4 +51,4 @@ const char* decode_encoder_name(uint32 encoder); #endif -#endif /* _VIDEO_ELECTRONICS_H */ +#endif /* _VIDEO_CONFIGURATION_H */ diff --git a/src/add-ons/accelerants/common/Jamfile b/src/add-ons/accelerants/common/Jamfile index 7c9de8cf95..a1ab758013 100644 --- a/src/add-ons/accelerants/common/Jamfile +++ b/src/add-ons/accelerants/common/Jamfile @@ -9,7 +9,7 @@ UsePrivateHeaders [ FDirName graphics common ] ; StaticLibrary libaccelerantscommon.a : compute_display_timing.cpp create_display_modes.cpp - video_electronics.c + video_configuration.cpp ddc.c decode_edid.c dump_edid.c diff --git a/src/add-ons/accelerants/common/video_electronics.c b/src/add-ons/accelerants/common/video_configuration.cpp similarity index 89% rename from src/add-ons/accelerants/common/video_electronics.c rename to src/add-ons/accelerants/common/video_configuration.cpp index 03fc884123..a6ed5bd1b9 100644 --- a/src/add-ons/accelerants/common/video_electronics.c +++ b/src/add-ons/accelerants/common/video_configuration.cpp @@ -10,11 +10,11 @@ #include #include -#include "video_electronics.h" +#include "video_configuration.h" const char* -decode_connector_name(uint32 connector) +get_connector_name(uint32 connector) { switch (connector) { case VIDEO_CONNECTOR_VGA: @@ -48,12 +48,12 @@ decode_connector_name(uint32 connector) case VIDEO_CONNECTOR_UNKNOWN: return "Unknown"; } - return "Connector Undefined"; + return "Undefined"; } const char* -decode_encoder_name(uint32 encoder) +get_encoder_name(uint32 encoder) { switch (encoder) { case VIDEO_ENCODER_NONE: @@ -67,5 +67,5 @@ decode_encoder_name(uint32 encoder) case VIDEO_ENCODER_TVDAC: return "TV DAC"; } - return "Encoder Undefined"; + return "Undefined"; } diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 38ccb95558..ed2c114384 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -312,7 +312,7 @@ detect_connectors_legacy() for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE_INFO; i++) { if (gConnector[i]->valid == true) { TRACE("%s: connector #%" B_PRId32 " is %s\n", __func__, i, - decode_connector_name(gConnector[i]->connector_type)); + get_connector_name(gConnector[i]->connector_type)); } } @@ -584,10 +584,10 @@ detect_connectors() // TODO : aux chan transactions TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 ")\n", - __func__, i, decode_connector_name(connector_type), + __func__, i, get_connector_name(connector_type), connector_type); TRACE("%s: Path #%" B_PRId32 ": Found encoder %s\n", __func__, - i, decode_encoder_name(encoder_type)); + i, get_encoder_name(encoder_type)); gConnector[connector_index]->valid = true; @@ -669,8 +669,8 @@ debug_displays() if (gDisplay[id]->active) { uint32 connector_type = gConnector[connector_index]->connector_type; uint32 encoder_type = gConnector[connector_index]->encoder_type; - TRACE(" + connector: %s\n", decode_connector_name(connector_type)); - TRACE(" + encoder: %s\n", decode_encoder_name(encoder_type)); + TRACE(" + connector: %s\n", get_connector_name(connector_type)); + TRACE(" + encoder: %s\n", get_encoder_name(encoder_type)); TRACE(" + limits: Vert Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", gDisplay[id]->vfreq_min, gDisplay[id]->vfreq_max); diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 517a28d6f6..064419359a 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -9,7 +9,7 @@ #define RADEON_HD_DISPLAY_H -#include +#include // convert radeon connector to common connector type From b5fc0237e14b93deac33523f327c7e36f1bca57f Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 6 Sep 2011 23:00:07 +0000 Subject: [PATCH 260/702] * add i2c/ddc info storage to connector * add edid info storage to display * pass i2c/ddc information to common i2c code * add code to read/write i2c/ddc * i2c/ddc read/write code works 'in theory', needs tested * detect monitors based on presence of edid on connector git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42718 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 30 ++++- src/add-ons/accelerants/radeon_hd/display.cpp | 4 +- src/add-ons/accelerants/radeon_hd/gpu.cpp | 125 +++++++++++------- src/add-ons/accelerants/radeon_hd/gpu.h | 1 + 4 files changed, 109 insertions(+), 51 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 4312cb019b..0cfd541149 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -138,16 +138,41 @@ struct pll_info { }; +struct ddc_info { + uint8 gpio_id; + + uint16 mask_scl_reg; + uint16 mask_sda_reg; + uint16 mask_scl_shift; + uint16 mask_sda_shift; + + uint16 gpio_en_scl_reg; + uint16 gpio_en_sda_reg; + uint16 gpio_en_scl_shift; + uint16 gpio_en_sda_shift; + + uint16 gpio_y_scl_reg; + uint16 gpio_y_sda_reg; + uint16 gpio_y_scl_shift; + uint16 gpio_y_sda_shift; + + uint16 gpio_a_scl_reg; + uint16 gpio_a_sda_reg; + uint16 gpio_a_scl_shift; + uint16 gpio_a_sda_shift; +}; + + typedef struct { bool valid; uint16 line_mux; uint16 connector_flags; uint32 connector_type; uint16 connector_object_id; - i2c_bus connector_i2c; uint32 encoder_type; uint16 encoder_object_id; - // TODO struct radeon_i2c_bus_rec ddc_bus; + ddc_info connector_ddc_info; + i2c_bus connector_i2c; // TODO struct radeon_hpd hpd; } connector_info; @@ -162,6 +187,7 @@ typedef struct { uint32 hfreq_max; uint32 hfreq_min; pll_info pll; + edid1_info *edid_info; } display_info; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index ed2c114384..04b81cc8e8 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -564,7 +564,7 @@ detect_connectors() = (ATOM_I2C_ID_CONFIG_ACCESS *) &i2c_record->sucI2cId; - // set up i2c bus for connector + // set up i2c gpio information for connector radeon_gpu_i2c_setup(connector_index, i2c_config->ucAccess); break; @@ -633,7 +633,7 @@ detect_displays() bool found = false; switch(gConnector[id]->encoder_type) { case VIDEO_ENCODER_DAC: - found = dac_sense(id); + found = radeon_gpu_read_edid(id, gDisplay[id]->edid_info); break; default: found = false; diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index faa48fb8af..15ad1df394 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -279,13 +279,12 @@ radeon_gpu_irq_setup() static status_t get_i2c_signals(void* cookie, int* _clock, int* _data) { - #if 0 - uint32 ioRegister = (uint32)cookie; - uint32 value = read32(ioRegister); + ddc_info *info = (ddc_info*)cookie; - *_clock = (value & I2C_CLOCK_VALUE_IN) != 0; - *_data = (value & I2C_DATA_VALUE_IN) != 0; - #endif + uint32 value = Read32(OUT, info->gpio_id); + + *_clock = (value >> info->gpio_y_scl_shift) & 1; + *_data = (value >> info->gpio_y_sda_shift) & 1; return B_OK; } @@ -294,34 +293,45 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) static status_t set_i2c_signals(void* cookie, int clock, int data) { - #if 0 - uint32 ioRegister = (uint32)cookie; - uint32 value = read32(OUT, ioRegister) & I2C_RESERVED; + ddc_info* info = (ddc_info*)cookie; - if (data != 0) - value |= I2C_DATA_DIRECTION_MASK; - else { - value |= I2C_DATA_DIRECTION_MASK - | I2C_DATA_DIRECTION_OUT - | I2C_DATA_VALUE_MASK; - } + uint32 value = Read32(OUT, info->gpio_id); - if (clock != 0) - value |= I2C_CLOCK_DIRECTION_MASK; - else - value |= I2C_CLOCK_DIRECTION_MASK - | I2C_CLOCK_DIRECTION_OUT - | I2C_CLOCK_VALUE_MASK; + value &= ~(info->gpio_a_scl_reg | info->gpio_a_sda_reg); + value &= ~(info->gpio_en_sda_reg | info->gpio_en_scl_reg); + value |= ((1 - clock) << info->gpio_en_scl_shift) + | ((1 - data) << info->gpio_en_sda_shift); - write32(OUT, ioRegister, value); - read32(OUT, ioRegister); - // make sure the PCI bus has flushed the write - #endif + Write32(OUT, info->gpio_id, value); return B_OK; } +bool +radeon_gpu_read_edid(uint32 connector, edid1_info *edid) +{ + i2c_bus bus; + + ddc2_init_timing(&bus); + bus.cookie = (void*)&gConnector[connector]->connector_ddc_info; + bus.set_signals = &set_i2c_signals; + bus.get_signals = &get_i2c_signals; + + void *vdif; + size_t vdifLength; + + if (ddc2_read_edid1(&bus, edid, &vdif, &vdifLength) != B_OK) + return false; + + TRACE("%s: found edid monitor on connector #%" B_PRId32 "\n", + __func__, connector); + + free(vdif); + return true; +} + + status_t radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) { @@ -349,33 +359,54 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) // TODO : if DCE 4 and i == 7 ... manual override for evergreen // TODO : if DCE 3 and i == 4 ... manual override - if (gpio->sucI2cId.ucAccess == gpio_id) { - i2c_bus bus; + if (gpio->sucI2cId.ucAccess != gpio_id) + continue; - // successful lookup - TRACE("%s: successful i2c gpio lookup\n", __func__); + // successful lookup + TRACE("%s: found i2c gpio\n", __func__); - // pull registers for data and clock... - uint16 analogDataReg - = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; - //uint16 analogClockReg - // = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; - //uint16 digitalDataReg - // = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) * 4; - //uint16 digitalClockReg - // = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; - // populate cookie with analog data register - bus.cookie = (void*)analogDataReg; - bus.set_signals = &set_i2c_signals; - bus.get_signals = &get_i2c_signals; + // populate gpio information + gConnector[connector]->connector_ddc_info.gpio_id = gpio_id; - ddc2_init_timing(&bus); - // TODO : check for valid analog edid - // TODO : check for valid digital edid no results on analog - } + gConnector[connector]->connector_ddc_info.mask_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.mask_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataMaskRegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.mask_scl_shift + = (1 << gpio->ucClkMaskShift); + gConnector[connector]->connector_ddc_info.mask_sda_shift + = (1 << gpio->ucDataMaskShift); + + gConnector[connector]->connector_ddc_info.gpio_en_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_en_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataEnRegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_en_scl_shift + = (1 << gpio->ucClkEnShift); + gConnector[connector]->connector_ddc_info.gpio_en_sda_shift + = (1 << gpio->ucDataEnShift); + + gConnector[connector]->connector_ddc_info.gpio_y_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_y_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_y_scl_shift + = (1 << gpio->ucClkY_Shift); + gConnector[connector]->connector_ddc_info.gpio_y_sda_shift + = (1 << gpio->ucDataY_Shift); + + gConnector[connector]->connector_ddc_info.gpio_a_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_a_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_a_scl_shift + = (1 << gpio->ucClkA_Shift); + gConnector[connector]->connector_ddc_info.gpio_a_sda_shift + = (1 << gpio->ucDataA_Shift); } + } return B_OK; diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index 618a49961b..ff0094f315 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -168,6 +168,7 @@ void radeon_gpu_mc_resume(); uint32 radeon_gpu_mc_idlecheck(); status_t radeon_gpu_mc_setup(); status_t radeon_gpu_irq_setup(); +bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid); status_t radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id); From aac8a4c3c46997bc19b61da38c24e92000d15119 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 7 Sep 2011 21:31:06 +0000 Subject: [PATCH 261/702] Fix clamping in BDate::AddMonths(): * use _DaysInMonth() instead of DaysInMonth(), as the latter only works for valid dates, which we do not have if the day needs to be clamped to the maximum value for the current month git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42719 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/support/DateTime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/support/DateTime.cpp b/src/kits/support/DateTime.cpp index 8fd64320b1..0d7c197255 100644 --- a/src/kits/support/DateTime.cpp +++ b/src/kits/support/DateTime.cpp @@ -721,7 +721,7 @@ BDate::AddMonths(int32 months) if (fYear == 1582 && fMonth == 10 && fDay > 4 && fDay < 15) fDay = (months > 0) ? 15 : 4; - fDay = min_c(fDay, DaysInMonth()); + fDay = min_c(fDay, _DaysInMonth(fYear, fMonth)); } } From 6846765fbf83f501df7ab9b10811971cbb5375a3 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 7 Sep 2011 21:41:57 +0000 Subject: [PATCH 262/702] Work on #7947 (CalendarView not respecting locale's start of week) * support all weekdays as start of week, not only Sunday and Monday (at least Saturday is used for real, too) * introduce BWeekday as enumeration of weekdays (currently in Locale.h, may be moved somewhere else later) * change CalendarView to use BDate as its model, not individual values for day, month and year, such that no more date computation is done in CalendarView itself * some more style cleanups in CalendarView along the way * add monthwise paging to CalendarView * adjusted Deskbar and Time preflet accordingly git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42720 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/locale/Locale.h | 22 +- headers/private/shared/CalendarView.h | 237 +++++------ src/apps/deskbar/CalendarMenuWindow.cpp | 8 +- src/kits/locale/Locale.cpp | 54 ++- src/kits/shared/CalendarView.cpp | 536 ++++++++---------------- src/preferences/time/DateTimeView.cpp | 16 +- 6 files changed, 348 insertions(+), 525 deletions(-) diff --git a/headers/os/locale/Locale.h b/headers/os/locale/Locale.h index 7aad721312..be7663c4eb 100644 --- a/headers/os/locale/Locale.h +++ b/headers/os/locale/Locale.h @@ -22,7 +22,7 @@ class BString; class BTimeZone; -typedef enum { +enum BDateElement { B_DATE_ELEMENT_INVALID = B_BAD_DATA, B_DATE_ELEMENT_YEAR = 0, B_DATE_ELEMENT_MONTH, @@ -31,14 +31,26 @@ typedef enum { B_DATE_ELEMENT_HOUR, B_DATE_ELEMENT_MINUTE, B_DATE_ELEMENT_SECOND -} BDateElement; +}; -typedef enum { +enum BNumberElement { B_NUMBER_ELEMENT_INVALID = B_BAD_DATA, B_NUMBER_ELEMENT_INTEGER = 0, B_NUMBER_ELEMENT_FRACTIONAL, B_NUMBER_ELEMENT_CURRENCY -} BNumberElement; +}; + + +// TODO: move this to BCalendar (should we ever have that) or BDate +enum BWeekday { + B_WEEKDAY_MONDAY = 1, + B_WEEKDAY_TUESDAY, + B_WEEKDAY_WEDNESDAY, + B_WEEKDAY_THURSDAY, + B_WEEKDAY_FRIDAY, + B_WEEKDAY_SATURDAY, + B_WEEKDAY_SUNDAY, +}; class BLocale { @@ -99,7 +111,7 @@ public: int& fieldCount, BDateFormatStyle style ) const; - int StartOfWeek() const; + status_t GetStartOfWeek(BWeekday* weekday) const; // Time diff --git a/headers/private/shared/CalendarView.h b/headers/private/shared/CalendarView.h index 6525de165d..04a0efeed5 100644 --- a/headers/private/shared/CalendarView.h +++ b/headers/private/shared/CalendarView.h @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -21,22 +22,9 @@ class BMessage; namespace BPrivate { -enum week_start { - B_WEEK_START_MONDAY, - B_WEEK_START_SUNDAY -}; - - class BCalendarView : public BView, public BInvoker { - public: - BCalendarView(BRect frame, const char *name, - uint32 resizeMask = B_FOLLOW_LEFT - | B_FOLLOW_TOP, - uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS - | B_NAVIGABLE); - - BCalendarView(BRect frame, const char *name, - week_start start, +public: + BCalendarView(BRect frame, const char* name, uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS @@ -46,170 +34,157 @@ class BCalendarView : public BView, public BInvoker { uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); - BCalendarView(const char* name, - week_start start, uint32 flags = B_WILL_DRAW - | B_FRAME_EVENTS | B_NAVIGABLE); + virtual ~BCalendarView(); - virtual ~BCalendarView(); - - BCalendarView(BMessage *archive); - static BArchivable* Instantiate(BMessage *archive); - virtual status_t Archive(BMessage *archive, + BCalendarView(BMessage* archive); + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, bool deep = true) const; - virtual void AttachedToWindow(); - virtual void DetachedFromWindow(); + virtual void AttachedToWindow(); - virtual void AllAttached(); - virtual void AllDetached(); + virtual void FrameResized(float width, float height); - virtual void FrameMoved(BPoint newPosition); - virtual void FrameResized(float width, float height); + virtual void Draw(BRect updateRect); - virtual void Draw(BRect updateRect); - - virtual void DrawDay(BView *owner, BRect frame, - const char *text, bool isSelected = false, + virtual void DrawDay(BView* owner, BRect frame, + const char* text, bool isSelected = false, bool isEnabled = true, bool focus = false); - virtual void DrawDayName(BView *owner, BRect frame, - const char *text); - virtual void DrawWeekNumber(BView *owner, BRect frame, - const char *text); + virtual void DrawDayName(BView* owner, BRect frame, + const char* text); + virtual void DrawWeekNumber(BView* owner, BRect frame, + const char* text); - virtual void MessageReceived(BMessage *message); + uint32 SelectionCommand() const; + BMessage* SelectionMessage() const; + virtual void SetSelectionMessage(BMessage* message); - uint32 SelectionCommand() const; - BMessage* SelectionMessage() const; - virtual void SetSelectionMessage(BMessage *message); + uint32 InvocationCommand() const; + BMessage* InvocationMessage() const; + virtual void SetInvocationMessage(BMessage* message); - uint32 InvocationCommand() const; - BMessage* InvocationMessage() const; - virtual void SetInvocationMessage(BMessage *message); + virtual void MakeFocus(bool state = true); + virtual status_t Invoke(BMessage* message = NULL); - virtual void WindowActivated(bool state); - virtual void MakeFocus(bool state = true); - virtual status_t Invoke(BMessage* message = NULL); + virtual void MouseDown(BPoint where); - virtual void MouseUp(BPoint point); - virtual void MouseDown(BPoint where); - virtual void MouseMoved(BPoint point, uint32 code, - const BMessage *dragMessage); + virtual void KeyDown(const char* bytes, int32 numBytes); - virtual void KeyDown(const char *bytes, int32 numBytes); + virtual void ResizeToPreferred(); + virtual void GetPreferredSize(float* width, float* height); - virtual BHandler* ResolveSpecifier(BMessage *message, int32 index, - BMessage *specifier, int32 form, - const char *property); - virtual status_t GetSupportedSuites(BMessage *data); - virtual status_t Perform(perform_code code, void* arg); + virtual BSize MaxSize(); + virtual BSize MinSize(); + virtual BSize PreferredSize(); - virtual void ResizeToPreferred(); - virtual void GetPreferredSize(float *width, float *height); + int32 Day() const; + int32 Year() const; + int32 Month() const; - virtual BSize MaxSize(); - virtual BSize MinSize(); - virtual BSize PreferredSize(); + BDate Date() const; + bool SetDate(const BDate& date); + bool SetDate(int32 year, int32 month, int32 day); - int32 Day() const; - int32 Year() const; - int32 Month() const; + BWeekday StartOfWeek() const; + void SetStartOfWeek(BWeekday startOfWeek); - BDate Date() const; - bool SetDate(const BDate &date); - bool SetDate(int32 year, int32 month, int32 day); + bool IsDayNameHeaderVisible() const; + void SetDayNameHeaderVisible(bool visible); - week_start WeekStart() const; - void SetWeekStart(week_start start); + bool IsWeekNumberHeaderVisible() const; + void SetWeekNumberHeaderVisible(bool visible); - bool IsDayNameHeaderVisible() const; - void SetDayNameHeaderVisible(bool visible); - - bool IsWeekNumberHeaderVisible() const; - void SetWeekNumberHeaderVisible(bool visible); - - private: - void _InitObject(); - - void _SetToDay(); - void _GetYearMonth(int32 *year, int32 *month) const; - void _GetPreferredSize(float *width, float *height); - - void _SetupDayNames(); - void _SetupDayNumbers(); - void _SetupWeekNumbers(); - - void _DrawDays(); - void _DrawFocusRect(); - void _DrawDayHeader(); - void _DrawWeekHeader(); - void _DrawDay(int32 curRow, int32 curColumn, - int32 row, int32 column, int32 counter, - BRect frame, const char *text, - bool focus = false); - void _DrawItem(BView *owner, BRect frame, - const char *text, bool isSelected = false, - bool isEnabled = true, bool focus = false); - - void _UpdateSelection(); - BRect _FirstCalendarItemFrame() const; - BRect _SetNewSelectedDay(const BPoint &where); - - BCalendarView(const BCalendarView &view); - BCalendarView& operator=(const BCalendarView &view); - - private: - struct Selection { +private: + struct Selection { Selection() - : row(0), column(0) { } + : row(0), column(0) + { + } - void SetTo(int32 _row, int32 _column) - { row = _row; column = _column; } + void + SetTo(int32 _row, int32 _column) + { + row = _row; + column = _column; + } int32 row; int32 column; - Selection& operator=(const Selection &s) + Selection& operator=(const Selection& s) { row = s.row; column = s.column; return *this; } - bool operator==(const Selection &s) const + bool operator==(const Selection& s) const { return row == s.row && column == s.column; } - bool operator!=(const Selection &s) const + bool operator!=(const Selection& s) const { return row != s.row || column != s.column; } }; - BRect _RectOfDay(const Selection &selection) const; - BMessage *fSelectionMessage; + void _InitObject(); - int32 fDay; - int32 fYear; - int32 fMonth; + void _SetToDay(); + void _GetYearMonthForSelection( + const Selection& selection, int32* year, + int32* month) const; + void _GetPreferredSize(float* width, float* height); - Selection fFocusedDay; - bool fFocusChanged; - Selection fNewFocusedDay; + void _SetupDayNames(); + void _SetupDayNumbers(); + void _SetupWeekNumbers(); - Selection fSelectedDay; - Selection fNewSelectedDay; - bool fSelectionChanged; + void _DrawDays(); + void _DrawFocusRect(); + void _DrawDayHeader(); + void _DrawWeekHeader(); + void _DrawDay(int32 curRow, int32 curColumn, + int32 row, int32 column, int32 counter, + BRect frame, const char* text, + bool focus = false); + void _DrawItem(BView* owner, BRect frame, + const char* text, bool isSelected = false, + bool isEnabled = true, bool focus = false); - week_start fWeekStart; - bool fDayNameHeaderVisible; - bool fWeekNumberHeaderVisible; + void _UpdateSelection(); + BRect _FirstCalendarItemFrame() const; + BRect _SetNewSelectedDay(const BPoint& where); - BString fDayNames[7]; - BString fWeekNumbers[6]; - BString fDayNumbers[6][7]; + BRect _RectOfDay(const Selection& selection) const; + +private: + BMessage* fSelectionMessage; + + BDate fDate; + + Selection fFocusedDay; + Selection fNewFocusedDay; + bool fFocusChanged; + + Selection fSelectedDay; + Selection fNewSelectedDay; + bool fSelectionChanged; + + int32 fStartOfWeek; + bool fDayNameHeaderVisible; + bool fWeekNumberHeaderVisible; + + BString fDayNames[7]; + BString fWeekNumbers[6]; + BString fDayNumbers[6][7]; + + // hide copy constructor & assignment + BCalendarView(const BCalendarView& view); + BCalendarView& operator=(const BCalendarView& view); }; diff --git a/src/apps/deskbar/CalendarMenuWindow.cpp b/src/apps/deskbar/CalendarMenuWindow.cpp index 162afbf5b4..aa59b35e8d 100644 --- a/src/apps/deskbar/CalendarMenuWindow.cpp +++ b/src/apps/deskbar/CalendarMenuWindow.cpp @@ -20,8 +20,6 @@ using BPrivate::BCalendarView; -using BPrivate::B_WEEK_START_SUNDAY; -using BPrivate::B_WEEK_START_MONDAY; enum { @@ -90,17 +88,13 @@ CalendarMenuWindow::CalendarMenuWindow(BPoint where) { SetFeel(B_FLOATING_ALL_WINDOW_FEEL); - BPrivate::week_start startOfWeek - = (BPrivate::week_start)BLocale::Default()->StartOfWeek(); - RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY); AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED)); fYearLabel = new BStringView("year", ""); fMonthLabel = new BStringView("month", ""); - fCalendarView = new BCalendarView(Bounds(), "calendar", - startOfWeek, B_FOLLOW_ALL); + fCalendarView = new BCalendarView(Bounds(), "calendar", B_FOLLOW_ALL); fCalendarView->SetInvocationMessage(new BMessage(kInvokationMessage)); BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL); diff --git a/src/kits/locale/Locale.cpp b/src/kits/locale/Locale.cpp index 3ad0dfce80..9be23e1796 100644 --- a/src/kits/locale/Locale.cpp +++ b/src/kits/locale/Locale.cpp @@ -30,8 +30,6 @@ using BPrivate::ObjectDeleter; -using BPrivate::B_WEEK_START_MONDAY; -using BPrivate::B_WEEK_START_SUNDAY; BLocale::BLocale(const BLanguage* language, @@ -353,26 +351,54 @@ BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, } -int -BLocale::StartOfWeek() const +status_t +BLocale::GetStartOfWeek(BWeekday* startOfWeek) const { + if (startOfWeek == NULL) + return B_BAD_VALUE; + BAutolock lock(fLock); if (!lock.IsLocked()) return B_WOULD_BLOCK; UErrorCode err = U_ZERO_ERROR; - Calendar* c = Calendar::createInstance( - *BFormattingConventions::Private(&fConventions).ICULocale(), - err); + ObjectDeleter calendar = Calendar::createInstance( + *BFormattingConventions::Private(&fConventions).ICULocale(), err); - if (err == U_ZERO_ERROR && c->getFirstDayOfWeek(err) == UCAL_SUNDAY) { - delete c; - return B_WEEK_START_SUNDAY; - } else { - delete c; - // Might be another day, but BeAPI will not handle it - return B_WEEK_START_MONDAY; + if (U_FAILURE(err)) + return B_ERROR; + + UCalendarDaysOfWeek icuWeekStart = calendar->getFirstDayOfWeek(err); + if (U_FAILURE(err)) + return B_ERROR; + + switch (icuWeekStart) { + case UCAL_SUNDAY: + *startOfWeek = B_WEEKDAY_SUNDAY; + break; + case UCAL_MONDAY: + *startOfWeek = B_WEEKDAY_MONDAY; + break; + case UCAL_TUESDAY: + *startOfWeek = B_WEEKDAY_TUESDAY; + break; + case UCAL_WEDNESDAY: + *startOfWeek = B_WEEKDAY_WEDNESDAY; + break; + case UCAL_THURSDAY: + *startOfWeek = B_WEEKDAY_THURSDAY; + break; + case UCAL_FRIDAY: + *startOfWeek = B_WEEKDAY_FRIDAY; + break; + case UCAL_SATURDAY: + *startOfWeek = B_WEEKDAY_SATURDAY; + break; + default: + return B_BAD_DATA; } + + return B_OK; } diff --git a/src/kits/shared/CalendarView.cpp b/src/kits/shared/CalendarView.cpp index e1b08d45da..fab7f2f8fc 100644 --- a/src/kits/shared/CalendarView.cpp +++ b/src/kits/shared/CalendarView.cpp @@ -19,7 +19,7 @@ namespace BPrivate { static float -FontHeight(const BView *view) +FontHeight(const BView* view) { if (!view) return 0.0; @@ -35,37 +35,16 @@ FontHeight(const BView *view) // #pragma mark - -BCalendarView::BCalendarView(BRect frame, const char *name, - uint32 resizeMask, uint32 flags) +BCalendarView::BCalendarView(BRect frame, const char* name, uint32 resizeMask, + uint32 flags) : BView(frame, name, resizeMask, flags), BInvoker(), fSelectionMessage(NULL), - fDay(0), - fYear(0), - fMonth(0), + fDate(), fFocusChanged(false), fSelectionChanged(false), - fWeekStart(B_WEEK_START_SUNDAY), - fDayNameHeaderVisible(true), - fWeekNumberHeaderVisible(true) -{ - _InitObject(); -} - - -BCalendarView::BCalendarView(BRect frame, const char *name, week_start start, - uint32 resizeMask, uint32 flags) - : - BView(frame, name, resizeMask, flags), - BInvoker(), - fSelectionMessage(NULL), - fDay(0), - fYear(0), - fMonth(0), - fFocusChanged(false), - fSelectionChanged(false), - fWeekStart(start), + fStartOfWeek((int32)B_WEEKDAY_MONDAY), fDayNameHeaderVisible(true), fWeekNumberHeaderVisible(true) { @@ -78,31 +57,10 @@ BCalendarView::BCalendarView(const char* name, uint32 flags) BView(name, flags), BInvoker(), fSelectionMessage(NULL), - fDay(0), - fYear(0), - fMonth(0), + fDate(), fFocusChanged(false), fSelectionChanged(false), - fWeekStart(B_WEEK_START_SUNDAY), - fDayNameHeaderVisible(true), - fWeekNumberHeaderVisible(true) -{ - _InitObject(); -} - - -BCalendarView::BCalendarView(const char* name, week_start start, - uint32 flags) - : - BView(name, flags), - BInvoker(), - fSelectionMessage(NULL), - fDay(0), - fYear(0), - fMonth(0), - fFocusChanged(false), - fSelectionChanged(false), - fWeekStart(start), + fStartOfWeek((int32)B_WEEKDAY_MONDAY), fDayNameHeaderVisible(true), fWeekNumberHeaderVisible(true) { @@ -116,42 +74,32 @@ BCalendarView::~BCalendarView() } -BCalendarView::BCalendarView(BMessage *archive) +BCalendarView::BCalendarView(BMessage* archive) : BView(archive), BInvoker(), fSelectionMessage(NULL), - fDay(0), - fYear(0), - fMonth(0), + fDate(archive), fFocusChanged(false), fSelectionChanged(false), - fWeekStart(B_WEEK_START_SUNDAY), + fStartOfWeek((int32)B_WEEKDAY_MONDAY), fDayNameHeaderVisible(true), fWeekNumberHeaderVisible(true) { if (archive->HasMessage("_invokeMsg")) { - BMessage *invokationMessage = new BMessage; + BMessage* invokationMessage = new BMessage; archive->FindMessage("_invokeMsg", invokationMessage); SetInvocationMessage(invokationMessage); } if (archive->HasMessage("_selectMsg")) { - BMessage *selectionMessage = new BMessage; + BMessage* selectionMessage = new BMessage; archive->FindMessage("selectMsg", selectionMessage); SetSelectionMessage(selectionMessage); } - if (archive->FindInt32("_day", &fDay) != B_OK - || archive->FindInt32("_month", &fMonth) != B_OK - || archive->FindInt32("_year", &fYear) != B_OK) { - BDate date = BDate::CurrentDate(B_LOCAL_TIME); - date.GetDate(&fYear, &fMonth, &fDay); - } - - int32 start; - if (archive->FindInt32("_weekStart", &start) == B_OK) - fWeekStart = week_start(start); + if (archive->FindInt32("_weekStart", &fStartOfWeek) != B_OK) + fStartOfWeek = (int32)B_WEEKDAY_MONDAY; if (archive->FindBool("_dayHeader", &fDayNameHeaderVisible) != B_OK) fDayNameHeaderVisible = true; @@ -166,7 +114,7 @@ BCalendarView::BCalendarView(BMessage *archive) BArchivable* -BCalendarView::Instantiate(BMessage *archive) +BCalendarView::Instantiate(BMessage* archive) { if (validate_instantiation(archive, "BCalendarView")) return new BCalendarView(archive); @@ -176,7 +124,7 @@ BCalendarView::Instantiate(BMessage *archive) status_t -BCalendarView::Archive(BMessage *archive, bool deep) const +BCalendarView::Archive(BMessage* archive, bool deep) const { status_t status = BView::Archive(archive, deep); @@ -187,16 +135,10 @@ BCalendarView::Archive(BMessage *archive, bool deep) const status = archive->AddMessage("_selectMsg", SelectionMessage()); if (status == B_OK) - status = archive->AddInt32("_day", fDay); + status = fDate.Archive(archive); if (status == B_OK) - status = archive->AddInt32("_month", fMonth); - - if (status == B_OK) - status = archive->AddInt32("_year", fYear); - - if (status == B_OK) - status = archive->AddInt32("_weekStart", int32(fWeekStart)); + status = archive->AddInt32("_weekStart", fStartOfWeek); if (status == B_OK) status = archive->AddBool("_dayHeader", fDayNameHeaderVisible); @@ -218,34 +160,6 @@ BCalendarView::AttachedToWindow() } -void -BCalendarView::DetachedFromWindow() -{ - BView::DetachedFromWindow(); -} - - -void -BCalendarView::AllAttached() -{ - BView::AllAttached(); -} - - -void -BCalendarView::AllDetached() -{ - BView::AllDetached(); -} - - -void -BCalendarView::FrameMoved(BPoint newPosition) -{ - BView::FrameMoved(newPosition); -} - - void BCalendarView::FrameResized(float width, float height) { @@ -283,7 +197,7 @@ BCalendarView::Draw(BRect updateRect) void -BCalendarView::DrawDay(BView *owner, BRect frame, const char *text, +BCalendarView::DrawDay(BView* owner, BRect frame, const char* text, bool isSelected, bool isEnabled, bool focus) { _DrawItem(owner, frame, text, isSelected, isEnabled, focus); @@ -291,7 +205,7 @@ BCalendarView::DrawDay(BView *owner, BRect frame, const char *text, void -BCalendarView::DrawDayName(BView *owner, BRect frame, const char *text) +BCalendarView::DrawDayName(BView* owner, BRect frame, const char* text) { // we get the full rect, fake this as the internal function // shrinks the frame to work properly when drawing a day item @@ -300,7 +214,7 @@ BCalendarView::DrawDayName(BView *owner, BRect frame, const char *text) void -BCalendarView::DrawWeekNumber(BView *owner, BRect frame, const char *text) +BCalendarView::DrawWeekNumber(BView* owner, BRect frame, const char* text) { // we get the full rect, fake this as the internal function // shrinks the frame to work properly when drawing a day item @@ -308,13 +222,6 @@ BCalendarView::DrawWeekNumber(BView *owner, BRect frame, const char *text) } -void -BCalendarView::MessageReceived(BMessage *message) -{ - BView::MessageReceived(message); -} - - uint32 BCalendarView::SelectionCommand() const { @@ -333,7 +240,7 @@ BCalendarView::SelectionMessage() const void -BCalendarView::SetSelectionMessage(BMessage *message) +BCalendarView::SetSelectionMessage(BMessage* message) { delete fSelectionMessage; fSelectionMessage = message; @@ -355,19 +262,12 @@ BCalendarView::InvocationMessage() const void -BCalendarView::SetInvocationMessage(BMessage *message) +BCalendarView::SetInvocationMessage(BMessage* message) { BInvoker::SetMessage(message); } -void -BCalendarView::WindowActivated(bool state) -{ - BView::WindowActivated(state); -} - - void BCalendarView::MakeFocus(bool state) { @@ -384,7 +284,7 @@ BCalendarView::MakeFocus(bool state) status_t -BCalendarView::Invoke(BMessage *message) +BCalendarView::Invoke(BMessage* message) { bool notify = false; uint32 kind = InvokeKind(¬ify); @@ -407,11 +307,11 @@ BCalendarView::Invoke(BMessage *message) int32 year; int32 month; - _GetYearMonth(&year, &month); + _GetYearMonthForSelection(fSelectedDay, &year, &month); - clone.AddInt32("year", year); - clone.AddInt32("month", month); - clone.AddInt32("day", fDay); + clone.AddInt32("year", fDate.Year()); + clone.AddInt32("month", fDate.Month()); + clone.AddInt32("day", fDate.Day()); if (message) status = BInvoker::Invoke(&clone); @@ -422,13 +322,6 @@ BCalendarView::Invoke(BMessage *message) } -void -BCalendarView::MouseUp(BPoint point) -{ - BView::MouseUp(point); -} - - void BCalendarView::MouseDown(BPoint where) { @@ -471,22 +364,14 @@ BCalendarView::MouseDown(BPoint where) int32 clicks; // on double click invoke - BMessage *message = Looper()->CurrentMessage(); + BMessage* message = Looper()->CurrentMessage(); if (message->FindInt32("clicks", &clicks) == B_OK && clicks > 1) Invoke(); } void -BCalendarView::MouseMoved(BPoint point, uint32 code, - const BMessage *dragMessage) -{ - BView::MouseMoved(point, code, dragMessage); -} - - -void -BCalendarView::KeyDown(const char *bytes, int32 numBytes) +BCalendarView::KeyDown(const char* bytes, int32 numBytes) { const int32 kRows = 6; const int32 kColumns = 7; @@ -496,19 +381,17 @@ BCalendarView::KeyDown(const char *bytes, int32 numBytes) switch (bytes[0]) { case B_LEFT_ARROW: - { column -= 1; if (column < 0) { - column = kColumns -1; + column = kColumns - 1; row -= 1; if (row >= 0) fFocusChanged = true; } else fFocusChanged = true; - } break; + break; case B_RIGHT_ARROW: - { column += 1; if (column == kColumns) { column = 0; @@ -517,24 +400,43 @@ BCalendarView::KeyDown(const char *bytes, int32 numBytes) fFocusChanged = true; } else fFocusChanged = true; - } break; + break; case B_UP_ARROW: - { row -= 1; if (row >= 0) fFocusChanged = true; - } break; + break; case B_DOWN_ARROW: - { row += 1; if (row < kRows) fFocusChanged = true; - } break; + break; + + case B_PAGE_UP: + { + BDate date(fDate); + date.AddMonths(-1); + SetDate(date); + + Invoke(); + break; + } + + case B_PAGE_DOWN: + { + BDate date(fDate); + date.AddMonths(1); + SetDate(date); + + Invoke(); + break; + } case B_RETURN: - case B_SPACE: { + case B_SPACE: + { fSelectionChanged = true; BPoint pt = _RectOfDay(fFocusedDay).LeftTop(); Draw(_SetNewSelectedDay(pt + BPoint(4.0, 4.0))); @@ -542,7 +444,8 @@ BCalendarView::KeyDown(const char *bytes, int32 numBytes) fSelectionChanged = false; Invoke(); - } break; + break; + } default: BView::KeyDown(bytes, numBytes); @@ -558,28 +461,6 @@ BCalendarView::KeyDown(const char *bytes, int32 numBytes) } -BHandler* -BCalendarView::ResolveSpecifier(BMessage *message, int32 index, - BMessage *specifier, int32 form, const char *property) -{ - return BView::ResolveSpecifier(message, index, specifier, form, property); -} - - -status_t -BCalendarView::GetSupportedSuites(BMessage *data) -{ - return BView::GetSupportedSuites(data); -} - - -status_t -BCalendarView::Perform(perform_code code, void *arg) -{ - return BView::Perform(code, arg); -} - - void BCalendarView::ResizeToPreferred() { @@ -592,7 +473,7 @@ BCalendarView::ResizeToPreferred() void -BCalendarView::GetPreferredSize(float *width, float *height) +BCalendarView::GetPreferredSize(float* width, float* height) { _GetPreferredSize(width, height); } @@ -611,23 +492,21 @@ BCalendarView::MinSize() { float width, height; _GetPreferredSize(&width, &height); - return BLayoutUtils::ComposeSize(ExplicitMinSize(), - BSize(width, height)); + return BLayoutUtils::ComposeSize(ExplicitMinSize(), BSize(width, height)); } BSize BCalendarView::PreferredSize() { - return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), - MinSize()); + return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), MinSize()); } int32 BCalendarView::Day() const { - return fDay; + return fDate.Day(); } @@ -635,8 +514,7 @@ int32 BCalendarView::Year() const { int32 year; - int32 month; - _GetYearMonth(&year, &month); + _GetYearMonthForSelection(fSelectedDay, &year, NULL); return year; } @@ -645,9 +523,8 @@ BCalendarView::Year() const int32 BCalendarView::Month() const { - int32 year; int32 month; - _GetYearMonth(&year, &month); + _GetYearMonthForSelection(fSelectedDay, NULL, &month); return month; } @@ -658,32 +535,23 @@ BCalendarView::Date() const { int32 year; int32 month; - _GetYearMonth(&year, &month); - return BDate(year, month, fDay); + _GetYearMonthForSelection(fSelectedDay, &year, &month); + return BDate(year, month, fDate.Day()); } bool -BCalendarView::SetDate(const BDate &date) +BCalendarView::SetDate(const BDate& date) { if (!date.IsValid()) return false; - return SetDate(date.Year(), date.Month(), date.Day()); -} - - -bool -BCalendarView::SetDate(int32 year, int32 month, int32 day) -{ - if (!BDate(year, month, day).IsValid()) - return false; - - if (fYear == year && fMonth == month && fDay == day) + if (fDate == date) return true; - fDay = day; - if (fYear == year && fMonth == month) { + if (fDate.Year() == date.Year() && fDate.Month() == date.Month()) { + fDate = date; + _SetToDay(); // update focus fFocusChanged = true; @@ -696,8 +564,7 @@ BCalendarView::SetDate(int32 year, int32 month, int32 day) Draw(_RectOfDay(fNewSelectedDay)); fSelectionChanged = false; } else { - fYear = year; - fMonth = month; + fDate = date; _SetupDayNumbers(); _SetupWeekNumbers(); @@ -716,20 +583,27 @@ BCalendarView::SetDate(int32 year, int32 month, int32 day) } -week_start -BCalendarView::WeekStart() const +bool +BCalendarView::SetDate(int32 year, int32 month, int32 day) { - return fWeekStart; + return SetDate(BDate(year, month, day)); +} + + +BWeekday +BCalendarView::StartOfWeek() const +{ + return BWeekday(fStartOfWeek); } void -BCalendarView::SetWeekStart(week_start start) +BCalendarView::SetStartOfWeek(BWeekday startOfWeek) { - if (fWeekStart == start) + if (fStartOfWeek == (int32)startOfWeek) return; - fWeekStart = start; + fStartOfWeek = (int32)startOfWeek; _SetupDayNames(); _SetupDayNumbers(); @@ -778,8 +652,9 @@ BCalendarView::SetWeekNumberHeaderVisible(bool visible) void BCalendarView::_InitObject() { - BDate date = BDate::CurrentDate(B_LOCAL_TIME); - date.GetDate(&fYear, &fMonth, &fDay); + fDate = BDate::CurrentDate(B_LOCAL_TIME); + + BLocale::Default()->GetStartOfWeek((BWeekday*)&fStartOfWeek); _SetupDayNames(); _SetupDayNumbers(); @@ -790,94 +665,53 @@ BCalendarView::_InitObject() void BCalendarView::_SetToDay() { - BDate date(fYear, fMonth, 1); + BDate date(fDate.Year(), fDate.Month(), 1); if (!date.IsValid()) return; + const int32 firstDayOffset = (7 + date.DayOfWeek() - fStartOfWeek) % 7; + + int32 day = 1 - firstDayOffset; + for (int32 row = 0; row < 6; ++row) { + for (int32 column = 0; column < 7; ++column) { + if (day == fDate.Day()) { + fNewFocusedDay.SetTo(row, column); + fNewSelectedDay.SetTo(row, column); + return; + } + day++; + } + } + fNewFocusedDay.SetTo(0, 0); fNewSelectedDay.SetTo(0, 0); - - const int32 dayCountCurrent = date.DaysInMonth(); - - int32 firstDay = date.DayOfWeek(); - if (fWeekStart == B_WEEK_START_MONDAY) - firstDay = ((firstDay - 1) < 0) ? 6 : firstDay -1; - - int32 counter = 0; - for (int32 row = 0; row < 6; ++row) { - for (int32 column = 0; column < 7; ++column) { - int32 day = counter - (firstDay - 1); - if (counter >= firstDay - && counter <= dayCountCurrent + firstDay - 1) { - if (day == fDay) { - fNewFocusedDay.SetTo(row, column); - fNewSelectedDay.SetTo(row, column); - return; - } - } - counter++; - } - } } void -BCalendarView::_GetYearMonth(int32 *year, int32 *month) const +BCalendarView::_GetYearMonthForSelection(const Selection& selection, + int32* year, int32* month) const { - BDate date(fYear, fMonth, 1); + BDate startOfMonth(fDate.Year(), fDate.Month(), 1); + const int32 firstDayOffset + = (7 + startOfMonth.DayOfWeek() - fStartOfWeek) % 7; + const int32 daysInMonth = startOfMonth.DaysInMonth(); - const int32 dayCountCurrent = date.DaysInMonth(); - - int32 firstDay = date.DayOfWeek(); - if (fWeekStart == B_WEEK_START_MONDAY) - firstDay = ((firstDay - 1) < 0) ? 6 : firstDay -1; - - // set the date to one month before - if (date.Month() == 1) - date.SetDate(date.Year() -1, 12, fDay); - else - date.SetDate(date.Year(), date.Month() - 1, fDay); - - const int32 currRow = fSelectedDay.row; - const int32 currColumn = fSelectedDay.column; - - *year = fYear; - *month = fMonth; - - int32 counter = 0; - for (int32 row = 0; row < 6; ++row) { - for (int32 column = 0; column < 7; ++column) { - if (counter < firstDay - || counter > dayCountCurrent + firstDay - 1) { - if (counter - firstDay < 0) { - if (row == currRow && column == currColumn) { - *year = date.Year(); - *month = date.Month(); - break; - } - } else { - if (row == currRow && column == currColumn) { - *year = fYear; - *month = fMonth +1; - if (fMonth == 12) { - *year = fYear +1; - *month = 1; - } - break; - } - } - } else { - if (row == currRow && column == currColumn) - break; - } - counter++; - } - } + BDate date(fDate); + const int32 dayOffset = selection.row * 7 + selection.column; + if (dayOffset < firstDayOffset) + date.AddMonths(-1); + else if (dayOffset >= firstDayOffset + daysInMonth) + date.AddMonths(1); + if (year != NULL) + *year = date.Year(); + if (month != NULL) + *month = date.Month(); } void -BCalendarView::_GetPreferredSize(float *_width, float *_height) +BCalendarView::_GetPreferredSize(float* _width, float* _height) { BFont font; GetFont(&font); @@ -911,87 +745,60 @@ BCalendarView::_GetPreferredSize(float *_width, float *_height) void BCalendarView::_SetupDayNames() { - const BDate date(fYear, fMonth, fDay); - if (!date.IsValid()) - return; - - if (fWeekStart == B_WEEK_START_MONDAY) { - for (int32 i = 1; i <= 7; ++i) { - fDayNames[i -1] = date.ShortDayName(i); - } - } else { - fDayNames[0] = date.ShortDayName(7); - for (int32 i = 1; i < 7; ++i) { - fDayNames[i] = date.ShortDayName(i); - } - } + for (int32 i = 0; i <= 6; ++i) + fDayNames[i] = fDate.ShortDayName(1 + (fStartOfWeek - 1 + i) % 7); } void BCalendarView::_SetupDayNumbers() { - BDate date(fYear, fMonth, 1); - if (!date.IsValid()) + BDate startOfMonth(fDate.Year(), fDate.Month(), 1); + if (!startOfMonth.IsValid()) return; fFocusedDay.SetTo(0, 0); fSelectedDay.SetTo(0, 0); fNewFocusedDay.SetTo(0, 0); - const int32 dayCountCurrent = date.DaysInMonth(); - - int32 firstDay = date.DayOfWeek(); - if (fWeekStart == B_WEEK_START_MONDAY) - firstDay = ((firstDay - 1) < 0) ? 6 : firstDay -1; + const int32 daysInMonth = startOfMonth.DaysInMonth(); + const int32 firstDayOffset + = (7 + startOfMonth.DayOfWeek() - fStartOfWeek) % 7; // calc the last day one month before - if (date.Month() == 1) - date.SetDate(date.Year() -1, 12, 1); - else - date.SetDate(date.Year(), date.Month() - 1, 1); - const int32 lastDayBefore = date.DaysInMonth(); + BDate lastDayInMonthBefore(startOfMonth); + lastDayInMonthBefore.AddDays(-1); + const int32 lastDayBefore = lastDayInMonthBefore.DaysInMonth(); int32 counter = 0; int32 firstDayAfter = 1; for (int32 row = 0; row < 6; ++row) { for (int32 column = 0; column < 7; ++column) { - int32 day = counter - (firstDay - 1); - if (counter < firstDay - || counter > dayCountCurrent + firstDay - 1) { - if (counter - firstDay < 0) - day += lastDayBefore; - else - day = firstDayAfter++; - } else { - if (day == fDay) { - fFocusedDay.SetTo(row, column); - fSelectedDay.SetTo(row, column); - fNewFocusedDay.SetTo(row, column); - } + int32 day = 1 + counter - firstDayOffset; + if (counter < firstDayOffset) + day += lastDayBefore; + else if (counter >= firstDayOffset + daysInMonth) + day = firstDayAfter++; + else if (day == fDate.Day()) { + fFocusedDay.SetTo(row, column); + fSelectedDay.SetTo(row, column); + fNewFocusedDay.SetTo(row, column); } counter++; - fDayNumbers[row][column].SetTo(""); + fDayNumbers[row][column].Truncate(0); fDayNumbers[row][column] << day; } } } + void BCalendarView::_SetupWeekNumbers() { - BDate date(fYear, fMonth, 1); + BDate date(fDate.Year(), fDate.Month(), 1); if (!date.IsValid()) return; - // date on Thursday determines week number (ISO 8601) - int dayOfWeek = date.DayOfWeek(); - // adjust weekday if Monday is week start, - // then Sunday is last day in week - if (fWeekStart == B_WEEK_START_MONDAY && dayOfWeek == 0) - dayOfWeek = 7; - date.AddDays(4 - dayOfWeek); - for (int32 row = 0; row < 6; ++row) { fWeekNumbers[row].SetTo(""); fWeekNumbers[row] << date.WeekNumber(); @@ -1002,26 +809,24 @@ BCalendarView::_SetupWeekNumbers() void BCalendarView::_DrawDay(int32 currRow, int32 currColumn, int32 row, - int32 column, int32 counter, BRect frame, const char *text, bool focus) + int32 column, int32 counter, BRect frame, const char* text, bool focus) { - const BDate date(fYear, fMonth, 1); - const int32 daysMonth = date.DaysInMonth(); - - int32 firstDay = date.DayOfWeek(); - if (fWeekStart == B_WEEK_START_MONDAY) - firstDay = ((firstDay - 1) < 0) ? 6 : firstDay -1; + BDate startOfMonth(fDate.Year(), fDate.Month(), 1); + const int32 firstDayOffset + = (7 + startOfMonth.DayOfWeek() - fStartOfWeek) % 7; + const int32 daysMonth = startOfMonth.DaysInMonth(); bool enabled = true; bool selected = false; // check for the current date if (currRow == row && currColumn == column) { selected = true; // draw current date selected - if (counter <= firstDay || counter > firstDay + daysMonth) { + if (counter <= firstDayOffset || counter > firstDayOffset + daysMonth) { enabled = false; // days of month before or after selected = false; // not selected but able to get focus } } else { - if (counter <= firstDay || counter > firstDay + daysMonth) + if (counter <= firstDayOffset || counter > firstDayOffset + daysMonth) enabled = false; // days of month before or after } @@ -1046,7 +851,7 @@ BCalendarView::_DrawDays() BRect tmp = frame; for (int32 column = 0; column < 7; ++column) { counter++; - const char *day = fDayNumbers[row][column].String(); + const char* day = fDayNumbers[row][column].String(); bool focus = isFocus && focusRow == row && focusColumn == column; _DrawDay(currRow, currColumn, row, column, counter, tmp, day, focus); @@ -1078,12 +883,11 @@ BCalendarView::_DrawFocusRect() fFocusedDay.SetTo(row, column); bool focus = IsFocus() && true; - const char *day = fDayNumbers[row][column].String(); + const char* day = fDayNumbers[row][column].String(); _DrawDay(currRow, currColumn, row, column, counter, tmp, day, focus); - } - else if (focusRow == row && focusColumn == column) { - const char *day = fDayNumbers[row][column].String(); + } else if (focusRow == row && focusColumn == column) { + const char* day = fDayNumbers[row][column].String(); _DrawDay(currRow, currColumn, row, column, counter, tmp, day, false); } @@ -1152,7 +956,7 @@ BCalendarView::_DrawWeekHeader() void -BCalendarView::_DrawItem(BView *owner, BRect frame, const char *text, +BCalendarView::_DrawItem(BView* owner, BRect frame, const char* text, bool isSelected, bool isEnabled, bool focus) { rgb_color lColor = LowColor(); @@ -1179,10 +983,10 @@ BCalendarView::_DrawItem(BView *owner, BRect frame, const char *text, SetHighColor(tint_color(black, B_LIGHTEN_2_TINT)); float offsetH = frame.Width() / 2.0; - float offsetV = (frame.Height() / 2.0) + (FontHeight(owner) / 2.0) - 2.0; + float offsetV = frame.Height() / 2.0 + FontHeight(owner) / 2.0 - 2.0; - DrawString(text, BPoint(frame.right - offsetH - - (StringWidth(text) / 2.0), frame.top + offsetV)); + DrawString(text, BPoint(frame.right - offsetH - StringWidth(text) / 2.0, + frame.top + offsetV)); SetLowColor(lColor); SetHighColor(highColor); @@ -1209,13 +1013,12 @@ BCalendarView::_UpdateSelection() && fNewSelectedDay.column == column) { fSelectedDay.SetTo(row, column); - const char *day = fDayNumbers[row][column].String(); + const char* day = fDayNumbers[row][column].String(); bool focus = IsFocus() && focusRow == row && focusColumn == column; _DrawDay(row, column, row, column, counter, tmp, day, focus); - } - else if (currRow == row && currColumn == column) { - const char *day = fDayNumbers[row][column].String(); + } else if (currRow == row && currColumn == column) { + const char* day = fDayNumbers[row][column].String(); bool focus = IsFocus() && focusRow == row && focusColumn == column; _DrawDay(currRow, currColumn, -1, -1, counter, tmp, day, focus); @@ -1256,7 +1059,7 @@ BCalendarView::_FirstCalendarItemFrame() const BRect -BCalendarView::_SetNewSelectedDay(const BPoint &where) +BCalendarView::_SetNewSelectedDay(const BPoint& where) { BRect frame = _FirstCalendarItemFrame(); @@ -1267,7 +1070,15 @@ BCalendarView::_SetNewSelectedDay(const BPoint &where) counter++; if (tmp.Contains(where)) { fNewSelectedDay.SetTo(row, column); - fDay = atoi(fDayNumbers[row][column].String()); + int32 year; + int32 month; + _GetYearMonthForSelection(fNewSelectedDay, &year, &month); + if (month == fDate.Month()) { + // only change date if a day in the current month has been + // selected + int32 day = atoi(fDayNumbers[row][column].String()); + fDate.SetDate(year, month, day); + } return tmp; } tmp.OffsetBy(tmp.Width(), 0.0); @@ -1280,7 +1091,7 @@ BCalendarView::_SetNewSelectedDay(const BPoint &where) BRect -BCalendarView::_RectOfDay(const Selection &selection) const +BCalendarView::_RectOfDay(const Selection& selection) const { BRect frame = _FirstCalendarItemFrame(); @@ -1289,9 +1100,8 @@ BCalendarView::_RectOfDay(const Selection &selection) const BRect tmp = frame; for (int32 column = 0; column < 7; ++column) { counter++; - if (selection.row == row && selection.column == column) { + if (selection.row == row && selection.column == column) return tmp; - } tmp.OffsetBy(tmp.Width(), 0.0); } frame.OffsetBy(0.0, frame.Height()); diff --git a/src/preferences/time/DateTimeView.cpp b/src/preferences/time/DateTimeView.cpp index 7a7ef43bed..cf8d5dd7ed 100644 --- a/src/preferences/time/DateTimeView.cpp +++ b/src/preferences/time/DateTimeView.cpp @@ -187,9 +187,7 @@ DateTimeView::_PrefletUptime() const void DateTimeView::_InitView() { - BPrivate::week_start weekStart = (BPrivate::week_start) - BLocale::Default()->StartOfWeek(); - fCalendarView = new BCalendarView("calendar", weekStart); + fCalendarView = new BCalendarView("calendar"); fCalendarView->SetWeekNumberHeaderVisible(false); fCalendarView->SetSelectionMessage(new BMessage(kDayChanged)); fCalendarView->SetInvocationMessage(new BMessage(kDayChanged)); @@ -305,8 +303,16 @@ DateTimeView::_UpdateDateTime(BMessage* message) if (message->FindInt32("month", &month) == B_OK && message->FindInt32("day", &day) == B_OK && message->FindInt32("year", &year) == B_OK) { - fDateEdit->SetDate(year, month, day); - fCalendarView->SetDate(year, month, day); + static int32 lastDay; + static int32 lastMonth; + static int32 lastYear; + if (day != lastDay || month != lastMonth || year != lastYear) { + fDateEdit->SetDate(year, month, day); + fCalendarView->SetDate(year, month, day); + lastDay = day; + lastMonth = month; + lastYear = year; + } } int32 hour; From eaa31a573d4e8f6cb5e7a9ac65dc06207f411002 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 7 Sep 2011 22:39:08 +0000 Subject: [PATCH 263/702] * add DeviceSCSI for handling scsi / disk devices identified by scsi bus * complete static category defines * a few style fixes * ata / scsi trees are still ugly but make a little more sense now * search for a pretty name as a last resort before going 'Unknown device' * closes #6503 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42721 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/devices/Device.h | 28 ++++++-- src/apps/devices/DeviceSCSI.cpp | 109 +++++++++++++++++++++++++++++++ src/apps/devices/DeviceSCSI.h | 25 +++++++ src/apps/devices/DevicesView.cpp | 37 +++++++---- src/apps/devices/DevicesView.h | 1 + src/apps/devices/Jamfile | 2 + 6 files changed, 185 insertions(+), 17 deletions(-) create mode 100644 src/apps/devices/DeviceSCSI.cpp create mode 100644 src/apps/devices/DeviceSCSI.h diff --git a/src/apps/devices/Device.h b/src/apps/devices/Device.h index 126950a04e..5b1dc0ef68 100644 --- a/src/apps/devices/Device.h +++ b/src/apps/devices/Device.h @@ -44,10 +44,26 @@ typedef std::vector Attributes; typedef enum { - CAT_NONE = 0, - CAT_BUS = 6, - CAT_COMPUTER = 0x12, - CAT_ACPI = 0x13 + CAT_NONE, // 0x00 + CAT_MASS, // 0x01 + CAT_NETWORK, // 0x02 + CAT_DISPLAY, // 0x03 + CAT_MULTIMEDIA, // 0x04 + CAT_MEMORY, // 0x05 + CAT_BUS, // 0x06 + CAT_COMM, // 0x07 + CAT_GENERIC, // 0x08 + CAT_INPUT, // 0x09 + CAT_DOCK, // 0x0A + CAT_CPU, // 0x0B + CAT_SERIAL, // 0x0C + CAT_WIRELESS, // 0x0D + CAT_INTEL, // 0x0E + CAT_SATELLITE, // 0x0F + CAT_CRYPTO, // 0x10 + CAT_SIGNAL, // 0x11 + CAT_COMPUTER, // 0x12 + CAT_ACPI // 0x13 } Category; @@ -57,8 +73,8 @@ extern const char* kCategoryString[]; class Device : public BStringItem { public: Device(Device* physicalParent, - BusType busType=BUS_NONE, - Category category=CAT_NONE, + BusType busType = BUS_NONE, + Category category = CAT_NONE, const BString& name = "unknown", const BString& manufacturer = "unknown", const BString& driverUsed = "unknown", diff --git a/src/apps/devices/DeviceSCSI.cpp b/src/apps/devices/DeviceSCSI.cpp new file mode 100644 index 0000000000..fd38d97ad8 --- /dev/null +++ b/src/apps/devices/DeviceSCSI.cpp @@ -0,0 +1,109 @@ +/* + * Copyright 2008-2011, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include "DeviceSCSI.h" + +#include +#include +#include + +#include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "DeviceSCSI" + + +// standard SCSI device types +const char* SCSITypeMap[] = { + B_TRANSLATE("Disk Drive"), // 0x00 + B_TRANSLATE("Tape Drive"), // 0x01 + B_TRANSLATE("Printer"), // 0x02 + B_TRANSLATE("Processor"), // 0x03 + B_TRANSLATE("Worm"), // 0x04 + B_TRANSLATE("CD-ROM"), // 0x05 + B_TRANSLATE("Scanner"), // 0x06 + B_TRANSLATE("Optical Drive"), // 0x07 + B_TRANSLATE("Changer"), // 0x08 + B_TRANSLATE("Communications"), // 0x09 + B_TRANSLATE("Graphics Peripheral"), // 0x0A + B_TRANSLATE("Graphics Peripheral"), // 0x0B + B_TRANSLATE("Array"), // 0x0C + B_TRANSLATE("Enclosure"), // 0x0D + B_TRANSLATE("RBC"), // 0x0E + B_TRANSLATE("Card Reader"), // 0x0F + B_TRANSLATE("Bridge"), // 0x10 + B_TRANSLATE("Other") // 0x11 +}; + + +DeviceSCSI::DeviceSCSI(Device* parent) + : + Device(parent) +{ +} + + +DeviceSCSI::~DeviceSCSI() +{ +} + + +void +DeviceSCSI::InitFromAttributes() +{ + BString nodeVendor(GetAttribute("scsi/vendor").fValue); + BString nodeProduct(GetAttribute("scsi/product").fValue); + + fCategory = (Category)CAT_MASS; + + uint32 nodeTypeID = atoi(GetAttribute("scsi/type").fValue); + + SetAttribute(B_TRANSLATE("Device name"), nodeProduct.String()); + SetAttribute(B_TRANSLATE("Manufacturer"), nodeVendor.String()); + SetAttribute(B_TRANSLATE("Device class"), SCSITypeMap[nodeTypeID]); + + BString listName; + listName + << "SCSI " << SCSITypeMap[nodeTypeID] << " (" << nodeProduct << ")"; + + SetText(listName.String()); +} + + +Attributes +DeviceSCSI::GetBusAttributes() +{ + // Push back things that matter for SCSI devices + Attributes attributes; + attributes.push_back(GetAttribute(B_TRANSLATE("Device class"))); + attributes.push_back(GetAttribute(B_TRANSLATE("Device name"))); + attributes.push_back(GetAttribute(B_TRANSLATE("Manufacturer"))); + attributes.push_back(GetAttribute("scsi/revision")); + attributes.push_back(GetAttribute("scsi/target_id")); + attributes.push_back(GetAttribute("scsi/target_lun")); + return attributes; +} + + +BString +DeviceSCSI::GetBusStrings() +{ + BString str(B_TRANSLATE("Class Info:\t\t\t\t: %classInfo%")); + str.ReplaceFirst("%classInfo%", fAttributeMap["Class Info"]); + + return str; +} + + +BString +DeviceSCSI::GetBusTabName() +{ + return B_TRANSLATE("SCSI Information"); +} + diff --git a/src/apps/devices/DeviceSCSI.h b/src/apps/devices/DeviceSCSI.h new file mode 100644 index 0000000000..d97083905b --- /dev/null +++ b/src/apps/devices/DeviceSCSI.h @@ -0,0 +1,25 @@ +/* + * Copyright 2008-2011, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ +#ifndef DEVICESCSI_H +#define DEVICESCSI_H + + +#include "Device.h" + + +class DeviceSCSI : public Device { +public: + DeviceSCSI(Device* parent); + virtual ~DeviceSCSI(); + virtual Attributes GetBusAttributes(); + virtual BString GetBusStrings(); + virtual void InitFromAttributes(); + virtual BString GetBusTabName(); +}; + +#endif /* DEVICESCSI_H */ diff --git a/src/apps/devices/DevicesView.cpp b/src/apps/devices/DevicesView.cpp index bd3582d1b9..040ea43388 100644 --- a/src/apps/devices/DevicesView.cpp +++ b/src/apps/devices/DevicesView.cpp @@ -280,54 +280,69 @@ DevicesView::AddDeviceAndChildren(device_node_cookie *node, Device* parent) for (unsigned int i = 0; i < attributes.size(); i++) { // Devices Root 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, B_TRANSLATE("Computer")); + CAT_COMPUTER, B_TRANSLATE("Computer")); break; } // ACPI Controller if (attributes[i].fName == B_DEVICE_PRETTY_NAME - && attributes[i].fValue == "ACPI") { + && attributes[i].fValue == "ACPI") { newDevice = new Device(parent, BUS_ACPI, - CAT_BUS, B_TRANSLATE("ACPI bus")); + CAT_BUS, B_TRANSLATE("ACPI bus")); break; } // PCI bus if (attributes[i].fName == B_DEVICE_PRETTY_NAME - && attributes[i].fValue == "PCI") { + && attributes[i].fValue == "PCI") { newDevice = new Device(parent, BUS_PCI, - CAT_BUS, B_TRANSLATE("PCI bus")); + CAT_BUS, B_TRANSLATE("PCI bus")); break; } // ISA bus if (attributes[i].fName == B_DEVICE_BUS - && attributes[i].fValue == "isa") { + && attributes[i].fValue == "isa") { newDevice = new Device(parent, BUS_ISA, - CAT_BUS, B_TRANSLATE("ISA bus")); + CAT_BUS, B_TRANSLATE("ISA bus")); break; } // PCI device if (attributes[i].fName == B_DEVICE_BUS - && attributes[i].fValue == "pci") { + && attributes[i].fValue == "pci") { newDevice = new DevicePCI(parent); break; } // ACPI device if (attributes[i].fName == B_DEVICE_BUS - && attributes[i].fValue == "acpi") { + && attributes[i].fValue == "acpi") { newDevice = new DeviceACPI(parent); break; } + + // SCSI device + if (attributes[i].fName == B_DEVICE_BUS + && attributes[i].fValue == "scsi") { + newDevice = new DeviceSCSI(parent); + break; + } + + // Last resort, lets look for a pretty name + if (attributes[i].fName == B_DEVICE_PRETTY_NAME) { + newDevice = new Device(parent, BUS_NONE, + CAT_NONE, attributes[i].fValue); + break; + } } + // A completely unknown device if (newDevice == NULL) { newDevice = new Device(parent, BUS_NONE, - CAT_NONE, B_TRANSLATE("Unknown device")); + CAT_NONE, B_TRANSLATE("Unknown device")); } // Add its attributes to the device, initialize it and add to the list. diff --git a/src/apps/devices/DevicesView.h b/src/apps/devices/DevicesView.h index c71d5e05bc..167c763708 100644 --- a/src/apps/devices/DevicesView.h +++ b/src/apps/devices/DevicesView.h @@ -21,6 +21,7 @@ #include "Device.h" #include "DevicePCI.h" #include "DeviceACPI.h" +#include "DeviceSCSI.h" #include "PropertyList.h" #include "PropertyListPlain.h" diff --git a/src/apps/devices/Jamfile b/src/apps/devices/Jamfile index fe7b609b71..e69b600b1e 100644 --- a/src/apps/devices/Jamfile +++ b/src/apps/devices/Jamfile @@ -69,6 +69,7 @@ Application Devices : dm_wrapper.c DevicePCI.cpp DeviceACPI.cpp + DeviceSCSI.cpp Device.cpp PropertyList.cpp PropertyListPlain.cpp @@ -86,6 +87,7 @@ DoCatalogs Devices : PropertyList.cpp PropertyListPlain.cpp DeviceACPI.cpp + DeviceSCSI.cpp Device.cpp ; From 252add8c2199c33b9d39c8d360e5f6e9418d8a21 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 8 Sep 2011 02:22:05 +0000 Subject: [PATCH 264/702] * style cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42722 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/devices/DevicesView.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/apps/devices/DevicesView.cpp b/src/apps/devices/DevicesView.cpp index 040ea43388..90743740a8 100644 --- a/src/apps/devices/DevicesView.cpp +++ b/src/apps/devices/DevicesView.cpp @@ -38,7 +38,7 @@ DevicesView::CreateLayout() BMenu* menu = new BMenu(B_TRANSLATE("Devices")); BMenuItem* item; menu->AddItem(new BMenuItem(B_TRANSLATE("Refresh devices"), - new BMessage(kMsgRefresh), 'R')); + new BMessage(kMsgRefresh), 'R')); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Report compatibility"), new BMessage(kMsgReportCompatibility))); item->SetEnabled(false); @@ -133,7 +133,7 @@ DevicesView::RescanDevices() void DevicesView::DeleteDevices() { - while(fDevices.size() > 0) { + while (fDevices.size() > 0) { delete fDevices.back(); fDevices.pop_back(); } @@ -149,7 +149,7 @@ DevicesView::CreateCategoryMap() const char* categoryName = kCategoryString[category]; iter = fCategoryMap.find(category); - if( iter == fCategoryMap.end() ) { + if (iter == fCategoryMap.end()) { // This category has not yet been added, add it. fCategoryMap[category] = new Device(NULL, BUS_NONE, CAT_NONE, categoryName); @@ -162,7 +162,7 @@ void DevicesView::DeleteCategoryMap() { CategoryMapIterator iter; - for(iter = fCategoryMap.begin(); iter != fCategoryMap.end(); iter++) { + for (iter = fCategoryMap.begin(); iter != fCategoryMap.end(); iter++) { delete iter->second; } fCategoryMap.clear(); @@ -173,14 +173,14 @@ int DevicesView::SortItemsCompare(const BListItem *item1, const BListItem *item2) { - const BStringItem* stringItem1 = dynamic_cast(item1); + const BStringItem* stringItem1 = dynamic_cast(item1); const BStringItem* stringItem2 = dynamic_cast(item2); if (!(stringItem1 && stringItem2)) { // is this check necessary? std::cerr << "Could not cast BListItem to BStringItem, file a bug\n"; return 0; } - return Compare(stringItem1->Text(),stringItem2->Text()); + return Compare(stringItem1->Text(), stringItem2->Text()); } @@ -198,8 +198,7 @@ DevicesView::RebuildDevicesOutline() AddChildrenToOutlineByConnection(fDevices[i]); } } - } - else if (fOrderBy == ORDER_BY_CATEGORY) { + } else if (fOrderBy == ORDER_BY_CATEGORY) { // Add all categories to the outline CategoryMapIterator iter; for (iter = fCategoryMap.begin(); iter != fCategoryMap.end(); iter++) { @@ -211,11 +210,11 @@ DevicesView::RebuildDevicesOutline() Category category = fDevices[i]->GetCategory(); iter = fCategoryMap.find(category); - if(iter == fCategoryMap.end()) { - std::cerr << "Tried to add device without category, file a bug\n"; + if (iter == fCategoryMap.end()) { + std::cerr + << "Tried to add device without category, file a bug\n"; continue; - } - else { + } else { fDevicesOutline->AddUnder(fDevices[i], iter->second); } } From e2ee3ffe9e137d7990c3dae292e82d36e7dffe81 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 8 Sep 2011 02:30:43 +0000 Subject: [PATCH 265/702] * detect storage controller and handle (ata/ide/scsi busses all set controller_name) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42723 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/devices/DevicesView.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/apps/devices/DevicesView.cpp b/src/apps/devices/DevicesView.cpp index 90743740a8..86e16efa00 100644 --- a/src/apps/devices/DevicesView.cpp +++ b/src/apps/devices/DevicesView.cpp @@ -323,7 +323,13 @@ DevicesView::AddDeviceAndChildren(device_node_cookie *node, Device* parent) break; } - // SCSI device + // ATA / SCSI / IDE controller + if (attributes[i].fName == "controller_name") { + newDevice = new Device(parent, BUS_PCI, + CAT_MASS, attributes[i].fValue); + } + + // SCSI device node if (attributes[i].fName == B_DEVICE_BUS && attributes[i].fValue == "scsi") { newDevice = new DeviceSCSI(parent); From 51928f9997c3cc045eeb78041abb4e3ddd53f4c0 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 8 Sep 2011 03:15:37 +0000 Subject: [PATCH 266/702] * make ata/ide channel pretty names more descriptive * verified nothing in the source tree references "IDE PCI" * line length fixes git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42724 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/generic/ata_adapter/ata_adapter.c | 16 ++++++++++++---- .../kernel/generic/ide_adapter/ide_adapter.c | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c b/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c index 48b8365aa0..4289ed755b 100644 --- a/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c +++ b/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -489,14 +490,21 @@ ata_adapter_publish_channel(device_node *controller_node, uint8 channel_index, const char *name, const io_resource *resources, device_node **node) { + char prettyName[25]; + sprintf(prettyName, "ATA Channel %" B_PRIu8, channel_index); + device_attr attrs[] = { // info about ourself and our consumer - { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, { string: "IDE PCI" }}, - { B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: ATA_FOR_CONTROLLER_MODULE_NAME }}, + { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, + { string: prettyName }}, + { B_DEVICE_FIXED_CHILD, B_STRING_TYPE, + { string: ATA_FOR_CONTROLLER_MODULE_NAME }}, // private data to identify channel - { ATA_ADAPTER_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }}, - { ATA_ADAPTER_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }}, + { ATA_ADAPTER_COMMAND_BLOCK_BASE, B_UINT16_TYPE, + { ui16: command_block_base }}, + { ATA_ADAPTER_CONTROL_BLOCK_BASE, B_UINT16_TYPE, + { ui16: control_block_base }}, { ATA_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: can_dma }}, { ATA_ADAPTER_INTNUM, B_UINT8_TYPE, { ui8: intnum }}, { ATA_ADAPTER_CHANNEL_INDEX, B_UINT8_TYPE, { ui8: channel_index }}, diff --git a/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c b/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c index 80fca61bda..6770fa0ec6 100644 --- a/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c +++ b/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -472,14 +473,21 @@ ide_adapter_publish_channel(device_node *controller_node, uint8 channel_index, const char *name, const io_resource *resources, device_node **node) { + char prettyName[25]; + sprintf(prettyName, "IDE Channel %" B_PRIu8, channel_index); + device_attr attrs[] = { // info about ourself and our consumer - { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, { string: "IDE PCI" }}, - { B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: IDE_FOR_CONTROLLER_MODULE_NAME }}, + { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, + { string: prettyName }}, + { B_DEVICE_FIXED_CHILD, B_STRING_TYPE, + { string: IDE_FOR_CONTROLLER_MODULE_NAME }}, // private data to identify channel - { IDE_ADAPTER_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }}, - { IDE_ADAPTER_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }}, + { IDE_ADAPTER_COMMAND_BLOCK_BASE, B_UINT16_TYPE, + { ui16: command_block_base }}, + { IDE_ADAPTER_CONTROL_BLOCK_BASE, B_UINT16_TYPE, + { ui16: control_block_base }}, { IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: can_dma }}, { IDE_ADAPTER_INTNUM, B_UINT8_TYPE, { ui8: intnum }}, { IDE_ADAPTER_CHANNEL_INDEX, B_UINT8_TYPE, { ui8: channel_index }}, From 6b8f21461e9f89bab101975a57d5475d19e91062 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 8 Sep 2011 15:47:25 +0000 Subject: [PATCH 267/702] * change c to cpp to resolve C89/C99 issue. (thanks Deadyak!) * changing to cpp uncovered a few bugs in ide_adaptor * correct losing signed integer * correct a variable name that conflicted with a type * gcc2 build now fixed after r42724 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42725 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/generic/ata_adapter/Jamfile | 2 +- .../ata_adapter/{ata_adapter.c => ata_adapter.cpp} | 0 src/add-ons/kernel/generic/ide_adapter/Jamfile | 2 +- .../ide_adapter/{ide_adapter.c => ide_adapter.cpp} | 8 ++++---- 4 files changed, 6 insertions(+), 6 deletions(-) rename src/add-ons/kernel/generic/ata_adapter/{ata_adapter.c => ata_adapter.cpp} (100%) rename src/add-ons/kernel/generic/ide_adapter/{ide_adapter.c => ide_adapter.cpp} (99%) diff --git a/src/add-ons/kernel/generic/ata_adapter/Jamfile b/src/add-ons/kernel/generic/ata_adapter/Jamfile index 01d423f8e7..7f846d7d90 100644 --- a/src/add-ons/kernel/generic/ata_adapter/Jamfile +++ b/src/add-ons/kernel/generic/ata_adapter/Jamfile @@ -3,6 +3,6 @@ SubDir HAIKU_TOP src add-ons kernel generic ata_adapter ; UsePrivateHeaders drivers kernel ; KernelAddon ata_adapter : - ata_adapter.c + ata_adapter.cpp ; diff --git a/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c b/src/add-ons/kernel/generic/ata_adapter/ata_adapter.cpp similarity index 100% rename from src/add-ons/kernel/generic/ata_adapter/ata_adapter.c rename to src/add-ons/kernel/generic/ata_adapter/ata_adapter.cpp diff --git a/src/add-ons/kernel/generic/ide_adapter/Jamfile b/src/add-ons/kernel/generic/ide_adapter/Jamfile index 83d8b92d3b..5ffd794197 100644 --- a/src/add-ons/kernel/generic/ide_adapter/Jamfile +++ b/src/add-ons/kernel/generic/ide_adapter/Jamfile @@ -3,6 +3,6 @@ SubDir HAIKU_TOP src add-ons kernel generic ide_adapter ; UsePrivateHeaders drivers kernel ; KernelAddon ide_adapter : - ide_adapter.c + ide_adapter.cpp ; diff --git a/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c b/src/add-ons/kernel/generic/ide_adapter/ide_adapter.cpp similarity index 99% rename from src/add-ons/kernel/generic/ide_adapter/ide_adapter.c rename to src/add-ons/kernel/generic/ide_adapter/ide_adapter.cpp index 6770fa0ec6..f7a5d2c7e0 100644 --- a/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c +++ b/src/add-ons/kernel/generic/ide_adapter/ide_adapter.cpp @@ -40,7 +40,7 @@ static device_manager_info *pnp; static void set_channel(ide_adapter_channel_info *channel, ide_channel ideChannel) { - channel->ide_channel = ideChannel; + channel->ideChannel = ideChannel; } @@ -212,7 +212,7 @@ ide_adapter_inthand(void *arg) // acknowledge IRQ status = pci->read_io_8(device, channel->command_block_base + 7); - return ide->irq_handler(channel->ide_channel, status); + return ide->irq_handler(channel->ideChannel, status); } @@ -460,7 +460,7 @@ ide_adapter_channel_removed(ide_adapter_channel_info *channel) if (channel != NULL) // disable access instantly - atomic_or(&channel->lost, 1); + atomic_or((int32*)&channel->lost, 1); } @@ -644,7 +644,7 @@ ide_adapter_controller_removed(ide_adapter_controller_info *controller) if (controller != NULL) { // disable access instantly; unit_device takes care of unregistering ioports - atomic_or(&controller->lost, 1); + atomic_or((int32*)&controller->lost, 1); } } From 560e1322cd092d5aa69420bfeaafeab609854511 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 8 Sep 2011 18:30:28 +0000 Subject: [PATCH 268/702] * add missed header file that goes along with r42725 * change var to be different then type git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42726 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/drivers/ide_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headers/private/drivers/ide_adapter.h b/headers/private/drivers/ide_adapter.h index fea3435c62..cc8a6baeaf 100644 --- a/headers/private/drivers/ide_adapter.h +++ b/headers/private/drivers/ide_adapter.h @@ -101,7 +101,7 @@ typedef struct ide_adapter_channel_info { uint32 lost; // != 0 if device got removed, i.e. if it must not // be accessed anymore - ide_channel ide_channel; + ide_channel ideChannel; device_node *node; int32 (*inthand)( void *arg ); From a8b357c7477d541c2c6d39fcba245b64cd9107a4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 8 Sep 2011 22:11:20 +0000 Subject: [PATCH 269/702] * run edid check on all connectors regardless of encoder * correction to output check (B_OK != true) * check for invalid gpio (prevents seg violation) * tab cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42727 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 53 ++++---- src/add-ons/accelerants/radeon_hd/display.cpp | 16 +-- src/add-ons/accelerants/radeon_hd/gpu.cpp | 120 ++++++++++-------- 3 files changed, 98 insertions(+), 91 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 0cfd541149..ff4908744d 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -139,40 +139,41 @@ struct pll_info { struct ddc_info { - uint8 gpio_id; + bool valid; + uint8 gpio_id; - uint16 mask_scl_reg; - uint16 mask_sda_reg; - uint16 mask_scl_shift; - uint16 mask_sda_shift; + uint16 mask_scl_reg; + uint16 mask_sda_reg; + uint16 mask_scl_shift; + uint16 mask_sda_shift; - uint16 gpio_en_scl_reg; - uint16 gpio_en_sda_reg; - uint16 gpio_en_scl_shift; - uint16 gpio_en_sda_shift; + uint16 gpio_en_scl_reg; + uint16 gpio_en_sda_reg; + uint16 gpio_en_scl_shift; + uint16 gpio_en_sda_shift; - uint16 gpio_y_scl_reg; - uint16 gpio_y_sda_reg; - uint16 gpio_y_scl_shift; - uint16 gpio_y_sda_shift; + uint16 gpio_y_scl_reg; + uint16 gpio_y_sda_reg; + uint16 gpio_y_scl_shift; + uint16 gpio_y_sda_shift; - uint16 gpio_a_scl_reg; - uint16 gpio_a_sda_reg; - uint16 gpio_a_scl_shift; - uint16 gpio_a_sda_shift; + uint16 gpio_a_scl_reg; + uint16 gpio_a_sda_reg; + uint16 gpio_a_scl_shift; + uint16 gpio_a_sda_shift; }; typedef struct { - bool valid; - uint16 line_mux; - uint16 connector_flags; - uint32 connector_type; - uint16 connector_object_id; - uint32 encoder_type; - uint16 encoder_object_id; - ddc_info connector_ddc_info; - i2c_bus connector_i2c; + bool valid; + uint16 line_mux; + uint16 connector_flags; + uint32 connector_type; + uint16 connector_object_id; + uint32 encoder_type; + uint16 encoder_object_id; + ddc_info connector_ddc_info; + i2c_bus connector_i2c; // TODO struct radeon_hpd hpd; } connector_info; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 04b81cc8e8..7d12624c1d 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -433,8 +433,8 @@ detect_connectors() = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { + // Found an encoder int32 k; - TRACE("%s: Found encoder at #%" B_PRIu32 "\n", __func__, j); for (k = 0; k < enc_obj->ucNumberOfObjects; k++) { uint16 encoder_obj = B_LENDIAN_TO_HOST_INT16( @@ -533,7 +533,7 @@ detect_connectors() } } } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { - ERROR("%s: TODO : Router object?\n", __func__); + ERROR("%s: TODO : Found router object?\n", __func__); } } @@ -630,20 +630,12 @@ detect_displays() if (displayIndex >= MAX_DISPLAY) continue; - bool found = false; - switch(gConnector[id]->encoder_type) { - case VIDEO_ENCODER_DAC: - found = radeon_gpu_read_edid(id, gDisplay[id]->edid_info); - break; - default: - found = false; - } - - if (found == true) { + if (radeon_gpu_read_edid(id, gDisplay[displayIndex]->edid_info)) { gDisplay[displayIndex]->active = true; // set this display as active gDisplay[displayIndex]->connector_index = id; // set physical connector index from gConnector + init_registers(gDisplay[displayIndex]->regs, displayIndex); if (detect_crt_ranges(displayIndex) == B_OK) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 15ad1df394..74769d012c 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -10,6 +10,7 @@ #include "accelerant_protos.h" #include "accelerant.h" +#include "bios.h" #include "gpu.h" #include "utility.h" @@ -286,6 +287,9 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) *_clock = (value >> info->gpio_y_scl_shift) & 1; *_data = (value >> info->gpio_y_sda_shift) & 1; + TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", + __func__, info->gpio_id, *_clock, *_data); + return B_OK; } @@ -304,6 +308,9 @@ set_i2c_signals(void* cookie, int clock, int data) Write32(OUT, info->gpio_id, value); + TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", + __func__, info->gpio_id, clock, data); + return B_OK; } @@ -311,6 +318,11 @@ set_i2c_signals(void* cookie, int clock, int data) bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid) { + // ensure things are sane + if (gConnector[connector]->connector_ddc_info.valid == false + || gConnector[connector]->connector_ddc_info.gpio_id == 0) + return false; + i2c_bus bus; ddc2_init_timing(&bus); @@ -339,74 +351,76 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) TRACE("%s: Path #%" B_PRId32 ": GPIO Pin 0x%" B_PRIx8 "\n", __func__, connector, gpio_id); - ATOM_GPIO_I2C_ASSIGMENT *gpio; - struct _ATOM_GPIO_I2C_INFO *i2c_info; int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); + uint8 frev; + uint8 crev; uint16 offset; uint16 size; - if (atom_parse_data_header(gAtomContext, index, - &size, NULL, NULL, &offset)) { + if (atom_parse_data_header(gAtomContext, index, &size, &frev, &crev, + &offset) != B_OK) { + ERROR("%s: GPIO pin not within AtomBIOS!\n", __func__); + gConnector[connector]->connector_ddc_info.valid = false; + return B_ERROR; + } - i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + offset); + struct _ATOM_GPIO_I2C_INFO *i2c_info + = (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + offset); - uint32 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) - / sizeof(ATOM_GPIO_I2C_ASSIGMENT); + uint32 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) + / sizeof(ATOM_GPIO_I2C_ASSIGMENT); - for (uint32 i = 0; i < num_indices; i++) { - gpio = &i2c_info->asGPIO_Info[i]; + for (uint32 i = 0; i < num_indices; i++) { + ATOM_GPIO_I2C_ASSIGMENT *gpio = &i2c_info->asGPIO_Info[i]; - // TODO : if DCE 4 and i == 7 ... manual override for evergreen - // TODO : if DCE 3 and i == 4 ... manual override + // TODO : if DCE 4 and i == 7 ... manual override for evergreen + // TODO : if DCE 3 and i == 4 ... manual override - if (gpio->sucI2cId.ucAccess != gpio_id) - continue; + if (gpio->sucI2cId.ucAccess != gpio_id) + continue; - // successful lookup - TRACE("%s: found i2c gpio\n", __func__); + // successful lookup + TRACE("%s: successful AtomBIOS GPIO lookup\n", __func__); + // populate gpio information + gConnector[connector]->connector_ddc_info.valid = true; + gConnector[connector]->connector_ddc_info.gpio_id = gpio_id; - // populate gpio information - gConnector[connector]->connector_ddc_info.gpio_id = gpio_id; + gConnector[connector]->connector_ddc_info.mask_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.mask_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataMaskRegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.mask_scl_shift + = (1 << gpio->ucClkMaskShift); + gConnector[connector]->connector_ddc_info.mask_sda_shift + = (1 << gpio->ucDataMaskShift); - gConnector[connector]->connector_ddc_info.mask_scl_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.mask_sda_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usDataMaskRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.mask_scl_shift - = (1 << gpio->ucClkMaskShift); - gConnector[connector]->connector_ddc_info.mask_sda_shift - = (1 << gpio->ucDataMaskShift); - - gConnector[connector]->connector_ddc_info.gpio_en_scl_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_en_sda_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usDataEnRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_en_scl_shift - = (1 << gpio->ucClkEnShift); - gConnector[connector]->connector_ddc_info.gpio_en_sda_shift - = (1 << gpio->ucDataEnShift); - - gConnector[connector]->connector_ddc_info.gpio_y_scl_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_y_sda_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_y_scl_shift - = (1 << gpio->ucClkY_Shift); - gConnector[connector]->connector_ddc_info.gpio_y_sda_shift - = (1 << gpio->ucDataY_Shift); - - gConnector[connector]->connector_ddc_info.gpio_a_scl_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_a_sda_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_a_scl_shift - = (1 << gpio->ucClkA_Shift); - gConnector[connector]->connector_ddc_info.gpio_a_sda_shift - = (1 << gpio->ucDataA_Shift); - } + gConnector[connector]->connector_ddc_info.gpio_en_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_en_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataEnRegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_en_scl_shift + = (1 << gpio->ucClkEnShift); + gConnector[connector]->connector_ddc_info.gpio_en_sda_shift + = (1 << gpio->ucDataEnShift); + gConnector[connector]->connector_ddc_info.gpio_y_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_y_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_y_scl_shift + = (1 << gpio->ucClkY_Shift); + gConnector[connector]->connector_ddc_info.gpio_y_sda_shift + = (1 << gpio->ucDataY_Shift); + gConnector[connector]->connector_ddc_info.gpio_a_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_a_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_a_scl_shift + = (1 << gpio->ucClkA_Shift); + gConnector[connector]->connector_ddc_info.gpio_a_sda_shift + = (1 << gpio->ucDataA_Shift); } return B_OK; From a9d08e5e27d95bc78bfb4869210db30fc27e4516 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 9 Sep 2011 15:44:27 +0000 Subject: [PATCH 270/702] * adjust error to make more sense git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42728 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 74769d012c..cf5afcd8dc 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -359,7 +359,8 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) if (atom_parse_data_header(gAtomContext, index, &size, &frev, &crev, &offset) != B_OK) { - ERROR("%s: GPIO pin not within AtomBIOS!\n", __func__); + ERROR("%s: could't read GPIO_I2C_Info table from AtomBIOS index %d!\n", + __func__, index); gConnector[connector]->connector_ddc_info.valid = false; return B_ERROR; } From c3ec7fedec4784b343767adcb37c4722924b18dc Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 9 Sep 2011 17:09:04 +0000 Subject: [PATCH 271/702] * bug fix in AtomBIOS data table parser, incorrect int size causing issues git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42729 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/atombios/atom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index a98781dea3..f037fb4137 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -1301,7 +1301,7 @@ atom_parse_data_header(atom_context *ctx, int index, uint16 *size, { int offset = index * 2 + 4; int idx = CU16(ctx->data_table + offset); - uint8 *mdt = ctx->bios + ctx->data_table + 4; + uint16 *mdt = (uint16 *)ctx->bios + ctx->data_table + 4; if (!mdt[index]) return B_ERROR; @@ -1323,7 +1323,7 @@ atom_parse_cmd_header(atom_context *ctx, int index, uint8 * frev, { int offset = index * 2 + 4; int idx = CU16(ctx->cmd_table + offset); - uint8 *mct = ctx->bios + ctx->cmd_table + 4; + uint16 *mct = (uint16 *)ctx->bios + ctx->cmd_table + 4; if (!mct[index]) return B_ERROR; From f3ccbf7121f034987da4dcea52f7b277c9a33b47 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 9 Sep 2011 18:45:38 +0000 Subject: [PATCH 272/702] * document GPIO values better based on AMD docs * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42730 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index cf5afcd8dc..4b9c6e96d4 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -387,6 +387,8 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) gConnector[connector]->connector_ddc_info.valid = true; gConnector[connector]->connector_ddc_info.gpio_id = gpio_id; + // GPIO mask (Allows software to control the GPIO pad) + // 0 = chip access; 1 = only software; gConnector[connector]->connector_ddc_info.mask_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) * 4; gConnector[connector]->connector_ddc_info.mask_sda_reg @@ -396,6 +398,8 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) gConnector[connector]->connector_ddc_info.mask_sda_shift = (1 << gpio->ucDataMaskShift); + // GPIO output / write (A) enable + // 0 = GPIO input (Y); 1 = GPIO output (A); gConnector[connector]->connector_ddc_info.gpio_en_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 4; gConnector[connector]->connector_ddc_info.gpio_en_sda_reg @@ -405,6 +409,17 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) gConnector[connector]->connector_ddc_info.gpio_en_sda_shift = (1 << gpio->ucDataEnShift); + // GPIO output / write (A) + gConnector[connector]->connector_ddc_info.gpio_a_scl_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_a_sda_reg + = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; + gConnector[connector]->connector_ddc_info.gpio_a_scl_shift + = (1 << gpio->ucClkA_Shift); + gConnector[connector]->connector_ddc_info.gpio_a_sda_shift + = (1 << gpio->ucDataA_Shift); + + // GPIO input / read (Y) gConnector[connector]->connector_ddc_info.gpio_y_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; gConnector[connector]->connector_ddc_info.gpio_y_sda_reg @@ -414,14 +429,6 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) gConnector[connector]->connector_ddc_info.gpio_y_sda_shift = (1 << gpio->ucDataY_Shift); - gConnector[connector]->connector_ddc_info.gpio_a_scl_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_a_sda_reg - = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_a_scl_shift - = (1 << gpio->ucClkA_Shift); - gConnector[connector]->connector_ddc_info.gpio_a_sda_shift - = (1 << gpio->ucDataA_Shift); } return B_OK; From f6766f291e49e3399b9037b885d0c970c2f2fae9 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 9 Sep 2011 19:43:09 +0000 Subject: [PATCH 273/702] * rework i2c read / write to make sense using values provided git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42731 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 50 +++++++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 4b9c6e96d4..e0f8ca1947 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -282,14 +282,30 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) { ddc_info *info = (ddc_info*)cookie; - uint32 value = Read32(OUT, info->gpio_id); + // software only access + //uint32 scl_maskVal = Read32(OUT, info->mask_scl_reg); + //uint32 sda_maskVal = Read32(OUT, info->mask_sda_reg); + //Write32(OUT, info->mask_scl_reg, 1); + //Write32(OUT, info->mask_sda_reg, 1); - *_clock = (value >> info->gpio_y_scl_shift) & 1; - *_data = (value >> info->gpio_y_sda_shift) & 1; + // set read mode + uint32 scl_enVal = Read32(OUT, info->gpio_en_scl_reg); + uint32 sda_enVal = Read32(OUT, info->gpio_en_sda_reg); + Write32(OUT, info->gpio_en_scl_reg, 0); + Write32(OUT, info->gpio_en_sda_reg, 0); + + *_clock = Read32(OUT, info->gpio_y_scl_reg); + *_data = Read32(OUT, info->gpio_y_sda_reg); TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", __func__, info->gpio_id, *_clock, *_data); + // restore previous settings + //Write32(OUT, info->mask_scl_reg, scl_maskVal); + //Write32(OUT, info->mask_sda_reg, sda_maskVal); + Write32(OUT, info->gpio_en_scl_reg, scl_enVal); + Write32(OUT, info->gpio_en_sda_reg, sda_enVal); + return B_OK; } @@ -299,18 +315,34 @@ set_i2c_signals(void* cookie, int clock, int data) { ddc_info* info = (ddc_info*)cookie; - uint32 value = Read32(OUT, info->gpio_id); + // software only access + uint32 scl_maskVal = Read32(OUT, info->mask_scl_reg); + uint32 sda_maskVal = Read32(OUT, info->mask_sda_reg); + Write32(OUT, info->mask_scl_reg, 1); + Write32(OUT, info->mask_sda_reg, 1); - value &= ~(info->gpio_a_scl_reg | info->gpio_a_sda_reg); - value &= ~(info->gpio_en_sda_reg | info->gpio_en_scl_reg); - value |= ((1 - clock) << info->gpio_en_scl_shift) - | ((1 - data) << info->gpio_en_sda_shift); + // set write mode + uint32 scl_enVal = Read32(OUT, info->gpio_en_scl_reg); + uint32 sda_enVal = Read32(OUT, info->gpio_en_sda_reg); + Write32(OUT, info->gpio_en_scl_reg, 1); + Write32(OUT, info->gpio_en_sda_reg, 1); - Write32(OUT, info->gpio_id, value); + Write32(OUT, info->gpio_a_scl_reg, clock); + Write32(OUT, info->gpio_a_sda_reg, data); + + // read back to improve reliability? + Read32(OUT, info->gpio_a_scl_reg); + Read32(OUT, info->gpio_a_sda_reg); TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", __func__, info->gpio_id, clock, data); + // restore previous settings + Write32(OUT, info->mask_scl_reg, scl_maskVal); + Write32(OUT, info->mask_sda_reg, sda_maskVal); + Write32(OUT, info->gpio_en_scl_reg, scl_enVal); + Write32(OUT, info->gpio_en_sda_reg, sda_enVal); + return B_OK; } From a178983df66aad5957fbc82fb596c74fa4d02e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 9 Sep 2011 21:33:16 +0000 Subject: [PATCH 274/702] Cleanup while I was searching for a bug that ended up being in the app_server; the decorators now return non-sense as their frame, thank you Clemens! * Got rid of Settings::CurrentSettings() - the get/store pair wasn't really thread-safe anyway, as it always updated all fields, so settings could get lost easily. The mechanism is still being used in the settings window, though. * Introduced some getters/setters for the settings that work on the message directly which simplifies some code. * Minor style cleanups. * Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42732 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/Controller.cpp | 4 +- src/apps/mediaplayer/MainApp.cpp | 25 +++---- src/apps/mediaplayer/MainWin.cpp | 7 +- src/apps/mediaplayer/VideoView.cpp | 10 +-- src/apps/mediaplayer/settings/Settings.cpp | 73 +++++++++++-------- src/apps/mediaplayer/settings/Settings.h | 23 ++++-- .../mediaplayer/settings/SettingsWindow.cpp | 32 ++++---- 7 files changed, 93 insertions(+), 81 deletions(-) diff --git a/src/apps/mediaplayer/Controller.cpp b/src/apps/mediaplayer/Controller.cpp index 5deecca6ea..5176a3d97f 100644 --- a/src/apps/mediaplayer/Controller.cpp +++ b/src/apps/mediaplayer/Controller.cpp @@ -966,8 +966,8 @@ Controller::RemoveListener(Listener* listener) void Controller::_AdoptGlobalSettings() { - mpSettings settings = Settings::CurrentSettings(); - // thread safe + mpSettings settings; + Settings::Default()->Get(settings); fAutoplaySetting = settings.autostart; // not yet used: diff --git a/src/apps/mediaplayer/MainApp.cpp b/src/apps/mediaplayer/MainApp.cpp index 6576e0b339..71ccf10127 100644 --- a/src/apps/mediaplayer/MainApp.cpp +++ b/src/apps/mediaplayer/MainApp.cpp @@ -75,8 +75,7 @@ MainApp::MainApp() fAudioWindowFrameSaved(false), fLastSavedAudioWindowCreationTime(0) { - mpSettings settings = Settings::CurrentSettings(); - fLastFilePanelFolder = settings.filePanelFolder; + fLastFilePanelFolder = Settings::Default()->FilePanelFolder(); // Now tell the application roster, that we're interested // in getting notifications of apps being launched or quit. @@ -91,7 +90,7 @@ MainApp::MainApp() if (!fMediaServerRunning || !fMediaAddOnServerRunning) { BAlert* alert = new BAlert("start_media_server", B_TRANSLATE("It appears the media server is not running.\n" - "Would you like to start it ?"), B_TRANSLATE("Quit"), + "Would you like to start it ?"), B_TRANSLATE("Quit"), B_TRANSLATE("Start media server"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); if (alert->Go() == 0) { @@ -145,9 +144,7 @@ MainApp::QuitRequested() fSettingsWindow = NULL; // store the current file panel ref in the global settings - mpSettings settings = Settings::CurrentSettings(); - settings.filePanelFolder = fLastFilePanelFolder; - Settings::Default()->SaveSettings(settings); + Settings::Default()->SetFilePanelFolder(fLastFilePanelFolder); return BApplication::QuitRequested(); } @@ -294,16 +291,12 @@ MainApp::MessageReceived(BMessage* message) && message->FindBool("audio only", &audioOnly) == B_OK && message->FindRect("window frame", &windowFrame) == B_OK && message->FindInt64("creation time", &creationTime) == B_OK) { - if (audioOnly) { - if (!fAudioWindowFrameSaved - || creationTime < fLastSavedAudioWindowCreationTime) { - fAudioWindowFrameSaved = true; - fLastSavedAudioWindowCreationTime = creationTime; - mpSettings settings - = Settings::Default()->CurrentSettings(); - settings.audioPlayerWindowFrame = windowFrame; - Settings::Default()->SaveSettings(settings); - } + if (audioOnly && (!fAudioWindowFrameSaved + || creationTime < fLastSavedAudioWindowCreationTime)) { + fAudioWindowFrameSaved = true; + fLastSavedAudioWindowCreationTime = creationTime; + + Settings::Default()->SetAudioPlayerWindowFrame(windowFrame); } } diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index 2dcb666bad..30c59689b1 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -211,8 +211,7 @@ MainWin::MainWin(bool isFirstWindow, BMessage* message) MoveBy(pos * 25, pos * 25); pos = (pos + 1) % 15; - BRect frame = Settings::Default()->CurrentSettings() - .audioPlayerWindowFrame; + BRect frame = Settings::Default()->AudioPlayerWindowFrame(); if (frame.IsValid()) { if (isFirstWindow) { if (message == NULL) { @@ -2585,8 +2584,8 @@ MainWin::_MarkItem(BMenu* menu, uint32 command, bool mark) void MainWin::_AdoptGlobalSettings() { - mpSettings settings = Settings::CurrentSettings(); - // thread safe + mpSettings settings; + Settings::Default()->Get(settings); fCloseWhenDonePlayingMovie = settings.closeWhenDonePlayingMovie; fCloseWhenDonePlayingSound = settings.closeWhenDonePlayingSound; diff --git a/src/apps/mediaplayer/VideoView.cpp b/src/apps/mediaplayer/VideoView.cpp index d55a14421d..1902df3ced 100644 --- a/src/apps/mediaplayer/VideoView.cpp +++ b/src/apps/mediaplayer/VideoView.cpp @@ -168,8 +168,7 @@ VideoView::SetBitmap(const BBitmap* bitmap) rgb_color key; status_t ret = SetViewOverlay(bitmap, bitmap->Bounds(), fVideoFrame, &key, B_FOLLOW_ALL, - B_OVERLAY_FILTER_HORIZONTAL - | B_OVERLAY_FILTER_VERTICAL); + B_OVERLAY_FILTER_HORIZONTAL | B_OVERLAY_FILTER_VERTICAL); if (ret == B_OK) { fOverlayKeyColor = key; SetLowColor(key); @@ -181,8 +180,7 @@ VideoView::SetBitmap(const BBitmap* bitmap) // update restrictions overlay_restrictions restrictions; - if (bitmap->GetOverlayRestrictions(&restrictions) - == B_OK) + if (bitmap->GetOverlayRestrictions(&restrictions) == B_OK) fOverlayRestrictions = restrictions; } else { // try again next time @@ -391,8 +389,8 @@ VideoView::_DrawSubtitle() void VideoView::_AdoptGlobalSettings() { - mpSettings settings = Settings::CurrentSettings(); - // thread safe + mpSettings settings; + Settings::Default()->Get(settings); fUseOverlays = settings.useOverlays; fUseBilinearScaling = settings.scaleBilinear; diff --git a/src/apps/mediaplayer/settings/Settings.cpp b/src/apps/mediaplayer/settings/Settings.cpp index 043302d1a0..7f1d00d25b 100644 --- a/src/apps/mediaplayer/settings/Settings.cpp +++ b/src/apps/mediaplayer/settings/Settings.cpp @@ -1,16 +1,20 @@ /* - * Copyright 2008, Haiku. All rights reserved. + * Copyright 2008-2011, Haiku. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Fredrik Modéen */ + #include "Settings.h" #include +/*static*/ Settings Settings::sGlobalInstance; + + bool mpSettings::operator!=(const mpSettings& other) const { @@ -40,7 +44,7 @@ Settings::Settings(const char* filename) void -Settings::LoadSettings(mpSettings& settings) const +Settings::Get(mpSettings& settings) const { BAutolock _(const_cast(this)); @@ -68,25 +72,20 @@ Settings::LoadSettings(mpSettings& settings) const = fSettingsMessage.GetValue("bgMovieVolumeMode", (uint32)mpSettings::BG_MOVIES_FULL_VOLUME); - entry_ref defaultFilePanelFolder; - // an "unset" entry_ref - settings.filePanelFolder = fSettingsMessage.GetValue( - "filePanelDirectory", defaultFilePanelFolder); - - settings.audioPlayerWindowFrame = fSettingsMessage.GetValue( - "audioPlayerWindowFrame", BRect()); + settings.filePanelFolder = FilePanelFolder(); + settings.audioPlayerWindowFrame = AudioPlayerWindowFrame(); } void -Settings::SaveSettings(const mpSettings& settings) +Settings::Update(const mpSettings& settings) { BAutolock _(this); fSettingsMessage.SetValue("autostart", settings.autostart); - fSettingsMessage.SetValue("closeWhenDonePlayingMovie", + fSettingsMessage.SetValue("closeWhenDonePlayingMovie", settings.closeWhenDonePlayingMovie); - fSettingsMessage.SetValue("closeWhenDonePlayingSound", + fSettingsMessage.SetValue("closeWhenDonePlayingSound", settings.closeWhenDonePlayingSound); fSettingsMessage.SetValue("loopMovie", settings.loopMovie); fSettingsMessage.SetValue("loopSound", settings.loopSound); @@ -105,33 +104,47 @@ Settings::SaveSettings(const mpSettings& settings) fSettingsMessage.SetValue("filePanelDirectory", settings.filePanelFolder); - fSettingsMessage.SetValue("audioPlayerWindowFrame", - settings.audioPlayerWindowFrame); - - // Save at this point, although saving is also done on destruction, - // this will make sure the settings are saved even when the player - // crashes. - fSettingsMessage.Save(); + SetAudioPlayerWindowFrame(settings.audioPlayerWindowFrame); Notify(); } -// #pragma mark - static - -/*static*/ Settings -Settings::sGlobalInstance; - - -/*static*/ mpSettings -Settings::CurrentSettings() +entry_ref +Settings::FilePanelFolder() const { - mpSettings settings; - sGlobalInstance.LoadSettings(settings); - return settings; + BAutolock locker(const_cast(this)); + return fSettingsMessage.GetValue("filePanelDirectory", entry_ref()); } +void +Settings::SetFilePanelFolder(const entry_ref& ref) +{ + BAutolock locker(this); + fSettingsMessage.SetValue("filePanelDirectory", ref); +} + + +BRect +Settings::AudioPlayerWindowFrame() const +{ + BAutolock locker(const_cast(this)); + return fSettingsMessage.GetValue("audioPlayerWindowFrame", BRect()); +} + + +void +Settings::SetAudioPlayerWindowFrame(BRect frame) +{ + BAutolock locker(this); + fSettingsMessage.SetValue("audioPlayerWindowFrame", frame); +} + + +// #pragma mark - static + + /*static*/ Settings* Settings::Default() { diff --git a/src/apps/mediaplayer/settings/Settings.h b/src/apps/mediaplayer/settings/Settings.h index 3ddf8a161d..f8b3590233 100644 --- a/src/apps/mediaplayer/settings/Settings.h +++ b/src/apps/mediaplayer/settings/Settings.h @@ -1,20 +1,24 @@ /* - * Copyright 2008, Haiku. All rights reserved. + * Copyright 2008-2011, Haiku. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Fredrik Modéen */ - #ifndef SETTINGS_H #define SETTINGS_H + #include #include #include "Notifier.h" #include "SettingsMessage.h" + +#define SETTINGS_FILENAME "MediaPlayer" + + struct mpSettings { enum { SUBTITLE_SIZE_SMALL = 0, @@ -43,23 +47,27 @@ struct mpSettings { uint32 subtitlePlacement; uint32 backgroundMovieVolumeMode; entry_ref filePanelFolder; - + bool operator!=(const mpSettings& other) const; BRect audioPlayerWindowFrame; }; -#define SETTINGS_FILENAME "MediaPlayer" class Settings : public BLocker, public Notifier { public: Settings( const char* filename = SETTINGS_FILENAME); - void LoadSettings(mpSettings& settings) const; - void SaveSettings(const mpSettings& settings); + void Get(mpSettings& settings) const; + void Update(const mpSettings& settings); + + entry_ref FilePanelFolder() const; + void SetFilePanelFolder(const entry_ref& ref); + + BRect AudioPlayerWindowFrame() const; + void SetAudioPlayerWindowFrame(BRect frame); - static mpSettings CurrentSettings(); static Settings* Default(); private: @@ -69,4 +77,5 @@ private: static Settings sGlobalInstance; }; + #endif // SETTINGS_H diff --git a/src/apps/mediaplayer/settings/SettingsWindow.cpp b/src/apps/mediaplayer/settings/SettingsWindow.cpp index 57e6ddee96..760957eddc 100644 --- a/src/apps/mediaplayer/settings/SettingsWindow.cpp +++ b/src/apps/mediaplayer/settings/SettingsWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010, Haiku, Inc. All rights reserved. + * Copyright 2008-2011, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -41,7 +41,7 @@ enum { #define SPACE 10 -#define SPACEING 7 +#define SPACEING 7 #define BUTTONHEIGHT 20 @@ -61,9 +61,9 @@ SettingsWindow::SettingsWindow(BRect frame) BStringView* playModeLabel = new BStringView("stringViewPlayMode", B_TRANSLATE("Play mode")); - BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions", + BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions", B_TRANSLATE("View options")); - BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg", + BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg", B_TRANSLATE("Volume of background clips")); BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER); playModeLabel->SetExplicitAlignment(alignment); @@ -73,14 +73,14 @@ SettingsWindow::SettingsWindow(BRect frame) bgMoviesModeLabel->SetExplicitAlignment(alignment); bgMoviesModeLabel->SetFont(be_bold_font); - fAutostartCB = new BCheckBox("chkboxAutostart", - B_TRANSLATE("Automatically start playing"), + fAutostartCB = new BCheckBox("chkboxAutostart", + B_TRANSLATE("Automatically start playing"), new BMessage(M_SETTINGS_CHANGED)); - fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies", + fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies", B_TRANSLATE("Close window after playing video"), new BMessage(M_SETTINGS_CHANGED)); - fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds", + fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds", B_TRANSLATE("Close window after playing audio"), new BMessage(M_SETTINGS_CHANGED)); @@ -120,17 +120,17 @@ SettingsWindow::SettingsWindow(BRect frame) fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", B_TRANSLATE("Full volume"), new BMessage(M_SETTINGS_CHANGED)); - - fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume", + + fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume", B_TRANSLATE("Low volume"), new BMessage(M_SETTINGS_CHANGED)); - + fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", B_TRANSLATE("Muted"), new BMessage(M_SETTINGS_CHANGED)); - fRevertB = new BButton("revert", B_TRANSLATE("Revert"), + fRevertB = new BButton("revert", B_TRANSLATE("Revert"), new BMessage(M_SETTINGS_REVERT)); - BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"), + BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"), new BMessage(M_SETTINGS_CANCEL)); BButton* okButton = new BButton("ok", B_TRANSLATE("OK"), @@ -208,7 +208,7 @@ SettingsWindow::Show() // The Settings that we want to be able to revert to is the state at which // the SettingsWindow was shown. So the current settings are stored in // fLastSettings. - Settings::Default()->LoadSettings(fLastSettings); + Settings::Default()->Get(fLastSettings); fSettings = fLastSettings; AdoptSettings(); @@ -313,7 +313,7 @@ SettingsWindow::ApplySettings() = mpSettings::BG_MOVIES_MUTED; } - Settings::Default()->SaveSettings(fSettings); + Settings::Default()->Update(fSettings); fRevertB->SetEnabled(IsRevertable()); } @@ -324,7 +324,7 @@ SettingsWindow::Revert() { fSettings = fLastSettings; AdoptSettings(); - Settings::Default()->SaveSettings(fSettings); + Settings::Default()->Update(fSettings); } From f6144bf7196f8f1bd46fdc28bb41035c51487867 Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Fri, 9 Sep 2011 22:27:08 +0000 Subject: [PATCH 275/702] Updated openssl to 1.0.0e and openssh to 5.9p1. Note that this moves the ssl directory to now be in B_COMMON_DATA_DIRECTORY/ssl, and may require rebuilding of other packages as well. See Haikuports changeset1635 and Haiku r41767. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42733 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalBuildFeatures | 4 ++-- build/jam/OptionalPackages | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index b12bbd1999..00d38406ab 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -12,9 +12,9 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSL ] { } if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_OPENSSL_PACKAGE = openssl-1.0.0d-r1a3-x86-gcc4-2011-05-20.zip ; + HAIKU_OPENSSL_PACKAGE = openssl-1.0.0e-x86-gcc4-2011-09-08.zip ; } else { - HAIKU_OPENSSL_PACKAGE = openssl-1.0.0d-r1a3-x86-gcc2-2011-05-17.zip ; + HAIKU_OPENSSL_PACKAGE = openssl-1.0.0e-x86-gcc2-2011-09-09.zip ; } local baseURL = http://haiku-files.org/files/optional-packages ; diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 12c5e08b12..2db287c254 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -1250,12 +1250,12 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSH ] { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - openssh-5.8p2-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/openssh-5.8p2-r1a3-x86-gcc4-2011-05-24.zip ; + openssh-5.9p1-x86-gcc4-2011-09-08.zip + : $(baseURL)/openssh-5.9p1-x86-gcc4-2011-09-08.zip ; } else { InstallOptionalHaikuImagePackage - openssh-5.8p2-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/openssh-5.8p2-r1a3-x86-gcc2-2011-05-18.zip ; + openssh-5.9p1-x86-gcc2-2011-09-09.zip + : $(baseURL)/openssh-5.9p1-x86-gcc2-2011-09-09.zip ; } AddUserToHaikuImage sshd : 1001 : 100 : /var/empty : /bin/true From c9e95a67dcacc792ef2c2ffcc86996016739fe2b Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Sun, 11 Sep 2011 06:12:50 +0000 Subject: [PATCH 276/702] Updated Finnish catkeys. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42734 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/apps/devices/fi.catkeys | 24 ++++++++++++++++++++++- data/catalogs/preferences/time/fi.catkeys | 13 ++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/data/catalogs/apps/devices/fi.catkeys b/data/catalogs/apps/devices/fi.catkeys index 312f453512..51271e606b 100644 --- a/data/catalogs/apps/devices/fi.catkeys +++ b/data/catalogs/apps/devices/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-Devices 1943893993 +1 finnish x-vnd.Haiku-Devices 865240481 ACPI Information DeviceACPI ACPI-tiedot ACPI Processor Namespace '%2' DeviceACPI ACPI-prosessorinimiavaruus ’%2’ ACPI System Bus DeviceACPI ACPI-järjestelmäväylä @@ -8,35 +8,47 @@ ACPI bus Device ACPI-väylä ACPI bus DevicesView ACPI-väylä ACPI controller Device ACPI-ohjain ACPI node '%1' DeviceACPI ACPI-solmu ’%1’ +Array DeviceSCSI Matriisi Basic information DevicesView Perustiedot Bridge Device Silta +Bridge DeviceSCSI Silta Bus DevicesView Väylä Bus Information Device Väylätiedot +CD-ROM DeviceSCSI CD-ROM +Card Reader DeviceSCSI Korttilukija Category DevicesView Luokka +Changer DeviceSCSI Vaihtaja Class Info:\t\t\t\t: %classInfo% DeviceACPI Luokkatiedot:\t\t\t\t: %classInfo% +Class Info:\t\t\t\t: %classInfo% DeviceSCSI Luokkatiedot:\t\t\t\t: %classInfo% Class info DevicePCI Luokkatiedot Communication controller Device Viestintäohjain +Communications DeviceSCSI Viestinnät Computer Device Tietokone Computer DevicesView Tietokone Connection DevicesView Yhteys Detailed DevicesView Yksityiskohdat Device Device Laite Device Name\t\t\t\t: %Name%\nManufacturer\t\t\t: %Manufacturer%\nDriver used\t\t\t\t: %DriverUsed%\nDevice paths\t: %DevicePaths% Device Laitenimi\t\t\t\t: %Name%\nValmistaja\t\t\t: %Manufacturer%\nKäytetty ajuri\t\t\t\t: %DriverUsed%\nLaitepolut\t: %DevicePaths% +Device class DeviceSCSI Laiteluokka Device name Device Laitenimi Device name DeviceACPI Laitenimi Device name DevicePCI Laitenimi +Device name DeviceSCSI Laitenimi Device name: Device Laitenimi: Device paths Device Laitepolut Device paths DevicePCI Laitepolut Devices DevicesView Laitteet Devices System name Laitteet +Disk Drive DeviceSCSI Levyasema Display controller Device Näyttöohjain Docking station Device Telakka-asema Driver used Device Käytetty laite Driver used DevicePCI Käytetty ajuri +Enclosure DeviceSCSI Kotelo Encryption controller Device Salausohjain Generate system information DevicesView Tuota järjestelmätiedot Generic system peripheral Device Yleinen järjestelmän oheislaite +Graphics Peripheral DeviceSCSI Grafiikkaoheislaite ISA bus Device ISA-väylä ISA bus DevicesView ISA-väylä Input device controller Device Syötelaiteohjain @@ -44,6 +56,7 @@ Intelligent controller Device Älyohjain Manufacturer Device Valmistaja Manufacturer DeviceACPI Valmistaja Manufacturer DevicePCI Valmistaja +Manufacturer DeviceSCSI Valmistaja Manufacturer: Device Valmistaja: Mass storage controller Device Massamuistilaiteohjain Memory controller Device Muistiohjain @@ -53,21 +66,30 @@ Network controller Device Verkko-ohjain None Device Ei mitään Not implemented DeviceACPI Ei ole toteutettu Not implemented DevicePCI Ei ole toteutettu +Optical Drive DeviceSCSI Optinen laite Order by: DevicesView Järjestys: +Other DeviceSCSI Muu PCI Information DevicePCI PCI-tiedot PCI bus Device PCI-väylä PCI bus DevicesView PCI-väylä +Printer DeviceSCSI Tulostin Processor Device Suoritin +Processor DeviceSCSI Suoritin Quit DevicesView Poistu +RBC DeviceSCSI RBC Refresh devices DevicesView Virkistä laitteita Report compatibility DevicesView Ilmoita yhteensopivuudesta +SCSI Information DeviceSCSI SCSI-tiedot Satellite communications controller Device Satelliittiviestintäohjain +Scanner DeviceSCSI Skanneri Serial bus controller Device Sarjaväyläohjain Signal processing controller Device Signaalikäsittelyohjain +Tape Drive DeviceSCSI Nauha-asema Unclassified device Device Luokittelematon laite Unknown DevicePCI Tuntematon Unknown device Device Tuntematon laite Unknown device DevicesView Tuntematon laite Value PropertyList Arvo Wireless controller Device Langaton ohjain +Worm DeviceSCSI Kertakirjoitteinen unknown Device tuntematon diff --git a/data/catalogs/preferences/time/fi.catkeys b/data/catalogs/preferences/time/fi.catkeys index 4f5d9c197e..a3a17bbf23 100644 --- a/data/catalogs/preferences/time/fi.catkeys +++ b/data/catalogs/preferences/time/fi.catkeys @@ -1,17 +1,26 @@ -1 finnish x-vnd.Haiku-Time 453699369 +1 finnish x-vnd.Haiku-Time 3739720453 Time Add Time Lisää +Africa Time Afrikka +America Time Amerikka +Antarctica Time Etelänapamanner +Arctic Time Pohjoinen napaseutu +Asia Time Aasia +Atlantic Time Atlantin valtameri +Australia Time Australia Could not contact server Time Ei voitu ottaa yhteyttä palvelimeen Could not create socket Time Ei voitu luoda pistoketta Current time: Time Nykyinen aika: Date and time Time Päivämäärä ja aika -Etc Time Jne +Europe Time Eurooppa GMT Time Greenwichin aika Hardware clock set to: Time Laitteistokellon ajaksi asetettu: +Indian Time Intia Local time Time Paikallinen aika Message receiving failed Time Viestin vastaanotto epäonnistui Network time Time Verkkoaika OK Time Valmis +Pacific Time Tyyni valtameri Preview time: Time Esikatseluaika: Received invalid time Time Vastaanotettiin virheellinen aika Remove Time Poista From df9db7862b4368cf7fed1094836f80013119254d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Sep 2011 11:04:43 +0000 Subject: [PATCH 277/702] * Added methods to work with display_modes directly. * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42735 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/screen/ScreenMode.cpp | 45 +++++++++++++++++++ src/preferences/screen/ScreenMode.h | 62 ++++++++++++++++----------- 2 files changed, 81 insertions(+), 26 deletions(-) diff --git a/src/preferences/screen/ScreenMode.cpp b/src/preferences/screen/ScreenMode.cpp index 748632e269..a4177ecdb0 100644 --- a/src/preferences/screen/ScreenMode.cpp +++ b/src/preferences/screen/ScreenMode.cpp @@ -242,6 +242,36 @@ ScreenMode::GetOriginalMode(screen_mode& mode, int32 workspace) const } +status_t +ScreenMode::Set(const display_mode& mode, int32 workspace) +{ + if (!fUpdatedModes) + UpdateOriginalModes(); + + BScreen screen(fWindow); + + if (workspace == ~0) + workspace = current_workspace(); + + // BScreen::SetMode() needs a non-const display_mode + display_mode nonConstMode; + memcpy(&nonConstMode, &mode, sizeof(display_mode)); + return screen.SetMode(workspace, &nonConstMode, true); +} + + +status_t +ScreenMode::Get(display_mode& mode, int32 workspace) const +{ + BScreen screen(fWindow); + + if (workspace == ~0) + workspace = current_workspace(); + + return screen.GetMode(workspace, &mode); +} + + /*! This method assumes that you already reverted to the correct number of workspaces. */ @@ -558,6 +588,18 @@ ScreenMode::ModeAt(int32 index) } +const display_mode& +ScreenMode::DisplayModeAt(int32 index) +{ + if (index < 0) + index = 0; + else if (index >= (int32)fModeCount) + index = fModeCount - 1; + + return fModeList[index]; +} + + int32 ScreenMode::CountModes() { @@ -565,6 +607,9 @@ ScreenMode::CountModes() } +/*! Searches for a similar mode in the reported mode list, and if that does not + find a matching mode, it will compute the mode manually using the GTF. +*/ bool ScreenMode::_GetDisplayMode(const screen_mode& mode, display_mode& displayMode) { diff --git a/src/preferences/screen/ScreenMode.h b/src/preferences/screen/ScreenMode.h index 0b8621353d..a22981e3f2 100644 --- a/src/preferences/screen/ScreenMode.h +++ b/src/preferences/screen/ScreenMode.h @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku. + * Copyright 2005-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -38,40 +38,50 @@ struct screen_mode { class ScreenMode { public: - ScreenMode(BWindow* window); - ~ScreenMode(); + ScreenMode(BWindow* window); + ~ScreenMode(); - status_t Set(const screen_mode& mode, int32 workspace = ~0); - status_t Get(screen_mode& mode, int32 workspace = ~0) const; - status_t GetOriginalMode(screen_mode &mode, - int32 workspace = ~0) const; + status_t Set(const screen_mode& mode, + int32 workspace = ~0); + status_t Get(screen_mode& mode, + int32 workspace = ~0) const; + status_t GetOriginalMode(screen_mode &mode, + int32 workspace = ~0) const; - status_t Revert(); - void UpdateOriginalModes(); + status_t Set(const display_mode& mode, + int32 workspace = ~0); + status_t Get(display_mode& mode, + int32 workspace = ~0) const; - bool SupportsColorSpace(const screen_mode& mode, - color_space space); - status_t GetRefreshLimits(const screen_mode& mode, - float& min, float& max); - status_t GetMonitorInfo(monitor_info& info, - float* _diagonalInches = NULL); + status_t Revert(); + void UpdateOriginalModes(); - status_t GetDeviceInfo(accelerant_device_info& info); + bool SupportsColorSpace(const screen_mode& mode, + color_space space); + status_t GetRefreshLimits(const screen_mode& mode, + float& min, float& max); + status_t GetMonitorInfo(monitor_info& info, + float* _diagonalInches = NULL); - screen_mode ModeAt(int32 index); - int32 CountModes(); + status_t GetDeviceInfo(accelerant_device_info& info); + + screen_mode ModeAt(int32 index); + const display_mode& DisplayModeAt(int32 index); + int32 CountModes(); private: - bool _GetDisplayMode(const screen_mode& mode, - display_mode& displayMode); + bool _GetDisplayMode(const screen_mode& mode, + display_mode& displayMode); - BWindow* fWindow; - display_mode* fModeList; - uint32 fModeCount; +private: + BWindow* fWindow; + display_mode* fModeList; + uint32 fModeCount; - bool fUpdatedModes; - display_mode fOriginalDisplayMode[32]; - screen_mode fOriginal[32]; + bool fUpdatedModes; + display_mode fOriginalDisplayMode[32]; + screen_mode fOriginal[32]; }; + #endif /* SCREEN_MODE_H */ From 02f248105ad82679b68f60338acef84ecbe4529d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Sep 2011 11:07:19 +0000 Subject: [PATCH 278/702] * Now asks for confirmation before exiting after a mode set. This will time out after ten seconds, and revert to the original mode. * Added option -q resp. --dont-confirm which turns off that confirmation. * Added option -m resp. --modeline that allows you to specify and dump X-style modelines. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42736 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/screenmode/screenmode.cpp | 217 ++++++++++++++++++++++++------ 1 file changed, 176 insertions(+), 41 deletions(-) diff --git a/src/bin/screenmode/screenmode.cpp b/src/bin/screenmode/screenmode.cpp index 2967780e8b..0891dcfe49 100644 --- a/src/bin/screenmode/screenmode.cpp +++ b/src/bin/screenmode/screenmode.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2008, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2008-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ +#include #include #include #include @@ -18,6 +19,8 @@ static struct option const kLongOptions[] = { {"fall-back", no_argument, 0, 'f'}, + {"dont-confirm", no_argument, 0, 'q'}, + {"modeline", no_argument, 0, 'm'}, {"short", no_argument, 0, 's'}, {"list", no_argument, 0, 'l'}, {"help", no_argument, 0, 'h'}, @@ -47,6 +50,36 @@ color_space_for_depth(int32 depth) } +static void +print_mode(const screen_mode& mode, bool shortOutput) +{ + const char* format + = shortOutput ? "%ld %ld %ld %g\n" : "%ld %ld, %ld bits, %g Hz\n"; + printf(format, mode.width, mode.height, mode.BitsPerPixel(), mode.refresh); +} + + +static void +print_mode(const display_mode& displayMode, const screen_mode& mode) +{ + const display_timing& timing = displayMode.timing; + + printf("%lu %u %u %u %u %u %u %u %u ", timing.pixel_clock / 1000, + timing.h_display, timing.h_sync_start, timing.h_sync_end, + timing.h_total, timing.v_display, timing.v_sync_start, + timing.v_sync_end, timing.v_total); + + // TODO: more flags? + if ((timing.flags & B_POSITIVE_HSYNC) != 0) + printf(" +HSync"); + if ((timing.flags & B_POSITIVE_VSYNC) != 0) + printf(" +VSync"); + if ((timing.flags & B_TIMING_INTERLACED) != 0) + printf(" Interlace"); + printf(" %lu\n", mode.BitsPerPixel()); +} + + static void usage(int status) { @@ -55,11 +88,18 @@ usage(int status) "Sets the specified screen mode. When no screen mode has been chosen,\n" "the current one is printed. takes the form: \n" " , or x, etc.\n" - " --fall-back\tchanges to the standard fallback mode, and displays a\n" + " --fall-back\tchanges to the standard fallback mode, and " + "displays a\n" "\t\t\tnotification requester.\n" " -s --short\t\twhen no mode is given the current screen mode is\n" - "\t\t\tprinted in short form.\n" - " -l --list\t\tdisplay a list of the available modes\n", + "\t\t\tprinted in short form.\n" + " -l --list\t\tdisplay a list of the available modes.\n" + " -q --dont-confirm\tdo not confirm the mode after setting it.\n" + " -m --modeline\taccept and print X-style modeline modes:\n" + "\t\t\t \n" + "\t\t\t [flags] " + "[depth]\n" + "\t\t\t(supported flags are: +/-HSync, +/-VSync, Interlace)\n", kProgramName); exit(status); @@ -73,16 +113,19 @@ main(int argc, char** argv) bool setMode = false; bool shortOutput = false; bool listModes = false; + bool modeLine = false; + bool confirm = true; int width = -1; int height = -1; int depth = -1; float refresh = -1; + display_mode mode; // TODO: add a possibility to set a virtual screen size in addition to // the display resolution! int c; - while ((c = getopt_long(argc, argv, "shlf", kLongOptions, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "shlfqm", kLongOptions, NULL)) != -1) { switch (c) { case 0: break; @@ -96,6 +139,12 @@ main(int argc, char** argv) case 'l': listModes = true; break; + case 'm': + modeLine = true; + break; + case 'q': + confirm = false; + break; case 'h': usage(0); break; @@ -109,22 +158,70 @@ main(int argc, char** argv) int depthIndex = -1; // arguments to specify the mode are following - int parsed = sscanf(argv[optind], "%dx%dx%d", &width, &height, &depth); - if (parsed == 2) - depthIndex = optind + 1; - else if (parsed == 1) { - if (argc - optind > 1) { - height = strtol(argv[optind + 1], NULL, 0); - depthIndex = optind + 2; - } else - usage(1); - } else if (parsed != 3) - usage(1); - if (depthIndex > 0 && depthIndex < argc) - depth = strtol(argv[depthIndex], NULL, 0); - if (depthIndex + 1 < argc) - refresh = strtod(argv[depthIndex + 1], NULL); + if (!modeLine) { + int parsed = sscanf(argv[optind], "%dx%dx%d", &width, &height, + &depth); + if (parsed == 2) + depthIndex = optind + 1; + else if (parsed == 1) { + if (argc - optind > 1) { + height = strtol(argv[optind + 1], NULL, 0); + depthIndex = optind + 2; + } else + usage(1); + } else if (parsed != 3) + usage(1); + + if (depthIndex > 0 && depthIndex < argc) + depth = strtol(argv[depthIndex], NULL, 0); + if (depthIndex + 1 < argc) + refresh = strtod(argv[depthIndex + 1], NULL); + } else { + // parse mode line + if (argc - optind < 9) + usage(1); + + mode.timing.pixel_clock = strtol(argv[optind], NULL, 0) * 1000; + mode.timing.h_display = strtol(argv[optind + 1], NULL, 0); + mode.timing.h_sync_start = strtol(argv[optind + 2], NULL, 0); + mode.timing.h_sync_end = strtol(argv[optind + 3], NULL, 0); + mode.timing.h_total = strtol(argv[optind + 4], NULL, 0); + mode.timing.h_display = strtol(argv[optind + 5], NULL, 0); + mode.timing.h_sync_start = strtol(argv[optind + 6], NULL, 0); + mode.timing.h_sync_end = strtol(argv[optind + 7], NULL, 0); + mode.timing.h_total = strtol(argv[optind + 8], NULL, 0); + mode.timing.flags = 0; + mode.space = B_RGB32; + + int i = optind + 9; + while (i < argc) { + if (!strcasecmp(argv[i], "+HSync")) + mode.timing.flags |= B_POSITIVE_HSYNC; + else if (!strcasecmp(argv[i], "+VSync")) + mode.timing.flags |= B_POSITIVE_VSYNC; + else if (!strcasecmp(argv[i], "Interlace")) + mode.timing.flags |= B_TIMING_INTERLACED; + else if (!strcasecmp(argv[i], "-VSync") + || !strcasecmp(argv[i], "-HSync")) { + // okay, but nothing to do + } else if (isdigit(argv[i][0]) && i + 1 == argc) { + // bits per pixel + mode.space + = color_space_for_depth(strtoul(argv[i], NULL, 0)); + } else { + fprintf(stderr, "Unknown flag: %s\n", argv[i]); + exit(1); + } + + i++; + } + + mode.virtual_width = mode.timing.h_display; + mode.virtual_height = mode.timing.v_display; + mode.h_display_start = 0; + mode.v_display_start = 0; + } setMode = true; } @@ -135,29 +232,39 @@ main(int argc, char** argv) screen_mode currentMode; screenMode.Get(currentMode); - if ((!setMode) && (!listModes)) { - const char* format = shortOutput - ? "%ld %ld %ld %g\n" : "Resolution: %ld %ld, %ld bits, %g Hz\n"; - printf(format, currentMode.width, currentMode.height, - currentMode.BitsPerPixel(), currentMode.refresh); + if (listModes) { + // List all reported modes + if (!shortOutput) + printf("Available screen modes:\n"); + + for (int index = 0; index < screenMode.CountModes(); index++) { + if (modeLine) { + print_mode(screenMode.DisplayModeAt(index), + screenMode.ModeAt(index)); + } else + print_mode(screenMode.ModeAt(index), shortOutput); + } + + return 0; + } + + if (!setMode) { + // Just print the current mode + if (modeLine) { + display_mode mode; + screenMode.Get(mode); + print_mode(mode, currentMode); + } else { + if (!shortOutput) + printf("Resolution: "); + print_mode(currentMode, shortOutput); + } return 0; } screen_mode newMode = currentMode; - if (listModes) { - const int modeCount = screenMode.CountModes(); - printf("Available screen modes :\n"); - - for (int modeNumber = 0; modeNumber < modeCount; modeNumber++) { - currentMode = screenMode.ModeAt(modeNumber); - const char* format = shortOutput - ? "%ld %ld %ld %g\n" : "%ld %ld, %ld bits, %g Hz\n"; - printf(format, currentMode.width, currentMode.height, - currentMode.BitsPerPixel(), currentMode.refresh); - } - return 0; - } else if (fallbackMode) { + if (fallbackMode) { if (currentMode.width == 800 && currentMode.height == 600) { newMode.width = 640; newMode.height = 480; @@ -169,6 +276,10 @@ main(int argc, char** argv) newMode.space = B_RGB16; newMode.refresh = 60; } + } else if (modeLine) { + display_mode currentDisplayMode; + if (screenMode.Get(currentDisplayMode) == B_OK) + mode.flags = currentDisplayMode.flags; } else { newMode.width = width; newMode.height = height; @@ -184,9 +295,33 @@ main(int argc, char** argv) newMode.refresh = 60; } - status_t status = screenMode.Set(newMode); - if (status != B_OK) { - fprintf(stderr, "%s: Could not set screen mode %ldx%ldx%ldx: %s\n", + status_t status; + if (modeLine) + status = screenMode.Set(mode); + else + status = screenMode.Set(newMode); + + if (status == B_OK) { + if (confirm) { + printf("Is this mode okay (Y/n - will revert after 10 seconds)? "); + fflush(stdout); + + int flags = fcntl(STDIN_FILENO, F_GETFL, 0); + fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK); + + bigtime_t end = system_time() + 10000000LL; + int c = 'n'; + while (system_time() < end) { + c = getchar(); + if (c != -1) + break; + } + + if (c != '\n' && c != 'y') + screenMode.Revert(); + } + } else { + fprintf(stderr, "%s: Could not set screen mode %ldx%ldx%ld: %s\n", kProgramName, newMode.width, newMode.height, newMode.BitsPerPixel(), strerror(status)); return 1; From 8a0a741db6ecbe56b09ee5142c3628f8f05ed58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Sep 2011 12:21:33 +0000 Subject: [PATCH 279/702] * Added missing but very common 1920x1080 resolution at 60Hz refresh. This should help with #7419. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42737 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/create_display_modes.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/add-ons/accelerants/common/create_display_modes.cpp b/src/add-ons/accelerants/common/create_display_modes.cpp index 778de4e4dd..a2916b37d9 100644 --- a/src/add-ons/accelerants/common/create_display_modes.cpp +++ b/src/add-ons/accelerants/common/create_display_modes.cpp @@ -71,6 +71,7 @@ static const display_mode kBaseModeList[] = { {{147100, 1680, 1784, 1968, 2256, 1050, 1051, 1054, 1087, POSITIVE_SYNC}, B_CMAP8, 1680, 1050, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1680X1050) */ + {{172000, 1920, 2040, 2248, 2576, 1080, 1081, 1084, 1118, POSITIVE_SYNC}, B_CMAP8, 1920, 1080, 0, 0, MODE_FLAGS}, /* 1920x1080 60Hz */ //{{160000, 1920, 2010, 2060, 2110, 1200, 1202, 1208, 1235, POSITIVE_SYNC}, B_CMAP8, 1920, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1920X1200) */ {{193160, 1920, 2048, 2256, 2592, 1200, 1201, 1204, 1242, POSITIVE_SYNC}, B_CMAP8, 1920, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1920X1200) */ }; From 1be3653a7b5a07191caf1bc0729c31afb02633ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Sep 2011 13:45:01 +0000 Subject: [PATCH 280/702] * Made DeskCalc "not anchored on activate" meaning that instead of changing the workspace to an already open DeskCalc, it moves to the current workspace instead. That's because you usually use DeskCalc in the context of another application (or just for a single use), so it makes little sense to have sort of a fixed workspace for it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42738 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskcalc/CalcWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/deskcalc/CalcWindow.cpp b/src/apps/deskcalc/CalcWindow.cpp index 30ccfd1afa..51204b0dfe 100644 --- a/src/apps/deskcalc/CalcWindow.cpp +++ b/src/apps/deskcalc/CalcWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006 Haiku, Inc. All Rights Reserved. + * Copyright 2006-2011 Haiku, Inc. All Rights Reserved. * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved. * Distributed under the terms of the MIT License. * @@ -29,7 +29,7 @@ CalcWindow::CalcWindow(BRect frame, BMessage* settings) : BWindow(frame, B_TRANSLATE_SYSTEM_NAME("DeskCalc"), B_TITLED_WINDOW, - B_ASYNCHRONOUS_CONTROLS) + B_ASYNCHRONOUS_CONTROLS | B_NOT_ANCHORED_ON_ACTIVATE) { // create calculator view with calculator description and // desktop background color From d06251a95a7c8448eb2807ef96a3791d4a414249 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 11 Sep 2011 17:15:14 +0000 Subject: [PATCH 281/702] * make ERROR define to always show AtomBIOS parsing errors git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42739 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index f037fb4137..69501d946d 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -44,6 +44,7 @@ # define TRACE(x...) ; #endif +#define ERROR(x...) _sPrintf("radeon_hd: " x) #define ATOM_COND_ABOVE 0 #define ATOM_COND_ABOVEOREQUAL 1 @@ -641,7 +642,7 @@ atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) if (execute) { if (ctx->last_jump == (ctx->start + target)) { if (ctx->last_jump_count > 128) { - TRACE("%s: DANGER! AtomBIOS stuck in infinite loop" + ERROR("%s: DANGER! AtomBIOS stuck in infinite loop" " for more then 128 jumps... abort!\n", __func__); ctx->abort = true; } else { @@ -1146,7 +1147,7 @@ atom_execute_table_locked(atom_context *ctx, int index, uint32 * params) TRACE("%s: unknown (0x%" B_PRIX16 ")\n", __func__, ptr - 1); if (ectx.abort == true) { - TRACE("AtomBios parser was aborted executing (0x%" B_PRIX16 ")\n", + ERROR("AtomBios parser was aborted executing (0x%" B_PRIX16 ")\n", ptr - 1); free(ectx.ws); return B_ERROR; @@ -1172,7 +1173,7 @@ atom_execute_table(atom_context *ctx, int index, uint32 *params) { if (acquire_sem_etc(ctx->exec_sem, 1, B_RELATIVE_TIMEOUT, 5000000) != B_NO_ERROR) { - TRACE("%s: Timeout to obtain semaphore!\n", __func__); + ERROR("%s: Timeout to obtain semaphore!\n", __func__); return B_ERROR; } /* reset reg block */ @@ -1211,7 +1212,7 @@ atom_parse(card_info *card, uint8 *bios) atom_context *ctx = (atom_context*)malloc(sizeof(atom_context)); if (ctx == NULL) { - TRACE("%s: Error: No memory for atom_context mapping\n", __func__); + ERROR("%s: Error: No memory for atom_context mapping\n", __func__); return NULL; } @@ -1219,13 +1220,13 @@ atom_parse(card_info *card, uint8 *bios) ctx->bios = bios; if (CU16(0) != ATOM_BIOS_MAGIC) { - TRACE("Invalid BIOS magic.\n"); + ERROR("Invalid BIOS magic.\n"); free(ctx); return NULL; } if (strncmp(CSTR(ATOM_ATI_MAGIC_PTR), ATOM_ATI_MAGIC, strlen(ATOM_ATI_MAGIC))) { - TRACE("Invalid ATI magic.\n"); + ERROR("Invalid ATI magic.\n"); free(ctx); return NULL; } @@ -1233,7 +1234,7 @@ atom_parse(card_info *card, uint8 *bios) int base = CU16(ATOM_ROM_TABLE_PTR); if (strncmp(CSTR(base + ATOM_ROM_MAGIC_PTR), ATOM_ROM_MAGIC, strlen(ATOM_ROM_MAGIC))) { - TRACE("Invalid ATOM magic.\n"); + ERROR("Invalid ATOM magic.\n"); free(ctx); return NULL; } From b053beab99d4f9dbf7f84b0f9867c2cfbcb55fd4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 11 Sep 2011 18:20:41 +0000 Subject: [PATCH 282/702] * refactor GPU i2c bit-banging code to be correct using drm as reference * add i2c locking code that represents common things we need to do before and after access git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42740 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 2 + src/add-ons/accelerants/radeon_hd/gpu.cpp | 105 +++++++++++------- 2 files changed, 68 insertions(+), 39 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index ff4908744d..8807bcfb94 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -140,6 +140,8 @@ struct pll_info { struct ddc_info { bool valid; + bool hw_capable; + uint8 gpio_id; uint16 mask_scl_reg; diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index e0f8ca1947..ead97ec426 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -277,35 +277,67 @@ radeon_gpu_irq_setup() } +static void +lock_i2c(void* cookie, bool lock) +{ + ddc_info *info = (ddc_info*)cookie; + + uint32 buffer = 0; + + if (info->hw_capable == true) { + // Switch GPIO pads to ddc mode + buffer = Read32(OUT, info->mask_scl_reg); + buffer &= ~(1 << 16); + Write32(OUT, info->mask_scl_reg, buffer); + } + + // Clear pins + buffer = Read32(OUT, info->gpio_a_scl_reg) & ~info->gpio_a_scl_shift; + Write32(OUT, info->gpio_a_scl_reg, buffer); + buffer = Read32(OUT, info->gpio_a_sda_reg) & ~info->gpio_a_sda_shift; + Write32(OUT, info->gpio_a_sda_reg, buffer); + + // Set pins to input + buffer = Read32(OUT, info->gpio_en_scl_reg) & ~info->gpio_en_scl_shift; + Write32(OUT, info->gpio_en_scl_reg, buffer); + buffer = Read32(OUT, info->gpio_en_sda_reg) & ~info->gpio_en_sda_shift; + Write32(OUT, info->gpio_en_sda_reg, buffer); + + // mask GPIO pins for software use + buffer = Read32(OUT, info->mask_scl_reg); + if (lock == true) + buffer |= info->mask_scl_shift; + else + buffer &= ~info->mask_scl_shift; + Write32(OUT, info->mask_scl_reg, buffer); + Read32(OUT, info->mask_scl_reg); + + buffer = Read32(OUT, info->mask_sda_reg); + if (lock == true) + buffer |= info->mask_sda_shift; + else + buffer &= ~info->mask_sda_shift; + Write32(OUT, info->mask_sda_reg, buffer); + Read32(OUT, info->mask_sda_reg); +} + + static status_t get_i2c_signals(void* cookie, int* _clock, int* _data) { ddc_info *info = (ddc_info*)cookie; - // software only access - //uint32 scl_maskVal = Read32(OUT, info->mask_scl_reg); - //uint32 sda_maskVal = Read32(OUT, info->mask_sda_reg); - //Write32(OUT, info->mask_scl_reg, 1); - //Write32(OUT, info->mask_sda_reg, 1); + lock_i2c(cookie, true); + uint32 scl = Read32(OUT, info->gpio_y_scl_reg) & info->gpio_y_scl_shift; + uint32 sda = Read32(OUT, info->gpio_y_sda_reg) & info->gpio_y_sda_shift; + lock_i2c(cookie, false); - // set read mode - uint32 scl_enVal = Read32(OUT, info->gpio_en_scl_reg); - uint32 sda_enVal = Read32(OUT, info->gpio_en_sda_reg); - Write32(OUT, info->gpio_en_scl_reg, 0); - Write32(OUT, info->gpio_en_sda_reg, 0); - - *_clock = Read32(OUT, info->gpio_y_scl_reg); - *_data = Read32(OUT, info->gpio_y_sda_reg); + *_clock = (scl != 0); + *_data = (sda != 0); TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", __func__, info->gpio_id, *_clock, *_data); - // restore previous settings - //Write32(OUT, info->mask_scl_reg, scl_maskVal); - //Write32(OUT, info->mask_sda_reg, sda_maskVal); - Write32(OUT, info->gpio_en_scl_reg, scl_enVal); - Write32(OUT, info->gpio_en_sda_reg, sda_enVal); - return B_OK; } @@ -315,34 +347,22 @@ set_i2c_signals(void* cookie, int clock, int data) { ddc_info* info = (ddc_info*)cookie; - // software only access - uint32 scl_maskVal = Read32(OUT, info->mask_scl_reg); - uint32 sda_maskVal = Read32(OUT, info->mask_sda_reg); - Write32(OUT, info->mask_scl_reg, 1); - Write32(OUT, info->mask_sda_reg, 1); + lock_i2c(cookie, true); + uint32 scl = Read32(OUT, info->gpio_en_scl_reg) + & ~info->gpio_en_scl_shift; + uint32 sda = Read32(OUT, info->gpio_en_sda_reg) + & ~info->gpio_en_sda_shift; - // set write mode - uint32 scl_enVal = Read32(OUT, info->gpio_en_scl_reg); - uint32 sda_enVal = Read32(OUT, info->gpio_en_sda_reg); - Write32(OUT, info->gpio_en_scl_reg, 1); - Write32(OUT, info->gpio_en_sda_reg, 1); + scl |= clock ? 0 : info->gpio_en_scl_shift; + sda |= data ? 0 : info->gpio_en_sda_shift; Write32(OUT, info->gpio_a_scl_reg, clock); Write32(OUT, info->gpio_a_sda_reg, data); - - // read back to improve reliability? - Read32(OUT, info->gpio_a_scl_reg); - Read32(OUT, info->gpio_a_sda_reg); + lock_i2c(cookie, false); TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", __func__, info->gpio_id, clock, data); - // restore previous settings - Write32(OUT, info->mask_scl_reg, scl_maskVal); - Write32(OUT, info->mask_sda_reg, sda_maskVal); - Write32(OUT, info->gpio_en_scl_reg, scl_enVal); - Write32(OUT, info->gpio_en_sda_reg, sda_enVal); - return B_OK; } @@ -417,6 +437,13 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) // populate gpio information gConnector[connector]->connector_ddc_info.valid = true; + + // TODO : what is hw_capable? + if (gpio->sucI2cId.sbfAccess.bfHW_Capable) + gConnector[connector]->connector_ddc_info.hw_capable = true; + else + gConnector[connector]->connector_ddc_info.hw_capable = true; + gConnector[connector]->connector_ddc_info.gpio_id = gpio_id; // GPIO mask (Allows software to control the GPIO pad) From 83187b29d3e8b7a8c49594bd87e8a3c8b3b2fa5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Sep 2011 18:29:50 +0000 Subject: [PATCH 283/702] * Added helper functions for the "propose mode" accelerant hook. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42741 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/common/validate_display_mode.h | 54 ++++++++ src/add-ons/accelerants/common/Jamfile | 3 +- .../common/validate_display_mode.cpp | 128 ++++++++++++++++++ 3 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 headers/private/graphics/common/validate_display_mode.h create mode 100644 src/add-ons/accelerants/common/validate_display_mode.cpp diff --git a/headers/private/graphics/common/validate_display_mode.h b/headers/private/graphics/common/validate_display_mode.h new file mode 100644 index 0000000000..e0fa3d8e1a --- /dev/null +++ b/headers/private/graphics/common/validate_display_mode.h @@ -0,0 +1,54 @@ +/* + * Copyright 2011, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _VALIDATE_DISPLAY_MODE_H +#define _VALIDATE_DISPLAY_MODE_H + + +#include + +#include "edid.h" + +struct timing_constraints { + uint16 resolution; + + uint16 min_before_sync; + uint16 max_sync_start; + uint16 min_sync_length; + uint16 max_sync_length; + uint16 min_after_sync; + uint16 max_total; +}; + +struct display_constraints { + uint16 min_h_display; + uint16 max_h_display; + uint16 min_v_display; + uint16 max_v_display; + + uint32 min_pixel_clock; + uint32 max_pixel_clock; + + timing_constraints horizontal_timing; + timing_constraints vertical_timing; +}; + + +#ifdef __cplusplus +extern "C" { +#endif + + +bool sanitize_display_mode(display_mode& mode, + const display_constraints& constraints, const edid1_info* edidInfo); +bool is_display_mode_within_bounds(display_mode& mode, const display_mode& low, + const display_mode& high); + + +#ifdef __cplusplus +} +#endif + + +#endif /* _VALIDATE_DISPLAY_MODE_H */ diff --git a/src/add-ons/accelerants/common/Jamfile b/src/add-ons/accelerants/common/Jamfile index a1ab758013..fe844b2342 100644 --- a/src/add-ons/accelerants/common/Jamfile +++ b/src/add-ons/accelerants/common/Jamfile @@ -9,9 +9,10 @@ UsePrivateHeaders [ FDirName graphics common ] ; StaticLibrary libaccelerantscommon.a : compute_display_timing.cpp create_display_modes.cpp - video_configuration.cpp ddc.c decode_edid.c dump_edid.c i2c.c + validate_display_mode.cpp + video_configuration.cpp ; diff --git a/src/add-ons/accelerants/common/validate_display_mode.cpp b/src/add-ons/accelerants/common/validate_display_mode.cpp new file mode 100644 index 0000000000..11863ffa34 --- /dev/null +++ b/src/add-ons/accelerants/common/validate_display_mode.cpp @@ -0,0 +1,128 @@ +/* + * Copyright 2011, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include + + +static uint16 +round(uint16 value, uint16 resolution) +{ + return value / resolution * resolution; +} + + +static void +sanitize_timing(uint16& display, uint16& syncStart, uint16& syncEnd, + uint16& total, const timing_constraints& constraints) +{ + if (syncStart < display + constraints.min_before_sync) + syncStart = display + constraints.min_before_sync; + else if (syncStart > constraints.max_sync_start) + syncStart = constraints.max_sync_start; + + uint32 syncLength = syncEnd - syncStart; + if (syncLength < constraints.min_sync_length) + syncLength = constraints.min_sync_length; + else if (syncLength > constraints.max_sync_length) + syncLength = constraints.max_sync_length; + + if (total < syncStart + syncLength + constraints.min_after_sync) + total = syncStart + syncLength + constraints.min_after_sync; + + if (total > constraints.max_total) { + total = constraints.max_total; + syncLength = min_c(syncLength, uint16(total - syncStart)); + } + + syncEnd = round(syncStart + syncLength, constraints.resolution); + syncStart = round(syncStart, constraints.resolution); + display = round(display, constraints.resolution); + total = round(total, constraints.resolution); +} + + +/*! Makes sure the passed in \a mode fulfills the specified \a constraints. + Returns whether or not the mode had to be changed. +*/ +bool +sanitize_display_mode(display_mode& mode, + const display_constraints& constraints, const edid1_info* edid) +{ + display_mode originalMode = mode; + + // size + + if (mode.timing.h_display < constraints.min_h_display) + mode.timing.h_display = constraints.min_h_display; + else if (mode.timing.h_display > constraints.max_h_display) + mode.timing.h_display = constraints.max_h_display; + + if (mode.timing.v_display < constraints.min_v_display) + mode.timing.v_display = constraints.min_v_display; + else if (mode.timing.v_display > constraints.max_v_display) + mode.timing.v_display = constraints.max_v_display; + + // horizontal timing + + sanitize_timing(mode.timing.h_display, mode.timing.h_sync_start, + mode.timing.h_sync_end, mode.timing.h_total, + constraints.horizontal_timing); + + // vertical timing + + sanitize_timing(mode.timing.v_display, mode.timing.v_sync_start, + mode.timing.v_sync_end, mode.timing.v_total, + constraints.vertical_timing); + + // TODO: take EDID and pixel clock into account! + + return memcmp(&mode, &originalMode, sizeof(display_mode)) != 0; +} + + +bool +is_display_mode_within_bounds(display_mode& mode, const display_mode& low, + const display_mode& high) +{ + // Check horizontal timing + if (mode.timing.h_display < low.timing.h_display + || mode.timing.h_display > high.timing.h_display + || mode.timing.h_sync_start < low.timing.h_sync_start + || mode.timing.h_sync_start > high.timing.h_sync_start + || mode.timing.h_sync_end < low.timing.h_sync_end + || mode.timing.h_sync_end > high.timing.h_sync_end + || mode.timing.h_total < low.timing.h_total + || mode.timing.h_total > high.timing.h_total) + return false; + + // Check vertical timing + if (mode.timing.h_display < low.timing.h_display + || mode.timing.h_display > high.timing.h_display + || mode.timing.h_sync_start < low.timing.h_sync_start + || mode.timing.h_sync_start > high.timing.h_sync_start + || mode.timing.h_sync_end < low.timing.h_sync_end + || mode.timing.h_sync_end > high.timing.h_sync_end + || mode.timing.h_total < low.timing.h_total + || mode.timing.h_total > high.timing.h_total) + return false; + + // Check pixel clock + if (mode.timing.pixel_clock > high.timing.pixel_clock + || mode.timing.pixel_clock < low.timing.pixel_clock) + return false; + + // Check horizontal size + if (mode.virtual_width > high.virtual_width + || mode.virtual_width < low.virtual_width) + return false; + + // Check vertical size + if (mode.virtual_height > high.virtual_height + || mode.virtual_height < low.virtual_height) + return false; + + return true; +} From 654613b66163404d50df58dfa7a1de19b1d6c22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Sep 2011 18:32:56 +0000 Subject: [PATCH 284/702] * Implemented intel_propose_display_mode() using the new helper functions. * In intel_set_display_mode(), we now use the sanitize_display_mode() method directly in order to see if the mode is valid (it's valid when it doesn't need to be altered anymore). * This should be the final nail on ticket #7419. * Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42742 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/intel_extreme/mode.cpp | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index e12ee0ff56..b3e3cb1c51 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #define TRACE_MODE @@ -419,7 +420,7 @@ retrieve_current_mode(display_mode& mode, uint32 pllRegister) divisors.m2 = (pllDivisor & DISPLAY_PLL_M2_DIVISOR_MASK) >> DISPLAY_PLL_M2_DIVISOR_SHIFT; divisors.n = (pllDivisor & DISPLAY_PLL_N_DIVISOR_MASK) - >> DISPLAY_PLL_N_DIVISOR_SHIFT; + >> DISPLAY_PLL_N_DIVISOR_SHIFT; } pll_limits limits; @@ -428,7 +429,7 @@ retrieve_current_mode(display_mode& mode, uint32 pllRegister) if (gInfo->shared_info->device_type.InFamily(INTEL_TYPE_9xx)) { if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_IGD)) { divisors.post1 = (pll & DISPLAY_PLL_IGD_POST1_DIVISOR_MASK) - >> DISPLAY_PLL_IGD_POST1_DIVISOR_SHIFT; + >> DISPLAY_PLL_IGD_POST1_DIVISOR_SHIFT; } else { divisors.post1 = (pll & DISPLAY_PLL_9xx_POST1_DIVISOR_MASK) >> DISPLAY_PLL_POST1_DIVISOR_SHIFT; @@ -574,6 +575,27 @@ get_color_space_format(const display_mode &mode, uint32 &colorMode, } +static bool +sanitize_display_mode(display_mode& mode) +{ + // TODO: verify constraints - these are more or less taken from the + // radeon driver! + const display_constraints constraints = { + // resolution + 320, 8192, 200, 4096, + // pixel clock + gInfo->shared_info->pll_info.min_frequency, + gInfo->shared_info->pll_info.max_frequency, + // horizontal + {8, 16, 8160, 24, 504, 15, 8192}, + {1, 1, 4092, 2, 63, 1, 4096} + }; + + return sanitize_display_mode(mode, constraints, + gInfo->has_edid ? &gInfo->edid_info : NULL); +} + + // #pragma mark - @@ -601,22 +623,10 @@ intel_propose_display_mode(display_mode *target, const display_mode *low, { TRACE(("intel_propose_display_mode()\n")); - // just search for the specified mode in the list + sanitize_display_mode(*target); - for (uint32 i = 0; i < gInfo->shared_info->mode_count; i++) { - display_mode *mode = &gInfo->mode_list[i]; - - // TODO: improve this, ie. adapt pixel clock to allowed values!!! - - if (target->virtual_width != mode->virtual_width - || target->virtual_height != mode->virtual_height - || target->space != mode->space) - continue; - - *target = *mode; - return B_OK; - } - return B_BAD_VALUE; + return is_display_mode_within_bounds(*target, *low, *high) + ? B_OK : B_BAD_VALUE; } @@ -634,8 +644,10 @@ intel_set_display_mode(display_mode *mode) // TODO: it may be acceptable to continue when using panel fitting or // centering, since the data from propose_display_mode will not actually be // used as is in this case. - if (intel_propose_display_mode(&target, mode, mode)) + if (sanitize_display_mode(target)) { + TRACE(("intel_extreme: invalid mode set!")); return B_BAD_VALUE; + } uint32 colorMode, bytesPerRow, bitsPerPixel; get_color_space_format(target, colorMode, bytesPerRow, bitsPerPixel); @@ -779,7 +791,7 @@ if (first) { | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) & DISPLAY_PLL_M1_DIVISOR_MASK) | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) - & DISPLAY_PLL_M2_DIVISOR_MASK)); + & DISPLAY_PLL_M2_DIVISOR_MASK)); } write32(INTEL_DISPLAY_B_PLL, dpll & ~DISPLAY_PLL_ENABLED); read32(INTEL_DISPLAY_B_PLL); @@ -819,7 +831,7 @@ if (first) { | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) & DISPLAY_PLL_M1_DIVISOR_MASK) | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) - & DISPLAY_PLL_M2_DIVISOR_MASK)); + & DISPLAY_PLL_M2_DIVISOR_MASK)); } write32(INTEL_DISPLAY_B_PLL, dpll); From 54401270ec0c143d133cd2bde4a3b133a1e06d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Sep 2011 18:41:42 +0000 Subject: [PATCH 285/702] * Turn off confirmation when using the fallback mode - this will already pop up a BAlert. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42743 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/screenmode/screenmode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/screenmode/screenmode.cpp b/src/bin/screenmode/screenmode.cpp index 0891dcfe49..a846141e71 100644 --- a/src/bin/screenmode/screenmode.cpp +++ b/src/bin/screenmode/screenmode.cpp @@ -132,6 +132,7 @@ main(int argc, char** argv) case 'f': fallbackMode = true; setMode = true; + confirm = false; break; case 's': shortOutput = true; From 57f2ed7eb3e3098750048f3043bd1a2469a8390e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Sep 2011 20:16:09 +0000 Subject: [PATCH 286/702] * This should fix the GCC4 build (we should really try to eliminate those tiny include differences between our compiler setups). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42744 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/validate_display_mode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/add-ons/accelerants/common/validate_display_mode.cpp b/src/add-ons/accelerants/common/validate_display_mode.cpp index 11863ffa34..645660dade 100644 --- a/src/add-ons/accelerants/common/validate_display_mode.cpp +++ b/src/add-ons/accelerants/common/validate_display_mode.cpp @@ -6,6 +6,8 @@ #include +#include + static uint16 round(uint16 value, uint16 resolution) From f6be39e0aed303ffafb9dd30665f5d9f7ebd2913 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 11 Sep 2011 21:34:06 +0000 Subject: [PATCH 287/702] * correct naming error. (a shift is a shift until you use it.. then its a mask) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42745 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 16 +++---- src/add-ons/accelerants/radeon_hd/gpu.cpp | 44 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 8807bcfb94..201a399154 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -146,23 +146,23 @@ struct ddc_info { uint16 mask_scl_reg; uint16 mask_sda_reg; - uint16 mask_scl_shift; - uint16 mask_sda_shift; + uint16 mask_scl_mask; + uint16 mask_sda_mask; uint16 gpio_en_scl_reg; uint16 gpio_en_sda_reg; - uint16 gpio_en_scl_shift; - uint16 gpio_en_sda_shift; + uint16 gpio_en_scl_mask; + uint16 gpio_en_sda_mask; uint16 gpio_y_scl_reg; uint16 gpio_y_sda_reg; - uint16 gpio_y_scl_shift; - uint16 gpio_y_sda_shift; + uint16 gpio_y_scl_mask; + uint16 gpio_y_sda_mask; uint16 gpio_a_scl_reg; uint16 gpio_a_sda_reg; - uint16 gpio_a_scl_shift; - uint16 gpio_a_sda_shift; + uint16 gpio_a_scl_mask; + uint16 gpio_a_sda_mask; }; diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index ead97ec426..d651da00f3 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -292,31 +292,31 @@ lock_i2c(void* cookie, bool lock) } // Clear pins - buffer = Read32(OUT, info->gpio_a_scl_reg) & ~info->gpio_a_scl_shift; + buffer = Read32(OUT, info->gpio_a_scl_reg) & ~info->gpio_a_scl_mask; Write32(OUT, info->gpio_a_scl_reg, buffer); - buffer = Read32(OUT, info->gpio_a_sda_reg) & ~info->gpio_a_sda_shift; + buffer = Read32(OUT, info->gpio_a_sda_reg) & ~info->gpio_a_sda_mask; Write32(OUT, info->gpio_a_sda_reg, buffer); // Set pins to input - buffer = Read32(OUT, info->gpio_en_scl_reg) & ~info->gpio_en_scl_shift; + buffer = Read32(OUT, info->gpio_en_scl_reg) & ~info->gpio_en_scl_mask; Write32(OUT, info->gpio_en_scl_reg, buffer); - buffer = Read32(OUT, info->gpio_en_sda_reg) & ~info->gpio_en_sda_shift; + buffer = Read32(OUT, info->gpio_en_sda_reg) & ~info->gpio_en_sda_mask; Write32(OUT, info->gpio_en_sda_reg, buffer); // mask GPIO pins for software use buffer = Read32(OUT, info->mask_scl_reg); if (lock == true) - buffer |= info->mask_scl_shift; + buffer |= info->mask_scl_mask; else - buffer &= ~info->mask_scl_shift; + buffer &= ~info->mask_scl_mask; Write32(OUT, info->mask_scl_reg, buffer); Read32(OUT, info->mask_scl_reg); buffer = Read32(OUT, info->mask_sda_reg); if (lock == true) - buffer |= info->mask_sda_shift; + buffer |= info->mask_sda_mask; else - buffer &= ~info->mask_sda_shift; + buffer &= ~info->mask_sda_mask; Write32(OUT, info->mask_sda_reg, buffer); Read32(OUT, info->mask_sda_reg); } @@ -328,8 +328,8 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) ddc_info *info = (ddc_info*)cookie; lock_i2c(cookie, true); - uint32 scl = Read32(OUT, info->gpio_y_scl_reg) & info->gpio_y_scl_shift; - uint32 sda = Read32(OUT, info->gpio_y_sda_reg) & info->gpio_y_sda_shift; + uint32 scl = Read32(OUT, info->gpio_y_scl_reg) & info->gpio_y_scl_mask; + uint32 sda = Read32(OUT, info->gpio_y_sda_reg) & info->gpio_y_sda_mask; lock_i2c(cookie, false); *_clock = (scl != 0); @@ -349,12 +349,12 @@ set_i2c_signals(void* cookie, int clock, int data) lock_i2c(cookie, true); uint32 scl = Read32(OUT, info->gpio_en_scl_reg) - & ~info->gpio_en_scl_shift; + & ~info->gpio_en_scl_mask; uint32 sda = Read32(OUT, info->gpio_en_sda_reg) - & ~info->gpio_en_sda_shift; + & ~info->gpio_en_sda_mask; - scl |= clock ? 0 : info->gpio_en_scl_shift; - sda |= data ? 0 : info->gpio_en_sda_shift; + scl |= clock ? 0 : info->gpio_en_scl_mask; + sda |= data ? 0 : info->gpio_en_sda_mask; Write32(OUT, info->gpio_a_scl_reg, clock); Write32(OUT, info->gpio_a_sda_reg, data); @@ -452,9 +452,9 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) * 4; gConnector[connector]->connector_ddc_info.mask_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataMaskRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.mask_scl_shift + gConnector[connector]->connector_ddc_info.mask_scl_mask = (1 << gpio->ucClkMaskShift); - gConnector[connector]->connector_ddc_info.mask_sda_shift + gConnector[connector]->connector_ddc_info.mask_sda_mask = (1 << gpio->ucDataMaskShift); // GPIO output / write (A) enable @@ -463,9 +463,9 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 4; gConnector[connector]->connector_ddc_info.gpio_en_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataEnRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_en_scl_shift + gConnector[connector]->connector_ddc_info.gpio_en_scl_mask = (1 << gpio->ucClkEnShift); - gConnector[connector]->connector_ddc_info.gpio_en_sda_shift + gConnector[connector]->connector_ddc_info.gpio_en_sda_mask = (1 << gpio->ucDataEnShift); // GPIO output / write (A) @@ -473,9 +473,9 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; gConnector[connector]->connector_ddc_info.gpio_a_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_a_scl_shift + gConnector[connector]->connector_ddc_info.gpio_a_scl_mask = (1 << gpio->ucClkA_Shift); - gConnector[connector]->connector_ddc_info.gpio_a_sda_shift + gConnector[connector]->connector_ddc_info.gpio_a_sda_mask = (1 << gpio->ucDataA_Shift); // GPIO input / read (Y) @@ -483,9 +483,9 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; gConnector[connector]->connector_ddc_info.gpio_y_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_y_scl_shift + gConnector[connector]->connector_ddc_info.gpio_y_scl_mask = (1 << gpio->ucClkY_Shift); - gConnector[connector]->connector_ddc_info.gpio_y_sda_shift + gConnector[connector]->connector_ddc_info.gpio_y_sda_mask = (1 << gpio->ucDataY_Shift); } From 3cd033a15c8a2f95c6144ea6bac91f1c2c318383 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 11 Sep 2011 23:26:12 +0000 Subject: [PATCH 288/702] * i2c locking should happen just before reading the edid locking and unlocked on every bit read sounds excessive * set vdif and vdif size to NULL... they really aren't needed git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42746 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index d651da00f3..aec0830548 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -327,10 +327,8 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) { ddc_info *info = (ddc_info*)cookie; - lock_i2c(cookie, true); uint32 scl = Read32(OUT, info->gpio_y_scl_reg) & info->gpio_y_scl_mask; uint32 sda = Read32(OUT, info->gpio_y_sda_reg) & info->gpio_y_sda_mask; - lock_i2c(cookie, false); *_clock = (scl != 0); *_data = (sda != 0); @@ -347,7 +345,6 @@ set_i2c_signals(void* cookie, int clock, int data) { ddc_info* info = (ddc_info*)cookie; - lock_i2c(cookie, true); uint32 scl = Read32(OUT, info->gpio_en_scl_reg) & ~info->gpio_en_scl_mask; uint32 sda = Read32(OUT, info->gpio_en_sda_reg) @@ -358,7 +355,6 @@ set_i2c_signals(void* cookie, int clock, int data) Write32(OUT, info->gpio_a_scl_reg, clock); Write32(OUT, info->gpio_a_sda_reg, data); - lock_i2c(cookie, false); TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", __func__, info->gpio_id, clock, data); @@ -382,16 +378,16 @@ radeon_gpu_read_edid(uint32 connector, edid1_info *edid) bus.set_signals = &set_i2c_signals; bus.get_signals = &get_i2c_signals; - void *vdif; - size_t vdifLength; + lock_i2c(bus.cookie, true); + status_t edid_result = ddc2_read_edid1(&bus, edid, NULL, NULL); + lock_i2c(bus.cookie, false); - if (ddc2_read_edid1(&bus, edid, &vdif, &vdifLength) != B_OK) + if (edid_result != B_OK) return false; TRACE("%s: found edid monitor on connector #%" B_PRId32 "\n", __func__, connector); - free(vdif); return true; } From ed2e27f066c8bed584d1060fcb9b621e2d5af4d6 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Mon, 12 Sep 2011 19:19:11 +0000 Subject: [PATCH 289/702] Bringing usb_davicom to life: part 1 of 3: * Unfortunately I have to rollback r42712 completely because it was "the attempt in the wrong direction" and the working version was already implemented on top of previous revision. Just fixed version and code style refactored one are coming soon. Please be patient. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42747 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/usb_davicom/DavicomDevice.cpp | 125 +++++++----------- .../network/usb_davicom/DavicomDevice.h | 9 +- .../drivers/network/usb_davicom/Driver.cpp | 28 ++-- 3 files changed, 59 insertions(+), 103 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp index 9cfe2c2f03..e5a3823a93 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp @@ -33,11 +33,8 @@ #define NSR 0x01 // Network status #define RCR 0x05 // RX Control #define PAR 0x10 // 6 bits - Physical address (MAC) -#define GPCR 0x1E // GPIO pins direction -#define GPR 0x1F // GPIO pins data -#define VID 0x28 // Vendor ID (16bit) -#define PID 0x2A // Product ID (16bit) -#define CHIPR 0x2C // Chip revision +#define GPCR 0x1E // General purpose control +#define GPR 0x1F // General purpose #define NCR_EXT_PHY 0x80 // External PHY #define NCR_FDX 0x08 // Full duplex @@ -63,7 +60,7 @@ status_t -DavicomDevice::_ReadRegister(uint8 reg, size_t size, void* buffer) +DavicomDevice::_ReadRegister(uint8 reg, size_t size, uint8* buffer) { if (size > 255) return B_BAD_VALUE; size_t actualLength; @@ -187,6 +184,14 @@ DavicomDevice::Open(uint32 flags) return result; } + // setup state notifications + result = gUSBModule->queue_interrupt(fNotifyEndpoint, fNotifyBuffer, + kNotifyBufferSize, _NotifyCallback, this); + if(result != B_OK) { + TRACE_ALWAYS("Error of requesting notify interrupt:%#010x\n", result); + return result; + } + fNonBlocking = (flags & O_NONBLOCK) == O_NONBLOCK; fOpen = true; return result; @@ -357,11 +362,9 @@ DavicomDevice::Control(uint32 op, void *buffer, size_t length) { switch (op) { case ETHER_INIT: - TRACE_ALWAYS("ETHER_INIT\n"); return B_OK; case ETHER_GETADDR: - TRACE_ALWAYS("ETHER_GETADDR\n"); memcpy(buffer, &fMACAddress, sizeof(fMACAddress)); return B_OK; @@ -392,7 +395,6 @@ DavicomDevice::Control(uint32 op, void *buffer, size_t length) return B_OK; case ETHER_GET_LINK_STATE: - TRACE_ALWAYS("ETHER_GET_LINK_STATE\n"); return GetLinkState((ether_link_state *)buffer); #endif @@ -431,10 +433,10 @@ DavicomDevice::Removed() status_t DavicomDevice::SetupDevice(bool deviceReplugged) { - /* First of all, we need to know the MAC address */ ether_address address; status_t result = ReadMACAddress(&address); if(result != B_OK) { + TRACE_ALWAYS("Error reading MAC address:%#010x\n", result); return result; } @@ -443,45 +445,18 @@ DavicomDevice::SetupDevice(bool deviceReplugged) address.ebyte[3], address.ebyte[4], address.ebyte[5]); if(deviceReplugged) { - // this might be the same device that was replugged - read the MAC - // address (which should be at the same index) to make sure + // this might be the same device that was replugged - read the MAC address + // (which should be at the same index) to make sure if(memcmp(&address, &fMACAddress, sizeof(address)) != 0) { TRACE_ALWAYS("Cannot replace device with MAC address:" - "%02x:%02x:%02x:%02x:%02x:%02x\n", - fMACAddress.ebyte[0], fMACAddress.ebyte[1], - fMACAddress.ebyte[2], fMACAddress.ebyte[3], - fMACAddress.ebyte[4], fMACAddress.ebyte[5]); + "%02x:%02x:%02x:%02x:%02x:%02x\n", + fMACAddress.ebyte[0], fMACAddress.ebyte[1], fMACAddress.ebyte[2], + fMACAddress.ebyte[3], fMACAddress.ebyte[4], fMACAddress.ebyte[5]); return B_BAD_VALUE; // is not the same } } else fMACAddress = address; - - /* Read the product ID, vendor ID, and chip revision (not used so far, but - I feel the quirks coming in sooner or later !) */ - - uint16 vidpid[3]; - vidpid[2] = 0; // We overwrite only the fist byte of this one. - - result = _ReadRegister(VID, 5, vidpid); - if (result != B_OK) - TRACE_ALWAYS("Error reading CHIPR: %#010x.\n", result); - else - TRACE_ALWAYS("Chip %#04x:%#04x revision %d\n", vidpid[0], vidpid[1], - vidpid[2]); - - // setup state notifications (we need this to get linkup/linkdown events) - result = gUSBModule->queue_interrupt(fNotifyEndpoint, fNotifyBuffer, - kNotifyBufferSize, _NotifyCallback, this); - if(result != B_OK) { - TRACE_ALWAYS("Error of requesting notify interrupt:%#010x\n", result); - return result; - } - - // TODO enable "wakeup" at the device level or we'll never get anything ! - // TODO check if link was already up before enabling interrupts. If so, we - // need to notify the network stack right now. - return B_OK; } @@ -557,41 +532,34 @@ DavicomDevice::_SetupEndpoints() int writeEndpoint = -1; for(size_t ep = 0; ep < interface->endpoint_count; ep++) { - usb_endpoint_descriptor *epd = interface->endpoint[ep].descr; - - // Is it an interrupt enpoint ? - if((epd->attributes & USB_ENDPOINT_ATTR_MASK) - == USB_ENDPOINT_ATTR_INTERRUPT) { - notifyEndpoint = ep; - continue; - } - - // Is it a bulk one ? - if((epd->attributes & USB_ENDPOINT_ATTR_MASK) != USB_ENDPOINT_ATTR_BULK) { - TRACE_ALWAYS("Error: USB endpoint type %#04x is unknown.\n", - epd->attributes); - continue; - } + usb_endpoint_descriptor *epd = interface->endpoint[ep].descr; + if((epd->attributes & USB_ENDPOINT_ATTR_MASK) == USB_ENDPOINT_ATTR_INTERRUPT) { + notifyEndpoint = ep; + continue; + } - // If so, which direction ? - if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) - == USB_ENDPOINT_ADDR_DIR_IN) { - readEndpoint = ep; - continue; - } + if((epd->attributes & USB_ENDPOINT_ATTR_MASK) != USB_ENDPOINT_ATTR_BULK) { + TRACE_ALWAYS("Error: USB endpoint type %#04x is unknown.\n", epd->attributes); + continue; + } - if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_OUT) - == USB_ENDPOINT_ADDR_DIR_OUT) { - writeEndpoint = ep; - continue; - } + if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) + == USB_ENDPOINT_ADDR_DIR_IN) { + readEndpoint = ep; + continue; + } + + if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_OUT) + == USB_ENDPOINT_ADDR_DIR_OUT) { + writeEndpoint = ep; + continue; + } } - // Did we find all the needed endpoints ? if (notifyEndpoint == -1 || readEndpoint == -1 || writeEndpoint == -1) { TRACE_ALWAYS("Error: not all USB endpoints were found: " - "notify:%d; read:%d; write:%d\n", notifyEndpoint, readEndpoint, - writeEndpoint); + "notify:%d; read:%d; write:%d\n", + notifyEndpoint, readEndpoint, writeEndpoint); return B_ERROR; } @@ -608,8 +576,7 @@ DavicomDevice::_SetupEndpoints() status_t DavicomDevice::ReadMACAddress(ether_address_t *address) { - status_t result = _ReadRegister(PAR, sizeof(ether_address), - (uint8*)address); + status_t result = _ReadRegister(PAR, sizeof(ether_address), (uint8*)address); if(result != B_OK) { TRACE_ALWAYS("Error of reading MAC address:%#010x\n", result); return result; @@ -720,6 +687,7 @@ DavicomDevice::_NotifyCallback(void *cookie, int32 status, void *data, */ } + // parse data in overriden class device->OnNotify(actualLength); // schedule next notification buffer @@ -733,10 +701,9 @@ status_t DavicomDevice::StartDevice() { uint8 registerValue = 0; - status_t result; - + /* disable loopback */ - result = _ReadRegister(NCR, 1, ®isterValue); + status_t result = _ReadRegister(NCR, 1, ®isterValue); if (result != B_OK) { TRACE_ALWAYS("Error reading NCR: %#010x.\n", result); return result; @@ -769,7 +736,7 @@ DavicomDevice::StartDevice() TRACE_ALWAYS("Error reading GPCR: %#010x.\n", result); return result; } - registerValue |= GPCR_GEP_CNTL0; + registerValue &= GPCR_GEP_CNTL0; result = _Write1Register(GPCR, registerValue); if (result != B_OK) { TRACE_ALWAYS("Error writing %#02X to GPCR: %#010x.\n", registerValue, result); @@ -820,7 +787,7 @@ DavicomDevice::OnNotify(uint32 actualLength) TRACE("Link is now up at %s Mb/s\n", (fNotifyBuffer[0] & NSR_SPEED) ? "10" : "100"); } else - TRACE("Link is now down.\n"); + TRACE("Link is now down"); } if (rxOverflow) @@ -859,7 +826,7 @@ DavicomDevice::GetLinkState(ether_link_state *linkState) linkState->media |= IFM_ACTIVE; result = _ReadRegister(NCR, 1, ®isterValue); if (result != B_OK) { - TRACE_ALWAYS("Error reading NCR register: %s\n",strerror(result)); + TRACE_ALWAYS("Error reading NCR register! %x\n",result); return result; } diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h index 13028d3f24..f0631925bf 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h @@ -23,8 +23,7 @@ class DavicomDevice { public: - DavicomDevice(usb_device device, - const char *description); + DavicomDevice(usb_device device, const char *description); virtual ~DavicomDevice(); status_t InitCheck() { return fStatus; }; @@ -55,10 +54,8 @@ static void _NotifyCallback(void *cookie, int32 status, status_t _SetupEndpoints(); - status_t _ReadRegister(uint8 reg, size_t size, - void* buffer); - status_t _WriteRegister(uint8 reg, size_t size, - uint8* buffer); + status_t _ReadRegister(uint8 reg, size_t size, uint8* buffer); + status_t _WriteRegister(uint8 reg, size_t size, uint8* buffer); status_t _Write1Register(uint8 reg, uint8 buffer); static const int kFrameSize = 1518; diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp index 169f6c4129..06a0ca299a 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp @@ -35,9 +35,9 @@ char *gDeviceNames[MAX_DEVICES + 1]; usb_module_info *gUSBModule = NULL; usb_support_descriptor gSupportedDevices[] = { - { 0, 0, 0, 0x0fe6, 0x8101}, // "Supereal SR9600" + { 0, 0, 0, 0x0fe6, 0x8101}, // "Sunrising JP108" { 0, 0, 0, 0x07aa, 0x9601}, // "Corega FEther USB-TXC" - { 0, 0, 0, 0x0a46, 0x9601}, // "Davicom DM9601" + { 0, 0, 0, 0x0a46, 0x9601}, // "Davicom USB-100" { 0, 0, 0, 0x0a46, 0x6688}, // "ZT6688 USB NIC" { 0, 0, 0, 0x0a46, 0x0268}, // "ShanTou ST268 USB NIC" { 0, 0, 0, 0x0a46, 0x8515}, // "ADMtek ADM8515 USB NIC" @@ -67,22 +67,14 @@ create_davicom_device(usb_device device) #define IDS(__vendor, __product) (((__vendor) << 16) | (__product)) switch(IDS(deviceDescriptor->vendor_id, deviceDescriptor->product_id)) { - case IDS(0x0fe6, 0x8101): - return new DavicomDevice(device, "Sunrising JP108"); - case IDS(0x07aa, 0x9601): - return new DavicomDevice(device, "Corega FEther USB-TXC"); - case IDS(0x0a46, 0x9601): - return new DavicomDevice(device, "Davicom USB-100"); - case IDS(0x0a46, 0x6688): - return new DavicomDevice(device, "ZT6688 USB NIC"); - case IDS(0x0a46, 0x0268): - return new DavicomDevice(device, "ShanTou ST268 USB NIC"); - case IDS(0x0a46, 0x8515): - return new DavicomDevice(device, "ADMtek ADM8515 USB NIC"); - case IDS(0x0a47, 0x9601): - return new DavicomDevice(device, "Hirose USB-100"); - case IDS(0x0a46, 0x9000): - return new DavicomDevice(device, "DM9000E"); + case IDS(0x0fe6, 0x8101): return new DavicomDevice(device, "Sunrising JP108"); + case IDS(0x07aa, 0x9601): return new DavicomDevice(device, "Corega FEther USB-TXC"); + case IDS(0x0a46, 0x9601): return new DavicomDevice(device, "Davicom USB-100"); + case IDS(0x0a46, 0x6688): return new DavicomDevice(device, "ZT6688 USB NIC"); + case IDS(0x0a46, 0x0268): return new DavicomDevice(device, "ShanTou ST268 USB NIC"); + case IDS(0x0a46, 0x8515): return new DavicomDevice(device, "ADMtek ADM8515 USB NIC"); + case IDS(0x0a47, 0x9601): return new DavicomDevice(device, "Hirose USB-100"); + case IDS(0x0a46, 0x9000): return new DavicomDevice(device, "DM9000E"); } return NULL; } From b337f35c4582d93d7560ef105bba95b1e092807e Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Mon, 12 Sep 2011 19:35:28 +0000 Subject: [PATCH 290/702] Bringing usb_davicom to life: part 2 of 3: * This part is just fixes to let the driver work. I have decided to separate this changes just for Adrien's information because final version will be refactored significantly. * The fixes: - Endpoint 3 acknowledgements must be enabled in USB Control Register to let async notifications work; - Functions to handle MII registers and MII initialization routines are implemented and used; - Sending WRITE1_REGISTER request typo was fixed; - Small typo in queueing RX iovec fixed: we are receiving 2 blocks not 1; - one byte size padding is required in case TX packet length is multiple of pipe max packet size; - StopDevice procedure implemented; - StartDevice procedure fixed; * Code style fixes are coming soon. Please be patient. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42748 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/usb_davicom/DavicomDevice.cpp | 302 ++++++++++++++---- .../network/usb_davicom/DavicomDevice.h | 19 +- .../drivers/network/usb_davicom/Settings.cpp | 8 +- .../drivers/network/usb_davicom/Settings.h | 10 +- .../network/usb_davicom/usb_davicom.settings | 18 +- 5 files changed, 288 insertions(+), 69 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp index e5a3823a93..dcb2ed13a9 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp @@ -1,22 +1,21 @@ /* * Davicom DM9601 USB 1.1 Ethernet Driver. * Copyright (c) 2009 Adrien Destugues + * Copyright (c) 2008, 2011 Siarzhuk Zharski * Distributed under the terms of the MIT license. * - * Heavily based on code of - * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski - * Distributed under the terms of the MIT license. - * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ + +#include "DavicomDevice.h" + #include "Driver.h" #include "Settings.h" -#include "DavicomDevice.h" // Vendor commands @@ -55,6 +54,21 @@ #define GPR_GEP_GEPIO0 0x01 // Power down +#define EPCR 0x0b // EEPROM/PHY Control Register +#define EPCR_EPOS 0x08 // EEPROM/PHY Operation Select +#define EPCR_ERPRR 0x04 // EEPROM/PHY Register Read Command +#define EPCR_ERPRW 0x02 // EEPROM/PHY Register Write Command + +#define EPAR 0x0c // EEPROM/PHY Control Register +#define EPAR_ADDR0 0x40 // EEPROM/PHY Address +#define EPAR_MASK 0x1f // mask [0:5] + +#define EPDRL 0x0d // EEPROM/PHY Data Register + +#define USBCR 0xf4 // USB Control Register +#define EP3ACK 0x20 // ACK with 8-byte data on interrupt EP +#define EP3NACK 0x10 // Supress ACK on interrupt EP + //TODO: multicast support //TODO: set media state support @@ -93,7 +107,163 @@ DavicomDevice::_Write1Register(uint8 reg, uint8 value) size_t actualLength; status_t result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - WRITE1_REGISTER, 0, reg, 1, &value, &actualLength); + WRITE1_REGISTER, value, reg, 0, NULL, &actualLength); + return result; +} + + +status_t +DavicomDevice::_ReadMII(uint8 reg, uint16* data) +{ + // select PHY and set PHY register address + status_t result = _Write1Register(EPAR, EPAR_ADDR0 | (reg & EPAR_MASK)); + if (result != B_OK) { + TRACE_ALWAYS("Failed to set MII address %#x. Error:%#x\n", reg, result); + return result; + } + + // select PHY operation and initiate reading + result = _Write1Register(EPCR, EPCR_EPOS | EPCR_ERPRR); + if (result != B_OK) { + TRACE_ALWAYS("Failed to starting MII reading. Error:%#x\n", result); + return result; + } + + // finalize writing + uint8 control = 0; + result = _ReadRegister(EPCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Failed to read EPCR register. Error:%#x\n", result); + return result; + } + + result = _Write1Register(EPCR, control & ~EPCR_ERPRR); + if (result != B_OK) { + TRACE_ALWAYS("Failed to write EPCR register. Error:%#x\n", result); + return result; + } + + // retrieve the result from data registers + uint8 values[2] = { 0 }; + result = _ReadRegister(EPDRL, 2, values); + if (result != B_OK) { + TRACE_ALWAYS("Failed to retrieve data %#x. Error:%#x\n", data, result); + return result; + } + + *data = values[0] | values[1] << 8; + return result; +} + + +status_t +DavicomDevice::_WriteMII(uint8 reg, uint16 data) +{ + // select PHY and set PHY register address + status_t result = _Write1Register(EPAR, EPAR_ADDR0 | (reg & EPAR_MASK)); + if (result != B_OK) { + TRACE_ALWAYS("Failed to set MII address %#x. Error:%#x\n", reg, result); + return result; + } + + // put the value to data register + uint8 values[] = { data & 0xff, ( data >> 8 ) & 0xff }; + result = _WriteRegister(EPDRL, sizeof(uint16), values); + if (result != B_OK) { + TRACE_ALWAYS("Failed to put data %#x. Error:%#x\n", data, result); + return result; + } + + // select PHY operation and initiate writing + result = _Write1Register(EPCR, EPCR_EPOS | EPCR_ERPRW); + if (result != B_OK) { + TRACE_ALWAYS("Failed to starting MII wrintig. Error:%#x\n", result); + return result; + } + + // finalize writing + uint8 control = 0; + result = _ReadRegister(EPCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Failed to read EPCR register. Error:%#x\n", result); + return result; + } + + result = _Write1Register(EPCR, control & ~EPCR_ERPRW); + if (result != B_OK) + TRACE_ALWAYS("Failed to write EPCR register. Error:%#x\n", result); + + return result; +} + + +status_t +DavicomDevice::_InitMII() +{ + uint16 control = 0; + status_t result = _ReadMII(0, &control); // read BMCR + if (result != B_OK) { + TRACE_ALWAYS("Failed to read BMCR register. Error:%#x\n", result); + return result; + } + + result = _WriteMII(0, control & ~0x0400); // clear Isolate flag + if (result != B_OK) { + TRACE_ALWAYS("Failed to write BMCR register. Error:%#x\n", result); + return result; + } + + result = _WriteMII(0, 0x8000); // write reset to BMCR + if (result != B_OK) { + TRACE_ALWAYS("Failed to reset BMCR register. Error:%#x\n", result); + return result; + } + + uint16 id01 = 0, id02 = 0; + result = _ReadMII(0x02, &id01); // read PHY_ID 0 + if (result != B_OK) { + TRACE_ALWAYS("Failed to read PHY ID 0. Error:%#x\n", result); + return result; + } + + result = _ReadMII(0x03, &id02); // read PHY_ID 1 + if (result != B_OK) { + TRACE_ALWAYS("Failed to read PHY ID 1. Error:%#x\n", result); + return result; + } + +#define MII_OUI(id1, id2) (((id1) << 6) | ((id2) >> 10)) +#define MII_MODEL(id2) (((id2) & 0x03f0) >> 4) +#define MII_REV(id2) ((id2) & 0x000f) + + TRACE_ALWAYS("MII Info: OUI:%04x; Model:%04x; rev:%02x.\n", + MII_OUI(id01, id02), MII_MODEL(id02), MII_REV(id02)); + + return result; +} + + +status_t +DavicomDevice::_EnableInterrupts(bool enable) +{ + uint8 control = 0; + status_t result = _ReadRegister(USBCR, 1, &control); + if(result != B_OK) { + TRACE_ALWAYS("Error of reading USB control register:%#010x\n", result); + return result; + } + + if (enable) { + control |= EP3ACK; + control &= ~EP3NACK; + } else { + control &= ~EP3ACK; + } + + result = _Write1Register(USBCR, control); + if(result != B_OK) + TRACE_ALWAYS("Error of setting USB control register:%#010x\n", result); + return result; } @@ -109,6 +279,7 @@ DavicomDevice::DavicomDevice(usb_device device, const char *description) fNotifyEndpoint(0), fReadEndpoint(0), fWriteEndpoint(0), + fMaxTXPacketSize(0), fNotifyReadSem(-1), fNotifyWriteSem(-1), fNotifyBuffer(NULL), @@ -150,7 +321,7 @@ DavicomDevice::DavicomDevice(usb_device device, const char *description) return; } - // TODO : others inits here ? + _InitMII(); fStatus = B_OK; } @@ -192,6 +363,8 @@ DavicomDevice::Open(uint32 flags) return result; } + result = _EnableInterrupts(true); + fNonBlocking = (flags & O_NONBLOCK) == O_NONBLOCK; fOpen = true; return result; @@ -205,6 +378,8 @@ DavicomDevice::Close() fOpen = false; return B_OK; } + + _EnableInterrupts(false); // wait until possible notification handling finished... while (atomic_add(&fInsideNotify, 0) != 0) @@ -238,16 +413,16 @@ DavicomDevice::Read(uint8 *buffer, size_t *numBytes) return B_DEVICE_NOT_FOUND; } - TRACE_FLOW("Request %d bytes.\n", numBytesToRead); +// TRACE_RX("Request %d bytes.\n", numBytesToRead); uint8 header[kRXHeaderSize]; iovec rxData[] = { - { &header, kRXHeaderSize }, + { header, kRXHeaderSize }, { buffer, numBytesToRead } }; status_t result = gUSBModule->queue_bulk_v(fReadEndpoint, - rxData, 1, _ReadCallback, this); + rxData, 2, _ReadCallback, this); if (result != B_OK) { TRACE_ALWAYS("Error of queue_bulk_v request:%#010x\n", result); return result; @@ -291,7 +466,7 @@ DavicomDevice::Read(uint8 *buffer, size_t *numBytes) *numBytes, fActualLengthRead - kRXHeaderSize); } - TRACE_FLOW("Read %d bytes.\n", *numBytes); +// TRACE_RX("Read %d bytes.\n", *numBytes); return B_OK; } @@ -320,19 +495,26 @@ DavicomDevice::Write(const uint8 *buffer, size_t *numBytes) return B_ERROR; } - TRACE_FLOW("Write %d bytes.\n", numBytesToWrite); + TRACE_TX("Write %d bytes.\n", numBytesToWrite); - uint8 header[kTXHeaderSize]; - header[0] = *numBytes & 0xFF; - header[1] = *numBytes >> 8; + uint16 length = numBytesToWrite; + size_t count = 2; + if (((numBytesToWrite + 2) % fMaxTXPacketSize) == 0) { + length++; + count++; + } + + uint8 header[kTXHeaderSize] = { length & 0xFF, length >> 8 }; + uint8 padding = 0; iovec txData[] = { - { &header, kTXHeaderSize }, - { (uint8*)buffer, numBytesToWrite } + { header, kTXHeaderSize }, + { (uint8*)buffer, numBytesToWrite }, + { &padding, 1 } }; status_t result = gUSBModule->queue_bulk_v(fWriteEndpoint, - txData, 2, _WriteCallback, this); + txData, count/*2*/, _WriteCallback, this); if (result != B_OK) { TRACE_ALWAYS("Error of queue_bulk_v request:%#010x\n", result); return result; @@ -352,7 +534,7 @@ DavicomDevice::Write(const uint8 *buffer, size_t *numBytes) *numBytes = fActualLengthWrite - kTXHeaderSize;; - TRACE_FLOW("Written %d bytes.\n", *numBytes); + TRACE_TX("Written %d bytes.\n", *numBytes); return B_OK; } @@ -568,6 +750,7 @@ DavicomDevice::_SetupEndpoints() fNotifyEndpoint = interface->endpoint[notifyEndpoint].handle; fReadEndpoint = interface->endpoint[readEndpoint ].handle; fWriteEndpoint = interface->endpoint[writeEndpoint ].handle; + fMaxTXPacketSize = interface->endpoint[writeEndpoint].descr->max_packet_size; return B_OK; } @@ -589,18 +772,21 @@ DavicomDevice::ReadMACAddress(ether_address_t *address) status_t DavicomDevice::StopDevice() { - /* - status_t result = WriteRXControlRegister(0); + uint8 control = 0; - if(result != B_OK) { - TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", 0, result); + // disable RX + status_t result = _ReadRegister(RCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Error reading RCR: %#010x.\n", result); + return result; } - TRACE_RET(result); + control &= ~RCR_RXEN; + result = _Write1Register(RCR, control); + if (result != B_OK) + TRACE_ALWAYS("Error writing %#02X to RCR: %#010x.\n", control, result); + return result; - */ - TRACE_ALWAYS("Stop device not implemented\n"); - return B_ERROR; } @@ -646,7 +832,7 @@ void DavicomDevice::_ReadCallback(void *cookie, int32 status, void *data, uint32 actualLength) { - TRACE_FLOW("ReadCB: %d bytes; status:%#010x\n", actualLength, status); +// TRACE_RX("ReadCB: %d bytes; status:%#010x\n", actualLength, status); DavicomDevice *device = (DavicomDevice *)cookie; device->fActualLengthRead = actualLength; device->fStatusRead = status; @@ -658,7 +844,7 @@ void DavicomDevice::_WriteCallback(void *cookie, int32 status, void *data, uint32 actualLength) { - TRACE_FLOW("WriteCB: %d bytes; status:%#010x\n", actualLength, status); + TRACE_TX("WriteCB: %d bytes; status:%#010x\n", actualLength, status); DavicomDevice *device = (DavicomDevice *)cookie; device->fActualLengthWrite = actualLength; device->fStatusWrite = status; @@ -700,58 +886,64 @@ DavicomDevice::_NotifyCallback(void *cookie, int32 status, void *data, status_t DavicomDevice::StartDevice() { - uint8 registerValue = 0; + uint8 control = 0; - /* disable loopback */ - status_t result = _ReadRegister(NCR, 1, ®isterValue); + // disable loopback + status_t result = _ReadRegister(NCR, 1, &control); if (result != B_OK) { TRACE_ALWAYS("Error reading NCR: %#010x.\n", result); return result; } - if (registerValue & NCR_EXT_PHY) + + if (control & NCR_EXT_PHY) TRACE_ALWAYS("Device uses external PHY\n"); - registerValue &= ~NCR_LBK; - result = _Write1Register(NCR, registerValue); + + control &= ~NCR_LBK; + result = _Write1Register(NCR, control); if (result != B_OK) { - TRACE_ALWAYS("Error writing %#02X to NCR: %#010x.\n", registerValue, result); + TRACE_ALWAYS("Error writing %#02X to NCR: %#010x.\n", control, result); return result; } - /* Initialize RX control register */ - result = _ReadRegister(RCR, 1, ®isterValue); + // Initialize RX control register, enable RX and activate multicast + result = _ReadRegister(RCR, 1, &control); if (result != B_OK) { TRACE_ALWAYS("Error reading RCR: %#010x.\n", result); return result; } - registerValue &= RCR_DIS_LONG & RCR_DIS_CRC & RCR_RXEN; - result = _Write1Register(RCR, registerValue); + + // TODO: do not forget handle promiscous mode correctly in the future!!! + control |= RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN | RCR_ALL; + result = _Write1Register(RCR, control); if (result != B_OK) { - TRACE_ALWAYS("Error writing %#02X to RCR: %#010x.\n", registerValue, result); + TRACE_ALWAYS("Error writing %#02X to RCR: %#010x.\n", control, result); return result; } - /* clear POWER_DOWN state of internal PHY */ - result = _ReadRegister(GPCR, 1, ®isterValue); + // clear POWER_DOWN state of internal PHY + result = _ReadRegister(GPCR, 1, &control); if (result != B_OK) { TRACE_ALWAYS("Error reading GPCR: %#010x.\n", result); return result; } - registerValue &= GPCR_GEP_CNTL0; - result = _Write1Register(GPCR, registerValue); + + control |= GPCR_GEP_CNTL0; + result = _Write1Register(GPCR, control); if (result != B_OK) { - TRACE_ALWAYS("Error writing %#02X to GPCR: %#010x.\n", registerValue, result); + TRACE_ALWAYS("Error writing %#02X to GPCR: %#010x.\n", control, result); return result; } - result = _ReadRegister(GPR, 1, ®isterValue); + result = _ReadRegister(GPR, 1, &control); if (result != B_OK) { TRACE_ALWAYS("Error reading GPR: %#010x.\n", result); return result; } - registerValue &= ~GPR_GEP_GEPIO0; - result = _Write1Register(GPR, registerValue); + + control &= ~GPR_GEP_GEPIO0; + result = _Write1Register(GPR, control); if (result != B_OK) { - TRACE_ALWAYS("Error writing %#02X to GPR: %#010x.\n", registerValue, result); + TRACE_ALWAYS("Error writing %#02X to GPR: %#010x.\n", control, result); return result; } @@ -804,6 +996,7 @@ DavicomDevice::OnNotify(uint32 actualLength) return B_OK; } + status_t DavicomDevice::GetLinkState(ether_link_state *linkState) { @@ -838,11 +1031,12 @@ DavicomDevice::GetLinkState(ether_link_state *linkState) if (registerValue & NCR_LBK) linkState->media |= IFM_LOOP; } - - TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n", +/* + TRACE_STATE("Medium state: %s, %lld MBit/s, %s duplex.\n", (linkState->media & IFM_ACTIVE) ? "active" : "inactive", - linkState->speed, + linkState->speed / 1000000, (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); +*/ return B_OK; } diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h index f0631925bf..11da5f6566 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h @@ -1,26 +1,24 @@ /* * Davicom DM9601 USB 1.1 Ethernet Driver. * Copyright (c) 2009 Adrien Destugues + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. * - * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski - * Distributed under the terms of the MIT license. - * * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ - #ifndef _USB_Davicom_DEVICE_H_ #define _USB_Davicom_DEVICE_H_ + #include #include "Driver.h" + class DavicomDevice { public: DavicomDevice(usb_device device, const char *description); @@ -57,10 +55,14 @@ static void _NotifyCallback(void *cookie, int32 status, status_t _ReadRegister(uint8 reg, size_t size, uint8* buffer); status_t _WriteRegister(uint8 reg, size_t size, uint8* buffer); status_t _Write1Register(uint8 reg, uint8 buffer); + status_t _ReadMII(uint8 reg, uint16* data); + status_t _WriteMII(uint8 reg, uint16 data); + status_t _InitMII(); + status_t _EnableInterrupts(bool enable); static const int kFrameSize = 1518; -static const int kRXHeaderSize = 3; -static const int kTXHeaderSize = 2; +static const size_t kRXHeaderSize = 3; +static const size_t kTXHeaderSize = 2; protected: /* overrides */ @@ -87,6 +89,7 @@ const char * fDescription; usb_pipe fNotifyEndpoint; usb_pipe fReadEndpoint; usb_pipe fWriteEndpoint; + uint16 fMaxTXPacketSize; // data stores for async usb transfers uint32 fActualLengthRead; @@ -97,7 +100,7 @@ const char * fDescription; sem_id fNotifyWriteSem; uint8 * fNotifyBuffer; -static const int kNotifyBufferSize = 8; +static const size_t kNotifyBufferSize = 8; // connection data sem_id fLinkStateChangeSem; diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp index e32d7d1e4a..311653d86a 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp @@ -17,7 +17,9 @@ bool gTraceOn = false; bool gTruncateLogFile = false; bool gAddTimeStamp = true; -bool gTraceFlow = false; +bool gTraceState = false; +bool gTraceRX = false; +bool gTraceTX = false; static char *gLogFilePath = NULL; mutex gLogLock; @@ -40,7 +42,9 @@ void load_settings() return; gTraceOn = get_driver_boolean_parameter(handle, "trace", gTraceOn, true); - gTraceFlow = get_driver_boolean_parameter(handle, "trace_flow", gTraceFlow, true); + gTraceState = get_driver_boolean_parameter(handle, "trace_state", gTraceState, true); + gTraceRX = get_driver_boolean_parameter(handle, "trace_rx", gTraceRX, true); + gTraceTX = get_driver_boolean_parameter(handle, "trace_tx", gTraceTX, true); gTruncateLogFile = get_driver_boolean_parameter(handle, "truncate_logfile", gTruncateLogFile, true); gAddTimeStamp = get_driver_boolean_parameter(handle, "add_timestamp", diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.h b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.h index 985057d011..a4a456d258 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.h +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.h @@ -25,8 +25,14 @@ void usb_davicom_trace(bool force, const char *func, const char *fmt, ...); #define TRACE(x...) usb_davicom_trace(false, __func__, x) #define TRACE_ALWAYS(x...) usb_davicom_trace(true, __func__, x) -extern bool gTraceFlow; -#define TRACE_FLOW(x...) usb_davicom_trace(gTraceFlow, NULL, x) +extern bool gTraceState; +#define TRACE_STATE(x...) usb_davicom_trace(gTraceState, NULL, x) + +extern bool gTraceRX; +#define TRACE_RX(x...) usb_davicom_trace(gTraceRX, NULL, x) + +extern bool gTraceTX; +#define TRACE_TX(x...) usb_davicom_trace(gTraceTX, NULL, x) #define TRACE_RET(result) usb_davicom_trace(false, __func__, \ "Returns:%#010x\n", result); diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/usb_davicom.settings b/src/add-ons/kernel/drivers/network/usb_davicom/usb_davicom.settings index 4dc7c7f37e..9399a7af5d 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/usb_davicom.settings +++ b/src/add-ons/kernel/drivers/network/usb_davicom/usb_davicom.settings @@ -28,8 +28,20 @@ reset_logfile on # add_timestamp off -## trace_flow [on|off] - activate data flow tracing. Statistic about of -## transferred data amount and media state. +## trace_state [on|off] - activate state tracing. Statistic about of +## media state. ## default value: off -# trace_flow on +# trace_state on + +## trace_rx [on|off] - activate data receivening tracing. Statistic about of +## transferred data amount. +## default value: off + +# trace_rx on + +## trace_tx [on|off] - activate data transmitting tracing. Statistic about of +## transferred data amount. +## default value: off + +# trace_tx on From 288723f429eaa141c5ddd55dafe252b34be35fc5 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Mon, 12 Sep 2011 19:42:52 +0000 Subject: [PATCH 291/702] Bringing usb_davicom to life: part 3 of 3: * Lot of code refactoring and code style fixes; * Promiscuous mode implemented; * Multicasting support implemented; * Binary-search devices table lookup procedure used instead of switch one. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42749 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/usb_davicom/DavicomDevice.cpp | 1115 ++++++++++------- .../network/usb_davicom/DavicomDevice.h | 154 ++- .../drivers/network/usb_davicom/Driver.cpp | 130 +- .../drivers/network/usb_davicom/Driver.h | 34 +- .../drivers/network/usb_davicom/Jamfile | 1 + .../drivers/network/usb_davicom/Settings.cpp | 92 +- .../drivers/network/usb_davicom/Settings.h | 48 +- .../network/usb_davicom/usb_davicom.settings | 23 +- 8 files changed, 939 insertions(+), 658 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp index dcb2ed13a9..e816da5b6c 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp @@ -1,301 +1,122 @@ /* * Davicom DM9601 USB 1.1 Ethernet Driver. - * Copyright (c) 2009 Adrien Destugues * Copyright (c) 2008, 2011 Siarzhuk Zharski + * Copyright (c) 2009 Adrien Destugues * Distributed under the terms of the MIT license. * - * Heavily based on code of the + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. - * */ #include "DavicomDevice.h" +#include +#include + #include "Driver.h" #include "Settings.h" -// Vendor commands -#define READ_REGISTER 0 -#define WRITE_REGISTER 1 -#define WRITE1_REGISTER 3 -#define READ_MEMORY 2 -#define WRITE_MEMORY 5 -#define WRITE1_MEMORY 7 +const int kFrameSize = 1522; + +enum VendorRequests { + ReqReadRegister = 0, + ReqWriteRegister = 1, + ReqWriteRegisterByte = 3, +}; -// Registers -#define NCR 0x00 // Network control -#define NSR 0x01 // Network status -#define RCR 0x05 // RX Control -#define PAR 0x10 // 6 bits - Physical address (MAC) -#define GPCR 0x1E // General purpose control -#define GPR 0x1F // General purpose +enum DM9601Registers { + RegNCR = 0x00, // Network Control Register + NCRExtPHY = 0x80, // Select External PHY + NCRFullDX = 0x08, // Full duplex + NCRLoopback = 0x06, // Internal PHY analog loopback -#define NCR_EXT_PHY 0x80 // External PHY -#define NCR_FDX 0x08 // Full duplex -#define NCR_LBK 0x06 // Loopback mode + RegNSR = 0x01, // Network Status Register + NSRSpeed10 = 0x80, // 0 = 100MBps, 1 = 10MBps (internal PHY) + NSRLinkUp = 0x40, // 1 = link up (internal PHY) + NSRTXFull = 0x10, // TX FIFO full + NSRRXOver = 0x08, // RX FIFO overflow -#define NSR_SPEED 0x80 // 0 = 100MBps, 1 = 10MBps -#define NSR_LINKST 0x40 // 1 = link up -#define NSR_TXFULL 0x10 // TX FIFO full -#define NSR_RXOV 0x08 // RX Overflow + RegRCR = 0x05, // RX Control Register + RCRDiscardLong = 0x20, // Discard long packet (over 1522 bytes) + RCRDiscardCRC = 0x10, // Discard CRC error packet + RCRAllMulticast = 0x08, // Pass all multicast + RCRPromiscuous = 0x02, // Promiscuous + RCRRXEnable = 0x01, // RX enable -#define RCR_DIS_LONG 0x20 // Discard long packet -#define RCR_DIS_CRC 0x10 // Discard CRC error packet -#define RCR_ALL 0x08 // Pass all multicast -#define RCR_PRMSC 0x02 // Promiscuous -#define RCR_RXEN 0x01 // RX enable + RegEPCR = 0x0b, // EEPROM & PHY Control Register + EPCROpSelect = 0x08, // EEPROM or PHY Operation Select + EPCRRegRead = 0x04, // EEPROM or PHY Register Read Command + EPCRRegWrite = 0x02, // EEPROM or PHY Register Write Command -#define GPCR_GEP_CNTL0 0x01 // Power Down function + RegEPAR = 0x0c, // EEPROM & PHY Address Register + EPARIntPHY = 0x40, // [7:6] force to 01 if Internal PHY is selected + EPARMask = 0x1f, // mask [0:5] -#define GPR_GEP_GEPIO0 0x01 // Power down + RegEPDRL = 0x0d, // EEPROM & PHY Low Byte Data Register -#define EPCR 0x0b // EEPROM/PHY Control Register -#define EPCR_EPOS 0x08 // EEPROM/PHY Operation Select -#define EPCR_ERPRR 0x04 // EEPROM/PHY Register Read Command -#define EPCR_ERPRW 0x02 // EEPROM/PHY Register Write Command + RegEPDRH = 0x0e, // EEPROM & PHY Low Byte Data Register -#define EPAR 0x0c // EEPROM/PHY Control Register -#define EPAR_ADDR0 0x40 // EEPROM/PHY Address -#define EPAR_MASK 0x1f // mask [0:5] - -#define EPDRL 0x0d // EEPROM/PHY Data Register - -#define USBCR 0xf4 // USB Control Register -#define EP3ACK 0x20 // ACK with 8-byte data on interrupt EP -#define EP3NACK 0x10 // Supress ACK on interrupt EP - -//TODO: multicast support -//TODO: set media state support - - -status_t -DavicomDevice::_ReadRegister(uint8 reg, size_t size, uint8* buffer) -{ - if (size > 255) return B_BAD_VALUE; - size_t actualLength; - status_t result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - READ_REGISTER, 0, reg, size, buffer, &actualLength); - if (size != actualLength) { - TRACE_ALWAYS("Size mismatch reading register ! asked %d got %d", - size, actualLength); - } - return result; -} - - -status_t -DavicomDevice::_WriteRegister(uint8 reg, size_t size, uint8* buffer) -{ - if (size > 255) return B_BAD_VALUE; - size_t actualLength; - status_t result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - WRITE_REGISTER, 0, reg, size, buffer, &actualLength); - return result; -} - - -status_t -DavicomDevice::_Write1Register(uint8 reg, uint8 value) -{ - size_t actualLength; - status_t result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - WRITE1_REGISTER, value, reg, 0, NULL, &actualLength); - return result; -} - - -status_t -DavicomDevice::_ReadMII(uint8 reg, uint16* data) -{ - // select PHY and set PHY register address - status_t result = _Write1Register(EPAR, EPAR_ADDR0 | (reg & EPAR_MASK)); - if (result != B_OK) { - TRACE_ALWAYS("Failed to set MII address %#x. Error:%#x\n", reg, result); - return result; - } + RegPAR = 0x10, // [0x10 - 0x15] Physical Address Register - // select PHY operation and initiate reading - result = _Write1Register(EPCR, EPCR_EPOS | EPCR_ERPRR); - if (result != B_OK) { - TRACE_ALWAYS("Failed to starting MII reading. Error:%#x\n", result); - return result; - } + RegMAR = 0x16, // [0x16 - 0x1d] Multicast Address Register - // finalize writing - uint8 control = 0; - result = _ReadRegister(EPCR, 1, &control); - if (result != B_OK) { - TRACE_ALWAYS("Failed to read EPCR register. Error:%#x\n", result); - return result; - } + RegGPCR = 0x1E, // General Purpose Control Register + GPCRPowerDown = 0x01, // [0:6] Define in/out direction of GPCR + // GPIO0 - is output for Power Down function - result = _Write1Register(EPCR, control & ~EPCR_ERPRR); - if (result != B_OK) { - TRACE_ALWAYS("Failed to write EPCR register. Error:%#x\n", result); - return result; - } + RegGPR = 0x1F, // General Purpose Register + GPRPowerDownInPHY = 0x01, // Power down Internal PHY - // retrieve the result from data registers - uint8 values[2] = { 0 }; - result = _ReadRegister(EPDRL, 2, values); - if (result != B_OK) { - TRACE_ALWAYS("Failed to retrieve data %#x. Error:%#x\n", data, result); - return result; - } + RegUSBC = 0xf4, // USB Control Register + USBCIntAck = 0x20, // ACK with 8-bytes of data on interrupt EP + USBCIntNAck = 0x10, // Supress ACK on interrupt EP - *data = values[0] | values[1] << 8; - return result; -} +}; -status_t -DavicomDevice::_WriteMII(uint8 reg, uint16 data) -{ - // select PHY and set PHY register address - status_t result = _Write1Register(EPAR, EPAR_ADDR0 | (reg & EPAR_MASK)); - if (result != B_OK) { - TRACE_ALWAYS("Failed to set MII address %#x. Error:%#x\n", reg, result); - return result; - } +enum MIIRegisters { + RegBMCR = 0x00, + BMCRIsolate = 0x0400, + BMCRReset = 0x8000, - // put the value to data register - uint8 values[] = { data & 0xff, ( data >> 8 ) & 0xff }; - result = _WriteRegister(EPDRL, sizeof(uint16), values); - if (result != B_OK) { - TRACE_ALWAYS("Failed to put data %#x. Error:%#x\n", data, result); - return result; - } - - // select PHY operation and initiate writing - result = _Write1Register(EPCR, EPCR_EPOS | EPCR_ERPRW); - if (result != B_OK) { - TRACE_ALWAYS("Failed to starting MII wrintig. Error:%#x\n", result); - return result; - } - - // finalize writing - uint8 control = 0; - result = _ReadRegister(EPCR, 1, &control); - if (result != B_OK) { - TRACE_ALWAYS("Failed to read EPCR register. Error:%#x\n", result); - return result; - } - - result = _Write1Register(EPCR, control & ~EPCR_ERPRW); - if (result != B_OK) - TRACE_ALWAYS("Failed to write EPCR register. Error:%#x\n", result); - - return result; -} - - -status_t -DavicomDevice::_InitMII() -{ - uint16 control = 0; - status_t result = _ReadMII(0, &control); // read BMCR - if (result != B_OK) { - TRACE_ALWAYS("Failed to read BMCR register. Error:%#x\n", result); - return result; - } - - result = _WriteMII(0, control & ~0x0400); // clear Isolate flag - if (result != B_OK) { - TRACE_ALWAYS("Failed to write BMCR register. Error:%#x\n", result); - return result; - } - - result = _WriteMII(0, 0x8000); // write reset to BMCR - if (result != B_OK) { - TRACE_ALWAYS("Failed to reset BMCR register. Error:%#x\n", result); - return result; - } - - uint16 id01 = 0, id02 = 0; - result = _ReadMII(0x02, &id01); // read PHY_ID 0 - if (result != B_OK) { - TRACE_ALWAYS("Failed to read PHY ID 0. Error:%#x\n", result); - return result; - } - - result = _ReadMII(0x03, &id02); // read PHY_ID 1 - if (result != B_OK) { - TRACE_ALWAYS("Failed to read PHY ID 1. Error:%#x\n", result); - return result; - } + RegBMSR = 0x01, + RegPHYID1 = 0x02, + RegPHYID2 = 0x03, +}; #define MII_OUI(id1, id2) (((id1) << 6) | ((id2) >> 10)) #define MII_MODEL(id2) (((id2) & 0x03f0) >> 4) #define MII_REV(id2) ((id2) & 0x000f) - TRACE_ALWAYS("MII Info: OUI:%04x; Model:%04x; rev:%02x.\n", - MII_OUI(id01, id02), MII_MODEL(id02), MII_REV(id02)); - return result; -} - - -status_t -DavicomDevice::_EnableInterrupts(bool enable) -{ - uint8 control = 0; - status_t result = _ReadRegister(USBCR, 1, &control); - if(result != B_OK) { - TRACE_ALWAYS("Error of reading USB control register:%#010x\n", result); - return result; - } - - if (enable) { - control |= EP3ACK; - control &= ~EP3NACK; - } else { - control &= ~EP3ACK; - } - - result = _Write1Register(USBCR, control); - if(result != B_OK) - TRACE_ALWAYS("Error of setting USB control register:%#010x\n", result); - - return result; -} - - -DavicomDevice::DavicomDevice(usb_device device, const char *description) - : fStatus(B_ERROR), +DavicomDevice::DavicomDevice(usb_device device, DeviceInfo& deviceInfo) + : fDevice(device), + fStatus(B_ERROR), fOpen(false), fRemoved(false), - fInsideNotify(0), - fDevice(device), - fDescription(description), + fHasConnection(false), + fTXBufferFull(false), fNonBlocking(false), + fInsideNotify(0), fNotifyEndpoint(0), fReadEndpoint(0), fWriteEndpoint(0), fMaxTXPacketSize(0), + fActualLengthRead(0), + fActualLengthWrite(0), + fStatusRead(0), + fStatusWrite(0), fNotifyReadSem(-1), fNotifyWriteSem(-1), - fNotifyBuffer(NULL), fLinkStateChangeSem(-1), - fHasConnection(false) + fNotifyData(NULL) { - const usb_device_descriptor - *deviceDescriptor = gUSBModule->get_device_descriptor(device); - - if (deviceDescriptor == NULL) { - TRACE_ALWAYS("Error of getting USB device descriptor.\n"); - return; - } - - fVendorID = deviceDescriptor->vendor_id; - fProductID = deviceDescriptor->product_id; + fDeviceInfo = deviceInfo; fNotifyReadSem = create_sem(0, DRIVER_NAME"_notify_read"); if (fNotifyReadSem < B_OK) { @@ -311,8 +132,8 @@ DavicomDevice::DavicomDevice(usb_device device, const char *description) return; } - fNotifyBuffer = (uint8*)malloc(kNotifyBufferSize); - if (fNotifyBuffer == NULL) { + fNotifyData = new DM9601NotifyData(); + if (fNotifyData == NULL) { TRACE_ALWAYS("Error allocating notify buffer\n"); return; } @@ -324,6 +145,7 @@ DavicomDevice::DavicomDevice(usb_device device, const char *description) _InitMII(); fStatus = B_OK; + TRACE("Created!\n"); } @@ -334,11 +156,11 @@ DavicomDevice::~DavicomDevice() if (fNotifyWriteSem >= B_OK) delete_sem(fNotifyWriteSem); - if (!fRemoved) //??? + if (!fRemoved) // ??? gUSBModule->cancel_queued_transfers(fNotifyEndpoint); - if(fNotifyBuffer) - free(fNotifyBuffer); + delete fNotifyData; + TRACE("Deleted!\n"); } @@ -350,23 +172,24 @@ DavicomDevice::Open(uint32 flags) if (fRemoved) return B_ERROR; - status_t result = StartDevice(); + status_t result = _StartDevice(); if (result != B_OK) { return result; } // setup state notifications - result = gUSBModule->queue_interrupt(fNotifyEndpoint, fNotifyBuffer, - kNotifyBufferSize, _NotifyCallback, this); - if(result != B_OK) { + result = gUSBModule->queue_interrupt(fNotifyEndpoint, fNotifyData, + sizeof(DM9601NotifyData), _NotifyCallback, this); + if (result != B_OK) { TRACE_ALWAYS("Error of requesting notify interrupt:%#010x\n", result); return result; } - result = _EnableInterrupts(true); + result = _EnableInterrupts(true); fNonBlocking = (flags & O_NONBLOCK) == O_NONBLOCK; fOpen = true; + TRACE("Opened: %#010x!\n", result); return result; } @@ -378,8 +201,8 @@ DavicomDevice::Close() fOpen = false; return B_OK; } - - _EnableInterrupts(false); + + _EnableInterrupts(false); // wait until possible notification handling finished... while (atomic_add(&fInsideNotify, 0) != 0) @@ -390,13 +213,16 @@ DavicomDevice::Close() fOpen = false; - return StopDevice(); + status_t result = _StopDevice(); + TRACE("Closed: %#010x!\n", result); + return result; } status_t DavicomDevice::Free() { + TRACE("Freed!\n"); return B_OK; } @@ -413,11 +239,27 @@ DavicomDevice::Read(uint8 *buffer, size_t *numBytes) return B_DEVICE_NOT_FOUND; } -// TRACE_RX("Request %d bytes.\n", numBytesToRead); + TRACE_RX("Request %d bytes.\n", numBytesToRead); + + struct _RXHeader { + uint FOE :1; + uint CE :1; + uint LE :1; + uint PLE :1; + uint RWTO:1; + uint LCS :1; + uint MF :1; + uint RF :1; + uint countLow :8; + uint countHigh :8; + + uint8 Errors() { return 0xbf & *(uint8*)this; } + } __attribute__((__packed__)); + + _RXHeader header = { 0 }; - uint8 header[kRXHeaderSize]; iovec rxData[] = { - { header, kRXHeaderSize }, + { &header, sizeof(header) }, { buffer, numBytesToRead } }; @@ -440,33 +282,28 @@ DavicomDevice::Read(uint8 *buffer, size_t *numBytes) return fStatusRead; } - if(fActualLengthRead < kRXHeaderSize) { - TRACE_ALWAYS("Error: no place for TRXHeader:only %d of %d bytes.\n", - fActualLengthRead, kRXHeaderSize); - return B_ERROR; //TODO: ??? + if (fActualLengthRead < sizeof(_RXHeader)) { + TRACE_ALWAYS("Error: no place for RXHeader: only %d of %d bytes.\n", + fActualLengthRead, sizeof(_RXHeader)); + return B_ERROR; } - /* - * TODO :see what the first byte holds ? - if(!header.IsValid()) { - TRACE_ALWAYS("Error:TRX Header is invalid: len:%#04x; ilen:%#04x\n", - header.fLength, header.fInvertedLength); - return B_ERROR; //TODO: ??? - } - */ - - *numBytes = header[1] | ( header[2] << 8 ); - - if (header[0] & 0xBF ) { - TRACE_ALWAYS("RX error %d occured !\n", header[0]); + if (header.Errors() != 0) { + TRACE_ALWAYS("RX header errors %#04x detected!\n", header.Errors()); } - if(fActualLengthRead - kRXHeaderSize > *numBytes) { + TRACE_STATS("FOE:%d CE:%d LE:%d PLE:%d rwTO:%d LCS:%d MF:%d RF:%d\n", + header.FOE, header.CE, header.LE, header.PLE, + header.RWTO, header.LCS, header.MF, header.RF); + + *numBytes = header.countLow | ( header.countHigh << 8 ); + + if (fActualLengthRead - sizeof(_RXHeader) > *numBytes) { TRACE_ALWAYS("MISMATCH of the frame length: hdr %d; received:%d\n", - *numBytes, fActualLengthRead - kRXHeaderSize); + *numBytes, fActualLengthRead - sizeof(_RXHeader)); } -// TRACE_RX("Read %d bytes.\n", *numBytes); + TRACE_RX("Read %d bytes.\n", *numBytes); return B_OK; } @@ -490,13 +327,15 @@ DavicomDevice::Write(const uint8 *buffer, size_t *numBytes) } if (fTXBufferFull) { - TRACE_ALWAYS("Error of writing %d bytes to device while TX buffer full.\n", + TRACE_ALWAYS("Error of writing %d bytes to device: TX buffer full.\n", numBytesToWrite); return B_ERROR; } TRACE_TX("Write %d bytes.\n", numBytesToWrite); + // additional padding byte must be transmitted in case data size + // to be send is multiple of pipe's max packet size uint16 length = numBytesToWrite; size_t count = 2; if (((numBytesToWrite + 2) % fMaxTXPacketSize) == 0) { @@ -504,17 +343,23 @@ DavicomDevice::Write(const uint8 *buffer, size_t *numBytes) count++; } - uint8 header[kTXHeaderSize] = { length & 0xFF, length >> 8 }; + struct _TXHeader { + uint countLow :8; + uint countHigh :8; + } __attribute__((__packed__)); + + _TXHeader header = { length & 0xff, length >> 8 & 0xff }; + uint8 padding = 0; iovec txData[] = { - { header, kTXHeaderSize }, + { &header, sizeof(_TXHeader) }, { (uint8*)buffer, numBytesToWrite }, { &padding, 1 } }; status_t result = gUSBModule->queue_bulk_v(fWriteEndpoint, - txData, count/*2*/, _WriteCallback, this); + txData, count, _WriteCallback, this); if (result != B_OK) { TRACE_ALWAYS("Error of queue_bulk_v request:%#010x\n", result); return result; @@ -532,7 +377,7 @@ DavicomDevice::Write(const uint8 *buffer, size_t *numBytes) return fStatusWrite; } - *numBytes = fActualLengthWrite - kTXHeaderSize;; + *numBytes = fActualLengthWrite - sizeof(_TXHeader); TRACE_TX("Written %d bytes.\n", *numBytes); return B_OK; @@ -551,7 +396,7 @@ DavicomDevice::Control(uint32 op, void *buffer, size_t length) return B_OK; case ETHER_GETFRAMESIZE: - *(uint32 *)buffer = 1518 /* fFrameSize */; + *(uint32 *)buffer = kFrameSize; return B_OK; case ETHER_NONBLOCK: @@ -561,24 +406,22 @@ DavicomDevice::Control(uint32 op, void *buffer, size_t length) case ETHER_SETPROMISC: TRACE("ETHER_SETPROMISC\n"); - return SetPromiscuousMode(*((uint8*)buffer)); + return _SetPromiscuousMode(*((uint8*)buffer)); case ETHER_ADDMULTI: TRACE("ETHER_ADDMULTI\n"); - return ModifyMulticastTable(true, *((uint8*)buffer)); + return _ModifyMulticastTable(true, (ether_address_t*)buffer); case ETHER_REMMULTI: TRACE("ETHER_REMMULTI\n"); - return ModifyMulticastTable(false, *((uint8*)buffer)); + return _ModifyMulticastTable(false, (ether_address_t*)buffer); -#if HAIKU_TARGET_PLATFORM_HAIKU case ETHER_SET_LINK_STATE_SEM: fLinkStateChangeSem = *(sem_id *)buffer; return B_OK; case ETHER_GET_LINK_STATE: - return GetLinkState((ether_link_state *)buffer); -#endif + return _GetLinkState((ether_link_state *)buffer); default: TRACE_ALWAYS("Unhandled IOCTL catched: %#010x\n", op); @@ -616,8 +459,8 @@ status_t DavicomDevice::SetupDevice(bool deviceReplugged) { ether_address address; - status_t result = ReadMACAddress(&address); - if(result != B_OK) { + status_t result = _ReadMACAddress(&address); + if (result != B_OK) { TRACE_ALWAYS("Error reading MAC address:%#010x\n", result); return result; } @@ -626,14 +469,15 @@ DavicomDevice::SetupDevice(bool deviceReplugged) address.ebyte[0], address.ebyte[1], address.ebyte[2], address.ebyte[3], address.ebyte[4], address.ebyte[5]); - if(deviceReplugged) { - // this might be the same device that was replugged - read the MAC address - // (which should be at the same index) to make sure - if(memcmp(&address, &fMACAddress, sizeof(address)) != 0) { + if (deviceReplugged) { + // this might be the same device that was replugged - read the MAC + // address (which should be at the same index) to make sure + if (memcmp(&address, &fMACAddress, sizeof(address)) != 0) { TRACE_ALWAYS("Cannot replace device with MAC address:" - "%02x:%02x:%02x:%02x:%02x:%02x\n", - fMACAddress.ebyte[0], fMACAddress.ebyte[1], fMACAddress.ebyte[2], - fMACAddress.ebyte[3], fMACAddress.ebyte[4], fMACAddress.ebyte[5]); + "%02x:%02x:%02x:%02x:%02x:%02x\n", + fMACAddress.ebyte[0], fMACAddress.ebyte[1], + fMACAddress.ebyte[2], fMACAddress.ebyte[3], + fMACAddress.ebyte[4], fMACAddress.ebyte[5]); return B_BAD_VALUE; // is not the same } } else @@ -654,8 +498,8 @@ DavicomDevice::CompareAndReattach(usb_device device) return B_ERROR; } - if (deviceDescriptor->vendor_id != fVendorID - && deviceDescriptor->product_id != fProductID) { + if (deviceDescriptor->vendor_id != fDeviceInfo.VendorId() + && deviceDescriptor->product_id != fDeviceInfo.ProductId()) { // this certainly isn't the same device return B_BAD_VALUE; } @@ -713,35 +557,41 @@ DavicomDevice::_SetupEndpoints() int readEndpoint = -1; int writeEndpoint = -1; - for(size_t ep = 0; ep < interface->endpoint_count; ep++) { - usb_endpoint_descriptor *epd = interface->endpoint[ep].descr; - if((epd->attributes & USB_ENDPOINT_ATTR_MASK) == USB_ENDPOINT_ATTR_INTERRUPT) { - notifyEndpoint = ep; - continue; - } + for (size_t ep = 0; ep < interface->endpoint_count; ep++) { + usb_endpoint_descriptor *epd = interface->endpoint[ep].descr; + if ((epd->attributes & USB_ENDPOINT_ATTR_MASK) + == USB_ENDPOINT_ATTR_INTERRUPT) + { + notifyEndpoint = ep; + continue; + } - if((epd->attributes & USB_ENDPOINT_ATTR_MASK) != USB_ENDPOINT_ATTR_BULK) { - TRACE_ALWAYS("Error: USB endpoint type %#04x is unknown.\n", epd->attributes); - continue; - } + if ((epd->attributes & USB_ENDPOINT_ATTR_MASK) + != USB_ENDPOINT_ATTR_BULK) + { + TRACE_ALWAYS("Error: USB endpoint type %#04x is unknown.\n", + epd->attributes); + continue; + } - if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) - == USB_ENDPOINT_ADDR_DIR_IN) { - readEndpoint = ep; - continue; - } + if ((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) + == USB_ENDPOINT_ADDR_DIR_IN) + { + readEndpoint = ep; + continue; + } - if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_OUT) - == USB_ENDPOINT_ADDR_DIR_OUT) { - writeEndpoint = ep; - continue; - } + if ((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_OUT) + == USB_ENDPOINT_ADDR_DIR_OUT) + { + writeEndpoint = ep; + continue; + } } if (notifyEndpoint == -1 || readEndpoint == -1 || writeEndpoint == -1) { - TRACE_ALWAYS("Error: not all USB endpoints were found: " - "notify:%d; read:%d; write:%d\n", - notifyEndpoint, readEndpoint, writeEndpoint); + TRACE_ALWAYS("Error: not all USB endpoints were found: notify:%d; " + "read:%d; write:%d\n", notifyEndpoint, readEndpoint, writeEndpoint); return B_ERROR; } @@ -757,10 +607,11 @@ DavicomDevice::_SetupEndpoints() status_t -DavicomDevice::ReadMACAddress(ether_address_t *address) +DavicomDevice::_ReadMACAddress(ether_address_t *address) { - status_t result = _ReadRegister(PAR, sizeof(ether_address), (uint8*)address); - if(result != B_OK) { + status_t result = _ReadRegister(RegPAR, + sizeof(ether_address), (uint8*)address); + if (result != B_OK) { TRACE_ALWAYS("Error of reading MAC address:%#010x\n", result); return result; } @@ -770,19 +621,87 @@ DavicomDevice::ReadMACAddress(ether_address_t *address) status_t -DavicomDevice::StopDevice() +DavicomDevice::_StartDevice() { uint8 control = 0; - // disable RX - status_t result = _ReadRegister(RCR, 1, &control); + // disable loopback + status_t result = _ReadRegister(RegNCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Error reading NCR: %#010x.\n", result); + return result; + } + + if (control & NCRExtPHY) + TRACE_ALWAYS("Device uses external PHY\n"); + + control &= ~NCRLoopback; + result = _Write1Register(RegNCR, control); + if (result != B_OK) { + TRACE_ALWAYS("Error writing %#02X to NCR: %#010x.\n", control, result); + return result; + } + + // Initialize RX control register, enable RX and activate multicast + result = _ReadRegister(RegRCR, 1, &control); if (result != B_OK) { TRACE_ALWAYS("Error reading RCR: %#010x.\n", result); return result; } - control &= ~RCR_RXEN; - result = _Write1Register(RCR, control); + control &= ~RCRPromiscuous; + control |= RCRDiscardLong | RCRDiscardCRC | RCRRXEnable | RCRAllMulticast; + result = _Write1Register(RegRCR, control); + if (result != B_OK) { + TRACE_ALWAYS("Error writing %#02X to RCR: %#010x.\n", control, result); + return result; + } + + // clear POWER_DOWN state of internal PHY + result = _ReadRegister(RegGPCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Error reading GPCR: %#010x.\n", result); + return result; + } + + control |= GPCRPowerDown; + result = _Write1Register(RegGPCR, control); + if (result != B_OK) { + TRACE_ALWAYS("Error writing %#02X to GPCR: %#010x.\n", control, result); + return result; + } + + result = _ReadRegister(RegGPR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Error reading GPR: %#010x.\n", result); + return result; + } + + control &= ~GPRPowerDownInPHY; + result = _Write1Register(RegGPR, control); + if (result != B_OK) { + TRACE_ALWAYS("Error writing %#02X to GPR: %#010x.\n", control, result); + return result; + } + + return B_OK; +} + + +status_t +DavicomDevice::_StopDevice() +{ + uint8 control = 0; + + // disable RX + status_t result = _ReadRegister(RegRCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Error reading RCR: %#010x.\n", result); + return result; + } + + control &= ~RCRRXEnable; + result = _Write1Register(RegRCR, control); if (result != B_OK) TRACE_ALWAYS("Error writing %#02X to RCR: %#010x.\n", control, result); @@ -791,40 +710,110 @@ DavicomDevice::StopDevice() status_t -DavicomDevice::SetPromiscuousMode(bool on) +DavicomDevice::_SetPromiscuousMode(bool on) { + uint8 control = 0; - /* load multicast filter and update promiscious mode bit */ - uint8_t rxmode; - - status_t result = _ReadRegister(RCR, 1, &rxmode); + status_t result = _ReadRegister(RegRCR, 1, &control); if (result != B_OK) { - TRACE_ALWAYS("Error reading RX Control:%#010x\n", result); + TRACE_ALWAYS("Error reading RCR: %#010x.\n", result); return result; } - rxmode &= ~(RCR_ALL | RCR_PRMSC); if (on) - rxmode |= RCR_ALL | RCR_PRMSC; -/* else if (ifp->if_flags & IFF_ALLMULTI) - rxmode |= RCR_ALL; */ + control |= RCRPromiscuous; + else + control &= ~RCRPromiscuous; - /* write new mode bits */ - result = _Write1Register(RCR, rxmode); - if(result != B_OK) { - TRACE_ALWAYS("Error writing %#04x to RX Control:%#010x\n", rxmode, result); - } + result = _Write1Register(RegRCR, control); + if (result != B_OK) + TRACE_ALWAYS("Error writing %#02X to RCR: %#010x.\n", control, result); return result; } -status_t -DavicomDevice::ModifyMulticastTable(bool add, uint8 address) +uint32 +DavicomDevice::_EthernetCRC32(const uint8* buffer, size_t length) { - //TODO: !!! - TRACE_ALWAYS("Call for (%d, %#02x) is not implemented\n", add, address); - return B_OK; + uint32 result = 0xffffffff; + for (size_t i = 0; i < length; i++) { + uint8 data = *buffer++; + for (int bit = 0; bit < 8; bit++, data >>= 1) { + uint32 carry = ((result & 0x80000000) ? 1 : 0) ^ (data & 0x01); + result <<= 1; + if (carry != 0) + result = (result ^ 0x04c11db6) | carry; + } + } + return result; +} + + +status_t +DavicomDevice::_ModifyMulticastTable(bool join, ether_address_t *group) +{ + char groupName[6 * 3 + 1] = { 0 }; + sprintf(groupName, "%02x:%02x:%02x:%02x:%02x:%02x", + group->ebyte[0], group->ebyte[1], group->ebyte[2], + group->ebyte[3], group->ebyte[4], group->ebyte[5]); + TRACE("%s multicast group %s\n", join ? "Joining" : "Leaving", groupName); + + uint32 hash = _EthernetCRC32(group->ebyte, 6); + bool isInTable = fMulticastHashes.Find(hash) != fMulticastHashes.End(); + + if (isInTable && join) + return B_OK; // already listed - nothing to do + + if (!isInTable && !join) { + TRACE_ALWAYS("Cannot leave unlisted multicast group %s!\n", groupName); + return B_ERROR; + } + + const size_t hashLength = 8; + uint8 hashTable[hashLength] = { 0 }; + hashTable[hashLength - 1] |= 0x80; // broadcast address + + status_t result = _WriteRegister(RegMAR, hashLength, hashTable); + if (result != B_OK) { + TRACE_ALWAYS("Error initializing MAR: %#010x.\n", result); + return result; + } + + if (join) + fMulticastHashes.PushBack(hash); + else + fMulticastHashes.Remove(hash); + + for (int32 i = 0; i < fMulticastHashes.Count(); i++) { + uint32 hash = fMulticastHashes[i] >> 26; + hashTable[hash / 8] |= 1 << (hash % 8); + } + + // clear/set pass all multicast bit as required + uint8 control = 0; + result = _ReadRegister(RegRCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Error reading RCR: %#010x.\n", result); + return result; + } + + if (fMulticastHashes.Count() > 0) + control &= ~RCRAllMulticast; + else + control |= RCRAllMulticast; + + result = _Write1Register(RegRCR, control); + if (result != B_OK) { + TRACE_ALWAYS("Error writing %#02X to RCR: %#010x.\n", control, result); + return result; + } + + result = _WriteRegister(RegMAR, hashLength, hashTable); + if (result != B_OK) + TRACE_ALWAYS("Error writing hash table in MAR: %#010x.\n", result); + + return result; } @@ -832,10 +821,11 @@ void DavicomDevice::_ReadCallback(void *cookie, int32 status, void *data, uint32 actualLength) { -// TRACE_RX("ReadCB: %d bytes; status:%#010x\n", actualLength, status); + TRACE_RX("ReadCB: %d bytes; status:%#010x\n", actualLength, status); DavicomDevice *device = (DavicomDevice *)cookie; device->fActualLengthRead = actualLength; device->fStatusRead = status; + device->fStats.readCount++; release_sem_etc(device->fNotifyReadSem, 1, B_DO_NOT_RESCHEDULE); } @@ -848,6 +838,7 @@ DavicomDevice::_WriteCallback(void *cookie, int32 status, void *data, DavicomDevice *device = (DavicomDevice *)cookie; device->fActualLengthWrite = actualLength; device->fStatusWrite = status; + device->fStats.writeCount++; release_sem_etc(device->fNotifyWriteSem, 1, B_DO_NOT_RESCHEDULE); } @@ -863,113 +854,30 @@ DavicomDevice::_NotifyCallback(void *cookie, int32 status, void *data, return; } - if (status != B_OK) { - TRACE_ALWAYS("Device status error:%#010x\n", status); - /* - status_t result = gUSBModule->clear_feature(device->fNotifyEndpoint, - USB_FEATURE_ENDPOINT_HALT); - if(result != B_OK) - TRACE_ALWAYS("Error during clearing of HALT state:%#010x.\n", result); - */ - } - - // parse data in overriden class - device->OnNotify(actualLength); + if (status == B_OK) + device->_OnNotify(actualLength); + else + TRACE_ALWAYS("Status error:%#010x; length:%d\n", status, actualLength); // schedule next notification buffer - gUSBModule->queue_interrupt(device->fNotifyEndpoint, device->fNotifyBuffer, - kNotifyBufferSize, _NotifyCallback, device); + gUSBModule->queue_interrupt(device->fNotifyEndpoint, device->fNotifyData, + sizeof(DM9601NotifyData), _NotifyCallback, device); atomic_add(&device->fInsideNotify, -1); } status_t -DavicomDevice::StartDevice() +DavicomDevice::_OnNotify(uint32 actualLength) { - uint8 control = 0; - - // disable loopback - status_t result = _ReadRegister(NCR, 1, &control); - if (result != B_OK) { - TRACE_ALWAYS("Error reading NCR: %#010x.\n", result); - return result; - } - - if (control & NCR_EXT_PHY) - TRACE_ALWAYS("Device uses external PHY\n"); - - control &= ~NCR_LBK; - result = _Write1Register(NCR, control); - if (result != B_OK) { - TRACE_ALWAYS("Error writing %#02X to NCR: %#010x.\n", control, result); - return result; - } - - // Initialize RX control register, enable RX and activate multicast - result = _ReadRegister(RCR, 1, &control); - if (result != B_OK) { - TRACE_ALWAYS("Error reading RCR: %#010x.\n", result); - return result; - } - - // TODO: do not forget handle promiscous mode correctly in the future!!! - control |= RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN | RCR_ALL; - result = _Write1Register(RCR, control); - if (result != B_OK) { - TRACE_ALWAYS("Error writing %#02X to RCR: %#010x.\n", control, result); - return result; - } - - // clear POWER_DOWN state of internal PHY - result = _ReadRegister(GPCR, 1, &control); - if (result != B_OK) { - TRACE_ALWAYS("Error reading GPCR: %#010x.\n", result); - return result; - } - - control |= GPCR_GEP_CNTL0; - result = _Write1Register(GPCR, control); - if (result != B_OK) { - TRACE_ALWAYS("Error writing %#02X to GPCR: %#010x.\n", control, result); - return result; - } - - result = _ReadRegister(GPR, 1, &control); - if (result != B_OK) { - TRACE_ALWAYS("Error reading GPR: %#010x.\n", result); - return result; - } - - control &= ~GPR_GEP_GEPIO0; - result = _Write1Register(GPR, control); - if (result != B_OK) { - TRACE_ALWAYS("Error writing %#02X to GPR: %#010x.\n", control, result); - return result; - } - - return B_OK; -} - - -status_t -DavicomDevice::OnNotify(uint32 actualLength) -{ - if (actualLength != kNotifyBufferSize) { - TRACE_ALWAYS("Data underrun error. %d of 8 bytes received\n", - actualLength); + if (actualLength != sizeof(DM9601NotifyData)) { + TRACE_ALWAYS("Data underrun error. %d of %d bytes received\n", + actualLength, sizeof(DM9601NotifyData)); return B_BAD_DATA; } - // 3 = RX status - // 4 = Receive overflow counter - // 5 = Received packet counter - // 6 = Transmit packet counter - // 7 = GPR - - // 0 = Network status (NSR) - bool linkIsUp = (fNotifyBuffer[0] & NSR_LINKST) != 0; - fTXBufferFull = (fNotifyBuffer[0] & NSR_TXFULL) != 0; - bool rxOverflow = (fNotifyBuffer[0] & NSR_RXOV) != 0; + bool linkIsUp = fNotifyData->LINKST != 0; + fTXBufferFull = fNotifyData->TXFULL != 0; + bool rxOverflow = fNotifyData->RXOV != 0; bool linkStateChange = (linkIsUp != fHasConnection); fHasConnection = linkIsUp; @@ -977,19 +885,72 @@ DavicomDevice::OnNotify(uint32 actualLength) if (linkStateChange) { if (fHasConnection) { TRACE("Link is now up at %s Mb/s\n", - (fNotifyBuffer[0] & NSR_SPEED) ? "10" : "100"); + fNotifyData->SPEED ? "10" : "100"); } else TRACE("Link is now down"); } - if (rxOverflow) - TRACE("RX buffer overflow occured %d times\n", fNotifyBuffer[4]); +#ifdef UDAV_TRACE + if (gTraceStats) { + if (fNotifyData->TXFULL) + fStats.txFull++; + if (fNotifyData->RXOV) + fStats.rxOverflow++; - // 1,2 = TX status - if (fNotifyBuffer[1]) - TRACE("Error %x occured on transmitting packet 1\n", fNotifyBuffer[1]); - if (fNotifyBuffer[2]) - TRACE("Error %x occured on transmitting packet 2\n", fNotifyBuffer[2]); + if (fNotifyData->ROC) + fStats.rxOvCount += fNotifyData->ROC; + + if (fNotifyData->RT) + fStats.runtFrames++; + if (fNotifyData->LCS) + fStats.lateRXCollisions++; + if (fNotifyData->RWTO) + fStats.rwTOs++; + if (fNotifyData->PLE) + fStats.physLayerErros++; + if (fNotifyData->AE) + fStats.alignmentErros++; + if (fNotifyData->CE) + fStats.crcErrors++; + if (fNotifyData->FOE) + fStats.overErrors++; + + if (fNotifyData->TSR1.LC) + fStats.lateTXCollisions++; + if (fNotifyData->TSR1.LCR) + fStats.lostOfCarrier++; + if (fNotifyData->TSR1.NC) + fStats.noCarrier++; + if (fNotifyData->TSR1.COL) + fStats.txCollisions++; + if (fNotifyData->TSR1.EC) + fStats.excCollisions++; + + if (fNotifyData->TSR2.LC) + fStats.lateTXCollisions++; + if (fNotifyData->TSR2.LCR) + fStats.lostOfCarrier++; + if (fNotifyData->TSR2.NC) + fStats.noCarrier++; + if (fNotifyData->TSR2.COL) + fStats.txCollisions++; + if (fNotifyData->TSR2.EC) + fStats.excCollisions++; + + fStats.notifyCount++; + } +#endif + + if (rxOverflow) + TRACE("RX buffer overflow. %d packets dropped\n", fNotifyData->ROC); + + uint8 tsr = 0xfc & *(uint8*)&fNotifyData->TSR1; + if (tsr != 0) + TRACE("TX packet 1: Status %#04x is not OK.\n", tsr); + + tsr = 0xfc & *(uint8*)&fNotifyData->TSR2; + if (tsr != 0) + TRACE("TX packet 2: Status %#04x is not OK.\n", tsr); if (linkStateChange && fLinkStateChangeSem >= B_OK) release_sem_etc(fLinkStateChangeSem, 1, B_DO_NOT_RESCHEDULE); @@ -998,16 +959,16 @@ DavicomDevice::OnNotify(uint32 actualLength) status_t -DavicomDevice::GetLinkState(ether_link_state *linkState) +DavicomDevice::_GetLinkState(ether_link_state *linkState) { uint8 registerValue = 0; - status_t result = _ReadRegister(NSR, 1, ®isterValue); + status_t result = _ReadRegister(RegNSR, 1, ®isterValue); if (result != B_OK) { - TRACE_ALWAYS("Error reading NSR register! %x\n",result); + TRACE_ALWAYS("Error reading NSR register! %x\n", result); return result; } - if (registerValue & NSR_SPEED) + if (registerValue & NSRSpeed10) linkState->speed = 10000000; else linkState->speed = 100000000; @@ -1017,26 +978,236 @@ DavicomDevice::GetLinkState(ether_link_state *linkState) linkState->media = IFM_ETHER | IFM_100_TX; if (fHasConnection) { linkState->media |= IFM_ACTIVE; - result = _ReadRegister(NCR, 1, ®isterValue); + result = _ReadRegister(RegNCR, 1, ®isterValue); if (result != B_OK) { - TRACE_ALWAYS("Error reading NCR register! %x\n",result); + TRACE_ALWAYS("Error reading NCR register! %x\n", result); return result; } - if (registerValue & NCR_FDX) + if (registerValue & NCRFullDX) linkState->media |= IFM_FULL_DUPLEX; else linkState->media |= IFM_HALF_DUPLEX; - if (registerValue & NCR_LBK) + if (registerValue & NCRLoopback) linkState->media |= IFM_LOOP; } -/* + TRACE_STATE("Medium state: %s, %lld MBit/s, %s duplex.\n", (linkState->media & IFM_ACTIVE) ? "active" : "inactive", linkState->speed / 1000000, (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); -*/ + + TRACE_STATS("tx:%d rx:%d rxCn:%d rtF:%d lRxC:%d rwTO:%d PLE:%d AE:%d CE:%d " + "oE:%d ltxC:%d lCR:%d nC:%d txC:%d exC:%d r:%d w:%d n:%d\n", + fStats.txFull, fStats.rxOverflow, fStats.rxOvCount, + fStats.runtFrames, fStats.lateRXCollisions, fStats.rwTOs, + fStats.physLayerErros, fStats.alignmentErros, + fStats.crcErrors, fStats.overErrors, + fStats.lateTXCollisions, fStats.lostOfCarrier, + fStats.noCarrier, fStats.txCollisions, fStats.excCollisions, + fStats.readCount, fStats.writeCount, fStats.notifyCount); return B_OK; } + +status_t +DavicomDevice::_ReadRegister(uint8 reg, size_t size, uint8* buffer) +{ + if (size > 255) + return B_BAD_VALUE; + + size_t actualLength = 0; + status_t result = gUSBModule->send_request(fDevice, + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, + ReqReadRegister, 0, reg, size, buffer, &actualLength); + + if (size != actualLength) { + TRACE_ALWAYS("Size mismatch reading register ! asked %d got %d", + size, actualLength); + } + + return result; +} + + +status_t +DavicomDevice::_WriteRegister(uint8 reg, size_t size, uint8* buffer) +{ + if (size > 255) + return B_BAD_VALUE; + + size_t actualLength = 0; + + status_t result = gUSBModule->send_request(fDevice, + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, + ReqWriteRegister, 0, reg, size, buffer, &actualLength); + + return result; +} + + +status_t +DavicomDevice::_Write1Register(uint8 reg, uint8 value) +{ + size_t actualLength = 0; + + status_t result = gUSBModule->send_request(fDevice, + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, + ReqWriteRegisterByte, value, reg, 0, NULL, &actualLength); + + return result; +} + + +status_t +DavicomDevice::_ReadMII(uint8 reg, uint16* data) +{ + // select PHY and set PHY register address + status_t result = _Write1Register(RegEPAR, EPARIntPHY | (reg & EPARMask)); + if (result != B_OK) { + TRACE_ALWAYS("Failed to set MII address %#x. Error:%#x\n", reg, result); + return result; + } + + // select PHY operation and initiate reading + result = _Write1Register(RegEPCR, EPCROpSelect | EPCRRegRead); + if (result != B_OK) { + TRACE_ALWAYS("Failed to starting MII reading. Error:%#x\n", result); + return result; + } + + // finalize writing + uint8 control = 0; + result = _ReadRegister(RegEPCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Failed to read EPCR register. Error:%#x\n", result); + return result; + } + + result = _Write1Register(RegEPCR, control & ~EPCRRegRead); + if (result != B_OK) { + TRACE_ALWAYS("Failed to write EPCR register. Error:%#x\n", result); + return result; + } + + // retrieve the result from data registers + uint8 values[2] = { 0 }; + result = _ReadRegister(RegEPDRL, 2, values); + if (result != B_OK) { + TRACE_ALWAYS("Failed to retrieve data %#x. Error:%#x\n", data, result); + return result; + } + + *data = values[0] | values[1] << 8; + return result; +} + + +status_t +DavicomDevice::_WriteMII(uint8 reg, uint16 data) +{ + // select PHY and set PHY register address + status_t result = _Write1Register(RegEPAR, EPARIntPHY | (reg & EPARMask)); + if (result != B_OK) { + TRACE_ALWAYS("Failed to set MII address %#x. Error:%#x\n", reg, result); + return result; + } + + // put the value to data register + uint8 values[] = { data & 0xff, ( data >> 8 ) & 0xff }; + result = _WriteRegister(RegEPDRL, sizeof(uint16), values); + if (result != B_OK) { + TRACE_ALWAYS("Failed to put data %#x. Error:%#x\n", data, result); + return result; + } + + // select PHY operation and initiate writing + result = _Write1Register(RegEPCR, EPCROpSelect | EPCRRegWrite); + if (result != B_OK) { + TRACE_ALWAYS("Failed to starting MII wrintig. Error:%#x\n", result); + return result; + } + + // finalize writing + uint8 control = 0; + result = _ReadRegister(RegEPCR, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Failed to read EPCR register. Error:%#x\n", result); + return result; + } + + result = _Write1Register(RegEPCR, control & ~EPCRRegWrite); + if (result != B_OK) + TRACE_ALWAYS("Failed to write EPCR register. Error:%#x\n", result); + + return result; +} + + +status_t +DavicomDevice::_InitMII() +{ + uint16 control = 0; + status_t result = _ReadMII(RegBMCR, &control); + if (result != B_OK) { + TRACE_ALWAYS("Failed to read MII BMCR register. Error:%#x\n", result); + return result; + } + + result = _WriteMII(RegBMCR, control & ~BMCRIsolate); + if (result != B_OK) { + TRACE_ALWAYS("Failed to clear isolate PHY. Error:%#x\n", result); + return result; + } + + result = _WriteMII(0, BMCRReset); + if (result != B_OK) { + TRACE_ALWAYS("Failed to reset BMCR register. Error:%#x\n", result); + return result; + } + + uint16 id01 = 0, id02 = 0; + result = _ReadMII(RegPHYID1, &id01); + if (result != B_OK) { + TRACE_ALWAYS("Failed to read PHY ID 0. Error:%#x\n", result); + return result; + } + + result = _ReadMII(RegPHYID2, &id02); + if (result != B_OK) { + TRACE_ALWAYS("Failed to read PHY ID 1. Error:%#x\n", result); + return result; + } + + TRACE_ALWAYS("MII Info: OUI:%04x; Model:%04x; rev:%02x.\n", + MII_OUI(id01, id02), MII_MODEL(id02), MII_REV(id02)); + + return result; +} + + +status_t +DavicomDevice::_EnableInterrupts(bool enable) +{ + uint8 control = 0; + status_t result = _ReadRegister(RegUSBC, 1, &control); + if (result != B_OK) { + TRACE_ALWAYS("Error of reading USB control register:%#010x\n", result); + return result; + } + + if (enable) { + control |= USBCIntAck; + control &= ~USBCIntNAck; + } else { + control &= ~USBCIntAck; + } + + result = _Write1Register(RegUSBC, control); + if (result != B_OK) + TRACE_ALWAYS("Error of setting USB control register:%#010x\n", result); + + return result; +} + diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h index 11da5f6566..d8441bd11e 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h @@ -1,28 +1,109 @@ /* * Davicom DM9601 USB 1.1 Ethernet Driver. + * Copyright (c) 2008, 2011 Siarzhuk Zharski * Copyright (c) 2009 Adrien Destugues - * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. * - * Heavily based on code of the + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. - * */ -#ifndef _USB_Davicom_DEVICE_H_ -#define _USB_Davicom_DEVICE_H_ +#ifndef _USB_DAVICOM_DEVICE_H_ +#define _USB_DAVICOM_DEVICE_H_ -#include +#include +#include #include "Driver.h" +struct DM9601NotifyData { + // Network Status Register + uint RXRDY :1; + uint RXOV :1; + uint TX1END :1; + uint TX2END :1; + uint TXFULL :1; + uint WAKEST :1; + uint LINKST :1; + uint SPEED :1; + + struct { + uint :2; + uint EC :1; + uint COL :1; + uint LC :1; + uint NC :1; + uint LCR :1; + uint :1; + } __attribute__((__packed__)) TSR1, TSR2; + + // RX Status Register + uint FOE :1; + uint CE :1; + uint AE :1; + uint PLE :1; + uint RWTO :1; + uint LCS :1; + uint MF :1; + uint RT :1; + + // RX Overflows Count + uint RXFU :1; + uint ROC :7; + + uint RXC :8; + uint TXC :8; + uint GPR :8; + + DM9601NotifyData() { memset(this, 0, sizeof(DM9601NotifyData)); } +} __attribute__((__packed__)); + + +struct DeviceInfo { + union Id { + uint16 fIds[2]; + uint32 fKey; + } fId; + const char* fName; + inline uint16 VendorId() { return fId.fIds[0]; } + inline uint16 ProductId() { return fId.fIds[1]; } + inline uint32 Key() { return fId.fKey; } +}; + class DavicomDevice { + + struct _Statistics { + // NSR + int txFull; + int rxOverflow; + int rxOvCount; + // RSR + int runtFrames; + int lateRXCollisions; + int rwTOs; + int physLayerErros; + int alignmentErros; + int crcErrors; + int overErrors; + // TSR 1/2 + int lateTXCollisions; + int lostOfCarrier; + int noCarrier; + int txCollisions; + int excCollisions; + + int notifyCount; + int readCount; + int writeCount; + _Statistics() { memset(this, 0, sizeof(_Statistics)); } + }; + public: - DavicomDevice(usb_device device, const char *description); - virtual ~DavicomDevice(); + DavicomDevice(usb_device device, DeviceInfo& Info); + ~DavicomDevice(); status_t InitCheck() { return fStatus; }; @@ -40,8 +121,8 @@ public: bool IsRemoved() { return fRemoved; }; status_t CompareAndReattach(usb_device device); -virtual status_t SetupDevice(bool deviceReplugged); - + status_t SetupDevice(bool deviceReplugged); + private: static void _ReadCallback(void *cookie, int32 status, void *data, uint32 actualLength); @@ -52,6 +133,16 @@ static void _NotifyCallback(void *cookie, int32 status, status_t _SetupEndpoints(); + status_t _StartDevice(); + status_t _StopDevice(); + status_t _OnNotify(uint32 actualLength); + status_t _GetLinkState(ether_link_state *state); + status_t _SetPromiscuousMode(bool bOn); + uint32 _EthernetCRC32(const uint8* buffer, size_t length); + status_t _ModifyMulticastTable(bool join, + ether_address_t *group); + status_t _ReadMACAddress(ether_address_t *address); + status_t _ReadRegister(uint8 reg, size_t size, uint8* buffer); status_t _WriteRegister(uint8 reg, size_t size, uint8* buffer); status_t _Write1Register(uint8 reg, uint8 buffer); @@ -60,32 +151,22 @@ static void _NotifyCallback(void *cookie, int32 status, status_t _InitMII(); status_t _EnableInterrupts(bool enable); -static const int kFrameSize = 1518; -static const size_t kRXHeaderSize = 3; -static const size_t kTXHeaderSize = 2; -protected: - /* overrides */ -virtual status_t StartDevice() ; -virtual status_t StopDevice(); -virtual status_t OnNotify(uint32 actualLength) ; -virtual status_t GetLinkState(ether_link_state *state) ; -virtual status_t SetPromiscuousMode(bool bOn); -virtual status_t ModifyMulticastTable(bool add, uint8 address); - status_t ReadMACAddress(ether_address_t *address); - + // device info + usb_device fDevice; + DeviceInfo fDeviceInfo; + ether_address_t fMACAddress; + // state tracking status_t fStatus; bool fOpen; bool fRemoved; - vint32 fInsideNotify; - usb_device fDevice; - uint16 fVendorID; - uint16 fProductID; -const char * fDescription; + bool fHasConnection; + bool fTXBufferFull; bool fNonBlocking; + vint32 fInsideNotify; - // pipes for notifications and data io + // pipes for notifications, data io and tx packet size usb_pipe fNotifyEndpoint; usb_pipe fReadEndpoint; usb_pipe fWriteEndpoint; @@ -98,15 +179,12 @@ const char * fDescription; int32 fStatusWrite; sem_id fNotifyReadSem; sem_id fNotifyWriteSem; - - uint8 * fNotifyBuffer; -static const size_t kNotifyBufferSize = 8; - - // connection data sem_id fLinkStateChangeSem; - ether_address_t fMACAddress; - bool fHasConnection; - bool fTXBufferFull; + + DM9601NotifyData* fNotifyData; + _Statistics fStats; + Vector fMulticastHashes; }; -#endif //_USB_Davicom_DEVICE_H_ +#endif // _USB_DAVICOM_DEVICE_H_ + diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp index 06a0ca299a..bdb2caede4 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp @@ -1,60 +1,53 @@ /* - * Davicom 9601 USB 1.1 Ethernet Driver. - * Copyright 2009 Adrien Destugues + * Davicom DM9601 USB 1.1 Ethernet Driver. + * Copyright (c) 2008, 2011 Siarzhuk Zharski + * Copyright (c) 2009 Adrien Destugues * Distributed under the terms of the MIT license. * - * Heavily based on code of - * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski - * Distributed under the terms of the MIT license. - * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. - * */ -#include -#include -#include -#ifdef HAIKU_TARGET_PLATFORM_HAIKU -#include // for mutex -#else -#include "BeOSCompatibility.h" // for pseudo mutex -#endif +#include "Driver.h" + +#include + +#include +#include #include "DavicomDevice.h" -#include "Driver.h" #include "Settings.h" + int32 api_version = B_CUR_DRIVER_API_VERSION; static const char *sDeviceBaseName = "net/usb_davicom/"; DavicomDevice *gDavicomDevices[MAX_DEVICES]; char *gDeviceNames[MAX_DEVICES + 1]; usb_module_info *gUSBModule = NULL; - -usb_support_descriptor gSupportedDevices[] = { - { 0, 0, 0, 0x0fe6, 0x8101}, // "Sunrising JP108" - { 0, 0, 0, 0x07aa, 0x9601}, // "Corega FEther USB-TXC" - { 0, 0, 0, 0x0a46, 0x9601}, // "Davicom USB-100" - { 0, 0, 0, 0x0a46, 0x6688}, // "ZT6688 USB NIC" - { 0, 0, 0, 0x0a46, 0x0268}, // "ShanTou ST268 USB NIC" - { 0, 0, 0, 0x0a46, 0x8515}, // "ADMtek ADM8515 USB NIC" - { 0, 0, 0, 0x0a47, 0x9601}, // "Hirose USB-100" - { 0, 0, 0, 0x0a46, 0x9000} // "DM9000E" -}; - mutex gDriverLock; -// auto-release helper class -class DriverSmartLock { -public: - DriverSmartLock() { mutex_lock(&gDriverLock); } - ~DriverSmartLock() { mutex_unlock(&gDriverLock); } + + +// IMPORTANT: keep entries sorted by ids to let the +// binary search lookup procedure work correctly !!! +DeviceInfo gSupportedDevices[] = { + { { { 0x01e1, 0x9601 } }, "Noname DM9601" }, + { { { 0x07aa, 0x9601 } }, "Corega FEther USB-TXC" }, + { { { 0x0a46, 0x0268 } }, "ShanTou ST268 USB NIC" }, + { { { 0x0a46, 0x6688 } }, "ZT6688 USB NIC" }, + { { { 0x0a46, 0x8515 } }, "ADMtek ADM8515 USB NIC" }, + { { { 0x0a46, 0x9000 } }, "DM9000E" }, + { { { 0x0a46, 0x9601 } }, "Davicom DM9601" }, + { { { 0x0a47, 0x9601 } }, "Hirose USB-100" }, + { { { 0x0fe6, 0x8101 } }, "Sunrising SR9600" }, + { { { 0x0fe6, 0x9700 } }, "Kontron DM9601" } }; + DavicomDevice * -create_davicom_device(usb_device device) +lookup_and_create_device(usb_device device) { const usb_device_descriptor *deviceDescriptor = gUSBModule->get_device_descriptor(device); @@ -64,18 +57,22 @@ create_davicom_device(usb_device device) return NULL; } -#define IDS(__vendor, __product) (((__vendor) << 16) | (__product)) + TRACE("trying %#06x:%#06x.\n", + deviceDescriptor->vendor_id, deviceDescriptor->product_id); - switch(IDS(deviceDescriptor->vendor_id, deviceDescriptor->product_id)) { - case IDS(0x0fe6, 0x8101): return new DavicomDevice(device, "Sunrising JP108"); - case IDS(0x07aa, 0x9601): return new DavicomDevice(device, "Corega FEther USB-TXC"); - case IDS(0x0a46, 0x9601): return new DavicomDevice(device, "Davicom USB-100"); - case IDS(0x0a46, 0x6688): return new DavicomDevice(device, "ZT6688 USB NIC"); - case IDS(0x0a46, 0x0268): return new DavicomDevice(device, "ShanTou ST268 USB NIC"); - case IDS(0x0a46, 0x8515): return new DavicomDevice(device, "ADMtek ADM8515 USB NIC"); - case IDS(0x0a47, 0x9601): return new DavicomDevice(device, "Hirose USB-100"); - case IDS(0x0a46, 0x9000): return new DavicomDevice(device, "DM9000E"); + // use binary search to lookup device in table + DeviceInfo::Id id = { { deviceDescriptor->vendor_id, + deviceDescriptor->product_id } }; + int left = -1; + int right = _countof(gSupportedDevices); + while((right - left) > 1) { + int i = (left + right) / 2; + ((gSupportedDevices[i].Key() < id.fKey) ? left : right) = i; } + + if(gSupportedDevices[right].Key() == id.fKey) + return new DavicomDevice(device, gSupportedDevices[right]); + return NULL; } @@ -85,7 +82,7 @@ usb_davicom_device_added(usb_device device, void **cookie) { *cookie = NULL; - DriverSmartLock driverLock; // released on exit + MutexLocker lock(gDriverLock); // released on exit // check if this is a replug of an existing device first for (int32 i = 0; i < MAX_DEVICES; i++) { @@ -101,7 +98,7 @@ usb_davicom_device_added(usb_device device, void **cookie) } // no such device yet, create a new one - DavicomDevice *davicomDevice = create_davicom_device(device); + DavicomDevice *davicomDevice = lookup_and_create_device(device); if (davicomDevice == 0) { return ENODEV; } @@ -140,7 +137,7 @@ usb_davicom_device_added(usb_device device, void **cookie) status_t usb_davicom_device_removed(void *cookie) { - DriverSmartLock driverLock; // released on exit + MutexLocker lock(gDriverLock); // released on exit DavicomDevice *device = (DavicomDevice *)cookie; for (int32 i = 0; i < MAX_DEVICES; i++) { @@ -161,7 +158,7 @@ usb_davicom_device_removed(void *cookie) } -//#pragma mark - +// #pragma mark - status_t @@ -180,9 +177,9 @@ init_driver() return status; load_settings(); - + TRACE_ALWAYS("%s\n", kVersion); - + for (int32 i = 0; i < MAX_DEVICES; i++) gDavicomDevices[i] = NULL; @@ -194,8 +191,15 @@ init_driver() &usb_davicom_device_removed }; - gUSBModule->register_driver(DRIVER_NAME, gSupportedDevices, - sizeof(gSupportedDevices) / sizeof(usb_support_descriptor), NULL); + const size_t count = _countof(gSupportedDevices); + static usb_support_descriptor sDescriptors[count] = {{ 0 }}; + + for(size_t i = 0; i < count; i++) { + sDescriptors[i].vendor = gSupportedDevices[i].VendorId(); + sDescriptors[i].product = gSupportedDevices[i].ProductId(); + } + + gUSBModule->register_driver(DRIVER_NAME, sDescriptors, count, NULL); gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks); return B_OK; } @@ -221,7 +225,7 @@ uninit_driver() mutex_destroy(&gDriverLock); put_module(B_USB_MODULE_NAME); - + release_settings(); } @@ -229,7 +233,7 @@ uninit_driver() static status_t usb_davicom_open(const char *name, uint32 flags, void **cookie) { - DriverSmartLock driverLock; // released on exit + MutexLocker lock(gDriverLock); // released on exit *cookie = NULL; status_t status = ENODEV; @@ -280,9 +284,9 @@ static status_t usb_davicom_free(void *cookie) { DavicomDevice *device = (DavicomDevice *)cookie; - - DriverSmartLock driverLock; // released on exit - + + MutexLocker lock(gDriverLock); // released on exit + status_t status = device->Free(); for (int32 i = 0; i < MAX_DEVICES; i++) { if (gDavicomDevices[i] == device) { @@ -307,8 +311,8 @@ publish_devices() gDeviceNames[i] = NULL; } - DriverSmartLock driverLock; // released on exit - + MutexLocker lock(gDriverLock); // released on exit + int32 deviceCount = 0; for (int32 i = 0; i < MAX_DEVICES; i++) { if (gDavicomDevices[i] == NULL) @@ -320,7 +324,7 @@ publish_devices() TRACE("publishing %s\n", gDeviceNames[deviceCount]); deviceCount++; } else - TRACE_ALWAYS("Error: out of memory during allocating device name.\n"); + TRACE_ALWAYS("Error: out of memory during allocating dev.name.\n"); } gDeviceNames[deviceCount] = NULL; @@ -338,8 +342,8 @@ find_device(const char *name) usb_davicom_control, usb_davicom_read, usb_davicom_write, - NULL, /* select */ - NULL /* deselect */ + NULL, // select + NULL // deselect }; return &deviceHooks; diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.h b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.h index 2a7bb3cfa1..0b4be0213e 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.h +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.h @@ -1,44 +1,35 @@ /* - * Davicom 9601 USB 1.1 Ethernet Driver. - * Copyright 2009 Adrien Destugues + * Davicom DM9601 USB 1.1 Ethernet Driver. + * Copyright (c) 2008, 2011 Siarzhuk Zharski + * Copyright (c) 2009 Adrien Destugues * Distributed under the terms of the MIT license. * - * Heavily based on code of : - * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski - * Distributed under the terms of the MIT license. - * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. - * */ - #ifndef _USB_DAVICOM_DRIVER_H_ #define _USB_DAVICOM_DRIVER_H_ -#include -#include + #include #include -#include -#include -#include -#include -#include -#include + +// extra tracing in debug mode +//#define UDAV_TRACE #define DRIVER_NAME "usb_davicom" #define MAX_DEVICES 8 -const uint8 kInvalidRequest = 0xff; - -const char* const kVersion = "ver.0.8.3"; +const char* const kVersion = "ver.0.9.4"; extern usb_module_info *gUSBModule; + extern "C" { + status_t usb_davicom_device_added(usb_device device, void **cookie); status_t usb_davicom_device_removed(void *cookie); @@ -47,8 +38,9 @@ void uninit_driver(); const char **publish_devices(); device_hooks *find_device(const char *name); + } -#endif //_USB_DAVICOM_DRIVER_H_ +#endif // _USB_DAVICOM_DRIVER_H_ diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Jamfile b/src/add-ons/kernel/drivers/network/usb_davicom/Jamfile index 8f06287b7d..486a067296 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Jamfile +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Jamfile @@ -3,6 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers network usb_davicom ; SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders kernel net ; +UsePrivateKernelHeaders ; KernelAddon usb_davicom : Driver.cpp diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp index 311653d86a..028843f1cc 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp @@ -1,32 +1,38 @@ /* - * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Davicom DM9601 USB 1.1 Ethernet Driver. + * Copyright (c) 2008, 2011 Siarzhuk Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the - * Driver for USB Ethernet Control Model devices - * Copyright (C) 2008 Michael Lotz - * Distributed under the terms of the MIT license. - * */ -#include // for mutex #include "Settings.h" +#include +#include +#include + +#include +#include + +#include "Driver.h" + + +mutex gLogLock; +static char *gLogFilePath = NULL; + bool gTraceOn = false; bool gTruncateLogFile = false; bool gAddTimeStamp = true; bool gTraceState = false; bool gTraceRX = false; bool gTraceTX = false; -static char *gLogFilePath = NULL; -mutex gLogLock; +bool gTraceStats = false; -static + +static void create_log() { - if(gLogFilePath == NULL) + if (gLogFilePath == NULL) return; int flags = O_WRONLY | O_CREAT | ((gTruncateLogFile) ? O_TRUNC : 0); @@ -35,23 +41,28 @@ void create_log() mutex_init(&gLogLock, DRIVER_NAME"-logging"); } -void load_settings() + +void +load_settings() { void *handle = load_driver_settings(DRIVER_NAME); - if(handle == 0) + if (handle == 0) return; gTraceOn = get_driver_boolean_parameter(handle, "trace", gTraceOn, true); - gTraceState = get_driver_boolean_parameter(handle, "trace_state", gTraceState, true); + gTraceState = get_driver_boolean_parameter(handle, + "trace_state", gTraceState, true); gTraceRX = get_driver_boolean_parameter(handle, "trace_rx", gTraceRX, true); gTraceTX = get_driver_boolean_parameter(handle, "trace_tx", gTraceTX, true); - gTruncateLogFile = get_driver_boolean_parameter(handle, "truncate_logfile", - gTruncateLogFile, true); - gAddTimeStamp = get_driver_boolean_parameter(handle, "add_timestamp", - gAddTimeStamp, true); - const char * logFilePath = get_driver_parameter(handle, "logfile", - NULL, "/var/log/"DRIVER_NAME".log"); - if(logFilePath != NULL) { + gTraceStats = get_driver_boolean_parameter(handle, + "trace_stats", gTraceStats, true); + gTruncateLogFile = get_driver_boolean_parameter(handle, + "reset_logfile", gTruncateLogFile, true); + gAddTimeStamp = get_driver_boolean_parameter(handle, + "add_timestamp", gAddTimeStamp, true); + const char * logFilePath = get_driver_parameter(handle, + "logfile", NULL, "/var/log/"DRIVER_NAME".log"); + if (logFilePath != NULL) { gLogFilePath = strdup(logFilePath); } @@ -60,39 +71,42 @@ void load_settings() create_log(); } -void release_settings() + +void +release_settings() { - if(gLogFilePath != NULL) { + if (gLogFilePath != NULL) { mutex_destroy(&gLogLock); free(gLogFilePath); } } + void usb_davicom_trace(bool force, const char* func, const char *fmt, ...) { - if(!(force || gTraceOn)) { -// return; + if (!(force || gTraceOn)) { + return; } va_list arg_list; static const char *prefix = "\33[33m"DRIVER_NAME":\33[0m"; static char buffer[1024]; char *buf_ptr = buffer; - if(gLogFilePath == NULL){ + if (gLogFilePath == NULL) { strcpy(buffer, prefix); buf_ptr += strlen(prefix); } - - if(gAddTimeStamp) { - bigtime_t time = system_time(); - uint32 msec = time / 1000; - uint32 sec = msec / 1000; - sprintf(buf_ptr, "%02ld.%02ld.%03ld:", - sec / 60, sec % 60, msec % 1000); - buf_ptr += strlen(buf_ptr); - } - if(func != NULL) { + if (gAddTimeStamp) { + bigtime_t time = system_time(); + uint32 msec = time / 1000; + uint32 sec = msec / 1000; + sprintf(buf_ptr, "%02ld.%02ld.%03ld:", + sec / 60, sec % 60, msec % 1000); + buf_ptr += strlen(buf_ptr); + } + + if (func != NULL) { sprintf(buf_ptr, "%s::", func); buf_ptr += strlen(buf_ptr); } @@ -101,7 +115,7 @@ void usb_davicom_trace(bool force, const char* func, const char *fmt, ...) vsprintf(buf_ptr, fmt, arg_list); va_end(arg_list); - if(gLogFilePath == NULL) { + if (gLogFilePath == NULL) { dprintf(buffer); return; } diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.h b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.h index a4a456d258..b3e2531b7c 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.h +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.h @@ -1,40 +1,48 @@ /* - * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Davicom DM9601 USB 1.1 Ethernet Driver. + * Copyright (c) 2008, 2011 Siarzhuk Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the - * Driver for USB Ethernet Control Model devices - * Copyright (C) 2008 Michael Lotz - * Distributed under the terms of the MIT license. - * */ +#ifndef _USB_DAVICOM_SETTINGS_H_ +#define _USB_DAVICOM_SETTINGS_H_ -#ifndef _USB_DAVICOM_SETTINGS_H_ - #define _USB_DAVICOM_SETTINGS_H_ -#include +#ifdef _countof +#warning "_countof(...) WAS ALREADY DEFINED!!! Remove local definition!" +#undef _countof +#endif +#define _countof(array)(sizeof(array) / sizeof(array[0])) -#include "Driver.h" void load_settings(); void release_settings(); - void usb_davicom_trace(bool force, const char *func, const char *fmt, ...); + #define TRACE(x...) usb_davicom_trace(false, __func__, x) #define TRACE_ALWAYS(x...) usb_davicom_trace(true, __func__, x) + +#ifdef UDAV_TRACE + extern bool gTraceState; -#define TRACE_STATE(x...) usb_davicom_trace(gTraceState, NULL, x) - extern bool gTraceRX; -#define TRACE_RX(x...) usb_davicom_trace(gTraceRX, NULL, x) - extern bool gTraceTX; +extern bool gTraceStats; +#define TRACE_STATE(x...) usb_davicom_trace(gTraceState, NULL, x) +#define TRACE_STATS(x...) usb_davicom_trace(gTraceStats, NULL, x) +#define TRACE_RX(x...) usb_davicom_trace(gTraceRX, NULL, x) #define TRACE_TX(x...) usb_davicom_trace(gTraceTX, NULL, x) -#define TRACE_RET(result) usb_davicom_trace(false, __func__, \ - "Returns:%#010x\n", result); +#else + +#define TRACE_STATE(x...) +#define TRACE_STATS(x...) +#define TRACE_RX(x...) +#define TRACE_TX(x...) + +#endif + + +#endif // _USB_DAVICOM_SETTINGS_H_ -#endif /*_USB_DAVICOM_SETTINGS_H_*/ diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/usb_davicom.settings b/src/add-ons/kernel/drivers/network/usb_davicom/usb_davicom.settings index 9399a7af5d..8953617ec7 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/usb_davicom.settings +++ b/src/add-ons/kernel/drivers/network/usb_davicom/usb_davicom.settings @@ -1,25 +1,25 @@ ## -## ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. -## Copyright (c) 2008 S.Zharski +## Davicom DM9601 USB 1.1 Ethernet Driver. +## Copyright (c) 2008, 2011 Siarzhuk Zharski ## Distributed under the terms of the MIT license. ## ## trace [on|off] - activate additional tracing. ## default value: off -trace on +# trace on ## logfile [full path to private log file] ## default path value: /var/log/usb_davicom.log ## if disabled - all output goes to syslog -logfile /var/log/usb_davicom.log +# logfile /var/log/usb_davicom.log ## reset_logfile [on|off] - truncate private log file on driver/system restart ## default value: off ## -reset_logfile on +# reset_logfile on ## add_timestamp [on|off] - add time of writing the string in private log file. @@ -28,6 +28,12 @@ reset_logfile on # add_timestamp off +########################################################################### +## +## Following settings are usable only with special version of the driver +## compiled with UDAV_TRACE defined. Look into Driver.h for details. +## + ## trace_state [on|off] - activate state tracing. Statistic about of ## media state. ## default value: off @@ -45,3 +51,10 @@ reset_logfile on ## default value: off # trace_tx on + +## trace_stats [on|off] - activate tx/rx error counters tracing. +## +## default value: off + +# trace_stats on + From 8f789932e88f9090a15e0b407c6eb6c20fe78186 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Mon, 12 Sep 2011 20:34:19 +0000 Subject: [PATCH 292/702] usb_davicom was fixed. Add it to image. Great thanks to Diver for his patiense and assistance during two-weeks long testing and driver refactoring! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42750 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index c18ada62be..90b9eee20a 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -174,7 +174,7 @@ SYSTEM_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)atheros813x $(X86_ONLY)ipro100 $(X86_ONLY)ipro1000 $(X86_ONLY)jmicron2x0 $(X86_ONLY)marvell_yukon $(X86_ONLY)nforce $(X86_ONLY)pcnet pegasus $(X86_ONLY)rtl8139 $(X86_ONLY)rtl81xx sis900 - $(X86_ONLY)syskonnect usb_asix usb_ecm $(X86_ONLY)via_rhine + $(X86_ONLY)syskonnect usb_davicom usb_asix usb_ecm $(X86_ONLY)via_rhine $(X86_ONLY)vt612x wb840 # WLAN drivers From 54c0390b901eb0606bc6c0b46fb0e0c6530f4eda Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 14 Sep 2011 15:40:30 +0000 Subject: [PATCH 293/702] * remove un-needed i2c_bus on each connector... we simply set this up each time it's needed using the gpio information * rename gpio information struct to be cleaner and shorter * add function to debug found connectors * set gpio mask to 1 vs the defined mask... this seems to get us closer to working ddc / edid per connector * change gpio_info u16's to u32's to ensure we aren't overflowing anything * fix bug always setting hw_capable true * change TRACE to ERROR to always show debug data when called git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42751 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 4 +- .../accelerants/radeon_hd/accelerant.h | 39 +++-- src/add-ons/accelerants/radeon_hd/display.cpp | 31 +++- src/add-ons/accelerants/radeon_hd/display.h | 1 + src/add-ons/accelerants/radeon_hd/gpu.cpp | 143 ++++++++++-------- src/add-ons/accelerants/radeon_hd/gpu.h | 2 +- 6 files changed, 125 insertions(+), 95 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index ea58efe9d5..2114052968 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -245,15 +245,15 @@ radeon_init_accelerant(int device) status = detect_connectors(); if (status != B_OK) { - // TODO : detect_connectors_manual to get from object table TRACE("%s: couldn't detect supported connectors!\n", __func__); return status; } + debug_connectors(); + status = detect_displays(); //if (status != B_OK) // return status; - debug_displays(); status = create_mode_list(); diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 201a399154..4ee3fd3bec 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -138,31 +138,31 @@ struct pll_info { }; -struct ddc_info { +struct gpio_info { bool valid; bool hw_capable; - uint8 gpio_id; + uint8 pin; - uint16 mask_scl_reg; - uint16 mask_sda_reg; - uint16 mask_scl_mask; - uint16 mask_sda_mask; + uint32 mask_scl_reg; + uint32 mask_sda_reg; + uint32 mask_scl_mask; + uint32 mask_sda_mask; - uint16 gpio_en_scl_reg; - uint16 gpio_en_sda_reg; - uint16 gpio_en_scl_mask; - uint16 gpio_en_sda_mask; + uint32 en_scl_reg; + uint32 en_sda_reg; + uint32 en_scl_mask; + uint32 en_sda_mask; - uint16 gpio_y_scl_reg; - uint16 gpio_y_sda_reg; - uint16 gpio_y_scl_mask; - uint16 gpio_y_sda_mask; + uint32 y_scl_reg; + uint32 y_sda_reg; + uint32 y_scl_mask; + uint32 y_sda_mask; - uint16 gpio_a_scl_reg; - uint16 gpio_a_sda_reg; - uint16 gpio_a_scl_mask; - uint16 gpio_a_sda_mask; + uint32 a_scl_reg; + uint32 a_sda_reg; + uint32 a_scl_mask; + uint32 a_sda_mask; }; @@ -172,10 +172,9 @@ typedef struct { uint16 connector_flags; uint32 connector_type; uint16 connector_object_id; + gpio_info connector_gpio; uint32 encoder_type; uint16 encoder_object_id; - ddc_info connector_ddc_info; - i2c_bus connector_i2c; // TODO struct radeon_hpd hpd; } connector_info; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 7d12624c1d..c9f336bfd8 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -653,7 +653,7 @@ debug_displays() { TRACE("Currently detected monitors===============\n"); for (uint32 id = 0; id < MAX_DISPLAY; id++) { - TRACE("Display #%" B_PRIu32 " active = %s\n", + ERROR("Display #%" B_PRIu32 " active = %s\n", id, gDisplay[id]->active ? "true" : "false"); uint32 connector_index = gDisplay[id]->connector_index; @@ -661,12 +661,12 @@ debug_displays() if (gDisplay[id]->active) { uint32 connector_type = gConnector[connector_index]->connector_type; uint32 encoder_type = gConnector[connector_index]->encoder_type; - TRACE(" + connector: %s\n", get_connector_name(connector_type)); - TRACE(" + encoder: %s\n", get_encoder_name(encoder_type)); + ERROR(" + connector: %s\n", get_connector_name(connector_type)); + ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); - TRACE(" + limits: Vert Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", + ERROR(" + limits: Vert Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", gDisplay[id]->vfreq_min, gDisplay[id]->vfreq_max); - TRACE(" + limits: Horz Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", + ERROR(" + limits: Horz Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", gDisplay[id]->hfreq_min, gDisplay[id]->hfreq_max); } } @@ -675,6 +675,27 @@ debug_displays() } +void +debug_connectors() +{ + ERROR("Currently detected connectors=============\n"); + for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { + if (gConnector[id]->valid == true) { + uint32 connector_type = gConnector[id]->connector_type; + uint32 encoder_type = gConnector[id]->encoder_type; + ERROR("Connector #%" B_PRIu32 ")\n", id); + ERROR(" + connector: %s\n", get_connector_name(connector_type)); + ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); + ERROR(" + gpio valid: %s\n", + (gConnector[id]->connector_gpio.valid) ? "true" : "false"); + ERROR(" + gpio pin: 0x%" B_PRIX8 "\n", + gConnector[id]->connector_gpio.pin); + } + } + ERROR("==========================================\n"); +} + + uint32 display_get_encoder_mode(uint32 connector_index) { diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 064419359a..d0fa8b0daf 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -63,6 +63,7 @@ status_t detect_connectors(); status_t detect_crt_ranges(uint32 crtid); status_t detect_displays(); void debug_displays(); +void debug_connectors(); uint32 display_get_encoder_mode(uint32 connector_index); void display_crtc_lock(uint8 crtc_id, int command); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index aec0830548..af1e9a053d 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -280,7 +280,7 @@ radeon_gpu_irq_setup() static void lock_i2c(void* cookie, bool lock) { - ddc_info *info = (ddc_info*)cookie; + gpio_info *info = (gpio_info*)cookie; uint32 buffer = 0; @@ -292,49 +292,59 @@ lock_i2c(void* cookie, bool lock) } // Clear pins - buffer = Read32(OUT, info->gpio_a_scl_reg) & ~info->gpio_a_scl_mask; - Write32(OUT, info->gpio_a_scl_reg, buffer); - buffer = Read32(OUT, info->gpio_a_sda_reg) & ~info->gpio_a_sda_mask; - Write32(OUT, info->gpio_a_sda_reg, buffer); + buffer = Read32(OUT, info->a_scl_reg) & ~info->a_scl_mask; + Write32(OUT, info->a_scl_reg, buffer); + buffer = Read32(OUT, info->a_sda_reg) & ~info->a_sda_mask; + Write32(OUT, info->a_sda_reg, buffer); // Set pins to input - buffer = Read32(OUT, info->gpio_en_scl_reg) & ~info->gpio_en_scl_mask; - Write32(OUT, info->gpio_en_scl_reg, buffer); - buffer = Read32(OUT, info->gpio_en_sda_reg) & ~info->gpio_en_sda_mask; - Write32(OUT, info->gpio_en_sda_reg, buffer); + buffer = Read32(OUT, info->en_scl_reg) & ~info->en_scl_mask; + Write32(OUT, info->en_scl_reg, buffer); + buffer = Read32(OUT, info->en_sda_reg) & ~info->en_sda_mask; + Write32(OUT, info->en_sda_reg, buffer); // mask GPIO pins for software use - buffer = Read32(OUT, info->mask_scl_reg); - if (lock == true) - buffer |= info->mask_scl_mask; - else - buffer &= ~info->mask_scl_mask; + // TODO : we should use the mask... but it doesn't work for some reason + // buffer = Read32(OUT, info->mask_scl_reg); + if (lock == true) { + buffer = 1; + //buffer |= info->mask_scl_mask; + } else { + buffer = 0; + //buffer &= ~info->mask_scl_mask; + } + Write32(OUT, info->mask_scl_reg, buffer); Read32(OUT, info->mask_scl_reg); buffer = Read32(OUT, info->mask_sda_reg); - if (lock == true) - buffer |= info->mask_sda_mask; - else - buffer &= ~info->mask_sda_mask; + if (lock == true) { + buffer = 1; + // buffer |= info->mask_sda_mask; + } else { + buffer = 0; + // buffer &= ~info->mask_sda_mask; + } + Write32(OUT, info->mask_sda_reg, buffer); Read32(OUT, info->mask_sda_reg); + } static status_t get_i2c_signals(void* cookie, int* _clock, int* _data) { - ddc_info *info = (ddc_info*)cookie; + gpio_info *info = (gpio_info*)cookie; - uint32 scl = Read32(OUT, info->gpio_y_scl_reg) & info->gpio_y_scl_mask; - uint32 sda = Read32(OUT, info->gpio_y_sda_reg) & info->gpio_y_sda_mask; + uint32 scl = Read32(OUT, info->y_scl_reg) & info->y_scl_mask; + uint32 sda = Read32(OUT, info->y_sda_reg) & info->y_sda_mask; *_clock = (scl != 0); *_data = (sda != 0); - TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", - __func__, info->gpio_id, *_clock, *_data); + //TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", + // __func__, info->pin, *_clock, *_data); return B_OK; } @@ -343,21 +353,21 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) static status_t set_i2c_signals(void* cookie, int clock, int data) { - ddc_info* info = (ddc_info*)cookie; + gpio_info* info = (gpio_info*)cookie; - uint32 scl = Read32(OUT, info->gpio_en_scl_reg) - & ~info->gpio_en_scl_mask; - uint32 sda = Read32(OUT, info->gpio_en_sda_reg) - & ~info->gpio_en_sda_mask; + uint32 scl = Read32(OUT, info->en_scl_reg) + & ~info->en_scl_mask; + uint32 sda = Read32(OUT, info->en_sda_reg) + & ~info->en_sda_mask; - scl |= clock ? 0 : info->gpio_en_scl_mask; - sda |= data ? 0 : info->gpio_en_sda_mask; + scl |= clock ? 0 : info->en_scl_mask; + sda |= data ? 0 : info->en_sda_mask; - Write32(OUT, info->gpio_a_scl_reg, clock); - Write32(OUT, info->gpio_a_sda_reg, data); + Write32(OUT, info->a_scl_reg, clock); + Write32(OUT, info->a_sda_reg, data); - TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", - __func__, info->gpio_id, clock, data); + //TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", + // __func__, info->pin, clock, data); return B_OK; } @@ -367,14 +377,13 @@ bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid) { // ensure things are sane - if (gConnector[connector]->connector_ddc_info.valid == false - || gConnector[connector]->connector_ddc_info.gpio_id == 0) + if (gConnector[connector]->connector_gpio.valid == false) return false; i2c_bus bus; ddc2_init_timing(&bus); - bus.cookie = (void*)&gConnector[connector]->connector_ddc_info; + bus.cookie = (void*)&gConnector[connector]->connector_gpio; bus.set_signals = &set_i2c_signals; bus.get_signals = &get_i2c_signals; @@ -393,11 +402,11 @@ radeon_gpu_read_edid(uint32 connector, edid1_info *edid) status_t -radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) +radeon_gpu_i2c_setup(uint32 id, uint8 gpio_pin) { // aka radeon_lookup_i2c_gpio TRACE("%s: Path #%" B_PRId32 ": GPIO Pin 0x%" B_PRIx8 "\n", __func__, - connector, gpio_id); + id, gpio_pin); int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); uint8 frev; @@ -409,7 +418,7 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) &offset) != B_OK) { ERROR("%s: could't read GPIO_I2C_Info table from AtomBIOS index %d!\n", __func__, index); - gConnector[connector]->connector_ddc_info.valid = false; + gConnector[id]->connector_gpio.valid = false; return B_ERROR; } @@ -425,65 +434,65 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id) // TODO : if DCE 4 and i == 7 ... manual override for evergreen // TODO : if DCE 3 and i == 4 ... manual override - if (gpio->sucI2cId.ucAccess != gpio_id) + if (gpio->sucI2cId.ucAccess != gpio_pin) continue; - // successful lookup - TRACE("%s: successful AtomBIOS GPIO lookup\n", __func__); - // populate gpio information - gConnector[connector]->connector_ddc_info.valid = true; - // TODO : what is hw_capable? - if (gpio->sucI2cId.sbfAccess.bfHW_Capable) - gConnector[connector]->connector_ddc_info.hw_capable = true; - else - gConnector[connector]->connector_ddc_info.hw_capable = true; + gConnector[id]->connector_gpio.hw_capable + = (gpio->sucI2cId.sbfAccess.bfHW_Capable) ? true : false; - gConnector[connector]->connector_ddc_info.gpio_id = gpio_id; + gConnector[id]->connector_gpio.pin = gpio_pin; // GPIO mask (Allows software to control the GPIO pad) // 0 = chip access; 1 = only software; - gConnector[connector]->connector_ddc_info.mask_scl_reg + gConnector[id]->connector_gpio.mask_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.mask_sda_reg + gConnector[id]->connector_gpio.mask_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataMaskRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.mask_scl_mask + gConnector[id]->connector_gpio.mask_scl_mask = (1 << gpio->ucClkMaskShift); - gConnector[connector]->connector_ddc_info.mask_sda_mask + gConnector[id]->connector_gpio.mask_sda_mask = (1 << gpio->ucDataMaskShift); // GPIO output / write (A) enable // 0 = GPIO input (Y); 1 = GPIO output (A); - gConnector[connector]->connector_ddc_info.gpio_en_scl_reg + gConnector[id]->connector_gpio.en_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_en_sda_reg + gConnector[id]->connector_gpio.en_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataEnRegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_en_scl_mask + gConnector[id]->connector_gpio.en_scl_mask = (1 << gpio->ucClkEnShift); - gConnector[connector]->connector_ddc_info.gpio_en_sda_mask + gConnector[id]->connector_gpio.en_sda_mask = (1 << gpio->ucDataEnShift); // GPIO output / write (A) - gConnector[connector]->connector_ddc_info.gpio_a_scl_reg + gConnector[id]->connector_gpio.a_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_a_sda_reg + gConnector[id]->connector_gpio.a_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_a_scl_mask + gConnector[id]->connector_gpio.a_scl_mask = (1 << gpio->ucClkA_Shift); - gConnector[connector]->connector_ddc_info.gpio_a_sda_mask + gConnector[id]->connector_gpio.a_sda_mask = (1 << gpio->ucDataA_Shift); // GPIO input / read (Y) - gConnector[connector]->connector_ddc_info.gpio_y_scl_reg + gConnector[id]->connector_gpio.y_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_y_sda_reg + gConnector[id]->connector_gpio.y_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) * 4; - gConnector[connector]->connector_ddc_info.gpio_y_scl_mask + gConnector[id]->connector_gpio.y_scl_mask = (1 << gpio->ucClkY_Shift); - gConnector[connector]->connector_ddc_info.gpio_y_sda_mask + gConnector[id]->connector_gpio.y_sda_mask = (1 << gpio->ucDataY_Shift); + // ensure data is valid + gConnector[id]->connector_gpio.valid + = (gConnector[id]->connector_gpio.mask_scl_reg) ? true : false; + + // see if we found what we were looking for + if (gConnector[id]->connector_gpio.valid == true) + break; } return B_OK; diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index ff0094f315..e79ee9fe55 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -169,7 +169,7 @@ uint32 radeon_gpu_mc_idlecheck(); status_t radeon_gpu_mc_setup(); status_t radeon_gpu_irq_setup(); bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid); -status_t radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id); +status_t radeon_gpu_i2c_setup(uint32 id, uint8 gpio_id); #endif From b1312c5c6476d30d8b52cd5e7030c9a6e2376359 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Wed, 14 Sep 2011 18:11:04 +0000 Subject: [PATCH 294/702] Updating vt612x and jmicron2x0 drivers to FreeBSD Release 8.2 sources. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42754 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/network/Jamfile | 6 +- .../network/jmicron2x0/dev/jme/if_jme.c | 100 +- .../network/jmicron2x0/dev/jme/if_jmereg.h | 6 +- .../network/jmicron2x0/dev/jme/if_jmevar.h | 2 +- .../network/jmicron2x0/dev/mii/jmphy.c | 70 +- .../network/jmicron2x0/dev/mii/jmphyreg.h | 2 +- .../drivers/network/vt612x/dev/mii/ciphy.c | 173 +- .../drivers/network/vt612x/dev/mii/ciphyreg.h | 12 +- .../drivers/network/vt612x/dev/mii/ukphy.c | 46 +- .../network/vt612x/dev/mii/ukphy_subr.c | 26 +- .../drivers/network/vt612x/dev/vge/Jamfile | 1 + .../drivers/network/vt612x/dev/vge/glue.c | 30 + .../drivers/network/vt612x/dev/vge/if_vge.c | 2776 ++++++++++------- .../network/vt612x/dev/vge/if_vgereg.h | 121 +- .../network/vt612x/dev/vge/if_vgevar.h | 220 +- 15 files changed, 2081 insertions(+), 1510 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/Jamfile b/src/add-ons/kernel/drivers/network/Jamfile index 5bd657ea13..88f48f92e8 100644 --- a/src/add-ons/kernel/drivers/network/Jamfile +++ b/src/add-ons/kernel/drivers/network/Jamfile @@ -14,7 +14,6 @@ SubInclude HAIKU_TOP src add-ons kernel drivers network wb840 ; # FreeBSD 7 drivers SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom440x ; SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom570x ; -SubInclude HAIKU_TOP src add-ons kernel drivers network jmicron2x0 ; SubInclude HAIKU_TOP src add-ons kernel drivers network marvell_yukon ; SubInclude HAIKU_TOP src add-ons kernel drivers network nforce ; SubInclude HAIKU_TOP src add-ons kernel drivers network pcnet ; @@ -23,7 +22,6 @@ SubInclude HAIKU_TOP src add-ons kernel drivers network attansic_l1 ; SubInclude HAIKU_TOP src add-ons kernel drivers network attansic_l2 ; SubInclude HAIKU_TOP src add-ons kernel drivers network ar81xx ; SubInclude HAIKU_TOP src add-ons kernel drivers network rtl81xx ; -SubInclude HAIKU_TOP src add-ons kernel drivers network vt612x ; SubIncludeGPL HAIKU_TOP src add-ons kernel drivers network bcm440x ; SubIncludeGPL HAIKU_TOP src add-ons kernel drivers network bcm570x ; @@ -31,10 +29,12 @@ SubIncludeGPL HAIKU_TOP src add-ons kernel drivers network bcm570x ; # FreeBSD 8 drivers SubInclude HAIKU_TOP src add-ons kernel drivers network 3com ; SubInclude HAIKU_TOP src add-ons kernel drivers network atheros813x ; +SubInclude HAIKU_TOP src add-ons kernel drivers network dec21xxx ; SubInclude HAIKU_TOP src add-ons kernel drivers network ipro100 ; SubInclude HAIKU_TOP src add-ons kernel drivers network ipro1000 ; -SubInclude HAIKU_TOP src add-ons kernel drivers network dec21xxx ; +SubInclude HAIKU_TOP src add-ons kernel drivers network jmicron2x0 ; SubInclude HAIKU_TOP src add-ons kernel drivers network rtl8139 ; +SubInclude HAIKU_TOP src add-ons kernel drivers network vt612x ; SubInclude HAIKU_TOP src add-ons kernel drivers network wlan ; SubInclude HAIKU_TOP src add-ons kernel drivers network wwan ; diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jme.c b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jme.c index 36f457bfd1..b9cd8b3360 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jme.c +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jme.c @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/jme/if_jme.c,v 1.10 2008/12/04 02:16:53 yongari Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/jme/if_jme.c,v 1.11.2.8.2.1 2010/12/21 17:09:25 kensmith Exp $"); #include #include @@ -201,13 +201,6 @@ static struct resource_spec jme_irq_spec_legacy[] = { static struct resource_spec jme_irq_spec_msi[] = { { SYS_RES_IRQ, 1, RF_ACTIVE }, - { SYS_RES_IRQ, 2, RF_ACTIVE }, - { SYS_RES_IRQ, 3, RF_ACTIVE }, - { SYS_RES_IRQ, 4, RF_ACTIVE }, - { SYS_RES_IRQ, 5, RF_ACTIVE }, - { SYS_RES_IRQ, 6, RF_ACTIVE }, - { SYS_RES_IRQ, 7, RF_ACTIVE }, - { SYS_RES_IRQ, 8, RF_ACTIVE }, { -1, 0, 0 } }; @@ -224,13 +217,8 @@ jme_miibus_readreg(device_t dev, int phy, int reg) sc = device_get_softc(dev); /* For FPGA version, PHY address 0 should be ignored. */ - if ((sc->jme_flags & JME_FLAG_FPGA) != 0) { - if (phy == 0) - return (0); - } else { - if (sc->jme_phyaddr != phy) - return (0); - } + if ((sc->jme_flags & JME_FLAG_FPGA) != 0 && phy == 0) + return (0); CSR_WRITE_4(sc, JME_SMI, SMI_OP_READ | SMI_OP_EXECUTE | SMI_PHY_ADDR(phy) | SMI_REG_ADDR(reg)); @@ -260,13 +248,8 @@ jme_miibus_writereg(device_t dev, int phy, int reg, int val) sc = device_get_softc(dev); /* For FPGA version, PHY address 0 should be ignored. */ - if ((sc->jme_flags & JME_FLAG_FPGA) != 0) { - if (phy == 0) - return (0); - } else { - if (sc->jme_phyaddr != phy) - return (0); - } + if ((sc->jme_flags & JME_FLAG_FPGA) != 0 && phy == 0) + return (0); CSR_WRITE_4(sc, JME_SMI, SMI_OP_WRITE | SMI_OP_EXECUTE | ((val << SMI_DATA_SHIFT) & SMI_DATA_MASK) | @@ -306,6 +289,10 @@ jme_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) sc = ifp->if_softc; JME_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + JME_UNLOCK(sc); + return; + } mii = device_get_softc(sc->jme_miibus); mii_pollstat(mii); @@ -461,7 +448,7 @@ jme_reg_macaddr(struct jme_softc *sc) "generating fake ethernet address.\n"); par0 = arc4random(); /* Set OUI to JMicron. */ - sc->jme_eaddr[0] = 0x00; + sc->jme_eaddr[0] = 0x02; /* U/L bit set. */ sc->jme_eaddr[1] = 0x1B; sc->jme_eaddr[2] = 0x8C; sc->jme_eaddr[3] = (par0 >> 16) & 0xff; @@ -592,11 +579,16 @@ jme_attach(device_t dev) device_printf(dev, "MSI count : %d\n", msic); } + /* Use 1 MSI/MSI-X. */ + if (msixc > 1) + msixc = 1; + if (msic > 1) + msic = 1; /* Prefer MSIX over MSI. */ if (msix_disable == 0 || msi_disable == 0) { - if (msix_disable == 0 && msixc == JME_MSIX_MESSAGES && + if (msix_disable == 0 && msixc > 0 && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == JME_MSIX_MESSAGES) { + if (msixc == 1) { device_printf(dev, "Using %d MSIX messages.\n", msixc); sc->jme_flags |= JME_FLAG_MSIX; @@ -605,9 +597,8 @@ jme_attach(device_t dev) pci_release_msi(dev); } if (msi_disable == 0 && (sc->jme_flags & JME_FLAG_MSIX) == 0 && - msic == JME_MSI_MESSAGES && - pci_alloc_msi(dev, &msic) == 0) { - if (msic == JME_MSI_MESSAGES) { + msic > 0 && pci_alloc_msi(dev, &msic) == 0) { + if (msic == 1) { device_printf(dev, "Using %d MSI messages.\n", msic); sc->jme_flags |= JME_FLAG_MSI; @@ -747,9 +738,11 @@ jme_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->jme_miibus, jme_mediachange, - jme_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->jme_miibus, ifp, jme_mediachange, + jme_mediastatus, BMSR_DEFCAPMASK, sc->jme_phyaddr, MII_OFFSET_ANY, + MIIF_DOPAUSE); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -779,7 +772,7 @@ jme_attach(device_t dev) /* VLAN capability setup */ ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | - IFCAP_VLAN_HWCSUM; + IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO; ifp->if_capenable = ifp->if_capabilities; /* Tell the upper layer(s) we support long frames. */ @@ -798,13 +791,7 @@ jme_attach(device_t dev) taskqueue_start_threads(&sc->jme_tq, 1, PI_NET, "%s taskq", device_get_nameunit(sc->jme_dev)); - if ((sc->jme_flags & JME_FLAG_MSIX) != 0) - msic = JME_MSIX_MESSAGES; - else if ((sc->jme_flags & JME_FLAG_MSI) != 0) - msic = JME_MSI_MESSAGES; - else - msic = 1; - for (i = 0; i < msic; i++) { + for (i = 0; i < 1; i++) { error = bus_setup_intr(dev, sc->jme_irq[i], INTR_TYPE_NET | INTR_MPSAFE, jme_intr, NULL, sc, &sc->jme_intrhand[i]); @@ -832,7 +819,7 @@ jme_detach(device_t dev) { struct jme_softc *sc; struct ifnet *ifp; - int i, msic; + int i; sc = device_get_softc(dev); @@ -867,14 +854,7 @@ jme_detach(device_t dev) sc->jme_ifp = NULL; } - msic = 1; - if ((sc->jme_flags & JME_FLAG_MSIX) != 0) - msic = JME_MSIX_MESSAGES; - else if ((sc->jme_flags & JME_FLAG_MSI) != 0) - msic = JME_MSI_MESSAGES; - else - msic = 1; - for (i = 0; i < msic; i++) { + for (i = 0; i < 1; i++) { if (sc->jme_intrhand[i] != NULL) { bus_teardown_intr(dev, sc->jme_irq[i], sc->jme_intrhand[i]); @@ -1585,8 +1565,10 @@ jme_resume(device_t dev) pmc + PCIR_POWER_STATUS, pmstat, 2); } ifp = sc->jme_ifp; - if ((ifp->if_flags & IFF_UP) != 0) + if ((ifp->if_flags & IFF_UP) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; jme_init_locked(sc); + } JME_UNLOCK(sc); @@ -1659,11 +1641,12 @@ jme_encap(struct jme_softc *sc, struct mbuf **m_head) *m_head = NULL; return (ENOBUFS); } - tcp = (struct tcphdr *)(mtod(m, char *) + poff); /* * Reset IP checksum and recompute TCP pseudo * checksum that NDIS specification requires. */ + ip = (struct ip *)(mtod(m, char *) + ip_off); + tcp = (struct tcphdr *)(mtod(m, char *) + poff); ip->ip_sum = 0; if (poff + (tcp->th_off << 2) == m->m_pkthdr.len) { tcp->th_sum = in_pseudo(ip->ip_src.s_addr, @@ -1861,6 +1844,7 @@ jme_watchdog(struct jme_softc *sc) if ((sc->jme_flags & JME_FLAG_LINK) == 0) { if_printf(sc->jme_ifp, "watchdog timeout (missed link)\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; jme_init_locked(sc); return; } @@ -1875,6 +1859,7 @@ jme_watchdog(struct jme_softc *sc) if_printf(sc->jme_ifp, "watchdog timeout\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; jme_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) taskqueue_enqueue(sc->jme_tq, &sc->jme_tx_task); @@ -1917,8 +1902,10 @@ jme_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) VLAN_CAPABILITIES(ifp); } ifp->if_mtu = ifr->ifr_mtu; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; jme_init_locked(sc); + } JME_UNLOCK(sc); } break; @@ -1990,6 +1977,9 @@ jme_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) if ((mask & IFCAP_VLAN_HWCSUM) != 0 && (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0) ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + if ((mask & IFCAP_VLAN_HWTSO) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && (IFCAP_VLAN_HWTAGGING & ifp->if_capabilities) != 0) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; @@ -2034,12 +2024,10 @@ jme_mac_config(struct jme_softc *sc) txmac &= ~(TXMAC_COLL_ENB | TXMAC_CARRIER_SENSE | TXMAC_BACKOFF | TXMAC_CARRIER_EXT | TXMAC_FRAME_BURST); -#ifdef notyet if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) txpause |= TXPFC_PAUSE_ENB; if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) rxmac |= RXMAC_FC_ENB; -#endif /* Disable retry transmit timer/retry limit. */ CSR_WRITE_4(sc, JME_TXTRHD, CSR_READ_4(sc, JME_TXTRHD) & ~(TXTRHD_RT_PERIOD_ENB | TXTRHD_RT_LIMIT_ENB)); @@ -2642,6 +2630,8 @@ jme_init_locked(struct jme_softc *sc) ifp = sc->jme_ifp; mii = device_get_softc(sc->jme_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; /* * Cancel any pending I/O. */ @@ -3122,7 +3112,7 @@ jme_set_filter(struct jme_softc *sc) rxcfg |= RXMAC_MULTICAST; bzero(mchash, sizeof(mchash)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3135,7 +3125,7 @@ jme_set_filter(struct jme_softc *sc) /* Set the corresponding bit in the hash table. */ mchash[crc >> 5] |= 1 << (crc & 0x1f); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); CSR_WRITE_4(sc, JME_MAR0, mchash[0]); CSR_WRITE_4(sc, JME_MAR1, mchash[1]); diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmereg.h b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmereg.h index 7040c4b828..ee2b2f674f 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmereg.h +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmereg.h @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/jme/if_jmereg.h,v 1.6 2008/12/04 02:16:53 yongari Exp $ + * $FreeBSD: src/sys/dev/jme/if_jmereg.h,v 1.6.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $ */ #ifndef _IF_JMEREG_H @@ -275,8 +275,8 @@ #define RXCSR_RXQ2 2 #define RXCSR_RXQ3 3 #define RXCSR_DESC_RT_CNT(x) \ - ((((x) / 4) << RXCSR_DESC_RT_CNT_SHIFT) & RXCSR_DESC_RT_CNT_MASK) -#define RXCSR_DESC_RT_CNT_DEFAULT 32 + (((x) << RXCSR_DESC_RT_CNT_SHIFT) & RXCSR_DESC_RT_CNT_MASK) +#define RXCSR_DESC_RT_CNT_DEFAULT 0 /* Rx queue descriptor base address. 16bytes alignment needed. */ #define JME_RXDBA_LO 0x0024 diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmevar.h b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmevar.h index 9f9b3895ec..b71cdf7be6 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmevar.h +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmevar.h @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/jme/if_jmevar.h,v 1.3 2008/12/04 02:16:53 yongari Exp $ + * $FreeBSD: src/sys/dev/jme/if_jmevar.h,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $ */ #ifndef _IF_JMEVAR_H diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphy.c b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphy.c index 4fba75d9ab..53b09b8842 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphy.c +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphy.c @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/jmphy.c,v 1.1 2008/05/27 01:16:40 yongari Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/jmphy.c,v 1.1.6.5.2.1 2010/12/21 17:09:25 kensmith Exp $"); /* * Driver for the JMicron JMP211 10/100/1000, JMP202 10/100 PHY. @@ -50,11 +50,11 @@ __FBSDID("$FreeBSD: src/sys/dev/mii/jmphy.c,v 1.1 2008/05/27 01:16:40 yongari Ex #include "miibus_if.h" -static int jmphy_probe(device_t); -static int jmphy_attach(device_t); +static int jmphy_probe(device_t); +static int jmphy_attach(device_t); static void jmphy_reset(struct mii_softc *); static uint16_t jmphy_anar(struct ifmedia_entry *); -static int jmphy_auto(struct mii_softc *, struct ifmedia_entry *); +static int jmphy_setmedia(struct mii_softc *, struct ifmedia_entry *); struct jmphy_softc { struct mii_softc mii_sc; @@ -109,16 +109,15 @@ jmphy_attach(device_t dev) sc = &jsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_flags = miibus_get_flags(dev); + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = jmphy_service; sc->mii_pdata = mii; - mii->mii_instance++; - jsc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); jsc->mii_model = MII_MODEL(ma->mii_id2); jsc->mii_rev = MII_REV(ma->mii_id2); @@ -136,52 +135,30 @@ jmphy_attach(device_t dev) printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); - return(0); + return (0); } static int jmphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - uint16_t bmcr; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: - /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - bmcr = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_ISO); - return (0); - } - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - if (jmphy_auto(sc, ife) != EJUSTRETURN) + if (jmphy_setmedia(sc, ife) != EJUSTRETURN) return (EINVAL); break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - /* * Is the interface even up? */ @@ -209,7 +186,7 @@ jmphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) return (0); sc->mii_ticks = 0; - jmphy_auto(sc, ife); + (void)jmphy_setmedia(sc, ife); break; } @@ -274,16 +251,14 @@ jmphy_status(struct mii_softc *sc) } if ((ssr & JMPHY_SSR_DUPLEX) != 0) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; - /* XXX Flow-control. */ -#ifdef notyet + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) { if ((PHY_READ(sc, MII_100T2SR) & GTSR_MS_RES) != 0) mii->mii_media_active |= IFM_ETH_MASTER; } -#endif } static void @@ -332,7 +307,7 @@ jmphy_anar(struct ifmedia_entry *ife) } static int -jmphy_auto(struct mii_softc *sc, struct ifmedia_entry *ife) +jmphy_setmedia(struct mii_softc *sc, struct ifmedia_entry *ife) { uint16_t anar, bmcr, gig; @@ -359,17 +334,18 @@ jmphy_auto(struct mii_softc *sc, struct ifmedia_entry *ife) bmcr |= BMCR_LOOP; anar = jmphy_anar(ife); - /* XXX Always advertise pause capability. */ - anar |= (3 << 10); + if (((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO || + (ife->ifm_media & IFM_FDX) != 0) && + (ife->ifm_media & IFM_FLOW) != 0) || + (sc->mii_flags & MIIF_FORCEPAUSE) != 0) + anar |= ANAR_PAUSE_TOWARDS; if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { -#ifdef notyet - struct mii_data *mii; - - mii = sc->mii_pdata; - if ((mii->mii_media.ifm_media & IFM_ETH_MASTER) != 0) - gig |= GTCR_MAN_MS | GTCR_MAN_ADV; -#endif + if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { + gig |= GTCR_MAN_MS; + if ((ife->ifm_media & IFM_ETH_MASTER) != 0) + gig |= GTCR_ADV_MS; + } PHY_WRITE(sc, MII_100T2CR, gig); } PHY_WRITE(sc, MII_ANAR, anar | ANAR_CSMA); diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphyreg.h b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphyreg.h index fa98022620..d2a3e34075 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphyreg.h +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphyreg.h @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/mii/jmphyreg.h,v 1.1 2008/05/27 01:16:40 yongari Exp $ + * $FreeBSD: src/sys/dev/mii/jmphyreg.h,v 1.1.6.1.6.1 2010/12/21 17:09:25 kensmith Exp $ */ #ifndef _DEV_MII_JMPHYREG_H_ diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c index e437af27d0..b0048ff219 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c @@ -28,15 +28,13 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/sys/dev/mii/ciphy.c,v 1.2 2005/01/06 01:42:55 imp Exp $ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ciphy.c,v 1.2 2005/01/06 01:42:55 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/ciphy.c,v 1.17.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $"); /* - * Driver for the Cicada CS8201 10/100/1000 copper PHY. + * Driver for the Cicada/Vitesse CS/VSC8xxx 10/100/1000 copper PHY. */ #include @@ -46,8 +44,6 @@ __FBSDID("$FreeBSD: src/sys/dev/mii/ciphy.c,v 1.2 2005/01/06 01:42:55 imp Exp $" #include #include -#include - #include #include #include @@ -61,9 +57,7 @@ __FBSDID("$FreeBSD: src/sys/dev/mii/ciphy.c,v 1.2 2005/01/06 01:42:55 imp Exp $" #include "miibus_if.h" #include -/* -#include -*/ + static int ciphy_probe(device_t); static int ciphy_attach(device_t); @@ -91,40 +85,26 @@ static void ciphy_status(struct mii_softc *); static void ciphy_reset(struct mii_softc *); static void ciphy_fixup(struct mii_softc *); +static const struct mii_phydesc ciphys[] = { + MII_PHY_DESC(CICADA, CS8201), + MII_PHY_DESC(CICADA, CS8201A), + MII_PHY_DESC(CICADA, CS8201B), + MII_PHY_DESC(CICADA, CS8204), + MII_PHY_DESC(CICADA, VSC8211), + MII_PHY_DESC(CICADA, CS8244), + MII_PHY_DESC(VITESSE, VSC8601), + MII_PHY_END +}; + static int -ciphy_probe(dev) - device_t dev; +ciphy_probe(device_t dev) { - struct mii_attach_args *ma; - ma = device_get_ivars(dev); - -device_printf(dev, "OUI: %x\n", MII_OUI(ma->mii_id1, ma->mii_id2)); -device_printf(dev, "MODEL: %x\n", MII_MODEL(ma->mii_id2)); - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_CICADA && - MII_MODEL(ma->mii_id2) == MII_MODEL_CICADA_CS8201) { - device_set_desc(dev, MII_STR_CICADA_CS8201); - return(0); - } - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_CICADA && - MII_MODEL(ma->mii_id2) == MII_MODEL_CICADA_CS8201A) { - device_set_desc(dev, MII_STR_CICADA_CS8201A); - return(0); - } - - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_CICADA && - MII_MODEL(ma->mii_id2) == MII_MODEL_CICADA_CS8201B) { - device_set_desc(dev, MII_STR_CICADA_CS8201B); - return(0); - } - - return(ENXIO); + return (mii_phy_dev_probe(dev, ciphys, BUS_PROBE_DEFAULT)); } static int -ciphy_attach(dev) - device_t dev; +ciphy_attach(device_t dev) { struct mii_softc *sc; struct mii_attach_args *ma; @@ -133,21 +113,20 @@ ciphy_attach(dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_flags = miibus_get_flags(dev); + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ciphy_service; sc->mii_pdata = mii; sc->mii_flags |= MIIF_NOISOLATE; - mii->mii_instance++; ciphy_reset(sc); - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); device_printf(dev, " "); @@ -155,38 +134,20 @@ ciphy_attach(dev) printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); - return(0); + return (0); } static int -ciphy_service(sc, mii, cmd) - struct mii_softc *sc; - struct mii_data *mii; - int cmd; +ciphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { struct ifmedia_entry *ife = mii->mii_media.ifm_cur; int reg, speed, gig; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: - /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - /* * If the interface is not up, don't do anything. */ @@ -204,7 +165,7 @@ ciphy_service(sc, mii, cmd) if (PHY_READ(sc, CIPHY_MII_BMCR) & CIPHY_BMCR_AUTOEN) return (0); #endif - (void) mii_phy_auto(sc); + (void)mii_phy_auto(sc); break; case IFM_1000_T: speed = CIPHY_S1000; @@ -226,45 +187,26 @@ setit: PHY_WRITE(sc, CIPHY_MII_BMCR, speed); PHY_WRITE(sc, CIPHY_MII_ANAR, CIPHY_SEL_TYPE); - if (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T) + if (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T) break; + gig |= CIPHY_1000CTL_MSE; + if ((ife->ifm_media & IFM_ETH_MASTER) != 0 || + (mii->mii_ifp->if_flags & IFF_LINK0) != 0) + gig |= CIPHY_1000CTL_MSC; PHY_WRITE(sc, CIPHY_MII_1000CTL, gig); PHY_WRITE(sc, CIPHY_MII_BMCR, - speed|CIPHY_BMCR_AUTOEN|CIPHY_BMCR_STARTNEG); - - /* - * When setting the link manually, one side must - * be the master and the other the slave. However - * ifmedia doesn't give us a good way to specify - * this, so we fake it by using one of the LINK - * flags. If LINK0 is set, we program the PHY to - * be a master, otherwise it's a slave. - */ - if ((mii->mii_ifp->if_flags & IFF_LINK0)) { - PHY_WRITE(sc, CIPHY_MII_1000CTL, - gig|CIPHY_1000CTL_MSE|CIPHY_1000CTL_MSC); - } else { - PHY_WRITE(sc, CIPHY_MII_1000CTL, - gig|CIPHY_1000CTL_MSE); - } + speed | CIPHY_BMCR_AUTOEN | CIPHY_BMCR_STARTNEG); break; case IFM_NONE: - PHY_WRITE(sc, MII_BMCR, BMCR_ISO|BMCR_PDOWN); + PHY_WRITE(sc, MII_BMCR, BMCR_ISO | BMCR_PDOWN); break; - case IFM_100_T4: default: return (EINVAL); } break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - /* * Is the interface even up? */ @@ -286,15 +228,18 @@ setit: if (reg & BMSR_LINK) break; - /* - * Only retry autonegotiation every 5 seconds. - */ - if (++sc->mii_ticks <= 5/*10*/) + /* Announce link loss right after it happens. */ + if (++sc->mii_ticks == 0) break; - + /* + * Only retry autonegotiation every mii_anegticks seconds. + */ + if (sc->mii_ticks <= sc->mii_anegticks) + break; + sc->mii_ticks = 0; mii_phy_auto(sc); - return (0); + break; } /* Update the media status. */ @@ -304,7 +249,7 @@ setit: * Callback if something changed. Note that we need to poke * apply fixups for certain PHY revs. */ - if (sc->mii_media_active != mii->mii_media_active || + if (sc->mii_media_active != mii->mii_media_active || sc->mii_media_status != mii->mii_media_status || cmd == MII_MEDIACHG) { ciphy_fixup(sc); @@ -314,8 +259,7 @@ setit: } static void -ciphy_status(sc) - struct mii_softc *sc; +ciphy_status(struct mii_softc *sc) { struct mii_data *mii = sc->mii_pdata; int bmsr, bmcr; @@ -360,17 +304,20 @@ ciphy_status(sc) if (bmsr & CIPHY_AUXCSR_FDX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; - return; + if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) && + (PHY_READ(sc, CIPHY_MII_1000STS) & CIPHY_1000STS_MSR) != 0) + mii->mii_media_active |= IFM_ETH_MASTER; } static void ciphy_reset(struct mii_softc *sc) { + mii_phy_reset(sc); DELAY(1000); - - return; } #define PHY_SETBIT(x, y, z) \ @@ -383,12 +330,30 @@ ciphy_fixup(struct mii_softc *sc) { uint16_t model; uint16_t status, speed; + uint16_t val; model = MII_MODEL(PHY_READ(sc, CIPHY_MII_PHYIDR2)); status = PHY_READ(sc, CIPHY_MII_AUXCSR); speed = status & CIPHY_AUXCSR_SPEED; + if (strcmp(device_get_name(device_get_parent(sc->mii_dev)), + "nfe") == 0) { + /* need to set for 2.5V RGMII for NVIDIA adapters */ + val = PHY_READ(sc, CIPHY_MII_ECTL1); + val &= ~(CIPHY_ECTL1_IOVOL | CIPHY_ECTL1_INTSEL); + val |= (CIPHY_IOVOL_2500MV | CIPHY_INTSEL_RGMII); + PHY_WRITE(sc, CIPHY_MII_ECTL1, val); + /* From Linux. */ + val = PHY_READ(sc, CIPHY_MII_AUXCSR); + val |= CIPHY_AUXCSR_MDPPS; + PHY_WRITE(sc, CIPHY_MII_AUXCSR, val); + val = PHY_READ(sc, CIPHY_MII_10BTCSR); + val |= CIPHY_10BTCSR_ECHO; + PHY_WRITE(sc, CIPHY_MII_10BTCSR, val); + } + switch (model) { + case MII_MODEL_CICADA_CS8204: case MII_MODEL_CICADA_CS8201: /* Turn off "aux mode" (whatever that means) */ @@ -424,12 +389,14 @@ ciphy_fixup(struct mii_softc *sc) PHY_CLRBIT(sc, CIPHY_MII_10BTCSR, CIPHY_10BTCSR_ECHO); } + break; + case MII_MODEL_CICADA_VSC8211: + case MII_MODEL_CICADA_CS8244: + case MII_MODEL_VITESSE_VSC8601: break; default: device_printf(sc->mii_dev, "unknown CICADA PHY model %x\n", model); break; } - - return; } diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphyreg.h b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphyreg.h index 727441ab1b..886b7b8fff 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphyreg.h +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphyreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/mii/ciphyreg.h,v 1.2 2005/01/06 01:42:55 imp Exp $ + * $FreeBSD: src/sys/dev/mii/ciphyreg.h,v 1.3.10.1.6.1 2010/12/21 17:09:25 kensmith Exp $ */ #ifndef _DEV_MII_CIPHYREG_H_ @@ -251,6 +251,16 @@ /* Extended PHY control register #1 */ #define CIPHY_MII_ECTL1 0x17 #define CIPHY_ECTL1_ACTIPHY 0x0020 /* Enable ActiPHY power saving */ +#define CIPHY_ECTL1_IOVOL 0x0e00 /* MAC interface and I/O voltage select */ +#define CIPHY_ECTL1_INTSEL 0xf000 /* select MAC interface */ + +#define CIPHY_IOVOL_3300MV 0x0000 /* 3.3V for I/O pins */ +#define CIPHY_IOVOL_2500MV 0x0200 /* 2.5V for I/O pins */ + +#define CIPHY_INTSEL_GMII 0x0000 /* GMII/MII */ +#define CIPHY_INTSEL_RGMII 0x1000 +#define CIPHY_INTSEL_TBI 0x2000 +#define CIPHY_INTSEL_RTBI 0x3000 /* Extended PHY control register #2 */ #define CIPHY_MII_ECTL2 0x18 diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c index 10347825bf..ad59059aad 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c @@ -16,13 +16,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -48,11 +41,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -67,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20 2007/01/20 00:52:29 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); /* * driver for generic unknown PHYs @@ -134,7 +122,7 @@ ukphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); if (bootverbose) @@ -142,17 +130,17 @@ ukphy_attach(device_t dev) MII_OUI(ma->mii_id1, ma->mii_id2), MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2)); - sc->mii_inst = mii->mii_instance; + sc->mii_flags = miibus_get_flags(dev); + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ukphy_service; sc->mii_pdata = mii; - mii->mii_instance++; + sc->mii_flags |= MIIF_NOMANPAUSE; mii_phy_reset(sc); - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); device_printf(dev, " "); @@ -168,29 +156,12 @@ ukphy_attach(device_t dev) static int ukphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int reg; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: - /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - /* * If the interface is not up, don't do anything. */ @@ -201,11 +172,6 @@ ukphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy_subr.c index fb40b75c1d..73007e197b 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy_subr.c @@ -16,13 +16,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -38,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.8.8.1 2006/07/19 04:40:26 yongari Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); /* * Subroutines shared by the ukphy driver and other PHY drivers. @@ -111,19 +104,26 @@ ukphy_status(struct mii_softc *phy) mii->mii_media_active |= IFM_1000_T|IFM_FDX; else if ((gtcr & GTCR_ADV_1000THDX) && (gtsr & GTSR_LP_1000THDX)) - mii->mii_media_active |= IFM_1000_T; - else if (anlpar & ANLPAR_T4) - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_1000_T|IFM_HDX; else if (anlpar & ANLPAR_TX_FD) mii->mii_media_active |= IFM_100_TX|IFM_FDX; + else if (anlpar & ANLPAR_T4) + mii->mii_media_active |= IFM_100_T4|IFM_HDX; else if (anlpar & ANLPAR_TX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; else if (anlpar & ANLPAR_10_FD) mii->mii_media_active |= IFM_10_T|IFM_FDX; else if (anlpar & ANLPAR_10) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; + + if ((mii->mii_media_active & IFM_1000_T) != 0 && + (gtsr & GTSR_MS_RES) != 0) + mii->mii_media_active |= IFM_ETH_MASTER; + + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= mii_phy_flowstatus(phy); } else mii->mii_media_active = ife->ifm_media; } diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/Jamfile b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/Jamfile index f8b85176da..1d40cf74eb 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/Jamfile +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/Jamfile @@ -3,6 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers network vt612x dev vge ; SubDirCcFlags -Wall ; UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ; +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ; UsePrivateHeaders net system ; diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/glue.c b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/glue.c index 5ca0397e86..80e058bf03 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/glue.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/glue.c @@ -4,7 +4,15 @@ */ +#include +#include #include +#include +#include + + +#include +#include HAIKU_FBSD_DRIVER_GLUE(vt612x, vge, pci); @@ -27,3 +35,25 @@ __haiku_select_miibus_driver(device_t dev) return __haiku_probe_miibus(dev, drivers); } + +int +__haiku_disable_interrupts(device_t dev) +{ + struct vge_softc *sc = device_get_softc(dev); + + if (CSR_READ_4(sc, VGE_ISR) == 0) + return 0; + + CSR_WRITE_4(sc, VGE_IMR, 0x00000000); + return 1; +} + + +void +__haiku_reenable_interrupts(device_t dev) +{ + struct vge_softc *sc = device_get_softc(dev); + + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); +} + diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c index 686dcded97..4e7a4bebc7 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/sys/dev/vge/if_vge.c,v 1.37.2.12.2.1 2010/12/21 17:09:25 kensmith Exp $"); /* * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver. @@ -93,7 +93,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include @@ -128,68 +128,79 @@ MODULE_DEPEND(vge, miibus, 1, 1, 1); #define VGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) +/* Tunables */ +static int msi_disable = 0; +TUNABLE_INT("hw.vge.msi_disable", &msi_disable); + +/* + * The SQE error counter of MIB seems to report bogus value. + * Vendor's workaround does not seem to work on PCIe based + * controllers. Disable it until we find better workaround. + */ +#undef VGE_ENABLE_SQEERR + /* * Various supported device vendors/types and their names. */ static struct vge_type vge_devs[] = { { VIA_VENDORID, VIA_DEVICEID_61XX, - "VIA Networking Gigabit Ethernet" }, + "VIA Networking Velocity Gigabit Ethernet" }, { 0, 0, NULL } }; -static int vge_probe (device_t); -static int vge_attach (device_t); -static int vge_detach (device_t); - -static int vge_encap (struct vge_softc *, struct mbuf *, int); - -static void vge_dma_map_addr (void *, bus_dma_segment_t *, int, int); -static void vge_dma_map_rx_desc (void *, bus_dma_segment_t *, int, - bus_size_t, int); -static void vge_dma_map_tx_desc (void *, bus_dma_segment_t *, int, - bus_size_t, int); -static int vge_allocmem (device_t, struct vge_softc *); -static int vge_newbuf (struct vge_softc *, int, struct mbuf *); -static int vge_rx_list_init (struct vge_softc *); -static int vge_tx_list_init (struct vge_softc *); -#ifdef VGE_FIXUP_RX -static __inline void vge_fixup_rx - (struct mbuf *); -#endif -static int vge_rxeof (struct vge_softc *); -static void vge_txeof (struct vge_softc *); -static void vge_intr (void *); -static void vge_tick (void *); -static void vge_tx_task (void *, int); -static void vge_start (struct ifnet *); -static int vge_ioctl (struct ifnet *, u_long, caddr_t); -static void vge_init (void *); -static void vge_stop (struct vge_softc *); -static void vge_watchdog (struct ifnet *); -static int vge_suspend (device_t); -static int vge_resume (device_t); -static int vge_shutdown (device_t); -static int vge_ifmedia_upd (struct ifnet *); -static void vge_ifmedia_sts (struct ifnet *, struct ifmediareq *); +static int vge_attach(device_t); +static int vge_detach(device_t); +static int vge_probe(device_t); +static int vge_resume(device_t); +static int vge_shutdown(device_t); +static int vge_suspend(device_t); +static void vge_cam_clear(struct vge_softc *); +static int vge_cam_set(struct vge_softc *, uint8_t *); +static void vge_clrwol(struct vge_softc *); +static void vge_discard_rxbuf(struct vge_softc *, int); +static int vge_dma_alloc(struct vge_softc *); +static void vge_dma_free(struct vge_softc *); +static void vge_dmamap_cb(void *, bus_dma_segment_t *, int, int); #ifdef VGE_EEPROM -static void vge_eeprom_getword (struct vge_softc *, int, u_int16_t *); +static void vge_eeprom_getword(struct vge_softc *, int, uint16_t *); #endif -static void vge_read_eeprom (struct vge_softc *, caddr_t, int, int, int); - -static void vge_miipoll_start (struct vge_softc *); -static void vge_miipoll_stop (struct vge_softc *); -static int vge_miibus_readreg (device_t, int, int); -static int vge_miibus_writereg (device_t, int, int, int); -static void vge_miibus_statchg (device_t); - -static void vge_cam_clear (struct vge_softc *); -static int vge_cam_set (struct vge_softc *, uint8_t *); -static void vge_setmulti (struct vge_softc *); -static void vge_reset (struct vge_softc *); - -#define VGE_PCI_LOIO 0x10 -#define VGE_PCI_LOMEM 0x14 +static int vge_encap(struct vge_softc *, struct mbuf **); +#ifndef __NO_STRICT_ALIGNMENT +static __inline void + vge_fixup_rx(struct mbuf *); +#endif +static void vge_freebufs(struct vge_softc *); +static void vge_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static int vge_ifmedia_upd(struct ifnet *); +static void vge_init(void *); +static void vge_init_locked(struct vge_softc *); +static void vge_intr(void *); +static void vge_intr_holdoff(struct vge_softc *); +static int vge_ioctl(struct ifnet *, u_long, caddr_t); +static void vge_link_statchg(void *); +static int vge_miibus_readreg(device_t, int, int); +static void vge_miibus_statchg(device_t); +static int vge_miibus_writereg(device_t, int, int, int); +static void vge_miipoll_start(struct vge_softc *); +static void vge_miipoll_stop(struct vge_softc *); +static int vge_newbuf(struct vge_softc *, int); +static void vge_read_eeprom(struct vge_softc *, caddr_t, int, int, int); +static void vge_reset(struct vge_softc *); +static int vge_rx_list_init(struct vge_softc *); +static int vge_rxeof(struct vge_softc *, int); +static void vge_rxfilter(struct vge_softc *); +static void vge_setvlan(struct vge_softc *); +static void vge_setwol(struct vge_softc *); +static void vge_start(struct ifnet *); +static void vge_start_locked(struct ifnet *); +static void vge_stats_clear(struct vge_softc *); +static void vge_stats_update(struct vge_softc *); +static void vge_stop(struct vge_softc *); +static void vge_sysctl_node(struct vge_softc *); +static int vge_tx_list_init(struct vge_softc *); +static void vge_txeof(struct vge_softc *); +static void vge_watchdog(void *); static device_method_t vge_methods[] = { /* Device interface */ @@ -223,41 +234,15 @@ static devclass_t vge_devclass; DRIVER_MODULE(vge, pci, vge_driver, vge_devclass, 0, 0); DRIVER_MODULE(miibus, vge, miibus_driver, miibus_devclass, 0, 0); -#ifdef __HAIKU__ -int -__haiku_disable_interrupts(device_t dev) -{ - struct vge_softc *sc = device_get_softc(dev); - - if (CSR_READ_4(sc, VGE_ISR) == 0) - return 0; - - CSR_WRITE_4(sc, VGE_IMR, 0x00000000); - return 1; -} - - -void -__haiku_reenable_interrupts(device_t dev) -{ - struct vge_softc *sc = device_get_softc(dev); - - CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); -} -#endif /* __HAIKU__ */ - #ifdef VGE_EEPROM /* * Read a word of data stored in the EEPROM at address 'addr.' */ static void -vge_eeprom_getword(sc, addr, dest) - struct vge_softc *sc; - int addr; - u_int16_t *dest; +vge_eeprom_getword(struct vge_softc *sc, int addr, uint16_t *dest) { - register int i; - u_int16_t word = 0; + int i; + uint16_t word = 0; /* * Enter EEPROM embedded programming mode. In order to @@ -293,8 +278,6 @@ vge_eeprom_getword(sc, addr, dest) CSR_CLRBIT_1(sc, VGE_CHIPCFG2, VGE_CHIPCFG2_EELOAD); *dest = word; - - return; } #endif @@ -302,20 +285,15 @@ vge_eeprom_getword(sc, addr, dest) * Read a sequence of words from the EEPROM. */ static void -vge_read_eeprom(sc, dest, off, cnt, swap) - struct vge_softc *sc; - caddr_t dest; - int off; - int cnt; - int swap; +vge_read_eeprom(struct vge_softc *sc, caddr_t dest, int off, int cnt, int swap) { - int i; + int i; #ifdef VGE_EEPROM - u_int16_t word = 0, *ptr; + uint16_t word = 0, *ptr; for (i = 0; i < cnt; i++) { vge_eeprom_getword(sc, off + i, &word); - ptr = (u_int16_t *)(dest + (i * 2)); + ptr = (uint16_t *)(dest + (i * 2)); if (swap) *ptr = ntohs(word); else @@ -328,10 +306,9 @@ vge_read_eeprom(sc, dest, off, cnt, swap) } static void -vge_miipoll_stop(sc) - struct vge_softc *sc; +vge_miipoll_stop(struct vge_softc *sc) { - int i; + int i; CSR_WRITE_1(sc, VGE_MIICMD, 0); @@ -343,15 +320,12 @@ vge_miipoll_stop(sc) if (i == VGE_TIMEOUT) device_printf(sc->vge_dev, "failed to idle MII autopoll\n"); - - return; } static void -vge_miipoll_start(sc) - struct vge_softc *sc; +vge_miipoll_start(struct vge_softc *sc) { - int i; + int i; /* First, make sure we're idle. */ @@ -383,25 +357,17 @@ vge_miipoll_start(sc) if (i == VGE_TIMEOUT) device_printf(sc->vge_dev, "failed to start MII autopoll\n"); - - return; } static int -vge_miibus_readreg(dev, phy, reg) - device_t dev; - int phy, reg; +vge_miibus_readreg(device_t dev, int phy, int reg) { - struct vge_softc *sc; - int i; - u_int16_t rval = 0; + struct vge_softc *sc; + int i; + uint16_t rval = 0; sc = device_get_softc(dev); - if (phy != (CSR_READ_1(sc, VGE_MIICFG) & 0x1F)) - return(0); - - VGE_LOCK(sc); vge_miipoll_stop(sc); /* Specify the register we want to read. */ @@ -423,25 +389,18 @@ vge_miibus_readreg(dev, phy, reg) rval = CSR_READ_2(sc, VGE_MIIDATA); vge_miipoll_start(sc); - VGE_UNLOCK(sc); return (rval); } static int -vge_miibus_writereg(dev, phy, reg, data) - device_t dev; - int phy, reg, data; +vge_miibus_writereg(device_t dev, int phy, int reg, int data) { - struct vge_softc *sc; - int i, rval = 0; + struct vge_softc *sc; + int i, rval = 0; sc = device_get_softc(dev); - if (phy != (CSR_READ_1(sc, VGE_MIICFG) & 0x1F)) - return(0); - - VGE_LOCK(sc); vge_miipoll_stop(sc); /* Specify the register we want to write. */ @@ -466,16 +425,14 @@ vge_miibus_writereg(dev, phy, reg, data) } vge_miipoll_start(sc); - VGE_UNLOCK(sc); return (rval); } static void -vge_cam_clear(sc) - struct vge_softc *sc; +vge_cam_clear(struct vge_softc *sc) { - int i; + int i; /* * Turn off all the mask bits. This tells the chip @@ -500,19 +457,15 @@ vge_cam_clear(sc) CSR_SETBIT_1(sc, VGE_CAMCTL, VGE_PAGESEL_MAR); sc->vge_camidx = 0; - - return; } static int -vge_cam_set(sc, addr) - struct vge_softc *sc; - uint8_t *addr; +vge_cam_set(struct vge_softc *sc, uint8_t *addr) { - int i, error = 0; + int i, error = 0; if (sc->vge_camidx == VGE_CAM_MAXADDRS) - return(ENOSPC); + return (ENOSPC); /* Select the CAM data page. */ CSR_CLRBIT_1(sc, VGE_CAMCTL, VGE_CAMCTL_PAGESEL); @@ -560,37 +513,66 @@ fail: return (error); } +static void +vge_setvlan(struct vge_softc *sc) +{ + struct ifnet *ifp; + uint8_t cfg; + + VGE_LOCK_ASSERT(sc); + + ifp = sc->vge_ifp; + cfg = CSR_READ_1(sc, VGE_RXCFG); + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) + cfg |= VGE_VTAG_OPT2; + else + cfg &= ~VGE_VTAG_OPT2; + CSR_WRITE_1(sc, VGE_RXCFG, cfg); +} + /* * Program the multicast filter. We use the 64-entry CAM filter * for perfect filtering. If there's more than 64 multicast addresses, - * we use the hash filter insted. + * we use the hash filter instead. */ static void -vge_setmulti(sc) - struct vge_softc *sc; +vge_rxfilter(struct vge_softc *sc) { - struct ifnet *ifp; - int error = 0/*, h = 0*/; - struct ifmultiaddr *ifma; - u_int32_t h, hashes[2] = { 0, 0 }; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + uint32_t h, hashes[2]; + uint8_t rxcfg; + int error = 0; - ifp = sc->vge_ifp; + VGE_LOCK_ASSERT(sc); /* First, zot all the multicast entries. */ - vge_cam_clear(sc); - CSR_WRITE_4(sc, VGE_MAR0, 0); - CSR_WRITE_4(sc, VGE_MAR1, 0); + hashes[0] = 0; + hashes[1] = 0; + rxcfg = CSR_READ_1(sc, VGE_RXCTL); + rxcfg &= ~(VGE_RXCTL_RX_MCAST | VGE_RXCTL_RX_BCAST | + VGE_RXCTL_RX_PROMISC); /* - * If the user wants allmulti or promisc mode, enable reception - * of all multicast frames. + * Always allow VLAN oversized frames and frames for + * this host. */ - if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { - CSR_WRITE_4(sc, VGE_MAR0, 0xFFFFFFFF); - CSR_WRITE_4(sc, VGE_MAR1, 0xFFFFFFFF); - return; + rxcfg |= VGE_RXCTL_RX_GIANT | VGE_RXCTL_RX_UCAST; + + ifp = sc->vge_ifp; + if ((ifp->if_flags & IFF_BROADCAST) != 0) + rxcfg |= VGE_RXCTL_RX_BCAST; + if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) { + if ((ifp->if_flags & IFF_PROMISC) != 0) + rxcfg |= VGE_RXCTL_RX_PROMISC; + if ((ifp->if_flags & IFF_ALLMULTI) != 0) { + hashes[0] = 0xFFFFFFFF; + hashes[1] = 0xFFFFFFFF; + } + goto done; } + vge_cam_clear(sc); /* Now program new ones */ if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { @@ -616,20 +598,21 @@ vge_setmulti(sc) else hashes[1] |= (1 << (h - 32)); } - - CSR_WRITE_4(sc, VGE_MAR0, hashes[0]); - CSR_WRITE_4(sc, VGE_MAR1, hashes[1]); } if_maddr_runlock(ifp); - return; +done: + if (hashes[0] != 0 || hashes[1] != 0) + rxcfg |= VGE_RXCTL_RX_MCAST; + CSR_WRITE_4(sc, VGE_MAR0, hashes[0]); + CSR_WRITE_4(sc, VGE_MAR1, hashes[1]); + CSR_WRITE_1(sc, VGE_RXCTL, rxcfg); } static void -vge_reset(sc) - struct vge_softc *sc; +vge_reset(struct vge_softc *sc) { - register int i; + int i; CSR_WRITE_1(sc, VGE_CRS1, VGE_CR1_SOFTRESET); @@ -640,29 +623,12 @@ vge_reset(sc) } if (i == VGE_TIMEOUT) { - device_printf(sc->vge_dev, "soft reset timed out"); + device_printf(sc->vge_dev, "soft reset timed out\n"); CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_STOP_FORCE); DELAY(2000); } DELAY(5000); - - CSR_SETBIT_1(sc, VGE_EECSR, VGE_EECSR_RELOAD); - - for (i = 0; i < VGE_TIMEOUT; i++) { - DELAY(5); - if ((CSR_READ_1(sc, VGE_EECSR) & VGE_EECSR_RELOAD) == 0) - break; - } - - if (i == VGE_TIMEOUT) { - device_printf(sc->vge_dev, "EEPROM reload timed out\n"); - return; - } - - CSR_CLRBIT_1(sc, VGE_CHIPCFG0, VGE_CHIPCFG0_PACPI); - - return; } /* @@ -670,10 +636,9 @@ vge_reset(sc) * IDs against our list and return a device name if we find a match. */ static int -vge_probe(dev) - device_t dev; +vge_probe(device_t dev) { - struct vge_type *t; + struct vge_type *t; t = vge_devs; @@ -689,249 +654,320 @@ vge_probe(dev) return (ENXIO); } -static void -vge_dma_map_rx_desc(arg, segs, nseg, mapsize, error) - void *arg; - bus_dma_segment_t *segs; - int nseg; - bus_size_t mapsize; - int error; -{ - - struct vge_dmaload_arg *ctx; - struct vge_rx_desc *d = NULL; - - if (error) - return; - - ctx = arg; - - /* Signal error to caller if there's too many segments */ - if (nseg > ctx->vge_maxsegs) { - ctx->vge_maxsegs = 0; - return; - } - - /* - * Map the segment array into descriptors. - */ - - d = &ctx->sc->vge_ldata.vge_rx_list[ctx->vge_idx]; - - /* If this descriptor is still owned by the chip, bail. */ - - if (le32toh(d->vge_sts) & VGE_RDSTS_OWN) { - device_printf(ctx->sc->vge_dev, - "tried to map busy descriptor\n"); - ctx->vge_maxsegs = 0; - return; - } - - d->vge_buflen = htole16(VGE_BUFLEN(segs[0].ds_len) | VGE_RXDESC_I); - d->vge_addrlo = htole32(VGE_ADDR_LO(segs[0].ds_addr)); - d->vge_addrhi = htole16(VGE_ADDR_HI(segs[0].ds_addr) & 0xFFFF); - d->vge_sts = 0; - d->vge_ctl = 0; - - ctx->vge_maxsegs = 1; - - return; -} - -static void -vge_dma_map_tx_desc(arg, segs, nseg, mapsize, error) - void *arg; - bus_dma_segment_t *segs; - int nseg; - bus_size_t mapsize; - int error; -{ - struct vge_dmaload_arg *ctx; - struct vge_tx_desc *d = NULL; - struct vge_tx_frag *f; - int i = 0; - - if (error) - return; - - ctx = arg; - - /* Signal error to caller if there's too many segments */ - if (nseg > ctx->vge_maxsegs) { - ctx->vge_maxsegs = 0; - return; - } - - /* Map the segment array into descriptors. */ - - d = &ctx->sc->vge_ldata.vge_tx_list[ctx->vge_idx]; - - /* If this descriptor is still owned by the chip, bail. */ - - if (le32toh(d->vge_sts) & VGE_TDSTS_OWN) { - ctx->vge_maxsegs = 0; - return; - } - - for (i = 0; i < nseg; i++) { - f = &d->vge_frag[i]; - f->vge_buflen = htole16(VGE_BUFLEN(segs[i].ds_len)); - f->vge_addrlo = htole32(VGE_ADDR_LO(segs[i].ds_addr)); - f->vge_addrhi = htole16(VGE_ADDR_HI(segs[i].ds_addr) & 0xFFFF); - } - - /* Argh. This chip does not autopad short frames */ - - if (ctx->vge_m0->m_pkthdr.len < VGE_MIN_FRAMELEN) { - f = &d->vge_frag[i]; - f->vge_buflen = htole16(VGE_BUFLEN(VGE_MIN_FRAMELEN - - ctx->vge_m0->m_pkthdr.len)); - f->vge_addrlo = htole32(VGE_ADDR_LO(segs[0].ds_addr)); - f->vge_addrhi = htole16(VGE_ADDR_HI(segs[0].ds_addr) & 0xFFFF); - ctx->vge_m0->m_pkthdr.len = VGE_MIN_FRAMELEN; - i++; - } - - /* - * When telling the chip how many segments there are, we - * must use nsegs + 1 instead of just nsegs. Darned if I - * know why. - */ - i++; - - d->vge_sts = ctx->vge_m0->m_pkthdr.len << 16; - d->vge_ctl = ctx->vge_flags|(i << 28)|VGE_TD_LS_NORM; - - if (ctx->vge_m0->m_pkthdr.len > ETHERMTU + ETHER_HDR_LEN) - d->vge_ctl |= VGE_TDCTL_JUMBO; - - ctx->vge_maxsegs = nseg; - - return; -} - /* * Map a single buffer address. */ -static void -vge_dma_map_addr(arg, segs, nseg, error) - void *arg; - bus_dma_segment_t *segs; - int nseg; - int error; -{ - bus_addr_t *addr; +struct vge_dmamap_arg { + bus_addr_t vge_busaddr; +}; - if (error) +static void +vge_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct vge_dmamap_arg *ctx; + + if (error != 0) return; - KASSERT(nseg == 1, ("too many DMA segments, %d should be 1", nseg)); - addr = arg; - *addr = segs->ds_addr; + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); - return; + ctx = (struct vge_dmamap_arg *)arg; + ctx->vge_busaddr = segs[0].ds_addr; } static int -vge_allocmem(dev, sc) - device_t dev; - struct vge_softc *sc; +vge_dma_alloc(struct vge_softc *sc) { - int error; - int nseg; - int i; + struct vge_dmamap_arg ctx; + struct vge_txdesc *txd; + struct vge_rxdesc *rxd; + bus_addr_t lowaddr, tx_ring_end, rx_ring_end; + int error, i; - /* - * Allocate map for RX mbufs. - */ - nseg = 32; - error = bus_dma_tag_create(sc->vge_parent_tag, ETHER_ALIGN, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, - NULL, MCLBYTES * nseg, nseg, MCLBYTES, BUS_DMA_ALLOCNOW, - NULL, NULL, &sc->vge_ldata.vge_mtag); - if (error) { - device_printf(dev, "could not allocate dma tag\n"); - return (ENOMEM); + lowaddr = BUS_SPACE_MAXADDR; + +again: + /* Create parent ring tag. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->vge_dev),/* parent */ + 1, 0, /* algnmnt, boundary */ + lowaddr, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ + 0, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vge_cdata.vge_ring_tag); + if (error != 0) { + device_printf(sc->vge_dev, + "could not create parent DMA tag.\n"); + goto fail; } - /* - * Allocate map for TX descriptor list. - */ - error = bus_dma_tag_create(sc->vge_parent_tag, VGE_RING_ALIGN, - 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, - NULL, VGE_TX_LIST_SZ, 1, VGE_TX_LIST_SZ, BUS_DMA_ALLOCNOW, - NULL, NULL, &sc->vge_ldata.vge_tx_list_tag); - if (error) { - device_printf(dev, "could not allocate dma tag\n"); - return (ENOMEM); + /* Create tag for Tx ring. */ + error = bus_dma_tag_create(sc->vge_cdata.vge_ring_tag,/* parent */ + VGE_TX_RING_ALIGN, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + VGE_TX_LIST_SZ, /* maxsize */ + 1, /* nsegments */ + VGE_TX_LIST_SZ, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vge_cdata.vge_tx_ring_tag); + if (error != 0) { + device_printf(sc->vge_dev, + "could not allocate Tx ring DMA tag.\n"); + goto fail; } - /* Allocate DMA'able memory for the TX ring */ + /* Create tag for Rx ring. */ + error = bus_dma_tag_create(sc->vge_cdata.vge_ring_tag,/* parent */ + VGE_RX_RING_ALIGN, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + VGE_RX_LIST_SZ, /* maxsize */ + 1, /* nsegments */ + VGE_RX_LIST_SZ, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vge_cdata.vge_rx_ring_tag); + if (error != 0) { + device_printf(sc->vge_dev, + "could not allocate Rx ring DMA tag.\n"); + goto fail; + } - error = bus_dmamem_alloc(sc->vge_ldata.vge_tx_list_tag, - (void **)&sc->vge_ldata.vge_tx_list, BUS_DMA_NOWAIT | BUS_DMA_ZERO, - &sc->vge_ldata.vge_tx_list_map); - if (error) - return (ENOMEM); + /* Allocate DMA'able memory and load the DMA map for Tx ring. */ + error = bus_dmamem_alloc(sc->vge_cdata.vge_tx_ring_tag, + (void **)&sc->vge_rdata.vge_tx_ring, + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT, + &sc->vge_cdata.vge_tx_ring_map); + if (error != 0) { + device_printf(sc->vge_dev, + "could not allocate DMA'able memory for Tx ring.\n"); + goto fail; + } - /* Load the map for the TX ring. */ + ctx.vge_busaddr = 0; + error = bus_dmamap_load(sc->vge_cdata.vge_tx_ring_tag, + sc->vge_cdata.vge_tx_ring_map, sc->vge_rdata.vge_tx_ring, + VGE_TX_LIST_SZ, vge_dmamap_cb, &ctx, BUS_DMA_NOWAIT); + if (error != 0 || ctx.vge_busaddr == 0) { + device_printf(sc->vge_dev, + "could not load DMA'able memory for Tx ring.\n"); + goto fail; + } + sc->vge_rdata.vge_tx_ring_paddr = ctx.vge_busaddr; - error = bus_dmamap_load(sc->vge_ldata.vge_tx_list_tag, - sc->vge_ldata.vge_tx_list_map, sc->vge_ldata.vge_tx_list, - VGE_TX_LIST_SZ, vge_dma_map_addr, - &sc->vge_ldata.vge_tx_list_addr, BUS_DMA_NOWAIT); + /* Allocate DMA'able memory and load the DMA map for Rx ring. */ + error = bus_dmamem_alloc(sc->vge_cdata.vge_rx_ring_tag, + (void **)&sc->vge_rdata.vge_rx_ring, + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT, + &sc->vge_cdata.vge_rx_ring_map); + if (error != 0) { + device_printf(sc->vge_dev, + "could not allocate DMA'able memory for Rx ring.\n"); + goto fail; + } - /* Create DMA maps for TX buffers */ + ctx.vge_busaddr = 0; + error = bus_dmamap_load(sc->vge_cdata.vge_rx_ring_tag, + sc->vge_cdata.vge_rx_ring_map, sc->vge_rdata.vge_rx_ring, + VGE_RX_LIST_SZ, vge_dmamap_cb, &ctx, BUS_DMA_NOWAIT); + if (error != 0 || ctx.vge_busaddr == 0) { + device_printf(sc->vge_dev, + "could not load DMA'able memory for Rx ring.\n"); + goto fail; + } + sc->vge_rdata.vge_rx_ring_paddr = ctx.vge_busaddr; + /* Tx/Rx descriptor queue should reside within 4GB boundary. */ + tx_ring_end = sc->vge_rdata.vge_tx_ring_paddr + VGE_TX_LIST_SZ; + rx_ring_end = sc->vge_rdata.vge_rx_ring_paddr + VGE_RX_LIST_SZ; + if ((VGE_ADDR_HI(tx_ring_end) != + VGE_ADDR_HI(sc->vge_rdata.vge_tx_ring_paddr)) || + (VGE_ADDR_HI(rx_ring_end) != + VGE_ADDR_HI(sc->vge_rdata.vge_rx_ring_paddr)) || + VGE_ADDR_HI(tx_ring_end) != VGE_ADDR_HI(rx_ring_end)) { + device_printf(sc->vge_dev, "4GB boundary crossed, " + "switching to 32bit DMA address mode.\n"); + vge_dma_free(sc); + /* Limit DMA address space to 32bit and try again. */ + lowaddr = BUS_SPACE_MAXADDR_32BIT; + goto again; + } + + /* Create parent buffer tag. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->vge_dev),/* parent */ + 1, 0, /* algnmnt, boundary */ + VGE_BUF_DMA_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ + 0, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vge_cdata.vge_buffer_tag); + if (error != 0) { + device_printf(sc->vge_dev, + "could not create parent buffer DMA tag.\n"); + goto fail; + } + + /* Create tag for Tx buffers. */ + error = bus_dma_tag_create(sc->vge_cdata.vge_buffer_tag,/* parent */ + 1, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES * VGE_MAXTXSEGS, /* maxsize */ + VGE_MAXTXSEGS, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vge_cdata.vge_tx_tag); + if (error != 0) { + device_printf(sc->vge_dev, "could not create Tx DMA tag.\n"); + goto fail; + } + + /* Create tag for Rx buffers. */ + error = bus_dma_tag_create(sc->vge_cdata.vge_buffer_tag,/* parent */ + VGE_RX_BUF_ALIGN, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES, /* maxsize */ + 1, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vge_cdata.vge_rx_tag); + if (error != 0) { + device_printf(sc->vge_dev, "could not create Rx DMA tag.\n"); + goto fail; + } + + /* Create DMA maps for Tx buffers. */ for (i = 0; i < VGE_TX_DESC_CNT; i++) { - error = bus_dmamap_create(sc->vge_ldata.vge_mtag, 0, - &sc->vge_ldata.vge_tx_dmamap[i]); - if (error) { - device_printf(dev, "can't create DMA map for TX\n"); - return (ENOMEM); + txd = &sc->vge_cdata.vge_txdesc[i]; + txd->tx_m = NULL; + txd->tx_dmamap = NULL; + error = bus_dmamap_create(sc->vge_cdata.vge_tx_tag, 0, + &txd->tx_dmamap); + if (error != 0) { + device_printf(sc->vge_dev, + "could not create Tx dmamap.\n"); + goto fail; } } - - /* - * Allocate map for RX descriptor list. - */ - error = bus_dma_tag_create(sc->vge_parent_tag, VGE_RING_ALIGN, - 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, - NULL, VGE_TX_LIST_SZ, 1, VGE_TX_LIST_SZ, BUS_DMA_ALLOCNOW, - NULL, NULL, &sc->vge_ldata.vge_rx_list_tag); - if (error) { - device_printf(dev, "could not allocate dma tag\n"); - return (ENOMEM); + /* Create DMA maps for Rx buffers. */ + if ((error = bus_dmamap_create(sc->vge_cdata.vge_rx_tag, 0, + &sc->vge_cdata.vge_rx_sparemap)) != 0) { + device_printf(sc->vge_dev, + "could not create spare Rx dmamap.\n"); + goto fail; } - - /* Allocate DMA'able memory for the RX ring */ - - error = bus_dmamem_alloc(sc->vge_ldata.vge_rx_list_tag, - (void **)&sc->vge_ldata.vge_rx_list, BUS_DMA_NOWAIT | BUS_DMA_ZERO, - &sc->vge_ldata.vge_rx_list_map); - if (error) - return (ENOMEM); - - /* Load the map for the RX ring. */ - - error = bus_dmamap_load(sc->vge_ldata.vge_rx_list_tag, - sc->vge_ldata.vge_rx_list_map, sc->vge_ldata.vge_rx_list, - VGE_TX_LIST_SZ, vge_dma_map_addr, - &sc->vge_ldata.vge_rx_list_addr, BUS_DMA_NOWAIT); - - /* Create DMA maps for RX buffers */ - for (i = 0; i < VGE_RX_DESC_CNT; i++) { - error = bus_dmamap_create(sc->vge_ldata.vge_mtag, 0, - &sc->vge_ldata.vge_rx_dmamap[i]); - if (error) { - device_printf(dev, "can't create DMA map for RX\n"); - return (ENOMEM); + rxd = &sc->vge_cdata.vge_rxdesc[i]; + rxd->rx_m = NULL; + rxd->rx_dmamap = NULL; + error = bus_dmamap_create(sc->vge_cdata.vge_rx_tag, 0, + &rxd->rx_dmamap); + if (error != 0) { + device_printf(sc->vge_dev, + "could not create Rx dmamap.\n"); + goto fail; } } - return (0); +fail: + return (error); +} + +static void +vge_dma_free(struct vge_softc *sc) +{ + struct vge_txdesc *txd; + struct vge_rxdesc *rxd; + int i; + + /* Tx ring. */ + if (sc->vge_cdata.vge_tx_ring_tag != NULL) { + if (sc->vge_cdata.vge_tx_ring_map) + bus_dmamap_unload(sc->vge_cdata.vge_tx_ring_tag, + sc->vge_cdata.vge_tx_ring_map); + if (sc->vge_cdata.vge_tx_ring_map && + sc->vge_rdata.vge_tx_ring) + bus_dmamem_free(sc->vge_cdata.vge_tx_ring_tag, + sc->vge_rdata.vge_tx_ring, + sc->vge_cdata.vge_tx_ring_map); + sc->vge_rdata.vge_tx_ring = NULL; + sc->vge_cdata.vge_tx_ring_map = NULL; + bus_dma_tag_destroy(sc->vge_cdata.vge_tx_ring_tag); + sc->vge_cdata.vge_tx_ring_tag = NULL; + } + /* Rx ring. */ + if (sc->vge_cdata.vge_rx_ring_tag != NULL) { + if (sc->vge_cdata.vge_rx_ring_map) + bus_dmamap_unload(sc->vge_cdata.vge_rx_ring_tag, + sc->vge_cdata.vge_rx_ring_map); + if (sc->vge_cdata.vge_rx_ring_map && + sc->vge_rdata.vge_rx_ring) + bus_dmamem_free(sc->vge_cdata.vge_rx_ring_tag, + sc->vge_rdata.vge_rx_ring, + sc->vge_cdata.vge_rx_ring_map); + sc->vge_rdata.vge_rx_ring = NULL; + sc->vge_cdata.vge_rx_ring_map = NULL; + bus_dma_tag_destroy(sc->vge_cdata.vge_rx_ring_tag); + sc->vge_cdata.vge_rx_ring_tag = NULL; + } + /* Tx buffers. */ + if (sc->vge_cdata.vge_tx_tag != NULL) { + for (i = 0; i < VGE_TX_DESC_CNT; i++) { + txd = &sc->vge_cdata.vge_txdesc[i]; + if (txd->tx_dmamap != NULL) { + bus_dmamap_destroy(sc->vge_cdata.vge_tx_tag, + txd->tx_dmamap); + txd->tx_dmamap = NULL; + } + } + bus_dma_tag_destroy(sc->vge_cdata.vge_tx_tag); + sc->vge_cdata.vge_tx_tag = NULL; + } + /* Rx buffers. */ + if (sc->vge_cdata.vge_rx_tag != NULL) { + for (i = 0; i < VGE_RX_DESC_CNT; i++) { + rxd = &sc->vge_cdata.vge_rxdesc[i]; + if (rxd->rx_dmamap != NULL) { + bus_dmamap_destroy(sc->vge_cdata.vge_rx_tag, + rxd->rx_dmamap); + rxd->rx_dmamap = NULL; + } + } + if (sc->vge_cdata.vge_rx_sparemap != NULL) { + bus_dmamap_destroy(sc->vge_cdata.vge_rx_tag, + sc->vge_cdata.vge_rx_sparemap); + sc->vge_cdata.vge_rx_sparemap = NULL; + } + bus_dma_tag_destroy(sc->vge_cdata.vge_rx_tag); + sc->vge_cdata.vge_rx_tag = NULL; + } + + if (sc->vge_cdata.vge_buffer_tag != NULL) { + bus_dma_tag_destroy(sc->vge_cdata.vge_buffer_tag); + sc->vge_cdata.vge_buffer_tag = NULL; + } + if (sc->vge_cdata.vge_ring_tag != NULL) { + bus_dma_tag_destroy(sc->vge_cdata.vge_ring_tag); + sc->vge_cdata.vge_ring_tag = NULL; + } } /* @@ -939,128 +975,158 @@ vge_allocmem(dev, sc) * setup and ethernet/BPF attach. */ static int -vge_attach(dev) - device_t dev; +vge_attach(device_t dev) { - u_char eaddr[ETHER_ADDR_LEN]; - struct vge_softc *sc; - struct ifnet *ifp; - int unit, error = 0, rid; + u_char eaddr[ETHER_ADDR_LEN]; + struct vge_softc *sc; + struct ifnet *ifp; + int error = 0, cap, i, msic, rid; sc = device_get_softc(dev); - unit = device_get_unit(dev); sc->vge_dev = dev; mtx_init(&sc->vge_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF | MTX_RECURSE); + MTX_DEF); + callout_init_mtx(&sc->vge_watchdog, &sc->vge_mtx, 0); + /* * Map control/status registers. */ pci_enable_busmaster(dev); - rid = VGE_PCI_LOMEM; - sc->vge_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0, ~0, 1, RF_ACTIVE); + rid = PCIR_BAR(1); + sc->vge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); if (sc->vge_res == NULL) { - printf ("vge%d: couldn't map ports/memory\n", unit); + device_printf(dev, "couldn't map ports/memory\n"); error = ENXIO; goto fail; } - sc->vge_btag = rman_get_bustag(sc->vge_res); - sc->vge_bhandle = rman_get_bushandle(sc->vge_res); + if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) == 0) { + sc->vge_flags |= VGE_FLAG_PCIE; + sc->vge_expcap = cap; + } else + sc->vge_flags |= VGE_FLAG_JUMBO; + if (pci_find_extcap(dev, PCIY_PMG, &cap) == 0) { + sc->vge_flags |= VGE_FLAG_PMCAP; + sc->vge_pmcap = cap; + } + rid = 0; + msic = pci_msi_count(dev); + if (msi_disable == 0 && msic > 0) { + msic = 1; + if (pci_alloc_msi(dev, &msic) == 0) { + if (msic == 1) { + sc->vge_flags |= VGE_FLAG_MSI; + device_printf(dev, "Using %d MSI message\n", + msic); + rid = 1; + } else + pci_release_msi(dev); + } + } /* Allocate interrupt */ - rid = 0; - sc->vge_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, - 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE); - + sc->vge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + ((sc->vge_flags & VGE_FLAG_MSI) ? 0 : RF_SHAREABLE) | RF_ACTIVE); if (sc->vge_irq == NULL) { - printf("vge%d: couldn't map interrupt\n", unit); + device_printf(dev, "couldn't map interrupt\n"); error = ENXIO; goto fail; } /* Reset the adapter. */ vge_reset(sc); + /* Reload EEPROM. */ + CSR_WRITE_1(sc, VGE_EECSR, VGE_EECSR_RELOAD); + for (i = 0; i < VGE_TIMEOUT; i++) { + DELAY(5); + if ((CSR_READ_1(sc, VGE_EECSR) & VGE_EECSR_RELOAD) == 0) + break; + } + if (i == VGE_TIMEOUT) + device_printf(dev, "EEPROM reload timed out\n"); + /* + * Clear PACPI as EEPROM reload will set the bit. Otherwise + * MAC will receive magic packet which in turn confuses + * controller. + */ + CSR_CLRBIT_1(sc, VGE_CHIPCFG0, VGE_CHIPCFG0_PACPI); /* * Get station address from the EEPROM. */ vge_read_eeprom(sc, (caddr_t)eaddr, VGE_EE_EADDR, 3, 0); - - sc->vge_unit = unit; - /* - * Allocate the parent bus DMA tag appropriate for PCI. + * Save configured PHY address. + * It seems the PHY address of PCIe controllers just + * reflects media jump strapping status so we assume the + * internal PHY address of PCIe controller is at 1. */ -#define VGE_NSEG_NEW 32 - error = bus_dma_tag_create(NULL, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - MAXBSIZE, VGE_NSEG_NEW, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->vge_parent_tag); - if (error) - goto fail; - - error = vge_allocmem(dev, sc); - + if ((sc->vge_flags & VGE_FLAG_PCIE) != 0) + sc->vge_phyaddr = 1; + else + sc->vge_phyaddr = CSR_READ_1(sc, VGE_MIICFG) & + VGE_MIICFG_PHYADDR; + /* Clear WOL and take hardware from powerdown. */ + vge_clrwol(sc); + vge_sysctl_node(sc); + error = vge_dma_alloc(sc); if (error) goto fail; ifp = sc->vge_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - printf("vge%d: can not if_alloc()\n", sc->vge_unit); + device_printf(dev, "can not if_alloc()\n"); error = ENOSPC; goto fail; } /* Do MII setup */ - if (mii_phy_probe(dev, &sc->vge_miibus, - vge_ifmedia_upd, vge_ifmedia_sts)) { - printf("vge%d: MII without any phy!\n", sc->vge_unit); - error = ENXIO; + error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, + vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = vge_ioctl; ifp->if_capabilities = IFCAP_VLAN_MTU; ifp->if_start = vge_start; ifp->if_hwassist = VGE_CSUM_FEATURES; - ifp->if_capabilities |= IFCAP_HWCSUM|IFCAP_VLAN_HWTAGGING; + ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | + IFCAP_VLAN_HWTAGGING; + if ((sc->vge_flags & VGE_FLAG_PMCAP) != 0) + ifp->if_capabilities |= IFCAP_WOL; ifp->if_capenable = ifp->if_capabilities; #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; #endif - ifp->if_watchdog = vge_watchdog; ifp->if_init = vge_init; - IFQ_SET_MAXLEN(&ifp->if_snd, VGE_IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = VGE_IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, VGE_TX_DESC_CNT - 1); + ifp->if_snd.ifq_drv_maxlen = VGE_TX_DESC_CNT - 1; IFQ_SET_READY(&ifp->if_snd); - TASK_INIT(&sc->vge_txtask, 0, vge_tx_task, ifp); - /* * Call MI attach routine. */ ether_ifattach(ifp, eaddr); + /* Tell the upper layer(s) we support long frames. */ + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->vge_irq, INTR_TYPE_NET|INTR_MPSAFE, NULL, vge_intr, sc, &sc->vge_intrhand); if (error) { - printf("vge%d: couldn't set up irq\n", unit); + device_printf(dev, "couldn't set up irq\n"); ether_ifdetach(ifp); goto fail; } @@ -1080,12 +1146,10 @@ fail: * allocated. */ static int -vge_detach(dev) - device_t dev; +vge_detach(device_t dev) { - struct vge_softc *sc; - struct ifnet *ifp; - int i; + struct vge_softc *sc; + struct ifnet *ifp; sc = device_get_softc(dev); KASSERT(mtx_initialized(&sc->vge_mtx), ("vge mutex not initialized")); @@ -1098,21 +1162,11 @@ vge_detach(dev) /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { - vge_stop(sc); - /* - * Force off the IFF_UP flag here, in case someone - * still had a BPF descriptor attached to this - * interface. If they do, ether_ifattach() will cause - * the BPF code to try and clear the promisc mode - * flag, which will bubble down to vge_ioctl(), - * which will try to call vge_init() again. This will - * turn the NIC back on and restart the MII ticker, - * which will panic the system when the kernel tries - * to invoke the vge_tick() function that isn't there - * anymore. - */ - ifp->if_flags &= ~IFF_UP; ether_ifdetach(ifp); + VGE_LOCK(sc); + vge_stop(sc); + VGE_UNLOCK(sc); + callout_drain(&sc->vge_watchdog); } if (sc->vge_miibus) device_delete_child(dev, sc->vge_miibus); @@ -1121,104 +1175,31 @@ vge_detach(dev) if (sc->vge_intrhand) bus_teardown_intr(dev, sc->vge_irq, sc->vge_intrhand); if (sc->vge_irq) - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->vge_irq); + bus_release_resource(dev, SYS_RES_IRQ, + sc->vge_flags & VGE_FLAG_MSI ? 1 : 0, sc->vge_irq); + if (sc->vge_flags & VGE_FLAG_MSI) + pci_release_msi(dev); if (sc->vge_res) bus_release_resource(dev, SYS_RES_MEMORY, - VGE_PCI_LOMEM, sc->vge_res); + PCIR_BAR(1), sc->vge_res); if (ifp) if_free(ifp); - /* Unload and free the RX DMA ring memory and map */ - - if (sc->vge_ldata.vge_rx_list_tag) { - bus_dmamap_unload(sc->vge_ldata.vge_rx_list_tag, - sc->vge_ldata.vge_rx_list_map); - bus_dmamem_free(sc->vge_ldata.vge_rx_list_tag, - sc->vge_ldata.vge_rx_list, - sc->vge_ldata.vge_rx_list_map); - bus_dma_tag_destroy(sc->vge_ldata.vge_rx_list_tag); - } - - /* Unload and free the TX DMA ring memory and map */ - - if (sc->vge_ldata.vge_tx_list_tag) { - bus_dmamap_unload(sc->vge_ldata.vge_tx_list_tag, - sc->vge_ldata.vge_tx_list_map); - bus_dmamem_free(sc->vge_ldata.vge_tx_list_tag, - sc->vge_ldata.vge_tx_list, - sc->vge_ldata.vge_tx_list_map); - bus_dma_tag_destroy(sc->vge_ldata.vge_tx_list_tag); - } - - /* Destroy all the RX and TX buffer maps */ - - if (sc->vge_ldata.vge_mtag) { - for (i = 0; i < VGE_TX_DESC_CNT; i++) - bus_dmamap_destroy(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_tx_dmamap[i]); - for (i = 0; i < VGE_RX_DESC_CNT; i++) - bus_dmamap_destroy(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_rx_dmamap[i]); - bus_dma_tag_destroy(sc->vge_ldata.vge_mtag); - } - - if (sc->vge_parent_tag) - bus_dma_tag_destroy(sc->vge_parent_tag); - + vge_dma_free(sc); mtx_destroy(&sc->vge_mtx); return (0); } -static int -vge_newbuf(sc, idx, m) - struct vge_softc *sc; - int idx; - struct mbuf *m; +static void +vge_discard_rxbuf(struct vge_softc *sc, int prod) { - struct vge_dmaload_arg arg; - struct mbuf *n = NULL; - int i, error; + struct vge_rxdesc *rxd; + int i; - if (m == NULL) { - n = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - if (n == NULL) - return (ENOBUFS); - m = n; - } else - m->m_data = m->m_ext.ext_buf; - - -#ifdef VGE_FIXUP_RX - /* - * This is part of an evil trick to deal with non-x86 platforms. - * The VIA chip requires RX buffers to be aligned on 32-bit - * boundaries, but that will hose non-x86 machines. To get around - * this, we leave some empty space at the start of each buffer - * and for non-x86 hosts, we copy the buffer back two bytes - * to achieve word alignment. This is slightly more efficient - * than allocating a new buffer, copying the contents, and - * discarding the old buffer. - */ - m->m_len = m->m_pkthdr.len = MCLBYTES - VGE_ETHER_ALIGN; - m_adj(m, VGE_ETHER_ALIGN); -#else - m->m_len = m->m_pkthdr.len = MCLBYTES; -#endif - - arg.sc = sc; - arg.vge_idx = idx; - arg.vge_maxsegs = 1; - arg.vge_flags = 0; - - error = bus_dmamap_load_mbuf(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_rx_dmamap[idx], m, vge_dma_map_rx_desc, - &arg, BUS_DMA_NOWAIT); - if (error || arg.vge_maxsegs != 1) { - if (n != NULL) - m_freem(n); - return (ENOMEM); - } + rxd = &sc->vge_cdata.vge_rxdesc[prod]; + rxd->rx_desc->vge_sts = 0; + rxd->rx_desc->vge_ctl = 0; /* * Note: the manual fails to document the fact that for @@ -1228,79 +1209,197 @@ vge_newbuf(sc, idx, m) * but we should not set the OWN bits until we're ready * to hand back 4 of them in one shot. */ + if ((prod % VGE_RXCHUNK) == (VGE_RXCHUNK - 1)) { + for (i = VGE_RXCHUNK; i > 0; i--) { + rxd->rx_desc->vge_sts = htole32(VGE_RDSTS_OWN); + rxd = rxd->rxd_prev; + } + sc->vge_cdata.vge_rx_commit += VGE_RXCHUNK; + } +} -#define VGE_RXCHUNK 4 - sc->vge_rx_consumed++; - if (sc->vge_rx_consumed == VGE_RXCHUNK) { - for (i = idx; i != idx - sc->vge_rx_consumed; i--) - sc->vge_ldata.vge_rx_list[i].vge_sts |= - htole32(VGE_RDSTS_OWN); - sc->vge_rx_consumed = 0; +static int +vge_newbuf(struct vge_softc *sc, int prod) +{ + struct vge_rxdesc *rxd; + struct mbuf *m; + bus_dma_segment_t segs[1]; + bus_dmamap_t map; + int i, nsegs; + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); + /* + * This is part of an evil trick to deal with strict-alignment + * architectures. The VIA chip requires RX buffers to be aligned + * on 32-bit boundaries, but that will hose strict-alignment + * architectures. To get around this, we leave some empty space + * at the start of each buffer and for non-strict-alignment hosts, + * we copy the buffer back two bytes to achieve word alignment. + * This is slightly more efficient than allocating a new buffer, + * copying the contents, and discarding the old buffer. + */ + m->m_len = m->m_pkthdr.len = MCLBYTES; + m_adj(m, VGE_RX_BUF_ALIGN); + + if (bus_dmamap_load_mbuf_sg(sc->vge_cdata.vge_rx_tag, + sc->vge_cdata.vge_rx_sparemap, m, segs, &nsegs, 0) != 0) { + m_freem(m); + return (ENOBUFS); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + rxd = &sc->vge_cdata.vge_rxdesc[prod]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(sc->vge_cdata.vge_rx_tag, rxd->rx_dmamap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->vge_cdata.vge_rx_tag, rxd->rx_dmamap); + } + map = rxd->rx_dmamap; + rxd->rx_dmamap = sc->vge_cdata.vge_rx_sparemap; + sc->vge_cdata.vge_rx_sparemap = map; + bus_dmamap_sync(sc->vge_cdata.vge_rx_tag, rxd->rx_dmamap, + BUS_DMASYNC_PREREAD); + rxd->rx_m = m; + + rxd->rx_desc->vge_sts = 0; + rxd->rx_desc->vge_ctl = 0; + rxd->rx_desc->vge_addrlo = htole32(VGE_ADDR_LO(segs[0].ds_addr)); + rxd->rx_desc->vge_addrhi = htole32(VGE_ADDR_HI(segs[0].ds_addr) | + (VGE_BUFLEN(segs[0].ds_len) << 16) | VGE_RXDESC_I); + + /* + * Note: the manual fails to document the fact that for + * proper operation, the driver needs to replenish the RX + * DMA ring 4 descriptors at a time (rather than one at a + * time, like most chips). We can allocate the new buffers + * but we should not set the OWN bits until we're ready + * to hand back 4 of them in one shot. + */ + if ((prod % VGE_RXCHUNK) == (VGE_RXCHUNK - 1)) { + for (i = VGE_RXCHUNK; i > 0; i--) { + rxd->rx_desc->vge_sts = htole32(VGE_RDSTS_OWN); + rxd = rxd->rxd_prev; + } + sc->vge_cdata.vge_rx_commit += VGE_RXCHUNK; } - sc->vge_ldata.vge_rx_mbuf[idx] = m; + return (0); +} - bus_dmamap_sync(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_rx_dmamap[idx], - BUS_DMASYNC_PREREAD); +static int +vge_tx_list_init(struct vge_softc *sc) +{ + struct vge_ring_data *rd; + struct vge_txdesc *txd; + int i; + + VGE_LOCK_ASSERT(sc); + + sc->vge_cdata.vge_tx_prodidx = 0; + sc->vge_cdata.vge_tx_considx = 0; + sc->vge_cdata.vge_tx_cnt = 0; + + rd = &sc->vge_rdata; + bzero(rd->vge_tx_ring, VGE_TX_LIST_SZ); + for (i = 0; i < VGE_TX_DESC_CNT; i++) { + txd = &sc->vge_cdata.vge_txdesc[i]; + txd->tx_m = NULL; + txd->tx_desc = &rd->vge_tx_ring[i]; + } + + bus_dmamap_sync(sc->vge_cdata.vge_tx_ring_tag, + sc->vge_cdata.vge_tx_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } static int -vge_tx_list_init(sc) - struct vge_softc *sc; +vge_rx_list_init(struct vge_softc *sc) { - bzero ((char *)sc->vge_ldata.vge_tx_list, VGE_TX_LIST_SZ); - bzero ((char *)&sc->vge_ldata.vge_tx_mbuf, - (VGE_TX_DESC_CNT * sizeof(struct mbuf *))); + struct vge_ring_data *rd; + struct vge_rxdesc *rxd; + int i; - bus_dmamap_sync(sc->vge_ldata.vge_tx_list_tag, - sc->vge_ldata.vge_tx_list_map, BUS_DMASYNC_PREWRITE); - sc->vge_ldata.vge_tx_prodidx = 0; - sc->vge_ldata.vge_tx_considx = 0; - sc->vge_ldata.vge_tx_free = VGE_TX_DESC_CNT; + VGE_LOCK_ASSERT(sc); - return (0); -} - -static int -vge_rx_list_init(sc) - struct vge_softc *sc; -{ - int i; - - bzero ((char *)sc->vge_ldata.vge_rx_list, VGE_RX_LIST_SZ); - bzero ((char *)&sc->vge_ldata.vge_rx_mbuf, - (VGE_RX_DESC_CNT * sizeof(struct mbuf *))); - - sc->vge_rx_consumed = 0; + sc->vge_cdata.vge_rx_prodidx = 0; + sc->vge_cdata.vge_head = NULL; + sc->vge_cdata.vge_tail = NULL; + sc->vge_cdata.vge_rx_commit = 0; + rd = &sc->vge_rdata; + bzero(rd->vge_rx_ring, VGE_RX_LIST_SZ); for (i = 0; i < VGE_RX_DESC_CNT; i++) { - if (vge_newbuf(sc, i, NULL) == ENOBUFS) + rxd = &sc->vge_cdata.vge_rxdesc[i]; + rxd->rx_m = NULL; + rxd->rx_desc = &rd->vge_rx_ring[i]; + if (i == 0) + rxd->rxd_prev = + &sc->vge_cdata.vge_rxdesc[VGE_RX_DESC_CNT - 1]; + else + rxd->rxd_prev = &sc->vge_cdata.vge_rxdesc[i - 1]; + if (vge_newbuf(sc, i) != 0) return (ENOBUFS); } - /* Flush the RX descriptors */ + bus_dmamap_sync(sc->vge_cdata.vge_rx_ring_tag, + sc->vge_cdata.vge_rx_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - bus_dmamap_sync(sc->vge_ldata.vge_rx_list_tag, - sc->vge_ldata.vge_rx_list_map, - BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); - - sc->vge_ldata.vge_rx_prodidx = 0; - sc->vge_rx_consumed = 0; - sc->vge_head = sc->vge_tail = NULL; + sc->vge_cdata.vge_rx_commit = 0; return (0); } -#ifdef VGE_FIXUP_RX -static __inline void -vge_fixup_rx(m) - struct mbuf *m; +static void +vge_freebufs(struct vge_softc *sc) { - int i; - uint16_t *src, *dst; + struct vge_txdesc *txd; + struct vge_rxdesc *rxd; + struct ifnet *ifp; + int i; + + VGE_LOCK_ASSERT(sc); + + ifp = sc->vge_ifp; + /* + * Free RX and TX mbufs still in the queues. + */ + for (i = 0; i < VGE_RX_DESC_CNT; i++) { + rxd = &sc->vge_cdata.vge_rxdesc[i]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(sc->vge_cdata.vge_rx_tag, + rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->vge_cdata.vge_rx_tag, + rxd->rx_dmamap); + m_freem(rxd->rx_m); + rxd->rx_m = NULL; + } + } + + for (i = 0; i < VGE_TX_DESC_CNT; i++) { + txd = &sc->vge_cdata.vge_txdesc[i]; + if (txd->tx_m != NULL) { + bus_dmamap_sync(sc->vge_cdata.vge_tx_tag, + txd->tx_dmamap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->vge_cdata.vge_tx_tag, + txd->tx_dmamap); + m_freem(txd->tx_m); + txd->tx_m = NULL; + ifp->if_oerrors++; + } + } +} + +#ifndef __NO_STRICT_ALIGNMENT +static __inline void +vge_fixup_rx(struct mbuf *m) +{ + int i; + uint16_t *src, *dst; src = mtod(m, uint16_t *); dst = src - 1; @@ -1309,8 +1408,6 @@ vge_fixup_rx(m) *dst++ = *src++; m->m_data -= ETHER_ALIGN; - - return; } #endif @@ -1319,49 +1416,37 @@ vge_fixup_rx(m) * been fragmented across multiple 2K mbuf cluster buffers. */ static int -vge_rxeof(sc) - struct vge_softc *sc; +vge_rxeof(struct vge_softc *sc, int count) { - struct mbuf *m; - struct ifnet *ifp; - int i, total_len; - int lim = 0; - struct vge_rx_desc *cur_rx; - u_int32_t rxstat, rxctl; + struct mbuf *m; + struct ifnet *ifp; + int prod, prog, total_len; + struct vge_rxdesc *rxd; + struct vge_rx_desc *cur_rx; + uint32_t rxstat, rxctl; VGE_LOCK_ASSERT(sc); + ifp = sc->vge_ifp; - i = sc->vge_ldata.vge_rx_prodidx; - /* Invalidate the descriptor memory */ + bus_dmamap_sync(sc->vge_cdata.vge_rx_ring_tag, + sc->vge_cdata.vge_rx_ring_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - bus_dmamap_sync(sc->vge_ldata.vge_rx_list_tag, - sc->vge_ldata.vge_rx_list_map, - BUS_DMASYNC_POSTREAD); - - while (!VGE_OWN(&sc->vge_ldata.vge_rx_list[i])) { - -#ifdef DEVICE_POLLING - if (ifp->if_capenable & IFCAP_POLLING) { - if (sc->rxcycles <= 0) - break; - sc->rxcycles--; - } -#endif - - cur_rx = &sc->vge_ldata.vge_rx_list[i]; - m = sc->vge_ldata.vge_rx_mbuf[i]; - total_len = VGE_RXBYTES(cur_rx); + prod = sc->vge_cdata.vge_rx_prodidx; + for (prog = 0; count > 0 && + (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0; + VGE_RX_DESC_INC(prod)) { + cur_rx = &sc->vge_rdata.vge_rx_ring[prod]; rxstat = le32toh(cur_rx->vge_sts); + if ((rxstat & VGE_RDSTS_OWN) != 0) + break; + count--; + prog++; rxctl = le32toh(cur_rx->vge_ctl); - - /* Invalidate the RX mbuf and unload its map */ - - bus_dmamap_sync(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_rx_dmamap[i], - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_rx_dmamap[i]); + total_len = VGE_RXBYTES(rxstat); + rxd = &sc->vge_cdata.vge_rxdesc[prod]; + m = rxd->rx_m; /* * If the 'start of frame' bit is set, this indicates @@ -1369,17 +1454,22 @@ vge_rxeof(sc) * or an intermediate fragment. Either way, we want to * accumulate the buffers. */ - if (rxstat & VGE_RXPKT_SOF) { - m->m_len = MCLBYTES - VGE_ETHER_ALIGN; - if (sc->vge_head == NULL) - sc->vge_head = sc->vge_tail = m; - else { - m->m_flags &= ~M_PKTHDR; - sc->vge_tail->m_next = m; - sc->vge_tail = m; + if ((rxstat & VGE_RXPKT_SOF) != 0) { + if (vge_newbuf(sc, prod) != 0) { + ifp->if_iqdrops++; + VGE_CHAIN_RESET(sc); + vge_discard_rxbuf(sc, prod); + continue; + } + m->m_len = MCLBYTES - VGE_RX_BUF_ALIGN; + if (sc->vge_cdata.vge_head == NULL) { + sc->vge_cdata.vge_head = m; + sc->vge_cdata.vge_tail = m; + } else { + m->m_flags &= ~M_PKTHDR; + sc->vge_cdata.vge_tail->m_next = m; + sc->vge_cdata.vge_tail = m; } - vge_newbuf(sc, i, NULL); - VGE_RX_DESC_INC(i); continue; } @@ -1391,43 +1481,32 @@ vge_rxeof(sc) * a 'VLAN CAM filter miss' and clears the 'RXOK' bit. * We don't want to drop the frame though: our VLAN * filtering is done in software. + * We also want to receive bad-checksummed frames and + * and frames with bad-length. */ - if (!(rxstat & VGE_RDSTS_RXOK) && !(rxstat & VGE_RDSTS_VIDM) - && !(rxstat & VGE_RDSTS_CSUMERR)) { + if ((rxstat & VGE_RDSTS_RXOK) == 0 && + (rxstat & (VGE_RDSTS_VIDM | VGE_RDSTS_RLERR | + VGE_RDSTS_CSUMERR)) == 0) { ifp->if_ierrors++; /* * If this is part of a multi-fragment packet, * discard all the pieces. */ - if (sc->vge_head != NULL) { - m_freem(sc->vge_head); - sc->vge_head = sc->vge_tail = NULL; - } - vge_newbuf(sc, i, m); - VGE_RX_DESC_INC(i); + VGE_CHAIN_RESET(sc); + vge_discard_rxbuf(sc, prod); continue; } - /* - * If allocating a replacement mbuf fails, - * reload the current one. - */ - - if (vge_newbuf(sc, i, NULL)) { - ifp->if_ierrors++; - if (sc->vge_head != NULL) { - m_freem(sc->vge_head); - sc->vge_head = sc->vge_tail = NULL; - } - vge_newbuf(sc, i, m); - VGE_RX_DESC_INC(i); + if (vge_newbuf(sc, prod) != 0) { + ifp->if_iqdrops++; + VGE_CHAIN_RESET(sc); + vge_discard_rxbuf(sc, prod); continue; } - VGE_RX_DESC_INC(i); - - if (sc->vge_head != NULL) { - m->m_len = total_len % (MCLBYTES - VGE_ETHER_ALIGN); + /* Chain received mbufs. */ + if (sc->vge_cdata.vge_head != NULL) { + m->m_len = total_len % (MCLBYTES - VGE_RX_BUF_ALIGN); /* * Special case: if there's 4 bytes or less * in this buffer, the mbuf can be discarded: @@ -1435,46 +1514,47 @@ vge_rxeof(sc) * care about anyway. */ if (m->m_len <= ETHER_CRC_LEN) { - sc->vge_tail->m_len -= + sc->vge_cdata.vge_tail->m_len -= (ETHER_CRC_LEN - m->m_len); m_freem(m); } else { m->m_len -= ETHER_CRC_LEN; m->m_flags &= ~M_PKTHDR; - sc->vge_tail->m_next = m; + sc->vge_cdata.vge_tail->m_next = m; } - m = sc->vge_head; - sc->vge_head = sc->vge_tail = NULL; + m = sc->vge_cdata.vge_head; + m->m_flags |= M_PKTHDR; m->m_pkthdr.len = total_len - ETHER_CRC_LEN; - } else + } else { + m->m_flags |= M_PKTHDR; m->m_pkthdr.len = m->m_len = (total_len - ETHER_CRC_LEN); + } -#ifdef VGE_FIXUP_RX +#ifndef __NO_STRICT_ALIGNMENT vge_fixup_rx(m); #endif - ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; /* Do RX checksumming if enabled */ - if (ifp->if_capenable & IFCAP_RXCSUM) { - + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0 && + (rxctl & VGE_RDCTL_FRAG) == 0) { /* Check IP header checksum */ - if (rxctl & VGE_RDCTL_IPPKT) + if ((rxctl & VGE_RDCTL_IPPKT) != 0) m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - if (rxctl & VGE_RDCTL_IPCSUMOK) + if ((rxctl & VGE_RDCTL_IPCSUMOK) != 0) m->m_pkthdr.csum_flags |= CSUM_IP_VALID; /* Check TCP/UDP checksum */ - if (rxctl & (VGE_RDCTL_TCPPKT|VGE_RDCTL_UDPPKT) && + if (rxctl & (VGE_RDCTL_TCPPKT | VGE_RDCTL_UDPPKT) && rxctl & VGE_RDCTL_PROTOCSUMOK) { m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID|CSUM_PSEUDO_HDR; + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } } - if (rxstat & VGE_RDSTS_VTAG) { + if ((rxstat & VGE_RDSTS_VTAG) != 0) { /* * The 32-bit rxctl register is stored in little-endian. * However, the 16-bit vlan tag is stored in big-endian, @@ -1488,120 +1568,107 @@ vge_rxeof(sc) VGE_UNLOCK(sc); (*ifp->if_input)(ifp, m); VGE_LOCK(sc); - - lim++; - if (lim == VGE_RX_DESC_CNT) - break; - + sc->vge_cdata.vge_head = NULL; + sc->vge_cdata.vge_tail = NULL; } - /* Flush the RX DMA ring */ - - bus_dmamap_sync(sc->vge_ldata.vge_rx_list_tag, - sc->vge_ldata.vge_rx_list_map, - BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); - - sc->vge_ldata.vge_rx_prodidx = i; - CSR_WRITE_2(sc, VGE_RXDESC_RESIDUECNT, lim); - - - return (lim); + if (prog > 0) { + sc->vge_cdata.vge_rx_prodidx = prod; + bus_dmamap_sync(sc->vge_cdata.vge_rx_ring_tag, + sc->vge_cdata.vge_rx_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* Update residue counter. */ + if (sc->vge_cdata.vge_rx_commit != 0) { + CSR_WRITE_2(sc, VGE_RXDESC_RESIDUECNT, + sc->vge_cdata.vge_rx_commit); + sc->vge_cdata.vge_rx_commit = 0; + } + } + return (prog); } static void -vge_txeof(sc) - struct vge_softc *sc; +vge_txeof(struct vge_softc *sc) { - struct ifnet *ifp; - u_int32_t txstat; - int idx; + struct ifnet *ifp; + struct vge_tx_desc *cur_tx; + struct vge_txdesc *txd; + uint32_t txstat; + int cons, prod; + + VGE_LOCK_ASSERT(sc); ifp = sc->vge_ifp; - idx = sc->vge_ldata.vge_tx_considx; - /* Invalidate the TX descriptor list */ + if (sc->vge_cdata.vge_tx_cnt == 0) + return; - bus_dmamap_sync(sc->vge_ldata.vge_tx_list_tag, - sc->vge_ldata.vge_tx_list_map, - BUS_DMASYNC_POSTREAD); - - while (idx != sc->vge_ldata.vge_tx_prodidx) { - - txstat = le32toh(sc->vge_ldata.vge_tx_list[idx].vge_sts); - if (txstat & VGE_TDSTS_OWN) - break; - - m_freem(sc->vge_ldata.vge_tx_mbuf[idx]); - sc->vge_ldata.vge_tx_mbuf[idx] = NULL; - bus_dmamap_unload(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_tx_dmamap[idx]); - if (txstat & (VGE_TDSTS_EXCESSCOLL|VGE_TDSTS_COLL)) - ifp->if_collisions++; - if (txstat & VGE_TDSTS_TXERR) - ifp->if_oerrors++; - else - ifp->if_opackets++; - - sc->vge_ldata.vge_tx_free++; - VGE_TX_DESC_INC(idx); - } - - /* No changes made to the TX ring, so no flush needed */ - - if (idx != sc->vge_ldata.vge_tx_considx) { - sc->vge_ldata.vge_tx_considx = idx; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_timer = 0; - } + bus_dmamap_sync(sc->vge_cdata.vge_tx_ring_tag, + sc->vge_cdata.vge_tx_ring_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* - * If not all descriptors have been released reaped yet, - * reload the timer so that we will eventually get another - * interrupt that will cause us to re-enter this routine. - * This is done in case the transmitter has gone idle. + * Go through our tx list and free mbufs for those + * frames that have been transmitted. */ - if (sc->vge_ldata.vge_tx_free != VGE_TX_DESC_CNT) { - CSR_WRITE_1(sc, VGE_CRS1, VGE_CR1_TIMER0_ENABLE); - } + cons = sc->vge_cdata.vge_tx_considx; + prod = sc->vge_cdata.vge_tx_prodidx; + for (; cons != prod; VGE_TX_DESC_INC(cons)) { + cur_tx = &sc->vge_rdata.vge_tx_ring[cons]; + txstat = le32toh(cur_tx->vge_sts); + if ((txstat & VGE_TDSTS_OWN) != 0) + break; + sc->vge_cdata.vge_tx_cnt--; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - return; + txd = &sc->vge_cdata.vge_txdesc[cons]; + bus_dmamap_sync(sc->vge_cdata.vge_tx_tag, txd->tx_dmamap, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->vge_cdata.vge_tx_tag, txd->tx_dmamap); + + KASSERT(txd->tx_m != NULL, ("%s: freeing NULL mbuf!\n", + __func__)); + m_freem(txd->tx_m); + txd->tx_m = NULL; + txd->tx_desc->vge_frag[0].vge_addrhi = 0; + } + bus_dmamap_sync(sc->vge_cdata.vge_tx_ring_tag, + sc->vge_cdata.vge_tx_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + sc->vge_cdata.vge_tx_considx = cons; + if (sc->vge_cdata.vge_tx_cnt == 0) + sc->vge_timer = 0; } static void -vge_tick(xsc) - void *xsc; +vge_link_statchg(void *xsc) { - struct vge_softc *sc; - struct ifnet *ifp; - struct mii_data *mii; + struct vge_softc *sc; + struct ifnet *ifp; + struct mii_data *mii; sc = xsc; ifp = sc->vge_ifp; - VGE_LOCK(sc); + VGE_LOCK_ASSERT(sc); mii = device_get_softc(sc->vge_miibus); - mii_tick(mii); - if (sc->vge_link) { + mii_pollstat(mii); + if ((sc->vge_flags & VGE_FLAG_LINK) != 0) { if (!(mii->mii_media_status & IFM_ACTIVE)) { - sc->vge_link = 0; + sc->vge_flags &= ~VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_DOWN); } } else { if (mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - sc->vge_link = 1; + sc->vge_flags |= VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_UP); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - taskqueue_enqueue(taskqueue_swi, - &sc->vge_txtask); + vge_start_locked(ifp); } } - - VGE_UNLOCK(sc); - - return; } #ifdef DEVICE_POLLING @@ -1615,15 +1682,14 @@ vge_poll (struct ifnet *ifp, enum poll_cmd cmd, int count) if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) goto done; - sc->rxcycles = count; - rx_npkts = vge_rxeof(sc); + rx_npkts = vge_rxeof(sc, count); vge_txeof(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - taskqueue_enqueue(taskqueue_swi, &sc->vge_txtask); + vge_start_locked(ifp); if (cmd == POLL_AND_CHECK_STATUS) { /* also check status register */ - u_int32_t status; + uint32_t status; status = CSR_READ_4(sc, VGE_ISR); if (status == 0xFFFFFFFF) goto done; @@ -1635,12 +1701,13 @@ vge_poll (struct ifnet *ifp, enum poll_cmd cmd, int count) */ if (status & VGE_ISR_TXDMA_STALL || - status & VGE_ISR_RXDMA_STALL) - vge_init(sc); + status & VGE_ISR_RXDMA_STALL) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vge_init_locked(sc); + } if (status & (VGE_ISR_RXOFLOW|VGE_ISR_RXNODESC)) { - vge_rxeof(sc); - ifp->if_ierrors++; + vge_rxeof(sc, count); CSR_WRITE_1(sc, VGE_RXQCSRS, VGE_RXQCSR_RUN); CSR_WRITE_1(sc, VGE_RXQCSRS, VGE_RXQCSR_WAK); } @@ -1652,23 +1719,18 @@ done: #endif /* DEVICE_POLLING */ static void -vge_intr(arg) - void *arg; +vge_intr(void *arg) { - struct vge_softc *sc; - struct ifnet *ifp; - u_int32_t status; + struct vge_softc *sc; + struct ifnet *ifp; + uint32_t status; sc = arg; - - if (sc->suspended) { - return; - } - VGE_LOCK(sc); - ifp = sc->vge_ifp; - if (!(ifp->if_flags & IFF_UP)) { + ifp = sc->vge_ifp; + if ((sc->vge_flags & VGE_FLAG_SUSPENDED) != 0 || + (ifp->if_flags & IFF_UP) == 0) { VGE_UNLOCK(sc); return; } @@ -1682,189 +1744,223 @@ vge_intr(arg) /* Disable interrupts */ CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); - - for (;;) { - - status = CSR_READ_4(sc, VGE_ISR); - /* If the card has gone away the read returns 0xffff. */ - if (status == 0xFFFFFFFF) - break; - - if (status) - CSR_WRITE_4(sc, VGE_ISR, status); - - if ((status & VGE_INTRS) == 0) - break; - + status = CSR_READ_4(sc, VGE_ISR); + CSR_WRITE_4(sc, VGE_ISR, status | VGE_ISR_HOLDOFF_RELOAD); + /* If the card has gone away the read returns 0xffff. */ + if (status == 0xFFFFFFFF || (status & VGE_INTRS) == 0) + goto done; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { if (status & (VGE_ISR_RXOK|VGE_ISR_RXOK_HIPRIO)) - vge_rxeof(sc); - + vge_rxeof(sc, VGE_RX_DESC_CNT); if (status & (VGE_ISR_RXOFLOW|VGE_ISR_RXNODESC)) { - vge_rxeof(sc); + vge_rxeof(sc, VGE_RX_DESC_CNT); CSR_WRITE_1(sc, VGE_RXQCSRS, VGE_RXQCSR_RUN); CSR_WRITE_1(sc, VGE_RXQCSRS, VGE_RXQCSR_WAK); } - if (status & (VGE_ISR_TXOK0|VGE_ISR_TIMER0)) + if (status & (VGE_ISR_TXOK0|VGE_ISR_TXOK_HIPRIO)) vge_txeof(sc); - if (status & (VGE_ISR_TXDMA_STALL|VGE_ISR_RXDMA_STALL)) - vge_init(sc); + if (status & (VGE_ISR_TXDMA_STALL|VGE_ISR_RXDMA_STALL)) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vge_init_locked(sc); + } if (status & VGE_ISR_LINKSTS) - vge_tick(sc); + vge_link_statchg(sc); } +done: + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + /* Re-enable interrupts */ + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); - /* Re-enable interrupts */ - CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); - + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + vge_start_locked(ifp); + } VGE_UNLOCK(sc); - - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - taskqueue_enqueue(taskqueue_swi, &sc->vge_txtask); - - return; } static int -vge_encap(sc, m_head, idx) - struct vge_softc *sc; - struct mbuf *m_head; - int idx; +vge_encap(struct vge_softc *sc, struct mbuf **m_head) { - struct mbuf *m_new = NULL; - struct vge_dmaload_arg arg; - bus_dmamap_t map; - int error; + struct vge_txdesc *txd; + struct vge_tx_frag *frag; + struct mbuf *m; + bus_dma_segment_t txsegs[VGE_MAXTXSEGS]; + int error, i, nsegs, padlen; + uint32_t cflags; - if (sc->vge_ldata.vge_tx_free <= 2) - return (EFBIG); + VGE_LOCK_ASSERT(sc); - arg.vge_flags = 0; + M_ASSERTPKTHDR((*m_head)); - if (m_head->m_pkthdr.csum_flags & CSUM_IP) - arg.vge_flags |= VGE_TDCTL_IPCSUM; - if (m_head->m_pkthdr.csum_flags & CSUM_TCP) - arg.vge_flags |= VGE_TDCTL_TCPCSUM; - if (m_head->m_pkthdr.csum_flags & CSUM_UDP) - arg.vge_flags |= VGE_TDCTL_UDPCSUM; - - arg.sc = sc; - arg.vge_idx = idx; - arg.vge_m0 = m_head; - arg.vge_maxsegs = VGE_TX_FRAGS; - - map = sc->vge_ldata.vge_tx_dmamap[idx]; - error = bus_dmamap_load_mbuf(sc->vge_ldata.vge_mtag, map, - m_head, vge_dma_map_tx_desc, &arg, BUS_DMA_NOWAIT); - - if (error && error != EFBIG) { - printf("vge%d: can't map mbuf (error %d)\n", - sc->vge_unit, error); - return (ENOBUFS); - } - - /* Too many segments to map, coalesce into a single mbuf */ - - if (error || arg.vge_maxsegs == 0) { - m_new = m_defrag(m_head, M_DONTWAIT); - if (m_new == NULL) - return (1); - else - m_head = m_new; - - arg.sc = sc; - arg.vge_m0 = m_head; - arg.vge_idx = idx; - arg.vge_maxsegs = 1; - - error = bus_dmamap_load_mbuf(sc->vge_ldata.vge_mtag, map, - m_head, vge_dma_map_tx_desc, &arg, BUS_DMA_NOWAIT); - if (error) { - printf("vge%d: can't map mbuf (error %d)\n", - sc->vge_unit, error); - return (EFBIG); + /* Argh. This chip does not autopad short frames. */ + if ((*m_head)->m_pkthdr.len < VGE_MIN_FRAMELEN) { + m = *m_head; + padlen = VGE_MIN_FRAMELEN - m->m_pkthdr.len; + if (M_WRITABLE(m) == 0) { + /* Get a writable copy. */ + m = m_dup(*m_head, M_DONTWAIT); + m_freem(*m_head); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; } + if (M_TRAILINGSPACE(m) < padlen) { + m = m_defrag(m, M_DONTWAIT); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + } + /* + * Manually pad short frames, and zero the pad space + * to avoid leaking data. + */ + bzero(mtod(m, char *) + m->m_pkthdr.len, padlen); + m->m_pkthdr.len += padlen; + m->m_len = m->m_pkthdr.len; + *m_head = m; } - sc->vge_ldata.vge_tx_mbuf[idx] = m_head; - sc->vge_ldata.vge_tx_free--; + txd = &sc->vge_cdata.vge_txdesc[sc->vge_cdata.vge_tx_prodidx]; + + error = bus_dmamap_load_mbuf_sg(sc->vge_cdata.vge_tx_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, 0); + if (error == EFBIG) { + m = m_collapse(*m_head, M_DONTWAIT, VGE_MAXTXSEGS); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOMEM); + } + *m_head = m; + error = bus_dmamap_load_mbuf_sg(sc->vge_cdata.vge_tx_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, 0); + if (error != 0) { + m_freem(*m_head); + *m_head = NULL; + return (error); + } + } else if (error != 0) + return (error); + bus_dmamap_sync(sc->vge_cdata.vge_tx_tag, txd->tx_dmamap, + BUS_DMASYNC_PREWRITE); + + m = *m_head; + cflags = 0; + + /* Configure checksum offload. */ + if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) + cflags |= VGE_TDCTL_IPCSUM; + if ((m->m_pkthdr.csum_flags & CSUM_TCP) != 0) + cflags |= VGE_TDCTL_TCPCSUM; + if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0) + cflags |= VGE_TDCTL_UDPCSUM; + + /* Configure VLAN. */ + if ((m->m_flags & M_VLANTAG) != 0) + cflags |= m->m_pkthdr.ether_vtag | VGE_TDCTL_VTAG; + txd->tx_desc->vge_sts = htole32(m->m_pkthdr.len << 16); + /* + * XXX + * Velocity family seems to support TSO but no information + * for MSS configuration is available. Also the number of + * fragments supported by a descriptor is too small to hold + * entire 64KB TCP/IP segment. Maybe VGE_TD_LS_MOF, + * VGE_TD_LS_SOF and VGE_TD_LS_EOF could be used to build + * longer chain of buffers but no additional information is + * available. + * + * When telling the chip how many segments there are, we + * must use nsegs + 1 instead of just nsegs. Darned if I + * know why. This also means we can't use the last fragment + * field of Tx descriptor. + */ + txd->tx_desc->vge_ctl = htole32(cflags | ((nsegs + 1) << 28) | + VGE_TD_LS_NORM); + for (i = 0; i < nsegs; i++) { + frag = &txd->tx_desc->vge_frag[i]; + frag->vge_addrlo = htole32(VGE_ADDR_LO(txsegs[i].ds_addr)); + frag->vge_addrhi = htole32(VGE_ADDR_HI(txsegs[i].ds_addr) | + (VGE_BUFLEN(txsegs[i].ds_len) << 16)); + } + + sc->vge_cdata.vge_tx_cnt++; + VGE_TX_DESC_INC(sc->vge_cdata.vge_tx_prodidx); /* - * Set up hardware VLAN tagging. + * Finally request interrupt and give the first descriptor + * ownership to hardware. */ - - if (m_head->m_flags & M_VLANTAG) - sc->vge_ldata.vge_tx_list[idx].vge_ctl |= - htole32(m_head->m_pkthdr.ether_vtag | VGE_TDCTL_VTAG); - - sc->vge_ldata.vge_tx_list[idx].vge_sts |= htole32(VGE_TDSTS_OWN); + txd->tx_desc->vge_ctl |= htole32(VGE_TDCTL_TIC); + txd->tx_desc->vge_sts |= htole32(VGE_TDSTS_OWN); + txd->tx_m = m; return (0); } -static void -vge_tx_task(arg, npending) - void *arg; - int npending; -{ - struct ifnet *ifp; - - ifp = arg; - vge_start(ifp); - - return; -} - /* * Main transmit routine. */ static void -vge_start(ifp) - struct ifnet *ifp; +vge_start(struct ifnet *ifp) { - struct vge_softc *sc; - struct mbuf *m_head = NULL; - int idx, pidx = 0; + struct vge_softc *sc; sc = ifp->if_softc; VGE_LOCK(sc); + vge_start_locked(ifp); + VGE_UNLOCK(sc); +} - if (!sc->vge_link || ifp->if_drv_flags & IFF_DRV_OACTIVE) { - VGE_UNLOCK(sc); + +static void +vge_start_locked(struct ifnet *ifp) +{ + struct vge_softc *sc; + struct vge_txdesc *txd; + struct mbuf *m_head; + int enq, idx; + + sc = ifp->if_softc; + + VGE_LOCK_ASSERT(sc); + + if ((sc->vge_flags & VGE_FLAG_LINK) == 0 || + (ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) return; - } - if (IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - VGE_UNLOCK(sc); - return; - } - - idx = sc->vge_ldata.vge_tx_prodidx; - - pidx = idx - 1; - if (pidx < 0) - pidx = VGE_TX_DESC_CNT - 1; - - - while (sc->vge_ldata.vge_tx_mbuf[idx] == NULL) { + idx = sc->vge_cdata.vge_tx_prodidx; + VGE_TX_DESC_DEC(idx); + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && + sc->vge_cdata.vge_tx_cnt < VGE_TX_DESC_CNT - 1; ) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; - - if (vge_encap(sc, m_head, idx)) { + /* + * Pack the data into the transmit ring. If we + * don't have room, set the OACTIVE flag and wait + * for the NIC to drain the ring. + */ + if (vge_encap(sc, &m_head)) { + if (m_head == NULL) + break; IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - sc->vge_ldata.vge_tx_list[pidx].vge_frag[0].vge_buflen |= - htole16(VGE_TXDESC_Q); - - pidx = idx; + txd = &sc->vge_cdata.vge_txdesc[idx]; + txd->tx_desc->vge_frag[0].vge_addrhi |= htole32(VGE_TXDESC_Q); VGE_TX_DESC_INC(idx); + enq++; /* * If there's a BPF listener, bounce a copy of this frame * to him. @@ -1872,55 +1968,42 @@ vge_start(ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (idx == sc->vge_ldata.vge_tx_prodidx) { - VGE_UNLOCK(sc); - return; + if (enq > 0) { + bus_dmamap_sync(sc->vge_cdata.vge_tx_ring_tag, + sc->vge_cdata.vge_tx_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* Issue a transmit command. */ + CSR_WRITE_2(sc, VGE_TXQCSRS, VGE_TXQCSR_WAK0); + /* + * Set a timeout in case the chip goes out to lunch. + */ + sc->vge_timer = 5; } - - /* Flush the TX descriptors */ - - bus_dmamap_sync(sc->vge_ldata.vge_tx_list_tag, - sc->vge_ldata.vge_tx_list_map, - BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); - - /* Issue a transmit command. */ - CSR_WRITE_2(sc, VGE_TXQCSRS, VGE_TXQCSR_WAK0); - - sc->vge_ldata.vge_tx_prodidx = idx; - - /* - * Use the countdown timer for interrupt moderation. - * 'TX done' interrupts are disabled. Instead, we reset the - * countdown timer, which will begin counting until it hits - * the value in the SSTIMER register, and then trigger an - * interrupt. Each time we set the TIMER0_ENABLE bit, the - * the timer count is reloaded. Only when the transmitter - * is idle will the timer hit 0 and an interrupt fire. - */ - CSR_WRITE_1(sc, VGE_CRS1, VGE_CR1_TIMER0_ENABLE); - - VGE_UNLOCK(sc); - - /* - * Set a timeout in case the chip goes out to lunch. - */ - ifp->if_timer = 5; - - return; } static void -vge_init(xsc) - void *xsc; +vge_init(void *xsc) { - struct vge_softc *sc = xsc; - struct ifnet *ifp = sc->vge_ifp; - struct mii_data *mii; - int i; + struct vge_softc *sc = xsc; VGE_LOCK(sc); + vge_init_locked(sc); + VGE_UNLOCK(sc); +} + +static void +vge_init_locked(struct vge_softc *sc) +{ + struct ifnet *ifp = sc->vge_ifp; + struct mii_data *mii; + int error, i; + + VGE_LOCK_ASSERT(sc); mii = device_get_softc(sc->vge_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -1931,9 +2014,14 @@ vge_init(xsc) * Initialize the RX and TX descriptors and mbufs. */ - vge_rx_list_init(sc); + error = vge_rx_list_init(sc); + if (error != 0) { + device_printf(sc->vge_dev, "no memory for Rx buffers.\n"); + return; + } vge_tx_list_init(sc); - + /* Clear MAC statistics. */ + vge_stats_clear(sc); /* Set our station address */ for (i = 0; i < ETHER_ADDR_LEN; i++) CSR_WRITE_1(sc, VGE_PAR0 + i, IF_LLADDR(sc->vge_ifp)[i]); @@ -1943,7 +2031,7 @@ vge_init(xsc) * reception of VLAN tagged frames. */ CSR_CLRBIT_1(sc, VGE_RXCFG, VGE_RXCFG_FIFO_THR|VGE_RXCFG_VTAGOPT); - CSR_SETBIT_1(sc, VGE_RXCFG, VGE_RXFIFOTHR_128BYTES|VGE_VTAG_OPT2); + CSR_SETBIT_1(sc, VGE_RXCFG, VGE_RXFIFOTHR_128BYTES); /* Set DMA burst length */ CSR_CLRBIT_1(sc, VGE_DMACFG0, VGE_DMACFG0_BURSTLEN); @@ -1964,15 +2052,20 @@ vge_init(xsc) * Note that we only use one transmit queue. */ + CSR_WRITE_4(sc, VGE_TXDESC_HIADDR, + VGE_ADDR_HI(sc->vge_rdata.vge_tx_ring_paddr)); CSR_WRITE_4(sc, VGE_TXDESC_ADDR_LO0, - VGE_ADDR_LO(sc->vge_ldata.vge_tx_list_addr)); + VGE_ADDR_LO(sc->vge_rdata.vge_tx_ring_paddr)); CSR_WRITE_2(sc, VGE_TXDESCNUM, VGE_TX_DESC_CNT - 1); CSR_WRITE_4(sc, VGE_RXDESC_ADDR_LO, - VGE_ADDR_LO(sc->vge_ldata.vge_rx_list_addr)); + VGE_ADDR_LO(sc->vge_rdata.vge_rx_ring_paddr)); CSR_WRITE_2(sc, VGE_RXDESCNUM, VGE_RX_DESC_CNT - 1); CSR_WRITE_2(sc, VGE_RXDESC_RESIDUECNT, VGE_RX_DESC_CNT); + /* Configure interrupt moderation. */ + vge_intr_holdoff(sc); + /* Enable and wake up the RX descriptor queue */ CSR_WRITE_1(sc, VGE_RXQCSRS, VGE_RXQCSR_RUN); CSR_WRITE_1(sc, VGE_RXQCSRS, VGE_RXQCSR_WAK); @@ -1980,29 +2073,12 @@ vge_init(xsc) /* Enable the TX descriptor queue */ CSR_WRITE_2(sc, VGE_TXQCSRS, VGE_TXQCSR_RUN0); - /* Set up the receive filter -- allow large frames for VLANs. */ - CSR_WRITE_1(sc, VGE_RXCTL, VGE_RXCTL_RX_UCAST|VGE_RXCTL_RX_GIANT); - - /* If we want promiscuous mode, set the allframes bit. */ - if (ifp->if_flags & IFF_PROMISC) { - CSR_SETBIT_1(sc, VGE_RXCTL, VGE_RXCTL_RX_PROMISC); - } - - /* Set capture broadcast bit to capture broadcast frames. */ - if (ifp->if_flags & IFF_BROADCAST) { - CSR_SETBIT_1(sc, VGE_RXCTL, VGE_RXCTL_RX_BCAST); - } - - /* Set multicast bit to capture multicast frames. */ - if (ifp->if_flags & IFF_MULTICAST) { - CSR_SETBIT_1(sc, VGE_RXCTL, VGE_RXCTL_RX_MCAST); - } - /* Init the cam filter. */ vge_cam_clear(sc); - /* Init the multicast filter. */ - vge_setmulti(sc); + /* Set up receiver filter. */ + vge_rxfilter(sc); + vge_setvlan(sc); /* Enable flow control */ @@ -2016,42 +2092,6 @@ vge_init(xsc) CSR_WRITE_1(sc, VGE_CRS0, VGE_CR0_TX_ENABLE|VGE_CR0_RX_ENABLE|VGE_CR0_START); - /* - * Configure one-shot timer for microsecond - * resulution and load it for 500 usecs. - */ - CSR_SETBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_TIMER0_RES); - CSR_WRITE_2(sc, VGE_SSTIMER, 400); - - /* - * Configure interrupt moderation for receive. Enable - * the holdoff counter and load it, and set the RX - * suppression count to the number of descriptors we - * want to allow before triggering an interrupt. - * The holdoff timer is in units of 20 usecs. - */ - -#ifdef notyet - CSR_WRITE_1(sc, VGE_INTCTL1, VGE_INTCTL_TXINTSUP_DISABLE); - /* Select the interrupt holdoff timer page. */ - CSR_CLRBIT_1(sc, VGE_CAMCTL, VGE_CAMCTL_PAGESEL); - CSR_SETBIT_1(sc, VGE_CAMCTL, VGE_PAGESEL_INTHLDOFF); - CSR_WRITE_1(sc, VGE_INTHOLDOFF, 10); /* ~200 usecs */ - - /* Enable use of the holdoff timer. */ - CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_HOLDOFF); - CSR_WRITE_1(sc, VGE_INTCTL1, VGE_INTCTL_SC_RELOAD); - - /* Select the RX suppression threshold page. */ - CSR_CLRBIT_1(sc, VGE_CAMCTL, VGE_CAMCTL_PAGESEL); - CSR_SETBIT_1(sc, VGE_CAMCTL, VGE_PAGESEL_RXSUPPTHR); - CSR_WRITE_1(sc, VGE_RXSUPPTHR, 64); /* interrupt after 64 packets */ - - /* Restore the page select bits. */ - CSR_CLRBIT_1(sc, VGE_CAMCTL, VGE_CAMCTL_PAGESEL); - CSR_SETBIT_1(sc, VGE_CAMCTL, VGE_PAGESEL_MAR); -#endif - #ifdef DEVICE_POLLING /* * Disable interrupts if we are polling. @@ -2066,70 +2106,66 @@ vge_init(xsc) * Enable interrupts. */ CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); - CSR_WRITE_4(sc, VGE_ISR, 0); + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); } + sc->vge_flags &= ~VGE_FLAG_LINK; mii_mediachg(mii); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - - sc->vge_if_flags = 0; - sc->vge_link = 0; - - VGE_UNLOCK(sc); - - return; + callout_reset(&sc->vge_watchdog, hz, vge_watchdog, sc); } /* * Set media options. */ static int -vge_ifmedia_upd(ifp) - struct ifnet *ifp; +vge_ifmedia_upd(struct ifnet *ifp) { - struct vge_softc *sc; - struct mii_data *mii; + struct vge_softc *sc; + struct mii_data *mii; + int error; sc = ifp->if_softc; VGE_LOCK(sc); mii = device_get_softc(sc->vge_miibus); - mii_mediachg(mii); + error = mii_mediachg(mii); VGE_UNLOCK(sc); - return (0); + return (error); } /* * Report current media status. */ static void -vge_ifmedia_sts(ifp, ifmr) - struct ifnet *ifp; - struct ifmediareq *ifmr; +vge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct vge_softc *sc; - struct mii_data *mii; + struct vge_softc *sc; + struct mii_data *mii; sc = ifp->if_softc; mii = device_get_softc(sc->vge_miibus); + VGE_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + VGE_UNLOCK(sc); + return; + } mii_pollstat(mii); + VGE_UNLOCK(sc); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; - - return; } static void -vge_miibus_statchg(dev) - device_t dev; +vge_miibus_statchg(device_t dev) { - struct vge_softc *sc; - struct mii_data *mii; - struct ifmedia_entry *ife; + struct vge_softc *sc; + struct mii_data *mii; + struct ifmedia_entry *ife; sc = device_get_softc(dev); mii = device_get_softc(sc->vge_miibus); @@ -2169,52 +2205,50 @@ vge_miibus_statchg(dev) IFM_SUBTYPE(ife->ifm_media)); break; } - - return; } static int -vge_ioctl(ifp, command, data) - struct ifnet *ifp; - u_long command; - caddr_t data; +vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { - struct vge_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; - struct mii_data *mii; - int error = 0; + struct vge_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *) data; + struct mii_data *mii; + int error = 0, mask; switch (command) { case SIOCSIFMTU: - if (ifr->ifr_mtu > VGE_JUMBO_MTU) + VGE_LOCK(sc); + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VGE_JUMBO_MTU) error = EINVAL; - ifp->if_mtu = ifr->ifr_mtu; + else if (ifp->if_mtu != ifr->ifr_mtu) { + if (ifr->ifr_mtu > ETHERMTU && + (sc->vge_flags & VGE_FLAG_JUMBO) == 0) + error = EINVAL; + else + ifp->if_mtu = ifr->ifr_mtu; + } + VGE_UNLOCK(sc); break; case SIOCSIFFLAGS: - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_flags & IFF_PROMISC && - !(sc->vge_if_flags & IFF_PROMISC)) { - CSR_SETBIT_1(sc, VGE_RXCTL, - VGE_RXCTL_RX_PROMISC); - vge_setmulti(sc); - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING && - !(ifp->if_flags & IFF_PROMISC) && - sc->vge_if_flags & IFF_PROMISC) { - CSR_CLRBIT_1(sc, VGE_RXCTL, - VGE_RXCTL_RX_PROMISC); - vge_setmulti(sc); - } else - vge_init(sc); - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - vge_stop(sc); - } + VGE_LOCK(sc); + if ((ifp->if_flags & IFF_UP) != 0) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && + ((ifp->if_flags ^ sc->vge_if_flags) & + (IFF_PROMISC | IFF_ALLMULTI)) != 0) + vge_rxfilter(sc); + else + vge_init_locked(sc); + } else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + vge_stop(sc); sc->vge_if_flags = ifp->if_flags; + VGE_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: - vge_setmulti(sc); + VGE_LOCK(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + vge_rxfilter(sc); + VGE_UNLOCK(sc); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: @@ -2222,14 +2256,13 @@ vge_ioctl(ifp, command, data) error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; case SIOCSIFCAP: - { - int mask = ifr->ifr_reqcap ^ ifp->if_capenable; + mask = ifr->ifr_reqcap ^ ifp->if_capenable; #ifdef DEVICE_POLLING if (mask & IFCAP_POLLING) { if (ifr->ifr_reqcap & IFCAP_POLLING) { error = ether_poll_register(vge_poll, ifp); if (error) - return(error); + return (error); VGE_LOCK(sc); /* Disable interrupts */ CSR_WRITE_4(sc, VGE_IMR, 0); @@ -2248,6 +2281,7 @@ vge_ioctl(ifp, command, data) } } #endif /* DEVICE_POLLING */ + VGE_LOCK(sc); if ((mask & IFCAP_TXCSUM) != 0 && (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { ifp->if_capenable ^= IFCAP_TXCSUM; @@ -2259,7 +2293,25 @@ vge_ioctl(ifp, command, data) if ((mask & IFCAP_RXCSUM) != 0 && (ifp->if_capabilities & IFCAP_RXCSUM) != 0) ifp->if_capenable ^= IFCAP_RXCSUM; - } + if ((mask & IFCAP_WOL_UCAST) != 0 && + (ifp->if_capabilities & IFCAP_WOL_UCAST) != 0) + ifp->if_capenable ^= IFCAP_WOL_UCAST; + if ((mask & IFCAP_WOL_MCAST) != 0 && + (ifp->if_capabilities & IFCAP_WOL_MCAST) != 0) + ifp->if_capenable ^= IFCAP_WOL_MCAST; + if ((mask & IFCAP_WOL_MAGIC) != 0 && + (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; + if ((mask & IFCAP_VLAN_HWCSUM) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (IFCAP_VLAN_HWTAGGING & ifp->if_capabilities) != 0) { + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + vge_setvlan(sc); + } + VGE_UNLOCK(sc); + VLAN_CAPABILITIES(ifp); break; default: error = ether_ioctl(ifp, command, data); @@ -2270,24 +2322,27 @@ vge_ioctl(ifp, command, data) } static void -vge_watchdog(ifp) - struct ifnet *ifp; +vge_watchdog(void *arg) { - struct vge_softc *sc; + struct vge_softc *sc; + struct ifnet *ifp; - sc = ifp->if_softc; - VGE_LOCK(sc); - printf("vge%d: watchdog timeout\n", sc->vge_unit); + sc = arg; + VGE_LOCK_ASSERT(sc); + vge_stats_update(sc); + callout_reset(&sc->vge_watchdog, hz, vge_watchdog, sc); + if (sc->vge_timer == 0 || --sc->vge_timer > 0) + return; + + ifp = sc->vge_ifp; + if_printf(ifp, "watchdog timeout\n"); ifp->if_oerrors++; vge_txeof(sc); - vge_rxeof(sc); + vge_rxeof(sc, VGE_RX_DESC_CNT); - vge_init(sc); - - VGE_UNLOCK(sc); - - return; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vge_init_locked(sc); } /* @@ -2295,15 +2350,14 @@ vge_watchdog(ifp) * RX and TX lists. */ static void -vge_stop(sc) - struct vge_softc *sc; +vge_stop(struct vge_softc *sc) { - register int i; - struct ifnet *ifp; + struct ifnet *ifp; - VGE_LOCK(sc); + VGE_LOCK_ASSERT(sc); ifp = sc->vge_ifp; - ifp->if_timer = 0; + sc->vge_timer = 0; + callout_stop(&sc->vge_watchdog); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); @@ -2314,36 +2368,10 @@ vge_stop(sc) CSR_WRITE_1(sc, VGE_RXQCSRC, 0xFF); CSR_WRITE_4(sc, VGE_RXDESC_ADDR_LO, 0); - if (sc->vge_head != NULL) { - m_freem(sc->vge_head); - sc->vge_head = sc->vge_tail = NULL; - } - - /* Free the TX list buffers. */ - - for (i = 0; i < VGE_TX_DESC_CNT; i++) { - if (sc->vge_ldata.vge_tx_mbuf[i] != NULL) { - bus_dmamap_unload(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_tx_dmamap[i]); - m_freem(sc->vge_ldata.vge_tx_mbuf[i]); - sc->vge_ldata.vge_tx_mbuf[i] = NULL; - } - } - - /* Free the RX list buffers. */ - - for (i = 0; i < VGE_RX_DESC_CNT; i++) { - if (sc->vge_ldata.vge_rx_mbuf[i] != NULL) { - bus_dmamap_unload(sc->vge_ldata.vge_mtag, - sc->vge_ldata.vge_rx_dmamap[i]); - m_freem(sc->vge_ldata.vge_rx_mbuf[i]); - sc->vge_ldata.vge_rx_mbuf[i] = NULL; - } - } - - VGE_UNLOCK(sc); - - return; + vge_stats_update(sc); + VGE_CHAIN_RESET(sc); + vge_txeof(sc); + vge_freebufs(sc); } /* @@ -2352,16 +2380,17 @@ vge_stop(sc) * resume. */ static int -vge_suspend(dev) - device_t dev; +vge_suspend(device_t dev) { - struct vge_softc *sc; + struct vge_softc *sc; sc = device_get_softc(dev); + VGE_LOCK(sc); vge_stop(sc); - - sc->suspended = 1; + vge_setwol(sc); + sc->vge_flags |= VGE_FLAG_SUSPENDED; + VGE_UNLOCK(sc); return (0); } @@ -2372,24 +2401,35 @@ vge_suspend(dev) * appropriate. */ static int -vge_resume(dev) - device_t dev; +vge_resume(device_t dev) { - struct vge_softc *sc; - struct ifnet *ifp; + struct vge_softc *sc; + struct ifnet *ifp; + uint16_t pmstat; sc = device_get_softc(dev); + VGE_LOCK(sc); + if ((sc->vge_flags & VGE_FLAG_PMCAP) != 0) { + /* Disable PME and clear PME status. */ + pmstat = pci_read_config(sc->vge_dev, + sc->vge_pmcap + PCIR_POWER_STATUS, 2); + if ((pmstat & PCIM_PSTAT_PMEENABLE) != 0) { + pmstat &= ~PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->vge_dev, + sc->vge_pmcap + PCIR_POWER_STATUS, pmstat, 2); + } + } + vge_clrwol(sc); + /* Restart MII auto-polling. */ + vge_miipoll_start(sc); ifp = sc->vge_ifp; - - /* reenable busmastering */ - pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_MEMORY); - - /* reinitialize interface if necessary */ - if (ifp->if_flags & IFF_UP) - vge_init(sc); - - sc->suspended = 0; + /* Reinitialize interface if necessary. */ + if ((ifp->if_flags & IFF_UP) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vge_init_locked(sc); + } + sc->vge_flags &= ~VGE_FLAG_SUSPENDED; + VGE_UNLOCK(sc); return (0); } @@ -2399,14 +2439,444 @@ vge_resume(dev) * get confused by errant DMAs when rebooting. */ static int -vge_shutdown(dev) - device_t dev; +vge_shutdown(device_t dev) { - struct vge_softc *sc; - sc = device_get_softc(dev); - - vge_stop(sc); - - return (0); + return (vge_suspend(dev)); +} + +#define VGE_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) + +static void +vge_sysctl_node(struct vge_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child, *parent; + struct sysctl_oid *tree; + struct vge_hw_stats *stats; + + stats = &sc->vge_stats; + ctx = device_get_sysctl_ctx(sc->vge_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->vge_dev)); + + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "int_holdoff", + CTLFLAG_RW, &sc->vge_int_holdoff, 0, "interrupt holdoff"); + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rx_coal_pkt", + CTLFLAG_RW, &sc->vge_rx_coal_pkt, 0, "rx coalescing packet"); + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "tx_coal_pkt", + CTLFLAG_RW, &sc->vge_tx_coal_pkt, 0, "tx coalescing packet"); + + /* Pull in device tunables. */ + sc->vge_int_holdoff = VGE_INT_HOLDOFF_DEFAULT; + resource_int_value(device_get_name(sc->vge_dev), + device_get_unit(sc->vge_dev), "int_holdoff", &sc->vge_int_holdoff); + sc->vge_rx_coal_pkt = VGE_RX_COAL_PKT_DEFAULT; + resource_int_value(device_get_name(sc->vge_dev), + device_get_unit(sc->vge_dev), "rx_coal_pkt", &sc->vge_rx_coal_pkt); + sc->vge_tx_coal_pkt = VGE_TX_COAL_PKT_DEFAULT; + resource_int_value(device_get_name(sc->vge_dev), + device_get_unit(sc->vge_dev), "tx_coal_pkt", &sc->vge_tx_coal_pkt); + + tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "VGE statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* Rx statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "RX MAC statistics"); + child = SYSCTL_CHILDREN(tree); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames", + &stats->rx_frames, "frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "good_frames", + &stats->rx_good_frames, "Good frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "fifo_oflows", + &stats->rx_fifo_oflows, "FIFO overflows"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "runts", + &stats->rx_runts, "Too short frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "runts_errs", + &stats->rx_runts_errs, "Too short frames with errors"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_64", + &stats->rx_pkts_64, "64 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_65_127", + &stats->rx_pkts_65_127, "65 to 127 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_128_255", + &stats->rx_pkts_128_255, "128 to 255 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_256_511", + &stats->rx_pkts_256_511, "256 to 511 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_512_1023", + &stats->rx_pkts_512_1023, "512 to 1023 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_1024_1518", + &stats->rx_pkts_1024_1518, "1024 to 1518 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_1519_max", + &stats->rx_pkts_1519_max, "1519 to max frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_1519_max_errs", + &stats->rx_pkts_1519_max_errs, "1519 to max frames with error"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_jumbo", + &stats->rx_jumbos, "Jumbo frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "crcerrs", + &stats->rx_crcerrs, "CRC errors"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "pause_frames", + &stats->rx_pause_frames, "CRC errors"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "align_errs", + &stats->rx_alignerrs, "Alignment errors"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "nobufs", + &stats->rx_nobufs, "Frames with no buffer event"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "sym_errs", + &stats->rx_symerrs, "Frames with symbol errors"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "len_errs", + &stats->rx_lenerrs, "Frames with length mismatched"); + + /* Tx statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "TX MAC statistics"); + child = SYSCTL_CHILDREN(tree); + VGE_SYSCTL_STAT_ADD32(ctx, child, "good_frames", + &stats->tx_good_frames, "Good frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_64", + &stats->tx_pkts_64, "64 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_65_127", + &stats->tx_pkts_65_127, "65 to 127 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_128_255", + &stats->tx_pkts_128_255, "128 to 255 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_256_511", + &stats->tx_pkts_256_511, "256 to 511 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_512_1023", + &stats->tx_pkts_512_1023, "512 to 1023 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_1024_1518", + &stats->tx_pkts_1024_1518, "1024 to 1518 bytes frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "frames_jumbo", + &stats->tx_jumbos, "Jumbo frames"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "colls", + &stats->tx_colls, "Collisions"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "late_colls", + &stats->tx_latecolls, "Late collisions"); + VGE_SYSCTL_STAT_ADD32(ctx, child, "pause_frames", + &stats->tx_pause, "Pause frames"); +#ifdef VGE_ENABLE_SQEERR + VGE_SYSCTL_STAT_ADD32(ctx, child, "sqeerrs", + &stats->tx_sqeerrs, "SQE errors"); +#endif + /* Clear MAC statistics. */ + vge_stats_clear(sc); +} + +#undef VGE_SYSCTL_STAT_ADD32 + +static void +vge_stats_clear(struct vge_softc *sc) +{ + int i; + + CSR_WRITE_1(sc, VGE_MIBCSR, + CSR_READ_1(sc, VGE_MIBCSR) | VGE_MIBCSR_FREEZE); + CSR_WRITE_1(sc, VGE_MIBCSR, + CSR_READ_1(sc, VGE_MIBCSR) | VGE_MIBCSR_CLR); + for (i = VGE_TIMEOUT; i > 0; i--) { + DELAY(1); + if ((CSR_READ_1(sc, VGE_MIBCSR) & VGE_MIBCSR_CLR) == 0) + break; + } + if (i == 0) + device_printf(sc->vge_dev, "MIB clear timed out!\n"); + CSR_WRITE_1(sc, VGE_MIBCSR, CSR_READ_1(sc, VGE_MIBCSR) & + ~VGE_MIBCSR_FREEZE); +} + +static void +vge_stats_update(struct vge_softc *sc) +{ + struct vge_hw_stats *stats; + struct ifnet *ifp; + uint32_t mib[VGE_MIB_CNT], val; + int i; + + VGE_LOCK_ASSERT(sc); + + stats = &sc->vge_stats; + ifp = sc->vge_ifp; + + CSR_WRITE_1(sc, VGE_MIBCSR, + CSR_READ_1(sc, VGE_MIBCSR) | VGE_MIBCSR_FLUSH); + for (i = VGE_TIMEOUT; i > 0; i--) { + DELAY(1); + if ((CSR_READ_1(sc, VGE_MIBCSR) & VGE_MIBCSR_FLUSH) == 0) + break; + } + if (i == 0) { + device_printf(sc->vge_dev, "MIB counter dump timed out!\n"); + vge_stats_clear(sc); + return; + } + + bzero(mib, sizeof(mib)); +reset_idx: + /* Set MIB read index to 0. */ + CSR_WRITE_1(sc, VGE_MIBCSR, + CSR_READ_1(sc, VGE_MIBCSR) | VGE_MIBCSR_RINI); + for (i = 0; i < VGE_MIB_CNT; i++) { + val = CSR_READ_4(sc, VGE_MIBDATA); + if (i != VGE_MIB_DATA_IDX(val)) { + /* Reading interrupted. */ + goto reset_idx; + } + mib[i] = val & VGE_MIB_DATA_MASK; + } + + /* Rx stats. */ + stats->rx_frames += mib[VGE_MIB_RX_FRAMES]; + stats->rx_good_frames += mib[VGE_MIB_RX_GOOD_FRAMES]; + stats->rx_fifo_oflows += mib[VGE_MIB_RX_FIFO_OVERRUNS]; + stats->rx_runts += mib[VGE_MIB_RX_RUNTS]; + stats->rx_runts_errs += mib[VGE_MIB_RX_RUNTS_ERRS]; + stats->rx_pkts_64 += mib[VGE_MIB_RX_PKTS_64]; + stats->rx_pkts_65_127 += mib[VGE_MIB_RX_PKTS_65_127]; + stats->rx_pkts_128_255 += mib[VGE_MIB_RX_PKTS_128_255]; + stats->rx_pkts_256_511 += mib[VGE_MIB_RX_PKTS_256_511]; + stats->rx_pkts_512_1023 += mib[VGE_MIB_RX_PKTS_512_1023]; + stats->rx_pkts_1024_1518 += mib[VGE_MIB_RX_PKTS_1024_1518]; + stats->rx_pkts_1519_max += mib[VGE_MIB_RX_PKTS_1519_MAX]; + stats->rx_pkts_1519_max_errs += mib[VGE_MIB_RX_PKTS_1519_MAX_ERRS]; + stats->rx_jumbos += mib[VGE_MIB_RX_JUMBOS]; + stats->rx_crcerrs += mib[VGE_MIB_RX_CRCERRS]; + stats->rx_pause_frames += mib[VGE_MIB_RX_PAUSE]; + stats->rx_alignerrs += mib[VGE_MIB_RX_ALIGNERRS]; + stats->rx_nobufs += mib[VGE_MIB_RX_NOBUFS]; + stats->rx_symerrs += mib[VGE_MIB_RX_SYMERRS]; + stats->rx_lenerrs += mib[VGE_MIB_RX_LENERRS]; + + /* Tx stats. */ + stats->tx_good_frames += mib[VGE_MIB_TX_GOOD_FRAMES]; + stats->tx_pkts_64 += mib[VGE_MIB_TX_PKTS_64]; + stats->tx_pkts_65_127 += mib[VGE_MIB_TX_PKTS_65_127]; + stats->tx_pkts_128_255 += mib[VGE_MIB_TX_PKTS_128_255]; + stats->tx_pkts_256_511 += mib[VGE_MIB_TX_PKTS_256_511]; + stats->tx_pkts_512_1023 += mib[VGE_MIB_TX_PKTS_512_1023]; + stats->tx_pkts_1024_1518 += mib[VGE_MIB_TX_PKTS_1024_1518]; + stats->tx_jumbos += mib[VGE_MIB_TX_JUMBOS]; + stats->tx_colls += mib[VGE_MIB_TX_COLLS]; + stats->tx_pause += mib[VGE_MIB_TX_PAUSE]; +#ifdef VGE_ENABLE_SQEERR + stats->tx_sqeerrs += mib[VGE_MIB_TX_SQEERRS]; +#endif + stats->tx_latecolls += mib[VGE_MIB_TX_LATECOLLS]; + + /* Update counters in ifnet. */ + ifp->if_opackets += mib[VGE_MIB_TX_GOOD_FRAMES]; + + ifp->if_collisions += mib[VGE_MIB_TX_COLLS] + + mib[VGE_MIB_TX_LATECOLLS]; + + ifp->if_oerrors += mib[VGE_MIB_TX_COLLS] + + mib[VGE_MIB_TX_LATECOLLS]; + + ifp->if_ipackets += mib[VGE_MIB_RX_GOOD_FRAMES]; + + ifp->if_ierrors += mib[VGE_MIB_RX_FIFO_OVERRUNS] + + mib[VGE_MIB_RX_RUNTS] + + mib[VGE_MIB_RX_RUNTS_ERRS] + + mib[VGE_MIB_RX_CRCERRS] + + mib[VGE_MIB_RX_ALIGNERRS] + + mib[VGE_MIB_RX_NOBUFS] + + mib[VGE_MIB_RX_SYMERRS] + + mib[VGE_MIB_RX_LENERRS]; +} + +static void +vge_intr_holdoff(struct vge_softc *sc) +{ + uint8_t intctl; + + VGE_LOCK_ASSERT(sc); + + /* + * Set Tx interrupt supression threshold. + * It's possible to use single-shot timer in VGE_CRS1 register + * in Tx path such that driver can remove most of Tx completion + * interrupts. However this requires additional access to + * VGE_CRS1 register to reload the timer in addintion to + * activating Tx kick command. Another downside is we don't know + * what single-shot timer value should be used in advance so + * reclaiming transmitted mbufs could be delayed a lot which in + * turn slows down Tx operation. + */ + CSR_WRITE_1(sc, VGE_CAMCTL, VGE_PAGESEL_TXSUPPTHR); + CSR_WRITE_1(sc, VGE_TXSUPPTHR, sc->vge_tx_coal_pkt); + + /* Set Rx interrupt suppresion threshold. */ + CSR_WRITE_1(sc, VGE_CAMCTL, VGE_PAGESEL_RXSUPPTHR); + CSR_WRITE_1(sc, VGE_RXSUPPTHR, sc->vge_rx_coal_pkt); + + intctl = CSR_READ_1(sc, VGE_INTCTL1); + intctl &= ~VGE_INTCTL_SC_RELOAD; + intctl |= VGE_INTCTL_HC_RELOAD; + if (sc->vge_tx_coal_pkt <= 0) + intctl |= VGE_INTCTL_TXINTSUP_DISABLE; + else + intctl &= ~VGE_INTCTL_TXINTSUP_DISABLE; + if (sc->vge_rx_coal_pkt <= 0) + intctl |= VGE_INTCTL_RXINTSUP_DISABLE; + else + intctl &= ~VGE_INTCTL_RXINTSUP_DISABLE; + CSR_WRITE_1(sc, VGE_INTCTL1, intctl); + CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_HOLDOFF); + if (sc->vge_int_holdoff > 0) { + /* Set interrupt holdoff timer. */ + CSR_WRITE_1(sc, VGE_CAMCTL, VGE_PAGESEL_INTHLDOFF); + CSR_WRITE_1(sc, VGE_INTHOLDOFF, + VGE_INT_HOLDOFF_USEC(sc->vge_int_holdoff)); + /* Enable holdoff timer. */ + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_HOLDOFF); + } +} + +static void +vge_setlinkspeed(struct vge_softc *sc) +{ + struct mii_data *mii; + int aneg, i; + + VGE_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->vge_miibus); + mii_pollstat(mii); + aneg = 0; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch IFM_SUBTYPE(mii->mii_media_active) { + case IFM_10_T: + case IFM_100_TX: + return; + case IFM_1000_T: + aneg++; + default: + break; + } + } + vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_100T2CR, 0); + vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_ANAR, + ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); + vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_BMCR, + BMCR_AUTOEN | BMCR_STARTNEG); + DELAY(1000); + if (aneg != 0) { + /* Poll link state until vge(4) get a 10/100 link. */ + for (i = 0; i < MII_ANEGTICKS_GIGE; i++) { + mii_pollstat(mii); + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) + == (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + return; + default: + break; + } + } + VGE_UNLOCK(sc); + pause("vgelnk", hz); + VGE_LOCK(sc); + } + if (i == MII_ANEGTICKS_GIGE) + device_printf(sc->vge_dev, "establishing link failed, " + "WOL may not work!"); + } + /* + * No link, force MAC to have 100Mbps, full-duplex link. + * This is the last resort and may/may not work. + */ + mii->mii_media_status = IFM_AVALID | IFM_ACTIVE; + mii->mii_media_active = IFM_ETHER | IFM_100_TX | IFM_FDX; +} + +static void +vge_setwol(struct vge_softc *sc) +{ + struct ifnet *ifp; + uint16_t pmstat; + uint8_t val; + + VGE_LOCK_ASSERT(sc); + + if ((sc->vge_flags & VGE_FLAG_PMCAP) == 0) { + /* No PME capability, PHY power down. */ + vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_BMCR, + BMCR_PDOWN); + vge_miipoll_stop(sc); + return; + } + + ifp = sc->vge_ifp; + + /* Clear WOL on pattern match. */ + CSR_WRITE_1(sc, VGE_WOLCR0C, VGE_WOLCR0_PATTERN_ALL); + /* Disable WOL on magic/unicast packet. */ + CSR_WRITE_1(sc, VGE_WOLCR1C, 0x0F); + CSR_WRITE_1(sc, VGE_WOLCFGC, VGE_WOLCFG_SAB | VGE_WOLCFG_SAM | + VGE_WOLCFG_PMEOVR); + if ((ifp->if_capenable & IFCAP_WOL) != 0) { + vge_setlinkspeed(sc); + val = 0; + if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) + val |= VGE_WOLCR1_UCAST; + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + val |= VGE_WOLCR1_MAGIC; + CSR_WRITE_1(sc, VGE_WOLCR1S, val); + val = 0; + if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) + val |= VGE_WOLCFG_SAM | VGE_WOLCFG_SAB; + CSR_WRITE_1(sc, VGE_WOLCFGS, val | VGE_WOLCFG_PMEOVR); + /* Disable MII auto-polling. */ + vge_miipoll_stop(sc); + } + CSR_SETBIT_1(sc, VGE_DIAGCTL, + VGE_DIAGCTL_MACFORCE | VGE_DIAGCTL_FDXFORCE); + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_GMII); + + /* Clear WOL status on pattern match. */ + CSR_WRITE_1(sc, VGE_WOLSR0C, 0xFF); + CSR_WRITE_1(sc, VGE_WOLSR1C, 0xFF); + + val = CSR_READ_1(sc, VGE_PWRSTAT); + val |= VGE_STICKHW_SWPTAG; + CSR_WRITE_1(sc, VGE_PWRSTAT, val); + /* Put hardware into sleep. */ + val = CSR_READ_1(sc, VGE_PWRSTAT); + val |= VGE_STICKHW_DS0 | VGE_STICKHW_DS1; + CSR_WRITE_1(sc, VGE_PWRSTAT, val); + /* Request PME if WOL is requested. */ + pmstat = pci_read_config(sc->vge_dev, sc->vge_pmcap + + PCIR_POWER_STATUS, 2); + pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if ((ifp->if_capenable & IFCAP_WOL) != 0) + pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->vge_dev, sc->vge_pmcap + PCIR_POWER_STATUS, + pmstat, 2); +} + +static void +vge_clrwol(struct vge_softc *sc) +{ + uint8_t val; + + val = CSR_READ_1(sc, VGE_PWRSTAT); + val &= ~VGE_STICKHW_SWPTAG; + CSR_WRITE_1(sc, VGE_PWRSTAT, val); + /* Disable WOL and clear power state indicator. */ + val = CSR_READ_1(sc, VGE_PWRSTAT); + val &= ~(VGE_STICKHW_DS0 | VGE_STICKHW_DS1); + CSR_WRITE_1(sc, VGE_PWRSTAT, val); + + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_GMII); + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE); + + /* Clear WOL on pattern match. */ + CSR_WRITE_1(sc, VGE_WOLCR0C, VGE_WOLCR0_PATTERN_ALL); + /* Disable WOL on magic/unicast packet. */ + CSR_WRITE_1(sc, VGE_WOLCR1C, 0x0F); + CSR_WRITE_1(sc, VGE_WOLCFGC, VGE_WOLCFG_SAB | VGE_WOLCFG_SAM | + VGE_WOLCFG_PMEOVR); + /* Clear WOL status on pattern match. */ + CSR_WRITE_1(sc, VGE_WOLSR0C, 0xFF); + CSR_WRITE_1(sc, VGE_WOLSR1C, 0xFF); } diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgereg.h b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgereg.h index 8d11a9c3e1..8a53bd89f0 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgereg.h +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgereg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: src/sys/dev/vge/if_vgereg.h,v 1.2.22.6.4.1 2010/12/21 17:09:25 kensmith Exp $ */ /* @@ -89,8 +89,8 @@ #define VGE_RXQCSRC 0x36 /* RX queue ctl/status clear */ #define VGE_RXDESC_ADDR_LO 0x38 /* RX desc base addr (lo 32 bits) */ #define VGE_RXDESC_CONSIDX 0x3C /* Current RX descriptor index */ -#define VGE_RXQTIMER 0x3E /* RX queue timer pend register */ -#define VGE_TXQTIMER 0x3F /* TX queue timer pend register */ +#define VGE_TXQTIMER 0x3E /* TX queue timer pend register */ +#define VGE_RXQTIMER 0x3F /* RX queue timer pend register */ #define VGE_TXDESC_ADDR_LO0 0x40 /* TX desc0 base addr (lo 32 bits) */ #define VGE_TXDESC_ADDR_LO1 0x44 /* TX desc1 base addr (lo 32 bits) */ #define VGE_TXDESC_ADDR_LO2 0x48 /* TX desc2 base addr (lo 32 bits) */ @@ -300,8 +300,7 @@ #define VGE_INTRS (VGE_ISR_TXOK0|VGE_ISR_RXOK|VGE_ISR_STOPPED| \ VGE_ISR_RXOFLOW|VGE_ISR_PHYINT| \ VGE_ISR_LINKSTS|VGE_ISR_RXNODESC| \ - VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL| \ - VGE_ISR_MIBOFLOW|VGE_ISR_TIMER0) + VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL) /* Interrupt mask register */ @@ -339,19 +338,19 @@ #define VGE_TXQCSR_RUN0 0x0001 /* Enable TX queue 0 */ #define VGE_TXQCSR_ACT0 0x0002 /* queue 0 active indicator */ #define VGE_TXQCSR_WAK0 0x0004 /* Wake up (poll) queue 0 */ -#define VGE_TXQCST_DEAD0 0x0008 /* queue 0 dead indicator */ +#define VGE_TXQCSR_DEAD0 0x0008 /* queue 0 dead indicator */ #define VGE_TXQCSR_RUN1 0x0010 /* Enable TX queue 1 */ #define VGE_TXQCSR_ACT1 0x0020 /* queue 1 active indicator */ #define VGE_TXQCSR_WAK1 0x0040 /* Wake up (poll) queue 1 */ -#define VGE_TXQCST_DEAD1 0x0080 /* queue 1 dead indicator */ +#define VGE_TXQCSR_DEAD1 0x0080 /* queue 1 dead indicator */ #define VGE_TXQCSR_RUN2 0x0100 /* Enable TX queue 2 */ #define VGE_TXQCSR_ACT2 0x0200 /* queue 2 active indicator */ #define VGE_TXQCSR_WAK2 0x0400 /* Wake up (poll) queue 2 */ -#define VGE_TXQCST_DEAD2 0x0800 /* queue 2 dead indicator */ +#define VGE_TXQCSR_DEAD2 0x0800 /* queue 2 dead indicator */ #define VGE_TXQCSR_RUN3 0x1000 /* Enable TX queue 3 */ #define VGE_TXQCSR_ACT3 0x2000 /* queue 3 active indicator */ #define VGE_TXQCSR_WAK3 0x4000 /* Wake up (poll) queue 3 */ -#define VGE_TXQCST_DEAD3 0x8000 /* queue 3 dead indicator */ +#define VGE_TXQCSR_DEAD3 0x8000 /* queue 3 dead indicator */ /* RX descriptor queue control/status register */ @@ -543,6 +542,90 @@ #define VGE_TXBLOCK_128PKTS 0x08 #define VGE_TXBLOCK_8PKTS 0x0C +/* MIB control/status register */ +#define VGE_MIBCSR_CLR 0x01 +#define VGE_MIBCSR_RINI 0x02 +#define VGE_MIBCSR_FLUSH 0x04 +#define VGE_MIBCSR_FREEZE 0x08 +#define VGE_MIBCSR_HI_80 0x00 +#define VGE_MIBCSR_HI_C0 0x10 +#define VGE_MIBCSR_BISTGO 0x40 +#define VGE_MIBCSR_BISTOK 0x80 + +/* MIB data index. */ +#define VGE_MIB_RX_FRAMES 0 +#define VGE_MIB_RX_GOOD_FRAMES 1 +#define VGE_MIB_TX_GOOD_FRAMES 2 +#define VGE_MIB_RX_FIFO_OVERRUNS 3 +#define VGE_MIB_RX_RUNTS 4 +#define VGE_MIB_RX_RUNTS_ERRS 5 +#define VGE_MIB_RX_PKTS_64 6 +#define VGE_MIB_TX_PKTS_64 7 +#define VGE_MIB_RX_PKTS_65_127 8 +#define VGE_MIB_TX_PKTS_65_127 9 +#define VGE_MIB_RX_PKTS_128_255 10 +#define VGE_MIB_TX_PKTS_128_255 11 +#define VGE_MIB_RX_PKTS_256_511 12 +#define VGE_MIB_TX_PKTS_256_511 13 +#define VGE_MIB_RX_PKTS_512_1023 14 +#define VGE_MIB_TX_PKTS_512_1023 15 +#define VGE_MIB_RX_PKTS_1024_1518 16 +#define VGE_MIB_TX_PKTS_1024_1518 17 +#define VGE_MIB_TX_COLLS 18 +#define VGE_MIB_RX_CRCERRS 19 +#define VGE_MIB_RX_JUMBOS 20 +#define VGE_MIB_TX_JUMBOS 21 +#define VGE_MIB_RX_PAUSE 22 +#define VGE_MIB_TX_PAUSE 23 +#define VGE_MIB_RX_ALIGNERRS 24 +#define VGE_MIB_RX_PKTS_1519_MAX 25 +#define VGE_MIB_RX_PKTS_1519_MAX_ERRS 26 +#define VGE_MIB_TX_SQEERRS 27 +#define VGE_MIB_RX_NOBUFS 28 +#define VGE_MIB_RX_SYMERRS 29 +#define VGE_MIB_RX_LENERRS 30 +#define VGE_MIB_TX_LATECOLLS 31 + +#define VGE_MIB_CNT (VGE_MIB_TX_LATECOLLS - VGE_MIB_RX_FRAMES + 1) +#define VGE_MIB_DATA_MASK 0x00FFFFFF +#define VGE_MIB_DATA_IDX(x) ((x) >> 24) + +/* Sticky bit shadow register */ + +#define VGE_STICKHW_DS0 0x01 +#define VGE_STICKHW_DS1 0x02 +#define VGE_STICKHW_WOL_ENB 0x04 +#define VGE_STICKHW_WOL_STS 0x08 +#define VGE_STICKHW_SWPTAG 0x10 + +/* WOL pattern control */ +#define VGE_WOLCR0_PATTERN0 0x01 +#define VGE_WOLCR0_PATTERN1 0x02 +#define VGE_WOLCR0_PATTERN2 0x04 +#define VGE_WOLCR0_PATTERN3 0x08 +#define VGE_WOLCR0_PATTERN4 0x10 +#define VGE_WOLCR0_PATTERN5 0x20 +#define VGE_WOLCR0_PATTERN6 0x40 +#define VGE_WOLCR0_PATTERN7 0x80 +#define VGE_WOLCR0_PATTERN_ALL 0xFF + +/* WOL event control */ +#define VGE_WOLCR1_UCAST 0x01 +#define VGE_WOLCR1_MAGIC 0x02 +#define VGE_WOLCR1_LINKON 0x04 +#define VGE_WOLCR1_LINKOFF 0x08 + +/* Poweer management config */ +#define VGE_PWRCFG_LEGACY_WOLEN 0x01 +#define VGE_PWRCFG_WOL_PULSE 0x20 +#define VGE_PWRCFG_WOL_BUTTON 0x00 + +/* WOL config register */ +#define VGE_WOLCFG_PHYINT_ENB 0x01 +#define VGE_WOLCFG_SAB 0x10 +#define VGE_WOLCFG_SAM 0x20 +#define VGE_WOLCFG_PMEOVR 0x80 + /* EEPROM control/status register */ #define VGE_EECSR_EDO 0x01 /* data out pin */ @@ -587,8 +670,7 @@ struct vge_tx_frag { uint32_t vge_addrlo; - uint16_t vge_addrhi; - uint16_t vge_buflen; + uint32_t vge_addrhi; }; /* @@ -600,7 +682,7 @@ struct vge_tx_frag { * to obtain this behavior, the special 'queue' bit must be set. */ -#define VGE_TXDESC_Q 0x8000 +#define VGE_TXDESC_Q 0x80000000 struct vge_tx_desc { uint32_t vge_sts; @@ -645,11 +727,10 @@ struct vge_tx_desc { /* Receive DMA descriptors have a single fragment pointer. */ struct vge_rx_desc { - volatile uint32_t vge_sts; - volatile uint32_t vge_ctl; - volatile uint32_t vge_addrlo; - volatile uint16_t vge_addrhi; - volatile uint16_t vge_buflen; + uint32_t vge_sts; + uint32_t vge_ctl; + uint32_t vge_addrlo; + uint32_t vge_addrhi; }; /* @@ -658,7 +739,7 @@ struct vge_rx_desc { * not interrupts are generated for this descriptor. */ -#define VGE_RXDESC_I 0x8000 +#define VGE_RXDESC_I 0x80000000 #define VGE_RDSTS_VIDM 0x00000001 /* VLAN tag filter miss */ #define VGE_RDSTS_CRCERR 0x00000002 /* bad CRC error */ @@ -680,8 +761,8 @@ struct vge_rx_desc { #define VGE_RDSTS_OWN 0x80000000 /* own bit. */ #define VGE_RXPKT_ONEFRAG 0x00000000 /* only one fragment */ -#define VGE_RXPKT_EOF 0x00000100 /* first frag in frame */ -#define VGE_RXPKT_SOF 0x00000200 /* last frag in frame */ +#define VGE_RXPKT_EOF 0x00000100 /* last frag in frame */ +#define VGE_RXPKT_SOF 0x00000200 /* first frag in frame */ #define VGE_RXPKT_MOF 0x00000300 /* intermediate frag */ #define VGE_RDCTL_VLANID 0x0000FFFF /* VLAN ID info */ diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgevar.h b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgevar.h index c4224f7eff..d73370b50a 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgevar.h +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgevar.h @@ -29,37 +29,55 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: src/sys/dev/vge/if_vgevar.h,v 1.4.22.9.4.1 2010/12/21 17:09:25 kensmith Exp $ */ -#if !defined(__i386__) -#define VGE_FIXUP_RX -#endif - #define VGE_JUMBO_MTU 9000 -#define VGE_IFQ_MAXLEN 64 - #define VGE_TX_DESC_CNT 256 -#define VGE_RX_DESC_CNT 256 /* Must be a multiple of 4!! */ -#define VGE_RING_ALIGN 256 +#define VGE_RX_DESC_CNT 252 /* Must be a multiple of 4!! */ +#define VGE_TX_RING_ALIGN 64 +#define VGE_RX_RING_ALIGN 64 +#define VGE_MAXTXSEGS 6 +#define VGE_RX_BUF_ALIGN sizeof(uint64_t) + +/* + * VIA Velocity allows 64bit DMA addressing but high 16bits + * of the DMA address should be the same for Tx/Rx buffers. + * Because this condition can't be guaranteed vge(4) limit + * DMA address space to 48bits. + */ +#if (BUS_SPACE_MAXADDR < 0xFFFFFFFFFF) +#define VGE_BUF_DMA_MAXADDR BUS_SPACE_MAXADDR +#else +#define VGE_BUF_DMA_MAXADDR 0xFFFFFFFFFFFF +#endif + #define VGE_RX_LIST_SZ (VGE_RX_DESC_CNT * sizeof(struct vge_rx_desc)) #define VGE_TX_LIST_SZ (VGE_TX_DESC_CNT * sizeof(struct vge_tx_desc)) -#define VGE_TX_DESC_INC(x) (x = (x + 1) % VGE_TX_DESC_CNT) -#define VGE_RX_DESC_INC(x) (x = (x + 1) % VGE_RX_DESC_CNT) -#define VGE_ADDR_LO(y) ((u_int64_t) (y) & 0xFFFFFFFF) -#define VGE_ADDR_HI(y) ((u_int64_t) (y) >> 32) -#define VGE_BUFLEN(y) ((y) & 0x7FFF) -#define VGE_OWN(x) (le32toh((x)->vge_sts) & VGE_RDSTS_OWN) -#define VGE_RXBYTES(x) ((le32toh((x)->vge_sts) & \ - VGE_RDSTS_BUFSIZ) >> 16) +#define VGE_TX_DESC_INC(x) ((x) = ((x) + 1) % VGE_TX_DESC_CNT) +#define VGE_TX_DESC_DEC(x) \ + ((x) = (((x) + VGE_TX_DESC_CNT - 1) % VGE_TX_DESC_CNT)) +#define VGE_RX_DESC_INC(x) ((x) = ((x) + 1) % VGE_RX_DESC_CNT) +#define VGE_ADDR_LO(y) ((uint64_t) (y) & 0xFFFFFFFF) +#define VGE_ADDR_HI(y) ((uint64_t) (y) >> 32) +#define VGE_BUFLEN(y) ((y) & 0x3FFF) +#define VGE_RXBYTES(x) (((x) & VGE_RDSTS_BUFSIZ) >> 16) #define VGE_MIN_FRAMELEN 60 -#ifdef VGE_FIXUP_RX -#define VGE_ETHER_ALIGN sizeof(uint32_t) -#else -#define VGE_ETHER_ALIGN 0 -#endif +#define VGE_INT_HOLDOFF_TICK 20 +#define VGE_INT_HOLDOFF_USEC(x) ((x) / VGE_INT_HOLDOFF_TICK) +#define VGE_INT_HOLDOFF_MIN 0 +#define VGE_INT_HOLDOFF_MAX (255 * VGE_INT_HOLDOFF_TICK) +#define VGE_INT_HOLDOFF_DEFAULT 150 + +#define VGE_RX_COAL_PKT_MIN 1 +#define VGE_RX_COAL_PKT_MAX VGE_RX_DESC_CNT +#define VGE_RX_COAL_PKT_DEFAULT 64 + +#define VGE_TX_COAL_PKT_MIN 1 +#define VGE_TX_COAL_PKT_MAX VGE_TX_DESC_CNT +#define VGE_TX_COAL_PKT_DEFAULT 128 struct vge_type { uint16_t vge_vid; @@ -67,64 +85,124 @@ struct vge_type { char *vge_name; }; -struct vge_softc; - -struct vge_dmaload_arg { - struct vge_softc *sc; - int vge_idx; - int vge_maxsegs; - struct mbuf *vge_m0; - u_int32_t vge_flags; +struct vge_txdesc { + struct mbuf *tx_m; + bus_dmamap_t tx_dmamap; + struct vge_tx_desc *tx_desc; + struct vge_txdesc *txd_prev; }; -struct vge_list_data { - struct mbuf *vge_tx_mbuf[VGE_TX_DESC_CNT]; - struct mbuf *vge_rx_mbuf[VGE_RX_DESC_CNT]; +struct vge_rxdesc { + struct mbuf *rx_m; + bus_dmamap_t rx_dmamap; + struct vge_rx_desc *rx_desc; + struct vge_rxdesc *rxd_prev; +}; + +struct vge_chain_data{ + bus_dma_tag_t vge_ring_tag; + bus_dma_tag_t vge_buffer_tag; + bus_dma_tag_t vge_tx_tag; + struct vge_txdesc vge_txdesc[VGE_TX_DESC_CNT]; + bus_dma_tag_t vge_rx_tag; + struct vge_rxdesc vge_rxdesc[VGE_RX_DESC_CNT]; + bus_dma_tag_t vge_tx_ring_tag; + bus_dmamap_t vge_tx_ring_map; + bus_dma_tag_t vge_rx_ring_tag; + bus_dmamap_t vge_rx_ring_map; + bus_dmamap_t vge_rx_sparemap; + int vge_tx_prodidx; - int vge_rx_prodidx; int vge_tx_considx; - int vge_tx_free; - bus_dmamap_t vge_tx_dmamap[VGE_TX_DESC_CNT]; - bus_dmamap_t vge_rx_dmamap[VGE_RX_DESC_CNT]; - bus_dma_tag_t vge_mtag; /* mbuf mapping tag */ - bus_dma_tag_t vge_rx_list_tag; - bus_dmamap_t vge_rx_list_map; - struct vge_rx_desc *vge_rx_list; - bus_addr_t vge_rx_list_addr; - bus_dma_tag_t vge_tx_list_tag; - bus_dmamap_t vge_tx_list_map; - struct vge_tx_desc *vge_tx_list; - bus_addr_t vge_tx_list_addr; + int vge_tx_cnt; + int vge_rx_prodidx; + int vge_rx_commit; + + struct mbuf *vge_head; + struct mbuf *vge_tail; +}; + +#define VGE_CHAIN_RESET(_sc) \ +do { \ + if ((_sc)->vge_cdata.vge_head != NULL) { \ + m_freem((_sc)->vge_cdata.vge_head); \ + (_sc)->vge_cdata.vge_head = NULL; \ + (_sc)->vge_cdata.vge_tail = NULL; \ + } \ +} while (0); + +struct vge_ring_data { + struct vge_tx_desc *vge_tx_ring; + bus_addr_t vge_tx_ring_paddr; + struct vge_rx_desc *vge_rx_ring; + bus_addr_t vge_rx_ring_paddr; +}; + +struct vge_hw_stats { + uint32_t rx_frames; + uint32_t rx_good_frames; + uint32_t rx_fifo_oflows; + uint32_t rx_runts; + uint32_t rx_runts_errs; + uint32_t rx_pkts_64; + uint32_t rx_pkts_65_127; + uint32_t rx_pkts_128_255; + uint32_t rx_pkts_256_511; + uint32_t rx_pkts_512_1023; + uint32_t rx_pkts_1024_1518; + uint32_t rx_pkts_1519_max; + uint32_t rx_pkts_1519_max_errs; + uint32_t rx_jumbos; + uint32_t rx_crcerrs; + uint32_t rx_pause_frames; + uint32_t rx_alignerrs; + uint32_t rx_nobufs; + uint32_t rx_symerrs; + uint32_t rx_lenerrs; + + uint32_t tx_good_frames; + uint32_t tx_pkts_64; + uint32_t tx_pkts_65_127; + uint32_t tx_pkts_128_255; + uint32_t tx_pkts_256_511; + uint32_t tx_pkts_512_1023; + uint32_t tx_pkts_1024_1518; + uint32_t tx_jumbos; + uint32_t tx_colls; + uint32_t tx_pause; + uint32_t tx_sqeerrs; + uint32_t tx_latecolls; }; struct vge_softc { struct ifnet *vge_ifp; /* interface info */ device_t vge_dev; - bus_space_handle_t vge_bhandle; /* bus space handle */ - bus_space_tag_t vge_btag; /* bus space tag */ struct resource *vge_res; struct resource *vge_irq; void *vge_intrhand; device_t vge_miibus; - bus_dma_tag_t vge_parent_tag; - bus_dma_tag_t vge_tag; - u_int8_t vge_unit; /* interface number */ - u_int8_t vge_type; int vge_if_flags; - int vge_rx_consumed; - int vge_link; + int vge_phyaddr; + int vge_flags; +#define VGE_FLAG_PCIE 0x0001 +#define VGE_FLAG_MSI 0x0002 +#define VGE_FLAG_PMCAP 0x0004 +#define VGE_FLAG_JUMBO 0x0008 +#define VGE_FLAG_SUSPENDED 0x4000 +#define VGE_FLAG_LINK 0x8000 + int vge_expcap; + int vge_pmcap; int vge_camidx; - struct task vge_txtask; + int vge_int_holdoff; + int vge_rx_coal_pkt; + int vge_tx_coal_pkt; struct mtx vge_mtx; - struct mbuf *vge_head; - struct mbuf *vge_tail; + struct callout vge_watchdog; + int vge_timer; - struct vge_list_data vge_ldata; - - int suspended; /* 0 = normal 1 = suspended */ -#ifdef DEVICE_POLLING - int rxcycles; -#endif + struct vge_chain_data vge_cdata; + struct vge_ring_data vge_rdata; + struct vge_hw_stats vge_stats; }; #define VGE_LOCK(_sc) mtx_lock(&(_sc)->vge_mtx) @@ -135,20 +213,20 @@ struct vge_softc { * register space access macros */ #define CSR_WRITE_STREAM_4(sc, reg, val) \ - bus_space_write_stream_4(sc->vge_btag, sc->vge_bhandle, reg, val) + bus_write_stream_4(sc->vge_res, reg, val) #define CSR_WRITE_4(sc, reg, val) \ - bus_space_write_4(sc->vge_btag, sc->vge_bhandle, reg, val) + bus_write_4(sc->vge_res, reg, val) #define CSR_WRITE_2(sc, reg, val) \ - bus_space_write_2(sc->vge_btag, sc->vge_bhandle, reg, val) + bus_write_2(sc->vge_res, reg, val) #define CSR_WRITE_1(sc, reg, val) \ - bus_space_write_1(sc->vge_btag, sc->vge_bhandle, reg, val) + bus_write_1(sc->vge_res, reg, val) #define CSR_READ_4(sc, reg) \ - bus_space_read_4(sc->vge_btag, sc->vge_bhandle, reg) + bus_read_4(sc->vge_res, reg) #define CSR_READ_2(sc, reg) \ - bus_space_read_2(sc->vge_btag, sc->vge_bhandle, reg) + bus_read_2(sc->vge_res, reg) #define CSR_READ_1(sc, reg) \ - bus_space_read_1(sc->vge_btag, sc->vge_bhandle, reg) + bus_read_1(sc->vge_res, reg) #define CSR_SETBIT_1(sc, reg, x) \ CSR_WRITE_1(sc, reg, CSR_READ_1(sc, reg) | (x)) @@ -164,4 +242,6 @@ struct vge_softc { #define CSR_CLRBIT_4(sc, reg, x) \ CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) & ~(x)) +#define VGE_RXCHUNK 4 #define VGE_TIMEOUT 10000 + From 909c526903ac020634f6efde096698989acf2198 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Thu, 15 Sep 2011 22:14:00 +0000 Subject: [PATCH 295/702] Pass up-to-date team_info to TeamRow, so we can detect when a team app image has changed after an exec() syscall, and update team's fields, icon included. This fix #7988. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42755 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../gui/teams_window/TeamsListView.cpp | 20 ++++++++++++++++++- .../gui/teams_window/TeamsListView.h | 6 ++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp index 9c23dfdc8a..8c632529ec 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp @@ -201,6 +201,21 @@ TeamRow::TeamRow(team_id team) } +status_t +TeamRow::UpdateInfo(team_info& info) +{ + // Check if we need to rebuilt the row's fields because the team critical + // info (basically, app image running under that team ID) has changed + + if (info.argc != fTeamInfo.argc + || strncmp(info.args, fTeamInfo.args, sizeof(fTeamInfo.args)) != 0) { + return _SetTo(info); + } + + return B_OK; +} + + status_t TeamRow::_SetTo(team_info& info) { @@ -427,7 +442,10 @@ TeamsListView::_UpdateList() row = dynamic_cast(RowAt(index)); } - if (row == NULL || tmi.team != row->TeamID()) { + if (row != NULL && tmi.team == row->TeamID()) { + // The team image app could have change due after an exec*() call, + row->UpdateInfo(tmi); + } else if (row == NULL || tmi.team != row->TeamID()) { // Team not found in previously known teams list: insert a new row TeamRow* newRow = new(std::nothrow) TeamRow(tmi); if (newRow != NULL) { diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h index aca92ea107..3d715589b7 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h @@ -63,17 +63,19 @@ private: class TeamRow : public BRow { typedef BRow Inherited; public: - TeamRow(team_info & teamInfo); + TeamRow(team_info& teamInfo); TeamRow(team_id teamId); public: team_id TeamID() const { return fTeamInfo.team; } + status_t UpdateInfo(team_info& info); + virtual void SetEnabled(bool enabled) { fEnabled = enabled; } bool IsEnabled() const { return fEnabled; } private: - status_t _SetTo(team_info & info); + status_t _SetTo(team_info& info); private: bool fEnabled; From 7a931c68e85dbdfbc546f5edc838a1f3246cf6f6 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Fri, 16 Sep 2011 19:31:02 +0000 Subject: [PATCH 296/702] Do an explicit row's update when it's needed. This should close #7988 this time, hopefully. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42756 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../gui/teams_window/TeamsListView.cpp | 14 ++++++++------ .../gui/teams_window/TeamsListView.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp index 8c632529ec..21543df753 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp @@ -201,18 +201,19 @@ TeamRow::TeamRow(team_id team) } -status_t -TeamRow::UpdateInfo(team_info& info) +bool +TeamRow::NeedsUpdate(team_info& info) { // Check if we need to rebuilt the row's fields because the team critical // info (basically, app image running under that team ID) has changed if (info.argc != fTeamInfo.argc || strncmp(info.args, fTeamInfo.args, sizeof(fTeamInfo.args)) != 0) { - return _SetTo(info); + _SetTo(info); + return true; } - return B_OK; + return false; } @@ -442,9 +443,10 @@ TeamsListView::_UpdateList() row = dynamic_cast(RowAt(index)); } - if (row != NULL && tmi.team == row->TeamID()) { + if (row != NULL && tmi.team == row->TeamID() + && row->NeedsUpdate(tmi)) { // The team image app could have change due after an exec*() call, - row->UpdateInfo(tmi); + UpdateRow(row); } else if (row == NULL || tmi.team != row->TeamID()) { // Team not found in previously known teams list: insert a new row TeamRow* newRow = new(std::nothrow) TeamRow(tmi); diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h index 3d715589b7..6553f825f9 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h @@ -69,7 +69,7 @@ public: public: team_id TeamID() const { return fTeamInfo.team; } - status_t UpdateInfo(team_info& info); + bool NeedsUpdate(team_info& info); virtual void SetEnabled(bool enabled) { fEnabled = enabled; } bool IsEnabled() const { return fEnabled; } From 117e135799a2b95c0bce51e440821fe2fc8a323e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 18 Sep 2011 15:29:24 +0000 Subject: [PATCH 297/702] * ddc still giving 128 bytes of 0's * add code to check if 0 valid displays were found * if 0 edid's were found, we inject the first connector as a last resort... SimNow seems to be ok with this and I get a valid screen mode set :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42757 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index c9f336bfd8..5e1a11ac11 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -644,6 +644,18 @@ detect_displays() } } + // fallback if no edid monitors were found + if (displayIndex == 0) { + ERROR("%s: ERROR: 0 attached monitors were found on display connectors." + " Injecting first connector as a last resort.\n", __func__); + gDisplay[displayIndex]->active = true; + gDisplay[displayIndex]->connector_index = 0; + init_registers(gDisplay[displayIndex]->regs, displayIndex); + if (detect_crt_ranges(displayIndex) == B_OK) + gDisplay[displayIndex]->found_ranges = true; + } + + return B_OK; } From 1724ebde5506d44318aa609ec71471618dc25d07 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 18 Sep 2011 16:47:47 +0000 Subject: [PATCH 298/702] usb_asix driver refactoring: * work with multicast filter table implemented; * new device lookup and creation procedure: avoid duplication of supported devices information; * coding style fixes; git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42758 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/network/usb_asix/ASIXDevice.cpp | 403 +++++++++++------- .../drivers/network/usb_asix/ASIXDevice.h | 70 +-- .../network/usb_asix/ASIXVendorRequests.h | 73 ++++ .../network/usb_asix/AX88172Device.cpp | 152 ++++--- .../drivers/network/usb_asix/AX88172Device.h | 15 +- .../network/usb_asix/AX88178Device.cpp | 175 ++++---- .../drivers/network/usb_asix/AX88178Device.h | 15 +- .../network/usb_asix/AX88772Device.cpp | 162 +++---- .../drivers/network/usb_asix/AX88772Device.h | 15 +- .../drivers/network/usb_asix/Driver.cpp | 180 ++++---- .../kernel/drivers/network/usb_asix/Driver.h | 24 +- .../kernel/drivers/network/usb_asix/Jamfile | 1 + .../drivers/network/usb_asix/MIIBus.cpp | 268 ++++++------ .../kernel/drivers/network/usb_asix/MIIBus.h | 97 ++--- .../drivers/network/usb_asix/Settings.cpp | 63 +-- .../drivers/network/usb_asix/Settings.h | 24 +- 16 files changed, 974 insertions(+), 763 deletions(-) create mode 100644 src/add-ons/kernel/drivers/network/usb_asix/ASIXVendorRequests.h diff --git a/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.cpp b/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.cpp index 853df28fda..3bc5b86b0a 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.cpp @@ -1,32 +1,34 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ -#include "Driver.h" -#include "Settings.h" + #include "ASIXDevice.h" -//TODO: multicast support -//TODO: set media state support +#include + +#include "ASIXVendorRequests.h" +#include "Driver.h" +#include "Settings.h" -// frame header used during transfer data +// frame header used during transfer data struct TRXHeader { uint16 fLength; uint16 fInvertedLength; - - TRXHeader(uint16 length = 0){ SetLength(length); } + + TRXHeader(uint16 length = 0) { SetLength(length); } bool IsValid() { return (fLength ^ fInvertedLength) == 0xffff; } uint16 Length() { return fLength; } - //TODO: low-endian convertion? + // TODO: low-endian convertion? void SetLength(uint16 length) { fLength = length; fInvertedLength = ~fLength; @@ -34,45 +36,37 @@ struct TRXHeader { }; -ASIXDevice::ASIXDevice(usb_device device, const char *description) - : fStatus(B_ERROR), +ASIXDevice::ASIXDevice(usb_device device, DeviceInfo& deviceInfo) + : + fDevice(device), + fStatus(B_ERROR), fOpen(false), fRemoved(false), - fInsideNotify(0), - fDevice(device), - fDescription(description), - fNonBlocking(false), - fFrameSize(0), - fNotifyEndpoint(0), - fReadEndpoint(0), - fWriteEndpoint(0), - fNotifyReadSem(-1), - fNotifyWriteSem(-1), - fNotifyBuffer(NULL), - fNotifyBufferLength(0), - fLinkStateChangeSem(-1), fHasConnection(false), - fUseTRXHeader(false), - fReadNodeIDRequest(kInvalidRequest), - fReadRXControlRequest(kInvalidRequest), - fWriteRXControlRequest(kInvalidRequest), - fPromiscuousBits(0) -{ - const usb_device_descriptor - *deviceDescriptor = gUSBModule->get_device_descriptor(device); - - if (deviceDescriptor == NULL) { - TRACE_ALWAYS("Error of getting USB device descriptor.\n"); - return; - } + fNonBlocking(false), + fInsideNotify(0), + fFrameSize(0), + fNotifyEndpoint(0), + fReadEndpoint(0), + fWriteEndpoint(0), + fActualLengthRead(0), + fActualLengthWrite(0), + fStatusRead(B_OK), + fStatusWrite(B_OK), + fNotifyReadSem(-1), + fNotifyWriteSem(-1), + fNotifyBuffer(NULL), + fNotifyBufferLength(0), + fLinkStateChangeSem(-1), + fUseTRXHeader(false), + fReadNodeIDRequest(kInvalidRequest) +{ + fDeviceInfo = deviceInfo; fIPG[0] = 0x15; fIPG[1] = 0x0c; fIPG[2] = 0x12; - fVendorID = deviceDescriptor->vendor_id; - fProductID = deviceDescriptor->product_id; - fNotifyReadSem = create_sem(0, DRIVER_NAME"_notify_read"); if (fNotifyReadSem < B_OK) { TRACE_ALWAYS("Error of creating read notify semaphore:%#010x\n", @@ -82,7 +76,7 @@ ASIXDevice::ASIXDevice(usb_device device, const char *description) fNotifyWriteSem = create_sem(0, DRIVER_NAME"_notify_write"); if (fNotifyWriteSem < B_OK) { - TRACE_ALWAYS("Error of creating write notify semaphore:%#010x\n", + TRACE_ALWAYS("Error of creating write notify semaphore:%#010x\n", fNotifyWriteSem); return; } @@ -90,7 +84,7 @@ ASIXDevice::ASIXDevice(usb_device device, const char *description) if (_SetupEndpoints() != B_OK) { return; } - + // must be set in derived class constructor // fStatus = B_OK; } @@ -102,11 +96,11 @@ ASIXDevice::~ASIXDevice() delete_sem(fNotifyReadSem); if (fNotifyWriteSem >= B_OK) delete_sem(fNotifyWriteSem); - - if (!fRemoved) //??? + + if (!fRemoved) // ??? gUSBModule->cancel_queued_transfers(fNotifyEndpoint); - if(fNotifyBuffer) + if (fNotifyBuffer) free(fNotifyBuffer); } @@ -118,23 +112,23 @@ ASIXDevice::Open(uint32 flags) return B_BUSY; if (fRemoved) return B_ERROR; - + status_t result = StartDevice(); if (result != B_OK) { return result; } - + // setup state notifications result = gUSBModule->queue_interrupt(fNotifyEndpoint, fNotifyBuffer, fNotifyBufferLength, _NotifyCallback, this); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of requesting notify interrupt:%#010x\n", result); return result; } fNonBlocking = (flags & O_NONBLOCK) == O_NONBLOCK; fOpen = true; - return result; + return result; } @@ -154,7 +148,7 @@ ASIXDevice::Close() gUSBModule->cancel_queued_transfers(fWriteEndpoint); fOpen = false; - + return StopDevice(); } @@ -171,9 +165,9 @@ ASIXDevice::Read(uint8 *buffer, size_t *numBytes) { size_t numBytesToRead = *numBytes; *numBytes = 0; - + if (fRemoved) { - TRACE_ALWAYS("Error of receiving %d bytes from removed device.\n", + TRACE_ALWAYS("Error of receiving %d bytes from removed device.\n", numBytesToRead); return B_DEVICE_NOT_FOUND; } @@ -189,7 +183,7 @@ ASIXDevice::Read(uint8 *buffer, size_t *numBytes) size_t startIndex = fUseTRXHeader ? 0 : 1 ; size_t chunkCount = fUseTRXHeader ? 2 : 1 ; - status_t result = gUSBModule->queue_bulk_v(fReadEndpoint, + status_t result = gUSBModule->queue_bulk_v(fReadEndpoint, &rxData[startIndex], chunkCount, _ReadCallback, this); if (result != B_OK) { TRACE_ALWAYS("Error of queue_bulk_v request:%#010x\n", result); @@ -202,33 +196,34 @@ ASIXDevice::Read(uint8 *buffer, size_t *numBytes) TRACE_ALWAYS("Error of acquiring notify semaphore:%#010x.\n", result); return result; } - + if (fStatusRead != B_OK && fStatusRead != B_CANCELED && !fRemoved) { TRACE_ALWAYS("Device status error:%#010x\n", fStatusRead); result = gUSBModule->clear_feature(fReadEndpoint, USB_FEATURE_ENDPOINT_HALT); if (result != B_OK) { - TRACE_ALWAYS("Error during clearing of HALT state:%#010x.\n", result); + TRACE_ALWAYS("Error during clearing of HALT state:%#010x.\n", + result); return result; } } - - if(fUseTRXHeader) { - if(fActualLengthRead < sizeof(TRXHeader)) { - TRACE_ALWAYS("Error: no place for TRXHeader:only %d of %d bytes.\n", + + if (fUseTRXHeader) { + if (fActualLengthRead < sizeof(TRXHeader)) { + TRACE_ALWAYS("Error: no place for TRXHeader:only %d of %d bytes.\n", fActualLengthRead, sizeof(TRXHeader)); - return B_ERROR; //TODO: ??? + return B_ERROR; // TODO: ??? } - - if(!header.IsValid()) { - TRACE_ALWAYS("Error:TRX Header is invalid: len:%#04x; ilen:%#04x\n", + + if (!header.IsValid()) { + TRACE_ALWAYS("Error:TRX Header is invalid: len:%#04x; ilen:%#04x\n", header.fLength, header.fInvertedLength); - return B_ERROR; //TODO: ??? + return B_ERROR; // TODO: ??? } - + *numBytes = header.Length(); - if(fActualLengthRead - sizeof(TRXHeader) > header.Length()) { + if (fActualLengthRead - sizeof(TRXHeader) > header.Length()) { TRACE_ALWAYS("MISMATCH of the frame length: hdr %d; received:%d\n", header.Length(), fActualLengthRead - sizeof(TRXHeader)); } @@ -248,25 +243,25 @@ ASIXDevice::Write(const uint8 *buffer, size_t *numBytes) { size_t numBytesToWrite = *numBytes; *numBytes = 0; - + if (fRemoved) { - TRACE_ALWAYS("Error of writing %d bytes to removed device.\n", + TRACE_ALWAYS("Error of writing %d bytes to removed device.\n", numBytesToWrite); return B_DEVICE_NOT_FOUND; } TRACE_FLOW("Write %d bytes.\n", numBytesToWrite); - + TRXHeader header(numBytesToWrite); iovec txData[] = { { &header, sizeof(TRXHeader) }, { (uint8*)buffer, numBytesToWrite } }; - + size_t startIndex = fUseTRXHeader ? 0 : 1 ; size_t chunkCount = fUseTRXHeader ? 2 : 1 ; - - status_t result = gUSBModule->queue_bulk_v(fWriteEndpoint, + + status_t result = gUSBModule->queue_bulk_v(fWriteEndpoint, &txData[startIndex], chunkCount, _WriteCallback, this); if (result != B_OK) { TRACE_ALWAYS("Error of queue_bulk_v request:%#010x\n", result); @@ -274,7 +269,7 @@ ASIXDevice::Write(const uint8 *buffer, size_t *numBytes) } result = acquire_sem_etc(fNotifyWriteSem, 1, B_CAN_INTERRUPT, 0); - + if (result < B_OK) { TRACE_ALWAYS("Error of acquiring notify semaphore:%#010x.\n", result); return result; @@ -290,7 +285,7 @@ ASIXDevice::Write(const uint8 *buffer, size_t *numBytes) } } - if(fUseTRXHeader) { + if (fUseTRXHeader) { *numBytes = fActualLengthWrite - sizeof(TRXHeader); } else { *numBytes = fActualLengthWrite; @@ -311,36 +306,34 @@ ASIXDevice::Control(uint32 op, void *buffer, size_t length) case ETHER_GETADDR: memcpy(buffer, &fMACAddress, sizeof(fMACAddress)); return B_OK; - + case ETHER_GETFRAMESIZE: *(uint32 *)buffer = fFrameSize; return B_OK; - case ETHER_NONBLOCK: + case ETHER_NONBLOCK: TRACE("ETHER_NONBLOCK\n"); fNonBlocking = *((uint8*)buffer); return B_OK; - - case ETHER_SETPROMISC: + + case ETHER_SETPROMISC: TRACE("ETHER_SETPROMISC\n"); return SetPromiscuousMode(*((uint8*)buffer)); - + case ETHER_ADDMULTI: TRACE("ETHER_ADDMULTI\n"); - return ModifyMulticastTable(true, *((uint8*)buffer)); - + return ModifyMulticastTable(true, (ether_address_t*)buffer); + case ETHER_REMMULTI: TRACE("ETHER_REMMULTI\n"); - return ModifyMulticastTable(false, *((uint8*)buffer)); - -#if HAIKU_TARGET_PLATFORM_HAIKU + return ModifyMulticastTable(false, (ether_address_t*)buffer); + case ETHER_SET_LINK_STATE_SEM: fLinkStateChangeSem = *(sem_id *)buffer; return B_OK; case ETHER_GET_LINK_STATE: return GetLinkState((ether_link_state *)buffer); -#endif default: TRACE_ALWAYS("Unhandled IOCTL catched: %#010x\n", op); @@ -379,29 +372,29 @@ ASIXDevice::SetupDevice(bool deviceReplugged) { ether_address address; status_t result = ReadMACAddress(&address); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of reading MAC address:%#010x\n", result); return result; } TRACE("MAC address is:%02x:%02x:%02x:%02x:%02x:%02x\n", - address.ebyte[0], address.ebyte[1], address.ebyte[2], + address.ebyte[0], address.ebyte[1], address.ebyte[2], address.ebyte[3], address.ebyte[4], address.ebyte[5]); - if(deviceReplugged) { - // this might be the same device that was replugged - read the MAC address - // (which should be at the same index) to make sure - if(memcmp(&address, &fMACAddress, sizeof(address)) != 0) { + if (deviceReplugged) { + // this might be the same device that was replugged - read the MAC + // address (which should be at the same index) to make sure + if (memcmp(&address, &fMACAddress, sizeof(address)) != 0) { TRACE_ALWAYS("Cannot replace device with MAC address:" - "%02x:%02x:%02x:%02x:%02x:%02x\n", - fMACAddress.ebyte[0], fMACAddress.ebyte[1], fMACAddress.ebyte[2], + "%02x:%02x:%02x:%02x:%02x:%02x\n", + fMACAddress.ebyte[0], fMACAddress.ebyte[1], fMACAddress.ebyte[2], fMACAddress.ebyte[3], fMACAddress.ebyte[4], fMACAddress.ebyte[5]); return B_BAD_VALUE; // is not the same } - } else + } else fMACAddress = address; - - return B_OK; + + return B_OK; } @@ -416,8 +409,8 @@ ASIXDevice::CompareAndReattach(usb_device device) return B_ERROR; } - if (deviceDescriptor->vendor_id != fVendorID - && deviceDescriptor->product_id != fProductID) { + if (deviceDescriptor->vendor_id != fDeviceInfo.VendorId() + && deviceDescriptor->product_id != fDeviceInfo.ProductId()) { // this certainly isn't the same device return B_BAD_VALUE; } @@ -436,7 +429,7 @@ ASIXDevice::CompareAndReattach(usb_device device) // we need to setup hardware on device replug result = SetupDevice(true); if (result != B_OK) { - return result; + return result; } if (fOpen) { @@ -470,40 +463,47 @@ ASIXDevice::_SetupEndpoints() "USB device configuration\n"); return B_ERROR; } - + int notifyEndpoint = -1; int readEndpoint = -1; int writeEndpoint = -1; - for(size_t ep = 0; ep < interface->endpoint_count; ep++) { - usb_endpoint_descriptor *epd = interface->endpoint[ep].descr; - if((epd->attributes & USB_ENDPOINT_ATTR_MASK) == USB_ENDPOINT_ATTR_INTERRUPT) { - notifyEndpoint = ep; - continue; - } - - if((epd->attributes & USB_ENDPOINT_ATTR_MASK) != USB_ENDPOINT_ATTR_BULK) { - TRACE_ALWAYS("Error: USB endpoint type %#04x is unknown.\n", epd->attributes); - continue; - } - - if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) - == USB_ENDPOINT_ADDR_DIR_IN) { - readEndpoint = ep; - continue; - } - - if((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_OUT) - == USB_ENDPOINT_ADDR_DIR_OUT) { - writeEndpoint = ep; - continue; - } + for (size_t ep = 0; ep < interface->endpoint_count; ep++) { + usb_endpoint_descriptor *epd = interface->endpoint[ep].descr; + if ((epd->attributes & USB_ENDPOINT_ATTR_MASK) + == USB_ENDPOINT_ATTR_INTERRUPT) + { + notifyEndpoint = ep; + continue; + } + + if ((epd->attributes & USB_ENDPOINT_ATTR_MASK) + != USB_ENDPOINT_ATTR_BULK) + { + TRACE_ALWAYS("Error: USB endpoint type %#04x is unknown.\n", + epd->attributes); + continue; + } + + if ((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) + == USB_ENDPOINT_ADDR_DIR_IN) + { + readEndpoint = ep; + continue; + } + + if ((epd->endpoint_address & USB_ENDPOINT_ADDR_DIR_OUT) + == USB_ENDPOINT_ADDR_DIR_OUT) + { + writeEndpoint = ep; + continue; + } } - + if (notifyEndpoint == -1 || readEndpoint == -1 || writeEndpoint == -1) { TRACE_ALWAYS("Error: not all USB endpoints were found: " - "notify:%d; read:%d; write:%d\n", - notifyEndpoint, readEndpoint, writeEndpoint); + "notify:%d; read:%d; write:%d\n", + notifyEndpoint, readEndpoint, writeEndpoint); return B_ERROR; } @@ -512,7 +512,7 @@ ASIXDevice::_SetupEndpoints() fNotifyEndpoint = interface->endpoint[notifyEndpoint].handle; fReadEndpoint = interface->endpoint[readEndpoint ].handle; fWriteEndpoint = interface->endpoint[writeEndpoint ].handle; - + return B_OK; } @@ -521,16 +521,16 @@ status_t ASIXDevice::ReadMACAddress(ether_address_t *address) { size_t actual_length = 0; - status_t result = gUSBModule->send_request(fDevice, + status_t result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, fReadNodeIDRequest, 0, 0, sizeof(ether_address), address, &actual_length); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of reading MAC address:%#010x\n", result); return result; } - if(actual_length != sizeof(ether_address)) { + if (actual_length != sizeof(ether_address)) { TRACE_ALWAYS("Mismatch of NODE ID data size: %d instead of %d bytes\n", actual_length, sizeof(ether_address)); return B_ERROR; @@ -545,28 +545,28 @@ ASIXDevice::ReadRXControlRegister(uint16 *rxcontrol) { size_t actual_length = 0; *rxcontrol = 0; - - status_t result = gUSBModule->send_request(fDevice, + + status_t result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - fReadRXControlRequest, 0, 0, + READ_RX_CONTROL, 0, 0, sizeof(*rxcontrol), rxcontrol, &actual_length); - if(sizeof(*rxcontrol) != actual_length) { + if (sizeof(*rxcontrol) != actual_length) { TRACE_ALWAYS("Mismatch during reading RX control register." - "Read %d bytes instead of %d.\n", + "Read %d bytes instead of %d.\n", actual_length, sizeof(*rxcontrol)); } - return result; + return result; } status_t ASIXDevice::WriteRXControlRegister(uint16 rxcontrol) { - status_t result = gUSBModule->send_request(fDevice, + status_t result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - fWriteRXControlRequest, rxcontrol, 0, 0, 0, 0); + WRITE_RX_CONTROL, rxcontrol, 0, 0, 0, 0); return result; } @@ -575,13 +575,13 @@ status_t ASIXDevice::StopDevice() { status_t result = WriteRXControlRegister(0); - - if(result != B_OK) { + + if (result != B_OK) { TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", 0, result); - } - + } + TRACE_RET(result); - return result; + return result; } @@ -589,35 +589,113 @@ status_t ASIXDevice::SetPromiscuousMode(bool on) { uint16 rxcontrol = 0; - + status_t result = ReadRXControlRegister(&rxcontrol); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of reading RX Control:%#010x\n", result); return result; } - if(on) - rxcontrol |= fPromiscuousBits; + if (on) + rxcontrol |= RXCTL_PROMISCUOUS; else - rxcontrol &= ~fPromiscuousBits; + rxcontrol &= ~RXCTL_PROMISCUOUS; result = WriteRXControlRegister(rxcontrol); - - if(result != B_OK ) { - TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", rxcontrol, result); + + if (result != B_OK ) { + TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", + rxcontrol, result); } - + TRACE_RET(result); - return result; + return result; +} + + +uint32 +ASIXDevice::EthernetCRC32(const uint8* buffer, size_t length) +{ + uint32 result = 0xffffffff; + for (size_t i = 0; i < length; i++) { + uint8 data = *buffer++; + for (int bit = 0; bit < 8; bit++, data >>= 1) { + uint32 carry = ((result & 0x80000000) ? 1 : 0) ^ (data & 0x01); + result <<= 1; + if (carry != 0) + result = (result ^ 0x04c11db6) | carry; + } + } + return result; } status_t -ASIXDevice::ModifyMulticastTable(bool add, uint8 address) +ASIXDevice::ModifyMulticastTable(bool join, ether_address_t* group) { - //TODO: !!! - TRACE_ALWAYS("Call for (%d, %#02x) is not implemented\n", add, address); - return B_OK; + char groupName[6 * 3 + 1] = { 0 }; + sprintf(groupName, "%02x:%02x:%02x:%02x:%02x:%02x", + group->ebyte[0], group->ebyte[1], group->ebyte[2], + group->ebyte[3], group->ebyte[4], group->ebyte[5]); + TRACE("%s multicast group %s\n", join ? "Joining" : "Leaving", groupName); + + uint32 hash = EthernetCRC32(group->ebyte, 6); + bool isInTable = fMulticastHashes.Find(hash) != fMulticastHashes.End(); + + if (isInTable && join) + return B_OK; // already listed - nothing to do + + if (!isInTable && !join) { + TRACE_ALWAYS("Cannot leave unlisted multicast group %s!\n", groupName); + return B_ERROR; + } + + const size_t hashLength = 8; + uint8 hashTable[hashLength] = { 0 }; + + if (join) + fMulticastHashes.PushBack(hash); + else + fMulticastHashes.Remove(hash); + + for (int32 i = 0; i < fMulticastHashes.Count(); i++) { + uint32 hash = fMulticastHashes[i] >> 26; + hashTable[hash / 8] |= 1 << (hash % 8); + } + + uint16 rxcontrol = 0; + + status_t result = ReadRXControlRegister(&rxcontrol); + if (result != B_OK) { + TRACE_ALWAYS("Error of reading RX Control:%#010x\n", result); + return result; + } + + if (fMulticastHashes.Count() > 0) + rxcontrol |= RXCTL_MULTICAST; + else + rxcontrol &= ~RXCTL_MULTICAST; + + // write multicast hash table + size_t actualLength = 0; + result = gUSBModule->send_request(fDevice, + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, + WRITE_MF_ARRAY, 0, 0, + hashLength, hashTable, &actualLength); + if (result != B_OK) { + TRACE_ALWAYS("Error writing hash table in MAR: %#010x.\n", result); + return result; + } + + if (actualLength != hashLength) + TRACE_ALWAYS("Incomplete writing of hash table: %d bytes of %d\n", + actualLength, hashLength); + + result = WriteRXControlRegister(rxcontrol); + if (result != B_OK) + TRACE_ALWAYS("Error writing %#02X to RXC:%#010x.\n", rxcontrol, result); + + return result; } @@ -660,10 +738,11 @@ ASIXDevice::_NotifyCallback(void *cookie, int32 status, void *data, TRACE_ALWAYS("Device status error:%#010x\n", status); status_t result = gUSBModule->clear_feature(device->fNotifyEndpoint, USB_FEATURE_ENDPOINT_HALT); - if(result != B_OK) - TRACE_ALWAYS("Error during clearing of HALT state:%#010x.\n", result); + if (result != B_OK) + TRACE_ALWAYS("Error during clearing of HALT state:%#010x.\n", + result); } - + // parse data in overriden class device->OnNotify(actualLength); diff --git a/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.h b/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.h index ff3807f7cc..af8be00be0 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.h +++ b/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.h @@ -1,26 +1,48 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ - #ifndef _USB_ASIX_DEVICE_H_ #define _USB_ASIX_DEVICE_H_ -#include + +#include +#include #include "Driver.h" #include "MIIBus.h" + +struct DeviceInfo { + union Id { + uint16 fIds[2]; + uint32 fKey; + } fId; + + enum Type { + AX88172 = 0, + AX88772 = 1, + AX88178 = 2 + } fType; + + const char* fName; + + inline uint16 VendorId() { return fId.fIds[0]; } + inline uint16 ProductId() { return fId.fIds[1]; } + inline uint32 Key() { return fId.fKey; } +}; + + class ASIXDevice { public: - ASIXDevice(usb_device device, const char *description); + ASIXDevice(usb_device device, DeviceInfo& devInfo); virtual ~ASIXDevice(); status_t InitCheck() { return fStatus; }; @@ -40,7 +62,7 @@ public: status_t CompareAndReattach(usb_device device); virtual status_t SetupDevice(bool deviceReplugged); - + private: static void _ReadCallback(void *cookie, int32 status, void *data, uint32 actualLength); @@ -52,27 +74,31 @@ static void _NotifyCallback(void *cookie, int32 status, status_t _SetupEndpoints(); protected: - /* overrides */ + // overrides virtual status_t StartDevice() = 0; virtual status_t StopDevice(); virtual status_t OnNotify(uint32 actualLength) = 0; -virtual status_t GetLinkState(ether_link_state *state) = 0; +virtual status_t GetLinkState(ether_link_state *state) = 0; virtual status_t SetPromiscuousMode(bool bOn); -virtual status_t ModifyMulticastTable(bool add, uint8 address); + uint32 EthernetCRC32(const uint8* buffer, size_t length); +virtual status_t ModifyMulticastTable(bool add, + ether_address_t* group); status_t ReadMACAddress(ether_address_t *address); status_t ReadRXControlRegister(uint16 *rxcontrol); status_t WriteRXControlRegister(uint16 rxcontrol); - + + // device info + usb_device fDevice; + DeviceInfo fDeviceInfo; + ether_address_t fMACAddress; + // state tracking status_t fStatus; bool fOpen; bool fRemoved; - vint32 fInsideNotify; - usb_device fDevice; - uint16 fVendorID; - uint16 fProductID; -const char * fDescription; + bool fHasConnection; bool fNonBlocking; + vint32 fInsideNotify; // interface and device infos uint16 fFrameSize; @@ -89,23 +115,19 @@ const char * fDescription; int32 fStatusWrite; sem_id fNotifyReadSem; sem_id fNotifyWriteSem; - + uint8 * fNotifyBuffer; uint32 fNotifyBufferLength; + sem_id fLinkStateChangeSem; // MII bus handler MIIBus fMII; // connection data - sem_id fLinkStateChangeSem; - ether_address_t fMACAddress; - bool fHasConnection; bool fUseTRXHeader; uint8 fIPG[3]; uint8 fReadNodeIDRequest; - uint8 fReadRXControlRequest; - uint8 fWriteRXControlRequest; - uint16 fPromiscuousBits; + Vector fMulticastHashes; }; -#endif //_USB_ASIX_DEVICE_H_ +#endif // _USB_ASIX_DEVICE_H_ diff --git a/src/add-ons/kernel/drivers/network/usb_asix/ASIXVendorRequests.h b/src/add-ons/kernel/drivers/network/usb_asix/ASIXVendorRequests.h new file mode 100644 index 0000000000..59ec0ec61c --- /dev/null +++ b/src/add-ons/kernel/drivers/network/usb_asix/ASIXVendorRequests.h @@ -0,0 +1,73 @@ +/* + * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. + * Copyright (c) 2011 S.Zharski + * Distributed under the terms of the MIT license. + * + */ +#ifndef _ASIX_VENDOR_REQUESTS_H_ +#define _ASIX_VENDOR_REQUESTS_H_ + + +// USB Vendor Requests used by all chip types +// For chip-spercific information look into +// corresponding AX88***Device.cpp files. +enum ASIXVendorRequests { + READ_RXTX_SRAM = 0x02, + WRITE_RXTX_SRAM = 0x03, // AX88178-772 + WRITE_RX_SRAM = 0x03, // AX88172 + WRITE_TX_SRAM = 0x04, // AX88172 + SW_MII_OP = 0x06, + READ_MII = 0x07, + WRITE_MII = 0x08, + READ_MII_OP_MODE = 0x09, // AX88172-772 + READ_MII_STATUS = 0x09, // AX88178 + HW_MII_OP = 0x0A, + READ_SROM = 0x0B, + WRITE_SROM = 0x0C, + WRITE_SROM_ENABLE = 0x0D, + WRITE_SROM_DISABLE = 0x0E, + READ_RX_CONTROL = 0x0F, + WRITE_RX_CONTROL = 0x10, + READ_IPGS = 0x11, + WRITE_IPGS = 0x12, // AX88178-772 + WRITE_IPG0 = 0x12, // AX88172 + WRITE_IPG1 = 0x13, // AX88172 + WRITE_IPG2 = 0x14, // AX88172 + READ_NODEID = 0x13, // AX88178-772 + WRITE_NODEID = 0x14, // AX88178-772 + READ_MF_ARRAY = 0x15, + WRITE_MF_ARRAY = 0x16, + READ_TEST = 0x17, // AX88178-772 + READ_NODEID_AX88172 = 0x17, // AX88172 + WRITE_NODEID_AX88172 = 0x18, // AX88172 + READ_PHYID = 0x19, + READ_MEDIUM_STATUS = 0x1A, + WRITE_MEDIUM_MODE = 0x1B, + GET_MONITOR_MODE = 0x1C, + SET_MONITOR_MODE = 0x1D, + READ_GPIOS = 0x1E, + WRITE_GPIOS = 0x1F, + WRITE_SOFT_RESET = 0x20, // AX88178-772 + READ_PHY_SEL_STATE = 0x21, // AX88772 + WRITE_PHY_SEL = 0x22, // AX88772 + READ_MIIS_IF_STATE = 0x21, // AX88178 + WRITE_MIIS_IF_STATE = 0x22 // AX88178 +}; + + +// RX Control Register bits +enum ASIXRXControl { + RXCTL_PROMISCUOUS = 0x0001, + RXCTL_ALL_MULTICAT = 0x0002, + RXCTL_UNICAST = 0x0004, // AX88172 + RXCTL_SEP = 0x0004, // AX88772-178 + RXCTL_BROADCAST = 0x0008, + RXCTL_MULTICAST = 0x0010, + RXCTL_AP = 0x0020, // AX88772-178 + RXCTL_START = 0x0080, + RXCTL_USB_MFB = 0x0100 // AX88772-178 +}; + + +#endif // _ASIX_VENDOR_REQUESTS_H_ + diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.cpp b/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.cpp index fc49ffb9ea..3de0da38ad 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.cpp @@ -1,6 +1,6 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. * * Heavily based on code of the @@ -10,52 +10,60 @@ * */ -#include "Settings.h" + #include "AX88172Device.h" +#include -enum AX88172_Requests { - READ_RXTX_SRAM = 0x02, // C0 02 XX YY 0M 00 0200 Read Rx/Tx SRAM - // M = 0 : Rx, M=1 : Tx - WRITE_RX_SRAM = 0x03, // 40 03 XX YY PP QQ 0000 Write Rx SRAM - WRITE_TX_SRAM = 0x04, // 40 04 XX YY PP QQ 0000 Write Tx SRAM - SW_MII_OP = 0x06, // 40 06 00 00 00 00 0000 Software MII Operation - READ_MII = 0x07, // C0 07 PI 00 RG 00 0200 Read MII Register - WRITE_MII = 0x08, // 40 08 PI 00 RG 00 0200 Write MII Register - READ_MII_OP_MODE = 0x09, // C0 09 00 00 00 00 0100 Read MII Operation Mode - HW_MII_OP = 0x0A, // 40 0A 00 00 00 00 0000 Hardware MII Operation - READ_SROM = 0x0B, // C0 0B DR 00 00 00 0200 Read SROM - WRITE_SROM = 0x0C, // 40 0C DR 00 MM SS 0000 Write SROM - WRITE_SROM_ENABLE = 0x0D, // 40 0D 00 00 00 00 0000 Write SROM Enable - WRITE_SROM_DISABLE = 0x0E, // 40 0E 00 00 00 00 0000 Write SROM Disable - READ_RX_CONTROL = 0x0F, // C0 0F 00 00 00 00 0200 Read Rx Control Register - WRITE_RX_CONTROL = 0x10, // 40 10 RR 00 00 00 0000 Write Rx Control Register - READ_IPGS = 0x11, // C0 11 00 00 00 00 0300 Read IPG/IPG1/IPG2 Register - WRITE_IPG0 = 0x12, // 40 12 II 00 00 00 0000 Write IPG Register - WRITE_IPG1 = 0x13, // 40 13 II 00 00 00 0000 Write IPG1 Register - WRITE_IPG2 = 0x14, // 40 14 II 00 00 00 0000 Write IPG2 Register - READ_MF_ARRAY = 0x15, // C0 15 00 00 00 00 0800 Read Multi-Filter Array - WRITE_MF_ARRAY = 0x16, // 40 16 00 00 00 00 0800 Write Multi-Filter Array - READ_NODEID = 0x17, // C0 17 00 00 00 00 0600 Read Node ID - WRITE_NODEID = 0x18, // - READ_PHYID = 0x19, // C0 19 00 00 00 00 0200 Read Ethernet/HomePNA PhyID - READ_MEDIUM_STATUS = 0x1A, // C0 1A 00 00 00 00 0100 Read Medium Status - WRITE_MEDIUM_MODE = 0x1B, // 40 1B MM 00 00 00 0000 Write Medium Mode - GET_MONITOR_MODE = 0x1C, // C0 1C 00 00 00 00 0100 Get Monitor Mode Status - SET_MONITOR_MODE = 0x1D, // 40 1D MM 00 00 00 0000 Set Monitor Mode On/Off - READ_GPIOS = 0x1E, // C0 1E 00 00 00 00 0100 Read GPIOs - WRITE_GPIOS = 0x1F // 40 1F MM 00 00 00 0000 Write GPIOs -}; +#include "ASIXVendorRequests.h" +#include "Settings.h" + + +// Most of vendor requests for all supported chip types use the same +// constants (see ASIXVendorRequests.h) but the layout of request data +// may be slightly diferrent for specific chip type. Below is a quick +// reference for AX88172 vendor requests data layout. +// +// READ_RXTX_SRAM, // C0 02 XX YY 0M 00 0200 Read Rx/Tx SRAM + // M = 0 : Rx, M=1 : Tx +// WRITE_RX_SRAM, // 40 03 XX YY PP QQ 0000 Write Rx SRAM +// WRITE_TX_SRAM, // 40 04 XX YY PP QQ 0000 Write Tx SRAM +// SW_MII_OP, // 40 06 00 00 00 00 0000 Software MII Operation +// READ_MII, // C0 07 PI 00 RG 00 0200 Read MII Register +// WRITE_MII, // 40 08 PI 00 RG 00 0200 Write MII Register +// READ_MII_OP_MODE, // C0 09 00 00 00 00 0100 Read MII Operation Mode +// HW_MII_OP, // 40 0A 00 00 00 00 0000 Hardware MII Operation +// READ_SROM, // C0 0B DR 00 00 00 0200 Read SROM +// WRITE_SROM, // 40 0C DR 00 MM SS 0000 Write SROM +// WRITE_SROM_ENABLE, // 40 0D 00 00 00 00 0000 Write SROM Enable +// WRITE_SROM_DISABLE, // 40 0E 00 00 00 00 0000 Write SROM Disable +// READ_RX_CONTROL, // C0 0F 00 00 00 00 0200 Read Rx Control Register +// WRITE_RX_CONTROL, // 40 10 RR 00 00 00 0000 Write Rx Control Register +// READ_IPGS, // C0 11 00 00 00 00 0300 Read IPG/IPG1/IPG2 Register +// WRITE_IPG0, // 40 12 II 00 00 00 0000 Write IPG Register +// WRITE_IPG1, // 40 13 II 00 00 00 0000 Write IPG1 Register +// WRITE_IPG2, // 40 14 II 00 00 00 0000 Write IPG2 Register +// READ_MF_ARRAY, // C0 15 00 00 00 00 0800 Read Multi-Filter Array +// WRITE_MF_ARRAY, // 40 16 00 00 00 00 0800 Write Multi-Filter Array +// READ_NODEID, // C0 17 00 00 00 00 0600 Read Node ID +// WRITE_NODEID, // +// READ_PHYID, // C0 19 00 00 00 00 0200 Read Ethernet/HomePNA PhyID +// READ_MEDIUM_STATUS, // C0 1A 00 00 00 00 0100 Read Medium Status +// WRITE_MEDIUM_MODE, // 40 1B MM 00 00 00 0000 Write Medium Mode +// GET_MONITOR_MODE, // C0 1C 00 00 00 00 0100 Get Monitor Mode Status +// SET_MONITOR_MODE, // 40 1D MM 00 00 00 0000 Set Monitor Mode On/Off +// READ_GPIOS, // C0 1E 00 00 00 00 0100 Read GPIOs +// WRITE_GPIOS, // 40 1F MM 00 00 00 0000 Write GPIOs // RX Control Register bits -enum AX88172_RXControl { - RXCTL_PROMISCUOUS = 0x0001, // - RXCTL_ALL_MULTICAT = 0x0002, // - RXCTL_UNICAST = 0x0004, // ??? - RXCTL_BROADCAST = 0x0008, // - RXCTL_MULTICAST = 0x0010, // - RXCTL_START = 0x0080 // -}; +// RXCTL_PROMISCUOUS, // forward all frames up to the host +// RXCTL_ALL_MULTICAT, // forward all multicast frames up to the host +// RXCTL_UNICAST, // ??? +// RXCTL_BROADCAST, // forward broadcast frames up to the host +// RXCTL_MULTICAST, // forward all multicast frames that are +// matching to multicast filter up to the host +// RXCTL_START, // ethernet MAC start operating + // PHY IDs request answer data layout struct PhyIDs { @@ -63,6 +71,7 @@ struct PhyIDs { uint8 PhyID2; } _PACKED; + // Medium state bits enum AX88172_MediumState { MEDIUM_STATE_FULL_DUPLEX = 0x02, @@ -70,6 +79,7 @@ enum AX88172_MediumState { MEDIUM_STATE_FLOW_CONTOL_EN = 0x10 }; + // Monitor Mode bits enum AX88172_MonitorMode { MONITOR_MODE = 0x01, @@ -78,6 +88,7 @@ enum AX88172_MonitorMode { MONITOR_MODE_HS_FS = 0x10 }; + // General Purpose I/O Register enum AX88172_GPIO { GPIO_OO_0EN = 0x01, @@ -88,6 +99,7 @@ enum AX88172_GPIO { GPIO_IO_2 = 0x20 }; + // Notification data layout struct AX88172Notify { uint8 btA1; @@ -100,16 +112,20 @@ struct AX88172Notify { uint8 bt07; } _PACKED; + // Link-State bits enum AX88172_LinkState { LINK_STATE_PHY1 = 0x01, LINK_STATE_PHY2 = 0x02 }; + const uint16 maxFrameSize = 1518; -AX88172Device::AX88172Device(usb_device device, const char *description) - : ASIXDevice(device, description) + +AX88172Device::AX88172Device(usb_device device, DeviceInfo& deviceInfo) + : + ASIXDevice(device, deviceInfo) { fStatus = InitDevice(); } @@ -120,11 +136,7 @@ AX88172Device::InitDevice() { fFrameSize = maxFrameSize; - fReadNodeIDRequest = READ_NODEID; - fReadRXControlRequest = READ_RX_CONTROL; - fWriteRXControlRequest = WRITE_RX_CONTROL; - - fPromiscuousBits = RXCTL_PROMISCUOUS; + fReadNodeIDRequest = READ_NODEID_AX88172; fNotifyBufferLength = sizeof(AX88172Notify); fNotifyBuffer = (uint8 *)malloc(fNotifyBufferLength); @@ -136,19 +148,19 @@ AX88172Device::InitDevice() TRACE_RET(B_OK); return B_OK; } + + status_t AX88172Device::SetupDevice(bool deviceReplugged) { status_t result = ASIXDevice::SetupDevice(deviceReplugged); - if(result != B_OK) { + if (result != B_OK) { return result; } - result = fMII.Init(fDevice, - SW_MII_OP, READ_MII, WRITE_MII, - READ_MII_OP_MODE, HW_MII_OP, READ_PHYID); + result = fMII.Init(fDevice); - if(result == B_OK) + if (result == B_OK) return fMII.SetupPHY(); TRACE_RET(result); @@ -161,27 +173,27 @@ AX88172Device::StartDevice() { size_t actualLength = 0; - for(size_t i = 0; i < sizeof(fIPG)/sizeof(fIPG[0]); i++) { + for (size_t i = 0; i < sizeof(fIPG) / sizeof(fIPG[0]); i++) { status_t result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_IPG0, 0, 0, sizeof(fIPG[i]), &fIPG[i], &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error writing IPG%d: %#010x\n", i, result); return result; } - if(actualLength != sizeof(fIPG[i])) { + if (actualLength != sizeof(fIPG[i])) { TRACE_ALWAYS("Mismatch of written IPG%d data. " - "%d bytes of %d written.\n", i, actualLength, sizeof(fIPG[i])); + "%d bytes of %d written.\n", i, actualLength, sizeof(fIPG[i])); } } - uint16 rxcontrol = RXCTL_START | RXCTL_MULTICAST - | RXCTL_UNICAST | RXCTL_BROADCAST; + uint16 rxcontrol = RXCTL_START | RXCTL_UNICAST | RXCTL_BROADCAST; status_t result = WriteRXControlRegister(rxcontrol); - if(result != B_OK) { - TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", rxcontrol, result); + if (result != B_OK) { + TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", + rxcontrol, result); } TRACE_RET(result); @@ -200,7 +212,7 @@ AX88172Device::OnNotify(uint32 actualLength) AX88172Notify *notification = (AX88172Notify *)fNotifyBuffer; - if(notification->btA1 != 0xa1) { + if (notification->btA1 != 0xa1) { TRACE_ALWAYS("Notify magic byte is invalid: %#02x\n", notification->btA1); } @@ -225,7 +237,7 @@ AX88172Device::OnNotify(uint32 actualLength) bool linkStateChange = linkIsUp != fHasConnection; fHasConnection = linkIsUp; - if(linkStateChange) { + if (linkStateChange) { TRACE("Link state of PHY%d has been changed to '%s'\n", phyIndex, fHasConnection ? "up" : "down"); } @@ -236,6 +248,7 @@ AX88172Device::OnNotify(uint32 actualLength) return B_OK; } + status_t AX88172Device::GetLinkState(ether_link_state *linkState) { @@ -243,13 +256,13 @@ AX88172Device::GetLinkState(ether_link_state *linkState) uint16 miiANLPAR = 0; status_t result = fMII.Read(MII_ANAR, &miiANAR); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error reading MII ANAR register:%#010x\n", result); return result; } result = fMII.Read(MII_ANLPAR, &miiANLPAR); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error reading MII ANLPAR register:%#010x\n", result); return result; } @@ -261,14 +274,15 @@ AX88172Device::GetLinkState(ether_link_state *linkState) linkState->quality = 1000; linkState->media = IFM_ETHER | (fHasConnection ? IFM_ACTIVE : 0); - linkState->media |= mediumStatus & (ANLPAR_TX_FD | ANLPAR_10_FD) ? + linkState->media |= mediumStatus & (ANLPAR_TX_FD | ANLPAR_10_FD) ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; - linkState->speed = mediumStatus & (ANLPAR_TX_FD | ANLPAR_TX_HD) ? 100000000 : 10000000; + linkState->speed = mediumStatus & (ANLPAR_TX_FD | ANLPAR_TX_HD) + ? 100000000 : 10000000; TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n", (linkState->media & IFM_ACTIVE) ? "active" : "inactive", - linkState->speed, + linkState->speed / 1000000, (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); return B_OK; } diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.h b/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.h index b88c669786..aabaf8cbda 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.h +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.h @@ -1,30 +1,31 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ - #ifndef _USB_AX88172_DEVICE_H_ #define _USB_AX88172_DEVICE_H_ + #include "ASIXDevice.h" + class AX88172Device : public ASIXDevice { public: - AX88172Device(usb_device device, const char *description); + AX88172Device(usb_device device, DeviceInfo& info); protected: status_t InitDevice(); virtual status_t SetupDevice(bool deviceReplugged); virtual status_t StartDevice(); virtual status_t OnNotify(uint32 actualLength); -virtual status_t GetLinkState(ether_link_state *state); +virtual status_t GetLinkState(ether_link_state *state); }; -#endif //_USB_AX88172_DEVICE_H_ +#endif // _USB_AX88172_DEVICE_H_ diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.cpp b/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.cpp index da9cb85c05..092e7e04a7 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.cpp @@ -1,6 +1,6 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. * * Heavily based on code of the @@ -10,54 +10,63 @@ * */ -#include "Settings.h" + #include "AX88178Device.h" -// Vendor USB requests for AX88178 -enum AX88178_Requests { - READ_RXTX_SRAM = 0x02, //C002_AA0B_0C00_0800 Rx/Tx SRAM Read - WRITE_RXTX_SRAM = 0x03, //4003_AA0B_0C00_0800 Rx/Tx SRAM Write - SW_MII_OP = 0x06, //4006_0000_0000_0000 SW Serial Management Control - READ_MII = 0x07, //c007_aa00_cc00_0200 PHY Read - WRITE_MII = 0x08, //4008_aa00_cc00_0200 PHY Write - READ_MII_STATUS = 0x09, //c009_0000_0000_0100 Serial Management Status - HW_MII_OP = 0x0A, //400a_0000_0000_0000 HW Serial Management Control - READ_SROM = 0x0B, //C00B_AA00_0000_0200 SROM Read - WRITE_SROM = 0x0C, //400C_AA00_CCDD_0000 SROM Write - WRITE_SROM_ENABLE = 0x0D, //400D_0000_0000_0000 SROM Write Enable - WRITE_SROM_DISABLE = 0x0E, //400E_0000_0000_0000 SROM Write Disable - READ_RX_CONTROL = 0x0F, //C00F_0000_0000_0200 Read Rx Control - WRITE_RX_CONTROL = 0x10, //4010_AABB_0000_0000 Write Rx Control - READ_IPGS = 0x11, //C011_0000_0000_0300 Read IPG/IPG1/IPG2 Register - WRITE_IPGS = 0x12, //4012_AABB_CC00_0000 Write IPG/IPG1/IPG2 Register - READ_NODEID = 0x13, //C013_0000_0000_0600 Read Node ID - WRITE_NODEID = 0x14, //4014_0000_0000_0600 Write Node ID - READ_MF_ARRAY = 0x15, //C015_0000_0000_0800 Read Multicast Filter Array - WRITE_MF_ARRAY = 0x16, //4016_0000_0000_0800 Write Multicast Filter Array - READ_TEST = 0x17, //4017_AA00_0000_0000 Write Test Register - READ_PHYID = 0x19, //C019_0000_0000_0200 Read Ethernet/HomePNA PHY Address - READ_MEDIUM_STATUS = 0x1A, //C01A_0000_0000_0200 Read Medium Status - WRITE_MEDIUM_MODE = 0x1B, //401B_AABB_0000_0000 Write Medium Mode Register - GET_MONITOR_MODE = 0x1C, //C01C_0000_0000_0100 Read Monitor Mode Status - SET_MONITOR_MODE = 0x1D, //401D_AA00_0000_0000 Write Monitor Mode Register - READ_GPIOS = 0x1E, //C01E_0000_0000_0100 Read GPIOs Status - WRITE_GPIOS = 0x1F, //401F_AA00_0000_0000 Write GPIOs - WRITE_SOFT_RESET = 0x20, //4020_AA00_0000_0000 Write Software Reset - READ_MIIS_IF_STATE = 0x21, //C021_AA00_0000_0100 Read MII/GMII/RGMII Interface Status - WRITE_MIIS_IF_STATE = 0x22 //4022_AA00_0000_0000 Write MII/GMII/RGMII Interface Control -}; +#include + +#include "ASIXVendorRequests.h" +#include "Settings.h" + + +// Most of vendor requests for all supported chip types use the same +// constants (see ASIXVendorRequests.h) but the layout of request data +// may be slightly diferrent for specific chip type. Below is a quick +// reference for AX88178 vendor requests data layout. + +// READ_RXTX_SRAM, //C002_AA0B_0C00_0800 Rx/Tx SRAM Read +// WRITE_RXTX_SRAM, //4003_AA0B_0C00_0800 Rx/Tx SRAM Write +// SW_MII_OP, //4006_0000_0000_0000 SW Serial Management Control +// READ_MII, //c007_aa00_cc00_0200 PHY Read +// WRITE_MII, //4008_aa00_cc00_0200 PHY Write +// READ_MII_STATUS, //c009_0000_0000_0100 Serial Management Status +// HW_MII_OP, //400a_0000_0000_0000 HW Serial Management Control +// READ_SROM, //C00B_AA00_0000_0200 SROM Read +// WRITE_SROM, //400C_AA00_CCDD_0000 SROM Write +// WRITE_SROM_ENABLE, //400D_0000_0000_0000 SROM Write Enable +// WRITE_SROM_DISABLE, //400E_0000_0000_0000 SROM Write Disable +// READ_RX_CONTROL, //C00F_0000_0000_0200 Read Rx Control +// WRITE_RX_CONTROL, //4010_AABB_0000_0000 Write Rx Control +// READ_IPGS, //C011_0000_0000_0300 Read IPG/IPG1/IPG2 Register +// WRITE_IPGS, //4012_AABB_CC00_0000 Write IPG/IPG1/IPG2 Register +// READ_NODEID, //C013_0000_0000_0600 Read Node ID +// WRITE_NODEID, //4014_0000_0000_0600 Write Node ID +// READ_MF_ARRAY, //C015_0000_0000_0800 Read Multicast Filter Array +// WRITE_MF_ARRAY, //4016_0000_0000_0800 Write Multicast Filter Array +// READ_TEST, //4017_AA00_0000_0000 Write Test Register +// READ_PHYID, //C019_0000_0000_0200 Read Ethernet/HomePNA PHY Address +// READ_MEDIUM_STATUS, //C01A_0000_0000_0200 Read Medium Status +// WRITE_MEDIUM_MODE, //401B_AABB_0000_0000 Write Medium Mode Register +// GET_MONITOR_MODE, //C01C_0000_0000_0100 Read Monitor Mode Status +// SET_MONITOR_MODE, //401D_AA00_0000_0000 Write Monitor Mode Register +// READ_GPIOS, //C01E_0000_0000_0100 Read GPIOs Status +// WRITE_GPIOS, //401F_AA00_0000_0000 Write GPIOs +// WRITE_SOFT_RESET, //4020_AA00_0000_0000 Write Software Reset +// READ_MIIS_IF_STATE, //C021_AA00_0000_0100 Read MII/GMII/RGMII Iface Status +// WRITE_MIIS_IF_STATE, //4022_AA00_0000_0000 Write MII/GMII/RGMII Iface Control // RX Control Register bits -enum AX88178_RXControl { - RXCTL_PROMISCUOUS = 0x0001, // - RXCTL_ALL_MULTICAT = 0x0002, // -// RXCTL_SEP = 0x0004, // do not set it! - RXCTL_BROADCAST = 0x0008, // - RXCTL_MULTICAST = 0x0010, // - RXCTL_AP = 0x0020, // - RXCTL_START = 0x0080, // - RXCTL_USB_MFB = 0x0100 // Max Frame Burst TX on USB -}; +// RXCTL_PROMISCUOUS, // forward all frames up to the host +// RXCTL_ALL_MULTICAT, // forward all multicast frames up to the host +// RXCTL_SEP, // forward frames with CRC error up to the host +// RXCTL_BROADCAST, // forward broadcast frames up to the host +// RXCTL_MULTICAST, // forward multicast frames that are +// matching to multicast filter up to the host +// RXCTL_AP, // forward unicast frames that are matching +// to multicast filter up to the host +// RXCTL_START, // ethernet MAC start operating +// RXCTL_USB_MFB, // Max Frame Burst TX on USB + // PHY IDs request answer data layout struct AX88178_PhyIDs { @@ -65,6 +74,7 @@ struct AX88178_PhyIDs { uint8 PriPhyID2; } _PACKED; + // Medium state bits enum AX88178_MediumState { MEDIUM_STATE_GM = 0x0001, @@ -84,6 +94,7 @@ enum AX88178_MediumState { MEDIUM_STATE_SM_ON = 0x1000 }; + // Monitor Mode bits enum AX88178_MonitorMode { MONITOR_MODE_MOM = 0x01, @@ -92,6 +103,7 @@ enum AX88178_MonitorMode { MONITOR_MODE_US = 0x10 }; + // General Purpose I/O Register enum AX88178_GPIO { GPIO_OO_0EN = 0x01, @@ -103,6 +115,7 @@ enum AX88178_GPIO { GPIO_RSE = 0x80 }; + // Software Reset Register bits enum AX88178_SoftwareReset { SW_RESET_RR = 0x01, @@ -113,12 +126,14 @@ enum AX88178_SoftwareReset { SW_RESET_BIT6 = 0x40 // always set to 1 }; + // MII/GMII/RGMII Interface Conttrol enum AX88178_MIISInterfaceStatus { MIIS_IF_STATE_DM = 0x01, MIIS_IF_STATE_RB = 0x02 }; + // Notification data layout struct AX88178_Notify { uint8 btA1; @@ -129,6 +144,7 @@ struct AX88178_Notify { uint16 regEEFF; } _PACKED; + // Link-State bits enum AX88178_BBState { LINK_STATE_PPLS = 0x01, @@ -137,10 +153,13 @@ enum AX88178_BBState { LINK_STATE_MDINT = 0x08 }; + const uint16 maxFrameSize = 1536; -AX88178Device::AX88178Device(usb_device device, const char *description) - : ASIXDevice(device, description) + +AX88178Device::AX88178Device(usb_device device, DeviceInfo& deviceInfo) + : + ASIXDevice(device, deviceInfo) { fStatus = InitDevice(); } @@ -153,10 +172,6 @@ AX88178Device::InitDevice() fUseTRXHeader = true; fReadNodeIDRequest = READ_NODEID; - fReadRXControlRequest = READ_RX_CONTROL; - fWriteRXControlRequest = WRITE_RX_CONTROL; - - fPromiscuousBits = RXCTL_PROMISCUOUS; fNotifyBufferLength = sizeof(AX88178_Notify); fNotifyBuffer = (uint8 *)malloc(fNotifyBufferLength); @@ -174,15 +189,13 @@ status_t AX88178Device::SetupDevice(bool deviceReplugged) { status_t result = ASIXDevice::SetupDevice(deviceReplugged); - if(result != B_OK) { + if (result != B_OK) { return result; } - result = fMII.Init(fDevice, - SW_MII_OP, READ_MII, WRITE_MII, - READ_MII_STATUS, HW_MII_OP, READ_PHYID); + result = fMII.Init(fDevice); - if(result != B_OK) { + if (result != B_OK) { return result; } @@ -192,7 +205,7 @@ AX88178Device::SetupDevice(bool deviceReplugged) USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_SROM_ENABLE, 0, 0, 0, 0, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of enabling SROM access:%#010x\n", result); return result; } @@ -203,26 +216,26 @@ AX88178Device::SetupDevice(bool deviceReplugged) READ_SROM, 0x17, 0, sizeof(eepromData), &eepromData, &actualLength); - if(op_result != B_OK) { + if (op_result != B_OK) { TRACE_ALWAYS("Error of reading SROM data:%#010x\n", result); } - if(actualLength != sizeof(eepromData)) { + if (actualLength != sizeof(eepromData)) { TRACE_ALWAYS("Mismatch of reading SROM data." "Read %d bytes instead of %d\n", - actualLength, sizeof(eepromData)); + actualLength, sizeof(eepromData)); } result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_SROM_DISABLE, 0, 0, 0, 0, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of disabling SROM access: %#010x\n", result); return result; } - if(op_result != B_OK) { + if (op_result != B_OK) { return op_result; } @@ -246,7 +259,7 @@ AX88178Device::SetupDevice(bool deviceReplugged) size_t from = bCase8 ? 0 : 4; size_t to = bCase8 ? 3 : 6; - for(size_t i = from; i <= to; i++) { + for (size_t i = from; i <= to; i++) { result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_GPIOS, GPIOCommands[i].value, @@ -254,7 +267,7 @@ AX88178Device::SetupDevice(bool deviceReplugged) snooze(GPIOCommands[i].delay); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of GPIO setup command %d:[%#04x]: %#010x\n", i, GPIOCommands[i].value, result); return result; @@ -267,7 +280,7 @@ AX88178Device::SetupDevice(bool deviceReplugged) USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_SOFT_RESET, uSWReset, 0, 0, 0, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of SW reset to %#02x: %#010x\n", uSWReset, result); return result; } @@ -279,7 +292,7 @@ AX88178Device::SetupDevice(bool deviceReplugged) USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_SOFT_RESET, uSWReset, 0, 0, 0, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of SW reset to %#02x: %#010x\n", uSWReset, result); return result; } @@ -287,7 +300,7 @@ AX88178Device::SetupDevice(bool deviceReplugged) snooze(150000); result = WriteRXControlRegister(0); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", 0, result); return result; } @@ -307,20 +320,21 @@ AX88178Device::StartDevice() USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_IPGS, 0, 0, sizeof(fIPG), fIPG, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of writing IPGs:%#010x\n", result); return result; } - if(actualLength != sizeof(fIPG)) { + if (actualLength != sizeof(fIPG)) { TRACE_ALWAYS("Mismatch of written IPGs data. " "%d bytes of %d written.\n", actualLength, sizeof(fIPG)); } - uint16 rxcontrol = RXCTL_START | RXCTL_MULTICAST | RXCTL_BROADCAST; + uint16 rxcontrol = RXCTL_START | RXCTL_BROADCAST; result = WriteRXControlRegister(rxcontrol); - if(result != B_OK) { - TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", rxcontrol, result); + if (result != B_OK) { + TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", + rxcontrol, result); } TRACE_RET(result); @@ -339,9 +353,9 @@ AX88178Device::OnNotify(uint32 actualLength) AX88178_Notify *notification = (AX88178_Notify *)fNotifyBuffer; - if(notification->btA1 != 0xa1) { + if (notification->btA1 != 0xa1) { TRACE_ALWAYS("Notify magic byte is invalid: %#02x\n", - notification->btA1); + notification->btA1); } uint phyIndex = 0; @@ -364,7 +378,7 @@ AX88178Device::OnNotify(uint32 actualLength) bool linkStateChange = linkIsUp != fHasConnection; fHasConnection = linkIsUp; - if(linkStateChange) { + if (linkStateChange) { TRACE("Link state of PHY%d has been changed to '%s'\n", phyIndex, fHasConnection ? "up" : "down"); } @@ -386,12 +400,12 @@ AX88178Device::GetLinkState(ether_link_state *linkState) READ_MEDIUM_STATUS, 0, 0, sizeof(mediumStatus), &mediumStatus, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of reading medium status:%#010x.\n", result); return result; } - if(actualLength != sizeof(mediumStatus)) { + if (actualLength != sizeof(mediumStatus)) { TRACE_ALWAYS("Mismatch of reading medium status." "Read %d bytes instead of %d\n", actualLength, sizeof(mediumStatus)); @@ -402,16 +416,17 @@ AX88178Device::GetLinkState(ether_link_state *linkState) linkState->quality = 1000; linkState->media = IFM_ETHER | (fHasConnection ? IFM_ACTIVE : 0); - linkState->media |= (mediumStatus & MEDIUM_STATE_FD) ? + linkState->media |= (mediumStatus & MEDIUM_STATE_FD) ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; - linkState->speed = (mediumStatus & MEDIUM_STATE_PS_100) ? 100000000 : 10000000; + linkState->speed = (mediumStatus & MEDIUM_STATE_PS_100) + ? 100000000 : 10000000; linkState->speed = (mediumStatus & MEDIUM_STATE_GM) ? 1000000000 : linkState->speed; TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n", (linkState->media & IFM_ACTIVE) ? "active" : "inactive", - linkState->speed, + linkState->speed / 1000000, (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); return B_OK; } diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.h b/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.h index 9f8841c057..2387b3e81e 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.h +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.h @@ -1,29 +1,30 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ - #ifndef _USB_AX88178_DEVICE_H_ #define _USB_AX88178_DEVICE_H_ + #include "ASIXDevice.h" + class AX88178Device : public ASIXDevice { public: - AX88178Device(usb_device device, const char *description); + AX88178Device(usb_device device, DeviceInfo& info); protected: status_t InitDevice(); virtual status_t SetupDevice(bool deviceReplugged); virtual status_t StartDevice(); virtual status_t OnNotify(uint32 actualLength); -virtual status_t GetLinkState(ether_link_state *state); +virtual status_t GetLinkState(ether_link_state *state); }; -#endif //_USB_AX88178_DEVICE_H_ +#endif // _USB_AX88178_DEVICE_H_ diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.cpp b/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.cpp index 8b35a5bba8..6f644c581d 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.cpp @@ -1,6 +1,6 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. * * Heavily based on code of the @@ -10,53 +10,63 @@ * */ -#include "Settings.h" + #include "AX88772Device.h" -enum AX88772_Requests { - READ_RXTX_SRAM = 0x02, //C002_AA0B_0C00_0800 Rx/Tx SRAM Read - WRITE_RXTX_SRAM = 0x03, //4003_AA0B_0C00_0800 Rx/Tx SRAM Write - SW_MII_OP = 0x06, //4006_0000_0000_0000 SW Serial Management Control - READ_MII = 0x07, //c007_aa00_cc00_0200 PHY Read - WRITE_MII = 0x08, //4008_aa00_cc00_0200 PHY Write - READ_MII_OP_MODE = 0x09, //c009_0000_0000_0100 Serial Management Status - HW_MII_OP = 0x0A, //400a_0000_0000_0000 HW Serial Management Control - READ_SROM = 0x0B, //C00B_AA00_0000_0200 SROM Read - WRITE_SROM = 0x0C, //400C_AA00_CCDD_0000 SROM Write - WRITE_SROM_ENABLE = 0x0D, //400D_0000_0000_0000 SROM Write Enable - WRITE_SROM_DISABLE = 0x0E, //400E_0000_0000_0000 SROM Write Disable - READ_RX_CONTROL = 0x0F, //C00F_0000_0000_0200 Read Rx Control - WRITE_RX_CONTROL = 0x10, //4010_AABB_0000_0000 Write Rx Control - READ_IPGS = 0x11, //C011_0000_0000_0300 Read IPG/IPG1/IPG2 Register - WRITE_IPGS = 0x12, //4012_AABB_CC00_0000 Write IPG/IPG1/IPG2 Register - READ_NODEID = 0x13, //C013_0000_0000_0600 Read Node ID - WRITE_NODEID = 0x14, //4014_0000_0000_0600 Write Node ID - READ_MF_ARRAY = 0x15, //C015_0000_0000_0800 Read Multicast Filter Array - WRITE_MF_ARRAY = 0x16, //4016_0000_0000_0800 Write Multicast Filter Array - READ_TEST = 0x17, //4017_AA00_0000_0000 Write Test Register - READ_PHYID = 0x19, //C019_0000_0000_0200 Read Ethernet/HomePNA PHY Address - READ_MEDIUM_STATUS = 0x1A, //C01A_0000_0000_0200 Read Medium Status - WRITE_MEDIUM_MODE = 0x1B, //401B_AABB_0000_0000 Write Medium Mode Register - GET_MONITOR_MODE = 0x1C, //C01C_0000_0000_0100 Read Monitor Mode Status - SET_MONITOR_MODE = 0x1D, //401D_AA00_0000_0000 Write Monitor Mode Register - READ_GPIOS = 0x1E, //C01E_0000_0000_0100 Read GPIOs Status - WRITE_GPIOS = 0x1F, //401F_AA00_0000_0000 Write GPIOs - WRITE_SOFT_RESET = 0x20, //4020_AA00_0000_0000 Write Software Reset - READ_PHY_SEL_STATE = 0x21, //C021_AA00_0000_0100 Read Software PHY Select Status - WRITE_PHY_SEL = 0x22 //4022_AA00_0000_0000 Write Software PHY Select -}; +#include + +#include "ASIXVendorRequests.h" +#include "Settings.h" + + +// Most of vendor requests for all supported chip types use the same +// constants (see ASIXVendorRequests.h) but the layout of request data +// may be slightly diferrent for specific chip type. Below is a quick +// reference for AX88772 vendor requests data layout. + +// READ_RXTX_SRAM, //C002_AA0B_0C00_0800 Rx/Tx SRAM Read +// WRITE_RXTX_SRAM, //4003_AA0B_0C00_0800 Rx/Tx SRAM Write +// SW_MII_OP, //4006_0000_0000_0000 SW Serial Management Control +// READ_MII, //c007_aa00_cc00_0200 PHY Read +// WRITE_MII, //4008_aa00_cc00_0200 PHY Write +// READ_MII_OP_MODE, //c009_0000_0000_0100 Serial Management Status +// HW_MII_OP, //400a_0000_0000_0000 HW Serial Management Control +// READ_SROM, //C00B_AA00_0000_0200 SROM Read +// WRITE_SROM, //400C_AA00_CCDD_0000 SROM Write +// WRITE_SROM_ENABLE, //400D_0000_0000_0000 SROM Write Enable +// WRITE_SROM_DISABLE, //400E_0000_0000_0000 SROM Write Disable +// READ_RX_CONTROL, //C00F_0000_0000_0200 Read Rx Control +// WRITE_RX_CONTROL, //4010_AABB_0000_0000 Write Rx Control +// READ_IPGS, //C011_0000_0000_0300 Read IPG/IPG1/IPG2 Register +// WRITE_IPGS, //4012_AABB_CC00_0000 Write IPG/IPG1/IPG2 Register +// READ_NODEID, //C013_0000_0000_0600 Read Node ID +// WRITE_NODEID, //4014_0000_0000_0600 Write Node ID +// READ_MF_ARRAY, //C015_0000_0000_0800 Read Multicast Filter Array +// WRITE_MF_ARRAY, //4016_0000_0000_0800 Write Multicast Filter Array +// READ_TEST, //4017_AA00_0000_0000 Write Test Register +// READ_PHYID, //C019_0000_0000_0200 Read Ethernet/HomePNA PHY Address +// READ_MEDIUM_STATUS, //C01A_0000_0000_0200 Read Medium Status +// WRITE_MEDIUM_MODE, //401B_AABB_0000_0000 Write Medium Mode Register +// GET_MONITOR_MODE, //C01C_0000_0000_0100 Read Monitor Mode Status +// SET_MONITOR_MODE, //401D_AA00_0000_0000 Write Monitor Mode Register +// READ_GPIOS, //C01E_0000_0000_0100 Read GPIOs Status +// WRITE_GPIOS, //401F_AA00_0000_0000 Write GPIOs +// WRITE_SOFT_RESET, //4020_AA00_0000_0000 Write Software Reset +// READ_PHY_SEL_STATE, //C021_AA00_0000_0100 Read Software PHY Select Status +// WRITE_PHY_SEL, //4022_AA00_0000_0000 Write Software PHY Select // RX Control Register bits -enum AX88772_RXControl { - RXCTL_PROMISCUOUS = 0x0001, // - RXCTL_ALL_MULTICAT = 0x0002, // -// RXCTL_SEP = 0x0004, // do not set it! - RXCTL_BROADCAST = 0x0008, // - RXCTL_MULTICAST = 0x0010, // - RXCTL_AP = 0x0020, // - RXCTL_START = 0x0080, // - RXCTL_USB_MFB = 0x0100 // Max Frame Burst TX on USB -}; +// RXCTL_PROMISCUOUS, // forward all frames up to the host +// RXCTL_ALL_MULTICAT, // forward all multicast frames up to the host +// RXCTL_SEP, // forward frames with CRC error up to the host +// RXCTL_BROADCAST, // forward broadcast frames up to the host +// RXCTL_MULTICAST, // forward multicast frames that are +// matching to multicast filter up to the host +// RXCTL_AP, // forward unicast frames that are matching +// to multicast filter up to the host +// RXCTL_START, // ethernet MAC start operating +// RXCTL_USB_MFB, // Max Frame Burst TX on USB + // PHY IDs request answer data layout struct AX88772_PhyIDs { @@ -64,6 +74,7 @@ struct AX88772_PhyIDs { uint8 PriPhyID2; } _PACKED; + // Medium state bits enum AX88772_MediumState { MEDIUM_STATE_FD = 0x0002, @@ -80,6 +91,7 @@ enum AX88772_MediumState { MEDIUM_STATE_SM_ON = 0x1000 }; + // Monitor Mode bits enum AX88772_MonitorMode { MONITOR_MODE_MOM = 0x01, @@ -88,6 +100,7 @@ enum AX88772_MonitorMode { MONITOR_MODE_US = 0x10 }; + // General Purpose I/O Register enum AX88772_GPIO { GPIO_OO_0EN = 0x01, @@ -99,6 +112,7 @@ enum AX88772_GPIO { GPIO_RSE = 0x80 }; + // Software Reset Register bits enum AX88772_SoftwareReset { SW_RESET_CLR = 0x00, @@ -111,6 +125,7 @@ enum AX88772_SoftwareReset { SW_RESET_IPPD = 0x40 }; + // Software PHY Select Status enum AX88772_SoftwarePHYSelStatus { SW_PHY_SEL_STATUS_EXT = 0x00, @@ -118,6 +133,7 @@ enum AX88772_SoftwarePHYSelStatus { SW_PHY_SEL_STATUS_ASEL = 0x02 }; + // Notification data layout struct AX88772_Notify { uint8 btA1; @@ -128,6 +144,7 @@ struct AX88772_Notify { uint16 regEEFF; } _PACKED; + // Link-State bits enum AX88772_BBState { LINK_STATE_PPLS = 0x01, @@ -136,10 +153,13 @@ enum AX88772_BBState { LINK_STATE_MDINT = 0x08 }; + const uint16 maxFrameSize = 1536; -AX88772Device::AX88772Device(usb_device device, const char *description) - : ASIXDevice(device, description) + +AX88772Device::AX88772Device(usb_device device, DeviceInfo& deviceInfo) + : + ASIXDevice(device, deviceInfo) { fStatus = InitDevice(); } @@ -152,10 +172,6 @@ AX88772Device::InitDevice() fUseTRXHeader = true; fReadNodeIDRequest = READ_NODEID; - fReadRXControlRequest = READ_RX_CONTROL; - fWriteRXControlRequest = WRITE_RX_CONTROL; - - fPromiscuousBits = RXCTL_PROMISCUOUS; fNotifyBufferLength = sizeof(AX88772_Notify); fNotifyBuffer = (uint8 *)malloc(fNotifyBufferLength); @@ -172,13 +188,11 @@ status_t AX88772Device::SetupDevice(bool deviceReplugged) { status_t result = ASIXDevice::SetupDevice(deviceReplugged); - if(result != B_OK) { + if (result != B_OK) { return result; } - result = fMII.Init(fDevice, - SW_MII_OP, READ_MII, WRITE_MII, - READ_MII_OP_MODE, HW_MII_OP, READ_PHYID); + result = fMII.Init(fDevice); size_t actualLength = 0; // enable GPIO2 - magic from FreeBSD's if_axe @@ -187,7 +201,7 @@ AX88772Device::SetupDevice(bool deviceReplugged) USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_GPIOS, GPIOs, 0, 0, 0, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of wrinting GPIOs: %#010x\n", result); return result; } @@ -205,7 +219,7 @@ AX88772Device::SetupDevice(bool deviceReplugged) TRACE("Selecting %s PHY[%#02x].\n", useEmbeddedPHY ? "embedded" : "external", selectPHY); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of selecting PHY:%#010x\n", result); return result; } @@ -231,7 +245,7 @@ AX88772Device::SetupDevice(bool deviceReplugged) size_t from = useEmbeddedPHY ? 0 : 4; size_t to = useEmbeddedPHY ? 3 : 4; - for(size_t i = from; i <= to; i++) { + for (size_t i = from; i <= to; i++) { result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_SOFT_RESET, resetCommands[i].reset, @@ -239,7 +253,7 @@ AX88772Device::SetupDevice(bool deviceReplugged) snooze(resetCommands[i].delay); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of SW reset command %d:[%#04x]: %#010x\n", i, resetCommands[i].reset, result); return result; @@ -249,13 +263,13 @@ AX88772Device::SetupDevice(bool deviceReplugged) snooze(150000); result = WriteRXControlRegister(0); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", 0, result); return result; } result = fMII.SetupPHY(); - if(result != B_OK) { + if (result != B_OK) { return result; } @@ -267,7 +281,7 @@ AX88772Device::SetupDevice(bool deviceReplugged) MEDIUM_STATE_RE | MEDIUM_STATE_PS_100, 0, 0, 0, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of setting medium mode: %#010x\n", result); } @@ -284,20 +298,21 @@ AX88772Device::StartDevice() USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_IPGS, 0, 0, sizeof(fIPG), fIPG, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of writing IPGs:%#010x\n", result); return result; } - if(actualLength != sizeof(fIPG)) { + if (actualLength != sizeof(fIPG)) { TRACE_ALWAYS("Mismatch of written IPGs data. " "%d bytes of %d written.\n", actualLength, sizeof(fIPG)); } - uint16 rxcontrol = RXCTL_START | RXCTL_MULTICAST | RXCTL_BROADCAST; + uint16 rxcontrol = RXCTL_START | RXCTL_BROADCAST; result = WriteRXControlRegister(rxcontrol); - if(result != B_OK) { - TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", rxcontrol, result); + if (result != B_OK) { + TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", + rxcontrol, result); } TRACE_RET(result); @@ -316,7 +331,7 @@ AX88772Device::OnNotify(uint32 actualLength) AX88772_Notify *notification = (AX88772_Notify *)fNotifyBuffer; - if(notification->btA1 != 0xa1) { + if (notification->btA1 != 0xa1) { TRACE_ALWAYS("Notify magic byte is invalid: %#02x\n", notification->btA1); } @@ -341,7 +356,7 @@ AX88772Device::OnNotify(uint32 actualLength) bool linkStateChange = linkIsUp != fHasConnection; fHasConnection = linkIsUp; - if(linkStateChange) { + if (linkStateChange) { TRACE("Link state of PHY%d has been changed to '%s'\n", phyIndex, fHasConnection ? "up" : "down"); } @@ -363,12 +378,12 @@ AX88772Device::GetLinkState(ether_link_state *linkState) READ_MEDIUM_STATUS, 0, 0, sizeof(mediumStatus), &mediumStatus, &actualLength); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of reading medium status:%#010x.\n", result); return result; } - if(actualLength != sizeof(mediumStatus)) { + if (actualLength != sizeof(mediumStatus)) { TRACE_ALWAYS("Mismatch of reading medium status." "Read %d bytes instead of %d\n", actualLength, sizeof(mediumStatus)); @@ -379,14 +394,15 @@ AX88772Device::GetLinkState(ether_link_state *linkState) linkState->quality = 1000; linkState->media = IFM_ETHER | (fHasConnection ? IFM_ACTIVE : 0); - linkState->media |= (mediumStatus & MEDIUM_STATE_FD) ? + linkState->media |= (mediumStatus & MEDIUM_STATE_FD) ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; - linkState->speed = (mediumStatus & MEDIUM_STATE_PS_100) ? 100000000 : 10000000; + linkState->speed = (mediumStatus & MEDIUM_STATE_PS_100) + ? 100000000 : 10000000; TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n", (linkState->media & IFM_ACTIVE) ? "active" : "inactive", - linkState->speed, + linkState->speed / 1000000, (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); return B_OK; } diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.h b/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.h index ed7546d97b..0fd70a6685 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.h +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.h @@ -1,29 +1,30 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ - #ifndef _USB_AX88772_DEVICE_H_ #define _USB_AX88772_DEVICE_H_ + #include "ASIXDevice.h" + class AX88772Device : public ASIXDevice { public: - AX88772Device(usb_device device, const char *description); + AX88772Device(usb_device device, DeviceInfo& info); protected: status_t InitDevice(); virtual status_t SetupDevice(bool deviceReplugged); virtual status_t StartDevice(); virtual status_t OnNotify(uint32 actualLength); -virtual status_t GetLinkState(ether_link_state *state); +virtual status_t GetLinkState(ether_link_state *state); }; -#endif //_USB_AX88772_DEVICE_H_ +#endif // _USB_AX88772_DEVICE_H_ diff --git a/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp b/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp index e1135a28ce..ef397ef6c7 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp @@ -1,6 +1,6 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. * * Heavily based on code of the @@ -10,71 +10,62 @@ * */ -#include -#include -#include - -#ifdef HAIKU_TARGET_PLATFORM_HAIKU -#include // for mutex -#else -#include "BeOSCompatibility.h" // for pseudo mutex -#endif #include "Driver.h" -#include "Settings.h" + +#include + +#include // for mutex +#include + #include "AX88172Device.h" -#include "AX88772Device.h" #include "AX88178Device.h" +#include "AX88772Device.h" +#include "Settings.h" + int32 api_version = B_CUR_DRIVER_API_VERSION; static const char *sDeviceBaseName = "net/usb_asix/"; ASIXDevice *gASIXDevices[MAX_DEVICES]; char *gDeviceNames[MAX_DEVICES + 1]; usb_module_info *gUSBModule = NULL; - mutex gDriverLock; -// auto-release helper class -class DriverSmartLock { -public: - DriverSmartLock() { mutex_lock(&gDriverLock); } - ~DriverSmartLock() { mutex_unlock(&gDriverLock); } -}; -usb_support_descriptor gSupportedDevices[] = { - // AX88172 - { 0, 0, 0, 0x0b95, 0x1720}, // "ASIX 88172 10/100" - { 0, 0, 0, 0x07b8, 0x420a}, // "ABOCOM UF200" - { 0, 0, 0, 0x1189, 0x0893}, // "Acer C&M EP-1427X-2" - { 0, 0, 0, 0x0557, 0x2009}, // "ATEN UC-210T" - { 0, 0, 0, 0x08dd, 0x90ff}, // "Billionton USB2AR" - { 0, 0, 0, 0x07aa, 0x0017}, // "Corega USB2TX" - { 0, 0, 0, 0x2001, 0x1A00}, // "D-Link DUB-E100" - { 0, 0, 0, 0x1631, 0x6200}, // "GoodWay USB2Ethernet" - { 0, 0, 0, 0x04f1, 0x3008}, // "JVC MP-PRX1" - { 0, 0, 0, 0x077b, 0x2226}, // "LinkSys USB 2.0" - { 0, 0, 0, 0x0411, 0x003d}, // "Melco LUA-U2-KTX" - { 0, 0, 0, 0x0846, 0x1040}, // "NetGear USB 2.0 Ethernet" - { 0, 0, 0, 0x086e, 0x1920}, // "System TALKS SGC-X2UL" - { 0, 0, 0, 0x6189, 0x182d}, // "Sitecom LN-029" - // AX88772 - { 0, 0, 0, 0x0b95, 0x7720}, // "ASIX 88772 10/100" - { 0, 0, 0, 0x13b1, 0x0018}, // "Linksys USB200M rev.2" - { 0, 0, 0, 0x07d1, 0x3c05}, // alternate D-Link DUB-E100 rev. B1 - { 0, 0, 0, 0x2001, 0x3c05}, // "D-Link DUB-E100 rev.B1" - { 0, 0, 0, 0x1557, 0x7720}, // "OQO 01+ Ethernet" - { 0, 0, 0, 0x05ac, 0x1402}, // "Apple A1277" - // AX88178 - { 0, 0, 0, 0x0b95, 0x1780}, // "ASIX 88178 10/100/1000" - { 0, 0, 0, 0x050d, 0x5055}, // "Belkin F5D5055" - { 0, 0, 0, 0x04bb, 0x0930}, // "I/O Data ETG-US2" - { 0, 0, 0, 0x1737, 0x0039}, // "LinkSys 1000" - { 0, 0, 0, 0x14ea, 0xab11}, // "Planex GU-1000T" - { 0, 0, 0, 0x0df6, 0x061c} // "Sitecom LN-028" -}; + +// IMPORTANT: keep entries sorted by ids to let the +// binary search lookup procedure work correctly !!! +DeviceInfo gSupportedDevices[] = { + { { { 0x0411, 0x003d } }, DeviceInfo::AX88172, "Melco LUA-U2-KTX" }, + { { { 0x04bb, 0x0930 } }, DeviceInfo::AX88178, "I/O Data ETG-US2" }, + { { { 0x04f1, 0x3008 } }, DeviceInfo::AX88172, "JVC MP-PRX1" }, + { { { 0x050d, 0x5055 } }, DeviceInfo::AX88178, "Belkin F5D5055" }, + { { { 0x0557, 0x2009 } }, DeviceInfo::AX88172, "ATEN UC-210T" }, + { { { 0x05ac, 0x1402 } }, DeviceInfo::AX88772, "Apple A1277" }, + { { { 0x077b, 0x2226 } }, DeviceInfo::AX88172, "LinkSys USB 2.0" }, + { { { 0x07aa, 0x0017 } }, DeviceInfo::AX88172, "Corega USB2TX" }, + { { { 0x07b8, 0x420a } }, DeviceInfo::AX88172, "ABOCOM UF200" }, + { { { 0x07d1, 0x3c05 } }, DeviceInfo::AX88772, "D-Link DUB-E100 rev.B1" }, + { { { 0x0846, 0x1040 } }, DeviceInfo::AX88172, "NetGear USB 2.0 Ethernet" }, + { { { 0x086e, 0x1920 } }, DeviceInfo::AX88172, "System TALKS SGC-X2UL" }, + { { { 0x08dd, 0x90ff } }, DeviceInfo::AX88172, "Billionton USB2AR" }, + { { { 0x0b95, 0x1720 } }, DeviceInfo::AX88172, "ASIX 88172 10/100" }, + { { { 0x0b95, 0x1780 } }, DeviceInfo::AX88178, "ASIX 88178 10/100/1000" }, + { { { 0x0b95, 0x7720 } }, DeviceInfo::AX88772, "ASIX 88772 10/100" }, + { { { 0x0df6, 0x061c } }, DeviceInfo::AX88178, "Sitecom LN-028" }, + { { { 0x1189, 0x0893 } }, DeviceInfo::AX88172, "Acer C&M EP-1427X-2" }, + { { { 0x13b1, 0x0018 } }, DeviceInfo::AX88772, "Linksys USB200M rev.2" }, + { { { 0x14ea, 0xab11 } }, DeviceInfo::AX88178, "Planex GU-1000T" }, + { { { 0x1557, 0x7720 } }, DeviceInfo::AX88772, "OQO 01+ Ethernet" }, + { { { 0x1631, 0x6200 } }, DeviceInfo::AX88172, "GoodWay USB2Ethernet" }, + { { { 0x1737, 0x0039 } }, DeviceInfo::AX88178, "LinkSys 1000" }, + { { { 0x2001, 0x1A00 } }, DeviceInfo::AX88172, "D-Link DUB-E100" }, + { { { 0x2001, 0x3c05 } }, DeviceInfo::AX88772, "D-Link DUB-E100 rev.B1" }, + { { { 0x6189, 0x182d } }, DeviceInfo::AX88172, "Sitecom LN-029" } +}; ASIXDevice * -create_asix_device(usb_device device) +lookup_and_create_device(usb_device device) { const usb_device_descriptor *deviceDescriptor = gUSBModule->get_device_descriptor(device); @@ -84,39 +75,34 @@ create_asix_device(usb_device device) return NULL; } -#define IDS(__vendor, __product) (((__vendor) << 16) | (__product)) - - switch(IDS(deviceDescriptor->vendor_id, deviceDescriptor->product_id)) { - // AX88172 - case IDS(0x0b95, 0x1720): return new AX88172Device(device, "ASIX 88172 10/100"); - case IDS(0x07b8, 0x420a): return new AX88172Device(device, "ABOCOM UF200"); - case IDS(0x1189, 0x0893): return new AX88172Device(device, "Acer C&M EP-1427X-2"); - case IDS(0x0557, 0x2009): return new AX88172Device(device, "ATEN UC-210T"); - case IDS(0x08dd, 0x90ff): return new AX88172Device(device, "Billionton USB2AR"); - case IDS(0x07aa, 0x0017): return new AX88172Device(device, "Corega USB2TX"); - case IDS(0x2001, 0x1A00): return new AX88172Device(device, "D-Link DUB-E100"); - case IDS(0x1631, 0x6200): return new AX88172Device(device, "GoodWay USB2Ethernet"); - case IDS(0x04f1, 0x3008): return new AX88172Device(device, "JVC MP-PRX1"); - case IDS(0x077b, 0x2226): return new AX88172Device(device, "LinkSys USB 2.0"); - case IDS(0x0411, 0x003d): return new AX88172Device(device, "Melco LUA-U2-KTX"); - case IDS(0x0846, 0x1040): return new AX88172Device(device, "NetGear USB 2.0 Ethernet"); - case IDS(0x086e, 0x1920): return new AX88172Device(device, "System TALKS SGC-X2UL"); - case IDS(0x6189, 0x182d): return new AX88172Device(device, "Sitecom LN-029"); - // AX88772 - case IDS(0x0b95, 0x7720): return new AX88772Device(device, "ASIX 88772 10/100"); - case IDS(0x13b1, 0x0018): return new AX88772Device(device, "Linksys USB200M rev.2"); - case IDS(0x07d1, 0x3c05): // alternate D-Link DUB-E100 rev. B1 - case IDS(0x2001, 0x3c05): return new AX88772Device(device, "D-Link DUB-E100 rev.B1"); - case IDS(0x1557, 0x7720): return new AX88772Device(device, "OQO 01+ Ethernet"); - case IDS(0x05ac, 0x1402): return new AX88772Device(device, "Apple A1277"); - // AX88178 - case IDS(0x0b95, 0x1780): return new AX88178Device(device, "ASIX 88178 10/100/1000"); - case IDS(0x050d, 0x5055): return new AX88178Device(device, "Belkin F5D5055"); - case IDS(0x04bb, 0x0930): return new AX88178Device(device, "I/O Data ETG-US2"); - case IDS(0x1737, 0x0039): return new AX88178Device(device, "LinkSys 1000"); - case IDS(0x14ea, 0xab11): return new AX88178Device(device, "Planex GU-1000T"); - case IDS(0x0df6, 0x061c): return new AX88178Device(device, "Sitecom LN-028"); + TRACE("trying %#06x:%#06x.\n", + deviceDescriptor->vendor_id, deviceDescriptor->product_id); + + // use binary search to lookup device in table + DeviceInfo::Id id = { { deviceDescriptor->vendor_id, + deviceDescriptor->product_id } }; + int left = -1; + int right = _countof(gSupportedDevices); + while ((right - left) > 1) { + int i = (left + right) / 2; + ((gSupportedDevices[i].Key() < id.fKey) ? left : right) = i; } + + if (gSupportedDevices[right].Key() == id.fKey) { + switch (gSupportedDevices[right].fType) { + case DeviceInfo::AX88172: + return new AX88172Device(device, gSupportedDevices[right]); + case DeviceInfo::AX88772: + return new AX88772Device(device, gSupportedDevices[right]); + case DeviceInfo::AX88178: + return new AX88178Device(device, gSupportedDevices[right]); + default: + TRACE_ALWAYS("Unknown device type:%#x ignored.\n", + static_cast(gSupportedDevices[right].fType)); + break; + } + } + return NULL; } @@ -126,7 +112,7 @@ usb_asix_device_added(usb_device device, void **cookie) { *cookie = NULL; - DriverSmartLock driverLock; // released on exit + MutexLocker lock(gDriverLock); // released on exit // check if this is a replug of an existing device first for (int32 i = 0; i < MAX_DEVICES; i++) { @@ -142,7 +128,7 @@ usb_asix_device_added(usb_device device, void **cookie) } // no such device yet, create a new one - ASIXDevice *asixDevice = create_asix_device(device); + ASIXDevice *asixDevice = lookup_and_create_device(device); if (asixDevice == 0) { return ENODEV; } @@ -181,7 +167,7 @@ usb_asix_device_added(usb_device device, void **cookie) status_t usb_asix_device_removed(void *cookie) { - DriverSmartLock driverLock; // released on exit + MutexLocker lock(gDriverLock); // released on exit ASIXDevice *device = (ASIXDevice *)cookie; for (int32 i = 0; i < MAX_DEVICES; i++) { @@ -202,7 +188,7 @@ usb_asix_device_removed(void *cookie) } -//#pragma mark - +// #pragma mark - status_t @@ -235,9 +221,17 @@ init_driver() &usb_asix_device_removed }; - gUSBModule->register_driver(DRIVER_NAME, gSupportedDevices, - sizeof(gSupportedDevices) / sizeof(usb_support_descriptor), NULL); + const size_t count = _countof(gSupportedDevices); + static usb_support_descriptor sDescriptors[count] = {{ 0 }}; + + for(size_t i = 0; i < count; i++) { + sDescriptors[i].vendor = gSupportedDevices[i].VendorId(); + sDescriptors[i].product = gSupportedDevices[i].ProductId(); + } + + gUSBModule->register_driver(DRIVER_NAME, sDescriptors, count, NULL); gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks); + return B_OK; } @@ -270,7 +264,7 @@ uninit_driver() static status_t usb_asix_open(const char *name, uint32 flags, void **cookie) { - DriverSmartLock driverLock; // released on exit + MutexLocker lock(gDriverLock); // released on exit *cookie = NULL; status_t status = ENODEV; @@ -322,7 +316,7 @@ usb_asix_free(void *cookie) { ASIXDevice *device = (ASIXDevice *)cookie; - DriverSmartLock driverLock; // released on exit + MutexLocker lock(gDriverLock); // released on exit status_t status = device->Free(); for (int32 i = 0; i < MAX_DEVICES; i++) { @@ -348,7 +342,7 @@ publish_devices() gDeviceNames[i] = NULL; } - DriverSmartLock driverLock; // released on exit + MutexLocker lock(gDriverLock); // released on exit int32 deviceCount = 0; for (int32 i = 0; i < MAX_DEVICES; i++) { @@ -361,7 +355,7 @@ publish_devices() TRACE("publishing %s\n", gDeviceNames[deviceCount]); deviceCount++; } else - TRACE_ALWAYS("Error: out of memory during allocating device name.\n"); + TRACE_ALWAYS("Error: out of memory during allocating dev.name.\n"); } gDeviceNames[deviceCount] = NULL; diff --git a/src/add-ons/kernel/drivers/network/usb_asix/Driver.h b/src/add-ons/kernel/drivers/network/usb_asix/Driver.h index 7c718d191f..9ff1ece038 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/Driver.h +++ b/src/add-ons/kernel/drivers/network/usb_asix/Driver.h @@ -1,39 +1,31 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ - #ifndef _USB_ASIX_DRIVER_H_ #define _USB_ASIX_DRIVER_H_ -#include -#include + #include #include -#include -#include -#include -#include -#include -#include #define DRIVER_NAME "usb_asix" #define MAX_DEVICES 8 + const uint8 kInvalidRequest = 0xff; - -const char* const kVersion = "ver.0.8.3"; - +const char* const kVersion = "ver.0.9.1"; extern usb_module_info *gUSBModule; + extern "C" { status_t usb_asix_device_added(usb_device device, void **cookie); status_t usb_asix_device_removed(void *cookie); @@ -46,5 +38,5 @@ device_hooks *find_device(const char *name); } -#endif //_USB_ASIX_DRIVER_H_ +#endif // _USB_ASIX_DRIVER_H_ diff --git a/src/add-ons/kernel/drivers/network/usb_asix/Jamfile b/src/add-ons/kernel/drivers/network/usb_asix/Jamfile index 3b79667da6..ac2fc29568 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/Jamfile +++ b/src/add-ons/kernel/drivers/network/usb_asix/Jamfile @@ -3,6 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers network usb_asix ; SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders kernel net ; +UsePrivateKernelHeaders ; KernelAddon usb_asix : Driver.cpp diff --git a/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.cpp b/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.cpp index 235834143e..0906be8e37 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.cpp @@ -1,105 +1,95 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ + +#include "MIIBus.h" + +#include "ASIXVendorRequests.h" #include "Driver.h" #include "Settings.h" -#include "MIIBus.h" + #define MII_OUI(id1, id2) (((id1) << 6) | ((id2) >> 10)) #define MII_MODEL(id2) (((id2) & 0x03f0) >> 4) #define MII_REV(id2) ((id2) & 0x000f) -MIIBus::MIIBus() : fDevice(0), - fSelectedPHY(CurrentPHY), - fSWOperationRequest(kInvalidRequest), - fReadValueRequest(kInvalidRequest), - fWriteValueRequest(kInvalidRequest), - fReadStatusRequest(kInvalidRequest), - fHWOperationRequest(kInvalidRequest), - fReadPHYIDsRequest(kInvalidRequest) + +MIIBus::MIIBus() + : + fStatus(B_NO_INIT), + fDevice(0), + fSelectedPHY(CurrentPHY) { - for(size_t i = 0; i < PHYsCount; i++) { + for (size_t i = 0; i < PHYsCount; i++) { fPHYs[i] = PHYNotInstalled; } } -status_t -MIIBus::Init(usb_device device, - uint8 SWOperationRequest, - uint8 ReadValueRequest, - uint8 WriteValueRequest, - uint8 ReadStatusRequest, - uint8 HWOperationRequest, - uint8 ReadPHYIDsRequest) +status_t +MIIBus::Init(usb_device device) { - fSWOperationRequest = SWOperationRequest; - fReadValueRequest = ReadValueRequest; - fWriteValueRequest = WriteValueRequest; - fReadStatusRequest = ReadStatusRequest; - fHWOperationRequest = HWOperationRequest; - fReadPHYIDsRequest = ReadPHYIDsRequest; - - // reset to default state + // reset to default state fDevice = 0; fSelectedPHY = CurrentPHY; - for(size_t i = 0; i < PHYsCount; i++) { + for (size_t i = 0; i < PHYsCount; i++) { fPHYs[i] = PHYNotInstalled; } - + size_t actual_length = 0; - status_t result = gUSBModule->send_request(device, + status_t result = gUSBModule->send_request(device, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - fReadPHYIDsRequest, 0, 0, sizeof(fPHYs), fPHYs, &actual_length); - - if(result != B_OK) { + READ_PHYID, 0, 0, sizeof(fPHYs), fPHYs, &actual_length); + + if (result != B_OK) { TRACE_ALWAYS("Request of the PHYIDs failed:%#010x\n", result); return result; } - if(sizeof(fPHYs) != actual_length) { - TRACE_ALWAYS("Mismatch of reading %d PHYIDs bytes instead of %d.\n", + if (sizeof(fPHYs) != actual_length) { + TRACE_ALWAYS("Mismatch of reading %d PHYIDs bytes instead of %d.\n", actual_length, sizeof(fPHYs)); } TRACE("PHYIDs are:%#02x:%#02x\n", fPHYs[0], fPHYs[1]); - + // simply tactic - we use first available PHY - if(PHYType(PrimaryPHY) != PHYNotInstalled) { + if (PHYType(PrimaryPHY) != PHYNotInstalled) { fSelectedPHY = PrimaryPHY; - } else - if(PHYType(SecondaryPHY) != PHYNotInstalled) { + } else + if (PHYType(SecondaryPHY) != PHYNotInstalled) { fSelectedPHY = SecondaryPHY; } - TRACE("PHYs are configured: Selected:%#02x; Primary:%#02x; Secondary:%#02x\n", + TRACE("PHYs are configured: Selected:%#02x; Primary:%#02x; 2ndary:%#02x\n", PHYID(CurrentPHY), PHYID(PrimaryPHY), PHYID(SecondaryPHY)); - if(fSelectedPHY == CurrentPHY) { + if (fSelectedPHY == CurrentPHY) { TRACE_ALWAYS("No PHYs found!\n"); - return B_ENTRY_NOT_FOUND; + return B_ENTRY_NOT_FOUND; } fDevice = device; - - return result; + fStatus = result; + + return fStatus; } -status_t +status_t MIIBus::SetupPHY() { uint16 control = 0; status_t result = Read(MII_BMCR, &control); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of reading control word:%#010x.\n", result); return result; } @@ -108,128 +98,121 @@ MIIBus::SetupPHY() control &= ~BMCR_Isolate; result = Write(MII_BMCR, control); - if(result != B_OK) { - TRACE_ALWAYS("Error of writing control word %#04x:%#010x.\n", control, result); + if (result != B_OK) { + TRACE_ALWAYS("Error of writing control word %#04x:%#010x.\n", + control, result); } result = Write(MII_BMCR, BMCR_Reset); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of resetting PHY:%#010x.\n", result); } uint16 id01 = 0, id02 = 0; result = Read(MII_PHYID0, &id01); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of reading PHY ID1:%#010x.\n", result); } result = Read(MII_PHYID1, &id02); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of reading PHY ID2:%#010x.\n", result); } - TRACE("MII Info: OUI:%04x; Model:%04x; rev:%02x.\n", + TRACE("MII Info: OUI:%04x; Model:%04x; rev:%02x.\n", MII_OUI(id01, id02), MII_MODEL(id02), MII_REV(id02)); - //Dump(); - + // Dump(); + return result; } -status_t +status_t MIIBus::InitCheck() { if (fSelectedPHY == CurrentPHY) { return B_ENTRY_NOT_FOUND; } - if(fSWOperationRequest == kInvalidRequest || - fReadValueRequest == kInvalidRequest || - fWriteValueRequest == kInvalidRequest || - fReadStatusRequest == kInvalidRequest || - fHWOperationRequest == kInvalidRequest || - fReadPHYIDsRequest == kInvalidRequest) { - return B_NO_INIT; - } - - return B_OK; + return fStatus; } uint8 MIIBus::PHYID(PHYIndex phyIndex /*= CurrentPHY*/) -{ - if(phyIndex == CurrentPHY) { - return (fSelectedPHY == CurrentPHY ? - 0 : fPHYs[fSelectedPHY]) & PHYIDMask; +{ + if (phyIndex == CurrentPHY) { + return (fSelectedPHY == CurrentPHY + ? 0 : fPHYs[fSelectedPHY]) & PHYIDMask; } - + return fPHYs[phyIndex] & PHYIDMask; } uint8 MIIBus::PHYType(PHYIndex phyIndex /*= CurrentPHY*/) -{ - if(phyIndex == CurrentPHY) { - return (fSelectedPHY == CurrentPHY ? - PHYNotInstalled : fPHYs[fSelectedPHY]) & PHYTypeMask; +{ + if (phyIndex == CurrentPHY) { + return (fSelectedPHY == CurrentPHY + ? PHYNotInstalled : fPHYs[fSelectedPHY]) & PHYTypeMask; } - + return fPHYs[phyIndex] & PHYTypeMask; } -status_t -MIIBus::Read(uint16 miiRegister, uint16 *value, PHYIndex phyIndex /*= CurrentPHY*/) + +status_t +MIIBus::Read(uint16 miiRegister, uint16 *value, PHYIndex phyIndex /*= CurrPHY*/) { status_t result = InitCheck(); - if(B_OK != result) { + if (B_OK != result) { TRACE_ALWAYS("Error: MII is not ready:%#010x\n", result); return result; } - if(PHYType(phyIndex) == PHYNotInstalled) { + if (PHYType(phyIndex) == PHYNotInstalled) { TRACE_ALWAYS("Error: Invalid PHY index:%#02x.\n", phyIndex); - return B_ENTRY_NOT_FOUND; + return B_ENTRY_NOT_FOUND; } uint16 phyId = PHYID(phyIndex); - - size_t actual_length = 0; - // switch to SW operation mode - result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - fSWOperationRequest, 0, 0, 0, 0, &actual_length); - if(result != B_OK) { + size_t actual_length = 0; + // switch to SW operation mode + result = gUSBModule->send_request(fDevice, + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, + SW_MII_OP, 0, 0, 0, 0, &actual_length); + + if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to SW op.mode: %#010x\n", result); return result; } - // read register value - status_t op_result = gUSBModule->send_request(fDevice, + // read register value + status_t op_result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - fReadValueRequest, phyId, miiRegister, + READ_MII, phyId, miiRegister, sizeof(*value), value, &actual_length); - if(op_result != B_OK) { - TRACE_ALWAYS("Error of reading MII reg.%d at PHY%d:%#010x.\n", + if (op_result != B_OK) { + TRACE_ALWAYS("Error of reading MII reg.%d at PHY%d:%#010x.\n", miiRegister, phyId, op_result); } - if(sizeof(*value) != actual_length) { + if (sizeof(*value) != actual_length) { TRACE_ALWAYS("Mismatch of reading MII reg.%d at PHY %d. " "Read %d bytes instead of %d.\n", miiRegister, phyId, actual_length, sizeof(*value)); } - // switch to HW operation mode - result = gUSBModule->send_request(fDevice, + // switch to HW operation mode + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - fHWOperationRequest, 0, 0, 0, 0, &actual_length); + HW_MII_OP, 0, 0, 0, 0, &actual_length); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to HW op.mode: %#010x\n", result); } @@ -237,57 +220,57 @@ MIIBus::Read(uint16 miiRegister, uint16 *value, PHYIndex phyIndex /*= CurrentPHY } -status_t -MIIBus::Write(uint16 miiRegister, uint16 value, PHYIndex phyIndex /*= CurrentPHY*/) +status_t +MIIBus::Write(uint16 miiRegister, uint16 value, PHYIndex phyIndex /*= CurrPHY*/) { size_t actual_length = 0; status_t result = InitCheck(); - if(B_OK != result) { + if (B_OK != result) { TRACE_ALWAYS("Error: MII is not ready:%#010x\n", result); return result; } - if(PHYType(phyIndex) == PHYNotInstalled) { + if (PHYType(phyIndex) == PHYNotInstalled) { TRACE_ALWAYS("Error: Invalid PHY index:%#02x\n", phyIndex); - return B_ENTRY_NOT_FOUND; + return B_ENTRY_NOT_FOUND; } uint16 phyId = PHYID(phyIndex); - // switch to SW operation mode - result = gUSBModule->send_request(fDevice, + // switch to SW operation mode + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - fSWOperationRequest, 0, 0, 0, 0, &actual_length); + SW_MII_OP, 0, 0, 0, 0, &actual_length); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to SW op.mode: %#010x\n", result); return result; } // write register value - status_t op_result = gUSBModule->send_request(fDevice, + status_t op_result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - fWriteValueRequest, phyId, miiRegister, + WRITE_MII, phyId, miiRegister, sizeof(value), &value, &actual_length); - if(op_result != B_OK) { - TRACE_ALWAYS("Error of writing MII reg.%d at PHY %d:%#010x.\n", + if (op_result != B_OK) { + TRACE_ALWAYS("Error of writing MII reg.%d at PHY %d:%#010x.\n", miiRegister, phyId, op_result); } - if(sizeof(value) != actual_length) { + if (sizeof(value) != actual_length) { TRACE_ALWAYS("Mismatch of writing MII reg.%d at PHY %d." - "Write %d bytes instead of %d.\n", + "Write %d bytes instead of %d.\n", miiRegister, phyId, actual_length, sizeof(value)); } // switch to HW operation mode - result = gUSBModule->send_request(fDevice, + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - fHWOperationRequest, 0, 0, 0, 0, &actual_length); + HW_MII_OP, 0, 0, 0, 0, &actual_length); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to HW op.mode: %#010x\n", result); } @@ -295,75 +278,76 @@ MIIBus::Write(uint16 miiRegister, uint16 value, PHYIndex phyIndex /*= CurrentPHY } -status_t +status_t MIIBus::Status(uint16 *status, PHYIndex phyIndex /*= CurrentPHY*/) { return Read(MII_BMSR, status, phyIndex); } -status_t + +status_t MIIBus::Dump() { status_t result = InitCheck(); - if(B_OK != result) { + if (B_OK != result) { TRACE_ALWAYS("Error: MII is not ready:%#010x.\n", result); return result; } - if(PHYType(CurrentPHY) == PHYNotInstalled) { + if (PHYType(CurrentPHY) == PHYNotInstalled) { TRACE_ALWAYS("Error: Current PHY index is invalid!\n"); - return B_ENTRY_NOT_FOUND; + return B_ENTRY_NOT_FOUND; } uint16 phyId = PHYID(CurrentPHY); size_t actual_length = 0; - // switch to SW operation mode - result = gUSBModule->send_request(fDevice, + // switch to SW operation mode + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - fSWOperationRequest, 0, 0, 0, 0, &actual_length); + SW_MII_OP, 0, 0, 0, 0, &actual_length); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to SW op.mode: %#010x\n", result); return result; } - uint8 regs[] = { MII_BMCR, MII_BMSR, - MII_PHYID0, MII_PHYID1, + uint8 regs[] = { MII_BMCR, MII_BMSR, + MII_PHYID0, MII_PHYID1, MII_ANAR, MII_ANLPAR/*, MII_ANER*/}; - uint16 value = 0; - for(size_t i = 0; i < sizeof(regs)/ sizeof(regs[0]); i++) { + uint16 value = 0; + for (size_t i = 0; i < sizeof(regs)/ sizeof(regs[0]); i++) { - // read register value - status_t op_result = gUSBModule->send_request(fDevice, + // read register value + status_t op_result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - fReadValueRequest, phyId, regs[i], + READ_MII, phyId, regs[i], sizeof(value), &value, &actual_length); - if(op_result != B_OK) { - TRACE_ALWAYS("Error of reading MII reg.%d at PHY%d:%#010x.\n", + if (op_result != B_OK) { + TRACE_ALWAYS("Error of reading MII reg.%d at PHY%d:%#010x.\n", regs[i], phyId, op_result); } - if(sizeof(value) != actual_length) { + if (sizeof(value) != actual_length) { TRACE_ALWAYS("Mismatch of reading MII reg.%d at PHY%d." - " Read %d bytes instead of %d.\n", + " Read %d bytes instead of %d.\n", regs[i], phyId, actual_length, sizeof(value)); } TRACE_ALWAYS("MII reg: %d has %#04x\n", regs[i], value); } - // switch to HW operation mode - result = gUSBModule->send_request(fDevice, + // switch to HW operation mode + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - fHWOperationRequest, 0, 0, 0, 0, &actual_length); + HW_MII_OP, 0, 0, 0, 0, &actual_length); - if(result != B_OK) { + if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to HW op.mode: %#010x\n", result); } return result; - + } diff --git a/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.h b/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.h index 2a719998fb..153ee3579f 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.h +++ b/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.h @@ -1,20 +1,21 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ - #ifndef _USB_MII_BUS_H_ #define _USB_MII_BUS_H_ + #include "Driver.h" + enum MII_Register { MII_BMCR = 0x00, MII_BMSR = 0x01, @@ -23,7 +24,8 @@ enum MII_Register { MII_ANAR = 0x04, MII_ANLPAR = 0x05, MII_ANER = 0x06 -}; +}; + enum MII_BMCR { BMCR_Reset = 0x8000, @@ -37,24 +39,26 @@ enum MII_BMCR { BMCR_CollTest = 0x0080 }; + enum MII_BMSR { BMSR_CAP_100BASE_T4 = 0x8000, // PHY is able to perform 100base-T4 - BMSR_CAP_100BASE_TXFD = 0x4000, // PHY is able to perform 100base-TX full duplex - BMSR_CAP_100BASE_TXHD = 0x2000, // PHY is able to perform 100base-TX half duplex - BMSR_CAP_10BASE_TXFD = 0x1000, // PHY is able to perform 10base-TX full duplex - BMSR_CAP_10BASE_TXHD = 0x0800, // PHY is able to perform 10base-TX half duplex - BMSR_MFPS = 0x0040, // Management frame preamble supression - BMSR_ANC = 0x0020, // Auto-negotiation complete - BMSR_RF = 0x0010, // Remote fault - BMSR_CAP_AN = 0x0008, // PHY is able to perform auto-negotiation - BMSR_Link = 0x0004, // link state - BMSR_Jabber = 0x0002, // Jabber condition detected + BMSR_CAP_100BASE_TXFD = 0x4000, // PHY is able to perform 100base-TX FD + BMSR_CAP_100BASE_TXHD = 0x2000, // PHY is able to perform 100base-TX HD + BMSR_CAP_10BASE_TXFD = 0x1000, // PHY is able to perform 10base-TX FD + BMSR_CAP_10BASE_TXHD = 0x0800, // PHY is able to perform 10base-TX HD + BMSR_MFPS = 0x0040, // Management frame preamble supression + BMSR_ANC = 0x0020, // Auto-negotiation complete + BMSR_RF = 0x0010, // Remote fault + BMSR_CAP_AN = 0x0008, // PHY is able to perform a-negotiation + BMSR_Link = 0x0004, // link state + BMSR_Jabber = 0x0002, // Jabber condition detected BMSR_CAP_Ext = 0x0001 // Extended register capable }; + enum MII_ANAR { ANAR_NP = 0x8000, // Next page available - ANAR_ACK = 0x4000, // Link partner data reception ability acknowledged + ANAR_ACK = 0x4000, // Link partner data reception ability ack-ed ANAR_RF = 0x2000, // Fault condition detected and advertised ANAR_PAUSE = 0x0400, // Pause operation enabled for full-duplex links ANAR_T4 = 0x0200, // 100BASE-T4 supported @@ -62,40 +66,42 @@ enum MII_ANAR { ANAR_TX_HD = 0x0080, // 100BASE-TX half duplex supported ANAR_10_FD = 0x0040, // 10BASE-TX full duplex supported ANAR_10_HD = 0x0020, // 10BASE-TX half duplex supported - ANAR_SELECTOR = 0x0001 // Protocol selection bits (hardcoded to ethernet) + ANAR_SELECTOR = 0x0001 // Protocol sel. bits (hardcoded to ethernet) }; + enum MII_ANLPAR { ANLPAR_NP = 0x8000, // Link partner next page enabled - ANLPAR_ACK = 0x4000, // Link partner data reception ability acknowledged + ANLPAR_ACK = 0x4000, // Link partner data reception ability ack-ed ANLPAR_RF = 0x2000, // Remote fault indicated by link partner ANLPAR_PAUSE = 0x0400, // Pause operation supported by link partner ANLPAR_T4 = 0x0200, // 100BASE-T4 supported by link partner - ANLPAR_TX_FD = 0x0100, // 100BASE-TX full duplex supported by link partner - ANLPAR_TX_HD = 0x0080, // 100BASE-TX half duplex supported by link partner - ANLPAR_10_FD = 0x0040, // 10BASE-TX full duplex supported by link partner - ANLPAR_10_HD = 0x0020, // 10BASE-TX half duplex supported by link partner - ANLPAR_SELECTOR = 0x0001 // Link partner's binary encoded protocol selector + ANLPAR_TX_FD = 0x0100, // 100BASE-TX FD supported by link partner + ANLPAR_TX_HD = 0x0080, // 100BASE-TX HD supported by link partner + ANLPAR_10_FD = 0x0040, // 10BASE-TX FD supported by link partner + ANLPAR_10_HD = 0x0020, // 10BASE-TX HD supported by link partner + ANLPAR_SELECTOR = 0x0001 // Link partner's bin. encoded protocol selector }; // index used to different PHY on MII bus enum PHYIndex { - CurrentPHY = -1, // currently selected PHY. - // Internally used as default index in case on PHYs found. + CurrentPHY = -1, // currently selected PHY. + // Internally used as def. index in case no PHYs found. SecondaryPHY = 0, // secondary PHY PrimaryPHY = 1, // primary PHY PHYsCount = 2 // maximal count of PHYs on bus }; + // PHY type and id constants and masks. enum PHYType { PHYTypeMask = 0xe0, // mask for PHY type bits PHYNormal = 0x00, // 10/100 Ethernet PHY (Link reports as normal case) PHYLinkAState = 0x80, // Special case 1 (Link reports is always active) PHYGigabit = 0x20, // Gigabit Ethernet PHY on AX88178 - PHYNotInstalled = 0xe0, // non-supported PHY - + PHYNotInstalled = 0xe0, // non-supported PHY + PHYIDMask = 0x1f, // mask for PHY ID bits PHYIDEmbedded = 0x10 // id for embedded PHY on AX88772 }; @@ -104,40 +110,31 @@ enum PHYType { class MIIBus { public: MIIBus(); - - status_t Init(usb_device device, - uint8 SWOperationRequest, - uint8 ReadValueRequest, - uint8 WriteValueRequest, - uint8 ReadStatusRequest, - uint8 HWOperationRequest, - uint8 ReadPHYIDsRequest); + + status_t Init(usb_device device); status_t InitCheck(); - + status_t SetupPHY(); - + uint8 PHYID(PHYIndex phyIndex = CurrentPHY); uint8 PHYType(PHYIndex phyIndex = CurrentPHY); PHYIndex ActivePHY() { return fSelectedPHY; } - - status_t Read(uint16 miiRegister, uint16 *value, PHYIndex phyIndex = CurrentPHY); - status_t Write(uint16 miiRegister, uint16 value, PHYIndex phyIndex = CurrentPHY); - status_t Status(uint16 *status, PHYIndex phyIndex = CurrentPHY); + status_t Read(uint16 miiRegister, uint16 *value, + PHYIndex phyIndex = CurrentPHY); + status_t Write(uint16 miiRegister, uint16 value, + PHYIndex phyIndex = CurrentPHY); + + status_t Status(uint16 *status, + PHYIndex phyIndex = CurrentPHY); status_t Dump(); - + private: + status_t fStatus; usb_device fDevice; uint8 fPHYs[PHYsCount]; PHYIndex fSelectedPHY; - - uint8 fSWOperationRequest; - uint8 fReadValueRequest; - uint8 fWriteValueRequest; - uint8 fReadStatusRequest; - uint8 fHWOperationRequest; - uint8 fReadPHYIDsRequest; }; -#endif //_USB_MII_BUS_H_ +#endif // _USB_MII_BUS_H_ diff --git a/src/add-ons/kernel/drivers/network/usb_asix/Settings.cpp b/src/add-ons/kernel/drivers/network/usb_asix/Settings.cpp index 3ac77bde75..71ceb5b99f 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/Settings.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/Settings.cpp @@ -1,19 +1,26 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008,2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ -#include // for mutex #include "Settings.h" +#include +#include +#include + +#include +#include + + bool gTraceOn = false; bool gTruncateLogFile = false; bool gAddTimeStamp = true; @@ -21,10 +28,10 @@ bool gTraceFlow = false; static char *gLogFilePath = NULL; mutex gLogLock; -static +static void create_log() { - if(gLogFilePath == NULL) + if (gLogFilePath == NULL) return; int flags = O_WRONLY | O_CREAT | ((gTruncateLogFile) ? O_TRUNC : 0); @@ -33,21 +40,23 @@ void create_log() mutex_init(&gLogLock, DRIVER_NAME"-logging"); } + void load_settings() { void *handle = load_driver_settings(DRIVER_NAME); - if(handle == 0) + if (handle == 0) return; gTraceOn = get_driver_boolean_parameter(handle, "trace", gTraceOn, true); - gTraceFlow = get_driver_boolean_parameter(handle, "trace_flow", gTraceFlow, true); - gTruncateLogFile = get_driver_boolean_parameter(handle, "truncate_logfile", + gTraceFlow = get_driver_boolean_parameter(handle, "trace_flow", + gTraceFlow, true); + gTruncateLogFile = get_driver_boolean_parameter(handle, "truncate_logfile", gTruncateLogFile, true); - gAddTimeStamp = get_driver_boolean_parameter(handle, "add_timestamp", + gAddTimeStamp = get_driver_boolean_parameter(handle, "add_timestamp", gAddTimeStamp, true); - const char * logFilePath = get_driver_parameter(handle, "logfile", + const char * logFilePath = get_driver_parameter(handle, "logfile", NULL, "/var/log/"DRIVER_NAME".log"); - if(logFilePath != NULL) { + if (logFilePath != NULL) { gLogFilePath = strdup(logFilePath); } @@ -56,17 +65,19 @@ void load_settings() create_log(); } + void release_settings() { - if(gLogFilePath != NULL) { + if (gLogFilePath != NULL) { mutex_destroy(&gLogLock); free(gLogFilePath); } } + void usb_asix_trace(bool force, const char* func, const char *fmt, ...) { - if(!(force || gTraceOn)) { + if (!(force || gTraceOn)) { return; } @@ -74,21 +85,21 @@ void usb_asix_trace(bool force, const char* func, const char *fmt, ...) static const char *prefix = "\33[33m"DRIVER_NAME":\33[0m"; static char buffer[1024]; char *buf_ptr = buffer; - if(gLogFilePath == NULL){ + if (gLogFilePath == NULL) { strcpy(buffer, prefix); buf_ptr += strlen(prefix); } - - if(gAddTimeStamp) { - bigtime_t time = system_time(); - uint32 msec = time / 1000; - uint32 sec = msec / 1000; - sprintf(buf_ptr, "%02ld.%02ld.%03ld:", - sec / 60, sec % 60, msec % 1000); - buf_ptr += strlen(buf_ptr); - } - if(func != NULL) { + if (gAddTimeStamp) { + bigtime_t time = system_time(); + uint32 msec = time / 1000; + uint32 sec = msec / 1000; + sprintf(buf_ptr, "%02ld.%02ld.%03ld:", + sec / 60, sec % 60, msec % 1000); + buf_ptr += strlen(buf_ptr); + } + + if (func != NULL) { sprintf(buf_ptr, "%s::", func); buf_ptr += strlen(buf_ptr); } @@ -97,7 +108,7 @@ void usb_asix_trace(bool force, const char* func, const char *fmt, ...) vsprintf(buf_ptr, fmt, arg_list); va_end(arg_list); - if(gLogFilePath == NULL) { + if (gLogFilePath == NULL) { dprintf(buffer); return; } diff --git a/src/add-ons/kernel/drivers/network/usb_asix/Settings.h b/src/add-ons/kernel/drivers/network/usb_asix/Settings.h index abea40151d..7ce86dcf8c 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/Settings.h +++ b/src/add-ons/kernel/drivers/network/usb_asix/Settings.h @@ -1,27 +1,36 @@ /* * ASIX AX88172/AX88772/AX88178 USB 2.0 Ethernet Driver. - * Copyright (c) 2008 S.Zharski + * Copyright (c) 2008, 2011 S.Zharski * Distributed under the terms of the MIT license. - * - * Heavily based on code of the + * + * Heavily based on code of the * Driver for USB Ethernet Control Model devices * Copyright (C) 2008 Michael Lotz * Distributed under the terms of the MIT license. * */ +#ifndef _USB_ASIX_SETTINGS_H_ +#define _USB_ASIX_SETTINGS_H_ -#ifndef _USB_ASIX_SETTINGS_H_ - #define _USB_ASIX_SETTINGS_H_ -#include +#include #include "Driver.h" + +#ifdef _countof +#warning "_countof(...) WAS ALREADY DEFINED!!! Remove local definition!" +#undef _countof +#endif +#define _countof(array)(sizeof(array) / sizeof(array[0])) + + void load_settings(); void release_settings(); void usb_asix_trace(bool force, const char *func, const char *fmt, ...); + #define TRACE(x...) usb_asix_trace(false, __func__, x) #define TRACE_ALWAYS(x...) usb_asix_trace(true, __func__, x) @@ -31,4 +40,5 @@ extern bool gTraceFlow; #define TRACE_RET(result) usb_asix_trace(false, __func__, \ "Returns:%#010x\n", result); -#endif /*_USB_ASIX_SETTINGS_H_*/ + +#endif // _USB_ASIX_SETTINGS_H_ From 42ea87d59b6529411e0dc4a0683c3d055a927367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 19 Sep 2011 20:01:38 +0000 Subject: [PATCH 299/702] Patch by "jwlh172": Added a text control to the partition creation panel of DriveSetup, to enter the partition size manually. Closes ticket #7991. Changes by myself: I've refactored updating the text control from the size slider and used that method also when the user somehow entered invalid input into the text control (untested). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42759 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/drivesetup/CreateParamsPanel.cpp | 40 ++++++++++++++++++++++- src/apps/drivesetup/CreateParamsPanel.h | 3 ++ src/apps/drivesetup/Support.cpp | 9 ++++- src/apps/drivesetup/Support.h | 2 ++ 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/src/apps/drivesetup/CreateParamsPanel.cpp b/src/apps/drivesetup/CreateParamsPanel.cpp index 76c6e008ad..771cd5231a 100644 --- a/src/apps/drivesetup/CreateParamsPanel.cpp +++ b/src/apps/drivesetup/CreateParamsPanel.cpp @@ -77,7 +77,9 @@ private: enum { MSG_OK = 'okok', MSG_CANCEL = 'cncl', - MSG_PARTITION_TYPE = 'type' + MSG_PARTITION_TYPE = 'type', + MSG_SIZE_SLIDER = 'ssld', + MSG_SIZE_TEXTCONTROL = 'stct' }; @@ -138,6 +140,22 @@ CreateParamsPanel::MessageReceived(BMessage* message) fEditor->PartitionTypeChanged(type); } break; + + case MSG_SIZE_SLIDER: + _UpdateTextControl(); + break; + + case MSG_SIZE_TEXTCONTROL: + { + BString sizeString; + sizeString = fSizeTextControl->Text(); + int32 sizeInt = atoi(sizeString.String()); + if (sizeInt >= 0 && sizeInt <= fSizeSlider->MaxPartitionSize()) + fSizeSlider->SetValue(sizeInt); + else + _UpdateTextControl(); + break; + } default: BWindow::MessageReceived(message); @@ -225,6 +243,17 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset, fSizeSlider = new SizeSlider("Slider", B_TRANSLATE("Partition size"), NULL, offset, offset + size); fSizeSlider->SetPosition(1.0); + fSizeSlider->SetModificationMessage(new BMessage(MSG_SIZE_SLIDER)); + + BString sizeText; + sizeText << fSizeSlider->Value(); + fSizeTextControl = new BTextControl("Size Control", + "", sizeText.String(), NULL); + for(int32 i = 0; i < 256; i++) + fSizeTextControl->TextView()->DisallowChar(i); + for(int32 i = '0'; i <= '9'; i++) + fSizeTextControl->TextView()->AllowChar(i); + fSizeTextControl->SetModificationMessage(new BMessage(MSG_SIZE_TEXTCONTROL)); fNameTextControl = new BTextControl("Name Control", B_TRANSLATE("Partition name:"), "", NULL); @@ -257,6 +286,7 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset, AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing) .Add(fSizeSlider) + .Add(fSizeTextControl) .Add(BGridLayoutBuilder(0.0, 5.0) .Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0) .Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0) @@ -284,3 +314,11 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset, layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); } + +void +CreateParamsPanel::_UpdateTextControl() +{ + BString sizeString; + sizeString << fSizeSlider->Value(); + fSizeTextControl->SetText(sizeString.String()); +} diff --git a/src/apps/drivesetup/CreateParamsPanel.h b/src/apps/drivesetup/CreateParamsPanel.h index 9b9221595f..3896c0fbb0 100644 --- a/src/apps/drivesetup/CreateParamsPanel.h +++ b/src/apps/drivesetup/CreateParamsPanel.h @@ -38,6 +38,8 @@ private: void _CreateViewControls(BPartition* parent, off_t offset, off_t size); + void _UpdateTextControl(); + class EscapeFilter; EscapeFilter* fEscapeFilter; sem_id fExitSemaphore; @@ -50,6 +52,7 @@ private: BMenuField* fTypeMenuField; BTextControl* fNameTextControl; SizeSlider* fSizeSlider; + BTextControl* fSizeTextControl; }; #endif // CREATE_PARAMS_PANEL_H diff --git a/src/apps/drivesetup/Support.cpp b/src/apps/drivesetup/Support.cpp index 49e59bdba7..1c913ed19c 100644 --- a/src/apps/drivesetup/Support.cpp +++ b/src/apps/drivesetup/Support.cpp @@ -99,7 +99,8 @@ SizeSlider::SizeSlider(const char* name, const char* label, BSlider(name, label, message, minValue, maxValue, B_HORIZONTAL, B_TRIANGLE_THUMB), fStartOffset(minValue), - fEndOffset(maxValue) + fEndOffset(maxValue), + fMaxPartitionSize(maxValue) { SetBarColor((rgb_color){ 0, 80, 255, 255 }); char minString[64]; @@ -143,3 +144,9 @@ SizeSlider::Offset() // headed slider is implemented. return fStartOffset; } + +int32 +SizeSlider::MaxPartitionSize() +{ + return fMaxPartitionSize; +} diff --git a/src/apps/drivesetup/Support.h b/src/apps/drivesetup/Support.h index 736ce4c011..9314446d67 100644 --- a/src/apps/drivesetup/Support.h +++ b/src/apps/drivesetup/Support.h @@ -51,10 +51,12 @@ public: virtual const char* UpdateText() const; int32 Size(); int32 Offset(); + int32 MaxPartitionSize(); private: off_t fStartOffset; off_t fEndOffset; + off_t fMaxPartitionSize; mutable char fStatusLabel[64]; }; From 6fca1a84fcc67f1fcc59e8d466c3638adde01d5c Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 20 Sep 2011 12:47:47 +0000 Subject: [PATCH 300/702] * fix header function define * while doing our last-resort fallback, skip TV DAC encoders as it is likely that is not what the user wants. This may need to change as the driver matures. (ex: only a tv is connected, no edid) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42760 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 16 +++++++++++----- src/add-ons/accelerants/radeon_hd/gpu.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 5e1a11ac11..54daf7fbc9 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -648,11 +648,17 @@ detect_displays() if (displayIndex == 0) { ERROR("%s: ERROR: 0 attached monitors were found on display connectors." " Injecting first connector as a last resort.\n", __func__); - gDisplay[displayIndex]->active = true; - gDisplay[displayIndex]->connector_index = 0; - init_registers(gDisplay[displayIndex]->regs, displayIndex); - if (detect_crt_ranges(displayIndex) == B_OK) - gDisplay[displayIndex]->found_ranges = true; + for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { + // skip TV DAC connectors as likely fallback isn't for TV + if (gConnector[id]->encoder_type == VIDEO_ENCODER_TVDAC) + continue; + gDisplay[0]->active = true; + gDisplay[0]->connector_index = id; + init_registers(gDisplay[0]->regs, 0); + if (detect_crt_ranges(0) == B_OK) + gDisplay[0]->found_ranges = true; + break; + } } diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index e79ee9fe55..d79eeae5bd 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -169,7 +169,7 @@ uint32 radeon_gpu_mc_idlecheck(); status_t radeon_gpu_mc_setup(); status_t radeon_gpu_irq_setup(); bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid); -status_t radeon_gpu_i2c_setup(uint32 id, uint8 gpio_id); +status_t radeon_gpu_i2c_setup(uint32 id, uint8 gpio_pin); #endif From 665505060604e9b66acadeca5a4115892a8bf7d0 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 20 Sep 2011 13:39:40 +0000 Subject: [PATCH 301/702] * style fix * clean up int types * curly brace cleanup * move vars away from top of functions when possible * split DDR timings to seperate header to avoid warnings on unused items * quite a few automated changes, please excuse things within diff still not fixed / incorrect git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42761 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/wwan/usb_beceemwmx/BeceemCPU.cpp | 6 +- .../network/wwan/usb_beceemwmx/BeceemCPU.h | 16 +- .../network/wwan/usb_beceemwmx/BeceemDDR.cpp | 51 +- .../network/wwan/usb_beceemwmx/BeceemDDR.h | 857 +----------------- .../wwan/usb_beceemwmx/BeceemDDRTiming.h | 849 +++++++++++++++++ .../wwan/usb_beceemwmx/BeceemDevice.cpp | 34 +- .../network/wwan/usb_beceemwmx/BeceemDevice.h | 20 +- .../network/wwan/usb_beceemwmx/BeceemLED.cpp | 100 +- .../network/wwan/usb_beceemwmx/BeceemLED.h | 20 +- .../network/wwan/usb_beceemwmx/BeceemNVM.cpp | 132 +-- .../network/wwan/usb_beceemwmx/BeceemNVM.h | 52 +- .../network/wwan/usb_beceemwmx/DeviceStruct.h | 144 +-- .../network/wwan/usb_beceemwmx/util.cpp | 10 +- .../drivers/network/wwan/usb_beceemwmx/util.h | 4 +- 14 files changed, 1148 insertions(+), 1147 deletions(-) create mode 100644 src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDRTiming.h diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.cpp index 624a372b23..1f07fc6306 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.cpp +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.cpp @@ -33,7 +33,7 @@ BeceemCPU::CPUInit(WIMAX_DEVICE* swmxdevice) status_t BeceemCPU::CPURun() { - unsigned int clockRegister = 0; + uint32 clockRegister = 0; // Read current clock register contents if (BizarroReadRegister(CLOCK_RESET_CNTRL_REG_1, @@ -62,7 +62,7 @@ BeceemCPU::CPURun() status_t BeceemCPU::CPUReset() { - unsigned int value = 0; + uint32 value = 0; if (fWmxDevice->deviceChipID >= T3LPB) { BizarroReadRegister(SYS_CFG, sizeof(value), &value); @@ -114,7 +114,7 @@ BeceemCPU::CPUReset() } // TODO : ELSE OLDER CHIP ID's < T3LP see Misc.c:1048 - unsigned int uiResetValue = 0; + uint32 uiResetValue = 0; if (fWmxDevice->CPUFlashBoot) { // In flash boot mode MIPS state register has reverse polarity. diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.h index 3520a611fd..5d8d762b31 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.h +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemCPU.h @@ -24,15 +24,15 @@ public: status_t CPUReset(); // yuck. These are in a parent class - virtual status_t ReadRegister(unsigned int reg, size_t size, - uint32_t* buffer) { return NULL; }; - virtual status_t WriteRegister(unsigned int reg, size_t size, - uint32_t* buffer) { return NULL; }; - virtual status_t BizarroReadRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t ReadRegister(uint32 reg, size_t size, + uint32* buffer) { return NULL; }; + virtual status_t WriteRegister(uint32 reg, size_t size, + uint32* buffer) { return NULL; }; + virtual status_t BizarroReadRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; - virtual status_t BizarroWriteRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t BizarroWriteRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; private: diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.cpp index 87dba3b6ff..397aa791b0 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.cpp +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.cpp @@ -10,6 +10,7 @@ #include "BeceemDDR.h" +#include "BeceemDDRTiming.h" #include "Settings.h" @@ -25,21 +26,21 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) fWmxDevice = swmxdevice; PDDR_SETTING psDDRSetting = NULL; - unsigned int chipID = fWmxDevice->deviceChipID; + uint32 chipID = fWmxDevice->deviceChipID; unsigned long registerCount = 0; unsigned long value = 0; - unsigned int uiResetValue = 0; - unsigned int uiClockSetting = 0; + uint32 uiResetValue = 0; + uint32 uiClockSetting = 0; int retval = B_OK; // Grab the Config6 metric from the vendor config and convert endianness - unsigned int vendorConfig6raw = fWmxDevice->vendorcfg.HostDrvrConfig6; + uint32 vendorConfig6raw = fWmxDevice->vendorcfg.HostDrvrConfig6; vendorConfig6raw &= ~(htonl(1 << 15)); - unsigned int vendorConfig6 = ntohl(vendorConfig6raw); + uint32 vendorConfig6 = ntohl(vendorConfig6raw); // Read our vendor provided Config6 metric and populate memory settings - unsigned int vendorDDRSetting = (ntohl(vendorConfig6raw) >> 8) & 0x0F; + uint32 vendorDDRSetting = (ntohl(vendorConfig6raw) >> 8) & 0x0F; bool vendorPmuMode = (vendorConfig6 >> 24) & 0x03; bool vendorMipsConfig = (vendorConfig6 >> 20) & 0x01; bool vendorPLLConfig = (vendorConfig6 >> 19) & 0x01; @@ -84,7 +85,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) if ((chipID != BCS220_2) && (chipID != BCS220_2BC) && (chipID != BCS220_3)) { - retval = BizarroReadRegister((unsigned int)0x0f000830, + retval = BizarroReadRegister((uint32)0x0f000830, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { @@ -93,7 +94,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) return retval; } uiResetValue |= 0x44; - retval = BizarroWriteRegister((unsigned int)0x0f000830, + retval = BizarroWriteRegister((uint32)0x0f000830, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroWriteRegister failed\n", @@ -227,7 +228,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) value = psDDRSetting->ulRegValue; retval = BizarroWriteRegister(psDDRSetting->ulRegAddress, - sizeof(value), (unsigned int*)&value); + sizeof(value), (uint32*)&value); if (B_OK != retval) { TRACE_ALWAYS( @@ -248,7 +249,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) && (chipID != BCS220_3)) { /* drive MDDR to half in case of UMA-B: */ uiResetValue = 0x01010001; - retval = BizarroWriteRegister((unsigned int)0x0F007018, + retval = BizarroWriteRegister((uint32)0x0F007018, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { @@ -257,7 +258,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) return retval; } uiResetValue = 0x00040020; - retval = BizarroWriteRegister((unsigned int)0x0F007094, + retval = BizarroWriteRegister((uint32)0x0F007094, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { @@ -266,7 +267,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) return retval; } uiResetValue = 0x01020101; - retval = BizarroWriteRegister((unsigned int)0x0F00701c, + retval = BizarroWriteRegister((uint32)0x0F00701c, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { @@ -275,7 +276,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) return retval; } uiResetValue = 0x01010000; - retval = BizarroWriteRegister((unsigned int)0x0F007018, + retval = BizarroWriteRegister((uint32)0x0F007018, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { @@ -295,7 +296,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) */ if (vendorPmuMode == HYBRID_MODE_7C) { TRACE("Debug: Hybrid Power Mode 7C\n"); - retval = BizarroReadRegister((unsigned int)0x0f000c00, + retval = BizarroReadRegister((uint32)0x0f000c00, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { @@ -303,7 +304,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) __FUNCTION__, __LINE__); return retval; } - retval = BizarroReadRegister((unsigned int)0x0f000c00, + retval = BizarroReadRegister((uint32)0x0f000c00, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroReadRegister failed\n", @@ -311,21 +312,21 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) return retval; } uiResetValue = 0x1322a8; - retval = BizarroWriteRegister((unsigned int)0x0f000d1c, + retval = BizarroWriteRegister((uint32)0x0f000d1c, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroWriteRegister failed\n", __FUNCTION__, __LINE__); return retval; } - retval = BizarroReadRegister((unsigned int)0x0f000c00, + retval = BizarroReadRegister((uint32)0x0f000c00, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroReadRegister failed\n", __FUNCTION__, __LINE__); return retval; } - retval = BizarroReadRegister((unsigned int)0x0f000c00, + retval = BizarroReadRegister((uint32)0x0f000c00, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroReadRegister failed\n", @@ -333,7 +334,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) return retval; } uiResetValue = 0x132296; - retval = BizarroWriteRegister((unsigned int)0x0f000d14, + retval = BizarroWriteRegister((uint32)0x0f000d14, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroWriteRegister failed\n", @@ -343,14 +344,14 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) } else if (vendorPmuMode == HYBRID_MODE_6) { TRACE("Debug: Hybrid Power Mode 6\n"); - retval = BizarroReadRegister((unsigned int)0x0f000c00, + retval = BizarroReadRegister((uint32)0x0f000c00, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroReadRegister failed\n", __FUNCTION__, __LINE__); return retval; } - retval = BizarroReadRegister((unsigned int)0x0f000c00, + retval = BizarroReadRegister((uint32)0x0f000c00, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroReadRegister failed\n", @@ -358,21 +359,21 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) return retval; } uiResetValue = 0x6003229a; - retval = BizarroWriteRegister((unsigned int)0x0f000d14, + retval = BizarroWriteRegister((uint32)0x0f000d14, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroWriteRegister failed\n", __FUNCTION__, __LINE__); return retval; } - retval = BizarroReadRegister((unsigned int)0x0f000c00, + retval = BizarroReadRegister((uint32)0x0f000c00, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroReadRegister failed\n", __FUNCTION__, __LINE__); return retval; } - retval = BizarroReadRegister((unsigned int)0x0f000c00, + retval = BizarroReadRegister((uint32)0x0f000c00, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroReadRegister failed\n", @@ -380,7 +381,7 @@ BeceemDDR::DDRInit(WIMAX_DEVICE* swmxdevice) return retval; } uiResetValue = 0x1322a8; - retval = BizarroWriteRegister((unsigned int)0x0f000d1c, + retval = BizarroWriteRegister((uint32)0x0f000d1c, sizeof(uiResetValue), &uiResetValue); if (retval < 0) { TRACE_ALWAYS("%s:%d BizarroWriteRegister failed\n", diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.h index 985663dfd2..ee7784b16c 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.h +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDR.h @@ -1,9 +1,7 @@ /* - * Beceem WiMax USB Driver. - * Copyright (c) 2010 Alexander von Gluck - * Distributed under the terms of the GNU General Public License. - * - * Based on GPL code developed by: Beceem Communications Pvt. Ltd + * Beceem WiMax USB Driver. + * Copyright (c) 2010 Alexander von Gluck + * Distributed under the terms of the MIT license. * * Description: Wrangle Beceem volatile DDR memory. */ @@ -15,24 +13,6 @@ #include "DeviceStruct.h" -#define DDR_DUMP_INTERNAL_DEVICE_MEMORY 0xBFC02B00 -#define MIPS_CLOCK_REG 0x0f000820 - -#define MIPS_200_MHZ 0 -#define MIPS_160_MHZ 1 -#define PLL_800_MHZ 0 -#define PLL_266_MHZ 1 - -#define DDR_80_MHZ 0 -#define DDR_100_MHZ 1 -#define DDR_120_MHZ 2 // Additional Frequency for T3LP -#define DDR_133_MHZ 3 -#define DDR_140_MHZ 4 // Not Used (Reserved for future) -#define DDR_160_MHZ 5 // Additional Frequency for T3LP -#define DDR_180_MHZ 6 // Not Used (Reserved for future) -#define DDR_200_MHZ 7 // Not Used (Reserved for future) - - class BeceemDDR { public: BeceemDDR(); @@ -41,831 +21,18 @@ public: WIMAX_DEVICE* fWmxDevice; // yuck. These are in a child class class - virtual status_t ReadRegister(unsigned int reg, size_t size, - uint32_t* buffer) { return NULL; }; - virtual status_t WriteRegister(unsigned int reg, size_t size, - uint32_t* buffer) { return NULL; }; - virtual status_t BizarroReadRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t ReadRegister(uint32 reg, size_t size, + uint32* buffer) { return NULL; }; + virtual status_t WriteRegister(uint32 reg, size_t size, + uint32* buffer) { return NULL; }; + virtual status_t BizarroReadRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; - virtual status_t BizarroWriteRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t BizarroWriteRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; }; -/* - * DDR Power modes - */ -typedef enum ePMU_MODES -{ - HYBRID_MODE_7C = 0, - INTERNAL_MODE_6 = 1, - HYBRID_MODE_6 = 2 -}PMU_MODE; - - -/* - * DDR Init maps, taken from Beceem GPL Linux Driver - */ -typedef struct _DDR_SETTING -{ - unsigned long ulRegAddress; - unsigned long ulRegValue; -} DDR_SETTING, *PDDR_SETTING; - - -typedef DDR_SETTING DDR_SET_NODE, *PDDR_SET_NODE; - - -// DDR INIT 133Mhz -#define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12 // index for 0x0F007000 -static DDR_SET_NODE asT3_DDRSetting133MHz[]= {// DPLL Clock Setting - {0x0F000800, 0x00007212}, - {0x0f000820, 0x07F13FFF}, - {0x0f000810, 0x00000F95}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - // Changed source for Xbar and MIPS clock to APLL - {0x0f000840, 0x0FFF1B00}, - {0x0f000870, 0x00000002}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - {0x0F00a04C, 0x0000000C}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01010100}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020001}, // POP - 0x00020001 Normal 0x01020001 - {0x0F007020, 0x04030107}, // Normal - 0x04030107 POP - 0x05030107 - {0x0F007024, 0x02000007}, - {0x0F007028, 0x02020202}, - {0x0F00702c, 0x0206060a}, // ROB - 0x0205050a, 0x0206060a - {0x0F007030, 0x05000000}, - {0x0F007034, 0x00000003}, - {0x0F007038, 0x110a0200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 - {0x0F00703C, 0x02101010}, // ROB - 0x02101010, 0x02101018}, - {0x0F007040, 0x45751200}, // ROB - 0x45751200, 0x450f1200}, - {0x0F007044, 0x110a0d00}, // ROB - 0x110a0d00, 0x111f0d00 - {0x0F007048, 0x081b0306}, - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0000001c}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x0010246c}, - {0x0F007064, 0x00000010}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00007000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - // # Enable BW improvement within memory controller - {0x0F007094, 0x00000104}, - // # Enable 2 ports within Xbar - {0x0F00A000, 0x00000016}, - // # Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -// 80Mhz -#define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10 // index for 0x0F007000 -static DDR_SET_NODE asT3_DDRSetting80MHz[]= {// DPLL Clock Setting - {0x0f000810, 0x00000F95}, - {0x0f000820, 0x07f1ffff}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - {0x0F00a000, 0x00000016}, - {0x0F00a04C, 0x0000000C}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01000000}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020000}, - {0x0F007020, 0x04020107}, - {0x0F007024, 0x00000007}, - {0x0F007028, 0x02020201}, - {0x0F00702c, 0x0204040a}, - {0x0F007030, 0x04000000}, - {0x0F007034, 0x00000002}, - {0x0F007038, 0x1F060200}, - {0x0F00703C, 0x1C22221F}, - {0x0F007040, 0x8A006600}, - {0x0F007044, 0x221a0800}, - {0x0F007048, 0x02690204}, - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0000001c}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x000A15D6}, - {0x0F007064, 0x0000000A}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00004000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - {0x0F007094, 0x00000104}, - // Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -// 100Mhz -#define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13 // index for 0x0F007000 -static DDR_SET_NODE asT3_DDRSetting100MHz[]= {// DPLL Clock Setting - {0x0F000800, 0x00007008}, - {0x0f000810, 0x00000F95}, - {0x0f000820, 0x07F13E3F}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - // Changed source for Xbar and MIPS clock to APLL - // 0x0f000840, 0x0FFF1800, - {0x0f000840, 0x0FFF1B00}, - {0x0f000870, 0x00000002}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - {0x0F00a04C, 0x0000000C}, - // Enable 2 ports within Xbar - {0x0F00A000, 0x00000016}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01010100}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020001}, // POP - 0x00020000 Normal 0x01020000 - {0x0F007020, 0x04020107}, // Normal - 0x04030107 POP - 0x05030107 - {0x0F007024, 0x00000007}, - {0x0F007028, 0x01020201}, - {0x0F00702c, 0x0204040A}, - {0x0F007030, 0x06000000}, - {0x0F007034, 0x00000004}, - {0x0F007038, 0x20080200}, - {0x0F00703C, 0x02030320}, - {0x0F007040, 0x6E7F1200}, - {0x0F007044, 0x01190A00}, - {0x0F007048, 0x06120305}, // 0x02690204 // 0x06120305 - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0000001C}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x00082ED6}, - {0x0F007064, 0x0000000A}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00005000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - // Enable BW improvement within memory controller - {0x0F007094, 0x00000104}, - // Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -// Net T3B DDR Settings -// DDR INIT 133Mhz -static DDR_SET_NODE asDPLL_266MHZ[] = { - {0x0F000800, 0x00007212}, - {0x0f000820, 0x07F13FFF}, - {0x0f000810, 0x00000F95}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - // Changed source for X - bar and MIPS clock to APLL - {0x0f000840, 0x0FFF1B00}, - {0x0f000870, 0x00000002} -}; - - -#if 0 -static DDR_SET_NODE asDPLL_800MHZ[] = { - {0x0f000810, 0x00000F95}, - {0x0f000810, 0x00000F95}, - {0x0f000810, 0x00000F95}, - {0x0f000820, 0x03F1365B}, - {0x0f000840, 0x0FFF0000}, - {0x0f000880, 0x000003DD}, - {0x0f000860, 0x00000000} -}; -#endif - - -#define T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 11 // index for 0x0F007000 -static DDR_SET_NODE asT3B_DDRSetting133MHz[] = {// DPLL Clock Setting - {0x0f000810, 0x00000F95}, - {0x0f000810, 0x00000F95}, - {0x0f000810, 0x00000F95}, - {0x0f000820, 0x07F13652}, - {0x0f000840, 0x0FFF0800}, - // Changed source for Xbar and MIPS clock to APLL - {0x0f000880, 0x000003DD}, - {0x0f000860, 0x00000000}, - // Changed source for Xbar and MIPS clock to APLL - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - // Enable 2 ports within Xbar - {0x0F00A000, 0x00000016}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01010100}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020001}, // POP - 0x00020001 Normal 0x01020001 - {0x0F007020, 0x04030107}, // Normal - 0x04030107 POP - 0x05030107 - {0x0F007024, 0x02000007}, - {0x0F007028, 0x02020202}, - {0x0F00702c, 0x0206060a}, // ROB- 0x0205050a, 0x0206060a - {0x0F007030, 0x05000000}, - {0x0F007034, 0x00000003}, - {0x0F007038, 0x130a0200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 - {0x0F00703C, 0x02101012}, // ROB - 0x02101010, 0x02101018}, - {0x0F007040, 0x457D1200}, // ROB - 0x45751200, 0x450f1200}, - {0x0F007044, 0x11130d00}, // ROB - 0x110a0d00, 0x111f0d00 - {0x0F007048, 0x040D0306}, - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0000001c}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x0010246c}, - {0x0F007064, 0x00000012}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00007000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - // # Enable BW improvement within memory controller - {0x0F007094, 0x00000104}, - // # Enable start bit within memory controller - {0x0F007018, 0x01010000}, -}; - - -#define T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 // index for 0x0F007000 -static DDR_SET_NODE asT3B_DDRSetting80MHz[] = {// DPLL Clock Setting - {0x0f000810, 0x00000F95}, - {0x0f000820, 0x07F13FFF}, - {0x0f000840, 0x0FFF1F00}, - {0x0f000880, 0x000003DD}, - {0x0f000860, 0x00000000}, - - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - {0x0F00a000, 0x00000016}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01000000}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020000}, - {0x0F007020, 0x04020107}, - {0x0F007024, 0x00000007}, - {0x0F007028, 0x02020201}, - {0x0F00702c, 0x0204040a}, - {0x0F007030, 0x04000000}, - {0x0F007034, 0x02000002}, - {0x0F007038, 0x1F060202}, - {0x0F00703C, 0x1C22221F}, - {0x0F007040, 0x8A006600}, - {0x0F007044, 0x221a0800}, - {0x0F007048, 0x02690204}, - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0100001c}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x000A15D6}, - {0x0F007064, 0x0000000A}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00004000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - {0x0F007094, 0x00000104}, - // Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -// 100Mhz -#define T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 9 // index for 0x0F007000 -static DDR_SET_NODE asT3B_DDRSetting100MHz[] = {// DPLL Clock Setting - {0x0f000810, 0x00000F95}, - {0x0f000820, 0x07F1369B}, - {0x0f000840, 0x0FFF0800}, - {0x0f000880, 0x000003DD}, - {0x0f000860, 0x00000000}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - // Enable 2 ports within Xbar - {0x0F00A000, 0x00000016}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01010100}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020000}, // POP - 0x00020000 Normal 0x01020000 - {0x0F007020, 0x04020107}, // Normal - 0x04030107 POP - 0x05030107 - {0x0F007024, 0x00000007}, - {0x0F007028, 0x01020201}, - {0x0F00702c, 0x0204040A}, - {0x0F007030, 0x06000000}, - {0x0F007034, 0x02000004}, - {0x0F007038, 0x20080200}, - {0x0F00703C, 0x02030320}, - {0x0F007040, 0x6E7F1200}, - {0x0F007044, 0x01190A00}, - {0x0F007048, 0x06120305}, // 0x02690204 // 0x06120305 - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0100001C}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x00082ED6}, - {0x0F007064, 0x0000000A}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00005000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - // # Enable BW improvement within memory controller - {0x0F007094, 0x00000104}, - // # Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -#define T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 9 // index for 0x0F007000 -static DDR_SET_NODE asT3LP_DDRSetting133MHz[] = {// DPLL Clock Setting - {0x0f000820, 0x03F1365B}, - {0x0f000810, 0x00002F95}, - {0x0f000880, 0x000003DD}, - // Changed source for Xbar and MIPS clock to APLL - {0x0f000840, 0x0FFF0000}, - {0x0f000860, 0x00000000}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - {0x0F00A000, 0x00000016}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01010100}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020001}, // POP - 0x00020001 Normal 0x01020001 - {0x0F007020, 0x04030107}, // Normal - 0x04030107 POP - 0x05030107 - {0x0F007024, 0x02000007}, - {0x0F007028, 0x02020200}, - {0x0F00702c, 0x0206060a}, // ROB - 0x0205050a, 0x0206060a - {0x0F007030, 0x05000000}, - {0x0F007034, 0x00000003}, - {0x0F007038, 0x200a0200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 - {0x0F00703C, 0x02101020}, // ROB - 0x02101010, 0x02101018, - {0x0F007040, 0x45711200}, // ROB - 0x45751200, 0x450f1200, - {0x0F007044, 0x110D0D00}, // ROB - 0x110a0d00, 0x111f0d00 - {0x0F007048, 0x04080306}, - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0100001c}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x0010245F}, - {0x0F007064, 0x00000010}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00007000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - {0x0F007088, 0x01000001}, - {0x0F00708c, 0x00000101}, - {0x0F007090, 0x00000000}, - // Enable BW improvement within memory controller - {0x0F007094, 0x00040000}, - {0x0F007098, 0x00000000}, - {0x0F0070c8, 0x00000104}, - // Enable 2 ports within Xbar - // Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -#define T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 11 // index for 0x0F007000 -static DDR_SET_NODE asT3LP_DDRSetting100MHz[]= {// # DPLL Clock Setting - {0x0f000810, 0x00002F95}, - {0x0f000820, 0x03F1369B}, - {0x0f000840, 0x0fff0000}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - // Changed source for Xbar and MIPS clock to APLL - {0x0f000840, 0x0FFF0000}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01010100}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020000}, // POP - 0x00020001 Normal 0x01020001 - {0x0F007020, 0x04020107}, // Normal - 0x04030107 POP - 0x05030107 - {0x0F007024, 0x00000007}, - {0x0F007028, 0x01020200}, - {0x0F00702c, 0x0204040a}, // ROB- 0x0205050a, 0x0206060a - {0x0F007030, 0x06000000}, - {0x0F007034, 0x00000004}, - {0x0F007038, 0x1F080200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 - {0x0F00703C, 0x0203031F}, // ROB - 0x02101010, 0x02101018, - {0x0F007040, 0x6e001200}, // ROB - 0x45751200, 0x450f1200, - {0x0F007044, 0x011a0a00}, // ROB - 0x110a0d00, 0x111f0d00 - {0x0F007048, 0x03000305}, - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0100001c}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x00082ED6}, - {0x0F007064, 0x0000000A}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00005000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - {0x0F007088, 0x01000001}, - {0x0F00708c, 0x00000101}, - {0x0F007090, 0x00000000}, - {0x0F007094, 0x00010000}, - {0x0F007098, 0x00000000}, - {0x0F0070C8, 0x00000104}, - // Enable 2 ports within Xbar - {0x0F00A000, 0x00000016}, - // Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -#define T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 // index for 0x0F007000 -static DDR_SET_NODE asT3LP_DDRSetting80MHz[]= {// # DPLL Clock Setting - {0x0f000820, 0x07F13FFF}, - {0x0f000810, 0x00002F95}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - {0x0f000840, 0x0FFF1F00}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0F00a084, 0x1Cffffff}, - {0x0F00a080, 0x1C000000}, - {0x0F00A000, 0x00000016}, - {0x0f007000, 0x00010001}, - {0x0f007004, 0x01000000}, - {0x0f007008, 0x01000001}, - {0x0f00700c, 0x00000000}, - {0x0f007010, 0x01000000}, - {0x0f007014, 0x01000100}, - {0x0f007018, 0x01000000}, - {0x0f00701c, 0x01020000}, - {0x0f007020, 0x04020107}, - {0x0f007024, 0x00000007}, - {0x0f007028, 0x02020200}, - {0x0f00702c, 0x0204040a}, - {0x0f007030, 0x04000000}, - {0x0f007034, 0x00000002}, - {0x0f007038, 0x1d060200}, - {0x0f00703c, 0x1c22221d}, - {0x0f007040, 0x8A116600}, - {0x0f007044, 0x222d0800}, - {0x0f007048, 0x02690204}, - {0x0f00704c, 0x00000000}, - {0x0f007050, 0x0100001c}, - {0x0f007054, 0x00000000}, - {0x0f007058, 0x00000000}, - {0x0f00705c, 0x00000000}, - {0x0f007060, 0x000A15D6}, - {0x0f007064, 0x0000000A}, - {0x0f007068, 0x00000000}, - {0x0f00706c, 0x00000001}, - {0x0f007070, 0x00004000}, - {0x0f007074, 0x00000000}, - {0x0f007078, 0x00000000}, - {0x0f00707c, 0x00000000}, - {0x0f007080, 0x00000000}, - {0x0f007084, 0x00000000}, - {0x0f007088, 0x01000001}, - {0x0f00708c, 0x00000101}, - {0x0f007090, 0x00000000}, - {0x0f007094, 0x00010000}, - {0x0f007098, 0x00000000}, - {0x0F0070C8, 0x00000104}, - {0x0F007018, 0x01010000} -}; - - -// T3 LP-B (UMA-B) -#define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ 7 // index for 0x0F007000 -static DDR_SET_NODE asT3LPB_DDRSetting160MHz[]= {// # DPLL Clock Setting - {0x0f000820, 0x03F137DB}, - {0x0f000810, 0x01842795}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - {0x0f000840, 0x0FFF0400}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0f003050, 0x00000021}, // nvm clock divisor set the flash clock to 20 MHz - {0x0F00a084, 0x1Cffffff}, // Now dump from her in internal memory - {0x0F00a080, 0x1C000000}, - {0x0F00A000, 0x00000016}, - {0x0f007000, 0x00010001}, - {0x0f007004, 0x01000001}, - {0x0f007008, 0x01000101}, - {0x0f00700c, 0x00000000}, - {0x0f007010, 0x01000100}, - {0x0f007014, 0x01000100}, - {0x0f007018, 0x01000000}, - {0x0f00701c, 0x01020000}, - {0x0f007020, 0x04030107}, - {0x0f007024, 0x02000007}, - {0x0f007028, 0x02020200}, - {0x0f00702c, 0x0206060a}, - {0x0f007030, 0x050d0d00}, - {0x0f007034, 0x00000003}, - {0x0f007038, 0x170a0200}, - {0x0f00703c, 0x02101012}, - {0x0f007040, 0x45161200}, - {0x0f007044, 0x11250c00}, - {0x0f007048, 0x04da0307}, - {0x0f00704c, 0x00000000}, - {0x0f007050, 0x0000001c}, - {0x0f007054, 0x00000000}, - {0x0f007058, 0x00000000}, - {0x0f00705c, 0x00000000}, - {0x0f007060, 0x00142bb6}, - {0x0f007064, 0x20430014}, - {0x0f007068, 0x00000000}, - {0x0f00706c, 0x00000001}, - {0x0f007070, 0x00009000}, - {0x0f007074, 0x00000000}, - {0x0f007078, 0x00000000}, - {0x0f00707c, 0x00000000}, - {0x0f007080, 0x00000000}, - {0x0f007084, 0x00000000}, - {0x0f007088, 0x01000001}, - {0x0f00708c, 0x00000101}, - {0x0f007090, 0x00000000}, - {0x0f007094, 0x00040000}, - {0x0f007098, 0x00000000}, - {0x0F0070C8, 0x00000104}, - {0x0F007018, 0x01010000} -}; - - -#define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 7 // index for 0x0F007000 -static DDR_SET_NODE asT3LPB_DDRSetting133MHz[]= {// # DPLL Clock Setting - {0x0f000820, 0x03F1365B}, - {0x0f000810, 0x00002F95}, - {0x0f000880, 0x000003DD}, - // Changed source for Xbar and MIPS clock to APLL - {0x0f000840, 0x0FFF0000}, - {0x0f000860, 0x00000000}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0f003050, 0x00000021}, // nvm clock divisor set the flash clock to 20 MHz - {0x0F00a084, 0x1Cffffff}, // dump from here in internal memory - {0x0F00a080, 0x1C000000}, - {0x0F00A000, 0x00000016}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01010100}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020001}, // POP - 0x00020001 Normal 0x01020001 - {0x0F007020, 0x04030107}, // Normal - 0x04030107 POP - 0x05030107 - {0x0F007024, 0x02000007}, - {0x0F007028, 0x02020200}, - {0x0F00702c, 0x0206060a}, // ROB- 0x0205050a, 0x0206060a - {0x0F007030, 0x05000000}, - {0x0F007034, 0x00000003}, - {0x0F007038, 0x190a0200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 - {0x0F00703C, 0x02101017}, // ROB - 0x02101010, 0x02101018, - {0x0F007040, 0x45171200}, // ROB - 0x45751200, 0x450f1200, - {0x0F007044, 0x11290D00}, // ROB - 0x110a0d00, 0x111f0d00 - {0x0F007048, 0x04080306}, - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0100001c}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x0010245F}, - {0x0F007064, 0x00000010}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00007000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - {0x0F007088, 0x01000001}, - {0x0F00708c, 0x00000101}, - {0x0F007090, 0x00000000}, - // Enable BW improvement within memory controller - {0x0F007094, 0x00040000}, - {0x0F007098, 0x00000000}, - {0x0F0070c8, 0x00000104}, - // Enable 2 ports within Xbar - // Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -#define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 8 // index for 0x0F007000 -static DDR_SET_NODE asT3LPB_DDRSetting100MHz[]= {// # DPLL Clock Setting - {0x0f000810, 0x00002F95}, - {0x0f000820, 0x03F1369B}, - {0x0f000840, 0x0fff0000}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - // Changed source for Xbar and MIPS clock to APLL - {0x0f000840, 0x0FFF0000}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0f003050, 0x00000021}, // nvm clock divisor set the flash clock to 20 MHz - {0x0F00a084, 0x1Cffffff}, // dump from here in internal memory - {0x0F00a080, 0x1C000000}, - // Memcontroller Default values - {0x0F007000, 0x00010001}, - {0x0F007004, 0x01010100}, - {0x0F007008, 0x01000001}, - {0x0F00700c, 0x00000000}, - {0x0F007010, 0x01000000}, - {0x0F007014, 0x01000100}, - {0x0F007018, 0x01000000}, - {0x0F00701c, 0x01020000}, // POP - 0x00020001 Normal 0x01020001 - {0x0F007020, 0x04020107}, // Normal - 0x04030107 POP - 0x05030107 - {0x0F007024, 0x00000007}, - {0x0F007028, 0x01020200}, - {0x0F00702c, 0x0204040a}, // ROB- 0x0205050a, 0x0206060a - {0x0F007030, 0x06000000}, - {0x0F007034, 0x00000004}, - {0x0F007038, 0x1F080200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 - {0x0F00703C, 0x0203031F}, // ROB - 0x02101010, 0x02101018, - {0x0F007040, 0x6e001200}, // ROB - 0x45751200, 0x450f1200, - {0x0F007044, 0x011a0a00}, // ROB - 0x110a0d00, 0x111f0d00 - {0x0F007048, 0x03000305}, - {0x0F00704c, 0x00000000}, - {0x0F007050, 0x0100001c}, - {0x0F007054, 0x00000000}, - {0x0F007058, 0x00000000}, - {0x0F00705c, 0x00000000}, - {0x0F007060, 0x00082ED6}, - {0x0F007064, 0x0000000A}, - {0x0F007068, 0x00000000}, - {0x0F00706c, 0x00000001}, - {0x0F007070, 0x00005000}, - {0x0F007074, 0x00000000}, - {0x0F007078, 0x00000000}, - {0x0F00707C, 0x00000000}, - {0x0F007080, 0x00000000}, - {0x0F007084, 0x00000000}, - {0x0F007088, 0x01000001}, - {0x0F00708c, 0x00000101}, - {0x0F007090, 0x00000000}, - {0x0F007094, 0x00010000}, - {0x0F007098, 0x00000000}, - {0x0F0070C8, 0x00000104}, - // # Enable 2 ports within Xbar - {0x0F00A000, 0x00000016}, - // # Enable start bit within memory controller - {0x0F007018, 0x01010000} -}; - - -#define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 7 // index for 0x0F007000 -static DDR_SET_NODE asT3LPB_DDRSetting80MHz[]= {// DPLL Clock Setting - {0x0f000820, 0x07F13FFF}, - {0x0f000810, 0x00002F95}, - {0x0f000860, 0x00000000}, - {0x0f000880, 0x000003DD}, - {0x0f000840, 0x0FFF1F00}, - {0x0F00a044, 0x1fffffff}, - {0x0F00a040, 0x1f000000}, - {0x0f003050, 0x00000021}, // nvm clock divisor set the flash clock to 20 MHz - {0x0F00a084, 0x1Cffffff}, // dump from here in internal memory - {0x0F00a080, 0x1C000000}, - {0x0F00A000, 0x00000016}, - {0x0f007000, 0x00010001}, - {0x0f007004, 0x01000000}, - {0x0f007008, 0x01000001}, - {0x0f00700c, 0x00000000}, - {0x0f007010, 0x01000000}, - {0x0f007014, 0x01000100}, - {0x0f007018, 0x01000000}, - {0x0f00701c, 0x01020000}, - {0x0f007020, 0x04020107}, - {0x0f007024, 0x00000007}, - {0x0f007028, 0x02020200}, - {0x0f00702c, 0x0204040a}, - {0x0f007030, 0x04000000}, - {0x0f007034, 0x00000002}, - {0x0f007038, 0x1d060200}, - {0x0f00703c, 0x1c22221d}, - {0x0f007040, 0x8A116600}, - {0x0f007044, 0x222d0800}, - {0x0f007048, 0x02690204}, - {0x0f00704c, 0x00000000}, - {0x0f007050, 0x0100001c}, - {0x0f007054, 0x00000000}, - {0x0f007058, 0x00000000}, - {0x0f00705c, 0x00000000}, - {0x0f007060, 0x000A15D6}, - {0x0f007064, 0x0000000A}, - {0x0f007068, 0x00000000}, - {0x0f00706c, 0x00000001}, - {0x0f007070, 0x00004000}, - {0x0f007074, 0x00000000}, - {0x0f007078, 0x00000000}, - {0x0f00707c, 0x00000000}, - {0x0f007080, 0x00000000}, - {0x0f007084, 0x00000000}, - {0x0f007088, 0x01000001}, - {0x0f00708c, 0x00000101}, - {0x0f007090, 0x00000000}, - {0x0f007094, 0x00010000}, - {0x0f007098, 0x00000000}, - {0x0F0070C8, 0x00000104}, - {0x0F007018, 0x01010000} -}; - - -#endif // _USB_BECEEM_DDR_H_ - +#endif /* _USB_BECEEM_DDR_H_ */ diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDRTiming.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDRTiming.h new file mode 100644 index 0000000000..194143f01f --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDDRTiming.h @@ -0,0 +1,849 @@ +/* + * Beceem WiMax USB Driver. + * Copyright (c) 2010 Alexander von Gluck + * Distributed under the terms of the GNU General Public License. + * + * Based on GPL code developed by: Beceem Communications Pvt. Ltd + * + * Description: Beceem DDR memory timings + */ +#ifndef _USB_BECEEM_DDR_TIMING_H_ +#define _USB_BECEEM_DDR_TIMING_H_ + + +#include +#include "DeviceStruct.h" + + +#define DDR_DUMP_INTERNAL_DEVICE_MEMORY 0xBFC02B00 +#define MIPS_CLOCK_REG 0x0f000820 + +#define MIPS_200_MHZ 0 +#define MIPS_160_MHZ 1 +#define PLL_800_MHZ 0 +#define PLL_266_MHZ 1 + +#define DDR_80_MHZ 0 +#define DDR_100_MHZ 1 +#define DDR_120_MHZ 2 // Additional Frequency for T3LP +#define DDR_133_MHZ 3 +#define DDR_140_MHZ 4 // Not Used (Reserved for future) +#define DDR_160_MHZ 5 // Additional Frequency for T3LP +#define DDR_180_MHZ 6 // Not Used (Reserved for future) +#define DDR_200_MHZ 7 // Not Used (Reserved for future) + + +/* + * DDR Power modes + */ +typedef enum ePMU_MODES +{ + HYBRID_MODE_7C = 0, + INTERNAL_MODE_6 = 1, + HYBRID_MODE_6 = 2 +}PMU_MODE; + + +/* + * DDR Init maps, taken from Beceem GPL Linux Driver + */ +typedef struct _DDR_SETTING +{ + unsigned long ulRegAddress; + unsigned long ulRegValue; +} DDR_SETTING, *PDDR_SETTING; + + +typedef DDR_SETTING DDR_SET_NODE, *PDDR_SET_NODE; + + +// DDR INIT 133Mhz +#define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12 // index for 0x0F007000 +static DDR_SET_NODE asT3_DDRSetting133MHz[]= {// DPLL Clock Setting + {0x0F000800, 0x00007212}, + {0x0f000820, 0x07F13FFF}, + {0x0f000810, 0x00000F95}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + // Changed source for Xbar and MIPS clock to APLL + {0x0f000840, 0x0FFF1B00}, + {0x0f000870, 0x00000002}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00a04C, 0x0000000C}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001}, // POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04030107}, // Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x02000007}, + {0x0F007028, 0x02020202}, + {0x0F00702c, 0x0206060a}, // ROB - 0x0205050a, 0x0206060a + {0x0F007030, 0x05000000}, + {0x0F007034, 0x00000003}, + {0x0F007038, 0x110a0200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 + {0x0F00703C, 0x02101010}, // ROB - 0x02101010, 0x02101018}, + {0x0F007040, 0x45751200}, // ROB - 0x45751200, 0x450f1200}, + {0x0F007044, 0x110a0d00}, // ROB - 0x110a0d00, 0x111f0d00 + {0x0F007048, 0x081b0306}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0000001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x0010246c}, + {0x0F007064, 0x00000010}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00007000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + // # Enable BW improvement within memory controller + {0x0F007094, 0x00000104}, + // # Enable 2 ports within Xbar + {0x0F00A000, 0x00000016}, + // # Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +// 80Mhz +#define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10 // index for 0x0F007000 +static DDR_SET_NODE asT3_DDRSetting80MHz[]= {// DPLL Clock Setting + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07f1ffff}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00a000, 0x00000016}, + {0x0F00a04C, 0x0000000C}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01000000}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000}, + {0x0F007020, 0x04020107}, + {0x0F007024, 0x00000007}, + {0x0F007028, 0x02020201}, + {0x0F00702c, 0x0204040a}, + {0x0F007030, 0x04000000}, + {0x0F007034, 0x00000002}, + {0x0F007038, 0x1F060200}, + {0x0F00703C, 0x1C22221F}, + {0x0F007040, 0x8A006600}, + {0x0F007044, 0x221a0800}, + {0x0F007048, 0x02690204}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0000001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x000A15D6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00004000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007094, 0x00000104}, + // Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +// 100Mhz +#define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13 // index for 0x0F007000 +static DDR_SET_NODE asT3_DDRSetting100MHz[]= {// DPLL Clock Setting + {0x0F000800, 0x00007008}, + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07F13E3F}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + // Changed source for Xbar and MIPS clock to APLL + // 0x0f000840, 0x0FFF1800, + {0x0f000840, 0x0FFF1B00}, + {0x0f000870, 0x00000002}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00a04C, 0x0000000C}, + // Enable 2 ports within Xbar + {0x0F00A000, 0x00000016}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001}, // POP - 0x00020000 Normal 0x01020000 + {0x0F007020, 0x04020107}, // Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x00000007}, + {0x0F007028, 0x01020201}, + {0x0F00702c, 0x0204040A}, + {0x0F007030, 0x06000000}, + {0x0F007034, 0x00000004}, + {0x0F007038, 0x20080200}, + {0x0F00703C, 0x02030320}, + {0x0F007040, 0x6E7F1200}, + {0x0F007044, 0x01190A00}, + {0x0F007048, 0x06120305}, // 0x02690204 // 0x06120305 + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0000001C}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x00082ED6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00005000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + // Enable BW improvement within memory controller + {0x0F007094, 0x00000104}, + // Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +// Net T3B DDR Settings +// DDR INIT 133Mhz +static DDR_SET_NODE asDPLL_266MHZ[] = { + {0x0F000800, 0x00007212}, + {0x0f000820, 0x07F13FFF}, + {0x0f000810, 0x00000F95}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + // Changed source for X - bar and MIPS clock to APLL + {0x0f000840, 0x0FFF1B00}, + {0x0f000870, 0x00000002} +}; + + +#if 0 +static DDR_SET_NODE asDPLL_800MHZ[] = { + {0x0f000810, 0x00000F95}, + {0x0f000810, 0x00000F95}, + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x03F1365B}, + {0x0f000840, 0x0FFF0000}, + {0x0f000880, 0x000003DD}, + {0x0f000860, 0x00000000} +}; +#endif + + +#define T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 11 // index for 0x0F007000 +static DDR_SET_NODE asT3B_DDRSetting133MHz[] = {// DPLL Clock Setting + {0x0f000810, 0x00000F95}, + {0x0f000810, 0x00000F95}, + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07F13652}, + {0x0f000840, 0x0FFF0800}, + // Changed source for Xbar and MIPS clock to APLL + {0x0f000880, 0x000003DD}, + {0x0f000860, 0x00000000}, + // Changed source for Xbar and MIPS clock to APLL + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + // Enable 2 ports within Xbar + {0x0F00A000, 0x00000016}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001}, // POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04030107}, // Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x02000007}, + {0x0F007028, 0x02020202}, + {0x0F00702c, 0x0206060a}, // ROB- 0x0205050a, 0x0206060a + {0x0F007030, 0x05000000}, + {0x0F007034, 0x00000003}, + {0x0F007038, 0x130a0200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 + {0x0F00703C, 0x02101012}, // ROB - 0x02101010, 0x02101018}, + {0x0F007040, 0x457D1200}, // ROB - 0x45751200, 0x450f1200}, + {0x0F007044, 0x11130d00}, // ROB - 0x110a0d00, 0x111f0d00 + {0x0F007048, 0x040D0306}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0000001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x0010246c}, + {0x0F007064, 0x00000012}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00007000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + // # Enable BW improvement within memory controller + {0x0F007094, 0x00000104}, + // # Enable start bit within memory controller + {0x0F007018, 0x01010000}, +}; + + +#define T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 // index for 0x0F007000 +static DDR_SET_NODE asT3B_DDRSetting80MHz[] = {// DPLL Clock Setting + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07F13FFF}, + {0x0f000840, 0x0FFF1F00}, + {0x0f000880, 0x000003DD}, + {0x0f000860, 0x00000000}, + + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00a000, 0x00000016}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01000000}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000}, + {0x0F007020, 0x04020107}, + {0x0F007024, 0x00000007}, + {0x0F007028, 0x02020201}, + {0x0F00702c, 0x0204040a}, + {0x0F007030, 0x04000000}, + {0x0F007034, 0x02000002}, + {0x0F007038, 0x1F060202}, + {0x0F00703C, 0x1C22221F}, + {0x0F007040, 0x8A006600}, + {0x0F007044, 0x221a0800}, + {0x0F007048, 0x02690204}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x000A15D6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00004000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007094, 0x00000104}, + // Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +// 100Mhz +#define T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 9 // index for 0x0F007000 +static DDR_SET_NODE asT3B_DDRSetting100MHz[] = {// DPLL Clock Setting + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07F1369B}, + {0x0f000840, 0x0FFF0800}, + {0x0f000880, 0x000003DD}, + {0x0f000860, 0x00000000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + // Enable 2 ports within Xbar + {0x0F00A000, 0x00000016}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000}, // POP - 0x00020000 Normal 0x01020000 + {0x0F007020, 0x04020107}, // Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x00000007}, + {0x0F007028, 0x01020201}, + {0x0F00702c, 0x0204040A}, + {0x0F007030, 0x06000000}, + {0x0F007034, 0x02000004}, + {0x0F007038, 0x20080200}, + {0x0F00703C, 0x02030320}, + {0x0F007040, 0x6E7F1200}, + {0x0F007044, 0x01190A00}, + {0x0F007048, 0x06120305}, // 0x02690204 // 0x06120305 + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001C}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x00082ED6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00005000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + // # Enable BW improvement within memory controller + {0x0F007094, 0x00000104}, + // # Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +#define T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 9 // index for 0x0F007000 +static DDR_SET_NODE asT3LP_DDRSetting133MHz[] = {// DPLL Clock Setting + {0x0f000820, 0x03F1365B}, + {0x0f000810, 0x00002F95}, + {0x0f000880, 0x000003DD}, + // Changed source for Xbar and MIPS clock to APLL + {0x0f000840, 0x0FFF0000}, + {0x0f000860, 0x00000000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001}, // POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04030107}, // Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x02000007}, + {0x0F007028, 0x02020200}, + {0x0F00702c, 0x0206060a}, // ROB - 0x0205050a, 0x0206060a + {0x0F007030, 0x05000000}, + {0x0F007034, 0x00000003}, + {0x0F007038, 0x200a0200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 + {0x0F00703C, 0x02101020}, // ROB - 0x02101010, 0x02101018, + {0x0F007040, 0x45711200}, // ROB - 0x45751200, 0x450f1200, + {0x0F007044, 0x110D0D00}, // ROB - 0x110a0d00, 0x111f0d00 + {0x0F007048, 0x04080306}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x0010245F}, + {0x0F007064, 0x00000010}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00007000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007088, 0x01000001}, + {0x0F00708c, 0x00000101}, + {0x0F007090, 0x00000000}, + // Enable BW improvement within memory controller + {0x0F007094, 0x00040000}, + {0x0F007098, 0x00000000}, + {0x0F0070c8, 0x00000104}, + // Enable 2 ports within Xbar + // Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +#define T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 11 // index for 0x0F007000 +static DDR_SET_NODE asT3LP_DDRSetting100MHz[]= {// # DPLL Clock Setting + {0x0f000810, 0x00002F95}, + {0x0f000820, 0x03F1369B}, + {0x0f000840, 0x0fff0000}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + // Changed source for Xbar and MIPS clock to APLL + {0x0f000840, 0x0FFF0000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000}, // POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04020107}, // Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x00000007}, + {0x0F007028, 0x01020200}, + {0x0F00702c, 0x0204040a}, // ROB- 0x0205050a, 0x0206060a + {0x0F007030, 0x06000000}, + {0x0F007034, 0x00000004}, + {0x0F007038, 0x1F080200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 + {0x0F00703C, 0x0203031F}, // ROB - 0x02101010, 0x02101018, + {0x0F007040, 0x6e001200}, // ROB - 0x45751200, 0x450f1200, + {0x0F007044, 0x011a0a00}, // ROB - 0x110a0d00, 0x111f0d00 + {0x0F007048, 0x03000305}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x00082ED6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00005000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007088, 0x01000001}, + {0x0F00708c, 0x00000101}, + {0x0F007090, 0x00000000}, + {0x0F007094, 0x00010000}, + {0x0F007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, + // Enable 2 ports within Xbar + {0x0F00A000, 0x00000016}, + // Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +#define T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 // index for 0x0F007000 +static DDR_SET_NODE asT3LP_DDRSetting80MHz[]= {// # DPLL Clock Setting + {0x0f000820, 0x07F13FFF}, + {0x0f000810, 0x00002F95}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0f000840, 0x0FFF1F00}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, + {0x0f007000, 0x00010001}, + {0x0f007004, 0x01000000}, + {0x0f007008, 0x01000001}, + {0x0f00700c, 0x00000000}, + {0x0f007010, 0x01000000}, + {0x0f007014, 0x01000100}, + {0x0f007018, 0x01000000}, + {0x0f00701c, 0x01020000}, + {0x0f007020, 0x04020107}, + {0x0f007024, 0x00000007}, + {0x0f007028, 0x02020200}, + {0x0f00702c, 0x0204040a}, + {0x0f007030, 0x04000000}, + {0x0f007034, 0x00000002}, + {0x0f007038, 0x1d060200}, + {0x0f00703c, 0x1c22221d}, + {0x0f007040, 0x8A116600}, + {0x0f007044, 0x222d0800}, + {0x0f007048, 0x02690204}, + {0x0f00704c, 0x00000000}, + {0x0f007050, 0x0100001c}, + {0x0f007054, 0x00000000}, + {0x0f007058, 0x00000000}, + {0x0f00705c, 0x00000000}, + {0x0f007060, 0x000A15D6}, + {0x0f007064, 0x0000000A}, + {0x0f007068, 0x00000000}, + {0x0f00706c, 0x00000001}, + {0x0f007070, 0x00004000}, + {0x0f007074, 0x00000000}, + {0x0f007078, 0x00000000}, + {0x0f00707c, 0x00000000}, + {0x0f007080, 0x00000000}, + {0x0f007084, 0x00000000}, + {0x0f007088, 0x01000001}, + {0x0f00708c, 0x00000101}, + {0x0f007090, 0x00000000}, + {0x0f007094, 0x00010000}, + {0x0f007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, + {0x0F007018, 0x01010000} +}; + + +// T3 LP-B (UMA-B) +#define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ 7 // index for 0x0F007000 +static DDR_SET_NODE asT3LPB_DDRSetting160MHz[]= {// # DPLL Clock Setting + {0x0f000820, 0x03F137DB}, + {0x0f000810, 0x01842795}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0f000840, 0x0FFF0400}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0f003050, 0x00000021}, // nvm clock divisor set the flash clock to 20 MHz + {0x0F00a084, 0x1Cffffff}, // Now dump from her in internal memory + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, + {0x0f007000, 0x00010001}, + {0x0f007004, 0x01000001}, + {0x0f007008, 0x01000101}, + {0x0f00700c, 0x00000000}, + {0x0f007010, 0x01000100}, + {0x0f007014, 0x01000100}, + {0x0f007018, 0x01000000}, + {0x0f00701c, 0x01020000}, + {0x0f007020, 0x04030107}, + {0x0f007024, 0x02000007}, + {0x0f007028, 0x02020200}, + {0x0f00702c, 0x0206060a}, + {0x0f007030, 0x050d0d00}, + {0x0f007034, 0x00000003}, + {0x0f007038, 0x170a0200}, + {0x0f00703c, 0x02101012}, + {0x0f007040, 0x45161200}, + {0x0f007044, 0x11250c00}, + {0x0f007048, 0x04da0307}, + {0x0f00704c, 0x00000000}, + {0x0f007050, 0x0000001c}, + {0x0f007054, 0x00000000}, + {0x0f007058, 0x00000000}, + {0x0f00705c, 0x00000000}, + {0x0f007060, 0x00142bb6}, + {0x0f007064, 0x20430014}, + {0x0f007068, 0x00000000}, + {0x0f00706c, 0x00000001}, + {0x0f007070, 0x00009000}, + {0x0f007074, 0x00000000}, + {0x0f007078, 0x00000000}, + {0x0f00707c, 0x00000000}, + {0x0f007080, 0x00000000}, + {0x0f007084, 0x00000000}, + {0x0f007088, 0x01000001}, + {0x0f00708c, 0x00000101}, + {0x0f007090, 0x00000000}, + {0x0f007094, 0x00040000}, + {0x0f007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, + {0x0F007018, 0x01010000} +}; + + +#define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 7 // index for 0x0F007000 +static DDR_SET_NODE asT3LPB_DDRSetting133MHz[]= {// # DPLL Clock Setting + {0x0f000820, 0x03F1365B}, + {0x0f000810, 0x00002F95}, + {0x0f000880, 0x000003DD}, + // Changed source for Xbar and MIPS clock to APLL + {0x0f000840, 0x0FFF0000}, + {0x0f000860, 0x00000000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0f003050, 0x00000021}, // nvm clock divisor set the flash clock to 20 MHz + {0x0F00a084, 0x1Cffffff}, // dump from here in internal memory + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001}, // POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04030107}, // Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x02000007}, + {0x0F007028, 0x02020200}, + {0x0F00702c, 0x0206060a}, // ROB- 0x0205050a, 0x0206060a + {0x0F007030, 0x05000000}, + {0x0F007034, 0x00000003}, + {0x0F007038, 0x190a0200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 + {0x0F00703C, 0x02101017}, // ROB - 0x02101010, 0x02101018, + {0x0F007040, 0x45171200}, // ROB - 0x45751200, 0x450f1200, + {0x0F007044, 0x11290D00}, // ROB - 0x110a0d00, 0x111f0d00 + {0x0F007048, 0x04080306}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x0010245F}, + {0x0F007064, 0x00000010}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00007000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007088, 0x01000001}, + {0x0F00708c, 0x00000101}, + {0x0F007090, 0x00000000}, + // Enable BW improvement within memory controller + {0x0F007094, 0x00040000}, + {0x0F007098, 0x00000000}, + {0x0F0070c8, 0x00000104}, + // Enable 2 ports within Xbar + // Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +#define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 8 // index for 0x0F007000 +static DDR_SET_NODE asT3LPB_DDRSetting100MHz[]= {// # DPLL Clock Setting + {0x0f000810, 0x00002F95}, + {0x0f000820, 0x03F1369B}, + {0x0f000840, 0x0fff0000}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + // Changed source for Xbar and MIPS clock to APLL + {0x0f000840, 0x0FFF0000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0f003050, 0x00000021}, // nvm clock divisor set the flash clock to 20 MHz + {0x0F00a084, 0x1Cffffff}, // dump from here in internal memory + {0x0F00a080, 0x1C000000}, + // Memcontroller Default values + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000}, // POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04020107}, // Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x00000007}, + {0x0F007028, 0x01020200}, + {0x0F00702c, 0x0204040a}, // ROB- 0x0205050a, 0x0206060a + {0x0F007030, 0x06000000}, + {0x0F007034, 0x00000004}, + {0x0F007038, 0x1F080200}, // ROB - 0x110a0200, 0x180a0200, 0x1f0a0200 + {0x0F00703C, 0x0203031F}, // ROB - 0x02101010, 0x02101018, + {0x0F007040, 0x6e001200}, // ROB - 0x45751200, 0x450f1200, + {0x0F007044, 0x011a0a00}, // ROB - 0x110a0d00, 0x111f0d00 + {0x0F007048, 0x03000305}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x00082ED6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00005000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007088, 0x01000001}, + {0x0F00708c, 0x00000101}, + {0x0F007090, 0x00000000}, + {0x0F007094, 0x00010000}, + {0x0F007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, + // # Enable 2 ports within Xbar + {0x0F00A000, 0x00000016}, + // # Enable start bit within memory controller + {0x0F007018, 0x01010000} +}; + + +#define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 7 // index for 0x0F007000 +static DDR_SET_NODE asT3LPB_DDRSetting80MHz[]= {// DPLL Clock Setting + {0x0f000820, 0x07F13FFF}, + {0x0f000810, 0x00002F95}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0f000840, 0x0FFF1F00}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0f003050, 0x00000021}, // nvm clock divisor set the flash clock to 20 MHz + {0x0F00a084, 0x1Cffffff}, // dump from here in internal memory + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, + {0x0f007000, 0x00010001}, + {0x0f007004, 0x01000000}, + {0x0f007008, 0x01000001}, + {0x0f00700c, 0x00000000}, + {0x0f007010, 0x01000000}, + {0x0f007014, 0x01000100}, + {0x0f007018, 0x01000000}, + {0x0f00701c, 0x01020000}, + {0x0f007020, 0x04020107}, + {0x0f007024, 0x00000007}, + {0x0f007028, 0x02020200}, + {0x0f00702c, 0x0204040a}, + {0x0f007030, 0x04000000}, + {0x0f007034, 0x00000002}, + {0x0f007038, 0x1d060200}, + {0x0f00703c, 0x1c22221d}, + {0x0f007040, 0x8A116600}, + {0x0f007044, 0x222d0800}, + {0x0f007048, 0x02690204}, + {0x0f00704c, 0x00000000}, + {0x0f007050, 0x0100001c}, + {0x0f007054, 0x00000000}, + {0x0f007058, 0x00000000}, + {0x0f00705c, 0x00000000}, + {0x0f007060, 0x000A15D6}, + {0x0f007064, 0x0000000A}, + {0x0f007068, 0x00000000}, + {0x0f00706c, 0x00000001}, + {0x0f007070, 0x00004000}, + {0x0f007074, 0x00000000}, + {0x0f007078, 0x00000000}, + {0x0f00707c, 0x00000000}, + {0x0f007080, 0x00000000}, + {0x0f007084, 0x00000000}, + {0x0f007088, 0x01000001}, + {0x0f00708c, 0x00000101}, + {0x0f007090, 0x00000000}, + {0x0f007094, 0x00010000}, + {0x0f007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, + {0x0F007018, 0x01010000} +}; + + +#endif // _USB_BECEEM_DDR_TIMING_H_ + diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.cpp index 00d6b3dd89..314369fb92 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.cpp +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.cpp @@ -47,7 +47,7 @@ public: status_t -BeceemDevice::ReadRegister(unsigned int reg, size_t size, uint32_t* buffer) +BeceemDevice::ReadRegister(uint32 reg, size_t size, uint32* buffer) { USBSmartLock USBSubsystemLock; // released on exit @@ -92,7 +92,7 @@ BeceemDevice::ReadRegister(unsigned int reg, size_t size, uint32_t* buffer) status_t -BeceemDevice::WriteRegister(unsigned int reg, size_t size, uint32_t* buffer) +BeceemDevice::WriteRegister(uint32 reg, size_t size, uint32* buffer) { USBSmartLock USBSubsystemLock; // released on exit @@ -139,8 +139,8 @@ BeceemDevice::WriteRegister(unsigned int reg, size_t size, uint32_t* buffer) status_t -BeceemDevice::BizarroReadRegister(unsigned int reg, size_t size, - uint32_t* buffer) +BeceemDevice::BizarroReadRegister(uint32 reg, size_t size, + uint32* buffer) { // NET_TO_HOST long @@ -154,12 +154,12 @@ BeceemDevice::BizarroReadRegister(unsigned int reg, size_t size, status_t -BeceemDevice::BizarroWriteRegister(unsigned int reg, size_t size, - uint32_t* buffer) +BeceemDevice::BizarroWriteRegister(uint32 reg, size_t size, + uint32* buffer) { // HOST_TO_NET long - volatile uint32_t reload = *buffer; + volatile uint32 reload = *buffer; convertEndian(true, size, buffer); @@ -577,7 +577,7 @@ status_t BeceemDevice::IdentifyChipset() { - if (BizarroReadRegister(CHIP_ID_REG, sizeof(unsigned int), + if (BizarroReadRegister(CHIP_ID_REG, sizeof(uint32), &pwmxdevice->deviceChipID) != B_OK) { TRACE_ALWAYS("Error: Beceem device identification read failure\n"); @@ -647,7 +647,7 @@ BeceemDevice::SetupDevice(bool deviceReplugged) return B_ERROR; if (pwmxdevice->deviceChipID >= T3LPB) { - unsigned int value = 0; + uint32 value = 0; BizarroReadRegister(SYS_CFG, sizeof(value), &value); pwmxdevice->syscfgBefFw = value; if ((value & 0x60) == 0) { @@ -689,12 +689,12 @@ BeceemDevice::SetupDevice(bool deviceReplugged) if (pwmxdevice->nvmVerMajor < 5) { TRACE("Debug: VerMajor < 5 PARAM pointer\n"); NVMRead(GPIO_PARAM_POINTER, 2, - (unsigned int*)&pwmxdevice->hwParamPtr); + (uint32*)&pwmxdevice->hwParamPtr); pwmxdevice->hwParamPtr = ntohs(pwmxdevice->hwParamPtr); } else { TRACE("Debug: VerMajor 5+ PARAM pointer\n"); NVMRead(GPIO_PARAM_POINTER_MAP5, 4, - (unsigned int*)&pwmxdevice->hwParamPtr); + (uint32*)&pwmxdevice->hwParamPtr); // TODO : NVM : validate v5+ nvm params a-la ValidateDSDParamsChecksum pwmxdevice->hwParamPtr = ntohl(pwmxdevice->hwParamPtr); } @@ -714,7 +714,7 @@ BeceemDevice::SetupDevice(bool deviceReplugged) dwReadValue = dwReadValue + GPIO_START_OFFSET; // add GPIO start offset - NVMRead(dwReadValue, 32, (uint32_t*)&pwmxdevice->gpioInfo); + NVMRead(dwReadValue, 32, (uint32*)&pwmxdevice->gpioInfo); // populate for LED information ValidateDSD(pwmxdevice->hwParamPtr); @@ -1010,7 +1010,7 @@ BeceemDevice::LoadConfig() size_t file_size = cfgStat.st_size; - unsigned int* buffer = (unsigned int*)malloc(MAX_USB_TRANSFER); + uint32* buffer = (uint32*)malloc(MAX_USB_TRANSFER); if (buffer == NULL) { TRACE_ALWAYS("Error: Memory allocation error.\n"); @@ -1103,7 +1103,7 @@ BeceemDevice::DumpConfig() status_t -BeceemDevice::PushConfig(unsigned int loc) +BeceemDevice::PushConfig(uint32 loc) { int fh = open(FIRM_CFG, O_RDONLY); @@ -1117,7 +1117,7 @@ BeceemDevice::PushConfig(unsigned int loc) TRACE_ALWAYS("Info: Vendor configuration to be pushed to 0x%x on device.\n", loc); - unsigned int* buffer = (unsigned int*)malloc(MAX_USB_TRANSFER); + uint32* buffer = (uint32*)malloc(MAX_USB_TRANSFER); if (!buffer) { TRACE_ALWAYS("Error: Memory allocation error.\n"); @@ -1175,7 +1175,7 @@ BeceemDevice::PushConfig(unsigned int loc) status_t -BeceemDevice::PushFirmware(unsigned int loc) +BeceemDevice::PushFirmware(uint32 loc) { int fh = open(FIRM_BIN, O_RDONLY); @@ -1195,7 +1195,7 @@ BeceemDevice::PushFirmware(unsigned int loc) file_size, loc); // For the push we load the file into the buffer - unsigned int* buffer = (unsigned int*)malloc(MAX_USB_TRANSFER); + uint32* buffer = (uint32*)malloc(MAX_USB_TRANSFER); if (!buffer) { TRACE_ALWAYS("Error: Memory allocation error.\n"); diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.h index ec92ef2dc0..6c295bf194 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.h +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemDevice.h @@ -58,22 +58,22 @@ virtual ~BeceemDevice(); status_t Control(uint32 op, void *buffer, size_t length); status_t LoadConfig(); void DumpConfig(); - status_t PushConfig(unsigned int loc); - status_t PushFirmware(unsigned int loc); + status_t PushConfig(uint32 loc); + status_t PushFirmware(uint32 loc); void Removed(); status_t CompareAndReattach(usb_device device); virtual status_t SetupDevice(bool deviceReplugged); - status_t ReadRegister(unsigned int reg, - size_t size, uint32_t* buffer); - status_t WriteRegister(unsigned int reg, - size_t size, uint32_t* buffer); - status_t BizarroReadRegister(unsigned int reg, - size_t size, uint32_t* buffer); - status_t BizarroWriteRegister(unsigned int reg, - size_t size, uint32_t* buffer); + status_t ReadRegister(uint32 reg, + size_t size, uint32* buffer); + status_t WriteRegister(uint32 reg, + size_t size, uint32* buffer); + status_t BizarroReadRegister(uint32 reg, + size_t size, uint32* buffer); + status_t BizarroWriteRegister(uint32 reg, + size_t size, uint32* buffer); private: static void _ReadCallback(void *cookie, int32 status, diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.cpp index 7451ef2bf8..1933486d9f 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.cpp +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.cpp @@ -27,21 +27,18 @@ BeceemLED::LEDInit(WIMAX_DEVICE* wmxdevice) { pwmxdevice = wmxdevice; - uint8_t GPIO_Array[NUM_OF_LEDS+1]; - unsigned char ucIndex = 0; - uint32_t uiIndex = 0; - unsigned char* puCFGData = NULL; - unsigned char bData = 0; + uint8 GPIO_Array[NUM_OF_LEDS + 1]; + uint8 ucIndex = 0; + uint32 uiIndex = 0; - memset(GPIO_Array, GPIO_DISABLE_VAL, NUM_OF_LEDS+1); + memset(GPIO_Array, GPIO_DISABLE_VAL, NUM_OF_LEDS + 1); TRACE("Debug: Raw GPIO information: 0x%x\n", pwmxdevice->gpioInfo); snooze(500000); if (pwmxdevice->deviceChipID == 0xbece0120 - || pwmxdevice->deviceChipID == 0xbece0121) - { + || pwmxdevice->deviceChipID == 0xbece0121) { /*Hardcode the values of GPIO numbers for ASIC board.*/ GPIO_Array[RED_LED] = 2; GPIO_Array[BLUE_LED] = 3; @@ -49,29 +46,27 @@ BeceemLED::LEDInit(WIMAX_DEVICE* wmxdevice) GPIO_Array[GREEN_LED] = 4; } else { // for all possible GPIO pins... - for (ucIndex = 0; ucIndex < 32; ucIndex++) - { - switch(pwmxdevice->gpioInfo[ucIndex]) - { + for (ucIndex = 0; ucIndex < 32; ucIndex++) { + switch(pwmxdevice->gpioInfo[ucIndex]) { case RED_LED: TRACE("Debug: GPIO: %d found RED_LED!\n", ucIndex); GPIO_Array[RED_LED] = ucIndex; - pwmxdevice->gpioBitMap |= (1<gpioBitMap |= (1 << ucIndex); break; case BLUE_LED: TRACE("Debug: GPIO: %d found BLUE_LED!\n", ucIndex); GPIO_Array[BLUE_LED] = ucIndex; - pwmxdevice->gpioBitMap |= (1<gpioBitMap |= (1 << ucIndex); break; case YELLOW_LED: TRACE("Debug: GPIO: %d found YELLOW_LED!\n", ucIndex); GPIO_Array[YELLOW_LED] = ucIndex; - pwmxdevice->gpioBitMap |= (1<gpioBitMap |= (1 << ucIndex); break; case GREEN_LED: TRACE("Debug: GPIO: %d found GREEN_LED!\n", ucIndex); GPIO_Array[GREEN_LED] = ucIndex; - pwmxdevice->gpioBitMap |= (1<gpioBitMap |= (1 << ucIndex); break; default: // TRACE("Debug: GPIO: %d found NO_LED!\n", ucIndex); @@ -84,15 +79,14 @@ BeceemLED::LEDInit(WIMAX_DEVICE* wmxdevice) pwmxdevice->gpioBitMap); // Load GPIO configuration data from vendor config - puCFGData = (unsigned char *)&pwmxdevice->vendorcfg.HostDrvrConfig1; + uint8* puCFGData = (uint8*)&pwmxdevice->vendorcfg.HostDrvrConfig1; - for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) - { - bData = *puCFGData; + for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) { + + uint8 bData = *puCFGData; // Check Bit 8 for polarity. If it is set, polarity is reverse - if (bData & 0x80) - { + if (bData & 0x80) { pwmxdevice->LEDMap.LEDState[uiIndex].BitPolarity = 0; // unset bit 8 bData = bData & 0x7f; @@ -123,8 +117,7 @@ BeceemLED::LEDInit(WIMAX_DEVICE* wmxdevice) GPIOReset(); // Set all GPIO pins to off - for (uiIndex = 0; uiIndexLEDMap.LEDState[uiIndex].GPIO_Num != GPIO_DISABLE_VAL) { LEDOn(uiIndex); TRACE("Debug: LED[%d].LED_Type = %x\n", @@ -144,12 +137,12 @@ BeceemLED::LEDInit(WIMAX_DEVICE* wmxdevice) // Spawn LED monitor / blink thread - pwmxdevice->LEDThreadID = spawn_kernel_thread(LEDThread, - "usb_beceemwmx GPIO:LED", - B_NORMAL_PRIORITY, this); + pwmxdevice->LEDThreadID = spawn_kernel_thread(LEDThread, + "usb_beceemwmx GPIO:LED", B_NORMAL_PRIORITY, this); if (pwmxdevice->LEDThreadID < 1) { - TRACE("Error: Problem spawning LED Thread: %i\n", pwmxdevice->LEDThreadID); + TRACE("Error: Problem spawning LED Thread: %i\n", + pwmxdevice->LEDThreadID); return B_ERROR; } @@ -196,10 +189,9 @@ BeceemLED::LEDThreadTerminate() status_t BeceemLED::LightsOut() { - unsigned int uiIndex = 0; + uint32 uiIndex; - for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) - { + for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) { if (pwmxdevice->LEDMap.LEDState[uiIndex].GPIO_Num != GPIO_DISABLE_VAL) { LEDOff(uiIndex); } @@ -209,13 +201,11 @@ BeceemLED::LightsOut() status_t -BeceemLED::LEDOn(unsigned int index) +BeceemLED::LEDOn(uint32 index) { - status_t result; - uint32_t gpio_towrite = 0; - uint32_t uiResetValue = 0; + status_t result; - gpio_towrite = 1<LEDMap.LEDState[index].GPIO_Num; + uint32 gpio_towrite = 1 << pwmxdevice->LEDMap.LEDState[index].GPIO_Num; if (pwmxdevice->LEDMap.LEDState[index].BitPolarity == 0) result = BizarroWriteRegister(GPIO_OUTPUT_SET_REG, @@ -229,23 +219,22 @@ BeceemLED::LEDOn(unsigned int index) index, gpio_towrite, pwmxdevice->LEDMap.LEDState[index].GPIO_Num); } - uiResetValue = BizarroReadRegister(GPIO_MODE_REGISTER, + uint32 uiResetValue = BizarroReadRegister(GPIO_MODE_REGISTER, sizeof(uiResetValue), &uiResetValue); uiResetValue |= gpio_towrite; - BizarroWriteRegister(GPIO_MODE_REGISTER, sizeof(uiResetValue), &uiResetValue); + BizarroWriteRegister(GPIO_MODE_REGISTER, + sizeof(uiResetValue), &uiResetValue); return B_OK; } status_t -BeceemLED::LEDOff(unsigned int index) +BeceemLED::LEDOff(uint32 index) { - status_t result; - uint32_t gpio_towrite = 0; - uint32_t uiResetValue = 0; + status_t result; - gpio_towrite = 1<LEDMap.LEDState[index].GPIO_Num; + uint32 gpio_towrite = 1 << pwmxdevice->LEDMap.LEDState[index].GPIO_Num; if (pwmxdevice->LEDMap.LEDState[index].BitPolarity == 0) result = BizarroWriteRegister(GPIO_OUTPUT_CLR_REG, @@ -259,7 +248,7 @@ BeceemLED::LEDOff(unsigned int index) index, gpio_towrite, pwmxdevice->LEDMap.LEDState[index].GPIO_Num); } - uiResetValue = BizarroReadRegister(GPIO_MODE_REGISTER, + uint32 uiResetValue = BizarroReadRegister(GPIO_MODE_REGISTER, sizeof(uiResetValue), &uiResetValue); uiResetValue |= gpio_towrite; BizarroWriteRegister(GPIO_MODE_REGISTER, @@ -276,24 +265,21 @@ BeceemLED::LEDThread(void *cookie) BeceemLED *led = (BeceemLED *)cookie; // While the driver is active - while (!led->pwmxdevice->driverHalt) - { - unsigned int uiIndex = 0; - unsigned int uiLedIndex = 0; - bool blink = false; + while (!led->pwmxdevice->driverHalt) { + bool blink = false; // LED state changes will be at least 500ms apart snooze(500000); + uint32 uiIndex; + uint32 uiLedIndex = 0; // determine what the LED is doing in each state switch(led->pwmxdevice->driverState) { case STATE_FWPUSH: - for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) - { - if (led->pwmxdevice->LEDMap.LEDState[uiIndex].LED_Blink_State - & STATE_FWPUSH) - { + for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) { + if (led->pwmxdevice->LEDMap + .LEDState[uiIndex].LED_Blink_State & STATE_FWPUSH) { if (led->pwmxdevice->LEDMap.LEDState[uiIndex].GPIO_Num != GPIO_DISABLE_VAL) { uiLedIndex = uiIndex; @@ -304,11 +290,9 @@ BeceemLED::LEDThread(void *cookie) break; case STATE_NONET: - for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) - { + for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) { if (led->pwmxdevice->LEDMap.LEDState[uiIndex].LED_On_State - & STATE_NONET) - { + & STATE_NONET) { if (led->pwmxdevice->LEDMap.LEDState[uiIndex].GPIO_Num != GPIO_DISABLE_VAL) { uiLedIndex = uiIndex; diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.h index efa2bf2570..048f9baa81 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.h +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemLED.h @@ -20,25 +20,25 @@ public: BeceemLED(); status_t LEDInit(WIMAX_DEVICE* wmxdevice); status_t LEDThreadTerminate(); - status_t LEDOff(unsigned int index); - status_t LEDOn(unsigned int index); + status_t LEDOff(uint32 index); + status_t LEDOn(uint32 index); status_t LightsOut(); static status_t LEDThread(void *cookie); WIMAX_DEVICE* pwmxdevice; // yuck. These are in a parent class - virtual status_t ReadRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t ReadRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; - virtual status_t WriteRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t WriteRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; - virtual status_t BizarroReadRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t BizarroReadRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; - virtual status_t BizarroWriteRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t BizarroWriteRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; private: diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.cpp index 8e98119775..20446b83a9 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.cpp +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.cpp @@ -43,7 +43,7 @@ BeceemNVM::NVMInit(WIMAX_DEVICE* swmxdevice) unsigned short usNVMVersion = 0; - NVMRead(NVM_VERSION_OFFSET, 2, (unsigned int*)&usNVMVersion); + NVMRead(NVM_VERSION_OFFSET, 2, (uint32*)&usNVMVersion); pwmxdevice->nvmVerMinor = usNVMVersion&0xFF; pwmxdevice->nvmVerMajor = ((usNVMVersion>>8)&0xFF); @@ -62,7 +62,7 @@ BeceemNVM::NVMFlush() * But we get 0x00001122. */ TRACE("Debug: Fixing reset value on 0x0f003004\n"); - unsigned int value = NVM_READ_DATA_AVAIL; + uint32 value = NVM_READ_DATA_AVAIL; BizarroWriteRegister(NVM_SPI_Q_STATUS1_REG, sizeof(value), &value); /* Flush the all of the NVM queues. */ @@ -79,7 +79,7 @@ BeceemNVM::NVMFlush() status_t BeceemNVM::NVMDetect() { - unsigned int uiData = 0; + uint32 uiData = 0; EEPROMBulkRead(0x0, 4, &uiData); if (uiData == BECM) { @@ -111,7 +111,7 @@ BeceemNVM::NVMDetect() status_t -BeceemNVM::NVMChipSelect(unsigned int offset) +BeceemNVM::NVMChipSelect(uint32 offset) { int chipIndex = offset / FLASH_PART_SIZE; @@ -125,16 +125,16 @@ BeceemNVM::NVMChipSelect(unsigned int offset) // Migrate selected chip to new selection bSelectedChip = chipIndex; - unsigned int flashConfig = 0; + uint32 flashConfig = 0; BizarroReadRegister(FLASH_CONFIG_REG, 4, &flashConfig); - unsigned int gpioConfig = 0; + uint32 gpioConfig = 0; BizarroReadRegister(FLASH_GPIO_CONFIG_REG, 4, &gpioConfig); // TRACE("Reading GPIO config 0x%x\n", &GPIOConfig); // TRACE("Reading Flash config 0x%x\n", &FlashConfig); - unsigned int partitionNumber = 0; + uint32 partitionNumber = 0; switch (chipIndex) { case 0: partitionNumber = 0; @@ -175,12 +175,12 @@ BeceemNVM::NVMChipSelect(unsigned int offset) int -BeceemNVM::NVMRead(unsigned int offset, unsigned int size, unsigned int* buffer) +BeceemNVM::NVMRead(uint32 offset, uint32 size, uint32* buffer) { - unsigned int temp = 0; - unsigned int value = 0; + uint32 temp = 0; + uint32 value = 0; int status = 0; - unsigned int myOffset = 0; + uint32 myOffset = 0; if (pwmxdevice->nvmType == NVM_FLASH) { @@ -218,11 +218,11 @@ BeceemNVM::NVMRead(unsigned int offset, unsigned int size, unsigned int* buffer) int -BeceemNVM::NVMWrite(unsigned int offset, unsigned int size, - unsigned int* buffer) +BeceemNVM::NVMWrite(uint32 offset, uint32 size, + uint32* buffer) { - unsigned int temp = 0; - unsigned int value = 0; + uint32 temp = 0; + uint32 value = 0; int status = 0; if (pwmxdevice->nvmType == NVM_FLASH) { @@ -277,7 +277,7 @@ BeceemNVM::FlashGetBaseAddr() } -unsigned int +uint32 BeceemNVM::FlashGetSize() { // TODO : Check for Flash2X @@ -289,7 +289,7 @@ unsigned long BeceemNVM::FlashReadID() { // Read the ID from FLASH_CMD_READ_ID - unsigned int value = FLASH_CMD_READ_ID << 24; + uint32 value = FLASH_CMD_READ_ID << 24; BizarroWriteRegister(FLASH_SPI_CMDQ_REG, sizeof(value), &value); snooze(10); @@ -298,7 +298,7 @@ BeceemNVM::FlashReadID() // The ID is the first 3 bytes. unsigned long readQID = 0; BizarroReadRegister(FLASH_SPI_READQ_REG, sizeof(readQID), - (unsigned int*)&readQID); + (uint32*)&readQID); return readQID >> 8; } @@ -318,13 +318,13 @@ BeceemNVM::FlashReadCS() if (pwmxdevice->driverDDRinit == false) { - unsigned int value = FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; + uint32 value = FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; BizarroWriteRegister(0xAF00A080, sizeof(value), &value); } // CS Signature(4), Minor(2), Major(2) FlashBulkRead(pwmxdevice->nvmFlashCSStart, 8, - (unsigned int*)pwmxdevice->nvmFlashCSInfo); + (uint32*)pwmxdevice->nvmFlashCSInfo); pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion = ntohl(pwmxdevice->nvmFlashCSInfo->FlashLayoutVersion); @@ -349,7 +349,7 @@ BeceemNVM::FlashReadCS() { // device is older flash map FlashBulkRead(pwmxdevice->nvmFlashCSStart, sizeof(FLASH_CS_INFO), - (unsigned int*)pwmxdevice->nvmFlashCSInfo); + (uint32*)pwmxdevice->nvmFlashCSInfo); snooze(100); FlashCSFlip(pwmxdevice->nvmFlashCSInfo); FlashCSDump(pwmxdevice->nvmFlashCSInfo); @@ -495,8 +495,8 @@ BeceemNVM::FlashCSDump(PFLASH_CS_INFO FlashCSInfo) status_t -BeceemNVM::FlashBulkRead(unsigned int offset, unsigned int size, - unsigned int* buffer) +BeceemNVM::FlashBulkRead(uint32 offset, uint32 size, + uint32* buffer) { if (pwmxdevice->driverHalt == true) return -ENODEV; @@ -508,24 +508,24 @@ BeceemNVM::FlashBulkRead(unsigned int offset, unsigned int size, TRACE("Debug: About to read %d bytes from 0x%x \n", size, offset); - unsigned int workOffset = offset; // our scratch work offset - unsigned int bytesLeft = size; // counter holding bytes left - unsigned int outputOffset = 0; // where we are in the output + uint32 workOffset = offset; // our scratch work offset + uint32 bytesLeft = size; // counter holding bytes left + uint32 outputOffset = 0; // where we are in the output while (bytesLeft > 0) { NVMChipSelect(workOffset); - unsigned int partOffset = (workOffset & (FLASH_PART_SIZE - 1)) + uint32 partOffset = (workOffset & (FLASH_PART_SIZE - 1)) + FlashGetBaseAddr(); - unsigned int workBytes = MIN(MAX_RW_SIZE, bytesLeft); + uint32 workBytes = MIN(MAX_RW_SIZE, bytesLeft); // We read the max RW size or whats left TRACE("Debug: reading %d bytes from 0x%x to 0x%x (output offset %d)\n", workBytes, partOffset, partOffset + workBytes, outputOffset); if (ReadRegister(partOffset, workBytes, - (unsigned int*)((unsigned char*)buffer + outputOffset)) != B_OK) { + (uint32*)((unsigned char*)buffer + outputOffset)) != B_OK) { // I've only done this once before. TRACE_ALWAYS("Error: Read error at 0x%x." " Read of %d bytes failed.\n", @@ -550,7 +550,7 @@ BeceemNVM::FlashBulkRead(unsigned int offset, unsigned int size, status_t BeceemNVM::RestoreBlockProtect(unsigned long writestatus) { - unsigned int value = (FLASH_CMD_WRITE_ENABLE<< 24); + uint32 value = (FLASH_CMD_WRITE_ENABLE<< 24); BizarroWriteRegister(FLASH_SPI_CMDQ_REG, sizeof(value), &value); snooze(20); @@ -563,15 +563,15 @@ BeceemNVM::RestoreBlockProtect(unsigned long writestatus) unsigned long -BeceemNVM::DisableBlockProtect(unsigned int offset, size_t size) +BeceemNVM::DisableBlockProtect(uint32 offset, size_t size) { return 0; } status_t -BeceemNVM::FlashBulkWrite(unsigned int offset, unsigned int size, - unsigned int* buffer) +BeceemNVM::FlashBulkWrite(uint32 offset, uint32 size, + uint32* buffer) { // TODO : Implement flash writing, not really needed for normal use TRACE_ALWAYS("%s: Not yet implemented\n", __func__); @@ -580,19 +580,19 @@ BeceemNVM::FlashBulkWrite(unsigned int offset, unsigned int size, status_t -BeceemNVM::FlashSectorErase(unsigned int addr, unsigned int numOfSectors) +BeceemNVM::FlashSectorErase(uint32 addr, uint32 numOfSectors) { TRACE("Debug: Erasing %d sectors at 0x%x\n", numOfSectors, addr); - unsigned int uiStatus = 0; - unsigned int iIndex; + uint32 uiStatus = 0; + uint32 iIndex; for (iIndex = 0 ; iIndex < numOfSectors ; iIndex++) { - unsigned int value = 0x06000000; + uint32 value = 0x06000000; BizarroWriteRegister(FLASH_SPI_CMDQ_REG, sizeof(value), &value); value = (0xd8000000 | (addr & 0xFFFFFF)); BizarroWriteRegister(FLASH_SPI_CMDQ_REG, sizeof(value), &value); - unsigned int iRetries = 0; + uint32 iRetries = 0; do { value = (FLASH_CMD_STATUS_REG_READ << 24); @@ -630,14 +630,14 @@ status_t BeceemNVM::ReadMACFromNVM(ether_address *address) { unsigned char MacAddr[6] = {0}; - status_t status = NVMRead(MAC_ADDR_OFFSET, 6, (unsigned int*)&MacAddr[0]); + status_t status = NVMRead(MAC_ADDR_OFFSET, 6, (uint32*)&MacAddr[0]); memcpy(address, MacAddr, 6); return (status); } -unsigned int +uint32 BeceemNVM::EEPROMGetSize() { // To find the EEPROM size read the possible boundaries of the @@ -645,12 +645,12 @@ BeceemNVM::EEPROMGetSize() // result in wrap around. So when we get the End of the EEPROM we will // get 'BECM' string which is indeed at offset 0. - unsigned int uiData = 0; + uint32 uiData = 0; EEPROMBulkRead(0x0, 4, &uiData); if (ntohl(uiData) == BECM) { // If EEPROM is present, it will have 'BECM' string at 0th offset. - unsigned int uiIndex; + uint32 uiIndex; for (uiIndex = 1 ; uiIndex <= 256; uiIndex *= 2) { EEPROMBulkRead(uiIndex * 1024, 4, &uiData); @@ -664,16 +664,16 @@ BeceemNVM::EEPROMGetSize() status_t -BeceemNVM::EEPROMRead(unsigned int offset, unsigned int *pdwData) +BeceemNVM::EEPROMRead(uint32 offset, uint32 *pdwData) { // Read 4 bytes from EEPROM // read 0x0f003020 until bit 2 of 0x0f003008 is set. - unsigned int regValue = 0; + uint32 regValue = 0; BizarroReadRegister(EEPROM_SPI_Q_STATUS_REG, - sizeof(unsigned int), ®Value); + sizeof(uint32), ®Value); - unsigned int retries = 16; + uint32 retries = 16; while (((regValue >> 2) & 1) == 0) { retries--; @@ -685,7 +685,7 @@ BeceemNVM::EEPROMRead(unsigned int offset, unsigned int *pdwData) } BizarroReadRegister(EEPROM_SPI_Q_STATUS_REG, - sizeof(unsigned int), ®Value); + sizeof(uint32), ®Value); } // wrm (0x0f003018, 0xNbXXXXXX) @@ -697,11 +697,11 @@ BeceemNVM::EEPROMRead(unsigned int offset, unsigned int *pdwData) offset |= 0x3b000000; - BizarroWriteRegister(EEPROM_CMDQ_SPI_REG, sizeof(unsigned int), &offset); + BizarroWriteRegister(EEPROM_CMDQ_SPI_REG, sizeof(uint32), &offset); retries = 50; - BizarroReadRegister(EEPROM_SPI_Q_STATUS_REG, sizeof(unsigned int), + BizarroReadRegister(EEPROM_SPI_Q_STATUS_REG, sizeof(uint32), ®Value); while (((regValue >> 1) & 1) == 1) { @@ -714,23 +714,23 @@ BeceemNVM::EEPROMRead(unsigned int offset, unsigned int *pdwData) return B_ERROR; } - BizarroReadRegister(EEPROM_SPI_Q_STATUS_REG, sizeof(unsigned int), + BizarroReadRegister(EEPROM_SPI_Q_STATUS_REG, sizeof(uint32), ®Value); } - BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(unsigned int), ®Value); + BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(uint32), ®Value); - unsigned int dwReadValue = regValue; + uint32 dwReadValue = regValue; - BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(unsigned int), ®Value); + BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(uint32), ®Value); dwReadValue |= regValue << 8; - BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(unsigned int), ®Value); + BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(uint32), ®Value); dwReadValue |= regValue << 16; - BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(unsigned int), ®Value); + BizarroReadRegister(EEPROM_READ_DATAQ_REG, sizeof(uint32), ®Value); dwReadValue |= regValue << 24; @@ -741,15 +741,15 @@ BeceemNVM::EEPROMRead(unsigned int offset, unsigned int *pdwData) status_t -BeceemNVM::EEPROMBulkRead(unsigned int offset, size_t numBytes, - unsigned int* buffer) +BeceemNVM::EEPROMBulkRead(uint32 offset, size_t numBytes, + uint32* buffer) { - unsigned int uiData[4] = {0}; - unsigned int uiBytesRemaining = numBytes; - unsigned int uiIndex = 0; + uint32 uiData[4] = {0}; + uint32 uiBytesRemaining = numBytes; + uint32 uiIndex = 0; - unsigned int uiTempOffset = 0; - unsigned int uiExtraBytes = 0; + uint32 uiTempOffset = 0; + uint32 uiExtraBytes = 0; unsigned char* pcBuff = (unsigned char*)buffer; TRACE("Debug: Reading %x bytes at offset %x.\n", numBytes, offset); @@ -758,7 +758,7 @@ BeceemNVM::EEPROMBulkRead(unsigned int offset, size_t numBytes, uiTempOffset = offset - (offset%16); uiExtraBytes = offset - uiTempOffset; - EEPROMBulkRead(uiTempOffset, 16, (unsigned int*)&uiData[0]); + EEPROMBulkRead(uiTempOffset, 16, (uint32*)&uiData[0]); if (uiBytesRemaining >= (16 - uiExtraBytes)) { memcpy(buffer, @@ -827,7 +827,7 @@ BeceemNVM::ValidateDSD(unsigned long hwParam) /* Read the Length of structure */ unsigned short hwParamLen = 0; - NVMRead(dwReadValue, 2, (unsigned int*)&hwParamLen); + NVMRead(dwReadValue, 2, (uint32*)&hwParamLen); hwParamLen = ntohs(hwParamLen); /* Validate length */ @@ -846,7 +846,7 @@ BeceemNVM::ValidateDSD(unsigned long hwParam) return B_ERROR; } - NVMRead(dwReadValue, hwParamLen, (unsigned int*)puBuffer); + NVMRead(dwReadValue, hwParamLen, (uint32*)puBuffer); // Populate allocated memory with string for checksum unsigned short usChksmCalc = 0; @@ -854,7 +854,7 @@ BeceemNVM::ValidateDSD(unsigned long hwParam) // Perform checksum on values unsigned short usChksmOrg = 0; - NVMRead(dwReadValue + hwParamLen, 2, (unsigned int*)&usChksmOrg); + NVMRead(dwReadValue + hwParamLen, 2, (uint32*)&usChksmOrg); // Read what the device thinks the checksum should be usChksmOrg = ntohs(usChksmOrg); diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.h index 2567d6e8c1..d7ab7d28a7 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.h +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/BeceemNVM.h @@ -83,23 +83,23 @@ public: status_t ValidateDSD(unsigned long hwParam); - int NVMRead(unsigned int offset, unsigned int size, - unsigned int* buffer); - int NVMWrite(unsigned int offset, unsigned int size, - unsigned int* buffer); + int NVMRead(uint32 offset, uint32 size, + uint32* buffer); + int NVMWrite(uint32 offset, uint32 size, + uint32* buffer); // yuck. These are in a child class class - virtual status_t ReadRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t ReadRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; - virtual status_t WriteRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t WriteRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; - virtual status_t BizarroReadRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t BizarroReadRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; - virtual status_t BizarroWriteRegister(unsigned int reg, - size_t size, uint32_t* buffer) + virtual status_t BizarroWriteRegister(uint32 reg, + size_t size, uint32* buffer) { return NULL; }; int bSelectedChip; // selected chip @@ -109,30 +109,30 @@ private: status_t NVMDetect(); status_t NVMFlush(); - status_t NVMChipSelect(unsigned int offset); + status_t NVMChipSelect(uint32 offset); status_t RestoreBlockProtect(unsigned long writestatus); - unsigned long DisableBlockProtect(unsigned int offset, + unsigned long DisableBlockProtect(uint32 offset, size_t size); int FlashGetBaseAddr(); unsigned long FlashReadID(); status_t FlashReadCS(); - status_t FlashSectorErase(unsigned int addr, - unsigned int numOfSectors); - status_t FlashBulkRead(unsigned int offset, - unsigned int size, unsigned int* buffer); - status_t FlashBulkWrite(unsigned int offset, - unsigned int size, unsigned int* buffer); + status_t FlashSectorErase(uint32 addr, + uint32 numOfSectors); + status_t FlashBulkRead(uint32 offset, + uint32 size, uint32* buffer); + status_t FlashBulkWrite(uint32 offset, + uint32 size, uint32* buffer); status_t FlashCSFlip(PFLASH_CS_INFO FlashCSInfo); status_t FlashCSDump(PFLASH_CS_INFO FlashCSInfo); - unsigned int EEPROMGetSize(); - unsigned int FlashGetSize(); + uint32 EEPROMGetSize(); + uint32 FlashGetSize(); - status_t EEPROMRead(unsigned int offset, - unsigned int *pdwData); - status_t EEPROMBulkRead( unsigned int offset, - size_t numBytes, unsigned int* buffer); + status_t EEPROMRead(uint32 offset, + uint32 *pdwData); + status_t EEPROMBulkRead( uint32 offset, + size_t numBytes, uint32* buffer); }; diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/DeviceStruct.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/DeviceStruct.h index e698ec86df..1efaa6aa10 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/DeviceStruct.h +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/DeviceStruct.h @@ -97,7 +97,7 @@ typedef struct _VENDORCFG # Ack generation # Version 50 - Added flag for handling partial nacking of PDUs, and retxing # only nacked blocks */ - unsigned int m_u32CfgVersion; + uint32 m_u32CfgVersion; /* Scanning Parameters @@ -105,19 +105,19 @@ typedef struct _VENDORCFG Or use: 2336, 2345, 2354, 2367.5, 2385.5 Choosing the center frequency non-zero will disable scanning! */ - unsigned int m_u32CenterFrequency; - unsigned int m_u32BandAScan; - unsigned int m_u32BandBScan; - unsigned int m_u32BandCScan; + uint32 m_u32CenterFrequency; + uint32 m_u32BandAScan; + uint32 m_u32BandBScan; + uint32 m_u32BandCScan; // QoS Params - unsigned int m_u32minGrantsize; // size of minimum grant is 0 or 6 - unsigned int m_u32PHSEnable; + uint32 m_u32minGrantsize; // size of minimum grant is 0 or 6 + uint32 m_u32PHSEnable; // HO Params - unsigned int m_u32HoEnable; - unsigned int m_u32HoReserved1; - unsigned int m_u32HoReserved2; + uint32 m_u32HoEnable; + uint32 m_u32HoReserved1; + uint32 m_u32HoReserved2; /* MIMO Enable ==> 0xddccbbaa @@ -127,7 +127,7 @@ typedef struct _VENDORCFG 0xdd Reserved 0x0101 => Enables DL MIMO and UL CSM 0x010101 =? Enable DL MIMO, UL CSM, and disable MIMO B in DL */ - unsigned int m_u32MimoEnable; + uint32 m_u32MimoEnable; /* Security Parameters @@ -136,20 +136,20 @@ typedef struct _VENDORCFG bit 2 = Enable domain restriction for security bit 3 = Disable encryption support bit[31:4] = Unused. */ - unsigned int m_u32SecurityEnable; + uint32 m_u32SecurityEnable; /* PowerSaving enable bit 1 = 1 Idlemode enable bit 2 = 1 Sleepmode Enable */ - unsigned int m_u32PowerSavingModesEnable; + uint32 m_u32PowerSavingModesEnable; /* PowerSaving Mode Options bit 0 = 1: CPE mode - to keep pcmcia if alive; bit 1 = 1: CINR reporing in Idlemode Msg bit 2 = 1: Default PSC Enable in sleepmode */ - unsigned int m_u32PowerSavingModeOptions; + uint32 m_u32PowerSavingModeOptions; /* ARQ Enable ==> 0xddccbbaa @@ -159,7 +159,7 @@ typedef struct _VENDORCFG cc => 0x01 Enable ARQ FB BW req enh dd => 0th bit Disable ARQ Cut thru for Ack Generation dd => 1st bit enables handling of partial nacking of PDUs, and retxing */ - unsigned int m_u32ArqEnable; + uint32 m_u32ArqEnable; /* HARQ Enable ==> 0xddccbbaa @@ -175,28 +175,28 @@ typedef struct _VENDORCFG Enables out of deliver on the non-ARQ rx ERTPS HARQ connections Eg. 0x0501 => Enables HARQ on Management and HARQ on Transport Connections Enables out of deliver on the non-ARQ RX HARQ connections */ - unsigned int m_u32HarqEnable; + uint32 m_u32HarqEnable; // EEPROM Param Location - unsigned int m_u32EEPROMFlag; + uint32 m_u32EEPROMFlag; /* Customize Normal Mode should be set to (0x00000100) Set bit 0 for using D5 CQICH IE (WiBro NW) Bit 26 should be set to disable the BEU */ - unsigned int m_u32Customize; + uint32 m_u32Customize; /* Config Bandwidth Should be in Hz i.e. 8750000, 10000000 */ - unsigned int m_u32ConfigBW; + uint32 m_u32ConfigBW; /* Shutdown Timer number of frames (5 ms) ShutDown Timer Value = 0x7fffffff */ - unsigned int m_u32ShutDownTimer; + uint32 m_u32ShutDownTimer; /* Radio Parameter @@ -217,7 +217,7 @@ typedef struct _VENDORCFG # 3.5GHz MS120 single band unit needs 0x42 # 2.3G and/or 3.5G BCS200 unit needs 0x40022 # 2.5G and/or 3.5G BCS200 unit needs 0x40032 */ - unsigned int m_u32RadioParameter; + uint32 m_u32RadioParameter; /* PhyParameter1 e.g. 0xccccbbaa @@ -226,7 +226,7 @@ typedef struct _VENDORCFG aa = [7:0] Number of UL symbols Special value of 0xFFFFFFFF indicates use of embedded logic PhyParameter1 = 0xFFFFFFFF */ - unsigned int m_u32PhyParameter1; + uint32 m_u32PhyParameter1; /* PhyParameter2 @@ -234,11 +234,11 @@ typedef struct _VENDORCFG If set to 1, note the BTS Link Adaptation tables may need change [15:8] Backoff in 0.25dBm steps in Transmit power to be applied for an uncalibrated unit */ - unsigned int m_u32PhyParameter2; + uint32 m_u32PhyParameter2; /* PhyParameter3 = 0x0 */ - unsigned int m_u32PhyParameter3; + uint32 m_u32PhyParameter3; /* TestOptions @@ -271,14 +271,14 @@ typedef struct _VENDORCFG -#define ENABLE__BF_WA 0x20000000 -#define ENABLE_BR_PWR_INCR_AND_IGNORE_PC_IE_OUT_DYNAMIC_RNG 0x40000000 -#define ENABLE_BR_CODE_TIMEOUT_PWR_ADJ_PDUS 0x80000000*/ - unsigned int m_u32TestOptions; + uint32 m_u32TestOptions; /* Max MAC Data per Frame to be sent in REG-REQ */ - unsigned int m_u32MaxMACDataperDLFrame; - unsigned int m_u32MaxMACDataperULFrame; + uint32 m_u32MaxMACDataperDLFrame; + uint32 m_u32MaxMACDataperULFrame; - unsigned int m_u32Corr2MacFlags; + uint32 m_u32Corr2MacFlags; /* HostDrvrConfig1/HostDrvrConfig2/HostDrvrConfig3 @@ -287,9 +287,9 @@ typedef struct _VENDORCFG ON State (This makes sure that the LED is ON till a state is achieved) Blink State (This makes sure that the LED Keeps Blinking till a state is achieved e.g. firmware download state)*/ - unsigned int HostDrvrConfig1; - unsigned int HostDrvrConfig2; - unsigned int HostDrvrConfig3; + uint32 HostDrvrConfig1; + uint32 HostDrvrConfig2; + uint32 HostDrvrConfig3; /* HostDrvrConfig4/HostDrvrConfig5 @@ -300,8 +300,8 @@ typedef struct _VENDORCFG HostDrvrConfig5 [31:0] To set WiMAX Trigger Threshold for the type selected in HostDrvrConfig4 */ - unsigned int HostDrvrConfig4; - unsigned int HostDrvrConfig5; + uint32 HostDrvrConfig4; + uint32 HostDrvrConfig5; /* HostDrvrConfig6: @@ -322,13 +322,13 @@ typedef struct _VENDORCFG DEVICE_POWERSAVE_MODE_AS_PMU_SHUTDOWN = 0x2 Bit[15] Idlemode Auto correct mode. 0-Enable, 1- Disable. */ - unsigned int HostDrvrConfig6; + uint32 HostDrvrConfig6; /* Segmented PSUC Option to enable support of Segmented PUSC. If set to 0, only full reuse profiles are supported */ - unsigned int m_u32SegmentedPUSCenable; + uint32 m_u32SegmentedPUSCenable; /* BAMC Related Parameters @@ -339,7 +339,7 @@ typedef struct _VENDORCFG Bit[16..31] Band AMC Data configuration: Bit 16 = 1 Band AMC 2x3 support. Bit 0 is effective only if bit 16 is set. */ - unsigned int m_u32BandAMCEnable; + uint32 m_u32BandAMCEnable; } VENDORCFG, *PSVENDORCFG; @@ -384,69 +384,69 @@ typedef struct _GPIO_LED_MAP typedef struct _FLASH_CS_INFO { - uint32_t MagicNumber; + uint32 MagicNumber; // 0xBECE - F1A5 for FLAS(H) - uint32_t FlashLayoutVersion; + uint32 FlashLayoutVersion; // Flash layout version - uint32_t ISOImageVersion; + uint32 ISOImageVersion; // ISO Image / Format / Eng version - uint32_t SCSIFirmwareVersion; + uint32 SCSIFirmwareVersion; // SCSI Firmware Version - uint32_t OffsetFromZeroForPart1ISOImage; + uint32 OffsetFromZeroForPart1ISOImage; // Normally 0 - uint32_t OffsetFromZeroForScsiFirmware; + uint32 OffsetFromZeroForScsiFirmware; // Normally 12MB - uint32_t SizeOfScsiFirmware; + uint32 SizeOfScsiFirmware; // Size of firmware, varies - uint32_t OffsetFromZeroForPart2ISOImage; + uint32 OffsetFromZeroForPart2ISOImage; // 1st word offset 12MB + sizeofScsiFirmware - uint32_t OffsetFromZeroForCalibrationStart; - uint32_t OffsetFromZeroForCalibrationEnd; + uint32 OffsetFromZeroForCalibrationStart; + uint32 OffsetFromZeroForCalibrationEnd; - uint32_t OffsetFromZeroForVSAStart; - uint32_t OffsetFromZeroForVSAEnd; + uint32 OffsetFromZeroForVSAStart; + uint32 OffsetFromZeroForVSAEnd; // VSA0 offsets - uint32_t OffsetFromZeroForControlSectionStart; - uint32_t OffsetFromZeroForControlSectionData; + uint32 OffsetFromZeroForControlSectionStart; + uint32 OffsetFromZeroForControlSectionData; // Control Section offsets - uint32_t CDLessInactivityTimeout; + uint32 CDLessInactivityTimeout; // NO Data Activity timeout to switch from MSC to NW Mode - uint32_t NewImageSignature; + uint32 NewImageSignature; // New ISO Image Signature - uint32_t FlashSectorSizeSig; + uint32 FlashSectorSizeSig; // Signature to validate the sector size. - uint32_t FlashSectorSize; + uint32 FlashSectorSize; // Sector Size - uint32_t FlashWriteSupportSize; + uint32 FlashWriteSupportSize; // Write Size Support - uint32_t TotalFlashSize; + uint32 TotalFlashSize; // Total Flash Size - uint32_t FlashBaseAddr; + uint32 FlashBaseAddr; // Flash Base Address for offset specified - uint32_t FlashPartMaxSize; + uint32 FlashPartMaxSize; // Flash Part Max Size - uint32_t IsCDLessDeviceBootSig; + uint32 IsCDLessDeviceBootSig; // Is CDLess or Flash Bootloader - uint32_t MassStorageTimeout; + uint32 MassStorageTimeout; // MSC Timeout after reset to switch from MSC to NW Mode } FLASH_CS_INFO, *PFLASH_CS_INFO; @@ -455,15 +455,15 @@ struct WIMAX_DEVICE { VENDORCFG vendorcfg; // we memcpy the vendor cfg here - unsigned int syscfgBefFw; + uint32 syscfgBefFw; // SYS_CFG before firmware bool CPUFlashBoot; // Reverse MIPS - unsigned int deviceChipID; + uint32 deviceChipID; // Beceem interface chip model volatile bool driverHalt; // gets set to true when driver is being shutdown -volatile unsigned int driverState; +volatile uint32 driverState; // Driver state, defined in Driver.h volatile bool driverDDRinit; // has the DDR memory been initialized? @@ -476,16 +476,16 @@ volatile bool driverFwPushed; thread_id LEDThreadID; // Thread ID of LED state handler - unsigned int nvmType; + uint32 nvmType; // NVM Type (FLASH|EEPROM|UNKNOWN) - unsigned int nvmDSDSize; + uint32 nvmDSDSize; // NVM DSD Size - unsigned int nvmVerMajor; + uint32 nvmVerMajor; // NVM Major - unsigned int nvmVerMinor; + uint32 nvmVerMinor; // NVM Minor -volatile uint32_t nvmFlashBaseAddr; +volatile uint32 nvmFlashBaseAddr; // NVM Flash base address unsigned long nvmFlashCalStart; // NVM Flash calibrated start @@ -500,16 +500,16 @@ volatile bool nvmFlashCSDone; volatile bool nvmFlashRaw; // Do we need raw access at the moment? - unsigned int nvmFlashMajor; + uint32 nvmFlashMajor; // NVM Flash layout major version - unsigned int nvmFlashMinor; + uint32 nvmFlashMinor; // NVM Flash layout major version - unsigned int hwParamPtr; + uint32 hwParamPtr; // Pointer to the NVM Param section address unsigned char gpioInfo[32]; // Stored GPIO information - unsigned int gpioBitMap; + uint32 gpioBitMap; // GPIO LED bitmap }; diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.cpp b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.cpp index 35a2d7bc55..44bcbc3f45 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.cpp +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.cpp @@ -10,23 +10,23 @@ #include "util.h" void -convertEndian(bool write, unsigned int uiByteCount, unsigned int* buffer) +convertEndian(bool write, uint32 uiByteCount, uint32* buffer) { - unsigned int uiIndex = 0; + uint32 uiIndex = 0; if( write == true ) { - for(uiIndex = 0; uiIndex < (uiByteCount/sizeof(unsigned int)); uiIndex++) { + for(uiIndex = 0; uiIndex < (uiByteCount/sizeof(uint32)); uiIndex++) { buffer[uiIndex] = htonl(buffer[uiIndex]); } } else { - for(uiIndex = 0; uiIndex < (uiByteCount/sizeof(unsigned int)); uiIndex++) { + for(uiIndex = 0; uiIndex < (uiByteCount/sizeof(uint32)); uiIndex++) { buffer[uiIndex] = ntohl(buffer[uiIndex]); } } } uint16_t -CalculateHWChecksum(uint8_t* pu8Buffer, uint32_t u32Size) +CalculateHWChecksum(uint8_t* pu8Buffer, uint32 u32Size) { uint16_t u16CheckSum=0; while(u32Size--) { diff --git a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.h b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.h index 50f90092f5..066bbf2449 100644 --- a/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.h +++ b/src/add-ons/kernel/drivers/network/wwan/usb_beceemwmx/util.h @@ -7,6 +7,6 @@ #include "Driver.h" -void convertEndian(bool write, unsigned int uiByteCount, unsigned int* buffer); -uint16_t CalculateHWChecksum(uint8_t* pu8Buffer, uint32_t u32Size); +void convertEndian(bool write, uint32 uiByteCount, uint32* buffer); +uint16_t CalculateHWChecksum(uint8_t* pu8Buffer, uint32 u32Size); From e40c00685cbbfc348064e71f4c38c551232f8f40 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 21 Sep 2011 21:36:00 +0000 Subject: [PATCH 302/702] * correct some naming after deeper investigation of linux drm driver. Seems radeon_hd isn't limited to the standard 0xa0 i2c slave address. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42762 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.h | 2 +- src/add-ons/accelerants/radeon_hd/display.cpp | 5 +++-- src/add-ons/accelerants/radeon_hd/gpu.cpp | 15 ++++++++------- src/add-ons/accelerants/radeon_hd/gpu.h | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 4ee3fd3bec..348beca362 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -142,7 +142,7 @@ struct gpio_info { bool valid; bool hw_capable; - uint8 pin; + uint8 i2c_slave_addr; uint32 mask_scl_reg; uint32 mask_sda_reg; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 54daf7fbc9..adfde16b88 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -567,6 +567,7 @@ detect_connectors() // set up i2c gpio information for connector radeon_gpu_i2c_setup(connector_index, i2c_config->ucAccess); + break; case ATOM_HPD_INT_RECORD_TYPE: // TODO : HPD (Hot Plug) @@ -704,10 +705,10 @@ debug_connectors() ERROR("Connector #%" B_PRIu32 ")\n", id); ERROR(" + connector: %s\n", get_connector_name(connector_type)); ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); + ERROR(" + i2c slave address: 0x%" B_PRIX8 "\n", + gConnector[id]->connector_gpio.i2c_slave_addr); ERROR(" + gpio valid: %s\n", (gConnector[id]->connector_gpio.valid) ? "true" : "false"); - ERROR(" + gpio pin: 0x%" B_PRIX8 "\n", - gConnector[id]->connector_gpio.pin); } } ERROR("==========================================\n"); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index af1e9a053d..65675152e9 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -344,7 +344,7 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) *_data = (sda != 0); //TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", - // __func__, info->pin, *_clock, *_data); + // __func__, info->i2c_slave_addr, *_clock, *_data); return B_OK; } @@ -367,7 +367,7 @@ set_i2c_signals(void* cookie, int clock, int data) Write32(OUT, info->a_sda_reg, data); //TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", - // __func__, info->pin, clock, data); + // __func__, info->i2c_slave_addr, clock, data); return B_OK; } @@ -402,11 +402,11 @@ radeon_gpu_read_edid(uint32 connector, edid1_info *edid) status_t -radeon_gpu_i2c_setup(uint32 id, uint8 gpio_pin) +radeon_gpu_i2c_setup(uint32 id, uint8 i2c_slave_addr) { // aka radeon_lookup_i2c_gpio - TRACE("%s: Path #%" B_PRId32 ": GPIO Pin 0x%" B_PRIx8 "\n", __func__, - id, gpio_pin); + TRACE("%s: Path #%" B_PRId32 ": i2c slave: 0x%" B_PRIx8 "\n", __func__, + id, i2c_slave_addr); int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); uint8 frev; @@ -434,7 +434,7 @@ radeon_gpu_i2c_setup(uint32 id, uint8 gpio_pin) // TODO : if DCE 4 and i == 7 ... manual override for evergreen // TODO : if DCE 3 and i == 4 ... manual override - if (gpio->sucI2cId.ucAccess != gpio_pin) + if (gpio->sucI2cId.ucAccess != i2c_slave_addr) continue; // populate gpio information @@ -442,7 +442,8 @@ radeon_gpu_i2c_setup(uint32 id, uint8 gpio_pin) gConnector[id]->connector_gpio.hw_capable = (gpio->sucI2cId.sbfAccess.bfHW_Capable) ? true : false; - gConnector[id]->connector_gpio.pin = gpio_pin; + // slave address of i2c endpoint + gConnector[id]->connector_gpio.i2c_slave_addr = i2c_slave_addr; // GPIO mask (Allows software to control the GPIO pad) // 0 = chip access; 1 = only software; diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index d79eeae5bd..9102d560b6 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -169,7 +169,7 @@ uint32 radeon_gpu_mc_idlecheck(); status_t radeon_gpu_mc_setup(); status_t radeon_gpu_irq_setup(); bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid); -status_t radeon_gpu_i2c_setup(uint32 id, uint8 gpio_pin); +status_t radeon_gpu_i2c_setup(uint32 id, uint8 i2c_slave_addr); #endif From cf53ed6f64b1480c034eb3dcaa24492ca2798b85 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Thu, 22 Sep 2011 22:43:16 +0000 Subject: [PATCH 303/702] New BWeakReferenceable API. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42763 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/WeakReferenceable.h | 214 +++++++++------------ 1 file changed, 88 insertions(+), 126 deletions(-) diff --git a/headers/private/shared/WeakReferenceable.h b/headers/private/shared/WeakReferenceable.h index b0182688dd..df49fd9152 100644 --- a/headers/private/shared/WeakReferenceable.h +++ b/headers/private/shared/WeakReferenceable.h @@ -11,38 +11,35 @@ namespace BPrivate { -template class WeakReferenceable; -template +class BWeakReferenceable; + + class WeakPointer : public BReferenceable { public: - Type* Get(); + WeakPointer(BWeakReferenceable* object); + ~WeakPointer(); + + BWeakReferenceable* Get(); bool Put(); int32 UseCount() const; -private: - friend class WeakReferenceable; - - WeakPointer(Type* object); - ~WeakPointer(); - -private: - void _GetUnchecked(); + void GetUnchecked(); private: vint32 fUseCount; - Type* fObject; + BWeakReferenceable* fObject; }; -template -class WeakReferenceable { + +class BWeakReferenceable { public: - WeakReferenceable(Type* object); - ~WeakReferenceable(); + BWeakReferenceable(); + virtual ~BWeakReferenceable(); void AcquireReference() - { fPointer->_GetUnchecked(); } + { fPointer->GetUnchecked(); } bool ReleaseReference() { return fPointer->Put(); } @@ -50,55 +47,43 @@ public: int32 CountReferences() const { return fPointer->UseCount(); } - WeakPointer* GetWeakPointer(); - -protected: - WeakPointer* fPointer; + WeakPointer* GetWeakPointer(); +private: + WeakPointer* fPointer; }; + template -class WeakReference { +class BWeakReference { public: - WeakReference() + BWeakReference() : - fPointer(NULL), - fObject(NULL) + fPointer(NULL) { } - WeakReference(Type* object) + BWeakReference(Type* object) : - fPointer(NULL), - fObject(NULL) + fPointer(NULL) { SetTo(object); } - WeakReference(WeakPointer& other) + BWeakReference(const BWeakReference& other) : - fPointer(NULL), - fObject(NULL) - { - SetTo(&other); - } - - WeakReference(WeakPointer* other) - : - fPointer(NULL), - fObject(NULL) + fPointer(NULL) { SetTo(other); } - WeakReference(const WeakReference& other) + BWeakReference(const BReference& other) : - fPointer(NULL), - fObject(NULL) + fPointer(NULL) { - SetTo(other.fPointer); + SetTo(other); } - ~WeakReference() + ~BWeakReference() { Unset(); } @@ -107,63 +92,51 @@ public: { Unset(); - if (object != NULL) { + if (object != NULL) fPointer = object->GetWeakPointer(); - fObject = fPointer->Get(); - } } - void SetTo(WeakPointer* pointer) + void SetTo(const BWeakReference& other) { Unset(); - if (pointer != NULL) { - fPointer = pointer; + if (other.fPointer) { + fPointer = other.fPointer; fPointer->AcquireReference(); - fObject = pointer->Get(); } } + void SetTo(const BReference& other) + { + SetTo(other.Get()); + } + void Unset() { if (fPointer != NULL) { - if (fObject != NULL) { - fPointer->Put(); - fObject = NULL; - } fPointer->ReleaseReference(); fPointer = NULL; } } - Type* Get() const + bool IsAlive() { - return fObject; + if (fPointer == NULL) + return false; + Type* object = static_cast(fPointer->Get()); + if (object == NULL) + return false; + fPointer->Put(); + return true; } - Type* Detach() + BReference GetReference() { - Type* object = fObject; - Unset(); - return object; + Type* object = static_cast(fPointer->Get()); + return BReference(object, true); } - Type& operator*() const - { - return *fObject; - } - - operator Type*() const - { - return fObject; - } - - Type* operator->() const - { - return fObject; - } - - WeakReference& operator=(const WeakReference& other) + BWeakReference& operator=(const BWeakReference& other) { if (this == &other) return *this; @@ -172,46 +145,59 @@ public: return *this; } - WeakReference& operator=(const Type& other) + BWeakReference& operator=(const Type& other) { SetTo(&other); return *this; } - WeakReference& operator=(WeakPointer& other) - { - SetTo(&other); - return *this; - } - - WeakReference& operator=(WeakPointer* other) + BWeakReference& operator=(Type* other) { SetTo(other); return *this; } - bool operator==(const WeakReference& other) const + BWeakReference& operator=(const BReference& other) + { + SetTo(other.Get()); + return *this; + } + + bool operator==(const BWeakReference& other) const { return fPointer == other.fPointer; } - bool operator!=(const WeakReference& other) const + bool operator!=(const BWeakReference& other) const { return fPointer != other.fPointer; } private: - WeakPointer* fPointer; - Type* fObject; + WeakPointer* fPointer; }; // #pragma mark - -template -inline Type* -WeakPointer::Get() +inline +WeakPointer::WeakPointer(BWeakReferenceable* object) + : + fUseCount(1), + fObject(object) +{ +} + + +inline +WeakPointer::~WeakPointer() +{ +} + + +inline BWeakReferenceable* +WeakPointer::Get() { int32 count = -11; @@ -225,9 +211,8 @@ WeakPointer::Get() } -template inline bool -WeakPointer::Put() +WeakPointer::Put() { if (atomic_add(&fUseCount, -1) == 1) { delete fObject; @@ -238,34 +223,15 @@ WeakPointer::Put() } -template inline int32 -WeakPointer::UseCount() const +WeakPointer::UseCount() const { return fUseCount; } -template -inline -WeakPointer::WeakPointer(Type* object) - : - fUseCount(1), - fObject(object) -{ -} - - -template -inline -WeakPointer::~WeakPointer() -{ -} - - -template inline void -WeakPointer::_GetUnchecked() +WeakPointer::GetUnchecked() { atomic_add(&fUseCount, 1); } @@ -274,26 +240,23 @@ WeakPointer::_GetUnchecked() // #pragma - -template inline -WeakReferenceable::WeakReferenceable(Type* object) +BWeakReferenceable::BWeakReferenceable() : - fPointer(new WeakPointer(object)) + fPointer(new WeakPointer(this)) { } -template inline -WeakReferenceable::~WeakReferenceable() +BWeakReferenceable::~BWeakReferenceable() { fPointer->ReleaseReference(); } -template -inline WeakPointer* -WeakReferenceable::GetWeakPointer() +inline WeakPointer* +BWeakReferenceable::GetWeakPointer() { fPointer->AcquireReference(); return fPointer; @@ -301,8 +264,7 @@ WeakReferenceable::GetWeakPointer() } // namespace BPrivate -using BPrivate::WeakReferenceable; -using BPrivate::WeakPointer; -using BPrivate::WeakReference; +using BPrivate::BWeakReferenceable; +using BPrivate::BWeakReference; #endif // _WEAK_REFERENCEABLE_H From a8e3ae78c9780541136e3631b59adb8f2aa1f388 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Thu, 22 Sep 2011 22:46:14 +0000 Subject: [PATCH 304/702] Switch to BWeakReference class. Hope this does not break anything. Calling virtual destructur on a struct should work fine, right? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42764 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/network/stack/net_socket.cpp | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/add-ons/kernel/network/stack/net_socket.cpp b/src/add-ons/kernel/network/stack/net_socket.cpp index f2b99da1bb..ac626a4fa1 100644 --- a/src/add-ons/kernel/network/stack/net_socket.cpp +++ b/src/add-ons/kernel/network/stack/net_socket.cpp @@ -50,13 +50,13 @@ typedef DoublyLinkedList SocketList; struct net_socket_private : net_socket, DoublyLinkedListLinkImpl, - WeakReferenceable { + BWeakReferenceable { net_socket_private(); ~net_socket_private(); void RemoveFromParent(); - WeakPointer* parent; + BWeakReference parent; team_id owner; uint32 max_backlog; uint32 child_count; @@ -82,8 +82,7 @@ static mutex sSocketLock; net_socket_private::net_socket_private() - : WeakReferenceable(this), - parent(NULL), + : owner(-1), max_backlog(0), child_count(0), @@ -148,7 +147,6 @@ net_socket_private::RemoveFromParent() { ASSERT(!is_in_socket_list && parent != NULL); - parent->ReleaseReference(); parent = NULL; mutex_lock(&sSocketLock); @@ -337,10 +335,11 @@ socket_receive_no_buffer(net_socket* socket, msghdr* header, void* data, static void print_socket_line(net_socket_private* socket, const char* prefix) { + BReference parent = socket->parent.GetReference(); kprintf("%s%p %2d.%2d.%2d %6ld %p %p %p%s\n", prefix, socket, socket->family, socket->type, socket->protocol, socket->owner, - socket->first_protocol, socket->first_info, socket->parent, - socket->parent != NULL ? socket->is_connected ? " (c)" : " (p)" : ""); + socket->first_protocol, socket->first_info, parent.Get(), + parent.Get() != NULL ? socket->is_connected ? " (c)" : " (p)" : ""); } @@ -357,8 +356,8 @@ dump_socket(int argc, char** argv) kprintf("SOCKET %p\n", socket); kprintf(" family.type.protocol: %d.%d.%d\n", socket->family, socket->type, socket->protocol); - WeakReference parent = socket->parent; - kprintf(" parent: %p (%p)\n", parent.Get(), socket->parent); + BReference parent = socket->parent.GetReference(); + kprintf(" parent: %p\n", parent.Get()); kprintf(" first protocol: %p\n", socket->first_protocol); kprintf(" first module_info: %p\n", socket->first_info); kprintf(" options: %x\n", socket->options); @@ -719,7 +718,7 @@ socket_spawn_pending(net_socket* _parent, net_socket** _socket) // add to the parent's list of pending connections parent->pending_children.Add(socket); - socket->parent = parent->GetWeakPointer(); + socket->parent = parent; parent->child_count++; *_socket = socket; @@ -815,7 +814,7 @@ socket_connected(net_socket* _socket) TRACE("socket_connected(%p)\n", socket); - WeakReference parent = socket->parent; + BReference parent = socket->parent.GetReference(); if (parent.Get() == NULL) return B_BAD_VALUE; @@ -843,7 +842,7 @@ socket_aborted(net_socket* _socket) TRACE("socket_aborted(%p)\n", socket); - WeakReference parent = socket->parent; + BReference parent = socket->parent.GetReference(); if (parent.Get() == NULL) return B_BAD_VALUE; From ac805304953069173c75eaafcddf7546f63b0619 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Fri, 23 Sep 2011 02:03:10 +0000 Subject: [PATCH 305/702] Use nothrow and add InitCheck method to check if allocation went fine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42765 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/WeakReferenceable.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/headers/private/shared/WeakReferenceable.h b/headers/private/shared/WeakReferenceable.h index df49fd9152..22d4181885 100644 --- a/headers/private/shared/WeakReferenceable.h +++ b/headers/private/shared/WeakReferenceable.h @@ -8,6 +8,8 @@ #include +#include + namespace BPrivate { @@ -38,6 +40,8 @@ public: BWeakReferenceable(); virtual ~BWeakReferenceable(); + status_t InitCheck(); + void AcquireReference() { fPointer->GetUnchecked(); } @@ -243,7 +247,7 @@ WeakPointer::GetUnchecked() inline BWeakReferenceable::BWeakReferenceable() : - fPointer(new WeakPointer(this)) + fPointer(new(std::nothrow) WeakPointer(this)) { } @@ -255,6 +259,15 @@ BWeakReferenceable::~BWeakReferenceable() } +inline status_t +BWeakReferenceable::InitCheck() +{ + if (fPointer == NULL) + return B_NO_MEMORY; + return B_OK; +} + + inline WeakPointer* BWeakReferenceable::GetWeakPointer() { From 6c5757eedb36fdd43e79d0f457e2f254425a235d Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Fri, 23 Sep 2011 02:11:32 +0000 Subject: [PATCH 306/702] Check if the socket has been created successfully. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42766 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/stack/net_socket.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/network/stack/net_socket.cpp b/src/add-ons/kernel/network/stack/net_socket.cpp index ac626a4fa1..7346769f2a 100644 --- a/src/add-ons/kernel/network/stack/net_socket.cpp +++ b/src/add-ons/kernel/network/stack/net_socket.cpp @@ -185,12 +185,17 @@ create_socket(int family, int type, int protocol, net_socket_private** _socket) struct net_socket_private* socket = new(std::nothrow) net_socket_private; if (socket == NULL) return B_NO_MEMORY; + status_t status = socket->InitCheck(); + if (status != B_OK) { + delete socket; + return status; + } socket->family = family; socket->type = type; socket->protocol = protocol; - status_t status = get_domain_protocols(socket); + status = get_domain_protocols(socket); if (status != B_OK) { delete socket; return status; From 28ff5413ddf0a0651ac8da13af8eb11c6401a4ac Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Sun, 25 Sep 2011 15:57:48 +0000 Subject: [PATCH 307/702] Updated Swedish catkeys from HTA git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42767 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/apps/aboutsystem/sv.catkeys | 4 ++-- data/catalogs/apps/devices/sv.catkeys | 19 ++++++++++++++++++- data/catalogs/apps/midiplayer/sv.catkeys | 4 ++-- data/catalogs/preferences/time/sv.catkeys | 13 +++++++++++-- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/data/catalogs/apps/aboutsystem/sv.catkeys b/data/catalogs/apps/aboutsystem/sv.catkeys index 8a7538375b..36a30e2b34 100644 --- a/data/catalogs/apps/aboutsystem/sv.catkeys +++ b/data/catalogs/apps/aboutsystem/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-About 3091539351 +1 swedish x-vnd.Haiku-About 1133193730 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB totalt %d MiB used (%d%%) AboutView %d MiB använt (%d%%) @@ -72,7 +72,7 @@ The Haiku-Ports team\n AboutView Haiku Ports-teamet\n The Haikuware team and their bounty program\n AboutView Haikuware-teamet och deras belöningsprogram\n The University of Auckland and Christof Lutteroth\n\n AboutView The University of Auckland och Christof Lutteroth\n\n The code that is unique to Haiku, especially the kernel and all code that applications may link against, is distributed under the terms of the %MIT license%. Some system libraries contain third party code distributed under the LGPL license. You can find the copyrights to third party code below.\n\n AboutView %MIT license% isn't a variable and has to be translated. Koden som är unik för Haiku, särskilt kärnan och all kod som program länkar mot, är distribuerad under villkoren hos %MIT licensen%. Några systembibliotek innehåller tredjepartskod distribuerat under villkoren för LGPL licensen. Du kan finna upphovsrättsvillkoren för tredjepartskod nedan.\n\n -The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Upphovsrätten till Haikus källkod är en egendom tillhörande Haiku, Inc eller dess respektive skapare där det uttryckligen är angivet i källkoden. Haiku™ och HAIKU logotyp® är (registrerade) varumärken tillhörande Haiku, Inc.\n\n +The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku® and the HAIKU logo® are registered trademarks of Haiku, Inc.\n\n AboutView Upphovsrätten till Haiku's källkod en egendom tillhörande Haiku, Inc. eller respektive upphovsman, där det uttryckligen är angivet i källkoden. Haiku® och Haiku's logo® är registrerade varumärken tillhörande Haiku, Inc.\n\n Time running: AboutView Tid sedan uppstart: Translations:\n AboutView Översättningar:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (och hans NewOS-kärna)\n diff --git a/data/catalogs/apps/devices/sv.catkeys b/data/catalogs/apps/devices/sv.catkeys index d58c29766d..a4b82d780a 100644 --- a/data/catalogs/apps/devices/sv.catkeys +++ b/data/catalogs/apps/devices/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-Devices 1943893993 +1 swedish x-vnd.Haiku-Devices 2539610927 ACPI Information DeviceACPI ACPI-information ACPI Processor Namespace '%2' DeviceACPI ACPI Processor-namnrymd '%2' ACPI System Bus DeviceACPI ACPI systembuss @@ -10,10 +10,14 @@ ACPI controller Device ACPI-kontroller ACPI node '%1' DeviceACPI ACPI nod '%1' Basic information DevicesView Grundläggande information Bridge Device Brygga +Bridge DeviceSCSI Brygga Bus DevicesView Buss Bus Information Device Bussinformation +CD-ROM DeviceSCSI CD-ROM +Card Reader DeviceSCSI Kortläsare Category DevicesView Kategori Class Info:\t\t\t\t: %classInfo% DeviceACPI Klassinformation:\t\t\t\t: %classInfo% +Class Info:\t\t\t\t: %classInfo% DeviceSCSI Klassinformation:\t\t\t\t: %classInfo% Class info DevicePCI Klassinformation Communication controller Device Kommunikationskontroller Computer Device Dator @@ -22,14 +26,17 @@ Connection DevicesView Anslutning Detailed DevicesView Detaljerat Device Device Enhet Device Name\t\t\t\t: %Name%\nManufacturer\t\t\t: %Manufacturer%\nDriver used\t\t\t\t: %DriverUsed%\nDevice paths\t: %DevicePaths% Device Enhetsnamn\t\t\t\t: %Name%\nTillverkare\t\t\t: %Manufacturer%\nDrivrutin\t\t\t\t: %DriverUsed%\nEnhetssökväg\t: %DevicePaths% +Device class DeviceSCSI Enhetsklass Device name Device Enhetsnamn Device name DeviceACPI Enhetsnamn Device name DevicePCI Enhetsnamn +Device name DeviceSCSI Enhetsnamn Device name: Device Enhetsnamn: Device paths Device Enhetssökväg Device paths DevicePCI Enhetssökväg Devices DevicesView Enheter Devices System name Enheter +Disk Drive DeviceSCSI Diskenhet Display controller Device Skärmkontroller Docking station Device Dockningsstation Driver used Device Drivrutin använd @@ -37,6 +44,7 @@ Driver used DevicePCI Använd drivrutin Encryption controller Device Krypteringskontroller Generate system information DevicesView Generera systeminformation Generic system peripheral Device Allmänt systemtillbehör +Graphics Peripheral DeviceSCSI Grafisk kringutrustning ISA bus Device ISA-buss ISA bus DevicesView ISA-buss Input device controller Device Indataenhetskontroller @@ -44,6 +52,7 @@ Intelligent controller Device Intelligent kontroller Manufacturer Device Tillverkare Manufacturer DeviceACPI Tillverkare Manufacturer DevicePCI Tillverkare +Manufacturer DeviceSCSI Tillverkare Manufacturer: Device Tillverkare: Mass storage controller Device Lagringskontroller Memory controller Device Minneskontroller @@ -53,17 +62,25 @@ Network controller Device Nätverkskontroller None Device Ingen Not implemented DeviceACPI Inte implementerat Not implemented DevicePCI Inte implementerat +Optical Drive DeviceSCSI Optisk enhet Order by: DevicesView Sortera efter: +Other DeviceSCSI Annan PCI Information DevicePCI PCI-information PCI bus Device PCI-buss PCI bus DevicesView PCI-buss +Printer DeviceSCSI Skrivare Processor Device Processor +Processor DeviceSCSI Processor Quit DevicesView Avsluta +RBC DeviceSCSI RBC Refresh devices DevicesView Uppdatera enhetsvy Report compatibility DevicesView Rapportera kompatibilitet +SCSI Information DeviceSCSI SCSI information Satellite communications controller Device Satelitkommunikationskontroller +Scanner DeviceSCSI Skanner Serial bus controller Device Seriell kontroller Signal processing controller Device Signalbehandlingskontroller +Tape Drive DeviceSCSI Bandstation Unclassified device Device Oklassificerad enhet Unknown DevicePCI Okänt Unknown device Device Okänd enhet diff --git a/data/catalogs/apps/midiplayer/sv.catkeys b/data/catalogs/apps/midiplayer/sv.catkeys index 236ba119fa..ceb92dda64 100644 --- a/data/catalogs/apps/midiplayer/sv.catkeys +++ b/data/catalogs/apps/midiplayer/sv.catkeys @@ -9,11 +9,11 @@ Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands o Igor's lab Main Window Igor's labb Live input: Main Window Livekälla: MidiPlayer System name MidiSpelare -None Main Window Ingen +None Main Window Inget OK Main Window OK Off Main Window Av Play Main Window Spela -Reverb: Main Window Reverb: +Reverb: Main Window Eko: Scope Main Window Visualisering Stop Main Window Stopp Volume: Main Window Volym: diff --git a/data/catalogs/preferences/time/sv.catkeys b/data/catalogs/preferences/time/sv.catkeys index d310e6f075..8591d1884f 100644 --- a/data/catalogs/preferences/time/sv.catkeys +++ b/data/catalogs/preferences/time/sv.catkeys @@ -1,17 +1,26 @@ -1 swedish x-vnd.Haiku-Time 453699369 +1 swedish x-vnd.Haiku-Time 3739720453 Time Add Time Lägg till +Africa Time Afrika +America Time Amerika +Antarctica Time Antarktis +Arctic Time Arktis +Asia Time Asien +Atlantic Time Atlanten +Australia Time Australien Could not contact server Time Kunde inte kontakta servern Could not create socket Time Kunde inte skapa en socket Current time: Time Aktuell tid: Date and time Time Datum och tid -Etc Time Etc +Europe Time Europa GMT Time GMT standardtid Hardware clock set to: Time Hårdvaruklockans tid: +Indian Time Indien Local time Time Lokal tid Message receiving failed Time Kunde inte ta emot meddelandet Network time Time Internettid OK Time OK +Pacific Time Stilla havet Preview time: Time Förhandsvisa tid: Received invalid time Time Tog emot en ogiltig tid Remove Time Ta bort From 2ccad1f632c815397f16f7062d97cd02bdede8b8 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 25 Sep 2011 23:04:43 +0000 Subject: [PATCH 308/702] * Fix decorator reloading of windows in a stack. When reloading the decorator all tabs have to be added to the decorator, the focus and the top layer tab must be set. The decorator does not know about the window and the window stack, thus the window has to do it itself. * Add Joseph Groover to the author list. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42768 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 25 +++++++++++++++++++++--- src/servers/app/decorator/DecorManager.h | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 3d43bf34d8..d4b003700d 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -587,14 +587,24 @@ Window::ReloadDecor() if (stack == NULL) return false; + // only reload the window at the first position + if (stack->WindowAt(0) != this) + return true; + if (fLook != B_NO_BORDER_WINDOW_LOOK) { // we need a new decorator decorator = gDecorManager.AllocateDecorator(this); if (decorator == NULL) return false; - int32 index = PositionInStack(); - if (IsFocus()) - decorator->SetFocus(index, true); + + // add all tabs to the decorator + for (int32 i = 1; i < stack->CountWindows(); i++) { + Window* window = stack->WindowAt(i); + BRegion dirty; + DesktopSettings settings(fDesktop); + decorator->AddTab(settings, window->Title(), window->Look(), + window->Flags(), -1, &dirty); + } } windowBehaviour = gDecorManager.AllocateWindowBehaviour(this); @@ -608,6 +618,15 @@ Window::ReloadDecor() delete fWindowBehaviour; fWindowBehaviour = windowBehaviour; + // set the correct focus and top layer tab + for (int32 i = 0; i < stack->CountWindows(); i++) { + Window* window = stack->WindowAt(i); + if (window->IsFocus()) + decorator->SetFocus(i, true); + if (window == stack->TopLayerWindow()) + decorator->SetTopTap(i); + } + return true; } diff --git a/src/servers/app/decorator/DecorManager.h b/src/servers/app/decorator/DecorManager.h index ab67a2e319..5240b01bce 100644 --- a/src/servers/app/decorator/DecorManager.h +++ b/src/servers/app/decorator/DecorManager.h @@ -5,6 +5,7 @@ * Author: * DarkWyrm * Clemens Zeidler + * Joseph Groover */ #ifndef DECOR_MANAGER_H #define DECOR_MANAGER_H From 2ce1337c71bf6de87632ce1ef94305ad479efa2a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 26 Sep 2011 16:50:29 +0000 Subject: [PATCH 309/702] * fix several i2c communication bugs dealing with i2c register addresses. * cleanup i2c hacks * now receive the following message in SimNow: "No device present at I2C slave address 0x66" git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42769 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 37 +++++++++-------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 65675152e9..6db876c5cd 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -281,10 +281,13 @@ static void lock_i2c(void* cookie, bool lock) { gpio_info *info = (gpio_info*)cookie; + radeon_shared_info &sinfo = *gInfo->shared_info; uint32 buffer = 0; - if (info->hw_capable == true) { + // hw_capable and > DCE3 + if (info->hw_capable == true + && sinfo.device_chipset >= (RADEON_R600 | 0x20)) { // Switch GPIO pads to ddc mode buffer = Read32(OUT, info->mask_scl_reg); buffer &= ~(1 << 16); @@ -304,14 +307,11 @@ lock_i2c(void* cookie, bool lock) Write32(OUT, info->en_sda_reg, buffer); // mask GPIO pins for software use - // TODO : we should use the mask... but it doesn't work for some reason - // buffer = Read32(OUT, info->mask_scl_reg); + buffer = Read32(OUT, info->mask_scl_reg); if (lock == true) { - buffer = 1; - //buffer |= info->mask_scl_mask; + buffer |= info->mask_scl_mask; } else { - buffer = 0; - //buffer &= ~info->mask_scl_mask; + buffer &= ~info->mask_scl_mask; } Write32(OUT, info->mask_scl_reg, buffer); @@ -319,16 +319,13 @@ lock_i2c(void* cookie, bool lock) buffer = Read32(OUT, info->mask_sda_reg); if (lock == true) { - buffer = 1; - // buffer |= info->mask_sda_mask; + buffer |= info->mask_sda_mask; } else { - buffer = 0; - // buffer &= ~info->mask_sda_mask; + buffer &= ~info->mask_sda_mask; } Write32(OUT, info->mask_sda_reg, buffer); Read32(OUT, info->mask_sda_reg); - } @@ -337,15 +334,14 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) { gpio_info *info = (gpio_info*)cookie; - uint32 scl = Read32(OUT, info->y_scl_reg) & info->y_scl_mask; - uint32 sda = Read32(OUT, info->y_sda_reg) & info->y_sda_mask; + uint32 scl = Read32(OUT, info->y_scl_reg); + scl &= info->y_scl_mask; + uint32 sda = Read32(OUT, info->y_sda_reg); + sda &= info->y_sda_mask; *_clock = (scl != 0); *_data = (sda != 0); - //TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", - // __func__, info->i2c_slave_addr, *_clock, *_data); - return B_OK; } @@ -363,11 +359,8 @@ set_i2c_signals(void* cookie, int clock, int data) scl |= clock ? 0 : info->en_scl_mask; sda |= data ? 0 : info->en_sda_mask; - Write32(OUT, info->a_scl_reg, clock); - Write32(OUT, info->a_sda_reg, data); - - //TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n", - // __func__, info->i2c_slave_addr, clock, data); + Write32(OUT, info->en_scl_reg, scl); + Write32(OUT, info->en_sda_reg, sda); return B_OK; } From 0d890a6821487ef6392c9bff9d8258a4ea85a60f Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 26 Sep 2011 20:32:55 +0000 Subject: [PATCH 310/702] Do some minimal sanity checks on the message data. Avoids trying to allocate random amounts of memory when getting an invalid header. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42770 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/value/value_nodes/BMessageValueNode.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp index 57ca04db45..65582d31ef 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include "Architecture.h" @@ -259,6 +260,10 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, if (error != B_OK) return error; + if (fHeader->format != MESSAGE_FORMAT_HAIKU + || (fHeader->flags & MESSAGE_FLAG_VALID) == 0) + return B_NOT_A_MESSAGE; + if (fIsFlatMessage) what.SetTo(fHeader->what); else From 2815c2d2c6e5e19b33c420556a58d752131c2d81 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 27 Sep 2011 14:11:03 +0000 Subject: [PATCH 311/702] Use the device name instead of the "external name" as the interface in network monitor messages. Due to how our compatibility layer works the latter is always just "wlan" (and even if it worked as expected it'd be mapped to the BSD short names i.e. "iwn" or "iwnX"). The device name is of the format "net//X", which is what we use as interface names througout the API (minus the "/dev/"). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42771 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp b/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp index 9bc487afd4..9cccdbb17d 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211_haiku.cpp @@ -590,7 +590,7 @@ ieee80211_notify_node_join(struct ieee80211_node* ni, int newassoc) KMessage message; message.SetTo(messageBuffer, sizeof(messageBuffer), B_NETWORK_MONITOR); message.AddInt32("opcode", B_NETWORK_WLAN_JOINED); - message.AddString("interface", ifp->if_xname); + message.AddString("interface", ifp->device_name); // TODO: add data about the node sNotificationModule->send_notification(&message); @@ -614,7 +614,7 @@ ieee80211_notify_node_leave(struct ieee80211_node* ni) KMessage message; message.SetTo(messageBuffer, sizeof(messageBuffer), B_NETWORK_MONITOR); message.AddInt32("opcode", B_NETWORK_WLAN_LEFT); - message.AddString("interface", ifp->if_xname); + message.AddString("interface", ifp->device_name); // TODO: add data about the node sNotificationModule->send_notification(&message); @@ -635,7 +635,7 @@ ieee80211_notify_scan_done(struct ieee80211vap* vap) KMessage message; message.SetTo(messageBuffer, sizeof(messageBuffer), B_NETWORK_MONITOR); message.AddInt32("opcode", B_NETWORK_WLAN_SCANNED); - message.AddString("interface", vap->iv_ifp->if_xname); + message.AddString("interface", vap->iv_ifp->device_name); sNotificationModule->send_notification(&message); } From 4a0f028c4dd88fa01600e5f6b8c4788db559bf96 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 27 Sep 2011 20:08:46 +0000 Subject: [PATCH 312/702] * perform some i2c cleanup from xorg ati driver * read gpio pins back after setting them to improve reliability git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42772 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 39 ++++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 6db876c5cd..242431f5c2 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -285,20 +285,22 @@ lock_i2c(void* cookie, bool lock) uint32 buffer = 0; - // hw_capable and > DCE3 - if (info->hw_capable == true - && sinfo.device_chipset >= (RADEON_R600 | 0x20)) { - // Switch GPIO pads to ddc mode - buffer = Read32(OUT, info->mask_scl_reg); - buffer &= ~(1 << 16); - Write32(OUT, info->mask_scl_reg, buffer); - } + if (lock == true) { + // hw_capable and > DCE3 + if (info->hw_capable == true + && sinfo.device_chipset >= (RADEON_R600 | 0x20)) { + // Switch GPIO pads to ddc mode + buffer = Read32(OUT, info->mask_scl_reg); + buffer &= ~(1 << 16); + Write32(OUT, info->mask_scl_reg, buffer); + } - // Clear pins - buffer = Read32(OUT, info->a_scl_reg) & ~info->a_scl_mask; - Write32(OUT, info->a_scl_reg, buffer); - buffer = Read32(OUT, info->a_sda_reg) & ~info->a_sda_mask; - Write32(OUT, info->a_sda_reg, buffer); + // Clear pins + buffer = Read32(OUT, info->a_scl_reg) & ~info->a_scl_mask; + Write32(OUT, info->a_scl_reg, buffer); + buffer = Read32(OUT, info->a_sda_reg) & ~info->a_sda_mask; + Write32(OUT, info->a_sda_reg, buffer); + } // Set pins to input buffer = Read32(OUT, info->en_scl_reg) & ~info->en_scl_mask; @@ -313,7 +315,6 @@ lock_i2c(void* cookie, bool lock) } else { buffer &= ~info->mask_scl_mask; } - Write32(OUT, info->mask_scl_reg, buffer); Read32(OUT, info->mask_scl_reg); @@ -323,7 +324,6 @@ lock_i2c(void* cookie, bool lock) } else { buffer &= ~info->mask_sda_mask; } - Write32(OUT, info->mask_sda_reg, buffer); Read32(OUT, info->mask_sda_reg); } @@ -353,14 +353,15 @@ set_i2c_signals(void* cookie, int clock, int data) uint32 scl = Read32(OUT, info->en_scl_reg) & ~info->en_scl_mask; + scl |= clock ? 0 : info->en_scl_mask; + Write32(OUT, info->en_scl_reg, scl); + Read32(OUT, info->en_scl_reg); + uint32 sda = Read32(OUT, info->en_sda_reg) & ~info->en_sda_mask; - - scl |= clock ? 0 : info->en_scl_mask; sda |= data ? 0 : info->en_sda_mask; - - Write32(OUT, info->en_scl_reg, scl); Write32(OUT, info->en_sda_reg, sda); + Read32(OUT, info->en_sda_reg); return B_OK; } From dd295058932cfb721aff7b714256dd9e5c334952 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 27 Sep 2011 21:34:28 +0000 Subject: [PATCH 313/702] * remap GPIO pin storage to global struct as they really aren't tied to a connector. (thus allowing for future non-ddc gpio devices like fan speed) * map all i2c gpio pins on accelerant init * use a smaller sub function to attach gpio info to connector i2c info git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42773 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 22 ++++- .../accelerants/radeon_hd/accelerant.h | 11 +-- src/add-ons/accelerants/radeon_hd/display.cpp | 14 +-- src/add-ons/accelerants/radeon_hd/gpu.cpp | 87 +++++++++++-------- src/add-ons/accelerants/radeon_hd/gpu.h | 3 +- 5 files changed, 87 insertions(+), 50 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 2114052968..64a0da7a13 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -42,6 +42,7 @@ struct accelerant_info *gInfo; display_info *gDisplay[MAX_DISPLAY]; connector_info *gConnector[ATOM_MAX_SUPPORTED_DEVICE]; +gpio_info *gGPIOInfo[ATOM_MAX_SUPPORTED_DEVICE]; class AreaCloner { @@ -133,6 +134,14 @@ init_common(int device, bool isClone) memset(gConnector[id], 0, sizeof(connector_info)); } + // malloc for card gpio pin information + for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { + gGPIOInfo[id] = (gpio_info *)malloc(sizeof(gpio_info)); + + if (gGPIOInfo[id] == NULL) + return B_NO_MEMORY; + memset(gGPIOInfo[id], 0, sizeof(gpio_info)); + } gInfo->is_clone = isClone; gInfo->device = device; @@ -218,8 +227,10 @@ uninit_common(void) } } - for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) + for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { free(gConnector[id]); + free(gGPIOInfo[id]); + } } @@ -243,19 +254,28 @@ radeon_init_accelerant(int device) radeon_init_bios(gInfo->rom); + // detect GPIO pins + radeon_gpu_gpio_setup(); + + // detect physical connectors status = detect_connectors(); if (status != B_OK) { TRACE("%s: couldn't detect supported connectors!\n", __func__); return status; } + // print found connectors debug_connectors(); + // detect attached displays status = detect_displays(); //if (status != B_OK) // return status; + + // print found displays debug_displays(); + // create initial list of video modes status = create_mode_list(); //if (status != B_OK) { // radeon_uninit_accelerant(); diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 348beca362..6f228c4bc5 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -138,11 +138,11 @@ struct pll_info { }; -struct gpio_info { +typedef struct { bool valid; - bool hw_capable; - uint8 i2c_slave_addr; + bool hw_capable; + uint32 hw_line; uint32 mask_scl_reg; uint32 mask_sda_reg; @@ -163,7 +163,7 @@ struct gpio_info { uint32 a_sda_reg; uint32 a_scl_mask; uint32 a_sda_mask; -}; +} gpio_info; typedef struct { @@ -172,7 +172,7 @@ typedef struct { uint16 connector_flags; uint32 connector_type; uint16 connector_object_id; - gpio_info connector_gpio; + uint16 connector_gpio_id; uint32 encoder_type; uint16 encoder_object_id; // TODO struct radeon_hpd hpd; @@ -205,6 +205,7 @@ extern accelerant_info *gInfo; extern atom_context *gAtomContext; extern display_info *gDisplay[MAX_DISPLAY]; extern connector_info *gConnector[ATOM_MAX_SUPPORTED_DEVICE]; +extern gpio_info *gGPIOInfo[ATOM_MAX_SUPPORTED_DEVICE]; // register access diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index adfde16b88..faaa8eb5a5 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -563,11 +563,9 @@ detect_connectors() i2c_config = (ATOM_I2C_ID_CONFIG_ACCESS *) &i2c_record->sucI2cId; - - // set up i2c gpio information for connector - radeon_gpu_i2c_setup(connector_index, + // attach i2c gpio information for connector + radeon_gpu_i2c_attach(connector_index, i2c_config->ucAccess); - break; case ATOM_HPD_INT_RECORD_TYPE: // TODO : HPD (Hot Plug) @@ -702,13 +700,15 @@ debug_connectors() if (gConnector[id]->valid == true) { uint32 connector_type = gConnector[id]->connector_type; uint32 encoder_type = gConnector[id]->encoder_type; + uint16 gpio_id = gConnector[id]->connector_gpio_id; ERROR("Connector #%" B_PRIu32 ")\n", id); ERROR(" + connector: %s\n", get_connector_name(connector_type)); ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); - ERROR(" + i2c slave address: 0x%" B_PRIX8 "\n", - gConnector[id]->connector_gpio.i2c_slave_addr); + ERROR(" + gpio id: %" B_PRIu16 "\n", gpio_id); ERROR(" + gpio valid: %s\n", - (gConnector[id]->connector_gpio.valid) ? "true" : "false"); + gGPIOInfo[gpio_id]->valid ? "true" : "false"); + ERROR(" + hw line: 0x%" B_PRIX32 "\n", + gGPIOInfo[gpio_id]->hw_line); } } ERROR("==========================================\n"); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 242431f5c2..d54f2fca9d 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -371,13 +371,15 @@ bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid) { // ensure things are sane - if (gConnector[connector]->connector_gpio.valid == false) + uint32 gpio_id = gConnector[connector]->connector_gpio_id; + if (gGPIOInfo[gpio_id]->valid == false) return false; i2c_bus bus; ddc2_init_timing(&bus); - bus.cookie = (void*)&gConnector[connector]->connector_gpio; + //bus.cookie = (void*)&gConnector[connector]->connector_gpio; + bus.cookie = (void*)gGPIOInfo[gpio_id]; bus.set_signals = &set_i2c_signals; bus.get_signals = &get_i2c_signals; @@ -396,12 +398,25 @@ radeon_gpu_read_edid(uint32 connector, edid1_info *edid) status_t -radeon_gpu_i2c_setup(uint32 id, uint8 i2c_slave_addr) +radeon_gpu_i2c_attach(uint32 id, uint8 hw_line) { - // aka radeon_lookup_i2c_gpio - TRACE("%s: Path #%" B_PRId32 ": i2c slave: 0x%" B_PRIx8 "\n", __func__, - id, i2c_slave_addr); + gConnector[id]->connector_gpio_id = 0; + for (uint32 i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { + if (gGPIOInfo[i]->hw_line != hw_line) + continue; + gConnector[id]->connector_gpio_id = i; + return B_OK; + } + TRACE("%s: couldn't find GPIO for connector %" B_PRIu32 "\n", + __func__, id); + return B_ERROR; +} + + +status_t +radeon_gpu_gpio_setup() +{ int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); uint8 frev; uint8 crev; @@ -412,7 +427,6 @@ radeon_gpu_i2c_setup(uint32 id, uint8 i2c_slave_addr) &offset) != B_OK) { ERROR("%s: could't read GPIO_I2C_Info table from AtomBIOS index %d!\n", __func__, index); - gConnector[id]->connector_gpio.valid = false; return B_ERROR; } @@ -422,72 +436,73 @@ radeon_gpu_i2c_setup(uint32 id, uint8 i2c_slave_addr) uint32 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / sizeof(ATOM_GPIO_I2C_ASSIGMENT); + if (num_indices > ATOM_MAX_SUPPORTED_DEVICE) { + ERROR("%s: ERROR: AtomBIOS contains more GPIO_Info items then I" + "was prepared for! (seen: %" B_PRIu32 "; max: %" B_PRIu32 ")\n", + __func__, num_indices, (uint32)ATOM_MAX_SUPPORTED_DEVICE); + return B_ERROR; + } + for (uint32 i = 0; i < num_indices; i++) { ATOM_GPIO_I2C_ASSIGMENT *gpio = &i2c_info->asGPIO_Info[i]; // TODO : if DCE 4 and i == 7 ... manual override for evergreen // TODO : if DCE 3 and i == 4 ... manual override - if (gpio->sucI2cId.ucAccess != i2c_slave_addr) - continue; - // populate gpio information - // TODO : what is hw_capable? - gConnector[id]->connector_gpio.hw_capable + gGPIOInfo[i]->hw_line + = gpio->sucI2cId.ucAccess; + gGPIOInfo[i]->hw_capable = (gpio->sucI2cId.sbfAccess.bfHW_Capable) ? true : false; - // slave address of i2c endpoint - gConnector[id]->connector_gpio.i2c_slave_addr = i2c_slave_addr; - // GPIO mask (Allows software to control the GPIO pad) // 0 = chip access; 1 = only software; - gConnector[id]->connector_gpio.mask_scl_reg + gGPIOInfo[i]->mask_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) * 4; - gConnector[id]->connector_gpio.mask_sda_reg + gGPIOInfo[i]->mask_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataMaskRegisterIndex) * 4; - gConnector[id]->connector_gpio.mask_scl_mask + gGPIOInfo[i]->mask_scl_mask = (1 << gpio->ucClkMaskShift); - gConnector[id]->connector_gpio.mask_sda_mask + gGPIOInfo[i]->mask_sda_mask = (1 << gpio->ucDataMaskShift); // GPIO output / write (A) enable // 0 = GPIO input (Y); 1 = GPIO output (A); - gConnector[id]->connector_gpio.en_scl_reg + gGPIOInfo[i]->en_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 4; - gConnector[id]->connector_gpio.en_sda_reg + gGPIOInfo[i]->en_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataEnRegisterIndex) * 4; - gConnector[id]->connector_gpio.en_scl_mask + gGPIOInfo[i]->en_scl_mask = (1 << gpio->ucClkEnShift); - gConnector[id]->connector_gpio.en_sda_mask + gGPIOInfo[i]->en_sda_mask = (1 << gpio->ucDataEnShift); // GPIO output / write (A) - gConnector[id]->connector_gpio.a_scl_reg + gGPIOInfo[i]->a_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 4; - gConnector[id]->connector_gpio.a_sda_reg + gGPIOInfo[i]->a_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) * 4; - gConnector[id]->connector_gpio.a_scl_mask + gGPIOInfo[i]->a_scl_mask = (1 << gpio->ucClkA_Shift); - gConnector[id]->connector_gpio.a_sda_mask + gGPIOInfo[i]->a_sda_mask = (1 << gpio->ucDataA_Shift); // GPIO input / read (Y) - gConnector[id]->connector_gpio.y_scl_reg + gGPIOInfo[i]->y_scl_reg = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 4; - gConnector[id]->connector_gpio.y_sda_reg + gGPIOInfo[i]->y_sda_reg = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) * 4; - gConnector[id]->connector_gpio.y_scl_mask + gGPIOInfo[i]->y_scl_mask = (1 << gpio->ucClkY_Shift); - gConnector[id]->connector_gpio.y_sda_mask + gGPIOInfo[i]->y_sda_mask = (1 << gpio->ucDataY_Shift); // ensure data is valid - gConnector[id]->connector_gpio.valid - = (gConnector[id]->connector_gpio.mask_scl_reg) ? true : false; + gGPIOInfo[i]->valid = (gGPIOInfo[i]->mask_scl_reg) ? true : false; - // see if we found what we were looking for - if (gConnector[id]->connector_gpio.valid == true) - break; + TRACE("%s: GPIO @ %" B_PRIu32 ", valid: %s, hw_line: 0x%" B_PRIX32 "\n", + __func__, i, gGPIOInfo[i]->valid ? "true" : "false", + gGPIOInfo[i]->hw_line); } return B_OK; diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index 9102d560b6..1de75e582b 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -168,8 +168,9 @@ void radeon_gpu_mc_resume(); uint32 radeon_gpu_mc_idlecheck(); status_t radeon_gpu_mc_setup(); status_t radeon_gpu_irq_setup(); +status_t radeon_gpu_gpio_setup(); +status_t radeon_gpu_i2c_attach(uint32 id, uint8 hw_line); bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid); -status_t radeon_gpu_i2c_setup(uint32 id, uint8 i2c_slave_addr); #endif From dd9a0d1d4bcecef47a04bd6d26e7f291277a5df6 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 28 Sep 2011 00:21:32 +0000 Subject: [PATCH 314/702] * Fill out the wireless network join request as detailed as possible, but don't fail when encountering missing information (like the password). This gives the supplicant an opportunity to ask for the required information as needed. * Remove (currently broken) WEP support from the net_server. It will be delegated to the supplicant as well, as that one already handles all the key/password conversion. In the absence of a supplicant the net_server can therefore only join open networks now. It will also only attempt that if it is sure that the network in question is actually an open network (by means of scan results or explicit configuration) and will otherwise delegate the join request. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42774 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/net/NetServer.cpp | 75 +++++++---------------------------- 1 file changed, 15 insertions(+), 60 deletions(-) diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp index 4eda704a49..88e172291d 100644 --- a/src/servers/net/NetServer.cpp +++ b/src/servers/net/NetServer.cpp @@ -151,22 +151,6 @@ set_80211(const char* name, int32 type, void* data, } -static int32 -translate_wep_key(const char*& buffer, char* key) -{ - memset(key, 0, IEEE80211_KEYBUF_SIZE); - - // TODO: support possibility to set them all - if (buffer[0] != '\0') { - int32 length = strlcpy(key, buffer, IEEE80211_KEYBUF_SIZE); - buffer += length; - return length; - } - - return 0; -} - - // #pragma mark - exported functions @@ -982,6 +966,8 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name) // Get network BNetworkDevice device(deviceName); wireless_network network; + + bool askForConfig = false; if ((address.Family() != AF_LINK || device.GetNetwork(address, network) != B_OK) && device.GetNetwork(name, network) != B_OK) { @@ -993,12 +979,14 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name) network.cipher = 0; network.group_cipher = 0; network.key_mode = 0; + askForConfig = true; } const char* string; if (message.FindString("authentication", &string) == B_OK || (found && networkMessage.FindString("authentication", &string) == B_OK)) { + askForConfig = false; if (!strcasecmp(string, "wpa2")) { network.authentication_mode = B_NETWORK_AUTHENTICATION_WPA2; network.key_mode = B_KEY_MODE_IEEE802_1X; @@ -1011,20 +999,14 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name) network.authentication_mode = B_NETWORK_AUTHENTICATION_WEP; network.key_mode = B_KEY_MODE_NONE; network.cipher = network.group_cipher = B_NETWORK_CIPHER_WEP_40; - } else if (strcasecmp(string, "none") && strcasecmp(string, "open")) + } else if (strcasecmp(string, "none") && strcasecmp(string, "open")) { fprintf(stderr, "%s: invalid authentication mode.\n", name); + askForConfig = true; + } } - // TODO: if password is still NULL, ask password manager once we have one - // TODO: remove the clear text settings password once we have - - if (password == NULL - && network.authentication_mode > B_NETWORK_AUTHENTICATION_NONE) - return B_NOT_ALLOWED; - - // Join the specified network with the specified authentication method - - if (network.authentication_mode < B_NETWORK_AUTHENTICATION_WPA) { + if (!askForConfig + && network.authentication_mode == B_NETWORK_AUTHENTICATION_NONE) { // we join the network ourselves status_t status = set_80211(deviceName, IEEE80211_IOC_SSID, network.name, strlen(network.name)); @@ -1034,39 +1016,6 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name) return status; } - if (network.authentication_mode == B_NETWORK_AUTHENTICATION_WEP) { - status = set_80211(deviceName, IEEE80211_IOC_WEP, NULL, 0, - IEEE80211_WEP_ON); - if (status != B_OK) { - fprintf(stderr, "%s: turning on WEP failed: %s\n", name, - strerror(status)); - return status; - } - - const char* buffer = password; - - // set key - for (int32 i = 0; i < 4; i++) { - char key[IEEE80211_KEYBUF_SIZE]; - int32 keyLength = translate_wep_key(buffer, key); - status = set_80211(deviceName, IEEE80211_IOC_WEPKEY, key, - keyLength); - if (status != B_OK) - break; - } - - if (status == B_OK) { - status = set_80211(deviceName, IEEE80211_IOC_WEPKEY, NULL, 0, - 0); - } - - if (status != B_OK) { - fprintf(stderr, "%s: setting WEP keys failed: %s\n", name, - strerror(status)); - return status; - } - } - return B_OK; } @@ -1084,6 +1033,12 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name) status = join.AddString("name", network.name); if (status == B_OK) status = join.AddFlat("address", &network.address); + if (status == B_OK && !askForConfig) + status = join.AddUInt32("authentication", network.authentication_mode); + if (status == B_OK && password != NULL) + status = join.AddString("password", password); + if (status != B_OK) + return status; BMessenger wpaSupplicant(kWPASupplicantSignature); BMessage reply; From e94e30ff788110f2cafe556f2d4eccfeb9da08ca Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 28 Sep 2011 00:33:45 +0000 Subject: [PATCH 315/702] Add the wpa_supplicant optional package. It should be stable and is working on the limited set of hardware I could test it with. By installing the wpa_supplicant one can now join WEP/WPA/WPA2 networks by either selecting them in the network prefs/network status applet or using "ifconfig join [password]". The wpa_supplicant opens a dialog asking for more details if it can't connect with the given information. Note that there is no way to automatically store that extra info right now, so it has to be provided on each join. The configuration can however be stored manually into the /boot/common/settings/network/wireless_networks config file. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42775 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalPackages | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 2db287c254..f9633e507f 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -90,7 +90,8 @@ if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1 # Welcome - introductory documentation to Haiku # WifiFirmwareScriptData - data files needed by install-wifi-firmwares.sh # WonderBrush - native graphics application -# WQY-MicroHei - Chinese font +# wpa_supplicant - a WPA Supplicant with support for WPA and WPA2 +# WQY-MicroHei - Chinese font # XZ-Utils - file archiving utility # Yasm - the assembler utility @@ -1750,6 +1751,22 @@ if [ IsOptionalHaikuImagePackageAdded WonderBrush ] { } +# wpa_supplicant +if [ IsOptionalHaikuImagePackageAdded wpa_supplicant ] { + if $(TARGET_ARCH) != x86 { + Echo "No optional package wpa_supplicant available for $(TARGET_ARCH)" ; + } else if $(HAIKU_GCC_VERSION[1]) >= 4) { + InstallOptionalHaikuImagePackage + wpa_supplicant-0.7.3-x86-gcc4-2011-09-27.zip + : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2011-09-27.zip ; + } else { + InstallOptionalHaikuImagePackage + wpa_supplicant-0.7.3-x86-gcc2-2011-09-27.zip + : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc2-2011-09-27.zip ; + } +} + + # WQY-MicroHei if [ IsOptionalHaikuImagePackageAdded WQY-MicroHei ] { InstallOptionalHaikuImagePackage From 17f2def171362c0c6de65ea0de4cf1ec4219b554 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 28 Sep 2011 13:06:48 +0000 Subject: [PATCH 316/702] Only call UserDefinedTimersRemoved if there actually are any. Should fix #7998. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42776 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/thread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/thread.cpp b/src/system/kernel/thread.cpp index 02a6acad67..7ced38ae93 100644 --- a/src/system/kernel/thread.cpp +++ b/src/system/kernel/thread.cpp @@ -465,7 +465,8 @@ void Thread::DeleteUserTimers(bool userDefinedOnly) { int32 count = fUserTimers.DeleteTimers(userDefinedOnly); - team->UserDefinedTimersRemoved(count); + if (count > 0) + team->UserDefinedTimersRemoved(count); } From 495a05fa9f70d0543df1b8e74e0a9bc6bb686875 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 29 Sep 2011 15:03:49 +0000 Subject: [PATCH 317/702] * reading through i2c specs, little comment cleanup * add a few notes for future i2c bit-bangers * cleanup of tracing * no real functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42777 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/i2c.c | 53 ++++++++++++++++------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/add-ons/accelerants/common/i2c.c b/src/add-ons/accelerants/common/i2c.c index ad70391d2e..8dede7b29c 100644 --- a/src/add-ons/accelerants/common/i2c.c +++ b/src/add-ons/accelerants/common/i2c.c @@ -14,6 +14,7 @@ #include #include + //#define TRACE_I2C #ifdef TRACE_I2C #ifdef __cplusplus @@ -26,7 +27,11 @@ void _sPrintf(const char *format, ...); #endif -//! Timining for 100kHz bus (fractional parts are rounded up) +/*! + I2c timings, rounded up (Phillips 1995 i2c bus specification, p20) +*/ + +//! Timing for standard mode i2c (100kHz max) const static i2c_timing kTiming100k = { .buf = 5, .hd_sta = 4, @@ -38,8 +43,8 @@ const static i2c_timing kTiming100k = { .r = 2, .f = 2, .su_sto = 4, - - // as these are unspecified, we use half a clock cycle as a safe guess + + // these are unspecified, use half a clock cycle as a safe guess .start_timeout = 5, .byte_timeout = 5, .bit_timeout = 5, @@ -47,8 +52,7 @@ const static i2c_timing kTiming100k = { .ack_timeout = 5 }; -// timing for 400 kHz bus -// (argh! heavy up-rounding here) +//! Timing for fast mode i2c (400kHz max) const static i2c_timing kTiming400k = { .buf = 2, .hd_sta = 1, @@ -60,8 +64,8 @@ const static i2c_timing kTiming400k = { .r = 1, .f = 1, .su_sto = 1, - - // see kTiming100k + + // these are unspecified, use half a clock cycle as a safe guess .start_timeout = 2, .byte_timeout = 2, .bit_timeout = 2, @@ -71,7 +75,7 @@ const static i2c_timing kTiming400k = { /*! - There's no spin in user space, but we need it to wait a couple + There's no spin in user space, but we need it to wait a couple of microseconds only (in this case, snooze has much too much overhead) */ @@ -121,7 +125,7 @@ send_start_condition(const i2c_bus *bus) status = wait_for_clk(bus, bus->timing.start_timeout); if (status != B_OK) { - TRACE("send_start_condition(): Timeout sending start condition\n"); + TRACE("%s: Timeout sending start condition\n", __func__); return status; } @@ -149,7 +153,7 @@ send_stop_condition(const i2c_bus *bus) // to make the slave release bus control status = wait_for_clk(bus, bus->timing.ack_timeout); if (status != B_OK) { - TRACE("send_stop_condition(): Timeout sending stop condition\n"); + TRACE("%s: Timeout sending stop condition\n", __func__); return status; } @@ -175,7 +179,7 @@ send_bit(const i2c_bus *bus, uint8 bit, int timeout) status = wait_for_clk(bus, timeout); if (status != B_OK) { - TRACE("send_bit(): Timeout when sending next bit\n"); + TRACE("%s: Timeout when sending next bit\n", __func__); return status; } @@ -201,7 +205,7 @@ send_acknowledge(const i2c_bus *bus) status = wait_for_clk(bus, bus->timing.ack_start_timeout); if (status != B_OK) { - TRACE("send_acknowledge(): Timeout when sending acknowledge\n"); + TRACE("%s: Timeout when sending acknowledge\n", __func__); return status; } @@ -218,8 +222,8 @@ send_acknowledge(const i2c_bus *bus) break; if (system_time() - startTime > bus->timing.ack_timeout) { - TRACE("send_acknowledge(): Slave didn't acknowledge byte within ack_timeout: %ld\n", - bus->timing.ack_timeout); + TRACE("%s: slave didn't acknowledge byte within ack_timeout: %ld\n", + __func__, bus->timing.ack_timeout); return B_TIMEOUT; } @@ -228,7 +232,7 @@ send_acknowledge(const i2c_bus *bus) TRACE("send_acknowledge(): Success!\n"); - // make sure we've waited at least t_high + // make sure we've waited at least t_high spin(bus->timing.high); bus->set_signals(bus->cookie, 0, 1); @@ -244,10 +248,10 @@ send_byte(const i2c_bus *bus, uint8 byte, bool acknowledge) { int i; - //TRACE("send_byte(byte = %x)\n", byte); + //TRACE("%s: (byte = %x)\n", __func__, byte); for (i = 7; i >= 0; --i) { - status_t status = send_bit(bus, byte >> i, + status_t status = send_bit(bus, byte >> i, i == 7 ? bus->timing.byte_timeout : bus->timing.bit_timeout); if (status != B_OK) return status; @@ -266,6 +270,7 @@ send_slave_address(const i2c_bus *bus, int slaveAddress, bool isWrite) { status_t status; + TRACE("%s: 0x%X\n", __func__, slaveAddress); status = send_byte(bus, (slaveAddress & 0xfe) | !isWrite, true); if (status != B_OK) return status; @@ -279,7 +284,7 @@ send_slave_address(const i2c_bus *bus, int slaveAddress, bool isWrite) // - 0000 1xxx |-> reserved // - 1111 1xxx | // - 1111 0xxx - 10 bit address (second byte contains remaining 8 bits) - + // the lsb is 0 for write and 1 for read (except for general call address) if ((slaveAddress & 0xff) != 0 && (slaveAddress & 0xf8) != 0xf0) return B_OK; @@ -302,7 +307,7 @@ receive_bit(const i2c_bus *bus, bool *bit, int timeout) // wait for slave to raise clock status = wait_for_clk(bus, timeout); if (status != B_OK) { - TRACE("receive_bit(): Timeout waiting for bit sent by slave\n"); + TRACE("%s: Timeout waiting for bit sent by slave\n", __func__); return status; } @@ -319,7 +324,7 @@ receive_bit(const i2c_bus *bus, bool *bit, int timeout) // let it settle and leave it low for minimal time // to make sure slave has finished bit transmission too - *bit = data; + *bit = data; return B_OK; } @@ -360,7 +365,7 @@ receive_byte(const i2c_bus *bus, uint8 *resultByte, bool acknowledge) static status_t send_bytes(const i2c_bus *bus, const uint8 *writeBuffer, ssize_t writeLength) { - TRACE("send_bytes(length = %ld)\n", writeLength); + TRACE("%s: (length = %ld)\n", __func__, writeLength); for (; writeLength > 0; --writeLength, ++writeBuffer) { status_t status = send_byte(bus, *writeBuffer, true); @@ -376,7 +381,7 @@ send_bytes(const i2c_bus *bus, const uint8 *writeBuffer, ssize_t writeLength) static status_t receive_bytes(const i2c_bus *bus, uint8 *readBuffer, ssize_t readLength) { - TRACE("receive_bytes(length = %ld)\n", readLength); + TRACE("%s: (length = %ld)\n", __func__, readLength); for (; readLength > 0; --readLength, ++readBuffer) { status_t status = receive_byte(bus, readBuffer, readLength > 1); @@ -423,7 +428,7 @@ i2c_send_receive(const i2c_bus *bus, int slaveAddress, const uint8 *writeBuffer, return send_stop_condition(bus); err: - TRACE("i2c_send_receive(): Cancelling transmission\n"); + TRACE("%s: Cancelling transmission\n", __func__); send_stop_condition(bus); return status; } @@ -432,6 +437,7 @@ err: void i2c_get100k_timing(i2c_timing *timing) { + // AKA standard i2c mode memcpy(timing, &kTiming100k, sizeof(i2c_timing)); } @@ -439,5 +445,6 @@ i2c_get100k_timing(i2c_timing *timing) void i2c_get400k_timing(i2c_timing *timing) { + // AKA fast i2c mode memcpy(timing, &kTiming400k, sizeof(i2c_timing)); } From f61b3e2026d71cbd2d021a1a2c9ee0b29faf7823 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 29 Sep 2011 15:08:44 +0000 Subject: [PATCH 318/702] * there's one 'l' in Philips * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42778 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/common/i2c.c b/src/add-ons/accelerants/common/i2c.c index 8dede7b29c..1847dddb59 100644 --- a/src/add-ons/accelerants/common/i2c.c +++ b/src/add-ons/accelerants/common/i2c.c @@ -28,7 +28,7 @@ void _sPrintf(const char *format, ...); /*! - I2c timings, rounded up (Phillips 1995 i2c bus specification, p20) + I2c timings, rounded up (Philips 1995 i2c bus specification, p20) */ //! Timing for standard mode i2c (100kHz max) From 0669ea37264ab51b41088106c850e4613c9e74ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 22:42:58 +0000 Subject: [PATCH 319/702] * Fixed setdecor build within the libbe_test environment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42779 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/Jamfile | 2 +- src/bin/setdecor.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/Jamfile b/src/bin/Jamfile index 3769a6b2ba..3c07b31b48 100644 --- a/src/bin/Jamfile +++ b/src/bin/Jamfile @@ -6,7 +6,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; AddSubDirSupportedPlatforms libbe_test ; -UsePrivateHeaders app shared storage support usb ; +UsePrivateHeaders app interface shared storage support usb ; UsePrivateSystemHeaders ; SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_cache ; UseLibraryHeaders ncurses ; diff --git a/src/bin/setdecor.cpp b/src/bin/setdecor.cpp index 273b787c18..bbb1dac0c4 100644 --- a/src/bin/setdecor.cpp +++ b/src/bin/setdecor.cpp @@ -11,10 +11,10 @@ #include #include #include -#include #include +#include -#include +#include void From e98a8505044adaeaddade6987a5185f66c7ed7ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 22:45:58 +0000 Subject: [PATCH 320/702] * Minor cleanup. * Removed non-Haiku compatibility code - it's just no longer needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42780 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/Utilities.cpp | 126 ++++++++++++++++----------------- 1 file changed, 60 insertions(+), 66 deletions(-) diff --git a/src/kits/tracker/Utilities.cpp b/src/kits/tracker/Utilities.cpp index fa409eb1c1..527fd54751 100644 --- a/src/kits/tracker/Utilities.cpp +++ b/src/kits/tracker/Utilities.cpp @@ -39,9 +39,7 @@ All rights reserved. #include "Utilities.h" #include "ContainerWindow.h" -#ifdef __HAIKU__ -# include -#endif +#include #include #include @@ -163,7 +161,8 @@ DisallowMetaKeys(BTextView *textView) PeriodicUpdatePoses::PeriodicUpdatePoses() - : fPoseList(20, true) + : + fPoseList(20, true) { fLock = new Benaphore("PeriodicUpdatePoses"); } @@ -235,6 +234,7 @@ PeriodicUpdatePoses::DoPeriodicUpdate(bool forceRedraw) PeriodicUpdatePoses gPeriodicUpdatePoses; + } // namespace BPrivate @@ -471,13 +471,13 @@ OffscreenBitmap::View() const namespace BPrivate { -/** Changes the alpha value of the given bitmap to create a nice - * horizontal fade out in the specified region. - * "from" is always transparent, "to" opaque. - */ - +/*! Changes the alpha value of the given bitmap to create a nice + horizontal fade out in the specified region. + "from" is always transparent, "to" opaque. +*/ void -FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, int32 to) +FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, + int32 to) { // check parameters if (width < 0 || height < 0 || from < 0 || to < 0) @@ -505,13 +505,13 @@ FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, int32 } -/** Changes the alpha value of the given bitmap to create a nice - * vertical fade out in the specified region. - * "from" is always transparent, "to" opaque. - */ - +/*! Changes the alpha value of the given bitmap to create a nice + vertical fade out in the specified region. + "from" is always transparent, "to" opaque. +*/ void -FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to) +FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, + int32 to) { // check parameters if (width < 0 || height < 0 || from < 0 || to < 0) @@ -541,6 +541,7 @@ FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to } } + } // namespace BPrivate @@ -550,7 +551,8 @@ FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType, icon_size size, const BMessage *message, BMessenger target, uint32 resizeMask, uint32 flags) - : BView(rect, name, resizeMask, flags), + : + BView(rect, name, resizeMask, flags), fMessage(*message), fTarget(target) { @@ -593,7 +595,7 @@ void DraggableIcon::AttachedToWindow() { BView *parent = Parent(); - if (parent) { + if (parent != NULL) { SetViewColor(parent->ViewColor()); SetLowColor(parent->LowColor()); } @@ -641,12 +643,8 @@ DraggableIcon::DragStarted(BMessage *) void DraggableIcon::Draw(BRect) { -#ifdef __HAIKU__ SetDrawingMode(B_OP_ALPHA); SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); -#else - SetDrawingMode(B_OP_OVER); -#endif DrawBitmap(fBitmap); } @@ -656,7 +654,8 @@ DraggableIcon::Draw(BRect) FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, const char *text, uint32 resizeFlags, uint32 flags) - : BStringView(bounds, name, text, resizeFlags, flags), + : + BStringView(bounds, name, text, resizeFlags, flags), fBitmap(NULL), fOrigBitmap(NULL) { @@ -665,7 +664,8 @@ FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, const char *text, BBitmap *inBitmap, uint32 resizeFlags, uint32 flags) - : BStringView(bounds, name, text, resizeFlags, flags), + : + BStringView(bounds, name, text, resizeFlags, flags), fBitmap(NULL), fOrigBitmap(inBitmap) { @@ -715,10 +715,8 @@ FlickerFreeStringView::Draw(BRect) edge_info eInfo; switch (Alignment()) { case B_ALIGN_LEFT: -#ifdef HAIKU_TARGET_PLATFORM_HAIKU case B_ALIGN_HORIZONTAL_UNSET: case B_ALIGN_USE_FULL_WIDTH: -#endif { // If the first char has a negative left edge give it // some more room by shifting that much more to the right. @@ -791,7 +789,8 @@ FlickerFreeStringView::SetLowColor(rgb_color color) TitledSeparatorItem::TitledSeparatorItem(const char *label) - : BMenuItem(label, 0) + : + BMenuItem(label, 0) { _inherited::SetEnabled(false); } @@ -858,7 +857,8 @@ TitledSeparatorItem::Draw() // first calculate the length of the stub part of the // divider line, so we can use it for secondStartX - float firstEndX = ((endX - startX) - maxStringWidth) / 2 - kStubToStringSlotX; + float firstEndX = ((endX - startX) - maxStringWidth) / 2 + - kStubToStringSlotX; if (firstEndX < 0) firstEndX = 0; @@ -902,7 +902,8 @@ TitledSeparatorItem::Draw() parent->GetFontHeight(&finfo); parent->SetLowColor(parent->ViewColor()); - BPoint loc(firstEndX + kStubToStringSlotX, ContentLocation().y + finfo.ascent); + BPoint loc(firstEndX + kStubToStringSlotX, + ContentLocation().y + finfo.ascent); parent->MovePenTo(loc + BPoint(1, 1)); parent->SetHighColor(ShiftMenuBackgroundColor(B_DARKEN_1_TINT)); @@ -921,7 +922,8 @@ TitledSeparatorItem::Draw() ShortcutFilter::ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier, uint32 shortcutWhat, BHandler *target) - : BMessageFilter(B_KEY_DOWN), + : + BMessageFilter(B_KEY_DOWN), fShortcutKey(shortcutKey), fShortcutModifier(shortcutModifier), fShortcutWhat(shortcutWhat), @@ -965,6 +967,7 @@ ShortcutFilter::Filter(BMessage *message, BHandler **) namespace BPrivate { + void EmbedUniqueVolumeInfo(BMessage *message, const BVolume *volume) { @@ -1143,7 +1146,8 @@ bool ContainsEntryRef(const BMessage *message, const entry_ref *ref) { entry_ref match; - for (int32 index = 0; (message->FindRef("refs", index, &match) == B_OK); index++) { + for (int32 index = 0; (message->FindRef("refs", index, &match) == B_OK); + index++) { if (*ref == match) return true; } @@ -1162,8 +1166,8 @@ EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *), typedef entry_ref *(*EachEntryIteratee)(entry_ref *, void *); const entry_ref * -EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *), - void *passThru) +EachEntryRef(const BMessage *message, + const entry_ref *(*func)(const entry_ref *, void *), void *passThru) { return EachEntryRefCommon(const_cast(message), (EachEntryIteratee)func, passThru, -1); @@ -1179,8 +1183,9 @@ EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *), const entry_ref * -EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *), - void *passThru, int32 maxCount) +EachEntryRef(const BMessage *message, + const entry_ref *(*func)(const entry_ref *, void *), void *passThru, + int32 maxCount) { return EachEntryRefCommon(const_cast(message), (EachEntryIteratee)func, passThru, maxCount); @@ -1229,26 +1234,6 @@ StringToScalar(const char *text) return val; } -#if B_BEOS_VERSION <= B_BEOS_VERSION_MAUI && !defined(__HAIKU__) - -bool -operator==(const rgb_color &a, const rgb_color &b) -{ - return a.red == b.red - && a.green == b.green - && a.blue == b.blue - && a.alpha == b.alpha; -} - - -bool -operator!=(const rgb_color &a, const rgb_color &b) -{ - return !operator==(a, b); -} - -#endif - static BRect LineBounds(BPoint where, float length, bool vertical) @@ -1265,8 +1250,10 @@ LineBounds(BPoint where, float length, bool vertical) } -SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical, const char *name) - : BView(LineBounds(where, length, vertical), name, +SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical, + const char *name) + : + BView(LineBounds(where, length, vertical), name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -1284,10 +1271,12 @@ SeparatorLine::Draw(BRect) BeginLineArray(2); if (vertical) { AddLine(bounds.LeftTop(), bounds.LeftBottom(), hiliteColor); - AddLine(bounds.LeftTop() + BPoint(1, 0), bounds.LeftBottom() + BPoint(1, 0), kWhite); + AddLine(bounds.LeftTop() + BPoint(1, 0), + bounds.LeftBottom() + BPoint(1, 0), kWhite); } else { AddLine(bounds.LeftTop(), bounds.RightTop(), hiliteColor); - AddLine(bounds.LeftTop() + BPoint(0, 1), bounds.RightTop() + BPoint(0, 1), kWhite); + AddLine(bounds.LeftTop() + BPoint(0, 1), + bounds.RightTop() + BPoint(0, 1), kWhite); } EndLineArray(); } @@ -1503,7 +1492,8 @@ EachMenuItem(BMenu *menu, bool recursive, BMenuItem *(*func)(BMenuItem *)) extern const BMenuItem * -EachMenuItem(const BMenu *menu, bool recursive, BMenuItem *(*func)(const BMenuItem *)) +EachMenuItem(const BMenu *menu, bool recursive, + BMenuItem *(*func)(const BMenuItem *)) { int32 count = menu->CountItems(); for (int32 index = 0; index < count; index++) { @@ -1525,14 +1515,15 @@ EachMenuItem(const BMenu *menu, bool recursive, BMenuItem *(*func)(const BMenuIt PositionPassingMenuItem::PositionPassingMenuItem(const char *title, BMessage *message, char shortcut, uint32 modifiers) - : BMenuItem(title, message, shortcut, modifiers) + : + BMenuItem(title, message, shortcut, modifiers) { } -PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu, - BMessage *message) - : BMenuItem(menu, message) +PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu, BMessage *message) + : + BMenuItem(menu, message) { } @@ -1639,7 +1630,8 @@ ComputeTypeAheadScore(const char *text, const char *match, bool wordMode) void -_ThrowOnError(status_t error, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line)) +_ThrowOnError(status_t error, const char *DEBUG_ONLY(file), + int32 DEBUG_ONLY(line)) { if (error != B_OK) { PRINT(("failing %s at %s:%d\n", strerror(error), file, (int)line)); @@ -1649,7 +1641,8 @@ _ThrowOnError(status_t error, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(lin void -_ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line)) +_ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file), + int32 DEBUG_ONLY(line)) { if (size < B_OK) { PRINT(("failing %s at %s:%d\n", strerror(size), file, (int)line)); @@ -1669,4 +1662,5 @@ _ThrowOnError(status_t error, const char *DEBUG_ONLY(debugString), } } + } // namespace BPrivate From 3f0171fff5cfe71c9114a95eefdbd31a677e1113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 22:46:35 +0000 Subject: [PATCH 321/702] * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42781 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Bitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/interface/Bitmap.cpp b/src/kits/interface/Bitmap.cpp index ed56794560..4a3b3986a7 100644 --- a/src/kits/interface/Bitmap.cpp +++ b/src/kits/interface/Bitmap.cpp @@ -1051,7 +1051,7 @@ BBitmap::_InitObject(BRect bounds, color_space colorSpace, uint32 flags, BPrivate::ServerMemoryAllocator* allocator = BApplication::Private::ServerAllocator(); - if (allocationFlags & kNewAllocatorArea) { + if ((allocationFlags & kNewAllocatorArea) != 0) { error = allocator->AddArea(fServerArea, fArea, fBasePointer, size); } else { From fbe9bdf09546aeed1753effae864baf91024bf51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 22:47:46 +0000 Subject: [PATCH 322/702] * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42782 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/vesa/mode.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/vesa/mode.cpp b/src/add-ons/accelerants/vesa/mode.cpp index 064b88f8f4..bdfe464efb 100644 --- a/src/add-ons/accelerants/vesa/mode.cpp +++ b/src/add-ons/accelerants/vesa/mode.cpp @@ -76,17 +76,16 @@ create_mode_list(void) const color_space kVesaSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE, B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8}; - display_mode* initialModes = NULL; uint32 initialModesCount = 0; // Add initial VESA modes. - initialModes = (display_mode*)malloc( + display_mode* initialModes = (display_mode*)malloc( sizeof(display_mode) * gInfo->shared_info->vesa_mode_count); if (initialModes != NULL) { initialModesCount = gInfo->shared_info->vesa_mode_count; vesa_mode* vesaModes = gInfo->vesa_modes; - for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) { + for (uint32 i = 0; i < initialModesCount; i++) { compute_display_timing(vesaModes[i].width, vesaModes[i].height, 60, false, &initialModes[i].timing); fill_display_mode(vesaModes[i].width, vesaModes[i].height, From e373834fe9cdaac94af7bf207c19ed32b381b2e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 22:48:46 +0000 Subject: [PATCH 323/702] * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42783 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp b/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp index c303dda3a5..cc43abb9ec 100644 --- a/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp +++ b/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp @@ -584,7 +584,7 @@ Aperture::AllocateMemory(aperture_memory *memory, uint32 flags) memory->allocating_thread = find_thread(NULL); #endif -#else +#else // !__HAIKU__ || GART_TEST void *address; memory->area = create_area("GART memory", &address, B_ANY_KERNEL_ADDRESS, size, B_FULL_LOCK | ((flags & B_APERTURE_NEED_PHYSICAL) != 0 From 12776185947b813cd389e97761c18f127d13e7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 22:51:03 +0000 Subject: [PATCH 324/702] * This should fix building the app_server test environment again (couldn't test yet, as my Haiku version is too old already). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42784 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/servers/app/Jamfile | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile index df8c05b7fe..596a0c0f65 100644 --- a/src/tests/servers/app/Jamfile +++ b/src/tests/servers/app/Jamfile @@ -18,15 +18,19 @@ UsePrivateHeaders [ FDirName graphics common ] ; # headers/build/private/kernel is needed for safemode.h and syscalls.h. # headers/private/kernel for the util/* stuff. UseHeaders [ FDirName $(HAIKU_TOP) headers build private kernel ] : true ; -UsePrivateHeaders kernel ; +UsePrivateHeaders kernel support ; local appServerDir = [ FDirName $(HAIKU_TOP) src servers app ] ; +UseHeaders [ FDirName $(appServerDir) decorator ] ; UseHeaders [ FDirName $(appServerDir) drawing ] ; UseHeaders [ FDirName $(appServerDir) drawing Painter ] ; UseHeaders [ FDirName $(appServerDir) drawing Painter drawing_modes ] ; UseHeaders [ FDirName $(appServerDir) drawing Painter font_support ] ; +UseHeaders [ FDirName $(appServerDir) font ] ; +UseHeaders [ FDirName $(appServerDir) stackandtile ] ; UseFreeTypeHeaders ; +UseLibraryHeaders agg lp_solve linprog ; # This overrides the definitions in private/servers/app/ServerConfig.h local defines = [ FDefines TEST_MODE=1 ] ; @@ -36,8 +40,11 @@ SubDirCcFlags $(defines) ; #-finstrument-functions ; #-fcheck-memory-usage -D_NO SubDirC++Flags $(defines) ; #-finstrument-functions ; #-fcheck-memory-usage -D_NO_INLINE_ASM ; SEARCH_SOURCE += $(appServerDir) ; +SEARCH_SOURCE += [ FDirName $(appServerDir) decorator ] ; SEARCH_SOURCE += [ FDirName $(appServerDir) drawing ] ; SEARCH_SOURCE += [ FDirName $(appServerDir) drawing Painter ] ; +SEARCH_SOURCE += [ FDirName $(appServerDir) font ] ; +SEARCH_SOURCE += [ FDirName $(appServerDir) stackandtile ] ; SharedLibrary libhwinterface.so : BBitmapBuffer.cpp @@ -71,6 +78,7 @@ SharedLibrary libtestappserver.so : CursorData.cpp CursorManager.cpp CursorSet.cpp + DesktopListener.cpp DesktopSettings.cpp DirectWindowInfo.cpp DrawState.cpp @@ -95,6 +103,14 @@ SharedLibrary libtestappserver.so : # drawing PatternHandler.cpp + # stack and tile + SATDecorator.cpp + SATGroup.cpp + SATWindow.cpp + StackAndTile.cpp + Stacking.cpp + Tiling.cpp + # trace.c # libraries From f9a7bd8e558c1bc0b197a9e2a58935aa823a5a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 23:19:49 +0000 Subject: [PATCH 325/702] * install-test-apps is now running through again. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42785 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/Jamfile | 1 + src/tests/servers/app/regularapps/Jamfile | 2 +- src/tests/servers/registrar/Jamfile | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/common/Jamfile b/src/add-ons/accelerants/common/Jamfile index fe844b2342..deaf3c3f91 100644 --- a/src/add-ons/accelerants/common/Jamfile +++ b/src/add-ons/accelerants/common/Jamfile @@ -1,6 +1,7 @@ SubDir HAIKU_TOP src add-ons accelerants common ; SetSubDirSupportedPlatformsBeOSCompatible ; +SetSubDirSupportedPlatforms libbe_test ; UsePrivateHeaders graphics ; UsePrivateHeaders [ FDirName graphics radeon ] ; diff --git a/src/tests/servers/app/regularapps/Jamfile b/src/tests/servers/app/regularapps/Jamfile index 12a72cf8b3..220fcd18d7 100644 --- a/src/tests/servers/app/regularapps/Jamfile +++ b/src/tests/servers/app/regularapps/Jamfile @@ -15,7 +15,7 @@ SimpleTest TestApp_Clock : cl_view.cpp cl_wind.cpp clock.cpp - : be $(TARGET_LIBSUPC++) + : be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) : Clock.rdef ; diff --git a/src/tests/servers/registrar/Jamfile b/src/tests/servers/registrar/Jamfile index 7011366573..5a3cf21962 100644 --- a/src/tests/servers/registrar/Jamfile +++ b/src/tests/servers/registrar/Jamfile @@ -113,8 +113,7 @@ Server test_registrar R5Compatibility.cpp : - be - $(TARGET_LIBSTDC++) + be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSTDC++) : registrar.rdef ; From 7e701a612adb56a16713fa4c9640f7034f80291c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 23:44:46 +0000 Subject: [PATCH 326/702] * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42786 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/gradients/GradientsView.cpp | 33 ++++++++++------------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/apps/gradients/GradientsView.cpp b/src/apps/gradients/GradientsView.cpp index 443c2d46e9..e8330e96ef 100644 --- a/src/apps/gradients/GradientsView.cpp +++ b/src/apps/gradients/GradientsView.cpp @@ -34,15 +34,15 @@ GradientsView::Draw(BRect update) case BGradient::TYPE_LINEAR: DrawLinear(update); break; - + case BGradient::TYPE_RADIAL: DrawRadial(update); break; - + case BGradient::TYPE_RADIAL_FOCUS: DrawRadialFocus(update); break; - + case BGradient::TYPE_DIAMOND: DrawDiamond(update); break; @@ -95,7 +95,7 @@ GradientsView::DrawLinear(BRect update) FillTriangle(BPoint(60, 230), BPoint(10, 330), BPoint(110, 330)); gradient.SetStart(BPoint(60, 230)); gradient.SetEnd(BPoint(60, 330)); - FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), + FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), gradient); // Ellipse @@ -111,24 +111,15 @@ void GradientsView::DrawRadial(BRect update) { BGradientRadial gradient; - rgb_color c; - c.red = 255; - c.green = 0; - c.blue = 0; - gradient.AddColor(c, 0); - c.red = 0; - c.green = 255; - c.blue = 0; - gradient.AddColor(c, 127); - c.red = 0; - c.green = 0; - c.blue = 255; - gradient.AddColor(c, 255); + gradient.AddColor(make_color(255, 0, 0), 0); + gradient.AddColor(make_color(0, 255, 0), 127); + gradient.AddColor(make_color(0, 0, 255), 255); // RoundRect SetHighColor(0, 0, 0); FillRoundRect(BRect(10, 10, 110, 110), 5, 5); gradient.SetCenter(BPoint(170, 60)); + gradient.SetRadius(50); FillRoundRect(BRect(120, 10, 220, 110), 5, 5, gradient); // Rect @@ -141,7 +132,7 @@ GradientsView::DrawRadial(BRect update) SetHighColor(0, 0, 0); FillTriangle(BPoint(60, 230), BPoint(10, 330), BPoint(110, 330)); gradient.SetCenter(BPoint(170, 280)); - FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), + FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), gradient); // Ellipse @@ -186,7 +177,7 @@ GradientsView::DrawRadialFocus(BRect update) SetHighColor(0, 0, 0); FillTriangle(BPoint(60, 230), BPoint(10, 330), BPoint(110, 330)); gradient.SetCenter(BPoint(170, 280)); - FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), + FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), gradient); // Ellipse @@ -231,7 +222,7 @@ GradientsView::DrawDiamond(BRect update) SetHighColor(0, 0, 0); FillTriangle(BPoint(60, 230), BPoint(10, 330), BPoint(110, 330)); gradient.SetCenter(BPoint(170, 280)); - FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), + FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), gradient); // Ellipse @@ -276,7 +267,7 @@ GradientsView::DrawConic(BRect update) SetHighColor(0, 0, 0); FillTriangle(BPoint(60, 230), BPoint(10, 330), BPoint(110, 330)); gradient.SetCenter(BPoint(170, 280)); - FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), + FillTriangle(BPoint(170, 230), BPoint(120, 330), BPoint(220, 330), gradient); // Ellipse From b6284c7f8a0b9de4ae9422fde052bcca21c6b1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Sep 2011 23:58:34 +0000 Subject: [PATCH 327/702] * Moved the SIMD code from AppServer.cpp to Painter.cpp where it is actually needed. It might be best to put it into its own file, though. * This is required in order to let our test environment work with the stricter runtime_loader we have now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42787 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/AppServer.cpp | 70 +----------------- src/servers/app/AppServer.h | 10 +-- src/servers/app/drawing/Painter/Painter.cpp | 82 ++++++++++++++++++++- src/servers/app/drawing/Painter/Painter.h | 30 +++----- 4 files changed, 95 insertions(+), 97 deletions(-) diff --git a/src/servers/app/AppServer.cpp b/src/servers/app/AppServer.cpp index 655fa03f42..76e09927c3 100644 --- a/src/servers/app/AppServer.cpp +++ b/src/servers/app/AppServer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku, Inc. + * Copyright 2001-2011, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -40,71 +40,6 @@ BTokenSpace gTokenSpace; uint32 gAppServerSIMDFlags = 0; -/*! Detect SIMD flags for use in AppServer. Checks all CPUs in the system - and chooses the minimum supported set of instructions. -*/ -static void -detect_simd() -{ -#if __INTEL__ - // Only scan CPUs for which we are certain the SIMD flags are properly - // defined. - const char* vendorNames[] = { - "GenuineIntel", - "AuthenticAMD", - "CentaurHauls", // Via CPUs, MMX and SSE support - "RiseRiseRise", // should be MMX-only - "CyrixInstead", // MMX-only, but custom MMX extensions - "GenuineTMx86", // MMX and SSE - 0 - }; - - system_info systemInfo; - if (get_system_info(&systemInfo) != B_OK) - return; - - // We start out with all flags set and end up with only those flags - // supported across all CPUs found. - uint32 appServerSIMD = 0xffffffff; - - for (int32 cpu = 0; cpu < systemInfo.cpu_count; cpu++) { - cpuid_info cpuInfo; - get_cpuid(&cpuInfo, 0, cpu); - - // Get the vendor string and terminate it manually - char vendor[13]; - memcpy(vendor, cpuInfo.eax_0.vendor_id, 12); - vendor[12] = 0; - - bool vendorFound = false; - for (uint32 i = 0; vendorNames[i] != 0; i++) { - if (strcmp(vendor, vendorNames[i]) == 0) - vendorFound = true; - } - - uint32 cpuSIMD = 0; - uint32 maxStdFunc = cpuInfo.regs.eax; - if (vendorFound && maxStdFunc >= 1) { - get_cpuid(&cpuInfo, 1, 0); - uint32 edx = cpuInfo.regs.edx; - if (edx & (1 << 23)) - cpuSIMD |= APPSERVER_SIMD_MMX; - if (edx & (1 << 25)) - cpuSIMD |= APPSERVER_SIMD_SSE; - } else { - // no flags can be identified - cpuSIMD = 0; - } - appServerSIMD &= cpuSIMD; - } - gAppServerSIMDFlags = appServerSIMD; -#endif // __INTEL__ -} - - -// #pragma mark - - - /*! \brief Constructor This loads the default fonts, allocates all the major global variables, @@ -128,9 +63,6 @@ AppServer::AppServer() sAppServer = this; - // Initialize SIMD flags - detect_simd(); - gInputManager = new InputManager(); // Create the font server and scan the proper directories. diff --git a/src/servers/app/AppServer.h b/src/servers/app/AppServer.h index cffa5b3fd4..6aaf5b5f56 100644 --- a/src/servers/app/AppServer.h +++ b/src/servers/app/AppServer.h @@ -1,8 +1,9 @@ /* - * Copyright (c) 2001-2005, Haiku, Inc. + * Copyright 2001-2011, Haiku, Inc. * Distributed under the terms of the MIT license. * - * Author: DarkWyrm + * Authors: + * DarkWyrm */ #ifndef APP_SERVER_H #define APP_SERVER_H @@ -54,12 +55,9 @@ class AppServer : public MessageLooper { BLocker fDesktopLock; }; + extern BitmapManager *gBitmapManager; extern port_id gAppServerPort; -extern uint32 gAppServerSIMDFlags; -// Defines for SIMD support. Early implementation, subject to change -#define APPSERVER_SIMD_MMX (1 << 0) -#define APPSERVER_SIMD_SSE (1 << 1) #endif /* APP_SERVER_H */ diff --git a/src/servers/app/drawing/Painter/Painter.cpp b/src/servers/app/drawing/Painter/Painter.cpp index 1a8ef424d9..d23a0a6d1a 100644 --- a/src/servers/app/drawing/Painter/Painter.cpp +++ b/src/servers/app/drawing/Painter/Painter.cpp @@ -81,8 +81,86 @@ using std::nothrow; #define CHECK_CLIPPING if (!fValidClipping) return BRect(0, 0, -1, -1); #define CHECK_CLIPPING_NO_RETURN if (!fValidClipping) return; +// Defines for SIMD support. +#define APPSERVER_SIMD_MMX (1 << 0) +#define APPSERVER_SIMD_SSE (1 << 1) + +// Prototypes for assembler routines +extern "C" { + void bilinear_scale_xloop_mmxsse(const uint8* src, void* dst, + void* xWeights, uint32 xmin, uint32 xmax, uint32 wTop, uint32 srcBPR); +} + +static uint32 detect_simd(); + +static uint32 sSIMDFlags = detect_simd(); + + +/*! Detect SIMD flags for use in AppServer. Checks all CPUs in the system + and chooses the minimum supported set of instructions. +*/ +static uint32 +detect_simd() +{ +#if __INTEL__ + // Only scan CPUs for which we are certain the SIMD flags are properly + // defined. + const char* vendorNames[] = { + "GenuineIntel", + "AuthenticAMD", + "CentaurHauls", // Via CPUs, MMX and SSE support + "RiseRiseRise", // should be MMX-only + "CyrixInstead", // MMX-only, but custom MMX extensions + "GenuineTMx86", // MMX and SSE + 0 + }; + + system_info systemInfo; + if (get_system_info(&systemInfo) != B_OK) + return 0; + + // We start out with all flags set and end up with only those flags + // supported across all CPUs found. + uint32 systemSIMD = 0xffffffff; + + for (int32 cpu = 0; cpu < systemInfo.cpu_count; cpu++) { + cpuid_info cpuInfo; + get_cpuid(&cpuInfo, 0, cpu); + + // Get the vendor string and terminate it manually + char vendor[13]; + memcpy(vendor, cpuInfo.eax_0.vendor_id, 12); + vendor[12] = 0; + + bool vendorFound = false; + for (uint32 i = 0; vendorNames[i] != 0; i++) { + if (strcmp(vendor, vendorNames[i]) == 0) + vendorFound = true; + } + + uint32 cpuSIMD = 0; + uint32 maxStdFunc = cpuInfo.regs.eax; + if (vendorFound && maxStdFunc >= 1) { + get_cpuid(&cpuInfo, 1, 0); + uint32 edx = cpuInfo.regs.edx; + if (edx & (1 << 23)) + cpuSIMD |= APPSERVER_SIMD_MMX; + if (edx & (1 << 25)) + cpuSIMD |= APPSERVER_SIMD_SSE; + } else { + // no flags can be identified + cpuSIMD = 0; + } + systemSIMD &= cpuSIMD; + } + return systemSIMD; +#endif // __INTEL__ +} + + +// #pragma mark - + -// constructor Painter::Painter() : fBuffer(), @@ -2314,7 +2392,7 @@ Painter::_DrawBitmapBilinearCopy32(agg::rendering_buffer& srcBuffer, int codeSelect = kUseDefaultVersion; uint32 neededSIMDFlags = APPSERVER_SIMD_MMX | APPSERVER_SIMD_SSE; - if ((gAppServerSIMDFlags & neededSIMDFlags) == neededSIMDFlags) + if ((sSIMDFlags & neededSIMDFlags) == neededSIMDFlags) codeSelect = kUseSIMDVersion; else { if (xScale == yScale && (xScale == 1.5 || xScale == 2.0 diff --git a/src/servers/app/drawing/Painter/Painter.h b/src/servers/app/drawing/Painter/Painter.h index 5192ceae65..645c95b6fc 100644 --- a/src/servers/app/drawing/Painter/Painter.h +++ b/src/servers/app/drawing/Painter/Painter.h @@ -7,10 +7,10 @@ * rendering pipe-lines for stroke, fills, bitmap and text rendering. * */ - #ifndef PAINTER_H #define PAINTER_H + #include "AGGTextRenderer.h" #include "FontManager.h" #include "PatternHandler.h" @@ -25,14 +25,6 @@ #include -// Prototypes for assembler routines -extern "C" { - void bilinear_scale_xloop_mmxsse(const uint8* src, void* dst, void* xWeights, - uint32 xmin, uint32 xmax, uint32 wTop, uint32 srcBPR ); -} - -extern uint32 gAppServerSIMDFlags; - class BBitmap; class BRegion; class BGradient; @@ -115,14 +107,14 @@ public: BRect FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, const BGradient& gradient) const; - + // polygons BRect DrawPolygon(BPoint* ptArray, int32 numPts, bool filled, bool closed) const; BRect FillPolygon(BPoint* ptArray, int32 numPts, const BGradient& gradient, bool closed) const; - + // bezier curves BRect DrawBezier(BPoint* controlPoints, bool filled) const; @@ -141,7 +133,7 @@ public: const BGradient& gradient, const BPoint& viewToScreenOffset, float viewScale) const; - + // rects BRect StrokeRect(const BRect& r) const; @@ -156,14 +148,14 @@ public: // fills a solid rect with color c, no blending void FillRect(const BRect& r, const rgb_color& c) const; - + // fills a rect with a linear gradient, the caller should be // sure that the gradient is indeed vertical. The start point of // the gradient should be above the end point, or this function // will not draw anything. void FillRectVerticalGradient(BRect r, const BGradientLinear& gradient) const; - + // fills a solid rect with color c, no blending, no clipping void FillRectNoClipping(const clipping_rect& r, const rgb_color& c) const; @@ -177,7 +169,7 @@ public: BRect FillRoundRect(const BRect& r, float xRadius, float yRadius, const BGradient& gradient) const; - + // ellipses void AlignEllipseRect(BRect* rect, bool filled) const; @@ -197,7 +189,7 @@ public: BRect FillArc(BPoint center, float xRadius, float yRadius, float angle, float span, const BGradient& gradient) const; - + // strings BRect DrawString(const char* utf8String, uint32 length, BPoint baseLine, @@ -310,7 +302,7 @@ private: void _MakeGradient(const BGradient& gradient, int32 colorCount, uint32* colors, int32 arrayOffset, int32 arraySize) const; - + template void _MakeGradient(Array& array, const BGradient& gradient) const; @@ -332,7 +324,7 @@ private: template void _FillPathGradientConic(VertexSource& path, const BGradientConic& conic) const; - + mutable agg::rendering_buffer fBuffer; // AGG rendering and rasterization classes @@ -404,5 +396,3 @@ Painter::AlignAndClipRect(BRect rect) const #endif // PAINTER_H - - From f74afb8218127ea96c3a7a89e846b4ff12777635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 30 Sep 2011 00:00:56 +0000 Subject: [PATCH 328/702] * This makes our app_server test_environment work again under Haiku. * A small quiz for our build system gurus: if I just add libbe_test to liblinprog.a, I can't build the normal app_server anymore (only in the test environment). Why is that? And who's going to fix it? :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42788 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/libs/linprog/Jamfile | 4 ++-- src/tests/servers/app/Jamfile | 40 ++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/libs/linprog/Jamfile b/src/libs/linprog/Jamfile index d6e60024f8..33b8124c14 100644 --- a/src/libs/linprog/Jamfile +++ b/src/libs/linprog/Jamfile @@ -1,12 +1,12 @@ SubDir HAIKU_TOP src libs linprog ; -SetSubDirSupportedPlatformsBeOSCompatible ; +SetSubDirSupportedPlatforms haiku haiku_host libbe_test ; UseLibraryHeaders lp_solve linprog ; UsePrivateHeaders shared ; -StaticLibrary liblinprog.a : +StaticLibrary liblinprog.a : ActiveSetSolver.cpp Constraint.cpp LayoutOptimizer.cpp diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile index 596a0c0f65..ce08d755e6 100644 --- a/src/tests/servers/app/Jamfile +++ b/src/tests/servers/app/Jamfile @@ -79,8 +79,8 @@ SharedLibrary libtestappserver.so : CursorManager.cpp CursorSet.cpp DesktopListener.cpp - DesktopSettings.cpp DirectWindowInfo.cpp + DrawingEngine.cpp DrawState.cpp FontCache.cpp FontCacheEntry.cpp @@ -101,35 +101,34 @@ SharedLibrary libtestappserver.so : SystemPalette.cpp # drawing + drawing_support.cpp PatternHandler.cpp - # stack and tile - SATDecorator.cpp - SATGroup.cpp - SATWindow.cpp - StackAndTile.cpp - Stacking.cpp - Tiling.cpp - # trace.c # libraries - : be libpainter.a libtextencoding.so libfreetype.so libshared.a + : be libpainter.a libagg.a libtextencoding.so libfreetype.so libshared.a ; AddResources test_app_server : app_server.rdef ; Server test_app_server : # Misc. Sources - Decorator.cpp ProfileMessageSupport.cpp EventDispatcher.cpp EventStream.cpp MessageLooper.cpp + # Decorator + Decorator.cpp + DecorManager.cpp + DefaultDecorator.cpp + DefaultWindowBehaviour.cpp + MagneticBorder.cpp + WindowBehaviour.cpp + # Manager Classes BitmapManager.cpp - DecorManager.cpp InputManager.cpp ScreenManager.cpp @@ -145,12 +144,11 @@ Server test_app_server : BitmapBuffer.cpp BitmapDrawingEngine.cpp drawing_support.cpp - DrawingEngine.cpp MallocBuffer.cpp + DesktopSettings.cpp VirtualScreen.cpp BitmapHWInterface.cpp - DefaultDecorator.cpp OffscreenServerWindow.cpp OffscreenWindow.cpp RegionPool.cpp @@ -163,11 +161,19 @@ Server test_app_server : Workspace.cpp WorkspacesView.cpp + # stack and tile + SATDecorator.cpp + SATGroup.cpp + SATWindow.cpp + StackAndTile.cpp + Stacking.cpp + Tiling.cpp + # libraries : - z libtestappserver.so libpainter.a be - libhwinterface.so libhwinterfaceimpl.so - libagg.a libfreetype.so libtextencoding.so + z libtestappserver.so be + libhwinterface.so libhwinterfaceimpl.so liblinprog.a + libfreetype.so libtextencoding.so $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) ; From a35bbf9fb38e83027b8e5679104c48a2942962ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 30 Sep 2011 00:02:22 +0000 Subject: [PATCH 329/702] * Coding style cleanup. * The Read() method remembers the last error, so you don't have to check each read when you do several in a row. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42789 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/LinkReceiver.cpp | 88 +++++++++++++++++++---------------- src/kits/app/ServerLink.cpp | 56 +++++++++++----------- 2 files changed, 77 insertions(+), 67 deletions(-) diff --git a/src/kits/app/LinkReceiver.cpp b/src/kits/app/LinkReceiver.cpp index 27d5219a5b..4928500da7 100644 --- a/src/kits/app/LinkReceiver.cpp +++ b/src/kits/app/LinkReceiver.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -9,7 +9,9 @@ * Artur Wyszynski */ -/** Class for low-overhead port-based messaging */ + +/*! Class for low-overhead port-based messaging */ + #include @@ -47,6 +49,7 @@ namespace BPrivate { + LinkReceiver::LinkReceiver(port_id port) : fReceivePort(port), fRecvBuffer(NULL), fRecvPosition(0), fRecvStart(0), @@ -233,7 +236,7 @@ LinkReceiver::ReadFromPort(bigtime_t timeout) } while (bytesRead == B_INTERRUPTED); } else { do { - bytesRead = read_port(fReceivePort, &code, fRecvBuffer, + bytesRead = read_port(fReceivePort, &code, fRecvBuffer, fRecvBufferSize); } while (bytesRead == B_INTERRUPTED); } @@ -297,7 +300,7 @@ LinkReceiver::Read(void *data, ssize_t passedSize) if (fReadError >= B_OK) { void* areaAddress = areaInfo.address; - + if (areaAddress && sourceArea >= B_OK) { memcpy(data, areaAddress, passedSize); delete_area(sourceArea); @@ -345,7 +348,7 @@ LinkReceiver::ReadString(char** _string, size_t* _length) if (_length) *_length = length; - + *_string = string; return B_OK; @@ -482,103 +485,106 @@ status_t LinkReceiver::ReadGradient(BGradient** _gradient) { GTRACE(("LinkReceiver::ReadGradient\n")); + BGradient::Type gradientType; int32 colorsCount; - status_t ret; - if ((ret = Read(&gradientType, sizeof(BGradient::Type))) != B_OK) - return ret; - if ((ret = Read(&colorsCount, sizeof(int32))) != B_OK) - return ret; + Read(&gradientType, sizeof(BGradient::Type)); + status_t status = Read(&colorsCount, sizeof(int32)); + if (status != B_OK) + return status; + BGradient* gradient = gradient_for_type(gradientType); if (!gradient) return B_NO_MEMORY; *_gradient = gradient; - + if (colorsCount > 0) { BGradient::ColorStop stop; for (int i = 0; i < colorsCount; i++) { - if ((ret = Read(&stop, sizeof(BGradient::ColorStop))) != B_OK) - return ret; + if ((status = Read(&stop, sizeof(BGradient::ColorStop))) != B_OK) + return status; if (!gradient->AddColorStop(stop, i)) return B_NO_MEMORY; } } - switch(gradientType) { - case BGradient::TYPE_LINEAR: { + switch (gradientType) { + case BGradient::TYPE_LINEAR: + { GTRACE(("LinkReceiver::ReadGradient> type == TYPE_LINEAR\n")); BGradientLinear* linear = (BGradientLinear*)gradient; BPoint start; BPoint end; - if ((ret = Read(&start, sizeof(BPoint))) != B_OK) - return ret; - if ((ret = Read(&end, sizeof(BPoint))) != B_OK) - return ret; + Read(&start, sizeof(BPoint)); + if ((status = Read(&end, sizeof(BPoint))) != B_OK) + return status; linear->SetStart(start); linear->SetEnd(end); return B_OK; } - case BGradient::TYPE_RADIAL: { + case BGradient::TYPE_RADIAL: + { GTRACE(("LinkReceiver::ReadGradient> type == TYPE_RADIAL\n")); BGradientRadial* radial = (BGradientRadial*)gradient; BPoint center; float radius; - if ((ret = Read(¢er, sizeof(BPoint))) != B_OK) - return ret; - if ((ret = Read(&radius, sizeof(float))) != B_OK) - return ret; + Read(¢er, sizeof(BPoint)); + if ((status = Read(&radius, sizeof(float))) != B_OK) + return status; radial->SetCenter(center); radial->SetRadius(radius); return B_OK; } - case BGradient::TYPE_RADIAL_FOCUS: { + case BGradient::TYPE_RADIAL_FOCUS: + { GTRACE(("LinkReceiver::ReadGradient> type == TYPE_RADIAL_FOCUS\n")); BGradientRadialFocus* radialFocus = (BGradientRadialFocus*)gradient; BPoint center; BPoint focal; float radius; - if ((ret = Read(¢er, sizeof(BPoint))) != B_OK) - return ret; - if ((ret = Read(&focal, sizeof(BPoint))) != B_OK) - return ret; - if ((ret = Read(&radius, sizeof(float))) != B_OK) - return ret; + Read(¢er, sizeof(BPoint)); + Read(&focal, sizeof(BPoint)); + if ((status = Read(&radius, sizeof(float))) != B_OK) + return status; radialFocus->SetCenter(center); radialFocus->SetFocal(focal); radialFocus->SetRadius(radius); return B_OK; } - case BGradient::TYPE_DIAMOND: { + case BGradient::TYPE_DIAMOND: + { GTRACE(("LinkReceiver::ReadGradient> type == TYPE_DIAMOND\n")); BGradientDiamond* diamond = (BGradientDiamond*)gradient; BPoint center; - if ((ret = Read(¢er, sizeof(BPoint))) != B_OK) - return ret; + if ((status = Read(¢er, sizeof(BPoint))) != B_OK) + return status; diamond->SetCenter(center); return B_OK; } - case BGradient::TYPE_CONIC: { + case BGradient::TYPE_CONIC: + { GTRACE(("LinkReceiver::ReadGradient> type == TYPE_CONIC\n")); BGradientConic* conic = (BGradientConic*)gradient; BPoint center; float angle; - if ((ret = Read(¢er, sizeof(BPoint))) != B_OK) - return ret; - if ((ret = Read(&angle, sizeof(float))) != B_OK) - return ret; + Read(¢er, sizeof(BPoint)); + if ((status = Read(&angle, sizeof(float))) != B_OK) + return status; conic->SetCenter(center); conic->SetAngle(angle); return B_OK; } - case BGradient::TYPE_NONE: { + case BGradient::TYPE_NONE: + { GTRACE(("LinkReceiver::ReadGradient> type == TYPE_NONE\n")); break; } } - + return B_ERROR; } + } // namespace BPrivate diff --git a/src/kits/app/ServerLink.cpp b/src/kits/app/ServerLink.cpp index f2f2fd9466..2c1b2af9f2 100644 --- a/src/kits/app/ServerLink.cpp +++ b/src/kits/app/ServerLink.cpp @@ -70,7 +70,7 @@ ServerLink::ReadRegion(BRegion* region) return fReceiver->Read(region->fData, region->fCount * sizeof(clipping_rect)); } - + return fReceiver->Read(®ion->fBounds, sizeof(clipping_rect)); } @@ -84,7 +84,7 @@ ServerLink::AttachRegion(const BRegion& region) return fSender->Attach(region.fData, region.fCount * sizeof(clipping_rect)); } - + return fSender->Attach(®ion.fBounds, sizeof(clipping_rect)); } @@ -95,15 +95,15 @@ ServerLink::ReadShape(BShape* shape) int32 opCount, ptCount; fReceiver->Read(&opCount, sizeof(int32)); fReceiver->Read(&ptCount, sizeof(int32)); - + uint32 opList[opCount]; if (opCount > 0) fReceiver->Read(opList, opCount * sizeof(uint32)); - + BPoint ptList[ptCount]; if (ptCount > 0) fReceiver->Read(ptList, ptCount * sizeof(BPoint)); - + shape->SetData(opCount, ptCount, opList, ptList); return B_OK; } @@ -115,9 +115,9 @@ ServerLink::AttachShape(BShape& shape) int32 opCount, ptCount; uint32* opList; BPoint* ptList; - + shape.GetData(&opCount, &ptCount, &opList, &ptList); - + fSender->Attach(&opCount, sizeof(int32)); fSender->Attach(&ptCount, sizeof(int32)); if (opCount > 0) @@ -135,7 +135,7 @@ ServerLink::ReadGradient(BGradient** _gradient) return fReceiver->ReadGradient(_gradient); } - + status_t ServerLink::AttachGradient(const BGradient& gradient) { @@ -152,30 +152,31 @@ ServerLink::AttachGradient(const BGradient& gradient) sizeof(BGradient::ColorStop)); } } - - switch(gradientType) { - case BGradient::TYPE_LINEAR: { + + switch (gradientType) { + case BGradient::TYPE_LINEAR: + { GTRACE(("ServerLink::AttachGradient> type == TYPE_LINEAR\n")); - const BGradientLinear* linear = (BGradientLinear*) &gradient; - BPoint start = linear->Start(); - BPoint end = linear->End(); - fSender->Attach(&start, sizeof(BPoint)); - fSender->Attach(&end, sizeof(BPoint)); + const BGradientLinear* linear = (BGradientLinear*)&gradient; + fSender->Attach(linear->Start()); + fSender->Attach(linear->End()); break; } - case BGradient::TYPE_RADIAL: { + case BGradient::TYPE_RADIAL: + { GTRACE(("ServerLink::AttachGradient> type == TYPE_RADIAL\n")); - const BGradientRadial* radial = (BGradientRadial*) &gradient; + const BGradientRadial* radial = (BGradientRadial*)&gradient; BPoint center = radial->Center(); float radius = radial->Radius(); fSender->Attach(¢er, sizeof(BPoint)); fSender->Attach(&radius, sizeof(float)); break; } - case BGradient::TYPE_RADIAL_FOCUS: { + case BGradient::TYPE_RADIAL_FOCUS: + { GTRACE(("ServerLink::AttachGradient> type == TYPE_RADIAL_FOCUS\n")); - const BGradientRadialFocus* radialFocus = - (BGradientRadialFocus*) &gradient; + const BGradientRadialFocus* radialFocus + = (BGradientRadialFocus*)&gradient; BPoint center = radialFocus->Center(); BPoint focal = radialFocus->Focal(); float radius = radialFocus->Radius(); @@ -184,23 +185,26 @@ ServerLink::AttachGradient(const BGradient& gradient) fSender->Attach(&radius, sizeof(float)); break; } - case BGradient::TYPE_DIAMOND: { + case BGradient::TYPE_DIAMOND: + { GTRACE(("ServerLink::AttachGradient> type == TYPE_DIAMOND\n")); - const BGradientDiamond* diamond = (BGradientDiamond*) &gradient; + const BGradientDiamond* diamond = (BGradientDiamond*)&gradient; BPoint center = diamond->Center(); fSender->Attach(¢er, sizeof(BPoint)); break; } - case BGradient::TYPE_CONIC: { + case BGradient::TYPE_CONIC: + { GTRACE(("ServerLink::AttachGradient> type == TYPE_CONIC\n")); - const BGradientConic* conic = (BGradientConic*) &gradient; + const BGradientConic* conic = (BGradientConic*)&gradient; BPoint center = conic->Center(); float angle = conic->Angle(); fSender->Attach(¢er, sizeof(BPoint)); fSender->Attach(&angle, sizeof(float)); break; } - case BGradient::TYPE_NONE: { + case BGradient::TYPE_NONE: + { GTRACE(("ServerLink::AttachGradient> type == TYPE_NONE\n")); break; } From ac592b5638eacb42d54eac071448bd0f4d049ec5 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Fri, 30 Sep 2011 01:11:24 +0000 Subject: [PATCH 330/702] Fixed the build under Haiku. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42790 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/Jamfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/common/Jamfile b/src/add-ons/accelerants/common/Jamfile index deaf3c3f91..6642a233d9 100644 --- a/src/add-ons/accelerants/common/Jamfile +++ b/src/add-ons/accelerants/common/Jamfile @@ -1,7 +1,7 @@ SubDir HAIKU_TOP src add-ons accelerants common ; SetSubDirSupportedPlatformsBeOSCompatible ; -SetSubDirSupportedPlatforms libbe_test ; +SetSubDirSupportedPlatforms haiku haiku_host libbe_test ; UsePrivateHeaders graphics ; UsePrivateHeaders [ FDirName graphics radeon ] ; From 114447597389da20cf4df4cec5cfa0e9afb716a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 30 Sep 2011 20:24:39 +0000 Subject: [PATCH 331/702] * Fixed build for non-x86 platforms. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42791 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/drawing/Painter/Painter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/servers/app/drawing/Painter/Painter.cpp b/src/servers/app/drawing/Painter/Painter.cpp index d23a0a6d1a..2dc6bb884c 100644 --- a/src/servers/app/drawing/Painter/Painter.cpp +++ b/src/servers/app/drawing/Painter/Painter.cpp @@ -5,10 +5,12 @@ * All rights reserved. Distributed under the terms of the MIT License. */ + /*! API to the Anti-Grain Geometry based "Painter" drawing backend. Manages rendering pipe-lines for stroke, fills, bitmap and text rendering. */ + #include "Painter.h" #include @@ -154,7 +156,9 @@ detect_simd() systemSIMD &= cpuSIMD; } return systemSIMD; -#endif // __INTEL__ +#else // !__INTEL__ + return 0; +#endif } From 70b41cd671256ac94c8ee459241b179bad8b3694 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 30 Sep 2011 20:25:05 +0000 Subject: [PATCH 332/702] * improve Nothern Islands PCI ID information using FreeBSD list of Radeon HD Cards * break tradition of sorting by chipset id because they really are not in any kind of order. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42792 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/driver.cpp | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index cd5bea94b1..1d65b645d4 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -144,17 +144,48 @@ const struct supported_device { // R2000 series (HD64xx - HD69xx) // Codename: Nothern Islands // Caicos - {0x6770, RADEON_R2000 | 0x00, true, "Radeon HD 6400"}, + {0x6760, RADEON_R2000 | 0x00, false, "Radeon HD 6470M"}, + {0x6761, RADEON_R2000 | 0x00, false, "Radeon HD 6430M"}, + {0x6762, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6763, RADEON_R2000 | 0x00, false, "Radeon HD E6460 Discreet"}, + {0x6764, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6765, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6766, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6767, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6768, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6770, RADEON_R2000 | 0x00, false, "Radeon HD 6400"}, {0x6779, RADEON_R2000 | 0x00, false, "Radeon HD 6450"}, // Turks + {0x6740, RADEON_R2000 | 0x10, false, "Radeon HD 6700M"}, + {0x6741, RADEON_R2000 | 0x10, false, "Radeon HD 6600M"}, + {0x6742, RADEON_R2000 | 0x10, false, "Radeon HD 6625M"}, + {0x6743, RADEON_R2000 | 0x10, false, "Radeon HD E6760 Discreet"}, + {0x6744, RADEON_R2000 | 0x10, false, "Radeon HD TURKS M"}, + {0x6745, RADEON_R2000 | 0x10, false, "Radeon HD TURKS M"}, + {0x6746, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, + {0x6747, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, + {0x6748, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, + {0x6749, RADEON_R2000 | 0x10, false, "FirePro v4900"}, {0x6759, RADEON_R2000 | 0x10, false, "Radeon HD 6570"}, - {0x6741, RADEON_R2000 | 0x10, true, "Radeon HD 6650M"}, // Barts {0x673e, RADEON_R2000 | 0x20, false, "Radeon HD 6790"}, {0x6739, RADEON_R2000 | 0x20, false, "Radeon HD 6850"}, {0x6738, RADEON_R2000 | 0x20, false, "Radeon HD 6870"}, // Cayman + {0x6700, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6701, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6702, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6703, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6704, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6705, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6706, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6707, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6708, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6709, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, {0x6718, RADEON_R2000 | 0x30, false, "Radeon HD 6970"}, + {0x6719, RADEON_R2000 | 0x30, false, "Radeon HD 6950"}, + {0x671C, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x671F, RADEON_R2000 | 0x30, false, "Radeon HD 6900"}, // Antilles {0x671d, RADEON_R2000 | 0x40, false, "Radeon HD 6990"} From ae347a6ce03d5b6b6fab6b955a847db5ec4a6d53 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 1 Oct 2011 03:07:33 +0000 Subject: [PATCH 333/702] * squash a *silly* bug don't set up a pointer and not malloc it. * small cleanups to radeon_hd i2c bit-banging code * i2c bit banging is now functioning git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42793 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.h | 2 +- src/add-ons/accelerants/radeon_hd/display.cpp | 2 +- src/add-ons/accelerants/radeon_hd/gpu.cpp | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 6f228c4bc5..2fefc8a350 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -189,7 +189,7 @@ typedef struct { uint32 hfreq_max; uint32 hfreq_min; pll_info pll; - edid1_info *edid_info; + edid1_info edid_info; } display_info; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index faaa8eb5a5..d82a0acdd1 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -629,7 +629,7 @@ detect_displays() if (displayIndex >= MAX_DISPLAY) continue; - if (radeon_gpu_read_edid(id, gDisplay[displayIndex]->edid_info)) { + if (radeon_gpu_read_edid(id, &gDisplay[displayIndex]->edid_info)) { gDisplay[displayIndex]->active = true; // set this display as active gDisplay[displayIndex]->connector_index = id; diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index d54f2fca9d..0569af3a9a 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -334,10 +334,10 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) { gpio_info *info = (gpio_info*)cookie; - uint32 scl = Read32(OUT, info->y_scl_reg); - scl &= info->y_scl_mask; - uint32 sda = Read32(OUT, info->y_sda_reg); - sda &= info->y_sda_mask; + uint32 scl = Read32(OUT, info->y_scl_reg) + & info->y_scl_mask; + uint32 sda = Read32(OUT, info->y_sda_reg) + & info->y_sda_mask; *_clock = (scl != 0); *_data = (sda != 0); @@ -378,7 +378,6 @@ radeon_gpu_read_edid(uint32 connector, edid1_info *edid) i2c_bus bus; ddc2_init_timing(&bus); - //bus.cookie = (void*)&gConnector[connector]->connector_gpio; bus.cookie = (void*)gGPIOInfo[gpio_id]; bus.set_signals = &set_i2c_signals; bus.get_signals = &get_i2c_signals; From 39bc159e6ebf1cb66068a5f1824f3033a62ba375 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 1 Oct 2011 03:11:21 +0000 Subject: [PATCH 334/702] * small bit of common i2c / ddc white space cleanup * small bit of tracing cleanup * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42794 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/ddc.c | 24 +++++++++++------------- src/add-ons/accelerants/common/i2c.c | 4 +++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/add-ons/accelerants/common/ddc.c b/src/add-ons/accelerants/common/ddc.c index 56b5b28fd0..8b1210c75a 100644 --- a/src/add-ons/accelerants/common/ddc.c +++ b/src/add-ons/accelerants/common/ddc.c @@ -18,7 +18,6 @@ #define READ_RETRIES 4 // number of retries to read ddc data - #define TRACE_DDC #ifdef TRACE_DDC extern void _sPrintf(const char* format, ...); @@ -28,7 +27,6 @@ extern void _sPrintf(const char* format, ...); #endif - //! Verify checksum of DDC data. static status_t verify_checksum(const uint8 *data, size_t len) @@ -43,12 +41,12 @@ verify_checksum(const uint8 *data, size_t len) } if (allOr == 0) { - TRACE("verify_checksum() DDC information contains zeros only\n"); + TRACE("%s: DDC information contains zeros only\n", __func__); return B_ERROR; } if (sum != 0) { - TRACE("verify_checksum() Checksum error in DDC information\n"); + TRACE("%s: Checksum error in DDC information\n", __func__); return B_IO_ERROR; } @@ -64,7 +62,7 @@ ddc2_read(const i2c_bus *bus, int start, uint8 *buffer, size_t length) uint8 writeBuffer[2]; int i; - writeBuffer[0] = start & 0xff; + writeBuffer[0] = start & 0xff; writeBuffer[1] = (start >> 8) & 0xff; for (i = 0; i < READ_RETRIES; ++i) { @@ -72,14 +70,14 @@ ddc2_read(const i2c_bus *bus, int start, uint8 *buffer, size_t length) start < 0x100 ? 1 : 2, buffer, length); if (status != B_OK) - TRACE("ddc2_read(): DDC information read failure\n"); + TRACE("%s: DDC information read failure\n", __func__); if (status == B_OK) { status = verify_checksum(buffer, length); if (status == B_OK) break; - dprintf("DDC checksum incorrect!\n"); + dprintf("%s: DDC checksum incorrect!\n", __func__); } } @@ -88,23 +86,23 @@ ddc2_read(const i2c_bus *bus, int start, uint8 *buffer, size_t length) /*! - Reading VDIF has not been tested. + Reading VDIF has not been tested. it seems that almost noone supports VDIF which makes testing hard, but what's the point anyway? */ #if 0 static status_t -ddc2_read_vdif(const i2c_bus *bus, int start, +ddc2_read_vdif(const i2c_bus *bus, int start, void **vdif, size_t *vdif_len) { status_t res; uint8 *data, *cur_data; int i; uint8 buffer[64]; - + *vdif = NULL; *vdif_len = 0; - + res = ddc2_read(bus, start, buffer, 64); SHOW_INFO(2, "%x", buffer[0]); if (res != B_OK || buffer[0] == 0) @@ -150,7 +148,7 @@ ddc2_init_timing(i2c_bus *bus) //! Read EDID and VDIF from monitor via ddc2 status_t -ddc2_read_edid1(const i2c_bus *bus, edid1_info *edid, +ddc2_read_edid1(const i2c_bus *bus, edid1_info *edid, void **vdif, size_t *vdifLength) { edid1_raw raw; @@ -159,7 +157,7 @@ ddc2_read_edid1(const i2c_bus *bus, edid1_info *edid, return status; if (raw.version.version != 1 || raw.version.revision > 4) { - TRACE("ddc2_read_edid1() EDID version or revision out of range\n"); + TRACE("%s: EDID version or revision out of range\n", __func__); return B_ERROR; } diff --git a/src/add-ons/accelerants/common/i2c.c b/src/add-ons/accelerants/common/i2c.c index 1847dddb59..c828a9614e 100644 --- a/src/add-ons/accelerants/common/i2c.c +++ b/src/add-ons/accelerants/common/i2c.c @@ -107,8 +107,10 @@ wait_for_clk(const i2c_bus *bus, bigtime_t timeout) if (clk != 0) return B_OK; - if (system_time() - startTime > timeout) + if (system_time() - startTime > timeout) { + TRACE("%s: Timeout waiting on clock (r)\n"); return B_TIMEOUT; + } spin(bus->timing.r); } From 2a77028057a41cf2a62855c9459cd67f4a603220 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 2 Oct 2011 21:25:15 +0000 Subject: [PATCH 335/702] Relax ensure_all_functions_matched() to assume no interrupt use when a device has no routing information but wasn't configured by the BIOS either. The function will now only panic if a device that was previously configured would not be so anymore after enabling the IO-APIC. Fixes #7971. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42795 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/irq_routing_table.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/system/kernel/arch/x86/irq_routing_table.cpp b/src/system/kernel/arch/x86/irq_routing_table.cpp index 4775649595..a9e46c7336 100644 --- a/src/system/kernel/arch/x86/irq_routing_table.cpp +++ b/src/system/kernel/arch/x86/irq_routing_table.cpp @@ -550,6 +550,14 @@ ensure_all_functions_matched(pci_module_info* pci, uint8 bus, } if (!matched) { + if (pci->read_pci_config(bus, device, function, + PCI_interrupt_line, 1) == 0) { + dprintf("assuming no interrupt use on PCI device" + " %u:%u:%u (bios irq 0, no routing information)\n", + bus, device, function); + continue; + } + panic("unable to find irq routing for PCI %u:%u:%u", bus, device, function); return B_ERROR; From f35af704c84cbdabe7106e6c5b422cb4d6dfa7ba Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 3 Oct 2011 00:15:04 +0000 Subject: [PATCH 336/702] * use bit-banged edid for monitor ranges * add function to set encoder to crtc * clean up some comments git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42796 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 154 +++++++++++++++++- src/add-ons/accelerants/radeon_hd/display.h | 1 + src/add-ons/accelerants/radeon_hd/mode.cpp | 8 +- 3 files changed, 154 insertions(+), 9 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index d82a0acdd1..42042d1751 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -195,9 +195,7 @@ init_registers(register_info* regs, uint8 crtid) status_t detect_crt_ranges(uint32 crtid) { - edid1_info *edid = &gInfo->shared_info->edid_info; - - // TODO : use radeon ddc to get to connector EDID instead of VESA + edid1_info *edid = &gDisplay[crtid]->edid_info; // Scan each VESA EDID description for monitor ranges for (uint32 index = 0; index < EDID1_NUM_DETAILED_MONITOR_DESC; index++) { @@ -325,7 +323,6 @@ status_t detect_connectors() { int index = GetIndexIntoMasterTable(DATA, Object_Header); - uint8 frev; uint8 crev; uint16 size; @@ -423,9 +420,9 @@ detect_connectors() int32 j; for (j = 0; j < ((B_LENDIAN_TO_HOST_INT16(path->usSize) - 8) / 2); j++) { - uint16 grph_obj_id - = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) - & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; + //uint16 grph_obj_id + // = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) + // & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; //uint8 grph_obj_num // = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & // ENUM_ID_MASK) >> ENUM_ID_SHIFT; @@ -529,7 +526,8 @@ detect_connectors() // drm_encoder_helper_add break; } - encoder_object_id = grph_obj_id; + //encoder_object_id = grph_obj_id; + encoder_object_id = encoder_id; } } } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { @@ -1092,3 +1090,143 @@ display_crtc_power(uint8 crt_id, int command) } +union crtc_source_param { + SELECT_CRTC_SOURCE_PS_ALLOCATION v1; + SELECT_CRTC_SOURCE_PARAMETERS_V2 v2; +}; + + +void +display_crtc_assign_encoder(uint8 crtc_id) +{ + int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source); + union crtc_source_param args; + uint8 frev; + uint8 crev; + + memset(&args, 0, sizeof(args)); + + if (atom_parse_cmd_header(gAtomContext, index, &frev, &crev) + != B_OK) + return; + + uint16 connector_index = gDisplay[crtc_id]->connector_index; + uint16 encoder_id = gConnector[connector_index]->encoder_object_id; + + switch (frev) { + case 1: + switch (crev) { + case 1: + default: + args.v1.ucCRTC = crtc_id; + switch (encoder_id) { + case ENCODER_OBJECT_ID_INTERNAL_TMDS1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: + args.v1.ucDevice = ATOM_DEVICE_DFP1_INDEX; + break; + case ENCODER_OBJECT_ID_INTERNAL_LVDS: + case ENCODER_OBJECT_ID_INTERNAL_LVTM1: + //if (radeon_encoder->devices + // & ATOM_DEVICE_LCD1_SUPPORT) + // args.v1.ucDevice = ATOM_DEVICE_LCD1_INDEX; + //else + args.v1.ucDevice = ATOM_DEVICE_DFP3_INDEX; + break; + case ENCODER_OBJECT_ID_INTERNAL_DVO1: + case ENCODER_OBJECT_ID_INTERNAL_DDI: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: + args.v1.ucDevice = ATOM_DEVICE_DFP2_INDEX; + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: + //if (radeon_encoder->active_device + // & (ATOM_DEVICE_TV_SUPPORT)) + // args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; + //else if (radeon_encoder->active_device + // & (ATOM_DEVICE_CV_SUPPORT)) + // args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; + //else + args.v1.ucDevice = ATOM_DEVICE_CRT1_INDEX; + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: + //if (radeon_encoder->active_device + // & (ATOM_DEVICE_TV_SUPPORT)) + // args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; + //else if (radeon_encoder->active_device + // & (ATOM_DEVICE_CV_SUPPORT)) + // args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; + //else + args.v1.ucDevice = ATOM_DEVICE_CRT2_INDEX; + break; + } + break; + case 2: + args.v2.ucCRTC = crtc_id; + args.v2.ucEncodeMode + = display_get_encoder_mode(connector_index); + switch (encoder_id) { + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: + ERROR("%s: DIG encoder not yet supported!\n", + __func__); + //dig = radeon_encoder->enc_priv; + //switch (dig->dig_encoder) { + // case 0: + // args.v2.ucEncoderID = ASIC_INT_DIG1_ENCODER_ID; + // break; + // case 1: + // args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID; + // break; + // case 2: + // args.v2.ucEncoderID = ASIC_INT_DIG3_ENCODER_ID; + // break; + // case 3: + // args.v2.ucEncoderID = ASIC_INT_DIG4_ENCODER_ID; + // break; + // case 4: + // args.v2.ucEncoderID = ASIC_INT_DIG5_ENCODER_ID; + // break; + // case 5: + // args.v2.ucEncoderID = ASIC_INT_DIG6_ENCODER_ID; + // break; + //} + break; + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: + args.v2.ucEncoderID = ASIC_INT_DVO_ENCODER_ID; + break; + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: + //if (radeon_encoder->active_device + // & (ATOM_DEVICE_TV_SUPPORT)) + // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + //else if (radeon_encoder->active_device + // & (ATOM_DEVICE_CV_SUPPORT)) + // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + //else + args.v2.ucEncoderID = ASIC_INT_DAC1_ENCODER_ID; + break; + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: + //if (radeon_encoder->active_device + // & (ATOM_DEVICE_TV_SUPPORT)) + // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + //else if (radeon_encoder->active_device + // & (ATOM_DEVICE_CV_SUPPORT)) + // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + //else + args.v2.ucEncoderID = ASIC_INT_DAC2_ENCODER_ID; + break; + } + break; + } + break; + default: + ERROR("%s: Unknown table version: %d, %d\n", __func__, frev, crev); + return; + } + + atom_execute_table(gAtomContext, index, (uint32*)&args); + + // TODO : encoder_crtc_scratch_regs? +} diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index d0fa8b0daf..3193f0686a 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -74,6 +74,7 @@ void display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode); void display_crtc_set(uint8 crtc_id, display_mode *mode); void display_crtc_set_dtd(uint8 crtc_id, display_mode *mode); void display_crtc_power(uint8 crt_id, int command); +void display_crtc_assign_encoder(uint8 crt_id); #endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 417d7690ec..bbf0448d24 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -38,6 +38,8 @@ extern "C" void _sPrintf(const char *format, ...); status_t create_mode_list(void) { + // TODO : multi-monitor? for now we use VESA and not gDisplay edid + const color_space kRadeonHDSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE, B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8}; @@ -80,6 +82,8 @@ radeon_get_mode_list(display_mode *modeList) status_t radeon_get_edid_info(void* info, size_t size, uint32* edid_version) { + // TODO : multi-monitor? for now we use VESA and not gDisplay edid + TRACE("%s\n", __func__); if (!gInfo->shared_info->has_edid) return B_ERROR; @@ -96,7 +100,7 @@ radeon_get_edid_info(void* info, size_t size, uint32* edid_version) status_t radeon_set_display_mode(display_mode *mode) { - // TODO : We set the same VESA EDID mode on each display + // TODO : multi-monitor? for now we use VESA and not gDisplay edid // Set mode on each display for (uint8 id = 0; id < MAX_DISPLAY; id++) { @@ -113,6 +117,8 @@ radeon_set_display_mode(display_mode *mode) // uint32 connector_type = gConnector[connector_index]->connector_type; uint32 encoder_type = gConnector[connector_index]->encoder_type; + display_crtc_assign_encoder(id); + // TODO : the first id is the pll we use... this won't work for // more then two monitors pll_set(id, mode->timing.pixel_clock, id); From 7c91a33c84935f6697e246a985730400ec976d61 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 3 Oct 2011 00:59:44 +0000 Subject: [PATCH 337/702] * RIP Radeon register banging Remove old non-atombios code * add encoder.c and encoder.h to handle encoder management * fix pll code to use encoder object id vs crtcid git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42797 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/Jamfile | 4 +- .../accelerants/radeon_hd/accelerant.h | 4 +- src/add-ons/accelerants/radeon_hd/dac.cpp | 390 ------------------ src/add-ons/accelerants/radeon_hd/dac.h | 32 -- src/add-ons/accelerants/radeon_hd/display.cpp | 140 ------- src/add-ons/accelerants/radeon_hd/display.h | 1 - src/add-ons/accelerants/radeon_hd/encoder.cpp | 172 ++++++++ src/add-ons/accelerants/radeon_hd/encoder.h | 15 + src/add-ons/accelerants/radeon_hd/lvds.cpp | 267 ------------ src/add-ons/accelerants/radeon_hd/lvds.h | 34 -- src/add-ons/accelerants/radeon_hd/mode.cpp | 39 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 4 +- src/add-ons/accelerants/radeon_hd/tmds.cpp | 233 ----------- src/add-ons/accelerants/radeon_hd/tmds.h | 19 - 14 files changed, 196 insertions(+), 1158 deletions(-) delete mode 100644 src/add-ons/accelerants/radeon_hd/dac.cpp delete mode 100644 src/add-ons/accelerants/radeon_hd/dac.h create mode 100644 src/add-ons/accelerants/radeon_hd/encoder.cpp create mode 100644 src/add-ons/accelerants/radeon_hd/encoder.h delete mode 100644 src/add-ons/accelerants/radeon_hd/lvds.cpp delete mode 100644 src/add-ons/accelerants/radeon_hd/lvds.h delete mode 100644 src/add-ons/accelerants/radeon_hd/tmds.cpp delete mode 100644 src/add-ons/accelerants/radeon_hd/tmds.h diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile b/src/add-ons/accelerants/radeon_hd/Jamfile index ffdf8dbef8..4d98f23328 100644 --- a/src/add-ons/accelerants/radeon_hd/Jamfile +++ b/src/add-ons/accelerants/radeon_hd/Jamfile @@ -13,13 +13,11 @@ Addon radeon_hd.accelerant : atom.cpp gpu.cpp accelerant.cpp + encoder.cpp engine.cpp hooks.cpp pll.cpp - dac.cpp display.cpp - tmds.cpp - lvds.cpp mode.cpp bios.cpp create_display_modes.cpp diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 2fefc8a350..f2dfbf600b 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -11,12 +11,10 @@ #include "atom.h" +#include "encoder.h" #include "mode.h" #include "radeon_hd.h" #include "pll.h" -#include "dac.h" -#include "tmds.h" -#include "lvds.h" #include diff --git a/src/add-ons/accelerants/radeon_hd/dac.cpp b/src/add-ons/accelerants/radeon_hd/dac.cpp deleted file mode 100644 index 94307f2c72..0000000000 --- a/src/add-ons/accelerants/radeon_hd/dac.cpp +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ - - -#include "accelerant_protos.h" -#include "accelerant.h" -#include "utility.h" -#include "dac.h" - - -#define TRACE_DAC -#ifdef TRACE_DAC -extern "C" void _sPrintf(const char *format, ...); -# define TRACE(x...) _sPrintf("radeon_hd: " x) -#else -# define TRACE(x...) ; -#endif - - -bool -dac_sense(uint32 connector_id) -{ - uint16 flags = gConnector[connector_id]->connector_flags; - - if (flags & (ATOM_DEVICE_CRT_SUPPORT - | ATOM_DEVICE_CV_SUPPORT - | ATOM_DEVICE_TV_SUPPORT)) { - - DAC_LOAD_DETECTION_PS_ALLOCATION args; - int index = GetIndexIntoMasterTable(COMMAND, DAC_LoadDetection); - uint8 frev, crev; - memset(&args, 0, sizeof(args)); - - if (!atom_parse_cmd_header(gAtomContext, index, &frev, &crev)) - return false; - - args.sDacload.ucMisc = 0; - - if ((flags & ENCODER_OBJECT_ID_INTERNAL_DAC1) - || (flags & ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1)) - args.sDacload.ucDacType = ATOM_DAC_A; - else - args.sDacload.ucDacType = ATOM_DAC_B; - - if (flags & ATOM_DEVICE_CRT1_SUPPORT) { - args.sDacload.usDeviceID - = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CRT1_SUPPORT); - } else if (flags & ATOM_DEVICE_CRT2_SUPPORT) { - args.sDacload.usDeviceID - = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CRT2_SUPPORT); - } else if (flags & ATOM_DEVICE_CV_SUPPORT) { - args.sDacload.usDeviceID - = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CV_SUPPORT); - if (crev >= 3) - args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; - } else if (flags & ATOM_DEVICE_TV1_SUPPORT) { - args.sDacload.usDeviceID - = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_TV1_SUPPORT); - if (crev >= 3) - args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; - } - - atom_execute_table(gAtomContext, index, (uint32*)&args); - - uint32 bios_0_scratch; - - bios_0_scratch = Read32(OUT, R600_BIOS_0_SCRATCH); - - if (flags & ATOM_DEVICE_CRT1_SUPPORT) { - if (bios_0_scratch & ATOM_S0_CRT1_MASK) - return true; - } - if (flags & ATOM_DEVICE_CRT2_SUPPORT) { - if (bios_0_scratch & ATOM_S0_CRT2_MASK) - return true; - } - if (flags & ATOM_DEVICE_CV_SUPPORT) { - if (bios_0_scratch & (ATOM_S0_CV_MASK|ATOM_S0_CV_MASK_A)) - return true; - } - if (flags & ATOM_DEVICE_TV1_SUPPORT) { - if (bios_0_scratch - & (ATOM_S0_TV1_COMPOSITE | ATOM_S0_TV1_COMPOSITE_A)) - return true; /* CTV */ - else if (bios_0_scratch & (ATOM_S0_TV1_SVIDEO | ATOM_S0_TV1_SVIDEO_A)) - return true; /* STV */ - } - } - return false; -} - - -void -DACGetElectrical(uint8 type, uint8 dac, - uint8 *bandgap, uint8 *whitefine) -{ - radeon_shared_info &info = *gInfo->shared_info; - - // These lookups are based on PCIID, maybe need - // to extract more from AtomBIOS? - struct - { - uint16 pciIdMin; - uint16 pciIdMax; - uint8 bandgap[2][4]; - uint8 whitefine[2][4]; - } list[] = { - { 0x791E, 0x791F, - { { 0x07, 0x07, 0x07, 0x07 }, - { 0x07, 0x07, 0x07, 0x07 } }, - { { 0x09, 0x09, 0x04, 0x09 }, - { 0x09, 0x09, 0x04, 0x09 } }, - }, - { 0x793F, 0x7942, - { { 0x09, 0x09, 0x09, 0x09 }, - { 0x09, 0x09, 0x09, 0x09 } }, - { { 0x0a, 0x0a, 0x08, 0x0a }, - { 0x0a, 0x0a, 0x08, 0x0a } }, - }, - { 0x9500, 0x9519, - { { 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00 } }, - { { 0x00, 0x00, 0x20, 0x00 }, - { 0x25, 0x25, 0x26, 0x26 } }, - }, - { 0, 0, - { { 0, 0, 0, 0 }, - { 0, 0, 0, 0 } }, - { { 0, 0, 0, 0 }, - { 0, 0, 0, 0 } } - } - }; - - *bandgap = 0; - *whitefine = 0; - - // TODO : ATOM BIOS Bandgap / Whitefine lookup - - if (*bandgap == 0 || *whitefine == 0) { - int i = 0; - while (list[i].pciIdMin != 0) { - if (list[i].pciIdMin <= info.device_id - && list[i].pciIdMax >= info.device_id) { - if (*bandgap == 0) - *bandgap = list[i].bandgap[dac][type]; - if (*whitefine == 0) - *whitefine = list[i].whitefine[dac][type]; - break; - } - i++; - } - if (list[i].pciIdMin != 0) { - TRACE("%s: found new BandGap / WhiteFine in table for card!\n", - __func__); - } - } -} - - -/* For Cards >= r620 */ -void -DACSetModern(uint8 dacIndex, uint32 crtid) -{ - bool istv = false; - - // BIG TODO : NTSC, PAL, ETC. We assume VGA for now - uint8 standard = FORMAT_VGA; /* VGA */ - uint32 mode = 2; - uint32 source = istv ? 0x2 : crtid; - - uint8 bandGap; - uint8 whiteFine; - DACGetElectrical(standard, dacIndex, &bandGap, &whiteFine); - - uint32 mask = 0; - if (bandGap) - mask |= 0xFF << 16; - if (whiteFine) - mask |= 0xFF << 8; - - uint32 dacOffset = dacIndex == 1 ? RV620_REG_DACA_OFFSET - : RV620_REG_DACB_OFFSET; - - Write32Mask(OUT, dacOffset + RV620_DACA_MACRO_CNTL, mode, 0xFF); - // no fine control yet - - Write32Mask(OUT, dacOffset + RV620_DACA_SOURCE_SELECT, source, 0x00000003); - - // enable tv if has TV mux(DACB) and istv - if (dacIndex) - Write32Mask(OUT, dacOffset + RV620_DACA_CONTROL2, istv << 8, 0x0100); - - // use fine control from white_fine control register - Write32Mask(OUT, dacOffset + RV620_DACA_AUTO_CALIB_CONTROL, 0x0, 0x4); - Write32Mask(OUT, dacOffset + RV620_DACA_BGADJ_SRC, 0x0, 0x30); - Write32Mask(OUT, dacOffset + RV620_DACA_MACRO_CNTL, - (bandGap << 16) | (whiteFine << 8), mask); - - // reset the FMT register - // TODO : ah-la external DxFMTSet - uint32 fmtOffset = crtid == 0 ? FMT1_REG_OFFSET : FMT2_REG_OFFSET; - Write32(OUT, fmtOffset + RV620_FMT1_BIT_DEPTH_CONTROL, 0); - - Write32Mask(OUT, fmtOffset + RV620_FMT1_CONTROL, 0, - RV62_FMT_PIXEL_ENCODING); - // 4:4:4 encoding - - Write32(OUT, fmtOffset + RV620_FMT1_CLAMP_CNTL, 0); - // disable color clamping -} - - -/* For Cards < r620 */ -void -DACSetLegacy(uint8 dacIndex, uint32 crtid) -{ - bool istv = false; - - // BIG TODO : NTSC, PAL, ETC. We assume VGA for now - uint8 standard = FORMAT_VGA; /* VGA */ - - uint8 bandGap; - uint8 whiteFine; - DACGetElectrical(standard, dacIndex, &bandGap, &whiteFine); - - uint32 mask = 0; - if (bandGap) - mask |= 0xFF << 16; - if (whiteFine) - mask |= 0xFF << 8; - - uint32 dacOffset = dacIndex == 1 ? REG_DACB_OFFSET : REG_DACA_OFFSET; - - Write32Mask(OUT, dacOffset + DACA_CONTROL1, standard, 0x000000FF); - /* white level fine adjust */ - Write32Mask(OUT, dacOffset + DACA_CONTROL1, (bandGap << 16) - | (whiteFine << 8), mask); - - if (istv) { - /* tv enable */ - if (dacIndex) /* TV mux only available on DACB */ - Write32Mask(OUT, dacOffset + DACA_CONTROL2, - 0x00000100, 0x0000FF00); - - /* select tv encoder */ - Write32Mask(OUT, dacOffset + DACA_SOURCE_SELECT, - 0x00000002, 0x00000003); - } else { - if (dacIndex) /* TV mux only available on DACB */ - Write32Mask(OUT, dacOffset + DACA_CONTROL2, 0, 0x0000FF00); - - /* select a crtc */ - Write32Mask(OUT, dacOffset + DACA_SOURCE_SELECT, - crtid & 0x01, 0x00000003); - } - - Write32Mask(OUT, dacOffset + DACA_FORCE_OUTPUT_CNTL, - 0x00000701, 0x00000701); - Write32Mask(OUT, dacOffset + DACA_FORCE_DATA, - 0, 0x0000FFFF); -} - - -void -DACSet(uint8 dacIndex, uint32 crtid) -{ - radeon_shared_info &info = *gInfo->shared_info; - - TRACE("%s: dac %d to crt %d\n", __func__, dacIndex, crtid); - - if (info.device_chipset < (RADEON_R600 | 0x20)) - DACSetLegacy(dacIndex, crtid); - else - DACSetModern(dacIndex, crtid); -} - - -/* For Cards >= r620 */ -void -DACPowerModern(uint8 dacIndex, int mode) -{ - TRACE("%s: dacIndex: %d; mode: %d\n", __func__, dacIndex, mode); - - uint32 dacOffset = dacIndex == 1 ? RV620_REG_DACB_OFFSET - : RV620_REG_DACA_OFFSET; - uint32 powerdown; - - switch (mode) { - case RHD_POWER_ON: - TRACE("%s: dacIndex: %d; POWER_ON\n", __func__, dacIndex); - // TODO : SensedType Detection? - powerdown = 0; - if (!(Read32(OUT, dacOffset + RV620_DACA_ENABLE) & 0x01)) - Write32Mask(OUT, dacOffset + RV620_DACA_ENABLE, 0x1, 0xff); - Write32Mask(OUT, dacOffset + RV620_DACA_FORCE_OUTPUT_CNTL, - 0x01, 0x01); - Write32Mask(OUT, dacOffset + RV620_DACA_POWERDOWN, 0x0, 0xff); - snooze(20); - Write32Mask(OUT, dacOffset + RV620_DACA_POWERDOWN, - powerdown, 0xFFFFFF00); - Write32(OUT, dacOffset + RV620_DACA_FORCE_OUTPUT_CNTL, 0x0); - Write32(OUT, dacOffset + RV620_DACA_SYNC_TRISTATE_CONTROL, 0x0); - return; - case RHD_POWER_RESET: - TRACE("%s: dacIndex: %d; POWER_RESET\n", __func__, dacIndex); - // No action - return; - case RHD_POWER_SHUTDOWN: - TRACE("%s: dacIndex: %d; POWER_SHUTDOWN\n", __func__, dacIndex); - default: - Write32(OUT, dacOffset + RV620_DACA_POWERDOWN, 0x01010100); - Write32(OUT, dacOffset + RV620_DACA_POWERDOWN, 0x01010101); - Write32(OUT, dacOffset + RV620_DACA_ENABLE, 0); - Write32Mask(OUT, dacOffset + RV620_DACA_FORCE_DATA, 0, 0xffff); - Write32Mask(OUT, dacOffset + RV620_DACA_FORCE_OUTPUT_CNTL, - 0x701, 0x701); - return; - } -} - - -/* For Cards < r620 */ -void -DACPowerLegacy(uint8 dacIndex, int mode) -{ - uint32 dacOffset = dacIndex == 1 ? REG_DACB_OFFSET : REG_DACA_OFFSET; - uint32 powerdown; - - switch (mode) { - case RHD_POWER_ON: - TRACE("%s: dacIndex: %d; POWER_ON\n", __func__, dacIndex); - // TODO : SensedType Detection? - powerdown = 0; - Write32(OUT, dacOffset + DACA_ENABLE, 1); - Write32(OUT, dacOffset + DACA_POWERDOWN, 0); - snooze(14); - Write32Mask(OUT, dacOffset + DACA_POWERDOWN, powerdown, 0xFFFFFF00); - snooze(2); - Write32(OUT, dacOffset + DACA_FORCE_OUTPUT_CNTL, 0); - Write32Mask(OUT, dacOffset + DACA_SYNC_SELECT, 0, 0x00000101); - Write32(OUT, dacOffset + DACA_SYNC_TRISTATE_CONTROL, 0); - return; - case RHD_POWER_RESET: - TRACE("%s: dacIndex: %d; POWER_RESET\n", __func__, dacIndex); - // No action - return; - case RHD_POWER_SHUTDOWN: - TRACE("%s: dacIndex: %d; POWER_SHUTDOWN\n", __func__, dacIndex); - default: - Write32Mask(OUT, dacOffset + DACA_FORCE_DATA, 0, 0x0000FFFF); - Write32Mask(OUT, dacOffset + DACA_FORCE_OUTPUT_CNTL, - 0x0000701, 0x0000701); - Write32(OUT, dacOffset + DACA_POWERDOWN, 0x01010100); - Write32(OUT, dacOffset + DACA_POWERDOWN, 0x01010101); - Write32(OUT, dacOffset + DACA_ENABLE, 0); - Write32(OUT, dacOffset + DACA_ENABLE, 0); - return; - } -} - - -void -DACPower(uint8 dacIndex, int mode) -{ - radeon_shared_info &info = *gInfo->shared_info; - - if (info.device_chipset < (RADEON_R600 | 0x20)) - DACPowerLegacy(dacIndex, mode); - else - DACPowerModern(dacIndex, mode); -} - - -void -DACAllIdle() -{ - // This really doesn't do anything on DAC monitors - // Implimented for completeness - uint8 i; - - for (i = 0; i < 2; i++) { - DACPower(i, RHD_POWER_RESET); - } -} - diff --git a/src/add-ons/accelerants/radeon_hd/dac.h b/src/add-ons/accelerants/radeon_hd/dac.h deleted file mode 100644 index 2176170e82..0000000000 --- a/src/add-ons/accelerants/radeon_hd/dac.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ -#ifndef RADEON_HD_DAC_H -#define RADEON_HD_DAC_H - - -// DAC Offsets -#define REG_DACA_OFFSET 0 -#define REG_DACB_OFFSET 0x200 -#define RV620_REG_DACA_OFFSET 0 -#define RV620_REG_DACB_OFFSET 0x100 - -// Signal types -#define FORMAT_PAL 0x0 -#define FORMAT_NTSC 0x1 -#define FORMAT_VGA 0x2 -#define FORMAT_TvCV 0x3 - - -bool dac_sense(uint32 connector_id); -void DACGetElectrical(uint8 type, uint8 dac, uint8 *bandgap, uint8 *whitefine); -void DACSet(uint8 dacIndex, uint32 crtid); -void DACPower(uint8 dacIndex, int mode); -void DACAllIdle(); - - -#endif diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 42042d1751..9cf967b2bf 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -1090,143 +1090,3 @@ display_crtc_power(uint8 crt_id, int command) } -union crtc_source_param { - SELECT_CRTC_SOURCE_PS_ALLOCATION v1; - SELECT_CRTC_SOURCE_PARAMETERS_V2 v2; -}; - - -void -display_crtc_assign_encoder(uint8 crtc_id) -{ - int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source); - union crtc_source_param args; - uint8 frev; - uint8 crev; - - memset(&args, 0, sizeof(args)); - - if (atom_parse_cmd_header(gAtomContext, index, &frev, &crev) - != B_OK) - return; - - uint16 connector_index = gDisplay[crtc_id]->connector_index; - uint16 encoder_id = gConnector[connector_index]->encoder_object_id; - - switch (frev) { - case 1: - switch (crev) { - case 1: - default: - args.v1.ucCRTC = crtc_id; - switch (encoder_id) { - case ENCODER_OBJECT_ID_INTERNAL_TMDS1: - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: - args.v1.ucDevice = ATOM_DEVICE_DFP1_INDEX; - break; - case ENCODER_OBJECT_ID_INTERNAL_LVDS: - case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - //if (radeon_encoder->devices - // & ATOM_DEVICE_LCD1_SUPPORT) - // args.v1.ucDevice = ATOM_DEVICE_LCD1_INDEX; - //else - args.v1.ucDevice = ATOM_DEVICE_DFP3_INDEX; - break; - case ENCODER_OBJECT_ID_INTERNAL_DVO1: - case ENCODER_OBJECT_ID_INTERNAL_DDI: - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: - args.v1.ucDevice = ATOM_DEVICE_DFP2_INDEX; - break; - case ENCODER_OBJECT_ID_INTERNAL_DAC1: - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: - //if (radeon_encoder->active_device - // & (ATOM_DEVICE_TV_SUPPORT)) - // args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; - //else if (radeon_encoder->active_device - // & (ATOM_DEVICE_CV_SUPPORT)) - // args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; - //else - args.v1.ucDevice = ATOM_DEVICE_CRT1_INDEX; - break; - case ENCODER_OBJECT_ID_INTERNAL_DAC2: - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: - //if (radeon_encoder->active_device - // & (ATOM_DEVICE_TV_SUPPORT)) - // args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; - //else if (radeon_encoder->active_device - // & (ATOM_DEVICE_CV_SUPPORT)) - // args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; - //else - args.v1.ucDevice = ATOM_DEVICE_CRT2_INDEX; - break; - } - break; - case 2: - args.v2.ucCRTC = crtc_id; - args.v2.ucEncodeMode - = display_get_encoder_mode(connector_index); - switch (encoder_id) { - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: - ERROR("%s: DIG encoder not yet supported!\n", - __func__); - //dig = radeon_encoder->enc_priv; - //switch (dig->dig_encoder) { - // case 0: - // args.v2.ucEncoderID = ASIC_INT_DIG1_ENCODER_ID; - // break; - // case 1: - // args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID; - // break; - // case 2: - // args.v2.ucEncoderID = ASIC_INT_DIG3_ENCODER_ID; - // break; - // case 3: - // args.v2.ucEncoderID = ASIC_INT_DIG4_ENCODER_ID; - // break; - // case 4: - // args.v2.ucEncoderID = ASIC_INT_DIG5_ENCODER_ID; - // break; - // case 5: - // args.v2.ucEncoderID = ASIC_INT_DIG6_ENCODER_ID; - // break; - //} - break; - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: - args.v2.ucEncoderID = ASIC_INT_DVO_ENCODER_ID; - break; - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: - //if (radeon_encoder->active_device - // & (ATOM_DEVICE_TV_SUPPORT)) - // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; - //else if (radeon_encoder->active_device - // & (ATOM_DEVICE_CV_SUPPORT)) - // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; - //else - args.v2.ucEncoderID = ASIC_INT_DAC1_ENCODER_ID; - break; - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: - //if (radeon_encoder->active_device - // & (ATOM_DEVICE_TV_SUPPORT)) - // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; - //else if (radeon_encoder->active_device - // & (ATOM_DEVICE_CV_SUPPORT)) - // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; - //else - args.v2.ucEncoderID = ASIC_INT_DAC2_ENCODER_ID; - break; - } - break; - } - break; - default: - ERROR("%s: Unknown table version: %d, %d\n", __func__, frev, crev); - return; - } - - atom_execute_table(gAtomContext, index, (uint32*)&args); - - // TODO : encoder_crtc_scratch_regs? -} diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 3193f0686a..d0fa8b0daf 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -74,7 +74,6 @@ void display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode); void display_crtc_set(uint8 crtc_id, display_mode *mode); void display_crtc_set_dtd(uint8 crtc_id, display_mode *mode); void display_crtc_power(uint8 crt_id, int command); -void display_crtc_assign_encoder(uint8 crt_id); #endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp new file mode 100644 index 0000000000..0f820e4bc8 --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -0,0 +1,172 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include "accelerant_protos.h" +#include "accelerant.h" +#include "bios.h" +#include "display.h" +#include "utility.h" + +#include +#include +#include +#include + + +#define TRACE_ENCODER +#ifdef TRACE_ENCODER +extern "C" void _sPrintf(const char *format, ...); +# define TRACE(x...) _sPrintf("radeon_hd: " x) +#else +# define TRACE(x...) ; +#endif + +#define ERROR(x...) _sPrintf("radeon_hd: " x) + + +union crtc_source_param { + SELECT_CRTC_SOURCE_PS_ALLOCATION v1; + SELECT_CRTC_SOURCE_PARAMETERS_V2 v2; +}; + + +void +encoder_assign_crtc(uint8 crtc_id) +{ + int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source); + union crtc_source_param args; + uint8 frev; + uint8 crev; + + memset(&args, 0, sizeof(args)); + + if (atom_parse_cmd_header(gAtomContext, index, &frev, &crev) + != B_OK) + return; + + uint16 connector_index = gDisplay[crtc_id]->connector_index; + uint16 encoder_id = gConnector[connector_index]->encoder_object_id; + + switch (frev) { + case 1: + switch (crev) { + case 1: + default: + args.v1.ucCRTC = crtc_id; + switch (encoder_id) { + case ENCODER_OBJECT_ID_INTERNAL_TMDS1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: + args.v1.ucDevice = ATOM_DEVICE_DFP1_INDEX; + break; + case ENCODER_OBJECT_ID_INTERNAL_LVDS: + case ENCODER_OBJECT_ID_INTERNAL_LVTM1: + //if (radeon_encoder->devices + // & ATOM_DEVICE_LCD1_SUPPORT) + // args.v1.ucDevice = ATOM_DEVICE_LCD1_INDEX; + //else + args.v1.ucDevice = ATOM_DEVICE_DFP3_INDEX; + break; + case ENCODER_OBJECT_ID_INTERNAL_DVO1: + case ENCODER_OBJECT_ID_INTERNAL_DDI: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: + args.v1.ucDevice = ATOM_DEVICE_DFP2_INDEX; + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: + //if (radeon_encoder->active_device + // & (ATOM_DEVICE_TV_SUPPORT)) + // args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; + //else if (radeon_encoder->active_device + // & (ATOM_DEVICE_CV_SUPPORT)) + // args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; + //else + args.v1.ucDevice = ATOM_DEVICE_CRT1_INDEX; + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: + //if (radeon_encoder->active_device + // & (ATOM_DEVICE_TV_SUPPORT)) + // args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; + //else if (radeon_encoder->active_device + // & (ATOM_DEVICE_CV_SUPPORT)) + // args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; + //else + args.v1.ucDevice = ATOM_DEVICE_CRT2_INDEX; + break; + } + break; + case 2: + args.v2.ucCRTC = crtc_id; + args.v2.ucEncodeMode + = display_get_encoder_mode(connector_index); + switch (encoder_id) { + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: + ERROR("%s: DIG encoder not yet supported!\n", + __func__); + //dig = radeon_encoder->enc_priv; + //switch (dig->dig_encoder) { + // case 0: + // args.v2.ucEncoderID = ASIC_INT_DIG1_ENCODER_ID; + // break; + // case 1: + // args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID; + // break; + // case 2: + // args.v2.ucEncoderID = ASIC_INT_DIG3_ENCODER_ID; + // break; + // case 3: + // args.v2.ucEncoderID = ASIC_INT_DIG4_ENCODER_ID; + // break; + // case 4: + // args.v2.ucEncoderID = ASIC_INT_DIG5_ENCODER_ID; + // break; + // case 5: + // args.v2.ucEncoderID = ASIC_INT_DIG6_ENCODER_ID; + // break; + //} + break; + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: + args.v2.ucEncoderID = ASIC_INT_DVO_ENCODER_ID; + break; + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: + //if (radeon_encoder->active_device + // & (ATOM_DEVICE_TV_SUPPORT)) + // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + //else if (radeon_encoder->active_device + // & (ATOM_DEVICE_CV_SUPPORT)) + // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + //else + args.v2.ucEncoderID = ASIC_INT_DAC1_ENCODER_ID; + break; + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: + //if (radeon_encoder->active_device + // & (ATOM_DEVICE_TV_SUPPORT)) + // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + //else if (radeon_encoder->active_device + // & (ATOM_DEVICE_CV_SUPPORT)) + // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + //else + args.v2.ucEncoderID = ASIC_INT_DAC2_ENCODER_ID; + break; + } + break; + } + break; + default: + ERROR("%s: Unknown table version: %d, %d\n", __func__, frev, crev); + return; + } + + atom_execute_table(gAtomContext, index, (uint32*)&args); + + // TODO : encoder_crtc_scratch_regs? +} diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h new file mode 100644 index 0000000000..380906c5b0 --- /dev/null +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -0,0 +1,15 @@ +/* + * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ +#ifndef RADEON_HD_ENCODER_H +#define RADEON_HD_ENCODER_H + + +void encoder_assign_crtc(uint8 crt_id); + + +#endif /* RADEON_HD_ENCODER_H */ diff --git a/src/add-ons/accelerants/radeon_hd/lvds.cpp b/src/add-ons/accelerants/radeon_hd/lvds.cpp deleted file mode 100644 index 6c7e52793a..0000000000 --- a/src/add-ons/accelerants/radeon_hd/lvds.cpp +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ - - -#include "accelerant_protos.h" -#include "accelerant.h" -#include "utility.h" -#include "lvds.h" - - -#define TRACE_LVDS -#ifdef TRACE_LVDS -extern "C" void _sPrintf(const char *format, ...); -# define TRACE(x...) _sPrintf("radeon_hd: " x) -#else -# define TRACE(x...) ; -#endif - - -// Static microvoltage values taken from Xorg driver -static struct R5xxTMDSBMacro { - uint16 device; - uint32 macroSingle; - uint32 macroDual; -} R5xxTMDSBMacro[] = { - /* - * this list isn't complete yet. - * Some more values for dual need to be dug up - */ - { 0x7104, 0x00F20616, 0x00F20616 }, // R520 - { 0x7142, 0x00F2061C, 0x00F2061C }, // RV515 - { 0x7145, 0x00F1061D, 0x00F2061D }, - { 0x7146, 0x00F1061D, 0x00F1061D }, // RV515 - { 0x7147, 0x0082041D, 0x0082041D }, // RV505 - { 0x7149, 0x00F1061D, 0x00D2061D }, - { 0x7152, 0x00F2061C, 0x00F2061C }, // RV515 - { 0x7183, 0x00B2050C, 0x00B2050C }, // RV530 - { 0x71C0, 0x00F1061F, 0x00f2061D }, - { 0x71C1, 0x0062041D, 0x0062041D }, // RV535 - { 0x71C2, 0x00F1061D, 0x00F2061D }, // RV530 - { 0x71C5, 0x00D1061D, 0x00D2061D }, - { 0x71C6, 0x00F2061D, 0x00F2061D }, // RV530 - { 0x71D2, 0x00F10610, 0x00F20610 }, // RV530: atombios uses 0x00F1061D - { 0x7249, 0x00F1061D, 0x00F1061D }, // R580 - { 0x724B, 0x00F10610, 0x00F10610 }, // R580: atombios uses 0x00F1061D - { 0x7280, 0x0042041F, 0x0042041F }, // RV570 - { 0x7288, 0x0042041F, 0x0042041F }, // RV570 - { 0x791E, 0x0001642F, 0x0001642F }, // RS690 - { 0x791F, 0x0001642F, 0x0001642F }, // RS690 - { 0x9400, 0x00020213, 0x00020213 }, // R600 - { 0x9401, 0x00020213, 0x00020213 }, // R600 - { 0x9402, 0x00020213, 0x00020213 }, // R600 - { 0x9403, 0x00020213, 0x00020213 }, // R600 - { 0x9405, 0x00020213, 0x00020213 }, // R600 - { 0x940A, 0x00020213, 0x00020213 }, // R600 - { 0x940B, 0x00020213, 0x00020213 }, // R600 - { 0x940F, 0x00020213, 0x00020213 }, // R600 - { 0, 0, 0 } /* End marker */ -}; - -static struct RV6xxTMDSBMacro { - uint16 device; - uint32 macro; - uint32 tx; - uint32 preEmphasis; -} RV6xxTMDSBMacro[] = { - { 0x94C1, 0x01030311, 0x10001A00, 0x01801015}, /* RV610 */ - { 0x94C3, 0x01030311, 0x10001A00, 0x01801015}, /* RV610 */ - { 0x9501, 0x0533041A, 0x020010A0, 0x41002045}, /* RV670 */ - { 0x9505, 0x0533041A, 0x020010A0, 0x41002045}, /* RV670 */ - { 0x950F, 0x0533041A, 0x020010A0, 0x41002045}, /* R680 */ - { 0x9587, 0x01030311, 0x10001C00, 0x01C01011}, /* RV630 */ - { 0x9588, 0x01030311, 0x10001C00, 0x01C01011}, /* RV630 */ - { 0x9589, 0x01030311, 0x10001C00, 0x01C01011}, /* RV630 */ - { 0, 0, 0, 0} /* End marker */ -}; - - -void -LVDSVoltageControl(uint8 lvdsIndex) -{ - bool dualLink = false; // TODO : DualLink - radeon_shared_info &info = *gInfo->shared_info; - - // TODO : Special RS690 RS600 IGP oneoffs - - if (info.device_chipset < (RADEON_R600 | 0x70)) - Write32Mask(OUT, LVTMA_REG_TEST_OUTPUT, 0x00100000, 0x00100000); - - // Micromanage voltages - if (info.device_chipset < (RADEON_R600 | 0x10)) { - for (uint32 i = 0; R5xxTMDSBMacro[i].device; i++) { - if (R5xxTMDSBMacro[i].device == info.device_id) { - if (dualLink) { - Write32(OUT, LVTMA_MACRO_CONTROL, - R5xxTMDSBMacro[i].macroDual); - } else { - Write32(OUT, LVTMA_MACRO_CONTROL, - R5xxTMDSBMacro[i].macroSingle); - } - return; - } - } - TRACE("%s : unhandled chipset 0x%X\n", __func__, info.device_id); - } else { - for (uint32 i = 0; RV6xxTMDSBMacro[i].device; i++) { - if (RV6xxTMDSBMacro[i].device == info.device_id) { - Write32(OUT, LVTMA_MACRO_CONTROL, RV6xxTMDSBMacro[i].macro); - Write32(OUT, LVTMA_TRANSMITTER_ADJUST, - RV6xxTMDSBMacro[i].tx); - Write32(OUT, LVTMA_PREEMPHASIS_CONTROL, - RV6xxTMDSBMacro[i].preEmphasis); - return; - } - } - TRACE("%s : unhandled chipset 0x%X\n", __func__, info.device_id); - } -} - - -void -LVDSPower(uint8 lvdsIndex, int command) -{ - bool dualLink = false; // TODO : dualLink - - if (lvdsIndex == 0) { - TRACE("LVTMA not yet supported :(\n"); - return; - } else { - // Select TMDSB (which is on LVDS) - Write32Mask(OUT, LVTMA_MODE, 0x00000001, 0x00000001); - } - - switch (command) { - case RHD_POWER_ON: - TRACE("%s: LVDS %d Power On\n", __func__, lvdsIndex); - Write32Mask(OUT, LVTMA_CNTL, 0x1, 0x00000001); - - if (dualLink) { - Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, - 0x00003E3E, 0x00003E3E); - } else { - Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, - 0x0000003E, 0x00003E3E); - } - - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x00000001, 0x00000001); - snooze(2); - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x00000002); - // TODO : Enable HDMI - return; - - case RHD_POWER_RESET: - TRACE("%s: LVDS %d Power Reset\n", __func__, lvdsIndex); - Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, 0, 0x00003E3E); - return; - - case RHD_POWER_SHUTDOWN: - default: - TRACE("%s: LVDS %d Power Shutdown\n", __func__, lvdsIndex); - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x00000002, 0x00000002); - snooze(2); - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x00000001); - - Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, 0, 0x00003E3E); - Write32Mask(OUT, LVTMA_CNTL, 0, 0x00000001); - // TODO : Disable HDMI - return; - } -} - - -status_t -LVDSSet(uint8 lvdsIndex, display_mode *mode) -{ - TRACE("%s: LVDS %d Set\n", __func__, lvdsIndex); - - uint16 crtid = 0; // TODO : assume CRT0 - - if (lvdsIndex == 0) { - TRACE("LVTMA not yet supported :(\n"); - return B_ERROR; - } else { - // Select TMDSB (which is on LVDS) - Write32Mask(OUT, LVTMA_MODE, 0x00000001, 0x00000001); - } - - // Clear HPD events - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x0000000C); - Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, 0, 0x00070000); - - Write32Mask(OUT, LVTMA_CNTL, 0, 0x00000010); - - // Disable LVDS (TMDSB) transmitter - Write32Mask(OUT, LVTMA_TRANSMITTER_ENABLE, 0, 0x00003E3E); - - // Reset dither bits - Write32Mask(OUT, LVTMA_BIT_DEPTH_CONTROL, 0, 0x00010101); - Write32Mask(OUT, LVTMA_BIT_DEPTH_CONTROL, LVTMA_DITHER_RESET_BIT, - LVTMA_DITHER_RESET_BIT); - snooze(2); - Write32Mask(OUT, LVTMA_BIT_DEPTH_CONTROL, 0, LVTMA_DITHER_RESET_BIT); - Write32Mask(OUT, LVTMA_BIT_DEPTH_CONTROL, 0, 0xF0000000); - // Undocumented depth control bit from Xorg - - Write32Mask(OUT, LVTMA_CNTL, 0x00001000, 0x00011000); - // Reset phase for vsync and use RGB color - - Write32Mask(OUT, LVTMA_SOURCE_SELECT, crtid, 0x00010101); - // Assign to CRTC - - Write32(OUT, LVTMA_COLOR_FORMAT, 0); - - // TODO : Detect DualLink via SynthClock? - Write32Mask(OUT, LVTMA_CNTL, 0, 0x01000000); - - // TODO : only > R600 - disable split mode - Write32Mask(OUT, LVTMA_CNTL, 0, 0x20000000); - - Write32Mask(OUT, LVTMA_FORCE_OUTPUT_CNTL, 0, 0x00000001); - // Disable force data - - Write32Mask(OUT, LVTMA_DCBALANCER_CONTROL, 0x00000001, 0x00000001); - // Enable DC balancer - - LVDSVoltageControl(lvdsIndex); - - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x00000010, 0x00000010); - // use IDCLK - - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x20000000, 0x20000000); - // use clock selected by next write - - // TODO : coherent mode? - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x10000000); - - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x03FF0000); - // Clear current LVDS clock - - // Reset PLL's - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0x00000002, 0x00000002); - snooze(2); - Write32Mask(OUT, LVTMA_TRANSMITTER_CONTROL, 0, 0x00000002); - snooze(20); - - // Restart LVDS data sync - Write32Mask(OUT, LVTMA_DATA_SYNCHRONIZATION, 0x00000001, 0x00000001); - Write32Mask(OUT, LVTMA_DATA_SYNCHRONIZATION, 0x00000100, 0x00000100); - snooze(20); - Write32Mask(OUT, LVTMA_DATA_SYNCHRONIZATION, 0, 0x00000001); - - // TODO : Set HDMI mode - - return B_OK; -} - - -void -LVDSAllIdle() -{ - LVDSPower(1, RHD_POWER_RESET); -} diff --git a/src/add-ons/accelerants/radeon_hd/lvds.h b/src/add-ons/accelerants/radeon_hd/lvds.h deleted file mode 100644 index ce32696fd1..0000000000 --- a/src/add-ons/accelerants/radeon_hd/lvds.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ -#ifndef RADEON_HD_LVDS_H -#define RADEON_HD_LVDS_H - - -#define LVTMA_DATA_SYNCHRONIZATION LVTMA_R600_DATA_SYNCHRONIZATION -#define LVTMA_PWRSEQ_REF_DIV LVTMA_R600_PWRSEQ_REF_DIV -#define LVTMA_PWRSEQ_DELAY1 LVTMA_R600_PWRSEQ_DELAY1 -#define LVTMA_PWRSEQ_DELAY2 LVTMA_R600_PWRSEQ_DELAY2 -#define LVTMA_PWRSEQ_CNTL LVTMA_R600_PWRSEQ_CNTL -#define LVTMA_PWRSEQ_STATE LVTMA_R600_PWRSEQ_STATE -#define LVTMA_LVDS_DATA_CNTL LVTMA_R600_LVDS_DATA_CNTL -#define LVTMA_MODE LVTMA_R600_MODE -#define LVTMA_TRANSMITTER_ENABLE LVTMA_R600_TRANSMITTER_ENABLE -#define LVTMA_MACRO_CONTROL LVTMA_R600_MACRO_CONTROL -#define LVTMA_TRANSMITTER_CONTROL LVTMA_R600_TRANSMITTER_CONTROL -#define LVTMA_REG_TEST_OUTPUT LVTMA_R600_REG_TEST_OUTPUT -#define LVTMA_BL_MOD_CNTL LVTMA_R600_BL_MOD_CNTL -#define LVTMA_DITHER_RESET_BIT 0x02000000 - - -void LVDSVoltageControl(uint8 lvdsIndex); -void LVDSPower(uint8 lvdsIndex, int command); -status_t LVDSSet(uint8 lvdsIndex, display_mode *mode); -void LVDSAllIdle(); - - -#endif /* RADEON_HD_LVDS_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index bbf0448d24..1b6dbc9aaa 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -113,11 +113,11 @@ radeon_set_display_mode(display_mode *mode) continue; } - uint32 connector_index = gDisplay[id]->connector_index; + // uint32 connector_index = gDisplay[id]->connector_index; // uint32 connector_type = gConnector[connector_index]->connector_type; - uint32 encoder_type = gConnector[connector_index]->encoder_type; + // uint32 encoder_type = gConnector[connector_index]->encoder_type; - display_crtc_assign_encoder(id); + encoder_assign_crtc(id); // TODO : the first id is the pll we use... this won't work for // more then two monitors @@ -125,45 +125,16 @@ radeon_set_display_mode(display_mode *mode) // Program CRT Controller display_crtc_set_dtd(id, mode); - //display_crtc_fb_set_dce1(id, mode); - display_crtc_fb_set_legacy(id, mode); + display_crtc_fb_set_dce1(id, mode); + //display_crtc_fb_set_legacy(id, mode); display_crtc_scale(id, mode); - // Program connector controllers - switch (encoder_type) { - case VIDEO_ENCODER_DAC: - case VIDEO_ENCODER_TVDAC: - // DACSet(connector_index, id); - break; - case VIDEO_ENCODER_TMDS: - // TMDSSet(connector_index, mode); - break; - case VIDEO_ENCODER_LVDS: - // LVDSSet(connector_index, mode); - break; - } - // Power CRT Controller display_crtc_blank(id, ATOM_DISABLE); display_crtc_power(id, ATOM_ENABLE); //PLLPower(gDisplay[id]->connection_id, RHD_POWER_ON); - // Power connector controllers - switch (encoder_type) { - case VIDEO_ENCODER_DAC: - case VIDEO_ENCODER_TVDAC: - // DACPower(connector_index, RHD_POWER_ON); - break; - case VIDEO_ENCODER_TMDS: - // TMDSPower(connector_index, RHD_POWER_ON); - break; - case VIDEO_ENCODER_LVDS: - // LVDSSet(connector_index, mode); - // LVDSPower(connector_index, RHD_POWER_ON); - break; - } - display_crtc_lock(id, ATOM_DISABLE); // commit } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 5305de61a0..75e78d41e2 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -221,8 +221,8 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) args.v3.ucMiscInfo = (pll_id << 2); // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; - args.v3.ucTransmitterId = crtc_id; - // TODO : transmitter id is now CRTC id? + args.v3.ucTransmitterId + = gConnector[connector_index]->encoder_object_id; args.v3.ucEncoderMode = display_get_encoder_mode(connector_index); break; default: diff --git a/src/add-ons/accelerants/radeon_hd/tmds.cpp b/src/add-ons/accelerants/radeon_hd/tmds.cpp deleted file mode 100644 index 1c84e3ce6f..0000000000 --- a/src/add-ons/accelerants/radeon_hd/tmds.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ - - -#include "accelerant_protos.h" -#include "accelerant.h" -#include "utility.h" -#include "tmds.h" - - -#define TRACE_TMDS -#ifdef TRACE_TMDS -extern "C" void _sPrintf(const char *format, ...); -# define TRACE(x...) _sPrintf("radeon_hd: " x) -#else -# define TRACE(x...) ; -#endif - - -/* - * From Xorg Driver - * This information is not provided in an atombios data table. - */ -static struct R5xxTMDSAMacro { - uint16 device; - uint32 macro; -} R5xxTMDSAMacro[] = { - { 0x7104, 0x00C00414 }, /* R520 */ - { 0x7142, 0x00A00415 }, /* RV515 */ - { 0x7145, 0x00A00416 }, /* M54 */ - { 0x7146, 0x00C0041F }, /* RV515 */ - { 0x7147, 0x00C00418 }, /* RV505 */ - { 0x7149, 0x00800416 }, /* M56 */ - { 0x7152, 0x00A00415 }, /* RV515 */ - { 0x7183, 0x00600412 }, /* RV530 */ - { 0x71C1, 0x00C0041F }, /* RV535 */ - { 0x71C2, 0x00A00416 }, /* RV530 */ - { 0x71C4, 0x00A00416 }, /* M56 */ - { 0x71C5, 0x00A00416 }, /* M56 */ - { 0x71C6, 0x00A00513 }, /* RV530 */ - { 0x71D2, 0x00A00513 }, /* RV530 */ - { 0x71D5, 0x00A00513 }, /* M66 */ - { 0x7249, 0x00A00513 }, /* R580 */ - { 0x724B, 0x00A00513 }, /* R580 */ - { 0x7280, 0x00C0041F }, /* RV570 */ - { 0x7288, 0x00C0041F }, /* RV570 */ - { 0x9400, 0x00910419 }, /* R600: */ - { 0, 0} /* End marker */ -}; - -static struct Rv6xxTMDSAMacro { - uint16 device; - uint32 pll; - uint32 tx; -} Rv6xxTMDSAMacro[] = { - { 0x94C1, 0x00010416, 0x00010308 }, /* RV610 */ - { 0x94C3, 0x00010416, 0x00010308 }, /* RV610 */ - { 0x9501, 0x00010416, 0x00010308 }, /* RV670: != atombios */ - { 0x9505, 0x00010416, 0x00010308 }, /* RV670: != atombios */ - { 0x950F, 0x00010416, 0x00010308 }, /* R680 : != atombios */ - { 0x9581, 0x00030410, 0x00301044 }, /* M76 */ - { 0x9587, 0x00010416, 0x00010308 }, /* RV630 */ - { 0x9588, 0x00010416, 0x00010388 }, /* RV630 */ - { 0x9589, 0x00010416, 0x00010388 }, /* RV630 */ - { 0, 0, 0} /* End marker */ -}; - - -void -TMDSVoltageControl(uint8 tmdsIndex) -{ - int i; - - radeon_shared_info &info = *gInfo->shared_info; - - if (info.device_chipset < (RADEON_R600 | 0x10)) { - for (i = 0; R5xxTMDSAMacro[i].device; i++) { - if (R5xxTMDSAMacro[i].device == info.device_id) { - Write32(OUT, TMDSA_MACRO_CONTROL, R5xxTMDSAMacro[i].macro); - return; - } - } - TRACE("%s : unhandled chipset 0x%X\n", __func__, info.device_id); - } else { - for (i = 0; Rv6xxTMDSAMacro[i].device; i++) { - if (Rv6xxTMDSAMacro[i].device == info.device_id) { - Write32(OUT, TMDSA_PLL_ADJUST, Rv6xxTMDSAMacro[i].pll); - Write32(OUT, TMDSA_TRANSMITTER_ADJUST, Rv6xxTMDSAMacro[i].tx); - return; - } - } - TRACE("%s : unhandled chipset 0x%X\n", __func__, info.device_id); - } -} - - -bool -TMDSSense(uint8 tmdsIndex) -{ - // For now radeon cards only have TMDSA and no TMDSB - - // Backup current TMDS values - uint32 loadDetect = Read32(OUT, TMDSA_LOAD_DETECT); - - // Call TMDS load detect on TMDSA - Write32Mask(OUT, TMDSA_LOAD_DETECT, 0x00000001, 0x00000001); - snooze(1); - - // Check result of TMDS load detect - bool result = Read32(OUT, TMDSA_LOAD_DETECT) & 0x00000010; - - // Restore saved value - Write32Mask(OUT, TMDSA_LOAD_DETECT, loadDetect, 0x00000001); - - return result; -} - - -status_t -TMDSPower(uint8 tmdsIndex, int command) -{ - // For now radeon cards only have TMDSA and no TMDSB - switch (command) { - case RHD_POWER_ON: - { - TRACE("%s: TMDS %d Power On\n", __func__, tmdsIndex); - Write32Mask(OUT, TMDSA_CNTL, 0x1, 0x00000001); - Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0x00000001, 0x00000001); - snooze(20); - - // Reset transmitter - Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0x00000002, 0x00000002); - snooze(2); - Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0, 0x00000002); - - snooze(30); - - // Restart data sync - // TODO : 165000 this is DualLink - Write32Mask(OUT, TMDSA_CNTL, 0, 0x01000000); - - // Disable force data - Write32Mask(OUT, TMDSA_FORCE_OUTPUT_CNTL, 0, 0x00000001); - - // Enable DC balancer - Write32Mask(OUT, TMDSA_DCBALANCER_CONTROL, 0x00000001, 0x00000001); - - TMDSVoltageControl(tmdsIndex); - - // USE IDCLK - Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0x00000010, 0x00000010); - - // TODO : if coherent? For now lets asume false - Write32Mask(OUT, TMDSA_TRANSMITTER_CONTROL, 0x10000000, 0x10000000); - - // TODO : HdmiSetMode(mode) - return B_OK; -} - - -void -TMDSAllIdle() -{ - TMDSPower(0, RHD_POWER_RESET); -} diff --git a/src/add-ons/accelerants/radeon_hd/tmds.h b/src/add-ons/accelerants/radeon_hd/tmds.h deleted file mode 100644 index f2b7eca59f..0000000000 --- a/src/add-ons/accelerants/radeon_hd/tmds.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ -#ifndef RADEON_HD_TMDS_H -#define RADEON_HD_TMDS_H - - -void TMDSVoltageControl(uint8 tmdsIndex); -bool TMDSSense(uint8 tmdsIndex); -status_t TMDSPower(uint8 tmdsIndex, int command); -status_t TMDSSet(uint8 tmdsIndex, display_mode *mode); -void TMDSAllIdle(); - - -#endif From 3c920dad102c6093bb351d070b202bf2c80e7cb3 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 3 Oct 2011 16:06:10 +0000 Subject: [PATCH 338/702] Add missing dependency of wpa_supplicant on OpenSSL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42798 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalPackageDependencies | 1 + 1 file changed, 1 insertion(+) diff --git a/build/jam/OptionalPackageDependencies b/build/jam/OptionalPackageDependencies index dd5be4f91e..6604f39430 100644 --- a/build/jam/OptionalPackageDependencies +++ b/build/jam/OptionalPackageDependencies @@ -33,6 +33,7 @@ OptionalPackageDependencies Subversion : APR-util Neon LibIconv LibXML2 OpenSSL OptionalPackageDependencies Transmission : LibEvent Curl OpenSSL LibIconv ; OptionalPackageDependencies Vim : GetText LibIconv ; OptionalPackageDependencies WebPositive : Curl LibXML2 SQLite ; +OptionalPackageDependencies wpa_supplicant : OpenSSL ; OptionalPackageDependencies XZ-Utils : Tar ; OptionalPackageDependencies MandatoryPackages : ICU Sed Tar ; From 2348de0bbc539bcff26d3d503e4bb4010e81d5eb Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 3 Oct 2011 18:36:00 +0000 Subject: [PATCH 339/702] Small cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42799 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/net/NetServer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp index 88e172291d..872c1fc558 100644 --- a/src/servers/net/NetServer.cpp +++ b/src/servers/net/NetServer.cpp @@ -468,19 +468,21 @@ NetServer::_ConfigureInterface(BMessage& message) bool startAutoConfig = false; int32 flags; - if (message.FindInt32("flags", &flags) < B_OK) + if (message.FindInt32("flags", &flags) != B_OK) flags = IFF_UP; bool autoConfigured; - if (message.FindBool("auto_configured", &autoConfigured) == B_OK && autoConfigured) + if (message.FindBool("auto_configured", &autoConfigured) == B_OK + && autoConfigured) { flags |= IFF_AUTO_CONFIGURED; + } int32 mtu; - if (message.FindInt32("mtu", &mtu) < B_OK) + if (message.FindInt32("mtu", &mtu) != B_OK) mtu = -1; int32 metric; - if (message.FindInt32("metric", &metric) < B_OK) + if (message.FindInt32("metric", &metric) != B_OK) metric = -1; BNetworkInterface interface(name); From e3e636ae3aaf0f88a2836fb5d0d6708697b7b836 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 3 Oct 2011 18:53:34 +0000 Subject: [PATCH 340/702] Update the GCC4 wpa_supplicant package to one built with GCC4.5. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42800 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalPackages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index f9633e507f..14ad85ceee 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -1758,7 +1758,7 @@ if [ IsOptionalHaikuImagePackageAdded wpa_supplicant ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4) { InstallOptionalHaikuImagePackage wpa_supplicant-0.7.3-x86-gcc4-2011-09-27.zip - : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2011-09-27.zip ; + : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2011-10-03.zip ; } else { InstallOptionalHaikuImagePackage wpa_supplicant-0.7.3-x86-gcc2-2011-09-27.zip From b54c811990b00b53158247e1daa019a6bda9c278 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 5 Oct 2011 04:25:50 +0000 Subject: [PATCH 341/702] * add encoder code to handle setting up and adjusting encoders * reorganize mode set code to match layout of linux DRM driver * add initial DPMS code * add lots of TODOs git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42801 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 19 +++- src/add-ons/accelerants/radeon_hd/display.h | 3 +- src/add-ons/accelerants/radeon_hd/encoder.cpp | 95 ++++++++++++++++++- src/add-ons/accelerants/radeon_hd/encoder.h | 3 + src/add-ons/accelerants/radeon_hd/hooks.cpp | 10 ++ src/add-ons/accelerants/radeon_hd/mode.cpp | 76 +++++++++++---- src/add-ons/accelerants/radeon_hd/mode.h | 1 + 7 files changed, 178 insertions(+), 29 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 9cf967b2bf..aa6deb1480 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -431,6 +431,7 @@ detect_connectors() OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { // Found an encoder + // TODO : it may be possible to have more then one encoder int32 k; for (k = 0; k < enc_obj->ucNumberOfObjects; k++) { uint16 encoder_obj @@ -526,7 +527,6 @@ detect_connectors() // drm_encoder_helper_add break; } - //encoder_object_id = grph_obj_id; encoder_object_id = encoder_id; } } @@ -1076,17 +1076,30 @@ display_crtc_set_dtd(uint8 crtc_id, display_mode *mode) void -display_crtc_power(uint8 crt_id, int command) +display_crtc_power(uint8 crtc_id, int command) { int index = GetIndexIntoMasterTable(COMMAND, EnableCRTC); ENABLE_CRTC_PS_ALLOCATION args; memset(&args, 0, sizeof(args)); - args.ucCRTC = crt_id; + args.ucCRTC = crtc_id; args.ucEnable = command; atom_execute_table(gAtomContext, index, (uint32*)&args); } +void +display_crtc_memreq(uint8 crtc_id, int command) +{ + int index = GetIndexIntoMasterTable(COMMAND, EnableCRTCMemReq); + ENABLE_CRTC_PS_ALLOCATION args; + + memset(&args, 0, sizeof(args)); + + args.ucCRTC = crtc_id; + args.ucEnable = command; + + atom_execute_table(gAtomContext, index, (uint32*)&args); +} diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index d0fa8b0daf..aa95b385aa 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -73,7 +73,8 @@ void display_crtc_fb_set_legacy(uint8 crtc_id, display_mode *mode); void display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode); void display_crtc_set(uint8 crtc_id, display_mode *mode); void display_crtc_set_dtd(uint8 crtc_id, display_mode *mode); -void display_crtc_power(uint8 crt_id, int command); +void display_crtc_power(uint8 crtc_id, int command); +void display_crtc_memreq(uint8 crtc_id, int command); #endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 0f820e4bc8..38b15f854f 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -37,7 +37,7 @@ union crtc_source_param { void -encoder_assign_crtc(uint8 crtc_id) +encoder_assign_crtc(uint8 id) { int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source); union crtc_source_param args; @@ -50,7 +50,7 @@ encoder_assign_crtc(uint8 crtc_id) != B_OK) return; - uint16 connector_index = gDisplay[crtc_id]->connector_index; + uint16 connector_index = gDisplay[id]->connector_index; uint16 encoder_id = gConnector[connector_index]->encoder_object_id; switch (frev) { @@ -58,7 +58,7 @@ encoder_assign_crtc(uint8 crtc_id) switch (crev) { case 1: default: - args.v1.ucCRTC = crtc_id; + args.v1.ucCRTC = id; switch (encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: @@ -102,7 +102,7 @@ encoder_assign_crtc(uint8 crtc_id) } break; case 2: - args.v2.ucCRTC = crtc_id; + args.v2.ucCRTC = id; args.v2.ucEncodeMode = display_get_encoder_mode(connector_index); switch (encoder_id) { @@ -170,3 +170,90 @@ encoder_assign_crtc(uint8 crtc_id) // TODO : encoder_crtc_scratch_regs? } + + +void +encoder_mode_set(uint8 id, uint32 pixelClock) +{ + uint32 connector_index = gDisplay[id]->connector_index; + + switch (gConnector[connector_index]->encoder_object_id) { + case ENCODER_OBJECT_ID_INTERNAL_DAC1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: + case ENCODER_OBJECT_ID_INTERNAL_DAC2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: + encoder_analog_setup(id, pixelClock, ATOM_ENABLE); + break; + case ENCODER_OBJECT_ID_INTERNAL_TMDS1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: + case ENCODER_OBJECT_ID_INTERNAL_LVDS: + case ENCODER_OBJECT_ID_INTERNAL_LVTM1: + TRACE("%s: TODO for digital encoder setup\n", __func__); + break; + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: + TRACE("%s: TODO for DIG encoder setup\n", __func__); + break; + case ENCODER_OBJECT_ID_INTERNAL_DDI: + case ENCODER_OBJECT_ID_INTERNAL_DVO1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: + TRACE("%s: TODO for DVO encoder setup\n", __func__); + break; + default: + TRACE("%s: TODO for unknown encoder setup!\n", __func__); + } + +} + + +void +encoder_analog_setup(uint8 id, uint32 pixelClock, int command) +{ + TRACE("%s\n", __func__); + + uint32 connector_index = gDisplay[id]->connector_index; + + int index = 0; + DAC_ENCODER_CONTROL_PS_ALLOCATION args; + memset(&args, 0, sizeof(args)); + + switch (gConnector[connector_index]->encoder_object_id) { + case ENCODER_OBJECT_ID_INTERNAL_DAC1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: + index = GetIndexIntoMasterTable(COMMAND, DAC1EncoderControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: + index = GetIndexIntoMasterTable(COMMAND, DAC2EncoderControl); + break; + } + + args.ucAction = command; + args.ucDacStandard = ATOM_DAC1_PS2; + // TODO : or ATOM_DAC1_CV if ATOM_DEVICE_CV_SUPPORT + // TODO : or ATOM_DAC1_PAL or ATOM_DAC1_NTSC if else + + args.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + + atom_execute_table(gAtomContext, index, (uint32*)&args); +} + + +void +encoder_output_lock(bool lock) +{ + TRACE("%s: %s\n", __func__, lock ? "true" : "false"); + uint32 bios_6_scratch = Read32(OUT, R600_BIOS_6_SCRATCH); + + if (lock) { + bios_6_scratch |= ATOM_S6_CRITICAL_STATE; + bios_6_scratch &= ~ATOM_S6_ACC_MODE; + } else { + bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; + bios_6_scratch |= ATOM_S6_ACC_MODE; + } + + Write32(OUT, R600_BIOS_6_SCRATCH, bios_6_scratch); +} diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index 380906c5b0..ccd1736fca 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -10,6 +10,9 @@ void encoder_assign_crtc(uint8 crt_id); +void encoder_mode_set(uint8 id, uint32 pixelClock); +void encoder_analog_setup(uint8 id, uint32 pixelClock, int command); +void encoder_output_lock(bool lock); #endif /* RADEON_HD_ENCODER_H */ diff --git a/src/add-ons/accelerants/radeon_hd/hooks.cpp b/src/add-ons/accelerants/radeon_hd/hooks.cpp index 68c4ea737d..63d6f54494 100644 --- a/src/add-ons/accelerants/radeon_hd/hooks.cpp +++ b/src/add-ons/accelerants/radeon_hd/hooks.cpp @@ -34,6 +34,16 @@ get_accelerant_hook(uint32 feature, void *data) return (void*)radeon_accelerant_retrace_semaphore; */ + /* DPMS */ + /* + case B_DPMS_CAPABILITIES: + return (void*)radeon_dpms_capabilities; + case B_DPMS_MODE: + return (void*)radeon_dpms_mode; + case B_SET_DPMS_MODE: + return (void*)radeon_dpms_set; + */ + /* mode configuration */ case B_ACCELERANT_MODE_COUNT: return (void*)radeon_accelerant_mode_count; diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 1b6dbc9aaa..c4a73298da 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -97,48 +97,82 @@ radeon_get_edid_info(void* info, size_t size, uint32* edid_version) } +void +radeon_dpms_set(int mode) +{ + switch(mode) { + case B_DPMS_ON: + for (uint8 id = 0; id < MAX_DISPLAY; id++) { + if (gDisplay[id]->active == false) + continue; + display_crtc_power(id, ATOM_ENABLE); + display_crtc_memreq(id, ATOM_ENABLE); + display_crtc_blank(id, ATOM_DISABLE); + } + break; + case B_DPMS_STAND_BY: + case B_DPMS_SUSPEND: + case B_DPMS_OFF: + for (uint8 id = 0; id < MAX_DISPLAY; id++) { + if (gDisplay[id]->active == false) + continue; + display_crtc_blank(id, ATOM_ENABLE); + display_crtc_memreq(id, ATOM_DISABLE); + display_crtc_power(id, ATOM_DISABLE); + } + break; + } +} + + status_t radeon_set_display_mode(display_mode *mode) { // TODO : multi-monitor? for now we use VESA and not gDisplay edid + radeon_dpms_set(B_DPMS_OFF); // Set mode on each display for (uint8 id = 0; id < MAX_DISPLAY; id++) { - display_crtc_lock(id, ATOM_ENABLE); - // Skip if display is inactive - if (gDisplay[id]->active == false) { - display_crtc_blank(id, ATOM_ENABLE); - display_crtc_power(id, ATOM_DISABLE); - display_crtc_lock(id, ATOM_DISABLE); + if (gDisplay[id]->active == false) continue; - } - // uint32 connector_index = gDisplay[id]->connector_index; - // uint32 connector_type = gConnector[connector_index]->connector_type; - // uint32 encoder_type = gConnector[connector_index]->encoder_type; + // *** encoder prep + encoder_output_lock(true); + // encoder DPMS OFF - encoder_assign_crtc(id); + // *** CRT controler prep + display_crtc_lock(id, ATOM_ENABLE); - // TODO : the first id is the pll we use... this won't work for - // more then two monitors - pll_set(id, mode->timing.pixel_clock, id); - // Program CRT Controller + // *** CRT controler mode set + // TODO program SS + pll_set(0, mode->timing.pixel_clock, id); + // TODO : check if pll 0 is used and use pll 1 if so display_crtc_set_dtd(id, mode); + + // TODO : vvvv : atombios_crtc_set_base display_crtc_fb_set_dce1(id, mode); - //display_crtc_fb_set_legacy(id, mode); + // display_crtc_fb_set_legacy(id, mode); + // atombios_overscan_setup display_crtc_scale(id, mode); - // Power CRT Controller - display_crtc_blank(id, ATOM_DISABLE); - display_crtc_power(id, ATOM_ENABLE); - //PLLPower(gDisplay[id]->connection_id, RHD_POWER_ON); + // *** encoder mode set + encoder_mode_set(id, mode->timing.pixel_clock); + encoder_assign_crtc(id); + + // *** CRT controler commit display_crtc_lock(id, ATOM_DISABLE); - // commit + + + // *** encoder commit + // encoder DPMS OFF + encoder_output_lock(false); } + radeon_dpms_set(B_DPMS_ON); + int32 crtstatus = Read32(CRT, D1CRTC_STATUS); TRACE("CRT0 Status: 0x%X\n", crtstatus); crtstatus = Read32(CRT, D2CRTC_STATUS); diff --git a/src/add-ons/accelerants/radeon_hd/mode.h b/src/add-ons/accelerants/radeon_hd/mode.h index 1527978c97..215a17c949 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.h +++ b/src/add-ons/accelerants/radeon_hd/mode.h @@ -29,6 +29,7 @@ status_t create_mode_list(void); bool is_mode_supported(display_mode* mode); status_t is_mode_sane(display_mode *mode); +void radeon_dpms_set(int mode); #endif /*RADEON_HD_MODE_H*/ From ffb494caeb4ebbdd13612139389b1ca62bcfad20 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 5 Oct 2011 04:45:54 +0000 Subject: [PATCH 342/702] * add encoder DPMS code * flip encoders on during modeset. * crt0 status keeps getting higher and higher which is a good sign. the more bits that are set, the closer to a successful lock. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42802 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/encoder.cpp | 78 +++++++++++++++++++ src/add-ons/accelerants/radeon_hd/encoder.h | 1 + src/add-ons/accelerants/radeon_hd/mode.cpp | 7 +- 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 38b15f854f..de27f76cb5 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -241,6 +241,84 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) } +void +encoder_dpms_set(uint8 encoder_id, int mode) +{ + int index = 0; + DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; + + memset(&args, 0, sizeof(args)); + + switch (encoder_id) { + case ENCODER_OBJECT_ID_INTERNAL_TMDS1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: + index = GetIndexIntoMasterTable(COMMAND, TMDSAOutputControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: + ERROR("%s: TODO DIG DPMS set\n", __func__); + return; + case ENCODER_OBJECT_ID_INTERNAL_DVO1: + case ENCODER_OBJECT_ID_INTERNAL_DDI: + index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: + // TODO : encoder dpms set newer cards + // If DCE5, dvo true + // If DCE3, dig true + // else... + index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_LVDS: + index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_LVTM1: + // TODO : Laptop LCD special cases dpms set + // if ATOM_DEVICE_LCD_SUPPORT, LCD1OutputControl + // else... + index = GetIndexIntoMasterTable(COMMAND, LVTMAOutputControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: + // TODO : encoder dpms dce5 dac + // else... + /* + if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) + index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); + else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) + index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); + else + */ + index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_DAC2: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: + // TODO : tv or CV encoder on DAC2 + index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); + break; + } + + switch (mode) { + case B_DPMS_ON: + args.ucAction = ATOM_ENABLE; + atom_execute_table(gAtomContext, index, (uint32*)&args); + // TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = ATOM_LCD_BLON; + // execute again + break; + case B_DPMS_STAND_BY: + case B_DPMS_SUSPEND: + case B_DPMS_OFF: + args.ucAction = ATOM_DISABLE; + atom_execute_table(gAtomContext, index, (uint32*)&args); + // TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = ATOM_LCD_BLOFF; + // execute again + break; + } +} + + void encoder_output_lock(bool lock) { diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index ccd1736fca..19f769d0c1 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -13,6 +13,7 @@ void encoder_assign_crtc(uint8 crt_id); void encoder_mode_set(uint8 id, uint32 pixelClock); void encoder_analog_setup(uint8 id, uint32 pixelClock, int command); void encoder_output_lock(bool lock); +void encoder_dpms_set(uint8 encoder_id, int mode); #endif /* RADEON_HD_ENCODER_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index c4a73298da..8635e96087 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -136,9 +136,11 @@ radeon_set_display_mode(display_mode *mode) if (gDisplay[id]->active == false) continue; + uint16 connector_index = gDisplay[id]->connector_index; // *** encoder prep encoder_output_lock(true); - // encoder DPMS OFF + encoder_dpms_set(gConnector[connector_index]->encoder_object_id, + B_DPMS_OFF); // *** CRT controler prep display_crtc_lock(id, ATOM_ENABLE); @@ -167,7 +169,8 @@ radeon_set_display_mode(display_mode *mode) // *** encoder commit - // encoder DPMS OFF + encoder_dpms_set(gConnector[connector_index]->encoder_object_id, + B_DPMS_ON); encoder_output_lock(false); } From 13cf6c7044cc27149d4b70022dc661e202d090ca Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 5 Oct 2011 18:56:58 +0000 Subject: [PATCH 343/702] Forgot to change the grist of the GCC4 wpa_supplicant package in r42800. Sorry. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42803 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalPackages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 14ad85ceee..e1b6b3fafa 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -1757,7 +1757,7 @@ if [ IsOptionalHaikuImagePackageAdded wpa_supplicant ] { Echo "No optional package wpa_supplicant available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4) { InstallOptionalHaikuImagePackage - wpa_supplicant-0.7.3-x86-gcc4-2011-09-27.zip + wpa_supplicant-0.7.3-x86-gcc4-2011-10-03.zip : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2011-10-03.zip ; } else { InstallOptionalHaikuImagePackage From fe8708f308eca0c8867eae4669df769a25271655 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 6 Oct 2011 10:22:02 +0000 Subject: [PATCH 344/702] * Update the wpa_supplicant package to include the latest synchronous join changes. * Fix the conditional for GCC4 where I missed removing a closing parenthesis. Thanks to Jens Arm for pointing out that not-as-obvious-as-hoped-for syntax error. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42804 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalPackages | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index e1b6b3fafa..60ddfb5518 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -1755,14 +1755,14 @@ if [ IsOptionalHaikuImagePackageAdded WonderBrush ] { if [ IsOptionalHaikuImagePackageAdded wpa_supplicant ] { if $(TARGET_ARCH) != x86 { Echo "No optional package wpa_supplicant available for $(TARGET_ARCH)" ; - } else if $(HAIKU_GCC_VERSION[1]) >= 4) { + } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - wpa_supplicant-0.7.3-x86-gcc4-2011-10-03.zip - : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2011-10-03.zip ; + wpa_supplicant-0.7.3-x86-gcc4-2011-10-05.zip + : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2011-10-05.zip ; } else { InstallOptionalHaikuImagePackage - wpa_supplicant-0.7.3-x86-gcc2-2011-09-27.zip - : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc2-2011-09-27.zip ; + wpa_supplicant-0.7.3-x86-gcc2-2011-10-05.zip + : $(baseURL)/wpa_supplicant-0.7.3-x86-gcc2-2011-10-05.zip ; } } From 4890c4a26513bba4c3d24276c8b048e9bc43a30a Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 7 Oct 2011 10:15:57 +0000 Subject: [PATCH 345/702] * Add functions for constructing a settings file from messages and settings templates. * Prepare saving of such generated config files. Actually writing them out isn't yet done however. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42805 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/net/Settings.cpp | 192 +++++++++++++++++++++++++++++++++-- src/servers/net/Settings.h | 17 ++++ 2 files changed, 200 insertions(+), 9 deletions(-) diff --git a/src/servers/net/Settings.cpp b/src/servers/net/Settings.cpp index 1ad1387332..c164cf4dda 100644 --- a/src/servers/net/Settings.cpp +++ b/src/servers/net/Settings.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -214,7 +215,7 @@ Settings::_ConvertFromDriverParameter(const driver_parameter& parameter, for (int32 j = 0; j < parameter.parameter_count; j++) { status = _ConvertFromDriverParameter(parameter.parameters[j], settingsTemplate->sub_template, subMessage); - if (status < B_OK) + if (status != B_OK) break; const settings_template* parentValueTemplate @@ -245,7 +246,7 @@ Settings::_ConvertFromDriverSettings(const driver_settings& settings, // ignore unknown entries continue; } - if (status < B_OK) + if (status != B_OK) return status; } @@ -259,7 +260,7 @@ Settings::_ConvertFromDriverSettings(const char* name, { BPath path; status_t status = _GetPath(name, path); - if (status < B_OK) + if (status != B_OK) return status; void* handle = load_driver_settings(path.Path()); @@ -277,24 +278,164 @@ Settings::_ConvertFromDriverSettings(const char* name, } +status_t +Settings::_AppendSettings(const settings_template* settingsTemplate, + BString& settings, const BMessage& message, const char* name, + type_code type, int32 count, const char* settingName) +{ + const settings_template* valueTemplate + = _FindSettingsTemplate(settingsTemplate, name); + if (valueTemplate == NULL) { + fprintf(stderr, "unknown field %s\n", name); + return B_BAD_VALUE; + } + + if (valueTemplate->type != type) { + fprintf(stderr, "field type mismatch %s\n", name); + return B_BAD_VALUE; + } + + if (settingName == NULL) + settingName = name; + + if (type != B_MESSAGE_TYPE) { + settings.Append("\n"); + settings.Append(settingName); + settings.Append("\t"); + } + + for (int32 valueIndex = 0; valueIndex < count; valueIndex++) { + if (valueIndex > 0 && type != B_MESSAGE_TYPE) + settings.Append(" "); + + switch (type) { + case B_BOOL_TYPE: + { + bool value; + status_t result = message.FindBool(name, valueIndex, &value); + if (result != B_OK) + return result; + + settings.Append(value ? "true" : "false"); + break; + } + + case B_STRING_TYPE: + { + const char* value = NULL; + status_t result = message.FindString(name, valueIndex, &value); + if (result != B_OK) + return result; + + settings.Append(value); + break; + } + + case B_INT32_TYPE: + { + int32 value; + status_t result = message.FindInt32(name, valueIndex, &value); + if (result != B_OK) + return result; + + char buffer[100]; + snprintf(buffer, sizeof(buffer), "%"B_PRId32, value); + settings.Append(buffer, sizeof(buffer)); + break; + } + + case B_MESSAGE_TYPE: + { + BMessage subMessage; + status_t result = message.FindMessage(name, valueIndex, + &subMessage); + if (result != B_OK) + return result; + + const settings_template* parentValueTemplate + = _FindParentValueTemplate(valueTemplate); + if (parentValueTemplate != NULL) { + _AppendSettings(valueTemplate->sub_template, settings, + subMessage, parentValueTemplate->name, + parentValueTemplate->type, 1, name); + subMessage.RemoveName(parentValueTemplate->name); + } + + BString subSettings; + _ConvertToDriverSettings(valueTemplate->sub_template, + subSettings, subMessage); + subSettings.ReplaceAll("\n", "\n\t"); + subSettings.RemoveFirst("\n"); + + settings.Append(" {\n"); + settings.Append(subSettings); + settings.Append("\n}"); + } + } + } + + return B_OK; +} + + +status_t +Settings::_ConvertToDriverSettings(const settings_template* settingsTemplate, + BString& settings, const BMessage& message) +{ + int32 index = 0; + char *name = NULL; + type_code type; + int32 count = 0; + + while (message.GetInfo(B_ANY_TYPE, index++, &name, &type, &count) == B_OK) { + status_t result = _AppendSettings(settingsTemplate, settings, message, + name, type, count); + if (result != B_OK) + return result; + } + + return B_OK; +} + + +status_t +Settings::_ConvertToDriverSettings(const char* name, + const settings_template* settingsTemplate, const BMessage& message) +{ + BPath path; + status_t status = _GetPath(name, path); + if (status != B_OK) + return status; + + BString settings; + status = _ConvertToDriverSettings(settingsTemplate, settings, message); + if (status == B_OK) { + settings.RemoveFirst("\n"); + // TODO: actually write the settings.String() out into the file + } + + return status; +} + + status_t Settings::_Load(const char* name, uint32* _type) { status_t status = B_ENTRY_NOT_FOUND; - if (name == NULL || !strcmp(name, "interfaces")) { + if (name == NULL || strcmp(name, "interfaces") == 0) { status = _ConvertFromDriverSettings("interfaces", kInterfacesTemplate, fInterfaces); if (status == B_OK && _type != NULL) *_type = kMsgInterfaceSettingsUpdated; } - if (name == NULL || !strcmp(name, "wireless_networks")) { + if (name == NULL || strcmp(name, "wireless_networks") == 0) { status = _ConvertFromDriverSettings("wireless_networks", kNetworksTemplate, fNetworks); if (status == B_OK && _type != NULL) *_type = kMsgInterfaceSettingsUpdated; } - if (name == NULL || !strcmp(name, "services")) { + if (name == NULL || strcmp(name, "services") == 0) { status = _ConvertFromDriverSettings("services", kServicesTemplate, fServices); if (status == B_OK && _type != NULL) @@ -305,12 +446,34 @@ Settings::_Load(const char* name, uint32* _type) } +status_t +Settings::_Save(const char* name) +{ + status_t status = B_ENTRY_NOT_FOUND; + + if (name == NULL || strcmp(name, "interfaces") == 0) { + status = _ConvertToDriverSettings("interfaces", kInterfacesTemplate, + fInterfaces); + } + if (name == NULL || strcmp(name, "wireless_networks") == 0) { + status = _ConvertToDriverSettings("wireless_networks", + kNetworksTemplate, fNetworks); + } + if (name == NULL || strcmp(name, "services") == 0) { + status = _ConvertToDriverSettings("services", kServicesTemplate, + fServices); + } + + return status; +} + + status_t Settings::_StartWatching(const char* name, const BMessenger& target) { BPath path; status_t status = _GetPath(name, path); - if (status < B_OK) + if (status != B_OK) return status; return BPrivate::BPathMonitor::StartWatching(path.Path(), B_WATCH_STAT, @@ -352,8 +515,8 @@ Settings::Update(BMessage* message) { const char* pathName; int32 opcode; - if (message->FindInt32("opcode", &opcode) < B_OK - || message->FindString("path", &pathName) < B_OK) + if (message->FindInt32("opcode", &opcode) != B_OK + || message->FindString("path", &pathName) != B_OK) return B_BAD_VALUE; BPath settingsFolderPath; @@ -412,6 +575,17 @@ Settings::GetNextNetwork(uint32& cookie, BMessage& network) } +status_t +Settings::AddNetwork(const BMessage& network) +{ + status_t result = fNetworks.AddMessage("network", &network); + if (result != B_OK) + return result; + + return _Save("wireless_networks"); +} + + status_t Settings::GetNextService(uint32& cookie, BMessage& service) { diff --git a/src/servers/net/Settings.h b/src/servers/net/Settings.h index 7ca90cdf42..d782f1ebbd 100644 --- a/src/servers/net/Settings.h +++ b/src/servers/net/Settings.h @@ -25,8 +25,11 @@ public: status_t GetNextInterface(uint32& cookie, BMessage& interface); + status_t GetNextNetwork(uint32& cookie, BMessage& network); + status_t AddNetwork(const BMessage& network); + status_t GetNextService(uint32& cookie, BMessage& service); const BMessage& Services() const; @@ -39,6 +42,7 @@ public: private: status_t _Load(const char* name = NULL, uint32* _type = NULL); + status_t _Save(const char* name = NULL); status_t _GetPath(const char* name, BPath& path); status_t _StartWatching(const char* name, @@ -64,6 +68,19 @@ private: const settings_template* settingsTemplate, BMessage& message); + status_t _AppendSettings( + const settings_template* settingsTemplate, + BString& settings, const BMessage& message, + const char* name, type_code type, + int32 count, + const char* settingName = NULL); + status_t _ConvertToDriverSettings( + const settings_template* settingsTemplate, + BString& settings, const BMessage& message); + status_t _ConvertToDriverSettings(const char* path, + const settings_template* settingsTemplate, + const BMessage& message); + bool _IsWatching(const BMessenger& target) const { return fListener == target; } bool _IsWatching() const From 8fecaf03e3cb4756b82f7285f4132f650d71b871 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 7 Oct 2011 10:18:21 +0000 Subject: [PATCH 346/702] Add message handling for adding persistent network configurations (as in wireless_network). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42806 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/net/NetServer.h | 9 +++++---- src/servers/net/NetServer.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/headers/private/net/NetServer.h b/headers/private/net/NetServer.h index b80469a06b..70b7eb0fff 100644 --- a/headers/private/net/NetServer.h +++ b/headers/private/net/NetServer.h @@ -11,10 +11,11 @@ #define kNetServerSignature "application/x-vnd.haiku-net_server" -#define kMsgConfigureInterface 'COif' -#define kMsgConfigureResolver 'COrs' -#define kMsgJoinNetwork 'JNnw' -#define kMsgLeaveNetwork 'LVnw' +#define kMsgConfigureInterface 'COif' +#define kMsgConfigureResolver 'COrs' +#define kMsgAddPersistentNetwork 'APnw' +#define kMsgJoinNetwork 'JNnw' +#define kMsgLeaveNetwork 'LVnw' #endif // _NET_SERVER_H diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp index 872c1fc558..301f827c86 100644 --- a/src/servers/net/NetServer.cpp +++ b/src/servers/net/NetServer.cpp @@ -357,6 +357,16 @@ NetServer::MessageReceived(BMessage* message) break; } + case kMsgAddPersistentNetwork: + { + status_t status = fSettings.AddNetwork(*message); + + BMessage reply(B_REPLY); + reply.AddInt32("status", status); + message->SendReply(&reply); + break; + } + default: BApplication::MessageReceived(message); return; From a1b98367ae834c4bb2027a0a7b8e9384af0f89d3 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 7 Oct 2011 10:23:47 +0000 Subject: [PATCH 347/702] Add a way to add persistent (configured) wireless_networks that will eventually be stored by the backend in the net_server. I put it in BNetworkDevice because that is where network enumeration is done as well, but I'm not sure that it fits there particularly well. Since BNetworkDevice::GetNetwork() directly interfaces with the driver and gets the networks from scan results, such persistent networks don't yet show up in those enumerations. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42807 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/net/NetworkDevice.h | 3 + src/kits/network/libnetapi/NetworkDevice.cpp | 84 ++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/headers/os/net/NetworkDevice.h b/headers/os/net/NetworkDevice.h index 181097585c..fb97c26218 100644 --- a/headers/os/net/NetworkDevice.h +++ b/headers/os/net/NetworkDevice.h @@ -97,6 +97,9 @@ public: status_t GetNetwork(const BNetworkAddress& address, wireless_network& network); + status_t AddPersistentNetwork( + const wireless_network& network); + status_t JoinNetwork(const char* name, const char* password = NULL); status_t JoinNetwork(const wireless_network& network, diff --git a/src/kits/network/libnetapi/NetworkDevice.cpp b/src/kits/network/libnetapi/NetworkDevice.cpp index 827ee06732..f4ac139fdf 100644 --- a/src/kits/network/libnetapi/NetworkDevice.cpp +++ b/src/kits/network/libnetapi/NetworkDevice.cpp @@ -696,6 +696,90 @@ BNetworkDevice::GetNetwork(const BNetworkAddress& address, } +status_t +BNetworkDevice::AddPersistentNetwork(const wireless_network& network) +{ + BMessage message(kMsgAddPersistentNetwork); + status_t status = message.AddString("name", network.name); + if (status != B_OK) + return status; + + if (status == B_OK && network.address.Family() == AF_LINK) { + size_t addressLength = network.address.LinkLevelAddressLength(); + uint8* macAddress = network.address.LinkLevelAddress(); + bool usable = false; + BString formatted; + + for (size_t index = 0; index < addressLength; index++) { + if (index > 0) + formatted.Append(":"); + char buffer[3]; + snprintf(buffer, sizeof(buffer), "%2x", macAddress[index]); + formatted.Append(buffer, sizeof(buffer)); + + if (macAddress[index] != 0) + usable = true; + } + + if (usable) + status = message.AddString("mac", formatted); + } + + const char* authentication = NULL; + switch (network.authentication_mode) { + case B_NETWORK_AUTHENTICATION_NONE: + authentication = "none"; + break; + case B_NETWORK_AUTHENTICATION_WEP: + authentication = "wep"; + break; + case B_NETWORK_AUTHENTICATION_WPA: + authentication = "wpa"; + break; + case B_NETWORK_AUTHENTICATION_WPA2: + authentication = "wpa2"; + break; + } + + if (status == B_OK && authentication != NULL) + status = message.AddString("authentication", authentication); + + if (status == B_OK && (network.cipher & B_NETWORK_CIPHER_NONE) != 0) + status = message.AddString("cipher", "none"); + if (status == B_OK && (network.cipher & B_NETWORK_CIPHER_TKIP) != 0) + status = message.AddString("cipher", "tkip"); + if (status == B_OK && (network.cipher & B_NETWORK_CIPHER_CCMP) != 0) + status = message.AddString("cipher", "ccmp"); + + if (status == B_OK && (network.group_cipher & B_NETWORK_CIPHER_NONE) != 0) + status = message.AddString("group_cipher", "none"); + if (status == B_OK && (network.group_cipher & B_NETWORK_CIPHER_WEP_40) != 0) + status = message.AddString("group_cipher", "wep40"); + if (status == B_OK + && (network.group_cipher & B_NETWORK_CIPHER_WEP_104) != 0) { + status = message.AddString("group_cipher", "wep104"); + } + if (status == B_OK && (network.group_cipher & B_NETWORK_CIPHER_TKIP) != 0) + status = message.AddString("group_cipher", "tkip"); + if (status == B_OK && (network.group_cipher & B_NETWORK_CIPHER_CCMP) != 0) + status = message.AddString("group_cipher", "ccmp"); + + // TODO: the other fields aren't currently used, add them when they are + // and when it's clear how they will be stored + + if (status != B_OK) + return status; + + BMessenger networkServer(kNetServerSignature); + BMessage reply; + status = networkServer.SendMessage(&message, &reply); + if (status == B_OK) + reply.FindInt32("status", &status); + + return status; +} + + status_t BNetworkDevice::JoinNetwork(const char* name, const char* password) { From 0c7f804cec9077746a5b0b99d9fbc66b47c9c2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 8 Oct 2011 18:41:20 +0000 Subject: [PATCH 348/702] * mail_util.h was not self-contained. * Added a few missing breaks in MailProtocolThread::MessageReceived()! * Minor coding style update. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42808 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/mail/mail_util.h | 8 +- src/kits/mail/HaikuMailFormatFilter.cpp | 40 +- src/kits/mail/MailProtocol.cpp | 248 +++++---- src/kits/mail/mail_util.cpp | 686 ++++++++++++------------ 4 files changed, 487 insertions(+), 495 deletions(-) diff --git a/headers/private/mail/mail_util.h b/headers/private/mail/mail_util.h index 205b2c9af1..021d069636 100644 --- a/headers/private/mail/mail_util.h +++ b/headers/private/mail/mail_util.h @@ -1,4 +1,5 @@ /* + * Copyright 2011, Haiku, Inc. All rights reserved. * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. */ #ifndef ZOIDBERG_GARGOYLE_MAIL_UTIL_H @@ -10,9 +11,10 @@ #include -#include - +#include #include +#include +#include // TODO: this should only be preserved for gcc2 compatibility @@ -60,7 +62,7 @@ ssize_t utf8_to_rfc2047(char **bufp, ssize_t length,uint32 charset, char encodin // Unidentified charsets and conversion errors cause // the offending text to be skipped. -void FoldLineAtWhiteSpaceAndAddCRLF (BString &string); +void FoldLineAtWhiteSpaceAndAddCRLF(BString &string); // Insert CRLF at various spots in the given string (before white space) so // that the line length is mostly under 78 bytes. Also makes sure there is a // CRLF at the very end. diff --git a/src/kits/mail/HaikuMailFormatFilter.cpp b/src/kits/mail/HaikuMailFormatFilter.cpp index 3462bc00be..7b711effe4 100644 --- a/src/kits/mail/HaikuMailFormatFilter.cpp +++ b/src/kits/mail/HaikuMailFormatFilter.cpp @@ -1,6 +1,7 @@ /* * Copyright 2011, Haiku, Inc. All rights reserved. * Copyright 2011, Clemens Zeidler + * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -17,10 +18,9 @@ struct mail_header_field { - const char *rfc_name; - - const char *attr_name; - type_code attr_type; + const char* rfc_name; + const char* attr_name; + type_code attr_type; // currently either B_STRING_TYPE and B_TIME_TYPE }; @@ -65,7 +65,7 @@ HaikuMailFormatFilter::HeaderFetched(const entry_ref& ref, BFile* file) file->Seek(0, SEEK_SET); BMessage attributes; - // TODO attributes.AddInt32(B_MAIL_ATTR_CONTENT, length); + // TODO: attributes.AddInt32(B_MAIL_ATTR_CONTENT, length); attributes.AddInt32(B_MAIL_ATTR_ACCOUNT_ID, fAccountID); attributes.AddString(B_MAIL_ATTR_ACCOUNT, fAccountName); @@ -83,6 +83,7 @@ HaikuMailFormatFilter::HeaderFetched(const entry_ref& ref, BFile* file) gDefaultFields[i].rfc_name, target); if (status != B_OK) continue; + switch (gDefaultFields[i].attr_type){ case B_STRING_TYPE: attributes.AddString(gDefaultFields[i].attr_name, target); @@ -111,8 +112,9 @@ HaikuMailFormatFilter::HeaderFetched(const entry_ref& ref, BFile* file) if (name.Length() <= 0) name = "No Subject"; attributes.AddString(B_MAIL_ATTR_THREAD, name); + // Avoid hidden files, starting with a dot. if (name[0] == '.') - name.Prepend ("_"); // Avoid hidden files, starting with a dot. + name.Prepend ("_"); // Convert the date into a year-month-day fixed digit width format, so that // sorting by file name will give all the messages with the same subject in @@ -120,23 +122,20 @@ HaikuMailFormatFilter::HeaderFetched(const entry_ref& ref, BFile* file) time_t dateAsTime = 0; const time_t* datePntr; ssize_t dateSize; - char numericDateString [40]; + char numericDateString[40]; struct tm timeFields; if (attributes.FindData(B_MAIL_ATTR_WHEN, B_TIME_TYPE, - (const void**)&datePntr, &dateSize) == B_OK) + (const void**)&datePntr, &dateSize) == B_OK) dateAsTime = *datePntr; localtime_r(&dateAsTime, &timeFields); - sprintf(numericDateString, "%04d%02d%02d%02d%02d%02d", - timeFields.tm_year + 1900, - timeFields.tm_mon + 1, - timeFields.tm_mday, - timeFields.tm_hour, - timeFields.tm_min, - timeFields.tm_sec); + snprintf(numericDateString, sizeof(numericDateString), + "%04d%02d%02d%02d%02d%02d", + timeFields.tm_year + 1900, timeFields.tm_mon + 1, timeFields.tm_mday, + timeFields.tm_hour, timeFields.tm_min, timeFields.tm_sec); name << " " << numericDateString; - BString worker = attributes.FindString("MAIL:from"); + BString worker = attributes.FindString(B_MAIL_ATTR_FROM); extract_address_name(worker); name << " " << worker; @@ -149,8 +148,9 @@ HaikuMailFormatFilter::HeaderFetched(const entry_ref& ref, BFile* file) name.ReplaceAll('!', '_'); name.ReplaceAll('<', '_'); name.ReplaceAll('>', '_'); - while (name.FindFirst(" ") >= 0) // Remove multiple spaces. - name.Replace(" " /* Old */, " " /* New */, 1024 /* Count */); + // Remove multiple spaces. + while (name.FindFirst(" ") >= 0) + name.Replace(" ", " ", 1024); worker = name; int32 identicalNumber = 1; @@ -162,10 +162,10 @@ HaikuMailFormatFilter::HeaderFetched(const entry_ref& ref, BFile* file) worker << "_" << identicalNumber; status = _SetFileName(ref, worker); } - if (status < B_OK) + if (status < B_OK) { printf("FolderFilter::ProcessMailMessage: could not rename mail (%s)! " "(should be: %s)\n",strerror(status), worker.String()); - else { + } else { entry_ref to(ref.device, ref.directory, worker); fMailProtocol.FileRenamed(ref, to); } diff --git a/src/kits/mail/MailProtocol.cpp b/src/kits/mail/MailProtocol.cpp index e494c711d5..54623d5e12 100644 --- a/src/kits/mail/MailProtocol.cpp +++ b/src/kits/mail/MailProtocol.cpp @@ -1,7 +1,7 @@ -/* BMailProtocol - the base class for protocol filters -** -** Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. -*/ +/* + * Copyright 2011, Haiku, Inc. All rights reserved. + * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. + */ #include @@ -35,56 +35,65 @@ using std::map; +const uint32 kMsgSyncMessages = '&SyM'; +const uint32 kMsgDeleteMessage = '&DeM'; +const uint32 kMsgAppendMessage = '&ApM'; + +const uint32 kMsgMoveFile = '&MoF'; +const uint32 kMsgDeleteFile = '&DeF'; +const uint32 kMsgFileRenamed = '&FiR'; +const uint32 kMsgFileDeleted = '&FDe'; +const uint32 kMsgInit = '&Ini'; + +const uint32 kMsgSendMessage = '&SeM'; + + MailFilter::MailFilter(MailProtocol& protocol, AddonSettings* settings) : fMailProtocol(protocol), fAddonSettings(settings) { - } MailFilter::~MailFilter() { - } void MailFilter::HeaderFetched(const entry_ref& ref, BFile* file) { - } void MailFilter::BodyFetched(const entry_ref& ref, BFile* file) { - } void MailFilter::MailboxSynced(status_t status) { - } void MailFilter::MessageReadyToSend(const entry_ref& ref, BFile* file) { - } void MailFilter::MessageSent(const entry_ref& ref, BFile* file) { - } +// #pragma mark - + + MailProtocol::MailProtocol(BMailAccountSettings* settings) : fMailNotifier(NULL), @@ -379,6 +388,9 @@ MailProtocol::_LoadFilter(AddonSettings* filterSettings) } +// #pragma mark - + + InboundProtocol::InboundProtocol(BMailAccountSettings* settings) : MailProtocol(settings) @@ -389,7 +401,7 @@ InboundProtocol::InboundProtocol(BMailAccountSettings* settings) InboundProtocol::~InboundProtocol() { - + } @@ -408,6 +420,9 @@ InboundProtocol::MarkMessageAsRead(const entry_ref& ref, read_flags flag) } +// #pragma mark - + + OutboundProtocol::OutboundProtocol(BMailAccountSettings* settings) : MailProtocol(settings) @@ -418,15 +433,11 @@ OutboundProtocol::OutboundProtocol(BMailAccountSettings* settings) OutboundProtocol::~OutboundProtocol() { - + } -const uint32 kMsgMoveFile = '&MoF'; -const uint32 kMsgDeleteFile = '&DeF'; -const uint32 kMsgFileRenamed = '&FiR'; -const uint32 kMsgFileDeleted = '&FDe'; -const uint32 kMsgInit = '&Ini'; +// #pragma mark - MailProtocolThread::MailProtocolThread(MailProtocol* protocol) @@ -448,48 +459,50 @@ void MailProtocolThread::MessageReceived(BMessage* message) { switch (message->what) { - case kMsgInit: - fMailProtocol->SetProtocolThread(this); - break; + case kMsgInit: + fMailProtocol->SetProtocolThread(this); + break; - case kMsgMoveFile: - { - entry_ref file; - message->FindRef("file", &file); - entry_ref dir; - message->FindRef("directory", &dir); - BDirectory directory(&dir); - fMailProtocol->MoveMessage(file, directory); - break; - } + case kMsgMoveFile: + { + entry_ref file; + message->FindRef("file", &file); + entry_ref dir; + message->FindRef("directory", &dir); + BDirectory directory(&dir); + fMailProtocol->MoveMessage(file, directory); + break; + } - case kMsgDeleteFile: - { - entry_ref file; - message->FindRef("file", &file); - fMailProtocol->DeleteMessage(file); - break; - } + case kMsgDeleteFile: + { + entry_ref file; + message->FindRef("file", &file); + fMailProtocol->DeleteMessage(file); + break; + } - case kMsgFileRenamed: - { - entry_ref from; - message->FindRef("from", &from); - entry_ref to; - message->FindRef("to", &to); - fMailProtocol->FileRenamed(from, to); - } + case kMsgFileRenamed: + { + entry_ref from; + message->FindRef("from", &from); + entry_ref to; + message->FindRef("to", &to); + fMailProtocol->FileRenamed(from, to); + break; + } - case kMsgFileDeleted: - { - node_ref node; - message->FindInt32("device",&node.device); - message->FindInt64("node", &node.node); - fMailProtocol->FileDeleted(node); - } + case kMsgFileDeleted: + { + node_ref node; + message->FindInt32("device",&node.device); + message->FindInt64("node", &node.node); + fMailProtocol->FileDeleted(node); + break; + } - default: - BLooper::MessageReceived(message); + default: + BLooper::MessageReceived(message); } } @@ -538,9 +551,7 @@ MailProtocolThread::TriggerFileDeleted(const node_ref& node) } -const uint32 kMsgSyncMessages = '&SyM'; -const uint32 kMsgDeleteMessage = '&DeM'; -const uint32 kMsgAppendMessage = '&ApM'; +// #pragma mark - InboundProtocolThread::InboundProtocolThread(InboundProtocol* protocol) @@ -562,57 +573,58 @@ void InboundProtocolThread::MessageReceived(BMessage* message) { switch (message->what) { - case kMsgSyncMessages: - { - status_t status = fProtocol->SyncMessages(); - _NotiyMailboxSynced(status); - break; - } - - case kMsgFetchBody: - { - entry_ref ref; - message->FindRef("ref", &ref); - status_t status = fProtocol->FetchBody(ref); - - BMessenger target; - if (message->FindMessenger("target", &target) != B_OK) + case kMsgSyncMessages: + { + status_t status = fProtocol->SyncMessages(); + _NotiyMailboxSynced(status); break; + } - BMessage message(kMsgBodyFetched); - message.AddInt32("status", status); - message.AddRef("ref", &ref); - target.SendMessage(&message); - break; - } + case kMsgFetchBody: + { + entry_ref ref; + message->FindRef("ref", &ref); + status_t status = fProtocol->FetchBody(ref); - case kMsgMarkMessageAsRead: - { - entry_ref ref; - message->FindRef("ref", &ref); - read_flags read = (read_flags)message->FindInt32("read"); - fProtocol->MarkMessageAsRead(ref, read); - break; - } + BMessenger target; + if (message->FindMessenger("target", &target) != B_OK) + break; - case kMsgDeleteMessage: - { - entry_ref ref; - message->FindRef("ref", &ref); - fProtocol->DeleteMessage(ref); - break; - } + BMessage message(kMsgBodyFetched); + message.AddInt32("status", status); + message.AddRef("ref", &ref); + target.SendMessage(&message); + break; + } - case kMsgAppendMessage: - { - entry_ref ref; - message->FindRef("ref", &ref); - fProtocol->AppendMessage(ref); - break; - } + case kMsgMarkMessageAsRead: + { + entry_ref ref; + message->FindRef("ref", &ref); + read_flags read = (read_flags)message->FindInt32("read"); + fProtocol->MarkMessageAsRead(ref, read); + break; + } - default: - MailProtocolThread::MessageReceived(message); + case kMsgDeleteMessage: + { + entry_ref ref; + message->FindRef("ref", &ref); + fProtocol->DeleteMessage(ref); + break; + } + + case kMsgAppendMessage: + { + entry_ref ref; + message->FindRef("ref", &ref); + fProtocol->AppendMessage(ref); + break; + } + + default: + MailProtocolThread::MessageReceived(message); + break; } } @@ -671,7 +683,7 @@ InboundProtocolThread::_NotiyMailboxSynced(status_t status) } -const uint32 kMsgSendMessage = '&SeM'; +// #pragma mark - OutboundProtocolThread::OutboundProtocolThread(OutboundProtocol* protocol) @@ -693,22 +705,22 @@ void OutboundProtocolThread::MessageReceived(BMessage* message) { switch (message->what) { - case kMsgSendMessage: - { - std::vector mails; - for (int32 i = 0; ;i++) { - entry_ref ref; - if (message->FindRef("ref", i, &ref) != B_OK) - break; - mails.push_back(ref); + case kMsgSendMessage: + { + std::vector mails; + for (int32 i = 0; ;i++) { + entry_ref ref; + if (message->FindRef("ref", i, &ref) != B_OK) + break; + mails.push_back(ref); + } + size_t size = message->FindInt32("size"); + fProtocol->SendMessages(mails, size); + break; } - size_t size = message->FindInt32("size"); - fProtocol->SendMessages(mails, size); - break; - } - default: - MailProtocolThread::MessageReceived(message); + default: + MailProtocolThread::MessageReceived(message); } } diff --git a/src/kits/mail/mail_util.cpp b/src/kits/mail/mail_util.cpp index 1bf5423184..751690aa0a 100644 --- a/src/kits/mail/mail_util.cpp +++ b/src/kits/mail/mail_util.cpp @@ -1,15 +1,10 @@ -/* mail util - header parsing -** -** Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. -*/ +/* + * Copyright 2011, Haiku, Inc. All rights reserved. + * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. + */ -#include -#include -#include -#include -#include -#include +#include #include #include @@ -18,27 +13,30 @@ #include #include #include + +#include +#include #include +#include +#include #include -#include - #include #include + using namespace BPrivate; + #define CRLF "\r\n" -struct CharsetConversionEntry -{ +struct CharsetConversionEntry { const char *charset; uint32 flavor; }; -extern const CharsetConversionEntry mail_charsets [] = -{ +extern const CharsetConversionEntry mail_charsets[] = { // In order of authority, so when searching for the name for a particular // numbered conversion, start at the beginning of the array. {"iso-8859-1", B_ISO1_CONVERSION}, // MIME STANDARD @@ -86,239 +84,16 @@ extern const CharsetConversionEntry mail_charsets [] = }; -status_t -write_read_attr(BNode& node, read_flags flag) -{ - if (node.WriteAttr(B_MAIL_ATTR_READ, B_INT32_TYPE, 0, &flag, sizeof(int32)) - < 0) - return B_ERROR; - -#if R5_COMPATIBLE - // manage the status string only if it currently has a "read" status - BString currentStatus; - if (node.ReadAttrString(B_MAIL_ATTR_STATUS, ¤tStatus) == B_OK) { - if (currentStatus.ICompare("New") != 0 - && currentStatus.ICompare("Read") != 0 - && currentStatus.ICompare("Seen") != 0) - return B_OK; - } - - const char* statusString = (flag == B_READ) ? "Read" - : (flag == B_SEEN) ? "Seen" : "New"; - if (node.WriteAttr(B_MAIL_ATTR_STATUS, B_STRING_TYPE, 0, statusString, - strlen(statusString)) < 0) - return B_ERROR; -#endif - return B_OK; -} +static int32 gLocker = 0; +static size_t gNsub = 1; +static re_pattern_buffer gRe; +static re_pattern_buffer *gRebuf = NULL; +static unsigned char gTranslation[256]; -status_t -read_read_attr(BNode& node, read_flags& flag) -{ - if (node.ReadAttr(B_MAIL_ATTR_READ, B_INT32_TYPE, 0, &flag, sizeof(int32)) - == sizeof(int32)) - return B_OK; - -#if R5_COMPATIBLE - BString statusString; - if (node.ReadAttrString(B_MAIL_ATTR_STATUS, &statusString) == B_OK) { - if (statusString.ICompare("New")) - flag = B_UNREAD; - else - flag = B_READ; - - return B_OK; - } -#endif - return B_ERROR; -} - - -// The next couple of functions are our wrapper around convert_to_utf8 and -// convert_from_utf8 so that they can also convert from UTF-8 to UTF-8 by -// specifying the B_MAIL_UTF8_CONVERSION constant as the conversion operation. It -// also lets us add new conversions, like B_MAIL_US_ASCII_CONVERSION. - -_EXPORT status_t mail_convert_to_utf8 ( - uint32 srcEncoding, - const char *src, - int32 *srcLen, - char *dst, - int32 *dstLen, - int32 *state, - char substitute) -{ - int32 copyAmount; - char *originalDst = dst; - status_t returnCode = -1; - - if (srcEncoding == B_MAIL_UTF8_CONVERSION) { - copyAmount = *srcLen; - if (*dstLen < copyAmount) - copyAmount = *dstLen; - memcpy (dst, src, copyAmount); - *srcLen = copyAmount; - *dstLen = copyAmount; - returnCode = B_OK; - } else if (srcEncoding == B_MAIL_US_ASCII_CONVERSION) { - int32 i; - unsigned char letter; - copyAmount = *srcLen; - if (*dstLen < copyAmount) - copyAmount = *dstLen; - for (i = 0; i < copyAmount; i++) { - letter = *src++; - if (letter > 0x80U) - // Invalid, could also use substitute, but better to strip high bit. - *dst++ = letter - 0x80U; - else if (letter == 0x80U) - // Can't convert to 0x00 since that's NUL, which would cause problems. - *dst++ = substitute; - else - *dst++ = letter; - } - *srcLen = copyAmount; - *dstLen = copyAmount; - returnCode = B_OK; - } else - returnCode = convert_to_utf8 (srcEncoding, src, srcLen, - dst, dstLen, state, substitute); - - if (returnCode == B_OK) { - // Replace spurious NUL bytes, which should normally not be in the - // output of the decoding (not normal UTF-8 characters, and no NULs are - // in our usual input strings). They happen for some odd ISO-2022-JP - // byte pair combinations which are improperly handled by the BeOS - // routines. Like "\e$ByD\e(B" where \e is the ESC character $1B, the - // first ESC $ B switches to a Japanese character set, then the next - // two bytes "yD" specify a character, then ESC ( B switches back to - // the ASCII character set. The UTF-8 conversion yields a NUL byte. - int32 i; - for (i = 0; i < *dstLen; i++) - if (originalDst[i] == 0) - originalDst[i] = substitute; - } - return returnCode; -} - - -_EXPORT status_t mail_convert_from_utf8 ( - uint32 dstEncoding, - const char *src, - int32 *srcLen, - char *dst, - int32 *dstLen, - int32 *state, - char substitute) -{ - int32 copyAmount; - status_t errorCode; - int32 originalDstLen = *dstLen; - int32 tempDstLen; - int32 tempSrcLen; - - if (dstEncoding == B_MAIL_UTF8_CONVERSION) - { - copyAmount = *srcLen; - if (*dstLen < copyAmount) - copyAmount = *dstLen; - memcpy (dst, src, copyAmount); - *srcLen = copyAmount; - *dstLen = copyAmount; - return B_OK; - } - - if (dstEncoding == B_MAIL_US_ASCII_CONVERSION) - { - int32 characterLength; - int32 dstRemaining = *dstLen; - unsigned char letter; - int32 srcRemaining = *srcLen; - - // state contains the number of source bytes to skip, left over from a - // partial UTF-8 character split over the end of the buffer from last - // time. - if (srcRemaining <= *state) { - *state -= srcRemaining; - *dstLen = 0; - return B_OK; - } - srcRemaining -= *state; - src += *state; - *state = 0; - - while (true) { - if (srcRemaining <= 0 || dstRemaining <= 0) - break; - letter = *src; - if (letter < 0x80) - characterLength = 1; // Regular ASCII equivalent code. - else if (letter < 0xC0) - characterLength = 1; // Invalid in-between data byte 10xxxxxx. - else if (letter < 0xE0) - characterLength = 2; - else if (letter < 0xF0) - characterLength = 3; - else if (letter < 0xF8) - characterLength = 4; - else if (letter < 0xFC) - characterLength = 5; - else if (letter < 0xFE) - characterLength = 6; - else - characterLength = 1; // 0xFE and 0xFF are invalid in UTF-8. - if (letter < 0x80) - *dst++ = *src; - else - *dst++ = substitute; - dstRemaining--; - if (srcRemaining < characterLength) { - // Character split past the end of the buffer. - *state = characterLength - srcRemaining; - srcRemaining = 0; - } else { - src += characterLength; - srcRemaining -= characterLength; - } - } - // Update with the amounts used. - *srcLen = *srcLen - srcRemaining; - *dstLen = *dstLen - dstRemaining; - return B_OK; - } - - errorCode = convert_from_utf8 (dstEncoding, src, srcLen, dst, dstLen, state, substitute); - if (errorCode != B_OK) - return errorCode; - - if (dstEncoding != B_JIS_CONVERSION) - return B_OK; - - // B_JIS_CONVERSION (ISO-2022-JP) works by shifting between different - // character subsets. For E-mail headers (and other uses), it needs to be - // switched back to ASCII at the end (otherwise the last character gets - // lost or other weird things happen in the headers). Note that we can't - // just append the escape code since the convert_from_utf8 "state" will be - // wrong. So we append an ASCII letter and throw it away, leaving just the - // escape code. Well, it actually switches to the Roman character set, not - // ASCII, but that should be OK. - - tempDstLen = originalDstLen - *dstLen; - if (tempDstLen < 3) // Not enough space remaining in the output. - return B_OK; // Sort of an error, but we did convert the rest OK. - tempSrcLen = 1; - errorCode = convert_from_utf8 (dstEncoding, "a", &tempSrcLen, - dst + *dstLen, &tempDstLen, state, substitute); - if (errorCode != B_OK) - return errorCode; - *dstLen += tempDstLen - 1 /* don't include the ASCII letter */; - return B_OK; -} - - - -static int handle_non_rfc2047_encoding(char **buffer,size_t *bufferLength,size_t *sourceLength) +static int +handle_non_rfc2047_encoding(char **buffer, size_t *bufferLength, + size_t *sourceLength) { char *string = *buffer; int32 length = *sourceLength; @@ -374,7 +149,230 @@ static int handle_non_rfc2047_encoding(char **buffer,size_t *bufferLength,size_t } -_EXPORT ssize_t rfc2047_to_utf8(char **bufp, size_t *bufLen, size_t strLen) +// #pragma mark - + + +status_t +write_read_attr(BNode& node, read_flags flag) +{ + if (node.WriteAttr(B_MAIL_ATTR_READ, B_INT32_TYPE, 0, &flag, sizeof(int32)) + < 0) + return B_ERROR; + + // manage the status string only if it currently has a "read" status + BString currentStatus; + if (node.ReadAttrString(B_MAIL_ATTR_STATUS, ¤tStatus) == B_OK) { + if (currentStatus.ICompare("New") != 0 + && currentStatus.ICompare("Read") != 0 + && currentStatus.ICompare("Seen") != 0) + return B_OK; + } + + const char* statusString = flag == B_READ ? "Read" + : flag == B_SEEN ? "Seen" : "New"; + if (node.WriteAttr(B_MAIL_ATTR_STATUS, B_STRING_TYPE, 0, statusString, + strlen(statusString)) < 0) + return B_ERROR; + + return B_OK; +} + + +status_t +read_read_attr(BNode& node, read_flags& flag) +{ + if (node.ReadAttr(B_MAIL_ATTR_READ, B_INT32_TYPE, 0, &flag, sizeof(int32)) + == sizeof(int32)) + return B_OK; + + BString statusString; + if (node.ReadAttrString(B_MAIL_ATTR_STATUS, &statusString) == B_OK) { + if (statusString.ICompare("New")) + flag = B_UNREAD; + else + flag = B_READ; + + return B_OK; + } + + return B_ERROR; +} + + +// The next couple of functions are our wrapper around convert_to_utf8 and +// convert_from_utf8 so that they can also convert from UTF-8 to UTF-8 by +// specifying the B_MAIL_UTF8_CONVERSION constant as the conversion operation. +// It also lets us add new conversions, like B_MAIL_US_ASCII_CONVERSION. + + +status_t +mail_convert_to_utf8(uint32 srcEncoding, const char *src, int32 *srcLen, + char *dst, int32 *dstLen, int32 *state, char substitute) +{ + int32 copyAmount; + char *originalDst = dst; + status_t returnCode = -1; + + if (srcEncoding == B_MAIL_UTF8_CONVERSION) { + copyAmount = *srcLen; + if (*dstLen < copyAmount) + copyAmount = *dstLen; + memcpy (dst, src, copyAmount); + *srcLen = copyAmount; + *dstLen = copyAmount; + returnCode = B_OK; + } else if (srcEncoding == B_MAIL_US_ASCII_CONVERSION) { + int32 i; + unsigned char letter; + copyAmount = *srcLen; + if (*dstLen < copyAmount) + copyAmount = *dstLen; + for (i = 0; i < copyAmount; i++) { + letter = *src++; + if (letter > 0x80U) + // Invalid, could also use substitute, but better to strip high bit. + *dst++ = letter - 0x80U; + else if (letter == 0x80U) + // Can't convert to 0x00 since that's NUL, which would cause problems. + *dst++ = substitute; + else + *dst++ = letter; + } + *srcLen = copyAmount; + *dstLen = copyAmount; + returnCode = B_OK; + } else + returnCode = convert_to_utf8 (srcEncoding, src, srcLen, + dst, dstLen, state, substitute); + + if (returnCode == B_OK) { + // Replace spurious NUL bytes, which should normally not be in the + // output of the decoding (not normal UTF-8 characters, and no NULs are + // in our usual input strings). They happen for some odd ISO-2022-JP + // byte pair combinations which are improperly handled by the BeOS + // routines. Like "\e$ByD\e(B" where \e is the ESC character $1B, the + // first ESC $ B switches to a Japanese character set, then the next + // two bytes "yD" specify a character, then ESC ( B switches back to + // the ASCII character set. The UTF-8 conversion yields a NUL byte. + int32 i; + for (i = 0; i < *dstLen; i++) + if (originalDst[i] == 0) + originalDst[i] = substitute; + } + return returnCode; +} + + +status_t +mail_convert_from_utf8(uint32 dstEncoding, const char *src, int32 *srcLen, + char *dst, int32 *dstLen, int32 *state, char substitute) +{ + int32 copyAmount; + status_t errorCode; + int32 originalDstLen = *dstLen; + int32 tempDstLen; + int32 tempSrcLen; + + if (dstEncoding == B_MAIL_UTF8_CONVERSION) { + copyAmount = *srcLen; + if (*dstLen < copyAmount) + copyAmount = *dstLen; + memcpy (dst, src, copyAmount); + *srcLen = copyAmount; + *dstLen = copyAmount; + return B_OK; + } + + if (dstEncoding == B_MAIL_US_ASCII_CONVERSION) { + int32 characterLength; + int32 dstRemaining = *dstLen; + unsigned char letter; + int32 srcRemaining = *srcLen; + + // state contains the number of source bytes to skip, left over from a + // partial UTF-8 character split over the end of the buffer from last + // time. + if (srcRemaining <= *state) { + *state -= srcRemaining; + *dstLen = 0; + return B_OK; + } + srcRemaining -= *state; + src += *state; + *state = 0; + + while (true) { + if (srcRemaining <= 0 || dstRemaining <= 0) + break; + letter = *src; + if (letter < 0x80) + characterLength = 1; // Regular ASCII equivalent code. + else if (letter < 0xC0) + characterLength = 1; // Invalid in-between data byte 10xxxxxx. + else if (letter < 0xE0) + characterLength = 2; + else if (letter < 0xF0) + characterLength = 3; + else if (letter < 0xF8) + characterLength = 4; + else if (letter < 0xFC) + characterLength = 5; + else if (letter < 0xFE) + characterLength = 6; + else + characterLength = 1; // 0xFE and 0xFF are invalid in UTF-8. + if (letter < 0x80) + *dst++ = *src; + else + *dst++ = substitute; + dstRemaining--; + if (srcRemaining < characterLength) { + // Character split past the end of the buffer. + *state = characterLength - srcRemaining; + srcRemaining = 0; + } else { + src += characterLength; + srcRemaining -= characterLength; + } + } + // Update with the amounts used. + *srcLen = *srcLen - srcRemaining; + *dstLen = *dstLen - dstRemaining; + return B_OK; + } + + errorCode = convert_from_utf8(dstEncoding, src, srcLen, dst, dstLen, state, + substitute); + if (errorCode != B_OK) + return errorCode; + + if (dstEncoding != B_JIS_CONVERSION) + return B_OK; + + // B_JIS_CONVERSION (ISO-2022-JP) works by shifting between different + // character subsets. For E-mail headers (and other uses), it needs to be + // switched back to ASCII at the end (otherwise the last character gets + // lost or other weird things happen in the headers). Note that we can't + // just append the escape code since the convert_from_utf8 "state" will be + // wrong. So we append an ASCII letter and throw it away, leaving just the + // escape code. Well, it actually switches to the Roman character set, not + // ASCII, but that should be OK. + + tempDstLen = originalDstLen - *dstLen; + if (tempDstLen < 3) // Not enough space remaining in the output. + return B_OK; // Sort of an error, but we did convert the rest OK. + tempSrcLen = 1; + errorCode = convert_from_utf8(dstEncoding, "a", &tempSrcLen, + dst + *dstLen, &tempDstLen, state, substitute); + if (errorCode != B_OK) + return errorCode; + *dstLen += tempDstLen - 1 /* don't include the ASCII letter */; + return B_OK; +} + + +ssize_t +rfc2047_to_utf8(char **bufp, size_t *bufLen, size_t strLen) { char *head, *tail; char *charset, *encoding, *end; @@ -384,7 +382,7 @@ _EXPORT ssize_t rfc2047_to_utf8(char **bufp, size_t *bufLen, size_t strLen) return -1; char *string = *bufp; - + //---------Handle *&&^%*&^ non-RFC compliant, 8bit mail if (handle_non_rfc2047_encoding(bufp,bufLen,&strLen)) return strLen; @@ -434,25 +432,25 @@ _EXPORT ssize_t rfc2047_to_utf8(char **bufp, size_t *bufLen, size_t strLen) end += 2; // find the charset this text is in now - size_t cLen = encoding - 1 - charset; - bool base64encoded = toupper(*encoding) == 'B'; + size_t cLen = encoding - 1 - charset; + bool base64encoded = toupper(*encoding) == 'B'; - uint32 convert_id = B_MAIL_NULL_CONVERSION; - char charset_string[cLen+1]; - memcpy(charset_string, charset, cLen); - charset_string[cLen] = '\0'; - if (strcasecmp(charset_string, "us-ascii") == 0) { - convert_id = B_MAIL_US_ASCII_CONVERSION; - } else if (strcasecmp(charset_string, "utf-8") == 0) { - convert_id = B_MAIL_UTF8_CONVERSION; + uint32 convertID = B_MAIL_NULL_CONVERSION; + char charsetName[cLen + 1]; + memcpy(charsetName, charset, cLen); + charsetName[cLen] = '\0'; + if (strcasecmp(charsetName, "us-ascii") == 0) { + convertID = B_MAIL_US_ASCII_CONVERSION; + } else if (strcasecmp(charsetName, "utf-8") == 0) { + convertID = B_MAIL_UTF8_CONVERSION; } else { - const BCharacterSet * cs = BCharacterSetRoster::FindCharacterSetByName(charset_string); - if (cs != NULL) { - convert_id = cs->GetConversionID(); + const BCharacterSet* charSet + = BCharacterSetRoster::FindCharacterSetByName(charsetName); + if (charSet != NULL) { + convertID = charSet->GetConversionID(); } } - if (convert_id == B_MAIL_NULL_CONVERSION) - { + if (convertID == B_MAIL_NULL_CONVERSION) { // unidentified charset // what to do? doing nothing skips the encoded text; // but we should keep it: we copy it to the output. @@ -469,7 +467,7 @@ _EXPORT ssize_t rfc2047_to_utf8(char **bufp, size_t *bufLen, size_t strLen) // decode text, get decoded length (reducing xforms) srcLen = !base64encoded ? decode_qp(src, src, srcLen, 1) - : decode_base64(src, src, srcLen); + : decode_base64(src, src, srcLen); // allocate space for the converted text int32 dstLen = end-string + *bufLen-strLen; @@ -480,9 +478,9 @@ _EXPORT ssize_t rfc2047_to_utf8(char **bufp, size_t *bufLen, size_t strLen) // // do the conversion // - ret = mail_convert_to_utf8(convert_id, src, &cvLen, dst, &dstLen, &convState); - if (ret != B_OK) - { + ret = mail_convert_to_utf8(convertID, src, &cvLen, dst, &dstLen, + &convState); + if (ret != B_OK) { // what to do? doing nothing skips the encoded text // but we should keep it: we copy it to the output. @@ -524,10 +522,8 @@ _EXPORT ssize_t rfc2047_to_utf8(char **bufp, size_t *bufLen, size_t strLen) continue; } */ - else - { - if (dstLen > end-string) - { + else { + if (dstLen > end-string) { // copy the string forward... memmove(string+dstLen, end, strLen - (end-head) + 1); strLen += string+dstLen - end; @@ -553,7 +549,9 @@ _EXPORT ssize_t rfc2047_to_utf8(char **bufp, size_t *bufLen, size_t strLen) } -_EXPORT ssize_t utf8_to_rfc2047 (char **bufp, ssize_t length, uint32 charset, char encoding) { +ssize_t +utf8_to_rfc2047 (char **bufp, ssize_t length, uint32 charset, char encoding) +{ struct word { BString originalWord; BString convertedWord; @@ -748,16 +746,15 @@ _EXPORT ssize_t utf8_to_rfc2047 (char **bufp, ssize_t length, uint32 charset, ch } -//==================================================================== - -void FoldLineAtWhiteSpaceAndAddCRLF (BString &string) +void +FoldLineAtWhiteSpaceAndAddCRLF(BString &string) { - int inputLength = string.Length(); - int lineStartIndex; - const int maxLineLength = 78; // Doesn't include CRLF. - BString output; - int splitIndex; - int tempIndex; + int inputLength = string.Length(); + int lineStartIndex; + const int maxLineLength = 78; // Doesn't include CRLF. + BString output; + int splitIndex; + int tempIndex; lineStartIndex = 0; while (true) { @@ -827,21 +824,18 @@ void FoldLineAtWhiteSpaceAndAddCRLF (BString &string) } -//==================================================================== - -_EXPORT ssize_t readfoldedline(FILE *file, char **buffer, size_t *buflen) +ssize_t +readfoldedline(FILE *file, char **buffer, size_t *buflen) { ssize_t len = buflen && *buflen ? *buflen : 0; char * buf = buffer && *buffer ? *buffer : NULL; ssize_t cnt = 0; // Number of characters currently in the buffer. int c; - while (true) - { + while (true) { // Make sure there is space in the buffer for two more characters (one // for the next character, and one for the end of string NUL byte). - if (buf == NULL || cnt + 2 >= len) - { + if (buf == NULL || cnt + 2 >= len) { char *temp = (char *)realloc(buf, len + 64); if (temp == NULL) { // Out of memory, however existing buffer remains allocated. @@ -898,7 +892,6 @@ _EXPORT ssize_t readfoldedline(FILE *file, char **buffer, size_t *buflen) } } - if (buf != NULL && cnt >= 0) buf[cnt] = '\0'; @@ -914,9 +907,8 @@ _EXPORT ssize_t readfoldedline(FILE *file, char **buffer, size_t *buflen) } -//==================================================================== - -_EXPORT ssize_t readfoldedline(BPositionIO &in, char **buffer, size_t *buflen) +ssize_t +readfoldedline(BPositionIO &in, char **buffer, size_t *buflen) { ssize_t len = buflen && *buflen ? *buflen : 0; char * buf = buffer && *buffer ? *buffer : NULL; @@ -924,12 +916,10 @@ _EXPORT ssize_t readfoldedline(BPositionIO &in, char **buffer, size_t *buflen) char c; status_t errorCode; - while (true) - { + while (true) { // Make sure there is space in the buffer for two more characters (one // for the next character, and one for the end of string NUL byte). - if (buf == NULL || cnt + 2 >= len) - { + if (buf == NULL || cnt + 2 >= len) { char *temp = (char *)realloc(buf, len + 64); if (temp == NULL) { // Out of memory, however existing buffer remains allocated. @@ -1005,7 +995,7 @@ _EXPORT ssize_t readfoldedline(BPositionIO &in, char **buffer, size_t *buflen) } -_EXPORT ssize_t +ssize_t nextfoldedline(const char** header, char **buffer, size_t *buflen) { ssize_t len = buflen && *buflen ? *buflen : 0; @@ -1085,7 +1075,7 @@ nextfoldedline(const char** header, char **buffer, size_t *buflen) } -_EXPORT void +void trim_white_space(BString &string) { int32 i; @@ -1105,12 +1095,11 @@ trim_white_space(BString &string) } -/** Tries to return a human-readable name from the specified - * header parameter (should be from "To:" or "From:"). - * Tries to return the name rather than the eMail address. - */ - -_EXPORT void +/*! Tries to return a human-readable name from the specified + header parameter (should be from "To:" or "From:"). + Tries to return the name rather than the eMail address. +*/ +void extract_address_name(BString &header) { BString name; @@ -1198,19 +1187,13 @@ extract_address_name(BString &header) } - -// Given a subject in a BString, remove the extraneous RE: re: and other stuff -// to get down to the core subject string, which should be identical for all -// messages posted about a topic. The input string is modified in place to -// become the output core subject string. - -static int32 gLocker = 0; -static size_t gNsub = 1; -static re_pattern_buffer gRe; -static re_pattern_buffer *gRebuf = NULL; -static unsigned char gTranslation[256]; - -_EXPORT void SubjectToThread (BString &string) +/*! Given a subject in a BString, remove the extraneous RE: re: and other stuff + to get down to the core subject string, which should be identical for all + messages posted about a topic. The input string is modified in place to + become the output core subject string. +*/ +void +SubjectToThread (BString &string) { // a regex that matches a non-ASCII UTF8 character: #define U8C \ @@ -1230,8 +1213,7 @@ _EXPORT void SubjectToThread (BString &string) "|^( +| *(\\<(\\w|" U8C "){2,3} *(\\[[^\\]]*\\])? *:)+ *)" \ "| *\\(fwd\\) *$" - if (gRebuf == NULL && atomic_add(&gLocker,1) == 0) - { + if (gRebuf == NULL && atomic_add(&gLocker, 1) == 0) { // the idea is to compile the regexp once to speed up testing for (int i=0; i<256; ++i) gTranslation[i]=i; @@ -1256,16 +1238,13 @@ _EXPORT void SubjectToThread (BString &string) gRebuf = &gRe; else fprintf(stderr, "Failed to compile the regex: %s\n", err); - } - else - { + } else { int32 tries = 200; while (gRebuf == NULL && tries-- > 0) snooze(10000); } - if (gRebuf) - { + if (gRebuf) { struct re_registers regs; // can't be static if this function is to be thread-safe @@ -1273,11 +1252,8 @@ _EXPORT void SubjectToThread (BString &string) regs.start = (regoff_t*)malloc(gNsub*sizeof(regoff_t)); regs.end = (regoff_t*)malloc(gNsub*sizeof(regoff_t)); - for (int start=0; - (start=re_search(gRebuf, string.String(), string.Length(), - 0, string.Length(), ®s)) >= 0; - ) - { + for (int start = 0; (start = re_search(gRebuf, string.String(), + string.Length(), 0, string.Length(), ®s)) >= 0;) { // // we found something // @@ -1287,7 +1263,8 @@ _EXPORT void SubjectToThread (BString &string) start = regs.start[2]; string.Remove(start,regs.end[0]-start); - if (start) string.Insert(' ',1,start); + if (start) + string.Insert(' ',1,start); // TODO: for some subjects this results in an endless loop, check // why this happen. @@ -1306,19 +1283,19 @@ _EXPORT void SubjectToThread (BString &string) } - -// Converts a date to a time. Handles numeric time zones too, unlike -// parsedate. Returns -1 if it fails. - -_EXPORT time_t ParseDateWithTimeZone (const char *DateString) +/*! Converts a date to a time. Handles numeric time zones too, unlike + parsedate(). Returns -1 if it fails. +*/ +time_t +ParseDateWithTimeZone(const char *DateString) { - time_t currentTime; - time_t dateAsTime; - char tempDateString [80]; - char tempZoneString [6]; - time_t zoneDeltaTime; - int zoneIndex; - char *zonePntr; + time_t currentTime; + time_t dateAsTime; + char tempDateString[80]; + char tempZoneString[6]; + time_t zoneDeltaTime; + int zoneIndex; + char *zonePntr; // See if we can remove the time zone portion. parsedate understands time // zone 3 letter names, but doesn't understand the numeric +9999 time zone @@ -1349,7 +1326,7 @@ _EXPORT time_t ParseDateWithTimeZone (const char *DateString) return -1; // Empty string. } } - + // Look for a numeric time zone like Tue, 30 Dec 2003 05:01:40 +0000 for (zoneIndex = strlen (tempDateString); zoneIndex >= 0; zoneIndex--) { @@ -1390,10 +1367,9 @@ _EXPORT time_t ParseDateWithTimeZone (const char *DateString) } -/** Parses a mail header and fills the headers BMessage - */ - -_EXPORT status_t +/*! Parses a mail header and fills the headers BMessage +*/ +status_t parse_header(BMessage &headers, BPositionIO &input) { char *buffer = NULL; @@ -1417,10 +1393,12 @@ parse_header(BMessage &headers, BPositionIO &input) // unified case for later fetch delimiter++; // Skip the colon. - while (isspace (*delimiter)) - delimiter++; // Skip over leading white space and tabs. To do: (comments in brackets). + // Skip over leading white space and tabs. + // TODO: (comments in brackets). + while (isspace(*delimiter)) + delimiter++; - // ToDo: implement joining of multiple header tags (i.e. multiple "Cc:"s) + // TODO: implement joining of multiple header tags (i.e. multiple "Cc:"s) headers.AddString(header.String(), delimiter); } free(buffer); @@ -1429,7 +1407,7 @@ parse_header(BMessage &headers, BPositionIO &input) } -_EXPORT status_t +status_t extract_from_header(const BString& header, const BString& field, BString& target) { @@ -1440,7 +1418,7 @@ extract_from_header(const BString& header, const BString& field, if (pos < 0) return B_BAD_VALUE; fieldEndPos = pos + field.Length(); - + if (pos != 0 && header.ByteAt(pos - 1) != '\n') continue; if (header.ByteAt(fieldEndPos) == ':') @@ -1486,7 +1464,7 @@ extract_address(BString &address) int32 first; // first, remove all quoted text - + if ((first = address.FindFirst('"')) >= 0) { int32 last = first + 1; while (string[last] && string[last] != '"') From ba91e5bbcd099f05939c6629f9e6f47d36f7949c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 8 Oct 2011 19:03:57 +0000 Subject: [PATCH 349/702] * Trim white space from the field names - this removes for example an extra space in front of *every* attribute. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42809 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/mail/mail_util.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kits/mail/mail_util.cpp b/src/kits/mail/mail_util.cpp index 751690aa0a..8d8c86e0a2 100644 --- a/src/kits/mail/mail_util.cpp +++ b/src/kits/mail/mail_util.cpp @@ -1453,11 +1453,13 @@ extract_from_header(const BString& header, const BString& field, size_t length = rfc2047_to_utf8(&buffer, &bufferSize, bufferSize); target.UnlockBuffer(length); + trim_white_space(target); + return B_OK; } -_EXPORT void +void extract_address(BString &address) { const char *string = address.String(); @@ -1504,8 +1506,9 @@ extract_address(BString &address) } -_EXPORT void -get_address_list(BList &list, const char *string, void (*cleanupFunc)(BString &)) +void +get_address_list(BList &list, const char *string, + void (*cleanupFunc)(BString &)) { if (string == NULL || !string[0]) return; From 49774900fb8798096e009cf9948e03c5472cfcbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 8 Oct 2011 19:25:10 +0000 Subject: [PATCH 350/702] * Now sanitizes the white space in the header fields before adding them to the message (ie. multiple spaces are compressed to a single one, tabs and other white space is replaced with a space). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42810 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/mail/HaikuMailFormatFilter.cpp | 32 ++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/kits/mail/HaikuMailFormatFilter.cpp b/src/kits/mail/HaikuMailFormatFilter.cpp index 7b711effe4..b65f861c22 100644 --- a/src/kits/mail/HaikuMailFormatFilter.cpp +++ b/src/kits/mail/HaikuMailFormatFilter.cpp @@ -8,8 +8,9 @@ #include "HaikuMailFormatFilter.h" -#include +#include +#include #include #include @@ -47,6 +48,34 @@ static const mail_header_field gDefaultFields[] = { }; +//! Replaces tabs and other white space with spaces, compresses spaces. +void +sanitize_white_space(BString& string) +{ + char* buffer = string.LockBuffer(string.Length() + 1); + if (buffer == NULL) + return; + + int32 count = string.Length(); + int32 spaces = 0; + for (int32 i = 0; buffer[i] != '\0'; i++, count--) { + if (isspace(buffer[i])) { + buffer[i] = ' '; + spaces++; + } else { + if (spaces > 1) + memmove(buffer + i + 1 - spaces, buffer + i, count + 1); + spaces = 0; + } + } + + string.UnlockBuffer(); +} + + +// #pragma mark - + + HaikuMailFormatFilter::HaikuMailFormatFilter(MailProtocol& protocol, BMailAccountSettings* settings) : @@ -86,6 +115,7 @@ HaikuMailFormatFilter::HeaderFetched(const entry_ref& ref, BFile* file) switch (gDefaultFields[i].attr_type){ case B_STRING_TYPE: + sanitize_white_space(target); attributes.AddString(gDefaultFields[i].attr_name, target); break; From 13cb2a2930823027e97751cb6cfca1da569bb137 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sun, 9 Oct 2011 15:12:05 +0000 Subject: [PATCH 351/702] Code cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42811 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/device/USBEndpoint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/device/USBEndpoint.cpp b/src/kits/device/USBEndpoint.cpp index c5120ba243..fd0d629f67 100644 --- a/src/kits/device/USBEndpoint.cpp +++ b/src/kits/device/USBEndpoint.cpp @@ -24,7 +24,7 @@ BUSBEndpoint::BUSBEndpoint(BUSBInterface *interface, uint32 index, int rawFD) command.endpoint_etc.alternate_index = fInterface->AlternateIndex(); command.endpoint_etc.endpoint_index = fIndex; if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR_ETC, &command, - sizeof(command)) || command.config.status != B_USB_RAW_STATUS_SUCCESS) + sizeof(command)) || command.endpoint_etc.status != B_USB_RAW_STATUS_SUCCESS) memset(&fDescriptor, 0, sizeof(fDescriptor)); } From d41559757e228cf311731050388e2534c660a55a Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sun, 9 Oct 2011 15:15:15 +0000 Subject: [PATCH 352/702] Expand usb_raw ioctl to support retrieving full usb configuration descriptor from userland, not only the header part. I try to keep UBSConfiguration binary compatibility, but proofreading is welcome. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42812 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/device/USBKit.h | 3 +- .../kernel/drivers/bus/usb/usb_raw.cpp | 23 ++++++++--- src/add-ons/kernel/drivers/bus/usb/usb_raw.h | 10 ++++- src/kits/device/USBConfiguration.cpp | 39 ++++++++++++++++--- 4 files changed, 62 insertions(+), 13 deletions(-) diff --git a/headers/os/device/USBKit.h b/headers/os/device/USBKit.h index f415bc00e1..9758942f12 100644 --- a/headers/os/device/USBKit.h +++ b/headers/os/device/USBKit.h @@ -204,7 +204,8 @@ friend class BUSBDevice; mutable char * fConfigurationString; - uint32 fReserved[10]; + usb_configuration_descriptor* fFullDescriptor; + uint32 fReserved[9]; }; diff --git a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp index d430080f19..fae00ac8d5 100644 --- a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp +++ b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp @@ -300,23 +300,36 @@ usb_raw_ioctl(void *cookie, uint32 op, void *buffer, size_t length) } case B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR: + case B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC: { if (length < sizeof(command->config)) return B_BUFFER_OVERFLOW; + size_t descriptorLength = sizeof(usb_configuration_descriptor); + if (op == B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC) { + if (length < sizeof(command->config_etc)) + return B_BUFFER_OVERFLOW; + + descriptorLength = command->config_etc.length; + } + const usb_configuration_info *configurationInfo = usb_raw_get_configuration(device, command->config.config_index, &command->config.status); if (configurationInfo == NULL) return B_OK; - if (user_memcpy(command->config.descriptor, - configurationInfo->descr, - sizeof(usb_configuration_descriptor)) != B_OK) { + const usb_configuration_descriptor* descriptor + = configurationInfo->descr; + if (user_memcpy(command->config.descriptor, descriptor, + min_c(descriptorLength, descriptor->total_length)) != B_OK) { return B_BAD_ADDRESS; } - - command->config.status = B_USB_RAW_STATUS_SUCCESS; + if (op == B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC + && descriptor->total_length > descriptorLength) + command->config.status = B_USB_RAW_STATUS_NO_MEMORY; + else + command->config.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } diff --git a/src/add-ons/kernel/drivers/bus/usb/usb_raw.h b/src/add-ons/kernel/drivers/bus/usb/usb_raw.h index 54112c2202..fc41654029 100644 --- a/src/add-ons/kernel/drivers/bus/usb/usb_raw.h +++ b/src/add-ons/kernel/drivers/bus/usb/usb_raw.h @@ -22,10 +22,11 @@ typedef enum { B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR, B_USB_RAW_COMMAND_GET_ALT_INTERFACE_COUNT, B_USB_RAW_COMMAND_GET_ACTIVE_ALT_INTERFACE_INDEX, + B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC, B_USB_RAW_COMMAND_GET_INTERFACE_DESCRIPTOR_ETC, B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR_ETC, B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR_ETC, - + B_USB_RAW_COMMAND_SET_CONFIGURATION = 0x3000, B_USB_RAW_COMMAND_SET_FEATURE, B_USB_RAW_COMMAND_CLEAR_FEATURE, @@ -74,6 +75,13 @@ typedef union { uint32 config_index; } config; + struct { + status_t status; + usb_configuration_descriptor *descriptor; + uint32 config_index; + size_t length; + } config_etc; + struct { status_t status; uint32 alternate_info; diff --git a/src/kits/device/USBConfiguration.cpp b/src/kits/device/USBConfiguration.cpp index cf158a06e2..1751cd2573 100644 --- a/src/kits/device/USBConfiguration.cpp +++ b/src/kits/device/USBConfiguration.cpp @@ -8,9 +8,12 @@ #include #include -#include -#include + #include +#include +#include +#include + BUSBConfiguration::BUSBConfiguration(BUSBDevice *device, uint32 index, int rawFD) @@ -18,14 +21,36 @@ BUSBConfiguration::BUSBConfiguration(BUSBDevice *device, uint32 index, int rawFD fIndex(index), fRawFD(rawFD), fInterfaces(NULL), - fConfigurationString(NULL) + fConfigurationString(NULL), + fFullDescriptor(NULL) { usb_raw_command command; command.config.descriptor = &fDescriptor; command.config.config_index = fIndex; - if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR, &command, - sizeof(command)) || command.config.status != B_USB_RAW_STATUS_SUCCESS) + + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR, + &command, sizeof(command)) + || command.config.status != B_USB_RAW_STATUS_SUCCESS) { memset(&fDescriptor, 0, sizeof(fDescriptor)); + } else { + // Got the descriptor header, retrieve the whole descriptor + size_t length = fDescriptor.total_length; + fFullDescriptor = (usb_configuration_descriptor*)malloc(length); + + if (fFullDescriptor != NULL) { + command.config_etc.descriptor = fFullDescriptor; + command.config_etc.config_index = fIndex; + command.config_etc.length = length; + + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC, + &command, sizeof(command)) + || command.config_etc.status != B_USB_RAW_STATUS_SUCCESS) { + + free(fFullDescriptor); + fFullDescriptor = NULL; + } + } + } fInterfaces = new(std::nothrow) BUSBInterface *[ fDescriptor.number_interfaces]; @@ -41,6 +66,8 @@ BUSBConfiguration::BUSBConfiguration(BUSBDevice *device, uint32 index, int rawFD BUSBConfiguration::~BUSBConfiguration() { + free(fFullDescriptor); + delete[] fConfigurationString; if (fInterfaces != NULL) { for (int32 i = 0; i < fDescriptor.number_interfaces; i++) @@ -85,7 +112,7 @@ BUSBConfiguration::ConfigurationString() const const usb_configuration_descriptor * BUSBConfiguration::Descriptor() const { - return &fDescriptor; + return (fFullDescriptor != NULL) ? fFullDescriptor : &fDescriptor; } From f6e59c500a1f5d94214bafd23df8521f97ffdc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 9 Oct 2011 18:35:39 +0000 Subject: [PATCH 353/702] * Minor work in progress of getting the test to run again. Never found the time to complete it, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42813 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/bfs/btree/Inode.h | 7 +++---- .../kernel/file_systems/bfs/btree/Jamfile | 11 ++++++----- .../kernel/file_systems/bfs/btree/Journal.h | 16 ++++++++++++++++ .../kernel/file_systems/bfs/btree/Volume.h | 3 +-- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/tests/add-ons/kernel/file_systems/bfs/btree/Inode.h b/src/tests/add-ons/kernel/file_systems/bfs/btree/Inode.h index e8f39d2165..4b1f5b7f86 100644 --- a/src/tests/add-ons/kernel/file_systems/bfs/btree/Inode.h +++ b/src/tests/add-ons/kernel/file_systems/bfs/btree/Inode.h @@ -10,7 +10,6 @@ #include #include -#include "Lock.h" #include "bfs.h" @@ -23,7 +22,7 @@ class Inode { Inode(const char *name,int32 mode = S_STR_INDEX | S_ALLOW_DUPS); ~Inode(); - ReadWriteLock &Lock() { return fLock; } + rw_lock &Lock() { return fLock; } status_t FindBlockRun(off_t pos,block_run &run,off_t &offset); status_t Append(Transaction *,off_t bytes); @@ -48,9 +47,9 @@ class Inode { Volume *fVolume; BFile fFile; off_t fSize; - ReadWriteLock fLock; + rw_lock fLock; int32 fMode; - + // for dump_inode() only: off_t fOldSize; off_t fOldLastModified; diff --git a/src/tests/add-ons/kernel/file_systems/bfs/btree/Jamfile b/src/tests/add-ons/kernel/file_systems/bfs/btree/Jamfile index e3115f84b6..5f389f9bff 100644 --- a/src/tests/add-ons/kernel/file_systems/bfs/btree/Jamfile +++ b/src/tests/add-ons/kernel/file_systems/bfs/btree/Jamfile @@ -1,19 +1,20 @@ SubDir HAIKU_TOP src tests add-ons kernel file_systems bfs btree ; -SubDirHdrs $(HAIKU_TOP) src tests add-ons kernel file_systems bfs r5 ; +SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_systems bfs ; -UsePrivateHeaders [ FDirName kernel ] ; # For kernel_cpp.cpp +UsePrivateKernelHeaders ; +UsePrivateHeaders shared ; rule FPreIncludes { return -include\ $(1:D=$(SUBDIR)) ; } { local defines = [ FDefines USER DEBUG ] ; # _NO_INLINE_ASM local preIncludes = [ FPreIncludes Journal.h Inode.h ] ; - SubDirC++Flags $(defines) $(preIncludes) -fno-exceptions -fno-rtti ; #-fcheck-memory-usage + SubDirC++Flags $(defines) $(preIncludes) -fno-exceptions ; #-fcheck-memory-usage } SimpleTest btreeTest - : test.cpp + : #test.cpp Volume.cpp Inode.cpp cache.cpp @@ -24,4 +25,4 @@ SimpleTest btreeTest # Tell Jam where to find these sources SEARCH on [ FGristFiles BPlusTree.cpp Utility.cpp Debug.cpp ] - = [ FDirName $(HAIKU_TOP) src tests add-ons kernel file_systems bfs r5 ] ; + = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems bfs ] ; diff --git a/src/tests/add-ons/kernel/file_systems/bfs/btree/Journal.h b/src/tests/add-ons/kernel/file_systems/bfs/btree/Journal.h index db19c82ec1..375373e142 100644 --- a/src/tests/add-ons/kernel/file_systems/bfs/btree/Journal.h +++ b/src/tests/add-ons/kernel/file_systems/bfs/btree/Journal.h @@ -11,9 +11,24 @@ #include "Volume.h" #include "Debug.h" +#include "Utility.h" + #include "cache.h" +class TransactionListener + : public DoublyLinkedListLinkImpl { +public: + TransactionListener(); + virtual ~TransactionListener(); + + virtual void TransactionDone(bool success) = 0; + virtual void RemovedFromTransaction() = 0; +}; + +typedef DoublyLinkedList TransactionListeners; + + class Transaction { public: Transaction(Volume *volume,off_t refBlock) @@ -39,4 +54,5 @@ class Transaction { Volume *fVolume; }; + #endif /* JOURNAL_H */ diff --git a/src/tests/add-ons/kernel/file_systems/bfs/btree/Volume.h b/src/tests/add-ons/kernel/file_systems/bfs/btree/Volume.h index 74aa5f32e5..82afc0bad7 100644 --- a/src/tests/add-ons/kernel/file_systems/bfs/btree/Volume.h +++ b/src/tests/add-ons/kernel/file_systems/bfs/btree/Volume.h @@ -9,7 +9,6 @@ #include -#include "Lock.h" #include "bfs.h" @@ -27,7 +26,7 @@ class Volume { block_run ToBlockRun(off_t block) const { return block_run::Run(0,0,block); } static void Panic(); - + private: BFile *fFile; }; From 17b66d82509ea6b07516b08115cc5765b8a7cb90 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 9 Oct 2011 19:10:56 +0000 Subject: [PATCH 354/702] * add digital encoder setup code * make encoder setup functions return status_t * really need a struct to hold encoder info git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42814 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 4 +- src/add-ons/accelerants/radeon_hd/encoder.cpp | 130 +++++++++++++++++- src/add-ons/accelerants/radeon_hd/encoder.h | 3 +- src/add-ons/accelerants/radeon_hd/hooks.cpp | 2 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 9 +- 5 files changed, 134 insertions(+), 14 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index aa6deb1480..61294c2fbd 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -477,7 +477,6 @@ detect_connectors() encoder_type = VIDEO_ENCODER_TMDS; // radeon_atombios_set_dig_info } - // drm_encoder_helper_add break; case ENCODER_OBJECT_ID_INTERNAL_DAC1: encoder_type = VIDEO_ENCODER_DAC; @@ -486,7 +485,6 @@ detect_connectors() case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: encoder_type = VIDEO_ENCODER_TVDAC; - // drm_encoder_helper_add break; case ENCODER_OBJECT_ID_INTERNAL_DVO1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: @@ -769,7 +767,7 @@ display_crtc_lock(uint8 crtc_id, int command) args.ucCRTC = crtc_id; args.ucEnable = command; - atom_execute_table(gAtomContext, index, (uint32 *)&args); + atom_execute_table(gAtomContext, index, (uint32*)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index de27f76cb5..6c91f2471b 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -188,7 +188,7 @@ encoder_mode_set(uint8 id, uint32 pixelClock) case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - TRACE("%s: TODO for digital encoder setup\n", __func__); + encoder_digital_setup(id, pixelClock, ATOM_ENABLE); break; case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: @@ -208,7 +208,131 @@ encoder_mode_set(uint8 id, uint32 pixelClock) } -void +union lvds_encoder_control { + LVDS_ENCODER_CONTROL_PS_ALLOCATION v1; + LVDS_ENCODER_CONTROL_PS_ALLOCATION_V2 v2; +}; + + +status_t +encoder_digital_setup(uint8 id, uint32 pixelClock, int command) +{ + TRACE("%s\n", __func__); + + uint32 connector_index = gDisplay[id]->connector_index; + + union lvds_encoder_control args; + memset(&args, 0, sizeof(args)); + + int index = 0; + uint16 connector_flags = gConnector[connector_index]->connector_flags; + + switch (gConnector[connector_index]->encoder_object_id) { + case ENCODER_OBJECT_ID_INTERNAL_LVDS: + index = GetIndexIntoMasterTable(COMMAND, LVDSEncoderControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_TMDS1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: + index = GetIndexIntoMasterTable(COMMAND, TMDS1EncoderControl); + break; + case ENCODER_OBJECT_ID_INTERNAL_LVTM1: + if (connector_flags & ATOM_DEVICE_LCD_SUPPORT) + index = GetIndexIntoMasterTable(COMMAND, LVDSEncoderControl); + else + index = GetIndexIntoMasterTable(COMMAND, TMDS2EncoderControl); + break; + } + + uint8 frev; + uint8 crev; + if (atom_parse_cmd_header(gAtomContext, index, &frev, &crev) != B_OK) + return B_ERROR; + + switch (frev) { + case 1: + case 2: + switch (crev) { + case 1: + args.v1.ucMisc = 0; + args.v1.ucAction = command; + if (0) // TODO : HDMI? + args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; + args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + + if (connector_flags & (ATOM_DEVICE_LCD_SUPPORT)) { + // TODO : laptop display support + //if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) + // args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; + //if (dig->lcd_misc & ATOM_PANEL_MISC_888RGB) + // args.v1.ucMisc |= ATOM_PANEL_MISC_888RGB; + } else { + //if (dig->linkb) + // args.v1.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB; + if (pixelClock > 165000) + args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; + /*if (pScrn->rgbBits == 8) */ + args.v1.ucMisc |= ATOM_PANEL_MISC_888RGB; + } + break; + case 2: + case 3: + args.v2.ucMisc = 0; + args.v2.ucAction = command; + if (crev == 3) { + //if (dig->coherent_mode) + // args.v2.ucMisc |= PANEL_ENCODER_MISC_COHERENT; + } + if (0) // TODO : HDMI? + args.v2.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; + args.v2.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v2.ucTruncate = 0; + args.v2.ucSpatial = 0; + args.v2.ucTemporal = 0; + args.v2.ucFRC = 0; + if (connector_flags & ATOM_DEVICE_LCD_SUPPORT) { + // TODO : laptop display support + //if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) + // args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; + //if (dig->lcd_misc & ATOM_PANEL_MISC_SPATIAL) { + args.v2.ucSpatial = PANEL_ENCODER_SPATIAL_DITHER_EN; + //if (dig->lcd_misc & ATOM_PANEL_MISC_888RGB) + // args.v2.ucSpatial |= PANEL_ENCODER_SPATIAL_DITHER_DEPTH; + //} + //if (dig->lcd_misc & ATOM_PANEL_MISC_TEMPORAL) { + // args.v2.ucTemporal = PANEL_ENCODER_TEMPORAL_DITHER_EN; + // if (dig->lcd_misc & ATOM_PANEL_MISC_888RGB) { + // args.v2.ucTemporal + // |= PANEL_ENCODER_TEMPORAL_DITHER_DEPTH; + // } + // if (((dig->lcd_misc >> ATOM_PANEL_MISC_GREY_LEVEL_SHIFT) + // & 0x3) == 2) { + // args.v2.ucTemporal + // |= PANEL_ENCODER_TEMPORAL_LEVEL_4; + // } + //} + } else { + //if (dig->linkb) + // args.v2.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB; + if (pixelClock > 165000) + args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; + } + break; + default: + ERROR("%s: Unknown minor table version: %d.%d\n", __func__, + frev, crev); + return B_ERROR; + } + break; + default: + ERROR("%s: Unknown major table version: %d.%d\n", __func__, + frev, crev); + return B_ERROR; + } + return atom_execute_table(gAtomContext, index, (uint32*)&args); +} + + +status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command) { TRACE("%s\n", __func__); @@ -237,7 +361,7 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) args.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); - atom_execute_table(gAtomContext, index, (uint32*)&args); + return atom_execute_table(gAtomContext, index, (uint32*)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index 19f769d0c1..0ed892b798 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -11,7 +11,8 @@ void encoder_assign_crtc(uint8 crt_id); void encoder_mode_set(uint8 id, uint32 pixelClock); -void encoder_analog_setup(uint8 id, uint32 pixelClock, int command); +status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command); +status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command); void encoder_output_lock(bool lock); void encoder_dpms_set(uint8 encoder_id, int mode); diff --git a/src/add-ons/accelerants/radeon_hd/hooks.cpp b/src/add-ons/accelerants/radeon_hd/hooks.cpp index 63d6f54494..9be18755a3 100644 --- a/src/add-ons/accelerants/radeon_hd/hooks.cpp +++ b/src/add-ons/accelerants/radeon_hd/hooks.cpp @@ -40,9 +40,9 @@ get_accelerant_hook(uint32 feature, void *data) return (void*)radeon_dpms_capabilities; case B_DPMS_MODE: return (void*)radeon_dpms_mode; + */ case B_SET_DPMS_MODE: return (void*)radeon_dpms_set; - */ /* mode configuration */ case B_ACCELERANT_MODE_COUNT: diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 8635e96087..3925a70d4f 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -137,17 +137,18 @@ radeon_set_display_mode(display_mode *mode) continue; uint16 connector_index = gDisplay[id]->connector_index; + // *** encoder prep encoder_output_lock(true); encoder_dpms_set(gConnector[connector_index]->encoder_object_id, B_DPMS_OFF); + encoder_assign_crtc(id); // *** CRT controler prep display_crtc_lock(id, ATOM_ENABLE); - // *** CRT controler mode set - // TODO program SS + // TODO : program SS pll_set(0, mode->timing.pixel_clock, id); // TODO : check if pll 0 is used and use pll 1 if so display_crtc_set_dtd(id, mode); @@ -158,16 +159,12 @@ radeon_set_display_mode(display_mode *mode) // atombios_overscan_setup display_crtc_scale(id, mode); - // *** encoder mode set encoder_mode_set(id, mode->timing.pixel_clock); - encoder_assign_crtc(id); - // *** CRT controler commit display_crtc_lock(id, ATOM_DISABLE); - // *** encoder commit encoder_dpms_set(gConnector[connector_index]->encoder_object_id, B_DPMS_ON); From d0509b7eb93e3cb67b23fa5ccdd2fb789333370b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 9 Oct 2011 19:51:59 +0000 Subject: [PATCH 355/702] * move encoder info into own struct * rename some connector / encoder struct members * improve debugging in connector / encoder AtomBIOS walking git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42815 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 21 ++++-- src/add-ons/accelerants/radeon_hd/display.cpp | 68 ++++++++++--------- src/add-ons/accelerants/radeon_hd/encoder.cpp | 10 +-- src/add-ons/accelerants/radeon_hd/gpu.cpp | 6 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 4 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 2 +- 6 files changed, 61 insertions(+), 50 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index f2dfbf600b..979bca76b8 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -164,15 +164,24 @@ typedef struct { } gpio_info; +struct encoder_info { + bool valid; + uint32 type; + uint16 object_id; + uint32 flags; + bool is_hdmi; + bool is_tv; +}; + + typedef struct { bool valid; + uint32 type; + uint16 object_id; + uint32 flags; uint16 line_mux; - uint16 connector_flags; - uint32 connector_type; - uint16 connector_object_id; - uint16 connector_gpio_id; - uint32 encoder_type; - uint16 encoder_object_id; + uint16 gpio_id; + struct encoder_info encoder; // TODO struct radeon_hpd hpd; } connector_info; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 61294c2fbd..2ebbfd0c90 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -267,11 +267,11 @@ detect_connectors_legacy() ATOM_CONNECTOR_INFO_I2C ci = supported_devices->info.asConnInfo[i]; - gConnector[i]->connector_type + gConnector[i]->type = connector_convert_legacy[ ci.sucConnectorInfo.sbfAccess.bfConnectorType]; - if (gConnector[i]->connector_type == VIDEO_CONNECTOR_UNKNOWN) { + if (gConnector[i]->type == VIDEO_CONNECTOR_UNKNOWN) { TRACE("%s: skipping unknown connector at %" B_PRId32 " of 0x%" B_PRIX8 "\n", __func__, i, ci.sucConnectorInfo.sbfAccess.bfConnectorType); @@ -287,10 +287,10 @@ detect_connectors_legacy() // Always set CRT1 and CRT2 as VGA, some cards incorrectly set // VGA ports as DVI if (i == ATOM_DEVICE_CRT1_INDEX || i == ATOM_DEVICE_CRT2_INDEX) - gConnector[i]->connector_type = VIDEO_CONNECTOR_VGA; + gConnector[i]->type = VIDEO_CONNECTOR_VGA; gConnector[i]->valid = true; - gConnector[i]->connector_flags = (1 << i); + gConnector[i]->encoder.flags = (1 << i); // TODO : add the encoder #if 0 @@ -310,7 +310,7 @@ detect_connectors_legacy() for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE_INFO; i++) { if (gConnector[i]->valid == true) { TRACE("%s: connector #%" B_PRId32 " is %s\n", __func__, i, - get_connector_name(gConnector[i]->connector_type)); + get_connector_name(gConnector[i]->type)); } } @@ -410,13 +410,11 @@ detect_connectors() } if (connector_type == VIDEO_CONNECTOR_UNKNOWN) { - TRACE("%s: Path #%" B_PRId32 ": skipping unknown connector.\n", + ERROR("%s: Path #%" B_PRId32 ": skipping unknown connector.\n", __func__, i); continue; } - uint32 encoder_type = VIDEO_ENCODER_NONE; - uint16 encoder_object_id = 0; int32 j; for (j = 0; j < ((B_LENDIAN_TO_HOST_INT16(path->usSize) - 8) / 2); j++) { @@ -464,6 +462,7 @@ detect_connectors() uint32 encoder_id = (encoder_obj & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; + uint32 encoder_type = VIDEO_ENCODER_NONE; switch(encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_TMDS1: @@ -525,7 +524,24 @@ detect_connectors() // drm_encoder_helper_add break; } - encoder_object_id = encoder_id; + + if (encoder_type == VIDEO_ENCODER_NONE) { + ERROR("%s: Path #%" B_PRId32 ":" + "skipping unknown encoder.\n", + __func__, i); + continue; + } + + // Set up encoder on connector if valid + TRACE("%s: Path #%" B_PRId32 ": Found encoder " + "%s\n", __func__, i, + get_encoder_name(encoder_type)); + gConnector[connector_index]->encoder.valid + = true; + gConnector[connector_index]->encoder.object_id + = encoder_id; + gConnector[connector_index]->encoder.type + = encoder_type; } } } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { @@ -581,27 +597,13 @@ detect_connectors() TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 ")\n", __func__, i, get_connector_name(connector_type), connector_type); - TRACE("%s: Path #%" B_PRId32 ": Found encoder %s\n", __func__, - i, get_encoder_name(encoder_type)); gConnector[connector_index]->valid = true; - - gConnector[connector_index]->connector_flags = connector_flags; - gConnector[connector_index]->connector_type = connector_type; - gConnector[connector_index]->connector_object_id + gConnector[connector_index]->flags = connector_flags; + gConnector[connector_index]->type = connector_type; + gConnector[connector_index]->object_id = connector_object_id; - gConnector[connector_index]->encoder_type = encoder_type; - gConnector[connector_index]->encoder_object_id = encoder_object_id; connector_index++; - - // radeon_add_atom_connector(dev, - // conn_id, - // le16_to_cpu(path-> usDeviceTag), - // connector_type, &ddc_bus, - // igp_lane_info, - // connector_object_id, - // &hpd, - // &router); } } // end for each display path @@ -645,7 +647,7 @@ detect_displays() " Injecting first connector as a last resort.\n", __func__); for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { // skip TV DAC connectors as likely fallback isn't for TV - if (gConnector[id]->encoder_type == VIDEO_ENCODER_TVDAC) + if (gConnector[id]->encoder.type == VIDEO_ENCODER_TVDAC) continue; gDisplay[0]->active = true; gDisplay[0]->connector_index = id; @@ -672,8 +674,8 @@ debug_displays() uint32 connector_index = gDisplay[id]->connector_index; if (gDisplay[id]->active) { - uint32 connector_type = gConnector[connector_index]->connector_type; - uint32 encoder_type = gConnector[connector_index]->encoder_type; + uint32 connector_type = gConnector[connector_index]->type; + uint32 encoder_type = gConnector[connector_index]->encoder.type; ERROR(" + connector: %s\n", get_connector_name(connector_type)); ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); @@ -694,9 +696,9 @@ debug_connectors() ERROR("Currently detected connectors=============\n"); for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { if (gConnector[id]->valid == true) { - uint32 connector_type = gConnector[id]->connector_type; - uint32 encoder_type = gConnector[id]->encoder_type; - uint16 gpio_id = gConnector[id]->connector_gpio_id; + uint32 connector_type = gConnector[id]->type; + uint32 encoder_type = gConnector[id]->encoder.type; + uint16 gpio_id = gConnector[id]->gpio_id; ERROR("Connector #%" B_PRIu32 ")\n", id); ERROR(" + connector: %s\n", get_connector_name(connector_type)); ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); @@ -714,7 +716,7 @@ debug_connectors() uint32 display_get_encoder_mode(uint32 connector_index) { - uint32 connector_type = gConnector[connector_index]->connector_type; + uint32 connector_type = gConnector[connector_index]->type; switch (connector_type) { case VIDEO_CONNECTOR_DVII: case VIDEO_CONNECTOR_HDMIB: /* HDMI-B is DL-DVI; analog works fine */ diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 6c91f2471b..beb0a0f38c 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -51,7 +51,7 @@ encoder_assign_crtc(uint8 id) return; uint16 connector_index = gDisplay[id]->connector_index; - uint16 encoder_id = gConnector[connector_index]->encoder_object_id; + uint16 encoder_id = gConnector[connector_index]->encoder.object_id; switch (frev) { case 1: @@ -177,7 +177,7 @@ encoder_mode_set(uint8 id, uint32 pixelClock) { uint32 connector_index = gDisplay[id]->connector_index; - switch (gConnector[connector_index]->encoder_object_id) { + switch (gConnector[connector_index]->encoder.object_id) { case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: case ENCODER_OBJECT_ID_INTERNAL_DAC2: @@ -225,9 +225,9 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) memset(&args, 0, sizeof(args)); int index = 0; - uint16 connector_flags = gConnector[connector_index]->connector_flags; + uint16 connector_flags = gConnector[connector_index]->encoder.flags; - switch (gConnector[connector_index]->encoder_object_id) { + switch (gConnector[connector_index]->encoder.object_id) { case ENCODER_OBJECT_ID_INTERNAL_LVDS: index = GetIndexIntoMasterTable(COMMAND, LVDSEncoderControl); break; @@ -343,7 +343,7 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) DAC_ENCODER_CONTROL_PS_ALLOCATION args; memset(&args, 0, sizeof(args)); - switch (gConnector[connector_index]->encoder_object_id) { + switch (gConnector[connector_index]->encoder.object_id) { case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: index = GetIndexIntoMasterTable(COMMAND, DAC1EncoderControl); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 0569af3a9a..ca064c9d7f 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -371,7 +371,7 @@ bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid) { // ensure things are sane - uint32 gpio_id = gConnector[connector]->connector_gpio_id; + uint32 gpio_id = gConnector[connector]->gpio_id; if (gGPIOInfo[gpio_id]->valid == false) return false; @@ -399,11 +399,11 @@ radeon_gpu_read_edid(uint32 connector, edid1_info *edid) status_t radeon_gpu_i2c_attach(uint32 id, uint8 hw_line) { - gConnector[id]->connector_gpio_id = 0; + gConnector[id]->gpio_id = 0; for (uint32 i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { if (gGPIOInfo[i]->hw_line != hw_line) continue; - gConnector[id]->connector_gpio_id = i; + gConnector[id]->gpio_id = i; return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 3925a70d4f..5a67f81f9c 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -140,7 +140,7 @@ radeon_set_display_mode(display_mode *mode) // *** encoder prep encoder_output_lock(true); - encoder_dpms_set(gConnector[connector_index]->encoder_object_id, + encoder_dpms_set(gConnector[connector_index]->encoder.object_id, B_DPMS_OFF); encoder_assign_crtc(id); @@ -166,7 +166,7 @@ radeon_set_display_mode(display_mode *mode) display_crtc_lock(id, ATOM_DISABLE); // *** encoder commit - encoder_dpms_set(gConnector[connector_index]->encoder_object_id, + encoder_dpms_set(gConnector[connector_index]->encoder.object_id, B_DPMS_ON); encoder_output_lock(false); } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 75e78d41e2..3591ca33e0 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -222,7 +222,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; args.v3.ucTransmitterId - = gConnector[connector_index]->encoder_object_id; + = gConnector[connector_index]->encoder.object_id; args.v3.ucEncoderMode = display_get_encoder_mode(connector_index); break; default: From 7d7b9632250246bc3a60ae5c343f79c0236a9f02 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 9 Oct 2011 19:56:19 +0000 Subject: [PATCH 356/702] * Remove the BNetworkDevice::AddPersistentNetwork() again and instead introduce BNetworkRoster::{Count|GetNext|Add|Remove}PersistentNetwork() as it fits better (thanks Philippe for the heads up). * Implement the backend for these functions in the net_server and also move conversion of the wireless_network based format into the settings based format there. * Implement removal of a network from the settings and make adding a new network with the same name replace the old one instead of just adding multiple ones. Might need to change this in the future depending on how we want to handle multiple networks with the same name (i.e. distinguish based on BSSID or similar). * Fix apparent oversight that caused configured networks _not_ to be used in the auto join attempt. * Remove auto joining open networks. I've been bitten by that more than once now because we happen to have an open network in the neighbourhood that I now accidentally used to transfer quite a bit of (unencrypted) stuff before noticing... In the future, one will instead have to explicitly join an open network once and store that config. Note that the driver will actually still auto-associate with open networks due to how things are set up currently. Note also that the auto join will fire join requests whenever there's a disassociation event, so you might see spurious join dialogs when the wpa_supplicant actually just re-establishes the connection. * Make join requests async again. Instead of waiting for a synchronous reply of the wpa_supplicant we instead return success when the request has been sent. While the API call might still be made synchronous again in the future, the net_server should really not block on an external application. In the case of the wpa_supplicant we would otherwise deadlock when using the new *PersistentNetwork() API after a successful join, and in other cases we might just unacceptably delay other calls. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42816 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/net/NetworkDevice.h | 4 +- headers/os/net/NetworkRoster.h | 8 + headers/private/net/NetServer.h | 3 + src/kits/network/libnetapi/NetworkDevice.cpp | 84 ------- src/kits/network/libnetapi/NetworkRoster.cpp | 132 ++++++++++ src/servers/net/NetServer.cpp | 240 +++++++++++++++++-- src/servers/net/Settings.cpp | 39 ++- src/servers/net/Settings.h | 4 +- 8 files changed, 401 insertions(+), 113 deletions(-) diff --git a/headers/os/net/NetworkDevice.h b/headers/os/net/NetworkDevice.h index fb97c26218..fe782be2ab 100644 --- a/headers/os/net/NetworkDevice.h +++ b/headers/os/net/NetworkDevice.h @@ -28,6 +28,7 @@ struct wireless_network { // flags #define B_NETWORK_IS_ENCRYPTED 0x01 +#define B_NETWORK_IS_PERSISTENT 0x02 // authentication modes enum { @@ -97,9 +98,6 @@ public: status_t GetNetwork(const BNetworkAddress& address, wireless_network& network); - status_t AddPersistentNetwork( - const wireless_network& network); - status_t JoinNetwork(const char* name, const char* password = NULL); status_t JoinNetwork(const wireless_network& network, diff --git a/headers/os/net/NetworkRoster.h b/headers/os/net/NetworkRoster.h index 849694542a..4d66365df9 100644 --- a/headers/os/net/NetworkRoster.h +++ b/headers/os/net/NetworkRoster.h @@ -12,6 +12,7 @@ class BMessenger; class BNetworkInterface; +struct wireless_network; class BNetworkRoster { @@ -29,6 +30,13 @@ public: status_t RemoveInterface( const BNetworkInterface& interface); + int32 CountPersistentNetworks() const; + status_t GetNextPersistentNetwork(uint32* cookie, + wireless_network& network) const; + status_t AddPersistentNetwork( + const wireless_network& network); + status_t RemovePersistentNetwork(const char* name); + status_t StartWatching(const BMessenger& target, uint32 eventMask); void StopWatching(const BMessenger& target); diff --git a/headers/private/net/NetServer.h b/headers/private/net/NetServer.h index 70b7eb0fff..9b66ad9a0f 100644 --- a/headers/private/net/NetServer.h +++ b/headers/private/net/NetServer.h @@ -13,7 +13,10 @@ #define kMsgConfigureInterface 'COif' #define kMsgConfigureResolver 'COrs' +#define kMsgCountPersistentNetworks 'CPnw' +#define kMsgGetPersistentNetwork 'GPnw' #define kMsgAddPersistentNetwork 'APnw' +#define kMsgRemovePersistentNetwork 'RPnw' #define kMsgJoinNetwork 'JNnw' #define kMsgLeaveNetwork 'LVnw' diff --git a/src/kits/network/libnetapi/NetworkDevice.cpp b/src/kits/network/libnetapi/NetworkDevice.cpp index f4ac139fdf..827ee06732 100644 --- a/src/kits/network/libnetapi/NetworkDevice.cpp +++ b/src/kits/network/libnetapi/NetworkDevice.cpp @@ -696,90 +696,6 @@ BNetworkDevice::GetNetwork(const BNetworkAddress& address, } -status_t -BNetworkDevice::AddPersistentNetwork(const wireless_network& network) -{ - BMessage message(kMsgAddPersistentNetwork); - status_t status = message.AddString("name", network.name); - if (status != B_OK) - return status; - - if (status == B_OK && network.address.Family() == AF_LINK) { - size_t addressLength = network.address.LinkLevelAddressLength(); - uint8* macAddress = network.address.LinkLevelAddress(); - bool usable = false; - BString formatted; - - for (size_t index = 0; index < addressLength; index++) { - if (index > 0) - formatted.Append(":"); - char buffer[3]; - snprintf(buffer, sizeof(buffer), "%2x", macAddress[index]); - formatted.Append(buffer, sizeof(buffer)); - - if (macAddress[index] != 0) - usable = true; - } - - if (usable) - status = message.AddString("mac", formatted); - } - - const char* authentication = NULL; - switch (network.authentication_mode) { - case B_NETWORK_AUTHENTICATION_NONE: - authentication = "none"; - break; - case B_NETWORK_AUTHENTICATION_WEP: - authentication = "wep"; - break; - case B_NETWORK_AUTHENTICATION_WPA: - authentication = "wpa"; - break; - case B_NETWORK_AUTHENTICATION_WPA2: - authentication = "wpa2"; - break; - } - - if (status == B_OK && authentication != NULL) - status = message.AddString("authentication", authentication); - - if (status == B_OK && (network.cipher & B_NETWORK_CIPHER_NONE) != 0) - status = message.AddString("cipher", "none"); - if (status == B_OK && (network.cipher & B_NETWORK_CIPHER_TKIP) != 0) - status = message.AddString("cipher", "tkip"); - if (status == B_OK && (network.cipher & B_NETWORK_CIPHER_CCMP) != 0) - status = message.AddString("cipher", "ccmp"); - - if (status == B_OK && (network.group_cipher & B_NETWORK_CIPHER_NONE) != 0) - status = message.AddString("group_cipher", "none"); - if (status == B_OK && (network.group_cipher & B_NETWORK_CIPHER_WEP_40) != 0) - status = message.AddString("group_cipher", "wep40"); - if (status == B_OK - && (network.group_cipher & B_NETWORK_CIPHER_WEP_104) != 0) { - status = message.AddString("group_cipher", "wep104"); - } - if (status == B_OK && (network.group_cipher & B_NETWORK_CIPHER_TKIP) != 0) - status = message.AddString("group_cipher", "tkip"); - if (status == B_OK && (network.group_cipher & B_NETWORK_CIPHER_CCMP) != 0) - status = message.AddString("group_cipher", "ccmp"); - - // TODO: the other fields aren't currently used, add them when they are - // and when it's clear how they will be stored - - if (status != B_OK) - return status; - - BMessenger networkServer(kNetServerSignature); - BMessage reply; - status = networkServer.SendMessage(&message, &reply); - if (status == B_OK) - reply.FindInt32("status", &status); - - return status; -} - - status_t BNetworkDevice::JoinNetwork(const char* name, const char* password) { diff --git a/src/kits/network/libnetapi/NetworkRoster.cpp b/src/kits/network/libnetapi/NetworkRoster.cpp index 43b4975d6a..d847f5a24a 100644 --- a/src/kits/network/libnetapi/NetworkRoster.cpp +++ b/src/kits/network/libnetapi/NetworkRoster.cpp @@ -9,10 +9,12 @@ #include #include +#include #include #include #include +#include // TODO: using AF_INET for the socket isn't really a smart idea, as one @@ -156,6 +158,136 @@ BNetworkRoster::RemoveInterface(const BNetworkInterface& interface) } +int32 +BNetworkRoster::CountPersistentNetworks() const +{ + BMessenger networkServer(kNetServerSignature); + BMessage message(kMsgCountPersistentNetworks); + BMessage reply; + if (networkServer.SendMessage(&message, &reply) != B_OK) + return 0; + + int32 count = 0; + if (reply.FindInt32("count", &count) != B_OK) + return 0; + + return count; +} + + +status_t +BNetworkRoster::GetNextPersistentNetwork(uint32* cookie, + wireless_network& network) const +{ + BMessenger networkServer(kNetServerSignature); + BMessage message(kMsgGetPersistentNetwork); + message.AddInt32("index", (int32)*cookie); + + BMessage reply; + status_t result = networkServer.SendMessage(&message, &reply); + if (result != B_OK) + return result; + + status_t status; + if (reply.FindInt32("status", &status) != B_OK) + return B_ERROR; + if (status != B_OK) + return status; + + BMessage networkMessage; + if (reply.FindMessage("network", &networkMessage) != B_OK) + return B_ERROR; + + BString networkName; + if (networkMessage.FindString("name", &networkName) != B_OK) + return B_ERROR; + + memset(network.name, 0, sizeof(network.name)); + strncpy(network.name, networkName.String(), sizeof(network.name)); + + BNetworkAddress address; + if (networkMessage.FindFlat("address", &network.address) != B_OK) + network.address.Unset(); + + if (networkMessage.FindUInt32("flags", &network.flags) != B_OK) + network.flags = 0; + + if (networkMessage.FindUInt32("authentication_mode", + &network.authentication_mode) != B_OK) { + network.authentication_mode = B_NETWORK_AUTHENTICATION_NONE; + } + + if (networkMessage.FindUInt32("cipher", &network.cipher) != B_OK) + network.cipher = B_NETWORK_CIPHER_NONE; + + if (networkMessage.FindUInt32("group_cipher", &network.group_cipher) + != B_OK) { + network.group_cipher = B_NETWORK_CIPHER_NONE; + } + + if (networkMessage.FindUInt32("key_mode", &network.key_mode) != B_OK) + network.key_mode = B_KEY_MODE_NONE; + + return B_OK; +} + + +status_t +BNetworkRoster::AddPersistentNetwork(const wireless_network& network) +{ + BMessage message(kMsgAddPersistentNetwork); + BString networkName; + networkName.SetTo(network.name, sizeof(network.name)); + status_t status = message.AddString("name", networkName); + if (status == B_OK) { + BNetworkAddress address = network.address; + status = message.AddFlat("address", &address); + } + + if (status == B_OK) + status = message.AddUInt32("flags", network.flags); + if (status == B_OK) { + status = message.AddUInt32("authentication_mode", + network.authentication_mode); + } + if (status == B_OK) + status = message.AddUInt32("cipher", network.cipher); + if (status == B_OK) + status = message.AddUInt32("group_cipher", network.group_cipher); + if (status == B_OK) + status = message.AddUInt32("key_mode", network.key_mode); + + if (status != B_OK) + return status; + + BMessenger networkServer(kNetServerSignature); + BMessage reply; + status = networkServer.SendMessage(&message, &reply); + if (status == B_OK) + reply.FindInt32("status", &status); + + return status; +} + + +status_t +BNetworkRoster::RemovePersistentNetwork(const char* name) +{ + BMessage message(kMsgRemovePersistentNetwork); + status_t status = message.AddString("name", name); + if (status != B_OK) + return status; + + BMessenger networkServer(kNetServerSignature); + BMessage reply; + status = networkServer.SendMessage(&message, &reply); + if (status == B_OK) + reply.FindInt32("status", &status); + + return status; +} + + status_t BNetworkRoster::StartWatching(const BMessenger& target, uint32 eventMask) { diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp index 301f827c86..4714b675fd 100644 --- a/src/servers/net/NetServer.cpp +++ b/src/servers/net/NetServer.cpp @@ -88,6 +88,9 @@ private: const char* name = NULL); status_t _LeaveNetwork(const BMessage& message); + status_t _ConvertNetworkToSettings(BMessage& message); + status_t _ConvertNetworkFromSettings(BMessage& message); + private: Settings fSettings; LooperMap fDeviceMap; @@ -357,12 +360,55 @@ NetServer::MessageReceived(BMessage* message) break; } - case kMsgAddPersistentNetwork: + case kMsgCountPersistentNetworks: { - status_t status = fSettings.AddNetwork(*message); + BMessage reply(B_REPLY); + reply.AddInt32("count", fSettings.CountNetworks()); + message->SendReply(&reply); + break; + } + + case kMsgGetPersistentNetwork: + { + uint32 index = 0; + status_t result = message->FindInt32("index", (int32*)&index); BMessage reply(B_REPLY); - reply.AddInt32("status", status); + if (result == B_OK) { + BMessage network; + result = fSettings.GetNextNetwork(index, network); + if (result == B_OK) + result = _ConvertNetworkFromSettings(network); + if (result == B_OK) + result = reply.AddMessage("network", &network); + } + + reply.AddInt32("status", result); + message->SendReply(&reply); + break; + } + + case kMsgAddPersistentNetwork: + { + status_t result = _ConvertNetworkToSettings(*message); + if (result == B_OK) + result = fSettings.AddNetwork(*message); + + BMessage reply(B_REPLY); + reply.AddInt32("status", result); + message->SendReply(&reply); + break; + } + + case kMsgRemovePersistentNetwork: + { + const char* networkName = NULL; + status_t result = message->FindString("name", &networkName); + if (result == B_OK) + result = fSettings.RemoveNetwork(networkName); + + BMessage reply(B_REPLY); + reply.AddInt32("status", result); message->SendReply(&reply); break; } @@ -511,7 +557,7 @@ NetServer::_ConfigureInterface(BMessage& message) BNetworkDevice device(name); if (device.IsWireless()) { const char* networkName; - if (message.FindString("network", &networkName) != B_OK) { + if (message.FindString("network", &networkName) == B_OK) { // join configured network status_t status = _JoinNetwork(message, networkName); if (status != B_OK) { @@ -908,23 +954,7 @@ NetServer::_AutoJoinNetwork(const char* name) } } - // None found, try them all - - wireless_network network; - cookie = 0; - while (device.GetNextNetwork(cookie, network) == B_OK) { - if ((network.flags & B_NETWORK_IS_ENCRYPTED) == 0) { - status_t status = _JoinNetwork(message, network.name); - printf("auto join open network \"%s\": %s\n", network.name, - strerror(status)); - if (status == B_OK) - return status; - } - - // TODO: once we have a password manager, use that - } - - return B_ERROR; + return B_NO_INIT; } @@ -1053,12 +1083,11 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name) return status; BMessenger wpaSupplicant(kWPASupplicantSignature); - BMessage reply; - status = wpaSupplicant.SendMessage(&join, &reply); + status = wpaSupplicant.SendMessage(&join); if (status != B_OK) return status; - return reply.FindInt32("status"); + return B_OK; } @@ -1070,6 +1099,169 @@ NetServer::_LeaveNetwork(const BMessage& message) } +status_t +NetServer::_ConvertNetworkToSettings(BMessage& message) +{ + BNetworkAddress address; + status_t result = message.FindFlat("address", &address); + if (result == B_OK) + message.RemoveName("address"); + + if (result == B_OK && address.Family() == AF_LINK) { + size_t addressLength = address.LinkLevelAddressLength(); + uint8* macAddress = address.LinkLevelAddress(); + bool usable = false; + BString formatted; + + for (size_t index = 0; index < addressLength; index++) { + if (index > 0) + formatted.Append(":"); + char buffer[3]; + snprintf(buffer, sizeof(buffer), "%2x", macAddress[index]); + formatted.Append(buffer, sizeof(buffer)); + + if (macAddress[index] != 0) + usable = true; + } + + if (usable) + message.AddString("mac", formatted); + } + + uint32 authentication = 0; + result = message.FindUInt32("authentication_mode", &authentication); + if (result == B_OK) { + message.RemoveName("authentication_mode"); + + const char* authenticationString = NULL; + switch (authentication) { + case B_NETWORK_AUTHENTICATION_NONE: + authenticationString = "none"; + break; + case B_NETWORK_AUTHENTICATION_WEP: + authenticationString = "wep"; + break; + case B_NETWORK_AUTHENTICATION_WPA: + authenticationString = "wpa"; + break; + case B_NETWORK_AUTHENTICATION_WPA2: + authenticationString = "wpa2"; + break; + } + + if (result == B_OK && authenticationString != NULL) + message.AddString("authentication", authenticationString); + } + + uint32 cipher = 0; + result = message.FindUInt32("cipher", &cipher); + if (result == B_OK) { + message.RemoveName("cipher"); + + if ((cipher & B_NETWORK_CIPHER_NONE) != 0) + message.AddString("cipher", "none"); + if ((cipher & B_NETWORK_CIPHER_TKIP) != 0) + message.AddString("cipher", "tkip"); + if ((cipher & B_NETWORK_CIPHER_CCMP) != 0) + message.AddString("cipher", "ccmp"); + } + + uint32 groupCipher = 0; + result = message.FindUInt32("group_cipher", &groupCipher); + if (result == B_OK) { + message.RemoveName("group_cipher"); + + if ((groupCipher & B_NETWORK_CIPHER_NONE) != 0) + message.AddString("group_cipher", "none"); + if ((groupCipher & B_NETWORK_CIPHER_WEP_40) != 0) + message.AddString("group_cipher", "wep40"); + if ((groupCipher & B_NETWORK_CIPHER_WEP_104) != 0) + message.AddString("group_cipher", "wep104"); + if ((groupCipher & B_NETWORK_CIPHER_TKIP) != 0) + message.AddString("group_cipher", "tkip"); + if ((groupCipher & B_NETWORK_CIPHER_CCMP) != 0) + message.AddString("group_cipher", "ccmp"); + } + + // TODO: the other fields aren't currently used, add them when they are + // and when it's clear how they will be stored + message.RemoveName("noise_level"); + message.RemoveName("signal_strength"); + message.RemoveName("flags"); + message.RemoveName("key_mode"); + + return B_OK; +} + + +status_t +NetServer::_ConvertNetworkFromSettings(BMessage& message) +{ + message.RemoveName("mac"); + // TODO: convert into a flat BNetworkAddress "address" + + const char* authentication = NULL; + if (message.FindString("authentication", &authentication) == B_OK) { + message.RemoveName("authentication"); + + if (strcasecmp(authentication, "none") == 0) { + message.AddUInt32("authentication_mode", + B_NETWORK_AUTHENTICATION_NONE); + } else if (strcasecmp(authentication, "wep") == 0) { + message.AddUInt32("authentication_mode", + B_NETWORK_AUTHENTICATION_WEP); + } else if (strcasecmp(authentication, "wpa") == 0) { + message.AddUInt32("authentication_mode", + B_NETWORK_AUTHENTICATION_WPA); + } else if (strcasecmp(authentication, "wpa2") == 0) { + message.AddUInt32("authentication_mode", + B_NETWORK_AUTHENTICATION_WPA2); + } + } + + int32 index = 0; + uint32 cipher = 0; + const char* cipherString = NULL; + while (message.FindString("cipher", index++, &cipherString) == B_OK) { + if (strcasecmp(cipherString, "none") == 0) + cipher |= B_NETWORK_CIPHER_NONE; + else if (strcasecmp(cipherString, "tkip") == 0) + cipher |= B_NETWORK_CIPHER_TKIP; + else if (strcasecmp(cipherString, "ccmp") == 0) + cipher |= B_NETWORK_CIPHER_CCMP; + } + + message.RemoveName("cipher"); + if (cipher != 0) + message.AddUInt32("cipher", cipher); + + index = 0; + cipher = 0; + while (message.FindString("group_cipher", index++, &cipherString) == B_OK) { + if (strcasecmp(cipherString, "none") == 0) + cipher |= B_NETWORK_CIPHER_NONE; + else if (strcasecmp(cipherString, "wep40") == 0) + cipher |= B_NETWORK_CIPHER_WEP_40; + else if (strcasecmp(cipherString, "wep104") == 0) + cipher |= B_NETWORK_CIPHER_WEP_104; + else if (strcasecmp(cipherString, "tkip") == 0) + cipher |= B_NETWORK_CIPHER_TKIP; + else if (strcasecmp(cipherString, "ccmp") == 0) + cipher |= B_NETWORK_CIPHER_CCMP; + } + + message.RemoveName("group_cipher"); + if (cipher != 0) + message.AddUInt32("group_cipher", cipher); + + message.AddUInt32("flags", B_NETWORK_IS_PERSISTENT); + + // TODO: add the other fields + message.RemoveName("key"); + return B_OK; +} + + // #pragma mark - diff --git a/src/servers/net/Settings.cpp b/src/servers/net/Settings.cpp index c164cf4dda..36dafc21c9 100644 --- a/src/servers/net/Settings.cpp +++ b/src/servers/net/Settings.cpp @@ -65,6 +65,7 @@ const static settings_template kNetworkTemplate[] = { {B_STRING_TYPE, "password", NULL}, {B_STRING_TYPE, "authentication", NULL}, {B_STRING_TYPE, "cipher", NULL}, + {B_STRING_TYPE, "group_cipher", NULL}, {B_STRING_TYPE, "key", NULL}, {0, NULL, NULL} }; @@ -412,6 +413,7 @@ Settings::_ConvertToDriverSettings(const char* name, if (status == B_OK) { settings.RemoveFirst("\n"); // TODO: actually write the settings.String() out into the file + printf("settings:\n%s\n", settings.String()); } return status; @@ -563,8 +565,19 @@ Settings::GetNextInterface(uint32& cookie, BMessage& interface) } +int32 +Settings::CountNetworks() const +{ + int32 count = 0; + if (fNetworks.GetInfo("network", NULL, &count) != B_OK) + return 0; + + return count; +} + + status_t -Settings::GetNextNetwork(uint32& cookie, BMessage& network) +Settings::GetNextNetwork(uint32& cookie, BMessage& network) const { status_t status = fNetworks.FindMessage("network", cookie, &network); if (status != B_OK) @@ -578,6 +591,10 @@ Settings::GetNextNetwork(uint32& cookie, BMessage& network) status_t Settings::AddNetwork(const BMessage& network) { + const char* name = NULL; + network.FindString("name", &name); + RemoveNetwork(name); + status_t result = fNetworks.AddMessage("network", &network); if (result != B_OK) return result; @@ -586,6 +603,26 @@ Settings::AddNetwork(const BMessage& network) } +status_t +Settings::RemoveNetwork(const char* name) +{ + int32 index = 0; + BMessage network; + while (fNetworks.FindMessage("network", index, &network) == B_OK) { + const char* networkName = NULL; + if (network.FindString("name", &networkName) == B_OK + && strcmp(networkName, name) == 0) { + fNetworks.RemoveData("network", index); + return _Save("wireless_networks"); + } + + index++; + } + + return B_ENTRY_NOT_FOUND; +} + + status_t Settings::GetNextService(uint32& cookie, BMessage& service) { diff --git a/src/servers/net/Settings.h b/src/servers/net/Settings.h index d782f1ebbd..01f2e16521 100644 --- a/src/servers/net/Settings.h +++ b/src/servers/net/Settings.h @@ -26,9 +26,11 @@ public: status_t GetNextInterface(uint32& cookie, BMessage& interface); + int32 CountNetworks() const; status_t GetNextNetwork(uint32& cookie, - BMessage& network); + BMessage& network) const; status_t AddNetwork(const BMessage& network); + status_t RemoveNetwork(const char* name); status_t GetNextService(uint32& cookie, BMessage& service); From 936aec7461bdc3312c60b4dc86a2d31ed57c8e2b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 9 Oct 2011 22:04:07 +0000 Subject: [PATCH 357/702] * remove some legacy code * don't init asic unless needed * do dpms by hand on mode set * detect tv and skip during detection for now git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42817 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/bios.cpp | 8 +- src/add-ons/accelerants/radeon_hd/display.cpp | 107 ++++-------------- src/add-ons/accelerants/radeon_hd/display.h | 1 - src/add-ons/accelerants/radeon_hd/encoder.cpp | 8 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 17 ++- 5 files changed, 40 insertions(+), 101 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 57ad8ec283..b47d8c4a73 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -159,13 +159,8 @@ radeon_init_bios(uint8* bios) radeon_bios_init_scratch(); atom_allocate_fb_scratch(gAtomContext); - // TODO : Always post bios for now... not doing this - // at a later date may save boot time - atom_asic_init(gAtomContext); - - #if 0 // post card atombios if needed - if (!radeon_bios_isposted()) { + if (radeon_bios_isposted() == false) { TRACE("%s: init AtomBIOS for this card as it is not not posted\n", __func__); // radeon_gpu_reset(); // <= r500 only? @@ -174,7 +169,6 @@ radeon_init_bios(uint8* bios) TRACE("%s: AtomBIOS is already posted\n", __func__); } - #endif return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 2ebbfd0c90..2f6f3e0bbb 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -282,7 +282,6 @@ detect_connectors_legacy() gConnector[i]->line_mux = ci.sucI2cId.ucAccess; // TODO : give tv unique connector ids - // TODO : ddc bus // Always set CRT1 and CRT2 as VGA, some cards incorrectly set // VGA ports as DVI @@ -603,6 +602,15 @@ detect_connectors() gConnector[connector_index]->type = connector_type; gConnector[connector_index]->object_id = connector_object_id; + + if (connector_type == VIDEO_CONNECTOR_COMPOSITE + || connector_type == VIDEO_CONNECTOR_SVIDEO + || connector_type == VIDEO_CONNECTOR_9DIN) { + gConnector[connector_index]->encoder.is_tv = true; + } else { + gConnector[connector_index]->encoder.is_tv = false; + } + connector_index++; } } // end for each display path @@ -624,6 +632,9 @@ detect_displays() for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { if (gConnector[id]->valid == false) continue; + // TODO : currently we skip TV connectors during detection + if (gConnector[id]->encoder.is_tv == true) + continue; if (displayIndex >= MAX_DISPLAY) continue; @@ -760,6 +771,7 @@ display_get_encoder_mode(uint32 connector_index) void display_crtc_lock(uint8 crtc_id, int command) { + TRACE("%s\n", __func__); ENABLE_CRTC_PS_ALLOCATION args; int index = GetIndexIntoMasterTable(COMMAND, UpdateCRTC_DoubleBufferRegisters); @@ -776,8 +788,9 @@ display_crtc_lock(uint8 crtc_id, int command) void display_crtc_blank(uint8 crtc_id, int command) { - int index = GetIndexIntoMasterTable(COMMAND, BlankCRTC); + TRACE("%s\n", __func__); BLANK_CRTC_PS_ALLOCATION args; + int index = GetIndexIntoMasterTable(COMMAND, BlankCRTC); memset(&args, 0, sizeof(args)); @@ -791,6 +804,7 @@ display_crtc_blank(uint8 crtc_id, int command) void display_crtc_scale(uint8 crtc_id, display_mode *mode) { + TRACE("%s\n", __func__); ENABLE_SCALER_PS_ALLOCATION args; int index = GetIndexIntoMasterTable(COMMAND, EnableScaler); @@ -875,17 +889,19 @@ display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode) Write32(CRT, regs->grphYStart, 0); Write32(CRT, regs->grphXEnd, mode->virtual_width); Write32(CRT, regs->grphYEnd, mode->virtual_height); - Write32(CRT, regs->grphPitch, bytesPerRow / 4); + Write32(CRT, regs->grphPitch, (bytesPerRow / 4)); Write32(CRT, regs->grphEnable, 1); // Enable Frame buffer Write32(CRT, regs->modeDesktopHeight, mode->virtual_height); - Write32(CRT, regs->viewportStart, 0); + uint32 viewport_w = mode->timing.h_display; + uint32 viewport_h = (mode->timing.v_display + 1) & ~1; + Write32(CRT, regs->viewportStart, 0); Write32(CRT, regs->viewportSize, - mode->timing.v_display | (mode->timing.h_display << 16)); + (viewport_w << 16) | viewport_h); uint32 tmp = Read32(CRT, AVIVO_D1GRPH_FLIP_CONTROL + regs->crtcOffset); tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; @@ -893,91 +909,12 @@ display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode) Write32(OUT, AVIVO_D1MODE_MASTER_UPDATE_MODE + regs->crtcOffset, 0); // Pageflip to happen anywhere in vblank -} - - -void -display_crtc_fb_set_legacy(uint8 crtc_id, display_mode *mode) -{ - register_info* regs = gDisplay[crtc_id]->regs; - - uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; - - Write32(CRT, regs->grphUpdate, (1<<16)); - // Lock for update (isn't this normally the other way around on VGA? - - Write32Mask(CRT, regs->grphEnable, 1, 0x00000001); - // Enable Frame buffer - - Write32(CRT, regs->grphControl, 0); - // Reset stored depth, format, etc - - uint32 bytesPerPixel; - uint32 bitsPerPixel; - - // set color mode on video card - switch (mode->space) { - case B_CMAP8: - bytesPerPixel = 1; - bitsPerPixel = 8; - Write32Mask(CRT, regs->grphControl, - 0, 0x00000703); - break; - case B_RGB15_LITTLE: - bytesPerPixel = 2; - bitsPerPixel = 15; - Write32Mask(CRT, regs->grphControl, - 0x000001, 0x00000703); - break; - case B_RGB16_LITTLE: - bytesPerPixel = 2; - bitsPerPixel = 16; - Write32Mask(CRT, regs->grphControl, - 0x000101, 0x00000703); - break; - case B_RGB24_LITTLE: - bytesPerPixel = 4; - bitsPerPixel = 24; - Write32Mask(CRT, regs->grphControl, - 0x000002, 0x00000703); - break; - case B_RGB32_LITTLE: - default: - bytesPerPixel = 4; - bitsPerPixel = 32; - Write32Mask(CRT, regs->grphControl, - 0x000002, 0x00000703); - break; - } - - uint32 bytesPerRow = mode->virtual_width * bytesPerPixel; - - Write32(CRT, regs->grphSwapControl, 0); - // only for chipsets > r600 - - // Tell GPU which frame buffer address to draw from - Write32(CRT, regs->grphPrimarySurfaceAddr, fbAddressInt & 0xFFFFFFFF); - Write32(CRT, regs->grphSecondarySurfaceAddr, fbAddressInt & 0xFFFFFFFF); - - Write32(CRT, regs->grphSurfaceOffsetX, 0); - Write32(CRT, regs->grphSurfaceOffsetY, 0); - Write32(CRT, regs->grphXStart, 0); - Write32(CRT, regs->grphYStart, 0); - Write32(CRT, regs->grphXEnd, mode->virtual_width); - Write32(CRT, regs->grphYEnd, mode->virtual_height); - Write32(CRT, regs->grphPitch, bytesPerRow / 4); - - Write32(CRT, regs->modeDesktopHeight, mode->virtual_height); - - Write32(CRT, regs->grphUpdate, 0); - // Unlock changed registers // update shared info gInfo->shared_info->bytes_per_row = bytesPerRow; gInfo->shared_info->current_mode = *mode; gInfo->shared_info->bits_per_pixel = bitsPerPixel; - // TODO : recompute bandwidth via rv515_bandwidth_avivo_update } @@ -1078,6 +1015,7 @@ display_crtc_set_dtd(uint8 crtc_id, display_mode *mode) void display_crtc_power(uint8 crtc_id, int command) { + TRACE("%s\n", __func__); int index = GetIndexIntoMasterTable(COMMAND, EnableCRTC); ENABLE_CRTC_PS_ALLOCATION args; @@ -1093,6 +1031,7 @@ display_crtc_power(uint8 crtc_id, int command) void display_crtc_memreq(uint8 crtc_id, int command) { + TRACE("%s\n", __func__); int index = GetIndexIntoMasterTable(COMMAND, EnableCRTCMemReq); ENABLE_CRTC_PS_ALLOCATION args; diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index aa95b385aa..37540ed4b8 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -69,7 +69,6 @@ uint32 display_get_encoder_mode(uint32 connector_index); void display_crtc_lock(uint8 crtc_id, int command); void display_crtc_blank(uint8 crtc_id, int command); void display_crtc_scale(uint8 crtc_id, display_mode *mode); -void display_crtc_fb_set_legacy(uint8 crtc_id, display_mode *mode); void display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode); void display_crtc_set(uint8 crtc_id, display_mode *mode); void display_crtc_set_dtd(uint8 crtc_id, display_mode *mode); diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index beb0a0f38c..46ebf8b5d1 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -66,10 +66,10 @@ encoder_assign_crtc(uint8 id) break; case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - //if (radeon_encoder->devices - // & ATOM_DEVICE_LCD1_SUPPORT) - // args.v1.ucDevice = ATOM_DEVICE_LCD1_INDEX; - //else + if (gConnector[connector_index]->flags + & ATOM_DEVICE_LCD1_SUPPORT) + args.v1.ucDevice = ATOM_DEVICE_LCD1_INDEX; + else args.v1.ucDevice = ATOM_DEVICE_DFP3_INDEX; break; case ENCODER_OBJECT_ID_INTERNAL_DVO1: diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 5a67f81f9c..d86dc3d016 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -102,23 +102,29 @@ radeon_dpms_set(int mode) { switch(mode) { case B_DPMS_ON: + TRACE("%s: ON\n", __func__); for (uint8 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id]->active == false) continue; + display_crtc_lock(id, ATOM_ENABLE); display_crtc_power(id, ATOM_ENABLE); display_crtc_memreq(id, ATOM_ENABLE); display_crtc_blank(id, ATOM_DISABLE); + display_crtc_lock(id, ATOM_DISABLE); } break; case B_DPMS_STAND_BY: case B_DPMS_SUSPEND: case B_DPMS_OFF: + TRACE("%s: OFF\n", __func__); for (uint8 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id]->active == false) continue; + display_crtc_lock(id, ATOM_ENABLE); display_crtc_blank(id, ATOM_ENABLE); display_crtc_memreq(id, ATOM_DISABLE); display_crtc_power(id, ATOM_DISABLE); + display_crtc_lock(id, ATOM_DISABLE); } break; } @@ -129,8 +135,6 @@ status_t radeon_set_display_mode(display_mode *mode) { // TODO : multi-monitor? for now we use VESA and not gDisplay edid - radeon_dpms_set(B_DPMS_OFF); - // Set mode on each display for (uint8 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id]->active == false) @@ -146,6 +150,9 @@ radeon_set_display_mode(display_mode *mode) // *** CRT controler prep display_crtc_lock(id, ATOM_ENABLE); + display_crtc_blank(id, ATOM_ENABLE); + display_crtc_memreq(id, ATOM_DISABLE); + display_crtc_power(id, ATOM_DISABLE); // *** CRT controler mode set // TODO : program SS @@ -155,7 +162,6 @@ radeon_set_display_mode(display_mode *mode) // TODO : vvvv : atombios_crtc_set_base display_crtc_fb_set_dce1(id, mode); - // display_crtc_fb_set_legacy(id, mode); // atombios_overscan_setup display_crtc_scale(id, mode); @@ -163,6 +169,9 @@ radeon_set_display_mode(display_mode *mode) encoder_mode_set(id, mode->timing.pixel_clock); // *** CRT controler commit + display_crtc_blank(id, ATOM_DISABLE); + display_crtc_memreq(id, ATOM_ENABLE); + display_crtc_power(id, ATOM_ENABLE); display_crtc_lock(id, ATOM_DISABLE); // *** encoder commit @@ -171,8 +180,6 @@ radeon_set_display_mode(display_mode *mode) encoder_output_lock(false); } - radeon_dpms_set(B_DPMS_ON); - int32 crtstatus = Read32(CRT, D1CRTC_STATUS); TRACE("CRT0 Status: 0x%X\n", crtstatus); crtstatus = Read32(CRT, D2CRTC_STATUS); From 1fca5eaf116609013ea078eac249e20fe8a87098 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 10 Oct 2011 16:46:22 +0000 Subject: [PATCH 358/702] * detect hdmi and tv and set as such * set encoder flags the same as connector flags * add curly comments to make troubleshooting clearer * program encoder dpms scratch registers git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42818 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 35 +++++--- src/add-ons/accelerants/radeon_hd/encoder.cpp | 79 ++++++++++++++++++- src/add-ons/accelerants/radeon_hd/encoder.h | 3 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 4 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 4 +- 5 files changed, 109 insertions(+), 16 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 2f6f3e0bbb..b991326c59 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -6,6 +6,11 @@ * Alexander von Gluck, kallisti5@unixzen.com */ +/* + * It's dangerous to go alone, take this! + * framebuffer -> crtc -> encoder -> transmitter -> connector -> monitor + */ + #include "accelerant_protos.h" #include "accelerant.h" @@ -398,7 +403,6 @@ detect_connectors() continue; } - uint16 igp_lane_info; if (0) ERROR("%s: TODO : IGP chip connector detection\n", __func__); @@ -426,6 +430,7 @@ detect_connectors() uint8 grph_obj_type = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; + if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { // Found an encoder // TODO : it may be possible to have more then one encoder @@ -535,6 +540,9 @@ detect_connectors() TRACE("%s: Path #%" B_PRId32 ": Found encoder " "%s\n", __func__, i, get_encoder_name(encoder_type)); + + gConnector[connector_index]->encoder.flags + = connector_flags; gConnector[connector_index]->encoder.valid = true; gConnector[connector_index]->encoder.object_id @@ -543,9 +551,10 @@ detect_connectors() = encoder_type; } } + // END if object is encoder } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { ERROR("%s: TODO : Found router object?\n", __func__); - } + } // END if object is router } // Set up information buses such as ddc @@ -593,6 +602,7 @@ detect_connectors() // TODO : aux chan transactions + // record connector information TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 ")\n", __func__, i, get_connector_name(connector_type), connector_type); @@ -603,16 +613,23 @@ detect_connectors() gConnector[connector_index]->object_id = connector_object_id; - if (connector_type == VIDEO_CONNECTOR_COMPOSITE - || connector_type == VIDEO_CONNECTOR_SVIDEO - || connector_type == VIDEO_CONNECTOR_9DIN) { - gConnector[connector_index]->encoder.is_tv = true; - } else { - gConnector[connector_index]->encoder.is_tv = false; + gConnector[connector_index]->encoder.is_tv = false; + gConnector[connector_index]->encoder.is_hdmi = false; + + switch(connector_type) { + case VIDEO_CONNECTOR_COMPOSITE: + case VIDEO_CONNECTOR_SVIDEO: + case VIDEO_CONNECTOR_9DIN: + gConnector[connector_index]->encoder.is_tv = true; + break; + case VIDEO_CONNECTOR_HDMIA: + case VIDEO_CONNECTOR_HDMIB: + gConnector[connector_index]->encoder.is_hdmi = true; + break; } connector_index++; - } + } // END for each valid connector } // end for each display path return B_OK; diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 46ebf8b5d1..0ee777b59f 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -366,7 +366,82 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) void -encoder_dpms_set(uint8 encoder_id, int mode) +encoder_dpms_scratch(uint8 crtc_id, bool power) +{ + TRACE("%s: power: %s\n", __func__, power ? "true" : "false"); + + uint32 connector_index = gDisplay[crtc_id]->connector_index; + uint32 encoder_flags = gConnector[connector_index]->encoder.flags; + + // TODO : r500 + uint32 bios_2_scratch = Read32(OUT, R600_BIOS_2_SCRATCH); + + if (encoder_flags & ATOM_DEVICE_TV1_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_TV1_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_TV1_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_CV_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_CV_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_CV_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_CRT1_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_CRT1_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_CRT2_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_CRT2_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_LCD1_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_LCD1_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_DFP1_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_DFP1_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_DFP2_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_DFP2_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_DFP3_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_DFP3_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_DFP4_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_DFP4_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_DFP4_DPMS_STATE; + } + if (encoder_flags & ATOM_DEVICE_DFP5_SUPPORT) { + if (power == true) + bios_2_scratch &= ~ATOM_S2_DFP5_DPMS_STATE; + else + bios_2_scratch |= ATOM_S2_DFP5_DPMS_STATE; + } + Write32(OUT, R600_BIOS_2_SCRATCH, bios_2_scratch); +} + + +void +encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) { int index = 0; DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; @@ -430,6 +505,7 @@ encoder_dpms_set(uint8 encoder_id, int mode) atom_execute_table(gAtomContext, index, (uint32*)&args); // TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = ATOM_LCD_BLON; // execute again + encoder_dpms_scratch(crtc_id, true); break; case B_DPMS_STAND_BY: case B_DPMS_SUSPEND: @@ -438,6 +514,7 @@ encoder_dpms_set(uint8 encoder_id, int mode) atom_execute_table(gAtomContext, index, (uint32*)&args); // TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = ATOM_LCD_BLOFF; // execute again + encoder_dpms_scratch(crtc_id, false); break; } } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index 0ed892b798..e4011c07b1 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -14,7 +14,8 @@ void encoder_mode_set(uint8 id, uint32 pixelClock); status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command); status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command); void encoder_output_lock(bool lock); -void encoder_dpms_set(uint8 encoder_id, int mode); +void encoder_dpms_scratch(uint8 crtc_id, bool power); +void encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode); #endif /* RADEON_HD_ENCODER_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index d86dc3d016..39226911ea 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -144,7 +144,7 @@ radeon_set_display_mode(display_mode *mode) // *** encoder prep encoder_output_lock(true); - encoder_dpms_set(gConnector[connector_index]->encoder.object_id, + encoder_dpms_set(id, gConnector[connector_index]->encoder.object_id, B_DPMS_OFF); encoder_assign_crtc(id); @@ -175,7 +175,7 @@ radeon_set_display_mode(display_mode *mode) display_crtc_lock(id, ATOM_DISABLE); // *** encoder commit - encoder_dpms_set(gConnector[connector_index]->encoder.object_id, + encoder_dpms_set(id, gConnector[connector_index]->encoder.object_id, B_DPMS_ON); encoder_output_lock(false); } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 3591ca33e0..97c53329db 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -233,7 +233,5 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) TRACE("%s: setting pixel clock %" B_PRIu32 "\n", __func__, pixelClock); - atom_execute_table(gAtomContext, index, (uint32 *)&args); - - return B_OK; + return atom_execute_table(gAtomContext, index, (uint32 *)&args); } From 82720f1cd0f4d1b7e5678ef3107e47b557cb4978 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 10 Oct 2011 18:07:53 +0000 Subject: [PATCH 359/702] * move pll info onto encoder * add atombios PLL adjustment code * add initial PLL clock flags git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42819 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 2 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 111 +++++++++++++++++- src/add-ons/accelerants/radeon_hd/pll.h | 18 +++ 3 files changed, 125 insertions(+), 6 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 979bca76b8..ed33fed80c 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -171,6 +171,7 @@ struct encoder_info { uint32 flags; bool is_hdmi; bool is_tv; + struct pll_info pll; }; @@ -195,7 +196,6 @@ typedef struct { uint32 vfreq_min; uint32 hfreq_max; uint32 hfreq_min; - pll_info pll; edid1_info edid_info; } display_info; diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 97c53329db..9ef4c7ac82 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -168,6 +168,104 @@ pll_compute(uint32 pixelClock, uint32 *dotclockOut, uint32 *referenceOut, } +union adjust_pixel_clock { + ADJUST_DISPLAY_PLL_PS_ALLOCATION v1; + ADJUST_DISPLAY_PLL_PS_ALLOCATION_V3 v3; +}; + + +uint32 +pll_adjust(uint32 pixelClock, uint8 crtc_id) +{ + uint32 flags = 0; + flags |= PLL_PREFER_LOW_REF_DIV; + // TODO : PLL flags + radeon_shared_info &info = *gInfo->shared_info; + + uint32 adjustedClock = pixelClock; + + uint32 connector_index = gDisplay[crtc_id]->connector_index; + uint32 encoder_id = gConnector[connector_index]->encoder.object_id; + uint32 encoder_mode = display_get_encoder_mode(connector_index); + pll_info *pll = &gConnector[connector_index]->encoder.pll; + + if (info.device_chipset >= (RADEON_R600 | 0x20)) { + union adjust_pixel_clock args; + uint8 frev; + uint8 crev; + + int index = GetIndexIntoMasterTable(COMMAND, AdjustDisplayPll); + + if (atom_parse_cmd_header(gAtomContext, index, &frev, &crev) != B_OK) + return adjustedClock; + + memset(&args, 0, sizeof(args)); + switch (frev) { + case 1: + switch (crev) { + case 1: + case 2: + args.v1.usPixelClock + = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v1.ucTransmitterID = encoder_id; + args.v1.ucEncodeMode = encoder_mode; + // TODO : SS and SS % > 0 + if (0) { + args.v1.ucConfig + |= ADJUST_DISPLAY_CONFIG_SS_ENABLE; + } + + atom_execute_table(gAtomContext, index, (uint32*)&args); + // get returned adjusted clock + adjustedClock + = B_LENDIAN_TO_HOST_INT16(args.v1.usPixelClock); + adjustedClock *= 10; + break; + case 3: + args.v3.sInput.usPixelClock + = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v3.sInput.ucTransmitterID = encoder_id; + args.v3.sInput.ucEncodeMode = encoder_mode; + args.v3.sInput.ucDispPllConfig = 0; + // TODO : SS and SS % > 0 + if (0) { + args.v3.sInput.ucDispPllConfig + |= DISPPLL_CONFIG_SS_ENABLE; + } + // TODO : if ATOM_DEVICE_DFP_SUPPORT + // TODO : display port DP + + // TODO : is DP? + args.v3.sInput.ucExtTransmitterID = 0; + + atom_execute_table(gAtomContext, index, (uint32*)&args); + adjustedClock + = B_LENDIAN_TO_HOST_INT32( + args.v3.sOutput.ulDispPllFreq) * 10; + + if (args.v3.sOutput.ucRefDiv) { + pll->flags |= PLL_USE_FRAC_FB_DIV; + pll->flags |= PLL_USE_REF_DIV; + pll->reference_div = args.v3.sOutput.ucRefDiv; + } + if (args.v3.sOutput.ucPostDiv) { + pll->flags |= PLL_USE_FRAC_FB_DIV; + pll->flags |= PLL_USE_POST_DIV; + pll->post_div = args.v3.sOutput.ucPostDiv; + } + break; + default: + return adjustedClock; + } + break; + default: + return adjustedClock; + } + } + return adjustedClock; +} + + status_t pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) { @@ -177,7 +275,9 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) uint32 feedbackFrac = 0; uint32 post = 0; - pll_compute(pixelClock, &dotclock, &reference, &feedback, + uint32 adjustedClock = pll_adjust(pixelClock, crtc_id); + + pll_compute(adjustedClock, &dotclock, &reference, &feedback, &feedbackFrac, &post); int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); @@ -192,7 +292,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) switch (crev) { case 1: - args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); args.v1.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); args.v1.ucFracFbDiv = feedbackFrac; @@ -202,7 +302,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) args.v1.ucRefDivSrc = 1; break; case 2: - args.v2.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v2.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); args.v2.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); args.v2.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); args.v2.ucFracFbDiv = feedbackFrac; @@ -212,7 +312,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) args.v2.ucRefDivSrc = 1; break; case 3: - args.v3.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + args.v3.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); args.v3.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); args.v3.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); args.v3.ucFracFbDiv = feedbackFrac; @@ -231,7 +331,8 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) return B_ERROR; } - TRACE("%s: setting pixel clock %" B_PRIu32 "\n", __func__, pixelClock); + TRACE("%s: set adjusted pixel clock %" B_PRIu32 " (was %" B_PRIu32 ")\n", + __func__, adjustedClock, pixelClock); return atom_execute_table(gAtomContext, index, (uint32 *)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index 144ab1adc6..dcf4736d9f 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -23,7 +23,25 @@ #define POST_DIV_MIN 2 #define POST_DIV_LIMIT 127 +/* pll flags */ +#define PLL_USE_BIOS_DIVS (1 << 0) +#define PLL_NO_ODD_POST_DIV (1 << 1) +#define PLL_USE_REF_DIV (1 << 2) +#define PLL_LEGACY (1 << 3) +#define PLL_PREFER_LOW_REF_DIV (1 << 4) +#define PLL_PREFER_HIGH_REF_DIV (1 << 5) +#define PLL_PREFER_LOW_FB_DIV (1 << 6) +#define PLL_PREFER_HIGH_FB_DIV (1 << 7) +#define PLL_PREFER_LOW_POST_DIV (1 << 8) +#define PLL_PREFER_HIGH_POST_DIV (1 << 9) +#define PLL_USE_FRAC_FB_DIV (1 << 10) +#define PLL_PREFER_CLOSEST_LOWER (1 << 11) +#define PLL_USE_POST_DIV (1 << 12) +#define PLL_IS_LCD (1 << 13) +#define PLL_PREFER_MINM_OVER_MAXP (1 << 14) + +uint32 pll_adjust(uint32 pixelClock, uint8 crtc_id); status_t pll_compute(uint32 pixelClock, uint32 *dotclockOut, uint32 *referenceOut, uint32 *feedbackOut, uint32 *feedbackFracOut, uint32 *postOut); From 2191dfe4bd3fb7134f2bcf880ca35ccb3c685522 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Tue, 11 Oct 2011 14:00:32 +0000 Subject: [PATCH 360/702] * Check the KBC command byte for kbd disable bit during keyboard probe and clean it in case it was set "on". * Tracing added for the case of ignoring interrupt with not active OBF status bit. Fixes #7973 #6313 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42820 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/ps2/ps2_common.cpp | 5 ++++- .../kernel/bus_managers/ps2/ps2_keyboard.cpp | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp index 27c837d8d1..889c657247 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp @@ -278,8 +278,11 @@ ps2_interrupt(void* cookie) ps2_dev *dev; ctrl = ps2_read_ctrl(); - if (!(ctrl & PS2_STATUS_OUTPUT_BUFFER_FULL)) + if (!(ctrl & PS2_STATUS_OUTPUT_BUFFER_FULL)) { + TRACE("ps2: ps2_interrupt unhandled, OBF bit unset, ctrl 0x%02x (%s)\n", + ctrl, (ctrl & PS2_STATUS_AUX_DATA) ? "aux" : "keyb"); return B_UNHANDLED_INTERRUPT; + } if (atomic_get(&sIgnoreInterrupts)) { TRACE("ps2: ps2_interrupt ignoring, ctrl 0x%02x (%s)\n", ctrl, diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp index bfd492bfb3..fd9ce14a78 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp @@ -289,6 +289,24 @@ probe_keyboard(void) // return B_ERROR; // } +// Some controllers set the disble keyboard command bit to "on" after resetting +// the keyboard device. Read #7973 #6313 for more details. +// So check the command byte now and re-enable the keyboard if it is the case. + uint8 cmdbyte = 0; + status = ps2_command(PS2_CTRL_READ_CMD, NULL, 0, &cmdbyte, 1); + + if (status != B_OK) { + INFO("ps2: cannot read CMD byte on kbd probe:0x%#08lx\n", status); + } else + if ((cmdbyte & PS2_BITS_KEYBOARD_DISABLED) == PS2_BITS_KEYBOARD_DISABLED) { + cmdbyte &= ~PS2_BITS_KEYBOARD_DISABLED; + status = ps2_command(PS2_CTRL_WRITE_CMD, &cmdbyte, 1, NULL, 0); + if (status != B_OK) { + INFO("ps2: cannot write 0x%02x to CMD byte on kbd probe:0x%08lx\n", + cmdbyte, status); + } + } + return B_OK; } From 522a82beb6378faebf16a6db8c0d2eb3ff1445c5 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Tue, 11 Oct 2011 14:59:28 +0000 Subject: [PATCH 361/702] SiS190/191 NIC driver moved from the development branch to the trunk to be available for using during build. It was requested by Frederik Modeen. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42822 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/network/Jamfile | 1 + .../drivers/network/sis19x/DataRing.cpp | 359 ++++++++++ .../kernel/drivers/network/sis19x/DataRing.h | 174 +++++ .../kernel/drivers/network/sis19x/Device.cpp | 676 ++++++++++++++++++ .../kernel/drivers/network/sis19x/Device.h | 127 ++++ .../kernel/drivers/network/sis19x/Driver.cpp | 283 ++++++++ .../kernel/drivers/network/sis19x/Driver.h | 45 ++ .../kernel/drivers/network/sis19x/Jamfile | 15 + .../kernel/drivers/network/sis19x/MIIBus.cpp | 446 ++++++++++++ .../kernel/drivers/network/sis19x/MIIBus.h | 147 ++++ .../kernel/drivers/network/sis19x/Registers.h | 265 +++++++ .../drivers/network/sis19x/Settings.cpp | 207 ++++++ .../kernel/drivers/network/sis19x/Settings.h | 92 +++ 13 files changed, 2837 insertions(+) create mode 100644 src/add-ons/kernel/drivers/network/sis19x/DataRing.cpp create mode 100644 src/add-ons/kernel/drivers/network/sis19x/DataRing.h create mode 100644 src/add-ons/kernel/drivers/network/sis19x/Device.cpp create mode 100644 src/add-ons/kernel/drivers/network/sis19x/Device.h create mode 100644 src/add-ons/kernel/drivers/network/sis19x/Driver.cpp create mode 100644 src/add-ons/kernel/drivers/network/sis19x/Driver.h create mode 100644 src/add-ons/kernel/drivers/network/sis19x/Jamfile create mode 100644 src/add-ons/kernel/drivers/network/sis19x/MIIBus.cpp create mode 100644 src/add-ons/kernel/drivers/network/sis19x/MIIBus.h create mode 100644 src/add-ons/kernel/drivers/network/sis19x/Registers.h create mode 100644 src/add-ons/kernel/drivers/network/sis19x/Settings.cpp create mode 100644 src/add-ons/kernel/drivers/network/sis19x/Settings.h diff --git a/src/add-ons/kernel/drivers/network/Jamfile b/src/add-ons/kernel/drivers/network/Jamfile index 88f48f92e8..5dadc90165 100644 --- a/src/add-ons/kernel/drivers/network/Jamfile +++ b/src/add-ons/kernel/drivers/network/Jamfile @@ -3,6 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers network ; SubInclude HAIKU_TOP src add-ons kernel drivers network etherpci ; SubInclude HAIKU_TOP src add-ons kernel drivers network pegasus ; SubInclude HAIKU_TOP src add-ons kernel drivers network rtl8169 ; +SubInclude HAIKU_TOP src add-ons kernel drivers network sis19x ; SubInclude HAIKU_TOP src add-ons kernel drivers network sis900 ; SubInclude HAIKU_TOP src add-ons kernel drivers network usb_asix ; SubInclude HAIKU_TOP src add-ons kernel drivers network usb_davicom ; diff --git a/src/add-ons/kernel/drivers/network/sis19x/DataRing.cpp b/src/add-ons/kernel/drivers/network/sis19x/DataRing.cpp new file mode 100644 index 0000000000..51150d8a38 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/DataRing.cpp @@ -0,0 +1,359 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ + +#include "DataRing.h" + +#include + +#include "Driver.h" +#include "Settings.h" +#include "Device.h" + + +// +// Tx stuff implementation +// + +template<> +void +DataRing::_SetBaseAddress(phys_addr_t address) +{ + fDevice->WritePCI32(TxBase, (uint32)address); +} + + +template<> +status_t +DataRing::Write(const uint8* buffer, + size_t* numBytes) +{ + *numBytes = min_c(*numBytes, MaxFrameSize); + + // wait for available tx descriptor + status_t status = acquire_sem_etc(fSemaphore, 1, B_TIMEOUT, TransmitTimeout); + if (status < B_NO_ERROR) { + TRACE_ALWAYS("Cannot acquire sem:%#010x\n", status); + return status; + } + + cpu_status cpuStatus = disable_interrupts(); + acquire_spinlock(&fSpinlock); + + uint32 index = fHead % TxDescriptorsCount; + volatile TxDescriptor& Descriptor = fDescriptors[index]; + + // check if the buffer not owned by hardware + uint32 descriptorStatus = Descriptor.fCommandStatus; + if ((descriptorStatus & TDC_TXOWN) == 0) { + + // copy data into buffer + status = user_memcpy((void*)fBuffers[index], buffer, *numBytes); + + // take care about tx descriptor + Descriptor.fPacketSize = *numBytes; + Descriptor.fEOD |= *numBytes; + Descriptor.fCommandStatus = TDC_PADEN | TDC_CRCEN + | TDC_DEFEN | TDC_THOL3 | TDC_TXINT; + if ((fDevice->LinkState().media & IFM_HALF_DUPLEX) != 0) { + Descriptor.fCommandStatus |= TDC_BKFEN | TDC_CRSEN | TDC_COLSEN; + if (fDevice->LinkState().speed == 1000000) { + Descriptor.fCommandStatus |= TDC_BSTEN | TDC_EXTEN; + } + } + + Descriptor.fCommandStatus |= TDC_TXOWN; + fHead++; + } + + fDevice->WritePCI32(TxControl, fDevice->ReadPCI32(TxControl) | TxControlPoll); + + release_spinlock(&fSpinlock); + restore_interrupts(cpuStatus); + + // if buffer was owned by hardware - notify about it + if ((descriptorStatus & TDC_TXOWN) != 0) { + release_sem_etc(fSemaphore, 1, B_DO_NOT_RESCHEDULE); + TRACE_ALWAYS("Buffer is still owned by the card.\n"); + status = B_BUSY; + } + + // TRACE_ALWAYS("Write:%d bytes:%#010x!\n", *numBytes, status); + + return status; +} + + +template<> +int32 +DataRing::InterruptHandler() +{ + uint32 releasedFrames = 0; + + acquire_spinlock(&fSpinlock); + + while (fTail != fHead) { + + uint32 index = fTail % TxDescriptorsCount; + volatile TxDescriptor& Descriptor = fDescriptors[index]; + uint32 status = Descriptor.fCommandStatus; + +#if STATISTICS + fDevice->fStatistics.PutTxStatus(status, Descriptor.fEOD/*PacketSize*/); +#endif + + /*if (status & TDC_TXOWN) { + //fDevice->WritePCI32(TxControl, fDevice->ReadPCI32(TxControl) | TxControlPoll); + break; //still owned by hardware - poll again ... + }*/ + + Descriptor.fPacketSize = 0; + Descriptor.fCommandStatus = 0; + Descriptor.fEOD &= TxDescriptorEOD; + + releasedFrames++; + + fTail++; + } + + release_spinlock(&fSpinlock); + + if (releasedFrames > 0) { + release_sem_etc(fSemaphore, releasedFrames, B_DO_NOT_RESCHEDULE); + return B_INVOKE_SCHEDULER; + } + + return B_HANDLED_INTERRUPT; +} + + +template<> +void +DataRing::CleanUp() +{ + cpu_status cpuStatus = disable_interrupts(); + acquire_spinlock(&fSpinlock); + + fDevice->WritePCI32(IntMask, 0 ); + + uint32 txControl = fDevice->ReadPCI32(TxControl); + txControl &= ~(TxControlPoll | TxControlEnable); + fDevice->WritePCI32(TxControl, txControl); + + spin(50); + + uint32 droppedFrames = fHead - fTail; + /* + for (;fHead != fTail; fHead--, droppedFrames++) { + uint32 index = fHead % TxDescriptorsCount; + volatile TxDescriptor& Descriptor = fDescriptors[index]; + + / * if (Descriptor.fCommandStatus & TDC_TXOWN) { + continue; //still owned by hardware - ignore? + }* / + + Descriptor.fPacketSize = 0; + Descriptor.fCommandStatus = 0; + Descriptor.fEOD &= TxDescriptorEOD; + } + */ +#if STATISTICS + fDevice->fStatistics.fDropped += droppedFrames; +#endif + + fHead = fTail = 0; + + for (size_t i = 0; i < TxDescriptorsCount; i++) { + fDescriptors[i].fPacketSize = 0; + fDescriptors[i].fCommandStatus = 0; + fDescriptors[i].fEOD &= TxDescriptorEOD;; + } + + // uint32 txBase = fDevice->ReadPCI32(TxBase); + //uint32 index = fHead % TxDescriptorsCount; + //fDevice->WritePCI32(TxStatus, txBase + 8 /*+ index * sizeof(TxDescriptor)*/); + //fDevice->WritePCI32(TxBase, txBase); + + if (droppedFrames > 0) { + release_sem_etc(fSemaphore, droppedFrames, B_DO_NOT_RESCHEDULE); + } + + txControl |= TxControlEnable; + fDevice->WritePCI32(TxControl, txControl); + + fDevice->WritePCI32(IntMask, knownInterruptsMask); + + release_spinlock(&fSpinlock); + restore_interrupts(cpuStatus); +} + + +template<> +void +DataRing::Dump() +{ + int32 count = 0; + get_sem_count(fSemaphore, &count); + kprintf("Tx:[count:%ld] head:%lu tail:%lu dirty:%lu\n", + count, fHead, fTail, fHead - fTail); + + kprintf("\tPktSize\t\tCmdStat\t\tBufPtr\t\tEOD\n"); + + for (size_t i = 0; i < TxDescriptorsCount; i++) { + volatile TxDescriptor& D = fDescriptors[i]; + char marker = ((fTail % TxDescriptorsCount) == i) ? '=' : ' '; + marker = ((fHead % TxDescriptorsCount) == i) ? '>' : marker; + kprintf("%02lx %c\t%08lx\t%08lx\t%08lx\t%08lx\n", i, marker, + D.fPacketSize, D.fCommandStatus, D.fBufferPointer, D.fEOD); + } +} + + +// +// Rx stuff implementation +// + +template<> +void +DataRing::_SetBaseAddress(phys_addr_t address) +{ + fDevice->WritePCI32(RxBase, (uint32)address); +} + + +template<> +int32 +DataRing::InterruptHandler() +{ + uint32 receivedFrames = 0; + + acquire_spinlock(&fSpinlock); + + uint32 index = fHead % RxDescriptorsCount; + uint32 status = fDescriptors[index].fStatusSize; + uint32 info = fDescriptors[index].fPacketInfo; + + while (((info & RDI_RXOWN) == 0) && (fHead - fTail) <= RxDescriptorsCount) { + +#if STATISTICS + fDevice->fStatistics.PutRxStatus(status); +#endif + receivedFrames++; + + fHead++; + + index = fHead % RxDescriptorsCount; + status = fDescriptors[index].fStatusSize; + info = fDescriptors[index].fPacketInfo; + } + + release_spinlock(&fSpinlock); + + if (receivedFrames > 0) { + release_sem_etc(fSemaphore, receivedFrames, B_DO_NOT_RESCHEDULE); + return B_INVOKE_SCHEDULER; + } + + return B_UNHANDLED_INTERRUPT; //XXX: ???? +} + + +template<> +status_t +DataRing::Read(uint8* buffer, size_t* numBytes) +{ + status_t rstatus = B_ERROR; + + do { + // wait for received rx descriptor + uint32 flags = B_CAN_INTERRUPT | fDevice->fBlockFlag; + status_t acquireStatus = acquire_sem_etc(fSemaphore, 1, flags, 0); + if (acquireStatus != B_NO_ERROR) { + TRACE_ALWAYS("Cannot acquire sem:%#010x\n", acquireStatus); + return acquireStatus; + } + + cpu_status cpuStatus = disable_interrupts(); + acquire_spinlock(&fSpinlock); + + uint32 index = fTail % RxDescriptorsCount; + volatile RxDescriptor& Descriptor = fDescriptors[index]; + + // check if the buffer owned by hardware - should never occure! + uint32 status = Descriptor.fStatusSize; + uint32 info = Descriptor.fPacketInfo; + uint16 count = (status & 0x7f000000) >> 24; + bool isFrameValid = false; + //status_t rstatus = B_ERROR; + + if ((info & RDI_RXOWN) == 0) { + isFrameValid = (status & rxErrorStatusBits) == 0 && (status & RDS_CRCOK) != 0; + if (isFrameValid) { + // frame is OK - copy it into buffer + *numBytes = status & RDS_SIZE; + rstatus = user_memcpy(buffer, (void*)fBuffers[index], *numBytes); + } + } + + // take care about rx descriptor + Descriptor.fStatusSize = 0; + Descriptor.fPacketInfo = RDI_RXOWN | RDI_RXINT; + + fTail++; + + release_spinlock(&fSpinlock); + restore_interrupts(cpuStatus); + + if ((info & RDI_RXOWN) != 0) { + TRACE_ALWAYS("Buffer is still owned by the card.\n"); + } else { + if (!isFrameValid) { + TRACE_ALWAYS("Invalid frame received, status:%#010x;info:%#010x!\n", status, info); + } /*else { + TRACE_ALWAYS("Read:%d bytes;st:%#010x;info:%#010x!\n", *numBytes, status, info); + } */ + // we have free rx buffer - reenable potentially idle state machine + fDevice->WritePCI32(RxControl, fDevice->ReadPCI32(RxControl) | RxControlPoll | RxControlEnable); + } + + if (count > 1) { + TRACE_ALWAYS("Warning:Descriptors count is %d!\n", count); + } + + } while (rstatus != B_OK); + + return rstatus; +} + + +template<> +void +DataRing::Dump() +{ + int32 count = 0; + get_sem_count(fSemaphore, &count); + kprintf("Rx:[count:%ld] head:%lu tail:%lu dirty:%lu\n", + count, fHead, fTail, fHead - fTail); + + for (size_t i = 0; i < 2; i++) { + kprintf("\tStatSize\tPktInfo\t\tBufPtr\t\tEOD %c", + i == 0 ? '|' : '\n'); + } + + for (size_t i = 0; i < RxDescriptorsCount / 2; i++) { + const char* mask = "%02lx %c\t%08lx\t%08lx\t%08lx\t%08lx %c"; + + for (size_t ii = 0; ii < 2; ii++) { + size_t index = ii == 0 ? i : (i + RxDescriptorsCount / 2); + volatile RxDescriptor& D = fDescriptors[index]; + char marker = ((fTail % RxDescriptorsCount) == index) ? '=' : ' '; + marker = ((fHead % RxDescriptorsCount) == index) ? '>' : marker; + kprintf(mask, index, marker, D.fStatusSize, D.fPacketInfo, + D.fBufferPointer, D.fEOD, ii == 0 ? '|' : '\n' ); + } + } +} + diff --git a/src/add-ons/kernel/drivers/network/sis19x/DataRing.h b/src/add-ons/kernel/drivers/network/sis19x/DataRing.h new file mode 100644 index 0000000000..af4ebfb625 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/DataRing.h @@ -0,0 +1,174 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ +#ifndef _SiS19X_DATARING_H_ +#define _SiS19X_DATARING_H_ + + +#include + +#include "Driver.h" +#include "Registers.h" +#include "Settings.h" + + +class Device; + +template +class DataRing { +public: + DataRing(Device* device, bool isTx); + ~DataRing(); + + status_t Open(); + void CleanUp(); + status_t Close(); + + status_t Read(uint8* buffer, size_t* numBytes); + status_t Write(const uint8* buffer, size_t* numBytes); + + int32 InterruptHandler(); + + void Trace(); + void Dump(); + +private: + status_t _InitArea(); + void _SetBaseAddress(phys_addr_t address); + + Device* fDevice; + bool fIsTx; + status_t fStatus; + area_id fArea; + int32 fSpinlock; + sem_id fSemaphore; + uint32 fHead; + uint32 fTail; + + volatile __type* fDescriptors; + volatile uint8* fBuffers[__count]; +}; + + + +template +DataRing<__type, __count>::DataRing(Device* device, bool isTx) + : + fDevice(device), + fIsTx(isTx), + fStatus(B_NO_INIT), + fArea(-1), + fSpinlock(0), + fSemaphore(0), + fHead(0), + fTail(0), + fDescriptors(NULL) +{ + memset(fBuffers, 0, sizeof(fBuffers)); +} + + +template +DataRing<__type, __count>::~DataRing() +{ + delete_sem(fSemaphore); + delete_area(fArea); +} + + +template +status_t +DataRing<__type, __count>::_InitArea() +{ + // create area for xfer data descriptors and buffers... + // + // layout is following: + // | descriptors array | buffers array | + // + uint32 buffSize = BufferSize + sizeof(__type); + buffSize *= __count; + buffSize = (buffSize + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); + fArea = create_area(DRIVER_NAME "_data_ring", (void**)&fDescriptors, + B_ANY_KERNEL_ADDRESS, buffSize, + B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA); + if (fArea < 0) { + TRACE_ALWAYS("Cannot create area with size %d bytes:%#010x\n", + buffSize, fArea); + return fStatus = fArea; + } + + // setup descriptors and buffers layout + uint8* buffersData = (uint8*)fDescriptors; + uint32 descriptorsSize = sizeof(__type) * __count; + buffersData += descriptorsSize; + + physical_entry table = {0}; + + for (size_t i = 0; i < __count; i++) { + fBuffers[i] = buffersData + BufferSize * i; + + get_memory_map((void*)fBuffers[i], BufferSize, &table, 1); + fDescriptors[i].Init(table.address, i == (__count - 1)); + } + + get_memory_map((void*)fDescriptors, descriptorsSize, &table, 1); + + _SetBaseAddress(table.address); + + return fStatus = B_OK; +} + + +template +status_t +DataRing<__type, __count>::Open() +{ + if (fStatus != B_OK && _InitArea() != B_OK) { + return fStatus; + } + + if (fIsTx) { + fSemaphore = create_sem(__count, "SiS19X Transmit"); + } else { + fSemaphore = create_sem(0, "SiS19X Receive"); + } + + if (fSemaphore < 0) { + TRACE_ALWAYS("Cannot create %s semaphore:%#010x\n", + fIsTx ? "transmit" : "receive", fSemaphore); + return fStatus = fSemaphore; + } + + set_sem_owner(fSemaphore, B_SYSTEM_TEAM); + + return fStatus = B_OK; +} + + +template +status_t +DataRing<__type, __count>::Close() +{ + delete_sem(fSemaphore); + fSemaphore = 0; + + return B_OK; +} + + +template +void +DataRing<__type, __count>::Trace() +{ + int32 count = 0; + get_sem_count(fSemaphore, &count); + TRACE_ALWAYS("%s:[count:%d] n:%lu l:%lu d:%lu\n", fIsTx ? "Tx" : "Rx", + count, fHead, fTail, fHead - fTail); +} + + +#endif //_SiS19X_DATARING_H_ + diff --git a/src/add-ons/kernel/drivers/network/sis19x/Device.cpp b/src/add-ons/kernel/drivers/network/sis19x/Device.cpp new file mode 100644 index 0000000000..e33c075549 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/Device.cpp @@ -0,0 +1,676 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ + + +#include "Device.h" + +#include +#include + +#include "Driver.h" +#include "Settings.h" +#include "Registers.h" + + +Device::Device(Device::Info &DeviceInfo, pci_info &PCIInfo) + : + fStatus(B_ERROR), + fPCIInfo(PCIInfo), + fInfo(DeviceInfo), + fIOBase(0), + fHWSpinlock(0), + fInterruptsNest(0), + fFrameSize(MaxFrameSize), + fMII(this), + fOpen(false), + fBlockFlag(0), + fLinkStateChangeSem(-1), + fHasConnection(false), + fTxDataRing(this, true), + fRxDataRing(this, false) +{ + memset((struct timer*)this, 0, sizeof(struct timer)); + + uint32 cmdRegister = gPCIModule->read_pci_config(PCIInfo.bus, + PCIInfo.device, PCIInfo.function, PCI_command, 2); + TRACE_ALWAYS("cmdRegister:%#010x\n", cmdRegister); + cmdRegister |= PCI_command_io | PCI_command_memory | PCI_command_master; + gPCIModule->write_pci_config(PCIInfo.bus, PCIInfo.device, + PCIInfo.function, PCI_command, 2, cmdRegister); + + fIOBase = PCIInfo.u.h0.base_registers[1]; + TRACE_ALWAYS("fIOBase:%#010x\n", fIOBase); + + fStatus = B_OK; +} + + +Device::~Device() +{ +} + + +status_t +Device::Open(uint32 flags) +{ + TRACE("flags:%x\n", flags); + if (fOpen) { + TRACE_ALWAYS("An attempt to re-open device ignored.\n"); + return B_BUSY; + } + + status_t result = fMII.Init(); + if (result != B_OK) { + TRACE_ALWAYS("MII initialization failed: %#010x.\n", result); + return result; + } + + _Reset(); + + if ((fMII.LinkState().media & IFM_ACTIVE) == 0/*fNegotiationComplete*/) { + fMII.UpdateLinkState(); + } + + fMII.SetMedia(); + + WritePCI32(RxMACAddress, 0); + _InitRxFilter(); + + fRxDataRing.Open(); + fTxDataRing.Open(); + + if (atomic_add(&fInterruptsNest, 1) == 0) { + install_io_interrupt_handler(fPCIInfo.u.h0.interrupt_line, + InterruptHandler, this, 0); + TRACE("Interrupt handler installed at line %d.\n", + fPCIInfo.u.h0.interrupt_line); + } + + _SetRxMode(false); + + // enable al known interrupts + WritePCI32(IntMask, knownInterruptsMask); + + // enable Rx and Tx + uint32 control = ReadPCI32(RxControl); + control |= RxControlEnable | RxControlPoll; + WritePCI32(RxControl, control); + + control = ReadPCI32(TxControl); + control |= TxControlEnable /*| TxControlPoll*/; + WritePCI32(TxControl, control); + + add_timer((timer*)this, _TimerHandler, 1000000LL, B_PERIODIC_TIMER); + + //fNonBlocking = (flags & O_NONBLOCK) == O_NONBLOCK; + fOpen = true; + return B_OK; +} + + +status_t +Device::Close() +{ + TRACE("closed!\n"); + + // disable interrupts + WritePCI32(IntMask, 0); + spin(2000); + + // Stop Tx / Rx status machine + uint32 status = ReadPCI32(IntControl); + status |= 0x00008000; + WritePCI32(IntControl, status); + spin(50); + status &= ~0x00008000; + WritePCI32(IntControl, status); + + if (atomic_add(&fInterruptsNest, -1) == 1) { + remove_io_interrupt_handler(fPCIInfo.u.h0.interrupt_line, + InterruptHandler, this); + TRACE("Interrupt handler at line %d uninstalled.\n", + fPCIInfo.u.h0.interrupt_line); + } + + fRxDataRing.Close(); + fTxDataRing.Close(); + + cancel_timer((timer*)this); + + TRACE("timer cancelled\n"); + + fOpen = false; + + return B_OK; +} + + +status_t +Device::Free() +{ + // fRxDataRing.Free(); + // fTxDataRing.Free(); + + TRACE("freed\n"); + return B_OK; +} + + +status_t +Device::Read(uint8 *buffer, size_t *numBytes) +{ + return fRxDataRing.Read(buffer, numBytes); +} + + +status_t +Device::Write(const uint8 *buffer, size_t *numBytes) +{ + if ((fMII.LinkState().media & IFM_ACTIVE) == 0) { + TRACE_ALWAYS("Write failed. link is inactive!\n"); + return B_OK; // return OK because of well-known DHCP "moustreap"! + } + + return fTxDataRing.Write(buffer, numBytes); +} + + +status_t +Device::Control(uint32 op, void *buffer, size_t length) +{ + switch (op) { + case ETHER_INIT: + TRACE("ETHER_INIT\n"); + return B_OK; + + case ETHER_GETADDR: + memcpy(buffer, &fMACAddress, sizeof(fMACAddress)); + TRACE("ETHER_GETADDR %#02x:%#02x:%#02x:%#02x:%#02x:%#02x\n", + fMACAddress.ebyte[0], fMACAddress.ebyte[1], + fMACAddress.ebyte[2], fMACAddress.ebyte[3], + fMACAddress.ebyte[4], fMACAddress.ebyte[5]); + return B_OK; + + case ETHER_GETFRAMESIZE: + *(uint32 *)buffer = fFrameSize; + TRACE("ETHER_ETHER_GETFRAMESIZE:%d\n",fFrameSize); + return B_OK; + + case ETHER_NONBLOCK: + TRACE("ETHER_NONBLOCK\n"); + fBlockFlag = *((uint32*)buffer) ? B_TIMEOUT : 0; + return B_OK; + + case ETHER_SETPROMISC: + TRACE("ETHER_SETPROMISC\n"); + return _SetRxMode(*((uint8*)buffer)); + + case ETHER_ADDMULTI: + case ETHER_REMMULTI: + TRACE_ALWAYS("Multicast operations are not implemented.\n"); + return B_ERROR; + + case ETHER_SET_LINK_STATE_SEM: + fLinkStateChangeSem = *(sem_id *)buffer; + TRACE_ALWAYS("ETHER_SET_LINK_STATE_SEM\n"); + return B_OK; + + case ETHER_GET_LINK_STATE: + return GetLinkState((ether_link_state *)buffer); + + default: + TRACE_ALWAYS("Unhandled IOCTL catched: %#010x\n", op); + } + + return B_DEV_INVALID_IOCTL; +} + + +status_t +Device::SetupDevice() +{ + ether_address address; + status_t result = ReadMACAddress(address); + if (result != B_OK) { + TRACE_ALWAYS("Error of reading MAC address:%#010x\n", result); + return result; + } + + TRACE("MAC address is:%02x:%02x:%02x:%02x:%02x:%02x\n", + address.ebyte[0], address.ebyte[1], address.ebyte[2], + address.ebyte[3], address.ebyte[4], address.ebyte[5]); + + fMACAddress = address; + + uint16 info = _ReadEEPROM(EEPROMInfo); + fMII.SetRGMII((info & 0x0080) != 0); + + TRACE("RGMII is '%s'. EEPROM info word:%#06x.\n", + fMII.HasRGMII() ? "on" : "off", info); + + fMII.SetGigagbitCapable(fInfo.Id() == SiS191); + + return B_OK; +} + + +void +Device::TeardownDevice() +{ + +} + + +uint8 +Device::ReadPCI8(int offset) +{ + return gPCIModule->read_io_8(fIOBase + offset); +} + + +uint16 +Device::ReadPCI16(int offset) +{ + return gPCIModule->read_io_16(fIOBase + offset); +} + + +uint32 +Device::ReadPCI32(int offset) +{ + return gPCIModule->read_io_32(fIOBase + offset); +} + + +void +Device::WritePCI8(int offset, uint8 value) +{ + gPCIModule->write_io_8(fIOBase + offset, value); +} + + +void +Device::WritePCI16(int offset, uint16 value) +{ + gPCIModule->write_io_16(fIOBase + offset, value); +} + + +void +Device::WritePCI32(int offset, uint32 value) +{ + gPCIModule->write_io_32(fIOBase + offset, value); +} + +/* + cpu_status + Device::Lock() + { + cpu_status st = disable_interrupts(); + acquire_spinlock(&fHWSpinlock); + return st; + } + + + void + Device::Unlock(cpu_status st) + { + release_spinlock(&fHWSpinlock); + restore_interrupts(st); + } + */ + +int32 +Device::InterruptHandler(void *InterruptParam) +{ + Device *device = (Device*)InterruptParam; + if(device == 0) { + TRACE_ALWAYS("Invalid parameter in the interrupt handler.\n"); + return B_HANDLED_INTERRUPT; + } + + int32 result = B_UNHANDLED_INTERRUPT; + + acquire_spinlock(&device->fHWSpinlock); + + // disable interrupts... + device->WritePCI32(IntMask, 0); + + //int maxWorks = 40; + + //do { + uint32 status = device->ReadPCI32(IntSource); + +#if STATISTICS + device->fStatistics.PutStatus(status); +#endif + device->WritePCI32(IntSource, status); + + if ((status & knownInterruptsMask) != 0) { + //break; + //} + + // XXX: ???? + result = B_HANDLED_INTERRUPT; + + if ((status & (/*INT_TXIDLE |*/ INT_TXDONE)) != 0 ) { + result = device->fTxDataRing.InterruptHandler(); + } + + if ((status & (/*INT_RXIDLE |*/ INT_RXDONE)) != 0 ) { + result = device->fRxDataRing.InterruptHandler(); + } + + /*if ((status & (INT_LINK)) != 0 ) { + //if (!device->fMII.isLinkUp()) { + device->fTxDataRing.CleanUp(); + //} + }*/ + } + + //} while (--maxWorks > 0); + + // enable interrupts... + device->WritePCI32(IntMask, knownInterruptsMask); + + release_spinlock(&device->fHWSpinlock); + + return result; +} + + +status_t +Device::GetLinkState(ether_link_state *linkState) +{ + status_t result = user_memcpy(linkState, &fMII.LinkState(), + sizeof(ether_link_state)); + +#if STATISTICS + fStatistics.Trace(); + fRxDataRing.Trace(); + fTxDataRing.Trace(); + uint32 rxControl = ReadPCI32(RxControl); + uint32 txControl = ReadPCI32(TxControl); + TRACE_ALWAYS("RxControl:%#010x;TxControl:%#010x\n", rxControl, txControl); +#endif + + TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n", + (linkState->media & IFM_ACTIVE) ? "active" : "inactive", + linkState->speed / 1000, + (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); + + return result; +} + + +status_t +Device::_SetRxMode(bool isPromiscuousModeOn) +{ + // clean the Rx MAC Control register + WritePCI16(RxMACControl, (ReadPCI16(RxMACControl) & ~RXM_Mask)); + + uint16 rxMode = RXM_Broadcast | RXM_Multicast | RXM_Physical; + if (isPromiscuousModeOn) { + rxMode |= RXM_AllPhysical; + } + + // set multicast filters + WritePCI32(RxHashTable, 0xffffffff); + WritePCI32(RxHashTable + 4, 0xffffffff); + + // update rx mode + WritePCI16(RxMACControl, ReadPCI16(RxMACControl) | rxMode); + + return B_OK; +} + + +int32 +Device::_TimerHandler(struct timer* timer) +{ + Device* device = (Device*)timer; + + bool linkChanged = false; + int32 result = device->fMII.TimerHandler(&linkChanged); + + if (linkChanged) { + if (device->fMII.IsLinkUp()) { + device->fTxDataRing.CleanUp(); + //device->WritePCI32(IntControl, 0x8000); + //device->ReadPCI32(IntControl); + //spin(100); + //device->WritePCI32(IntControl, 0x0); + } + } + + if (linkChanged && device->fLinkStateChangeSem > B_OK) { + release_sem_etc(device->fLinkStateChangeSem, 1, B_DO_NOT_RESCHEDULE); + } + + return result; +} + + +status_t +Device::_Reset() +{ + // disable interrupts + WritePCI32(IntMask, 0); + WritePCI32(IntSource, 0xffffffff); + + // reset Rx & Tx + WritePCI32(TxControl, 0x00001c00); + WritePCI32(RxControl, 0x001e1c00); + + WritePCI32(IntControl, 0x8000); + ReadPCI32(IntControl); + spin(100); + WritePCI32(IntControl, 0x0); + + WritePCI32(IntMask, 0); + WritePCI32(IntSource, 0xffffffff); + + // initial values for all MAC registers + WritePCI32(TxBase, 0x0); + WritePCI32(TxReserved, 0x0); + WritePCI32(RxBase, 0x0); + WritePCI32(RxReserved, 0x0); + + WritePCI32(PowControl, 0xffc00000); + WritePCI32(Reserved0, 0x0); + + WritePCI32(StationControl, fMII.HasRGMII() ? 0x04008001 : 0x04000001); + WritePCI32(GIoCR, 0x0); + WritePCI32(GIoControl, 0x0); + + WritePCI32(TxMACControl, 0x00002364); + WritePCI32(TxLimit, 0x0000000f); + + WritePCI32(RGDelay, 0x0); + WritePCI32(Reserved1, 0x0); + WritePCI32(RxMACControl, 0x00000252); + + WritePCI32(RxHashTable, 0x0); + WritePCI32(RxHashTable + 4, 0x0); + + WritePCI32(RxWOLControl, 0x80ff0000); + WritePCI32(RxWOLData, 0x80ff0000); + WritePCI32(RxMPSControl, 0x0); + WritePCI32(Reserved2, 0x0); + + return B_OK; +} + + +void +Device::_InitRxFilter() +{ + // store filter value + uint16 filter = ReadPCI16(RxMACControl); + + // disable disable packet filtering before address is set + WritePCI32(RxMACControl, (filter & ~RXM_Mask)); + + for (size_t i = 0; i < _countof(fMACAddress.ebyte); i++) { + WritePCI8(RxMACAddress + i, fMACAddress.ebyte[i]); + } + + // enable packet filtering + WritePCI16(RxMACControl, filter); +} + + +uint16 +Device::_ReadEEPROM(uint32 address) +{ + if (address > EIOffset) { + TRACE_ALWAYS("EEPROM address %#08x is invalid.\n", address); + return EIInvalid; + } + + WritePCI32(EEPROMInterface, EIReq | EIOpRead | (address << EIOffsetShift)); + + spin(500); // 500 ms? + + for (size_t i = 0; i < 1000; i++) { + uint32 data = ReadPCI32(EEPROMInterface); + if ((data & EIReq) == 0) { + return (data & EIData) >> EIDataShift; + } + spin(100); // 100 ms? + } + + TRACE_ALWAYS("timeout reading EEPROM.\n"); + + return EIInvalid; +} + + +status_t +Device::ReadMACAddress(ether_address_t& address) +{ + uint16 signature = _ReadEEPROM(EEPROMSignature); + TRACE("EEPROM Signature: %#06x\n", signature); + + if (signature != 0x0000 && signature != EIInvalid) { + for (size_t i = 0; i < _countof(address.ebyte) / 2; i++) { + uint16 addr = _ReadEEPROM(EEPROMAddress + i); + address.ebyte[i * 2 + 0] = (uint8)addr; + address.ebyte[i * 2 + 1] = (uint8)(addr >> 8); + } + + return B_OK; + } + + // SiS96x can use APC CMOS RAM to store MAC address, + // this is accessed through ISA bridge. + uint32 register73 = gPCIModule->read_pci_config(fPCIInfo.bus, + fPCIInfo.device, fPCIInfo.function, 0x73, 1); + TRACE_ALWAYS("Config register x73:%#010x\n", register73); + + if ((register73 & 0x00000001) == 0) + return B_ERROR; + + // look for PCI-ISA bridge + uint16 ids[] = { 0x0965, 0x0966, 0x0968 }; + + pci_info pciInfo = {0}; + for (long i = 0; B_OK == (*gPCIModule->get_nth_pci_info)(i, &pciInfo); i++) { + if (pciInfo.vendor_id != 0x1039) + continue; + + for (size_t idx = 0; idx < _countof(ids); idx++) { + if (pciInfo.device_id == ids[idx]) { + + // enable ports 0x78 0x79 to access APC registers + uint32 reg = gPCIModule->read_pci_config(pciInfo.bus, + pciInfo.device, pciInfo.function, 0x48, 1); + reg &= ~0x02; + gPCIModule->write_pci_config(pciInfo.bus, + pciInfo.device, pciInfo.function, 0x48, 1, reg); + snooze(50); + reg = gPCIModule->read_pci_config(pciInfo.bus, + pciInfo.device, pciInfo.function, 0x48, 1); + + // read factory MAC address + for (size_t i = 0; i < _countof(address.ebyte); i++) { + gPCIModule->write_io_8(0x78, 0x09 + i); + address.ebyte[i] = gPCIModule->read_io_8(0x79); + } + + // check MII/RGMII + gPCIModule->write_io_8(0x78, 0x12); + uint8 u8 = gPCIModule->read_io_8(0x79); + // TODO: set RGMII in fMII correctly! + // bool bRGMII = (u8 & 0x80) != 0; + TRACE_ALWAYS("RGMII: %#04x\n", u8); + + // close access to APC registers + gPCIModule->write_pci_config(pciInfo.bus, + pciInfo.device, pciInfo.function, 0x48, 1, reg); + + return B_OK; + } + } + } + + TRACE_ALWAYS("ISA bridge was not found.\n"); + return B_ERROR; +} + + +void +Device::DumpRegisters() +{ + struct RegisterEntry { + uint32 Base; + const char* Name; + bool writeBack; + } RegisterEntries[] = { + { TxControl, "TxControl", false }, + { TxBase, "TxBase\t", false }, + { TxStatus, "TxStatus", false }, + { TxReserved, "TxReserved", false }, + { RxControl, "RxControl", false }, + { RxBase, "RxBase\t", false }, + { RxStatus, "RxStatus", false }, + { RxReserved, "RxReserved", false }, + { IntSource, "IntSource", true }, + { IntMask, "IntMask", false }, + { IntControl, "IntControl", false }, + { IntTimer, "IntTimer", false }, + { PowControl, "PowControl", false }, + { Reserved0, "Reserved0", false }, + { EEPROMControl, "EEPROMCntl", false }, + { EEPROMInterface, "EEPROMIface", false }, + { StationControl, "StationCntl", false }, + { SMInterface, "SMInterface", false }, + { GIoCR, "GIoCR\t", false }, + { GIoControl, "GIoControl", false }, + { TxMACControl, "TxMACCntl", false }, + { TxLimit, "TxLimit", false }, + { RGDelay, "RGDelay", false }, + { Reserved1, "Reserved1", false }, + { RxMACControl, "RxMACCntlEtc", false }, + { RxMACAddress + 2, "RxMACAddr2", false }, + { RxHashTable, "RxHashTable1", false }, + { RxHashTable + 4, "RxHashTable2", false }, + { RxWOLControl, "RxWOLControl", false }, + { RxWOLData, "RxWOLData", false }, + { RxMPSControl, "RxMPSControl", false }, + { Reserved2, "Reserved2", false } + }; + + for (size_t i = 0; i < _countof(RegisterEntries); i++) { + uint32 registerContents = ReadPCI32(RegisterEntries[i].Base); + kprintf("%s:\t%08lx\n", RegisterEntries[i].Name, registerContents); + if (RegisterEntries[i].writeBack) { + WritePCI32(RegisterEntries[i].Base, registerContents); + } + } +} + diff --git a/src/add-ons/kernel/drivers/network/sis19x/Device.h b/src/add-ons/kernel/drivers/network/sis19x/Device.h new file mode 100644 index 0000000000..0a45233fd0 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/Device.h @@ -0,0 +1,127 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ +#ifndef _SiS19X_DEVICE_H_ +#define _SiS19X_DEVICE_H_ + + +#include "Driver.h" +#include "MIIBus.h" +#include "Registers.h" +#include "DataRing.h" + +#include "Settings.h" //!!! + + +const uint32 MaxFrameSize = 1514; // 1536?? +const bigtime_t TransmitTimeout = 5000000; + + +const uint32 TxDescriptorsCount = 65;//34;//32; +const uint32 RxDescriptorsCount = 65;//64; +const uint32 TxDescriptorsMask = TxDescriptorsCount - 1; +const uint32 RxDescriptorsMask = RxDescriptorsCount - 1; + + +typedef DataRing TxDataRing; +typedef DataRing RxDataRing; + + +class Device : private timer { +public: + class Info { + public: + const uint32 fId; + const char* fName; + const char* fDescription; + inline const char* Name() { return fName; } + inline const char* Description() { return fName; } + inline uint16 DeviceId() { return DEVICEID(fId); } + inline uint16 VendorId() { return VENDORID(fId); } + inline uint32 Id() { return fId; } + }; + + Device(Info &DeviceInfo, pci_info &PCIInfo); + virtual ~Device(); + + status_t InitCheck() { return fStatus; }; + + status_t Open(uint32 flags); +// bool IsOpen() { return fOpen; }; + + status_t Close(); + status_t Free(); + + status_t Read(uint8 *buffer, size_t *numBytes); + status_t Write(const uint8 *buffer, size_t *numBytes); + status_t Control(uint32 op, void *buffer, size_t length); + + status_t SetupDevice(); + void TeardownDevice(); + + status_t _Reset(); + + uint8 ReadPCI8(int offset); + uint16 ReadPCI16(int offset); + uint32 ReadPCI32(int offset); + void WritePCI8(int offset, uint8 value); + void WritePCI16(int offset, uint16 value); + void WritePCI32(int offset, uint32 value); + + cpu_status Lock(); + void Unlock(cpu_status st); + +static int32 InterruptHandler(void *InterruptParam); +const ether_link_state& LinkState() const { return fMII.LinkState(); } + +protected: + + status_t GetLinkState(ether_link_state *state); + status_t ReadMACAddress(ether_address_t& address); + uint16 _ReadEEPROM(uint32 address); + void _InitRxFilter(); + status_t _SetRxMode(bool isPromiscuousModeOn); + +static int32 _TimerHandler(struct timer* timer); + + // state tracking + status_t fStatus; + pci_info fPCIInfo; + Info& fInfo; + int fIOBase; + int32 fHWSpinlock; + int32 fInterruptsNest; + + // interface and device infos + uint16 fFrameSize; + + // MII bus handler + MIIBus fMII; + + // connection data + ether_address_t fMACAddress; + +public: + + bool fOpen; + uint32 fBlockFlag; + + // connection data + sem_id fLinkStateChangeSem; + bool fHasConnection; + + TxDataRing fTxDataRing; + RxDataRing fRxDataRing; + + void DumpRegisters(); + +#if STATISTICS + Statistics fStatistics; +#endif +}; + +#endif //_SiS19X_DEVICE_H_ + diff --git a/src/add-ons/kernel/drivers/network/sis19x/Driver.cpp b/src/add-ons/kernel/drivers/network/sis19x/Driver.cpp new file mode 100644 index 0000000000..bfce9dfb48 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/Driver.cpp @@ -0,0 +1,283 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ + + +#include "Driver.h" + +#include +#include +#include +#include + +#include "Device.h" +#include "Settings.h" + + +// TODO: Optimize buffers - use size 1536 instead of 2048 and dynamically determine count of descriptors. +// TODO: implement tx ring cleanup on reconnect (?) +// TODO: Tx speed is extremely low!!! Only 200 K/sek :-( + + +int32 api_version = B_CUR_DRIVER_API_VERSION; + +size_t numCards = 0; +Device* gDevices[MAX_DEVICES] = {0}; +char* gDeviceNames[MAX_DEVICES + 1] = {0}; + +pci_module_info* gPCIModule = NULL; + + +static Device::Info cardInfos[] = { + { SiS190, "SiS190", "SiS 190 PCI Fast Ethernet Adapter" }, + { SiS191, "SiS191", "SiS 191 PCI Gigabit Ethernet Adapter" } +}; + + +status_t +init_hardware() +{ + TRACE_ALWAYS("SiS19X:init_hardware()\n"); + status_t result = get_module(B_PCI_MODULE_NAME, (module_info**)&gPCIModule); + if (result < B_OK) { + return ENOSYS; + } + + pci_info info = {0}; + for (long i = 0; B_OK == (*gPCIModule->get_nth_pci_info)(i, &info); i++) { + for (size_t idx = 0; idx < _countof(cardInfos); idx++) { + if (CARDID(info.vendor_id, info.device_id) == cardInfos[idx].Id()) { + TRACE_ALWAYS("Found:%s %#010x\n", + cardInfos[idx].Description(), cardInfos[idx].Id()); + put_module(B_PCI_MODULE_NAME); + return B_OK; + } + } + } + + put_module(B_PCI_MODULE_NAME); + return ENODEV; +} + + +static int SiS19X_DebuggerCommand(int argc, char** argv) +{ + const char* usageInfo = "usage:" DRIVER_NAME " [index] \n" + " - t - dump Transmit ring;\n" + " - r - dump Receive ring.\n" + " - g - dump reGisters.\n"; + + uint64 cardId = 0; + int cmdIndex = 1; + + if (argc < 2) { + kprintf(usageInfo); + return 0; + } else + if (argc > 2) { + cardId = parse_expression(argv[2]); + cmdIndex++; + } + + if (cardId >= numCards) { + kprintf("%lld - invalid index.\n", cardId); + kprintf(usageInfo); + return 0; + } + + Device* device = gDevices[cardId]; + if (device == NULL) { + kprintf("Invalid device pointer!!!.\n"); + return 0; + } + + switch(*argv[cmdIndex]) { + case 'g': device->DumpRegisters(); break; + case 't': device->fTxDataRing.Dump(); break; + case 'r': device->fRxDataRing.Dump(); break; + default: + kprintf("'%s' - invalid parameter\n", argv[cmdIndex]); + kprintf(usageInfo); + break; + } + + return 0; +} + + +status_t +init_driver() +{ + status_t status = get_module(B_PCI_MODULE_NAME, (module_info**)&gPCIModule); + if (status < B_OK) { + return ENOSYS; + } + + load_settings(); + + TRACE_ALWAYS("%s\n", kVersion); + + pci_info info = {0}; + for (long i = 0; B_OK == (*gPCIModule->get_nth_pci_info)(i, &info); i++) { + for (size_t idx = 0; idx < _countof(cardInfos); idx++) { + if (info.vendor_id == cardInfos[idx].VendorId() + && info.device_id == cardInfos[idx].DeviceId()) + { + TRACE_ALWAYS("Found:%s %#010x\n", + cardInfos[idx].Description(), cardInfos[idx].Id()); + + if (numCards == MAX_DEVICES) { + break; + } + + Device* device = new Device(cardInfos[idx], info); + if (device == 0) { + return ENODEV; + } + + status_t status = device->InitCheck(); + if (status < B_OK) { + delete device; + break; + } + + status = device->SetupDevice(); + if (status < B_OK) { + delete device; + break; + } + + char name[DEVNAME_LEN] = {0}; + sprintf(name, "net/%s/%ld", cardInfos[idx].Name(), numCards); + gDeviceNames[numCards] = strdup(name); + gDevices[numCards++] = device; + } + } + } + + if (numCards == 0) { + put_module(B_PCI_MODULE_NAME); + return ENODEV; + } + + add_debugger_command(DRIVER_NAME, SiS19X_DebuggerCommand, + "SiS190/191 Ethernet driver info"); + + return B_OK; +} + + +void +uninit_driver() +{ + remove_debugger_command(DRIVER_NAME, SiS19X_DebuggerCommand); + + for (size_t i = 0; i < MAX_DEVICES; i++) { + if (gDevices[i]) { + gDevices[i]->TeardownDevice(); + delete gDevices[i]; + gDevices[i] = NULL; + } + + free(gDeviceNames[i]); + gDeviceNames[i] = NULL; + } + + put_module(B_PCI_MODULE_NAME); + + release_settings(); +} + + +static status_t +SiS19X_open(const char* name, uint32 flags, void** cookie) +{ + status_t status = ENODEV; + *cookie = NULL; + for (size_t i = 0; i < MAX_DEVICES; i++) { + if (gDeviceNames[i] && !strcmp(gDeviceNames[i], name)) { + status = gDevices[i]->Open(flags); + *cookie = gDevices[i]; + } + } + + return status; +} + + +static status_t +SiS19X_read(void* cookie, off_t position, void* buffer, size_t* numBytes) +{ + Device* device = (Device*)cookie; + return device->Read((uint8*)buffer, numBytes); +} + + +static status_t +SiS19X_write(void* cookie, off_t position, + const void* buffer, size_t* numBytes) +{ + Device* device = (Device*)cookie; + return device->Write((const uint8*)buffer, numBytes); +} + + +static status_t +SiS19X_control(void* cookie, uint32 op, void* buffer, size_t length) +{ + Device* device = (Device*) cookie; + return device->Control(op, buffer, length); +} + + +static status_t +SiS19X_close(void* cookie) +{ + Device* device = (Device*)cookie; + return device->Close(); +} + + +static status_t +SiS19X_free(void* cookie) +{ + Device* device = (Device*)cookie; + return device->Free(); +} + + +const char** +publish_devices() +{ + for (size_t i = 0; i < MAX_DEVICES; i++) { + if (gDevices[i] == NULL) + continue; + + if (gDeviceNames[i]) + TRACE("%s\n", gDeviceNames[i]); + } + + return (const char**)&gDeviceNames[0]; +} + + +device_hooks* +find_device(const char* name) +{ + static device_hooks deviceHooks = { + SiS19X_open, + SiS19X_close, + SiS19X_free, + SiS19X_control, + SiS19X_read, + SiS19X_write, + NULL, // select + NULL // deselect + }; + + return &deviceHooks; +} + diff --git a/src/add-ons/kernel/drivers/network/sis19x/Driver.h b/src/add-ons/kernel/drivers/network/sis19x/Driver.h new file mode 100644 index 0000000000..90793796a6 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/Driver.h @@ -0,0 +1,45 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ +#ifndef _SiS19X_DRIVER_H_ +#define _SiS19X_DRIVER_H_ + + +#include +#include + +#define DRIVER_NAME "sis19x" +#define MAX_DEVICES 3 +#define DEVNAME_LEN 32 + +#define CARDID(vendor_id, device_id)\ + (((uint32)(vendor_id) << 16) | (device_id)) + +#define VENDORID(card_id) (((card_id) >> 16) & 0xffff) +#define DEVICEID(card_id) ((card_id) & 0xffff) + + +const char* const kVersion = "ver.1.0.0"; + +// ids for supported hardware +const uint32 SiS190 = CARDID(0x1039, 0x0190); +const uint32 SiS191 = CARDID(0x1039, 0x0191); + +extern pci_module_info* gPCIModule; + + +extern "C" { + +status_t init_hardware(); +status_t init_driver(); +void uninit_driver(); +const char** publish_devices(); +device_hooks* find_device(const char* name); + +} + +#endif //_SiS19X_DRIVER_H_ + diff --git a/src/add-ons/kernel/drivers/network/sis19x/Jamfile b/src/add-ons/kernel/drivers/network/sis19x/Jamfile new file mode 100644 index 0000000000..4f58405f88 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/Jamfile @@ -0,0 +1,15 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network sis19x ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +UsePrivateHeaders kernel net ; + +UsePrivateHeaders [ FDirName kernel util ] ; + +KernelAddon sis19x : + Driver.cpp + Device.cpp + MIIBus.cpp + DataRing.cpp + Settings.cpp + ; diff --git a/src/add-ons/kernel/drivers/network/sis19x/MIIBus.cpp b/src/add-ons/kernel/drivers/network/sis19x/MIIBus.cpp new file mode 100644 index 0000000000..772307c4c5 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/MIIBus.cpp @@ -0,0 +1,446 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ + + +#include "MIIBus.h" + +#include + +#include "Driver.h" +#include "Settings.h" +#include "Device.h" +#include "Registers.h" + + +#define MII_OUI(id) ((id >> 10) & 0xffff) +#define MII_MODEL(id) ((id >> 4) & 0x003f) +#define MII_REV(id) ((id) & 0x000f) + +#define ISVALID(__address) ((__address) < 32) + +// the marker for not initialized or currently selected PHY address +const uint8 NotInitPHY = 0xff; + +// composite ids of PHYs suported by this driver +const uint32 BroadcomBCM5461 = CARDID(0x0020, 0x60c0); +const uint32 BroadcomAC131 = CARDID(0x0143, 0xbc70); +const uint32 AgereET1101B = CARDID(0x0282, 0xf010); +const uint32 Atheros = CARDID(0x004d, 0xd010); +const uint32 AtherosAR8012 = CARDID(0x004d, 0xd020); +const uint32 RealtekRTL8201 = CARDID(0x0000, 0x8200); +const uint32 Marvell88E1111 = CARDID(0x0141, 0x0cc0); +const uint32 UnknownPHY = CARDID(0x0000, 0x0000); + +MIIBus::ChipInfo miiChipTable[] = { + { BroadcomBCM5461, MIIBus::PHYLAN, "Broadcom BCM5461" }, + { BroadcomAC131, MIIBus::PHYLAN, "Broadcom AC131" }, + { AgereET1101B, MIIBus::PHYLAN, "Agere ET1101B" }, + { Atheros, MIIBus::PHYLAN, "Atheros" }, + { AtherosAR8012, MIIBus::PHYLAN, "Atheros AR8012" }, + { RealtekRTL8201, MIIBus::PHYLAN, "Realtek RTL8201" }, + { Marvell88E1111, MIIBus::PHYLAN, "Marvell 88E1111" }, + // unknown one must be the terminating entry! + { UnknownPHY, MIIBus::PHYUnknown, "Unknown PHY" } +}; + + +MIIBus::MIIBus(Device* device) + : + fDevice(device), + fSelectedPHY(NotInitPHY), + fGigagbitCapable(false), + fHasRGMII(false) +{ + memset(&fLinkState, 0, sizeof(fLinkState)); +} + + +status_t +MIIBus::Init() +{ + // reset to default state + fPHYs.MakeEmpty(); + + // iterate through all possible MII addresses + for (uint8 addr = 0; ISVALID(addr); addr++) { + uint16 miiStatus = _Read(MII_BMSR, addr); + + if (miiStatus == 0xffff || miiStatus == 0) + continue; + + uint32 Id = CARDID(_Read(MII_PHYID0, addr), _Read(MII_PHYID1, addr)); + + TRACE("MII Info(addr:%d,id:%#010x): OUI:%04x; Model:%04x; rev:%02x.\n", + addr, Id, MII_OUI(Id), MII_MODEL(Id), MII_REV(Id)); + + for (size_t i = 0; i < _countof(miiChipTable); i++){ + ChipInfo& info = miiChipTable[i]; + + if (info.fId != UnknownPHY && info.fId != (Id & 0xfffffff0)) + continue; + + fPHYs.Put(addr, info); + + break; + } + } + + if (fPHYs.IsEmpty()) { + TRACE_ALWAYS("No PHYs found.\n"); + return B_ENTRY_NOT_FOUND; + } + + // select appropriate PHY + Select(); + + // Marvell 88E1111 requires extra initialization + if (fPHYs.Get(fSelectedPHY).fId == Marvell88E1111) { + _Write(0x1b, (fHasRGMII ? 0x808b : 0x808f), fSelectedPHY); + spin(200); + _Write(0x14, (fHasRGMII ? 0x0ce1 : 0x0c60), fSelectedPHY); + spin(200); + } + + // some chips require reset + Reset(); + + return B_OK; +} + + +status_t +MIIBus::Select(uint16* currentStatus /*= NULL*/) +{ + if (fPHYs.IsEmpty()) { + TRACE_ALWAYS("Error: No PHYs found or available.\n"); + return B_ENTRY_NOT_FOUND; + } + + uint8 lanPHY = NotInitPHY; + uint8 homePHY = NotInitPHY; + fSelectedPHY = NotInitPHY; + + for (ChipInfoMap::Iterator i = fPHYs.Begin(); i != fPHYs.End(); i++) { + uint8 address = i->Key(); + ChipInfo& info = i->Value(); + + uint16 status = _Status(address); + + if ((status & BMSR_Link) && !ISVALID(fSelectedPHY) + && (info.fType != PHYUnknown)) + { + fSelectedPHY = address; + } else { + uint16 control = _Read(MII_BMCR, address); + control |= BMCR_Isolate | BMCR_ANegEnabled; + _Write(MII_BMCR, control, address); + + if (info.fType == PHYLAN) + lanPHY = address; + if (info.fType == PHYHome) + homePHY = address; + } + } + + if (!ISVALID(fSelectedPHY)) { + if (ISVALID(homePHY)) + fSelectedPHY = homePHY; + else if (ISVALID(lanPHY)) + fSelectedPHY = lanPHY; + else + fSelectedPHY = fPHYs.Begin()->Key(); + } + + uint16 control = _Read(MII_BMCR, fSelectedPHY); + control &= ~BMCR_Isolate; + _Write(MII_BMCR, control, fSelectedPHY); + +// TRACE("Selected PHY:%s\n", fPHYs.Get(fSelectedPHY).fName); + + if (currentStatus != NULL) { + *currentStatus = _Status(fSelectedPHY); + } + + return B_OK; +} + + +status_t +MIIBus::Reset(uint16* currentStatus /*=NULL*/) +{ + if (fPHYs.IsEmpty()) { + TRACE_ALWAYS("Error: No PHYs found or available.\n"); + return B_ENTRY_NOT_FOUND; + } + + uint16 status = _Status(fSelectedPHY); + _Write(MII_BMCR, BMCR_Reset | BMCR_ANegEnabled | BMCR_ANegRestart, fSelectedPHY); + + if (currentStatus != NULL) + *currentStatus = status; + + return B_OK; +} + + +void +MIIBus::_ControlSMInterface(uint32 control) +{ + fDevice->WritePCI32(SMInterface, control); + spin(10); + + for (size_t i = 0; i < 1000; i++) { + if ((fDevice->ReadPCI32(SMInterface) & SMIReq) == 0) { + return; + } + spin(10); + } + + TRACE_ALWAYS("Timeout writing SMI control.\n"); +} + + +uint16 +MIIBus::_Read(uint16 miiRegister, uint32 phyAddress) +{ + uint32 control = SMIOpRead | SMIReq; + control |= phyAddress << SMIPHYShift; + control |= miiRegister << SMIRegShift; + + _ControlSMInterface(control); + + return (fDevice->ReadPCI32(SMInterface) & SMIData) >> SMIDataShift; +} + + +status_t +MIIBus::Read(uint16 miiRegister, uint16 *value) +{ + if (fSelectedPHY >= 32) { + TRACE_ALWAYS("Error: MII is not ready\n"); + return B_ENTRY_NOT_FOUND; + } + + *value = _Read(miiRegister, fSelectedPHY); + + return B_OK; +} + + +void +MIIBus::_Write(uint16 miiRegister, uint16 value, uint32 phyAddress) +{ + uint32 control = SMIOpWrite | SMIReq; + control |= phyAddress << SMIPHYShift; + control |= miiRegister << SMIRegShift; + control |= value << SMIDataShift; + + _ControlSMInterface(control); +} + + +status_t +MIIBus::Write(uint16 miiRegister, uint16 value) +{ + if (fSelectedPHY >= 32) { + TRACE_ALWAYS("Error: MII is not ready\n"); + return B_ENTRY_NOT_FOUND; + } + + _Write(miiRegister, value, fSelectedPHY); + + return B_OK; +} + + +status_t +MIIBus::Status(uint16 *status) +{ + return Read(MII_BMSR, status); +} + + +uint16 +MIIBus::_Status(uint8 phyAddress) +{ + _Read(MII_BMSR, phyAddress); + return _Read(MII_BMSR, phyAddress); +} + + +bool +MIIBus::IsLinkUp() +{ + return (_Status(fSelectedPHY) & BMSR_Link) != 0; +} + + +uint32 +MIIBus::TimerHandler(bool* linkChanged) +{ + // XXX ? + /*if (!fNegotiationComplete) { + _UpdateLinkState(); + if ((fLinkState.media & IFM_ACTIVE) != 0) { + _SetMedia(); + } + return 0; + }*/ + + if ((fLinkState.media & IFM_ACTIVE) == 0) { + Select(); + if ((_Status(fSelectedPHY) & BMSR_Link) != 0) { + UpdateLinkState(); + SetMedia(); + if (fHasRGMII) { + if (fPHYs.Get(fSelectedPHY).fId == BroadcomBCM5461) { + _Write(0x18, 0xf1c7, fSelectedPHY); + spin(200); + _Write(0x1c, 0x8c00, fSelectedPHY); + } + + fDevice->WritePCI32(RGDelay, 0x0441); + fDevice->WritePCI32(RGDelay, 0x0440); + } + // start Rx + uint32 control = fDevice->ReadPCI32(RxControl); + control |= 0x00000010; + fDevice->WritePCI32(RxControl, control); + + *linkChanged = true; + } + } else { + if ((_Status(fSelectedPHY) & BMSR_Link) == 0) { + // stop Rx + uint32 control = fDevice->ReadPCI32(RxControl); + control &= ~(0x00000010); + fDevice->WritePCI32(RxControl, control); + UpdateLinkState(); + + *linkChanged = true; + } + } + + //if (*linkChanged) { + // TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n", + // (fLinkState.media & IFM_ACTIVE) ? "active" : "inactive", + // fLinkState.speed / 1000, + // (fLinkState.media & IFM_FULL_DUPLEX) ? "full" : "half"); + //} + + return 0; +} + + +status_t +MIIBus::UpdateLinkState(ether_link_state* state /*=NULL*/) +{ + if (state == NULL) { + state = &fLinkState; + } + + state->quality = 1000; + state->speed = 0; + state->media = IFM_ETHER; + + uint16 status = _Status(fSelectedPHY); + + if ((status & BMSR_Link) == 0) { + return B_OK; + } + + state->speed = 10000; + state->media |= IFM_ACTIVE; + + uint16 regAnar = _Read(MII_ANAR, fSelectedPHY); + uint16 regAnlpar = _Read(MII_ANLPAR, fSelectedPHY); + uint16 regAner = _Read(MII_ANER, fSelectedPHY); + + if (fGigagbitCapable && (regAnlpar & ANAR_NP) && (regAner & 0x0001)) { + uint16 regGAnar = _Read(MII_GANAR, fSelectedPHY); + uint16 regGAnlpar = _Read(MII_GANLPAR, fSelectedPHY); + + status = regGAnar & (regGAnlpar >> 2); + if (status & 0x0200) { + state->speed = 1000000; + state->media |= IFM_FULL_DUPLEX; + + } else if (status & 0x0100){ + state->speed = 1000000; + state->media |= IFM_HALF_DUPLEX; + + } else { + state->media |= IFM_HALF_DUPLEX; + } + + } else { + status = regAnar & regAnlpar; + + if (status & (ANAR_TX_HD | ANAR_TX_FD)) + state->speed = 100000; + if (status & (ANAR_TX_FD | ANAR_10_FD)) + state->media |= IFM_FULL_DUPLEX; + else + state->media |= IFM_HALF_DUPLEX; + } + + switch(state->speed) { + case 10000: state->media |= IFM_10_T; break; + case 100000: state->media |= IFM_100_TX; break; + case 1000000: state->media |= IFM_1000_T; break; + } + +// fNegotiationComplete = true; + return B_OK; +} + + +status_t +MIIBus::SetMedia(ether_link_state* state /*=NULL*/) +{ + if (state == NULL) { + state = &fLinkState; + } + + uint32 control = fDevice->ReadPCI32(StationControl); + + control &= ~(0x0f000000 | SC_FullDuplex | SC_Speed); + + switch(state->speed) { + case 1000000: + control |= (SC_Speed1000 | (0x3 << 24) | (0x1 << 26)); + break; + case 100000: + control |= (SC_Speed100 | (0x1 << 26)); + break; + case 10000: + control |= (SC_Speed10 | (0x1 << 26)); + break; + default: + TRACE_ALWAYS("Unsupported linkspeed:%d\n", state->speed); + break; + } + + if ((state->media & IFM_FULL_DUPLEX) != 0) { + control |= SC_FullDuplex; + } + + if (fHasRGMII) { + if (fPHYs.Get(fSelectedPHY).fId == BroadcomBCM5461) { + _Write(0x18, 0xf1c7, fSelectedPHY); + spin(200); + _Write(0x1c, 0x8c00, fSelectedPHY); + } + + control |= (0x3 << 24); + } + + fDevice->WritePCI32(StationControl, control); + + return B_OK; +} + diff --git a/src/add-ons/kernel/drivers/network/sis19x/MIIBus.h b/src/add-ons/kernel/drivers/network/sis19x/MIIBus.h new file mode 100644 index 0000000000..6e9a1f2c74 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/MIIBus.h @@ -0,0 +1,147 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ +#ifndef _SiS19X_MII_BUS_H_ +#define _SiS19X_MII_BUS_H_ + + +#include +#include + +#include "Driver.h" + + +enum MII_Register { + MII_BMCR = 0x00, + MII_BMSR = 0x01, + MII_PHYID0 = 0x02, + MII_PHYID1 = 0x03, + MII_ANAR = 0x04, + MII_ANLPAR = 0x05, + MII_ANER = 0x06, + MII_GANAR = 0x09, + MII_GANLPAR = 0x0a +}; + + +enum MII_BMCR { + BMCR_FullDuplex = 0x0100, + BMCR_ANegRestart = 0x0200, + BMCR_Isolate = 0x0400, + BMCR_PowerDown = 0x0800, + BMCR_ANegEnabled = 0x1000, + BMCR_SpeedSelection = 0x2000, + BMCR_Loopback = 0x4000, + BMCR_Reset = 0x8000 +}; + + +enum MII_BMSR { + BMSR_CAP_100BASE_T4 = 0x8000, // PHY is able to perform 100base-T4 + BMSR_CAP_100BASE_TXFD = 0x4000, // PHY is able to perform 100base-TX full duplex + BMSR_CAP_100BASE_TXHD = 0x2000, // PHY is able to perform 100base-TX half duplex + BMSR_CAP_10BASE_TXFD = 0x1000, // PHY is able to perform 10base-TX full duplex + BMSR_CAP_10BASE_TXHD = 0x0800, // PHY is able to perform 10base-TX half duplex + BMSR_MFPS = 0x0040, // Management frame preamble supression + BMSR_ANC = 0x0020, // Auto-negotiation complete + BMSR_RF = 0x0010, // Remote fault + BMSR_CAP_AN = 0x0008, // PHY is able to perform auto-negotiation + BMSR_Link = 0x0004, // link state + BMSR_Jabber = 0x0002, // Jabber condition detected + BMSR_CAP_Ext = 0x0001 // Extended register capable +}; + + +enum MII_ANAR { + ANAR_NP = 0x8000, // Next page available + ANAR_ACK = 0x4000, // Link partner data reception ability acknowledged + ANAR_RF = 0x2000, // Fault condition detected and advertised + ANAR_PAUSE = 0x0400, // Pause operation enabled for full-duplex links + ANAR_T4 = 0x0200, // 100BASE-T4 supported + ANAR_TX_FD = 0x0100, // 100BASE-TX full duplex supported + ANAR_TX_HD = 0x0080, // 100BASE-TX half duplex supported + ANAR_10_FD = 0x0040, // 10BASE-TX full duplex supported + ANAR_10_HD = 0x0020, // 10BASE-TX half duplex supported + ANAR_SELECTOR = 0x0001 // Protocol selection bits (hardcoded to ethernet) +}; + + +enum MII_ANLPAR { + ANLPAR_NP = 0x8000, // Link partner next page enabled + ANLPAR_ACK = 0x4000, // Link partner data reception ability acknowledged + ANLPAR_RF = 0x2000, // Remote fault indicated by link partner + ANLPAR_PAUSE = 0x0400, // Pause operation supported by link partner + ANLPAR_T4 = 0x0200, // 100BASE-T4 supported by link partner + ANLPAR_TX_FD = 0x0100, // 100BASE-TX full duplex supported by link partner + ANLPAR_TX_HD = 0x0080, // 100BASE-TX half duplex supported by link partner + ANLPAR_10_FD = 0x0040, // 10BASE-TX full duplex supported by link partner + ANLPAR_10_HD = 0x0020, // 10BASE-TX half duplex supported by link partner + ANLPAR_SELECTOR = 0x0001 // Link partner's binary encoded protocol selector +}; + + +class Device; + +class MIIBus { +public: + enum Type { + PHYUnknown = 0, + PHYHome = 1, + PHYLAN = 2, + PHYMix = 3 + }; + + struct ChipInfo { + uint32 fId; + Type fType; + const char* fName; + }; + + typedef VectorMap ChipInfoMap; + + MIIBus(Device* device); + + status_t Init(); + status_t InitCheck(); + + status_t Read(uint16 miiRegister, uint16 *value); + status_t Write(uint16 miiRegister, uint16 value); + + status_t Status(uint16 *status); + status_t Select(uint16* status = NULL); + status_t Reset(uint16* status = NULL); + uint32 TimerHandler(bool* linkChanged); + + bool IsLinkUp(); + status_t UpdateLinkState(ether_link_state* state = NULL); + status_t SetMedia(ether_link_state* state = NULL); + + bool IsGigagbitCapable() { return fGigagbitCapable; } + void SetGigagbitCapable(bool on) { fGigagbitCapable = on; } + + bool HasRGMII() { return fHasRGMII; } + void SetRGMII(bool on) { fHasRGMII = on; } + + const ether_link_state& LinkState() const { return fLinkState; } + +private: + uint16 _Status(uint8 phyAddress); + void _ControlSMInterface(uint32 control); + uint16 _Read(uint16 miiRegister, uint32 phyAddress); + void _Write(uint16 miiRegister, uint16 value, uint32 phyAddress); + + Device* fDevice; + uint8 fSelectedPHY; + ChipInfoMap fPHYs; + + bool fGigagbitCapable; + bool fHasRGMII; + + ether_link_state fLinkState; +}; + +#endif //_SiS19X_MII_BUS_H_ + diff --git a/src/add-ons/kernel/drivers/network/sis19x/Registers.h b/src/add-ons/kernel/drivers/network/sis19x/Registers.h new file mode 100644 index 0000000000..78431332e9 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/Registers.h @@ -0,0 +1,265 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ +#ifndef _SiS19X_REGISTERS_H_ +#define _SiS19X_REGISTERS_H_ + + +// Symbolic offset to registers +enum SiS19XRegisters { + TxControl = 0x00, // Tx Host Control / Status + TxBase = 0x04, // Tx Home Descriptor Base + TxReserved = 0x08, // Reserved + TxStatus = 0x0c, // Tx Next Descriptor Control / Status + RxControl = 0x10, // Rx Host Control / Status + RxBase = 0x14, // Rx Home Descriptor Base + RxReserved = 0x18, // Reserved + RxStatus = 0x1c, // Rx Next Descriptor Control / Status + IntSource = 0x20, // Interrupt Source + IntMask = 0x24, // Interrupt Mask + IntControl = 0x28, // Interrupt Control + IntTimer = 0x2c, // Interrupt Timer + PowControl = 0x30, // Power Management Control / Status + Reserved0 = 0x34, // Reserved + EEPROMControl = 0x38, // EEPROM Control / Status + EEPROMInterface = 0x3c, // EEPROM Interface + StationControl = 0x40, // Station Control / Status + SMInterface = 0x44, // Station Management Interface + GIoCR = 0x48, // GMAC IO Compensation + GIoControl = 0x4c, // GMAC IO Control + TxMACControl = 0x50, // Tx MAC Control + TxLimit = 0x54, // Tx MAC Timer / TryLimit + RGDelay = 0x58, // RGMII Tx Internal Delay Control + Reserved1 = 0x5c, // Reserved + RxMACControl = 0x60, // Rx MAC Control + RxMACAddress = 0x62, // Rx MAC Unicast Address + RxHashTable = 0x68, // Rx Multicast Hash Table + RxWOLControl = 0x70, // Rx WOL Control + RxWOLData = 0x74, // Rx WOL Data Access + RxMPSControl = 0x78, // Rx MPS Control + Reserved2 = 0x7c // Reserved +}; + + +// interrupt bits for IMR/ISR registers +enum SiS19XInterruptBits { + INT_SOFT = 0x40000000U, + INT_TIMER = 0x20000000U, + INT_PAUSEF = 0x00080000U, + INT_MAGICP = 0x00040000U, + INT_WAKEF = 0x00020000U, + INT_LINK = 0x00010000U, + INT_RXIDLE = 0x00000080U, + INT_RXDONE = 0x00000040U, + INT_TXIDLE = 0x00000008U, + INT_TXDONE = 0x00000004U, + INT_RXHALT = 0x00000002U, + INT_TXHALT = 0x00000001U +}; + + +const uint32 knownInterruptsMask = INT_LINK + /*| INT_RXIDLE*/ | INT_RXDONE + /*| INT_TXIDLE*/ | INT_TXDONE + | INT_RXHALT | INT_TXHALT; + + +// bits for RxControl register +enum SiS19XRxControlBits { + RxControlPoll = 0x00000010U, + RxControlEnable = 0x00000001U +}; + + +// bits for TxControl register +enum SiS19XTxControlBits { + TxControlPoll = 0x00000010U, + TxControlEnable = 0x00000001U +}; + + +// EEPROM Addresses +enum SiS19XEEPROMAddress { + EEPROMSignature = 0x00, + EEPROMClock = 0x01, + EEPROMInfo = 0x02, + EEPROMAddress = 0x03 +}; + + +// EEPROM Interface Register +enum SiS19XEEPROMInterface { + EIData = 0xffff0000, + EIDataShift = 16, + EIOffset = 0x0000fc00, + EIOffsetShift = 10, + EIOp = 0x00000300, + EIOpShift = 8, + EIOpRead = (2 << EIOpShift), + EIOpWrite = (1 << EIOpShift), + EIReq = 0x00000080, + EI_DO = 0x00000008, + EI_DI = 0x00000004, + EIClock = 0x00000002, + EI_CS = 0x00000001, + + EIInvalid = 0xffff // used as invalid readout from EEPROM +}; + + +// interrupt bits for Station Control registers +enum SiS19XStationControlBits { + SC_Loopback = 0x80000000U, + SC_RGMII = 0x00008000U, + SC_FullDuplex = 0x00001000U, + SC_Speed = 0x00000c00U, + SC_SpeedShift = 10, + SC_Speed1000 = (3U << SC_SpeedShift), + SC_Speed100 = (2U << SC_SpeedShift), + SC_Speed10 = (1U << SC_SpeedShift) +}; + + +// Station Management Interface Register +enum SiS19XSMInterface { + SMIData = 0xffff0000, + SMIDataShift = 16, + SMIReg = 0x0000f800, + SMIRegShift = 11, + SMIPHY = 0x000007c0, + SMIPHYShift = 6, + SMIOp = 0x00000020, + SMIOpShift = 5, + SMIOpWrite = (1 << SMIOpShift), + SMIOpRead = (0 << SMIOpShift), + SMIReq = 0x00000010, + SMI_MDIO = 0x00000008, + SMI_MDDIR = 0x00000004, + SMI_MDC = 0x00000002, + SMI_MDEN = 0x00000001 +}; + + +// transmit descriptor command bits +enum TxDescriptorCommandStatus { + TDC_TXOWN = 0x80000000U, // own bit + TDC_TXINT = 0x40000000U, + TDC_THOL3 = 0x30000000U, + TDC_THOL2 = 0x20000000U, + TDC_THOL1 = 0x10000000U, + TDC_THOL0 = 0x00000000U, + TDC_LSEN = 0x08000000U, + TDC_IPCS = 0x04000000U, + TDC_TCPCS = 0x02000000U, + TDC_UDPCS = 0x01000000U, + TDC_BSTEN = 0x00800000U, + TDC_EXTEN = 0x00400000U, + TDC_DEFEN = 0x00200000U, + TDC_BKFEN = 0x00100000U, + TDC_CRSEN = 0x00080000U, + TDC_COLSEN = 0x00040000U, + TDC_CRCEN = 0x00020000U, + TDC_PADEN = 0x00010000U, + // following bits are set/filled by hardware? + TDS_OWC = 0x00080000U, + TDS_ABT = 0x00040000U, + TDS_FIFO = 0x00020000U, + TDS_CRS = 0x00010000U, + TDS_COLLS = 0x0000ffffU +}; + + +const uint32 txErrorStatusBits = TDS_OWC | TDS_ABT | TDS_FIFO | TDS_CRS; +const uint32 TxDescriptorEOD = 0x80000000U; +const uint32 TxDescriptorSize = 0x0000ffffU; + + +struct TxDescriptor { + uint32 fPacketSize; + uint32 fCommandStatus; + uint32 fBufferPointer; + uint32 fEOD; + + void Init(phys_addr_t bufferPointer, bool bEOD) volatile { + fPacketSize = 0; + fCommandStatus = 0; + fBufferPointer = (uint32)bufferPointer; + fEOD = bEOD ? TxDescriptorEOD : 0; + } +}; + + +// receive descriptor information bits +enum RxDescriptorInformation { + RDI_RXOWN = 0x80000000U, + RDI_RXINT = 0x40000000U, + RDI_IPON = 0x20000000U, + RDI_TCPON = 0x10000000U, + RDI_UDPON = 0x08000000U, + RDI_WAKUP = 0x00400000U, + RDI_MAGIC = 0x00200000U, + RDI_PAUSE = 0x00100000U, + RDI_CAST = 0x000c0000U, + RDI_CAST_SHIFT = 18, + RDI_BCAST = ( 3U << RDI_CAST_SHIFT ), + RDI_MCAST = ( 2U << RDI_CAST_SHIFT ), + RDI_UCAST = ( 1U << RDI_CAST_SHIFT ), + RDI_CRCOFF = 0x00020000U, + RDI_PREADD = 0x00010000U +}; + + +// receive descriptor status bits +enum RxDescriptorStatus { + RDS_TAGON = 0x80000000U, + RDS_DESCS = 0x3f000000U, + RDS_DESCS_SHIFT = 24, + RDS_ABORT = 0x00800000U, + RDS_SHORT = 0x00400000U, + RDS_LIMIT = 0x00200000U, + RDS_MIIER = 0x00100000U, + RDS_OVRUN = 0x00080000U, + RDS_NIBON = 0x00040000U, + RDS_COLON = 0x00020000U, + RDS_CRCOK = 0x00010000U, + RDS_SIZE = 0x0000ffffU +}; + + +const uint32 rxErrorStatusBits = RDS_ABORT | RDS_SHORT | RDS_LIMIT + | RDS_MIIER | RDS_OVRUN | RDS_NIBON | RDS_COLON; +const uint32 RxDescriptorEOD = 0x80000000U; +const uint32 BufferSize = 1536; + +struct RxDescriptor { + uint32 fStatusSize; + uint32 fPacketInfo; + uint32 fBufferPointer; + uint32 fEOD; + + void Init(phys_addr_t bufferPointer, bool isEOD) volatile { + fStatusSize = 0; + fPacketInfo = RDI_RXOWN | RDI_RXINT; + fBufferPointer =(uint32) bufferPointer; + fEOD = isEOD ? RxDescriptorEOD : 0; + fEOD |= (BufferSize & 0x0000fff8); + } +}; + + +// RxMACControl bits +enum RxMACControlBits { + RXM_Broadcast = 0x0800U, + RXM_Multicast = 0x0400U, + RXM_Physical = 0x0200U, + RXM_AllPhysical = 0x0100U, + + RXM_Mask = RXM_Broadcast | RXM_Multicast + | RXM_Physical | RXM_AllPhysical +}; + +#endif // _SiS19X_REGISTERS_H_ + diff --git a/src/add-ons/kernel/drivers/network/sis19x/Settings.cpp b/src/add-ons/kernel/drivers/network/sis19x/Settings.cpp new file mode 100644 index 0000000000..78413a2920 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/Settings.cpp @@ -0,0 +1,207 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ + + +#include "Settings.h" + +#include +#include +#include + +#include // for mutex + + +bool gTraceOn = false; +bool gTruncateLogFile = false; +bool gTraceFlow = false; +bool gAddTimeStamp = true; +static char *gLogFilePath = NULL; + +mutex gLogLock; + + +// +// Logging, tracing and settings +// + +static +void create_log() +{ + if (gLogFilePath == NULL) + return; + + int flags = O_WRONLY | O_CREAT | ((gTruncateLogFile) ? O_TRUNC : 0); + close(open(gLogFilePath, flags, 0666)); + + mutex_init(&gLogLock, DRIVER_NAME"-logging"); +} + + +void load_settings() +{ + void *handle = load_driver_settings(DRIVER_NAME); + if (handle == 0) + return; + + gTraceOn = get_driver_boolean_parameter( + handle, "trace", gTraceOn, true); + + gTruncateLogFile = get_driver_boolean_parameter( + handle, "truncate_logfile", gTruncateLogFile, true); + + gTraceFlow = get_driver_boolean_parameter( + handle, "trace_flow", gTraceFlow, true); + + gAddTimeStamp = get_driver_boolean_parameter( + handle, "add_timestamp", gAddTimeStamp, true); + + const char * logFilePath = get_driver_parameter( + handle, "logfile", NULL, "/var/log/"DRIVER_NAME".log"); + if (logFilePath != NULL) { + gLogFilePath = strdup(logFilePath); + } + + unload_driver_settings(handle); + + create_log(); +} + + +void release_settings() +{ + if (gLogFilePath != NULL) { + mutex_destroy(&gLogLock); + free(gLogFilePath); + } +} + + +void SiS19X_trace(bool force, const char* func, const char *fmt, ...) +{ + if (!(force || gTraceOn)) { + return; + } + + va_list arg_list; + static const char *prefix = DRIVER_NAME":"; + static char buffer[1024]; + char *buf_ptr = buffer; + if (gLogFilePath == NULL) { + strcpy(buffer, prefix); + buf_ptr += strlen(prefix); + } + + if (gAddTimeStamp) { + bigtime_t time = system_time(); + uint32 msec = time / 1000; + uint32 sec = msec / 1000; + sprintf(buf_ptr, "%02ld.%02ld.%03ld:", + sec / 60, sec % 60, msec % 1000); + buf_ptr += strlen(buf_ptr); + } + + if (func != NULL) { + sprintf(buf_ptr, "%s::", func); + buf_ptr += strlen(buf_ptr); + } + + va_start(arg_list, fmt); + vsprintf(buf_ptr, fmt, arg_list); + va_end(arg_list); + + if (gLogFilePath == NULL) { + dprintf(buffer); + return; + } + + mutex_lock(&gLogLock); + int fd = open(gLogFilePath, O_WRONLY | O_APPEND); + write(fd, buffer, strlen(buffer)); + close(fd); + mutex_unlock(&gLogLock); +} + + +// +// Rx/Tx traffic statistic harvesting +// + +Statistics::Statistics() +{ + memset(this, 0, sizeof(Statistics)); +} + + +void +Statistics::PutStatus(uint32 status) +{ + fInterrupts++; + if (status & (INT_TXDONE /*| INT_TXIDLE*/)) fTxInterrupts++; + if (status & (INT_RXDONE /*| INT_RXIDLE*/)) fRxInterrupts++; + + if (status & INT_TXHALT) fTxHalt++; + if (status & INT_RXHALT) fRxHalt++; + if (status & INT_TXDONE) fTxDone++; + if (status & INT_TXIDLE) fTxIdle++; + if (status & INT_RXDONE) fRxDone++; + if (status & INT_RXIDLE) fRxIdle++; + if (status & INT_LINK) fLink++; + if (status & INT_WAKEF) fWakeUp++; + if (status & INT_MAGICP) fMagic++; + if (status & INT_PAUSEF) fPause++; + if (status & INT_TIMER) fTimer++; + if (status & INT_SOFT) fSoft++; +} + + +void +Statistics::PutTxStatus(uint32 status, uint32 size) +{ + if (status & TDS_CRS) fCarrier++; + if (status & TDS_FIFO) fFIFO++; + if (status & TDS_ABT) fTxAbort++; + if (status & TDS_OWC) fWindow++; + if ((status & txErrorStatusBits) == 0) { + fCollisions += (status & TDS_COLLS) - 1; + fTransmitted += (size & TxDescriptorSize); + } +} + + +void +Statistics::PutRxStatus(uint32 status) +{ + if (!(status & RDS_CRCOK)) fCRC++; + if (status & RDS_COLON) fColon++; + if (status & RDS_NIBON) fNibon++; + if (status & RDS_OVRUN) fOverrun++; + if (status & RDS_MIIER) fMIIError++; + if (status & RDS_LIMIT) fLimit++; + if (status & RDS_SHORT) fShort++; + if (status & RDS_ABORT) fRxAbort++; + if ((status & rxErrorStatusBits) == 0) { + fReceived += (status & RDS_SIZE) - 4; // exclude CRC? + } +} + + +void Statistics::Trace() +{ + TRACE("Ints:%d;Lnk:%d;WkUps:%d;Mgic:%d;Pause:%d;Tmr:%d;Sft:%d\n", + fInterrupts, fLink, fWakeUp, fMagic, fPause, fTimer, fSoft); + + TRACE("TX:Ints:%d;Bts:%llu;Drop:%d;Hlts:%d;Done:%d;Idle:%d;" + "Colls:%d;Carr:%d;FIFO:%d;Abrt:%d;Wndw:%d;\n", + fTxInterrupts, fTransmitted, fDropped, fTxHalt, fTxDone, + fTxIdle, fCollisions, fCarrier, fFIFO, fTxAbort, fWindow); + + TRACE("RX:Ints:%d;Bts:%llu;Hlts:%d;Done:%d;Idle:%d;CRC:%d;Cln:%d;" + "Nibon:%d;Ovrrn:%d;MIIErr:%d;Lmt:%d;Shrt:%d;Abrt:%d\n", + fRxInterrupts, fReceived, fRxHalt, fRxDone, fRxIdle, fCRC, fColon, + fNibon, fOverrun, fMIIError, fLimit, fShort, fRxAbort); +} + diff --git a/src/add-ons/kernel/drivers/network/sis19x/Settings.h b/src/add-ons/kernel/drivers/network/sis19x/Settings.h new file mode 100644 index 0000000000..6afc96bf6c --- /dev/null +++ b/src/add-ons/kernel/drivers/network/sis19x/Settings.h @@ -0,0 +1,92 @@ +/* + * SiS 190/191 NIC Driver. + * Copyright (c) 2009 S.Zharski + * Distributed under the terms of the MIT license. + * + */ +#ifndef _SiS19X_SETTINGS_H_ +#define _SiS19X_SETTINGS_H_ + + +#include + +#include "Driver.h" +#include "Registers.h" + + +#ifdef _countof +#warning "_countof(...) WAS ALREADY DEFINED!!! Remove local definition!" +#undef _countof +#endif +#define _countof(array)(sizeof(array) / sizeof(array[0])) + + +void load_settings(); +void release_settings(); + + +void SiS19X_trace(bool force, const char *func, const char *fmt, ...); + +#undef TRACE + +#define TRACE(x...) SiS19X_trace(false, __func__, x) +#define TRACE_ALWAYS(x...) SiS19X_trace(true, __func__, x) + +extern bool gTraceFlow; +#define TRACE_FLOW(x...) SiS19X_trace(gTraceFlow, NULL, x) + +#define TRACE_RET(result) SiS19X_trace(false, __func__, \ + "Returns:%#010x\n", result); + + +#define STATISTICS 1 + +struct Statistics { + Statistics(); + + void PutStatus(uint32 status); + void PutTxStatus(uint32 status, uint32 size); + void PutRxStatus(uint32 status); + void Trace(); + + + // shared + uint32 fInterrupts; + uint32 fLink; + uint32 fWakeUp; + uint32 fMagic; + uint32 fPause; + uint32 fTimer; + uint32 fSoft; + // transmit + uint32 fTxInterrupts; + uint32 fTxHalt; + uint32 fTxDone; + uint32 fTxIdle; + uint32 fCollisions; + uint32 fCarrier; + uint32 fFIFO; + uint32 fTxAbort; + uint32 fWindow; + uint32 fDropped; + uint64 fTransmitted; + + // receive + uint32 fRxInterrupts; + uint32 fRxHalt; + uint32 fRxDone; + uint32 fRxIdle; + uint32 fCRC; + uint32 fColon; + uint32 fNibon; + uint32 fOverrun; + uint32 fMIIError; + uint32 fLimit; + uint32 fShort; + uint32 fRxAbort; + uint64 fReceived; +}; + + +#endif /*_SiS19X_SETTINGS_H_*/ + From 44db4996ae3b596532684e63d3d5abc948cf45e5 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 11 Oct 2011 17:39:43 +0000 Subject: [PATCH 362/702] * better tracing of modeline sanitization for #8001 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42823 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../common/validate_display_mode.cpp | 63 ++++++++++++++++--- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/src/add-ons/accelerants/common/validate_display_mode.cpp b/src/add-ons/accelerants/common/validate_display_mode.cpp index 645660dade..8109b4b1aa 100644 --- a/src/add-ons/accelerants/common/validate_display_mode.cpp +++ b/src/add-ons/accelerants/common/validate_display_mode.cpp @@ -9,6 +9,20 @@ #include +//#define TRACE_VALIDATION +#ifdef TRACE_VALIDATION +#ifdef __cplusplus +extern "C" +#endif +void _sPrintf(const char *format, ...); +# define TRACE(x...) _sPrintf("accelerant common: " x) +#else +# define TRACE(x...) ; +#endif + +#define ERROR(x...) _sPrintf("accelerant common: " x) + + static uint16 round(uint16 value, uint16 resolution) { @@ -20,21 +34,42 @@ static void sanitize_timing(uint16& display, uint16& syncStart, uint16& syncEnd, uint16& total, const timing_constraints& constraints) { - if (syncStart < display + constraints.min_before_sync) + if (syncStart < display + constraints.min_before_sync) { + TRACE("%s: syncStart(%" B_PRIu16 ") < display(%" B_PRIu16 ")" + " + min_before_sync(%" B_PRIu16 ")\n", __func__, syncStart, + display, constraints.min_before_sync); syncStart = display + constraints.min_before_sync; - else if (syncStart > constraints.max_sync_start) + } else if (syncStart > constraints.max_sync_start) { + TRACE("%s: syncStart(%" B_PRIu16 ") > max_sync_start(%" B_PRIu16 ")\n", + __func__, syncStart, constraints.max_sync_start); syncStart = constraints.max_sync_start; + } uint32 syncLength = syncEnd - syncStart; - if (syncLength < constraints.min_sync_length) + if (syncLength < constraints.min_sync_length) { + TRACE("%s: syncLength(%" B_PRIu16 ")" + " < min_sync_length(%" B_PRIu16 ")\n", + __func__, syncLength, constraints.min_sync_length); syncLength = constraints.min_sync_length; - else if (syncLength > constraints.max_sync_length) + } else if (syncLength > constraints.max_sync_length) { + TRACE("%s: syncLength(%" B_PRIu16 ")" + " > max_sync_length(%" B_PRIu16 ")\n", + __func__, syncLength, constraints.max_sync_length); syncLength = constraints.max_sync_length; + } - if (total < syncStart + syncLength + constraints.min_after_sync) + if (total < syncStart + syncLength + constraints.min_after_sync) { + TRACE("%s: total(%" B_PRIu16 ")" + " < syncStart(%" B_PRIu16 ")" + " + syncLength(%" B_PRIu16 ")" + " + min_after_sync(%" B_PRIu16 ")\n", + __func__, total, syncStart, syncLength, constraints.min_after_sync); total = syncStart + syncLength + constraints.min_after_sync; + } if (total > constraints.max_total) { + TRACE("%s: total(%" B_PRIu16 ") > max_total(%" B_PRIu16 ")\n" + __func__, total, constraints.max_total); total = constraints.max_total; syncLength = min_c(syncLength, uint16(total - syncStart)); } @@ -57,15 +92,25 @@ sanitize_display_mode(display_mode& mode, // size - if (mode.timing.h_display < constraints.min_h_display) + if (mode.timing.h_display < constraints.min_h_display) { + TRACE("%s: h_display(%" B_PRIu16 ") < min_h_display(%" B_PRIu16 ")\n", + __func__, mode.timing.h_display, constraints.min_h_display); mode.timing.h_display = constraints.min_h_display; - else if (mode.timing.h_display > constraints.max_h_display) + } else if (mode.timing.h_display > constraints.max_h_display) { + TRACE("%s: h_display(%" B_PRIu16 ") > max_h_display(%" B_PRIu16 ")\n", + __func__, mode.timing.h_display, constraints.max_h_display); mode.timing.h_display = constraints.max_h_display; + } - if (mode.timing.v_display < constraints.min_v_display) + if (mode.timing.v_display < constraints.min_v_display) { + TRACE("%s: v_display(%" B_PRIu16 ") < min_v_display(%" B_PRIu16 ")\n", + __func__, mode.timing.v_display, constraints.min_v_display); mode.timing.v_display = constraints.min_v_display; - else if (mode.timing.v_display > constraints.max_v_display) + } else if (mode.timing.v_display > constraints.max_v_display) { + TRACE("%s: v_display(%" B_PRIu16 ") > max_v_display(%" B_PRIu16 ")\n", + __func__, mode.timing.v_display, constraints.max_v_display); mode.timing.v_display = constraints.max_v_display; + } // horizontal timing From 7c7c2f12c163f3417d017c41847273a3e62c45bf Mon Sep 17 00:00:00 2001 From: Joseph Prostko Date: Tue, 11 Oct 2011 18:10:20 +0000 Subject: [PATCH 363/702] * Fix build due to missing comma in r42823 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42824 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/validate_display_mode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/accelerants/common/validate_display_mode.cpp b/src/add-ons/accelerants/common/validate_display_mode.cpp index 8109b4b1aa..0f03daa909 100644 --- a/src/add-ons/accelerants/common/validate_display_mode.cpp +++ b/src/add-ons/accelerants/common/validate_display_mode.cpp @@ -9,7 +9,7 @@ #include -//#define TRACE_VALIDATION +#define TRACE_VALIDATION #ifdef TRACE_VALIDATION #ifdef __cplusplus extern "C" @@ -68,7 +68,7 @@ sanitize_timing(uint16& display, uint16& syncStart, uint16& syncEnd, } if (total > constraints.max_total) { - TRACE("%s: total(%" B_PRIu16 ") > max_total(%" B_PRIu16 ")\n" + TRACE("%s: total(%" B_PRIu16 ") > max_total(%" B_PRIu16 ")\n", __func__, total, constraints.max_total); total = constraints.max_total; syncLength = min_c(syncLength, uint16(total - syncStart)); From 44316103885b06fe8234326f3b29cea05f40b4ce Mon Sep 17 00:00:00 2001 From: Joseph Prostko Date: Tue, 11 Oct 2011 18:13:36 +0000 Subject: [PATCH 364/702] * Commenting out tracing, as before. Sorry about re-enabling it accidentally. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42825 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/common/validate_display_mode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/common/validate_display_mode.cpp b/src/add-ons/accelerants/common/validate_display_mode.cpp index 0f03daa909..df3a2cb1f3 100644 --- a/src/add-ons/accelerants/common/validate_display_mode.cpp +++ b/src/add-ons/accelerants/common/validate_display_mode.cpp @@ -9,7 +9,7 @@ #include -#define TRACE_VALIDATION +//#define TRACE_VALIDATION #ifdef TRACE_VALIDATION #ifdef __cplusplus extern "C" From e7d0abae231f1fcd3fefc6bc963793c5d6756118 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 11 Oct 2011 22:23:31 +0000 Subject: [PATCH 365/702] * move pll info into pll_info struct. * reduce the number of unique storage uint32's git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42826 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 35 ----- src/add-ons/accelerants/radeon_hd/mode.cpp | 4 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 132 ++++++++---------- src/add-ons/accelerants/radeon_hd/pll.h | 52 ++++++- 4 files changed, 112 insertions(+), 111 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index ed33fed80c..9702e7562b 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -101,41 +101,6 @@ struct register_info { }; -struct pll_info { - /* reference frequency */ - uint32 reference_freq; - - /* fixed dividers */ - uint32 reference_div; - uint32 post_div; - - /* pll in/out limits */ - uint32 pll_in_min; - uint32 pll_in_max; - uint32 pll_out_min; - uint32 pll_out_max; - uint32 lcd_pll_out_min; - uint32 lcd_pll_out_max; - uint32 best_vco; - - /* divider limits */ - uint32 min_ref_div; - uint32 max_ref_div; - uint32 min_post_div; - uint32 max_post_div; - uint32 min_feedback_div; - uint32 max_feedback_div; - uint32 min_frac_feedback_div; - uint32 max_frac_feedback_div; - - /* flags for the current clock */ - uint32 flags; - - /* pll id */ - uint32 id; -}; - - typedef struct { bool valid; diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 39226911ea..3b7607c04b 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -156,8 +156,8 @@ radeon_set_display_mode(display_mode *mode) // *** CRT controler mode set // TODO : program SS - pll_set(0, mode->timing.pixel_clock, id); - // TODO : check if pll 0 is used and use pll 1 if so + pll_set(ATOM_PPLL1, mode->timing.pixel_clock, id); + // TODO : check if ATOM_PPLL1 is used and use ATOM_PPLL2 if so display_crtc_set_dtd(id, mode); // TODO : vvvv : atombios_crtc_set_base diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 9ef4c7ac82..9db7771e95 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -6,7 +6,6 @@ * Alexander von Gluck, kallisti5@unixzen.com */ - #include "accelerant_protos.h" #include "accelerant.h" #include "bios.h" @@ -82,14 +81,13 @@ pll_compute_post_divider(uint32 targetClock) status_t -pll_compute(uint32 pixelClock, uint32 *dotclockOut, uint32 *referenceOut, - uint32 *feedbackOut, uint32 *feedbackFracOut, uint32 *postOut) -{ - uint32 targetClock = pixelClock / 10; - uint32 postDivider = pll_compute_post_divider(targetClock); - uint32 referenceDivider = REF_DIV_MIN; - uint32 feedbackDivider = 0; - uint32 feedbackDividerFrac = 0; +pll_compute(pll_info *pll) { + + uint32 targetClock = pll->pixel_clock / 10; + pll->post_div = pll_compute_post_divider(targetClock); + pll->reference_div = REF_DIV_MIN; + pll->feedback_div = 0; + pll->feedback_div_frac = 0; // if RADEON_PLL_USE_REF_DIV // ref_div = pll->reference_div; @@ -108,61 +106,58 @@ pll_compute(uint32 pixelClock, uint32 *dotclockOut, uint32 *referenceOut, // frac_fb_div = 0; // } // } else { - while (referenceDivider <= REF_DIV_LIMIT) { + while (pll->reference_div <= REF_DIV_LIMIT) { // get feedback divider - uint32 retroEncabulator = postDivider * referenceDivider; + uint32 retroEncabulator = pll->post_div * pll->reference_div; retroEncabulator *= targetClock; - feedbackDivider = retroEncabulator / PLL_REFERENCE_DEFAULT; - feedbackDividerFrac = retroEncabulator % PLL_REFERENCE_DEFAULT; + pll->feedback_div = retroEncabulator / PLL_REFERENCE_DEFAULT; + pll->feedback_div_frac = retroEncabulator % PLL_REFERENCE_DEFAULT; - if (feedbackDivider > FB_DIV_LIMIT) - feedbackDivider = FB_DIV_LIMIT; - else if (feedbackDivider < FB_DIV_MIN) - feedbackDivider = FB_DIV_MIN; + if (pll->feedback_div > FB_DIV_LIMIT) + pll->feedback_div = FB_DIV_LIMIT; + else if (pll->feedback_div < FB_DIV_MIN) + pll->feedback_div = FB_DIV_MIN; - if (feedbackDividerFrac >= (PLL_REFERENCE_DEFAULT / 2)) - feedbackDivider++; + if (pll->feedback_div_frac >= (PLL_REFERENCE_DEFAULT / 2)) + pll->feedback_div++; - feedbackDividerFrac = 0; - if (referenceDivider == 0 || postDivider == 0 || targetClock == 0) { - TRACE("%s: Caught division by zero\n", - __func__); + pll->feedback_div_frac = 0; + if (pll->reference_div == 0 + || pll->post_div == 0 + || targetClock == 0) { + TRACE("%s: Caught division by zero\n", __func__); return B_ERROR; } - uint32 tmp = (PLL_REFERENCE_DEFAULT * feedbackDivider) - / (postDivider * referenceDivider); + uint32 tmp = (PLL_REFERENCE_DEFAULT * pll->feedback_div) + / (pll->post_div * pll->reference_div); tmp = (tmp * 10000) / targetClock; if (tmp > (10000 + MAX_TOLERANCE)) - referenceDivider++; + pll->reference_div++; else if (tmp >= (10000 - MAX_TOLERANCE)) break; else - referenceDivider++; + pll->reference_div++; } // } - if (referenceDivider == 0 || postDivider == 0) { + if (pll->reference_div == 0 || pll->post_div == 0) { TRACE("%s: Caught division by zero of post or reference divider\n", __func__); return B_ERROR; } - *dotclockOut = ((PLL_REFERENCE_DEFAULT * feedbackDivider * 10) - + (PLL_REFERENCE_DEFAULT * feedbackDividerFrac)) - / (referenceDivider * postDivider * 10); - - *feedbackOut = feedbackDivider; - *feedbackFracOut = feedbackDividerFrac; - *referenceOut = referenceDivider; - *postOut = postDivider; + pll->dot_clock = ((PLL_REFERENCE_DEFAULT * pll->feedback_div * 10) + + (PLL_REFERENCE_DEFAULT * pll->feedback_div_frac)) + / (pll->reference_div * pll->post_div * 10); TRACE("%s: pixel clock: %" B_PRIu32 " gives:" " feedbackDivider = %" B_PRIu32 ".%" B_PRIu32 "; referenceDivider = %" B_PRIu32 "; postDivider = %" B_PRIu32 - "; dotClock = %" B_PRIu32 "\n", __func__, pixelClock, feedbackDivider, - feedbackDividerFrac, referenceDivider, postDivider, *dotclockOut); + "; dotClock = %" B_PRIu32 "\n", __func__, pll->pixel_clock, + pll->feedback_div, pll->feedback_div_frac, pll->reference_div, + pll->post_div, pll->dot_clock); return B_OK; } @@ -175,19 +170,19 @@ union adjust_pixel_clock { uint32 -pll_adjust(uint32 pixelClock, uint8 crtc_id) +pll_adjust(pll_info *pll, uint8 crtc_id) { - uint32 flags = 0; - flags |= PLL_PREFER_LOW_REF_DIV; + pll->flags |= PLL_PREFER_LOW_REF_DIV; + // TODO : PLL flags radeon_shared_info &info = *gInfo->shared_info; - uint32 adjustedClock = pixelClock; + uint32 pixelClock = pll->pixel_clock; + uint32 adjustedClock = pll->pixel_clock; uint32 connector_index = gDisplay[crtc_id]->connector_index; uint32 encoder_id = gConnector[connector_index]->encoder.object_id; uint32 encoder_mode = display_get_encoder_mode(connector_index); - pll_info *pll = &gConnector[connector_index]->encoder.pll; if (info.device_chipset >= (RADEON_R600 | 0x20)) { union adjust_pixel_clock args; @@ -269,16 +264,15 @@ pll_adjust(uint32 pixelClock, uint8 crtc_id) status_t pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) { - uint32 dotclock = 0; - uint32 reference = 0; - uint32 feedback = 0; - uint32 feedbackFrac = 0; - uint32 post = 0; + uint32 connector_index = gDisplay[crtc_id]->connector_index; + pll_info *pll = &gConnector[connector_index]->encoder.pll; + pll->pixel_clock = pixelClock; + pll->id = pll_id; - uint32 adjustedClock = pll_adjust(pixelClock, crtc_id); + // get any needed clock adjustments, set reference/post dividers, set flags + uint32 adjustedClock = pll_adjust(pll, crtc_id); - pll_compute(adjustedClock, &dotclock, &reference, &feedback, - &feedbackFrac, &post); + pll_compute(pll); int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); union set_pixel_clock args; @@ -288,37 +282,35 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) uint8 crev; atom_parse_cmd_header(gAtomContext, index, &frev, &crev); - uint32 connector_index = gDisplay[crtc_id]->connector_index; - switch (crev) { case 1: args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); - args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); - args.v1.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); - args.v1.ucFracFbDiv = feedbackFrac; - args.v1.ucPostDiv = post; - args.v1.ucPpll = pll_id; + args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); + args.v1.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); + args.v1.ucFracFbDiv = pll->feedback_div_frac; + args.v1.ucPostDiv = pll->post_div; + args.v1.ucPpll = pll->id; args.v1.ucCRTC = crtc_id; args.v1.ucRefDivSrc = 1; break; case 2: args.v2.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); - args.v2.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); - args.v2.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); - args.v2.ucFracFbDiv = feedbackFrac; - args.v2.ucPostDiv = post; - args.v2.ucPpll = pll_id; + args.v2.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); + args.v2.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); + args.v2.ucFracFbDiv = pll->feedback_div_frac; + args.v2.ucPostDiv = pll->post_div; + args.v2.ucPpll = pll->id; args.v2.ucCRTC = crtc_id; args.v2.ucRefDivSrc = 1; break; case 3: args.v3.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); - args.v3.usRefDiv = B_HOST_TO_LENDIAN_INT16(reference); - args.v3.usFbDiv = B_HOST_TO_LENDIAN_INT16(feedback); - args.v3.ucFracFbDiv = feedbackFrac; - args.v3.ucPostDiv = post; - args.v3.ucPpll = pll_id; - args.v3.ucMiscInfo = (pll_id << 2); + args.v3.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); + args.v3.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); + args.v3.ucFracFbDiv = pll->feedback_div_frac; + args.v3.ucPostDiv = pll->post_div; + args.v3.ucPpll = pll->id; + args.v3.ucMiscInfo = (pll->id << 2); // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; args.v3.ucTransmitterId @@ -332,7 +324,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) } TRACE("%s: set adjusted pixel clock %" B_PRIu32 " (was %" B_PRIu32 ")\n", - __func__, adjustedClock, pixelClock); + __func__, adjustedClock, pll->pixel_clock); return atom_execute_table(gAtomContext, index, (uint32 *)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index dcf4736d9f..3c0b7ff11e 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -9,6 +9,9 @@ #define RADEON_HD_PLL_H +#include "accelerant.h" + + #define MAX_TOLERANCE 10 #define PLL_MIN_DEFAULT 16000 @@ -41,10 +44,51 @@ #define PLL_PREFER_MINM_OVER_MAXP (1 << 14) -uint32 pll_adjust(uint32 pixelClock, uint8 crtc_id); -status_t pll_compute(uint32 pixelClock, uint32 *dotclockOut, - uint32 *referenceOut, uint32 *feedbackOut, uint32 *feedbackFracOut, - uint32 *postOut); +struct pll_info { + /* pixel clock to be programmed (kHz)*/ + uint32 pixel_clock; + + /* dot clock (kHz) */ + uint32 dot_clock; + + /* flags for the current clock */ + uint32 flags; + + /* pll id */ + uint32 id; + + /* reference frequency */ + uint32 reference_freq; + + /* fixed dividers */ + uint32 post_div; + uint32 reference_div; + uint32 feedback_div; + uint32 feedback_div_frac; + + /* pll in/out limits */ + uint32 pll_in_min; + uint32 pll_in_max; + uint32 pll_out_min; + uint32 pll_out_max; + uint32 lcd_pll_out_min; + uint32 lcd_pll_out_max; + uint32 best_vco; + + /* divider limits */ + uint32 min_ref_div; + uint32 max_ref_div; + uint32 min_post_div; + uint32 max_post_div; + uint32 min_feedback_div; + uint32 max_feedback_div; + uint32 min_frac_feedback_div; + uint32 max_frac_feedback_div; +}; + + +uint32 pll_adjust(pll_info *pll, uint8 crtc_id); +status_t pll_compute(pll_info *pll); status_t pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id); From 14493b1ecb3a2f1f6575d83d38f11cc95e7c1810 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 11 Oct 2011 22:32:45 +0000 Subject: [PATCH 366/702] * quick style fix before I forget, no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42827 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/pll.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 9db7771e95..ab851eefec 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -6,6 +6,7 @@ * Alexander von Gluck, kallisti5@unixzen.com */ + #include "accelerant_protos.h" #include "accelerant.h" #include "bios.h" From 042bdcc0d24430a5af2dcda23e5439bd623926b7 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 12 Oct 2011 17:24:15 +0000 Subject: [PATCH 367/702] * complete pll_set for all AtomBIOS revisions * add update of crtc encoder scratch registers * rename id for more descriptive crtc_id * encoder dpms, BL on/off on lcd git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42828 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/encoder.cpp | 83 ++++++++++++++++--- src/add-ons/accelerants/radeon_hd/encoder.h | 1 + src/add-ons/accelerants/radeon_hd/pll.cpp | 63 ++++++++++++++ 3 files changed, 134 insertions(+), 13 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 0ee777b59f..ac7fb7e084 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -37,7 +37,7 @@ union crtc_source_param { void -encoder_assign_crtc(uint8 id) +encoder_assign_crtc(uint8 crtc_id) { int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source); union crtc_source_param args; @@ -50,7 +50,7 @@ encoder_assign_crtc(uint8 id) != B_OK) return; - uint16 connector_index = gDisplay[id]->connector_index; + uint16 connector_index = gDisplay[crtc_id]->connector_index; uint16 encoder_id = gConnector[connector_index]->encoder.object_id; switch (frev) { @@ -58,7 +58,7 @@ encoder_assign_crtc(uint8 id) switch (crev) { case 1: default: - args.v1.ucCRTC = id; + args.v1.ucCRTC = crtc_id; switch (encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: @@ -102,7 +102,7 @@ encoder_assign_crtc(uint8 id) } break; case 2: - args.v2.ucCRTC = id; + args.v2.ucCRTC = crtc_id; args.v2.ucEncodeMode = display_get_encoder_mode(connector_index); switch (encoder_id) { @@ -168,7 +168,8 @@ encoder_assign_crtc(uint8 id) atom_execute_table(gAtomContext, index, (uint32*)&args); - // TODO : encoder_crtc_scratch_regs? + // update crtc encoder scratch register @ scratch 3 + encoder_crtc_scratch(crtc_id); } @@ -365,6 +366,55 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) } +void +encoder_crtc_scratch(uint8 crtc_id) +{ + TRACE("%s\n", __func__); + + uint32 connector_index = gDisplay[crtc_id]->connector_index; + uint32 encoder_flags = gConnector[connector_index]->encoder.flags; + + // TODO : r500 + uint32 bios_3_scratch = Read32(OUT, R600_BIOS_3_SCRATCH); + + if (encoder_flags & ATOM_DEVICE_TV1_SUPPORT) { + bios_3_scratch &= ~ATOM_S3_TV1_CRTC_ACTIVE; + bios_3_scratch |= (crtc_id << 18); + } + if (encoder_flags & ATOM_DEVICE_CV_SUPPORT) { + bios_3_scratch &= ~ATOM_S3_CV_CRTC_ACTIVE; + bios_3_scratch |= (crtc_id << 24); + } + if (encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) { + bios_3_scratch &= ~ATOM_S3_CRT1_CRTC_ACTIVE; + bios_3_scratch |= (crtc_id << 16); + } + if (encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) { + bios_3_scratch &= ~ATOM_S3_CRT2_CRTC_ACTIVE; + bios_3_scratch |= (crtc_id << 20); + } + if (encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) { + bios_3_scratch &= ~ATOM_S3_LCD1_CRTC_ACTIVE; + bios_3_scratch |= (crtc_id << 17); + } + if (encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) { + bios_3_scratch &= ~ATOM_S3_DFP1_CRTC_ACTIVE; + bios_3_scratch |= (crtc_id << 19); + } + if (encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) { + bios_3_scratch &= ~ATOM_S3_DFP2_CRTC_ACTIVE; + bios_3_scratch |= (crtc_id << 23); + } + if (encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) { + bios_3_scratch &= ~ATOM_S3_DFP3_CRTC_ACTIVE; + bios_3_scratch |= (crtc_id << 25); + } + + // TODO : r500 + Write32(OUT, R600_BIOS_3_SCRATCH, bios_3_scratch); +} + + void encoder_dpms_scratch(uint8 crtc_id, bool power) { @@ -448,6 +498,9 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) memset(&args, 0, sizeof(args)); + uint32 connector_index = gDisplay[crtc_id]->connector_index; + uint32 encoder_flags = gConnector[connector_index]->encoder.flags; + switch (encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: @@ -474,10 +527,10 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); break; case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - // TODO : Laptop LCD special cases dpms set - // if ATOM_DEVICE_LCD_SUPPORT, LCD1OutputControl - // else... - index = GetIndexIntoMasterTable(COMMAND, LVTMAOutputControl); + if (encoder_flags & ATOM_DEVICE_LCD_SUPPORT) + index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); + else + index = GetIndexIntoMasterTable(COMMAND, LVTMAOutputControl); break; case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: @@ -503,8 +556,10 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) case B_DPMS_ON: args.ucAction = ATOM_ENABLE; atom_execute_table(gAtomContext, index, (uint32*)&args); - // TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = ATOM_LCD_BLON; - // execute again + if (encoder_flags & ATOM_DEVICE_LCD_SUPPORT) { + args.ucAction = ATOM_LCD_BLON; + atom_execute_table(gAtomContext, index, (uint32*)&args); + } encoder_dpms_scratch(crtc_id, true); break; case B_DPMS_STAND_BY: @@ -512,8 +567,10 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) case B_DPMS_OFF: args.ucAction = ATOM_DISABLE; atom_execute_table(gAtomContext, index, (uint32*)&args); - // TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = ATOM_LCD_BLOFF; - // execute again + if (encoder_flags & ATOM_DEVICE_LCD_SUPPORT) { + args.ucAction = ATOM_LCD_BLOFF; + atom_execute_table(gAtomContext, index, (uint32*)&args); + } encoder_dpms_scratch(crtc_id, false); break; } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index e4011c07b1..093225fb23 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -14,6 +14,7 @@ void encoder_mode_set(uint8 id, uint32 pixelClock); status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command); status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command); void encoder_output_lock(bool lock); +void encoder_crtc_scratch(uint8 crtc_id); void encoder_dpms_scratch(uint8 crtc_id, bool power); void encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode); diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index ab851eefec..1be68ad14b 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -267,12 +267,14 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) { uint32 connector_index = gDisplay[crtc_id]->connector_index; pll_info *pll = &gConnector[connector_index]->encoder.pll; + pll->pixel_clock = pixelClock; pll->id = pll_id; // get any needed clock adjustments, set reference/post dividers, set flags uint32 adjustedClock = pll_adjust(pll, crtc_id); + // compute dividers, set flags pll_compute(pll); int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); @@ -283,6 +285,10 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) uint8 crev; atom_parse_cmd_header(gAtomContext, index, &frev, &crev); + uint32 bpc = 8; + // TODO : BPC == Digital Depth, EDID 1.4+ on digital displays + // isn't in Haiku edid common code? + switch (crev) { case 1: args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); @@ -318,6 +324,63 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) = gConnector[connector_index]->encoder.object_id; args.v3.ucEncoderMode = display_get_encoder_mode(connector_index); break; + case 5: + args.v5.ucCRTC = crtc_id; + args.v5.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); + args.v5.ucRefDiv = pll->reference_div; + args.v5.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); + args.v5.ulFbDivDecFrac + = B_HOST_TO_LENDIAN_INT32(pll->feedback_div_frac * 100000); + args.v5.ucPostDiv = pll->post_div; + args.v5.ucMiscInfo = 0; /* HDMI depth, etc. */ + // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) + // args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_REF_DIV_SRC; + switch (bpc) { + case 8: + default: + args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_HDMI_24BPP; + break; + case 10: + args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_HDMI_30BPP; + break; + } + args.v5.ucTransmitterID + = gConnector[connector_index]->encoder.object_id; + args.v5.ucEncoderMode + = display_get_encoder_mode(connector_index); + args.v5.ucPpll = pll_id; + break; + case 6: + args.v6.ulDispEngClkFreq + = B_HOST_TO_LENDIAN_INT32(crtc_id << 24 | adjustedClock / 10); + args.v6.ucRefDiv = pll->reference_div; + args.v6.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); + args.v6.ulFbDivDecFrac + = B_HOST_TO_LENDIAN_INT32(pll->feedback_div_frac * 100000); + args.v6.ucPostDiv = pll->post_div; + args.v6.ucMiscInfo = 0; /* HDMI depth, etc. */ + // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) + // args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_REF_DIV_SRC; + switch (bpc) { + case 8: + default: + args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_24BPP; + break; + case 10: + args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_30BPP; + break; + case 12: + args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_36BPP; + break; + case 16: + args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_48BPP; + break; + } + args.v6.ucTransmitterID + = gConnector[connector_index]->encoder.object_id; + args.v6.ucEncoderMode = display_get_encoder_mode(connector_index); + args.v6.ucPpll = pll_id; + break; default: TRACE("%s: ERROR: table version %d.%d TODO\n", __func__, frev, crev); From 7934da0f090bc6970fc259eff3f171e27966eeee Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 12 Oct 2011 19:36:47 +0000 Subject: [PATCH 368/702] * add *very* preliminary dpms support we will need to query the card dpms state for each monitor at a later date git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42829 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 3 +++ src/add-ons/accelerants/radeon_hd/accelerant.h | 2 ++ src/add-ons/accelerants/radeon_hd/hooks.cpp | 2 -- src/add-ons/accelerants/radeon_hd/mode.cpp | 18 ++++++++++++++++++ src/add-ons/accelerants/radeon_hd/mode.h | 2 ++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 64a0da7a13..e850c9faea 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -146,6 +146,9 @@ init_common(int device, bool isClone) gInfo->is_clone = isClone; gInfo->device = device; + gInfo->dpms_mode = B_DPMS_ON; + // initial state + // get basic info from driver radeon_get_private_data data; diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 9702e7562b..01ad458e59 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -56,6 +56,8 @@ struct accelerant_info { gpu_mc_info *mc_info; // used for last known mc state + volatile uint32 dpms_mode; // current driver dpms mode + // LVDS panel mode passed from the bios/startup. display_mode lvds_panel_mode; }; diff --git a/src/add-ons/accelerants/radeon_hd/hooks.cpp b/src/add-ons/accelerants/radeon_hd/hooks.cpp index 9be18755a3..5e73ef48ab 100644 --- a/src/add-ons/accelerants/radeon_hd/hooks.cpp +++ b/src/add-ons/accelerants/radeon_hd/hooks.cpp @@ -35,12 +35,10 @@ get_accelerant_hook(uint32 feature, void *data) */ /* DPMS */ - /* case B_DPMS_CAPABILITIES: return (void*)radeon_dpms_capabilities; case B_DPMS_MODE: return (void*)radeon_dpms_mode; - */ case B_SET_DPMS_MODE: return (void*)radeon_dpms_set; diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 3b7607c04b..6763b603f4 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -97,6 +97,23 @@ radeon_get_edid_info(void* info, size_t size, uint32* edid_version) } +uint32 +radeon_dpms_capabilities(void) +{ + // These should be pretty universally supported on Radeon HD cards + return B_DPMS_ON | B_DPMS_STAND_BY | B_DPMS_SUSPEND | B_DPMS_OFF; +} + + +uint32 +radeon_dpms_mode(void) +{ + // TODO : this really isn't a good long-term solution + // we may need to look at the encoder dpms scratch registers + return gInfo->dpms_mode; +} + + void radeon_dpms_set(int mode) { @@ -128,6 +145,7 @@ radeon_dpms_set(int mode) } break; } + gInfo->dpms_mode = mode; } diff --git a/src/add-ons/accelerants/radeon_hd/mode.h b/src/add-ons/accelerants/radeon_hd/mode.h index 215a17c949..2a479d3808 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.h +++ b/src/add-ons/accelerants/radeon_hd/mode.h @@ -29,6 +29,8 @@ status_t create_mode_list(void); bool is_mode_supported(display_mode* mode); status_t is_mode_sane(display_mode *mode); +uint32 radeon_dpms_capabilities(void); +uint32 radeon_dpms_mode(void); void radeon_dpms_set(int mode); From dc223cc5a011d517dd70e3997021ba39fc3d1097 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 12 Oct 2011 20:28:37 +0000 Subject: [PATCH 369/702] * style fix ensure bitwise ands are compared to 0 or non 0 as per Axel git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42830 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/bios.cpp | 6 +-- src/add-ons/accelerants/radeon_hd/display.cpp | 24 ++++----- src/add-ons/accelerants/radeon_hd/encoder.cpp | 52 +++++++++---------- src/add-ons/accelerants/radeon_hd/gpu.cpp | 6 +-- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index b47d8c4a73..6919efe33b 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -73,7 +73,7 @@ radeon_bios_isposted() + EVERGREEN_CRTC0_REGISTER_OFFSET) | Read32(OUT, EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET); - if (reg & EVERGREEN_CRTC_MASTER_EN) + if ((reg & EVERGREEN_CRTC_MASTER_EN) != 0) return true; } else if (info.device_chipset >= RADEON_R1000) { // evergreen or higher @@ -89,13 +89,13 @@ radeon_bios_isposted() + EVERGREEN_CRTC4_REGISTER_OFFSET) | Read32(OUT, EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET); - if (reg & EVERGREEN_CRTC_MASTER_EN) + if ((reg & EVERGREEN_CRTC_MASTER_EN) != 0) return true; } else if (info.device_chipset > RADEON_R580) { // avivio through r700 reg = Read32(OUT, AVIVO_D1CRTC_CONTROL) | Read32(OUT, AVIVO_D2CRTC_CONTROL); - if (reg & AVIVO_CRTC_EN) { + if ((reg & AVIVO_CRTC_EN) != 0) { return true; } } diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index b991326c59..2aa0576d94 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -260,7 +260,7 @@ detect_connectors_legacy() gConnector[i]->valid = false; // check if this connector is used - if (!(device_support & (1 << i))) + if ((device_support & (1 << i)) == 0) continue; if (i == ATOM_DEVICE_CV_INDEX) { @@ -386,7 +386,7 @@ detect_connectors() uint16 connector_object_id; uint16 connector_flags = B_LENDIAN_TO_HOST_INT16(path->usDeviceTag); - if (device_support & connector_flags) { + if ((device_support & connector_flags) != 0) { uint8 con_obj_id = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; @@ -472,8 +472,8 @@ detect_connectors() case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if (connector_flags - & ATOM_DEVICE_LCD_SUPPORT) { + if ((connector_flags + & ATOM_DEVICE_LCD_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_LVDS; // radeon_atombios_get_lvds_info } else { @@ -496,11 +496,11 @@ detect_connectors() case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: - if (connector_flags - & ATOM_DEVICE_LCD_SUPPORT) { + if ((connector_flags + & ATOM_DEVICE_LCD_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_LVDS; - } else if (connector_flags - & ATOM_DEVICE_CRT_SUPPORT) { + } else if ((connector_flags + & ATOM_DEVICE_CRT_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_DAC; } else { encoder_type = VIDEO_ENCODER_TMDS; @@ -516,11 +516,11 @@ detect_connectors() case ENCODER_OBJECT_ID_HDMI_SI1930: case ENCODER_OBJECT_ID_TRAVIS: case ENCODER_OBJECT_ID_NUTMEG: - if (connector_flags - & ATOM_DEVICE_LCD_SUPPORT) { + if ((connector_flags + & ATOM_DEVICE_LCD_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_LVDS; - } else if (connector_flags - & ATOM_DEVICE_CRT_SUPPORT) { + } else if ((connector_flags + & ATOM_DEVICE_CRT_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_DAC; } else { encoder_type = VIDEO_ENCODER_TMDS; diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index ac7fb7e084..a82d554daf 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -66,8 +66,8 @@ encoder_assign_crtc(uint8 crtc_id) break; case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if (gConnector[connector_index]->flags - & ATOM_DEVICE_LCD1_SUPPORT) + if ((gConnector[connector_index]->flags + & ATOM_DEVICE_LCD1_SUPPORT) != 0) args.v1.ucDevice = ATOM_DEVICE_LCD1_INDEX; else args.v1.ucDevice = ATOM_DEVICE_DFP3_INDEX; @@ -237,7 +237,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) index = GetIndexIntoMasterTable(COMMAND, TMDS1EncoderControl); break; case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if (connector_flags & ATOM_DEVICE_LCD_SUPPORT) + if ((connector_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) index = GetIndexIntoMasterTable(COMMAND, LVDSEncoderControl); else index = GetIndexIntoMasterTable(COMMAND, TMDS2EncoderControl); @@ -260,7 +260,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); - if (connector_flags & (ATOM_DEVICE_LCD_SUPPORT)) { + if ((connector_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) { // TODO : laptop display support //if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) // args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; @@ -290,7 +290,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) args.v2.ucSpatial = 0; args.v2.ucTemporal = 0; args.v2.ucFRC = 0; - if (connector_flags & ATOM_DEVICE_LCD_SUPPORT) { + if ((connector_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) { // TODO : laptop display support //if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) // args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; @@ -377,35 +377,35 @@ encoder_crtc_scratch(uint8 crtc_id) // TODO : r500 uint32 bios_3_scratch = Read32(OUT, R600_BIOS_3_SCRATCH); - if (encoder_flags & ATOM_DEVICE_TV1_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_TV1_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_TV1_CRTC_ACTIVE; bios_3_scratch |= (crtc_id << 18); } - if (encoder_flags & ATOM_DEVICE_CV_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_CV_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_CV_CRTC_ACTIVE; bios_3_scratch |= (crtc_id << 24); } - if (encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_CRT1_CRTC_ACTIVE; bios_3_scratch |= (crtc_id << 16); } - if (encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_CRT2_CRTC_ACTIVE; bios_3_scratch |= (crtc_id << 20); } - if (encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_LCD1_CRTC_ACTIVE; bios_3_scratch |= (crtc_id << 17); } - if (encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_DFP1_CRTC_ACTIVE; bios_3_scratch |= (crtc_id << 19); } - if (encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_DFP2_CRTC_ACTIVE; bios_3_scratch |= (crtc_id << 23); } - if (encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_DFP3_CRTC_ACTIVE; bios_3_scratch |= (crtc_id << 25); } @@ -426,61 +426,61 @@ encoder_dpms_scratch(uint8 crtc_id, bool power) // TODO : r500 uint32 bios_2_scratch = Read32(OUT, R600_BIOS_2_SCRATCH); - if (encoder_flags & ATOM_DEVICE_TV1_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_TV1_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_TV1_DPMS_STATE; else bios_2_scratch |= ATOM_S2_TV1_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_CV_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_CV_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_CV_DPMS_STATE; else bios_2_scratch |= ATOM_S2_CV_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_CRT1_DPMS_STATE; else bios_2_scratch |= ATOM_S2_CRT1_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_CRT2_DPMS_STATE; else bios_2_scratch |= ATOM_S2_CRT2_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_LCD1_DPMS_STATE; else bios_2_scratch |= ATOM_S2_LCD1_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP1_DPMS_STATE; else bios_2_scratch |= ATOM_S2_DFP1_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP2_DPMS_STATE; else bios_2_scratch |= ATOM_S2_DFP2_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP3_DPMS_STATE; else bios_2_scratch |= ATOM_S2_DFP3_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_DFP4_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_DFP4_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP4_DPMS_STATE; else bios_2_scratch |= ATOM_S2_DFP4_DPMS_STATE; } - if (encoder_flags & ATOM_DEVICE_DFP5_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_DFP5_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP5_DPMS_STATE; else @@ -527,7 +527,7 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); break; case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if (encoder_flags & ATOM_DEVICE_LCD_SUPPORT) + if ((encoder_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); else index = GetIndexIntoMasterTable(COMMAND, LVTMAOutputControl); @@ -556,7 +556,7 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) case B_DPMS_ON: args.ucAction = ATOM_ENABLE; atom_execute_table(gAtomContext, index, (uint32*)&args); - if (encoder_flags & ATOM_DEVICE_LCD_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) { args.ucAction = ATOM_LCD_BLON; atom_execute_table(gAtomContext, index, (uint32*)&args); } @@ -567,7 +567,7 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) case B_DPMS_OFF: args.ucAction = ATOM_DISABLE; atom_execute_table(gAtomContext, index, (uint32*)&args); - if (encoder_flags & ATOM_DEVICE_LCD_SUPPORT) { + if ((encoder_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) { args.ucAction = ATOM_LCD_BLOFF; atom_execute_table(gAtomContext, index, (uint32*)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index ca064c9d7f..c0f3ae18a6 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -35,7 +35,7 @@ radeon_gpu_reset() radeon_shared_info &info = *gInfo->shared_info; // Read GRBM Command Processor status - if (!(Read32(OUT, GRBM_STATUS) & GUI_ACTIVE)) + if ((Read32(OUT, GRBM_STATUS) & GUI_ACTIVE) == 0) return B_ERROR; TRACE("%s: GPU software reset in progress...\n", __func__); @@ -95,8 +95,8 @@ radeon_gpu_reset() uint32 tmp; /* Check if any of the rendering block is busy and reset it */ - if ((Read32(OUT, GRBM_STATUS) & grbm_busy_mask) - || (Read32(OUT, GRBM_STATUS2) & grbm2_busy_mask)) { + if ((Read32(OUT, GRBM_STATUS) & grbm_busy_mask) != 0 + || (Read32(OUT, GRBM_STATUS2) & grbm2_busy_mask) != 0) { tmp = SOFT_RESET_CR | SOFT_RESET_DB | SOFT_RESET_CB From 6b0b621be9113080a339054cb3847201e5ed55dd Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 12 Oct 2011 20:45:49 +0000 Subject: [PATCH 370/702] * style fixes, no functional change... automatic crtc_id -> crtcID automatic pll_id -> pllID automatic encoder_id -> encoderID automatic connector_index -> connectorIndex automatic encoder_flags -> encoderFlags git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42831 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 2 +- src/add-ons/accelerants/radeon_hd/display.cpp | 86 ++++++------- src/add-ons/accelerants/radeon_hd/display.h | 18 +-- src/add-ons/accelerants/radeon_hd/encoder.cpp | 116 +++++++++--------- src/add-ons/accelerants/radeon_hd/encoder.h | 6 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 6 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 46 +++---- src/add-ons/accelerants/radeon_hd/pll.h | 4 +- 8 files changed, 142 insertions(+), 142 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 01ad458e59..98184a9c28 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -156,7 +156,7 @@ typedef struct { typedef struct { bool active; - uint32 connector_index; // matches connector id in connector_info + uint32 connectorIndex; // matches connector id in connector_info register_info *regs; bool found_ranges; uint32 vfreq_max; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 2aa0576d94..dbff0c288e 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -370,10 +370,10 @@ detect_connectors() TRACE("%s: found %" B_PRIu8 " potential display paths.\n", __func__, path_obj->ucNumOfDispPath); - uint32 connector_index = 0; + uint32 connectorIndex = 0; for (i = 0; i < path_obj->ucNumOfDispPath; i++) { - if (connector_index >= ATOM_MAX_SUPPORTED_DEVICE) + if (connectorIndex >= ATOM_MAX_SUPPORTED_DEVICE) continue; uint8 *addr = (uint8*)path_obj->asDispPath; @@ -463,11 +463,11 @@ detect_connectors() record = (ATOM_COMMON_RECORD_HEADER *) ((char *)record + record->ucRecordSize); } - uint32 encoder_id = (encoder_obj & OBJECT_ID_MASK) + uint32 encoderID = (encoder_obj & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; uint32 encoder_type = VIDEO_ENCODER_NONE; - switch(encoder_id) { + switch(encoderID) { case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: @@ -541,13 +541,13 @@ detect_connectors() "%s\n", __func__, i, get_encoder_name(encoder_type)); - gConnector[connector_index]->encoder.flags + gConnector[connectorIndex]->encoder.flags = connector_flags; - gConnector[connector_index]->encoder.valid + gConnector[connectorIndex]->encoder.valid = true; - gConnector[connector_index]->encoder.object_id - = encoder_id; - gConnector[connector_index]->encoder.type + gConnector[connectorIndex]->encoder.object_id + = encoderID; + gConnector[connectorIndex]->encoder.type = encoder_type; } } @@ -584,7 +584,7 @@ detect_connectors() = (ATOM_I2C_ID_CONFIG_ACCESS *) &i2c_record->sucI2cId; // attach i2c gpio information for connector - radeon_gpu_i2c_attach(connector_index, + radeon_gpu_i2c_attach(connectorIndex, i2c_config->ucAccess); break; case ATOM_HPD_INT_RECORD_TYPE: @@ -607,28 +607,28 @@ detect_connectors() __func__, i, get_connector_name(connector_type), connector_type); - gConnector[connector_index]->valid = true; - gConnector[connector_index]->flags = connector_flags; - gConnector[connector_index]->type = connector_type; - gConnector[connector_index]->object_id + gConnector[connectorIndex]->valid = true; + gConnector[connectorIndex]->flags = connector_flags; + gConnector[connectorIndex]->type = connector_type; + gConnector[connectorIndex]->object_id = connector_object_id; - gConnector[connector_index]->encoder.is_tv = false; - gConnector[connector_index]->encoder.is_hdmi = false; + gConnector[connectorIndex]->encoder.is_tv = false; + gConnector[connectorIndex]->encoder.is_hdmi = false; switch(connector_type) { case VIDEO_CONNECTOR_COMPOSITE: case VIDEO_CONNECTOR_SVIDEO: case VIDEO_CONNECTOR_9DIN: - gConnector[connector_index]->encoder.is_tv = true; + gConnector[connectorIndex]->encoder.is_tv = true; break; case VIDEO_CONNECTOR_HDMIA: case VIDEO_CONNECTOR_HDMIB: - gConnector[connector_index]->encoder.is_hdmi = true; + gConnector[connectorIndex]->encoder.is_hdmi = true; break; } - connector_index++; + connectorIndex++; } // END for each valid connector } // end for each display path @@ -658,7 +658,7 @@ detect_displays() if (radeon_gpu_read_edid(id, &gDisplay[displayIndex]->edid_info)) { gDisplay[displayIndex]->active = true; // set this display as active - gDisplay[displayIndex]->connector_index = id; + gDisplay[displayIndex]->connectorIndex = id; // set physical connector index from gConnector init_registers(gDisplay[displayIndex]->regs, displayIndex); @@ -678,7 +678,7 @@ detect_displays() if (gConnector[id]->encoder.type == VIDEO_ENCODER_TVDAC) continue; gDisplay[0]->active = true; - gDisplay[0]->connector_index = id; + gDisplay[0]->connectorIndex = id; init_registers(gDisplay[0]->regs, 0); if (detect_crt_ranges(0) == B_OK) gDisplay[0]->found_ranges = true; @@ -699,11 +699,11 @@ debug_displays() ERROR("Display #%" B_PRIu32 " active = %s\n", id, gDisplay[id]->active ? "true" : "false"); - uint32 connector_index = gDisplay[id]->connector_index; + uint32 connectorIndex = gDisplay[id]->connectorIndex; if (gDisplay[id]->active) { - uint32 connector_type = gConnector[connector_index]->type; - uint32 encoder_type = gConnector[connector_index]->encoder.type; + uint32 connector_type = gConnector[connectorIndex]->type; + uint32 encoder_type = gConnector[connectorIndex]->encoder.type; ERROR(" + connector: %s\n", get_connector_name(connector_type)); ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); @@ -742,15 +742,15 @@ debug_connectors() uint32 -display_get_encoder_mode(uint32 connector_index) +display_get_encoder_mode(uint32 connectorIndex) { - uint32 connector_type = gConnector[connector_index]->type; + uint32 connector_type = gConnector[connectorIndex]->type; switch (connector_type) { case VIDEO_CONNECTOR_DVII: case VIDEO_CONNECTOR_HDMIB: /* HDMI-B is DL-DVI; analog works fine */ // TODO : if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI - // if (gConnector[connector_index]->use_digital) + // if (gConnector[connectorIndex]->use_digital) // return ATOM_ENCODER_MODE_DVI; // else return ATOM_ENCODER_MODE_CRT; @@ -786,7 +786,7 @@ display_get_encoder_mode(uint32 connector_index) void -display_crtc_lock(uint8 crtc_id, int command) +display_crtc_lock(uint8 crtcID, int command) { TRACE("%s\n", __func__); ENABLE_CRTC_PS_ALLOCATION args; @@ -795,7 +795,7 @@ display_crtc_lock(uint8 crtc_id, int command) memset(&args, 0, sizeof(args)); - args.ucCRTC = crtc_id; + args.ucCRTC = crtcID; args.ucEnable = command; atom_execute_table(gAtomContext, index, (uint32*)&args); @@ -803,7 +803,7 @@ display_crtc_lock(uint8 crtc_id, int command) void -display_crtc_blank(uint8 crtc_id, int command) +display_crtc_blank(uint8 crtcID, int command) { TRACE("%s\n", __func__); BLANK_CRTC_PS_ALLOCATION args; @@ -811,7 +811,7 @@ display_crtc_blank(uint8 crtc_id, int command) memset(&args, 0, sizeof(args)); - args.ucCRTC = crtc_id; + args.ucCRTC = crtcID; args.ucBlanking = command; atom_execute_table(gAtomContext, index, (uint32 *)&args); @@ -819,7 +819,7 @@ display_crtc_blank(uint8 crtc_id, int command) void -display_crtc_scale(uint8 crtc_id, display_mode *mode) +display_crtc_scale(uint8 crtcID, display_mode *mode) { TRACE("%s\n", __func__); ENABLE_SCALER_PS_ALLOCATION args; @@ -827,7 +827,7 @@ display_crtc_scale(uint8 crtc_id, display_mode *mode) memset(&args, 0, sizeof(args)); - args.ucScaler = crtc_id; + args.ucScaler = crtcID; args.ucEnable = ATOM_SCALER_EXPANSION; atom_execute_table(gAtomContext, index, (uint32 *)&args); @@ -835,10 +835,10 @@ display_crtc_scale(uint8 crtc_id, display_mode *mode) void -display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode) +display_crtc_fb_set_dce1(uint8 crtcID, display_mode *mode) { radeon_shared_info &info = *gInfo->shared_info; - register_info* regs = gDisplay[crtc_id]->regs; + register_info* regs = gDisplay[crtcID]->regs; uint32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; uint32 fb_format; @@ -936,7 +936,7 @@ display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode) void -display_crtc_set(uint8 crtc_id, display_mode *mode) +display_crtc_set(uint8 crtcID, display_mode *mode) { display_timing& displayTiming = mode->timing; @@ -972,14 +972,14 @@ display_crtc_set(uint8 crtc_id, display_mode *mode) misc |= ATOM_VSYNC_POLARITY; args.susModeMiscInfo.usAccess = B_HOST_TO_LENDIAN_INT16(misc); - args.ucCRTC = crtc_id; + args.ucCRTC = crtcID; atom_execute_table(gAtomContext, index, (uint32 *)&args); } void -display_crtc_set_dtd(uint8 crtc_id, display_mode *mode) +display_crtc_set_dtd(uint8 crtcID, display_mode *mode) { display_timing& displayTiming = mode->timing; @@ -1023,14 +1023,14 @@ display_crtc_set_dtd(uint8 crtc_id, display_mode *mode) misc |= ATOM_VSYNC_POLARITY; args.susModeMiscInfo.usAccess = B_HOST_TO_LENDIAN_INT16(misc); - args.ucCRTC = crtc_id; + args.ucCRTC = crtcID; atom_execute_table(gAtomContext, index, (uint32 *)&args); } void -display_crtc_power(uint8 crtc_id, int command) +display_crtc_power(uint8 crtcID, int command) { TRACE("%s\n", __func__); int index = GetIndexIntoMasterTable(COMMAND, EnableCRTC); @@ -1038,7 +1038,7 @@ display_crtc_power(uint8 crtc_id, int command) memset(&args, 0, sizeof(args)); - args.ucCRTC = crtc_id; + args.ucCRTC = crtcID; args.ucEnable = command; atom_execute_table(gAtomContext, index, (uint32*)&args); @@ -1046,7 +1046,7 @@ display_crtc_power(uint8 crtc_id, int command) void -display_crtc_memreq(uint8 crtc_id, int command) +display_crtc_memreq(uint8 crtcID, int command) { TRACE("%s\n", __func__); int index = GetIndexIntoMasterTable(COMMAND, EnableCRTCMemReq); @@ -1054,7 +1054,7 @@ display_crtc_memreq(uint8 crtc_id, int command) memset(&args, 0, sizeof(args)); - args.ucCRTC = crtc_id; + args.ucCRTC = crtcID; args.ucEnable = command; atom_execute_table(gAtomContext, index, (uint32*)&args); diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 37540ed4b8..a000a97989 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -65,15 +65,15 @@ status_t detect_displays(); void debug_displays(); void debug_connectors(); -uint32 display_get_encoder_mode(uint32 connector_index); -void display_crtc_lock(uint8 crtc_id, int command); -void display_crtc_blank(uint8 crtc_id, int command); -void display_crtc_scale(uint8 crtc_id, display_mode *mode); -void display_crtc_fb_set_dce1(uint8 crtc_id, display_mode *mode); -void display_crtc_set(uint8 crtc_id, display_mode *mode); -void display_crtc_set_dtd(uint8 crtc_id, display_mode *mode); -void display_crtc_power(uint8 crtc_id, int command); -void display_crtc_memreq(uint8 crtc_id, int command); +uint32 display_get_encoder_mode(uint32 connectorIndex); +void display_crtc_lock(uint8 crtcID, int command); +void display_crtc_blank(uint8 crtcID, int command); +void display_crtc_scale(uint8 crtcID, display_mode *mode); +void display_crtc_fb_set_dce1(uint8 crtcID, display_mode *mode); +void display_crtc_set(uint8 crtcID, display_mode *mode); +void display_crtc_set_dtd(uint8 crtcID, display_mode *mode); +void display_crtc_power(uint8 crtcID, int command); +void display_crtc_memreq(uint8 crtcID, int command); #endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index a82d554daf..f4abc06257 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -37,7 +37,7 @@ union crtc_source_param { void -encoder_assign_crtc(uint8 crtc_id) +encoder_assign_crtc(uint8 crtcID) { int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source); union crtc_source_param args; @@ -50,23 +50,23 @@ encoder_assign_crtc(uint8 crtc_id) != B_OK) return; - uint16 connector_index = gDisplay[crtc_id]->connector_index; - uint16 encoder_id = gConnector[connector_index]->encoder.object_id; + uint16 connectorIndex = gDisplay[crtcID]->connectorIndex; + uint16 encoderID = gConnector[connectorIndex]->encoder.object_id; switch (frev) { case 1: switch (crev) { case 1: default: - args.v1.ucCRTC = crtc_id; - switch (encoder_id) { + args.v1.ucCRTC = crtcID; + switch (encoderID) { case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: args.v1.ucDevice = ATOM_DEVICE_DFP1_INDEX; break; case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if ((gConnector[connector_index]->flags + if ((gConnector[connectorIndex]->flags & ATOM_DEVICE_LCD1_SUPPORT) != 0) args.v1.ucDevice = ATOM_DEVICE_LCD1_INDEX; else @@ -102,10 +102,10 @@ encoder_assign_crtc(uint8 crtc_id) } break; case 2: - args.v2.ucCRTC = crtc_id; + args.v2.ucCRTC = crtcID; args.v2.ucEncodeMode - = display_get_encoder_mode(connector_index); - switch (encoder_id) { + = display_get_encoder_mode(connectorIndex); + switch (encoderID) { case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: @@ -169,16 +169,16 @@ encoder_assign_crtc(uint8 crtc_id) atom_execute_table(gAtomContext, index, (uint32*)&args); // update crtc encoder scratch register @ scratch 3 - encoder_crtc_scratch(crtc_id); + encoder_crtc_scratch(crtcID); } void encoder_mode_set(uint8 id, uint32 pixelClock) { - uint32 connector_index = gDisplay[id]->connector_index; + uint32 connectorIndex = gDisplay[id]->connectorIndex; - switch (gConnector[connector_index]->encoder.object_id) { + switch (gConnector[connectorIndex]->encoder.object_id) { case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: case ENCODER_OBJECT_ID_INTERNAL_DAC2: @@ -220,15 +220,15 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) { TRACE("%s\n", __func__); - uint32 connector_index = gDisplay[id]->connector_index; + uint32 connectorIndex = gDisplay[id]->connectorIndex; union lvds_encoder_control args; memset(&args, 0, sizeof(args)); int index = 0; - uint16 connector_flags = gConnector[connector_index]->encoder.flags; + uint16 connector_flags = gConnector[connectorIndex]->encoder.flags; - switch (gConnector[connector_index]->encoder.object_id) { + switch (gConnector[connectorIndex]->encoder.object_id) { case ENCODER_OBJECT_ID_INTERNAL_LVDS: index = GetIndexIntoMasterTable(COMMAND, LVDSEncoderControl); break; @@ -338,13 +338,13 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) { TRACE("%s\n", __func__); - uint32 connector_index = gDisplay[id]->connector_index; + uint32 connectorIndex = gDisplay[id]->connectorIndex; int index = 0; DAC_ENCODER_CONTROL_PS_ALLOCATION args; memset(&args, 0, sizeof(args)); - switch (gConnector[connector_index]->encoder.object_id) { + switch (gConnector[connectorIndex]->encoder.object_id) { case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: index = GetIndexIntoMasterTable(COMMAND, DAC1EncoderControl); @@ -367,47 +367,47 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) void -encoder_crtc_scratch(uint8 crtc_id) +encoder_crtc_scratch(uint8 crtcID) { TRACE("%s\n", __func__); - uint32 connector_index = gDisplay[crtc_id]->connector_index; - uint32 encoder_flags = gConnector[connector_index]->encoder.flags; + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; + uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; // TODO : r500 uint32 bios_3_scratch = Read32(OUT, R600_BIOS_3_SCRATCH); - if ((encoder_flags & ATOM_DEVICE_TV1_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_TV1_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_TV1_CRTC_ACTIVE; - bios_3_scratch |= (crtc_id << 18); + bios_3_scratch |= (crtcID << 18); } - if ((encoder_flags & ATOM_DEVICE_CV_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_CV_CRTC_ACTIVE; - bios_3_scratch |= (crtc_id << 24); + bios_3_scratch |= (crtcID << 24); } - if ((encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_CRT1_CRTC_ACTIVE; - bios_3_scratch |= (crtc_id << 16); + bios_3_scratch |= (crtcID << 16); } - if ((encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_CRT2_CRTC_ACTIVE; - bios_3_scratch |= (crtc_id << 20); + bios_3_scratch |= (crtcID << 20); } - if ((encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_LCD1_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_LCD1_CRTC_ACTIVE; - bios_3_scratch |= (crtc_id << 17); + bios_3_scratch |= (crtcID << 17); } - if ((encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_DFP1_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_DFP1_CRTC_ACTIVE; - bios_3_scratch |= (crtc_id << 19); + bios_3_scratch |= (crtcID << 19); } - if ((encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_DFP2_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_DFP2_CRTC_ACTIVE; - bios_3_scratch |= (crtc_id << 23); + bios_3_scratch |= (crtcID << 23); } - if ((encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_DFP3_SUPPORT) != 0) { bios_3_scratch &= ~ATOM_S3_DFP3_CRTC_ACTIVE; - bios_3_scratch |= (crtc_id << 25); + bios_3_scratch |= (crtcID << 25); } // TODO : r500 @@ -416,71 +416,71 @@ encoder_crtc_scratch(uint8 crtc_id) void -encoder_dpms_scratch(uint8 crtc_id, bool power) +encoder_dpms_scratch(uint8 crtcID, bool power) { TRACE("%s: power: %s\n", __func__, power ? "true" : "false"); - uint32 connector_index = gDisplay[crtc_id]->connector_index; - uint32 encoder_flags = gConnector[connector_index]->encoder.flags; + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; + uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; // TODO : r500 uint32 bios_2_scratch = Read32(OUT, R600_BIOS_2_SCRATCH); - if ((encoder_flags & ATOM_DEVICE_TV1_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_TV1_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_TV1_DPMS_STATE; else bios_2_scratch |= ATOM_S2_TV1_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_CV_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_CV_DPMS_STATE; else bios_2_scratch |= ATOM_S2_CV_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_CRT1_DPMS_STATE; else bios_2_scratch |= ATOM_S2_CRT1_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_CRT2_DPMS_STATE; else bios_2_scratch |= ATOM_S2_CRT2_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_LCD1_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_LCD1_DPMS_STATE; else bios_2_scratch |= ATOM_S2_LCD1_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_DFP1_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP1_DPMS_STATE; else bios_2_scratch |= ATOM_S2_DFP1_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_DFP2_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP2_DPMS_STATE; else bios_2_scratch |= ATOM_S2_DFP2_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_DFP3_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP3_DPMS_STATE; else bios_2_scratch |= ATOM_S2_DFP3_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_DFP4_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_DFP4_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP4_DPMS_STATE; else bios_2_scratch |= ATOM_S2_DFP4_DPMS_STATE; } - if ((encoder_flags & ATOM_DEVICE_DFP5_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_DFP5_SUPPORT) != 0) { if (power == true) bios_2_scratch &= ~ATOM_S2_DFP5_DPMS_STATE; else @@ -491,17 +491,17 @@ encoder_dpms_scratch(uint8 crtc_id, bool power) void -encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) +encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode) { int index = 0; DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; memset(&args, 0, sizeof(args)); - uint32 connector_index = gDisplay[crtc_id]->connector_index; - uint32 encoder_flags = gConnector[connector_index]->encoder.flags; + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; + uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; - switch (encoder_id) { + switch (encoderID) { case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: index = GetIndexIntoMasterTable(COMMAND, TMDSAOutputControl); @@ -527,7 +527,7 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); break; case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if ((encoder_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); else index = GetIndexIntoMasterTable(COMMAND, LVTMAOutputControl); @@ -556,22 +556,22 @@ encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode) case B_DPMS_ON: args.ucAction = ATOM_ENABLE; atom_execute_table(gAtomContext, index, (uint32*)&args); - if ((encoder_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { args.ucAction = ATOM_LCD_BLON; atom_execute_table(gAtomContext, index, (uint32*)&args); } - encoder_dpms_scratch(crtc_id, true); + encoder_dpms_scratch(crtcID, true); break; case B_DPMS_STAND_BY: case B_DPMS_SUSPEND: case B_DPMS_OFF: args.ucAction = ATOM_DISABLE; atom_execute_table(gAtomContext, index, (uint32*)&args); - if ((encoder_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { args.ucAction = ATOM_LCD_BLOFF; atom_execute_table(gAtomContext, index, (uint32*)&args); } - encoder_dpms_scratch(crtc_id, false); + encoder_dpms_scratch(crtcID, false); break; } } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index 093225fb23..9389320e39 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -14,9 +14,9 @@ void encoder_mode_set(uint8 id, uint32 pixelClock); status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command); status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command); void encoder_output_lock(bool lock); -void encoder_crtc_scratch(uint8 crtc_id); -void encoder_dpms_scratch(uint8 crtc_id, bool power); -void encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode); +void encoder_crtc_scratch(uint8 crtcID); +void encoder_dpms_scratch(uint8 crtcID, bool power); +void encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode); #endif /* RADEON_HD_ENCODER_H */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 6763b603f4..07a0367ddc 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -158,11 +158,11 @@ radeon_set_display_mode(display_mode *mode) if (gDisplay[id]->active == false) continue; - uint16 connector_index = gDisplay[id]->connector_index; + uint16 connectorIndex = gDisplay[id]->connectorIndex; // *** encoder prep encoder_output_lock(true); - encoder_dpms_set(id, gConnector[connector_index]->encoder.object_id, + encoder_dpms_set(id, gConnector[connectorIndex]->encoder.object_id, B_DPMS_OFF); encoder_assign_crtc(id); @@ -193,7 +193,7 @@ radeon_set_display_mode(display_mode *mode) display_crtc_lock(id, ATOM_DISABLE); // *** encoder commit - encoder_dpms_set(id, gConnector[connector_index]->encoder.object_id, + encoder_dpms_set(id, gConnector[connectorIndex]->encoder.object_id, B_DPMS_ON); encoder_output_lock(false); } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 1be68ad14b..0ab1cd1004 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -171,7 +171,7 @@ union adjust_pixel_clock { uint32 -pll_adjust(pll_info *pll, uint8 crtc_id) +pll_adjust(pll_info *pll, uint8 crtcID) { pll->flags |= PLL_PREFER_LOW_REF_DIV; @@ -181,9 +181,9 @@ pll_adjust(pll_info *pll, uint8 crtc_id) uint32 pixelClock = pll->pixel_clock; uint32 adjustedClock = pll->pixel_clock; - uint32 connector_index = gDisplay[crtc_id]->connector_index; - uint32 encoder_id = gConnector[connector_index]->encoder.object_id; - uint32 encoder_mode = display_get_encoder_mode(connector_index); + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; + uint32 encoderID = gConnector[connectorIndex]->encoder.object_id; + uint32 encoder_mode = display_get_encoder_mode(connectorIndex); if (info.device_chipset >= (RADEON_R600 | 0x20)) { union adjust_pixel_clock args; @@ -203,7 +203,7 @@ pll_adjust(pll_info *pll, uint8 crtc_id) case 2: args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); - args.v1.ucTransmitterID = encoder_id; + args.v1.ucTransmitterID = encoderID; args.v1.ucEncodeMode = encoder_mode; // TODO : SS and SS % > 0 if (0) { @@ -220,7 +220,7 @@ pll_adjust(pll_info *pll, uint8 crtc_id) case 3: args.v3.sInput.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); - args.v3.sInput.ucTransmitterID = encoder_id; + args.v3.sInput.ucTransmitterID = encoderID; args.v3.sInput.ucEncodeMode = encoder_mode; args.v3.sInput.ucDispPllConfig = 0; // TODO : SS and SS % > 0 @@ -263,16 +263,16 @@ pll_adjust(pll_info *pll, uint8 crtc_id) status_t -pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) +pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) { - uint32 connector_index = gDisplay[crtc_id]->connector_index; - pll_info *pll = &gConnector[connector_index]->encoder.pll; + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; + pll_info *pll = &gConnector[connectorIndex]->encoder.pll; pll->pixel_clock = pixelClock; - pll->id = pll_id; + pll->id = pllID; // get any needed clock adjustments, set reference/post dividers, set flags - uint32 adjustedClock = pll_adjust(pll, crtc_id); + uint32 adjustedClock = pll_adjust(pll, crtcID); // compute dividers, set flags pll_compute(pll); @@ -297,7 +297,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) args.v1.ucFracFbDiv = pll->feedback_div_frac; args.v1.ucPostDiv = pll->post_div; args.v1.ucPpll = pll->id; - args.v1.ucCRTC = crtc_id; + args.v1.ucCRTC = crtcID; args.v1.ucRefDivSrc = 1; break; case 2: @@ -307,7 +307,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) args.v2.ucFracFbDiv = pll->feedback_div_frac; args.v2.ucPostDiv = pll->post_div; args.v2.ucPpll = pll->id; - args.v2.ucCRTC = crtc_id; + args.v2.ucCRTC = crtcID; args.v2.ucRefDivSrc = 1; break; case 3: @@ -321,11 +321,11 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; args.v3.ucTransmitterId - = gConnector[connector_index]->encoder.object_id; - args.v3.ucEncoderMode = display_get_encoder_mode(connector_index); + = gConnector[connectorIndex]->encoder.object_id; + args.v3.ucEncoderMode = display_get_encoder_mode(connectorIndex); break; case 5: - args.v5.ucCRTC = crtc_id; + args.v5.ucCRTC = crtcID; args.v5.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); args.v5.ucRefDiv = pll->reference_div; args.v5.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); @@ -345,14 +345,14 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) break; } args.v5.ucTransmitterID - = gConnector[connector_index]->encoder.object_id; + = gConnector[connectorIndex]->encoder.object_id; args.v5.ucEncoderMode - = display_get_encoder_mode(connector_index); - args.v5.ucPpll = pll_id; + = display_get_encoder_mode(connectorIndex); + args.v5.ucPpll = pllID; break; case 6: args.v6.ulDispEngClkFreq - = B_HOST_TO_LENDIAN_INT32(crtc_id << 24 | adjustedClock / 10); + = B_HOST_TO_LENDIAN_INT32(crtcID << 24 | adjustedClock / 10); args.v6.ucRefDiv = pll->reference_div; args.v6.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); args.v6.ulFbDivDecFrac @@ -377,9 +377,9 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id) break; } args.v6.ucTransmitterID - = gConnector[connector_index]->encoder.object_id; - args.v6.ucEncoderMode = display_get_encoder_mode(connector_index); - args.v6.ucPpll = pll_id; + = gConnector[connectorIndex]->encoder.object_id; + args.v6.ucEncoderMode = display_get_encoder_mode(connectorIndex); + args.v6.ucPpll = pllID; break; default: TRACE("%s: ERROR: table version %d.%d TODO\n", __func__, diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index 3c0b7ff11e..b0650df479 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -87,9 +87,9 @@ struct pll_info { }; -uint32 pll_adjust(pll_info *pll, uint8 crtc_id); +uint32 pll_adjust(pll_info *pll, uint8 crtcID); status_t pll_compute(pll_info *pll); -status_t pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id); +status_t pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID); #endif /* RADEON_HD_PLL_H */ From fc2d7cb04d7ad78424169fd0df4d236de2bb17d1 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 12 Oct 2011 20:55:28 +0000 Subject: [PATCH 371/702] * Introduce {reserve|allocate|free}_io_interrupt_vectors() that can generically be used to mark certain io interrupt vectors as reserved and to allocate from the still free ones. It is a kernel private API for now though. * Make the MSI code use that functionality instead of implementing its own which slims it down considerably and also removes quite a bit of hardcoded knowledge about the interrupt layout that didn't really belong there. * Mark the various in-use interrupts as reserved from the components that actually know about them (PIC, IO-APIC, SMP, APIC timer and interrupt setup). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42832 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/int.h | 4 + src/system/kernel/arch/x86/arch_int.cpp | 3 + src/system/kernel/arch/x86/arch_smp.cpp | 1 + src/system/kernel/arch/x86/ioapic.cpp | 8 ++ src/system/kernel/arch/x86/msi.cpp | 84 ++------------ src/system/kernel/arch/x86/pic.cpp | 6 + .../kernel/arch/x86/timers/x86_apic.cpp | 2 + src/system/kernel/int.cpp | 106 ++++++++++++++++++ 8 files changed, 141 insertions(+), 73 deletions(-) diff --git a/headers/private/kernel/int.h b/headers/private/kernel/int.h index 8fe8fd59d7..b3642c4d80 100644 --- a/headers/private/kernel/int.h +++ b/headers/private/kernel/int.h @@ -53,4 +53,8 @@ are_interrupts_enabled(void) #define restore_interrupts(status) arch_int_restore_interrupts(status) +status_t reserve_io_interrupt_vectors(long count, long startVector); +status_t allocate_io_interrupt_vectors(long count, long *startVector); +void free_io_interrupt_vectors(long count, long startVector); + #endif /* _KERNEL_INT_H */ diff --git a/src/system/kernel/arch/x86/arch_int.cpp b/src/system/kernel/arch/x86/arch_int.cpp index fe746b342b..123f575bb3 100644 --- a/src/system/kernel/arch/x86/arch_int.cpp +++ b/src/system/kernel/arch/x86/arch_int.cpp @@ -84,6 +84,7 @@ static desc_table* sIDTs[B_MAX_CPU_COUNT]; // table with functions handling respective interrupts typedef void interrupt_handler_function(struct iframe* frame); + #define INTERRUPT_HANDLER_TABLE_SIZE 256 interrupt_handler_function* gInterruptHandlerTable[ INTERRUPT_HANDLER_TABLE_SIZE]; @@ -653,6 +654,8 @@ arch_int_init(struct kernel_args *args) set_trap_gate(0, 98, &trap98); // for performance testing only set_trap_gate(0, 99, &trap99); // syscall interrupt + reserve_io_interrupt_vectors(2, 98); + // configurable msi or msi-x interrupts set_interrupt_gate(0, 100, &trap100); set_interrupt_gate(0, 101, &trap101); diff --git a/src/system/kernel/arch/x86/arch_smp.cpp b/src/system/kernel/arch/x86/arch_smp.cpp index 1b585eada6..dd67bea52c 100644 --- a/src/system/kernel/arch/x86/arch_smp.cpp +++ b/src/system/kernel/arch/x86/arch_smp.cpp @@ -90,6 +90,7 @@ arch_smp_init(kernel_args *args) if (args->num_cpus > 1) { // I/O interrupts start at ARCH_INTERRUPT_BASE, so all interrupts are shifted + reserve_io_interrupt_vectors(3, 0xfd - ARCH_INTERRUPT_BASE); install_io_interrupt_handler(0xfd - ARCH_INTERRUPT_BASE, &i386_ici_interrupt, NULL, B_NO_LOCK_VECTOR); install_io_interrupt_handler(0xfe - ARCH_INTERRUPT_BASE, &i386_smp_error_interrupt, NULL, B_NO_LOCK_VECTOR); install_io_interrupt_handler(0xff - ARCH_INTERRUPT_BASE, &i386_spurious_interrupt, NULL, B_NO_LOCK_VECTOR); diff --git a/src/system/kernel/arch/x86/ioapic.cpp b/src/system/kernel/arch/x86/ioapic.cpp index 5b5e52f910..78f6129718 100644 --- a/src/system/kernel/arch/x86/ioapic.cpp +++ b/src/system/kernel/arch/x86/ioapic.cpp @@ -767,6 +767,14 @@ ioapic_init(kernel_args* args) ioapic_enable_io_interrupt(i); } + // mark the interrupt vectors reserved so they aren't used for other stuff + current = sIOAPICs; + while (current != NULL) { + reserve_io_interrupt_vectors(current->max_redirection_entry + 1, + current->global_interrupt_base); + current = current->next; + } + // prefer the ioapic over the normal pic dprintf("using io-apics for interrupt routing\n"); arch_int_set_interrupt_controller(ioapicController); diff --git a/src/system/kernel/arch/x86/msi.cpp b/src/system/kernel/arch/x86/msi.cpp index 2972de74c0..a859a9a07c 100644 --- a/src/system/kernel/arch/x86/msi.cpp +++ b/src/system/kernel/arch/x86/msi.cpp @@ -4,20 +4,14 @@ */ #include -#include -#include #include #include +#include #include -static const uint32 kVectorCount = 256 - ARCH_INTERRUPT_BASE; -static const uint8 kNumISAVectors = 16; - static bool sMSISupported = false; -static bool sAllocatedVectors[kVectorCount]; -static mutex sMSIAllocationLock = MUTEX_INITIALIZER("msi_allocation"); void @@ -28,27 +22,6 @@ msi_init() return; } - // TODO: less hardcoding! - - // the first 16 vectors are legacy ISA in all cases - for (uint16 i = 0; i < kNumISAVectors; i++) - sAllocatedVectors[i] = true; - - for (uint16 i = kNumISAVectors; i < kVectorCount; i++) { - // if ioapics aren't in use this will always return false, leaving - // the vectors free for us; otherwise we'll avoid any vector that - // can be addressed by an IO-APIC - sAllocatedVectors[i] = ioapic_is_interrupt_available(i); - } - - // performance testing and syscall interrupts - sAllocatedVectors[98 - ARCH_INTERRUPT_BASE] = true; - sAllocatedVectors[99 - ARCH_INTERRUPT_BASE] = true; - - // the upper range is used by apic local (timer) and smp interrupts (ipi) - for (uint16 i = 251; i < 256; i++) - sAllocatedVectors[i - ARCH_INTERRUPT_BASE] = true; - dprintf("msi support enabled\n"); sMSISupported = true; } @@ -68,46 +41,24 @@ msi_allocate_vectors(uint8 count, uint8 *startVector, uint64 *address, if (!sMSISupported) return B_UNSUPPORTED; - mutex_lock(&sMSIAllocationLock); + long vector; + status_t result = allocate_io_interrupt_vectors(count, &vector); + if (result != B_OK) + return result; - uint8 vector = 0; - bool runFound = true; - for (uint16 i = 0; i < kVectorCount - (count - 1); i++) { - if (!sAllocatedVectors[i]) { - vector = i; - runFound = true; - for (uint16 j = 1; j < count; j++) { - if (sAllocatedVectors[i + j]) { - runFound = false; - i += j; - break; - } - } - - if (runFound) - break; - } - } - - if (!runFound) { - mutex_unlock(&sMSIAllocationLock); - dprintf("found no free vectors to allocate %u msi messages\n", count); + if (vector >= 256) { + free_io_interrupt_vectors(count, vector); return B_NO_MEMORY; } - for (uint16 i = 0; i < count; i++) - sAllocatedVectors[i + vector] = true; - - mutex_unlock(&sMSIAllocationLock); - - *startVector = vector; + *startVector = (uint8)vector; *address = MSI_ADDRESS_BASE | (0 << MSI_DESTINATION_ID_SHIFT) | MSI_NO_REDIRECTION | MSI_DESTINATION_MODE_PHYSICAL; *data = MSI_TRIGGER_MODE_EDGE | MSI_DELIVERY_MODE_FIXED - | (vector + ARCH_INTERRUPT_BASE); + | ((uint16)vector + ARCH_INTERRUPT_BASE); dprintf("msi_allocate_vectors: allocated %u vectors starting from %u\n", - count, vector); + count, *startVector); return B_OK; } @@ -120,21 +71,8 @@ msi_free_vectors(uint8 count, uint8 startVector) return; } - if ((uint32)startVector + count > kVectorCount) { - panic("invalid start vector %u or count %u supplied to " - "msi_free_vectors\n", startVector, count); - } - dprintf("msi_free_vectors: freeing %u vectors starting from %u\n", count, startVector); - mutex_lock(&sMSIAllocationLock); - for (uint16 i = 0; i < count; i++) { - if (!sAllocatedVectors[i + startVector]) - panic("msi vector %u was not allocated\n", i + startVector); - - sAllocatedVectors[i + startVector] = false; - } - - mutex_unlock(&sMSIAllocationLock); + free_io_interrupt_vectors(count, startVector); } diff --git a/src/system/kernel/arch/x86/pic.cpp b/src/system/kernel/arch/x86/pic.cpp index 2f5916b671..7e086312c2 100644 --- a/src/system/kernel/arch/x86/pic.cpp +++ b/src/system/kernel/arch/x86/pic.cpp @@ -13,6 +13,8 @@ #include +#include + //#define TRACE_PIC #ifdef TRACE_PIC @@ -229,6 +231,8 @@ pic_init() TRACE(("PIC level trigger mode: 0x%08lx\n", sLevelTriggeredInterrupts)); + reserve_io_interrupt_vectors(16, 0); + // make the pic controller the current one arch_int_set_interrupt_controller(picController); } @@ -243,4 +247,6 @@ pic_disable(uint16& enabledInterrupts) // Mask off all interrupts on master and slave out8(0xff, PIC_MASTER_MASK); out8(0xff, PIC_SLAVE_MASK); + + free_io_interrupt_vectors(16, 0); } diff --git a/src/system/kernel/arch/x86/timers/x86_apic.cpp b/src/system/kernel/arch/x86/timers/x86_apic.cpp index 05636775b0..7c9b3f0133 100644 --- a/src/system/kernel/arch/x86/timers/x86_apic.cpp +++ b/src/system/kernel/arch/x86/timers/x86_apic.cpp @@ -105,6 +105,8 @@ apic_timer_init(struct kernel_args *args) return B_ERROR; sApicTicsPerSec = args->arch_args.apic_time_cv_factor; + + reserve_io_interrupt_vectors(1, 0xfb - ARCH_INTERRUPT_BASE); install_io_interrupt_handler(0xfb - ARCH_INTERRUPT_BASE, &apic_timer_interrupt, NULL, B_NO_LOCK_VECTOR); diff --git a/src/system/kernel/int.cpp b/src/system/kernel/int.cpp index 8ac9d6a90c..3818db3761 100644 --- a/src/system/kernel/int.cpp +++ b/src/system/kernel/int.cpp @@ -1,4 +1,7 @@ /* + * Copyright 2011, Michael Lotz, mmlr@mlotz.ch. + * Distributed under the terms of the MIT License. + * * Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * @@ -17,6 +20,7 @@ #include #include #include +#include #include #include @@ -56,6 +60,9 @@ struct io_vector { }; static struct io_vector sVectors[NUM_IO_VECTORS]; +static bool sAllocatedIOInterruptVectors[NUM_IO_VECTORS]; +static mutex sIOInterruptVectorAllocationLock + = MUTEX_INITIALIZER("io_interrupt_vector_allocation"); #if DEBUG_INTERRUPTS @@ -421,3 +428,102 @@ remove_io_interrupt_handler(long vector, interrupt_handler handler, void *data) return status; } + +/* Mark \a count contigous interrupts starting at \a startVector as in use. + This will prevent them from being allocated by others. Only use this when + the reserved range is hardwired to the given vector, otherwise allocate + vectors using allocate_io_interrupt_vectors() instead. +*/ +status_t +reserve_io_interrupt_vectors(long count, long startVector) +{ + MutexLocker locker(&sIOInterruptVectorAllocationLock); + + for (long i = 0; i < count; i++) { + if (sAllocatedIOInterruptVectors[startVector + i]) { + panic("reserved interrupt vector range %ld-%ld overlaps already " + "allocated vector %ld", startVector, startVector + count - 1, + startVector + i); + free_io_interrupt_vectors(i, startVector); + return B_BUSY; + } + + sAllocatedIOInterruptVectors[startVector + i] = true; + } + + dprintf("reserve_io_interrupt_vectors: reserved %ld vectors starting " + "from %ld\n", count, startVector); + return B_OK; +} + + +/*! Allocate \a count contigous interrupt vectors. The vectors are allocated + as available so that they do not overlap with any other reserved vector. + The first vector to be used is returned in \a startVector on success. +*/ +status_t +allocate_io_interrupt_vectors(long count, long *startVector) +{ + MutexLocker locker(&sIOInterruptVectorAllocationLock); + + long vector = 0; + bool runFound = true; + for (long i = 0; i < NUM_IO_VECTORS - (count - 1); i++) { + if (sAllocatedIOInterruptVectors[i]) + continue; + + vector = i; + runFound = true; + for (uint16 j = 1; j < count; j++) { + if (sAllocatedIOInterruptVectors[i + j]) { + runFound = false; + i += j; + break; + } + } + + if (runFound) + break; + } + + if (!runFound) { + dprintf("found no free vectors to allocate %ld io interrupts\n", count); + return B_NO_MEMORY; + } + + for (long i = 0; i < count; i++) + sAllocatedIOInterruptVectors[vector + i] = true; + + *startVector = vector; + dprintf("allocate_io_interrupt_vectors: allocated %ld vectors starting " + "from %ld\n", count, vector); + return B_OK; +} + + +/*! Free/unreserve interrupt vectors previously allocated with the + {reserve|allocate}_io_interrupt_vectors() functions. The \a count and + \a startVector can be adjusted from the allocation calls to partially free + a vector range. +*/ +void +free_io_interrupt_vectors(long count, long startVector) +{ + if (startVector + count > NUM_IO_VECTORS) { + panic("invalid start vector %ld or count %ld supplied to " + "free_io_interrupt_vectors\n", startVector, count); + } + + dprintf("free_io_interrupt_vectors: freeing %ld vectors starting " + "from %ld\n", count, startVector); + + MutexLocker locker(sIOInterruptVectorAllocationLock); + for (long i = 0; i < count; i++) { + if (!sAllocatedIOInterruptVectors[startVector + i]) { + panic("io interrupt vector %ld was not allocated\n", + startVector + i); + } + + sAllocatedIOInterruptVectors[startVector + i] = false; + } +} From 20f094cc38adc63ae5b19b07bb90863734012f02 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 12 Oct 2011 21:06:21 +0000 Subject: [PATCH 372/702] Fix and add copyright year spotted by Urias. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42833 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/msi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/arch/x86/msi.cpp b/src/system/kernel/arch/x86/msi.cpp index a859a9a07c..67b24225cc 100644 --- a/src/system/kernel/arch/x86/msi.cpp +++ b/src/system/kernel/arch/x86/msi.cpp @@ -1,5 +1,5 @@ /* - * Copyright 20010, Michael Lotz, mmlr@mlotz.ch. All Rights Reserved. + * Copyright 2010-2011, Michael Lotz, mmlr@mlotz.ch. All Rights Reserved. * Distributed under the terms of the MIT license. */ From 6b49ba893183ec7d0c9a1231080e2c60fe33722e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 12 Oct 2011 21:21:45 +0000 Subject: [PATCH 373/702] * style fixes, no functional change... frev / crev to tableMajor / tableMinor size to tableSize offset to tableOffset git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42834 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 95 ++++++++++--------- src/add-ons/accelerants/radeon_hd/encoder.cpp | 39 ++++---- src/add-ons/accelerants/radeon_hd/gpu.cpp | 23 ++--- src/add-ons/accelerants/radeon_hd/pll.cpp | 26 ++--- 4 files changed, 98 insertions(+), 85 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index dbff0c288e..3a758b8682 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -235,13 +235,13 @@ status_t detect_connectors_legacy() { int index = GetIndexIntoMasterTable(DATA, SupportedDevicesInfo); - uint8 frev; - uint8 crev; - uint16 size; - uint16 data_offset; + uint8 tableMajor; + uint8 tableMinor; + uint16 tableSize; + uint16 tableOffset; - if (atom_parse_data_header(gAtomContext, index, &size, &frev, &crev, - &data_offset) != B_OK) { + if (atom_parse_data_header(gAtomContext, index, &tableSize, + &tableMajor, &tableMinor, &tableOffset) != B_OK) { ERROR("%s: unable to parse data header!\n", __func__); return B_ERROR; } @@ -249,7 +249,7 @@ detect_connectors_legacy() union atom_supported_devices *supported_devices; supported_devices = (union atom_supported_devices *) - (gAtomContext->bios + data_offset); + (gAtomContext->bios + tableOffset); uint16 device_support = B_LENDIAN_TO_HOST_INT16(supported_devices->info.usDeviceSupport); @@ -327,19 +327,20 @@ status_t detect_connectors() { int index = GetIndexIntoMasterTable(DATA, Object_Header); - uint8 frev; - uint8 crev; - uint16 size; - uint16 data_offset; + uint8 tableMajor; + uint8 tableMinor; + uint16 tableSize; + uint16 tableOffset; - if (atom_parse_data_header(gAtomContext, index, &size, &frev, &crev, - &data_offset) != B_OK) { + if (atom_parse_data_header(gAtomContext, index, &tableSize, + &tableMajor, &tableMinor, &tableOffset) != B_OK) { ERROR("%s: ERROR: parsing data header failed!\n", __func__); return B_ERROR; } - if (crev < 2) { - ERROR("%s: ERROR: data header version unknown!\n", __func__); + if (tableMinor < 2) { + ERROR("%s: ERROR: table minor version unknown! " + "(%" B_PRIu8 ".%" B_PRIu8 ")\n", __func__, tableMajor, tableMinor); return B_ERROR; } @@ -349,22 +350,22 @@ detect_connectors() ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj; ATOM_OBJECT_HEADER *obj_header; - obj_header = (ATOM_OBJECT_HEADER *)(gAtomContext->bios + data_offset); + obj_header = (ATOM_OBJECT_HEADER *)(gAtomContext->bios + tableOffset); path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *) - (gAtomContext->bios + data_offset + (gAtomContext->bios + tableOffset + B_LENDIAN_TO_HOST_INT16(obj_header->usDisplayPathTableOffset)); con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *) - (gAtomContext->bios + data_offset + (gAtomContext->bios + tableOffset + B_LENDIAN_TO_HOST_INT16(obj_header->usConnectorObjectTableOffset)); enc_obj = (ATOM_ENCODER_OBJECT_TABLE *) - (gAtomContext->bios + data_offset + (gAtomContext->bios + tableOffset + B_LENDIAN_TO_HOST_INT16(obj_header->usEncoderObjectTableOffset)); router_obj = (ATOM_OBJECT_TABLE *) - (gAtomContext->bios + data_offset + (gAtomContext->bios + tableOffset + B_LENDIAN_TO_HOST_INT16(obj_header->usRouterObjectTableOffset)); - int device_support = B_LENDIAN_TO_HOST_INT16(obj_header->usDeviceSupport); + int deviceSupport = B_LENDIAN_TO_HOST_INT16(obj_header->usDeviceSupport); - int path_size = 0; + int pathSize = 0; int32 i = 0; TRACE("%s: found %" B_PRIu8 " potential display paths.\n", __func__, @@ -378,15 +379,15 @@ detect_connectors() uint8 *addr = (uint8*)path_obj->asDispPath; ATOM_DISPLAY_OBJECT_PATH *path; - addr += path_size; + addr += pathSize; path = (ATOM_DISPLAY_OBJECT_PATH *)addr; - path_size += B_LENDIAN_TO_HOST_INT16(path->usSize); + pathSize += B_LENDIAN_TO_HOST_INT16(path->usSize); - uint32 connector_type; - uint16 connector_object_id; - uint16 connector_flags = B_LENDIAN_TO_HOST_INT16(path->usDeviceTag); + uint32 connectorType; + uint16 connectorObjectID; + uint16 connectorFlags = B_LENDIAN_TO_HOST_INT16(path->usDeviceTag); - if ((device_support & connector_flags) != 0) { + if ((deviceSupport & connectorFlags) != 0) { uint8 con_obj_id = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; @@ -397,7 +398,7 @@ detect_connectors() // = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) // & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; - if (connector_flags == ATOM_DEVICE_CV_SUPPORT) { + if (connectorFlags == ATOM_DEVICE_CV_SUPPORT) { TRACE("%s: Path #%" B_PRId32 ": skipping component video.\n", __func__, i); continue; @@ -408,11 +409,11 @@ detect_connectors() ERROR("%s: TODO : IGP chip connector detection\n", __func__); else { igp_lane_info = 0; - connector_type = connector_convert[con_obj_id]; - connector_object_id = con_obj_id; + connectorType = connector_convert[con_obj_id]; + connectorObjectID = con_obj_id; } - if (connector_type == VIDEO_CONNECTOR_UNKNOWN) { + if (connectorType == VIDEO_CONNECTOR_UNKNOWN) { ERROR("%s: Path #%" B_PRId32 ": skipping unknown connector.\n", __func__, i); continue; @@ -443,7 +444,7 @@ detect_connectors() == encoder_obj) { ATOM_COMMON_RECORD_HEADER *record = (ATOM_COMMON_RECORD_HEADER *) - ((uint16 *)gAtomContext->bios + data_offset + ((uint16 *)gAtomContext->bios + tableOffset + B_LENDIAN_TO_HOST_INT16( enc_obj->asObjects[k].usRecordOffset)); ATOM_ENCODER_CAP_RECORD *cap_record; @@ -472,7 +473,7 @@ detect_connectors() case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if ((connector_flags + if ((connectorFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_LVDS; // radeon_atombios_get_lvds_info @@ -496,10 +497,10 @@ detect_connectors() case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: - if ((connector_flags + if ((connectorFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_LVDS; - } else if ((connector_flags + } else if ((connectorFlags & ATOM_DEVICE_CRT_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_DAC; } else { @@ -516,10 +517,10 @@ detect_connectors() case ENCODER_OBJECT_ID_HDMI_SI1930: case ENCODER_OBJECT_ID_TRAVIS: case ENCODER_OBJECT_ID_NUTMEG: - if ((connector_flags + if ((connectorFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_LVDS; - } else if ((connector_flags + } else if ((connectorFlags & ATOM_DEVICE_CRT_SUPPORT) != 0) { encoder_type = VIDEO_ENCODER_DAC; } else { @@ -542,7 +543,7 @@ detect_connectors() get_encoder_name(encoder_type)); gConnector[connectorIndex]->encoder.flags - = connector_flags; + = connectorFlags; gConnector[connectorIndex]->encoder.valid = true; gConnector[connectorIndex]->encoder.object_id @@ -558,7 +559,7 @@ detect_connectors() } // Set up information buses such as ddc - if ((connector_flags + if ((connectorFlags & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) == 0) { for (j = 0; j < con_obj->ucNumberOfObjects; j++) { if (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId) @@ -566,7 +567,7 @@ detect_connectors() con_obj->asObjects[j].usObjectID)) { ATOM_COMMON_RECORD_HEADER *record = (ATOM_COMMON_RECORD_HEADER*)(gAtomContext->bios - + data_offset + B_LENDIAN_TO_HOST_INT16( + + tableOffset + B_LENDIAN_TO_HOST_INT16( con_obj->asObjects[j].usRecordOffset)); while (record->ucRecordSize > 0 && record->ucRecordType > 0 @@ -604,19 +605,19 @@ detect_connectors() // record connector information TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 ")\n", - __func__, i, get_connector_name(connector_type), - connector_type); + __func__, i, get_connector_name(connectorType), + connectorType); gConnector[connectorIndex]->valid = true; - gConnector[connectorIndex]->flags = connector_flags; - gConnector[connectorIndex]->type = connector_type; + gConnector[connectorIndex]->flags = connectorFlags; + gConnector[connectorIndex]->type = connectorType; gConnector[connectorIndex]->object_id - = connector_object_id; + = connectorObjectID; gConnector[connectorIndex]->encoder.is_tv = false; gConnector[connectorIndex]->encoder.is_hdmi = false; - switch(connector_type) { + switch(connectorType) { case VIDEO_CONNECTOR_COMPOSITE: case VIDEO_CONNECTOR_SVIDEO: case VIDEO_CONNECTOR_9DIN: diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index f4abc06257..497fd5ba95 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -41,21 +41,23 @@ encoder_assign_crtc(uint8 crtcID) { int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source); union crtc_source_param args; - uint8 frev; - uint8 crev; + + // Table version + uint8 tableMajor; + uint8 tableMinor; memset(&args, 0, sizeof(args)); - if (atom_parse_cmd_header(gAtomContext, index, &frev, &crev) + if (atom_parse_cmd_header(gAtomContext, index, &tableMajor, &tableMinor) != B_OK) return; uint16 connectorIndex = gDisplay[crtcID]->connectorIndex; uint16 encoderID = gConnector[connectorIndex]->encoder.object_id; - switch (frev) { + switch (tableMajor) { case 1: - switch (crev) { + switch (tableMinor) { case 1: default: args.v1.ucCRTC = crtcID; @@ -162,7 +164,8 @@ encoder_assign_crtc(uint8 crtcID) } break; default: - ERROR("%s: Unknown table version: %d, %d\n", __func__, frev, crev); + ERROR("%s: Unknown table version: %" B_PRIu8 ".%" B_PRIu8 "\n", + __func__, tableMajor, tableMinor); return; } @@ -244,15 +247,18 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) break; } - uint8 frev; - uint8 crev; - if (atom_parse_cmd_header(gAtomContext, index, &frev, &crev) != B_OK) + // Table verson + uint8 tableMajor; + uint8 tableMinor; + + if (atom_parse_cmd_header(gAtomContext, index, &tableMajor, &tableMinor) + != B_OK) return B_ERROR; - switch (frev) { + switch (tableMajor) { case 1: case 2: - switch (crev) { + switch (tableMinor) { case 1: args.v1.ucMisc = 0; args.v1.ucAction = command; @@ -279,7 +285,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) case 3: args.v2.ucMisc = 0; args.v2.ucAction = command; - if (crev == 3) { + if (tableMinor == 3) { //if (dig->coherent_mode) // args.v2.ucMisc |= PANEL_ENCODER_MISC_COHERENT; } @@ -319,14 +325,15 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) } break; default: - ERROR("%s: Unknown minor table version: %d.%d\n", __func__, - frev, crev); + ERROR("%s: Unknown minor table version: %" + B_PRIu8 ".%" B_PRIu8 "\n", __func__, + tableMajor, tableMinor); return B_ERROR; } break; default: - ERROR("%s: Unknown major table version: %d.%d\n", __func__, - frev, crev); + ERROR("%s: Unknown major table version: %" B_PRIu8 ".%" B_PRIu8 "\n", + __func__, tableMajor, tableMinor); return B_ERROR; } return atom_execute_table(gAtomContext, index, (uint32*)&args); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index c0f3ae18a6..67a9bace3f 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -417,32 +417,33 @@ status_t radeon_gpu_gpio_setup() { int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); - uint8 frev; - uint8 crev; - uint16 offset; - uint16 size; - if (atom_parse_data_header(gAtomContext, index, &size, &frev, &crev, - &offset) != B_OK) { + uint8 tableMajor; + uint8 tableMinor; + uint16 tableOffset; + uint16 tableSize; + + if (atom_parse_data_header(gAtomContext, index, &tableSize, + &tableMajor, &tableMinor, &tableOffset) != B_OK) { ERROR("%s: could't read GPIO_I2C_Info table from AtomBIOS index %d!\n", __func__, index); return B_ERROR; } struct _ATOM_GPIO_I2C_INFO *i2c_info - = (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + offset); + = (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + tableOffset); - uint32 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) + uint32 numIndices = (tableSize - sizeof(ATOM_COMMON_TABLE_HEADER)) / sizeof(ATOM_GPIO_I2C_ASSIGMENT); - if (num_indices > ATOM_MAX_SUPPORTED_DEVICE) { + if (numIndices > ATOM_MAX_SUPPORTED_DEVICE) { ERROR("%s: ERROR: AtomBIOS contains more GPIO_Info items then I" "was prepared for! (seen: %" B_PRIu32 "; max: %" B_PRIu32 ")\n", - __func__, num_indices, (uint32)ATOM_MAX_SUPPORTED_DEVICE); + __func__, numIndices, (uint32)ATOM_MAX_SUPPORTED_DEVICE); return B_ERROR; } - for (uint32 i = 0; i < num_indices; i++) { + for (uint32 i = 0; i < numIndices; i++) { ATOM_GPIO_I2C_ASSIGMENT *gpio = &i2c_info->asGPIO_Info[i]; // TODO : if DCE 4 and i == 7 ... manual override for evergreen diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 0ab1cd1004..829edb5416 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -187,18 +187,21 @@ pll_adjust(pll_info *pll, uint8 crtcID) if (info.device_chipset >= (RADEON_R600 | 0x20)) { union adjust_pixel_clock args; - uint8 frev; - uint8 crev; + + uint8 tableMajor; + uint8 tableMinor; int index = GetIndexIntoMasterTable(COMMAND, AdjustDisplayPll); - if (atom_parse_cmd_header(gAtomContext, index, &frev, &crev) != B_OK) + if (atom_parse_cmd_header(gAtomContext, index, &tableMajor, &tableMinor) + != B_OK) { return adjustedClock; + } memset(&args, 0, sizeof(args)); - switch (frev) { + switch (tableMajor) { case 1: - switch (crev) { + switch (tableMinor) { case 1: case 2: args.v1.usPixelClock @@ -281,15 +284,16 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) union set_pixel_clock args; memset(&args, 0, sizeof(args)); - uint8 frev; - uint8 crev; - atom_parse_cmd_header(gAtomContext, index, &frev, &crev); + uint8 tableMajor; + uint8 tableMinor; + + atom_parse_cmd_header(gAtomContext, index, &tableMajor, &tableMinor); uint32 bpc = 8; // TODO : BPC == Digital Depth, EDID 1.4+ on digital displays // isn't in Haiku edid common code? - switch (crev) { + switch (tableMinor) { case 1: args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); @@ -382,8 +386,8 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) args.v6.ucPpll = pllID; break; default: - TRACE("%s: ERROR: table version %d.%d TODO\n", __func__, - frev, crev); + TRACE("%s: ERROR: table version %" B_PRIu8 ".%" B_PRIu8 " TODO\n", + __func__, tableMajor, tableMinor); return B_ERROR; } From e774cb4b0aea6ec99b8b9d8878c5ffbe79516ded Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 12 Oct 2011 22:04:41 +0000 Subject: [PATCH 374/702] * style fixes move quite a bit of code away from var_var format * #if 0 some not-yet-ready r500 code * no real functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42835 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.h | 11 ++- src/add-ons/accelerants/radeon_hd/display.cpp | 79 +++++++++---------- src/add-ons/accelerants/radeon_hd/display.h | 2 +- src/add-ons/accelerants/radeon_hd/encoder.cpp | 16 ++-- src/add-ons/accelerants/radeon_hd/gpu.cpp | 10 +-- src/add-ons/accelerants/radeon_hd/mode.cpp | 4 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 8 +- 7 files changed, 64 insertions(+), 66 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 98184a9c28..c54ab3eb6b 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -133,22 +133,21 @@ typedef struct { struct encoder_info { bool valid; + uint16 objectID; uint32 type; - uint16 object_id; uint32 flags; - bool is_hdmi; - bool is_tv; + bool isHDMI; + bool isTV; struct pll_info pll; }; typedef struct { bool valid; + uint16 objectID; uint32 type; - uint16 object_id; uint32 flags; - uint16 line_mux; - uint16 gpio_id; + uint16 gpioID; struct encoder_info encoder; // TODO struct radeon_hpd hpd; } connector_info; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 3a758b8682..3afec46c90 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -223,6 +223,8 @@ detect_crt_ranges(uint32 crtid) } +// TODO: only used on r4xx, r5xx, and rs600/rs690/rs740 +#if 0 union atom_supported_devices { struct _ATOM_SUPPORTED_DEVICES_INFO info; struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2; @@ -230,7 +232,6 @@ union atom_supported_devices { }; -// only used on r4xx, r5xx, and rs600/rs690/rs740 status_t detect_connectors_legacy() { @@ -284,7 +285,7 @@ detect_connectors_legacy() } // uint8 dac = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC; - gConnector[i]->line_mux = ci.sucI2cId.ucAccess; + // gConnector[i]->line_mux = ci.sucI2cId.ucAccess; // TODO : give tv unique connector ids @@ -320,6 +321,7 @@ detect_connectors_legacy() return B_OK; } +#endif // r600+ @@ -467,7 +469,7 @@ detect_connectors() uint32 encoderID = (encoder_obj & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; - uint32 encoder_type = VIDEO_ENCODER_NONE; + uint32 encoderType = VIDEO_ENCODER_NONE; switch(encoderID) { case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_TMDS1: @@ -475,20 +477,20 @@ detect_connectors() case ENCODER_OBJECT_ID_INTERNAL_LVTM1: if ((connectorFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { - encoder_type = VIDEO_ENCODER_LVDS; + encoderType = VIDEO_ENCODER_LVDS; // radeon_atombios_get_lvds_info } else { - encoder_type = VIDEO_ENCODER_TMDS; + encoderType = VIDEO_ENCODER_TMDS; // radeon_atombios_set_dig_info } break; case ENCODER_OBJECT_ID_INTERNAL_DAC1: - encoder_type = VIDEO_ENCODER_DAC; + encoderType = VIDEO_ENCODER_DAC; break; case ENCODER_OBJECT_ID_INTERNAL_DAC2: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: - encoder_type = VIDEO_ENCODER_TVDAC; + encoderType = VIDEO_ENCODER_TVDAC; break; case ENCODER_OBJECT_ID_INTERNAL_DVO1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: @@ -499,12 +501,12 @@ detect_connectors() case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: if ((connectorFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { - encoder_type = VIDEO_ENCODER_LVDS; + encoderType = VIDEO_ENCODER_LVDS; } else if ((connectorFlags & ATOM_DEVICE_CRT_SUPPORT) != 0) { - encoder_type = VIDEO_ENCODER_DAC; + encoderType = VIDEO_ENCODER_DAC; } else { - encoder_type = VIDEO_ENCODER_TMDS; + encoderType = VIDEO_ENCODER_TMDS; } // drm_encoder_helper_add break; @@ -519,18 +521,18 @@ detect_connectors() case ENCODER_OBJECT_ID_NUTMEG: if ((connectorFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { - encoder_type = VIDEO_ENCODER_LVDS; + encoderType = VIDEO_ENCODER_LVDS; } else if ((connectorFlags & ATOM_DEVICE_CRT_SUPPORT) != 0) { - encoder_type = VIDEO_ENCODER_DAC; + encoderType = VIDEO_ENCODER_DAC; } else { - encoder_type = VIDEO_ENCODER_TMDS; + encoderType = VIDEO_ENCODER_TMDS; } // drm_encoder_helper_add break; } - if (encoder_type == VIDEO_ENCODER_NONE) { + if (encoderType == VIDEO_ENCODER_NONE) { ERROR("%s: Path #%" B_PRId32 ":" "skipping unknown encoder.\n", __func__, i); @@ -540,21 +542,21 @@ detect_connectors() // Set up encoder on connector if valid TRACE("%s: Path #%" B_PRId32 ": Found encoder " "%s\n", __func__, i, - get_encoder_name(encoder_type)); + get_encoder_name(encoderType)); gConnector[connectorIndex]->encoder.flags = connectorFlags; gConnector[connectorIndex]->encoder.valid = true; - gConnector[connectorIndex]->encoder.object_id + gConnector[connectorIndex]->encoder.objectID = encoderID; gConnector[connectorIndex]->encoder.type - = encoder_type; + = encoderType; } } // END if object is encoder } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { - ERROR("%s: TODO : Found router object?\n", __func__); + ERROR("%s: TODO: Found router object?\n", __func__); } // END if object is router } @@ -611,21 +613,20 @@ detect_connectors() gConnector[connectorIndex]->valid = true; gConnector[connectorIndex]->flags = connectorFlags; gConnector[connectorIndex]->type = connectorType; - gConnector[connectorIndex]->object_id - = connectorObjectID; + gConnector[connectorIndex]->objectID = connectorObjectID; - gConnector[connectorIndex]->encoder.is_tv = false; - gConnector[connectorIndex]->encoder.is_hdmi = false; + gConnector[connectorIndex]->encoder.isTV = false; + gConnector[connectorIndex]->encoder.isHDMI = false; switch(connectorType) { case VIDEO_CONNECTOR_COMPOSITE: case VIDEO_CONNECTOR_SVIDEO: case VIDEO_CONNECTOR_9DIN: - gConnector[connectorIndex]->encoder.is_tv = true; + gConnector[connectorIndex]->encoder.isTV = true; break; case VIDEO_CONNECTOR_HDMIA: case VIDEO_CONNECTOR_HDMIB: - gConnector[connectorIndex]->encoder.is_hdmi = true; + gConnector[connectorIndex]->encoder.isHDMI = true; break; } @@ -651,7 +652,7 @@ detect_displays() if (gConnector[id]->valid == false) continue; // TODO : currently we skip TV connectors during detection - if (gConnector[id]->encoder.is_tv == true) + if (gConnector[id]->encoder.isTV == true) continue; if (displayIndex >= MAX_DISPLAY) continue; @@ -703,10 +704,10 @@ debug_displays() uint32 connectorIndex = gDisplay[id]->connectorIndex; if (gDisplay[id]->active) { - uint32 connector_type = gConnector[connectorIndex]->type; - uint32 encoder_type = gConnector[connectorIndex]->encoder.type; - ERROR(" + connector: %s\n", get_connector_name(connector_type)); - ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); + uint32 connectorType = gConnector[connectorIndex]->type; + uint32 encoderType = gConnector[connectorIndex]->encoder.type; + ERROR(" + connector: %s\n", get_connector_name(connectorType)); + ERROR(" + encoder: %s\n", get_encoder_name(encoderType)); ERROR(" + limits: Vert Min/Max: %" B_PRIu32 "/%" B_PRIu32"\n", gDisplay[id]->vfreq_min, gDisplay[id]->vfreq_max); @@ -715,7 +716,6 @@ debug_displays() } } TRACE("==========================================\n"); - } @@ -725,17 +725,17 @@ debug_connectors() ERROR("Currently detected connectors=============\n"); for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { if (gConnector[id]->valid == true) { - uint32 connector_type = gConnector[id]->type; - uint32 encoder_type = gConnector[id]->encoder.type; - uint16 gpio_id = gConnector[id]->gpio_id; + uint32 connectorType = gConnector[id]->type; + uint32 encoderType = gConnector[id]->encoder.type; + uint16 gpioID = gConnector[id]->gpioID; ERROR("Connector #%" B_PRIu32 ")\n", id); - ERROR(" + connector: %s\n", get_connector_name(connector_type)); - ERROR(" + encoder: %s\n", get_encoder_name(encoder_type)); - ERROR(" + gpio id: %" B_PRIu16 "\n", gpio_id); + ERROR(" + connector: %s\n", get_connector_name(connectorType)); + ERROR(" + encoder: %s\n", get_encoder_name(encoderType)); + ERROR(" + gpio id: %" B_PRIu16 "\n", gpioID); ERROR(" + gpio valid: %s\n", - gGPIOInfo[gpio_id]->valid ? "true" : "false"); + gGPIOInfo[gpioID]->valid ? "true" : "false"); ERROR(" + hw line: 0x%" B_PRIX32 "\n", - gGPIOInfo[gpio_id]->hw_line); + gGPIOInfo[gpioID]->hw_line); } } ERROR("==========================================\n"); @@ -745,8 +745,7 @@ debug_connectors() uint32 display_get_encoder_mode(uint32 connectorIndex) { - uint32 connector_type = gConnector[connectorIndex]->type; - switch (connector_type) { + switch (gConnector[connectorIndex]->type) { case VIDEO_CONNECTOR_DVII: case VIDEO_CONNECTOR_HDMIB: /* HDMI-B is DL-DVI; analog works fine */ // TODO : if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index a000a97989..317c42d578 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -58,7 +58,7 @@ const int connector_convert[] = { }; status_t init_registers(register_info* reg, uint8 crtid); -status_t detect_connectors_legacy(); +// status_t detect_connectors_legacy(); status_t detect_connectors(); status_t detect_crt_ranges(uint32 crtid); status_t detect_displays(); diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 497fd5ba95..622c534c66 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -53,7 +53,7 @@ encoder_assign_crtc(uint8 crtcID) return; uint16 connectorIndex = gDisplay[crtcID]->connectorIndex; - uint16 encoderID = gConnector[connectorIndex]->encoder.object_id; + uint16 encoderID = gConnector[connectorIndex]->encoder.objectID; switch (tableMajor) { case 1: @@ -181,7 +181,7 @@ encoder_mode_set(uint8 id, uint32 pixelClock) { uint32 connectorIndex = gDisplay[id]->connectorIndex; - switch (gConnector[connectorIndex]->encoder.object_id) { + switch (gConnector[connectorIndex]->encoder.objectID) { case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: case ENCODER_OBJECT_ID_INTERNAL_DAC2: @@ -229,9 +229,9 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) memset(&args, 0, sizeof(args)); int index = 0; - uint16 connector_flags = gConnector[connectorIndex]->encoder.flags; + uint16 encoderFlags = gConnector[connectorIndex]->encoder.flags; - switch (gConnector[connectorIndex]->encoder.object_id) { + switch (gConnector[connectorIndex]->encoder.objectID) { case ENCODER_OBJECT_ID_INTERNAL_LVDS: index = GetIndexIntoMasterTable(COMMAND, LVDSEncoderControl); break; @@ -240,7 +240,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) index = GetIndexIntoMasterTable(COMMAND, TMDS1EncoderControl); break; case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - if ((connector_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) index = GetIndexIntoMasterTable(COMMAND, LVDSEncoderControl); else index = GetIndexIntoMasterTable(COMMAND, TMDS2EncoderControl); @@ -266,7 +266,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); - if ((connector_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { // TODO : laptop display support //if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) // args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; @@ -296,7 +296,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) args.v2.ucSpatial = 0; args.v2.ucTemporal = 0; args.v2.ucFRC = 0; - if ((connector_flags & ATOM_DEVICE_LCD_SUPPORT) != 0) { + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { // TODO : laptop display support //if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) // args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; @@ -351,7 +351,7 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) DAC_ENCODER_CONTROL_PS_ALLOCATION args; memset(&args, 0, sizeof(args)); - switch (gConnector[connectorIndex]->encoder.object_id) { + switch (gConnector[connectorIndex]->encoder.objectID) { case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: index = GetIndexIntoMasterTable(COMMAND, DAC1EncoderControl); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 67a9bace3f..2dab9eb653 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -371,14 +371,14 @@ bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid) { // ensure things are sane - uint32 gpio_id = gConnector[connector]->gpio_id; - if (gGPIOInfo[gpio_id]->valid == false) + uint32 gpioID = gConnector[connector]->gpioID; + if (gGPIOInfo[gpioID]->valid == false) return false; i2c_bus bus; ddc2_init_timing(&bus); - bus.cookie = (void*)gGPIOInfo[gpio_id]; + bus.cookie = (void*)gGPIOInfo[gpioID]; bus.set_signals = &set_i2c_signals; bus.get_signals = &get_i2c_signals; @@ -399,11 +399,11 @@ radeon_gpu_read_edid(uint32 connector, edid1_info *edid) status_t radeon_gpu_i2c_attach(uint32 id, uint8 hw_line) { - gConnector[id]->gpio_id = 0; + gConnector[id]->gpioID = 0; for (uint32 i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { if (gGPIOInfo[i]->hw_line != hw_line) continue; - gConnector[id]->gpio_id = i; + gConnector[id]->gpioID = i; return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 07a0367ddc..a221e9802b 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -162,7 +162,7 @@ radeon_set_display_mode(display_mode *mode) // *** encoder prep encoder_output_lock(true); - encoder_dpms_set(id, gConnector[connectorIndex]->encoder.object_id, + encoder_dpms_set(id, gConnector[connectorIndex]->encoder.objectID, B_DPMS_OFF); encoder_assign_crtc(id); @@ -193,7 +193,7 @@ radeon_set_display_mode(display_mode *mode) display_crtc_lock(id, ATOM_DISABLE); // *** encoder commit - encoder_dpms_set(id, gConnector[connectorIndex]->encoder.object_id, + encoder_dpms_set(id, gConnector[connectorIndex]->encoder.objectID, B_DPMS_ON); encoder_output_lock(false); } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 829edb5416..8f36ab17ef 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -182,7 +182,7 @@ pll_adjust(pll_info *pll, uint8 crtcID) uint32 adjustedClock = pll->pixel_clock; uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; - uint32 encoderID = gConnector[connectorIndex]->encoder.object_id; + uint32 encoderID = gConnector[connectorIndex]->encoder.objectID; uint32 encoder_mode = display_get_encoder_mode(connectorIndex); if (info.device_chipset >= (RADEON_R600 | 0x20)) { @@ -325,7 +325,7 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC; args.v3.ucTransmitterId - = gConnector[connectorIndex]->encoder.object_id; + = gConnector[connectorIndex]->encoder.objectID; args.v3.ucEncoderMode = display_get_encoder_mode(connectorIndex); break; case 5: @@ -349,7 +349,7 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) break; } args.v5.ucTransmitterID - = gConnector[connectorIndex]->encoder.object_id; + = gConnector[connectorIndex]->encoder.objectID; args.v5.ucEncoderMode = display_get_encoder_mode(connectorIndex); args.v5.ucPpll = pllID; @@ -381,7 +381,7 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) break; } args.v6.ucTransmitterID - = gConnector[connectorIndex]->encoder.object_id; + = gConnector[connectorIndex]->encoder.objectID; args.v6.ucEncoderMode = display_get_encoder_mode(connectorIndex); args.v6.ucPpll = pllID; break; From 2e77a03d92960d6510bd7601fe861904a389e5ff Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 13 Oct 2011 08:16:45 +0000 Subject: [PATCH 375/702] Add a test app for the hpet driver (which I'll commit later) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42836 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/add-ons/kernel/drivers/Jamfile | 1 + src/tests/add-ons/kernel/drivers/hpet/Jamfile | 10 ++++ .../add-ons/kernel/drivers/hpet/main.cpp | 47 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 src/tests/add-ons/kernel/drivers/hpet/Jamfile create mode 100644 src/tests/add-ons/kernel/drivers/hpet/main.cpp diff --git a/src/tests/add-ons/kernel/drivers/Jamfile b/src/tests/add-ons/kernel/drivers/Jamfile index e98372a8dc..4480be903e 100644 --- a/src/tests/add-ons/kernel/drivers/Jamfile +++ b/src/tests/add-ons/kernel/drivers/Jamfile @@ -1,5 +1,6 @@ SubDir HAIKU_TOP src tests add-ons kernel drivers ; SubInclude HAIKU_TOP src tests add-ons kernel drivers audio ; +SubInclude HAIKU_TOP src tests add-ons kernel drivers hpet ; SubInclude HAIKU_TOP src tests add-ons kernel drivers random ; SubInclude HAIKU_TOP src tests add-ons kernel drivers tty ; diff --git a/src/tests/add-ons/kernel/drivers/hpet/Jamfile b/src/tests/add-ons/kernel/drivers/hpet/Jamfile new file mode 100644 index 0000000000..f7bd459baf --- /dev/null +++ b/src/tests/add-ons/kernel/drivers/hpet/Jamfile @@ -0,0 +1,10 @@ +SubDir HAIKU_TOP src tests add-ons kernel drivers hpet ; + +UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel drivers timer ] : true ; + +Application hpet_test : + main.cpp + : be $(TARGET_LIBSUPC++) + ; + + diff --git a/src/tests/add-ons/kernel/drivers/hpet/main.cpp b/src/tests/add-ons/kernel/drivers/hpet/main.cpp new file mode 100644 index 0000000000..f61dc99f71 --- /dev/null +++ b/src/tests/add-ons/kernel/drivers/hpet/main.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +#include +#include + +#include + +#include + +int main() +{ + int hpetFD = open("/dev/misc/hpet", O_RDWR); + if (hpetFD < 0) { + printf("Cannot open HPET driver: %s\n", strerror(errno)); + return -1; + } + + uint64 value, newValue; + read(hpetFD, &value, sizeof(uint64)); + + snooze(1000000); + + read(hpetFD, &newValue, sizeof(uint64)); + printf("HPET counter value difference (1 sec): %lld\n", newValue - value); + + status_t status; + bigtime_t timeValue = 2000000; + printf("Waiting 2 seconds...\n"); + status = ioctl(hpetFD, HPET_WAIT_TIMER, &timeValue, sizeof(timeValue)); + printf("%s.\n", strerror(status)); + + timeValue = 5000000; + printf("Waiting 5 seconds...\n"); + status = ioctl(hpetFD, HPET_WAIT_TIMER, &timeValue, sizeof(timeValue)); + printf("%s.\n", strerror(status)); + + timeValue = 1000000; + printf("Waiting 1 second...\n"); + status = ioctl(hpetFD, HPET_WAIT_TIMER, &timeValue, sizeof(timeValue)); + printf("%s.\n", strerror(status)); + + close(hpetFD); + + return 0; +} + From 79e3f9012d7246bc8cec7f31291d84f33c5251e2 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 13 Oct 2011 08:20:10 +0000 Subject: [PATCH 376/702] HPET driver for testing HPET code more easily. Seems to work correctly on real hardware, not on qemu where it can only use the irq 2, and this causes wreakage (could be a programming error). Changed from the kernel code: - Adapted to use as a driver - Configure for level interrupts instead of edge, which seems not to work correctly - Add traceing dprintfs - Various other changes Does not use yet the new interrupt api introduced by Michael Lotz. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42837 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/Jamfile | 1 + src/add-ons/kernel/drivers/timer/Jamfile | 6 + src/add-ons/kernel/drivers/timer/arch_acpi.h | 206 +++++++ src/add-ons/kernel/drivers/timer/hpet.cpp | 508 ++++++++++++++++++ src/add-ons/kernel/drivers/timer/hpet.h | 118 ++++ .../kernel/drivers/timer/hpet_interface.h | 10 + src/add-ons/kernel/drivers/timer/int.h | 16 + src/add-ons/kernel/drivers/timer/msi.h | 33 ++ 8 files changed, 898 insertions(+) create mode 100644 src/add-ons/kernel/drivers/timer/Jamfile create mode 100644 src/add-ons/kernel/drivers/timer/arch_acpi.h create mode 100644 src/add-ons/kernel/drivers/timer/hpet.cpp create mode 100644 src/add-ons/kernel/drivers/timer/hpet.h create mode 100644 src/add-ons/kernel/drivers/timer/hpet_interface.h create mode 100644 src/add-ons/kernel/drivers/timer/int.h create mode 100644 src/add-ons/kernel/drivers/timer/msi.h diff --git a/src/add-ons/kernel/drivers/Jamfile b/src/add-ons/kernel/drivers/Jamfile index 241c5bebb9..9243e8f42b 100644 --- a/src/add-ons/kernel/drivers/Jamfile +++ b/src/add-ons/kernel/drivers/Jamfile @@ -16,4 +16,5 @@ SubInclude HAIKU_TOP src add-ons kernel drivers power ; SubInclude HAIKU_TOP src add-ons kernel drivers printer ; SubInclude HAIKU_TOP src add-ons kernel drivers random ; SubInclude HAIKU_TOP src add-ons kernel drivers tty ; +SubInclude HAIKU_TOP src add-ons kernel drivers timer ; SubInclude HAIKU_TOP src add-ons kernel drivers video ; diff --git a/src/add-ons/kernel/drivers/timer/Jamfile b/src/add-ons/kernel/drivers/timer/Jamfile new file mode 100644 index 0000000000..e7d6e700a2 --- /dev/null +++ b/src/add-ons/kernel/drivers/timer/Jamfile @@ -0,0 +1,6 @@ +SubDir HAIKU_TOP src add-ons kernel drivers timer ; + +UsePrivateHeaders drivers ; + +KernelAddon hpet : + hpet.cpp ; diff --git a/src/add-ons/kernel/drivers/timer/arch_acpi.h b/src/add-ons/kernel/drivers/timer/arch_acpi.h new file mode 100644 index 0000000000..0e1ae043df --- /dev/null +++ b/src/add-ons/kernel/drivers/timer/arch_acpi.h @@ -0,0 +1,206 @@ +/* + * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. + * Copyright 2007, Michael Lotz, mmlr@mlotz.ch. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_ARCH_x86_ARCH_ACPI_H +#define _KERNEL_ARCH_x86_ARCH_ACPI_H + +#define ACPI_RSDP_SIGNATURE "RSD PTR " +#define ACPI_RSDT_SIGNATURE "RSDT" +#define ACPI_XSDT_SIGNATURE "XSDT" +#define ACPI_MADT_SIGNATURE "APIC" + +#define ACPI_LOCAL_APIC_ENABLED 0x01 + +typedef struct acpi_rsdp_legacy { + char signature[8]; /* "RSD PTR " including blank */ + uint8 checksum; /* checksum of bytes 0-19 (per ACPI 1.0) */ + char oem_id[6]; /* not null terminated */ + uint8 revision; /* 0 = ACPI 1.0, 2 = ACPI 3.0 */ + uint32 rsdt_address; /* physical memory address of RSDT */ +} _PACKED acpi_rsdp_legacy; + +typedef struct acpi_rsdp_extended { + char signature[8]; /* "RSD PTR " including blank */ + uint8 checksum; /* checksum of bytes 0-19 (per ACPI 1.0) */ + char oem_id[6]; /* not null terminated */ + uint8 revision; /* 0 = ACPI 1.0, 2 = ACPI 3.0 */ + uint32 rsdt_address; /* physical memory address of RSDT */ + uint32 xsdt_length; /* length in bytes including header */ + uint64 xsdt_address; /* 64bit physical memory address of XSDT */ + uint8 extended_checksum; /* including entire table */ + uint8 reserved[3]; +} _PACKED acpi_rsdp_extended; + +typedef acpi_rsdp_extended acpi_rsdp; + +typedef struct acpi_descriptor_header { + char signature[4]; /* table identifier as ASCII string */ + uint32 length; /* length in bytes of the entire table */ + uint8 revision; + uint8 checksum; /* checksum of entire table */ + char oem_id[6]; /* not null terminated */ + char oem_table_id[8]; /* oem supplied table identifier */ + uint32 oem_revision; /* oem supplied revision number */ + char creator_id[4]; /* creator / asl compiler id */ + uint32 creator_revision; /* compiler revision */ +} _PACKED acpi_descriptor_header; + +typedef struct acpi_madt { + acpi_descriptor_header header; /* "APIC" signature */ + uint32 local_apic_address; /* physical address for local CPUs APICs */ + uint32 flags; +} _PACKED acpi_madt; + +enum { + ACPI_MADT_LOCAL_APIC = 0, + ACPI_MADT_IO_APIC = 1, + ACPI_MADT_INTERRUPT_SOURCE_OVERRIDE = 2, + ACPI_MADT_NMI_SOURCE = 3, + ACPI_MADT_LOCAL_APIC_NMI = 4, + ACPI_MADT_LOCAL_APIC_ADDRESS_OVERRIDE = 5, + ACPI_MADT_IO_SAPIC = 6, + ACPI_MADT_LOCAL_SAPIC = 7, + ACPI_MADT_PLATFORM_INTERRUPT_SOURCE = 8, + ACPI_MADT_PROCESSOR_LOCAL_X2_APIC_NMI = 9, + ACPI_MADT_LOCAL_X2_APIC_NMI = 0XA +}; + +typedef struct acpi_apic { + uint8 type; + uint8 length; +} _PACKED acpi_apic; + +typedef struct acpi_local_apic { + uint8 type; /* 0 = processor local APIC */ + uint8 length; /* 8 bytes */ + uint8 acpi_processor_id; + uint8 apic_id; /* the id of this APIC */ + uint32 flags; /* 1 = enabled */ +} _PACKED acpi_local_apic; + +typedef struct acpi_io_apic { + uint8 type; /* 1 = I/O APIC */ + uint8 length; /* 12 bytes */ + uint8 io_apic_id; /* the id of this APIC */ + uint8 reserved; + uint32 io_apic_address; /* physical address of I/O APIC */ + uint32 interrupt_base; /* global system interrupt base */ +} _PACKED acpi_io_apic; + +typedef struct acpi_int_source_override { + uint8 type; /* 2 = Interrupt source override */ + uint8 length; /* 10 bytes */ + uint8 bus; /* 0 = ISA */ + uint8 source; /* Bus-relative interrupt source (IRQ) */ + uint32 interrupt; /* global system interrupt this + bus-relative source int will signal */ + uint16 flags; /* MPS INTI flags. See Table 5-25 in + ACPI Spec 4.0a or similar */ +} _PACKED acpi_int_source_override; + +typedef struct acpi_nmi_source { + uint8 type; /* 3 = NMI */ + uint8 length; /* 8 bytes */ + uint16 flags; /* Same as MPS INTI flags. See Table 5-25 in + ACPI Spec 4.0a or similar */ + uint32 interrupt; /* global system interrupt this + non-maskable interrupt will trigger */ +} _PACKED acpi_nmi_source; + +typedef struct acpi_local_apic_nmi { + uint8 type; /* 4 = local APIC NMI */ + uint8 length; /* 6 bytes */ + uint8 acpi_processor_id; /* Processor ID corresponding to processor + ID in acpi_local_apic. 0xFF means + it applies to all processors */ + uint16 flags; /* Same as MPS INTI flags. See Table 5-25 in + ACPI Spec 4.0a or similar */ + uint8 local_interrupt; /* Local APIC interrupt input LINTn to which + NMI is connected */ +} _PACKED acpi_local_apic_nmi; + +typedef struct acpi_local_apic_address_override { + uint8 type; /* 5 = local APIC address override */ + uint8 length; /* 12 bytes */ + uint16 reserved; /* reserved (must be set to zero) */ + uint64 local_apic_address; /* Physical address of local APIC. See table + 5-28 in ACPI Spec 4.0a for more */ +} _PACKED acpi_local_apic_address_override; + +typedef struct acpi_io_sapic { + uint8 type; /* 6 = I/0 SAPIC (should be used if it + exists instead of I/O APIC if both exists + for a APIC ID.*/ + uint8 length; /* 16 bytes */ + uint8 io_apic_id; /* the id of this SAPIC */ + uint8 reserved; /* reserved (must be set to zero) */ + uint32 interrupt_base; /* global system interrupt base */ + uint64 sapic_address; /* The physical address to access this I/0 + SAPIC. Each SAPIC resides at a unique + address */ +} _PACKED acpi_io_sapic; + +typedef struct acpi_local_sapic { + uint8 type; /* 7 = processor local SAPIC */ + uint8 length; /* n bytes */ + uint8 acpi_processor_id; + uint8 local_sapic_id; + uint8 local_sapic_eid; + uint8 reserved1; /* reserved (must be set to zero) */ + uint8 reserved2; /* reserved (must be set to zero) */ + uint8 reserved3; /* reserved (must be set to zero) */ + uint32 flags; /* Local SAPIC flags, see table 5-22 in + ACPI Spec 4.0a */ + uint32 processor_uid_nr; /* Matches _UID of a processor when it is a + number */ + char processor_uid_str[]; /* Matches _UID of a processor when it is a + string. Null-terminated */ +} _PACKED acpi_local_sapic; + +typedef struct acpi_platform_interrupt_source { + uint8 type; /* 8 = platform interrupt source */ + uint8 length; /* 16 bytes */ + uint16 flags; /* Same as MPS INTI flags. See Table 5-25 in + ACPI Spec 4.0a or similar */ + uint8 interrupt_type; /* 1 PMI, 2 INIT, 3 Corrected Platform + Error Interrupt */ + uint8 processor_id; /* processor ID of destination */ + uint8 processor_eid; /* processor EID of destination */ + uint8 io_sapic_vector; /* value that must be used to program the + vector field of the I/O SAPIC redirection + entry for entries with PMI type. */ + uint32 interrupt; /* global system interrupt this + platform interrupt will trigger */ + uint32 platform_int_flags; /* Platform Interrupt Source Flags. See + Table 5-32 of ACPI Spec 4.0a for desc */ +} _PACKED acpi_platform_interrupt_source; + +typedef struct acpi_local_x2_apic { + uint8 type; /* 9 = processor local x2APIC */ + uint8 length; /* 16 bytes */ + uint16 reserved; /* reserved (must be zero) */ + uint32 x2apic_id; /* processor's local x2APIC ID */ + uint32 flags; /* 1 = enabled. */ + uint32 processor_uid_nr; /* Matches _UID of a processor when it is a + number */ +} _PACKED acpi_local_x2_apic; + +typedef struct acpi_local_x2_apic_nmi { + uint8 type; /* 0xA = local x2APIC NMI */ + uint8 length; /* 12 bytes */ + uint16 flags; /* Same as MPS INTI flags. See Table 5-25 in + ACPI Spec 4.0a or similar */ + uint32 acpi_processor_uid; /* UID corresponding to ID in processor + device object. 0xFFFFFFFF means + it applies to all processors */ + uint8 local_interrupt; /* Local x2APIC interrupt input LINTn to + which NMI is connected */ + uint8 reserved1; /* reserved (must be set to zero) */ + uint8 reserved2; /* reserved (must be set to zero) */ + uint8 reserved3; /* reserved (must be set to zero) */ +} _PACKED acpi_local_x2_apic_nmi; + + +#endif /* _KERNEL_ARCH_x86_ARCH_ACPI_H */ diff --git a/src/add-ons/kernel/drivers/timer/hpet.cpp b/src/add-ons/kernel/drivers/timer/hpet.cpp new file mode 100644 index 0000000000..58a84dcdde --- /dev/null +++ b/src/add-ons/kernel/drivers/timer/hpet.cpp @@ -0,0 +1,508 @@ +/* + * Copyright 2009-2010, Stefano Ceccherini (stefano.ceccherini@gmail.com) + * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include "hpet.h" +#include "hpet_interface.h" +#include "int.h" +#include "msi.h" + +#include +#include +#include +#include + +#include +#include + + +#define TRACE_HPET +#ifdef TRACE_HPET + #define TRACE(x) dprintf x +#else + #define TRACE(x) ; +#endif + +#define TEST_HPET + + +static struct hpet_regs *sHPETRegs; +static uint64 sHPETPeriod; + +static area_id sHPETArea; + + +struct hpet_timer_cookie { + int number; + int32 irq; + sem_id sem; +}; + +//////////////////////////////////////////////////////////////////////////////// + +static status_t hpet_open(const char*, uint32, void**); +static status_t hpet_close(void*); +static status_t hpet_free(void*); +static status_t hpet_control(void*, uint32, void*, size_t); +static ssize_t hpet_read(void*, off_t, void*, size_t*); +static ssize_t hpet_write(void*, off_t, const void*, size_t*); + +//////////////////////////////////////////////////////////////////////////////// + +static const char* hpet_name[] = { + "misc/hpet", + NULL +}; + + +device_hooks hpet_hooks = { + hpet_open, + hpet_close, + hpet_free, + hpet_control, + hpet_read, + hpet_write, +}; + +int32 api_version = B_CUR_DRIVER_API_VERSION; + +static acpi_module_info* sAcpi; +static vint32 sOpenCount; + + +static inline bigtime_t +hpet_convert_timeout(const bigtime_t &relativeTimeout) +{ + bigtime_t counter = sHPETRegs->u0.counter64; + bigtime_t converted = (1000000000ULL / sHPETPeriod) * relativeTimeout; + + dprintf("counter: %lld, relativeTimeout: %lld, converted: %lld\n", + counter, relativeTimeout, converted); + + return converted + counter; +} + + +#define MIN_TIMEOUT 3000 + +static status_t +hpet_set_hardware_timer(bigtime_t relativeTimeout, volatile hpet_timer *timer) +{ + // TODO: + if (relativeTimeout < MIN_TIMEOUT) + relativeTimeout = MIN_TIMEOUT; + + bigtime_t timerValue = hpet_convert_timeout(relativeTimeout); + + //dprintf("comparator: %lld, new value: %lld\n", timer->u0.comparator64, timerValue); + + timer->u0.comparator64 = timerValue; + + // enable timer interrupt + timer->config |= HPET_CONF_TIMER_INT_ENABLE; + + return B_OK; +} + + +static status_t +hpet_clear_hardware_timer(volatile hpet_timer *timer) +{ + // Disable timer interrupt + timer->config &= ~HPET_CONF_TIMER_INT_ENABLE; + return B_OK; +} + + +static int32 +hpet_timer_interrupt(void *arg) +{ + //dprintf("HPET timer_interrupt!!!!\n"); + hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)arg; + + // clear interrupt status + int32 intStatus = 1 << hpetCookie->number; + if (sHPETRegs->interrupt_status & intStatus) { + sHPETRegs->interrupt_status |= intStatus; + hpet_clear_hardware_timer(&sHPETRegs->timer[hpetCookie->number]); + + release_sem(hpetCookie->sem); + return B_HANDLED_INTERRUPT; + } + + return B_UNHANDLED_INTERRUPT; +} + + +static status_t +hpet_set_enabled(bool enabled) +{ + if (enabled) + sHPETRegs->config |= HPET_CONF_MASK_ENABLED; + else + sHPETRegs->config &= ~HPET_CONF_MASK_ENABLED; + return B_OK; +} + + +static status_t +hpet_set_legacy(bool enabled) +{ + if (!HPET_IS_LEGACY_CAPABLE(sHPETRegs)) { + dprintf("hpet_init: HPET doesn't support legacy mode. Skipping.\n"); + return B_NOT_SUPPORTED; + } + + if (enabled) + sHPETRegs->config |= HPET_CONF_MASK_LEGACY; + else + sHPETRegs->config &= ~HPET_CONF_MASK_LEGACY; + + return B_OK; +} + + +#ifdef TRACE_HPET +static void +hpet_dump_timer(volatile struct hpet_timer *timer) +{ + dprintf("HPET Timer %ld:\n", (timer - sHPETRegs->timer)); + dprintf("CAP/CONFIG register: 0x%llx\n", timer->config); + dprintf("Capabilities:\n"); + dprintf("\troutable IRQs: "); + uint32 interrupts = (uint32)HPET_GET_CAP_TIMER_ROUTE(timer); + for (int i = 0; i < 32; i++) { + if (interrupts & (1 << i)) + dprintf("%d ", i); + } + + dprintf("\n\tsupports FSB delivery: %s\n", + timer->config & HPET_CAP_TIMER_FSB_INT_DEL ? "Yes" : "No"); + + + dprintf("\n"); + dprintf("Configuration:\n"); + dprintf("\tFSB Enabled: %s\n", + timer->config & HPET_CONF_TIMER_FSB_ENABLE ? "Yes" : "No"); + dprintf("\tInterrupt Enabled: %s\n", + timer->config & HPET_CONF_TIMER_INT_ENABLE ? "Yes" : "No"); + dprintf("\tTimer type: %s\n", + timer->config & HPET_CONF_TIMER_TYPE ? "Periodic" : "OneShot"); + dprintf("\tInterrupt Type: %s\n", + timer->config & HPET_CONF_TIMER_INT_TYPE ? "Level" : "Edge"); + + dprintf("\tconfigured IRQ: %lld\n", + HPET_GET_CONF_TIMER_INT_ROUTE(timer)); + + if (timer->config & HPET_CONF_TIMER_FSB_ENABLE) { + dprintf("\tfsb_route[0]: 0x%llx\n", timer->fsb_route[0]); + dprintf("\tfsb_route[1]: 0x%llx\n", timer->fsb_route[1]); + } +} +#endif + + +static void +hpet_init_timer(volatile struct hpet_timer *timer) +{ + uint32 interrupts = (uint32)HPET_GET_CAP_TIMER_ROUTE(timer); + + // TODO: Check if the interrupt is already used, and try another + uint32 interrupt = 0; + for (int i = 0; i < 32; i++) { + if (interrupts & (1 << i)) { + interrupt = i; + break; + } + } + + timer->config = 0; + + timer->config |= (interrupt << HPET_CONF_TIMER_INT_ROUTE_SHIFT) + & HPET_CONF_TIMER_INT_ROUTE_MASK; + + // Non-periodic mode + timer->config &= ~HPET_CONF_TIMER_TYPE; + + // level triggered + timer->config |= HPET_CONF_TIMER_INT_TYPE; + + // Disable FSB/MSI, enable 64 bit mode + timer->config &= ~HPET_CONF_TIMER_FSB_ENABLE; + timer->config &= ~HPET_CONF_TIMER_32MODE; + + +#ifdef TRACE_HPET + hpet_dump_timer(timer); +#endif +} + + +static status_t +hpet_configure_interrupt(volatile hpet_timer* timer, int32 *irq) +{ + status_t status = B_OK; + *irq = HPET_GET_CONF_TIMER_INT_ROUTE(timer); + // TODO: Configure interrupt using msi or regular irqs + return status; +} + + +static status_t +hpet_test() +{ + uint64 initialValue = sHPETRegs->u0.counter64; + spin(10); + uint64 finalValue = sHPETRegs->u0.counter64; + + if (initialValue == finalValue) { + dprintf("hpet_test: counter does not increment\n"); + return B_ERROR; + } + + return B_OK; +} + + +static status_t +hpet_init() +{ + if (sHPETRegs == NULL) + return B_NO_INIT; + + sHPETPeriod = HPET_GET_PERIOD(sHPETRegs); + + TRACE(("hpet_init: HPET is at %p.\n\tVendor ID: %llx, rev: %llx, period: %lld\n", + sHPETRegs, HPET_GET_VENDOR_ID(sHPETRegs), HPET_GET_REVID(sHPETRegs), + sHPETPeriod)); + + status_t status = hpet_set_enabled(false); + if (status != B_OK) + return status; + + status = hpet_set_legacy(false); + if (status != B_OK) + return status; + + uint32 numTimers = HPET_GET_NUM_TIMERS(sHPETRegs) + 1; + + TRACE(("hpet_init: HPET supports %lu timers, and is %s bits wide.\n", + numTimers, HPET_IS_64BIT(sHPETRegs) ? "64" : "32")); + + TRACE(("hpet_init: configuration: 0x%llx, timer_interrupts: 0x%llx\n", + sHPETRegs->config, sHPETRegs->interrupt_status)); + + if (numTimers < 3) { + dprintf("hpet_init: HPET does not have at least 3 timers. Skipping.\n"); + return B_ERROR; + } + +/* +#ifdef TRACE_HPET + for (uint32 c = 0; c < numTimers; c++) + hpet_dump_timer(&sHPETRegs->timer[c]); +#endif +*/ + sHPETRegs->interrupt_status = 0; + + status = hpet_set_enabled(true); + if (status != B_OK) + return status; + +#ifdef TEST_HPET + status = hpet_test(); + if (status != B_OK) + return status; +#endif + + return status; +} + + +//////////////////////////////////////////////////////////////////////////////// + + +status_t +init_hardware(void) +{ + return B_OK; +} + + +status_t +init_driver(void) +{ + sOpenCount = 0; + + status_t status = get_module(B_ACPI_MODULE_NAME, (module_info**)&sAcpi); + if (status < B_OK) + return status; + + acpi_hpet *hpetTable; + status = sAcpi->get_table(ACPI_HPET_SIGNATURE, 0, + (void**)&hpetTable); + + if (status != B_OK) { + put_module(B_ACPI_MODULE_NAME); + return status; + } + + sHPETArea = map_physical_memory("HPET registries", + hpetTable->hpet_address.address, B_PAGE_SIZE, 0, + 0, (void**)&sHPETRegs); + + if (sHPETArea < 0) { + put_module(B_ACPI_MODULE_NAME); + return sHPETArea; + } + + return hpet_init(); +} + + +void +uninit_driver(void) +{ + hpet_set_enabled(false); + + if (sHPETArea > 0) + delete_area(sHPETArea); + + put_module(B_ACPI_MODULE_NAME); +} + + +const char** +publish_devices(void) +{ + return hpet_name; +} + + +device_hooks* +find_device(const char* name) +{ + return &hpet_hooks; +} + + +//////////////////////////////////////////////////////////////////////////////// +// #pragma mark - + + +status_t +hpet_open(const char* name, uint32 flags, void** cookie) +{ + *cookie = NULL; + + if (sHPETRegs == NULL) + return B_NO_INIT; + + if (atomic_add(&sOpenCount, 1) != 0) { + atomic_add(&sOpenCount, -1); + return B_BUSY; + } + + hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)malloc(sizeof(hpet_timer_cookie)); + int timerNumber = 2; + hpetCookie->number = timerNumber; + hpetCookie->sem = create_sem(0, "hpet_timer 2 sem"); + set_sem_owner(hpetCookie->sem, B_SYSTEM_TEAM); + + hpet_set_enabled(false); + + hpet_init_timer(&sHPETRegs->timer[timerNumber]); + + status_t status = hpet_configure_interrupt(&sHPETRegs->timer[timerNumber], &hpetCookie->irq); + if (status == B_OK) + status = install_io_interrupt_handler(hpetCookie->irq, &hpet_timer_interrupt, hpetCookie, 0); + if (status != B_OK) + dprintf("hpet_open(): cannot install interrupt handler: %s\n", strerror(status)); + else + dprintf("hpet_open(): HPET timer uses irq %ld\n", hpetCookie->irq); + + hpet_set_enabled(true); + + *cookie = hpetCookie; + + return status; +} + + +status_t +hpet_close(void* cookie) +{ + if (sHPETRegs == NULL) + return B_NO_INIT; + + atomic_add(&sOpenCount, -1); + + hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)cookie; + + dprintf("hpet_close (%d)\n", hpetCookie->number); + hpet_clear_hardware_timer(&sHPETRegs->timer[hpetCookie->number]); + remove_io_interrupt_handler(hpetCookie->irq, &hpet_timer_interrupt, hpetCookie); + + return B_OK; +} + + +status_t +hpet_free(void* cookie) +{ + if (sHPETRegs == NULL) + return B_NO_INIT; + + hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)cookie; + + delete_sem(hpetCookie->sem); + + free(cookie); + + return B_OK; +} + + +status_t +hpet_control(void* cookie, uint32 op, void* arg, size_t length) +{ + hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)cookie; + status_t status = B_BAD_VALUE; + + switch (op) { + case HPET_WAIT_TIMER: + { + bigtime_t value = *(bigtime_t*)arg; + dprintf("hpet: wait timer (%d) for %lld...\n", hpetCookie->number, value); + hpet_set_hardware_timer(value, &sHPETRegs->timer[hpetCookie->number]); + status = acquire_sem_etc(hpetCookie->sem, 1, B_CAN_INTERRUPT, B_INFINITE_TIMEOUT); + break; + } + default: + break; + + } + + return status; +} + + +ssize_t +hpet_read(void* cookie, off_t position, void* buffer, size_t* numBytes) +{ + //hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)cookie; + *(uint64*)buffer = sHPETRegs->u0.counter64; + + return sizeof(uint64); +} + + +ssize_t +hpet_write(void* cookie, off_t position, const void* buffer, size_t* numBytes) +{ + *numBytes = 0; + return B_NOT_ALLOWED; +} + diff --git a/src/add-ons/kernel/drivers/timer/hpet.h b/src/add-ons/kernel/drivers/timer/hpet.h new file mode 100644 index 0000000000..d82eea336c --- /dev/null +++ b/src/add-ons/kernel/drivers/timer/hpet.h @@ -0,0 +1,118 @@ +/* + * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_ARCH_x86_HPET_H +#define _KERNEL_ARCH_x86_HPET_H + +#include +#include "arch_acpi.h" + +/* All masks are 32 bits wide to represent relative bit locations */ +/* Doing it this way is Required since the HPET only supports 32/64-bit aligned reads. */ + +/* Global Capability Register Masks */ +#define HPET_CAP_MASK_REVID 0x00000000000000FFULL +#define HPET_CAP_MASK_NUMTIMERS 0x0000000000001F00ULL +#define HPET_CAP_MASK_WIDTH 0x0000000000002000ULL +#define HPET_CAP_MASK_LEGACY 0x0000000000008000ULL +#define HPET_CAP_MASK_VENDOR_ID 0x00000000FFFF0000ULL +#define HPET_CAP_MASK_PERIOD 0xFFFFFFFF00000000ULL + +/* Retrieve Global Capabilities */ +#define HPET_GET_REVID(regs) ((regs)->capabilities & HPET_CAP_MASK_REVID) +#define HPET_GET_NUM_TIMERS(regs) (((regs)->capabilities & HPET_CAP_MASK_NUMTIMERS) >> 8) +#define HPET_IS_64BIT(regs) (((regs)->capabilities & HPET_CAP_MASK_WIDTH) >> 13) +#define HPET_IS_LEGACY_CAPABLE(regs) (((regs)->capabilities & HPET_CAP_MASK_LEGACY) >> 15) +#define HPET_GET_VENDOR_ID(regs) (((regs)->capabilities & HPET_CAP_MASK_VENDOR_ID) >> 16) +#define HPET_GET_PERIOD(regs) (((regs)->capabilities & HPET_CAP_MASK_PERIOD) >> 32) + +/* Global Config Register Masks */ +#define HPET_CONF_MASK_ENABLED 0x00000001 +#define HPET_CONF_MASK_LEGACY 0x00000002 + +/* Retrieve Global Configuration */ +#define HPET_IS_ENABLED(regs) ((regs)->config & HPET_CONF_MASK_ENABLED) +#define HPET_IS_LEGACY(regs) (((regs)->config & HPET_CONF_MASK_LEGACY) >> 1) + +/* Timer Configuration and Capabilities*/ +#define HPET_CAP_TIMER_MASK 0xFFFFFFFF00000000ULL +#define HPET_CONF_TIMER_INT_ROUTE_MASK 0x3e00UL +#define HPET_CONF_TIMER_INT_ROUTE_SHIFT 9 +#define HPET_CONF_TIMER_INT_TYPE 0x00000002UL +#define HPET_CONF_TIMER_INT_ENABLE 0x00000004UL +#define HPET_CONF_TIMER_TYPE 0x00000008UL +#define HPET_CONF_TIMER_VAL_SET 0x00000040UL +#define HPET_CONF_TIMER_32MODE 0x00000100UL +#define HPET_CONF_TIMER_FSB_ENABLE 0x00004000UL +#define HPET_CAP_TIMER_PER_INT 0x00000010UL +#define HPET_CAP_TIMER_SIZE 0x00000020UL +#define HPET_CAP_TIMER_FSB_INT_DEL 0x00008000UL + +#define HPET_GET_CAP_TIMER_ROUTE(timer) (((timer)->config & HPET_CAP_TIMER_MASK) >> 32) +#define HPET_GET_CONF_TIMER_INT_ROUTE(timer) (((timer)->config & HPET_CONF_TIMER_INT_ROUTE_MASK) >> HPET_CONF_TIMER_INT_ROUTE_SHIFT) + +#define ACPI_HPET_SIGNATURE "HPET" + +struct hpet_timer { + /* Timer Configuration/Capability bits, Reversed because x86 is LSB */ + volatile uint64 config; + /* R/W: Each bit represents one allowed interrupt for this timer. */ + /* If interrupt 16 is allowed, bit 16 will be 1. */ + union { + volatile uint64 comparator64; /* R/W: Comparator value */ + volatile uint32 comparator32; + } u0; /* non-periodic mode: fires once when main counter = this comparator */ + /* periodic mode: fires when timer reaches this value, is increased by the original value */ + + volatile uint64 fsb_route[2]; /* R/W: FSB Interrupt Route values */ +}; + + +struct hpet_regs { + volatile uint64 capabilities; /* Read Only */ + + volatile uint64 reserved1; + + volatile uint64 config; /* R/W: Config Bits */ + + volatile uint64 reserved2; + + /* Interrupt Status bits */ + volatile uint64 interrupt_status; /* Interrupt Config bits for timers 0-31 */ + /* Level Tigger: 0 = off, 1 = set by hardware, timer is active */ + /* Edge Trigger: ignored */ + /* Writing 0 will not clear these. Must write 1 again. */ + volatile uint64 reserved3[25]; + + union { + volatile uint64 counter64; /* R/W */ + volatile uint32 counter32; + } u0; + + volatile uint64 reserved4; + + volatile struct hpet_timer timer[1]; +}; + + +typedef struct acpi_hpet { + acpi_descriptor_header header; /* "HPET" signature and acpi header */ + uint16 vendor_id; + uint8 legacy_capable : 1; + uint8 reserved1 : 1; + uint8 countersize : 1; + uint8 comparators : 5; + uint8 hw_revision; + struct hpet_addr { + uint8 address_space; + uint8 register_width; + uint8 register_offset; + uint8 reserved; + uint64 address; + } hpet_address; + uint8 number; + uint16 min_tick; +} _PACKED acpi_hpet; + +#endif diff --git a/src/add-ons/kernel/drivers/timer/hpet_interface.h b/src/add-ons/kernel/drivers/timer/hpet_interface.h new file mode 100644 index 0000000000..3c611965c7 --- /dev/null +++ b/src/add-ons/kernel/drivers/timer/hpet_interface.h @@ -0,0 +1,10 @@ +#ifndef _HPET_H +#define _HPET_H + + +struct hpet_timer_cookie ; + + +#define HPET_WAIT_TIMER 0x0001 + +#endif diff --git a/src/add-ons/kernel/drivers/timer/int.h b/src/add-ons/kernel/drivers/timer/int.h new file mode 100644 index 0000000000..0fb0bcbe51 --- /dev/null +++ b/src/add-ons/kernel/drivers/timer/int.h @@ -0,0 +1,16 @@ +/* + * Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + * + * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ +#ifndef __INT_H +#define __INT_H + + +status_t reserve_io_interrupt_vectors(long count, long startVector); +status_t allocate_io_interrupt_vectors(long count, long *startVector); +void free_io_interrupt_vectors(long count, long startVector); + +#endif /* __INT_H */ diff --git a/src/add-ons/kernel/drivers/timer/msi.h b/src/add-ons/kernel/drivers/timer/msi.h new file mode 100644 index 0000000000..d0cec5b078 --- /dev/null +++ b/src/add-ons/kernel/drivers/timer/msi.h @@ -0,0 +1,33 @@ +#ifndef _KERNEL_ARCH_x86_MSI_H +#define _KERNEL_ARCH_x86_MSI_H + +#include + +// address register +#define MSI_ADDRESS_BASE 0xfee00000 +#define MSI_DESTINATION_ID_SHIFT 12 +#define MSI_REDIRECTION 0x00000008 +#define MSI_NO_REDIRECTION 0x00000000 +#define MSI_DESTINATION_MODE_LOGICAL 0x00000004 +#define MSI_DESTINATION_MODE_PHYSICAL 0x00000000 + +// data register +#define MSI_TRIGGER_MODE_EDGE 0x00000000 +#define MSI_TRIGGER_MODE_LEVEL 0x00008000 +#define MSI_LEVEL_DEASSERT 0x00000000 +#define MSI_LEVEL_ASSERT 0x00004000 +#define MSI_DELIVERY_MODE_FIXED 0x00000000 +#define MSI_DELIVERY_MODE_LOWEST_PRIO 0x00000100 +#define MSI_DELIVERY_MODE_SMI 0x00000200 +#define MSI_DELIVERY_MODE_NMI 0x00000400 +#define MSI_DELIVERY_MODE_INIT 0x00000500 +#define MSI_DELIVERY_MODE_EXT_INT 0x00000700 + + +void msi_init(); +bool msi_supported(); +status_t msi_allocate_vectors(uint8 count, uint8 *startVector, + uint64 *address, uint16 *data); +void msi_free_vectors(uint8 count, uint8 startVector); + +#endif // _KERNEL_ARCH_x86_MSI_H From c6e876fc853e81fe09af0e2c43696205e1633864 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 13 Oct 2011 08:43:56 +0000 Subject: [PATCH 377/702] Tiny cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42838 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp index 1ec34087b5..bc712101a8 100644 --- a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp +++ b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp @@ -704,7 +704,7 @@ usb_disk_device_added(usb_device newDevice, void **cookie) continue; if (!hasIn && (endpoint->descr->endpoint_address - & USB_ENDPOINT_ADDR_DIR_IN)) { + & USB_ENDPOINT_ADDR_DIR_IN) != 0) { device->bulk_in = endpoint->handle; hasIn = true; } else if (!hasOut && (endpoint->descr->endpoint_address From e436a27e5f6df975a1e35c27f42e8f6ad27ebdca Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 13 Oct 2011 09:07:33 +0000 Subject: [PATCH 378/702] * Add preliminary support for one SandyBridge mobile integrated graphics device (the one in my new ThinkPad X1). The PLL is still off a bit so it has a few blurry stripes, but EDID and mode setting basically works. * Starting with IronLake the north/south bridge or (G)MCH/ICH setup was moved into a platform control hub (PCH) which means that many registers previously located in the GMCH are now in the PCH and have a new address. * I'm committing this mostly because this way the additions are more easy to follow. It is a bit messy and I'll clean it up more and possibly make it a bit more generic. Also most of these changes actually apply to IronLake and up and aren't SandyBridge specific, so a few of those additions will still get a broader scope and new chips will be added. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42839 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 68 +++++++- .../accelerants/intel_extreme/hooks.cpp | 3 +- .../accelerants/intel_extreme/mode.cpp | 154 ++++++++++++------ .../kernel/busses/agp_gart/intel_gart.cpp | 79 ++++++++- .../drivers/graphics/intel_extreme/driver.cpp | 4 +- .../graphics/intel_extreme/intel_extreme.cpp | 3 + 6 files changed, 249 insertions(+), 62 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index b129525ad2..5d38cbcaaa 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -18,13 +18,13 @@ #define VENDOR_ID_INTEL 0x8086 -#define INTEL_TYPE_FAMILY_MASK 0xf000 -#define INTEL_TYPE_GROUP_MASK 0xfff0 -#define INTEL_TYPE_MODEL_MASK 0xffff +#define INTEL_TYPE_FAMILY_MASK 0x000f0000 +#define INTEL_TYPE_GROUP_MASK 0x000ffff0 +#define INTEL_TYPE_MODEL_MASK 0x000fffff // families -#define INTEL_TYPE_7xx 0x1000 -#define INTEL_TYPE_8xx 0x2000 -#define INTEL_TYPE_9xx 0x4000 +#define INTEL_TYPE_7xx 0x00010000 +#define INTEL_TYPE_8xx 0x00020000 +#define INTEL_TYPE_9xx 0x00040000 // groups #define INTEL_TYPE_83x (INTEL_TYPE_8xx | 0x0010) #define INTEL_TYPE_85x (INTEL_TYPE_8xx | 0x0020) @@ -34,6 +34,7 @@ #define INTEL_TYPE_Gxx (INTEL_TYPE_9xx | 0x0200) #define INTEL_TYPE_G4x (INTEL_TYPE_9xx | 0x0400) #define INTEL_TYPE_IGD (INTEL_TYPE_9xx | 0x0800) +#define INTEL_TYPE_SNB (INTEL_TYPE_9xx | 0x1000) // models #define INTEL_TYPE_MOBILE 0x0008 #define INTEL_TYPE_915 (INTEL_TYPE_91x) @@ -47,6 +48,8 @@ #define INTEL_TYPE_GM45 (INTEL_TYPE_G4x | INTEL_TYPE_MOBILE) #define INTEL_TYPE_IGDG (INTEL_TYPE_IGD) #define INTEL_TYPE_IGDGM (INTEL_TYPE_IGD | INTEL_TYPE_MOBILE) +#define INTEL_TYPE_SNBG (INTEL_TYPE_SNB) +#define INTEL_TYPE_SNBGM (INTEL_TYPE_SNB | INTEL_TYPE_MOBILE) #define DEVICE_NAME "intel_extreme" #define INTEL_ACCELERANT_NAME "intel_extreme.accelerant" @@ -218,6 +221,59 @@ struct intel_free_graphics_memory { #define G4X_STOLEN_MEMORY_224MB 0xc0 #define G4X_STOLEN_MEMORY_352MB 0xd0 +// PCH - Platform Control Hub - Newer hardware moves from a MCH/ICH based setup +// to a PCH based one, that means anything that used to communicate via (G)MCH +// registers needs to use different ones on PCH based platforms (Ironlake and +// up, SandyBridge, etc.). +#define PCH_DE_INTERRUPT_ENABLE 0x4400c // INTEL_INTERRUPT_ENABLED +#define PCH_DISPLAY_A_ANALOG_PORT 0xe1100 // INTEL_DISPLAY_A_ANALOG_PORT +#define PCH_DISPLAY_LVDS_PORT 0xe1180 // INTEL_DISPLAY_LVDS_PORT +#define PCH_I2C_IO_A 0xc5010 // INTEL_I2C_IO_A +#define PCH_I2C_IO_C 0xc5018 // INTEL_I2C_IO_C +#define PCH_DISPLAY_A_PLL 0xc6014 // INTEL_DISPLAY_A_PLL +#define PCH_DISPLAY_B_PLL 0xc6018 // INTEL_DISPLAY_B_PLL +#define PCH_DISPLAY_A_PLL_DIVISOR_0 0xc6040 // INTEL_DISPLAY_A_PLL_DIVISOR_0 +#define PCH_DISPLAY_A_PLL_DIVISOR_1 0xc6044 // INTEL_DISPLAY_A_PLL_DIVISOR_1 +#define PCH_DISPLAY_B_PLL_DIVISOR_0 0xc6048 // INTEL_DISPLAY_B_PLL_DIVISOR_0 +#define PCH_DISPLAY_B_PLL_DIVISOR_1 0xc604c // INTEL_DISPLAY_B_PLL_DIVISOR_1 +#define PCH_TRANSCODER_A_HTOTAL 0xe0000 // INTEL_DISPLAY_A_HTOTAL +#define PCH_TRANSCODER_A_HBLANK 0xe0004 // INTEL_DISPLAY_A_HBLANK +#define PCH_TRANSCODER_A_HSYNC 0xe0008 // INTEL_DISPLAY_A_HSYNC +#define PCH_TRANSCODER_A_VTOTAL 0xe000c // INTEL_DISPLAY_A_VTOTAL +#define PCH_TRANSCODER_A_VBLANK 0xe0010 // INTEL_DISPLAY_A_VBLANK +#define PCH_TRANSCODER_A_VSYNC 0xe0014 // INTEL_DISPLAY_A_VSYNC +#define PCH_TRANSCODER_B_HTOTAL 0xe1000 // INTEL_DISPLAY_B_HTOTAL +#define PCH_TRANSCODER_B_HBLANK 0xe1004 // INTEL_DISPLAY_B_HBLANK +#define PCH_TRANSCODER_B_HSYNC 0xe1008 // INTEL_DISPLAY_B_HSYNC +#define PCH_TRANSCODER_B_VTOTAL 0xe100c // INTEL_DISPLAY_B_VTOTAL +#define PCH_TRANSCODER_B_VBLANK 0xe1010 // INTEL_DISPLAY_B_VBLANK +#define PCH_TRANSCODER_B_VSYNC 0xe1014 // INTEL_DISPLAY_B_VSYNC + +// SandyBridge (SNB) +#define SNB_GRAPHICS_MEMORY_CONTROL 0x50 + +#define SNB_STOLEN_MEMORY_MASK 0xf8 +#define SNB_STOLEN_MEMORY_32MB (1 << 3) +#define SNB_STOLEN_MEMORY_64MB (2 << 3) +#define SNB_STOLEN_MEMORY_96MB (3 << 3) +#define SNB_STOLEN_MEMORY_128MB (4 << 3) +#define SNB_STOLEN_MEMORY_160MB (5 << 3) +#define SNB_STOLEN_MEMORY_192MB (6 << 3) +#define SNB_STOLEN_MEMORY_224MB (7 << 3) +#define SNB_STOLEN_MEMORY_256MB (8 << 3) +#define SNB_STOLEN_MEMORY_288MB (9 << 3) +#define SNB_STOLEN_MEMORY_320MB (10 << 3) +#define SNB_STOLEN_MEMORY_352MB (11 << 3) +#define SNB_STOLEN_MEMORY_384MB (12 << 3) +#define SNB_STOLEN_MEMORY_416MB (13 << 3) +#define SNB_STOLEN_MEMORY_448MB (14 << 3) +#define SNB_STOLEN_MEMORY_480MB (15 << 3) +#define SNB_STOLEN_MEMORY_512MB (16 << 3) + +#define SNB_GTT_SIZE_MASK (3 << 8) +#define SNB_GTT_SIZE_NONE (0 << 8) +#define SNB_GTT_SIZE_1MB (1 << 8) +#define SNB_GTT_SIZE_2MB (2 << 8) // graphics page translation table #define INTEL_PAGE_TABLE_CONTROL 0x02020 diff --git a/src/add-ons/accelerants/intel_extreme/hooks.cpp b/src/add-ons/accelerants/intel_extreme/hooks.cpp index 7ec8701ef5..7ac7c3895e 100644 --- a/src/add-ons/accelerants/intel_extreme/hooks.cpp +++ b/src/add-ons/accelerants/intel_extreme/hooks.cpp @@ -115,7 +115,8 @@ get_accelerant_hook(uint32 feature, void *data) || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_94x) || gInfo->shared_info->device_type.IsModel(INTEL_TYPE_965M) || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_G4x) - || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_IGD)) + || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_IGD) + || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB)) return NULL; return (void*)intel_allocate_overlay_buffer; diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index b3e3cb1c51..7a0929a8a2 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -132,7 +132,8 @@ set_frame_buffer_base() } if (sharedInfo.device_type.InGroup(INTEL_TYPE_96x) - || sharedInfo.device_type.InGroup(INTEL_TYPE_G4x)) { + || sharedInfo.device_type.InGroup(INTEL_TYPE_G4x) + || sharedInfo.device_type.InGroup(INTEL_TYPE_SNB)) { write32(baseRegister, mode.v_display_start * sharedInfo.bytes_per_row + mode.h_display_start * (sharedInfo.bits_per_pixel + 7) / 8); read32(baseRegister); @@ -153,8 +154,10 @@ set_frame_buffer_base() status_t create_mode_list(void) { + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + i2c_bus bus; - bus.cookie = (void*)INTEL_I2C_IO_A; + bus.cookie = (void*)(isSNB ? PCH_I2C_IO_A : INTEL_I2C_IO_A); bus.set_signals = &set_i2c_signals; bus.get_signals = &get_i2c_signals; ddc2_init_timing(&bus); @@ -166,7 +169,7 @@ create_mode_list(void) } else { TRACE(("intel_extreme: getting EDID on port A (analog) failed : %s. " "Trying on port C (lvds)\n", strerror(error))); - bus.cookie = (void*)INTEL_I2C_IO_C; + bus.cookie = (void*)(isSNB ? PCH_I2C_IO_C : INTEL_I2C_IO_C); error = ddc2_read_edid1(&bus, &gInfo->edid_info, NULL, NULL); if (error == B_OK) { edid_dump(&gInfo->edid_info); @@ -234,7 +237,16 @@ get_pll_limits(pll_limits &limits) // Note, the limits are taken from the X driver; they have not yet been // tested - if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_G4x)) { + if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB)) { + // TODO: support LVDS output limits as well + static const pll_limits kLimits = { + // p, p1, p2, high, n, m, m1, m2 + { 5, 1, 10, false, 1, 79, 12, 5}, // min + { 80, 8, 5, true, 5, 127, 22, 9}, // max + 225000, 1760000, 3510000 + }; + limits = kLimits; + } else if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_G4x)) { // TODO: support LVDS output limits as well static const pll_limits kLimits = { // p, p1, p2, high, n, m, m1, m2 @@ -312,8 +324,12 @@ compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors, TRACE(("required MHz: %g\n", requestedPixelClock)); + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + if (isLVDS) { - if ((read32(INTEL_DISPLAY_LVDS_PORT) & LVDS_CLKB_POWER_MASK) + int targetRegister + = isSNB ? PCH_DISPLAY_LVDS_PORT : INTEL_DISPLAY_LVDS_PORT; + if ((read32(targetRegister) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) divisors.post2 = LVDS_POST2_RATE_FAST; else @@ -402,6 +418,26 @@ retrieve_current_mode(display_mode& mode, uint32 pllRegister) vSyncRegister = INTEL_DISPLAY_B_VSYNC; imageSizeRegister = INTEL_DISPLAY_B_IMAGE_SIZE; controlRegister = INTEL_DISPLAY_B_CONTROL; + } else if (pllRegister == PCH_DISPLAY_A_PLL) { + pllDivisor = read32((pll & DISPLAY_PLL_DIVISOR_1) != 0 + ? PCH_DISPLAY_A_PLL_DIVISOR_1 : PCH_DISPLAY_A_PLL_DIVISOR_0); + + hTotalRegister = PCH_TRANSCODER_A_HTOTAL; + vTotalRegister = PCH_TRANSCODER_A_VTOTAL; + hSyncRegister = PCH_TRANSCODER_A_HSYNC; + vSyncRegister = PCH_TRANSCODER_A_VSYNC; + imageSizeRegister = INTEL_DISPLAY_A_IMAGE_SIZE; + controlRegister = INTEL_DISPLAY_A_CONTROL; + } else if (pllRegister == PCH_DISPLAY_B_PLL) { + pllDivisor = read32((pll & DISPLAY_PLL_DIVISOR_1) != 0 + ? PCH_DISPLAY_B_PLL_DIVISOR_1 : PCH_DISPLAY_B_PLL_DIVISOR_0); + + hTotalRegister = PCH_TRANSCODER_B_HTOTAL; + vTotalRegister = PCH_TRANSCODER_B_VTOTAL; + hSyncRegister = PCH_TRANSCODER_B_HSYNC; + vSyncRegister = PCH_TRANSCODER_B_VSYNC; + imageSizeRegister = INTEL_DISPLAY_B_IMAGE_SIZE; + controlRegister = INTEL_DISPLAY_B_CONTROL; } else { // TODO: not supported return; @@ -529,9 +565,12 @@ retrieve_current_mode(display_mode& mode, uint32 pllRegister) void save_lvds_mode(void) { + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + // dump currently programmed mode. display_mode biosMode; - retrieve_current_mode(biosMode, INTEL_DISPLAY_B_PLL); + retrieve_current_mode(biosMode, + isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL); gInfo->lvds_panel_mode = biosMode; } @@ -645,7 +684,7 @@ intel_set_display_mode(display_mode *mode) // centering, since the data from propose_display_mode will not actually be // used as is in this case. if (sanitize_display_mode(target)) { - TRACE(("intel_extreme: invalid mode set!")); + TRACE(("intel_extreme: invalid mode set!\n")); return B_BAD_VALUE; } @@ -710,6 +749,9 @@ if (first) { write32(INTEL_VGA_DISPLAY_CONTROL, VGA_DISPLAY_DISABLED); read32(INTEL_VGA_DISPLAY_CONTROL); + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + int targetRegister; + if ((gInfo->head_mode & HEAD_MODE_B_DIGITAL) != 0) { // For LVDS panels, we actually always set the native mode in hardware // Then we use the panel fitter to scale the picture to that. @@ -761,9 +803,11 @@ if (first) { // Compute bitmask from p1 value if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_IGD)) { - dpll |= (1 << (divisors.post1 - 1)) << DISPLAY_PLL_IGD_POST1_DIVISOR_SHIFT; + dpll |= (1 << (divisors.post1 - 1)) + << DISPLAY_PLL_IGD_POST1_DIVISOR_SHIFT; } else { - dpll |= (1 << (divisors.post1 - 1)) << DISPLAY_PLL_POST1_DIVISOR_SHIFT; + dpll |= (1 << (divisors.post1 - 1)) + << DISPLAY_PLL_POST1_DIVISOR_SHIFT; } switch (divisors.post2) { case 5: @@ -785,7 +829,8 @@ if (first) { | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_IGD_M2_DIVISOR_MASK)); } else { - write32(INTEL_DISPLAY_B_PLL_DIVISOR_0, + write32(isSNB ? PCH_DISPLAY_B_PLL_DIVISOR_0 + : INTEL_DISPLAY_B_PLL_DIVISOR_0, (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) @@ -793,13 +838,16 @@ if (first) { | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_M2_DIVISOR_MASK)); } - write32(INTEL_DISPLAY_B_PLL, dpll & ~DISPLAY_PLL_ENABLED); - read32(INTEL_DISPLAY_B_PLL); + targetRegister = isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL; + write32(targetRegister, dpll & ~DISPLAY_PLL_ENABLED); + read32(targetRegister); spin(150); } - uint32 lvds = read32(INTEL_DISPLAY_LVDS_PORT) - | LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT; + targetRegister + = isSNB ? PCH_DISPLAY_LVDS_PORT : INTEL_DISPLAY_LVDS_PORT; + uint32 lvds = read32(targetRegister) | LVDS_PORT_EN + | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT; lvds |= LVDS_18BIT_DITHER; // TODO: do not do this if the connected panel is 24-bit @@ -815,8 +863,8 @@ if (first) { else lvds &= ~( LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP); - write32(INTEL_DISPLAY_LVDS_PORT, lvds); - read32(INTEL_DISPLAY_LVDS_PORT); + write32(targetRegister, lvds); + read32(targetRegister); if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_IGD)) { write32(INTEL_DISPLAY_B_PLL_DIVISOR_0, @@ -825,7 +873,8 @@ if (first) { | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_IGD_M2_DIVISOR_MASK)); } else { - write32(INTEL_DISPLAY_B_PLL_DIVISOR_0, + write32(isSNB ? PCH_DISPLAY_B_PLL_DIVISOR_0 + : INTEL_DISPLAY_B_PLL_DIVISOR_0, (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) @@ -834,8 +883,9 @@ if (first) { & DISPLAY_PLL_M2_DIVISOR_MASK)); } - write32(INTEL_DISPLAY_B_PLL, dpll); - read32(INTEL_DISPLAY_B_PLL); + targetRegister = isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL; + write32(targetRegister, dpll); + read32(targetRegister); // Wait for the clocks to stabilize spin(150); @@ -855,9 +905,9 @@ if (first) { write32(INTEL_DISPLAY_B_PLL_MULTIPLIER_DIVISOR, (0 << 24) | ((pixelMultiply - 1) << 8)); } else - write32(INTEL_DISPLAY_B_PLL, dpll); + write32(targetRegister, dpll); - read32(INTEL_DISPLAY_B_PLL); + read32(targetRegister); spin(150); // update timing parameters @@ -878,14 +928,14 @@ if (first) { + (hardwareTarget.timing.h_total - target.timing.h_display) / 2; - write32(INTEL_DISPLAY_B_HTOTAL, + write32(isSNB ? PCH_TRANSCODER_B_HTOTAL : INTEL_DISPLAY_B_HTOTAL, ((uint32)(hardwareTarget.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(INTEL_DISPLAY_B_HBLANK, + write32(isSNB ? PCH_TRANSCODER_B_HBLANK : INTEL_DISPLAY_B_HBLANK, ((uint32)(hardwareTarget.timing.h_total - borderWidth / 2 - 1) << 16) | ((uint32)target.timing.h_display + borderWidth / 2 - 1)); - write32(INTEL_DISPLAY_B_HSYNC, + write32(isSNB ? PCH_TRANSCODER_B_HSYNC : INTEL_DISPLAY_B_HSYNC, ((uint32)(syncCenter + syncWidth / 2 - 1) << 16) | ((uint32)syncCenter - syncWidth / 2 - 1)); @@ -899,16 +949,16 @@ if (first) { + (hardwareTarget.timing.v_total - target.timing.v_display) / 2; - write32(INTEL_DISPLAY_B_VTOTAL, + write32(isSNB ? PCH_TRANSCODER_B_VTOTAL : INTEL_DISPLAY_B_VTOTAL, ((uint32)(hardwareTarget.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(INTEL_DISPLAY_B_VBLANK, + write32(isSNB ? PCH_TRANSCODER_B_VBLANK : INTEL_DISPLAY_B_VBLANK, ((uint32)(hardwareTarget.timing.v_total - borderHeight / 2 - 1) << 16) | ((uint32)target.timing.v_display + borderHeight / 2 - 1)); - write32(INTEL_DISPLAY_B_VSYNC, ((uint32)(syncCenter - + syncHeight / 2 - 1) << 16) + write32(isSNB ? PCH_TRANSCODER_B_VSYNC : INTEL_DISPLAY_B_VSYNC, + ((uint32)(syncCenter + syncHeight / 2 - 1) << 16) | ((uint32)syncCenter - syncHeight / 2 - 1)); // This is useful for debugging: it sets the border to red, so you @@ -916,23 +966,23 @@ if (first) { // sync) // write32(0x61020, 0x00FF0000); } else { - write32(INTEL_DISPLAY_B_HTOTAL, + write32(isSNB ? PCH_TRANSCODER_B_HTOTAL : INTEL_DISPLAY_B_HTOTAL, ((uint32)(target.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(INTEL_DISPLAY_B_HBLANK, + write32(isSNB ? PCH_TRANSCODER_B_HBLANK : INTEL_DISPLAY_B_HBLANK, ((uint32)(target.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(INTEL_DISPLAY_B_HSYNC, ( - (uint32)(target.timing.h_sync_end - 1) << 16) + write32(isSNB ? PCH_TRANSCODER_B_HSYNC : INTEL_DISPLAY_B_HSYNC, + ((uint32)(target.timing.h_sync_end - 1) << 16) | ((uint32)target.timing.h_sync_start - 1)); - write32(INTEL_DISPLAY_B_VTOTAL, + write32(isSNB ? PCH_TRANSCODER_B_VTOTAL : INTEL_DISPLAY_B_VTOTAL, ((uint32)(target.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(INTEL_DISPLAY_B_VBLANK, + write32(isSNB ? PCH_TRANSCODER_B_VBLANK : INTEL_DISPLAY_B_VBLANK, ((uint32)(target.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(INTEL_DISPLAY_B_VSYNC, ( + write32(isSNB ? PCH_TRANSCODER_B_VSYNC : INTEL_DISPLAY_B_VSYNC, ( (uint32)(target.timing.v_sync_end - 1) << 16) | ((uint32)target.timing.v_sync_start - 1)); } @@ -966,7 +1016,8 @@ if (first) { | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_IGD_M2_DIVISOR_MASK)); } else { - write32(INTEL_DISPLAY_A_PLL_DIVISOR_0, + write32(isSNB ? PCH_DISPLAY_A_PLL_DIVISOR_0 + : INTEL_DISPLAY_A_PLL_DIVISOR_0, (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) @@ -1008,31 +1059,32 @@ if (first) { pll |= DISPLAY_PLL_POST1_DIVIDE_2; } - write32(INTEL_DISPLAY_A_PLL, pll); - read32(INTEL_DISPLAY_A_PLL); + targetRegister = isSNB ? PCH_DISPLAY_A_PLL : INTEL_DISPLAY_A_PLL; + write32(targetRegister, pll); + read32(targetRegister); spin(150); - write32(INTEL_DISPLAY_A_PLL, pll); - read32(INTEL_DISPLAY_A_PLL); + write32(targetRegister, pll); + read32(targetRegister); spin(150); // update timing parameters - write32(INTEL_DISPLAY_A_HTOTAL, + write32(isSNB ? PCH_TRANSCODER_A_HTOTAL : INTEL_DISPLAY_A_HTOTAL, ((uint32)(target.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(INTEL_DISPLAY_A_HBLANK, + write32(isSNB ? PCH_TRANSCODER_A_HBLANK : INTEL_DISPLAY_A_HBLANK, ((uint32)(target.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(INTEL_DISPLAY_A_HSYNC, + write32(isSNB ? PCH_TRANSCODER_A_HSYNC : INTEL_DISPLAY_A_HSYNC, ((uint32)(target.timing.h_sync_end - 1) << 16) | ((uint32)target.timing.h_sync_start - 1)); - write32(INTEL_DISPLAY_A_VTOTAL, + write32(isSNB ? PCH_TRANSCODER_A_VTOTAL : INTEL_DISPLAY_A_VTOTAL, ((uint32)(target.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(INTEL_DISPLAY_A_VBLANK, + write32(isSNB ? PCH_TRANSCODER_A_VBLANK : INTEL_DISPLAY_A_VBLANK, ((uint32)(target.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(INTEL_DISPLAY_A_VSYNC, + write32(isSNB ? PCH_TRANSCODER_A_VSYNC : INTEL_DISPLAY_A_VSYNC, ((uint32)(target.timing.v_sync_end - 1) << 16) | ((uint32)target.timing.v_sync_start - 1)); @@ -1040,8 +1092,10 @@ if (first) { ((uint32)(target.timing.h_display - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(INTEL_DISPLAY_A_ANALOG_PORT, - (read32(INTEL_DISPLAY_A_ANALOG_PORT) + targetRegister + = isSNB ? PCH_DISPLAY_A_ANALOG_PORT : INTEL_DISPLAY_A_ANALOG_PORT; + write32(targetRegister, + (read32(targetRegister) & ~(DISPLAY_MONITOR_POLARITY_MASK | DISPLAY_MONITOR_VGA_POLARITY)) | ((target.timing.flags & B_POSITIVE_HSYNC) != 0 @@ -1097,7 +1151,9 @@ intel_get_display_mode(display_mode *_currentMode) { TRACE(("intel_get_display_mode()\n")); - retrieve_current_mode(*_currentMode, INTEL_DISPLAY_A_PLL); + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + retrieve_current_mode(*_currentMode, + isSNB ? PCH_DISPLAY_A_PLL : INTEL_DISPLAY_A_PLL); return B_OK; } diff --git a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp index a1ea37f526..a11b3323fd 100644 --- a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp +++ b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp @@ -77,9 +77,11 @@ const struct supported_device { {0x2e30, 0x2e32, INTEL_TYPE_G45, "G41"}, {0x2e40, 0x2e42, INTEL_TYPE_G45, "B43"}, {0x2e90, 0x2e92, INTEL_TYPE_G45, "B43"}, - + {0xa000, 0xa001, INTEL_TYPE_IGDG, "Atom_Dx10"}, {0xa010, 0xa011, INTEL_TYPE_IGDGM, "Atom_N4x0"}, + + {0x0104, 0x0126, INTEL_TYPE_SNBGM, "SNBGM"}, }; struct intel_info { @@ -131,8 +133,11 @@ static void determine_memory_sizes(intel_info &info, size_t >tSize, size_t &stolenSize) { // read stolen memory from the PCI configuration of the PCI bridge - uint16 memoryConfig = get_pci_config(info.bridge, - INTEL_GRAPHICS_MEMORY_CONTROL, 2); + uint8 controlRegister = INTEL_GRAPHICS_MEMORY_CONTROL; + if ((info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_SNB) + controlRegister = SNB_GRAPHICS_MEMORY_CONTROL; + + uint16 memoryConfig = get_pci_config(info.bridge, controlRegister, 2); size_t memorySize = 1 << 20; // 1 MB gttSize = 0; stolenSize = 0; @@ -178,6 +183,18 @@ determine_memory_sizes(intel_info &info, size_t >tSize, size_t &stolenSize) gttSize = 4 << 20; break; } + } else if ((info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_SNB) { + switch (memoryConfig & SNB_GTT_SIZE_MASK) { + case SNB_GTT_SIZE_NONE: + gttSize = 0; + break; + case SNB_GTT_SIZE_1MB: + gttSize = 1 << 20; + break; + case SNB_GTT_SIZE_2MB: + gttSize = 2 << 20; + break; + } } else { // older models have the GTT as large as their frame buffer mapping // TODO: check if the i9xx version works with the i8xx chips as well @@ -191,7 +208,7 @@ determine_memory_sizes(intel_info &info, size_t >tSize, size_t &stolenSize) } else if ((info.type & INTEL_TYPE_9xx) != 0) frameBufferSize = info.display.u.h0.base_register_sizes[2]; - TRACE(("frame buffer size %lu MB\n", frameBufferSize >> 20)); + TRACE("frame buffer size %lu MB\n", frameBufferSize >> 20); gttSize = frameBufferSize / 1024; } @@ -214,6 +231,57 @@ determine_memory_sizes(intel_info &info, size_t >tSize, size_t &stolenSize) memorySize *= 8; break; } + } else if ((info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_SNB) { + switch (memoryConfig & SNB_STOLEN_MEMORY_MASK) { + case SNB_STOLEN_MEMORY_32MB: + memorySize *= 32; + break; + case SNB_STOLEN_MEMORY_64MB: + memorySize *= 64; + break; + case SNB_STOLEN_MEMORY_96MB: + memorySize *= 96; + break; + case SNB_STOLEN_MEMORY_128MB: + memorySize *= 128; + break; + case SNB_STOLEN_MEMORY_160MB: + memorySize *= 160; + break; + case SNB_STOLEN_MEMORY_192MB: + memorySize *= 192; + break; + case SNB_STOLEN_MEMORY_224MB: + memorySize *= 224; + break; + case SNB_STOLEN_MEMORY_256MB: + memorySize *= 256; + break; + case SNB_STOLEN_MEMORY_288MB: + memorySize *= 288; + break; + case SNB_STOLEN_MEMORY_320MB: + memorySize *= 320; + break; + case SNB_STOLEN_MEMORY_352MB: + memorySize *= 352; + break; + case SNB_STOLEN_MEMORY_384MB: + memorySize *= 384; + break; + case SNB_STOLEN_MEMORY_416MB: + memorySize *= 416; + break; + case SNB_STOLEN_MEMORY_448MB: + memorySize *= 448; + break; + case SNB_STOLEN_MEMORY_480MB: + memorySize *= 480; + break; + case SNB_STOLEN_MEMORY_512MB: + memorySize *= 512; + break; + } } else if (info.type == INTEL_TYPE_85x || (info.type & INTEL_TYPE_9xx) == INTEL_TYPE_9xx) { switch (memoryConfig & STOLEN_MEMORY_MASK) { @@ -325,7 +393,8 @@ intel_map(intel_info &info) return B_ERROR; if ((info.type & INTEL_TYPE_FAMILY_MASK) == INTEL_TYPE_9xx) { - if ((info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_G4x) { + if ((info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_G4x + || (info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_SNB) { info.gtt_physical_base = info.display.u.h0.base_registers[mmioIndex] + (2UL << 20); } else diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp index 9859294472..835fcee462 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp @@ -69,9 +69,11 @@ const struct supported_device { {0x2e32, INTEL_TYPE_G45, "G41"}, {0x2e42, INTEL_TYPE_G45, "B43"}, {0x2e92, INTEL_TYPE_G45, "B43"}, - + {0xa001, INTEL_TYPE_IGDG, "Atom_Dx10"}, {0xa011, INTEL_TYPE_IGDGM, "Atom_N4x0"}, + + {0x0126, INTEL_TYPE_SNBGM, "SNBGM"}, }; int32 api_version = B_CUR_DRIVER_API_VERSION; diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index d83194913c..ef6b0aec8c 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -257,6 +257,9 @@ intel_extreme_init(intel_info &info) if (info.pci->device_id == 0x2a02 || info.pci->device_id == 0x2a12) { dprintf("i965GM/i965GME quirk\n"); write32(info.registers + 0x6204, (1L << 29)); + } else if (info.device_type.InGroup(INTEL_TYPE_SNB)) { + dprintf("SNB clock gating\n"); + write32(info.registers + 0x42020, (1L << 28) | (1L << 7) | (1L << 5)); } else if (info.device_type.InGroup(INTEL_TYPE_G4x)) { dprintf("G4x clock gating\n"); write32(info.registers + 0x6204, 0); From 9f6dd249744f1bd2dad7cfed5a59f9be277c7433 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 13 Oct 2011 15:54:40 +0000 Subject: [PATCH 379/702] Don't try to do another request sense if the failing operation already was a request sense. Otherwise we can easily run into an infinite recursion. Should fix #8022. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42840 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp index bc712101a8..2ae90e6a56 100644 --- a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp +++ b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp @@ -386,6 +386,9 @@ usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength, // the operation is complete and has succeeded return B_OK; } else { + if (operation == SCSI_REQUEST_SENSE_6) + return B_ERROR; + // the operation is complete but has failed at the SCSI level if (operation != SCSI_TEST_UNIT_READY_6) { TRACE_ALWAYS("operation 0x%02x failed at the SCSI level\n", From 8efc947242453d4cef29241dee18d48bed40d0d0 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 13 Oct 2011 16:05:48 +0000 Subject: [PATCH 380/702] Ordered SubIncludes (thank you Jerome) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42841 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/Jamfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/kernel/drivers/Jamfile b/src/add-ons/kernel/drivers/Jamfile index 9243e8f42b..ef7c7eee24 100644 --- a/src/add-ons/kernel/drivers/Jamfile +++ b/src/add-ons/kernel/drivers/Jamfile @@ -15,6 +15,6 @@ SubInclude HAIKU_TOP src add-ons kernel drivers ports ; SubInclude HAIKU_TOP src add-ons kernel drivers power ; SubInclude HAIKU_TOP src add-ons kernel drivers printer ; SubInclude HAIKU_TOP src add-ons kernel drivers random ; -SubInclude HAIKU_TOP src add-ons kernel drivers tty ; SubInclude HAIKU_TOP src add-ons kernel drivers timer ; +SubInclude HAIKU_TOP src add-ons kernel drivers tty ; SubInclude HAIKU_TOP src add-ons kernel drivers video ; From f53638d71eec63015b5b6e2a0c6e884c5354c775 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 13 Oct 2011 16:07:10 +0000 Subject: [PATCH 381/702] Some refactoring, some other changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42842 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/timer/hpet.cpp | 69 ++++++++++++----------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/src/add-ons/kernel/drivers/timer/hpet.cpp b/src/add-ons/kernel/drivers/timer/hpet.cpp index 58a84dcdde..5d787f8091 100644 --- a/src/add-ons/kernel/drivers/timer/hpet.cpp +++ b/src/add-ons/kernel/drivers/timer/hpet.cpp @@ -181,8 +181,6 @@ hpet_dump_timer(volatile struct hpet_timer *timer) dprintf("\n\tsupports FSB delivery: %s\n", timer->config & HPET_CAP_TIMER_FSB_INT_DEL ? "Yes" : "No"); - - dprintf("\n"); dprintf("Configuration:\n"); dprintf("\tFSB Enabled: %s\n", timer->config & HPET_CONF_TIMER_FSB_ENABLE ? "Yes" : "No"); @@ -204,21 +202,24 @@ hpet_dump_timer(volatile struct hpet_timer *timer) #endif -static void -hpet_init_timer(volatile struct hpet_timer *timer) +static status_t +hpet_init_timer(hpet_timer_cookie* cookie) { + volatile struct hpet_timer *timer = &sHPETRegs->timer[cookie->number]; + uint32 interrupts = (uint32)HPET_GET_CAP_TIMER_ROUTE(timer); // TODO: Check if the interrupt is already used, and try another - uint32 interrupt = 0; + int32 interrupt = -1; for (int i = 0; i < 32; i++) { if (interrupts & (1 << i)) { - interrupt = i; + interrupt = i; break; } } - timer->config = 0; + if (interrupt == -1) + return B_ERROR; timer->config |= (interrupt << HPET_CONF_TIMER_INT_ROUTE_SHIFT) & HPET_CONF_TIMER_INT_ROUTE_MASK; @@ -233,20 +234,16 @@ hpet_init_timer(volatile struct hpet_timer *timer) timer->config &= ~HPET_CONF_TIMER_FSB_ENABLE; timer->config &= ~HPET_CONF_TIMER_32MODE; - + cookie->irq = interrupt = HPET_GET_CONF_TIMER_INT_ROUTE(timer); + status_t status = install_io_interrupt_handler(interrupt, &hpet_timer_interrupt, cookie, 0); + if (status != B_OK) { + dprintf("hpet_init_timer(): cannot install interrupt handler: %s\n", strerror(status)); + return status; + } #ifdef TRACE_HPET hpet_dump_timer(timer); #endif -} - - -static status_t -hpet_configure_interrupt(volatile hpet_timer* timer, int32 *irq) -{ - status_t status = B_OK; - *irq = HPET_GET_CONF_TIMER_INT_ROUTE(timer); - // TODO: Configure interrupt using msi or regular irqs - return status; + return B_OK; } @@ -299,12 +296,12 @@ hpet_init() return B_ERROR; } -/* + #ifdef TRACE_HPET for (uint32 c = 0; c < numTimers; c++) hpet_dump_timer(&sHPETRegs->timer[c]); #endif -*/ + sHPETRegs->interrupt_status = 0; status = hpet_set_enabled(true); @@ -350,15 +347,24 @@ init_driver(void) } sHPETArea = map_physical_memory("HPET registries", - hpetTable->hpet_address.address, B_PAGE_SIZE, 0, - 0, (void**)&sHPETRegs); + hpetTable->hpet_address.address, + B_PAGE_SIZE, + B_ANY_KERNEL_ADDRESS, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, + (void**)&sHPETRegs); if (sHPETArea < 0) { put_module(B_ACPI_MODULE_NAME); return sHPETArea; } - return hpet_init(); + status = hpet_init(); + if (status != B_OK) { + delete_area(sHPETArea); + put_module(B_ACPI_MODULE_NAME); + } + + return status; } @@ -413,20 +419,19 @@ hpet_open(const char* name, uint32 flags, void** cookie) hpet_set_enabled(false); - hpet_init_timer(&sHPETRegs->timer[timerNumber]); - - status_t status = hpet_configure_interrupt(&sHPETRegs->timer[timerNumber], &hpetCookie->irq); - if (status == B_OK) - status = install_io_interrupt_handler(hpetCookie->irq, &hpet_timer_interrupt, hpetCookie, 0); - if (status != B_OK) - dprintf("hpet_open(): cannot install interrupt handler: %s\n", strerror(status)); - else - dprintf("hpet_open(): HPET timer uses irq %ld\n", hpetCookie->irq); + status_t status = hpet_init_timer(hpetCookie); + if (status != B_OK) { + dprintf("hpet_open: initializing timer failed: %s\n", strerror(status)); + return status; + } hpet_set_enabled(true); *cookie = hpetCookie; + if (status != B_OK) + atomic_add(&sOpenCount, -1); + return status; } From 65ac830822175445f818fb3a6b7f766224ae7876 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 13 Oct 2011 16:37:03 +0000 Subject: [PATCH 382/702] Fix comparison. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42843 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/intel_extreme/mode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 7a0929a8a2..21646e752e 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -181,8 +181,8 @@ create_mode_list(void) // We could not read any EDID info. Fallback to creating a list with // only the mode set up by the BIOS. // TODO: support lower modes via scaling and windowing - if (gInfo->head_mode & HEAD_MODE_LVDS_PANEL - && ((gInfo->head_mode & HEAD_MODE_A_ANALOG) == 0)) { + if ((gInfo->head_mode & HEAD_MODE_LVDS_PANEL) != 0 + && (gInfo->head_mode & HEAD_MODE_A_ANALOG) == 0) { size_t size = (sizeof(display_mode) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); From ec38b9004636cdf58f725ad76e75de41ddae3779 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 13 Oct 2011 16:47:02 +0000 Subject: [PATCH 383/702] * Use the actual (virtual) width and height instead of the display timing values, as those might be slightly off (when coming from the GTF for example) and cause needless display scaling. * Tiny cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42844 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/intel_extreme/mode.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 21646e752e..4734d39415 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -861,7 +861,7 @@ if (first) { if (divisors.post2 == LVDS_POST2_RATE_FAST) lvds |= LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP; else - lvds &= ~( LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP); + lvds &= ~(LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP); write32(targetRegister, lvds); read32(targetRegister); @@ -988,8 +988,8 @@ if (first) { } write32(INTEL_DISPLAY_B_IMAGE_SIZE, - ((uint32)(target.timing.h_display - 1) << 16) - | ((uint32)target.timing.v_display - 1)); + ((uint32)(target.virtual_width - 1) << 16) + | ((uint32)target.virtual_height - 1)); write32(INTEL_DISPLAY_B_POS, 0); write32(INTEL_DISPLAY_B_PIPE_SIZE, From 832d09b54d60976654d7c61bef9f5025d66c1ca6 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 13 Oct 2011 16:49:46 +0000 Subject: [PATCH 384/702] Apply r42844 to the analog case as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42845 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/intel_extreme/mode.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 4734d39415..5cf2a1ed42 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -1089,8 +1089,8 @@ if (first) { | ((uint32)target.timing.v_sync_start - 1)); write32(INTEL_DISPLAY_A_IMAGE_SIZE, - ((uint32)(target.timing.h_display - 1) << 16) - | ((uint32)target.timing.v_display - 1)); + ((uint32)(target.virtual_width - 1) << 16) + | ((uint32)target.virtual_height - 1)); targetRegister = isSNB ? PCH_DISPLAY_A_ANALOG_PORT : INTEL_DISPLAY_A_ANALOG_PORT; @@ -1115,8 +1115,8 @@ if (first) { if ((gInfo->head_mode & HEAD_MODE_B_DIGITAL) != 0) { write32(INTEL_DISPLAY_B_IMAGE_SIZE, - ((uint32)(target.timing.h_display - 1) << 16) - | ((uint32)target.timing.v_display - 1)); + ((uint32)(target.virtual_width - 1) << 16) + | ((uint32)target.virtual_height - 1)); write32(INTEL_DISPLAY_B_CONTROL, (read32(INTEL_DISPLAY_B_CONTROL) & ~(DISPLAY_CONTROL_COLOR_MASK | DISPLAY_CONTROL_GAMMA)) From 951b5e51470a8f323f194e669e7c79725b500a61 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 13 Oct 2011 16:56:11 +0000 Subject: [PATCH 385/702] More SandyBridge specifics: Use the proper registers for display detection and DPMS. Still needs to be reworked... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42846 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 10 +++- .../accelerants/intel_extreme/accelerant.cpp | 15 ++++-- .../accelerants/intel_extreme/dpms.cpp | 52 +++++++++++-------- 3 files changed, 50 insertions(+), 27 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index 5d38cbcaaa..ecc59c57d5 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -227,6 +227,8 @@ struct intel_free_graphics_memory { // up, SandyBridge, etc.). #define PCH_DE_INTERRUPT_ENABLE 0x4400c // INTEL_INTERRUPT_ENABLED #define PCH_DISPLAY_A_ANALOG_PORT 0xe1100 // INTEL_DISPLAY_A_ANALOG_PORT +#define PCH_DISPLAY_A_DIGITAL_PORT 0xe1120 // INTEL_DISPLAY_A_DIGITAL_PORT +#define PCH_DISPLAY_B_DIGITAL_PORT 0xe1140 // INTEL_DISPLAY_B_DIGITAL_PORT #define PCH_DISPLAY_LVDS_PORT 0xe1180 // INTEL_DISPLAY_LVDS_PORT #define PCH_I2C_IO_A 0xc5010 // INTEL_I2C_IO_A #define PCH_I2C_IO_C 0xc5018 // INTEL_I2C_IO_C @@ -249,6 +251,9 @@ struct intel_free_graphics_memory { #define PCH_TRANSCODER_B_VBLANK 0xe1010 // INTEL_DISPLAY_B_VBLANK #define PCH_TRANSCODER_B_VSYNC 0xe1014 // INTEL_DISPLAY_B_VSYNC +#define PCH_LVDS_DETECTED (1 << 1) + + // SandyBridge (SNB) #define SNB_GRAPHICS_MEMORY_CONTROL 0x50 @@ -387,6 +392,8 @@ struct intel_free_graphics_memory { #define INTEL_DISPLAY_A_CONTROL 0x70180 #define INTEL_DISPLAY_A_BASE 0x70184 #define INTEL_DISPLAY_A_BYTES_PER_ROW 0x70188 +#define INTEL_DISPLAY_A_POS 0x7018c // reserved +#define INTEL_DISPLAY_A_PIPE_SIZE 0x70190 #define INTEL_DISPLAY_A_SURFACE 0x7019c // i965 and up only #define DISPLAY_CONTROL_ENABLED (1UL << 31) #define DISPLAY_CONTROL_GAMMA (1UL << 30) @@ -408,6 +415,7 @@ struct intel_free_graphics_memory { #define DISPLAY_PIPE_VBLANK_STATUS (1UL << 1) #define INTEL_DISPLAY_A_PLL 0x06014 +#define INTEL_DISPLAY_A_PLL_MULTIPLIER_DIVISOR 0x0601c #define INTEL_DISPLAY_A_PLL_DIVISOR_0 0x06040 #define INTEL_DISPLAY_A_PLL_DIVISOR_1 0x06044 @@ -428,7 +436,7 @@ struct intel_free_graphics_memory { #define INTEL_DISPLAY_B_CONTROL 0x71180 #define INTEL_DISPLAY_B_BASE 0x71184 #define INTEL_DISPLAY_B_BYTES_PER_ROW 0x71188 -#define INTEL_DISPLAY_B_POS 0x7118C +#define INTEL_DISPLAY_B_POS 0x7118c #define INTEL_DISPLAY_B_IMAGE_SIZE 0x6101c #define INTEL_DISPLAY_B_SURFACE 0x7119c // i965 and up only diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.cpp b/src/add-ons/accelerants/intel_extreme/accelerant.cpp index 209ce53a81..a3545ccd80 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant.cpp +++ b/src/add-ons/accelerants/intel_extreme/accelerant.cpp @@ -203,22 +203,27 @@ intel_init_accelerant(int device) if (read32(INTEL_DISPLAY_A_PIPE_CONTROL) & DISPLAY_PIPE_ENABLED) gInfo->head_mode |= HEAD_MODE_A_ANALOG; - uint32 lvds = read32(INTEL_DISPLAY_LVDS_PORT); + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + int lvdsRegister = isSNB ? PCH_DISPLAY_LVDS_PORT : INTEL_DISPLAY_LVDS_PORT; + uint32 lvds = read32(lvdsRegister); // If we have an enabled display pipe we save the passed information and // assume it is the valid panel size.. // Later we query for proper EDID info if it exists, or figure something // else out. (Default modes, etc.) - if ((lvds & DISPLAY_PIPE_ENABLED) != 0) { + if ((isSNB && (lvds & PCH_LVDS_DETECTED) != 0) + || (!isSNB && (lvds & DISPLAY_PIPE_ENABLED) != 0)) { save_lvds_mode(); gInfo->head_mode |= HEAD_MODE_LVDS_PANEL; } TRACE(("head detected: %#x\n", gInfo->head_mode)); TRACE(("adpa: %08lx, dova: %08lx, dovb: %08lx, lvds: %08lx\n", - read32(INTEL_DISPLAY_A_ANALOG_PORT), - read32(INTEL_DISPLAY_A_DIGITAL_PORT), - read32(INTEL_DISPLAY_B_DIGITAL_PORT), read32(INTEL_DISPLAY_LVDS_PORT))); + read32(isSNB ? PCH_DISPLAY_A_ANALOG_PORT : INTEL_DISPLAY_A_ANALOG_PORT), + read32(isSNB ? PCH_DISPLAY_A_DIGITAL_PORT + : INTEL_DISPLAY_A_DIGITAL_PORT), + read32(isSNB ? PCH_DISPLAY_B_DIGITAL_PORT + : INTEL_DISPLAY_B_DIGITAL_PORT), read32(lvdsRegister))); status = create_mode_list(); if (status != B_OK) { diff --git a/src/add-ons/accelerants/intel_extreme/dpms.cpp b/src/add-ons/accelerants/intel_extreme/dpms.cpp index 03c4435f72..b45242a6c3 100644 --- a/src/add-ons/accelerants/intel_extreme/dpms.cpp +++ b/src/add-ons/accelerants/intel_extreme/dpms.cpp @@ -104,32 +104,35 @@ set_display_power_mode(uint32 mode) { uint32 monitorMode = 0; + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); if (mode == B_DPMS_ON) { - uint32 pll = read32(INTEL_DISPLAY_A_PLL); + int targetRegister = isSNB ? PCH_DISPLAY_A_PLL : INTEL_DISPLAY_A_PLL; + uint32 pll = read32(targetRegister); if ((pll & DISPLAY_PLL_ENABLED) == 0) { // reactivate PLL - write32(INTEL_DISPLAY_A_PLL, pll); - read32(INTEL_DISPLAY_A_PLL); + write32(targetRegister, pll); + read32(targetRegister); spin(150); - write32(INTEL_DISPLAY_A_PLL, pll | DISPLAY_PLL_ENABLED); - read32(INTEL_DISPLAY_A_PLL); + write32(targetRegister, pll | DISPLAY_PLL_ENABLED); + read32(targetRegister); spin(150); - write32(INTEL_DISPLAY_A_PLL, pll | DISPLAY_PLL_ENABLED); - read32(INTEL_DISPLAY_A_PLL); + write32(targetRegister, pll | DISPLAY_PLL_ENABLED); + read32(targetRegister); spin(150); } - pll = read32(INTEL_DISPLAY_B_PLL); + targetRegister = isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL; + pll = read32(targetRegister); if ((pll & DISPLAY_PLL_ENABLED) == 0) { // reactivate PLL - write32(INTEL_DISPLAY_B_PLL, pll); - read32(INTEL_DISPLAY_B_PLL); + write32(targetRegister, pll); + read32(targetRegister); spin(150); - write32(INTEL_DISPLAY_B_PLL, pll | DISPLAY_PLL_ENABLED); - read32(INTEL_DISPLAY_B_PLL); + write32(targetRegister, pll | DISPLAY_PLL_ENABLED); + read32(targetRegister); spin(150); - write32(INTEL_DISPLAY_B_PLL, pll | DISPLAY_PLL_ENABLED); - read32(INTEL_DISPLAY_B_PLL); + write32(targetRegister, pll | DISPLAY_PLL_ENABLED); + read32(targetRegister); spin(150); } @@ -155,12 +158,16 @@ set_display_power_mode(uint32 mode) } if (gInfo->head_mode & HEAD_MODE_A_ANALOG) { - write32(INTEL_DISPLAY_A_ANALOG_PORT, (read32(INTEL_DISPLAY_A_ANALOG_PORT) + int targetRegister + = isSNB ? PCH_DISPLAY_A_ANALOG_PORT : INTEL_DISPLAY_A_ANALOG_PORT; + write32(targetRegister, (read32(targetRegister) & ~(DISPLAY_MONITOR_MODE_MASK | DISPLAY_MONITOR_PORT_ENABLED)) | monitorMode | (mode != B_DPMS_OFF ? DISPLAY_MONITOR_PORT_ENABLED : 0)); } if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { - write32(INTEL_DISPLAY_B_DIGITAL_PORT, (read32(INTEL_DISPLAY_B_DIGITAL_PORT) + int targetRegister + = isSNB ? PCH_DISPLAY_B_DIGITAL_PORT : INTEL_DISPLAY_B_DIGITAL_PORT; + write32(targetRegister, (read32(targetRegister) & ~(DISPLAY_MONITOR_MODE_MASK | DISPLAY_MONITOR_PORT_ENABLED)) | (mode != B_DPMS_OFF ? DISPLAY_MONITOR_PORT_ENABLED : 0)); // TODO: monitorMode? @@ -173,18 +180,21 @@ set_display_power_mode(uint32 mode) } if (mode == B_DPMS_OFF) { - write32(INTEL_DISPLAY_A_PLL, read32(INTEL_DISPLAY_A_PLL) + int targetRegister = isSNB ? PCH_DISPLAY_A_PLL : INTEL_DISPLAY_A_PLL; + write32(targetRegister, read32(targetRegister) | DISPLAY_PLL_ENABLED); - write32(INTEL_DISPLAY_B_PLL, read32(INTEL_DISPLAY_B_PLL) + targetRegister = isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL; + write32(targetRegister, read32(targetRegister) | DISPLAY_PLL_ENABLED); - read32(INTEL_DISPLAY_B_PLL); - // flush the eventually cached PCI bus writes + read32(targetRegister); + // flush the possibly cached PCI bus writes spin(150); } - if ((gInfo->head_mode & HEAD_MODE_LVDS_PANEL) != 0) + // TODO: fix for SNB + if (!isSNB && (gInfo->head_mode & HEAD_MODE_LVDS_PANEL) != 0) enable_lvds_panel(mode == B_DPMS_ON); read32(INTEL_DISPLAY_A_BASE); From 53aac74407d7640cbc6cea89f3b1c916a58e411e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 13 Oct 2011 17:48:22 +0000 Subject: [PATCH 386/702] * there is only one DDC channel on DVI-I connectors. as such we get valid EDID data for two physical connectors (one analog, one digital) Check for load on the analog or assume digital and keep rolling as normal * style fix, rename bios_*_scratch to biosScratch* git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42847 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/bios.cpp | 24 +-- src/add-ons/accelerants/radeon_hd/display.cpp | 21 +- src/add-ons/accelerants/radeon_hd/encoder.cpp | 185 +++++++++++++----- src/add-ons/accelerants/radeon_hd/encoder.h | 1 + 4 files changed, 166 insertions(+), 65 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index 6919efe33b..c87427d7b1 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -33,28 +33,28 @@ radeon_bios_init_scratch() { radeon_shared_info &info = *gInfo->shared_info; - uint32 bios_2_scratch; - uint32 bios_6_scratch; + uint32 biosScratch2; + uint32 biosScratch6; if (info.device_chipset >= RADEON_R600) { - bios_2_scratch = Read32(OUT, R600_BIOS_2_SCRATCH); - bios_6_scratch = Read32(OUT, R600_BIOS_6_SCRATCH); + biosScratch2 = Read32(OUT, R600_BIOS_2_SCRATCH); + biosScratch6 = Read32(OUT, R600_BIOS_6_SCRATCH); } else { - bios_2_scratch = Read32(OUT, RADEON_BIOS_2_SCRATCH); - bios_6_scratch = Read32(OUT, RADEON_BIOS_6_SCRATCH); + biosScratch2 = Read32(OUT, RADEON_BIOS_2_SCRATCH); + biosScratch6 = Read32(OUT, RADEON_BIOS_6_SCRATCH); } - bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; + biosScratch2 &= ~ATOM_S2_VRI_BRIGHT_ENABLE; // bios should control backlight - bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH; + biosScratch6 |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH; // bios shouldn't handle mode switching if (info.device_chipset >= RADEON_R600) { - Write32(OUT, R600_BIOS_2_SCRATCH, bios_2_scratch); - Write32(OUT, R600_BIOS_6_SCRATCH, bios_6_scratch); + Write32(OUT, R600_BIOS_2_SCRATCH, biosScratch2); + Write32(OUT, R600_BIOS_6_SCRATCH, biosScratch6); } else { - Write32(OUT, RADEON_BIOS_2_SCRATCH, bios_2_scratch); - Write32(OUT, RADEON_BIOS_6_SCRATCH, bios_6_scratch); + Write32(OUT, RADEON_BIOS_2_SCRATCH, biosScratch2); + Write32(OUT, RADEON_BIOS_6_SCRATCH, biosScratch6); } } diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 3afec46c90..f0c1c89b4c 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -651,15 +651,23 @@ detect_displays() for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { if (gConnector[id]->valid == false) continue; - // TODO : currently we skip TV connectors during detection - if (gConnector[id]->encoder.isTV == true) - continue; if (displayIndex >= MAX_DISPLAY) continue; if (radeon_gpu_read_edid(id, &gDisplay[displayIndex]->edid_info)) { + + if (gConnector[id]->encoder.type == VIDEO_ENCODER_TVDAC + || gConnector[id]->encoder.type == VIDEO_ENCODER_DAC) { + // analog? with valid EDID? lets make sure there is load. + // There is only one ddc communications path on DVI-I + if (encoder_analog_load_detect(id) != true) { + TRACE("%s: no analog load on EDID valid connector " + "#%" B_PRIu32 "\n", __func__); + continue; + } + } + gDisplay[displayIndex]->active = true; - // set this display as active gDisplay[displayIndex]->connectorIndex = id; // set physical connector index from gConnector @@ -688,7 +696,6 @@ detect_displays() } } - return B_OK; } @@ -814,7 +821,7 @@ display_crtc_blank(uint8 crtcID, int command) args.ucCRTC = crtcID; args.ucBlanking = command; - atom_execute_table(gAtomContext, index, (uint32 *)&args); + atom_execute_table(gAtomContext, index, (uint32*)&args); } @@ -1025,7 +1032,7 @@ display_crtc_set_dtd(uint8 crtcID, display_mode *mode) args.susModeMiscInfo.usAccess = B_HOST_TO_LENDIAN_INT16(misc); args.ucCRTC = crtcID; - atom_execute_table(gAtomContext, index, (uint32 *)&args); + atom_execute_table(gAtomContext, index, (uint32*)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 622c534c66..fb8dd10004 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -373,6 +373,99 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) } +bool +encoder_analog_load_detect(uint8 connectorIndex) +{ + uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; + uint32 encoderID = gConnector[connectorIndex]->encoder.objectID; + + if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) == 0 + && (encoderFlags & ATOM_DEVICE_CV_SUPPORT) == 0 + && (encoderFlags & ATOM_DEVICE_CRT_SUPPORT) == 0) { + ERROR("%s: executed on non-dac device connector #%" B_PRIu8 "\n", + __func__, connectorIndex); + return false; + } + + // *** tell the card we want to do a DAC detection + + DAC_LOAD_DETECTION_PS_ALLOCATION args; + int index = GetIndexIntoMasterTable(COMMAND, DAC_LoadDetection); + uint8 tableMajor; + uint8 tableMinor; + + memset(&args, 0, sizeof(args)); + + if (atom_parse_cmd_header(gAtomContext, index, &tableMajor, &tableMinor) + != B_OK) { + ERROR("%s: failed getting AtomBIOS header for DAC_LoadDetection\n", + __func__); + return false; + } + + args.sDacload.ucMisc = 0; + + if (encoderID == ENCODER_OBJECT_ID_INTERNAL_DAC1 + || encoderID == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1) { + args.sDacload.ucDacType = ATOM_DAC_A; + } else { + args.sDacload.ucDacType = ATOM_DAC_B; + } + + if ((encoderFlags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { + args.sDacload.usDeviceID + = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CRT1_SUPPORT); + atom_execute_table(gAtomContext, index, (uint32*)&args); + + uint32 biosScratch0 = Read32(OUT, R600_BIOS_0_SCRATCH); + + if ((biosScratch0 & ATOM_S0_CRT1_MASK) != 0) + return true; + + } else if ((encoderFlags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { + args.sDacload.usDeviceID + = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CRT2_SUPPORT); + atom_execute_table(gAtomContext, index, (uint32*)&args); + + uint32 biosScratch0 = Read32(OUT, R600_BIOS_0_SCRATCH); + + if ((biosScratch0 & ATOM_S0_CRT2_MASK) != 0) + return true; + + } else if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0) { + args.sDacload.usDeviceID + = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_CV_SUPPORT); + if (tableMinor >= 3) + args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; + atom_execute_table(gAtomContext, index, (uint32*)&args); + + uint32 biosScratch0 = Read32(OUT, R600_BIOS_0_SCRATCH); + + if ((biosScratch0 & (ATOM_S0_CV_MASK | ATOM_S0_CV_MASK_A)) != 0) + return true; + + } else if ((encoderFlags & ATOM_DEVICE_TV1_SUPPORT) != 0) { + args.sDacload.usDeviceID + = B_HOST_TO_LENDIAN_INT16(ATOM_DEVICE_TV1_SUPPORT); + if (tableMinor >= 3) + args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; + atom_execute_table(gAtomContext, index, (uint32*)&args); + + uint32 biosScratch0 = Read32(OUT, R600_BIOS_0_SCRATCH); + + if ((biosScratch0 + & (ATOM_S0_TV1_COMPOSITE | ATOM_S0_TV1_COMPOSITE_A)) != 0) { + return true; /* Composite connected */ + } else if ((biosScratch0 + & (ATOM_S0_TV1_SVIDEO | ATOM_S0_TV1_SVIDEO_A)) != 0) { + return true; /* S-Video connected */ + } + + } + return false; +} + + void encoder_crtc_scratch(uint8 crtcID) { @@ -382,43 +475,43 @@ encoder_crtc_scratch(uint8 crtcID) uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; // TODO : r500 - uint32 bios_3_scratch = Read32(OUT, R600_BIOS_3_SCRATCH); + uint32 biosScratch3 = Read32(OUT, R600_BIOS_3_SCRATCH); if ((encoderFlags & ATOM_DEVICE_TV1_SUPPORT) != 0) { - bios_3_scratch &= ~ATOM_S3_TV1_CRTC_ACTIVE; - bios_3_scratch |= (crtcID << 18); + biosScratch3 &= ~ATOM_S3_TV1_CRTC_ACTIVE; + biosScratch3 |= (crtcID << 18); } if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0) { - bios_3_scratch &= ~ATOM_S3_CV_CRTC_ACTIVE; - bios_3_scratch |= (crtcID << 24); + biosScratch3 &= ~ATOM_S3_CV_CRTC_ACTIVE; + biosScratch3 |= (crtcID << 24); } if ((encoderFlags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { - bios_3_scratch &= ~ATOM_S3_CRT1_CRTC_ACTIVE; - bios_3_scratch |= (crtcID << 16); + biosScratch3 &= ~ATOM_S3_CRT1_CRTC_ACTIVE; + biosScratch3 |= (crtcID << 16); } if ((encoderFlags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { - bios_3_scratch &= ~ATOM_S3_CRT2_CRTC_ACTIVE; - bios_3_scratch |= (crtcID << 20); + biosScratch3 &= ~ATOM_S3_CRT2_CRTC_ACTIVE; + biosScratch3 |= (crtcID << 20); } if ((encoderFlags & ATOM_DEVICE_LCD1_SUPPORT) != 0) { - bios_3_scratch &= ~ATOM_S3_LCD1_CRTC_ACTIVE; - bios_3_scratch |= (crtcID << 17); + biosScratch3 &= ~ATOM_S3_LCD1_CRTC_ACTIVE; + biosScratch3 |= (crtcID << 17); } if ((encoderFlags & ATOM_DEVICE_DFP1_SUPPORT) != 0) { - bios_3_scratch &= ~ATOM_S3_DFP1_CRTC_ACTIVE; - bios_3_scratch |= (crtcID << 19); + biosScratch3 &= ~ATOM_S3_DFP1_CRTC_ACTIVE; + biosScratch3 |= (crtcID << 19); } if ((encoderFlags & ATOM_DEVICE_DFP2_SUPPORT) != 0) { - bios_3_scratch &= ~ATOM_S3_DFP2_CRTC_ACTIVE; - bios_3_scratch |= (crtcID << 23); + biosScratch3 &= ~ATOM_S3_DFP2_CRTC_ACTIVE; + biosScratch3 |= (crtcID << 23); } if ((encoderFlags & ATOM_DEVICE_DFP3_SUPPORT) != 0) { - bios_3_scratch &= ~ATOM_S3_DFP3_CRTC_ACTIVE; - bios_3_scratch |= (crtcID << 25); + biosScratch3 &= ~ATOM_S3_DFP3_CRTC_ACTIVE; + biosScratch3 |= (crtcID << 25); } // TODO : r500 - Write32(OUT, R600_BIOS_3_SCRATCH, bios_3_scratch); + Write32(OUT, R600_BIOS_3_SCRATCH, biosScratch3); } @@ -431,69 +524,69 @@ encoder_dpms_scratch(uint8 crtcID, bool power) uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; // TODO : r500 - uint32 bios_2_scratch = Read32(OUT, R600_BIOS_2_SCRATCH); + uint32 biosScratch2 = Read32(OUT, R600_BIOS_2_SCRATCH); if ((encoderFlags & ATOM_DEVICE_TV1_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_TV1_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_TV1_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_TV1_DPMS_STATE; + biosScratch2 |= ATOM_S2_TV1_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_CV_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_CV_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_CV_DPMS_STATE; + biosScratch2 |= ATOM_S2_CV_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_CRT1_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_CRT1_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_CRT1_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_CRT1_DPMS_STATE; + biosScratch2 |= ATOM_S2_CRT1_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_CRT2_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_CRT2_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_CRT2_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_CRT2_DPMS_STATE; + biosScratch2 |= ATOM_S2_CRT2_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_LCD1_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_LCD1_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_LCD1_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_LCD1_DPMS_STATE; + biosScratch2 |= ATOM_S2_LCD1_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_DFP1_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_DFP1_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_DFP1_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_DFP1_DPMS_STATE; + biosScratch2 |= ATOM_S2_DFP1_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_DFP2_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_DFP2_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_DFP2_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_DFP2_DPMS_STATE; + biosScratch2 |= ATOM_S2_DFP2_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_DFP3_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_DFP3_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_DFP3_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_DFP3_DPMS_STATE; + biosScratch2 |= ATOM_S2_DFP3_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_DFP4_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_DFP4_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_DFP4_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_DFP4_DPMS_STATE; + biosScratch2 |= ATOM_S2_DFP4_DPMS_STATE; } if ((encoderFlags & ATOM_DEVICE_DFP5_SUPPORT) != 0) { if (power == true) - bios_2_scratch &= ~ATOM_S2_DFP5_DPMS_STATE; + biosScratch2 &= ~ATOM_S2_DFP5_DPMS_STATE; else - bios_2_scratch |= ATOM_S2_DFP5_DPMS_STATE; + biosScratch2 |= ATOM_S2_DFP5_DPMS_STATE; } - Write32(OUT, R600_BIOS_2_SCRATCH, bios_2_scratch); + Write32(OUT, R600_BIOS_2_SCRATCH, biosScratch2); } @@ -588,15 +681,15 @@ void encoder_output_lock(bool lock) { TRACE("%s: %s\n", __func__, lock ? "true" : "false"); - uint32 bios_6_scratch = Read32(OUT, R600_BIOS_6_SCRATCH); + uint32 biosScratch6 = Read32(OUT, R600_BIOS_6_SCRATCH); if (lock) { - bios_6_scratch |= ATOM_S6_CRITICAL_STATE; - bios_6_scratch &= ~ATOM_S6_ACC_MODE; + biosScratch6 |= ATOM_S6_CRITICAL_STATE; + biosScratch6 &= ~ATOM_S6_ACC_MODE; } else { - bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; - bios_6_scratch |= ATOM_S6_ACC_MODE; + biosScratch6 &= ~ATOM_S6_CRITICAL_STATE; + biosScratch6 |= ATOM_S6_ACC_MODE; } - Write32(OUT, R600_BIOS_6_SCRATCH, bios_6_scratch); + Write32(OUT, R600_BIOS_6_SCRATCH, biosScratch6); } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index 9389320e39..9005506eed 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -13,6 +13,7 @@ void encoder_assign_crtc(uint8 crt_id); void encoder_mode_set(uint8 id, uint32 pixelClock); status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command); status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command); +bool encoder_analog_load_detect(uint8 connectorIndex); void encoder_output_lock(bool lock); void encoder_crtc_scratch(uint8 crtcID); void encoder_dpms_scratch(uint8 crtcID, bool power); From e09045d41f067ea34a2fcefedb36c2b83ac4cb5d Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 14 Oct 2011 11:57:39 +0000 Subject: [PATCH 387/702] * Fix debug build of the registrar. * Make the macros use varargs so we avoid multiple invokations of the print function (to properly use with debug_printf for example). * Minor cleanup to the macros. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42848 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/registrar/Debug.h | 42 ++++--- src/servers/registrar/MessageDeliverer.cpp | 28 ++--- .../registrar/MessageRunnerManager.cpp | 4 +- src/servers/registrar/MessagingService.cpp | 16 +-- src/servers/registrar/Registrar.cpp | 18 +-- src/servers/registrar/ShutdownProcess.cpp | 108 +++++++++--------- src/servers/registrar/TRoster.cpp | 72 ++++++------ 7 files changed, 151 insertions(+), 137 deletions(-) diff --git a/src/servers/registrar/Debug.h b/src/servers/registrar/Debug.h index 2b5f06e9b5..34d6d220fe 100644 --- a/src/servers/registrar/Debug.h +++ b/src/servers/registrar/Debug.h @@ -35,28 +35,42 @@ #define DEBUG_APP "REG" #if DEBUG - #define PRINT(x) { __out(DEBUG_APP ": "); __out x; } - #define REPORT_ERROR(status) __out(DEBUG_APP ": %s:%d: %s\n",__FUNCTION__,__LINE__,strerror(status)); - #define RETURN_ERROR(err) { status_t _status = err; if (_status < B_OK) REPORT_ERROR(_status); return _status;} - #define SET_ERROR(var, err) { status_t _status = err; if (_status < B_OK) REPORT_ERROR(_status); var = _status; } - #define FATAL(x) { __out(DEBUG_APP ": "); __out x; } - #define ERROR(x) { __out(DEBUG_APP ": "); __out x; } - #define WARNING(x) { __out(DEBUG_APP ": "); __out x; } - #define INFORM(x) { __out(DEBUG_APP ": "); __out x; } + #define PRINT(x...) { __out(DEBUG_APP ": " x); } + #define REPORT_ERROR(status) \ + __out(DEBUG_APP ": %s:%d: %s\n", __FUNCTION__, __LINE__, \ + strerror(status)); + #define RETURN_ERROR(err) \ + { \ + status_t _status = err; \ + if (_status < B_OK) \ + REPORT_ERROR(_status); \ + return _status; \ + } + #define SET_ERROR(var, err) \ + { \ + status_t _status = err; \ + if (_status < B_OK) \ + REPORT_ERROR(_status); \ + var = _status; \ + } + #define FATAL(x...) { __out(DEBUG_APP ": " x); } + #define ERROR(x...) { __out(DEBUG_APP ": " x); } + #define WARNING(x...) { __out(DEBUG_APP ": " x); } + #define INFORM(x...) { __out(DEBUG_APP ": " x); } #define FUNCTION(x) { __out(DEBUG_APP ": %s() ",__FUNCTION__); __out x; } #define FUNCTION_START() { __out(DEBUG_APP ": %s()\n",__FUNCTION__); } #define FUNCTION_END() { __out(DEBUG_APP ": %s() done\n",__FUNCTION__); } #define D(x) {x;}; #else - #define PRINT(x) ; + #define PRINT(x...) ; #define REPORT_ERROR(status) ; #define RETURN_ERROR(status) return status; #define SET_ERROR(var, err) var = err; - #define FATAL(x) { __out(DEBUG_APP ": "); __out x; } - #define ERROR(x) { __out(DEBUG_APP ": "); __out x; } - #define WARNING(x) { __out(DEBUG_APP ": "); __out x; } - #define INFORM(x) { __out(DEBUG_APP ": "); __out x; } - #define FUNCTION(x) ; + #define FATAL(x...) { __out(DEBUG_APP ": " x); } + #define ERROR(x...) { __out(DEBUG_APP ": " x); } + #define WARNING(x...) { __out(DEBUG_APP ": " x); } + #define INFORM(x...) { __out(DEBUG_APP ": " x); } + #define FUNCTION(x...) ; #define FUNCTION_START() ; #define FUNCTION_END() ; #define D(x) ; diff --git a/src/servers/registrar/MessageDeliverer.cpp b/src/servers/registrar/MessageDeliverer.cpp index 1b383f2d7b..eb5f22a965 100644 --- a/src/servers/registrar/MessageDeliverer.cpp +++ b/src/servers/registrar/MessageDeliverer.cpp @@ -356,8 +356,8 @@ public: status_t PushMessage(Message *message, int32 token) { -PRINT(("MessageDeliverer::TargetPort::PushMessage(port: %ld, %p, %ld)\n", -fPortID, message, token)); +PRINT("MessageDeliverer::TargetPort::PushMessage(port: %ld, %p, %ld)\n", +fPortID, message, token); // create a target message TargetMessage *targetMessage = new(nothrow) TargetMessage(message, token); @@ -390,8 +390,8 @@ fPortID, message, token)); void PopMessage() { if (fMessages.Head()) { -PRINT(("MessageDeliverer::TargetPort::PopMessage(): port: %ld, %p\n", -fPortID, fMessages.Head()->GetMessage())); +PRINT("MessageDeliverer::TargetPort::PopMessage(): port: %ld, %p\n", +fPortID, fMessages.Head()->GetMessage()); _RemoveMessage(fMessages.Head()); } } @@ -405,8 +405,8 @@ fPortID, fMessages.Head()->GetMessage())); if (message->GetMessage()->TimeoutTime() > now) break; -PRINT(("MessageDeliverer::TargetPort::DropTimedOutMessages(): port: %ld: " -"message %p timed out\n", fPortID, message->GetMessage())); +PRINT("MessageDeliverer::TargetPort::DropTimedOutMessages(): port: %ld: " +"message %p timed out\n", fPortID, message->GetMessage()); _RemoveMessage(message); } } @@ -433,15 +433,15 @@ private: { // message count while (fMessageCount > kMaxMessagesPerPort) { -PRINT(("MessageDeliverer::TargetPort::_EnforceLimits(): port: %ld: hit maximum " -"message count limit.\n", fPortID)); +PRINT("MessageDeliverer::TargetPort::_EnforceLimits(): port: %ld: hit maximum " +"message count limit.\n", fPortID); PopMessage(); } // message size while (fMessageSize > kMaxDataPerPort) { -PRINT(("MessageDeliverer::TargetPort::_EnforceLimits(): port: %ld: hit maximum " -"message size limit.\n", fPortID)); +PRINT("MessageDeliverer::TargetPort::_EnforceLimits(): port: %ld: hit maximum " +"message size limit.\n", fPortID); PopMessage(); } } @@ -735,8 +735,8 @@ MessageDeliverer::_SendMessage(Message *message, port_id portID, int32 token) { status_t error = BMessage::Private::SendFlattenedMessage(message->Data(), message->DataSize(), portID, token, 0); -//PRINT(("MessageDeliverer::_SendMessage(%p, port: %ld, token: %ld): %lx\n", -//message, portID, token, error)); +//PRINT("MessageDeliverer::_SendMessage(%p, port: %ld, token: %ld): %lx\n", +//message, portID, token, error); return error; } @@ -773,8 +773,8 @@ MessageDeliverer::_DelivererThread() error = _SendMessage(message, port->PortID(), token); // } else { // // timeout, drop message -// PRINT(("MessageDeliverer::_DelivererThread(): port %ld, " -// "message %p timed out\n", port->PortID(), message)); +// PRINT("MessageDeliverer::_DelivererThread(): port %ld, " +// "message %p timed out\n", port->PortID(), message); // } if (error == B_OK) { diff --git a/src/servers/registrar/MessageRunnerManager.cpp b/src/servers/registrar/MessageRunnerManager.cpp index 6141406bd5..bcafc845cd 100644 --- a/src/servers/registrar/MessageRunnerManager.cpp +++ b/src/servers/registrar/MessageRunnerManager.cpp @@ -751,8 +751,8 @@ MessageRunnerManager::_ScheduleEvent(RunnerInfo *info) info->event->SetTime(info->time); scheduled = fEventQueue->AddEvent(info->event); -PRINT(("runner %ld (%lld, %ld) rescheduled: %d, time: %lld, now: %lld\n", -info->token, info->interval, info->count, scheduled, info->time, system_time())); +PRINT("runner %ld (%lld, %ld) rescheduled: %d, time: %lld, now: %lld\n", +info->token, info->interval, info->count, scheduled, info->time, system_time()); } return scheduled; } diff --git a/src/servers/registrar/MessagingService.cpp b/src/servers/registrar/MessagingService.cpp index eaf7f412b4..5d1758f729 100644 --- a/src/servers/registrar/MessagingService.cpp +++ b/src/servers/registrar/MessagingService.cpp @@ -408,13 +408,13 @@ MessagingService::_CommandProcessor() const messaging_command *command = area->PopCommand(); if (!command) { // something's seriously wrong - ERROR(("MessagingService::_CommandProcessor(): area %p (%ld) " + ERROR("MessagingService::_CommandProcessor(): area %p (%ld) " "has command count %ld, but doesn't return any more " - "commands.", area, area->ID(), area->CountCommands())); + "commands.", area, area->ID(), area->CountCommands()); break; } -PRINT(("MessagingService::_CommandProcessor(): got command %lu\n", -command->command)); +PRINT("MessagingService::_CommandProcessor(): got command %lu\n", +command->command); // dispatch the command MessagingCommandHandler *handler @@ -423,8 +423,8 @@ command->command)); handler->HandleMessagingCommand(command->command, command->data, command->size - sizeof(messaging_command)); } else { - WARNING(("MessagingService::_CommandProcessor(): No handler " - "found for command %lu\n", command->command)); + WARNING("MessagingService::_CommandProcessor(): No handler " + "found for command %lu\n", command->command); } } @@ -439,9 +439,9 @@ command->command)); commandWaiting = true; } else { // Bad, but what can we do? - ERROR(("MessagingService::_CommandProcessor(): Failed to clone " + ERROR("MessagingService::_CommandProcessor(): Failed to clone " "kernel area %ld: %s\n", area->NextKernelAreaID(), - strerror(error))); + strerror(error)); } } diff --git a/src/servers/registrar/Registrar.cpp b/src/servers/registrar/Registrar.cpp index cb6cfb5a56..bcd5ef6323 100644 --- a/src/servers/registrar/Registrar.cpp +++ b/src/servers/registrar/Registrar.cpp @@ -130,8 +130,8 @@ Registrar::ReadyToRun() // create message deliverer status_t error = MessageDeliverer::CreateDefault(); if (error != B_OK) { - FATAL(("Registrar::ReadyToRun(): Failed to create the message " - "deliverer: %s\n", strerror(error))); + FATAL("Registrar::ReadyToRun(): Failed to create the message " + "deliverer: %s\n", strerror(error)); } // create event queue @@ -162,8 +162,8 @@ Registrar::ReadyToRun() // create the messaging service error = MessagingService::CreateDefault(); if (error != B_OK) { - ERROR(("Registrar::ReadyToRun(): Failed to init messaging service " - "(that's by design when running under R5): %s\n", strerror(error))); + ERROR("Registrar::ReadyToRun(): Failed to init messaging service " + "(that's by design when running under R5): %s\n", strerror(error)); } // create and schedule the sanity message event @@ -215,7 +215,7 @@ Registrar::_MessageReceived(BMessage *message) // general requests case B_REG_GET_MIME_MESSENGER: { - PRINT(("B_REG_GET_MIME_MESSENGER\n")); + PRINT("B_REG_GET_MIME_MESSENGER\n"); BMessenger messenger(NULL, fMIMEManager); BMessage reply(B_REG_SUCCESS); reply.AddMessenger("messenger", messenger); @@ -225,7 +225,7 @@ Registrar::_MessageReceived(BMessage *message) case B_REG_GET_CLIPBOARD_MESSENGER: { - PRINT(("B_REG_GET_CLIPBOARD_MESSENGER\n")); + PRINT("B_REG_GET_CLIPBOARD_MESSENGER\n"); BMessenger messenger(fClipboardHandler); BMessage reply(B_REG_SUCCESS); reply.AddMessenger("messenger", messenger); @@ -236,7 +236,7 @@ Registrar::_MessageReceived(BMessage *message) // shutdown process case B_REG_SHUT_DOWN: { - PRINT(("B_REG_SHUT_DOWN\n")); + PRINT("B_REG_SHUT_DOWN\n"); _HandleShutDown(message); break; @@ -425,7 +425,7 @@ main() // rename the main thread rename_thread(find_thread(NULL), kRosterThreadName); - PRINT(("app->Run()...\n")); + PRINT("app->Run()...\n"); try { app->Run(); @@ -438,7 +438,7 @@ main() debugger("registrar main() caught unknown exception"); } - PRINT(("delete app...\n")); + PRINT("delete app...\n"); delete app; FUNCTION_END(); diff --git a/src/servers/registrar/ShutdownProcess.cpp b/src/servers/registrar/ShutdownProcess.cpp index a611348dff..3482119424 100644 --- a/src/servers/registrar/ShutdownProcess.cpp +++ b/src/servers/registrar/ShutdownProcess.cpp @@ -670,7 +670,7 @@ ShutdownProcess::~ShutdownProcess() status_t ShutdownProcess::Init(BMessage* request) { - PRINT(("ShutdownProcess::Init()\n")); + PRINT("ShutdownProcess::Init()\n"); // create and add the quit request reply handler fQuitRequestReplyHandler = new(nothrow) QuitRequestReplyHandler(this); @@ -720,7 +720,7 @@ ShutdownProcess::Init(BMessage* request) resume_thread(fWorker); - PRINT(("ShutdownProcess::Init() done\n")); + PRINT("ShutdownProcess::Init() done\n"); return B_OK; } @@ -739,8 +739,8 @@ ShutdownProcess::MessageReceived(BMessage* message) return; } - PRINT(("ShutdownProcess::MessageReceived(): B_SOME_APP_QUIT: %ld\n", - team)); + PRINT("ShutdownProcess::MessageReceived(): B_SOME_APP_QUIT: %ld\n", + team); // remove the app info from the respective list int32 phase; @@ -774,7 +774,7 @@ ShutdownProcess::MessageReceived(BMessage* message) // get the phase the event is intended for int32 phase = TimeoutEvent::GetMessagePhase(message); team_id team = TimeoutEvent::GetMessageTeam(message);; - PRINT(("MSG_PHASE_TIMED_OUT: phase: %ld, team: %ld\n", phase, team)); + PRINT("MSG_PHASE_TIMED_OUT: phase: %ld, team: %ld\n", phase, team); BAutolock _(fWorkerLock); @@ -837,10 +837,10 @@ ShutdownProcess::MessageReceived(BMessage* message) BAutolock _(fWorkerLock); if (open) { - PRINT(("B_REG_TEAM_DEBUGGER_ALERT: insert %ld\n", team)); + PRINT("B_REG_TEAM_DEBUGGER_ALERT: insert %ld\n", team); fDebuggedTeams.insert(team); } else { - PRINT(("B_REG_TEAM_DEBUGGER_ALERT: remove %ld\n", team)); + PRINT("B_REG_TEAM_DEBUGGER_ALERT: remove %ld\n", team); fDebuggedTeams.erase(team); _PushEvent(DEBUG_EVENT, -1, fCurrentPhase); } @@ -947,8 +947,8 @@ ShutdownProcess::_InitShutdownWindow() _AddShutdownWindowApps(fUserApps); _AddShutdownWindowApps(fSystemApps); } else { - WARNING(("ShutdownProcess::Init(): Failed to create or init " - "shutdown window.")); + WARNING("ShutdownProcess::Init(): Failed to create or init " + "shutdown window."); fHasGUI = false; } @@ -969,18 +969,18 @@ ShutdownProcess::_AddShutdownWindowApps(AppInfoList& infos) BFile file; status_t error = file.SetTo(&info->ref, B_READ_ONLY); if (error != B_OK) { - WARNING(("ShutdownProcess::_AddShutdownWindowApps(): Failed to " + WARNING("ShutdownProcess::_AddShutdownWindowApps(): Failed to " "open file for app %s: %s\n", info->signature, - strerror(error))); + strerror(error)); continue; } BAppFileInfo appFileInfo; error = appFileInfo.SetTo(&file); if (error != B_OK) { - WARNING(("ShutdownProcess::_AddShutdownWindowApps(): Failed to " + WARNING("ShutdownProcess::_AddShutdownWindowApps(): Failed to " "init app file info for app %s: %s\n", info->signature, - strerror(error))); + strerror(error)); } // get the application icons @@ -1017,8 +1017,8 @@ ShutdownProcess::_AddShutdownWindowApps(AppInfoList& infos) // add the app error = fWindow->AddApp(info->team, miniIcon, largeIcon); if (error != B_OK) { - WARNING(("ShutdownProcess::_AddShutdownWindowApps(): Failed to " - "add app to the shutdown window: %s\n", strerror(error))); + WARNING("ShutdownProcess::_AddShutdownWindowApps(): Failed to " + "add app to the shutdown window: %s\n", strerror(error)); } } } @@ -1126,7 +1126,7 @@ ShutdownProcess::_PrepareShutdownMessage(BMessage& message) const status_t ShutdownProcess::_ShutDown() { - PRINT(("Invoking _kern_shutdown(%d)\n", fReboot)); + PRINT("Invoking _kern_shutdown(%d)\n", fReboot); RETURN_ERROR(_kern_shutdown(fReboot)); } @@ -1136,7 +1136,7 @@ ShutdownProcess::_PushEvent(uint32 eventType, team_id team, int32 phase) { InternalEvent* event = new(nothrow) InternalEvent(eventType, team, phase); if (!event) { - ERROR(("ShutdownProcess::_PushEvent(): Failed to create event!\n")); + ERROR("ShutdownProcess::_PushEvent(): Failed to create event!\n"); return B_NO_MEMORY; } @@ -1214,8 +1214,8 @@ ShutdownProcess::_Worker() _WorkerDoShutdown(); fShutdownError = B_OK; } catch (status_t error) { - PRINT(("ShutdownProcess::_Worker(): error while shutting down: %s\n", - strerror(error))); + PRINT("ShutdownProcess::_Worker(): error while shutting down: %s\n", + strerror(error)); fShutdownError = error; } @@ -1232,7 +1232,7 @@ ShutdownProcess::_Worker() void ShutdownProcess::_WorkerDoShutdown() { - PRINT(("ShutdownProcess::_WorkerDoShutdown()\n")); + PRINT("ShutdownProcess::_WorkerDoShutdown()\n"); // If we are here, the shutdown process has been initiated successfully, // that is, if an asynchronous BRoster::Shutdown() was requested, we @@ -1336,7 +1336,7 @@ ShutdownProcess::_WorkerDoShutdown() _ShutDown(); _SetShutdownWindowWaitForShutdown(); - PRINT((" _kern_shutdown() failed\n")); + PRINT(" _kern_shutdown() failed\n"); // shutdown failed: This can happen for power off mode -- reboot should // always work. @@ -1397,8 +1397,8 @@ ShutdownProcess::_WaitForApp(team_id team, AppInfoList* list, bool systemApps) return false; } else { // The app returned false in QuitRequested(). - PRINT(("ShutdownProcess::_WaitForApp(): shutdown cancelled " - "by team %ld (-1 => user)\n", eventTeam)); + PRINT("ShutdownProcess::_WaitForApp(): shutdown cancelled " + "by team %ld (-1 => user)\n", eventTeam); _DisplayAbortingApp(team); throw_error(B_SHUTDOWN_CANCELLED); @@ -1417,8 +1417,8 @@ ShutdownProcess::_WaitForApp(team_id team, AppInfoList* list, bool systemApps) void ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps) { - PRINT(("ShutdownProcess::_QuitApps(%s)\n", - (systemApps ? "system" : "user"))); + PRINT("ShutdownProcess::_QuitApps(%s)\n", + (systemApps ? "system" : "user")); if (systemApps) { _SetShutdownWindowCancelButtonEnabled(false); @@ -1433,8 +1433,8 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps) throw_error(error); if (event == ABORT_EVENT) { - PRINT(("ShutdownProcess::_QuitApps(): shutdown cancelled by " - "team %ld (-1 => user)\n", team)); + PRINT("ShutdownProcess::_QuitApps(): shutdown cancelled by " + "team %ld (-1 => user)\n", team); _DisplayAbortingApp(team); throw_error(B_SHUTDOWN_CANCELLED); @@ -1459,8 +1459,8 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps) throw_error(error); if (!systemApps && event == ABORT_EVENT) { - PRINT(("ShutdownProcess::_QuitApps(): shutdown cancelled by " - "team %ld (-1 => user)\n", team)); + PRINT("ShutdownProcess::_QuitApps(): shutdown cancelled by " + "team %ld (-1 => user)\n", team); _DisplayAbortingApp(team); throw_error(B_SHUTDOWN_CANCELLED); @@ -1488,7 +1488,7 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps) } if (team < 0) { - PRINT(("ShutdownProcess::_QuitApps() done\n")); + PRINT("ShutdownProcess::_QuitApps() done\n"); return; } @@ -1499,8 +1499,8 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps) _SetShutdownWindowCurrentApp(team); // send the shutdown message to the app - PRINT((" sending team %ld (port: %ld) a shutdown message\n", team, - port)); + PRINT(" sending team %ld (port: %ld) a shutdown message\n", team, + port); SingleMessagingTargetSet target(port, B_PREFERRED_TOKEN); MessageDeliverer::Default()->DeliverMessage(&message, target); @@ -1533,7 +1533,7 @@ ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps) void ShutdownProcess::_QuitBackgroundApps() { - PRINT(("ShutdownProcess::_QuitBackgroundApps()\n")); + PRINT("ShutdownProcess::_QuitBackgroundApps()\n"); _SetShutdownWindowText( B_TRANSLATE("Asking background applications to quit.")); @@ -1548,26 +1548,26 @@ ShutdownProcess::_QuitBackgroundApps() AppInfoListMessagingTargetSet targetSet(fBackgroundApps); if (targetSet.HasNext()) { - PRINT((" sending shutdown message to %ld apps\n", - fBackgroundApps.CountInfos())); + PRINT(" sending shutdown message to %ld apps\n", + fBackgroundApps.CountInfos()); status_t error = MessageDeliverer::Default()->DeliverMessage( &message, targetSet); if (error != B_OK) { - WARNING(("_QuitBackgroundApps::_Worker(): Failed to deliver " + WARNING("_QuitBackgroundApps::_Worker(): Failed to deliver " "shutdown message to all applications: %s\n", - strerror(error))); + strerror(error)); } } - PRINT(("ShutdownProcess::_QuitBackgroundApps() done\n")); + PRINT("ShutdownProcess::_QuitBackgroundApps() done\n"); } void ShutdownProcess::_WaitForBackgroundApps() { - PRINT(("ShutdownProcess::_WaitForBackgroundApps()\n")); + PRINT("ShutdownProcess::_WaitForBackgroundApps()\n"); // wait for user apps bool moreApps = true; @@ -1594,14 +1594,14 @@ ShutdownProcess::_WaitForBackgroundApps() } } - PRINT(("ShutdownProcess::_WaitForBackgroundApps() done\n")); + PRINT("ShutdownProcess::_WaitForBackgroundApps() done\n"); } void ShutdownProcess::_KillBackgroundApps() { - PRINT(("ShutdownProcess::_KillBackgroundApps()\n")); + PRINT("ShutdownProcess::_KillBackgroundApps()\n"); while (true) { // eat events (we need to be responsive for an abort event) @@ -1631,7 +1631,7 @@ ShutdownProcess::_KillBackgroundApps() if (team < 0) { - PRINT(("ShutdownProcess::_KillBackgroundApps() done\n")); + PRINT("ShutdownProcess::_KillBackgroundApps() done\n"); return; } @@ -1645,7 +1645,7 @@ ShutdownProcess::_KillBackgroundApps() void ShutdownProcess::_QuitNonApps() { - PRINT(("ShutdownProcess::_QuitNonApps()\n")); + PRINT("ShutdownProcess::_QuitNonApps()\n"); _SetShutdownWindowText(B_TRANSLATE("Asking other processes to quit.")); @@ -1654,7 +1654,7 @@ ShutdownProcess::_QuitNonApps() team_info teamInfo; while (get_next_team_info(&cookie, &teamInfo) == B_OK) { if (fVitalSystemApps.find(teamInfo.team) == fVitalSystemApps.end()) { - PRINT((" sending team %ld TERM signal\n", teamInfo.team)); + PRINT(" sending team %ld TERM signal\n", teamInfo.team); #ifdef __HAIKU__ // Note: team ID == team main thread ID under Haiku @@ -1675,7 +1675,7 @@ ShutdownProcess::_QuitNonApps() cookie = 0; while (get_next_team_info(&cookie, &teamInfo) == B_OK) { if (fVitalSystemApps.find(teamInfo.team) == fVitalSystemApps.end()) { - PRINT((" killing team %ld\n", teamInfo.team)); + PRINT(" killing team %ld\n", teamInfo.team); #ifdef __HAIKU__ kill_team(teamInfo.team); @@ -1686,7 +1686,7 @@ ShutdownProcess::_QuitNonApps() } } - PRINT(("ShutdownProcess::_QuitNonApps() done\n")); + PRINT("ShutdownProcess::_QuitNonApps() done\n"); } @@ -1735,8 +1735,8 @@ ShutdownProcess::_QuitBlockingApp(AppInfoList& list, team_id team, if (event == ABORT_EVENT) { if (cancelAllowed || debugged) { - PRINT(("ShutdownProcess::_QuitBlockingApp(): shutdown " - "cancelled by team %ld (-1 => user)\n", eventTeam)); + PRINT("ShutdownProcess::_QuitBlockingApp(): shutdown " + "cancelled by team %ld (-1 => user)\n", eventTeam); if (!debugged) _DisplayAbortingApp(eventTeam); @@ -1758,7 +1758,7 @@ ShutdownProcess::_QuitBlockingApp(AppInfoList& list, team_id team, } // kill the app - PRINT((" killing team %ld\n", team)); + PRINT(" killing team %ld\n", team); kill_team(team); @@ -1797,8 +1797,8 @@ ShutdownProcess::_DisplayAbortingApp(team_id team) } if (!foundApp) { - PRINT(("ShutdownProcess::_DisplayAbortingApp(): Didn't find the app " - "that has cancelled the shutdown.\n")); + PRINT("ShutdownProcess::_DisplayAbortingApp(): Didn't find the app " + "that has cancelled the shutdown.\n"); return; } @@ -1842,14 +1842,14 @@ ShutdownProcess::_DisplayAbortingApp(team_id team) void ShutdownProcess::_WaitForDebuggedTeams() { - PRINT(("ShutdownProcess::_WaitForDebuggedTeams()\n")); + PRINT("ShutdownProcess::_WaitForDebuggedTeams()\n"); { BAutolock _(fWorkerLock); if (fDebuggedTeams.empty()) return; } - PRINT((" not empty!\n")); + PRINT(" not empty!\n"); // wait for something to happen while (true) { @@ -1865,7 +1865,7 @@ ShutdownProcess::_WaitForDebuggedTeams() BAutolock _(fWorkerLock); if (fDebuggedTeams.empty()) { - PRINT((" out empty")); + PRINT(" out empty"); return; } } diff --git a/src/servers/registrar/TRoster.cpp b/src/servers/registrar/TRoster.cpp index 279b192334..269fd1adb6 100644 --- a/src/servers/registrar/TRoster.cpp +++ b/src/servers/registrar/TRoster.cpp @@ -185,8 +185,8 @@ TRoster::HandleAddApplication(BMessage* request) if (request->FindBool("full_registration", &fullReg) != B_OK) fullReg = false; - PRINT(("team: %ld, signature: %s\n", team, signature)); - PRINT(("full registration: %d\n", fullReg)); + PRINT("team: %ld, signature: %s\n", team, signature); + PRINT("full registration: %d\n", fullReg); if (fShuttingDown) error = B_SHUTTING_DOWN; @@ -205,8 +205,8 @@ TRoster::HandleAddApplication(BMessage* request) // entry_ref if (error == B_OK) { - PRINT(("flags: %lx\n", flags)); - PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name)); + PRINT("flags: %lx\n", flags); + PRINT("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name); // check single/exclusive launchers RosterAppInfo* info = NULL; if ((launchFlags == B_SINGLE_LAUNCH @@ -255,15 +255,15 @@ TRoster::HandleAddApplication(BMessage* request) // add it to the right list bool addingSuccess = false; if (team >= 0) { - PRINT(("added ref: %ld, %lld, %s\n", info->ref.device, - info->ref.directory, info->ref.name)); + PRINT("added ref: %ld, %lld, %s\n", info->ref.device, + info->ref.directory, info->ref.name); addingSuccess = (AddApp(info) == B_OK); if (addingSuccess && fullReg) _AppAdded(info); } else { token = info->token = _NextToken(); addingSuccess = fEarlyPreRegisteredApps.AddInfo(info); - PRINT(("added to early pre-regs, token: %lu\n", token)); + PRINT("added to early pre-regs, token: %lu\n", token); } if (!addingSuccess) SET_ERROR(error, B_NO_MEMORY); @@ -387,8 +387,8 @@ TRoster::HandleIsAppRegistered(BMessage* request) if (request->FindInt32("token", (int32*)&token) != B_OK) token = 0; - PRINT(("team: %ld, token: %lu\n", team, token)); - PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name)); + PRINT("team: %ld, token: %lu\n", team, token); + PRINT("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name); // check the parameters // entry_ref @@ -402,24 +402,24 @@ TRoster::HandleIsAppRegistered(BMessage* request) RosterAppInfo* info = NULL; if (error == B_OK) { if ((info = fRegisteredApps.InfoFor(team)) != NULL) { - PRINT(("found team in fRegisteredApps\n")); + PRINT("found team in fRegisteredApps\n"); _ReplyToIARRequest(request, info); } else if (token > 0 && (info = fEarlyPreRegisteredApps.InfoForToken(token)) != NULL) { - PRINT(("found ref in fEarlyRegisteredApps (by token)\n")); + PRINT("found ref in fEarlyRegisteredApps (by token)\n"); // pre-registered and has no team ID assigned yet -- queue the // request be_app->DetachCurrentMessage(); _AddIARRequest(fIARRequestsByToken, token, request); } else if (team >= 0 && (info = fEarlyPreRegisteredApps.InfoFor(&ref)) != NULL) { - PRINT(("found ref in fEarlyRegisteredApps (by ref)\n")); + PRINT("found ref in fEarlyRegisteredApps (by ref)\n"); // pre-registered and has no team ID assigned yet -- queue the // request be_app->DetachCurrentMessage(); _AddIARRequest(fIARRequestsByID, team, request); } else { - PRINT(("didn't find team or ref\n")); + PRINT("didn't find team or ref\n"); // team not registered, ref/token not early pre-registered _ReplyToIARRequest(request, NULL); } @@ -488,7 +488,7 @@ TRoster::HandleRemoveApp(BMessage* request) if (request->FindInt32("team", &team) != B_OK) team = -1; - PRINT(("team: %ld\n", team)); + PRINT("team: %ld\n", team); // remove the app if (error == B_OK) { @@ -540,7 +540,7 @@ TRoster::HandleSetThreadAndTeam(BMessage* request) if (error == B_OK && team < 0) SET_ERROR(error, B_BAD_VALUE); - PRINT(("team: %ld, thread: %ld, token: %lu\n", team, thread, token)); + PRINT("team: %ld, thread: %ld, token: %lu\n", team, thread, token); // update the app_info if (error == B_OK) { @@ -669,11 +669,11 @@ TRoster::HandleGetAppInfo(BMessage* request) hasSignature = false; if (hasTeam) -PRINT(("team: %ld\n", team)); +PRINT("team: %ld\n", team); if (hasRef) -PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name)); +PRINT("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name); if (hasSignature) -PRINT(("signature: %s\n", signature)); +PRINT("signature: %s\n", signature); // get the info RosterAppInfo* info = NULL; @@ -985,7 +985,7 @@ TRoster::HandleGetRecentApps(BMessage* request) BAutolock _(fLock); if (!request) { - D(PRINT(("WARNING: TRoster::HandleGetRecentApps(NULL) called\n"))); + D(PRINT("WARNING: TRoster::HandleGetRecentApps(NULL) called\n")); return; } @@ -1013,7 +1013,7 @@ TRoster::HandleAddToRecentDocuments(BMessage* request) BAutolock _(fLock); if (!request) { - D(PRINT(("WARNING: TRoster::HandleAddToRecentDocuments(NULL) called\n"))); + D(PRINT("WARNING: TRoster::HandleAddToRecentDocuments(NULL) called\n")); return; } @@ -1044,7 +1044,7 @@ TRoster::HandleAddToRecentFolders(BMessage* request) BAutolock _(fLock); if (!request) { - D(PRINT(("WARNING: TRoster::HandleAddToRecentFolders(NULL) called\n"))); + D(PRINT("WARNING: TRoster::HandleAddToRecentFolders(NULL) called\n")); return; } @@ -1075,7 +1075,7 @@ TRoster::HandleAddToRecentApps(BMessage* request) BAutolock _(fLock); if (!request) { - D(PRINT(("WARNING: TRoster::HandleAddToRecentApps(NULL) called\n"))); + D(PRINT("WARNING: TRoster::HandleAddToRecentApps(NULL) called\n")); return; } @@ -1100,7 +1100,7 @@ TRoster::HandleLoadRecentLists(BMessage* request) BAutolock _(fLock); if (!request) { - D(PRINT(("WARNING: TRoster::HandleLoadRecentLists(NULL) called\n"))); + D(PRINT("WARNING: TRoster::HandleLoadRecentLists(NULL) called\n")); return; } @@ -1125,7 +1125,7 @@ TRoster::HandleSaveRecentLists(BMessage* request) BAutolock _(fLock); if (!request) { - D(PRINT(("WARNING: TRoster::HandleSaveRecentLists(NULL) called\n"))); + D(PRINT("WARNING: TRoster::HandleSaveRecentLists(NULL) called\n")); return; } @@ -1687,7 +1687,7 @@ TRoster::_ReplyToIARRequest(BMessage* request, const RosterAppInfo* info) BMessage reply(B_REG_SUCCESS); reply.AddBool("registered", (bool)info); reply.AddBool("pre-registered", preRegistered); - PRINT(("_ReplyToIARRequest(): pre-registered: %d\n", preRegistered)); + PRINT("_ReplyToIARRequest(): pre-registered: %d\n", preRegistered); if (info) _AddMessageAppInfo(&reply, info); request->SendReply(&reply); @@ -1702,7 +1702,7 @@ TRoster::_HandleGetRecentEntries(BMessage* request) { FUNCTION_START(); if (!request) { - D(PRINT(("WARNING: TRoster::HandleGetRecentFolders(NULL) called\n"))); + D(PRINT("WARNING: TRoster::HandleGetRecentFolders(NULL) called\n")); return; } @@ -1763,9 +1763,9 @@ TRoster::_HandleGetRecentEntries(BMessage* request) break; default: - D(PRINT(("WARNING: TRoster::_HandleGetRecentEntries(): " + D(PRINT("WARNING: TRoster::_HandleGetRecentEntries(): " "unexpected request->what value of 0x%lx\n", - request->what))); + request->what)); error = B_BAD_VALUE; break; } @@ -1984,8 +1984,8 @@ TRoster::_LoadRosterSettings(const char* path) ); } if (error) { - D(PRINT(("WARNING: TRoster::_LoadRosterSettings(): error loading roster " - "settings from '%s', 0x%lx\n", settingsPath, error))); + D(PRINT("WARNING: TRoster::_LoadRosterSettings(): error loading roster " + "settings from '%s', 0x%lx\n", settingsPath, error)); } return error; } @@ -2007,18 +2007,18 @@ TRoster::_SaveRosterSettings(const char* path) status_t saveError; saveError = fRecentDocuments.Save(file, "Recent documents", "RecentDoc"); if (saveError) { - D(PRINT(("TRoster::_SaveRosterSettings(): recent documents save " - "failed with error 0x%lx\n", saveError))); + D(PRINT("TRoster::_SaveRosterSettings(): recent documents save " + "failed with error 0x%lx\n", saveError)); } saveError = fRecentFolders.Save(file, "Recent folders", "RecentFolder"); if (saveError) { - D(PRINT(("TRoster::_SaveRosterSettings(): recent folders save " - "failed with error 0x%lx\n", saveError))); + D(PRINT("TRoster::_SaveRosterSettings(): recent folders save " + "failed with error 0x%lx\n", saveError)); } saveError = fRecentApps.Save(file); if (saveError) { - D(PRINT(("TRoster::_SaveRosterSettings(): recent folders save " - "failed with error 0x%lx\n", saveError))); + D(PRINT("TRoster::_SaveRosterSettings(): recent folders save " + "failed with error 0x%lx\n", saveError)); } fclose(file); } From 2cc1b103860866ce3445df7707fb32f70437aba4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 14 Oct 2011 18:34:45 +0000 Subject: [PATCH 388/702] * make atombios lockup checking adjustments more robust git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42849 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 69501d946d..04fe4e4245 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -35,8 +35,14 @@ #include "atom-bits.h" -#undef TRACE +/* AtomBIOS loop detection + * Number of repeat AtomBIOS jmp operations + * before bailing due to stuck in a loop + */ +#define ATOM_OP_JMP_TIMEOUT 128 +// *** Tracing +#undef TRACE //#define TRACE_ATOM #ifdef TRACE_ATOM # define TRACE(x...) _sPrintf("radeon_hd: " x) @@ -64,6 +70,7 @@ #define PLL_INDEX 2 #define PLL_DATA 3 + typedef struct { atom_context *ctx; @@ -641,9 +648,10 @@ atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) if (execute) { if (ctx->last_jump == (ctx->start + target)) { - if (ctx->last_jump_count > 128) { - ERROR("%s: DANGER! AtomBIOS stuck in infinite loop" - " for more then 128 jumps... abort!\n", __func__); + if (ctx->last_jump_count > ATOM_OP_JMP_TIMEOUT) { + ERROR("%s: DANGER! AtomBIOS stuck in loop" + " for more then %d jumps... abort!\n", + __func__, ATOM_OP_JMP_TIMEOUT); ctx->abort = true; } else { ctx->last_jump_count++; From 395d16a9bd615881a63bcfb31e04ad12de377bb7 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 14 Oct 2011 19:11:29 +0000 Subject: [PATCH 389/702] Some more SandyBridge specifics to get V-blank interrupts going. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42850 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 8 +++- .../graphics/intel_extreme/intel_extreme.cpp | 40 +++++++++++++------ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index ecc59c57d5..8fc3ae73ee 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -225,7 +225,11 @@ struct intel_free_graphics_memory { // to a PCH based one, that means anything that used to communicate via (G)MCH // registers needs to use different ones on PCH based platforms (Ironlake and // up, SandyBridge, etc.). -#define PCH_DE_INTERRUPT_ENABLE 0x4400c // INTEL_INTERRUPT_ENABLED +#define PCH_DE_POWER_MEASUREMENT 0x42400 +#define PCH_DE_INTERRUPT_STATUS 0x44000 // INTEL_INTERRUPT_STATUS +#define PCH_DE_INTERRUPT_MASK 0x44004 // INTEL_INTERRUPT_MASK +#define PCH_DE_INTERRUPT_IDENTITY 0x44008 // INTEL_INTERRUPT_IDENTITY +#define PCH_DE_INTERRUPT_ENABLED 0x4400c // INTEL_INTERRUPT_ENABLED #define PCH_DISPLAY_A_ANALOG_PORT 0xe1100 // INTEL_DISPLAY_A_ANALOG_PORT #define PCH_DISPLAY_A_DIGITAL_PORT 0xe1120 // INTEL_DISPLAY_A_DIGITAL_PORT #define PCH_DISPLAY_B_DIGITAL_PORT 0xe1140 // INTEL_DISPLAY_B_DIGITAL_PORT @@ -252,6 +256,8 @@ struct intel_free_graphics_memory { #define PCH_TRANSCODER_B_VSYNC 0xe1014 // INTEL_DISPLAY_B_VSYNC #define PCH_LVDS_DETECTED (1 << 1) +#define PCH_INTERRUPT_VBLANK_PIPEA (1 << 7) +#define PCH_INTERRUPT_VBLANK_PIPEB (1 << 15) // SandyBridge (SNB) diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index ef6b0aec8c..e959216691 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -76,13 +76,16 @@ intel_interrupt_handler(void *data) { intel_info &info = *(intel_info *)data; - uint32 identity = read16(info.registers + INTEL_INTERRUPT_IDENTITY); + bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); + uint32 identity = read16(info.registers + + (isSNB ? PCH_DE_INTERRUPT_IDENTITY : INTEL_INTERRUPT_IDENTITY)); if (identity == 0) return B_UNHANDLED_INTERRUPT; int32 handled = B_HANDLED_INTERRUPT; - if ((identity & INTERRUPT_VBLANK_PIPEA) != 0) { + uint32 mask = isSNB ? PCH_INTERRUPT_VBLANK_PIPEA : INTERRUPT_VBLANK_PIPEA; + if ((identity & mask) != 0) { handled = release_vblank_sem(info); // make sure we'll get another one of those @@ -90,7 +93,8 @@ intel_interrupt_handler(void *data) DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); } - if ((identity & INTERRUPT_VBLANK_PIPEB) != 0) { + mask = isSNB ? PCH_INTERRUPT_VBLANK_PIPEB : INTERRUPT_VBLANK_PIPEB; + if ((identity & mask) != 0) { handled = release_vblank_sem(info); // make sure we'll get another one of those @@ -99,7 +103,8 @@ intel_interrupt_handler(void *data) } // setting the bit clears it! - write16(info.registers + INTEL_INTERRUPT_IDENTITY, identity); + write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_IDENTITY + : INTEL_INTERRUPT_IDENTITY), identity); return handled; } @@ -137,14 +142,22 @@ init_interrupt_handler(intel_info &info) DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); write32(info.registers + INTEL_DISPLAY_B_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); - write16(info.registers + INTEL_INTERRUPT_IDENTITY, ~0); + + bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); + write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_IDENTITY + : INTEL_INTERRUPT_IDENTITY), ~0); // enable interrupts - we only want VBLANK interrupts - write16(info.registers + INTEL_INTERRUPT_ENABLED, - read16(info.registers + INTEL_INTERRUPT_ENABLED) - | INTERRUPT_VBLANK_PIPEA | INTERRUPT_VBLANK_PIPEB); - write16(info.registers + INTEL_INTERRUPT_MASK, - ~(INTERRUPT_VBLANK_PIPEA | INTERRUPT_VBLANK_PIPEB)); + uint16 enable = isSNB + ? (PCH_INTERRUPT_VBLANK_PIPEA | PCH_INTERRUPT_VBLANK_PIPEB) + : (INTERRUPT_VBLANK_PIPEA | INTERRUPT_VBLANK_PIPEB); + + write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_ENABLED + : INTEL_INTERRUPT_ENABLED), + read16(info.registers + (isSNB ? PCH_DE_INTERRUPT_ENABLED + : INTEL_INTERRUPT_ENABLED)) | enable); + write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_MASK + : INTEL_INTERRUPT_MASK), ~enable); } } if (status < B_OK) { @@ -354,8 +367,11 @@ intel_extreme_uninit(intel_info &info) if (!info.fake_interrupts && info.shared_info->vblank_sem > 0) { // disable interrupt generation - write16(info.registers + INTEL_INTERRUPT_ENABLED, 0); - write16(info.registers + INTEL_INTERRUPT_MASK, ~0); + bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); + write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_ENABLED + : INTEL_INTERRUPT_ENABLED), 0); + write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_MASK + : INTEL_INTERRUPT_MASK), ~0); remove_io_interrupt_handler(info.pci->u.h0.interrupt_line, intel_interrupt_handler, &info); From bff57edf94aa70c5437710e75e0f62e7bc7a2516 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 14 Oct 2011 19:30:20 +0000 Subject: [PATCH 390/702] Add indexed color mode support for SandyBridge. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42851 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/intel_extreme/intel_extreme.h | 2 ++ src/add-ons/accelerants/intel_extreme/mode.cpp | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index 8fc3ae73ee..23df8cd13b 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -254,6 +254,8 @@ struct intel_free_graphics_memory { #define PCH_TRANSCODER_B_VTOTAL 0xe100c // INTEL_DISPLAY_B_VTOTAL #define PCH_TRANSCODER_B_VBLANK 0xe1010 // INTEL_DISPLAY_B_VBLANK #define PCH_TRANSCODER_B_VSYNC 0xe1014 // INTEL_DISPLAY_B_VSYNC +#define PCH_DISPLAY_A_PALETTE 0x4a000 // INTEL_DISPLAY_A_PALETTE +#define PCH_DISPLAY_B_PALETTE 0x4a800 // INTEL_DISPLAY_B_PALETTE #define PCH_LVDS_DETECTED (1 << 1) #define PCH_INTERRUPT_VBLANK_PIPEA (1 << 7) diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 5cf2a1ed42..6cf97ab5a5 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -1259,8 +1259,11 @@ intel_set_indexed_colors(uint count, uint8 first, uint8 *colors, uint32 flags) uint32 color = colors[0] << 16 | colors[1] << 8 | colors[2]; colors += 3; - write32(INTEL_DISPLAY_A_PALETTE + first * sizeof(uint32), color); - write32(INTEL_DISPLAY_B_PALETTE + first * sizeof(uint32), color); + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + write32((isSNB ? PCH_DISPLAY_A_PALETTE : INTEL_DISPLAY_A_PALETTE) + + first * sizeof(uint32), color); + write32((isSNB ? PCH_DISPLAY_B_PALETTE : INTEL_DISPLAY_B_PALETTE) + + first * sizeof(uint32), color); } } From b4f4ac9237dc94e3384ad841dcdbb57d30e48642 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 14 Oct 2011 20:15:33 +0000 Subject: [PATCH 391/702] Group the PCH registers logically. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42852 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index 23df8cd13b..c5cb0169b6 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -225,15 +225,20 @@ struct intel_free_graphics_memory { // to a PCH based one, that means anything that used to communicate via (G)MCH // registers needs to use different ones on PCH based platforms (Ironlake and // up, SandyBridge, etc.). + +// North Shared Functions #define PCH_DE_POWER_MEASUREMENT 0x42400 #define PCH_DE_INTERRUPT_STATUS 0x44000 // INTEL_INTERRUPT_STATUS #define PCH_DE_INTERRUPT_MASK 0x44004 // INTEL_INTERRUPT_MASK #define PCH_DE_INTERRUPT_IDENTITY 0x44008 // INTEL_INTERRUPT_IDENTITY #define PCH_DE_INTERRUPT_ENABLED 0x4400c // INTEL_INTERRUPT_ENABLED -#define PCH_DISPLAY_A_ANALOG_PORT 0xe1100 // INTEL_DISPLAY_A_ANALOG_PORT -#define PCH_DISPLAY_A_DIGITAL_PORT 0xe1120 // INTEL_DISPLAY_A_DIGITAL_PORT -#define PCH_DISPLAY_B_DIGITAL_PORT 0xe1140 // INTEL_DISPLAY_B_DIGITAL_PORT -#define PCH_DISPLAY_LVDS_PORT 0xe1180 // INTEL_DISPLAY_LVDS_PORT +#define PCH_DISPLAY_A_PALETTE 0x4a000 // INTEL_DISPLAY_A_PALETTE +#define PCH_DISPLAY_B_PALETTE 0x4a800 // INTEL_DISPLAY_B_PALETTE + +#define PCH_INTERRUPT_VBLANK_PIPEA (1 << 7) +#define PCH_INTERRUPT_VBLANK_PIPEB (1 << 15) + +// South Shared Functions #define PCH_I2C_IO_A 0xc5010 // INTEL_I2C_IO_A #define PCH_I2C_IO_C 0xc5018 // INTEL_I2C_IO_C #define PCH_DISPLAY_A_PLL 0xc6014 // INTEL_DISPLAY_A_PLL @@ -242,6 +247,12 @@ struct intel_free_graphics_memory { #define PCH_DISPLAY_A_PLL_DIVISOR_1 0xc6044 // INTEL_DISPLAY_A_PLL_DIVISOR_1 #define PCH_DISPLAY_B_PLL_DIVISOR_0 0xc6048 // INTEL_DISPLAY_B_PLL_DIVISOR_0 #define PCH_DISPLAY_B_PLL_DIVISOR_1 0xc604c // INTEL_DISPLAY_B_PLL_DIVISOR_1 + +// South Display Engine (SDE) Transcoder and Port Controls +#define PCH_DISPLAY_A_ANALOG_PORT 0xe1100 // INTEL_DISPLAY_A_ANALOG_PORT +#define PCH_DISPLAY_A_DIGITAL_PORT 0xe1120 // INTEL_DISPLAY_A_DIGITAL_PORT +#define PCH_DISPLAY_B_DIGITAL_PORT 0xe1140 // INTEL_DISPLAY_B_DIGITAL_PORT +#define PCH_DISPLAY_LVDS_PORT 0xe1180 // INTEL_DISPLAY_LVDS_PORT #define PCH_TRANSCODER_A_HTOTAL 0xe0000 // INTEL_DISPLAY_A_HTOTAL #define PCH_TRANSCODER_A_HBLANK 0xe0004 // INTEL_DISPLAY_A_HBLANK #define PCH_TRANSCODER_A_HSYNC 0xe0008 // INTEL_DISPLAY_A_HSYNC @@ -254,12 +265,8 @@ struct intel_free_graphics_memory { #define PCH_TRANSCODER_B_VTOTAL 0xe100c // INTEL_DISPLAY_B_VTOTAL #define PCH_TRANSCODER_B_VBLANK 0xe1010 // INTEL_DISPLAY_B_VBLANK #define PCH_TRANSCODER_B_VSYNC 0xe1014 // INTEL_DISPLAY_B_VSYNC -#define PCH_DISPLAY_A_PALETTE 0x4a000 // INTEL_DISPLAY_A_PALETTE -#define PCH_DISPLAY_B_PALETTE 0x4a800 // INTEL_DISPLAY_B_PALETTE #define PCH_LVDS_DETECTED (1 << 1) -#define PCH_INTERRUPT_VBLANK_PIPEA (1 << 7) -#define PCH_INTERRUPT_VBLANK_PIPEB (1 << 15) // SandyBridge (SNB) From 245fe001e7ee6458a7a5cc1a4702e5697574cf5e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 14 Oct 2011 22:57:00 +0000 Subject: [PATCH 392/702] * first shot at fixing pll calculations AtomBIOS wants number of 10Khz Units * better debugging after modeset on current CRTC status git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42853 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/mode.cpp | 19 ++++-- src/add-ons/accelerants/radeon_hd/pll.cpp | 76 ++++++++++++++-------- src/add-ons/accelerants/radeon_hd/pll.h | 2 +- 3 files changed, 64 insertions(+), 33 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index a221e9802b..73e0b2fbea 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -187,9 +187,9 @@ radeon_set_display_mode(display_mode *mode) encoder_mode_set(id, mode->timing.pixel_clock); // *** CRT controler commit - display_crtc_blank(id, ATOM_DISABLE); - display_crtc_memreq(id, ATOM_ENABLE); display_crtc_power(id, ATOM_ENABLE); + display_crtc_memreq(id, ATOM_ENABLE); + display_crtc_blank(id, ATOM_DISABLE); display_crtc_lock(id, ATOM_DISABLE); // *** encoder commit @@ -198,10 +198,17 @@ radeon_set_display_mode(display_mode *mode) encoder_output_lock(false); } - int32 crtstatus = Read32(CRT, D1CRTC_STATUS); - TRACE("CRT0 Status: 0x%X\n", crtstatus); - crtstatus = Read32(CRT, D2CRTC_STATUS); - TRACE("CRT1 Status: 0x%X\n", crtstatus); + // for debugging + TRACE("D1CRTC_STATUS Value: 0x%X\n", Read32(CRT, D1CRTC_STATUS)); + TRACE("D2CRTC_STATUS Value: 0x%X\n", Read32(CRT, D2CRTC_STATUS)); + TRACE("D1CRTC_CONTROL Value: 0x%X\n", Read32(CRT, D1CRTC_CONTROL)); + TRACE("D2CRTC_CONTROL Value: 0x%X\n", Read32(CRT, D2CRTC_CONTROL)); + TRACE("D1GRPH_ENABLE Value: 0x%X\n", Read32(CRT, D1GRPH_ENABLE)); + TRACE("D2GRPH_ENABLE Value: 0x%X\n", Read32(CRT, D2GRPH_ENABLE)); + TRACE("D1SCL_ENABLE Value: 0x%X\n", Read32(CRT, D1SCL_ENABLE)); + TRACE("D2SCL_ENABLE Value: 0x%X\n", Read32(CRT, D2SCL_ENABLE)); + TRACE("RV620_DACA_ENABLE Value: 0x%X\n", Read32(CRT, RV620_DACA_ENABLE)); + TRACE("RV620_DACB_ENABLE Value: 0x%X\n", Read32(CRT, RV620_DACB_ENABLE)); return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 8f36ab17ef..e423f052cf 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -85,6 +85,8 @@ status_t pll_compute(pll_info *pll) { uint32 targetClock = pll->pixel_clock / 10; + // to 10 kHz units + pll->post_div = pll_compute_post_divider(targetClock); pll->reference_div = REF_DIV_MIN; pll->feedback_div = 0; @@ -149,16 +151,25 @@ pll_compute(pll_info *pll) { return B_ERROR; } - pll->dot_clock = ((PLL_REFERENCE_DEFAULT * pll->feedback_div * 10) + uint32 calculatedClock + = ((PLL_REFERENCE_DEFAULT * pll->feedback_div) + (PLL_REFERENCE_DEFAULT * pll->feedback_div_frac)) - / (pll->reference_div * pll->post_div * 10); + / (pll->reference_div * pll->post_div); + + calculatedClock *= 10; + // back to kHz for storage TRACE("%s: pixel clock: %" B_PRIu32 " gives:" " feedbackDivider = %" B_PRIu32 ".%" B_PRIu32 - "; referenceDivider = %" B_PRIu32 "; postDivider = %" B_PRIu32 - "; dotClock = %" B_PRIu32 "\n", __func__, pll->pixel_clock, - pll->feedback_div, pll->feedback_div_frac, pll->reference_div, - pll->post_div, pll->dot_clock); + "; referenceDivider = %" B_PRIu32 "; postDivider = %" B_PRIu32 "\n", + __func__, pll->pixel_clock, pll->feedback_div, pll->feedback_div_frac, + pll->reference_div, pll->post_div); + + if (pll->pixel_clock != calculatedClock) { + TRACE("%s: pixel clock %" B_PRIu32 " was changed to %" B_PRIu32 "\n", + __func__, pll->pixel_clock, calculatedClock); + pll->pixel_clock = calculatedClock; + } return B_OK; } @@ -170,7 +181,7 @@ union adjust_pixel_clock { }; -uint32 +status_t pll_adjust(pll_info *pll, uint8 crtcID) { pll->flags |= PLL_PREFER_LOW_REF_DIV; @@ -179,7 +190,7 @@ pll_adjust(pll_info *pll, uint8 crtcID) radeon_shared_info &info = *gInfo->shared_info; uint32 pixelClock = pll->pixel_clock; - uint32 adjustedClock = pll->pixel_clock; + // original as pixel_clock will be adjusted uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; uint32 encoderID = gConnector[connectorIndex]->encoder.objectID; @@ -195,7 +206,7 @@ pll_adjust(pll_info *pll, uint8 crtcID) if (atom_parse_cmd_header(gAtomContext, index, &tableMajor, &tableMinor) != B_OK) { - return adjustedClock; + return B_ERROR; } memset(&args, 0, sizeof(args)); @@ -216,9 +227,9 @@ pll_adjust(pll_info *pll, uint8 crtcID) atom_execute_table(gAtomContext, index, (uint32*)&args); // get returned adjusted clock - adjustedClock + pll->pixel_clock = B_LENDIAN_TO_HOST_INT16(args.v1.usPixelClock); - adjustedClock *= 10; + pll->pixel_clock *= 10; break; case 3: args.v3.sInput.usPixelClock @@ -238,9 +249,11 @@ pll_adjust(pll_info *pll, uint8 crtcID) args.v3.sInput.ucExtTransmitterID = 0; atom_execute_table(gAtomContext, index, (uint32*)&args); - adjustedClock + // get returned adjusted clock + pll->pixel_clock = B_LENDIAN_TO_HOST_INT32( - args.v3.sOutput.ulDispPllFreq) * 10; + args.v3.sOutput.ulDispPllFreq); + pll->pixel_clock *= 10; if (args.v3.sOutput.ucRefDiv) { pll->flags |= PLL_USE_FRAC_FB_DIV; @@ -254,14 +267,22 @@ pll_adjust(pll_info *pll, uint8 crtcID) } break; default: - return adjustedClock; + TRACE("%s: ERROR: table version %" B_PRIu8 ".%" B_PRIu8 + " unknown\n", __func__, tableMajor, tableMinor); + return B_ERROR; } break; default: - return adjustedClock; + TRACE("%s: ERROR: table version %" B_PRIu8 ".%" B_PRIu8 + " unknown\n", __func__, tableMajor, tableMinor); + return B_ERROR; } } - return adjustedClock; + + TRACE("%s: was: %" B_PRIu32 ", now: %" B_PRIu32 "\n", __func__, + pixelClock, pll->pixel_clock); + + return B_OK; } @@ -274,11 +295,10 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) pll->pixel_clock = pixelClock; pll->id = pllID; - // get any needed clock adjustments, set reference/post dividers, set flags - uint32 adjustedClock = pll_adjust(pll, crtcID); - - // compute dividers, set flags + pll_adjust(pll, crtcID); + // get any needed clock adjustments, set reference/post dividers, set flags pll_compute(pll); + // compute dividers, set flags int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); union set_pixel_clock args; @@ -295,7 +315,8 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) switch (tableMinor) { case 1: - args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); + args.v1.usPixelClock + = B_HOST_TO_LENDIAN_INT16(pll->pixel_clock / 10); args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); args.v1.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); args.v1.ucFracFbDiv = pll->feedback_div_frac; @@ -305,7 +326,8 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) args.v1.ucRefDivSrc = 1; break; case 2: - args.v2.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); + args.v2.usPixelClock + = B_HOST_TO_LENDIAN_INT16(pll->pixel_clock / 10); args.v2.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); args.v2.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); args.v2.ucFracFbDiv = pll->feedback_div_frac; @@ -315,7 +337,8 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) args.v2.ucRefDivSrc = 1; break; case 3: - args.v3.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); + args.v3.usPixelClock + = B_HOST_TO_LENDIAN_INT16(pll->pixel_clock / 10); args.v3.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); args.v3.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); args.v3.ucFracFbDiv = pll->feedback_div_frac; @@ -330,7 +353,8 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) break; case 5: args.v5.ucCRTC = crtcID; - args.v5.usPixelClock = B_HOST_TO_LENDIAN_INT16(adjustedClock / 10); + args.v5.usPixelClock + = B_HOST_TO_LENDIAN_INT16(pll->pixel_clock / 10); args.v5.ucRefDiv = pll->reference_div; args.v5.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); args.v5.ulFbDivDecFrac @@ -356,7 +380,7 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) break; case 6: args.v6.ulDispEngClkFreq - = B_HOST_TO_LENDIAN_INT32(crtcID << 24 | adjustedClock / 10); + = B_HOST_TO_LENDIAN_INT32(crtcID << 24 | pll->pixel_clock / 10); args.v6.ucRefDiv = pll->reference_div; args.v6.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); args.v6.ulFbDivDecFrac @@ -392,7 +416,7 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) } TRACE("%s: set adjusted pixel clock %" B_PRIu32 " (was %" B_PRIu32 ")\n", - __func__, adjustedClock, pll->pixel_clock); + __func__, pll->pixel_clock, pixelClock); return atom_execute_table(gAtomContext, index, (uint32 *)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index b0650df479..8387e91796 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -87,7 +87,7 @@ struct pll_info { }; -uint32 pll_adjust(pll_info *pll, uint8 crtcID); +status_t pll_adjust(pll_info *pll, uint8 crtcID); status_t pll_compute(pll_info *pll); status_t pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID); From c0fe7a011ba98044dd373433784b848e01659d4f Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 14 Oct 2011 23:27:44 +0000 Subject: [PATCH 393/702] * tweaks to pll calculation reference units.. make divisors match 10 kHz unit git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42854 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/pll.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index e423f052cf..15de394a0e 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -51,14 +51,14 @@ pll_compute_post_divider(uint32 targetClock) uint32 vco; if (info.device_chipset < (RADEON_R700 | 0x70)) { if (0) // TODO : RADEON_PLL_IS_LCD - vco = PLL_MIN_DEFAULT; // pll->lcd_pll_out_min; + vco = PLL_MIN_DEFAULT / 10; // pll->lcd_pll_out_min; else - vco = PLL_MIN_DEFAULT; // pll->pll_out_min; + vco = PLL_MIN_DEFAULT / 10; // pll->pll_out_min; } else { if (0) // TODO : RADEON_PLL_IS_LCD - vco = PLL_MAX_DEFAULT; // pll->lcd_pll_out_max; + vco = PLL_MAX_DEFAULT / 10; // pll->lcd_pll_out_max; else - vco = PLL_MAX_DEFAULT; // pll->pll_out_min; + vco = PLL_MAX_DEFAULT / 10; // pll->pll_out_min; } uint32 postDivider = vco / targetClock; @@ -92,6 +92,8 @@ pll_compute(pll_info *pll) { pll->feedback_div = 0; pll->feedback_div_frac = 0; + uint32 referenceFrequency = PLL_REFERENCE_DEFAULT / 10; + // if RADEON_PLL_USE_REF_DIV // ref_div = pll->reference_div; @@ -114,15 +116,16 @@ pll_compute(pll_info *pll) { uint32 retroEncabulator = pll->post_div * pll->reference_div; retroEncabulator *= targetClock; - pll->feedback_div = retroEncabulator / PLL_REFERENCE_DEFAULT; - pll->feedback_div_frac = retroEncabulator % PLL_REFERENCE_DEFAULT; + pll->feedback_div = retroEncabulator / referenceFrequency; + pll->feedback_div_frac + = retroEncabulator % referenceFrequency; if (pll->feedback_div > FB_DIV_LIMIT) pll->feedback_div = FB_DIV_LIMIT; else if (pll->feedback_div < FB_DIV_MIN) pll->feedback_div = FB_DIV_MIN; - if (pll->feedback_div_frac >= (PLL_REFERENCE_DEFAULT / 2)) + if (pll->feedback_div_frac >= (referenceFrequency / 2)) pll->feedback_div++; pll->feedback_div_frac = 0; @@ -132,7 +135,7 @@ pll_compute(pll_info *pll) { TRACE("%s: Caught division by zero\n", __func__); return B_ERROR; } - uint32 tmp = (PLL_REFERENCE_DEFAULT * pll->feedback_div) + uint32 tmp = (referenceFrequency * pll->feedback_div) / (pll->post_div * pll->reference_div); tmp = (tmp * 10000) / targetClock; @@ -152,8 +155,8 @@ pll_compute(pll_info *pll) { } uint32 calculatedClock - = ((PLL_REFERENCE_DEFAULT * pll->feedback_div) - + (PLL_REFERENCE_DEFAULT * pll->feedback_div_frac)) + = (referenceFrequency * pll->feedback_div) + + (referenceFrequency * pll->feedback_div_frac) / (pll->reference_div * pll->post_div); calculatedClock *= 10; From cf1d1fb4ffb2cc4323b92a6d2f3c9a2cd1389a80 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 15 Oct 2011 04:23:32 +0000 Subject: [PATCH 394/702] * add function to probe pll timing limits from AtomBIOS * rename *_* pll vars to match style guidelines * refactor PLL calculation to be easier to read with more central 10kHz unit conversions * limited mode switching has been seen working including a perfect 1280x1024@75 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42855 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 3 + src/add-ons/accelerants/radeon_hd/pll.cpp | 294 ++++++++++++------ src/add-ons/accelerants/radeon_hd/pll.h | 46 ++- 3 files changed, 221 insertions(+), 122 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index f0c1c89b4c..af436abf67 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -552,6 +552,9 @@ detect_connectors() = encoderID; gConnector[connectorIndex]->encoder.type = encoderType; + + pll_limit_probe( + &gConnector[connectorIndex]->encoder.pll); } } // END if object is encoder diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 15de394a0e..1338d0a6a2 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -28,20 +28,103 @@ extern "C" void _sPrintf(const char *format, ...); # define TRACE(x...) ; #endif +#define ERROR(x...) _sPrintf("radeon_hd: " x) -// For AtomBIOS PLLSet -union set_pixel_clock { - SET_PIXEL_CLOCK_PS_ALLOCATION base; - PIXEL_CLOCK_PARAMETERS v1; - PIXEL_CLOCK_PARAMETERS_V2 v2; - PIXEL_CLOCK_PARAMETERS_V3 v3; - PIXEL_CLOCK_PARAMETERS_V5 v5; - PIXEL_CLOCK_PARAMETERS_V6 v6; + +union firmware_info { + ATOM_FIRMWARE_INFO info; + ATOM_FIRMWARE_INFO_V1_2 info_12; + ATOM_FIRMWARE_INFO_V1_3 info_13; + ATOM_FIRMWARE_INFO_V1_4 info_14; + ATOM_FIRMWARE_INFO_V2_1 info_21; + ATOM_FIRMWARE_INFO_V2_2 info_22; }; -static uint32 -pll_compute_post_divider(uint32 targetClock) +status_t +pll_limit_probe(pll_info *pll) +{ + int index = GetIndexIntoMasterTable(DATA, FirmwareInfo); + uint8 tableMajor; + uint8 tableMinor; + uint16 tableOffset; + + if (atom_parse_data_header(gAtomContext, index, NULL, + &tableMajor, &tableMinor, &tableOffset) != B_OK) { + ERROR("%s: Couldn't parse data header\n", __func__); + return B_ERROR; + } + + union firmware_info *firmwareInfo + = (union firmware_info *)(gAtomContext->bios + tableOffset); + + /* pixel clock limits */ + pll->referenceFreq + = B_LENDIAN_TO_HOST_INT16(firmwareInfo->info.usReferenceClock) * 10; + + if (tableMinor < 2) { + pll->pllOutMin + = B_LENDIAN_TO_HOST_INT16( + firmwareInfo->info.usMinPixelClockPLL_Output) * 10; + } else { + pll->pllOutMin + = B_LENDIAN_TO_HOST_INT32( + firmwareInfo->info_12.ulMinPixelClockPLL_Output); + } + + pll->pllOutMax + = B_LENDIAN_TO_HOST_INT32( + firmwareInfo->info.ulMaxPixelClockPLL_Output) * 10; + + if (tableMinor >= 4) { + pll->lcdPllOutMin + = B_LENDIAN_TO_HOST_INT16( + firmwareInfo->info_14.usLcdMinPixelClockPLL_Output) * 100; + + if (pll->lcdPllOutMin == 0) + pll->lcdPllOutMin = pll->pllOutMin; + + pll->lcdPllOutMax + = B_LENDIAN_TO_HOST_INT16( + firmwareInfo->info_14.usLcdMaxPixelClockPLL_Output) * 100; + + if (pll->lcdPllOutMax == 0) + pll->lcdPllOutMax = pll->pllOutMax; + + } else { + pll->lcdPllOutMin = pll->pllOutMin; + pll->lcdPllOutMax = pll->pllOutMax; + } + + if (pll->pllOutMin == 0) { + pll->pllOutMin = 64800; + // Avivo+ limit + } + + pll->minPostDiv = POST_DIV_MIN; + pll->maxPostDiv = POST_DIV_LIMIT; + pll->minRefDiv = REF_DIV_MIN; + pll->maxRefDiv = REF_DIV_LIMIT; + pll->minFeedbackDiv = FB_DIV_MIN; + pll->maxFeedbackDiv = FB_DIV_LIMIT; + +// pll->pllInMin = B_LENDIAN_TO_HOST_INT16( +// firmware_info->info.usMinPixelClockPLL_Input) * 10; +// +// pll->pllInMax = B_LENDIAN_TO_HOST_INT16( +// firmware_info->info.usMaxPixelClockPLL_Input) * 10; + + TRACE("%s: referenceFreq: %" B_PRIu16 "; pllOutMin: %" B_PRIu16 "; " + " pllOutMax: %" B_PRIu16 "; pllInMin: %" B_PRIu16 ";" + "pllInMax: %" B_PRIu16 "\n", __func__, pll->referenceFreq, + pll->pllOutMin, pll->pllOutMax, pll->pllInMin, pll->pllInMax); + + return B_OK; +} + + +void +pll_compute_post_divider(pll_info *pll) { radeon_shared_info &info = *gInfo->shared_info; @@ -51,18 +134,20 @@ pll_compute_post_divider(uint32 targetClock) uint32 vco; if (info.device_chipset < (RADEON_R700 | 0x70)) { if (0) // TODO : RADEON_PLL_IS_LCD - vco = PLL_MIN_DEFAULT / 10; // pll->lcd_pll_out_min; + vco = pll->lcdPllOutMin; else - vco = PLL_MIN_DEFAULT / 10; // pll->pll_out_min; + vco = pll->pllOutMin; } else { if (0) // TODO : RADEON_PLL_IS_LCD - vco = PLL_MAX_DEFAULT / 10; // pll->lcd_pll_out_max; + vco = pll->lcdPllOutMax; else - vco = PLL_MAX_DEFAULT / 10; // pll->pll_out_min; + vco = pll->pllOutMin; } - uint32 postDivider = vco / targetClock; - uint32 tmp = vco % targetClock; + TRACE("%s: vco = %" B_PRIu32 "\n", __func__, vco); + + uint32 postDivider = vco / pll->pixelClock; + uint32 tmp = vco % pll->pixelClock; if (info.device_chipset < (RADEON_R700 | 0x70)) { if (tmp) @@ -72,27 +157,28 @@ pll_compute_post_divider(uint32 targetClock) postDivider--; } - if (postDivider > POST_DIV_LIMIT) - postDivider = POST_DIV_LIMIT; - else if (postDivider < POST_DIV_MIN) - postDivider = POST_DIV_MIN; + if (postDivider > pll->maxPostDiv) + postDivider = pll->maxPostDiv; + else if (postDivider < pll->minPostDiv) + postDivider = pll->minPostDiv; - return postDivider; + pll->postDiv = postDivider; + TRACE("%s: postDiv = %" B_PRIu32 "\n", __func__, postDivider); } status_t -pll_compute(pll_info *pll) { +pll_compute(pll_info *pll) +{ + pll_compute_post_divider(pll); - uint32 targetClock = pll->pixel_clock / 10; - // to 10 kHz units + uint32 targetClock = pll->pixelClock; - pll->post_div = pll_compute_post_divider(targetClock); - pll->reference_div = REF_DIV_MIN; - pll->feedback_div = 0; - pll->feedback_div_frac = 0; + pll->feedbackDiv = 0; + pll->feedbackDivFrac = 0; + pll->referenceDiv = pll->minRefDiv; - uint32 referenceFrequency = PLL_REFERENCE_DEFAULT / 10; + uint32 referenceFrequency = pll->referenceFreq; // if RADEON_PLL_USE_REF_DIV // ref_div = pll->reference_div; @@ -111,67 +197,68 @@ pll_compute(pll_info *pll) { // frac_fb_div = 0; // } // } else { - while (pll->reference_div <= REF_DIV_LIMIT) { + while (pll->referenceDiv <= pll->maxRefDiv) { // get feedback divider - uint32 retroEncabulator = pll->post_div * pll->reference_div; + uint32 retroEncabulator = pll->postDiv * pll->referenceDiv; retroEncabulator *= targetClock; - pll->feedback_div = retroEncabulator / referenceFrequency; - pll->feedback_div_frac + pll->feedbackDiv = retroEncabulator / referenceFrequency; + pll->feedbackDivFrac = retroEncabulator % referenceFrequency; - if (pll->feedback_div > FB_DIV_LIMIT) - pll->feedback_div = FB_DIV_LIMIT; - else if (pll->feedback_div < FB_DIV_MIN) - pll->feedback_div = FB_DIV_MIN; + if (pll->feedbackDiv > pll->maxFeedbackDiv) + pll->feedbackDiv = pll->maxFeedbackDiv; + else if (pll->feedbackDiv < pll->minFeedbackDiv) + pll->feedbackDiv = pll->minFeedbackDiv; - if (pll->feedback_div_frac >= (referenceFrequency / 2)) - pll->feedback_div++; + if (pll->feedbackDivFrac >= (referenceFrequency / 2)) + pll->feedbackDiv++; - pll->feedback_div_frac = 0; - if (pll->reference_div == 0 - || pll->post_div == 0 + pll->feedbackDivFrac = 0; + + if (pll->referenceDiv == 0 + || pll->postDiv == 0 || targetClock == 0) { - TRACE("%s: Caught division by zero\n", __func__); + TRACE("%s: Caught division by zero!\n", __func__); + TRACE("%s: referenceDiv %" B_PRIu32 "\n", __func__, pll->referenceDiv); + TRACE("%s: postDiv %" B_PRIu32 "\n", __func__, pll->postDiv); + TRACE("%s: targetClock %" B_PRIu32 "\n", __func__, targetClock); return B_ERROR; } - uint32 tmp = (referenceFrequency * pll->feedback_div) - / (pll->post_div * pll->reference_div); + uint32 tmp = (referenceFrequency * pll->feedbackDiv) + / (pll->postDiv * pll->referenceDiv); tmp = (tmp * 10000) / targetClock; if (tmp > (10000 + MAX_TOLERANCE)) - pll->reference_div++; + pll->referenceDiv++; else if (tmp >= (10000 - MAX_TOLERANCE)) break; else - pll->reference_div++; + pll->referenceDiv++; } // } - if (pll->reference_div == 0 || pll->post_div == 0) { + if (pll->referenceDiv == 0 || pll->postDiv == 0) { TRACE("%s: Caught division by zero of post or reference divider\n", __func__); return B_ERROR; } uint32 calculatedClock - = (referenceFrequency * pll->feedback_div) - + (referenceFrequency * pll->feedback_div_frac) - / (pll->reference_div * pll->post_div); - - calculatedClock *= 10; - // back to kHz for storage + = (referenceFrequency * pll->feedbackDiv) + + (referenceFrequency * pll->feedbackDivFrac) + / (pll->referenceDiv * pll->postDiv); TRACE("%s: pixel clock: %" B_PRIu32 " gives:" " feedbackDivider = %" B_PRIu32 ".%" B_PRIu32 "; referenceDivider = %" B_PRIu32 "; postDivider = %" B_PRIu32 "\n", - __func__, pll->pixel_clock, pll->feedback_div, pll->feedback_div_frac, - pll->reference_div, pll->post_div); + __func__, pll->pixelClock, pll->feedbackDiv, pll->feedbackDivFrac, + pll->referenceDiv, pll->postDiv); - if (pll->pixel_clock != calculatedClock) { + if (pll->pixelClock != calculatedClock) { TRACE("%s: pixel clock %" B_PRIu32 " was changed to %" B_PRIu32 "\n", - __func__, pll->pixel_clock, calculatedClock); - pll->pixel_clock = calculatedClock; + __func__, pll->pixelClock, calculatedClock); + pll->pixelClock = calculatedClock; } return B_OK; @@ -192,12 +279,12 @@ pll_adjust(pll_info *pll, uint8 crtcID) // TODO : PLL flags radeon_shared_info &info = *gInfo->shared_info; - uint32 pixelClock = pll->pixel_clock; + uint32 pixelClock = pll->pixelClock; // original as pixel_clock will be adjusted uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; uint32 encoderID = gConnector[connectorIndex]->encoder.objectID; - uint32 encoder_mode = display_get_encoder_mode(connectorIndex); + uint32 encoderMode = display_get_encoder_mode(connectorIndex); if (info.device_chipset >= (RADEON_R600 | 0x20)) { union adjust_pixel_clock args; @@ -221,7 +308,7 @@ pll_adjust(pll_info *pll, uint8 crtcID) args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); args.v1.ucTransmitterID = encoderID; - args.v1.ucEncodeMode = encoder_mode; + args.v1.ucEncodeMode = encoderMode; // TODO : SS and SS % > 0 if (0) { args.v1.ucConfig @@ -230,15 +317,15 @@ pll_adjust(pll_info *pll, uint8 crtcID) atom_execute_table(gAtomContext, index, (uint32*)&args); // get returned adjusted clock - pll->pixel_clock + pll->pixelClock = B_LENDIAN_TO_HOST_INT16(args.v1.usPixelClock); - pll->pixel_clock *= 10; + pll->pixelClock *= 10; break; case 3: args.v3.sInput.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); args.v3.sInput.ucTransmitterID = encoderID; - args.v3.sInput.ucEncodeMode = encoder_mode; + args.v3.sInput.ucEncodeMode = encoderMode; args.v3.sInput.ucDispPllConfig = 0; // TODO : SS and SS % > 0 if (0) { @@ -253,20 +340,21 @@ pll_adjust(pll_info *pll, uint8 crtcID) atom_execute_table(gAtomContext, index, (uint32*)&args); // get returned adjusted clock - pll->pixel_clock + pll->pixelClock = B_LENDIAN_TO_HOST_INT32( args.v3.sOutput.ulDispPllFreq); - pll->pixel_clock *= 10; + pll->pixelClock *= 10; + // convert to kHz for storage if (args.v3.sOutput.ucRefDiv) { pll->flags |= PLL_USE_FRAC_FB_DIV; pll->flags |= PLL_USE_REF_DIV; - pll->reference_div = args.v3.sOutput.ucRefDiv; + pll->referenceDiv = args.v3.sOutput.ucRefDiv; } if (args.v3.sOutput.ucPostDiv) { pll->flags |= PLL_USE_FRAC_FB_DIV; pll->flags |= PLL_USE_POST_DIV; - pll->post_div = args.v3.sOutput.ucPostDiv; + pll->postDiv = args.v3.sOutput.ucPostDiv; } break; default: @@ -283,19 +371,29 @@ pll_adjust(pll_info *pll, uint8 crtcID) } TRACE("%s: was: %" B_PRIu32 ", now: %" B_PRIu32 "\n", __func__, - pixelClock, pll->pixel_clock); + pixelClock, pll->pixelClock); return B_OK; } +union set_pixel_clock { + SET_PIXEL_CLOCK_PS_ALLOCATION base; + PIXEL_CLOCK_PARAMETERS v1; + PIXEL_CLOCK_PARAMETERS_V2 v2; + PIXEL_CLOCK_PARAMETERS_V3 v3; + PIXEL_CLOCK_PARAMETERS_V5 v5; + PIXEL_CLOCK_PARAMETERS_V6 v6; +}; + + status_t pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) { uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; pll_info *pll = &gConnector[connectorIndex]->encoder.pll; - pll->pixel_clock = pixelClock; + pll->pixelClock = pixelClock; pll->id = pllID; pll_adjust(pll, crtcID); @@ -319,33 +417,33 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) switch (tableMinor) { case 1: args.v1.usPixelClock - = B_HOST_TO_LENDIAN_INT16(pll->pixel_clock / 10); - args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); - args.v1.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); - args.v1.ucFracFbDiv = pll->feedback_div_frac; - args.v1.ucPostDiv = pll->post_div; + = B_HOST_TO_LENDIAN_INT16(pll->pixelClock / 10); + args.v1.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->referenceDiv); + args.v1.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedbackDiv); + args.v1.ucFracFbDiv = pll->feedbackDivFrac; + args.v1.ucPostDiv = pll->postDiv; args.v1.ucPpll = pll->id; args.v1.ucCRTC = crtcID; args.v1.ucRefDivSrc = 1; break; case 2: args.v2.usPixelClock - = B_HOST_TO_LENDIAN_INT16(pll->pixel_clock / 10); - args.v2.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); - args.v2.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); - args.v2.ucFracFbDiv = pll->feedback_div_frac; - args.v2.ucPostDiv = pll->post_div; + = B_HOST_TO_LENDIAN_INT16(pll->pixelClock / 10); + args.v2.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->referenceDiv); + args.v2.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedbackDiv); + args.v2.ucFracFbDiv = pll->feedbackDivFrac; + args.v2.ucPostDiv = pll->postDiv; args.v2.ucPpll = pll->id; args.v2.ucCRTC = crtcID; args.v2.ucRefDivSrc = 1; break; case 3: args.v3.usPixelClock - = B_HOST_TO_LENDIAN_INT16(pll->pixel_clock / 10); - args.v3.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->reference_div); - args.v3.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); - args.v3.ucFracFbDiv = pll->feedback_div_frac; - args.v3.ucPostDiv = pll->post_div; + = B_HOST_TO_LENDIAN_INT16(pll->pixelClock / 10); + args.v3.usRefDiv = B_HOST_TO_LENDIAN_INT16(pll->referenceDiv); + args.v3.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedbackDiv); + args.v3.ucFracFbDiv = pll->feedbackDivFrac; + args.v3.ucPostDiv = pll->postDiv; args.v3.ucPpll = pll->id; args.v3.ucMiscInfo = (pll->id << 2); // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) @@ -357,12 +455,12 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) case 5: args.v5.ucCRTC = crtcID; args.v5.usPixelClock - = B_HOST_TO_LENDIAN_INT16(pll->pixel_clock / 10); - args.v5.ucRefDiv = pll->reference_div; - args.v5.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); + = B_HOST_TO_LENDIAN_INT16(pll->pixelClock / 10); + args.v5.ucRefDiv = pll->referenceDiv; + args.v5.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedbackDiv); args.v5.ulFbDivDecFrac - = B_HOST_TO_LENDIAN_INT32(pll->feedback_div_frac * 100000); - args.v5.ucPostDiv = pll->post_div; + = B_HOST_TO_LENDIAN_INT32(pll->feedbackDivFrac * 100000); + args.v5.ucPostDiv = pll->postDiv; args.v5.ucMiscInfo = 0; /* HDMI depth, etc. */ // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_REF_DIV_SRC; @@ -383,12 +481,12 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) break; case 6: args.v6.ulDispEngClkFreq - = B_HOST_TO_LENDIAN_INT32(crtcID << 24 | pll->pixel_clock / 10); - args.v6.ucRefDiv = pll->reference_div; - args.v6.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedback_div); + = B_HOST_TO_LENDIAN_INT32(crtcID << 24 | pll->pixelClock / 10); + args.v6.ucRefDiv = pll->referenceDiv; + args.v6.usFbDiv = B_HOST_TO_LENDIAN_INT16(pll->feedbackDiv); args.v6.ulFbDivDecFrac - = B_HOST_TO_LENDIAN_INT32(pll->feedback_div_frac * 100000); - args.v6.ucPostDiv = pll->post_div; + = B_HOST_TO_LENDIAN_INT32(pll->feedbackDivFrac * 100000); + args.v6.ucPostDiv = pll->postDiv; args.v6.ucMiscInfo = 0; /* HDMI depth, etc. */ // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_REF_DIV_SRC; @@ -419,7 +517,7 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) } TRACE("%s: set adjusted pixel clock %" B_PRIu32 " (was %" B_PRIu32 ")\n", - __func__, pll->pixel_clock, pixelClock); + __func__, pll->pixelClock, pixelClock); - return atom_execute_table(gAtomContext, index, (uint32 *)&args); + return atom_execute_table(gAtomContext, index, (uint32*)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index 8387e91796..11740eeb33 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -46,10 +46,7 @@ struct pll_info { /* pixel clock to be programmed (kHz)*/ - uint32 pixel_clock; - - /* dot clock (kHz) */ - uint32 dot_clock; + uint32 pixelClock; /* flags for the current clock */ uint32 flags; @@ -58,35 +55,36 @@ struct pll_info { uint32 id; /* reference frequency */ - uint32 reference_freq; + uint32 referenceFreq; /* fixed dividers */ - uint32 post_div; - uint32 reference_div; - uint32 feedback_div; - uint32 feedback_div_frac; + uint32 postDiv; + uint32 referenceDiv; + uint32 feedbackDiv; + uint32 feedbackDivFrac; /* pll in/out limits */ - uint32 pll_in_min; - uint32 pll_in_max; - uint32 pll_out_min; - uint32 pll_out_max; - uint32 lcd_pll_out_min; - uint32 lcd_pll_out_max; - uint32 best_vco; + uint32 pllInMin; + uint32 pllInMax; + uint32 pllOutMin; + uint32 pllOutMax; + uint32 lcdPllOutMin; + uint32 lcdPllOutMax; + uint32 bestVco; /* divider limits */ - uint32 min_ref_div; - uint32 max_ref_div; - uint32 min_post_div; - uint32 max_post_div; - uint32 min_feedback_div; - uint32 max_feedback_div; - uint32 min_frac_feedback_div; - uint32 max_frac_feedback_div; + uint32 minRefDiv; + uint32 maxRefDiv; + uint32 minPostDiv; + uint32 maxPostDiv; + uint32 minFeedbackDiv; + uint32 maxFeedbackDiv; + uint32 minFeedbackDivFrac; + uint32 maxFeedbackDivFrac; }; +status_t pll_limit_probe(pll_info *pll); status_t pll_adjust(pll_info *pll, uint8 crtcID); status_t pll_compute(pll_info *pll); status_t pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID); From 16cc59778b590eea0e0a39fe1838880169cdfdb6 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 15 Oct 2011 11:20:40 +0000 Subject: [PATCH 395/702] Attempt at panel control for SandyBridge, still disabled though as it doesn't work yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42856 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 4 ++++ src/add-ons/accelerants/intel_extreme/dpms.cpp | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index c5cb0169b6..e2ef215504 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -247,6 +247,10 @@ struct intel_free_graphics_memory { #define PCH_DISPLAY_A_PLL_DIVISOR_1 0xc6044 // INTEL_DISPLAY_A_PLL_DIVISOR_1 #define PCH_DISPLAY_B_PLL_DIVISOR_0 0xc6048 // INTEL_DISPLAY_B_PLL_DIVISOR_0 #define PCH_DISPLAY_B_PLL_DIVISOR_1 0xc604c // INTEL_DISPLAY_B_PLL_DIVISOR_1 +#define PCH_PANEL_CONTROL 0xc7200 // INTEL_PANEL_CONTROL +#define PCH_PANEL_STATUS 0xc7204 // INTEL_PANEL_STATUS + +#define PANEL_REGISTER_UNLOCK (0xabcd << 16) // South Display Engine (SDE) Transcoder and Port Controls #define PCH_DISPLAY_A_ANALOG_PORT 0xe1100 // INTEL_DISPLAY_A_ANALOG_PORT diff --git a/src/add-ons/accelerants/intel_extreme/dpms.cpp b/src/add-ons/accelerants/intel_extreme/dpms.cpp index b45242a6c3..37fee355f6 100644 --- a/src/add-ons/accelerants/intel_extreme/dpms.cpp +++ b/src/add-ons/accelerants/intel_extreme/dpms.cpp @@ -74,26 +74,30 @@ enable_display_pipe(bool enable) static void enable_lvds_panel(bool enable) { - uint32 control = read32(INTEL_PANEL_CONTROL); + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + int controlRegister = isSNB ? PCH_PANEL_CONTROL : INTEL_PANEL_CONTROL; + int statusRegister = isSNB ? PCH_PANEL_STATUS : INTEL_PANEL_STATUS; + + uint32 control = read32(controlRegister); uint32 panelStatus; if (enable) { if ((control & PANEL_CONTROL_POWER_TARGET_ON) == 0) { - write32(INTEL_PANEL_CONTROL, control - | PANEL_CONTROL_POWER_TARGET_ON); + write32(controlRegister, control | PANEL_CONTROL_POWER_TARGET_ON + | (isSNB ? PANEL_REGISTER_UNLOCK : 0)); } do { - panelStatus = read32(INTEL_PANEL_STATUS); + panelStatus = read32(statusRegister); } while ((panelStatus & PANEL_STATUS_POWER_ON) == 0); } else { if ((control & PANEL_CONTROL_POWER_TARGET_ON) != 0) { - write32(INTEL_PANEL_CONTROL, control - & ~PANEL_CONTROL_POWER_TARGET_ON); + write32(controlRegister, (control & ~PANEL_CONTROL_POWER_TARGET_ON) + | (isSNB ? PANEL_REGISTER_UNLOCK : 0)); } do { - panelStatus = read32(INTEL_PANEL_STATUS); + panelStatus = read32(statusRegister); } while ((panelStatus & PANEL_STATUS_POWER_ON) != 0); } } From f0468be3845a6f7318a5a4f4dadcd62f7ed4ee22 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 15 Oct 2011 15:35:35 +0000 Subject: [PATCH 396/702] * Rework how registers are accessed. Most registers are now grouped into register blocks and we encode their block into the register definition. On register access these blocks are then translated into the final address. * Set up the register blocks for (G)MCH and PCH variants. * Remove most SandyBridge code that was actually PCH specific and is now taken care of automatically. * This will temporarily break SandyBridge support again until the right transcoders are actually programmed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42857 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 315 +++++++++--------- .../accelerants/intel_extreme/accelerant.cpp | 15 +- .../accelerants/intel_extreme/accelerant.h | 14 +- .../accelerants/intel_extreme/dpms.cpp | 63 ++-- .../accelerants/intel_extreme/mode.cpp | 133 +++----- .../drivers/graphics/intel_extreme/device.cpp | 6 +- .../drivers/graphics/intel_extreme/driver.h | 46 ++- .../graphics/intel_extreme/intel_extreme.cpp | 90 +++-- .../intel_extreme/intel_extreme_private.h | 2 + 9 files changed, 345 insertions(+), 339 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index e2ef215504..2d90d88f18 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -54,6 +54,43 @@ #define DEVICE_NAME "intel_extreme" #define INTEL_ACCELERANT_NAME "intel_extreme.accelerant" +// We encode the register block into the value and extract/translate it when +// actually accessing. +#define REGISTER_BLOCK_COUNT 7 +#define REGISTER_BLOCK_SHIFT 24 +#define REGISTER_BLOCK_MASK 0xff000000 +#define REGISTER_REGISTER_MASK 0x00ffffff +#define REGISTER_BLOCK(x) ((x & REGISTER_BLOCK_MASK) >> REGISTER_BLOCK_SHIFT) +#define REGISTER_REGISTER(x) (x & REGISTER_REGISTER_MASK) + +#define REGS_FLAT (0 << REGISTER_BLOCK_SHIFT) +#define REGS_INTERRUPT (1 << REGISTER_BLOCK_SHIFT) +#define REGS_NORTH_SHARED (2 << REGISTER_BLOCK_SHIFT) +#define REGS_NORTH_PIPE_AND_PORT (3 << REGISTER_BLOCK_SHIFT) +#define REGS_NORTH_PLANE_CONTROL (4 << REGISTER_BLOCK_SHIFT) +#define REGS_SOUTH_SHARED (5 << REGISTER_BLOCK_SHIFT) +#define REGS_SOUTH_TRANSCODER_PORT (6 << REGISTER_BLOCK_SHIFT) + +// register blocks for (G)MCH/ICH based platforms +#define MCH_INTERRUPT_REGISTER_BASE 0x020a0 +#define MCH_SHARED_REGISTER_BASE 0x00000 +#define MCH_PIPE_AND_PORT_REGISTER_BASE 0x60000 +#define MCH_PLANE_CONTROL_REGISTER_BASE 0x70000 +#define ICH_SHARED_REGISTER_BASE 0x00000 +#define ICH_PORT_REGISTER_BASE 0x60000 + +// PCH - Platform Control Hub - Newer hardware moves from a MCH/ICH based setup +// to a PCH based one, that means anything that used to communicate via (G)MCH +// registers needs to use different ones on PCH based platforms (Ironlake and +// up, SandyBridge, etc.). +#define PCH_DE_INTERRUPT_REGISTER_BASE 0x44000 +#define PCH_NORTH_SHARED_REGISTER_BASE 0x40000 +#define PCH_NORTH_PIPE_AND_PORT_REGISTER_BASE 0x60000 +#define PCH_NORTH_PLANE_CONTROL_REGISTER_BASE 0x70000 +#define PCH_SOUTH_SHARED_REGISTER_BASE 0xc0000 +#define PCH_SOUTH_TRANSCODER_AND_PORT_REGISTER_BASE 0xe0000 + + struct DeviceType { uint32 type; @@ -114,6 +151,7 @@ struct intel_shared_info { uint32 dpms_mode; area_id registers_area; // area of memory mapped registers + uint32 register_blocks[REGISTER_BLOCK_COUNT]; uint8* status_page; phys_addr_t physical_status_page; uint8* graphics_memory; @@ -221,58 +259,6 @@ struct intel_free_graphics_memory { #define G4X_STOLEN_MEMORY_224MB 0xc0 #define G4X_STOLEN_MEMORY_352MB 0xd0 -// PCH - Platform Control Hub - Newer hardware moves from a MCH/ICH based setup -// to a PCH based one, that means anything that used to communicate via (G)MCH -// registers needs to use different ones on PCH based platforms (Ironlake and -// up, SandyBridge, etc.). - -// North Shared Functions -#define PCH_DE_POWER_MEASUREMENT 0x42400 -#define PCH_DE_INTERRUPT_STATUS 0x44000 // INTEL_INTERRUPT_STATUS -#define PCH_DE_INTERRUPT_MASK 0x44004 // INTEL_INTERRUPT_MASK -#define PCH_DE_INTERRUPT_IDENTITY 0x44008 // INTEL_INTERRUPT_IDENTITY -#define PCH_DE_INTERRUPT_ENABLED 0x4400c // INTEL_INTERRUPT_ENABLED -#define PCH_DISPLAY_A_PALETTE 0x4a000 // INTEL_DISPLAY_A_PALETTE -#define PCH_DISPLAY_B_PALETTE 0x4a800 // INTEL_DISPLAY_B_PALETTE - -#define PCH_INTERRUPT_VBLANK_PIPEA (1 << 7) -#define PCH_INTERRUPT_VBLANK_PIPEB (1 << 15) - -// South Shared Functions -#define PCH_I2C_IO_A 0xc5010 // INTEL_I2C_IO_A -#define PCH_I2C_IO_C 0xc5018 // INTEL_I2C_IO_C -#define PCH_DISPLAY_A_PLL 0xc6014 // INTEL_DISPLAY_A_PLL -#define PCH_DISPLAY_B_PLL 0xc6018 // INTEL_DISPLAY_B_PLL -#define PCH_DISPLAY_A_PLL_DIVISOR_0 0xc6040 // INTEL_DISPLAY_A_PLL_DIVISOR_0 -#define PCH_DISPLAY_A_PLL_DIVISOR_1 0xc6044 // INTEL_DISPLAY_A_PLL_DIVISOR_1 -#define PCH_DISPLAY_B_PLL_DIVISOR_0 0xc6048 // INTEL_DISPLAY_B_PLL_DIVISOR_0 -#define PCH_DISPLAY_B_PLL_DIVISOR_1 0xc604c // INTEL_DISPLAY_B_PLL_DIVISOR_1 -#define PCH_PANEL_CONTROL 0xc7200 // INTEL_PANEL_CONTROL -#define PCH_PANEL_STATUS 0xc7204 // INTEL_PANEL_STATUS - -#define PANEL_REGISTER_UNLOCK (0xabcd << 16) - -// South Display Engine (SDE) Transcoder and Port Controls -#define PCH_DISPLAY_A_ANALOG_PORT 0xe1100 // INTEL_DISPLAY_A_ANALOG_PORT -#define PCH_DISPLAY_A_DIGITAL_PORT 0xe1120 // INTEL_DISPLAY_A_DIGITAL_PORT -#define PCH_DISPLAY_B_DIGITAL_PORT 0xe1140 // INTEL_DISPLAY_B_DIGITAL_PORT -#define PCH_DISPLAY_LVDS_PORT 0xe1180 // INTEL_DISPLAY_LVDS_PORT -#define PCH_TRANSCODER_A_HTOTAL 0xe0000 // INTEL_DISPLAY_A_HTOTAL -#define PCH_TRANSCODER_A_HBLANK 0xe0004 // INTEL_DISPLAY_A_HBLANK -#define PCH_TRANSCODER_A_HSYNC 0xe0008 // INTEL_DISPLAY_A_HSYNC -#define PCH_TRANSCODER_A_VTOTAL 0xe000c // INTEL_DISPLAY_A_VTOTAL -#define PCH_TRANSCODER_A_VBLANK 0xe0010 // INTEL_DISPLAY_A_VBLANK -#define PCH_TRANSCODER_A_VSYNC 0xe0014 // INTEL_DISPLAY_A_VSYNC -#define PCH_TRANSCODER_B_HTOTAL 0xe1000 // INTEL_DISPLAY_B_HTOTAL -#define PCH_TRANSCODER_B_HBLANK 0xe1004 // INTEL_DISPLAY_B_HBLANK -#define PCH_TRANSCODER_B_HSYNC 0xe1008 // INTEL_DISPLAY_B_HSYNC -#define PCH_TRANSCODER_B_VTOTAL 0xe100c // INTEL_DISPLAY_B_VTOTAL -#define PCH_TRANSCODER_B_VBLANK 0xe1010 // INTEL_DISPLAY_B_VBLANK -#define PCH_TRANSCODER_B_VSYNC 0xe1014 // INTEL_DISPLAY_B_VSYNC - -#define PCH_LVDS_DETECTED (1 << 1) - - // SandyBridge (SNB) #define SNB_GRAPHICS_MEMORY_CONTROL 0x50 @@ -326,13 +312,6 @@ struct intel_free_graphics_memory { #define GTT_ENTRY_LOCAL_MEMORY 0x02 #define GTT_PAGE_SHIFT 12 -// interrupts -#define INTEL_INTERRUPT_ENABLED 0x020a0 -#define INTEL_INTERRUPT_IDENTITY 0x020a4 -#define INTEL_INTERRUPT_MASK 0x020a8 -#define INTEL_INTERRUPT_STATUS 0x020ac -#define INTERRUPT_VBLANK_PIPEA (1 << 7) -#define INTERRUPT_VBLANK_PIPEB (1 << 5) // ring buffer #define INTEL_PRIMARY_RING_BUFFER 0x02030 @@ -347,8 +326,19 @@ struct intel_free_graphics_memory { #define INTEL_RING_BUFFER_HEAD_MASK 0x001ffffc #define INTEL_RING_BUFFER_ENABLED 1 +// interrupts +#define INTEL_INTERRUPT_ENABLED (0x0000 | REGS_INTERRUPT) +#define INTEL_INTERRUPT_IDENTITY (0x0004 | REGS_INTERRUPT) +#define INTEL_INTERRUPT_MASK (0x0008 | REGS_INTERRUPT) +#define INTEL_INTERRUPT_STATUS (0x000c | REGS_INTERRUPT) +#define INTERRUPT_VBLANK_PIPEA (1 << 7) +#define INTERRUPT_VBLANK_PIPEB (1 << 5) +// TODO: verify that these are actually different on older versions +#define PCH_INTERRUPT_VBLANK_PIPEA (1 << 7) +#define PCH_INTERRUPT_VBLANK_PIPEB (1 << 15) + // display ports -#define INTEL_DISPLAY_A_ANALOG_PORT 0x61100 +#define INTEL_DISPLAY_A_ANALOG_PORT (0x1100 | REGS_SOUTH_TRANSCODER_PORT) #define DISPLAY_MONITOR_PORT_ENABLED (1UL << 31) #define DISPLAY_MONITOR_PIPE_B (1UL << 30) #define DISPLAY_MONITOR_VGA_POLARITY (1UL << 15) @@ -360,9 +350,9 @@ struct intel_free_graphics_memory { #define DISPLAY_MONITOR_POLARITY_MASK (3UL << 3) #define DISPLAY_MONITOR_POSITIVE_HSYNC (1UL << 3) #define DISPLAY_MONITOR_POSITIVE_VSYNC (2UL << 3) -#define INTEL_DISPLAY_A_DIGITAL_PORT 0x61120 -#define INTEL_DISPLAY_C_DIGITAL 0x61160 -#define INTEL_DISPLAY_LVDS_PORT 0x61180 +#define INTEL_DISPLAY_A_DIGITAL_PORT (0x1120 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_C_DIGITAL (0x1160 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_LVDS_PORT (0x1180 | REGS_SOUTH_TRANSCODER_PORT) #define LVDS_POST2_RATE_SLOW 14 // PLL Divisors #define LVDS_POST2_RATE_FAST 7 #define LVDS_CLKB_POWER_MASK (3 << 4) @@ -399,21 +389,51 @@ struct intel_free_graphics_memory { #define DISPLAY_PLL_M2_DIVISOR_SHIFT 0 #define DISPLAY_PLL_PULSE_PHASE_SHIFT 9 -// display A -#define INTEL_DISPLAY_A_HTOTAL 0x60000 -#define INTEL_DISPLAY_A_HBLANK 0x60004 -#define INTEL_DISPLAY_A_HSYNC 0x60008 -#define INTEL_DISPLAY_A_VTOTAL 0x6000c -#define INTEL_DISPLAY_A_VBLANK 0x60010 -#define INTEL_DISPLAY_A_VSYNC 0x60014 -#define INTEL_DISPLAY_A_IMAGE_SIZE 0x6001c +// display +#define INTEL_DISPLAY_A_HTOTAL (0x0000 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_A_HBLANK (0x0004 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_A_HSYNC (0x0008 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_A_VTOTAL (0x000c | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_A_VBLANK (0x0010 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_A_VSYNC (0x0014 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_A_IMAGE_SIZE (0x001c | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_B_HTOTAL (0x1000 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_B_HBLANK (0x1004 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_B_HSYNC (0x1008 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_B_VTOTAL (0x100c | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_B_VBLANK (0x1010 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_B_VSYNC (0x1014 | REGS_SOUTH_TRANSCODER_PORT) +#define INTEL_DISPLAY_B_IMAGE_SIZE (0x101c | REGS_SOUTH_TRANSCODER_PORT) + +#define INTEL_DISPLAY_B_DIGITAL_PORT (0x1140 | REGS_SOUTH_TRANSCODER_PORT) + +// planes +#define INTEL_DISPLAY_A_PIPE_CONTROL (0x0008 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_B_PIPE_CONTROL (0x1008 | REGS_NORTH_PLANE_CONTROL) +#define DISPLAY_PIPE_ENABLED (1UL << 31) + +#define INTEL_DISPLAY_A_PIPE_STATUS (0x0024 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_B_PIPE_STATUS (0x1024 | REGS_NORTH_PLANE_CONTROL) +#define DISPLAY_PIPE_VBLANK_ENABLED (1UL << 17) +#define DISPLAY_PIPE_VBLANK_STATUS (1UL << 1) + +#define INTEL_DISPLAY_A_CONTROL (0x0180 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_A_BASE (0x0184 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_A_BYTES_PER_ROW (0x0188 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_A_POS (0x018c | REGS_NORTH_PLANE_CONTROL) + // reserved on A +#define INTEL_DISPLAY_A_PIPE_SIZE (0x0190 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_A_SURFACE (0x019c | REGS_NORTH_PLANE_CONTROL) + // i965 and up only + +#define INTEL_DISPLAY_B_CONTROL (0x1180 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_B_BASE (0x1184 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_B_BYTES_PER_ROW (0x1188 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_B_POS (0x118c | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_B_PIPE_SIZE (0x1190 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_DISPLAY_B_SURFACE (0x119c | REGS_NORTH_PLANE_CONTROL) + // i965 and up only -#define INTEL_DISPLAY_A_CONTROL 0x70180 -#define INTEL_DISPLAY_A_BASE 0x70184 -#define INTEL_DISPLAY_A_BYTES_PER_ROW 0x70188 -#define INTEL_DISPLAY_A_POS 0x7018c // reserved -#define INTEL_DISPLAY_A_PIPE_SIZE 0x70190 -#define INTEL_DISPLAY_A_SURFACE 0x7019c // i965 and up only #define DISPLAY_CONTROL_ENABLED (1UL << 31) #define DISPLAY_CONTROL_GAMMA (1UL << 30) #define DISPLAY_CONTROL_COLOR_MASK (0x0fUL << 26) @@ -422,51 +442,64 @@ struct intel_free_graphics_memory { #define DISPLAY_CONTROL_RGB16 (5UL << 26) #define DISPLAY_CONTROL_RGB32 (6UL << 26) +// cursors +#define INTEL_CURSOR_CONTROL (0x0080 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_CURSOR_BASE (0x0084 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_CURSOR_POSITION (0x0088 | REGS_NORTH_PLANE_CONTROL) +#define INTEL_CURSOR_PALETTE (0x0090 | REGS_NORTH_PLANE_CONTROL) + // (- 0x009f) +#define INTEL_CURSOR_SIZE (0x00a0 | REGS_NORTH_PLANE_CONTROL) +#define CURSOR_ENABLED (1UL << 31) +#define CURSOR_FORMAT_2_COLORS (0UL << 24) +#define CURSOR_FORMAT_3_COLORS (1UL << 24) +#define CURSOR_FORMAT_4_COLORS (2UL << 24) +#define CURSOR_FORMAT_ARGB (4UL << 24) +#define CURSOR_FORMAT_XRGB (5UL << 24) +#define CURSOR_POSITION_NEGATIVE 0x8000 +#define CURSOR_POSITION_MASK 0x3fff + +// palette registers +#define INTEL_DISPLAY_A_PALETTE (0xa000 | REGS_NORTH_SHARED) +#define INTEL_DISPLAY_B_PALETTE (0xa800 | REGS_NORTH_SHARED) + +// PLL registers +#define INTEL_DISPLAY_A_PLL (0x6014 | REGS_SOUTH_SHARED) +#define INTEL_DISPLAY_B_PLL (0x6018 | REGS_SOUTH_SHARED) +#define INTEL_DISPLAY_A_PLL_MULTIPLIER_DIVISOR \ + (0x601c | REGS_SOUTH_SHARED) +#define INTEL_DISPLAY_B_PLL_MULTIPLIER_DIVISOR \ + (0x6020 | REGS_SOUTH_SHARED) +#define INTEL_DISPLAY_A_PLL_DIVISOR_0 (0x6040 | REGS_SOUTH_SHARED) +#define INTEL_DISPLAY_A_PLL_DIVISOR_1 (0x6044 | REGS_SOUTH_SHARED) +#define INTEL_DISPLAY_B_PLL_DIVISOR_0 (0x6048 | REGS_SOUTH_SHARED) +#define INTEL_DISPLAY_B_PLL_DIVISOR_1 (0x604c | REGS_SOUTH_SHARED) + +// i2c +#define INTEL_I2C_IO_A (0x5010 | REGS_SOUTH_SHARED) +#define INTEL_I2C_IO_B (0x5014 | REGS_SOUTH_SHARED) +#define INTEL_I2C_IO_C (0x5018 | REGS_SOUTH_SHARED) +#define INTEL_I2C_IO_D (0x501c | REGS_SOUTH_SHARED) +#define INTEL_I2C_IO_E (0x5020 | REGS_SOUTH_SHARED) +#define INTEL_I2C_IO_F (0x5024 | REGS_SOUTH_SHARED) +#define INTEL_I2C_IO_G (0x5028 | REGS_SOUTH_SHARED) +#define INTEL_I2C_IO_H (0x502c | REGS_SOUTH_SHARED) + +#define I2C_CLOCK_DIRECTION_MASK (1 << 0) +#define I2C_CLOCK_DIRECTION_OUT (1 << 1) +#define I2C_CLOCK_VALUE_MASK (1 << 2) +#define I2C_CLOCK_VALUE_OUT (1 << 3) +#define I2C_CLOCK_VALUE_IN (1 << 4) +#define I2C_DATA_DIRECTION_MASK (1 << 8) +#define I2C_DATA_DIRECTION_OUT (1 << 9) +#define I2C_DATA_VALUE_MASK (1 << 10) +#define I2C_DATA_VALUE_OUT (1 << 11) +#define I2C_DATA_VALUE_IN (1 << 12) +#define I2C_RESERVED ((1 << 13) | (1 << 5)) + +// TODO: on IronLake this is in the north shared block at 0x41000 #define INTEL_VGA_DISPLAY_CONTROL 0x71400 #define VGA_DISPLAY_DISABLED (1UL << 31) -#define INTEL_DISPLAY_A_PALETTE 0x0a000 - -#define INTEL_DISPLAY_A_PIPE_CONTROL 0x70008 -#define DISPLAY_PIPE_ENABLED (1UL << 31) -#define INTEL_DISPLAY_A_PIPE_STATUS 0x70024 -#define DISPLAY_PIPE_VBLANK_ENABLED (1UL << 17) -#define DISPLAY_PIPE_VBLANK_STATUS (1UL << 1) - -#define INTEL_DISPLAY_A_PLL 0x06014 -#define INTEL_DISPLAY_A_PLL_MULTIPLIER_DIVISOR 0x0601c -#define INTEL_DISPLAY_A_PLL_DIVISOR_0 0x06040 -#define INTEL_DISPLAY_A_PLL_DIVISOR_1 0x06044 - -// display B -#define INTEL_DISPLAY_B_HTOTAL 0x61000 -#define INTEL_DISPLAY_B_HBLANK 0x61004 -#define INTEL_DISPLAY_B_HSYNC 0x61008 -#define INTEL_DISPLAY_B_VTOTAL 0x6100c -#define INTEL_DISPLAY_B_VBLANK 0x61010 -#define INTEL_DISPLAY_B_VSYNC 0x61014 - -#define INTEL_DISPLAY_B_DIGITAL_PORT 0x61140 -#define INTEL_DISPLAY_B_PIPE_SIZE 0x71190 - -#define INTEL_DISPLAY_B_PIPE_CONTROL 0x71008 -#define INTEL_DISPLAY_B_PIPE_STATUS 0x71024 - -#define INTEL_DISPLAY_B_CONTROL 0x71180 -#define INTEL_DISPLAY_B_BASE 0x71184 -#define INTEL_DISPLAY_B_BYTES_PER_ROW 0x71188 -#define INTEL_DISPLAY_B_POS 0x7118c - -#define INTEL_DISPLAY_B_IMAGE_SIZE 0x6101c -#define INTEL_DISPLAY_B_SURFACE 0x7119c // i965 and up only - -#define INTEL_DISPLAY_B_PALETTE 0x0a800 - -#define INTEL_DISPLAY_B_PLL 0x06018 -#define INTEL_DISPLAY_B_PLL_MULTIPLIER_DIVISOR 0x06020 -#define INTEL_DISPLAY_B_PLL_DIVISOR_0 0x06048 -#define INTEL_DISPLAY_B_PLL_DIVISOR_1 0x0604c - // LVDS panel #define INTEL_PANEL_STATUS 0x61200 #define PANEL_STATUS_POWER_ON (1UL << 31) @@ -475,20 +508,12 @@ struct intel_free_graphics_memory { #define INTEL_PANEL_FIT_CONTROL 0x61230 #define INTEL_PANEL_FIT_RATIOS 0x61234 -// cursor -#define INTEL_CURSOR_CONTROL 0x70080 -#define INTEL_CURSOR_BASE 0x70084 -#define INTEL_CURSOR_POSITION 0x70088 -#define INTEL_CURSOR_PALETTE 0x70090 // (- 0x7009f) -#define INTEL_CURSOR_SIZE 0x700a0 -#define CURSOR_ENABLED (1UL << 31) -#define CURSOR_FORMAT_2_COLORS (0UL << 24) -#define CURSOR_FORMAT_3_COLORS (1UL << 24) -#define CURSOR_FORMAT_4_COLORS (2UL << 24) -#define CURSOR_FORMAT_ARGB (4UL << 24) -#define CURSOR_FORMAT_XRGB (5UL << 24) -#define CURSOR_POSITION_NEGATIVE 0x8000 -#define CURSOR_POSITION_MASK 0x3fff +// LVDS on IronLake and up +#define PCH_PANEL_CONTROL 0xc7200 +#define PCH_PANEL_STATUS 0xc7204 +#define PANEL_REGISTER_UNLOCK (0xabcd << 16) +#define PCH_LVDS_DETECTED (1 << 1) + // ring buffer commands @@ -519,31 +544,7 @@ struct intel_free_graphics_memory { #define COMMAND_MODE_RGB16 0x01 #define COMMAND_MODE_RGB32 0x03 -// i2c - -#define INTEL_I2C_IO_A 0x5010 -#define INTEL_I2C_IO_B 0x5014 -#define INTEL_I2C_IO_C 0x5018 -#define INTEL_I2C_IO_D 0x501c -#define INTEL_I2C_IO_E 0x5020 -#define INTEL_I2C_IO_F 0x5024 -#define INTEL_I2C_IO_G 0x5028 -#define INTEL_I2C_IO_H 0x502c - -#define I2C_CLOCK_DIRECTION_MASK (1 << 0) -#define I2C_CLOCK_DIRECTION_OUT (1 << 1) -#define I2C_CLOCK_VALUE_MASK (1 << 2) -#define I2C_CLOCK_VALUE_OUT (1 << 3) -#define I2C_CLOCK_VALUE_IN (1 << 4) -#define I2C_DATA_DIRECTION_MASK (1 << 8) -#define I2C_DATA_DIRECTION_OUT (1 << 9) -#define I2C_DATA_VALUE_MASK (1 << 10) -#define I2C_DATA_VALUE_OUT (1 << 11) -#define I2C_DATA_VALUE_IN (1 << 12) -#define I2C_RESERVED ((1 << 13) | (1 << 5)) - // overlay - #define INTEL_OVERLAY_UPDATE 0x30000 #define INTEL_OVERLAY_TEST 0x30004 #define INTEL_OVERLAY_STATUS 0x30008 diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.cpp b/src/add-ons/accelerants/intel_extreme/accelerant.cpp index a3545ccd80..3d9b0023cf 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant.cpp +++ b/src/add-ons/accelerants/intel_extreme/accelerant.cpp @@ -123,7 +123,7 @@ init_common(int device, bool isClone) AreaCloner regsCloner; gInfo->regs_area = regsCloner.Clone("intel extreme regs", - (void **)&gInfo->regs, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, + (void **)&gInfo->registers, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, gInfo->shared_info->registers_area); status = regsCloner.InitCheck(); if (status < B_OK) { @@ -203,14 +203,13 @@ intel_init_accelerant(int device) if (read32(INTEL_DISPLAY_A_PIPE_CONTROL) & DISPLAY_PIPE_ENABLED) gInfo->head_mode |= HEAD_MODE_A_ANALOG; - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - int lvdsRegister = isSNB ? PCH_DISPLAY_LVDS_PORT : INTEL_DISPLAY_LVDS_PORT; - uint32 lvds = read32(lvdsRegister); + uint32 lvds = read32(INTEL_DISPLAY_LVDS_PORT); // If we have an enabled display pipe we save the passed information and // assume it is the valid panel size.. // Later we query for proper EDID info if it exists, or figure something // else out. (Default modes, etc.) + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); if ((isSNB && (lvds & PCH_LVDS_DETECTED) != 0) || (!isSNB && (lvds & DISPLAY_PIPE_ENABLED) != 0)) { save_lvds_mode(); @@ -219,11 +218,9 @@ intel_init_accelerant(int device) TRACE(("head detected: %#x\n", gInfo->head_mode)); TRACE(("adpa: %08lx, dova: %08lx, dovb: %08lx, lvds: %08lx\n", - read32(isSNB ? PCH_DISPLAY_A_ANALOG_PORT : INTEL_DISPLAY_A_ANALOG_PORT), - read32(isSNB ? PCH_DISPLAY_A_DIGITAL_PORT - : INTEL_DISPLAY_A_DIGITAL_PORT), - read32(isSNB ? PCH_DISPLAY_B_DIGITAL_PORT - : INTEL_DISPLAY_B_DIGITAL_PORT), read32(lvdsRegister))); + read32(INTEL_DISPLAY_A_ANALOG_PORT), + read32(INTEL_DISPLAY_A_DIGITAL_PORT), + read32(INTEL_DISPLAY_B_DIGITAL_PORT), read32(INTEL_DISPLAY_LVDS_PORT))); status = create_mode_list(); if (status != B_OK) { diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.h b/src/add-ons/accelerants/intel_extreme/accelerant.h index 2b4da8485e..a0216a9115 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant.h +++ b/src/add-ons/accelerants/intel_extreme/accelerant.h @@ -31,7 +31,7 @@ struct overlay_frame { }; struct accelerant_info { - vuint8 *regs; + uint8 *registers; area_id regs_area; intel_shared_info *shared_info; @@ -74,15 +74,19 @@ extern accelerant_info *gInfo; // register access inline uint32 -read32(uint32 offset) +read32(uint32 encodedRegister) { - return *(volatile uint32 *)(gInfo->regs + offset); + return *(volatile uint32 *)(gInfo->registers + + gInfo->shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + + REGISTER_REGISTER(encodedRegister)); } inline void -write32(uint32 offset, uint32 value) +write32(uint32 encodedRegister, uint32 value) { - *(volatile uint32 *)(gInfo->regs + offset) = value; + *(volatile uint32 *)(gInfo->registers + + gInfo->shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + + REGISTER_REGISTER(encodedRegister)) = value; } diff --git a/src/add-ons/accelerants/intel_extreme/dpms.cpp b/src/add-ons/accelerants/intel_extreme/dpms.cpp index 37fee355f6..4a4a3beea2 100644 --- a/src/add-ons/accelerants/intel_extreme/dpms.cpp +++ b/src/add-ons/accelerants/intel_extreme/dpms.cpp @@ -75,6 +75,11 @@ static void enable_lvds_panel(bool enable) { bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + if (isSNB) { + // TODO: fix for SNB + return; + } + int controlRegister = isSNB ? PCH_PANEL_CONTROL : INTEL_PANEL_CONTROL; int statusRegister = isSNB ? PCH_PANEL_STATUS : INTEL_PANEL_STATUS; @@ -108,35 +113,32 @@ set_display_power_mode(uint32 mode) { uint32 monitorMode = 0; - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); if (mode == B_DPMS_ON) { - int targetRegister = isSNB ? PCH_DISPLAY_A_PLL : INTEL_DISPLAY_A_PLL; - uint32 pll = read32(targetRegister); + uint32 pll = read32(INTEL_DISPLAY_A_PLL); if ((pll & DISPLAY_PLL_ENABLED) == 0) { // reactivate PLL - write32(targetRegister, pll); - read32(targetRegister); + write32(INTEL_DISPLAY_A_PLL, pll); + read32(INTEL_DISPLAY_A_PLL); spin(150); - write32(targetRegister, pll | DISPLAY_PLL_ENABLED); - read32(targetRegister); + write32(INTEL_DISPLAY_A_PLL, pll | DISPLAY_PLL_ENABLED); + read32(INTEL_DISPLAY_A_PLL); spin(150); - write32(targetRegister, pll | DISPLAY_PLL_ENABLED); - read32(targetRegister); + write32(INTEL_DISPLAY_A_PLL, pll | DISPLAY_PLL_ENABLED); + read32(INTEL_DISPLAY_A_PLL); spin(150); } - targetRegister = isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL; - pll = read32(targetRegister); + pll = read32(INTEL_DISPLAY_B_PLL); if ((pll & DISPLAY_PLL_ENABLED) == 0) { // reactivate PLL - write32(targetRegister, pll); - read32(targetRegister); + write32(INTEL_DISPLAY_B_PLL, pll); + read32(INTEL_DISPLAY_B_PLL); spin(150); - write32(targetRegister, pll | DISPLAY_PLL_ENABLED); - read32(targetRegister); + write32(INTEL_DISPLAY_B_PLL, pll | DISPLAY_PLL_ENABLED); + read32(INTEL_DISPLAY_B_PLL); spin(150); - write32(targetRegister, pll | DISPLAY_PLL_ENABLED); - read32(targetRegister); + write32(INTEL_DISPLAY_B_PLL, pll | DISPLAY_PLL_ENABLED); + read32(INTEL_DISPLAY_B_PLL); spin(150); } @@ -162,17 +164,15 @@ set_display_power_mode(uint32 mode) } if (gInfo->head_mode & HEAD_MODE_A_ANALOG) { - int targetRegister - = isSNB ? PCH_DISPLAY_A_ANALOG_PORT : INTEL_DISPLAY_A_ANALOG_PORT; - write32(targetRegister, (read32(targetRegister) - & ~(DISPLAY_MONITOR_MODE_MASK | DISPLAY_MONITOR_PORT_ENABLED)) + write32(INTEL_DISPLAY_A_ANALOG_PORT, + (read32(INTEL_DISPLAY_A_ANALOG_PORT) + & ~(DISPLAY_MONITOR_MODE_MASK | DISPLAY_MONITOR_PORT_ENABLED)) | monitorMode | (mode != B_DPMS_OFF ? DISPLAY_MONITOR_PORT_ENABLED : 0)); } if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { - int targetRegister - = isSNB ? PCH_DISPLAY_B_DIGITAL_PORT : INTEL_DISPLAY_B_DIGITAL_PORT; - write32(targetRegister, (read32(targetRegister) - & ~(DISPLAY_MONITOR_MODE_MASK | DISPLAY_MONITOR_PORT_ENABLED)) + write32(INTEL_DISPLAY_B_DIGITAL_PORT, + (read32(INTEL_DISPLAY_B_DIGITAL_PORT) + & ~(DISPLAY_MONITOR_MODE_MASK | DISPLAY_MONITOR_PORT_ENABLED)) | (mode != B_DPMS_OFF ? DISPLAY_MONITOR_PORT_ENABLED : 0)); // TODO: monitorMode? } @@ -184,25 +184,22 @@ set_display_power_mode(uint32 mode) } if (mode == B_DPMS_OFF) { - int targetRegister = isSNB ? PCH_DISPLAY_A_PLL : INTEL_DISPLAY_A_PLL; - write32(targetRegister, read32(targetRegister) + write32(INTEL_DISPLAY_A_PLL, read32(INTEL_DISPLAY_A_PLL) | DISPLAY_PLL_ENABLED); - targetRegister = isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL; - write32(targetRegister, read32(targetRegister) + write32(INTEL_DISPLAY_B_PLL, read32(INTEL_DISPLAY_B_PLL) | DISPLAY_PLL_ENABLED); - read32(targetRegister); + read32(INTEL_DISPLAY_B_PLL); // flush the possibly cached PCI bus writes spin(150); } - // TODO: fix for SNB - if (!isSNB && (gInfo->head_mode & HEAD_MODE_LVDS_PANEL) != 0) + if ((gInfo->head_mode & HEAD_MODE_LVDS_PANEL) != 0) enable_lvds_panel(mode == B_DPMS_ON); read32(INTEL_DISPLAY_A_BASE); - // flush the eventually cached PCI bus writes + // flush the possibly cached PCI bus writes } diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 6cf97ab5a5..4e09262329 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -154,10 +154,8 @@ set_frame_buffer_base() status_t create_mode_list(void) { - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - i2c_bus bus; - bus.cookie = (void*)(isSNB ? PCH_I2C_IO_A : INTEL_I2C_IO_A); + bus.cookie = (void*)INTEL_I2C_IO_A; bus.set_signals = &set_i2c_signals; bus.get_signals = &get_i2c_signals; ddc2_init_timing(&bus); @@ -169,7 +167,7 @@ create_mode_list(void) } else { TRACE(("intel_extreme: getting EDID on port A (analog) failed : %s. " "Trying on port C (lvds)\n", strerror(error))); - bus.cookie = (void*)(isSNB ? PCH_I2C_IO_C : INTEL_I2C_IO_C); + bus.cookie = (void*)INTEL_I2C_IO_C; error = ddc2_read_edid1(&bus, &gInfo->edid_info, NULL, NULL); if (error == B_OK) { edid_dump(&gInfo->edid_info); @@ -324,12 +322,8 @@ compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors, TRACE(("required MHz: %g\n", requestedPixelClock)); - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - if (isLVDS) { - int targetRegister - = isSNB ? PCH_DISPLAY_LVDS_PORT : INTEL_DISPLAY_LVDS_PORT; - if ((read32(targetRegister) & LVDS_CLKB_POWER_MASK) + if ((read32(INTEL_DISPLAY_LVDS_PORT) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) divisors.post2 = LVDS_POST2_RATE_FAST; else @@ -418,26 +412,6 @@ retrieve_current_mode(display_mode& mode, uint32 pllRegister) vSyncRegister = INTEL_DISPLAY_B_VSYNC; imageSizeRegister = INTEL_DISPLAY_B_IMAGE_SIZE; controlRegister = INTEL_DISPLAY_B_CONTROL; - } else if (pllRegister == PCH_DISPLAY_A_PLL) { - pllDivisor = read32((pll & DISPLAY_PLL_DIVISOR_1) != 0 - ? PCH_DISPLAY_A_PLL_DIVISOR_1 : PCH_DISPLAY_A_PLL_DIVISOR_0); - - hTotalRegister = PCH_TRANSCODER_A_HTOTAL; - vTotalRegister = PCH_TRANSCODER_A_VTOTAL; - hSyncRegister = PCH_TRANSCODER_A_HSYNC; - vSyncRegister = PCH_TRANSCODER_A_VSYNC; - imageSizeRegister = INTEL_DISPLAY_A_IMAGE_SIZE; - controlRegister = INTEL_DISPLAY_A_CONTROL; - } else if (pllRegister == PCH_DISPLAY_B_PLL) { - pllDivisor = read32((pll & DISPLAY_PLL_DIVISOR_1) != 0 - ? PCH_DISPLAY_B_PLL_DIVISOR_1 : PCH_DISPLAY_B_PLL_DIVISOR_0); - - hTotalRegister = PCH_TRANSCODER_B_HTOTAL; - vTotalRegister = PCH_TRANSCODER_B_VTOTAL; - hSyncRegister = PCH_TRANSCODER_B_HSYNC; - vSyncRegister = PCH_TRANSCODER_B_VSYNC; - imageSizeRegister = INTEL_DISPLAY_B_IMAGE_SIZE; - controlRegister = INTEL_DISPLAY_B_CONTROL; } else { // TODO: not supported return; @@ -565,12 +539,9 @@ retrieve_current_mode(display_mode& mode, uint32 pllRegister) void save_lvds_mode(void) { - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - // dump currently programmed mode. display_mode biosMode; - retrieve_current_mode(biosMode, - isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL); + retrieve_current_mode(biosMode, INTEL_DISPLAY_B_PLL); gInfo->lvds_panel_mode = biosMode; } @@ -749,9 +720,6 @@ if (first) { write32(INTEL_VGA_DISPLAY_CONTROL, VGA_DISPLAY_DISABLED); read32(INTEL_VGA_DISPLAY_CONTROL); - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - int targetRegister; - if ((gInfo->head_mode & HEAD_MODE_B_DIGITAL) != 0) { // For LVDS panels, we actually always set the native mode in hardware // Then we use the panel fitter to scale the picture to that. @@ -829,8 +797,7 @@ if (first) { | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_IGD_M2_DIVISOR_MASK)); } else { - write32(isSNB ? PCH_DISPLAY_B_PLL_DIVISOR_0 - : INTEL_DISPLAY_B_PLL_DIVISOR_0, + write32(INTEL_DISPLAY_B_PLL_DIVISOR_0, (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) @@ -838,15 +805,12 @@ if (first) { | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_M2_DIVISOR_MASK)); } - targetRegister = isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL; - write32(targetRegister, dpll & ~DISPLAY_PLL_ENABLED); - read32(targetRegister); + write32(INTEL_DISPLAY_B_PLL, dpll & ~DISPLAY_PLL_ENABLED); + read32(INTEL_DISPLAY_B_PLL); spin(150); } - targetRegister - = isSNB ? PCH_DISPLAY_LVDS_PORT : INTEL_DISPLAY_LVDS_PORT; - uint32 lvds = read32(targetRegister) | LVDS_PORT_EN + uint32 lvds = read32(INTEL_DISPLAY_LVDS_PORT) | LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT; lvds |= LVDS_18BIT_DITHER; @@ -863,8 +827,8 @@ if (first) { else lvds &= ~(LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP); - write32(targetRegister, lvds); - read32(targetRegister); + write32(INTEL_DISPLAY_LVDS_PORT, lvds); + read32(INTEL_DISPLAY_LVDS_PORT); if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_IGD)) { write32(INTEL_DISPLAY_B_PLL_DIVISOR_0, @@ -873,8 +837,7 @@ if (first) { | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_IGD_M2_DIVISOR_MASK)); } else { - write32(isSNB ? PCH_DISPLAY_B_PLL_DIVISOR_0 - : INTEL_DISPLAY_B_PLL_DIVISOR_0, + write32(INTEL_DISPLAY_B_PLL_DIVISOR_0, (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) @@ -883,9 +846,8 @@ if (first) { & DISPLAY_PLL_M2_DIVISOR_MASK)); } - targetRegister = isSNB ? PCH_DISPLAY_B_PLL : INTEL_DISPLAY_B_PLL; - write32(targetRegister, dpll); - read32(targetRegister); + write32(INTEL_DISPLAY_B_PLL, dpll); + read32(INTEL_DISPLAY_B_PLL); // Wait for the clocks to stabilize spin(150); @@ -905,9 +867,9 @@ if (first) { write32(INTEL_DISPLAY_B_PLL_MULTIPLIER_DIVISOR, (0 << 24) | ((pixelMultiply - 1) << 8)); } else - write32(targetRegister, dpll); + write32(INTEL_DISPLAY_B_PLL, dpll); - read32(targetRegister); + read32(INTEL_DISPLAY_B_PLL); spin(150); // update timing parameters @@ -928,14 +890,14 @@ if (first) { + (hardwareTarget.timing.h_total - target.timing.h_display) / 2; - write32(isSNB ? PCH_TRANSCODER_B_HTOTAL : INTEL_DISPLAY_B_HTOTAL, + write32(INTEL_DISPLAY_B_HTOTAL, ((uint32)(hardwareTarget.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(isSNB ? PCH_TRANSCODER_B_HBLANK : INTEL_DISPLAY_B_HBLANK, + write32(INTEL_DISPLAY_B_HBLANK, ((uint32)(hardwareTarget.timing.h_total - borderWidth / 2 - 1) << 16) | ((uint32)target.timing.h_display + borderWidth / 2 - 1)); - write32(isSNB ? PCH_TRANSCODER_B_HSYNC : INTEL_DISPLAY_B_HSYNC, + write32(INTEL_DISPLAY_B_HSYNC, ((uint32)(syncCenter + syncWidth / 2 - 1) << 16) | ((uint32)syncCenter - syncWidth / 2 - 1)); @@ -949,15 +911,15 @@ if (first) { + (hardwareTarget.timing.v_total - target.timing.v_display) / 2; - write32(isSNB ? PCH_TRANSCODER_B_VTOTAL : INTEL_DISPLAY_B_VTOTAL, + write32(INTEL_DISPLAY_B_VTOTAL, ((uint32)(hardwareTarget.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(isSNB ? PCH_TRANSCODER_B_VBLANK : INTEL_DISPLAY_B_VBLANK, + write32(INTEL_DISPLAY_B_VBLANK, ((uint32)(hardwareTarget.timing.v_total - borderHeight / 2 - 1) << 16) | ((uint32)target.timing.v_display + borderHeight / 2 - 1)); - write32(isSNB ? PCH_TRANSCODER_B_VSYNC : INTEL_DISPLAY_B_VSYNC, + write32(INTEL_DISPLAY_B_VSYNC, ((uint32)(syncCenter + syncHeight / 2 - 1) << 16) | ((uint32)syncCenter - syncHeight / 2 - 1)); @@ -966,23 +928,23 @@ if (first) { // sync) // write32(0x61020, 0x00FF0000); } else { - write32(isSNB ? PCH_TRANSCODER_B_HTOTAL : INTEL_DISPLAY_B_HTOTAL, + write32(INTEL_DISPLAY_B_HTOTAL, ((uint32)(target.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(isSNB ? PCH_TRANSCODER_B_HBLANK : INTEL_DISPLAY_B_HBLANK, + write32(INTEL_DISPLAY_B_HBLANK, ((uint32)(target.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(isSNB ? PCH_TRANSCODER_B_HSYNC : INTEL_DISPLAY_B_HSYNC, + write32(INTEL_DISPLAY_B_HSYNC, ((uint32)(target.timing.h_sync_end - 1) << 16) | ((uint32)target.timing.h_sync_start - 1)); - write32(isSNB ? PCH_TRANSCODER_B_VTOTAL : INTEL_DISPLAY_B_VTOTAL, + write32(INTEL_DISPLAY_B_VTOTAL, ((uint32)(target.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(isSNB ? PCH_TRANSCODER_B_VBLANK : INTEL_DISPLAY_B_VBLANK, + write32(INTEL_DISPLAY_B_VBLANK, ((uint32)(target.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(isSNB ? PCH_TRANSCODER_B_VSYNC : INTEL_DISPLAY_B_VSYNC, ( + write32(INTEL_DISPLAY_B_VSYNC, ( (uint32)(target.timing.v_sync_end - 1) << 16) | ((uint32)target.timing.v_sync_start - 1)); } @@ -1016,8 +978,7 @@ if (first) { | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_IGD_M2_DIVISOR_MASK)); } else { - write32(isSNB ? PCH_DISPLAY_A_PLL_DIVISOR_0 - : INTEL_DISPLAY_A_PLL_DIVISOR_0, + write32(INTEL_DISPLAY_A_PLL_DIVISOR_0, (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) @@ -1059,32 +1020,31 @@ if (first) { pll |= DISPLAY_PLL_POST1_DIVIDE_2; } - targetRegister = isSNB ? PCH_DISPLAY_A_PLL : INTEL_DISPLAY_A_PLL; - write32(targetRegister, pll); - read32(targetRegister); + write32(INTEL_DISPLAY_A_PLL, pll); + read32(INTEL_DISPLAY_A_PLL); spin(150); - write32(targetRegister, pll); - read32(targetRegister); + write32(INTEL_DISPLAY_A_PLL, pll); + read32(INTEL_DISPLAY_A_PLL); spin(150); // update timing parameters - write32(isSNB ? PCH_TRANSCODER_A_HTOTAL : INTEL_DISPLAY_A_HTOTAL, + write32(INTEL_DISPLAY_A_HTOTAL, ((uint32)(target.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(isSNB ? PCH_TRANSCODER_A_HBLANK : INTEL_DISPLAY_A_HBLANK, + write32(INTEL_DISPLAY_A_HBLANK, ((uint32)(target.timing.h_total - 1) << 16) | ((uint32)target.timing.h_display - 1)); - write32(isSNB ? PCH_TRANSCODER_A_HSYNC : INTEL_DISPLAY_A_HSYNC, + write32(INTEL_DISPLAY_A_HSYNC, ((uint32)(target.timing.h_sync_end - 1) << 16) | ((uint32)target.timing.h_sync_start - 1)); - write32(isSNB ? PCH_TRANSCODER_A_VTOTAL : INTEL_DISPLAY_A_VTOTAL, + write32(INTEL_DISPLAY_A_VTOTAL, ((uint32)(target.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(isSNB ? PCH_TRANSCODER_A_VBLANK : INTEL_DISPLAY_A_VBLANK, + write32(INTEL_DISPLAY_A_VBLANK, ((uint32)(target.timing.v_total - 1) << 16) | ((uint32)target.timing.v_display - 1)); - write32(isSNB ? PCH_TRANSCODER_A_VSYNC : INTEL_DISPLAY_A_VSYNC, + write32(INTEL_DISPLAY_A_VSYNC, ((uint32)(target.timing.v_sync_end - 1) << 16) | ((uint32)target.timing.v_sync_start - 1)); @@ -1092,10 +1052,8 @@ if (first) { ((uint32)(target.virtual_width - 1) << 16) | ((uint32)target.virtual_height - 1)); - targetRegister - = isSNB ? PCH_DISPLAY_A_ANALOG_PORT : INTEL_DISPLAY_A_ANALOG_PORT; - write32(targetRegister, - (read32(targetRegister) + write32(INTEL_DISPLAY_A_ANALOG_PORT, + (read32(INTEL_DISPLAY_A_ANALOG_PORT) & ~(DISPLAY_MONITOR_POLARITY_MASK | DISPLAY_MONITOR_VGA_POLARITY)) | ((target.timing.flags & B_POSITIVE_HSYNC) != 0 @@ -1151,9 +1109,7 @@ intel_get_display_mode(display_mode *_currentMode) { TRACE(("intel_get_display_mode()\n")); - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - retrieve_current_mode(*_currentMode, - isSNB ? PCH_DISPLAY_A_PLL : INTEL_DISPLAY_A_PLL); + retrieve_current_mode(*_currentMode, INTEL_DISPLAY_A_PLL); return B_OK; } @@ -1259,11 +1215,8 @@ intel_set_indexed_colors(uint count, uint8 first, uint8 *colors, uint32 flags) uint32 color = colors[0] << 16 | colors[1] << 8 | colors[2]; colors += 3; - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - write32((isSNB ? PCH_DISPLAY_A_PALETTE : INTEL_DISPLAY_A_PALETTE) - + first * sizeof(uint32), color); - write32((isSNB ? PCH_DISPLAY_B_PALETTE : INTEL_DISPLAY_B_PALETTE) - + first * sizeof(uint32), color); + write32(INTEL_DISPLAY_A_PALETTE + first * sizeof(uint32), color); + write32(INTEL_DISPLAY_B_PALETTE + first * sizeof(uint32), color); } } diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp index b867fc95c6..d3321f390a 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp @@ -76,14 +76,14 @@ getset_register(int argc, char **argv) kprintf("intel_extreme register %#lx\n", reg); intel_info &info = *gDeviceInfo[0]; - uint32 oldValue = read32(info.registers + reg); + uint32 oldValue = read32(info, reg); kprintf(" %svalue: %#lx (%lu)\n", set ? "old " : "", oldValue, oldValue); if (set) { - write32(info.registers + reg, value); + write32(info, reg, value); - value = read32(info.registers + reg); + value = read32(info, reg); kprintf(" new value: %#lx (%lu)\n", value, value); } diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h index 68d851f57f..06956d7e58 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h @@ -17,16 +17,6 @@ #include "intel_extreme_private.h" -// PCI Communications - -#define read8(address) (*((volatile uint8*)(address))) -#define read16(address) (*((volatile uint16*)(address))) -#define read32(address) (*((volatile uint32*)(address))) -#define write8(address, data) (*((volatile uint8*)(address)) = (data)) -#define write16(address, data) (*((volatile uint16*)(address)) = (data)) -#define write32(address, data) (*((volatile uint32*)(address)) = (data)) - - extern char* gDeviceNames[]; extern intel_info* gDeviceInfo[]; extern pci_module_info* gPCI; @@ -49,4 +39,40 @@ set_pci_config(pci_info* info, uint8 offset, uint8 size, uint32 value) size, value); } + +static inline uint16 +read16(intel_info &info, uint32 encodedRegister) +{ + return *(volatile uint16 *)(info.registers + + info.shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + + REGISTER_REGISTER(encodedRegister)); +} + + +static inline uint32 +read32(intel_info &info, uint32 encodedRegister) +{ + return *(volatile uint32 *)(info.registers + + info.shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + + REGISTER_REGISTER(encodedRegister)); +} + + +static inline void +write16(intel_info &info, uint32 encodedRegister, uint16 value) +{ + *(volatile uint16 *)(info.registers + + info.shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + + REGISTER_REGISTER(encodedRegister)) = value; +} + + +static inline void +write32(intel_info &info, uint32 encodedRegister, uint32 value) +{ + *(volatile uint32 *)(info.registers + + info.shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + + REGISTER_REGISTER(encodedRegister)) = value; +} + #endif /* DRIVER_H */ diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index e959216691..34c9fbd216 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -76,20 +76,20 @@ intel_interrupt_handler(void *data) { intel_info &info = *(intel_info *)data; - bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); - uint32 identity = read16(info.registers - + (isSNB ? PCH_DE_INTERRUPT_IDENTITY : INTEL_INTERRUPT_IDENTITY)); + uint16 identity = read16(info, INTEL_INTERRUPT_IDENTITY); if (identity == 0) return B_UNHANDLED_INTERRUPT; int32 handled = B_HANDLED_INTERRUPT; - uint32 mask = isSNB ? PCH_INTERRUPT_VBLANK_PIPEA : INTERRUPT_VBLANK_PIPEA; + // TODO: verify that these aren't actually the same + bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); + uint16 mask = isSNB ? PCH_INTERRUPT_VBLANK_PIPEA : INTERRUPT_VBLANK_PIPEA; if ((identity & mask) != 0) { handled = release_vblank_sem(info); // make sure we'll get another one of those - write32(info.registers + INTEL_DISPLAY_A_PIPE_STATUS, + write32(info, INTEL_DISPLAY_A_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); } @@ -98,13 +98,12 @@ intel_interrupt_handler(void *data) handled = release_vblank_sem(info); // make sure we'll get another one of those - write32(info.registers + INTEL_DISPLAY_B_PIPE_STATUS, + write32(info, INTEL_DISPLAY_B_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); } // setting the bit clears it! - write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_IDENTITY - : INTEL_INTERRUPT_IDENTITY), identity); + write16(info, INTEL_INTERRUPT_IDENTITY, identity); return handled; } @@ -138,26 +137,22 @@ init_interrupt_handler(intel_info &info) status = install_io_interrupt_handler(info.pci->u.h0.interrupt_line, &intel_interrupt_handler, (void *)&info, 0); if (status == B_OK) { - write32(info.registers + INTEL_DISPLAY_A_PIPE_STATUS, + write32(info, INTEL_DISPLAY_A_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); - write32(info.registers + INTEL_DISPLAY_B_PIPE_STATUS, + write32(info, INTEL_DISPLAY_B_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); - bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); - write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_IDENTITY - : INTEL_INTERRUPT_IDENTITY), ~0); + write16(info, INTEL_INTERRUPT_IDENTITY, ~0); // enable interrupts - we only want VBLANK interrupts + bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); uint16 enable = isSNB ? (PCH_INTERRUPT_VBLANK_PIPEA | PCH_INTERRUPT_VBLANK_PIPEB) : (INTERRUPT_VBLANK_PIPEA | INTERRUPT_VBLANK_PIPEB); - write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_ENABLED - : INTEL_INTERRUPT_ENABLED), - read16(info.registers + (isSNB ? PCH_DE_INTERRUPT_ENABLED - : INTEL_INTERRUPT_ENABLED)) | enable); - write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_MASK - : INTEL_INTERRUPT_MASK), ~enable); + write16(info, INTEL_INTERRUPT_ENABLED, + read16(info, INTEL_INTERRUPT_ENABLED) | enable); + write16(info, INTEL_INTERRUPT_MASK, ~enable); } } if (status < B_OK) { @@ -248,6 +243,40 @@ intel_extreme_init(intel_info &info) return info.registers_area; } + uint32 *blocks = info.shared_info->register_blocks; + blocks[REGISTER_BLOCK(REGS_FLAT)] = 0; + + // setup the register blocks for the different architectures + if (info.device_type.InGroup(INTEL_TYPE_SNB)) { + // PCH based platforms (IronLake and up) + blocks[REGISTER_BLOCK(REGS_INTERRUPT)] + = PCH_DE_INTERRUPT_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_NORTH_SHARED)] + = PCH_NORTH_SHARED_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_NORTH_PIPE_AND_PORT)] + = PCH_NORTH_PIPE_AND_PORT_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_NORTH_PLANE_CONTROL)] + = PCH_NORTH_PLANE_CONTROL_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_SOUTH_SHARED)] + = PCH_SOUTH_SHARED_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_SOUTH_TRANSCODER_PORT)] + = PCH_SOUTH_TRANSCODER_AND_PORT_REGISTER_BASE; + } else { + // (G)MCH/ICH based platforms + blocks[REGISTER_BLOCK(REGS_INTERRUPT)] + = MCH_INTERRUPT_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_NORTH_SHARED)] + = MCH_SHARED_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_NORTH_PIPE_AND_PORT)] + = MCH_PIPE_AND_PORT_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_NORTH_PLANE_CONTROL)] + = MCH_PLANE_CONTROL_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_SOUTH_SHARED)] + = ICH_SHARED_REGISTER_BASE; + blocks[REGISTER_BLOCK(REGS_SOUTH_TRANSCODER_PORT)] + = ICH_PORT_REGISTER_BASE; + } + // make sure bus master, memory-mapped I/O, and frame buffer is enabled set_pci_config(info.pci, PCI_command, 2, get_pci_config(info.pci, PCI_command, 2) | PCI_command_io | PCI_command_memory | PCI_command_master); @@ -269,27 +298,27 @@ intel_extreme_init(intel_info &info) // TODO: clean this up if (info.pci->device_id == 0x2a02 || info.pci->device_id == 0x2a12) { dprintf("i965GM/i965GME quirk\n"); - write32(info.registers + 0x6204, (1L << 29)); + write32(info, 0x6204, (1L << 29)); } else if (info.device_type.InGroup(INTEL_TYPE_SNB)) { dprintf("SNB clock gating\n"); - write32(info.registers + 0x42020, (1L << 28) | (1L << 7) | (1L << 5)); + write32(info, 0x42020, (1L << 28) | (1L << 7) | (1L << 5)); } else if (info.device_type.InGroup(INTEL_TYPE_G4x)) { dprintf("G4x clock gating\n"); - write32(info.registers + 0x6204, 0); - write32(info.registers + 0x6208, (1L << 9) | (1L << 7) | (1L << 6)); - write32(info.registers + 0x6210, 0); + write32(info, 0x6204, 0); + write32(info, 0x6208, (1L << 9) | (1L << 7) | (1L << 6)); + write32(info, 0x6210, 0); uint32 gateValue = (1L << 28) | (1L << 3) | (1L << 2); if ((info.device_type.type & INTEL_TYPE_MOBILE) == INTEL_TYPE_MOBILE) { dprintf("G4x mobile clock gating\n"); gateValue |= 1L << 18; } - write32(info.registers + 0x6200, gateValue); + write32(info, 0x6200, gateValue); } else { dprintf("i965 quirk\n"); - write32(info.registers + 0x6204, (1L << 29) | (1L << 23)); + write32(info, 0x6204, (1L << 29) | (1L << 23)); } - write32(info.registers + 0x7408, 0x10); + write32(info, 0x7408, 0x10); // no errors, so keep areas and mappings sharedCreator.Detach(); @@ -367,11 +396,8 @@ intel_extreme_uninit(intel_info &info) if (!info.fake_interrupts && info.shared_info->vblank_sem > 0) { // disable interrupt generation - bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); - write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_ENABLED - : INTEL_INTERRUPT_ENABLED), 0); - write16(info.registers + (isSNB ? PCH_DE_INTERRUPT_MASK - : INTEL_INTERRUPT_MASK), ~0); + write16(info, INTEL_INTERRUPT_ENABLED, 0); + write16(info, INTEL_INTERRUPT_MASK, ~0); remove_io_interrupt_handler(info.pci->u.h0.interrupt_line, intel_interrupt_handler, &info); diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h index a655ec0b60..906395d4de 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h @@ -24,7 +24,9 @@ struct intel_info { pci_info* pci; addr_t aperture_base; aperture_id aperture; + uint8* registers; + area_id registers_area; struct intel_shared_info* shared_info; area_id shared_area; From 5fd02779275f8a197a6988d961fb301674f0c6bf Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 15 Oct 2011 16:46:20 +0000 Subject: [PATCH 397/702] * add function to make pll flag adjustments * bug fix of improper unit conversion git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42858 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/pll.cpp | 54 +++++++++++++++++------ src/add-ons/accelerants/radeon_hd/pll.h | 3 +- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 1338d0a6a2..d77f2969d4 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -74,7 +74,7 @@ pll_limit_probe(pll_info *pll) pll->pllOutMax = B_LENDIAN_TO_HOST_INT32( - firmwareInfo->info.ulMaxPixelClockPLL_Output) * 10; + firmwareInfo->info.ulMaxPixelClockPLL_Output); if (tableMinor >= 4) { pll->lcdPllOutMin @@ -108,11 +108,10 @@ pll_limit_probe(pll_info *pll) pll->minFeedbackDiv = FB_DIV_MIN; pll->maxFeedbackDiv = FB_DIV_LIMIT; -// pll->pllInMin = B_LENDIAN_TO_HOST_INT16( -// firmware_info->info.usMinPixelClockPLL_Input) * 10; -// -// pll->pllInMax = B_LENDIAN_TO_HOST_INT16( -// firmware_info->info.usMaxPixelClockPLL_Input) * 10; + pll->pllInMin = B_LENDIAN_TO_HOST_INT16( + firmwareInfo->info.usMinPixelClockPLL_Input) * 10; + pll->pllInMax = B_LENDIAN_TO_HOST_INT16( + firmwareInfo->info.usMaxPixelClockPLL_Input) * 10; TRACE("%s: referenceFreq: %" B_PRIu16 "; pllOutMin: %" B_PRIu16 "; " " pllOutMax: %" B_PRIu16 "; pllInMin: %" B_PRIu16 ";" @@ -128,17 +127,17 @@ pll_compute_post_divider(pll_info *pll) { radeon_shared_info &info = *gInfo->shared_info; - // if RADEON_PLL_USE_POST_DIV - // return pll->post_div; + if ((pll->flags & PLL_USE_POST_DIV) != 0) + return; uint32 vco; if (info.device_chipset < (RADEON_R700 | 0x70)) { - if (0) // TODO : RADEON_PLL_IS_LCD + if ((pll->flags & PLL_IS_LCD) != 0) vco = pll->lcdPllOutMin; else vco = pll->pllOutMin; } else { - if (0) // TODO : RADEON_PLL_IS_LCD + if ((pll->flags & PLL_IS_LCD) != 0) vco = pll->lcdPllOutMax; else vco = pll->pllOutMin; @@ -271,11 +270,36 @@ union adjust_pixel_clock { }; +void +pll_setup_flags(pll_info *pll, uint8 crtcID) +{ + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; + uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; + + pll->flags |= PLL_PREFER_LOW_REF_DIV; + + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { + pll->flags |= PLL_IS_LCD; + + // TODO: Spread Spectrum PLL + // use reference divider for spread spectrum + if (0) { // SS enabled + if (0) { // if we have a SS reference divider + pll->flags |= PLL_USE_REF_DIV; + //pll->reference_div = ss->refdiv; + pll->flags |= PLL_USE_FRAC_FB_DIV; + } + } + } + + if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0) + pll->flags |= PLL_PREFER_CLOSEST_LOWER; +} + + status_t pll_adjust(pll_info *pll, uint8 crtcID) { - pll->flags |= PLL_PREFER_LOW_REF_DIV; - // TODO : PLL flags radeon_shared_info &info = *gInfo->shared_info; @@ -396,10 +420,12 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) pll->pixelClock = pixelClock; pll->id = pllID; + pll_setup_flags(pll, crtcID); + // set up any special flags pll_adjust(pll, crtcID); - // get any needed clock adjustments, set reference/post dividers, set flags + // get any needed clock adjustments, set reference/post dividers pll_compute(pll); - // compute dividers, set flags + // compute dividers int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); union set_pixel_clock args; diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index 11740eeb33..aebba18df1 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -84,9 +84,10 @@ struct pll_info { }; -status_t pll_limit_probe(pll_info *pll); status_t pll_adjust(pll_info *pll, uint8 crtcID); status_t pll_compute(pll_info *pll); +void pll_setup_flags(pll_info *pll, uint8 crtcID); +status_t pll_limit_probe(pll_info *pll); status_t pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID); From fd4f34da56d1274c23ceaebc142466c1f84d5583 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 16 Oct 2011 10:02:10 +0000 Subject: [PATCH 398/702] Remove extra parameter to function call in documentation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42859 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/drivers/usb_modules.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/drivers/usb_modules.dox b/docs/user/drivers/usb_modules.dox index 8ad4f32e76..714d104e55 100644 --- a/docs/user/drivers/usb_modules.dox +++ b/docs/user/drivers/usb_modules.dox @@ -316,7 +316,7 @@ init_driver(void) USB_REQTYPE_INTERFACE_IN | USB_REQTYPE_CLASS, USB_REQUEST_HID_GET_REPORT, 0x0100 | report_id, interfaceNumber, device->total_report_size, - device->buffer, device->total_report_size, &actual); + device->buffer, &actual); \endcode \warning Both the \link usb_module_info::send_request() \a send_request() From 7117b2ea258118c2cb0b41ac3c46a9de6ea293d6 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 16 Oct 2011 11:46:53 +0000 Subject: [PATCH 399/702] Add support for Silicon Labs CP210x to usb_serial. Not completely tested : my device has no control lines wired. RX/TX seems to work fine, at least. Inspiration from the Linux driver since there isn't any documentation avilable: http://lxr.free-electrons.com/source/drivers/usb/serial/cp210x.c The switch/case for VID/PID identification is getting quite long. Isn't there a better way to do it ? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42860 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/ports/usb_serial/Jamfile | 1 + .../drivers/ports/usb_serial/SerialDevice.cpp | 356 ++++++++++++++++++ .../drivers/ports/usb_serial/Silicon.cpp | 135 +++++++ .../kernel/drivers/ports/usb_serial/Silicon.h | 127 +++++++ 4 files changed, 619 insertions(+) create mode 100644 src/add-ons/kernel/drivers/ports/usb_serial/Silicon.cpp create mode 100644 src/add-ons/kernel/drivers/ports/usb_serial/Silicon.h diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile b/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile index 1240a5a24e..8a85cbd402 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile @@ -14,6 +14,7 @@ KernelAddon usb_serial : FTDI.cpp KLSI.cpp Prolific.cpp + Silicon.cpp ; AddResources usb_serial : usb_serial.rdef ; diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp index 23a5bcfc37..0d76a31550 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp @@ -14,6 +14,7 @@ #include "FTDI.h" #include "KLSI.h" #include "Prolific.h" +#include "Silicon.h" #include @@ -801,6 +802,361 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, return new(std::nothrow) KLSIDevice(device, vendorID, productID, description); } + + case VENDOR_RENESAS: + { + switch (productID) { + case 0x0053: + description = "Renesas RX610 RX-Stick"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_AKATOM: + { + switch (productID) { + case 0x066A: + description = "AKTAKOM ACE-1001"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_PIRELLI: + { + switch (productID) { + case 0xE000: + case 0xE003: + description = "Pirelli DP-L10 GSM Mobile"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_CYPHERLAB: + { + switch (productID) { + case 0x1000: + description = "Cipherlab CCD Barcode Scanner"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_GEMALTO: + { + switch (productID) { + case 0x5501: + description = "Gemalto contactless smartcard reader"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_DIGIANSWER: + { + switch (productID) { + case 0x000A: + description = "Digianswer ZigBee MAC device"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_MEI: + { + switch (productID) { + case 0x1100: + case 0x1101: + description = "MEI Acceptor"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_DYNASTREAM: + { + switch (productID) { + case 0x1003: + case 0x1004: + case 0x1006: + description = "Dynastream ANT development board"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_KNOCKOFF: + { + switch (productID) { + case 0xAA26: + description = "Knock-off DCU-11"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_SIEMENS: + { + switch (productID) { + case 0x10C5: + description = "Siemens MC60"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_NOKIA: + { + switch (productID) { + case 0xAC70: + description = "Nokia CA-42"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_SILICON: + { + switch (productID) { + case 0x0F91: + case 0x1101: + case 0x1601: + case 0x800A: + case 0x803B: + case 0x8044: + case 0x804E: + case 0x8053: + case 0x8054: + case 0x8066: + case 0x806F: + case 0x807A: + case 0x80CA: + case 0x80DD: + case 0x80F6: + case 0x8115: + case 0x813D: + case 0x813F: + case 0x814A: + case 0x814B: + case 0x8156: + case 0x815E: + case 0x818B: + case 0x819F: + case 0x81A6: + case 0x81AC: + case 0x81AD: + case 0x81C8: + case 0x81E2: + case 0x81E7: + case 0x81E8: + case 0x81F2: + case 0x8218: + case 0x822B: + case 0x826B: + case 0x8293: + case 0x82F9: + case 0x8341: + case 0x8382: + case 0x83A8: + case 0x83D8: + case 0x8411: + case 0x8418: + case 0x846E: + case 0x8477: + case 0x85EA: + case 0x85EB: + case 0x8664: + case 0x8665: + case 0xEA60: + case 0xEA61: + case 0xEA71: + case 0xF001: + case 0xF002: + case 0xF003: + case 0xF004: + description = "Silicon Labs CP210x USB UART converter"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_SILICON2: + { + switch (productID) { + case 0xEA61: + description = "Silicon Labs GPRS USB Modem"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_SILICON3: + { + switch (productID) { + case 0xEA6A: + description = "Silicon Labs GPRS USB Modem 100EU"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_BALTECH: + { + switch (productID) { + case 0x9999: + description = "Balteck card reader"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_OWEN: + { + switch (productID) { + case 0x0004: + description = "Owen AC4 USB-RS485 Converter"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_CLIPSAL: + { + switch (productID) { + case 0x0303: + description = "Clipsal 5500PCU C-Bus USB interface"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_JABLOTRON: + { + switch (productID) { + case 0x0001: + description = "Jablotron serial interface"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_WIENER: + { + switch (productID) { + case 0x0010: + case 0x0011: + case 0x0012: + case 0x0015: + description = "W-IE-NE-R Plein & Baus GmbH device"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_WAVESENSE: + { + switch (productID) { + case 0xAAAA: + description = "Wavesense Jazz blood glucose meter"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_VAISALA: + { + switch (productID) { + case 0x0200: + description = "Vaisala USB instrument"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_ELV: + { + switch (productID) { + case 0xE00F: + description = "ELV USB I²C interface"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_WAGO: + { + switch (productID) { + case 0x07A6: + description = "WAGO 750-923 USB Service"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + case VENDOR_DW700: + { + switch (productID) { + case 0x9500: + description = "DW700 GPS USB interface"; + break; + } + + if (description != NULL) + goto SILICON; + break; + } + +SILICON: + return new(std::nothrow) SiliconDevice(device, vendorID, productID, + description); } return new(std::nothrow) ACMDevice(device, vendorID, productID, diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.cpp new file mode 100644 index 0000000000..5f3a33e451 --- /dev/null +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.cpp @@ -0,0 +1,135 @@ +/* + * Copyright 2011, Adrien Destugues + * Distributed under the terms of the MIT License. + */ + + +#include "Silicon.h" + + +static const int kBaudrateGeneratorFrequency = 0x384000; + + +SiliconDevice::SiliconDevice(usb_device device, uint16 vendorID, uint16 productID, + const char *description) + : SerialDevice(device, vendorID, productID, description) +{ +} + + +// Called for each configuration of the device. Return B_OK if the given +// configuration sounds like it is the usb serial one. +status_t +SiliconDevice::AddDevice(const usb_configuration_info *config) +{ + status_t status = ENODEV; + if (config->interface_count > 0) { + int32 pipesSet = 0; + usb_interface_info *interface = config->interface[0].active; + for (size_t i = 0; i < interface->endpoint_count; i++) { + usb_endpoint_info *endpoint = &interface->endpoint[i]; + if (endpoint->descr->attributes == USB_ENDPOINT_ATTR_BULK) { + if (endpoint->descr->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) { + SetReadPipe(endpoint->handle); + if (++pipesSet >= 3) + break; + } else { + if (endpoint->descr->endpoint_address) { + SetControlPipe(endpoint->handle); + SetWritePipe(endpoint->handle); + pipesSet += 2; + if (pipesSet >= 3) + break; + } + } + } + } + + if (pipesSet >= 3) { + status = B_OK; + } + } + return status; +} + + +// Called on opening the device - Good time to enable the UART ? +status_t +SiliconDevice::ResetDevice() +{ + uint16_t enableUart = 1; + return WriteConfig(ENABLE_UART, &enableUart, 2); +} + + +status_t +SiliconDevice::SetLineCoding(usb_cdc_line_coding *lineCoding) +{ + uint16_t divider = kBaudrateGeneratorFrequency / lineCoding->speed ; + status_t result = WriteConfig(SET_BAUDRATE_DIVIDER, ÷r, 2); + + if (result != B_OK) return result; + + uint16_t data = 0; + + switch (lineCoding->stopbits) { + case USB_CDC_LINE_CODING_1_STOPBIT: data = 0; break; + case USB_CDC_LINE_CODING_2_STOPBITS: data = 2; break; + default: + TRACE_ALWAYS("= SiliconDevice::SetLineCoding(): Wrong stopbits param: %d\n", + lineCoding->stopbits); + break; + } + + switch (lineCoding->parity) { + case USB_CDC_LINE_CODING_NO_PARITY: data |= 0 << 4; break; + case USB_CDC_LINE_CODING_EVEN_PARITY: data |= 2 << 4; break; + case USB_CDC_LINE_CODING_ODD_PARITY: data |= 1 << 4; break; + default: + TRACE_ALWAYS("= SiliconDevice::SetLineCoding(): Wrong parity param: %d\n", + lineCoding->parity); + break; + } + + data |= lineCoding->databits << 8; + + return WriteConfig(SET_LINE_FORMAT, &data, 2); +} + + +status_t +SiliconDevice::SetControlLineState(uint16 state) +{ + uint16_t control = 0; + control |= 0x0300; // We are updating DTR and RTS + control |= (state & USB_CDC_CONTROL_SIGNAL_STATE_RTS) ? 2 : 0; + control |= (state & USB_CDC_CONTROL_SIGNAL_STATE_DTR) ? 1 : 0; + + return WriteConfig(SET_STATUS, &control, 2); +} + + +status_t SiliconDevice::WriteConfig(CP210XRequest request, uint16_t* data, + size_t size) +{ + size_t replyLength = 0; + status_t result; + // Small requests (16 bits and less) use the "value" field for their data. + // Bigger ones use the actual buffer. + if (size <= 2) { + result = gUSBModule->send_request(Device(), + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, request, data[0], 0, 0, + NULL, &replyLength); + } else { + result = gUSBModule->send_request(Device(), + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, request, 0x0000, 0, + size, data, &replyLength); + } + + if (result != B_OK) { + TRACE_ALWAYS("= SiliconDevice request failed: 0x%08x (%s)\n", + result, strerror(result)); + } + + return result; +} diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.h b/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.h new file mode 100644 index 0000000000..3c1897dac4 --- /dev/null +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.h @@ -0,0 +1,127 @@ +/* + * Copyright 2011, Adrien Destugues + * Distributed under the terms of the MIT License. + */ +#ifndef _USB_SILICON_H_ +#define _USB_SILICON_H_ + +#include "SerialDevice.h" + +class SiliconDevice : public SerialDevice { +public: + SiliconDevice(usb_device device, uint16 vendorID, + uint16 productID, const char *description); + +virtual status_t AddDevice(const usb_configuration_info *config); + +virtual status_t ResetDevice(); + +virtual status_t SetLineCoding(usb_cdc_line_coding *coding); +virtual status_t SetControlLineState(uint16 state); + +private: +enum CP210XRequest { + ENABLE_UART = 0, + /* 1 to enable the UART function, 0 to disable + * (some Silicon Labs chips have other functions such as GPIOs) */ + + + SET_BAUDRATE_DIVIDER = 1, + GET_BAUDRATE_DIVIDER = 2, + /* + Baudrate base clock is 3686400 + + 3686400 / 32 = 115200 + ... + 3686400 / 384 = 9600 + */ + + SET_LINE_FORMAT = 3, + GET_LINE_FORMAT = 4, + /* + DataBits << 0x100 | Parity << 0x10 | StopBits + + Databits in [5,9] + Parity : + 0 = none + 1 = odd + 2 = even + 3 = mark + 4 = space + Stop bits: + 0 = 1 stop bit + 1 = 1.5 stop bits + 2 = 2 stop bits + */ + + SET_BREAK = 5, + /* 1 to enable, 0 to disable */ + + IMMEDIATE_CHAR = 6, + + SET_STATUS = 7, + GET_STATUS = 8, + /* + bit 0 = DTR + bit 1 = RTS + + bit 4 = CTS + bit 5 = DSR + bit 6 = RING + bit 7 = DCD + bit 8 = WRITE_DTR (unset to not touch DTR) + bit 9 = WRITE_RTS (unset to not touch RTS) + */ + + SET_XON = 9, + SET_XOFF = 10, + SET_EVENTMASK = 11, + GET_EVENTMASK = 12, + SET_CHAR = 13, + GET_CHARS = 14, + GET_PROPS = 15, + GET_COMM_STATUS = 16, + RESET = 17, + PURGE = 18, + + SET_FLOW = 19, + GET_FLOW = 20, + /* Hardware flow control setup */ + + EMBED_EVENTS = 21, + GET_EVENTSTATE = 22, + SET_CHARS = 0x19 +}; + +private: +status_t WriteConfig(CP210XRequest request, uint16_t* data, + size_t size); +}; + +#define VENDOR_RENESAS 0x045B +#define VENDOR_AKATOM 0x0471 +#define VENDOR_PIRELLI 0x0489 +#define VENDOR_CYPHERLAB 0x0745 +#define VENDOR_GEMALTO 0x08E6 +#define VENDOR_DIGIANSWER 0x08FD +#define VENDOR_MEI 0x0BED +#define VENDOR_DYNASTREAM 0x0FCF +#define VENDOR_KNOCKOFF 0x10A6 +#define VENDOR_SIEMENS 0x10AB +#define VENDOR_NOKIA 0x10B5 +#define VENDOR_SILICON 0x10C4 +#define VENDOR_SILICON2 0x10C5 +#define VENDOR_SILICON3 0x10CE +#define VENDOR_BALTECH 0x13AD +#define VENDOR_OWEN 0x1555 +#define VENDOR_CLIPSAL 0x166A +#define VENDOR_JABLOTRON 0x16D6 +#define VENDOR_WIENER 0x16DC +#define VENDOR_WAVESENSE 0x17F4 +#define VENDOR_VAISALA 0x1843 +#define VENDOR_ELV 0x18EF +#define VENDOR_WAGO 0x1BE3 +#define VENDOR_DW700 0x413C + + +#endif //_USB_SILICON_H_ From f66a1a8d71e68f2c725fa556af7b9983a85e057e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 16 Oct 2011 14:12:03 +0000 Subject: [PATCH 400/702] * fix TODO style due to ML * rename bpc to bitsPerChannel * remove un-needed / unused PCI BAR reference * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42861 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/bios.cpp | 13 +++------ src/add-ons/accelerants/radeon_hd/display.cpp | 27 ++++++++++--------- src/add-ons/accelerants/radeon_hd/encoder.cpp | 24 ++++++++--------- src/add-ons/accelerants/radeon_hd/gpu.cpp | 8 +++--- src/add-ons/accelerants/radeon_hd/mode.cpp | 16 +++++------ src/add-ons/accelerants/radeon_hd/mode.h | 3 ++- src/add-ons/accelerants/radeon_hd/pll.cpp | 20 +++++++------- 7 files changed, 54 insertions(+), 57 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index c87427d7b1..c9ba622bd8 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -127,15 +127,10 @@ radeon_init_bios(uint8* bios) atom_card_info->reg_read = Read32Cail; atom_card_info->reg_write = Write32Cail; - if (false) { - // TODO : if rio_mem, use ioreg - //atom_card_info->ioreg_read = cail_ioreg_read; - //atom_card_info->ioreg_write = cail_ioreg_write; - } else { - TRACE("%s: Cannot find PCI I/O BAR; using MMIO\n", __func__); - atom_card_info->ioreg_read = Read32Cail; - atom_card_info->ioreg_write = Write32Cail; - } + // use MMIO instead of PCI I/O BAR + atom_card_info->ioreg_read = Read32Cail; + atom_card_info->ioreg_write = Write32Cail; + atom_card_info->mc_read = _read32; atom_card_info->mc_write = _write32; atom_card_info->pll_read = _read32; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index af436abf67..2fe20de60a 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -157,7 +157,7 @@ init_registers(register_info* regs, uint8 crtid) } // Populate common registers - // TODO : Wait.. this doesn't work with Eyefinity > crt 1. + // TODO: Wait.. this doesn't work with Eyefinity > crt 1. regs->modeCenter = crtid == 1 ? D2MODE_CENTER : D1MODE_CENTER; @@ -287,7 +287,7 @@ detect_connectors_legacy() // uint8 dac = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC; // gConnector[i]->line_mux = ci.sucI2cId.ucAccess; - // TODO : give tv unique connector ids + // TODO: give tv unique connector ids // Always set CRT1 and CRT2 as VGA, some cards incorrectly set // VGA ports as DVI @@ -297,7 +297,7 @@ detect_connectors_legacy() gConnector[i]->valid = true; gConnector[i]->encoder.flags = (1 << i); - // TODO : add the encoder + // TODO: add the encoder #if 0 radeon_add_atom_encoder(dev, radeon_get_encoder_enum(dev, @@ -308,9 +308,9 @@ detect_connectors_legacy() #endif } - // TODO : combine shared connectors + // TODO: combine shared connectors - // TODO : add connectors + // TODO: add connectors for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE_INFO; i++) { if (gConnector[i]->valid == true) { @@ -408,7 +408,7 @@ detect_connectors() uint16 igp_lane_info; if (0) - ERROR("%s: TODO : IGP chip connector detection\n", __func__); + ERROR("%s: TODO: IGP chip connector detection\n", __func__); else { igp_lane_info = 0; connectorType = connector_convert[con_obj_id]; @@ -436,7 +436,7 @@ detect_connectors() if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { // Found an encoder - // TODO : it may be possible to have more then one encoder + // TODO: it may be possible to have more then one encoder int32 k; for (k = 0; k < enc_obj->ucNumberOfObjects; k++) { uint16 encoder_obj @@ -594,7 +594,7 @@ detect_connectors() i2c_config->ucAccess); break; case ATOM_HPD_INT_RECORD_TYPE: - // TODO : HPD (Hot Plug) + // TODO: HPD (Hot Plug) break; } @@ -606,7 +606,7 @@ detect_connectors() } } - // TODO : aux chan transactions + // TODO: aux chan transactions // record connector information TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 ")\n", @@ -758,7 +758,7 @@ display_get_encoder_mode(uint32 connectorIndex) switch (gConnector[connectorIndex]->type) { case VIDEO_CONNECTOR_DVII: case VIDEO_CONNECTOR_HDMIB: /* HDMI-B is DL-DVI; analog works fine */ - // TODO : if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI + // TODO: if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI // if (gConnector[connectorIndex]->use_digital) // return ATOM_ENCODER_MODE_DVI; @@ -768,18 +768,19 @@ display_get_encoder_mode(uint32 connectorIndex) case VIDEO_CONNECTOR_DVID: case VIDEO_CONNECTOR_HDMIA: default: - // TODO : if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI + // TODO: if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI return ATOM_ENCODER_MODE_DVI; case VIDEO_CONNECTOR_LVDS: return ATOM_ENCODER_MODE_LVDS; case VIDEO_CONNECTOR_DP: // dig_connector = radeon_connector->con_priv; - // if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) + // if ((dig_connector->dp_sink_type + // == CONNECTOR_OBJECT_ID_DISPLAYPORT) // || (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { // return ATOM_ENCODER_MODE_DP; // } - // TODO : if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI + // TODO: if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI return ATOM_ENCODER_MODE_DVI; case VIDEO_CONNECTOR_EDP: diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index fb8dd10004..4547209dbb 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -262,12 +262,12 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) case 1: args.v1.ucMisc = 0; args.v1.ucAction = command; - if (0) // TODO : HDMI? + if (0) // TODO: HDMI? args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { - // TODO : laptop display support + // TODO: laptop display support //if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) // args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; //if (dig->lcd_misc & ATOM_PANEL_MISC_888RGB) @@ -289,7 +289,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) //if (dig->coherent_mode) // args.v2.ucMisc |= PANEL_ENCODER_MISC_COHERENT; } - if (0) // TODO : HDMI? + if (0) // TODO: HDMI? args.v2.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; args.v2.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); args.v2.ucTruncate = 0; @@ -297,7 +297,7 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) args.v2.ucTemporal = 0; args.v2.ucFRC = 0; if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { - // TODO : laptop display support + // TODO: laptop display support //if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) // args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; //if (dig->lcd_misc & ATOM_PANEL_MISC_SPATIAL) { @@ -364,8 +364,8 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command) args.ucAction = command; args.ucDacStandard = ATOM_DAC1_PS2; - // TODO : or ATOM_DAC1_CV if ATOM_DEVICE_CV_SUPPORT - // TODO : or ATOM_DAC1_PAL or ATOM_DAC1_NTSC if else + // TODO: or ATOM_DAC1_CV if ATOM_DEVICE_CV_SUPPORT + // TODO: or ATOM_DAC1_PAL or ATOM_DAC1_NTSC if else args.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); @@ -474,7 +474,7 @@ encoder_crtc_scratch(uint8 crtcID) uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; - // TODO : r500 + // TODO: r500 uint32 biosScratch3 = Read32(OUT, R600_BIOS_3_SCRATCH); if ((encoderFlags & ATOM_DEVICE_TV1_SUPPORT) != 0) { @@ -510,7 +510,7 @@ encoder_crtc_scratch(uint8 crtcID) biosScratch3 |= (crtcID << 25); } - // TODO : r500 + // TODO: r500 Write32(OUT, R600_BIOS_3_SCRATCH, biosScratch3); } @@ -523,7 +523,7 @@ encoder_dpms_scratch(uint8 crtcID, bool power) uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; - // TODO : r500 + // TODO: r500 uint32 biosScratch2 = Read32(OUT, R600_BIOS_2_SCRATCH); if ((encoderFlags & ATOM_DEVICE_TV1_SUPPORT) != 0) { @@ -617,7 +617,7 @@ encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode) index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); break; case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: - // TODO : encoder dpms set newer cards + // TODO: encoder dpms set newer cards // If DCE5, dvo true // If DCE3, dig true // else... @@ -634,7 +634,7 @@ encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode) break; case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: - // TODO : encoder dpms dce5 dac + // TODO: encoder dpms dce5 dac // else... /* if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) @@ -647,7 +647,7 @@ encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode) break; case ENCODER_OBJECT_ID_INTERNAL_DAC2: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: - // TODO : tv or CV encoder on DAC2 + // TODO: tv or CV encoder on DAC2 index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); break; } diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 2dab9eb653..4404e75cfc 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -189,7 +189,7 @@ radeon_gpu_mc_halt() void radeon_gpu_mc_resume() { - // TODO : do surface addresses disappear on mc halt? + // TODO: do surface addresses disappear on mc halt? //Write32(OUT, D1GRPH_PRIMARY_SURFACE_ADDRESS, rdev->mc.vram_start); //Write32(OUT, D1GRPH_SECONDARY_SURFACE_ADDRESS, rdev->mc.vram_start); //Write32(OUT, D2GRPH_PRIMARY_SURFACE_ADDRESS, rdev->mc.vram_start); @@ -263,7 +263,7 @@ radeon_gpu_mc_setup() status_t radeon_gpu_irq_setup() { - // TODO : Stub for IRQ setup + // TODO: Stub for IRQ setup // allocate rings via r600_ih_ring_alloc @@ -446,8 +446,8 @@ radeon_gpu_gpio_setup() for (uint32 i = 0; i < numIndices; i++) { ATOM_GPIO_I2C_ASSIGMENT *gpio = &i2c_info->asGPIO_Info[i]; - // TODO : if DCE 4 and i == 7 ... manual override for evergreen - // TODO : if DCE 3 and i == 4 ... manual override + // TODO: if DCE 4 and i == 7 ... manual override for evergreen + // TODO: if DCE 3 and i == 4 ... manual override // populate gpio information gGPIOInfo[i]->hw_line diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 73e0b2fbea..1061ba950f 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -38,7 +38,7 @@ extern "C" void _sPrintf(const char *format, ...); status_t create_mode_list(void) { - // TODO : multi-monitor? for now we use VESA and not gDisplay edid + // TODO: multi-monitor? for now we use VESA and not gDisplay edid const color_space kRadeonHDSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE, B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8}; @@ -82,7 +82,7 @@ radeon_get_mode_list(display_mode *modeList) status_t radeon_get_edid_info(void* info, size_t size, uint32* edid_version) { - // TODO : multi-monitor? for now we use VESA and not gDisplay edid + // TODO: multi-monitor? for now we use VESA and not gDisplay edid TRACE("%s\n", __func__); if (!gInfo->shared_info->has_edid) @@ -108,7 +108,7 @@ radeon_dpms_capabilities(void) uint32 radeon_dpms_mode(void) { - // TODO : this really isn't a good long-term solution + // TODO: this really isn't a good long-term solution // we may need to look at the encoder dpms scratch registers return gInfo->dpms_mode; } @@ -152,7 +152,7 @@ radeon_dpms_set(int mode) status_t radeon_set_display_mode(display_mode *mode) { - // TODO : multi-monitor? for now we use VESA and not gDisplay edid + // TODO: multi-monitor? for now we use VESA and not gDisplay edid // Set mode on each display for (uint8 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id]->active == false) @@ -173,12 +173,12 @@ radeon_set_display_mode(display_mode *mode) display_crtc_power(id, ATOM_DISABLE); // *** CRT controler mode set - // TODO : program SS + // TODO: program SS pll_set(ATOM_PPLL1, mode->timing.pixel_clock, id); - // TODO : check if ATOM_PPLL1 is used and use ATOM_PPLL2 if so + // TODO: check if ATOM_PPLL1 is used and use ATOM_PPLL2 if so display_crtc_set_dtd(id, mode); - // TODO : vvvv : atombios_crtc_set_base + // TODO: vvvv : atombios_crtc_set_base display_crtc_fb_set_dce1(id, mode); // atombios_overscan_setup display_crtc_scale(id, mode); @@ -280,7 +280,7 @@ is_mode_supported(display_mode *mode) if (is_mode_sane(mode) != B_OK) return false; - // TODO : is_mode_supported on *which* display? + // TODO: is_mode_supported on *which* display? uint32 crtid = 0; // if we have edid info, check frequency adginst crt reported valid ranges diff --git a/src/add-ons/accelerants/radeon_hd/mode.h b/src/add-ons/accelerants/radeon_hd/mode.h index 2a479d3808..d4ed405d67 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.h +++ b/src/add-ons/accelerants/radeon_hd/mode.h @@ -15,6 +15,7 @@ #include "gpu.h" + #define T_POSITIVE_SYNC (B_POSITIVE_HSYNC | B_POSITIVE_VSYNC) #define D1_REG_OFFSET 0x0000 @@ -23,7 +24,7 @@ #define FMT2_REG_OFFSET 0x800 #define OVERSCAN 0 - // TODO : Overscan and scaling support + // TODO: Overscan and scaling support status_t create_mode_list(void); diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index d77f2969d4..502780769e 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -300,7 +300,7 @@ pll_setup_flags(pll_info *pll, uint8 crtcID) status_t pll_adjust(pll_info *pll, uint8 crtcID) { - // TODO : PLL flags + // TODO: PLL flags radeon_shared_info &info = *gInfo->shared_info; uint32 pixelClock = pll->pixelClock; @@ -333,7 +333,7 @@ pll_adjust(pll_info *pll, uint8 crtcID) = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); args.v1.ucTransmitterID = encoderID; args.v1.ucEncodeMode = encoderMode; - // TODO : SS and SS % > 0 + // TODO: SS and SS % > 0 if (0) { args.v1.ucConfig |= ADJUST_DISPLAY_CONFIG_SS_ENABLE; @@ -351,15 +351,15 @@ pll_adjust(pll_info *pll, uint8 crtcID) args.v3.sInput.ucTransmitterID = encoderID; args.v3.sInput.ucEncodeMode = encoderMode; args.v3.sInput.ucDispPllConfig = 0; - // TODO : SS and SS % > 0 + // TODO: SS and SS % > 0 if (0) { args.v3.sInput.ucDispPllConfig |= DISPPLL_CONFIG_SS_ENABLE; } - // TODO : if ATOM_DEVICE_DFP_SUPPORT - // TODO : display port DP + // TODO: if ATOM_DEVICE_DFP_SUPPORT + // TODO: display port DP - // TODO : is DP? + // TODO: is DP? args.v3.sInput.ucExtTransmitterID = 0; atom_execute_table(gAtomContext, index, (uint32*)&args); @@ -436,8 +436,8 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) atom_parse_cmd_header(gAtomContext, index, &tableMajor, &tableMinor); - uint32 bpc = 8; - // TODO : BPC == Digital Depth, EDID 1.4+ on digital displays + uint32 bitsPerChannel = 8; + // TODO: Digital Depth, EDID 1.4+ on digital displays // isn't in Haiku edid common code? switch (tableMinor) { @@ -490,7 +490,7 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) args.v5.ucMiscInfo = 0; /* HDMI depth, etc. */ // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_REF_DIV_SRC; - switch (bpc) { + switch (bitsPerChannel) { case 8: default: args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_HDMI_24BPP; @@ -516,7 +516,7 @@ pll_set(uint8 pllID, uint32 pixelClock, uint8 crtcID) args.v6.ucMiscInfo = 0; /* HDMI depth, etc. */ // if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK)) // args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_REF_DIV_SRC; - switch (bpc) { + switch (bitsPerChannel) { case 8: default: args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_24BPP; From 2d004e3e89b98b25cdd710f0f92a33f5cee7a10d Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 16 Oct 2011 14:38:44 +0000 Subject: [PATCH 401/702] Fix register definition for image size registers. They are in the north pipe control block. Doesn't matter on (G)MCH (they are the same register block tehre) but fixes mode setting on PCH again. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42862 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/intel_extreme/intel_extreme.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index 2d90d88f18..a5e8f86bf0 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -396,14 +396,15 @@ struct intel_free_graphics_memory { #define INTEL_DISPLAY_A_VTOTAL (0x000c | REGS_SOUTH_TRANSCODER_PORT) #define INTEL_DISPLAY_A_VBLANK (0x0010 | REGS_SOUTH_TRANSCODER_PORT) #define INTEL_DISPLAY_A_VSYNC (0x0014 | REGS_SOUTH_TRANSCODER_PORT) -#define INTEL_DISPLAY_A_IMAGE_SIZE (0x001c | REGS_SOUTH_TRANSCODER_PORT) #define INTEL_DISPLAY_B_HTOTAL (0x1000 | REGS_SOUTH_TRANSCODER_PORT) #define INTEL_DISPLAY_B_HBLANK (0x1004 | REGS_SOUTH_TRANSCODER_PORT) #define INTEL_DISPLAY_B_HSYNC (0x1008 | REGS_SOUTH_TRANSCODER_PORT) #define INTEL_DISPLAY_B_VTOTAL (0x100c | REGS_SOUTH_TRANSCODER_PORT) #define INTEL_DISPLAY_B_VBLANK (0x1010 | REGS_SOUTH_TRANSCODER_PORT) #define INTEL_DISPLAY_B_VSYNC (0x1014 | REGS_SOUTH_TRANSCODER_PORT) -#define INTEL_DISPLAY_B_IMAGE_SIZE (0x101c | REGS_SOUTH_TRANSCODER_PORT) + +#define INTEL_DISPLAY_A_IMAGE_SIZE (0x001c | REGS_NORTH_PIPE_AND_PORT) +#define INTEL_DISPLAY_B_IMAGE_SIZE (0x101c | REGS_NORTH_PIPE_AND_PORT) #define INTEL_DISPLAY_B_DIGITAL_PORT (0x1140 | REGS_SOUTH_TRANSCODER_PORT) From c788baed28e28960c17306fe9f5b40382b07cb1d Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 16 Oct 2011 15:15:03 +0000 Subject: [PATCH 402/702] Style cleanups only, no functional change. * Make the pointer style consistent accross all components, which should make it easier when working all over the place. * 80 char limits. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42863 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 3 +- .../accelerants/intel_extreme/accelerant.cpp | 28 +++--- .../accelerants/intel_extreme/accelerant.h | 18 ++-- .../intel_extreme/accelerant_protos.h | 75 ++++++++-------- .../accelerants/intel_extreme/commands.h | 2 +- .../accelerants/intel_extreme/cursor.cpp | 16 ++-- .../accelerants/intel_extreme/dpms.cpp | 60 ++++++++----- .../accelerants/intel_extreme/engine.cpp | 24 +++--- .../accelerants/intel_extreme/hooks.cpp | 4 +- .../accelerants/intel_extreme/memory.cpp | 2 +- .../accelerants/intel_extreme/mode.cpp | 74 +++++++++------- .../accelerants/intel_extreme/overlay.cpp | 85 ++++++++++--------- .../kernel/busses/agp_gart/intel_gart.cpp | 61 ++++++------- .../drivers/graphics/intel_extreme/device.cpp | 53 ++++++------ .../drivers/graphics/intel_extreme/driver.cpp | 10 +-- .../drivers/graphics/intel_extreme/driver.h | 8 +- .../graphics/intel_extreme/intel_extreme.cpp | 40 ++++----- 17 files changed, 314 insertions(+), 249 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index a5e8f86bf0..d4828d13ab 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -227,7 +227,8 @@ struct intel_free_graphics_memory { // Register definitions, taken from X driver // PCI bridge memory management -#define INTEL_GRAPHICS_MEMORY_CONTROL 0x52 // GGC - (G)MCH Graphics Control Register +#define INTEL_GRAPHICS_MEMORY_CONTROL 0x52 + // GGC - (G)MCH Graphics Control Register #define MEMORY_CONTROL_ENABLED 0x0004 #define MEMORY_MASK 0x0001 #define STOLEN_MEMORY_MASK 0x00f0 diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.cpp b/src/add-ons/accelerants/intel_extreme/accelerant.cpp index 3d9b0023cf..465f9b6fde 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant.cpp +++ b/src/add-ons/accelerants/intel_extreme/accelerant.cpp @@ -23,14 +23,14 @@ #define TRACE_ACCELERANT #ifdef TRACE_ACCELERANT -extern "C" void _sPrintf(const char *format, ...); +extern "C" void _sPrintf(const char* format, ...); # define TRACE(x) _sPrintf x #else # define TRACE(x) ; #endif -struct accelerant_info *gInfo; +struct accelerant_info* gInfo; class AreaCloner { @@ -38,7 +38,7 @@ public: AreaCloner(); ~AreaCloner(); - area_id Clone(const char *name, void **_address, + area_id Clone(const char* name, void** _address, uint32 spec, uint32 protection, area_id sourceArea); status_t InitCheck() @@ -65,7 +65,7 @@ AreaCloner::~AreaCloner() area_id -AreaCloner::Clone(const char *name, void **_address, uint32 spec, +AreaCloner::Clone(const char* name, void** _address, uint32 spec, uint32 protection, area_id sourceArea) { fArea = clone_area(name, _address, spec, protection, sourceArea); @@ -91,7 +91,7 @@ init_common(int device, bool isClone) { // initialize global accelerant info structure - gInfo = (accelerant_info *)malloc(sizeof(accelerant_info)); + gInfo = (accelerant_info*)malloc(sizeof(accelerant_info)); if (gInfo == NULL) return B_NO_MEMORY; @@ -113,7 +113,7 @@ init_common(int device, bool isClone) AreaCloner sharedCloner; gInfo->shared_info_area = sharedCloner.Clone("intel extreme shared info", - (void **)&gInfo->shared_info, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, + (void**)&gInfo->shared_info, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, data.shared_info_area); status_t status = sharedCloner.InitCheck(); if (status < B_OK) { @@ -123,7 +123,7 @@ init_common(int device, bool isClone) AreaCloner regsCloner; gInfo->regs_area = regsCloner.Clone("intel extreme regs", - (void **)&gInfo->registers, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, + (void**)&gInfo->registers, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, gInfo->shared_info->registers_area); status = regsCloner.InitCheck(); if (status < B_OK) { @@ -137,7 +137,7 @@ init_common(int device, bool isClone) // The overlay registers, hardware status, and cursor memory share // a single area with the shared_info - gInfo->overlay_registers = (struct overlay_registers *) + gInfo->overlay_registers = (struct overlay_registers*) (gInfo->shared_info->graphics_memory + gInfo->shared_info->overlay_offset); @@ -242,7 +242,7 @@ intel_accelerant_clone_info_size(void) void -intel_get_accelerant_clone_info(void *info) +intel_get_accelerant_clone_info(void* info) { TRACE(("intel_get_accelerant_clone_info()\n")); ioctl(gInfo->device, INTEL_GET_DEVICE_NAME, info, B_PATH_NAME_LENGTH); @@ -250,7 +250,7 @@ intel_get_accelerant_clone_info(void *info) status_t -intel_clone_accelerant(void *info) +intel_clone_accelerant(void* info) { TRACE(("intel_clone_accelerant()\n")); @@ -258,9 +258,9 @@ intel_clone_accelerant(void *info) char path[B_PATH_NAME_LENGTH]; strcpy(path, "/dev/"); #ifdef __HAIKU__ - strlcat(path, (const char *)info, sizeof(path)); + strlcat(path, (const char*)info, sizeof(path)); #else - strcat(path, (const char *)info); + strcat(path, (const char*)info); #endif int fd = open(path, B_READ_WRITE); @@ -273,7 +273,7 @@ intel_clone_accelerant(void *info) // get read-only clone of supported display modes status = gInfo->mode_list_area = clone_area( - "intel extreme cloned modes", (void **)&gInfo->mode_list, + "intel extreme cloned modes", (void**)&gInfo->mode_list, B_ANY_ADDRESS, B_READ_AREA, gInfo->shared_info->mode_list_area); if (status < B_OK) goto err2; @@ -312,7 +312,7 @@ intel_uninit_accelerant(void) status_t -intel_get_accelerant_device_info(accelerant_device_info *info) +intel_get_accelerant_device_info(accelerant_device_info* info) { TRACE(("intel_get_accelerant_device_info()\n")); diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.h b/src/add-ons/accelerants/intel_extreme/accelerant.h index a0216a9115..1f8aa4523c 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant.h +++ b/src/add-ons/accelerants/intel_extreme/accelerant.h @@ -31,17 +31,17 @@ struct overlay_frame { }; struct accelerant_info { - uint8 *registers; + uint8* registers; area_id regs_area; - intel_shared_info *shared_info; + intel_shared_info* shared_info; area_id shared_info_area; - display_mode *mode_list; // cloned list of standard display modes + display_mode* mode_list; // cloned list of standard display modes area_id mode_list_area; - struct overlay_registers *overlay_registers; - overlay *current_overlay; + struct overlay_registers* overlay_registers; + overlay* current_overlay; overlay_view last_overlay_view; overlay_frame last_overlay_frame; uint32 last_horizontal_overlay_scale; @@ -69,14 +69,14 @@ struct accelerant_info { #define HEAD_MODE_CLONE 0x03 #define HEAD_MODE_LVDS_PANEL 0x08 -extern accelerant_info *gInfo; +extern accelerant_info* gInfo; // register access inline uint32 read32(uint32 encodedRegister) { - return *(volatile uint32 *)(gInfo->registers + return *(volatile uint32*)(gInfo->registers + gInfo->shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + REGISTER_REGISTER(encodedRegister)); } @@ -84,7 +84,7 @@ read32(uint32 encodedRegister) inline void write32(uint32 encodedRegister, uint32 value) { - *(volatile uint32 *)(gInfo->registers + *(volatile uint32*)(gInfo->registers + gInfo->shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + REGISTER_REGISTER(encodedRegister)) = value; } @@ -96,7 +96,7 @@ extern void set_display_power_mode(uint32 mode); // engine.cpp extern void uninit_ring_buffer(ring_buffer &ringBuffer); -extern void setup_ring_buffer(ring_buffer &ringBuffer, const char *name); +extern void setup_ring_buffer(ring_buffer &ringBuffer, const char* name); // modes.cpp extern void wait_for_vblank(void); diff --git a/src/add-ons/accelerants/intel_extreme/accelerant_protos.h b/src/add-ons/accelerants/intel_extreme/accelerant_protos.h index 2768ee6483..fc7031d77d 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant_protos.h +++ b/src/add-ons/accelerants/intel_extreme/accelerant_protos.h @@ -22,25 +22,27 @@ void spin(bigtime_t delay); // general status_t intel_init_accelerant(int fd); ssize_t intel_accelerant_clone_info_size(void); -void intel_get_accelerant_clone_info(void *data); -status_t intel_clone_accelerant(void *data); +void intel_get_accelerant_clone_info(void* data); +status_t intel_clone_accelerant(void* data); void intel_uninit_accelerant(void); -status_t intel_get_accelerant_device_info(accelerant_device_info *info); +status_t intel_get_accelerant_device_info(accelerant_device_info* info); sem_id intel_accelerant_retrace_semaphore(void); // modes & constraints uint32 intel_accelerant_mode_count(void); -status_t intel_get_mode_list(display_mode *dm); -status_t intel_propose_display_mode(display_mode *target, const display_mode *low, - const display_mode *high); -status_t intel_set_display_mode(display_mode *mode); -status_t intel_get_display_mode(display_mode *currentMode); +status_t intel_get_mode_list(display_mode* dm); +status_t intel_propose_display_mode(display_mode* target, + const display_mode* low, const display_mode* high); +status_t intel_set_display_mode(display_mode* mode); +status_t intel_get_display_mode(display_mode* currentMode); status_t intel_get_edid_info(void* info, size_t size, uint32* _version); -status_t intel_get_frame_buffer_config(frame_buffer_config *config); -status_t intel_get_pixel_clock_limits(display_mode *mode, uint32 *low, uint32 *high); +status_t intel_get_frame_buffer_config(frame_buffer_config* config); +status_t intel_get_pixel_clock_limits(display_mode* mode, uint32* low, + uint32* high); status_t intel_move_display(uint16 hDisplayStart, uint16 vDisplayStart); -status_t intel_get_timing_constraints(display_timing_constraints *constraints); -void intel_set_indexed_colors(uint count, uint8 first, uint8 *colorData, uint32 flags); +status_t intel_get_timing_constraints(display_timing_constraints* constraints); +void intel_set_indexed_colors(uint count, uint8 first, uint8* colorData, + uint32 flags); // DPMS uint32 intel_dpms_capabilities(void); @@ -48,42 +50,47 @@ uint32 intel_dpms_mode(void); status_t intel_set_dpms_mode(uint32 flags); // cursor -status_t intel_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, - uint8 *andMask, uint8 *xorMask); +status_t intel_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, + uint16 hotY, uint8* andMask, uint8* xorMask); void intel_move_cursor(uint16 x, uint16 y); void intel_show_cursor(bool isVisible); // accelerant engine uint32 intel_accelerant_engine_count(void); status_t intel_acquire_engine(uint32 capabilities, uint32 maxWait, - sync_token *syncToken, engine_token **_engineToken); -status_t intel_release_engine(engine_token *engineToken, sync_token *syncToken); + sync_token* syncToken, engine_token** _engineToken); +status_t intel_release_engine(engine_token* engineToken, sync_token* syncToken); void intel_wait_engine_idle(void); -status_t intel_get_sync_token(engine_token *engineToken, sync_token *syncToken); -status_t intel_sync_to_token(sync_token *syncToken); +status_t intel_get_sync_token(engine_token* engineToken, sync_token* syncToken); +status_t intel_sync_to_token(sync_token* syncToken); // 2D acceleration -void intel_screen_to_screen_blit(engine_token *engineToken, blit_params *list, uint32 count); -void intel_fill_rectangle(engine_token *engineToken, uint32 color, fill_rect_params *list, - uint32 count); -void intel_invert_rectangle(engine_token *engineToken, fill_rect_params *list, uint32 count); -void intel_fill_span(engine_token *engineToken, uint32 color, uint16 *list, uint32 count); +void intel_screen_to_screen_blit(engine_token* engineToken, + blit_params* list, uint32 count); +void intel_fill_rectangle(engine_token* engineToken, uint32 color, + fill_rect_params* list, uint32 count); +void intel_invert_rectangle(engine_token* engineToken, fill_rect_params* list, + uint32 count); +void intel_fill_span(engine_token* engineToken, uint32 color, uint16* list, + uint32 count); // overlay -uint32 intel_overlay_count(const display_mode *mode); -const uint32 *intel_overlay_supported_spaces(const display_mode *mode); +uint32 intel_overlay_count(const display_mode* mode); +const uint32* intel_overlay_supported_spaces(const display_mode* mode); uint32 intel_overlay_supported_features(uint32 colorSpace); -const overlay_buffer *intel_allocate_overlay_buffer(color_space space, uint16 width, - uint16 height); -status_t intel_release_overlay_buffer(const overlay_buffer *buffer); -status_t intel_get_overlay_constraints(const display_mode *mode, const overlay_buffer *buffer, - overlay_constraints *constraints); +const overlay_buffer* intel_allocate_overlay_buffer(color_space space, + uint16 width, uint16 height); +status_t intel_release_overlay_buffer(const overlay_buffer* buffer); +status_t intel_get_overlay_constraints(const display_mode* mode, + const overlay_buffer* buffer, overlay_constraints* constraints); overlay_token intel_allocate_overlay(void); status_t intel_release_overlay(overlay_token overlayToken); -status_t intel_configure_overlay(overlay_token overlayToken, const overlay_buffer *buffer, - const overlay_window *window, const overlay_view *view); -status_t i965_configure_overlay(overlay_token overlayToken, const overlay_buffer *buffer, - const overlay_window *window, const overlay_view *view); +status_t intel_configure_overlay(overlay_token overlayToken, + const overlay_buffer* buffer, const overlay_window* window, + const overlay_view* view); +status_t i965_configure_overlay(overlay_token overlayToken, + const overlay_buffer* buffer, const overlay_window* window, + const overlay_view* view); #ifdef __cplusplus } diff --git a/src/add-ons/accelerants/intel_extreme/commands.h b/src/add-ons/accelerants/intel_extreme/commands.h index f0b04f15a1..094c5e21ab 100644 --- a/src/add-ons/accelerants/intel_extreme/commands.h +++ b/src/add-ons/accelerants/intel_extreme/commands.h @@ -15,7 +15,7 @@ struct command { uint32 opcode; - uint32 *Data() { return &opcode; } + uint32* Data() { return &opcode; } }; class QueueCommands { diff --git a/src/add-ons/accelerants/intel_extreme/cursor.cpp b/src/add-ons/accelerants/intel_extreme/cursor.cpp index 793c96d191..5ab49b0f29 100644 --- a/src/add-ons/accelerants/intel_extreme/cursor.cpp +++ b/src/add-ons/accelerants/intel_extreme/cursor.cpp @@ -15,7 +15,7 @@ status_t intel_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, - uint8 *andMask, uint8 *xorMask) + uint8* andMask, uint8* xorMask) { if (width > 64 || height > 64) return B_BAD_VALUE; @@ -23,7 +23,8 @@ intel_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, write32(INTEL_CURSOR_CONTROL, 0); // disable cursor - // In two-color mode, the data is ordered as follows (always 64 bit per line): + // In two-color mode, the data is ordered as follows (always 64 bit per + // line): // plane 1: line 0 (AND mask) // plane 0: line 0 (XOR mask) // plane 1: line 1 (AND mask) @@ -33,7 +34,7 @@ intel_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, // transparent, for 0x3 it inverts the background, so only the first // two palette entries will be used (since we're using the 2 color mode). - uint8 *data = gInfo->shared_info->cursor_memory; + uint8* data = gInfo->shared_info->cursor_memory; uint8 byteWidth = (width + 7) / 8; for (int32 y = 0; y < height; y++) { @@ -49,10 +50,12 @@ intel_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, gInfo->shared_info->cursor_format = CURSOR_FORMAT_2_COLORS; - write32(INTEL_CURSOR_CONTROL, CURSOR_ENABLED | gInfo->shared_info->cursor_format); + write32(INTEL_CURSOR_CONTROL, + CURSOR_ENABLED | gInfo->shared_info->cursor_format); write32(INTEL_CURSOR_SIZE, height << 12 | width); - write32(INTEL_CURSOR_BASE, (uint32)gInfo->shared_info->physical_graphics_memory + write32(INTEL_CURSOR_BASE, + (uint32)gInfo->shared_info->physical_graphics_memory + gInfo->shared_info->cursor_buffer_offset); // changing the hot point changes the cursor position, too @@ -104,7 +107,8 @@ intel_show_cursor(bool isVisible) write32(INTEL_CURSOR_CONTROL, (isVisible ? CURSOR_ENABLED : 0) | gInfo->shared_info->cursor_format); - write32(INTEL_CURSOR_BASE, (uint32)gInfo->shared_info->physical_graphics_memory + write32(INTEL_CURSOR_BASE, + (uint32)gInfo->shared_info->physical_graphics_memory + gInfo->shared_info->cursor_buffer_offset); gInfo->shared_info->cursor_visible = isVisible; diff --git a/src/add-ons/accelerants/intel_extreme/dpms.cpp b/src/add-ons/accelerants/intel_extreme/dpms.cpp index 4a4a3beea2..bbd2ec37bd 100644 --- a/src/add-ons/accelerants/intel_extreme/dpms.cpp +++ b/src/add-ons/accelerants/intel_extreme/dpms.cpp @@ -13,7 +13,7 @@ //#define TRACE_DPMS #ifdef TRACE_DPMS -extern "C" void _sPrintf(const char *format, ...); +extern "C" void _sPrintf(const char* format, ...); # define TRACE(x) _sPrintf x #else # define TRACE(x) ; @@ -27,21 +27,32 @@ enable_display_plane(bool enable) uint32 planeBControl = read32(INTEL_DISPLAY_B_CONTROL); if (enable) { - // when enabling the display, the register values are updated automatically - if (gInfo->head_mode & HEAD_MODE_A_ANALOG) - write32(INTEL_DISPLAY_A_CONTROL, planeAControl | DISPLAY_CONTROL_ENABLED); - if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) - write32(INTEL_DISPLAY_B_CONTROL, planeBControl | DISPLAY_CONTROL_ENABLED); + // when enabling the display, the register values are updated + // automatically + if (gInfo->head_mode & HEAD_MODE_A_ANALOG) { + write32(INTEL_DISPLAY_A_CONTROL, + planeAControl | DISPLAY_CONTROL_ENABLED); + } + + if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { + write32(INTEL_DISPLAY_B_CONTROL, + planeBControl | DISPLAY_CONTROL_ENABLED); + } read32(INTEL_DISPLAY_A_BASE); // flush the eventually cached PCI bus writes } else { // when disabling it, we have to trigger the update using a write to // the display base address - if (gInfo->head_mode & HEAD_MODE_A_ANALOG) - write32(INTEL_DISPLAY_A_CONTROL, planeAControl & ~DISPLAY_CONTROL_ENABLED); - if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) - write32(INTEL_DISPLAY_B_CONTROL, planeBControl & ~DISPLAY_CONTROL_ENABLED); + if (gInfo->head_mode & HEAD_MODE_A_ANALOG) { + write32(INTEL_DISPLAY_A_CONTROL, + planeAControl & ~DISPLAY_CONTROL_ENABLED); + } + + if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { + write32(INTEL_DISPLAY_B_CONTROL, + planeBControl & ~DISPLAY_CONTROL_ENABLED); + } set_frame_buffer_base(); } @@ -55,15 +66,25 @@ enable_display_pipe(bool enable) uint32 pipeBControl = read32(INTEL_DISPLAY_B_PIPE_CONTROL); if (enable) { - if (gInfo->head_mode & HEAD_MODE_A_ANALOG) - write32(INTEL_DISPLAY_A_PIPE_CONTROL, pipeAControl | DISPLAY_PIPE_ENABLED); - if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) - write32(INTEL_DISPLAY_B_PIPE_CONTROL, pipeBControl | DISPLAY_PIPE_ENABLED); + if (gInfo->head_mode & HEAD_MODE_A_ANALOG) { + write32(INTEL_DISPLAY_A_PIPE_CONTROL, + pipeAControl | DISPLAY_PIPE_ENABLED); + } + + if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { + write32(INTEL_DISPLAY_B_PIPE_CONTROL, + pipeBControl | DISPLAY_PIPE_ENABLED); + } } else { - if (gInfo->head_mode & HEAD_MODE_A_ANALOG) - write32(INTEL_DISPLAY_A_PIPE_CONTROL, pipeAControl & ~DISPLAY_PIPE_ENABLED); - if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) - write32(INTEL_DISPLAY_B_PIPE_CONTROL, pipeBControl & ~DISPLAY_PIPE_ENABLED); + if (gInfo->head_mode & HEAD_MODE_A_ANALOG) { + write32(INTEL_DISPLAY_A_PIPE_CONTROL, + pipeAControl & ~DISPLAY_PIPE_ENABLED); + } + + if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { + write32(INTEL_DISPLAY_B_PIPE_CONTROL, + pipeBControl & ~DISPLAY_PIPE_ENABLED); + } } read32(INTEL_DISPLAY_A_BASE); @@ -167,7 +188,8 @@ set_display_power_mode(uint32 mode) write32(INTEL_DISPLAY_A_ANALOG_PORT, (read32(INTEL_DISPLAY_A_ANALOG_PORT) & ~(DISPLAY_MONITOR_MODE_MASK | DISPLAY_MONITOR_PORT_ENABLED)) - | monitorMode | (mode != B_DPMS_OFF ? DISPLAY_MONITOR_PORT_ENABLED : 0)); + | monitorMode + | (mode != B_DPMS_OFF ? DISPLAY_MONITOR_PORT_ENABLED : 0)); } if (gInfo->head_mode & HEAD_MODE_B_DIGITAL) { write32(INTEL_DISPLAY_B_DIGITAL_PORT, diff --git a/src/add-ons/accelerants/intel_extreme/engine.cpp b/src/add-ons/accelerants/intel_extreme/engine.cpp index 1d8e21c9b2..fa42be4774 100644 --- a/src/add-ons/accelerants/intel_extreme/engine.cpp +++ b/src/add-ons/accelerants/intel_extreme/engine.cpp @@ -161,7 +161,7 @@ uninit_ring_buffer(ring_buffer &ringBuffer) void -setup_ring_buffer(ring_buffer &ringBuffer, const char *name) +setup_ring_buffer(ring_buffer &ringBuffer, const char* name) { TRACE(("Setup ring buffer %s, offset %lx, size %lx\n", name, ringBuffer.offset, ringBuffer.size)); @@ -197,8 +197,8 @@ intel_accelerant_engine_count(void) status_t -intel_acquire_engine(uint32 capabilities, uint32 maxWait, sync_token *syncToken, - engine_token **_engineToken) +intel_acquire_engine(uint32 capabilities, uint32 maxWait, sync_token* syncToken, + engine_token** _engineToken) { TRACE(("intel_acquire_engine()\n")); *_engineToken = &sEngineToken; @@ -214,7 +214,7 @@ intel_acquire_engine(uint32 capabilities, uint32 maxWait, sync_token *syncToken, status_t -intel_release_engine(engine_token *engineToken, sync_token *syncToken) +intel_release_engine(engine_token* engineToken, sync_token* syncToken) { TRACE(("intel_release_engine()\n")); if (syncToken != NULL) @@ -264,7 +264,7 @@ intel_wait_engine_idle(void) status_t -intel_get_sync_token(engine_token *engineToken, sync_token *syncToken) +intel_get_sync_token(engine_token* engineToken, sync_token* syncToken) { TRACE(("intel_get_sync_token()\n")); return B_OK; @@ -272,7 +272,7 @@ intel_get_sync_token(engine_token *engineToken, sync_token *syncToken) status_t -intel_sync_to_token(sync_token *syncToken) +intel_sync_to_token(sync_token* syncToken) { TRACE(("intel_sync_to_token()\n")); intel_wait_engine_idle(); @@ -284,7 +284,7 @@ intel_sync_to_token(sync_token *syncToken) void -intel_screen_to_screen_blit(engine_token *token, blit_params *params, +intel_screen_to_screen_blit(engine_token* token, blit_params* params, uint32 count) { QueueCommands queue(gInfo->shared_info->primary_ring_buffer); @@ -304,8 +304,8 @@ intel_screen_to_screen_blit(engine_token *token, blit_params *params, void -intel_fill_rectangle(engine_token *token, uint32 color, - fill_rect_params *params, uint32 count) +intel_fill_rectangle(engine_token* token, uint32 color, + fill_rect_params* params, uint32 count) { QueueCommands queue(gInfo->shared_info->primary_ring_buffer); @@ -323,7 +323,7 @@ intel_fill_rectangle(engine_token *token, uint32 color, void -intel_invert_rectangle(engine_token *token, fill_rect_params *params, +intel_invert_rectangle(engine_token* token, fill_rect_params* params, uint32 count) { QueueCommands queue(gInfo->shared_info->primary_ring_buffer); @@ -342,14 +342,14 @@ intel_invert_rectangle(engine_token *token, fill_rect_params *params, void -intel_fill_span(engine_token *token, uint32 color, uint16* _params, +intel_fill_span(engine_token* token, uint32 color, uint16* _params, uint32 count) { struct params { uint16 top; uint16 left; uint16 right; - } *params = (struct params *)_params; + } *params = (struct params*)_params; QueueCommands queue(gInfo->shared_info->primary_ring_buffer); diff --git a/src/add-ons/accelerants/intel_extreme/hooks.cpp b/src/add-ons/accelerants/intel_extreme/hooks.cpp index 7ac7c3895e..eeedee226a 100644 --- a/src/add-ons/accelerants/intel_extreme/hooks.cpp +++ b/src/add-ons/accelerants/intel_extreme/hooks.cpp @@ -11,8 +11,8 @@ #include "accelerant.h" -extern "C" void * -get_accelerant_hook(uint32 feature, void *data) +extern "C" void* +get_accelerant_hook(uint32 feature, void* data) { switch (feature) { /* general */ diff --git a/src/add-ons/accelerants/intel_extreme/memory.cpp b/src/add-ons/accelerants/intel_extreme/memory.cpp index 1f2a705f42..e32a7e77f2 100644 --- a/src/add-ons/accelerants/intel_extreme/memory.cpp +++ b/src/add-ons/accelerants/intel_extreme/memory.cpp @@ -16,7 +16,7 @@ //#define TRACE_MEMORY #ifdef TRACE_MEMORY -extern "C" void _sPrintf(const char *format, ...); +extern "C" void _sPrintf(const char* format, ...); # define TRACE(x) _sPrintf x #else # define TRACE(x) ; diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 4e09262329..c14f213b51 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -26,7 +26,7 @@ #define TRACE_MODE #ifdef TRACE_MODE -extern "C" void _sPrintf(const char *format, ...); +extern "C" void _sPrintf(const char* format, ...); # define TRACE(x) _sPrintf x #else # define TRACE(x) ; @@ -99,13 +99,17 @@ set_i2c_signals(void* cookie, int clock, int data) if (data != 0) value |= I2C_DATA_DIRECTION_MASK; - else - value |= I2C_DATA_DIRECTION_MASK | I2C_DATA_DIRECTION_OUT | I2C_DATA_VALUE_MASK; + else { + value |= I2C_DATA_DIRECTION_MASK | I2C_DATA_DIRECTION_OUT + | I2C_DATA_VALUE_MASK; + } if (clock != 0) value |= I2C_CLOCK_DIRECTION_MASK; - else - value |= I2C_CLOCK_DIRECTION_MASK | I2C_CLOCK_DIRECTION_OUT | I2C_CLOCK_VALUE_MASK; + else { + value |= I2C_CLOCK_DIRECTION_MASK | I2C_CLOCK_DIRECTION_OUT + | I2C_CLOCK_VALUE_MASK; + } write32(ioRegister, value); read32(ioRegister); @@ -184,9 +188,9 @@ create_mode_list(void) size_t size = (sizeof(display_mode) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); - display_mode *list; + display_mode* list; area_id area = create_area("intel extreme modes", - (void **)&list, B_ANY_ADDRESS, size, B_NO_LOCK, + (void**)&list, B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); if (area < B_OK) return area; @@ -203,7 +207,7 @@ create_mode_list(void) } // Otherwise return the 'real' list of modes - display_mode *list; + display_mode* list; uint32 count = 0; gInfo->mode_list_area = create_display_modes("intel extreme modes", gInfo->has_edid ? &gInfo->edid_info : NULL, NULL, 0, NULL, 0, NULL, @@ -285,12 +289,14 @@ get_pll_limits(pll_limits &limits) limits = kLimits; } - TRACE(("PLL limits, min: p %lu (p1 %lu, p2 %lu), n %lu, m %lu (m1 %lu, m2 %lu)\n", - limits.min.post, limits.min.post1, limits.min.post2, limits.min.n, - limits.min.m, limits.min.m1, limits.min.m2)); - TRACE(("PLL limits, max: p %lu (p1 %lu, p2 %lu), n %lu, m %lu (m1 %lu, m2 %lu)\n", - limits.max.post, limits.max.post1, limits.max.post2, limits.max.n, - limits.max.m, limits.max.m1, limits.max.m2)); + TRACE(("PLL limits, min: p %lu (p1 %lu, p2 %lu), n %lu, m %lu " + "(m1 %lu, m2 %lu)\n", limits.min.post, limits.min.post1, + limits.min.post2, limits.min.n, limits.min.m, limits.min.m1, + limits.min.m2)); + TRACE(("PLL limits, max: p %lu (p1 %lu, p2 %lu), n %lu, m %lu " + "(m1 %lu, m2 %lu)\n", limits.max.post, limits.max.post1, + limits.max.post2, limits.max.n, limits.max.m, limits.max.m1, + limits.max.m2)); } @@ -316,7 +322,8 @@ compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors, bool isLVDS) { float requestedPixelClock = current.timing.pixel_clock / 1000.0f; - float referenceClock = gInfo->shared_info->pll_info.reference_frequency / 1000.0f; + float referenceClock + = gInfo->shared_info->pll_info.reference_frequency / 1000.0f; pll_limits limits; get_pll_limits(limits); @@ -344,7 +351,8 @@ compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors, pll_divisors bestDivisors; bool is_igd = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_IGD); - for (divisors.m1 = limits.min.m1; divisors.m1 <= limits.max.m1; divisors.m1++) { + for (divisors.m1 = limits.min.m1; divisors.m1 <= limits.max.m1; + divisors.m1++) { for (divisors.m2 = limits.min.m2; divisors.m2 <= limits.max.m2 && ((divisors.m2 < divisors.m1) || is_igd); divisors.m2++) { for (divisors.n = limits.min.n; divisors.n <= limits.max.n; @@ -358,7 +366,8 @@ compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors, continue; float error = fabs(requestedPixelClock - - ((referenceClock * divisors.m) / divisors.n) / divisors.post); + - ((referenceClock * divisors.m) / divisors.n) + / divisors.post); if (error < best) { best = error; bestDivisors = divisors; @@ -373,7 +382,8 @@ compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors, divisors = bestDivisors; - TRACE(("found: %g MHz, p = %lu (p1 = %lu, p2 = %lu), n = %lu, m = %lu (m1 = %lu, m2 = %lu)\n", + TRACE(("found: %g MHz, p = %lu (p1 = %lu, p2 = %lu), n = %lu, m = %lu " + "(m1 = %lu, m2 = %lu)\n", ((referenceClock * divisors.m) / divisors.n) / divisors.post, divisors.post, divisors.post1, divisors.post2, divisors.n, divisors.m, divisors.m1, divisors.m2)); @@ -618,7 +628,7 @@ intel_accelerant_mode_count(void) status_t -intel_get_mode_list(display_mode *modeList) +intel_get_mode_list(display_mode* modeList) { TRACE(("intel_get_mode_info()\n")); memcpy(modeList, gInfo->mode_list, @@ -628,8 +638,8 @@ intel_get_mode_list(display_mode *modeList) status_t -intel_propose_display_mode(display_mode *target, const display_mode *low, - const display_mode *high) +intel_propose_display_mode(display_mode* target, const display_mode* low, + const display_mode* high) { TRACE(("intel_propose_display_mode()\n")); @@ -641,7 +651,7 @@ intel_propose_display_mode(display_mode *target, const display_mode *low, status_t -intel_set_display_mode(display_mode *mode) +intel_set_display_mode(display_mode* mode) { TRACE(("intel_set_display_mode(%ldx%ld)\n", mode->virtual_width, mode->virtual_height)); @@ -712,7 +722,7 @@ if (first) { } // clear frame buffer before using it - memset((uint8 *)base, 0, bytesPerRow * target.virtual_height); + memset((uint8*)base, 0, bytesPerRow * target.virtual_height); sharedInfo.frame_buffer = base; sharedInfo.frame_buffer_offset = base - (addr_t)sharedInfo.graphics_memory; @@ -1105,7 +1115,7 @@ if (first) { status_t -intel_get_display_mode(display_mode *_currentMode) +intel_get_display_mode(display_mode* _currentMode) { TRACE(("intel_get_display_mode()\n")); @@ -1131,7 +1141,7 @@ intel_get_edid_info(void* info, size_t size, uint32* _version) status_t -intel_get_frame_buffer_config(frame_buffer_config *config) +intel_get_frame_buffer_config(frame_buffer_config* config) { TRACE(("intel_get_frame_buffer_config()\n")); @@ -1139,7 +1149,7 @@ intel_get_frame_buffer_config(frame_buffer_config *config) config->frame_buffer = gInfo->shared_info->graphics_memory + offset; config->frame_buffer_dma - = (uint8 *)gInfo->shared_info->physical_graphics_memory + offset; + = (uint8*)gInfo->shared_info->physical_graphics_memory + offset; config->bytes_per_row = gInfo->shared_info->bytes_per_row; return B_OK; @@ -1147,13 +1157,14 @@ intel_get_frame_buffer_config(frame_buffer_config *config) status_t -intel_get_pixel_clock_limits(display_mode *mode, uint32 *_low, uint32 *_high) +intel_get_pixel_clock_limits(display_mode* mode, uint32* _low, uint32* _high) { TRACE(("intel_get_pixel_clock_limits()\n")); if (_low != NULL) { // lower limit of about 48Hz vertical refresh - uint32 totalClocks = (uint32)mode->timing.h_total * (uint32)mode->timing.v_total; + uint32 totalClocks = (uint32)mode->timing.h_total + * (uint32)mode->timing.v_total; uint32 low = (totalClocks * 48L) / 1000L; if (low < gInfo->shared_info->pll_info.min_frequency) low = gInfo->shared_info->pll_info.min_frequency; @@ -1194,7 +1205,7 @@ intel_move_display(uint16 horizontalStart, uint16 verticalStart) status_t -intel_get_timing_constraints(display_timing_constraints *constraints) +intel_get_timing_constraints(display_timing_constraints* constraints) { TRACE(("intel_get_timing_contraints()\n")); return B_ERROR; @@ -1202,9 +1213,10 @@ intel_get_timing_constraints(display_timing_constraints *constraints) void -intel_set_indexed_colors(uint count, uint8 first, uint8 *colors, uint32 flags) +intel_set_indexed_colors(uint count, uint8 first, uint8* colors, uint32 flags) { - TRACE(("intel_set_indexed_colors(colors = %p, first = %u)\n", colors, first)); + TRACE(("intel_set_indexed_colors(colors = %p, first = %u)\n", colors, + first)); if (colors == NULL) return; diff --git a/src/add-ons/accelerants/intel_extreme/overlay.cpp b/src/add-ons/accelerants/intel_extreme/overlay.cpp index a348ac6251..a36f46dd3e 100644 --- a/src/add-ons/accelerants/intel_extreme/overlay.cpp +++ b/src/add-ons/accelerants/intel_extreme/overlay.cpp @@ -23,7 +23,7 @@ //#define TRACE_OVERLAY #ifdef TRACE_OVERLAY -extern "C" void _sPrintf(const char *format, ...); +extern "C" void _sPrintf(const char* format, ...); # define TRACE(x) _sPrintf x #else # define TRACE(x) ; @@ -63,19 +63,23 @@ split_coefficient(double &coefficient, int32 mantissaSize, int32 maxValue = 1 << mantissaSize; res = 12 - mantissaSize; - if ((intCoefficient = (int)(absCoefficient * 4 * maxValue + 0.5)) < maxValue) { + if ((intCoefficient = (int)(absCoefficient * 4 * maxValue + 0.5)) + < maxValue) { splitCoefficient.exponent = 3; splitCoefficient.mantissa = intCoefficient << res; coefficient = (double)intCoefficient / (double)(4 * maxValue); - } else if ((intCoefficient = (int)(absCoefficient * 2 * maxValue + 0.5)) < maxValue) { + } else if ((intCoefficient = (int)(absCoefficient * 2 * maxValue + 0.5)) + < maxValue) { splitCoefficient.exponent = 2; splitCoefficient.mantissa = intCoefficient << res; coefficient = (double)intCoefficient / (double)(2 * maxValue); - } else if ((intCoefficient = (int)(absCoefficient * maxValue + 0.5)) < maxValue) { + } else if ((intCoefficient = (int)(absCoefficient * maxValue + 0.5)) + < maxValue) { splitCoefficient.exponent = 1; splitCoefficient.mantissa = intCoefficient << res; coefficient = (double)intCoefficient / (double)maxValue; - } else if ((intCoefficient = (int)(absCoefficient * maxValue * 0.5 + 0.5)) < maxValue) { + } else if ((intCoefficient = (int)(absCoefficient * maxValue * 0.5 + 0.5)) + < maxValue) { splitCoefficient.exponent = 0; splitCoefficient.mantissa = intCoefficient << res; coefficient = (double)intCoefficient / (double)(maxValue / 2); @@ -94,7 +98,7 @@ split_coefficient(double &coefficient, int32 mantissaSize, static void update_coefficients(int32 taps, double filterCutOff, bool horizontal, bool isY, - phase_coefficient *splitCoefficients) + phase_coefficient* splitCoefficients) { if (filterCutOff < 1) filterCutOff = 1; @@ -184,7 +188,7 @@ static void set_color_key(uint8 red, uint8 green, uint8 blue, uint8 redMask, uint8 greenMask, uint8 blueMask) { - overlay_registers *registers = gInfo->overlay_registers; + overlay_registers* registers = gInfo->overlay_registers; registers->color_key_red = red; registers->color_key_green = green; @@ -197,7 +201,7 @@ set_color_key(uint8 red, uint8 green, uint8 blue, uint8 redMask, static void -set_color_key(const overlay_window *window) +set_color_key(const overlay_window* window) { switch (gInfo->shared_info->current_mode.space) { case B_CMAP8: @@ -205,13 +209,13 @@ set_color_key(const overlay_window *window) break; case B_RGB15: set_color_key(window->red.value << 3, window->green.value << 3, - window->blue.value << 3, window->red.mask << 3, window->green.mask << 3, - window->blue.mask << 3); + window->blue.value << 3, window->red.mask << 3, + window->green.mask << 3, window->blue.mask << 3); break; case B_RGB16: set_color_key(window->red.value << 3, window->green.value << 2, - window->blue.value << 3, window->red.mask << 3, window->green.mask << 2, - window->blue.mask << 3); + window->blue.value << 3, window->red.mask << 3, + window->green.mask << 2, window->blue.mask << 3); break; default: @@ -239,9 +243,11 @@ update_overlay(bool updateCoefficients) queue.PutWaitFor(COMMAND_WAIT_FOR_OVERLAY_FLIP); queue.PutFlush(); - TRACE(("update overlay: UP: %lx, TST: %lx, ST: %lx, CMD: %lx (%lx), ERR: %lx\n", - read32(INTEL_OVERLAY_UPDATE), read32(INtEL_OVERLAY_TEST), read32(INTEL_OVERLAY_STATUS), - *(((uint32 *)gInfo->overlay_registers) + 0x68/4), read32(0x30168), read32(0x2024))); + TRACE(("update overlay: UP: %lx, TST: %lx, ST: %lx, CMD: %lx (%lx), " + "ERR: %lx\n", read32(INTEL_OVERLAY_UPDATE), read32(INtEL_OVERLAY_TEST), + read32(INTEL_OVERLAY_STATUS), + *(((uint32*)gInfo->overlay_registers) + 0x68/4), read32(0x30168), + read32(0x2024))); } @@ -259,9 +265,11 @@ show_overlay(void) queue.PutOverlayFlip(COMMAND_OVERLAY_ON, true); queue.PutFlush(); - TRACE(("show overlay: UP: %lx, TST: %lx, ST: %lx, CMD: %lx (%lx), ERR: %lx\n", - read32(INTEL_OVERLAY_UPDATE), read32(INTEL_OVERLAY_TEST), read32(INTEL_OVERLAY_STATUS), - *(((uint32 *)gInfo->overlay_registers) + 0x68/4), read32(0x30168), read32(0x2024))); + TRACE(("show overlay: UP: %lx, TST: %lx, ST: %lx, CMD: %lx (%lx), " + "ERR: %lx\n", read32(INTEL_OVERLAY_UPDATE), read32(INTEL_OVERLAY_TEST), + read32(INTEL_OVERLAY_STATUS), + *(((uint32*)gInfo->overlay_registers) + 0x68/4), read32(0x30168), + read32(0x2024))); } @@ -272,7 +280,7 @@ hide_overlay(void) || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_965)) return; - overlay_registers *registers = gInfo->overlay_registers; + overlay_registers* registers = gInfo->overlay_registers; gInfo->shared_info->overlay_active = false; registers->overlay_enabled = false; @@ -299,7 +307,7 @@ hide_overlay(void) uint32 -intel_overlay_count(const display_mode *mode) +intel_overlay_count(const display_mode* mode) { // TODO: make this depending on the amount of RAM and the screen mode // (and we could even have more than one when using 3D as well) @@ -307,8 +315,8 @@ intel_overlay_count(const display_mode *mode) } -const uint32 * -intel_overlay_supported_spaces(const display_mode *mode) +const uint32* +intel_overlay_supported_spaces(const display_mode* mode) { static const uint32 kSupportedSpaces[] = {B_RGB15, B_RGB16, B_RGB32, B_YCbCr422, 0}; @@ -332,12 +340,12 @@ intel_overlay_supported_features(uint32 colorSpace) } -const overlay_buffer * +const overlay_buffer* intel_allocate_overlay_buffer(color_space colorSpace, uint16 width, uint16 height) { - TRACE(("intel_allocate_overlay_buffer(width %u, height %u, colorSpace %lu)\n", - width, height, colorSpace)); + TRACE(("intel_allocate_overlay_buffer(width %u, height %u, " + "colorSpace %lu)\n", width, height, colorSpace)); intel_shared_info &sharedInfo = *gInfo->shared_info; uint32 bytesPerPixel; @@ -359,7 +367,7 @@ intel_allocate_overlay_buffer(color_space colorSpace, uint16 width, return NULL; } - struct overlay *overlay = (struct overlay *)malloc(sizeof(struct overlay)); + struct overlay* overlay = (struct overlay*)malloc(sizeof(struct overlay)); if (overlay == NULL) return NULL; @@ -371,7 +379,7 @@ intel_allocate_overlay_buffer(color_space colorSpace, uint16 width, if (sharedInfo.device_type.InGroup(INTEL_TYPE_965)) alignment = 0xff; - overlay_buffer *buffer = &overlay->buffer; + overlay_buffer* buffer = &overlay->buffer; buffer->space = colorSpace; buffer->width = width; buffer->height = height; @@ -400,8 +408,8 @@ intel_allocate_overlay_buffer(color_space colorSpace, uint16 width, overlay->buffer_offset = overlay->buffer_base - (addr_t)gInfo->shared_info->graphics_memory; - buffer->buffer = (uint8 *)overlay->buffer_base; - buffer->buffer_dma = (uint8 *)gInfo->shared_info->physical_graphics_memory + buffer->buffer = (uint8*)overlay->buffer_base; + buffer->buffer_dma = (uint8*)gInfo->shared_info->physical_graphics_memory + overlay->buffer_offset; TRACE(("allocated overlay buffer: base=%x, offset=%x, address=%x, " @@ -413,11 +421,11 @@ intel_allocate_overlay_buffer(color_space colorSpace, uint16 width, status_t -intel_release_overlay_buffer(const overlay_buffer *buffer) +intel_release_overlay_buffer(const overlay_buffer* buffer) { TRACE(("intel_release_overlay_buffer(buffer %p)\n", buffer)); - struct overlay *overlay = (struct overlay *)buffer; + struct overlay* overlay = (struct overlay*)buffer; // TODO: locking! @@ -434,8 +442,8 @@ intel_release_overlay_buffer(const overlay_buffer *buffer) status_t -intel_get_overlay_constraints(const display_mode *mode, - const overlay_buffer *buffer, overlay_constraints *constraints) +intel_get_overlay_constraints(const display_mode* mode, + const overlay_buffer* buffer, overlay_constraints* constraints) { TRACE(("intel_get_overlay_constraints(buffer %p)\n", buffer)); @@ -525,8 +533,9 @@ intel_release_overlay(overlay_token overlayToken) status_t -intel_configure_overlay(overlay_token overlayToken, const overlay_buffer *buffer, - const overlay_window *window, const overlay_view *view) +intel_configure_overlay(overlay_token overlayToken, + const overlay_buffer* buffer, const overlay_window* window, + const overlay_view* view) { TRACE(("intel_configure_overlay: buffer %p, window %p, view %p\n", buffer, window, view)); @@ -539,8 +548,8 @@ intel_configure_overlay(overlay_token overlayToken, const overlay_buffer *buffer return B_OK; } - struct overlay *overlay = (struct overlay *)buffer; - overlay_registers *registers = gInfo->overlay_registers; + struct overlay* overlay = (struct overlay*)buffer; + overlay_registers* registers = gInfo->overlay_registers; bool updateCoefficients = false; uint32 bytesPerPixel = 2; @@ -689,7 +698,7 @@ intel_configure_overlay(overlay_token overlayToken, const overlay_buffer *buffer } gInfo->last_overlay_view = *view; - gInfo->last_overlay_frame = *(overlay_frame *)window; + gInfo->last_overlay_frame = *(overlay_frame*)window; } registers->color_control_output_mode = true; diff --git a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp index a11b3323fd..5e3b0923fe 100644 --- a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp +++ b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp @@ -34,9 +34,9 @@ (sPCI->write_pci_config((info).bus, (info).device, (info).function, \ (offset), (size), (value))) #define write32(address, data) \ - (*((volatile uint32 *)(address)) = (data)) + (*((volatile uint32*)(address)) = (data)) #define read32(address) \ - (*((volatile uint32 *)(address))) + (*((volatile uint32*)(address))) const struct supported_device { @@ -109,7 +109,7 @@ struct intel_info { }; static intel_info sInfo; -static pci_module_info *sPCI; +static pci_module_info* sPCI; static bool @@ -219,7 +219,8 @@ determine_memory_sizes(intel_info &info, size_t >tSize, size_t &stolenSize) switch (memoryConfig & STOLEN_MEMORY_MASK) { case i830_LOCAL_MEMORY_ONLY: // TODO: determine its size! - dprintf("intel_gart: getting local memory size not implemented.\n"); + dprintf("intel_gart: getting local memory size not " + "implemented.\n"); break; case i830_STOLEN_512K: memorySize >>= 1; @@ -357,17 +358,17 @@ intel_map(intel_info &info) int fbIndex = 0; int mmioIndex = 1; if ((info.type & INTEL_TYPE_FAMILY_MASK) == INTEL_TYPE_9xx) { - // for some reason Intel saw the need to change the order of the mappings - // with the introduction of the i9xx family + // for some reason Intel saw the need to change the order of the + // mappings with the introduction of the i9xx family mmioIndex = 0; fbIndex = 2; } AreaKeeper mmioMapper; info.registers_area = mmioMapper.Map("intel GMCH mmio", - (void *)info.display.u.h0.base_registers[mmioIndex], + (void*)info.display.u.h0.base_registers[mmioIndex], info.display.u.h0.base_register_sizes[mmioIndex], B_ANY_KERNEL_ADDRESS, - B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void **)&info.registers); + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&info.registers); if (mmioMapper.InitCheck() < B_OK) { dprintf("agp_intel: could not map memory I/O!\n"); return info.registers_area; @@ -378,7 +379,7 @@ intel_map(intel_info &info) get_pci_config(info.display, PCI_command, 2) | PCI_command_io | PCI_command_memory | PCI_command_master); - void *scratchAddress; + void* scratchAddress; AreaKeeper scratchCreator; info.scratch_area = scratchCreator.Create("intel GMCH scratch", &scratchAddress, B_ANY_KERNEL_ADDRESS, B_PAGE_SIZE, B_FULL_LOCK, @@ -398,7 +399,8 @@ intel_map(intel_info &info) info.gtt_physical_base = info.display.u.h0.base_registers[mmioIndex] + (2UL << 20); } else - info.gtt_physical_base = get_pci_config(info.display, i915_GTT_BASE, 4); + info.gtt_physical_base + = get_pci_config(info.display, i915_GTT_BASE, 4); } else { info.gtt_physical_base = read32(info.registers + INTEL_PAGE_TABLE_CONTROL) & ~PAGE_TABLE_ENABLED; @@ -417,13 +419,13 @@ intel_map(intel_info &info) info.gtt_entries = gttSize / 4096; info.gtt_stolen_entries = stolenSize / 4096; - TRACE("GTT base %lx, size %lu, entries %lu, stolen %lu\n", info.gtt_physical_base, - gttSize, info.gtt_entries, stolenSize); + TRACE("GTT base %lx, size %lu, entries %lu, stolen %lu\n", + info.gtt_physical_base, gttSize, info.gtt_entries, stolenSize); AreaKeeper gttMapper; info.gtt_area = gttMapper.Map("intel GMCH gtt", - (void *)info.gtt_physical_base, gttSize, B_ANY_KERNEL_ADDRESS, - B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void **)&info.gtt_base); + (void*)info.gtt_physical_base, gttSize, B_ANY_KERNEL_ADDRESS, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&info.gtt_base); if (gttMapper.InitCheck() < B_OK) { dprintf("intel_gart: could not map GTT!\n"); return info.gtt_area; @@ -439,22 +441,23 @@ intel_map(intel_info &info) info.aperture_size >> 20, gttSize >> 10); dprintf("intel_gart: GTT base = 0x%lx\n", info.gtt_physical_base); - dprintf("intel_gart: MMIO base = 0x%lx\n", info.display.u.h0.base_registers[mmioIndex]); + dprintf("intel_gart: MMIO base = 0x%lx\n", + info.display.u.h0.base_registers[mmioIndex]); dprintf("intel_gart: GMR base = 0x%lx\n", info.aperture_physical_base); AreaKeeper apertureMapper; info.aperture_area = apertureMapper.Map("intel graphics aperture", - (void *)info.aperture_physical_base, info.aperture_size, + (void*)info.aperture_physical_base, info.aperture_size, B_ANY_KERNEL_BLOCK_ADDRESS | B_MTR_WC, - B_READ_AREA | B_WRITE_AREA, (void **)&info.aperture_base); + B_READ_AREA | B_WRITE_AREA, (void**)&info.aperture_base); if (apertureMapper.InitCheck() < B_OK) { // try again without write combining dprintf(DEVICE_NAME ": enabling write combined mode failed.\n"); info.aperture_area = apertureMapper.Map("intel graphics aperture", - (void *)info.aperture_physical_base, info.aperture_size, + (void*)info.aperture_physical_base, info.aperture_size, B_ANY_KERNEL_BLOCK_ADDRESS, B_READ_AREA | B_WRITE_AREA, - (void **)&info.aperture_base); + (void**)&info.aperture_base); } if (apertureMapper.InitCheck() < B_OK) { dprintf(DEVICE_NAME ": could not map graphics aperture!\n"); @@ -477,7 +480,7 @@ intel_map(intel_info &info) status_t intel_create_aperture(uint8 bus, uint8 device, uint8 function, size_t size, - void **_aperture) + void** _aperture) { // TODO: we currently only support a single AGP bridge! if ((bus != sInfo.bridge.bus || device != sInfo.bridge.device @@ -514,14 +517,14 @@ intel_create_aperture(uint8 bus, uint8 device, uint8 function, size_t size, void -intel_delete_aperture(void *aperture) +intel_delete_aperture(void* aperture) { intel_unmap(sInfo); } static status_t -intel_get_aperture_info(void *aperture, aperture_info *info) +intel_get_aperture_info(void* aperture, aperture_info* info) { if (info == NULL) return B_BAD_VALUE; @@ -536,14 +539,14 @@ intel_get_aperture_info(void *aperture, aperture_info *info) status_t -intel_set_aperture_size(void *aperture, size_t size) +intel_set_aperture_size(void* aperture, size_t size) { return B_ERROR; } static status_t -intel_bind_page(void *aperture, uint32 offset, phys_addr_t physicalAddress) +intel_bind_page(void* aperture, uint32 offset, phys_addr_t physicalAddress) { //TRACE("bind_page(offset %lx, physical %lx)\n", offset, physicalAddress); @@ -553,7 +556,7 @@ intel_bind_page(void *aperture, uint32 offset, phys_addr_t physicalAddress) static status_t -intel_unbind_page(void *aperture, uint32 offset) +intel_unbind_page(void* aperture, uint32 offset) { //TRACE("unbind_page(offset %lx)\n", offset); @@ -565,7 +568,7 @@ intel_unbind_page(void *aperture, uint32 offset) void -intel_flush_tlbs(void *aperture) +intel_flush_tlbs(void* aperture) { read32(sInfo.gtt_base + sInfo.gtt_entries - 1); asm("wbinvd;"); @@ -580,7 +583,7 @@ intel_init() { TRACE("bus manager init\n"); - if (get_module(B_PCI_MODULE_NAME, (module_info **)&sPCI) != B_OK) + if (get_module(B_PCI_MODULE_NAME, (module_info**)&sPCI) != B_OK) return B_ERROR; bool found = false; @@ -652,7 +655,7 @@ static struct agp_gart_bus_module_info sIntelModuleInfo = { intel_flush_tlbs }; -module_info *modules[] = { - (module_info *)&sIntelModuleInfo, +module_info* modules[] = { + (module_info*)&sIntelModuleInfo, NULL }; diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp index d3321f390a..df259cbdd7 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp @@ -36,12 +36,15 @@ /* device hooks prototypes */ -static status_t device_open(const char *name, uint32 flags, void **_cookie); -static status_t device_close(void *data); -static status_t device_free(void *data); -static status_t device_ioctl(void *data, uint32 opcode, void *buffer, size_t length); -static status_t device_read(void *data, off_t offset, void *buffer, size_t *length); -static status_t device_write(void *data, off_t offset, const void *buffer, size_t *length); +static status_t device_open(const char* name, uint32 flags, void** _cookie); +static status_t device_close(void* data); +static status_t device_free(void* data); +static status_t device_ioctl(void* data, uint32 opcode, void* buffer, + size_t length); +static status_t device_read(void* data, off_t offset, void* buffer, + size_t* length); +static status_t device_write(void* data, off_t offset, const void* buffer, + size_t* length); device_hooks gDeviceHooks = { @@ -60,7 +63,7 @@ device_hooks gDeviceHooks = { #ifdef DEBUG_COMMANDS static int -getset_register(int argc, char **argv) +getset_register(int argc, char** argv) { if (argc < 2 || argc > 3) { kprintf("usage: %s [set-to-value]\n", argv[0]); @@ -96,14 +99,14 @@ getset_register(int argc, char **argv) static status_t -device_open(const char *name, uint32 /*flags*/, void **_cookie) +device_open(const char* name, uint32 /*flags*/, void** _cookie) { TRACE((DEVICE_NAME ": open(name = %s)\n", name)); int32 id; // find accessed device { - char *thisName; + char* thisName; // search for device name for (id = 0; (thisName = gDeviceNames[id]) != NULL; id++) { @@ -114,7 +117,7 @@ device_open(const char *name, uint32 /*flags*/, void **_cookie) return B_BAD_VALUE; } - intel_info *info = gDeviceInfo[id]; + intel_info* info = gDeviceInfo[id]; mutex_lock(&gLock); @@ -142,7 +145,7 @@ device_open(const char *name, uint32 /*flags*/, void **_cookie) static status_t -device_close(void */*data*/) +device_close(void* /*data*/) { TRACE((DEVICE_NAME ": close\n")); return B_OK; @@ -150,9 +153,9 @@ device_close(void */*data*/) static status_t -device_free(void *data) +device_free(void* data) { - struct intel_info *info = (intel_info *)data; + struct intel_info* info = (intel_info*)data; mutex_lock(&gLock); @@ -173,20 +176,20 @@ device_free(void *data) static status_t -device_ioctl(void *data, uint32 op, void *buffer, size_t bufferLength) +device_ioctl(void* data, uint32 op, void* buffer, size_t bufferLength) { - struct intel_info *info = (intel_info *)data; + struct intel_info* info = (intel_info*)data; switch (op) { case B_GET_ACCELERANT_SIGNATURE: - strcpy((char *)buffer, INTEL_ACCELERANT_NAME); + strcpy((char*)buffer, INTEL_ACCELERANT_NAME); TRACE((DEVICE_NAME ": accelerant: %s\n", INTEL_ACCELERANT_NAME)); return B_OK; // needed to share data between kernel and accelerant case INTEL_GET_PRIVATE_DATA: { - intel_get_private_data *data = (intel_get_private_data *)buffer; + intel_get_private_data* data = (intel_get_private_data* )buffer; if (data->magic == INTEL_PRIVATE_DATA_MAGIC) { data->shared_info_area = info->shared_area; @@ -198,12 +201,12 @@ device_ioctl(void *data, uint32 op, void *buffer, size_t bufferLength) // needed for cloning case INTEL_GET_DEVICE_NAME: #ifdef __HAIKU__ - if (user_strlcpy((char *)buffer, gDeviceNames[info->id], + if (user_strlcpy((char* )buffer, gDeviceNames[info->id], B_PATH_NAME_LENGTH) < B_OK) return B_BAD_ADDRESS; #else - strncpy((char *)buffer, gDeviceNames[info->id], B_PATH_NAME_LENGTH); - ((char *)buffer)[B_PATH_NAME_LENGTH - 1] = '\0'; + strncpy((char* )buffer, gDeviceNames[info->id], B_PATH_NAME_LENGTH); + ((char* )buffer)[B_PATH_NAME_LENGTH - 1] = '\0'; #endif return B_OK; @@ -216,7 +219,8 @@ device_ioctl(void *data, uint32 op, void *buffer, size_t bufferLength) sizeof(intel_allocate_graphics_memory)) < B_OK) return B_BAD_ADDRESS; #else - memcpy(&allocMemory, buffer, sizeof(intel_allocate_graphics_memory)); + memcpy(&allocMemory, buffer, + sizeof(intel_allocate_graphics_memory)); #endif if (allocMemory.magic != INTEL_PRIVATE_DATA_MAGIC) @@ -224,7 +228,7 @@ device_ioctl(void *data, uint32 op, void *buffer, size_t bufferLength) status_t status = intel_allocate_memory(*info, allocMemory.size, allocMemory.alignment, allocMemory.flags, - (addr_t *)&allocMemory.buffer_base); + (addr_t* )&allocMemory.buffer_base); if (status == B_OK) { // copy result #ifdef __HAIKU__ @@ -266,7 +270,7 @@ device_ioctl(void *data, uint32 op, void *buffer, size_t bufferLength) static status_t -device_read(void */*data*/, off_t /*pos*/, void */*buffer*/, size_t *_length) +device_read(void* /*data*/, off_t /*pos*/, void* /*buffer*/, size_t* _length) { *_length = 0; return B_NOT_ALLOWED; @@ -274,7 +278,8 @@ device_read(void */*data*/, off_t /*pos*/, void */*buffer*/, size_t *_length) static status_t -device_write(void */*data*/, off_t /*pos*/, const void */*buffer*/, size_t *_length) +device_write(void* /*data*/, off_t /*pos*/, const void* /*buffer*/, + size_t* _length) { *_length = 0; return B_NOT_ALLOWED; diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp index 835fcee462..5a0329df11 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp @@ -86,7 +86,7 @@ mutex gLock; static status_t -get_next_intel_extreme(int32 *_cookie, pci_info &info, uint32 &type) +get_next_intel_extreme(int32* _cookie, pci_info &info, uint32 &type) { int32 index = *_cookie; @@ -114,11 +114,11 @@ get_next_intel_extreme(int32 *_cookie, pci_info &info, uint32 &type) } -extern "C" const char ** +extern "C" const char** publish_devices(void) { TRACE((DEVICE_NAME ": publish_devices()\n")); - return (const char **)gDeviceNames; + return (const char**)gDeviceNames; } @@ -127,7 +127,7 @@ init_hardware(void) { TRACE((DEVICE_NAME ": init_hardware()\n")); - status_t status = get_module(B_PCI_MODULE_NAME,(module_info **)&gPCI); + status_t status = get_module(B_PCI_MODULE_NAME,(module_info**)&gPCI); if (status != B_OK) { TRACE((DEVICE_NAME ": pci module unavailable\n")); return status; @@ -202,7 +202,7 @@ init_driver(void) gDeviceInfo[found]->init_status = B_NO_INIT; gDeviceInfo[found]->id = found; gDeviceInfo[found]->pci = info; - gDeviceInfo[found]->registers = (uint8 *)info->u.h0.base_registers[0]; + gDeviceInfo[found]->registers = (uint8*)info->u.h0.base_registers[0]; gDeviceInfo[found]->device_identifier = kSupportedDevices[type].name; gDeviceInfo[found]->device_type = kSupportedDevices[type].type; diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h index 06956d7e58..1c83e729ed 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h @@ -43,7 +43,7 @@ set_pci_config(pci_info* info, uint8 offset, uint8 size, uint32 value) static inline uint16 read16(intel_info &info, uint32 encodedRegister) { - return *(volatile uint16 *)(info.registers + return *(volatile uint16*)(info.registers + info.shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + REGISTER_REGISTER(encodedRegister)); } @@ -52,7 +52,7 @@ read16(intel_info &info, uint32 encodedRegister) static inline uint32 read32(intel_info &info, uint32 encodedRegister) { - return *(volatile uint32 *)(info.registers + return *(volatile uint32*)(info.registers + info.shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + REGISTER_REGISTER(encodedRegister)); } @@ -61,7 +61,7 @@ read32(intel_info &info, uint32 encodedRegister) static inline void write16(intel_info &info, uint32 encodedRegister, uint16 value) { - *(volatile uint16 *)(info.registers + *(volatile uint16*)(info.registers + info.shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + REGISTER_REGISTER(encodedRegister)) = value; } @@ -70,7 +70,7 @@ write16(intel_info &info, uint32 encodedRegister, uint16 value) static inline void write32(intel_info &info, uint32 encodedRegister, uint32 value) { - *(volatile uint32 *)(info.registers + *(volatile uint32*)(info.registers + info.shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)] + REGISTER_REGISTER(encodedRegister)) = value; } diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index 34c9fbd216..7e445d218d 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -31,7 +31,7 @@ static void -init_overlay_registers(overlay_registers *registers) +init_overlay_registers(overlay_registers* registers) { memset(registers, 0, B_PAGE_SIZE); @@ -46,7 +46,7 @@ read_settings(bool &hardwareCursor) { hardwareCursor = false; - void *settings = load_driver_settings("intel_extreme"); + void* settings = load_driver_settings("intel_extreme"); if (settings != NULL) { hardwareCursor = get_driver_boolean_parameter(settings, "hardware_cursor", true, true); @@ -72,9 +72,9 @@ release_vblank_sem(intel_info &info) static int32 -intel_interrupt_handler(void *data) +intel_interrupt_handler(void* data) { - intel_info &info = *(intel_info *)data; + intel_info &info = *(intel_info*)data; uint16 identity = read16(info, INTEL_INTERRUPT_IDENTITY); if (identity == 0) @@ -135,7 +135,7 @@ init_interrupt_handler(intel_info &info) info.fake_interrupts = false; status = install_io_interrupt_handler(info.pci->u.h0.interrupt_line, - &intel_interrupt_handler, (void *)&info, 0); + &intel_interrupt_handler, (void*)&info, 0); if (status == B_OK) { write32(info, INTEL_DISPLAY_A_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); @@ -162,7 +162,8 @@ init_interrupt_handler(intel_info &info) info.fake_interrupts = true; // TODO: fake interrupts! - TRACE((DEVICE_NAME "Fake interrupt mode (no PCI interrupt line assigned)")); + TRACE((DEVICE_NAME "Fake interrupt mode (no PCI interrupt line " + "assigned)")); status = B_ERROR; } @@ -185,7 +186,7 @@ intel_free_memory(intel_info &info, addr_t base) status_t intel_allocate_memory(intel_info &info, size_t size, size_t alignment, - uint32 flags, addr_t *_base, phys_addr_t *_physicalBase) + uint32 flags, addr_t* _base, phys_addr_t* _physicalBase) { return gGART->allocate_memory(info.aperture, size, alignment, flags, _base, _physicalBase); @@ -202,7 +203,7 @@ intel_extreme_init(intel_info &info) AreaKeeper sharedCreator; info.shared_area = sharedCreator.Create("intel extreme shared info", - (void **)&info.shared_info, B_ANY_KERNEL_ADDRESS, + (void**)&info.shared_info, B_ANY_KERNEL_ADDRESS, ROUND_TO_PAGE_SIZE(sizeof(intel_shared_info)) + 3 * B_PAGE_SIZE, B_FULL_LOCK, 0); if (info.shared_area < B_OK) { @@ -210,7 +211,7 @@ intel_extreme_init(intel_info &info) return info.shared_area; } - memset((void *)info.shared_info, 0, sizeof(intel_shared_info)); + memset((void*)info.shared_info, 0, sizeof(intel_shared_info)); int fbIndex = 0; int mmioIndex = 1; @@ -233,17 +234,17 @@ intel_extreme_init(intel_info &info) AreaKeeper mmioMapper; info.registers_area = mmioMapper.Map("intel extreme mmio", - (void *)info.pci->u.h0.base_registers[mmioIndex], + (void*)info.pci->u.h0.base_registers[mmioIndex], info.pci->u.h0.base_register_sizes[mmioIndex], B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, - (void **)&info.registers); + (void**)&info.registers); if (mmioMapper.InitCheck() < B_OK) { dprintf(DEVICE_NAME ": could not map memory I/O!\n"); gGART->unmap_aperture(info.aperture); return info.registers_area; } - uint32 *blocks = info.shared_info->register_blocks; + uint32* blocks = info.shared_info->register_blocks; blocks[REGISTER_BLOCK(REGS_FLAT)] = 0; // setup the register blocks for the different architectures @@ -278,8 +279,9 @@ intel_extreme_init(intel_info &info) } // make sure bus master, memory-mapped I/O, and frame buffer is enabled - set_pci_config(info.pci, PCI_command, 2, get_pci_config(info.pci, PCI_command, 2) - | PCI_command_io | PCI_command_memory | PCI_command_master); + set_pci_config(info.pci, PCI_command, 2, get_pci_config(info.pci, + PCI_command, 2) | PCI_command_io | PCI_command_memory + | PCI_command_master); // reserve ring buffer memory (currently, this memory is placed in // the graphics memory), but this could bring us problems with @@ -287,7 +289,7 @@ intel_extreme_init(intel_info &info) ring_buffer &primary = info.shared_info->primary_ring_buffer; if (intel_allocate_memory(info, 16 * B_PAGE_SIZE, 0, 0, - (addr_t *)&primary.base) == B_OK) { + (addr_t*)&primary.base) == B_OK) { primary.register_base = INTEL_PRIMARY_RING_BUFFER; primary.size = 16 * B_PAGE_SIZE; primary.offset = (addr_t)primary.base - info.aperture_base; @@ -328,7 +330,7 @@ intel_extreme_init(intel_info &info) gGART->get_aperture_info(info.aperture, &apertureInfo); info.shared_info->registers_area = info.registers_area; - info.shared_info->graphics_memory = (uint8 *)info.aperture_base; + info.shared_info->graphics_memory = (uint8*)info.aperture_base; info.shared_info->physical_graphics_memory = apertureInfo.physical_base; info.shared_info->graphics_memory_size = apertureInfo.size; info.shared_info->frame_buffer = 0; @@ -361,7 +363,7 @@ intel_extreme_init(intel_info &info) if (intel_allocate_memory(info, B_PAGE_SIZE, 0, intel_uses_physical_overlay(*info.shared_info) ? B_APERTURE_NEED_PHYSICAL : 0, - (addr_t *)&info.overlay_registers, + (addr_t*)&info.overlay_registers, &info.shared_info->physical_overlay_registers) == B_OK) { info.shared_info->overlay_offset = (addr_t)info.overlay_registers - info.aperture_base; @@ -372,13 +374,13 @@ intel_extreme_init(intel_info &info) // Allocate hardware status page and the cursor memory if (intel_allocate_memory(info, B_PAGE_SIZE, 0, B_APERTURE_NEED_PHYSICAL, - (addr_t *)info.shared_info->status_page, + (addr_t*)info.shared_info->status_page, &info.shared_info->physical_status_page) == B_OK) { // TODO: set status page } if (hardwareCursor) { intel_allocate_memory(info, B_PAGE_SIZE, 0, B_APERTURE_NEED_PHYSICAL, - (addr_t *)&info.shared_info->cursor_memory, + (addr_t*)&info.shared_info->cursor_memory, &info.shared_info->physical_cursor_memory); } From 6b063167dce0855c81f8050bab58aec6a411575d Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 16 Oct 2011 16:02:34 +0000 Subject: [PATCH 403/702] Strip the leading and trailing spaces from the makefile-defined variables to make the engine more input robust. Fixes #8019 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42864 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/develop/makefile-engine | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/data/develop/makefile-engine b/data/develop/makefile-engine index 21be2f9a9f..e737619128 100644 --- a/data/develop/makefile-engine +++ b/data/develop/makefile-engine @@ -43,20 +43,20 @@ endif C++ := g++ # SETTING: set the CFLAGS for each binary type - ifeq ($(TYPE), DRIVER) + ifeq ($(strip $(TYPE)), DRIVER) CFLAGS += -D_KERNEL_MODE=1 -no-fpic else CFLAGS += endif # SETTING: set the proper optimization level - ifeq ($(OPTIMIZE), FULL) + ifeq ($(strip $(OPTIMIZE)), FULL) OPTIMIZER = -O3 else - ifeq ($(OPTIMIZE), SOME) + ifeq ($(strip $(OPTIMIZE)), SOME) OPTIMIZER = -O1 else - ifeq ($(OPTIMIZE), NONE) + ifeq ($(strip $(OPTIMIZE)), NONE) OPTIMIZER = -O0 else # OPTIMIZE not set so set to full @@ -66,7 +66,7 @@ endif endif # SETTING: set proper debugger flags - ifeq ($(DEBUGGER), TRUE) + ifeq ($(strip $(DEBUGGER)), TRUE) DEBUG += -g OPTIMIZER = -O0 endif @@ -74,10 +74,10 @@ endif CFLAGS += $(OPTIMIZER) $(DEBUG) # SETTING: set warning level - ifeq ($(WARNINGS), ALL) + ifeq ($(strip $(WARNINGS)), ALL) CFLAGS += -Wall -Wno-multichar -Wno-ctor-dtor-privacy else - ifeq ($(WARNINGS), NONE) + ifeq ($(strip $(WARNINGS)), NONE) CFLAGS += -w endif endif @@ -89,13 +89,13 @@ endif LDFLAGS += $(DEBUG) # SETTING: set linker flags for each binary type - ifeq ($(TYPE), APP) + ifeq ($(strip $(TYPE)), APP) LDFLAGS += -Xlinker -soname=_APP_ else - ifeq ($(TYPE), SHARED) + ifeq ($(strip $(TYPE)), SHARED) LDFLAGS += -nostart -Xlinker -soname=$(NAME) else - ifeq ($(TYPE), DRIVER) + ifeq ($(strip $(TYPE)), DRIVER) LDFLAGS += -nostdlib /boot/develop/lib/x86/_KERNEL_ \ /boot/develop/lib/x86/haiku_version_glue.o endif @@ -191,7 +191,7 @@ LDFLAGS += $(LINKER_FLAGS) # SETTING: use the archive tools if building a static library # otherwise use the linker -ifeq ($(TYPE), STATIC) +ifeq ($(strip $(TYPE)), STATIC) BUILD_LINE = ar -cru "$(TARGET)" $(OBJS) else BUILD_LINE = $(LD) -o "$@" $(OBJS) $(LDFLAGS) @@ -346,7 +346,7 @@ USER_BIN_PATH = /boot/home/config/add-ons/kernel/drivers/bin USER_DEV_PATH = /boot/home/config/add-ons/kernel/drivers/dev driverinstall :: default -ifeq ($(TYPE), DRIVER) +ifeq ($(strip $(TYPE)), DRIVER) copyattr --data $(TARGET) $(USER_BIN_PATH)/$(NAME) mkdir -p $(USER_DEV_PATH)/$(DRIVER_PATH) ln -sf $(USER_BIN_PATH)/$(NAME) $(USER_DEV_PATH)/$(DRIVER_PATH)/$(NAME) From a1f2a6b1795c0897dfbf085be37451915d3e848a Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 16 Oct 2011 16:44:17 +0000 Subject: [PATCH 404/702] Add cfmakeraw. Like cf{get/set}{i/o}speed, it iisn't POSIx standard but is used often enough and simple enough to write that we should allow it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42865 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/termios.h | 1 + src/system/libroot/posix/termios.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/headers/posix/termios.h b/headers/posix/termios.h index 5d01343d46..88db94675a 100644 --- a/headers/posix/termios.h +++ b/headers/posix/termios.h @@ -223,6 +223,7 @@ extern speed_t cfgetispeed(const struct termios *termios); extern speed_t cfgetospeed(const struct termios *termios); extern int cfsetispeed(struct termios *termios, speed_t speed); extern int cfsetospeed(struct termios *termios, speed_t speed); +extern void cfmakeraw(struct termios *termios); extern int tcgetattr(int fd, struct termios *termios); extern int tcsetattr(int fd, int option, const struct termios *termios); extern int tcsendbreak(int fd, int duration); diff --git a/src/system/libroot/posix/termios.c b/src/system/libroot/posix/termios.c index 77d3e8dd46..0158f86b30 100644 --- a/src/system/libroot/posix/termios.c +++ b/src/system/libroot/posix/termios.c @@ -146,3 +146,15 @@ cfsetospeed(struct termios *termios, speed_t speed) termios->c_cflag |= speed; return 0; } + + +void +cfmakeraw(struct termios *termios) +{ + termios->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR + | ICRNL | IXON); + termios->c_oflag &= ~OPOST; + termios->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + termios->c_cflag &= ~(CSIZE | PARENB); + termios->c_cflag |= CS8; +} From fc3cecb36102f3f431938728f25be7bb1dc381a1 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 16 Oct 2011 16:57:06 +0000 Subject: [PATCH 405/702] Support of keyboard id reading. Partially fixes #7963. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42866 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/ps2/ps2_keyboard.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp index fd9ce14a78..fcbf6f686d 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp @@ -61,6 +61,7 @@ static bool sIsExtended = false; static int32 sKeyboardRepeatRate; static bigtime_t sKeyboardRepeatDelay; +static uint8 sKeyboardIds[2]; static status_t @@ -306,6 +307,13 @@ probe_keyboard(void) cmdbyte, status); } } + + status = ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], + PS2_CMD_GET_DEVICE_ID, NULL, 0, sKeyboardIds, sizeof(sKeyboardIds)); + + if (status != B_OK) { + INFO("ps2: cannot read keyboard device id:0x%#08lx\n", status); + } return B_OK; } @@ -384,6 +392,8 @@ keyboard_close(void *_cookie) sHasKeyboardReader = false; if (cookie->is_debugger) sHasDebugReader = false; + + sKeyboardIds[0] = sKeyboardIds[1] = 0; } TRACE("ps2: keyboard_close done\n"); @@ -510,6 +520,11 @@ keyboard_ioctl(void *_cookie, uint32 op, void *buffer, size_t length) } case KB_GET_KEYBOARD_ID: + { + TRACE("ps2: ioctl KB_GET_KEYBOARD_ID\n"); + return user_memcpy(buffer, &sKeyboardIds, sizeof(sKeyboardIds)); + } + case KB_SET_CONTROL_ALT_DEL_TIMEOUT: case KB_CANCEL_CONTROL_ALT_DEL: case KB_DELAY_CONTROL_ALT_DEL: From 3aaf71a60053276ff20beede7f50bf0d35cf1f7a Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 16 Oct 2011 17:19:46 +0000 Subject: [PATCH 406/702] Fix for reported keyboard id endiannes. I'm sorry for the extra noise. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42867 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp index fcbf6f686d..d4a36cd4f6 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp @@ -522,7 +522,8 @@ keyboard_ioctl(void *_cookie, uint32 op, void *buffer, size_t length) case KB_GET_KEYBOARD_ID: { TRACE("ps2: ioctl KB_GET_KEYBOARD_ID\n"); - return user_memcpy(buffer, &sKeyboardIds, sizeof(sKeyboardIds)); + uint16 keyboardId = sKeyboardIds[1] << 8 | sKeyboardIds[0]; + return user_memcpy(buffer, &keyboardId, sizeof(keyboardId)); } case KB_SET_CONTROL_ALT_DEL_TIMEOUT: From 9e2e0d8dacfbf49553256dadb0a3b40f494c1774 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 16 Oct 2011 19:36:02 +0000 Subject: [PATCH 407/702] Make some more SandyBridge specifics into Platform Control Hub (PCH) specifics. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42868 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/intel_extreme/intel_extreme.h | 5 +++++ .../accelerants/intel_extreme/accelerant.cpp | 6 +++--- src/add-ons/accelerants/intel_extreme/dpms.cpp | 14 +++++++------- .../graphics/intel_extreme/intel_extreme.cpp | 12 ++++++------ 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index d4828d13ab..6158d4b413 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -119,6 +119,11 @@ struct DeviceType { { return (type & INTEL_TYPE_MODEL_MASK) == model; } + + bool HasPlatformControlHub() const + { + return InGroup(INTEL_TYPE_SNB); + } }; // info about PLL on graphics card diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.cpp b/src/add-ons/accelerants/intel_extreme/accelerant.cpp index 465f9b6fde..095251de24 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant.cpp +++ b/src/add-ons/accelerants/intel_extreme/accelerant.cpp @@ -209,9 +209,9 @@ intel_init_accelerant(int device) // assume it is the valid panel size.. // Later we query for proper EDID info if it exists, or figure something // else out. (Default modes, etc.) - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - if ((isSNB && (lvds & PCH_LVDS_DETECTED) != 0) - || (!isSNB && (lvds & DISPLAY_PIPE_ENABLED) != 0)) { + bool hasPCH = gInfo->shared_info->device_type.HasPlatformControlHub(); + if ((hasPCH && (lvds & PCH_LVDS_DETECTED) != 0) + || (!hasPCH && (lvds & DISPLAY_PIPE_ENABLED) != 0)) { save_lvds_mode(); gInfo->head_mode |= HEAD_MODE_LVDS_PANEL; } diff --git a/src/add-ons/accelerants/intel_extreme/dpms.cpp b/src/add-ons/accelerants/intel_extreme/dpms.cpp index bbd2ec37bd..21820743a3 100644 --- a/src/add-ons/accelerants/intel_extreme/dpms.cpp +++ b/src/add-ons/accelerants/intel_extreme/dpms.cpp @@ -95,14 +95,14 @@ enable_display_pipe(bool enable) static void enable_lvds_panel(bool enable) { - bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); - if (isSNB) { - // TODO: fix for SNB + bool hasPCH = gInfo->shared_info->device_type.HasPlatformControlHub(); + if (hasPCH) { + // TODO: fix for PCH return; } - int controlRegister = isSNB ? PCH_PANEL_CONTROL : INTEL_PANEL_CONTROL; - int statusRegister = isSNB ? PCH_PANEL_STATUS : INTEL_PANEL_STATUS; + int controlRegister = hasPCH ? PCH_PANEL_CONTROL : INTEL_PANEL_CONTROL; + int statusRegister = hasPCH ? PCH_PANEL_STATUS : INTEL_PANEL_STATUS; uint32 control = read32(controlRegister); uint32 panelStatus; @@ -110,7 +110,7 @@ enable_lvds_panel(bool enable) if (enable) { if ((control & PANEL_CONTROL_POWER_TARGET_ON) == 0) { write32(controlRegister, control | PANEL_CONTROL_POWER_TARGET_ON - | (isSNB ? PANEL_REGISTER_UNLOCK : 0)); + | (hasPCH ? PANEL_REGISTER_UNLOCK : 0)); } do { @@ -119,7 +119,7 @@ enable_lvds_panel(bool enable) } else { if ((control & PANEL_CONTROL_POWER_TARGET_ON) != 0) { write32(controlRegister, (control & ~PANEL_CONTROL_POWER_TARGET_ON) - | (isSNB ? PANEL_REGISTER_UNLOCK : 0)); + | (hasPCH ? PANEL_REGISTER_UNLOCK : 0)); } do { diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index 7e445d218d..9cfd428b0b 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -83,8 +83,8 @@ intel_interrupt_handler(void* data) int32 handled = B_HANDLED_INTERRUPT; // TODO: verify that these aren't actually the same - bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); - uint16 mask = isSNB ? PCH_INTERRUPT_VBLANK_PIPEA : INTERRUPT_VBLANK_PIPEA; + bool hasPCH = info.device_type.HasPlatformControlHub(); + uint16 mask = hasPCH ? PCH_INTERRUPT_VBLANK_PIPEA : INTERRUPT_VBLANK_PIPEA; if ((identity & mask) != 0) { handled = release_vblank_sem(info); @@ -93,7 +93,7 @@ intel_interrupt_handler(void* data) DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); } - mask = isSNB ? PCH_INTERRUPT_VBLANK_PIPEB : INTERRUPT_VBLANK_PIPEB; + mask = hasPCH ? PCH_INTERRUPT_VBLANK_PIPEB : INTERRUPT_VBLANK_PIPEB; if ((identity & mask) != 0) { handled = release_vblank_sem(info); @@ -145,8 +145,8 @@ init_interrupt_handler(intel_info &info) write16(info, INTEL_INTERRUPT_IDENTITY, ~0); // enable interrupts - we only want VBLANK interrupts - bool isSNB = info.device_type.InGroup(INTEL_TYPE_SNB); - uint16 enable = isSNB + bool hasPCH = info.device_type.HasPlatformControlHub(); + uint16 enable = hasPCH ? (PCH_INTERRUPT_VBLANK_PIPEA | PCH_INTERRUPT_VBLANK_PIPEB) : (INTERRUPT_VBLANK_PIPEA | INTERRUPT_VBLANK_PIPEB); @@ -248,7 +248,7 @@ intel_extreme_init(intel_info &info) blocks[REGISTER_BLOCK(REGS_FLAT)] = 0; // setup the register blocks for the different architectures - if (info.device_type.InGroup(INTEL_TYPE_SNB)) { + if (info.device_type.HasPlatformControlHub()) { // PCH based platforms (IronLake and up) blocks[REGISTER_BLOCK(REGS_INTERRUPT)] = PCH_DE_INTERRUPT_REGISTER_BASE; From c0cb09baee3bffd53702c25c6b7d3c990df1d8fd Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 16 Oct 2011 20:02:56 +0000 Subject: [PATCH 408/702] * Add a couple more SandyBridge IDs. They might work, but I can't test them. * Also add the definitions and some specifics for IronLake (ILK), but keep the IDs disabled as at least the one version I can test with doesn't work yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42869 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 9 +++++++-- .../accelerants/intel_extreme/hooks.cpp | 1 + .../accelerants/intel_extreme/mode.cpp | 4 +++- .../kernel/busses/agp_gart/intel_gart.cpp | 20 ++++++++++++++++--- .../drivers/graphics/intel_extreme/driver.cpp | 13 +++++++++++- .../graphics/intel_extreme/intel_extreme.cpp | 5 ++++- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index 6158d4b413..5b9609ef70 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -34,8 +34,10 @@ #define INTEL_TYPE_Gxx (INTEL_TYPE_9xx | 0x0200) #define INTEL_TYPE_G4x (INTEL_TYPE_9xx | 0x0400) #define INTEL_TYPE_IGD (INTEL_TYPE_9xx | 0x0800) -#define INTEL_TYPE_SNB (INTEL_TYPE_9xx | 0x1000) +#define INTEL_TYPE_ILK (INTEL_TYPE_9xx | 0x1000) +#define INTEL_TYPE_SNB (INTEL_TYPE_9xx | 0x2000) // models +#define INTEL_TYPE_SERVER 0x0004 #define INTEL_TYPE_MOBILE 0x0008 #define INTEL_TYPE_915 (INTEL_TYPE_91x) #define INTEL_TYPE_915M (INTEL_TYPE_91x | INTEL_TYPE_MOBILE) @@ -48,8 +50,11 @@ #define INTEL_TYPE_GM45 (INTEL_TYPE_G4x | INTEL_TYPE_MOBILE) #define INTEL_TYPE_IGDG (INTEL_TYPE_IGD) #define INTEL_TYPE_IGDGM (INTEL_TYPE_IGD | INTEL_TYPE_MOBILE) +#define INTEL_TYPE_ILKG (INTEL_TYPE_ILK) +#define INTEL_TYPE_ILKGM (INTEL_TYPE_ILK | INTEL_TYPE_MOBILE) #define INTEL_TYPE_SNBG (INTEL_TYPE_SNB) #define INTEL_TYPE_SNBGM (INTEL_TYPE_SNB | INTEL_TYPE_MOBILE) +#define INTEL_TYPE_SNBGS (INTEL_TYPE_SNB | INTEL_TYPE_SERVER) #define DEVICE_NAME "intel_extreme" #define INTEL_ACCELERANT_NAME "intel_extreme.accelerant" @@ -122,7 +127,7 @@ struct DeviceType { bool HasPlatformControlHub() const { - return InGroup(INTEL_TYPE_SNB); + return InGroup(INTEL_TYPE_ILK) || InGroup(INTEL_TYPE_SNB); } }; diff --git a/src/add-ons/accelerants/intel_extreme/hooks.cpp b/src/add-ons/accelerants/intel_extreme/hooks.cpp index eeedee226a..b8c1b86a86 100644 --- a/src/add-ons/accelerants/intel_extreme/hooks.cpp +++ b/src/add-ons/accelerants/intel_extreme/hooks.cpp @@ -116,6 +116,7 @@ get_accelerant_hook(uint32 feature, void* data) || gInfo->shared_info->device_type.IsModel(INTEL_TYPE_965M) || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_G4x) || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_IGD) + || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_ILK) || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB)) return NULL; diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index c14f213b51..afb8b4baae 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -137,6 +137,7 @@ set_frame_buffer_base() if (sharedInfo.device_type.InGroup(INTEL_TYPE_96x) || sharedInfo.device_type.InGroup(INTEL_TYPE_G4x) + || sharedInfo.device_type.InGroup(INTEL_TYPE_ILK) || sharedInfo.device_type.InGroup(INTEL_TYPE_SNB)) { write32(baseRegister, mode.v_display_start * sharedInfo.bytes_per_row + mode.h_display_start * (sharedInfo.bits_per_pixel + 7) / 8); @@ -239,7 +240,8 @@ get_pll_limits(pll_limits &limits) // Note, the limits are taken from the X driver; they have not yet been // tested - if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB)) { + if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_ILK) + || gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB)) { // TODO: support LVDS output limits as well static const pll_limits kLimits = { // p, p1, p2, high, n, m, m1, m2 diff --git a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp index 5e3b0923fe..8f3eb6bfe1 100644 --- a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp +++ b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp @@ -81,7 +81,20 @@ const struct supported_device { {0xa000, 0xa001, INTEL_TYPE_IGDG, "Atom_Dx10"}, {0xa010, 0xa011, INTEL_TYPE_IGDGM, "Atom_N4x0"}, - {0x0104, 0x0126, INTEL_TYPE_SNBGM, "SNBGM"}, +#if 0 + {0x0040, 0x0042, INTEL_TYPE_ILKG, "IronLake Desktop"}, + {0x0044, 0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, + {0x0062, 0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, + {0x006a, 0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, +#endif + + {0x0100, 0x0102, INTEL_TYPE_SNBG, "SandyBridge Desktop GT1"}, + {0x0100, 0x0112, INTEL_TYPE_SNBG, "SandyBridge Desktop GT2"}, + {0x0100, 0x0122, INTEL_TYPE_SNBG, "SandyBridge Desktop GT2+"}, + {0x0104, 0x0106, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT1"}, + {0x0104, 0x0116, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2"}, + {0x0104, 0x0126, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2+"}, + {0x0108, 0x010a, INTEL_TYPE_SNBGS, "SandyBridge Server"} }; struct intel_info { @@ -164,7 +177,8 @@ determine_memory_sizes(intel_info &info, size_t >tSize, size_t &stolenSize) gttSize = 2 << 20; break; } - } else if ((info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_G4x) { + } else if ((info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_G4x + || (info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_ILK) { switch (memoryConfig & G4X_GTT_MASK) { case G4X_GTT_NONE: gttSize = 0; @@ -395,6 +409,7 @@ intel_map(intel_info &info) if ((info.type & INTEL_TYPE_FAMILY_MASK) == INTEL_TYPE_9xx) { if ((info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_G4x + || (info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_ILK || (info.type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_SNB) { info.gtt_physical_base = info.display.u.h0.base_registers[mmioIndex] + (2UL << 20); @@ -601,7 +616,6 @@ intel_init() sInfo.type = kSupportedDevices[i].type; found = has_display_device(sInfo.display, kSupportedDevices[i].display_id); - break; } } diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp index 5a0329df11..5c3c20be26 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp @@ -73,7 +73,18 @@ const struct supported_device { {0xa001, INTEL_TYPE_IGDG, "Atom_Dx10"}, {0xa011, INTEL_TYPE_IGDGM, "Atom_N4x0"}, - {0x0126, INTEL_TYPE_SNBGM, "SNBGM"}, + {0x0042, INTEL_TYPE_ILKG, "IronLake Desktop"}, + {0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, + {0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, + {0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, + + {0x0102, INTEL_TYPE_SNBG, "SandyBridge Desktop GT1"}, + {0x0112, INTEL_TYPE_SNBG, "SandyBridge Desktop GT2"}, + {0x0122, INTEL_TYPE_SNBG, "SandyBridge Desktop GT2+"}, + {0x0106, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT1"}, + {0x0116, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2"}, + {0x0126, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2+"}, + {0x010a, INTEL_TYPE_SNBGS, "SandyBridge Server"} }; int32 api_version = B_CUR_DRIVER_API_VERSION; diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index 9cfd428b0b..b8a268c3d9 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -302,8 +302,11 @@ intel_extreme_init(intel_info &info) dprintf("i965GM/i965GME quirk\n"); write32(info, 0x6204, (1L << 29)); } else if (info.device_type.InGroup(INTEL_TYPE_SNB)) { - dprintf("SNB clock gating\n"); + dprintf("SandyBridge clock gating\n"); write32(info, 0x42020, (1L << 28) | (1L << 7) | (1L << 5)); + } else if (info.device_type.InGroup(INTEL_TYPE_ILK)) { + dprintf("IronLake clock gating\n"); + write32(info, 0x42020, (1L << 7) | (1L << 5)); } else if (info.device_type.InGroup(INTEL_TYPE_G4x)) { dprintf("G4x clock gating\n"); write32(info, 0x6204, 0); From 1f75663ca6601b1960c4e91b7e586e7d7bc27dd6 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 16 Oct 2011 20:48:54 +0000 Subject: [PATCH 409/702] Remove the interrupt register block. These aren't actually identitiy mapped (they are actually reversed), so introduce a find_reg() inline function to map such regs individually instead. Should fix interrupt storms on SandyBridge. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42870 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 30 ++++++++++--------- .../graphics/intel_extreme/intel_extreme.cpp | 19 +++++------- .../intel_extreme/intel_extreme_private.h | 28 +++++++++++++++++ 3 files changed, 51 insertions(+), 26 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index 5b9609ef70..5dc744d1f8 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -61,7 +61,7 @@ // We encode the register block into the value and extract/translate it when // actually accessing. -#define REGISTER_BLOCK_COUNT 7 +#define REGISTER_BLOCK_COUNT 6 #define REGISTER_BLOCK_SHIFT 24 #define REGISTER_BLOCK_MASK 0xff000000 #define REGISTER_REGISTER_MASK 0x00ffffff @@ -69,15 +69,13 @@ #define REGISTER_REGISTER(x) (x & REGISTER_REGISTER_MASK) #define REGS_FLAT (0 << REGISTER_BLOCK_SHIFT) -#define REGS_INTERRUPT (1 << REGISTER_BLOCK_SHIFT) -#define REGS_NORTH_SHARED (2 << REGISTER_BLOCK_SHIFT) -#define REGS_NORTH_PIPE_AND_PORT (3 << REGISTER_BLOCK_SHIFT) -#define REGS_NORTH_PLANE_CONTROL (4 << REGISTER_BLOCK_SHIFT) -#define REGS_SOUTH_SHARED (5 << REGISTER_BLOCK_SHIFT) -#define REGS_SOUTH_TRANSCODER_PORT (6 << REGISTER_BLOCK_SHIFT) +#define REGS_NORTH_SHARED (1 << REGISTER_BLOCK_SHIFT) +#define REGS_NORTH_PIPE_AND_PORT (2 << REGISTER_BLOCK_SHIFT) +#define REGS_NORTH_PLANE_CONTROL (3 << REGISTER_BLOCK_SHIFT) +#define REGS_SOUTH_SHARED (4 << REGISTER_BLOCK_SHIFT) +#define REGS_SOUTH_TRANSCODER_PORT (5 << REGISTER_BLOCK_SHIFT) // register blocks for (G)MCH/ICH based platforms -#define MCH_INTERRUPT_REGISTER_BASE 0x020a0 #define MCH_SHARED_REGISTER_BASE 0x00000 #define MCH_PIPE_AND_PORT_REGISTER_BASE 0x60000 #define MCH_PLANE_CONTROL_REGISTER_BASE 0x70000 @@ -88,7 +86,6 @@ // to a PCH based one, that means anything that used to communicate via (G)MCH // registers needs to use different ones on PCH based platforms (Ironlake and // up, SandyBridge, etc.). -#define PCH_DE_INTERRUPT_REGISTER_BASE 0x44000 #define PCH_NORTH_SHARED_REGISTER_BASE 0x40000 #define PCH_NORTH_PIPE_AND_PORT_REGISTER_BASE 0x60000 #define PCH_NORTH_PLANE_CONTROL_REGISTER_BASE 0x70000 @@ -338,13 +335,18 @@ struct intel_free_graphics_memory { #define INTEL_RING_BUFFER_ENABLED 1 // interrupts -#define INTEL_INTERRUPT_ENABLED (0x0000 | REGS_INTERRUPT) -#define INTEL_INTERRUPT_IDENTITY (0x0004 | REGS_INTERRUPT) -#define INTEL_INTERRUPT_MASK (0x0008 | REGS_INTERRUPT) -#define INTEL_INTERRUPT_STATUS (0x000c | REGS_INTERRUPT) +#define INTEL_INTERRUPT_ENABLED 0x02a0 +#define INTEL_INTERRUPT_IDENTITY 0x02a4 +#define INTEL_INTERRUPT_MASK 0x02a8 +#define INTEL_INTERRUPT_STATUS 0x02ac #define INTERRUPT_VBLANK_PIPEA (1 << 7) #define INTERRUPT_VBLANK_PIPEB (1 << 5) -// TODO: verify that these are actually different on older versions + +// PCH interrupts +#define PCH_INTERRUPT_STATUS 0x44000 +#define PCH_INTERRUPT_MASK 0x44004 +#define PCH_INTERRUPT_IDENTITY 0x44008 +#define PCH_INTERRUPT_ENABLED 0x4400c #define PCH_INTERRUPT_VBLANK_PIPEA (1 << 7) #define PCH_INTERRUPT_VBLANK_PIPEB (1 << 15) diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index b8a268c3d9..850184288f 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -76,7 +76,7 @@ intel_interrupt_handler(void* data) { intel_info &info = *(intel_info*)data; - uint16 identity = read16(info, INTEL_INTERRUPT_IDENTITY); + uint16 identity = read16(info, find_reg(info, INTEL_INTERRUPT_IDENTITY)); if (identity == 0) return B_UNHANDLED_INTERRUPT; @@ -103,7 +103,7 @@ intel_interrupt_handler(void* data) } // setting the bit clears it! - write16(info, INTEL_INTERRUPT_IDENTITY, identity); + write16(info, find_reg(info, INTEL_INTERRUPT_IDENTITY), identity); return handled; } @@ -142,7 +142,7 @@ init_interrupt_handler(intel_info &info) write32(info, INTEL_DISPLAY_B_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); - write16(info, INTEL_INTERRUPT_IDENTITY, ~0); + write16(info, find_reg(info, INTEL_INTERRUPT_IDENTITY), ~0); // enable interrupts - we only want VBLANK interrupts bool hasPCH = info.device_type.HasPlatformControlHub(); @@ -150,9 +150,8 @@ init_interrupt_handler(intel_info &info) ? (PCH_INTERRUPT_VBLANK_PIPEA | PCH_INTERRUPT_VBLANK_PIPEB) : (INTERRUPT_VBLANK_PIPEA | INTERRUPT_VBLANK_PIPEB); - write16(info, INTEL_INTERRUPT_ENABLED, - read16(info, INTEL_INTERRUPT_ENABLED) | enable); - write16(info, INTEL_INTERRUPT_MASK, ~enable); + write16(info, find_reg(info, INTEL_INTERRUPT_ENABLED), enable); + write16(info, find_reg(info, INTEL_INTERRUPT_MASK), ~enable); } } if (status < B_OK) { @@ -250,8 +249,6 @@ intel_extreme_init(intel_info &info) // setup the register blocks for the different architectures if (info.device_type.HasPlatformControlHub()) { // PCH based platforms (IronLake and up) - blocks[REGISTER_BLOCK(REGS_INTERRUPT)] - = PCH_DE_INTERRUPT_REGISTER_BASE; blocks[REGISTER_BLOCK(REGS_NORTH_SHARED)] = PCH_NORTH_SHARED_REGISTER_BASE; blocks[REGISTER_BLOCK(REGS_NORTH_PIPE_AND_PORT)] @@ -264,8 +261,6 @@ intel_extreme_init(intel_info &info) = PCH_SOUTH_TRANSCODER_AND_PORT_REGISTER_BASE; } else { // (G)MCH/ICH based platforms - blocks[REGISTER_BLOCK(REGS_INTERRUPT)] - = MCH_INTERRUPT_REGISTER_BASE; blocks[REGISTER_BLOCK(REGS_NORTH_SHARED)] = MCH_SHARED_REGISTER_BASE; blocks[REGISTER_BLOCK(REGS_NORTH_PIPE_AND_PORT)] @@ -401,8 +396,8 @@ intel_extreme_uninit(intel_info &info) if (!info.fake_interrupts && info.shared_info->vblank_sem > 0) { // disable interrupt generation - write16(info, INTEL_INTERRUPT_ENABLED, 0); - write16(info, INTEL_INTERRUPT_MASK, ~0); + write16(info, find_reg(info, INTEL_INTERRUPT_ENABLED), 0); + write16(info, find_reg(info, INTEL_INTERRUPT_MASK), ~0); remove_io_interrupt_handler(info.pci->u.h0.interrupt_line, intel_interrupt_handler, &info); diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h index 906395d4de..15e3efc966 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h @@ -39,6 +39,34 @@ struct intel_info { DeviceType device_type; }; + +static inline uint32 +find_reg(const intel_info& info, uint32 target) +{ + if (REGISTER_BLOCK(target) != REGS_FLAT) { + panic("find_reg is only supposed to be used for unrouped registers\n"); + return target; + } + + if (!info.device_type.HasPlatformControlHub()) + return target; + + #define RETURN_REG(x) case INTEL_##x: return PCH_##x; + + switch (target) { + RETURN_REG(INTERRUPT_ENABLED) + RETURN_REG(INTERRUPT_IDENTITY) + RETURN_REG(INTERRUPT_MASK) + RETURN_REG(INTERRUPT_STATUS) + } + + #undef RETURN_REG; + + panic("find_reg didn't have any matching register\n"); + return target; +} + + extern status_t intel_free_memory(intel_info& info, addr_t offset); extern status_t intel_allocate_memory(intel_info& info, size_t size, size_t alignment, uint32 flags, addr_t* _offset, From ecb5cbe97dafd045eb98a9a58c2bb4657c86b7a8 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 16 Oct 2011 21:53:26 +0000 Subject: [PATCH 410/702] Enable the IronLake devices as at least mine works now with the correct interrupt registers being used. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42871 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/agp_gart/intel_gart.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp index 8f3eb6bfe1..4a48e76a45 100644 --- a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp +++ b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp @@ -81,12 +81,10 @@ const struct supported_device { {0xa000, 0xa001, INTEL_TYPE_IGDG, "Atom_Dx10"}, {0xa010, 0xa011, INTEL_TYPE_IGDGM, "Atom_N4x0"}, -#if 0 {0x0040, 0x0042, INTEL_TYPE_ILKG, "IronLake Desktop"}, {0x0044, 0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, {0x0062, 0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, {0x006a, 0x0046, INTEL_TYPE_ILKGM, "IronLake Mobile"}, -#endif {0x0100, 0x0102, INTEL_TYPE_SNBG, "SandyBridge Desktop GT1"}, {0x0100, 0x0112, INTEL_TYPE_SNBG, "SandyBridge Desktop GT2"}, From 4254fc37051c1dc1728b362f526164df696c57ef Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 16 Oct 2011 22:00:30 +0000 Subject: [PATCH 411/702] Fix wrong register values introduced in r42870. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42872 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/intel_extreme/intel_extreme.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index 5dc744d1f8..aed1be324e 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -335,10 +335,10 @@ struct intel_free_graphics_memory { #define INTEL_RING_BUFFER_ENABLED 1 // interrupts -#define INTEL_INTERRUPT_ENABLED 0x02a0 -#define INTEL_INTERRUPT_IDENTITY 0x02a4 -#define INTEL_INTERRUPT_MASK 0x02a8 -#define INTEL_INTERRUPT_STATUS 0x02ac +#define INTEL_INTERRUPT_ENABLED 0x020a0 +#define INTEL_INTERRUPT_IDENTITY 0x020a4 +#define INTEL_INTERRUPT_MASK 0x020a8 +#define INTEL_INTERRUPT_STATUS 0x020ac #define INTERRUPT_VBLANK_PIPEA (1 << 7) #define INTERRUPT_VBLANK_PIPEB (1 << 5) From 05a2fee65016aca7f143f1607580f5e28eb98238 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 17 Oct 2011 14:13:42 +0000 Subject: [PATCH 412/702] * add varying PLL calculations as directed by AtomBIOS * don't set referenceDivider as minimum unless directed to by AtomBIOS git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42873 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/pll.cpp | 58 +++++++++++++++-------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 502780769e..0ce54bd143 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -127,8 +127,10 @@ pll_compute_post_divider(pll_info *pll) { radeon_shared_info &info = *gInfo->shared_info; - if ((pll->flags & PLL_USE_POST_DIV) != 0) + if ((pll->flags & PLL_USE_POST_DIV) != 0) { + TRACE("%s: using AtomBIOS post divider\n", __func__); return; + } uint32 vco; if (info.device_chipset < (RADEON_R700 | 0x70)) { @@ -175,27 +177,43 @@ pll_compute(pll_info *pll) pll->feedbackDiv = 0; pll->feedbackDivFrac = 0; - pll->referenceDiv = pll->minRefDiv; - uint32 referenceFrequency = pll->referenceFreq; - // if RADEON_PLL_USE_REF_DIV - // ref_div = pll->reference_div; + if ((pll->flags & PLL_USE_REF_DIV) != 0) { + TRACE("%s: using AtomBIOS reference divider\n", __func__); + return B_OK; + } else { + pll->referenceDiv = pll->minRefDiv; + } + + if ((pll->flags & PLL_USE_FRAC_FB_DIV) != 0) { + TRACE("%s: using AtomBIOS fractional feedback divider\n", __func__); + + uint32 tmp = pll->postDiv * pll->referenceDiv; + tmp *= targetClock; + pll->feedbackDiv = tmp / pll->referenceFreq; + pll->feedbackDivFrac = tmp % pll->referenceFreq; + + if (pll->feedbackDiv > pll->maxFeedbackDiv) + pll->feedbackDiv = pll->maxFeedbackDiv; + else if (pll->feedbackDiv < pll->minFeedbackDiv) + pll->feedbackDiv = pll->minFeedbackDiv; + + pll->feedbackDivFrac + = (100 * pll->feedbackDivFrac) / pll->referenceFreq; + + if (pll->feedbackDivFrac >= 5) { + pll->feedbackDivFrac -= 5; + pll->feedbackDivFrac /= 10; + pll->feedbackDivFrac++; + } + if (pll->feedbackDivFrac >= 10) { + pll->feedbackDiv++; + pll->feedbackDivFrac = 0; + } + } else { + TRACE("%s: performing fractional feedback calculations\n", __func__); - // if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { - // avivo_get_fb_div(pll, targetClock, postDivider, referenceDivider, - // &feedbackDivider, &feedbackDividerFrac); - // feedbackDividerFrac = (100 * feedbackDividerFrac) / pll->reference_freq; - // if (frac_fb_div >= 5) { - // frac_fb_div -= 5; - // frac_fb_div = frac_fb_div / 10; - // frac_fb_div++; - // } - // if (frac_fb_div >= 10) { - // fb_div++; - // frac_fb_div = 0; - // } - // } else { while (pll->referenceDiv <= pll->maxRefDiv) { // get feedback divider uint32 retroEncabulator = pll->postDiv * pll->referenceDiv; @@ -235,7 +253,7 @@ pll_compute(pll_info *pll) else pll->referenceDiv++; } - // } + } if (pll->referenceDiv == 0 || pll->postDiv == 0) { TRACE("%s: Caught division by zero of post or reference divider\n", From 96eb5a46fdc54393d4e279740542c1b970adaea4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 17 Oct 2011 19:19:13 +0000 Subject: [PATCH 413/702] * increase tolerance checking as we store kHz vs 10kHz units git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42874 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/pll.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 0ce54bd143..21b723bbcc 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -244,11 +244,11 @@ pll_compute(pll_info *pll) } uint32 tmp = (referenceFrequency * pll->feedbackDiv) / (pll->postDiv * pll->referenceDiv); - tmp = (tmp * 10000) / targetClock; + tmp = (tmp * 100000) / targetClock; - if (tmp > (10000 + MAX_TOLERANCE)) + if (tmp > (100000 + (MAX_TOLERANCE * 10))) pll->referenceDiv++; - else if (tmp >= (10000 - MAX_TOLERANCE)) + else if (tmp >= (100000 - (MAX_TOLERANCE * 10))) break; else pll->referenceDiv++; From 8a66cb4c634fffa3b37941b71c313ddf49724bd4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 17 Oct 2011 20:51:26 +0000 Subject: [PATCH 414/702] * add Radeon HD PCI ID card from a dell laptop git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42875 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 1d65b645d4..24c5a43a33 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -97,6 +97,7 @@ const struct supported_device { {0x9552, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, {0x9555, RADEON_R700 | 0x10, false, "Radeon HD 4350"}, {0x9540, RADEON_R700 | 0x10, false, "Radeon HD 4550"}, + {0x9480, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, {0x9498, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, {0x94b4, RADEON_R700 | 0x40, false, "Radeon HD 4700"}, {0x9490, RADEON_R700 | 0x30, false, "Radeon HD 4710"}, From 86a5585b2d127c8cd8c8207db9904f8d9953e622 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 17 Oct 2011 22:18:53 +0000 Subject: [PATCH 415/702] * redo 42874 in the right direction * fix a order of operations bug * fix a few long lines * pll computation should now be correct git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42876 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/pll.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 21b723bbcc..28b2a05387 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -237,18 +237,21 @@ pll_compute(pll_info *pll) || pll->postDiv == 0 || targetClock == 0) { TRACE("%s: Caught division by zero!\n", __func__); - TRACE("%s: referenceDiv %" B_PRIu32 "\n", __func__, pll->referenceDiv); - TRACE("%s: postDiv %" B_PRIu32 "\n", __func__, pll->postDiv); - TRACE("%s: targetClock %" B_PRIu32 "\n", __func__, targetClock); + TRACE("%s: referenceDiv %" B_PRIu32 "\n", + __func__, pll->referenceDiv); + TRACE("%s: postDiv %" B_PRIu32 "\n", + __func__, pll->postDiv); + TRACE("%s: targetClock %" B_PRIu32 "\n", + __func__, targetClock); return B_ERROR; } uint32 tmp = (referenceFrequency * pll->feedbackDiv) / (pll->postDiv * pll->referenceDiv); - tmp = (tmp * 100000) / targetClock; + tmp = (tmp * 1000) / targetClock; - if (tmp > (100000 + (MAX_TOLERANCE * 10))) + if (tmp > (1000 + (MAX_TOLERANCE / 10))) pll->referenceDiv++; - else if (tmp >= (100000 - (MAX_TOLERANCE * 10))) + else if (tmp >= (1000 - (MAX_TOLERANCE / 10))) break; else pll->referenceDiv++; @@ -262,9 +265,9 @@ pll_compute(pll_info *pll) } uint32 calculatedClock - = (referenceFrequency * pll->feedbackDiv) - + (referenceFrequency * pll->feedbackDivFrac) - / (pll->referenceDiv * pll->postDiv); + = ((referenceFrequency * pll->feedbackDiv * 10) + + (referenceFrequency * pll->feedbackDivFrac)) + / (pll->referenceDiv * pll->postDiv * 10); TRACE("%s: pixel clock: %" B_PRIu32 " gives:" " feedbackDivider = %" B_PRIu32 ".%" B_PRIu32 From 756fb8b7964aedbadad260cec62997d753ddd401 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 17 Oct 2011 22:49:44 +0000 Subject: [PATCH 416/702] * fix pll limitations probing * radeon HD mode setting on analog monitors is now working! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42877 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/pll.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 28b2a05387..7799bda2fc 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -69,24 +69,24 @@ pll_limit_probe(pll_info *pll) } else { pll->pllOutMin = B_LENDIAN_TO_HOST_INT32( - firmwareInfo->info_12.ulMinPixelClockPLL_Output); + firmwareInfo->info_12.ulMinPixelClockPLL_Output) * 10; } pll->pllOutMax = B_LENDIAN_TO_HOST_INT32( - firmwareInfo->info.ulMaxPixelClockPLL_Output); + firmwareInfo->info.ulMaxPixelClockPLL_Output) * 10; if (tableMinor >= 4) { pll->lcdPllOutMin = B_LENDIAN_TO_HOST_INT16( - firmwareInfo->info_14.usLcdMinPixelClockPLL_Output) * 100; + firmwareInfo->info_14.usLcdMinPixelClockPLL_Output) * 1000; if (pll->lcdPllOutMin == 0) pll->lcdPllOutMin = pll->pllOutMin; pll->lcdPllOutMax = B_LENDIAN_TO_HOST_INT16( - firmwareInfo->info_14.usLcdMaxPixelClockPLL_Output) * 100; + firmwareInfo->info_14.usLcdMaxPixelClockPLL_Output) * 1000; if (pll->lcdPllOutMax == 0) pll->lcdPllOutMax = pll->pllOutMax; From a4f66979fe6b62e658496d993a65c95e0c9a138e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 18 Oct 2011 03:34:28 +0000 Subject: [PATCH 417/702] * fix minimum pll out units * sort files in Jamfile * add TV and compontent video support in encoder code * fix missing var in display detection code git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42878 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/Jamfile | 12 ++--- src/add-ons/accelerants/radeon_hd/display.cpp | 2 +- src/add-ons/accelerants/radeon_hd/encoder.cpp | 53 +++++++++---------- src/add-ons/accelerants/radeon_hd/pll.cpp | 2 +- 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile b/src/add-ons/accelerants/radeon_hd/Jamfile index 4d98f23328..f72e18bd76 100644 --- a/src/add-ons/accelerants/radeon_hd/Jamfile +++ b/src/add-ons/accelerants/radeon_hd/Jamfile @@ -10,16 +10,16 @@ UsePrivateHeaders [ FDirName graphics radeon_hd ] ; UsePrivateHeaders [ FDirName graphics common ] ; Addon radeon_hd.accelerant : - atom.cpp - gpu.cpp accelerant.cpp + atom.cpp + create_display_modes.cpp + bios.cpp + display.cpp encoder.cpp engine.cpp + gpu.cpp hooks.cpp - pll.cpp - display.cpp mode.cpp - bios.cpp - create_display_modes.cpp + pll.cpp : be libaccelerantscommon.a ; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 2fe20de60a..c79933f198 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -665,7 +665,7 @@ detect_displays() // There is only one ddc communications path on DVI-I if (encoder_analog_load_detect(id) != true) { TRACE("%s: no analog load on EDID valid connector " - "#%" B_PRIu32 "\n", __func__); + "#%" B_PRIu32 "\n", __func__, id); continue; } } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 4547209dbb..543e458c81 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -54,6 +54,7 @@ encoder_assign_crtc(uint8 crtcID) uint16 connectorIndex = gDisplay[crtcID]->connectorIndex; uint16 encoderID = gConnector[connectorIndex]->encoder.objectID; + uint16 encoderFlags = gConnector[connectorIndex]->encoder.flags; switch (tableMajor) { case 1: @@ -81,24 +82,22 @@ encoder_assign_crtc(uint8 crtcID) break; case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: - //if (radeon_encoder->active_device - // & (ATOM_DEVICE_TV_SUPPORT)) - // args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; - //else if (radeon_encoder->active_device - // & (ATOM_DEVICE_CV_SUPPORT)) - // args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; - //else + if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0) { + args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; + } else if ((encoderFlags + & ATOM_DEVICE_CV_SUPPORT) != 0) { + args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; + } else args.v1.ucDevice = ATOM_DEVICE_CRT1_INDEX; break; case ENCODER_OBJECT_ID_INTERNAL_DAC2: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: - //if (radeon_encoder->active_device - // & (ATOM_DEVICE_TV_SUPPORT)) - // args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; - //else if (radeon_encoder->active_device - // & (ATOM_DEVICE_CV_SUPPORT)) - // args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; - //else + if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0) { + args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; + } else if ((encoderFlags + & ATOM_DEVICE_CV_SUPPORT) != 0) { + args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; + } else args.v1.ucDevice = ATOM_DEVICE_CRT2_INDEX; break; } @@ -140,23 +139,21 @@ encoder_assign_crtc(uint8 crtcID) args.v2.ucEncoderID = ASIC_INT_DVO_ENCODER_ID; break; case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: - //if (radeon_encoder->active_device - // & (ATOM_DEVICE_TV_SUPPORT)) - // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; - //else if (radeon_encoder->active_device - // & (ATOM_DEVICE_CV_SUPPORT)) - // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; - //else + if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0) { + args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + } else if ((encoderFlags + & ATOM_DEVICE_CV_SUPPORT) != 0) { + args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + } else args.v2.ucEncoderID = ASIC_INT_DAC1_ENCODER_ID; break; case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: - //if (radeon_encoder->active_device - // & (ATOM_DEVICE_TV_SUPPORT)) - // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; - //else if (radeon_encoder->active_device - // & (ATOM_DEVICE_CV_SUPPORT)) - // args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; - //else + if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0) { + args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + } else if ((encoderFlags + & ATOM_DEVICE_CV_SUPPORT) != 0) { + args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; + } else args.v2.ucEncoderID = ASIC_INT_DAC2_ENCODER_ID; break; } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 7799bda2fc..d94f6c6fde 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -97,7 +97,7 @@ pll_limit_probe(pll_info *pll) } if (pll->pllOutMin == 0) { - pll->pllOutMin = 64800; + pll->pllOutMin = 64800 * 10; // Avivo+ limit } From afbd52f16acc635e8ba1a0a32e1b4d02b8724ce6 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 18 Oct 2011 05:54:28 +0000 Subject: [PATCH 418/702] * improve framebuffer programming on newer cards * correct? color mode setting bug * fix var naming to match style guidelines * add a few missing register defines git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42879 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon_hd/r800_reg.h | 3 + src/add-ons/accelerants/radeon_hd/display.cpp | 104 +++++++++++++----- src/add-ons/accelerants/radeon_hd/display.h | 2 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 3 +- 4 files changed, 81 insertions(+), 31 deletions(-) diff --git a/headers/private/graphics/radeon_hd/r800_reg.h b/headers/private/graphics/radeon_hd/r800_reg.h index 9f45e80a21..0cab35522c 100644 --- a/headers/private/graphics/radeon_hd/r800_reg.h +++ b/headers/private/graphics/radeon_hd/r800_reg.h @@ -117,6 +117,8 @@ #define EVERGREEN_GRPH_Y_START 0x6830 #define EVERGREEN_GRPH_X_END 0x6834 #define EVERGREEN_GRPH_Y_END 0x6838 +#define EVERGREEN_GRPH_FLIP_CONTROL 0x6848 +# define EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN (1 << 0) #define EVERGREEN_CUR_CONTROL 0x6998 # define EVERGREEN_CURSOR_EN (1 << 0) # define EVERGREEN_CURSOR_MODE(x) (((x) & 0x3) << 8) @@ -180,6 +182,7 @@ #define EVERGREEN_CRTC_CONTROL 0x6e70 # define EVERGREEN_CRTC_MASTER_EN (1 << 0) #define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4 +#define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 #define EVERGREEN_DC_GPIO_HPD_MASK 0x64b0 #define EVERGREEN_DC_GPIO_HPD_A 0x64b4 #define EVERGREEN_DC_GPIO_HPD_EN 0x64b8 diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index c79933f198..d074de2c26 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -846,13 +846,18 @@ display_crtc_scale(uint8 crtcID, display_mode *mode) void -display_crtc_fb_set_dce1(uint8 crtcID, display_mode *mode) +display_crtc_fb_set(uint8 crtcID, display_mode *mode) { radeon_shared_info &info = *gInfo->shared_info; register_info* regs = gDisplay[crtcID]->regs; - uint32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; - uint32 fb_format; + uint32 fbSwap; + if (info.device_chipset >= RADEON_R1000) + fbSwap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); + else + fbSwap = R600_D1GRPH_SWAP_ENDIAN_NONE; + + uint32 fbFormat; uint32 bytesPerPixel; uint32 bitsPerPixel; @@ -861,34 +866,63 @@ display_crtc_fb_set_dce1(uint8 crtcID, display_mode *mode) case B_CMAP8: bytesPerPixel = 1; bitsPerPixel = 8; - fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_8BPP - | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; + if (info.device_chipset >= RADEON_R1000) { // DCE4 + fbFormat = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_8BPP) + | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_INDEXED)); + } else { + fbFormat = AVIVO_D1GRPH_CONTROL_DEPTH_8BPP + | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; + } break; case B_RGB15_LITTLE: bytesPerPixel = 2; bitsPerPixel = 15; - fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_16BPP - | AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555; + if (info.device_chipset >= RADEON_R1000) { // DCE4 + fbFormat = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) + | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB1555)); + } else { + fbFormat = AVIVO_D1GRPH_CONTROL_DEPTH_16BPP + | AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555; + } break; case B_RGB16_LITTLE: bytesPerPixel = 2; bitsPerPixel = 16; - fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_16BPP - | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; - #ifdef __POWERPC__ - fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; - #endif + + if (info.device_chipset >= RADEON_R1000) { // DCE4 + fbFormat = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) + | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); + #ifdef __POWERPC__ + fbSwap + = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); + #endif + } else { + fbFormat = AVIVO_D1GRPH_CONTROL_DEPTH_16BPP + | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; + #ifdef __POWERPC__ + fbSwap = R600_D1GRPH_SWAP_ENDIAN_16BIT; + #endif + } break; case B_RGB24_LITTLE: case B_RGB32_LITTLE: default: bytesPerPixel = 4; bitsPerPixel = 32; - fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_32BPP - | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; - #ifdef __POWERPC__ - fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; - #endif + if (info.device_chipset >= RADEON_R1000) { // DCE4 + fbFormat = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) + | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); + #ifdef __POWERPC__ + fbSwap + = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); + #endif + } else { + fbFormat = AVIVO_D1GRPH_CONTROL_DEPTH_32BPP + | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; + #ifdef __POWERPC__ + fbSwap = R600_D1GRPH_SWAP_ENDIAN_32BIT; + #endif + } break; } @@ -898,9 +932,6 @@ display_crtc_fb_set_dce1(uint8 crtcID, display_mode *mode) uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; - Write32(OUT, regs->grphPrimarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); - Write32(OUT, regs->grphSecondarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); - if (info.device_chipset >= (RADEON_R700 | 0x70)) { Write32(OUT, regs->grphPrimarySurfaceAddrHigh, (fbAddressInt >> 32) & 0xf); @@ -908,8 +939,14 @@ display_crtc_fb_set_dce1(uint8 crtcID, display_mode *mode) (fbAddressInt >> 32) & 0xf); } - if (info.device_chipset >= RADEON_R600) - Write32(CRT, regs->grphSwapControl, fb_swap); + Write32(OUT, regs->grphPrimarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); + Write32(OUT, regs->grphSecondarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); + + + if (info.device_chipset >= RADEON_R600) { + Write32(CRT, regs->grphControl, fbFormat); + Write32(CRT, regs->grphSwapControl, fbSwap); + } Write32(CRT, regs->grphSurfaceOffsetX, 0); Write32(CRT, regs->grphSurfaceOffsetY, 0); @@ -931,18 +968,29 @@ display_crtc_fb_set_dce1(uint8 crtcID, display_mode *mode) Write32(CRT, regs->viewportSize, (viewport_w << 16) | viewport_h); - uint32 tmp = Read32(CRT, AVIVO_D1GRPH_FLIP_CONTROL + regs->crtcOffset); - tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; - Write32(OUT, AVIVO_D1GRPH_FLIP_CONTROL + regs->crtcOffset, tmp); + // Pageflip setup + if (info.device_chipset >= RADEON_R1000) { // DCE4 + uint32 tmp + = Read32(OUT, EVERGREEN_GRPH_FLIP_CONTROL + regs->crtcOffset); + tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN; + Write32(OUT, EVERGREEN_GRPH_FLIP_CONTROL + regs->crtcOffset, tmp); - Write32(OUT, AVIVO_D1MODE_MASTER_UPDATE_MODE + regs->crtcOffset, 0); - // Pageflip to happen anywhere in vblank + Write32(OUT, EVERGREEN_MASTER_UPDATE_MODE + regs->crtcOffset, 0); + // Pageflip to happen anywhere in vblank + + } else { + uint32 tmp = Read32(OUT, AVIVO_D1GRPH_FLIP_CONTROL + regs->crtcOffset); + tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; + Write32(OUT, AVIVO_D1GRPH_FLIP_CONTROL + regs->crtcOffset, tmp); + + Write32(OUT, AVIVO_D1MODE_MASTER_UPDATE_MODE + regs->crtcOffset, 0); + // Pageflip to happen anywhere in vblank + } // update shared info gInfo->shared_info->bytes_per_row = bytesPerRow; gInfo->shared_info->current_mode = *mode; gInfo->shared_info->bits_per_pixel = bitsPerPixel; - } diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 317c42d578..49250c6542 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -69,7 +69,7 @@ uint32 display_get_encoder_mode(uint32 connectorIndex); void display_crtc_lock(uint8 crtcID, int command); void display_crtc_blank(uint8 crtcID, int command); void display_crtc_scale(uint8 crtcID, display_mode *mode); -void display_crtc_fb_set_dce1(uint8 crtcID, display_mode *mode); +void display_crtc_fb_set(uint8 crtcID, display_mode *mode); void display_crtc_set(uint8 crtcID, display_mode *mode); void display_crtc_set_dtd(uint8 crtcID, display_mode *mode); void display_crtc_power(uint8 crtcID, int command); diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 1061ba950f..4ede7be3fd 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -178,8 +178,7 @@ radeon_set_display_mode(display_mode *mode) // TODO: check if ATOM_PPLL1 is used and use ATOM_PPLL2 if so display_crtc_set_dtd(id, mode); - // TODO: vvvv : atombios_crtc_set_base - display_crtc_fb_set_dce1(id, mode); + display_crtc_fb_set(id, mode); // atombios_overscan_setup display_crtc_scale(id, mode); From 9774c58f55784c517aaa1a4c5b8461f5cccc165b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 18 Oct 2011 18:11:26 +0000 Subject: [PATCH 419/702] * remove un-used registers that were left over from base intel_extreme driver long ago * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42880 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 79 ------------------- 1 file changed, 79 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 32f7f4ccf0..9ce20ff0ec 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -196,85 +196,6 @@ struct radeon_free_graphics_memory { #define VGA_RENDER_CONTROL 0x0300 #define VGA_VSTATUS_CNTL_MASK 0x00030000 -// cursor -#define RADEON_CURSOR_CONTROL 0x70080 -#define RADEON_CURSOR_BASE 0x70084 -#define RADEON_CURSOR_POSITION 0x70088 -#define RADEON_CURSOR_PALETTE 0x70090 // (- 0x7009f) -#define RADEON_CURSOR_SIZE 0x700a0 -#define CURSOR_ENABLED (1UL << 31) -#define CURSOR_FORMAT_2_COLORS (0UL << 24) -#define CURSOR_FORMAT_3_COLORS (1UL << 24) -#define CURSOR_FORMAT_4_COLORS (2UL << 24) -#define CURSOR_FORMAT_ARGB (4UL << 24) -#define CURSOR_FORMAT_XRGB (5UL << 24) -#define CURSOR_POSITION_NEGATIVE 0x8000 -#define CURSOR_POSITION_MASK 0x3fff - -// overlay flip -#define COMMAND_OVERLAY_FLIP (0x11 << 23) -#define COMMAND_OVERLAY_CONTINUE (0 << 21) -#define COMMAND_OVERLAY_ON (1 << 21) -#define COMMAND_OVERLAY_OFF (2 << 21) -#define OVERLAY_UPDATE_COEFFICIENTS 0x1 - -// 2D acceleration -#define XY_COMMAND_SOURCE_BLIT 0x54c00006 -#define XY_COMMAND_COLOR_BLIT 0x54000004 -#define XY_COMMAND_SETUP_MONO_PATTERN 0x44400007 -#define XY_COMMAND_SCANLINE_BLIT 0x49400001 -#define COMMAND_COLOR_BLIT 0x50000003 -#define COMMAND_BLIT_RGBA 0x00300000 - -#define COMMAND_MODE_SOLID_PATTERN 0x80 -#define COMMAND_MODE_CMAP8 0x00 -#define COMMAND_MODE_RGB15 0x02 -#define COMMAND_MODE_RGB16 0x01 -#define COMMAND_MODE_RGB32 0x03 - -// display - -#define DISPLAY_CONTROL_ENABLED (1UL << 31) -#define DISPLAY_CONTROL_GAMMA (1UL << 30) -#define DISPLAY_CONTROL_COLOR_MASK (0x0fUL << 26) -#define DISPLAY_CONTROL_CMAP8 (2UL << 26) -#define DISPLAY_CONTROL_RGB15 (4UL << 26) -#define DISPLAY_CONTROL_RGB16 (5UL << 26) -#define DISPLAY_CONTROL_RGB32 (6UL << 26) - -/* VIP bus */ -#define RADEON_VIPH_CH0_DATA 0x0c00 -#define RADEON_VIPH_CH1_DATA 0x0c04 -#define RADEON_VIPH_CH2_DATA 0x0c08 -#define RADEON_VIPH_CH3_DATA 0x0c0c -#define RADEON_VIPH_CH0_ADDR 0x0c10 -#define RADEON_VIPH_CH1_ADDR 0x0c14 -#define RADEON_VIPH_CH2_ADDR 0x0c18 -#define RADEON_VIPH_CH3_ADDR 0x0c1c -#define RADEON_VIPH_CH0_SBCNT 0x0c20 -#define RADEON_VIPH_CH1_SBCNT 0x0c24 -#define RADEON_VIPH_CH2_SBCNT 0x0c28 -#define RADEON_VIPH_CH3_SBCNT 0x0c2c -#define RADEON_VIPH_CH0_ABCNT 0x0c30 -#define RADEON_VIPH_CH1_ABCNT 0x0c34 -#define RADEON_VIPH_CH2_ABCNT 0x0c38 -#define RADEON_VIPH_CH3_ABCNT 0x0c3c -#define RADEON_VIPH_CONTROL 0x0c40 -# define RADEON_VIP_BUSY 0 -# define RADEON_VIP_IDLE 1 -# define RADEON_VIP_RESET 2 -# define RADEON_VIPH_EN (1 << 21) -#define RADEON_VIPH_DV_LAT 0x0c44 -#define RADEON_VIPH_BM_CHUNK 0x0c48 -#define RADEON_VIPH_DV_INT 0x0c4c -#define RADEON_VIPH_TIMEOUT_STAT 0x0c50 -#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REG_STAT 0x00000010 -#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REG_AK 0x00000010 -#define RADEON_VIPH_TIMEOUT_STAT__VIPH_REGR_DIS 0x01000000 - -#define RADEON_VIPH_REG_DATA 0x0084 -#define RADEON_VIPH_REG_ADDR 0x0080 - // PCI bridge memory management // overlay From bcf13367d4adb759fb78af63602501dce87e5d52 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 19 Oct 2011 11:11:53 +0000 Subject: [PATCH 420/702] Use B_DO_NOT_RESCHEDULE in the interrupt handler because we are running with the interrupts disabled (was causing KDL under qemu). Add a define to switch the HPET timers to 32 or 64 bit (32 bit now by default) Reordered some things Add some debug output. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42881 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/timer/hpet.cpp | 39 ++++++++++++++++------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/add-ons/kernel/drivers/timer/hpet.cpp b/src/add-ons/kernel/drivers/timer/hpet.cpp index 5d787f8091..653b874104 100644 --- a/src/add-ons/kernel/drivers/timer/hpet.cpp +++ b/src/add-ons/kernel/drivers/timer/hpet.cpp @@ -26,7 +26,7 @@ #endif #define TEST_HPET - +#define HPET64 0 static struct hpet_regs *sHPETRegs; static uint64 sHPETPeriod; @@ -75,7 +75,11 @@ static vint32 sOpenCount; static inline bigtime_t hpet_convert_timeout(const bigtime_t &relativeTimeout) { +#if HPET64 bigtime_t counter = sHPETRegs->u0.counter64; +#else + bigtime_t counter = sHPETRegs->u0.counter32; +#endif bigtime_t converted = (1000000000ULL / sHPETPeriod) * relativeTimeout; dprintf("counter: %lld, relativeTimeout: %lld, converted: %lld\n", @@ -85,7 +89,7 @@ hpet_convert_timeout(const bigtime_t &relativeTimeout) } -#define MIN_TIMEOUT 3000 +#define MIN_TIMEOUT 1 static status_t hpet_set_hardware_timer(bigtime_t relativeTimeout, volatile hpet_timer *timer) @@ -98,7 +102,11 @@ hpet_set_hardware_timer(bigtime_t relativeTimeout, volatile hpet_timer *timer) //dprintf("comparator: %lld, new value: %lld\n", timer->u0.comparator64, timerValue); +#if HPET64 timer->u0.comparator64 = timerValue; +#else + timer->u0.comparator32 = timerValue; +#endif // enable timer interrupt timer->config |= HPET_CONF_TIMER_INT_ENABLE; @@ -128,7 +136,7 @@ hpet_timer_interrupt(void *arg) sHPETRegs->interrupt_status |= intStatus; hpet_clear_hardware_timer(&sHPETRegs->timer[hpetCookie->number]); - release_sem(hpetCookie->sem); + release_sem_etc(hpetCookie->sem, 1, B_DO_NOT_RESCHEDULE); return B_HANDLED_INTERRUPT; } @@ -221,18 +229,25 @@ hpet_init_timer(hpet_timer_cookie* cookie) if (interrupt == -1) return B_ERROR; - timer->config |= (interrupt << HPET_CONF_TIMER_INT_ROUTE_SHIFT) - & HPET_CONF_TIMER_INT_ROUTE_MASK; - // Non-periodic mode timer->config &= ~HPET_CONF_TIMER_TYPE; // level triggered timer->config |= HPET_CONF_TIMER_INT_TYPE; - // Disable FSB/MSI, enable 64 bit mode + // Disable FSB/MSI timer->config &= ~HPET_CONF_TIMER_FSB_ENABLE; + +#if HPET64 + //disable 32 bit mode timer->config &= ~HPET_CONF_TIMER_32MODE; +#else + //enable 32 bit mode + timer->config |= HPET_CONF_TIMER_32MODE; +#endif + + timer->config |= (interrupt << HPET_CONF_TIMER_INT_ROUTE_SHIFT) + & HPET_CONF_TIMER_INT_ROUTE_MASK; cookie->irq = interrupt = HPET_GET_CONF_TIMER_INT_ROUTE(timer); status_t status = install_io_interrupt_handler(interrupt, &hpet_timer_interrupt, cookie, 0); @@ -250,9 +265,9 @@ hpet_init_timer(hpet_timer_cookie* cookie) static status_t hpet_test() { - uint64 initialValue = sHPETRegs->u0.counter64; + uint64 initialValue = sHPETRegs->u0.counter32; spin(10); - uint64 finalValue = sHPETRegs->u0.counter64; + uint64 finalValue = sHPETRegs->u0.counter32; if (initialValue == finalValue) { dprintf("hpet_test: counter does not increment\n"); @@ -271,9 +286,11 @@ hpet_init() sHPETPeriod = HPET_GET_PERIOD(sHPETRegs); - TRACE(("hpet_init: HPET is at %p.\n\tVendor ID: %llx, rev: %llx, period: %lld\n", + TRACE(("hpet_init: HPET is at %p.\n" + "\tVendor ID: %llx, rev: %llx, period: %lld\n" + "\tin legacy mode: %s\n", sHPETRegs, HPET_GET_VENDOR_ID(sHPETRegs), HPET_GET_REVID(sHPETRegs), - sHPETPeriod)); + sHPETPeriod, sHPETRegs->config & HPET_CONF_MASK_LEGACY ? "yes" : "no")); status_t status = hpet_set_enabled(false); if (status != B_OK) From 276a254c1c5eadd310a1aafb5707b0a7e08a29f3 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 19 Oct 2011 12:40:12 +0000 Subject: [PATCH 421/702] Reorganized defines in the header. Deallocate resources correcly in error case. Support for level and edge interrupts. Removed volatile keyword where it's not needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42882 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/timer/hpet.cpp | 67 +++++++++++++++-------- src/add-ons/kernel/drivers/timer/hpet.h | 43 ++++++++------- 2 files changed, 67 insertions(+), 43 deletions(-) diff --git a/src/add-ons/kernel/drivers/timer/hpet.cpp b/src/add-ons/kernel/drivers/timer/hpet.cpp index 653b874104..9c93689258 100644 --- a/src/add-ons/kernel/drivers/timer/hpet.cpp +++ b/src/add-ons/kernel/drivers/timer/hpet.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -38,6 +39,7 @@ struct hpet_timer_cookie { int number; int32 irq; sem_id sem; + hpet_timer* timer; }; //////////////////////////////////////////////////////////////////////////////// @@ -92,7 +94,7 @@ hpet_convert_timeout(const bigtime_t &relativeTimeout) #define MIN_TIMEOUT 1 static status_t -hpet_set_hardware_timer(bigtime_t relativeTimeout, volatile hpet_timer *timer) +hpet_set_hardware_timer(bigtime_t relativeTimeout, hpet_timer *timer) { // TODO: if (relativeTimeout < MIN_TIMEOUT) @@ -116,7 +118,7 @@ hpet_set_hardware_timer(bigtime_t relativeTimeout, volatile hpet_timer *timer) static status_t -hpet_clear_hardware_timer(volatile hpet_timer *timer) +hpet_clear_hardware_timer(hpet_timer *timer) { // Disable timer interrupt timer->config &= ~HPET_CONF_TIMER_INT_ENABLE; @@ -129,12 +131,14 @@ hpet_timer_interrupt(void *arg) { //dprintf("HPET timer_interrupt!!!!\n"); hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)arg; + hpet_timer* timer = &sHPETRegs->timer[hpetCookie->number]; - // clear interrupt status int32 intStatus = 1 << hpetCookie->number; - if (sHPETRegs->interrupt_status & intStatus) { + if (!HPET_GET_CONF_TIMER_INT_IS_LEVEL(timer) + || (sHPETRegs->interrupt_status & intStatus)) { + // clear interrupt status sHPETRegs->interrupt_status |= intStatus; - hpet_clear_hardware_timer(&sHPETRegs->timer[hpetCookie->number]); + hpet_clear_hardware_timer(timer); release_sem_etc(hpetCookie->sem, 1, B_DO_NOT_RESCHEDULE); return B_HANDLED_INTERRUPT; @@ -159,7 +163,7 @@ static status_t hpet_set_legacy(bool enabled) { if (!HPET_IS_LEGACY_CAPABLE(sHPETRegs)) { - dprintf("hpet_init: HPET doesn't support legacy mode. Skipping.\n"); + dprintf("hpet_init: HPET doesn't support legacy mode.\n"); return B_NOT_SUPPORTED; } @@ -197,7 +201,7 @@ hpet_dump_timer(volatile struct hpet_timer *timer) dprintf("\tTimer type: %s\n", timer->config & HPET_CONF_TIMER_TYPE ? "Periodic" : "OneShot"); dprintf("\tInterrupt Type: %s\n", - timer->config & HPET_CONF_TIMER_INT_TYPE ? "Level" : "Edge"); + HPET_GET_CONF_TIMER_INT_IS_LEVEL(timer) ? "Level" : "Edge"); dprintf("\tconfigured IRQ: %lld\n", HPET_GET_CONF_TIMER_INT_ROUTE(timer)); @@ -213,7 +217,7 @@ hpet_dump_timer(volatile struct hpet_timer *timer) static status_t hpet_init_timer(hpet_timer_cookie* cookie) { - volatile struct hpet_timer *timer = &sHPETRegs->timer[cookie->number]; + struct hpet_timer *timer = cookie->timer; uint32 interrupts = (uint32)HPET_GET_CAP_TIMER_ROUTE(timer); @@ -226,9 +230,10 @@ hpet_init_timer(hpet_timer_cookie* cookie) } } - if (interrupt == -1) + if (interrupt == -1) { + dprintf("hpet_init_timer(): timer can't be routed to any interrupt!") return B_ERROR; - + } // Non-periodic mode timer->config &= ~HPET_CONF_TIMER_TYPE; @@ -287,10 +292,9 @@ hpet_init() sHPETPeriod = HPET_GET_PERIOD(sHPETRegs); TRACE(("hpet_init: HPET is at %p.\n" - "\tVendor ID: %llx, rev: %llx, period: %lld\n" - "\tin legacy mode: %s\n", + "\tVendor ID: %llx, rev: %llx, period: %lld\n", sHPETRegs, HPET_GET_VENDOR_ID(sHPETRegs), HPET_GET_REVID(sHPETRegs), - sHPETPeriod, sHPETRegs->config & HPET_CONF_MASK_LEGACY ? "yes" : "no")); + sHPETPeriod)); status_t status = hpet_set_enabled(false); if (status != B_OK) @@ -302,8 +306,10 @@ hpet_init() uint32 numTimers = HPET_GET_NUM_TIMERS(sHPETRegs) + 1; - TRACE(("hpet_init: HPET supports %lu timers, and is %s bits wide.\n", - numTimers, HPET_IS_64BIT(sHPETRegs) ? "64" : "32")); + TRACE(("hpet_init: HPET supports %lu timers, is %s bits wide, " + "and is %sin legacy mode.\n", + numTimers, HPET_IS_64BIT(sHPETRegs) ? "64" : "32", + sHPETRegs->config & HPET_CONF_MASK_LEGACY ? "" : "not ")); TRACE(("hpet_init: configuration: 0x%llx, timer_interrupts: 0x%llx\n", sHPETRegs->config, sHPETRegs->interrupt_status)); @@ -428,27 +434,44 @@ hpet_open(const char* name, uint32 flags, void** cookie) return B_BUSY; } - hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)malloc(sizeof(hpet_timer_cookie)); int timerNumber = 2; + // TODO + + char semName[B_OS_NAME_LENGTH]; + snprintf(semName, B_OS_NAME_LENGTH, "hpet_timer %d sem", timerNumber); + sem_id sem = create_sem(0, semName); + if (sem < 0) { + atomic_add(&sOpenCount, -1); + return sem; + } + + hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)malloc(sizeof(hpet_timer_cookie)); + if (hpetCookie == NULL) { + delete_sem(sem); + atomic_add(&sOpenCount, -1); + return B_NO_MEMORY; + } + hpetCookie->number = timerNumber; - hpetCookie->sem = create_sem(0, "hpet_timer 2 sem"); + hpetCookie->timer = &sHPETRegs->timer[timerNumber]; + hpetCookie->sem = sem; set_sem_owner(hpetCookie->sem, B_SYSTEM_TEAM); hpet_set_enabled(false); status_t status = hpet_init_timer(hpetCookie); - if (status != B_OK) { + if (status != B_OK) dprintf("hpet_open: initializing timer failed: %s\n", strerror(status)); - return status; - } hpet_set_enabled(true); *cookie = hpetCookie; - if (status != B_OK) + if (status != B_OK) { + delete_sem(sem); + free(hpetCookie); atomic_add(&sOpenCount, -1); - + } return status; } diff --git a/src/add-ons/kernel/drivers/timer/hpet.h b/src/add-ons/kernel/drivers/timer/hpet.h index d82eea336c..b025ec10a6 100644 --- a/src/add-ons/kernel/drivers/timer/hpet.h +++ b/src/add-ons/kernel/drivers/timer/hpet.h @@ -12,20 +12,20 @@ /* Doing it this way is Required since the HPET only supports 32/64-bit aligned reads. */ /* Global Capability Register Masks */ -#define HPET_CAP_MASK_REVID 0x00000000000000FFULL +#define HPET_CAP_MASK_REVID 0x00000000000000FFULL #define HPET_CAP_MASK_NUMTIMERS 0x0000000000001F00ULL -#define HPET_CAP_MASK_WIDTH 0x0000000000002000ULL +#define HPET_CAP_MASK_WIDTH 0x0000000000002000ULL #define HPET_CAP_MASK_LEGACY 0x0000000000008000ULL #define HPET_CAP_MASK_VENDOR_ID 0x00000000FFFF0000ULL #define HPET_CAP_MASK_PERIOD 0xFFFFFFFF00000000ULL /* Retrieve Global Capabilities */ -#define HPET_GET_REVID(regs) ((regs)->capabilities & HPET_CAP_MASK_REVID) -#define HPET_GET_NUM_TIMERS(regs) (((regs)->capabilities & HPET_CAP_MASK_NUMTIMERS) >> 8) -#define HPET_IS_64BIT(regs) (((regs)->capabilities & HPET_CAP_MASK_WIDTH) >> 13) +#define HPET_GET_REVID(regs) ((regs)->capabilities & HPET_CAP_MASK_REVID) +#define HPET_GET_NUM_TIMERS(regs) (((regs)->capabilities & HPET_CAP_MASK_NUMTIMERS) >> 8) +#define HPET_IS_64BIT(regs) (((regs)->capabilities & HPET_CAP_MASK_WIDTH) >> 13) #define HPET_IS_LEGACY_CAPABLE(regs) (((regs)->capabilities & HPET_CAP_MASK_LEGACY) >> 15) -#define HPET_GET_VENDOR_ID(regs) (((regs)->capabilities & HPET_CAP_MASK_VENDOR_ID) >> 16) -#define HPET_GET_PERIOD(regs) (((regs)->capabilities & HPET_CAP_MASK_PERIOD) >> 32) +#define HPET_GET_VENDOR_ID(regs) (((regs)->capabilities & HPET_CAP_MASK_VENDOR_ID) >> 16) +#define HPET_GET_PERIOD(regs) (((regs)->capabilities & HPET_CAP_MASK_PERIOD) >> 32) /* Global Config Register Masks */ #define HPET_CONF_MASK_ENABLED 0x00000001 @@ -37,20 +37,21 @@ /* Timer Configuration and Capabilities*/ #define HPET_CAP_TIMER_MASK 0xFFFFFFFF00000000ULL +#define HPET_CAP_TIMER_PER_INT 0x00000010UL +#define HPET_CAP_TIMER_SIZE 0x00000020UL +#define HPET_CAP_TIMER_FSB_INT_DEL 0x00008000UL +#define HPET_GET_CAP_TIMER_ROUTE(timer) (((timer)->config & HPET_CAP_TIMER_MASK) >> 32) + #define HPET_CONF_TIMER_INT_ROUTE_MASK 0x3e00UL #define HPET_CONF_TIMER_INT_ROUTE_SHIFT 9 -#define HPET_CONF_TIMER_INT_TYPE 0x00000002UL -#define HPET_CONF_TIMER_INT_ENABLE 0x00000004UL -#define HPET_CONF_TIMER_TYPE 0x00000008UL -#define HPET_CONF_TIMER_VAL_SET 0x00000040UL -#define HPET_CONF_TIMER_32MODE 0x00000100UL -#define HPET_CONF_TIMER_FSB_ENABLE 0x00004000UL -#define HPET_CAP_TIMER_PER_INT 0x00000010UL -#define HPET_CAP_TIMER_SIZE 0x00000020UL -#define HPET_CAP_TIMER_FSB_INT_DEL 0x00008000UL - -#define HPET_GET_CAP_TIMER_ROUTE(timer) (((timer)->config & HPET_CAP_TIMER_MASK) >> 32) +#define HPET_CONF_TIMER_INT_TYPE 0x00000002UL +#define HPET_CONF_TIMER_INT_ENABLE 0x00000004UL +#define HPET_CONF_TIMER_TYPE 0x00000008UL +#define HPET_CONF_TIMER_VAL_SET 0x00000040UL +#define HPET_CONF_TIMER_32MODE 0x00000100UL +#define HPET_CONF_TIMER_FSB_ENABLE 0x00004000UL #define HPET_GET_CONF_TIMER_INT_ROUTE(timer) (((timer)->config & HPET_CONF_TIMER_INT_ROUTE_MASK) >> HPET_CONF_TIMER_INT_ROUTE_SHIFT) +#define HPET_GET_CONF_TIMER_INT_IS_LEVEL(timer) (((timer)->config & HPET_CONF_TIMER_INT_TYPE)) #define ACPI_HPET_SIGNATURE "HPET" @@ -83,16 +84,16 @@ struct hpet_regs { /* Level Tigger: 0 = off, 1 = set by hardware, timer is active */ /* Edge Trigger: ignored */ /* Writing 0 will not clear these. Must write 1 again. */ - volatile uint64 reserved3[25]; + uint64 reserved3[25]; union { volatile uint64 counter64; /* R/W */ volatile uint32 counter32; } u0; - volatile uint64 reserved4; + uint64 reserved4; - volatile struct hpet_timer timer[1]; + struct hpet_timer timer[1]; }; From b1128999ca51f7b937dfa86cd5e2488e72c801a5 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 19 Oct 2011 12:41:36 +0000 Subject: [PATCH 422/702] Fix build (forgot the ";") git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42883 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/timer/hpet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/kernel/drivers/timer/hpet.cpp b/src/add-ons/kernel/drivers/timer/hpet.cpp index 9c93689258..baab94a086 100644 --- a/src/add-ons/kernel/drivers/timer/hpet.cpp +++ b/src/add-ons/kernel/drivers/timer/hpet.cpp @@ -231,7 +231,7 @@ hpet_init_timer(hpet_timer_cookie* cookie) } if (interrupt == -1) { - dprintf("hpet_init_timer(): timer can't be routed to any interrupt!") + dprintf("hpet_init_timer(): timer can't be routed to any interrupt!"); return B_ERROR; } // Non-periodic mode From 6e4eb955c78fe116f25ced302152330ba2a04756 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 19 Oct 2011 18:19:13 +0000 Subject: [PATCH 423/702] * add DCE version major and minor as we may need it at some point * add notes that AtomBIOS goes all the way back to X700 (r4xx) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42884 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/driver.cpp | 240 +++++++++--------- 1 file changed, 123 insertions(+), 117 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 24c5a43a33..f0ac465f78 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -35,160 +35,166 @@ #define MAX_CARDS 1 +// ATI / AMD cards starting at the Radeon X700 have an AtomBIOS + // list of supported devices const struct supported_device { uint32 device_id; + uint8 dceMajor; // Display block family + uint8 dceMinor; // Display block family uint16 chipset; bool igp; const char* name; } kSupportedDevices[] = { + // R400 Series (Radeon) DCE 0.0 (*very* early AtomBIOS) + // R500 Series (Radeon Xxxx) DCE 1.0 // R600 series (HD24xx - HD42xx) // Codename: Pele - {0x94c7, RADEON_R600 | 0x10, false, "Radeon HD 2350"}, - {0x94c1, RADEON_R600 | 0x10, true, "Radeon HD 2400"}, - {0x94c3, RADEON_R600 | 0x10, false, "Radeon HD 2400"}, - {0x94cc, RADEON_R600 | 0x10, false, "Radeon HD 2400"}, - {0x9586, RADEON_R600 | 0x30, false, "Radeon HD 2600"}, - {0x9588, RADEON_R600 | 0x30, false, "Radeon HD 2600"}, - {0x958a, RADEON_R600 | 0x30, false, "Radeon HD 2600 X2"}, + {0x94c7, 2, 0, RADEON_R600 | 0x10, false, "Radeon HD 2350"}, + {0x94c1, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 2400"}, + {0x94c3, 2, 0, RADEON_R600 | 0x10, false, "Radeon HD 2400"}, + {0x94cc, 2, 0, RADEON_R600 | 0x10, false, "Radeon HD 2400"}, + {0x9586, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 2600"}, + {0x9588, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 2600"}, + {0x958a, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 2600 X2"}, // Radeon 2700 - RV630 - {0x9400, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, - {0x9401, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, - {0x9402, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, - {0x9403, RADEON_R600 | 0x00, false, "Radeon HD 2900 Pro"}, - {0x9405, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, - {0x940a, RADEON_R600 | 0x00, false, "Radeon FireGL V8650"}, - {0x940b, RADEON_R600 | 0x00, false, "Radeon FireGL V8600"}, - {0x940f, RADEON_R600 | 0x00, false, "Radeon FireGL V7600"}, - {0x9611, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, - {0x9613, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, - {0x9610, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, - {0x9612, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, - {0x9615, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, - {0x9614, RADEON_R600 | 0x10, true, "Radeon HD 3300"}, + {0x9400, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x9401, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x9402, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x9403, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900 Pro"}, + {0x9405, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, + {0x940a, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V8650"}, + {0x940b, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V8600"}, + {0x940f, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V7600"}, + {0x9611, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, + {0x9613, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, + {0x9610, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, + {0x9612, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, + {0x9615, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, + {0x9614, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3300"}, // Radeon 3430 - RV620 - {0x95c5, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, - {0x95c6, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, - {0x95c7, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, - {0x95c9, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, - {0x95c4, RADEON_R600 | 0x20, false, "Radeon HD 3470"}, - {0x95c0, RADEON_R600 | 0x20, false, "Radeon HD 3550"}, - {0x9581, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, - {0x9583, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, - {0x9598, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, - {0x9591, RADEON_R600 | 0x35, false, "Radeon HD 3600"}, - {0x9589, RADEON_R600 | 0x30, false, "Radeon HD 3610"}, + {0x95c5, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, + {0x95c6, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, + {0x95c7, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, + {0x95c9, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, + {0x95c4, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3470"}, + {0x95c0, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3550"}, + {0x9581, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, + {0x9583, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, + {0x9598, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, + {0x9591, 3, 0, RADEON_R600 | 0x35, false, "Radeon HD 3600"}, + {0x9589, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 3610"}, // Radeon 3650 - RV635 // Radeon 3670 - RV635 - {0x9507, RADEON_R600 | 0x70, false, "Radeon HD 3830"}, - {0x9505, RADEON_R600 | 0x70, false, "Radeon HD 3850"}, - {0x9513, RADEON_R600 | 0x80, false, "Radeon HD 3850 X2"}, - {0x9501, RADEON_R600 | 0x70, false, "Radeon HD 3870"}, - {0x950F, RADEON_R600 | 0x80, false, "Radeon HD 3870 X2"}, - {0x9710, RADEON_R600 | 0x20, true, "Radeon HD 4200"}, - {0x9715, RADEON_R600 | 0x20, true, "Radeon HD 4250"}, - {0x9712, RADEON_R600 | 0x20, true, "Radeon HD 4270"}, - {0x9714, RADEON_R600 | 0x20, true, "Radeon HD 4290"}, + {0x9507, 2, 0, RADEON_R600 | 0x70, false, "Radeon HD 3830"}, + {0x9505, 2, 0, RADEON_R600 | 0x70, false, "Radeon HD 3850"}, + {0x9513, 2, 0, RADEON_R600 | 0x80, false, "Radeon HD 3850 X2"}, + {0x9501, 2, 0, RADEON_R600 | 0x70, false, "Radeon HD 3870"}, + {0x950F, 2, 0, RADEON_R600 | 0x80, false, "Radeon HD 3870 X2"}, + {0x9710, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 4200"}, + {0x9715, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 4250"}, + {0x9712, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 4270"}, + {0x9714, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 4290"}, // R700 series (HD4330 - HD4890, HD51xx, HD5xxV) // Codename: Wekiva // Radeon 4330 - RV710 - {0x954f, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, - {0x9552, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, - {0x9555, RADEON_R700 | 0x10, false, "Radeon HD 4350"}, - {0x9540, RADEON_R700 | 0x10, false, "Radeon HD 4550"}, - {0x9480, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, - {0x9498, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, - {0x94b4, RADEON_R700 | 0x40, false, "Radeon HD 4700"}, - {0x9490, RADEON_R700 | 0x30, false, "Radeon HD 4710"}, - {0x94b3, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, - {0x94b5, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, - {0x944a, RADEON_R700 | 0x70, false, "Radeon HD 4850 Mobile"}, // IGP? - {0x944e, RADEON_R700 | 0x70, false, "Radeon HD 4810"}, - {0x944c, RADEON_R700 | 0x70, false, "Radeon HD 4830"}, - {0x9442, RADEON_R700 | 0x70, false, "Radeon HD 4850"}, - {0x9443, RADEON_R700 | 0x70, false, "Radeon HD 4850 X2"}, - {0x94a1, RADEON_R700 | 0x90, true, "Radeon HD 4860"}, - {0x9440, RADEON_R700 | 0x70, false, "Radeon HD 4870"}, - {0x9441, RADEON_R700 | 0x70, false, "Radeon HD 4870 X2"}, + {0x954f, 3, 2, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, + {0x9552, 3, 2, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, + {0x9555, 3, 2, RADEON_R700 | 0x10, false, "Radeon HD 4350"}, + {0x9540, 3, 2, RADEON_R700 | 0x10, false, "Radeon HD 4550"}, + {0x9480, 3, 2, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, + {0x9498, 3, 2, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, + {0x94b4, 3, 2, RADEON_R700 | 0x40, false, "Radeon HD 4700"}, + {0x9490, 3, 2, RADEON_R700 | 0x30, false, "Radeon HD 4710"}, + {0x94b3, 3, 2, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, + {0x94b5, 3, 2, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, + {0x944a, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4850 Mobile"}, + {0x944e, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4810"}, + {0x944c, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4830"}, + {0x9442, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4850"}, + {0x9443, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4850 X2"}, + {0x94a1, 3, 0, RADEON_R700 | 0x90, true, "Radeon HD 4860"}, + {0x9440, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4870"}, + {0x9441, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4870 X2"}, // From here on AMD no longer used numeric identifiers // R1000 series (HD54xx - HD63xx) // Codename: Evergreen // Cedar - {0x68e1, RADEON_R1000 | 0x00, false, "Radeon HD 5430"}, - {0x68f9, RADEON_R1000 | 0x00, false, "Radeon HD 5450"}, - {0x68e0, RADEON_R1000 | 0x00, true, "Radeon HD 5470"}, + {0x68e1, 4, 0, RADEON_R1000 | 0x00, false, "Radeon HD 5430"}, + {0x68f9, 4, 0, RADEON_R1000 | 0x00, false, "Radeon HD 5450"}, + {0x68e0, 4, 0, RADEON_R1000 | 0x00, true, "Radeon HD 5470"}, // Redwood - {0x68da, RADEON_R1000 | 0x10, false, "Radeon HD 5500"}, - {0x68d9, RADEON_R1000 | 0x10, false, "Radeon HD 5570"}, - {0x68b9, RADEON_R1000 | 0x10, false, "Radeon HD 5600"}, - {0x68c1, RADEON_R1000 | 0x10, false, "Radeon HD 5650"}, - {0x68d8, RADEON_R1000 | 0x10, false, "Radeon HD 5670"}, + {0x68da, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5500"}, + {0x68d9, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5570"}, + {0x68b9, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5600"}, + {0x68c1, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5650"}, + {0x68d8, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5670"}, // Juniper - {0x68be, RADEON_R1000 | 0x20, false, "Radeon HD 5700"}, - {0x68b8, RADEON_R1000 | 0x20, false, "Radeon HD 5770"}, + {0x68be, 4, 0, RADEON_R1000 | 0x20, false, "Radeon HD 5700"}, + {0x68b8, 4, 0, RADEON_R1000 | 0x20, false, "Radeon HD 5770"}, // Cypress - {0x689e, RADEON_R1000 | 0x30, false, "Radeon HD 5800"}, - {0x6899, RADEON_R1000 | 0x30, false, "Radeon HD 5850"}, - {0x6898, RADEON_R1000 | 0x30, false, "Radeon HD 5870"}, + {0x689e, 4, 0, RADEON_R1000 | 0x30, false, "Radeon HD 5800"}, + {0x6899, 4, 0, RADEON_R1000 | 0x30, false, "Radeon HD 5850"}, + {0x6898, 4, 0, RADEON_R1000 | 0x30, false, "Radeon HD 5870"}, // Hemlock - {0x689c, RADEON_R1000 | 0x40, false, "Radeon HD 5900"}, + {0x689c, 4, 0, RADEON_R1000 | 0x40, false, "Radeon HD 5900"}, // Fusion APUS // Palms - {0x9804, RADEON_R1000 | 0x50, true, "Radeon HD 6250"}, - {0x9805, RADEON_R1000 | 0x50, true, "Radeon HD 6290"}, - {0x9802, RADEON_R1000 | 0x50, true, "Radeon HD 6310"}, - {0x9803, RADEON_R1000 | 0x50, true, "Radeon HD 6310"}, + {0x9804, 4, 1, RADEON_R1000 | 0x50, true, "Radeon HD 6250"}, + {0x9805, 4, 1, RADEON_R1000 | 0x50, true, "Radeon HD 6290"}, + {0x9802, 4, 1, RADEON_R1000 | 0x50, true, "Radeon HD 6310"}, + {0x9803, 4, 1, RADEON_R1000 | 0x50, true, "Radeon HD 6310"}, // R2000 series (HD64xx - HD69xx) // Codename: Nothern Islands // Caicos - {0x6760, RADEON_R2000 | 0x00, false, "Radeon HD 6470M"}, - {0x6761, RADEON_R2000 | 0x00, false, "Radeon HD 6430M"}, - {0x6762, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6763, RADEON_R2000 | 0x00, false, "Radeon HD E6460 Discreet"}, - {0x6764, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6765, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6766, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6767, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6768, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6770, RADEON_R2000 | 0x00, false, "Radeon HD 6400"}, - {0x6779, RADEON_R2000 | 0x00, false, "Radeon HD 6450"}, + {0x6760, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD 6470M"}, + {0x6761, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD 6430M"}, + {0x6762, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6763, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD E6460 Discreet"}, + {0x6764, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6765, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6766, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6767, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6768, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, + {0x6770, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD 6400"}, + {0x6779, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD 6450"}, // Turks - {0x6740, RADEON_R2000 | 0x10, false, "Radeon HD 6700M"}, - {0x6741, RADEON_R2000 | 0x10, false, "Radeon HD 6600M"}, - {0x6742, RADEON_R2000 | 0x10, false, "Radeon HD 6625M"}, - {0x6743, RADEON_R2000 | 0x10, false, "Radeon HD E6760 Discreet"}, - {0x6744, RADEON_R2000 | 0x10, false, "Radeon HD TURKS M"}, - {0x6745, RADEON_R2000 | 0x10, false, "Radeon HD TURKS M"}, - {0x6746, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, - {0x6747, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, - {0x6748, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, - {0x6749, RADEON_R2000 | 0x10, false, "FirePro v4900"}, - {0x6759, RADEON_R2000 | 0x10, false, "Radeon HD 6570"}, + {0x6740, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD 6700M"}, + {0x6741, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD 6600M"}, + {0x6742, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD 6625M"}, + {0x6743, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD E6760 Discreet"}, + {0x6744, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS M"}, + {0x6745, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS M"}, + {0x6746, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, + {0x6747, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, + {0x6748, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, + {0x6749, 5, 0, RADEON_R2000 | 0x10, false, "FirePro v4900"}, + {0x6759, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD 6570"}, // Barts - {0x673e, RADEON_R2000 | 0x20, false, "Radeon HD 6790"}, - {0x6739, RADEON_R2000 | 0x20, false, "Radeon HD 6850"}, - {0x6738, RADEON_R2000 | 0x20, false, "Radeon HD 6870"}, + {0x673e, 5, 0, RADEON_R2000 | 0x20, false, "Radeon HD 6790"}, + {0x6739, 5, 0, RADEON_R2000 | 0x20, false, "Radeon HD 6850"}, + {0x6738, 5, 0, RADEON_R2000 | 0x20, false, "Radeon HD 6870"}, // Cayman - {0x6700, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6701, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6702, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6703, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6704, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6705, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6706, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6707, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6708, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6709, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6718, RADEON_R2000 | 0x30, false, "Radeon HD 6970"}, - {0x6719, RADEON_R2000 | 0x30, false, "Radeon HD 6950"}, - {0x671C, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x671F, RADEON_R2000 | 0x30, false, "Radeon HD 6900"}, + {0x6700, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6701, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6702, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6703, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6704, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6705, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6706, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6707, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6708, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6709, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x6718, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD 6970"}, + {0x6719, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD 6950"}, + {0x671C, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, + {0x671F, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD 6900"}, // Antilles - {0x671d, RADEON_R2000 | 0x40, false, "Radeon HD 6990"} + {0x671d, 5, 0, RADEON_R2000 | 0x40, false, "Radeon HD 6990"} // R3000 series (HD74xx - HD79xx) // Codename: Southern Islands From 9b4aacc2100bce4e5a885c77db32db6703f05192 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 19 Oct 2011 18:40:46 +0000 Subject: [PATCH 424/702] * backport linux AtomBIOS parser bugfix... Fixes memory corruption on some boards. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42885 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/atombios/atom.cpp | 16 +++++++++++++++- .../accelerants/radeon_hd/atombios/atom.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 04fe4e4245..5649e545eb 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -246,6 +246,13 @@ atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, idx = U8(*ptr); (*ptr)++; val = gctx->scratch[((gctx->fb_base + idx) / 4)]; + if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) { + ERROR("%s: fb tried to read beyond scratch region!" + " %" B_PRIu32 " vs. %d\n", __func__, + gctx->fb_base + (idx * 4), gctx->scratch_size_bytes); + val = 0; + } else + val = gctx->scratch[(gctx->fb_base / 4) + idx]; break; case ATOM_ARG_IMM: switch(align) { @@ -463,7 +470,12 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, case ATOM_ARG_FB: idx = U8(*ptr); (*ptr)++; - gctx->scratch[((gctx->fb_base + idx) / 4)] = val; + if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) { + ERROR("%s: fb tried to write beyond scratch region! " + "%" B_PRIu32 " vs. %d\n", __func__, + gctx->fb_base + (idx * 4), gctx->scratch_size_bytes); + } else + gctx->scratch[(gctx->fb_base / 4) + idx] = val; break; case ATOM_ARG_PLL: idx = U8(*ptr); @@ -1364,6 +1376,7 @@ atom_allocate_fb_scratch(atom_context *ctx) usage_bytes = firmware->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024; } + ctx->scratch_size_bytes = 0; if (usage_bytes == 0) usage_bytes = 20 * 1024; /* allocate some scratch memory */ @@ -1371,5 +1384,6 @@ atom_allocate_fb_scratch(atom_context *ctx) if (!ctx->scratch) return B_NO_MEMORY; + ctx->scratch_size_bytes = usage_bytes; return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index c0f7fec688..6ad02878c5 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -143,6 +143,7 @@ typedef struct atom_context_s { int cs_equal, cs_above; int io_mode; uint32 *scratch; + int scratch_size_bytes; } atom_context; extern int atom_debug; From 24d19f4dab07a1cf7f15ecc3c5ba6d66615725d0 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 19 Oct 2011 20:12:20 +0000 Subject: [PATCH 425/702] * fix silly unsigned vs signed bug in gcc2 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42886 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/atombios/atom.cpp | 4 ++-- src/add-ons/accelerants/radeon_hd/atombios/atom.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp index 5649e545eb..6df03d2c51 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp @@ -248,7 +248,7 @@ atom_get_src_int(atom_exec_context *ctx, uint8 attr, int *ptr, val = gctx->scratch[((gctx->fb_base + idx) / 4)]; if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) { ERROR("%s: fb tried to read beyond scratch region!" - " %" B_PRIu32 " vs. %d\n", __func__, + " %" B_PRIu32 " vs. %" B_PRIu32 "\n", __func__, gctx->fb_base + (idx * 4), gctx->scratch_size_bytes); val = 0; } else @@ -472,7 +472,7 @@ atom_put_dst(atom_exec_context *ctx, int arg, uint8 attr, (*ptr)++; if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) { ERROR("%s: fb tried to write beyond scratch region! " - "%" B_PRIu32 " vs. %d\n", __func__, + "%" B_PRIu32 " vs. %" B_PRIu32 "\n", __func__, gctx->fb_base + (idx * 4), gctx->scratch_size_bytes); } else gctx->scratch[(gctx->fb_base / 4) + idx] = val; diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h index 6ad02878c5..2644cb1c4f 100644 --- a/src/add-ons/accelerants/radeon_hd/atombios/atom.h +++ b/src/add-ons/accelerants/radeon_hd/atombios/atom.h @@ -143,7 +143,7 @@ typedef struct atom_context_s { int cs_equal, cs_above; int io_mode; uint32 *scratch; - int scratch_size_bytes; + uint32 scratch_size_bytes; } atom_context; extern int atom_debug; From f5edabc8f84adaa05abcb2d8ee8c013ab6da616d Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 20 Oct 2011 01:00:23 +0000 Subject: [PATCH 426/702] * add a 4890 PCIID I missed * correct a few wrong DCE versions using xorg documentation git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42887 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/driver.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index f0ac465f78..cf19bdc41c 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -109,14 +109,15 @@ const struct supported_device { {0x9490, 3, 2, RADEON_R700 | 0x30, false, "Radeon HD 4710"}, {0x94b3, 3, 2, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, {0x94b5, 3, 2, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, - {0x944a, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4850 Mobile"}, - {0x944e, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4810"}, - {0x944c, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4830"}, - {0x9442, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4850"}, - {0x9443, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4850 X2"}, - {0x94a1, 3, 0, RADEON_R700 | 0x90, true, "Radeon HD 4860"}, - {0x9440, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4870"}, - {0x9441, 3, 0, RADEON_R700 | 0x70, false, "Radeon HD 4870 X2"}, + {0x944a, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4850 Mobile"}, + {0x944e, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4810"}, + {0x944c, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4830"}, + {0x9442, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4850"}, + {0x9443, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4850 X2"}, + {0x94a1, 3, 1, RADEON_R700 | 0x90, true, "Radeon HD 4860"}, + {0x9440, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4870"}, + {0x9441, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4870 X2"}, + {0x9460, 3, 1, RADEON_R700 | 0x90, false, "Radeon HD 4890"}, // From here on AMD no longer used numeric identifiers From a6c4bc423e3774fbf091a594a48f2666e49267bb Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 20 Oct 2011 14:22:30 +0000 Subject: [PATCH 427/702] * enable radeon_hd in the nightly build * disable Evergreen+ cards for now as they are tested non-functional. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42888 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 4 ++-- src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 90b9eee20a..295cb019e9 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -119,7 +119,7 @@ SYSTEM_ADD_ONS_ACCELERANTS = $(X86_ONLY)radeon.accelerant $(X86_ONLY)s3.accelerant $(X86_ONLY)vesa.accelerant $(X86_ONLY)ati.accelerant $(X86_ONLY)3dfx.accelerant - #$(X86_ONLY)radeon_hd.accelerant + $(X86_ONLY)radeon_hd.accelerant #$(X86_ONLY)via.accelerant #$(X86_ONLY)vmware.accelerant ; @@ -165,7 +165,7 @@ SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia usb_audio ; SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware - $(X86_ONLY)ati $(X86_ONLY)3dfx #$(X86_ONLY)radeon_hd + $(X86_ONLY)ati $(X86_ONLY)3dfx $(X86_ONLY)radeon_hd ; SYSTEM_ADD_ONS_DRIVERS_MIDI = emuxki usb_midi ; SYSTEM_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)atheros813x diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index cf19bdc41c..2884609f18 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -121,6 +121,8 @@ const struct supported_device { // From here on AMD no longer used numeric identifiers + // TODO: These don't work yet, no video. (maybe FB issue?) + # if 0 // R1000 series (HD54xx - HD63xx) // Codename: Evergreen // Cedar @@ -196,6 +198,7 @@ const struct supported_device { {0x671F, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD 6900"}, // Antilles {0x671d, 5, 0, RADEON_R2000 | 0x40, false, "Radeon HD 6990"} + #endif // R3000 series (HD74xx - HD79xx) // Codename: Southern Islands From b18a9bc3384189a6549e6558daaa3e1743d46ec3 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 20 Oct 2011 18:20:38 +0000 Subject: [PATCH 428/702] * add a Radeon HD IGP chip reported as missing git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42889 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 2884609f18..f9b6a3fe84 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -66,6 +66,7 @@ const struct supported_device { {0x940a, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V8650"}, {0x940b, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V8600"}, {0x940f, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V7600"}, + {0x9616, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3000"}, {0x9611, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, {0x9613, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, {0x9610, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, From b0efb2e13be72a285f29554f8d24b5194d1e62cf Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 20 Oct 2011 22:54:03 +0000 Subject: [PATCH 429/702] Skip non-file entries when enumerating OpenGL renderer add-ons. Fixes #8039. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42890 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/opengl/GLRendererRoster.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/kits/opengl/GLRendererRoster.cpp b/src/kits/opengl/GLRendererRoster.cpp index d4778c71aa..c4f5d81472 100644 --- a/src/kits/opengl/GLRendererRoster.cpp +++ b/src/kits/opengl/GLRendererRoster.cpp @@ -148,7 +148,12 @@ GLRendererRoster::AddPath(const char* path) int32 files = 0; entry_ref ref; + BEntry entry; while (directory.GetNextRef(&ref) == B_OK) { + entry.SetTo(&ref); + if (entry.InitCheck() == B_OK && !entry.IsFile()) + continue; + if (CreateRenderer(ref) == B_OK) count++; From a4ba3a0f61a920cb64dca0c49337586f45760a12 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 21 Oct 2011 14:32:01 +0000 Subject: [PATCH 430/702] * pass dceMajor and dceMinor to accelerant * will fix other var names to match style guidelines shortly git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42891 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon_hd/radeon_hd.h | 2 ++ src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp | 2 ++ src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp | 2 ++ .../kernel/drivers/graphics/radeon_hd/radeon_hd_private.h | 2 ++ 4 files changed, 8 insertions(+) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 9ce20ff0ec..2cacaacd49 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -119,6 +119,8 @@ struct radeon_shared_info { uint16 cursor_hot_y; uint16 device_chipset; + uint8 dceMajor; + uint8 dceMinor; char device_identifier[32]; }; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index f9b6a3fe84..d0a984e24b 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -337,6 +337,8 @@ init_driver(void) gDeviceInfo[found]->device_id = kSupportedDevices[type].device_id; gDeviceInfo[found]->device_identifier = kSupportedDevices[type].name; gDeviceInfo[found]->device_chipset = kSupportedDevices[type].chipset; + gDeviceInfo[found]->dceMajor = kSupportedDevices[type].dceMajor; + gDeviceInfo[found]->dceMinor = kSupportedDevices[type].dceMinor; dprintf(DEVICE_NAME ": GPU(%ld) %s, revision = 0x%x\n", found, kSupportedDevices[type].name, info->revision); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index e53d997317..27337bb9fb 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -378,6 +378,8 @@ radeon_hd_init(radeon_info &info) info.shared_info->device_index = info.id; info.shared_info->device_id = info.device_id; info.shared_info->device_chipset = info.device_chipset; + info.shared_info->dceMajor = info.dceMajor; + info.shared_info->dceMinor = info.dceMinor; info.shared_info->registers_area = info.registers_area; strcpy(info.shared_info->device_identifier, info.device_identifier); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index ca1b9b9dca..d6a67e670b 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -44,6 +44,8 @@ struct radeon_info { const char* device_identifier; uint32 device_id; uint16 device_chipset; + uint8 dceMajor; + uint8 dceMinor; }; From f089aa5229020b51c15e2fd294dcc5de269fdb5c Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 21 Oct 2011 14:53:40 +0000 Subject: [PATCH 431/702] * stub out dig encoder setup * adjust pll post divider calculation * fix digital encoder setup action * don't run memreq on DCE < 3, should solve some AtomBIOS failure loops git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42892 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/encoder.cpp | 48 ++++++++++++++++++- src/add-ons/accelerants/radeon_hd/encoder.h | 1 + src/add-ons/accelerants/radeon_hd/mode.cpp | 16 +++++-- src/add-ons/accelerants/radeon_hd/pll.cpp | 18 +++++-- 4 files changed, 73 insertions(+), 10 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 543e458c81..8c16d8c274 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -176,6 +176,7 @@ encoder_assign_crtc(uint8 crtcID) void encoder_mode_set(uint8 id, uint32 pixelClock) { + radeon_shared_info &info = *gInfo->shared_info; uint32 connectorIndex = gDisplay[id]->connectorIndex; switch (gConnector[connectorIndex]->encoder.objectID) { @@ -189,12 +190,40 @@ encoder_mode_set(uint8 id, uint32 pixelClock) case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_LVTM1: - encoder_digital_setup(id, pixelClock, ATOM_ENABLE); + encoder_digital_setup(id, pixelClock, PANEL_ENCODER_ACTION_ENABLE); break; case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: + if (info.dceMajor >= 4) { + //atombios_dig_transmitter_setup(encoder, + // ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); + // TODO: Disable the dig transmitter + encoder_dig_setup(id, pixelClock, ATOM_ENCODER_CMD_SETUP); + // Setup and enable the dig encoder + + //atombios_dig_transmitter_setup(encoder, + // ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); + // TODO: Enable the dig transmitter + } else { + //atombios_dig_transmitter_setup(encoder, + // ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); + // Disable the dig transmitter + encoder_dig_setup(id, pixelClock, ATOM_DISABLE); + // Disable the dig encoder + + /* setup and enable the encoder and transmitter */ + encoder_dig_setup(id, pixelClock, ATOM_ENABLE); + // Setup and enable the dig encoder + + //atombios_dig_transmitter_setup(encoder, + // ATOM_TRANSMITTER_ACTION_SETUP, 0, 0); + //atombios_dig_transmitter_setup(encoder, + // ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); + // TODO: Setup and Enable the dig transmitter + } + TRACE("%s: TODO for DIG encoder setup\n", __func__); break; case ENCODER_OBJECT_ID_INTERNAL_DDI: @@ -337,6 +366,23 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command) } +union dig_encoder_control { + DIG_ENCODER_CONTROL_PS_ALLOCATION v1; + DIG_ENCODER_CONTROL_PARAMETERS_V2 v2; + DIG_ENCODER_CONTROL_PARAMETERS_V3 v3; + DIG_ENCODER_CONTROL_PARAMETERS_V4 v4; +}; + + +status_t +encoder_dig_setup(uint8 id, uint32 pixelClock, int command) +{ + TRACE("%s: TODO\n", __func__); + + return B_OK; +} + + status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command) { diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index 9005506eed..45b40c1ccd 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -13,6 +13,7 @@ void encoder_assign_crtc(uint8 crt_id); void encoder_mode_set(uint8 id, uint32 pixelClock); status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command); status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command); +status_t encoder_dig_setup(uint8 id, uint32 pixelClock, int command); bool encoder_analog_load_detect(uint8 connectorIndex); void encoder_output_lock(bool lock); void encoder_crtc_scratch(uint8 crtcID); diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 4ede7be3fd..fea5ecb8e8 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -117,6 +117,8 @@ radeon_dpms_mode(void) void radeon_dpms_set(int mode) { + radeon_shared_info &info = *gInfo->shared_info; + switch(mode) { case B_DPMS_ON: TRACE("%s: ON\n", __func__); @@ -125,7 +127,8 @@ radeon_dpms_set(int mode) continue; display_crtc_lock(id, ATOM_ENABLE); display_crtc_power(id, ATOM_ENABLE); - display_crtc_memreq(id, ATOM_ENABLE); + if (info.dceMajor >= 3) + display_crtc_memreq(id, ATOM_ENABLE); display_crtc_blank(id, ATOM_DISABLE); display_crtc_lock(id, ATOM_DISABLE); } @@ -139,7 +142,8 @@ radeon_dpms_set(int mode) continue; display_crtc_lock(id, ATOM_ENABLE); display_crtc_blank(id, ATOM_ENABLE); - display_crtc_memreq(id, ATOM_DISABLE); + if (info.dceMajor >= 3) + display_crtc_memreq(id, ATOM_DISABLE); display_crtc_power(id, ATOM_DISABLE); display_crtc_lock(id, ATOM_DISABLE); } @@ -152,6 +156,8 @@ radeon_dpms_set(int mode) status_t radeon_set_display_mode(display_mode *mode) { + radeon_shared_info &info = *gInfo->shared_info; + // TODO: multi-monitor? for now we use VESA and not gDisplay edid // Set mode on each display for (uint8 id = 0; id < MAX_DISPLAY; id++) { @@ -169,7 +175,8 @@ radeon_set_display_mode(display_mode *mode) // *** CRT controler prep display_crtc_lock(id, ATOM_ENABLE); display_crtc_blank(id, ATOM_ENABLE); - display_crtc_memreq(id, ATOM_DISABLE); + if (info.dceMajor >= 3) + display_crtc_memreq(id, ATOM_DISABLE); display_crtc_power(id, ATOM_DISABLE); // *** CRT controler mode set @@ -187,7 +194,8 @@ radeon_set_display_mode(display_mode *mode) // *** CRT controler commit display_crtc_power(id, ATOM_ENABLE); - display_crtc_memreq(id, ATOM_ENABLE); + if (info.dceMajor >= 3) + display_crtc_memreq(id, ATOM_ENABLE); display_crtc_blank(id, ATOM_DISABLE); display_crtc_lock(id, ATOM_DISABLE); diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index d94f6c6fde..b0abd2d0d7 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -125,15 +125,13 @@ pll_limit_probe(pll_info *pll) void pll_compute_post_divider(pll_info *pll) { - radeon_shared_info &info = *gInfo->shared_info; - if ((pll->flags & PLL_USE_POST_DIV) != 0) { TRACE("%s: using AtomBIOS post divider\n", __func__); return; } uint32 vco; - if (info.device_chipset < (RADEON_R700 | 0x70)) { + if ((pll->flags & PLL_PREFER_MINM_OVER_MAXP) != 0) { if ((pll->flags & PLL_IS_LCD) != 0) vco = pll->lcdPllOutMin; else @@ -150,7 +148,7 @@ pll_compute_post_divider(pll_info *pll) uint32 postDivider = vco / pll->pixelClock; uint32 tmp = vco % pll->pixelClock; - if (info.device_chipset < (RADEON_R700 | 0x70)) { + if ((pll->flags & PLL_PREFER_MINM_OVER_MAXP) != 0) { if (tmp) postDivider++; } else { @@ -294,10 +292,20 @@ union adjust_pixel_clock { void pll_setup_flags(pll_info *pll, uint8 crtcID) { + radeon_shared_info &info = *gInfo->shared_info; uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; uint32 encoderFlags = gConnector[connectorIndex]->encoder.flags; - pll->flags |= PLL_PREFER_LOW_REF_DIV; + if ((info.dceMajor >= 3 && info.dceMinor >= 2) + && pll->pixelClock > 200000) { + pll->flags |= PLL_PREFER_HIGH_FB_DIV; + } else + pll->flags |= PLL_PREFER_LOW_REF_DIV; + + + if (info.device_chipset < (RADEON_R700 | 0x70)) + pll->flags |= PLL_PREFER_MINM_OVER_MAXP; + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { pll->flags |= PLL_IS_LCD; From f3cb4623c8f4d77d12916cc6bee9cfc61e7c197d Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 21 Oct 2011 15:52:22 +0000 Subject: [PATCH 432/702] * take note of external encoders git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42893 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/accelerant.h | 1 + src/add-ons/accelerants/radeon_hd/display.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index c54ab3eb6b..f27aa5b44a 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -136,6 +136,7 @@ struct encoder_info { uint16 objectID; uint32 type; uint32 flags; + bool isExternal; bool isHDMI; bool isTV; struct pll_info pll; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index d074de2c26..c77a4c03df 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -470,6 +470,8 @@ detect_connectors() >> OBJECT_ID_SHIFT; uint32 encoderType = VIDEO_ENCODER_NONE; + bool encoderExternal = false; + switch(encoderID) { case ENCODER_OBJECT_ID_INTERNAL_LVDS: case ENCODER_OBJECT_ID_INTERNAL_TMDS1: @@ -519,6 +521,7 @@ detect_connectors() case ENCODER_OBJECT_ID_HDMI_SI1930: case ENCODER_OBJECT_ID_TRAVIS: case ENCODER_OBJECT_ID_NUTMEG: + encoderExternal = true; if ((connectorFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { encoderType = VIDEO_ENCODER_LVDS; @@ -552,6 +555,8 @@ detect_connectors() = encoderID; gConnector[connectorIndex]->encoder.type = encoderType; + gConnector[connectorIndex]->encoder.isExternal + = encoderExternal; pll_limit_probe( &gConnector[connectorIndex]->encoder.pll); From f9ba150bd987db80fb3c41b0984dd3ee2dcd26c0 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 21 Oct 2011 16:30:03 +0000 Subject: [PATCH 433/702] Adding the PulsedDrawing test app that redraws its view every second with a random color. It can be used to reproduce an app_server bug that causes the view to be drawn on the last position on the old workspace when the window is moved to another workspace using Workspaces. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42894 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/servers/app/Jamfile | 1 + src/tests/servers/app/pulsed_drawing/Jamfile | 17 +++++ src/tests/servers/app/pulsed_drawing/main.cpp | 62 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 src/tests/servers/app/pulsed_drawing/Jamfile create mode 100644 src/tests/servers/app/pulsed_drawing/main.cpp diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile index ce08d755e6..78bf6253a1 100644 --- a/src/tests/servers/app/Jamfile +++ b/src/tests/servers/app/Jamfile @@ -216,6 +216,7 @@ SubInclude HAIKU_TOP src tests servers app menu_crash ; SubInclude HAIKU_TOP src tests servers app no_pointer_history ; SubInclude HAIKU_TOP src tests servers app painter ; SubInclude HAIKU_TOP src tests servers app playground ; +SubInclude HAIKU_TOP src tests servers app pulsed_drawing ; SubInclude HAIKU_TOP src tests servers app regularapps ; SubInclude HAIKU_TOP src tests servers app resize_limits ; SubInclude HAIKU_TOP src tests servers app scrollbar ; diff --git a/src/tests/servers/app/pulsed_drawing/Jamfile b/src/tests/servers/app/pulsed_drawing/Jamfile new file mode 100644 index 0000000000..c6a348b081 --- /dev/null +++ b/src/tests/servers/app/pulsed_drawing/Jamfile @@ -0,0 +1,17 @@ +SubDir HAIKU_TOP src tests servers app pulsed_drawing ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +UseHeaders [ FDirName os app ] ; +UseHeaders [ FDirName os interface ] ; + +SimpleTest PulsedDrawing : + main.cpp + : be $(TARGET_LIBSUPC++) ; + +if ( $(TARGET_PLATFORM) = libbe_test ) { + HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : PulsedDrawing + : tests!apps ; +} + diff --git a/src/tests/servers/app/pulsed_drawing/main.cpp b/src/tests/servers/app/pulsed_drawing/main.cpp new file mode 100644 index 0000000000..32a406a281 --- /dev/null +++ b/src/tests/servers/app/pulsed_drawing/main.cpp @@ -0,0 +1,62 @@ +#include +#include + +#include +#include +#include + + +class PulsedView : public BView { +public: + PulsedView(BRect frame) + : + BView(frame, "pulsed view", B_FOLLOW_ALL, B_WILL_DRAW) + { + } + + virtual void Draw(BRect updateRect) + { + SetHighColor(rand() % 255, rand() % 255, rand() % 255, 255); + FillRect(updateRect); + } +}; + + +class PulsedApplication : public BApplication { +public: + PulsedApplication() + : + BApplication("application/x-vnd.haiku.pulsed_drawing") + { + BRect frame(100, 100, 400, 300); + BWindow* window = new BWindow(frame, "Pulsed Drawing", + B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_QUIT_ON_WINDOW_CLOSE); + + fView = new PulsedView(frame.OffsetToCopy(0, 0)); + window->AddChild(fView); + window->Show(); + + SetPulseRate(1 * 1000 * 1000); + } + + virtual void Pulse() + { + if (!fView->LockLooper()) + return; + + fView->Invalidate(); + fView->UnlockLooper(); + } + +private: + PulsedView* fView; +}; + + +int +main(int argc, char* argv[]) +{ + PulsedApplication app; + app.Run(); + return 0; +} From c5862c76d37dfcaf0152d7ba63728e7d3d8f7510 Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Fri, 21 Oct 2011 19:14:06 +0000 Subject: [PATCH 434/702] Patch by scgtrp (Mike Smith) to copy DSDT to memory, as some machines corrupt DSDT after boot. This fixes bug #8043. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42895 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/settings/kernel/drivers/kernel | 4 ++++ src/add-ons/kernel/bus_managers/acpi/acpi_busman.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/data/settings/kernel/drivers/kernel b/data/settings/kernel/drivers/kernel index 0c7fd48873..50a27f988d 100644 --- a/data/settings/kernel/drivers/kernel +++ b/data/settings/kernel/drivers/kernel @@ -64,6 +64,10 @@ load_symbols true # Avoids running _INI and _STA methods and final object initialization, # which may be used to for debugging ACPI issues, false by default +#acpi_copy_dsdt true + # Makes a copy of the DSDT during boot, to work around BIOSes that + # corrupt it, false by default + #disable_ioapic true # Disables IO-APIC support, enabled by default diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c index 8dc0361e51..71443ef26d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c @@ -97,6 +97,8 @@ acpi_std_ops(int32 op,...) true, true); acpiAvoidFullInit = get_driver_boolean_parameter(settings, "acpi_avoid_full_init", false, false); + AcpiGbl_CopyDsdtLocally = get_driver_boolean_parameter(settings, + "acpi_copy_dsdt", false, false); unload_driver_settings(settings); } From 97d5dc0a3c90deb20d32e757d3e9c9f14431d34a Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Fri, 21 Oct 2011 19:42:46 +0000 Subject: [PATCH 435/702] I was being lazy, as pointe out by mmlr. It is much better to copy DSDT always do you don't need to figure out if you need to toggle that switch. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42896 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/settings/kernel/drivers/kernel | 4 ---- src/add-ons/kernel/bus_managers/acpi/acpi_busman.c | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/data/settings/kernel/drivers/kernel b/data/settings/kernel/drivers/kernel index 50a27f988d..0c7fd48873 100644 --- a/data/settings/kernel/drivers/kernel +++ b/data/settings/kernel/drivers/kernel @@ -64,10 +64,6 @@ load_symbols true # Avoids running _INI and _STA methods and final object initialization, # which may be used to for debugging ACPI issues, false by default -#acpi_copy_dsdt true - # Makes a copy of the DSDT during boot, to work around BIOSes that - # corrupt it, false by default - #disable_ioapic true # Disables IO-APIC support, enabled by default diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c index 71443ef26d..ce4744bca8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c @@ -90,6 +90,7 @@ acpi_std_ops(int32 op,...) void *settings; bool acpiDisabled = false; bool acpiAvoidFullInit = false; + AcpiGbl_CopyDsdtLocally = true; settings = load_driver_settings("kernel"); if (settings != NULL) { @@ -97,8 +98,6 @@ acpi_std_ops(int32 op,...) true, true); acpiAvoidFullInit = get_driver_boolean_parameter(settings, "acpi_avoid_full_init", false, false); - AcpiGbl_CopyDsdtLocally = get_driver_boolean_parameter(settings, - "acpi_copy_dsdt", false, false); unload_driver_settings(settings); } From 72bc31d759ece38f0fd718b7d9b9cf533f4818dc Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 21 Oct 2011 22:13:58 +0000 Subject: [PATCH 436/702] * get some DIG code done, lots of commented out Display Port stuff. We need special DIG encoder storage unless I can find a way to mash it into the same box as the other encoders. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42897 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/encoder.cpp | 145 +++++++++++++++++- 1 file changed, 143 insertions(+), 2 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 8c16d8c274..7e711a089f 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -377,9 +377,150 @@ union dig_encoder_control { status_t encoder_dig_setup(uint8 id, uint32 pixelClock, int command) { - TRACE("%s: TODO\n", __func__); + radeon_shared_info &info = *gInfo->shared_info; - return B_OK; + uint32 connectorIndex = gDisplay[id]->connectorIndex; + uint32 encoderID = gConnector[connectorIndex]->encoder.objectID; + + union dig_encoder_control args; + int index = 0; + + uint8 tableMajor; + uint8 tableMinor; + + memset(&args, 0, sizeof(args)); + + if (info.dceMajor > 4) + index = GetIndexIntoMasterTable(COMMAND, DIGxEncoderControl); + else { + if (1) // TODO: pick dig encoder + index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl); + else + index = GetIndexIntoMasterTable(COMMAND, DIG2EncoderControl); + } + + if (atom_parse_cmd_header(gAtomContext, index, &tableMajor, &tableMinor) + != B_OK) { + ERROR("%s: cannot parse command table\n", __func__); + return B_ERROR; + } + + args.v1.ucAction = command; + args.v1.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + + #if 0 + if (command == ATOM_ENCODER_CMD_SETUP_PANEL_MODE) { + if (info.dceMajor >= 4 && 0) // TODO: 0 == if DP bridge + args.v3.ucPanelMode = DP_PANEL_MODE_INTERNAL_DP1_MODE; + else + args.v3.ucPanelMode = DP_PANEL_MODE_EXTERNAL_DP_MODE; + } else { + args.v1.ucEncoderMode = display_get_encoder_mode(connectorIndex); + + if (args.v1.ucEncoderMode == ATOM_ENCODER_MODE_DP + || args.v1.ucEncoderMode == ATOM_ENCODER_MODE_DP_MST) { + args.v1.ucLaneNum = dp_lane_count; + } else if (pixelClock > 165000) + args.v1.ucLaneNum = 8; + else + args.v1.ucLaneNum = 4; + + if (info.dceMajor >= 5) { + if (args.v1.ucEncoderMode == ATOM_ENCODER_MODE_DP + || args.v1.ucEncoderMode == ATOM_ENCODER_MODE_DP_MST) { + if (dpClock == 270000) { + args.v1.ucConfig + |= ATOM_ENCODER_CONFIG_V4_DPLINKRATE_2_70GHZ; + } else if (dpClock == 540000) { + args.v1.ucConfig + |= ATOM_ENCODER_CONFIG_V4_DPLINKRATE_5_40GHZ; + } + } + args.v4.acConfig.ucDigSel = dig->dig_encoder; + switch (bpc) { + case 0: + args.v4.ucBitPerColor = PANEL_BPC_UNDEFINE; + break; + case 6: + args.v4.ucBitPerColor = PANEL_6BIT_PER_COLOR; + break; + case 8: + default: + args.v4.ucBitPerColor = PANEL_8BIT_PER_COLOR; + break; + case 10: + args.v4.ucBitPerColor = PANEL_10BIT_PER_COLOR; + break; + case 12: + args.v4.ucBitPerColor = PANEL_12BIT_PER_COLOR; + break; + case 16: + args.v4.ucBitPerColor = PANEL_16BIT_PER_COLOR; + break; + } + + //if (hpdID == RADEON_HPD_NONE) + if (1) + args.v4.ucHPD_ID = 0; + else + args.v4.ucHPD_ID = hpd_id + 1; + + } else if (info.dceMajor >= 4) { + if (args.v1.ucEncoderMode == ATOM_ENCODER_MODE_DP + && dp_clock == 270000) { + args.v1.ucConfig |= ATOM_ENCODER_CONFIG_V3_DPLINKRATE_2_70GHZ; + } + + args.v3.acConfig.ucDigSel = dig->dig_encoder; + switch (bpc) { + case 0: + args.v3.ucBitPerColor = PANEL_BPC_UNDEFINE; + break; + case 6: + args.v3.ucBitPerColor = PANEL_6BIT_PER_COLOR; + break; + case 8: + default: + args.v3.ucBitPerColor = PANEL_8BIT_PER_COLOR; + break; + case 10: + args.v3.ucBitPerColor = PANEL_10BIT_PER_COLOR; + break; + case 12: + args.v3.ucBitPerColor = PANEL_12BIT_PER_COLOR; + break; + case 16: + args.v3.ucBitPerColor = PANEL_16BIT_PER_COLOR; + break; + } + + } else { + if (args.v1.ucEncoderMode == ATOM_ENCODER_MODE_DP + && dp_clock == 270000) { + args.v1.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ; + } + #endif + switch (encoderID) { + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: + args.v1.ucConfig = ATOM_ENCODER_CONFIG_V2_TRANSMITTER1; + break; + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: + args.v1.ucConfig = ATOM_ENCODER_CONFIG_V2_TRANSMITTER2; + break; + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: + args.v1.ucConfig = ATOM_ENCODER_CONFIG_V2_TRANSMITTER3; + break; + } + #if 0 + if (dig->linkb) + args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKB; + else + args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKA; + } + #endif + + return atom_execute_table(gAtomContext, index, (uint32*)&args); } From bbf37742d360c6c696fa0c235d86e65572f401b1 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 21 Oct 2011 22:44:23 +0000 Subject: [PATCH 437/702] * start using DCE versions in framebuffer code as it gives us finer control git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42898 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index c77a4c03df..6a5f150ba1 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -846,7 +846,7 @@ display_crtc_scale(uint8 crtcID, display_mode *mode) args.ucScaler = crtcID; args.ucEnable = ATOM_SCALER_EXPANSION; - atom_execute_table(gAtomContext, index, (uint32 *)&args); + atom_execute_table(gAtomContext, index, (uint32*)&args); } @@ -857,7 +857,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) register_info* regs = gDisplay[crtcID]->regs; uint32 fbSwap; - if (info.device_chipset >= RADEON_R1000) + if (info.dceMajor >= 4) fbSwap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); else fbSwap = R600_D1GRPH_SWAP_ENDIAN_NONE; @@ -871,7 +871,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) case B_CMAP8: bytesPerPixel = 1; bitsPerPixel = 8; - if (info.device_chipset >= RADEON_R1000) { // DCE4 + if (info.dceMajor >= 4) { fbFormat = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_8BPP) | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_INDEXED)); } else { @@ -882,7 +882,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) case B_RGB15_LITTLE: bytesPerPixel = 2; bitsPerPixel = 15; - if (info.device_chipset >= RADEON_R1000) { // DCE4 + if (info.dceMajor >= 4) { fbFormat = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB1555)); } else { @@ -894,7 +894,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) bytesPerPixel = 2; bitsPerPixel = 16; - if (info.device_chipset >= RADEON_R1000) { // DCE4 + if (info.dceMajor >= 4) { fbFormat = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); #ifdef __POWERPC__ @@ -914,7 +914,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) default: bytesPerPixel = 4; bitsPerPixel = 32; - if (info.device_chipset >= RADEON_R1000) { // DCE4 + if (info.dceMajor >= 4) { fbFormat = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); #ifdef __POWERPC__ @@ -974,7 +974,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) (viewport_w << 16) | viewport_h); // Pageflip setup - if (info.device_chipset >= RADEON_R1000) { // DCE4 + if (info.dceMajor >= 4) { uint32 tmp = Read32(OUT, EVERGREEN_GRPH_FLIP_CONTROL + regs->crtcOffset); tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN; From a3f90d5ccafd3f0d6872196133e5786e6bac76e7 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 24 Oct 2011 10:21:22 +0000 Subject: [PATCH 438/702] Unlike FreeBSD we use a ifmultiaddr struct field to store the address and let the ifma_addr point to that. Therefore freeing it caused a misaligned free and then a double free, resulting in heap corruption for the next user to fall victim to. Only happened when removing multicast addresses though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42899 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/libs/compat/freebsd_network/if.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/compat/freebsd_network/if.c b/src/libs/compat/freebsd_network/if.c index 4b6e032806..257e44b8b8 100644 --- a/src/libs/compat/freebsd_network/if.c +++ b/src/libs/compat/freebsd_network/if.c @@ -406,7 +406,6 @@ if_freemulti(struct ifmultiaddr *ifma) if (ifma->ifma_lladdr != NULL) free(ifma->ifma_lladdr); - free(ifma->ifma_addr); free(ifma); } From edfba0bb0395bb825edc4766c990b246a7de92eb Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 24 Oct 2011 10:25:41 +0000 Subject: [PATCH 439/702] Actually put a note about the Haiku specific there, so that this isn't overlooked accidentally on future updates. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42900 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/libs/compat/freebsd_network/if.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libs/compat/freebsd_network/if.c b/src/libs/compat/freebsd_network/if.c index 257e44b8b8..fc418c6619 100644 --- a/src/libs/compat/freebsd_network/if.c +++ b/src/libs/compat/freebsd_network/if.c @@ -406,6 +406,12 @@ if_freemulti(struct ifmultiaddr *ifma) if (ifma->ifma_lladdr != NULL) free(ifma->ifma_lladdr); + + // Haiku note: We use a field in the ifmultiaddr struct (ifma_addr_storage) + // to store the address and let ifma_addr point to that. We therefore do not + // free it here, as it will be freed as part of freeing the if_multiaddr. + //free(ifma->ifma_addr); + free(ifma); } From 98421bb88721b382172c0ead3e511b254dd5de36 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 24 Oct 2011 14:58:27 +0000 Subject: [PATCH 440/702] * simplify some trace statements * add potential support for IGP chipsets * igp code is *untested* and should work *in theory* * potentially resolves #8040 / #8046 ? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42901 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 1 + .../drivers/graphics/radeon_hd/driver.cpp | 3 +- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 112 ++++++++++-------- .../graphics/radeon_hd/radeon_hd_private.h | 1 + 4 files changed, 66 insertions(+), 51 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 2cacaacd49..915ff5eadd 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -121,6 +121,7 @@ struct radeon_shared_info { uint16 device_chipset; uint8 dceMajor; uint8 dceMinor; + bool isIGP; char device_identifier[32]; }; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index d0a984e24b..09e136d1b8 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -43,7 +43,7 @@ const struct supported_device { uint8 dceMajor; // Display block family uint8 dceMinor; // Display block family uint16 chipset; - bool igp; + bool isIGP; const char* name; } kSupportedDevices[] = { // R400 Series (Radeon) DCE 0.0 (*very* early AtomBIOS) @@ -339,6 +339,7 @@ init_driver(void) gDeviceInfo[found]->device_chipset = kSupportedDevices[type].chipset; gDeviceInfo[found]->dceMajor = kSupportedDevices[type].dceMajor; gDeviceInfo[found]->dceMinor = kSupportedDevices[type].dceMinor; + gDeviceInfo[found]->isIGP = kSupportedDevices[type].isIGP; dprintf(DEVICE_NAME ": GPU(%ld) %s, revision = 0x%x\n", found, kSupportedDevices[type].name, info->revision); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 27337bb9fb..1cbf24d2b7 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -34,6 +34,7 @@ # define TRACE(x) ; #endif +#define ERROR(x...) dprintf("radeon_hd: " x) // #pragma mark - @@ -57,99 +58,109 @@ radeon_hd_getbios(radeon_info &info) { TRACE("card(%ld): %s: called\n", info.id, __func__); - // Enable ROM decoding - uint32 rom_config = get_pci_config(info.pci, PCI_rom_base, 4); - rom_config |= PCI_rom_enable; - set_pci_config(info.pci, PCI_rom_base, 4, rom_config); + uint32 romBase; + uint32 romSize; + uint32 romConfig = 0; - uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); - if (flags & PCI_rom_enable) - TRACE("%s: PCI ROM decode enabled successfully\n", __func__); + if (info.isIGP == true) { + romBase = info.pci->u.h1.memory_base; + romSize = 256 * 1024; + // a complete guess + } else { + // Enable ROM decoding for PCI bar rom + romConfig = get_pci_config(info.pci, PCI_rom_base, 4); + romConfig |= PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, romConfig); - uint32 rom_base = info.pci->u.h0.rom_base; - uint32 rom_size = info.pci->u.h0.rom_size; + uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); + if (flags & PCI_rom_enable) + TRACE("%s: PCI ROM decode enabled successfully\n", __func__); - if (rom_base == 0) { - TRACE("%s: no PCI rom, trying shadow rom\n", __func__); - // ROM has been copied by BIOS - rom_base = 0xC0000; - if (rom_size == 0) { - rom_size = 0x7FFF; - // A guess at maximum shadow bios size + romBase = info.pci->u.h0.rom_base; + romSize = info.pci->u.h0.rom_size; + + if (romBase == 0) { + TRACE("%s: no PCI rom, trying shadow rom\n", __func__); + // ROM has been copied by BIOS + romBase = 0xC0000; + if (romSize == 0) { + romSize = 0x7FFF; + // A guess at maximum shadow bios size + } } } TRACE("%s: seeking rom at 0x%" B_PRIX32 " [size: 0x%" B_PRIX32 "]\n", - __func__, rom_base, rom_size); + __func__, romBase, romSize); uint8* bios; status_t result = B_ERROR; - if (rom_base == 0 || rom_size == 0) { + if (romBase == 0 || romSize == 0) { // FAIL: we never found a base to work off of. - dprintf(DEVICE_NAME ": %s: no rom address located.\n", __func__); + ERROR("%s: no rom address located.\n", __func__); result = B_ERROR; } else { area_id rom_area = map_physical_memory("radeon hd rom", - rom_base, rom_size, B_ANY_KERNEL_ADDRESS, B_READ_AREA, + romBase, romSize, B_ANY_KERNEL_ADDRESS, B_READ_AREA, (void **)&bios); if (info.rom_area < B_OK) { // FAIL : rom area wasn't mapped for access - dprintf(DEVICE_NAME ": failed to map rom\n"); + ERROR("%s: failed to map rom\n", __func__); result = B_ERROR; } else { if (bios[0] != 0x55 || bios[1] != 0xAA) { // FAIL : not a PCI rom uint16 id = bios[0] + (bios[1] << 8); - dprintf(DEVICE_NAME ": %s: this isn't a PCI rom (%X)\n", + ERROR("%s: this isn't a PCI rom (%X)\n", __func__, id); result = B_ERROR; } else if (isAtomBIOS(bios)) { info.rom_area = create_area("radeon hd AtomBIOS", (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, - rom_size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + romSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); if (info.rom_area < 0) { // FAIL : couldn't create kernel AtomBIOS area - dprintf(DEVICE_NAME ": %s: Error creating kernel" + ERROR("%s: Error creating kernel" " AtomBIOS area!\n", __func__); result = B_ERROR; } else { - memset((void*)info.atom_buffer, 0, rom_size); + memset((void*)info.atom_buffer, 0, romSize); // Prevent unknown code execution by AtomBIOS parser - memcpy(info.atom_buffer, (void *)bios, rom_size); + memcpy(info.atom_buffer, (void *)bios, romSize); // Copy AtomBIOS to kernel area if (isAtomBIOS(info.atom_buffer)) { // SUCCESS : bios copied and verified - dprintf(DEVICE_NAME ": %s: AtomBIOS mapped!\n", - __func__); + ERROR("%s: AtomBIOS mapped!\n", __func__); set_area_protection(info.rom_area, B_READ_AREA); // Lock it down result = B_OK; } else { // FAIL : bios didn't copy properly for some reason - dprintf(DEVICE_NAME ": %s: AtomBIOS not mapped!\n", - __func__); + ERROR("%s: AtomBIOS not mapped!\n", __func__); result = B_ERROR; } } } else { - dprintf(DEVICE_NAME ": %s: rom found wasn't identified" - " as AtomBIOS!\n", __func__); + ERROR("%s: rom found wasn't identified" + " as AtomBIOS!\n", __func__); result = B_ERROR; } delete_area(rom_area); } } - // Disable ROM decoding - rom_config &= ~PCI_rom_enable; - set_pci_config(info.pci, PCI_rom_base, 4, rom_config); + if (info.isIGP == false) { + // Disable ROM decoding + romConfig &= ~PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, romConfig); + } if (result == B_OK) { - info.shared_info->rom_phys = rom_base; - info.shared_info->rom_size = rom_size; + info.shared_info->rom_phys = romBase; + info.shared_info->rom_size = romSize; } return result; @@ -323,9 +334,9 @@ radeon_hd_init(radeon_info &info) { TRACE("card(%ld): %s: called\n", info.id, __func__); - dprintf(DEVICE_NAME ": card(%ld): " + ERROR("%s: card(%ld): " "Radeon r%" B_PRIX16 " 1002:%" B_PRIX32 "\n", - info.id, info.device_chipset, info.device_id); + __func__, info.id, info.device_chipset, info.device_id); // *** Map shared info AreaKeeper sharedCreator; @@ -333,8 +344,8 @@ radeon_hd_init(radeon_info &info) (void **)&info.shared_info, B_ANY_KERNEL_ADDRESS, ROUND_TO_PAGE_SIZE(sizeof(radeon_shared_info)), B_FULL_LOCK, 0); if (info.shared_area < B_OK) { - dprintf(DEVICE_NAME ": card (%ld): couldn't map shared area!\n", - info.id); + ERROR("%s: card (%ld): couldn't map shared area!\n", + __func__, info.id); return info.shared_area; } @@ -348,8 +359,8 @@ radeon_hd_init(radeon_info &info) B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void **)&info.registers); if (mmioMapper.InitCheck() < B_OK) { - dprintf(DEVICE_NAME ": card (%ld): couldn't map memory I/O!\n", - info.id); + ERROR("%s: card (%ld): couldn't map memory I/O!\n", + __func__, info.id); return info.registers_area; } @@ -361,8 +372,8 @@ radeon_hd_init(radeon_info &info) B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, (void **)&info.shared_info->frame_buffer); if (frambufferMapper.InitCheck() < B_OK) { - dprintf(DEVICE_NAME ": card(%ld): couldn't map framebuffer!\n", - info.id); + ERROR("%s: card(%ld): couldn't map framebuffer!\n", + __func__, info.id); return info.framebuffer_area; } @@ -380,6 +391,7 @@ radeon_hd_init(radeon_info &info) info.shared_info->device_chipset = info.device_chipset; info.shared_info->dceMajor = info.dceMajor; info.shared_info->dceMinor = info.dceMinor; + info.shared_info->isIGP = info.isIGP; info.shared_info->registers_area = info.registers_area; strcpy(info.shared_info->device_identifier, info.device_identifier); @@ -407,12 +419,12 @@ radeon_hd_init(radeon_info &info) // Check if a valid AtomBIOS image was found. if (biosStatus != B_OK) { - dprintf(DEVICE_NAME ": card (%ld): couldn't find AtomBIOS rom!\n", - info.id); - dprintf(DEVICE_NAME ": card (%ld): exiting. Please open a bug ticket" + ERROR("%s: card (%ld): couldn't find AtomBIOS rom!\n", + __func__, info.id); + ERROR("%s: card (%ld): exiting. Please open a bug ticket" " at haiku-os.org with your /var/log/syslog\n", - info.id); - // Fallback to VESA + __func__, info.id); + // Fallback to VESA (more likely crash app_server) return B_ERROR; } diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index d6a67e670b..c2bc0e1051 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -46,6 +46,7 @@ struct radeon_info { uint16 device_chipset; uint8 dceMajor; uint8 dceMinor; + bool isIGP; }; From bc096b828edf245b76127c39d4dc32e78f3c93d4 Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Mon, 24 Oct 2011 15:57:18 +0000 Subject: [PATCH 441/702] Applied patch inserting newlines in error message. Closes #7953. Thanks diver. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42902 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/launchbox/MainWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/launchbox/MainWindow.cpp b/src/apps/launchbox/MainWindow.cpp index d8bbd0a5d1..8499f5abe6 100644 --- a/src/apps/launchbox/MainWindow.cpp +++ b/src/apps/launchbox/MainWindow.cpp @@ -141,7 +141,7 @@ MainWindow::MessageReceived(BMessage* message) status_t ret = be_roster->Launch(button->Ref()); if (ret < B_OK && ret != B_ALREADY_RUNNING) { BString errStr(B_TRANSLATE("Failed to launch '%1'.\n" - "\nError: ")); + "\nError:")); BPath path(button->Ref()); if (path.InitCheck() >= B_OK) errStr.ReplaceFirst("%1", path.Path()); @@ -156,8 +156,8 @@ MainWindow::MessageReceived(BMessage* message) if (!launchedByRef && button->AppSignature()) { status_t ret = be_roster->Launch(button->AppSignature()); if (ret != B_OK && ret != B_ALREADY_RUNNING) { - BString errStr(B_TRANSLATE("Failed to launch application " - "with signature '%2'.\n\nError: ")); + BString errStr(B_TRANSLATE("\n\nFailed to launch application " + "with signature '%2'.\n\nError:")); errStr.ReplaceFirst("%2", button->AppSignature()); errorMessage << errStr.String() << " "; errorMessage << strerror(ret); From 6f2ec43df7c09a69f587f43e3cbc0fc20eac9f03 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 24 Oct 2011 17:03:48 +0000 Subject: [PATCH 442/702] * memory_base isn't what I thought it was and is 0x0 * look at PCI bar 0 (Frame buffer base) for AtomBIOS * potential solution to #8040 ? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42903 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/graphics/radeon_hd/radeon_hd.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 1cbf24d2b7..f1aac4a644 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -63,9 +63,12 @@ radeon_hd_getbios(radeon_info &info) uint32 romConfig = 0; if (info.isIGP == true) { - romBase = info.pci->u.h1.memory_base; + // IGP chipsets don't have a PCI rom BAR. + // On post, the bios puts a copy of the IGP + // AtomBIOS at the start of the video ram + romBase = info.pci->u.h0.base_registers[RHD_FB_BAR]; romSize = 256 * 1024; - // a complete guess + // romSize an educated guess } else { // Enable ROM decoding for PCI bar rom romConfig = get_pci_config(info.pci, PCI_rom_base, 4); From d5c8ef5d6980887025cdf3d87faf1ae9bf2eb38d Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 24 Oct 2011 17:53:22 +0000 Subject: [PATCH 443/702] * add chipset flags vs isIGP * we can now utilize these chipset flags throughout the driver to better id cards and features * remove leftover BIOS size define from intel skel * no *real* functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42904 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 10 +- .../drivers/graphics/radeon_hd/driver.cpp | 242 +++++++++--------- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 6 +- .../graphics/radeon_hd/radeon_hd_private.h | 2 +- 4 files changed, 133 insertions(+), 127 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 915ff5eadd..344df082cd 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -27,6 +27,7 @@ #define VENDOR_ID_ATI 0x1002 +// Card models #define RADEON_R520 0x0520 // Fudo #define RADEON_R580 0x0580 // Rodin #define RADEON_R600 0x0600 // Pele @@ -36,7 +37,12 @@ #define RADEON_R3000 0x3000 // Southern Islands #define RADEON_R4000 0x4000 // Not yet known / used -#define RADEON_VBIOS_SIZE 0x10000 +// Card chipset flags +#define CHIP_STD (1 << 0) // Standard chipset +#define CHIP_IGP (1 << 1) // IGP chipset +#define CHIP_MOBILE (1 << 2) // Mobile chipset +#define CHIP_DISCREET (1 << 3) // Discreet chipset +#define CHIP_APU (1 << 4) // APU chipset #define DEVICE_NAME "radeon_hd" #define RADEON_ACCELERANT_NAME "radeon_hd.accelerant" @@ -119,9 +125,9 @@ struct radeon_shared_info { uint16 cursor_hot_y; uint16 device_chipset; + uint32 chipsetFlags; uint8 dceMajor; uint8 dceMinor; - bool isIGP; char device_identifier[32]; }; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 09e136d1b8..65b1c989a0 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -43,82 +43,82 @@ const struct supported_device { uint8 dceMajor; // Display block family uint8 dceMinor; // Display block family uint16 chipset; - bool isIGP; + uint32 chipsetFlags; const char* name; } kSupportedDevices[] = { // R400 Series (Radeon) DCE 0.0 (*very* early AtomBIOS) // R500 Series (Radeon Xxxx) DCE 1.0 // R600 series (HD24xx - HD42xx) // Codename: Pele - {0x94c7, 2, 0, RADEON_R600 | 0x10, false, "Radeon HD 2350"}, - {0x94c1, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 2400"}, - {0x94c3, 2, 0, RADEON_R600 | 0x10, false, "Radeon HD 2400"}, - {0x94cc, 2, 0, RADEON_R600 | 0x10, false, "Radeon HD 2400"}, - {0x9586, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 2600"}, - {0x9588, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 2600"}, - {0x958a, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 2600 X2"}, + {0x94c7, 2, 0, RADEON_R600 | 0x10, CHIP_STD, "Radeon HD 2350"}, + {0x94c1, 2, 0, RADEON_R600 | 0x10, CHIP_IGP, "Radeon HD 2400"}, + {0x94c3, 2, 0, RADEON_R600 | 0x10, CHIP_STD, "Radeon HD 2400"}, + {0x94cc, 2, 0, RADEON_R600 | 0x10, CHIP_STD, "Radeon HD 2400"}, + {0x9586, 2, 0, RADEON_R600 | 0x30, CHIP_STD, "Radeon HD 2600"}, + {0x9588, 2, 0, RADEON_R600 | 0x30, CHIP_STD, "Radeon HD 2600"}, + {0x958a, 2, 0, RADEON_R600 | 0x30, CHIP_STD, "Radeon HD 2600 X2"}, // Radeon 2700 - RV630 - {0x9400, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, - {0x9401, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, - {0x9402, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, - {0x9403, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900 Pro"}, - {0x9405, 2, 0, RADEON_R600 | 0x00, false, "Radeon HD 2900"}, - {0x940a, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V8650"}, - {0x940b, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V8600"}, - {0x940f, 2, 0, RADEON_R600 | 0x00, false, "Radeon FireGL V7600"}, - {0x9616, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3000"}, - {0x9611, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, - {0x9613, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 3100"}, - {0x9610, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, - {0x9612, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, - {0x9615, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3200"}, - {0x9614, 2, 0, RADEON_R600 | 0x10, true, "Radeon HD 3300"}, + {0x9400, 2, 0, RADEON_R600 | 0x00, CHIP_STD, "Radeon HD 2900"}, + {0x9401, 2, 0, RADEON_R600 | 0x00, CHIP_STD, "Radeon HD 2900"}, + {0x9402, 2, 0, RADEON_R600 | 0x00, CHIP_STD, "Radeon HD 2900"}, + {0x9403, 2, 0, RADEON_R600 | 0x00, CHIP_STD, "Radeon HD 2900 Pro"}, + {0x9405, 2, 0, RADEON_R600 | 0x00, CHIP_STD, "Radeon HD 2900"}, + {0x940a, 2, 0, RADEON_R600 | 0x00, CHIP_STD, "Radeon FireGL V8650"}, + {0x940b, 2, 0, RADEON_R600 | 0x00, CHIP_STD, "Radeon FireGL V8600"}, + {0x940f, 2, 0, RADEON_R600 | 0x00, CHIP_STD, "Radeon FireGL V7600"}, + {0x9616, 2, 0, RADEON_R600 | 0x10, CHIP_IGP, "Radeon HD 3000"}, + {0x9611, 3, 0, RADEON_R600 | 0x20, CHIP_IGP, "Radeon HD 3100"}, + {0x9613, 3, 0, RADEON_R600 | 0x20, CHIP_IGP, "Radeon HD 3100"}, + {0x9610, 2, 0, RADEON_R600 | 0x10, CHIP_IGP, "Radeon HD 3200"}, + {0x9612, 2, 0, RADEON_R600 | 0x10, CHIP_IGP, "Radeon HD 3200"}, + {0x9615, 2, 0, RADEON_R600 | 0x10, CHIP_IGP, "Radeon HD 3200"}, + {0x9614, 2, 0, RADEON_R600 | 0x10, CHIP_IGP, "Radeon HD 3300"}, // Radeon 3430 - RV620 - {0x95c5, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, - {0x95c6, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, - {0x95c7, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, - {0x95c9, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3450"}, - {0x95c4, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3470"}, - {0x95c0, 3, 0, RADEON_R600 | 0x20, false, "Radeon HD 3550"}, - {0x9581, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, - {0x9583, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, - {0x9598, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 3600"}, - {0x9591, 3, 0, RADEON_R600 | 0x35, false, "Radeon HD 3600"}, - {0x9589, 2, 0, RADEON_R600 | 0x30, false, "Radeon HD 3610"}, + {0x95c5, 3, 0, RADEON_R600 | 0x20, CHIP_STD, "Radeon HD 3450"}, + {0x95c6, 3, 0, RADEON_R600 | 0x20, CHIP_STD, "Radeon HD 3450"}, + {0x95c7, 3, 0, RADEON_R600 | 0x20, CHIP_STD, "Radeon HD 3450"}, + {0x95c9, 3, 0, RADEON_R600 | 0x20, CHIP_STD, "Radeon HD 3450"}, + {0x95c4, 3, 0, RADEON_R600 | 0x20, CHIP_STD, "Radeon HD 3470"}, + {0x95c0, 3, 0, RADEON_R600 | 0x20, CHIP_STD, "Radeon HD 3550"}, + {0x9581, 2, 0, RADEON_R600 | 0x30, CHIP_STD, "Radeon HD 3600"}, + {0x9583, 2, 0, RADEON_R600 | 0x30, CHIP_STD, "Radeon HD 3600"}, + {0x9598, 2, 0, RADEON_R600 | 0x30, CHIP_STD, "Radeon HD 3600"}, + {0x9591, 3, 0, RADEON_R600 | 0x35, CHIP_STD, "Radeon HD 3600"}, + {0x9589, 2, 0, RADEON_R600 | 0x30, CHIP_STD, "Radeon HD 3610"}, // Radeon 3650 - RV635 // Radeon 3670 - RV635 - {0x9507, 2, 0, RADEON_R600 | 0x70, false, "Radeon HD 3830"}, - {0x9505, 2, 0, RADEON_R600 | 0x70, false, "Radeon HD 3850"}, - {0x9513, 2, 0, RADEON_R600 | 0x80, false, "Radeon HD 3850 X2"}, - {0x9501, 2, 0, RADEON_R600 | 0x70, false, "Radeon HD 3870"}, - {0x950F, 2, 0, RADEON_R600 | 0x80, false, "Radeon HD 3870 X2"}, - {0x9710, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 4200"}, - {0x9715, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 4250"}, - {0x9712, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 4270"}, - {0x9714, 3, 0, RADEON_R600 | 0x20, true, "Radeon HD 4290"}, + {0x9507, 2, 0, RADEON_R600 | 0x70, CHIP_STD, "Radeon HD 3830"}, + {0x9505, 2, 0, RADEON_R600 | 0x70, CHIP_STD, "Radeon HD 3850"}, + {0x9513, 2, 0, RADEON_R600 | 0x80, CHIP_STD, "Radeon HD 3850 X2"}, + {0x9501, 2, 0, RADEON_R600 | 0x70, CHIP_STD, "Radeon HD 3870"}, + {0x950F, 2, 0, RADEON_R600 | 0x80, CHIP_STD, "Radeon HD 3870 X2"}, + {0x9710, 3, 0, RADEON_R600 | 0x20, CHIP_IGP, "Radeon HD 4200"}, + {0x9715, 3, 0, RADEON_R600 | 0x20, CHIP_IGP, "Radeon HD 4250"}, + {0x9712, 3, 0, RADEON_R600 | 0x20, CHIP_IGP, "Radeon HD 4270"}, + {0x9714, 3, 0, RADEON_R600 | 0x20, CHIP_IGP, "Radeon HD 4290"}, // R700 series (HD4330 - HD4890, HD51xx, HD5xxV) // Codename: Wekiva // Radeon 4330 - RV710 - {0x954f, 3, 2, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, - {0x9552, 3, 2, RADEON_R700 | 0x10, true, "Radeon HD 4300"}, - {0x9555, 3, 2, RADEON_R700 | 0x10, false, "Radeon HD 4350"}, - {0x9540, 3, 2, RADEON_R700 | 0x10, false, "Radeon HD 4550"}, - {0x9480, 3, 2, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, - {0x9498, 3, 2, RADEON_R700 | 0x30, false, "Radeon HD 4650"}, - {0x94b4, 3, 2, RADEON_R700 | 0x40, false, "Radeon HD 4700"}, - {0x9490, 3, 2, RADEON_R700 | 0x30, false, "Radeon HD 4710"}, - {0x94b3, 3, 2, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, - {0x94b5, 3, 2, RADEON_R700 | 0x40, false, "Radeon HD 4770"}, - {0x944a, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4850 Mobile"}, - {0x944e, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4810"}, - {0x944c, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4830"}, - {0x9442, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4850"}, - {0x9443, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4850 X2"}, - {0x94a1, 3, 1, RADEON_R700 | 0x90, true, "Radeon HD 4860"}, - {0x9440, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4870"}, - {0x9441, 3, 1, RADEON_R700 | 0x70, false, "Radeon HD 4870 X2"}, - {0x9460, 3, 1, RADEON_R700 | 0x90, false, "Radeon HD 4890"}, + {0x954f, 3, 2, RADEON_R700 | 0x10, CHIP_IGP, "Radeon HD 4300"}, + {0x9552, 3, 2, RADEON_R700 | 0x10, CHIP_IGP, "Radeon HD 4300"}, + {0x9555, 3, 2, RADEON_R700 | 0x10, CHIP_STD, "Radeon HD 4350"}, + {0x9540, 3, 2, RADEON_R700 | 0x10, CHIP_STD, "Radeon HD 4550"}, + {0x9480, 3, 2, RADEON_R700 | 0x30, CHIP_STD, "Radeon HD 4650"}, + {0x9498, 3, 2, RADEON_R700 | 0x30, CHIP_STD, "Radeon HD 4650"}, + {0x94b4, 3, 2, RADEON_R700 | 0x40, CHIP_STD, "Radeon HD 4700"}, + {0x9490, 3, 2, RADEON_R700 | 0x30, CHIP_STD, "Radeon HD 4710"}, + {0x94b3, 3, 2, RADEON_R700 | 0x40, CHIP_STD, "Radeon HD 4770"}, + {0x94b5, 3, 2, RADEON_R700 | 0x40, CHIP_STD, "Radeon HD 4770"}, + {0x944a, 3, 1, RADEON_R700 | 0x70, CHIP_MOBILE, "Radeon HD 4850"}, + {0x944e, 3, 1, RADEON_R700 | 0x70, CHIP_STD, "Radeon HD 4810"}, + {0x944c, 3, 1, RADEON_R700 | 0x70, CHIP_STD, "Radeon HD 4830"}, + {0x9442, 3, 1, RADEON_R700 | 0x70, CHIP_STD, "Radeon HD 4850"}, + {0x9443, 3, 1, RADEON_R700 | 0x70, CHIP_STD, "Radeon HD 4850 X2"}, + {0x94a1, 3, 1, RADEON_R700 | 0x90, CHIP_IGP, "Radeon HD 4860"}, + {0x9440, 3, 1, RADEON_R700 | 0x70, CHIP_STD, "Radeon HD 4870"}, + {0x9441, 3, 1, RADEON_R700 | 0x70, CHIP_STD, "Radeon HD 4870 X2"}, + {0x9460, 3, 1, RADEON_R700 | 0x90, CHIP_STD, "Radeon HD 4890"}, // From here on AMD no longer used numeric identifiers @@ -127,78 +127,78 @@ const struct supported_device { // R1000 series (HD54xx - HD63xx) // Codename: Evergreen // Cedar - {0x68e1, 4, 0, RADEON_R1000 | 0x00, false, "Radeon HD 5430"}, - {0x68f9, 4, 0, RADEON_R1000 | 0x00, false, "Radeon HD 5450"}, - {0x68e0, 4, 0, RADEON_R1000 | 0x00, true, "Radeon HD 5470"}, + {0x68e1, 4, 0, RADEON_R1000 | 0x00, CHIP_STD, "Radeon HD 5430"}, + {0x68f9, 4, 0, RADEON_R1000 | 0x00, CHIP_STD, "Radeon HD 5450"}, + {0x68e0, 4, 0, RADEON_R1000 | 0x00, CHIP_IGP, "Radeon HD 5470"}, // Redwood - {0x68da, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5500"}, - {0x68d9, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5570"}, - {0x68b9, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5600"}, - {0x68c1, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5650"}, - {0x68d8, 4, 0, RADEON_R1000 | 0x10, false, "Radeon HD 5670"}, + {0x68da, 4, 0, RADEON_R1000 | 0x10, CHIP_STD, "Radeon HD 5500"}, + {0x68d9, 4, 0, RADEON_R1000 | 0x10, CHIP_STD, "Radeon HD 5570"}, + {0x68b9, 4, 0, RADEON_R1000 | 0x10, CHIP_STD, "Radeon HD 5600"}, + {0x68c1, 4, 0, RADEON_R1000 | 0x10, CHIP_STD, "Radeon HD 5650"}, + {0x68d8, 4, 0, RADEON_R1000 | 0x10, CHIP_STD, "Radeon HD 5670"}, // Juniper - {0x68be, 4, 0, RADEON_R1000 | 0x20, false, "Radeon HD 5700"}, - {0x68b8, 4, 0, RADEON_R1000 | 0x20, false, "Radeon HD 5770"}, + {0x68be, 4, 0, RADEON_R1000 | 0x20, CHIP_STD, "Radeon HD 5700"}, + {0x68b8, 4, 0, RADEON_R1000 | 0x20, CHIP_STD, "Radeon HD 5770"}, // Cypress - {0x689e, 4, 0, RADEON_R1000 | 0x30, false, "Radeon HD 5800"}, - {0x6899, 4, 0, RADEON_R1000 | 0x30, false, "Radeon HD 5850"}, - {0x6898, 4, 0, RADEON_R1000 | 0x30, false, "Radeon HD 5870"}, + {0x689e, 4, 0, RADEON_R1000 | 0x30, CHIP_STD, "Radeon HD 5800"}, + {0x6899, 4, 0, RADEON_R1000 | 0x30, CHIP_STD, "Radeon HD 5850"}, + {0x6898, 4, 0, RADEON_R1000 | 0x30, CHIP_STD, "Radeon HD 5870"}, // Hemlock - {0x689c, 4, 0, RADEON_R1000 | 0x40, false, "Radeon HD 5900"}, + {0x689c, 4, 0, RADEON_R1000 | 0x40, CHIP_STD, "Radeon HD 5900"}, // Fusion APUS // Palms - {0x9804, 4, 1, RADEON_R1000 | 0x50, true, "Radeon HD 6250"}, - {0x9805, 4, 1, RADEON_R1000 | 0x50, true, "Radeon HD 6290"}, - {0x9802, 4, 1, RADEON_R1000 | 0x50, true, "Radeon HD 6310"}, - {0x9803, 4, 1, RADEON_R1000 | 0x50, true, "Radeon HD 6310"}, + {0x9804, 4, 1, RADEON_R1000 | 0x50, CHIP_APU, "Radeon HD 6250"}, + {0x9805, 4, 1, RADEON_R1000 | 0x50, CHIP_APU, "Radeon HD 6290"}, + {0x9802, 4, 1, RADEON_R1000 | 0x50, CHIP_APU, "Radeon HD 6310"}, + {0x9803, 4, 1, RADEON_R1000 | 0x50, CHIP_APU, "Radeon HD 6310"}, // R2000 series (HD64xx - HD69xx) // Codename: Nothern Islands // Caicos - {0x6760, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD 6470M"}, - {0x6761, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD 6430M"}, - {0x6762, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6763, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD E6460 Discreet"}, - {0x6764, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6765, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6766, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6767, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6768, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD CAICOS"}, - {0x6770, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD 6400"}, - {0x6779, 5, 0, RADEON_R2000 | 0x00, false, "Radeon HD 6450"}, + {0x6760, 5, 0, RADEON_R2000 | 0x00, CHIP_MOBILE, "Radeon HD 6470M"}, + {0x6761, 5, 0, RADEON_R2000 | 0x00, CHIP_MOBILE, "Radeon HD 6430M"}, + {0x6762, 5, 0, RADEON_R2000 | 0x00, CHIP_STD, "Radeon HD CAICOS"}, + {0x6763, 5, 0, RADEON_R2000 | 0x00, CHIP_DISCREET, "Radeon HD E6460"}, + {0x6764, 5, 0, RADEON_R2000 | 0x00, CHIP_STD, "Radeon HD CAICOS"}, + {0x6765, 5, 0, RADEON_R2000 | 0x00, CHIP_STD, "Radeon HD CAICOS"}, + {0x6766, 5, 0, RADEON_R2000 | 0x00, CHIP_STD, "Radeon HD CAICOS"}, + {0x6767, 5, 0, RADEON_R2000 | 0x00, CHIP_STD, "Radeon HD CAICOS"}, + {0x6768, 5, 0, RADEON_R2000 | 0x00, CHIP_STD, "Radeon HD CAICOS"}, + {0x6770, 5, 0, RADEON_R2000 | 0x00, CHIP_STD, "Radeon HD 6400"}, + {0x6779, 5, 0, RADEON_R2000 | 0x00, CHIP_STD, "Radeon HD 6450"}, // Turks - {0x6740, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD 6700M"}, - {0x6741, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD 6600M"}, - {0x6742, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD 6625M"}, - {0x6743, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD E6760 Discreet"}, - {0x6744, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS M"}, - {0x6745, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS M"}, - {0x6746, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, - {0x6747, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, - {0x6748, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD TURKS"}, - {0x6749, 5, 0, RADEON_R2000 | 0x10, false, "FirePro v4900"}, - {0x6759, 5, 0, RADEON_R2000 | 0x10, false, "Radeon HD 6570"}, + {0x6740, 5, 0, RADEON_R2000 | 0x10, CHIP_MOBILE, "Radeon HD 6700M"}, + {0x6741, 5, 0, RADEON_R2000 | 0x10, CHIP_MOBILE, "Radeon HD 6600M"}, + {0x6742, 5, 0, RADEON_R2000 | 0x10, CHIP_MOBILE, "Radeon HD 6625M"}, + {0x6743, 5, 0, RADEON_R2000 | 0x10, CHIP_DISCREET, "Radeon HD E6760"}, + {0x6744, 5, 0, RADEON_R2000 | 0x10, CHIP_MOBILE, "Radeon HD TURKS M"}, + {0x6745, 5, 0, RADEON_R2000 | 0x10, CHIP_MOBILE, "Radeon HD TURKS M"}, + {0x6746, 5, 0, RADEON_R2000 | 0x10, CHIP_STD, "Radeon HD TURKS"}, + {0x6747, 5, 0, RADEON_R2000 | 0x10, CHIP_STD, "Radeon HD TURKS"}, + {0x6748, 5, 0, RADEON_R2000 | 0x10, CHIP_STD, "Radeon HD TURKS"}, + {0x6749, 5, 0, RADEON_R2000 | 0x10, CHIP_STD, "FirePro v4900"}, + {0x6759, 5, 0, RADEON_R2000 | 0x10, CHIP_STD, "Radeon HD 6570"}, // Barts - {0x673e, 5, 0, RADEON_R2000 | 0x20, false, "Radeon HD 6790"}, - {0x6739, 5, 0, RADEON_R2000 | 0x20, false, "Radeon HD 6850"}, - {0x6738, 5, 0, RADEON_R2000 | 0x20, false, "Radeon HD 6870"}, + {0x673e, 5, 0, RADEON_R2000 | 0x20, CHIP_STD, "Radeon HD 6790"}, + {0x6739, 5, 0, RADEON_R2000 | 0x20, CHIP_STD, "Radeon HD 6850"}, + {0x6738, 5, 0, RADEON_R2000 | 0x20, CHIP_STD, "Radeon HD 6870"}, // Cayman - {0x6700, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6701, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6702, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6703, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6704, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6705, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6706, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6707, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6708, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6709, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x6718, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD 6970"}, - {0x6719, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD 6950"}, - {0x671C, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD CAYMAN"}, - {0x671F, 5, 0, RADEON_R2000 | 0x30, false, "Radeon HD 6900"}, + {0x6700, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6701, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6702, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6703, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6704, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6705, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6706, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6707, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6708, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6709, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x6718, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD 6970"}, + {0x6719, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD 6950"}, + {0x671C, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD CAYMAN"}, + {0x671F, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD 6900"}, // Antilles - {0x671d, 5, 0, RADEON_R2000 | 0x40, false, "Radeon HD 6990"} + {0x671d, 5, 0, RADEON_R2000 | 0x40, CHIP_STD, "Radeon HD 6990"} #endif // R3000 series (HD74xx - HD79xx) @@ -339,7 +339,7 @@ init_driver(void) gDeviceInfo[found]->device_chipset = kSupportedDevices[type].chipset; gDeviceInfo[found]->dceMajor = kSupportedDevices[type].dceMajor; gDeviceInfo[found]->dceMinor = kSupportedDevices[type].dceMinor; - gDeviceInfo[found]->isIGP = kSupportedDevices[type].isIGP; + gDeviceInfo[found]->chipsetFlags = kSupportedDevices[type].chipsetFlags; dprintf(DEVICE_NAME ": GPU(%ld) %s, revision = 0x%x\n", found, kSupportedDevices[type].name, info->revision); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index f1aac4a644..b46dbec3a3 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -62,7 +62,7 @@ radeon_hd_getbios(radeon_info &info) uint32 romSize; uint32 romConfig = 0; - if (info.isIGP == true) { + if ((info.chipsetFlags & CHIP_IGP) != 0) { // IGP chipsets don't have a PCI rom BAR. // On post, the bios puts a copy of the IGP // AtomBIOS at the start of the video ram @@ -155,7 +155,7 @@ radeon_hd_getbios(radeon_info &info) } } - if (info.isIGP == false) { + if ((info.chipsetFlags & CHIP_IGP) == 0) { // Disable ROM decoding romConfig &= ~PCI_rom_enable; set_pci_config(info.pci, PCI_rom_base, 4, romConfig); @@ -392,9 +392,9 @@ radeon_hd_init(radeon_info &info) info.shared_info->device_index = info.id; info.shared_info->device_id = info.device_id; info.shared_info->device_chipset = info.device_chipset; + info.shared_info->chipsetFlags = info.chipsetFlags; info.shared_info->dceMajor = info.dceMajor; info.shared_info->dceMinor = info.dceMinor; - info.shared_info->isIGP = info.isIGP; info.shared_info->registers_area = info.registers_area; strcpy(info.shared_info->device_identifier, info.device_identifier); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index c2bc0e1051..4dcd4450f0 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -44,9 +44,9 @@ struct radeon_info { const char* device_identifier; uint32 device_id; uint16 device_chipset; + uint32 chipsetFlags; uint8 dceMajor; uint8 dceMinor; - bool isIGP; }; From 1ce29039cdb74fff21e73ab6cd8b5c8bf51caba8 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Mon, 24 Oct 2011 21:02:14 +0000 Subject: [PATCH 444/702] Revert r42812. As pointed by Michael, one can use BUSBDevice::GetDescriptor() to retrieve whatever descriptor, including a complete configuration descriptor. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42905 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/device/USBKit.h | 3 +- .../kernel/drivers/bus/usb/usb_raw.cpp | 23 +++-------- src/add-ons/kernel/drivers/bus/usb/usb_raw.h | 10 +---- src/kits/device/USBConfiguration.cpp | 39 +++---------------- 4 files changed, 13 insertions(+), 62 deletions(-) diff --git a/headers/os/device/USBKit.h b/headers/os/device/USBKit.h index 9758942f12..f415bc00e1 100644 --- a/headers/os/device/USBKit.h +++ b/headers/os/device/USBKit.h @@ -204,8 +204,7 @@ friend class BUSBDevice; mutable char * fConfigurationString; - usb_configuration_descriptor* fFullDescriptor; - uint32 fReserved[9]; + uint32 fReserved[10]; }; diff --git a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp index fae00ac8d5..d430080f19 100644 --- a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp +++ b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp @@ -300,36 +300,23 @@ usb_raw_ioctl(void *cookie, uint32 op, void *buffer, size_t length) } case B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR: - case B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC: { if (length < sizeof(command->config)) return B_BUFFER_OVERFLOW; - size_t descriptorLength = sizeof(usb_configuration_descriptor); - if (op == B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC) { - if (length < sizeof(command->config_etc)) - return B_BUFFER_OVERFLOW; - - descriptorLength = command->config_etc.length; - } - const usb_configuration_info *configurationInfo = usb_raw_get_configuration(device, command->config.config_index, &command->config.status); if (configurationInfo == NULL) return B_OK; - const usb_configuration_descriptor* descriptor - = configurationInfo->descr; - if (user_memcpy(command->config.descriptor, descriptor, - min_c(descriptorLength, descriptor->total_length)) != B_OK) { + if (user_memcpy(command->config.descriptor, + configurationInfo->descr, + sizeof(usb_configuration_descriptor)) != B_OK) { return B_BAD_ADDRESS; } - if (op == B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC - && descriptor->total_length > descriptorLength) - command->config.status = B_USB_RAW_STATUS_NO_MEMORY; - else - command->config.status = B_USB_RAW_STATUS_SUCCESS; + + command->config.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } diff --git a/src/add-ons/kernel/drivers/bus/usb/usb_raw.h b/src/add-ons/kernel/drivers/bus/usb/usb_raw.h index fc41654029..54112c2202 100644 --- a/src/add-ons/kernel/drivers/bus/usb/usb_raw.h +++ b/src/add-ons/kernel/drivers/bus/usb/usb_raw.h @@ -22,11 +22,10 @@ typedef enum { B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR, B_USB_RAW_COMMAND_GET_ALT_INTERFACE_COUNT, B_USB_RAW_COMMAND_GET_ACTIVE_ALT_INTERFACE_INDEX, - B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC, B_USB_RAW_COMMAND_GET_INTERFACE_DESCRIPTOR_ETC, B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR_ETC, B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR_ETC, - + B_USB_RAW_COMMAND_SET_CONFIGURATION = 0x3000, B_USB_RAW_COMMAND_SET_FEATURE, B_USB_RAW_COMMAND_CLEAR_FEATURE, @@ -75,13 +74,6 @@ typedef union { uint32 config_index; } config; - struct { - status_t status; - usb_configuration_descriptor *descriptor; - uint32 config_index; - size_t length; - } config_etc; - struct { status_t status; uint32 alternate_info; diff --git a/src/kits/device/USBConfiguration.cpp b/src/kits/device/USBConfiguration.cpp index 1751cd2573..cf158a06e2 100644 --- a/src/kits/device/USBConfiguration.cpp +++ b/src/kits/device/USBConfiguration.cpp @@ -8,12 +8,9 @@ #include #include - -#include -#include -#include #include - +#include +#include BUSBConfiguration::BUSBConfiguration(BUSBDevice *device, uint32 index, int rawFD) @@ -21,36 +18,14 @@ BUSBConfiguration::BUSBConfiguration(BUSBDevice *device, uint32 index, int rawFD fIndex(index), fRawFD(rawFD), fInterfaces(NULL), - fConfigurationString(NULL), - fFullDescriptor(NULL) + fConfigurationString(NULL) { usb_raw_command command; command.config.descriptor = &fDescriptor; command.config.config_index = fIndex; - - if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR, - &command, sizeof(command)) - || command.config.status != B_USB_RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR, &command, + sizeof(command)) || command.config.status != B_USB_RAW_STATUS_SUCCESS) memset(&fDescriptor, 0, sizeof(fDescriptor)); - } else { - // Got the descriptor header, retrieve the whole descriptor - size_t length = fDescriptor.total_length; - fFullDescriptor = (usb_configuration_descriptor*)malloc(length); - - if (fFullDescriptor != NULL) { - command.config_etc.descriptor = fFullDescriptor; - command.config_etc.config_index = fIndex; - command.config_etc.length = length; - - if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC, - &command, sizeof(command)) - || command.config_etc.status != B_USB_RAW_STATUS_SUCCESS) { - - free(fFullDescriptor); - fFullDescriptor = NULL; - } - } - } fInterfaces = new(std::nothrow) BUSBInterface *[ fDescriptor.number_interfaces]; @@ -66,8 +41,6 @@ BUSBConfiguration::BUSBConfiguration(BUSBDevice *device, uint32 index, int rawFD BUSBConfiguration::~BUSBConfiguration() { - free(fFullDescriptor); - delete[] fConfigurationString; if (fInterfaces != NULL) { for (int32 i = 0; i < fDescriptor.number_interfaces; i++) @@ -112,7 +85,7 @@ BUSBConfiguration::ConfigurationString() const const usb_configuration_descriptor * BUSBConfiguration::Descriptor() const { - return (fFullDescriptor != NULL) ? fFullDescriptor : &fDescriptor; + return &fDescriptor; } From 62605d2824c0b594931b51025a98f44ff4c59e58 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 25 Oct 2011 02:29:25 +0000 Subject: [PATCH 445/702] * redesign code that locates AtomBIOS allows for more flexible searching * check out shadow VGA bios as very last resort may cause issues but not a bad last resort compared to an app_server crash * better tracing git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42906 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 354 ++++++++++++------ .../graphics/radeon_hd/radeon_hd_private.h | 2 + 2 files changed, 245 insertions(+), 111 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index b46dbec3a3..274ee40ee1 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -43,13 +43,77 @@ #define RHD_MMIO_BAR 2 -inline bool -isAtomBIOS(uint8* bios) +status_t +mapAtomBIOS(radeon_info &info, uint32 romBase, uint32 romSize) { - uint16 bios_header = RADEON_BIOS16(bios, 0x48); + TRACE("%s: seeking AtomBIOS @ 0x%" B_PRIX32 " [size: 0x%" B_PRIX32 "]\n", + __func__, romBase, romSize); - return !memcmp(&bios[bios_header + 4], "ATOM", 4) || - !memcmp(&bios[bios_header + 4], "MOTA", 4); + uint8* rom; + + // attempt to access area specified + area_id testArea = map_physical_memory("radeon hd rom probe", + romBase, romSize, B_ANY_KERNEL_ADDRESS, B_READ_AREA, + (void **)&rom); + + if (testArea < 0) { + ERROR("%s: couldn't map potential rom @ 0x%" B_PRIX32 + "\n", __func__, romBase); + return B_NO_MEMORY; + } + + // check for valid BIOS signature + if (rom[0] != 0x55 || rom[1] != 0xAA) { + uint16 id = rom[0] + (rom[1] << 8); + TRACE("%s: BIOS signature incorrect @ 0x%" B_PRIX32 " (%X)\n", + __func__, romBase, id); + delete_area(testArea); + return B_ERROR; + } + + // see if valid AtomBIOS rom + uint16 romHeader = RADEON_BIOS16(rom, 0x48); + bool romValid = !memcmp(&rom[romHeader + 4], "ATOM", 4) + || !memcmp(&rom[romHeader + 4], "MOTA", 4); + + if (romValid == false) { + // FAIL : a PCI VGA bios but not AtomBIOS + uint16 id = rom[0] + (rom[1] << 8); + TRACE("%s: not AtomBIOS rom at 0x%" B_PRIX32 "(%X)\n", + __func__, romBase, id); + delete_area(testArea); + return B_ERROR; + } + + info.rom_area = create_area("radeon hd AtomBIOS", + (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, + romSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + + if (info.rom_area < 0) { + ERROR("%s: unable to map kernel AtomBIOS space!\n", + __func__); + delete_area(testArea); + return B_NO_MEMORY; + } + + memset((void*)info.atom_buffer, 0, romSize); + // Prevent unknown code execution by AtomBIOS parser + memcpy(info.atom_buffer, (void*)rom, romSize); + // Copy AtomBIOS to kernel area + + // validate copied rom is valid + romHeader = RADEON_BIOS16(info.atom_buffer, 0x48); + romValid = !memcmp(&info.atom_buffer[romHeader + 4], "ATOM", 4) + || !memcmp(&info.atom_buffer[romHeader + 4], "MOTA", 4); + + if (romValid == true) { + set_area_protection(info.rom_area, B_READ_AREA); + ERROR("%s: AtomBIOS verified and locked\n", __func__); + } else + ERROR("%s: AtomBIOS memcpy failed!\n", __func__); + + delete_area(testArea); + return romValid ? B_OK : B_ERROR; } @@ -58,115 +122,77 @@ radeon_hd_getbios(radeon_info &info) { TRACE("card(%ld): %s: called\n", info.id, __func__); - uint32 romBase; - uint32 romSize; - uint32 romConfig = 0; + uint32 romBase = 0; + uint32 romSize = 0; + uint32 romMethod = 0; - if ((info.chipsetFlags & CHIP_IGP) != 0) { - // IGP chipsets don't have a PCI rom BAR. - // On post, the bios puts a copy of the IGP - // AtomBIOS at the start of the video ram - romBase = info.pci->u.h0.base_registers[RHD_FB_BAR]; - romSize = 256 * 1024; - // romSize an educated guess - } else { - // Enable ROM decoding for PCI bar rom - romConfig = get_pci_config(info.pci, PCI_rom_base, 4); - romConfig |= PCI_rom_enable; - set_pci_config(info.pci, PCI_rom_base, 4, romConfig); + status_t mapResult = B_ERROR; - uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); - if (flags & PCI_rom_enable) - TRACE("%s: PCI ROM decode enabled successfully\n", __func__); + // first we try to find the AtomBIOS rom via various methods + for (romMethod = 0; romMethod < 3; romMethod++) { + switch(romMethod) { + case 0: + // TODO: *** New ACPI method + ERROR("%s: ACPI ATRM AtomBIOS TODO\n", __func__); + break; + case 1: + // *** Discreet card on IGP, check PCI BAR 0 + // On post, the bios puts a copy of the IGP + // AtomBIOS at the start of the video ram + romBase = info.pci->u.h0.base_registers[RHD_FB_BAR]; + romSize = 256 * 1024; - romBase = info.pci->u.h0.rom_base; - romSize = info.pci->u.h0.rom_size; - - if (romBase == 0) { - TRACE("%s: no PCI rom, trying shadow rom\n", __func__); - // ROM has been copied by BIOS - romBase = 0xC0000; - if (romSize == 0) { - romSize = 0x7FFF; - // A guess at maximum shadow bios size - } - } - } - - TRACE("%s: seeking rom at 0x%" B_PRIX32 " [size: 0x%" B_PRIX32 "]\n", - __func__, romBase, romSize); - - uint8* bios; - status_t result = B_ERROR; - if (romBase == 0 || romSize == 0) { - // FAIL: we never found a base to work off of. - ERROR("%s: no rom address located.\n", __func__); - result = B_ERROR; - } else { - area_id rom_area = map_physical_memory("radeon hd rom", - romBase, romSize, B_ANY_KERNEL_ADDRESS, B_READ_AREA, - (void **)&bios); - - if (info.rom_area < B_OK) { - // FAIL : rom area wasn't mapped for access - ERROR("%s: failed to map rom\n", __func__); - result = B_ERROR; - } else { - if (bios[0] != 0x55 || bios[1] != 0xAA) { - // FAIL : not a PCI rom - uint16 id = bios[0] + (bios[1] << 8); - ERROR("%s: this isn't a PCI rom (%X)\n", - __func__, id); - result = B_ERROR; - } else if (isAtomBIOS(bios)) { - info.rom_area = create_area("radeon hd AtomBIOS", - (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, - romSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - - if (info.rom_area < 0) { - // FAIL : couldn't create kernel AtomBIOS area - ERROR("%s: Error creating kernel" - " AtomBIOS area!\n", __func__); - result = B_ERROR; + if (romBase == 0 || romSize == 0) { + ERROR("%s: No base found at PCI FB BAR\n", __func__); } else { - memset((void*)info.atom_buffer, 0, romSize); - // Prevent unknown code execution by AtomBIOS parser - memcpy(info.atom_buffer, (void *)bios, romSize); - // Copy AtomBIOS to kernel area - - if (isAtomBIOS(info.atom_buffer)) { - // SUCCESS : bios copied and verified - ERROR("%s: AtomBIOS mapped!\n", __func__); - set_area_protection(info.rom_area, B_READ_AREA); - // Lock it down - result = B_OK; - } else { - // FAIL : bios didn't copy properly for some reason - ERROR("%s: AtomBIOS not mapped!\n", __func__); - result = B_ERROR; - } + mapResult = mapAtomBIOS(info, romBase, romSize); } - } else { - ERROR("%s: rom found wasn't identified" - " as AtomBIOS!\n", __func__); - result = B_ERROR; + break; + case 2: + { + // *** PCI ROM BAR + // Enable ROM decoding for PCI BAR rom + uint32 pciConfig = get_pci_config(info.pci, PCI_rom_base, 4); + pciConfig |= PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, pciConfig); + + uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); + if ((flags & PCI_rom_enable) != 0) + TRACE("%s: PCI ROM decode enabled\n", __func__); + + romBase = info.pci->u.h0.rom_base; + romSize = info.pci->u.h0.rom_size; + + if (romBase == 0 || romSize == 0) { + ERROR("%s: No base found at PCI ROM BAR\n", __func__); + } else { + mapResult = mapAtomBIOS(info, romBase, romSize); + } + + // Disable ROM decoding + pciConfig &= ~PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, pciConfig); + break; } - delete_area(rom_area); + } + + if (mapResult == B_OK) { + ERROR("%s: AtomBIOS found using active method %" B_PRIu32 + " at 0x%" B_PRIX32 "\n", __func__, romMethod, romBase); + break; + } else { + ERROR("%s: AtomBIOS not found using active method %" B_PRIu32 + " at 0x%" B_PRIX32 "\n", __func__, romMethod, romBase); } } - if ((info.chipsetFlags & CHIP_IGP) == 0) { - // Disable ROM decoding - romConfig &= ~PCI_rom_enable; - set_pci_config(info.pci, PCI_rom_base, 4, romConfig); - } - - if (result == B_OK) { + if (mapResult == B_OK) { info.shared_info->rom_phys = romBase; info.shared_info->rom_size = romSize; - } + } else + ERROR("%s: Active AtomBIOS search failed.\n", __func__); - return result; + return mapResult; } @@ -195,8 +221,37 @@ radeon_hd_getbios_ni(radeon_info &info) write32(info.registers + R600_ROM_CNTL, (rom_cntl | R600_SCK_OVERWRITE)); - // try to grab the bios - status_t result = radeon_hd_getbios(info); + // try to grab the bios via PCI ROM bar + // Enable ROM decoding for PCI BAR rom + uint32 pciConfig = get_pci_config(info.pci, PCI_rom_base, 4); + pciConfig |= PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, pciConfig); + + uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); + if (flags & PCI_rom_enable) + TRACE("%s: PCI ROM decode enabled\n", __func__); + + uint32 romBase = info.pci->u.h0.rom_base; + uint32 romSize = info.pci->u.h0.rom_size; + + status_t result = B_OK; + if (romBase == 0 || romSize == 0) { + ERROR("%s: No AtomBIOS found at PCI ROM BAR\n", __func__); + result = B_ERROR; + } else { + result = mapAtomBIOS(info, romBase, romSize); + } + + if (result == B_OK) { + ERROR("%s: AtomBIOS found using disabled method at 0x%" B_PRIX32 + " [size: 0x%" B_PRIX32 "]\n", __func__, romBase, romSize); + info.shared_info->rom_phys = romBase; + info.shared_info->rom_size = romSize; + } + + // Disable ROM decoding + pciConfig &= ~PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, pciConfig); // restore regs write32(info.registers + R600_BUS_CNTL, bus_cntl); @@ -238,8 +293,37 @@ radeon_hd_getbios_r700(radeon_info &info) write32(info.registers + R600_ROM_CNTL, (rom_cntl | R600_SCK_OVERWRITE)); - // try to grab the bios - status_t result = radeon_hd_getbios(info); + // try to grab the bios via PCI ROM bar + // Enable ROM decoding for PCI BAR rom + uint32 pciConfig = get_pci_config(info.pci, PCI_rom_base, 4); + pciConfig |= PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, pciConfig); + + uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); + if (flags & PCI_rom_enable) + TRACE("%s: PCI ROM decode enabled\n", __func__); + + uint32 romBase = info.pci->u.h0.rom_base; + uint32 romSize = info.pci->u.h0.rom_size; + + status_t result = B_OK; + if (romBase == 0 || romSize == 0) { + ERROR("%s: No AtomBIOS found at PCI ROM BAR\n", __func__); + result = B_ERROR; + } else { + result = mapAtomBIOS(info, romBase, romSize); + } + + if (result == B_OK) { + ERROR("%s: AtomBIOS found using disabled method at 0x%" B_PRIX32 + " [size: 0x%" B_PRIX32 "]\n", __func__, romBase, romSize); + info.shared_info->rom_phys = romBase; + info.shared_info->rom_size = romSize; + } + + // Disable ROM decoding + pciConfig &= ~PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, pciConfig); // restore regs write32(info.registers + RADEON_VIPH_CONTROL, viph_control); @@ -308,7 +392,37 @@ radeon_hd_getbios_r600(radeon_info &info) write32(info.registers + R600_LOWER_GPIO_ENABLE, (lower_gpio_enable | 0x400)); - status_t result = radeon_hd_getbios(info); + // try to grab the bios via PCI ROM bar + // Enable ROM decoding for PCI BAR rom + uint32 pciConfig = get_pci_config(info.pci, PCI_rom_base, 4); + pciConfig |= PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, pciConfig); + + uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4); + if (flags & PCI_rom_enable) + TRACE("%s: PCI ROM decode enabled\n", __func__); + + uint32 romBase = info.pci->u.h0.rom_base; + uint32 romSize = info.pci->u.h0.rom_size; + + status_t result = B_OK; + if (romBase == 0 || romSize == 0) { + ERROR("%s: No AtomBIOS found at PCI ROM BAR\n", __func__); + result = B_ERROR; + } else { + result = mapAtomBIOS(info, romBase, romSize); + } + + if (result == B_OK) { + ERROR("%s: AtomBIOS found using disabled method at 0x%" B_PRIX32 + " [size: 0x%" B_PRIX32 "]\n", __func__, romBase, romSize); + info.shared_info->rom_phys = romBase; + info.shared_info->rom_size = romSize; + } + + // Disable ROM decoding + pciConfig &= ~PCI_rom_enable; + set_pci_config(info.pci, PCI_rom_base, 4, pciConfig); // restore regs write32(info.registers + RADEON_VIPH_CONTROL, viph_control); @@ -405,13 +519,11 @@ radeon_hd_init(radeon_info &info) = read32(info.registers + R6XX_CONFIG_FB_BASE); // *** AtomBIOS mapping - // First we try an active bios read status_t biosStatus = radeon_hd_getbios(info); - if (biosStatus != B_OK) { - // If the active read fails, we do a disabled read - // TODO : IGP read + if (biosStatus != B_OK) { + // If the active read fails, we try a disabled read if (info.device_chipset >= (RADEON_R1000 | 0x20)) biosStatus = radeon_hd_getbios_ni(info); else if (info.device_chipset >= (RADEON_R700 | 0x70)) @@ -420,6 +532,26 @@ radeon_hd_init(radeon_info &info) biosStatus = radeon_hd_getbios_r600(info); } + if (biosStatus != B_OK) { + // *** very last resort, shadow bios VGA rom + + // This works as long as the primary card is what this driver + // is loaded for. Multiple cards may pose the risk of loading + // the wrong AtomBIOS for the wrong card. + + uint32 romBase = 0xC0000; + uint32 romSize = 128 * 1024; + // what happens when AtomBIOS goes over 128Kb? + // A Radeon HD 6990 has a 128Kb AtomBIOS + + if (mapAtomBIOS(info, romBase, romSize) == B_OK) { + ERROR("%s: fallback to shadow VGA rom\n", __func__); + info.shared_info->rom_phys = romBase; + info.shared_info->rom_size = romSize; + biosStatus = B_OK; + } + } + // Check if a valid AtomBIOS image was found. if (biosStatus != B_OK) { ERROR("%s: card (%ld): couldn't find AtomBIOS rom!\n", diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index 4dcd4450f0..a5161ec80d 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -50,7 +50,9 @@ struct radeon_info { }; +status_t mapAtomBIOS(radeon_info &info, uint32 romBase, uint32 romSize); extern status_t radeon_hd_init(radeon_info& info); extern void radeon_hd_uninit(radeon_info& info); + #endif /* RADEON_RD_PRIVATE_H */ From cc6dd72fbb10a2bf59019619b186bb5af1f0473f Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Tue, 25 Oct 2011 06:19:49 +0000 Subject: [PATCH 446/702] Update B_USB_RAW_COMMAND_GET_DESCRIPTOR to support retrieving up to total_length a configuration descriptor. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42907 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/bus/usb/usb_raw.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp index d430080f19..b07ee5509b 100644 --- a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp +++ b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp @@ -545,21 +545,31 @@ usb_raw_ioctl(void *cookie, uint32 op, void *buffer, size_t length) return B_BUFFER_OVERFLOW; size_t actualLength = 0; - uint8 firstTwoBytes[2]; + uint8 firstBytes[4]; + size_t bytesNeeded = + command->descriptor.type == USB_DESCRIPTOR_CONFIGURATION ? + 4 : 2; if (gUSBModule->get_descriptor(device->device, command->descriptor.type, command->descriptor.index, - command->descriptor.language_id, firstTwoBytes, 2, + command->descriptor.language_id, firstBytes, bytesNeeded, &actualLength) < B_OK - || actualLength != 2 - || firstTwoBytes[1] != command->descriptor.type) { + || actualLength != bytesNeeded + || firstBytes[1] != command->descriptor.type) { command->descriptor.status = B_USB_RAW_STATUS_ABORTED; command->descriptor.length = 0; return B_OK; } - uint8 descriptorLength = MIN(firstTwoBytes[0], - command->descriptor.length); + uint8 descriptorLength = firstBytes[0]; + if (command->descriptor.type == USB_DESCRIPTOR_CONFIGURATION) { + // configuration complete descriptor total length is + // bigger than just its header size + descriptorLength = + ((usb_configuration_descriptor*)firstBytes)->total_length; + } + descriptorLength = MIN(descriptorLength, command->descriptor.length); + uint8 *descriptorBuffer = (uint8 *)malloc(descriptorLength); if (descriptorBuffer == NULL) { command->descriptor.status = B_USB_RAW_STATUS_ABORTED; From 427e96598c55e68f2de5b090a752c45b2f14d378 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Tue, 25 Oct 2011 06:46:40 +0000 Subject: [PATCH 447/702] Revert back my change as its broken. I will take some rest as obviously I should not allwed to commit anything rigth now. Sorry guys. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42908 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/bus/usb/usb_raw.cpp | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp index b07ee5509b..d430080f19 100644 --- a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp +++ b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp @@ -545,31 +545,21 @@ usb_raw_ioctl(void *cookie, uint32 op, void *buffer, size_t length) return B_BUFFER_OVERFLOW; size_t actualLength = 0; - uint8 firstBytes[4]; - size_t bytesNeeded = - command->descriptor.type == USB_DESCRIPTOR_CONFIGURATION ? - 4 : 2; + uint8 firstTwoBytes[2]; if (gUSBModule->get_descriptor(device->device, command->descriptor.type, command->descriptor.index, - command->descriptor.language_id, firstBytes, bytesNeeded, + command->descriptor.language_id, firstTwoBytes, 2, &actualLength) < B_OK - || actualLength != bytesNeeded - || firstBytes[1] != command->descriptor.type) { + || actualLength != 2 + || firstTwoBytes[1] != command->descriptor.type) { command->descriptor.status = B_USB_RAW_STATUS_ABORTED; command->descriptor.length = 0; return B_OK; } - uint8 descriptorLength = firstBytes[0]; - if (command->descriptor.type == USB_DESCRIPTOR_CONFIGURATION) { - // configuration complete descriptor total length is - // bigger than just its header size - descriptorLength = - ((usb_configuration_descriptor*)firstBytes)->total_length; - } - descriptorLength = MIN(descriptorLength, command->descriptor.length); - + uint8 descriptorLength = MIN(firstTwoBytes[0], + command->descriptor.length); uint8 *descriptorBuffer = (uint8 *)malloc(descriptorLength); if (descriptorBuffer == NULL) { command->descriptor.status = B_USB_RAW_STATUS_ABORTED; From da9d54ead06000536a0ccff42f8c74e9c8cb10e9 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 25 Oct 2011 15:49:23 +0000 Subject: [PATCH 448/702] * be a little clearer in tracing on whats going on when we fallback to shadow rom * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42909 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 274ee40ee1..909126f162 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -534,6 +534,8 @@ radeon_hd_init(radeon_info &info) if (biosStatus != B_OK) { // *** very last resort, shadow bios VGA rom + ERROR("%s: Can't find an AtomBIOS rom! Trying shadow rom...\n", + __func__); // This works as long as the primary card is what this driver // is loaded for. Multiple cards may pose the risk of loading @@ -545,7 +547,8 @@ radeon_hd_init(radeon_info &info) // A Radeon HD 6990 has a 128Kb AtomBIOS if (mapAtomBIOS(info, romBase, romSize) == B_OK) { - ERROR("%s: fallback to shadow VGA rom\n", __func__); + ERROR("%s: Found AtomBIOS at VGA shadow rom\n", __func__); + // Whew! info.shared_info->rom_phys = romBase; info.shared_info->rom_size = romSize; biosStatus = B_OK; From 9829800d2c60d6aba146af7fde09601929161730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 25 Oct 2011 15:49:39 +0000 Subject: [PATCH 449/702] A prototype of hardware reporting form generating script for the compatibility list. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42910 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 270 ++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100755 3rdparty/mmu_man/scripts/HardwareChecker.sh diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh new file mode 100755 index 0000000000..895594c339 --- /dev/null +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -0,0 +1,270 @@ +#!/bin/sh +# HardwareChecker.sh for Haiku +# +# Copyright 2011, François Revol . +# +# Distributed under the MIT License +# +# Created: 2011-10-25 +# + + +netcat=netcat +report_site=haikuware.con +report_cgi=http://haikuware.com/hwreport.php + +start_fake_httpd () +{ + report_port=8989 + report_file="$(finddir B_DESKTOP_DIRECTORY)/hwchecker_report_$$.txt" + report_ack="

OK

" + report_cgi=http://127.0.0.1:$report_port/hwreport + ( + echo "listening on port $report_port" + # + (echo -e "HTTP/1.1 100 Continue\r\n\r\n"; echo -e "HTTP/1.1 200 OK\r\nDate: $(date)\r\nContent-Type: text/html\r\nContent-Length: ${#report_ack}\r\n\r\n$report_ack") | $netcat -q 1 -l -p $report_port > "$report_file" + + open "$report_file" + sleep 1 + alert "A file named $(basename $report_file) has been created on your desktop. You can copy this file to an external drive to submit it with another operating system." "Ok" + ) & +} + +detect_network () +{ + ping -c 1 "$report_site" + if [ "$?" -gt 0 ]; then + alert --stop "Cannot contact the hardware report site ($report_site). +You can continue anyway and generate a local file to submit later on, or try to configure networking." "Cancel" "Configure Network" "Continue" + case "$?" in + 0) + exit 0 + ;; + 1) + /system/preferences/Network + detect_network + ;; + 2) + start_fake_httpd + ;; + *) + exit 1 + ;; + esac + fi +} + +check_pci () +{ + echo "

PCI devices

" + echo "
List ot detected PCI devices. This does not indicate that every probed device is supported by a driver.

" + devn=0 + bus="pci" + vendor='' + device='' + true; + listdev | while read line; do + + case "$line" in + device*) + case "$vendor" in + "") + desc="${line/device /}" + echo "
$desc
" + ;; + *) + devicestr=${line#*:} + device="${line%:*}" + device="${device#device }" + echo "
" + echo "
$vendor:$device $vendorstr:$devicestr
" + descline="$vendor:$device \"$vendorstr\" \"$devicestr\" $desc" + echo "Identification: " + + echo "
" + echo "Status: " + echo "" + echo "" + echo "" + echo "
" + + echo "
" + echo "Is it an add-in card (not part of the motherboard) ? " + echo "" + echo "
" + + echo "
" + echo "Comment: " + echo "" + echo "
" + + echo "
" + + vendor='' + devn=$(($devn+1)) + ;; + esac + ;; + vendor*) + vendorstr=${line#*:} + vendor="${line%:*}" + vendor="${vendor#vendor }" + ;; + *) + ;; + esac + done +} + +check_usb () +{ + echo "

USB devices

" + echo "
List ot detected USB devices. This does not indicate that every probed device is supported by a driver.

" + devn=0 + bus="usb" + listusb | while read vpid dev desc; do + echo "
$desc
" + echo "Identification: " + echo "
" + if [ "$vpid" != "0000:0000" ]; then + enabled=1 + id="" + echo "
" + echo "Status: " + echo "" + echo "" + echo "" + echo "
" + + echo "
" + echo "Is it an external device (not part of the motherboard) ? " + echo "" + echo "
" + + echo "
" + echo "Comment: " + echo "" + echo "
" + + else + echo "(virtual device)" + fi + echo "
" + devn=$(($devn+1)) + done + echo "
" +} + +check_machine () +{ + echo "

Machine

" + echo "Vendor: " + echo "
" + echo "Model: " + echo "
" + echo "Specification page: " + echo "
" + echo "Comments:
" + echo "" + echo "
" +} + +check_haiku () +{ + echo "

Haiku

" + uname_r="$(uname -r)" + uname_v="$(uname -v)" + echo "Release: " + echo "
" + echo "Version: " + echo "
" + echo "Comments:
" + echo "" + echo "
" +} + +check_utils () +{ + echo "

Utilities output

" + echo "The output of some system utilities gives precious informations on the processor model and other stuff..." + + echo "

sysinfo

" + echo "(system info)
" + echo "" + + echo "

listimage 1

" + echo "(list of loaded kernel drivers)
" + echo "" + + echo "

ifconfig

" + echo "(list of network interfaces)
" + echo "" + + echo "

installoptionalpackage -l

" + echo "(list of installed packaged)
" + echo "" + + echo "
" +} + +check_syslog () +{ + echo "

System log

" + echo "
Part of the system boot log that could help developer understand why some devices are not recognized...
" + echo "" + +} + +check_sender () +{ + echo "

Sender info (optional)

" + echo "Name: " + echo "
" + echo "Mail: " + echo "
" + echo "Other comments:
" + echo "" + echo "
" +} + +check_all () +{ + echo "" + echo "Hardware report" + echo "" + echo "
" + + check_pci + check_usb + check_haiku + check_utils + check_syslog + check_sender + + echo "
Note: this form will only send data that is visible on this page.
" + + echo "" + + echo "
" + echo "" + echo "" +} + +tf=/tmp/hw_checker_$$.html + +detect_network + +check_all > "$tf" + +open "$tf" + From 93b9886a445cb561a4874025321424a02e80ae8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 25 Oct 2011 16:06:51 +0000 Subject: [PATCH 450/702] Add some notify calls to give visual indication of the script working. Doesn't take too much time but... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42911 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index 895594c339..16867ebf41 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -13,6 +13,21 @@ netcat=netcat report_site=haikuware.con report_cgi=http://haikuware.com/hwreport.php +do_notify () +{ + p="$1" + m="$2" + shift + shift + notify --type progress \ + --messageID hwck_$$ \ + --icon /system/apps/Devices \ + --app HardwareChecker \ + --title "progress:" --progress "$p" "$m" "$@" + + +} + start_fake_httpd () { report_port=8989 @@ -244,12 +259,23 @@ check_all () echo "" echo "
" + do_notify 0.1 "Checking for PCI hardware..." check_pci + + do_notify 0.3 "Checking for USB hardware..." check_usb + + do_notify 0.5 "Checking for Haiku version..." check_haiku + + do_notify 0.6 "Checking for utility outputs..." check_utils + + do_notify 0.8 "Dumping syslog output..." check_syslog check_sender + + do_notify 1.0 "Done!" echo "
Note: this form will only send data that is visible on this page.
" @@ -262,6 +288,7 @@ check_all () tf=/tmp/hw_checker_$$.html +do_notify 0.0 "Checking for network..." detect_network check_all > "$tf" From 6c278c3b976ccb3005fe4f578d38465323fb40cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 25 Oct 2011 16:14:49 +0000 Subject: [PATCH 451/702] Make sure we close previous instances of netcat and ignore empty files. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42912 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index 16867ebf41..aab7a5d35a 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -35,13 +35,20 @@ start_fake_httpd () report_ack="

OK

" report_cgi=http://127.0.0.1:$report_port/hwreport ( + # force a previous isntance to close + $netcat 127.0.0.1 8989 < /dev/null > /dev/null echo "listening on port $report_port" # (echo -e "HTTP/1.1 100 Continue\r\n\r\n"; echo -e "HTTP/1.1 200 OK\r\nDate: $(date)\r\nContent-Type: text/html\r\nContent-Length: ${#report_ack}\r\n\r\n$report_ack") | $netcat -q 1 -l -p $report_port > "$report_file" - open "$report_file" - sleep 1 - alert "A file named $(basename $report_file) has been created on your desktop. You can copy this file to an external drive to submit it with another operating system." "Ok" + # make sure we have something + if [ -s "$report_file" ]; then + open "$report_file" + sleep 1 + alert "A file named $(basename $report_file) has been created on your desktop. You can copy this file to an external drive to submit it with another operating system." "Ok" + else + rm "$report_file" + fi ) & } @@ -275,7 +282,7 @@ check_all () check_syslog check_sender - do_notify 1.0 "Done!" + do_notify 1.0 "Done!" --timeout 3 echo "
Note: this form will only send data that is visible on this page.
" From 19618f8bbafc55a55874cf65150dd60520982dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 25 Oct 2011 16:25:57 +0000 Subject: [PATCH 452/702] Better message. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42913 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index aab7a5d35a..f73e646bf8 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -32,7 +32,7 @@ start_fake_httpd () { report_port=8989 report_file="$(finddir B_DESKTOP_DIRECTORY)/hwchecker_report_$$.txt" - report_ack="

OK

" + report_ack="

Done! You can close this window now.

" report_cgi=http://127.0.0.1:$report_port/hwreport ( # force a previous isntance to close From 2362652a4b95ecfc29130dbde7433c516742000d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 25 Oct 2011 16:43:26 +0000 Subject: [PATCH 453/702] Make it look a little better. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42914 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index f73e646bf8..c21ea91d15 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -105,9 +105,9 @@ check_pci () echo "
" echo "Status: " - echo "" - echo "" - echo "" + echo "" + echo "" + echo "" echo "
" echo "
" @@ -119,6 +119,8 @@ check_pci () echo "Comment: " echo "" echo "
" + + echo "
" echo "" @@ -146,16 +148,16 @@ check_usb () bus="usb" listusb | while read vpid dev desc; do echo "
$desc
" - echo "Identification: " echo "
" + echo "Identification: " if [ "$vpid" != "0000:0000" ]; then enabled=1 id="" echo "
" echo "Status: " - echo "" - echo "" - echo "" + echo "" + echo "" + echo "" echo "
" echo "
" @@ -167,10 +169,11 @@ check_usb () echo "Comment: " echo "" echo "
" - else - echo "(virtual device)" + echo "
(virtual device)
" fi + + echo "
" echo "
" devn=$(($devn+1)) done @@ -262,7 +265,14 @@ check_sender () check_all () { echo "" - echo "Hardware report" + echo "" + echo "Hardware report" + echo "" + echo "" echo "" echo "" From 9191eeb7558f89d4848352ae614a5a6b88c2dd7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 25 Oct 2011 16:53:58 +0000 Subject: [PATCH 454/702] Add missing name attribute so the field does get sent as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42915 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index c21ea91d15..41595de8fc 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -101,7 +101,7 @@ check_pci () echo "
" echo "
$vendor:$device $vendorstr:$devicestr
" descline="$vendor:$device \"$vendorstr\" \"$devicestr\" $desc" - echo "Identification: " + echo "Identification: " echo "
" echo "Status: " From 18b34d36b7a3ee354419aa50303382b2219e6309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 25 Oct 2011 17:16:44 +0000 Subject: [PATCH 455/702] Put radio buttons in columns. Tried to use the user guide css but it doesn't like having DIV elements everywhere. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42916 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 28 +++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index 41595de8fc..b1186daa46 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -101,13 +101,22 @@ check_pci () echo "
" echo "
$vendor:$device $vendorstr:$devicestr
" descline="$vendor:$device \"$vendorstr\" \"$devicestr\" $desc" - echo "Identification: " + echo "
Identification:
" echo "
" + echo "" + echo "" + echo "
" echo "Status: " + echo "" echo "" + echo "
" + #echo "
" echo "" + echo "
" + #echo "
" echo "" + echo "
" echo "
" echo "
" @@ -149,15 +158,25 @@ check_usb () listusb | while read vpid dev desc; do echo "
$desc
" echo "
" - echo "Identification: " + echo "
Identification:
" if [ "$vpid" != "0000:0000" ]; then enabled=1 id="" + echo "
" + echo "" + echo "" + echo "
" echo "Status: " + echo "" echo "" + echo "
" + #echo "
" echo "" + echo "
" + #echo "
" echo "" + echo "
" echo "
" echo "
" @@ -266,7 +285,10 @@ check_all () { echo "" echo "" + echo '' echo "Hardware report" + #echo '' + echo "" echo "" echo "" + echo "
" echo "" do_notify 0.1 "Checking for PCI hardware..." @@ -299,6 +322,7 @@ check_all () echo "" echo "" + echo "
" echo "" echo "" } From 07a90a634dcc4f68fed1a426d566b78bdd0a736b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 25 Oct 2011 17:25:09 +0000 Subject: [PATCH 456/702] * add better tracing * add encoder quirks git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42917 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 13 +++++++++++-- src/add-ons/accelerants/radeon_hd/encoder.cpp | 19 +++++++++++++++++++ src/add-ons/accelerants/radeon_hd/encoder.h | 1 + src/add-ons/accelerants/radeon_hd/mode.cpp | 7 +++++-- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 6a5f150ba1..bc1c9e5eaa 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -202,7 +202,7 @@ detect_crt_ranges(uint32 crtid) { edid1_info *edid = &gDisplay[crtid]->edid_info; - // Scan each VESA EDID description for monitor ranges + // Scan each display EDID description for monitor ranges for (uint32 index = 0; index < EDID1_NUM_DETAILED_MONITOR_DESC; index++) { edid1_detailed_monitor *monitor @@ -742,10 +742,12 @@ debug_connectors() if (gConnector[id]->valid == true) { uint32 connectorType = gConnector[id]->type; uint32 encoderType = gConnector[id]->encoder.type; + uint16 encoderID = gConnector[id]->encoder.objectID; uint16 gpioID = gConnector[id]->gpioID; ERROR("Connector #%" B_PRIu32 ")\n", id); ERROR(" + connector: %s\n", get_connector_name(connectorType)); ERROR(" + encoder: %s\n", get_encoder_name(encoderType)); + ERROR(" + encoder id: %" B_PRIu16 "\n", encoderID); ERROR(" + gpio id: %" B_PRIu16 "\n", gpioID); ERROR(" + gpio valid: %s\n", gGPIOInfo[gpioID]->valid ? "true" : "false"); @@ -936,18 +938,25 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) Write32(OUT, regs->vgaControl, 0); uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; + TRACE("%s: Framebuffer at: 0x%" B_PRIX64 "\n", __func__, fbAddressInt); + if (info.device_chipset >= (RADEON_R700 | 0x70)) { + TRACE("%s: Set SurfaceAddress High: 0x%" B_PRIX32 "\n", + __func__, (fbAddressInt >> 32) & 0xf); + Write32(OUT, regs->grphPrimarySurfaceAddrHigh, (fbAddressInt >> 32) & 0xf); Write32(OUT, regs->grphSecondarySurfaceAddrHigh, (fbAddressInt >> 32) & 0xf); } + TRACE("%s: Set SurfaceAddress: 0x%" B_PRIX32 "\n", + __func__, (fbAddressInt & 0xFFFFFFFF)); + Write32(OUT, regs->grphPrimarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); Write32(OUT, regs->grphSecondarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); - if (info.device_chipset >= RADEON_R600) { Write32(CRT, regs->grphControl, fbFormat); Write32(CRT, regs->grphSwapControl, fbSwap); diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 7e711a089f..0eba919d35 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -173,6 +173,24 @@ encoder_assign_crtc(uint8 crtcID) } +void +encoder_apply_quirks(uint8 crtcID) +{ + radeon_shared_info &info = *gInfo->shared_info; + register_info* regs = gDisplay[crtcID]->regs; + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; + uint16 encoderFlags = gConnector[connectorIndex]->encoder.flags; + + // Setting the scaler clears this on some chips... + if (info.dceMajor >= 3 + && (encoderFlags & ATOM_DEVICE_TV_SUPPORT) == 0) { + // TODO: assume non interleave mode for now + // en: EVERGREEN_INTERLEAVE_EN : AVIVO_D1MODE_INTERLEAVE_EN + Write32(OUT, regs->modeDataFormat, 0); + } +} + + void encoder_mode_set(uint8 id, uint32 pixelClock) { @@ -235,6 +253,7 @@ encoder_mode_set(uint8 id, uint32 pixelClock) TRACE("%s: TODO for unknown encoder setup!\n", __func__); } + encoder_apply_quirks(id); } diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index 45b40c1ccd..94b81d6615 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -10,6 +10,7 @@ void encoder_assign_crtc(uint8 crt_id); +void encoder_apply_quirks(uint8 crtcID); void encoder_mode_set(uint8 id, uint32 pixelClock); status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command); status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command); diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index fea5ecb8e8..dad0cdef7b 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -82,7 +82,7 @@ radeon_get_mode_list(display_mode *modeList) status_t radeon_get_edid_info(void* info, size_t size, uint32* edid_version) { - // TODO: multi-monitor? for now we use VESA and not gDisplay edid + // TODO: multi-monitor? for now we use VESA edid TRACE("%s\n", __func__); if (!gInfo->shared_info->has_edid) @@ -91,6 +91,10 @@ radeon_get_edid_info(void* info, size_t size, uint32* edid_version) return B_BUFFER_OVERFLOW; memcpy(info, &gInfo->shared_info->edid_info, sizeof(struct edid1_info)); + // VESA + //memcpy(info, &gDisplay[0]->edid_info, sizeof(struct edid1_info)); + // BitBanged display 0 + *edid_version = EDID_VERSION_1; return B_OK; @@ -158,7 +162,6 @@ radeon_set_display_mode(display_mode *mode) { radeon_shared_info &info = *gInfo->shared_info; - // TODO: multi-monitor? for now we use VESA and not gDisplay edid // Set mode on each display for (uint8 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id]->active == false) From 6f6d1e36fd792356e7de5a99a3ba8141c16fb80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 25 Oct 2011 17:43:33 +0000 Subject: [PATCH 457/702] Missed the most important: machine infos. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42918 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index b1186daa46..b078625b0a 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -202,7 +202,7 @@ check_usb () check_machine () { echo "

Machine

" - echo "Vendor: " + echo "Vendor: " echo "
" echo "Model: " echo "
" @@ -313,6 +313,8 @@ check_all () do_notify 0.8 "Dumping syslog output..." check_syslog + + check_machine check_sender do_notify 1.0 "Done!" --timeout 3 From 62278874a6e3072ebeb940e3e646eadb3564d277 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 25 Oct 2011 18:34:47 +0000 Subject: [PATCH 458/702] * add TV encoder setup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42919 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/encoder.cpp | 33 +++++++++++++++++++ src/add-ons/accelerants/radeon_hd/encoder.h | 1 + 2 files changed, 34 insertions(+) diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 0eba919d35..dfd1bda3f9 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -196,6 +196,7 @@ encoder_mode_set(uint8 id, uint32 pixelClock) { radeon_shared_info &info = *gInfo->shared_info; uint32 connectorIndex = gDisplay[id]->connectorIndex; + uint16 encoderFlags = gConnector[connectorIndex]->encoder.flags; switch (gConnector[connectorIndex]->encoder.objectID) { case ENCODER_OBJECT_ID_INTERNAL_DAC1: @@ -203,6 +204,12 @@ encoder_mode_set(uint8 id, uint32 pixelClock) case ENCODER_OBJECT_ID_INTERNAL_DAC2: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: encoder_analog_setup(id, pixelClock, ATOM_ENABLE); + if ((encoderFlags + & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) != 0) { + encoder_tv_setup(id, pixelClock, ATOM_ENABLE); + } else { + encoder_tv_setup(id, pixelClock, ATOM_DISABLE); + } break; case ENCODER_OBJECT_ID_INTERNAL_TMDS1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: @@ -257,6 +264,32 @@ encoder_mode_set(uint8 id, uint32 pixelClock) } +status_t +encoder_tv_setup(uint8 id, uint32 pixelClock, int command) +{ + uint32 connectorIndex = gDisplay[id]->connectorIndex; + uint16 encoderFlags = gConnector[connectorIndex]->encoder.flags; + + TV_ENCODER_CONTROL_PS_ALLOCATION args; + memset(&args, 0, sizeof(args)); + + int index = GetIndexIntoMasterTable(COMMAND, TVEncoderControl); + + args.sTVEncoder.ucAction = command; + + if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0) + args.sTVEncoder.ucTvStandard = ATOM_TV_CV; + else { + // TODO: we assume NTSC for now + args.sTVEncoder.ucTvStandard = ATOM_TV_NTSC; + } + + args.sTVEncoder.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10); + + return atom_execute_table(gAtomContext, index, (uint32*)&args); +} + + union lvds_encoder_control { LVDS_ENCODER_CONTROL_PS_ALLOCATION v1; LVDS_ENCODER_CONTROL_PS_ALLOCATION_V2 v2; diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index 94b81d6615..ab60e401a8 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -15,6 +15,7 @@ void encoder_mode_set(uint8 id, uint32 pixelClock); status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command); status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command); status_t encoder_dig_setup(uint8 id, uint32 pixelClock, int command); +status_t encoder_tv_setup(uint8 id, uint32 pixelClock, int command); bool encoder_analog_load_detect(uint8 connectorIndex); void encoder_output_lock(bool lock); void encoder_crtc_scratch(uint8 crtcID); From 6c80b06bb879fb12a09423f4e3d12189a97575a4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 25 Oct 2011 18:54:17 +0000 Subject: [PATCH 459/702] * same blanking value, correct define. * set blanking color to full red for debugging to know when blanking is enabled. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42920 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/display.cpp | 5 +++++ src/add-ons/accelerants/radeon_hd/mode.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index bc1c9e5eaa..041a4ea49d 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -832,6 +832,11 @@ display_crtc_blank(uint8 crtcID, int command) args.ucCRTC = crtcID; args.ucBlanking = command; + // DEBUG: AMD red to know when we are blanked :) + args.usBlackColorRCr = 255; + args.usBlackColorGY = 0; + args.usBlackColorBCb = 0; + atom_execute_table(gAtomContext, index, (uint32*)&args); } diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index dad0cdef7b..c0700aade5 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -133,7 +133,7 @@ radeon_dpms_set(int mode) display_crtc_power(id, ATOM_ENABLE); if (info.dceMajor >= 3) display_crtc_memreq(id, ATOM_ENABLE); - display_crtc_blank(id, ATOM_DISABLE); + display_crtc_blank(id, ATOM_BLANKING_OFF); display_crtc_lock(id, ATOM_DISABLE); } break; @@ -145,7 +145,7 @@ radeon_dpms_set(int mode) if (gDisplay[id]->active == false) continue; display_crtc_lock(id, ATOM_ENABLE); - display_crtc_blank(id, ATOM_ENABLE); + display_crtc_blank(id, ATOM_BLANKING); if (info.dceMajor >= 3) display_crtc_memreq(id, ATOM_DISABLE); display_crtc_power(id, ATOM_DISABLE); @@ -177,7 +177,7 @@ radeon_set_display_mode(display_mode *mode) // *** CRT controler prep display_crtc_lock(id, ATOM_ENABLE); - display_crtc_blank(id, ATOM_ENABLE); + display_crtc_blank(id, ATOM_BLANKING); if (info.dceMajor >= 3) display_crtc_memreq(id, ATOM_DISABLE); display_crtc_power(id, ATOM_DISABLE); @@ -199,7 +199,7 @@ radeon_set_display_mode(display_mode *mode) display_crtc_power(id, ATOM_ENABLE); if (info.dceMajor >= 3) display_crtc_memreq(id, ATOM_ENABLE); - display_crtc_blank(id, ATOM_DISABLE); + display_crtc_blank(id, ATOM_BLANKING_OFF); display_crtc_lock(id, ATOM_DISABLE); // *** encoder commit From a96db7dc369e1289059d27dc044f9edf685ca4c6 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 25 Oct 2011 20:29:41 +0000 Subject: [PATCH 460/702] * vesa != intel. *cough* * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42921 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/vesa/mode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/vesa/mode.cpp b/src/add-ons/accelerants/vesa/mode.cpp index bdfe464efb..0ef483fbe3 100644 --- a/src/add-ons/accelerants/vesa/mode.cpp +++ b/src/add-ons/accelerants/vesa/mode.cpp @@ -189,7 +189,7 @@ vesa_get_display_mode(display_mode* _currentMode) status_t vesa_get_edid_info(void* info, size_t size, uint32* _version) { - TRACE(("intel_get_edid_info()\n")); + TRACE(("vesa_get_edid_info()\n")); if (!gInfo->shared_info->has_edid) return B_ERROR; From 97e22a9b500f89e38c67be7e2ee3fe2d539a54a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Wed, 26 Oct 2011 00:02:02 +0000 Subject: [PATCH 461/702] Workaround missing mkisofs in Debian sid for ppc boot CD. It needs a rewrite anyway. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42922 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/ImageRules | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/jam/ImageRules b/build/jam/ImageRules index b9090353d5..0954a6cff3 100644 --- a/build/jam/ImageRules +++ b/build/jam/ImageRules @@ -1465,7 +1465,11 @@ actions BuildCDBootPPCImage1 bind MAPS # -hfs -hfs-bless . mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg \ -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -prep-boot \ - ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd + ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd \ + || \ + genisoimage -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg \ + -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -prep-boot \ + ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd #$(RM) -R $(HAIKU_OUTPUT_DIR)/cd } From 5dfed048860d526b7094db0f0d357c72f3a24a62 Mon Sep 17 00:00:00 2001 From: Joseph Prostko Date: Wed, 26 Oct 2011 02:32:59 +0000 Subject: [PATCH 462/702] * Fix a couple of spelling mistakes, one which affects functionality git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42923 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index b078625b0a..0a0d50253e 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -10,7 +10,7 @@ netcat=netcat -report_site=haikuware.con +report_site=haikuware.com report_cgi=http://haikuware.com/hwreport.php do_notify () @@ -79,7 +79,7 @@ You can continue anyway and generate a local file to submit later on, or try to check_pci () { echo "

PCI devices

" - echo "
List ot detected PCI devices. This does not indicate that every probed device is supported by a driver.

" + echo "
List of detected PCI devices. This does not indicate that every probed device is supported by a driver.

" devn=0 bus="pci" vendor='' From 46af81655d98616bb2c30a2b76563a3d440ded16 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 26 Oct 2011 04:51:51 +0000 Subject: [PATCH 463/702] * redesign pretty much everything frame buffer related * don't resize the frame buffer after mapping it.. doesn't make sense * add memory controller code and program the memory controller for r600 * remove unneeded frame_buffer_int * don't malloc mc_info, waste of time * fix scaler setting * vramStart in mc should be 0... get vertical colored lines however when this this is set properly (everything in mc_info is the MC view of FB BAR) When vramStart is the FB physical address... i get proper video on some cards ... thoughts? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42924 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/radeon_hd/radeon_hd.h | 7 +- .../accelerants/radeon_hd/accelerant.cpp | 8 +- .../accelerants/radeon_hd/accelerant.h | 15 +- src/add-ons/accelerants/radeon_hd/display.cpp | 21 +-- src/add-ons/accelerants/radeon_hd/gpu.cpp | 146 +++++++++++++----- src/add-ons/accelerants/radeon_hd/gpu.h | 6 + src/add-ons/accelerants/radeon_hd/mode.cpp | 26 ++-- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 80 +++++----- 8 files changed, 195 insertions(+), 114 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 344df082cd..c17aa218b4 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -93,11 +93,10 @@ struct radeon_shared_info { addr_t physical_status_page; uint32 graphics_memory_size; - addr_t frame_buffer_phys; // card PCI BAR address of FB - area_id frame_buffer_area; // area of memory mapped FB - uint32 frame_buffer_int; // card internal FB location - uint32 frame_buffer_size; // card internal FB aperture size uint8* frame_buffer; // virtual memory mapped FB + area_id frame_buffer_area; // area of memory mapped FB + addr_t frame_buffer_phys; // card PCI BAR address of FB + uint32 frame_buffer_size; // FB size mapped bool has_edid; edid1_info edid_info; diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index e850c9faea..39e99b8448 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -110,8 +110,6 @@ init_common(int device, bool isClone) memset(gInfo, 0, sizeof(accelerant_info)); - gInfo->mc_info = (gpu_mc_info *)malloc(sizeof(gpu_mc_info)); - // malloc memory for active display information for (uint32 id = 0; id < MAX_DISPLAY; id++) { gDisplay[id] = (display_info *)malloc(sizeof(display_info)); @@ -156,7 +154,6 @@ init_common(int device, bool isClone) if (ioctl(device, RADEON_GET_PRIVATE_DATA, &data, sizeof(radeon_get_private_data)) != 0) { - free(gInfo->mc_info); free(gInfo); return B_ERROR; } @@ -167,7 +164,6 @@ init_common(int device, bool isClone) data.shared_info_area); status_t status = sharedCloner.InitCheck(); if (status < B_OK) { - free(gInfo->mc_info); free(gInfo); TRACE("%s, failed to create shared area\n", __func__); return status; @@ -179,7 +175,6 @@ init_common(int device, bool isClone) gInfo->shared_info->registers_area); status = regsCloner.InitCheck(); if (status < B_OK) { - free(gInfo->mc_info); free(gInfo); TRACE("%s, failed to create mmio area\n", __func__); return status; @@ -219,7 +214,6 @@ uninit_common(void) if (gInfo->is_clone) close(gInfo->device); - free(gInfo->mc_info); free(gInfo); } @@ -285,6 +279,8 @@ radeon_init_accelerant(int device) // return status; //} + radeon_gpu_mc_setup(); + TRACE("%s done\n", __func__); return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index f27aa5b44a..a8bd40ebc0 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -25,14 +25,22 @@ // Maximum displays (more then two requires AtomBIOS) -typedef struct { +struct gpu_state_info { uint32 d1vga_control; uint32 d2vga_control; uint32 vga_render_control; uint32 vga_hdp_control; uint32 d1crtc_control; uint32 d2crtc_control; -} gpu_mc_info; +}; + + +struct mc_info { + bool valid; + uint64 vramStart; + uint64 vramEnd; + uint64 vramSize; +}; struct accelerant_info { @@ -54,7 +62,8 @@ struct accelerant_info { int device; bool is_clone; - gpu_mc_info *mc_info; // used for last known mc state + struct gpu_state_info gpu_info; // used for last known gpu state + struct mc_info mc; // used for memory controller info volatile uint32 dpms_mode; // current driver dpms mode diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 041a4ea49d..bd75bf0cf1 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -832,7 +832,7 @@ display_crtc_blank(uint8 crtcID, int command) args.ucCRTC = crtcID; args.ucBlanking = command; - // DEBUG: AMD red to know when we are blanked :) + // DEBUG: Radeon red to know when we are blanked :) args.usBlackColorRCr = 255; args.usBlackColorGY = 0; args.usBlackColorBCb = 0; @@ -851,7 +851,7 @@ display_crtc_scale(uint8 crtcID, display_mode *mode) memset(&args, 0, sizeof(args)); args.ucScaler = crtcID; - args.ucEnable = ATOM_SCALER_EXPANSION; + args.ucEnable = ATOM_SCALER_DISABLE; atom_execute_table(gAtomContext, index, (uint32*)&args); } @@ -942,25 +942,26 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) Write32(OUT, regs->vgaControl, 0); - uint64 fbAddressInt = gInfo->shared_info->frame_buffer_int; - TRACE("%s: Framebuffer at: 0x%" B_PRIX64 "\n", __func__, fbAddressInt); + uint64 fbAddress = gInfo->mc.vramStart; + //uint64 fbAddress = gInfo->shared_info->frame_buffer_phys; + TRACE("%s: Framebuffer at: 0x%" B_PRIX64 "\n", __func__, fbAddress); if (info.device_chipset >= (RADEON_R700 | 0x70)) { TRACE("%s: Set SurfaceAddress High: 0x%" B_PRIX32 "\n", - __func__, (fbAddressInt >> 32) & 0xf); + __func__, (fbAddress >> 32) & 0xf); Write32(OUT, regs->grphPrimarySurfaceAddrHigh, - (fbAddressInt >> 32) & 0xf); + (fbAddress >> 32) & 0xf); Write32(OUT, regs->grphSecondarySurfaceAddrHigh, - (fbAddressInt >> 32) & 0xf); + (fbAddress >> 32) & 0xf); } TRACE("%s: Set SurfaceAddress: 0x%" B_PRIX32 "\n", - __func__, (fbAddressInt & 0xFFFFFFFF)); + __func__, (fbAddress & 0xFFFFFFFF)); - Write32(OUT, regs->grphPrimarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); - Write32(OUT, regs->grphSecondarySurfaceAddr, (fbAddressInt & 0xFFFFFFFF)); + Write32(OUT, regs->grphPrimarySurfaceAddr, (fbAddress & 0xFFFFFFFF)); + Write32(OUT, regs->grphSecondarySurfaceAddr, (fbAddress & 0xFFFFFFFF)); if (info.device_chipset >= RADEON_R600) { Write32(CRT, regs->grphControl, fbFormat); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 4404e75cfc..245498ea27 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -165,12 +165,12 @@ void radeon_gpu_mc_halt() { // Backup current memory controller state - gInfo->mc_info->d1vga_control = Read32(OUT, D1VGA_CONTROL); - gInfo->mc_info->d2vga_control = Read32(OUT, D2VGA_CONTROL); - gInfo->mc_info->vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); - gInfo->mc_info->vga_hdp_control = Read32(OUT, VGA_HDP_CONTROL); - gInfo->mc_info->d1crtc_control = Read32(OUT, D1CRTC_CONTROL); - gInfo->mc_info->d2crtc_control = Read32(OUT, D2CRTC_CONTROL); + gInfo->gpu_info.d1vga_control = Read32(OUT, D1VGA_CONTROL); + gInfo->gpu_info.d2vga_control = Read32(OUT, D2VGA_CONTROL); + gInfo->gpu_info.vga_render_control = Read32(OUT, VGA_RENDER_CONTROL); + gInfo->gpu_info.vga_hdp_control = Read32(OUT, VGA_HDP_CONTROL); + gInfo->gpu_info.d1crtc_control = Read32(OUT, D1CRTC_CONTROL); + gInfo->gpu_info.d2crtc_control = Read32(OUT, D2CRTC_CONTROL); // halt all memory controller actions Write32(OUT, D2CRTC_UPDATE_LOCK, 0); @@ -189,27 +189,26 @@ radeon_gpu_mc_halt() void radeon_gpu_mc_resume() { - // TODO: do surface addresses disappear on mc halt? - //Write32(OUT, D1GRPH_PRIMARY_SURFACE_ADDRESS, rdev->mc.vram_start); - //Write32(OUT, D1GRPH_SECONDARY_SURFACE_ADDRESS, rdev->mc.vram_start); - //Write32(OUT, D2GRPH_PRIMARY_SURFACE_ADDRESS, rdev->mc.vram_start); - //Write32(OUT, D2GRPH_SECONDARY_SURFACE_ADDRESS, rdev->mc.vram_start); - //Write32(OUT, VGA_MEMORY_BASE_ADDRESS, rdev->mc.vram_start); + Write32(OUT, D1GRPH_PRIMARY_SURFACE_ADDRESS, gInfo->mc.vramStart); + Write32(OUT, D1GRPH_SECONDARY_SURFACE_ADDRESS, gInfo->mc.vramStart); + Write32(OUT, D2GRPH_PRIMARY_SURFACE_ADDRESS, gInfo->mc.vramStart); + Write32(OUT, D2GRPH_SECONDARY_SURFACE_ADDRESS, gInfo->mc.vramStart); + Write32(OUT, VGA_MEMORY_BASE_ADDRESS, gInfo->mc.vramStart); - // Rnlock host access - Write32(OUT, VGA_HDP_CONTROL, gInfo->mc_info->vga_hdp_control); + // Unlock host access + Write32(OUT, VGA_HDP_CONTROL, gInfo->gpu_info.vga_hdp_control); snooze(1); // Restore memory controller state - Write32(OUT, D1VGA_CONTROL, gInfo->mc_info->d1vga_control); - Write32(OUT, D2VGA_CONTROL, gInfo->mc_info->d2vga_control); + Write32(OUT, D1VGA_CONTROL, gInfo->gpu_info.d1vga_control); + Write32(OUT, D2VGA_CONTROL, gInfo->gpu_info.d2vga_control); Write32(OUT, D1CRTC_UPDATE_LOCK, 1); Write32(OUT, D2CRTC_UPDATE_LOCK, 1); - Write32(OUT, D1CRTC_CONTROL, gInfo->mc_info->d1crtc_control); - Write32(OUT, D2CRTC_CONTROL, gInfo->mc_info->d2crtc_control); + Write32(OUT, D1CRTC_CONTROL, gInfo->gpu_info.d1crtc_control); + Write32(OUT, D2CRTC_CONTROL, gInfo->gpu_info.d2crtc_control); Write32(OUT, D1CRTC_UPDATE_LOCK, 0); Write32(OUT, D2CRTC_UPDATE_LOCK, 0); - Write32(OUT, VGA_RENDER_CONTROL, gInfo->mc_info->vga_render_control); + Write32(OUT, VGA_RENDER_CONTROL, gInfo->gpu_info.vga_render_control); } @@ -226,19 +225,22 @@ radeon_gpu_mc_idlecheck() } -status_t -radeon_gpu_mc_setup() +static status_t +radeon_gpu_mc_setup_r600() { - uint32 fb_location_int = gInfo->shared_info->frame_buffer_int; - - uint32 fb_location = Read32(OUT, R600_MC_VM_FB_LOCATION); - uint16 fb_size = (fb_location >> 16) - (fb_location & 0xFFFF); - uint32 fb_location_tmp = fb_location_int >> 24; - fb_location_tmp |= (fb_location_tmp + fb_size) << 16; - uint32 fb_offset_tmp = (fb_location_int >> 8) & 0xff0000; - - radeon_gpu_mc_halt(); + // HDP initialization + uint32 i; + uint32 j; + for (i = 0, j = 0; i < 32; i++, j += 0x18) { + Write32(OUT, (0x2c14 + j), 0x00000000); + Write32(OUT, (0x2c18 + j), 0x00000000); + Write32(OUT, (0x2c1c + j), 0x00000000); + Write32(OUT, (0x2c20 + j), 0x00000000); + Write32(OUT, (0x2c24 + j), 0x00000000); + } + Write32(OUT, HDP_REG_COHERENCY_FLUSH_CNTL, 0); + // idle the memory controller uint32 idleState = radeon_gpu_mc_idlecheck(); if (idleState > 0) { TRACE("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", @@ -246,20 +248,92 @@ radeon_gpu_mc_setup() return B_ERROR; } - TRACE("%s: Setting frame buffer from 0x%" B_PRIX32 - " to 0x%" B_PRIX32 " [size 0x%" B_PRIX16 "]\n", - __func__, fb_location, fb_location_tmp, fb_size); + // TODO: Memory Controller AGP + Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR, + gInfo->mc.vramStart >> 12); + Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR, + gInfo->mc.vramEnd >> 12); - // The MC Write32 will handle cards needing a special MC read/write register - Write32(MC, R600_MC_VM_FB_LOCATION, fb_location_tmp); - Write32(MC, R600_HDP_NONSURFACE_BASE, fb_offset_tmp); + Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, 0); + uint32 tmp = ((gInfo->mc.vramEnd >> 24) & 0xFFFF) << 16; + tmp |= ((gInfo->mc.vramStart >> 24) & 0xFFFF); + Write32(OUT, R6XX_MC_VM_FB_LOCATION, tmp); + Write32(OUT, HDP_NONSURFACE_BASE, (gInfo->mc.vramStart >> 8)); + Write32(OUT, HDP_NONSURFACE_INFO, (2 << 7)); + Write32(OUT, HDP_NONSURFACE_SIZE, 0x3FFFFFFF); + + // TODO: AGP gtt start / end / agp base + // is AGP? + // WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 22); + // WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 22); + // WREG32(MC_VM_AGP_BASE, rdev->mc.agp_base >> 22); + // else? + Write32(OUT, R600_MC_VM_AGP_BASE, 0); + Write32(OUT, R600_MC_VM_AGP_TOP, 0x0FFFFFFF); + Write32(OUT, R600_MC_VM_AGP_BOT, 0x0FFFFFFF); + + idleState = radeon_gpu_mc_idlecheck(); + if (idleState > 0) { + TRACE("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", + __func__, idleState); + return B_ERROR; + } radeon_gpu_mc_resume(); + // disable render control + Write32(OUT, 0x000300, Read32(OUT, 0x000300) & 0xFFFCFFFF); + return B_OK; } +void +radeon_gpu_mc_init() +{ + radeon_shared_info &info = *gInfo->shared_info; + + if (gInfo->shared_info->frame_buffer_size > 0) + gInfo->mc.valid = true; + + // TODO: 0 should be correct here... but it gets me vertical stripes + //uint64 vramBase = 0; + uint64 vramBase = gInfo->shared_info->frame_buffer_phys; + + if ((info.chipsetFlags & CHIP_IGP) != 0) { + vramBase = Read32(OUT, R6XX_MC_VM_FB_LOCATION) & 0xFFFF; + vramBase <<= 24; + } + + gInfo->mc.vramStart = vramBase; + gInfo->mc.vramSize = gInfo->shared_info->frame_buffer_size * 1024; + gInfo->mc.vramEnd = (vramBase + gInfo->mc.vramSize) - 1; +} + + +status_t +radeon_gpu_mc_setup() +{ + radeon_shared_info &info = *gInfo->shared_info; + + radeon_gpu_mc_init(); + // init video ram ranges for memory controler + + if (gInfo->mc.valid != true) { + ERROR("%s: Memory Controller init failed.\n", __func__); + return B_ERROR; + } + + TRACE("%s: vramStart: 0x%" B_PRIX64 ", vramEnd: 0x%" B_PRIX64 "\n", + __func__, gInfo->mc.vramStart, gInfo->mc.vramEnd); + + if (info.device_chipset >= RADEON_R600) + return radeon_gpu_mc_setup_r600(); + + return B_ERROR; +} + + status_t radeon_gpu_irq_setup() { diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h b/src/add-ons/accelerants/radeon_hd/gpu.h index 1de75e582b..54f60b7e7f 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.h +++ b/src/add-ons/accelerants/radeon_hd/gpu.h @@ -12,6 +12,12 @@ #include "accelerant.h" +#define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0 +#define HDP_NONSURFACE_BASE 0x2C04 +#define HDP_NONSURFACE_INFO 0x2C08 +#define HDP_NONSURFACE_SIZE 0x2C0C + + // GPU Control registers. These are combined as // the registers exist on all models, some flags // are different though and are commented as such diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index c0700aade5..63805a08b6 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -209,16 +209,20 @@ radeon_set_display_mode(display_mode *mode) } // for debugging - TRACE("D1CRTC_STATUS Value: 0x%X\n", Read32(CRT, D1CRTC_STATUS)); - TRACE("D2CRTC_STATUS Value: 0x%X\n", Read32(CRT, D2CRTC_STATUS)); - TRACE("D1CRTC_CONTROL Value: 0x%X\n", Read32(CRT, D1CRTC_CONTROL)); - TRACE("D2CRTC_CONTROL Value: 0x%X\n", Read32(CRT, D2CRTC_CONTROL)); - TRACE("D1GRPH_ENABLE Value: 0x%X\n", Read32(CRT, D1GRPH_ENABLE)); - TRACE("D2GRPH_ENABLE Value: 0x%X\n", Read32(CRT, D2GRPH_ENABLE)); - TRACE("D1SCL_ENABLE Value: 0x%X\n", Read32(CRT, D1SCL_ENABLE)); - TRACE("D2SCL_ENABLE Value: 0x%X\n", Read32(CRT, D2SCL_ENABLE)); - TRACE("RV620_DACA_ENABLE Value: 0x%X\n", Read32(CRT, RV620_DACA_ENABLE)); - TRACE("RV620_DACB_ENABLE Value: 0x%X\n", Read32(CRT, RV620_DACB_ENABLE)); + TRACE("D1CRTC_STATUS Value: 0x%X\n", Read32(CRT, D1CRTC_STATUS)); + TRACE("D2CRTC_STATUS Value: 0x%X\n", Read32(CRT, D2CRTC_STATUS)); + TRACE("D1CRTC_CONTROL Value: 0x%X\n", Read32(CRT, D1CRTC_CONTROL)); + TRACE("D2CRTC_CONTROL Value: 0x%X\n", Read32(CRT, D2CRTC_CONTROL)); + TRACE("D1GRPH_ENABLE Value: 0x%X\n", Read32(CRT, D1GRPH_ENABLE)); + TRACE("D2GRPH_ENABLE Value: 0x%X\n", Read32(CRT, D2GRPH_ENABLE)); + TRACE("D1SCL_ENABLE Value: 0x%X\n", Read32(CRT, D1SCL_ENABLE)); + TRACE("D2SCL_ENABLE Value: 0x%X\n", Read32(CRT, D2SCL_ENABLE)); + TRACE("RV620_DACA_ENABLE Value: 0x%X\n", Read32(CRT, RV620_DACA_ENABLE)); + TRACE("RV620_DACB_ENABLE Value: 0x%X\n", Read32(CRT, RV620_DACB_ENABLE)); + TRACE("D1CRTC_BLANK_CONTROL Value: 0x%X\n", + Read32(CRT, D1CRTC_BLANK_CONTROL)); + TRACE("D2CRTC_BLANK_CONTROL Value: 0x%X\n", + Read32(CRT, D2CRTC_BLANK_CONTROL)); return B_OK; } @@ -240,7 +244,7 @@ radeon_get_frame_buffer_config(frame_buffer_config *config) TRACE("%s\n", __func__); config->frame_buffer = gInfo->shared_info->frame_buffer; - config->frame_buffer_dma = (uint8 *)gInfo->shared_info->frame_buffer_phys; + config->frame_buffer_dma = (uint8*)gInfo->shared_info->frame_buffer_phys; config->bytes_per_row = gInfo->shared_info->bytes_per_row; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 909126f162..c4f44cdeb6 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -467,6 +467,7 @@ radeon_hd_init(radeon_info &info) } memset((void *)info.shared_info, 0, sizeof(radeon_shared_info)); + sharedCreator.Detach(); // *** Map Memory mapped IO AreaKeeper mmioMapper; @@ -480,16 +481,44 @@ radeon_hd_init(radeon_info &info) __func__, info.id); return info.registers_area; } + mmioMapper.Detach(); + + // *** Populate frame buffer information + if (info.shared_info->device_chipset >= RADEON_R1000) { + // R800+ has memory stored in MB + info.shared_info->graphics_memory_size + = read32(info.registers + R6XX_CONFIG_MEMSIZE) * 1024; + } else { + // R600-R700 has memory stored in bytes + info.shared_info->graphics_memory_size + = read32(info.registers + R6XX_CONFIG_MEMSIZE) / 1024; + } + + uint32 barSize = info.pci->u.h0.base_register_sizes[RHD_FB_BAR] / 1024; + + // if graphics memory is larger then PCI bar, just map bar + if (info.shared_info->graphics_memory_size > barSize) { + TRACE("%s: shrinking frame buffer to PCI bar...\n", + __func__); + info.shared_info->frame_buffer_size = barSize; + } else { + info.shared_info->frame_buffer_size + = info.shared_info->graphics_memory_size; + } + + TRACE("%s: mapping a frame buffer of %" B_PRIu32 "MB out of %" B_PRIu32 + "MB video ram\n", __func__, info.shared_info->frame_buffer_size / 1024, + info.shared_info->graphics_memory_size / 1024); // *** Framebuffer mapping AreaKeeper frambufferMapper; - info.framebuffer_area = frambufferMapper.Map("radeon hd framebuffer", + info.framebuffer_area = frambufferMapper.Map("radeon hd frame buffer", (void *)info.pci->u.h0.base_registers[RHD_FB_BAR], - info.pci->u.h0.base_register_sizes[RHD_FB_BAR], + info.shared_info->frame_buffer_size * 1024, B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, (void **)&info.shared_info->frame_buffer); if (frambufferMapper.InitCheck() < B_OK) { - ERROR("%s: card(%ld): couldn't map framebuffer!\n", + ERROR("%s: card(%ld): couldn't map frame buffer!\n", __func__, info.id); return info.framebuffer_area; } @@ -498,10 +527,12 @@ radeon_hd_init(radeon_info &info) vm_set_area_memory_type(info.framebuffer_area, info.pci->u.h0.base_registers[RHD_FB_BAR], B_MTR_WC); - sharedCreator.Detach(); - mmioMapper.Detach(); frambufferMapper.Detach(); + info.shared_info->frame_buffer_area = info.framebuffer_area; + info.shared_info->frame_buffer_phys + = info.pci->u.h0.base_registers[RHD_FB_BAR]; + // Pass common information to accelerant info.shared_info->device_index = info.id; info.shared_info->device_id = info.device_id; @@ -512,12 +543,6 @@ radeon_hd_init(radeon_info &info) info.shared_info->registers_area = info.registers_area; strcpy(info.shared_info->device_identifier, info.device_identifier); - info.shared_info->frame_buffer_area = info.framebuffer_area; - info.shared_info->frame_buffer_phys - = info.pci->u.h0.base_registers[RHD_FB_BAR]; - info.shared_info->frame_buffer_int - = read32(info.registers + R6XX_CONFIG_FB_BASE); - // *** AtomBIOS mapping // First we try an active bios read status_t biosStatus = radeon_hd_getbios(info); @@ -584,39 +609,6 @@ radeon_hd_init(radeon_info &info) info.shared_info->has_edid = false; } - // *** Populate graphics_memory/aperture_size with KB - if (info.shared_info->device_chipset >= RADEON_R1000) { - // R800+ has memory stored in MB - info.shared_info->graphics_memory_size - = read32(info.registers + R6XX_CONFIG_MEMSIZE) * 1024; - info.shared_info->frame_buffer_size - = read32(info.registers + R6XX_CONFIG_APER_SIZE) * 1024; - } else { - // R600-R700 has memory stored in bytes - info.shared_info->graphics_memory_size - = read32(info.registers + R6XX_CONFIG_MEMSIZE) / 1024; - info.shared_info->frame_buffer_size - = read32(info.registers + R6XX_CONFIG_APER_SIZE) / 1024; - } - - uint32 barSize = info.pci->u.h0.base_register_sizes[RHD_FB_BAR] / 1024; - - // if graphics memory is larger then PCI bar, just map bar - if (info.shared_info->graphics_memory_size > barSize) - info.shared_info->frame_buffer_size = barSize; - else - info.shared_info->frame_buffer_size - = info.shared_info->graphics_memory_size; - - int32 memory_size = info.shared_info->graphics_memory_size / 1024; - int32 frame_buffer_size = info.shared_info->frame_buffer_size / 1024; - - TRACE("card(%ld): Found %ld MB memory on card\n", info.id, - memory_size); - - TRACE("card(%ld): Frame buffer aperture size is %ld MB\n", info.id, - frame_buffer_size); - TRACE("card(%ld): %s completed successfully!\n", info.id, __func__); return B_OK; } From bbcc2a8c03a61740b3d4e600e228028e545ce324 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 26 Oct 2011 14:11:24 +0000 Subject: [PATCH 464/702] * lets idle the memory controller before checking if it's idle git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42925 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 245498ea27..25a290b3d7 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -241,6 +241,8 @@ radeon_gpu_mc_setup_r600() Write32(OUT, HDP_REG_COHERENCY_FLUSH_CNTL, 0); // idle the memory controller + radeon_gpu_mc_halt(); + uint32 idleState = radeon_gpu_mc_idlecheck(); if (idleState > 0) { TRACE("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", From 9de720a4ac2c6ee092da299d6948670b4c17ad10 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Wed, 26 Oct 2011 20:12:09 +0000 Subject: [PATCH 465/702] * Propose using $(STDCPPLIBS) definition for version-independent linking of standard C++ libraries (stdc++.r4 <-> stdc++ supc++); * Force C++ language at preprocessing the sources before localization catkeys collecting. It gives a hint for compiler to handle .pre file as C++ one preventing breaking on "unfound" C++ headers. Thanks to Vitaly Diger for pointing it out. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42926 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/develop/makefile | 5 ++++- data/develop/makefile-engine | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/data/develop/makefile b/data/develop/makefile index 6a6caebb63..51681517d5 100644 --- a/data/develop/makefile +++ b/data/develop/makefile @@ -1,4 +1,4 @@ -## BeOS Generic Makefile v2.4 ## +## BeOS Generic Makefile v2.5 ## ## Fill in this file to specify the project being created, and the referenced ## makefile-engine will do all of the hard work for you. This handles both @@ -56,6 +56,9 @@ RSRCS= # libXXX.so or libXXX.a you can simply specify XXX # library: libbe.so entry: be # +# - for version-independent linking of standard C++ libraries please add +# $(STDCPPLIBS) instead of raw "stdc++[.r4] [supc++]" library names +# # - for localization support add following libs: # locale localestub # diff --git a/data/develop/makefile-engine b/data/develop/makefile-engine index e737619128..279d0f05fb 100644 --- a/data/develop/makefile-engine +++ b/data/develop/makefile-engine @@ -1,8 +1,8 @@ -## BeOS and Haiku Generic Makefile Engine v2.4.0 +## BeOS and Haiku Generic Makefile Engine v2.5.0 ## Does all the hard work for the Generic Makefile ## which simply defines the project parameters -## Supports Generic Makefile v2.0, 2.01, 2.1, 2.2, 2.3, 2.4 +## Supports Generic Makefile v2.0, 2.01, 2.1, 2.2, 2.3, 2.4, 2.5 # determine wheather running on x86 or ppc MACHINE=$(shell uname -m) @@ -142,17 +142,21 @@ SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) VPATH := VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) -# SETTING: build the local and system include paths +# SETTING: build the local and system include paths, compose C++ libs ifeq ($(CPU), x86) LOC_INCLUDES = $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -I, $(path))) ifeq ($(CC_VER), 2) INCLUDES = $(LOC_INCLUDES) INCLUDES += -I- INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -I, $(path))) + + STDCPPLIBS = stdc++.r4 else INCLUDES = -iquote./ INCLUDES += $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -iquote, $(path))) INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -isystem, $(path))) + + STDCPPLIBS = stdc++ supc++ endif else ifeq ($(CPU), ppc) @@ -310,7 +314,7 @@ $(CATALOGS_DIR)/%.catalog : $(CATKEYS_DIR)/%.catkeys # rule to preprocess program sources into file ready for collecting catkeys $(OBJ_DIR)/$(NAME).pre : $(SRCS) - -cat $(SRCS) | $(CC) -E $(INCLUDES) $(CFLAGS) -DB_COLLECTING_CATKEYS - > $(OBJ_DIR)/$(NAME).pre + -cat $(SRCS) | $(CC) -E -x c++ $(INCLUDES) $(CFLAGS) -DB_COLLECTING_CATKEYS - > $(OBJ_DIR)/$(NAME).pre # rules to collect localization catkeys catkeys : $(CATKEYS_DIR)/en.catkeys From 3c6f4dd82e4b7dda54106fc687298c436dba95ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Wed, 26 Oct 2011 23:55:00 +0000 Subject: [PATCH 466/702] A description of the Atari TOS PRG file format I used to write the ldscript for the .prg bootloader at src/system/ldscripts/m68k/boot_prg_atari_m68k.ld git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42927 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/develop/ports/m68k/atari/atariexe.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 docs/develop/ports/m68k/atari/atariexe.txt diff --git a/docs/develop/ports/m68k/atari/atariexe.txt b/docs/develop/ports/m68k/atari/atariexe.txt new file mode 100644 index 0000000000..4061c2eead --- /dev/null +++ b/docs/develop/ports/m68k/atari/atariexe.txt @@ -0,0 +1,57 @@ +Subject: Atari ST executables +From: DaFi + +The specs for Atari ST executables (was listed as requested on www.wotsit.demon.co.uk/wanted.htm)... + +applies for TOS, PRG, TTP, PRX, GTP, APP, ACC, ACX (different suffixes indicate different behavior of the program, i.e. TOS and TTP may not use the GEM GUI, while all the others may; only TTP and GTP can be called with parameters; ACC may be installed as desktop accessories; PRX and ACX mean the programs were disabled. + +file structure: +[2] WORD PRG_magic - magic value 0x601a +[4] LONG PRG_tsize - size of text segment +[4] LONG PRG_dsize - size of data segment +[4] LONG PRG_bsize - size of bss segment +[4] LONG PRG_ssize - size of symbol table +[4] LONG PRG_res1 - reserved +[4] LONG PRGFLAGS - bit vector that defines additional process characteristics, as follows: + Bit 0 PF_FASTLOAD - if set, only the BSS area is cleared, otherwise, + the programs whole memory is cleared before loading + Bit 1 PF_TTRAMLOAD - if set, the program will be loaded into TT RAM + Bit 2 PF_TTRAMMEM - if set, the program will be allowed to allocate + memory from TT RAM + Bit 4 AND 5 as a two bit value with the following meanings: + 0 PF_PRIVATE - the processes entire memory space is considered private + 1 PF_GLOBAL - the processes memory will be r/w-allowed for others + 2 PF_SUPER - the memory will be r/w for itself and any supervisor proc + 3 PF_READ - the memory will be readable by others +[2] WORD ABSFLAG - is NON-ZERO, if the program does not need to be relocated + is ZERO, if the program needs to be relocated + note: since some TOS versions handle files with ABSFLAG>0 incorrectly, + this value should be set to ZERO also for programs that need to be + relocated, and the FIXUP_offset should be set to 0. + +From there on... (should be offset 0x1c) +[PRG_tsize] TEXT segment +[PRG_dsize] DATA segment +[PRG_ssize] Symbol table + +[4] LONG FIXUP_offset - first LONG that needs to be relocated (offset to beginning of file) + +From there on till the end of the file... +FIXUP table, with entries as follows: +[1] BYTE value - with value as follows: + value=0 end of list + value=1 advance 254 bytes + value=2 to value=254 (only even values!) advance this many bytes and + relocate the LONG found there +Thats it. You made it through to EOF. + +A final note about fixing up (relocating) an executable: (pseudo-code) +The long value FIXUP_offset tells you your start adress. Lets call it "adr". So, now, that +you have adr, read the first byte of the table. +(*) loop +- if its 0, stop relocating -> youre done! +- if its 1, add 254 to adr and read the next byte, jump back to the asterisk (*) +- if its any other even value, add the value to your adr, then relocate the LONG at adr. + (i.e. add the adress of the LONG to its value) + +dafi From fe0bb0ec24b04d124f0576eb5aef86340248a002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Wed, 26 Oct 2011 23:56:40 +0000 Subject: [PATCH 467/702] Cleanup: reorder includes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42928 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../input_server/methods/t9/T9InputServerMethod.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp b/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp index 4552baa039..0b102923bf 100644 --- a/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp +++ b/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp @@ -12,13 +12,14 @@ #include #include -#include #include -#include -#include +#include +#include #include #include -#include +#include +#include +#include #include From 139848f37a5f88530689074225a4da795c7bd6bd Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 27 Oct 2011 18:03:02 +0000 Subject: [PATCH 468/702] * bailing when we can't idle the MC is the correct behaviour... but while things are incomplete it may be better to try and push on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42929 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 25a290b3d7..4ace4dfa47 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -245,9 +245,9 @@ radeon_gpu_mc_setup_r600() uint32 idleState = radeon_gpu_mc_idlecheck(); if (idleState > 0) { - TRACE("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", + ERROR("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", __func__, idleState); - return B_ERROR; + //return B_ERROR; } // TODO: Memory Controller AGP @@ -277,9 +277,9 @@ radeon_gpu_mc_setup_r600() idleState = radeon_gpu_mc_idlecheck(); if (idleState > 0) { - TRACE("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", + ERROR("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", __func__, idleState); - return B_ERROR; + //return B_ERROR; } radeon_gpu_mc_resume(); From 025d4eed52f31e0047268227cde722164e52e2d8 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 28 Oct 2011 04:30:54 +0000 Subject: [PATCH 469/702] * reorganize register definitions There were a large number if incorrect, duplicated, misplaced registers that were leading to bugs in the code. This is my first shot at cleaning them up. Luckly as we are using AtomBIOS the number of registers we need to know about is shrinking. * remove registers left over from register banging days * r770 is less then r710, r720 in the drm sources. Fix in code. * enable newer radeons for testing git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42930 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/radeon_hd/avivo.h | 65 + headers/private/graphics/radeon_hd/r500_reg.h | 4 - headers/private/graphics/radeon_hd/r600_reg.h | 23 +- headers/private/graphics/radeon_hd/r700_reg.h | 404 ++++++ .../private/graphics/radeon_hd/radeon_hd.h | 39 +- headers/private/graphics/radeon_hd/rhd_regs.h | 1160 ----------------- .../accelerants/radeon_hd/accelerant.h | 18 +- src/add-ons/accelerants/radeon_hd/display.cpp | 260 ++-- src/add-ons/accelerants/radeon_hd/gpu.cpp | 77 +- src/add-ons/accelerants/radeon_hd/mode.cpp | 18 +- src/add-ons/accelerants/radeon_hd/pll.cpp | 2 +- .../drivers/graphics/radeon_hd/driver.cpp | 3 - .../drivers/graphics/radeon_hd/radeon_hd.cpp | 6 +- 13 files changed, 699 insertions(+), 1380 deletions(-) create mode 100644 headers/private/graphics/radeon_hd/avivo.h create mode 100644 headers/private/graphics/radeon_hd/r700_reg.h delete mode 100644 headers/private/graphics/radeon_hd/rhd_regs.h diff --git a/headers/private/graphics/radeon_hd/avivo.h b/headers/private/graphics/radeon_hd/avivo.h new file mode 100644 index 0000000000..bd4dab793b --- /dev/null +++ b/headers/private/graphics/radeon_hd/avivo.h @@ -0,0 +1,65 @@ +/* + * Copyright 2009 Advanced Micro Devices, Inc. + * Copyright 2009 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: Dave Airlie + * Alex Deucher + * Jerome Glisse + */ +#ifndef AVIVO_H +#define AVIVO_H + + +#define D1CRTC_CONTROL 0x6080 +#define CRTC_EN (1 << 0) +#define D1CRTC_STATUS 0x609c +#define D1CRTC_UPDATE_LOCK 0x60E8 +#define D1GRPH_SWAP_CNTL 0x610C +#define D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 +#define D1GRPH_SECONDARY_SURFACE_ADDRESS 0x6118 + +#define D2CRTC_CONTROL 0x6880 +#define D2CRTC_STATUS 0x689c +#define D2CRTC_UPDATE_LOCK 0x68E8 +#define D2GRPH_SWAP_CNTL 0x690C +#define D2GRPH_PRIMARY_SURFACE_ADDRESS 0x6910 +#define D2GRPH_SECONDARY_SURFACE_ADDRESS 0x6918 + +#define D1VGA_CONTROL 0x0330 +#define DVGA_CONTROL_MODE_ENABLE (1 << 0) +#define DVGA_CONTROL_TIMING_SELECT (1 << 8) +#define DVGA_CONTROL_SYNC_POLARITY_SELECT (1 << 9) +#define DVGA_CONTROL_OVERSCAN_TIMING_SELECT (1 << 10) +#define DVGA_CONTROL_OVERSCAN_COLOR_EN (1 << 16) +#define DVGA_CONTROL_ROTATE (1 << 24) +#define D2VGA_CONTROL 0x0338 + +#define VGA_HDP_CONTROL 0x328 +#define VGA_MEM_PAGE_SELECT_EN (1 << 0) +#define VGA_MEMORY_DISABLE (1 << 4) +#define VGA_RBBM_LOCK_DISABLE (1 << 8) +#define VGA_SOFT_RESET (1 << 16) +#define VGA_MEMORY_BASE_ADDRESS 0x0310 +#define VGA_RENDER_CONTROL 0x0300 +#define VGA_VSTATUS_CNTL_MASK 0x00030000 + + +#endif diff --git a/headers/private/graphics/radeon_hd/r500_reg.h b/headers/private/graphics/radeon_hd/r500_reg.h index fc43705991..93afeea84b 100644 --- a/headers/private/graphics/radeon_hd/r500_reg.h +++ b/headers/private/graphics/radeon_hd/r500_reg.h @@ -398,11 +398,7 @@ */ #define AVIVO_D1GRPH_LUT_SEL 0x6108 #define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 -#define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6914 -#define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 #define AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS 0x6118 -#define R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x691c -#define R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x611c #define AVIVO_D1GRPH_PITCH 0x6120 #define AVIVO_D1GRPH_SURFACE_OFFSET_X 0x6124 #define AVIVO_D1GRPH_SURFACE_OFFSET_Y 0x6128 diff --git a/headers/private/graphics/radeon_hd/r600_reg.h b/headers/private/graphics/radeon_hd/r600_reg.h index 215c2a1de2..73e50db477 100644 --- a/headers/private/graphics/radeon_hd/r600_reg.h +++ b/headers/private/graphics/radeon_hd/r600_reg.h @@ -29,6 +29,10 @@ #define __R600_REG_H__ +#define R600_CRTC0_REGISTER_OFFSET 0x0 +#define R600_CRTC1_REGISTER_OFFSET 0x800 + + #define R600_PCIE_PORT_INDEX 0x0038 #define R600_PCIE_PORT_DATA 0x003c @@ -50,29 +54,10 @@ #define R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2194 #define R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x2198 -#define R700_MC_VM_FB_LOCATION 0x2024 -#define R700_MC_FB_BASE_MASK 0x0000FFFF -#define R700_MC_FB_BASE_SHIFT 0 -#define R700_MC_FB_TOP_MASK 0xFFFF0000 -#define R700_MC_FB_TOP_SHIFT 16 -#define R700_MC_VM_AGP_TOP 0x2028 -#define R700_MC_AGP_TOP_MASK 0x0003FFFF -#define R700_MC_AGP_TOP_SHIFT 0 -#define R700_MC_VM_AGP_BOT 0x202c -#define R700_MC_AGP_BOT_MASK 0x0003FFFF -#define R700_MC_AGP_BOT_SHIFT 0 -#define R700_MC_VM_AGP_BASE 0x2030 -#define R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034 -#define R700_LOGICAL_PAGE_NUMBER_MASK 0x000FFFFF -#define R700_LOGICAL_PAGE_NUMBER_SHIFT 0 -#define R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038 -#define R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203c - #define R600_RAMCFG 0x2408 # define R600_CHANSIZE (1 << 7) # define R600_CHANSIZE_OVERRIDE (1 << 10) - #define R600_GENERAL_PWRMGT 0x618 # define R600_OPEN_DRAIN_PADS (1 << 11) diff --git a/headers/private/graphics/radeon_hd/r700_reg.h b/headers/private/graphics/radeon_hd/r700_reg.h new file mode 100644 index 0000000000..bf38804649 --- /dev/null +++ b/headers/private/graphics/radeon_hd/r700_reg.h @@ -0,0 +1,404 @@ +/* + * Copyright 2009 Advanced Micro Devices, Inc. + * Copyright 2009 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: Dave Airlie + * Alex Deucher + * Jerome Glisse + */ +#ifndef RV770_H +#define RV770_H + + +#define R7XX_MAX_SH_GPRS 256 +#define R7XX_MAX_TEMP_GPRS 16 +#define R7XX_MAX_SH_THREADS 256 +#define R7XX_MAX_SH_STACK_ENTRIES 4096 +#define R7XX_MAX_BACKENDS 8 +#define R7XX_MAX_BACKENDS_MASK 0xff +#define R7XX_MAX_SIMDS 16 +#define R7XX_MAX_SIMDS_MASK 0xffff +#define R7XX_MAX_PIPES 8 +#define R7XX_MAX_PIPES_MASK 0xff + +#if 0 +/* Registers */ +#define CB_COLOR0_BASE 0x28040 +#define CB_COLOR1_BASE 0x28044 +#define CB_COLOR2_BASE 0x28048 +#define CB_COLOR3_BASE 0x2804C +#define CB_COLOR4_BASE 0x28050 +#define CB_COLOR5_BASE 0x28054 +#define CB_COLOR6_BASE 0x28058 +#define CB_COLOR7_BASE 0x2805C +#define CB_COLOR7_FRAG 0x280FC + +#define CC_GC_SHADER_PIPE_CONFIG 0x8950 +#define CC_RB_BACKEND_DISABLE 0x98F4 +#define BACKEND_DISABLE(x) ((x) << 16) +#define CC_SYS_RB_BACKEND_DISABLE 0x3F88 + +#define CGTS_SYS_TCC_DISABLE 0x3F90 +#define CGTS_TCC_DISABLE 0x9148 +#define CGTS_USER_SYS_TCC_DISABLE 0x3F94 +#define CGTS_USER_TCC_DISABLE 0x914C + +#define CP_ME_CNTL 0x86D8 +#define CP_ME_HALT (1<<28) +#define CP_PFP_HALT (1<<26) +#define CP_ME_RAM_DATA 0xC160 +#define CP_ME_RAM_RADDR 0xC158 +#define CP_ME_RAM_WADDR 0xC15C +#define CP_MEQ_THRESHOLDS 0x8764 +#define STQ_SPLIT(x) ((x) << 0) +#define CP_PERFMON_CNTL 0x87FC +#define CP_PFP_UCODE_ADDR 0xC150 +#define CP_PFP_UCODE_DATA 0xC154 +#define CP_QUEUE_THRESHOLDS 0x8760 +#define ROQ_IB1_START(x) ((x) << 0) +#define ROQ_IB2_START(x) ((x) << 8) +#define CP_RB_CNTL 0xC104 +#define RB_BUFSZ(x) ((x) << 0) +#define RB_BLKSZ(x) ((x) << 8) +#define RB_NO_UPDATE (1 << 27) +#define RB_RPTR_WR_ENA (1 << 31) +#define BUF_SWAP_32BIT (2 << 16) +#define CP_RB_RPTR 0x8700 +#define CP_RB_RPTR_ADDR 0xC10C +#define CP_RB_RPTR_ADDR_HI 0xC110 +#define CP_RB_RPTR_WR 0xC108 +#define CP_RB_WPTR 0xC114 +#define CP_RB_WPTR_ADDR 0xC118 +#define CP_RB_WPTR_ADDR_HI 0xC11C +#define CP_RB_WPTR_DELAY 0x8704 +#define CP_SEM_WAIT_TIMER 0x85BC + +#define DB_DEBUG3 0x98B0 +#define DB_CLK_OFF_DELAY(x) ((x) << 11) +#define DB_DEBUG4 0x9B8C +#define DISABLE_TILE_COVERED_FOR_PS_ITER (1 << 6) + +#define DCP_TILING_CONFIG 0x6CA0 +#define PIPE_TILING(x) ((x) << 1) +#define BANK_TILING(x) ((x) << 4) +#define GROUP_SIZE(x) ((x) << 6) +#define ROW_TILING(x) ((x) << 8) +#define BANK_SWAPS(x) ((x) << 11) +#define SAMPLE_SPLIT(x) ((x) << 14) +#define BACKEND_MAP(x) ((x) << 16) + +#define GB_TILING_CONFIG 0x98F0 + +#define GC_USER_SHADER_PIPE_CONFIG 0x8954 +#define INACTIVE_QD_PIPES(x) ((x) << 8) +#define INACTIVE_QD_PIPES_MASK 0x0000FF00 +#define INACTIVE_SIMDS(x) ((x) << 16) +#define INACTIVE_SIMDS_MASK 0x00FF0000 + +#define GRBM_CNTL 0x8000 +#define GRBM_READ_TIMEOUT(x) ((x) << 0) +#define GRBM_SOFT_RESET 0x8020 +#define SOFT_RESET_CP (1<<0) +#define GRBM_STATUS 0x8010 +#define CMDFIFO_AVAIL_MASK 0x0000000F +#define GUI_ACTIVE (1<<31) +#define GRBM_STATUS2 0x8014 + +#define CG_MULT_THERMAL_STATUS 0x740 +#define ASIC_T(x) ((x) << 16) +#define ASIC_T_MASK 0x3FF0000 +#define ASIC_T_SHIFT 16 +#endif + +#define HDP_HOST_PATH_CNTL 0x2C00 +#define HDP_NONSURFACE_BASE 0x2C04 +#define HDP_NONSURFACE_INFO 0x2C08 +#define HDP_NONSURFACE_SIZE 0x2C0C +#define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0 +#define HDP_TILING_CONFIG 0x2F3C +#define HDP_DEBUG1 0x2F34 + +#define R700_MC_SHARED_CHMAP 0x2004 +#define NOOFCHAN_SHIFT 12 +#define NOOFCHAN_MASK 0x00003000 +#define R700_MC_SHARED_CHREMAP 0x2008 + +#define R700_MC_ARB_RAMCFG 0x2760 +#define NOOFBANK_SHIFT 0 +#define NOOFBANK_MASK 0x00000003 +#define NOOFRANK_SHIFT 2 +#define NOOFRANK_MASK 0x00000004 +#define NOOFROWS_SHIFT 3 +#define NOOFROWS_MASK 0x00000038 +#define NOOFCOLS_SHIFT 6 +#define NOOFCOLS_MASK 0x000000C0 +#define CHANSIZE_SHIFT 8 +#define CHANSIZE_MASK 0x00000100 +#define BURSTLENGTH_SHIFT 9 +#define BURSTLENGTH_MASK 0x00000200 +#define CHANSIZE_OVERRIDE (1 << 11) +#define R700_MC_VM_AGP_TOP 0x2028 +#define R700_MC_VM_AGP_BOT 0x202C +#define R700_MC_VM_AGP_BASE 0x2030 +#define R700_MC_VM_FB_LOCATION 0x2024 +#define R700_MC_VM_MB_L1_TLB0_CNTL 0x2234 +#define R700_MC_VM_MB_L1_TLB1_CNTL 0x2238 +#define R700_MC_VM_MB_L1_TLB2_CNTL 0x223C +#define R700_MC_VM_MB_L1_TLB3_CNTL 0x2240 +#define ENABLE_L1_TLB (1 << 0) +#define ENABLE_L1_FRAGMENT_PROCESSING (1 << 1) +#define SYSTEM_ACCESS_MODE_PA_ONLY (0 << 3) +#define SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 3) +#define SYSTEM_ACCESS_MODE_IN_SYS (2 << 3) +#define SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 3) +#define SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 5) +#define EFFECTIVE_L1_TLB_SIZE(x) ((x)<<15) +#define EFFECTIVE_L1_QUEUE_SIZE(x) ((x)<<18) +#define R700_MC_VM_MD_L1_TLB0_CNTL 0x2654 +#define R700_MC_VM_MD_L1_TLB1_CNTL 0x2658 +#define R700_MC_VM_MD_L1_TLB2_CNTL 0x265C +#define R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C +#define R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038 +#define R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034 + +#define PA_CL_ENHANCE 0x8A14 +#define CLIP_VTX_REORDER_ENA (1 << 0) +#define NUM_CLIP_SEQ(x) ((x) << 1) +#define PA_SC_AA_CONFIG 0x28C04 +#define PA_SC_CLIPRECT_RULE 0x2820C +#define PA_SC_EDGERULE 0x28230 +#define PA_SC_FIFO_SIZE 0x8BCC +#define SC_PRIM_FIFO_SIZE(x) ((x) << 0) +#define SC_HIZ_TILE_FIFO_SIZE(x) ((x) << 12) +#define PA_SC_FORCE_EOV_MAX_CNTS 0x8B24 +#define FORCE_EOV_MAX_CLK_CNT(x) ((x)<<0) +#define FORCE_EOV_MAX_REZ_CNT(x) ((x)<<16) +#define PA_SC_LINE_STIPPLE 0x28A0C +#define PA_SC_LINE_STIPPLE_STATE 0x8B10 +#define PA_SC_MODE_CNTL 0x28A4C +#define PA_SC_MULTI_CHIP_CNTL 0x8B20 +#define SC_EARLYZ_TILE_FIFO_SIZE(x) ((x) << 20) + +#define R700_SCRATCH_REG0 0x8500 +#define R700_SCRATCH_REG1 0x8504 +#define R700_SCRATCH_REG2 0x8508 +#define R700_SCRATCH_REG3 0x850C +#define R700_SCRATCH_REG4 0x8510 +#define R700_SCRATCH_REG5 0x8514 +#define R700_SCRATCH_REG6 0x8518 +#define R700_SCRATCH_REG7 0x851C +#define R700_SCRATCH_UMSK 0x8540 +#define R700_SCRATCH_ADDR 0x8544 + +#if 0 +#define SMX_DC_CTL0 0xA020 +#define USE_HASH_FUNCTION (1 << 0) +#define CACHE_DEPTH(x) ((x) << 1) +#define FLUSH_ALL_ON_EVENT (1 << 10) +#define STALL_ON_EVENT (1 << 11) +#define SMX_EVENT_CTL 0xA02C +#define ES_FLUSH_CTL(x) ((x) << 0) +#define GS_FLUSH_CTL(x) ((x) << 3) +#define ACK_FLUSH_CTL(x) ((x) << 6) +#define SYNC_FLUSH_CTL (1 << 8) + +#define SPI_CONFIG_CNTL 0x9100 +#define GPR_WRITE_PRIORITY(x) ((x) << 0) +#define DISABLE_INTERP_1 (1 << 5) +#define SPI_CONFIG_CNTL_1 0x913C +#define VTX_DONE_DELAY(x) ((x) << 0) +#define INTERP_ONE_PRIM_PER_ROW (1 << 4) +#define SPI_INPUT_Z 0x286D8 +#define SPI_PS_IN_CONTROL_0 0x286CC +#define NUM_INTERP(x) ((x)<<0) +#define POSITION_ENA (1<<8) +#define POSITION_CENTROID (1<<9) +#define POSITION_ADDR(x) ((x)<<10) +#define PARAM_GEN(x) ((x)<<15) +#define PARAM_GEN_ADDR(x) ((x)<<19) +#define BARYC_SAMPLE_CNTL(x) ((x)<<26) +#define PERSP_GRADIENT_ENA (1<<28) +#define LINEAR_GRADIENT_ENA (1<<29) +#define POSITION_SAMPLE (1<<30) +#define BARYC_AT_SAMPLE_ENA (1<<31) + +#define SQ_CONFIG 0x8C00 +#define VC_ENABLE (1 << 0) +#define EXPORT_SRC_C (1 << 1) +#define DX9_CONSTS (1 << 2) +#define ALU_INST_PREFER_VECTOR (1 << 3) +#define DX10_CLAMP (1 << 4) +#define CLAUSE_SEQ_PRIO(x) ((x) << 8) +#define PS_PRIO(x) ((x) << 24) +#define VS_PRIO(x) ((x) << 26) +#define GS_PRIO(x) ((x) << 28) +#define SQ_DYN_GPR_SIZE_SIMD_AB_0 0x8DB0 +#define SIMDA_RING0(x) ((x)<<0) +#define SIMDA_RING1(x) ((x)<<8) +#define SIMDB_RING0(x) ((x)<<16) +#define SIMDB_RING1(x) ((x)<<24) +#define SQ_DYN_GPR_SIZE_SIMD_AB_1 0x8DB4 +#define SQ_DYN_GPR_SIZE_SIMD_AB_2 0x8DB8 +#define SQ_DYN_GPR_SIZE_SIMD_AB_3 0x8DBC +#define SQ_DYN_GPR_SIZE_SIMD_AB_4 0x8DC0 +#define SQ_DYN_GPR_SIZE_SIMD_AB_5 0x8DC4 +#define SQ_DYN_GPR_SIZE_SIMD_AB_6 0x8DC8 +#define SQ_DYN_GPR_SIZE_SIMD_AB_7 0x8DCC +#define ES_PRIO(x) ((x) << 30) +#define SQ_GPR_RESOURCE_MGMT_1 0x8C04 +#define NUM_PS_GPRS(x) ((x) << 0) +#define NUM_VS_GPRS(x) ((x) << 16) +#define DYN_GPR_ENABLE (1 << 27) +#define NUM_CLAUSE_TEMP_GPRS(x) ((x) << 28) +#define SQ_GPR_RESOURCE_MGMT_2 0x8C08 +#define NUM_GS_GPRS(x) ((x) << 0) +#define NUM_ES_GPRS(x) ((x) << 16) +#define SQ_MS_FIFO_SIZES 0x8CF0 +#define CACHE_FIFO_SIZE(x) ((x) << 0) +#define FETCH_FIFO_HIWATER(x) ((x) << 8) +#define DONE_FIFO_HIWATER(x) ((x) << 16) +#define ALU_UPDATE_FIFO_HIWATER(x) ((x) << 24) +#define SQ_STACK_RESOURCE_MGMT_1 0x8C10 +#define NUM_PS_STACK_ENTRIES(x) ((x) << 0) +#define NUM_VS_STACK_ENTRIES(x) ((x) << 16) +#define SQ_STACK_RESOURCE_MGMT_2 0x8C14 +#define NUM_GS_STACK_ENTRIES(x) ((x) << 0) +#define NUM_ES_STACK_ENTRIES(x) ((x) << 16) +#define SQ_THREAD_RESOURCE_MGMT 0x8C0C +#define NUM_PS_THREADS(x) ((x) << 0) +#define NUM_VS_THREADS(x) ((x) << 8) +#define NUM_GS_THREADS(x) ((x) << 16) +#define NUM_ES_THREADS(x) ((x) << 24) + +#define SX_DEBUG_1 0x9058 +#define ENABLE_NEW_SMX_ADDRESS (1 << 16) +#define SX_EXPORT_BUFFER_SIZES 0x900C +#define COLOR_BUFFER_SIZE(x) ((x) << 0) +#define POSITION_BUFFER_SIZE(x) ((x) << 8) +#define SMX_BUFFER_SIZE(x) ((x) << 16) +#define SX_MISC 0x28350 + +#define TA_CNTL_AUX 0x9508 +#define DISABLE_CUBE_WRAP (1 << 0) +#define DISABLE_CUBE_ANISO (1 << 1) +#define SYNC_GRADIENT (1 << 24) +#define SYNC_WALKER (1 << 25) +#define SYNC_ALIGNER (1 << 26) +#define BILINEAR_PRECISION_6_BIT (0 << 31) +#define BILINEAR_PRECISION_8_BIT (1 << 31) + +#define TCP_CNTL 0x9610 +#define TCP_CHAN_STEER 0x9614 + +#define VGT_CACHE_INVALIDATION 0x88C4 +#define CACHE_INVALIDATION(x) ((x)<<0) +#define VC_ONLY 0 +#define TC_ONLY 1 +#define VC_AND_TC 2 +#define AUTO_INVLD_EN(x) ((x) << 6) +#define NO_AUTO 0 +#define ES_AUTO 1 +#define GS_AUTO 2 +#define ES_AND_GS_AUTO 3 +#define VGT_ES_PER_GS 0x88CC +#define VGT_GS_PER_ES 0x88C8 +#define VGT_GS_PER_VS 0x88E8 +#define VGT_GS_VERTEX_REUSE 0x88D4 +#define VGT_NUM_INSTANCES 0x8974 +#define VGT_OUT_DEALLOC_CNTL 0x28C5C +#define DEALLOC_DIST_MASK 0x0000007F +#define VGT_STRMOUT_EN 0x28AB0 +#define VGT_VERTEX_REUSE_BLOCK_CNTL 0x28C58 +#define VTX_REUSE_DEPTH_MASK 0x000000FF + +#define VM_CONTEXT0_CNTL 0x1410 +#define ENABLE_CONTEXT (1 << 0) +#define PAGE_TABLE_DEPTH(x) (((x) & 3) << 1) +#define RANGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 4) +#define VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x153C +#define VM_CONTEXT0_PAGE_TABLE_END_ADDR 0x157C +#define VM_CONTEXT0_PAGE_TABLE_START_ADDR 0x155C +#define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR 0x1518 +#define VM_L2_CNTL 0x1400 +#define ENABLE_L2_CACHE (1 << 0) +#define ENABLE_L2_FRAGMENT_PROCESSING (1 << 1) +#define ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE (1 << 9) +#define EFFECTIVE_L2_QUEUE_SIZE(x) (((x) & 7) << 14) +#define VM_L2_CNTL2 0x1404 +#define INVALIDATE_ALL_L1_TLBS (1 << 0) +#define INVALIDATE_L2_CACHE (1 << 1) +#define VM_L2_CNTL3 0x1408 +#define BANK_SELECT(x) ((x) << 0) +#define CACHE_UPDATE_MODE(x) ((x) << 6) +#define VM_L2_STATUS 0x140C +#define L2_BUSY (1 << 0) + +#define WAIT_UNTIL 0x8040 + +#define SRBM_STATUS 0x0E50 +#endif + +#define D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 +#define D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6914 +#define D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 +#define D1GRPH_SECONDARY_SURFACE_ADDRESS 0x6118 +#define D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x691c +#define D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x611c + +/* PCIE link stuff */ +#define PCIE_LC_TRAINING_CNTL 0xa1 /* PCIE_P */ +#define PCIE_LC_LINK_WIDTH_CNTL 0xa2 /* PCIE_P */ +# define LC_LINK_WIDTH_SHIFT 0 +# define LC_LINK_WIDTH_MASK 0x7 +# define LC_LINK_WIDTH_X0 0 +# define LC_LINK_WIDTH_X1 1 +# define LC_LINK_WIDTH_X2 2 +# define LC_LINK_WIDTH_X4 3 +# define LC_LINK_WIDTH_X8 4 +# define LC_LINK_WIDTH_X16 6 +# define LC_LINK_WIDTH_RD_SHIFT 4 +# define LC_LINK_WIDTH_RD_MASK 0x70 +# define LC_RECONFIG_ARC_MISSING_ESCAPE (1 << 7) +# define LC_RECONFIG_NOW (1 << 8) +# define LC_RENEGOTIATION_SUPPORT (1 << 9) +# define LC_RENEGOTIATE_EN (1 << 10) +# define LC_SHORT_RECONFIG_EN (1 << 11) +# define LC_UPCONFIGURE_SUPPORT (1 << 12) +# define LC_UPCONFIGURE_DIS (1 << 13) +#define PCIE_LC_SPEED_CNTL 0xa4 /* PCIE_P */ +# define LC_GEN2_EN_STRAP (1 << 0) +# define LC_TARGET_LINK_SPEED_OVERRIDE_EN (1 << 1) +# define LC_FORCE_EN_HW_SPEED_CHANGE (1 << 5) +# define LC_FORCE_DIS_HW_SPEED_CHANGE (1 << 6) +# define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK (0x3 << 8) +# define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT 3 +# define LC_CURRENT_DATA_RATE (1 << 11) +# define LC_VOLTAGE_TIMER_SEL_MASK (0xf << 14) +# define LC_CLR_FAILED_SPD_CHANGE_CNT (1 << 21) +# define LC_OTHER_SIDE_EVER_SENT_GEN2 (1 << 23) +# define LC_OTHER_SIDE_SUPPORTS_GEN2 (1 << 24) +#define MM_CFGREGS_CNTL 0x544c +# define MM_WR_TO_CFG_EN (1 << 3) +#define LINK_CNTL2 0x88 /* F0 */ +# define TARGET_LINK_SPEED_MASK (0xf << 0) +# define SELECTABLE_DEEMPHASIS (1 << 6) + +#endif diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index c17aa218b4..b0dde7300e 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -14,9 +14,10 @@ #include "radeon_reg.h" -#include "rhd_regs.h" // to phase out +#include "avivo.h" #include "r500_reg.h" #include "r600_reg.h" +#include "r700_reg.h" #include "r800_reg.h" #include @@ -168,41 +169,7 @@ struct radeon_free_graphics_memory { // registers #define R6XX_CONFIG_APER_SIZE 0x5430 // r600> #define OLD_CONFIG_APER_SIZE 0x0108 // -#define D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x691c // r700> - -#define D2CRTC_CONTROL 0x6880 -#define D2CRTC_STATUS 0x689c -#define D2CRTC_UPDATE_LOCK 0x68E8 -#define D2GRPH_PRIMARY_SURFACE_ADDRESS 0x6910 -#define D2GRPH_SECONDARY_SURFACE_ADDRESS 0x6918 -#define D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 // r700> -#define D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x611c // r700> - -#define D1VGA_CONTROL 0x0330 -#define DVGA_CONTROL_MODE_ENABLE (1 << 0) -#define DVGA_CONTROL_TIMING_SELECT (1 << 8) -#define DVGA_CONTROL_SYNC_POLARITY_SELECT (1 << 9) -#define DVGA_CONTROL_OVERSCAN_TIMING_SELECT (1 << 10) -#define DVGA_CONTROL_OVERSCAN_COLOR_EN (1 << 16) -#define DVGA_CONTROL_ROTATE (1 << 24) -#define D2VGA_CONTROL 0x0338 - -#define VGA_HDP_CONTROL 0x328 -#define VGA_MEM_PAGE_SELECT_EN (1 << 0) -#define VGA_MEMORY_DISABLE (1 << 4) -#define VGA_RBBM_LOCK_DISABLE (1 << 8) -#define VGA_SOFT_RESET (1 << 16) -#define VGA_MEMORY_BASE_ADDRESS 0x0310 -#define VGA_RENDER_CONTROL 0x0300 -#define VGA_VSTATUS_CNTL_MASK 0x00030000 +#define CONFIG_MEMSIZE 0x5428 // r600> // PCI bridge memory management diff --git a/headers/private/graphics/radeon_hd/rhd_regs.h b/headers/private/graphics/radeon_hd/rhd_regs.h deleted file mode 100644 index 179a9d9419..0000000000 --- a/headers/private/graphics/radeon_hd/rhd_regs.h +++ /dev/null @@ -1,1160 +0,0 @@ -/* - * Copyright 2007, 2008 Luc Verhaegen - * Copyright 2007, 2008 Matthias Hopf - * Copyright 2007, 2008 Egbert Eich - * Copyright 2007, 2008 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -#ifndef _RHD_REGS_H -# define _RHD_REGS_H - -enum { - CLOCK_CNTL_INDEX = 0x8, /* (RW) */ - CLOCK_CNTL_DATA = 0xC, /* (RW) */ - BUS_CNTL = 0x4C, /* (RW) */ - MC_IND_INDEX = 0x70, /* (RW) */ - MC_IND_DATA = 0x74, /* (RW) */ - RS600_MC_INDEX = 0x70, - RS600_MC_DATA = 0x74, - RS690_MC_INDEX = 0x78, - RS690_MC_DATA = 0x7c, - RS780_MC_INDEX = 0x28f8, - RS780_MC_DATA = 0x28fc, - - RS60_MC_NB_MC_INDEX = 0x78, - RS60_MC_NB_MC_DATA = 0x7C, - CONFIG_CNTL = 0xE0, - PCIE_RS69_MC_INDEX = 0xE8, - PCIE_RS69_MC_DATA = 0xEC, - R5XX_CONFIG_MEMSIZE = 0x00F8, - - HDP_FB_LOCATION = 0x0134, - - SEPROM_CNTL1 = 0x1C0, /* (RW) */ - - AGP_BASE = 0x0170, - - GPIOPAD_MASK = 0x198, /* (RW) */ - GPIOPAD_A = 0x19C, /* (RW) */ - GPIOPAD_EN = 0x1A0, /* (RW) */ - VIPH_CONTROL = 0xC40, /* (RW) */ - - ROM_CNTL = 0x1600, - GENERAL_PWRMGT = 0x0618, - LOW_VID_LOWER_GPIO_CNTL = 0x0724, - MEDIUM_VID_LOWER_GPIO_CNTL = 0x0720, - HIGH_VID_LOWER_GPIO_CNTL = 0x071C, - CTXSW_VID_LOWER_GPIO_CNTL = 0x0718, - LOWER_GPIO_ENABLE = 0x0710, - - /* VGA registers */ - VGA_RENDER_CONTROL = 0x0300, - VGA_MODE_CONTROL = 0x0308, - VGA_MEMORY_BASE_ADDRESS = 0x0310, - VGA_HDP_CONTROL = 0x0328, - D1VGA_CONTROL = 0x0330, - D2VGA_CONTROL = 0x0338, - - EXT1_PPLL_REF_DIV_SRC = 0x0400, - EXT1_PPLL_REF_DIV = 0x0404, - EXT1_PPLL_UPDATE_LOCK = 0x0408, - EXT1_PPLL_UPDATE_CNTL = 0x040C, - EXT2_PPLL_REF_DIV_SRC = 0x0410, - EXT2_PPLL_REF_DIV = 0x0414, - EXT2_PPLL_UPDATE_LOCK = 0x0418, - EXT2_PPLL_UPDATE_CNTL = 0x041C, - - EXT1_PPLL_FB_DIV = 0x0430, - EXT2_PPLL_FB_DIV = 0x0434, - EXT1_PPLL_POST_DIV_SRC = 0x0438, - EXT1_PPLL_POST_DIV = 0x043C, - EXT2_PPLL_POST_DIV_SRC = 0x0440, - EXT2_PPLL_POST_DIV = 0x0444, - EXT1_PPLL_CNTL = 0x0448, - EXT2_PPLL_CNTL = 0x044C, - P1PLL_CNTL = 0x0450, - P2PLL_CNTL = 0x0454, - P1PLL_INT_SS_CNTL = 0x0458, - P2PLL_INT_SS_CNTL = 0x045C, - - P1PLL_DISP_CLK_CNTL = 0x0468, /* rv620+ */ - P2PLL_DISP_CLK_CNTL = 0x046C, /* rv620+ */ - EXT1_SYM_PPLL_POST_DIV = 0x0470, /* rv620+ */ - EXT2_SYM_PPLL_POST_DIV = 0x0474, /* rv620+ */ - - PCLK_CRTC1_CNTL = 0x0480, - PCLK_CRTC2_CNTL = 0x0484, - - /* these regs were reverse enginered, - * so the chance is high that the naming is wrong - * R6xx+ ??? */ - AUDIO_PLL1_MUL = 0x0514, - AUDIO_PLL1_DIV = 0x0518, - AUDIO_PLL2_MUL = 0x0524, - AUDIO_PLL2_DIV = 0x0528, - AUDIO_CLK_SRCSEL = 0x0534, - - DCCG_DISP_CLK_SRCSEL = 0x0538, /* rv620+ */ - - AGP_STATUS = 0x0F5C, - - R7XX_MC_VM_FB_LOCATION = 0x2024, - - R6XX_MC_VM_FB_LOCATION = 0x2180, - R6XX_HDP_NONSURFACE_BASE = 0x2C04, - R6XX_CONFIG_MEMSIZE = 0x5428, - R6XX_CONFIG_FB_BASE = 0x542C, /* AKA CONFIG_F0_BASE */ - /* PCI config space */ - PCI_CONFIG_SPACE_BASE = 0x5000, - PCI_CAPABILITIES_PTR = 0x5034, - - /* CRTC1 registers */ - D1CRTC_H_TOTAL = 0x6000, - D1CRTC_H_BLANK_START_END = 0x6004, - D1CRTC_H_SYNC_A = 0x6008, - D1CRTC_H_SYNC_A_CNTL = 0x600C, - D1CRTC_H_SYNC_B = 0x6010, - D1CRTC_H_SYNC_B_CNTL = 0x6014, - - D1CRTC_V_TOTAL = 0x6020, - D1CRTC_V_BLANK_START_END = 0x6024, - D1CRTC_V_SYNC_A = 0x6028, - D1CRTC_V_SYNC_A_CNTL = 0x602C, - D1CRTC_V_SYNC_B = 0x6030, - D1CRTC_V_SYNC_B_CNTL = 0x6034, - - D1CRTC_CONTROL = 0x6080, - D1CRTC_BLANK_CONTROL = 0x6084, - D1CRTC_INTERLACE_CONTROL = 0x6088, - D1CRTC_BLACK_COLOR = 0x6098, - D1CRTC_STATUS = 0x609C, - D1CRTC_COUNT_CONTROL = 0x60B4, - - /* D1GRPH registers */ - D1GRPH_ENABLE = 0x6100, - D1GRPH_CONTROL = 0x6104, - D1GRPH_LUT_SEL = 0x6108, - D1GRPH_SWAP_CNTL = 0x610C, - D1GRPH_PRIMARY_SURFACE_ADDRESS = 0x6110, - D1GRPH_SECONDARY_SURFACE_ADDRESS = 0x6118, - D1GRPH_PITCH = 0x6120, - D1GRPH_SURFACE_OFFSET_X = 0x6124, - D1GRPH_SURFACE_OFFSET_Y = 0x6128, - D1GRPH_X_START = 0x612C, - D1GRPH_Y_START = 0x6130, - D1GRPH_X_END = 0x6134, - D1GRPH_Y_END = 0x6138, - D1GRPH_UPDATE = 0x6144, - - /* LUT */ - DC_LUT_RW_SELECT = 0x6480, - DC_LUT_RW_MODE = 0x6484, - DC_LUT_RW_INDEX = 0x6488, - DC_LUT_SEQ_COLOR = 0x648C, - DC_LUT_PWL_DATA = 0x6490, - DC_LUT_30_COLOR = 0x6494, - DC_LUT_READ_PIPE_SELECT = 0x6498, - DC_LUT_WRITE_EN_MASK = 0x649C, - DC_LUT_AUTOFILL = 0x64A0, - - /* LUTA */ - DC_LUTA_CONTROL = 0x64C0, - DC_LUTA_BLACK_OFFSET_BLUE = 0x64C4, - DC_LUTA_BLACK_OFFSET_GREEN = 0x64C8, - DC_LUTA_BLACK_OFFSET_RED = 0x64CC, - DC_LUTA_WHITE_OFFSET_BLUE = 0x64D0, - DC_LUTA_WHITE_OFFSET_GREEN = 0x64D4, - DC_LUTA_WHITE_OFFSET_RED = 0x64D8, - - /* D1CUR */ - D1CUR_CONTROL = 0x6400, - D1CUR_SURFACE_ADDRESS = 0x6408, - D1CUR_SIZE = 0x6410, - D1CUR_POSITION = 0x6414, - D1CUR_HOT_SPOT = 0x6418, - D1CUR_UPDATE = 0x6424, - - /* D1MODE */ - D1MODE_DESKTOP_HEIGHT = 0x652C, - D1MODE_VLINE_START_END = 0x6538, - D1MODE_VLINE_STATUS = 0x653C, - D1MODE_VIEWPORT_START = 0x6580, - D1MODE_VIEWPORT_SIZE = 0x6584, - D1MODE_EXT_OVERSCAN_LEFT_RIGHT = 0x6588, - D1MODE_EXT_OVERSCAN_TOP_BOTTOM = 0x658C, - D1MODE_DATA_FORMAT = 0x6528, - - /* D1SCL */ - D1SCL_ENABLE = 0x6590, - D1SCL_TAP_CONTROL = 0x6594, - D1MODE_CENTER = 0x659C, /* guess */ - D1SCL_HVSCALE = 0x65A4, /* guess */ - D1SCL_HFILTER = 0x65B0, /* guess */ - D1SCL_VFILTER = 0x65C0, /* guess */ - D1SCL_UPDATE = 0x65CC, - D1SCL_DITHER = 0x65D4, /* guess */ - D1SCL_FLIP_CONTROL = 0x65D8, /* guess */ - - /* CRTC2 registers */ - D2CRTC_H_TOTAL = 0x6800, - D2CRTC_H_BLANK_START_END = 0x6804, - D2CRTC_H_SYNC_A = 0x6808, - D2CRTC_H_SYNC_A_CNTL = 0x680C, - D2CRTC_H_SYNC_B = 0x6810, - D2CRTC_H_SYNC_B_CNTL = 0x6814, - - D2CRTC_V_TOTAL = 0x6820, - D2CRTC_V_BLANK_START_END = 0x6824, - D2CRTC_V_SYNC_A = 0x6828, - D2CRTC_V_SYNC_A_CNTL = 0x682C, - D2CRTC_V_SYNC_B = 0x6830, - D2CRTC_V_SYNC_B_CNTL = 0x6834, - - D2CRTC_CONTROL = 0x6880, - D2CRTC_BLANK_CONTROL = 0x6884, - D2CRTC_BLACK_COLOR = 0x6898, - D2CRTC_INTERLACE_CONTROL = 0x6888, - D2CRTC_STATUS = 0x689C, - D2CRTC_COUNT_CONTROL = 0x68B4, - - /* D2GRPH registers */ - D2GRPH_ENABLE = 0x6900, - D2GRPH_CONTROL = 0x6904, - D2GRPH_LUT_SEL = 0x6908, - D2GRPH_SWAP_CNTL = 0x690C, - D2GRPH_PRIMARY_SURFACE_ADDRESS = 0x6910, - D2GRPH_SECONDARY_SURFACE_ADDRESS = 0x6918, - D2GRPH_PITCH = 0x6920, - D2GRPH_SURFACE_OFFSET_X = 0x6924, - D2GRPH_SURFACE_OFFSET_Y = 0x6928, - D2GRPH_X_START = 0x692C, - D2GRPH_Y_START = 0x6930, - D2GRPH_X_END = 0x6934, - D2GRPH_Y_END = 0x6938, - D2GRPH_UPDATE = 0x6944, - - /* LUTB */ - DC_LUTB_CONTROL = 0x6CC0, - DC_LUTB_BLACK_OFFSET_BLUE = 0x6CC4, - DC_LUTB_BLACK_OFFSET_GREEN = 0x6CC8, - DC_LUTB_BLACK_OFFSET_RED = 0x6CCC, - DC_LUTB_WHITE_OFFSET_BLUE = 0x6CD0, - DC_LUTB_WHITE_OFFSET_GREEN = 0x6CD4, - DC_LUTB_WHITE_OFFSET_RED = 0x6CD8, - - /* D2MODE */ - D2MODE_DESKTOP_HEIGHT = 0x6D2C, - D2MODE_VLINE_START_END = 0x6D38, - D2MODE_VLINE_STATUS = 0x6D3C, - D2MODE_VIEWPORT_START = 0x6D80, - D2MODE_VIEWPORT_SIZE = 0x6D84, - D2MODE_EXT_OVERSCAN_LEFT_RIGHT = 0x6D88, - D2MODE_EXT_OVERSCAN_TOP_BOTTOM = 0x6D8C, - D2MODE_DATA_FORMAT = 0x6D28, - - /* D2SCL */ - D2SCL_ENABLE = 0x6D90, - D2SCL_TAP_CONTROL = 0x6D94, - D2MODE_CENTER = 0x6D9C, /* guess */ - D2SCL_HVSCALE = 0x6DA4, /* guess */ - D2SCL_HFILTER = 0x6DB0, /* guess */ - D2SCL_VFILTER = 0x6DC0, /* guess */ - D2SCL_UPDATE = 0x6DCC, - D2SCL_DITHER = 0x6DD4, /* guess */ - D2SCL_FLIP_CONTROL = 0x6DD8, /* guess */ - - /* Audio, reverse enginered */ - AUDIO_ENABLE = 0x7300, /* RW */ - AUDIO_TIMING = 0x7344, /* RW */ - /* Audio params */ - AUDIO_VENDOR_ID = 0x7380, /* RW */ - AUDIO_REVISION_ID = 0x7384, /* RW */ - AUDIO_ROOT_NODE_COUNT = 0x7388, /* RW */ - AUDIO_NID1_NODE_COUNT = 0x738c, /* RW */ - AUDIO_NID1_TYPE = 0x7390, /* RW */ - AUDIO_SUPPORTED_SIZE_RATE = 0x7394, /* RW */ - AUDIO_SUPPORTED_CODEC = 0x7398, /* RW */ - AUDIO_SUPPORTED_POWER_STATES = 0x739c, /* RW */ - AUDIO_NID2_CAPS = 0x73a0, /* RW */ - AUDIO_NID3_CAPS = 0x73a4, /* RW */ - AUDIO_NID3_PIN_CAPS = 0x73a8, /* RW */ - /* Audio conn list */ - AUDIO_CONN_LIST_LEN = 0x73ac, /* RW */ - AUDIO_CONN_LIST = 0x73b0, /* RW */ - /* Audio verbs */ - AUDIO_RATE_BPS_CHANNEL = 0x73c0, /* RO */ - AUDIO_PLAYING = 0x73c4, /* RO */ - AUDIO_IMPLEMENTATION_ID = 0x73c8, /* RW */ - AUDIO_CONFIG_DEFAULT = 0x73cc, /* RW */ - AUDIO_PIN_SENSE = 0x73d0, /* RW */ - AUDIO_PIN_WIDGET_CNTL = 0x73d4, /* RO */ - AUDIO_STATUS_BITS = 0x73d8, /* RO */ - - R700_AUDIO_UNKNOWN = 0x7604, - - /* HDMI */ - HDMI_TMDS = 0x7400, - HDMI_LVTMA = 0x7700, - HDMI_DIG = 0x7800, - - /* R500 DAC A */ - DACA_ENABLE = 0x7800, - DACA_SOURCE_SELECT = 0x7804, - DACA_SYNC_TRISTATE_CONTROL = 0x7820, - DACA_SYNC_SELECT = 0x7824, - DACA_AUTODETECT_CONTROL = 0x7828, - DACA_AUTODETECT_INT_CONTROL = 0x7838, - DACA_FORCE_OUTPUT_CNTL = 0x783C, - DACA_FORCE_DATA = 0x7840, - DACA_POWERDOWN = 0x7850, - DACA_CONTROL1 = 0x7854, - DACA_CONTROL2 = 0x7858, - DACA_COMPARATOR_ENABLE = 0x785C, - DACA_COMPARATOR_OUTPUT = 0x7860, - -/* TMDSA */ - TMDSA_CNTL = 0x7880, - TMDSA_SOURCE_SELECT = 0x7884, - TMDSA_COLOR_FORMAT = 0x7888, - TMDSA_FORCE_OUTPUT_CNTL = 0x788C, - TMDSA_BIT_DEPTH_CONTROL = 0x7894, - TMDSA_DCBALANCER_CONTROL = 0x78D0, - TMDSA_DATA_SYNCHRONIZATION_R500 = 0x78D8, - TMDSA_DATA_SYNCHRONIZATION_R600 = 0x78DC, - TMDSA_TRANSMITTER_ENABLE = 0x7904, - TMDSA_LOAD_DETECT = 0x7908, - TMDSA_MACRO_CONTROL = 0x790C, /* r5x0 and r600: 3 for pll and 1 for TX */ - TMDSA_PLL_ADJUST = 0x790C, /* rv6x0: pll only */ - TMDSA_TRANSMITTER_CONTROL = 0x7910, - TMDSA_TRANSMITTER_ADJUST = 0x7920, /* rv6x0: TX part of macro control */ - - /* DAC B */ - DACB_ENABLE = 0x7A00, - DACB_SOURCE_SELECT = 0x7A04, - DACB_SYNC_TRISTATE_CONTROL = 0x7A20, - DACB_SYNC_SELECT = 0x7A24, - DACB_AUTODETECT_CONTROL = 0x7A28, - DACB_AUTODETECT_INT_CONTROL = 0x7A38, - DACB_FORCE_OUTPUT_CNTL = 0x7A3C, - DACB_FORCE_DATA = 0x7A40, - DACB_POWERDOWN = 0x7A50, - DACB_CONTROL1 = 0x7A54, - DACB_CONTROL2 = 0x7A58, - DACB_COMPARATOR_ENABLE = 0x7A5C, - DACB_COMPARATOR_OUTPUT = 0x7A60, - - /* LVTMA */ - LVTMA_CNTL = 0x7A80, - LVTMA_SOURCE_SELECT = 0x7A84, - LVTMA_COLOR_FORMAT = 0x7A88, - LVTMA_FORCE_OUTPUT_CNTL = 0x7A8C, - LVTMA_BIT_DEPTH_CONTROL = 0x7A94, - LVTMA_DCBALANCER_CONTROL = 0x7AD0, - - /* no longer shared between both r5xx and r6xx */ - LVTMA_R500_DATA_SYNCHRONIZATION = 0x7AD8, - LVTMA_R500_PWRSEQ_REF_DIV = 0x7AE4, - LVTMA_R500_PWRSEQ_DELAY1 = 0x7AE8, - LVTMA_R500_PWRSEQ_DELAY2 = 0x7AEC, - LVTMA_R500_PWRSEQ_CNTL = 0x7AF0, - LVTMA_R500_PWRSEQ_STATE = 0x7AF4, - LVTMA_R500_BL_MOD_CNTL = 0x7AF8, - LVTMA_R500_LVDS_DATA_CNTL = 0x7AFC, - LVTMA_R500_MODE = 0x7B00, - LVTMA_R500_TRANSMITTER_ENABLE = 0x7B04, - LVTMA_R500_MACRO_CONTROL = 0x7B0C, - LVTMA_R500_TRANSMITTER_CONTROL = 0x7B10, - LVTMA_R500_REG_TEST_OUTPUT = 0x7B14, - - /* R600 adds an undocumented register at 0x7AD8, - * shifting all subsequent registers by exactly one. */ - LVTMA_R600_DATA_SYNCHRONIZATION = 0x7ADC, - LVTMA_R600_PWRSEQ_REF_DIV = 0x7AE8, - LVTMA_R600_PWRSEQ_DELAY1 = 0x7AEC, - LVTMA_R600_PWRSEQ_DELAY2 = 0x7AF0, - LVTMA_R600_PWRSEQ_CNTL = 0x7AF4, - LVTMA_R600_PWRSEQ_STATE = 0x7AF8, - LVTMA_R600_BL_MOD_CNTL = 0x7AFC, - LVTMA_R600_LVDS_DATA_CNTL = 0x7B00, - LVTMA_R600_MODE = 0x7B04, - LVTMA_R600_TRANSMITTER_ENABLE = 0x7B08, - LVTMA_R600_MACRO_CONTROL = 0x7B10, - LVTMA_R600_TRANSMITTER_CONTROL = 0x7B14, - LVTMA_R600_REG_TEST_OUTPUT = 0x7B18, - - LVTMA_TRANSMITTER_ADJUST = 0x7B24, /* RV630 */ - LVTMA_PREEMPHASIS_CONTROL = 0x7B28, /* RV630 */ - - /* I2C in separate enum */ - - /* HPD */ - DC_GPIO_HPD_MASK = 0x7E90, - DC_GPIO_HPD_A = 0x7E94, - DC_GPIO_HPD_EN = 0x7E98, - DC_GPIO_HPD_Y = 0x7E9C -}; - -enum DXSCL_UPDATE_bits { - DXSCL_UPDATE_LOCK = (1 << 16) -}; - -enum CONFIG_CNTL_BITS { - RS69_CFG_ATI_REV_ID_SHIFT = 8, - RS69_CFG_ATI_REV_ID_MASK = 0xF << RS69_CFG_ATI_REV_ID_SHIFT -}; - -enum rv620Regs { - /* DAC common */ - RV620_DAC_COMPARATOR_MISC = 0x7da4, - RV620_DAC_COMPARATOR_OUTPUT = 0x7da8, - - /* RV620 DAC A */ - RV620_DACA_ENABLE = 0x7000, - RV620_DACA_SOURCE_SELECT = 0x7004, - RV620_DACA_SYNC_TRISTATE_CONTROL = 0x7020, - /* RV620_DACA_SYNC_SELECT = 0x7024, ?? */ - RV620_DACA_AUTODETECT_CONTROL = 0x7028, - RV620_DACA_AUTODETECT_STATUS = 0x7034, - RV620_DACA_AUTODETECT_INT_CONTROL = 0x7038, - RV620_DACA_FORCE_OUTPUT_CNTL = 0x703C, - RV620_DACA_FORCE_DATA = 0x7040, - RV620_DACA_POWERDOWN = 0x7050, - /* RV620_DACA_CONTROL1 moved */ - RV620_DACA_CONTROL2 = 0x7058, - RV620_DACA_COMPARATOR_ENABLE = 0x705C, - /* RV620_DACA_COMPARATOR_OUTPUT changed */ - RV620_DACA_BGADJ_SRC = 0x7ef0, - RV620_DACA_MACRO_CNTL = 0x7ef4, - RV620_DACA_AUTO_CALIB_CONTROL = 0x7ef8, - - /* DAC B */ - RV620_DACB_ENABLE = 0x7100, - RV620_DACB_SOURCE_SELECT = 0x7104, - RV620_DACB_SYNC_TRISTATE_CONTROL = 0x7120, - /* RV620_DACB_SYNC_SELECT = 0x7124, ?? */ - RV620_DACB_AUTODETECT_CONTROL = 0x7128, - RV620_DACB_AUTODETECT_STATUS = 0x7134, - RV620_DACB_AUTODETECT_INT_CONTROL = 0x7138, - RV620_DACB_FORCE_OUTPUT_CNTL = 0x713C, - RV620_DACB_FORCE_DATA = 0x7140, - RV620_DACB_POWERDOWN = 0x7150, - /* RV620_DACB_CONTROL1 moved */ - RV620_DACB_CONTROL2 = 0x7158, - RV620_DACB_COMPARATOR_ENABLE = 0x715C, - RV620_DACB_BGADJ_SRC = 0x7ef0, - RV620_DACB_MACRO_CNTL = 0x7ff4, - RV620_DACB_AUTO_CALIB_CONTROL = 0x7ef8, - /* DIG1 */ - RV620_DIG1_CNTL = 0x75A0, - RV620_DIG1_CLOCK_PATTERN = 0x75AC, - RV620_LVDS1_DATA_CNTL = 0x75BC, - RV620_TMDS1_CNTL = 0x75C0, - /* DIG2 */ - RV620_DIG2_CNTL = 0x79A0, - RV620_DIG2_CLOCK_PATTERN = 0x79AC, - RV620_LVDS2_DATA_CNTL = 0x79BC, - RV620_TMDS2_CNTL = 0x79C0, - - /* RV62x I2C */ - RV62_GENERIC_I2C_CONTROL = 0x7d80, /* (RW) */ - RV62_GENERIC_I2C_INTERRUPT_CONTROL = 0x7d84, /* (RW) */ - RV62_GENERIC_I2C_STATUS = 0x7d88, /* (RW) */ - RV62_GENERIC_I2C_SPEED = 0x7d8c, /* (RW) */ - RV62_GENERIC_I2C_SETUP = 0x7d90, /* (RW) */ - RV62_GENERIC_I2C_TRANSACTION = 0x7d94, /* (RW) */ - RV62_GENERIC_I2C_DATA = 0x7d98, /* (RW) */ - RV62_GENERIC_I2C_PIN_SELECTION = 0x7d9c, /* (RW) */ - RV62_DC_GPIO_DDC4_MASK = 0x7e20, /* (RW) */ - RV62_DC_GPIO_DDC1_MASK = 0x7e40, /* (RW) */ - RV62_DC_GPIO_DDC2_MASK = 0x7e50, /* (RW) */ - RV62_DC_GPIO_DDC3_MASK = 0x7e60, /* (RW) */ - - /* ?? */ - RV620_DCIO_LINK_STEER_CNTL = 0x7FA4, - - RV620_LVTMA_TRANSMITTER_CONTROL= 0x7F00, - RV620_LVTMA_TRANSMITTER_ENABLE = 0x7F04, - RV620_LVTMA_TRANSMITTER_ADJUST = 0x7F18, - RV620_LVTMA_PREEMPHASIS_CONTROL= 0x7F1C, - RV620_LVTMA_MACRO_CONTROL = 0x7F0C, - RV620_LVTMA_PWRSEQ_CNTL = 0x7F80, - RV620_LVTMA_PWRSEQ_STATE = 0x7f84, - RV620_LVTMA_PWRSEQ_REF_DIV = 0x7f88, - RV620_LVTMA_PWRSEQ_DELAY1 = 0x7f8C, - RV620_LVTMA_PWRSEQ_DELAY2 = 0x7f90, - RV620_LVTMA_BL_MOD_CNTL = 0x7F94, - RV620_LVTMA_DATA_SYNCHRONIZATION = 0x7F98, - RV620_FMT1_CONTROL = 0x6700, - RV620_FMT1_BIT_DEPTH_CONTROL= 0x6710, - RV620_FMT1_CLAMP_CNTL = 0x672C, - RV620_FMT2_CONTROL = 0x6F00, - RV620_FMT2_CNTL = 0x6F10, - RV620_FMT2_CLAMP_CNTL = 0x6F2C, - - RV620_EXT1_DIFF_POST_DIV_CNTL= 0x0420, - RV620_EXT2_DIFF_POST_DIV_CNTL= 0x0424, - RV620_DCCG_PCLK_DIGA_CNTL = 0x04b0, - RV620_DCCG_PCLK_DIGB_CNTL = 0x04b4, - RV620_DCCG_SYMCLK_CNTL = 0x04b8 -}; - -enum RV620_EXT1_DIFF_POST_DIV_CNTL_BITS { - RV62_EXT1_DIFF_POST_DIV_RESET = 1 << 0, - RV62_EXT1_DIFF_POST_DIV_SELECT = 1 << 4, - RV62_EXT1_DIFF_DRIVER_ENABLE = 1 << 8 -}; - -enum RV620_EXT2_DIFF_POST_DIV_CNTL_BITS { - RV62_EXT2_DIFF_POST_DIV_RESET = 1 << 0, - RV62_EXT2_DIFF_POST_DIV_SELECT = 1 << 4, - RV62_EXT2_DIFF_DRIVER_ENABLE = 3 << 8 -}; - -enum RV620_LVTMA_PWRSEQ_CNTL_BITS { - RV62_LVTMA_PWRSEQ_EN = 1 << 0, - RV62_LVTMA_PWRSEQ_DISABLE_SYNCEN_CONTROL_OF_TX_EN = 1 << 1, - RV62_LVTMA_PLL_ENABLE_PWRSEQ_MASK = 1 << 2, - RV62_LVTMA_PLL_RESET_PWRSEQ_MASK = 1 << 3, - RV62_LVTMA_PWRSEQ_TARGET_STATE = 1 << 4, - RV62_LVTMA_SYNCEN = 1 << 8, - RV62_LVTMA_SYNCEN_OVRD = 1 << 9, - RV62_LVTMA_SYNCEN_POL = 1 << 10, - RV62_LVTMA_DIGON = 1 << 16, - RV62_LVTMA_DIGON_OVRD = 1 << 17, - RV62_LVTMA_DIGON_POL = 1 << 18, - RV62_LVTMA_BLON = 1 << 24, - RV62_LVTMA_BLON_OVRD = 1 << 25, - RV62_LVTMA_BLON_POL = 1 << 26 -}; - -enum RV620_LVTMA_PWRSEQ_STATE_BITS { - RV62_LVTMA_PWRSEQ_STATE_SHIFT = 8 -}; - -enum RV620_LVTMA_PWRSEQ_STATE_VAL { - RV62_POWERUP_DONE = 4, - RV62_POWERDOWN_DONE = 9 -}; - -enum RV620_LVTMA_TRANSMITTER_CONTROL_BITS { - RV62_LVTMA_PLL_ENABLE = 1 << 0, - RV62_LVTMA_PLL_RESET = 1 << 1, - RV62_LVTMA_IDSCKSEL = 1 << 4, - RV62_LVTMA_BGSLEEP = 1 << 5, - RV62_LVTMA_IDCLK_SEL = 1 << 6, - RV62_LVTMA_TMCLK = 1 << 8, - RV62_LVTMA_TMCLK_FROM_PADS = 1 << 13, - RV62_LVTMA_TDCLK = 1 << 14, - RV62_LVTMA_TDCLK_FROM_PADS = 1 << 15, - RV62_LVTMA_BYPASS_PLL = 1 << 28, - RV62_LVTMA_USE_CLK_DATA = 1 << 29, - RV62_LVTMA_MODE = 1 << 30, - RV62_LVTMA_INPUT_TEST_CLK_SEL = 1 << 31 -}; - -enum RV620_DCCG_SYMCLK_CNTL { - RV62_SYMCLKA_SRC_SHIFT = 8, - RV62_SYMCLKB_SRC_SHIFT = 12 -}; - -enum RV620_DCCG_DIG_CNTL { - RV62_PCLK_DIGA_ON = 0x1 -}; - -enum RV620_DCIO_LINK_STEER_CNTL { - RV62_LINK_STEER_SWAP = 1 << 0, - RV62_LINK_STEER_PLLSEL_OVERWRITE_EN = 1 << 16, - RV62_LINK_STEER_PLLSELA = 1 << 17, - RV62_LINK_STEER_PLLSELB = 1 << 18 -}; - -enum R620_LVTMA_TRANSMITTER_ENABLE_BITS { - RV62_LVTMA_LNK0EN = 1 << 0, - RV62_LVTMA_LNK1EN = 1 << 1, - RV62_LVTMA_LNK2EN = 1 << 2, - RV62_LVTMA_LNK3EN = 1 << 3, - RV62_LVTMA_LNK4EN = 1 << 4, - RV62_LVTMA_LNK5EN = 1 << 5, - RV62_LVTMA_LNK6EN = 1 << 6, - RV62_LVTMA_LNK7EN = 1 << 7, - RV62_LVTMA_LNK8EN = 1 << 8, - RV62_LVTMA_LNK9EN = 1 << 9, - RV62_LVTMA_LNKL = RV62_LVTMA_LNK0EN | RV62_LVTMA_LNK1EN - | RV62_LVTMA_LNK2EN | RV62_LVTMA_LNK3EN, - RV62_LVTMA_LNKU = RV62_LVTMA_LNK4EN | RV62_LVTMA_LNK5EN - | RV62_LVTMA_LNK6EN | RV62_LVTMA_LNK7EN, - RV62_LVTMA_LNK_ALL = RV62_LVTMA_LNKL | RV62_LVTMA_LNKU - | RV62_LVTMA_LNK8EN | RV62_LVTMA_LNK9EN, - RV62_LVTMA_LNKEN_HPD_MASK = 1 << 16 -}; - -enum RV620_LVTMA_DATA_SYNCHRONIZATION { - RV62_LVTMA_DSYNSEL = (1 << 0), - RV62_LVTMA_PFREQCHG = (1 << 8) -}; - -enum RV620_LVTMA_PWRSEQ_REF_DIV_BITS { - LVTMA_PWRSEQ_REF_DI_SHIFT = 0, - LVTMA_BL_MOD_REF_DI_SHIFT = 16 -}; - -enum RV620_LVTMA_BL_MOD_CNTL_BITS { - LVTMA_BL_MOD_EN = 1 << 0, - LVTMA_BL_MOD_LEVEL_SHIFT = 8, - LVTMA_BL_MOD_RES_SHIFT = 16 -}; - -enum RV620_DIG_CNTL_BITS { - /* 0x75A0 */ - RV62_DIG_SWAP = (0x1 << 16), - RV62_DIG_DUAL_LINK_ENABLE = (0x1 << 12), - RV62_DIG_START = (0x1 << 6), - RV62_DIG_MODE = (0x7 << 8), - RV62_DIG_STEREOSYNC_SELECT = (1 << 2), - RV62_DIG_SOURCE_SELECT = (1 << 0), - RV62_DIG_SOURCE_SELECT_FMT1 = (0 << 0), - RV62_DIG_SOURCE_SELECT_FMT2 = (1 << 0) -}; - -enum RV620_DIG_LVDS_DATA_CNTL_BITS { - /* 0x75BC */ - RV62_LVDS_24BIT_ENABLE = (0x1 << 0), - RV62_LVDS_24BIT_FORMAT = (0x1 << 4) -}; - -enum RV620_TMDS_CNTL_BITS { - /* 0x75C0 */ - RV62_TMDS_PIXEL_ENCODING = (0x1 << 4), - RV62_TMDS_COLOR_FORMAT = (0x3 << 8) -}; - -enum RV620_FMT_BIT_DEPTH_CONTROL { - RV62_FMT_TRUNCATE_EN = 1 << 0, - RV62_FMT_TRUNCATE_DEPTH = 1 << 4, - RV62_FMT_SPATIAL_DITHER_EN = 1 << 8, - RV62_FMT_SPATIAL_DITHER_MODE = 1 << 9, - RV62_FMT_SPATIAL_DITHER_DEPTH = 1 << 12, - RV62_FMT_FRAME_RANDOM_ENABLE = 1 << 13, - RV62_FMT_RGB_RANDOM_ENABLE = 1 << 14, - RV62_FMT_HIGHPASS_RANDOM_ENABLE = 1 << 15, - RV62_FMT_TEMPORAL_DITHER_EN = 1 << 16, - RV62_FMT_TEMPORAL_DITHER_DEPTH = 1 << 20, - RV62_FMT_TEMPORAL_DITHER_OFFSET = 3 << 21, - RV62_FMT_TEMPORAL_LEVEL = 1 << 24, - RV62_FMT_TEMPORAL_DITHER_RESET = 1 << 25, - RV62_FMT_25FRC_SEL = 3 << 26, - RV62_FMT_50FRC_SEL = 3 << 28, - RV62_FMT_75FRC_SEL = 3 << 30 -}; - -enum RV620_FMT_CONTROL { - RV62_FMT_PIXEL_ENCODING = 1 << 16 -}; - -enum _r5xxMCRegs { - R5XX_MC_STATUS = 0x0000, - RV515_MC_FB_LOCATION = 0x0001, - R5XX_MC_FB_LOCATION = 0x0004, - RV515_MC_STATUS = 0x0008, - RV515_MC_MISC_LAT_TIMER = 0x0009 -}; - -enum _r5xxRegs { - /* I2C */ - R5_DC_I2C_STATUS1 = 0x7D30, /* (RW) */ - R5_DC_I2C_RESET = 0x7D34, /* (RW) */ - R5_DC_I2C_CONTROL1 = 0x7D38, /* (RW) */ - R5_DC_I2C_CONTROL2 = 0x7D3C, /* (RW) */ - R5_DC_I2C_CONTROL3 = 0x7D40, /* (RW) */ - R5_DC_I2C_DATA = 0x7D44, /* (RW) */ - R5_DC_I2C_INTERRUPT_CONTROL = 0x7D48, /* (RW) */ - R5_DC_I2C_ARBITRATION = 0x7D50, /* (RW) */ - - R5_DC_GPIO_DDC1_MASK = 0x7E40, /* (RW) */ - R5_DC_GPIO_DDC1_A = 0x7E44, /* (RW) */ - R5_DC_GPIO_DDC1_EN = 0x7E48, /* (RW) */ - R5_DC_GPIO_DDC2_MASK = 0x7E50, /* (RW) */ - R5_DC_GPIO_DDC2_A = 0x7E54, /* (RW) */ - R5_DC_GPIO_DDC2_EN = 0x7E58, /* (RW) */ - R5_DC_GPIO_DDC3_MASK = 0x7E60, /* (RW) */ - R5_DC_GPIO_DDC3_A = 0x7E64, /* (RW) */ - R5_DC_GPIO_DDC3_EN = 0x7E68 /* (RW) */ -}; - -enum _r5xxSPLLRegs { - SPLL_FUNC_CNTL = 0x0 /* (RW) */ -}; - -enum _r6xxRegs { - /* MCLK */ - R6_MCLK_PWRMGT_CNTL = 0x620, - /* I2C */ - R6_DC_I2C_CONTROL = 0x7D30, /* (RW) */ - R6_DC_I2C_ARBITRATION = 0x7D34, /* (RW) */ - R6_DC_I2C_INTERRUPT_CONTROL = 0x7D38, /* (RW) */ - R6_DC_I2C_SW_STATUS = 0x7d3c, /* (RW) */ - R6_DC_I2C_DDC1_SPEED = 0x7D4C, /* (RW) */ - R6_DC_I2C_DDC1_SETUP = 0x7D50, /* (RW) */ - R6_DC_I2C_DDC2_SPEED = 0x7D54, /* (RW) */ - R6_DC_I2C_DDC2_SETUP = 0x7D58, /* (RW) */ - R6_DC_I2C_DDC3_SPEED = 0x7D5C, /* (RW) */ - R6_DC_I2C_DDC3_SETUP = 0x7D60, /* (RW) */ - R6_DC_I2C_TRANSACTION0 = 0x7D64, /* (RW) */ - R6_DC_I2C_TRANSACTION1 = 0x7D68, /* (RW) */ - R6_DC_I2C_DATA = 0x7D74, /* (RW) */ - R6_DC_I2C_DDC4_SPEED = 0x7DB4, /* (RW) */ - R6_DC_I2C_DDC4_SETUP = 0x7DBC, /* (RW) */ - R6_DC_GPIO_DDC4_MASK = 0x7E00, /* (RW) */ - R6_DC_GPIO_DDC4_A = 0x7E04, /* (RW) */ - R6_DC_GPIO_DDC4_EN = 0x7E08, /* (RW) */ - R6_DC_GPIO_DDC1_MASK = 0x7E40, /* (RW) */ - R6_DC_GPIO_DDC1_A = 0x7E44, /* (RW) */ - R6_DC_GPIO_DDC1_EN = 0x7E48, /* (RW) */ - R6_DC_GPIO_DDC1_Y = 0x7E4C, /* (RW) */ - R6_DC_GPIO_DDC2_MASK = 0x7E50, /* (RW) */ - R6_DC_GPIO_DDC2_A = 0x7E54, /* (RW) */ - R6_DC_GPIO_DDC2_EN = 0x7E58, /* (RW) */ - R6_DC_GPIO_DDC2_Y = 0x7E5C, /* (RW) */ - R6_DC_GPIO_DDC3_MASK = 0x7E60, /* (RW) */ - R6_DC_GPIO_DDC3_A = 0x7E64, /* (RW) */ - R6_DC_GPIO_DDC3_EN = 0x7E68, /* (RW) */ - R6_DC_GPIO_DDC3_Y = 0x7E6C /* (RW) */ -}; - -enum R6_MCLK_PWRMGT_CNTL { - R6_MC_BUSY = (1 << 5) -}; - - -/* *_Q: questionbable */ -enum _rs69xRegs { - /* I2C */ - RS69_DC_I2C_CONTROL = 0x7D30, /* (RW) *//* */ - RS69_DC_I2C_UNKNOWN_2 = 0x7D34, /* (RW) */ - RS69_DC_I2C_INTERRUPT_CONTROL = 0x7D38, /* (RW) */ - RS69_DC_I2C_SW_STATUS = 0x7d3c, /* (RW) *//**/ - RS69_DC_I2C_UNKNOWN_1 = 0x7d40, - RS69_DC_I2C_DDC_SETUP_Q = 0x7D44, /* (RW) */ - RS69_DC_I2C_DATA = 0x7D58, /* (RW) *//**/ - RS69_DC_I2C_TRANSACTION0 = 0x7D48, /* (RW) *//**/ - RS69_DC_I2C_TRANSACTION1 = 0x7D4C, /* (RW) *//**/ - /* DDIA */ - RS69_DDIA_CNTL = 0x7200, - RS69_DDIA_SOURCE_SELECT = 0x7204, - RS69_DDIA_BIT_DEPTH_CONTROL = 0x7214, - RS69_DDIA_DCBALANCER_CONTROL = 0x7250, - RS69_DDIA_PATH_CONTROL = 0x7264, - RS69_DDIA_PCIE_LINK_CONTROL2 = 0x7278, - RS69_DDIA_PCIE_LINK_CONTROL3 = 0x727c, - RS69_DDIA_PCIE_PHY_CONTROL1 = 0x728c, - RS69_DDIA_PCIE_PHY_CONTROL2 = 0x7290 -}; - -enum RS69_DDIA_CNTL_BITS { - RS69_DDIA_ENABLE = 1 << 0, - RS69_DDIA_HDMI_EN = 1 << 2, - RS69_DDIA_ENABLE_HPD_MASK = 1 << 4, - RS69_DDIA_HPD_SELECT = 1 << 8, - RS69_DDIA_SYNC_PHASE = 1 << 12, - RS69_DDIA_PIXEL_ENCODING = 1 << 16, - RS69_DDIA_DUAL_LINK_ENABLE = 1 << 24, - RS69_DDIA_SWAP = 1 << 28 -}; - -enum RS69_DDIA_SOURCE_SELECT_BITS { - RS69_DDIA_SOURCE_SELECT_BIT = 1 << 0, - RS69_DDIA_SYNC_SELECT = 1 << 8, - RS69_DDIA_STEREOSYNC_SELECT = 1 << 16 -}; - -enum RS69_DDIA_LINK_CONTROL2_SHIFT { - RS69_DDIA_PCIE_OUTPUT_MUX_SEL0 = 0, - RS69_DDIA_PCIE_OUTPUT_MUX_SEL1 = 4, - RS69_DDIA_PCIE_OUTPUT_MUX_SEL2 = 8, - RS69_DDIA_PCIE_OUTPUT_MUX_SEL3 = 12 -}; - -enum RS69_DDIA_BIT_DEPTH_CONTROL_BITS { - RS69_DDIA_TRUNCATE_EN = 1 << 0, - RS69_DDIA_TRUNCATE_DEPTH = 1 << 4, - RS69_DDIA_SPATIAL_DITHER_EN = 1 << 8, - RS69_DDIA_SPATIAL_DITHER_DEPTH = 1 << 12, - RS69_DDIA_TEMPORAL_DITHER_EN = 1 << 16, - RS69_DDIA_TEMPORAL_DITHER_DEPTH = 1 << 20, - RS69_DDIA_TEMPORAL_LEVEL = 1 << 24, - RS69_DDIA_TEMPORAL_DITHER_RESET = 1 << 25 -}; - -enum RS69_DDIA_DCBALANCER_CONTROL_BITS { - RS69_DDIA_DCBALANCER_EN = 1 << 0, - RS69_DDIA_SYNC_DCBAL_EN_SHIFT = 4, - RS69_DDIA_SYNC_DCBAL_EN_MASK = 7 << RS69_DDIA_SYNC_DCBAL_EN_SHIFT, - RS69_DDIA_DCBALANCER_TEST_EN = 1 << 8, - RS69_DDIA_DCBALANCER_TEST_IN_SHIFT = 16, - RS69_DDIA_DCBALANCER_FORCE = 1 << 24 -}; - -enum RS69_DDIA_PATH_CONTROL_BITS { - RS69_DDIA_PATH_SELECT_SHIFT = 0, - RS69_DDIA_DDPII_DE_ALIGN_EN = 1 << 4, - RS69_DDIA_DDPII_TRAIN_EN = 1 << 8, - RS69_DDIA_DDPII_TRAIN_SELECT = 1 << 12, - RS69_DDIA_DDPII_SCRAMBLE_EN = 1 << 16, - RS69_DDIA_REPL_MODE_SELECT = 1 << 20, - RS69_DDIA_RB_30b_SWAP_EN = 1 << 24, - RS69_DDIA_PIXVLD_RESET = 1 << 28, - RS69_DDIA_REARRANGER_EN = 1 << 30 -}; - -enum RS69_DDIA_PCIE_LINK_CONTROL3_BITS { - RS69_DDIA_PCIE_MIRROR_EN = 1 << 0, - RS69_DDIA_PCIE_CFGDUALLINK = 1 << 4, - RS69_DDIA_PCIE_NCHG3EN = 1 << 8, - RS69_DDIA_PCIE_RX_PDNB_SHIFT = 12 -}; - -enum RS69_MC_INDEX_BITS { - PCIE_RS69_MC_IND_ADDR = (0x1 << 0), - PCIE_RS69_MC_IND_WR_EN = (0x1 << 9) -}; - -enum RS60_MC_NB_MC_INDEX_BITS { - RS60_NB_MC_IND_ADDR = (0x1 << 0), - RS60_NB_MC_IND_WR_EN = (0x1 << 8) -}; - -enum _rs690MCRegs { - RS69_K8_FB_LOCATION = 0x1E, - RS69_MC_MISC_UMA_CNTL = 0x5f, - RS69_MC_SYSTEM_STATUS = 0x90, /* (RW) */ - RS69_MCCFG_FB_LOCATION = 0x100, - RS69MCCFG_AGP_LOCATION = 0x101, - RS69_MC_INIT_MISC_LAT_TIMER = 0x104 -}; - -enum MC_MISC_LAT_TIMER_BITS { - MC_CPR_INIT_LAT_SHIFT = 0, - MC_VF_INIT_LAT = 4, - MC_DISP0R_INIT_LAT_SHIFT = 8, - MC_DISP1R_INIT_LAT_SHIFT = 12, - MC_FIXED_INIT_LAT_SHIFT = 16, - MC_E2R_INIT_LAT_SHIFT = 20, - SAME_PAGE_PRIO_SHIFT = 24, - MC_GLOBW_INIT_LAT_SHIFT = 28 -}; - -enum RS69_MC_MISC_UMA_CNTL_BITS { - RS69_K8_40BIT_ADDR_EXTENSION = (0x1 << 0), - RS69_GART_BYPASS = (0x1 << 8), - RS69_GFX_64BYTE_MODE = (0x1 << 9), - RS69_GFX_64BYTE_LAT = (0x1 << 10), - RS69_GTW_COHERENCY = (0x1 << 15), - RS69_READ_BUFFER_SIZE = (0x1 << 16), - RS69_HDR_ROUTE_TO_DSP = (0x1 << 24), - RS69_GTW_ROUTE_TO_DSP = (0x1 << 25), - RS69_DSP_ROUTE_TO_GFX = (0x1 << 26), - RS69_USE_HDPW_LAT_INIT = (0x1 << 27), - RS69_USE_GFXW_LAT_INIT = (0x1 << 28), - RS69_MCIFR_COHERENT = (0x1 << 29), - RS69_NON_SNOOP_AZR_AIC_BP = (0x1 << 30), - RS69_SIDE_PORT_PRESENT_R = (0x1 << 31) -}; - -enum _rs600MCRegs { - RS60_MC_SYSTEM_STATUS = 0x0, - RS60_NB_FB_LOCATION = 0xa -}; - -enum RS600_MC_INDEX_BITS { - RS600_MC_INDEX_ADDR_MASK = 0xffff, - RS600_MC_INDEX_SEQ_RBS_0 = (1 << 16), - RS600_MC_INDEX_SEQ_RBS_1 = (1 << 17), - RS600_MC_INDEX_SEQ_RBS_2 = (1 << 18), - RS600_MC_INDEX_SEQ_RBS_3 = (1 << 19), - RS600_MC_INDEX_AIC_RBS = (1 << 20), - RS600_MC_INDEX_CITF_ARB0 = (1 << 21), - RS600_MC_INDEX_CITF_ARB1 = (1 << 22), - RS600_MC_INDEX_WR_EN = (1 << 23) -}; - -enum RS690_MC_INDEX_BITS { - RS690_MC_INDEX_ADDR_MASK = 0x1ff, - RS690_MC_INDEX_WR_EN = (1 << 9), - RS690_MC_INDEX_WR_ACK = 0x7f -}; - -enum RS780_MC_INDEX_BITS { - RS780_MC_INDEX_ADDR_MASK = 0x1ff, - RS780_MC_INDEX_WR_EN = (1 << 9) -}; - -enum _rs780NBRegs { - PCIE_RS78_NB_MC_IND_INDEX = 0x70, - PCIE_RS78_NB_MC_IND_DATA = 0x74 -}; - -enum RS78_NB_IND_INDEX_BITS { - PCIE_RS78_NB_MC_IND_INDEX_MASK = (0xffff << 0), - PCIE_RS78_MC_IND_SEQ_RBS_0 = (0x1 << 16), - PCIE_RS78_MC_IND_SEQ_RBS_1 = (0x1 << 17), - PCIE_RS78_MC_IND_SEQ_RBS_2 = (0x1 << 18), - PCIE_RS78_MC_IND_SEQ_RBS_3 = (0x1 << 19), - PCIE_RS78_MC_IND_AIC_RBS = (0x1 << 20), - PCIE_RS78_MC_IND_CITF_ARB0 = (0x1 << 21), - PCIE_RS78_MC_IND_CITF_ARB1 = (0x1 << 22), - PCIE_RS78_MC_IND_WR_EN = (0x1 << 23), - PCIE_RS78_MC_IND_RD_INV = (0x1 << 24) -}; - -enum _rs780MCRegs { - RS78_MC_SYSTEM_STATUS = 0x0, - RS78_MC_FB_LOCATION = 0x10, - RS78_K8_FB_LOCATION = 0x11, - RS78_MC_MISC_UMA_CNTL = 0x12 -}; - -enum RS6X_MC_SYSTEM_STATUS_BITS { - RS6X_MC_SYSTEM_IDLE = (0x1 << 0), - RS6X_MC_SEQUENCER_IDLE = (0x1 << 1), - RS6X_MC_ARBITER_IDLE = (0x1 << 2), - RS6X_MC_SELECT_PM = (0x1 << 3), - RS6X_RESERVED4 = (0xf << 4), - RS6X_RESERVED8 = (0xf << 8), - RS6X_RESERVED12_SYSTEM_STATUS = (0xf << 12), - RS6X_MCA_INIT_EXECUTED = (0x1 << 16), - RS6X_MCA_IDLE = (0x1 << 17), - RS6X_MCA_SEQ_IDLE = (0x1 << 18), - RS6X_MCA_ARB_IDLE = (0x1 << 19), - RS6X_RESERVED20_SYSTEM_STATUS = (0xfff << 20) -}; - -enum RS78_MC_MISC_UMA_CNTL_BITS { - RS78_K8_40BIT_ADDR_EXTENSION = ( 0x1 << 0), - RS78_BANKGROUP_SEL = ( 0x1 << 8), - RS78_CNTL_SPARE = ( 0x1 << 15), - RS78_SIDE_PORT_PRESENT_R = ( 0x1 << 31) -}; - -enum R5XX_MC_STATUS_BITS { - R5XX_MEM_PWRUP_COMPL = (0x1 << 0), - R5XX_MC_IDLE = (0x1 << 1) -}; - -enum RV515_MC_STATUS_BITS { - RV515_MC_IDLE = (0x1 << 4) -}; - -enum RS78_MC_SYSTEM_STATUS_BITS { - RS78_MC_SYSTEM_IDLE = 1 << 0, - RS78_MC_SEQUENCER_IDLE = 1 << 1, - RS78_MC_ARBITER_IDLE = 1 << 2, - RS78_MC_SELECT_PM = 1 << 3, - RS78_MC_STATUS_15_4_SHIFT = 4, - RS78_MCA_INIT_EXECUTED = 1 << 16, - RS78_MCA_IDLE = 1 << 17, - RS78_MCA_SEQ_IDLE = 1 << 18, - RS78_MCA_ARB_IDLE = 1 << 19, - RS78_MC_STATUS_31_20_SHIFT = 20 -}; - -enum BUS_CNTL_BITS { - /* BUS_CNTL */ - BUS_DBL_RESYNC = (0x1 << 0), - BIOS_ROM_WRT_EN = (0x1 << 1), - BIOS_ROM_DIS = (0x1 << 2), - PMI_IO_DIS = (0x1 << 3), - PMI_MEM_DIS = (0x1 << 4), - PMI_BM_DIS = (0x1 << 5), - PMI_INT_DIS = (0x1 << 6) -}; - -enum SEPROM_SNTL1_BITS { - /* SEPROM_CNTL1 */ - WRITE_ENABLE = (0x1 << 0), - WRITE_DISABLE = (0x1 << 1), - READ_CONFIG = (0x1 << 2), - WRITE_CONFIG = (0x1 << 3), - READ_STATUS = (0x1 << 4), - SECT_TO_SRAM = (0x1 << 5), - READY_BUSY = (0x1 << 7), - SEPROM_BUSY = (0x1 << 8), - BCNT_OVER_WTE_EN = (0x1 << 9), - RB_MASKB = (0x1 << 10), - SOFT_RESET = (0x1 << 11), - STATE_IDLEb = (0x1 << 12), - SECTOR_ERASE = (0x1 << 13), - BYTE_CNT = (0xff << 16), - SCK_PRESCALE = (0xff << 24) -}; - -enum VIPH_CONTROL_BITS { - /* VIPH_CONTROL */ - VIPH_CLK_SEL = (0xff << 0), - VIPH_REG_RDY = (0x1 << 13), - VIPH_MAX_WAIT = (0xf << 16), - VIPH_DMA_MODE = (0x1 << 20), - VIPH_EN = (0x1 << 21), - VIPH_DV0_WID = (0x1 << 24), - VIPH_DV1_WID = (0x1 << 25), - VIPH_DV2_WID = (0x1 << 26), - VIPH_DV3_WID = (0x1 << 27), - VIPH_PWR_DOWN = (0x1 << 28), - VIPH_PWR_DOWN_AK = (0x1 << 28), - VIPH_VIPCLK_DIS = (0x1 << 29) -}; - -enum ROM_CNTL_BITS { - SCK_OVERWRITE = 1 << 1, - CLOCK_GATING_EN = 1 << 2, - CSB_ACTIVE_TO_SCK_SETUP_TIME_SHIFT = 8, - CSB_ACTIVE_TO_SCK_HOLD_TIME_SHIFT = 16, - SCK_PRESCALE_REFCLK_SHIFT = 24, - SCK_PRESCALE_CRYSTAL_CLK_SHIFT = 28 -}; - -enum GENERAL_PWRMGT_BITS { - GLOBAL_PWRMGT_EN = 1 << 0, - STATIC_PM_EN = 1 << 1, - MOBILE_SU = 1 << 2, - THERMAL_PROTECTION_DIS = 1 << 3, - THERMAL_PROTECTION_TYPE = 1 << 4, - ENABLE_GEN2PCIE = 1 << 5, - SW_GPIO_INDEX_SHIFT = 1 << 6, - LOW_VOLT_D2_ACPI = 1 << 8, - LOW_VOLT_D3_ACPI = 1 << 9, - VOLT_PWRMGT_EN = 1 << 10, - OPEN_DRAIN_PADS = 1 << 11, - AVP_SCLK_EN = 1 << 12, - IDCT_SCLK_EN = 1 << 13, - GPU_COUNTER_ACPI = 1 << 14, - GPU_COUNTER_CLK = 1 << 15, - BACKBIAS_PAD_EN = 1 << 16, - BACKBIAS_VALUE = 1 << 17, - BACKBIAS_DPM_CNTL = 1 << 18, - SPREAD_SPECTRUM_INDEX_SHIFT = 19, - DYN_SPREAD_SPECTRUM_EN = 1 << 2 -}; - -enum VGA_RENDER_CONTROL_BITS { - /* VGA_RENDER_CONTROL */ - VGA_BLINK_RATE = (0x1f << 0), - VGA_BLINK_MODE = (0x3 << 5), - VGA_CURSOR_BLINK_INVERT = (0x1 << 7), - VGA_EXTD_ADDR_COUNT_ENABLE = (0x1 << 8), - VGA_VSTATUS_CNTL = (0x3 << 16), - VGA_LOCK_8DOT = (0x1 << 24), - VGAREG_LINECMP_COMPATIBILITY_SEL = (0x1 << 25) -}; - -enum D1VGA_CONTROL_BITS { - /* D1VGA_CONTROL */ - D1VGA_MODE_ENABLE = (0x1 << 0), - D1VGA_TIMING_SELECT = (0x1 << 8), - D1VGA_SYNC_POLARITY_SELECT = (0x1 << 9), - D1VGA_OVERSCAN_TIMING_SELECT = (0x1 << 10), - D1VGA_OVERSCAN_COLOR_EN = (0x1 << 16), - D1VGA_ROTATE = (0x3 << 24) -}; - -enum D2VGA_CONTROL_BITS { - /* D2VGA_CONTROL */ - D2VGA_MODE_ENABLE = (0x1 << 0), - D2VGA_TIMING_SELECT = (0x1 << 8), - D2VGA_SYNC_POLARITY_SELECT = (0x1 << 9), - D2VGA_OVERSCAN_TIMING_SELECT = (0x1 << 10), - D2VGA_OVERSCAN_COLOR_EN = (0x1 << 16), - D2VGA_ROTATE = (0x3 << 24) -}; - -enum { - /* CLOCK_CNTL_INDEX */ - PLL_ADDR = (0x3f << 0), - PLL_WR_EN = (0x1 << 7), - PPLL_DIV_SEL = (0x3 << 8), - - /* CLOCK_CNTL_DATA */ -#define PLL_DATA 0xffffffff - - /* SPLL_FUNC_CNTL */ - SPLL_CHG_STATUS = (0x1 << 29), - SPLL_BYPASS_EN = (0x1 << 25), - - /* MC_IND_INDEX */ - MC_IND_ADDR = (0xffff << 0), - MC_IND_SEQ_RBS_0 = (0x1 << 16), - MC_IND_SEQ_RBS_1 = (0x1 << 17), - MC_IND_SEQ_RBS_2 = (0x1 << 18), - MC_IND_SEQ_RBS_3 = (0x1 << 19), - MC_IND_AIC_RBS = (0x1 << 20), - MC_IND_CITF_ARB0 = (0x1 << 21), - MC_IND_CITF_ARB1 = (0x1 << 22), - MC_IND_WR_EN = (0x1 << 23), - MC_IND_RD_INV = (0x1 << 24) -#define MC_IND_ALL (MC_IND_SEQ_RBS_0 | MC_IND_SEQ_RBS_1 \ - | MC_IND_SEQ_RBS_2 | MC_IND_SEQ_RBS_3 \ - | MC_IND_AIC_RBS | MC_IND_CITF_ARB0 | MC_IND_CITF_ARB1) - - /* MC_IND_DATA */ -#define MC_IND_DATA_BIT 0xffffffff -}; - -enum AGP_STATUS_BITS { - AGP_1X_MODE = 0x01, - AGP_2X_MODE = 0x02, - AGP_4X_MODE = 0x04, - AGP_FW_MODE = 0x10, - AGP_MODE_MASK = 0x17, - AGPv3_MODE = 0x08, - AGPv3_4X_MODE = 0x01, - AGPv3_8X_MODE = 0x02 -}; - -enum { - /* HDMI registers */ - HDMI_ENABLE = 0x00, - HDMI_STATUS = 0x04, - HDMI_CNTL = 0x08, - HDMI_UNKNOWN_0 = 0x0C, - HDMI_AUDIOCNTL = 0x10, - HDMI_VIDEOCNTL = 0x14, - HDMI_VERSION = 0x18, - HDMI_UNKNOWN_1 = 0x28, - HDMI_VIDEOINFOFRAME_0 = 0x54, - HDMI_VIDEOINFOFRAME_1 = 0x58, - HDMI_VIDEOINFOFRAME_2 = 0x5c, - HDMI_VIDEOINFOFRAME_3 = 0x60, - HDMI_32kHz_CTS = 0xac, - HDMI_32kHz_N = 0xb0, - HDMI_44_1kHz_CTS = 0xb4, - HDMI_44_1kHz_N = 0xb8, - HDMI_48kHz_CTS = 0xbc, - HDMI_48kHz_N = 0xc0, - HDMI_AUDIOINFOFRAME_0 = 0xcc, - HDMI_AUDIOINFOFRAME_1 = 0xd0, - HDMI_IEC60958_1 = 0xd4, - HDMI_IEC60958_2 = 0xd8, - HDMI_UNKNOWN_2 = 0xdc, - HDMI_AUDIO_DEBUG_0 = 0xe0, - HDMI_AUDIO_DEBUG_1 = 0xe4, - HDMI_AUDIO_DEBUG_2 = 0xe8, - HDMI_AUDIO_DEBUG_3 = 0xec -}; - -#endif /* _RHD_REGS_H */ diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index a8bd40ebc0..ea4c0a42a4 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -73,9 +73,9 @@ struct accelerant_info { struct register_info { + uint16 crtcOffset; uint16 vgaControl; uint16 grphEnable; - uint16 grphUpdate; uint16 grphControl; uint16 grphSwapControl; uint16 grphPrimarySurfaceAddr; @@ -89,26 +89,10 @@ struct register_info { uint16 grphYStart; uint16 grphXEnd; uint16 grphYEnd; - uint16 crtControl; - uint16 crtCountControl; - uint16 crtInterlace; - uint16 crtHPolarity; - uint16 crtVPolarity; - uint16 crtHSync; - uint16 crtVSync; - uint16 crtHBlank; - uint16 crtVBlank; - uint16 crtHTotal; - uint16 crtVTotal; - uint16 crtcOffset; uint16 modeDesktopHeight; uint16 modeDataFormat; - uint16 modeCenter; uint16 viewportStart; uint16 viewportSize; - uint16 sclUpdate; - uint16 sclEnable; - uint16 sclTapControl; }; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index bd75bf0cf1..408b978185 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -34,7 +34,7 @@ extern "C" void _sPrintf(const char *format, ...); /*! Populate regs with device dependant register locations */ status_t -init_registers(register_info* regs, uint8 crtid) +init_registers(register_info* regs, uint8 crtcID) { memset(regs, 0, sizeof(register_info)); @@ -43,112 +43,157 @@ init_registers(register_info* regs, uint8 crtid) if (info.device_chipset >= RADEON_R1000) { uint32 offset = 0; - // AMD Eyefinity on Evergreen GPUs - if (crtid == 1) { - offset = EVERGREEN_CRTC1_REGISTER_OFFSET; - regs->vgaControl = D2VGA_CONTROL; - } else if (crtid == 2) { - offset = EVERGREEN_CRTC2_REGISTER_OFFSET; - regs->vgaControl = EVERGREEN_D3VGA_CONTROL; - } else if (crtid == 3) { - offset = EVERGREEN_CRTC3_REGISTER_OFFSET; - regs->vgaControl = EVERGREEN_D4VGA_CONTROL; - } else if (crtid == 4) { - offset = EVERGREEN_CRTC4_REGISTER_OFFSET; - regs->vgaControl = EVERGREEN_D5VGA_CONTROL; - } else if (crtid == 5) { - offset = EVERGREEN_CRTC5_REGISTER_OFFSET; - regs->vgaControl = EVERGREEN_D6VGA_CONTROL; - } else { - offset = EVERGREEN_CRTC0_REGISTER_OFFSET; - regs->vgaControl = D1VGA_CONTROL; + switch(crtcID) { + case 0: + offset = EVERGREEN_CRTC0_REGISTER_OFFSET; + regs->vgaControl = AVIVO_D1VGA_CONTROL; + break; + case 1: + offset = EVERGREEN_CRTC1_REGISTER_OFFSET; + regs->vgaControl = AVIVO_D2VGA_CONTROL; + break; + case 2: + offset = EVERGREEN_CRTC2_REGISTER_OFFSET; + regs->vgaControl = EVERGREEN_D3VGA_CONTROL; + break; + case 3: + offset = EVERGREEN_CRTC3_REGISTER_OFFSET; + regs->vgaControl = EVERGREEN_D4VGA_CONTROL; + break; + case 4: + offset = EVERGREEN_CRTC4_REGISTER_OFFSET; + regs->vgaControl = EVERGREEN_D5VGA_CONTROL; + break; + case 5: + offset = EVERGREEN_CRTC5_REGISTER_OFFSET; + regs->vgaControl = EVERGREEN_D6VGA_CONTROL; + break; + default: + ERROR("%s: Unknown CRTC %" B_PRIu32 "\n", + __func__, crtcID); + return B_ERROR; } regs->crtcOffset = offset; - // Evergreen+ is crtoffset + register - regs->grphEnable = offset + EVERGREEN_GRPH_ENABLE; - regs->grphControl = offset + EVERGREEN_GRPH_CONTROL; - regs->grphSwapControl = offset + EVERGREEN_GRPH_SWAP_CONTROL; + regs->grphEnable = EVERGREEN_GRPH_ENABLE + offset; + regs->grphControl = EVERGREEN_GRPH_CONTROL + offset; + regs->grphSwapControl = EVERGREEN_GRPH_SWAP_CONTROL + offset; regs->grphPrimarySurfaceAddr - = offset + EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS; + = EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS + offset; regs->grphSecondarySurfaceAddr - = offset + EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS; + = EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + offset; regs->grphPrimarySurfaceAddrHigh - = offset + EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; + = EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + offset; regs->grphSecondarySurfaceAddrHigh - = offset + EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH; + = EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + offset; - regs->grphPitch = offset + EVERGREEN_GRPH_PITCH; + regs->grphPitch = EVERGREEN_GRPH_PITCH + offset; regs->grphSurfaceOffsetX - = offset + EVERGREEN_GRPH_SURFACE_OFFSET_X; + = EVERGREEN_GRPH_SURFACE_OFFSET_X + offset; regs->grphSurfaceOffsetY - = offset + EVERGREEN_GRPH_SURFACE_OFFSET_Y; - regs->grphXStart = offset + EVERGREEN_GRPH_X_START; - regs->grphYStart = offset + EVERGREEN_GRPH_Y_START; - regs->grphXEnd = offset + EVERGREEN_GRPH_X_END; - regs->grphYEnd = offset + EVERGREEN_GRPH_Y_END; - regs->crtControl = offset + EVERGREEN_CRTC_CONTROL; - regs->modeDesktopHeight = offset + EVERGREEN_DESKTOP_HEIGHT; - regs->modeDataFormat = offset + EVERGREEN_DATA_FORMAT; - regs->viewportStart = offset + EVERGREEN_VIEWPORT_START; - regs->viewportSize = offset + EVERGREEN_VIEWPORT_SIZE; + = EVERGREEN_GRPH_SURFACE_OFFSET_Y + offset; + regs->grphXStart = EVERGREEN_GRPH_X_START + offset; + regs->grphYStart = EVERGREEN_GRPH_Y_START + offset; + regs->grphXEnd = EVERGREEN_GRPH_X_END + offset; + regs->grphYEnd = EVERGREEN_GRPH_Y_END + offset; + regs->modeDesktopHeight = EVERGREEN_DESKTOP_HEIGHT + offset; + regs->modeDataFormat = EVERGREEN_DATA_FORMAT + offset; + regs->viewportStart = EVERGREEN_VIEWPORT_START + offset; + regs->viewportSize = EVERGREEN_VIEWPORT_SIZE + offset; - } else if (info.device_chipset >= RADEON_R600 - && info.device_chipset < RADEON_R1000) { + } else if (info.device_chipset >= RADEON_R700) { + uint32 offset = 0; + + switch(crtcID) { + case 0: + offset = R600_CRTC0_REGISTER_OFFSET; + regs->vgaControl = AVIVO_D1VGA_CONTROL; + regs->grphPrimarySurfaceAddrHigh + = D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; + break; + case 1: + offset = R600_CRTC1_REGISTER_OFFSET; + regs->vgaControl = AVIVO_D2VGA_CONTROL; + regs->grphPrimarySurfaceAddrHigh + = D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; + break; + default: + ERROR("%s: Unknown CRTC %" B_PRIu32 "\n", + __func__, crtcID); + return B_ERROR; + } + + regs->crtcOffset = offset; + + regs->grphEnable = AVIVO_D1GRPH_ENABLE + offset; + regs->grphControl = AVIVO_D1GRPH_CONTROL + offset; + regs->grphSwapControl = D1GRPH_SWAP_CNTL + offset; - // r600 - r700 are D1 or D2 based on primary / secondary crt - regs->vgaControl - = crtid == 1 ? D2VGA_CONTROL : D1VGA_CONTROL; - regs->grphEnable - = crtid == 1 ? D2GRPH_ENABLE : D1GRPH_ENABLE; - regs->grphControl - = crtid == 1 ? D2GRPH_CONTROL : D1GRPH_CONTROL; - regs->grphSwapControl - = crtid == 1 ? D2GRPH_SWAP_CNTL : D1GRPH_SWAP_CNTL; regs->grphPrimarySurfaceAddr - = crtid == 1 ? D2GRPH_PRIMARY_SURFACE_ADDRESS - : D1GRPH_PRIMARY_SURFACE_ADDRESS; + = D1GRPH_PRIMARY_SURFACE_ADDRESS + offset; regs->grphSecondarySurfaceAddr - = crtid == 1 ? D2GRPH_SECONDARY_SURFACE_ADDRESS - : D1GRPH_SECONDARY_SURFACE_ADDRESS; + = D1GRPH_SECONDARY_SURFACE_ADDRESS + offset; - regs->crtcOffset - = crtid == 1 ? (D2GRPH_X_END - D1GRPH_X_END) : 0; + regs->grphPitch = AVIVO_D1GRPH_PITCH + offset; + regs->grphSurfaceOffsetX = AVIVO_D1GRPH_SURFACE_OFFSET_X + offset; + regs->grphSurfaceOffsetY = AVIVO_D1GRPH_SURFACE_OFFSET_Y + offset; + regs->grphXStart = AVIVO_D1GRPH_X_START + offset; + regs->grphYStart = AVIVO_D1GRPH_Y_START + offset; + regs->grphXEnd = AVIVO_D1GRPH_X_END + offset; + regs->grphYEnd = AVIVO_D1GRPH_Y_END + offset; - // Surface Address high only used on r770+ - regs->grphPrimarySurfaceAddrHigh - = crtid == 1 ? D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH - : D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH; - regs->grphSecondarySurfaceAddrHigh - = crtid == 1 ? D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH - : D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH; + regs->modeDesktopHeight = AVIVO_D1MODE_DESKTOP_HEIGHT + offset; + regs->modeDataFormat = AVIVO_D1MODE_DATA_FORMAT + offset; + regs->viewportStart = AVIVO_D1MODE_VIEWPORT_START + offset; + regs->viewportSize = AVIVO_D1MODE_VIEWPORT_SIZE + offset; - regs->grphPitch - = crtid == 1 ? D2GRPH_PITCH : D1GRPH_PITCH; - regs->grphSurfaceOffsetX - = crtid == 1 ? D2GRPH_SURFACE_OFFSET_X : D1GRPH_SURFACE_OFFSET_X; - regs->grphSurfaceOffsetY - = crtid == 1 ? D2GRPH_SURFACE_OFFSET_Y : D1GRPH_SURFACE_OFFSET_Y; - regs->grphXStart - = crtid == 1 ? D2GRPH_X_START : D1GRPH_X_START; - regs->grphYStart - = crtid == 1 ? D2GRPH_Y_START : D1GRPH_Y_START; - regs->grphXEnd - = crtid == 1 ? D2GRPH_X_END : D1GRPH_X_END; - regs->grphYEnd - = crtid == 1 ? D2GRPH_Y_END : D1GRPH_Y_END; - regs->crtControl - = crtid == 1 ? D2CRTC_CONTROL : D1CRTC_CONTROL; - regs->modeDesktopHeight - = crtid == 1 ? D2MODE_DESKTOP_HEIGHT : D1MODE_DESKTOP_HEIGHT; - regs->modeDataFormat - = crtid == 1 ? D2MODE_DATA_FORMAT : D1MODE_DATA_FORMAT; - regs->viewportStart - = crtid == 1 ? D2MODE_VIEWPORT_START : D1MODE_VIEWPORT_START; - regs->viewportSize - = crtid == 1 ? D2MODE_VIEWPORT_SIZE : D1MODE_VIEWPORT_SIZE; + } else if (info.device_chipset >= RADEON_R600) { + uint32 offset = 0; + + switch(crtcID) { + case 0: + offset = R600_CRTC0_REGISTER_OFFSET; + regs->vgaControl = AVIVO_D1VGA_CONTROL; + break; + case 1: + offset = R600_CRTC1_REGISTER_OFFSET; + regs->vgaControl = AVIVO_D2VGA_CONTROL; + break; + default: + ERROR("%s: Unknown CRTC %" B_PRIu32 "\n", + __func__, crtcID); + return B_ERROR; + } + + regs->crtcOffset = offset; + + regs->grphEnable = AVIVO_D1GRPH_ENABLE + offset; + regs->grphControl = AVIVO_D1GRPH_CONTROL + offset; + regs->grphSwapControl = D1GRPH_SWAP_CNTL + offset; + + regs->grphPrimarySurfaceAddr + = D1GRPH_PRIMARY_SURFACE_ADDRESS + offset; + regs->grphSecondarySurfaceAddr + = D1GRPH_SECONDARY_SURFACE_ADDRESS + offset; + + // Surface Address high only used on r700 and higher + regs->grphPrimarySurfaceAddrHigh = 0xDEAD; + regs->grphSecondarySurfaceAddrHigh = 0xDEAD; + + regs->grphPitch = AVIVO_D1GRPH_PITCH + offset; + regs->grphSurfaceOffsetX = AVIVO_D1GRPH_SURFACE_OFFSET_X + offset; + regs->grphSurfaceOffsetY = AVIVO_D1GRPH_SURFACE_OFFSET_Y + offset; + regs->grphXStart = AVIVO_D1GRPH_X_START + offset; + regs->grphYStart = AVIVO_D1GRPH_Y_START + offset; + regs->grphXEnd = AVIVO_D1GRPH_X_END + offset; + regs->grphYEnd = AVIVO_D1GRPH_Y_END + offset; + + regs->modeDesktopHeight = AVIVO_D1MODE_DESKTOP_HEIGHT + offset; + regs->modeDataFormat = AVIVO_D1MODE_DATA_FORMAT + offset; + regs->viewportStart = AVIVO_D1MODE_VIEWPORT_START + offset; + regs->viewportSize = AVIVO_D1MODE_VIEWPORT_SIZE + offset; } else { // this really shouldn't happen unless a driver PCIID chipset is wrong TRACE("%s, unknown Radeon chipset: r%X\n", __func__, @@ -156,42 +201,8 @@ init_registers(register_info* regs, uint8 crtid) return B_ERROR; } - // Populate common registers - // TODO: Wait.. this doesn't work with Eyefinity > crt 1. - - regs->modeCenter - = crtid == 1 ? D2MODE_CENTER : D1MODE_CENTER; - regs->grphUpdate - = crtid == 1 ? D2GRPH_UPDATE : D1GRPH_UPDATE; - regs->crtHPolarity - = crtid == 1 ? D2CRTC_H_SYNC_A_CNTL : D1CRTC_H_SYNC_A_CNTL; - regs->crtVPolarity - = crtid == 1 ? D2CRTC_V_SYNC_A_CNTL : D1CRTC_V_SYNC_A_CNTL; - regs->crtHTotal - = crtid == 1 ? D2CRTC_H_TOTAL : D1CRTC_H_TOTAL; - regs->crtVTotal - = crtid == 1 ? D2CRTC_V_TOTAL : D1CRTC_V_TOTAL; - regs->crtHSync - = crtid == 1 ? D2CRTC_H_SYNC_A : D1CRTC_H_SYNC_A; - regs->crtVSync - = crtid == 1 ? D2CRTC_V_SYNC_A : D1CRTC_V_SYNC_A; - regs->crtHBlank - = crtid == 1 ? D2CRTC_H_BLANK_START_END : D1CRTC_H_BLANK_START_END; - regs->crtVBlank - = crtid == 1 ? D2CRTC_V_BLANK_START_END : D1CRTC_V_BLANK_START_END; - regs->crtInterlace - = crtid == 1 ? D2CRTC_INTERLACE_CONTROL : D1CRTC_INTERLACE_CONTROL; - regs->crtCountControl - = crtid == 1 ? D2CRTC_COUNT_CONTROL : D1CRTC_COUNT_CONTROL; - regs->sclUpdate - = crtid == 1 ? D2SCL_UPDATE : D1SCL_UPDATE; - regs->sclEnable - = crtid == 1 ? D2SCL_ENABLE : D1SCL_ENABLE; - regs->sclTapControl - = crtid == 1 ? D2SCL_TAP_CONTROL : D1SCL_TAP_CONTROL; - TRACE("%s, registers for ATI chipset r%X crt #%d loaded\n", __func__, - info.device_chipset, crtid); + info.device_chipset, crtcID); return B_OK; } @@ -943,11 +954,10 @@ display_crtc_fb_set(uint8 crtcID, display_mode *mode) Write32(OUT, regs->vgaControl, 0); uint64 fbAddress = gInfo->mc.vramStart; - //uint64 fbAddress = gInfo->shared_info->frame_buffer_phys; TRACE("%s: Framebuffer at: 0x%" B_PRIX64 "\n", __func__, fbAddress); - if (info.device_chipset >= (RADEON_R700 | 0x70)) { + if (info.device_chipset >= RADEON_R700) { TRACE("%s: Set SurfaceAddress High: 0x%" B_PRIX32 "\n", __func__, (fbAddress >> 32) & 0xf); diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index 4ace4dfa47..b920913ee4 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -242,7 +242,7 @@ radeon_gpu_mc_setup_r600() // idle the memory controller radeon_gpu_mc_halt(); - + uint32 idleState = radeon_gpu_mc_idlecheck(); if (idleState > 0) { ERROR("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", @@ -260,7 +260,74 @@ radeon_gpu_mc_setup_r600() uint32 tmp = ((gInfo->mc.vramEnd >> 24) & 0xFFFF) << 16; tmp |= ((gInfo->mc.vramStart >> 24) & 0xFFFF); - Write32(OUT, R6XX_MC_VM_FB_LOCATION, tmp); + Write32(OUT, R600_MC_VM_FB_LOCATION, tmp); + Write32(OUT, HDP_NONSURFACE_BASE, (gInfo->mc.vramStart >> 8)); + Write32(OUT, HDP_NONSURFACE_INFO, (2 << 7)); + Write32(OUT, HDP_NONSURFACE_SIZE, 0x3FFFFFFF); + + // TODO: AGP gtt start / end / agp base + // is AGP? + // WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 22); + // WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 22); + // WREG32(MC_VM_AGP_BASE, rdev->mc.agp_base >> 22); + // else? + Write32(OUT, R600_MC_VM_AGP_BASE, 0); + Write32(OUT, R600_MC_VM_AGP_TOP, 0x0FFFFFFF); + Write32(OUT, R600_MC_VM_AGP_BOT, 0x0FFFFFFF); + + idleState = radeon_gpu_mc_idlecheck(); + if (idleState > 0) { + ERROR("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", + __func__, idleState); + //return B_ERROR; + } + radeon_gpu_mc_resume(); + + // disable render control + Write32(OUT, 0x000300, Read32(OUT, 0x000300) & 0xFFFCFFFF); + + return B_OK; +} + + +static status_t +radeon_gpu_mc_setup_r700() +{ + // HDP initialization + uint32 i; + uint32 j; + for (i = 0, j = 0; i < 32; i++, j += 0x18) { + Write32(OUT, (0x2c14 + j), 0x00000000); + Write32(OUT, (0x2c18 + j), 0x00000000); + Write32(OUT, (0x2c1c + j), 0x00000000); + Write32(OUT, (0x2c20 + j), 0x00000000); + Write32(OUT, (0x2c24 + j), 0x00000000); + } + + // On r7xx read from HDP_DEBUG1 vs write HDP_REG_COHERENCY_FLUSH_CNTL + Read32(OUT, HDP_DEBUG1); + + // idle the memory controller + radeon_gpu_mc_halt(); + + uint32 idleState = radeon_gpu_mc_idlecheck(); + if (idleState > 0) { + ERROR("%s: Cannot modify non-idle MC! idleState: 0x%" B_PRIX32 "\n", + __func__, idleState); + //return B_ERROR; + } + + // TODO: Memory Controller AGP + Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR, + gInfo->mc.vramStart >> 12); + Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR, + gInfo->mc.vramEnd >> 12); + + Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, 0); + uint32 tmp = ((gInfo->mc.vramEnd >> 24) & 0xFFFF) << 16; + tmp |= ((gInfo->mc.vramStart >> 24) & 0xFFFF); + + Write32(OUT, R600_MC_VM_FB_LOCATION, tmp); Write32(OUT, HDP_NONSURFACE_BASE, (gInfo->mc.vramStart >> 8)); Write32(OUT, HDP_NONSURFACE_INFO, (2 << 7)); Write32(OUT, HDP_NONSURFACE_SIZE, 0x3FFFFFFF); @@ -303,7 +370,7 @@ radeon_gpu_mc_init() uint64 vramBase = gInfo->shared_info->frame_buffer_phys; if ((info.chipsetFlags & CHIP_IGP) != 0) { - vramBase = Read32(OUT, R6XX_MC_VM_FB_LOCATION) & 0xFFFF; + vramBase = Read32(OUT, R600_MC_VM_FB_LOCATION) & 0xFFFF; vramBase <<= 24; } @@ -329,7 +396,9 @@ radeon_gpu_mc_setup() TRACE("%s: vramStart: 0x%" B_PRIX64 ", vramEnd: 0x%" B_PRIX64 "\n", __func__, gInfo->mc.vramStart, gInfo->mc.vramEnd); - if (info.device_chipset >= RADEON_R600) + if (info.device_chipset >= RADEON_R700) + return radeon_gpu_mc_setup_r700(); + else if (info.device_chipset >= RADEON_R600) return radeon_gpu_mc_setup_r600(); return B_ERROR; diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 63805a08b6..5ce71dd76a 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -213,16 +213,18 @@ radeon_set_display_mode(display_mode *mode) TRACE("D2CRTC_STATUS Value: 0x%X\n", Read32(CRT, D2CRTC_STATUS)); TRACE("D1CRTC_CONTROL Value: 0x%X\n", Read32(CRT, D1CRTC_CONTROL)); TRACE("D2CRTC_CONTROL Value: 0x%X\n", Read32(CRT, D2CRTC_CONTROL)); - TRACE("D1GRPH_ENABLE Value: 0x%X\n", Read32(CRT, D1GRPH_ENABLE)); - TRACE("D2GRPH_ENABLE Value: 0x%X\n", Read32(CRT, D2GRPH_ENABLE)); - TRACE("D1SCL_ENABLE Value: 0x%X\n", Read32(CRT, D1SCL_ENABLE)); - TRACE("D2SCL_ENABLE Value: 0x%X\n", Read32(CRT, D2SCL_ENABLE)); - TRACE("RV620_DACA_ENABLE Value: 0x%X\n", Read32(CRT, RV620_DACA_ENABLE)); - TRACE("RV620_DACB_ENABLE Value: 0x%X\n", Read32(CRT, RV620_DACB_ENABLE)); + TRACE("D1GRPH_ENABLE Value: 0x%X\n", + Read32(CRT, AVIVO_D1GRPH_ENABLE)); + TRACE("D2GRPH_ENABLE Value: 0x%X\n", + Read32(CRT, AVIVO_D2GRPH_ENABLE)); + TRACE("D1SCL_ENABLE Value: 0x%X\n", + Read32(CRT, AVIVO_D1SCL_SCALER_ENABLE)); + TRACE("D2SCL_ENABLE Value: 0x%X\n", + Read32(CRT, AVIVO_D2SCL_SCALER_ENABLE)); TRACE("D1CRTC_BLANK_CONTROL Value: 0x%X\n", - Read32(CRT, D1CRTC_BLANK_CONTROL)); + Read32(CRT, AVIVO_D1CRTC_BLANK_CONTROL)); TRACE("D2CRTC_BLANK_CONTROL Value: 0x%X\n", - Read32(CRT, D2CRTC_BLANK_CONTROL)); + Read32(CRT, AVIVO_D1CRTC_BLANK_CONTROL)); return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index b0abd2d0d7..95e40bbfb4 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -303,7 +303,7 @@ pll_setup_flags(pll_info *pll, uint8 crtcID) pll->flags |= PLL_PREFER_LOW_REF_DIV; - if (info.device_chipset < (RADEON_R700 | 0x70)) + if (info.device_chipset < RADEON_R700) pll->flags |= PLL_PREFER_MINM_OVER_MAXP; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 65b1c989a0..bf4f880291 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -122,8 +122,6 @@ const struct supported_device { // From here on AMD no longer used numeric identifiers - // TODO: These don't work yet, no video. (maybe FB issue?) - # if 0 // R1000 series (HD54xx - HD63xx) // Codename: Evergreen // Cedar @@ -199,7 +197,6 @@ const struct supported_device { {0x671F, 5, 0, RADEON_R2000 | 0x30, CHIP_STD, "Radeon HD 6900"}, // Antilles {0x671d, 5, 0, RADEON_R2000 | 0x40, CHIP_STD, "Radeon HD 6990"} - #endif // R3000 series (HD74xx - HD79xx) // Codename: Southern Islands diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index c4f44cdeb6..efc2c2bc86 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -485,13 +485,13 @@ radeon_hd_init(radeon_info &info) // *** Populate frame buffer information if (info.shared_info->device_chipset >= RADEON_R1000) { - // R800+ has memory stored in MB + // Evergreen+ has memory stored in MB info.shared_info->graphics_memory_size - = read32(info.registers + R6XX_CONFIG_MEMSIZE) * 1024; + = read32(info.registers + CONFIG_MEMSIZE) * 1024; } else { // R600-R700 has memory stored in bytes info.shared_info->graphics_memory_size - = read32(info.registers + R6XX_CONFIG_MEMSIZE) / 1024; + = read32(info.registers + CONFIG_MEMSIZE) / 1024; } uint32 barSize = info.pci->u.h0.base_register_sizes[RHD_FB_BAR] / 1024; From 8fbddad17cd360e6d90f565f2a4a349dd59081bc Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 28 Oct 2011 04:42:16 +0000 Subject: [PATCH 470/702] * better use Radeon HD 4xxx (r7xx) VM FB registers git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42931 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/gpu.cpp | 25 +++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp b/src/add-ons/accelerants/radeon_hd/gpu.cpp index b920913ee4..b15e4efc6c 100644 --- a/src/add-ons/accelerants/radeon_hd/gpu.cpp +++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp @@ -317,17 +317,19 @@ radeon_gpu_mc_setup_r700() //return B_ERROR; } + Write32(OUT, VGA_HDP_CONTROL, VGA_MEMORY_DISABLE); + // TODO: Memory Controller AGP - Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR, + Write32(OUT, R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR, gInfo->mc.vramStart >> 12); - Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR, + Write32(OUT, R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR, gInfo->mc.vramEnd >> 12); - Write32(OUT, R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, 0); + Write32(OUT, R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, 0); uint32 tmp = ((gInfo->mc.vramEnd >> 24) & 0xFFFF) << 16; tmp |= ((gInfo->mc.vramStart >> 24) & 0xFFFF); - Write32(OUT, R600_MC_VM_FB_LOCATION, tmp); + Write32(OUT, R700_MC_VM_FB_LOCATION, tmp); Write32(OUT, HDP_NONSURFACE_BASE, (gInfo->mc.vramStart >> 8)); Write32(OUT, HDP_NONSURFACE_INFO, (2 << 7)); Write32(OUT, HDP_NONSURFACE_SIZE, 0x3FFFFFFF); @@ -338,9 +340,9 @@ radeon_gpu_mc_setup_r700() // WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 22); // WREG32(MC_VM_AGP_BASE, rdev->mc.agp_base >> 22); // else? - Write32(OUT, R600_MC_VM_AGP_BASE, 0); - Write32(OUT, R600_MC_VM_AGP_TOP, 0x0FFFFFFF); - Write32(OUT, R600_MC_VM_AGP_BOT, 0x0FFFFFFF); + Write32(OUT, R700_MC_VM_AGP_BASE, 0); + Write32(OUT, R700_MC_VM_AGP_TOP, 0x0FFFFFFF); + Write32(OUT, R700_MC_VM_AGP_BOT, 0x0FFFFFFF); idleState = radeon_gpu_mc_idlecheck(); if (idleState > 0) { @@ -362,6 +364,13 @@ radeon_gpu_mc_init() { radeon_shared_info &info = *gInfo->shared_info; + uint32 fbVMLocationReg; + if (info.device_chipset >= RADEON_R700) { + fbVMLocationReg = R700_MC_VM_FB_LOCATION; + } else { + fbVMLocationReg = R600_MC_VM_FB_LOCATION; + } + if (gInfo->shared_info->frame_buffer_size > 0) gInfo->mc.valid = true; @@ -370,7 +379,7 @@ radeon_gpu_mc_init() uint64 vramBase = gInfo->shared_info->frame_buffer_phys; if ((info.chipsetFlags & CHIP_IGP) != 0) { - vramBase = Read32(OUT, R600_MC_VM_FB_LOCATION) & 0xFFFF; + vramBase = Read32(OUT, fbVMLocationReg) & 0xFFFF; vramBase <<= 24; } From f52ca69c7998ff0cc464e0654de92194d24ddad3 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 28 Oct 2011 16:39:26 +0000 Subject: [PATCH 471/702] * attempt to reduce tracing spam a bit git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42932 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/radeon_hd/mode.cpp | 38 +++++++++------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index 5ce71dd76a..5bb92b9467 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -285,16 +285,11 @@ radeon_get_pixel_clock_limits(display_mode *mode, uint32 *_low, uint32 *_high) bool is_mode_supported(display_mode *mode) { - TRACE("MODE: %d ; %d %d %d %d ; %d %d %d %d\n", - mode->timing.pixel_clock, mode->timing.h_display, - mode->timing.h_sync_start, mode->timing.h_sync_end, - mode->timing.h_total, mode->timing.v_display, - mode->timing.v_sync_start, mode->timing.v_sync_end, - mode->timing.v_total); + bool sane = true; // Validate modeline is within a sane range if (is_mode_sane(mode) != B_OK) - return false; + sane = false; // TODO: is_mode_supported on *which* display? uint32 crtid = 0; @@ -303,34 +298,33 @@ is_mode_supported(display_mode *mode) if (gInfo->shared_info->has_edid && gDisplay[crtid]->found_ranges) { + // validate horizontal frequency range uint32 hfreq = mode->timing.pixel_clock / mode->timing.h_total; if (hfreq > gDisplay[crtid]->hfreq_max + 1 || hfreq < gDisplay[crtid]->hfreq_min - 1) { - TRACE("!!! hfreq : %d , hfreq_min : %d, hfreq_max : %d\n", - hfreq, gDisplay[crtid]->hfreq_min, gDisplay[crtid]->hfreq_max); - TRACE("!!! %dx%d falls outside of CRT %d's valid " - "horizontal range.\n", mode->timing.h_display, - mode->timing.v_display, crtid); - return false; + //TRACE("!!! mode below falls outside of hfreq range!\n"); + sane = false; } + // validate vertical frequency range uint32 vfreq = mode->timing.pixel_clock / ((mode->timing.v_total * mode->timing.h_total) / 1000); - if (vfreq > gDisplay[crtid]->vfreq_max + 1 || vfreq < gDisplay[crtid]->vfreq_min - 1) { - TRACE("!!! vfreq : %d , vfreq_min : %d, vfreq_max : %d\n", - vfreq, gDisplay[crtid]->vfreq_min, gDisplay[crtid]->vfreq_max); - TRACE("!!! %dx%d falls outside of CRT %d's valid vertical range\n", - mode->timing.h_display, mode->timing.v_display, crtid); - return false; + //TRACE("!!! mode below falls outside of vfreq range!\n"); + sane = false; } } - TRACE("%dx%d is within CRT %d's valid frequency range\n", - mode->timing.h_display, mode->timing.v_display, crtid); + TRACE("MODE: %d ; %d %d %d %d ; %d %d %d %d is %s\n", + mode->timing.pixel_clock, mode->timing.h_display, + mode->timing.h_sync_start, mode->timing.h_sync_end, + mode->timing.h_total, mode->timing.v_display, + mode->timing.v_sync_start, mode->timing.v_sync_end, + mode->timing.v_total, + sane ? "OK." : "BAD, out of range!"); - return true; + return sane; } From 397fbc47bb63cd3ef0835eadc21db8d2519d7111 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 28 Oct 2011 19:08:37 +0000 Subject: [PATCH 472/702] * better identify BAR location defines * fix bug where we were using an r600 bios pull method on r700 cards. this should help prevent shadow rom fallback. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42933 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 21 ++++++++----------- .../graphics/radeon_hd/radeon_hd_private.h | 4 ++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index efc2c2bc86..9dbd0eda32 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -36,13 +36,10 @@ #define ERROR(x...) dprintf("radeon_hd: " x) + // #pragma mark - -#define RHD_FB_BAR 0 -#define RHD_MMIO_BAR 2 - - status_t mapAtomBIOS(radeon_info &info, uint32 romBase, uint32 romSize) { @@ -139,7 +136,7 @@ radeon_hd_getbios(radeon_info &info) // *** Discreet card on IGP, check PCI BAR 0 // On post, the bios puts a copy of the IGP // AtomBIOS at the start of the video ram - romBase = info.pci->u.h0.base_registers[RHD_FB_BAR]; + romBase = info.pci->u.h0.base_registers[PCI_BAR_FB]; romSize = 256 * 1024; if (romBase == 0 || romSize == 0) { @@ -472,8 +469,8 @@ radeon_hd_init(radeon_info &info) // *** Map Memory mapped IO AreaKeeper mmioMapper; info.registers_area = mmioMapper.Map("radeon hd mmio", - (void *)info.pci->u.h0.base_registers[RHD_MMIO_BAR], - info.pci->u.h0.base_register_sizes[RHD_MMIO_BAR], + (void *)info.pci->u.h0.base_registers[PCI_BAR_MMIO], + info.pci->u.h0.base_register_sizes[PCI_BAR_MMIO], B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void **)&info.registers); if (mmioMapper.InitCheck() < B_OK) { @@ -494,7 +491,7 @@ radeon_hd_init(radeon_info &info) = read32(info.registers + CONFIG_MEMSIZE) / 1024; } - uint32 barSize = info.pci->u.h0.base_register_sizes[RHD_FB_BAR] / 1024; + uint32 barSize = info.pci->u.h0.base_register_sizes[PCI_BAR_FB] / 1024; // if graphics memory is larger then PCI bar, just map bar if (info.shared_info->graphics_memory_size > barSize) { @@ -513,7 +510,7 @@ radeon_hd_init(radeon_info &info) // *** Framebuffer mapping AreaKeeper frambufferMapper; info.framebuffer_area = frambufferMapper.Map("radeon hd frame buffer", - (void *)info.pci->u.h0.base_registers[RHD_FB_BAR], + (void *)info.pci->u.h0.base_registers[PCI_BAR_FB], info.shared_info->frame_buffer_size * 1024, B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, (void **)&info.shared_info->frame_buffer); @@ -525,13 +522,13 @@ radeon_hd_init(radeon_info &info) // Turn on write combining for the frame buffer area vm_set_area_memory_type(info.framebuffer_area, - info.pci->u.h0.base_registers[RHD_FB_BAR], B_MTR_WC); + info.pci->u.h0.base_registers[PCI_BAR_FB], B_MTR_WC); frambufferMapper.Detach(); info.shared_info->frame_buffer_area = info.framebuffer_area; info.shared_info->frame_buffer_phys - = info.pci->u.h0.base_registers[RHD_FB_BAR]; + = info.pci->u.h0.base_registers[PCI_BAR_FB]; // Pass common information to accelerant info.shared_info->device_index = info.id; @@ -551,7 +548,7 @@ radeon_hd_init(radeon_info &info) // If the active read fails, we try a disabled read if (info.device_chipset >= (RADEON_R1000 | 0x20)) biosStatus = radeon_hd_getbios_ni(info); - else if (info.device_chipset >= (RADEON_R700 | 0x70)) + else if (info.device_chipset >= RADEON_R700) biosStatus = radeon_hd_getbios_r700(info); else if (info.device_chipset >= RADEON_R600) biosStatus = radeon_hd_getbios_r600(info); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index a5161ec80d..776a8f88d2 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -19,6 +19,10 @@ #include "lock.h" +// PCI Base Address Registers +#define PCI_BAR_FB 0 +#define PCI_BAR_MMIO 2 + #define RADEON_BIOS8(adr, v) (adr[v]) #define RADEON_BIOS16(adr, v) ((adr[v]) | (adr[(v) + 1] << 8)) #define RADEON_BIOS32(adr, v) \ From 0fa0204f7cfa96ec117a006bd308e52a148b4bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 28 Oct 2011 21:55:14 +0000 Subject: [PATCH 473/702] Use the new private roster API to shutdown. Maybe we should have a confirmation alert the first time ? Btw, the power_button driver should really implement select() or some other non-polling mechanism, it sux having to waste cpu. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42934 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/power/Jamfile | 2 ++ src/servers/power/power_button_monitor.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/servers/power/Jamfile b/src/servers/power/Jamfile index 5921ebceb8..8e94eb969d 100644 --- a/src/servers/power/Jamfile +++ b/src/servers/power/Jamfile @@ -1,5 +1,7 @@ SubDir HAIKU_TOP src servers power ; +UsePrivateHeaders app ; + AddResources power_daemon : power_daemon.rdef ; Server power_daemon : diff --git a/src/servers/power/power_button_monitor.cpp b/src/servers/power/power_button_monitor.cpp index 8aee4dcd11..5fb6d91cf2 100644 --- a/src/servers/power/power_button_monitor.cpp +++ b/src/servers/power/power_button_monitor.cpp @@ -1,10 +1,10 @@ #include #include +#include + #include "power_button_monitor.h" -#define B_SYSTEM_SHUTDOWN 0x12d -static const char *kRosterSignature = "application/x-vnd.Be-ROST"; PowerButtonMonitor::PowerButtonMonitor() : BHandler ("power_button_monitor") { power_button_fd = open("/dev/power/button/power",O_RDONLY); @@ -22,9 +22,13 @@ void PowerButtonMonitor::MessageReceived(BMessage *msg) { if (power_button_fd <= 0) return; - bool button_pressed; + uint8 button_pressed; read(power_button_fd,&button_pressed,1); - if (button_pressed) - BMessenger(kRosterSignature).SendMessage(B_SYSTEM_SHUTDOWN); + if (button_pressed) { + BRoster roster; + BRoster::Private rosterPrivate(roster); + + rosterPrivate.ShutDown(false, false, false); + } } From 159517ea26c264e8aa6ad7ea5110949cf99445e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 28 Oct 2011 22:07:04 +0000 Subject: [PATCH 474/702] =?UTF-8?q?Add=20power=5Fdaemon=20and=20apci=5Fbut?= =?UTF-8?q?ton=20driver=20back=20to=20the=20image.=20WorksForMe=E2=84=A2.?= =?UTF-8?q?=20Just=20need=20to=20start=20power=5Fdaemon=20from=20Bootscrip?= =?UTF-8?q?t.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42935 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 295cb019e9..0c505c98a0 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -104,7 +104,7 @@ PRIVATE_SYSTEM_LIBS = ; SYSTEM_SERVERS = app_server cddb_daemon debug_server input_server mail_daemon media_addon_server media_server midi_server mount_server net_server - notification_server print_server print_addon_server registrar syslog_daemon + notification_server power_daemon print_server print_addon_server registrar syslog_daemon ; SYSTEM_NETWORK_DEVICES = ethernet loopback ; @@ -186,7 +186,7 @@ SYSTEM_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)atheros813x # WiMAX drivers $(GPL_ONLY)usb_beceemwmx ; -#SYSTEM_ADD_ONS_DRIVERS_POWER = $(X86_ONLY)acpi_button ; +SYSTEM_ADD_ONS_DRIVERS_POWER = $(X86_ONLY)acpi_button ; SYSTEM_ADD_ONS_BUS_MANAGERS = $(ATA_ONLY)ata pci $(X86_ONLY)ps2 $(X86_ONLY)isa $(IDE_ONLY)ide scsi config_manager agp_gart usb firewire $(X86_ONLY)acpi ; @@ -273,7 +273,7 @@ AddDriversToHaikuImage input : ps2_hid usb_hid wacom ; AddDriversToHaikuImage misc : poke mem ; AddDriversToHaikuImage net : $(SYSTEM_ADD_ONS_DRIVERS_NET) ; AddDriversToHaikuImage ports : usb_serial ; -#AddDriversToHaikuImage power : $(SYSTEM_ADD_ONS_DRIVERS_POWER) ; +AddDriversToHaikuImage power : $(SYSTEM_ADD_ONS_DRIVERS_POWER) ; # kernel AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ; From 5e70d31cc74100f164ae819dac4e4f48ebae985d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 28 Oct 2011 22:21:07 +0000 Subject: [PATCH 475/702] Start the power_daemon now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42936 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/system/boot/Bootscript | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/system/boot/Bootscript b/data/system/boot/Bootscript index e37bc59ab5..04a73bf6e6 100644 --- a/data/system/boot/Bootscript +++ b/data/system/boot/Bootscript @@ -164,6 +164,11 @@ if [ "$SAFEMODE" != "yes" ]; then launch $SERVERS/notification_server "" fi +# Launch Power Daemon +if [ "$SAFEMODE" != "yes" ]; then + launch $SERVERS/power_daemon "" +fi + # Check for daylight saving time launch system/bin/dstcheck From ceb1e821197f7684edfc9bdb18f1f212d3ff87d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 28 Oct 2011 23:16:54 +0000 Subject: [PATCH 476/702] Add the original icon used by NetSurf, and a new icon for VirtualBox. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42937 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/artwork/icons/App_NetSurf_Original | Bin 0 -> 19788 bytes data/artwork/icons/App_VirtualBox | Bin 0 -> 8783 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 data/artwork/icons/App_NetSurf_Original create mode 100644 data/artwork/icons/App_VirtualBox diff --git a/data/artwork/icons/App_NetSurf_Original b/data/artwork/icons/App_NetSurf_Original new file mode 100644 index 0000000000000000000000000000000000000000..ca81f55ec013337ba2a9158cc2d410efe53318d9 GIT binary patch literal 19788 zcmeHP4RBP|6@EZAY)FX-Mu>%w7k(s>OpQ!afvVYiS@NThtWAo@NSh_ukXMu4b$10a z&Nvy%4Cq*hA~hYHCjN{@7$hZ3r6Ucij!p&{CWTIIu?|7`n<;;`YN;UUci!8ZylmL` zmeR1e@66oXz2}{K?s@k+_uljFy_3?#6~%LSc~Qw?sh?^+l@%FO0xv_yciM|9f?1MO zTwJlZ9l6Ep4Al80iRx2Xkf>h=-Wna>X=h7_NA*cIf$AflKn3tgPs=DOXe9KMfLEvE zlO3e?CzTZo#v)H}I~!cc?|1CXiR7! z66=c>yk;HW$okR-9b$bD>q}}#Z^t{i{Dra;?13FKc-@covHKS0^WzKlu&rIw`1%by z*lOuEzOr&NtNLORpV8RLUjI6k|MdR#%-c4O`&2Oqu2x;BsIiRX5+?cbbX zwV!>!D%K_NlfOR1TI{2^^-pKm4#!P=-uBPf=cN<*t%tv6t*=hum-ZcDw0_b2E$ju_qw2TPF4XfKFFagTl-HvLzUM1RNHI5Yhh z4htI2e@7y||J(jncJwJfd)nK=4j$UfmQH_$&HmXY_E6LF%-*S}^P`dYK3YBD_>1`7 zh@NlPWEX^Gkf~z0p@sbE$du)fE}N=j`?aj4C4~5o=CVD(Gw525FTZ< zr`7TC;9UuPOu>5glFz~kpR#|PHjGQOdLrRsL{B{6GPY_9>wJ6ypS<%mwxT$Tmml52 zChy7StJ0fU&&8V!?^8spClW43^uz-$osaKgm&)__t4Q#`KdLrRsL{B{6GHJ`N zSi3WapP9Oi-LpKG=e)X=oqF;PPVw^3tv@h~OSF0-;bKHjJm7M9RyX_Ci@99MJI<78 zIXvOD6Dl6Rd!<{&$LRS)w0a`pVnk0o;PUKYiT~l;O#bGP6#kdSX*{hZmDBk7_?FSU z;oxk;<0V=>k#I4hCmwLgIyr?OJDABoIg`tuI6jGAtj^>ANzLSGnOVGK^>o9yM5`wf zE=Kgk11^X57Vv_!RG#^KA<1`Q?|B_@B4U<0p2d8^$GCJ&|xRqUUq7e(v`rsb@0w ziZikKhJ$fBr~00{6Q}(V`^U5&T?L(V{$7GS(I056clp)xT`CI_=OR|{GIV^bJ4=Ws z&hIU1eds~O9vl?YIWe832oid7z_aQ2WQPnPI=`p$<^J<~Ro}hp`Sld=i_6Lv(H@$m z+EefGNm8M^4<+q<`xN?$?C3^rUFmbyC@wnUSBdN(z93wlCMxbamrn`EVec!TAipHNMD0j6Jjg)m!EeIh0uqt%SCUUhSw^xU2@=l< z=O)2KE^xNtH}$`utM#`&5a}R0QjyD40O{NRfBO6GFSYi`{u|lfJG-V9O>FzLQ0u*c zzq>R(`FrpF`{&q@x78&7&?fv?_@5a6!r#??dEtNecetKProU_RD>~!4`ulBlXVvy^ zbbo&%^TU%x+blNCy9WNYYy2QMy|eeOupw`1UBF~7=f$|V+WFn|_rdXm@V7|w zJI(Fqk*X{J49S6Dh2k8Nj}%|^P7lQ;$P@i_PH!l_>PA_RSf|#5*P`PC-zCHwh_9%= zc0W=EKT>>^0UK>%azrEH^I4J_SIItCt!6ODt`tUeyu)K54mF1gk)DFEb zy=yZZfZ~bWNc5iK{V5(JOhiABzd6Q$5h8)x1^Ak*YrW!j$<pwj#HzR%+;?^x=)8mBQ_^Y{WTaqU?s?)M|=hh8KZ zsRU^^5>YB%qy@R~BeK_lvKX)5wedvjL^o0k61^w&A(4zS^^xcY8c%HkWbnm!Dgn={ zqT4Urz7YcbzN8t>uw=;dVC zF&sV}us`1BJ9ql+d%k$?!jO5%obRr0{4mnIke6CdO8_ekPn)!;GlK|dJ%J{n1U#L=@keqs}!apw3@&$ELuI(~3< zL?v_l#OC-BXGkVKv560^U76ztJrG2S#rPmaMaPVcKIn&7 zoZr$+e4>i4X`e2LP39_Wyma8>#DM^-4U>=!9oahpcTI4aRGtVK+?%eV%euHT-G+;> jwyAiIivUg7bfkMWk?!{ppYEd)$+-AR{|k*soFD!dp=oCc literal 0 HcmV?d00001 diff --git a/data/artwork/icons/App_VirtualBox b/data/artwork/icons/App_VirtualBox new file mode 100644 index 0000000000000000000000000000000000000000..62fe2c77b8f244fc28283d7f2bd57c17bc253645 GIT binary patch literal 8783 zcmeHMTWnNC7@lRJ+$vOp0WZWgG2yDBB6uP0QZ7YpDG?IEa9g&g^uX?(y1UR~NbC#9 z9U-D7geVscfd`C+Xi(BZR0z?CJSf2jBnBbq124uHjrIFx&YV4GIa>xO;e|>5o}F*z z%;o$3nfd4Rg}PZa)9a=^E|4Oy&N8X}At9nD?^RLREV0IS#@k-LlM!{dGtIOGo zIDoO5bn+A4s(|TE*f<;FRMk{^iI->3n#_D93y?@v6mQL*F|(TQj)mO~*?aP_4TqHwsjb$+Nl)8*)Q#+i)WJ=OY}j;SzbunSxYoKcD8`LNC>fZ zl6pQ}EyNZ4ZpL#uEapCE0{a}+k&ti2?CcG`h|aJ3&6JbPTB(B7AR;nRrdTTN*rmcmA$@PwlOSw4U#+(D0t|b;l zJ2lBb9Dl{G#ZWbaB=9im=K&9+evQ{oaHYKM z;*xs4Sa6!JB3`kgR>w?`UUpSc+D<|Utvi6Zp^`ycx=Klg%LjhC1E~44tN;x z^MQvE|EAYYkofH`E{SJ@dAp&wKarlW{YcT~b9s}BiutZg_ zt31Zk;Xqbnu<@`k<`)7FV}2d*u-)ce7njWQILtRC8=Mx;>q%5A&H$bZe73=OCd`CY zRhMvot%^nN%h&9J`?H4JSD>CL_hDYoEhqsi^?HrZMwy>`jqe2R=bkw2A}oyizg^t( z`n0pe@tEHS=1;*+z|O#afmMO^KClk=cTfC&7{+>I@T`PQgbns9(;W>dDGHvBW1y+Pf^t&IP9l@+f z6%#4&Cmr}xs=ZtVNGzA#NYYGtxfgHsfUy_dI)2KYnP(ucV{9F?5oe5DGo!wiBcw<= zXp>@aNQ=|S)H0EB(oPOJ(OHLHOa^omEz+CxfH*iNc61{HiXiCM_oMgG2q(;Tyn(9d zuQ<>pxnzTFAt2m=+9o4Dh!(lAYoYYWizBX(6mll_!I(ILC`g-HTRnyKcuk4HSVvRK z-_(^Sj#^*6#q9dpX&TP}SL+3LEuR#tfK!1e_E$f?8kp*LNZ|USPpDKnna_hQA!;-Q zflMKn%;p=NTqaqtovf&wk~y;O;K}%Ri(Y+V+i$1i7hZqw^u_(Zwh!C1{m_xGevYG^ zM9Zk^1fCzv`ENo(F+AYYL!IKe&Q7PXF>e)6#?%%stZcUAPh6O+T(gr_eUKVE+hpbJ zLae0w$V=eCM4omuV(L)tGID7Odbo~_OC4$m#zJlPzu(z7^!(&w@gCn^ zetuWonf9RzR)3V4dy)Pm&R4&fz@ww}i?Q0D_IGynnsB@uwx`W#*kpU+iNGCQpBmI2 z+0gS&-($l3N#A4SHsrf!D9=GGm|+}cGNM}+60|hg1?kt_%3a z#{)q#MV8o%PX2)CocleHWwINw6|b7~@*!IFpXO|V`tS%*r)|H$sR~$*iXRvKr!Chv zPho!mMg8uFvCU}7=|37cXBNeo@Bg^C)T@7wJpIW4$B{3CZ**}P2F7w$qpU3hQJpDu zk&=@Y4Io{SD@6VF|GgS-!kKMnmk5!uv#}L+-d=2{?ZV1fK9x*c^3_bTHLRd5F$Jue zh?0N;Jex@nlNNJSoXV1k7P|rekx;2Bk--L)i=}Nm zJxsmeFBv&+%dtO4T#4tKoLs?D&9b_uj0#>=3sRxyIG~xbXvbXKVSZ|dk zTqET)8G*7eO_l%;lr3kMCS{Z!3ix(B)UhXNvj8ueu$=k*4lVmCeW3osl!Hww595NH>pl6u|0IbXR z8I@65|A9wI9)yvX(g5HQV2b+Sx0>T{rLX{?0v&}(HLwgm!o`bHafY5$%&;3zF8Kl5 slj}|d(9IEm=-vq6vBQ^kZ+P_bRgtt0PYjtqq5}$dT-rT6aT5{1|5i&)vj6}9 literal 0 HcmV?d00001 From 1ff3981e26181afb4db065b023bc4c5cfb7be33e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 28 Oct 2011 23:20:20 +0000 Subject: [PATCH 477/702] PPC Mac related links for porting. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42938 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/develop/ports/ppc/mac/urls.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 docs/develop/ports/ppc/mac/urls.txt diff --git a/docs/develop/ports/ppc/mac/urls.txt b/docs/develop/ports/ppc/mac/urls.txt new file mode 100644 index 0000000000..b0cf634ba3 --- /dev/null +++ b/docs/develop/ports/ppc/mac/urls.txt @@ -0,0 +1,9 @@ +http://www.debian.org/releases/stable/powerpc/ch05s01.html.en +http://www.kernelthread.com/mac/osx/arch_boot.html +http://playground.sun.com/1275/mejohnson/ +http://homepages.gold.ac.uk/suzanne/startup.html +http://www.netbsd.org/ports/macppc/SystemDisk-tutorial/ +http://www.netneurotic.net/mac/openfirmware.html +http://www.netbsd.org/ports/macppc/faq.html +http://mail-index.netbsd.org/port-macppc/1999/03/21/0001.html +http://mail-index.netbsd.org/port-macppc/1999/06/25/0006.html From f196d7198d95b362dbe41ea3407ffe97501da721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 28 Oct 2011 23:22:30 +0000 Subject: [PATCH 478/702] Small perspective adjustment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42939 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/artwork/icons/App_VirtualBox | Bin 8783 -> 8783 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/artwork/icons/App_VirtualBox b/data/artwork/icons/App_VirtualBox index 62fe2c77b8f244fc28283d7f2bd57c17bc253645..27f66cea7593c5ead18f855a456dd4435b7bd8ed 100644 GIT binary patch delta 38 kcmX@_a^7V_9yhCl69dDJ$;I3%P}Ur7RS0YIG44(=0Pp_`!~g&Q delta 38 kcmX@_a^7V_9yhCv69dDB$;I3%P}Ur7RS0YIG44(=0PT+ppa1{> From 6db5b8c639bce86b9a3459edd30e7f63640c3363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 29 Oct 2011 01:34:08 +0000 Subject: [PATCH 479/702] Use a fake site for testing... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42940 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index 0a0d50253e..e4c40f5f60 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -10,7 +10,7 @@ netcat=netcat -report_site=haikuware.com +report_site=fake.haikuware.com report_cgi=http://haikuware.com/hwreport.php do_notify () From e2932f63b00ba76ab3769a9c217754a4d03868ca Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sat, 29 Oct 2011 01:58:39 +0000 Subject: [PATCH 480/702] Small performance tweak -- replace a call to expr. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42941 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/bin/installoptionalpackage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/bin/installoptionalpackage b/data/bin/installoptionalpackage index e2ac6a5262..540ea0bfcf 100755 --- a/data/bin/installoptionalpackage +++ b/data/bin/installoptionalpackage @@ -339,7 +339,7 @@ function ContainsSubstring() local string="$1" local substring="$2" local newString=${string/${substring}/''} - if [ ${#string} -eq `expr ${#newString} + ${#substring}` ] ; then + if [ ${#string} -eq $((${#newString} + ${#substring})) ] ; then return 0 fi return 1 From 46c36a5db3e3d89ade5ae2877cbe03c809964d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 29 Oct 2011 08:12:54 +0000 Subject: [PATCH 481/702] Some more perspective tweaking again, hopefully it's ok now. stippi ? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42942 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/artwork/icons/App_VirtualBox | Bin 8783 -> 8783 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/artwork/icons/App_VirtualBox b/data/artwork/icons/App_VirtualBox index 27f66cea7593c5ead18f855a456dd4435b7bd8ed..edaf9548089d7266a5e8163735de1dc917728e12 100644 GIT binary patch delta 69 zcmX@_a^7XbHcn0fCk6%^AeNZCpVI+}$HC=@;B5}#(qLrtnOx1S0VJ1jYcl$5KF8fC F1^_O957+ Date: Sat, 29 Oct 2011 09:01:00 +0000 Subject: [PATCH 482/702] * Removed files that aren't really make any sense to have in our repository. * Removed duplicated headers that we already have in our repository elsewhere. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42943 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../mail/ExtraMenuLinksForR5Tracker.zip | Bin 3453 -> 0 bytes src/servers/mail/HISTORY | 297 ------------------ src/servers/mail/Jamfile | 6 +- src/servers/mail/NavMenu.h | 164 ---------- src/servers/mail/SlowMenu.h | 76 ----- 5 files changed, 2 insertions(+), 541 deletions(-) delete mode 100644 src/servers/mail/ExtraMenuLinksForR5Tracker.zip delete mode 100644 src/servers/mail/HISTORY delete mode 100644 src/servers/mail/NavMenu.h delete mode 100644 src/servers/mail/SlowMenu.h diff --git a/src/servers/mail/ExtraMenuLinksForR5Tracker.zip b/src/servers/mail/ExtraMenuLinksForR5Tracker.zip deleted file mode 100644 index de2894cbf8ed3ba86c74509b02cad440f5f1af70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3453 zcmchZc{r4N8^>piWkQ+87P4hMwi!psIhM(qrLhx=EHfC(3^J1}MJU;_@3M^|*(&=H z5(<-uC^2Yc4jM&8O5Pd0y@~T)?|<)auIHKOd9L4l=Dwc$d*Aoh+yunT4q&V(YXhaN zi+`W?0Rn;gibxlXkC;IK&UYsKhK=rBIOzG40O zfna|JNKPbuKeGRCxCtVqAuSgq2!=vr=gmH3^lFE2uDHNZHDfae#o|G6!-elPm=7;# zjtdadTg#%pY3Xwz!F-o`HdXVWmyh&coyd3JM|5rI!_Q{>ew62D_H@+-U-zQf@v#P! zQr8!)w12a@ni_5K&=mdH&3Y=l+tbU`a`CiL0n=K|>@Az2tV-$tiaep1o%wJ|zO3=d zo%JHCj)sPiJRS$8v;J!HgFvFyCjT;v`G4}GlSus~KkR@FpqU>UE2bCV;vTq_n|KWl z#IL!b0E0nWxhZ<&sh(h^Z8m(2=fV+b6G(EL(_fx5c*iNj!X zjO0lRb=3UbY96it8&a7hX!9#BiK89tez+GpB%uaWQ?q1z|c6-RJ_@Z$dYxF`-8QIJzUee{B za@Eoxr72+{Qv6M7h5Oz$J;Qybko9PkRzs@aaH`oEB|Zg3PgB`m!&lZ^EcJ7E_WSr8 zE44)BbfNQa5?9?TkJYjDz0#9S7O;>|#ygTKJz|LFGd0YaDfbA{Al*j?dTv+mwJBK3 z#*ZgiKmVY)IsI49Oi}ye8-jzF`O`5yLoU_<85uD^Q_$7M+n=T`L{o++gjhL6eVy(C z$c7#EK}85`pTvrH0zn^fe~@bOQzSWYR3%K=#9b&o>5OAPzyh!(5+kfDE=bG(=Yv8A zY-uI+=uWMu0aWO}0P5(QS^a5kZ>|qO8X>LdPZ&$s#m~8s4nq^^snQ6U%EDBBI1J) zeO`R6%j@WiF{MT9;XS9AF@`F4X=9;_(y2F!SiUS)zn1}bk;SPMX0eCvQ}aWIQ4NUp zh=}RQv$VVrnxyKrL{%%kB!9{p4=1v&(C%E?IY4hnIIV>1X)B8}2UWQQ(=Tl5%Qcw4 z!M^cy%^#vP9ns^&>#g9%bLK!sx!1+Tf|rFJM(6)H`T>fF$?YPxbW?NhU%JVMRrw=S z*D+DX9yn&j!Zgxe_-p~!g&tZ9T-UeeU*#G0ZoE<~72a^*TP1js6w6N`i4ghYh#PzM z0-hjT8%tFU%O6>~oTwif6nO0=g@fT0Z+)=6fO!%|kS9i@iU| zHm~PIk(=`q%)w&qVFliB>fZjLv5+T$^U9;s3Y@BDFMELJ3!i>cD6+7P_u)e;Upsb0 zv4ogcea1GW0c~og1}$HLn>n3I)s%TtFA7z4PkUrmKWno;`D$t=!6Bm*QfLzl<{dQ# zjwF^}N@*Okm6x>kUYNLN@^%8%TID?mnoqttEu0j@spdBue#|f0zDLPFh0R&2uOfSC z{PSmboysTY0+gtB$x-41wV=c5tCg!@dr`=I-E_+pbI(HlyxDT;oM`33)kLok+)Jai zr?14BzJB>!Z8EdrOlx~XK4Kc@F~;SP@p`?bqXNXX_ls_uj;3U)QNKiS6OVdkK8LpG zsoN@~EIIf0H*Xo%>C}q`@y<4ftw3q6B&8z|d!3;8hI+pfmcr60%gP=+h_^FHw~jQP z-0^O*2<;U&u2X1r0~Ciud8!Y!WMR zQhK%E$&2>3Dt^bmq_5U%50ChF;2&tmHbF=863f|+z*FvYOAMIBV)hymT?1TmvXrPF z%Ib{sqE$ra5N|)(8QAwy#p7Rx1}~JdOQ`g&zze$WOB=%oVf!iIWY+{ujzTu=N|OXpaA!~FU)UF5hBxs%v#Gg4bPoODHVixSF$}r zW&6KueC+>b#cA^utfcN6(@z;W?C@mV09T+D-qj237AU5R!v?xwuxEc5v%Fo#%m}FP z-IxvYEydG~nQI8s%{UDDv7tiV`5BR1f6f z{aNd4l6t9B&Wy9ox8TvY!KqyV#ATAu!(a{UYG(p>^pru-yAt#1GBOSSr{hhikY1;) z5EoqM8KL?l$|NRY;kdlM$>s$o_Qd{YWt224l5FHUs|>CEO(DoY(hu_c_@W^TTwELV zsmd##$pLvi6566fE{phfz4^*qyr<$w8wY>Xl{wzpHvHFYi^bJ+S}5-nW+4SQpiI1R z{O+sr&*5>l$%^I94mUij6Y~WW_)c^8rjz7qIOM~M-|=SMx<;x6X&L0dS;g5@A9}(o z$#-k?#l62(*fEzb0L)E*O#G1lW|aBpli~X!Mlim2+GdvTw%H~K0MJ3R0BnKuJ==-9 zt=)EFA$|LHqerJPjNT6#c_(eR2lz?bEb5~B!GCZBbST3S{D5vbf$bqOpudjs?a-6- zzO@DYWvKrz=I&wqlSz!2r89SqW;&5Entwzo!jSj&D0jEr?L;IS0I-}A%5%1{Oy{d0`|KQbJQyMF;%h&QDG diff --git a/src/servers/mail/HISTORY b/src/servers/mail/HISTORY deleted file mode 100644 index bbac985b39..0000000000 --- a/src/servers/mail/HISTORY +++ /dev/null @@ -1,297 +0,0 @@ -Haiku Mail Daemon Replacement v3.0.3 - -VERSION HISTORY - -November 5 2005 - v3.0.3 -- Fixed up source code to compile under the newest Haiku build system. -- AGMSBayesianSpamServer renamed to "spamdbm", runtime interface between the filter and server repaired, spam MIME types and icons also revived. -- BeMail supported MIME type added for "application/x-vnd.Be.URL.mailto" as requested by tqh on BeBits. So now opening a mailto link in NetPositive only opens one BeMail window rather than two. - -January 30 2005 - v3.0.2 -- Added SMTP SSL support -- Fixed a nasty bug with Message-ID generation that was caused by incorrect headers when building on BONE - -December 6 2004 - v3.0.0 -- Fixed all known bugs -- Removed timeout crash in IMAP -- Added POP3-SSL support -- Fixed code so IMAP could compile if OpenSSL not used. -- Integrated into Haiku source tree -- Changed installation system -- Massive API update - -March 9 2004 - v2.3.0 -- Fix date parsing to handle time zone offset numbers inside round brackets. -- Handle spam messages with a malformed MIME Content-Type header that specifies multipart, but no boundary marker string. The messages show up as empty. They also sneakily have a second Content-Type that says the message is text. So, only use the multipart entry if there is no other, and only if the boundary string exists too. -- Makefiles changed to do a parallel make on multiprocessor systems. -- BeMail no longer breaks URLs in outgoing mails, at least it tries to do that. It's kind of a hack like the whole word-wrap algorithm, so it shouldn't do much more harm :) -- E-mail addresses are now properly recognized without the "mailto:" prefix. -- Doesn't keep as many file handles open as before (was using 4 per window, with the BeOS limit of 100 files open, that was a maximum of 25 BeMail windows). -- Included new icons by Stefano -- Fixed a horrible bug that would cause deletion of entire mailboxes on newly set-up IMAP accounts. -- IMAP-SSL support - -December 29 2003 - v2.2.6 -- Don't use "!" in file names of e-mail messages, the bash shell doesn't like it. -- Got the e-mail MAIL:priority attribute working. It stores it as a text string, perferably the standard 1 to 5 (high to low) levels. The words High, Normal, Low, Urgent and Non-Urgent may also show up in the attribute depending on which mailer sent the message. -- Added MS Exchange support to IMAP, fixed tons of other IMAP bugs (not that there were any in the first place.... :P) -- Added a status log notification method - -December 4 2003 - v2.2.5 -- Queries changed to be multivolume, so you can have mail directories (inbox, outbox, draft) on volumes other than /boot. -- Added new error-handling, so there aren't alert boxes. Whooo! -- Fixed all outstanding bugs in IMAP. -- More memory leaks fixed. -- General happiness. - -October 12 2003 - v2.2.4 -- Fixed IMAP's mailbox look-up routines so that they use LSUB instead of LIST. This fixes a few bugs with certain mail servers, and allows better interoperability with other mail clients on the same account. -- Added the X-Mailer header to satisfy Feature Request 788700. -- Made it so that the message count uses the correct singular/plural form, given the number of messages, in the daemon status window. -- CHECK_MEM build simply does not work with BONE, changed to get it to partially work. -- Fixed a socket handle leak in POP3. -- Fixed the magic non-dissapearing mail bug (when you use the delete-mail option in match header it would leave a temporary file in the inbox). -- Fixed a bug that caused thousands of error messages. -- Fixed a bug that caused RemoteStorageProtocols not to sync on startup. -- Fixed a bug that caused folder names to be appended to paths set by the Match Header filter. -- Some memory leaks fixed. - -September 20 2003 - v2.2.3 -- Fixed crash in POP3 protocol when the mail server was not reachable (was trying to send a QUIT command over a dead connection). -- Allowed users to drag people files (and other sorts of files) onto the Mail Status window and have them open in the user's preferred mail reader, which, in the case of people files, creates a new message addressed to the person in question. -- More IMAP bug fixes. -- Some memory leak bugs fixed. -- Added a command line script which will go through all your People files and make sure that the e-mail addresses contain valid characters. Useful for bulk e-mailing (the SMTP server will reject the whole batch if one is bad), so look for ValidatePeopleEmails.sh in the Mass Mailing folder. -- Temporary file for incoming mail created in /tmp or now in a local directory, so that the in-box can be on a different drive than /boot. Well, maybe not, all the query stuff still looks on /boot only. - -August 20 2003 - v2.2.2 -- Automatic index creation changed, use an int for the MAIL:flags, not a string! -- Use a query to find mail to send rather than scanning the Out directory (a certain person keeps thousands of his old files there and was getting annoyed at the time delay for checking mail). -- Fixed some bugs in IMAP, including one that would block ChainRunner's message queue forever. -- Fixed some random bugs in IMAP and made it so MDR doesn't redownload your whole mailbox if it crashes! Now *there* is a feature. -- Fixed window position save in BeMail - last closed window position is used for the window the next time you start BeMail. Got broken when the settings file format got changed. -- Fixed race condition where RemoteStorageProtocol was locking the node, so init was failing in the daemon. So no longer need the long delay before sending mail kludge. - -August 3 2003 - v2.2.1 -- Changed networking operations to use sockets directly rather than the buggy BeOS network kit. - -July 30 2003 - v2.2.0 -- Starting a new version for Nathan's second overhaul of the architecture: adding a fancy RemoteStorageProtocol for better IMAP (and others in the future) local vs remote mail folder synchronization. -- Fixed recently added bug in AGMSBayesianSpamServer which wouldn't let you double classify a message, even if the IgnorePreviousClassification option was on. -- Added hack to wait for spell checking dictionaries to load when you start up BeMail with the command line options to create a new message. Avoids the warning about not finding the dictionaries. - -July 15 2003 - v2.1.0rc3 -- Added Mark Heeren's alternate new mail deskbar icons to the mail daemon resource. They're a blue and red envelope, rather than the empty and full mailbox icon. Use QuickRes to copy them over the existing icons in /boot/beos/system/servers/mail_daemon if you want to use them. -- Fixed AGMSBayesianSpamServer race bug with the classification choices dialog box coming up mangled due to default sizes of controls being zero. Happens when the RefsReceived message gets processed before ReadyToRun has finished setting things up. -- Make Drafts query non-temporary, so it doesn't disappear after a few days. Also split the Today's Mail query into Received Today and Sent Today queries. -- Turn on auto-training by default in the spam filter, at "BiPolar"'s suggestion. Also modified the other default options - spam in subject off (status now shown in window title), leave server running (slow startup with hundreds of thousands of words), cutoffs made more strict (more uncertain messages, fewer errors). -- Added a couple of Japanese translations. -- IMAP bugs fixed, now handles network disconnection better. -- Also stops when it encounters an error while reading message contents from the server, rather than putting up error alerts for each and every remaining message. -- Changed BeMail to use a flattened BMessage for its settings, rather than the unreliable binary dump. -- Added an option to start with spell checking on. -- Added people's names to the auto-complete word list. So if you want to send e-mail to Dane, type a double quote then the first few letters of his name; typing "Da… will expand to "Dane Scott" . The usual pure e-mail address expansion is unchanged, typing da… without the quote mark will expand to only dane@somewhere.com. We don't have it include the name since the auto-complete is simple text substitution - would need a fancy post processing stage to figure out the right addresses and full names. -- Found some buffer overwrite bugs in SMTP which prevented some authentication methods from working. -- Moved the Save button furthur from the Send button; "Skiver" didn't like accidentally hitting Send. - -July 6 2003 - v2.1.0rc2 -- Fixed some IMAP bugs. Not all IMAP servers are the same, or even standard. -- Wipe out the /boot/beos/etc/word_index/ directory when installing, since the corrupt spell checking indices crash BeMail, and they get automatically regenerated if they aren't there. -- Installer now creates the symbolic link /boot/develop/lib/(x86|ppc)/libmail.so which the older installers accidentally deleted. -- Added Robert Paciorek's central beep modification. Use this notification method if you have several e-mail accounts and just want one beep when there's new mail in any of them (rather than separate beeps for each account with new mail). Didn't add his RS232 CTS/RTS signal line toggling code that turns on a light plugged into the serial port - not that many users would use it and it would need preferences changes to choose a serial port, etc. Contact him (http://www.bebits.com/devprofile/2771) if you want the modifications. -- Changed POP protocol to remove the period escape code at the start of a line, rather than having the editor hide it. This avoids slightly incorrect message size counts (two periods should count as one), and lots of other little related off by one problems and partial or missing message problems. -- Fixed multiple send bug. If you create several new messages per second for the same outbound account, it fired off several sender threads, and ended up sending each message several times. The threads fought over access to their configuration files (and other unrelated outbound configuration files for some reason), which often resulted in wiped out account settings and other weirdness. Now uses only one sender thread per account. -- Installer completely regenerates the MIME types for the applications and the data types text/x-email, text/x-partial-email so that the correct icons (particularly the partial e-mail one) show up. So if you had custom attributes registered for e-mail files, you'll have to re-enter them. On a related note, the Daemon now takes a command line argument of "-M" to forcibly delete the old MIME types and rebuild them, plus the existing -E argument that exits immediately if you don't have the auto-run option turned on (so it can be simply started from the boot script). -- Added a command to AGMSBayesianSpamServer to declassify mail, and the related GUI changes. So now if you decide a message shouldn't be in the database, you can change it back to Uncertain status, which will also remove its word counts from the database. Incidentally, I had to make a new dialogue box to choose spam/genuine/uncertain after exceeding the maximum number of buttons (3) for a BAlert. Also changed the logo to remove the reference to SPAM, since Hormel doesn't like having their meat product associated with junk e-mail. -- Added the spam button to BeMail. Click it to train the current message as spam and then delete the message. Right click it to bring up a menu with other training options and long descriptions of what they do (you need to train it on genuine messages too!). Also added spam menu items to the Message menu and a spam status display in the window title bar. The button, menu items, ALT-K hotkey, window title modifications all only show up if you have a spam filter configured in any one of your e-mail accounts. -- For partial e-mail downloads, the spam filter will only auto-train on the partial download, it will ignore the complete message (leaving it classified as before). That's because it doesn't know how to untrain the partial message (doesn't have the old partial message size at that point). Of course, if the spam system isn't in headers only mode, it will read the whole message anyway. - -June 26 2003 - v2.1.0rc1 -- Added US-ASCII encoding and decoding, which also uses 7bit rather than quoted printable. -- Remove leading and trailing spaces from the thread string (subject minus the Re: etc bits), since some other mail software likes adding a trailing space, which messes up the thread sorting. -- Replace NUL bytes after conversion to UTF-8 with the substitute character. This is because the BeOS ISO-2022-JP to UTF-8 conversion sometimes gets it wrong and inserts a NUL. -- Added an optional alert to warn you if you try to send a message which contains characters unencodable in the currently selected character set. -- More intelligently picks 7bit encoding if there are no 8 bit characters (for all character sets). Also uses 8bit rather than quoted printable for Latin-1, ISO-2022-JP, EUC-KR. Base64 used for SHIFT-JIS and EUC-JP. Quoted printable for all others that have 8 bit data. -- Fixed a crash bug with malformed MIME empty text attachments (had a negative contents length). -- IMAP completely rewritten from scratch. Everything that was bad about the old IMAP is gone. Everything that was good about it is gone too. New goodnesses and badnesses are here (although mostly goodnesses – I hope) -- POP3 massively upgraded for slightly greater speed (gets sizes of all messages in one bulk command, receive buffer size bumped to 10K from 1K), much less CPU usage on slow systems. -- Partial Message Downloading (double click on the message file to finish downloading). -- Reworked the protocol framework. And the add-on framework. And everything else. Except BeMail. AGMS did things to that... I'm scared of it. AGMS is too. -- Miscellaneous really awesome things. -- Spam checker now looks at file names of attachments to see if they are text files, sometimes the MIME type is specified incorrectly by those naughty spammers. -- Added instructions on how to do customized bulk e-mailing. - -April 13 2003 - v2.0.1b2 -- Make the encoding menu slide around when resizing the window. Can only do it for reading a mail message, not when composing, since pop-up menus don't resize (a BeOS bug). -- Changed encoding to work on a per-word basis to reduce the chance of making words longer than the 75 character RFC2047 limit. Will even split up a Japanese subject line with no spaces into encoded "words" which should get reassembled without spaces. -- Changed header encoding to base64 rather than quoted-printable for Asian languages, for cell phone system compatability. -- Word wrap long header lines so that if you send a message to hundreds of people, the To: header won't go over the 1000 byte line limit. -- Also recognize Content-Disposition: filename="logo.jpg" as specifying the name, though they really should use "name" rather than "filename". -- Removed query "leash" limit of 1024 max e-mail addresses in the typing auto-completion list. Note that as usual the addresses are found via query from files only on the boot volume with the META:email attribute (and META:email[2-5] too), and groups with the META:group attribute. -- Removed 128 item leash on the pop-up email address choice menu, also avoid deadlock when choosing hundreds of names (which used to exceed the message queue size) by batching them up into one operation. -- Add All People menu item, now only people not in any group are listed at the bottom of the pop-up address menu. -- Fixed a PPC (PowerPC CPU version of BeOS) bug in AGMSBayesianSpamServer (atoll wasn't working so word database wasn't read), and changed sound effect format so they work for PPC. -- Also, besides double quotes, don't encode <>,@() in the headers so that the mail system can see them. -- AGMSBayesianSpamServer now shuts down immediately and returns true if it is asked to quit by the registrar. Previously if you left it running, the system shutdown would be cancelled at AGMSBayesianSpamServer. -- Added momoziro's Undo/Redo stack to BeMail. Thanks momoziro! - -February 20 2003 - v2.0.1b1 -- Yet more Japanese translations, courtesy of Jun Suzki this time. -- Added an international install script feature. -- Fixed crash bug when using Open With…BeMail on people files (was a buffer size bug). -- Add BeOS USer Guide Replacement for the E-mail preferences aaplication. -- Do a "sync" to flush data to disk if any messages received, so that a crash soon after receiving e-mail won't lose data. -- Sort the pop-up lists of e-mail addresses by last name (formerly e-mail address). Also list people in the groups they belong to and in the main list too. Note it uses an n-squared stupid sort algorithm, so it will be slow if you have thousands of People files. -- Added an Encoding menu to chose the character set when sending mail, in case you want to temporarily override the default set in preferences. -- Also have the encoding pop-up menu let you change the character set to use for reading a message, though by default it will automatically determine it. -- Fixed up excessive <<>> around e-mail addresses in list when typing a group name. - -February 6 2003 - v2.0.0b9 -- Use quoted printable for the headers to avoid base64 extra CRLF insertion which makes a mess if the header (like Subject) is too long to fit on a line. -- Added 7bit and 8bit encoding to the library, and made BeMail use 7bit for ISO-2022-JP (base64 for other Japanese character sets). -- If a header field (CC, Subject, etc) is made empty in BeMail, also remove that header. Was causing a reply (with an automatically generated CC) to get sent to extra people even though the CC seemed to have been erased. Library code changed to accept NULL and empty value strings as meaning remove the header. -- Made install script into a one use script, so you can't accidentally run it twice (it won't work since it moved a lot of the installation files to their final resting places). -- Reduced the size of the spam database from around 1500 messages to just 10 spam and 10 genuine examples (after complaints it was too big). Accuracy will be reduced, but then you can quickly make up for it by training it when it gets it wrong (and even faster with auto-train). -- As requested by "dolgogi" in the BeBits.com talkback, I've added the ksc5601, ks_c_5601-1987 character sets as an alias for euc-kr in incoming mail (they seem to be subsets of euc-kr). Outgoing is always EUC-KR. Also, the output for EUC-KR is sent as 8bit rather than base64 or quoted printable. Sorry, unable to support iso-2022-kr. -- Fixed bug in date parsing (affecting the MAIL:when attribute) where it didn't understand the new numeric +0000 style of time zone. -- Changed file names to be a bit more readable, hopefully avoiding characters which cause problems. -- Avoid having a single period on a line; fix SMTP protocol to insert an extra period on all lines starting with a period. POP protocol should do the opposite, but for now the extra period is hidden by the display code! -- Fixed bug with missing last letter in Japanese headers by forcing it to switch to the Roman character set (could also switch to ASCII, but they are almost the same) at the end of the header. -- Compensate for Yahoo! address inside the name goofyness, find "Joe" for the name when given: "Joe " -- Added Koki's first batch of Japanese translations for text within MDR. -- Fixed up word wrapping code to fall back to the user's preferred font if the system fixed width font didn't have as many of the characters used in the message. Doesn't depend on character set choice now. -- Added some more queries to the pop-up daemon menu and changed it to largely use a zip file so it will be easier to add new ones: Today's mail, mail from someone, mail with a subject containing something. - -January 22 2003 - v2.0.0b8 -- Date format changed slightly to make it compliant to RFC-822 (some other mail apps had problems understanding it). -- decode_base64() should now work with single character line breaks as well. -- Changed default spam cutoff ratio to 0.95 to correspond to the default Chi-Squared scoring method. -- Added Uncertain spam classification as suggested by BiPolar. This also means adding a Genuine cutoff number, a new sound effect, change the prefs window, etc. -- Fixed up BeMail to use the user's character set choice (was ignoring it). -- Added a few more character set encodings, including UTF-8 for BeOS native messages. -- Made the character set choice affect the encoding of the Subject, To, CC and other header lines. So now your subject can contain international characters. -- Made it internationalize (using utf-8, no choice) the file attachment headers so file names with weird characters will now work. -- Don't convert words to lower case for spam checking, the case can be an important clue! -- Updated sample spam database: now has capitalized words and includes fresh spam. Old uncapitalized databases won't work as well. Either replace your existing one with the sample one, or be prepared for worse results until more training corrects it. -- Headers in ISO-2022-JP should now appear correctly. Fixed up header encoding so that it also turns on the encoding markers for escapes and control characters, which you see in the 7 bit encodings like ISO-2022-JP (previously it only did them when it found 8 bit characters). -- Missing Japanese text at the end, or garbage characters at the end bug fixed. Increased the conversion buffer size calculation so that the ballooning of text due to the excessive number of escape characters in ISO-2022-JP doesn't run it past the end of the buffer (both body text and headers were affected). - -December 13 2002 - v2.0.0b7 -- Fixed vman's bug with TABs after the colon in the headers making it ignore the header. -- Fixed the Forwarding with Attachments bug so it now works with X-BFile type attachments. -- Added a couple of forwarding menu items, so you get the complete set on the main menu and the right-click on the Forward button menu. -- Added full set of reply options to the right-click-on-the-reply-button menu. -- Removed old word wrap menu code from BeMail. -- Added a preferences option to attach files in BeMail without the attributes, so that users of other operating systems don't get confused by the extra attachment. -- Fixed some bugs with reading (garbage appended bug) and forwarding text attachments (didn't copy text so it sometimes crashed). -- Include preamble text when making a reply from selected text in a message. -- Added ChiSquared (Greek X is called chi, capital is Χ, lower case is χ) statistical error scoring method to AGMSBayesianSpamServer; you lose the shades of gray and get better spam/genuine/don't-know results instead. -- Reclassifying a message as spam or genuine will now also update the spam ratio attribute (it runs an EvaluateFile on it). -- Subject prefix of [Spam 99.9%] removed from the subject attribute when you evaluate a message (the number would become incorrect, and we can't tell if it is spam since the cut-off value is in the filter client, not the server). -- Implemented self-training mode in the spam filter. -- Load the database when the spam server window is displayed. -- Hide the spam server window so it doesn't flash briefly onto the screen when the program starts up. - -December 1 2002 - v2.0.0b6 -- Fixed Reply-All bug where it would get stuck in an infinite loop when it tried to remove the sender's address from the list of addresses. -- Forgot to mention spam database was updated in Beta 5 to reflect MIME decoding improvements (base64 text now decoded) and to add new spam examples. -- Fixed Reply-All CC bug where some CCed addresses weren't included. -- Added reply preamble options for full name and date, so you can have something like "Joe Who wrote on December 23 2001 18:33:" inserted in your replies. -- Fixed Draft loading so you get the From, To, CC etc instead of blanks. -- Changed MAIL:draft attribute type to be Int32 to match the index type, also create the index as INT32 (in daemon and BeMail) hopefully stopping the invisible drafts problem. You might have to do a "cd /boot ; rmindex MAIL:draft" command to remove a bad old TEXT index from before (use "cd /boot ; lsindex -l" to see what you have). - -November 29 2002 - v2.0.0b5 -- Changed readfoldedline and MIME parsing to both handle lines ending in either CRLF (the standard for Internet mail) or LF (sometimes used for local file storage). Also handles EOF and errors better. -- Fixed a bug where an empty message sub-part would cause a crash due to BString UnlockBuffer(0) not working for empty strings. This generally made it crash when it tried to open a malformed message. -- Check for IO errors while writing generic headers and copying existing MIME components. -- New "Reply With" option for the Match Header filter. -- New "Set As Read" option for the Match Header filter. -- Old style name extraction fixed so that StripGook "joe@foo.com (Joe)" will return "Joe" rather than "Jo". -- MessageIO fixed so that it doesn't reread the whole message when doing a SEEK_END, doubles performance when checking for spam! -- Added a close window box in the title bar of the E-mail preferences, acts like the Cancel button. -- Changed AGMSBayesianSpamFilter so that it checks the server's tokenize mode, and if it is JustHeaders then it will only download the headers for spam testing, rather than the entire message. -- Updated AGMSBayesianSpam documentation with a trick for spam checking without downloading the whole message, and explained the word display. - -November 20 2002 - v2.0.0b4 - - Zillions of bug fixes. Too much to mention, really - - Lots of new features (we will let you have fun discovering them) - - Profuse apologies for waiting so long to release this - - Bayesian Spam Filter included - -February 12 2002 - v2.0.0b1 - - Serious speed and stability improvements - - Friendly addon names - - Finalized, beautified, and FBC-protected API - - Crash on shutdown bug fixed - - Colored quotes - - Attachments work now :P - - Lots of other things are much better too, but I don't remember them now - -November 21 2001 - v2.0.0a2 - - Attachments that used not to be handled are handled now. - - HTML emails are displayed as the HTML source. - - Implements all stub functions programs like Postmaster expects (most functions do nothing). - - Mail handling is much faster - - Various API improvements - - Blinking lights support (Notifier) - - Really improved Deskbar menu! Uses NavMenu. Check it out! - - Right-clicking the deskbar replicant while pressing the SHIFT key gives more options - - Central Notification (uses only one Alert for all accounts). - - Changed links for bug reporting and others - - Button to enable configuration of the Deskbar Replicant menu - - Do not crash when opening pre-MDR2 emails - - Reply to Sender - - Reply to all - - Resend/Forward works - - Better Notifier Filter - - Better RuleFilter (Descriptive filter names) - - Better Folder Filter (No more email filename colisions) - - SMTP Auth now works for real - -November 06 2001 - v2.0.0 a1 - - Complete rewrite from the ground up - - Filters - - BeMail - - IMAP - - SMTP Auth - - POP3 Auth for SMTP - - Sort emails by thread in Tracker - - New Mail Kit - - All sorts of other cool stuff - -July 05 2001 - v1.0.0 b5 - - Outgoing (SMTP) mail servers are now configured per account. - - Leave messages on server now works as expected. - - You can select your default acount from the Deskbar menu (fixed). - - Add-on loading problem under BONE seems to be fixed now. - - Various other bug-fixes and performance improvements. - -June 12 2001 - v1.0.0 b4 - - E-mail preferences app completelly rewritten. Now it is cleaner, - more intuitive, and font sensitive! Please send us suggestions for - improving it. - - Added buttons to create/erase accounts. - - The Mail Status window now remembers its size and position. - - Option to never show the Mail Status window. - - More bug fixes. More error checking is now being done. - - First version of the filter API. - - Some brand new bugs for you to play with. :) - - The old mail_daemon icon is back! Thanks to Syn.Terra for it. - -June 08 2001 - v1.0.0 b3 - - Installation script now creates an index for the MAIL:account - attribute. - - mail_daemon detects if the MAIL:account exists and creates it - if it does not. - - Various bug fixes. *ALL* Deskbar crashes should be gone. - - Improved Deskbar Icon menu. - - Does not check for email immediately after starting. - -June 06 2001 - v1.0.0 b2 - - Fixed lots of bugs! - - The status window can now be made persistent. - - E-mail preferences app works better (for some definition - of better). - -June 05 2001 - v1.0.0 b1 - - First public release. \ No newline at end of file diff --git a/src/servers/mail/Jamfile b/src/servers/mail/Jamfile index f42b3025ab..1492589d48 100644 --- a/src/servers/mail/Jamfile +++ b/src/servers/mail/Jamfile @@ -7,10 +7,8 @@ if $(TARGET_PLATFORM) != haiku { } UsePublicHeaders [ FDirName add-ons mail_daemon ] ; -UsePrivateHeaders mail ; -UsePrivateHeaders shared ; - -SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; +UsePrivateHeaders mail shared tracker ; +SubDirHdrs $(HAIKU_TOP) src kits tracker ; AddResources mail_daemon : mail_daemon.rdef DeskbarViewIcons.rdef ; diff --git a/src/servers/mail/NavMenu.h b/src/servers/mail/NavMenu.h deleted file mode 100644 index 8ba3ca2006..0000000000 --- a/src/servers/mail/NavMenu.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -Open Tracker License - -Terms and Conditions - -Copyright (c) 1991-2000, Be Incorporated. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice applies to all licensees -and shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Be Incorporated shall not be -used in advertising or otherwise to promote the sale, use or other dealings in -this Software without prior written authorization from Be Incorporated. - -Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks -of Be Incorporated in the United States and other countries. Other brand product -names are registered trademarks or trademarks of their respective holders. -All rights reserved. -*/ - -// NavMenu is a hierarchical menu of volumes, folders, files and queries -// displays icons, uses the SlowMenu API for full interruptability - -#ifndef NAV_MENU_H -#define NAV_MENU_H - - -#include -#include -#include - -#include "SlowMenu.h" - -template class BObjectList; -class BMenuItem; - -namespace BPrivate { - -class Model; -class BContainerWindow; -class ModelMenuItem; -class EntryListBase; - - -class TrackingHookData { -public: - TrackingHookData() - : fTrackingHook(NULL), - fDragMessage(NULL) - {} - - bool (*fTrackingHook)(BMenu *, void *); - BMessenger fTarget; - const BMessage *fDragMessage; -}; - - -class BNavMenu : public BSlowMenu { - -public: - BNavMenu(const char* title, uint32 message, const BHandler *, - BWindow *parentWindow = NULL, const BObjectList *list = NULL); - BNavMenu(const char* title, uint32 message, const BMessenger &, - BWindow *parentWindow = NULL, const BObjectList *list = NULL); - // parentWindow, if specified, will be closed if nav menu item invoked - // with option held down - - virtual ~BNavMenu(); - - virtual void AttachedToWindow(); - virtual void DetachedFromWindow(); - - void SetNavDir(const entry_ref *); - void ForceRebuild(); - bool NeedsToRebuild() const; - // will cause menu to get rebuilt next time it is shown - - virtual void ResetTargets(); - void SetTarget(const BMessenger &); - BMessenger Target(); - - void SetTypesList(const BObjectList *list); - const BObjectList *TypesList() const; - - void AddNavDir(const Model *mode, uint32 what, BHandler *target, - bool populateSubmenu); - - static int32 GetMaxMenuWidth(); - - static int CompareFolderNamesFirstOne(const BMenuItem *, const BMenuItem *); - static int CompareOne(const BMenuItem *, const BMenuItem *); - - static ModelMenuItem *NewModelItem(Model *, const BMessage *, const BMessenger &, - bool suppressFolderHierarchy=false, BContainerWindow * = NULL, - const BObjectList *typeslist = NULL, - TrackingHookData *hook = NULL); - - TrackingHookData *InitTrackingHook(bool (*hookfunction)(BMenu *, void *), - const BMessenger *target, const BMessage *dragMessage); - -protected: - virtual bool StartBuildingItemList(); - virtual bool AddNextItem(); - virtual void DoneBuildingItemList(); - virtual void ClearMenuBuildingState(); - - void BuildVolumeMenu(); - - void AddOneItem(Model *); - void AddRootItemsIfNeeded(); - static void SetTrackingHookDeep(BMenu *, bool (*)(BMenu *, void *), void *); - - entry_ref fNavDir; - BMessage fMessage; - BMessenger fMessenger; - BWindow *fParentWindow; - - // menu building state - bool fVolsOnly; - BObjectList *fItemList; - EntryListBase *fContainer; - bool fIteratingDesktop; - - const BObjectList *fTypesList; - - TrackingHookData fTrackingHook; -}; - -// Spring Loaded Folder convenience routines -// used in both Tracker and Deskbar -#if !(defined(HAIKU_TARGET_PLATFORM_BEOS) || defined(HAIKU_TARGET_PLATFORM_BONE)) -#define _IMPEXP_TRACKER -#endif -_IMPEXP_TRACKER bool SpringLoadedFolderCompareMessages(const BMessage *incoming, - const BMessage *dragmessage); -_IMPEXP_TRACKER void SpringLoadedFolderSetMenuStates(const BMenu *menu, - const BObjectList *typeslist); -_IMPEXP_TRACKER void SpringLoadedFolderAddUniqueTypeToList(entry_ref *ref, - BObjectList *typeslist); -_IMPEXP_TRACKER void SpringLoadedFolderCacheDragData(const BMessage *incoming, - BMessage **, BObjectList **typeslist); -#if !(defined(HAIKU_TARGET_PLATFORM_BEOS) || defined(HAIKU_TARGET_PLATFORM_BONE)) -#undef _IMPEXP_TRACKER -#endif - -} // namespace BPrivate - -using namespace BPrivate; - -#endif diff --git a/src/servers/mail/SlowMenu.h b/src/servers/mail/SlowMenu.h deleted file mode 100644 index 5392a5c640..0000000000 --- a/src/servers/mail/SlowMenu.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -Open Tracker License - -Terms and Conditions - -Copyright (c) 1991-2000, Be Incorporated. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice applies to all licensees -and shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Be Incorporated shall not be -used in advertising or otherwise to promote the sale, use or other dealings in -this Software without prior written authorization from Be Incorporated. - -Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks -of Be Incorporated in the United States and other countries. Other brand product -names are registered trademarks or trademarks of their respective holders. -All rights reserved. -*/ - -#ifndef __SLOW_MENU__ -#define __SLOW_MENU__ - -#include -#include -#include - -// SlowMenu is a convenience class that makes it easier to -// use the AddDynamicItem callback to implement a menu that can -// checks periodically between creating new items and quits -// early if needed - -namespace BPrivate { - -class BSlowMenu : public BMenu { -public: - BSlowMenu(const char *title, menu_layout layout = B_ITEMS_IN_COLUMN); - -protected: - virtual bool StartBuildingItemList(); - // set up state to start building the item list - // returns false if setup failed - virtual bool AddNextItem() = 0; - // returns false if done - virtual void DoneBuildingItemList() = 0; - // default version adds items from itemList to menu and deletes - // the list; override to sort items first, etc. - - virtual void ClearMenuBuildingState() = 0; - -protected: - virtual bool AddDynamicItem(add_state state); - // this is the callback from BMenu, you shouldn't need to override this - - bool fMenuBuilt; -}; - -} // namespace BPrivate - -using namespace BPrivate; - -#endif From cdffe7e544e2a1c908b5a496e5cb35de58cc77c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 09:01:43 +0000 Subject: [PATCH 483/702] * Removed the license file as well, since it's just MIT. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42944 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/mail/LICENSE | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 src/servers/mail/LICENSE diff --git a/src/servers/mail/LICENSE b/src/servers/mail/LICENSE deleted file mode 100644 index 4fe36f12a5..0000000000 --- a/src/servers/mail/LICENSE +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (c) 2001-2005, Haiku, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -•Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -•Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -•Neither the name of the project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file From d396412d0bb696240986110a4dc8f1cdda562ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 11:32:55 +0000 Subject: [PATCH 484/702] * Ordered methods in the order of their declaration. * Minor coding style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42945 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/mail/MailDaemon.cpp | 837 ++++++++++++++++---------------- src/servers/mail/MailDaemon.h | 11 +- 2 files changed, 424 insertions(+), 424 deletions(-) diff --git a/src/servers/mail/MailDaemon.cpp b/src/servers/mail/MailDaemon.cpp index ba7e998003..688b28d86b 100644 --- a/src/servers/mail/MailDaemon.cpp +++ b/src/servers/mail/MailDaemon.cpp @@ -35,7 +35,21 @@ #define B_TRANSLATE_CONTEXT "MailDaemon" -void +struct send_mails_info { + send_mails_info() + { + totalSize = 0; + } + + vector files; + off_t totalSize; +}; + + +// #pragma mark - + + +static void makeIndices() { const char* stringIndices[] = { @@ -67,7 +81,7 @@ makeIndices() } -void +static void addAttribute(BMessage& msg, const char* name, const char* publicName, int32 type = B_STRING_TYPE, bool viewable = true, bool editable = false, int32 width = 200) @@ -212,6 +226,406 @@ MailDaemonApp::RefsReceived(BMessage* message) } +void +MailDaemonApp::MessageReceived(BMessage* msg) +{ + switch (msg->what) { + case 'moto': + if (fSettingsFile.CheckOnlyIfPPPUp()) { + // TODO: check whether internet is up and running! + } + // supposed to fall through + case kMsgCheckAndSend: // check & send messages + msg->what = kMsgSendMessages; + PostMessage(msg); + // supposed to fall trough + case kMsgCheckMessage: // check messages + GetNewMessages(msg); + break; + + case kMsgSendMessages: // send messages + SendPendingMessages(msg); + break; + + case kMsgSettingsUpdated: + fSettingsFile.Reload(); + _UpdateAutoCheck(fSettingsFile.AutoCheckInterval()); + fMailStatusWindow->SetShowCriterion(fSettingsFile.ShowStatusWindow()); + break; + + case kMsgAccountsChanged: + _ReloadAccounts(msg); + break; + + case kMsgSetStatusWindowMode: // when to show the status window + { + int32 mode; + if (msg->FindInt32("ShowStatusWindow", &mode) == B_OK) + fMailStatusWindow->SetShowCriterion(mode); + break; + } + + case kMsgMarkMessageAsRead: + { + int32 account = msg->FindInt32("account"); + entry_ref ref; + if (msg->FindRef("ref", &ref) != B_OK) + break; + read_flags read = (read_flags)msg->FindInt32("read"); + AccountMap::iterator it = fAccounts.find(account); + if (it == fAccounts.end()) + break; + InboundProtocolThread* inboundThread = it->second.inboundThread; + inboundThread->MarkMessageAsRead(ref, read); + break; + } + + case kMsgFetchBody: + RefsReceived(msg); + break; + + case 'lkch': // status window look changed + case 'wsch': // workspace changed + fMailStatusWindow->PostMessage(msg); + break; + + case 'stwg': // Status window gone + { + BMessage reply('mnuc'); + reply.AddInt32("num_new_messages", fNewMessages); + + while ((msg = fFetchDoneRespondents.RemoveItemAt(0))) { + msg->SendReply(&reply); + delete msg; + } + + if (fAlertString != B_EMPTY_STRING) { + fAlertString.Truncate(fAlertString.Length() - 1); + BAlert* alert = new BAlert(B_TRANSLATE("New Messages"), + fAlertString.String(), "OK", NULL, NULL, B_WIDTH_AS_USUAL); + alert->SetFeel(B_NORMAL_WINDOW_FEEL); + alert->Go(NULL); + fAlertString = B_EMPTY_STRING; + } + + if (fCentralBeep) { + system_beep("New E-mail"); + fCentralBeep = false; + } + break; + } + + case 'mcbp': + if (fNewMessages > 0) + fCentralBeep = true; + break; + + case kMsgCountNewMessages: // Number of new messages + { + BMessage reply('mnuc'); // Mail New message Count + if (msg->FindBool("wait_for_fetch_done")) { + fFetchDoneRespondents.AddItem(DetachCurrentMessage()); + break; + } + + reply.AddInt32("num_new_messages", fNewMessages); + msg->SendReply(&reply); + break; + } + + case 'mblk': // Mail Blink + if (fNewMessages > 0) + fLEDAnimation->Start(); + break; + + case 'enda': // End Auto Check + delete fAutoCheckRunner; + fAutoCheckRunner = NULL; + break; + + case 'numg': + { + int32 numMessages = msg->FindInt32("num_messages"); + BString numString; + + if (numMessages > 1) + fAlertString << B_TRANSLATE("%num new messages for %name\n"); + else + fAlertString << B_TRANSLATE("%num new message for %name\n"); + + numString << numMessages; + fAlertString.ReplaceFirst("%num", numString); + fAlertString.ReplaceFirst("%name", msg->FindString("name")); + break; + } + + case B_QUERY_UPDATE: + { + int32 what; + msg->FindInt32("opcode", &what); + switch (what) { + case B_ENTRY_CREATED: + fNewMessages++; + break; + case B_ENTRY_REMOVED: + fNewMessages--; + break; + } + + BString string, numString; + + if (fNewMessages > 0) { + if (fNewMessages != 1) + string << B_TRANSLATE("%num new messages."); + else + string << B_TRANSLATE("%num new message."); + + numString << fNewMessages; + string.ReplaceFirst("%num", numString); + } + else + string << B_TRANSLATE("No new messages."); + + fMailStatusWindow->SetDefaultMessage(string.String()); + break; + } + + default: + BApplication::MessageReceived(msg); + break; + } +} + + +void +MailDaemonApp::Pulse() +{ + bigtime_t idle = idle_time(); + if (fLEDAnimation->IsRunning() && idle < 100000) + fLEDAnimation->Stop(); +} + + +bool +MailDaemonApp::QuitRequested() +{ + RemoveDeskbarIcon(); + return true; +} + + +void +MailDaemonApp::InstallDeskbarIcon() +{ + BDeskbar deskbar; + + if (!deskbar.HasItem("mail_daemon")) { + BRoster roster; + entry_ref ref; + + status_t status = roster.FindApp("application/x-vnd.Be-POST", &ref); + if (status < B_OK) { + fprintf(stderr, "Can't find application to tell deskbar: %s\n", + strerror(status)); + return; + } + + status = deskbar.AddItem(&ref); + if (status < B_OK) { + fprintf(stderr, "Can't add deskbar replicant: %s\n", strerror(status)); + return; + } + } +} + + +void +MailDaemonApp::RemoveDeskbarIcon() +{ + BDeskbar deskbar; + if (deskbar.HasItem("mail_daemon")) + deskbar.RemoveItem("mail_daemon"); +} + + +void +MailDaemonApp::GetNewMessages(BMessage* msg) +{ + int32 account = -1; + if (msg->FindInt32("account", &account) == B_OK && account >= 0) { + InboundProtocolThread* protocol = _FindInboundProtocol(account); + if (!protocol) + return; + protocol->SyncMessages(); + return; + } + + // else check all accounts + AccountMap::const_iterator it = fAccounts.begin(); + for (; it != fAccounts.end(); it++) { + InboundProtocolThread* protocol = it->second.inboundThread; + if (!protocol) + continue; + protocol->SyncMessages(); + } +} + + +void +MailDaemonApp::SendPendingMessages(BMessage* msg) +{ + BVolumeRoster roster; + BVolume volume; + + map messages; + + + int32 account = -1; + if (msg->FindInt32("account", &account) != B_OK) + account = -1; + + if (!msg->HasString("message_path")) { + while (roster.GetNextVolume(&volume) == B_OK) { + BQuery query; + query.SetVolume(&volume); + query.PushAttr(B_MAIL_ATTR_FLAGS); + query.PushInt32(B_MAIL_PENDING); + query.PushOp(B_EQ); + + query.PushAttr(B_MAIL_ATTR_FLAGS); + query.PushInt32(B_MAIL_PENDING | B_MAIL_SAVE); + query.PushOp(B_EQ); + + if (account >= 0) { + query.PushAttr(B_MAIL_ATTR_ACCOUNT_ID); + query.PushInt32(account); + query.PushOp(B_EQ); + query.PushOp(B_AND); + } + + query.PushOp(B_OR); + query.Fetch(); + BEntry entry; + while (query.GetNextEntry(&entry) == B_OK) { + if (_IsEntryInTrash(entry)) + continue; + + BNode node; + while (node.SetTo(&entry) == B_BUSY) + snooze(1000); + if (!_IsPending(node)) + continue; + + int32 messageAccount; + if (node.ReadAttr(B_MAIL_ATTR_ACCOUNT_ID, B_INT32_TYPE, 0, + &messageAccount, sizeof(int32)) < 0) + messageAccount = -1; + + off_t size = 0; + node.GetSize(&size); + entry_ref ref; + entry.GetRef(&ref); + + messages[messageAccount].files.push_back(ref); + messages[messageAccount].totalSize += size; + } + } + } else { + const char* path; + if (msg->FindString("message_path", &path) != B_OK) + return; + + off_t size = 0; + if (BNode(path).GetSize(&size) != B_OK) + return; + BEntry entry(path); + entry_ref ref; + entry.GetRef(&ref); + + messages[account].files.push_back(ref); + messages[account].totalSize += size; + } + + map::iterator iter = messages.begin(); + for (; iter != messages.end(); iter++) { + OutboundProtocolThread* protocolThread = _FindOutboundProtocol( + iter->first); + if (!protocolThread) + continue; + + send_mails_info& info = iter->second; + if (info.files.size() == 0) + continue; + + MailProtocol* protocol = protocolThread->Protocol(); + + protocolThread->Lock(); + protocol->SetTotalItems(info.files.size()); + protocol->SetTotalItemsSize(info.totalSize); + protocolThread->Unlock(); + + protocolThread->SendMessages(iter->second.files, info.totalSize); + } +} + + +void +MailDaemonApp::MakeMimeTypes(bool remakeMIMETypes) +{ + // Add MIME database entries for the e-mail file types we handle. Either + // do a full rebuild from nothing, or just add on the new attributes that + // we support which the regular BeOS mail daemon didn't have. + + const uint8 kNTypes = 2; + const char* types[kNTypes] = {"text/x-email", "text/x-partial-email"}; + + for (size_t i = 0; i < kNTypes; i++) { + BMessage info; + BMimeType mime(types[i]); + if (mime.InitCheck() != B_OK) { + fputs("could not init mime type.\n", stderr); + return; + } + + if (!mime.IsInstalled() || remakeMIMETypes) { + // install the full mime type + mime.Delete(); + mime.Install(); + + // Set up the list of e-mail related attributes that Tracker will + // let you display in columns for e-mail messages. + addAttribute(info, B_MAIL_ATTR_NAME, "Name"); + addAttribute(info, B_MAIL_ATTR_SUBJECT, "Subject"); + addAttribute(info, B_MAIL_ATTR_TO, "To"); + addAttribute(info, B_MAIL_ATTR_CC, "Cc"); + addAttribute(info, B_MAIL_ATTR_FROM, "From"); + addAttribute(info, B_MAIL_ATTR_REPLY, "Reply To"); + addAttribute(info, B_MAIL_ATTR_STATUS, "Status"); + addAttribute(info, B_MAIL_ATTR_PRIORITY, "Priority", B_STRING_TYPE, + true, true, 40); + addAttribute(info, B_MAIL_ATTR_WHEN, "When", B_TIME_TYPE, true, + false, 150); + addAttribute(info, B_MAIL_ATTR_THREAD, "Thread"); + addAttribute(info, B_MAIL_ATTR_ACCOUNT, "Account", B_STRING_TYPE, + true, false, 100); + addAttribute(info, B_MAIL_ATTR_READ, "Read", B_INT32_TYPE, + true, false, 70); + mime.SetAttrInfo(&info); + + if (i == 0) { + mime.SetShortDescription("E-mail"); + mime.SetLongDescription("Electronic Mail Message"); + mime.SetPreferredApp("application/x-vnd.Be-MAIL"); + } else { + mime.SetShortDescription("Partial E-mail"); + mime.SetLongDescription("A Partially Downloaded E-mail"); + mime.SetPreferredApp("application/x-vnd.Be-MAIL"); + } + } + } +} + + void MailDaemonApp::_InitAccounts() { @@ -400,423 +814,9 @@ MailDaemonApp::_UpdateAutoCheck(bigtime_t interval) } -void -MailDaemonApp::MessageReceived(BMessage* msg) -{ - switch (msg->what) { - case 'moto': - if (fSettingsFile.CheckOnlyIfPPPUp()) { - // TODO: check whether internet is up and running! - } - // supposed to fall through - case kMsgCheckAndSend: // check & send messages - msg->what = kMsgSendMessages; - PostMessage(msg); - // supposed to fall trough - case kMsgCheckMessage: // check messages - GetNewMessages(msg); - break; - - case kMsgSendMessages: // send messages - SendPendingMessages(msg); - break; - - case kMsgSettingsUpdated: - fSettingsFile.Reload(); - _UpdateAutoCheck(fSettingsFile.AutoCheckInterval()); - fMailStatusWindow->SetShowCriterion(fSettingsFile.ShowStatusWindow()); - break; - - case kMsgAccountsChanged: - _ReloadAccounts(msg); - break; - - case kMsgSetStatusWindowMode: // when to show the status window - { - int32 mode; - if (msg->FindInt32("ShowStatusWindow", &mode) == B_OK) - fMailStatusWindow->SetShowCriterion(mode); - break; - } - - case kMsgMarkMessageAsRead: - { - int32 account = msg->FindInt32("account"); - entry_ref ref; - if (msg->FindRef("ref", &ref) != B_OK) - break; - read_flags read = (read_flags)msg->FindInt32("read"); - AccountMap::iterator it = fAccounts.find(account); - if (it == fAccounts.end()) - break; - InboundProtocolThread* inboundThread = it->second.inboundThread; - inboundThread->MarkMessageAsRead(ref, read); - break; - } - - case kMsgFetchBody: - RefsReceived(msg); - break; - - case 'lkch': // status window look changed - case 'wsch': // workspace changed - fMailStatusWindow->PostMessage(msg); - break; - - case 'stwg': // Status window gone - { - BMessage reply('mnuc'); - reply.AddInt32("num_new_messages", fNewMessages); - - while ((msg = fFetchDoneRespondents.RemoveItemAt(0))) { - msg->SendReply(&reply); - delete msg; - } - - if (fAlertString != B_EMPTY_STRING) { - fAlertString.Truncate(fAlertString.Length() - 1); - BAlert* alert = new BAlert(B_TRANSLATE("New Messages"), - fAlertString.String(), "OK", NULL, NULL, B_WIDTH_AS_USUAL); - alert->SetFeel(B_NORMAL_WINDOW_FEEL); - alert->Go(NULL); - fAlertString = B_EMPTY_STRING; - } - - if (fCentralBeep) { - system_beep("New E-mail"); - fCentralBeep = false; - } - break; - } - - case 'mcbp': - if (fNewMessages > 0) - fCentralBeep = true; - break; - - case kMsgCountNewMessages: // Number of new messages - { - BMessage reply('mnuc'); // Mail New message Count - if (msg->FindBool("wait_for_fetch_done")) { - fFetchDoneRespondents.AddItem(DetachCurrentMessage()); - break; - } - - reply.AddInt32("num_new_messages", fNewMessages); - msg->SendReply(&reply); - break; - } - - case 'mblk': // Mail Blink - if (fNewMessages > 0) - fLEDAnimation->Start(); - break; - - case 'enda': // End Auto Check - delete fAutoCheckRunner; - fAutoCheckRunner = NULL; - break; - - case 'numg': - { - int32 numMessages = msg->FindInt32("num_messages"); - BString numString; - - if (numMessages > 1) - fAlertString << B_TRANSLATE("%num new messages for %name\n"); - else - fAlertString << B_TRANSLATE("%num new message for %name\n"); - - numString << numMessages; - fAlertString.ReplaceFirst("%num", numString); - fAlertString.ReplaceFirst("%name", msg->FindString("name")); - break; - } - - case B_QUERY_UPDATE: - { - int32 what; - msg->FindInt32("opcode", &what); - switch (what) { - case B_ENTRY_CREATED: - fNewMessages++; - break; - case B_ENTRY_REMOVED: - fNewMessages--; - break; - } - - BString string, numString; - - if (fNewMessages > 0) { - if (fNewMessages != 1) - string << B_TRANSLATE("%num new messages."); - else - string << B_TRANSLATE("%num new message."); - - numString << fNewMessages; - string.ReplaceFirst("%num", numString); - } - else - string << B_TRANSLATE("No new messages."); - - fMailStatusWindow->SetDefaultMessage(string.String()); - break; - } - - default: - BApplication::MessageReceived(msg); - break; - } -} - - -void -MailDaemonApp::InstallDeskbarIcon() -{ - BDeskbar deskbar; - - if (!deskbar.HasItem("mail_daemon")) { - BRoster roster; - entry_ref ref; - - status_t status = roster.FindApp("application/x-vnd.Be-POST", &ref); - if (status < B_OK) { - fprintf(stderr, "Can't find application to tell deskbar: %s\n", - strerror(status)); - return; - } - - status = deskbar.AddItem(&ref); - if (status < B_OK) { - fprintf(stderr, "Can't add deskbar replicant: %s\n", strerror(status)); - return; - } - } -} - - -void -MailDaemonApp::RemoveDeskbarIcon() -{ - BDeskbar deskbar; - if (deskbar.HasItem("mail_daemon")) - deskbar.RemoveItem("mail_daemon"); -} - - -bool -MailDaemonApp::QuitRequested() -{ - RemoveDeskbarIcon(); - - return true; -} - - -void -MailDaemonApp::GetNewMessages(BMessage* msg) -{ - int32 account = -1; - if (msg->FindInt32("account", &account) == B_OK && account >= 0) { - InboundProtocolThread* protocol = _FindInboundProtocol(account); - if (!protocol) - return; - protocol->SyncMessages(); - return; - } - - // else check all accounts - AccountMap::const_iterator it = fAccounts.begin(); - for (; it != fAccounts.end(); it++) { - InboundProtocolThread* protocol = it->second.inboundThread; - if (!protocol) - continue; - protocol->SyncMessages(); - } -} - - -void -MailDaemonApp::MakeMimeTypes(bool remakeMIMETypes) -{ - // Add MIME database entries for the e-mail file types we handle. Either - // do a full rebuild from nothing, or just add on the new attributes that - // we support which the regular BeOS mail daemon didn't have. - - const uint8 kNTypes = 2; - const char* types[kNTypes] = {"text/x-email", "text/x-partial-email"}; - - for (size_t i = 0; i < kNTypes; i++) { - BMessage info; - BMimeType mime(types[i]); - if (mime.InitCheck() != B_OK) { - fputs("could not init mime type.\n", stderr); - return; - } - - if (!mime.IsInstalled() || remakeMIMETypes) { - // install the full mime type - mime.Delete(); - mime.Install(); - - // Set up the list of e-mail related attributes that Tracker will - // let you display in columns for e-mail messages. - addAttribute(info, B_MAIL_ATTR_NAME, "Name"); - addAttribute(info, B_MAIL_ATTR_SUBJECT, "Subject"); - addAttribute(info, B_MAIL_ATTR_TO, "To"); - addAttribute(info, B_MAIL_ATTR_CC, "Cc"); - addAttribute(info, B_MAIL_ATTR_FROM, "From"); - addAttribute(info, B_MAIL_ATTR_REPLY, "Reply To"); - addAttribute(info, B_MAIL_ATTR_STATUS, "Status"); - addAttribute(info, B_MAIL_ATTR_PRIORITY, "Priority", B_STRING_TYPE, - true, true, 40); - addAttribute(info, B_MAIL_ATTR_WHEN, "When", B_TIME_TYPE, true, - false, 150); - addAttribute(info, B_MAIL_ATTR_THREAD, "Thread"); - addAttribute(info, B_MAIL_ATTR_ACCOUNT, "Account", B_STRING_TYPE, - true, false, 100); - addAttribute(info, B_MAIL_ATTR_READ, "Read", B_INT32_TYPE, - true, false, 70); - mime.SetAttrInfo(&info); - - if (i == 0) { - mime.SetShortDescription("E-mail"); - mime.SetLongDescription("Electronic Mail Message"); - mime.SetPreferredApp("application/x-vnd.Be-MAIL"); - } else { - mime.SetShortDescription("Partial E-mail"); - mime.SetLongDescription("A Partially Downloaded E-mail"); - mime.SetPreferredApp("application/x-vnd.Be-MAIL"); - } - } - } -} - - -struct send_mails_info { - send_mails_info() - { - totalSize = 0; - } - vector files; - off_t totalSize; -}; - - -void -MailDaemonApp::SendPendingMessages(BMessage* msg) -{ - BVolumeRoster roster; - BVolume volume; - - map messages; - - - int32 account = -1; - if (msg->FindInt32("account", &account) != B_OK) - account = -1; - - if (!msg->HasString("message_path")) { - while (roster.GetNextVolume(&volume) == B_OK) { - BQuery query; - query.SetVolume(&volume); - query.PushAttr(B_MAIL_ATTR_FLAGS); - query.PushInt32(B_MAIL_PENDING); - query.PushOp(B_EQ); - - query.PushAttr(B_MAIL_ATTR_FLAGS); - query.PushInt32(B_MAIL_PENDING | B_MAIL_SAVE); - query.PushOp(B_EQ); - - if (account >= 0) { - query.PushAttr(B_MAIL_ATTR_ACCOUNT_ID); - query.PushInt32(account); - query.PushOp(B_EQ); - query.PushOp(B_AND); - } - - query.PushOp(B_OR); - query.Fetch(); - BEntry entry; - while (query.GetNextEntry(&entry) == B_OK) { - if (_IsEntryInTrash(entry)) - continue; - - BNode node; - while (node.SetTo(&entry) == B_BUSY) - snooze(1000); - if (!_IsPending(node)) - continue; - - int32 messageAccount; - if (node.ReadAttr(B_MAIL_ATTR_ACCOUNT_ID, B_INT32_TYPE, 0, - &messageAccount, sizeof(int32)) < 0) - messageAccount = -1; - - off_t size = 0; - node.GetSize(&size); - entry_ref ref; - entry.GetRef(&ref); - - messages[messageAccount].files.push_back(ref); - messages[messageAccount].totalSize += size; - } - } - } else { - const char* path; - if (msg->FindString("message_path", &path) != B_OK) - return; - - off_t size = 0; - if (BNode(path).GetSize(&size) != B_OK) - return; - BEntry entry(path); - entry_ref ref; - entry.GetRef(&ref); - - messages[account].files.push_back(ref); - messages[account].totalSize += size; - } - - map::iterator iter = messages.begin(); - for (; iter != messages.end(); iter++) { - OutboundProtocolThread* protocolThread = _FindOutboundProtocol( - iter->first); - if (!protocolThread) - continue; - - send_mails_info& info = iter->second; - if (info.files.size() == 0) - continue; - - MailProtocol* protocol = protocolThread->Protocol(); - - protocolThread->Lock(); - protocol->SetTotalItems(info.files.size()); - protocol->SetTotalItemsSize(info.totalSize); - protocolThread->Unlock(); - - protocolThread->SendMessages(iter->second.files, info.totalSize); - } - -} - - -void -MailDaemonApp::Pulse() -{ - bigtime_t idle = idle_time(); - if (fLEDAnimation->IsRunning() && idle < 100000) - fLEDAnimation->Stop(); -} - - /*! Work-around for a broken index that contains out-of-date information. */ - -/* static */ -bool +/*static*/ bool MailDaemonApp::_IsPending(BNode& node) { int32 flags; @@ -828,8 +828,7 @@ MailDaemonApp::_IsPending(BNode& node) } -/* static */ -bool +/*static*/ bool MailDaemonApp::_IsEntryInTrash(BEntry& entry) { entry_ref ref; diff --git a/src/servers/mail/MailDaemon.h b/src/servers/mail/MailDaemon.h index 82a0721d80..212c1f7c01 100644 --- a/src/servers/mail/MailDaemon.h +++ b/src/servers/mail/MailDaemon.h @@ -50,18 +50,18 @@ public: MailDaemonApp(); virtual ~MailDaemonApp(); - virtual void MessageReceived(BMessage* message); + virtual void ReadyToRun(); virtual void RefsReceived(BMessage* message); + virtual void MessageReceived(BMessage* message); virtual void Pulse(); virtual bool QuitRequested(); - virtual void ReadyToRun(); void InstallDeskbarIcon(); void RemoveDeskbarIcon(); - void SendPendingMessages(BMessage* message); void GetNewMessages(BMessage* message); + void SendPendingMessages(BMessage* message); void MakeMimeTypes(bool remakeMIMETypes = false); @@ -82,6 +82,7 @@ private: OutboundProtocolThread* _FindOutboundProtocol(int32 account); void _UpdateAutoCheck(bigtime_t interval); + static bool _IsPending(BNode& node); static bool _IsEntryInTrash(BEntry& entry); @@ -97,8 +98,8 @@ private: // account. // Set to TRUE by the 'mcbp' message that the mail Notification // filter sends us, cleared when the beep is done. - BObjectList fFetchDoneRespondents; - BObjectList fQueries; + BObjectList fFetchDoneRespondents; + BObjectList fQueries; LEDAnimation* fLEDAnimation; From 4b2c09b6b34063de5c7625c6846ff547cff23cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 12:16:11 +0000 Subject: [PATCH 485/702] * Style cleanup. * Changed quote from double to uint64. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42946 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../imap/IMAPFolderConfig.cpp | 125 ++++++++++-------- .../imap/IMAPInboundProtocol.h | 9 +- .../imap/IMAPRootInboundProtocol.cpp | 4 +- .../inbound_protocols/imap/imap_config.cpp | 36 ++--- .../imap/imap_lib/IMAPFolders.cpp | 18 +-- .../imap/imap_lib/IMAPFolders.h | 2 +- .../imap/imap_lib/IMAPHandler.cpp | 94 ++++++++----- .../imap/imap_lib/IMAPHandler.h | 20 +-- .../imap/imap_lib/IMAPMailbox.cpp | 10 +- .../imap/imap_lib/IMAPParser.cpp | 10 +- .../imap/imap_lib/IMAPProtocol.cpp | 11 +- .../imap/imap_lib/IMAPStorage.cpp | 34 +++-- .../imap/imap_lib/IMAPStorage.h | 7 +- 13 files changed, 222 insertions(+), 158 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp index 70e1d4cee5..214730d1c8 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp @@ -39,14 +39,6 @@ protected: }; -EditableListItem::EditableListItem() - : - fListView(NULL) -{ - -} - - class CheckBoxItem : public BStringItem, public EditableListItem { public: CheckBoxItem(const char* text, bool checked); @@ -65,6 +57,67 @@ private: }; +class EditListView : public BListView { +public: + EditListView(const char* name, + list_view_type type + = B_SINGLE_SELECTION_LIST, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS + | B_NAVIGABLE); + + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); + virtual void FrameResized(float newWidth, float newHeight); + +private: + EditableListItem* fLastMouseDown; +}; + + +class StatusWindow : public BWindow { +public: + StatusWindow(const char* text) + : + BWindow(BRect(0, 0, 10, 10), B_TRANSLATE("status"), B_MODAL_WINDOW_LOOK, + B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE + | B_AVOID_FRONT | B_NOT_RESIZABLE) + { + BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL, + B_WILL_DRAW); + AddChild(rootView); + rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + float spacing = be_control_look->DefaultItemSpacing(); + BALMLayout* layout = new BALMLayout(spacing); + rootView->SetLayout(layout); + layout->SetInset(spacing); + + BStringView* string = new BStringView("text", text); + layout->AddView(string, layout->Left(), layout->Top(), layout->Right(), + layout->Bottom()); + BSize min = layout->MinSize(); + ResizeTo(min.Width(), min.Height()); + CenterOnScreen(); + } +}; + + +const uint32 kMsgApplyButton = '&Abu'; +const uint32 kMsgInit = '&Ini'; + + +// #pragma mark - + + +EditableListItem::EditableListItem() + : + fListView(NULL) +{ + +} + + +// #pragma mark - + CheckBoxItem::CheckBoxItem(const char* text, bool checked) : @@ -134,21 +187,7 @@ CheckBoxItem::MouseUp(BPoint where) } -class EditListView : public BListView { -public: - EditListView(const char* name, - list_view_type type - = B_SINGLE_SELECTION_LIST, - uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS - | B_NAVIGABLE); - - virtual void MouseDown(BPoint where); - virtual void MouseUp(BPoint where); - virtual void FrameResized(float newWidth, float newHeight); - -private: - EditableListItem* fLastMouseDown; -}; +// #pragma mark - EditListView::EditListView(const char* name, list_view_type type, uint32 flags) @@ -156,7 +195,7 @@ EditListView::EditListView(const char* name, list_view_type type, uint32 flags) BListView(name, type, flags), fLastMouseDown(NULL) { - + } @@ -201,42 +240,14 @@ EditListView::FrameResized(float newWidth, float newHeight) } -class StatusWindow : public BWindow { -public: - StatusWindow(const char* text) - : - BWindow(BRect(0, 0, 10, 10), B_TRANSLATE("status"), B_MODAL_WINDOW_LOOK, - B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE - | B_AVOID_FRONT | B_NOT_RESIZABLE) - { - BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL, - B_WILL_DRAW); - AddChild(rootView); - rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - float spacing = be_control_look->DefaultItemSpacing(); - BALMLayout* layout = new BALMLayout(spacing); - rootView->SetLayout(layout); - layout->SetInset(spacing); - - BStringView* string = new BStringView("text", text); - layout->AddView(string, layout->Left(), layout->Top(), layout->Right(), - layout->Bottom()); - BSize min = layout->MinSize(); - ResizeTo(min.Width(), min.Height()); - CenterOnScreen(); - } -}; - - -const uint32 kMsgApplyButton = '&Abu'; -const uint32 kMsgInit = '&Ini'; +// #pragma mark - FolderConfigWindow::FolderConfigWindow(BRect parent, const BMessage& settings) : BWindow(BRect(0, 0, 300, 300), B_TRANSLATE("IMAP Folders"), - B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION - | B_NOT_ZOOMABLE | B_AVOID_FRONT), + B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, + B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE | B_AVOID_FRONT), fSettings(settings) { BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL, B_WILL_DRAW); @@ -316,7 +327,7 @@ FolderConfigWindow::_LoadFolders() BString password; char* passwd = get_passwd(&fSettings, "cpasswd"); - if (passwd) { + if (passwd != NULL) { password = passwd; delete[] passwd; } @@ -331,7 +342,7 @@ FolderConfigWindow::_LoadFolders() item->SetListView(fFolderListView); } - double used, total; + uint64 used, total; if (fIMAPFolders.GetQuota(used, total) == B_OK) { char buffer[256]; BString quotaString = "Server storage: "; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.h b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.h index a06380c8bd..954a1fc685 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.h @@ -42,9 +42,6 @@ private: class IMAPInboundProtocol; -int32 watch_mailbox(void* data); - - /*! Just wait for a IDLE (watching) IMAP response in this thread. */ class IMAPMailboxThread { public: @@ -57,11 +54,11 @@ public: status_t StopWatchingMailbox(); private: + static status_t _WatchThreadFunction(void* data); void _Watch(); - friend int32 watch_mailbox(void* data); - - IMAPInboundProtocol& fProtocol; +private: + IMAPInboundProtocol& fProtocol; IMAPMailbox& fIMAPMailbox; BLocker fLock; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPRootInboundProtocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPRootInboundProtocol.cpp index 2f24efb528..b7e49275d8 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPRootInboundProtocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPRootInboundProtocol.cpp @@ -16,7 +16,6 @@ IMAPRootInboundProtocol::IMAPRootInboundProtocol(BMailAccountSettings* settings) : IMAPInboundProtocol(settings, "INBOX") { - } @@ -179,6 +178,9 @@ IMAPRootInboundProtocol::_FindThreadFor(const entry_ref& ref) } +// #pragma mark - + + InboundProtocol* instantiate_inbound_protocol(BMailAccountSettings* settings) { diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_config.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_config.cpp index 8169baaaa0..b5128c0914 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_config.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_config.cpp @@ -66,13 +66,13 @@ IMAPConfig::IMAPConfig(MailAddonSettings& settings, SetTo(settings); - ((BControl *)(FindView("leave_mail_on_server")))->SetValue(B_CONTROL_ON); - ((BControl *)(FindView("leave_mail_on_server")))->Hide(); + ((BControl*)(FindView("leave_mail_on_server")))->SetValue(B_CONTROL_ON); + ((BControl*)(FindView("leave_mail_on_server")))->Hide(); BRect frame = FindView("delete_remote_when_local")->Frame(); - ((BControl *)(FindView("delete_remote_when_local")))->SetEnabled(true); - ((BControl *)(FindView("delete_remote_when_local")))->MoveBy(0, -25); + ((BControl*)(FindView("delete_remote_when_local")))->SetEnabled(true); + ((BControl*)(FindView("delete_remote_when_local")))->MoveBy(0, -25); fIMAPFolderButton = new BButton(frame, "IMAP Folders", B_TRANSLATE( "IMAP Folders"), new BMessage(kMsgOpenIMAPFolder)); @@ -83,7 +83,7 @@ IMAPConfig::IMAPConfig(MailAddonSettings& settings, BPath defaultFolder = BPrivate::default_mail_directory(); defaultFolder.Append(accountSettings.Name()); - fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), + fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), "destination", false, defaultFolder.Path()); fFileView->SetTo(&settings.Settings(), NULL); AddChild(fFileView); @@ -95,7 +95,6 @@ IMAPConfig::IMAPConfig(MailAddonSettings& settings, IMAPConfig::~IMAPConfig() { - } @@ -119,18 +118,18 @@ void IMAPConfig::MessageReceived(BMessage* message) { switch (message->what) { - case kMsgOpenIMAPFolder: - { - BMessage settings; - Archive(&settings); - BWindow* window = new FolderConfigWindow(Window()->Frame(), - settings); - window->Show(); - break; - } + case kMsgOpenIMAPFolder: + { + BMessage settings; + Archive(&settings); + BWindow* window = new FolderConfigWindow(Window()->Frame(), + settings); + window->Show(); + break; + } - default: - BMailProtocolConfigView::MessageReceived(message); + default: + BMailProtocolConfigView::MessageReceived(message); } } @@ -142,6 +141,9 @@ IMAPConfig::AttachedToWindow() } +// #pragma mark - + + BView* instantiate_config_panel(MailAddonSettings& settings, BMailAccountSettings& accountSettings) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPFolders.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPFolders.cpp index b64fea79cb..6d16ab2bf2 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPFolders.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPFolders.cpp @@ -29,16 +29,16 @@ IMAPFolders::GetFolders(FolderList& folders) status_t status = _GetAllFolders(allFolders); if (status != B_OK) return status; - StringList subscibedFolders; - status = _GetSubscribedFolders(subscibedFolders); + StringList subscribedFolders; + status = _GetSubscribedFolders(subscribedFolders); if (status != B_OK) return status; for (unsigned int i = 0; i < allFolders.size(); i++) { FolderInfo info; info.folder = allFolders[i]; - for (unsigned int a = 0; a < subscibedFolders.size(); a++) { - if (allFolders[i] == subscibedFolders[a] + for (unsigned int a = 0; a < subscribedFolders.size(); a++) { + if (allFolders[i] == subscribedFolders[a] || allFolders[i].ICompare("INBOX") == 0) { info.subscribed = true; break; @@ -48,10 +48,10 @@ IMAPFolders::GetFolders(FolderList& folders) } // you could be subscribed to a folder which not exist currently, add them: - for (unsigned int a = 0; a < subscibedFolders.size(); a++) { + for (unsigned int a = 0; a < subscribedFolders.size(); a++) { bool isInlist = false; for (unsigned int i = 0; i < allFolders.size(); i++) { - if (subscibedFolders[a] == allFolders[i]) { + if (subscribedFolders[a] == allFolders[i]) { isInlist = true; break; } @@ -60,7 +60,7 @@ IMAPFolders::GetFolders(FolderList& folders) continue; FolderInfo info; - info.folder = subscibedFolders[a]; + info.folder = subscribedFolders[a]; info.subscribed = true; folders.push_back(info); } @@ -86,7 +86,7 @@ IMAPFolders::UnsubscribeFolder(const char* folder) status_t -IMAPFolders::GetQuota(double& used, double& total) +IMAPFolders::GetQuota(uint64& used, uint64& total) { if (fCapabilityHandler.Capabilities() == "") ProcessCommand(fCapabilityHandler.Command()); @@ -100,7 +100,7 @@ IMAPFolders::GetQuota(double& used, double& total) used = quotaCommand.UsedStorage(); total = quotaCommand.TotalStorage(); - return status; + return B_OK; } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPFolders.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPFolders.h index 5d72745689..8f230b02bc 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPFolders.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPFolders.h @@ -39,7 +39,7 @@ public: status_t SubscribeFolder(const char* folder); status_t UnsubscribeFolder(const char* folder); - status_t GetQuota(double& used, double& total); + status_t GetQuota(uint64& used, uint64& total); private: status_t _GetAllFolders(StringList& folders); status_t _GetSubscribedFolders(StringList& folders); diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp index 0b5510fa81..695f8693fc 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp @@ -7,7 +7,7 @@ #include "IMAPHandler.h" -#include // for atoi +#include #include @@ -17,12 +17,11 @@ #define DEBUG_IMAP_HANDLER - #ifdef DEBUG_IMAP_HANDLER -#include -#define TRACE(x...) printf(x) +# include +# define TRACE(x...) printf(x) #else -#define TRACE(x...) /* nothing */ +# define TRACE(x...) ; #endif @@ -31,7 +30,6 @@ using namespace BPrivate; IMAPCommand::~IMAPCommand() { - } @@ -48,16 +46,17 @@ IMAPMailboxCommand::IMAPMailboxCommand(IMAPMailbox& mailbox) fStorage(mailbox.GetStorage()), fConnectionReader(mailbox.GetConnectionReader()) { - } IMAPMailboxCommand::~IMAPMailboxCommand() { - } +// #pragma mark - + + MailboxSelectHandler::MailboxSelectHandler(IMAPMailbox& mailbox) : IMAPMailboxCommand(mailbox), @@ -66,7 +65,6 @@ MailboxSelectHandler::MailboxSelectHandler(IMAPMailbox& mailbox) fNextUID(-1), fUIDValidity(-1) { - } @@ -105,11 +103,13 @@ MailboxSelectHandler::Handle(const BString& response) } +// #pragma mark - + + CapabilityHandler::CapabilityHandler() : fCapabilities("") { - } @@ -139,7 +139,7 @@ CapabilityHandler::Capabilities() } -// FetchHandler +// #pragma mark - FetchMinMessageCommand::FetchMinMessageCommand(IMAPMailbox& mailbox, @@ -152,7 +152,6 @@ FetchMinMessageCommand::FetchMinMessageCommand(IMAPMailbox& mailbox, fMinMessageList(list), fData(data) { - } @@ -167,7 +166,6 @@ FetchMinMessageCommand::FetchMinMessageCommand(IMAPMailbox& mailbox, fMinMessageList(list), fData(data) { - } @@ -255,6 +253,9 @@ FetchMinMessageCommand::ExtractFlags(const BString& response) } +// #pragma mark - + + FetchMessageListCommand::FetchMessageListCommand(IMAPMailbox& mailbox, MinMessageList* list, int32 nextId) : @@ -263,7 +264,6 @@ FetchMessageListCommand::FetchMessageListCommand(IMAPMailbox& mailbox, fMinMessageList(list), fNextId(nextId) { - } @@ -294,6 +294,9 @@ FetchMessageListCommand::Handle(const BString& response) } +// #pragma mark - + + FetchMessageCommand::FetchMessageCommand(IMAPMailbox& mailbox, int32 message, BPositionIO* data, int32 fetchBodyLimit) : @@ -304,7 +307,6 @@ FetchMessageCommand::FetchMessageCommand(IMAPMailbox& mailbox, int32 message, fOutData(data), fFetchBodyLimit(fetchBodyLimit) { - } @@ -431,6 +433,9 @@ FetchMessageCommand::Handle(const BString& response) } +// #pragma mark - + + FetchBodyCommand::FetchBodyCommand(IMAPMailbox& mailbox, int32 message, BPositionIO* data) : @@ -439,7 +444,6 @@ FetchBodyCommand::FetchBodyCommand(IMAPMailbox& mailbox, int32 message, fMessage(message), fOutData(data) { - } @@ -502,6 +506,9 @@ FetchBodyCommand::Handle(const BString& response) } +// #pragma mark - + + SetFlagsCommand::SetFlagsCommand(IMAPMailbox& mailbox, int32 message, int32 flags) : @@ -552,6 +559,9 @@ SetFlagsCommand::GenerateFlagList(int32 flags) } +// #pragma mark - + + AppendCommand::AppendCommand(IMAPMailbox& mailbox, BPositionIO& message, off_t size, int32 flags, time_t time) : @@ -562,7 +572,6 @@ AppendCommand::AppendCommand(IMAPMailbox& mailbox, BPositionIO& message, fFlags(flags), fTime(time) { - } @@ -607,13 +616,16 @@ AppendCommand::Handle(const BString& response) } +// #pragma mark - + + ExistsHandler::ExistsHandler(IMAPMailbox& mailbox) : IMAPMailboxCommand(mailbox) { - } + bool ExistsHandler::Handle(const BString& response) { @@ -647,13 +659,16 @@ ExistsHandler::Handle(const BString& response) } +// #pragma mark - + + ExpungeCommmand::ExpungeCommmand(IMAPMailbox& mailbox) : IMAPMailboxCommand(mailbox) { - } + BString ExpungeCommmand::Command() { @@ -668,13 +683,16 @@ ExpungeCommmand::Handle(const BString& response) } +// #pragma mark - + + ExpungeHandler::ExpungeHandler(IMAPMailbox& mailbox) : IMAPMailboxCommand(mailbox) { - } + bool ExpungeHandler::Handle(const BString& response) { @@ -703,11 +721,13 @@ ExpungeHandler::Handle(const BString& response) } +// #pragma mark - + + FlagsHandler::FlagsHandler(IMAPMailbox& mailbox) : IMAPMailboxCommand(mailbox) { - } @@ -731,6 +751,9 @@ FlagsHandler::Handle(const BString& response) } +// #pragma mark - + + BString ListCommand::Command() { @@ -783,6 +806,9 @@ ListCommand::ParseList(const char* command, const BString& response, } +// #pragma mark - + + BString ListSubscribedCommand::Command() { @@ -805,11 +831,13 @@ ListSubscribedCommand::FolderList() } +// #pragma mark - + + SubscribeCommand::SubscribeCommand(const char* mailboxName) : fMailboxName(mailboxName) { - } @@ -830,11 +858,13 @@ SubscribeCommand::Handle(const BString& response) } +// #pragma mark - + + UnsubscribeCommand::UnsubscribeCommand(const char* mailboxName) : fMailboxName(mailboxName) { - } @@ -855,15 +885,15 @@ UnsubscribeCommand::Handle(const BString& response) } +// #pragma mark - + GetQuotaCommand::GetQuotaCommand(const char* mailboxName) : fMailboxName(mailboxName), - - fUsedStorage(-1), - fTotalStorage(-1) + fUsedStorage(0), + fTotalStorage(0) { - } @@ -885,23 +915,21 @@ GetQuotaCommand::Handle(const BString& response) BString data = IMAPParser::ExtractBetweenBrackets(response, "(", ")"); IMAPParser::RemovePrimitiveFromLeft(data); - fUsedStorage = IMAPParser::RemoveIntegerFromLeft(data); - fUsedStorage *= 1024; - fTotalStorage = IMAPParser::RemoveIntegerFromLeft(data); - fTotalStorage *= 1024; + fUsedStorage = (uint64)IMAPParser::RemoveIntegerFromLeft(data) * 1024; + fTotalStorage = (uint64)IMAPParser::RemoveIntegerFromLeft(data) * 1024; return true; } -double +uint64 GetQuotaCommand::UsedStorage() { return fUsedStorage; } -double +uint64 GetQuotaCommand::TotalStorage() { return fTotalStorage; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.h index b172294e3b..ed322db076 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Haiku Inc. All Rights Reserved. + * Copyright 2010-2011, Haiku Inc. All Rights Reserved. * Copyright 2010 Clemens Zeidler. All rights reserved. * * Distributed under the terms of the MIT License. @@ -74,10 +74,10 @@ private: struct MinMessage { - MinMessage(); + MinMessage(); - int32 uid; - int32 flags; + int32 uid; + int32 flags; }; @@ -99,6 +99,7 @@ public: static bool ParseMinMessage(const BString& response, MinMessage& minMessage); static int32 ExtractFlags(const BString& response); + private: int32 fMessage; int32 fEndMessage; @@ -169,6 +170,7 @@ public: bool Handle(const BString& response); static BString GenerateFlagList(int32 flags); + private: int32 fMessage; int32 fFlags; @@ -183,6 +185,7 @@ public: BString Command(); bool Handle(const BString& response); + private: BPositionIO& fMessageData; off_t fDataSize; @@ -287,15 +290,14 @@ public: BString Command(); bool Handle(const BString& response); - double UsedStorage(); - double TotalStorage(); + uint64 UsedStorage(); + uint64 TotalStorage(); private: BString fMailboxName; - double fUsedStorage; - double fTotalStorage; + uint64 fUsedStorage; + uint64 fTotalStorage; }; - #endif // IMAP_HANDLER_H diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.cpp index 310d3750e1..4db97d9a9f 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.cpp @@ -12,12 +12,11 @@ #define DEBUG_IMAP_MAILBOX - #ifdef DEBUG_IMAP_MAILBOX -#include -#define TRACE(x...) printf(x) +# include +# define TRACE(x...) printf(x) #else -#define TRACE(x...) /* nothing */ +# define TRACE(x...) ; #endif @@ -28,6 +27,9 @@ MinMessage::MinMessage() } +// #pragma mark - + + IMAPMailbox::IMAPMailbox(IMAPStorage& storage) : fStorage(storage), diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPParser.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPParser.cpp index cb60a5f738..5ea949701f 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPParser.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPParser.cpp @@ -1,6 +1,14 @@ +/* + * Copyright 2010, Haiku Inc. All Rights Reserved. + * Copyright 2010 Clemens Zeidler. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ + + #include "IMAPParser.h" -#include // for atoi +#include BString diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp index cc85a3faef..b8fe7a3430 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp @@ -12,13 +12,13 @@ #else #define TRACE(x...) /* nothing */ #endif - + ConnectionReader::ConnectionReader(ServerConnection* connection) : fServerConnection(connection) { - + } @@ -130,6 +130,9 @@ ConnectionReader::_ExtractTillEndOfLine(BString& out) } +// #pragma mark - + + IMAPProtocol::IMAPProtocol() : fServerConnection(&fOwnServerConnection), @@ -138,7 +141,6 @@ IMAPProtocol::IMAPProtocol() fStopNow(0), fIsConnected(false) { - } @@ -150,7 +152,6 @@ IMAPProtocol::IMAPProtocol(IMAPProtocol& connection) fStopNow(0), fIsConnected(false) { - } @@ -320,7 +321,7 @@ IMAPProtocol::HandleResponse(int32 commandId, bigtime_t timeout, bool disconnect TRACE("S:read error %s", line.String()); _Disconnect(); } else if (disconnectOnTimeout) { - _Disconnect(); + _Disconnect(); } return status; } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.cpp index 6ae12fb741..17c6f043de 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.cpp @@ -1,3 +1,11 @@ +/* + * Copyright 2010-2011, Haiku Inc. All Rights Reserved. + * Copyright 2010 Clemens Zeidler. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ + + #include "IMAPStorage.h" #include @@ -13,12 +21,11 @@ #define DEBUG_IMAP_STORAGE - #ifdef DEBUG_IMAP_STORAGE -#include -#define TRACE(x...) printf(x) +# include +# define TRACE(x...) printf(x) #else -#define TRACE(x...) /* nothing */ +# define TRACE(x...) /* nothing */ #endif @@ -100,12 +107,7 @@ IMAPMailboxSync::Sync(IMAPStorage& storage, IMAPMailbox& mailbox) } -int32 -ReadDirThreadFunction(void *data) -{ - IMAPStorage* storage = (IMAPStorage*)data; - return storage->_ReadFilesThread(); -} +// #pragma mark - IMAPStorage::IMAPStorage() @@ -134,7 +136,7 @@ IMAPStorage::StartReadDatabase() if (status != B_OK) return status; - thread_id id = spawn_thread(ReadDirThreadFunction, "read mailbox", + thread_id id = spawn_thread(_ReadFilesThreadFunction, "read mailbox", B_LOW_PRIORITY, this); if (id < 0) return id; @@ -417,7 +419,15 @@ IMAPStorage::UIDToRef(int32 uid, entry_ref& ref) status_t -IMAPStorage::_ReadFilesThread() +IMAPStorage::_ReadFilesThreadFunction(void* data) +{ + IMAPStorage* storage = (IMAPStorage*)data; + return storage->_ReadFiles(); +} + + +status_t +IMAPStorage::_ReadFiles() { fMailEntryMap.clear(); diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.h index 185ea1e04c..d402e5e166 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.h @@ -82,13 +82,13 @@ public: status_t ReadUniqueID(BNode& node, int32& uid); private: - friend int32 ReadDirThreadFunction(void *data); - - status_t _ReadFilesThread(); + static status_t _ReadFilesThreadFunction(void* data); + status_t _ReadFiles(); status_t _WriteFlags(int32 flags, BNode& node); status_t _WriteUniqueID(BNode& node, int32 uid); +private: BPath fMailboxPath; sem_id fLoadDatabaseLock; @@ -104,6 +104,7 @@ public: status_t Sync(IMAPStorage& storage, IMAPMailbox& mailbox); const MessageNumberList& ToFetchList() { return fToFetchList; } + private: MessageNumberList fToFetchList; }; From 3928c786a0eb3e5d36e9b6b8d8066862283fa95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 12:22:56 +0000 Subject: [PATCH 486/702] * Moved thread function into the class. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42947 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../imap/IMAPInboundProtocol.cpp | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.cpp index 6a1c7768d4..8784ba346e 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.cpp @@ -17,13 +17,15 @@ #include +const uint32 kMsgStartWatching = '&StW'; + + DispatcherIMAPListener::DispatcherIMAPListener(MailProtocol& protocol, IMAPStorage& storage) : fProtocol(protocol), fStorage(storage) { - } @@ -74,15 +76,7 @@ DispatcherIMAPListener::FetchEnd() } -const uint32 kMsgStartWatching = '&StW'; - - -int32 -watch_mailbox(void* data) -{ - ((IMAPMailboxThread*)data)->_Watch(); - return B_OK; -} +// #pragma mark - IMAPMailboxThread::IMAPMailboxThread(IMAPInboundProtocol& protocol, @@ -122,7 +116,7 @@ IMAPMailboxThread::SyncAndStartWatchingMailbox() BAutolock autolock(fLock); if (fIsWatching) return B_OK; - fThread = spawn_thread(watch_mailbox, "IMAPMailboxThread", + fThread = spawn_thread(_WatchThreadFunction, "IMAPMailboxThread", B_LOW_PRIORITY, this); if (resume_thread(fThread) != B_OK) { fThread = -1; @@ -159,6 +153,15 @@ IMAPMailboxThread::StopWatchingMailbox() } +/*static*/ status_t +IMAPMailboxThread::_WatchThreadFunction(void* data) +{ + ((IMAPMailboxThread*)data)->_Watch(); + return B_OK; +} + + + void IMAPMailboxThread::_Watch() { @@ -181,7 +184,6 @@ MailboxWatcher::MailboxWatcher(IMAPInboundProtocol* protocol) : fProtocol(protocol) { - } @@ -223,7 +225,7 @@ MailboxWatcher::MessageReceived(BMessage* message) fProtocol->AppendMessage(ref); break; - + case B_ENTRY_REMOVED: message->FindInt32("device", &nref.device); message->FindInt64("node", &nref.node); From cd32d81c40743d1f46961821aef15b01dd4924ae Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 29 Oct 2011 12:59:10 +0000 Subject: [PATCH 487/702] Build fix. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42948 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/mail/MailDaemon.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/servers/mail/MailDaemon.cpp b/src/servers/mail/MailDaemon.cpp index 688b28d86b..e96d0335ad 100644 --- a/src/servers/mail/MailDaemon.cpp +++ b/src/servers/mail/MailDaemon.cpp @@ -35,6 +35,10 @@ #define B_TRANSLATE_CONTEXT "MailDaemon" +using std::map; +using std::vector; + + struct send_mails_info { send_mails_info() { @@ -99,10 +103,6 @@ addAttribute(BMessage& msg, const char* name, const char* publicName, // #pragma mark - -using std::map; -using std::vector; - - MailDaemonApp::MailDaemonApp() : BApplication("application/x-vnd.Be-POST"), From eab1b0e87e6cbaf1d3fdc6104b54597d27648896 Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sat, 29 Oct 2011 13:40:53 +0000 Subject: [PATCH 488/702] BuildSetup wasn't caring about HAIKU_CCFLAGS or HAIKU_C++FLAGS set at configuring time. A bit out of my comfortzone with, so please tell me if I'm wrong. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42949 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/BuildSetup | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 0a97eb6c67..dee151c8ee 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -164,10 +164,14 @@ HAIKU_LINK = $(HAIKU_CC) ; HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ; HAIKU_HDRS = [ FStandardHeaders ] ; -HAIKU_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; -HAIKU_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; -HAIKU_KERNEL_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) ; -HAIKU_KERNEL_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) ; + +HAIKU_CUSTOM_CCFLAGS = $(HAIKU_CCFLAGS) ; +HAIKU_CUSTOM_C++FLAGS = $(HAIKU_C++FLAGS) ; + +HAIKU_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) $(HAIKU_CUSTOM_CCFLAGS) -nostdinc ; +HAIKU_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) $(HAIKU_CUSTOM_C++FLAGS) -nostdinc ; +HAIKU_KERNEL_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) $(HAIKU_CUSTOM_CCFLAGS) ; +HAIKU_KERNEL_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) $(HAIKU_CUSTOM_C++FLAGS) ; HAIKU_DEFINES = __HAIKU__ ; HAIKU_NO_WERROR ?= 0 ; @@ -361,10 +365,15 @@ switch $(HAIKU_ARCH) { } case x86 : { - HAIKU_CCFLAGS += -march=pentium ; - HAIKU_C++FLAGS += -march=pentium ; - HAIKU_KERNEL_CCFLAGS += -march=pentium ; - HAIKU_KERNEL_C++FLAGS += -march=pentium ; + if $(HAIKU_CUSTOM_CCFLAGS) = '' { + HAIKU_CCFLAGS += -march=pentium ; + HAIKU_KERNEL_CCFLAGS += -march=pentium ; + } + + if $(HAIKU_CUSTOM_C++FLAGS) = '' { + HAIKU_C++FLAGS += -march=pentium ; + HAIKU_KERNEL_C++FLAGS += -march=pentium ; + } # Enable use of the gcc built-in atomic functions instead of atomic_*(). # The former are inlined and have thus less overhead. They are not From 92bae21ab74d0dd77410c7ab01e03527c306941d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 14:35:55 +0000 Subject: [PATCH 489/702] Try to load resource-embedded catalog from application. Should fix #8037. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42950 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/locale/DefaultCatalog.cpp | 37 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/kits/locale/DefaultCatalog.cpp b/src/kits/locale/DefaultCatalog.cpp index 997060c4c3..17713f8a70 100644 --- a/src/kits/locale/DefaultCatalog.cpp +++ b/src/kits/locale/DefaultCatalog.cpp @@ -65,20 +65,29 @@ DefaultCatalog::DefaultCatalog(const char *signature, const char *language, : BHashMapCatalog(signature, language, fingerprint) { - // give highest priority to catalog living in sub-folder of app's folder: + status_t status; + app_info appInfo; be_app->GetAppInfo(&appInfo); - node_ref nref; - nref.device = appInfo.ref.device; - nref.node = appInfo.ref.directory; - BDirectory appDir(&nref); - BString catalogName("locale/"); - catalogName << kCatFolder - << "/" << fSignature - << "/" << fLanguageName - << kCatExtension; - BPath catalogPath(&appDir, catalogName.String()); - status_t status = ReadFromFile(catalogPath.Path()); + + // give highest priority to catalog embedded as resource in application + // executable: + status = ReadFromResource(&appInfo.ref); + + // search for catalog living in sub-folder of app's folder: + if (status != B_OK) { + node_ref nref; + nref.device = appInfo.ref.device; + nref.node = appInfo.ref.directory; + BDirectory appDir(&nref); + BString catalogName("locale/"); + catalogName << kCatFolder + << "/" << fSignature + << "/" << fLanguageName + << kCatExtension; + BPath catalogPath(&appDir, catalogName.String()); + status = ReadFromFile(catalogPath.Path()); + } if (status != B_OK) { // search in data folders @@ -92,8 +101,8 @@ DefaultCatalog::DefaultCatalog(const char *signature, const char *language, for (size_t i = 0; i < sizeof(which) / sizeof(which[0]); i++) { BPath path; if (find_directory(which[i], &path) == B_OK) { - catalogName = BString(path.Path()) - << "/locale/" << kCatFolder + BString catalogName(path.Path()); + catalogName << "/locale/" << kCatFolder << "/" << fSignature << "/" << fLanguageName << kCatExtension; From f86acdc207e02e0a50e35b0622d510bf69700f32 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 14:44:13 +0000 Subject: [PATCH 490/702] Patch by Karvjorm: localize Login. Fixes #7234. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42951 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/login/DesktopWindow.cpp | 10 +++++++-- src/apps/login/Jamfile | 10 ++++++++- src/apps/login/LoginApp.cpp | 36 ++++++++++++++++++-------------- src/apps/login/LoginView.cpp | 22 +++++++++++-------- src/apps/login/LoginWindow.cpp | 7 ++++++- 5 files changed, 56 insertions(+), 29 deletions(-) diff --git a/src/apps/login/DesktopWindow.cpp b/src/apps/login/DesktopWindow.cpp index 512a1bb394..aa9b95cb56 100644 --- a/src/apps/login/DesktopWindow.cpp +++ b/src/apps/login/DesktopWindow.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -17,13 +18,16 @@ #include "LoginApp.h" #include "DesktopWindow.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "Desktop Window" + const window_feel kPrivateDesktopWindowFeel = window_feel(1024); const window_look kPrivateDesktopWindowLook = window_look(4); // this is a mirror of an app server private values DesktopWindow::DesktopWindow(BRect frame, bool editMode) - : BWindow(frame, "Desktop", + : BWindow(frame, B_TRANSLATE("Desktop"), kPrivateDesktopWindowLook, kPrivateDesktopWindowFeel, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE @@ -71,7 +75,9 @@ DesktopWindow::QuitRequested() { status_t err; err = fDesktopShelf->Save(); - printf("error %s\n", strerror(err)); + printf(B_TRANSLATE_COMMENT("error %s\n", + "A return message from fDesktopShelf->Save(). It can be \"B_OK\""), + strerror(err)); return BWindow::QuitRequested(); } diff --git a/src/apps/login/Jamfile b/src/apps/login/Jamfile index 08f782d020..9c15dea930 100644 --- a/src/apps/login/Jamfile +++ b/src/apps/login/Jamfile @@ -19,7 +19,15 @@ Application Login : LoginWindow.cpp LoginView.cpp main.cpp - : be tracker $(mu_libs) $(TARGET_LIBSTDC++) + : be tracker $(mu_libs) $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS) : Login.rdef ; +DoCatalogs Login : + x-vnd.Haiku-Login + : + LoginApp.cpp + DesktopWindow.cpp + LoginView.cpp + LoginWindow.cpp +; diff --git a/src/apps/login/LoginApp.cpp b/src/apps/login/LoginApp.cpp index 655c55b7fe..8078417524 100644 --- a/src/apps/login/LoginApp.cpp +++ b/src/apps/login/LoginApp.cpp @@ -5,6 +5,7 @@ #include +#include #include #include #include @@ -25,6 +26,8 @@ #include "multiuser_utils.h" #endif +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "Login App" const char *kLoginAppSig = "application/x-vnd.Haiku-Login"; @@ -48,11 +51,12 @@ LoginApp::ReadyToRun() BScreen screen; if (fEditShelfMode) { - (new BAlert("Info", "You can customize the desktop shown " - "behind the Login application by dropping replicants onto it.\n" + (new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can customize the " + "desktop shown behind the Login application by dropping replicants" + " onto it.\n" "\n" - "When you are finished just quit the application (Alt-Q).", - "OK"))->Go(NULL); + "When you are finished just quit the application (Alt-Q)."), + B_TRANSLATE("OK")))->Go(NULL); } else { BRect frame(0, 0, 400, 150); frame.OffsetBySelf(screen.Frame().Width()/2 - frame.Width()/2, @@ -88,14 +92,15 @@ LoginApp::MessageReceived(BMessage *message) BRoster::Private rosterPrivate(roster); status_t error = rosterPrivate.ShutDown(reboot, false, false); if (error < B_OK) { - BString msg("Error: "); - msg << strerror(error); - (new BAlert("Error", msg.String(), "OK"))->Go(); + BString msg(B_TRANSLATE("Error: %1")); + msg.ReplaceFirst("%1", strerror(error)); + (new BAlert(("Error"), msg.String(), B_TRANSLATE("OK")))->Go(); } break; } case kSuspendAction: - (new BAlert("Error", "Unimplemented", "OK"))->Go(); + (new BAlert(B_TRANSLATE("Error"), B_TRANSLATE("Unimplemented"), + B_TRANSLATE("OK")))->Go(); break; #endif default: @@ -115,11 +120,11 @@ LoginApp::ArgvReceived(int32 argc, char **argv) else if (arg == "--nonmodal") fModalMode = false; else /*if (arg == "--help")*/ { - printf("Login application for Haiku\nUsage:\n"); + printf(B_TRANSLATE("Login application for Haiku\nUsage:\n")); printf("%s [--nonmodal] [--edit]\n", argv[0]); - printf("--nonmodal Do not make the window modal\n"); - printf("--edit Launch in shelf editting mode to " - "allow customizing the desktop.\n"); + printf(B_TRANSLATE("--nonmodal Do not make the window modal\n")); + printf(B_TRANSLATE("--edit Launch in shelf editting mode to " + "allow customizing the desktop.\n")); // just return to the shell exit((arg == "--help") ? 0 : 1); return; @@ -139,7 +144,9 @@ LoginApp::TryLogin(BMessage *message) if (message->FindString("password", &password) < B_OK) password = NULL; err = ValidateLogin(login, password); - printf("ValidateLogin: %s\n", strerror(err)); + printf(B_TRANSLATE_COMMENT("ValidateLogin: %s\n", + "A message returned from the ValidateLogin function. " + "It can be \"B_OK\"."), strerror(err)); if (err == B_OK) { reply.what = kLoginOk; message->SendReply(&reply); @@ -224,6 +231,3 @@ LoginApp::getpty(char *pty, char *tty) return fd; } - - - diff --git a/src/apps/login/LoginView.cpp b/src/apps/login/LoginView.cpp index d0fc6769f1..fe64e7a9d4 100644 --- a/src/apps/login/LoginView.cpp +++ b/src/apps/login/LoginView.cpp @@ -2,6 +2,7 @@ * Copyright 2008, François Revol, . All rights reserved. * Distributed under the terms of the MIT License. */ +#include #include #include #include @@ -14,6 +15,9 @@ #include "LoginApp.h" #include "LoginView.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "Login View" + #define LW 120 #define CSEP 15 #define BH 20 @@ -57,19 +61,19 @@ LoginView::LoginView(BRect frame) r.Set(LW + 30, Bounds().top + CSEP, Bounds().right - CSEP, Bounds().top + CSEP + CSEP); - fLoginControl = new BTextControl(r, "login", "Login:", "", + fLoginControl = new BTextControl(r, "login", B_TRANSLATE("Login:"), "", new BMessage(kLoginEdited)); AddChild(fLoginControl); r.OffsetBySelf(0, CSEP + CSEP); - fPasswordControl = new BTextControl(r, "password", "Password:", "", - new BMessage(kPasswordEdited)); + fPasswordControl = new BTextControl(r, "password", + B_TRANSLATE("Password:"), "", new BMessage(kPasswordEdited)); fPasswordControl->TextView()->HideTyping(true); AddChild(fPasswordControl); r.OffsetBySelf(0, CSEP + CSEP); - fHidePasswordCheckBox = new BCheckBox(r, "hidepw", "Hide password", - new BMessage(kHidePassword)); + fHidePasswordCheckBox = new BCheckBox(r, "hidepw", + B_TRANSLATE("Hide password"), new BMessage(kHidePassword)); fHidePasswordCheckBox->SetValue(1); AddChild(fHidePasswordCheckBox); @@ -79,12 +83,12 @@ LoginView::LoginView(BRect frame) buttonWidth, Bounds().bottom); buttonRect.OffsetBySelf(CSEP, -CSEP); - fHaltButton = new BButton(buttonRect, "halt", "Halt", + fHaltButton = new BButton(buttonRect, "halt", B_TRANSLATE("Halt"), new BMessage(kHaltAction)); AddChild(fHaltButton); buttonRect.OffsetBySelf(CSEP + buttonWidth, 0); - fRebootButton = new BButton(buttonRect, "reboot", "Reboot", + fRebootButton = new BButton(buttonRect, "reboot", B_TRANSLATE("Reboot"), new BMessage(kRebootAction)); AddChild(fRebootButton); @@ -93,7 +97,7 @@ LoginView::LoginView(BRect frame) buttonRect.OffsetToSelf(Bounds().Width() - CSEP - buttonWidth, Bounds().Height() - CSEP - BH); - fLoginButton = new BButton(buttonRect, "ok", "OK", + fLoginButton = new BButton(buttonRect, "ok", B_TRANSLATE("OK"), new BMessage(kAttemptLogin)); AddChild(fLoginButton); @@ -175,7 +179,7 @@ LoginView::MessageReceived(BMessage *message) case kLoginBad: fPasswordControl->SetText(""); EnableControls(false); - fInfoView->SetText("Invalid login!"); + fInfoView->SetText(B_TRANSLATE("Invalid login!")); if (Window()) { BPoint savedPos = Window()->Frame().LeftTop(); for (int i = 0; i < 10; i++) { diff --git a/src/apps/login/LoginWindow.cpp b/src/apps/login/LoginWindow.cpp index 7ad89be936..40a7729275 100644 --- a/src/apps/login/LoginWindow.cpp +++ b/src/apps/login/LoginWindow.cpp @@ -4,14 +4,19 @@ */ +#include + #include "LoginWindow.h" #include "LoginView.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "Login Window" + #define WINDOW_FEEL B_NORMAL_WINDOW_FEEL //#define WINDOW_FEEL B_FLOATING_ALL_WINDOW_FEEL LoginWindow::LoginWindow(BRect frame) - : BWindow(frame, "Welcome to Haiku", B_TITLED_WINDOW_LOOK, + : BWindow(frame, B_TRANSLATE("Welcome to Haiku"), B_TITLED_WINDOW_LOOK, WINDOW_FEEL, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | From 32aa019c4558a64e8942ba6ac33484525e1e5444 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 29 Oct 2011 14:45:39 +0000 Subject: [PATCH 491/702] Apply patch by Adrian Panasiuk that fixes issues with some 3com combo chipsets. Resolves #3120. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42952 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c b/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c index 96a414bf1d..187738bb4b 100644 --- a/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c +++ b/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c @@ -1206,6 +1206,9 @@ xl_attach(device_t dev) sc->xl_flags |= XL_FLAG_PHYOK; switch (did) { +#ifdef __HAIKU__ + case TC_DEVICEID_BOOMERANG_10BT_COMBO: +#endif case TC_DEVICEID_BOOMERANG_10_100BT: /* 3c905-TX */ case TC_DEVICEID_HURRICANE_575A: case TC_DEVICEID_HURRICANE_575B: @@ -1458,6 +1461,11 @@ xl_attach(device_t dev) sc->xl_xcvr &= XL_ICFG_CONNECTOR_MASK; sc->xl_xcvr >>= XL_ICFG_CONNECTOR_BITS; +#ifdef __HAIKU__ + if (did == TC_DEVICEID_BOOMERANG_10BT_COMBO) + sc->xl_xcvr = XL_XCVR_10BT; +#endif + xl_mediacheck(sc); if (sc->xl_media & XL_MEDIAOPT_MII || From 1e52d1c2d55d9d3218194dd24f49776e53749020 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 14:52:17 +0000 Subject: [PATCH 492/702] Patch by Kavjorm to fix app server tests (#6367). Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42953 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/servers/app/drawing_modes/DrawingModes.cpp | 1 + src/tests/servers/app/drawing_modes/Jamfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/servers/app/drawing_modes/DrawingModes.cpp b/src/tests/servers/app/drawing_modes/DrawingModes.cpp index bd0bbbba05..70f3aea507 100644 --- a/src/tests/servers/app/drawing_modes/DrawingModes.cpp +++ b/src/tests/servers/app/drawing_modes/DrawingModes.cpp @@ -3,6 +3,7 @@ #include #include #include +#include uint32 kBitmapBits[] = { 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, diff --git a/src/tests/servers/app/drawing_modes/Jamfile b/src/tests/servers/app/drawing_modes/Jamfile index c4d3c525b0..d3c4ae6353 100644 --- a/src/tests/servers/app/drawing_modes/Jamfile +++ b/src/tests/servers/app/drawing_modes/Jamfile @@ -8,5 +8,5 @@ UseHeaders [ FDirName os interface ] ; Application DrawingModes : DrawingModes.cpp - : be + : $(TARGET_LIBSTDC++) be ; From c143c1031275e168dd431463a61209463a44eb77 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 15:20:26 +0000 Subject: [PATCH 493/702] Patch by humdinger: localize BSnow. (#7528) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42954 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bsnow/Jamfile | 8 +++++++- src/apps/bsnow/SnowView.h | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/apps/bsnow/Jamfile b/src/apps/bsnow/Jamfile index b144ba1e1e..2b34a26d1b 100644 --- a/src/apps/bsnow/Jamfile +++ b/src/apps/bsnow/Jamfile @@ -6,6 +6,12 @@ Application BSnow : Flakes.cpp SnowView.cpp SnowApp.cpp - : be $(TARGET_LIBSUPC++) + : be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) : BSnow.rdef ; + +DoCatalogs BSnow : + x-vnd.mmu_man.BSnow + : + SnowView.h + ; diff --git a/src/apps/bsnow/SnowView.h b/src/apps/bsnow/SnowView.h index 1a5e6612e5..b5343c1376 100644 --- a/src/apps/bsnow/SnowView.h +++ b/src/apps/bsnow/SnowView.h @@ -3,11 +3,12 @@ #include +#include #include #include +#include #include #include -#include #include "Flakes.h" @@ -26,8 +27,11 @@ #define FALLEN_HEIGHT 30 #define INVALIDATOR_THREAD_NAME "You're Neo? I'm the Snow Maker!" -#define MSG_DRAG_ME "Drag me on your desktop..." -#define MSG_CLICK_ME "Click me to remove BSnow..." +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "BSnow" + +#define MSG_DRAG_ME B_TRANSLATE("Drag me on your desktop...") +#define MSG_CLICK_ME B_TRANSLATE("Click me to remove BSnow...") typedef struct flake { From 5261544b0d0ff95cfb3cc143234833e1b00285b2 Mon Sep 17 00:00:00 2001 From: Alexandre Deckner Date: Sat, 29 Oct 2011 15:21:05 +0000 Subject: [PATCH 494/702] Applying patch for ticket #6134. Fixes BCursor tests. Thanks Karvjorm! And sorry for the delay. I also re-enabled the tests in the Jamfile (cf. r41788) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42955 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/app/Jamfile | 4 +- src/tests/kits/app/bcursor/BCursorTester.cpp | 65 +++----------------- src/tests/kits/app/bcursor/BCursorTester.h | 2 - 3 files changed, 11 insertions(+), 60 deletions(-) diff --git a/src/tests/kits/app/Jamfile b/src/tests/kits/app/Jamfile index 9b4081be06..d6119891f0 100644 --- a/src/tests/kits/app/Jamfile +++ b/src/tests/kits/app/Jamfile @@ -53,8 +53,8 @@ UnitTestLib libapptest.so ReadWriteTester.cpp # BCursor -# BCursorTester.cpp -# CursorTest.cpp + BCursorTester.cpp + CursorTest.cpp # BHandler HandlerTest.cpp diff --git a/src/tests/kits/app/bcursor/BCursorTester.cpp b/src/tests/kits/app/bcursor/BCursorTester.cpp index d9b2a0da07..c585855c8d 100644 --- a/src/tests/kits/app/bcursor/BCursorTester.cpp +++ b/src/tests/kits/app/bcursor/BCursorTester.cpp @@ -1,27 +1,27 @@ -//------------------------------------------------------------------------------ +//----------------------------------------------------------------------------- // BCursorTester.cpp // -//------------------------------------------------------------------------------ +//----------------------------------------------------------------------------- -// Standard Includes ----------------------------------------------------------- +// Standard Includes ---------------------------------------------------------- -// System Includes ------------------------------------------------------------- +// System Includes ------------------------------------------------------------ #include #include #include #define CHK CPPUNIT_ASSERT -// Project Includes ------------------------------------------------------------ +// Project Includes ----------------------------------------------------------- -// Local Includes -------------------------------------------------------------- +// Local Includes ------------------------------------------------------------- #include "BCursorTester.h" -// Local Defines --------------------------------------------------------------- +// Local Defines -------------------------------------------------------------- -// Globals --------------------------------------------------------------------- +// Globals -------------------------------------------------------------------- -//------------------------------------------------------------------------------ +//----------------------------------------------------------------------------- /* BCursor(const void *cursorData) @@ -174,49 +174,6 @@ void BCursorTester::Archive2() CHK(cur.Archive(&msg) == B_OK); } -/* - status_t Perform(perform_code d, void* arg) - @case 1 - @results return B_OK - */ -void BCursorTester::Perform1() -{ - BApplication app("application/x-vnd.cursortest"); - char data[68]; - int i; - - data[0] = 16; - data[1] = 1; - data[2] = 0; - data[3] = 0; - for (i=4; i<68; i++) - data[i] = 1; - - BCursor cur(data); - CHK(cur.Perform(0,NULL) == B_OK); -} - -/* - status_t Perform(perform_code d, void* arg) - @case 2 - @results return B_OK - */ -void BCursorTester::Perform2() -{ - BApplication app("application/x-vnd.cursortest"); - char data[68]; - int i; - - data[0] = 16; - data[1] = 1; - data[2] = 0; - data[3] = 0; - for (i=4; i<68; i++) - data[i] = 1; - - BCursor cur(data); - CHK(cur.Perform(0,&i) == B_OK); -} Test* BCursorTester::Suite() { @@ -231,11 +188,7 @@ Test* BCursorTester::Suite() ADD_TEST4(BCursor, SuiteOfTests, BCursorTester, Instantiate2); ADD_TEST4(BCursor, SuiteOfTests, BCursorTester, Archive1); ADD_TEST4(BCursor, SuiteOfTests, BCursorTester, Archive2); - ADD_TEST4(BCursor, SuiteOfTests, BCursorTester, Perform1); - ADD_TEST4(BCursor, SuiteOfTests, BCursorTester, Perform2); return SuiteOfTests; } - - diff --git a/src/tests/kits/app/bcursor/BCursorTester.h b/src/tests/kits/app/bcursor/BCursorTester.h index b564330c2e..94bc0e209e 100644 --- a/src/tests/kits/app/bcursor/BCursorTester.h +++ b/src/tests/kits/app/bcursor/BCursorTester.h @@ -34,8 +34,6 @@ class BCursorTester : public TestCase void Instantiate2(); void Archive1(); void Archive2(); - void Perform1(); - void Perform2(); static Test* Suite(); }; From a481c815c1af2589b15d2a1e378c49ccd8e967d4 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 29 Oct 2011 15:22:05 +0000 Subject: [PATCH 495/702] Apply patch by Taos which adds hyperlink for LGPL license (#7907). Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42956 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/aboutsystem/AboutSystem.cpp | 32 +++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 4c32e306f3..0ea0be0395 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -1225,6 +1225,8 @@ AboutView::_CreateCreditsView() BPath mitPath; _GetLicensePath("MIT", mitPath); + BPath lgplPath; + _GetLicensePath("GNU LGPL v2.1", lgplPath); font.SetSize(be_bold_font->Size() + 4); font.SetFace(B_BOLD_FACE); @@ -1236,14 +1238,18 @@ AboutView::_CreateCreditsView() "respective license.]\n\n")); // Haiku license - BString haikuLicense = B_TRANSLATE_COMMENT("The code that is unique to Haiku, " - "especially the kernel and all code that applications may link " - "against, is distributed under the terms of the %MIT license%. " + BString haikuLicense = B_TRANSLATE_COMMENT("The code that is unique to " + "Haiku, especially the kernel and all code that applications may link " + "against, is distributed under the terms of the . " "Some system libraries contain third party code distributed under the " - "LGPL license. You can find the copyrights to third party code below.\n" - "\n", "%MIT license% isn't a variable and has to be translated."); - int32 licensePart1 = haikuLicense.FindFirst("%"); - int32 licensePart2 = haikuLicense.FindLast("%"); + ". You can find the copyrights to third party code below." + "\n\n", " and aren't variables and can be " + "translated. However, please, don't remove < and > as they're needed " + "as placeholders for proper hypertext functionality."); + int32 licensePart1 = haikuLicense.FindFirst("<"); + int32 licensePart2 = haikuLicense.FindFirst(">"); + int32 licensePart3 = haikuLicense.FindLast("<"); + int32 licensePart4 = haikuLicense.FindLast(">"); BString part; haikuLicense.CopyInto(part, 0, licensePart1); fCreditsView->Insert(part); @@ -1254,9 +1260,19 @@ AboutView::_CreateCreditsView() fCreditsView->InsertHyperText(part, new OpenFileAction(mitPath.Path())); part.Truncate(0); - haikuLicense.CopyInto(part, licensePart2 + 1, haikuLicense.Length() - 1 + haikuLicense.CopyInto(part, licensePart2 + 1, licensePart3 - 1 - licensePart2); fCreditsView->Insert(part); + + part.Truncate(0); + haikuLicense.CopyInto(part, licensePart3 + 1, licensePart4 - 1 + - licensePart3); + fCreditsView->InsertHyperText(part, new OpenFileAction(lgplPath.Path())); + + part.Truncate(0); + haikuLicense.CopyInto(part, licensePart4 + 1, haikuLicense.Length() - 1 + - licensePart4); + fCreditsView->Insert(part); // GNU copyrights AddCopyrightEntry("The GNU Project", From f1d67b39de63baf1788832e3639cde67e27487e5 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 15:31:55 +0000 Subject: [PATCH 496/702] Patch by taos (#7529): localize Chart. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42957 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/game/chart/Chart.cpp | 19 ++- src/tests/kits/game/chart/ChartWindow.cpp | 185 ++++++++++++++-------- src/tests/kits/game/chart/Jamfile | 9 +- 3 files changed, 138 insertions(+), 75 deletions(-) diff --git a/src/tests/kits/game/chart/Chart.cpp b/src/tests/kits/game/chart/Chart.cpp index 5314c24ab2..596062295d 100644 --- a/src/tests/kits/game/chart/Chart.cpp +++ b/src/tests/kits/game/chart/Chart.cpp @@ -1,9 +1,9 @@ /* - + Chart.cpp - + by Pierre Raynaud-Richard. - + */ /* @@ -14,14 +14,18 @@ #include "ChartWindow.h" #include "Chart.h" +#include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "Chart" + int main() -{ +{ ChartApp *app = new ChartApp(); app->Run(); - + delete app; return 0; } @@ -29,8 +33,9 @@ main() ChartApp::ChartApp() : BApplication("application/x-vnd.Be.ChartDemo") { - fWindow = new ChartWindow(BRect(120, 150, 629, 591), "Chart"); - + fWindow = new ChartWindow(BRect(120, 150, 629, 591), + B_TRANSLATE_SYSTEM_NAME("Chart")); + // showing the window will also start the direct connection. If you // Sync() after the show, the direct connection will be established // when the Sync() return (as far as any part of the content area of diff --git a/src/tests/kits/game/chart/ChartWindow.cpp b/src/tests/kits/game/chart/ChartWindow.cpp index ac8b3755f8..e568bf3e68 100644 --- a/src/tests/kits/game/chart/ChartWindow.cpp +++ b/src/tests/kits/game/chart/ChartWindow.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,9 @@ #include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ChartWindow" + /* pseudo-random generator parameters (not very good ones, but good enough for what we do here). */ enum { @@ -487,25 +491,30 @@ ChartWindow::ChartWindow(BRect frame, const char *name) h += INSTANT_LOAD+H_BORDER; /* camera animation popup */ - menu = new BPopUpMenu("Off"); - item = new BMenuItem("Off", new BMessage(ANIM_OFF_MSG)); + menu = new BPopUpMenu(B_TRANSLATE("Off")); + item = new BMenuItem(B_TRANSLATE("Off"), new BMessage(ANIM_OFF_MSG)); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("Slow rotation", new BMessage(ANIM_SLOW_ROT_MSG)); + item = new BMenuItem(B_TRANSLATE("Slow rotation"), + new BMessage(ANIM_SLOW_ROT_MSG)); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("Slow motion", new BMessage(ANIM_SLOW_MOVE_MSG)); + item = new BMenuItem(B_TRANSLATE("Slow motion"), + new BMessage(ANIM_SLOW_MOVE_MSG)); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("Fast motion", new BMessage(ANIM_FAST_MOVE_MSG)); + item = new BMenuItem(B_TRANSLATE("Fast motion"), + new BMessage(ANIM_FAST_MOVE_MSG)); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("Free motion", new BMessage(ANIM_FREE_MOVE_MSG)); + item = new BMenuItem(B_TRANSLATE("Free motion"), + new BMessage(ANIM_FREE_MOVE_MSG)); item->SetTarget(this); menu->AddItem(item); - r.Set(h, v, h+ANIM_LABEL+ANIM_POPUP-1, v + (TOP_LEFT_LIMIT - 1 - 2*V_BORDER)); - popup = new BMenuField(r, "", "Animation:", menu); + r.Set(h, v, h+ANIM_LABEL+ANIM_POPUP-1, v + + (TOP_LEFT_LIMIT - 1 - 2*V_BORDER)); + popup = new BMenuField(r, "", B_TRANSLATE("Animation:"), menu); popup->SetFont(&font); popup->MenuBar()->SetFont(&font); popup->Menu()->SetFont(&font); @@ -513,27 +522,32 @@ ChartWindow::ChartWindow(BRect frame, const char *name) popup->SetDivider(popup->StringWidth(popup->Label()) + 4.0f); fTopView->AddChild(popup); - h += ANIM_LABEL + ANIM_POPUP + popup->StringWidth("Slow rotation"); + h += ANIM_LABEL + ANIM_POPUP + + popup->StringWidth(B_TRANSLATE("Slow rotation")); /* display mode popup */ - menu = new BPopUpMenu("Off"); - item = new BMenuItem("Off", new BMessage(DISP_OFF_MSG)); + menu = new BPopUpMenu(B_TRANSLATE("Off")); + item = new BMenuItem(B_TRANSLATE("Off"), new BMessage(DISP_OFF_MSG)); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("LineArray", new BMessage(DISP_LINE_MSG)); + item = new BMenuItem(B_TRANSLATE("LineArray"), + new BMessage(DISP_LINE_MSG)); item->SetTarget(this); item->SetEnabled(false); menu->AddItem(item); - item = new BMenuItem("DrawBitmap", new BMessage(DISP_BITMAP_MSG)); + item = new BMenuItem(B_TRANSLATE("DrawBitmap"), + new BMessage(DISP_BITMAP_MSG)); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("DirectWindow", new BMessage(DISP_DIRECT_MSG)); + item = new BMenuItem(B_TRANSLATE("DirectWindow"), + new BMessage(DISP_DIRECT_MSG)); item->SetTarget(this); item->SetEnabled(BDirectWindow::SupportsWindowMode()); menu->AddItem(item); - r.Set(h, v, h+DISP_LABEL+DISP_POPUP-1, v + (TOP_LEFT_LIMIT - 1 - 2*V_BORDER)); - popup = new BMenuField(r, "", "Display:", menu); + r.Set(h, v, h+DISP_LABEL+DISP_POPUP-1, v + + (TOP_LEFT_LIMIT - 1 - 2*V_BORDER)); + popup = new BMenuField(r, "", B_TRANSLATE("Display:"), menu); popup->SetFont(&font); popup->MenuBar()->SetFont(&font); popup->Menu()->SetFont(&font); @@ -541,7 +555,8 @@ ChartWindow::ChartWindow(BRect frame, const char *name) popup->SetDivider(popup->StringWidth(popup->Label()) + 4.0f); fTopView->AddChild(popup); - h += DISP_LABEL + DISP_POPUP + popup->StringWidth("DirectWindow") + H_BORDER; + h += DISP_LABEL + DISP_POPUP + + popup->StringWidth(B_TRANSLATE("DirectWindow")) + H_BORDER; /* create the offwindow (invisible) button on the left side. this will be used to record the content of the Picture @@ -589,19 +604,22 @@ ChartWindow::ChartWindow(BRect frame, const char *name) h += BUTTON_WIDTH+H_BORDER; /* starfield type popup */ - menu = new BPopUpMenu("Chaos"); - item = new BMenuItem("Chaos", new BMessage(SPACE_CHAOS_MSG)); + menu = new BPopUpMenu(B_TRANSLATE("Chaos")); + item = new BMenuItem(B_TRANSLATE("Chaos"), + new BMessage(SPACE_CHAOS_MSG)); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("Amas", new BMessage(SPACE_AMAS_MSG)); + item = new BMenuItem(B_TRANSLATE("Amas"), new BMessage(SPACE_AMAS_MSG)); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("Spiral", new BMessage(SPACE_SPIRAL_MSG)); + item = new BMenuItem(B_TRANSLATE("Spiral"), + new BMessage(SPACE_SPIRAL_MSG)); item->SetTarget(this); menu->AddItem(item); - r.Set(h, v, h+SPACE_LABEL+SPACE_POPUP-1, v + (TOP_LEFT_LIMIT - 1 - 2*V_BORDER)); - popup = new BMenuField(r, "", "Space:", menu); + r.Set(h, v, h+SPACE_LABEL+SPACE_POPUP-1, v + + (TOP_LEFT_LIMIT - 1 - 2*V_BORDER)); + popup = new BMenuField(r, "", B_TRANSLATE("Space:"), menu); popup->SetFont(&font); popup->MenuBar()->SetFont(&font); popup->Menu()->SetFont(&font); @@ -626,7 +644,7 @@ ChartWindow::ChartWindow(BRect frame, const char *name) r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2, v+STATUS_BOX-1); fStatusBox = new BBox(r); fStatusBox->SetFont(&boldFont); - fStatusBox->SetLabel("Status"); + fStatusBox->SetLabel(B_TRANSLATE("Status")); fLeftView->AddChild(fStatusBox); float boxWidth, boxHeight; fStatusBox->GetPreferredSize(&boxWidth, &boxHeight); @@ -636,8 +654,9 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v = BOX_V_OFFSET; /* frames per second title string */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+STATUS_LABEL-1); - string = new BStringView(r, "", "Frames/s"); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+STATUS_LABEL-1); + string = new BStringView(r, "", B_TRANSLATE("Frames/s")); string->SetFont(&font); string->SetAlignment(B_ALIGN_CENTER); fStatusBox->AddChild(string); @@ -645,7 +664,8 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += STATUS_LABEL+STATUS_OFFSET; /* frames per second display string */ - r.Set(h-1, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET, v+STATUS_EDIT-1); + r.Set(h-1, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET, + v+STATUS_EDIT-1); fFramesView = new BStringView(r, "", "0.0"); fFramesView->SetAlignment(B_ALIGN_RIGHT); fFramesView->SetFont(be_bold_font); @@ -656,8 +676,9 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += STATUS_EDIT+STATUS_OFFSET; /* CPU load pourcentage title string */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+STATUS_LABEL-1); - string = new BStringView(r, "", "CPU load"); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+STATUS_LABEL-1); + string = new BStringView(r, "", B_TRANSLATE("CPU load")); string->SetAlignment(B_ALIGN_CENTER); string->SetFont(&font); fStatusBox->AddChild(string); @@ -665,7 +686,8 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += STATUS_LABEL+STATUS_OFFSET; /* CPU load pourcentage display string */ - r.Set(h-1, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET, v+STATUS_EDIT-1); + r.Set(h-1, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET, + v+STATUS_EDIT-1); fCpuLoadView = new BStringView(r, "", "0.0"); fCpuLoadView->SetAlignment(B_ALIGN_RIGHT); fCpuLoadView->SetFont(be_bold_font); @@ -679,7 +701,8 @@ ChartWindow::ChartWindow(BRect frame, const char *name) /* Fullscreen mode check box */ r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-1, v+FULL_SCREEN-1); - full_screen = new BCheckBox(r, "", "Full screen", new BMessage(FULL_SCREEN_MSG)); + full_screen = new BCheckBox(r, "", B_TRANSLATE("Full screen"), + new BMessage(FULL_SCREEN_MSG)); full_screen->SetTarget(this); full_screen->SetFont(&font); full_screen->ResizeToPreferred(); @@ -695,7 +718,8 @@ ChartWindow::ChartWindow(BRect frame, const char *name) /* Automatic demonstration activation button */ r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-1, v+AUTO_DEMO-1); - button = new BButton(r, "", "Auto demo", new BMessage(AUTO_DEMO_MSG)); + button = new BButton(r, "", B_TRANSLATE("Auto demo"), + new BMessage(AUTO_DEMO_MSG)); button->SetTarget(this); button->ResizeToPreferred(); button->GetPreferredSize(&width, &height); @@ -708,7 +732,8 @@ ChartWindow::ChartWindow(BRect frame, const char *name) /* Enabling second thread check box */ r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-1, v+SECOND_THREAD-1); - check_box = new BCheckBox(r, "", "2 threads", new BMessage(SECOND_THREAD_MSG)); + check_box = new BCheckBox(r, "", B_TRANSLATE("2 threads"), + new BMessage(SECOND_THREAD_MSG)); check_box->SetTarget(this); check_box->SetFont(&font); check_box->ResizeToPreferred(); @@ -721,7 +746,7 @@ ChartWindow::ChartWindow(BRect frame, const char *name) /* Star color selection box */ r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2, v+COLORS_BOX-1); fColorsBox = new BBox(r); - fColorsBox->SetLabel("Colors"); + fColorsBox->SetLabel(B_TRANSLATE("Colors")); fColorsBox->SetFont(&boldFont); fLeftView->AddChild(fColorsBox); @@ -729,8 +754,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v = BOX_V_OFFSET; /* star color red check box */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - check_box = new BCheckBox(r, "", "Red", new BMessage(COLORS_RED_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + check_box = new BCheckBox(r, "", B_TRANSLATE("Red"), + new BMessage(COLORS_RED_MSG)); check_box->SetFont(&font); check_box->ResizeToPreferred(); fColorsBox->AddChild(check_box); @@ -738,8 +765,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* star color green check box */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - check_box = new BCheckBox(r, "", "Green", new BMessage(COLORS_GREEN_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + check_box = new BCheckBox(r, "", B_TRANSLATE("Green"), + new BMessage(COLORS_GREEN_MSG)); check_box->SetValue(1); check_box->SetFont(&font); check_box->ResizeToPreferred(); @@ -748,8 +777,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* star color blue check box */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - check_box = new BCheckBox(r, "", "Blue", new BMessage(COLORS_BLUE_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + check_box = new BCheckBox(r, "", B_TRANSLATE("Blue"), + new BMessage(COLORS_BLUE_MSG)); check_box->SetValue(1); check_box->SetFont(&font); check_box->ResizeToPreferred(); @@ -758,8 +789,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* star color yellow check box */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - check_box = new BCheckBox(r, "", "Yellow", new BMessage(COLORS_YELLOW_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + check_box = new BCheckBox(r, "", B_TRANSLATE("Yellow"), + new BMessage(COLORS_YELLOW_MSG)); check_box->SetValue(1); check_box->SetFont(&font); check_box->ResizeToPreferred(); @@ -768,8 +801,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* star color orange check box */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - check_box = new BCheckBox(r, "", "Orange", new BMessage(COLORS_ORANGE_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + check_box = new BCheckBox(r, "", B_TRANSLATE("Orange"), + new BMessage(COLORS_ORANGE_MSG)); check_box->SetFont(&font); check_box->ResizeToPreferred(); fColorsBox->AddChild(check_box); @@ -777,8 +812,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* star color pink check box */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - check_box = new BCheckBox(r, "", "Pink", new BMessage(COLORS_PINK_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + check_box = new BCheckBox(r, "", B_TRANSLATE("Pink"), + new BMessage(COLORS_PINK_MSG)); check_box->SetFont(&font); check_box->ResizeToPreferred(); fColorsBox->AddChild(check_box); @@ -786,8 +823,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* star color white check box */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - check_box = new BCheckBox(r, "", "White", new BMessage(COLORS_WHITE_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + check_box = new BCheckBox(r, "", B_TRANSLATE("White"), + new BMessage(COLORS_WHITE_MSG)); check_box->SetFont(&font); check_box->ResizeToPreferred(); fColorsBox->AddChild(check_box); @@ -800,15 +839,17 @@ ChartWindow::ChartWindow(BRect frame, const char *name) r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2, v+SPECIAL_BOX-1); fSpecialBox = new BBox(r); fSpecialBox->SetFont(&boldFont); - fSpecialBox->SetLabel("Special"); + fSpecialBox->SetLabel(B_TRANSLATE("Special")); fLeftView->AddChild(fSpecialBox); h = BOX_H_OFFSET; v = BOX_V_OFFSET; /* no special radio button */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - radio = new BRadioButton(r, "", "None", new BMessage(SPECIAL_NONE_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + radio = new BRadioButton(r, "", B_TRANSLATE("None"), + new BMessage(SPECIAL_NONE_MSG)); radio->SetValue(1); radio->SetFont(&font); radio->ResizeToPreferred(); @@ -817,8 +858,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* comet special animation radio button */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - radio = new BRadioButton(r, "", "Comet", new BMessage(SPECIAL_COMET_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + radio = new BRadioButton(r, "", B_TRANSLATE("Comet"), + new BMessage(SPECIAL_COMET_MSG)); radio->SetFont(&font); radio->ResizeToPreferred(); fSpecialBox->AddChild(radio); @@ -826,8 +869,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* novas special animation radio button */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - radio = new BRadioButton(r, "", "Novas", new BMessage(SPECIAL_NOVAS_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + radio = new BRadioButton(r, "", B_TRANSLATE("Novas"), + new BMessage(SPECIAL_NOVAS_MSG)); radio->SetFont(&font); radio->ResizeToPreferred(); fSpecialBox->AddChild(radio); @@ -835,8 +880,10 @@ ChartWindow::ChartWindow(BRect frame, const char *name) v += COLORS_LABEL+COLORS_OFFSET; /* space batle special animation radio button (not implemented) */ - r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, v+COLORS_LABEL-1); - radio = new BRadioButton(r, "", "Battle", new BMessage(SPECIAL_BATTLE_MSG)); + r.Set(h, v, h+LEFT_WIDTH-2*LEFT_OFFSET-2*BOX_H_OFFSET-1, + v+COLORS_LABEL-1); + radio = new BRadioButton(r, "", B_TRANSLATE("Battle"), + new BMessage(SPECIAL_BATTLE_MSG)); radio->SetEnabled(false); radio->SetFont(&font); radio->ResizeToPreferred(); @@ -1152,10 +1199,10 @@ ChartWindow::OpenColorPalette(BPoint here) BRect frame; BPoint point; - BWindow *window = GetAppWindow("Space color"); + BWindow *window = GetAppWindow(B_TRANSLATE("Space color")); if (window == NULL) { frame.Set(here.x, here.y, here.x + 199.0, here.y + 99.0); - window = new BWindow(frame, "Space color", + window = new BWindow(frame, B_TRANSLATE("Space color"), B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_NOT_RESIZABLE); @@ -1179,10 +1226,11 @@ ChartWindow::OpenColorPalette(BPoint here) void ChartWindow::OpenStarDensity(BPoint here) { - BWindow *window = GetAppWindow("Star density"); + BWindow *window = GetAppWindow(B_TRANSLATE("Star density")); if (window == NULL) { - BRect frame(here.x, here.y, here.x + STAR_DENSITY_H-1, here.y + STAR_DENSITY_V-1); - window = new BWindow(frame, "Star density", + BRect frame(here.x, here.y, here.x + STAR_DENSITY_H-1, + here.y + STAR_DENSITY_V-1); + window = new BWindow(frame, B_TRANSLATE("Star density"), B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK); @@ -1193,7 +1241,8 @@ ChartWindow::OpenStarDensity(BPoint here) slider->SetTarget(NULL, this); slider->SetValue(fCurrentSettings.star_density); slider->SetModificationMessage(new BMessage(STAR_DENSITY_MSG)); - slider->SetLimitLabels(" 5% (low)", "(high) 100% "); + slider->SetLimitLabels(B_TRANSLATE(" 5% (low)"), + B_TRANSLATE("(high) 100% ")); slider->ResizeToPreferred(); window->ResizeTo(slider->Bounds().Width(), slider->Bounds().Height()); window->AddChild(slider); @@ -1208,10 +1257,11 @@ ChartWindow::OpenStarDensity(BPoint here) void ChartWindow::OpenRefresh(BPoint here) { - BWindow *window = GetAppWindow("Refresh rate"); + BWindow *window = GetAppWindow(B_TRANSLATE("Refresh rate")); if (window == NULL) { - BRect frame(here.x, here.y, here.x + REFRESH_RATE_H-1, here.y + REFRESH_RATE_V-1); - window = new BWindow(frame, "Refresh rate", + BRect frame(here.x, here.y, here.x + REFRESH_RATE_H-1, + here.y + REFRESH_RATE_V-1); + window = new BWindow(frame, B_TRANSLATE("Refresh rate"), B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK); @@ -1222,7 +1272,8 @@ ChartWindow::OpenRefresh(BPoint here) slider->SetValue((int32)(1000 * log(fCurrentSettings.refresh_rate / REFRESH_RATE_MIN) / log(REFRESH_RATE_MAX/REFRESH_RATE_MIN))); slider->SetModificationMessage(new BMessage(REFRESH_RATE_MSG)); - slider->SetLimitLabels(" 0.6 f/s (logarythmic scale)", "600.0 f/s"); + slider->SetLimitLabels(B_TRANSLATE(" 0.6 f/s (logarythmic scale)"), + B_TRANSLATE("600.0 f/s")); slider->ResizeToPreferred(); window->ResizeTo(slider->Bounds().Width(), slider->Bounds().Height()); window->AddChild(slider); diff --git a/src/tests/kits/game/chart/Jamfile b/src/tests/kits/game/chart/Jamfile index 05e3c2759f..b05224afb0 100644 --- a/src/tests/kits/game/chart/Jamfile +++ b/src/tests/kits/game/chart/Jamfile @@ -8,10 +8,17 @@ Application Chart : ChartRender.cpp ChartView.cpp ChartWindow.cpp - : be game $(TARGET_LIBSUPC++) + : be game $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) : Chart.rdef ; +DoCatalogs Chart : + x-vnd.Be.ChartDemo + : + Chart.cpp + ChartWindow.cpp +; + if $(TARGET_PLATFORM) = libbe_test { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Chart : tests!apps ; From 7749d0bb0c358a3279b1b9cc76d8376e900130a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 29 Oct 2011 15:38:20 +0000 Subject: [PATCH 497/702] Applied slightly reworked and updated patch from ticket #1576 by "jarz" to rewrite the last remaining (?) headers in order to get rid of the Be copyright. Thanks a lot and sorry for the long delay. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42958 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/be_apps/NetPositive/NetPositive.h | 48 +- headers/os/drivers/ISA.h | 95 +- headers/os/drivers/PCI.h | 930 ++++++++----------- headers/os/drivers/atomizer.h | 104 +-- 4 files changed, 483 insertions(+), 694 deletions(-) diff --git a/headers/os/be_apps/NetPositive/NetPositive.h b/headers/os/be_apps/NetPositive/NetPositive.h index c0e0ac54d4..3e8f24221e 100644 --- a/headers/os/be_apps/NetPositive/NetPositive.h +++ b/headers/os/be_apps/NetPositive/NetPositive.h @@ -1,51 +1,35 @@ -/******************************************************************************* -/ -/ File: NetPositive.h -/ -/ Description: Defines all public APIs for communicating with NetPositive -/ -/ Copyright 1998-1999, Be Incorporated, All Rights Reserved -/ -*******************************************************************************/ - +/* + * Copyright 2011, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _NETPOSITIVE_H #define _NETPOSITIVE_H -/*----------------------------------------------------------------*/ -/*----- message command constants -------------------------------*/ +// Message command constants +// These are not supported by WebPositive at this time and only exists for +// compile time backwards compatibility. enum { - /* Can be sent to the NetPositive application, a window, or a replicant */ - /* view. Put the URL in a String field named be:url */ + // This message could be sent to the NetPositive application, a window, or a + // replicant view. The receiver expected the URL in a "be:url" string field. B_NETPOSITIVE_OPEN_URL = 'NPOP', - /* Can be sent to a window or replicant view */ + // These commands could be sent to a window or replicant view. B_NETPOSITIVE_BACK = 'NPBK', B_NETPOSITIVE_FORWARD = 'NPFW', B_NETPOSITIVE_HOME = 'NPHM', B_NETPOSITIVE_RELOAD = 'NPRL', - B_NETPOSITIVE_STOP = 'NPST', + B_NETPOSITIVE_STOP = 'NPST', B_NETPOSITIVE_DOWN = 'NPDN', B_NETPOSITIVE_UP = 'NPUP' }; - -/*----------------------------------------------------------------*/ -/*----- NetPositive-related MIME types --------------------------*/ - /* The MIME types for the NetPositive application and its bookmark files */ + +// NetPositive related MIME types +// The first one is useless on Haiku, unless NetPositive was manually installed, +// the second one is still used for URL files saved by WebPositive. #define B_NETPOSITIVE_APP_SIGNATURE "application/x-vnd.Be-NPOS" #define B_NETPOSITIVE_BOOKMARK_SIGNATURE "application/x-vnd.Be-bookmark" - /* To set up your application to receive notification when the user */ - /* clicks on a specific type of URL (telnet URL's, for example), see the */ - /* details in TypeConstants.h. NetPositive will use external handlers */ - /* for all URL types except for http, https, file, netpositive, and */ - /* javascript, which it always handles internally. To maintain */ - /* compatibility with its previous behavior, if NetPositive does not */ - /* find a handler for mailto URL's, it will instead launch the handler */ - /* for "text/x-email". */ -/*----------------------------------------------------------------*/ -/*----------------------------------------------------------------*/ - -#endif /* _NETPOSITIVE_H */ +#endif // _NETPOSITIVE_H diff --git a/headers/os/drivers/ISA.h b/headers/os/drivers/ISA.h index 3d2e39af05..8d4cab1001 100644 --- a/headers/os/drivers/ISA.h +++ b/headers/os/drivers/ISA.h @@ -1,84 +1,85 @@ -/******************************************************************************* -/ -/ File: ISA.h -/ -/ Description: Interface to ISA module -/ -/ Copyright 1998, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ - +/* + * Copyright 2010-2011, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _ISA_H #define _ISA_H -//#include + +#include #include + #ifdef __cplusplus extern "C" { #endif -/* --- - ISA scatter/gather dma support. ---- */ -typedef struct { - ulong address; /* memory address (little endian!) 4 bytes */ - ushort transfer_count; /* # transfers minus one (little endian!) 2 bytes*/ - uchar reserved; /* filler, 1byte*/ - uchar flag; /* end of link flag, 1byte */ +typedef struct isa_dma_entry { + uint32 address; + uint16 transfer_count; + uchar reserved; + uchar flag; } isa_dma_entry; -#define B_LAST_ISA_DMA_ENTRY 0x80 /* sets end of link flag in isa_dma_entry */ + +#define B_LAST_ISA_DMA_ENTRY 0x80 + enum { B_8_BIT_TRANSFER, B_16_BIT_TRANSFER }; + #define B_MAX_ISA_DMA_COUNT 0x10000 + typedef struct isa_module_info isa_module_info; struct isa_module_info { bus_manager_info binfo; - uint8 (*read_io_8) (int mapped_io_addr); - void (*write_io_8) (int mapped_io_addr, uint8 value); - uint16 (*read_io_16) (int mapped_io_addr); - void (*write_io_16) (int mapped_io_addr, uint16 value); - uint32 (*read_io_32) (int mapped_io_addr); - void (*write_io_32) (int mapped_io_addr, uint32 value); + uint8 (*read_io_8) (int32 mapped_io_addr); + void (*write_io_8) (int32 mapped_io_addr, uint8 value); + uint16 (*read_io_16) (int32 mapped_io_addr); + void (*write_io_16) (int32 mapped_io_addr, uint16 value); + uint32 (*read_io_32) (int32 mapped_io_addr); + void (*write_io_32) (int32 mapped_io_addr, uint32 value); - void * (*ram_address) (const void *physical_address_in_system_memory); + void* (*ram_address) + (const void * physical_address_in_system_memory); - long (*make_isa_dma_table) ( - const void *buffer, /* buffer to make a table for */ - long buffer_size, /* buffer size */ - ulong num_bits, /* dma transfer size that will be used */ - isa_dma_entry *table, /* -> caller-supplied scatter/gather table */ - long num_entries /* max # entries in table */ + int32 (*make_isa_dma_table) ( + const void *buffer, + int32 buffer_size, + uint32 num_bits, + isa_dma_entry *table, + int32 num_entries ); - long (*start_isa_dma) ( - long channel, /* dma channel to use */ - void *buf, /* buffer to transfer */ - long transfer_count, /* # transfers */ - uchar mode, /* mode flags */ - uchar e_mode /* extended mode flags */ + int32 (*start_isa_dma) ( + int32 channel, + void *buf, + int32 transfer_count, + uchar mode, + uchar e_mode ); - long (*start_scattered_isa_dma) ( - long channel, /* channel # to use */ - const isa_dma_entry *table, /* physical address of scatter/gather table */ - uchar mode, /* mode flags */ - uchar emode /* extended mode flags */ + int32 (*start_scattered_isa_dma) ( + int32 channel, + const isa_dma_entry* table, + uchar mode, + uchar emode ); - long (*lock_isa_dma_channel) (long channel); - long (*unlock_isa_dma_channel) (long channel); + int32 (*lock_isa_dma_channel) (int32 channel); + int32 (*unlock_isa_dma_channel) (int32 channel); }; - + + #define B_ISA_MODULE_NAME "bus_managers/isa/v1" + #ifdef __cplusplus } #endif + #endif /* _ISA_H */ diff --git a/headers/os/drivers/PCI.h b/headers/os/drivers/PCI.h index adccd60ab4..61680ab1d6 100644 --- a/headers/os/drivers/PCI.h +++ b/headers/os/drivers/PCI.h @@ -1,35 +1,25 @@ -/******************************************************************************* -/ -/ File: PCI.h -/ -/ Description: Interface to the PCI bus. -/ For more information, see "PCI Local Bus Specification, Revision 2.1", -/ PCI Special Interest Group, 1995. -/ -/ Copyright 1993-98, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ - - +/* + * Copyright 2010-2011, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _PCI_H #define _PCI_H -//#include -//#include + +#include #include + #ifdef __cplusplus extern "C" { #endif -/* ----- - pci device info ------ */ - +/* pci device info */ +typedef struct pci_info pci_info; typedef struct pci_info { - ushort vendor_id; /* vendor id */ - ushort device_id; /* device id */ + uint16 vendor_id; /* vendor id */ + uint16 device_id; /* device id */ uchar bus; /* bus number */ uchar device; /* device number on bus */ uchar function; /* function number in device */ @@ -44,15 +34,15 @@ typedef struct pci_info { uchar reserved; /* filler, for alignment */ union { struct { - ulong cardbus_cis; /* CardBus CIS pointer */ - ushort subsystem_id; /* subsystem (add-in card) id */ - ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */ - ulong rom_base; /* rom base address, viewed from host */ - ulong rom_base_pci; /* rom base addr, viewed from pci */ - ulong rom_size; /* rom size */ - ulong base_registers[6]; /* base registers, viewed from host */ - ulong base_registers_pci[6]; /* base registers, viewed from pci */ - ulong base_register_sizes[6]; /* size of what base regs point to */ + uint32 cardbus_cis; /* CardBus CIS pointer */ + uint16 subsystem_id; /* subsystem (add-in card) id */ + uint16 subsystem_vendor_id; /* subsystem vendor id */ + uint32 rom_base; /* rom base addr, view from host */ + uint32 rom_base_pci; /* rom base addr, viewed from pci */ + uint32 rom_size; /* rom size */ + uint32 base_registers[6]; /* base registers, view from host */ + uint32 base_registers_pci[6]; /* base registers, view from pci */ + uint32 base_register_sizes[6]; /* size of what base regs point */ uchar base_register_flags[6]; /* flags from base address fields */ uchar interrupt_line; /* interrupt line */ uchar interrupt_pin; /* interrupt pin */ @@ -60,9 +50,9 @@ typedef struct pci_info { uchar max_latency; /* how often PCI access needed */ } h0; struct { - ulong base_registers[2]; /* base registers, viewed from host */ - ulong base_registers_pci[2]; /* base registers, viewed from pci */ - ulong base_register_sizes[2]; /* size of what base regs point to */ + uint32 base_registers[2]; /* base registers, view from host */ + uint32 base_registers_pci[2]; /* base registers, view from pci */ + uint32 base_register_sizes[2]; /* size of what base regs point */ uchar base_register_flags[2]; /* flags from base address fields */ uchar primary_bus; uchar secondary_bus; @@ -70,65 +60,64 @@ typedef struct pci_info { uchar secondary_latency; uchar io_base; uchar io_limit; - ushort secondary_status; - ushort memory_base; - ushort memory_limit; - ushort prefetchable_memory_base; - ushort prefetchable_memory_limit; - ulong prefetchable_memory_base_upper32; - ulong prefetchable_memory_limit_upper32; - ushort io_base_upper16; - ushort io_limit_upper16; - ulong rom_base; /* rom base address, viewed from host */ - ulong rom_base_pci; /* rom base addr, viewed from pci */ + uint16 secondary_status; + uint16 memory_base; + uint16 memory_limit; + uint16 prefetchable_memory_base; + uint16 prefetchable_memory_limit; + uint32 prefetchable_memory_base_upper32; + uint32 prefetchable_memory_limit_upper32; + uint16 io_base_upper16; + uint16 io_limit_upper16; + uint32 rom_base; /* rom base addr, view from host */ + uint32 rom_base_pci; /* rom base addr, view from pci */ uchar interrupt_line; /* interrupt line */ uchar interrupt_pin; /* interrupt pin */ - ushort bridge_control; - ushort subsystem_id; /* subsystem (add-in card) id */ - ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */ + uint16 bridge_control; + uint16 subsystem_id; /* subsystem (add-in card) id */ + uint16 subsystem_vendor_id; /* subsystem vendor id */ } h1; struct { - ushort subsystem_id; /* subsystem (add-in card) id */ - ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */ + uint16 subsystem_id; /* subsystem (add-in card) id */ + uint16 subsystem_vendor_id; /* subsystem vendor id */ #ifdef __HAIKU_PCI_BUS_MANAGER_TESTING // for testing only, not final (do not use!): - uchar primary_bus; - uchar secondary_bus; - uchar subordinate_bus; - uchar secondary_latency; - ushort reserved; - ulong memory_base; - ulong memory_limit; - ulong memory_base_upper32; - ulong memory_limit_upper32; - ulong io_base; - ulong io_limit; - ulong io_base_upper32; - ulong io_limit_upper32; - ushort secondary_status; - ushort bridge_control; + uchar primary_bus; + uchar secondary_bus; + uchar subordinate_bus; + uchar secondary_latency; + uint16 reserved; + uint32 memory_base; + uint32 memory_limit; + uint32 memory_base_upper32; + uint32 memory_limit_upper32; + uint32 io_base; + uint32 io_limit; + uint32 io_base_upper32; + uint32 io_limit_upper32; + uint16 secondary_status; + uint16 bridge_control; #endif /* __HAIKU_PCI_BUS_MANAGER_TESTING */ } h2; } u; -} pci_info; +}; typedef struct pci_module_info pci_module_info; - -struct pci_module_info { +typedef struct pci_module_info { bus_manager_info binfo; - uint8 (*read_io_8) (int mapped_io_addr); - void (*write_io_8) (int mapped_io_addr, uint8 value); - uint16 (*read_io_16) (int mapped_io_addr); - void (*write_io_16) (int mapped_io_addr, uint16 value); - uint32 (*read_io_32) (int mapped_io_addr); - void (*write_io_32) (int mapped_io_addr, uint32 value); + uint8 (*read_io_8) (int32 mapped_io_addr); + void (*write_io_8) (int32 mapped_io_addr, uint8 value); + uint16 (*read_io_16) (int32 mapped_io_addr); + void (*write_io_16) (int32 mapped_io_addr, uint16 value); + uint32 (*read_io_32) (int32 mapped_io_addr); + void (*write_io_32) (int32 mapped_io_addr, uint32 value); - long (*get_nth_pci_info) ( - long index, /* index into pci device table */ - pci_info *info /* caller-supplied buffer for info */ + int32 (*get_nth_pci_info) ( + int32 index, /* index into pci device table */ + pci_info *info /* caller-supplied buf for info */ ); uint32 (*read_pci_config) ( uchar bus, /* bus number */ @@ -146,7 +135,8 @@ struct pci_module_info { uint32 value /* value to write */ ); - void * (*ram_address) (const void *physical_address_in_system_memory); + void* (*ram_address) + (const void* physical_address_in_system_memory); status_t (*find_pci_capability) ( uchar bus, @@ -157,17 +147,17 @@ struct pci_module_info { ); status_t (*reserve_device) ( - uchar bus, - uchar device, - uchar function, - const char *driver_name, - void *cookie); + uchar bus, + uchar device, + uchar function, + const char* driver_name, + void* cookie); status_t (*unreserve_device) ( - uchar bus, - uchar device, - uchar function, - const char *driver_name, - void *cookie); + uchar bus, + uchar device, + uchar function, + const char* driver_name, + void* cookie); status_t (*update_interrupt_line) ( uchar bus, @@ -178,517 +168,379 @@ struct pci_module_info { #define B_PCI_MODULE_NAME "bus_managers/pci/v1" -/* --- - offsets in PCI configuration space to the elements of the predefined - header common to all header types ---- */ -#define PCI_vendor_id 0x00 /* (2 byte) vendor id */ -#define PCI_device_id 0x02 /* (2 byte) device id */ -#define PCI_command 0x04 /* (2 byte) command */ -#define PCI_status 0x06 /* (2 byte) status */ -#define PCI_revision 0x08 /* (1 byte) revision id */ -#define PCI_class_api 0x09 /* (1 byte) specific register interface type */ -#define PCI_class_sub 0x0a /* (1 byte) specific device function */ -#define PCI_class_base 0x0b /* (1 byte) device type (display vs network, etc) */ -#define PCI_line_size 0x0c /* (1 byte) cache line size in 32 bit words */ -#define PCI_latency 0x0d /* (1 byte) latency timer */ -#define PCI_header_type 0x0e /* (1 byte) header type */ -#define PCI_bist 0x0f /* (1 byte) built-in self-test */ +/* offsets in PCI config space to the elements of the predefined header */ +/* offsets common to all header types */ +#define PCI_vendor_id 0x00 /* vendor id */ +#define PCI_device_id 0x02 /* device id */ +#define PCI_command 0x04 /* command */ +#define PCI_status 0x06 /* status */ +#define PCI_revision 0x08 /* revision id */ +#define PCI_class_api 0x09 /* specific register interface type */ +#define PCI_class_sub 0x0A /* specific device function */ +#define PCI_class_base 0x0B /* device type */ +#define PCI_line_size 0x0C /* cache line size in 32 bit words */ +#define PCI_latency 0x0D /* latency timer */ +#define PCI_header_type 0x0E /* header type */ +#define PCI_bist 0x0F /* built-in self-test */ +/* offsets common to header types 0x00 and 0x01 */ +#define PCI_base_registers 0x10 /* base registers */ +#define PCI_interrupt_line 0x3C /* interrupt line */ +#define PCI_interrupt_pin 0x3D /* interrupt pin */ +/* offsets common to header type 0x00 */ +#define PCI_cardbus_cis 0x28 /* CardBus CIS pointer */ +#define PCI_subsystem_vendor_id 0x2C /* subsystem vendor id */ +#define PCI_subsystem_id 0x2E /* subsystem id */ +#define PCI_rom_base 0x30 /* expansion rom base address */ +#define PCI_capabilities_ptr 0x34 /* point to start of cap list */ +#define PCI_min_grant 0x3E /* burst period @ 33 Mhz */ +#define PCI_max_latency 0x3F /* how often need PCI access */ -/* --- - offsets in PCI configuration space to the elements of the predefined - header common to header types 0x00 and 0x01 ---- */ -#define PCI_base_registers 0x10 /* base registers (size varies) */ -#define PCI_interrupt_line 0x3c /* (1 byte) interrupt line */ -#define PCI_interrupt_pin 0x3d /* (1 byte) interrupt pin */ - - - -/* --- - offsets in PCI configuration space to the elements of header type 0x00 ---- */ - -#define PCI_cardbus_cis 0x28 /* (4 bytes) CardBus CIS (Card Information Structure) pointer (see PCMCIA v2.10 Spec) */ -#define PCI_subsystem_vendor_id 0x2c /* (2 bytes) subsystem (add-in card) vendor id */ -#define PCI_subsystem_id 0x2e /* (2 bytes) subsystem (add-in card) id */ -#define PCI_rom_base 0x30 /* (4 bytes) expansion rom base address */ -#define PCI_capabilities_ptr 0x34 /* (1 byte) pointer to the start of the capabilities list */ -#define PCI_min_grant 0x3e /* (1 byte) burst period @ 33 Mhz */ -#define PCI_max_latency 0x3f /* (1 byte) how often PCI access needed */ - - -/* --- - offsets in PCI configuration space to the elements of header type 0x01 (PCI-to-PCI bridge) ---- */ - -#define PCI_primary_bus 0x18 /* (1 byte) */ -#define PCI_secondary_bus 0x19 /* (1 byte) */ -#define PCI_subordinate_bus 0x1A /* (1 byte) */ -#define PCI_secondary_latency 0x1B /* (1 byte) latency of secondary bus */ -#define PCI_io_base 0x1C /* (1 byte) io base address register for 2ndry bus*/ -#define PCI_io_limit 0x1D /* (1 byte) */ -#define PCI_secondary_status 0x1E /* (2 bytes) */ -#define PCI_memory_base 0x20 /* (2 bytes) */ -#define PCI_memory_limit 0x22 /* (2 bytes) */ -#define PCI_prefetchable_memory_base 0x24 /* (2 bytes) */ -#define PCI_prefetchable_memory_limit 0x26 /* (2 bytes) */ +/* offsets common to the elements of header type 0x01 (PCI-to-PCI bridge) */ +#define PCI_primary_bus 0x18 +#define PCI_secondary_bus 0x19 +#define PCI_subordinate_bus 0x1A +#define PCI_secondary_latency 0x1B +#define PCI_io_base 0x1C +#define PCI_io_limit 0x1D +#define PCI_secondary_status 0x1E +#define PCI_memory_base 0x20 +#define PCI_memory_limit 0x22 +#define PCI_prefetchable_memory_base 0x24 +#define PCI_prefetchable_memory_limit 0x26 #define PCI_prefetchable_memory_base_upper32 0x28 #define PCI_prefetchable_memory_limit_upper32 0x2C -#define PCI_io_base_upper16 0x30 /* (2 bytes) */ -#define PCI_io_limit_upper16 0x32 /* (2 bytes) */ -#define PCI_sub_vendor_id_1 0x34 /* (2 bytes) */ -#define PCI_sub_device_id_1 0x36 /* (2 bytes) */ +#define PCI_io_base_upper16 0x30 +#define PCI_io_limit_upper16 0x32 +#define PCI_sub_vendor_id_1 0x34 +#define PCI_sub_device_id_1 0x36 #define PCI_bridge_rom_base 0x38 -#define PCI_bridge_control 0x3E /* (2 bytes) */ - +#define PCI_bridge_control 0x3E /* PCI type 2 header offsets */ -#define PCI_capabilities_ptr_2 0x14 /* (1 byte) */ -#define PCI_secondary_status_2 0x16 /* (2 bytes) */ -#define PCI_primary_bus_2 0x18 /* (1 byte) */ -#define PCI_secondary_bus_2 0x19 /* (1 byte) */ -#define PCI_subordinate_bus_2 0x1A /* (1 byte) */ -#define PCI_secondary_latency_2 0x1B /* (1 byte) latency of secondary bus */ -#define PCI_memory_base0_2 0x1C /* (4 bytes) */ -#define PCI_memory_limit0_2 0x20 /* (4 bytes) */ -#define PCI_memory_base1_2 0x24 /* (4 bytes) */ -#define PCI_memory_limit1_2 0x28 /* (4 bytes) */ -#define PCI_io_base0_2 0x2c /* (4 bytes) */ -#define PCI_io_limit0_2 0x30 /* (4 bytes) */ -#define PCI_io_base1_2 0x34 /* (4 bytes) */ -#define PCI_io_limit1_2 0x38 /* (4 bytes) */ -#define PCI_bridge_control_2 0x3E /* (2 bytes) */ - -#define PCI_sub_vendor_id_2 0x40 /* (2 bytes) */ -#define PCI_sub_device_id_2 0x42 /* (2 bytes) */ - -#define PCI_card_interface_2 0x44 /* ?? */ - -/* --- - values for the class_base field in the common header ---- */ - -#define PCI_early 0x00 /* built before class codes defined */ -#define PCI_mass_storage 0x01 /* mass storage_controller */ -#define PCI_network 0x02 /* network controller */ -#define PCI_display 0x03 /* display controller */ -#define PCI_multimedia 0x04 /* multimedia device */ -#define PCI_memory 0x05 /* memory controller */ -#define PCI_bridge 0x06 /* bridge controller */ -#define PCI_simple_communications 0x07 /* simple communications controller */ -#define PCI_base_peripheral 0x08 /* base system peripherals */ -#define PCI_input 0x09 /* input devices */ -#define PCI_docking_station 0x0a /* docking stations */ -#define PCI_processor 0x0b /* processors */ -#define PCI_serial_bus 0x0c /* serial bus controllers */ -#define PCI_wireless 0x0d /* wireless controllers */ -#define PCI_intelligent_io 0x0e -#define PCI_satellite_communications 0x0f -#define PCI_encryption_decryption 0x10 -#define PCI_data_acquisition 0x11 - -#define PCI_undefined 0xFF /* not in any defined class */ +#define PCI_capabilities_ptr_2 0x14 +#define PCI_secondary_status_2 0x16 +#define PCI_primary_bus_2 0x18 +#define PCI_secondary_bus_2 0x19 +#define PCI_subordinate_bus_2 0x1A +#define PCI_secondary_latency_2 0x1B +#define PCI_memory_base0_2 0x1C +#define PCI_memory_limit0_2 0x20 +#define PCI_memory_base1_2 0x24 +#define PCI_memory_limit1_2 0x28 +#define PCI_io_base0_2 0x2C +#define PCI_io_limit0_2 0x30 +#define PCI_io_base1_2 0x34 +#define PCI_io_limit1_2 0x38 +#define PCI_bridge_control_2 0x3E +#define PCI_sub_vendor_id_2 0x40 +#define PCI_sub_device_id_2 0x42 +#define PCI_card_interface_2 0x44 -/* --- - values for the class_sub field for class_base = 0x00 (built before - class codes were defined) ---- */ +/* values for the class_base field in the common header */ +#define PCI_early 0x00 +#define PCI_mass_storage 0x01 +#define PCI_network 0x02 +#define PCI_display 0x03 +#define PCI_multimedia 0x04 +#define PCI_memory 0x05 +#define PCI_bridge 0x06 +#define PCI_simple_communications 0x07 +#define PCI_base_peripheral 0x08 +#define PCI_input 0x09 +#define PCI_docking_station 0x0A +#define PCI_processor 0x0B +#define PCI_serial_bus 0x0C +#define PCI_wireless 0x0D +#define PCI_intelligent_io 0x0E +#define PCI_satellite_communications 0x0F +#define PCI_encryption_decryption 0x10 +#define PCI_data_acquisition 0x11 +#define PCI_undefined 0xFF -#define PCI_early_not_vga 0x00 /* all except vga */ -#define PCI_early_vga 0x01 /* vga devices */ +/* values for the class_sub field for class_base = 0x00 (early) */ +#define PCI_early_not_vga 0x00 +#define PCI_early_vga 0x01 + +/* values for the class_sub field for class_base = 0x01 (mass storage) */ +#define PCI_scsi 0x00 +#define PCI_ide 0x01 +#define PCI_floppy 0x02 +#define PCI_ipi 0x03 +#define PCI_raid 0x04 +#define PCI_ata 0x05 +#define PCI_sata 0x06 +#define PCI_sas 0x07 +#define PCI_mass_storage_other 0x80 + +/* values of the class_api field for class_base = 0x01, class_sub = 0x06 */ +#define PCI_sata_other 0x00 +#define PCI_sata_ahci 0x01 + +/* values for the class_sub field for class_base = 0x02 (network) */ +#define PCI_ethernet 0x00 +#define PCI_token_ring 0x01 +#define PCI_fddi 0x02 +#define PCI_atm 0x03 +#define PCI_isdn 0x04 +#define PCI_network_other 0x80 + +/* values for the class_sub field for class_base = 0x03 (display) */ +#define PCI_vga 0x00 +#define PCI_xga 0x01 +#define PCI_3d 0x02 +#define PCI_display_other 0x80 + +/* values for the class_sub field for class_base = 0x04 (multimedia device) */ +#define PCI_video 0x00 +#define PCI_audio 0x01 +#define PCI_telephony 0x02 +#define PCI_hd_audio 0x03 +#define PCI_multimedia_other 0x80 + +/* values for the class_sub field for class_base = 0x05 (memory) */ +#define PCI_ram 0x00 +#define PCI_flash 0x01 +#define PCI_memory_other 0x80 + +/* values for the class_sub field for class_base = 0x06 (bridge) */ +#define PCI_host 0x00 +#define PCI_isa 0x01 +#define PCI_eisa 0x02 +#define PCI_microchannel 0x03 +#define PCI_pci 0x04 +#define PCI_pcmcia 0x05 +#define PCI_nubus 0x06 +#define PCI_cardbus 0x07 +#define PCI_raceway 0x08 +#define PCI_bridge_transparent 0x09 +#define PCI_bridge_infiniband 0x0A +#define PCI_bridge_other 0x80 + +/* values for the class_sub field for class_base = 0x07 (simple comm ctrlers) */ +#define PCI_serial 0x00 +#define PCI_parallel 0x01 +#define PCI_multiport_serial 0x02 +#define PCI_modem 0x03 +#define PCI_simple_communications_other 0x80 + +/* values of the class_api field for class_base = 0x07 and class_sub = 0x00 */ +#define PCI_serial_xt 0x00 +#define PCI_serial_16450 0x01 +#define PCI_serial_16550 0x02 + +/* values of the class_api field for class_base = 0x07 and class_sub = 0x01 */ +#define PCI_parallel_simple 0x00 +#define PCI_parallel_bidirectional 0x01 +#define PCI_parallel_ecp 0x02 -/* --- - values for the class_sub field for class_base = 0x01 (mass storage) ---- */ +/* values for the class_sub field for class_base = 0x08 (system peripherals) */ +#define PCI_pic 0x00 +#define PCI_dma 0x01 +#define PCI_timer 0x02 +#define PCI_rtc 0x03 +#define PCI_generic_hot_plug 0x04 +#define PCI_system_peripheral_other 0x80 -#define PCI_scsi 0x00 /* SCSI controller */ -#define PCI_ide 0x01 /* IDE controller */ -#define PCI_floppy 0x02 /* floppy disk controller */ -#define PCI_ipi 0x03 /* IPI bus controller */ -#define PCI_raid 0x04 /* RAID controller */ -#define PCI_ata 0x05 /* ATA controller with ADMA interface */ -#define PCI_sata 0x06 /* Serial ATA controller */ -#define PCI_sas 0x07 /* Serial Attached SCSI controller */ -#define PCI_mass_storage_other 0x80 /* other mass storage controller */ +/* values of the class_api field for class_base = 0x08 and class_sub = 0x00 */ +#define PCI_pic_8259 0x00 +#define PCI_pic_isa 0x01 +#define PCI_pic_eisa 0x02 -/* --- - values of the class_api field for - class_base = 0x01 (mass storage) - class_sub = 0x06 (Serial ATA controller) ---- */ +/* values of the class_api field for class_base = 0x08 and class_sub = 0x01 */ +#define PCI_dma_8237 0x00 +#define PCI_dma_isa 0x01 +#define PCI_dma_eisa 0x02 -#define PCI_sata_other 0x00 /* vendor specific interface */ -#define PCI_sata_ahci 0x01 /* AHCI interface */ +/* values of the class_api field for class_base = 0x08 and class_sub = 0x02 */ +#define PCI_timer_8254 0x00 +#define PCI_timer_isa 0x01 +#define PCI_timer_eisa 0x02 +/* values of the class_api field for class_base = 0x08 and class_sub = 0x03 */ +#define PCI_rtc_generic 0x00 +#define PCI_rtc_isa 0x01 -/* --- - values for the class_sub field for class_base = 0x02 (network) ---- */ +/* values for the class_sub field for class_base = 0x09 (input devices) */ +#define PCI_keyboard 0x00 +#define PCI_pen 0x01 +#define PCI_mouse 0x02 +#define PCI_scanner 0x03 +#define PCI_gameport 0x04 +#define PCI_input_other 0x80 -#define PCI_ethernet 0x00 /* Ethernet controller */ -#define PCI_token_ring 0x01 /* Token Ring controller */ -#define PCI_fddi 0x02 /* FDDI controller */ -#define PCI_atm 0x03 /* ATM controller */ -#define PCI_isdn 0x04 /* ISDN controller */ -#define PCI_network_other 0x80 /* other network controller */ +/* values for the class_sub field for class_base = 0x0A (docking stations) */ +#define PCI_docking_generic 0x00 +#define PCI_docking_other 0x80 +/* values for the class_sub field for class_base = 0x0B (processor) */ +#define PCI_386 0x00 +#define PCI_486 0x01 +#define PCI_pentium 0x02 +#define PCI_alpha 0x10 +#define PCI_PowerPC 0x20 +#define PCI_mips 0x30 +#define PCI_coprocessor 0x40 -/* --- - values for the class_sub field for class_base = 0x03 (display) ---- */ - -#define PCI_vga 0x00 /* VGA controller */ -#define PCI_xga 0x01 /* XGA controller */ -#define PCI_3d 0x02 /* 3d controller */ -#define PCI_display_other 0x80 /* other display controller */ - - -/* --- - values for the class_sub field for class_base = 0x04 (multimedia device) ---- */ - -#define PCI_video 0x00 /* video */ -#define PCI_audio 0x01 /* audio */ -#define PCI_telephony 0x02 /* computer telephony device */ -#define PCI_hd_audio 0x03 /* HD audio */ -#define PCI_multimedia_other 0x80 /* other multimedia device */ - - -/* --- - values for the class_sub field for class_base = 0x05 (memory) ---- */ - -#define PCI_ram 0x00 /* RAM */ -#define PCI_flash 0x01 /* flash */ -#define PCI_memory_other 0x80 /* other memory controller */ - - -/* --- - values for the class_sub field for class_base = 0x06 (bridge) ---- */ - -#define PCI_host 0x00 /* host bridge */ -#define PCI_isa 0x01 /* ISA bridge */ -#define PCI_eisa 0x02 /* EISA bridge */ -#define PCI_microchannel 0x03 /* MicroChannel bridge */ -#define PCI_pci 0x04 /* PCI-to-PCI bridge */ -#define PCI_pcmcia 0x05 /* PCMCIA bridge */ -#define PCI_nubus 0x06 /* NuBus bridge */ -#define PCI_cardbus 0x07 /* CardBus bridge */ -#define PCI_raceway 0x08 /* RACEway bridge */ -#define PCI_bridge_transparent 0x09 /* PCI transparent */ -#define PCI_bridge_infiniband 0x0a /* Infiniband */ -#define PCI_bridge_other 0x80 /* other bridge device */ - - -/* --- - values for the class_sub field for class_base = 0x07 (simple - communications controllers) ---- */ - -#define PCI_serial 0x00 /* serial port controller */ -#define PCI_parallel 0x01 /* parallel port */ -#define PCI_multiport_serial 0x02 /* multiport serial controller */ -#define PCI_modem 0x03 /* modem */ -#define PCI_simple_communications_other 0x80 /* other communications device */ - -/* --- - values of the class_api field for - class_base = 0x07 (simple communications), and - class_sub = 0x00 (serial port controller) ---- */ - -#define PCI_serial_xt 0x00 /* XT-compatible serial controller */ -#define PCI_serial_16450 0x01 /* 16450-compatible serial controller */ -#define PCI_serial_16550 0x02 /* 16550-compatible serial controller */ - - -/* --- - values of the class_api field for - class_base = 0x07 (simple communications), and - class_sub = 0x01 (parallel port) ---- */ - -#define PCI_parallel_simple 0x00 /* simple (output-only) parallel port */ -#define PCI_parallel_bidirectional 0x01 /* bidirectional parallel port */ -#define PCI_parallel_ecp 0x02 /* ECP 1.x compliant parallel port */ - - -/* --- - values for the class_sub field for class_base = 0x08 (generic - system peripherals) ---- */ - -#define PCI_pic 0x00 /* peripheral interrupt controller */ -#define PCI_dma 0x01 /* dma controller */ -#define PCI_timer 0x02 /* timers */ -#define PCI_rtc 0x03 /* real time clock */ -#define PCI_generic_hot_plug 0x04 /* generic PCI hot-plug controller */ -#define PCI_system_peripheral_other 0x80 /* other generic system peripheral */ - -/* --- - values of the class_api field for - class_base = 0x08 (generic system peripherals) - class_sub = 0x00 (peripheral interrupt controller) ---- */ - -#define PCI_pic_8259 0x00 /* generic 8259 */ -#define PCI_pic_isa 0x01 /* ISA pic */ -#define PCI_pic_eisa 0x02 /* EISA pic */ - -/* --- - values of the class_api field for - class_base = 0x08 (generic system peripherals) - class_sub = 0x01 (dma controller) ---- */ - -#define PCI_dma_8237 0x00 /* generic 8237 */ -#define PCI_dma_isa 0x01 /* ISA dma */ -#define PCI_dma_eisa 0x02 /* EISA dma */ - -/* --- - values of the class_api field for - class_base = 0x08 (generic system peripherals) - class_sub = 0x02 (timer) ---- */ - -#define PCI_timer_8254 0x00 /* generic 8254 */ -#define PCI_timer_isa 0x01 /* ISA timer */ -#define PCI_timer_eisa 0x02 /* EISA timers (2 timers) */ - - -/* --- - values of the class_api field for - class_base = 0x08 (generic system peripherals) - class_sub = 0x03 (real time clock ---- */ - -#define PCI_rtc_generic 0x00 /* generic real time clock */ -#define PCI_rtc_isa 0x01 /* ISA real time clock */ - - -/* --- - values for the class_sub field for class_base = 0x09 (input devices) ---- */ - -#define PCI_keyboard 0x00 /* keyboard controller */ -#define PCI_pen 0x01 /* pen */ -#define PCI_mouse 0x02 /* mouse controller */ -#define PCI_scanner 0x03 /* scanner controller */ -#define PCI_gameport 0x04 /* gameport controller */ -#define PCI_input_other 0x80 /* other input controller */ - - -/* --- - values for the class_sub field for class_base = 0x0a (docking stations) ---- */ - -#define PCI_docking_generic 0x00 /* generic docking station */ -#define PCI_docking_other 0x80 /* other docking stations */ - -/* --- - values for the class_sub field for class_base = 0x0b (processor) ---- */ - -#define PCI_386 0x00 /* 386 */ -#define PCI_486 0x01 /* 486 */ -#define PCI_pentium 0x02 /* Pentium */ -#define PCI_alpha 0x10 /* Alpha */ -#define PCI_PowerPC 0x20 /* PowerPC */ -#define PCI_mips 0x30 /* MIPS */ -#define PCI_coprocessor 0x40 /* co-processor */ - -/* --- - values for the class_sub field for class_base = 0x0c (serial bus - controller) ---- */ - -#define PCI_firewire 0x00 /* FireWire (IEEE 1394) */ -#define PCI_access 0x01 /* ACCESS bus */ -#define PCI_ssa 0x02 /* SSA */ -#define PCI_usb 0x03 /* Universal Serial Bus */ -#define PCI_fibre_channel 0x04 /* Fibre channel */ +/* values for the class_sub field for class_base = 0x0C (serial bus ctrlr) */ +#define PCI_firewire 0x00 +#define PCI_access 0x01 +#define PCI_ssa 0x02 +#define PCI_usb 0x03 +#define PCI_fibre_channel 0x04 #define PCI_smbus 0x05 -#define PCI_infiniband 0x06 +#define PCI_infiniband 0x06 #define PCI_ipmi 0x07 #define PCI_sercos 0x08 #define PCI_canbus 0x09 -/* --- - values of the class_api field for - class_base = 0x0c ( serial bus controller ) - class_sub = 0x03 ( Universal Serial Bus ) ---- */ +/* values of the class_api field for class_base = 0x0C and class_sub = 0x03 */ +#define PCI_usb_uhci 0x00 +#define PCI_usb_ohci 0x10 +#define PCI_usb_ehci 0x20 +#define PCI_usb_xhci 0x30 /* Extensible Host Controller Interface */ -#define PCI_usb_uhci 0x00 /* Universal Host Controller Interface */ -#define PCI_usb_ohci 0x10 /* Open Host Controller Interface */ -#define PCI_usb_ehci 0x20 /* Enhanced Host Controller Interface */ -#define PCI_usb_xhci 0x30 /* Extensible Host Controller Interface */ - -/* --- - values for the class_sub field for class_base = 0x0d (wireless controller) ---- */ +/* values for the class_sub field for class_base = 0x0d (wireless controller) */ #define PCI_wireless_irda 0x00 -#define PCI_wireless_consumer_ir 0x01 +#define PCI_wireless_consumer_ir 0x01 #define PCI_wireless_rf 0x02 -#define PCI_wireless_bluetooth 0x03 -#define PCI_wireless_broadband 0x04 +#define PCI_wireless_bluetooth 0x03 +#define PCI_wireless_broadband 0x04 #define PCI_wireless_80211A 0x10 #define PCI_wireless_80211B 0x20 #define PCI_wireless_other 0x80 -/* --- - masks for command register bits ---- */ -#define PCI_command_io 0x001 /* 1/0 i/o space en/disabled */ -#define PCI_command_memory 0x002 /* 1/0 memory space en/disabled */ -#define PCI_command_master 0x004 /* 1/0 pci master en/disabled */ -#define PCI_command_special 0x008 /* 1/0 pci special cycles en/disabled */ -#define PCI_command_mwi 0x010 /* 1/0 memory write & invalidate en/disabled */ -#define PCI_command_vga_snoop 0x020 /* 1/0 vga pallette snoop en/disabled */ -#define PCI_command_parity 0x040 /* 1/0 parity check en/disabled */ -#define PCI_command_address_step 0x080 /* 1/0 address stepping en/disabled */ -#define PCI_command_serr 0x100 /* 1/0 SERR# en/disabled */ -#define PCI_command_fastback 0x200 /* 1/0 fast back-to-back en/disabled */ -#define PCI_command_int_disable 0x400 /* 1/0 interrupt generation dis/enabled */ +/* masks for command register bits */ +#define PCI_command_io 0x001 +#define PCI_command_memory 0x002 +#define PCI_command_master 0x004 +#define PCI_command_special 0x008 +#define PCI_command_mwi 0x010 +#define PCI_command_vga_snoop 0x020 +#define PCI_command_parity 0x040 +#define PCI_command_address_step 0x080 +#define PCI_command_serr 0x100 +#define PCI_command_fastback 0x200 +#define PCI_command_int_disable 0x400 -/* --- - masks for status register bits ---- */ - -#define PCI_status_capabilities 0x0010 /* capabilities list */ -#define PCI_status_66_MHz_capable 0x0020 /* 66 Mhz capable */ -#define PCI_status_udf_supported 0x0040 /* user-definable-features (udf) supported */ -#define PCI_status_fastback 0x0080 /* fast back-to-back capable */ -#define PCI_status_parity_signalled 0x0100 /* parity error signalled */ -#define PCI_status_devsel 0x0600 /* devsel timing (see below) */ -#define PCI_status_target_abort_signalled 0x0800 /* signaled a target abort */ -#define PCI_status_target_abort_received 0x1000 /* received a target abort */ -#define PCI_status_master_abort_received 0x2000 /* received a master abort */ -#define PCI_status_serr_signalled 0x4000 /* signalled SERR# */ -#define PCI_status_parity_error_detected 0x8000 /* parity error detected */ +/* masks for status register bits */ +#define PCI_status_capabilities 0x0010 +#define PCI_status_66_MHz_capable 0x0020 +#define PCI_status_udf_supported 0x0040 +#define PCI_status_fastback 0x0080 +#define PCI_status_parity_signalled 0x0100 +#define PCI_status_devsel 0x0600 +#define PCI_status_target_abort_signalled 0x0800 +#define PCI_status_target_abort_received 0x1000 +#define PCI_status_master_abort_received 0x2000 +#define PCI_status_serr_signalled 0x4000 +#define PCI_status_parity_error_detected 0x8000 -/* --- - masks for devsel field in status register ---- */ - -#define PCI_status_devsel_fast 0x0000 /* fast */ -#define PCI_status_devsel_medium 0x0200 /* medium */ -#define PCI_status_devsel_slow 0x0400 /* slow */ +/* masks for devsel field in status register */ +#define PCI_status_devsel_fast 0x0000 +#define PCI_status_devsel_medium 0x0200 +#define PCI_status_devsel_slow 0x0400 -/* --- - masks for header type register ---- */ - -#define PCI_header_type_mask 0x7F /* header type field */ -#define PCI_multifunction 0x80 /* multifunction device flag */ +/* masks for header type register */ +#define PCI_header_type_mask 0x7F +#define PCI_multifunction 0x80 -/** types of PCI header */ - +/* types of PCI header */ #define PCI_header_type_generic 0x00 #define PCI_header_type_PCI_to_PCI_bridge 0x01 -#define PCI_header_type_cardbus 0x02 +#define PCI_header_type_cardbus 0x02 -/* --- - masks for built in self test (bist) register bits ---- */ - -#define PCI_bist_code 0x0F /* self-test completion code, 0 = success */ -#define PCI_bist_start 0x40 /* 1 = start self-test */ -#define PCI_bist_capable 0x80 /* 1 = self-test capable */ +/* masks for built in self test (bist) register bits */ +#define PCI_bist_code 0x0F +#define PCI_bist_start 0x40 +#define PCI_bist_capable 0x80 -/** masks for flags in the various base address registers */ - -#define PCI_address_space 0x01 /* 0 = memory space, 1 = i/o space */ -#define PCI_register_start 0x10 -#define PCI_register_end 0x24 -#define PCI_register_ppb_end 0x18 -#define PCI_register_pcb_end 0x14 - -/** masks for flags in memory space base address registers */ - -#define PCI_address_type_32 0x00 /* locate anywhere in 32 bit space */ -#define PCI_address_type_32_low 0x02 /* locate below 1 Meg */ -#define PCI_address_type_64 0x04 /* locate anywhere in 64 bit space */ -#define PCI_address_type 0x06 /* type (see below) */ -#define PCI_address_prefetchable 0x08 /* 1 if prefetchable (see PCI spec) */ - -#define PCI_address_memory_32_mask 0xFFFFFFF0 /* mask to get 32bit memory space base address */ +/* masks for flags in the various base address registers */ +#define PCI_address_space 0x01 +#define PCI_register_start 0x10 +#define PCI_register_end 0x24 +#define PCI_register_ppb_end 0x18 +#define PCI_register_pcb_end 0x14 -/* --- - masks for flags in i/o space base address registers ---- */ - -#define PCI_address_io_mask 0xFFFFFFFC /* mask to get i/o space base address */ +/* masks for flags in memory space base address registers */ +#define PCI_address_type_32 0x00 +#define PCI_address_type_32_low 0x02 +#define PCI_address_type_64 0x04 +#define PCI_address_type 0x06 +#define PCI_address_prefetchable 0x08 +#define PCI_address_memory_32_mask 0xFFFFFFF0 -/* --- - masks for flags in expansion rom base address registers ---- */ +/* masks for flags in i/o space base address registers */ +#define PCI_address_io_mask 0xFFFFFFFC -#define PCI_rom_enable 0x00000001 /* 1 expansion rom decode enabled */ + +/* masks for flags in expansion rom base address registers */ +#define PCI_rom_enable 0x00000001 #define PCI_rom_shadow 0x00000010 /* 2 rom copied at shadow (C0000) */ #define PCI_rom_copy 0x00000100 /* 4 rom is allocated copy */ #define PCI_rom_bios 0x00001000 /* 8 rom is bios copy */ -#define PCI_rom_address_mask 0xFFFFF800 /* mask to get expansion rom addr */ +#define PCI_rom_address_mask 0xFFFFF800 -/** PCI interrupt pin values */ -#define PCI_pin_mask 0x07 -#define PCI_pin_none 0x00 -#define PCI_pin_a 0x01 -#define PCI_pin_b 0x02 -#define PCI_pin_c 0x03 -#define PCI_pin_d 0x04 -#define PCI_pin_max 0x04 -/** PCI Capability Codes */ -#define PCI_cap_id_reserved 0x00 -#define PCI_cap_id_pm 0x01 /* Power management */ -#define PCI_cap_id_agp 0x02 /* AGP */ -#define PCI_cap_id_vpd 0x03 /* Vital product data */ -#define PCI_cap_id_slotid 0x04 /* Slot ID */ -#define PCI_cap_id_msi 0x05 /* Message signalled interrupt */ -#define PCI_cap_id_chswp 0x06 /* Compact PCI HotSwap */ -#define PCI_cap_id_pcix 0x07 /* PCI-X */ -#define PCI_cap_id_ldt 0x08 -#define PCI_cap_id_vendspec 0x09 -#define PCI_cap_id_debugport 0x0a -#define PCI_cap_id_cpci_rsrcctl 0x0b -#define PCI_cap_id_hotplug 0x0c -#define PCI_cap_id_subvendor 0x0d -#define PCI_cap_id_agp8x 0x0e -#define PCI_cap_id_secure_dev 0x0f -#define PCI_cap_id_pcie 0x10 /* PCIe (PCI express) */ -#define PCI_cap_id_msix 0x11 /* MSI-X */ -#define PCI_cap_id_sata 0x12 /* Serial ATA Capability */ -#define PCI_cap_id_pciaf 0x13 /* PCI Advanced Features */ +/* PCI interrupt pin values */ +#define PCI_pin_mask 0x07 +#define PCI_pin_none 0x00 +#define PCI_pin_a 0x01 +#define PCI_pin_b 0x02 +#define PCI_pin_c 0x03 +#define PCI_pin_d 0x04 +#define PCI_pin_max 0x04 -/** Power Management Control Status Register settings */ -#define PCI_pm_mask 0x03 -#define PCI_pm_ctrl 0x02 -#define PCI_pm_d1supp 0x0200 -#define PCI_pm_d2supp 0x0400 -#define PCI_pm_status 0x04 -#define PCI_pm_state_d0 0x00 -#define PCI_pm_state_d1 0x01 -#define PCI_pm_state_d2 0x02 -#define PCI_pm_state_d3 0x03 -/** MSI registers **/ +/* PCI Capability Codes */ +#define PCI_cap_id_reserved 0x00 +#define PCI_cap_id_pm 0x01 +#define PCI_cap_id_agp 0x02 +#define PCI_cap_id_vpd 0x03 +#define PCI_cap_id_slotid 0x04 +#define PCI_cap_id_msi 0x05 +#define PCI_cap_id_chswp 0x06 +#define PCI_cap_id_pcix 0x07 +#define PCI_cap_id_ldt 0x08 +#define PCI_cap_id_vendspec 0x09 +#define PCI_cap_id_debugport 0x0a +#define PCI_cap_id_cpci_rsrcctl 0x0b +#define PCI_cap_id_hotplug 0x0c +#define PCI_cap_id_subvendor 0x0d +#define PCI_cap_id_agp8x 0x0e +#define PCI_cap_id_secure_dev 0x0f +#define PCI_cap_id_pcie 0x10 +#define PCI_cap_id_msix 0x11 +#define PCI_cap_id_sata 0x12 +#define PCI_cap_id_pciaf 0x13 + + +/* Power Management Control Status Register settings */ +#define PCI_pm_mask 0x03 +#define PCI_pm_ctrl 0x02 +#define PCI_pm_d1supp 0x0200 +#define PCI_pm_d2supp 0x0400 +#define PCI_pm_status 0x04 +#define PCI_pm_state_d0 0x00 +#define PCI_pm_state_d1 0x01 +#define PCI_pm_state_d2 0x02 +#define PCI_pm_state_d3 0x03 + + +/* MSI registers */ #define PCI_msi_control 0x02 #define PCI_msi_address 0x04 #define PCI_msi_address_high 0x08 @@ -697,7 +549,7 @@ struct pci_module_info { #define PCI_msi_mask 0x10 #define PCI_msi_pending 0x14 -/** MSI control register values **/ +/* MSI control register values */ #define PCI_msi_control_enable 0x0001 #define PCI_msi_control_vector 0x0100 #define PCI_msi_control_64bit 0x0080 @@ -716,8 +568,10 @@ struct pci_module_info { #define PCI_msi_control_mmc_16 0x0008 #define PCI_msi_control_mmc_32 0x000a + #ifdef __cplusplus } #endif + #endif /* _PCI_H */ diff --git a/headers/os/drivers/atomizer.h b/headers/os/drivers/atomizer.h index d3c6bf3f9d..3f049fcf9b 100644 --- a/headers/os/drivers/atomizer.h +++ b/headers/os/drivers/atomizer.h @@ -1,97 +1,47 @@ -/******************************************************************************* -/ -/ File: atomizer.h -/ -/ Description: Kernel atomizer module API -/ -/ Copyright 1999, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ - -#ifndef _ATOMIZER_MODULE_H_ -#define _ATOMIZER_MODULE_H_ +/* + * Copyright 2010, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _ATOMIZER_H +#define _ATOMIZER_H +#include #include + #ifdef __cplusplus extern "C" { #endif -/* - An atomizer is a software device that returns a unique token for a - null-terminated UTF8 string. - Each atomizer comprises a separate token space. The same string interned - in two different atomizers will generate two distinct tokens. +#define B_ATOMIZER_MODULE_NAME "generic/atomizer/v1" +#define B_SYSTEM_ATOMIZER_NAME "Haiku System Atomizer" - Atomizers and the tokens they generate are only guaranteed valid between - matched calls to get_module/put_module. - - void * find_or_make_atomizer(const char *string) - Returns a token that identifies the named atomizer, creating a new - atomizer if the named atomizer does not exist. Pass null, a zero - length string, or the value B_SYSTEM_ATOMIZER_NAME for string will - return a pointer to the system atomizer. Returns (void *)(0) - if the atomizer could not be created (for whatever reason). A return - value of (void *)(-1) refers to the system atomizer. - status_t delete_atomizer(void *atomizer) - Delete the atomizer specified. Returns B_OK if successfull, B_ERROR - otherwise. An error return usually means that a race condition was - detected while destroying the atomizer. - - void * atomize(void *atomizer, const char *string, int create) - Return the unique token for the specified string, creating a new token - if the string was not previously atomized and create is non-zero. If - atomizer is (void *)(-1), use the system atomizer (saving the step of - looking it up with find_or_make_atomizer(). Returns (const char *)(0) - if there were any errors detected: insufficient memory or a race - condition with someone deleting the atomizer. - - const char * string_for_token(void *atomizer, void *atom) - Return a pointer to the string described by atom in the provided atomizer. - Returns (const char *)(0) if either the atomizer or the atom were invalid. - - status_t get_next_atomizer_info(void **cookie, atomizer_info *info) - Returns info about the next atomizer in the list of atomizers by modifying - the contents of info. The pointer specified by *cookie should be set to - (void *)(0) to retrieve the first atomizer, and should not be modified - thereafter. Returns B_ERROR when there are no more atomizers. - Adding or deleting atomizers between calls to get_next_atomizer() results - in a safe but undefined behavior. - - void * get_next_atom(void *atomizer, uint32 *cookie) - Returns the next atom interned in specified atomizer, *cookie - should be set to (uint32)(0) to get the first atom. Returns - (void *)(0) when there are no more atoms. Adding atoms between - calls to get_next_atom() may cause atoms to be skipped. - - Atomizers are SMP-safe. Check return codes for errors! - -*/ - -#define B_ATOMIZER_MODULE_NAME "generic/atomizer/v1" -#define B_SYSTEM_ATOMIZER_NAME "BeOS System Atomizer" - -typedef struct { - void *atomizer; /* An opaque token representing the atomizer. */ - char name[B_OS_NAME_LENGTH]; /* The first B_OS_NAME_LENGTH bytes of the atomizer name, null terminated. */ - uint32 atom_count; /* The number of atoms currently interned in this atomizer. */ +typedef struct atomizer_info { + void* atomizer; + char name[B_OS_NAME_LENGTH]; + uint32 atom_count; } atomizer_info; -typedef struct { + +typedef struct atomizer_module_info { module_info minfo; - const void * (*find_or_make_atomizer)(const char *string); - status_t (*delete_atomizer)(const void *atomizer); - const void * (*atomize)(const void *atomizer, const char *string, int create); - const char * (*string_for_token)(const void * atomizer, const void *atom); - status_t (*get_next_atomizer_info)(void **cookie, atomizer_info *info); - const void * (*get_next_atom)(const void *atomizer, uint32 *cookie); + const void* (*find_or_make_atomizer)(const char* string); + status_t (*delete_atomizer)(const void* atomizer); + const void* (*atomize) + (const void* atomizer, const char* string, int create); + const char* (*string_for_token) + (const void* atomizer, const void* atom); + status_t (*get_next_atomizer_info) + (void** cookie, atomizer_info* info); + const void* (*get_next_atom)(const void* atomizer, uint32* cookie); } atomizer_module_info; + #ifdef __cplusplus } #endif -#endif +#endif /* _ATOMIZER_H */ From a576344849833885d2e1eda3d77461306a30bbca Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 15:46:26 +0000 Subject: [PATCH 498/702] Patch by Karvjorm : localize FontDemo (#7349). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42959 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/fontdemo/ControlView.cpp | 59 +++++++++++++++++++----------- src/apps/fontdemo/FontDemo.cpp | 9 ++++- src/apps/fontdemo/FontDemoView.cpp | 6 ++- src/apps/fontdemo/Jamfile | 15 +++++++- 4 files changed, 64 insertions(+), 25 deletions(-) diff --git a/src/apps/fontdemo/ControlView.cpp b/src/apps/fontdemo/ControlView.cpp index a502bbe011..9d85aa0a13 100644 --- a/src/apps/fontdemo/ControlView.cpp +++ b/src/apps/fontdemo/ControlView.cpp @@ -11,6 +11,7 @@ #include "messages.h" #include +#include #include #include #include @@ -24,6 +25,8 @@ #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ControlView" ControlView::ControlView(BRect rect) : BView(rect, "ControlView", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE_JUMP), @@ -66,7 +69,8 @@ ControlView::AttachedToWindow() float offsetX = 0; float offsetY = 0; - fTextControl = new BTextControl(rect, "TextInput", "Text:", "Haiku, Inc.", NULL); + fTextControl = new BTextControl(rect, "TextInput", B_TRANSLATE("Text:"), + B_TRANSLATE("Haiku, Inc."), NULL); fTextControl->SetDivider(29.0); fTextControl->SetModificationMessage(new BMessage(TEXT_CHANGED_MSG)); AddChild(fTextControl); @@ -75,7 +79,8 @@ ControlView::AttachedToWindow() _AddFontMenu(rect); rect.OffsetBy(0.0, 29.0); - fFontsizeSlider = new BSlider(rect, "Fontsize", "Size: 50", NULL, 4, 360); + fFontsizeSlider = new BSlider(rect, "Fontsize", B_TRANSLATE("Size: 50"), + NULL, 4, 360); fFontsizeSlider->SetModificationMessage(new BMessage(FONTSIZE_MSG)); fFontsizeSlider->SetValue(50); AddChild(fFontsizeSlider); @@ -85,31 +90,35 @@ ControlView::AttachedToWindow() offsetX += 1; rect.OffsetBy(0.0, offsetX); - fShearSlider = new BSlider(rect, "Shear", "Shear: 90", NULL, 45, 135); + fShearSlider = new BSlider(rect, "Shear", B_TRANSLATE("Shear: 90"), NULL, + 45, 135); fShearSlider->SetModificationMessage(new BMessage(FONTSHEAR_MSG)); fShearSlider->SetValue(90); AddChild(fShearSlider); rect.OffsetBy(0.0, offsetX); - fRotationSlider = new BSlider(rect, "Rotation", "Rotation: 0", NULL, 0, 360); + fRotationSlider = new BSlider(rect, "Rotation", B_TRANSLATE("Rotation: 0"), + NULL, 0, 360); fRotationSlider->SetModificationMessage( new BMessage(ROTATION_MSG)); fRotationSlider->SetValue(0); AddChild(fRotationSlider); rect.OffsetBy(0.0, offsetX); - fSpacingSlider = new BSlider(rect, "Spacing", "Spacing: 0", NULL, -5, 50); + fSpacingSlider = new BSlider(rect, "Spacing", B_TRANSLATE("Spacing: 0"), + NULL, -5, 50); fSpacingSlider->SetModificationMessage(new BMessage(SPACING_MSG)); fSpacingSlider->SetValue(0); AddChild(fSpacingSlider); rect.OffsetBy(0.0, offsetX); - fOutlineSlider = new BSlider(rect, "Outline", "Outline:", NULL, 0, 20); + fOutlineSlider = new BSlider(rect, "Outline", B_TRANSLATE("Outline:"), + NULL, 0, 20); fOutlineSlider->SetModificationMessage(new BMessage(OUTLINE_MSG)); AddChild(fOutlineSlider); rect.OffsetBy(0.0, offsetX); - fAliasingCheckBox = new BCheckBox(rect, "Aliasing", "Antialiased text", - new BMessage(ALIASING_MSG)); + fAliasingCheckBox = new BCheckBox(rect, "Aliasing", + B_TRANSLATE("Antialiased text"), new BMessage(ALIASING_MSG)); fAliasingCheckBox->SetValue(B_CONTROL_ON); AddChild(fAliasingCheckBox); @@ -154,18 +163,20 @@ ControlView::AttachedToWindow() fDrawingModeMenu->SetLabelFromMarked(true); - BMenuField *drawingModeMenuField = new BMenuField(rect, "FontMenuField", "Drawing mode:", fDrawingModeMenu, true); - drawingModeMenuField->SetDivider(5+StringWidth("Drawing mode:")); + BMenuField *drawingModeMenuField = new BMenuField(rect, "FontMenuField", + B_TRANSLATE("Drawing mode:"), fDrawingModeMenu, true); + drawingModeMenuField->SetDivider(5+StringWidth( + B_TRANSLATE("Drawing mode:"))); AddChild(drawingModeMenuField); rect.OffsetBy(0.0, 22); - fBoundingboxesCheckBox = new BCheckBox(rect, "BoundingBoxes", "Bounding boxes", - new BMessage(BOUNDING_BOX_MSG)); + fBoundingboxesCheckBox = new BCheckBox(rect, "BoundingBoxes", + B_TRANSLATE("Bounding boxes"), new BMessage(BOUNDING_BOX_MSG)); AddChild(fBoundingboxesCheckBox); rect.OffsetBy(0.0, 22.0); - fCyclingFontButton = new BButton(rect, "Cyclefonts", "Cycle fonts", - new BMessage(CYCLING_FONTS_MSG)); + fCyclingFontButton = new BButton(rect, "Cyclefonts", + B_TRANSLATE("Cycle fonts"), new BMessage(CYCLING_FONTS_MSG)); AddChild(fCyclingFontButton); fTextControl->SetTarget(this); @@ -222,7 +233,8 @@ ControlView::MessageReceived(BMessage* msg) case FONTSIZE_MSG: { char buff[256]; - sprintf(buff, "Size: %d", static_cast(fFontsizeSlider->Value())); + sprintf(buff, B_TRANSLATE("Size: %d"), + static_cast(fFontsizeSlider->Value())); fFontsizeSlider->SetLabel(buff); BMessage msg(FONTSIZE_MSG); @@ -234,7 +246,8 @@ ControlView::MessageReceived(BMessage* msg) case FONTSHEAR_MSG: { char buff[256]; - sprintf(buff, "Shear: %d", static_cast(fShearSlider->Value())); + sprintf(buff, B_TRANSLATE("Shear: %d"), + static_cast(fShearSlider->Value())); fShearSlider->SetLabel(buff); BMessage msg(FONTSHEAR_MSG); @@ -246,7 +259,8 @@ ControlView::MessageReceived(BMessage* msg) case ROTATION_MSG: { char buff[256]; - sprintf(buff, "Rotation: %d", static_cast(fRotationSlider->Value())); + sprintf(buff, B_TRANSLATE("Rotation: %d"), + static_cast(fRotationSlider->Value())); fRotationSlider->SetLabel(buff); BMessage msg(ROTATION_MSG); @@ -258,7 +272,8 @@ ControlView::MessageReceived(BMessage* msg) case SPACING_MSG: { char buff[256]; - sprintf(buff, "Spacing: %d", (int)fSpacingSlider->Value()); + sprintf(buff, B_TRANSLATE("Spacing: %d"), + (int)fSpacingSlider->Value()); fSpacingSlider->SetLabel(buff); BMessage msg(SPACING_MSG); @@ -296,7 +311,7 @@ ControlView::MessageReceived(BMessage* msg) int8 outlineVal = (int8)fOutlineSlider->Value(); char buff[256]; - sprintf(buff, "Outline: %d", outlineVal); + sprintf(buff, B_TRANSLATE("Outline: %d"), outlineVal); fOutlineSlider->SetLabel(buff); fAliasingCheckBox->SetEnabled(outlineVal < 1); @@ -310,7 +325,8 @@ ControlView::MessageReceived(BMessage* msg) case CYCLING_FONTS_MSG: { - fCyclingFontButton->SetLabel(fCycleFonts ? "Cycle fonts" : "Stop cycling"); + fCyclingFontButton->SetLabel(fCycleFonts ? \ + B_TRANSLATE("Cycle fonts") : B_TRANSLATE("Stop cycling")); fCycleFonts = !fCycleFonts; if (fCycleFonts) { @@ -456,7 +472,8 @@ ControlView::_AddFontMenu(BRect rect) _UpdateFontmenus(true); - fFontMenuField = new BMenuField(rect, "FontMenuField", "Font:", fFontFamilyMenu, true); + fFontMenuField = new BMenuField(rect, "FontMenuField", + B_TRANSLATE("Font:"), fFontFamilyMenu, true); fFontMenuField->SetDivider(30.0); AddChild(fFontMenuField); } diff --git a/src/apps/fontdemo/FontDemo.cpp b/src/apps/fontdemo/FontDemo.cpp index 2110adf5bf..b46d69c29a 100644 --- a/src/apps/fontdemo/FontDemo.cpp +++ b/src/apps/fontdemo/FontDemo.cpp @@ -11,20 +11,25 @@ #include "FontDemoView.h" #include "ControlView.h" +#include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "FontDemo" + +const BString APP_NAME = B_TRANSLATE_MARK("FontDemo"); FontDemo::FontDemo() : BApplication("application/x-vnd.Haiku-FontDemo") { // Create the demo window where we draw the string - BWindow* demoWindow = new BWindow(BRect(80, 30, 490, 300), "FontDemo", + BWindow* demoWindow = new BWindow(BRect(80, 30, 490, 300), APP_NAME, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE); FontDemoView* demoView = new FontDemoView(demoWindow->Bounds()); demoWindow->AddChild(demoView); - BWindow* controlWindow = new BWindow(BRect(500, 30, 700, 402), "Controls", + BWindow* controlWindow = new BWindow(BRect(500, 30, 700, 402), B_TRANSLATE("Controls"), B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS); diff --git a/src/apps/fontdemo/FontDemoView.cpp b/src/apps/fontdemo/FontDemoView.cpp index b012ee6200..b62ec3f9a7 100644 --- a/src/apps/fontdemo/FontDemoView.cpp +++ b/src/apps/fontdemo/FontDemoView.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -21,6 +22,8 @@ #include "messages.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "FontDemoView" FontDemoView::FontDemoView(BRect rect) : BView(rect, "FontDemoView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS), @@ -36,7 +39,8 @@ FontDemoView::FontDemoView(BRect rect) fShapes(NULL) { SetViewColor(B_TRANSPARENT_COLOR); - SetString("Haiku, Inc."); + BString setStr = B_TRANSLATE("Haiku, Inc."); + SetString(setStr); SetFontSize(fFontSize); SetAntialiasing(true); diff --git a/src/apps/fontdemo/Jamfile b/src/apps/fontdemo/Jamfile index 514ae18a03..616621f2b0 100644 --- a/src/apps/fontdemo/Jamfile +++ b/src/apps/fontdemo/Jamfile @@ -6,6 +6,19 @@ Application FontDemo : ControlView.cpp FontDemo.cpp FontDemoView.cpp - : be $(TARGET_LIBSUPC++) + : be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) : FontDemo.rdef ; + +DoCatalogs FontDemo : + x-vnd.Haiku-FontDemo + : + FontDemo.cpp + ControlView.cpp + FontDemoView.cpp +; + +AddCatalogEntryAttribute FontDemo + : + x-vnd.Haiku-FontDemo:FontDemo:FontDemo +; From 993181928d502753d413e4f7c772c0419a4bc6d6 Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Sat, 29 Oct 2011 15:47:21 +0000 Subject: [PATCH 499/702] Applied patch by rq. Changes the example keyboard from 101 to 102-keys, inserting key 0x69 between letf shift and Z. Fixes #6539. Thanks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42960 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/keymap/Keymap.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/bin/keymap/Keymap.cpp b/src/bin/keymap/Keymap.cpp index f863bae7cf..b7003661ed 100644 --- a/src/bin/keymap/Keymap.cpp +++ b/src/bin/keymap/Keymap.cpp @@ -796,7 +796,7 @@ Keymap::_SaveSourceText(FILE* file) int bytes = fprintf(file, "#!/bin/keymap -s\n" "#\n" - "#\tRaw key numbering for 101 keyboard...\n"); + "#\tRaw key numbering for 102-key keyboard...\n"); #if (defined(__BEOS__) || defined(__HAIKU__)) if (runs != NULL) { @@ -807,25 +807,25 @@ Keymap::_SaveSourceText(FILE* file) } #endif - bytes += fprintf(file, "# [sys] [brk]\n" - "# 0x7e 0x7f\n" - "# [esc] [ f1] [ f2] [ f3] [ f4] [ f5] [ f6] [ f7] [ f8] [ f9] [f10] [f11] [f12] [prn] [scr] [pau]\n" - "# 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 K E Y P A D K E Y S\n" + bytes += fprintf(file, "# [sys] [brk]\n" + "# 0x7e 0x7f\n" + "# [esc] [ f1] [ f2] [ f3] [ f4] [ f5] [ f6] [ f7] [ f8] [ f9] [f10] [f11] [f12] [prn] [scr] [pau]\n" + "# 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 K E Y P A D K E Y S\n" "#\n" - "# [ ` ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 0 ] [ - ] [ = ] [bck] [ins] [hme] [pup] [num] [ / ] [ * ] [ - ]\n" - "# 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25\n" + "# [ ` ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 0 ] [ - ] [ = ] [ bck ] [ins] [hme] [pup] [num] [ / ] [ * ] [ - ]\n" + "# 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25\n" "#\n" - "# [tab] [ q ] [ w ] [ e ] [ r ] [ t ] [ y ] [ u ] [ i ] [ o ] [ p ] [ [ ] [ ] ] [ \\ ] [del] [end] [pdn] [ 7 ] [ 8 ] [ 9 ] [ + ]\n" - "# 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a\n" + "# [ tab ] [ q ] [ w ] [ e ] [ r ] [ t ] [ y ] [ u ] [ i ] [ o ] [ p ] [ [ ] [ ] ] [ \\ ] [del] [end] [pdn] [ 7 ] [ 8 ] [ 9 ] [ + ]\n" + "# 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a\n" "#\n" - "# [cap] [ a ] [ s ] [ d ] [ f ] [ g ] [ h ] [ j ] [ k ] [ l ] [ ; ] [ ' ] [ enter ] [ 4 ] [ 5 ] [ 6 ]\n" - "# 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a\n" + "# [ caps ] [ a ] [ s ] [ d ] [ f ] [ g ] [ h ] [ j ] [ k ] [ l ] [ ; ] [ ' ] [ enter ] [ 4 ] [ 5 ] [ 6 ]\n" + "# 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a\n" "#\n" - "# [shift] [ z ] [ x ] [ c ] [ v ] [ b ] [ n ] [ m ] [ , ] [ . ] [ / ] [shift] [ up] [ 1 ] [ 2 ] [ 3 ] [ent]\n" - "# 0x4b 0x4c 0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b\n" + "# [shft] [ \\ ] [ z ] [ x ] [ c ] [ v ] [ b ] [ n ] [ m ] [ , ] [ . ] [ / ] [ shift ] [ up] [ 1 ] [ 2 ] [ 3 ] [ent]\n" + "# 0x4b 0x69 0x4c 0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b\n" "#\n" - "# [ctr] [cmd] [ space ] [cmd] [ctr] [lft] [dwn] [rgt] [ 0 ] [ . ]\n" - "# 0x5c 0x5d 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65\n"); + "# [ ctrl ] [ cmd ] [ space ] [ cmd ] [ ctrl ] [lft] [dwn] [rgt] [ 0 ] [ . ]\n" + "# 0x5c 0x5d 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65\n"); #if (defined(__BEOS__) || defined(__HAIKU__)) if (runs != NULL) { @@ -836,6 +836,7 @@ Keymap::_SaveSourceText(FILE* file) #endif bytes += fprintf(file, "#\n" + "#\tNOTE: Key 0x69 does not exist on US keyboards\n" "#\tNOTE: On a Microsoft Natural Keyboard:\n" "#\t\t\tleft option = 0x66\n" "#\t\t\tright option = 0x67\n" From f9152093a3d49d76eb824c08e90388e706be3f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 29 Oct 2011 15:51:04 +0000 Subject: [PATCH 500/702] Reverted r42958 as it is broken and I completely forgot to compile before I commited... need to get back into the habbit, sorry for the noise. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42961 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/ISA.h | 100 +++-- headers/os/drivers/PCI.h | 930 ++++++++++++++++++++++----------------- 2 files changed, 587 insertions(+), 443 deletions(-) diff --git a/headers/os/drivers/ISA.h b/headers/os/drivers/ISA.h index 8d4cab1001..812e04b0c1 100644 --- a/headers/os/drivers/ISA.h +++ b/headers/os/drivers/ISA.h @@ -1,85 +1,83 @@ -/* - * Copyright 2010-2011, Haiku Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ +/******************************************************************************* +/ +/ File: ISA.h +/ +/ Description: Interface to ISA module +/ +/ Copyright 1998, Be Incorporated, All Rights Reserved. +/ +*******************************************************************************/ + #ifndef _ISA_H #define _ISA_H - -#include +//#include #include - #ifdef __cplusplus extern "C" { #endif +/* --- + ISA scatter/gather dma support. +--- */ -typedef struct isa_dma_entry { - uint32 address; - uint16 transfer_count; - uchar reserved; - uchar flag; +typedef struct { + ulong address; /* memory address (little endian!) 4 bytes */ + ushort transfer_count; /* # transfers minus one (little endian!) 2 bytes*/ + uchar reserved; /* filler, 1byte*/ + uchar flag; /* end of link flag, 1byte */ } isa_dma_entry; - -#define B_LAST_ISA_DMA_ENTRY 0x80 - +#define B_LAST_ISA_DMA_ENTRY 0x80 /* sets end of link flag in isa_dma_entry */ enum { B_8_BIT_TRANSFER, B_16_BIT_TRANSFER }; - #define B_MAX_ISA_DMA_COUNT 0x10000 - -typedef struct isa_module_info isa_module_info; -struct isa_module_info { +typedef struct isa_module_info { bus_manager_info binfo; - uint8 (*read_io_8) (int32 mapped_io_addr); - void (*write_io_8) (int32 mapped_io_addr, uint8 value); - uint16 (*read_io_16) (int32 mapped_io_addr); - void (*write_io_16) (int32 mapped_io_addr, uint16 value); - uint32 (*read_io_32) (int32 mapped_io_addr); - void (*write_io_32) (int32 mapped_io_addr, uint32 value); + uint8 (*read_io_8) (int mapped_io_addr); + void (*write_io_8) (int mapped_io_addr, uint8 value); + uint16 (*read_io_16) (int mapped_io_addr); + void (*write_io_16) (int mapped_io_addr, uint16 value); + uint32 (*read_io_32) (int mapped_io_addr); + void (*write_io_32) (int mapped_io_addr, uint32 value); - void* (*ram_address) - (const void * physical_address_in_system_memory); + void * (*ram_address) (const void *physical_address_in_system_memory); - int32 (*make_isa_dma_table) ( - const void *buffer, - int32 buffer_size, - uint32 num_bits, - isa_dma_entry *table, - int32 num_entries + long (*make_isa_dma_table) ( + const void *buffer, /* buffer to make a table for */ + long buffer_size, /* buffer size */ + ulong num_bits, /* dma transfer size that will be used */ + isa_dma_entry *table, /* -> caller-supplied scatter/gather table */ + long num_entries /* max # entries in table */ ); - int32 (*start_isa_dma) ( - int32 channel, - void *buf, - int32 transfer_count, - uchar mode, - uchar e_mode + long (*start_isa_dma) ( + long channel, /* dma channel to use */ + void *buf, /* buffer to transfer */ + long transfer_count, /* # transfers */ + uchar mode, /* mode flags */ + uchar e_mode /* extended mode flags */ ); - int32 (*start_scattered_isa_dma) ( - int32 channel, - const isa_dma_entry* table, - uchar mode, - uchar emode + long (*start_scattered_isa_dma) ( + long channel, /* channel # to use */ + const isa_dma_entry *table, /* physical address of scatter/gather table */ + uchar mode, /* mode flags */ + uchar emode /* extended mode flags */ ); - int32 (*lock_isa_dma_channel) (int32 channel); - int32 (*unlock_isa_dma_channel) (int32 channel); -}; - - + long (*lock_isa_dma_channel) (long channel); + long (*unlock_isa_dma_channel) (long channel); +} isa_module_info; + #define B_ISA_MODULE_NAME "bus_managers/isa/v1" - #ifdef __cplusplus } #endif - #endif /* _ISA_H */ diff --git a/headers/os/drivers/PCI.h b/headers/os/drivers/PCI.h index 61680ab1d6..adccd60ab4 100644 --- a/headers/os/drivers/PCI.h +++ b/headers/os/drivers/PCI.h @@ -1,25 +1,35 @@ -/* - * Copyright 2010-2011, Haiku Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ +/******************************************************************************* +/ +/ File: PCI.h +/ +/ Description: Interface to the PCI bus. +/ For more information, see "PCI Local Bus Specification, Revision 2.1", +/ PCI Special Interest Group, 1995. +/ +/ Copyright 1993-98, Be Incorporated, All Rights Reserved. +/ +*******************************************************************************/ + + #ifndef _PCI_H #define _PCI_H - -#include +//#include +//#include #include - #ifdef __cplusplus extern "C" { #endif -/* pci device info */ -typedef struct pci_info pci_info; +/* ----- + pci device info +----- */ + typedef struct pci_info { - uint16 vendor_id; /* vendor id */ - uint16 device_id; /* device id */ + ushort vendor_id; /* vendor id */ + ushort device_id; /* device id */ uchar bus; /* bus number */ uchar device; /* device number on bus */ uchar function; /* function number in device */ @@ -34,15 +44,15 @@ typedef struct pci_info { uchar reserved; /* filler, for alignment */ union { struct { - uint32 cardbus_cis; /* CardBus CIS pointer */ - uint16 subsystem_id; /* subsystem (add-in card) id */ - uint16 subsystem_vendor_id; /* subsystem vendor id */ - uint32 rom_base; /* rom base addr, view from host */ - uint32 rom_base_pci; /* rom base addr, viewed from pci */ - uint32 rom_size; /* rom size */ - uint32 base_registers[6]; /* base registers, view from host */ - uint32 base_registers_pci[6]; /* base registers, view from pci */ - uint32 base_register_sizes[6]; /* size of what base regs point */ + ulong cardbus_cis; /* CardBus CIS pointer */ + ushort subsystem_id; /* subsystem (add-in card) id */ + ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */ + ulong rom_base; /* rom base address, viewed from host */ + ulong rom_base_pci; /* rom base addr, viewed from pci */ + ulong rom_size; /* rom size */ + ulong base_registers[6]; /* base registers, viewed from host */ + ulong base_registers_pci[6]; /* base registers, viewed from pci */ + ulong base_register_sizes[6]; /* size of what base regs point to */ uchar base_register_flags[6]; /* flags from base address fields */ uchar interrupt_line; /* interrupt line */ uchar interrupt_pin; /* interrupt pin */ @@ -50,9 +60,9 @@ typedef struct pci_info { uchar max_latency; /* how often PCI access needed */ } h0; struct { - uint32 base_registers[2]; /* base registers, view from host */ - uint32 base_registers_pci[2]; /* base registers, view from pci */ - uint32 base_register_sizes[2]; /* size of what base regs point */ + ulong base_registers[2]; /* base registers, viewed from host */ + ulong base_registers_pci[2]; /* base registers, viewed from pci */ + ulong base_register_sizes[2]; /* size of what base regs point to */ uchar base_register_flags[2]; /* flags from base address fields */ uchar primary_bus; uchar secondary_bus; @@ -60,64 +70,65 @@ typedef struct pci_info { uchar secondary_latency; uchar io_base; uchar io_limit; - uint16 secondary_status; - uint16 memory_base; - uint16 memory_limit; - uint16 prefetchable_memory_base; - uint16 prefetchable_memory_limit; - uint32 prefetchable_memory_base_upper32; - uint32 prefetchable_memory_limit_upper32; - uint16 io_base_upper16; - uint16 io_limit_upper16; - uint32 rom_base; /* rom base addr, view from host */ - uint32 rom_base_pci; /* rom base addr, view from pci */ + ushort secondary_status; + ushort memory_base; + ushort memory_limit; + ushort prefetchable_memory_base; + ushort prefetchable_memory_limit; + ulong prefetchable_memory_base_upper32; + ulong prefetchable_memory_limit_upper32; + ushort io_base_upper16; + ushort io_limit_upper16; + ulong rom_base; /* rom base address, viewed from host */ + ulong rom_base_pci; /* rom base addr, viewed from pci */ uchar interrupt_line; /* interrupt line */ uchar interrupt_pin; /* interrupt pin */ - uint16 bridge_control; - uint16 subsystem_id; /* subsystem (add-in card) id */ - uint16 subsystem_vendor_id; /* subsystem vendor id */ + ushort bridge_control; + ushort subsystem_id; /* subsystem (add-in card) id */ + ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */ } h1; struct { - uint16 subsystem_id; /* subsystem (add-in card) id */ - uint16 subsystem_vendor_id; /* subsystem vendor id */ + ushort subsystem_id; /* subsystem (add-in card) id */ + ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */ #ifdef __HAIKU_PCI_BUS_MANAGER_TESTING // for testing only, not final (do not use!): - uchar primary_bus; - uchar secondary_bus; - uchar subordinate_bus; - uchar secondary_latency; - uint16 reserved; - uint32 memory_base; - uint32 memory_limit; - uint32 memory_base_upper32; - uint32 memory_limit_upper32; - uint32 io_base; - uint32 io_limit; - uint32 io_base_upper32; - uint32 io_limit_upper32; - uint16 secondary_status; - uint16 bridge_control; + uchar primary_bus; + uchar secondary_bus; + uchar subordinate_bus; + uchar secondary_latency; + ushort reserved; + ulong memory_base; + ulong memory_limit; + ulong memory_base_upper32; + ulong memory_limit_upper32; + ulong io_base; + ulong io_limit; + ulong io_base_upper32; + ulong io_limit_upper32; + ushort secondary_status; + ushort bridge_control; #endif /* __HAIKU_PCI_BUS_MANAGER_TESTING */ } h2; } u; -}; +} pci_info; typedef struct pci_module_info pci_module_info; -typedef struct pci_module_info { + +struct pci_module_info { bus_manager_info binfo; - uint8 (*read_io_8) (int32 mapped_io_addr); - void (*write_io_8) (int32 mapped_io_addr, uint8 value); - uint16 (*read_io_16) (int32 mapped_io_addr); - void (*write_io_16) (int32 mapped_io_addr, uint16 value); - uint32 (*read_io_32) (int32 mapped_io_addr); - void (*write_io_32) (int32 mapped_io_addr, uint32 value); + uint8 (*read_io_8) (int mapped_io_addr); + void (*write_io_8) (int mapped_io_addr, uint8 value); + uint16 (*read_io_16) (int mapped_io_addr); + void (*write_io_16) (int mapped_io_addr, uint16 value); + uint32 (*read_io_32) (int mapped_io_addr); + void (*write_io_32) (int mapped_io_addr, uint32 value); - int32 (*get_nth_pci_info) ( - int32 index, /* index into pci device table */ - pci_info *info /* caller-supplied buf for info */ + long (*get_nth_pci_info) ( + long index, /* index into pci device table */ + pci_info *info /* caller-supplied buffer for info */ ); uint32 (*read_pci_config) ( uchar bus, /* bus number */ @@ -135,8 +146,7 @@ typedef struct pci_module_info { uint32 value /* value to write */ ); - void* (*ram_address) - (const void* physical_address_in_system_memory); + void * (*ram_address) (const void *physical_address_in_system_memory); status_t (*find_pci_capability) ( uchar bus, @@ -147,17 +157,17 @@ typedef struct pci_module_info { ); status_t (*reserve_device) ( - uchar bus, - uchar device, - uchar function, - const char* driver_name, - void* cookie); + uchar bus, + uchar device, + uchar function, + const char *driver_name, + void *cookie); status_t (*unreserve_device) ( - uchar bus, - uchar device, - uchar function, - const char* driver_name, - void* cookie); + uchar bus, + uchar device, + uchar function, + const char *driver_name, + void *cookie); status_t (*update_interrupt_line) ( uchar bus, @@ -168,379 +178,517 @@ typedef struct pci_module_info { #define B_PCI_MODULE_NAME "bus_managers/pci/v1" +/* --- + offsets in PCI configuration space to the elements of the predefined + header common to all header types +--- */ -/* offsets in PCI config space to the elements of the predefined header */ -/* offsets common to all header types */ -#define PCI_vendor_id 0x00 /* vendor id */ -#define PCI_device_id 0x02 /* device id */ -#define PCI_command 0x04 /* command */ -#define PCI_status 0x06 /* status */ -#define PCI_revision 0x08 /* revision id */ -#define PCI_class_api 0x09 /* specific register interface type */ -#define PCI_class_sub 0x0A /* specific device function */ -#define PCI_class_base 0x0B /* device type */ -#define PCI_line_size 0x0C /* cache line size in 32 bit words */ -#define PCI_latency 0x0D /* latency timer */ -#define PCI_header_type 0x0E /* header type */ -#define PCI_bist 0x0F /* built-in self-test */ +#define PCI_vendor_id 0x00 /* (2 byte) vendor id */ +#define PCI_device_id 0x02 /* (2 byte) device id */ +#define PCI_command 0x04 /* (2 byte) command */ +#define PCI_status 0x06 /* (2 byte) status */ +#define PCI_revision 0x08 /* (1 byte) revision id */ +#define PCI_class_api 0x09 /* (1 byte) specific register interface type */ +#define PCI_class_sub 0x0a /* (1 byte) specific device function */ +#define PCI_class_base 0x0b /* (1 byte) device type (display vs network, etc) */ +#define PCI_line_size 0x0c /* (1 byte) cache line size in 32 bit words */ +#define PCI_latency 0x0d /* (1 byte) latency timer */ +#define PCI_header_type 0x0e /* (1 byte) header type */ +#define PCI_bist 0x0f /* (1 byte) built-in self-test */ -/* offsets common to header types 0x00 and 0x01 */ -#define PCI_base_registers 0x10 /* base registers */ -#define PCI_interrupt_line 0x3C /* interrupt line */ -#define PCI_interrupt_pin 0x3D /* interrupt pin */ -/* offsets common to header type 0x00 */ -#define PCI_cardbus_cis 0x28 /* CardBus CIS pointer */ -#define PCI_subsystem_vendor_id 0x2C /* subsystem vendor id */ -#define PCI_subsystem_id 0x2E /* subsystem id */ -#define PCI_rom_base 0x30 /* expansion rom base address */ -#define PCI_capabilities_ptr 0x34 /* point to start of cap list */ -#define PCI_min_grant 0x3E /* burst period @ 33 Mhz */ -#define PCI_max_latency 0x3F /* how often need PCI access */ -/* offsets common to the elements of header type 0x01 (PCI-to-PCI bridge) */ -#define PCI_primary_bus 0x18 -#define PCI_secondary_bus 0x19 -#define PCI_subordinate_bus 0x1A -#define PCI_secondary_latency 0x1B -#define PCI_io_base 0x1C -#define PCI_io_limit 0x1D -#define PCI_secondary_status 0x1E -#define PCI_memory_base 0x20 -#define PCI_memory_limit 0x22 -#define PCI_prefetchable_memory_base 0x24 -#define PCI_prefetchable_memory_limit 0x26 +/* --- + offsets in PCI configuration space to the elements of the predefined + header common to header types 0x00 and 0x01 +--- */ +#define PCI_base_registers 0x10 /* base registers (size varies) */ +#define PCI_interrupt_line 0x3c /* (1 byte) interrupt line */ +#define PCI_interrupt_pin 0x3d /* (1 byte) interrupt pin */ + + + +/* --- + offsets in PCI configuration space to the elements of header type 0x00 +--- */ + +#define PCI_cardbus_cis 0x28 /* (4 bytes) CardBus CIS (Card Information Structure) pointer (see PCMCIA v2.10 Spec) */ +#define PCI_subsystem_vendor_id 0x2c /* (2 bytes) subsystem (add-in card) vendor id */ +#define PCI_subsystem_id 0x2e /* (2 bytes) subsystem (add-in card) id */ +#define PCI_rom_base 0x30 /* (4 bytes) expansion rom base address */ +#define PCI_capabilities_ptr 0x34 /* (1 byte) pointer to the start of the capabilities list */ +#define PCI_min_grant 0x3e /* (1 byte) burst period @ 33 Mhz */ +#define PCI_max_latency 0x3f /* (1 byte) how often PCI access needed */ + + +/* --- + offsets in PCI configuration space to the elements of header type 0x01 (PCI-to-PCI bridge) +--- */ + +#define PCI_primary_bus 0x18 /* (1 byte) */ +#define PCI_secondary_bus 0x19 /* (1 byte) */ +#define PCI_subordinate_bus 0x1A /* (1 byte) */ +#define PCI_secondary_latency 0x1B /* (1 byte) latency of secondary bus */ +#define PCI_io_base 0x1C /* (1 byte) io base address register for 2ndry bus*/ +#define PCI_io_limit 0x1D /* (1 byte) */ +#define PCI_secondary_status 0x1E /* (2 bytes) */ +#define PCI_memory_base 0x20 /* (2 bytes) */ +#define PCI_memory_limit 0x22 /* (2 bytes) */ +#define PCI_prefetchable_memory_base 0x24 /* (2 bytes) */ +#define PCI_prefetchable_memory_limit 0x26 /* (2 bytes) */ #define PCI_prefetchable_memory_base_upper32 0x28 #define PCI_prefetchable_memory_limit_upper32 0x2C -#define PCI_io_base_upper16 0x30 -#define PCI_io_limit_upper16 0x32 -#define PCI_sub_vendor_id_1 0x34 -#define PCI_sub_device_id_1 0x36 +#define PCI_io_base_upper16 0x30 /* (2 bytes) */ +#define PCI_io_limit_upper16 0x32 /* (2 bytes) */ +#define PCI_sub_vendor_id_1 0x34 /* (2 bytes) */ +#define PCI_sub_device_id_1 0x36 /* (2 bytes) */ #define PCI_bridge_rom_base 0x38 -#define PCI_bridge_control 0x3E +#define PCI_bridge_control 0x3E /* (2 bytes) */ + /* PCI type 2 header offsets */ -#define PCI_capabilities_ptr_2 0x14 -#define PCI_secondary_status_2 0x16 -#define PCI_primary_bus_2 0x18 -#define PCI_secondary_bus_2 0x19 -#define PCI_subordinate_bus_2 0x1A -#define PCI_secondary_latency_2 0x1B -#define PCI_memory_base0_2 0x1C -#define PCI_memory_limit0_2 0x20 -#define PCI_memory_base1_2 0x24 -#define PCI_memory_limit1_2 0x28 -#define PCI_io_base0_2 0x2C -#define PCI_io_limit0_2 0x30 -#define PCI_io_base1_2 0x34 -#define PCI_io_limit1_2 0x38 -#define PCI_bridge_control_2 0x3E -#define PCI_sub_vendor_id_2 0x40 -#define PCI_sub_device_id_2 0x42 -#define PCI_card_interface_2 0x44 +#define PCI_capabilities_ptr_2 0x14 /* (1 byte) */ +#define PCI_secondary_status_2 0x16 /* (2 bytes) */ +#define PCI_primary_bus_2 0x18 /* (1 byte) */ +#define PCI_secondary_bus_2 0x19 /* (1 byte) */ +#define PCI_subordinate_bus_2 0x1A /* (1 byte) */ +#define PCI_secondary_latency_2 0x1B /* (1 byte) latency of secondary bus */ +#define PCI_memory_base0_2 0x1C /* (4 bytes) */ +#define PCI_memory_limit0_2 0x20 /* (4 bytes) */ +#define PCI_memory_base1_2 0x24 /* (4 bytes) */ +#define PCI_memory_limit1_2 0x28 /* (4 bytes) */ +#define PCI_io_base0_2 0x2c /* (4 bytes) */ +#define PCI_io_limit0_2 0x30 /* (4 bytes) */ +#define PCI_io_base1_2 0x34 /* (4 bytes) */ +#define PCI_io_limit1_2 0x38 /* (4 bytes) */ +#define PCI_bridge_control_2 0x3E /* (2 bytes) */ + +#define PCI_sub_vendor_id_2 0x40 /* (2 bytes) */ +#define PCI_sub_device_id_2 0x42 /* (2 bytes) */ + +#define PCI_card_interface_2 0x44 /* ?? */ + +/* --- + values for the class_base field in the common header +--- */ + +#define PCI_early 0x00 /* built before class codes defined */ +#define PCI_mass_storage 0x01 /* mass storage_controller */ +#define PCI_network 0x02 /* network controller */ +#define PCI_display 0x03 /* display controller */ +#define PCI_multimedia 0x04 /* multimedia device */ +#define PCI_memory 0x05 /* memory controller */ +#define PCI_bridge 0x06 /* bridge controller */ +#define PCI_simple_communications 0x07 /* simple communications controller */ +#define PCI_base_peripheral 0x08 /* base system peripherals */ +#define PCI_input 0x09 /* input devices */ +#define PCI_docking_station 0x0a /* docking stations */ +#define PCI_processor 0x0b /* processors */ +#define PCI_serial_bus 0x0c /* serial bus controllers */ +#define PCI_wireless 0x0d /* wireless controllers */ +#define PCI_intelligent_io 0x0e +#define PCI_satellite_communications 0x0f +#define PCI_encryption_decryption 0x10 +#define PCI_data_acquisition 0x11 + +#define PCI_undefined 0xFF /* not in any defined class */ -/* values for the class_base field in the common header */ -#define PCI_early 0x00 -#define PCI_mass_storage 0x01 -#define PCI_network 0x02 -#define PCI_display 0x03 -#define PCI_multimedia 0x04 -#define PCI_memory 0x05 -#define PCI_bridge 0x06 -#define PCI_simple_communications 0x07 -#define PCI_base_peripheral 0x08 -#define PCI_input 0x09 -#define PCI_docking_station 0x0A -#define PCI_processor 0x0B -#define PCI_serial_bus 0x0C -#define PCI_wireless 0x0D -#define PCI_intelligent_io 0x0E -#define PCI_satellite_communications 0x0F -#define PCI_encryption_decryption 0x10 -#define PCI_data_acquisition 0x11 -#define PCI_undefined 0xFF +/* --- + values for the class_sub field for class_base = 0x00 (built before + class codes were defined) +--- */ -/* values for the class_sub field for class_base = 0x00 (early) */ -#define PCI_early_not_vga 0x00 -#define PCI_early_vga 0x01 - -/* values for the class_sub field for class_base = 0x01 (mass storage) */ -#define PCI_scsi 0x00 -#define PCI_ide 0x01 -#define PCI_floppy 0x02 -#define PCI_ipi 0x03 -#define PCI_raid 0x04 -#define PCI_ata 0x05 -#define PCI_sata 0x06 -#define PCI_sas 0x07 -#define PCI_mass_storage_other 0x80 - -/* values of the class_api field for class_base = 0x01, class_sub = 0x06 */ -#define PCI_sata_other 0x00 -#define PCI_sata_ahci 0x01 - -/* values for the class_sub field for class_base = 0x02 (network) */ -#define PCI_ethernet 0x00 -#define PCI_token_ring 0x01 -#define PCI_fddi 0x02 -#define PCI_atm 0x03 -#define PCI_isdn 0x04 -#define PCI_network_other 0x80 - -/* values for the class_sub field for class_base = 0x03 (display) */ -#define PCI_vga 0x00 -#define PCI_xga 0x01 -#define PCI_3d 0x02 -#define PCI_display_other 0x80 - -/* values for the class_sub field for class_base = 0x04 (multimedia device) */ -#define PCI_video 0x00 -#define PCI_audio 0x01 -#define PCI_telephony 0x02 -#define PCI_hd_audio 0x03 -#define PCI_multimedia_other 0x80 - -/* values for the class_sub field for class_base = 0x05 (memory) */ -#define PCI_ram 0x00 -#define PCI_flash 0x01 -#define PCI_memory_other 0x80 - -/* values for the class_sub field for class_base = 0x06 (bridge) */ -#define PCI_host 0x00 -#define PCI_isa 0x01 -#define PCI_eisa 0x02 -#define PCI_microchannel 0x03 -#define PCI_pci 0x04 -#define PCI_pcmcia 0x05 -#define PCI_nubus 0x06 -#define PCI_cardbus 0x07 -#define PCI_raceway 0x08 -#define PCI_bridge_transparent 0x09 -#define PCI_bridge_infiniband 0x0A -#define PCI_bridge_other 0x80 - -/* values for the class_sub field for class_base = 0x07 (simple comm ctrlers) */ -#define PCI_serial 0x00 -#define PCI_parallel 0x01 -#define PCI_multiport_serial 0x02 -#define PCI_modem 0x03 -#define PCI_simple_communications_other 0x80 - -/* values of the class_api field for class_base = 0x07 and class_sub = 0x00 */ -#define PCI_serial_xt 0x00 -#define PCI_serial_16450 0x01 -#define PCI_serial_16550 0x02 - -/* values of the class_api field for class_base = 0x07 and class_sub = 0x01 */ -#define PCI_parallel_simple 0x00 -#define PCI_parallel_bidirectional 0x01 -#define PCI_parallel_ecp 0x02 +#define PCI_early_not_vga 0x00 /* all except vga */ +#define PCI_early_vga 0x01 /* vga devices */ -/* values for the class_sub field for class_base = 0x08 (system peripherals) */ -#define PCI_pic 0x00 -#define PCI_dma 0x01 -#define PCI_timer 0x02 -#define PCI_rtc 0x03 -#define PCI_generic_hot_plug 0x04 -#define PCI_system_peripheral_other 0x80 +/* --- + values for the class_sub field for class_base = 0x01 (mass storage) +--- */ -/* values of the class_api field for class_base = 0x08 and class_sub = 0x00 */ -#define PCI_pic_8259 0x00 -#define PCI_pic_isa 0x01 -#define PCI_pic_eisa 0x02 +#define PCI_scsi 0x00 /* SCSI controller */ +#define PCI_ide 0x01 /* IDE controller */ +#define PCI_floppy 0x02 /* floppy disk controller */ +#define PCI_ipi 0x03 /* IPI bus controller */ +#define PCI_raid 0x04 /* RAID controller */ +#define PCI_ata 0x05 /* ATA controller with ADMA interface */ +#define PCI_sata 0x06 /* Serial ATA controller */ +#define PCI_sas 0x07 /* Serial Attached SCSI controller */ +#define PCI_mass_storage_other 0x80 /* other mass storage controller */ -/* values of the class_api field for class_base = 0x08 and class_sub = 0x01 */ -#define PCI_dma_8237 0x00 -#define PCI_dma_isa 0x01 -#define PCI_dma_eisa 0x02 +/* --- + values of the class_api field for + class_base = 0x01 (mass storage) + class_sub = 0x06 (Serial ATA controller) +--- */ -/* values of the class_api field for class_base = 0x08 and class_sub = 0x02 */ -#define PCI_timer_8254 0x00 -#define PCI_timer_isa 0x01 -#define PCI_timer_eisa 0x02 +#define PCI_sata_other 0x00 /* vendor specific interface */ +#define PCI_sata_ahci 0x01 /* AHCI interface */ -/* values of the class_api field for class_base = 0x08 and class_sub = 0x03 */ -#define PCI_rtc_generic 0x00 -#define PCI_rtc_isa 0x01 -/* values for the class_sub field for class_base = 0x09 (input devices) */ -#define PCI_keyboard 0x00 -#define PCI_pen 0x01 -#define PCI_mouse 0x02 -#define PCI_scanner 0x03 -#define PCI_gameport 0x04 -#define PCI_input_other 0x80 +/* --- + values for the class_sub field for class_base = 0x02 (network) +--- */ -/* values for the class_sub field for class_base = 0x0A (docking stations) */ -#define PCI_docking_generic 0x00 -#define PCI_docking_other 0x80 +#define PCI_ethernet 0x00 /* Ethernet controller */ +#define PCI_token_ring 0x01 /* Token Ring controller */ +#define PCI_fddi 0x02 /* FDDI controller */ +#define PCI_atm 0x03 /* ATM controller */ +#define PCI_isdn 0x04 /* ISDN controller */ +#define PCI_network_other 0x80 /* other network controller */ -/* values for the class_sub field for class_base = 0x0B (processor) */ -#define PCI_386 0x00 -#define PCI_486 0x01 -#define PCI_pentium 0x02 -#define PCI_alpha 0x10 -#define PCI_PowerPC 0x20 -#define PCI_mips 0x30 -#define PCI_coprocessor 0x40 -/* values for the class_sub field for class_base = 0x0C (serial bus ctrlr) */ -#define PCI_firewire 0x00 -#define PCI_access 0x01 -#define PCI_ssa 0x02 -#define PCI_usb 0x03 -#define PCI_fibre_channel 0x04 +/* --- + values for the class_sub field for class_base = 0x03 (display) +--- */ + +#define PCI_vga 0x00 /* VGA controller */ +#define PCI_xga 0x01 /* XGA controller */ +#define PCI_3d 0x02 /* 3d controller */ +#define PCI_display_other 0x80 /* other display controller */ + + +/* --- + values for the class_sub field for class_base = 0x04 (multimedia device) +--- */ + +#define PCI_video 0x00 /* video */ +#define PCI_audio 0x01 /* audio */ +#define PCI_telephony 0x02 /* computer telephony device */ +#define PCI_hd_audio 0x03 /* HD audio */ +#define PCI_multimedia_other 0x80 /* other multimedia device */ + + +/* --- + values for the class_sub field for class_base = 0x05 (memory) +--- */ + +#define PCI_ram 0x00 /* RAM */ +#define PCI_flash 0x01 /* flash */ +#define PCI_memory_other 0x80 /* other memory controller */ + + +/* --- + values for the class_sub field for class_base = 0x06 (bridge) +--- */ + +#define PCI_host 0x00 /* host bridge */ +#define PCI_isa 0x01 /* ISA bridge */ +#define PCI_eisa 0x02 /* EISA bridge */ +#define PCI_microchannel 0x03 /* MicroChannel bridge */ +#define PCI_pci 0x04 /* PCI-to-PCI bridge */ +#define PCI_pcmcia 0x05 /* PCMCIA bridge */ +#define PCI_nubus 0x06 /* NuBus bridge */ +#define PCI_cardbus 0x07 /* CardBus bridge */ +#define PCI_raceway 0x08 /* RACEway bridge */ +#define PCI_bridge_transparent 0x09 /* PCI transparent */ +#define PCI_bridge_infiniband 0x0a /* Infiniband */ +#define PCI_bridge_other 0x80 /* other bridge device */ + + +/* --- + values for the class_sub field for class_base = 0x07 (simple + communications controllers) +--- */ + +#define PCI_serial 0x00 /* serial port controller */ +#define PCI_parallel 0x01 /* parallel port */ +#define PCI_multiport_serial 0x02 /* multiport serial controller */ +#define PCI_modem 0x03 /* modem */ +#define PCI_simple_communications_other 0x80 /* other communications device */ + +/* --- + values of the class_api field for + class_base = 0x07 (simple communications), and + class_sub = 0x00 (serial port controller) +--- */ + +#define PCI_serial_xt 0x00 /* XT-compatible serial controller */ +#define PCI_serial_16450 0x01 /* 16450-compatible serial controller */ +#define PCI_serial_16550 0x02 /* 16550-compatible serial controller */ + + +/* --- + values of the class_api field for + class_base = 0x07 (simple communications), and + class_sub = 0x01 (parallel port) +--- */ + +#define PCI_parallel_simple 0x00 /* simple (output-only) parallel port */ +#define PCI_parallel_bidirectional 0x01 /* bidirectional parallel port */ +#define PCI_parallel_ecp 0x02 /* ECP 1.x compliant parallel port */ + + +/* --- + values for the class_sub field for class_base = 0x08 (generic + system peripherals) +--- */ + +#define PCI_pic 0x00 /* peripheral interrupt controller */ +#define PCI_dma 0x01 /* dma controller */ +#define PCI_timer 0x02 /* timers */ +#define PCI_rtc 0x03 /* real time clock */ +#define PCI_generic_hot_plug 0x04 /* generic PCI hot-plug controller */ +#define PCI_system_peripheral_other 0x80 /* other generic system peripheral */ + +/* --- + values of the class_api field for + class_base = 0x08 (generic system peripherals) + class_sub = 0x00 (peripheral interrupt controller) +--- */ + +#define PCI_pic_8259 0x00 /* generic 8259 */ +#define PCI_pic_isa 0x01 /* ISA pic */ +#define PCI_pic_eisa 0x02 /* EISA pic */ + +/* --- + values of the class_api field for + class_base = 0x08 (generic system peripherals) + class_sub = 0x01 (dma controller) +--- */ + +#define PCI_dma_8237 0x00 /* generic 8237 */ +#define PCI_dma_isa 0x01 /* ISA dma */ +#define PCI_dma_eisa 0x02 /* EISA dma */ + +/* --- + values of the class_api field for + class_base = 0x08 (generic system peripherals) + class_sub = 0x02 (timer) +--- */ + +#define PCI_timer_8254 0x00 /* generic 8254 */ +#define PCI_timer_isa 0x01 /* ISA timer */ +#define PCI_timer_eisa 0x02 /* EISA timers (2 timers) */ + + +/* --- + values of the class_api field for + class_base = 0x08 (generic system peripherals) + class_sub = 0x03 (real time clock +--- */ + +#define PCI_rtc_generic 0x00 /* generic real time clock */ +#define PCI_rtc_isa 0x01 /* ISA real time clock */ + + +/* --- + values for the class_sub field for class_base = 0x09 (input devices) +--- */ + +#define PCI_keyboard 0x00 /* keyboard controller */ +#define PCI_pen 0x01 /* pen */ +#define PCI_mouse 0x02 /* mouse controller */ +#define PCI_scanner 0x03 /* scanner controller */ +#define PCI_gameport 0x04 /* gameport controller */ +#define PCI_input_other 0x80 /* other input controller */ + + +/* --- + values for the class_sub field for class_base = 0x0a (docking stations) +--- */ + +#define PCI_docking_generic 0x00 /* generic docking station */ +#define PCI_docking_other 0x80 /* other docking stations */ + +/* --- + values for the class_sub field for class_base = 0x0b (processor) +--- */ + +#define PCI_386 0x00 /* 386 */ +#define PCI_486 0x01 /* 486 */ +#define PCI_pentium 0x02 /* Pentium */ +#define PCI_alpha 0x10 /* Alpha */ +#define PCI_PowerPC 0x20 /* PowerPC */ +#define PCI_mips 0x30 /* MIPS */ +#define PCI_coprocessor 0x40 /* co-processor */ + +/* --- + values for the class_sub field for class_base = 0x0c (serial bus + controller) +--- */ + +#define PCI_firewire 0x00 /* FireWire (IEEE 1394) */ +#define PCI_access 0x01 /* ACCESS bus */ +#define PCI_ssa 0x02 /* SSA */ +#define PCI_usb 0x03 /* Universal Serial Bus */ +#define PCI_fibre_channel 0x04 /* Fibre channel */ #define PCI_smbus 0x05 -#define PCI_infiniband 0x06 +#define PCI_infiniband 0x06 #define PCI_ipmi 0x07 #define PCI_sercos 0x08 #define PCI_canbus 0x09 -/* values of the class_api field for class_base = 0x0C and class_sub = 0x03 */ -#define PCI_usb_uhci 0x00 -#define PCI_usb_ohci 0x10 -#define PCI_usb_ehci 0x20 -#define PCI_usb_xhci 0x30 /* Extensible Host Controller Interface */ +/* --- + values of the class_api field for + class_base = 0x0c ( serial bus controller ) + class_sub = 0x03 ( Universal Serial Bus ) +--- */ -/* values for the class_sub field for class_base = 0x0d (wireless controller) */ +#define PCI_usb_uhci 0x00 /* Universal Host Controller Interface */ +#define PCI_usb_ohci 0x10 /* Open Host Controller Interface */ +#define PCI_usb_ehci 0x20 /* Enhanced Host Controller Interface */ +#define PCI_usb_xhci 0x30 /* Extensible Host Controller Interface */ + +/* --- + values for the class_sub field for class_base = 0x0d (wireless controller) +--- */ #define PCI_wireless_irda 0x00 -#define PCI_wireless_consumer_ir 0x01 +#define PCI_wireless_consumer_ir 0x01 #define PCI_wireless_rf 0x02 -#define PCI_wireless_bluetooth 0x03 -#define PCI_wireless_broadband 0x04 +#define PCI_wireless_bluetooth 0x03 +#define PCI_wireless_broadband 0x04 #define PCI_wireless_80211A 0x10 #define PCI_wireless_80211B 0x20 #define PCI_wireless_other 0x80 +/* --- + masks for command register bits +--- */ -/* masks for command register bits */ -#define PCI_command_io 0x001 -#define PCI_command_memory 0x002 -#define PCI_command_master 0x004 -#define PCI_command_special 0x008 -#define PCI_command_mwi 0x010 -#define PCI_command_vga_snoop 0x020 -#define PCI_command_parity 0x040 -#define PCI_command_address_step 0x080 -#define PCI_command_serr 0x100 -#define PCI_command_fastback 0x200 -#define PCI_command_int_disable 0x400 +#define PCI_command_io 0x001 /* 1/0 i/o space en/disabled */ +#define PCI_command_memory 0x002 /* 1/0 memory space en/disabled */ +#define PCI_command_master 0x004 /* 1/0 pci master en/disabled */ +#define PCI_command_special 0x008 /* 1/0 pci special cycles en/disabled */ +#define PCI_command_mwi 0x010 /* 1/0 memory write & invalidate en/disabled */ +#define PCI_command_vga_snoop 0x020 /* 1/0 vga pallette snoop en/disabled */ +#define PCI_command_parity 0x040 /* 1/0 parity check en/disabled */ +#define PCI_command_address_step 0x080 /* 1/0 address stepping en/disabled */ +#define PCI_command_serr 0x100 /* 1/0 SERR# en/disabled */ +#define PCI_command_fastback 0x200 /* 1/0 fast back-to-back en/disabled */ +#define PCI_command_int_disable 0x400 /* 1/0 interrupt generation dis/enabled */ -/* masks for status register bits */ -#define PCI_status_capabilities 0x0010 -#define PCI_status_66_MHz_capable 0x0020 -#define PCI_status_udf_supported 0x0040 -#define PCI_status_fastback 0x0080 -#define PCI_status_parity_signalled 0x0100 -#define PCI_status_devsel 0x0600 -#define PCI_status_target_abort_signalled 0x0800 -#define PCI_status_target_abort_received 0x1000 -#define PCI_status_master_abort_received 0x2000 -#define PCI_status_serr_signalled 0x4000 -#define PCI_status_parity_error_detected 0x8000 +/* --- + masks for status register bits +--- */ + +#define PCI_status_capabilities 0x0010 /* capabilities list */ +#define PCI_status_66_MHz_capable 0x0020 /* 66 Mhz capable */ +#define PCI_status_udf_supported 0x0040 /* user-definable-features (udf) supported */ +#define PCI_status_fastback 0x0080 /* fast back-to-back capable */ +#define PCI_status_parity_signalled 0x0100 /* parity error signalled */ +#define PCI_status_devsel 0x0600 /* devsel timing (see below) */ +#define PCI_status_target_abort_signalled 0x0800 /* signaled a target abort */ +#define PCI_status_target_abort_received 0x1000 /* received a target abort */ +#define PCI_status_master_abort_received 0x2000 /* received a master abort */ +#define PCI_status_serr_signalled 0x4000 /* signalled SERR# */ +#define PCI_status_parity_error_detected 0x8000 /* parity error detected */ -/* masks for devsel field in status register */ -#define PCI_status_devsel_fast 0x0000 -#define PCI_status_devsel_medium 0x0200 -#define PCI_status_devsel_slow 0x0400 +/* --- + masks for devsel field in status register +--- */ + +#define PCI_status_devsel_fast 0x0000 /* fast */ +#define PCI_status_devsel_medium 0x0200 /* medium */ +#define PCI_status_devsel_slow 0x0400 /* slow */ -/* masks for header type register */ -#define PCI_header_type_mask 0x7F -#define PCI_multifunction 0x80 +/* --- + masks for header type register +--- */ + +#define PCI_header_type_mask 0x7F /* header type field */ +#define PCI_multifunction 0x80 /* multifunction device flag */ -/* types of PCI header */ +/** types of PCI header */ + #define PCI_header_type_generic 0x00 #define PCI_header_type_PCI_to_PCI_bridge 0x01 -#define PCI_header_type_cardbus 0x02 +#define PCI_header_type_cardbus 0x02 -/* masks for built in self test (bist) register bits */ -#define PCI_bist_code 0x0F -#define PCI_bist_start 0x40 -#define PCI_bist_capable 0x80 +/* --- + masks for built in self test (bist) register bits +--- */ + +#define PCI_bist_code 0x0F /* self-test completion code, 0 = success */ +#define PCI_bist_start 0x40 /* 1 = start self-test */ +#define PCI_bist_capable 0x80 /* 1 = self-test capable */ -/* masks for flags in the various base address registers */ -#define PCI_address_space 0x01 -#define PCI_register_start 0x10 -#define PCI_register_end 0x24 -#define PCI_register_ppb_end 0x18 -#define PCI_register_pcb_end 0x14 +/** masks for flags in the various base address registers */ + +#define PCI_address_space 0x01 /* 0 = memory space, 1 = i/o space */ +#define PCI_register_start 0x10 +#define PCI_register_end 0x24 +#define PCI_register_ppb_end 0x18 +#define PCI_register_pcb_end 0x14 + +/** masks for flags in memory space base address registers */ + +#define PCI_address_type_32 0x00 /* locate anywhere in 32 bit space */ +#define PCI_address_type_32_low 0x02 /* locate below 1 Meg */ +#define PCI_address_type_64 0x04 /* locate anywhere in 64 bit space */ +#define PCI_address_type 0x06 /* type (see below) */ +#define PCI_address_prefetchable 0x08 /* 1 if prefetchable (see PCI spec) */ + +#define PCI_address_memory_32_mask 0xFFFFFFF0 /* mask to get 32bit memory space base address */ -/* masks for flags in memory space base address registers */ -#define PCI_address_type_32 0x00 -#define PCI_address_type_32_low 0x02 -#define PCI_address_type_64 0x04 -#define PCI_address_type 0x06 -#define PCI_address_prefetchable 0x08 -#define PCI_address_memory_32_mask 0xFFFFFFF0 +/* --- + masks for flags in i/o space base address registers +--- */ + +#define PCI_address_io_mask 0xFFFFFFFC /* mask to get i/o space base address */ -/* masks for flags in i/o space base address registers */ -#define PCI_address_io_mask 0xFFFFFFFC +/* --- + masks for flags in expansion rom base address registers +--- */ - -/* masks for flags in expansion rom base address registers */ -#define PCI_rom_enable 0x00000001 +#define PCI_rom_enable 0x00000001 /* 1 expansion rom decode enabled */ #define PCI_rom_shadow 0x00000010 /* 2 rom copied at shadow (C0000) */ #define PCI_rom_copy 0x00000100 /* 4 rom is allocated copy */ #define PCI_rom_bios 0x00001000 /* 8 rom is bios copy */ -#define PCI_rom_address_mask 0xFFFFF800 +#define PCI_rom_address_mask 0xFFFFF800 /* mask to get expansion rom addr */ +/** PCI interrupt pin values */ +#define PCI_pin_mask 0x07 +#define PCI_pin_none 0x00 +#define PCI_pin_a 0x01 +#define PCI_pin_b 0x02 +#define PCI_pin_c 0x03 +#define PCI_pin_d 0x04 +#define PCI_pin_max 0x04 -/* PCI interrupt pin values */ -#define PCI_pin_mask 0x07 -#define PCI_pin_none 0x00 -#define PCI_pin_a 0x01 -#define PCI_pin_b 0x02 -#define PCI_pin_c 0x03 -#define PCI_pin_d 0x04 -#define PCI_pin_max 0x04 +/** PCI Capability Codes */ +#define PCI_cap_id_reserved 0x00 +#define PCI_cap_id_pm 0x01 /* Power management */ +#define PCI_cap_id_agp 0x02 /* AGP */ +#define PCI_cap_id_vpd 0x03 /* Vital product data */ +#define PCI_cap_id_slotid 0x04 /* Slot ID */ +#define PCI_cap_id_msi 0x05 /* Message signalled interrupt */ +#define PCI_cap_id_chswp 0x06 /* Compact PCI HotSwap */ +#define PCI_cap_id_pcix 0x07 /* PCI-X */ +#define PCI_cap_id_ldt 0x08 +#define PCI_cap_id_vendspec 0x09 +#define PCI_cap_id_debugport 0x0a +#define PCI_cap_id_cpci_rsrcctl 0x0b +#define PCI_cap_id_hotplug 0x0c +#define PCI_cap_id_subvendor 0x0d +#define PCI_cap_id_agp8x 0x0e +#define PCI_cap_id_secure_dev 0x0f +#define PCI_cap_id_pcie 0x10 /* PCIe (PCI express) */ +#define PCI_cap_id_msix 0x11 /* MSI-X */ +#define PCI_cap_id_sata 0x12 /* Serial ATA Capability */ +#define PCI_cap_id_pciaf 0x13 /* PCI Advanced Features */ +/** Power Management Control Status Register settings */ +#define PCI_pm_mask 0x03 +#define PCI_pm_ctrl 0x02 +#define PCI_pm_d1supp 0x0200 +#define PCI_pm_d2supp 0x0400 +#define PCI_pm_status 0x04 +#define PCI_pm_state_d0 0x00 +#define PCI_pm_state_d1 0x01 +#define PCI_pm_state_d2 0x02 +#define PCI_pm_state_d3 0x03 -/* PCI Capability Codes */ -#define PCI_cap_id_reserved 0x00 -#define PCI_cap_id_pm 0x01 -#define PCI_cap_id_agp 0x02 -#define PCI_cap_id_vpd 0x03 -#define PCI_cap_id_slotid 0x04 -#define PCI_cap_id_msi 0x05 -#define PCI_cap_id_chswp 0x06 -#define PCI_cap_id_pcix 0x07 -#define PCI_cap_id_ldt 0x08 -#define PCI_cap_id_vendspec 0x09 -#define PCI_cap_id_debugport 0x0a -#define PCI_cap_id_cpci_rsrcctl 0x0b -#define PCI_cap_id_hotplug 0x0c -#define PCI_cap_id_subvendor 0x0d -#define PCI_cap_id_agp8x 0x0e -#define PCI_cap_id_secure_dev 0x0f -#define PCI_cap_id_pcie 0x10 -#define PCI_cap_id_msix 0x11 -#define PCI_cap_id_sata 0x12 -#define PCI_cap_id_pciaf 0x13 - - -/* Power Management Control Status Register settings */ -#define PCI_pm_mask 0x03 -#define PCI_pm_ctrl 0x02 -#define PCI_pm_d1supp 0x0200 -#define PCI_pm_d2supp 0x0400 -#define PCI_pm_status 0x04 -#define PCI_pm_state_d0 0x00 -#define PCI_pm_state_d1 0x01 -#define PCI_pm_state_d2 0x02 -#define PCI_pm_state_d3 0x03 - - -/* MSI registers */ +/** MSI registers **/ #define PCI_msi_control 0x02 #define PCI_msi_address 0x04 #define PCI_msi_address_high 0x08 @@ -549,7 +697,7 @@ typedef struct pci_module_info { #define PCI_msi_mask 0x10 #define PCI_msi_pending 0x14 -/* MSI control register values */ +/** MSI control register values **/ #define PCI_msi_control_enable 0x0001 #define PCI_msi_control_vector 0x0100 #define PCI_msi_control_64bit 0x0080 @@ -568,10 +716,8 @@ typedef struct pci_module_info { #define PCI_msi_control_mmc_16 0x0008 #define PCI_msi_control_mmc_32 0x000a - #ifdef __cplusplus } #endif - #endif /* _PCI_H */ From 7c91e8ddab19225f5b52d1bfffbccfca18da9d70 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sat, 29 Oct 2011 15:55:28 +0000 Subject: [PATCH 501/702] Change command/option behaviour to mimic the American.keymap. This closes ticket #4464. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42962 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/data/keymaps/US-International.keymap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/keymaps/US-International.keymap b/src/data/keymaps/US-International.keymap index cb62e6d249..9d76fd4f80 100644 --- a/src/data/keymaps/US-International.keymap +++ b/src/data/keymaps/US-International.keymap @@ -37,11 +37,11 @@ NumLock = 0x22 LShift = 0x4b RShift = 0x56 LCommand = 0x5d -RCommand = 0x00 +RCommand = 0x05f LControl = 0x5c RControl = 0x60 LOption = 0x66 -ROption = 0x5f +ROption = 0x67 Menu = 0x68 # # Lock settings From e2b113d4f23f088974488a247dbb0aff37a9a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 29 Oct 2011 16:00:25 +0000 Subject: [PATCH 502/702] Some coding style fixes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42963 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/launchbox/support.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/apps/launchbox/support.cpp b/src/apps/launchbox/support.cpp index 05222d54c7..f1eb1c71dd 100644 --- a/src/apps/launchbox/support.cpp +++ b/src/apps/launchbox/support.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku. + * Copyright 2006, 2011 Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -18,7 +18,7 @@ #include #include -// load_settings + status_t load_settings(BMessage* message, const char* fileName, const char* folder) { @@ -41,7 +41,7 @@ load_settings(BMessage* message, const char* fileName, const char* folder) return ret; } -// save_settings + status_t save_settings(BMessage* message, const char* fileName, const char* folder) { @@ -53,7 +53,8 @@ save_settings(BMessage* message, const char* fileName, const char* folder) if (folder && (ret = path.Append(folder)) == B_OK) ret = create_directory(path.Path(), 0777); if (ret == B_OK && (ret = path.Append(fileName)) == B_OK) { - BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); + BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE + | B_ERASE_FILE); if ((ret = file.InitCheck()) == B_OK) { ret = message->Flatten(&file); file.Unset(); @@ -64,10 +65,10 @@ save_settings(BMessage* message, const char* fileName, const char* folder) return ret; } -// stroke_frame + void -stroke_frame(BView* v, BRect r, rgb_color left, rgb_color top, - rgb_color right, rgb_color bottom) +stroke_frame(BView* v, BRect r, rgb_color left, rgb_color top, rgb_color right, + rgb_color bottom) { if (v && r.IsValid()) { v->BeginLineArray(4); @@ -83,11 +84,13 @@ stroke_frame(BView* v, BRect r, rgb_color left, rgb_color top, } } -// make_sure_frame_is_on_screen + bool make_sure_frame_is_on_screen(BRect& frame, BWindow* window) { - BScreen* screen = window ? new BScreen(window) : new BScreen(B_MAIN_SCREEN_ID); + BScreen* screen = window != NULL ? new BScreen(window) + : new BScreen(B_MAIN_SCREEN_ID); + bool success = false; if (frame.IsValid() && screen->IsValid()) { BRect screenFrame = screen->Frame(); From e54b10160f809bbb03eda8d0d933d22069c4e164 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 29 Oct 2011 16:06:08 +0000 Subject: [PATCH 503/702] Close #3223 with patch provided by Humdinger (which I adjusted to the current state of the code). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42964 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/diskusage/DiskUsage.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/diskusage/DiskUsage.h b/src/apps/diskusage/DiskUsage.h index cdd222ee47..fc258bd67c 100644 --- a/src/apps/diskusage/DiskUsage.h +++ b/src/apps/diskusage/DiskUsage.h @@ -18,10 +18,10 @@ const rgb_color RGB_WIN = { 0xDE, 0xDB, 0xDE, 0xFF }; const rgb_color RGB_PIE_OL = { 0x80, 0x80, 0x80, 0xFF }; const rgb_color RGB_PIE_BG = { 0xFF, 0xFF, 0xFF, 0xFF }; const rgb_color RGB_PIE_MT = { 0xA0, 0xA0, 0xA0, 0xFF }; -const rgb_color RGB_PIE_1 = { 0x00, 0x60, 0x60, 0xFF }; +const rgb_color RGB_PIE_1 = { 0x00, 0x00, 0xb6, 0xFF }; const rgb_color RGB_PIE_2 = { 0x00, 0x00, 0x68, 0xFF }; -const rgb_color RGB_PIE_3 = { 0x60, 0x00, 0x60, 0xFF }; -const rgb_color RGB_PIE_4 = { 0x68, 0x00, 0x00, 0xFF }; +const rgb_color RGB_PIE_3 = { 0xcf, 0x00, 0x00, 0xFF }; +const rgb_color RGB_PIE_4 = { 0xaf, 0x63, 0xb1, 0xFF }; const int kBasePieColorCount = 4; const rgb_color kBasePieColor[kBasePieColorCount] From 345eb8c4fea85cef0339c919468716f9611798d8 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 29 Oct 2011 16:16:45 +0000 Subject: [PATCH 504/702] Make two unexpected/error cases more visible with debug output. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42965 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/usb/ehci.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index a5625a7a6a..5aa27232c8 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -582,7 +582,7 @@ EHCI::Start() TRACE("frame list size 256\n"); break; default: - TRACE("unknown frame list size\n"); + TRACE_ALWAYS("unknown frame list size\n"); } bool running = false; @@ -599,7 +599,7 @@ EHCI::Start() } if (!running) { - TRACE("host controller didn't start\n"); + TRACE_ERROR("host controller didn't start\n"); return B_ERROR; } From e039afe87e28d786408d3d9b4c802221481691b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 29 Oct 2011 16:21:17 +0000 Subject: [PATCH 505/702] Define B_MAIL_DAEMON_SIGNATURE and use it instead of hardcoding the signature everywhere. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42966 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/mail/MailDaemon.h | 5 +++++ src/kits/mail/MailDaemon.cpp | 14 +++++++------- src/kits/mail/MailMessage.cpp | 2 +- src/kits/mail/MailSettings.cpp | 7 ++++--- src/servers/mail/DeskbarView.cpp | 4 ++-- src/servers/mail/MailDaemon.cpp | 4 ++-- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/headers/os/mail/MailDaemon.h b/headers/os/mail/MailDaemon.h index 40f40534a6..4cef96ac20 100644 --- a/headers/os/mail/MailDaemon.h +++ b/headers/os/mail/MailDaemon.h @@ -10,6 +10,8 @@ #include +#define B_MAIL_DAEMON_SIGNATURE "application/x-vnd.Be-POST" + const uint32 kMsgCheckAndSend = 'mbth'; const uint32 kMsgCheckMessage = 'mnow'; const uint32 kMsgSendMessages = 'msnd'; @@ -22,6 +24,9 @@ const uint32 kMsgFetchBody = 'mfeb'; const uint32 kMsgBodyFetched = 'mbfe'; +class BMessenger; + + class BMailDaemon { public: //! accountID = -1 means check all accounts diff --git a/src/kits/mail/MailDaemon.cpp b/src/kits/mail/MailDaemon.cpp index 0faa4d4756..6e73b9f1d2 100644 --- a/src/kits/mail/MailDaemon.cpp +++ b/src/kits/mail/MailDaemon.cpp @@ -17,7 +17,7 @@ status_t BMailDaemon::CheckMail(int32 accountID) { - BMessenger daemon("application/x-vnd.Be-POST"); + BMessenger daemon(B_MAIL_DAEMON_SIGNATURE); if (!daemon.IsValid()) return B_MAIL_NO_DAEMON; @@ -30,7 +30,7 @@ BMailDaemon::CheckMail(int32 accountID) status_t BMailDaemon::CheckAndSendQueuedMail(int32 accountID) { - BMessenger daemon("application/x-vnd.Be-POST"); + BMessenger daemon(B_MAIL_DAEMON_SIGNATURE); if (!daemon.IsValid()) return B_MAIL_NO_DAEMON; @@ -43,7 +43,7 @@ BMailDaemon::CheckAndSendQueuedMail(int32 accountID) status_t BMailDaemon::SendQueuedMail() { - BMessenger daemon("application/x-vnd.Be-POST"); + BMessenger daemon(B_MAIL_DAEMON_SIGNATURE); if (!daemon.IsValid()) return B_MAIL_NO_DAEMON; @@ -54,7 +54,7 @@ BMailDaemon::SendQueuedMail() int32 BMailDaemon::CountNewMessages(bool wait_for_fetch_completion) { - BMessenger daemon("application/x-vnd.Be-POST"); + BMessenger daemon(B_MAIL_DAEMON_SIGNATURE); if (!daemon.IsValid()) return B_MAIL_NO_DAEMON; @@ -73,7 +73,7 @@ BMailDaemon::CountNewMessages(bool wait_for_fetch_completion) status_t BMailDaemon::MarkAsRead(int32 account, const entry_ref& ref, read_flags flag) { - BMessenger daemon("application/x-vnd.Be-POST"); + BMessenger daemon(B_MAIL_DAEMON_SIGNATURE); if (!daemon.IsValid()) return B_MAIL_NO_DAEMON; @@ -89,7 +89,7 @@ BMailDaemon::MarkAsRead(int32 account, const entry_ref& ref, read_flags flag) status_t BMailDaemon::FetchBody(const entry_ref& ref, BMessenger* listener) { - BMessenger daemon("application/x-vnd.Be-POST"); + BMessenger daemon(B_MAIL_DAEMON_SIGNATURE); if (!daemon.IsValid()) return B_MAIL_NO_DAEMON; @@ -106,7 +106,7 @@ BMailDaemon::FetchBody(const entry_ref& ref, BMessenger* listener) status_t BMailDaemon::Quit() { - BMessenger daemon("application/x-vnd.Be-POST"); + BMessenger daemon(B_MAIL_DAEMON_SIGNATURE); if (!daemon.IsValid()) return B_MAIL_NO_DAEMON; diff --git a/src/kits/mail/MailMessage.cpp b/src/kits/mail/MailMessage.cpp index 0a2edb579b..e91139f5b7 100644 --- a/src/kits/mail/MailMessage.cpp +++ b/src/kits/mail/MailMessage.cpp @@ -948,7 +948,7 @@ BEmailMessage::Send(bool sendNow) // TODO! } - BMessenger daemon("application/x-vnd.Be-POST"); + BMessenger daemon(B_MAIL_DAEMON_SIGNATURE); if (!daemon.IsValid()) return B_MAIL_NO_DAEMON; diff --git a/src/kits/mail/MailSettings.cpp b/src/kits/mail/MailSettings.cpp index c7e57da16d..65aa33d39f 100644 --- a/src/kits/mail/MailSettings.cpp +++ b/src/kits/mail/MailSettings.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -72,7 +73,7 @@ BMailSettings::Save(bigtime_t /*timeout*/) if (result < B_OK) return result; - BMessenger("application/x-vnd.Be-POST").SendMessage('mrrs'); + BMessenger(B_MAIL_DAEMON_SIGNATURE).SendMessage('mrrs'); return B_OK; } @@ -224,7 +225,7 @@ BMailSettings::SetStatusWindowWorkspaces(int32 workspace) BMessage msg('wsch'); msg.AddInt32("StatusWindowWorkSpace",workspace); - BMessenger("application/x-vnd.Be-POST").SendMessage(&msg); + BMessenger(B_MAIL_DAEMON_SIGNATURE).SendMessage(&msg); } @@ -243,7 +244,7 @@ BMailSettings::SetStatusWindowLook(int32 look) BMessage msg('lkch'); msg.AddInt32("StatusWindowLook", look); - BMessenger("application/x-vnd.Be-POST").SendMessage(&msg); + BMessenger(B_MAIL_DAEMON_SIGNATURE).SendMessage(&msg); } diff --git a/src/servers/mail/DeskbarView.cpp b/src/servers/mail/DeskbarView.cpp index aae0782ff1..5d5c30febf 100644 --- a/src/servers/mail/DeskbarView.cpp +++ b/src/servers/mail/DeskbarView.cpp @@ -122,7 +122,7 @@ void DeskbarView::AttachedToWindow() SetLowColor(ViewColor()); - if (be_roster->IsRunning("application/x-vnd.Be-POST")) { + if (be_roster->IsRunning(B_MAIL_DAEMON_SIGNATURE)) { _RefreshMailQuery(); } else { BDeskbar deskbar; @@ -203,7 +203,7 @@ status_t DeskbarView::Archive(BMessage *data,bool deep) const { BView::Archive(data, deep); - data->AddString("add_on", "application/x-vnd.Be-POST"); + data->AddString("add_on", B_MAIL_DAEMON_SIGNATURE); return B_NO_ERROR; } diff --git a/src/servers/mail/MailDaemon.cpp b/src/servers/mail/MailDaemon.cpp index e96d0335ad..d0c4567109 100644 --- a/src/servers/mail/MailDaemon.cpp +++ b/src/servers/mail/MailDaemon.cpp @@ -105,7 +105,7 @@ addAttribute(BMessage& msg, const char* name, const char* publicName, MailDaemonApp::MailDaemonApp() : - BApplication("application/x-vnd.Be-POST"), + BApplication(B_MAIL_DAEMON_SIGNATURE), fAutoCheckRunner(NULL) { @@ -423,7 +423,7 @@ MailDaemonApp::InstallDeskbarIcon() BRoster roster; entry_ref ref; - status_t status = roster.FindApp("application/x-vnd.Be-POST", &ref); + status_t status = roster.FindApp(B_MAIL_DAEMON_SIGNATURE, &ref); if (status < B_OK) { fprintf(stderr, "Can't find application to tell deskbar: %s\n", strerror(status)); From 6fd240c27d13ae7a34c546ce7f0f2123aa836783 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 16:40:56 +0000 Subject: [PATCH 506/702] #7512: Localize mixer media add-on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42967 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../media/media-add-ons/mixer/AudioMixer.cpp | 155 ++++++++++++------ .../media/media-add-ons/mixer/AudioMixer.rdef | 15 ++ src/add-ons/media/media-add-ons/mixer/Jamfile | 11 +- 3 files changed, 129 insertions(+), 52 deletions(-) create mode 100644 src/add-ons/media/media-add-ons/mixer/AudioMixer.rdef diff --git a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp index 8e316f2074..b41b95dc88 100644 --- a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp +++ b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -28,6 +29,10 @@ #include "MixerUtils.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "AudioMixer" + + // the range of the gain sliders (in dB) #define DB_MAX 18.0 #define DB_MIN -60.0 @@ -1696,71 +1701,104 @@ AudioMixer::UpdateParameterWeb() MixerOutput *out; char buf[50]; - top = web->MakeGroup("Gain controls"); + top = web->MakeGroup(B_TRANSLATE("Gain controls")); out = fCore->Output(); group = top->MakeGroup(""); - group->MakeNullParameter(PARAM_STR1(0), B_MEDIA_RAW_AUDIO, "Master output", B_WEB_BUFFER_INPUT); + group->MakeNullParameter(PARAM_STR1(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Master output"), B_WEB_BUFFER_INPUT); if (!out) { - group->MakeNullParameter(PARAM_STR2(0), B_MEDIA_RAW_AUDIO, "not connected", B_GENERIC); + group->MakeNullParameter(PARAM_STR2(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("not connected"), B_GENERIC); } else { - group->MakeNullParameter(PARAM_STR2(0), B_MEDIA_RAW_AUDIO, StringForFormat(buf, out), B_GENERIC); - group->MakeDiscreteParameter(PARAM_MUTE(0), B_MEDIA_RAW_AUDIO, "Mute", B_MUTE); - if (fCore->Settings()->UseBalanceControl() && out->GetOutputChannelCount() == 2 && 1 /*channel mask is stereo */) { + group->MakeNullParameter(PARAM_STR2(0), B_MEDIA_RAW_AUDIO, + StringForFormat(buf, out), B_GENERIC); + group->MakeDiscreteParameter(PARAM_MUTE(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Mute"), B_MUTE); + if (fCore->Settings()->UseBalanceControl() + && out->GetOutputChannelCount() == 2 && 1 + /*channel mask is stereo */) { // single channel control + balance - group->MakeContinuousParameter(PARAM_GAIN(0), B_MEDIA_RAW_AUDIO, "Gain", B_MASTER_GAIN, "dB", DB_MIN, DB_MAX, 0.1); - group->MakeContinuousParameter(PARAM_BALANCE(0), B_MEDIA_RAW_AUDIO, "", B_BALANCE, "", 0, 100, 1); + group->MakeContinuousParameter(PARAM_GAIN(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Gain"), B_MASTER_GAIN, B_TRANSLATE("dB"), + DB_MIN, DB_MAX, 0.1); + group->MakeContinuousParameter(PARAM_BALANCE(0), B_MEDIA_RAW_AUDIO, + "", B_BALANCE, "", 0, 100, 1); } else { // multi channel control - group->MakeContinuousParameter(PARAM_GAIN(0), B_MEDIA_RAW_AUDIO, "Gain", B_MASTER_GAIN, "dB", DB_MIN, DB_MAX, 0.1) - ->SetChannelCount(out->GetOutputChannelCount()); + group->MakeContinuousParameter(PARAM_GAIN(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Gain"), B_MASTER_GAIN, B_TRANSLATE("dB"), + DB_MIN, DB_MAX, 0.1) + ->SetChannelCount(out->GetOutputChannelCount()); } - group->MakeNullParameter(PARAM_STR3(0), B_MEDIA_RAW_AUDIO, "To output", B_WEB_BUFFER_OUTPUT); + group->MakeNullParameter(PARAM_STR3(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("To output"), B_WEB_BUFFER_OUTPUT); } for (int i = 0; (in = fCore->Input(i)); i++) { group = top->MakeGroup(""); - group->MakeNullParameter(PARAM_STR1(in->ID()), B_MEDIA_RAW_AUDIO, in->MediaInput().name, B_WEB_BUFFER_INPUT); - group->MakeNullParameter(PARAM_STR2(in->ID()), B_MEDIA_RAW_AUDIO, StringForFormat(buf, in), B_GENERIC); - group->MakeDiscreteParameter(PARAM_MUTE(in->ID()), B_MEDIA_RAW_AUDIO, "Mute", B_MUTE); + group->MakeNullParameter(PARAM_STR1(in->ID()), B_MEDIA_RAW_AUDIO, + in->MediaInput().name, B_WEB_BUFFER_INPUT); + group->MakeNullParameter(PARAM_STR2(in->ID()), B_MEDIA_RAW_AUDIO, + StringForFormat(buf, in), B_GENERIC); + group->MakeDiscreteParameter(PARAM_MUTE(in->ID()), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Mute"), B_MUTE); // XXX the gain control is ugly once you have more than two channels, // as you don't know what channel each slider controls. Tooltips might help... if (fCore->Settings()->InputGainControls() == 0) { // Physical input channels - if (fCore->Settings()->UseBalanceControl() && in->GetInputChannelCount() == 2 && 1 /*channel mask is stereo */) { + if (fCore->Settings()->UseBalanceControl() + && in->GetInputChannelCount() == 2 && 1 + /*channel mask is stereo */) { // single channel control + balance - group->MakeContinuousParameter(PARAM_GAIN(in->ID()), B_MEDIA_RAW_AUDIO, "Gain", B_GAIN, "dB", DB_MIN, DB_MAX, 0.1); - group->MakeContinuousParameter(PARAM_BALANCE(in->ID()), B_MEDIA_RAW_AUDIO, "", B_BALANCE, "", 0, 100, 1); + group->MakeContinuousParameter(PARAM_GAIN(in->ID()), + B_MEDIA_RAW_AUDIO, B_TRANSLATE("Gain"), B_GAIN, + B_TRANSLATE("dB"), DB_MIN, DB_MAX, 0.1); + group->MakeContinuousParameter(PARAM_BALANCE(in->ID()), + B_MEDIA_RAW_AUDIO, "", B_BALANCE, "", 0, 100, 1); } else { // multi channel control - group->MakeContinuousParameter(PARAM_GAIN(in->ID()), B_MEDIA_RAW_AUDIO, "Gain", B_GAIN, "dB", DB_MIN, DB_MAX, 0.1) - ->SetChannelCount(in->GetInputChannelCount()); + group->MakeContinuousParameter(PARAM_GAIN(in->ID()), + B_MEDIA_RAW_AUDIO, B_TRANSLATE("Gain"), B_GAIN, + B_TRANSLATE("dB"), DB_MIN, DB_MAX, 0.1) + ->SetChannelCount(in->GetInputChannelCount()); } } else { // Virtual output channels - if (fCore->Settings()->UseBalanceControl() && in->GetMixerChannelCount() == 2 && 1 /*channel mask is stereo */) { + if (fCore->Settings()->UseBalanceControl() + && in->GetMixerChannelCount() == 2 && 1 + /*channel mask is stereo */) { // single channel control + balance - group->MakeContinuousParameter(PARAM_GAIN(in->ID()), B_MEDIA_RAW_AUDIO, "Gain", B_GAIN, "dB", DB_MIN, DB_MAX, 0.1); - group->MakeContinuousParameter(PARAM_BALANCE(in->ID()), B_MEDIA_RAW_AUDIO, "", B_BALANCE, "", 0, 100, 1); + group->MakeContinuousParameter(PARAM_GAIN(in->ID()), + B_MEDIA_RAW_AUDIO, B_TRANSLATE("Gain"), B_GAIN, + B_TRANSLATE("dB"), DB_MIN, DB_MAX, 0.1); + group->MakeContinuousParameter(PARAM_BALANCE(in->ID()), + B_MEDIA_RAW_AUDIO, "", B_BALANCE, "", 0, 100, 1); } else { // multi channel control - group->MakeContinuousParameter(PARAM_GAIN(in->ID()), B_MEDIA_RAW_AUDIO, "Gain", B_GAIN, "dB", DB_MIN, DB_MAX, 0.1) - ->SetChannelCount(in->GetMixerChannelCount()); + group->MakeContinuousParameter(PARAM_GAIN(in->ID()), + B_MEDIA_RAW_AUDIO, B_TRANSLATE("Gain"), B_GAIN, + B_TRANSLATE("dB"), DB_MIN, DB_MAX, 0.1) + ->SetChannelCount(in->GetMixerChannelCount()); } } - group->MakeNullParameter(PARAM_STR3(in->ID()), B_MEDIA_RAW_AUDIO, "To master", B_WEB_BUFFER_OUTPUT); + group->MakeNullParameter(PARAM_STR3(in->ID()), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("To master"), B_WEB_BUFFER_OUTPUT); } if (fCore->Settings()->AllowOutputChannelRemapping()) { - top = web->MakeGroup("Output mapping"); // top level group + top = web->MakeGroup(B_TRANSLATE("Output mapping")); // top level group outputchannels = top->MakeGroup(""); - outputchannels->MakeNullParameter(PARAM_STR4(0), B_MEDIA_RAW_AUDIO, "Output channel sources", B_GENERIC); + outputchannels->MakeNullParameter(PARAM_STR4(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Output channel sources"), B_GENERIC); group = outputchannels->MakeGroup(""); - group->MakeNullParameter(PARAM_STR5(0), B_MEDIA_RAW_AUDIO, "Master output", B_GENERIC); + group->MakeNullParameter(PARAM_STR5(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Master output"), B_GENERIC); group = group->MakeGroup(""); if (!out) { - group->MakeNullParameter(PARAM_STR6(0), B_MEDIA_RAW_AUDIO, "not connected", B_GENERIC); + group->MakeNullParameter(PARAM_STR6(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("not connected"), B_GENERIC); } else { for (int chan = 0; chan < out->GetOutputChannelCount(); chan++) { subgroup = group->MakeGroup(""); @@ -1782,52 +1820,67 @@ AudioMixer::UpdateParameterWeb() } if (fCore->Settings()->AllowInputChannelRemapping()) { - top = web->MakeGroup("Input mapping"); // top level group + top = web->MakeGroup(B_TRANSLATE("Input mapping")); // top level group inputchannels = top->MakeGroup(""); - inputchannels->MakeNullParameter(PARAM_STR7(0), B_MEDIA_RAW_AUDIO, "Input channel destinations", B_GENERIC); + inputchannels->MakeNullParameter(PARAM_STR7(0), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Input channel destinations"), B_GENERIC); for (int i = 0; (in = fCore->Input(i)); i++) { group = inputchannels->MakeGroup(""); - group->MakeNullParameter(PARAM_STR4(in->ID()), B_MEDIA_RAW_AUDIO, in->MediaInput().name, B_GENERIC); + group->MakeNullParameter(PARAM_STR4(in->ID()), B_MEDIA_RAW_AUDIO, + in->MediaInput().name, B_GENERIC); group = group->MakeGroup(""); for (int chan = 0; chan < in->GetInputChannelCount(); chan++) { subgroup = group->MakeGroup(""); - subgroup->MakeNullParameter(PARAM_DST_STR(in->ID(), chan), B_MEDIA_RAW_AUDIO, - StringForChannelType(buf, in->GetInputChannelType(chan)), B_GENERIC); + subgroup->MakeNullParameter(PARAM_DST_STR(in->ID(), chan), + B_MEDIA_RAW_AUDIO, StringForChannelType(buf, + in->GetInputChannelType(chan)), B_GENERIC); for (int dst = 0; dst < MAX_CHANNEL_TYPES; dst++) { - subgroup->MakeDiscreteParameter(PARAM_DST_ENABLE(in->ID(), chan, dst), B_MEDIA_RAW_AUDIO, StringForChannelType(buf, dst), B_ENABLE); + subgroup->MakeDiscreteParameter(PARAM_DST_ENABLE(in->ID(), + chan, dst), B_MEDIA_RAW_AUDIO, StringForChannelType(buf, dst), + B_ENABLE); } } } } - top = web->MakeGroup("Setup"); // top level group + top = web->MakeGroup(B_TRANSLATE("Setup")); // top level group group = top->MakeGroup(""); - group->MakeDiscreteParameter(PARAM_ETC(10), B_MEDIA_RAW_AUDIO, "Attenuate mixer output by 3dB (like BeOS R5)", B_ENABLE); - group->MakeDiscreteParameter(PARAM_ETC(20), B_MEDIA_RAW_AUDIO, "Use non linear gain sliders (like BeOS R5)", B_ENABLE); - group->MakeDiscreteParameter(PARAM_ETC(30), B_MEDIA_RAW_AUDIO, "Display balance control for stereo connections", B_ENABLE); + group->MakeDiscreteParameter(PARAM_ETC(10), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Attenuate mixer output by 3dB (like BeOS R5)"), B_ENABLE); + group->MakeDiscreteParameter(PARAM_ETC(20), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Use non linear gain sliders (like BeOS R5)"), B_ENABLE); + group->MakeDiscreteParameter(PARAM_ETC(30), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Display balance control for stereo connections"), + B_ENABLE); - group->MakeDiscreteParameter(PARAM_ETC(40), B_MEDIA_RAW_AUDIO, "Allow output channel remapping", B_ENABLE); - group->MakeDiscreteParameter(PARAM_ETC(50), B_MEDIA_RAW_AUDIO, "Allow input channel remapping", B_ENABLE); + group->MakeDiscreteParameter(PARAM_ETC(40), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Allow output channel remapping"), B_ENABLE); + group->MakeDiscreteParameter(PARAM_ETC(50), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Allow input channel remapping"), B_ENABLE); - dp = group->MakeDiscreteParameter(PARAM_ETC(60), B_MEDIA_RAW_AUDIO, "Input gain controls represent", B_INPUT_MUX); - dp->AddItem(0, "Physical input channels"); - dp->AddItem(1, "Virtual output channels"); + dp = group->MakeDiscreteParameter(PARAM_ETC(60), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Input gain controls represent"), B_INPUT_MUX); + dp->AddItem(0, B_TRANSLATE("Physical input channels")); + dp->AddItem(1, B_TRANSLATE("Virtual output channels")); - dp = group->MakeDiscreteParameter(PARAM_ETC(70), B_MEDIA_RAW_AUDIO, "Resampling algorithm", B_INPUT_MUX); - dp->AddItem(0, "Drop/repeat samples"); - dp->AddItem(2, "Linear interpolation"); + dp = group->MakeDiscreteParameter(PARAM_ETC(70), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Resampling algorithm"), B_INPUT_MUX); + dp->AddItem(0, B_TRANSLATE("Drop/repeat samples")); + dp->AddItem(2, B_TRANSLATE("Linear interpolation")); // Note: The following code is outcommented on purpose // and is about to be modified at a later point /* - dp->AddItem(1, "Drop/repeat samples (template based)"); - dp->AddItem(3, "17th order filtering"); + dp->AddItem(1, B_TRANSLATE("Drop/repeat samples (template based)")); + dp->AddItem(3, B_TRANSLATE("17th order filtering")); */ - group->MakeDiscreteParameter(PARAM_ETC(80), B_MEDIA_RAW_AUDIO, "Refuse output format changes", B_ENABLE); - group->MakeDiscreteParameter(PARAM_ETC(90), B_MEDIA_RAW_AUDIO, "Refuse input format changes", B_ENABLE); + group->MakeDiscreteParameter(PARAM_ETC(80), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Refuse output format changes"), B_ENABLE); + group->MakeDiscreteParameter(PARAM_ETC(90), B_MEDIA_RAW_AUDIO, + B_TRANSLATE("Refuse input format changes"), B_ENABLE); fCore->Unlock(); SetParameterWeb(web); diff --git a/src/add-ons/media/media-add-ons/mixer/AudioMixer.rdef b/src/add-ons/media/media-add-ons/mixer/AudioMixer.rdef new file mode 100644 index 0000000000..ac3ecd17fa --- /dev/null +++ b/src/add-ons/media/media-add-ons/mixer/AudioMixer.rdef @@ -0,0 +1,15 @@ +/* + * AudioMixer.rdef + */ + +resource app_signature "application/x-vnd.Haiku-mixer.media_addon"; + +resource app_version { + major = 1, + middle = 0, + minor = 0, + variety = 0, + internal = 0, + short_info = "1.0.0", + long_info = "Haiku AudioMixer media add-on." +}; diff --git a/src/add-ons/media/media-add-ons/mixer/Jamfile b/src/add-ons/media/media-add-ons/mixer/Jamfile index 64134e4f79..506edb093c 100644 --- a/src/add-ons/media/media-add-ons/mixer/Jamfile +++ b/src/add-ons/media/media-add-ons/mixer/Jamfile @@ -2,6 +2,8 @@ SubDir HAIKU_TOP src add-ons media media-add-ons mixer ; SetSubDirSupportedPlatformsBeOSCompatible ; +AddResources mixer.media_addon : AudioMixer.rdef ; + Addon mixer.media_addon : AudioMixer.cpp ByteSwap.cpp @@ -13,9 +15,16 @@ Addon mixer.media_addon : MixerSettings.cpp MixerUtils.cpp Resampler.cpp - : be media $(TARGET_LIBSUPC++) + : be media $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) ; Package haiku-mixer-cvs : mixer.media_addon : boot home config add-ons media ; + +DoCatalogs mixer.media_addon + : + x-vnd.Haiku-mixer.media_addon + : + AudioMixer.cpp + ; From 7781d9ad28ffca6da65e9bf646358c2540ffc2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 16:48:16 +0000 Subject: [PATCH 507/702] * Applied patch by 'mt' that fixes ticket #6275 - thanks a lot! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42968 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/AppearPrefView.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/apps/terminal/AppearPrefView.cpp b/src/apps/terminal/AppearPrefView.cpp index 0df9df1c87..17345a57a2 100644 --- a/src/apps/terminal/AppearPrefView.cpp +++ b/src/apps/terminal/AppearPrefView.cpp @@ -125,8 +125,10 @@ AppearancePrefView::AppearancePrefView(const char* name, BLayoutBuilder::Group<>(this) .SetInsets(5, 5, 5, 5) .AddGrid(5, 5) - .AddTextControl(fTabTitle, 0, 0, B_ALIGN_RIGHT) - .AddTextControl(fWindowTitle, 0, 1, B_ALIGN_RIGHT) + .Add(fTabTitle->CreateLabelLayoutItem(), 0, 0) + .Add(fTabTitle->CreateTextViewLayoutItem(), 1, 0) + .Add(fWindowTitle->CreateLabelLayoutItem(), 0, 1) + .Add(fWindowTitle->CreateTextViewLayoutItem(), 1, 1) .Add(fFont->CreateLabelLayoutItem(), 0, 2) .Add(fFont->CreateMenuBarLayoutItem(), 1, 2) .Add(fFontSize->CreateLabelLayoutItem(), 0, 3) @@ -141,6 +143,8 @@ AppearancePrefView::AppearancePrefView(const char* name, B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED))) .Add(fWarnOnExit); + fTabTitle->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); + fWindowTitle->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); fFont->SetAlignment(B_ALIGN_RIGHT); fFontSize->SetAlignment(B_ALIGN_RIGHT); fColorField->SetAlignment(B_ALIGN_RIGHT); From e4700f2e2bdb3f8a801ad91fcb86f7cfe563a98e Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 29 Oct 2011 16:52:37 +0000 Subject: [PATCH 508/702] Patch by Philippe Saint-Pierre: Wait only half a second instead of 5 before displaying anything. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42969 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/top.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/bin/top.c b/src/bin/top.c index eed4ae153f..090bf177df 100644 --- a/src/bin/top.c +++ b/src/bin/top.c @@ -443,11 +443,7 @@ main(int argc, char **argv) refresh = 0; } } - if (iters < 0) { - printf("Starting: infinite intervals of %d second%s each\n", - interval, - (interval == 1) ? "" : "s"); - } else { + if (iters >= 0) { printf("Starting: %d interval%s of %d second%s each\n", iters, (iters == 1) ? "" : "s", interval, (interval == 1) ? "" : "s"); @@ -456,8 +452,21 @@ main(int argc, char **argv) signal(SIGWINCH, winch_handler); then = system_time(); + if (iters < 0) { + // You will only have to wait half a second for the first iteration. + uinterval = 1 * 1000000 / 2; + baseline = gather(NULL, &busy, 0, refresh); + elapsed = system_time() - then; + if (elapsed < uinterval) { + snooze(uinterval - elapsed); + elapsed = uinterval; + } + then = system_time(); + baseline = gather(&baseline, &busy, elapsed, refresh); + } else + baseline = gather(NULL, &busy, 0, refresh); + uinterval = interval * 1000000; - baseline = gather(NULL, &busy, 0, refresh); for (i = 0; iters < 0 || i < iters; i++) { elapsed = system_time() - then; if (elapsed < uinterval) { From d817520f9870f68166cbc49d0e629c681229a751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 17:09:12 +0000 Subject: [PATCH 509/702] * Removed some dead code by applying a patch by lucian from ticket #6275, thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42970 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/elf.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/system/kernel/elf.cpp b/src/system/kernel/elf.cpp index ffc90ccc55..ad3c291ce2 100644 --- a/src/system/kernel/elf.cpp +++ b/src/system/kernel/elf.cpp @@ -1999,7 +1999,6 @@ load_kernel_add_on(const char *path) struct elf_image_info *image; const char *fileName; void *reservedAddress; - addr_t start; size_t reservedSize; status_t status; ssize_t length; @@ -2125,7 +2124,6 @@ load_kernel_add_on(const char *path) goto error3; } - start = (addr_t)reservedAddress; image->data_region.size = 0; image->text_region.size = 0; @@ -2212,17 +2210,6 @@ load_kernel_add_on(const char *path) } } - // get the segment order - elf_region *firstRegion; - elf_region *secondRegion; - if (image->text_region.start < image->data_region.start) { - firstRegion = &image->text_region; - secondRegion = &image->data_region; - } else { - firstRegion = &image->data_region; - secondRegion = &image->text_region; - } - image->data_region.delta += image->data_region.start; image->text_region.delta += image->text_region.start; From 4d9b54c1759730155ec4511cf68144f7300eb710 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 29 Oct 2011 17:12:44 +0000 Subject: [PATCH 510/702] Some cleanup in Backround preflet: * rename a couple of members for imroved clarity * adjust formatting in header git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42971 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../backgrounds/BackgroundsView.cpp | 46 +++--- src/preferences/backgrounds/BackgroundsView.h | 140 +++++++++--------- 2 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/preferences/backgrounds/BackgroundsView.cpp b/src/preferences/backgrounds/BackgroundsView.cpp index d1db60156b..cefb60ab10 100644 --- a/src/preferences/backgrounds/BackgroundsView.cpp +++ b/src/preferences/backgrounds/BackgroundsView.cpp @@ -72,10 +72,10 @@ BackgroundsView::BackgroundsView() { SetBorder(B_NO_BORDER); - fPreview = new BBox("preview"); - fPreview->SetLabel(B_TRANSLATE("Preview")); + fPreviewBox = new BBox("preview"); + fPreviewBox->SetLabel(B_TRANSLATE("Preview")); - fPreView = new PreView(); + fPreview = new Preview(); fTopLeft = new FramePart(FRAME_TOP_LEFT); fTop = new FramePart(FRAME_TOP); @@ -111,7 +111,7 @@ BackgroundsView::BackgroundsView() .Add(fTop, 1, 0) .Add(fTopRight, 2, 0) .Add(fLeft, 0, 1) - .Add(fPreView, 1, 1) + .Add(fPreview, 1, 1) .Add(fRight, 2, 1) .Add(fBottomLeft, 0, 2) .Add(fBottom, 1, 2) @@ -129,7 +129,7 @@ BackgroundsView::BackgroundsView() .AddGlue() .View(); - fPreview->AddChild(view); + fPreviewBox->AddChild(view); BBox* rightbox = new BBox("rightbox"); @@ -227,7 +227,7 @@ BackgroundsView::BackgroundsView() view = BLayoutBuilder::Group<>() .AddGroup(B_VERTICAL, 10) .AddGroup(B_HORIZONTAL, 10) - .Add(fPreview) + .Add(fPreviewBox) .Add(rightbox) .End() .AddGroup(B_HORIZONTAL, 0) @@ -306,8 +306,8 @@ BackgroundsView::MessageReceived(BMessage* msg) case kMsgUpdatePreviewPlacement: { BString xstring, ystring; - xstring << (int)fPreView->fPoint.x; - ystring << (int)fPreView->fPoint.y; + xstring << (int)fPreview->fPoint.x; + ystring << (int)fPreview->fPoint.y; fXPlacementText->SetText(xstring.String()); fYPlacementText->SetText(ystring.String()); _UpdatePreview(); @@ -865,7 +865,7 @@ BackgroundsView::_UpdatePreview() fXPlacementText->TextView()->MakeEditable(textEnabled); fYPlacementText->TextView()->MakeEditable(textEnabled); - fPreView->ClearViewBitmap(); + fPreview->ClearViewBitmap(); int32 index = ((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex(); if (index >= 0) { @@ -877,22 +877,22 @@ BackgroundsView::_UpdatePreview() atoi(fYPlacementText->Text())), fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0); if (info->fMode == BackgroundImage::kAtOffset) { - fPreView->SetEnabled(true); - fPreView->fPoint.x = atoi(fXPlacementText->Text()); - fPreView->fPoint.y = atoi(fYPlacementText->Text()); + fPreview->SetEnabled(true); + fPreview->fPoint.x = atoi(fXPlacementText->Text()); + fPreview->fPoint.y = atoi(fYPlacementText->Text()); } else - fPreView->SetEnabled(false); + fPreview->SetEnabled(false); - fPreView->fImageBounds = BRect(bitmap->Bounds()); - fCurrent->Show(info, fPreView); + fPreview->fImageBounds = BRect(bitmap->Bounds()); + fCurrent->Show(info, fPreview); delete info; } } else - fPreView->SetEnabled(false); + fPreview->SetEnabled(false); - fPreView->SetViewColor(fPicker->ValueAsColor()); - fPreView->Invalidate(); + fPreview->SetViewColor(fPicker->ValueAsColor()); + fPreview->Invalidate(); } @@ -1144,7 +1144,7 @@ BackgroundsView::FoundPositionSetting() // #pragma mark - -PreView::PreView() +Preview::Preview() : BControl("PreView", NULL, NULL, B_WILL_DRAW | B_SUBPIXEL_PRECISE) { @@ -1159,7 +1159,7 @@ PreView::PreView() void -PreView::AttachedToWindow() +Preview::AttachedToWindow() { rgb_color color = ViewColor(); BControl::AttachedToWindow(); @@ -1168,7 +1168,7 @@ PreView::AttachedToWindow() void -PreView::MouseDown(BPoint point) +Preview::MouseDown(BPoint point) { if (IsEnabled() && Bounds().Contains(point)) { uint32 buttons; @@ -1190,7 +1190,7 @@ PreView::MouseDown(BPoint point) void -PreView::MouseUp(BPoint point) +Preview::MouseUp(BPoint point) { if (IsTracking()) { SetTracking(false); @@ -1201,7 +1201,7 @@ PreView::MouseUp(BPoint point) void -PreView::MouseMoved(BPoint point, uint32 transit, const BMessage* message) +Preview::MouseMoved(BPoint point, uint32 transit, const BMessage* message) { if (!IsTracking()) { BCursor cursor(IsEnabled() diff --git a/src/preferences/backgrounds/BackgroundsView.h b/src/preferences/backgrounds/BackgroundsView.h index 692065c247..0c80d65daf 100644 --- a/src/preferences/backgrounds/BackgroundsView.h +++ b/src/preferences/backgrounds/BackgroundsView.h @@ -65,116 +65,116 @@ enum frame_parts { class FramePart : public BView { public: - FramePart(int32 part); + FramePart(int32 part); - void Draw(BRect rect); - void SetDesktop(bool isDesktop); + void Draw(BRect rect); + void SetDesktop(bool isDesktop); private: - void _SetSizeAndAlignment(); + void _SetSizeAndAlignment(); - int32 fFramePart; - bool fIsDesktop; + int32 fFramePart; + bool fIsDesktop; }; -class PreView : public BControl { +class Preview : public BControl { public: - PreView(); + Preview(); - BPoint fPoint; - BRect fImageBounds; + BPoint fPoint; + BRect fImageBounds; protected: - void MouseDown(BPoint point); - void MouseUp(BPoint point); - void MouseMoved(BPoint point, uint32 transit, - const BMessage* message); - void AttachedToWindow(); + void MouseDown(BPoint point); + void MouseUp(BPoint point); + void MouseMoved(BPoint point, uint32 transit, + const BMessage* message); + void AttachedToWindow(); - BPoint fOldPoint; - float fXRatio; - float fYRatio; - display_mode fMode; + BPoint fOldPoint; + float fXRatio; + float fYRatio; + display_mode fMode; }; class BackgroundsView : public BBox { public: - BackgroundsView(); - ~BackgroundsView(); + BackgroundsView(); + ~BackgroundsView(); - void AllAttached(); - void MessageReceived(BMessage* msg); + void AllAttached(); + void MessageReceived(BMessage* msg); - void RefsReceived(BMessage* msg); + void RefsReceived(BMessage* msg); - void SaveSettings(); - void WorkspaceActivated(uint32 oldWorkspaces, - bool active); - int32 AddImage(BPath path); - Image* GetImage(int32 imageIndex); + void SaveSettings(); + void WorkspaceActivated(uint32 oldWorkspaces, + bool active); + int32 AddImage(BPath path); + Image* GetImage(int32 imageIndex); - bool FoundPositionSetting(); + bool FoundPositionSetting(); protected: - void _Save(); - void _NotifyServer(); - void _LoadSettings(); - void _LoadDesktopFolder(); - void _LoadDefaultFolder(); - void _LoadFolder(bool isDesktop); - void _LoadRecentFolder(BPath path); - void _UpdateWithCurrent(); - void _UpdatePreview(); - void _UpdateButtons(); - void _SetDesktop(bool isDesktop); - int32 _AddPath(BPath path); + void _Save(); + void _NotifyServer(); + void _LoadSettings(); + void _LoadDesktopFolder(); + void _LoadDefaultFolder(); + void _LoadFolder(bool isDesktop); + void _LoadRecentFolder(BPath path); + void _UpdateWithCurrent(); + void _UpdatePreview(); + void _UpdateButtons(); + void _SetDesktop(bool isDesktop); + int32 _AddPath(BPath path); - static int32 _NotifyThread(void* data); + static int32 _NotifyThread(void* data); BGImageMenuItem* _FindImageItem(const int32 imageIndex); - bool _AddItem(BGImageMenuItem* item); + bool _AddItem(BGImageMenuItem* item); BackgroundImage::Mode _FindPlacementMode(); - BColorControl* fPicker; - BButton* fApply; - BButton* fRevert; - BCheckBox* fIconLabelOutline; - BMenu* fPlacementMenu; - BMenu* fImageMenu; - BMenu* fWorkspaceMenu; - BTextControl* fXPlacementText; - BTextControl* fYPlacementText; - PreView* fPreView; - BBox* fPreview; - BFilePanel* fFolderPanel; - ImageFilePanel* fPanel; + BColorControl* fPicker; + BButton* fApply; + BButton* fRevert; + BCheckBox* fIconLabelOutline; + BMenu* fPlacementMenu; + BMenu* fImageMenu; + BMenu* fWorkspaceMenu; + BTextControl* fXPlacementText; + BTextControl* fYPlacementText; + Preview* fPreview; + BBox* fPreviewBox; + BFilePanel* fFolderPanel; + ImageFilePanel* fPanel; BackgroundImage* fCurrent; BackgroundImage::BackgroundImageInfo* fCurrentInfo; - entry_ref fCurrentRef; - int32 fLastImageIndex; - int32 fLastWorkspaceIndex; - BMessage fSettings; + entry_ref fCurrentRef; + int32 fLastImageIndex; + int32 fLastWorkspaceIndex; + BMessage fSettings; BObjectList fPathList; BObjectList fImageList; - FramePart* fTopLeft; - FramePart* fTop; - FramePart* fTopRight; - FramePart* fLeft; - FramePart* fRight; - FramePart* fBottomLeft; - FramePart* fBottom; - FramePart* fBottomRight; + FramePart* fTopLeft; + FramePart* fTop; + FramePart* fTopRight; + FramePart* fLeft; + FramePart* fRight; + FramePart* fBottomLeft; + FramePart* fBottom; + FramePart* fBottomRight; - bool fFoundPositionSetting; + bool fFoundPositionSetting; }; #endif // BACKGROUNDS_VIEW_H From ee5f0dac80926eac52c38a13a03a2c3fb3b24def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 29 Oct 2011 17:35:11 +0000 Subject: [PATCH 511/702] Applied patch from jalopeura on ticket #7458 and reworked it to use the BMailDaemon::MarkAsRead() method when an account id exists. Added a TODO note about using menu labels in tests while they could someday be translated. Replaced some hardcoded strings with the proper defines. Made the add-on also apply partial emails, I suppose it's the intent. Works for me. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42972 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/tracker/mark_as/Jamfile | 6 ++-- src/add-ons/tracker/mark_as/MarkAs.cpp | 38 +++++++++++++++++++-- src/add-ons/tracker/mark_as/MarkAs.rdef | 3 +- src/add-ons/tracker/mark_as/MarkAsRead.cpp | 31 ++++++++++++++--- src/add-ons/tracker/mark_as/MarkAsRead.rdef | 3 +- 5 files changed, 70 insertions(+), 11 deletions(-) diff --git a/src/add-ons/tracker/mark_as/Jamfile b/src/add-ons/tracker/mark_as/Jamfile index 62ccad3cad..0a22ea12b0 100644 --- a/src/add-ons/tracker/mark_as/Jamfile +++ b/src/add-ons/tracker/mark_as/Jamfile @@ -2,15 +2,17 @@ SubDir HAIKU_TOP src add-ons tracker mark_as ; SetSubDirSupportedPlatformsBeOSCompatible ; +UsePrivateHeaders mail ; + AddResources Mark\ as… : MarkAs.rdef ; AddResources Mark\ as\ Read-R : MarkAsRead.rdef ; Addon Mark\ as… : MarkAs.cpp - : be tracker $(TARGET_LIBSUPC++) + : be tracker $(TARGET_LIBSUPC++) libmail.so ; Addon Mark\ as\ Read-R : MarkAsRead.cpp - : be tracker $(TARGET_LIBSUPC++) + : be tracker $(TARGET_LIBSUPC++) libmail.so ; diff --git a/src/add-ons/tracker/mark_as/MarkAs.cpp b/src/add-ons/tracker/mark_as/MarkAs.cpp index a81c7af3ba..3f8bfb3b95 100644 --- a/src/add-ons/tracker/mark_as/MarkAs.cpp +++ b/src/add-ons/tracker/mark_as/MarkAs.cpp @@ -7,9 +7,12 @@ #include #include +#include #include #include #include +#include +#include #include #include #include @@ -84,6 +87,7 @@ process_refs(entry_ref dir, BMessage* message, void* /*reserved*/) return; BString status = item->Label(); + //TODO:This won't work anymore when the menu gets translated! Use index! entry_ref ref; for (int i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) { @@ -92,13 +96,41 @@ process_refs(entry_ref dir, BMessage* message, void* /*reserved*/) if (node.InitCheck() == B_OK && node.ReadAttrString("BEOS:TYPE", &type) == B_OK - && type == "text/x-email") { + && (type == B_MAIL_TYPE || type == B_PARTIAL_MAIL_TYPE)) { BString previousStatus; + read_flags previousRead; + + // Update the MAIL:read flag + if (status == "New") { + if (read_read_attr(node, previousRead) != B_OK || + previousRead != B_UNREAD) + write_read_attr(node, B_UNREAD); + } + else if (status == "Read") { + // if we're marking it via the add-on, we haven't really read it + // so use B_SEEN instead of B_READ + // Check both B_SEEN and B_READ + // (so we don't overwrite B_READ with B_SEEN) + if (read_read_attr(node, previousRead) != B_OK || + (previousRead != B_SEEN && previousRead != B_READ)) { + int32 account; + if (node.ReadAttr(B_MAIL_ATTR_ACCOUNT_ID, B_INT32_TYPE, + 0LL, &account, sizeof(account)) == sizeof(account)) + BMailDaemon::MarkAsRead(account, ref, B_SEEN); + else + write_read_attr(node, B_SEEN); + } + } + // ignore "Replied"; no matching MAIL:read status + // We want to keep the previous behavior of updating the status + // string, but write_read_attr will only change the status string + // if it's one of "New", "Seen", or "Read" (and not, for example, + // "Replied"), so we change the status string here // Only update the attribute if there is an actual change - if (node.ReadAttrString("MAIL:status", &previousStatus) != B_OK + if (node.ReadAttrString(B_MAIL_ATTR_STATUS, &previousStatus) != B_OK || previousStatus != status) - node.WriteAttrString("MAIL:status", &status); + node.WriteAttrString(B_MAIL_ATTR_STATUS, &status); } } } diff --git a/src/add-ons/tracker/mark_as/MarkAs.rdef b/src/add-ons/tracker/mark_as/MarkAs.rdef index 76168d9d3f..4c70b6abb9 100644 --- a/src/add-ons/tracker/mark_as/MarkAs.rdef +++ b/src/add-ons/tracker/mark_as/MarkAs.rdef @@ -1,7 +1,8 @@ resource app_signature "application/x-vnd.Haiku-MarkAs"; resource file_types message { - "types" = "text/x-email" + "types" = "text/x-email", + "types" = "text/x-partial-email" }; resource app_version { diff --git a/src/add-ons/tracker/mark_as/MarkAsRead.cpp b/src/add-ons/tracker/mark_as/MarkAsRead.cpp index 6c37376be8..ee79b46c4f 100644 --- a/src/add-ons/tracker/mark_as/MarkAsRead.cpp +++ b/src/add-ons/tracker/mark_as/MarkAsRead.cpp @@ -5,12 +5,14 @@ */ +#include #include +#include +#include #include #include #include - extern "C" void process_refs(entry_ref dir, BMessage* message, void* /*reserved*/) { @@ -21,14 +23,35 @@ process_refs(entry_ref dir, BMessage* message, void* /*reserved*/) if (node.InitCheck() == B_OK && node.ReadAttrString("BEOS:TYPE", &type) == B_OK - && type == "text/x-email") { + && (type == B_MAIL_TYPE || type == B_PARTIAL_MAIL_TYPE)) { BString previousStatus; BString status("Read"); + read_flags previousRead; + // if we're marking it via the add-on, we haven't really read it + // so use B_SEEN instead of B_READ + read_flags read = B_SEEN; + + // Update the MAIL:read status to match + // Check both B_SEEN and B_READ + // (so we don't overwrite B_READ with B_SEEN) + if (read_read_attr(node, previousRead) != B_OK || + (previousRead != B_SEEN && previousRead != B_READ)) { + int32 account; + if (node.ReadAttr(B_MAIL_ATTR_ACCOUNT_ID, B_INT32_TYPE, + 0LL, &account, sizeof(account)) == sizeof(account)) + BMailDaemon::MarkAsRead(account, ref, read); + else + write_read_attr(node, read); + } + // We want to keep the previous behavior of updating the status + // string, but write_read_attr will only change the status string + // if it's one of "New", "Seen", or "Read" (and not, for example, + // "Replied"), so we change the status string here // Only update the attribute if there is an actual change - if (node.ReadAttrString("MAIL:status", &previousStatus) != B_OK + if (node.ReadAttrString(B_MAIL_ATTR_STATUS, &previousStatus) != B_OK || previousStatus != status) - node.WriteAttrString("MAIL:status", &status); + node.WriteAttrString(B_MAIL_ATTR_STATUS, &status); } } } diff --git a/src/add-ons/tracker/mark_as/MarkAsRead.rdef b/src/add-ons/tracker/mark_as/MarkAsRead.rdef index 03eef69129..8ebf49e3de 100644 --- a/src/add-ons/tracker/mark_as/MarkAsRead.rdef +++ b/src/add-ons/tracker/mark_as/MarkAsRead.rdef @@ -1,7 +1,8 @@ resource app_signature "application/x-vnd.Haiku-MarkAsRead"; resource file_types message { - "types" = "text/x-email" + "types" = "text/x-email", + "types" = "text/x-partial-email" }; resource app_version { From a9bd4e48ebd86de4929a793f6eb21c8476c04195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 17:38:58 +0000 Subject: [PATCH 512/702] * More minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42973 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../imap/imap_lib/IMAPMailbox.cpp | 6 +-- .../imap/imap_lib/IMAPMailbox.h | 6 +-- .../imap/imap_lib/IMAPProtocol.cpp | 43 +++++++++++-------- .../imap/imap_lib/IMAPProtocol.h | 4 +- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.cpp index 4db97d9a9f..2da4cfc655 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.cpp @@ -132,9 +132,9 @@ IMAPMailbox::StartWatchingMailbox(sem_id startedSem) bigtime_t timeout = 1000 * 1000 * 60 * 29; // 29 min status_t status; while (true) { - int32 commandId = NextCommandId(); + int32 commandID = NextCommandID(); TRACE("IDLE ...\n"); - status = SendCommand("IDLE", commandId); + status = SendCommand("IDLE", commandID); if (firstIDLE) { release_sem(startedSem); firstIDLE = false; @@ -142,7 +142,7 @@ IMAPMailbox::StartWatchingMailbox(sem_id startedSem) if (status != B_OK) break; - status = HandleResponse(commandId, timeout, false); + status = HandleResponse(commandID, timeout, false); ProcessAfterQuacks(kIMAP4ClientTimeout); if (atomic_get(&fWatching) == 0) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.h index e1910f54a0..b814919262 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.h @@ -81,10 +81,10 @@ private: MinMessageList fMessageList; IMAPStorage& fStorage; - IMAPMailboxListener* fIMAPMailboxListener; - IMAPMailboxListener fNULLListener; + IMAPMailboxListener* fIMAPMailboxListener; + IMAPMailboxListener fNULLListener; - MailboxSelectHandler fMailboxSelectHandler; + MailboxSelectHandler fMailboxSelectHandler; CapabilityHandler fCapabilityHandler; ExistsHandler fExistsHandler; ExpungeHandler fExpungeHandler; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp index b8fe7a3430..6f33929002 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp @@ -1,3 +1,11 @@ +/* + * Copyright 2010-2011, Haiku Inc. All Rights Reserved. + * Copyright 2010 Clemens Zeidler. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ + + #include "IMAPProtocol.h" #include "IMAPHandler.h" @@ -5,12 +13,11 @@ #define DEBUG_IMAP_PROTOCOL - #ifdef DEBUG_IMAP_PROTOCOL -#include -#define TRACE(x...) printf(x) +# include +# define TRACE(x...) printf(x) #else -#define TRACE(x...) /* nothing */ +# define TRACE(x...) ; #endif @@ -18,7 +25,6 @@ ConnectionReader::ConnectionReader(ServerConnection* connection) : fServerConnection(connection) { - } @@ -137,7 +143,7 @@ IMAPProtocol::IMAPProtocol() : fServerConnection(&fOwnServerConnection), fConnectionReader(fServerConnection), - fCommandId(0), + fCommandID(0), fStopNow(0), fIsConnected(false) { @@ -148,7 +154,7 @@ IMAPProtocol::IMAPProtocol(IMAPProtocol& connection) : fServerConnection(connection.fServerConnection), fConnectionReader(fServerConnection), - fCommandId(0), + fCommandID(0), fStopNow(0), fIsConnected(false) { @@ -285,13 +291,13 @@ IMAPProtocol::ProcessCommand(const char* command, bigtime_t timeout) status_t -IMAPProtocol::SendCommand(const char* command, int32 commandId) +IMAPProtocol::SendCommand(const char* command, int32 commandID) { if (strlen(command) + 10 > 256) return B_NO_MEMORY; static char cmd[256]; - ::sprintf(cmd, "A%.7ld %s"CRLF, commandId, command); + ::sprintf(cmd, "A%.7ld %s"CRLF, commandID, command); TRACE("_SendCommand: %s\n", cmd); int commandLength = strlen(cmd); @@ -301,13 +307,14 @@ IMAPProtocol::SendCommand(const char* command, int32 commandId) return B_ERROR; } - fOngoingCommands.push_back(commandId); + fOngoingCommands.push_back(commandID); return B_OK; } status_t -IMAPProtocol::HandleResponse(int32 commandId, bigtime_t timeout, bool disconnectOnTimeout) +IMAPProtocol::HandleResponse(int32 commandID, bigtime_t timeout, + bool disconnectOnTimeout) { status_t commandStatus = B_ERROR; @@ -342,7 +349,7 @@ IMAPProtocol::HandleResponse(int32 commandId, bigtime_t timeout, bool disconnect static char idString[8]; ::sprintf(idString, "A%.7ld", *it); if (line.FindFirst(idString) >= 0) { - if (*it == commandId) { + if (*it == commandID) { BString result = IMAPParser::ExtractElementAfter(line, idString); if (result == "OK") @@ -379,10 +386,10 @@ IMAPProtocol::ProcessAfterQuacks(bigtime_t timeout) int32 -IMAPProtocol::NextCommandId() +IMAPProtocol::NextCommandID() { - fCommandId++; - return fCommandId; + fCommandID++; + return fCommandID; } @@ -408,12 +415,12 @@ status_t IMAPProtocol::_ProcessCommandWithoutAfterQuake(const char* command, bigtime_t timeout) { - int32 commandId = NextCommandId(); - status_t status = SendCommand(command, commandId); + int32 commandID = NextCommandID(); + status_t status = SendCommand(command, commandID); if (status != B_OK) return status; - return HandleResponse(commandId, timeout); + return HandleResponse(commandID, timeout); } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.h index df8beb56f9..833e9b7873 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.h @@ -97,7 +97,7 @@ protected: bigtime_t timeout = kIMAP4ClientTimeout, bool disconnectOnTimeout = true); void ProcessAfterQuacks(bigtime_t timeout); - int32 NextCommandId(); + int32 NextCommandID(); ServerConnection* fServerConnection; ServerConnection fOwnServerConnection; @@ -115,7 +115,7 @@ private: bigtime_t timeout = kIMAP4ClientTimeout); status_t _Disconnect(); - int32 fCommandId; + int32 fCommandID; std::vector fOngoingCommands; BString fCommandError; From e9e53773c9cbe9d42abedffba86e307fb046f089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 29 Oct 2011 18:47:21 +0000 Subject: [PATCH 513/702] Erase the removed account from the accounts map. This avoids a crash when an account was removed when we shutdown the daemon, due to double free(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42974 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/mail/MailDaemon.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/servers/mail/MailDaemon.cpp b/src/servers/mail/MailDaemon.cpp index d0c4567109..d1d3537415 100644 --- a/src/servers/mail/MailDaemon.cpp +++ b/src/servers/mail/MailDaemon.cpp @@ -725,6 +725,7 @@ MailDaemonApp::_RemoveAccount(AccountMap::const_iterator it) delete it->second.outboundProtocol; unload_add_on(it->second.inboundImage); unload_add_on(it->second.outboundImage); + fAccounts.erase(it->first); } From 3f2e30c0a01399573013b982895f72ef70d0ea86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 29 Oct 2011 19:31:29 +0000 Subject: [PATCH 514/702] Place the button description window near the mouse and to the side of the pad window that has enough room (preferring right/bottom side of pad). The algorithm doesn't strictly prevent the window to be placed outside of the screen in any and all situations, but it should work pretty well in practice. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42975 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/launchbox/App.cpp | 36 +++++++++++++++-- src/apps/launchbox/App.h | 12 +++++- src/apps/launchbox/MainWindow.cpp | 64 +++++++++++++++++++++---------- src/apps/launchbox/MainWindow.h | 4 +- src/apps/launchbox/NamePanel.cpp | 21 +++++----- src/apps/launchbox/NamePanel.h | 11 ++---- 6 files changed, 102 insertions(+), 46 deletions(-) diff --git a/src/apps/launchbox/App.cpp b/src/apps/launchbox/App.cpp index f9c0f54620..3481ff0634 100644 --- a/src/apps/launchbox/App.cpp +++ b/src/apps/launchbox/App.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Stephan Aßmus . + * Copyright 2006-2011, Stephan Aßmus . * All rights reserved. Distributed under the terms of the MIT License. */ @@ -22,7 +22,8 @@ App::App() : BApplication("application/x-vnd.Haiku-LaunchBox"), - fSettingsChanged(false) + fSettingsChanged(false), + fNamePanelSize(200, 50) { SetPulseRate(3000000); } @@ -47,7 +48,7 @@ App::ReadyToRun() bool windowAdded = false; BRect frame(50.0, 50.0, 65.0, 100.0); - BMessage settings('sett'); + BMessage settings; status_t status = load_settings(&settings, "main_settings", "LaunchBox"); if (status >= B_OK) { BMessage windowMessage; @@ -65,8 +66,11 @@ App::ReadyToRun() frame.OffsetBy(10.0, 10.0); windowMessage.MakeEmpty(); } + BSize size; + if (settings.FindSize("name panel size", &size) == B_OK) + fNamePanelSize = size; } - + if (!windowAdded) { MainWindow* window = new MainWindow(B_TRANSLATE("Pad 1"), frame, true); window->Show(); @@ -110,6 +114,28 @@ App::Pulse() } +void +App::SetNamePanelSize(const BSize& size) +{ + if (Lock()) { + fNamePanelSize = size; + Unlock(); + } +} + + +BSize +App::NamePanelSize() +{ + BSize size; + if (Lock()) { + size = fNamePanelSize; + Unlock(); + } + return size; +} + + void App::_StoreSettingsIfNeeded() { @@ -127,6 +153,8 @@ App::_StoreSettingsIfNeeded() } } } + settings.AddSize("name panel size", fNamePanelSize); + save_settings(&settings, "main_settings", "LaunchBox"); fSettingsChanged = false; diff --git a/src/apps/launchbox/App.h b/src/apps/launchbox/App.h index 9d2465ad94..12366d19d4 100644 --- a/src/apps/launchbox/App.h +++ b/src/apps/launchbox/App.h @@ -1,15 +1,19 @@ /* - * Copyright 2006-2009, Stephan Aßmus . + * Copyright 2006-2011, Stephan Aßmus . * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef APP_H #define APP_H + #include #include +#include + class MainWindow; + class App : public BApplication { public: App(); @@ -20,10 +24,16 @@ public: virtual void MessageReceived(BMessage* message); virtual void Pulse(); + void SetNamePanelSize(const BSize& size); + BSize NamePanelSize(); + private: void _StoreSettingsIfNeeded(); bool fSettingsChanged; + + BSize fNamePanelSize; }; + #endif // APP_H diff --git a/src/apps/launchbox/MainWindow.cpp b/src/apps/launchbox/MainWindow.cpp index 8499f5abe6..8e6f907c90 100644 --- a/src/apps/launchbox/MainWindow.cpp +++ b/src/apps/launchbox/MainWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006 - 2009, Stephan Aßmus . + * Copyright 2006 - 2011, Stephan Aßmus . * All rights reserved. Distributed under the terms of the MIT License. */ @@ -20,6 +20,7 @@ #include "support.h" +#include "App.h" #include "LaunchButton.h" #include "NamePanel.h" #include "PadView.h" @@ -36,7 +37,6 @@ MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons) B_ALL_WORKSPACES), fSettings(new BMessage('sett')), fPadView(new PadView("pad view")), - fNamePanelFrame(-1000.0, -1000.0, -800.0, -900.0), fAutoRaise(false), fShowOnAllWorkspaces(true) { @@ -65,7 +65,6 @@ MainWindow::MainWindow(const char* name, BRect frame, BMessage* settings) B_ALL_WORKSPACES), fSettings(settings), fPadView(new PadView("pad view")), - fNamePanelFrame(-1000.0, -1000.0, -900.0, -900.0), fAutoRaise(false), fShowOnAllWorkspaces(true) { @@ -206,17 +205,52 @@ MainWindow::MessageReceived(BMessage* message) if (message->FindString("name", &name) >= B_OK) { // message comes from a previous name panel button->SetDescription(name); - message->FindRect("frame", &fNamePanelFrame); + BRect namePanelFrame; + if (message->FindRect("frame", &namePanelFrame) == B_OK) { + ((App*)be_app)->SetNamePanelSize( + namePanelFrame.Size()); + } } else { // message comes from pad view entry_ref* ref = button->Ref(); if (ref) { BString helper(B_TRANSLATE("Description for '%3'")); helper.ReplaceFirst("%3", ref->name); - make_sure_frame_is_on_screen(fNamePanelFrame, this); - new NamePanel(helper.String(), button->Description(), - this, this, new BMessage(*message), - fNamePanelFrame); + // Place the name panel besides the pad, but give it + // the user configured size. + BPoint origin = B_ORIGIN; + BSize size = ((App*)be_app)->NamePanelSize(); + NamePanel* panel = new NamePanel(helper.String(), + button->Description(), this, this, + new BMessage(*message), size); + panel->Layout(true); + size = panel->Frame().Size(); + BScreen screen(this); + BPoint mousePos; + uint32 buttons; + fPadView->GetMouse(&mousePos, &buttons, false); + fPadView->ConvertToScreen(&mousePos); + if (fPadView->Orientation() == B_HORIZONTAL) { + // Place above or below the pad + origin.x = mousePos.x - size.width / 2; + if (screen.Frame().bottom - Frame().bottom + > size.height + 20) { + origin.y = Frame().bottom + 10; + } else { + origin.y = Frame().top - 10 - size.height; + } + } else { + // Place left or right of the pad + origin.y = mousePos.y - size.height / 2; + if (screen.Frame().right - Frame().right + > size.width + 20) { + origin.x = Frame().right + 10; + } else { + origin.x = Frame().left - 10 - size.width; + } + } + panel->MoveTo(origin); + panel->Show(); } } } @@ -344,14 +378,6 @@ MainWindow::LoadSettings(const BMessage* message) } } - // restore name panel frame - if (message->FindRect("name panel frame", &frame) == B_OK) { - if (frame.IsValid()) { - make_sure_frame_is_on_screen(frame, this); - fNamePanelFrame = frame; - } - } - // restore window look window_look look; if (message->FindInt32("window look", (int32*)&look) == B_OK) @@ -429,14 +455,10 @@ MainWindow::SaveSettings(BMessage* message) if (message->ReplaceFloat("border distance", fBorderDist) != B_OK) message->AddFloat("border distance", fBorderDist); - // store window frame + // store window frame and look if (message->ReplaceRect("window frame", Frame()) != B_OK) message->AddRect("window frame", Frame()); - // store name panel frame - if (message->ReplaceRect("name panel frame", fNamePanelFrame) != B_OK) - message->AddRect("name panel frame", fNamePanelFrame); - if (message->ReplaceInt32("window look", Look()) != B_OK) message->AddInt32("window look", Look()); diff --git a/src/apps/launchbox/MainWindow.h b/src/apps/launchbox/MainWindow.h index 31a184ad07..50de629b54 100644 --- a/src/apps/launchbox/MainWindow.h +++ b/src/apps/launchbox/MainWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Stephan Aßmus . + * Copyright 2006-2011, Stephan Aßmus . * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef MAIN_WINDOW_H @@ -73,8 +73,6 @@ private: BPoint fScreenPosition; // not really the position, 0...1 = left...right - BRect fNamePanelFrame; - bool fAutoRaise; bool fShowOnAllWorkspaces; }; diff --git a/src/apps/launchbox/NamePanel.cpp b/src/apps/launchbox/NamePanel.cpp index b820dcb0be..db931e7973 100644 --- a/src/apps/launchbox/NamePanel.cpp +++ b/src/apps/launchbox/NamePanel.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Stephan Aßmus . + * Copyright 2006-2011, Stephan Aßmus . * All rights reserved. Distributed under the terms of the MIT License. */ @@ -15,16 +15,18 @@ #undef B_TRANSLATE_CONTEXT #define B_TRANSLATE_CONTEXT "LaunchBox" + + enum { MSG_PANEL_OK, MSG_PANEL_CANCEL, }; -// constructor + NamePanel::NamePanel(const char* label, const char* text, BWindow* window, - BHandler* target, BMessage* message, BRect frame) + BHandler* target, BMessage* message, const BSize& size) : - Panel(frame, B_TRANSLATE("Name Panel"), + Panel(BRect(B_ORIGIN, size), B_TRANSLATE("Name Panel"), B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS), @@ -37,6 +39,10 @@ NamePanel::NamePanel(const char* label, const char* text, BWindow* window, BButton* cancelButton = new BButton(B_TRANSLATE("Cancel"), new BMessage(MSG_PANEL_CANCEL)); fNameTC = new BTextControl(label, text, NULL); + BLayoutItem* inputItem = fNameTC->CreateTextViewLayoutItem(); + inputItem->SetExplicitMinSize( + BSize(fNameTC->StringWidth("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), + B_SIZE_UNSET)); BLayoutBuilder::Group<>(this, B_VERTICAL, 10) .AddGlue() @@ -47,7 +53,7 @@ NamePanel::NamePanel(const char* label, const char* text, BWindow* window, // text control .Add(fNameTC->CreateLabelLayoutItem()) - .Add(fNameTC->CreateTextViewLayoutItem()) + .Add(inputItem) .AddStrut(5) .End() @@ -74,11 +80,6 @@ NamePanel::NamePanel(const char* label, const char* text, BWindow* window, } AddToSubset(fWindow); - - if (!frame.IsValid()) - CenterOnScreen(); - - Show(); } diff --git a/src/apps/launchbox/NamePanel.h b/src/apps/launchbox/NamePanel.h index 2a8d0011e9..386283aaf2 100644 --- a/src/apps/launchbox/NamePanel.h +++ b/src/apps/launchbox/NamePanel.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Stephan Aßmus . + * Copyright 2006-2011, Stephan Aßmus . * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef NAME_PANEL_H @@ -11,12 +11,9 @@ class BTextControl; class NamePanel : public Panel { public: - NamePanel(const char* label, - const char* text, - BWindow* window, - BHandler* target, - BMessage* message, - BRect frame = BRect(-1000.0, -1000.0, -900.0, -900.0)); + NamePanel(const char* label, const char* text, + BWindow* window, BHandler* target, + BMessage* message, const BSize& size); virtual ~NamePanel(); virtual void MessageReceived(BMessage *message); From c647837666771daf95e7d026e1b1c2dacc662bab Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 19:56:05 +0000 Subject: [PATCH 515/702] * Add some details on how the Locale and the formater classes relate and which one one should use. * Add documentation for BDurationFormat. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42976 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/locale/DurationFormat.dox | 58 +++++++++++++++++++++++++++++ docs/user/locale/localeintro.dox | 17 ++++++--- 2 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 docs/user/locale/DurationFormat.dox diff --git a/docs/user/locale/DurationFormat.dox b/docs/user/locale/DurationFormat.dox new file mode 100644 index 0000000000..8177757dc9 --- /dev/null +++ b/docs/user/locale/DurationFormat.dox @@ -0,0 +1,58 @@ +/* + * Copyright 2011, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Adrien Destugues, pulkomandy@pulkomandy.ath.cx + * + * Corresponds to: + * /trunk/headers/os/locale/DurationFormat.h rev 42944 + * /trunk/src/kits/locale/DurationFormat.cpp rev 42944 + */ + + +/*! + \class BDurationFormat + \ingroup locale + \brief Formatter for time interfals + + BDurationFormat is a formatter for time intervals. A time interval is defined + by its start and end values, and the result is a string such as + "1 hour, 2 minutes, 28 seconds". +*/ + + +/*! + \fn BDurationFormat::BDurationFormat(const BString& separator) + \brief Constructor. + + \warning Creating a BDurationFormat is a costly operation. Most of the time, + you most likely want to use the default one through the BLocale class. + + The separator string will be appended between the elements of formated + durations. +*/ + + +/*! + \fn void BDurationFormat::SetSeparator(cosnt BString& separator) + \brief Replace the spearator for this formatter. +*/ + + +/*! + \fn status_t BDurationForamt::SetLocale(const BLocale* locale) + \brief Sets the locale for this formatter. +*/ + + +/*! + \fn status_t BDurationFormat::Format(bigtime_t startValue, + bigtime_t endValue, BString* buffer, time_unit_style = B_TIME_UNIT_FULL) + const; + \brief Formats a duration defined by its start and end values. + +The start and end values are in milliseconds. The result is appeded to the +buffer. The full time style uses full words (hours, minuts, seconds), while the +shot one uses units (h, m, s). +*/ diff --git a/docs/user/locale/localeintro.dox b/docs/user/locale/localeintro.dox index 34f7e77659..db88b84dd1 100644 --- a/docs/user/locale/localeintro.dox +++ b/docs/user/locale/localeintro.dox @@ -8,12 +8,17 @@ dates, and times in a way that match the locale preferences of the user. The main way to access locale data is through the be_locale_roster. This is a global instance of the BLocaleRoster class, storing the data for localizing an -application according to the user's preferred settings. The locale roster also -acts as a factory to instanciate most of the other classes. However, there are -some cases where you will need to instanciate another class by yourself, to -use it with custom settings. For example, you may need to format a date with -a fixed format in english for including in an e-mail header, as it is the only -format accepted there. +application according to the user's preferred settings. Most of the time, you +should be able to use the default BLocale object and its convenience methods to +get things formatted according to the user preferences. However, you can also +use the various formatter classes directly when you need a more advanced +formatting. For example, you may need to format a date with a fixed format in +english for including in an e-mail header, as it is the only format accepted +there. + +Note that creating a new format is a costly operation. The idea is that you +create your format object once and reuse it accross your application to format +all the stuff that needs it. Unlike the other kits in Haiku, the Locale kit does not live in libbe. When building a localized application, you have to link it to liblocale.so. If you From 4eef91b9c8f84625586bdf0e259674363e836b58 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 29 Oct 2011 20:48:41 +0000 Subject: [PATCH 516/702] Rework time computations in tracker status window to use localized functions. Result is not as good as the previous implementation, because we need the more advanced BDateFormat API, which is not available yet. Fixes #6930. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42977 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/StatusWindow.cpp | 50 +++++++++++-------------------- src/kits/tracker/StatusWindow.h | 4 +-- 2 files changed, 19 insertions(+), 35 deletions(-) diff --git a/src/kits/tracker/StatusWindow.cpp b/src/kits/tracker/StatusWindow.cpp index ea53640f28..ece34097a3 100644 --- a/src/kits/tracker/StatusWindow.cpp +++ b/src/kits/tracker/StatusWindow.cpp @@ -42,6 +42,7 @@ All rights reserved. #include #include #include +#include #include #include #include @@ -775,24 +776,17 @@ BStatusView::_TimeStatusString(float availableSpace, float* _width) time_t now = (time_t)real_time_clock(); time_t finishTime = (time_t)(now + secondsRemaining); - tm _time; - tm* time = localtime_r(&finishTime, &_time); - int32 year = time->tm_year + 1900; - char timeText[32]; - // TODO: Localization of time string... - if (now < finishTime - kSecondsPerDay) { - // process is going to take more than a day! - snprintf(timeText, sizeof(timeText), "%0*d:%0*d %0*d/%0*d/%ld", - 2, time->tm_hour, 2, time->tm_min, - 2, time->tm_mon + 1, 2, time->tm_mday, year); + const BLocale* locale = BLocale::Default(); + if (finishTime - now > kSecondsPerDay) { + locale->FormatDateTime(timeText, sizeof(timeText), finishTime, + B_MEDIUM_DATE_FORMAT, B_MEDIUM_TIME_FORMAT); } else { - snprintf(timeText, sizeof(timeText), "%0*d:%0*d", - 2, time->tm_hour, 2, time->tm_min); + locale->FormatTime(timeText, sizeof(timeText), finishTime, + B_MEDIUM_TIME_FORMAT); } - finishTime -= now; - BString string(_FullTimeRemainingString(finishTime, timeText)); + BString string(_FullTimeRemainingString(now, finishTime, timeText)); *_width = StringWidth(string.String()); if (*_width > availableSpace) { string.SetTo(_ShortTimeRemainingString(timeText)); @@ -817,28 +811,18 @@ BStatusView::_ShortTimeRemainingString(const char* timeText) BString -BStatusView::_FullTimeRemainingString(time_t finishTime, const char* timeText) +BStatusView::_FullTimeRemainingString(time_t now, time_t finishTime, + const char* timeText) { + BDurationFormat formatter; BString buffer; - char finishStr[32]; - if (finishTime > kSecondsPerDay) { - buffer.SetTo(B_TRANSLATE("(Finish: %time - Over %finishtime " - "days left)")); - snprintf(finishStr, sizeof(finishStr), "%ld", - finishTime / kSecondsPerDay); - } else if (finishTime > 60 * 60) { - buffer.SetTo(B_TRANSLATE("(Finish: %time - Over %finishtime " - "hours left)")); - snprintf(finishStr, sizeof(finishStr), "%ld", - finishTime / (60 * 60)); - } else if (finishTime > 60) { - buffer.SetTo(B_TRANSLATE("(Finish: %time - %finishtime minutes " - "left)")); - snprintf(finishStr, sizeof(finishStr), "%ld", finishTime / 60); + BString finishStr; + if (finishTime - now > 60 * 60) { + buffer.SetTo(B_TRANSLATE("(Finish: %time - Over %finishtime left)")); + formatter.Format(now * 1000000LL, finishTime * 1000000LL, &finishStr); } else { - buffer.SetTo(B_TRANSLATE("(Finish: %time - %finishtime seconds " - "left)")); - snprintf(finishStr, sizeof(finishStr), "%ld", finishTime); + buffer.SetTo(B_TRANSLATE("(Finish: %time - %finishtime left)")); + formatter.Format(now * 1000000LL, finishTime * 1000000LL, &finishStr); } buffer.ReplaceFirst("%time", timeText); diff --git a/src/kits/tracker/StatusWindow.h b/src/kits/tracker/StatusWindow.h index bf3aa66bec..75019ad4c0 100644 --- a/src/kits/tracker/StatusWindow.h +++ b/src/kits/tracker/StatusWindow.h @@ -141,8 +141,8 @@ private: BString _TimeStatusString(float availableSpace, float* _width); BString _ShortTimeRemainingString(const char* timeText); - BString _FullTimeRemainingString(time_t finishTime, - const char* timeText); + BString _FullTimeRemainingString(time_t now, + time_t finishTime, const char* timeText); BStatusBar* fStatusBar; off_t fTotalSize; From edbfa1c70bca24f1d903e8bcfcabfa26014bc43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 20:52:52 +0000 Subject: [PATCH 517/702] * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42978 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Looper.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/kits/app/Looper.cpp b/src/kits/app/Looper.cpp index 9cd9e6e984..15f074a497 100644 --- a/src/kits/app/Looper.cpp +++ b/src/kits/app/Looper.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -9,8 +9,10 @@ * Axel Dörfler, axeld@pinc-software.de */ + /*! BLooper class spawns a thread that runs a message loop. */ + #include #include #include @@ -51,7 +53,7 @@ static BLocker sDebugPrintLocker("BLooper debug print"); #define FILTER_LIST_BLOCK_SIZE 5 #define DATA_BLOCK_SIZE 5 -// Globals --------------------------------------------------------------------- + using BPrivate::gDefaultTokens; using BPrivate::gLooperList; using BPrivate::BLooperList; @@ -63,7 +65,7 @@ enum { BLOOPER_HANDLER_BY_INDEX }; -static property_info gLooperPropInfo[] = { +static property_info sLooperPropInfo[] = { { "Handler", {}, @@ -622,7 +624,7 @@ BLooper::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, string comparisons -- which wouldn't tell the whole story anyway, because of the same name being used for multiple properties. */ - BPropertyInfo propertyInfo(gLooperPropInfo); + BPropertyInfo propertyInfo(sLooperPropInfo); uint32 data; status_t err = B_OK; const char* errMsg = ""; @@ -677,7 +679,7 @@ BLooper::GetSupportedSuites(BMessage* data) status_t status = data->AddString("suites", "suite/vnd.Be-looper"); if (status == B_OK) { - BPropertyInfo PropertyInfo(gLooperPropInfo); + BPropertyInfo PropertyInfo(sLooperPropInfo); status = data->AddFlat("messages", &PropertyInfo); if (status == B_OK) status = BHandler::GetSupportedSuites(data); From 8215661bb2811fb6166433a87fd09123e88ea2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 29 Oct 2011 21:00:07 +0000 Subject: [PATCH 518/702] Apply patch by 'mt' from ticket #7622 to localize the debug_server alert. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42979 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/debug/DebugServer.cpp | 15 +++++++++++---- src/servers/debug/Jamfile | 8 ++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/servers/debug/DebugServer.cpp b/src/servers/debug/DebugServer.cpp index b01da568bc..1c76cf7aab 100644 --- a/src/servers/debug/DebugServer.cpp +++ b/src/servers/debug/DebugServer.cpp @@ -16,9 +16,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -30,6 +32,9 @@ #define HANDOVER_USE_GDB 1 //#define HANDOVER_USE_DEBUGGER 1 +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "DebugServer" + #define USE_GUI true // define to false if the debug server shouldn't use GUI (i.e. an alert) @@ -605,14 +610,16 @@ TeamDebugHandler::_HandleMessage(DebugMessage *message) _NotifyAppServer(fTeam); _NotifyRegistrar(fTeam, true, false); - char buffer[1024]; - snprintf(buffer, sizeof(buffer), "The application:\n\n %s\n\n" + BString buffer( + B_TRANSLATE("The application:\n\n %app\n\n" "has encountered an error which prevents it from continuing. Haiku " - "will terminate the application and clean up.", fTeamInfo.args); + "will terminate the application and clean up.")); + buffer.ReplaceFirst("%app", fTeamInfo.args); // TODO: It would be nice if the alert would go away automatically // if someone else kills our teams. - BAlert *alert = new BAlert(NULL, buffer, "Debug", "OK", NULL, + BAlert *alert = new BAlert(NULL, buffer.String(), + B_TRANSLATE("Debug"), B_TRANSLATE("OK"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); int32 result = alert->Go(); kill = (result == 1); diff --git a/src/servers/debug/Jamfile b/src/servers/debug/Jamfile index 2e5c4b45a7..d643d8c425 100644 --- a/src/servers/debug/Jamfile +++ b/src/servers/debug/Jamfile @@ -15,4 +15,12 @@ Server debug_server libbe.so # Haiku libbe libdebug.so $(TARGET_LIBSTDC++) + $(HAIKU_LOCALE_LIBS) ; + +DoCatalogs debug_server : + x-vnd.Haiku-debug_server + : + DebugServer.cpp +; + From 78faf579e3a150606e30073b772fd9e29ea068b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 29 Oct 2011 21:01:33 +0000 Subject: [PATCH 519/702] Add english and french localization to debug_server. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42980 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/servers/debug/en.catkeys | 4 ++++ data/catalogs/servers/debug/fr.catkeys | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 data/catalogs/servers/debug/en.catkeys create mode 100644 data/catalogs/servers/debug/fr.catkeys diff --git a/data/catalogs/servers/debug/en.catkeys b/data/catalogs/servers/debug/en.catkeys new file mode 100644 index 0000000000..19feb96f61 --- /dev/null +++ b/data/catalogs/servers/debug/en.catkeys @@ -0,0 +1,4 @@ +1 english x-vnd.Haiku-debug_server 1035915338 +OK DebugServer OK +Debug DebugServer Debug +The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. diff --git a/data/catalogs/servers/debug/fr.catkeys b/data/catalogs/servers/debug/fr.catkeys new file mode 100644 index 0000000000..1333c11daa --- /dev/null +++ b/data/catalogs/servers/debug/fr.catkeys @@ -0,0 +1,4 @@ +1 french x-vnd.Haiku-debug_server 1035915338 +OK DebugServer OK +Debug DebugServer Déboguer +The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer L'application :\n\n %app\n\na rencontré une erreur l'empêchant de continuer. Haiku va fermer l'application et libérer ses ressources. From 78fcc847a2311f3fe8df9f6c6ba1ee4706c3fc66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 21:04:22 +0000 Subject: [PATCH 520/702] * Coding style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42981 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/LooperList.h | 109 ++++++++++++++++--------------- headers/private/app/TokenSpace.h | 54 ++++++++------- 2 files changed, 87 insertions(+), 76 deletions(-) diff --git a/headers/private/app/LooperList.h b/headers/private/app/LooperList.h index 0410ae3070..32b77a4c96 100644 --- a/headers/private/app/LooperList.h +++ b/headers/private/app/LooperList.h @@ -1,19 +1,20 @@ /* - * Copyright 2001-2007, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: * Erik Jaesler (erik@cgsoftware.com) */ -#ifndef LOOPERLIST_H -#define LOOPERLIST_H +#ifndef LOOPER_LIST_H +#define LOOPER_LIST_H +#include + #include #include #include -#include class BList; class BLooper; @@ -21,64 +22,68 @@ class BLooper; namespace BPrivate { + class BLooperList { - public: - BLooperList(); +public: + BLooperList(); - bool Lock(); - void Unlock(); - bool IsLocked(); + bool Lock(); + void Unlock(); + bool IsLocked(); - void AddLooper(BLooper* l); - bool IsLooperValid(const BLooper* l); - bool RemoveLooper(BLooper* l); - void GetLooperList(BList* list); - int32 CountLoopers(); - BLooper* LooperAt(int32 index); - BLooper* LooperForThread(thread_id tid); - BLooper* LooperForName(const char* name); - BLooper* LooperForPort(port_id port); + void AddLooper(BLooper* l); + bool IsLooperValid(const BLooper* l); + bool RemoveLooper(BLooper* l); + void GetLooperList(BList* list); + int32 CountLoopers(); + BLooper* LooperAt(int32 index); + BLooper* LooperForThread(thread_id tid); + BLooper* LooperForName(const char* name); + BLooper* LooperForPort(port_id port); - private: - struct LooperData { - LooperData(); - LooperData(BLooper* looper); - LooperData(const LooperData& rhs); - LooperData& operator=(const LooperData& rhs); +private: + struct LooperData { + LooperData(); + LooperData(BLooper* looper); + LooperData(const LooperData& rhs); + LooperData& operator=(const LooperData& rhs); - BLooper* looper; - }; + BLooper* looper; + }; + struct FindLooperPred { + FindLooperPred(const BLooper* loop) : looper(loop) {} + bool operator()(LooperData& Data); + const BLooper* looper; + }; + struct FindThreadPred { + FindThreadPred(thread_id tid) : thread(tid) {} + bool operator()(LooperData& Data); + thread_id thread; + }; + struct FindNamePred { + FindNamePred(const char* n) : name(n) {} + bool operator()(LooperData& Data); + const char* name; + }; + struct FindPortPred { + FindPortPred(port_id pid) : port(pid) {} + bool operator()(LooperData& Data); + port_id port; + }; - static bool EmptySlotPred(LooperData& Data); - struct FindLooperPred { - FindLooperPred(const BLooper* loop) : looper(loop) {;} - bool operator()(LooperData& Data); - const BLooper* looper; - }; - struct FindThreadPred { - FindThreadPred(thread_id tid) : thread(tid) {;} - bool operator()(LooperData& Data); - thread_id thread; - }; - struct FindNamePred { - FindNamePred(const char* n) : name(n) {;} - bool operator()(LooperData& Data); - const char* name; - }; - struct FindPortPred { - FindPortPred(port_id pid) : port(pid) {;} - bool operator()(LooperData& Data); - port_id port; - }; + static bool EmptySlotPred(LooperData& Data); + void AssertLocked(); - void AssertLocked(); - - BLocker fLock; - std::vector fData; +private: + BLocker fLock; + std::vector fData; }; + extern BLooperList gLooperList; + } // namespace BPrivate -#endif // LOOPERLIST_H + +#endif // LOOPER_LIST_H diff --git a/headers/private/app/TokenSpace.h b/headers/private/app/TokenSpace.h index c221d1de30..97798e2a33 100644 --- a/headers/private/app/TokenSpace.h +++ b/headers/private/app/TokenSpace.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -10,13 +10,12 @@ #define _TOKEN_SPACE_H -#include -#include -#include - #include #include +#include +#include + // token types as specified in targets #define B_PREFERRED_TOKEN -2 /* A little bird told me about this one */ @@ -30,38 +29,45 @@ namespace BPrivate { + class BDirectMessageTarget; class BTokenSpace : public BLocker { - public: - BTokenSpace(); - ~BTokenSpace(); +public: + BTokenSpace(); + ~BTokenSpace(); - int32 NewToken(int16 type, void* object); - bool SetToken(int32 token, int16 type, void* object); + int32 NewToken(int16 type, void* object); + bool SetToken(int32 token, int16 type, void* object); - bool RemoveToken(int32 token); - bool CheckToken(int32 token, int16 type) const; - status_t GetToken(int32 token, int16 type, void** _object) const; + bool RemoveToken(int32 token); + bool CheckToken(int32 token, int16 type) const; + status_t GetToken(int32 token, int16 type, + void** _object) const; - status_t SetHandlerTarget(int32 token, BDirectMessageTarget* target); - status_t AcquireHandlerTarget(int32 token, BDirectMessageTarget** _target); + status_t SetHandlerTarget(int32 token, + BDirectMessageTarget* target); + status_t AcquireHandlerTarget(int32 token, + BDirectMessageTarget** _target); - private: - struct token_info { - int16 type; - void* object; - BDirectMessageTarget* target; - }; - typedef std::map TokenMap; +private: + struct token_info { + int16 type; + void* object; + BDirectMessageTarget* target; + }; + typedef std::map TokenMap; - TokenMap fTokenMap; - int32 fTokenCount; + TokenMap fTokenMap; + int32 fTokenCount; }; + extern BTokenSpace gDefaultTokens; + } // namespace BPrivate + #endif // _TOKEN_SPACE_H From ef88976995d531bab82cce00f0badfb65faa271a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 21:17:59 +0000 Subject: [PATCH 521/702] * Reinitialize global locks after a fork (at least those in the Application Kit). * This should fix #5668. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42982 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/LooperList.h | 2 ++ headers/private/app/TokenSpace.h | 2 ++ src/kits/app/InitTerminateLibBe.cpp | 6 +++++- src/kits/app/LooperList.cpp | 10 +++++++++- src/kits/app/TokenSpace.cpp | 11 ++++++++++- 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/headers/private/app/LooperList.h b/headers/private/app/LooperList.h index 32b77a4c96..7bdc8244e4 100644 --- a/headers/private/app/LooperList.h +++ b/headers/private/app/LooperList.h @@ -41,6 +41,8 @@ public: BLooper* LooperForName(const char* name); BLooper* LooperForPort(port_id port); + void InitAfterFork(); + private: struct LooperData { LooperData(); diff --git a/headers/private/app/TokenSpace.h b/headers/private/app/TokenSpace.h index 97798e2a33..a3aacef566 100644 --- a/headers/private/app/TokenSpace.h +++ b/headers/private/app/TokenSpace.h @@ -51,6 +51,8 @@ public: status_t AcquireHandlerTarget(int32 token, BDirectMessageTarget** _target); + void InitAfterFork(); + private: struct token_info { int16 type; diff --git a/src/kits/app/InitTerminateLibBe.cpp b/src/kits/app/InitTerminateLibBe.cpp index 1d4b527959..6d5b017523 100644 --- a/src/kits/app/InitTerminateLibBe.cpp +++ b/src/kits/app/InitTerminateLibBe.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -12,8 +12,10 @@ #include #include +#include #include #include +#include // debugging @@ -28,6 +30,8 @@ initialize_forked_child() DBG(OUT("initialize_forked_child()\n")); BMessage::Private::StaticReInitForkedChild(); + BPrivate::gLooperList.InitAfterFork(); + BPrivate::gDefaultTokens.InitAfterFork(); DBG(OUT("initialize_forked_child() done\n")); } diff --git a/src/kits/app/LooperList.cpp b/src/kits/app/LooperList.cpp index f8844a2451..e27460a646 100644 --- a/src/kits/app/LooperList.cpp +++ b/src/kits/app/LooperList.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -187,6 +187,14 @@ BLooperList::LooperForPort(port_id port) } +void +BLooperList::InitAfterFork() +{ + // We need to reinitialize the locker to get a new semaphore + new (&fLock) BLocker("BLooperList lock"); +} + + bool BLooperList::EmptySlotPred(LooperData& data) { diff --git a/src/kits/app/TokenSpace.cpp b/src/kits/app/TokenSpace.cpp index 2ab3f85ea6..d1dec451a6 100644 --- a/src/kits/app/TokenSpace.cpp +++ b/src/kits/app/TokenSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -169,4 +169,13 @@ BTokenSpace::AcquireHandlerTarget(int32 token, BDirectMessageTarget** _target) return B_OK; } + +void +BTokenSpace::InitAfterFork() +{ + // We need to reinitialize the locker to get a new semaphore + new (this) BTokenSpace(); +} + + } // namespace BPrivate From 526bbce9a51c00efb4c177dbe86dc2ffc8d4b007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 29 Oct 2011 21:30:22 +0000 Subject: [PATCH 522/702] Actually, no need to keep the english strings around, they are automatically generated. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42983 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/servers/debug/en.catkeys | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 data/catalogs/servers/debug/en.catkeys diff --git a/data/catalogs/servers/debug/en.catkeys b/data/catalogs/servers/debug/en.catkeys deleted file mode 100644 index 19feb96f61..0000000000 --- a/data/catalogs/servers/debug/en.catkeys +++ /dev/null @@ -1,4 +0,0 @@ -1 english x-vnd.Haiku-debug_server 1035915338 -OK DebugServer OK -Debug DebugServer Debug -The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. From 1326b9d0b48dd37031ac17a31f77f092fd2afd73 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 29 Oct 2011 21:51:43 +0000 Subject: [PATCH 523/702] Apply the patch by jscipione on ticket #7994. * Update BScreen class style and variable names * Remove documentation from Screen.cpp file * Create Screen.dox documentation file git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42984 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/Doxyfile | 1 + docs/user/interface/Screen.dox | 640 +++++++++++++++++++++++++++++++++ headers/os/interface/Screen.h | 12 +- src/kits/interface/Screen.cpp | 231 ++---------- 4 files changed, 679 insertions(+), 205 deletions(-) create mode 100644 docs/user/interface/Screen.dox diff --git a/docs/user/Doxyfile b/docs/user/Doxyfile index 70b2a7bd50..a1a1e41373 100644 --- a/docs/user/Doxyfile +++ b/docs/user/Doxyfile @@ -488,6 +488,7 @@ INPUT = . \ ../../headers/os/interface/Layout.h \ ../../headers/os/interface/LayoutBuilder.h \ ../../headers/os/interface/LayoutItem.h \ + ../../headers/os/interface/Screen.h \ ../../headers/os/interface/TwoDimensionalLayout.h \ ../../headers/os/locale \ ../../headers/os/midi2 \ diff --git a/docs/user/interface/Screen.dox b/docs/user/interface/Screen.dox new file mode 100644 index 0000000000..d8eb5cd994 --- /dev/null +++ b/docs/user/interface/Screen.dox @@ -0,0 +1,640 @@ +/* + * Copyright 2011, Haiku inc. + * Distributed under the terms of the MIT Licence. + * + * Documentation by: + * Stefano Ceccherini, burton666@libero.it + * Axel Dörfler, axeld@pinc-software.de + * John Scipione, jscipione@gmail.com + * Corresponds to: + * /trunk/headers/os/interface/Screen.h rev 42759 + * /trunk/src/kits/interface/Screen.cpp rev 42759 + */ + + +/*! + \file Screen.h + \brief Defines the BScreen class and support structures. +*/ + + +/*! + \class BScreen + \ingroup interface + \brief The BScreen class provides methods to retrieve and change display + settings. + + Each BScreen object describes one display connected to the computer. + Multiple BScreen objects can represent the same physical display. + + \attention Haiku currently supports only a single display. The main + screen with id \c B_MAIN_SCREEN_ID contains the origin in its top left + corner. Additional displays, when they become supported, will extend + the coordinates of the main screen. + + Some utility methods provided by this class are ColorSpace() to get the + color space of the screen, Frame() to get the frame rectangle, and ID() + to get the identifier of the screen. + + Methods to convert between 8-bit and 32-bit colors are provided by + IndexForColor() and ColorForIndex(). + + You can also use this class to take a screenshot of the entire screen or + a particular portion of it. To take a screenshot use either the GetBitmap() + or ReadBitmap() method. + + Furthermore, you can use this class get and set the background color of a + workspace. To get the background color call DesktopColor() or to set the + background color use SetDesktopColor(). + + This class provides methods to get and set the resolution, pixel depth, + and color map of a display. To get a list of the display modes supported + by the graphics card use the GetModeList() method. You can get and set + the screen resolution by calling the GetMode() and SetMode() methods. + The color map of the display can be retrieved by calling the ColorMap() + method. + + You can use this class to get information about the graphics card and + monitor connected to the computer by calling the GetDeviceInfo() and + GetMonitorInfo() methods. + + VESA Display Power Management Signaling support allow you to put the + monitor into a low-power mode. Call DPMSCapabilites() to check what + modes are supported by your monitor. DPMSState() tells you what state + your monitor is currently in and SetDPMS() allows you to change it. +*/ + + +/*! + \fn BScreen::BScreen(screen_id id) + \brief Creates a BScreen object which represents the display + connected to the computer with the given screen_id. + + In the current implementation, there is only one display + (\c B_MAIN_SCREEN_ID). To be sure that the object was constructed + correctly, call IsValid(). + + \param id The screen_id of the screen to create a BScreen object from. +*/ + + +/*! + \fn BScreen::BScreen(BWindow* window) + \brief Creates a BScreen object which represents the display that + contains \a window. + + In the current implementation, there is only one display + (\c B_MAIN_SCREEN_ID). To be sure that the object was constructed + correctly, call IsValid(). + + \param window A BWindow object. +*/ + + +/*! + \fn BScreen::~BScreen() + \brief Frees the resources used by the BScreen object and unlocks the + screen. + + \note The main screen object will never go away, even if you disconnect + all monitors. +*/ + + +/*! + \name Utility Methods +*/ + + +//! @{ + + +/*! + \fn bool BScreen::IsValid() + \brief Checks that the BScreen object represents a real display that is + connected to the computer. + + \return \c true if the BScreen object is valid, \c false otherwise. +*/ + + +/*! + \fn status_t BScreen::SetToNext() + \brief Sets the BScreen object to the next display in the screen list. + + \return \c B_OK if successful, otherwise \c B_ERROR. +*/ + + +/*! \fn color_space BScreen::ColorSpace() + \brief Gets the color_space of the display. + + \return \c B_CMAP8, \c B_RGB15, \c B_RGB32, or \c B_NO_COLOR_SPACE + if the BScreen object is invalid. +*/ + + +/*! + \fn BRect BScreen::Frame() + \brief Gets the frame of the screen in the screen's coordinate system. + + For example if the BScreen object points to the main screen with a + resolution of 1,366x768 then this method returns + BRect(0.0, 0.0, 1365.0, 767.0). If the BScreen object is invalid then + this method returns an empty rectangle i.e. BRect(0.0, 0.0, 0.0, 0.0) + + You can set the frame programmatically by calling the SetMode() method. + + \return a BRect frame of the screen in the screen's coordinate system. +*/ + + +/*! + \fn screen_id BScreen::ID() + \brief Gets the identifier of the display. + + In the current implementation this method returns \c B_MAIN_SCREEN_ID + even if the object is invalid. + + \return A screen_id that identifies the screen. +*/ + + +/*! + \fn status_t BScreen::WaitForRetrace() + \brief Blocks until the monitor has finished its current vertical retrace. + + \return \c B_OK or \c B_ERROR if the screen object is invalid. +*/ + + +/*! + \fn status_t BScreen::WaitForRetrace(bigtime_t timeout) + \brief Blocks until the monitor has finished its current vertical retrace + or until \a timeout has expired. + + \param timeout The amount of time to wait before returning. + + \return \c B_OK if the monitor has retraced in the given \a timeout + duration, \c B_ERROR otherwise. +*/ + + +//! @} + + +/*! + \name Color Methods +*/ + + +//! @{ + + +/*! + \fn inline uint8 BScreen::IndexForColor(rgb_color color) + \brief Gets the 8-bit color index that most closely matches a + 32-bit \a color. + + \param color The 32-bit \a color to get the 8-bit index of. + + \return An 8-bit color index in the screen's color_map. +*/ + + +/*! + \fn uint8 BScreen::IndexForColor(uint8 red, uint8 green, uint8 blue, + uint8 alpha) + \brief Gets the 8-bit color index that most closely matches a set of + \a red, \a green, \a blue, and \a alpha values. + + \param red The \a red value. + \param green The \a green value. + \param blue The \a blue value. + \param alpha The \a alpha value. + + \return An 8-bit color index in the screen's color_map. +*/ + + +/*! + \fn rgb_color BScreen::ColorForIndex(const uint8 index) + \brief Gets the 32-bit color representation of an 8-bit color \a index. + + \param index The 8-bit color \a index to convert to a 32-bit color. + + \return A 32-bit rgb_color structure. +*/ + + +/*! + \fn uint8 BScreen::InvertIndex(uint8 index) + \brief Gets the "Inversion" of an 8-bit color \a index. + + Inverted colors are useful for highlighting. + + \param index The 8-bit color \a index. + + \return An 8-bit color \a index that represents the "Inversion" of the + given color in the screen's color_map. +*/ + + +/*! + \fn const color_map* BScreen::ColorMap() + \brief Gets the color_map of the BScreen. + + \return A pointer to the BScreen object's color_map. +*/ + + +//! @} + + +/*! + \name Bitmap Methods +*/ + + +//! @{ + + +/*! + \fn status_t BScreen::GetBitmap(BBitmap** _bitmap, bool drawCursor, + BRect* bounds) + \brief Allocates a BBitmap and copies the contents of the screen into it. + + \note GetBitmap() will allocate a BBitmap object for you while + ReadBitmap() requires you to pre-allocate a BBitmap object first. + + \note The caller is responsible for freeing the BBitmap object. + + \param _bitmap A pointer to a BBitmap pointer where this method will + store the contents of the display. + \param drawCursor Specifies whether or not to draw the cursor. + \param bounds Specifies the screen area that you want copied. If + \a bounds is \c NULL then the entire screen is copied. + + \return \c B_OK if the operation was successful, \c B_ERROR otherwise. +*/ + + +/*! + \fn status_t BScreen::ReadBitmap(BBitmap* bitmap, bool drawCursor, + BRect* bounds) + \brief Copies the contents of the screen into a BBitmap. + + \note ReadBitmap() requires you to pre-allocate a BBitmap object first, + while GetBitmap() will allocate a BBitmap object for you. + + \param bitmap A pointer to a pre-allocated BBitmap where this + method will store the contents of the display. + \param drawCursor Specifies whether or not to draw the cursor. + \param bounds Specifies the screen area that you want copied. If + \a bounds is \c NULL then the entire screen is copied. + + \return \c B_OK if the operation was successful, \c B_ERROR otherwise. +*/ + + +//! @} + + +/*! + \name Desktop Color Methods +*/ + + +//! @{ + + +/*! + \fn rgb_color BScreen::DesktopColor() + \brief Gets the background color of the current workspace. + + \return A 32-bit rgb_color structure containing the background color + of the current workspace. +*/ + + +/*! + \fn rgb_color BScreen::DesktopColor(uint32 workspace) + \brief Gets the background color of the specified \a workspace. + + \param workspace The \a workspace index to get the desktop background + color of. + + \return An 32-bit rgb_color structure containing the background color + of the specified \a workspace. +*/ + + +/*! + \fn void BScreen::SetDesktopColor(rgb_color color, bool stick) + \brief Set the background \a color of the current workspace. + + \param color The 32-bit \a color to paint the desktop background. + \param stick Whether or not the \a color will stay after a reboot. +*/ + + +/*! + \fn void BScreen::SetDesktopColor(rgb_color color, uint32 workspace, + bool stick) + \brief Set the background \a color of the specified \a workspace. + + \param color The 32-bit \a color to paint the desktop background. + \param workspace The \a workspace index to update. + \param stick Whether or not the \a color will stay after a reboot. +*/ + + +//! @} + + +/*! + \name Display Mode Methods + + The following methods retrieve and alter the display_mode structure + of a screen. The display_mode structure contains screen size, + pixel depth, and display timings settings. +*/ + + +//! @{ + + +/*! + \fn status_t BScreen::ProposeMode(display_mode* target, + const display_mode* low, + const display_mode* high) + \brief Adjust the \a target mode to make it a supported mode. + + The list of supported modes for the graphics card is supplied by + the GetModeList() method. + + \param target The mode you want adjust. + \param low The lower display mode limit. + \param high The higher display mode limit. + + \retval B_OK if \a target is supported and falls within the + \a low and \a high limits. + \retval B_BAD_VALUE if \a target is supported but does not + fall within the \a low and \a high limits. + \retval B_ERROR if the target mode isn't supported. +*/ + + +/*! + \fn status_t BScreen::GetModeList(display_mode** _modeList, uint32* _count) + \brief Allocates and returns a list of the display modes supported by the + graphics card into \a _modeList. + + \warning The monitor may not be able to display all of the modes that + GetModeList() retrieves. + + \note The caller is responsible for freeing the display_mode object. + + \param _modeList A pointer to a display_mode pointer, where the function + will allocate an array of display_mode structures. + \param _count A pointer to an integer used to store the count of + available display modes. + + \retval B_OK if the operation was successful. + \retval B_ERROR if \a modeList or \a count is invalid. + \retval B_ERROR for all other errors. +*/ + + +/*! + \fn status_t BScreen::GetMode(display_mode* mode) + \brief Fills out the display_mode struct from the current workspace. + + \param mode A pointer to a display_mode struct to copy into. + + \retval B_OK if the operation was successful. + \retval B_BAD_VALUE if \a mode is invalid. + \retval B_ERROR for all other errors. +*/ + + +/*! + \fn status_t BScreen::GetMode(uint32 workspace, display_mode* mode) + \brief Fills out the display_mode struct from the specified + \a workspace. + + \param workspace The index of the \a workspace to query. + \param mode A pointer to a display_mode structure to copy into. + + \retval B_OK if the operation was successful + \retval B_BAD_VALUE if \a mode is invalid. + \retval B_ERROR for all other errors. +*/ + + +/*! + \fn status_t BScreen::SetMode(display_mode* mode, bool makeDefault) + \brief Sets the screen in the current workspace to the given \a mode. + + \param mode A pointer to a display_mode struct. + \param makeDefault Whether or not \a mode is set as the default. + + \return \c B_OK if the operation was successful, \c B_ERROR otherwise. +*/ + + +/*! + \fn status_t BScreen::SetMode(uint32 workspace, display_mode* mode, + bool makeDefault) + \brief Set the screen in the specified \a workspace to the given \a mode. + + \param workspace The index of the workspace to set the \a mode of. + \param mode A pointer to a display_mode struct. + \param makeDefault Whether or not the \a mode is set as the default + for the specified \a workspace. + + \return \c B_OK if the operation was successful, \c B_ERROR otherwise. +*/ + + +//! @} + + +/*! + \name Display and Graphics Card Info Methods +*/ + + +//! @{ + + +/*! + \fn status_t BScreen::GetDeviceInfo(accelerant_device_info* info) + \brief Fills out the \a info struct with information about a graphics card. + + \param info An accelerant_device_info struct to store the device + \a info. + + \retval B_OK if the operation was successful. + \retval B_BAD_VALUE if \a info is invalid. + \retval B_ERROR for all other errors. +*/ + + +/*! + \fn status_t BScreen::GetMonitorInfo(monitor_info* info) + \brief Fills out the \a info struct with information about a monitor. + + \param info A monitor_info struct to store the monitor \a info. + + \retval B_OK if the operation was successful. + \retval B_BAD_VALUE if \a info is invalid. + \retval B_ERROR for all other errors. +*/ + + +/*! + \fn status_t BScreen::GetPixelClockLimits(display_mode* mode, + uint32* _low, uint32* _high) + \brief Gets the minimum and maximum pixel clock rates that are possible + for the specified \a mode. + + \param mode A pointer to a display_mode structure. + \param _low A pointer to a uint32 where the method stores the lowest + available pixel clock. + \param _high A pointer to a uint32 where the method stores the highest + available pixel clock. + + \retval B_OK if the operation was successful. + \retval B_BAD_VALUE if \a mode, \a low, or \a high is invalid. + \retval B_ERROR for all other errors. +*/ + + +/*! + \fn status_t BScreen::GetTimingConstraints(display_timing_constraints* + constraints) + \brief Fills out the \a constraints structure with the timing constraints + of the current display mode. + + \param constraints A pointer to a display_timing_constraints structure + to store the timing constraints. + + \retval B_OK if the operation was successful. + \retval B_BAD_VALUE if \a constraints is invalid. + \retval B_ERROR for all other errors. +*/ + + +//! @} + + +/*! + \name VESA Display Power Management Signaling Settings + + VESA Display Power Management Signaling (or DPMS) is a standard from the + VESA consortium for managing the power usage of displays through the + graphics card. DPMS allows you to shut off the display after the computer + has been unused for some time to save power. + + DPMS states include: + - \c B_DPMS_ON Normal display operation. + - \c B_DPMS_STAND_BY Image not visible normal operation and returns to + normal after ~1 second. + - \c B_DPMS_SUSPEND Image not visible, returns to normal after ~5 + seconds. + - \c B_DPMS_OFF Image not visible, display is off except for power to + monitoring circuitry. Returns to normal after ~8-20 seconds. + + Power usage in each of the above states depends on the monitor used. CRT + monitors typically receive larger power savings than LCD monitors in + low-power states. +*/ + + +//! @{ + + +/*! + \fn status_t BScreen::SetDPMS(uint32 dpmsState) + \brief Sets the VESA Display Power Management Signaling (DPMS) state for + the display. + + \param dpmsState The DPMS state to set. + valid values are: + - \c B_DPMS_ON + - \c B_DPMS_STAND_BY + - \c B_DPMS_SUSPEND + - \c B_DPMS_OFF + + \return \c B_OK if the operation was successful, otherwise an error code. +*/ + + +/*! + \fn uint32 BScreen::DPMSState() + \brief Gets the current VESA Display Power Management Signaling (DPMS) + state of the screen. + + \return The current VESA Display Power Management Signaling (DPMS) state + of the display or 0 in the case of an error. +*/ + + + +/*! + \fn uint32 BScreen::DPMSCapabilites() + \brief Gets the VESA Display Power Management Signaling (DPMS) + modes that the display supports as a bit mask. + + - \c B_DPMS_ON is worth 1 + - \c B_DPMS_STAND_BY is worth 2 + - \c B_DPMS_SUSPEND is worth 4 + - \c B_DPMS_OFF is worth 8 + + \return A bit mask of the VESA Display Power Management Signaling (DPMS) + modes that the display supports or 0 in the case of an error. +*/ + + +//! @} + + +/*! + \name Deprecated methods +*/ + + +//! @{ + + +/*! + \fn BPrivate::BPrivateScreen* BScreen::private_screen() + \brief Returns the BPrivateScreen used by the BScreen object. + + \return A pointer to the BPrivateScreen class internally used by the BScreen + object. +*/ + + +/*! + \fn status_t BScreen::ProposeDisplayMode(display_mode* target, + const display_mode* low, + const display_mode* high) + \brief Deprecated, use ProposeMode() instead. +*/ + + +/*! + \fn void* BScreen::BaseAddress() + \brief Returns the base address of the frame buffer. +*/ + + +/*! + \fn uint32 BScreen::BytesPerRow() + \brief Returns the bytes per row of the frame buffer. +*/ + + +//! @} diff --git a/headers/os/interface/Screen.h b/headers/os/interface/Screen.h index 58cb2e4147..b1479d9b40 100644 --- a/headers/os/interface/Screen.h +++ b/headers/os/interface/Screen.h @@ -52,20 +52,20 @@ public: BRect* frame = NULL); rgb_color DesktopColor(); - rgb_color DesktopColor(uint32 index); + rgb_color DesktopColor(uint32 workspace); void SetDesktopColor(rgb_color color, - bool makeDefault = true); + bool stick = true); void SetDesktopColor(rgb_color color, - uint32 index, bool makeDefault = true); + uint32 workspace, bool stick = true); status_t ProposeMode(display_mode* target, const display_mode* low, const display_mode* high); status_t GetModeList(display_mode** _modeList, uint32* _count); - status_t GetMode(display_mode* _mode); + status_t GetMode(display_mode* mode); status_t GetMode(uint32 workspace, - display_mode* _mode); + display_mode* mode); status_t SetMode(display_mode* mode, bool makeDefault = false); status_t SetMode(uint32 workspace, @@ -74,7 +74,7 @@ public: status_t GetDeviceInfo(accelerant_device_info* info); status_t GetMonitorInfo(monitor_info* info); status_t GetPixelClockLimits(display_mode* mode, - uint32* low, uint32* high); + uint32* _low, uint32* _high); status_t GetTimingConstraints( display_timing_constraints* timingConstraints); diff --git a/src/kits/interface/Screen.cpp b/src/kits/interface/Screen.cpp index 7c75a55373..0bb4feff6f 100644 --- a/src/kits/interface/Screen.cpp +++ b/src/kits/interface/Screen.cpp @@ -8,9 +8,6 @@ */ -/*! BScreen lets you retrieve and change the display settings. */ - - #include #include @@ -21,41 +18,24 @@ using namespace BPrivate; -/*! \brief Creates a BScreen object which represents the display with the given - screen_id - \param id The screen_id of the screen to get. - - In the current implementation, there is only one display (B_MAIN_SCREEN_ID). - To be sure that the object was correctly constructed, call IsValid(). -*/ BScreen::BScreen(screen_id id) { fScreen = BPrivateScreen::Get(id.id); } -/*! \brief Creates a BScreen object which represents the display which contains - the given BWindow. - \param window A BWindow. -*/ BScreen::BScreen(BWindow* window) { fScreen = BPrivateScreen::Get(window); } -/*! \brief Releases the resources allocated by the constructor. -*/ BScreen::~BScreen() { BPrivateScreen::Put(fScreen); } -/*! \brief Checks if the BScreen object represents a real screen connected to - the computer. - \return \c true if the BScreen object is valid, \c false if not. -*/ bool BScreen::IsValid() { @@ -63,9 +43,6 @@ BScreen::IsValid() } -/*! \brief In the current implementation, this function always returns B_ERROR. - \return Always \c B_ERROR. -*/ status_t BScreen::SetToNext() { @@ -80,38 +57,26 @@ BScreen::SetToNext() } -/*! \brief Returns the color space of the screen display. - \return \c B_CMAP8, \c B_RGB15, or \c B_RGB32, or \c B_NO_COLOR_SPACE - if the screen object is invalid. -*/ color_space BScreen::ColorSpace() { if (fScreen != NULL) return fScreen->ColorSpace(); + return B_NO_COLOR_SPACE; } -/*! \brief Returns the rectangle that locates the screen in the screen - coordinate system. - \return a BRect that locates the screen in the screen coordinate system. -*/ BRect BScreen::Frame() { if (fScreen != NULL) return fScreen->Frame(); + return BRect(0, 0, 0, 0); } -/*! \brief Returns the identifier for the screen. - \return A screen_id struct that identifies the screen. - - In the current implementation, this function always returns - \c B_MAIN_SCREEN_ID, even if the object is invalid. -*/ screen_id BScreen::ID() { @@ -124,9 +89,6 @@ BScreen::ID() } -/*! \brief Blocks until the monitor has finished the current vertical retrace. - \return \c B_OK, or \c B_ERROR if the screen object is invalid. -*/ status_t BScreen::WaitForRetrace() { @@ -134,119 +96,76 @@ BScreen::WaitForRetrace() } -/*! \brief Blocks until the monitor has finished the current vertical retrace, - or until the given timeout has passed. - \param timeout A bigtime_t which indicates the time to wait before - returning. - \return \c B_OK if the monitor has retraced in the given amount of time, - \c B_ERROR otherwise. -*/ status_t BScreen::WaitForRetrace(bigtime_t timeout) { if (fScreen != NULL) return fScreen->WaitForRetrace(timeout); + return B_ERROR; } -/*! \brief Returns the index of the 8-bit color that, - most closely matches the given 32-bit color. - \param r The red value for a 32-bit color. - \param g The green value for a 32-bit color. - \param b The blue value for a 32-bit color. - \param a The alpha value for a 32-bit color. - \return An index for a 8-bit color in the screen's color map. -*/ uint8 -BScreen::IndexForColor(uint8 r, uint8 g, uint8 b, uint8 a) +BScreen::IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha) { if (fScreen != NULL) - return fScreen->IndexForColor(r, g, b, a); + return fScreen->IndexForColor(red, green, blue, alpha); + return 0; } -/*! \brief Returns the 32-bit color representation of a given 8-bit color index. - \param index The 8-bit color index to convert. - \return A rgb_color struct which represents the given 8-bit color index. -*/ rgb_color BScreen::ColorForIndex(const uint8 index) { if (fScreen != NULL) return fScreen->ColorForIndex(index); + return rgb_color(); } -/*! \brief Returns the "inversion" of the given 8-bit color. - \param index An 8-bit color index. - \return An 8-bit color index that represents the "inversion" of the given - color. -*/ uint8 BScreen::InvertIndex(uint8 index) { if (fScreen != NULL) return fScreen->InvertIndex(index); + return 0; } -/*! \brief Returns the color map of the current display. - \return A pointer to the object's color_map. -*/ const color_map* BScreen::ColorMap() { if (fScreen != NULL) return fScreen->ColorMap(); + return NULL; } -/*! \brief Copies the screen's contents into the first argument BBitmap. - \param screen_shot A pointer to a BBitmap pointer, where the function will - allocate a BBitmap for you. - \param draw_cursor Specifies if you want the cursor to be drawn. - \param bound Let you specify the area you want copied. If it's NULL, the - entire screen is copied. - \return \c B_OK if the operation was succesful, \c B_ERROR on failure. -*/ status_t BScreen::GetBitmap(BBitmap** _bitmap, bool drawCursor, BRect* bounds) { if (fScreen != NULL) return fScreen->GetBitmap(_bitmap, drawCursor, bounds); + return B_ERROR; } -/*! \brief Copies the screen's contents into the first argument BBitmap. - \param screen_shot A pointer to an allocated BBitmap, where the function - will store the screen's content. - \param draw_cursor Specifies if you want the cursor to be drawn. - \param bound Let you specify the area you want copied. If it's NULL, the - entire screen is copied. - \return \c B_OK if the operation was succesful, \c B_ERROR on failure. - - The only difference between this method and GetBitmap() is that ReadBitmap - requires you to allocate a BBitmap, while the latter will allocate a BBitmap - for you. -*/ status_t -BScreen::ReadBitmap(BBitmap* buffer, bool drawCursor, BRect* bounds) +BScreen::ReadBitmap(BBitmap* bitmap, bool drawCursor, BRect* bounds) { if (fScreen != NULL) - return fScreen->ReadBitmap(buffer, drawCursor, bounds); + return fScreen->ReadBitmap(bitmap, drawCursor, bounds); + return B_ERROR; } -/*! \brief Returns the color of the desktop. - \return An rgb_color structure which is the color of the desktop. -*/ rgb_color BScreen::DesktopColor() { @@ -257,11 +176,6 @@ BScreen::DesktopColor() } -/*! \brief Returns the color of the desktop in the given workspace. - \param workspace The workspace of which you want to have the color. - \return An rgb_color structure which is the color of the desktop in the - given workspace. -*/ rgb_color BScreen::DesktopColor(uint32 workspace) { @@ -272,139 +186,89 @@ BScreen::DesktopColor(uint32 workspace) } -/*! \brief Set the color of the desktop. - \param rgb The color you want to paint the desktop background. - \param stick If you pass \c true here, the color will be maintained across - boots. -*/ void -BScreen::SetDesktopColor(rgb_color rgb, bool stick) +BScreen::SetDesktopColor(rgb_color color, bool stick) { if (fScreen != NULL) - fScreen->SetDesktopColor(rgb, B_CURRENT_WORKSPACE_INDEX, stick); + fScreen->SetDesktopColor(color, B_CURRENT_WORKSPACE_INDEX, stick); } -/*! \brief Set the color of the desktop in the given workspace. - \param rgb The color you want to paint the desktop background. - \param index The workspace you want to change the color. - \param stick If you pass \c true here, the color will be maintained across - boots. -*/ void -BScreen::SetDesktopColor(rgb_color rgb, uint32 index, bool stick) +BScreen::SetDesktopColor(rgb_color color, uint32 workspace, bool stick) { if (fScreen != NULL) - fScreen->SetDesktopColor(rgb, index, stick); + fScreen->SetDesktopColor(color, workspace, stick); } -/*! \brief Attempts to adjust the supplied mode so that it's a supported mode. - \param target The mode you want to be adjusted. - \param low The lower limit you want target to be adjusted. - \param high The higher limit you want target to be adjusted. - \return - - \c B_OK if target (as returned) is supported and falls into the - limits. - - \c B_BAD_VALUE if target (as returned) is supported but doesn't fall - into the limits. - - \c B_ERROR if target isn't supported. -*/ status_t BScreen::ProposeMode(display_mode* target, const display_mode* low, const display_mode* high) { if (fScreen != NULL) return fScreen->ProposeMode(target, low, high); + return B_ERROR; } -/*! \brief allocates and returns a list of the display_modes - that the graphics card supports. - \param mode_list A pointer to a mode_list pointer, where the function will - allocate an array of display_mode structures. - \param count A pointer to an integer, where the function will store the - amount of available display modes. - \return \c B_OK. -*/ status_t BScreen::GetModeList(display_mode** _modeList, uint32* _count) { if (fScreen != NULL) return fScreen->GetModeList(_modeList, _count); + return B_ERROR; } -/*! \brief Copies the current display_mode into mode. - \param mode A pointer to a display_mode structure, - where the current display_mode will be copied. - \return \c B_OK if the operation was succesful. -*/ status_t BScreen::GetMode(display_mode* mode) { if (fScreen != NULL) return fScreen->GetMode(B_CURRENT_WORKSPACE_INDEX, mode); + return B_ERROR; } -/*! \brief Copies the current display_mode of the given workspace into mode. - \param workspace The index of the workspace to query. - \param mode A pointer to a display_mode structure, - where the current display_mode will be copied. - \return \c B_OK if the operation was succesful. -*/ status_t BScreen::GetMode(uint32 workspace, display_mode* mode) { if (fScreen != NULL) return fScreen->GetMode(workspace, mode); + return B_ERROR; } -/*! \brief Set the screen to the given mode. - \param mode A pointer to a display_mode. - \param makeDefault If true, the mode becomes the default for the screen. - \return \c B_OK. -*/ status_t BScreen::SetMode(display_mode* mode, bool makeDefault) { if (fScreen != NULL) return fScreen->SetMode(B_CURRENT_WORKSPACE_INDEX, mode, makeDefault); + return B_ERROR; } -/*! \brief Set the given workspace to the given mode. - \param workspace The index of the workspace that you want to change. - \param mode A pointer to a display_mode. - \param makeDefault If true, the mode becomes the default for the workspace. - \return \c B_OK. -*/ status_t BScreen::SetMode(uint32 workspace, display_mode* mode, bool makeDefault) { if (fScreen != NULL) return fScreen->SetMode(workspace, mode, makeDefault); + return B_ERROR; } -/*! \brief Returns information about the graphics card. - \param info An accelerant_device_info struct where to store the retrieved - info. - \return \c B_OK if the operation went fine, otherwise an error code. -*/ status_t BScreen::GetDeviceInfo(accelerant_device_info* info) { if (fScreen != NULL) return fScreen->GetDeviceInfo(info); + return B_ERROR; } @@ -414,80 +278,57 @@ BScreen::GetMonitorInfo(monitor_info* info) { if (fScreen != NULL) return fScreen->GetMonitorInfo(info); + return B_ERROR; } -/*! \brief Returns, in low and high, the minimum and maximum pixel clock rates - that are possible for the given mode. - \param mode A pointer to a display_mode. - \param low A pointer to an int where the function will store the lowest - available pixel clock. - \param high A pointer to an int where the function wills tore the highest - available pixel clock. - \return \c B_OK if the operation went fine, otherwise an error code. -*/ status_t BScreen::GetPixelClockLimits(display_mode* mode, uint32* _low, uint32* _high) { if (fScreen != NULL) return fScreen->GetPixelClockLimits(mode, _low, _high); + return B_ERROR; } -/*! \brief Fills out the dtc structure with the timing constraints of the - current display mode. - \param dtc A pointer to a display_timing_constraints structure where the - function will store the timing constraints of the current mode. - \return \c B_OK if the operation went fine, otherwise an error code. -*/ status_t BScreen::GetTimingConstraints(display_timing_constraints* constraints) { if (fScreen != NULL) return fScreen->GetTimingConstraints(constraints); + return B_ERROR; } -/*! \brief Lets you set the VESA Display Power Management Signaling state for - the screen. - \param dpms_state The DPMS state you want to be set. - valid values are: - - \c B_DPMS_ON - - \c B_DPMS_STAND_BY - - \c B_DPMS_SUSPEND - - \c B_DPMS_OFF - \return \c B_OK if the operation went fine, otherwise an error code. -*/ status_t BScreen::SetDPMS(uint32 dpmsState) { if (fScreen != NULL) return fScreen->SetDPMS(dpmsState); + return B_ERROR; } -/*! \brief Returns the current DPMS state of the screen. -*/ uint32 BScreen::DPMSState() { if (fScreen != NULL) return fScreen->DPMSState(); + return 0; } -/*! \brief Indicates which DPMS modes the monitor supports. -*/ uint32 BScreen::DPMSCapabilites() { if (fScreen != NULL) return fScreen->DPMSCapabilites(); + return 0; } @@ -495,10 +336,6 @@ BScreen::DPMSCapabilites() // #pragma mark - Deprecated methods -/*! \brief Returns the BPrivateScreen used by the BScreen object. - \return A pointer to the BPrivateScreen class internally used by the BScreen - object. -*/ BPrivate::BPrivateScreen* BScreen::private_screen() { @@ -506,8 +343,6 @@ BScreen::private_screen() } -/*! \brief Deprecated, use ProposeMode() instead. -*/ status_t BScreen::ProposeDisplayMode(display_mode* target, const display_mode* low, const display_mode* high) @@ -516,23 +351,21 @@ BScreen::ProposeDisplayMode(display_mode* target, const display_mode* low, } -/*! \brief Returns the base address of the framebuffer. -*/ void* BScreen::BaseAddress() { if (fScreen != NULL) return fScreen->BaseAddress(); + return NULL; } -/*! \brief Returns the amount of bytes per row of the framebuffer. -*/ uint32 BScreen::BytesPerRow() { if (fScreen != NULL) return fScreen->BytesPerRow(); + return 0; } From 3c259863a6f800e52a6ddce59fead63f29f6ba2a Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sat, 29 Oct 2011 22:00:33 +0000 Subject: [PATCH 524/702] Now that we can have custom buildflags allow Haiku to build with -Os which needs some functions not only as defines. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42985 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/coreutils/lib/Jamfile | 1 + src/bin/network/wget/Jamfile | 1 + 2 files changed, 2 insertions(+) diff --git a/src/bin/coreutils/lib/Jamfile b/src/bin/coreutils/lib/Jamfile index 2497670775..e121489c2e 100644 --- a/src/bin/coreutils/lib/Jamfile +++ b/src/bin/coreutils/lib/Jamfile @@ -24,6 +24,7 @@ StaticLibrary libfetish.a : basename.c basename-lgpl.c buffer-lcm.c + c-ctype.c c-strcasecmp.c c-strtod.c c-strtold.c diff --git a/src/bin/network/wget/Jamfile b/src/bin/network/wget/Jamfile index ca2b06e309..7b970521f8 100644 --- a/src/bin/network/wget/Jamfile +++ b/src/bin/network/wget/Jamfile @@ -34,6 +34,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) src ] ; BinCommand wget : build_info.c + c-ctype.c cmpt.c connect.c convert.c From 7f1880dc0ed378e10f46bf7dd6d697dcf9ffd9fe Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 29 Oct 2011 22:02:52 +0000 Subject: [PATCH 525/702] Apply patch for ticket #8008: * Remove BNode documentation from the source code and add it to Node.dox * Rewrite some of the existing documents git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42986 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/Doxyfile | 1 + docs/user/book.dox | 6 +- docs/user/storage/Node.dox | 634 +++++++++++++++++++++++++++++++++++++ headers/os/storage/Node.h | 18 -- src/kits/storage/Node.cpp | 335 -------------------- 5 files changed, 639 insertions(+), 355 deletions(-) create mode 100644 docs/user/storage/Node.dox diff --git a/docs/user/Doxyfile b/docs/user/Doxyfile index a1a1e41373..7eb5b6d040 100644 --- a/docs/user/Doxyfile +++ b/docs/user/Doxyfile @@ -494,6 +494,7 @@ INPUT = . \ ../../headers/os/midi2 \ ../../headers/os/storage/AppFileInfo.h \ ../../headers/os/storage/FindDirectory.h \ + ../../headers/os/storage/Node.h \ ../../headers/os/support \ ../../headers/posix/syslog.h diff --git a/docs/user/book.dox b/docs/user/book.dox index d5d392e3ad..1b87f6d721 100644 --- a/docs/user/book.dox +++ b/docs/user/book.dox @@ -7,10 +7,10 @@ - \ref drivers - \ref interface | \link interface_intro \em Introduction \endlink - \ref locale | \link locale_intro \em Introduction \endlink - - \ref media | \link media_intro \em Introduction \endlink + - \ref media | \em Introduction - \ref midi1 - \ref midi2 | \link midi2_intro \em Introduction \endlink - - \ref storage | \link storage_intro \em Introduction \endlink + - \ref storage | \em Introduction - \ref support | \link support_intro \em Introduction \endlink \section notes General Notes and Information @@ -26,9 +26,11 @@ \defgroup drivers Drivers \defgroup interface Interface Kit \brief API for displaying a graphical user interface. + \defgroup media \defgroup midi2 MIDI 2 Kit \brief API for producing and consuming MIDI events. \defgroup libmidi2 (libmidi2.so) + \defgroup storage \defgroup support Support Kit \brief Collection of utility classes that are used throughout the API. \defgroup libbe (libbe.so) diff --git a/docs/user/storage/Node.dox b/docs/user/storage/Node.dox new file mode 100644 index 0000000000..861ac2dc94 --- /dev/null +++ b/docs/user/storage/Node.dox @@ -0,0 +1,634 @@ +/* + * Copyright 2002-2011, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Tyler Dauwalder, tylerdauwalder@users.sf.net + * John Scipione, jscipione@gmail.com + * Ingo Weinhold, bonefish@users.sf.net + * Corresponds to: + * /trunk/headers/os/app/Node.h rev 42803 + * /trunk/src/kits/app/Node.cpp rev 42803 + */ + + +/*! + \file Node.h + \brief Provides the BNode class and node_ref structure. +*/ + + +/*! + \struct node_ref + \brief Reference structure to a particular vnode on a device. +*/ + + +/*! + \fn node_ref::node_ref() + \brief Creates an uninitialized node_ref object. +*/ + + +/*! + \fn node_ref::node_ref(const node_ref &ref) + \brief Creates a copy of the given node_ref object. + + \param ref the node_ref to be copied. +*/ + + +/*! + \fn bool node_ref::operator==(const node_ref &ref) const + \brief Tests whether this node_ref and the supplied one are equal. + + \param ref the node_ref to be compared with. + + \return \c true, if the objects are equal, \c false otherwise. +*/ + + +/*! + \fn bool node_ref::operator!=(const node_ref &ref) const + \brief Tests whether this node_ref and the supplied one are not equal. + + \param ref the node_ref to be compared with. + + \return \c true, if the objects are \b not equal, \c false otherwise. +*/ + + +/*! + \fn node_ref& node_ref::operator=(const node_ref &ref) + \brief Makes this node ref a copy of the supplied one. + + \param ref the node_ref to be copied. + + \return a reference to this object. +*/ + + +/*! + \class BNode + \ingroup storage + \brief A BNode represents a chunk of data in the filesystem. + + The BNode class provides an interface for manipulating the data and + attributes belonging to filesystem entries. The BNode is unaware of the + name that refers to it in the filesystem (i.e. its entry), instead, a + BNode is concerned solely with the entry's data and attributes. +*/ + + +/*! + \var BNode::fFd + File descriptor for the given node. +*/ + + +/*! + \var BNode::fAttrFd + File descriptor for the attribute directory of the node. Initialized lazily. +*/ + + +/*! + \var BNode::fCStatus + The object's initialization status. +*/ + + +/*! + \fn BNode::BNode() + \brief Creates an uninitialized BNode object. +*/ + + +/*! + \fn BNode::BNode(const entry_ref *ref) + \brief Creates a BNode object and initializes it to the specified + entry_ref. + + \param ref the entry_ref referring to the entry. +*/ + + +/*! + \fn BNode::BNode(const BEntry *entry) + \brief Creates a BNode object and initializes it to the specified + filesystem entry. + + \param entry the BEntry representing the entry. +*/ + + +/*! + \fn BNode::BNode(const char *path) + \brief Creates a BNode object and initializes it to the entry referred + to by the specified path. + + \param path the path referring to the entry. +*/ + + +/*! + \fn BNode::BNode(const BDirectory *dir, const char *path) + \brief Creates a BNode object and initializes it to the entry referred + to by the specified path rooted in the specified directory. + + \param dir the BDirectory, relative to which the entry's path name is + given. + \param path the entry's path name relative to \a dir. +*/ + + +/*! + \fn BNode::BNode(const BNode &node) + \brief Creates a copy of the given BNode. + + \param node the BNode to be copied. +*/ + + +/*! + \fn BNode::~BNode() + \brief Frees all resources associated with the BNode. +*/ + + +/*! + \fn status_t BNode::InitCheck() const + \brief Checks whether the object has been properly initialized or not. + + \returns B_OK if the object has been properly initialized, or an error + code otherwise. +*/ + + +/*! + \fn status_t BNode::GetStat(struct stat *st) const + \brief Fills in the given stat structure with the stat() + information for this object. + + \param st a pointer to a stat structure to be filled in. + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE: \c NULL \a st. +*/ + + +/*! + \fn int BNode::Dup() + \brief Gets the POSIX file descriptor referred to by this node. + + Remember to call close() on the file descriptor when you're through + with it. + + \returns a valid file descriptor, or -1 if something went wrong. +*/ + + +/*! + \name Assignment Methods +*/ + + +//! @{ + + +/*! + \fn BNode& BNode::operator=(const BNode &node) + \brief Initializes the object as a copy of the \a node. + + \param node the BNode to be copied. + + \returns a reference to this BNode object. +*/ + + +/*! + \fn status_t BNode::SetTo(const entry_ref *ref) + \brief Initializes the object to the specified entry_ref. + + \param ref the entry_ref referring to the entry. + + \retval B_OK: Everything went fine. + \retval B_BAD_VALUE: \c NULL \a ref. + \retval B_ENTRY_NOT_FOUND: The entry could not be found. + \retval B_BUSY: The entry is locked. +*/ + + +/*! + \fn status_t BNode::SetTo(const BEntry *entry) + \brief Initializes the object to the specified filesystem \a entry. + + \param entry the BEntry representing the entry. + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \c NULL \a entry. + \retval B_ENTRY_NOT_FOUND The entry could not be found. + \retval B_BUSY The entry is locked. +*/ + + +/*! + \fn status_t BNode::SetTo(const BDirectory *dir, const char *path) + \brief Initializes the object to the entry referred by the + specified \a path relative to the the specified directory. + + \param dir the base BDirectory. + \param path the entry's path name relative to \a dir + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \c NULL \a entry. + \retval B_ENTRY_NOT_FOUND The entry could not be found. + \retval B_BUSY The entry is locked. +*/ + + +/*! + \fn void BNode::Unset() + \brief Returns the object to an uninitialized state. +*/ + + +//! @} + + +/*! + \name Locking Methods +*/ + + +//! @{ + + +/*! + \fn status_t BNode::Lock() + \brief Attains an exclusive lock on the data referred to by this node + so that it may not be modified by any other objects or methods. + + \retval B_OK Everything went fine. + \retval B_FILE_ERROR The object is not initialized. + \retval B_BUSY The node is already locked. +*/ + + +/*! + \fn status_t BNode::Unlock() + \brief Unlocks the date referred to by this node. + + \retval B_OK Everything went fine. + \retval B_FILE_ERROR The object is not initialized. + \retval B_BAD_VALUE The node is not locked. +*/ + + +/*! + \fn status_t BNode::Sync() + \brief Immediately performs any pending disk actions on the node. + + \retval B_OK Everything went fine. + \retval B_FILE_ERROR Something went wrong. +*/ + + +//! @} + + +/*! + \name Attribute Methods +*/ + + +//! @{ + + +/*! + \fn ssize_t BNode::WriteAttr(const char *attr, type_code type, + off_t offset, const void *buffer, size_t len) + \brief Writes data from a buffer to an attribute. + + Write \a len bytes of data from \a buffer to the attribute specified + by \a name after erasing any data that existed previously. The type + specified by \a type \em is remembered, and may be queried with + GetAttrInfo(). The value of \a offset is currently ignored. + + \param attr the name of the attribute. + \param type the type of the attribute. + \param offset the index at which to write the data (currently ignored). + \param buffer the buffer containing the data to be written. + \param len the number of bytes to be written. + + \returns the number of bytes actually written. + \retval B_BAD_VALUE \a attr or \a buffer is \c NULL. + \retval B_FILE_ERROR The object is not initialized or the node it refers to + is read only. + \retval B_NOT_ALLOWED The node resides on a read only volume. + \retval B_DEVICE_FULL Insufficient disk space. + \retval B_NO_MEMORY Insufficient memory to complete the operation. +*/ + + +/*! + \fn ssize_t BNode::ReadAttr(const char *attr, type_code type, + off_t offset, void *buffer, size_t len) const + \brief Reads data from an attribute into \a buffer. + + Reads \a len bytes of data from the attribute given by \a name into + \a buffer. \a type and \a offset are currently ignored. + + \param attr the name of the attribute. + \param type the type of the attribute (currently ignored). + \param offset the index from which to read the data (currently ignored). + \param buffer the buffer for the data to be read. + \param len the number of bytes to be read. + + \returns the number of bytes actually read + \retval B_BAD_VALUE \a attr or \a buffer is \c NULL. + \retval B_FILE_ERROR The object is not initialized. + \retval B_ENTRY_NOT_FOUND The node has no attribute \a attr. +*/ + + +/*! + \fn status_t BNode::RemoveAttr(const char *name) + \brief Deletes the attribute given by \a name. + + \param name the name of the attribute to remove. + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \a name is \c NULL. + \retval B_FILE_ERROR The object is not initialized or the node it + refers to read only. + \retval B_ENTRY_NOT_FOUND The node has no attribute \a name. + \retval B_NOT_ALLOWED The node resides on a read only volume. +*/ + + +/*! + \fn status_t BNode::RenameAttr(const char *oldname, const char *newname) + \brief Moves the attribute given by \a oldname to \a newname. + + If \a newname already exists, the data is clobbered. + + \param oldname the name of the attribute to be renamed. + \param newname the new name for the attribute. + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \a oldname or \a newname is \c NULL. + \retval B_FILE_ERROR The object is not initialized or the node it + refers to is read only. + \retval B_ENTRY_NOT_FOUND The node has no attribute \a oldname. + \retval B_NOT_ALLOWED The node resides on a read only volume. +*/ + + +/*! + \fn status_t BNode::GetAttrInfo(const char *name, + struct attr_info *info) const + \brief Fills in the pre-allocated attr_info struct pointed to by \a info + with information about the attribute specified by \a name. + + \param name the name of the attribute + \param info the attr_info structure to be filled in + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \a name is \c NULL. + \retval B_FILE_ERROR The object is not initialized. + \retval B_ENTRY_NOT_FOUND The node has no attribute \a name. +*/ + + +/*! + \fn status_t BNode::GetNextAttrName(char *buffer) + \brief Copies the name of the attribute into \c buffer and then advances + the pointer to the next attribute. + + The name of the node is first copied into \a buffer, which should be at + least \c B_ATTR_NAME_LENGTH characters long. The copied node name is + \c NUL terminated. Once the name is copied the attribute list pointer + is advanced to the next attribute in the list. When GetNextAttrName() + reaches the end of the list it returns \c B_ENTRY_NOT_FOUND. + + \param buffer A buffer to copy the name of the attribute into. + + \retval B_OK The Attribute name was copied and there are more attribute + names to copy. + \retval B_BAD_VALUE passed in \a buffer is \c NULL. + \retval B_FILE_ERROR The object is not initialized. + \retval B_ENTRY_NOT_FOUND There are no more attributes, the last attribute + name has already been copied. +*/ + + +/*! + \fn status_t BNode::RewindAttrs() + \brief Resets the object's attribute pointer to the first attribute in the + list. + + \retval B_OK Everything went fine. + \retval B_FILE_ERROR Some other error occurred. +*/ + + +/*! + \fn status_t BNode::WriteAttrString(const char *name, const BString *data) + \brief Writes the specified string to the specified attribute, clobbering + any previous data. + + \param name the name of the attribute. + \param data the BString to be written to the attribute. + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \c NULL \a name or \a data + \retval B_FILE_ERROR The object is not initialized or the node it refers to + is read only. + \retval B_NOT_ALLOWED The node resides on a read only volume. + \retval B_DEVICE_FULL Insufficient disk space. + \retval B_NO_MEMORY Insufficient memory to complete the operation. +*/ + + +/*! + \fn status_t BNode::ReadAttrString(const char *name, BString *result) const + \brief Reads the data of the specified attribute into the pre-allocated + \a result. + + \param name the name of the attribute. + \param result the BString to be set to the value of the attribute. + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \a name or \a result is \c NULL. + \retval B_FILE_ERROR The object is not initialized. + \retval B_ENTRY_NOT_FOUND The node has no attribute \a attr. +*/ + + +//! @} + + +/*! + \name Comparison Methods +*/ + + +//! @{ + + +/*! + \fn bool BNode::operator==(const BNode &node) const + \brief Tests whether this and the supplied BNode object are equal. + + Two BNode objects are said to be equal if they're set to the same node, + or if they're both \c B_NO_INIT. + + \param node the BNode to be compared with. + + \return \c true, if the BNode objects are equal, \c false otherwise. +*/ + + +/*! + \fn bool BNode::operator!=(const BNode &node) const + \brief Tests whether this and the supplied BNode object are not equal. + + Two BNode objects are said to be equal if they're set to the same node, + or if they're both \c B_NO_INIT. + + \param node the BNode to be compared with + + \return \c false, if the BNode objects are equal, \c true otherwise. +*/ + + +//! @} + + +/*! + \name Private Methods +*/ + + +//! @{ + + +/*! + \fn status_t BNode::set_fd(int fd) + \brief Sets the node's file descriptor. + + Used by each implementation (i.e. BNode, BFile, BDirectory, etc.) to set + the node's file descriptor. This allows each subclass to use the various + file-type specific system calls for opening file descriptors. + + \note This method calls close_fd() to close previously opened FDs. Thus + derived classes should take care to first call set_fd() and set + class specific resources freed in their close_fd() version + thereafter. + + \param fd the file descriptor this BNode should be set to (may be -1). + + \returns \c B_OK if everything went fine, or an error code if something + went wrong. +*/ + + +/*! + \fn void BNode::close_fd() + \brief Closes the node's file descriptor(s). + + To be implemented by subclasses to close the file descriptor using the + proper system call for the given file-type. This implementation calls + _kern_close(fFd) and also _kern_close(fAttrDir) if necessary. +*/ + + +/*! + \fn void BNode::set_status(status_t newStatus) + \brief Sets the BNode's status. + + To be used by derived classes instead of accessing the BNode's private + \c fCStatus member directly. + + \param newStatus the new value for the status variable. +*/ + + +/*! + \fn status_t BNode::_SetTo(int fd, const char *path, bool traverse) + \brief Initializes the BNode's file descriptor to the node referred to + by the given FD and path combo. + + \a path must either be \c NULL, an absolute or a relative path. + In the first case, \a fd must not be \c NULL; the node it refers to will + be opened. If absolute, \a fd is ignored. If relative and \a fd is >= 0, + it will be reckoned off the directory identified by \a fd, otherwise off + the current working directory. + + The method will first try to open the node with read and write permission. + If that fails due to a read-only FS or because the user has no write + permission for the node, it will re-try opening the node read-only. + + The \a fCStatus member will be set to the return value of this method. + + \param fd Either a directory FD or a value < 0. In the latter case \a path + must be specified. + \param path Either \a NULL in which case \a fd must be given, absolute, or + relative to the directory specified by \a fd (if given) or to the + current working directory. + \param traverse If the node identified by \a fd and \a path is a symlink + and \a traverse is \c true, the symlink will be resolved recursively. + + \returns \c B_OK if everything went fine, or an error code if something + went wrong. +*/ + + +/*! + \fn status_t BNode::_SetTo(const entry_ref *ref, bool traverse) + \brief Initializes the BNode's file descriptor to the node referred to + by the given entry_ref. + + The method will first try to open the node with read and write permission. + If that fails due to a read-only FS or because the user has no write + permission for the node, it will re-try opening the node read-only. + + The \a fCStatus member will be set to the return value of this method. + + \param ref An entry_ref identifying the node to be opened. + \param traverse If the node identified by \a ref is a symlink and + \a traverse is \c true, the symlink will be resolved recursively. + + \returns \c B_OK if everything went fine, or an error code if something + went wrong. +*/ + + +/*! + \fn status_t BNode::set_stat(struct stat &st, uint32 what) + \brief Modifies a certain setting for this node based on \a what and the + corresponding value in \a st. + + Inherited from and called by BStatable. + + \param st a stat structure containing the value to be set. + \param what specifies what setting to be modified. + + \returns \c B_OK if everything went fine, or an error code if something + went wrong. +*/ + + +/*! + \fn status_t BNode::InitAttrDir() + \brief Verifies that the BNode has been properly initialized, and then + (if necessary) opens the attribute directory on the node's file + descriptor, storing it in fAttrDir. + + \returns \c B_OK if everything went fine, or an error code if something + went wrong. +*/ + + +//! @} diff --git a/headers/os/storage/Node.h b/headers/os/storage/Node.h index 06f8ed4520..bb22e74fac 100644 --- a/headers/os/storage/Node.h +++ b/headers/os/storage/Node.h @@ -14,13 +14,6 @@ class BString; struct entry_ref; -//! Reference structure to a particular vnode on a particular device -/*! node_ref - A node reference. - - @author Tyler Dauwalder - @author Be Inc. - @version 0.0.0 -*/ struct node_ref { node_ref(); node_ref(const node_ref &ref); @@ -34,17 +27,6 @@ struct node_ref { }; -//! A BNode represents a chunk of data in the filesystem. -/*! The BNode class provides an interface for manipulating the data and attributes - belonging to filesystem entries. The BNode is unaware of the name that refers - to it in the filesystem (i.e. its entry); a BNode is solely concerned with - the entry's data and attributes. - - - @author Tyler Dauwalder - @version 0.0.0 - -*/ class BNode : public BStatable { public: BNode(); diff --git a/src/kits/storage/Node.cpp b/src/kits/storage/Node.cpp index 0def72e11b..1fc1fa730b 100644 --- a/src/kits/storage/Node.cpp +++ b/src/kits/storage/Node.cpp @@ -8,11 +8,6 @@ */ -/*! - \file Node.cpp - BNode implementation. -*/ - #include #include @@ -37,8 +32,6 @@ // #pragma mark - node_ref -/*! \brief Creates an uninitialized node_ref object. -*/ node_ref::node_ref() : device((dev_t)-1), node((ino_t)-1) @@ -46,9 +39,6 @@ node_ref::node_ref() } // copy constructor -/*! \brief Creates a copy of the given node_ref object. - \param ref the node_ref to be copied -*/ node_ref::node_ref(const node_ref &ref) : device((dev_t)-1), node((ino_t)-1) @@ -57,10 +47,6 @@ node_ref::node_ref(const node_ref &ref) } // == -/*! \brief Tests whether this node_ref and the supplied one are equal. - \param ref the node_ref to be compared with - \return \c true, if the objects are equal, \c false otherwise -*/ bool node_ref::operator==(const node_ref &ref) const { @@ -68,10 +54,6 @@ node_ref::operator==(const node_ref &ref) const } // != -/*! \brief Tests whether this node_ref and the supplied one are not equal. - \param ref the node_ref to be compared with - \return \c false, if the objects are equal, \c true otherwise -*/ bool node_ref::operator!=(const node_ref &ref) const { @@ -79,10 +61,6 @@ node_ref::operator!=(const node_ref &ref) const } // = -/*! \brief Makes this node ref a copy of the supplied one. - \param ref the node_ref to be copied - \return a reference to this object -*/ node_ref& node_ref::operator=(const node_ref &ref) { @@ -95,8 +73,6 @@ node_ref::operator=(const node_ref &ref) // #pragma mark - BNode -/*! \brief Creates an uninitialized BNode object -*/ BNode::BNode() : fFd(-1), fAttrFd(-1), @@ -105,10 +81,6 @@ BNode::BNode() } -/*! \brief Creates a BNode object and initializes it to the specified - entry_ref. - \param ref the entry_ref referring to the entry -*/ BNode::BNode(const entry_ref *ref) : fFd(-1), fAttrFd(-1), @@ -118,10 +90,6 @@ BNode::BNode(const entry_ref *ref) } -/*! \brief Creates a BNode object and initializes it to the specified - filesystem entry. - \param entry the BEntry representing the entry -*/ BNode::BNode(const BEntry *entry) : fFd(-1), fAttrFd(-1), @@ -131,10 +99,6 @@ BNode::BNode(const BEntry *entry) } -/*! \brief Creates a BNode object and initializes it to the entry referred - to by the specified path. - \param path the path referring to the entry -*/ BNode::BNode(const char *path) : fFd(-1), fAttrFd(-1), @@ -144,12 +108,6 @@ BNode::BNode(const char *path) } -/*! \brief Creates a BNode object and initializes it to the entry referred - to by the specified path rooted in the specified directory. - \param dir the BDirectory, relative to which the entry's path name is - given - \param path the entry's path name relative to \a dir -*/ BNode::BNode(const BDirectory *dir, const char *path) : fFd(-1), fAttrFd(-1), @@ -159,9 +117,6 @@ BNode::BNode(const BDirectory *dir, const char *path) } -/*! \brief Creates a copy of the given BNode. - \param node the BNode to be copied -*/ BNode::BNode(const BNode &node) : fFd(-1), fAttrFd(-1), @@ -171,19 +126,12 @@ BNode::BNode(const BNode &node) } -/*! \brief Frees all resources associated with the BNode. -*/ BNode::~BNode() { Unset(); } -/*! \brief Checks whether the object has been properly initialized or not. - \return - - \c B_OK, if the object has been properly initialized, - - an error code, otherwise. -*/ status_t BNode::InitCheck() const { @@ -191,25 +139,6 @@ BNode::InitCheck() const } -/*! \fn status_t BNode::GetStat(struct stat *st) const - \brief Fills in the given stat structure with \code stat() \endcode - information for this object. - \param st a pointer to a stat structure to be filled in - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a st. - - another error code, e.g., if the object wasn't properly initialized -*/ - - -/*! \brief Reinitializes the object to the specified entry_ref. - \param ref the entry_ref referring to the entry - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a ref. - - \c B_ENTRY_NOT_FOUND: The entry could not be found. - - \c B_BUSY: The entry is locked. -*/ status_t BNode::SetTo(const entry_ref *ref) { @@ -217,14 +146,6 @@ BNode::SetTo(const entry_ref *ref) } -/*! \brief Reinitializes the object to the specified filesystem entry. - \param entry the BEntry representing the entry - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a entry. - - \c B_ENTRY_NOT_FOUND: The entry could not be found. - - \c B_BUSY: The entry is locked. -*/ status_t BNode::SetTo(const BEntry *entry) { @@ -236,15 +157,6 @@ BNode::SetTo(const BEntry *entry) } -/*! \brief Reinitializes the object to the entry referred to by the specified - path. - \param path the path referring to the entry - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a path. - - \c B_ENTRY_NOT_FOUND: The entry could not be found. - - \c B_BUSY: The entry is locked. -*/ status_t BNode::SetTo(const char *path) { @@ -252,17 +164,6 @@ BNode::SetTo(const char *path) } -/*! \brief Reinitializes the object to the entry referred to by the specified - path rooted in the specified directory. - \param dir the BDirectory, relative to which the entry's path name is - given - \param path the entry's path name relative to \a dir - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a dir or \a path. - - \c B_ENTRY_NOT_FOUND: The entry could not be found. - - \c B_BUSY: The entry is locked. -*/ status_t BNode::SetTo(const BDirectory *dir, const char *path) { @@ -274,8 +175,6 @@ BNode::SetTo(const BDirectory *dir, const char *path) } -/*! \brief Returns the object to an uninitialized state. -*/ void BNode::Unset() { @@ -284,13 +183,6 @@ BNode::Unset() } -/*! \brief Attains an exclusive lock on the data referred to by this node, so - that it may not be modified by any other objects or methods. - \return - - \c B_OK: Everything went fine. - - \c B_FILE_ERROR: The object is not initialized. - - \c B_BUSY: The node is already locked. -*/ status_t BNode::Lock() { @@ -300,12 +192,6 @@ BNode::Lock() } -/*! \brief Unlocks the node. - \return - - \c B_OK: Everything went fine. - - \c B_FILE_ERROR: The object is not initialized. - - \c B_BAD_VALUE: The node is not locked. -*/ status_t BNode::Unlock() { @@ -315,11 +201,6 @@ BNode::Unlock() } -/*! \brief Immediately performs any pending disk actions on the node. - \return - - \c B_OK: Everything went fine. - - an error code, if something went wrong. -*/ status_t BNode::Sync() { @@ -327,26 +208,6 @@ BNode::Sync() } -/*! \brief Writes data from a buffer to an attribute. - Write the \a len bytes of data from \a buffer to - the attribute specified by \a name after erasing any data - that existed previously. The type specified by \a type \em is - remembered, and may be queried with GetAttrInfo(). The value of - \a offset is currently ignored. - \param attr the name of the attribute - \param type the type of the attribute - \param offset the index at which to write the data (currently ignored) - \param buffer the buffer containing the data to be written - \param len the number of bytes to be written - \return - - the number of bytes actually written - - \c B_BAD_VALUE: \c NULL \a attr or \a buffer - - \c B_FILE_ERROR: The object is not initialized or the node it refers to - is read only. - - \c B_NOT_ALLOWED: The node resides on a read only volume. - - \c B_DEVICE_FULL: Insufficient disk space. - - \c B_NO_MEMORY: Insufficient memory to complete the operation. -*/ ssize_t BNode::WriteAttr(const char *attr, type_code type, off_t offset, const void *buffer, size_t len) @@ -361,21 +222,6 @@ BNode::WriteAttr(const char *attr, type_code type, off_t offset, } -/*! \brief Reads data from an attribute into a buffer. - Reads the data of the attribute given by \a name into - the buffer specified by \a buffer with length specified - by \a len. \a type and \a offset are currently ignored. - \param attr the name of the attribute - \param type the type of the attribute (currently ignored) - \param offset the index from which to read the data (currently ignored) - \param buffer the buffer for the data to be read - \param len the number of bytes to be read - \return - - the number of bytes actually read - - \c B_BAD_VALUE: \c NULL \a attr or \a buffer - - \c B_FILE_ERROR: The object is not initialized. - - \c B_ENTRY_NOT_FOUND: The node has no attribute \a attr. -*/ ssize_t BNode::ReadAttr(const char *attr, type_code type, off_t offset, void *buffer, size_t len) const @@ -390,15 +236,6 @@ BNode::ReadAttr(const char *attr, type_code type, off_t offset, } -/*! \brief Deletes the attribute given by \a name. - \param name the name of the attribute - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a name - - \c B_FILE_ERROR: The object is not initialized or the node it refers to - is read only. - - \c B_ENTRY_NOT_FOUND: The node has no attribute \a name. - - \c B_NOT_ALLOWED: The node resides on a read only volume. -*/ status_t BNode::RemoveAttr(const char *name) { @@ -406,18 +243,6 @@ BNode::RemoveAttr(const char *name) } -/*! \brief Moves the attribute given by \a oldname to \a newname. - If \a newname already exists, the current data is clobbered. - \param oldname the name of the attribute to be renamed - \param newname the new name for the attribute - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a oldname or \a newname - - \c B_FILE_ERROR: The object is not initialized or the node it refers to - is read only. - - \c B_ENTRY_NOT_FOUND: The node has no attribute \a oldname. - - \c B_NOT_ALLOWED: The node resides on a read only volume. -*/ status_t BNode::RenameAttr(const char *oldname, const char *newname) { @@ -428,16 +253,6 @@ BNode::RenameAttr(const char *oldname, const char *newname) } -/*! \brief Fills in the pre-allocated attr_info struct pointed to by \a info - with useful information about the attribute specified by \a name. - \param name the name of the attribute - \param info the attr_info structure to be filled in - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a name - - \c B_FILE_ERROR: The object is not initialized. - - \c B_ENTRY_NOT_FOUND: The node has no attribute \a name. -*/ status_t BNode::GetAttrInfo(const char *name, struct attr_info *info) const { @@ -450,23 +265,6 @@ BNode::GetAttrInfo(const char *name, struct attr_info *info) const } -/*! \brief Returns the next attribute in the node's list of attributes. - Every BNode maintains a pointer to its list of attributes. - GetNextAttrName() retrieves the name of the attribute that the pointer is - currently pointing to, and then bumps the pointer to the next attribute. - The name is copied into the buffer, which should be at least - B_ATTR_NAME_LENGTH characters long. The copied name is NULL-terminated. - When you've asked for every name in the list, GetNextAttrName() - returns \c B_ENTRY_NOT_FOUND. - \param buffer the buffer the name of the next attribute shall be stored in - (must be at least \c B_ATTR_NAME_LENGTH bytes long) - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a buffer. - - \c B_FILE_ERROR: The object is not initialized. - - \c B_ENTRY_NOT_FOUND: There are no more attributes, the last attribute - name has already been returned. -*/ status_t BNode::GetNextAttrName(char *buffer) { @@ -489,12 +287,6 @@ BNode::GetNextAttrName(char *buffer) } -/*! \brief Resets the object's attribute pointer to the first attribute in the - list. - \return - - \c B_OK: Everything went fine. - - \c B_FILE_ERROR: Some error occured. -*/ status_t BNode::RewindAttrs() { @@ -505,18 +297,6 @@ BNode::RewindAttrs() } -/*! Writes the specified string to the specified attribute, clobbering any - previous data. - \param name the name of the attribute - \param data the BString to be written to the attribute - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a name or \a data - - \c B_FILE_ERROR: The object is not initialized or the node it refers to - is read only. - - \c B_NOT_ALLOWED: The node resides on a read only volume. - - \c B_DEVICE_FULL: Insufficient disk space. - - \c B_NO_MEMORY: Insufficient memory to complete the operation. -*/ status_t BNode::WriteAttrString(const char *name, const BString *data) { @@ -532,16 +312,6 @@ BNode::WriteAttrString(const char *name, const BString *data) } -/*! \brief Reads the data of the specified attribute into the pre-allocated - \a result. - \param name the name of the attribute - \param result the BString to be set to the value of the attribute - \return - - \c B_OK: Everything went fine. - - \c B_BAD_VALUE: \c NULL \a name or \a result - - \c B_FILE_ERROR: The object is not initialized. - - \c B_ENTRY_NOT_FOUND: The node has no attribute \a attr. -*/ status_t BNode::ReadAttrString(const char *name, BString *result) const { @@ -577,10 +347,6 @@ BNode::ReadAttrString(const char *name, BString *result) const } -/*! \brief Reinitializes the object as a copy of the \a node. - \param node the BNode to be copied - \return a reference to this BNode object. -*/ BNode& BNode::operator=(const BNode &node) { @@ -598,12 +364,6 @@ BNode::operator=(const BNode &node) } -/*! Tests whether this and the supplied BNode object are equal. - Two BNode objects are said to be equal if they're set to the same node, - or if they're both \c B_NO_INIT. - \param node the BNode to be compared with - \return \c true, if the BNode objects are equal, \c false otherwise -*/ bool BNode::operator==(const BNode &node) const { @@ -622,12 +382,6 @@ BNode::operator==(const BNode &node) const } -/*! Tests whether this and the supplied BNode object are not equal. - Two BNode objects are said to be equal if they're set to the same node, - or if they're both \c B_NO_INIT. - \param node the BNode to be compared with - \return \c false, if the BNode objects are equal, \c true otherwise -*/ bool BNode::operator!=(const BNode &node) const { @@ -635,11 +389,6 @@ BNode::operator!=(const BNode &node) const } -/*! \brief Returns a POSIX file descriptor to the node this object refers to. - Remember to call close() on the file descriptor when you're through with - it. - \return a valid file descriptor, or -1, if something went wrong. -*/ int BNode::Dup() { @@ -657,17 +406,6 @@ void BNode::_RudeNode5() { } void BNode::_RudeNode6() { } -/*! \brief Sets the node's file descriptor. - Used by each implementation (i.e. BNode, BFile, BDirectory, etc.) to set - the node's file descriptor. This allows each subclass to use the various - file-type specific system calls for opening file descriptors. - \param fd the file descriptor this BNode should be set to (may be -1) - \return \c B_OK, if everything went fine, an error code otherwise. - \note This method calls close_fd() to close previously opened FDs. Thus - derived classes should take care to first call set_fd() and set - class specific resources freed in their close_fd() version - thereafter. -*/ status_t BNode::set_fd(int fd) { @@ -678,11 +416,6 @@ BNode::set_fd(int fd) } -/*! \brief Closes the node's file descriptor(s). - To be implemented by subclasses to close the file descriptor using the - proper system call for the given file-type. This implementation calls - _kern_close(fFd) and also _kern_close(fAttrDir) if necessary. -*/ void BNode::close_fd() { @@ -697,11 +430,6 @@ BNode::close_fd() } -/*! \brief Sets the BNode's status. - To be used by derived classes instead of accessing the BNode's private - \c fCStatus member directly. - \param newStatus the new value for the status variable. -*/ void BNode::set_status(status_t newStatus) { @@ -709,30 +437,6 @@ BNode::set_status(status_t newStatus) } -/*! \brief Initializes the BNode's file descriptor to the node referred to - by the given FD and path combo. - - \a path must either be \c NULL, an absolute or a relative path. - In the first case, \a fd must not be \c NULL; the node it refers to will - be opened. If absolute, \a fd is ignored. If relative and \a fd is >= 0, - it will be reckoned off the directory identified by \a fd, otherwise off - the current working directory. - - The method will first try to open the node with read and write permission. - If that fails due to a read-only FS or because the user has no write - permission for the node, it will re-try opening the node read-only. - - The \a fCStatus member will be set to the return value of this method. - - \param fd Either a directory FD or a value < 0. In the latter case \a path - must be specified. - \param path Either \a NULL in which case \a fd must be given, absolute, or - relative to the directory specified by \a fd (if given) or to the - current working directory. - \param traverse If the node identified by \a fd and \a path is a symlink - and \a traverse is \c true, the symlink will be resolved recursively. - \return \c B_OK, if everything went fine, another error code otherwise. -*/ status_t BNode::_SetTo(int fd, const char *path, bool traverse) { @@ -752,20 +456,6 @@ BNode::_SetTo(int fd, const char *path, bool traverse) } -/*! \brief Initializes the BNode's file descriptor to the node referred to - by the given entry_ref. - - The method will first try to open the node with read and write permission. - If that fails due to a read-only FS or because the user has no write - permission for the node, it will re-try opening the node read-only. - - The \a fCStatus member will be set to the return value of this method. - - \param ref An entry_ref identifying the node to be opened. - \param traverse If the node identified by \a ref is a symlink - and \a traverse is \c true, the symlink will be resolved recursively. - \return \c B_OK, if everything went fine, another error code otherwise. -*/ status_t BNode::_SetTo(const entry_ref *ref, bool traverse) { @@ -787,13 +477,6 @@ BNode::_SetTo(const entry_ref *ref, bool traverse) } -/*! \brief Modifies a certain setting for this node based on \a what and the - corresponding value in \a st. - Inherited from and called by BStatable. - \param st a stat structure containing the value to be set - \param what specifies what setting to be modified - \return \c B_OK if everything went fine, an error code otherwise. -*/ status_t BNode::set_stat(struct stat &st, uint32 what) { @@ -805,11 +488,6 @@ BNode::set_stat(struct stat &st, uint32 what) } -/*! \brief Verifies that the BNode has been properly initialized, and then - (if necessary) opens the attribute directory on the node's file - descriptor, storing it in fAttrDir. - \return \c B_OK if everything went fine, an error code otherwise. -*/ status_t BNode::InitAttrDir() { @@ -847,19 +525,6 @@ BNode::_GetStat(struct stat_beos *st) const } -/*! \var BNode::fFd - File descriptor for the given node. -*/ - -/*! \var BNode::fAttrFd - File descriptor for the attribute directory of the node. Initialized lazily. -*/ - -/*! \var BNode::fCStatus - The object's initialization status. -*/ - - // #pragma mark - symbol versions From 4325056b3b18c427f34deb3d62127c0554cb361a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 29 Oct 2011 22:19:16 +0000 Subject: [PATCH 526/702] * Busy looping without sleeping isn't so nice. * Also allow upper case Y to please Michael :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42987 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/screenmode/screenmode.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/screenmode/screenmode.cpp b/src/bin/screenmode/screenmode.cpp index a846141e71..512ac32996 100644 --- a/src/bin/screenmode/screenmode.cpp +++ b/src/bin/screenmode/screenmode.cpp @@ -316,9 +316,11 @@ main(int argc, char** argv) c = getchar(); if (c != -1) break; + + snooze(10000); } - if (c != '\n' && c != 'y') + if (c != '\n' && tolower(c) != 'y') screenMode.Revert(); } } else { From d57dba3c4e2afa1972d16e5538ad1d98d127a9ce Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 29 Oct 2011 22:28:11 +0000 Subject: [PATCH 527/702] Apply patch from ticket #7015 (slightly modified) by kallisti: A cosmetic cleanup of the partition types for the Intel partition map. * large number of partition types added (thanks fdisk!) * clean up what partitions can be created git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42988 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../intel/PartitionMap.cpp | 129 +++++++++++++----- 1 file changed, 93 insertions(+), 36 deletions(-) diff --git a/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp b/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp index 6278e21911..7633290a57 100644 --- a/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp +++ b/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp @@ -50,42 +50,99 @@ static const char* const kUnrecognizedTypeString = "Unrecognized Type "; static const size_t kUnrecognizedTypeStringLength = 18; static const struct partition_type kPartitionTypes[] = { - // these entries must be sorted by type (currently not) -// TODO: Standardize naming. - { 0x00, "empty", true }, - { 0x01, "FAT 12-bit", false}, - { 0x02, "Xenix root", false }, - { 0x03, "Xenix user", false }, - { 0x04, "FAT 16-bit (dos 3.0)", false }, - { 0x05, /*"Extended Partition"*/INTEL_EXTENDED_PARTITION_NAME, false }, - { 0x06, "FAT 16-bit (dos 3.31)", false }, - { 0x07, "Windows NT, OS/2", true }, - { 0x0b, "FAT 32-bit", false }, - { 0x0c, "FAT 32-bit, LBA-mapped", true }, - { 0x0d, "FAT 16-bit, LBA-mapped", false }, - { 0x0f, /*"Extended Partition, LBA-mapped"*/INTEL_EXTENDED_PARTITION_NAME, - true }, - { 0x42, "Windows 2000 marker (switches to a proprietary partition table)", - false }, - { 0x4d, "QNX 4", true }, - { 0x4e, "QNX 4 2nd part", false }, - { 0x4f, "QNX 4 3rd part", false }, - { 0x78, "XOSL boot loader", false }, - { 0x82, "Linux swapfile", true }, - { 0x83, "Linux native", true }, - { 0x85, /*"Linux extendend partition"*/INTEL_EXTENDED_PARTITION_NAME, - false }, - { 0xa5, "FreeBSD", true }, - { 0xa6, "OpenBSD", true }, - { 0xa7, "NextSTEP", false }, - { 0xa8, "MacOS X", true }, - { 0xa9, "NetBSD", true }, - { 0xab, "MacOS X boot", true }, - { 0xaf, "MacOS X HFS", true }, - { 0xbe, "Solaris 8 boot", false }, - { 0xbf, "Solaris 10", false }, - { 0xeb, /*"BeOS"*/ BFS_NAME, true }, - { 0, NULL, false } + // Can be created (in display order) + { 0x00, "empty", true }, + { 0x0f, INTEL_EXTENDED_PARTITION_NAME, true }, + { 0x0c, "FAT 32-bit, LBA-mapped", true }, + { 0x82, "Linux swap", true }, + { 0x83, "Linux native", true }, + { 0xa5, "FreeBSD", true }, + { 0xa6, "OpenBSD", true }, + { 0xa9, "NetBSD", true }, + { 0xa8, "MacOS X", true }, + { 0xab, "MacOS X boot", true }, + { 0xaf, "MacOS X HFS/HFS+", true }, + { 0x4d, "QNX 4", true }, + { 0xb3, "QNX 6", true }, + { 0xeb, BFS_NAME, true }, + // Known file system types + { 0x01, "FAT 12-bit", false}, + { 0x02, "Xenix root", false }, + { 0x03, "Xenix user", false }, + { 0x04, "FAT 16-bit (dos 3.0)", false }, + { 0x05, INTEL_EXTENDED_PARTITION_NAME, false }, + { 0x06, "FAT 16-bit (dos 3.31)", false }, + { 0x07, "Windows NT, OS/2 IFS, Advanced Unix", false }, + { 0x08, "AIX", false }, + { 0x09, "AIX bootable", false }, + { 0x0a, "OS/2 Boot Manager", false }, + { 0x0b, "FAT 32-bit", false }, + { 0x0e, "FAT 16-bit, LBA-mapped", false }, + { 0x10, "OPUS", false }, + { 0x11, "Hidden FAT 12-bit", false }, + { 0x12, "Compaq diagnostic", false }, + { 0x14, "Hidden FAT 16-bit", false }, + { 0x16, "Hidden FAT 16-bit", false }, + { 0x17, "Hidden HPFS/NTFS", false }, + { 0x18, "AST SmartSleep", false }, + { 0x1b, "Hidden W95 FAT 32-bit", false }, + { 0x1c, "Hidden W95 FAT 32-bit", false }, + { 0x1e, "Hidden W95 FAT 16-bit", false }, + { 0x24, "NEC DOS", false }, + { 0x39, "Plan 9", false }, + { 0x3c, "PartitionMagic", false }, + { 0x40, "Venix 80286", false }, + { 0x41, "PPC PReP Boot", false }, + { 0x42, "Windows 2000 marker (proprietary extended)", + false }, + { 0x4e, "QNX 4 2nd part", false }, + { 0x4f, "QNX 4 3rd part", false }, + { 0x50, "OnTrack DM", false }, + { 0x51, "OnTrack DM6 Aux", false }, + { 0x52, "CP/M", false }, + { 0x53, "OnTrack DM6 Aux", false }, + { 0x54, "OnTrack DM6", false }, + { 0x55, "EZ-Drive", false }, + { 0x56, "Golden Bow", false }, + { 0x5c, "Priam Edisk", false }, + { 0x61, "SpeedStor", false }, + { 0x63, "GNU HURD", false }, + { 0x64, "Novell Netware", false }, + { 0x65, "Novell Netware", false }, + { 0x70, "DiskSecure Mult", false }, + { 0x75, "PC/IX", false }, + { 0x78, "XOSL boot loader", false }, + { 0x80, "Old Minix", false }, + { 0x81, "Minix", false }, + { 0x84, "OS/2 hidden", false }, + { 0x85, /*"Linux extendend partition"*/INTEL_EXTENDED_PARTITION_NAME, + false }, + { 0x86, "NTFS volume set", false }, + { 0x87, "NTFS volume set", false }, + { 0x88, "Linux plaintext", false }, + { 0x8e, "Linux LVM", false }, + { 0x93, "Amoeba", false }, + { 0x94, "Amoeba BBT", false }, + { 0x9f, "BSD/OS", false }, + { 0xa0, "IBM Hibernation", false }, + { 0xa7, "NextSTEP", false }, + { 0xb1, "QNX 6", false}, + { 0xb2, "QNX 6", false}, + { 0xb7, "BSDI fs", false }, + { 0xb8, "BSDI swap", false }, + { 0xbe, "Solaris 8 boot", false }, + { 0xbf, "Solaris 10", false }, + { 0xc1, "DR-DOS FAT", false }, + { 0xc4, "DR-DOS FAT", false }, + { 0xc6, "DR-DOS FAT", false }, + { 0xc7, "Syrinx", false }, + { 0xe4, "SpeedStor", false }, + { 0xee, "GPT", false }, + { 0xef, "EFI", false }, + { 0xfb, "VMware VMFS", false }, + { 0xfc, "VMware VMKCORE", false }, + { 0xfd, "Linux raid auto", false }, + { 0, NULL, false } }; static const struct partition_type kPartitionContentTypes[] = { From 9a39723ca56c8678b7d343059845d31fcc40364d Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Sat, 29 Oct 2011 22:42:52 +0000 Subject: [PATCH 528/702] Applied patch by Disreali, adding colour scheme green on black. Fixes #7977. Thanks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42989 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/Colors.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/apps/terminal/Colors.cpp b/src/apps/terminal/Colors.cpp index df8cbc707e..877e0ef9ca 100644 --- a/src/apps/terminal/Colors.cpp +++ b/src/apps/terminal/Colors.cpp @@ -14,6 +14,7 @@ const rgb_color kBlack= { 0, 0, 0, 255 }; const rgb_color kWhite = { 255, 255, 255, 255 }; +const rgb_color kGreen = { 0, 255, 0, 255 }; const struct color_schema kBlackOnWhite = { B_TRANSLATE("Black on White"), @@ -36,6 +37,15 @@ const struct color_schema kWhiteOnBlack = { kWhite }; +const struct color_schema kGreenOnBlack = { + B_TRANSLATE("Green on Black"), + kGreen, + kBlack, + kBlack, + kGreen, + kBlack, + kGreen +}; struct color_schema gCustomSchema = { B_TRANSLATE("Custom") @@ -44,6 +54,7 @@ struct color_schema gCustomSchema = { const color_schema* gPredefinedSchemas[] = { &kBlackOnWhite, &kWhiteOnBlack, + &kGreenOnBlack, &gCustomSchema, NULL }; From f64b502da072e041cba79dd7d2ae764f10c21246 Mon Sep 17 00:00:00 2001 From: Ryan Leavengood Date: Sun, 30 Oct 2011 04:16:00 +0000 Subject: [PATCH 529/702] Hide the time zone preview in the Time preflet when the BIOS clock is set to local time. Fixes #6743. I tried to mimic existing message constant naming, but may come back and fix them all to our coding style. Is there some backwards compatible reason for some of the constants being what they are? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42990 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/DateTimeView.cpp | 14 ++++++++++++++ src/preferences/time/DateTimeView.h | 1 + src/preferences/time/TimeMessages.h | 16 +++++++++++----- src/preferences/time/TimeWindow.cpp | 13 +++++++++++++ src/preferences/time/ZoneView.cpp | 10 ++++++++++ 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/preferences/time/DateTimeView.cpp b/src/preferences/time/DateTimeView.cpp index cf8d5dd7ed..8d1cc48c95 100644 --- a/src/preferences/time/DateTimeView.cpp +++ b/src/preferences/time/DateTimeView.cpp @@ -78,6 +78,8 @@ DateTimeView::AttachedToWindow() fCalendarView->SetTarget(this); } + + _NotifyClockSettingChanged(); } @@ -290,6 +292,8 @@ DateTimeView::_UpdateGmtSettings() { _WriteRTCSettings(); + _NotifyClockSettingChanged(); + _kern_set_real_time_clock_is_gmt(fUseGmtTime); } @@ -325,3 +329,13 @@ DateTimeView::_UpdateDateTime(BMessage* message) fTimeEdit->SetTime(hour, minute, second); } } + + +void +DateTimeView::_NotifyClockSettingChanged() +{ + BMessage msg(kMsgClockSettingChanged); + msg.AddBool("UseGMT", fUseGmtTime); + Window()->PostMessage(&msg); +} + diff --git a/src/preferences/time/DateTimeView.h b/src/preferences/time/DateTimeView.h index 9426610e2c..159ff6baa5 100644 --- a/src/preferences/time/DateTimeView.h +++ b/src/preferences/time/DateTimeView.h @@ -45,6 +45,7 @@ private: void _WriteRTCSettings(); void _UpdateGmtSettings(); void _UpdateDateTime(BMessage* message); + void _NotifyClockSettingChanged(); void _Revert(); time_t _PrefletUptime() const; diff --git a/src/preferences/time/TimeMessages.h b/src/preferences/time/TimeMessages.h index bb1bfe0e15..101e659121 100644 --- a/src/preferences/time/TimeMessages.h +++ b/src/preferences/time/TimeMessages.h @@ -12,25 +12,29 @@ #define _TIME_MESSAGES_H -//Timezone messages +// Timezone messages const uint32 H_CITY_CHANGED = 'h_CC'; const uint32 H_CITY_SET = 'h_CS'; -//SetButton +// SetButton const uint32 H_SET_TIME_ZONE = 'hSTZ'; -//local and GMT settings +// local and GMT settings const uint32 RTC_SETTINGS = 'RTse'; // clock tick message const uint32 H_TIME_UPDATE ='obTU'; -//notice for clock ticks +// notice for clock ticks const uint32 H_TM_CHANGED = 'obTC'; -//notice for user changes +// notice for user changes const uint32 H_USER_CHANGE = 'obUC'; +// notices to hide or show the time zone preview +const uint32 H_HIDE_PREVIEW = 'hipr'; +const uint32 H_SHOW_PREVIEW = 'shpr'; + // local/ gmt radiobuttons const uint32 kRTCUpdate = '_rtc'; @@ -49,6 +53,8 @@ const uint32 kMsgChange = 'chng'; // change time finished const uint32 kChangeTimeFinished = 'tcfi'; +// GMT or localtime setting was changed +const uint32 kMsgClockSettingChanged = 'tsch'; #endif // _TIME_MESSAGES_H diff --git a/src/preferences/time/TimeWindow.cpp b/src/preferences/time/TimeWindow.cpp index e5f0ef7b20..56712456c8 100644 --- a/src/preferences/time/TimeWindow.cpp +++ b/src/preferences/time/TimeWindow.cpp @@ -92,6 +92,19 @@ TTimeWindow::MessageReceived(BMessage* message) _SetRevertStatus(); break; + case kMsgClockSettingChanged: + { + bool useGMTTime = true; + message->FindBool("UseGMT", &useGMTTime); + if (useGMTTime) { + BMessage show(H_SHOW_PREVIEW); + fTimeZoneView->MessageReceived(&show); + } else { + BMessage hide(H_HIDE_PREVIEW); + fTimeZoneView->MessageReceived(&hide); + } + } + default: BWindow::MessageReceived(message); break; diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index 5c97318ec0..44ae77ff5d 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -162,6 +162,16 @@ TimeZoneView::MessageReceived(BMessage* message) break; } + case H_HIDE_PREVIEW: + fCurrent->Hide(); + fPreview->Hide(); + break; + + case H_SHOW_PREVIEW: + fCurrent->Show(); + fPreview->Show(); + break; + case kMsgRevert: _Revert(); break; From c0d5825b50f162526e28ab6ffa9f59454901e2ae Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 30 Oct 2011 08:33:54 +0000 Subject: [PATCH 530/702] Move string constants out of ifdef blocks so they can be collected by collectcatkeys. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42991 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../mail_daemon/outbound_protocols/smtp/ConfigView.cpp | 9 ++++++--- src/apps/deskbar/BeMenu.cpp | 10 +++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp b/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp index d1b877d8b3..1477401cb6 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp @@ -43,10 +43,13 @@ SMTPConfigView::SMTPConfigView(MailAddonSettings& settings, #endif ) { + static const char* kUnencryptedStr = B_TRANSLATE_MARK("Unencrypted"); + static const char* kSSLStr = B_TRANSLATE_MARK("SSL"); + static const char* kSTARTTLSStr = B_TRANSLATE_MARK("STARTTLS"); #ifdef USE_SSL - AddFlavor(B_TRANSLATE("Unencrypted")); - AddFlavor(B_TRANSLATE("SSL")); - AddFlavor(B_TRANSLATE("STARTTLS")); + AddFlavor(B_TRANSLATE_NOCOLLECT(kUnencryptedStr)); + AddFlavor(B_TRANSLATE(kSSLStr)); + AddFlavor(B_TRANSLATE(kSTARTTLSStr)); #endif AddAuthMethod(B_TRANSLATE("None"), false); diff --git a/src/apps/deskbar/BeMenu.cpp b/src/apps/deskbar/BeMenu.cpp index 69ab0125a1..6017f44094 100644 --- a/src/apps/deskbar/BeMenu.cpp +++ b/src/apps/deskbar/BeMenu.cpp @@ -244,13 +244,13 @@ TBeMenu::AddStandardBeMenuItems() AddSeparatorItem(); } -#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL +// One of them is used if HAIKU_DISTRO_COMPATIBILITY_OFFICIAL, and the other if +// not. However, we want both of them to end up in the catalog, so we have to +// put them outside of the ifdef block. static const char* kAboutHaikuMenuItemStr = B_TRANSLATE_MARK( "About Haiku"); -#else static const char* kAboutThisSystemMenuItemStr = B_TRANSLATE_MARK( "About this system"); -#endif item = new BMenuItem( #ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL @@ -305,9 +305,9 @@ TBeMenu::AddStandardBeMenuItems() item->SetEnabled(!dragging); shutdownMenu->AddItem(item); -#ifdef APM_SUPPORT + // String outside of ifdef block for collectcatkeys purposes static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend"); - +#ifdef APM_SUPPORT if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kSuspendMenuItemStr), new BMessage(kSuspendSystem)); From 7bc85684918f9cdfeaf53d3d2f26ef8c79954b3a Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sun, 30 Oct 2011 08:53:57 +0000 Subject: [PATCH 531/702] John Scipione has moved from a contributor to a maintainer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42992 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/aboutsystem/AboutSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 0ea0be0395..4ac2a16973 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -989,6 +989,7 @@ AboutView::_CreateCreditsView() "Michael Pfeiffer\n" "François Revol\n" "Philippe Saint-Pierre\n" + "John Scipione\n" "Andrej Spielmann\n" "Jonas Sundström\n" "Oliver Tappe\n" @@ -1126,7 +1127,6 @@ AboutView::_CreateCreditsView() "Thomas Roell\n" "Rafael Romo\n" "Ralf Schülke\n" - "John Scipione\n" "Reznikov Sergei\n" "Zousar Shaker\n" "Caitlin Shaw\n" From 5b264395c068fa5a9b22121bafc5ae58197710e6 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 30 Oct 2011 09:10:23 +0000 Subject: [PATCH 532/702] Patch by Karvjorm (#7348): localize Pairs application name. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42993 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/pairs/Jamfile | 5 +++++ src/apps/pairs/Pairs.cpp | 1 - src/apps/pairs/PairsView.cpp | 9 ++++++--- src/apps/pairs/PairsWindow.cpp | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/apps/pairs/Jamfile b/src/apps/pairs/Jamfile index a8585d066f..3127be1c09 100644 --- a/src/apps/pairs/Jamfile +++ b/src/apps/pairs/Jamfile @@ -16,3 +16,8 @@ DoCatalogs Pairs : PairsView.cpp PairsWindow.cpp ; + +AddCatalogEntryAttribute Pairs + : + x-vnd.Haiku-Pairs:PairsWindow:Pairs +; diff --git a/src/apps/pairs/Pairs.cpp b/src/apps/pairs/Pairs.cpp index 7c3798edb3..0857716530 100644 --- a/src/apps/pairs/Pairs.cpp +++ b/src/apps/pairs/Pairs.cpp @@ -7,7 +7,6 @@ #include #include -#include #include "Pairs.h" #include "PairsWindow.h" diff --git a/src/apps/pairs/PairsView.cpp b/src/apps/pairs/PairsView.cpp index 6cee5dae66..1041b03409 100644 --- a/src/apps/pairs/PairsView.cpp +++ b/src/apps/pairs/PairsView.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -171,8 +170,12 @@ PairsView::_ReadRandomIcons() snprintf(buffer, sizeof(buffer), B_TRANSLATE("Pairs did not find " "enough vector icons in the system; it needs at least %d."), fNumOfCards / 2); - BAlert* alert = new BAlert("fatal", buffer, B_TRANSLATE("OK"), - NULL, NULL, B_WIDTH_FROM_WIDEST, B_STOP_ALERT); + BString msgStr(buffer); + msgStr << "\n"; + BAlert* alert = new BAlert("Fatal", msgStr.String(), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_WIDEST, + B_STOP_ALERT); + alert->SetShortcut(0, B_ESCAPE); alert->Go(); exit(1); } diff --git a/src/apps/pairs/PairsWindow.cpp b/src/apps/pairs/PairsWindow.cpp index 03ade3f296..a78fddfe38 100644 --- a/src/apps/pairs/PairsWindow.cpp +++ b/src/apps/pairs/PairsWindow.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -247,6 +246,7 @@ PairsWindow::MessageReceived(BMessage* message) view->SetFontAndColor(0, strlen(B_TRANSLATE_SYSTEM_NAME("Pairs")), &font); view->ResizeToPreferred(); + alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) { // New game From b50f9c8616000379e70708e4656efa81b8a0c42b Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 30 Oct 2011 10:53:07 +0000 Subject: [PATCH 533/702] Build fix. These lines otherwise trigger unused variable errors on gcc4. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42994 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/BeMenu.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/apps/deskbar/BeMenu.cpp b/src/apps/deskbar/BeMenu.cpp index 6017f44094..d51bc8cf7e 100644 --- a/src/apps/deskbar/BeMenu.cpp +++ b/src/apps/deskbar/BeMenu.cpp @@ -58,6 +58,18 @@ All rights reserved. #define ROSTER_SIG "application/x-vnd.Be-ROST" + +// One of them is used if HAIKU_DISTRO_COMPATIBILITY_OFFICIAL, and the other if +// not. However, we want both of them to end up in the catalog, so we have to +// put them outside of the ifdef block. +static const char* skSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend"); +static const char* skAboutHaikuMenuItemStr = B_TRANSLATE_MARK( + "About Haiku"); +static const char* skAboutThisSystemMenuItemStr = B_TRANSLATE_MARK( + "About this system"); + + + #ifdef MOUNT_MENU_IN_DESKBAR class DeskbarMountMenu : public BPrivate::MountMenu { @@ -244,19 +256,11 @@ TBeMenu::AddStandardBeMenuItems() AddSeparatorItem(); } -// One of them is used if HAIKU_DISTRO_COMPATIBILITY_OFFICIAL, and the other if -// not. However, we want both of them to end up in the catalog, so we have to -// put them outside of the ifdef block. - static const char* kAboutHaikuMenuItemStr = B_TRANSLATE_MARK( - "About Haiku"); - static const char* kAboutThisSystemMenuItemStr = B_TRANSLATE_MARK( - "About this system"); - item = new BMenuItem( #ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL - B_TRANSLATE_NOCOLLECT(kAboutHaikuMenuItemStr) + B_TRANSLATE_NOCOLLECT(skAboutHaikuMenuItemStr) #else - B_TRANSLATE_NOCOLLECT(kAboutThisSystemMenuItemStr) + B_TRANSLATE_NOCOLLECT(skAboutThisSystemMenuItemStr) #endif , new BMessage(kShowSplash)); item->SetEnabled(!dragging); @@ -305,11 +309,9 @@ TBeMenu::AddStandardBeMenuItems() item->SetEnabled(!dragging); shutdownMenu->AddItem(item); - // String outside of ifdef block for collectcatkeys purposes - static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend"); #ifdef APM_SUPPORT if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { - item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kSuspendMenuItemStr), + item = new BMenuItem(B_TRANSLATE_NOCOLLECT(skSuspendMenuItemStr), new BMessage(kSuspendSystem)); item->SetEnabled(!dragging); shutdownMenu->AddItem(item); From 25342134e74a516ebe530cbc43cb84d924967394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 30 Oct 2011 11:00:09 +0000 Subject: [PATCH 534/702] * Started a very simple test application for the IMAP add-on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42995 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/add-ons/Jamfile | 1 + src/tests/add-ons/mail/Jamfile | 3 + src/tests/add-ons/mail/imap/Jamfile | 29 +++ src/tests/add-ons/mail/imap/imap_tester.cpp | 198 ++++++++++++++++++++ 4 files changed, 231 insertions(+) create mode 100644 src/tests/add-ons/mail/Jamfile create mode 100644 src/tests/add-ons/mail/imap/Jamfile create mode 100644 src/tests/add-ons/mail/imap/imap_tester.cpp diff --git a/src/tests/add-ons/Jamfile b/src/tests/add-ons/Jamfile index e94c3e0eb1..26a4111a69 100644 --- a/src/tests/add-ons/Jamfile +++ b/src/tests/add-ons/Jamfile @@ -3,6 +3,7 @@ SubDir HAIKU_TOP src tests add-ons ; SubInclude HAIKU_TOP src tests add-ons input_server ; SubInclude HAIKU_TOP src tests add-ons index_server ; SubInclude HAIKU_TOP src tests add-ons kernel ; +SubInclude HAIKU_TOP src tests add-ons mail ; SubInclude HAIKU_TOP src tests add-ons media ; SubInclude HAIKU_TOP src tests add-ons opengl ; SubInclude HAIKU_TOP src tests add-ons print ; diff --git a/src/tests/add-ons/mail/Jamfile b/src/tests/add-ons/mail/Jamfile new file mode 100644 index 0000000000..8008d13b1f --- /dev/null +++ b/src/tests/add-ons/mail/Jamfile @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP src tests add-ons mail ; + +SubInclude HAIKU_TOP src tests add-ons mail imap ; diff --git a/src/tests/add-ons/mail/imap/Jamfile b/src/tests/add-ons/mail/imap/Jamfile new file mode 100644 index 0000000000..ebee62a704 --- /dev/null +++ b/src/tests/add-ons/mail/imap/Jamfile @@ -0,0 +1,29 @@ +SubDir HAIKU_TOP src tests add-ons mail imap ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +UsePrivateHeaders mail shared ; +SubDirHdrs [ FDirName $(HAIKU_TOP) src tests add-ons kernel file_systems + fs_shell ] ; +SubDirHdrs [ FDirName $(HAIKU_TOP) src add-ons mail_daemon inbound_protocols + imap imap_lib ] ; + +local libSources = IMAPFolders.cpp IMAPHandler.cpp IMAPMailbox.cpp + IMAPParser.cpp IMAPProtocol.cpp IMAPStorage.cpp ; + +SimpleTest imap_tester : + imap_tester.cpp + $(libSources) + + # from fs_shell + argv.c + + : be $(TARGET_LIBSUPC++) mail +; + +SEARCH on [ FGristFiles $(libSources) ] + = [ FDirName $(HAIKU_TOP) src add-ons mail_daemon inbound_protocols imap + imap_lib ] ; + +SEARCH on [ FGristFiles argv.c ] = [ FDirName $(HAIKU_TOP) src tests add-ons + kernel file_systems fs_shell ] ; diff --git a/src/tests/add-ons/mail/imap/imap_tester.cpp b/src/tests/add-ons/mail/imap/imap_tester.cpp new file mode 100644 index 0000000000..188178f2e3 --- /dev/null +++ b/src/tests/add-ons/mail/imap/imap_tester.cpp @@ -0,0 +1,198 @@ +#include "IMAPFolders.h" +#include "IMAPMailbox.h" +#include "IMAPStorage.h" + +#include "argv.h" + + +struct cmd_entry { + char* name; + void (*func)(int argc, char **argv); + char* help; +}; + + +static void do_help(int argc, char** argv); + + +extern const char* __progname; +static const char* kProgramName = __progname; + +static IMAPStorage sStorage; +static IMAPMailbox sMailbox(sStorage); + + +static void +error(const char* context, status_t status) +{ + fprintf(stderr, "Error during %s: %s\n", context, strerror(status)); +} + + +static void +usage() +{ + printf("Usage: %s \n", kProgramName); + exit(1); +} + + +// #pragma mark - + + +static void +do_select(int argc, char** argv) +{ + const char* folder = "INBOX"; + if (argc > 1) + folder = argv[1]; + + status_t status = sMailbox.SelectMailbox(folder); + if (status != B_OK) + error("select", status); +} + + +static void +do_folders(int argc, char** argv) +{ + IMAPFolders folder(sMailbox); + FolderList folders; + status_t status = folder.GetFolders(folders); + if (status != B_OK) + error("folders", status); + + for (size_t i = 0; i < folders.size(); i++) { + printf(" %s %s\n", folders[i].subscribed ? "*" : " ", + folders[i].folder.String()); + } +} + + +static void +do_raw(int argc, char** argv) +{ + // build command back again + char command[4096]; + command[0] = '\0'; + + for (int i = 1; i < argc; i++) { + if (i > 1) + strlcat(command, " ", sizeof(command)); + strlcat(command, argv[i], sizeof(command)); + } + + class RawCommand : public IMAPCommand { + public: + RawCommand(const char* command) + : + fCommand(command) + { + } + + BString Command() + { + return fCommand; + } + + bool Handle(const BString& response) + { + return false; + } + + private: + const char* fCommand; + }; + RawCommand rawCommand(command); + status_t status = sMailbox.ProcessCommand(&rawCommand, 60 * 1000); + if (status != B_OK) + error("raw", status); +} + + +static cmd_entry sBuiltinCommands[] = { + {"select", do_select, "Selects a mailbox, defaults to INBOX"}, + {"folders", do_folders, "List of existing folders"}, + {"raw", do_raw, "Issue a raw command to the server"}, + {"help", do_help, "prints this help text"}, + {"quit", NULL, "exits the application"}, + {NULL, NULL, NULL}, +}; + + +static void +do_help(int argc, char** argv) +{ + printf("Available commands:\n"); + + for (cmd_entry* command = sBuiltinCommands; command->name != NULL; + command++) { + printf("%8s - %s\n", command->name, command->help); + } +} + + +// #pragma mark - + + +int +main(int argc, char** argv) +{ + if (argc < 4) + usage(); + + const char* server = argv[1]; + const char* user = argv[2]; + const char* password = argv[3]; + bool useSSL = argc > 4; + uint16 port = useSSL ? 995 : 143; + + printf("Connecting to \"%s\" as %s\n", server, user); + + status_t status = sMailbox.Connect(server, user, password, useSSL, port); + if (status != B_OK) { + error("connect", status); + return 1; + } + + while (true) { + printf("> "); + fflush(stdout); + + char line[1024]; + if (fgets(line, sizeof(line), stdin) == NULL) + break; + + argc = 0; + argv = build_argv(line, &argc); + if (argv == NULL || argc == 0) + continue; + + if (!strcmp(argv[0], "quit") + || !strcmp(argv[0], "exit") + || !strcmp(argv[0], "q")) + break; + + int length = strlen(argv[0]); + bool found = false; + + for (cmd_entry* command = sBuiltinCommands; command->name != NULL; + command++) { + if (!strncmp(command->name, argv[0], length)) { + command->func(argc, argv); + found = true; + break; + } + } + + if (!found) { + fprintf(stderr, "Unknown command \"%s\". Type \"help\" for a " + "list of commands.\n", argv[0]); + } + + free(argv); + } + + + return 0; +} From 3b7d1b050fcb69d93fd672ed96c91ad701d9bf24 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 30 Oct 2011 12:48:18 +0000 Subject: [PATCH 535/702] Use the proper define to make the string visible only to collectcatkeys. Makes gcc4 happy. Sorry for the inconvenience, build fixed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42996 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../outbound_protocols/smtp/ConfigView.cpp | 3 ++ src/apps/deskbar/BeMenu.cpp | 33 ++++++++++--------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp b/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp index 1477401cb6..083bea1402 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp @@ -43,9 +43,12 @@ SMTPConfigView::SMTPConfigView(MailAddonSettings& settings, #endif ) { +#if defined(USE_SSL) || defined(B_COLLECTING_CATKEYS) static const char* kUnencryptedStr = B_TRANSLATE_MARK("Unencrypted"); static const char* kSSLStr = B_TRANSLATE_MARK("SSL"); static const char* kSTARTTLSStr = B_TRANSLATE_MARK("STARTTLS"); +#endif + #ifdef USE_SSL AddFlavor(B_TRANSLATE_NOCOLLECT(kUnencryptedStr)); AddFlavor(B_TRANSLATE(kSSLStr)); diff --git a/src/apps/deskbar/BeMenu.cpp b/src/apps/deskbar/BeMenu.cpp index d51bc8cf7e..240500e6f8 100644 --- a/src/apps/deskbar/BeMenu.cpp +++ b/src/apps/deskbar/BeMenu.cpp @@ -58,18 +58,6 @@ All rights reserved. #define ROSTER_SIG "application/x-vnd.Be-ROST" - -// One of them is used if HAIKU_DISTRO_COMPATIBILITY_OFFICIAL, and the other if -// not. However, we want both of them to end up in the catalog, so we have to -// put them outside of the ifdef block. -static const char* skSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend"); -static const char* skAboutHaikuMenuItemStr = B_TRANSLATE_MARK( - "About Haiku"); -static const char* skAboutThisSystemMenuItemStr = B_TRANSLATE_MARK( - "About this system"); - - - #ifdef MOUNT_MENU_IN_DESKBAR class DeskbarMountMenu : public BPrivate::MountMenu { @@ -256,11 +244,24 @@ TBeMenu::AddStandardBeMenuItems() AddSeparatorItem(); } +// One of them is used if HAIKU_DISTRO_COMPATIBILITY_OFFICIAL, and the other if +// not. However, we want both of them to end up in the catalog, so we have to +// make them visible to collectcatkeys in either case. +#if defined(B_COLLECTING_CATKEYS)||defined(HAIKU_DISTRO_COMPATIBILITY_OFFICIAL) + static const char* kAboutHaikuMenuItemStr = B_TRANSLATE_MARK( + "About Haiku"); +#endif + +#if defined(B_COLLECTING_CATKEYS)||!defined(HAIKU_DISTRO_COMPATIBILITY_OFFICIAL) + static const char* kAboutThisSystemMenuItemStr = B_TRANSLATE_MARK( + "About this system"); +#endif + item = new BMenuItem( #ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL - B_TRANSLATE_NOCOLLECT(skAboutHaikuMenuItemStr) + B_TRANSLATE_NOCOLLECT(kAboutHaikuMenuItemStr) #else - B_TRANSLATE_NOCOLLECT(skAboutThisSystemMenuItemStr) + B_TRANSLATE_NOCOLLECT(kAboutThisSystemMenuItemStr) #endif , new BMessage(kShowSplash)); item->SetEnabled(!dragging); @@ -309,9 +310,11 @@ TBeMenu::AddStandardBeMenuItems() item->SetEnabled(!dragging); shutdownMenu->AddItem(item); + // String outside of ifdef block for collectcatkeys purposes + static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend"); #ifdef APM_SUPPORT if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { - item = new BMenuItem(B_TRANSLATE_NOCOLLECT(skSuspendMenuItemStr), + item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kSuspendMenuItemStr), new BMessage(kSuspendSystem)); item->SetEnabled(!dragging); shutdownMenu->AddItem(item); From d07738ee1dc2667ee010031028461e89c78800ff Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 30 Oct 2011 13:46:43 +0000 Subject: [PATCH 536/702] Apply the same fix as r42996 for the suspend string as well. Fixes build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42997 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/BeMenu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apps/deskbar/BeMenu.cpp b/src/apps/deskbar/BeMenu.cpp index 240500e6f8..206076601a 100644 --- a/src/apps/deskbar/BeMenu.cpp +++ b/src/apps/deskbar/BeMenu.cpp @@ -310,8 +310,10 @@ TBeMenu::AddStandardBeMenuItems() item->SetEnabled(!dragging); shutdownMenu->AddItem(item); - // String outside of ifdef block for collectcatkeys purposes +#if defined(APM_SUPPORT) || defined(B_COLLECTING_CATKEYS) static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend"); +#endif + #ifdef APM_SUPPORT if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kSuspendMenuItemStr), From 500b53f5db27074f66beda999556103c9b18aa76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 30 Oct 2011 14:07:57 +0000 Subject: [PATCH 537/702] Add kdlhangman to the image since this wonderful thing actually still works fine ;-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42998 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 0c505c98a0..cb5f426201 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -234,7 +234,7 @@ AddFilesToHaikuImage system add-ons kernel busses usb : uhci ohci ehci ; AddFilesToHaikuImage system add-ons kernel console : vga_text ; AddFilesToHaikuImage system add-ons kernel debugger - : demangle $(X86_ONLY)disasm + : demangle $(X86_ONLY)disasm hangman invalidate_on_exit usb_keyboard run_on_exit ; AddFilesToHaikuImage system add-ons kernel file_systems : $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ; From cba6e1d06ded22a47246a477461506f2212ad36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 30 Oct 2011 16:01:36 +0000 Subject: [PATCH 538/702] Just use ntfs_attr_add() since the non_resident version doesn't seem to work, can't remember why I wanted to force non-resident attributes in the first place. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43000 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/ntfs/attributes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/add-ons/kernel/file_systems/ntfs/attributes.c b/src/add-ons/kernel/file_systems/ntfs/attributes.c index d2491b4819..2d5aa4d304 100644 --- a/src/add-ons/kernel/file_systems/ntfs/attributes.c +++ b/src/add-ons/kernel/file_systems/ntfs/attributes.c @@ -285,11 +285,12 @@ fs_create_attrib(fs_volume *_vol, fs_vnode *_node, const char* name, strerror(result)); goto exit; } - if (ntfs_non_resident_attr_record_add(ni, AT_DATA, uname, ulen, 0, 32, - 0) < 0) { + //if (ntfs_non_resident_attr_record_add(ni, AT_DATA, uname, ulen, 0, 32, + // 0) < 0) { + if (ntfs_attr_add(ni, AT_DATA, uname, ulen, NULL, 0) < 0) { result = errno; - ERROR("%s - ntfs_non_resident_attr_record_add: %s\n", - __FUNCTION__, strerror(result)); + //ERROR("%s - ntfs_non_resident_attr_record_add: %s\n", + ERROR("%s - ntfs_attr_add: %s\n", __FUNCTION__, strerror(result)); goto exit; } na = ntfs_attr_open(ni, AT_DATA, uname, ulen); From f045f44c7af112451975fd6b2c82f09e4b1cb2db Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 30 Oct 2011 16:13:13 +0000 Subject: [PATCH 539/702] Patch by taos : localize TGA and STX translator. Fixes #7229. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43001 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/translators/stxt/STXTView.cpp | 13 ++++++++++--- src/add-ons/translators/tga/TGAView.cpp | 17 +++++++++-------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/add-ons/translators/stxt/STXTView.cpp b/src/add-ons/translators/stxt/STXTView.cpp index da4a00d169..edfb284744 100644 --- a/src/add-ons/translators/stxt/STXTView.cpp +++ b/src/add-ons/translators/stxt/STXTView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Haiku, Inc. All rights reserved. + * Copyright 2002-2011, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -13,11 +13,16 @@ #include "STXTView.h" #include "STXTTranslator.h" +#include #include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "STXTView" + + STXTView::STXTView(const BRect &frame, const char *name, uint32 resizeMode, uint32 flags, TranslatorSettings *settings) : BView(frame, name, resizeMode, flags) @@ -30,7 +35,8 @@ STXTView::STXTView(const BRect &frame, const char *name, uint32 resizeMode, float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; BRect rect(10, 10, 200, 10 + height); - BStringView *stringView = new BStringView(rect, "title", "StyledEdit files translator"); + BStringView *stringView = new BStringView(rect, "title", + B_TRANSLATE("StyledEdit files translator")); stringView->SetFont(be_bold_font); stringView->ResizeToPreferred(); AddChild(stringView); @@ -55,7 +61,8 @@ STXTView::STXTView(const BRect &frame, const char *name, uint32 resizeMode, height = fontHeight.descent + fontHeight.ascent + fontHeight.leading; rect.OffsetBy(0, height + 5); - stringView = new BStringView(rect, "Copyright", B_UTF8_COPYRIGHT "2002-2006 Haiku Inc."); + stringView = new BStringView(rect, "Copyright", + B_UTF8_COPYRIGHT "2002-2006 Haiku Inc."); stringView->ResizeToPreferred(); AddChild(stringView); diff --git a/src/add-ons/translators/tga/TGAView.cpp b/src/add-ons/translators/tga/TGAView.cpp index 393ecdd946..f27e5e15ca 100644 --- a/src/add-ons/translators/tga/TGAView.cpp +++ b/src/add-ons/translators/tga/TGAView.cpp @@ -52,9 +52,9 @@ TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings) SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ViewColor()); - fTitle = new BStringView("title", "TGA Image Translator"); + fTitle = new BStringView("title", B_TRANSLATE("TGA Image Translator")); fTitle->SetFont(be_bold_font); - + char detail[100]; sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"), static_cast(B_TRANSLATION_MAJOR_VERSION(TGA_TRANSLATOR_VERSION)), @@ -64,22 +64,22 @@ TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings) fDetail = new BStringView("detail", detail); fWrittenBy = new BStringView("writtenby", B_TRANSLATE("Written by the Haiku Translation Kit Team")); - + fpchkIgnoreAlpha = new BCheckBox(B_TRANSLATE("Ignore TGA alpha channel"), new BMessage(CHANGE_IGNORE_ALPHA)); int32 val = (fSettings->SetGetBool(TGA_SETTING_IGNORE_ALPHA)) ? 1 : 0; fpchkIgnoreAlpha->SetValue(val); fpchkIgnoreAlpha->SetViewColor(ViewColor()); - + fpchkRLE = new BCheckBox(B_TRANSLATE("Save with RLE Compression"), new BMessage(CHANGE_RLE)); val = (fSettings->SetGetBool(TGA_SETTING_RLE)) ? 1 : 0; fpchkRLE->SetValue(val); fpchkRLE->SetViewColor(ViewColor()); - + // Build the layout SetLayout(new BGroupLayout(B_HORIZONTAL)); - + AddChild(BGroupLayoutBuilder(B_VERTICAL, 7) .Add(fTitle) .Add(fDetail) @@ -91,10 +91,11 @@ TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings) .AddGlue() .SetInsets(5, 5, 5, 5) ); - + BFont font; GetFont(&font); - SetExplicitPreferredSize(BSize((font.Size() * 333)/12, (font.Size() * 200)/12)); + SetExplicitPreferredSize(BSize((font.Size() * 333)/12, + (font.Size() * 200)/12)); } From 93676a6f0bcae89dab56191fead1a0e3403cefb0 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sun, 30 Oct 2011 16:38:39 +0000 Subject: [PATCH 540/702] Automatic whitespace cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43002 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../methods/canna/CannaInterface.cpp | 96 +++++++++---------- .../methods/canna/CannaInterface.h | 2 +- .../methods/canna/CannaLooper.cpp | 8 +- .../methods/canna/CannaMethod.cpp | 16 ++-- .../input_server/methods/canna/CannaMethod.h | 4 +- .../methods/canna/KouhoWindow.cpp | 62 ++++++------ .../input_server/methods/canna/KouhoWindow.h | 2 +- .../methods/canna/PaletteWindow.cpp | 44 ++++----- 8 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/add-ons/input_server/methods/canna/CannaInterface.cpp b/src/add-ons/input_server/methods/canna/CannaInterface.cpp index 4815fb8103..c08f321215 100644 --- a/src/add-ons/input_server/methods/canna/CannaInterface.cpp +++ b/src/add-ons/input_server/methods/canna/CannaInterface.cpp @@ -30,19 +30,19 @@ void CannaInterface::InitializeCanna() { char **warn; - + context_id = 0; //context id is now fixed to zero. #ifdef DEBUG SERIAL_PRINT(( "CannaInterface:Setting basepath to %s.\n", basePath )); #endif - + setBasePath( basePath ); - + jrKanjiControl(context_id, KC_INITIALIZE, (char *)&warn); #ifdef DEBUG SERIAL_PRINT(( "CannaInterface:Canna Initialize result = %x.\n", warn )); #endif - + if (warn) { canna_enabled = false; @@ -55,12 +55,12 @@ CannaInterface::InitializeCanna() jrKanjiControl( context_id, KC_SETMODEINFOSTYLE, (char *)(int32) 0); jrKanjiControl(context_id, KC_SETHEXINPUTSTYLE, (char *)(int32) 1); - + jrKanjiControl( context_id, KC_SETUNDEFKEYFUNCTION, (char *)(int32) kc_through ); jrKanjiStatusWithValue ks; uchar buf[CONVERT_BUFFER_SIZE]; - + ks.val = CANNA_MODE_HenkanMode; ks.buffer = buf; ks.bytes_buffer = CONVERT_BUFFER_SIZE; @@ -104,10 +104,10 @@ status_t CannaInterface::InitCheck() uint32 CannaInterface::KeyIn( char ch, uint32 mod, int32 key ) { int inkey; - + inkey = ConvertSpecial( ch, mod, key ); #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x%x\n", inkey )); +SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x%x\n", inkey )); #endif if ( convert_arrowkey && kanji_status.gline.length != 0 ) inkey = ConvertArrowKey( inkey ); @@ -122,18 +122,18 @@ SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x strcpy( previousUTF, mikakuteiUTF ); hadMikakuteiStr = true; } -*/ +*/ #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: Calling jrKanjiString()...\n" )); +SERIAL_PRINT(( "CannaInterface: Calling jrKanjiString()...\n" )); #endif kakuteiLen = jrKanjiString(context_id, inkey, kakuteiStr, CONVERT_BUFFER_SIZE, &kanji_status); #ifdef DEBUG -SERIAL_PRINT(( "kakL = %d, mikL = %d, glineL = %d, info = 0x%x\n", kakuteiLen, kanji_status.length, kanji_status.gline.length, kanji_status.info )); +SERIAL_PRINT(( "kakL = %d, mikL = %d, glineL = %d, info = 0x%x\n", kakuteiLen, kanji_status.length, kanji_status.gline.length, kanji_status.info )); #endif //return UpdateKanjiStatus(); uint32 result = UpdateKanjiStatus(); #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: KeyIn() returning 0x%x.\n", result )); +SERIAL_PRINT(( "CannaInterface: KeyIn() returning 0x%x.\n", result )); #endif return result; } @@ -142,7 +142,7 @@ uint32 CannaInterface::UpdateKanjiStatus() { uint32 result = 0; #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); +SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); #endif if ( hadGuideLine && kanji_status.gline.length == 0 ) @@ -150,13 +150,13 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); result |= GUIDELINE_DISAPPEARED; hadGuideLine = false; } - + if ( kanji_status.length == -1 ) { result |= MIKAKUTEI_NO_CHANGE; return result; } - + if ( kanji_status.info & KanjiThroughInfo ) { result |= THROUGH_INPUT; @@ -172,7 +172,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); jrKanjiControl( context_id, KC_SETMODEINFOSTYLE, (char *)(int32) 0); result |= MODE_CHANGED; } - + if ( !hadMikakuteiStr && (kanji_status.length != 0 || kakuteiLen != 0 )) { //ClearPrevious(); @@ -207,7 +207,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); result |= MIKAKUTEI_EXISTS; } - + //when mikakutei string is deleted and become empty if ( hadMikakuteiStr && kanji_status.length == 0 && kakuteiLen == 0 ) result |= MIKAKUTEI_BECOME_EMPTY; @@ -219,13 +219,13 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); if ( hadGuideLine && (kanji_status.info & KanjiGLineInfo) ) result |= GUIDELINE_CHANGED; - + if ( !hadGuideLine && kanji_status.gline.length != 0 ) { result |= GUIDELINE_APPEARED; hadGuideLine = true; } - + // calculate revpos, revlen if ( kanji_status.revLen == 0 ) { @@ -239,7 +239,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.echoStr, &length, mikakuteiUTF, &revBegin, &state ); revBegin += kakuteiUTFLen; - + length = kanji_status.revPos + kanji_status.revLen; revEnd = CONVERT_BUFFER_SIZE * 2; convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.echoStr, &length, @@ -247,7 +247,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); revEnd += kakuteiUTFLen; } #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: UpdateKanjiStatus() returning 0x%x.\n", result )); +SERIAL_PRINT(( "CannaInterface: UpdateKanjiStatus() returning 0x%x.\n", result )); #endif return result; } @@ -269,7 +269,7 @@ int CannaInterface::ConvertSpecial(char ch, uint32 mod, int32 key) { #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: ConvertSpecial ch = 0x%x, mod = 0x%x, key = 0x%x\n", ch, mod, key )); +SERIAL_PRINT(( "CannaInterface: ConvertSpecial ch = 0x%x, mod = 0x%x, key = 0x%x\n", ch, mod, key )); #endif if (mod & B_CONTROL_KEY) { // if control key is held down, do not convert special key @@ -372,7 +372,7 @@ void CannaInterface::GetModified( int32* from, int32* to, char** string ) { int32 i, previousLen; previousLen = strlen( previousUTF ); - + for( i = 0 ; mikakuteiUTF[i] == previousUTF[i] && mikakuteiUTF[i] != '\0' @@ -380,12 +380,12 @@ void CannaInterface::GetModified( int32* from, int32* to, char** string ) i++ ) {} *from = i; - + if ( mikakuteiUTFLen > previousLen ) *to = mikakuteiUTFLen; else *to = previousLen; - + *string = &mikakuteiUTF[ i ]; } @@ -393,7 +393,7 @@ int32 CannaInterface::ForceKakutei() { if ( !canna_enabled ) return 0; - + jrKanjiStatusWithValue ks; ks.val = 0; ks.buffer = (unsigned char *)kakuteiStr; @@ -409,14 +409,14 @@ bool CannaInterface::ReadSetting(char *path, BFont *aFont) BFile preffile( INLINE_SETTING_FILE, B_READ_ONLY ); if ( preffile.InitCheck() != B_NO_ERROR ) return false; - + if ( pref.Unflatten( &preffile ) != B_OK ) return false; - + font_family fontfamily; float size; char *string; - + underline_color = FindColorData( &pref, "underline" ); highlight_color = FindColorData( &pref, "highlight" ); selection_color = FindColorData( &pref, "selection" ); @@ -427,7 +427,7 @@ bool CannaInterface::ReadSetting(char *path, BFont *aFont) pref.FindFloat( "size", &size ); pref.FindBool( "arrow", &convert_arrowkey ); - aFont->SetFamilyAndStyle( fontfamily, NULL ); + aFont->SetFamilyAndStyle( fontfamily, NULL ); aFont->SetSize( size ); return true; } @@ -442,7 +442,7 @@ rgb_color CannaInterface::FindColorData( BMessage *msg, char *name ) return result; } */ - + bool CannaInterface::HasRev() { if ( kanji_status.revLen == 0 ) @@ -462,17 +462,17 @@ CannaInterface::GenerateKouhoString() int32 state; bool noindex, sizelimit, partialhighlight; #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mode = %d\n", revposition, kanji_status.gline.revLen, current_mode )); +SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mode = %d\n", revposition, kanji_status.gline.revLen, current_mode )); #endif - + noindex = sizelimit = partialhighlight = false; - + kouhoUTFLen = KOUHO_WINDOW_MAXCHAR * 2; convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.gline.line, &length, kouhoUTF, &kouhoUTFLen, &state ); kouhoUTF[ kouhoUTFLen ] = '\0'; - + //find gline revpos by converting to UTF8 if ( kanji_status.gline.revLen == 0 ) kouhoRevLine = -1; @@ -483,8 +483,8 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod kouhoUTF, &revposUTF, &state ); //then, count full-spaces before revpos kouhoRevLine = 0; - - if ( current_mode == CANNA_MODE_TourokuMode + + if ( current_mode == CANNA_MODE_TourokuMode || ( kanji_status.gline.length != 0 && current_mode != CANNA_MODE_KigoMode && current_mode != CANNA_MODE_IchiranMode && current_mode != CANNA_MODE_YesNoMode @@ -511,7 +511,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod { for ( long i = 0; i < revposUTF ; i++ ) { - if ( (uint8)kouhoUTF[ i ] == 0xe3 + if ( (uint8)kouhoUTF[ i ] == 0xe3 && (uint8)kouhoUTF[ i + 1 ] == 0x80 && (uint8)kouhoUTF[ i + 2 ] == 0x80 ) kouhoRevLine++; @@ -520,7 +520,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod } //printf("KouhoRevLine = %d\n", kouhoRevLine ); - + // setup title string switch ( current_mode ) { @@ -588,7 +588,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod //setup info string according to current mode char* index; int32 len; - + if (current_mode == CANNA_MODE_IchiranMode || current_mode == CANNA_MODE_ExtendMode || (current_mode == CANNA_MODE_TourokuHinshiMode @@ -632,7 +632,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod kouhoUTFLen = strlen(kouhoUTF); } /* - if ( current_mode == CANNA_MODE_TourokuMode + if ( current_mode == CANNA_MODE_TourokuMode || ( kanji_status.gline.length != 0 && ( current_mode == CANNA_MODE_TankouhoMode || current_mode == CANNA_MODE_TankouhoMode || current_mode == CANNA_MODE_AdjustBunsetsuMode ))) @@ -644,7 +644,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod *index = '\x0a'; } } -*/ +*/ if ( current_mode == CANNA_MODE_IchiranMode || current_mode == CANNA_MODE_RussianMode || current_mode == CANNA_MODE_LineMode @@ -662,7 +662,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod while ( ( *index >= '0' && *index <= '9' ) || *index == '/' ) index--; strcat( infoUTF, index ); - + //remove excess spaces before number display while ( *index == ' ' ) *index-- = '\0'; @@ -690,14 +690,14 @@ uint32 CannaInterface::ChangeMode( int32 mode ) ksv.buffer = (unsigned char *)kakuteiStr; ksv.bytes_buffer = CONVERT_BUFFER_SIZE; ksv.val = mode; - + jrKanjiControl( context_id, KC_CHANGEMODE, (char *)&ksv ); kakuteiLen = ksv.val; #ifdef DEBUG SERIAL_PRINT(( "CannaInterface: ChangeMode returned kakuteiLen = %d\n", kakuteiLen )); SERIAL_PRINT(( "CannaInterface: ChangeMode mikakuteiLen = %d\n", kanji_status.length )); #endif - + return UpdateKanjiStatus(); } @@ -712,7 +712,7 @@ uint32 CannaInterface::Kakutei() ksv.ks = &kanji_status; ksv.buffer = (unsigned char *)kakuteiStr; ksv.bytes_buffer = CONVERT_BUFFER_SIZE; - + jrKanjiControl( context_id, KC_KAKUTEI, (char *)&ksv ); kakuteiLen = ksv.val; #ifdef DEBUG @@ -751,13 +751,13 @@ CannaInterface::GetRevStartPositionInChar() { int32 charNum; charNum = 0; - + if ( mikakuteiUTFLen == 0 ) return 0; #ifdef DEBUG SERIAL_PRINT(( "CannaInterface: GetRevStartPos revBegin = %d\n", revBegin )); #endif - + for ( int32 i = 0 ; i < mikakuteiUTFLen ; i += UTF8CharLen( mikakuteiUTF[i] ) ) { diff --git a/src/add-ons/input_server/methods/canna/CannaInterface.h b/src/add-ons/input_server/methods/canna/CannaInterface.h index 2e80df82fb..ae125ccdb1 100644 --- a/src/add-ons/input_server/methods/canna/CannaInterface.h +++ b/src/add-ons/input_server/methods/canna/CannaInterface.h @@ -60,7 +60,7 @@ private: uint32 UpdateKanjiStatus(); void InitializeCanna(); - + public: CannaInterface( char *basepath ); ~CannaInterface(); diff --git a/src/add-ons/input_server/methods/canna/CannaLooper.cpp b/src/add-ons/input_server/methods/canna/CannaLooper.cpp index 61fd9a2f8f..d9ec2359a9 100644 --- a/src/add-ons/input_server/methods/canna/CannaLooper.cpp +++ b/src/add-ons/input_server/methods/canna/CannaLooper.cpp @@ -181,7 +181,7 @@ CannaLooper::MessageReceived(BMessage* msg) panel->Go(); break; } - + case RELOAD_INIT_FILE: _ForceKakutei(); fCanna->Reset(); @@ -425,7 +425,7 @@ CannaLooper::_HandleMethodActivated(bool active) { if (active) { if (!fPaletteWindow) { - // first time input method activated + // first time input method activated float x = gSettings.palette_loc.x; float y = gSettings.palette_loc.y; BRect frame(x, y, x + 114, y + 44); @@ -448,8 +448,8 @@ CannaLooper::_HandleMethodActivated(bool active) fOwner->SetMenu(NULL, this); } } - - + + void CannaLooper::_ForceKakutei() { diff --git a/src/add-ons/input_server/methods/canna/CannaMethod.cpp b/src/add-ons/input_server/methods/canna/CannaMethod.cpp index 972df41fa8..2e4a5d3eb4 100644 --- a/src/add-ons/input_server/methods/canna/CannaMethod.cpp +++ b/src/add-ons/input_server/methods/canna/CannaMethod.cpp @@ -1,6 +1,6 @@ // -// CannaIM - Canna-based Input Method Add-on for BeOS R4 -// +// CannaIM - Canna-based Input Method Add-on for BeOS R4 +// #include #include @@ -61,12 +61,12 @@ status_t CannaMethod::MethodActivated( bool active ) { BMessage msg( CANNA_METHOD_ACTIVATED ); - + if ( active ) msg.AddBool( "active", true ); - + cannaLooper.SendMessage( &msg ); - + return B_OK; } @@ -75,7 +75,7 @@ CannaMethod::Filter( BMessage *msg, BList *outList ) { if ( msg->what != B_KEY_DOWN ) return B_DISPATCH_MESSAGE; - + cannaLooper.SendMessage( msg ); return B_SKIP_MESSAGE; } @@ -99,7 +99,7 @@ CannaMethod::InitCheck() else SERIAL_PRINT(( "CannaLooper::InitCheck() success.\n" )); #endif - + return err; } @@ -133,7 +133,7 @@ void CannaMethod::WriteSettings() BMessage pref; BFile preffile( CANNAIM_SETTINGS_FILE, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE ); - + if ( preffile.InitCheck() == B_NO_ERROR ) { pref.AddBool( "arrowkey", gSettings.convert_arrowkey ); diff --git a/src/add-ons/input_server/methods/canna/CannaMethod.h b/src/add-ons/input_server/methods/canna/CannaMethod.h index 82b14b1f1a..e4ff975e72 100644 --- a/src/add-ons/input_server/methods/canna/CannaMethod.h +++ b/src/add-ons/input_server/methods/canna/CannaMethod.h @@ -1,6 +1,6 @@ // -// CannaIM - Canna-based Input Method Add-on for BeOS R4 -// +// CannaIM - Canna-based Input Method Add-on for BeOS R4 +// #ifndef _CANNAMETHOD_H #define _CANNAMETHOD_H diff --git a/src/add-ons/input_server/methods/canna/KouhoWindow.cpp b/src/add-ons/input_server/methods/canna/KouhoWindow.cpp index d297987ebc..1511d19b8e 100644 --- a/src/add-ons/input_server/methods/canna/KouhoWindow.cpp +++ b/src/add-ons/input_server/methods/canna/KouhoWindow.cpp @@ -19,7 +19,7 @@ KouhoWindow::KouhoWindow( BFont *font, BLooper *looper ) :BWindow( DUMMY_RECT, - "kouho", B_MODAL_WINDOW_LOOK, + "kouho", B_MODAL_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AVOID_FOCUS | @@ -38,15 +38,15 @@ KouhoWindow::KouhoWindow( BFont *font, BLooper *looper ) strcpy( style, "Regular" ); indexfont.SetFamilyAndStyle( family, style ); indexfont.SetSize( 10 ); - + #ifdef DEBUG SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" )); #endif - + //setup main pane indexWidth = indexfont.StringWidth( "W" ) + INDEXVIEW_SIDE_MARGIN * 2; minimumWidth = indexfont.StringWidth( "ギリシャ 100/100" ); - + frame = Bounds(); frame.left = indexWidth + 2; frame.bottom -= INFOVIEW_HEIGHT; @@ -64,7 +64,7 @@ SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" )); indexView = new KouhoIndexView( frame, fontHeight ); indexView->SetFont( &indexfont ); AddChild( indexView ); - + frame = Bounds(); frame.top = frame.bottom - INFOVIEW_HEIGHT + 1; infoView = new KouhoInfoView( frame ); @@ -78,7 +78,7 @@ void KouhoWindow::MessageReceived( BMessage* msg ) float height, width, x, y, w; BPoint point; BRect screenrect, frame; - + switch( msg->what ) { case KOUHO_WINDOW_HIDE: @@ -91,36 +91,36 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_HIDE recieved.\n" )); standalone_mode = false; } break; - + case KOUHO_WINDOW_SHOW: #ifdef DEBUG SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOW recieved.\n" )); #endif ShowWindow(); break; - + case KOUHO_WINDOW_SHOW_ALONE: standalone_mode = true; frame = Frame(); screenrect = BScreen().Frame(); frame.OffsetTo( gSettings.standalone_loc.x, gSettings.standalone_loc.y ); - + x = screenrect.right - frame.right; y = screenrect.bottom - frame.bottom; - + if ( x < 0 ) frame.OffsetBy( x, 0 ); - + if ( y < 0 ) frame.OffsetBy( 0, y ); - + gSettings.standalone_loc.x = frame.left; gSettings.standalone_loc.y = frame.top; point = frame.LeftTop(); MoveTo( point ); ShowWindow(); break; - + case KOUHO_WINDOW_SHOWAT: #ifdef DEBUG SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" )); @@ -129,24 +129,24 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" )); msg->FindFloat( "height", &height ); ShowAt( point, height ); break; - + case KOUHO_WINDOW_SETTEXT: const char* newtext; bool hideindex, limitsize; msg->FindString( "text", &newtext ); kouhoView->SetText( newtext ); - + msg->FindBool( "index", &hideindex ); indexView->HideNumberDisplay( hideindex ); msg->FindBool( "limit", &limitsize ); height = kouhoView->TextHeight( 0, kouhoView->TextLength() ); height += INFOVIEW_HEIGHT; - + msg->FindString( "info", &newtext ); infoView->SetText( newtext ); // calculate widest line width - width = 0; + width = 0; for ( int32 line = 0, numlines = kouhoView->CountLines() ; line < numlines ; line++ ) { @@ -174,13 +174,13 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to msg->FindInt32( "kouhorev", &kouhorevline ); kouhoView->HighlightLine( kouhorevline ); } - + break; - + case NUM_SELECTED_FROM_KOUHO_WIN: cannaLooper->PostMessage( msg ); break; - + default: BWindow::MessageReceived( msg ); } @@ -194,7 +194,7 @@ void KouhoWindow::ShowAt( BPoint revpoint, float height ) kouhowidth = Frame().IntegerWidth(); kouhoheight = Frame().IntegerHeight(); - + screenrect = BScreen( this ).Frame(); #ifdef DEBUG SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f", revpoint.x, revpoint.y, height )); @@ -209,16 +209,16 @@ SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f", point.y = revpoint.y - kouhoheight - WINDOW_BORDER_WIDTH_V; // else // point.y = revpoint.y + height; - + if ( point.x + kouhowidth > screenrect.right ) point.x = point.x - (screenrect.right - (point.x + kouhowidth )); -// point.x = revpoint.x +// point.x = revpoint.x // - ( revpoint.x + kouhowidth + WINDOW_BORDER_WIDTH - screenrect.right ); // else // point.x = revpoint.x; - + MoveTo( point ); - ShowWindow(); + ShowWindow(); } void @@ -260,7 +260,7 @@ void KouhoView::HighlightLine( int32 line ) BRegion region; if ( line != -1 ) - { + { begin = OffsetAt( line ); if ( line == CountLines() - 1 ) end = TextLength() + 1; @@ -273,9 +273,9 @@ void KouhoView::HighlightLine( int32 line ) //extend highlihght region to right end highlightRect.right = Bounds().right; Invalidate( highlightRect ); - + } - + } void @@ -286,7 +286,7 @@ KouhoView::HighlightPartial( int32 begin, int32 end ) highlightRect = region.RectAt( 0 ); Invalidate( highlightRect ); } - + void KouhoView::Draw( BRect rect ) { BTextView::Draw( rect ); @@ -303,7 +303,7 @@ void KouhoView::MouseDown( BPoint point ) iview = (KouhoIndexView *)(Window()->FindView( "index" )); if ( iview->IsNumberDisplayHidden() ) return; - + int32 number; number = LineAt( point ); BMessage msg( NUM_SELECTED_FROM_KOUHO_WIN ); @@ -325,7 +325,7 @@ KouhoIndexView::KouhoIndexView( BRect frame, float fontheight ) indexfontheight = ht.ascent + ht.descent + ht.leading; if ( indexfontheight < lineHeight ) fontOffset = (int32)((lineHeight - indexfontheight) / 2 + 1.5); -//printf("line height=%f, index font height=%f, offset=%d\n", lineHeight, indexfontheight, fontOffset ); +//printf("line height=%f, index font height=%f, offset=%d\n", lineHeight, indexfontheight, fontOffset ); } diff --git a/src/add-ons/input_server/methods/canna/KouhoWindow.h b/src/add-ons/input_server/methods/canna/KouhoWindow.h index e9b8db0a23..8103b0b472 100644 --- a/src/add-ons/input_server/methods/canna/KouhoWindow.h +++ b/src/add-ons/input_server/methods/canna/KouhoWindow.h @@ -49,7 +49,7 @@ class KouhoIndexView : public BBox { private: float lineHeight; - int32 fontOffset; //for vertical centering + int32 fontOffset; //for vertical centering bool hideNumber; public: KouhoIndexView( BRect rect, float height ); diff --git a/src/add-ons/input_server/methods/canna/PaletteWindow.cpp b/src/add-ons/input_server/methods/canna/PaletteWindow.cpp index a2ca66ee03..292e3ac527 100644 --- a/src/add-ons/input_server/methods/canna/PaletteWindow.cpp +++ b/src/add-ons/input_server/methods/canna/PaletteWindow.cpp @@ -19,7 +19,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) :BWindow( rect, B_EMPTY_STRING, kLeftTitledWindowLook, B_FLOATING_ALL_WINDOW_FEEL, - B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE | + B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE | B_AVOID_FOCUS | B_WILL_ACCEPT_FIRST_CLICK ) { cannaLooper = looper; @@ -31,7 +31,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) frame.right += 3; back = new BBox( frame ); AddChild( back ); - + BRect largerect( 0, 0, HexOnwidth - 1, HexOnheight - 1 ); BRect smallrect( 0, 0, HiraOnwidth - 1, HiraOnheight - 1); int32 largebytes = HexOnbytesperpixel * HexOnwidth * HexOnheight; @@ -43,9 +43,9 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) //printf( "smallbytes = %d\n", smallbytes ); smallimage = new BBitmap( smallrect, cspace ); largeimage = new BBitmap( largerect, cspace ); - + back->MovePenTo( 0, 0 ); - + smallimage->SetBits( HiraOnbits, smallbytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( smallimage ); @@ -59,7 +59,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) HiraButton = new BPictureButton( BRect( 4, 4, 4 + HiraOnwidth - 1, 4 + HiraOnheight - 1), "hira", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( HiraButton ); - + smallimage->SetBits( KataOnbits, smallbytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( smallimage ); @@ -73,7 +73,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) KataButton = new BPictureButton( BRect( 26, 4, 26 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "kata", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( KataButton ); - + smallimage->SetBits( ZenAlphaOnbits, smallbytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( smallimage ); @@ -87,7 +87,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) ZenAlphaButton = new BPictureButton( BRect( 48, 4, 48 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "zenalpha", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( ZenAlphaButton ); - + smallimage->SetBits( HanAlphaOnbits, smallbytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( smallimage ); @@ -101,7 +101,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) HanAlphaButton = new BPictureButton( BRect( 70, 4, 70 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "hanalpha", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( HanAlphaButton ); - + largeimage->SetBits( ExtendOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -115,7 +115,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) ExtendButton = new BPictureButton( BRect( 94, 4, 94 + HexOnwidth -1 , 4 + HexOnheight - 1 ), "extend", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( ExtendButton ); - + largeimage->SetBits( KigoOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -129,7 +129,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) KigoButton = new BPictureButton( BRect( 4, 26, 4 + HexOnwidth -1, 26 + HexOnheight - 1 ), "kigo", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( KigoButton ); - + largeimage->SetBits( HexOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -143,7 +143,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) HexButton = new BPictureButton( BRect( 34, 26, 34 + HexOnwidth -1, 26 + HexOnheight - 1 ), "hex", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( HexButton ); - + largeimage->SetBits( BushuOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -158,7 +158,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( BushuButton ); -/* +/* largeimage->SetBits( TorokuOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -178,10 +178,10 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) delete largeimage; delete offpict; delete onpict; - + } - + void PaletteWindow::MessageReceived( BMessage *msg ) { int32 mode; @@ -191,23 +191,23 @@ void PaletteWindow::MessageReceived( BMessage *msg ) if ( !IsHidden() ) Hide(); break; - + case PALETTE_WINDOW_SHOW: if ( IsHidden() ) { BRect frame = Frame(); BRect screenrect = BScreen().Frame(); float x, y; - + x = screenrect.right - frame.right; y = screenrect.bottom - frame.bottom; - + if ( x < 0 ) frame.OffsetBy( x, 0 ); - + if ( y < 0 ) frame.OffsetBy( 0, y ); - + MoveTo( frame.left, frame.top ); SetWorkspaces( B_CURRENT_WORKSPACE ); Show(); @@ -270,13 +270,13 @@ void PaletteWindow::MessageReceived( BMessage *msg ) break; } break; - - + + default: BWindow::MessageReceived( msg ); } } - + void PaletteWindow::AllButtonOff() { HiraButton->SetValue( B_CONTROL_OFF ); From 9f37e36f78591796072f10352df53c5bf1cfe3a7 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sun, 30 Oct 2011 16:41:57 +0000 Subject: [PATCH 541/702] updated the copyright and license for the files that list copyright to M.Kawamura. Based on r29897. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43003 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../input_server/methods/canna/CannaCommon.h | 12 +++++++----- .../input_server/methods/canna/CannaInterface.cpp | 14 ++++++-------- .../input_server/methods/canna/CannaInterface.h | 14 ++++++-------- .../input_server/methods/canna/CannaLooper.cpp | 2 +- .../input_server/methods/canna/CannaLooper.h | 4 +++- .../input_server/methods/canna/KouhoWindow.cpp | 15 +++++++-------- .../input_server/methods/canna/KouhoWindow.h | 15 +++++++-------- .../input_server/methods/canna/PaletteWindow.cpp | 15 +++++++-------- .../input_server/methods/canna/PaletteWindow.h | 15 +++++++-------- 9 files changed, 51 insertions(+), 55 deletions(-) diff --git a/src/add-ons/input_server/methods/canna/CannaCommon.h b/src/add-ons/input_server/methods/canna/CannaCommon.h index 66108ecf65..3caf17f338 100644 --- a/src/add-ons/input_server/methods/canna/CannaCommon.h +++ b/src/add-ons/input_server/methods/canna/CannaCommon.h @@ -1,8 +1,10 @@ -// -// CannaCommon.h -// Common data and variable definition for CannaIM -// (c) 1999 Masao Kawamura -// +/* + * Copyright 2011 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 1999 M.Kawamura + */ + #ifndef _CANNACOMMON_H #define _CANNACOMMON_H diff --git a/src/add-ons/input_server/methods/canna/CannaInterface.cpp b/src/add-ons/input_server/methods/canna/CannaInterface.cpp index c08f321215..3cdbbeee54 100644 --- a/src/add-ons/input_server/methods/canna/CannaInterface.cpp +++ b/src/add-ons/input_server/methods/canna/CannaInterface.cpp @@ -1,12 +1,10 @@ -// -// CannaInterface.cpp -// canna library wrapper +/* + * Copyright 2011 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 1999 M.Kawamura + */ -// This is a part of... -// CannaIM -// version 1.0 -// (c) 1999 M.Kawamura -// #include "CannaInterface.h" #include diff --git a/src/add-ons/input_server/methods/canna/CannaInterface.h b/src/add-ons/input_server/methods/canna/CannaInterface.h index ae125ccdb1..da5e77c419 100644 --- a/src/add-ons/input_server/methods/canna/CannaInterface.h +++ b/src/add-ons/input_server/methods/canna/CannaInterface.h @@ -1,12 +1,10 @@ -// -// CannaInterface.h -// canna library wrapper +/* + * Copyright 2011 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 1999 M.Kawamura + */ -// This is a part of... -// CannaIM -// version 1.0 -// (c) 1999 M.Kawamura -// #ifndef _CANNA_INTERFACE_H #define _CANNA_INTERFACE_H diff --git a/src/add-ons/input_server/methods/canna/CannaLooper.cpp b/src/add-ons/input_server/methods/canna/CannaLooper.cpp index d9ec2359a9..8d81a4da14 100644 --- a/src/add-ons/input_server/methods/canna/CannaLooper.cpp +++ b/src/add-ons/input_server/methods/canna/CannaLooper.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2007-2009 Haiku Inc. All rights reserved. + * Copyright 2011 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 1999 M.Kawamura diff --git a/src/add-ons/input_server/methods/canna/CannaLooper.h b/src/add-ons/input_server/methods/canna/CannaLooper.h index 4d6fcbff9b..60e93a37b2 100644 --- a/src/add-ons/input_server/methods/canna/CannaLooper.h +++ b/src/add-ons/input_server/methods/canna/CannaLooper.h @@ -1,9 +1,11 @@ /* - * Copyright 2007-2009 Haiku Inc. All rights reserved. + * Copyright 2007-2009 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 1999 M.Kawamura */ + + #ifndef CANNA_LOOPER_H #define CANNA_LOOPER_H diff --git a/src/add-ons/input_server/methods/canna/KouhoWindow.cpp b/src/add-ons/input_server/methods/canna/KouhoWindow.cpp index 1511d19b8e..2bc2f46ff7 100644 --- a/src/add-ons/input_server/methods/canna/KouhoWindow.cpp +++ b/src/add-ons/input_server/methods/canna/KouhoWindow.cpp @@ -1,11 +1,10 @@ -// -// KouhoWindow.cpp -// -// This is a part of... -// CannaIM -// version 1.0 -// (c) 1999 M.Kawamura -// +/* + * Copyright 2011 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 1999 M.Kawamura + */ + #include diff --git a/src/add-ons/input_server/methods/canna/KouhoWindow.h b/src/add-ons/input_server/methods/canna/KouhoWindow.h index 8103b0b472..c4069da978 100644 --- a/src/add-ons/input_server/methods/canna/KouhoWindow.h +++ b/src/add-ons/input_server/methods/canna/KouhoWindow.h @@ -1,11 +1,10 @@ -// -// KouhoWindow.h -// -// This is a part of... -// CannaIM -// version 1.0 -// (c) 1999 M.Kawamura -// +/* + * Copyright 2011 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 1999 M.Kawamura + */ + #ifndef KOUHOWINDOW_H #define KOUHOWINDOW_H diff --git a/src/add-ons/input_server/methods/canna/PaletteWindow.cpp b/src/add-ons/input_server/methods/canna/PaletteWindow.cpp index 292e3ac527..2b634356ef 100644 --- a/src/add-ons/input_server/methods/canna/PaletteWindow.cpp +++ b/src/add-ons/input_server/methods/canna/PaletteWindow.cpp @@ -1,11 +1,10 @@ -// -// PaletteWindow.cpp -// -// This is a part of... -// CannaIM -// version 1.0 -// (c) 1999 M.Kawamura -// +/* + * Copyright 2011 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 1999 M.Kawamura + */ + #include "CannaCommon.h" #include "PaletteWindow.h" diff --git a/src/add-ons/input_server/methods/canna/PaletteWindow.h b/src/add-ons/input_server/methods/canna/PaletteWindow.h index e3c4d19022..b8f71aa3d5 100644 --- a/src/add-ons/input_server/methods/canna/PaletteWindow.h +++ b/src/add-ons/input_server/methods/canna/PaletteWindow.h @@ -1,11 +1,10 @@ -// -// PaletteWindow.h -// -// This is a part of... -// CannaIM -// version 1.0 -// (c) 1999 M.Kawamura -// +/* + * Copyright 2011 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 1999 M.Kawamura + */ + #ifndef PALETTEWINDOW_H #define PALETTEWINDOW_H From 3e6ff860b4f9cd789a091250a8923023bbe0ce91 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 30 Oct 2011 16:52:03 +0000 Subject: [PATCH 542/702] Rework Deskbar's tray replicant support a bit. Instead of relying on a live query for be:deskbar_item_status in order to determine which replicants are supposed to be living in the tray, a list of entry refs is now stored. While the former approach was cool, it doesn't really work in either a multiuser or a package-aware world, where executables are generally read-only. Note this means you'll lose your existing replicants the first time you run this new revision, and need to re-add them. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43004 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/BarView.cpp | 7 + src/apps/deskbar/BarView.h | 1 + src/apps/deskbar/BarWindow.cpp | 19 +-- src/apps/deskbar/StatusView.cpp | 220 ++++++-------------------------- src/apps/deskbar/StatusView.h | 6 +- 5 files changed, 54 insertions(+), 199 deletions(-) diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 6e71956535..638eebc244 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -1028,6 +1028,13 @@ TBarView::AddItem(BMessage* item, DeskbarShelf, int32* id) } +status_t +TBarView::AddItem(BEntry* entry, DeskbarShelf, int32* id) +{ + return fReplicantTray->LoadAddOn(entry, id); +} + + void TBarView::RemoveItem(int32 id) { diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h index 9e165cbfe0..5f4bee66dc 100644 --- a/src/apps/deskbar/BarView.h +++ b/src/apps/deskbar/BarView.h @@ -125,6 +125,7 @@ class TBarView : public BView { int32 CountItems(DeskbarShelf shelf); status_t AddItem(BMessage* archive, DeskbarShelf shelf, int32* id); + status_t AddItem(BEntry* entry, DeskbarShelf shelf, int32* id); void RemoveItem(int32 id); void RemoveItem(const char* name, DeskbarShelf shelf); diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp index 90c2935a24..b8a89f5d3a 100644 --- a/src/apps/deskbar/BarWindow.cpp +++ b/src/apps/deskbar/BarWindow.cpp @@ -518,7 +518,7 @@ TBarWindow::CountItems(BMessage* message) void TBarWindow::AddItem(BMessage* message) { - DeskbarShelf shelf; + DeskbarShelf shelf = B_DESKBAR_TRAY; entry_ref ref; int32 id = 999; BMessage reply; @@ -527,24 +527,17 @@ TBarWindow::AddItem(BMessage* message) BMessage archivedView; if (message->FindMessage("view", &archivedView) == B_OK) { #if SHELF_AWARE - if (message->FindInt32("shelf", (int32*)&shelf) != B_OK) + message->FindInt32("shelf", &shelf); #endif - shelf = B_DESKBAR_TRAY; - BMessage* archive = new BMessage(archivedView); err = fBarView->AddItem(archive, shelf, &id); if (err < B_OK) delete archive; } else if (message->FindRef("addon", &ref) == B_OK) { - // exposing the name of the view here is not so great - TReplicantTray* tray - = dynamic_cast(FindView("Status")); - if (tray) { - // Force this into the deskbar even if the security code is wrong - // This is OK because the user specifically asked for this replicant - BEntry entry(&ref); - err = tray->LoadAddOn(&entry, &id, true); - } + BEntry entry(&ref); + err = entry.InitCheck(); + if (err == B_OK) + err = fBarView->AddItem(&entry, shelf, &id); } if (err == B_OK) diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 620e84aeac..7d71c1284a 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -83,11 +83,8 @@ using std::max; const char* const kInstantiateItemCFunctionName = "instantiate_deskbar_item"; const char* const kInstantiateEntryCFunctionName = "instantiate_deskbar_entry"; -const char* const kDeskbarSecurityCodeFile = "Deskbar_security_code"; -const char* const kDeskbarSecurityCodeAttr = "be:deskbar_security_code"; -const char* const kStatusPredicate = "be:deskbar_item_status"; -const char* const kEnabledPredicate = "be:deskbar_item_status = enabled"; -const char* const kDisabledPredicate = "be:deskbar_item_status = disabled"; +const char* const kReplicantSettingsFile = "Deskbar_replicants"; +const char* const kReplicantRefField = "replicant"; float sMinimumWindowWidth = kGutter + kMinimumTrayWidth + kDragRegionWidth; @@ -331,7 +328,6 @@ TReplicantTray::MessageReceived(BMessage* message) #ifdef DB_ADDONS case B_NODE_MONITOR: - case B_QUERY_UPDATE: HandleEntryUpdate(message); break; #endif @@ -410,53 +406,48 @@ TReplicantTray::InitAddOnSupport() { // list to maintain refs to each rep added/deleted fItemList = new BList(); - bool haveKey = false; BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { - path.Append(kDeskbarSecurityCodeFile); + path.Append(kReplicantSettingsFile); BFile file(path.Path(), B_READ_ONLY); - if (file.InitCheck() == B_OK - && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)) - == sizeof(fDeskbarSecurityCode)) - haveKey = true; - } - if (!haveKey) { - // create the security code - bigtime_t real = real_time_clock_usecs(); - bigtime_t boot = system_time(); - // two computers would have to have exactly matching clocks, and launch - // Deskbar at the exact same time into the bootsequence in order for - // their security-ID to be identical - fDeskbarSecurityCode = ((real & 0xffffffffULL) << 32) - | (boot & 0xffffffffULL); - - if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { - path.Append(kDeskbarSecurityCodeFile); - BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE - | B_ERASE_FILE); - if (file.InitCheck() == B_OK) - file.Write(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)); + if (file.InitCheck() == B_OK) { + entry_ref ref; + status_t result; + BEntry entry; + int32 id; + if (fAddOnSettings.Unflatten(&file) == B_OK) { + for (int32 i = 0; fAddOnSettings.FindRef(kReplicantRefField, + i, &ref) == B_OK; i++) { + if (entry.SetTo(&ref) == B_OK && entry.Exists()) { + result = LoadAddOn(&entry, &id, false); + } else + result = B_ENTRY_NOT_FOUND; + + if (result != B_OK) { + fAddOnSettings.RemoveData(kReplicantRefField, i); + --i; + } + } + } } } - - // for each volume currently mounted index the volume with our indices - BVolumeRoster roster; - BVolume volume; - while (roster.GetNextVolume(&volume) == B_OK) { - fs_create_index(volume.Device(), kStatusPredicate, B_STRING_TYPE, 0); - RunAddOnQuery(&volume, kEnabledPredicate); - } - - // we also watch for volumes mounted and unmounted - watch_node(NULL, B_WATCH_MOUNT | B_WATCH_ATTR, this, Window()); } void TReplicantTray::DeleteAddOnSupport() { + BPath path; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { + path.Append(kReplicantSettingsFile); + + BFile file(path.Path(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); + if (file.InitCheck() == B_OK) + fAddOnSettings.Flatten(&file); + } + for (int32 i = fItemList->CountItems(); i-- > 0 ;) { DeskbarItemInfo* item = (DeskbarItemInfo*)fItemList->RemoveItem(i); if (item) { @@ -473,47 +464,6 @@ TReplicantTray::DeleteAddOnSupport() } -void -TReplicantTray::RunAddOnQuery(BVolume* volume, const char* predicate) -{ - // Since the new BFS supports querying for attributes without - // an index, we only run the query if the index exists (for - // newly mounted devices only - the Deskbar will automatically - // create an index for every device mounted at startup). - index_info info; - if (!volume->KnowsQuery() - || fs_stat_index(volume->Device(), kStatusPredicate, &info) != 0) - return; - - // run a new query on a specific volume and make it live - BQuery query; - query.SetVolume(volume); - query.SetPredicate(predicate); - query.Fetch(); - - int32 id; - BEntry entry; - while (query.GetNextEntry(&entry) == B_OK) { - // scan any entries returned - // attempt to load them as add-ons - // collisions are handled in LoadAddOn - LoadAddOn(&entry, &id); - } -} - - -bool -TReplicantTray::IsAddOn(entry_ref& ref) -{ - BFile file(&ref, B_READ_ONLY); - - char status[64]; - ssize_t size = file.ReadAttr(kStatusPredicate, B_STRING_TYPE, 0, &status, - sizeof(status)); - return size > 0; -} - - DeskbarItemInfo* TReplicantTray::DeskbarItemFor(node_ref& nodeRef) { @@ -565,61 +515,6 @@ TReplicantTray::HandleEntryUpdate(BMessage* message) BPath path; switch (opcode) { - case B_ENTRY_CREATED: - { - // entry was just listed, matches live query - const char* name; - ino_t directory; - dev_t device; - // received when an app adds a ref to the - // Deskbar add-ons folder - if (message->FindString("name", &name) == B_OK - && message->FindInt64("directory", &directory) == B_OK - && message->FindInt32("device", &device) == B_OK) { - entry_ref ref(device, directory, name); - // see if this item has the attribute - // that we expect - if (IsAddOn(ref)) { - int32 id; - BEntry entry(&ref); - LoadAddOn(&entry, &id); - } - } - break; - } - - case B_ATTR_CHANGED: - { - // from node watch on individual items - // (node_watch added in LoadAddOn) - node_ref nodeRef; - if (message->FindInt32("device", &(nodeRef.device)) == B_OK - && message->FindInt64("node", &(nodeRef.node)) == B_OK) { - // get the add-on this is for - DeskbarItemInfo* item = DeskbarItemFor(nodeRef); - if (item == NULL) - break; - - BFile file(&item->entryRef, B_READ_ONLY); - - char status[255]; - ssize_t size = file.ReadAttr(kStatusPredicate, - B_STRING_TYPE, 0, status, sizeof(status) - 1); - status[sizeof(status) - 1] = '\0'; - - // attribute was removed - if (size == B_ENTRY_NOT_FOUND) { - // cleans up and removes node_watch - UnloadAddOn(&nodeRef, NULL, true, false); - } else if (!strcmp(status, "enable")) { - int32 id; - BEntry entry(&item->entryRef, true); - LoadAddOn(&entry, &id); - } - } - break; - } - case B_ENTRY_MOVED: { entry_ref ref; @@ -663,32 +558,6 @@ TReplicantTray::HandleEntryUpdate(BMessage* message) } break; } - - case B_DEVICE_MOUNTED: - { - // run a new query on the new device - dev_t device; - if (message->FindInt32("new device", &device) != B_OK) - break; - - BVolume volume(device); - RunAddOnQuery(&volume, kEnabledPredicate); - break; - } - - case B_DEVICE_UNMOUNTED: - { - // remove all items associated with the device - // unmounted - // contrary to what the BeBook says, the item is called "device", - // not "new device" like it is for B_DEVICE_MOUNTED - dev_t device; - if (message->FindInt32("device", &device) != B_OK) - break; - - UnloadAddOn(NULL, &device, false, true); - break; - } } } @@ -698,7 +567,7 @@ TReplicantTray::HandleEntryUpdate(BMessage* message) primary function is the Instantiate function */ status_t -TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool force) +TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool addToSettings) { if (!entry) return B_ERROR; @@ -710,21 +579,6 @@ TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool force) return B_ERROR; BNode node(entry); - if (!force) { - status_t error = node.InitCheck(); - if (error != B_OK) - return error; - - uint64 deskbarID; - ssize_t size = node.ReadAttr(kDeskbarSecurityCodeAttr, B_UINT64_TYPE, - 0, &deskbarID, sizeof(fDeskbarSecurityCode)); - if (size != sizeof(fDeskbarSecurityCode) - || deskbarID != fDeskbarSecurityCode) { - // no code or code doesn't match - return B_ERROR; - } - } - BPath path; status_t status = entry->GetPath(&path); if (status < B_OK) @@ -770,9 +624,12 @@ TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool force) AddIcon(data, id, &ref); // add the rep; adds info to list - node.WriteAttr(kDeskbarSecurityCodeAttr, B_UINT64_TYPE, 0, - &fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)); - + if (addToSettings) { + entry_ref ref; + if (entry->GetRef(&ref) == B_OK) + fAddOnSettings.AddRef(kReplicantRefField, &ref); + } + return B_OK; } @@ -841,7 +698,6 @@ TReplicantTray::RemoveItem(int32 id) // attribute was added via Deskbar API (AddItem(entry_ref*, int32*) if (item->isAddOn) { BNode node(&item->entryRef); - node.RemoveAttr(kStatusPredicate); watch_node(&item->nodeRef, B_STOP_WATCHING, this, Window()); } diff --git a/src/apps/deskbar/StatusView.h b/src/apps/deskbar/StatusView.h index 28438e9760..0ef5e81dc1 100644 --- a/src/apps/deskbar/StatusView.h +++ b/src/apps/deskbar/StatusView.h @@ -117,7 +117,7 @@ public: void DealWithClock(bool); #ifdef DB_ADDONS - status_t LoadAddOn(BEntry* entry, int32* id, bool force = false); + status_t LoadAddOn(BEntry* entry, int32* id, bool addToSettings = true); #endif private: @@ -129,9 +129,7 @@ private: #ifdef DB_ADDONS void InitAddOnSupport(); void DeleteAddOnSupport(); - void RunAddOnQuery(BVolume* volume, const char* predicated); - bool IsAddOn(entry_ref &ref); DeskbarItemInfo* DeskbarItemFor(node_ref &nodeRef); DeskbarItemInfo* DeskbarItemFor(int32 id); bool NodeExists(node_ref &nodeRef); @@ -162,7 +160,7 @@ private: bool fAlignmentSupport; #ifdef DB_ADDONS BList* fItemList; - uint64 fDeskbarSecurityCode; + BMessage fAddOnSettings; #endif }; From c0ad1c9185758eff05b6947dc22f0b20f1b5f417 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 30 Oct 2011 17:00:50 +0000 Subject: [PATCH 543/702] Adjust the previous change to use paths instead of entry_refs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43005 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/StatusView.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 7d71c1284a..d6a91707fa 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -84,7 +84,7 @@ using std::max; const char* const kInstantiateItemCFunctionName = "instantiate_deskbar_item"; const char* const kInstantiateEntryCFunctionName = "instantiate_deskbar_entry"; const char* const kReplicantSettingsFile = "Deskbar_replicants"; -const char* const kReplicantRefField = "replicant"; +const char* const kReplicantPathField = "replicant_path"; float sMinimumWindowWidth = kGutter + kMinimumTrayWidth + kDragRegionWidth; @@ -413,20 +413,20 @@ TReplicantTray::InitAddOnSupport() BFile file(path.Path(), B_READ_ONLY); if (file.InitCheck() == B_OK) { - entry_ref ref; status_t result; BEntry entry; int32 id; + BString path; if (fAddOnSettings.Unflatten(&file) == B_OK) { - for (int32 i = 0; fAddOnSettings.FindRef(kReplicantRefField, - i, &ref) == B_OK; i++) { - if (entry.SetTo(&ref) == B_OK && entry.Exists()) { + for (int32 i = 0; fAddOnSettings.FindString(kReplicantPathField, + i, &path) == B_OK; i++) { + if (entry.SetTo(path.String()) == B_OK && entry.Exists()) { result = LoadAddOn(&entry, &id, false); } else result = B_ENTRY_NOT_FOUND; if (result != B_OK) { - fAddOnSettings.RemoveData(kReplicantRefField, i); + fAddOnSettings.RemoveData(kReplicantPathField, i); --i; } } @@ -627,7 +627,7 @@ TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool addToSettings) if (addToSettings) { entry_ref ref; if (entry->GetRef(&ref) == B_OK) - fAddOnSettings.AddRef(kReplicantRefField, &ref); + fAddOnSettings.AddString(kReplicantPathField, path.Path()); } return B_OK; From dff7bba0da0a73fdb7bf4d8d628579ca9f95311a Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 30 Oct 2011 17:30:11 +0000 Subject: [PATCH 544/702] Patch by oco: use more regular look for size slider in DriveSetup partition creation dialog. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43006 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/drivesetup/Support.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apps/drivesetup/Support.cpp b/src/apps/drivesetup/Support.cpp index 1c913ed19c..0f2956166d 100644 --- a/src/apps/drivesetup/Support.cpp +++ b/src/apps/drivesetup/Support.cpp @@ -102,7 +102,8 @@ SizeSlider::SizeSlider(const char* name, const char* label, fEndOffset(maxValue), fMaxPartitionSize(maxValue) { - SetBarColor((rgb_color){ 0, 80, 255, 255 }); + rgb_color fillColor = ui_color(B_CONTROL_HIGHLIGHT_COLOR); + UseFillColor(true, &fillColor); char minString[64]; char maxString[64]; snprintf(minString, sizeof(minString), B_TRANSLATE("Offset: %ld MB"), From 520d5f6e3e42ab0a4a6ca87526e29e5cfb6e0c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 30 Oct 2011 18:25:27 +0000 Subject: [PATCH 545/702] Some pending work on the esound sink media node. Still not usable, and esound is being deprecated anyway on Linux. At least it compiles. Renamed it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43007 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../media-add-ons/esound_sink/ESDEndpoint.cpp | 50 ++++- .../media-add-ons/esound_sink/ESDEndpoint.h | 2 + .../esound_sink/ESDSinkAddOn.cpp | 20 +- .../media-add-ons/esound_sink/ESDSinkNode.cpp | 172 +++++------------- .../media-add-ons/esound_sink/ESDSinkNode.h | 1 + .../media/media-add-ons/esound_sink/Jamfile | 6 +- 6 files changed, 100 insertions(+), 151 deletions(-) diff --git a/src/add-ons/media/media-add-ons/esound_sink/ESDEndpoint.cpp b/src/add-ons/media/media-add-ons/esound_sink/ESDEndpoint.cpp index 0c7452885e..85453e1d38 100644 --- a/src/add-ons/media/media-add-ons/esound_sink/ESDEndpoint.cpp +++ b/src/add-ons/media/media-add-ons/esound_sink/ESDEndpoint.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -142,12 +143,25 @@ ESDEndpoint::Connect(const char *host, uint16 port) err = resume_thread(fConnectThread); // TODO: return now instead and move Connect() call - wait_for_thread(fConnectThread, &err); + //wait_for_thread(fConnectThread, &err); return err; } +status_t +ESDEndpoint::WaitForConnect() +{ + status_t err; + int32 ret; + err = wait_for_thread(fConnectThread, &ret); + if (err < B_OK) + return err; + + return ret; +} + + int32 ESDEndpoint::_ConnectThread(void *_arg) { @@ -162,6 +176,9 @@ ESDEndpoint::ConnectThread(void) uint16 port = fPort; status_t err; int flag; + struct timeval oldTimeout; + socklen_t oldTimeoutLen = sizeof(struct timeval); + struct timeval timeout = { 10, 0 }; // 10s should be enough on a LAN CALLED(); struct hostent *he; @@ -188,9 +205,14 @@ ESDEndpoint::ConnectThread(void) setsockopt(fSocket, SOL_SOCKET, SO_SNDBUF, &flag, sizeof(flag)); setsockopt(fSocket, SOL_SOCKET, SO_RCVBUF, &flag, sizeof(flag)); */ + + if (getsockopt(fSocket, SOL_SOCKET, SO_RCVTIMEO, (char *)&oldTimeout, &oldTimeoutLen) >= 0) { + setsockopt(fSocket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(struct timeval)); + } err = connect(fSocket, (struct sockaddr *) &sin, sizeof(sin)); PRINT(("connect: %ld, %s\n", err, strerror(errno))); + setsockopt(fSocket, SOL_SOCKET, SO_RCVTIMEO, (char *)&oldTimeout, sizeof(struct timeval)); if (err < 0) return errno; @@ -217,7 +239,7 @@ ESDEndpoint::ConnectThread(void) err = write(fSocket, &cmd, sizeof(cmd)); if (err < 0) return errno; - if (err < sizeof(cmd)) + if ((unsigned)err < sizeof(cmd)) return EIO; read(fSocket, &result, sizeof(result)); @@ -240,7 +262,7 @@ ESDEndpoint::ConnectThread(void) err = write(fSocket, &cmd, sizeof(cmd)); if (err < 0) return errno; - if (err < sizeof(cmd)) + if ((unsigned)err < sizeof(cmd)) return EIO; read(fSocket, &result, sizeof(result)); @@ -257,7 +279,7 @@ ESDEndpoint::ConnectThread(void) flag = 1; - int len; + //int len; /* disable Nagle */ setsockopt(fSocket, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag)); //setsockopt(fSocket, SOL_SOCKET, SO_NONBLOCK, &flag, sizeof(flag)); @@ -306,7 +328,7 @@ ESDEndpoint::SetFormat(int bits, int channels, float rate) CALLED(); if (fDefaultCommandSent) return EALREADY; - PRINT(("SetFormat(%d,%d,%d)\n", bits, channels, rate)); + PRINT(("SetFormat(%d,%d,%f)\n", bits, channels, rate)); switch (bits) { case 8: fmt |= ESD_BITS8; @@ -328,7 +350,7 @@ ESDEndpoint::SetFormat(int bits, int channels, float rate) return EINVAL; } fmt |= ESD_STREAM | ESD_FUNC_PLAY; - PRINT(("SetFormat: %08lx\n", fmt)); + PRINT(("SetFormat: %08lx\n", (long)fmt)); fDefaultFormat = fmt; fDefaultRate = rate; return B_OK; @@ -347,10 +369,20 @@ ESDEndpoint::GetServerInfo() err = SendCommand(ESD_PROTO_SERVER_INFO, (const uint8 *)&si, 0, (uint8 *)&si, sizeof(si)); if (err < 0) return err; - PRINT(("err %d, version: %lu, rate: %lu, fmt: %lu\n", err, si.ver, si.rate, si.fmt)); + PRINT(("err 0x%08lx, version: %lu, rate: %lu, fmt: %lu\n", err, si.ver, si.rate, si.fmt)); return B_OK; } + +void +ESDEndpoint::GetFriendlyName(BString &name) +{ + name = "ESounD Out"; + name << " (" << Host(); + name << ":" << Port() << ")"; + +} + bool ESDEndpoint::CanSend() { @@ -381,8 +413,8 @@ ESDEndpoint::Write(const void *buffer, size_t size) size *= 2; } err = write(fSocket, buffer, size); - if (err != size) { - fprintf(stderr, "ESDEndpoint::Write: sent only %d of %d!\n", err, size); + if ((unsigned)err != size) { + fprintf(stderr, "ESDEndpoint::Write: sent only %ld of %ld!\n", err, size); if (err < 0) fprintf(stderr, "ESDEndpoint::Write: %s\n", strerror(errno)); } diff --git a/src/add-ons/media/media-add-ons/esound_sink/ESDEndpoint.h b/src/add-ons/media/media-add-ons/esound_sink/ESDEndpoint.h index 76800548d8..31e74d8d6e 100644 --- a/src/add-ons/media/media-add-ons/esound_sink/ESDEndpoint.h +++ b/src/add-ons/media/media-add-ons/esound_sink/ESDEndpoint.h @@ -50,6 +50,7 @@ status_t SendAuthKey(); bool Connected() const; status_t Connect(const char *host, uint16 port=ESD_DEFAULT_PORT); +status_t WaitForConnect(); status_t Disconnect(); /* set the default command and format for BDataIO interface */ @@ -63,6 +64,7 @@ status_t GetServerInfo(); bigtime_t GetLatency() const { return fLatency; }; const char *Host() const { return fHost.String(); }; uint16 Port() const { return fPort; }; +void GetFriendlyName(BString &name); bool CanSend(); diff --git a/src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.cpp b/src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.cpp index 305cfc5cad..e2c3e1933e 100644 --- a/src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.cpp +++ b/src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.cpp @@ -119,12 +119,11 @@ status_t ESDSinkAddOn::GetFlavorAt( return B_BAD_INDEX; } - ESDEndpoint *device = (ESDEndpoint *) fDevices.ItemAt(n); + //ESDEndpoint *device = (ESDEndpoint *) fDevices.ItemAt(n); flavor_info * infos = new flavor_info[1]; ESDSinkNode::GetFlavor(&infos[0], n); // infos[0].name = device->MD.friendly_name; - infos[0].name = "ESounD Out"; (*out_info) = infos; return B_OK; } @@ -136,16 +135,20 @@ BMediaNode * ESDSinkAddOn::InstantiateNodeFor( { CALLED(); + BString name = "ESounD Sink"; #ifdef MULTI_SAVE - if(fSettings.FindMessage(device->MD.friendly_name, config)==B_OK) { - fSettings.RemoveData(device->MD.friendly_name); + ESDEndpoint *device = (ESDEndpoint *) fDevices.ItemAt(info->internal_id); + if (device) + device->GetFriendlyName(name); + if(fSettings.FindMessage(name.String(), config)==B_OK) { + fSettings.RemoveData(name.String()); } #endif ESDSinkNode * node = new ESDSinkNode(this, - "ESounD Sink", + (char *)name.String(), config); if (node == 0) { *out_error = B_NO_MEMORY; @@ -161,7 +164,8 @@ ESDSinkAddOn::GetConfigurationFor(BMediaNode * your_node, BMessage * into_messag { CALLED(); #ifdef MULTI_SAVE - into_message = new BMessage(); + if (!into_message) + into_message = new BMessage(); ESDSinkNode * node = dynamic_cast(your_node); if (node == 0) { fprintf(stderr,"<- B_BAD_TYPE\n"); @@ -173,13 +177,15 @@ ESDSinkAddOn::GetConfigurationFor(BMediaNode * your_node, BMessage * into_messag return B_OK; #endif // currently never called by the media kit. Seems it is not implemented. - +#if 0 ESDSinkNode * node = dynamic_cast(your_node); if (node == 0) { fprintf(stderr,"<- B_BAD_TYPE\n"); return B_BAD_TYPE; } return node->GetConfigurationFor(into_message); +#endif + return B_ERROR; } #if 0 diff --git a/src/add-ons/media/media-add-ons/esound_sink/ESDSinkNode.cpp b/src/add-ons/media/media-add-ons/esound_sink/ESDSinkNode.cpp index 6b154e1a38..bc82c4260d 100644 --- a/src/add-ons/media/media-add-ons/esound_sink/ESDSinkNode.cpp +++ b/src/add-ons/media/media-add-ons/esound_sink/ESDSinkNode.cpp @@ -28,6 +28,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +//#define DEBUG 4 #include #include #include @@ -58,15 +59,6 @@ #include #include -const char * multi_string[] = -{ - "NAME IS ATTACHED", - "Output", "Input", "Setup", "Tone Control", "Extended Setup", "Enhanced Setup", "Master", - "Beep", "Phone", "Mic", "Line", "CD", "Video", "Aux", "Wave", "Gain", "Level", "Volume", - "Mute", "Enable", "Stereo Mix", "Mono Mix", "Output Stereo Mix", "Output Mono Mix", "Output Bass", - "Output Treble", "Output 3D Center", "Output 3D Depth" -}; - // -------------------------------------------------------- // // ctor/dtor @@ -133,8 +125,9 @@ ESDSinkNode::ESDSinkNode(BMediaAddOn *addon, char* name, BMessage * config) config->FindString("hostname", &fHostname); } if (fHostname.Length() < 1) - fHostname = "192.168.0.1"; + fHostname = "172.20.109.151";//"192.168.0.2"; fPort = ESD_DEFAULT_PORT; + fEnabled = false; fDevice = new ESDEndpoint(); /* @@ -241,7 +234,7 @@ void ESDSinkNode::NodeRegistered(void) } #ifdef PRINTING - PRINT(("apply configuration in : %ld\n", system_time() - start)); + PRINT(("apply configuration in : %lld\n", system_time() - start)); #endif } @@ -266,6 +259,7 @@ status_t ESDSinkNode::AcceptFormat( const media_destination & dest, media_format * format) { + status_t err; CALLED(); if(fInput.destination != dest) { @@ -310,6 +304,10 @@ status_t ESDSinkNode::AcceptFormat( return B_MEDIA_BAD_FORMAT; }*/ //AddRequirements(format); + + // start connecting here + err = fDevice->Connect(fHostname.String(), fPort); + return B_OK; } @@ -322,7 +320,7 @@ status_t ESDSinkNode::GetNextInput( if ((*cookie < 1) && (*cookie >= 0)) { *out_input = fInput; *cookie += 1; - PRINT(("input.format : %u\n", fInput.format.u.raw_audio.format)); + PRINT(("input.format : %lu\n", fInput.format.u.raw_audio.format)); return B_OK; } else return B_BAD_INDEX; @@ -431,6 +429,7 @@ status_t ESDSinkNode::Connected( const media_format & with_format, media_input * out_input) { + status_t err; CALLED(); if(fInput.destination != where) { @@ -440,12 +439,15 @@ status_t ESDSinkNode::Connected( // if (fDevice) { - if (fDevice->Connect(fHostname.String(), fPort) >= 0) { - fDevice->SetCommand(); - //fDevice->GetServerInfo(); - fDevice->SetFormat(ESD_FMT, 2); - fInitCheckStatus = fDevice->SendDefaultCommand(); - } + err = fDevice->WaitForConnect(); + if (err < B_OK) + return err; + fDevice->SetCommand(); + //fDevice->GetServerInfo(); + fDevice->SetFormat(ESD_FMT, 2); + err = fDevice->SendDefaultCommand(); + if (err < B_OK) + return err; } // use one buffer length latency fInternalLatency = with_format.u.raw_audio.buffer_size * 10000 / 2 @@ -483,6 +485,8 @@ void ESDSinkNode::Disconnected( fInput.source = media_source::null; fInput.format = fPreferredFormat; //GetFormat(&channel->fInput.format); + if (fDevice) + fDevice->Disconnect(); } /* The notification comes from the upstream producer, so he's already cool with */ @@ -957,7 +961,7 @@ status_t ESDSinkNode::HandleDataStatus( bool realTimeEvent) { CALLED(); - PRINT(("ESDSinkNode::HandleDataStatus status:%li, lateness:%li\n", event->data, lateness)); + PRINT(("ESDSinkNode::HandleDataStatus status:%li, lateness:%lli\n", event->data, lateness)); switch(event->data) { case B_DATA_NOT_AVAILABLE: break; @@ -1093,8 +1097,11 @@ ESDSinkNode::GetParameterValue(int32 id, bigtime_t* last_change, void* value, si //PRINT(("id : %i\n", id)); switch (id) { case PARAM_ENABLED: - // XXX - break; + if (*ioSize < sizeof(bool)) + return B_NO_MEMORY; + *(bool *)value = fEnabled; + *ioSize = sizeof(bool); + return B_OK; case PARAM_HOST: { BString s = fDevice->Host(); @@ -1129,7 +1136,7 @@ void ESDSinkNode::SetParameterValue(int32 id, bigtime_t performance_time, const void* value, size_t size) { CALLED(); - PRINT(("id : %i, performance_time : %lld, size : %i\n", id, performance_time, size)); + PRINT(("id : %li, performance_time : %lld, size : %li\n", id, performance_time, size)); BParameter *parameter = NULL; for(int32 i=0; iCountParameters(); i++) { parameter = fWeb->ParameterAt(i); @@ -1138,11 +1145,15 @@ ESDSinkNode::SetParameterValue(int32 id, bigtime_t performance_time, const void* } switch (id) { case PARAM_ENABLED: - break; + if (size != sizeof(bool)) + return; + fEnabled = *(bool *)value; + return; case PARAM_HOST: { fprintf(stderr, "set HOST: %s\n", (const char *)value); fHostname = (const char *)value; +#if 0 if (fDevice && fDevice->Connected()) { if (fDevice->Connect(fHostname.String(), fPort) >= 0) { fDevice->SetCommand(); @@ -1151,12 +1162,14 @@ ESDSinkNode::SetParameterValue(int32 id, bigtime_t performance_time, const void* fInitCheckStatus = fDevice->SendDefaultCommand(); } } +#endif return; } case PARAM_PORT: { fprintf(stderr, "set PORT: %s\n", (const char *)value); fPort = atoi((const char *)value); +#if 0 if (fDevice && fDevice->Connected()) { if (fDevice->Connect(fHostname.String(), fPort) >= 0) { fDevice->SetCommand(); @@ -1165,6 +1178,7 @@ ESDSinkNode::SetParameterValue(int32 id, bigtime_t performance_time, const void* fInitCheckStatus = fDevice->SendDefaultCommand(); } } +#endif return; } default: @@ -1177,25 +1191,6 @@ ESDSinkNode::MakeParameterWeb() { CALLED(); BParameterWeb* web = new BParameterWeb; -#if 0 - PRINT(("MMCI.control_count : %i\n", fDevice->MMCI.control_count)); - multi_mix_control *MMC = fDevice->MMCI.controls; - - for(int i=0; iMMCI.control_count; i++) { - if(MMC[i].flags & B_MULTI_MIX_GROUP && MMC[i].parent == 0) { - PRINT(("NEW_GROUP\n")); - int32 nb = 0; - const char* childName; - if(MMC[i].string != S_null) - childName = multi_string[MMC[i].string]; - else - childName = MMC[i].name; - BParameterGroup *child = web->MakeGroup(childName); - ProcessGroup(child, i, nb); - } - } -#endif - int id = 0; BParameterGroup *group = web->MakeGroup("Server"); BParameter *p; // XXX: use B_MEDIA_UNKNOWN_TYPE or _NO_TYPE ? @@ -1207,93 +1202,7 @@ ESDSinkNode::MakeParameterWeb() #endif return web; } -#if 0 -void -ESDSinkNode::ProcessGroup(BParameterGroup *group, int32 index, int32 &nbParameters) -{ - CALLED(); - multi_mix_control *parent = &fDevice->MMCI.controls[index]; - multi_mix_control *MMC = fDevice->MMCI.controls; - for(int32 i=0; iMMCI.control_count; i++) { - if(MMC[i].parent != parent->id) - continue; - - const char* childName; - if(MMC[i].string != S_null) - childName = multi_string[MMC[i].string]; - else - childName = MMC[i].name; - - if(MMC[i].flags & B_MULTI_MIX_GROUP) { - PRINT(("NEW_GROUP\n")); - int32 nb = 1; - BParameterGroup *child = group->MakeGroup(childName); - child->MakeNullParameter(MMC[i].id, B_MEDIA_RAW_AUDIO, childName, B_WEB_BUFFER_OUTPUT); - ProcessGroup(child, i, nb); - } else if(MMC[i].flags & B_MULTI_MIX_MUX) { - PRINT(("NEW_MUX\n")); - BDiscreteParameter *parameter = - group->MakeDiscreteParameter(100 + MMC[i].id, B_MEDIA_RAW_AUDIO, childName, B_INPUT_MUX); - if(nbParameters>0) { - (group->ParameterAt(nbParameters - 1))->AddOutput(group->ParameterAt(nbParameters)); - nbParameters++; - } - ProcessMux(parameter, i); - } else if(MMC[i].flags & B_MULTI_MIX_GAIN) { - PRINT(("NEW_GAIN\n")); - group->MakeContinuousParameter(100 + MMC[i].id, B_MEDIA_RAW_AUDIO, "", B_MASTER_GAIN, - "dB", MMC[i].gain.min_gain, MMC[i].gain.max_gain, MMC[i].gain.granularity); - - if(i+1 MMCI.control_count && MMC[i+1].master == MMC[i].id && MMC[i+1].flags & B_MULTI_MIX_GAIN) { - group->ParameterAt(nbParameters)->SetChannelCount( - group->ParameterAt(nbParameters)->CountChannels() + 1); - i++; - } - - PRINT(("nb parameters : %d\n", nbParameters)); - if (nbParameters > 0) { - (group->ParameterAt(nbParameters - 1))->AddOutput(group->ParameterAt(nbParameters)); - nbParameters++; - } - } else if(MMC[i].flags & B_MULTI_MIX_ENABLE) { - PRINT(("NEW_ENABLE\n")); - if(MMC[i].string == S_MUTE) - group->MakeDiscreteParameter(100 + MMC[i].id, B_MEDIA_RAW_AUDIO, childName, B_MUTE); - else - group->MakeDiscreteParameter(100 + MMC[i].id, B_MEDIA_RAW_AUDIO, childName, B_ENABLE); - if(nbParameters>0) { - (group->ParameterAt(nbParameters - 1))->AddOutput(group->ParameterAt(nbParameters)); - nbParameters++; - } - } - } -} -void -ESDSinkNode::ProcessMux(BDiscreteParameter *parameter, int32 index) -{ - CALLED(); - multi_mix_control *parent = &fDevice->MMCI.controls[index]; - multi_mix_control *MMC = fDevice->MMCI.controls; - int32 itemIndex = 0; - for(int32 i=0; iMMCI.control_count; i++) { - if(MMC[i].parent != parent->id) - continue; - - const char* childName; - if(MMC[i].string != S_null) - childName = multi_string[MMC[i].string]; - else - childName = MMC[i].name; - - if(MMC[i].flags & B_MULTI_MIX_MUX_VALUE) { - PRINT(("NEW_MUX_VALUE\n")); - parameter->AddItem(itemIndex, childName); - itemIndex++; - } - } -} -#endif // -------------------------------------------------------- // // ESDSinkNode specific functions // -------------------------------------------------------- // @@ -1309,6 +1218,9 @@ ESDSinkNode::GetConfigurationFor(BMessage * into_message) bigtime_t last_change; status_t err; + if (!into_message) + return B_BAD_VALUE; + buffer = malloc(size); for(int32 i=0; iCountParameters(); i++) { @@ -1317,7 +1229,7 @@ ESDSinkNode::GetConfigurationFor(BMessage * into_message) && parameter->Type() != BParameter::B_DISCRETE_PARAMETER) continue; - PRINT(("getting parameter %i\n", parameter->ID())); + PRINT(("getting parameter %li\n", parameter->ID())); size = 128; while((err = GetParameterValue(parameter->ID(), &last_change, buffer, &size))==B_NO_MEMORY) { size += 128; @@ -1329,7 +1241,7 @@ ESDSinkNode::GetConfigurationFor(BMessage * into_message) into_message->AddInt32("parameterID", parameter->ID()); into_message->AddData("parameterData", B_RAW_TYPE, buffer, size, false); } else { - PRINT(("parameter err : %s\n", strerror(err))); + PRINT(("parameter %li err : %s\n", parameter->ID(), strerror(err))); } } diff --git a/src/add-ons/media/media-add-ons/esound_sink/ESDSinkNode.h b/src/add-ons/media/media-add-ons/esound_sink/ESDSinkNode.h index b39820bc5c..4fbb0a324e 100644 --- a/src/add-ons/media/media-add-ons/esound_sink/ESDSinkNode.h +++ b/src/add-ons/media/media-add-ons/esound_sink/ESDSinkNode.h @@ -353,6 +353,7 @@ private: BString fHostname; uint16 fPort; + bool fEnabled; ESDEndpoint *fDevice; //multi_description MD; diff --git a/src/add-ons/media/media-add-ons/esound_sink/Jamfile b/src/add-ons/media/media-add-ons/esound_sink/Jamfile index 94a5360a1d..6e45d95d48 100644 --- a/src/add-ons/media/media-add-ons/esound_sink/Jamfile +++ b/src/add-ons/media/media-add-ons/esound_sink/Jamfile @@ -6,14 +6,10 @@ if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SubDirC++Flags -fmultiple-symbol-spaces ; } -Addon ESDSink.media_addon : +Addon esound_sink.media_addon : ESDEndpoint.cpp ESDSinkAddOn.cpp ESDSinkNode.cpp : be media network $(TARGET_LIBSUPC++) ; -#Package haiku-multi_audio-cvs -# : hmulti_audio.media_addon -# : boot home config add-ons media ; - From d64437e6a9fa87011f246e4ae9f4e6ababc3affa Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sun, 30 Oct 2011 18:28:03 +0000 Subject: [PATCH 546/702] Removed some TODO for licenses and url's. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43008 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/aboutsystem/AboutSystem.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 4ac2a16973..869cf5a357 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -1263,7 +1263,7 @@ AboutView::_CreateCreditsView() haikuLicense.CopyInto(part, licensePart2 + 1, licensePart3 - 1 - licensePart2); fCreditsView->Insert(part); - + part.Truncate(0); haikuLicense.CopyInto(part, licensePart3 + 1, licensePart4 - 1 - licensePart3); @@ -1296,8 +1296,10 @@ AboutView::_CreateCreditsView() "telnetd, traceroute\n" COPYRIGHT_STRING "1994-2008 The FreeBSD Project. " "All rights reserved."), + StringVector("BSD (2-clause)", "BSD (3-clause)", "BSD (4-clause)", + NULL), + StringVector(), "http://www.freebsd.org"); - // TODO: License! // NetBSD copyrights AddCopyrightEntry("The NetBSD Project", @@ -1384,8 +1386,9 @@ AboutView::_CreateCreditsView() COPYRIGHT_STRING "2006-2009 Daisuke SUZUKI.", COPYRIGHT_STRING "2006-2009 Project Vine.", B_TRANSLATE("MIT license. All rights reserved."), - NULL)); - // TODO: License! + NULL) + .SetLicense("BSD (3-clause)") + .SetURL("http://vlgothic.dicey.org/")); // expat copyrights _AddPackageCredit(PackageCredit("expat") @@ -1441,13 +1444,14 @@ AboutView::_CreateCreditsView() _AddPackageCredit(PackageCredit("atftp") .SetCopyright(B_TRANSLATE(COPYRIGHT_STRING "2000 Jean-Pierre " "ervbefeL and Remi Lefebvre.")) - .SetLicense("GNU GPL v2")); - // TODO: URL! + .SetLicense("GNU GPL v2") + .SetURL("http://freecode.com/projects/atftp")); // Netcat copyrights _AddPackageCredit(PackageCredit("Netcat") - .SetCopyright(COPYRIGHT_STRING "1996 Hobbit.")); - // TODO: License! + .SetCopyright(COPYRIGHT_STRING "1996 Hobbit.") + .SetLicense("Public Domain") + .SetURL("http://nc110.sourceforge.net/")); // acpica copyrights _AddPackageCredit(PackageCredit("acpica") @@ -1498,8 +1502,8 @@ AboutView::_CreateCreditsView() // CannaIM copyrights _AddPackageCredit(PackageCredit("CannaIM") - .SetCopyright(COPYRIGHT_STRING "1999 Masao Kawamura.")); - // TODO: License! + .SetCopyright(COPYRIGHT_STRING "1999 Masao Kawamura.") + .SetLicense("MIT")); // libxml2, libxslt, libexslt copyrights _AddPackageCredit(PackageCredit("libxml2, libxslt") @@ -1570,7 +1574,6 @@ AboutView::_CreateCreditsView() "Vivek Mohan. All rights reserved.")) .SetLicense(B_TRANSLATE("BSD (2-clause)")) .SetURL("http://udis86.sourceforge.net")); - // TODO: License! - Project website refers to BSD License #endif #ifdef __INTEL__ From 7625ce51505cad2b0b3b51cbc63ac0b205f2a9da Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 30 Oct 2011 18:28:22 +0000 Subject: [PATCH 547/702] Factor out an _SaveSettings() call to write back settings. Use it to commit tray item changes immediately instead of at Deskbar exit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43009 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/StatusView.cpp | 44 ++++++++++++++++++++++++--------- src/apps/deskbar/StatusView.h | 2 ++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index d6a91707fa..9b613baa2e 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -439,14 +439,7 @@ TReplicantTray::InitAddOnSupport() void TReplicantTray::DeleteAddOnSupport() { - BPath path; - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { - path.Append(kReplicantSettingsFile); - - BFile file(path.Path(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); - if (file.InitCheck() == B_OK) - fAddOnSettings.Flatten(&file); - } + _SaveSettings(); for (int32 i = fItemList->CountItems(); i-- > 0 ;) { DeskbarItemInfo* item = (DeskbarItemInfo*)fItemList->RemoveItem(i); @@ -625,9 +618,8 @@ TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool addToSettings) // add the rep; adds info to list if (addToSettings) { - entry_ref ref; - if (entry->GetRef(&ref) == B_OK) - fAddOnSettings.AddString(kReplicantPathField, path.Path()); + fAddOnSettings.AddString(kReplicantPathField, path.Path()); + _SaveSettings(); } return B_OK; @@ -697,6 +689,18 @@ TReplicantTray::RemoveItem(int32 id) // attribute was added via Deskbar API (AddItem(entry_ref*, int32*) if (item->isAddOn) { + BPath path(&item->entryRef); + BString storedPath; + for (int32 i = 0; + fAddOnSettings->FindString(kReplicantPathField, i, &storedPath) + == B_OK; i++) { + if (storedPath == path.Path()) { + fAddOnSettings->RemoveItem(kReplicantPathField, i); + break; + } + } + _SaveSettings(); + BNode node(&item->entryRef); watch_node(&item->nodeRef, B_STOP_WATCHING, this, Window()); } @@ -1198,6 +1202,24 @@ TReplicantTray::SetMultiRow(bool state) } +void +TReplicantTray::_SaveSettings() +{ + status_t result; + BPath path; + if ((result = find_directory(B_USER_SETTINGS_DIRECTORY, &path, true)) + == B_OK) { + path.Append(kReplicantSettingsFile); + + BFile file(path.Path(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); + if ((result = file.InitCheck()) == B_OK) + result = fAddOnSettings.Flatten(&file); + } + + return result; +} + + // #pragma mark - diff --git a/src/apps/deskbar/StatusView.h b/src/apps/deskbar/StatusView.h index 0ef5e81dc1..77e862cd56 100644 --- a/src/apps/deskbar/StatusView.h +++ b/src/apps/deskbar/StatusView.h @@ -199,6 +199,8 @@ public: bool IsDragging() {return IsTracking();} private: + status_t _SaveSettings(); + TBarView* fBarView; BView* fChild; BPoint fPreviousPosition; From b373759b5d990f4d1a3f5d4c746b6f9b5bb6ef90 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 30 Oct 2011 19:36:26 +0000 Subject: [PATCH 548/702] Build fix. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43011 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/StatusView.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/deskbar/StatusView.h b/src/apps/deskbar/StatusView.h index 77e862cd56..fbfc6c4720 100644 --- a/src/apps/deskbar/StatusView.h +++ b/src/apps/deskbar/StatusView.h @@ -146,6 +146,8 @@ private: BPoint LocationForReplicant(int32 index, float width); BShelf* Shelf() const; + status_t _SaveSettings(); + friend class TReplicantShelf; TTimeView* fClock; @@ -199,8 +201,6 @@ public: bool IsDragging() {return IsTracking();} private: - status_t _SaveSettings(); - TBarView* fBarView; BView* fChild; BPoint fPreviousPosition; From 312e961c5d3c1e1ad7ed99abf47666a822b51f7f Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 30 Oct 2011 19:39:12 +0000 Subject: [PATCH 549/702] Closing #8063: * touch all .info files before trying to build the gcc4 buildtools in order to avoid the dependency on makeinfo. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43012 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/scripts/build_cross_tools_gcc4 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/scripts/build_cross_tools_gcc4 b/build/scripts/build_cross_tools_gcc4 index 9eb0c8257c..fa20f7c601 100755 --- a/build/scripts/build_cross_tools_gcc4 +++ b/build/scripts/build_cross_tools_gcc4 @@ -86,6 +86,12 @@ if [ -z "$gccVersion" ]; then exit 1 fi +# touch all info files in order to avoid the dependency on makeinfo +# (which apparently doesn't work reliably on all the different host +# configurations and changes files which in turn appear as local changes +# to the VCS). +find $binutilsSourceDir -name \*.info -print0 | xargs -0 touch +find $gccSourceDir -name \*.info -print0 | xargs -0 touch # create the object and installation directories for the cross compilation tools installDir=$haikuOutputDir/cross-tools From 8aab28f19b8361c9eebdd81c7ae645ba3d10096e Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 30 Oct 2011 19:42:44 +0000 Subject: [PATCH 550/702] And more fixes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43013 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/StatusView.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 9b613baa2e..ea73298c82 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -692,10 +692,10 @@ TReplicantTray::RemoveItem(int32 id) BPath path(&item->entryRef); BString storedPath; for (int32 i = 0; - fAddOnSettings->FindString(kReplicantPathField, i, &storedPath) + fAddOnSettings.FindString(kReplicantPathField, i, &storedPath) == B_OK; i++) { if (storedPath == path.Path()) { - fAddOnSettings->RemoveItem(kReplicantPathField, i); + fAddOnSettings.RemoveData(kReplicantPathField, i); break; } } @@ -1202,7 +1202,7 @@ TReplicantTray::SetMultiRow(bool state) } -void +status_t TReplicantTray::_SaveSettings() { status_t result; From d3fdd8b1800c07919c89f51781040895b397bfff Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 30 Oct 2011 20:37:15 +0000 Subject: [PATCH 551/702] Remove superflous test done a few lines above already. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43014 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm_page.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/vm/vm_page.cpp b/src/system/kernel/vm/vm_page.cpp index 3816c45375..cefb53a0e0 100644 --- a/src/system/kernel/vm/vm_page.cpp +++ b/src/system/kernel/vm/vm_page.cpp @@ -2250,7 +2250,7 @@ idle_scan_active_pages(page_stats& pageStats) if (cache == NULL) continue; - if (cache == NULL || page->State() != PAGE_STATE_ACTIVE) { + if (page->State() != PAGE_STATE_ACTIVE) { // page is no longer in the cache or in this queue cache->ReleaseRefAndUnlock(); continue; From 7349dee191579773a0bd80057d7639cd30578c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 30 Oct 2011 20:45:57 +0000 Subject: [PATCH 552/702] Rename the settings file to match the addon name. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43015 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.h b/src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.h index d2ac025f35..d9e2ab5191 100644 --- a/src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.h +++ b/src/add-ons/media/media-add-ons/esound_sink/ESDSinkAddOn.h @@ -34,7 +34,7 @@ #include #include -#define SETTINGS_FILE "Media/esd_sink_settings" +#define SETTINGS_FILE "Media/esound_sink_settings" class ESDSinkAddOn : public BMediaAddOn From 86b7df9ad63f3bd4fbf99a849bb30eac948392d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 30 Oct 2011 21:14:50 +0000 Subject: [PATCH 553/702] Add five Wacom Bamboo models, patch by Jeroen Oortwijn (idefix) from ticket #7600. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43016 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../devices/wacom/TabletDevice.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp index 60bf65de8b..068dd9ba6c 100644 --- a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp +++ b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp @@ -10,6 +10,7 @@ * Frans van Nispen * Stefan Werner * Hiroyuki Tsutsumi + * Jeroen Oortwijn */ #include @@ -238,6 +239,21 @@ TabletDevice::DetectDevice(const DeviceReader* reader) case 0xD4: // Wacom Bamboo 4x5 (from Linux Wacom Project) SetDevice(14720.0, 9200.0, DEVICE_BAMBOO_PT); break; + case 0xD6: // Wacom Bamboo CTH-460/K (from Linux Wacom Project) + SetDevice(14720.0, 9200.0, DEVICE_BAMBOO_PT); + break; + case 0xD7: // Wacom Bamboo CTH-461/S (from Linux Wacom Project) + SetDevice(14720.0, 9200.0, DEVICE_BAMBOO_PT); + break; + case 0xD8: // Wacom Bamboo CTH-661/S1 (from Linux Wacom Project) + SetDevice(21648.0, 13530.0, DEVICE_BAMBOO_PT); + break; + case 0xDA: // Wacom Bamboo CTH-461/L (from Linux Wacom Project) + SetDevice(14720.0, 9200.0, DEVICE_BAMBOO_PT); + break; + case 0xDB: // Wacom Bamboo CTH-661 (from Linux Wacom Project) + SetDevice(21648.0, 13530.0, DEVICE_BAMBOO_PT); + break; default: status = B_BAD_VALUE; break; @@ -816,6 +832,21 @@ TabletDevice::_GetName(uint16 productID, const char** name) const case 0xD4: *name = "Wacom Bamboo 4x5\" USB"; break; + case 0xD6: + *name = "Wacom Bamboo (CTH-460/K)"; + break; + case 0xD7: + *name = "Wacom Bamboo (CTH-461/S)"; + break; + case 0xD8: + *name = "Wacom Bamboo (CTH-661/S1)"; + break; + case 0xDA: + *name = "Wacom Bamboo (CTH-461/L)"; + break; + case 0xDB: + *name = "Wacom Bamboo (CTH-661)"; + break; default: *name = ""; From ba43890fe54da3f3d62db4950d17833ce4a6282c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 30 Oct 2011 21:18:20 +0000 Subject: [PATCH 554/702] Whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43017 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../devices/wacom/TabletDevice.cpp | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp index 068dd9ba6c..224f0f7c89 100644 --- a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp +++ b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp @@ -310,7 +310,7 @@ TabletDevice::ReadData(const uchar* data, int dataBytes, bool& hasContact, xPos = data[3] << 8 | data[2]; yPos = data[5] << 8 | data[4]; - hasContact = (data[1] & 0x80); + hasContact = (data[1] & 0x80); uint16 pressureData = data[7] << 8 | data[6]; pressure = (float)pressureData / 511.0; @@ -338,17 +338,17 @@ TabletDevice::ReadData(const uchar* data, int dataBytes, bool& hasContact, if (dataBytes < 20) { // ignore touch-packets xPos = data[3] << 8 | data[2]; yPos = data[5] << 8 | data[4]; - - hasContact = (data[1] & 0x10) && (data[1] & 0x20); - + + hasContact = (data[1] & 0x10) && (data[1] & 0x20); + uint16 pressureData = data[7] << 8 | data[6]; pressure = (float)pressureData / 1023.0; eraser = (data[1] & 0x08); - + firstButton = (data[1] & 0x01); secondButton = (data[1] & 0x02); thirdButton = (data[1] & 0x04); - + break; } } @@ -408,7 +408,7 @@ TabletDevice::ReadData(const uchar* data, int dataBytes, bool& hasContact, hasContact = ( data[1] & 0x20); xPos = data[2] << 8 | data[3]; yPos = data[5] << 8 | data[6]; - firstButton = (data[4] & 0x08); + firstButton = (data[4] & 0x08); secondButton = (data[4] & 0x10); thirdButton = (data[4] & 0x20); uint16 pressureData = (data[4] & 0x04) >> 2 | (data[7] & 0x7f) << 1; @@ -418,15 +418,15 @@ TabletDevice::ReadData(const uchar* data, int dataBytes, bool& hasContact, case DEVICE_VOLITO: { eraser = 0; thirdButton = 0; - + xPos = data[3] << 8 | data[2]; yPos = data[5] << 8 | data[4]; - hasContact = (data[1] & 0x80); + hasContact = (data[1] & 0x80); firstButton = (data[1] & 0x01) == 1; secondButton = data[1] & 0x04; - + uint16 pressureData = data[7] << 8 | data[6]; pressure = (float)pressureData / 511.0; @@ -437,13 +437,13 @@ TabletDevice::ReadData(const uchar* data, int dataBytes, bool& hasContact, pressure = 0.0; secondButton = data[1] & 0x02; } - + break; } case DEVICE_PENSTATION: { xPos = data[3] << 8 | data[2]; yPos = data[5] << 8 | data[4]; - hasContact = (data[1] & 0x10); + hasContact = (data[1] & 0x10); uint16 pressureData = data[7] << 8 | data[6]; pressure = (float)pressureData / 511.0; firstButton = (data[1] & 0x01); @@ -475,7 +475,7 @@ TabletDevice::SetStatus(uint32 mode, uint32 buttons, float x, float y, what = B_MOUSE_DOWN; else if (buttons < fButtons) what = B_MOUSE_UP; - + #if DEBUG float tabletX = x; @@ -483,10 +483,10 @@ TabletDevice::SetStatus(uint32 mode, uint32 buttons, float x, float y, #endif x /= fMaxX; y /= fMaxY; - + float deltaX = 0.0; float deltaY = 0.0; - + float absDeltaX = 0.0; float absDeltaY = 0.0; @@ -510,13 +510,13 @@ fParent->LogString() << "tilt x: " << tiltX << ", tilt y: " << tiltY << "\n\n"; if (absDeltaY < fJitterY) y = fPosY; } - + // only do send message if something changed if (x != fPosX || y != fPosY || fButtons != buttons || pressure != fPressure || fEraser != eraser || fTiltX != tiltX || fTiltY != tiltY) { - + bigtime_t now = system_time(); - + // common fields for any mouse message BMessage* event = new BMessage(what); event->AddInt64("when", now); @@ -579,7 +579,7 @@ event->AddFloat("tablet y", tabletY); status_t ret = fParent->EnqueueMessage(event); if (ret < B_OK) PRINT(("EnqueueMessage(): %s\n", strerror(ret))); - + // apply values to members fPosX = x; fPosY = y; @@ -590,7 +590,7 @@ event->AddFloat("tablet y", tabletY); fTiltX = tiltX; fTiltY = tiltY; } - + // separate wheel changed message if (fWheelX != wheelX || fWheelY != wheelY) { BMessage* event = new BMessage(B_MOUSE_WHEEL_CHANGED); From 48215ce4670d5dc2b8ebda722141458dfb2bbb24 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 30 Oct 2011 22:40:45 +0000 Subject: [PATCH 555/702] Use a more correct mimetype for libbe catalogs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43018 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/kits/locale/be.catkeys | 2 +- data/catalogs/kits/locale/cs.catkeys | 2 +- data/catalogs/kits/locale/da.catkeys | 2 +- data/catalogs/kits/locale/de.catkeys | 2 +- data/catalogs/kits/locale/es.catkeys | 2 +- data/catalogs/kits/locale/fi.catkeys | 2 +- data/catalogs/kits/locale/fr.catkeys | 2 +- data/catalogs/kits/locale/it.catkeys | 2 +- data/catalogs/kits/locale/ja.catkeys | 2 +- data/catalogs/kits/locale/ko.catkeys | 2 +- data/catalogs/kits/locale/lt.catkeys | 2 +- data/catalogs/kits/locale/nb.catkeys | 2 +- data/catalogs/kits/locale/nl.catkeys | 2 +- data/catalogs/kits/locale/pl.catkeys | 2 +- data/catalogs/kits/locale/pt.catkeys | 2 +- data/catalogs/kits/locale/pt_br.catkeys | 2 +- data/catalogs/kits/locale/ro.catkeys | 2 +- data/catalogs/kits/locale/ru.catkeys | 2 +- data/catalogs/kits/locale/sk.catkeys | 2 +- data/catalogs/kits/locale/sv.catkeys | 2 +- data/catalogs/kits/locale/uk.catkeys | 2 +- data/catalogs/kits/locale/zh_hans.catkeys | 2 +- src/kits/locale/Jamfile | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/data/catalogs/kits/locale/be.catkeys b/data/catalogs/kits/locale/be.catkeys index aae2117181..30fde58d61 100644 --- a/data/catalogs/kits/locale/be.catkeys +++ b/data/catalogs/kits/locale/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian system 180647795 +1 belarusian x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f ТіБ %3.2f GiB StringForSize %3.2f ГіБ %3.2f KiB StringForSize %3.2f КіБ diff --git a/data/catalogs/kits/locale/cs.catkeys b/data/catalogs/kits/locale/cs.catkeys index e574a8a2a6..1d13761d19 100644 --- a/data/catalogs/kits/locale/cs.catkeys +++ b/data/catalogs/kits/locale/cs.catkeys @@ -1,4 +1,4 @@ -1 czech system 2686335505 +1 czech x-vnd.Haiku-libbe 2686335505 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/da.catkeys b/data/catalogs/kits/locale/da.catkeys index a0e1725169..7834921183 100644 --- a/data/catalogs/kits/locale/da.catkeys +++ b/data/catalogs/kits/locale/da.catkeys @@ -1,4 +1,4 @@ -1 danish system 2677153267 +1 danish x-vnd.Haiku-libbe 2677153267 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/de.catkeys b/data/catalogs/kits/locale/de.catkeys index b6780c6615..92a37564ea 100644 --- a/data/catalogs/kits/locale/de.catkeys +++ b/data/catalogs/kits/locale/de.catkeys @@ -1,4 +1,4 @@ -1 german system 180647795 +1 german x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/es.catkeys b/data/catalogs/kits/locale/es.catkeys index d70030d6e0..666e7e5672 100644 --- a/data/catalogs/kits/locale/es.catkeys +++ b/data/catalogs/kits/locale/es.catkeys @@ -1,4 +1,4 @@ -1 spanish system 2677153267 +1 spanish x-vnd.Haiku-libbe 2677153267 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/fi.catkeys b/data/catalogs/kits/locale/fi.catkeys index c4a017844f..3390e8db69 100644 --- a/data/catalogs/kits/locale/fi.catkeys +++ b/data/catalogs/kits/locale/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish system 180647795 +1 finnish x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f tebitavua %3.2f GiB StringForSize %3.2f gibitavua %3.2f KiB StringForSize %3.2f kibitavua diff --git a/data/catalogs/kits/locale/fr.catkeys b/data/catalogs/kits/locale/fr.catkeys index 06c95dd05d..d7c9cc6400 100644 --- a/data/catalogs/kits/locale/fr.catkeys +++ b/data/catalogs/kits/locale/fr.catkeys @@ -1,4 +1,4 @@ -1 french system 180647795 +1 french x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f Tio %3.2f GiB StringForSize %3.2f Gio %3.2f KiB StringForSize %3.2f Kio diff --git a/data/catalogs/kits/locale/it.catkeys b/data/catalogs/kits/locale/it.catkeys index d07d918dbb..853cfdc479 100644 --- a/data/catalogs/kits/locale/it.catkeys +++ b/data/catalogs/kits/locale/it.catkeys @@ -1,4 +1,4 @@ -1 italian system 2686335505 +1 italian x-vnd.Haiku-libbe 2686335505 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/ja.catkeys b/data/catalogs/kits/locale/ja.catkeys index 8ff0b315a9..a8bc69f47d 100644 --- a/data/catalogs/kits/locale/ja.catkeys +++ b/data/catalogs/kits/locale/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese system 180647795 +1 japanese x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/ko.catkeys b/data/catalogs/kits/locale/ko.catkeys index 5e6f006f9d..30eaa9c91b 100644 --- a/data/catalogs/kits/locale/ko.catkeys +++ b/data/catalogs/kits/locale/ko.catkeys @@ -1,4 +1,4 @@ -1 korean system 2677153267 +1 korean x-vnd.Haiku-libbe 2677153267 %.2f TiB StringForSize %.2f 테라 이진 바이트 %3.2f GiB StringForSize %3.2f 기가 이진 바이트 %3.2f KiB StringForSize %3.2f 킬로 이진 바이트 diff --git a/data/catalogs/kits/locale/lt.catkeys b/data/catalogs/kits/locale/lt.catkeys index 4196da0b54..f3eb6bb9fd 100644 --- a/data/catalogs/kits/locale/lt.catkeys +++ b/data/catalogs/kits/locale/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian system 1448968507 +1 lithuanian x-vnd.Haiku-libbe 1448968507 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/nb.catkeys b/data/catalogs/kits/locale/nb.catkeys index 15608a5fa4..76a915f27a 100644 --- a/data/catalogs/kits/locale/nb.catkeys +++ b/data/catalogs/kits/locale/nb.catkeys @@ -1,4 +1,4 @@ -1 norwegian_bokmål system 320832488 +1 norwegian_bokmål x-vnd.Haiku-libbe 320832488 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/nl.catkeys b/data/catalogs/kits/locale/nl.catkeys index fde66c6bbd..ef727acda2 100644 --- a/data/catalogs/kits/locale/nl.catkeys +++ b/data/catalogs/kits/locale/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch system 1624661606 +1 dutch x-vnd.Haiku-libbe 1624661606 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/pl.catkeys b/data/catalogs/kits/locale/pl.catkeys index 76e202caab..24d1f19c2b 100644 --- a/data/catalogs/kits/locale/pl.catkeys +++ b/data/catalogs/kits/locale/pl.catkeys @@ -1,4 +1,4 @@ -1 polish system 1624661606 +1 polish x-vnd.Haiku-libbe 1624661606 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/pt.catkeys b/data/catalogs/kits/locale/pt.catkeys index 7687339be5..f885157dac 100644 --- a/data/catalogs/kits/locale/pt.catkeys +++ b/data/catalogs/kits/locale/pt.catkeys @@ -1,4 +1,4 @@ -1 portuguese system 1448968507 +1 portuguese x-vnd.Haiku-libbe 1448968507 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/pt_br.catkeys b/data/catalogs/kits/locale/pt_br.catkeys index bb1549c625..203853f771 100644 --- a/data/catalogs/kits/locale/pt_br.catkeys +++ b/data/catalogs/kits/locale/pt_br.catkeys @@ -1,2 +1,2 @@ -1 brazilian_portuguese system 1228184760 +1 brazilian_portuguese x-vnd.Haiku-libbe 1228184760 %d bytes StringForSize %d bytes diff --git a/data/catalogs/kits/locale/ro.catkeys b/data/catalogs/kits/locale/ro.catkeys index 816150101f..db6b53e8aa 100644 --- a/data/catalogs/kits/locale/ro.catkeys +++ b/data/catalogs/kits/locale/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian system 1624661606 +1 romanian x-vnd.Haiku-libbe 1624661606 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/ru.catkeys b/data/catalogs/kits/locale/ru.catkeys index 2a80928bc4..9c58952a06 100644 --- a/data/catalogs/kits/locale/ru.catkeys +++ b/data/catalogs/kits/locale/ru.catkeys @@ -1,4 +1,4 @@ -1 russian system 180647795 +1 russian x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f Тбайт %3.2f GiB StringForSize %3.2f Гбайт %3.2f KiB StringForSize %3.2f Кбайт diff --git a/data/catalogs/kits/locale/sk.catkeys b/data/catalogs/kits/locale/sk.catkeys index cb012aae6b..3246238e60 100644 --- a/data/catalogs/kits/locale/sk.catkeys +++ b/data/catalogs/kits/locale/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak system 180647795 +1 slovak x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/sv.catkeys b/data/catalogs/kits/locale/sv.catkeys index 417251ba98..f098f3adf8 100644 --- a/data/catalogs/kits/locale/sv.catkeys +++ b/data/catalogs/kits/locale/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish system 180647795 +1 swedish x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/uk.catkeys b/data/catalogs/kits/locale/uk.catkeys index 30f0f72f9c..8165a986e4 100644 --- a/data/catalogs/kits/locale/uk.catkeys +++ b/data/catalogs/kits/locale/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian system 180647795 +1 ukrainian x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/kits/locale/zh_hans.catkeys b/data/catalogs/kits/locale/zh_hans.catkeys index da48231682..9a47a1388a 100644 --- a/data/catalogs/kits/locale/zh_hans.catkeys +++ b/data/catalogs/kits/locale/zh_hans.catkeys @@ -1,4 +1,4 @@ -1 simplified_chinese system 180647795 +1 simplified_chinese x-vnd.Haiku-libbe 180647795 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/src/kits/locale/Jamfile b/src/kits/locale/Jamfile index 42a087add6..41a1f82fe4 100644 --- a/src/kits/locale/Jamfile +++ b/src/kits/locale/Jamfile @@ -74,7 +74,7 @@ SEARCH on [ FGristFiles PrintJob.cpp ] += [ FDirName $(HAIKU_TOP) src kits inter SEARCH on [ FGristFiles ZombieReplicantView.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; DoCatalogs liblocale.so - : system + : x-vnd.Haiku-libbe : AboutMenuItem.cpp AboutWindow.cpp From 1ea897d0ab8d05848826377791c1512216dd7ca8 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 31 Oct 2011 07:07:43 +0000 Subject: [PATCH 556/702] Should have been part of yesterday's Deskbar changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43019 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Deskbar.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/kits/interface/Deskbar.cpp b/src/kits/interface/Deskbar.cpp index 63e7e1177a..6db798917f 100644 --- a/src/kits/interface/Deskbar.cpp +++ b/src/kits/interface/Deskbar.cpp @@ -277,21 +277,8 @@ BDeskbar::AddItem(entry_ref *addon, int32 *_id) BMessage request(kMsgAddAddOn); request.AddRef("addon", addon); - // Note: to make Deskbar items persistent, they need to have the attribute - // set. The Deskbar will remove the attribute automatically when needed. - // ToDo: move this functionality into the Deskbar itself! - - BNode node; - status_t status = node.SetTo(addon); - if (status < B_OK) - return status; - - if ((status = node.WriteAttr("be:deskbar_item_status", B_STRING_TYPE, - 0, "enabled", strlen("enabled"))) < B_OK) - return status; - BMessage reply; - status = fMessenger->SendMessage(&request, &reply); + status_t status = fMessenger->SendMessage(&request, &reply); if (status == B_OK) { if (_id != NULL) status = reply.FindInt32("id", _id); From ef9641e111c4371d9e332ad7fd9ed68c877f3cb3 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Mon, 31 Oct 2011 07:42:49 +0000 Subject: [PATCH 557/702] Some updates to the ReadMe's. Basically remove references to BeOS being a supported build platform. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43020 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- ReadMe | 32 ++++++++++++-------------------- ReadMe.cross-compile | 21 +++++++++++---------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/ReadMe b/ReadMe index 5bf4fa894f..cb34eee8f4 100644 --- a/ReadMe +++ b/ReadMe @@ -1,15 +1,14 @@ -Building on BeOS -================ +Building on Haiku +================= -For building on BeOS you need the development tools from: +For building on Haiku, all of the necessary development tools are included in +both official releases (R1 alpha 1 for instance) and the nightly builds. - http://haiku-os.org/downloads +Official releases can be obtained from www.haiku-os.org/get-haiku +The nightly builds are available at http://www.haiku-files.org -Please always use the most recent versions. They are required to build Haiku. - - -Building on a non-BeOS platform -=============================== +Building on a non-Haiku platform +================================ Please read the file 'ReadMe.cross-compile' before continuing. It describes how to build the cross-compilation tools and configure the build system for @@ -17,19 +16,13 @@ building Haiku. After following the instructions you can directly continue with the section Building. -Configuring on BeOS -=================== +Configuring on Haiku +==================== Open a Terminal and change to your Haiku trunk folder. To configure the build you can run configure like this: - ./configure --target=TARGET - -Where "TARGET" is the target platform that the compiled code should run on: - * haiku (default) - * r5 - * bone - * dano (also for Zeta) + ./configure The configure script generates a file named "BuildConfig" in the "generated/build" directory. As long as configure is not modified (!), there @@ -78,13 +71,12 @@ Bootable CD-ROM Image This _requires_ having the mkisofs tool installed. On Debian GNU/Linux for example you can install it with: apt-get install mkisofs -On BeOS you can get it from http://bebits.com/app/3964 along with cdrecord. This creates a bootable 'haiku-cd.iso' in your 'generated/' folder: jam -q haiku-cd -Under Unix/Linux, and BeOS you can use cdrecord to create a CD with: +Under Unix/Linux, and Haiku you can use cdrecord to create a CD with: cdrecord dev=x,y,z -v -eject -dao -data generated/haiku-cd.iso diff --git a/ReadMe.cross-compile b/ReadMe.cross-compile index 512468eaed..5b4291ff2e 100644 --- a/ReadMe.cross-compile +++ b/ReadMe.cross-compile @@ -1,16 +1,16 @@ -Building on a non-BeOS platform -=============================== +Building on a non-Haiku platform +================================ -We currently support these non-BeOS platforms: +We currently support these non-Haiku platforms: * Linux * FreeBSD * Mac OS X Intel (gcc 4 builds only) -To build Haiku on a non-BeOS platform you must first check out and build the -cross-compiler. The easiest method for doing so is to check it out in the -parent directory of your Haiku repository: +To build Haiku on a platform other than Haiku, you must first check out and +build the cross-compiler. The easiest method for doing so is to check it out in +the parent directory of your Haiku repository: - svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools + svn checkout http://svn.haiku-os.org/haiku/buildtools/trunk buildtools You should now have a 'buildtools' folder that contains folders named 'binutils', 'gcc', and 'jam' among others. @@ -46,10 +46,11 @@ Change to the buildtools folder and we will start to build 'jam' which is a requirement for building Haiku. Run the following commands to generate and install the tool: - cd buildtools/jam + cd buildtools/jam make sudo ./jam0 install - + -- or -- + ./jam0 -sBINDIR=$HOME/bin install Building binutils ================= @@ -68,7 +69,7 @@ frequent build issues. The commands for configuration are, GCC 2.95 -------- - cd haiku + cd haiku ./configure --build-cross-tools ../buildtools/ GCC 4.x From 54fad654ce9986a2b0ce4849608e738907509292 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 08:57:09 +0000 Subject: [PATCH 558/702] Rework the handling of catalog loading in locale kit : Instead of computing the mime signature and giving this to the catalog system, give an entry_ref instead. The default catalog add-on can thus look at the right place when searching local catalogs (embedded as resources, or stored as files next to the executable. * This allows different versions of the same app to each have their own catalog set, * And also make the embedded/local catalog searching work for add-ons and libs, instead it only worked for apps because of a getAppInfo call. Fix cpufrequency to make use of it properly (that wouldhave worked without the change, but nowit's mandatory, since loading a catlog by mimesignature is not possible anymore). Should fix #8037. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43021 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/locale/Catalog.h | 4 +- headers/private/locale/DefaultCatalog.h | 6 +- headers/private/locale/MutableLocaleRoster.h | 6 +- src/kits/libbe_version.rdef | 2 + src/kits/locale/Catalog.cpp | 8 +-- src/kits/locale/DefaultCatalog.cpp | 54 ++++++++++++------ src/kits/locale/LocaleRoster.cpp | 26 ++------- src/kits/locale/MutableLocaleRoster.cpp | 59 +++----------------- src/preferences/cpufrequency/StatusView.cpp | 32 +++++------ src/preferences/cpufrequency/StatusView.h | 2 - src/tools/locale/Catalog.cpp | 5 +- src/tools/locale/DefaultCatalog.cpp | 48 ++++++++++------ 12 files changed, 110 insertions(+), 142 deletions(-) diff --git a/headers/os/locale/Catalog.h b/headers/os/locale/Catalog.h index bcc2ab5bdd..11cb6368fc 100644 --- a/headers/os/locale/Catalog.h +++ b/headers/os/locale/Catalog.h @@ -20,7 +20,7 @@ struct entry_ref; class BCatalog { public: BCatalog(); - BCatalog(const char* signature, + BCatalog(const entry_ref& catalogOwner, const char* language = NULL, uint32 fingerprint = 0); virtual ~BCatalog(); @@ -42,7 +42,7 @@ public: status_t GetLanguage(BString* language); status_t GetFingerprint(uint32* fingerprint); - status_t SetCatalog(const char* signature, + status_t SetCatalog(const entry_ref& catalogOwner, uint32 fingerprint); status_t InitCheck() const; diff --git a/headers/private/locale/DefaultCatalog.h b/headers/private/locale/DefaultCatalog.h index 0b52305b43..a79bd31321 100644 --- a/headers/private/locale/DefaultCatalog.h +++ b/headers/private/locale/DefaultCatalog.h @@ -24,7 +24,7 @@ namespace BPrivate { */ class DefaultCatalog : public BHashMapCatalog { public: - DefaultCatalog(const char *signature, const char *language, + DefaultCatalog(const entry_ref &catalogOwner, const char *language, uint32 fingerprint); // constructor for normal use DefaultCatalog(entry_ref *appOrAddOnRef); @@ -45,10 +45,10 @@ class DefaultCatalog : public BHashMapCatalog { status_t WriteToResource(entry_ref *appOrAddOnRef); status_t SetRawString(const CatKey& key, const char *translated); + void SetSignature(const entry_ref &catalogOwner); - static BCatalogAddOn *Instantiate(const char *signature, + static BCatalogAddOn *Instantiate(const entry_ref& catalogOwner, const char *language, uint32 fingerprint); - static BCatalogAddOn *InstantiateEmbedded(entry_ref *appOrAddOnRef); static BCatalogAddOn *Create(const char *signature, const char *language); diff --git a/headers/private/locale/MutableLocaleRoster.h b/headers/private/locale/MutableLocaleRoster.h index b1a377ef93..1027fce68e 100644 --- a/headers/private/locale/MutableLocaleRoster.h +++ b/headers/private/locale/MutableLocaleRoster.h @@ -48,10 +48,9 @@ public: status_t GetSystemCatalog(BCatalogAddOn** catalog) const; - BCatalogAddOn* LoadCatalog(const char* signature, + BCatalogAddOn* LoadCatalog(const entry_ref& catalogOwner, const char* language = NULL, int32 fingerprint = 0) const; - BCatalogAddOn* LoadEmbeddedCatalog(entry_ref* appOrAddOnRef); status_t UnloadCatalog(BCatalogAddOn* addOn); BCatalogAddOn* CreateCatalog(const char* type, @@ -60,7 +59,7 @@ public: }; -typedef BCatalogAddOn* (*InstantiateCatalogFunc)(const char* name, +typedef BCatalogAddOn* (*InstantiateCatalogFunc)(const entry_ref& catalogOwner, const char* language, uint32 fingerprint); typedef BCatalogAddOn* (*CreateCatalogFunc)(const char* name, @@ -77,7 +76,6 @@ typedef status_t (*GetAvailableLanguagesFunc)(BMessage*, const char*, */ struct CatalogAddOnInfo { InstantiateCatalogFunc fInstantiateFunc; - InstantiateEmbeddedCatalogFunc fInstantiateEmbeddedFunc; CreateCatalogFunc fCreateFunc; GetAvailableLanguagesFunc fLanguagesFunc; diff --git a/src/kits/libbe_version.rdef b/src/kits/libbe_version.rdef index 07854914fd..f7a90b9d8d 100644 --- a/src/kits/libbe_version.rdef +++ b/src/kits/libbe_version.rdef @@ -10,3 +10,5 @@ resource app_version { short_info = "Walter", long_info = "©2001-2011 Haiku Inc." }; + +resource app_signature "application/x-vnd.Haiku-libbe" ; diff --git a/src/kits/locale/Catalog.cpp b/src/kits/locale/Catalog.cpp index 1791e9132a..7e4a0b2d1d 100644 --- a/src/kits/locale/Catalog.cpp +++ b/src/kits/locale/Catalog.cpp @@ -26,10 +26,10 @@ BCatalog::BCatalog() } -BCatalog::BCatalog(const char *signature, const char *language, +BCatalog::BCatalog(const entry_ref &catalogOwner, const char *language, uint32 fingerprint) { - fCatalog = MutableLocaleRoster::Default()->LoadCatalog(signature, language, + fCatalog = MutableLocaleRoster::Default()->LoadCatalog(catalogOwner, language, fingerprint); } @@ -98,12 +98,12 @@ BCatalog::GetData(uint32 id, BMessage *msg) status_t -BCatalog::SetCatalog(const char* signature, uint32 fingerprint) +BCatalog::SetCatalog(const entry_ref &catalogOwner, uint32 fingerprint) { // This is not thread safe. It is used only in ReadOnlyBootPrompt and should // not do harm there, but not sure what to do about it… MutableLocaleRoster::Default()->UnloadCatalog(fCatalog); - fCatalog = MutableLocaleRoster::Default()->LoadCatalog(signature, NULL, + fCatalog = MutableLocaleRoster::Default()->LoadCatalog(catalogOwner, NULL, fingerprint); return B_OK; diff --git a/src/kits/locale/DefaultCatalog.cpp b/src/kits/locale/DefaultCatalog.cpp index 17713f8a70..092edbec6a 100644 --- a/src/kits/locale/DefaultCatalog.cpp +++ b/src/kits/locale/DefaultCatalog.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -55,16 +56,47 @@ const uint8 DefaultCatalog::kDefaultCatalogAddOnPriority = 1; // give highest priority to our embedded catalog-add-on +void DefaultCatalog::SetSignature(const entry_ref &catalogOwner) +{ + // figure out mimetype from image + BFile objectFile(&catalogOwner, B_READ_ONLY); + BAppFileInfo objectInfo(&objectFile); + char objectSignature[B_MIME_TYPE_LENGTH]; + if (objectInfo.GetSignature(objectSignature) != B_OK) { + log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" + " localization.", catalogOwner.name); + fSignature = ""; + return; + } + + // drop supertype from mimetype (should be "application/"): + char* stripSignature = objectSignature; + while (*stripSignature != '/' && *stripSignature != '\0') + stripSignature ++; + + if (*stripSignature == '\0') + stripSignature = objectSignature; + else + stripSignature ++; + + log_team(LOG_DEBUG, "Image %s requested catalog with mimetype %s", + catalogOwner.name, stripSignature); + fSignature = stripSignature; +} + + /*! Constructs a DefaultCatalog with given signature and language and reads the catalog from disk. InitCheck() will be B_OK if catalog could be loaded successfully, it will give an appropriate error-code otherwise. */ -DefaultCatalog::DefaultCatalog(const char *signature, const char *language, +DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, const char *language, uint32 fingerprint) : - BHashMapCatalog(signature, language, fingerprint) + BHashMapCatalog("", language, fingerprint) { + // We created the catalog with an invalid signature, but we fix that now. + SetSignature(catalogOwner); status_t status; app_info appInfo; @@ -116,7 +148,7 @@ DefaultCatalog::DefaultCatalog(const char *signature, const char *language, fInitCheck = status; log_team(LOG_DEBUG, "trying to load default-catalog(sig=%s, lang=%s) results in %s", - signature, language, strerror(fInitCheck)); + fSignature.String(), language, strerror(fInitCheck)); } @@ -555,23 +587,11 @@ DefaultCatalog::Unflatten(BDataIO *dataIO) BCatalogAddOn * -DefaultCatalog::Instantiate(const char *signature, const char *language, +DefaultCatalog::Instantiate(const entry_ref &catalogOwner, const char *language, uint32 fingerprint) { DefaultCatalog *catalog - = new(std::nothrow) DefaultCatalog(signature, language, fingerprint); - if (catalog && catalog->InitCheck() != B_OK) { - delete catalog; - return NULL; - } - return catalog; -} - - -BCatalogAddOn * -DefaultCatalog::InstantiateEmbedded(entry_ref *appOrAddOnRef) -{ - DefaultCatalog *catalog = new(std::nothrow) DefaultCatalog(appOrAddOnRef); + = new(std::nothrow) DefaultCatalog(catalogOwner, language, fingerprint); if (catalog && catalog->InitCheck() != B_OK) { delete catalog; return NULL; diff --git a/src/kits/locale/LocaleRoster.cpp b/src/kits/locale/LocaleRoster.cpp index 2f630c9adb..8f3f0b194b 100644 --- a/src/kits/locale/LocaleRoster.cpp +++ b/src/kits/locale/LocaleRoster.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -465,7 +464,7 @@ BLocaleRoster::GetLocalizedFileName(BString& localizedFileName, if (status != B_OK) return status; - BCatalog catalog(signature); + BCatalog catalog(ref); const char* temp = catalog.GetString(string, context); if (temp == NULL) @@ -505,28 +504,11 @@ BLocaleRoster::_GetCatalog(BCatalog* catalog, vint32* catalogInitStatus) catalog); return catalog; } - // figure out mimetype from image - BFile objectFile(info.name, B_READ_ONLY); - BAppFileInfo objectInfo(&objectFile); - char objectSignature[B_MIME_TYPE_LENGTH]; - if (objectInfo.GetSignature(objectSignature) != B_OK) { - log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" - " localization.", info.name); - return catalog; - } - - // drop supertype from mimetype (should be "application/"): - char* stripSignature = objectSignature; - while (*stripSignature != '/') - stripSignature ++; - stripSignature ++; - - log_team(LOG_DEBUG, - "Image %s (address %x) requested catalog with mimetype %s", - info.name, catalog, stripSignature); // load the catalog for this mimetype and return it to the app - catalog->SetCatalog(stripSignature, 0); + entry_ref ref; + BEntry(info.name).GetRef(&ref); + catalog->SetCatalog(ref, 0); *catalogInitStatus = true; return catalog; diff --git a/src/kits/locale/MutableLocaleRoster.cpp b/src/kits/locale/MutableLocaleRoster.cpp index 0ea31b1a2a..738b2d18f2 100644 --- a/src/kits/locale/MutableLocaleRoster.cpp +++ b/src/kits/locale/MutableLocaleRoster.cpp @@ -51,7 +51,6 @@ CatalogAddOnInfo::CatalogAddOnInfo(const BString& name, const BString& path, uint8 priority) : fInstantiateFunc(NULL), - fInstantiateEmbeddedFunc(NULL), fCreateFunc(NULL), fLanguagesFunc(NULL), fName(name), @@ -87,8 +86,6 @@ CatalogAddOnInfo::MakeSureItsLoaded() if (fAddOnImage >= B_OK) { get_image_symbol(fAddOnImage, "instantiate_catalog", B_SYMBOL_TYPE_TEXT, (void**)&fInstantiateFunc); - get_image_symbol(fAddOnImage, "instantiate_embedded_catalog", - B_SYMBOL_TYPE_TEXT, (void**)&fInstantiateEmbeddedFunc); get_image_symbol(fAddOnImage, "create_catalog", B_SYMBOL_TYPE_TEXT, (void**)&fCreateFunc); get_image_symbol(fAddOnImage, "get_available_languages", @@ -115,7 +112,6 @@ CatalogAddOnInfo::UnloadIfPossible() unload_add_on(fAddOnImage); fAddOnImage = B_NO_INIT; fInstantiateFunc = NULL; - fInstantiateEmbeddedFunc = NULL; fCreateFunc = NULL; fLanguagesFunc = NULL; // log_team(LOG_DEBUG, "catalog-add-on %s has been unloaded", @@ -360,8 +356,6 @@ RosterData::_InitializeCatalogAddOns() return B_NO_MEMORY; defaultCatalogAddOnInfo->fInstantiateFunc = DefaultCatalog::Instantiate; - defaultCatalogAddOnInfo->fInstantiateEmbeddedFunc - = DefaultCatalog::InstantiateEmbedded; defaultCatalogAddOnInfo->fCreateFunc = DefaultCatalog::Create; fCatalogAddOnInfos.AddItem((void*)defaultCatalogAddOnInfo); @@ -794,7 +788,10 @@ MutableLocaleRoster::GetSystemCatalog(BCatalogAddOn** catalog) const { if (!catalog) return B_BAD_VALUE; - *catalog = LoadCatalog("system"); + // get libbe entry_ref + entry_ref ref; + BEntry("/boot/system/lib/libbe.so").GetRef(&ref); + *catalog = LoadCatalog(ref); return B_OK; } @@ -849,12 +846,9 @@ MutableLocaleRoster::CreateCatalog(const char* type, const char* signature, * NULL is returned if no matching catalog could be found. */ BCatalogAddOn* -MutableLocaleRoster::LoadCatalog(const char* signature, const char* language, +MutableLocaleRoster::LoadCatalog(const entry_ref& catalogOwner, const char* language, int32 fingerprint) const { - if (!signature) - return NULL; - BAutolock lock(RosterData::Default()->fLock); if (!lock.IsLocked()) return NULL; @@ -877,7 +871,7 @@ MutableLocaleRoster::LoadCatalog(const char* signature, const char* language, BCatalogAddOn* catalog = NULL; const char* lang; for (int32 l=0; languages.FindString("language", l, &lang)==B_OK; ++l) { - catalog = info->fInstantiateFunc(signature, lang, fingerprint); + catalog = info->fInstantiateFunc(catalogOwner, lang, fingerprint); if (catalog) info->fLoadedCatalogs.AddItem(catalog); // Chain-load catalogs for languages that depend on @@ -889,12 +883,12 @@ MutableLocaleRoster::LoadCatalog(const char* signature, const char* language, int32 pos; BString langName(lang); BCatalogAddOn* currCatalog = catalog; - BCatalogAddOn* nextCatalog; + BCatalogAddOn* nextCatalog = NULL; while ((pos = langName.FindLast('_')) >= 0) { // language is based on parent, so we load that, too: // (even if the parent catalog was not found) langName.Truncate(pos); - nextCatalog = info->fInstantiateFunc(signature, + nextCatalog = info->fInstantiateFunc(catalogOwner, langName.String(), fingerprint); if (nextCatalog) { info->fLoadedCatalogs.AddItem(nextCatalog); @@ -915,43 +909,6 @@ MutableLocaleRoster::LoadCatalog(const char* signature, const char* language, } -/* - * Loads an embedded catalog from the given entry-ref (which is usually an - * app- or add-on-file. The request to load the catalog is dispatched to all - * add-ons in turn, until an add-on reports success. - * NULL is returned if no embedded catalog could be found. - */ -BCatalogAddOn* -MutableLocaleRoster::LoadEmbeddedCatalog(entry_ref* appOrAddOnRef) -{ - if (!appOrAddOnRef) - return NULL; - - BAutolock lock(RosterData::Default()->fLock); - if (!lock.IsLocked()) - return NULL; - - int32 count = RosterData::Default()->fCatalogAddOnInfos.CountItems(); - for (int32 i = 0; i < count; ++i) { - CatalogAddOnInfo* info = (CatalogAddOnInfo*) - RosterData::Default()->fCatalogAddOnInfos.ItemAt(i); - - if (!info->MakeSureItsLoaded() || !info->fInstantiateEmbeddedFunc) - continue; - - BCatalogAddOn* catalog = NULL; - catalog = info->fInstantiateEmbeddedFunc(appOrAddOnRef); - if (catalog) { - info->fLoadedCatalogs.AddItem(catalog); - return catalog; - } - info->UnloadIfPossible(); - } - - return NULL; -} - - /* * unloads the given catalog (or rather: catalog-chain). * Every single catalog of the chain will be deleted automatically. diff --git a/src/preferences/cpufrequency/StatusView.cpp b/src/preferences/cpufrequency/StatusView.cpp index d1320a740a..06c7e35827 100644 --- a/src/preferences/cpufrequency/StatusView.cpp +++ b/src/preferences/cpufrequency/StatusView.cpp @@ -217,22 +217,20 @@ FrequencyMenu::FrequencyMenu(BMenu* menu, BHandler* target, fStorage(storage), fInterface(interface) { - BCatalog catalog("x-vnd.Haiku-CPUFrequencyPref"); fDynamicPerformance = new BMenuItem( - catalog.GetString("Dynamic performance", B_TRANSLATE_CONTEXT), + B_TRANSLATE("Dynamic performance"), new BMessage(kMsgPolicyDynamic)); fHighPerformance = new BMenuItem( - catalog.GetString("High performance", B_TRANSLATE_CONTEXT), + B_TRANSLATE("High performance"), new BMessage(kMsgPolicyPerformance)); - fLowEnergie = new BMenuItem(catalog.GetString("Low energy", - B_TRANSLATE_CONTEXT), new BMessage(kMsgPolicyLowEnergy)); + fLowEnergie = new BMenuItem(B_TRANSLATE("Low energy"), + new BMessage(kMsgPolicyLowEnergy)); menu->AddItem(fDynamicPerformance); menu->AddItem(fHighPerformance); menu->AddItem(fLowEnergie); - fCustomStateMenu = new BMenu(catalog.GetString("Set state", - B_TRANSLATE_CONTEXT)); + fCustomStateMenu = new BMenu(B_TRANSLATE("Set state")); StateList* stateList = fInterface->GetCpuFrequencyStates(); for (int i = 0; i < stateList->CountItems(); i++) { @@ -376,8 +374,7 @@ StatusView::StatusView(BRect frame, bool inDeskbar, B_WILL_DRAW | B_FRAME_EVENTS), fInDeskbar(inDeskbar), fCurrentFrequency(NULL), - fDragger(NULL), - fCatalog("x-vnd.Haiku-CPUFrequencyPref") + fDragger(NULL) { if (!inDeskbar) { // we were obviously added to a standard window - let's add a dragger @@ -406,8 +403,7 @@ StatusView::StatusView(BMessage* archive) : BView(archive), fInDeskbar(false), fCurrentFrequency(NULL), - fDragger(NULL), - fCatalog("x-vnd.Haiku-CPUFrequencyPref") + fDragger(NULL) { app_info info; if (be_app->GetAppInfo(&info) == B_OK @@ -431,10 +427,10 @@ StatusView::~StatusView() void StatusView::_AboutRequested() { - BAlert *alert = new BAlert("about", fCatalog.GetString("CPUFrequency\n" + BAlert *alert = new BAlert("about", B_TRANSLATE("CPUFrequency\n" "\twritten by Clemens Zeidler\n" - "\tCopyright 2009, Haiku, Inc.\n", B_TRANSLATE_CONTEXT), - fCatalog.GetString("Ok", B_TRANSLATE_CONTEXT)); + "\tCopyright 2009, Haiku, Inc.\n"), + B_TRANSLATE("Ok")); BTextView *view = alert->TextView(); BFont font; @@ -514,15 +510,15 @@ StatusView::AttachedToWindow() fPreferencesMenu->SetFont(be_plain_font); fPreferencesMenu->AddSeparatorItem(); - fOpenPrefItem = new BMenuItem(fCatalog.GetString( - "Open Speedstep preferences" B_UTF8_ELLIPSIS, B_TRANSLATE_CONTEXT), + fOpenPrefItem = new BMenuItem(B_TRANSLATE( + "Open Speedstep preferences" B_UTF8_ELLIPSIS), new BMessage(kMsgOpenSSPreferences)); fPreferencesMenu->AddItem(fOpenPrefItem); fOpenPrefItem->SetTarget(this); if (fInDeskbar) { - fQuitItem= new BMenuItem(fCatalog.GetString("Quit", - B_TRANSLATE_CONTEXT), new BMessage(B_QUIT_REQUESTED)); + fQuitItem= new BMenuItem(B_TRANSLATE("Quit"), + new BMessage(B_QUIT_REQUESTED)); fPreferencesMenu->AddItem(fQuitItem); fQuitItem->SetTarget(this); } diff --git a/src/preferences/cpufrequency/StatusView.h b/src/preferences/cpufrequency/StatusView.h index 4f275b648e..cc677c182b 100644 --- a/src/preferences/cpufrequency/StatusView.h +++ b/src/preferences/cpufrequency/StatusView.h @@ -130,8 +130,6 @@ private: BString fFreqString; BDragger* fDragger; - - BCatalog fCatalog; }; #endif // STATUS_VIEW_H diff --git a/src/tools/locale/Catalog.cpp b/src/tools/locale/Catalog.cpp index 6000b00141..3c6ff02031 100644 --- a/src/tools/locale/Catalog.cpp +++ b/src/tools/locale/Catalog.cpp @@ -31,10 +31,11 @@ BCatalog::BCatalog() } -BCatalog::BCatalog(const char *signature, const char *language, +BCatalog::BCatalog(const entry_ref& catalogOwner, const char *language, uint32 fingerprint) { - //fCatalog = be_locale_roster->LoadCatalog(signature, language, fingerprint); + // Unsupported - the build tools can't (and don't need to) load anything + // this way. } diff --git a/src/tools/locale/DefaultCatalog.cpp b/src/tools/locale/DefaultCatalog.cpp index 4075bc9387..0bc1e219c2 100644 --- a/src/tools/locale/DefaultCatalog.cpp +++ b/src/tools/locale/DefaultCatalog.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -55,20 +56,45 @@ static int16 kCatArchiveVersion = 1; // version of the catalog archive structure, bump this if you change it! +const char* getCatalogSignature(const entry_ref &catalogOwner) +{ + // figure out mimetype from image + BFile objectFile(&catalogOwner, B_READ_ONLY); + BAppFileInfo objectInfo(&objectFile); + char objectSignature[B_MIME_TYPE_LENGTH]; + if (objectInfo.GetSignature(objectSignature) != B_OK) { + log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" + " localization.", catalogOwner.name); + return NULL; + } + + // drop supertype from mimetype (should be "application/"): + char* stripSignature = objectSignature; + while (*stripSignature != '/') + stripSignature ++; + stripSignature ++; + + log_team(LOG_DEBUG, "Image %s requested catalog with mimetype %s", + catalogOwner.name, stripSignature); + + return stripSignature; +} + + /*! Constructs a DefaultCatalog with given signature and language and reads the catalog from disk. InitCheck() will be B_OK if catalog could be loaded successfully, it will give an appropriate error-code otherwise. */ -DefaultCatalog::DefaultCatalog(const char *signature, const char *language, +DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, const char *language, uint32 fingerprint) : - BHashMapCatalog(signature, language, fingerprint) + BHashMapCatalog(getCatalogSignature(catalogOwner), language, fingerprint) { fInitCheck = B_NOT_SUPPORTED; fprintf(stderr, "trying to load default-catalog(sig=%s, lang=%s) results in %s", - signature, language, strerror(fInitCheck)); + getCatalogSignature(catalogOwner), language, strerror(fInitCheck)); } @@ -389,23 +415,11 @@ DefaultCatalog::Unflatten(BDataIO *dataIO) BCatalogAddOn * -DefaultCatalog::Instantiate(const char *signature, const char *language, +DefaultCatalog::Instantiate(const entry_ref &catalogOwner, const char *language, uint32 fingerprint) { DefaultCatalog *catalog - = new(std::nothrow) DefaultCatalog(signature, language, fingerprint); - if (catalog && catalog->InitCheck() != B_OK) { - delete catalog; - return NULL; - } - return catalog; -} - - -BCatalogAddOn * -DefaultCatalog::InstantiateEmbedded(entry_ref *appOrAddOnRef) -{ - DefaultCatalog *catalog = new(std::nothrow) DefaultCatalog(appOrAddOnRef); + = new(std::nothrow) DefaultCatalog(catalogOwner, language, fingerprint); if (catalog && catalog->InitCheck() != B_OK) { delete catalog; return NULL; From 924ead9a3e4bc9abb66c73a7d9817654267c58fc Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 09:16:38 +0000 Subject: [PATCH 559/702] * Coding style * Stub out the unneeded code in the buildtool version of DefaultCatalog. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43022 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/locale/DefaultCatalog.cpp | 59 +++++++++++++++-------------- src/tools/locale/DefaultCatalog.cpp | 41 ++++++-------------- 2 files changed, 42 insertions(+), 58 deletions(-) diff --git a/src/kits/locale/DefaultCatalog.cpp b/src/kits/locale/DefaultCatalog.cpp index 092edbec6a..8594bc03f5 100644 --- a/src/kits/locale/DefaultCatalog.cpp +++ b/src/kits/locale/DefaultCatalog.cpp @@ -56,35 +56,6 @@ const uint8 DefaultCatalog::kDefaultCatalogAddOnPriority = 1; // give highest priority to our embedded catalog-add-on -void DefaultCatalog::SetSignature(const entry_ref &catalogOwner) -{ - // figure out mimetype from image - BFile objectFile(&catalogOwner, B_READ_ONLY); - BAppFileInfo objectInfo(&objectFile); - char objectSignature[B_MIME_TYPE_LENGTH]; - if (objectInfo.GetSignature(objectSignature) != B_OK) { - log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" - " localization.", catalogOwner.name); - fSignature = ""; - return; - } - - // drop supertype from mimetype (should be "application/"): - char* stripSignature = objectSignature; - while (*stripSignature != '/' && *stripSignature != '\0') - stripSignature ++; - - if (*stripSignature == '\0') - stripSignature = objectSignature; - else - stripSignature ++; - - log_team(LOG_DEBUG, "Image %s requested catalog with mimetype %s", - catalogOwner.name, stripSignature); - fSignature = stripSignature; -} - - /*! Constructs a DefaultCatalog with given signature and language and reads the catalog from disk. InitCheck() will be B_OK if catalog could be loaded successfully, it will @@ -187,6 +158,36 @@ DefaultCatalog::~DefaultCatalog() } +void +DefaultCatalog::SetSignature(const entry_ref &catalogOwner) +{ + // figure out mimetype from image + BFile objectFile(&catalogOwner, B_READ_ONLY); + BAppFileInfo objectInfo(&objectFile); + char objectSignature[B_MIME_TYPE_LENGTH]; + if (objectInfo.GetSignature(objectSignature) != B_OK) { + log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" + " localization.", catalogOwner.name); + fSignature = ""; + return; + } + + // drop supertype from mimetype (should be "application/"): + char* stripSignature = objectSignature; + while (*stripSignature != '/' && *stripSignature != '\0') + stripSignature ++; + + if (*stripSignature == '\0') + stripSignature = objectSignature; + else + stripSignature ++; + + log_team(LOG_DEBUG, "Image %s requested catalog with mimetype %s", + catalogOwner.name, stripSignature); + fSignature = stripSignature; +} + + status_t DefaultCatalog::SetRawString(const CatKey& key, const char *translated) { diff --git a/src/tools/locale/DefaultCatalog.cpp b/src/tools/locale/DefaultCatalog.cpp index 0bc1e219c2..86acdc6c84 100644 --- a/src/tools/locale/DefaultCatalog.cpp +++ b/src/tools/locale/DefaultCatalog.cpp @@ -56,45 +56,20 @@ static int16 kCatArchiveVersion = 1; // version of the catalog archive structure, bump this if you change it! -const char* getCatalogSignature(const entry_ref &catalogOwner) -{ - // figure out mimetype from image - BFile objectFile(&catalogOwner, B_READ_ONLY); - BAppFileInfo objectInfo(&objectFile); - char objectSignature[B_MIME_TYPE_LENGTH]; - if (objectInfo.GetSignature(objectSignature) != B_OK) { - log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" - " localization.", catalogOwner.name); - return NULL; - } - - // drop supertype from mimetype (should be "application/"): - char* stripSignature = objectSignature; - while (*stripSignature != '/') - stripSignature ++; - stripSignature ++; - - log_team(LOG_DEBUG, "Image %s requested catalog with mimetype %s", - catalogOwner.name, stripSignature); - - return stripSignature; -} - - /*! Constructs a DefaultCatalog with given signature and language and reads the catalog from disk. InitCheck() will be B_OK if catalog could be loaded successfully, it will give an appropriate error-code otherwise. */ -DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, const char *language, - uint32 fingerprint) +DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, + const char *language, uint32 fingerprint) : - BHashMapCatalog(getCatalogSignature(catalogOwner), language, fingerprint) + BHashMapCatalog("", language, fingerprint) { fInitCheck = B_NOT_SUPPORTED; fprintf(stderr, "trying to load default-catalog(sig=%s, lang=%s) results in %s", - getCatalogSignature(catalogOwner), language, strerror(fInitCheck)); + "", language, strerror(fInitCheck)); } @@ -133,6 +108,14 @@ DefaultCatalog::~DefaultCatalog() } +void +DefaultCatalog::SetSignature(const entry_ref &catalogOwner) +{ + // Not allowed for the build-tool version. + return; +} + + status_t DefaultCatalog::SetRawString(const CatKey& key, const char *translated) { From 837b16251d4b2b6249ebcaa19bb319cbe82c6126 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 09:56:00 +0000 Subject: [PATCH 560/702] Fix #7948: add correct prototype for String::compare alongside the wrong one for BeOS compatibility. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43023 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/cpp/std/bastring.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/headers/cpp/std/bastring.h b/headers/cpp/std/bastring.h index 1fdff54d0e..b07761e961 100644 --- a/headers/cpp/std/bastring.h +++ b/headers/cpp/std/bastring.h @@ -407,7 +407,13 @@ public: int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const; // There is no 'strncmp' equivalent for charT pointers. + + // BeOS bogus version int compare (const charT* s, size_type pos, size_type n) const; + + // Correct std C++ prototype + int compare (size_type pos, size_type n, const charT* s) const + { return compare(s, pos, n); } int compare (const charT* s, size_type pos = 0) const { return compare (s, pos, traits::length (s)); } From 988cfaca329cb9dce69bc76f4e5ef262fa3ffb82 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 10:04:32 +0000 Subject: [PATCH 561/702] Don't delete the be_app, it is destoried by the Quit() call. Fixes the crash when closing the app_server test environment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43024 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/drawing/ViewHWInterface.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/servers/app/drawing/ViewHWInterface.cpp b/src/servers/app/drawing/ViewHWInterface.cpp index fc3140f259..7d2d76e52c 100644 --- a/src/servers/app/drawing/ViewHWInterface.cpp +++ b/src/servers/app/drawing/ViewHWInterface.cpp @@ -420,7 +420,6 @@ ViewHWInterface::~ViewHWInterface() be_app->Lock(); be_app->Quit(); - delete be_app; } From a735bdebb94ce14c72f56204f022038de7a49e2f Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 10:18:03 +0000 Subject: [PATCH 562/702] Align all filesystem relevant places to use B_UNSUPPORTED for unsupported instead of a mix of B_NOT_SUPPORTED and B_UNSUPPORTED. This allows checking for a specific error code. Probably one of those should be phased out... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43025 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../file_systems/bfs/kernel_interface.cpp | 2 +- .../kernel/file_systems/ext2/Journal.cpp | 2 +- .../kernel/file_systems/ext2/Volume.cpp | 6 +- .../file_systems/ext2/kernel_interface.cpp | 2 +- .../kernel/file_systems/iso9660/iso9660.cpp | 6 +- .../file_systems/userlandfs/server/Volume.cpp | 2 +- src/system/kernel/device_manager/devfs.cpp | 6 +- src/system/kernel/fs/fd.cpp | 6 +- src/system/kernel/fs/vfs.cpp | 60 +++++++++---------- 9 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index 8d265fb390..fd7bb0cf4e 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -1030,7 +1030,7 @@ bfs_link(fs_volume* _volume, fs_vnode* dir, const char* name, fs_vnode* node) FUNCTION_START(("name = \"%s\"\n", name)); // This one won't be implemented in a binary compatible BFS - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } diff --git a/src/add-ons/kernel/file_systems/ext2/Journal.cpp b/src/add-ons/kernel/file_systems/ext2/Journal.cpp index c95a713a76..d7f2d4c345 100644 --- a/src/add-ons/kernel/file_systems/ext2/Journal.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Journal.cpp @@ -773,7 +773,7 @@ Journal::_CheckFeatures(JournalSuperBlock* superblock) & ~JOURNAL_KNOWN_READ_ONLY_COMPATIBLE_FEATURES) != 0 || (superblock->IncompatibleFeatures() & ~JOURNAL_KNOWN_INCOMPATIBLE_FEATURES) != 0) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; return B_OK; } diff --git a/src/add-ons/kernel/file_systems/ext2/Volume.cpp b/src/add-ons/kernel/file_systems/ext2/Volume.cpp index adb47497e2..3ff776ae40 100644 --- a/src/add-ons/kernel/file_systems/ext2/Volume.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Volume.cpp @@ -309,7 +309,7 @@ Volume::Mount(const char* deviceName, uint32 flags) // check read-only features if mounting read-write if (!IsReadOnly() && _UnsupportedReadOnlyFeatures(fSuperBlock) != 0) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; // initialize short hands to the super block (to save byte swapping) fBlockShift = fSuperBlock.BlockShift(); @@ -378,7 +378,7 @@ Volume::Mount(const char* deviceName, uint32 flags) } else { // TODO: external journal TRACE("Can not open an external journal.\n"); - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } } else { TRACE("Opening a fake journal (NoJournal).\n"); @@ -935,7 +935,7 @@ Volume::Identify(int fd, ext2_super_block* superBlock) } return _UnsupportedIncompatibleFeatures(*superBlock) == 0 - ? B_OK : B_NOT_SUPPORTED; + ? B_OK : B_UNSUPPORTED; } diff --git a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp index 373d83edcc..9842fd23cb 100644 --- a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp @@ -864,7 +864,7 @@ ext2_link(fs_volume* volume, fs_vnode* dir, const char* name, fs_vnode* node) { // TODO - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } diff --git a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp index 80c7b10ef9..a9caafd416 100644 --- a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp @@ -526,7 +526,7 @@ parse_rock_ridge(iso9660_volume* volume, iso9660_inode* node, char* buffer, // Relocated directory, we should skip. TRACE(("RR: found RE, length %u\n", length)); if (!relocated) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; break; case 'TF': @@ -540,7 +540,7 @@ parse_rock_ridge(iso9660_volume* volume, iso9660_inode* node, char* buffer, case 'SF': TRACE(("RR: found SF, sparse files not supported!\n")); // TODO: support sparse files - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; default: if (buffer[0] == '\0') { @@ -750,7 +750,7 @@ ISOReadDirEnt(iso9660_volume *volume, dircookie *cookie, struct dirent *dirent, &bytesRead); // if we hit an entry that we don't support, we just skip it - if (result != B_OK && result != B_NOT_SUPPORTED) + if (result != B_OK && result != B_UNSUPPORTED) break; if (result == B_OK && (node.flags & ISO_IS_ASSOCIATED_FILE) == 0) { diff --git a/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp b/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp index 5c8f00c07f..a8e74d20c6 100644 --- a/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp +++ b/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp @@ -97,7 +97,7 @@ Volume::Lookup(void* dir, const char* entryName, ino_t* vnid) status_t Volume::GetVNodeType(void* node, int* type) { - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } diff --git a/src/system/kernel/device_manager/devfs.cpp b/src/system/kernel/device_manager/devfs.cpp index af4753ace7..67b76ed6e0 100644 --- a/src/system/kernel/device_manager/devfs.cpp +++ b/src/system/kernel/device_manager/devfs.cpp @@ -1559,13 +1559,13 @@ devfs_ioctl(fs_volume* _volume, fs_vnode* _vnode, void* _cookie, uint32 op, case B_GET_NEXT_OPEN_DEVICE: dprintf("devfs: unsupported legacy ioctl B_GET_NEXT_OPEN_DEVICE\n"); - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; case B_ADD_FIXED_DRIVER: dprintf("devfs: unsupported legacy ioctl B_ADD_FIXED_DRIVER\n"); - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; case B_REMOVE_FIXED_DRIVER: dprintf("devfs: unsupported legacy ioctl B_REMOVE_FIXED_DRIVER\n"); - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } diff --git a/src/system/kernel/fs/fd.cpp b/src/system/kernel/fs/fd.cpp index d1e89b61d7..04dd45e2cd 100644 --- a/src/system/kernel/fs/fd.cpp +++ b/src/system/kernel/fs/fd.cpp @@ -985,7 +985,7 @@ _user_rewind_dir(int fd) if (descriptor->ops->fd_rewind_dir) status = descriptor->ops->fd_rewind_dir(descriptor); else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; put_fd(descriptor); return status; @@ -1258,7 +1258,7 @@ _kern_read_dir(int fd, struct dirent* buffer, size_t bufferSize, if (retval >= 0) retval = count; } else - retval = B_NOT_SUPPORTED; + retval = B_UNSUPPORTED; put_fd(descriptor); return retval; @@ -1280,7 +1280,7 @@ _kern_rewind_dir(int fd) if (descriptor->ops->fd_rewind_dir) status = descriptor->ops->fd_rewind_dir(descriptor); else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; put_fd(descriptor); return status; diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index 80da3bd3f2..77968e7829 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -1689,7 +1689,7 @@ normalize_flock(struct file_descriptor* descriptor, struct flock* flock) status_t status; if (!HAS_FS_CALL(vnode, read_stat)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; status = FS_CALL(vnode, read_stat, &stat); if (status != B_OK) @@ -2444,7 +2444,7 @@ get_vnode_name(struct vnode* vnode, struct vnode* parent, struct dirent* buffer, // parent directory for the vnode, if the caller let us. if (parent == NULL) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; void* cookie; @@ -4170,7 +4170,7 @@ vfs_read_stat(int fd, const char* path, bool traverseLeafLink, if (descriptor->ops->fd_read_stat) status = descriptor->ops->fd_read_stat(descriptor, stat); else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; put_fd(descriptor); } @@ -5231,7 +5231,7 @@ static int open_attr_dir_vnode(struct vnode* vnode, bool kernel) { if (!HAS_FS_CALL(vnode, open_attr_dir)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; void* cookie; status_t status = FS_CALL(vnode, open_attr_dir, &cookie); @@ -5462,7 +5462,7 @@ file_seek(struct file_descriptor* descriptor, off_t pos, int seekType) { // stat() the node if (!HAS_FS_CALL(vnode, read_stat)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; struct stat stat; status_t status = FS_CALL(vnode, read_stat, &stat); @@ -5716,7 +5716,7 @@ dir_read(struct io_context* ioContext, struct vnode* vnode, void* cookie, struct dirent* buffer, size_t bufferSize, uint32* _count) { if (!HAS_FS_CALL(vnode, read_dir)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; status_t error = FS_CALL(vnode, read_dir, cookie, buffer, bufferSize, _count); @@ -5746,7 +5746,7 @@ dir_rewind(struct file_descriptor* descriptor) return FS_CALL(vnode, rewind_dir, descriptor->cookie); } - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } @@ -5876,7 +5876,7 @@ common_fcntl(int fd, int op, uint32 argument, bool kernel) status = FS_CALL(vnode, set_flags, descriptor->cookie, (int)argument); } else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; if (status == B_OK) { // update this descriptor's open_mode field @@ -5969,7 +5969,7 @@ common_sync(int fd, bool kernel) if (HAS_FS_CALL(vnode, fsync)) status = FS_CALL_NO_PARAMS(vnode, fsync); else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; put_fd(descriptor); return status; @@ -6063,7 +6063,7 @@ common_create_symlink(int fd, char* path, const char* toPath, int mode, status = FS_CALL(vnode, create_symlink, name, toPath, mode); else { status = HAS_FS_CALL(vnode, write) - ? B_NOT_SUPPORTED : B_READ_ONLY_DEVICE; + ? B_UNSUPPORTED : B_READ_ONLY_DEVICE; } put_vnode(vnode); @@ -6359,7 +6359,7 @@ attr_dir_read(struct io_context* ioContext, struct file_descriptor* descriptor, return FS_CALL(vnode, read_attr_dir, descriptor->cookie, buffer, bufferSize, _count); - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } @@ -6373,7 +6373,7 @@ attr_dir_rewind(struct file_descriptor* descriptor) if (HAS_FS_CALL(vnode, rewind_attr_dir)) return FS_CALL(vnode, rewind_attr_dir, descriptor->cookie); - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } @@ -6443,7 +6443,7 @@ attr_open(int fd, char* path, const char* name, int openMode, bool kernel) } if (!HAS_FS_CALL(vnode, open_attr)) { - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; goto err; } @@ -6505,7 +6505,7 @@ attr_read(struct file_descriptor* descriptor, off_t pos, void* buffer, *length)); if (!HAS_FS_CALL(vnode, read_attr)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; return FS_CALL(vnode, read_attr, descriptor->cookie, pos, buffer, length); } @@ -6519,7 +6519,7 @@ attr_write(struct file_descriptor* descriptor, off_t pos, const void* buffer, FUNCTION(("attr_write: buf %p, pos %Ld, len %p\n", buffer, pos, length)); if (!HAS_FS_CALL(vnode, write_attr)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; return FS_CALL(vnode, write_attr, descriptor->cookie, pos, buffer, length); } @@ -6541,7 +6541,7 @@ attr_seek(struct file_descriptor* descriptor, off_t pos, int seekType) { struct vnode* vnode = descriptor->u.vnode; if (!HAS_FS_CALL(vnode, read_stat)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; struct stat stat; status_t status = FS_CALL(vnode, read_attr_stat, descriptor->cookie, @@ -6576,7 +6576,7 @@ attr_read_stat(struct file_descriptor* descriptor, struct stat* stat) FUNCTION(("attr_read_stat: stat 0x%p\n", stat)); if (!HAS_FS_CALL(vnode, read_attr_stat)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; return FS_CALL(vnode, read_attr_stat, descriptor->cookie, stat); } @@ -6685,7 +6685,7 @@ index_dir_open(dev_t mountID, bool kernel) return status; if (!HAS_FS_MOUNT_CALL(mount, open_index_dir)) { - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; goto error; } @@ -6748,7 +6748,7 @@ index_dir_read(struct io_context* ioContext, struct file_descriptor* descriptor, bufferSize, _count); } - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } @@ -6760,7 +6760,7 @@ index_dir_rewind(struct file_descriptor* descriptor) if (HAS_FS_MOUNT_CALL(mount, rewind_index_dir)) return FS_MOUNT_CALL(mount, rewind_index_dir, descriptor->cookie); - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } @@ -6798,9 +6798,9 @@ index_read_stat(struct file_descriptor* descriptor, struct stat* stat) // ToDo: currently unused! FUNCTION(("index_read_stat: stat 0x%p\n", stat)); if (!HAS_FS_CALL(vnode, read_index_stat)) - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; //return FS_CALL(vnode, read_index_stat, descriptor->cookie, stat); } @@ -6831,7 +6831,7 @@ index_name_read_stat(dev_t mountID, const char* name, struct stat* stat, return status; if (!HAS_FS_MOUNT_CALL(mount, read_index_stat)) { - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; goto out; } @@ -6887,7 +6887,7 @@ query_open(dev_t device, const char* query, uint32 flags, port_id port, return status; if (!HAS_FS_MOUNT_CALL(mount, open_query)) { - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; goto error; } @@ -6951,7 +6951,7 @@ query_read(struct io_context* ioContext, struct file_descriptor* descriptor, bufferSize, _count); } - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } @@ -6963,7 +6963,7 @@ query_rewind(struct file_descriptor* descriptor) if (HAS_FS_MOUNT_CALL(mount, rewind_query)) return FS_MOUNT_CALL(mount, rewind_query, descriptor->cookie); - return B_NOT_SUPPORTED; + return B_UNSUPPORTED; } @@ -8230,7 +8230,7 @@ _kern_write_stat(int fd, const char* path, bool traverseLeafLink, if (descriptor->ops->fd_write_stat) status = descriptor->ops->fd_write_stat(descriptor, stat, statMask); else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; put_fd(descriptor); } @@ -9143,7 +9143,7 @@ _user_read_stat(int fd, const char* userPath, bool traverseLink, if (descriptor->ops->fd_read_stat) status = descriptor->ops->fd_read_stat(descriptor, &stat); else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; put_fd(descriptor); } @@ -9204,7 +9204,7 @@ _user_write_stat(int fd, const char* userPath, bool traverseLeafLink, status = descriptor->ops->fd_write_stat(descriptor, &stat, statMask); } else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; put_fd(descriptor); } @@ -9284,7 +9284,7 @@ _user_stat_attr(int fd, const char* attribute, struct attr_info* userAttrInfo) if (descriptor->ops->fd_read_stat) status = descriptor->ops->fd_read_stat(descriptor, &stat); else - status = B_NOT_SUPPORTED; + status = B_UNSUPPORTED; put_fd(descriptor); _user_close(attr); From 87d4f28e6f52966e2d271986f7025b11e2bfaf0d Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 10:20:50 +0000 Subject: [PATCH 563/702] Watch out for missing attribute support when copying attributes and then don't error out. Fixes an error message for each copied file when copying from a filesystem that doesn't support attributes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43026 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/coreutils/src/copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/coreutils/src/copy.c b/src/bin/coreutils/src/copy.c index e20566a460..8a964788c3 100644 --- a/src/bin/coreutils/src/copy.c +++ b/src/bin/coreutils/src/copy.c @@ -182,7 +182,7 @@ copy_attributes(int fromFd, int toFd) DIR *attributes = fs_fopen_attr_dir(fromFd); if (attributes == NULL) - return -1; + return errno == B_UNSUPPORTED ? 0 : -1; while ((dirent = fs_read_attr_dir(attributes)) != NULL) { struct stat stat; From 9a4b557caa2d6804cef9e505e0362bfb2b3b7c73 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 10:22:48 +0000 Subject: [PATCH 564/702] Fix typo, no functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43027 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp b/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp index 650d4947d9..3935e244fd 100644 --- a/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp +++ b/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp @@ -41,7 +41,8 @@ HIDCollection::HIDCollection(HIDCollection *parent, uint8 type, // this is just a logical grouping collection usageValue.u.extended = 0; } else { - TRACE_ALWAYS("non of the possible usages for the collection are set\n"); + TRACE_ALWAYS("none of the possible usages for the collection are " + "set\n"); } fUsage = usageValue.u.extended; From 83b35411ed9217e9ede833ead35740a6f9e21b66 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Mon, 31 Oct 2011 10:34:06 +0000 Subject: [PATCH 565/702] Updated the ReadMe documentation and combined non-Haiku platform notes with within-Haiku notes. Feedback and changes welcome. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43028 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- ReadMe | 271 ++++++++++++++++++++++++++++++------------- ReadMe.cross-compile | 85 -------------- 2 files changed, 189 insertions(+), 167 deletions(-) delete mode 100644 ReadMe.cross-compile diff --git a/ReadMe b/ReadMe index cb34eee8f4..aaf5f28c31 100644 --- a/ReadMe +++ b/ReadMe @@ -1,28 +1,114 @@ -Building on Haiku -================= +Building Haiku from source +========================== -For building on Haiku, all of the necessary development tools are included in -both official releases (R1 alpha 1 for instance) and the nightly builds. +This is a overview into the process of building HAIKU from source. +An online version is available at http://www.haiku-os.org/guides/building/ -Official releases can be obtained from www.haiku-os.org/get-haiku -The nightly builds are available at http://www.haiku-files.org +Official releases of Haiku are at http://www.haiku-os.org/get-haiku +The (unstable) nightly builds are available at http://www.haiku-files.org -Building on a non-Haiku platform -================================ +To build Haiku, you will need to + * ensure pre-requisite software is installed + * download sources + * configure your build + * run jam to initiate the build process -Please read the file 'ReadMe.cross-compile' before continuing. It describes -how to build the cross-compilation tools and configure the build system for -building Haiku. After following the instructions you can directly continue -with the section Building. +We currently support these platforms: + * Haiku + * Linux + * FreeBSD + * Mac OS X Intel + +Pre-requisite software +====================== + +Tools provided within Haiku's repositories + + * Jam (Jam 2.5-haiku-20090626) + * Haiku's cross-compiler (needed only for non-Haiku platforms) + +The tools to compile Haiku will vary, depending on the platform that you are +using to build Haiku. When building from Haiku, all of the necessary +development tools are included in official releases (e.g. R1 alpha 1) and in the +(unstable) nightly builds. + + * Subversion client + * SSH client (for developers with commit access) + * gcc and the binutils (as, ld, etc., required by gcc) + * make (GNU make) + * bison + * flex and lex (usually a mini shell script invoking flex) + * makeinfo (part of texinfo, needed for building gcc 4 only) + * autoheader (part of autoconf, needed for building gcc) + * automake + * gawk + * yasm (http://www.tortall.net/projects/yasm/wiki/Download) + * wget + * (un)zip + * cdrtools (not genisoimage!) + * case-sensitive file system + +Whether they are installed can be tested for instance by running them in the +shell with the "--version" parameter. + +Specific: Haiku for the ARM platform +------------------------------------ + +The following tools are needed to compile Haiku for the ARM platform + + * mkimage (http://www.denx.de/wiki/UBoot) + * Mtools (http://www.gnu.org/software/mtools/intro.html) + * sfdisk + +Specific: Mac OS X +------------------ + +Disk Utility can create a case-sensitive disk image of at least 3 GiB in size. +The following darwin ports need to be installed: + * expat + * gawk + * gettext + * libiconv + * gnuregex + +More information about individual distributions of Linux and BSD can be found +at http://haiku-os.org/guides/building/pre-reqs -Configuring on Haiku -==================== +Download Haiku's sources +======================== -Open a Terminal and change to your Haiku trunk folder. To configure the build -you can run configure like this: +There are two parts to Haiku's sources -- the code for Haiku itself and a set +of build tools for compiling Haiku on an operating system other than Haiku. +The buildtools are needed only for non-Haiku platform. - ./configure +Anonymous checkout: + svn co http://svn.haiku-os.org/haiku/haiku/trunk haiku + svn co http://svn.haiku-os.org/haiku/buildtools/trunk buildtools + +Developer with commit access: + svn co svn+ssh://@svn.haiku-os.org/srv/svn/repos/haiku/haiku/trunk haiku + svn co svn+ssh://@svn.haiku-os.org/srv/svn/repos/haiku/buildtools/trunk buildtools + + +Building the Jam executable +=========================== + +This step applies only to non-Haiku platforms. + +Change to the buildtools folder and we will start to build 'jam' which is a +requirement for building Haiku. Run the following commands to generate and +install the tool: + + cd buildtools/jam + make + sudo ./jam0 install + -- or -- + ./jam0 -sBINDIR=$HOME/bin install + + +Configuring your build +====================== The configure script generates a file named "BuildConfig" in the "generated/build" directory. As long as configure is not modified (!), there @@ -30,23 +116,84 @@ is no need to call it again. That is for re-building you only need to invoke jam (see below). If you don't update the source tree very frequently, you may want to execute 'configure' after each update just to be on the safe side. +Depending on your goal, there are several different ways to configure Haiku. +You can either call configure from within your Haiku trunk folder. That will +prepare a folder named 'generated', which will contain the compiled objects. +Another option is to manually created one or more 'generated.*' folders and run +configure from within them. For example imagine the following directory setup -Building -======== + buildtools-trunk/ + haiku-trunk/ + haiku-trunk/generated.x86gcc2 + haiku-trunk/generated.x86gcc4 + +Configure a GCC 2.95 Hybrid, from non-Haiku platform +---------------------------------------------------- + + cd haiku-trunk/generated.x86gcc4 + ../configure --use-gcc-pipe --use-xattr \ + --build-cross-tools-gcc4 x86 ../../buildtools/ \ + --alternative-gcc-output-dir ../generated.x86gcc2 + cd ../generated.x86gcc2 + ../configure --use-gcc-pipe --use-xattr \ + --build-cross-tools ../../buildtools/ \ + --alternative-gcc-output-dir ../generated.x86gcc4 + +Configure a GCC 2.95 Hybrid, from within Haiku +---------------------------------------------- + + cd haiku-trunk/generated.x86gcc4 + ../configure --use-gcc-pipe \ + --alternative-gcc-output-dir ../generated.x86gcc2 \ + --cross-tools-prefix /boot/develop/abi/x86/gcc4/tools/current/bin/ + cd ../generated.x86gcc2 + ../configure --use-gcc-pipe \ + --alternative-gcc-output-dir ../generated.x86gcc4 \ + --cross-tools-prefix /boot/develop/abi/x86/gcc2/tools/current/bin/ + +Additional information about GCC Hybrids can be found on the website, +http://www.haiku-os.org/guides/building/gcc-hybrid + +Configure options +----------------- + +The various runtime options for configure are documented in it's onscreen help + + ./configure --help + + +Building via Jam +================ Haiku can be built in either of two ways, as disk image file (e.g. for use -with emulators) or as installation in a directory. +with emulators, to be written directly to a usb stick, burned as a compact +disc) or as installation in a directory. -Image File ----------- +Running Jam +----------- - jam -q haiku-image +There are various ways in which you can run jam. -This generates an image file named 'haiku.image' in your output directory -under 'generated/'. + * If you have a single generated folder, + you can run 'jam' from the top level of Haiku's trunk. + * If you have one or more generated folders, + (e.g. generated.x86gcc2), you can cd into that directory and run 'jam' + * In either case, you can cd into a certain folder in the source tree (e.g. + src/apps/debugger) and run jam -sHAIKU_OUTPUT_DIR= -VMware Image File ------------------ +Be sure to read build/jam/UserBuildConfig.ReadMe and UserBuildConfig.sample, +as they contain information on customizing your build of Haiku. + +Building a Haiku anyboot file +--------------------------- + + jam -q haiku-anyboot-image + +This generates an image file named 'haiku-anyboot.image' in your output +directory under 'generated/'. + +Building a VMware image file +---------------------------- jam -q haiku-vmware-image @@ -62,55 +209,40 @@ Installs all Haiku components into the volume mounted at "/Haiku" and automatically marks it as bootable. To create a partition in the first place use DriveSetup and initialize it to BFS. -Note that installing Haiku in a directory only works as expected under BeOS, -but it is not yet supported under Linux and other non-BeOS platforms. +Note that installing Haiku in a directory only works as expected under Haiku, +but it is not yet supported under Linux and other non-Haiku platforms. -Bootable CD-ROM Image ---------------------- - -This _requires_ having the mkisofs tool installed. -On Debian GNU/Linux for example you can install it with: - apt-get install mkisofs - -This creates a bootable 'haiku-cd.iso' in your 'generated/' folder: - - jam -q haiku-cd - -Under Unix/Linux, and Haiku you can use cdrecord to create a CD with: - - cdrecord dev=x,y,z -v -eject -dao -data generated/haiku-cd.iso - -Here x,y,z is the device number as found with cdrecord -scanbus, it can also -be a device path on Linux. - -Building Components -------------------- +Building individual components +------------------------------ If you don't want to build the complete Haiku, but only a certain app/driver/etc. you can specify it as argument to jam, e.g.: - jam Pulse + jam Debugger Alternatively, you can 'cd' to the directory of the component you want to -build and run 'jam' from there. +build and run 'jam' from there. Note: if your generated directory named +something other than "generated/", you will need to tell jam where it is. + + jam -sHAIKU_OUTPUT_DIR= You can also force rebuilding of a component by using the "-a" parameter: - jam -a Pulse + jam -a Debugger Running ======= Generally there are two ways of running Haiku. On real hardware using a -partition and on emulated hardware using an emulator like Bochs or QEmu. +partition and on emulated hardware using an emulator like Bochs or QEMU. On Real Hardware ---------------- If you have installed Haiku to its own partition you can include this partition in your bootmanager and try to boot Haiku like any other OS you -have installed. To include a new partition in the BeOS bootmanager run this +have installed. To include a new partition in the Haiku bootmanager run this in a Terminal: bootman @@ -119,34 +251,9 @@ On Emulated Hardware -------------------- For emulated hardware you should build disk image (see above). How to setup -this image depends on your emulater. A tutorial for Bochs on BeOS is below. -If you use QEmu, you can usually just provide the path to the image as -command line argument to the "qemu" executable. - -Bochs ------ - -Version 2.2 of Bochs for BeOS (BeBochs) can be downloaded from BeBits: - - http://www.bebits.com/app/3324 - -The package installs to: /boot/apps/BeBochs2.2 - -You have to set up a configuration for Bochs. You should edit the ".bochsrc" to -include the following: - -ata0-master: type=disk, path="/path/to/haiku.image", cylinders=122, heads=16, spt=63 -boot: disk - -Now you can start Bochs: - - $ cd /boot/apps/BeBochs2.2 - $ ./bochs - -Answer with RETURN and with some patience you will see Haiku booting. -If booting into the graphical evironment fails you can try to hit "space" at the -very beginning of the boot process. The Haiku bootloader should then come up and -you can select some safe mode options. +this image depends on your emulater. If you use QEMU, you can usually just +provide the path to the image as command line argument to the "qemu" +executable. Docbook documentation diff --git a/ReadMe.cross-compile b/ReadMe.cross-compile deleted file mode 100644 index 5b4291ff2e..0000000000 --- a/ReadMe.cross-compile +++ /dev/null @@ -1,85 +0,0 @@ -Building on a non-Haiku platform -================================ - -We currently support these non-Haiku platforms: - * Linux - * FreeBSD - * Mac OS X Intel (gcc 4 builds only) - -To build Haiku on a platform other than Haiku, you must first check out and -build the cross-compiler. The easiest method for doing so is to check it out in -the parent directory of your Haiku repository: - - svn checkout http://svn.haiku-os.org/haiku/buildtools/trunk buildtools - -You should now have a 'buildtools' folder that contains folders named -'binutils', 'gcc', and 'jam' among others. - -Several other tools are required to build these build tools or are used by -Haiku's build system itself: - * gcc and the binutils (as, ld, etc., required by gcc) - * make (GNU make) - * bison - * flex and lex (usually a mini shell script invoking flex) - * makeinfo (part of texinfo, needed for building gcc 4 only) - * autoheader (part of autoconf, needed for building gcc) - * gawk - * yasm (http://www.tortall.net/projects/yasm/wiki/Download) - -Whether they are installed can be tested for instance by running them in the -shell with the "--version" parameter. - -On Mac OS X a case-sensitive file system is required for the Haiku tree -(Disk Utility can be used to create a case-sensitive disk image of at least -3GB size), and the following darwin ports need to be installed: - * expat - * gawk - * gettext - * libiconv - * gnuregex - * cdrtools (for mkisofs used to create the bootable CD-ROM image) - -Building Jam -============ - -Change to the buildtools folder and we will start to build 'jam' which is a -requirement for building Haiku. Run the following commands to generate and -install the tool: - - cd buildtools/jam - make - sudo ./jam0 install - -- or -- - ./jam0 -sBINDIR=$HOME/bin install - -Building binutils -================= - -The binutils used by Haiku will be automatically generated according to the -initial configuration of the Haiku source and placed in the -'generated/cross-tools' directory of Haiku. Before generating the tools you -must consider the version required, there are essentially two choices: - - * 2.95: Creates BeOS compatible binaries - * 4.x: Incompatible with BeOS, but theoretically more efficient binaries - -Unless there is a pressing need, choose 2.95 as the latter option can cause -frequent build issues. The commands for configuration are, - -GCC 2.95 --------- - - cd haiku - ./configure --build-cross-tools ../buildtools/ - -GCC 4.x -------- - - cd haiku - ./configure --build-cross-tools-gcc4 x86 ../buildtools/ - -The process can take quite some time, but when it finishes the build system is -fully configured and you are ready to compile your first Haiku image. - -Instructions on how to build Haiku can be found in the section Building in the -'ReadMe' document. From cddcc2bea95011c47b7a9ee25b630e2f639a1191 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 31 Oct 2011 11:00:01 +0000 Subject: [PATCH 566/702] Fix MutableLocaleRoster::GetSystemCatalog() * Using a hardcoded path is bad, since the library folder might change and/or the /system/lib/libbe.so may not be the libbe.so actually in use. Instead, we now lookup the loaded libbe-image and get the entry_ref from its image_info. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43029 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/locale/MutableLocaleRoster.cpp | 27 +++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/kits/locale/MutableLocaleRoster.cpp b/src/kits/locale/MutableLocaleRoster.cpp index 738b2d18f2..9c282542e8 100644 --- a/src/kits/locale/MutableLocaleRoster.cpp +++ b/src/kits/locale/MutableLocaleRoster.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -788,10 +789,32 @@ MutableLocaleRoster::GetSystemCatalog(BCatalogAddOn** catalog) const { if (!catalog) return B_BAD_VALUE; - // get libbe entry_ref + + // figure out libbe-image (shared object) by name + image_info info; + int32 cookie = 0; + bool found = false; + + while (get_next_image_info(0, &cookie, &info) == B_OK) { + if (info.data < (void*)&be_app + && (char*)info.data + info.data_size > (void*)&be_app) { + found = true; + break; + } + } + + if (!found) { + log_team(LOG_DEBUG, "Unable to find libbe-image!"); + + return B_ERROR; + } + + // load the catalog for libbe and return it to the app entry_ref ref; - BEntry("/boot/system/lib/libbe.so").GetRef(&ref); + BEntry(info.name).GetRef(&ref); + *catalog = LoadCatalog(ref); + return B_OK; } From 89a1a98bca8797f72c9c4b73c9d6d1496b404c83 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 31 Oct 2011 13:13:30 +0000 Subject: [PATCH 567/702] Delete the application object from the correct thread. The previous version attempted to Quit() and then immediately delete the app object from another thread. This triggered a debug assert since in the latter case we push a quit message onto the looper's message queue and let that handle terminating the message loop. As a consequence, it was possible for said looper thread to not have finished shutting down properly before we called delete, leading to a debug assert with respect to calling delete on a still running looper. Should correctly fix the crash on terminating the test app_server. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43030 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/drawing/ViewHWInterface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/servers/app/drawing/ViewHWInterface.cpp b/src/servers/app/drawing/ViewHWInterface.cpp index 7d2d76e52c..fe4ca9879c 100644 --- a/src/servers/app/drawing/ViewHWInterface.cpp +++ b/src/servers/app/drawing/ViewHWInterface.cpp @@ -104,6 +104,7 @@ run_app_thread(void* cookie) if (BApplication* app = (BApplication*)cookie) { app->Lock(); app->Run(); + delete app; } return 0; } From c2f3ee3b7b386d538f1181e7dc5e277307229c78 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 13:25:26 +0000 Subject: [PATCH 568/702] * Move the GMT/Local radio box to the timezone tab * As there is some extra space there, use it to display a hint on what the settings are useful for * Remove the huge and unclear tooltip that explained it before (that'd rather be part of the userguide) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43031 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/AnalogClock.cpp | 2 +- src/preferences/time/DateTimeView.cpp | 104 +------------------------- src/preferences/time/DateTimeView.h | 8 -- src/preferences/time/TZDisplay.cpp | 3 +- src/preferences/time/TZDisplay.h | 1 + src/preferences/time/TimeWindow.cpp | 9 ++- src/preferences/time/ZoneView.cpp | 104 +++++++++++++++++++++++++- src/preferences/time/ZoneView.h | 10 +++ 8 files changed, 125 insertions(+), 116 deletions(-) diff --git a/src/preferences/time/AnalogClock.cpp b/src/preferences/time/AnalogClock.cpp index 41620ea2eb..4f1c0d0178 100644 --- a/src/preferences/time/AnalogClock.cpp +++ b/src/preferences/time/AnalogClock.cpp @@ -183,7 +183,7 @@ TAnalogClock::MaxSize() BSize TAnalogClock::MinSize() { - return BSize(0, 0); + return BSize(64.f, 64.f); } diff --git a/src/preferences/time/DateTimeView.cpp b/src/preferences/time/DateTimeView.cpp index 8d1cc48c95..9d5d3d6cfc 100644 --- a/src/preferences/time/DateTimeView.cpp +++ b/src/preferences/time/DateTimeView.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -48,12 +47,9 @@ using BPrivate::B_LOCAL_TIME; DateTimeView::DateTimeView(const char* name) : BGroupView(name, B_HORIZONTAL, 5), - fGmtTime(NULL), - fUseGmtTime(false), fInitialized(false), fSystemTimeAtStart(system_time()) { - _ReadRTCSettings(); _InitView(); // record the current time to enable revert. @@ -63,7 +59,6 @@ DateTimeView::DateTimeView(const char* name) DateTimeView::~DateTimeView() { - _WriteRTCSettings(); } @@ -110,11 +105,6 @@ DateTimeView::MessageReceived(BMessage* message) break; } - case kRTCUpdate: - fUseGmtTime = fGmtTime->Value() == B_CONTROL_ON; - _UpdateGmtSettings(); - break; - case kMsgRevert: _Revert(); break; @@ -125,6 +115,9 @@ DateTimeView::MessageReceived(BMessage* message) fClock->ChangeTimeFinished(); break; + case kRTCUpdate: + break; + default: BView::MessageReceived(message); break; @@ -135,15 +128,12 @@ DateTimeView::MessageReceived(BMessage* message) bool DateTimeView::CheckCanRevert() { - // check GMT vs Local setting - bool enable = fUseGmtTime != fOldUseGmtTime; - // check for changed time time_t unchangedNow = fTimeAtStart + _PrefletUptime(); time_t changedNow; time(&changedNow); - return enable || (changedNow != unchangedNow); + return changedNow != unchangedNow; } @@ -153,14 +143,6 @@ DateTimeView::_Revert() // Set the clock and calendar as they were at launch time + // time elapsed since application launch. - fUseGmtTime = fOldUseGmtTime; - _UpdateGmtSettings(); - - if (fUseGmtTime) - fGmtTime->SetValue(B_CONTROL_ON); - else - fLocalTime->SetValue(B_CONTROL_ON); - time_t timeNow = fTimeAtStart + _PrefletUptime(); struct tm result; struct tm* timeInfo; @@ -201,26 +183,6 @@ DateTimeView::_InitView() BTime time(BTime::CurrentTime(B_LOCAL_TIME)); fClock->SetTime(time.Hour(), time.Minute(), time.Second()); - BStringView* text = new BStringView("clockSetTo", - B_TRANSLATE("Hardware clock set to:")); - text->SetToolTip(B_TRANSLATE( - "This setting controls how Haiku will display your time based on how\n" - "time is measured in the computer's hardware clock. Windows is usually\n" - "set to local time, meaning the hardware clock is measured in the same\n" - "time as the configured time zone. When this is set to GMT it means the\n" - "hardware clock is measured based on GMT and Haiku will adjust the time\n" - "it shows based on the configured time zone.")); - fLocalTime = new BRadioButton("localTime", - B_TRANSLATE("Local time"), new BMessage(kRTCUpdate)); - fGmtTime = new BRadioButton("greenwichMeanTime", - B_TRANSLATE("GMT"), new BMessage(kRTCUpdate)); - - if (fUseGmtTime) - fGmtTime->SetValue(B_CONTROL_ON); - else - fLocalTime->SetValue(B_CONTROL_ON); - fOldUseGmtTime = fUseGmtTime; - BBox* divider = new BBox(BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER); @@ -236,68 +198,11 @@ DateTimeView::_InitView() .AddGroup(B_VERTICAL, 0) .Add(fTimeEdit) .Add(fClock) - .Add(text) - .AddGroup(B_HORIZONTAL, kInset) - .Add(fLocalTime) - .Add(fGmtTime) - .End() .End() .SetInsets(kInset, kInset, kInset, kInset); } -void -DateTimeView::_ReadRTCSettings() -{ - BPath path; - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) - return; - - path.Append("RTC_time_settings"); - - BEntry entry(path.Path()); - if (entry.Exists()) { - BFile file(&entry, B_READ_ONLY); - if (file.InitCheck() == B_OK) { - char buffer[6]; - file.Read(buffer, 6); - if (strncmp(buffer, "gmt", 3) == 0) - fUseGmtTime = true; - } - } -} - - -void -DateTimeView::_WriteRTCSettings() -{ - BPath path; - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) - return; - - path.Append("RTC_time_settings"); - - BFile file(path.Path(), B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY); - if (file.InitCheck() == B_OK) { - if (fUseGmtTime) - file.Write("gmt", 3); - else - file.Write("local", 5); - } -} - - -void -DateTimeView::_UpdateGmtSettings() -{ - _WriteRTCSettings(); - - _NotifyClockSettingChanged(); - - _kern_set_real_time_clock_is_gmt(fUseGmtTime); -} - - void DateTimeView::_UpdateDateTime(BMessage* message) { @@ -335,7 +240,6 @@ void DateTimeView::_NotifyClockSettingChanged() { BMessage msg(kMsgClockSettingChanged); - msg.AddBool("UseGMT", fUseGmtTime); Window()->PostMessage(&msg); } diff --git a/src/preferences/time/DateTimeView.h b/src/preferences/time/DateTimeView.h index 159ff6baa5..745f8d82da 100644 --- a/src/preferences/time/DateTimeView.h +++ b/src/preferences/time/DateTimeView.h @@ -18,7 +18,6 @@ class TDateEdit; class TTimeEdit; -class BRadioButton; class TAnalogClock; @@ -41,23 +40,16 @@ public: private: void _InitView(); - void _ReadRTCSettings(); - void _WriteRTCSettings(); - void _UpdateGmtSettings(); void _UpdateDateTime(BMessage* message); void _NotifyClockSettingChanged(); void _Revert(); time_t _PrefletUptime() const; - BRadioButton* fLocalTime; - BRadioButton* fGmtTime; TDateEdit* fDateEdit; TTimeEdit* fTimeEdit; BCalendarView* fCalendarView; TAnalogClock* fClock; - bool fUseGmtTime; - bool fOldUseGmtTime; bool fInitialized; time_t fTimeAtStart; diff --git a/src/preferences/time/TZDisplay.cpp b/src/preferences/time/TZDisplay.cpp index 03f322fe1f..1981ac27ef 100644 --- a/src/preferences/time/TZDisplay.cpp +++ b/src/preferences/time/TZDisplay.cpp @@ -55,7 +55,7 @@ TTZDisplay::Draw(BRect) BRect bounds = Bounds(); FillRect(Bounds(), B_SOLID_LOW); - + font_height height; GetFontHeight(&height); float fontHeight = ceilf(height.descent + height.ascent + @@ -164,5 +164,6 @@ TTZDisplay::_CalcPrefSize() StringWidth(" ") + StringWidth(fTime.String()) + padding); float secondLine = ceilf(StringWidth(fText.String()) + padding); size.width = firstLine > secondLine ? firstLine : secondLine; + return size; } diff --git a/src/preferences/time/TZDisplay.h b/src/preferences/time/TZDisplay.h index 273aa58232..331b71d361 100644 --- a/src/preferences/time/TZDisplay.h +++ b/src/preferences/time/TZDisplay.h @@ -14,6 +14,7 @@ #include #include +#include class TTZDisplay : public BView { diff --git a/src/preferences/time/TimeWindow.cpp b/src/preferences/time/TimeWindow.cpp index 56712456c8..13ed1995fc 100644 --- a/src/preferences/time/TimeWindow.cpp +++ b/src/preferences/time/TimeWindow.cpp @@ -89,11 +89,8 @@ TTimeWindow::MessageReceived(BMessage* message) break; case kMsgChange: - _SetRevertStatus(); - break; - - case kMsgClockSettingChanged: { + _SetRevertStatus(); bool useGMTTime = true; message->FindBool("UseGMT", &useGMTTime); if (useGMTTime) { @@ -103,8 +100,12 @@ TTimeWindow::MessageReceived(BMessage* message) BMessage hide(H_HIDE_PREVIEW); fTimeZoneView->MessageReceived(&hide); } + break; } + case kMsgClockSettingChanged: + break; + default: BWindow::MessageReceived(message); break; diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index 44ae77ff5d..734ed30498 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -35,9 +35,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -80,11 +82,14 @@ private: TimeZoneView::TimeZoneView(const char* name) : BGroupView(name, B_HORIZONTAL, B_USE_DEFAULT_SPACING), + fGmtTime(NULL), fToolTip(NULL), + fUseGmtTime(false), fCurrentZoneItem(NULL), fOldZoneItem(NULL), fInitialized(false) { + _ReadRTCSettings(); _InitView(); } @@ -92,7 +97,10 @@ TimeZoneView::TimeZoneView(const char* name) bool TimeZoneView::CheckCanRevert() { - return fCurrentZoneItem != fOldZoneItem; + // check GMT vs Local setting + bool enable = fUseGmtTime != fOldUseGmtTime; + + return enable || fCurrentZoneItem != fOldZoneItem; } @@ -100,6 +108,7 @@ TimeZoneView::~TimeZoneView() { if (fToolTip != NULL) fToolTip->ReleaseReference(); + _WriteRTCSettings(); } @@ -158,7 +167,7 @@ TimeZoneView::MessageReceived(BMessage* message) case H_SET_TIME_ZONE: { _SetSystemTimeZone(); - Looper()->PostMessage(new BMessage(kMsgChange)); + _NotifyClockSettingChanged(); break; } @@ -177,6 +186,8 @@ TimeZoneView::MessageReceived(BMessage* message) break; case kRTCUpdate: + fUseGmtTime = fGmtTime->Value() == B_CONTROL_ON; + _UpdateGmtSettings(); _UpdateCurrent(); _UpdatePreview(); break; @@ -248,6 +259,7 @@ TimeZoneView::_InitView() _BuildZoneMenu(); BScrollView* scrollList = new BScrollView("scrollList", fZoneList, B_FRAME_EVENTS | B_WILL_DRAW, false, true); + scrollList->SetExplicitMinSize(BSize(200, 0)); fCurrent = new TTZDisplay("currentTime", B_TRANSLATE("Current time:")); fPreview = new TTZDisplay("previewTime", B_TRANSLATE("Preview time:")); @@ -258,6 +270,20 @@ TimeZoneView::_InitView() fSetZone->SetExplicitAlignment( BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM)); + BStringView* text = new BStringView("clockSetTo", + B_TRANSLATE("Hardware clock set to:")); + fLocalTime = new BRadioButton("localTime", + B_TRANSLATE("Local time (Windows compatible)"), new BMessage(kRTCUpdate)); + fGmtTime = new BRadioButton("greenwichMeanTime", + B_TRANSLATE("GMT (UNIX compatible)"), new BMessage(kRTCUpdate)); + + if (fUseGmtTime) + fGmtTime->SetValue(B_CONTROL_ON); + else + fLocalTime->SetValue(B_CONTROL_ON); + fOldUseGmtTime = fUseGmtTime; + + const float kInset = be_control_look->DefaultItemSpacing(); BLayoutBuilder::Group<>(this) .Add(scrollList) @@ -265,6 +291,11 @@ TimeZoneView::_InitView() .Add(fCurrent) .Add(fPreview) .AddGlue() + .Add(text) + .AddGroup(B_VERTICAL, kInset) + .Add(fLocalTime) + .Add(fGmtTime) + .End() .Add(fSetZone) .End() .SetInsets(kInset, kInset, kInset, kInset); @@ -463,6 +494,13 @@ TimeZoneView::_Revert() fZoneList->DeselectAll(); fZoneList->ScrollToSelection(); + fUseGmtTime = fOldUseGmtTime; + if (fUseGmtTime) + fGmtTime->SetValue(B_CONTROL_ON); + else + fLocalTime->SetValue(B_CONTROL_ON); + + _UpdateGmtSettings(); _SetSystemTimeZone(); _UpdatePreview(); _UpdateCurrent(); @@ -555,3 +593,65 @@ TimeZoneView::_FormatTime(const BTimeZone& timeZone) return result; } + + +void +TimeZoneView::_ReadRTCSettings() +{ + BPath path; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) + return; + + path.Append("RTC_time_settings"); + + BEntry entry(path.Path()); + if (entry.Exists()) { + BFile file(&entry, B_READ_ONLY); + if (file.InitCheck() == B_OK) { + char buffer[6]; + file.Read(buffer, 6); + if (strncmp(buffer, "gmt", 3) == 0) + fUseGmtTime = true; + } + } +} + + +void +TimeZoneView::_WriteRTCSettings() +{ + BPath path; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) + return; + + path.Append("RTC_time_settings"); + + BFile file(path.Path(), B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY); + if (file.InitCheck() == B_OK) { + if (fUseGmtTime) + file.Write("gmt", 3); + else + file.Write("local", 5); + } +} + + +void +TimeZoneView::_UpdateGmtSettings() +{ + _WriteRTCSettings(); + + _NotifyClockSettingChanged(); + + _kern_set_real_time_clock_is_gmt(fUseGmtTime); +} + + +void +TimeZoneView::_NotifyClockSettingChanged() +{ + BMessage msg(kMsgChange); + msg.AddBool("UseGMT", fUseGmtTime); + Window()->PostMessage(&msg); +} + diff --git a/src/preferences/time/ZoneView.h b/src/preferences/time/ZoneView.h index 9bfde926d4..9dc559b470 100644 --- a/src/preferences/time/ZoneView.h +++ b/src/preferences/time/ZoneView.h @@ -19,6 +19,7 @@ class BButton; class BMessage; class BOutlineListView; class BPopUpMenu; +class BRadioButton; class BTextToolTip; class BTimeZone; class TimeZoneListItem; @@ -45,8 +46,13 @@ private: void _UpdatePreview(); void _UpdateCurrent(); + void _NotifyClockSettingChanged(); BString _FormatTime(const BTimeZone& timeZone); + void _ReadRTCSettings(); + void _WriteRTCSettings(); + void _UpdateGmtSettings(); + void _InitView(); void _BuildZoneMenu(); @@ -56,10 +62,14 @@ private: BButton* fSetZone; TTZDisplay* fCurrent; TTZDisplay* fPreview; + BRadioButton* fLocalTime; + BRadioButton* fGmtTime; BTextToolTip* fToolTip; int32 fLastUpdateMinute; + bool fUseGmtTime; + bool fOldUseGmtTime; TimeZoneListItem* fCurrentZoneItem; TimeZoneListItem* fOldZoneItem; From ee46c038a6563365b0ad7ad842bcb94dadd2eeb4 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 13:32:22 +0000 Subject: [PATCH 569/702] Add newline to locale command line output. (that's more usual and it works for all other CLI apps). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43032 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/locale/locale.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/locale/locale.cpp b/src/bin/locale/locale.cpp index 130cfb68b3..8424912a99 100644 --- a/src/bin/locale/locale.cpp +++ b/src/bin/locale/locale.cpp @@ -42,7 +42,7 @@ print_formatting_conventions() { BFormattingConventions conventions; BLocale::Default()->GetFormattingConventions(&conventions); - printf("%s_%s.UTF-8", conventions.LanguageCode(), conventions.CountryCode()); + printf("%s_%s.UTF-8\n", conventions.LanguageCode(), conventions.CountryCode()); } @@ -75,10 +75,10 @@ main(int argc, char **argv) while ((c = getopt_long(argc, argv, "lcfh", longopts, NULL)) != -1) { switch (c) { case 'l': - printf("%s", preferred_language()); + printf("%s\n", preferred_language()); break; case 'c': - printf("%s.UTF-8", preferred_language()); + printf("%s.UTF-8\n", preferred_language()); break; case 'f': print_formatting_conventions(); From 9b7ff360a0be19bb16d926df971e802ea7d5c742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 31 Oct 2011 13:33:40 +0000 Subject: [PATCH 570/702] Add creation of a be:volume_id attribute on the root node as BeOS did, based on a patch by phcoder. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43033 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/bfs/Volume.cpp | 49 +++++++++++++++++-- src/add-ons/kernel/file_systems/bfs/Volume.h | 2 + 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.cpp b/src/add-ons/kernel/file_systems/bfs/Volume.cpp index a7166947f3..22619861d4 100644 --- a/src/add-ons/kernel/file_systems/bfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Volume.cpp @@ -10,6 +10,7 @@ #include "Volume.h" #include "Journal.h" #include "Inode.h" +#include "Attribute.h" #include "Query.h" @@ -412,19 +413,28 @@ Volume::Mount(const char* deviceName, uint32 flags) // we don't use the vnode layer to access the indices node } - // all went fine - opener.Keep(); - return B_OK; } else + { FATAL(("could not create root node: publish_vnode() failed!\n")); + delete fRootNode; + return status; + } - delete fRootNode; } else { status = B_BAD_VALUE; FATAL(("could not create root node!\n")); + return status; } - return status; + if (!(fFlags & VOLUME_READ_ONLY)) { + Attribute attr(fRootNode); + if (attr.Get ("be:volume_id") == B_ENTRY_NOT_FOUND) + CreateVolumeID(); + } + + // all went fine + opener.Keep(); + return B_OK; } @@ -501,6 +511,33 @@ Volume::CreateIndicesRoot(Transaction& transaction) } +status_t +Volume::CreateVolumeID() +{ + Attribute attr(fRootNode); + status_t status; + attr_cookie* cookie; + status = attr.Create("be:volume_id", B_UINT64_TYPE, O_RDWR, &cookie); + if (status == B_OK) { + static bool seeded = false; + if (!seeded) { + // seed the random number generator for the be:volume_id attribute. + srand(time(NULL)); + seeded = true; + } + uint64_t id; + size_t len = sizeof (id); + id = ((uint64_t) rand () << 32) | rand (); + Transaction transaction(this, fRootNode->BlockNumber()); + fRootNode->WriteLockInTransaction(transaction); + attr.Write(transaction, cookie, 0, (uint8_t *) &id, &len, NULL); + transaction.Done(); + } + return status; +} + + + status_t Volume::AllocateForInode(Transaction& transaction, const Inode* parent, mode_t type, block_run& run) @@ -732,6 +769,8 @@ Volume::Initialize(int fd, const char* name, uint32 blockSize, return status; } + CreateVolumeID(); + WriteSuperBlock(); transaction.Done(); diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.h b/src/add-ons/kernel/file_systems/bfs/Volume.h index 562ea21375..500a00f682 100644 --- a/src/add-ons/kernel/file_systems/bfs/Volume.h +++ b/src/add-ons/kernel/file_systems/bfs/Volume.h @@ -92,6 +92,8 @@ public: status_t CreateIndicesRoot(Transaction& transaction); + status_t CreateVolumeID(); + InodeList& RemovedInodes() { return fRemovedInodes; } // This list is guarded by the transaction lock From 14ac1ee9620bcd06aa0a3730d0d66897eff5f6f1 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 14:26:37 +0000 Subject: [PATCH 571/702] Tweak the notification window again : * Spacing of the bprogressbar is now 8pixels on each size * Remove the useless window tab for now Also fix DecoratorFrame() again as BORDERED_WINDOW didn't work with it either. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43034 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 7 ++++--- src/servers/notification/NotificationView.cpp | 4 ++-- src/servers/notification/NotificationWindow.cpp | 8 ++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index aad44398ce..b95e19d313 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2088,9 +2088,10 @@ BWindow::DecoratorFrame() const settings.FindFloat("border width", &borderWidth); } else { // probably no-border window look - if (fLook == B_NO_BORDER_WINDOW_LOOK) { - borderWidth = 0.0; - } + if (fLook == B_NO_BORDER_WINDOW_LOOK) + borderWidth = 0.f; + else if (fLook == B_BORDERED_WINDOW_LOOK) + borderWidth = 1.f; // else use fall-back values from above } diff --git a/src/servers/notification/NotificationView.cpp b/src/servers/notification/NotificationView.cpp index 215b1e1958..8241542496 100644 --- a/src/servers/notification/NotificationView.cpp +++ b/src/servers/notification/NotificationView.cpp @@ -105,8 +105,8 @@ NotificationView::NotificationView(NotificationWindow* win, break; case B_PROGRESS_NOTIFICATION: { - BRect frame(kIconStripeWidth + 8, Bounds().bottom - 36, - Bounds().right - 8, Bounds().bottom - 8); + BRect frame(kIconStripeWidth + 9, Bounds().bottom - 36, + Bounds().right - 8, Bounds().bottom - 10); BStatusBar* progress = new BStatusBar(frame, "progress"); progress->SetBarHeight(12.0f); progress->SetMaxValue(1.0f); diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index a633c38321..8c9c5032b0 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -55,14 +55,17 @@ const float kSmallPadding = 2; NotificationWindow::NotificationWindow() : BWindow(BRect(0, 0, 0, 0), B_TRANSLATE_MARK("Notification"), - kLeftTitledWindowLook, B_FLOATING_ALL_WINDOW_FEEL, B_AVOID_FRONT | B_AVOID_FOCUS | B_NOT_CLOSABLE - | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_NOT_MOVABLE, + B_BORDERED_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_AVOID_FRONT + | B_AVOID_FOCUS | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE + | B_NOT_RESIZABLE | B_NOT_MOVABLE, B_ALL_WORKSPACES) { fBorder = new BorderView(Bounds(), "Notification"); AddChild(fBorder); + // Needed so everything gets the right size - we should switch to layout + // mode... Show(); Hide(); @@ -379,6 +382,7 @@ NotificationWindow::SetPosition() float rightOffset = bounds.right - Frame().right; float bottomOffset = bounds.bottom - Frame().bottom; // Size of the borders around the window + printf("%f %f %f %f\n",leftOffset, topOffset, rightOffset, bottomOffset); float x = Frame().left, y = Frame().top; // If we can't guess, don't move... From 62d998858fd50491269250934aec75179098d3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 31 Oct 2011 15:42:56 +0000 Subject: [PATCH 572/702] Quote $f to avoid problems with space in file names... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43035 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/common/boot/post_install/mime_update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/common/boot/post_install/mime_update.sh b/data/common/boot/post_install/mime_update.sh index fb8e137dcf..275e580343 100755 --- a/data/common/boot/post_install/mime_update.sh +++ b/data/common/boot/post_install/mime_update.sh @@ -15,8 +15,8 @@ _progress 0.0 "desktop files" for f in $(/bin/finddir B_DESKTOP_DIRECTORY 2>/dev/null\ || echo "/boot/home/Desktop")/*; do - if [ -f $f ]; then - mimeset -f $f + if [ -f "$f" ]; then + mimeset -f "$f" fi done From f6df6995b6b4a58f3fa5c6b8c8853ad4c38628df Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 31 Oct 2011 17:07:47 +0000 Subject: [PATCH 573/702] Apply patch by Olivier Coursiere that fixes #8075: the color index variable wasn't constrained to the size of the color array, leading to an overflow + crash when a large number of files were scanned. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43036 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/diskusage/PieView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/diskusage/PieView.cpp b/src/apps/diskusage/PieView.cpp index 57908a385b..e3ec4e637e 100644 --- a/src/apps/diskusage/PieView.cpp +++ b/src/apps/diskusage/PieView.cpp @@ -443,7 +443,7 @@ PieView::_DrawDirectory(BRect b, FileInfo* info, float parentSpan, } if (info != NULL && info->color >= 0 && level == 0) - colorIdx = info->color; + colorIdx = info->color % kBasePieColorCount; else if (info != NULL) info->color = colorIdx; From 0fa3181d95582cdf165a9f9e1cfb08ab5bad158f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 31 Oct 2011 18:09:24 +0000 Subject: [PATCH 574/702] Implemented the patch on #7963 in a different way. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43037 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/input/InputServerTypes.h | 1 + .../devices/keyboard/KeyboardInputDevice.cpp | 9 +++++++++ .../devices/keyboard/KeyboardInputDevice.h | 1 + src/servers/input/InputServer.cpp | 13 +++++++++++-- src/servers/input/InputServer.h | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/headers/private/input/InputServerTypes.h b/headers/private/input/InputServerTypes.h index 68377e7851..7ba56de2ab 100644 --- a/headers/private/input/InputServerTypes.h +++ b/headers/private/input/InputServerTypes.h @@ -23,6 +23,7 @@ #define IS_GET_MOUSE_MAP 'Igmm' #define IS_SET_MOUSE_MAP 'Ismm' #define IS_GET_KEYBOARD_ID 'Igid' +#define IS_SET_KEYBOARD_ID 'Isid' #define IS_GET_CLICK_SPEED 'Igcs' #define IS_SET_CLICK_SPEED 'Iscs' #define IS_GET_KEY_REPEAT_RATE 'Igrr' diff --git a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp index ef963d2621..a4c05f8c2b 100644 --- a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp +++ b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp @@ -131,6 +131,7 @@ KeyboardDevice::KeyboardDevice(KeyboardInputDevice* owner, const char* path) fThread(-1), fActive(false), fInputMethodStarted(false), + fKeyboardID(0), fUpdateSettings(false), fSettingsCommand(0), fKeymapLock("keymap lock") @@ -281,6 +282,14 @@ KeyboardDevice::_ControlThread() memset(states, 0, sizeof(states)); + if (fKeyboardID == 0) { + if (ioctl(fFD, KB_GET_KEYBOARD_ID, &fKeyboardID) == 0) { + BMessage message(IS_SET_KEYBOARD_ID); + message.AddInt16("id", fKeyboardID); + be_app->PostMessage(&message); + } + } + while (fActive) { if (ioctl(fFD, KB_READ, &keyInfo, sizeof(keyInfo)) != B_OK) { _ControlThreadCleanup(); diff --git a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h index 1adc45c7aa..14a77c2885 100644 --- a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h +++ b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h @@ -61,6 +61,7 @@ private: uint32 fModifiers; uint32 fCommandKey; uint32 fControlKey; + uint16 fKeyboardID; volatile bool fUpdateSettings; volatile uint32 fSettingsCommand; diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index 8b44ef8eb5..a8c2e3c886 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -510,7 +510,10 @@ InputServer::MessageReceived(BMessage* message) status = HandleGetSetMouseMap(message, &reply); break; case IS_GET_KEYBOARD_ID: - status = HandleGetKeyboardID(message, &reply); + status = HandleGetSetKeyboardID(message, &reply); + break; + case IS_SET_KEYBOARD_ID: + status = HandleGetSetKeyboardID(message, &reply); break; case IS_GET_CLICK_SPEED: status = HandleGetSetClickSpeed(message, &reply); @@ -870,8 +873,14 @@ InputServer::HandleGetSetMouseMap(BMessage* message, BMessage* reply) status_t -InputServer::HandleGetKeyboardID(BMessage* message, BMessage* reply) +InputServer::HandleGetSetKeyboardID(BMessage* message, BMessage* reply) { + int16 id; +message->PrintToStream(); + if (message->FindInt16("id", &id) == B_OK) { + fKeyboardID = (uint16)id; + return B_OK; + } return reply->AddInt16("id", fKeyboardID); } diff --git a/src/servers/input/InputServer.h b/src/servers/input/InputServer.h index 44224790db..7b70b330ed 100644 --- a/src/servers/input/InputServer.h +++ b/src/servers/input/InputServer.h @@ -137,7 +137,7 @@ class InputServer : public BApplication { status_t HandleGetSetMouseSpeed(BMessage* message, BMessage* reply); status_t HandleSetMousePosition(BMessage* message, BMessage* reply); status_t HandleGetSetMouseMap(BMessage* message, BMessage* reply); - status_t HandleGetKeyboardID(BMessage* message, BMessage* reply); + status_t HandleGetSetKeyboardID(BMessage* message, BMessage* reply); status_t HandleGetSetClickSpeed(BMessage* message, BMessage* reply); status_t HandleGetSetKeyRepeatRate(BMessage* message, BMessage* reply); status_t HandleGetSetKeyMap(BMessage* message, BMessage* reply); From 77697df4cf1aa0e84f9ff91976b50dfe198bbbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 31 Oct 2011 20:14:16 +0000 Subject: [PATCH 575/702] Remove leftover debug code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43038 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/input/InputServer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index a8c2e3c886..55d50d570a 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -876,7 +876,6 @@ status_t InputServer::HandleGetSetKeyboardID(BMessage* message, BMessage* reply) { int16 id; -message->PrintToStream(); if (message->FindInt16("id", &id) == B_OK) { fKeyboardID = (uint16)id; return B_OK; From 701c4b84bb1d0066e5124f0b5755a1c3657caf28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 31 Oct 2011 20:39:57 +0000 Subject: [PATCH 576/702] Abide by the Coding Style Police. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43039 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/bfs/Volume.cpp | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.cpp b/src/add-ons/kernel/file_systems/bfs/Volume.cpp index 22619861d4..874511268d 100644 --- a/src/add-ons/kernel/file_systems/bfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Volume.cpp @@ -6,12 +6,12 @@ //! super block, mounting, etc. -#include "Debug.h" -#include "Volume.h" -#include "Journal.h" -#include "Inode.h" #include "Attribute.h" +#include "Debug.h" +#include "Inode.h" +#include "Journal.h" #include "Query.h" +#include "Volume.h" static const int32 kDesiredAllocationGroups = 56; @@ -412,14 +412,11 @@ Volume::Mount(const char* deviceName, uint32 flags) } else { // we don't use the vnode layer to access the indices node } - - } else - { + } else { FATAL(("could not create root node: publish_vnode() failed!\n")); delete fRootNode; return status; - } - + } } else { status = B_BAD_VALUE; FATAL(("could not create root node!\n")); @@ -428,7 +425,7 @@ Volume::Mount(const char* deviceName, uint32 flags) if (!(fFlags & VOLUME_READ_ONLY)) { Attribute attr(fRootNode); - if (attr.Get ("be:volume_id") == B_ENTRY_NOT_FOUND) + if (attr.Get("be:volume_id") == B_ENTRY_NOT_FOUND) CreateVolumeID(); } @@ -526,11 +523,11 @@ Volume::CreateVolumeID() seeded = true; } uint64_t id; - size_t len = sizeof (id); - id = ((uint64_t) rand () << 32) | rand (); + size_t length = sizeof(id); + id = ((uint64_t)rand() << 32) | rand(); Transaction transaction(this, fRootNode->BlockNumber()); fRootNode->WriteLockInTransaction(transaction); - attr.Write(transaction, cookie, 0, (uint8_t *) &id, &len, NULL); + attr.Write(transaction, cookie, 0, (uint8_t *)&id, &length, NULL); transaction.Done(); } return status; From a287d1c156bc2cceecb8ae2be675e766a57f82e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 31 Oct 2011 20:55:59 +0000 Subject: [PATCH 577/702] Fix Jeroen Oortwijn's email address. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43042 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/input_server/devices/wacom/TabletDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp index 224f0f7c89..8a4f144e3e 100644 --- a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp +++ b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp @@ -10,7 +10,7 @@ * Frans van Nispen * Stefan Werner * Hiroyuki Tsutsumi - * Jeroen Oortwijn + * Jeroen Oortwijn */ #include From 7008d2f61167277c317608d00693a5e6c26aaa93 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 21:30:13 +0000 Subject: [PATCH 578/702] bonefish+mmlr: Add a DoublyLinkedList::Contains() method to check if a list contains a certain element. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43043 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/util/DoublyLinkedList.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/headers/private/kernel/util/DoublyLinkedList.h b/headers/private/kernel/util/DoublyLinkedList.h index 50e5fa1281..23216894d3 100644 --- a/headers/private/kernel/util/DoublyLinkedList.h +++ b/headers/private/kernel/util/DoublyLinkedList.h @@ -359,6 +359,9 @@ public: inline Element* GetPrevious(Element* element) const; inline Element* GetNext(Element* element) const; + inline bool Contains(Element* element) const; + // O(n)! + inline int32 Count() const; // O(n)! @@ -617,6 +620,20 @@ DOUBLY_LINKED_LIST_CLASS_NAME::GetNext(Element* element) const return result; } + +DOUBLY_LINKED_LIST_TEMPLATE_LIST +bool +DOUBLY_LINKED_LIST_CLASS_NAME::Contains(Element* _element) const +{ + for (Element* element = First(); element; element = GetNext(element)) { + if (element == _element) + return true; + } + + return false; +} + + // Count DOUBLY_LINKED_LIST_TEMPLATE_LIST int32 From ebf63109bb273a8f68476e0664debde48f36aea3 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 21:31:58 +0000 Subject: [PATCH 579/702] Tiny style cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43044 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/VMCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/vm/VMCache.cpp b/src/system/kernel/vm/VMCache.cpp index 032772f4d7..1385fe1112 100644 --- a/src/system/kernel/vm/VMCache.cpp +++ b/src/system/kernel/vm/VMCache.cpp @@ -611,7 +611,7 @@ VMCache::Init(uint32 cacheType, uint32 allocationFlags) #if DEBUG_CACHE_LIST mutex_lock(&sCacheListLock); - if (gDebugCacheList) + if (gDebugCacheList != NULL) gDebugCacheList->debug_previous = this; debug_next = gDebugCacheList; gDebugCacheList = this; From fe8f0f4601874527071ef066e8550e07323f9f51 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 21:37:39 +0000 Subject: [PATCH 580/702] bonefish+mmlr: * Add an AbstractTraceEntryWithStackTrace that includes stack trace handling. * Add a selector macro/template combo to conveniently select the right base class depending on whether stack traces are enabled or not. * Minor style cleanups. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43045 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/tracing.h | 71 ++++++++++++++++++++++++----- src/system/kernel/debug/tracing.cpp | 43 ++++++++++++----- 2 files changed, 91 insertions(+), 23 deletions(-) diff --git a/headers/private/kernel/tracing.h b/headers/private/kernel/tracing.h index 71a8b30d65..52f0cf5c93 100644 --- a/headers/private/kernel/tracing.h +++ b/headers/private/kernel/tracing.h @@ -92,25 +92,72 @@ class TraceEntry { class AbstractTraceEntry : public TraceEntry { - public: - AbstractTraceEntry(); - virtual ~AbstractTraceEntry(); +public: + AbstractTraceEntry() + { + _Init(); + } - virtual void Dump(TraceOutput& out); + // dummy, ignores all arguments + AbstractTraceEntry(size_t, size_t, bool) + { + _Init(); + } - virtual void AddDump(TraceOutput& out); + virtual ~AbstractTraceEntry(); - thread_id ThreadID() const { return fThread; } - thread_id TeamID() const { return fTeam; } - bigtime_t Time() const { return fTime; } + virtual void Dump(TraceOutput& out); - protected: - thread_id fThread; - team_id fTeam; - bigtime_t fTime; + virtual void AddDump(TraceOutput& out); + + thread_id ThreadID() const { return fThread; } + thread_id TeamID() const { return fTeam; } + bigtime_t Time() const { return fTime; } + +protected: + typedef AbstractTraceEntry TraceEntryBase; + +private: + void _Init(); + +protected: + thread_id fThread; + team_id fTeam; + bigtime_t fTime; }; +class AbstractTraceEntryWithStackTrace : public AbstractTraceEntry { +public: + AbstractTraceEntryWithStackTrace(size_t stackTraceDepth, + size_t skipFrames, bool kernelOnly); + + virtual void DumpStackTrace(TraceOutput& out); + +protected: + typedef AbstractTraceEntryWithStackTrace TraceEntryBase; + +private: + tracing_stack_trace* fStackTrace; +}; + + +template +struct AbstractTraceEntrySelector { + typedef AbstractTraceEntryWithStackTrace Type; +}; + + +template<> +struct AbstractTraceEntrySelector<0> { + typedef AbstractTraceEntry Type; +}; + + +#define TRACE_ENTRY_SELECTOR(stackTraceDepth) \ + AbstractTraceEntrySelector::Type + + class LazyTraceOutput : public TraceOutput { public: LazyTraceOutput(char* buffer, size_t bufferSize, uint32 flags) diff --git a/src/system/kernel/debug/tracing.cpp b/src/system/kernel/debug/tracing.cpp index 75cd8b771e..7d487f5e11 100644 --- a/src/system/kernel/debug/tracing.cpp +++ b/src/system/kernel/debug/tracing.cpp @@ -737,17 +737,6 @@ TraceEntry::operator new(size_t size, const std::nothrow_t&) throw() // #pragma mark - -AbstractTraceEntry::AbstractTraceEntry() -{ - Thread* thread = thread_get_current_thread(); - if (thread != NULL) { - fThread = thread->id; - if (thread->team) - fTeam = thread->team->id; - } - fTime = system_time(); -} - AbstractTraceEntry::~AbstractTraceEntry() { } @@ -777,6 +766,38 @@ AbstractTraceEntry::AddDump(TraceOutput& out) } +void +AbstractTraceEntry::_Init() +{ + Thread* thread = thread_get_current_thread(); + if (thread != NULL) { + fThread = thread->id; + if (thread->team) + fTeam = thread->team->id; + } + fTime = system_time(); +} + + +// #pragma mark - AbstractTraceEntryWithStackTrace + + + +AbstractTraceEntryWithStackTrace::AbstractTraceEntryWithStackTrace( + size_t stackTraceDepth, size_t skipFrames, bool kernelOnly) +{ + fStackTrace = capture_tracing_stack_trace(stackTraceDepth, skipFrames + 1, + kernelOnly); +} + + +void +AbstractTraceEntryWithStackTrace::DumpStackTrace(TraceOutput& out) +{ + out.PrintStackTrace(fStackTrace); +} + + // #pragma mark - From 72156a402f54ea4be9dc3e3e9704c612f7d9ad16 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 21:58:00 +0000 Subject: [PATCH 581/702] bonefish+mmlr: * Introduce "paranoid" malloc/free into the slab allocator (initializing allocated memory to 0xcc and setting freed memory to 0xdeadbeef). * Allow for optional stack traces for slab object cache tracing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43046 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/config_headers/tracing_config.h | 1 + headers/private/kernel/slab/ObjectDepot.h | 4 ++ src/system/kernel/slab/MemoryManager.cpp | 8 +++- src/system/kernel/slab/ObjectCache.cpp | 29 ++++++++++++ src/system/kernel/slab/ObjectCache.h | 4 ++ src/system/kernel/slab/ObjectDepot.cpp | 54 +++++++++++++++++++++++ src/system/kernel/slab/Slab.cpp | 27 ++++++++++-- src/system/kernel/slab/slab_private.h | 37 ++++++++++++++++ 8 files changed, 159 insertions(+), 5 deletions(-) diff --git a/build/config_headers/tracing_config.h b/build/config_headers/tracing_config.h index 926b69e1d5..5f1da44232 100644 --- a/build/config_headers/tracing_config.h +++ b/build/config_headers/tracing_config.h @@ -48,6 +48,7 @@ #define SIGNAL_TRACING 0 #define SLAB_MEMORY_MANAGER_TRACING 0 #define SLAB_OBJECT_CACHE_TRACING 0 +#define SLAB_OBJECT_CACHE_TRACING_STACK_TRACE 0 /* stack trace depth */ #define SWAP_TRACING 0 #define SYSCALL_TRACING 0 #define SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT 1 diff --git a/headers/private/kernel/slab/ObjectDepot.h b/headers/private/kernel/slab/ObjectDepot.h index 4ed0591606..456038aed2 100644 --- a/headers/private/kernel/slab/ObjectDepot.h +++ b/headers/private/kernel/slab/ObjectDepot.h @@ -45,6 +45,10 @@ void object_depot_store(object_depot* depot, void* object, uint32 flags); void object_depot_make_empty(object_depot* depot, uint32 flags); +#if PARANOID_KERNEL_FREE +bool object_depot_contains_object(object_depot* depot, void* object); +#endif + #ifdef __cplusplus } #endif diff --git a/src/system/kernel/slab/MemoryManager.cpp b/src/system/kernel/slab/MemoryManager.cpp index b59a2a82a4..0c8dcdfdb2 100644 --- a/src/system/kernel/slab/MemoryManager.cpp +++ b/src/system/kernel/slab/MemoryManager.cpp @@ -617,7 +617,11 @@ MemoryManager::AllocateRaw(size_t size, uint32 flags, void*& _pages) ? CREATE_AREA_DONT_WAIT : 0) | CREATE_AREA_DONT_CLEAR, &virtualRestrictions, &physicalRestrictions, &_pages); - return area >= 0 ? B_OK : area; + + status_t result = area >= 0 ? B_OK : area; + if (result == B_OK) + fill_allocated_block(_pages, size); + return result; } // determine chunk size (small or medium) @@ -656,6 +660,8 @@ MemoryManager::AllocateRaw(size_t size, uint32 flags, void*& _pages) chunk->reference = (addr_t)chunkAddress + size - 1; _pages = (void*)chunkAddress; + fill_allocated_block(_pages, size); + TRACE("MemoryManager::AllocateRaw() done: %p (meta chunk: %d, chunk %d)\n", _pages, int(metaChunk - area->metaChunks), int(chunk - metaChunk->chunks)); diff --git a/src/system/kernel/slab/ObjectCache.cpp b/src/system/kernel/slab/ObjectCache.cpp index 7a3bb3b258..8f1822a4aa 100644 --- a/src/system/kernel/slab/ObjectCache.cpp +++ b/src/system/kernel/slab/ObjectCache.cpp @@ -238,3 +238,32 @@ ObjectCache::ReturnObjectToSlab(slab* source, void* object, uint32 flags) partial.Add(source); } } + + +#if PARANOID_KERNEL_FREE + +bool +ObjectCache::AssertObjectNotFreed(void* object) +{ + MutexLocker locker(lock); + + slab* source = ObjectSlab(object); + if (!partial.Contains(source) && !full.Contains(source)) { + panic("object_cache: to be freed object slab not part of cache!"); + return false; + } + + object_link* link = object_to_link(object, object_size); + for (object_link* freeLink = source->free; freeLink != NULL; + freeLink = freeLink->next) { + if (freeLink == link) { + panic("object_cache: double free of %p (slab %p, cache %p)", + object, source, this); + return false; + } + } + + return true; +} + +#endif // PARANOID_KERNEL_FREE diff --git a/src/system/kernel/slab/ObjectCache.h b/src/system/kernel/slab/ObjectCache.h index f2d36b5caf..498256edad 100644 --- a/src/system/kernel/slab/ObjectCache.h +++ b/src/system/kernel/slab/ObjectCache.h @@ -107,6 +107,10 @@ public: void FreePages(void* pages); status_t EarlyAllocatePages(void** pages, uint32 flags); void EarlyFreePages(void* pages); + +#if PARANOID_KERNEL_FREE + bool AssertObjectNotFreed(void* object); +#endif }; diff --git a/src/system/kernel/slab/ObjectDepot.cpp b/src/system/kernel/slab/ObjectDepot.cpp index 60bab902c3..e8a890edbc 100644 --- a/src/system/kernel/slab/ObjectDepot.cpp +++ b/src/system/kernel/slab/ObjectDepot.cpp @@ -31,6 +31,10 @@ public: inline void* Pop(); inline bool Push(void* object); + +#if PARANOID_KERNEL_FREE + bool ContainsObject(void* object) const; +#endif }; @@ -72,6 +76,22 @@ DepotMagazine::Push(void* object) } +#if PARANOID_KERNEL_FREE + +bool +DepotMagazine::ContainsObject(void* object) const +{ + for (uint16 i = 0; i < current_round; i++) { + if (rounds[i] == object) + return true; + } + + return false; +} + +#endif // PARANOID_KERNEL_FREE + + // #pragma mark - @@ -352,6 +372,40 @@ object_depot_make_empty(object_depot* depot, uint32 flags) } +#if PARANOID_KERNEL_FREE + +bool +object_depot_contains_object(object_depot* depot, void* object) +{ + WriteLocker writeLocker(depot->outer_lock); + + int cpuCount = smp_get_num_cpus(); + for (int i = 0; i < cpuCount; i++) { + depot_cpu_store& store = depot->stores[i]; + + if (store.loaded != NULL && !store.loaded->IsEmpty()) { + if (store.loaded->ContainsObject(object)) + return true; + } + + if (store.previous != NULL && !store.previous->IsEmpty()) { + if (store.previous->ContainsObject(object)) + return true; + } + } + + for (DepotMagazine* magazine = depot->full; magazine != NULL; + magazine = magazine->next) { + if (magazine->ContainsObject(object)) + return true; + } + + return false; +} + +#endif // PARANOID_KERNEL_FREE + + // #pragma mark - private kernel API diff --git a/src/system/kernel/slab/Slab.cpp b/src/system/kernel/slab/Slab.cpp index 402d9718cc..12f02f6d3d 100644 --- a/src/system/kernel/slab/Slab.cpp +++ b/src/system/kernel/slab/Slab.cpp @@ -54,10 +54,12 @@ static ConditionVariable sMaintenanceCondition; namespace SlabObjectCacheTracing { -class ObjectCacheTraceEntry : public AbstractTraceEntry { +class ObjectCacheTraceEntry + : public TRACE_ENTRY_SELECTOR(SLAB_OBJECT_CACHE_TRACING_STACK_TRACE) { public: ObjectCacheTraceEntry(ObjectCache* cache) : + TraceEntryBase(SLAB_OBJECT_CACHE_TRACING_STACK_TRACE, 0, true), fCache(cache) { } @@ -668,7 +670,7 @@ object_cache_alloc(object_cache* cache, uint32 flags) void* object = object_depot_obtain(&cache->depot); if (object) { T(Alloc(cache, flags, object)); - return object; + return fill_allocated_block(object, cache->object_size); } } @@ -717,7 +719,7 @@ object_cache_alloc(object_cache* cache, uint32 flags) void* object = link_to_object(link, cache->object_size); T(Alloc(cache, flags, object)); - return object; + return fill_allocated_block(object, cache->object_size); } @@ -729,7 +731,24 @@ object_cache_free(object_cache* cache, void* object, uint32 flags) T(Free(cache, object)); - if (!(cache->flags & CACHE_NO_DEPOT)) { +#if PARANOID_KERNEL_FREE + // TODO: allow forcing the check even if we don't find deadbeef + if (*(uint32*)object == 0xdeadbeef) { + if (!cache->AssertObjectNotFreed(object)) + return; + + if ((cache->flags & CACHE_NO_DEPOT) == 0) { + if (object_depot_contains_object(&cache->depot, object)) { + panic("object_cache: object %p is already freed", object); + return; + } + } + } + + fill_freed_block(object, cache->object_size); +#endif + + if ((cache->flags & CACHE_NO_DEPOT) == 0) { object_depot_store(&cache->depot, object, flags); return; } diff --git a/src/system/kernel/slab/slab_private.h b/src/system/kernel/slab/slab_private.h index 6eba3fcf69..9c0e1e2b08 100644 --- a/src/system/kernel/slab/slab_private.h +++ b/src/system/kernel/slab/slab_private.h @@ -84,4 +84,41 @@ slab_internal_free(void* buffer, uint32 flags) } +#if PARANOID_KERNEL_MALLOC || PARANOID_KERNEL_FREE +static inline void* +fill_block(void* buffer, size_t size, uint32 pattern) +{ + if (buffer == NULL) + return NULL; + + size &= ~(sizeof(pattern) - 1); + for (size_t i = 0; i < size / sizeof(pattern); i++) + ((uint32*)buffer)[i] = pattern; + + return buffer; +} +#endif + + +static inline void* +fill_allocated_block(void* buffer, size_t size) +{ +#if PARANOID_KERNEL_MALLOC + return fill_block(buffer, size, 0xcccccccc); +#else + return buffer; +#endif +} + + +static inline void* +fill_freed_block(void* buffer, size_t size) +{ +#if PARANOID_KERNEL_FREE + return fill_block(buffer, size, 0xdeadbeef); +#else + return buffer; +#endif +} + #endif // SLAB_PRIVATE_H From ffb6929a3b30dd9367feb64368e7c50448ff59dd Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 31 Oct 2011 22:00:16 +0000 Subject: [PATCH 582/702] bonefish+mmlr: Move blocking the 0xcccccccc and 0xdeadbeef address ranges from heap to VM init so that it also works when used in the slab allocator. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43047 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/heap.cpp | 9 --------- src/system/kernel/vm/vm.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/system/kernel/heap.cpp b/src/system/kernel/heap.cpp index 0ef551c6d7..928f5b1ba4 100644 --- a/src/system/kernel/heap.cpp +++ b/src/system/kernel/heap.cpp @@ -2137,15 +2137,6 @@ heap_init_post_area() status_t heap_init_post_sem() { -#if PARANOID_KERNEL_MALLOC - vm_block_address_range("uninitialized heap memory", - (void *)ROUNDDOWN(0xcccccccc, B_PAGE_SIZE), B_PAGE_SIZE * 64); -#endif -#if PARANOID_KERNEL_FREE - vm_block_address_range("freed heap memory", - (void *)ROUNDDOWN(0xdeadbeef, B_PAGE_SIZE), B_PAGE_SIZE * 64); -#endif - sHeapGrowSem = create_sem(0, "heap_grow_sem"); if (sHeapGrowSem < 0) { panic("heap_init_post_sem(): failed to create heap grow sem\n"); diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 97ba711709..f3b1f291f5 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -3739,6 +3739,15 @@ vm_init(kernel_args* args) void* lastPage = (void*)ROUNDDOWN(~(addr_t)0, B_PAGE_SIZE); vm_block_address_range("overflow protection", lastPage, B_PAGE_SIZE); +#if PARANOID_KERNEL_MALLOC + vm_block_address_range("uninitialized heap memory", + (void *)ROUNDDOWN(0xcccccccc, B_PAGE_SIZE), B_PAGE_SIZE * 64); +#endif +#if PARANOID_KERNEL_FREE + vm_block_address_range("freed heap memory", + (void *)ROUNDDOWN(0xdeadbeef, B_PAGE_SIZE), B_PAGE_SIZE * 64); +#endif + // create the object cache for the page mappings gPageMappingsObjectCache = create_object_cache_etc("page mappings", sizeof(vm_page_mapping), 0, 0, 64, 128, CACHE_LARGE_SLAB, NULL, NULL, From 02c3d9f5e6e7dbd7e6de9a6fd959cf5e934b583b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 31 Oct 2011 22:01:29 +0000 Subject: [PATCH 583/702] Rename some parameters to avoid "declaration of 'foo' shadows global declaration" warnings. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43048 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/math.h | 2 +- headers/posix/signal.h | 34 +++++++++++++++++----------------- headers/posix/time.h | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/headers/posix/math.h b/headers/posix/math.h index 2aa3e9cfd3..789aff023d 100644 --- a/headers/posix/math.h +++ b/headers/posix/math.h @@ -234,7 +234,7 @@ extern long double fmal(long double x, long double y, long double z); extern long double fmaxl(long double x, long double y); extern long double fminl(long double x, long double y); extern long double fmodl(long double x, long double y); -extern long double frexpl(long double num, int *exp); +extern long double frexpl(long double num, int *_exponent); extern long double hypotl(long double x, long double y); extern int ilogbl(long double x); extern long double ldexpl(long double x, int exponent); diff --git a/headers/posix/signal.h b/headers/posix/signal.h index c43aef770a..7415cfe99c 100644 --- a/headers/posix/signal.h +++ b/headers/posix/signal.h @@ -225,29 +225,29 @@ extern "C" { /* signal management (actions and block masks) */ -__sighandler_t signal(int signal, __sighandler_t signalHandler); -int sigaction(int signal, const struct sigaction* action, +__sighandler_t signal(int _signal, __sighandler_t signalHandler); +int sigaction(int _signal, const struct sigaction* action, struct sigaction* oldAction); -__sighandler_t sigset(int signal, __sighandler_t signalHandler); -int sigignore(int signal); -int siginterrupt(int signal, int flag); +__sighandler_t sigset(int _signal, __sighandler_t signalHandler); +int sigignore(int _signal); +int siginterrupt(int _signal, int flag); int sigprocmask(int how, const sigset_t* set, sigset_t* oldSet); int pthread_sigmask(int how, const sigset_t* set, sigset_t* oldSet); -int sighold(int signal); -int sigrelse(int signal); +int sighold(int _signal); +int sigrelse(int _signal); /* sending signals */ -int raise(int signal); -int kill(pid_t pid, int signal); -int killpg(pid_t processGroupID, int signal); -int sigqueue(pid_t pid, int signal, const union sigval userValue); -int pthread_kill(pthread_t thread, int signal); +int raise(int _signal); +int kill(pid_t pid, int _signal); +int killpg(pid_t processGroupID, int _signal); +int sigqueue(pid_t pid, int _signal, const union sigval userValue); +int pthread_kill(pthread_t thread, int _signal); /* querying and waiting for signals */ int sigpending(sigset_t* set); int sigsuspend(const sigset_t* mask); -int sigpause(int signal); +int sigpause(int _signal); int sigwait(const sigset_t* set, int* _signal); int sigwaitinfo(const sigset_t* set, siginfo_t* info); int sigtimedwait(const sigset_t* set, siginfo_t* info, @@ -259,13 +259,13 @@ int sigaltstack(const stack_t* stack, stack_t* oldStack); /* signal set (sigset_t) manipulation */ int sigemptyset(sigset_t* set); int sigfillset(sigset_t* set); -int sigaddset(sigset_t* set, int signal); -int sigdelset(sigset_t* set, int signal); -int sigismember(const sigset_t* set, int signal); +int sigaddset(sigset_t* set, int _signal); +int sigdelset(sigset_t* set, int _signal); +int sigismember(const sigset_t* set, int _signal); /* printing signal names */ void psiginfo(const siginfo_t* info, const char* message); -void psignal(int signal, const char* message); +void psignal(int _signal, const char* message); /* implementation private */ int __signal_get_sigrtmin(); diff --git a/headers/posix/time.h b/headers/posix/time.h index 856c6d5c8b..08abda28f2 100644 --- a/headers/posix/time.h +++ b/headers/posix/time.h @@ -90,10 +90,10 @@ extern char *strptime(const char *buf, const char *format, struct tm *tm); /* clock functions */ int clock_getres(clockid_t clockID, struct timespec* resolution); -int clock_gettime(clockid_t clockID, struct timespec* time); -int clock_settime(clockid_t clockID, const struct timespec* time); +int clock_gettime(clockid_t clockID, struct timespec* _time); +int clock_settime(clockid_t clockID, const struct timespec* _time); int clock_nanosleep(clockid_t clockID, int flags, - const struct timespec* time, struct timespec* remainingTime); + const struct timespec* _time, struct timespec* remainingTime); int clock_getcpuclockid(pid_t pid, clockid_t* _clockID); /* timer functions */ From a40e8645e2c20a5ea17af2264ca3150542b81a9b Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 22:05:24 +0000 Subject: [PATCH 584/702] Switch the default value of the "crlf" option in telnet. This means lines are ended with \r\n instead of \r\0. Both are accepted in most telnet servers, as there is some unclear wording in the telnet RFC. However, using \r\n allows to use telnet for other stuff, like connecting to an SMTP server. Debian Linux telnet client also uses that by default (likely other Linuces use the same). Fixes #2663. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43049 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/network/telnet/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bin/network/telnet/main.c b/src/bin/network/telnet/main.c index 0395772b4f..628ab50c5c 100644 --- a/src/bin/network/telnet/main.c +++ b/src/bin/network/telnet/main.c @@ -156,6 +156,9 @@ main(int argc, char *argv[]) #else #define IPSECOPT #endif + + crlf = 1; + while ((ch = getopt(argc, argv, "468EKLNS:X:acde:fFk:l:n:rs:uxy" IPSECOPT)) != -1) #undef IPSECOPT From 85feb4de3fff9f5d960f63abe6d707ac32ee895e Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 22:39:58 +0000 Subject: [PATCH 585/702] Wrong fd count given to select. Fixes #7557. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43050 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp b/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp index c44dea2b8b..f3341aefa7 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp @@ -964,7 +964,7 @@ SMTPProtocol::ReceiveResponse(BString &out) result = 1; else #endif - result = select(32, &fds, NULL, NULL, &tv); + result = select(1, &fds, NULL, NULL, &tv); if (result < 0) return errno; From 74ddcac51f2253bd45aaf3392882bf1538fac710 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 31 Oct 2011 22:52:18 +0000 Subject: [PATCH 586/702] Sorry, fix #7557 for real. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43051 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp b/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp index f3341aefa7..c13b8048e2 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp @@ -964,7 +964,7 @@ SMTPProtocol::ReceiveResponse(BString &out) result = 1; else #endif - result = select(1, &fds, NULL, NULL, &tv); + result = select(1 + fSocket, &fds, NULL, NULL, &tv); if (result < 0) return errno; From b47bd3cf51bd9a3c0d1b779369635582d42871a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 31 Oct 2011 23:33:22 +0000 Subject: [PATCH 587/702] * Work in progress of an IMAP response parser that will replace weak and error prone parsing method that is currently utilized by the IMAP module. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43052 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../imap/imap_lib/Response.cpp | 413 ++++++++++++++++++ .../imap/imap_lib/Response.h | 150 +++++++ 2 files changed, 563 insertions(+) create mode 100644 src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.cpp create mode 100644 src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.h diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.cpp new file mode 100644 index 0000000000..0454883c8d --- /dev/null +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.cpp @@ -0,0 +1,413 @@ +/* + * Copyright 2011, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include "Response.h" + + +namespace IMAP { + + +ArgumentList::ArgumentList() + : + fArguments(5, true) +{ +} + + +ArgumentList::~ArgumentList() +{ +} + + +BString +ArgumentList::StringAt(int32 index) const +{ + if (index >= 0 && index < fArguments.CountItems()) { + if (StringArgument* argument = dynamic_cast( + fArguments.ItemAt(index))) + return argument->String(); + } + return ""; +} + + +bool +ArgumentList::IsStringAt(int32 index) const +{ + if (index >= 0 && index < fArguments.CountItems()) { + if (dynamic_cast(fArguments.ItemAt(index)) != NULL) + return true; + } + return false; +} + + +bool +ArgumentList::EqualsAt(int32 index, const char* string) const +{ + return StringAt(index).ICompare(string); +} + + +const ArgumentList& +ArgumentList::ListAt(int32 index) const +{ + if (index >= 0 && index < fArguments.CountItems()) { + if (ListArgument* argument = dynamic_cast( + fArguments.ItemAt(index))) + return argument->List(); + } + + static ArgumentList empty(0, true); + return empty; +} + + +bool +ArgumentList::IsListAt(int32 index) const +{ + if (index >= 0 && index < fArguments.CountItems()) { + if (ListArgument* argument = dynamic_cast( + fArguments.ItemAt(index))) + return true; + } + return false; +} + + +bool +ArgumentList::IsListAt(int32 index, char kind) const +{ + if (index >= 0 && index < fArguments.CountItems()) { + if (ListArgument* argument = dynamic_cast( + fArguments.ItemAt(index))) + return argument->Kind() == kind; + } + return false; +} + + +int32 +ArgumentList::IntegerAt(int32 index) const +{ + return atoi(StringAt(index).String()); +} + + +bool +ArgumentList::IsIntegerAt(int32 index) const +{ + BString string = StringAt(index); + for (int32 i = 0; i < string.Length(); i++) { + if (!isdigit(string.ByteAt(i))) + return false; + } + return string.Length() > 0; +} + + +// #pragma mark - + + +Argument::Argument() +{ +} + + +Argument::~Argument() +{ +} + + +/*static*/ BString +Argument::ToString(const ArgumentList& arguments) +{ + BString string; + + for (int32 i = 0; i < arguments.CountItems(); i++) { + if (i > 0) + string += ", "; + string += arguments.ItemAt(i)->ToString(); + } + return string; +} + + +bool +Argument::Contains(const ArgumentList& arguments, const char* string) const +{ + for (int32 i = 0; i < arguments.CountItems(); i++) { + if (StringArgument* argument = dynamic_cast( + arguments.ItemAt(i))) { + if (argument->String().ICompare(string)) + return true; + } + } + return false; +} + + +// #pragma mark - + + +ListArgument::ListArgument() + : + fList(5, true) +{ +} + + +BString +ListArgument::ToString() const +{ + BString string("("); + string += Argument::ToString(response.Arguments()); + string += ")"; + + return string; +} + + +// #pragma mark - + + +StringArgument::StringArgument(const BString& string) + : + fString(string) +{ +} + + +BString +StringArgument::ToString() const +{ + return fString; +} + + +// #pragma mark - + + +ParseException::ParseException() + : + fMessage(NULL) +{ +} + + +ParseException::ParseException(const char* message) + : + fMessage(message) +{ +} + + +ParseException::~ParseException() +{ +} + + +// #pragma mark - + + +ExpectedParseException::ExpectedParseException(char expected, char instead) +{ + snprintf(fBuffer, sizeof(fBuffer), "Expected \"%c\", but got \"%c\"!", + expected, instead); + fMessage = fBuffer; +} + + +// #pragma mark - + + +Response::Response() + : + fTag(0), + fArguments(5, true), + fContinued(false) +{ +} + + +Response::~Response() +{ +} + + +void +Response::SetTo(const char* line) throw(ParseException) +{ + MakeEmpty(); + fTag = 0; + fContinued = false; + + if (line[0] == '*') { + // Untagged response + Consume(line, '*'); + Consume(line, ' '); + } else if (line[0] == '+') { + // Continuation + Consume(line, '+'); + fContinued = true; + } else { + // Tagged response + Consume(line, 'A'); + fTag = strtoul(line, (char**)&line, 10); + if (line == NULL) + ParseException("Invalid tag!"); + Consume(line, ' '); + } + + char c = ParseLine(this, line); + if (c != '\0') + throw ExpectedParseException('\0', c); +} + + +bool +Response::IsCommand(const char* command) const +{ + return IsStringAt(0, command); +} + + +char +Response::ParseLine(ArgumentList& arguments, const char*& line) +{ + while (line[0] != '\0') { + char c = line[0]; + switch (c) { + case '(': + ParseList(arguments, line, '(', ')'); + break; + case '[': + ParseList(arguments, line, '[', ']'); + break; + case ')': + case ']': + Consume(line, c); + return c; + case '"': + ParseQuoted(arguments, line); + break; + case '{': + ParseLiteral(arguments, line); + break; + + case ' ': + case '\t': + // whitespace + Consume(line, c); + break; + + case '\r': + Consume(line, '\r'); + Consume(line, '\n'); + return '\0'; + case '\n': + Consume(line, '\n'); + return '\0'; + + default: + ParseString(arguments, line); + break; + } + } + + return '\0'; +} + + +void +Response::Consume(const char*& line, char c) +{ + if (line[0] != c) + throw ExpectedParseException(c, line[0]); + + line++; +} + + +void +Response::ParseList(ArgumentList& arguments, const char*& line, char start, + char end) +{ + Consume(line, start); + + ListArgument* argument = new ListArgument(start); + arguments.AddItem(argument); + + char c = ParseLine(argument->List(), line); + if (c != end) + throw ExpectedParseException(end, c); +} + + +void +Response::ParseQuoted(ArgumentList& arguments, const char*& line) +{ + Consume(line, '"'); + + BString string; + char* output = string.LockBuffer(strlen(line)); + int32 index = 0; + + while (line[0] != '\0') { + char c = line[0]; + if (c == '\\') { + line++; + if (line[0] == '\0') + break; + } else if (c == '"') { + line++; + output[index] = '\0'; + string.UnlockBuffer(index); + arguments.AddItem(new StringArgument(string)); + return; + } + + output[index++] = c; + line++; + } + + throw ParseException("Unexpected end of qouted string!"); +} + + +void +Response::ParseLiteral(ArgumentList& arguments, const char*& line) +{ + // TODO! + throw ParseException("Literals are not yet supported!"); +} + + +void +Response::ParseString(ArgumentList& arguments, const char*& line) +{ + arguments.AddItem(new StringArgument(ExtractString(line))); +} + + +BString +Response::ExtractString(const char*& line) +{ + const char* start = line; + + while (line[0] != '\0') { + char c = line[0]; + if (c <= ' ' || strchr("()[]{}\"", c) != NULL) + return BString(start, line - start); + + line++; + } + + throw ParseException("Unexpected end of string"); +} + + +} // namespace IMAP diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.h new file mode 100644 index 0000000000..f6201970c7 --- /dev/null +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.h @@ -0,0 +1,150 @@ +/* + * Copyright 2011, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef RESPONSE_H +#define RESPONSE_H + + +#include + +#include +#include + + +namespace IMAP { + + +class Argument; + + +class ArgumentList { +public: + ArgumentList(); + ~ArgumentList(); + + size_t CountItems() + { return (size_t)fArguments.CountItems(); } + Argument& ItemAt(size_t index) const + { return *fArguments.ItemAt(index); } + void MakeEmpty() + { fArguments.MakeEmpty(); } + bool AddItem(Argument* argument) + { return fArguments.AddItem(argument); } + Argument* RemoveItem(size_t index) + { return fArguments.RemoveItemAt(index); } + + BString ToString() const; + bool Contains(const char* string) const; + + BString StringAt(int32 index) const; + bool IsStringAt(int32 index) const; + bool EqualsAt(int32 index, + const char* string) const; + const ArgumentList& ListAt(int32 index) const; + bool IsListAt(int32 index) const; + bool IsListAt(int32 index, char kind) const; + int32 IntegerAt(int32 index) const; + bool IsIntegerAt(int32 index) const; + +private: + BObjectList fArguments; +}; + + +class Argument { +public: + Argument(); + virtual ~Argument(); + + virtual BString ToString() const = 0; +}; + + +class ListArgument : public Argument { +public: + ListArgument(char kind); + + ArgumentList& List() { return fList; } + char Kind() { return fKind; } + + virtual BString ToString() const; + +private: + ArgumentList fList; + char fKind; +}; + + +class StringArgument : public Argument { +public: + StringArgument(const BString& string); + + const BString& String() { return fString; } + + virtual BString ToString() const; + +private: + BString fString; +}; + + +class ParseException : public std::exception { +public: + ParseException(); + ParseException(const char* message); + virtual ~ParseException(); + + const char* Message() const { return fMessage; } + +protected: + const char* fMessage; +}; + + +class ExpectedParseException : ParseException { +public: + ExpectedParseException(char expected, + char instead); + +protected: + char fBuffer[64]; +}; + + +class Response : public ArgumentList { +public: + Response(); + ~Response(); + + void SetTo(const char* line) throw(ParseException); + + bool IsUntagged() const { return fTag == 0; } + int32 Tag() const { return fTag; } + bool IsCommand(const char* command) const; + bool IsContinued() const { return fContinued; } + +protected: + char ParseLine(ArgumentList& arguments, + const char*& line); + void Consume(const char*& line, char c); + void ParseList(ArgumentList& arguments, + const char*& line, char start, char end); + void ParseQuoted(ArgumentList& arguments, + const char*& line); + void ParseLiteral(ArgumentList& arguments, + const char*& line); + void ParseString(ArgumentList& arguments, + const char*& line); + BString ExtractString(const char*& line); + +protected: + int32 fTag; + bool fContinued; +}; + + +} // namespace IMAP + + +#endif // RESPONSE_H From 701d92850ee31c77a78041d3563662c45e688574 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 1 Nov 2011 08:13:02 +0000 Subject: [PATCH 588/702] Mail daemon now uses standard notification windows. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43053 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/mail/Jamfile | 2 - src/servers/mail/MailDaemon.cpp | 27 +- src/servers/mail/MailDaemon.h | 5 +- src/servers/mail/Notifier.cpp | 64 ++-- src/servers/mail/Notifier.h | 12 +- src/servers/mail/StatusWindow.cpp | 592 ------------------------------ src/servers/mail/StatusWindow.h | 90 ----- 7 files changed, 65 insertions(+), 727 deletions(-) delete mode 100644 src/servers/mail/StatusWindow.cpp delete mode 100644 src/servers/mail/StatusWindow.h diff --git a/src/servers/mail/Jamfile b/src/servers/mail/Jamfile index 1492589d48..26cabb4928 100644 --- a/src/servers/mail/Jamfile +++ b/src/servers/mail/Jamfile @@ -19,7 +19,6 @@ Server mail_daemon : MailDaemon.cpp main.cpp Notifier.cpp - StatusWindow.cpp : be libmail.so tracker $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSTDC++) $(TARGET_NETWORK_LIBS) ; @@ -37,5 +36,4 @@ DoCatalogs mail_daemon : DeskbarView.cpp MailDaemon.cpp Notifier.cpp - StatusWindow.cpp ; diff --git a/src/servers/mail/MailDaemon.cpp b/src/servers/mail/MailDaemon.cpp index d1d3537415..0505e790b0 100644 --- a/src/servers/mail/MailDaemon.cpp +++ b/src/servers/mail/MailDaemon.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -111,8 +112,6 @@ MailDaemonApp::MailDaemonApp() { fErrorLogWindow = new ErrorLogWindow(BRect(200, 200, 500, 250), B_TRANSLATE("Mail daemon status log"), B_TITLED_WINDOW); - fMailStatusWindow = new MailStatusWindow(BRect(40, 400, 360, 400), - B_TRANSLATE("Mail Status"), fSettingsFile.ShowStatusWindow()); // install MimeTypes, attributes, indices, and the // system beep add startup MakeMimeTypes(); @@ -129,6 +128,7 @@ MailDaemonApp::~MailDaemonApp() delete fQueries.ItemAt(i); delete fLEDAnimation; + delete fNotification; AccountMap::const_iterator it = fAccounts.begin(); for (; it != fAccounts.end(); it++) @@ -190,7 +190,10 @@ MailDaemonApp::ReadyToRun() string = B_TRANSLATE("No new messages"); fCentralBeep = false; - fMailStatusWindow->SetDefaultMessage(string); + + fNotification = new BNotification(B_INFORMATION_NOTIFICATION); + fNotification->SetApplication("Mail daemon"); + fNotification->SetTitle(string); fLEDAnimation = new LEDAnimation; SetPulseRate(1000000); @@ -200,7 +203,7 @@ MailDaemonApp::ReadyToRun() void MailDaemonApp::RefsReceived(BMessage* message) { - fMailStatusWindow->Activate(true); + be_roster->Notify(*fNotification, 3); entry_ref ref; for (int32 i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) { @@ -250,7 +253,6 @@ MailDaemonApp::MessageReceived(BMessage* msg) case kMsgSettingsUpdated: fSettingsFile.Reload(); _UpdateAutoCheck(fSettingsFile.AutoCheckInterval()); - fMailStatusWindow->SetShowCriterion(fSettingsFile.ShowStatusWindow()); break; case kMsgAccountsChanged: @@ -258,12 +260,12 @@ MailDaemonApp::MessageReceived(BMessage* msg) break; case kMsgSetStatusWindowMode: // when to show the status window - { + {/* int32 mode; if (msg->FindInt32("ShowStatusWindow", &mode) == B_OK) fMailStatusWindow->SetShowCriterion(mode); break; - } + */} case kMsgMarkMessageAsRead: { @@ -284,11 +286,6 @@ MailDaemonApp::MessageReceived(BMessage* msg) RefsReceived(msg); break; - case 'lkch': // status window look changed - case 'wsch': // workspace changed - fMailStatusWindow->PostMessage(msg); - break; - case 'stwg': // Status window gone { BMessage reply('mnuc'); @@ -386,7 +383,7 @@ MailDaemonApp::MessageReceived(BMessage* msg) else string << B_TRANSLATE("No new messages."); - fMailStatusWindow->SetDefaultMessage(string.String()); + fNotification->SetTitle(string.String()); break; } @@ -648,7 +645,7 @@ MailDaemonApp::_InitAccount(BMailAccountSettings& settings) } if (account.inboundProtocol) { DefaultNotifier* notifier = new DefaultNotifier(settings.Name(), true, - fErrorLogWindow, fMailStatusWindow); + fErrorLogWindow); account.inboundProtocol->SetMailNotifier(notifier); account.inboundThread = new InboundProtocolThread( @@ -665,7 +662,7 @@ MailDaemonApp::_InitAccount(BMailAccountSettings& settings) } if (account.outboundProtocol) { DefaultNotifier* notifier = new DefaultNotifier(settings.Name(), false, - fErrorLogWindow, fMailStatusWindow); + fErrorLogWindow); account.outboundProtocol->SetMailNotifier(notifier); account.outboundThread = new OutboundProtocolThread( diff --git a/src/servers/mail/MailDaemon.h b/src/servers/mail/MailDaemon.h index 212c1f7c01..016f3793ef 100644 --- a/src/servers/mail/MailDaemon.h +++ b/src/servers/mail/MailDaemon.h @@ -24,6 +24,9 @@ #include "Notifier.h" +class BNotification; + + struct account_protocols { account_protocols() { inboundImage = -1; @@ -108,7 +111,7 @@ private: AccountMap fAccounts; ErrorLogWindow* fErrorLogWindow; - MailStatusWindow* fMailStatusWindow; + BNotification* fNotification; }; diff --git a/src/servers/mail/Notifier.cpp b/src/servers/mail/Notifier.cpp index e7a288a10d..a5f59da2d9 100644 --- a/src/servers/mail/Notifier.cpp +++ b/src/servers/mail/Notifier.cpp @@ -5,6 +5,7 @@ */ #include +#include #include "Notifier.h" @@ -14,12 +15,16 @@ DefaultNotifier::DefaultNotifier(const char* accountName, bool inbound, - ErrorLogWindow* errorWindow, MailStatusWindow* statusWindow) + ErrorLogWindow* errorWindow) : fAccountName(accountName), fIsInbound(inbound), fErrorWindow(errorWindow), - fStatusWindow(statusWindow) + fNotification(B_PROGRESS_NOTIFICATION), + fTotalItems(0), + fItemsDone(0), + fTotalSize(0), + fSizeDone(0) { BString desc; if (fIsInbound == true) @@ -28,27 +33,23 @@ DefaultNotifier::DefaultNotifier(const char* accountName, bool inbound, desc << B_TRANSLATE("Sending mail for %name"); desc.ReplaceFirst("%name", fAccountName); - fStatusWindow->Lock(); - fStatusView = fStatusWindow->NewStatusView(desc, fIsInbound != false); - fStatusWindow->Unlock(); + BString identifier; + identifier << (int)this; + // This should get us an unique value for each notifier running + fNotification.SetMessageID(identifier); + fNotification.SetApplication("Mail daemon"); } DefaultNotifier::~DefaultNotifier() { - fStatusWindow->Lock(); - if (fStatusView->Window()) - fStatusWindow->RemoveView(fStatusView); - delete fStatusView; - fStatusWindow->Unlock(); } MailNotifier* DefaultNotifier::Clone() { - return new DefaultNotifier(fAccountName, fIsInbound, fErrorWindow, - fStatusWindow); + return new DefaultNotifier(fAccountName, fIsInbound, fErrorWindow); } @@ -69,38 +70,55 @@ DefaultNotifier::ShowMessage(const char* message) void DefaultNotifier::SetTotalItems(int32 items) { - fStatusView->SetTotalItems(items); + fTotalItems = items; + BString progress; + progress << fItemsDone << "/" << fTotalItems; + fNotification.SetContent(progress); } void DefaultNotifier::SetTotalItemsSize(int32 size) { - fStatusView->SetMaximum(size); + fTotalSize = size; + fNotification.SetProgress(fSizeDone / (float)fTotalSize); } void DefaultNotifier::ReportProgress(int bytes, int messages, const char* message) { - if (bytes != 0) - fStatusView->AddProgress(bytes); + fSizeDone += bytes; + if (fTotalSize > 0) + fNotification.SetProgress(fSizeDone / (float)fTotalSize); + else { + // Likely we should set it as an INFORMATION_NOTIFICATION in that case, + // but this can't be done after object creation... + fNotification.SetProgress(0); + } - for (int i = 0; i < messages; i++) - fStatusView->AddItem(); + fItemsDone += messages; + BString progress; + if (fTotalItems > 0) + progress << fItemsDone << "/" << fTotalItems; + + fNotification.SetContent(progress); if (message != NULL) - fStatusView->SetMessage(message); + fNotification.SetTitle(message); - if (fStatusView->ItemsNow() == fStatusView->CountTotalItems()) - fStatusView->Reset(); + int timeout = 0; // Default timeout + if (fItemsDone == fTotalItems && fTotalItems != 0) + timeout = 1; // We're done, make the window go away faster + be_roster->Notify(fNotification, timeout); } void DefaultNotifier::ResetProgress(const char* message) { - fStatusView->Reset(); + fNotification.SetProgress(0); if (message != NULL) - fStatusView->SetMessage(message); + fNotification.SetContent(message); + be_roster->Notify(fNotification, 0); } diff --git a/src/servers/mail/Notifier.h b/src/servers/mail/Notifier.h index edd9043e60..72d077c620 100644 --- a/src/servers/mail/Notifier.h +++ b/src/servers/mail/Notifier.h @@ -7,6 +7,7 @@ #define NOTIFIER_H +#include #include #include "MailProtocol.h" @@ -18,8 +19,7 @@ class DefaultNotifier : public MailNotifier { public: DefaultNotifier(const char* accountName, - bool inbound, ErrorLogWindow* errorWindow, - MailStatusWindow* statusWindow); + bool inbound, ErrorLogWindow* errorWindow); ~DefaultNotifier(); MailNotifier* Clone(); @@ -37,8 +37,12 @@ private: BString fAccountName; bool fIsInbound; ErrorLogWindow* fErrorWindow; - MailStatusWindow* fStatusWindow; - MailStatusView* fStatusView; + BNotification fNotification; + + int fTotalItems; + int fItemsDone; + int fTotalSize; + int fSizeDone; }; #endif //NOTIFIER_H diff --git a/src/servers/mail/StatusWindow.cpp b/src/servers/mail/StatusWindow.cpp deleted file mode 100644 index e21215c8f4..0000000000 --- a/src/servers/mail/StatusWindow.cpp +++ /dev/null @@ -1,592 +0,0 @@ -/* - * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. - * Copyright 2004-2011, Haiku Inc. All rights reserved. - * - * Distributed under the terms of the MIT License. - */ - - -//! The status window while fetching/sending mails - - -#include "StatusWindow.h" - -#include "MailSettings.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -#undef B_TRANSLATE_CONTEXT -#define B_TRANSLATE_CONTEXT "StatusWindow" - - -static BLocker sLock; - - -MailStatusWindow::MailStatusWindow(BRect rect, const char *name, - uint32 showMode) - : - BWindow(rect, name, B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, - B_NOT_CLOSABLE | B_NO_WORKSPACE_ACTIVATION | B_NOT_V_RESIZABLE - | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AVOID_FRONT), - fShowMode(showMode), - fWindowMoved(0L) -{ - BRect frame(Bounds()); - frame.InsetBy(90.0 + 5.0, 5.0); - - fCheckNowButton = new BButton(frame, "check_mail", - B_TRANSLATE("Check mail now"), - new BMessage('mbth'), B_FOLLOW_LEFT_RIGHT, - B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_NAVIGABLE); - fCheckNowButton->ResizeToPreferred(); - frame = fCheckNowButton->Frame(); - - fCheckNowButton->SetTarget(be_app_messenger); - - frame.OffsetBy(0.0, frame.Height()); - frame.InsetBy(-90.0, 0.0); - - fMessageView = new BStringView(frame, "message_view", "", - B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); - fMessageView->SetAlignment(B_ALIGN_CENTER); - fMessageView->SetText(B_TRANSLATE("No new messages.")); - float framewidth = frame.Width(); - fMessageView->ResizeToPreferred(); - fMessageView->ResizeTo(framewidth, fMessageView->Bounds().Height()); - frame = fMessageView->Frame(); - - frame.InsetBy(-5.0, -5.0); - frame.top = 0.0; - - fDefaultView = new BView(frame, "default_view", B_FOLLOW_LEFT_RIGHT, - B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP); - fDefaultView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - - fDefaultView->AddChild(fCheckNowButton); - fDefaultView->AddChild(fMessageView); - - fMinWidth = fDefaultView->Bounds().Width(); - fMinHeight = fDefaultView->Bounds().Height(); - ResizeTo(fMinWidth, fMinHeight); - SetSizeLimits(fMinWidth, 2.0 * fMinWidth, fMinHeight, fMinHeight); - - BMailSettings general; - if (general.InitCheck() == B_OK) { - // set on-screen location - - frame = general.StatusWindowFrame(); - BScreen screen(this); - if (screen.Frame().Contains(frame)) { - MoveTo(frame.LeftTop()); - if (frame.Width() >= fMinWidth && frame.Height() >= fMinHeight) { - float x_off_set = frame.Width() - fMinWidth; - float y_off_set = 0; //---The height is constant - - ResizeBy(x_off_set, y_off_set); - fDefaultView->ResizeBy(x_off_set, y_off_set); - fCheckNowButton->ResizeBy(x_off_set, y_off_set); - fMessageView->ResizeBy(x_off_set, y_off_set); - } - } - // set workspace for window - - uint32 workspace = general.StatusWindowWorkspaces(); - int32 workspacesCount = count_workspaces(); - uint32 workspacesMask = (workspacesCount > 31 ? 0 : 1L << workspacesCount) - 1; - if ((workspacesMask & workspace) && (workspace != Workspaces())) - SetWorkspaces(workspace); - - // set look - - SetBorderStyle(general.StatusWindowLook()); - } - AddChild(fDefaultView); - - fFrame = Frame(); - - BPath path; - status_t status = BMailAccounts::AccountsPath(path); - if (status == B_OK) { - BDirectory chainDirectory(path.Path()); - if (chainDirectory.GetNodeRef(&fChainDirectory) == B_OK) { - // Watch this directory for changes - watch_node(&fChainDirectory, B_WATCH_DIRECTORY, this); - _CheckChains(); - } - } - - if (fShowMode != B_MAIL_SHOW_STATUS_WINDOW_ALWAYS) - Hide(); - - Show(); -} - - -MailStatusWindow::~MailStatusWindow() -{ - // remove all status_views, so we don't accidentally delete them - while (MailStatusView *status_view = (MailStatusView *)fStatusViews.RemoveItem(0L)) - RemoveView(status_view); - - BMailSettings general; - if (general.InitCheck() == B_OK) { - // save the current status window properties - general.SetStatusWindowFrame(Frame()); - general.SetStatusWindowWorkspaces((int32)Workspaces()); - general.Save(); - } - - stop_watching(this); -} - - -//! Activate the "Check Now" button only if there are inbound accounts -void -MailStatusWindow::_CheckChains() -{ - bool hasInbound = false; - BMailAccounts accounts; - for (int32 i = 0; i < accounts.CountAccounts(); i++) { - if (accounts.AccountAt(i)->HasInbound()) { - hasInbound = true; - break; - } - } - - fCheckNowButton->SetEnabled(hasInbound); -} - - -void -MailStatusWindow::FrameMoved(BPoint /*origin*/) -{ - if (fLastWorkspace == current_workspace()) - fFrame = Frame(); -} - - -void -MailStatusWindow::WorkspaceActivated(int32 workspace, bool active) -{ - if (!active) - return; - - MoveTo(fFrame.LeftTop()); - fLastWorkspace = workspace; - - // make the window visible if the screen's frame doesn't contain it - BScreen screen; - if (screen.Frame().bottom < fFrame.top) - MoveTo(fFrame.left - 1, screen.Frame().bottom - fFrame.Height() - 4); - if (screen.Frame().right < fFrame.left) - MoveTo(fFrame.left - 1, screen.Frame().bottom - fFrame.Height() - 4); -} - - -void -MailStatusWindow::MessageReceived(BMessage *msg) -{ - switch (msg->what) { - case 'lkch': - { - int32 look; - if (msg->FindInt32("StatusWindowLook", &look) == B_OK) - SetBorderStyle(look); - break; - } - case 'wsch': - { - uint32 workspaces; - if (msg->FindInt32("StatusWindowWorkSpace", (int32 *)&workspaces) != B_OK) - break; - if (Workspaces() != B_ALL_WORKSPACES && workspaces != B_ALL_WORKSPACES) - break; - if (workspaces != Workspaces()) - SetWorkspaces(workspaces); - break; - } - case 'DATA': - msg->what = B_REFS_RECEIVED; - be_roster->Launch(B_MAIL_TYPE, msg); - break; - - case B_NODE_MONITOR: - _CheckChains(); - break; - - default: - BWindow::MessageReceived(msg); - } -} - - -void -MailStatusWindow::SetDefaultMessage(const BString &message) -{ - if (Lock()) { - fMessageView->SetText(message.String()); - Unlock(); - } -} - - -MailStatusView * -MailStatusWindow::NewStatusView(const char *description, bool upstream) -{ - if (!Lock()) - return NULL; - - BRect rect = Bounds(); - rect.top = fStatusViews.CountItems() * (fMinHeight + 1); - rect.bottom = rect.top + fMinHeight; - MailStatusView *status = new MailStatusView(rect, description, upstream); - status->window = this; - - Unlock(); - return status; -} - - -void -MailStatusWindow::ActuallyAddStatusView(MailStatusView *status) -{ - if (!Lock()) - return; - - sLock.Lock(); - - BRect rect = Bounds(); - rect.top = fStatusViews.CountItems() * (fMinHeight + 1); - rect.bottom = rect.top + fMinHeight; - - status->MoveTo(rect.LeftTop()); - status->ResizeTo(rect.Width(), rect.Height()); - - fStatusViews.AddItem((void *)status); - - status->Hide(); - AddChild(status); - - if (CountVisibleItems() == 1) - fDefaultView->Hide(); - - status->Show(); - SetSizeLimits(10.0, 2000.0, 10.0, 2000.0); - - // if the window doesn't fit on screen anymore, move it - BScreen screen; - if (screen.Frame().bottom < Frame().top + rect.bottom) { - MoveBy(0, -fMinHeight - 1); - fWindowMoved++; - } - - ResizeTo(rect.Width(), rect.bottom); - - if (fShowMode != B_MAIL_SHOW_STATUS_WINDOW_ALWAYS - && fShowMode != B_MAIL_SHOW_STATUS_WINDOW_NEVER - && CountVisibleItems() == 1) - { - SetFlags(Flags() | B_AVOID_FOCUS); - Show(); - SetFlags(Flags() ^ B_AVOID_FOCUS); - } - sLock.Unlock(); - Unlock(); -} - - -void -MailStatusWindow::RemoveView(MailStatusView *view) -{ - if (!view || !Lock()) - return; - - sLock.Lock(); - // ToDo: although there already is the outer lock, this seems - // to help... (maybe we should investigate this further...) - - int32 i = fStatusViews.IndexOf(view); - if (i < 0) { - Unlock(); - return; - } - - fStatusViews.RemoveItem((void *)view); - if (RemoveChild(view)) { - while ((view = (MailStatusView *)fStatusViews.ItemAt(i++)) != NULL) - view->MoveBy(0, -fMinHeight - 1); - - // the view will be deleted in the ChainRunner - view = NULL; - } - - if (fWindowMoved > 0) { - fWindowMoved--; - MoveBy(0, fMinHeight + 1); - } - - if (CountVisibleItems() == 0) { - if (fShowMode != B_MAIL_SHOW_STATUS_WINDOW_NEVER - && fShowMode != B_MAIL_SHOW_STATUS_WINDOW_ALWAYS) { - while (!IsHidden()) - Hide(); - } - - fDefaultView->Show(); - - SetSizeLimits(fMinWidth, 2.0 * fMinWidth, fMinHeight, fMinHeight); - ResizeTo(fDefaultView->Frame().Width(), fDefaultView->Frame().Height()); - - be_app->PostMessage('stwg'); - // notify that the status window is gone - } - else - ResizeTo(Bounds().Width(), fStatusViews.CountItems() * fMinHeight); - - sLock.Unlock(); - Unlock(); -} - - -int32 -MailStatusWindow::CountVisibleItems() -{ - if (fShowMode != B_MAIL_SHOW_STATUS_WINDOW_WHEN_SENDING) - return fStatusViews.CountItems(); - - int32 count = 0; - for (int32 i = fStatusViews.CountItems(); i-- > 0;) { - MailStatusView *view = (MailStatusView *)fStatusViews.ItemAt(i); - if (view->is_upstream) - count++; - } - return count; -} - - -bool -MailStatusWindow::HasItems(void) -{ - return CountVisibleItems() > 0; -} - - -void -MailStatusWindow::SetShowCriterion(uint32 when) -{ - if (!Lock()) - return; - - fShowMode = when; - if (fShowMode == B_MAIL_SHOW_STATUS_WINDOW_ALWAYS - || (fShowMode != B_MAIL_SHOW_STATUS_WINDOW_NEVER && HasItems())) - { - while (IsHidden()) - Show(); - } else { - while (!IsHidden()) - Hide(); - } - Unlock(); -} - - -void -MailStatusWindow::SetBorderStyle(int32 look) -{ - switch (look) { - case B_MAIL_STATUS_LOOK_TITLED: - SetLook(B_TITLED_WINDOW_LOOK); - break; - case B_MAIL_STATUS_LOOK_FLOATING: - SetLook(B_FLOATING_WINDOW_LOOK); - break; - case B_MAIL_STATUS_LOOK_THIN_BORDER: - SetLook(B_BORDERED_WINDOW_LOOK); - break; - case B_MAIL_STATUS_LOOK_NO_BORDER: - SetLook(B_NO_BORDER_WINDOW_LOOK); - break; - - case B_MAIL_STATUS_LOOK_NORMAL_BORDER: - default: - SetLook(B_MODAL_WINDOW_LOOK); - } -} - - -// #pragma mark - -//------------------------------------------------ -// -// MailStatusView -// -//------------------------------------------------ - - -MailStatusView::MailStatusView(BRect rect, const char *description,bool upstream) - : BBox(rect, description, B_FOLLOW_LEFT_RIGHT, - B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, - B_PLAIN_BORDER) -{ - status = new BStatusBar(BRect(5, 5, Bounds().right - 5, Bounds().bottom - 5), - "status_bar", description, ""); - status->SetResizingMode(B_FOLLOW_ALL_SIDES); - status->SetBarHeight(12); - - if (!upstream) { - const rgb_color downstreamColor = {48,176,48,255}; // upstream was: {255,100,50,255} - status->SetBarColor(downstreamColor); - } - AddChild(status); - - items_now = 0; - total_items = 0; - pre_text[0] = 0; - is_upstream = upstream; - - by_bytes = false; -} - - -MailStatusView::~MailStatusView() -{ -} - - -void -MailStatusView::AddProgress(int32 how_much) -{ - AddSelfToWindow(); - - if (LockLooper()) { - if (status->CurrentValue() == 0) - strcpy(pre_text,status->TrailingText()); - char final[80]; - if (by_bytes) { - sprintf(final, B_TRANSLATE("%.1f / %.1f kb (%d / %d messages)"), - float(float(status->CurrentValue() + how_much) / 1024), - float(float(status->MaxValue()) / 1024),(int)items_now+1, - (int)total_items); - status->Update(how_much,NULL,final); - } else { - sprintf(final, B_TRANSLATE("%d / %d messages"),(int)items_now, - (int)total_items); - status->Update(how_much,NULL,final); - } - UnlockLooper(); - } -} - - -void -MailStatusView::SetMessage(const char *msg) -{ - AddSelfToWindow(); - - if (LockLooper()) { - status->SetTrailingText(msg); - UnlockLooper(); - } -} - - -void -MailStatusView::Reset(bool hide) -{ - if (!LockLooper()) - return; - - char old[255]; - if ((pre_text[0] == 0) && !hide) - strcpy(pre_text, status->TrailingText()); - if (hide) - pre_text[0] = 0; - - strcpy(old,status->Label()); - status->Reset(old); - status->SetTrailingText(pre_text); - status->Draw(status->Bounds()); - pre_text[0] = 0; - total_items = 0; - items_now = 0; - - UnlockLooper(); - - if (hide && Window()) - window->RemoveView(this); -} - - -void -MailStatusView::SetMaximum(int32 max_bytes) -{ - AddSelfToWindow(); - - if (LockLooper()) { - if (max_bytes < 0) { - status->SetMaxValue(total_items); - by_bytes = false; - } else { - status->SetMaxValue(max_bytes); - by_bytes = true; - } - UnlockLooper(); - } -} - - -void -MailStatusView::SetTotalItems(int32 items) -{ - AddSelfToWindow(); - total_items = items; - if (!by_bytes) - SetMaximum(-1); -} - - -int32 -MailStatusView::CountTotalItems() -{ - return total_items; -} - - -void -MailStatusView::AddItem(void) -{ - AddSelfToWindow(); - items_now++; - - if (!by_bytes) - AddProgress(1); -} - - -void -MailStatusView::AddSelfToWindow() -{ - if (Window() != NULL) - return; - - window->ActuallyAddStatusView(this); -} - diff --git a/src/servers/mail/StatusWindow.h b/src/servers/mail/StatusWindow.h deleted file mode 100644 index 988c3f9e73..0000000000 --- a/src/servers/mail/StatusWindow.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. - * Copyright 2004-2007, Haiku Inc. All rights reserved. - * - * Distributed under the terms of the MIT License. - */ -#ifndef ZOIDBERG_STATUS_WINDOW_H -#define ZOIDBERG_STATUS_WINDOW_H - - -#include -#include -#include -#include -#include - -class BStatusBar; -class BStringView; -class MailStatusView; - -class MailStatusWindow : public BWindow { - public: - MailStatusWindow(BRect rect, const char *name, uint32 showMode); - ~MailStatusWindow(); - - virtual void FrameMoved(BPoint origin); - virtual void WorkspaceActivated(int32 workspace, bool active); - virtual void MessageReceived(BMessage *msg); - - MailStatusView *NewStatusView(const char *description, bool upstream); - void RemoveView(MailStatusView *view); - int32 CountVisibleItems(); - - bool HasItems(void); - void SetShowCriterion(uint32); - void SetDefaultMessage(const BString &message); - - private: - friend class MailStatusView; - - void _CheckChains(); - void SetBorderStyle(int32 look); - void ActuallyAddStatusView(MailStatusView *status); - - node_ref fChainDirectory; - BButton* fCheckNowButton; - BList fStatusViews; - uint32 fShowMode; - BView *fDefaultView; - BStringView *fMessageView; - float fMinWidth; - float fMinHeight; - int32 fWindowMoved; - int32 fLastWorkspace; - BRect fFrame; - - uint32 _reserved[5]; -}; - -class MailStatusView : public BBox { -public: - ~MailStatusView(); - - void AddProgress(int32 how_much); - void SetMessage(const char *msg); - void SetMaximum(int32 max_bytes); - int32 CountTotalItems(); - void SetTotalItems(int32 items); - void AddItem(void); - void Reset(bool hide = true); - int32 ItemsNow() { return items_now; } - -private: - friend class MailStatusWindow; - - MailStatusView(BRect rect,const char *description,bool upstream); - void AddSelfToWindow(); - - BStatusBar *status; - MailStatusWindow *window; - int32 items_now; - int32 total_items; - bool is_upstream; - bool by_bytes; - char pre_text[255]; - - uint32 _reserved[5]; -}; - -#endif /* ZOIDBERG_STATUS_WINDOW_H */ From e85bc472e153067a1f075a554aaf18657ed2969c Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Tue, 1 Nov 2011 08:58:16 +0000 Subject: [PATCH 589/702] Added gsed to the list of MacOSX requirments. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43054 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- ReadMe | 1 + 1 file changed, 1 insertion(+) diff --git a/ReadMe b/ReadMe index aaf5f28c31..9ddc712bc2 100644 --- a/ReadMe +++ b/ReadMe @@ -70,6 +70,7 @@ The following darwin ports need to be installed: * gettext * libiconv * gnuregex + * gsed More information about individual distributions of Linux and BSD can be found at http://haiku-os.org/guides/building/pre-reqs From 95f7cdcccb16f24e6cb05e820feb0486da9b048a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 1 Nov 2011 09:32:05 +0000 Subject: [PATCH 590/702] Fix BeOS build for comparison. This test still fails on Haiku btw... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43055 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../BApplicationTestAppQuitWhenStartedFromAnotherThread.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/kits/app/bapplication/testapps/BApplicationTestAppQuitWhenStartedFromAnotherThread.cpp b/src/tests/kits/app/bapplication/testapps/BApplicationTestAppQuitWhenStartedFromAnotherThread.cpp index eba713defb..4c3f407de6 100644 --- a/src/tests/kits/app/bapplication/testapps/BApplicationTestAppQuitWhenStartedFromAnotherThread.cpp +++ b/src/tests/kits/app/bapplication/testapps/BApplicationTestAppQuitWhenStartedFromAnotherThread.cpp @@ -1,5 +1,6 @@ #include #include +#include #include static thread_id gBAppThreadID; From c87c47960cfad10e8bff6ec921def3e8d61383c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 1 Nov 2011 09:49:05 +0000 Subject: [PATCH 591/702] Pass an existing or created transaction to CreateVolumeID(). Hopefully it's correct this time. Axel? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43056 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/Volume.cpp | 15 ++++++++------- src/add-ons/kernel/file_systems/bfs/Volume.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.cpp b/src/add-ons/kernel/file_systems/bfs/Volume.cpp index 874511268d..3e674c499c 100644 --- a/src/add-ons/kernel/file_systems/bfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Volume.cpp @@ -425,8 +425,12 @@ Volume::Mount(const char* deviceName, uint32 flags) if (!(fFlags & VOLUME_READ_ONLY)) { Attribute attr(fRootNode); - if (attr.Get("be:volume_id") == B_ENTRY_NOT_FOUND) - CreateVolumeID(); + if (attr.Get("be:volume_id") == B_ENTRY_NOT_FOUND) { + Transaction transaction(this, fRootNode->BlockNumber()); + fRootNode->WriteLockInTransaction(transaction); + CreateVolumeID(transaction); + transaction.Done(); + } } // all went fine @@ -509,7 +513,7 @@ Volume::CreateIndicesRoot(Transaction& transaction) status_t -Volume::CreateVolumeID() +Volume::CreateVolumeID(Transaction& transaction) { Attribute attr(fRootNode); status_t status; @@ -525,10 +529,7 @@ Volume::CreateVolumeID() uint64_t id; size_t length = sizeof(id); id = ((uint64_t)rand() << 32) | rand(); - Transaction transaction(this, fRootNode->BlockNumber()); - fRootNode->WriteLockInTransaction(transaction); attr.Write(transaction, cookie, 0, (uint8_t *)&id, &length, NULL); - transaction.Done(); } return status; } @@ -766,7 +767,7 @@ Volume::Initialize(int fd, const char* name, uint32 blockSize, return status; } - CreateVolumeID(); + CreateVolumeID(transaction); WriteSuperBlock(); transaction.Done(); diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.h b/src/add-ons/kernel/file_systems/bfs/Volume.h index 500a00f682..1e9b8f9737 100644 --- a/src/add-ons/kernel/file_systems/bfs/Volume.h +++ b/src/add-ons/kernel/file_systems/bfs/Volume.h @@ -92,7 +92,7 @@ public: status_t CreateIndicesRoot(Transaction& transaction); - status_t CreateVolumeID(); + status_t CreateVolumeID(Transaction& transaction); InodeList& RemovedInodes() { return fRemovedInodes; } // This list is guarded by the transaction lock From 1a5c1f9ed57fae37829befc007cd51c32205c1cd Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 1 Nov 2011 10:13:34 +0000 Subject: [PATCH 592/702] * Use const references instead of pointers for the read from/write to attribute/resource method in locale kit catalogs * Only load the embedded catalog if nothing else was found, so it can easily be overridden * Change the resource type to 'CADA' (CAtalog DAta) for embedded catalogs, and use a hash of the language code as the resource ID. This allows multiple languages to be stored in the same file and does not interfere with the user storing his own BMessages as resources. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43057 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/locale/Catalog.h | 24 ++++--- headers/private/locale/DefaultCatalog.h | 8 +-- headers/private/locale/HashMapCatalog.h | 8 +-- src/bin/locale/linkcatkeys.cpp | 4 +- src/kits/locale/Catalog.cpp | 16 ++--- src/kits/locale/DefaultCatalog.cpp | 84 +++++++++++++------------ src/tools/locale/Catalog.cpp | 8 +-- src/tools/locale/DefaultCatalog.cpp | 10 +-- src/tools/locale/linkcatkeys.cpp | 4 +- 9 files changed, 88 insertions(+), 78 deletions(-) diff --git a/headers/os/locale/Catalog.h b/headers/os/locale/Catalog.h index 11cb6368fc..ce8324dc74 100644 --- a/headers/os/locale/Catalog.h +++ b/headers/os/locale/Catalog.h @@ -305,11 +305,15 @@ public: virtual status_t SetData(uint32 id, BMessage* msg); virtual status_t ReadFromFile(const char* path = NULL); - virtual status_t ReadFromAttribute(entry_ref* appOrAddOnRef); - virtual status_t ReadFromResource(entry_ref* appOrAddOnRef); + virtual status_t ReadFromAttribute( + const entry_ref& appOrAddOnRef); + virtual status_t ReadFromResource( + const entry_ref& appOrAddOnRef); virtual status_t WriteToFile(const char* path = NULL); - virtual status_t WriteToAttribute(entry_ref* appOrAddOnRef); - virtual status_t WriteToResource(entry_ref* appOrAddOnRef); + virtual status_t WriteToAttribute( + const entry_ref& appOrAddOnRef); + virtual status_t WriteToResource( + const entry_ref& appOrAddOnRef); virtual void MakeEmpty(); virtual int32 CountItems() const; @@ -475,11 +479,15 @@ public: status_t SetData(uint32 id, BMessage* msg); status_t ReadFromFile(const char* path = NULL); - status_t ReadFromAttribute(entry_ref* appOrAddOnRef); - status_t ReadFromResource(entry_ref* appOrAddOnRef); + status_t ReadFromAttribute( + const entry_ref& appOrAddOnRef); + status_t ReadFromResource( + const entry_ref& appOrAddOnRef); status_t WriteToFile(const char* path = NULL); - status_t WriteToAttribute(entry_ref* appOrAddOnRef); - status_t WriteToResource(entry_ref* appOrAddOnRef); + status_t WriteToAttribute( + const entry_ref& appOrAddOnRef); + status_t WriteToResource( + const entry_ref& appOrAddOnRef); void MakeEmpty(); diff --git a/headers/private/locale/DefaultCatalog.h b/headers/private/locale/DefaultCatalog.h index a79bd31321..be519d3780 100644 --- a/headers/private/locale/DefaultCatalog.h +++ b/headers/private/locale/DefaultCatalog.h @@ -38,11 +38,11 @@ class DefaultCatalog : public BHashMapCatalog { // implementation for editor-interface: status_t ReadFromFile(const char *path = NULL); - status_t ReadFromAttribute(entry_ref *appOrAddOnRef); - status_t ReadFromResource(entry_ref *appOrAddOnRef); + status_t ReadFromAttribute(const entry_ref &appOrAddOnRef); + status_t ReadFromResource(const entry_ref &appOrAddOnRef); status_t WriteToFile(const char *path = NULL); - status_t WriteToAttribute(entry_ref *appOrAddOnRef); - status_t WriteToResource(entry_ref *appOrAddOnRef); + status_t WriteToAttribute(const entry_ref &appOrAddOnRef); + status_t WriteToResource(const entry_ref &appOrAddOnRef); status_t SetRawString(const CatKey& key, const char *translated); void SetSignature(const entry_ref &catalogOwner); diff --git a/headers/private/locale/HashMapCatalog.h b/headers/private/locale/HashMapCatalog.h index 930ac646ba..fd5b27fdee 100644 --- a/headers/private/locale/HashMapCatalog.h +++ b/headers/private/locale/HashMapCatalog.h @@ -90,15 +90,15 @@ class BHashMapCatalog: public BCatalogAddOn { // implementation for editor-interface virtual status_t ReadFromFile(const char *path = NULL) {return B_NOT_SUPPORTED;} - virtual status_t ReadFromAttribute(entry_ref *appOrAddOnRef) + virtual status_t ReadFromAttribute(const entry_ref &appOrAddOnRef) {return B_NOT_SUPPORTED;} - virtual status_t ReadFromResource(entry_ref *appOrAddOnRef) + virtual status_t ReadFromResource(const entry_ref &appOrAddOnRef) {return B_NOT_SUPPORTED;} virtual status_t WriteToFile(const char *path = NULL) {return B_NOT_SUPPORTED;} - virtual status_t WriteToAttribute(entry_ref *appOrAddOnRef) + virtual status_t WriteToAttribute(const entry_ref &appOrAddOnRef) {return B_NOT_SUPPORTED;} - virtual status_t WriteToResource(entry_ref *appOrAddOnRef) + virtual status_t WriteToResource(const entry_ref &appOrAddOnRef) {return B_NOT_SUPPORTED;} void UpdateFingerprint(); diff --git a/src/bin/locale/linkcatkeys.cpp b/src/bin/locale/linkcatkeys.cpp index f9407ec003..c762362888 100644 --- a/src/bin/locale/linkcatkeys.cpp +++ b/src/bin/locale/linkcatkeys.cpp @@ -139,7 +139,7 @@ main(int argc, char **argv) BEntry entry(outputFile.String()); entry_ref eref; entry.GetRef(&eref); - res = targetCatalog.WriteToAttribute(&eref); + res = targetCatalog.WriteToAttribute(eref); if (res != B_OK) { fprintf(stderr, "couldn't write target-attribute to %s - error: %s\n", @@ -152,7 +152,7 @@ main(int argc, char **argv) BEntry entry(outputFile.String()); entry_ref eref; entry.GetRef(&eref); - res = targetCatalog.WriteToResource(&eref); + res = targetCatalog.WriteToResource(eref); if (res != B_OK) { fprintf(stderr, "couldn't write target-resource to %s - error: %s\n", diff --git a/src/kits/locale/Catalog.cpp b/src/kits/locale/Catalog.cpp index 7e4a0b2d1d..d22f98697f 100644 --- a/src/kits/locale/Catalog.cpp +++ b/src/kits/locale/Catalog.cpp @@ -211,14 +211,14 @@ BCatalogAddOn::ReadFromFile(const char *path) status_t -BCatalogAddOn::ReadFromAttribute(entry_ref *appOrAddOnRef) +BCatalogAddOn::ReadFromAttribute(const entry_ref &appOrAddOnRef) { return EOPNOTSUPP; } status_t -BCatalogAddOn::ReadFromResource(entry_ref *appOrAddOnRef) +BCatalogAddOn::ReadFromResource(const entry_ref &appOrAddOnRef) { return EOPNOTSUPP; } @@ -232,14 +232,14 @@ BCatalogAddOn::WriteToFile(const char *path) status_t -BCatalogAddOn::WriteToAttribute(entry_ref *appOrAddOnRef) +BCatalogAddOn::WriteToAttribute(const entry_ref &appOrAddOnRef) { return EOPNOTSUPP; } status_t -BCatalogAddOn::WriteToResource(entry_ref *appOrAddOnRef) +BCatalogAddOn::WriteToResource(const entry_ref &appOrAddOnRef) { return EOPNOTSUPP; } @@ -335,7 +335,7 @@ EditableCatalog::ReadFromFile(const char *path) status_t -EditableCatalog::ReadFromAttribute(entry_ref *appOrAddOnRef) +EditableCatalog::ReadFromAttribute(const entry_ref &appOrAddOnRef) { if (!fCatalog) return B_NO_INIT; @@ -344,7 +344,7 @@ EditableCatalog::ReadFromAttribute(entry_ref *appOrAddOnRef) status_t -EditableCatalog::ReadFromResource(entry_ref *appOrAddOnRef) +EditableCatalog::ReadFromResource(const entry_ref &appOrAddOnRef) { if (!fCatalog) return B_NO_INIT; @@ -362,7 +362,7 @@ EditableCatalog::WriteToFile(const char *path) status_t -EditableCatalog::WriteToAttribute(entry_ref *appOrAddOnRef) +EditableCatalog::WriteToAttribute(const entry_ref &appOrAddOnRef) { if (!fCatalog) return B_NO_INIT; @@ -371,7 +371,7 @@ EditableCatalog::WriteToAttribute(entry_ref *appOrAddOnRef) status_t -EditableCatalog::WriteToResource(entry_ref *appOrAddOnRef) +EditableCatalog::WriteToResource(const entry_ref &appOrAddOnRef) { if (!fCatalog) return B_NO_INIT; diff --git a/src/kits/locale/DefaultCatalog.cpp b/src/kits/locale/DefaultCatalog.cpp index 8594bc03f5..a7acc96aa0 100644 --- a/src/kits/locale/DefaultCatalog.cpp +++ b/src/kits/locale/DefaultCatalog.cpp @@ -70,27 +70,18 @@ DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, const char *langua SetSignature(catalogOwner); status_t status; - app_info appInfo; - be_app->GetAppInfo(&appInfo); - - // give highest priority to catalog embedded as resource in application - // executable: - status = ReadFromResource(&appInfo.ref); - // search for catalog living in sub-folder of app's folder: - if (status != B_OK) { - node_ref nref; - nref.device = appInfo.ref.device; - nref.node = appInfo.ref.directory; - BDirectory appDir(&nref); - BString catalogName("locale/"); - catalogName << kCatFolder - << "/" << fSignature - << "/" << fLanguageName - << kCatExtension; - BPath catalogPath(&appDir, catalogName.String()); - status = ReadFromFile(catalogPath.Path()); - } + node_ref nref; + nref.device = catalogOwner.device; + nref.node = catalogOwner.directory; + BDirectory appDir(&nref); + BString catalogName("locale/"); + catalogName << kCatFolder + << "/" << fSignature + << "/" << fLanguageName + << kCatExtension; + BPath catalogPath(&appDir, catalogName.String()); + status = ReadFromFile(catalogPath.Path()); if (status != B_OK) { // search in data folders @@ -116,6 +107,12 @@ DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, const char *langua } } + if (status != B_OK) { + // give lowest priority to catalog embedded as resource in application + // executable, so they can be overridden easily. + status = ReadFromResource(catalogOwner); + } + fInitCheck = status; log_team(LOG_DEBUG, "trying to load default-catalog(sig=%s, lang=%s) results in %s", @@ -132,7 +129,7 @@ DefaultCatalog::DefaultCatalog(entry_ref *appOrAddOnRef) : BHashMapCatalog("", "", 0) { - fInitCheck = ReadFromResource(appOrAddOnRef); + fInitCheck = ReadFromResource(*appOrAddOnRef); log_team(LOG_DEBUG, "trying to load embedded catalog from resources results in %s", strerror(fInitCheck)); @@ -255,22 +252,22 @@ DefaultCatalog::ReadFromFile(const char *path) * this method is not currently being used, but it may be useful in the future... */ status_t -DefaultCatalog::ReadFromAttribute(entry_ref *appOrAddOnRef) +DefaultCatalog::ReadFromAttribute(const entry_ref &appOrAddOnRef) { BNode node; - status_t res = node.SetTo(appOrAddOnRef); + status_t res = node.SetTo(&appOrAddOnRef); if (res != B_OK) { log_team(LOG_ERR, "couldn't find app or add-on (dev=%lu, dir=%Lu, name=%s)", - appOrAddOnRef->device, appOrAddOnRef->directory, - appOrAddOnRef->name); + appOrAddOnRef.device, appOrAddOnRef.directory, + appOrAddOnRef.name); return B_ENTRY_NOT_FOUND; } log_team(LOG_DEBUG, "looking for embedded catalog-attribute in app/add-on" - "(dev=%lu, dir=%Lu, name=%s)", appOrAddOnRef->device, - appOrAddOnRef->directory, appOrAddOnRef->name); + "(dev=%lu, dir=%Lu, name=%s)", appOrAddOnRef.device, + appOrAddOnRef.directory, appOrAddOnRef.name); attr_info attrInfo; res = node.GetAttrInfo(BLocaleRoster::kEmbeddedCatAttr, &attrInfo); @@ -305,22 +302,22 @@ DefaultCatalog::ReadFromAttribute(entry_ref *appOrAddOnRef) status_t -DefaultCatalog::ReadFromResource(entry_ref *appOrAddOnRef) +DefaultCatalog::ReadFromResource(const entry_ref &appOrAddOnRef) { BFile file; - status_t res = file.SetTo(appOrAddOnRef, B_READ_ONLY); + status_t res = file.SetTo(&appOrAddOnRef, B_READ_ONLY); if (res != B_OK) { log_team(LOG_ERR, "couldn't find app or add-on (dev=%lu, dir=%Lu, name=%s)", - appOrAddOnRef->device, appOrAddOnRef->directory, - appOrAddOnRef->name); + appOrAddOnRef.device, appOrAddOnRef.directory, + appOrAddOnRef.name); return B_ENTRY_NOT_FOUND; } log_team(LOG_DEBUG, "looking for embedded catalog-resource in app/add-on" - "(dev=%lu, dir=%Lu, name=%s)", appOrAddOnRef->device, - appOrAddOnRef->directory, appOrAddOnRef->name); + "(dev=%lu, dir=%Lu, name=%s)", appOrAddOnRef.device, + appOrAddOnRef.directory, appOrAddOnRef.name); BResources rsrc; res = rsrc.SetTo(&file); @@ -329,9 +326,11 @@ DefaultCatalog::ReadFromResource(entry_ref *appOrAddOnRef) return res; } + int mangledLanguage = CatKey::HashFun(fLanguageName.String(), 0); + size_t sz; - const void *buf = rsrc.LoadResource(B_MESSAGE_TYPE, - BLocaleRoster::kEmbeddedCatResId, &sz); + const void *buf = rsrc.LoadResource('CADA', + mangledLanguage, &sz); if (!buf) { log_team(LOG_DEBUG, "file has no catalog-resource"); return B_NAME_NOT_FOUND; @@ -379,10 +378,10 @@ DefaultCatalog::WriteToFile(const char *path) * future... */ status_t -DefaultCatalog::WriteToAttribute(entry_ref *appOrAddOnRef) +DefaultCatalog::WriteToAttribute(const entry_ref &appOrAddOnRef) { BNode node; - status_t res = node.SetTo(appOrAddOnRef); + status_t res = node.SetTo(&appOrAddOnRef); if (res != B_OK) return res; @@ -405,10 +404,10 @@ DefaultCatalog::WriteToAttribute(entry_ref *appOrAddOnRef) status_t -DefaultCatalog::WriteToResource(entry_ref *appOrAddOnRef) +DefaultCatalog::WriteToResource(const entry_ref &appOrAddOnRef) { BFile file; - status_t res = file.SetTo(appOrAddOnRef, B_READ_WRITE); + status_t res = file.SetTo(&appOrAddOnRef, B_READ_WRITE); if (res != B_OK) return res; @@ -422,9 +421,12 @@ DefaultCatalog::WriteToResource(entry_ref *appOrAddOnRef) // set a largish block-size in order to avoid reallocs res = Flatten(&mallocIO); + int mangledLanguage = CatKey::HashFun(fLanguageName.String(), 0); + if (res == B_OK) { - res = rsrc.AddResource(B_MESSAGE_TYPE, BLocaleRoster::kEmbeddedCatResId, - mallocIO.Buffer(), mallocIO.BufferLength(), "embedded catalog"); + res = rsrc.AddResource('CADA', mangledLanguage, + mallocIO.Buffer(), mallocIO.BufferLength(), + BString(fLanguageName) << " catalog"); } return res; diff --git a/src/tools/locale/Catalog.cpp b/src/tools/locale/Catalog.cpp index 3c6ff02031..f576b53e4b 100644 --- a/src/tools/locale/Catalog.cpp +++ b/src/tools/locale/Catalog.cpp @@ -206,14 +206,14 @@ BCatalogAddOn::ReadFromFile(const char *path) status_t -BCatalogAddOn::ReadFromAttribute(entry_ref *appOrAddOnRef) +BCatalogAddOn::ReadFromAttribute(const entry_ref &appOrAddOnRef) { return EOPNOTSUPP; } status_t -BCatalogAddOn::ReadFromResource(entry_ref *appOrAddOnRef) +BCatalogAddOn::ReadFromResource(const entry_ref &appOrAddOnRef) { return EOPNOTSUPP; } @@ -227,14 +227,14 @@ BCatalogAddOn::WriteToFile(const char *path) status_t -BCatalogAddOn::WriteToAttribute(entry_ref *appOrAddOnRef) +BCatalogAddOn::WriteToAttribute(const entry_ref &appOrAddOnRef) { return EOPNOTSUPP; } status_t -BCatalogAddOn::WriteToResource(entry_ref *appOrAddOnRef) +BCatalogAddOn::WriteToResource(const entry_ref &appOrAddOnRef) { return EOPNOTSUPP; } diff --git a/src/tools/locale/DefaultCatalog.cpp b/src/tools/locale/DefaultCatalog.cpp index 86acdc6c84..e8fc2e0b10 100644 --- a/src/tools/locale/DefaultCatalog.cpp +++ b/src/tools/locale/DefaultCatalog.cpp @@ -82,7 +82,7 @@ DefaultCatalog::DefaultCatalog(entry_ref *appOrAddOnRef) : BHashMapCatalog("", "", 0) { - fInitCheck = ReadFromResource(appOrAddOnRef); + fInitCheck = ReadFromResource(*appOrAddOnRef); // fprintf(stderr, // "trying to load embedded catalog from resources results in %s", // strerror(fInitCheck)); @@ -180,14 +180,14 @@ DefaultCatalog::ReadFromFile(const char *path) future... */ status_t -DefaultCatalog::ReadFromAttribute(entry_ref *appOrAddOnRef) +DefaultCatalog::ReadFromAttribute(const entry_ref &appOrAddOnRef) { return B_NOT_SUPPORTED; } status_t -DefaultCatalog::ReadFromResource(entry_ref *appOrAddOnRef) +DefaultCatalog::ReadFromResource(const entry_ref &appOrAddOnRef) { return B_NOT_SUPPORTED; } @@ -229,14 +229,14 @@ DefaultCatalog::WriteToFile(const char *path) future... */ status_t -DefaultCatalog::WriteToAttribute(entry_ref *appOrAddOnRef) +DefaultCatalog::WriteToAttribute(const entry_ref &appOrAddOnRef) { return B_NOT_SUPPORTED; } status_t -DefaultCatalog::WriteToResource(entry_ref *appOrAddOnRef) +DefaultCatalog::WriteToResource(const entry_ref &appOrAddOnRef) { return B_NOT_SUPPORTED; } diff --git a/src/tools/locale/linkcatkeys.cpp b/src/tools/locale/linkcatkeys.cpp index 51f731a747..41aaff0837 100644 --- a/src/tools/locale/linkcatkeys.cpp +++ b/src/tools/locale/linkcatkeys.cpp @@ -123,7 +123,7 @@ main(int argc, char **argv) BEntry entry(outputFile.String()); entry_ref eref; entry.GetRef(&eref); - res = targetCatImpl.WriteToAttribute(&eref); + res = targetCatImpl.WriteToAttribute(eref); if (res != B_OK) { fprintf(stderr, "couldn't write target-attribute to %s - error: %s\n", @@ -136,7 +136,7 @@ main(int argc, char **argv) BEntry entry(outputFile.String()); entry_ref eref; entry.GetRef(&eref); - res = targetCatImpl.WriteToResource(&eref); + res = targetCatImpl.WriteToResource(eref); if (res != B_OK) { fprintf(stderr, "couldn't write target-resource to %s - error: %s\n", From e5712f7bf8aaedb522ed3d7d91df980f18bb7efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 1 Nov 2011 10:55:34 +0000 Subject: [PATCH 593/702] Fix constness to avoid warnings. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43058 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/mail_utils/spamdbm.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/mail_utils/spamdbm.cpp b/src/bin/mail_utils/spamdbm.cpp index 257f3b70dd..041fe540ca 100644 --- a/src/bin/mail_utils/spamdbm.cpp +++ b/src/bin/mail_utils/spamdbm.cpp @@ -635,7 +635,7 @@ typedef enum PropertyNumbersEnum PN_MAX } PropertyNumbers; -static char * g_PropertyNames [PN_MAX] = +static const char * g_PropertyNames [PN_MAX] = { "DatabaseFile", "Spam", @@ -863,7 +863,7 @@ typedef enum ScoringModeEnum SM_MAX } ScoringModes; -static char * g_ScoringModeNames [SM_MAX] = +static const char * g_ScoringModeNames [SM_MAX] = { "Robinson", "ChiSquared" @@ -885,7 +885,7 @@ typedef enum TokenizeModeEnum TM_MAX } TokenizeModes; -static char * g_TokenizeModeNames [TM_MAX] = +static const char * g_TokenizeModeNames [TM_MAX] = { "All", "Plain text", @@ -6097,7 +6097,7 @@ void ControlsView::AttachedToWindow () float RowHeight; float RowTop; ScoringModes ScoringMode; - char *StringPntr; + const char *StringPntr; BMenuItem *TempMenuItemPntr; BRect TempRect; char TempString [PATH_MAX]; From b15c03021da96b5d98ec148c99b9a375ece6f026 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 1 Nov 2011 12:40:51 +0000 Subject: [PATCH 594/702] Add catmerge.sh, a shellscript for easily merging an existing but outdated catalog with a newer one in another language. I was not sure where to put it, is this the right place ? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43059 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/pulkomandy/catmerge.sh | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 3rdparty/pulkomandy/catmerge.sh diff --git a/3rdparty/pulkomandy/catmerge.sh b/3rdparty/pulkomandy/catmerge.sh new file mode 100755 index 0000000000..1a0b729329 --- /dev/null +++ b/3rdparty/pulkomandy/catmerge.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if [ $# -eq 2 ] + then + OLD=$1 + NEW=$2 + + # We need a tab character as a field separator + TAB=`echo -e "\t"` + + #Temporary storage + TEMPFILE=`mktemp /tmp/catmerge.XXXXX` + + # Extract the list of keys to remove + # Compare (diff) the keys only (cut) ; keep only 'removed' lines (grep -), + # Ignore diff header and headlines from both files (tail), remove diff's + # prepended stuff (cut) + # Put the result in our tempfile. + diff -u <(cut -f 1,2 $OLD) <(cut -f 1,2 $NEW) |grep ^-|\ + tail -n +3|cut -b2- > $TEMPFILE + + # Reuse the headline from the new file (including fingerprint). This gets + # the language wrong, but it isn't actually used anywhere + head -1 $NEW + # Sort-merge old and new, inserting lines from NEW into OLD (sort); + # Exclude the headline from that (tail -n +2) + # Then, filter out the removed strings (fgrep) + sort -u -t"$TAB" -k 1,2 <(tail -n +2 $OLD) <(tail -n +2 $NEW)|\ + fgrep -v -f $TEMPFILE + + rm $TEMPFILE + + else + echo "$0 OLD NEW" + echo "merges OLD and NEW catalogs, such that all the keys in NEW that are" + echo "not yet in OLD are added to it, and the one in OLD but not in NEW are" + echo "removed. The fingerprint is also updated." +fi From 0d3e3475077cb913d90d780c4e23301d4170867f Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 1 Nov 2011 12:45:01 +0000 Subject: [PATCH 595/702] WIP: Add abstract base class TeamUISettings and corresponding subclass GUITeamUISettings. Once complete, these will be used to store/restore settings for the debugger's various UI components. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43060 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/Jamfile | 4 +- .../debugger/settings/GUITeamUISettings.cpp | 67 +++++++++++++++++++ .../debugger/settings/GUITeamUISettings.h | 40 +++++++++++ src/apps/debugger/settings/TeamSettings.cpp | 36 ++++++++++ src/apps/debugger/settings/TeamSettings.h | 6 ++ src/apps/debugger/settings/TeamUISettings.cpp | 15 +++++ src/apps/debugger/settings/TeamUISettings.h | 30 +++++++++ 7 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 src/apps/debugger/settings/GUITeamUISettings.cpp create mode 100644 src/apps/debugger/settings/GUITeamUISettings.h create mode 100644 src/apps/debugger/settings/TeamUISettings.cpp create mode 100644 src/apps/debugger/settings/TeamUISettings.h diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index d5029bacc4..c8c2158686 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -140,8 +140,10 @@ Application Debugger : # settings BreakpointSetting.cpp - TeamSettings.cpp SettingsManager.cpp + TeamSettings.cpp + TeamUISettings.cpp + GUITeamUISettings.cpp # settings/generic Setting.cpp diff --git a/src/apps/debugger/settings/GUITeamUISettings.cpp b/src/apps/debugger/settings/GUITeamUISettings.cpp new file mode 100644 index 0000000000..0bdfe1778e --- /dev/null +++ b/src/apps/debugger/settings/GUITeamUISettings.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#include "GUITeamUISettings.h" + +#include + + +GUITeamUISettings::GUITeamUISettings(const char* settingsID) + : + fID(settingsID) +{ +} + + +GUITeamUISettings::GUITeamUISettings(const GUITeamUISettings& other) +{ + fID = other.fID; +} + + +GUITeamUISettings::~GUITeamUISettings() +{ +} + + +const char* +GUITeamUISettings::ID() const +{ + return fID.String(); +} + + +status_t +GUITeamUISettings::SetTo(const BMessage& archive) +{ + status_t error = archive.FindString("ID", &fID); + + return error; +} + + +status_t +GUITeamUISettings::WriteTo(BMessage& archive) const +{ + status_t error = archive.AddString("ID", fID); + + return error; +} + + +TeamUISettings* +GUITeamUISettings::Clone() const +{ + GUITeamUISettings* settings = new GUITeamUISettings(fID.String()); + + return settings; +} + + +GUITeamUISettings& +GUITeamUISettings::operator=(const GUITeamUISettings& other) +{ + fID = other.fID; + return *this; +} diff --git a/src/apps/debugger/settings/GUITeamUISettings.h b/src/apps/debugger/settings/GUITeamUISettings.h new file mode 100644 index 0000000000..ab3e0dcd0d --- /dev/null +++ b/src/apps/debugger/settings/GUITeamUISettings.h @@ -0,0 +1,40 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef GUI_TEAM_UI_SETTINGS_H +#define GUI_TEAM_UI_SETTINGS_H + + +#include + +#include + +#include "TeamUISettings.h" + +class BMessage; + + +class GUITeamUISettings : public TeamUISettings { +public: + GUITeamUISettings(const char* settingsID); + GUITeamUISettings(const GUITeamUISettings& + other); + // throws std::bad_alloc + ~GUITeamUISettings(); + + virtual const char* ID() const; + virtual status_t SetTo(const BMessage& archive); + virtual status_t WriteTo(BMessage& archive) const; + virtual TeamUISettings* Clone() const; + + GUITeamUISettings& operator=(const GUITeamUISettings& other); + // throws std::bad_alloc + +private: + + BString fID; +}; + + +#endif // GUI_TEAM_UI_SETTINGS_H diff --git a/src/apps/debugger/settings/TeamSettings.cpp b/src/apps/debugger/settings/TeamSettings.cpp index 723cd12f71..d94448328a 100644 --- a/src/apps/debugger/settings/TeamSettings.cpp +++ b/src/apps/debugger/settings/TeamSettings.cpp @@ -15,6 +15,7 @@ #include "ArchivingUtils.h" #include "BreakpointSetting.h" #include "Team.h" +#include "TeamUISettings.h" #include "UserBreakpoint.h" @@ -98,6 +99,12 @@ TeamSettings::SetTo(const BMessage& archive) return error; } } + + // add UI settings + for (int32 i = 0; archive.FindMessage("uisettings", i, &childArchive) + == B_OK; i++) { + + } return B_OK; } @@ -140,6 +147,20 @@ TeamSettings::BreakpointAt(int32 index) const } +int32 +TeamSettings::CountUISettings() const +{ + return fUISettings.CountItems(); +} + + +const TeamUISettings* +TeamSettings::UISettingAt(int32 index) const +{ + return fUISettings.ItemAt(index); +} + + TeamSettings& TeamSettings::operator=(const TeamSettings& other) { @@ -160,6 +181,16 @@ TeamSettings::operator=(const TeamSettings& other) } } + for (int32 i = 0; TeamUISettings* uiSetting + = other.fUISettings.ItemAt(i); i++) { + TeamUISettings* clonedSetting + = uiSetting->Clone(); + if (!fUISettings.AddItem(clonedSetting)) { + delete clonedSetting; + throw std::bad_alloc(); + } + } + return *this; } @@ -171,7 +202,12 @@ TeamSettings::_Unset() i++) { delete breakpoint; } + + for (int32 i = 0; TeamUISettings* uiSetting = fUISettings.ItemAt(i); i++) + delete uiSetting; + fBreakpoints.MakeEmpty(); + fUISettings.MakeEmpty(); fTeamName.Truncate(0); } diff --git a/src/apps/debugger/settings/TeamSettings.h b/src/apps/debugger/settings/TeamSettings.h index 3b66c5e2da..202924d11e 100644 --- a/src/apps/debugger/settings/TeamSettings.h +++ b/src/apps/debugger/settings/TeamSettings.h @@ -14,6 +14,7 @@ class BMessage; class Team; class BreakpointSetting; +class TeamUISettings; class TeamSettings { @@ -31,18 +32,23 @@ public: int32 CountBreakpoints() const; const BreakpointSetting* BreakpointAt(int32 index) const; + + int32 CountUISettings() const; + const TeamUISettings* UISettingAt(int32 index) const; TeamSettings& operator=(const TeamSettings& other); // throws std::bad_alloc private: typedef BObjectList BreakpointList; + typedef BObjectList UISettingsList; private: void _Unset(); private: BreakpointList fBreakpoints; + UISettingsList fUISettings; BString fTeamName; }; diff --git a/src/apps/debugger/settings/TeamUISettings.cpp b/src/apps/debugger/settings/TeamUISettings.cpp new file mode 100644 index 0000000000..bbffadb05e --- /dev/null +++ b/src/apps/debugger/settings/TeamUISettings.cpp @@ -0,0 +1,15 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#include "TeamUISettings.h" + + +TeamUISettings::TeamUISettings() +{ +} + + +TeamUISettings::~TeamUISettings() +{ +} diff --git a/src/apps/debugger/settings/TeamUISettings.h b/src/apps/debugger/settings/TeamUISettings.h new file mode 100644 index 0000000000..fc15d03962 --- /dev/null +++ b/src/apps/debugger/settings/TeamUISettings.h @@ -0,0 +1,30 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef TEAM_UI_SETTINGS_H +#define TEAM_UI_SETTINGS_H + + +#include + + +class BMessage; + + +class TeamUISettings { +public: + TeamUISettings(); + ~TeamUISettings(); + + virtual const char* ID() const = 0; + virtual status_t SetTo(const BMessage& archive) = 0; + virtual status_t WriteTo(BMessage& archive) const = 0; + + virtual TeamUISettings* Clone() const = 0; + // throws std::bad_alloc + +}; + + +#endif // TEAM_UI_SETTINGS_H From f3b7dcd4d293221e7cb3f11fadbd30cfd8116f55 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 1 Nov 2011 13:35:58 +0000 Subject: [PATCH 596/702] * Remove the now unneeded Message-logic for hiding and showing the preview * Put the clock mode radio buttons above the preview Also makes hiding hte preview work again. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43061 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/TimeMessages.h | 4 --- src/preferences/time/TimeWindow.cpp | 11 -------- src/preferences/time/ZoneView.cpp | 39 ++++++++++++++++++----------- src/preferences/time/ZoneView.h | 1 + 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/preferences/time/TimeMessages.h b/src/preferences/time/TimeMessages.h index 101e659121..082a814cab 100644 --- a/src/preferences/time/TimeMessages.h +++ b/src/preferences/time/TimeMessages.h @@ -31,10 +31,6 @@ const uint32 H_TM_CHANGED = 'obTC'; // notice for user changes const uint32 H_USER_CHANGE = 'obUC'; -// notices to hide or show the time zone preview -const uint32 H_HIDE_PREVIEW = 'hipr'; -const uint32 H_SHOW_PREVIEW = 'shpr'; - // local/ gmt radiobuttons const uint32 kRTCUpdate = '_rtc'; diff --git a/src/preferences/time/TimeWindow.cpp b/src/preferences/time/TimeWindow.cpp index 13ed1995fc..63e0c75fea 100644 --- a/src/preferences/time/TimeWindow.cpp +++ b/src/preferences/time/TimeWindow.cpp @@ -89,19 +89,8 @@ TTimeWindow::MessageReceived(BMessage* message) break; case kMsgChange: - { _SetRevertStatus(); - bool useGMTTime = true; - message->FindBool("UseGMT", &useGMTTime); - if (useGMTTime) { - BMessage show(H_SHOW_PREVIEW); - fTimeZoneView->MessageReceived(&show); - } else { - BMessage hide(H_HIDE_PREVIEW); - fTimeZoneView->MessageReceived(&hide); - } break; - } case kMsgClockSettingChanged: break; diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index 734ed30498..90781f0625 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -171,16 +171,6 @@ TimeZoneView::MessageReceived(BMessage* message) break; } - case H_HIDE_PREVIEW: - fCurrent->Hide(); - fPreview->Hide(); - break; - - case H_SHOW_PREVIEW: - fCurrent->Show(); - fPreview->Show(); - break; - case kMsgRevert: _Revert(); break; @@ -281,6 +271,7 @@ TimeZoneView::_InitView() fGmtTime->SetValue(B_CONTROL_ON); else fLocalTime->SetValue(B_CONTROL_ON); + _ShowOrHidePreview(); fOldUseGmtTime = fUseGmtTime; @@ -288,14 +279,14 @@ TimeZoneView::_InitView() BLayoutBuilder::Group<>(this) .Add(scrollList) .AddGroup(B_VERTICAL, kInset) - .Add(fCurrent) - .Add(fPreview) - .AddGlue() .Add(text) .AddGroup(B_VERTICAL, kInset) .Add(fLocalTime) .Add(fGmtTime) .End() + .AddGlue() + .Add(fCurrent) + .Add(fPreview) .Add(fSetZone) .End() .SetInsets(kInset, kInset, kInset, kInset); @@ -499,6 +490,7 @@ TimeZoneView::_Revert() fGmtTime->SetValue(B_CONTROL_ON); else fLocalTime->SetValue(B_CONTROL_ON); + _ShowOrHidePreview(); _UpdateGmtSettings(); _SetSystemTimeZone(); @@ -641,17 +633,34 @@ TimeZoneView::_UpdateGmtSettings() { _WriteRTCSettings(); + _ShowOrHidePreview(); _NotifyClockSettingChanged(); _kern_set_real_time_clock_is_gmt(fUseGmtTime); } +void +TimeZoneView::_ShowOrHidePreview() +{ + if (fUseGmtTime) { + // Hardware clock uses GMT time, changing timezone will adjust the + // offset and we need to display a preview + fCurrent->Show(); + fPreview->Show(); + } else { + // Hardware clock uses local time, changing timezone will adjust the + // clock and there is no offset to manage, thus, no preview. + fCurrent->Hide(); + fPreview->Hide(); + } +} + + void TimeZoneView::_NotifyClockSettingChanged() { - BMessage msg(kMsgChange); - msg.AddBool("UseGMT", fUseGmtTime); + BMessage msg(kMsgClockSettingChanged); Window()->PostMessage(&msg); } diff --git a/src/preferences/time/ZoneView.h b/src/preferences/time/ZoneView.h index 9dc559b470..8d97decd65 100644 --- a/src/preferences/time/ZoneView.h +++ b/src/preferences/time/ZoneView.h @@ -52,6 +52,7 @@ private: void _ReadRTCSettings(); void _WriteRTCSettings(); void _UpdateGmtSettings(); + void _ShowOrHidePreview(); void _InitView(); void _BuildZoneMenu(); From 8252ed52dd77f68909f9288b58c71a4117df8735 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 1 Nov 2011 14:07:35 +0000 Subject: [PATCH 597/702] gcc2 build fix. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43062 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/settings/TeamUISettings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/debugger/settings/TeamUISettings.h b/src/apps/debugger/settings/TeamUISettings.h index fc15d03962..201fb83b36 100644 --- a/src/apps/debugger/settings/TeamUISettings.h +++ b/src/apps/debugger/settings/TeamUISettings.h @@ -15,7 +15,7 @@ class BMessage; class TeamUISettings { public: TeamUISettings(); - ~TeamUISettings(); + virtual ~TeamUISettings(); virtual const char* ID() const = 0; virtual status_t SetTo(const BMessage& archive) = 0; From 5fd0416842b615025017ab7df50886757063c842 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 1 Nov 2011 14:27:25 +0000 Subject: [PATCH 598/702] Tiny cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43063 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/heap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/heap.cpp b/src/system/kernel/heap.cpp index 928f5b1ba4..19e9e0966b 100644 --- a/src/system/kernel/heap.cpp +++ b/src/system/kernel/heap.cpp @@ -729,7 +729,7 @@ analyze_allocation_callers(heap_allocator *heap) caller_info *callerInfo = get_caller_info(info->caller); if (callerInfo == NULL) { kprintf("out of space for caller infos\n"); - return 0; + return false; } callerInfo->count++; From 0044a8c39ab5721051b6279506d1a8c511e20453 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 1 Nov 2011 14:31:08 +0000 Subject: [PATCH 599/702] Apply patch by bkmx from ticket #5093 : fixes some buffer index math in BPushGameSound so at least it doesn't crashes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43064 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/game/PushGameSound.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/kits/game/PushGameSound.cpp b/src/kits/game/PushGameSound.cpp index 89ec156f59..651fc10a79 100644 --- a/src/kits/game/PushGameSound.cpp +++ b/src/kits/game/PushGameSound.cpp @@ -15,9 +15,13 @@ #include "GSUtility.h" -BPushGameSound::BPushGameSound(size_t inBufferFrameCount, const gs_audio_format *format, - size_t inBufferCount, BGameSoundDevice *device) - : BStreamingGameSound(inBufferFrameCount, format, inBufferCount, device) +BPushGameSound::BPushGameSound(size_t inBufferFrameCount, + const gs_audio_format *format, size_t inBufferCount, + BGameSoundDevice *device) + : + BStreamingGameSound(inBufferFrameCount, format, inBufferCount, device), + fLockPos(0), + fPlayPos(0) { fPageLocked = new BList; @@ -137,8 +141,8 @@ BPushGameSound::SetParameters(size_t inBufferFrameCount, status_t -BPushGameSound::SetStreamHook(void (*hook)(void * inCookie, void * inBuffer, size_t inByteCount, BStreamingGameSound * me), - void * cookie) +BPushGameSound::SetStreamHook(void (*hook)(void * inCookie, void * inBuffer, + size_t inByteCount, BStreamingGameSound * me), void * cookie) { return B_UNSUPPORTED; } @@ -153,7 +157,8 @@ BPushGameSound::FillBuffer(void *inBuffer, size_t inByteCount) return; if (fPlayPos + bytes > fBufferSize) { - size_t remainder = fPlayPos + bytes - fBufferSize; + size_t remainder = fBufferSize - fPlayPos; + // Space left in buffer char * buffer = (char*)inBuffer; // fill the buffer with the samples left at the end of our buffer From 4d186396e679deb3f273cf24dbf6e67f93b8fa3c Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Tue, 1 Nov 2011 14:51:42 +0000 Subject: [PATCH 600/702] Update Swedish catkeys. Thanks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43065 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/apps/deskbar/sv.catkeys | 2 +- data/catalogs/apps/devices/sv.catkeys | 7 ++++++- data/catalogs/apps/launchbox/sv.catkeys | 6 +++--- data/catalogs/apps/readonlybootprompt/sv.catkeys | 2 +- data/catalogs/servers/registrar/sv.catkeys | 16 ++++++++-------- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/data/catalogs/apps/deskbar/sv.catkeys b/data/catalogs/apps/deskbar/sv.catkeys index b025fd4301..e771c77780 100644 --- a/data/catalogs/apps/deskbar/sv.catkeys +++ b/data/catalogs/apps/deskbar/sv.catkeys @@ -12,7 +12,7 @@ Close all WindowMenu Stäng alla Demos B_USER_DESKBAR_DIRECTORY/Demos Exempelprogram Deskbar System name Deskbar Deskbar preferences PreferencesWindow Deskbar inställningar -Deskbar preferences… BeMenu Deskbar inställningar... +Deskbar preferences… BeMenu Inställningar... Desktop applets B_USER_DESKBAR_DIRECTORY/Desktop applets Skrivbordsprogram Edit menu… PreferencesWindow Redigera meny... Expand new applications PreferencesWindow Expandera nya program diff --git a/data/catalogs/apps/devices/sv.catkeys b/data/catalogs/apps/devices/sv.catkeys index a4b82d780a..a0640245f9 100644 --- a/data/catalogs/apps/devices/sv.catkeys +++ b/data/catalogs/apps/devices/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-Devices 2539610927 +1 swedish x-vnd.Haiku-Devices 865240481 ACPI Information DeviceACPI ACPI-information ACPI Processor Namespace '%2' DeviceACPI ACPI Processor-namnrymd '%2' ACPI System Bus DeviceACPI ACPI systembuss @@ -8,6 +8,7 @@ ACPI bus Device ACPI-buss ACPI bus DevicesView ACPI-buss ACPI controller Device ACPI-kontroller ACPI node '%1' DeviceACPI ACPI nod '%1' +Array DeviceSCSI Matris Basic information DevicesView Grundläggande information Bridge Device Brygga Bridge DeviceSCSI Brygga @@ -16,10 +17,12 @@ Bus Information Device Bussinformation CD-ROM DeviceSCSI CD-ROM Card Reader DeviceSCSI Kortläsare Category DevicesView Kategori +Changer DeviceSCSI Växlare Class Info:\t\t\t\t: %classInfo% DeviceACPI Klassinformation:\t\t\t\t: %classInfo% Class Info:\t\t\t\t: %classInfo% DeviceSCSI Klassinformation:\t\t\t\t: %classInfo% Class info DevicePCI Klassinformation Communication controller Device Kommunikationskontroller +Communications DeviceSCSI Kommunikations Computer Device Dator Computer DevicesView Dator Connection DevicesView Anslutning @@ -41,6 +44,7 @@ Display controller Device Skärmkontroller Docking station Device Dockningsstation Driver used Device Drivrutin använd Driver used DevicePCI Använd drivrutin +Enclosure DeviceSCSI Hölje Encryption controller Device Krypteringskontroller Generate system information DevicesView Generera systeminformation Generic system peripheral Device Allmänt systemtillbehör @@ -87,4 +91,5 @@ Unknown device Device Okänd enhet Unknown device DevicesView Okänd enhet Value PropertyList Värde Wireless controller Device Trådlös kontroller +Worm DeviceSCSI Mask unknown Device okänd diff --git a/data/catalogs/apps/launchbox/sv.catkeys b/data/catalogs/apps/launchbox/sv.catkeys index 13ca41bdfd..859724c9b4 100644 --- a/data/catalogs/apps/launchbox/sv.catkeys +++ b/data/catalogs/apps/launchbox/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-LaunchBox 1440389990 +1 swedish x-vnd.Haiku-LaunchBox 3172696206 Add button here LaunchBox Lägg till knapp Auto-raise LaunchBox Upphöj automatiskt Bummer LaunchBox Hoppsan @@ -7,9 +7,8 @@ Clear button LaunchBox Rensa knapp Clone LaunchBox Klona Close LaunchBox Stäng Description for '%3' LaunchBox Beskrivning för '%3' -Failed to launch '%1'.\n\nError: LaunchBox Misslyckades att starta '%1'.\n\nFel: +Failed to launch '%1'.\n\nError: LaunchBox Misslyckades att starta '%1'.\n\nFel: Failed to launch 'something',error in Pad data. LaunchBox Misslyckades att starta 'någonting'. Fel på knappen. -Failed to launch application with signature '%2'.\n\nError: LaunchBox Misslyckades att starta programmet med signaturen '%2'.\n\nFel: Failed to send 'open folder' command to Tracker.\n\nError: LaunchBox Misslyckades att skicka 'öppna mapp' kommando till Tracker.\n\nFel: Horizontal layout LaunchBox Horisontal utformning Icon size LaunchBox Ikonstorlek @@ -30,5 +29,6 @@ Show on all workspaces LaunchBox Visa på alla arbetsytor Show window border LaunchBox Visa fönsterkant Vertical layout LaunchBox Vertikal utformning You can drag an icon here. LaunchBox Du kan dra en ikon hit. +\n\nFailed to launch application with signature '%2'.\n\nError: LaunchBox \n\nKunde inte starta programmet med signaturen '%2'.\n\nFel: last chance LaunchBox sista chansen launch popup LaunchBox starta popup diff --git a/data/catalogs/apps/readonlybootprompt/sv.catkeys b/data/catalogs/apps/readonlybootprompt/sv.catkeys index 13b41a6c24..a51c289b34 100644 --- a/data/catalogs/apps/readonlybootprompt/sv.catkeys +++ b/data/catalogs/apps/readonlybootprompt/sv.catkeys @@ -3,6 +3,6 @@ Custom BootPromptWindow Anpassad Desktop (Live-CD) BootPromptWindow Skrivbord (Live-CD) Keymap BootPromptWindow Tangentbordslayout Language BootPromptWindow Språk -Run Installer BootPromptWindow Kör Installeraren +Run Installer BootPromptWindow Starta Installeraren Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Tack för att du testar Haiku! Vi hoppas att du kommer att gilla det!\n\nDu kan välja ditt föredragna språk och tangentbordslayout från listan till vänster. Du kan enkelt byta båda inställningarna från skrivbordet senare.\n\nVill du fortsätta att köra Installeraren eller starta fortsätta och starta direkt till skrivbordet?\n Welcome to Haiku! BootPromptWindow Välkommen till Haiku! diff --git a/data/catalogs/servers/registrar/sv.catkeys b/data/catalogs/servers/registrar/sv.catkeys index dbcb72bb08..b7cd79ed73 100644 --- a/data/catalogs/servers/registrar/sv.catkeys +++ b/data/catalogs/servers/registrar/sv.catkeys @@ -1,23 +1,23 @@ 1 swedish application/x-vnd.Haiku-Registrar 2599857937 %action%? ShutdownProcess %action%? -Application \"%appName%\" has aborted the shutdown process. ShutdownProcess Applikationen "%appName%" avbröt nerstängningen. +Application \"%appName%\" has aborted the shutdown process. ShutdownProcess Programmet "%appName%" avbröt avstängningen. Asking \"%appName%\" to quit. ShutdownProcess Ber "%appName%" att avsluta. -Asking background applications to quit. ShutdownProcess Ber bakgrunds applikationerna att avsluta. +Asking background applications to quit. ShutdownProcess Ber bakgrundsprogrammen att avsluta. Asking other processes to quit. ShutdownProcess Ber alla processer att avsluta. Cancel ShutdownProcess Avbryt -Cancel shutdown ShutdownProcess Avbryt nerstängning +Cancel shutdown ShutdownProcess Avbryt avstängning Do you really want to restart the system? ShutdownProcess Vill du verkligen starta om systemet? -Do you really want to shut down the system? ShutdownProcess Är du säker på att du vill avsluta systemet? +Do you really want to shut down the system? ShutdownProcess Är du säker på att du vill stänga av Haiku? It's now safe to turn off the computer. ShutdownProcess Nu är det säkert att slå av datorn. -Kill application ShutdownProcess Avsluta applikation +Kill application ShutdownProcess Avsluta program OK ShutdownProcess OK Restart ShutdownProcess Starta om Restart system ShutdownProcess Starta om Restarting… ShutdownProcess Startar om... Shut down ShutdownProcess Stäng av -Shutdown aborted ShutdownProcess Avslutningen avbröts +Shutdown aborted ShutdownProcess Avstängningen avbröts Shutdown status ShutdownProcess Avslutar Haiku Shutting down… ShutdownProcess Stänger av... -System is shut down ShutdownProcess Systemet är avslutat -The application \"%appName%\" might be blocked on a modal panel. ShutdownProcess Applikationen "%appName%" kan vara blockerad av en dialogruta. +System is shut down ShutdownProcess Systemet är avstängt +The application \"%appName%\" might be blocked on a modal panel. ShutdownProcess Programmet "%appName%" kan vara blockerad av en dialogruta. Tidying things up a bit. ShutdownProcess Städar upp lite. From 71f92c6439bddce17ccd7121d4ba7ff716617b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 1 Nov 2011 15:02:06 +0000 Subject: [PATCH 601/702] Check for and use dmidecode if present, to get the exact vendor and machine identification, which should be much more reliable than the user. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43066 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/HardwareChecker.sh | 39 ++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/3rdparty/mmu_man/scripts/HardwareChecker.sh b/3rdparty/mmu_man/scripts/HardwareChecker.sh index e4c40f5f60..c5c234a56f 100755 --- a/3rdparty/mmu_man/scripts/HardwareChecker.sh +++ b/3rdparty/mmu_man/scripts/HardwareChecker.sh @@ -199,12 +199,32 @@ check_usb () echo "
" } +check_dmidecode () { + which dmidecode >/dev/null 2>&1 || return + + echo "

DMIdecode output

" + echo "The output of dmidecode gives exact vendor and device identification." + + echo "

dmidecode

" + echo "(full output, stripped from the machine UUID)
" + echo "" + + dmidecode_bios_vendor="$(dmidecode -s bios-vendor)" + dmidecode_bios_version="$(dmidecode -s bios-version)" + dmidecode_bios_release_date="$(dmidecode -s bios-release-date)" + dmidecode_system_manufacturer="$(dmidecode -s system-manufacturer)" + dmidecode_system_product_name="$(dmidecode -s system-product-name)" + dmidecode_system_version="$(dmidecode -s system-version)" +} + check_machine () { echo "

Machine

" - echo "Vendor: " + echo "Vendor: " echo "
" - echo "Model: " + echo "Model: " echo "
" echo "Specification page: " echo "
" @@ -302,19 +322,22 @@ check_all () do_notify 0.1 "Checking for PCI hardware..." check_pci - do_notify 0.3 "Checking for USB hardware..." + do_notify 0.2 "Checking for USB hardware..." check_usb - do_notify 0.5 "Checking for Haiku version..." - check_haiku - - do_notify 0.6 "Checking for utility outputs..." + do_notify 0.3 "Checking for utility outputs..." check_utils - do_notify 0.8 "Dumping syslog output..." + do_notify 0.7 "Dumping syslog output..." check_syslog + do_notify 0.8 "Checking machine infos..." + check_dmidecode check_machine + + do_notify 0.9 "Checking for Haiku version..." + check_haiku + check_sender do_notify 1.0 "Done!" --timeout 3 From 76ce2c7ef72d883238c339ee9d2bb79e8a8bfce6 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 1 Nov 2011 15:45:31 +0000 Subject: [PATCH 602/702] More work-in-progress towards getting settings saved/restored. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43067 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/Jamfile | 3 +- .../debugger/settings/GUITeamUISettings.cpp | 16 ++++++ .../debugger/settings/GUITeamUISettings.h | 2 + src/apps/debugger/settings/TeamSettings.cpp | 23 +++++++- src/apps/debugger/settings/TeamUISettings.h | 7 +++ .../settings/TeamUISettingsFactory.cpp | 56 +++++++++++++++++++ .../debugger/settings/TeamUISettingsFactory.h | 24 ++++++++ 7 files changed, 128 insertions(+), 3 deletions(-) create mode 100644 src/apps/debugger/settings/TeamUISettingsFactory.cpp create mode 100644 src/apps/debugger/settings/TeamUISettingsFactory.h diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index c8c2158686..61b1ad7161 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -140,10 +140,11 @@ Application Debugger : # settings BreakpointSetting.cpp + GUITeamUISettings.cpp SettingsManager.cpp TeamSettings.cpp TeamUISettings.cpp - GUITeamUISettings.cpp + TeamUISettingsFactory.cpp # settings/generic Setting.cpp diff --git a/src/apps/debugger/settings/GUITeamUISettings.cpp b/src/apps/debugger/settings/GUITeamUISettings.cpp index 0bdfe1778e..e39d4bae55 100644 --- a/src/apps/debugger/settings/GUITeamUISettings.cpp +++ b/src/apps/debugger/settings/GUITeamUISettings.cpp @@ -7,6 +7,11 @@ #include +GUITeamUISettings::GUITeamUISettings() +{ +} + + GUITeamUISettings::GUITeamUISettings(const char* settingsID) : fID(settingsID) @@ -25,6 +30,13 @@ GUITeamUISettings::~GUITeamUISettings() } +team_ui_settings_type +GUITeamUISettings::Type() const +{ + return TEAM_UI_SETTINGS_TYPE_GUI; +} + + const char* GUITeamUISettings::ID() const { @@ -45,6 +57,10 @@ status_t GUITeamUISettings::WriteTo(BMessage& archive) const { status_t error = archive.AddString("ID", fID); + if (error != B_OK) + return error; + + error = archive.AddInt32("type", Type()); return error; } diff --git a/src/apps/debugger/settings/GUITeamUISettings.h b/src/apps/debugger/settings/GUITeamUISettings.h index ab3e0dcd0d..14e43d62ff 100644 --- a/src/apps/debugger/settings/GUITeamUISettings.h +++ b/src/apps/debugger/settings/GUITeamUISettings.h @@ -17,12 +17,14 @@ class BMessage; class GUITeamUISettings : public TeamUISettings { public: + GUITeamUISettings(); GUITeamUISettings(const char* settingsID); GUITeamUISettings(const GUITeamUISettings& other); // throws std::bad_alloc ~GUITeamUISettings(); + virtual team_ui_settings_type Type() const; virtual const char* ID() const; virtual status_t SetTo(const BMessage& archive); virtual status_t WriteTo(BMessage& archive) const; diff --git a/src/apps/debugger/settings/TeamSettings.cpp b/src/apps/debugger/settings/TeamSettings.cpp index d94448328a..a7bf81ad36 100644 --- a/src/apps/debugger/settings/TeamSettings.cpp +++ b/src/apps/debugger/settings/TeamSettings.cpp @@ -16,6 +16,7 @@ #include "BreakpointSetting.h" #include "Team.h" #include "TeamUISettings.h" +#include "TeamUISettingsFactory.h" #include "UserBreakpoint.h" @@ -103,7 +104,14 @@ TeamSettings::SetTo(const BMessage& archive) // add UI settings for (int32 i = 0; archive.FindMessage("uisettings", i, &childArchive) == B_OK; i++) { - + TeamUISettings* setting = NULL; + error = TeamUISettingsFactory::Create(childArchive, setting); + if (error == B_OK && !fUISettings.AddItem(setting)) + error = B_NO_MEMORY; + if (error != B_OK) { + delete setting; + return error; + } } return B_OK; @@ -117,9 +125,9 @@ TeamSettings::WriteTo(BMessage& archive) const if (error != B_OK) return error; + BMessage childArchive; for (int32 i = 0; BreakpointSetting* breakpoint = fBreakpoints.ItemAt(i); i++) { - BMessage childArchive; error = breakpoint->WriteTo(childArchive); if (error != B_OK) return error; @@ -128,6 +136,17 @@ TeamSettings::WriteTo(BMessage& archive) const if (error != B_OK) return error; } + + for (int32 i = 0; TeamUISettings* uiSetting = fUISettings.ItemAt(i); + i++) { + error = uiSetting->WriteTo(childArchive); + if (error != B_OK) + return error; + + error = archive.AddMessage("uisettings", &childArchive); + if (error != B_OK) + return error; + } return B_OK; } diff --git a/src/apps/debugger/settings/TeamUISettings.h b/src/apps/debugger/settings/TeamUISettings.h index 201fb83b36..06913d7b39 100644 --- a/src/apps/debugger/settings/TeamUISettings.h +++ b/src/apps/debugger/settings/TeamUISettings.h @@ -12,11 +12,18 @@ class BMessage; +enum team_ui_settings_type { + TEAM_UI_SETTINGS_TYPE_GUI, + TEAM_UI_SETTINGS_TYPE_CLI +}; + + class TeamUISettings { public: TeamUISettings(); virtual ~TeamUISettings(); + virtual team_ui_settings_type Type() const = 0; virtual const char* ID() const = 0; virtual status_t SetTo(const BMessage& archive) = 0; virtual status_t WriteTo(BMessage& archive) const = 0; diff --git a/src/apps/debugger/settings/TeamUISettingsFactory.cpp b/src/apps/debugger/settings/TeamUISettingsFactory.cpp new file mode 100644 index 0000000000..4651e8c383 --- /dev/null +++ b/src/apps/debugger/settings/TeamUISettingsFactory.cpp @@ -0,0 +1,56 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ + +#include "TeamUISettingsFactory.h" + +#include + +#include "GUITeamUISettings.h" + + +TeamUISettingsFactory::TeamUISettingsFactory() +{ +} + + +TeamUISettingsFactory::~TeamUISettingsFactory() +{ +} + + +status_t +TeamUISettingsFactory::Create(const BMessage& archive, TeamUISettings*& + settings) +{ + int32 type; + status_t error = archive.FindInt32("type", &type); + if (error != B_OK) + return error; + + switch (type) { + case TEAM_UI_SETTINGS_TYPE_GUI: + settings = new(std::nothrow) GUITeamUISettings(); + if (settings == NULL) + return B_NO_MEMORY; + + error = settings->SetTo(archive); + if (error != B_OK) { + delete settings; + settings = NULL; + return error; + } + break; + + case TEAM_UI_SETTINGS_TYPE_CLI: + // TODO: implement once we have a CLI interface + // (and corresponding settings) + return B_UNSUPPORTED; + + default: + return B_BAD_DATA; + } + + return B_OK; +} diff --git a/src/apps/debugger/settings/TeamUISettingsFactory.h b/src/apps/debugger/settings/TeamUISettingsFactory.h new file mode 100644 index 0000000000..40054db462 --- /dev/null +++ b/src/apps/debugger/settings/TeamUISettingsFactory.h @@ -0,0 +1,24 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef TEAM_UI_SETTINGS_FACTORY_H +#define TEAM_UI_SETTINGS_FACTORY_H + + +#include + + +class BMessage; +class TeamUISettings; + +class TeamUISettingsFactory { +public: + TeamUISettingsFactory(); + ~TeamUISettingsFactory(); + + static status_t Create(const BMessage& archive, + TeamUISettings*& settings); +}; + +#endif // TEAM_UI_SETTINGS_FACTORY_H From 485bb14c36312aeeb73b25f8f389cb401ed1abbf Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 1 Nov 2011 16:29:28 +0000 Subject: [PATCH 603/702] Prefix the heap version of the "allocations" debugger command with "heap_". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43068 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/heap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/heap.cpp b/src/system/kernel/heap.cpp index 19e9e0966b..49cd2edbab 100644 --- a/src/system/kernel/heap.cpp +++ b/src/system/kernel/heap.cpp @@ -2202,7 +2202,7 @@ heap_init_post_thread() "Dump infos about the specified kernel heap. If \"stats\" is given\n" "as the argument, currently only the heap count is printed.\n", 0); #if !KERNEL_HEAP_LEAK_CHECK - add_debugger_command_etc("allocations", &dump_allocations, + add_debugger_command_etc("heap_allocations", &dump_allocations, "Dump current heap allocations", "[\"stats\"] \n" "If the optional argument \"stats\" is specified, only the allocation\n" From 506a6eb522d36d618bc4cacfae814b8222d120c2 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 1 Nov 2011 16:58:35 +0000 Subject: [PATCH 604/702] Fix delay loop condition in BPushGamesound test. It seems to work mostly fine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43069 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../push_game_sound_test/push_game_sound_test.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tests/kits/game/push_game_sound_test/push_game_sound_test.cpp b/src/tests/kits/game/push_game_sound_test/push_game_sound_test.cpp index f48b7044e5..3ebf3dbbbf 100644 --- a/src/tests/kits/game/push_game_sound_test/push_game_sound_test.cpp +++ b/src/tests/kits/game/push_game_sound_test/push_game_sound_test.cpp @@ -127,7 +127,7 @@ main(int argc, char *argv[]) & media_raw_audio_format::B_AUDIO_SIZE_MASK); size_t decodedSize = 0; size_t partPos = 0; - size_t pos = pushGameSound.CurrentPosition(); + size_t pos = 0; /*pushGameSound.CurrentPosition();*/ key_info keyInfo; while (true) { @@ -159,6 +159,7 @@ main(int argc, char *argv[]) printf("\rtime: %.2f", (double)mediaTrack->CurrentTime() / 1000000LL); fflush(stdout); + continue; } @@ -168,9 +169,11 @@ main(int argc, char *argv[]) if (bufferSize <= pos) pos = 0; - // playback sync - while (pushGameSound.CurrentPosition() == pos) - snooze(100); + // playback sync - wait for the buffer part we're about to fill to be + // played + while (pushGameSound.CurrentPosition() >= pos + bufferPartSize + || pushGameSound.CurrentPosition() < pos) + snooze(1000 * framesPerBufferPart / gsFormat.frame_rate); // check escape key state if (get_key_info(&keyInfo) != B_OK) { From 69d7ad7dc5b8d1281aa8f19e2d0347b3721b96a6 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 17:16:29 +0000 Subject: [PATCH 605/702] mmlr + bonefish: * Move struct tracing_stack_trace to tracing.h header. * Add tracing_find_caller_in_stack_trace(). Helper function to get the first return address of a stack trace that is not in one of the given address ranges. * Add AbstractTracingEntryWithStackTrace::StackTrace() getter. * Add tracing_is_entry_valid(). Checks, based on the additionally given time, whether a tracing entry is (probably) still in the tracing buffer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43070 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/tracing.h | 19 ++++++++++- src/system/kernel/debug/tracing.cpp | 50 +++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/headers/private/kernel/tracing.h b/headers/private/kernel/tracing.h index 52f0cf5c93..49999b1b9b 100644 --- a/headers/private/kernel/tracing.h +++ b/headers/private/kernel/tracing.h @@ -21,7 +21,11 @@ struct trace_entry { uint32 flags : 6; }; -struct tracing_stack_trace; +struct tracing_stack_trace { + int32 depth; + addr_t return_addresses[0]; +}; + #ifdef __cplusplus @@ -134,6 +138,11 @@ public: virtual void DumpStackTrace(TraceOutput& out); + tracing_stack_trace* StackTrace() const + { + return fStackTrace; + } + protected: typedef AbstractTraceEntryWithStackTrace TraceEntryBase; @@ -244,8 +253,11 @@ private: int dump_tracing(int argc, char** argv, WrapperTraceFilter* wrapperFilter); +bool tracing_is_entry_valid(TraceEntry* entry, bigtime_t entryTime); + #endif // __cplusplus + #ifdef __cplusplus extern "C" { #endif @@ -254,8 +266,13 @@ uint8* alloc_tracing_buffer(size_t size); uint8* alloc_tracing_buffer_memcpy(const void* source, size_t size, bool user); char* alloc_tracing_buffer_strcpy(const char* source, size_t maxSize, bool user); + struct tracing_stack_trace* capture_tracing_stack_trace(int32 maxCount, int32 skipFrames, bool kernelOnly); +addr_t tracing_find_caller_in_stack_trace( + struct tracing_stack_trace* stackTrace, const addr_t excludeRanges[], + uint32 excludeRangeCount); + void lock_tracing_buffer(); void unlock_tracing_buffer(); status_t tracing_init(void); diff --git a/src/system/kernel/debug/tracing.cpp b/src/system/kernel/debug/tracing.cpp index 7d487f5e11..45861833f6 100644 --- a/src/system/kernel/debug/tracing.cpp +++ b/src/system/kernel/debug/tracing.cpp @@ -23,12 +23,6 @@ #include -struct tracing_stack_trace { - int32 depth; - addr_t return_addresses[0]; -}; - - #if ENABLE_TRACING //#define TRACE_TRACING @@ -1616,6 +1610,30 @@ capture_tracing_stack_trace(int32 maxCount, int32 skipFrames, bool kernelOnly) } +addr_t +tracing_find_caller_in_stack_trace(struct tracing_stack_trace* stackTrace, + const addr_t excludeRanges[], uint32 excludeRangeCount) +{ + for (int32 i = 0; i < stackTrace->depth; i++) { + addr_t returnAddress = stackTrace->return_addresses[i]; + + bool inRange = false; + for (uint32 j = 0; j < excludeRangeCount; j++) { + if (returnAddress >= excludeRanges[j * 2 + 0] + && returnAddress < excludeRanges[j * 2 + 1]) { + inRange = true; + break; + } + } + + if (!inRange) + return returnAddress; + } + + return 0; +} + + int dump_tracing(int argc, char** argv, WrapperTraceFilter* wrapperFilter) { @@ -1627,6 +1645,26 @@ dump_tracing(int argc, char** argv, WrapperTraceFilter* wrapperFilter) } +bool +tracing_is_entry_valid(TraceEntry* candidate, bigtime_t entryTime) +{ +#if ENABLE_TRACING + TraceEntryIterator iterator; + while (TraceEntry* entry = iterator.Next()) { + AbstractTraceEntry* abstract = dynamic_cast(entry); + if (abstract == NULL) + continue; + + // TODO: This could be better by additionally checking if the + // candidate entry address falls within the valid entry range. + return abstract == candidate || abstract->Time() < entryTime; + } +#endif + + return false; +} + + void lock_tracing_buffer() { From 97ac7257f656cba2ffba7fcefae6cad0cd41efb6 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 17:19:26 +0000 Subject: [PATCH 606/702] mmlr + bonefish: Add helper macros for placing markers in the source, so we can get the address ranges of code we're interested in. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43071 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/debug.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/headers/private/kernel/debug.h b/headers/private/kernel/debug.h index 051a62dbed..5cca136b9b 100644 --- a/headers/private/kernel/debug.h +++ b/headers/private/kernel/debug.h @@ -82,6 +82,25 @@ # define KDEBUG_ONLY(x) /* nothing */ #endif + +// Macros for for placing marker functions. They can be used to mark the +// beginning and end of code sections (e.g. used in the slab code). +#define RANGE_MARKER_FUNCTION(functionName) \ + void functionName() {} +#define RANGE_MARKER_FUNCTION_BEGIN(scope) \ + RANGE_MARKER_FUNCTION(scope##_begin) +#define RANGE_MARKER_FUNCTION_END(scope) \ + RANGE_MARKER_FUNCTION(scope##_end) + +#define RANGE_MARKER_FUNCTION_PROTOTYPE(functionName) \ + void functionName(); +#define RANGE_MARKER_FUNCTION_PROTOTYPES(scope) \ + RANGE_MARKER_FUNCTION_PROTOTYPE(scope##_begin) \ + RANGE_MARKER_FUNCTION_PROTOTYPE(scope##_end) +#define RANGE_MARKER_FUNCTION_ADDRESS_RANGE(scope) \ + (addr_t)&scope##_begin, (addr_t)&scope##_end + + // command return value #define B_KDEBUG_ERROR 4 #define B_KDEBUG_RESTART_PIPE 5 From e1c6140eaa641aa95fc6d82f0d5c53cf4fe41a16 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 18:34:21 +0000 Subject: [PATCH 607/702] mmlr + bonefish: * Add optional stack trace capturing for slab memory manager tracing. * Add allocation tracking for the slab allocator (enabled via SLAB_ALLOCATION_TRACKING). The allocation tracking requires tracing with stack traces to be enabled for object caches and/or the memory manager. - Add class AllocationTrackingInfo that associates an allocation with its respective tracing entry. The structure is added to the end of an allocation done by the memory manager. For the object caches there's a separate array for each slab. - Add code range markers to the slab code, so that the first caller into the slab code can be retrieved from the stack traces. - Add KDL command "allocations_per_caller" that lists all allocations summarized by caller. * Move debug definitions from slab_private.h to slab_debug.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43072 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/config_headers/kernel_debug_config.h | 5 +- build/config_headers/tracing_config.h | 1 + src/system/kernel/slab/HashedObjectCache.cpp | 17 +- src/system/kernel/slab/MemoryManager.cpp | 43 ++- src/system/kernel/slab/MemoryManager.h | 9 + src/system/kernel/slab/ObjectCache.cpp | 45 ++++ src/system/kernel/slab/ObjectCache.h | 32 +++ src/system/kernel/slab/ObjectDepot.cpp | 7 + src/system/kernel/slab/Slab.cpp | 264 ++++++++++++++++++- src/system/kernel/slab/SmallObjectCache.cpp | 17 +- src/system/kernel/slab/allocator.cpp | 6 + src/system/kernel/slab/slab_debug.h | 135 ++++++++++ src/system/kernel/slab/slab_private.h | 59 ----- 13 files changed, 571 insertions(+), 69 deletions(-) create mode 100644 src/system/kernel/slab/slab_debug.h diff --git a/build/config_headers/kernel_debug_config.h b/build/config_headers/kernel_debug_config.h index 26add874c4..d8370bbc61 100644 --- a/build/config_headers/kernel_debug_config.h +++ b/build/config_headers/kernel_debug_config.h @@ -42,7 +42,7 @@ #define DEBUG_FILE_MAP KDEBUG_LEVEL_1 -// heap +// heap / slab // Initialize newly allocated memory with something non zero. #define PARANOID_KERNEL_MALLOC KDEBUG_LEVEL_2 @@ -57,6 +57,9 @@ // Enables the "allocations*" debugger commands. #define KERNEL_HEAP_LEAK_CHECK 0 +// Enables the "allocations*" debugger commands for the slab. +#define SLAB_ALLOCATION_TRACKING 0 + // interrupts diff --git a/build/config_headers/tracing_config.h b/build/config_headers/tracing_config.h index 5f1da44232..85717d7f4a 100644 --- a/build/config_headers/tracing_config.h +++ b/build/config_headers/tracing_config.h @@ -47,6 +47,7 @@ #define SCHEDULING_ANALYSIS_TRACING 0 #define SIGNAL_TRACING 0 #define SLAB_MEMORY_MANAGER_TRACING 0 +#define SLAB_MEMORY_MANAGER_TRACING_STACK_TRACE 0 /* stack trace depth */ #define SLAB_OBJECT_CACHE_TRACING 0 #define SLAB_OBJECT_CACHE_TRACING_STACK_TRACE 0 /* stack trace depth */ #define SWAP_TRACING 0 diff --git a/src/system/kernel/slab/HashedObjectCache.cpp b/src/system/kernel/slab/HashedObjectCache.cpp index 5d2bc68a56..0d8dc20b1b 100644 --- a/src/system/kernel/slab/HashedObjectCache.cpp +++ b/src/system/kernel/slab/HashedObjectCache.cpp @@ -12,6 +12,9 @@ #include "slab_private.h" +RANGE_MARKER_FUNCTION_BEGIN(SlabHashedObjectCache) + + static inline int __fls0(size_t value) { @@ -109,8 +112,9 @@ HashedObjectCache::CreateSlab(uint32 flags) HashedSlab* slab = allocate_slab(flags); if (slab != NULL) { - void* pages; - if (MemoryManager::Allocate(this, flags, pages) == B_OK) { + void* pages = NULL; + if (MemoryManager::Allocate(this, flags, pages) == B_OK + && AllocateTrackingInfos(slab, slab_size, flags) == B_OK) { Lock(); if (InitSlab(slab, pages, slab_size, flags)) { hash_table.InsertUnchecked(slab); @@ -118,9 +122,12 @@ HashedObjectCache::CreateSlab(uint32 flags) return slab; } Unlock(); - MemoryManager::Free(pages, flags); + FreeTrackingInfos(slab, flags); } + if (pages != NULL) + MemoryManager::Free(pages, flags); + free_slab(slab, flags); } @@ -140,6 +147,7 @@ HashedObjectCache::ReturnSlab(slab* _slab, uint32 flags) UninitSlab(slab); Unlock(); + FreeTrackingInfos(slab, flags); MemoryManager::Free(slab->pages, flags); free_slab(slab, flags); Lock(); @@ -180,3 +188,6 @@ HashedObjectCache::_ResizeHashTableIfNeeded(uint32 flags) } } } + + +RANGE_MARKER_FUNCTION_END(SlabHashedObjectCache) diff --git a/src/system/kernel/slab/MemoryManager.cpp b/src/system/kernel/slab/MemoryManager.cpp index 0c8dcdfdb2..a44bcb6869 100644 --- a/src/system/kernel/slab/MemoryManager.cpp +++ b/src/system/kernel/slab/MemoryManager.cpp @@ -22,6 +22,7 @@ #include "kernel_debug_config.h" #include "ObjectCache.h" +#include "slab_debug.h" #include "slab_private.h" @@ -58,6 +59,9 @@ MemoryManager::AllocationEntry* MemoryManager::sAllocationEntryDontWait; bool MemoryManager::sMaintenanceNeeded; +RANGE_MARKER_FUNCTION_BEGIN(SlabMemoryManager) + + // #pragma mark - kernel tracing @@ -67,9 +71,12 @@ bool MemoryManager::sMaintenanceNeeded; //namespace SlabMemoryManagerCacheTracing { struct MemoryManager::Tracing { -class MemoryManagerTraceEntry : public AbstractTraceEntry { +class MemoryManagerTraceEntry + : public TRACE_ENTRY_SELECTOR(SLAB_MEMORY_MANAGER_TRACING_STACK_TRACE) { public: MemoryManagerTraceEntry() + : + TraceEntryBase(SLAB_MEMORY_MANAGER_TRACING_STACK_TRACE, 0, true) { } }; @@ -592,7 +599,14 @@ MemoryManager::Free(void* pages, uint32 flags) /*static*/ status_t MemoryManager::AllocateRaw(size_t size, uint32 flags, void*& _pages) { +#if SLAB_MEMORY_MANAGER_TRACING +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + AbstractTraceEntryWithStackTrace* traceEntry = T(AllocateRaw(size, flags)); + size += sizeof(AllocationTrackingInfo); +#else T(AllocateRaw(size, flags)); +#endif +#endif size = ROUNDUP(size, SLAB_CHUNK_SIZE_SMALL); @@ -619,8 +633,13 @@ MemoryManager::AllocateRaw(size_t size, uint32 flags, void*& _pages) &virtualRestrictions, &physicalRestrictions, &_pages); status_t result = area >= 0 ? B_OK : area; - if (result == B_OK) + if (result == B_OK) { fill_allocated_block(_pages, size); +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + _AddTrackingInfo(_pages, size, traceEntry); +#endif + } + return result; } @@ -661,6 +680,9 @@ MemoryManager::AllocateRaw(size_t size, uint32 flags, void*& _pages) _pages = (void*)chunkAddress; fill_allocated_block(_pages, size); +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + _AddTrackingInfo(_pages, size, traceEntry); +#endif TRACE("MemoryManager::AllocateRaw() done: %p (meta chunk: %d, chunk %d)\n", _pages, int(metaChunk - area->metaChunks), @@ -1959,3 +1981,20 @@ MemoryManager::_DumpAreas(int argc, char** argv) return 0; } + + +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + +void +MemoryManager::_AddTrackingInfo(void* allocation, size_t size, + AbstractTraceEntryWithStackTrace* traceEntry) +{ + AllocationTrackingInfo* info = (AllocationTrackingInfo*) + ((uint8*)allocation + size - sizeof(AllocationTrackingInfo)); + info->Init(traceEntry); +} + +#endif // SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + + +RANGE_MARKER_FUNCTION_END(SlabMemoryManager) diff --git a/src/system/kernel/slab/MemoryManager.h b/src/system/kernel/slab/MemoryManager.h index a8a6040da1..f1fbcdbd7d 100644 --- a/src/system/kernel/slab/MemoryManager.h +++ b/src/system/kernel/slab/MemoryManager.h @@ -14,7 +14,11 @@ #include #include +#include "kernel_debug_config.h" +#include "tracing_config.h" + +class AbstractTraceEntryWithStackTrace; struct kernel_args; struct ObjectCache; struct VMArea; @@ -191,6 +195,11 @@ private: static int _DumpArea(int argc, char** argv); static int _DumpAreas(int argc, char** argv); +#if SLAB_ALLOCATION_TRACKING && SLAB_MEMORY_MANAGER_TRACING + static void _AddTrackingInfo(void* allocation, size_t size, + AbstractTraceEntryWithStackTrace* entry); +#endif + private: static const size_t kAreaAdminSize = ROUNDUP(sizeof(Area), B_PAGE_SIZE); diff --git a/src/system/kernel/slab/ObjectCache.cpp b/src/system/kernel/slab/ObjectCache.cpp index 8f1822a4aa..a68c2ce521 100644 --- a/src/system/kernel/slab/ObjectCache.cpp +++ b/src/system/kernel/slab/ObjectCache.cpp @@ -14,9 +14,13 @@ #include #include +#include "MemoryManager.h" #include "slab_private.h" +RANGE_MARKER_FUNCTION_BEGIN(SlabObjectCache) + + static void object_cache_return_object_wrapper(object_depot* depot, void* cookie, void* object, uint32 flags) @@ -137,6 +141,7 @@ ObjectCache::InitSlab(slab* slab, void* pages, size_t byteCount, uint32 flags) CREATE_PARANOIA_CHECK_SET(slab, "slab"); + for (size_t i = 0; i < slab->size; i++) { status_t status = B_OK; if (constructor) @@ -267,3 +272,43 @@ ObjectCache::AssertObjectNotFreed(void* object) } #endif // PARANOID_KERNEL_FREE + + +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + +status_t +ObjectCache::AllocateTrackingInfos(slab* slab, size_t byteCount, uint32 flags) +{ + void* pages; + size_t objectCount = byteCount / object_size; + status_t result = MemoryManager::AllocateRaw( + objectCount * sizeof(AllocationTrackingInfo), flags, pages); + if (result == B_OK) { + slab->tracking = (AllocationTrackingInfo*)pages; + for (size_t i = 0; i < objectCount; i++) + slab->tracking[i].Clear(); + } + + return result; +} + + +void +ObjectCache::FreeTrackingInfos(slab* slab, uint32 flags) +{ + MemoryManager::FreeRawOrReturnCache(slab->tracking, flags); +} + + +AllocationTrackingInfo* +ObjectCache::TrackingInfoFor(void* object) const +{ + slab* objectSlab = ObjectSlab(object); + return &objectSlab->tracking[((addr_t)object - objectSlab->offset + - (addr_t)objectSlab->pages) / object_size]; +} + +#endif // SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + + +RANGE_MARKER_FUNCTION_END(SlabObjectCache) diff --git a/src/system/kernel/slab/ObjectCache.h b/src/system/kernel/slab/ObjectCache.h index 498256edad..1c45c96c9b 100644 --- a/src/system/kernel/slab/ObjectCache.h +++ b/src/system/kernel/slab/ObjectCache.h @@ -14,7 +14,11 @@ #include #include +#include "kernel_debug_config.h" +#include "slab_debug.h" + +class AllocationTrackingInfo; struct ResizeRequest; @@ -28,6 +32,9 @@ struct slab : DoublyLinkedListLinkImpl { size_t count; // free objects size_t offset; object_link* free; +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + AllocationTrackingInfo* tracking; +#endif }; typedef DoublyLinkedList SlabList; @@ -111,6 +118,15 @@ public: #if PARANOID_KERNEL_FREE bool AssertObjectNotFreed(void* object); #endif + + status_t AllocateTrackingInfos(slab* slab, + size_t byteCount, uint32 flags); + void FreeTrackingInfos(slab* slab, uint32 flags); + +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + AllocationTrackingInfo* + TrackingInfoFor(void* object) const; +#endif }; @@ -146,4 +162,20 @@ check_cache_quota(ObjectCache* cache) } +#if !SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + +inline status_t +ObjectCache::AllocateTrackingInfos(slab* slab, size_t byteCount, uint32 flags) +{ + return B_OK; +} + + +inline void +ObjectCache::FreeTrackingInfos(slab* slab, uint32 flags) +{ +} + +#endif // !SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + #endif // OBJECT_CACHE_H diff --git a/src/system/kernel/slab/ObjectDepot.cpp b/src/system/kernel/slab/ObjectDepot.cpp index e8a890edbc..702b624461 100644 --- a/src/system/kernel/slab/ObjectDepot.cpp +++ b/src/system/kernel/slab/ObjectDepot.cpp @@ -16,6 +16,7 @@ #include #include +#include "slab_debug.h" #include "slab_private.h" @@ -44,6 +45,9 @@ struct depot_cpu_store { }; +RANGE_MARKER_FUNCTION_BEGIN(SlabObjectDepot) + + bool DepotMagazine::IsEmpty() const { @@ -458,3 +462,6 @@ dump_depot_magazine(int argCount, char** args) return 0; } + + +RANGE_MARKER_FUNCTION_END(SlabObjectDepot) diff --git a/src/system/kernel/slab/Slab.cpp b/src/system/kernel/slab/Slab.cpp index 12f02f6d3d..093c1780e1 100644 --- a/src/system/kernel/slab/Slab.cpp +++ b/src/system/kernel/slab/Slab.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include "HashedObjectCache.h" #include "MemoryManager.h" +#include "slab_debug.h" #include "slab_private.h" #include "SmallObjectCache.h" @@ -49,6 +51,47 @@ static MaintenanceQueue sMaintenanceQueue; static ConditionVariable sMaintenanceCondition; +#if SLAB_ALLOCATION_TRACKING_AVAILABLE + +struct caller_info { + addr_t caller; + size_t count; + size_t size; +}; + +static const int32 kCallerInfoTableSize = 1024; +static caller_info sCallerInfoTable[kCallerInfoTableSize]; +static int32 sCallerInfoCount = 0; + + +RANGE_MARKER_FUNCTION_PROTOTYPES(slab_allocator) +RANGE_MARKER_FUNCTION_PROTOTYPES(SlabHashedObjectCache) +RANGE_MARKER_FUNCTION_PROTOTYPES(SlabMemoryManager) +RANGE_MARKER_FUNCTION_PROTOTYPES(SlabObjectCache) +RANGE_MARKER_FUNCTION_PROTOTYPES(SlabObjectDepot) +RANGE_MARKER_FUNCTION_PROTOTYPES(Slab) +RANGE_MARKER_FUNCTION_PROTOTYPES(SlabSmallObjectCache) + + +static const addr_t kSlabCodeAddressRanges[] = { + RANGE_MARKER_FUNCTION_ADDRESS_RANGE(slab_allocator), + RANGE_MARKER_FUNCTION_ADDRESS_RANGE(SlabHashedObjectCache), + RANGE_MARKER_FUNCTION_ADDRESS_RANGE(SlabMemoryManager), + RANGE_MARKER_FUNCTION_ADDRESS_RANGE(SlabObjectCache), + RANGE_MARKER_FUNCTION_ADDRESS_RANGE(SlabObjectDepot), + RANGE_MARKER_FUNCTION_ADDRESS_RANGE(Slab), + RANGE_MARKER_FUNCTION_ADDRESS_RANGE(SlabSmallObjectCache) +}; + +static const uint32 kSlabCodeAddressRangeCount + = sizeof(kSlabCodeAddressRanges) / sizeof(kSlabCodeAddressRanges[0]) / 2; + +#endif // SLAB_ALLOCATION_TRACKING_AVAILABLE + + +RANGE_MARKER_FUNCTION_BEGIN(Slab) + + #if SLAB_OBJECT_CACHE_TRACING @@ -284,6 +327,205 @@ dump_cache_info(int argc, char* argv[]) } +#if SLAB_ALLOCATION_TRACKING_AVAILABLE + +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + // until memory manager tracking is analyzed + +static caller_info* +get_caller_info(addr_t caller) +{ + // find the caller info + for (int32 i = 0; i < sCallerInfoCount; i++) { + if (caller == sCallerInfoTable[i].caller) + return &sCallerInfoTable[i]; + } + + // not found, add a new entry, if there are free slots + if (sCallerInfoCount >= kCallerInfoTableSize) + return NULL; + + caller_info* info = &sCallerInfoTable[sCallerInfoCount++]; + info->caller = caller; + info->count = 0; + info->size = 0; + + return info; +} + +#endif // SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + + +static int +caller_info_compare_size(const void* _a, const void* _b) +{ + const caller_info* a = (const caller_info*)_a; + const caller_info* b = (const caller_info*)_b; + return (int)(b->size - a->size); +} + + +static int +caller_info_compare_count(const void* _a, const void* _b) +{ + const caller_info* a = (const caller_info*)_a; + const caller_info* b = (const caller_info*)_b; + return (int)(b->count - a->count); +} + + +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + +static bool +analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList, + size_t& _totalAllocationSize, size_t& _totalAllocationCount) +{ + for (SlabList::ConstIterator it = slabList.GetIterator(); + slab* slab = it.Next();) { + for (uint32 i = 0; i < slab->size; i++) { + AllocationTrackingInfo* info = &slab->tracking[i]; + if (!info->IsInitialized()) + continue; + + _totalAllocationSize += cache->object_size; + _totalAllocationCount++; + + addr_t caller = 0; + AbstractTraceEntryWithStackTrace* traceEntry = info->TraceEntry(); + + if (traceEntry != NULL && info->IsTraceEntryValid()) { + caller = tracing_find_caller_in_stack_trace( + traceEntry->StackTrace(), kSlabCodeAddressRanges, + kSlabCodeAddressRangeCount); + } + + caller_info* callerInfo = get_caller_info(caller); + if (callerInfo == NULL) { + kprintf("out of space for caller infos\n"); + return false; + } + + callerInfo->count++; + callerInfo->size += cache->object_size; + } + } + + return true; +} + + +static bool +analyze_allocation_callers(ObjectCache* cache, size_t& _totalAllocationSize, + size_t& _totalAllocationCount) +{ + return analyze_allocation_callers(cache, cache->full, _totalAllocationSize, + _totalAllocationCount) + && analyze_allocation_callers(cache, cache->partial, + _totalAllocationSize, _totalAllocationCount); +} + +#endif // SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + + +static int +dump_allocations_per_caller(int argc, char **argv) +{ + bool sortBySize = true; + ObjectCache* cache = NULL; + + for (int32 i = 1; i < argc; i++) { + if (strcmp(argv[i], "-c") == 0) { + sortBySize = false; + } else if (strcmp(argv[i], "-o") == 0) { + uint64 cacheAddress; + if (++i >= argc + || !evaluate_debug_expression(argv[i], &cacheAddress, true)) { + print_debugger_command_usage(argv[0]); + return 0; + } + + cache = (ObjectCache*)(addr_t)cacheAddress; + } else { + print_debugger_command_usage(argv[0]); + return 0; + } + } + + sCallerInfoCount = 0; + + size_t totalAllocationSize = 0; + size_t totalAllocationCount = 0; + if (cache != NULL) { +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + analyze_allocation_callers(cache, totalAllocationSize, + totalAllocationCount); +#else + kprintf("Object cache allocation tracking not available. " + "SLAB_OBJECT_CACHE_TRACING (%d) and " + "SLAB_OBJECT_CACHE_TRACING_STACK_TRACE (%d) must be enabled.\n", + SLAB_OBJECT_CACHE_TRACING, SLAB_OBJECT_CACHE_TRACING_STACK_TRACE); + return 0; +#endif + } else { +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + ObjectCacheList::Iterator it = sObjectCaches.GetIterator(); + + while (it.HasNext()) { + analyze_allocation_callers(it.Next(), totalAllocationSize, + totalAllocationCount); + } +#endif + } + + // sort the array + qsort(sCallerInfoTable, sCallerInfoCount, sizeof(caller_info), + sortBySize ? &caller_info_compare_size : &caller_info_compare_count); + + kprintf("%ld different callers, sorted by %s...\n\n", sCallerInfoCount, + sortBySize ? "size" : "count"); + + kprintf(" count size caller\n"); + kprintf("----------------------------------\n"); + for (int32 i = 0; i < sCallerInfoCount; i++) { + caller_info& info = sCallerInfoTable[i]; + kprintf("%10" B_PRIuSIZE " %10" B_PRIuSIZE " %p", info.count, + info.size, (void*)info.caller); + + const char *symbol; + const char *imageName; + bool exactMatch; + addr_t baseAddress; + + if (elf_debug_lookup_symbol_address(info.caller, &baseAddress, &symbol, + &imageName, &exactMatch) == B_OK) { + kprintf(" %s + %#" B_PRIxADDR " (%s)%s\n", symbol, + info.caller - baseAddress, imageName, + exactMatch ? "" : " (nearest)"); + } else + kprintf("\n"); + } + + kprintf("\ntotal allocations: %" B_PRIuSIZE ", %" B_PRIuSIZE " bytes\n", + totalAllocationCount, totalAllocationSize); + + return 0; +} + +#endif // SLAB_ALLOCATION_TRACKING_AVAILABLE + + +void +add_alloc_tracing_entry(ObjectCache* cache, uint32 flags, void* object) +{ +#if SLAB_OBJECT_CACHE_TRACING +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + cache->TrackingInfoFor(object)->Init(T(Alloc(cache, flags, object))); +#else + T(Alloc(cache, flags, object)); +#endif +#endif +} + // #pragma mark - @@ -669,7 +911,7 @@ object_cache_alloc(object_cache* cache, uint32 flags) if (!(cache->flags & CACHE_NO_DEPOT)) { void* object = object_depot_obtain(&cache->depot); if (object) { - T(Alloc(cache, flags, object)); + add_alloc_tracing_entry(cache, flags, object); return fill_allocated_block(object, cache->object_size); } } @@ -718,7 +960,7 @@ object_cache_alloc(object_cache* cache, uint32 flags) } void* object = link_to_object(link, cache->object_size); - T(Alloc(cache, flags, object)); + add_alloc_tracing_entry(cache, flags, object); return fill_allocated_block(object, cache->object_size); } @@ -748,6 +990,10 @@ object_cache_free(object_cache* cache, void* object, uint32 flags) fill_freed_block(object, cache->object_size); #endif +#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING + cache->TrackingInfoFor(object)->Clear(); +#endif + if ((cache->flags & CACHE_NO_DEPOT) == 0) { object_depot_store(&cache->depot, object, flags); return; @@ -802,6 +1048,17 @@ slab_init_post_area() "dump contents of an object depot"); add_debugger_command("slab_magazine", dump_depot_magazine, "dump contents of a depot magazine"); +#if SLAB_ALLOCATION_TRACKING_AVAILABLE + add_debugger_command_etc("allocations_per_caller", + &dump_allocations_per_caller, + "Dump current heap allocations summed up per caller", + "[ \"-c\" ] [ -o ]\n" + "The current allocations will by summed up by caller (their count and\n" + "size) printed in decreasing order by size or, if \"-c\" is\n" + "specified, by allocation count. If given specifies\n" + "the address of the object cache for which to print the allocations.\n", + 0); +#endif // SLAB_ALLOCATION_TRACKING_AVAILABLE } @@ -832,3 +1089,6 @@ slab_init_post_thread() resume_thread(objectCacheResizer); } + + +RANGE_MARKER_FUNCTION_END(Slab) diff --git a/src/system/kernel/slab/SmallObjectCache.cpp b/src/system/kernel/slab/SmallObjectCache.cpp index 8b0f3ee511..7953ceaa71 100644 --- a/src/system/kernel/slab/SmallObjectCache.cpp +++ b/src/system/kernel/slab/SmallObjectCache.cpp @@ -12,6 +12,9 @@ #include "slab_private.h" +RANGE_MARKER_FUNCTION_BEGIN(SlabSmallObjectCache) + + static inline slab * slab_in_pages(const void *pages, size_t slab_size) { @@ -73,8 +76,14 @@ SmallObjectCache::CreateSlab(uint32 flags) if (error != B_OK) return NULL; - return InitSlab(slab_in_pages(pages, slab_size), pages, - slab_size - sizeof(slab), flags); + slab* newSlab = slab_in_pages(pages, slab_size); + size_t byteCount = slab_size - sizeof(slab); + if (AllocateTrackingInfos(newSlab, byteCount, flags) != B_OK) { + MemoryManager::Free(pages, flags); + return NULL; + } + + return InitSlab(newSlab, pages, byteCount, flags); } @@ -84,6 +93,7 @@ SmallObjectCache::ReturnSlab(slab* slab, uint32 flags) UninitSlab(slab); Unlock(); + FreeTrackingInfos(slab, flags); MemoryManager::Free(slab->pages, flags); Lock(); } @@ -94,3 +104,6 @@ SmallObjectCache::ObjectSlab(void* object) const { return slab_in_pages(lower_boundary(object, slab_size), slab_size); } + + +RANGE_MARKER_FUNCTION_END(SlabSmallObjectCache) diff --git a/src/system/kernel/slab/allocator.cpp b/src/system/kernel/slab/allocator.cpp index 3fae1fb88e..e863991897 100644 --- a/src/system/kernel/slab/allocator.cpp +++ b/src/system/kernel/slab/allocator.cpp @@ -44,6 +44,9 @@ static size_t sBootStrapMemorySize = 0; static size_t sUsedBootStrapMemory = 0; +RANGE_MARKER_FUNCTION_BEGIN(slab_allocator) + + static int size_to_index(size_t size) { @@ -272,3 +275,6 @@ realloc(void* address, size_t newSize) #endif // USE_SLAB_ALLOCATOR_FOR_MALLOC + + +RANGE_MARKER_FUNCTION_END(slab_allocator) diff --git a/src/system/kernel/slab/slab_debug.h b/src/system/kernel/slab/slab_debug.h new file mode 100644 index 0000000000..99c9469d90 --- /dev/null +++ b/src/system/kernel/slab/slab_debug.h @@ -0,0 +1,135 @@ +/* + * Copyright 2011, Michael Lotz . + * Copyright 2011, Ingo Weinhold . + * + * Distributed under the terms of the MIT License. + */ +#ifndef SLAB_DEBUG_H +#define SLAB_DEBUG_H + + +#include +#include +#include + +#include "kernel_debug_config.h" + + +//#define TRACE_SLAB +#ifdef TRACE_SLAB +#define TRACE_CACHE(cache, format, args...) \ + dprintf("Cache[%p, %s] " format "\n", cache, cache->name , ##args) +#else +#define TRACE_CACHE(cache, format, bananas...) do { } while (0) +#endif + + +#define COMPONENT_PARANOIA_LEVEL OBJECT_CACHE_PARANOIA +#include + + +// Macros determining whether allocation tracking is actually available. +#define SLAB_OBJECT_CACHE_ALLOCATION_TRACKING (SLAB_ALLOCATION_TRACKING != 0 \ + && SLAB_OBJECT_CACHE_TRACING != 0 \ + && SLAB_OBJECT_CACHE_TRACING_STACK_TRACE > 0) + // The object cache code needs to do allocation tracking. +#define SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING (SLAB_ALLOCATION_TRACKING != 0 \ + && SLAB_MEMORY_MANAGER_TRACING != 0 \ + && SLAB_MEMORY_MANAGER_TRACING_STACK_TRACE > 0) + // The memory manager code needs to do allocation tracking. +#define SLAB_ALLOCATION_TRACKING_AVAILABLE \ + (SLAB_OBJECT_CACHE_ALLOCATION_TRACKING \ + || SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING) + // Guards code that is needed for either object cache or memory manager + // allocation tracking. + + +struct object_depot; + + +void dump_object_depot(object_depot* depot); +int dump_object_depot(int argCount, char** args); +int dump_depot_magazine(int argCount, char** args); + + +#if SLAB_ALLOCATION_TRACKING_AVAILABLE + +class AllocationTrackingInfo { +public: + AbstractTraceEntryWithStackTrace* traceEntry; + bigtime_t traceEntryTimestamp; + +public: + void Init(AbstractTraceEntryWithStackTrace* entry) + { + traceEntry = entry; + traceEntryTimestamp = entry != NULL ? entry->Time() : -1; + // Note: this is a race condition, if the tracing buffer wrapped and + // got overwritten once, we would access an invalid trace entry + // here. Obviously this is rather unlikely. + } + + void Clear() + { + traceEntry = NULL; + traceEntryTimestamp = 0; + } + + bool IsInitialized() const + { + return traceEntryTimestamp != 0; + } + + AbstractTraceEntryWithStackTrace* TraceEntry() const + { + return traceEntry; + } + + bool IsTraceEntryValid() const + { + return tracing_is_entry_valid(traceEntry, traceEntryTimestamp); + } +}; + +#endif // SLAB_ALLOCATION_TRACKING_AVAILABLE + + +#if PARANOID_KERNEL_MALLOC || PARANOID_KERNEL_FREE +static inline void* +fill_block(void* buffer, size_t size, uint32 pattern) +{ + if (buffer == NULL) + return NULL; + + size &= ~(sizeof(pattern) - 1); + for (size_t i = 0; i < size / sizeof(pattern); i++) + ((uint32*)buffer)[i] = pattern; + + return buffer; +} +#endif + + +static inline void* +fill_allocated_block(void* buffer, size_t size) +{ +#if PARANOID_KERNEL_MALLOC + return fill_block(buffer, size, 0xcccccccc); +#else + return buffer; +#endif +} + + +static inline void* +fill_freed_block(void* buffer, size_t size) +{ +#if PARANOID_KERNEL_FREE + return fill_block(buffer, size, 0xdeadbeef); +#else + return buffer; +#endif +} + + +#endif // SLAB_DEBUG_H diff --git a/src/system/kernel/slab/slab_private.h b/src/system/kernel/slab/slab_private.h index 9c0e1e2b08..c9b8d534b0 100644 --- a/src/system/kernel/slab/slab_private.h +++ b/src/system/kernel/slab/slab_private.h @@ -14,27 +14,9 @@ #include -//#define TRACE_SLAB -#ifdef TRACE_SLAB -#define TRACE_CACHE(cache, format, args...) \ - dprintf("Cache[%p, %s] " format "\n", cache, cache->name , ##args) -#else -#define TRACE_CACHE(cache, format, bananas...) do { } while (0) -#endif - - -#define COMPONENT_PARANOIA_LEVEL OBJECT_CACHE_PARANOIA -#include - - - static const size_t kMinObjectAlignment = 8; -struct ObjectCache; -struct object_depot; - - void request_memory_manager_maintenance(); void* block_alloc(size_t size, size_t alignment, uint32 flags); @@ -43,10 +25,6 @@ void block_free(void* block, uint32 flags); void block_allocator_init_boot(); void block_allocator_init_rest(); -void dump_object_depot(object_depot* depot); -int dump_object_depot(int argCount, char** args); -int dump_depot_magazine(int argCount, char** args); - template static inline Type* @@ -84,41 +62,4 @@ slab_internal_free(void* buffer, uint32 flags) } -#if PARANOID_KERNEL_MALLOC || PARANOID_KERNEL_FREE -static inline void* -fill_block(void* buffer, size_t size, uint32 pattern) -{ - if (buffer == NULL) - return NULL; - - size &= ~(sizeof(pattern) - 1); - for (size_t i = 0; i < size / sizeof(pattern); i++) - ((uint32*)buffer)[i] = pattern; - - return buffer; -} -#endif - - -static inline void* -fill_allocated_block(void* buffer, size_t size) -{ -#if PARANOID_KERNEL_MALLOC - return fill_block(buffer, size, 0xcccccccc); -#else - return buffer; -#endif -} - - -static inline void* -fill_freed_block(void* buffer, size_t size) -{ -#if PARANOID_KERNEL_FREE - return fill_block(buffer, size, 0xdeadbeef); -#else - return buffer; -#endif -} - #endif // SLAB_PRIVATE_H From f6fbf32a02daa2aa6a58456fe4a6153c6c410ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 1 Nov 2011 18:58:18 +0000 Subject: [PATCH 608/702] Dump the 68040 mmu registers before touching them. Added a comment about the Milan clone which uses the mmu in the BIOS to emulate Atari hardware, and the Transparent Translation registers to map the PCI bus, which screws up with our current code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43073 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/arch/m68k/mmu_040.cpp | 44 ++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/system/boot/arch/m68k/mmu_040.cpp b/src/system/boot/arch/m68k/mmu_040.cpp index 69f2f005eb..607b34d75f 100644 --- a/src/system/boot/arch/m68k/mmu_040.cpp +++ b/src/system/boot/arch/m68k/mmu_040.cpp @@ -23,7 +23,7 @@ #include "arch_040_mmu.h" -//#define TRACE_MMU +#define TRACE_MMU #ifdef TRACE_MMU # define TRACE(x) dprintf x #else @@ -33,10 +33,52 @@ extern page_root_entry *gPageRoot; +//XXX: the milan BIOS uses the mmu for itself, +// likely to virtualize missing Atari I/O ports... +// tcr: c000 (enabled, 8k pages :() +// dtt0: 803fe140 0x80000000 & ~0x3f... en ignFC2 U=1 CI,S RW +// dtt1: 403fe060 0x40000000 & ~0x3f... en ignFC2 U=0 CI,NS RW +// itt0: 803fe040 0x80000000 & ~0x3f... en ignFC2 U=0 CI,S RW +// itt1: 403fe000 0x40000000 & ~0x3f... en ignFC2 U=0 C,WT RW +// srp: 00dfde00 +// urp: 00dfde00 + +static void +dump_mmu(void) +{ + uint32 dttr0, dttr1; + uint32 ittr0, ittr1; + uint32 srp, urp; + uint32 tcr; + + TRACE(("mmu_040:dump:\n")); + + asm volatile("movec %%tcr,%0\n" : "=d"(tcr) :); + TRACE(("tcr:\t%08lx\n", tcr)); + + asm volatile("movec %%dtt0,%0\n" : "=d"(dttr0) :); + TRACE(("dtt0:\t%08lx\n", dttr0)); + asm volatile("movec %%dtt1,%0\n" : "=d"(dttr1) :); + TRACE(("dtt1:\t%08lx\n", dttr1)); + + asm volatile("movec %%itt0,%0\n" : "=d"(ittr0) :); + TRACE(("itt0:\t%08lx\n", ittr0)); + asm volatile("movec %%itt1,%0\n" : "=d"(ittr1) :); + TRACE(("itt1:\t%08lx\n", ittr1)); + + asm volatile("movec %%srp,%0\n" : "=d"(srp) :); + TRACE(("srp:\t%08lx\n", srp)); + asm volatile("movec %%urp,%0\n" : "=d"(urp) :); + TRACE(("urp:\t%08lx\n", urp)); + + TRACE(("mmu_040:dump:\n")); +} + static void initialize(void) { + dump_mmu(); TRACE(("mmu_040:initialize\n")); } From 8fe82997ba025013823fa0fe3f669009780bcd9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 1 Nov 2011 18:59:47 +0000 Subject: [PATCH 609/702] Some more tracing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43074 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/atari_m68k/mmu.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/boot/platform/atari_m68k/mmu.cpp b/src/system/boot/platform/atari_m68k/mmu.cpp index d2d2ec3def..3a209d6476 100644 --- a/src/system/boot/platform/atari_m68k/mmu.cpp +++ b/src/system/boot/platform/atari_m68k/mmu.cpp @@ -574,11 +574,13 @@ mmu_init(void) gKernelArgs.num_physical_allocated_ranges = 1; // remember the start of the allocated physical pages + TRACE(("mmu_init: enabling transparent translation\n")); // enable transparent translation of the first 256 MB gMMUOps->set_tt(0, ATARI_CHIPRAM_BASE, 0x10000000, 0); // enable transparent translation of the 16MB ST shadow range for I/O gMMUOps->set_tt(1, ATARI_SHADOW_BASE, 0x01000000, 0); + TRACE(("mmu_init: init rtdir\n")); init_page_directory(); #if 0//XXX:HOLE From 4b38291dbcc6c82709a2f470efa7e3194291c4ab Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 1 Nov 2011 19:10:21 +0000 Subject: [PATCH 610/702] Style fixes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43075 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/settings/GUITeamUISettings.cpp | 2 ++ src/apps/debugger/settings/TeamUISettings.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/apps/debugger/settings/GUITeamUISettings.cpp b/src/apps/debugger/settings/GUITeamUISettings.cpp index e39d4bae55..aaed46a80f 100644 --- a/src/apps/debugger/settings/GUITeamUISettings.cpp +++ b/src/apps/debugger/settings/GUITeamUISettings.cpp @@ -2,6 +2,8 @@ * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ + + #include "GUITeamUISettings.h" #include diff --git a/src/apps/debugger/settings/TeamUISettings.cpp b/src/apps/debugger/settings/TeamUISettings.cpp index bbffadb05e..a417e8c9ee 100644 --- a/src/apps/debugger/settings/TeamUISettings.cpp +++ b/src/apps/debugger/settings/TeamUISettings.cpp @@ -2,6 +2,8 @@ * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ + + #include "TeamUISettings.h" From c0691021f7b9bca7fbc7794a51f15e0438429519 Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Tue, 1 Nov 2011 19:16:12 +0000 Subject: [PATCH 611/702] Updated Slovakian catkeys. Thanks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43076 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/apps/aboutsystem/sk.catkeys | 3 +-- data/catalogs/apps/launchbox/sk.catkeys | 5 ++--- data/catalogs/kits/locale/sk.catkeys | 2 +- data/catalogs/preferences/time/sk.catkeys | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/data/catalogs/apps/aboutsystem/sk.catkeys b/data/catalogs/apps/aboutsystem/sk.catkeys index 6cc23be1e1..58f3b94b1c 100644 --- a/data/catalogs/apps/aboutsystem/sk.catkeys +++ b/data/catalogs/apps/aboutsystem/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-About 282658629 +1 slovak x-vnd.Haiku-About 2175207182 %.2f GHz AboutView %.2f GHz %d MiB total AboutView %d MiB celkom %d MiB used (%d%%) AboutView %d MiB využitých (%d%%) @@ -70,7 +70,6 @@ The BeGeistert team\n AboutView Tím BeGeistert\n The Haiku-Ports team\n AboutView Tím Haiku-Ports\n The Haikuware team and their bounty program\n AboutView Tím Haikuware a ich program odmien\n The University of Auckland and Christof Lutteroth\n\n AboutView University of Auckland a Christof Lutteroth\n\n -The copyright to the Haiku code is property of Haiku, Inc. or of the respective authors where expressly noted in the source. Haiku™ and the HAIKU logo® are (registered) trademarks of Haiku, Inc.\n\n AboutView Autorské práva ku kódu Haiku sú vlastníctvom Haiku, Inc. alebo jednotlivých autorov, kde sú v kóde výslovne uvedení. Haiku™ a logo HAIKU® sú (registrované) obchodné známky Haiku, Inc.\n\n Time running: AboutView Čas behu: Translations:\n AboutView Preklady:\n Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (a jeho jadro NewOS)\n diff --git a/data/catalogs/apps/launchbox/sk.catkeys b/data/catalogs/apps/launchbox/sk.catkeys index 567f930c89..73b79cd5d5 100644 --- a/data/catalogs/apps/launchbox/sk.catkeys +++ b/data/catalogs/apps/launchbox/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-LaunchBox 1440389990 +1 slovak x-vnd.Haiku-LaunchBox 2567299959 Add button here LaunchBox Pridať tlačidlo sem Auto-raise LaunchBox Automaticky aktivovať Bummer LaunchBox Škoda @@ -7,9 +7,8 @@ Clear button LaunchBox Tlačidlo Vyčistiť Clone LaunchBox Klonovať Close LaunchBox Zatvoriť Description for '%3' LaunchBox Popis „%3“ -Failed to launch '%1'.\n\nError: LaunchBox Nepodarilo sa spustiť „%1“.\n\nChyba: +Failed to launch '%1'.\n\nError: LaunchBox Nepodarilo sa spustiť „%1“.\n\nChyba: Failed to launch 'something',error in Pad data. LaunchBox Nepodarilo sa spustiť „niečo“, chyba v dátach Oblasti. -Failed to launch application with signature '%2'.\n\nError: LaunchBox Nepodarilo sa spustiť aplikáciu so signatúrou „%2“.\n\nChyba: Failed to send 'open folder' command to Tracker.\n\nError: LaunchBox Nepodarilo sa poslať príkaz „otvoriť priečinok“ Trackeru.\n\nChyba: Horizontal layout LaunchBox Vodorovné rozloženie Icon size LaunchBox Veľkosť ikon diff --git a/data/catalogs/kits/locale/sk.catkeys b/data/catalogs/kits/locale/sk.catkeys index 3246238e60..cb012aae6b 100644 --- a/data/catalogs/kits/locale/sk.catkeys +++ b/data/catalogs/kits/locale/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-libbe 180647795 +1 slovak system 180647795 %.2f TiB StringForSize %.2f TiB %3.2f GiB StringForSize %3.2f GiB %3.2f KiB StringForSize %3.2f KiB diff --git a/data/catalogs/preferences/time/sk.catkeys b/data/catalogs/preferences/time/sk.catkeys index cb65adf976..b4ef8de25d 100644 --- a/data/catalogs/preferences/time/sk.catkeys +++ b/data/catalogs/preferences/time/sk.catkeys @@ -1,11 +1,10 @@ -1 slovak x-vnd.Haiku-Time 453699369 +1 slovak x-vnd.Haiku-Time 265526963 Time Add Time Pridať Could not contact server Time Nepodarilo sa kontaktovať server Could not create socket Time Nepodarilo sa vytvoriť socket Current time: Time Aktuálny čas: Date and time Time Dátum a čas -Etc Time Etc GMT Time GMT Hardware clock set to: Time Hardvérové hodiny nastavené na: Local time Time Lokálny čas From 244a545018686eccc1cc9ccf9bb8880a5426accf Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 1 Nov 2011 19:25:40 +0000 Subject: [PATCH 612/702] Mail daemon notifications, round 2: * Use the proper identifier for each notification window : 2 per account for sending/receiving, and a global one to show the "n message received" message. * Use the mail daemon icon on the windows instead of the default ones * Shuffle the text in the windows a bit so it makes more sense * Use the settings from the mail preflet for showing or not the window. The meaning of "always" changes a bit, since it is not possible to have a "forever" timeout with the notification server (and that would be rather annoying). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43077 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/mail/MailDaemon.cpp | 27 +++++++++++++++--------- src/servers/mail/MailDaemon.h | 1 + src/servers/mail/Notifier.cpp | 37 ++++++++++++++++++++++++--------- src/servers/mail/Notifier.h | 4 +++- 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/src/servers/mail/MailDaemon.cpp b/src/servers/mail/MailDaemon.cpp index 0505e790b0..ebc03c81fb 100644 --- a/src/servers/mail/MailDaemon.cpp +++ b/src/servers/mail/MailDaemon.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -150,8 +151,6 @@ MailDaemonApp::ReadyToRun() fNewMessages = 0; while (roster.GetNextVolume(&volume) == B_OK) { - //{char name[255];volume.GetName(name);printf("Volume: %s\n",name);} - BQuery* query = new BQuery; query->SetTarget(this); @@ -192,8 +191,16 @@ MailDaemonApp::ReadyToRun() fCentralBeep = false; fNotification = new BNotification(B_INFORMATION_NOTIFICATION); - fNotification->SetApplication("Mail daemon"); + fNotification->SetApplication(B_TRANSLATE("Mail status")); fNotification->SetTitle(string); + fNotification->SetMessageID("daemon_status"); + + app_info info; + be_roster->GetAppInfo(B_MAIL_DAEMON_SIGNATURE, &info); + BBitmap icon(BRect(0, 0, 32, 32), B_RGBA32); + BNode node(&info.ref); + BIconUtils::GetVectorIcon(&node, "BEOS:ICON", &icon); + fNotification->SetIcon(&icon); fLEDAnimation = new LEDAnimation; SetPulseRate(1000000); @@ -203,8 +210,6 @@ MailDaemonApp::ReadyToRun() void MailDaemonApp::RefsReceived(BMessage* message) { - be_roster->Notify(*fNotification, 3); - entry_ref ref; for (int32 i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) { BNode node(&ref); @@ -260,12 +265,12 @@ MailDaemonApp::MessageReceived(BMessage* msg) break; case kMsgSetStatusWindowMode: // when to show the status window - {/* + { int32 mode; if (msg->FindInt32("ShowStatusWindow", &mode) == B_OK) - fMailStatusWindow->SetShowCriterion(mode); + fNotifyMode = mode; break; - */} + } case kMsgMarkMessageAsRead: { @@ -384,6 +389,8 @@ MailDaemonApp::MessageReceived(BMessage* msg) string << B_TRANSLATE("No new messages."); fNotification->SetTitle(string.String()); + if (fNotifyMode != B_MAIL_SHOW_STATUS_WINDOW_NEVER) + be_roster->Notify(*fNotification); break; } @@ -645,7 +652,7 @@ MailDaemonApp::_InitAccount(BMailAccountSettings& settings) } if (account.inboundProtocol) { DefaultNotifier* notifier = new DefaultNotifier(settings.Name(), true, - fErrorLogWindow); + fErrorLogWindow, fNotifyMode); account.inboundProtocol->SetMailNotifier(notifier); account.inboundThread = new InboundProtocolThread( @@ -662,7 +669,7 @@ MailDaemonApp::_InitAccount(BMailAccountSettings& settings) } if (account.outboundProtocol) { DefaultNotifier* notifier = new DefaultNotifier(settings.Name(), false, - fErrorLogWindow); + fErrorLogWindow, fNotifyMode); account.outboundProtocol->SetMailNotifier(notifier); account.outboundThread = new OutboundProtocolThread( diff --git a/src/servers/mail/MailDaemon.h b/src/servers/mail/MailDaemon.h index 016f3793ef..a740cd571d 100644 --- a/src/servers/mail/MailDaemon.h +++ b/src/servers/mail/MailDaemon.h @@ -112,6 +112,7 @@ private: ErrorLogWindow* fErrorLogWindow; BNotification* fNotification; + uint32 fNotifyMode; }; diff --git a/src/servers/mail/Notifier.cpp b/src/servers/mail/Notifier.cpp index a5f59da2d9..c0c0b37066 100644 --- a/src/servers/mail/Notifier.cpp +++ b/src/servers/mail/Notifier.cpp @@ -4,7 +4,10 @@ * Distributed under the terms of the MIT License. */ + #include +#include +#include #include #include "Notifier.h" @@ -15,12 +18,13 @@ DefaultNotifier::DefaultNotifier(const char* accountName, bool inbound, - ErrorLogWindow* errorWindow) + ErrorLogWindow* errorWindow, uint32& showMode) : fAccountName(accountName), fIsInbound(inbound), fErrorWindow(errorWindow), fNotification(B_PROGRESS_NOTIFICATION), + fShowMode(showMode), fTotalItems(0), fItemsDone(0), fTotalSize(0), @@ -34,10 +38,19 @@ DefaultNotifier::DefaultNotifier(const char* accountName, bool inbound, desc.ReplaceFirst("%name", fAccountName); BString identifier; - identifier << (int)this; - // This should get us an unique value for each notifier running + identifier << accountName << inbound; + // Two windows for each acocunt : one for sending and the other for + // receiving mails fNotification.SetMessageID(identifier); - fNotification.SetApplication("Mail daemon"); + fNotification.SetApplication(B_TRANSLATE("Mail Status")); + fNotification.SetTitle(desc); + + app_info info; + be_roster->GetAppInfo(B_MAIL_DAEMON_SIGNATURE, &info); + BBitmap icon(BRect(0, 0, 32, 32), B_RGBA32); + BNode node(&info.ref); + BIconUtils::GetVectorIcon(&node, "BEOS:ICON", &icon); + fNotification.SetIcon(&icon); } @@ -49,7 +62,7 @@ DefaultNotifier::~DefaultNotifier() MailNotifier* DefaultNotifier::Clone() { - return new DefaultNotifier(fAccountName, fIsInbound, fErrorWindow); + return new DefaultNotifier(fAccountName, fIsInbound, fErrorWindow, fShowMode); } @@ -98,19 +111,23 @@ DefaultNotifier::ReportProgress(int bytes, int messages, const char* message) } fItemsDone += messages; + BString progress; + + progress << message << "\t"; + if (fTotalItems > 0) progress << fItemsDone << "/" << fTotalItems; fNotification.SetContent(progress); - if (message != NULL) - fNotification.SetTitle(message); - int timeout = 0; // Default timeout if (fItemsDone == fTotalItems && fTotalItems != 0) timeout = 1; // We're done, make the window go away faster - be_roster->Notify(fNotification, timeout); + + if ((!fIsInbound && fShowMode | B_MAIL_SHOW_STATUS_WINDOW_WHEN_SENDING) + || (fIsInbound && fShowMode | B_MAIL_SHOW_STATUS_WINDOW_WHEN_ACTIVE)) + be_roster->Notify(fNotification, timeout); } @@ -119,6 +136,6 @@ DefaultNotifier::ResetProgress(const char* message) { fNotification.SetProgress(0); if (message != NULL) - fNotification.SetContent(message); + fNotification.SetTitle(message); be_roster->Notify(fNotification, 0); } diff --git a/src/servers/mail/Notifier.h b/src/servers/mail/Notifier.h index 72d077c620..d00e9d69ab 100644 --- a/src/servers/mail/Notifier.h +++ b/src/servers/mail/Notifier.h @@ -19,7 +19,8 @@ class DefaultNotifier : public MailNotifier { public: DefaultNotifier(const char* accountName, - bool inbound, ErrorLogWindow* errorWindow); + bool inbound, ErrorLogWindow* errorWindow, + uint32& showMode); ~DefaultNotifier(); MailNotifier* Clone(); @@ -38,6 +39,7 @@ private: bool fIsInbound; ErrorLogWindow* fErrorWindow; BNotification fNotification; + uint32& fShowMode; int fTotalItems; int fItemsDone; From 0422a0f3ae8f12f32bd27868a7e742293786f0a0 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 19:40:27 +0000 Subject: [PATCH 613/702] mmlr + bonefish: * dump_allocations_per_caller(): Compute the total allocation count and size from the caller infos instead of using return arguments in the helper functions called. * Move caller info update code from analyze_allocation_callers() to new function slab_debug_add_allocation_for_caller(), so it can be reused. * Add MemoryManager::AnalyzeAllocationCallers() to collect the allocation information for the memory manager. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43078 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/slab/MemoryManager.cpp | 43 +++++++++-- src/system/kernel/slab/MemoryManager.h | 21 +++++- src/system/kernel/slab/Slab.cpp | 91 +++++++++++++----------- src/system/kernel/slab/slab_debug.h | 13 ++-- 4 files changed, 115 insertions(+), 53 deletions(-) diff --git a/src/system/kernel/slab/MemoryManager.cpp b/src/system/kernel/slab/MemoryManager.cpp index a44bcb6869..f242455541 100644 --- a/src/system/kernel/slab/MemoryManager.cpp +++ b/src/system/kernel/slab/MemoryManager.cpp @@ -22,7 +22,6 @@ #include "kernel_debug_config.h" #include "ObjectCache.h" -#include "slab_debug.h" #include "slab_private.h" @@ -867,6 +866,44 @@ MemoryManager::PerformMaintenance() } +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + +/*static*/ bool +MemoryManager::AnalyzeAllocationCallers() +{ + for (AreaTable::Iterator it = sAreaTable.GetIterator(); + Area* area = it.Next();) { + for (int32 i = 0; i < SLAB_META_CHUNKS_PER_AREA; i++) { + MetaChunk* metaChunk = area->metaChunks + i; + if (metaChunk->chunkSize == 0) + continue; + + for (uint32 k = 0; k < metaChunk->chunkCount; k++) { + Chunk* chunk = metaChunk->chunks + k; + + // skip free chunks + if (_IsChunkFree(metaChunk, chunk)) + continue; + + addr_t reference = chunk->reference; + if ((reference & 1) == 0 || reference == 1) + continue; + + addr_t chunkAddress = _ChunkAddress(metaChunk, chunk); + size_t size = reference - chunkAddress + 1; + + slab_debug_add_allocation_for_caller( + _TrackingInfoFor((void*)chunkAddress, size), size); + } + } + } + + return true; +} + +#endif // SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + + /*static*/ status_t MemoryManager::_AllocateChunks(size_t chunkSize, uint32 chunkCount, uint32 flags, MetaChunk*& _metaChunk, Chunk*& _chunk) @@ -1989,9 +2026,7 @@ void MemoryManager::_AddTrackingInfo(void* allocation, size_t size, AbstractTraceEntryWithStackTrace* traceEntry) { - AllocationTrackingInfo* info = (AllocationTrackingInfo*) - ((uint8*)allocation + size - sizeof(AllocationTrackingInfo)); - info->Init(traceEntry); + _TrackingInfoFor(allocation, size)->Init(traceEntry); } #endif // SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING diff --git a/src/system/kernel/slab/MemoryManager.h b/src/system/kernel/slab/MemoryManager.h index f1fbcdbd7d..4adcf2f433 100644 --- a/src/system/kernel/slab/MemoryManager.h +++ b/src/system/kernel/slab/MemoryManager.h @@ -14,8 +14,7 @@ #include #include -#include "kernel_debug_config.h" -#include "tracing_config.h" +#include "slab_debug.h" class AbstractTraceEntryWithStackTrace; @@ -61,6 +60,8 @@ public: static bool MaintenanceNeeded(); static void PerformMaintenance(); + static bool AnalyzeAllocationCallers(); + private: struct Tracing; @@ -195,9 +196,11 @@ private: static int _DumpArea(int argc, char** argv); static int _DumpAreas(int argc, char** argv); -#if SLAB_ALLOCATION_TRACKING && SLAB_MEMORY_MANAGER_TRACING +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING static void _AddTrackingInfo(void* allocation, size_t size, AbstractTraceEntryWithStackTrace* entry); + static AllocationTrackingInfo* _TrackingInfoFor(void* allocation, + size_t size); #endif private: @@ -273,4 +276,16 @@ MemoryManager::MetaChunk::GetArea() const } +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + +/*static*/ inline AllocationTrackingInfo* +MemoryManager::_TrackingInfoFor(void* allocation, size_t size) +{ + return (AllocationTrackingInfo*)((uint8*)allocation + size + - sizeof(AllocationTrackingInfo)); +} + +#endif // SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + + #endif // MEMORY_MANAGER_H diff --git a/src/system/kernel/slab/Slab.cpp b/src/system/kernel/slab/Slab.cpp index 093c1780e1..22f65899aa 100644 --- a/src/system/kernel/slab/Slab.cpp +++ b/src/system/kernel/slab/Slab.cpp @@ -329,9 +329,6 @@ dump_cache_info(int argc, char* argv[]) #if SLAB_ALLOCATION_TRACKING_AVAILABLE -#if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING - // until memory manager tracking is analyzed - static caller_info* get_caller_info(addr_t caller) { @@ -353,8 +350,6 @@ get_caller_info(addr_t caller) return info; } -#endif // SLAB_OBJECT_CACHE_ALLOCATION_TRACKING - static int caller_info_compare_size(const void* _a, const void* _b) @@ -374,39 +369,47 @@ caller_info_compare_count(const void* _a, const void* _b) } +bool +slab_debug_add_allocation_for_caller(const AllocationTrackingInfo* info, + size_t allocationSize) +{ + if (!info->IsInitialized()) + return true; + + addr_t caller = 0; + AbstractTraceEntryWithStackTrace* traceEntry = info->TraceEntry(); + + if (traceEntry != NULL && info->IsTraceEntryValid()) { + caller = tracing_find_caller_in_stack_trace( + traceEntry->StackTrace(), kSlabCodeAddressRanges, + kSlabCodeAddressRangeCount); + } + + caller_info* callerInfo = get_caller_info(caller); + if (callerInfo == NULL) { + kprintf("out of space for caller infos\n"); + return false; + } + + callerInfo->count++; + callerInfo->size += allocationSize; + + return true; +} + + #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING static bool -analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList, - size_t& _totalAllocationSize, size_t& _totalAllocationCount) +analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList) { for (SlabList::ConstIterator it = slabList.GetIterator(); slab* slab = it.Next();) { for (uint32 i = 0; i < slab->size; i++) { - AllocationTrackingInfo* info = &slab->tracking[i]; - if (!info->IsInitialized()) - continue; - - _totalAllocationSize += cache->object_size; - _totalAllocationCount++; - - addr_t caller = 0; - AbstractTraceEntryWithStackTrace* traceEntry = info->TraceEntry(); - - if (traceEntry != NULL && info->IsTraceEntryValid()) { - caller = tracing_find_caller_in_stack_trace( - traceEntry->StackTrace(), kSlabCodeAddressRanges, - kSlabCodeAddressRangeCount); - } - - caller_info* callerInfo = get_caller_info(caller); - if (callerInfo == NULL) { - kprintf("out of space for caller infos\n"); + if (!slab_debug_add_allocation_for_caller(&slab->tracking[i], + cache->object_size)) { return false; } - - callerInfo->count++; - callerInfo->size += cache->object_size; } } @@ -415,13 +418,10 @@ analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList, static bool -analyze_allocation_callers(ObjectCache* cache, size_t& _totalAllocationSize, - size_t& _totalAllocationCount) +analyze_allocation_callers(ObjectCache* cache) { - return analyze_allocation_callers(cache, cache->full, _totalAllocationSize, - _totalAllocationCount) - && analyze_allocation_callers(cache, cache->partial, - _totalAllocationSize, _totalAllocationCount); + return analyze_allocation_callers(cache, cache->full) + && analyze_allocation_callers(cache, cache->partial); } #endif // SLAB_OBJECT_CACHE_ALLOCATION_TRACKING @@ -453,12 +453,10 @@ dump_allocations_per_caller(int argc, char **argv) sCallerInfoCount = 0; - size_t totalAllocationSize = 0; - size_t totalAllocationCount = 0; if (cache != NULL) { #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING - analyze_allocation_callers(cache, totalAllocationSize, - totalAllocationCount); + if (!analyze_allocation_callers(cache)) + return 0; #else kprintf("Object cache allocation tracking not available. " "SLAB_OBJECT_CACHE_TRACING (%d) and " @@ -471,10 +469,15 @@ dump_allocations_per_caller(int argc, char **argv) ObjectCacheList::Iterator it = sObjectCaches.GetIterator(); while (it.HasNext()) { - analyze_allocation_callers(it.Next(), totalAllocationSize, - totalAllocationCount); + if (!analyze_allocation_callers(it.Next())) + return 0; } #endif + +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING + if (!MemoryManager::AnalyzeAllocationCallers()) + return 0; +#endif } // sort the array @@ -484,6 +487,9 @@ dump_allocations_per_caller(int argc, char **argv) kprintf("%ld different callers, sorted by %s...\n\n", sCallerInfoCount, sortBySize ? "size" : "count"); + size_t totalAllocationSize = 0; + size_t totalAllocationCount = 0; + kprintf(" count size caller\n"); kprintf("----------------------------------\n"); for (int32 i = 0; i < sCallerInfoCount; i++) { @@ -503,6 +509,9 @@ dump_allocations_per_caller(int argc, char **argv) exactMatch ? "" : " (nearest)"); } else kprintf("\n"); + + totalAllocationCount += info.count; + totalAllocationSize += info.size; } kprintf("\ntotal allocations: %" B_PRIuSIZE ", %" B_PRIuSIZE " bytes\n", diff --git a/src/system/kernel/slab/slab_debug.h b/src/system/kernel/slab/slab_debug.h index 99c9469d90..0181d61ee5 100644 --- a/src/system/kernel/slab/slab_debug.h +++ b/src/system/kernel/slab/slab_debug.h @@ -47,11 +47,6 @@ struct object_depot; -void dump_object_depot(object_depot* depot); -int dump_object_depot(int argCount, char** args); -int dump_depot_magazine(int argCount, char** args); - - #if SLAB_ALLOCATION_TRACKING_AVAILABLE class AllocationTrackingInfo { @@ -94,6 +89,14 @@ public: #endif // SLAB_ALLOCATION_TRACKING_AVAILABLE +void dump_object_depot(object_depot* depot); +int dump_object_depot(int argCount, char** args); +int dump_depot_magazine(int argCount, char** args); + +bool slab_debug_add_allocation_for_caller( + const AllocationTrackingInfo* info, size_t allocationSize); + + #if PARANOID_KERNEL_MALLOC || PARANOID_KERNEL_FREE static inline void* fill_block(void* buffer, size_t size, uint32 pattern) From f908ff9bb658aa86aa53760c51070415e69f951d Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 20:35:49 +0000 Subject: [PATCH 614/702] mmlr + bonefish: * Fix build broken in r43078. The slab_debug_add_allocation_for_caller() wasn't guarded correctly. * slab_debug_add_allocation_for_caller(): Add bool resetAllocationInfos parameter, which makes the function clear the allocation tracking infos after processing the data. * "allocations_per_caller" KDL command: Add option "-r" to reset the allocation tracking infos. The next invocation of the command will only show the allocations made after the reset. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43079 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/slab/MemoryManager.cpp | 5 ++-- src/system/kernel/slab/MemoryManager.h | 3 +- src/system/kernel/slab/Slab.cpp | 36 +++++++++++++++--------- src/system/kernel/slab/slab_debug.h | 7 ++++- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/system/kernel/slab/MemoryManager.cpp b/src/system/kernel/slab/MemoryManager.cpp index f242455541..21c70e2fc1 100644 --- a/src/system/kernel/slab/MemoryManager.cpp +++ b/src/system/kernel/slab/MemoryManager.cpp @@ -869,7 +869,7 @@ MemoryManager::PerformMaintenance() #if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING /*static*/ bool -MemoryManager::AnalyzeAllocationCallers() +MemoryManager::AnalyzeAllocationCallers(bool resetAllocationInfos) { for (AreaTable::Iterator it = sAreaTable.GetIterator(); Area* area = it.Next();) { @@ -893,7 +893,8 @@ MemoryManager::AnalyzeAllocationCallers() size_t size = reference - chunkAddress + 1; slab_debug_add_allocation_for_caller( - _TrackingInfoFor((void*)chunkAddress, size), size); + _TrackingInfoFor((void*)chunkAddress, size), size, + resetAllocationInfos); } } } diff --git a/src/system/kernel/slab/MemoryManager.h b/src/system/kernel/slab/MemoryManager.h index 4adcf2f433..df2c6af94b 100644 --- a/src/system/kernel/slab/MemoryManager.h +++ b/src/system/kernel/slab/MemoryManager.h @@ -60,7 +60,8 @@ public: static bool MaintenanceNeeded(); static void PerformMaintenance(); - static bool AnalyzeAllocationCallers(); + static bool AnalyzeAllocationCallers( + bool resetAllocationInfos); private: struct Tracing; diff --git a/src/system/kernel/slab/Slab.cpp b/src/system/kernel/slab/Slab.cpp index 22f65899aa..3dc5e63615 100644 --- a/src/system/kernel/slab/Slab.cpp +++ b/src/system/kernel/slab/Slab.cpp @@ -370,8 +370,8 @@ caller_info_compare_count(const void* _a, const void* _b) bool -slab_debug_add_allocation_for_caller(const AllocationTrackingInfo* info, - size_t allocationSize) +slab_debug_add_allocation_for_caller(AllocationTrackingInfo* info, + size_t allocationSize, bool resetAllocationInfos) { if (!info->IsInitialized()) return true; @@ -394,6 +394,9 @@ slab_debug_add_allocation_for_caller(const AllocationTrackingInfo* info, callerInfo->count++; callerInfo->size += allocationSize; + if (resetAllocationInfos) + info->Clear(); + return true; } @@ -401,13 +404,14 @@ slab_debug_add_allocation_for_caller(const AllocationTrackingInfo* info, #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING static bool -analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList) +analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList, + bool resetAllocationInfos) { for (SlabList::ConstIterator it = slabList.GetIterator(); slab* slab = it.Next();) { for (uint32 i = 0; i < slab->size; i++) { if (!slab_debug_add_allocation_for_caller(&slab->tracking[i], - cache->object_size)) { + cache->object_size, resetAllocationInfos)) { return false; } } @@ -418,10 +422,11 @@ analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList) static bool -analyze_allocation_callers(ObjectCache* cache) +analyze_allocation_callers(ObjectCache* cache, bool resetAllocationInfos) { - return analyze_allocation_callers(cache, cache->full) - && analyze_allocation_callers(cache, cache->partial); + return analyze_allocation_callers(cache, cache->full, resetAllocationInfos) + && analyze_allocation_callers(cache, cache->partial, + resetAllocationInfos); } #endif // SLAB_OBJECT_CACHE_ALLOCATION_TRACKING @@ -431,6 +436,7 @@ static int dump_allocations_per_caller(int argc, char **argv) { bool sortBySize = true; + bool resetAllocationInfos = false; ObjectCache* cache = NULL; for (int32 i = 1; i < argc; i++) { @@ -445,6 +451,8 @@ dump_allocations_per_caller(int argc, char **argv) } cache = (ObjectCache*)(addr_t)cacheAddress; + } else if (strcmp(argv[i], "-r") == 0) { + resetAllocationInfos = true; } else { print_debugger_command_usage(argv[0]); return 0; @@ -455,7 +463,7 @@ dump_allocations_per_caller(int argc, char **argv) if (cache != NULL) { #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING - if (!analyze_allocation_callers(cache)) + if (!analyze_allocation_callers(cache, resetAllocationInfos)) return 0; #else kprintf("Object cache allocation tracking not available. " @@ -469,13 +477,13 @@ dump_allocations_per_caller(int argc, char **argv) ObjectCacheList::Iterator it = sObjectCaches.GetIterator(); while (it.HasNext()) { - if (!analyze_allocation_callers(it.Next())) + if (!analyze_allocation_callers(it.Next(), resetAllocationInfos)) return 0; } #endif #if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING - if (!MemoryManager::AnalyzeAllocationCallers()) + if (!MemoryManager::AnalyzeAllocationCallers(resetAllocationInfos)) return 0; #endif } @@ -1061,12 +1069,14 @@ slab_init_post_area() add_debugger_command_etc("allocations_per_caller", &dump_allocations_per_caller, "Dump current heap allocations summed up per caller", - "[ \"-c\" ] [ -o ]\n" + "[ -c ] [ -o ] [ -r ]\n" "The current allocations will by summed up by caller (their count and\n" "size) printed in decreasing order by size or, if \"-c\" is\n" "specified, by allocation count. If given specifies\n" - "the address of the object cache for which to print the allocations.\n", - 0); + "the address of the object cache for which to print the allocations.\n" + "If \"-r\" is given, the allocation infos are reset after gathering\n" + "the information, so the next command invocation will only show the\n" + "allocations made after the reset.\n", 0); #endif // SLAB_ALLOCATION_TRACKING_AVAILABLE } diff --git a/src/system/kernel/slab/slab_debug.h b/src/system/kernel/slab/slab_debug.h index 0181d61ee5..bc356b11a3 100644 --- a/src/system/kernel/slab/slab_debug.h +++ b/src/system/kernel/slab/slab_debug.h @@ -93,8 +93,13 @@ void dump_object_depot(object_depot* depot); int dump_object_depot(int argCount, char** args); int dump_depot_magazine(int argCount, char** args); +#if SLAB_ALLOCATION_TRACKING_AVAILABLE + bool slab_debug_add_allocation_for_caller( - const AllocationTrackingInfo* info, size_t allocationSize); + AllocationTrackingInfo* info, size_t allocationSize, + bool resetAllocationInfos); + +#endif // SLAB_ALLOCATION_TRACKING_AVAILABLE #if PARANOID_KERNEL_MALLOC || PARANOID_KERNEL_FREE From 15dbca93da2b19ef6372ce46a45ebe045b5430dc Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 1 Nov 2011 20:57:31 +0000 Subject: [PATCH 615/702] Extend BVariant to support storing BRects as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43080 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/Variant.h | 44 ++++++++++++++++++++++++++++++++ src/kits/shared/Variant.cpp | 34 ++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/headers/private/shared/Variant.h b/headers/private/shared/Variant.h index b5b226846b..bbbaa7a6ae 100644 --- a/headers/private/shared/Variant.h +++ b/headers/private/shared/Variant.h @@ -1,11 +1,13 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef _VARIANT_H #define _VARIANT_H +#include #include #include @@ -36,6 +38,9 @@ public: inline BVariant(uint64 value); inline BVariant(float value); inline BVariant(double value); + inline BVariant(const BRect &value); + inline BVariant(float left, float top, float right, + float bottom); inline BVariant(const void* value); inline BVariant(const char* value, uint32 flags = 0); @@ -56,6 +61,9 @@ public: inline void SetTo(uint64 value); inline void SetTo(float value); inline void SetTo(double value); + inline void SetTo(const BRect& value); + inline void SetTo(float left, float top, float right, + float bottom); inline void SetTo(const void* value); inline void SetTo(const char* value, uint32 flags = 0); @@ -92,6 +100,7 @@ public: double ToDouble() const; void* ToPointer() const; const char* ToString() const; + BRect ToRect() const; BReferenceable* ToReferenceable() const; void SwapEndianess(); @@ -123,6 +132,8 @@ private: void _SetTo(float value); void _SetTo(double value); void _SetTo(const void* value); + void _SetTo(float left, float top, float right, + float bottom); bool _SetTo(const char* value, uint32 flags); void _SetTo(BReferenceable* value, type_code type); @@ -150,6 +161,11 @@ private: BReferenceable* fReferenceable; uint8 fBytes[8]; }; + + float fLeft; + float fTop; + float fRight; + float fBottom; }; @@ -227,6 +243,18 @@ BVariant::BVariant(double value) } +BVariant::BVariant(const BRect& value) +{ + _SetTo(value); +} + + +BVariant::BVariant(float left, float top, float right, float bottom) +{ + _SetTo(left, top, right, bottom); +} + + BVariant::BVariant(const void* value) { _SetTo(value); @@ -363,6 +391,22 @@ BVariant::SetTo(double value) } +void +BVariant::SetTo(const BRect& value) +{ + Unset(); + _SetTo(value.left, value.top, value.right, value.bottom); +} + + +void +BVariant::SetTo(float left, float top, float right, float bottom) +{ + Unset(); + _SetTo(left, top, right, bottom); +} + + void BVariant::SetTo(const void* value) { diff --git a/src/kits/shared/Variant.cpp b/src/kits/shared/Variant.cpp index 352a8ded9b..d81df4b269 100644 --- a/src/kits/shared/Variant.cpp +++ b/src/kits/shared/Variant.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -96,6 +97,12 @@ BVariant::SetToTypedData(const void* data, type_code type) break; case B_STRING_TYPE: return _SetTo((const char*)data, 0) ? B_OK : B_NO_MEMORY; + case B_RECT_TYPE: + { + BRect *rect = (BRect *)data; + _SetTo(rect->left, rect->top, rect->right, rect->bottom); + break; + } default: return B_BAD_TYPE; } @@ -169,6 +176,9 @@ BVariant::operator==(const BVariant& other) const if (fString == NULL || other.fString == NULL) return fString == other.fString; return strcmp(fString, other.fString) == 0; + case B_RECT_TYPE: + return BRect(fLeft, fTop, fRight, fBottom) == BRect( + other.fLeft, other.fTop, other.fRight, other.fBottom); default: return false; } @@ -303,6 +313,13 @@ BVariant::ToDouble() const } +BRect +BVariant::ToRect() const +{ + return BRect(fLeft, fTop, fRight, fBottom); +} + + void* BVariant::ToPointer() const { @@ -387,6 +404,9 @@ BVariant::AddToMessage(BMessage& message, const char* fieldName) const return message.AddPointer(fieldName, fPointer); case B_STRING_TYPE: return message.AddString(fieldName, fString); + case B_RECT_TYPE: + return message.AddRect(fieldName, BRect(fLeft, fTop, fRight, + fBottom)); default: return B_UNSUPPORTED; } @@ -443,6 +463,8 @@ BVariant::SizeOfType(type_code type) return sizeof(double); case B_POINTER_TYPE: return sizeof(void*); + case B_RECT_TYPE: + return sizeof(BRect); default: return 0; } @@ -606,6 +628,18 @@ BVariant::_SetTo(double value) } +void +BVariant::_SetTo(float left, float top, float right, float bottom) +{ + fType = B_RECT_TYPE; + fFlags = 0; + fLeft = left; + fTop = top; + fRight = right; + fBottom = bottom; +} + + void BVariant::_SetTo(const void* value) { From 12a1034a7ded9c96d2f8fb03760b15c9dc72c98e Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 1 Nov 2011 21:10:24 +0000 Subject: [PATCH 616/702] Extend the generic Settings classes to support float and rect settings. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43081 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../debugger/settings/generic/Setting.cpp | 71 +++++++++++++++++++ src/apps/debugger/settings/generic/Setting.h | 50 ++++++++++++- 2 files changed, 120 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/settings/generic/Setting.cpp b/src/apps/debugger/settings/generic/Setting.cpp index f8390e0247..f704699270 100644 --- a/src/apps/debugger/settings/generic/Setting.cpp +++ b/src/apps/debugger/settings/generic/Setting.cpp @@ -34,6 +34,23 @@ BoolSetting::DefaultValue() const } +// #pragma mark - FloatSetting + + +setting_type +FloatSetting::Type() const +{ + return SETTING_TYPE_FLOAT; +} + + +BVariant +FloatSetting::DefaultValue() const +{ + return DefaultFloatValue(); +} + + // #pragma mark - SettingsOption @@ -71,6 +88,22 @@ RangeSetting::Type() const } +// #pragma mark - RectSetting + +setting_type +RectSetting::Type() const +{ + return SETTING_TYPE_RECT; +} + + +BVariant +RectSetting::DefaultValue() const +{ + return DefaultRectValue(); +} + + // #pragma mark - AbstractSetting @@ -115,6 +148,25 @@ BoolSettingImpl::DefaultBoolValue() const } +// #pragma mark - FloatSettingImpl + + +FloatSettingImpl::FloatSettingImpl(const BString& id, const BString& name, + float defaultValue) + : + AbstractSetting(id, name), + fDefaultValue(defaultValue) +{ +} + + +float +FloatSettingImpl::DefaultFloatValue() const +{ + return fDefaultValue; +} + + // #pragma mark - OptionsSettingImpl @@ -263,3 +315,22 @@ RangeSettingImpl::UpperBound() const { return fUpperBound; } + + +// #pragma mark - RectSettingImpl + + +RectSettingImpl::RectSettingImpl(const BString& id, const BString& name, + const BRect& defaultValue) + : + AbstractSetting(id, name), + fDefaultValue(defaultValue) +{ +} + + +BRect +RectSettingImpl::DefaultRectValue() const +{ + return fDefaultValue; +} diff --git a/src/apps/debugger/settings/generic/Setting.h b/src/apps/debugger/settings/generic/Setting.h index f434008a5f..e779451f00 100644 --- a/src/apps/debugger/settings/generic/Setting.h +++ b/src/apps/debugger/settings/generic/Setting.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef SETTING_H @@ -15,8 +16,10 @@ enum setting_type { SETTING_TYPE_BOOL, + SETTING_TYPE_FLOAT, SETTING_TYPE_OPTIONS, - SETTING_TYPE_RANGE + SETTING_TYPE_RANGE, + SETTING_TYPE_RECT }; @@ -42,6 +45,16 @@ public: }; +class FloatSetting : public virtual Setting { +public: + virtual setting_type Type() const; + + virtual BVariant DefaultValue() const; + + virtual float DefaultFloatValue() const = 0; +}; + + class SettingsOption : public BReferenceable { public: virtual ~SettingsOption(); @@ -74,6 +87,16 @@ public: }; +class RectSetting : public virtual Setting { +public: + virtual setting_type Type() const; + + virtual BVariant DefaultValue() const; + + virtual BRect DefaultRectValue() const = 0; +}; + + class AbstractSetting : public virtual Setting { public: AbstractSetting(const BString& id, @@ -100,6 +123,18 @@ private: }; +class FloatSettingImpl : public AbstractSetting, public FloatSetting { +public: + FloatSettingImpl(const BString& id, + const BString& name, float defaultValue); + + virtual float DefaultFloatValue() const; + +private: + float fDefaultValue; +}; + + class OptionsSettingImpl : public AbstractSetting, public OptionsSetting { public: OptionsSettingImpl(const BString& id, @@ -149,4 +184,17 @@ private: }; +class RectSettingImpl : public AbstractSetting, public RectSetting { +public: + RectSettingImpl(const BString& id, + const BString& name, + const BRect& defaultValue); + + virtual BRect DefaultRectValue() const; + +private: + BRect fDefaultValue; +}; + + #endif // SETTING_H From 50175c99c4747dcc83dcdeff24c259500cbf7478 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 21:16:14 +0000 Subject: [PATCH 617/702] mmlr + bonefish: Refactor the "allocations_per_caller" KDL command related functions. They expect an instance of a class implementing the new AllocationTrackingCallback interface, now. The only implementation ATM is AllocationCollectorCallback, which does the work the now removed slab_debug_add_allocation_for_caller() did before. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43082 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/slab/MemoryManager.cpp | 9 +- src/system/kernel/slab/MemoryManager.h | 2 +- src/system/kernel/slab/Slab.cpp | 121 ++++++++++++++--------- src/system/kernel/slab/slab_debug.h | 24 +++-- 4 files changed, 99 insertions(+), 57 deletions(-) diff --git a/src/system/kernel/slab/MemoryManager.cpp b/src/system/kernel/slab/MemoryManager.cpp index 21c70e2fc1..6c64fcef6d 100644 --- a/src/system/kernel/slab/MemoryManager.cpp +++ b/src/system/kernel/slab/MemoryManager.cpp @@ -869,7 +869,7 @@ MemoryManager::PerformMaintenance() #if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING /*static*/ bool -MemoryManager::AnalyzeAllocationCallers(bool resetAllocationInfos) +MemoryManager::AnalyzeAllocationCallers(AllocationTrackingCallback& callback) { for (AreaTable::Iterator it = sAreaTable.GetIterator(); Area* area = it.Next();) { @@ -892,9 +892,10 @@ MemoryManager::AnalyzeAllocationCallers(bool resetAllocationInfos) addr_t chunkAddress = _ChunkAddress(metaChunk, chunk); size_t size = reference - chunkAddress + 1; - slab_debug_add_allocation_for_caller( - _TrackingInfoFor((void*)chunkAddress, size), size, - resetAllocationInfos); + if (!callback.ProcessTrackingInfo( + _TrackingInfoFor((void*)chunkAddress, size), size)) { + return false; + } } } } diff --git a/src/system/kernel/slab/MemoryManager.h b/src/system/kernel/slab/MemoryManager.h index df2c6af94b..482cd86471 100644 --- a/src/system/kernel/slab/MemoryManager.h +++ b/src/system/kernel/slab/MemoryManager.h @@ -61,7 +61,7 @@ public: static void PerformMaintenance(); static bool AnalyzeAllocationCallers( - bool resetAllocationInfos); + AllocationTrackingCallback& callback); private: struct Tracing; diff --git a/src/system/kernel/slab/Slab.cpp b/src/system/kernel/slab/Slab.cpp index 3dc5e63615..c7775dec5c 100644 --- a/src/system/kernel/slab/Slab.cpp +++ b/src/system/kernel/slab/Slab.cpp @@ -63,6 +63,8 @@ static const int32 kCallerInfoTableSize = 1024; static caller_info sCallerInfoTable[kCallerInfoTableSize]; static int32 sCallerInfoCount = 0; +static caller_info* get_caller_info(addr_t caller); + RANGE_MARKER_FUNCTION_PROTOTYPES(slab_allocator) RANGE_MARKER_FUNCTION_PROTOTYPES(SlabHashedObjectCache) @@ -327,8 +329,69 @@ dump_cache_info(int argc, char* argv[]) } +// #pragma mark - AllocationTrackingCallback + + #if SLAB_ALLOCATION_TRACKING_AVAILABLE +AllocationTrackingCallback::~AllocationTrackingCallback() +{ +} + +#endif // SLAB_ALLOCATION_TRACKING_AVAILABLE + + +// #pragma mark - + + +#if SLAB_ALLOCATION_TRACKING_AVAILABLE + +namespace { + +class AllocationCollectorCallback : public AllocationTrackingCallback { +public: + AllocationCollectorCallback(bool resetInfos) + : + fResetInfos(resetInfos) + { + } + + virtual bool ProcessTrackingInfo(AllocationTrackingInfo* info, + size_t allocationSize) + { + if (!info->IsInitialized()) + return true; + + addr_t caller = 0; + AbstractTraceEntryWithStackTrace* traceEntry = info->TraceEntry(); + + if (traceEntry != NULL && info->IsTraceEntryValid()) { + caller = tracing_find_caller_in_stack_trace( + traceEntry->StackTrace(), kSlabCodeAddressRanges, + kSlabCodeAddressRangeCount); + } + + caller_info* callerInfo = get_caller_info(caller); + if (callerInfo == NULL) { + kprintf("out of space for caller infos\n"); + return false; + } + + callerInfo->count++; + callerInfo->size += allocationSize; + + if (fResetInfos) + info->Clear(); + + return true; + } + +private: + bool fResetInfos; +}; + +} // unnamed namespace + static caller_info* get_caller_info(addr_t caller) { @@ -369,49 +432,17 @@ caller_info_compare_count(const void* _a, const void* _b) } -bool -slab_debug_add_allocation_for_caller(AllocationTrackingInfo* info, - size_t allocationSize, bool resetAllocationInfos) -{ - if (!info->IsInitialized()) - return true; - - addr_t caller = 0; - AbstractTraceEntryWithStackTrace* traceEntry = info->TraceEntry(); - - if (traceEntry != NULL && info->IsTraceEntryValid()) { - caller = tracing_find_caller_in_stack_trace( - traceEntry->StackTrace(), kSlabCodeAddressRanges, - kSlabCodeAddressRangeCount); - } - - caller_info* callerInfo = get_caller_info(caller); - if (callerInfo == NULL) { - kprintf("out of space for caller infos\n"); - return false; - } - - callerInfo->count++; - callerInfo->size += allocationSize; - - if (resetAllocationInfos) - info->Clear(); - - return true; -} - - #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING static bool analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList, - bool resetAllocationInfos) + AllocationTrackingCallback& callback) { for (SlabList::ConstIterator it = slabList.GetIterator(); slab* slab = it.Next();) { for (uint32 i = 0; i < slab->size; i++) { - if (!slab_debug_add_allocation_for_caller(&slab->tracking[i], - cache->object_size, resetAllocationInfos)) { + if (!callback.ProcessTrackingInfo(&slab->tracking[i], + cache->object_size)) { return false; } } @@ -422,11 +453,11 @@ analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList, static bool -analyze_allocation_callers(ObjectCache* cache, bool resetAllocationInfos) +analyze_allocation_callers(ObjectCache* cache, + AllocationTrackingCallback& callback) { - return analyze_allocation_callers(cache, cache->full, resetAllocationInfos) - && analyze_allocation_callers(cache, cache->partial, - resetAllocationInfos); + return analyze_allocation_callers(cache, cache->full, callback) + && analyze_allocation_callers(cache, cache->partial, callback); } #endif // SLAB_OBJECT_CACHE_ALLOCATION_TRACKING @@ -463,7 +494,8 @@ dump_allocations_per_caller(int argc, char **argv) if (cache != NULL) { #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING - if (!analyze_allocation_callers(cache, resetAllocationInfos)) + AllocationCollectorCallback callback(resetAllocationInfos); + if (!analyze_allocation_callers(cache, callback)) return 0; #else kprintf("Object cache allocation tracking not available. " @@ -473,17 +505,18 @@ dump_allocations_per_caller(int argc, char **argv) return 0; #endif } else { + AllocationCollectorCallback callback(resetAllocationInfos); #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING - ObjectCacheList::Iterator it = sObjectCaches.GetIterator(); - while (it.HasNext()) { - if (!analyze_allocation_callers(it.Next(), resetAllocationInfos)) + for (ObjectCacheList::Iterator it = sObjectCaches.GetIterator(); + it.HasNext();) { + if (!analyze_allocation_callers(it.Next(), callback)) return 0; } #endif #if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING - if (!MemoryManager::AnalyzeAllocationCallers(resetAllocationInfos)) + if (!MemoryManager::AnalyzeAllocationCallers(callback)) return 0; #endif } diff --git a/src/system/kernel/slab/slab_debug.h b/src/system/kernel/slab/slab_debug.h index bc356b11a3..baf08002fd 100644 --- a/src/system/kernel/slab/slab_debug.h +++ b/src/system/kernel/slab/slab_debug.h @@ -86,6 +86,22 @@ public: } }; + +namespace BKernel { + +class AllocationTrackingCallback { +public: + virtual ~AllocationTrackingCallback(); + + virtual bool ProcessTrackingInfo( + AllocationTrackingInfo* info, + size_t allocationSize) = 0; +}; + +} + +using BKernel::AllocationTrackingCallback; + #endif // SLAB_ALLOCATION_TRACKING_AVAILABLE @@ -93,14 +109,6 @@ void dump_object_depot(object_depot* depot); int dump_object_depot(int argCount, char** args); int dump_depot_magazine(int argCount, char** args); -#if SLAB_ALLOCATION_TRACKING_AVAILABLE - -bool slab_debug_add_allocation_for_caller( - AllocationTrackingInfo* info, size_t allocationSize, - bool resetAllocationInfos); - -#endif // SLAB_ALLOCATION_TRACKING_AVAILABLE - #if PARANOID_KERNEL_MALLOC || PARANOID_KERNEL_FREE static inline void* From 7014f7f3e47a6ce3068eb4571922a53d61747523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 1 Nov 2011 21:29:19 +0000 Subject: [PATCH 618/702] Fix method name in trace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43083 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/arch/x86/paging/32bit/X86PagingMethod32Bit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/arch/x86/paging/32bit/X86PagingMethod32Bit.cpp b/src/system/kernel/arch/x86/paging/32bit/X86PagingMethod32Bit.cpp index 97e2ee1261..9f84057e2d 100644 --- a/src/system/kernel/arch/x86/paging/32bit/X86PagingMethod32Bit.cpp +++ b/src/system/kernel/arch/x86/paging/32bit/X86PagingMethod32Bit.cpp @@ -263,7 +263,7 @@ status_t X86PagingMethod32Bit::Init(kernel_args* args, VMPhysicalPageMapper** _physicalPageMapper) { - TRACE("vm_translation_map_init: entry\n"); + TRACE("X86PagingMethod32Bit::Init(): entry\n"); // page hole set up in stage2 fPageHole = (page_table_entry*)args->arch_args.page_hole; @@ -310,7 +310,7 @@ X86PagingMethod32Bit::Init(kernel_args* args, x86_write_cr4(x86_read_cr4() | IA32_CR4_GLOBAL_PAGES); } - TRACE("vm_translation_map_init: done\n"); + TRACE("X86PagingMethod32Bit::Init(): done\n"); *_physicalPageMapper = fPhysicalPageMapper; return B_OK; From a5e2a43050d65404153e20c01681d3463948610b Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 1 Nov 2011 21:40:40 +0000 Subject: [PATCH 619/702] Fix the build with memory manager tracing disabled. The guard was missing in the header. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43084 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/slab/MemoryManager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/kernel/slab/MemoryManager.h b/src/system/kernel/slab/MemoryManager.h index 482cd86471..1e6cfbf781 100644 --- a/src/system/kernel/slab/MemoryManager.h +++ b/src/system/kernel/slab/MemoryManager.h @@ -60,8 +60,10 @@ public: static bool MaintenanceNeeded(); static void PerformMaintenance(); +#if SLAB_MEMORY_MANAGER_ALLOCATION_TRACKING static bool AnalyzeAllocationCallers( AllocationTrackingCallback& callback); +#endif private: struct Tracing; From 328df922e6fe47e466937aa518456b10ec7a9320 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 22:22:14 +0000 Subject: [PATCH 620/702] mmlr + bonefish: * Add TraceOutput::PrintArgs(), a va_list version of Print(). * Move code of TraceOutput::Print() to new private template function print_stack_trace(). * Add public tracing_print_stack_trace(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43085 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/tracing.h | 51 ++++++++++++++-------- src/system/kernel/debug/tracing.cpp | 68 ++++++++++++++++++++++++----- 2 files changed, 90 insertions(+), 29 deletions(-) diff --git a/headers/private/kernel/tracing.h b/headers/private/kernel/tracing.h index 49999b1b9b..d1a91fc8a7 100644 --- a/headers/private/kernel/tracing.h +++ b/headers/private/kernel/tracing.h @@ -10,6 +10,7 @@ #include #include +#include #include #include "tracing_config.h" @@ -41,30 +42,31 @@ struct tracing_stack_trace { class TraceOutput { - public: - TraceOutput(char* buffer, size_t bufferSize, uint32 flags); +public: + TraceOutput(char* buffer, size_t bufferSize, uint32 flags); - void Clear(); - void Print(const char* format,...) - __attribute__ ((format (__printf__, 2, 3))); - void PrintStackTrace(tracing_stack_trace* stackTrace); - bool IsFull() const { return fSize >= fCapacity; } + void Clear(); + void Print(const char* format,...) + __attribute__ ((format (__printf__, 2, 3))); + void PrintArgs(const char* format, va_list args); + void PrintStackTrace(tracing_stack_trace* stackTrace); + bool IsFull() const { return fSize >= fCapacity; } - char* Buffer() const { return fBuffer; } - size_t Capacity() const { return fCapacity; } - size_t Size() const { return fSize; } + char* Buffer() const { return fBuffer; } + size_t Capacity() const { return fCapacity; } + size_t Size() const { return fSize; } - uint32 Flags() const { return fFlags; } + uint32 Flags() const { return fFlags; } - void SetLastEntryTime(bigtime_t time); - bigtime_t LastEntryTime() const; + void SetLastEntryTime(bigtime_t time); + bigtime_t LastEntryTime() const; - private: - char* fBuffer; - size_t fCapacity; - size_t fSize; - uint32 fFlags; - bigtime_t fLastEntryTime; +private: + char* fBuffer; + size_t fCapacity; + size_t fSize; + uint32 fFlags; + bigtime_t fLastEntryTime; }; @@ -251,6 +253,16 @@ private: }; +inline void +TraceOutput::Print(const char* format,...) +{ + va_list args; + va_start(args, format); + PrintArgs(format, args); + va_end(args); +} + + int dump_tracing(int argc, char** argv, WrapperTraceFilter* wrapperFilter); bool tracing_is_entry_valid(TraceEntry* entry, bigtime_t entryTime); @@ -272,6 +284,7 @@ struct tracing_stack_trace* capture_tracing_stack_trace(int32 maxCount, addr_t tracing_find_caller_in_stack_trace( struct tracing_stack_trace* stackTrace, const addr_t excludeRanges[], uint32 excludeRangeCount); +void tracing_print_stack_trace(struct tracing_stack_trace* stackTrace); void lock_tracing_buffer(); void unlock_tracing_buffer(); diff --git a/src/system/kernel/debug/tracing.cpp b/src/system/kernel/debug/tracing.cpp index 45861833f6..2b178a8521 100644 --- a/src/system/kernel/debug/tracing.cpp +++ b/src/system/kernel/debug/tracing.cpp @@ -7,7 +7,6 @@ #include -#include #include #include @@ -59,6 +58,26 @@ static const size_t kMaxTracingEntryByteSize = ((1 << 13) - 1) * sizeof(trace_entry); +struct TraceOutputPrint { + TraceOutputPrint(TraceOutput& output) + : + fOutput(output) + { + } + + void operator()(const char* format,...) const + { + va_list args; + va_start(args, format); + fOutput.PrintArgs(format, args); + va_end(args); + } + +private: + TraceOutput& fOutput; +}; + + class TracingMetaData { public: static status_t Create(TracingMetaData*& _metaData); @@ -112,6 +131,33 @@ static bool sTracingDataRecovered = false; // #pragma mark - +template +static void +print_stack_trace(struct tracing_stack_trace* stackTrace, + const Print& print) +{ + if (stackTrace == NULL || stackTrace->depth <= 0) + return; + + for (int32 i = 0; i < stackTrace->depth; i++) { + addr_t address = stackTrace->return_addresses[i]; + + const char* symbol; + const char* imageName; + bool exactMatch; + addr_t baseAddress; + + if (elf_debug_lookup_symbol_address(address, &baseAddress, &symbol, + &imageName, &exactMatch) == B_OK) { + print(" %p %s + 0x%lx (%s)%s\n", (void*)address, symbol, + address - baseAddress, imageName, + exactMatch ? "" : " (nearest)"); + } else + print(" %p\n", (void*)address); + } +} + + // #pragma mark - TracingMetaData @@ -618,20 +664,14 @@ TraceOutput::Clear() void -TraceOutput::Print(const char* format,...) +TraceOutput::PrintArgs(const char* format, va_list args) { #if ENABLE_TRACING if (IsFull()) return; - if (fSize < fCapacity) { - va_list args; - va_start(args, format); - size_t length = vsnprintf(fBuffer + fSize, fCapacity - fSize, format, - args); - fSize += std::min(length, fCapacity - fSize - 1); - va_end(args); - } + size_t length = vsnprintf(fBuffer + fSize, fCapacity - fSize, format, args); + fSize += std::min(length, fCapacity - fSize - 1); #endif } @@ -640,6 +680,7 @@ void TraceOutput::PrintStackTrace(tracing_stack_trace* stackTrace) { #if ENABLE_TRACING + print_stack_trace(stackTrace, TraceOutputPrint(*this)); if (stackTrace == NULL || stackTrace->depth <= 0) return; @@ -1634,6 +1675,13 @@ tracing_find_caller_in_stack_trace(struct tracing_stack_trace* stackTrace, } +void +tracing_print_stack_trace(struct tracing_stack_trace* stackTrace) +{ + print_stack_trace(stackTrace, kprintf); +} + + int dump_tracing(int argc, char** argv, WrapperTraceFilter* wrapperFilter) { From e32699b4048dd37347a98122177cec936b2b36a8 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 22:23:37 +0000 Subject: [PATCH 621/702] mmlr + bonefish: Add ObjectCache::ObjectAtIndex(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43086 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/slab/ObjectCache.cpp | 9 ++++++++- src/system/kernel/slab/ObjectCache.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/slab/ObjectCache.cpp b/src/system/kernel/slab/ObjectCache.cpp index a68c2ce521..d16ff02943 100644 --- a/src/system/kernel/slab/ObjectCache.cpp +++ b/src/system/kernel/slab/ObjectCache.cpp @@ -141,7 +141,7 @@ ObjectCache::InitSlab(slab* slab, void* pages, size_t byteCount, uint32 flags) CREATE_PARANOIA_CHECK_SET(slab, "slab"); - + for (size_t i = 0; i < slab->size; i++) { status_t status = B_OK; if (constructor) @@ -245,6 +245,13 @@ ObjectCache::ReturnObjectToSlab(slab* source, void* object, uint32 flags) } +void* +ObjectCache::ObjectAtIndex(slab* source, int32 index) const +{ + return (uint8*)source->pages + source->offset + index * object_size; +} + + #if PARANOID_KERNEL_FREE bool diff --git a/src/system/kernel/slab/ObjectCache.h b/src/system/kernel/slab/ObjectCache.h index 1c45c96c9b..27c56cf9c4 100644 --- a/src/system/kernel/slab/ObjectCache.h +++ b/src/system/kernel/slab/ObjectCache.h @@ -106,6 +106,7 @@ public: void ReturnObjectToSlab(slab* source, void* object, uint32 flags); + void* ObjectAtIndex(slab* source, int32 index) const; bool Lock() { return mutex_lock(&lock) == B_OK; } void Unlock() { mutex_unlock(&lock); } From f606e8fd79b26ccfa5a7a50e3caeb560ab1ac9a9 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Nov 2011 22:26:23 +0000 Subject: [PATCH 622/702] mmlr + bonefish: * AllocationTrackingCallback::ProcessTrackingInfo(): Also pass the allocation pointer. * "allocations_per_caller" KDL command: Add option "-d". When given, each allocation for the specified caller is printed, including the respective stack trace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43087 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/slab/MemoryManager.cpp | 3 +- src/system/kernel/slab/Slab.cpp | 70 ++++++++++++++++++++++-- src/system/kernel/slab/slab_debug.h | 1 + 3 files changed, 68 insertions(+), 6 deletions(-) diff --git a/src/system/kernel/slab/MemoryManager.cpp b/src/system/kernel/slab/MemoryManager.cpp index 6c64fcef6d..bde45cedf5 100644 --- a/src/system/kernel/slab/MemoryManager.cpp +++ b/src/system/kernel/slab/MemoryManager.cpp @@ -893,7 +893,8 @@ MemoryManager::AnalyzeAllocationCallers(AllocationTrackingCallback& callback) size_t size = reference - chunkAddress + 1; if (!callback.ProcessTrackingInfo( - _TrackingInfoFor((void*)chunkAddress, size), size)) { + _TrackingInfoFor((void*)chunkAddress, size), + (void*)chunkAddress, size)) { return false; } } diff --git a/src/system/kernel/slab/Slab.cpp b/src/system/kernel/slab/Slab.cpp index c7775dec5c..c9c5b08f6c 100644 --- a/src/system/kernel/slab/Slab.cpp +++ b/src/system/kernel/slab/Slab.cpp @@ -357,7 +357,7 @@ public: } virtual bool ProcessTrackingInfo(AllocationTrackingInfo* info, - size_t allocationSize) + void* allocation, size_t allocationSize) { if (!info->IsInitialized()) return true; @@ -390,6 +390,45 @@ private: bool fResetInfos; }; + +class AllocationDetailPrinterCallback : public AllocationTrackingCallback { +public: + AllocationDetailPrinterCallback(addr_t caller) + : + fCaller(caller) + { + } + + virtual bool ProcessTrackingInfo(AllocationTrackingInfo* info, + void* allocation, size_t allocationSize) + { + if (!info->IsInitialized()) + return true; + + addr_t caller = 0; + AbstractTraceEntryWithStackTrace* traceEntry = info->TraceEntry(); + + if (traceEntry != NULL && info->IsTraceEntryValid()) { + caller = tracing_find_caller_in_stack_trace( + traceEntry->StackTrace(), kSlabCodeAddressRanges, + kSlabCodeAddressRangeCount); + } + + if (caller != fCaller) + return true; + + kprintf("allocation %p, size: %" B_PRIuSIZE "\n", allocation, + allocationSize); + if (traceEntry != NULL) + tracing_print_stack_trace(traceEntry->StackTrace()); + + return true; + } + +private: + addr_t fCaller; +}; + } // unnamed namespace static caller_info* @@ -442,7 +481,7 @@ analyze_allocation_callers(ObjectCache* cache, const SlabList& slabList, slab* slab = it.Next();) { for (uint32 i = 0; i < slab->size; i++) { if (!callback.ProcessTrackingInfo(&slab->tracking[i], - cache->object_size)) { + cache->ObjectAtIndex(slab, i), cache->object_size)) { return false; } } @@ -468,11 +507,23 @@ dump_allocations_per_caller(int argc, char **argv) { bool sortBySize = true; bool resetAllocationInfos = false; + bool printDetails = false; ObjectCache* cache = NULL; + addr_t caller = 0; for (int32 i = 1; i < argc; i++) { if (strcmp(argv[i], "-c") == 0) { sortBySize = false; + } else if (strcmp(argv[i], "-d") == 0) { + uint64 callerAddress; + if (++i >= argc + || !evaluate_debug_expression(argv[i], &callerAddress, true)) { + print_debugger_command_usage(argv[0]); + return 0; + } + + caller = callerAddress; + printDetails = true; } else if (strcmp(argv[i], "-o") == 0) { uint64 cacheAddress; if (++i >= argc @@ -492,9 +543,14 @@ dump_allocations_per_caller(int argc, char **argv) sCallerInfoCount = 0; + AllocationCollectorCallback collectorCallback(resetAllocationInfos); + AllocationDetailPrinterCallback detailsCallback(caller); + AllocationTrackingCallback& callback = printDetails + ? (AllocationTrackingCallback&)detailsCallback + : (AllocationTrackingCallback&)collectorCallback; + if (cache != NULL) { #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING - AllocationCollectorCallback callback(resetAllocationInfos); if (!analyze_allocation_callers(cache, callback)) return 0; #else @@ -505,7 +561,6 @@ dump_allocations_per_caller(int argc, char **argv) return 0; #endif } else { - AllocationCollectorCallback callback(resetAllocationInfos); #if SLAB_OBJECT_CACHE_ALLOCATION_TRACKING for (ObjectCacheList::Iterator it = sObjectCaches.GetIterator(); @@ -521,6 +576,9 @@ dump_allocations_per_caller(int argc, char **argv) #endif } + if (printDetails) + return 0; + // sort the array qsort(sCallerInfoTable, sCallerInfoCount, sizeof(caller_info), sortBySize ? &caller_info_compare_size : &caller_info_compare_count); @@ -1102,11 +1160,13 @@ slab_init_post_area() add_debugger_command_etc("allocations_per_caller", &dump_allocations_per_caller, "Dump current heap allocations summed up per caller", - "[ -c ] [ -o ] [ -r ]\n" + "[ -c ] [ -d ] [ -o ] [ -r ]\n" "The current allocations will by summed up by caller (their count and\n" "size) printed in decreasing order by size or, if \"-c\" is\n" "specified, by allocation count. If given specifies\n" "the address of the object cache for which to print the allocations.\n" + "If \"-d\" is given, each allocation for caller is printed\n" + "including the respective stack trace.\n" "If \"-r\" is given, the allocation infos are reset after gathering\n" "the information, so the next command invocation will only show the\n" "allocations made after the reset.\n", 0); diff --git a/src/system/kernel/slab/slab_debug.h b/src/system/kernel/slab/slab_debug.h index baf08002fd..319efd4090 100644 --- a/src/system/kernel/slab/slab_debug.h +++ b/src/system/kernel/slab/slab_debug.h @@ -95,6 +95,7 @@ public: virtual bool ProcessTrackingInfo( AllocationTrackingInfo* info, + void* allocation, size_t allocationSize) = 0; }; From 45cbd8143649b2fc1a82b9d153eaf52073f641dd Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 1 Nov 2011 22:49:32 +0000 Subject: [PATCH 623/702] Fix build with tracing disabled. Since capture_tracing_stack_trace() doesn't return a stack trace when tracing is disabled we don't really need to be able to print one either. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43088 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/debug/tracing.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/kernel/debug/tracing.cpp b/src/system/kernel/debug/tracing.cpp index 2b178a8521..a7c424d6fe 100644 --- a/src/system/kernel/debug/tracing.cpp +++ b/src/system/kernel/debug/tracing.cpp @@ -1678,7 +1678,9 @@ tracing_find_caller_in_stack_trace(struct tracing_stack_trace* stackTrace, void tracing_print_stack_trace(struct tracing_stack_trace* stackTrace) { +#if ENABLE_TRACING print_stack_trace(stackTrace, kprintf); +#endif } From 3cb4f942953c16c1e6c6f88601a4d17c0bc30713 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 2 Nov 2011 00:06:53 +0000 Subject: [PATCH 624/702] Add macro to BeBuild.h for declaring a weak alias. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43089 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/BeBuild.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/headers/os/BeBuild.h b/headers/os/BeBuild.h index 678bf4abad..63fac1f98c 100644 --- a/headers/os/BeBuild.h +++ b/headers/os/BeBuild.h @@ -78,4 +78,8 @@ #define B_DEFINE_SYMBOL_VERSION(function, versionedSymbol) \ __asm__(".symver " function "," versionedSymbol) +#define B_DEFINE_WEAK_ALIAS(name, alias_name) \ + __typeof (name) alias_name __attribute__ ((weak, alias (#name))) + + #endif /* _BE_BUILD_H */ From 3063b5a05e6ed5e8809bb36d2175e30d2506f953 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 2 Nov 2011 00:09:52 +0000 Subject: [PATCH 625/702] Add private headers for internal versions of wchar/multibye-functions. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43090 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/libroot/wchar_private.h | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 headers/private/libroot/wchar_private.h diff --git a/headers/private/libroot/wchar_private.h b/headers/private/libroot/wchar_private.h new file mode 100644 index 0000000000..6fc699ff62 --- /dev/null +++ b/headers/private/libroot/wchar_private.h @@ -0,0 +1,69 @@ +/* + * Copyright 2011, Oliver Tappe . All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _LIBROOT_WCHAR_PRIVATE_H +#define _LIBROOT_WCHAR_PRIVATE_H + + +#include + +#include +#include + + +__BEGIN_DECLS + + +extern wint_t __btowc(int); + +extern size_t __mbrlen(const char *s, size_t n, mbstate_t *ps); +extern size_t __mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); +extern int __mbsinit(const mbstate_t *); +extern size_t __mbsrtowcs(wchar_t *dst, const char **src, size_t len, + mbstate_t *ps); + +extern size_t __wcrtomb(char *, wchar_t, mbstate_t *); +extern wchar_t *__wcscat(wchar_t *, const wchar_t *); +extern wchar_t *__wcschr(const wchar_t *, wchar_t); +extern int __wcscmp(const wchar_t *ws1, const wchar_t *ws2); +extern int __wcscoll(const wchar_t *ws1, const wchar_t *ws2); +extern wchar_t *__wcscpy(wchar_t *, const wchar_t *); +extern size_t __wcscspn(const wchar_t *, const wchar_t *); +extern wchar_t *__wcsdup(const wchar_t *); +extern size_t __wcsftime(wchar_t *, size_t, const wchar_t *, + const struct tm *); +extern size_t __wcslen(const wchar_t *); +extern wchar_t *__wcsncat(wchar_t *, const wchar_t *, size_t); +extern int __wcsncmp(const wchar_t *, const wchar_t *, size_t); +extern wchar_t *__wcsncpy(wchar_t *, const wchar_t *, size_t); +extern wchar_t *__wcspbrk(const wchar_t *, const wchar_t *); +extern wchar_t *__wcsrchr(const wchar_t *, wchar_t); +extern size_t __wcsrtombs(char *dst, const wchar_t **src, size_t len, + mbstate_t *ps); +extern size_t __wcsspn(const wchar_t *, const wchar_t *); +extern wchar_t *__wcsstr(const wchar_t *, const wchar_t *); +extern double __wcstod(const wchar_t *, wchar_t **); +extern float __wcstof(const wchar_t *, wchar_t **); +extern wchar_t *__wcstok(wchar_t *, const wchar_t *, wchar_t **); +extern long __wcstol(const wchar_t *, wchar_t **, int); +extern long double __wcstold(const wchar_t *, wchar_t **); +extern long long __wcstoll(const wchar_t *, wchar_t **, int); +extern unsigned long __wcstoul(const wchar_t *, wchar_t **, int); +extern unsigned long long __wcstoull(const wchar_t *, wchar_t **, int); +extern wchar_t *__wcswcs(const wchar_t *, const wchar_t *); +extern int __wcswidth(const wchar_t *, size_t); +extern size_t __wcsxfrm(wchar_t *, const wchar_t *, size_t); +extern int __wctob(wint_t); +extern int __wcwidth(wchar_t); +extern wchar_t *__wmemchr(const wchar_t *, wchar_t, size_t); +extern int __wmemcmp(const wchar_t *, const wchar_t *, size_t); +extern wchar_t *__wmemcpy(wchar_t *, const wchar_t *, size_t); +extern wchar_t *__wmemmove(wchar_t *, const wchar_t *, size_t); +extern wchar_t *__wmemset(wchar_t *, wchar_t, size_t); + + +__END_DECLS + + +#endif // _LIBROOT_WCHAR_PRIVATE_H From acbd89984d5035bc8416bf8fbd1737e1ec7e25cc Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 2 Nov 2011 00:10:54 +0000 Subject: [PATCH 626/702] Add more tests for wchar/multibyte converter functions. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43091 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/system/libroot/posix/Jamfile | 3 + .../system/libroot/posix/gnulib-test-btowc.c | 76 ++++ .../libroot/posix/gnulib-test-mbrtowc.c | 370 ++++++++++++++++++ .../libroot/posix/gnulib-test-wcrtomb.c | 187 +++++++++ src/tests/system/libroot/posix/tst-mbrtowc.c | 2 +- 5 files changed, 637 insertions(+), 1 deletion(-) create mode 100644 src/tests/system/libroot/posix/gnulib-test-btowc.c create mode 100644 src/tests/system/libroot/posix/gnulib-test-mbrtowc.c create mode 100644 src/tests/system/libroot/posix/gnulib-test-wcrtomb.c diff --git a/src/tests/system/libroot/posix/Jamfile b/src/tests/system/libroot/posix/Jamfile index 32dd64bd39..6dcccf662c 100644 --- a/src/tests/system/libroot/posix/Jamfile +++ b/src/tests/system/libroot/posix/Jamfile @@ -37,6 +37,9 @@ SimpleTest xsi_msg_queue_test1 : xsi_msg_queue_test1.cpp ; SimpleTest xsi_sem_test1 : xsi_sem_test1.cpp ; # wide character tests +SimpleTest gnulib-test-btowc : gnulib-test-btowc.c ; +SimpleTest gnulib-test-mbrtowc : gnulib-test-mbrtowc.c ; +SimpleTest gnulib-test-wcrtomb : gnulib-test-wcrtomb.c ; SimpleTest mbtest : mbtest.c ; SimpleTest testmb : testmb.c ; SimpleTest tst-btowc : tst-btowc.c ; diff --git a/src/tests/system/libroot/posix/gnulib-test-btowc.c b/src/tests/system/libroot/posix/gnulib-test-btowc.c new file mode 100644 index 0000000000..424ba83600 --- /dev/null +++ b/src/tests/system/libroot/posix/gnulib-test-btowc.c @@ -0,0 +1,76 @@ +/* Test of conversion of unibyte character to wide character. + Copyright (C) 2008-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2008. */ + +#include +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + int c, i; + + /* configure should already have checked that the locale is supported. */ + if (setlocale (LC_ALL, "") == NULL) { + fprintf(stderr, "unable to set standard locale\n"); + return 1; + } + + assert (btowc (EOF) == WEOF); + + for (i = '1'; i <= '2'; ++i) { + switch (i) + { + case '1': + /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ + printf("ISO8859-1 ...\n"); + + if (setlocale (LC_ALL, "en_US.ISO8859-1") == NULL) { + fprintf(stderr, "unable to set ISO8859-1 locale, skipping\n"); + break; + } + + for (c = 0; c < 0x80; c++) + assert (btowc (c) == (wint_t)c); + for (c = 0xA0; c < 0x100; c++) + assert (btowc (c) != WEOF); + break; + + case '2': + /* Locale encoding is UTF-8. */ + printf("UTF-8 ...\n"); + + if (setlocale (LC_ALL, "en_US.ISO8859-1") == NULL) { + fprintf(stderr, "unable to set ISO8859-1 locale, skipping\n"); + break; + } + + for (c = 0; c < 0x80; c++) + assert (btowc (c) == (wint_t)c); + for (c = 0x80; c < 0x100; c++) +{ +printf("btowc(%d) = %x\n", c, btowc(c)); + assert (btowc (c) == WEOF); +} + break; + } + } + + return 0; +} diff --git a/src/tests/system/libroot/posix/gnulib-test-mbrtowc.c b/src/tests/system/libroot/posix/gnulib-test-mbrtowc.c new file mode 100644 index 0000000000..35322e098f --- /dev/null +++ b/src/tests/system/libroot/posix/gnulib-test-mbrtowc.c @@ -0,0 +1,370 @@ +/* Test of conversion of multibyte character to wide character. + Copyright (C) 2008-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2008. */ + +#undef NDEBUG +#include +#include +#include +#include +#include + +#include + +int +main (int argc, char *argv[]) +{ + mbstate_t state; + wchar_t wc; + size_t ret; + int i; + + /* configure should already have checked that the locale is supported. */ + if (setlocale (LC_ALL, "") == NULL) { + fprintf(stderr, "unable to set standard locale\n"); + return 1; + } + + /* Test zero-length input. */ + printf("zero-length input ...\n"); + { + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, "x", 0, &state); + /* gnulib's implementation returns (size_t)(-2). + The AIX 5.1 implementation returns (size_t)(-1). + glibc's implementation returns 0. */ + assert (ret == (size_t)(-2) || ret == (size_t)(-1) || ret == 0); + assert (mbsinit (&state)); + } + + /* Test NUL byte input. */ + printf("NUL byte input ...\n"); + { + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, "", 1, &state); + assert (ret == 0); + assert (wc == 0); + assert (mbsinit (&state)); + ret = mbrtowc (NULL, "", 1, &state); + assert (ret == 0); + assert (mbsinit (&state)); + } + + /* Test single-byte input. */ + printf("single-byte input ...\n"); + { + char buf[1]; + int c; + + memset (&state, '\0', sizeof (mbstate_t)); + for (c = 0; c < 0x100; c++) + switch (c) + { + case '\t': case '\v': case '\f': + case ' ': case '!': case '"': case '#': case '%': + case '&': case '\'': case '(': case ')': case '*': + case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': + case '?': + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': + case 'Z': + case '[': case '\\': case ']': case '^': case '_': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': + case 'z': case '{': case '|': case '}': case '~': + /* c is in the ISO C "basic character set". */ + buf[0] = c; + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, buf, 1, &state); + assert (ret == 1); + assert (wc == c); + assert (mbsinit (&state)); + ret = mbrtowc (NULL, buf, 1, &state); + assert (ret == 1); + assert (mbsinit (&state)); + break; + } + } + + /* Test special calling convention, passing a NULL pointer. */ + printf("special calling convention, passing NULL ...\n"); + { + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, NULL, 5, &state); + assert (ret == 0); + assert (wc == (wchar_t) 0xBADFACE); + assert (mbsinit (&state)); + } + + for (i = '1'; i <= '4'; ++i) { + switch (i) + { + case '1': + /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ + printf("ISO8859-1 ...\n"); + { + char input[] = "B\374\337er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + if (setlocale (LC_ALL, "en_US.ISO8859-1") == NULL) { + fprintf(stderr, "unable to set ISO8859-1 locale, skipping\n"); + break; + } + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + assert (ret == 1); + assert (wc == 'B'); + assert (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + assert (ret == 1); + assert (wctob (wc) == (unsigned char) '\374'); + assert (mbsinit (&state)); + input[1] = '\0'; + + /* Test support of NULL first argument. */ + ret = mbrtowc (NULL, input + 2, 3, &state); + assert (ret == 1); + assert (mbsinit (&state)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 3, &state); + assert (ret == 1); + assert (wctob (wc) == (unsigned char) '\337'); + assert (mbsinit (&state)); + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 2, &state); + assert (ret == 1); + assert (wc == 'e'); + assert (mbsinit (&state)); + input[3] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 4, 1, &state); + assert (ret == 1); + assert (wc == 'r'); + assert (mbsinit (&state)); + } + break; + + case '2': + /* Locale encoding is UTF-8. */ + printf("UTF-8 ...\n"); + { + char input[] = "B\303\274\303\237er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + if (setlocale (LC_ALL, "en_US.UTF-8") == NULL) { + fprintf(stderr, "unable to set UTF-8 locale, skipping\n"); + break; + } + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + assert (ret == 1); + assert (wc == 'B'); + assert (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + assert (ret == (size_t)(-2)); + assert (wc == (wchar_t) 0xBADFACE); + assert (!mbsinit (&state)); + input[1] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 5, &state); + assert (ret == 1); + assert (wctob (wc) == EOF); + assert (mbsinit (&state)); + input[2] = '\0'; + + /* Test support of NULL first argument. */ + ret = mbrtowc (NULL, input + 3, 4, &state); + assert (ret == 2); + assert (mbsinit (&state)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 4, &state); + assert (ret == 2); + assert (wctob (wc) == EOF); + assert (mbsinit (&state)); + input[3] = '\0'; + input[4] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 5, 2, &state); + assert (ret == 1); + assert (wc == 'e'); + assert (mbsinit (&state)); + input[5] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 6, 1, &state); + assert (ret == 1); + assert (wc == 'r'); + assert (mbsinit (&state)); + } + break; + + case '3': + /* Locale encoding is EUC-JP. */ + printf("EUC-JP ...\n"); + { + char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ + memset (&state, '\0', sizeof (mbstate_t)); + + if (setlocale (LC_ALL, "en_US.EUC-JP") == NULL) { + fprintf(stderr, "unable to set EUC-JP locale, skipping\n"); + break; + } + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + assert (ret == 1); + assert (wc == '<'); + assert (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 2, &state); + assert (ret == 2); + assert (wctob (wc) == EOF); + assert (mbsinit (&state)); + input[1] = '\0'; + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 1, &state); + assert (ret == (size_t)(-2)); + assert (wc == (wchar_t) 0xBADFACE); + assert (!mbsinit (&state)); + input[3] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 4, 4, &state); + assert (ret == 1); + assert (wctob (wc) == EOF); + assert (mbsinit (&state)); + input[4] = '\0'; + + /* Test support of NULL first argument. */ + ret = mbrtowc (NULL, input + 5, 3, &state); + assert (ret == 2); + assert (mbsinit (&state)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 5, 3, &state); + assert (ret == 2); + assert (wctob (wc) == EOF); + assert (mbsinit (&state)); + input[5] = '\0'; + input[6] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 7, 1, &state); + assert (ret == 1); + assert (wc == '>'); + assert (mbsinit (&state)); + } + break; + + case '4': + /* Locale encoding is GB18030. */ + printf("GB18030 ...\n"); + { + char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + if (setlocale (LC_ALL, "en_US.GB18030") == NULL) { + fprintf(stderr, "unable to set GB18030 locale, skipping\n"); + break; + } + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + assert (ret == 1); + assert (wc == 'B'); + assert (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + assert (ret == (size_t)(-2)); + assert (wc == (wchar_t) 0xBADFACE); + assert (!mbsinit (&state)); + input[1] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 7, &state); + assert (ret == 1); + assert (wctob (wc) == EOF); + assert (mbsinit (&state)); + input[2] = '\0'; + + /* Test support of NULL first argument. */ + ret = mbrtowc (NULL, input + 3, 6, &state); + assert (ret == 4); + assert (mbsinit (&state)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 6, &state); + assert (ret == 4); + assert (wctob (wc) == EOF); + assert (mbsinit (&state)); + input[3] = '\0'; + input[4] = '\0'; + input[5] = '\0'; + input[6] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 7, 2, &state); + assert (ret == 1); + assert (wc == 'e'); + assert (mbsinit (&state)); + input[5] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 8, 1, &state); + assert (ret == 1); + assert (wc == 'r'); + assert (mbsinit (&state)); + } + break; + } + } + + return 0; +} diff --git a/src/tests/system/libroot/posix/gnulib-test-wcrtomb.c b/src/tests/system/libroot/posix/gnulib-test-wcrtomb.c new file mode 100644 index 0000000000..d29359728e --- /dev/null +++ b/src/tests/system/libroot/posix/gnulib-test-wcrtomb.c @@ -0,0 +1,187 @@ +/* Test of conversion of wide character to multibyte character. + Copyright (C) 2008-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2008. */ + +#include +#include +#include +#include +#include + +/* Check the multibyte character s[0..n-1]. */ +static void +check_character (const char *s, size_t n) +{ + wchar_t wc; + char buf[64]; + int iret; + size_t ret; + + wc = (wchar_t) 0xBADFACE; + iret = mbtowc (&wc, s, n); + assert (iret == (int)n); + + ret = wcrtomb (buf, wc, NULL); + assert (ret == n); + assert (memcmp (buf, s, n) == 0); + + /* Test special calling convention, passing a NULL pointer. */ + ret = wcrtomb (NULL, wc, NULL); + + assert (ret == 1); +} + +int +main (int argc, char *argv[]) +{ + char buf[64]; + size_t ret; + int i; + + /* configure should already have checked that the locale is supported. */ + if (setlocale (LC_ALL, "") == NULL) { + fprintf(stderr, "unable to set standard locale\n"); + return 1; + } + + /* Test NUL character. */ + printf("NUL character ...\n"); + { + buf[0] = 'x'; + ret = wcrtomb (buf, 0, NULL); + assert (ret == 1); + assert (buf[0] == '\0'); + } + + /* Test single bytes. */ + printf("single bytes ...\n"); + { + int c; + + for (c = 0; c < 0x100; c++) + switch (c) + { + case '\t': case '\v': case '\f': + case ' ': case '!': case '"': case '#': case '%': + case '&': case '\'': case '(': case ')': case '*': + case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': + case '?': + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': + case 'Z': + case '[': case '\\': case ']': case '^': case '_': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': + case 'z': case '{': case '|': case '}': case '~': + /* c is in the ISO C "basic character set". */ + ret = wcrtomb (buf, btowc (c), NULL); + assert (ret == 1); + assert (buf[0] == (char) c); + break; + } + } + + /* Test special calling convention, passing a NULL pointer. */ + printf("special calling convention with NULL pointer ...\n"); + { + ret = wcrtomb (NULL, '\0', NULL); + assert (ret == 1); + ret = wcrtomb (NULL, btowc ('x'), NULL); + assert (ret == 1); + } + + for (i = '1'; i <= '4'; ++i) { + switch (i) + { + case '1': + /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ + printf("ISO8859-1 ...\n"); + { + const char input[] = "B\374\337er"; /* "Büßer" */ + + if (setlocale (LC_ALL, "en_US.ISO8859-1") == NULL) { + fprintf(stderr, "unable to set ISO8859-1 locale, skipping\n"); + break; + } + + check_character (input + 1, 1); + check_character (input + 2, 1); + } + break; + + case '2': + /* Locale encoding is UTF-8. */ + printf("UTF-8 ...\n"); + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + + if (setlocale (LC_ALL, "en_US.UTF-8") == NULL) { + fprintf(stderr, "unable to set UTF-8 locale, skipping\n"); + break; + } + + check_character (input + 1, 2); + check_character (input + 3, 2); + } + break; + + case '3': + /* Locale encoding is EUC-JP. */ + printf("EUC-JP ...\n"); + { + const char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ + + if (setlocale (LC_ALL, "en_US.EUC-JP") == NULL) { + fprintf(stderr, "unable to set EUC-JP locale, skipping\n"); + break; + } + + check_character (input + 1, 2); + check_character (input + 3, 2); + check_character (input + 5, 2); + } + break; + + case '4': + /* Locale encoding is GB18030. */ + printf("GB18030 ...\n"); + { + const char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ + + if (setlocale (LC_ALL, "en_US.GB18030") == NULL) { + fprintf(stderr, "unable to set GB18030 locale, skipping\n"); + break; + } + + check_character (input + 1, 2); + check_character (input + 3, 4); + } + break; + } + } + + return 0; +} diff --git a/src/tests/system/libroot/posix/tst-mbrtowc.c b/src/tests/system/libroot/posix/tst-mbrtowc.c index 8ae6c72085..6d0f23f293 100644 --- a/src/tests/system/libroot/posix/tst-mbrtowc.c +++ b/src/tests/system/libroot/posix/tst-mbrtowc.c @@ -212,7 +212,7 @@ check_ascii(const char *locname) printf("%s: '\\x%x': not 1 returned\n", locname, c); ++res; } else if (wc != (wchar_t) c) { - printf("%s: '\\x%x': wc != L'\\x%x'\n", locname, c, c); + printf("%s: '\\x%x' != wc != L'\\x%x'\n", locname, c, wc); ++res; } } From 001f379993c2a6b597c9469b9de66d372ee3ef8a Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 2 Nov 2011 03:39:20 +0000 Subject: [PATCH 627/702] This commit fixes a bug described in ticket #7051 where Deskbar forgets expanded items when you switch away from expando mode. It does this by keeping a list of expanded item signatures in a fExpandedItems BList on the BarView class. I can't use team_id because there can be more than one team per application. If you have checked the 'Expand new applications' option in the Deskbar preferences then the signatures of new applications will be added to the fExpandedItems list expanding the item. If you open a new application while not in expando mode then the app will be expanded upon returning to expando mode. Since 'Expand new applications' automatically adds any new item's signature to the fExpandedItems list Tracker is expanded on startup since it is 'new'. Also if Deskbar is restarted all applications will be considered 'new' so they are expanded. This fixes ticket #4830 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43092 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/BarApp.cpp | 13 +++- src/apps/deskbar/BarView.cpp | 130 ++++++++++++++++++++++++----------- src/apps/deskbar/BarView.h | 7 +- 3 files changed, 107 insertions(+), 43 deletions(-) diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp index 58664f75a7..9f42ca36ac 100644 --- a/src/apps/deskbar/BarApp.cpp +++ b/src/apps/deskbar/BarApp.cpp @@ -95,6 +95,8 @@ TBarApp::TBarApp() InitSettings(); InitIconPreloader(); + fBarWindow = new TBarWindow(); + be_roster->StartWatching(this); gLocalizedNamePreferred @@ -119,9 +121,15 @@ TBarApp::TBarApp() fSwitcherMessenger = BMessenger(new TSwitchManager(fSettings.switcherLoc)); - fBarWindow = new TBarWindow(); fBarWindow->Show(); + // Call UpdatePlacement() after the window is shown because expanded apps + // need to resize the window. + if (fBarWindow->Lock()) { + BarView()->UpdatePlacement(); + fBarWindow->Unlock(); + } + // this messenger now targets the barview instead of the // statusview so that all additions to the tray // follow the same path @@ -645,6 +653,9 @@ TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref) sBarTeamInfoList.AddItem(barInfo); + if (fSettings.expandNewTeams) + BarView()->AddExpandedItem(sig); + int32 subsCount = sSubscribers.CountItems(); if (subsCount > 0) { for (int32 i = 0; i < subsCount; i++) { diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 638eebc244..f1473a258f 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -68,6 +68,7 @@ const int32 kDefaultRecentAppCount = 10; const int32 kMenuTrackMargin = 20; + TBarView::TBarView(BRect frame, bool vertical, bool left, bool top, bool showInterval, uint32 state, float, bool showTime) : BView(frame, "BarView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW), @@ -99,6 +100,8 @@ TBarView::~TBarView() { delete fDragMessage; delete fCachedTypesList; + + RemoveExpandedItems(); } @@ -405,10 +408,10 @@ TBarView::GetPreferredWindowSize(BRect screenFrame, float* width, float* height) windowHeight = screenFrame.bottom; windowWidth = fBarMenuBar->Frame().Width(); } else if (fState == kExpandoState) { - if (fVertical) + if (fVertical) { // top left or right windowHeight = fExpando->Frame().bottom; - else { + } else { // top or bottom, full fExpando->CheckItemSizes(0); windowHeight = kHModeHeight; @@ -528,58 +531,103 @@ TBarView::ChangeState(int32 state, bool vertical, bool left, bool top) PlaceBeMenu(); PlaceTray(vertSwap, leftSwap, screenFrame); - // We need to keep track of what apps are expanded. - BList expandedItems; - BString* signature = NULL; - if (fVertical && Expando() - && static_cast(be_app)->Settings()->superExpando) { - // Get a list of the signatures of expanded apps. Can't use - // team_id because there can be more than one team per application - if (fVertical && Expando() && vertical && fExpando) { - for (int index = 0; index < fExpando->CountItems(); index++) { - TTeamMenuItem* item - = dynamic_cast(fExpando->ItemAt(index)); - if (item != NULL && item->IsExpanded()) { - signature = new BString(item->Signature()); - expandedItems.AddItem((void*)signature); - } - } - } - } + // Keep track of which apps are expanded + SaveExpandedItems(); PlaceApplicationBar(screenFrame); SizeWindow(screenFrame); PositionWindow(screenFrame); Window()->UpdateIfNeeded(); - // Re-expand those apps. - if (expandedItems.CountItems() > 0) { - for (int sigIndex = expandedItems.CountItems(); sigIndex-- > 0;) { - signature = static_cast(expandedItems.ItemAt(sigIndex)); - if (signature == NULL) - continue; + // Re-expand apps + ExpandItems(); + Invalidate(); +} - // Start at the 'bottom' of the list working up. - // Prevents being thrown off by expanding items. - for (int teamIndex = fExpando->CountItems(); teamIndex-- > 0;) { - TTeamMenuItem* item - = dynamic_cast(fExpando->ItemAt(teamIndex)); - if (item != NULL && !signature->Compare(item->Signature())) { - item->ToggleExpandState(false); + +void +TBarView::SaveExpandedItems() +{ + if (fExpando == NULL || fExpando->CountItems() <= 0) + return; + + // Get a list of the signatures of expanded apps. Can't use + // team_id because there can be more than one team per application + for (int32 i = 0; i < fExpando->CountItems(); i++) { + TTeamMenuItem* teamItem + = dynamic_cast(fExpando->ItemAt(i)); + + if (teamItem != NULL && teamItem->IsExpanded()) + AddExpandedItem(teamItem->Signature()); + } +} + + +void +TBarView::RemoveExpandedItems() +{ + while (!fExpandedItems.IsEmpty()) + delete static_cast(fExpandedItems.RemoveItem((int32)0)); + fExpandedItems.MakeEmpty(); +} + + +void +TBarView::ExpandItems() +{ + if (fExpando == NULL || !fVertical || !Expando() + || !static_cast(be_app)->Settings()->superExpando + || fExpandedItems.CountItems() <= 0) + return; + + // Start at the 'bottom' of the list working up. + // Prevents being thrown off by expanding items. + for (int32 i = fExpando->CountItems() - 1; i >= 0; i--) { + TTeamMenuItem* teamItem + = dynamic_cast(fExpando->ItemAt(i)); + + if (teamItem != NULL) { + // Start at the 'bottom' of the fExpandedItems list working up + // matching the order of the fExpando list in the outer loop. + for (int32 j = fExpandedItems.CountItems() - 1; j >= 0; j--) { + BString* itemSig = + static_cast(fExpandedItems.ItemAt(j)); + + if (itemSig->Compare(teamItem->Signature()) == 0) { + // Found it, expand the item and delete signature from + // the list so that we don't consider it for later items. + teamItem->ToggleExpandState(false); + fExpandedItems.RemoveItem(j); + delete itemSig; break; } } } - - // Clean up expanded signature list. - while (!expandedItems.IsEmpty()) { - delete static_cast(expandedItems.RemoveItem((int32)0)); - } - - fExpando->SizeWindow(); } - Invalidate(); + // Clean up the expanded items list + RemoveExpandedItems(); + + fExpando->SizeWindow(); +} + + +void +TBarView::AddExpandedItem(const char* signature) +{ + bool shouldAdd = true; + + for (int32 i = 0; i < fExpandedItems.CountItems(); i++) { + BString *itemSig = static_cast(fExpandedItems.ItemAt(i)); + if (itemSig->Compare(signature) == 0) { + // already in the list, don't add the signature + shouldAdd = false; + break; + } + } + + if (shouldAdd) + fExpandedItems.AddItem(static_cast(new BString(signature))); } diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h index 5f4bee66dc..e9d3cf996f 100644 --- a/src/apps/deskbar/BarView.h +++ b/src/apps/deskbar/BarView.h @@ -142,7 +142,8 @@ class TBarView : public BView { TExpandoMenuBar* ExpandoMenuBar() const; TBarMenuBar* BarMenuBar() const; TDragRegion* DragRegion() const { return fDragRegion; } - + void AddExpandedItem(const char* signature); + private: friend class TBeMenu; friend class PreferencesWindow; @@ -152,6 +153,9 @@ class TBarView : public BView { void PlaceBeMenu(); void PlaceTray(bool vertSwap, bool leftSwap, BRect screenFrame); void PlaceApplicationBar(BRect screenFrame); + void SaveExpandedItems(); + void RemoveExpandedItems(); + void ExpandItems(); TBarMenuBar* fBarMenuBar; TExpandoMenuBar* fExpando; @@ -178,6 +182,7 @@ class TBarView : public BView { uint32 fMaxRecentApps; TTeamMenuItem* fLastDragItem; + BList fExpandedItems; }; From 08cd4bc208c658ee17b0825529d5e8479d4fd560 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 2 Nov 2011 04:30:44 +0000 Subject: [PATCH 628/702] Add 3 new Apple Aluminum keyboard layout files and update and rename the existing 'Apple Aluminium' keyboard layout to 'Apple Aluminium Extended International.' The 3 new layout files are US mini and extended version as well as an international mini version. This completes #7964 International corresponds to keyboard layouts for all locales except the US and Japan. I have Japanese Apple Aluminum keyboard layout files almost ready but I first need to determine what the special kana and eisu keys are mapped to. The Apple Aluminum keyboard layout files are tucked away in an Apple Aluminum subdirectory. The Keymap preference app has been modified to turn subdirectories into submenus of the Layout menu. HaikuImage has been modified to include each keyboard layout file in the image individually as recommended by Ingo. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43093 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 30 +++- .../Apple Aluminium Extended International} | 7 +- .../Apple Aluminium International | 27 +++ .../Apple Aluminum/Apple Aluminum (US) | 24 +++ .../Apple Aluminum Extended (US) | 23 +++ src/preferences/keymap/KeymapWindow.cpp | 158 +++++++++++++----- src/preferences/keymap/KeymapWindow.h | 7 +- 7 files changed, 224 insertions(+), 52 deletions(-) rename data/system/data/KeyboardLayouts/{Apple Aluminium => Apple Aluminum/Apple Aluminium Extended International} (73%) create mode 100644 data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminium International create mode 100644 data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminum (US) create mode 100644 data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminum Extended (US) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index cb5f426201..d594b2bf15 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -499,10 +499,36 @@ AddSymlinkToHaikuImage system data Keymaps : Swedish : Finnish ; AddSymlinkToHaikuImage system data Keymaps : Slovene : Croatian ; AddSymlinkToHaikuImage system data Keymaps : US-International : Brazilian ; +# Copy keyboard layout files to the image one-by-one. local keyboardLayoutsDir = [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ] ; -local keyboardLayouts = [ Glob $(keyboardLayoutsDir) : [^.]* ] ; -AddFilesToHaikuImage system data KeyboardLayouts : $(keyboardLayouts) ; +local keyboardLayoutFiles = + "Generic 104-key" + "Generic 105-key International" + "IBM Laptop International" + "Kinesis Advantage" + "Kinesis Ergo Elan International" + "TypeMatrix 2030" ; +keyboardLayoutFiles = $(keyboardLayoutFiles:G=keyboard-layout) ; +SEARCH on $(keyboardLayoutFiles) = $(keyboardLayoutsDir) ; +AddFilesToHaikuImage system data KeyboardLayouts + : $(keyboardLayoutFiles) ; + +# Add Apple Aluminum keyboard layout files to the image in an Apple Aluminum +# subdirectory. The subdirectory is turned into a submenu in the Layout menu +# of the Keymap preference app. +local appleAluminumDir + = [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts + Apple\ Aluminum ] ; +local appleAluminumFiles = + "Apple Aluminium Extended International" + "Apple Aluminium International" + "Apple Aluminum (US)" + "Apple Aluminum Extended (US)" ; +appleAluminumFiles = $(appleAluminumFiles:G=keyboard-layout) ; +SEARCH on $(appleAluminumFiles) = $(appleAluminumDir) ; +AddFilesToHaikuImage system data KeyboardLayouts Apple\ Aluminum + : $(appleAluminumFiles) ; local driverSettingsFiles = kernel ; SEARCH on $(driverSettingsFiles) diff --git a/data/system/data/KeyboardLayouts/Apple Aluminium b/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminium Extended International similarity index 73% rename from data/system/data/KeyboardLayouts/Apple Aluminium rename to data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminium Extended International index dba6cde165..68c96bb948 100644 --- a/data/system/data/KeyboardLayouts/Apple Aluminium +++ b/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminium Extended International @@ -1,4 +1,4 @@ -name = Apple aluminium +name = Apple Aluminium Extended International # Size shortcuts default-size = 10,10 @@ -15,9 +15,8 @@ $f = 10,20 $two = 20,10 # Key rows -[ 0,0; 4,5:-; d$fn:0x01; $fn:+12; d$fn:0x00; 5,6:-; 10,6:0x04+2; 5,6:-; - 10,6:+4 ] -[ 0,6; 4,5:-; :0x11+12; d$back:+; $b:-; d:+3; $b:-; d:+1; d:0x6a; d:0x23+1 ] +[ 0,0; 4,5:-; d$fn:0x01; $fn:+12; 15.5,6:-; 10,6:0x70068; 10,6:+2; 5,6:-; 10,6:+4; ] +[ 0,6; 4,5:-; :0x11+12; d$back:+; $b:-; :-; d:0x20; d:+1; $b:-; d:+1; d:0x6a; d:0x23+1 ] [ 0,16; 4,5:-; d$d:0x26; :+12; d$e:0x47; $b:-; d:0x34-0x36; $b:-; :+3; d:0x25 ] [ 0,26; 4,5:led-caps; # integrated into caps key d17,10:0x3b; :+11; :0x33; 50,10:-; :0x48-0x4a; d:0x3a ] diff --git a/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminium International b/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminium International new file mode 100644 index 0000000000..38758b8bf1 --- /dev/null +++ b/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminium International @@ -0,0 +1,27 @@ +name = Apple Aluminium International + +# Size shortcuts +default-size = 10,10 +$back = 17,10 +$fn = 10.5,6 +$lshift = 13,10 +$b = 2,12 +$d = 15,10 +$e = l12,20,8 +$f = 10,20 +$two = 20,10 +$last = 10,12 +$cmd = 14,12 +$arrow = 10,6 + +# Key rows +[ 0,0; 4,5:-; d$fn:0x01; $fn:+12; ] +[ 0,6; 4,5:-; :0x11+12; d$back:+; ] +[ 0,16; 4,5:-; d$d:0x26; :+12; d$e:0x47; ] +[ 0,26; 4,5:led-caps; # integrated into caps key + d17,10:0x3b; :+11; :0x33; ] +[ 0,36; 4,5:-; d$lshift:0x4b; :0x69; :0x4c+9; d24,10:+1; ] +[ 0,46; 4,5:-; d$last:-; # fn key + d$last:0x5c; d$last:0x5d; d$cmd:0x66; 49,12:0x5e; d$cmd:0x67; + d$last:0x5f; $arrow:-; d$arrow:0x57; $arrow:-; ] +[ 121,52; d$arrow:0x61+2; ] diff --git a/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminum (US) b/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminum (US) new file mode 100644 index 0000000000..976c71c12f --- /dev/null +++ b/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminum (US) @@ -0,0 +1,24 @@ +name = Apple Aluminum (US) + +# Size shortcuts +default-size = 10,10 +$back = 17,10 +$fn = 10.5,6 +$b = 2,12 +$f = 10,20 +$two = 20,10 +$last = 10,12 +$cmd = 14,12 +$arrow = 10,6 + +# Key rows +[ 0,0; 4,5:-; d$fn:0x01; $fn:+12; ] +[ 0,6; 4,5:-; :0x11+12; d$back:+; ] +[ 0,16; 4,5:-; d17,10:0x26; :+13; ] +[ 0,26; 4,5:led-caps; # integrated into caps key + d19,10:0x3b; :+11; d18,10:0x47; ] +[ 0,36; 4,5:-; d24,10:0x4b; :+10; d23,10:+1; ] +[ 0,46; 4,5:-; d$last:-; # fn key + d$last:0x5c; d$last:0x5d; d$cmd:0x66; 49,12:0x5e; d$cmd:0x67; + d$last:0x5f; $arrow:-; d$arrow:0x57; $arrow:-; ] +[ 121,52; d$arrow:0x61+2; ] diff --git a/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminum Extended (US) b/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminum Extended (US) new file mode 100644 index 0000000000..c2a753b9ec --- /dev/null +++ b/data/system/data/KeyboardLayouts/Apple Aluminum/Apple Aluminum Extended (US) @@ -0,0 +1,23 @@ +name = Apple Aluminum Extended (US) + +# Size shortcuts +default-size = 10,10 +$back = 17,10 +$fn = 10.5,6 +$shift = 24,10 +$ctrl = 14,10 +$alt = 12,10 +$cmd = 14,10 +$b = 5,10 +$f = 10,20 +$two = 20,10 + +# Key rows +[ 0,0; 4,5:-; d$fn:0x01; $fn:+12; 15.5,6:-; 10,6:0x70068; 10,6:+2; 5,6:-; 10,6:+4; ] +[ 0,6; 4,5:-; :0x11+12; d$back:+; $b:-; :-; d:0x20; d:+1; $b:-; d:+1; d:0x6a; d:0x23+1 ] +[ 0,16; 4,5:-; 0,16; 4,5:-; d17,10:0x26; :+13; $b:-; d:0x34-0x36; $b:-; :+3; d:0x25 ] +[ 0,26; 4,5:led-caps; # integrated into caps key + d19,10:0x3b; :+11; d18,10:0x47; 40,10:-; :0x48-0x4a; d:0x3a ] +[ 0,36; 4,5:-; d24,10:0x4b; :+10; d23,10:+1; 15,10:-; d:+1; 15,10:-; :+3; d$f:+1 ] +[ 0,46; 4,5:-; d$ctrl:0x5c; d$alt:0x5d; d$cmd:0x66; 67,10:0x5e; d$cmd:0x67; + d$alt:0x5f; d$ctrl:0x60; $b:-; d:+3; $b:-; $two:+1; :+1 ] diff --git a/src/preferences/keymap/KeymapWindow.cpp b/src/preferences/keymap/KeymapWindow.cpp index 62924a20d3..daa368c921 100644 --- a/src/preferences/keymap/KeymapWindow.cpp +++ b/src/preferences/keymap/KeymapWindow.cpp @@ -375,7 +375,6 @@ BMenuBar* KeymapWindow::_CreateMenu() { BMenuBar* menuBar = new BMenuBar(Bounds(), "menubar"); - BMenuItem* item; // Create the File menu BMenu* menu = new BMenu(B_TRANSLATE("File")); @@ -391,12 +390,6 @@ KeymapWindow::_CreateMenu() // Create keyboard layout menu fLayoutMenu = new BMenu(B_TRANSLATE("Layout")); - fLayoutMenu->SetRadioMode(true); - fLayoutMenu->AddItem(item = new BMenuItem( - fKeyboardLayoutView->GetKeyboardLayout()->Name(), - new BMessage(kChangeKeyboardLayout))); - item->SetMarked(true); - _AddKeyboardLayouts(fLayoutMenu); menuBar->AddItem(fLayoutMenu); @@ -531,49 +524,60 @@ KeymapWindow::_AddKeyboardLayouts(BMenu* menu) path.Append("KeyboardLayouts"); BDirectory directory; - if (directory.SetTo(path.Path()) == B_OK) { - entry_ref ref; - while (directory.GetNextRef(&ref) == B_OK) { - if (menu->FindItem(ref.name) != NULL) - continue; + if (directory.SetTo(path.Path()) == B_OK) + _AddKeyboardLayoutMenu(menu, directory); + } +} - BMessage* message = new BMessage(kChangeKeyboardLayout); - message->AddRef("ref", &ref); - menu->AddItem(new BMenuItem(ref.name, message)); - } +/*! Adds a menu populated with the keyboard layouts found in the passed + in directory to the passed in menu. Each subdirectory in the passed + in directory is added as a submenu recursively. +*/ +void +KeymapWindow::_AddKeyboardLayoutMenu(BMenu* menu, BDirectory directory) +{ + entry_ref ref; + + while (directory.GetNextRef(&ref) == B_OK) { + if (menu->FindItem(ref.name) != NULL) + continue; + + BDirectory subdirectory; + subdirectory.SetTo(&ref); + if (subdirectory.InitCheck() == B_OK) { + BMenu* submenu = new BMenu(ref.name); + + _AddKeyboardLayoutMenu(submenu, subdirectory); + menu->AddItem(submenu); + } else { + BMessage* message = new BMessage(kChangeKeyboardLayout); + + message->AddRef("ref", &ref); + menu->AddItem(new BMenuItem(ref.name, message)); } } } +/*! Sets the keyboard layout with the passed in path and marks the + corresponding menu item. If the path is not found in the menu this method + sets the default keyboard layout and marks the corresponding menu item. +*/ status_t KeymapWindow::_SetKeyboardLayout(const char* path) { - status_t status = B_OK; + status_t status = fKeyboardLayoutView->GetKeyboardLayout()->Load(path); - if (path != NULL && path[0] != '\0') { - status = fKeyboardLayoutView->GetKeyboardLayout()->Load(path); - if (status == B_OK) { - // select item - for (int32 i = fLayoutMenu->CountItems(); i-- > 0;) { - BMenuItem* item = fLayoutMenu->ItemAt(i); - BMessage* message = item->Message(); - entry_ref ref; - if (message->FindRef("ref", &ref) == B_OK) { - BPath layoutPath(&ref); - if (layoutPath == path) { - item->SetMarked(true); - break; - } - } - } - } - } + // mark a menu item (unmarking all others) + _MarkKeyboardLayoutItem(path, fLayoutMenu); - if (path == NULL || status != B_OK) { + if (path == NULL || path[0] == '\0' || status != B_OK) { fKeyboardLayoutView->GetKeyboardLayout()->SetDefault(); - fLayoutMenu->ItemAt(0)->SetMarked(true); + BMenuItem* item = fLayoutMenu->FindItem( + fKeyboardLayoutView->GetKeyboardLayout()->Name()); + if (item != NULL) + item->SetMarked(true); } // Refresh currently set layout @@ -584,6 +588,42 @@ KeymapWindow::_SetKeyboardLayout(const char* path) } +/*! Marks a keyboard layout item by iterating through the menus recursively + searching for the menu item with the passed in path. This method always + iterates through all menu items and unmarks them. If no item with the + passed in path is found it is up to the caller to set the default keyboard + layout and mark item corresponding to the default keyboard layout path. +*/ +void +KeymapWindow::_MarkKeyboardLayoutItem(const char* path, BMenu* menu) +{ + BMenuItem* item = NULL; + entry_ref ref; + + for (int32 i = 0; i < menu->CountItems(); i++) { + item = menu->ItemAt(i); + if (item == NULL) + continue; + + // Unmark each item initially + item->SetMarked(false); + + BMenu* submenu = item->Submenu(); + if (submenu != NULL) + _MarkKeyboardLayoutItem(path, submenu); + else { + if (item->Message()->FindRef("ref", &ref) == B_OK) { + BPath layoutPath(&ref); + if (path != NULL && path[0] != '\0' && layoutPath == path) { + // Found it, mark the item + item->SetMarked(true); + } + } + } + } +} + + /*! Sets the label of the "Switch Shorcuts" button to make it more descriptive what will happen when you press that button. */ @@ -922,7 +962,7 @@ KeymapWindow::_LoadSettings(BRect& windowFrame, BString& keyboardLayout) status_t -KeymapWindow::_SaveSettings() const +KeymapWindow::_SaveSettings() { BFile file; status_t status @@ -933,13 +973,41 @@ KeymapWindow::_SaveSettings() const BMessage settings('keym'); settings.AddRect("window frame", Frame()); - BMenuItem* item = fLayoutMenu->FindMarked(); - entry_ref ref; - if (item != NULL && item->Message()->FindRef("ref", &ref) == B_OK) { - BPath path(&ref); - if (path.InitCheck() == B_OK) - settings.AddString("keyboard layout", path.Path()); - } + BPath path = _GetMarkedKeyboardLayoutPath(fLayoutMenu); + if (path.InitCheck() == B_OK) + settings.AddString("keyboard layout", path.Path()); return settings.Flatten(&file); } + + +/*! Gets the path of the currently marked keyboard layout item + by searching through each of the menus recursively until + a marked item is found. +*/ +BPath +KeymapWindow::_GetMarkedKeyboardLayoutPath(BMenu* menu) +{ + BPath path; + BMenuItem* item = NULL; + entry_ref ref; + + for (int32 i = 0; i < menu->CountItems(); i++) { + item = menu->ItemAt(i); + if (item == NULL) + continue; + + BMenu* submenu = item->Submenu(); + if (submenu != NULL) + return _GetMarkedKeyboardLayoutPath(submenu); + else { + if (item->IsMarked() + && item->Message()->FindRef("ref", &ref) == B_OK) { + path.SetTo(&ref); + return path; + } + } + } + + return path; +} diff --git a/src/preferences/keymap/KeymapWindow.h b/src/preferences/keymap/KeymapWindow.h index cc6cb4b75e..acb0305455 100644 --- a/src/preferences/keymap/KeymapWindow.h +++ b/src/preferences/keymap/KeymapWindow.h @@ -40,7 +40,11 @@ protected: BMenuBar* _CreateMenu(); BView* _CreateMapLists(); void _AddKeyboardLayouts(BMenu* menu); + void _AddKeyboardLayoutMenu(BMenu* menu, + BDirectory directory); status_t _SetKeyboardLayout(const char* path); + void _MarkKeyboardLayoutItem(const char* path, + BMenu* menu); void _UpdateSwitchShortcutButton(); void _UpdateButtons(); @@ -64,7 +68,8 @@ protected: status_t _GetSettings(BFile& file, int mode) const; status_t _LoadSettings(BRect& frame, BString& keyboardLayout); - status_t _SaveSettings() const; + status_t _SaveSettings(); + BPath _GetMarkedKeyboardLayoutPath(BMenu* menu); private: BListView* fSystemListView; From 8d15934d9b73e659d3a377d83b90e509126dea11 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 2 Nov 2011 04:51:30 +0000 Subject: [PATCH 629/702] Add US and international keyboard layout files for ThinkPad, ThinkPad T400s, ThinkPad X1 and ThinkPad X100e keyboards. The name of these layout files correspond to the model that introduced them and should cover every US and international laptop made by IBM and Lenovo except Japanese (and perhaps some other Asian locale) versions. Like the Apple Aluminum keyboard layouts these are neatly tucked away in a ThinkPad submenu in the Keymap preference app. Removed the 'IBM Laptop International' keyboard layout file which has been superseded by 'ThinkPad International'. Closes #8021 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43094 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 20 ++++++++++++- .../KeyboardLayouts/ThinkPad/ThinkPad (US) | 27 +++++++++++++++++ .../ThinkPad International} | 6 ++-- .../ThinkPad/ThinkPad T400s (US) | 28 ++++++++++++++++++ .../ThinkPad/ThinkPad T400s International | 27 +++++++++++++++++ .../KeyboardLayouts/ThinkPad/ThinkPad X1 (US) | 28 ++++++++++++++++++ .../ThinkPad/ThinkPad X1 International | 28 ++++++++++++++++++ .../ThinkPad/ThinkPad X100e (US) | 26 +++++++++++++++++ .../ThinkPad/ThinkPad X100e International | 29 +++++++++++++++++++ 9 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 data/system/data/KeyboardLayouts/ThinkPad/ThinkPad (US) rename data/system/data/KeyboardLayouts/{IBM Laptop International => ThinkPad/ThinkPad International} (80%) create mode 100644 data/system/data/KeyboardLayouts/ThinkPad/ThinkPad T400s (US) create mode 100644 data/system/data/KeyboardLayouts/ThinkPad/ThinkPad T400s International create mode 100644 data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X1 (US) create mode 100644 data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X1 International create mode 100644 data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X100e (US) create mode 100644 data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X100e International diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index d594b2bf15..352d4ae721 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -505,7 +505,6 @@ local keyboardLayoutsDir local keyboardLayoutFiles = "Generic 104-key" "Generic 105-key International" - "IBM Laptop International" "Kinesis Advantage" "Kinesis Ergo Elan International" "TypeMatrix 2030" ; @@ -530,6 +529,25 @@ SEARCH on $(appleAluminumFiles) = $(appleAluminumDir) ; AddFilesToHaikuImage system data KeyboardLayouts Apple\ Aluminum : $(appleAluminumFiles) ; +# Add ThinkPad keyboard layout files to the image in a ThinkPad +# subdirectory. The subdirectory is turned into a submenu in the Layout menu +# of the Keymap preference app. +local thinkpadDir + = [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ThinkPad ] ; +local thinkPadFiles = + "ThinkPad (US)" + "ThinkPad International" + "ThinkPad T400s (US)" + "ThinkPad T400s International" + "ThinkPad X1 (US)" + "ThinkPad X1 International" + "ThinkPad X100e (US)" + "ThinkPad X100e International" ; +thinkPadFiles = $(thinkPadFiles:G=keyboard-layout) ; +SEARCH on $(thinkPadFiles) = $(thinkpadDir) ; +AddFilesToHaikuImage system data KeyboardLayouts ThinkPad + : $(thinkPadFiles) ; + local driverSettingsFiles = kernel ; SEARCH on $(driverSettingsFiles) = [ FDirName $(HAIKU_TOP) data settings kernel drivers ] ; diff --git a/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad (US) b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad (US) new file mode 100644 index 0000000000..5dc834fc13 --- /dev/null +++ b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad (US) @@ -0,0 +1,27 @@ +name = ThinkPad (US) + +# Size shortcuts +default-size = 18,18 +$s = 17,10 +$gap = 6,10 +$sgap = 5,10 +$backspace = 38,18 +$tab = 28,18 +$caps = 32,18 +$enter = d42,18 +$lshift = 41,18 +$rshift = 51,18 +$lctrl = 23,18 +$option = 13,18 +$space = 95,18 + +# Key rows +[ 0,0; $s:0x01; 148,10:-; $s:0x0e+2; $sgap:-; $s:0x1f+2; ] +[ 0,10; $s:0x02+3; $gap:-; $s:+4; $gap:-; $s:+4; $sgap:-; $s:0x34+2; ] +[ 0,20; :0x11+12; $backspace:+1; ] +[ 0,38; $tab:0x26; :+12; 28,18:+1; ] +[ 0,56; $caps:0x3b; :+11; $enter:0x47; ] +[ 0,74; $lshift:0x4b; :0x4c+9; $rshift:+1 ] +[ 0,92; :-; $lctrl:0x5c; $option:0x66; :0x5d; $space:+1; + :+1; :0x68; :0x60; $s:0x9a; $s:0x57; $s:0x9b ] +[ 221,102; $s:0x61+2; ] diff --git a/data/system/data/KeyboardLayouts/IBM Laptop International b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad International similarity index 80% rename from data/system/data/KeyboardLayouts/IBM Laptop International rename to data/system/data/KeyboardLayouts/ThinkPad/ThinkPad International index b595f9c934..f98e71dea0 100644 --- a/data/system/data/KeyboardLayouts/IBM Laptop International +++ b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad International @@ -1,4 +1,4 @@ -name = IBM Laptop International +name = ThinkPad International # Size shortcuts default-size = 18,18 @@ -17,10 +17,10 @@ $space = 95,18 # Key rows [ 0,0; $s:0x01; 148,10:-; $s:0x0e+2; $sgap:-; $s:0x1f+2; ] [ 0,10; $s:0x02+3; $gap:-; $s:+4; $gap:-; $s:+4; $sgap:-; $s:0x34+2; ] -[ 0,20; :0x11+12; $backspace:+1 ] +[ 0,20; :0x11+12; $backspace:+1; ] [ 0,38; $tab:0x26; :+12; $enter:0x47; ] [ 0,56; $caps:0x3b; :+11; :0x33 ] [ 0,74; $l-shift-ctrl:0x4b; :0x69; :0x4c+9; $r-shift:+1 ] -[ 0,92; :0x99; $l-shift-ctrl:0x5c; $option:0x66; :0x5d; $space:+1; +[ 0,92; :-; $l-shift-ctrl:0x5c; $option:0x66; :0x5d; $space:+1; :+1; :0x68; :0x60; $s:0x9a; $s:0x57; $s:0x9b ] [ 221,102; $s:0x61+2; ] diff --git a/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad T400s (US) b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad T400s (US) new file mode 100644 index 0000000000..aad37c6d72 --- /dev/null +++ b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad T400s (US) @@ -0,0 +1,28 @@ +name = ThinkPad T400s (US) + +# Size shortcuts +default-size = 18,18 +$s = 16,10 +$sdouble = 16,20 +$gap = 4,10 +$backspace = 38,18 +$tab = 28,18 +$caps = 32,18 +$enter = d42,18 +$lshift = 41,18 +$rshift = 51,18 +$lctrl = 23,18 +$option = 13,18 +$space = 95,18 +$arrow = 17,10 + +# Key rows +[ 0,0; $sdouble:0x01; 140,10:-; $s:0x0e+2; $s:0x1f; $gap:-; $sdouble:0x34; $s:0x20+1; ] +[ 0,10; 20,10:-; $s:0x02+3; $gap:-; $s:+4; $gap:-; $s:+4; 20,10:-; $s:0x35+1; ] +[ 0,20; :0x11+12; $backspace:+1; ] +[ 0,38; $tab:0x26; :+12; 28,18:+1; ] +[ 0,56; $caps:0x3b; :+11; $enter:0x47; ] +[ 0,74; $lshift:0x4b; :0x4c+9; $rshift:+1 ] +[ 0,92; :-; $lctrl:0x5c; $option:0x66; :0x5d; $space:+1; + :+1; :0x68; :0x60; $arrow:0x9a; $arrow:0x57; $arrow:0x9b ] +[ 221,102; $arrow:0x61+2; ] diff --git a/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad T400s International b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad T400s International new file mode 100644 index 0000000000..ca0d5b6998 --- /dev/null +++ b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad T400s International @@ -0,0 +1,27 @@ +name = ThinkPad T400s International + +# Size shortcuts +default-size = 18,18 +$s = 16,10 +$sdouble = 16,20 +$gap = 4,10 +$backspace = 38,18 +$tab = 28,18 +$caps = 32,18 +$enter = dl28,36,22 +$l-shift-ctrl = 23,18 +$r-shift = 51,18 +$option = 13,18 +$space = 95,18 +$arrow = 17,10 + +# Key rows +[ 0,0; $sdouble:0x01; 140,10:-; $s:0x0e+2; $s:0x1f; $gap:-; $sdouble:0x34; $s:0x20+1; ] +[ 0,10; 20,10:-; $s:0x02+3; $gap:-; $s:+4; $gap:-; $s:+4; 20,10:-; $s:0x35+1; ] +[ 0,20; :0x11+12; $backspace:+1; ] +[ 0,38; $tab:0x26; :+12; $enter:0x47; ] +[ 0,56; $caps:0x3b; :+11; :0x33 ] +[ 0,74; $l-shift-ctrl:0x4b; :0x69; :0x4c+9; $r-shift:+1 ] +[ 0,92; :-; $l-shift-ctrl:0x5c; $option:0x66; :0x5d; $space:+1; + :+1; :0x68; :0x60; $arrow:0x9a; $arrow:0x57; $arrow:0x9b ] +[ 221,102; $arrow:0x61+2; ] diff --git a/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X1 (US) b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X1 (US) new file mode 100644 index 0000000000..88c2e4e902 --- /dev/null +++ b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X1 (US) @@ -0,0 +1,28 @@ +name = ThinkPad X1 (US) + +# Size shortcuts +default-size = 18,18 +$s = 15,10 +$s2 = 23.5,10 +$backspace = 38,18 +$tab = 28,18 +$caps = 32,18 +$enter = d42,18 +$lshift = 42,18 +$rshift = 50,18 +$lctrl = 24,20 +$bottom = 18,20 +$space = 90,20 +$sarrow = 16,10 +$arrow = 18,10 + +# Key rows +[ 0,0; $s2:0x01; $s:+12; $s:0x20; $s:0x35; $s:0x1f; $s2:0x34; ] +[ 0,10; :0x11+12; $backspace:+1; ] +[ 0,28; $tab:0x26; :+12; 28,18:+1; ] +[ 0,46; $caps:0x3b; :+11; $enter:0x47; ] +[ 0,64; $lshift:0x4b; :0x4c+9; $rshift:+1 ] +[ 0,82; $bottom:-; $lctrl:0x5c; $bottom:0x66; $bottom:0x5d; $space:+1; + $bottom:+1; $bottom:0x0e; $bottom:0x60; $sarrow:0x21; $arrow:0x57; + $sarrow:0x36; ] +[ 222,92; $sarrow:0x61; $arrow:0x62; $sarrow:0x63; ] diff --git a/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X1 International b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X1 International new file mode 100644 index 0000000000..f00efe05ec --- /dev/null +++ b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X1 International @@ -0,0 +1,28 @@ +name = ThinkPad X1 International + +# Size shortcuts +default-size = 18,18 +$s = 15,10 +$s2 = 23.5,10 +$backspace = 38,18 +$tab = 28,18 +$caps = 32,18 +$enter = dl28,36,22 +$lshift = 24,18 +$rshift = 50,18 +$lctrl = 24,20 +$bottom = 18,20 +$space = 90,20 +$sarrow = 16,10 +$arrow = 18,10 + +# Key rows +[ 0,0; $s2:0x01; $s:+12; $s:0x20; $s:0x35; $s:0x1f; $s2:0x34; ] +[ 0,10; :0x11+12; $backspace:+1; ] +[ 0,28; $tab:0x26; :+12; $enter:0x47; ] +[ 0,46; $caps:0x3b; :+11; :0x33 ] +[ 0,64; $lshift:0x4b; :0x69; :0x4c+9; $rshift:+1 ] +[ 0,82; $bottom:-; $lctrl:0x5c; $bottom:0x66; $bottom:0x5d; $space:+1; + $bottom:+1; $bottom:0x0e; $bottom:0x60; $sarrow:0x21; $arrow:0x57; + $sarrow:0x36; ] +[ 222,92; $sarrow:0x61; $arrow:0x62; $sarrow:0x63; ] diff --git a/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X100e (US) b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X100e (US) new file mode 100644 index 0000000000..ebf9a24273 --- /dev/null +++ b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X100e (US) @@ -0,0 +1,26 @@ +name = ThinkPad X100e (US) + +# Size shortcuts +default-size = 19,18 +$s = 15.5,10 +$gap = 2.125,10 +$backspace = 25,18 +$tab = 25,18 +$caps = 32,18 +$enter = d31,18 +$shift = 41,18 +$bottom = 19,20 +$space = 105,20 +$sarrow = 17,10 +$arrow = 19,10 + +# Key rows +[ 0,0; $s:0x01; $gap:-; $s:+4; $gap:-; $s:+4; $gap:-; $s:+4; $gap:-; $s:0x1f; + $s:0x34; $s:0x20; $s:0x35; ] +[ 0,10; :0x11+12; $backspace:+1; ] +[ 0,28; $tab:0x26; :+13; ] +[ 0,46; $caps:0x3b; :+11; $enter:0x47; ] +[ 0,64; $shift:0x4b; :0x4c+9; $shift:+1 ] +[ 0,82; $bottom:-; $bottom:0x5c; $bottom:0x66; $bottom:0x5d; $space:+1; + $bottom:+1; $bottom:0x60; 17,9:0x21; $arrow:0x57; 17,9:0x36; ] +[ 219,92; $sarrow:0x61; $arrow:0x62; $sarrow:0x63; ] diff --git a/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X100e International b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X100e International new file mode 100644 index 0000000000..8161f73977 --- /dev/null +++ b/data/system/data/KeyboardLayouts/ThinkPad/ThinkPad X100e International @@ -0,0 +1,29 @@ +name = ThinkPad X100e International + +# Size shortcuts +default-size = 19,18 +$s = 15.5,10 +$gap = 2.125,10 +$backspace = 25,18 +$tab = 27,18 +$caps = 33,18 +$small = 16,18 +$enter = dl23,36,15 +$lshift = 22,18 +$rshift = 41,18 +$bottom = 19,20 +$space = 105,20 +$sarrow = 17,10 +$arrow = 19,10 + +# Key rows +[ 0,0; $s:0x01; $gap:-; $s:+4; $gap:-; $s:+4; $gap:-; $s:+4; $gap:-; $s:0x1f; + $s:0x34; $s:0x20; $s:0x35; ] +[ 0,10; :0x11+12; $backspace:+1; ] +[ 0,28; $tab:0x26; :+10; $small:+1; $small:+1; $enter:0x47; ] +[ 0,46; $caps:0x3b; :+10; $small:+1; $small:0x33; ] +[ 0,64; $lshift:0x4b; :0x69; :0x4c+9; $rshift:+1; ] +[ 0,82; $bottom:-; $bottom:0x5c; $bottom:0x66; $bottom:0x5d; $space:+1; + $bottom:+1; $bottom:0x60; 17,9:0x21; $arrow:0x57; + 17,9:0x36; ] +[ 219,92; $sarrow:0x61; $arrow:0x62; $sarrow:0x63; ] From 740ae7fef6788697bb687b6789cfb331361d84d9 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 2 Nov 2011 06:02:36 +0000 Subject: [PATCH 630/702] Return B_ERROR if a locking error occurs in while locking the BLocale object, return B_BAD_VALUE if an ICU error occurs or the passed in value is NULL. Update BLocale API documentation to reflect this and also add some more documentation fixes. Closes #7901 pending confirmation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43095 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/locale/Locale.dox | 119 +++++++++++++++++++++++------------- src/kits/locale/Locale.cpp | 48 +++++++-------- 2 files changed, 100 insertions(+), 67 deletions(-) diff --git a/docs/user/locale/Locale.dox b/docs/user/locale/Locale.dox index 93ace80d9a..12d3ca7a2a 100644 --- a/docs/user/locale/Locale.dox +++ b/docs/user/locale/Locale.dox @@ -8,8 +8,8 @@ * Oliver Tappe, zooey@hirschkaefer.de. * * Corresponds to: - * /trunk/headers/os/locale/Locale.h rev 42274 - * /trunk/src/kits/locale/Locale.cpp rev 42274 + * /trunk/headers/os/locale/Locale.h rev 43095 + * /trunk/src/kits/locale/Locale.cpp rev 43095 */ @@ -129,6 +129,8 @@ const BFormattingConventions& conventions) \brief Sets the formatting convention for this locale. + If unable to lock the BLocale \a conventions is left untouched. + \param conventions The formatting convention to set. */ @@ -137,6 +139,8 @@ \fn void BLocale::SetCollator(const BCollator& newCollator) \brief Set the collator for this locale. + If unable to lock the BLocale \a newCollator is left untouched. + \param newCollator The collator to set. */ @@ -145,6 +149,8 @@ \fn void BLocale::SetLanguage(const BLanguage& newLanguage) \brief Set the language for this locale. + If unable to lock the BLocale \a newLanguage is left untouched. + \param newLanguage The code of the language to set to locale to. */ @@ -207,15 +213,16 @@ \param string The string buffer to fill with the formatted date. \param fieldPositions ??? - \param fieldCount ??? + \param fieldCount The number of fields. \param time The time (in seconds since epoch) to format \param style Specify the long format (with day name, full month name) or the short format, 08/12/2010 or similar. \returns A status code. \retval B_OK Everything went fine. - \retval B_ERROR Unable to lock the BLocale or an error formatting the date. + \retval B_ERROR Unable to lock the BLocale. \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + \retval B_BAD_VALUE An error occurred while performing the date formatting. \sa BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount, time_t time, BTimeFormatStyle style) const @@ -227,7 +234,7 @@ BDateFormatStyle style) const \brief Get the type of each field in the date format of the locale. - This function is most often used in combination with FormatDate(). + This method is most often used in combination with FormatDate(). FormatDate() gives you the offset of each field in a formatted string, and GetDateFields() gives you the type of the field at a given offset. With these informations, you can handle the formatted date string as @@ -240,9 +247,9 @@ \returns A status code. \retval B_OK Everything went fine. - \retval B_ERROR Unable to lock the BLocale or an error getting the date - fields. + \retval B_ERROR Unable to lock the BLocale. \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + \retval B_BAD_VALUE An error occurred while getting the date fields. \sa BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount, BTimeFormatStyle style) const @@ -250,14 +257,22 @@ /*! - \fn int BLocale::StartOfWeek() const - \brief Returns the number of the day used as start of week in this locale. + \fn status_t BLocale::GetStartOfWeek(BWeekday* startOfWeek) const + \brief Returns the day used as the start of week in this locale. - \returns a flag that indicates the day of the week that the week starts or - B_ERROR if there was an error. - \retval B_ERROR Unable to lock the BLocale. - \retval B_WEEK_START_SUNDAY If the beginning of the week starts on Sunday. - \retval B_WEEK_START_MONDAY If the beginning of the week starts on Monday. + Possible values for \a startOfWeek include: + - \c B_WEEKDAY_SUNDAY + - \c B_WEEKDAY_MONDAY + - \c B_WEEKDAY_TUESDAY + - \c B_WEEKDAY_WEDNESDAY + - \c B_WEEKDAY_THURSDAY + - \c B_WEEKDAY_THURSDAY + - \c B_WEEKDAY_SATURDAY + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \a startOfWeek is \c NULL. + \retval B_ERROR Unable to lock the BLocale or another error occurred. */ @@ -373,8 +388,9 @@ \returns A status code. \retval B_OK Everything went fine. - \retval B_ERROR Unable to lock the BLocale or an error formatting the time. + \retval B_ERROR Unable to lock the BLocale. \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + \retval B_BAD_VALUE An error occurred during time formatting. \sa BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount, time_t time, BDateFormatStyle style) const @@ -386,10 +402,10 @@ BTimeFormatStyle style) const \brief Get the type of each field in the time format of the locale. - This function is most often used in combination with FormatTime(). + This method is used most often in combination with FormatTime(). FormatTime() gives you the offset of each field in a formatted string, and GetTimeFields() gives you the type of the field at a given offset. - With these informations, you can handle the formatted date string as + With this information you can handle the formatted date string as a list of fields that you can split and alter at will. \param fields Pointer to the fields object. @@ -398,9 +414,9 @@ \returns A status code. \retval B_OK Everything went fine. - \retval B_ERROR Unable to lock the BLocale or an error getting the time - fields. + \retval B_ERROR Unable to lock the BLocale. \retval B_NO_MEMORY Ran out of memory while creating the DateFormat object. + \retval B_BAD_VALUE An error occurred while getting the time fields. \sa BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, BDateFormatStyle style) const @@ -417,8 +433,11 @@ \param maxSize The maximum of bytes to copy into \a string. \param value The number that you want to get a formatted version of. - \returns The length of the string created or an error status code in - the case of an error. + \returns The length of the string created or an error status code. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the NumberFormat + object. + \retval B_BAD_VALUE An error occurred while formatting the number. \sa BLocale::FormatNumber(char* string, size_t maxSize, int32 value) const @@ -429,14 +448,18 @@ /*! \fn status_t BLocale::FormatNumber(BString* string, double value) const - \brief \brief Format the \c double \a value as a string and put the result - into \a string in the current locale. + \brief \brief Format the \c double \a value as a string and put the + result into \a string in the current locale. \param string The string to put the formatted number into. \param value The number that you want to get a formatted version of. - \returns The length of the string created or an error status code in - the case of an error. + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the NumberFormat + object. + \retval B_BAD_VALUE An error occurred while formatting the number. \sa BLocale::FormatNumber(BString* string, int32 value) const \sa BLocale::FormatMonetary(BString* string, double value) const @@ -453,8 +476,11 @@ \param maxSize The maximum of bytes to copy into \a string. \param value The number that you want to get a formatted version of. - \returns The length of the string created or an error status code in - the case of an error. + \returns The length of the string created or an error status code. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the NumberFormat + object. + \retval B_BAD_VALUE An error occurred while formatting the number. \sa BLocale::FormatNumber(char* string, size_t maxSize, double value) const @@ -471,8 +497,12 @@ \param string The string to put the formatted number into. \param value The number that you want to get a formatted version of. - \returns The length of the string created or an error status code in - the case of an error. + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the NumberFormat + object. + \retval B_BAD_VALUE An error occurred while formatting the number. \sa BLocale::FormatNumber(BString* string, double value) const \sa BLocale::FormatMonetary(BString* string, double value) const @@ -485,18 +515,18 @@ \brief Format the \c double \a value as a monetary string and put the result into \a string up to \a maxSize bytes in the current locale. - \param string The string to put the monetary formatted number into. + \param string The \a string to put the monetary formatted number into. \param maxSize The maximum of bytes to copy into \a string. - \param value The number that you want to get a monetary formatted version - of. + \param value The number to format as a monetary \a value. - \returns The length of the string created or an error status code in - the case of an error. + \returns The length of the string created or an error status code. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the NumberFormat + object. + \retval B_BAD_VALUE An error occurred while formatting the number. - \sa BLocale::FormatNumber(char* string, size_t maxSize, - double value) const - \sa BLocale::FormatNumber(char* string, size_t maxSize, - int32 value) const + \sa BLocale::FormatNumber(char* string, size_t maxSize, double value) const + \sa BLocale::FormatNumber(char* string, size_t maxSize, int32 value) const */ @@ -505,12 +535,15 @@ \brief \brief Format the \c double \a value as a monetary string and put the result into \a string in the current locale. - \param string The string to put the monetary formatted number into. - \param value The number that you want to get a monetary formatted version - of. + \param string The \a string to put the monetary formatted number into. + \param value The number to format as a monetary \a value. - \returns The length of the string created or an error status code in - the case of an error. + \returns A status code. + \retval B_OK Everything went fine. + \retval B_ERROR Unable to lock the BLocale. + \retval B_NO_MEMORY Ran out of memory while creating the NumberFormat + object. + \retval B_BAD_VALUE An error occurred while formatting the number. \sa BLocale::FormatNumber(BString* string, double value) const \sa BLocale::FormatNumber(BString* string, int32 value) const diff --git a/src/kits/locale/Locale.cpp b/src/kits/locale/Locale.cpp index 9be23e1796..4a23de6eb3 100644 --- a/src/kits/locale/Locale.cpp +++ b/src/kits/locale/Locale.cpp @@ -109,7 +109,7 @@ BLocale::GetLanguage(BLanguage* language) const BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; *language = fLanguage; @@ -125,7 +125,7 @@ BLocale::GetFormattingConventions(BFormattingConventions* conventions) const BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; *conventions = fConventions; @@ -194,7 +194,7 @@ BLocale::FormatDate(char* string, size_t maxSize, time_t time, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetDateFormat(style, format); @@ -221,7 +221,7 @@ BLocale::FormatDate(BString *string, time_t time, BDateFormatStyle style, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetDateFormat(style, format); @@ -254,7 +254,7 @@ BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetDateFormat(style, format); @@ -270,7 +270,7 @@ BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount, error); if (error != U_ZERO_ERROR) - return B_ERROR; + return B_BAD_VALUE; icu::FieldPosition field; std::vector fieldPosStorage; @@ -301,7 +301,7 @@ BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetDateFormat(style, format); @@ -318,7 +318,7 @@ BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, &positionIterator, error); if (U_FAILURE(error)) - return B_ERROR; + return B_BAD_VALUE; icu::FieldPosition field; std::vector fieldPosStorage; @@ -359,7 +359,7 @@ BLocale::GetStartOfWeek(BWeekday* startOfWeek) const BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; UErrorCode err = U_ZERO_ERROR; ObjectDeleter calendar = Calendar::createInstance( @@ -395,7 +395,7 @@ BLocale::GetStartOfWeek(BWeekday* startOfWeek) const *startOfWeek = B_WEEKDAY_SATURDAY; break; default: - return B_BAD_DATA; + return B_ERROR; } return B_OK; @@ -408,7 +408,7 @@ BLocale::FormatDateTime(char* target, size_t maxSize, time_t time, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetDateFormat(dateStyle, format); @@ -445,7 +445,7 @@ BLocale::FormatDateTime(BString* target, time_t time, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetDateFormat(dateStyle, format); @@ -488,7 +488,7 @@ BLocale::FormatTime(char* string, size_t maxSize, time_t time, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetTimeFormat(style, format); @@ -515,7 +515,7 @@ BLocale::FormatTime(BString* string, time_t time, BTimeFormatStyle style, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetTimeFormat(style, format); @@ -548,7 +548,7 @@ BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetTimeFormat(style, format); @@ -564,7 +564,7 @@ BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount, error); if (error != U_ZERO_ERROR) - return B_ERROR; + return B_BAD_VALUE; icu::FieldPosition field; std::vector fieldPosStorage; @@ -594,7 +594,7 @@ BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount, { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; BString format; fConventions.GetTimeFormat(style, format); @@ -611,7 +611,7 @@ BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount, &positionIterator, error); if (error != U_ZERO_ERROR) - return B_ERROR; + return B_BAD_VALUE; icu::FieldPosition field; std::vector fieldPosStorage; @@ -670,7 +670,7 @@ BLocale::FormatNumber(BString* string, double value) const { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; UErrorCode err = U_ZERO_ERROR; ObjectDeleter numberFormatter(NumberFormat::createInstance( @@ -680,7 +680,7 @@ BLocale::FormatNumber(BString* string, double value) const if (numberFormatter.Get() == NULL) return B_NO_MEMORY; if (U_FAILURE(err)) - return B_ERROR; + return B_BAD_VALUE; UnicodeString icuString; numberFormatter->format(value, icuString); @@ -710,7 +710,7 @@ BLocale::FormatNumber(BString* string, int32 value) const { BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; UErrorCode err = U_ZERO_ERROR; ObjectDeleter numberFormatter(NumberFormat::createInstance( @@ -720,7 +720,7 @@ BLocale::FormatNumber(BString* string, int32 value) const if (numberFormatter.Get() == NULL) return B_NO_MEMORY; if (U_FAILURE(err)) - return B_ERROR; + return B_BAD_VALUE; UnicodeString icuString; numberFormatter->format((int32_t)value, icuString); @@ -753,7 +753,7 @@ BLocale::FormatMonetary(BString* string, double value) const BAutolock lock(fLock); if (!lock.IsLocked()) - return B_WOULD_BLOCK; + return B_ERROR; UErrorCode err = U_ZERO_ERROR; ObjectDeleter numberFormatter( @@ -764,7 +764,7 @@ BLocale::FormatMonetary(BString* string, double value) const if (numberFormatter.Get() == NULL) return B_NO_MEMORY; if (U_FAILURE(err)) - return B_ERROR; + return B_BAD_VALUE; UnicodeString icuString; numberFormatter->format(value, icuString); From 6ac7032dc66744139522bdef3fab49d4e894a84a Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 2 Nov 2011 08:36:02 +0000 Subject: [PATCH 631/702] Update the style of the Haiku Book to resemble the User Guide. If you have never seen this before you are in for a bit of a shock. Update the Doxyfile to 1.7.3 (the version that gets auto-generated). Update the book.dox front page with some nice introductory text. Add new documentation for the following classes: BCheckBox BClipboard BColorControl BControl BEntryList BView (preliminary) Remove redundant documentation from src/kits/storage/EntryList.cpp Minor documentation update for the following classes: BAlert BApplication BArchivable BBox BButton BCatalog BFindDirectory BHandler BUnarchiver BString git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43096 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- docs/user/Doxyfile | 1545 +++++++++++------ docs/user/app/Application.dox | 5 +- docs/user/app/Clipboard.dox | 343 ++++ docs/user/app/Handler.dox | 32 +- docs/user/book.css | 996 +++++++---- docs/user/book.dox | 573 +++++- docs/user/header.html | 7 +- docs/user/interface/Alert.dox | 9 +- docs/user/interface/BCheckBox_example.png | Bin 0 -> 6166 bytes docs/user/interface/BColorControl_example.png | Bin 0 -> 6124 bytes .../BColorControl_example_256_colors.png | Bin 0 -> 6545 bytes docs/user/interface/Box.dox | 263 +-- docs/user/interface/Button.dox | 155 +- docs/user/interface/CheckBox.dox | 239 +++ docs/user/interface/ColorControl.dox | 316 ++++ docs/user/interface/Control.dox | 422 +++++ docs/user/interface/View.dox | 297 ++++ docs/user/locale/Catalog.dox | 36 +- docs/user/storage/EntryList.dox | 132 ++ docs/user/storage/FindDirectory.dox | 8 +- docs/user/support/Archivable.dox | 58 +- docs/user/support/Unarchiver.dox | 69 +- docs/user/support/string.dox | 8 +- src/kits/storage/EntryList.cpp | 84 +- 24 files changed, 4228 insertions(+), 1369 deletions(-) create mode 100644 docs/user/app/Clipboard.dox create mode 100644 docs/user/interface/BCheckBox_example.png create mode 100644 docs/user/interface/BColorControl_example.png create mode 100644 docs/user/interface/BColorControl_example_256_colors.png create mode 100644 docs/user/interface/CheckBox.dox create mode 100644 docs/user/interface/ColorControl.dox create mode 100644 docs/user/interface/Control.dox create mode 100644 docs/user/interface/View.dox create mode 100644 docs/user/storage/EntryList.dox diff --git a/docs/user/Doxyfile b/docs/user/Doxyfile index 7eb5b6d040..69f5c7c050 100644 --- a/docs/user/Doxyfile +++ b/docs/user/Doxyfile @@ -1,204 +1,240 @@ -# Doxyfile 1.5.2 +# Doxyfile 1.7.3 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project +# doxygen (www.doxygen.org) for a project. # -# All text after a hash (#) is considered a comment and will be ignored +# All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") +# Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -# This tag specifies the encoding used for all characters in the config file that -# follow. The default is UTF-8 which is also the encoding used for all text before -# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into -# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of -# possible encodings. +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "The Haiku Book" -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = pre-R1 -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location +# Using the PROJECT_BRIEF tag one can provide an optional one line description for a project that appears at the top of each page and should give viewer a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = ../../generated/doxygen -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, -# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, -# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, -# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" -ABBREVIATE_BRIEF = +ABBREVIATE_BRIEF = -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = YES -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the # path to strip. -STRIP_FROM_PATH = +STRIP_FROM_PATH = -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO -# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -# For keyboard shortcuts and anything related to pressing keys ALIASES = "key{1}=\1" -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO @@ -208,431 +244,531 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file +# If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. -HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_MEMBERS = YES -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. -HIDE_UNDOC_CLASSES = NO +HIDE_UNDOC_CLASSES = YES -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = YES -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = NO -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = YES -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the +# Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even if there is only one candidate or it is obvious which candidate to choose by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = NO -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = NO -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = NO -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= NO -# The ENABLED_SECTIONS tag can be used to enable conditional +# The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. -ENABLED_SECTIONS = +ENABLED_SECTIONS = -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = NO -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. -FILE_VERSION_FILTER = +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- -# The QUIET tag can be used to turn on/off the messages that are generated +# The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written # to stderr. -WARN_LOGFILE = +WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = . \ - app \ + app \ drivers \ - interface \ - locale \ + interface \ + locale \ + media \ midi \ midi2 \ storage \ support \ - ../../headers/os/app \ + ../../headers/os/app \ ../../headers/os/drivers/fs_interface.h \ ../../headers/os/drivers/USB3.h \ ../../headers/os/drivers/USB_spec.h \ - ../../headers/os/interface/AbstractLayout.h \ - ../../headers/os/interface/Alert.h \ - ../../headers/os/interface/Button.h \ - ../../headers/os/interface/Bitmap.h \ - ../../headers/os/interface/Box.h \ - ../../headers/os/interface/GridLayout.h \ - ../../headers/os/interface/GroupLayout.h \ - ../../headers/os/interface/IconUtils.h \ - ../../headers/os/interface/InterfaceDefs.h \ - ../../headers/os/interface/Layout.h \ - ../../headers/os/interface/LayoutBuilder.h \ - ../../headers/os/interface/LayoutItem.h \ - ../../headers/os/interface/Screen.h \ - ../../headers/os/interface/TwoDimensionalLayout.h \ + ../../headers/os/interface \ ../../headers/os/locale \ + ../../headers/os/media \ ../../headers/os/midi2 \ - ../../headers/os/storage/AppFileInfo.h \ - ../../headers/os/storage/FindDirectory.h \ - ../../headers/os/storage/Node.h \ + ../../headers/os/storage \ ../../headers/os/support \ ../../headers/posix/syslog.h -# This tag can be used to specify the character encoding of the source files that -# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default -# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. -# See http://www.gnu.org/software/libiconv for the list of possible encodings. +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. INPUT_ENCODING = UTF-8 -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.dox \ *.h \ *.c \ *.cpp -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = +EXCLUDE = -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */libkernelppp/_KPPP* -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the output. -# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, -# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test -EXCLUDE_SYMBOLS = +EXCLUDE_SYMBOLS = -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = +EXAMPLE_PATH = -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left # blank all files are included. -EXAMPLE_PATTERNS = +EXAMPLE_PATTERNS = -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = . \ - interface\ + interface \ midi2 -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be # ignored. -INPUT_FILTER = +INPUT_FILTER = -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. -FILTER_PATTERNS = +FILTER_PATTERNS = -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO -# Setting the INLINE_SOURCES tag to YES will include the body +# Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES @@ -640,20 +776,21 @@ REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. +# link to the source code. +# Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = NO -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = NO @@ -662,279 +799,508 @@ VERBATIM_HEADERS = NO # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = header.html -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = footer.html -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = book.css -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be # written to the html output directory. -CHM_FILE = +CHM_FILE = -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. -HHC_LOCATION = +HHC_LOCATION = -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO -# The TOC_EXPAND flag can be set to YES to add extra items for group members +# The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO -# This tag can be used to set the number of enum values (range [1..20]) +# This tag can be used to set the number of enum values (range [0,1..20]) # that doxygen will group on one line in the generated HTML documentation. +# Note that a value of 0 will completely suppress the enum values from appearing in the overview section. ENUM_VALUES_PER_LINE = 1 -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing +# MathJax, but it is strongly recommended to install a local copy of MathJax +# before deployment. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = NO + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. LATEX_CMD_NAME = latex -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. -EXTRA_PACKAGES = +EXTRA_PACKAGES = -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! -LATEX_HEADER = +LATEX_HEADER = -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. -RTF_STYLESHEET_FILE = +RTF_STYLESHEET_FILE = -# Set optional variables used in the generation of an rtf document. +# Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. -RTF_EXTENSIONS_FILE = +RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man -# The MAN_EXTENSION tag determines the extension that is added to +# The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO @@ -943,33 +1309,33 @@ MAN_LINKS = NO # configuration options related to the XML output #--------------------------------------------------------------------------- -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = YES -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the # syntax of the XML files. -XML_SCHEMA = +XML_SCHEMA = -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the # syntax of the XML files. -XML_DTD = +XML_DTD = -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES @@ -978,10 +1344,10 @@ XML_PROGRAMLISTING = YES # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO @@ -990,313 +1356,350 @@ GENERATE_AUTOGEN_DEF = NO # configuration options related to the Perl module output #--------------------------------------------------------------------------- -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. -PERLMOD_MAKEVAR_PREFIX = +PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- -# Configuration options related to the preprocessor +# Configuration options related to the preprocessor #--------------------------------------------------------------------------- -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by # the preprocessor. -INCLUDE_PATH = +INCLUDE_PATH = -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. -INCLUDE_FILE_PATTERNS = +INCLUDE_FILE_PATTERNS = -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator # instead of the = operator. -# Beep.h and SupportDefs.h require __cplusplus to be defined. -# SupportDefs.h defines some things that are also defined in types.h. There's -# check whether or not types.h has already been included. There is no need -# to put these definitions in our docs. - PREDEFINED = __cplusplus \ _SYS_TYPES_H -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that overrules the definition found in the source code. -EXPAND_AS_DEFINED = +EXPAND_AS_DEFINED = -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- -# Configuration::additions related to external references +# Configuration::additions related to external references #--------------------------------------------------------------------------- -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen +# If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = +TAGFILES = -# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. -GENERATE_TAGFILE = +GENERATE_TAGFILE = -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES -# The PERL_PATH should be the absolute path and name of the perl script +# The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /boot/home/config/bin/perl #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to -# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to -# specify the directory where the mscgen tool resides. If left empty the tool is assumed to -# be found in the default search path. +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. -MSCGEN_PATH = +MSCGEN_PATH = -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called Helvetica to the output +# directory and reference it in all dot files that doxygen generates. +# When you want a differently looking font you can specify the font name +# using DOT_FONTNAME. You need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO -# If set to YES, the inheritance and collaboration graphs will show the +# If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = NO -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = NO -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. CALL_GRAPH = NO -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, svg, gif or svg. # If left blank png will be used. DOT_IMAGE_FORMAT = png -# The tag DOT_PATH can be used to specify the path where the dot tool can be +# The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. -DOT_PATH = +DOT_PATH = -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the # \dotfile command). -DOTFILE_DIRS = +DOTFILE_DIRS = -# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen will always -# show the root nodes and its direct children regardless of this setting. +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/docs/user/app/Application.dox b/docs/user/app/Application.dox index c7418b312f..f64f2399b2 100644 --- a/docs/user/app/Application.dox +++ b/docs/user/app/Application.dox @@ -6,8 +6,8 @@ * John Scipione, jscipione@gmail.com * * Corresponds to: - * /trunk/headers/os/app/Application.h rev 42274 - * /trunk/src/kits/app/Application.cpp rev 42274 + * /trunk/headers/os/app/Application.h rev 42794 + * /trunk/src/kits/app/Application.cpp rev 42794 */ @@ -20,6 +20,7 @@ /*! \class BApplication \ingroup app + \ingroup libbe \brief A container object for an application. A BApplication establishes a connection between the application and the diff --git a/docs/user/app/Clipboard.dox b/docs/user/app/Clipboard.dox new file mode 100644 index 0000000000..3cc3e89df0 --- /dev/null +++ b/docs/user/app/Clipboard.dox @@ -0,0 +1,343 @@ +/* + * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Gabe Yoder, gyoder@stny.rr.com + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * /trunk/headers/os/app/Clipboard.h rev 42274 + * /trunk/src/kits/app/Clipboard.cpp rev 42274 + */ + + +/*! + \file Clipboard.h + \brief Provides the BClipboard class. +*/ + + +/*! + \var be_clipboard + \brief Global system clipboard object. +*/ + + +/*! + \class BClipboard + \ingroup app + \brief Used for short-term data storage between documents and + applications via copy and paste operations. + + Clipboards are differentiated by their name. In order for two + applications to share a clipboard they simply have to create a + BClipboard object with the same name. However, it is rarely necessary + to create your own clipboard, instead you can use the \c be_clipboard + system clipboard object. + + \remark To access the system clipboard without a BApplication object, + create a BClipboard object with the name "system". You should avoid + creating a custom clipboard with the name "system" for your own use. + + To access the clipboard data call the Data() method. The BMessage object + returned by the Data() method has the following properties: + - The \c what value is unused. + - The clipboard data is stored in a message field typed as + \c B_MIME_TYPE. + - The MIME type of the data is used as the name of the field that + holds the data. + - Each field in the data message contains the same data with a + different format. + + To read and write to the clipboard you must first lock the BClipboard + object. If you fail to lock the BClipboard object then the Data() method + will return \c NULL instead of a pointer to a BMessage object. + + Below is an example of reading a string from the system clipboard. +\code +const char *string; +int32 stringLen; +if (be_clipboard->Lock()) { + // Get the clipboard BMessage + BMessage *clip = be_clipboard->Data(); + + // Read the string from the clipboard data message + clip->FindData("text/plain", B_MIME_TYPE, (const void **)&string, + &stringLen); + + be_clipboard->Unlock(); +} else + fprintf(stderr, "could not lock clipboard.\n"); +\endcode + + Below is an example of writing a string to the system clipboard. +\code +const char* string = "Some clipboard data"; + +if (be_clipboard->Lock()) { + // Clear the clipboard data + be_clipboard->Clear(); + + // Get the clipboard data message + BMessage *clip = be_clipboard->Data(); + + // Write string data to the clipboard data message + clip->AddData("text/plain", B_MIME_TYPE, string, strlen(string)); + + // Commit the data to the clipboard + status = be_clipboard->Commit(); + if (status != B_OK) + fprintf(stderr, "could not commit data to clipboard.\n"); + + be_clipboard->Unlock(); +} else + fprintf(stderr, "could not lock clipboard.\n"); +\endcode +*/ + + +/*! + \fn BClipboard::BClipboard(const char *name, bool transient = false) + \brief Create a BClipboard object with the given \a name. + + If the \a name parameter is \c NULL then the "system" BClipboard object + is constructed instead. + + \param name The \a name of the clipboard. + \param transient If \c true, lose data after a reboot (currently unused). +*/ + + +/*! + \fn BClipboard::~BClipboard() + \brief Destroys the BClipboard object. The clipboard data is not destroyed. +*/ + + +/*! + \fn const char* BClipboard::Name() const + \brief Returns the name of the BClipboard object. + + \returns The name of the clipboard. +*/ + + +/*! + \name Commit Count Methods +*/ + + +//! @{ + + +/*! + \fn uint32 BClipboard::LocalCount() const + \brief Returns the (locally cached) number of commits to the clipboard. + + The returned value is the number of successful Commit() invocations for + the clipboard represented by this object, either invoked on this object + or another (even from another application). This method returns a locally + cached value, which might already be obsolete. For an up-to-date value + use SystemCount(). + + \return The number of commits to the clipboard. + + \sa SystemCount() +*/ + + +/*! + \fn uint32 BClipboard::SystemCount() const + \brief Returns the number of commits to the clipboard. + + The returned value is the number of successful Commit() invocations for + the clipboard represented by this object, either invoked on this object + or another (even from another application). This method retrieves the + value directly from the system service managing the clipboards, so it is + more expensive, but more up-to-date than LocalCount(), which returns a + locally cached value. + + \return The number of commits to the clipboard. + + \sa LocalCount() +*/ + + +//! @} + + +/*! + \name Monitoring Methods +*/ + + +//! @{ + + +/*! + \fn status_t BClipboard::StartWatching(BMessenger target) + \brief Start watching the BClipboard object for changes. + + When a change in the clipboard occurs, most like as the result of a cut + or copy action, a \a B_CLIPBOARD_CHANGED message is sent to \a target. + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \a target is invalid. + \retval B_ERROR An error occured. + + \sa StopWatching() +*/ + + +/*! + \fn status_t BClipboard::StopWatching(BMessenger target) + \brief Stop watching the BClipboard object for changes. + + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \a target is invalid. + \retval B_ERROR An error occurred. + + \sa StartWatching() +*/ + + +//! @} + + +/*! + \name Locking Methods +*/ + + +//! @{ + + +/*! + \fn bool BClipboard::Lock() + \brief Locks the clipboard so that no other tread can read from it or + write to it. + + You should call Lock() before reading or writing to the clipboard. + + \returns \c true if the clipboard was locked, \c false otherwise. + + \sa Unlock() +*/ + + +/*! + \fn void BClipboard::Unlock() + \brief Unlocks the clipboard. + + \sa Lock() +*/ + + +/*! + \fn bool BClipboard::IsLocked() const + \brief Returns whether or not the clipboard is locked. + + \returns \c true if the clipboard is locked, \c false if it is unlocked. +*/ + + +//! @} + + +/*! + \name Clipboard Data Transaction Methods +*/ + + +//! @{ + + +/*! + \fn status_t BClipboard::Clear() + \brief Clears out all data from the clipboard. + + You should call Clear() before adding new data to the BClipboard object. + + \retval B_OK Everything went find. + \retval B_NOT_ALLOWED The clipboard is not locked. + \retval B_NO_MEMORY Ran out of memory initializing the data message. + \retval B_ERROR Another error occurred. +*/ + + +/*! + \fn status_t BClipboard::Commit() + \brief Commits the clipboard data to the BClipboard object. + + \retval B_OK Everything went find. + \retval B_NOT_ALLOWED The clipboard is not locked. + \retval B_ERROR Another error occurred. +*/ + + +/*! + \fn status_t BClipboard::Commit(bool failIfChanged) + \brief Commits the clipboard data to the BClipboard object with the + option to fail if there is a change to the clipboard data. + + \param failIfChanged Whether or not to fail to commit the changes + if there is a change in the clipboard data. + + \retval B_OK Everything went find. + \retval B_NOT_ALLOWED The clipboard is not locked. + \retval B_ERROR Another error occurred. +*/ + + +/*! + \fn status_t BClipboard::Revert() + \brief Reverts the clipboard data. + + The method should be used in the case that you have made a change to the + clipboard data message and then decide to revert the change instead of + committing it. + + \retval B_OK Everything went find. + \retval B_NOT_ALLOWED The clipboard is not locked. + \retval B_NO_MEMORY Ran out of memory initializing the data message. + \retval B_ERROR Another error occurred. +*/ + + +//! @} + + +/*! + \name Clipboard Data Message Methods +*/ + + +//! @{ + + +/*! + \fn BMessenger BClipboard::DataSource() const + \brief Gets a BMessenger object targeting the application that last + modified the clipboard. + + The clipboard object does not need to be locked to call this method. + + \returns A BMessenger object that targets the application that last + modified the clipboard. +*/ + + +/*! + \fn BMessage* BClipboard::Data() const + \brief Gets a pointer to the BMessage object that holds the clipboard + data. + + If the BClipboard object is not locked this method returns \c NULL. + + \returns A pointer to the BMessage object that holds the clipboard + data or \c NULL if the clipboard is not locked. +*/ + + +//! @} diff --git a/docs/user/app/Handler.dox b/docs/user/app/Handler.dox index 04ecddb1c9..87f7e84a0b 100644 --- a/docs/user/app/Handler.dox +++ b/docs/user/app/Handler.dox @@ -207,15 +207,15 @@ /*! \fn void BHandler::MessageReceived(BMessage *message) \brief Handle a message that has been received by the associated looper. - - This method is reimplemented in your subclasses. If the messages that have + + This method is reimplemented by subclasses. If the messages that have been received by a looper pass through the filters, then they end up in the MessageReceived() methods. - - The example shows a very common way to handle message. Usually, this - involves parsing the BMessage::what constant and then perform an action - based on that. - + + The example below shows a very common way to handle message. Usually, + this involves parsing the BMessage::what constant and then perform an + action based on that. + \code void ShowImageApp::MessageReceived(BMessage *message) @@ -239,14 +239,14 @@ ShowImageApp::MessageReceived(BMessage *message) } \endcode - If your handler cannot process this message, you should pass it on to the - base class. Eventually, it will reach the default implementation, which - will reply with a \c B_MESSAGE_NOT_UNDERSTOOD constant. - - \attention If you want to keep or manipulate the \a message, have a look - at the \link BLooper::DetachCurrentMessage() DetachCurrentMessage() \endlink - method to get ownership of the message. - + If your handler cannot process this message, you should pass it on + to the base class. Eventually, it will reach the base implementation, + which will reply with \c B_MESSAGE_NOT_UNDERSTOOD. + + \attention If you want to keep or manipulate the \a message, have a + look at BLooper::DetachCurrentMessage() to receive ownership of + the message. + \param message The message that needs to be handled. */ @@ -254,7 +254,7 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn BLooper *BHandler::Looper() const \brief Return a pointer to the looper that this handler is associated with. - + \return If the handler is not yet associated with a looper, it will return \c NULL. \see BLooper::AddHandler() diff --git a/docs/user/book.css b/docs/user/book.css index 42c2079a55..4f50ee8f05 100644 --- a/docs/user/book.css +++ b/docs/user/book.css @@ -7,149 +7,236 @@ * Stephan Aßmus * Braden Ewing * Humdinger + * John Scipione */ -/* This is the Doxygen standard (messy) CSS updated with Haiku stuff. - All tags which are lower case have custom CSS, all upper case tags are the original. - I did some reordering. - - nielx - */ +/* color names provided by: http://chir.ag/projects/name-that-color */ html { - margin: 0px; - padding: 0px; + overflow-x: hidden; + overflow-y: scroll; +} + +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea, + p,blockquote,th,td { + margin: 0; + padding: 0; } body { - font-family: "DejaVu Sans",Arial,Helvetica,sans-serif; - background: white; - color: #333333; - font-size: 90%; - margin: 0px; - padding: 0px; + color: #333333; /* mine shaft */ + background-color: white; + font-family: "DejaVu Sans", Arial, sans-serif; +} + +h1, h2, h3, h4, h5, h6 { + color: #0c3762; /* madison */ + margin-top: 0.5em; + margin-bottom: 0.5em; } h1 { font-size: 1.3em; - font-weight: normal; - color: #0c3762; - border-bottom: dotted thin #e0e0e0; + font-weight: bold; + border-bottom: dotted thin #c0c0c0; /* silver */ } h2 { - font-size: 1.2em; + font-size: 1.3em; font-weight: normal; - color: #0c3762; - border-bottom: dotted thin #e0e0e0; - margin-top: 10px; + border-bottom: dotted thin #c0c0c0; /* silver */ } h3 { - font-size: 1.1em; + font-size: 1.2em; font-weight: normal; - color: #0c3762; - margin-top: 10px; + border-bottom: dotted thin #c0c0c0; /* silver */ } h4 { + font-size: 1.1em; + font-weight: normal; +} + +h5, h6 { font-size: 1.0em; - font-weight: lighter; - color: #0c3762; - margin-top: 10px; + font-weight: normal; } p { - text-align: justify; - line-height: 1.3; + font-size: 14.4px; + margin-top: 0.5em; + margin-bottom: 0.5em; } -/* link colors and text decoration */ - -a:link { - font-weight: bold; - text-decoration: none; - color: #dc3c01; +table { + border-collapse: collapse; + border-spacing: 0; } -a:visited { +td, th { + vertical-align: top; + text-align: left; +} + +caption { + text-align:left; +} + +fieldset,img { + border: 0; +} + +q:before,q:after { + content: ''; +} + +abbr,acronym { + border: 0; +} + +a:link { font-weight: bold; text-decoration: none; - color: #892601; + color: #dc3c01; /* grenadier */ +} + +a:visited { + font-weight: bold; + text-decoration: none; + color: #892601; /* peru tan */ } a:hover, a:active { text-decoration: underline; - color: #ff4500; + color: #ff4500; /* vermilion */ } + /* Some headers act as anchors, don't give them a hover effect */ -h1 a:hover, a:active { +h1 a:hover, a:active, h2 a:hover, a:active, h3 a:hover, a:active, +h4 a:hover, a:active, h5 a:hover, a:active, h6 a:hover, a:active { text-decoration: none; - color: #0c3762; -} - -h2 a:hover, a:active { - text-decoration: none; - color: #0c3762; -} - -h3 a:hover, a:active { - text-decoration: none; - color: #0c3762; -} - -h4 a:hover, a:active { - text-decoration: none; - color: #0c3762; + color: #0c3762; /* madison */ } /* Custom Header */ -div.logo { +#banner { position: relative; - left: 0px; - top: 0px; - background: #efefef; + top: 0; + left: 0; + height: 84px; + background: #eeeeee; /* gallery */ } -div.logo img { - margin-left: 20px; +#banner div.logo { + background: url('http://api.haiku-os.org/logo.png') no-repeat scroll 0 0 transparent; + width: 59em; + height: 100%; + margin: 0 auto; } -div.title { - position: absolute; +#banner span.subtitle { + position: relative; top: 54px; - right: 40px; + left: 272px; + color: #333333; /* mine shaft */ + text-transform: uppercase; + letter-spacing: 3px; + font-family: Myriad Pro,Myriad Web Pro Regular,Lucida Grande,Geneva,Trebuchet MS,sans-serif; + font-weight: normal; +} + +div.header { + margin-top: 20px; + margin: 10px auto; + width: 59em; +} + +div.summary { + margin: 0 auto; + width: 59em; + + display: none; +} + +div.headertitle { + margin: 0 auto; + width: 59em; +} + +div.headertitle div.title { + color: #0c3762; /* madison */ font-size: 1.2em; + font-weight: bold; + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +.ingroups { + margin-top: 10px; } /* Navigation Tabs */ -div.tabs { - width: 100%; - background: #e0e0e0; + +div.tabs, div.tabs2, div.tabs3 { + position: relative; + left: 0; + top: 0; + background: #e0e0e0; /* alto */ + margin: 0; + padding: 0; } -div.tabs ul { - margin: 0px; - padding-left: 10px; +div.tabs ul.tablist, div.tabs2 ul.tablist, div.tabs3 ul.tablist { + margin: 0 auto; + padding-top: 3px; + padding-bottom: 2px; + list-style: none; + width: 59em; +} + +div.navpath { + margin: 20px auto; + width: 59em; +} + +div.navpath ul { list-style: none; } -div.tabs li { +div.navpath ul li { + padding-top: 3px; + padding-bottom: 2px; +} + +div.tabs ul.tablist { +} + +div.tabs2 ul.tablist { +} + +div.tabs3 ul.tablist { +} + +div.tabs ul.tablist li, div.tabs2 ul.tablist li, div.tabs3 ul.tablist li { display: inline; margin: 0px; padding: 0px; - font-size: 0,8em; + font-size: 0.8em; } -div.tabs span { +div.tabs ul.tablist li span, div.tabs2 ul.tablist li span, + div.tabs3 ul.tablist li span { display: inline; - padding: 5px 9px; + padding-right: 9px; white-space: nowrap; } -div.tabs li.current a { +div.tabs ul.tablist li li.current a, div.tabs2 ul.tablist li li.current a, + div.tabs3 ul.tablist li li.current a { color: black; text-decoration: none; } @@ -157,33 +244,122 @@ div.tabs li.current a { /* Contents div */ div.contents { - padding: 50px 40px; + line-height: 1.5; + margin: 10px auto; + width: 59em; +} + +div.contents ul, div.contents ol { + font-size: 14.4px; + line-height: 1.3; +} + +div.contents em, div.contents code { + font-weight: normal; + font-style: normal; +} + +div.contents code { + color: blue; +} + +div.contents td { + line-height: 1.3; +} + +div.contents code { + color: blue; + font-family: "Deja Vu Mono", Courier, "Courier New", monospace, fixed; + font-weight: normal; + font-style: normal; +} + +div.contents div.dynheader { + margin-bottom: 16px; +} + +div.contents span.keycap, div.contents span.keysym { + -webkit-border-radius: 3px; + -khtml-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + border-color: #c7c7c7; /* silver */ + border-style: solid; + border-width: 1px; + padding: 0px 2px 0px 2px; + background-color: #e8e8e8; /* mercury */ + font-family: serif; + font-variant: small-caps; +} + +div.contents div.textblock { + width: 95%; + margin-bottom: 20px; +} + +div.contents hr { + display: none; +} + +div.contents ol,ul { + list-style: none; +} + +div.contents li { + margin-bottom: 10px; + margin-left: 20px; +} + +div.contents dd { + font-size: 14.4px; +} + +div.contents dt { + margin-top: 16px; + margin-bottom: 8px; } /* The boxes from the userguide */ -/* Rounded corner boxes */ -/* Common declarations */ -.info, .stop, .warning { - -webkit-border-radius: 10px; - -khtml-border-radius: 10px; - -moz-border-radius: 10px; - border-radius: 10px; - border-style: dotted; - border-width: thin; - border-color: #dcdcdc; - padding: 10px 15px 10px 80px; - margin-bottom: 15px; - margin-top: 15px; - min-height: 42px; +dl.note, dl.remark, dl.warning, dl.attention { + width: 100%; + border-style: solid; + border-width: 2px; + margin-top: 24px; + margin-bottom: 24px; + padding: 4px; + min-height: 64px; } -.info { - background: #e4ffde url(images/alert_info_32.png) 15px 15px no-repeat; + +dl.note { + /* rice flower */ + background:#e4ffde url('http://haiku-os.org/sites/haiku-os.org/themes/shijin/haiku-icons/alert_info_32.png') 15px 15px no-repeat; + border-color: #94ce18; /* lima */ } -.warning { - background: #fffbc6 url(images/alert_warning_32.png) 15px 15px no-repeat; + +dl.remark { + background: #f3f3f3 url('http://api.haiku-os.org/images/alert_idea_32.png') 15px 15px no-repeat; + border-color: #c0c0c0; /* silver */ } -.stop { - background: #ffeae6 url(images/alert_stop_32.png) 15px 15px no-repeat; + +dl.warning { + /* lemon chiffon */ + background: #fffbc6 url('http://api.haiku-os.org/images/alert_warning_32.png') 15px 15px no-repeat; + border-color: #eed300; /* gold */ +} + +dl.attention { + /* fair pink */ + background: #ffeae6 url('http://api.haiku-os.org/images/alert_stop_32.png') 15px 15px no-repeat; + border-color: red; +} + +dl.note dt, dl.remark dt, dl.warning dt, dl.attention dt { + display: none; /* don't display the Note: or Warning: header */ +} + +dl.note dd, dl.remark dd, dl.warning dd, dl.attention dd { + margin: 10px 10px 10px 60px; + color: black; /* pseudo-bold */ } @@ -194,11 +370,11 @@ div.contents span.keycap { -khtml-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; - border-color: #c7c7c7; + border-color: #c7c7c7; /* silver */ border-style: solid; border-width: 1px; padding: 0px 2px 0px 2px; - background-color: #e8e8e8; + background-color: #e8e8e8; /* mercury */ font-family: serif; font-variant: small-caps; } @@ -207,96 +383,117 @@ div.contents span.keycap { /* Continue with the rest of the standard Doxygen stuff... */ CAPTION { font-weight: bold } -DIV.qindex { +div.qindex { width: 100%; - background-color: #e8eef2; - border: 1px solid #84b0c7; + background-color: #f3f3f3; /* concrete */ + border: 1px solid #c0c0c0; /* silver */ text-align: center; margin: 2px; padding: 2px; - line-height: 140%; + line-height: 1.3; } -DIV.nav { +div.nav { width: 100%; - background-color: #e8eef2; - border: 1px solid #84b0c7; + background-color: #f3f3f3; /* concrete */ + border: 1px solid #c0c0c0; /* silver */ text-align: center; margin: 2px; padding: 2px; - line-height: 140%; + line-height: 1.3; } -DIV.navtab { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; +div.navtab { + background-color: #f3f3f3; /* concrete */ + border: 1px solid #c0c0c0; /* silver */ + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; } TD.navtab { - font-size: 70%; + ; } A.qindex { - text-decoration: none; - font-weight: bold; - color: #1A419D; + text-decoration: none; + font-weight: bold; + color: #1a419d; /* fun blue */ } A.qindex:visited { - text-decoration: none; - font-weight: bold; - color: #1A419D + text-decoration: none; + font-weight: bold; + color: #1a419d; /* fun blue */ } A.qindex:hover { text-decoration: none; - background-color: #ddddff; + background-color: #ddddff; /* fog */ } A.qindexHL { text-decoration: none; font-weight: bold; - background-color: #6666cc; - color: #ffffff; - border: 1px double #9295C2; + background-color: #6666cc; /* blue marguerite */ + color: white; + border: 1px double #9295c2; /* bell blue */ } A.qindexHL:hover { text-decoration: none; - background-color: #6666cc; - color: #ffffff; + background-color: #6666cc; /* blue marguerite */ + color: white; } -A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } -A.elRef { font-weight: bold } -A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} -A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} -A.codeRef:link { font-weight: normal; color: #0000FF} -A.codeRef:visited { font-weight: normal; color: #0000FF} -DL.el { margin-left: -1cm } -.fragment { - font-family: monospace, fixed; - font-size: 95%; +A.qindexHL:visited { + text-decoration: none; + background-color: #6666cc; /* blue marguerite */ + color: white; } -PRE.fragment { - border: 1px solid #CCCCCC; - background-color: #f5f5f5; - margin-top: 4px; - margin-bottom: 4px; - margin-left: 2px; - margin-right: 8px; - padding-left: 6px; - padding-right: 6px; - padding-top: 4px; - padding-bottom: 4px; +A.elRef { + font-weight: bold } -DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } - -DIV.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold; +A.code:link { + text-decoration: none; + font-weight: normal; + color: blue; +} +A.code:visited { + text-decoration: none; + font-weight: normal; + color: blue; +} +A.codeRef:link { + font-weight: normal; + color: blue; +} +A.codeRef:visited { + font-weight: normal; + color: blue; +} +dl.el { + margin-left: -1cm +} +div.fragment { + width: 99%; + background-color: #f3f3f3; /* concrete */ + border: 1px solid #c0c0c0; /* silver */ + padding: 4px; +} +div.fragment pre.fragment { + color: black; + font-family: "Deja Vu Mono", Courier, "Courier New", monospace, fixed; + font-weight: normal; + font-style: normal; + font-size: 0.9em; + line-height: 1.3; +} +div.fragment pre.fragment a.code { + font-weight: bold; +} +div.ah { + background-color: black; + font-weight: bold; + color: white; + margin-bottom: 3px; + margin-top: 3px; } -DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } - TD.indexkey { - background-color: #e8eef2; + background-color: #f3f3f3; /* concrete */ + border: 1px solid #c0c0c0; /* silver */ font-weight: bold; padding-right : 10px; padding-top : 2px; @@ -306,10 +503,10 @@ TD.indexkey { margin-right : 0px; margin-top : 2px; margin-bottom : 2px; - border: 1px solid #CCCCCC; } TD.indexvalue { - background-color: #e8eef2; + background-color: #f3f3f3; /* concrete */ + border: 1px solid #c0c0c0; /* silver */ font-style: italic; padding-right : 10px; padding-top : 2px; @@ -319,220 +516,345 @@ TD.indexvalue { margin-right : 0px; margin-top : 2px; margin-bottom : 2px; - border: 1px solid #CCCCCC; } TR.memlist { - background-color: #f0f0f0; + background-color: #f0f0f0; /* gallery */ } P.formulaDsp { text-align: center; } IMG.formulaDsp { } IMG.formulaInl { vertical-align: middle; } -SPAN.keyword { color: #008000 } -SPAN.keywordtype { color: #604020 } -SPAN.keywordflow { color: #e08000 } -SPAN.comment { color: #800000 } -SPAN.preprocessor { color: #806020 } -SPAN.stringliteral { color: #002080 } -SPAN.charliteral { color: #008080 } -.mdescLeft { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.mdescRight { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.memItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplParams { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - color: #606060; - background-color: #FAFAFA; - font-size: 80%; -} -.search { color: #003399; - font-weight: bold; +SPAN.keyword { color: #008000; /* japanese laurel */ } +SPAN.keywordtype { color: #5c5f05; /* antique bronze */ } +SPAN.keywordflow { color: #e08000; /* mango tango */ } +SPAN.comment { color: #008000; /* japanese laurel */ } +SPAN.preprocessor { color: #806020; /* kumera */ } +SPAN.stringliteral { color: blue; } +SPAN.charliteral { color: #008080; /* teal */ } +.search { + color: #003399; /* smalt */ + font-weight: bold; } FORM.search { - margin-bottom: 0px; - margin-top: 0px; + margin-bottom: 0px; + margin-top: 0px; } -INPUT.search { font-size: 75%; - color: #000080; - font-weight: normal; - background-color: #e8eef2; +INPUT.search { + color: #000080; /* navy blue */ + font-weight: normal; + background-color: #f3f3f3; /* concrete */ } -TD.tiny { font-size: 75%; +TD.tiny { font-size: 75%; } +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; /* glacier */ +} +TH.dirtab { + background-color: #f3f3f3; /* concrete */ + font-weight: bold; } -.dirtab { padding: 4px; - border-collapse: collapse; - border: 1px solid #84b0c7; +/* member declaration table */ + +table.memberdecls { + width: 100%; } -TH.dirtab { background: #e8eef2; - font-weight: bold; + +table.memberdecls td.memItemLeft { + font-size: 13px; + white-space: nowrap; + text-align: right; + padding: 6px 0px 4px 8px; + margin: 4px; + vertical-align: top; + border-top: 1px solid #c0c0c0; /* silver */ + border-left: 1px solid #c0c0c0; /* silver */ + background-color: #f3f3f3; /* concrete */ } -HR { height: 1px; - border: none; - border-top: 1px solid black; + +table.memberdecls td.memItemRight { + font-size: 13px; + padding: 6px 8px 4px 0px; + margin: 4px; + vertical-align: top; + border-top: 1px solid #c0c0c0; /* silver */ + border-right: 1px solid #c0c0c0; /* silver */ + background-color: #f3f3f3; /* concrete */ +} + +table.memberdecls td.mdescLeft { + font-size: 13px; + line-height: 1.3; + padding: 1px 0px 4px 8px; + margin: 0px; + border-bottom: 1px solid #c0c0c0; /* silver */ + border-left: 1px solid #c0c0c0; /* silver */ + background-color: #f3f3f3; /* concrete */ +} + +table.memberdecls td.mdescRight { + font-size: 13px; + line-height: 1.3; + padding: 1px 8px 4px 0px; + margin: 0px; + border-bottom: 1px solid #c0c0c0; /* silver */ + border-right: 1px solid #c0c0c0; /* silver */ + background-color: #f3f3f3; /* concrete */ +} + +table.memberdecls td.mdescRight p { + margin: 0; + padding: 0; +} + +table.memberdecls td.memTemplItemLeft { + font-size: 13px; + padding: 1px 0px 0px 8px; + margin: 0px; + text-align: right; + border-left: 1px solid #c0c0c0; /* silver */ + background-color: #f3f3f3; /* concrete */ +} + +table.memberdecls td.memTemplItemRight { + font-size: 13px; + padding: 1px 8px 0px 0px; + margin: 0px; + border-right: 1px solid #c0c0c0; /* silver */ + background-color: #f3f3f3; /* concrete */ +} + +table.memberdecls td.memTemplParams { + font-size: 13px; + padding: 1px 0px 0px 8px; + margin: 0px; + border-top: 1px solid #c0c0c0; /* silver */ + border-left: 1px solid #c0c0c0; /* silver */ + border-right: 1px solid #c0c0c0; /* silver */ + background-color: #f3f3f3; /* concrete */ +} + +table.memberdecls td div.groupHeader { + /* same as h3 */ + color: #0c3762; /* madison */ + margin-top: 0.5em; + margin-bottom: 0.5em; + font-size: 1.2em; + font-weight: normal; + border-bottom: dotted thin #c0c0c0; /* silver */ +} + +table.memberdecls td div.groupText { + font-size: 14.4px; } /* Style for detailed member documentation */ -.memtemplate { - font-size: 80%; - color: #606060; - font-weight: normal; + +div.memtemplate { + font-weight: normal; + font-style: normal; } -.memnav { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; + +div.memnav { + background-color: #f3f3f3; /* concrete */ + border: 1px solid #c0c0c0; /* silver */ + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; } -.memitem { - padding: 4px; - background-color: #eef3f5; - border-width: 1px; - border-style: solid; - border-color: #dedeee; - -moz-border-radius: 8px 8px 8px 8px; + +/* member item */ + +div.memitem { + margin-bottom: 20px; + width: 100%; } -.memname { - white-space: nowrap; - font-weight: bold; + +div.memitem dl.info, div.memitem dl.note, div.memitem dl.attention, + div.memitem dl.warning, + div.memitem dl.stop, div.memitem dl.bug { + width: 99%; } -.memdoc{ - padding-left: 10px; + +/* member prototype */ + +div.memproto { + padding: 4px; + background-color: #f3f3f3; /* concrete */ + border: 1px solid #c0c0c0; /* silver */ + font-size: 13px; } -.memproto { - background-color: #d5e1e8; - width: 100%; - border-width: 1px; - border-style: solid; - border-color: #84b0c7; - font-weight: bold; - -moz-border-radius: 8px 8px 8px 8px; + +div.memproto table { + font-size: 13px; } -.paramkey { - text-align: right; + +/* member table */ + +div.memproto table.memname { + line-height: 1.3; } -.paramtype { - white-space: nowrap; + +div.memproto table.memname td.paramtype { + white-space: nowrap; } -.paramname { - color: #602020; - font-style: italic; - white-space: nowrap; + +div.memproto table.memname td.paramkey { + text-align: right; } + +div.memproto table.memname td.paramname { + white-space: nowrap; +} + +div.memproto table.memname td.memname { + white-space: nowrap; +} + +/* member documetation */ + +div.memdoc { + width: 100%; +} + +div.memdoc div.memproto { + margin-top: 2em; +} + +div.memdoc table { + width: 100%; +} + +div.memdoc table td { + vertical-align: middle; + padding: 8px; + border: 1px solid #d5d5d5; /* silver */ +} + +div.memdoc td:first-child { + width: 157px; +} + +div.memdoc dl dd table { + width: 100%; +} + +div.memdoc dl dd table td { + font-size: 14.4px; + padding: 8px; + border: 1px solid #d5d5d5; /* silver */ +} + +div.memdoc dl dd table td ul, table td ol { + margin-top: 8px; + margin-bottom: 8px; +} + +div.memdoc dl dd div.memdoc table.doxtable td { + border: none; +} + +/* parameters table */ + +div.memdoc dl dd table.params td.paramdir { + vertical-align: top; + color: black; + width: 157px; +} + +div.memdoc dl dd table.params td.paramname { + vertical-align: top; + font-weight: normal; + font-style: normal; + width: 157px; +} + +/* return values table */ + +div.memdoc dl dd table.retval td.paramname { + vertical-align: top; + color: blue; + width: 157px; +} + /* End Styling for detailed member documentation */ /* for the tree view */ .ftvtree { font-family: sans-serif; - margin:0.5em; + margin: 0.5em; } + .directory { font-size: 9pt; font-weight: bold; } .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } .directory > h3 { margin-top: 0; } .directory p { margin: 0px; white-space: nowrap; } .directory div { display: none; margin: 0px; } .directory img { vertical-align: -30%; } + +/* printer only pretty stuff */ +@media print { + /* suggest page orientation */ + @page { size: portrait; } + .noprint { + display: none; + } + + html { + background: #FFF; + } + + /* hide header and nav bar */ + #banner { + display:none; + } + + div.tabs, div.tabs2, div.tabs3 { + display:none; + } + + div.summary { + margin: 0px; + padding: 0px; + } + + div.headertitle { + margin: 0px; + padding: 0px; + } + + div.content { + margin: 0px; + padding: 0px; + } + + /* some links we want to print the url along with (CSS2) */ + a.printurl:after { + content: " <" attr(href) ">"; + font-weight: normal; + font-size: small; + } + + /* override for those we really don't want to print */ + a.noprinturl:after { + content: ""; + } + + /* for acronyms we want their definitions inlined at print time */ + acronym[title]:after { + font-size: small; + content: " (" attr(title) ")"; + font-style: italic; + } + + /* and not have mozilla dotted underline */ + acronym { + border: none; + } + + pre.terminal { /* Terminal output black on white */ + background-color: #ffffff; + color: #000000; + } +} diff --git a/docs/user/book.dox b/docs/user/book.dox index 1b87f6d721..b2c2056c45 100644 --- a/docs/user/book.dox +++ b/docs/user/book.dox @@ -1,50 +1,555 @@ /*! - \mainpage The Haiku Book + \mainpage Welcome to the Haiku Book - \section kits Kits and Servers + Below you will find documentation on the Application Programming + Interface (API) of the Haiku operating system. This API describes + the internals of the operating system allowing developers to write + native C++ applications and device drivers. See the + online version for the most + updated version of this document. If you would like to help contribute + contact the documentation + mailing list. For guidelines on how to help document the API see + the \link apidoc Documenting the API\endlink page. A list of + contributors can be found \ref credits page. Documenting the API is + an ongoing process so contributions are greatly appreciated. - - \ref app | \link app_intro \em Introduction \endlink - - \ref drivers - - \ref interface | \link interface_intro \em Introduction \endlink - - \ref locale | \link locale_intro \em Introduction \endlink - - \ref media | \em Introduction - - \ref midi1 - - \ref midi2 | \link midi2_intro \em Introduction \endlink - - \ref storage | \em Introduction - - \ref support | \link support_intro \em Introduction \endlink + The Haiku API is based on the BeOS R5 API but changes and additions have + been included where appropriate. Important compatibility differences are + detailed on the \ref compatibility page. New classes and methods + and incompatible API changes to the BeOS R5 API are noted in the + appropriate sections. + + A complete reference to the BeOS R5 API is available on the web in + The Be Book. + The Be Book is used with permission from + Access Co., the current + owners of Be's intellectual property. - \section notes General Notes and Information - - \ref compatibility - - \ref apidoc - - \ref credits + \section kits Kits and Servers + + The API is split into several kits and servers each detailing a different + aspect of the operating system. + - The \ref app is the starting point for developing applications + and includes classes for messaging and for interacting with + the rest of the system. + - The \ref interface is used to create responsive and attractive + graphical user interfaces building on the messaging facilities + provided by the Application Kit. + - The \link layout_intro Layout API \endlink is a new addition + to the Interface Kit in Haiku which provides resources to + layout your application flexibly and easily. + - The \ref locale includes classes to localize your application to + different languages, timezones, number formatting conventions and + much more. + - The \ref media provides a unified and consistent interface for media + streams and applications to intercommunicate. + - The \ref midi2 describes an interface to generating, processing, + and playing music in MIDI format. For reference documentation on the + \ref midi1 is also included. + - The \ref storage is a collection of classes that deal with storing and + retrieving information from disk. + - The \ref support contains support classes to use in your application + including resources for thread safety, IO, and serialization. + + \section special_topics Special Topics + + - \ref drivers */ ///// Define main kits ///// /*! - \defgroup app Application Kit - \defgroup drivers Drivers - \defgroup interface Interface Kit - \brief API for displaying a graphical user interface. - \defgroup media - \defgroup midi2 MIDI 2 Kit - \brief API for producing and consuming MIDI events. - \defgroup libmidi2 (libmidi2.so) - \defgroup storage - \defgroup support Support Kit - \brief Collection of utility classes that are used throughout the API. - \defgroup libbe (libbe.so) - \defgroup libroot (libroot.so) - \defgroup locale Locale Kit - \brief Collection of classes for localizing applications. + \defgroup app Application Kit + \brief The Application Kit is the starting point for writing native Haiku + GUI applications. + + The application kit is exactly what its name suggests — it is the + basis of Haiku applications. You should first read through this document + and the references here before moving on to the other parts of the API. + + The Application Kit classes can be divided into two groups: the messaging + classes and the system interaction classes. The larger of the two groups is + the messaging classes. Since the Haiku API relies on pervasive + multithreading messaging is an essential topic for any application. Have a + look at the \link app_messaging Introduction to Messaging \endlink for more + information. + + The following messaging classes which allow you to easily and securely + communicate between threads. + - BHandler + - BInvoker + - BLooper + - BMessage + - BMessageFilter + - BMessageQueue + - BMessageRunner + - BMessenger + + The second group is the system interaction classes. These classes + provide hooks for your application to interact with the rest of the system. + The most important class in this group is BApplication. Below is a list of + all system interaction classes: + - BApplication + - BClipboard + - BCursor + - BPropertyInfo + - BRoster + + + \defgroup drivers Device Drivers + + + \defgroup interface Interface Kit + \brief API for displaying a graphical user interface. + + The Interface Kit holds all the classes you'll need to develop a GUI. + Building on the messaging facilities provided by the Application Kit, + the Interface Kit can be used to create a responsive and attractive + graphical user interface. + + The most important class in the Interface Kit is the BView class, which + handles drawing and user interaction. Pointer and keyboard events are + processed in this class. + + Another important class is the BWindow class, which holds BViews and makes + them visible to the user. The BWindow class also handles BView focusing + and BMessage dispatching, among other things. + + A new addition Haiku has added over the BeOS API is the Layout API, which + is based around the BLayoutItem and BLayout classes. These classes will + take care of making sure all your GUI widgets end up where you want them, + with enough space to be useful. You can start learning the Layout API + by reading the \link layout_intro introduction \endlink. + + + \defgroup locale Locale Kit + \brief Collection of classes for localizing applications. + + The Locale Kit provides a set of tools for internationalizing, + localizing and translating your software. This includes not only + replacing string with their translations at runtime, but also more + complex tasks such as formatting numbers, dates, and times in a way + that match the locale preferences of the user. + + The main way to access locale data is through the be_locale_roster. + This is a global instance of the BLocaleRoster class, storing the data + for localizing an application according to the user's preferred settings. + The locale roster also acts as a factory to instantiate most of the other + classes. However, there are some cases where you will need to instantiate + another class by yourself, to use it with custom settings. For example, you + may need to format a date with a fixed format in english for including in an + e-mail header, as it is the only format accepted there. + + Unlike the other kits in Haiku, the Locale kit does not live in libbe. + When building a localized application, you have to link it to + liblocale.so. If you want to use the catalog macros, you also have to + link each of your images (that is, applications, libraries and add-ons) + to liblocalestub.a. + + \defgroup media Media Kit + \brief Collection of classes that deal with audio and video. + + + \defgroup midi1 The old MIDI Kit (libmidi.so) + \brief The old MIDI kit. + + + \defgroup midi2 MIDI 2 Kit + \brief The Midi Kit is the API that implements support for generating, + processing, and playing music in MIDI format. + + MIDI, which stands for 'Musical + Instrument Digital Interface', is a well-established standard for + representing and communicating musical data. This document serves as + an overview. If you would like to see all the components, please look + at \link midi2 the list with classes \endlink. + + \section midi2twokits A Tale of Two MIDI Kits + + BeOS comes with two different, but compatible Midi Kits. This + documentation focuses on the "new" Midi Kit, or midi2 as we like to + call it, that was introduced with BeOS R5. The old kit, which we'll + refer to as midi1, is more complete than the new kit, but less powerful. + + Both kits let you create so-called MIDI endpoints, but the endpoints + from midi1 cannot be shared between different applications. The midi2 + kit solves that problem, but unlike midi1 it does not include a General + MIDI softsynth, nor does it have a facility for reading and playing + Standard MIDI Files. Don't worry: both kits are compatible and you can + mix-and-match them in your applications. + + The main differences between the two kits: + - Instead of one BMidi object that both produces and consumes events, + we have BMidiProducer and BMidiConsumer. + - Applications are capable of sharing MIDI producers and consumers + with other applications via the centralized Midi Roster. + - Physical MIDI ports are now sharable without apps "stealing" events + from each other. + - Applications can now send/receive raw MIDI byte streams (useful if + an application has its own MIDI parser/engine). + - Channels are numbered 0–15, not 1–16 + - Timing is now specified in microseconds rather than milliseconds. + + \section midi2concepts Midi Kit Concepts + + A brief overview of the elements that comprise the Midi Kit: + - \b Endpoints. This is what the Midi Kit is all about: sending MIDI + messages between endpoints. An endpoint is like a MIDI In or MIDI + Out socket on your equipment; it either receives information or it + sends information. Endpoints that send MIDI events are called + \b producers; the endpoints that receive those events are called + \b consumers. An endpoint that is created by your own application + is called \b local; endpoints from other applications are + \b remote. You can access remote endpoints using \b proxies. + - \b Filters. A filter is an object that has a consumer and a producer + endpoint. It reads incoming events from its consumer, performs some + operation, and tells its producer to send out the results. In its + current form, the Midi Kit doesn't provide any special facilities + for writing filters. + - \b Midi \b Roster. The roster is the list of all published producers + and consumers. By publishing an endpoint, you allow other + applications to talk to it. You are not required to publish your + endpoints, in which case only your own application can use them. + - \b Midi \b Server. The Midi Server does the behind-the-scenes work. + It manages the roster, it connects endpoints, it makes sure that + endpoints can communicate, and so on. The Midi Server is started + automatically when BeOS boots, and you never have to deal with it + directly. Just remember that it runs the show. + - \b libmidi. The BMidi* classes live inside two shared libraries: + libmidi.so and libmidi2.so. If you write an application that uses + old Midi Kit, you must link it to libmidi.so. Applications that use + the new Midi Kit must link to libmidi2.so. If you want to + mix-and-match both kits, you should also link to both libraries. + + Here is a pretty picture: + + \image html midi2concepts.png + + \section midi2mediakit Midi Kit != Media Kit + + Be chose not to integrate the Midi Kit into the Media Kit as another media + type, mainly because MIDI doesn't require any of the format negotiation that + other media types need. Although the two kits look similar -- both have a + "roster" for finding or registering "consumers" and "producers" -- there are + some very important differences. + + The first and most important point to note is that BMidiConsumer and + BMidiProducer in the Midi Kit are \b NOT directly analogous to + BBufferConsumer and BBufferProducer in the Media Kit! In the Media Kit, + consumers and producers are the data consuming and producing properties + of a media node. A filter in the Media Kit, therefore, inherits from both + BBufferConsumer and BBufferProducer, and implements their virtual member + functions to do its work. + + In the Midi Kit, consumers and producers act as endpoints of MIDI data + connections, much as media_source and media_destination do in the Media Kit. + Thus, a MIDI filter does not derive from BMidiConsumer and BMidiProducer; + instead, it contains BMidiConsumer and BMidiProducer objects for each of its + distinct endpoints that connect to other MIDI objects. The Midi Kit does not + allow the use of multiple virtual inheritance, so you can't create an object + that's both a BMidiConsumer and a BMidiProducer. + + This also contrasts with the old Midi Kit's conception of a BMidi object, + which stood for an object that both received and sent MIDI data. In the new + Midi Kit, the endpoints of MIDI connections are all that matters. What lies + between the endpoints, i.e. how a MIDI filter is actually structured, is + entirely at your discretion. + + Also, rather than use token structs like media_node to make connections + via the MediaRoster, the new kit makes the connections directly via the + BMidiProducer object. + + \section midi2remotelocal Remote vs. Local Objects + + The Midi Kit makes a distinction between remote and local MIDI objects. + You can only create local MIDI endpoints, which derive from either + BMidiLocalConsumer or BMidiLocalProducer. Remote endpoints are endpoints + that live in other applications, and you access them through BMidiRoster. + + BMidiRoster only gives you access to BMidiEndpoints, BMidiConsumers, and + BMidiProducers. When you want to talk to remote MIDI objects, you do so + through the proxy objects that BMidiRoster provides. Unlike + BMidiLocalConsumer and BMidiLocalProducer, these classes do not provide a + lot of functions. That is intentional. In order to hide the details of + communication with MIDI endpoints in other applications, the Midi Kit must + hide the details of how a particular endpoint is implemented. + + So what can you do with remote objects? Only what BMidiConsumer, + BMidiProducer, and BMidiEndpoint will let you do. You can connect + objects, get the properties of these objects -- and that's about it. + + \section midi2lifespan Creating and Destroying Objects + + The constructors and destructors of most midi2 classes are private, + which means that you cannot directly create them using the C++ + new operator, on the stack, or as globals. Nor can you + delete them. Instead, these objects are obtained through + BMidiRoster. The only two exceptions to this rule are BMidiLocalConsumer + and BMidiLocalProducer. These two objects may be directly created and + subclassed by developers. + + \section midi2refcount Reference Counting + + Each MIDI endpoint has a reference count associated with it, so that + the Midi Roster can do proper bookkeeping. When you construct a + BMidiLocalProducer or BMidiLocalConsumer endpoint, it starts with a + reference count of 1. In addition, BMidiRoster increments the reference + count of any object it hands to you as a result of + \link BMidiRoster::NextEndpoint() NextEndpoint() \endlink or + \link BMidiRoster::FindEndpoint() FindEndpoint() \endlink. + Once the count hits 0, the endpoint will be deleted. + + This means that, to delete an endpoint, you don't call the + delete operator directly; instead, you call + \link BMidiEndpoint::Release() Release() \endlink. + To balance this call, there's also an + \link BMidiEndpoint::Acquire() Acquire() \endlink, in case you have two + disparate parts of your application working with the endpoint, and you + don't want to have to keep track of who needs to Release() the endpoint. + + When you're done with any endpoint object, you must Release() it. + This is true for both local and remote objects. Repeat after me: + Release() when you're done. + + \section midi2events MIDI Events + + To make some actual music, you need to + \link BMidiProducer::Connect() Connect() \endlink your consumers to + your producers. Then you tell the producer to "spray" MIDI events to all + the connected consumers. The consumers are notified of these incoming + events through a set of hook functions. + + The Midi Kit already provides a set of commonly used spray functions, + such as \link BMidiLocalProducer::SprayNoteOn() SprayNoteOn() \endlink, + \link BMidiLocalProducer::SprayControlChange() SprayControlChange() + \endlink, and so on. These correspond one-to-one with the message types + from the MIDI spec. You don't need to be a MIDI expert to use the kit, but + of course some knowledge of the protocol helps. If you are really hardcore, + you can also use the + \link BMidiLocalProducer::SprayData() SprayData() \endlink to send raw MIDI + events to the consumers. + + At the consumer side, a dedicated thread invokes a hook function for every + incoming MIDI event. For every spray function, there is a corresponding hook + function, e.g. \link BMidiLocalConsumer::NoteOn() NoteOn() \endlink and + \link BMidiLocalConsumer::ControlChange() ControlChange() \endlink. + The hardcore MIDI fanatics among you will be pleased to know that you can + also tap into the \link BMidiLocalConsumer::Data() Data() \endlink hook and + get your hands dirty with the raw MIDI data. + + \section midi2time Time + + The spray and hook functions accept a bigtime_t parameter named "time". This + indicates when the MIDI event should be performed. The time is given in + microseconds since the computer booted. To get the current tick measurement, + you call the system_time() function from the Kernel Kit. + + If you override a hook function in one of your consumer objects, it should + look at the time argument, wait until the designated time, and then perform + its action. The preferred method is to use the Kernel Kit's + snooze_until() function, which sends the consumer thread to + sleep until the requested time has come. (Or, if the time has already + passed, returns immediately.) + + Like this: + + \code +void MyConsumer::NoteOn( + uchar channel, uchar note, uchar velocity, bigtime_t time) +{ + snooze_until(time, B_SYSTEM_TIMEBASE); + ...do your thing... +} + \endcode + + If you want your producers to run in real time, i.e. they produce MIDI data + that needs to be performed immediately, you should pass time 0 to the spray + functions (which also happens to be the default value). Since time 0 has + already passed, snooze_until() returns immediately, and the + consumer will process the events as soon as they are received. + + To schedule MIDI events for a performance time that lies somewhere in the + future, the producer must take into account the consumer's latency. + Producers should attempt to get notes to the consumer by or before + (scheduled_performance_time - latency). The time argument is still + the scheduled performance time, so if your consumer has latency, it should + snooze like this before it starts to perform the events: + + \code +snooze_until(time - Latency(), B_SYSTEM_TIMEBASE); + \endcode + + Note that a typical producer sends out its events as soon as it can; + unlike a consumer, it does not have to snooze. + + \section midi2ports Other Timing Issues + + Each consumer object uses a Kernel Kit port to receive MIDI events from + connected producers. The queue for this port is only 1 message deep. + This means that if the consumer thread is asleep in a + snooze_until(), it will not read its port. Consequently, + any producer that tries to write a new event to this port will block until + the consumer thread is ready to receive a new message. This is intentional, + because it prevents producers from generating and queueing up thousands of + events. + + This mechanism, while simple, puts on the producer the responsibility + for sorting the events in time. Suppose your producer sends three Note + On events, the first on t + 0, the second on t + 4, and the third on t + 2. + This last event won't be received until after t + 4, so it will be two ticks + too late. If this sort of thing can happen with your producer, you should + somehow sort the events before you spray them. Of course, if you have two or + more producers connected to the same consumer, it is nearly impossible to + sort this all out (pardon the pun). So it is not wise to send the same kinds + of events from more than one producer to one consumer at the same time. + + The article Introduction to MIDI, Part 2 in OpenBeOS + Newsletter 36 describes this problem in more detail, and provides a + solution. Go read it now! + + \section midi2filters Writing a Filter + + A typical filter contains a consumer and a producer endpoint. It receives + events from the consumer, processes them, and sends them out again using the + producer. The consumer endpoint is a subclass of BMidiLocalConsumer, whereas + the producer is simply a BMidiLocalProducer, not a subclass. This is a + common configuration, because consumers work by overriding the event hooks + to do work when MIDI data arrives. Producers work by sending an event when + you call their member functions. You should hardly ever need to derive from + BMidiLocalProducer (unless you need to know when the producer gets connected + or disconnected, perhaps), but you'll always have to override one or more of + BMidiLocalConsumer's member functions to do something useful with incoming + data. + + Filters should ignore the time argument from the spray and hook functions, + and simply pass it on unchanged. Objects that only filter data should + process the event as quickly as possible and be done with it. Do not + snooze_until() in the consumer endpoint of a filter! + + \section midi2apidiffs API Differences + + As far as the end user is concerned, the Haiku Midi Kit is mostly the same + as the BeOS R5 kits, although there are a few small differences in the API + (mostly bug fixes): + - BMidiEndpoint::IsPersistent() always returns false. + - The B_MIDI_CHANGE_LATENCY notification is now properly sent. The Be + kit incorrectly set be:op to B_MIDI_CHANGED_NAME, even though the + rest of the message was properly structured. + - If creating a local endpoint fails, you can still Release() the object + without crashing into the debugger. + + \section midi2seealso See also + + More about the Midi Kit: + - \ref Midi2Defs.h + - Be Newsletter Volume 3, Issue 47 - Motor Mix sample code + - Be Newsletter Volume 4, Issue 3 - Overview of the new kit + - Newsletter + 33, Introduction to MIDI, Part 1 + - Newsletter + 36, Introduction to MIDI, Part 2 + - Sample code and other goodies at the + Haiku Midi Kit team page + + Information about MIDI in general: + - MIDI Manufacturers Association + - MIDI Tutorials + - MIDI Specification + - Standard MIDI File Format + - Jim Menard's MIDI Reference + + + \defgroup libmidi2 (libmidi2.so) + + + \defgroup storage Storage Kit + \brief Collection of classes that deal with storing and retrieving + information from disk. + + + \defgroup support Support Kit + \brief Collection of utility classes that are used throughout the API. + + The Support Kit provides a handy set of classes that you can use in your + applications. These classes provide: + - \b Thread \b Safety. Haiku can execute multiple threads of an + application in parallel, letting certain parts of an application + continue when one part is stalled, as well as letting an application + process multiple pieces of data at the same time on multicore or + multiprocessor systems. However, there are times when multiple + threads desire to work on the same piece of data at the same time, + potentially causing a conflict where variables or pointers are + changed by one thread causing another to execute incorrectly. To + prevent this, Haiku implements a \"locking\" mechanism, allowing one + thread to \"lock out\" other threads from executing code that might + modify the same data. + - \b Archiving \b and \b IO. These classes allow a programmer to + convert objects into a form that can more easily be transferred to + other applications or stored to disk, as well as performing basic + input and output operations. + - \b Memory \b Allocation. This class allows a programmer to hand off + some of the duties of memory accounting and management. + - \b Common \b Datatypes. To avoid unnecessary duplication of code + and to make life easier for programmers, Haiku includes classes that + handle management of ordered lists and strings. + + There are also a number of utility functions to time actions, play system + alert sounds, compare strings, and atomically manipulate integers. Have a + look at the overview, or go straight to the complete + \link support list of components \endlink of this kit. + + \section Overview + - Thread Safety: + - BLocker provides a semaphore-like locking mechanism allowing for + recursive locks. + - BAutolock provides a simple method of automatically removing a + lock when a function ends. + - \ref TLS.h "Thread Local Storage" allows a global variable\'s + content to be sensitive to thread context. + - Archiving and IO: + - BArchivable provides an interface for \"archiving\" objects so + that they may be sent to other applications where an identical + copy will be recreated. + - BArchiver simplifies archiving of BArchivable hierarchies. + - BUnarchiver simplifies unarchiving hierarchies that have been + archived using BArchiver. + - BFlattenable provides an interface for \"flattening\" objects so + that they may be easily stored to disk. + - BDataIO provides an interface for generalized read/write streams. + - BPositionIO extends BDataIO to allow seeking within the data. + - BBufferIO creates a buffer and attaches it to a BPositionIO + stream, allowing for reduced load on the underlying stream. + - BMemoryIO allows operation on an already-existing buffer. + - BMallocIO creates and allows operation on a buffer. + - Memory Allocation: + - BBlockCache allows an application to allocate a \"pool\" of + memory blocks that the application can fetch and dispose of as + it pleases, letting the application make only a few large memory + allocations, instead of many small expensive allocations. + - Common Datatypes: + - BList allows simple ordered lists and provides common access, + modification, and comparison functions. + - BString allows strings and provides common access, modification, + and comparison functions. + - BStopWatch allows an application to measure the time an action takes. + - \ref support_globals "Global functions" + - \ref TypeConstants.h "Common types and constants" + - Error codes for all kits + + + \defgroup libbe (libbe.so) + + + \defgroup libroot (libroot.so) */ ///// Subgroups ///// /*! - \defgroup support_globals Global functions in the support kit - \ingroup support + \defgroup support_globals Global functions in the support kit + \ingroup support - \defgroup layout Layout classes in the Interface Kit - \ingroup interface + \defgroup layout Layout classes in the Interface Kit + \ingroup interface */ diff --git a/docs/user/header.html b/docs/user/header.html index 2c0fe5b34d..277802f32e 100644 --- a/docs/user/header.html +++ b/docs/user/header.html @@ -6,7 +6,8 @@ -